Class: Shape

graphics.Shape

Shape

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
Name Type Description
type number
Properties
Name Type Description
Shape.XYZ number

X, Y, Z- Vertex Coordinates

Shape.XYZW number

X, Y, Z, W- Vertex Coordinates

Shape.NXYZ number

X, Y, Z- Normal Coordinates

Shape.RGB number

Red, Green, and Blue Color

Shape.RGBA number

Red, Green, Blue, and Alpha Color

Shape.ST number

S,T Texture Coordinates

data Array(number)
indices Array(number)
attributes Array(Attribute)

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