new Mesh(vertexUsage, indexUsage)
Parameters:
Name | Type | Description |
---|---|---|
vertexUsage |
BufferUsage | A usage hint for the vertex buffer. |
indexUsage |
BufferUsage | A usage hint for the index buffer. |
Members
-
<static> DEFAULT_VERTEX_SIZE
-
The vertex stride for meshes created with
Mesh#createDefaultEmpty
-
hasMorphData
-
Whether or not this Mesh supports morph target animations. This is the case if
Mesh#generateMorphData
was called. -
indexUsage
-
A usage hint for the index buffer.
- See:
-
numIndices
-
The amount of face indices contained in the Mesh.
-
numStreams
-
The amount of streams (vertex buffers) used for this Mesh/
-
numVertexAttributes
-
The amount of vertex attributes contained in the Mesh.
-
numVertices
-
The amount of vertices contained in the Mesh.
-
vertexUsage
-
A usage hint for the vertex buffer.
- See:
Methods
-
<static> createDefaultEmpty()
-
Creates an empty Mesh with a default layout.
-
addVertexAttribute(name, numComponents, streamIndex)
-
Adds a named vertex attribute. All properties are given manually to make it easier to support multiple streams in the future.
Parameters:
Name Type Description name
The name of the attribute, matching the attribute name used in the vertex shaders.
numComponents
The amount of components used by the attribute value.
streamIndex
[Optional] The stream index indicating which vertex buffer is used, defaults to 0
-
clone()
-
Returns a duplicate of this Mesh.
-
extractAttributeData()
-
Extracts the vertex attribute data for the given attribute name as a flat Array.
-
generateMorphData()
-
Generates the required data to support morph target animations.
-
getIndexData()
-
Returns the index data uploaded to the index buffer.
-
getVertexAttributeByIndex()
-
Gets the vertex attribute data according to the index.
-
getVertexAttributeByName()
-
Gets the vertex attribute data according to the attribute name.
-
getVertexData()
-
Gets the vertex data for a given stream.
-
getVertexStride()
-
Gets the vertex stride (number of components used per stream per vertex) for a given stream
-
hasVertexData()
-
Returns whether or not vertex data was uploaded to the given stream index.
-
setIndexData()
-
Uploads index data from an Array or a Uint16Array
-
setVertexData()
-
Uploads vertex data from an Array or a Float32Array. This method must be called after the layout for the stream has been finalized using setVertexAttribute calls. The data in the stream should be an interleaved array of floats, with each attribute data in the order specified with the setVertexAttribute calls.