Class mesh
mesh
Defined in: mesh.js.
Constructor Attributes | Constructor Name and Description |
---|---|
mesh()
3D object defined by triangle primitives.
|
Field Attributes | Field Name and Description |
---|---|
Number of vertices that belong to this mesh.
|
Method Attributes | Method Name and Description |
---|---|
addObject(object)
Adds a faceList to the mesh.
|
|
defineVertices(attribute, data)
Explicitly defines the vertices of the mesh.
|
|
getObject(i)
Retrieves the i'th face list requested.
|
|
getVertex(vertexIndex, attribute)
Gets the data for the requested vertex.
|
|
Returns the number of face lists that this mesh contains.
|
|
removeObject(i)
Removes the meshObject requested.
|
|
setVertex(vertexIndex, attribute, newData)
Sets the data for the requested vertex.
|
Class Detail
mesh()
3D object defined by triangle primitives.
A mesh contains 2 components: the Mesh itself and a series of faces (face list).
The mesh itself provides the base data: vertex positions, normals,
UVs, you name it. A face list actually
Using the mesh - meshObject reloationship aptly can allow for flexible
control over performance vs. memory cost.
Field Detail
vertexCount
Number of vertices that belong to this mesh. vertex count must be set before
starting to modify vertices.
Method Detail
addObject(object)
Adds a faceList to the mesh. When drawn, to the
faceList will refer to vertices of this mesh.
- Parameters:
- {Array} object
- The face list to add. If no argument is given, an empty mesh object is added. The array is an array of indices into the mesh's vertices
defineVertices(attribute, data)
Explicitly defines the vertices of the mesh.
This overwrites any previous geometry data. The array of data
must match numVertices in lenght or the request will be rejected.
The numbe rof floats per vertex depends on the given sandboxe.mesh.vertexAttribute
- Parameters:
- {Number} attribute
- The attribute . See sandboxe.mesh.vertexAttribute
- {Array} data
- The array of values to read from.
{Array}
getObject(i)
Retrieves the i'th face list requested.
- Parameters:
- {Number} i
- Returns:
- {Array}
{Array}
getVertex(vertexIndex, attribute)
Gets the data for the requested vertex.
- Parameters:
- {Number} vertexIndex
- The index of the vertex to get info for.
- {Number} attribute
- The attribute to request.
- Returns:
- {Array} The data for the vertex requested.
{Number}
numObjects()
Returns the number of face lists that this mesh contains.
- Returns:
- {Number} Count of face lists.
removeObject(i)
Removes the meshObject requested.
- Parameters:
- {Number} i
setVertex(vertexIndex, attribute, newData)
Sets the data for the requested vertex.
- Parameters:
- {Number} vertexIndex
- The index of the vertex to get info for.
- {Number} attribute
- The attribute to request.
- {Array} newData
- The data for the vertex requested.