Constructor
new Shape()
Shape: Graphical object defined by geometries (Vertex Data) and a rendering style (Shader Program).
The classical way to create a shape in Mowgli is:
var shape = new Shape();
shape.type = 'POINTS';
var vrtxData = {
'content': Shape.XYZ | Shape.RGB,
'data':vertices,
'attributes': [new Attribute("aVertexPosition",0,6), new Attribute("aVertexColor",3,6)]
};
shape.addVertexData(vrtxData);
shape.setProgram(shaderProgram);
Extends
- Leaf
Methods
addVertexData(a_geom)
Add Vertex Data.
These data may contain:
- Coordinates
- Normals
- Colors
- Indices
- And/or texture coordinates.
Parameters:
Name | Type | Description |
---|---|---|
a_geom |
VertexData | Contains all the data describing the vertices of this shape |
Properties:
Name | Type | Description | ||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
a_geom |
VertexData |
Properties
|
isIndexedGeometry() → {boolean}
Flag indicating if this shape contains indexed geometries
Returns:
- Type
- boolean
setCentroid(cg)
Set centroid
Parameters:
Name | Type | Description |
---|---|---|
cg |
Point3D | Centroid |
setProgram(a_program)
Set Program
Parameters:
Name | Type | Description |
---|---|---|
a_program |
Program | A shader program defining the rendering style |