Creates a new MeshBuilder with the specified vertex layout.
Layout is given as a list of "attribute" objects with the following properties:
name - Attribute name components - Size of the attribute (how many float values it uses)
var builder = new MeshBuilder([
// vertex position (x,y,z)
{ name: "position", components: 3 },
// normal vector (x,y,z)
{ name: "normal", components: 3 },
// texture UV (u,v)
{ name: "texture0", components: 2 },
]);
The index data type used by this MeshBuilder. MeshIndexType.UInt16
is the value normally used for this.
The topology type used for the mesh.
Appends indices to the index list.
Takes a list of list of vertex values according to the layout.
Similar to appendVertices
, but takes all values in one large array.
Static
createRemoves all indices starting at index from
and ending before index to
.
Removes all vertex data starting at vertex index from
and ending before vertex index to
.
Returns the number of indices in the index list.
Returns a RenderMesh asset that can be applied to a MeshVisual's mesh
property. This asset stays linked to the MeshBuilder that provided it, so making changes to the mesh data and calling updateMesh()
will update the RenderMesh as well.
Returns the number of vertices in the vertex list.
Checks whether the current data entered will create a valid mesh.
Sets data for a single vertex at vertex index index
.
Rebuilds the MeshAsset controlled by this MeshBuilder using the current mesh data.
A class for generating meshes at runtime.
Example
Quad Mesh Example
Cube Mesh Example