TriMesh class

A TriMesh contains raw data that can be used by GPU directly. This class is a utility to help to construct a mesh that only contains per-vertex data.

public class TriMesh : Entity, IEnumerable<Vertex>


Name Description
TriMesh(string, VertexDeclaration) Initialize an instance of TriMesh


Name Description
Capacity { get; } The capacity of pre-allocated vertices.
Excluded { get; set; } Gets or sets whether to exclude this entity during exporting.
IndicesCount { get; } The count of indices in this TriMesh
virtual Name { get; set; } Gets or sets the name.
ParentNode { get; set; } Gets or sets the first parent node, if set the first parent node, this entity will be detached from other parent nodes.
ParentNodes { get; } Gets all parent nodes, an entity can be attached to multiple parent nodes for geometry instancing
Properties { get; } Gets the collection of all properties.
Scene { get; } Gets the scene that this object belongs to
UnmergedVerticesCount { get; } The count of unmerged vertices that passed in by BeginVertex and EndVertex.
VertexDeclaration { get; } The vertex layout of the TriMesh.
VerticesCount { get; } The count of vertices in this TriMesh
VerticesSizeInBytes { get; } The total size of all vertices in bytes


Name Description
static CopyFrom(TriMesh, VertexDeclaration) Copy the TriMesh from input with new vertex layout
static FromMesh(Mesh, bool) Create a TriMesh from given mesh object, the vertex declaration are based on the input mesh’s structure.
static FromMesh(VertexDeclaration, Mesh) Create a TriMesh from given mesh object with given vertex layout.
static FromRawData(VertexDeclaration, byte[], int[], bool) Create TriMesh from raw data
BeginVertex() Begin adding vertex
EndVertex() End adding vertex
FindProperty(string) Finds the property. It can be a dynamic property (Created by CreateDynamicProperty/SetProperty) or native property(Identified by its name)
GetBoundingBox() Gets the bounding box of current entity in its object space coordinate system.
virtual GetEntityRendererKey() Gets the key of the entity renderer registered in the renderer
GetEnumerator() Get the enumerator to enumerate Vertex
GetProperty(string) Get the value of specified property
IndicesToArray(out int[])
IndicesToArray(out ushort[])
LoadVerticesFromBytes(byte[]) Load vertices from bytes, the length of bytes must be an integer multiple of vertex size.
ReadDouble(int, VertexField) Read the double field
ReadFloat(int, VertexField) Read the float field
ReadFVector2(int, VertexField) Read the vector2 field
ReadFVector3(int, VertexField) Read the vector3 field
ReadFVector4(int, VertexField) Read the vector4 field
ReadVector2(int, VertexField) Read the vector2 field
ReadVector3(int, VertexField) Read the vector3 field
ReadVector4(int, VertexField) Read the vector4 field
RemoveProperty(Property) Removes a dynamic property.
RemoveProperty(string) Remove the specified property identified by name
SetProperty(string, object) Sets the value of specified property
override ToString() Gets the string representation of TriMesh
VerticesToArray() Convert the vertices data to byte array
Write16bIndicesTo(Stream) Write the indices data as 16bit integer to the stream
Write32bIndicesTo(Stream) Write the indices data as 32bit integer to the stream
WriteVerticesTo(Stream) Write vertices data to the specified stream

See Also