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. |
Properties:
Name | Type | Description |
---|---|---|
elementType |
An |
Members
-
<static> DEFAULT_VERTEX_SIZE
-
The vertex stride for meshes created with
Mesh#createDefaultEmpty
-
bounds
-
The object-space bounding volume. Setting this value only changes the type of volume.
-
dynamicBounds
-
The object-space bounding volume. Setting this value only changes the type of volume.
-
hasMorphData
-
Whether or not this Mesh supports morph target animations. This is the case if
Mesh#generateMorphData
was called. -
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.
Methods
-
<static> createDefaultEmpty()
-
Creates an empty Mesh with a default layout.
-
addMorphTarget()
-
Adds a MorphTarget object for animators to work with.
-
addVertexAttribute(name, numComponents, streamIndex, normalized)
-
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
normalized
[Optional] Whether or not the input of the attribute should be normalized to [-1, 1]
-
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.
-
getMorphTarget(index)
-
Gets the morph target by name.
Parameters:
Name Type Description index
name The name of the
MorphTarget
Returns:
- Type
- MorphTarget
-
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
-
hasVertexAttribute()
-
Returns whether the Mesh has a vertex attribute with the given name.
-
hasVertexData()
-
Returns whether or not vertex data was uploaded to the given stream index.
-
removeMorphTarget()
-
Adds a MorphTarget object for animators to work with.
-
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.