MeshData represents the raw geometric data of a Mesh. This class has built in properties for common vertex elements, however custom vertex elements can
be added. When a MeshData constructs a vertex buffer, it will sort the vertex elements in the order of their VertexSemantic enumeration and their semantic index.
Keep this in mind when writing shaders, to ensure vertex input layouts match.
The MeshData contains a CPU copy of all data, which it uses when constructing the vertex/index buffers. This data can be used to access geometry
without having to read from the graphics device.
Calling Reconstruct() will completely rebuild the vertex/index buffers and dispose of previously held resources. Do not do this per-frame. MeshData supports
dynamic buffers, and once the buffers are constructed UpdateVertex/IndexData can be used to set data without recreating resources.
Declaration Syntax
C# |
public class MeshData : ISavable
Members
All Members | Constructors | Methods | Properties | ||
|
|
|
Icon | Member | Description |
---|---|---|
MeshData()()()() |
Initializes a new instance of the MeshData class.
|
|
AddBuffer(VertexSemantic, DataBuffer) |
Adds a vertex element to the mesh data's buffer map. Each of these buffers correspond to
all the data for a specific vertex element. This will always set the semantic index to 0.
|
|
AddBuffer(VertexSemantic, Int32, DataBuffer) |
Adds a vertex element to the mesh data's buffer map. Each of these buffers correspond to
all the data for a specific vertex element.
|
|
Binormals |
Gets or sets the vertex binormals (Semantic: Binormal, SemanticIndex: 0)
|
|
BlendIndices |
Gets or sets the vertex blend indices (Semantic: BlendIndices, SemanticIndex: 0)
|
|
BlendWeights |
Gets or sets the vertex blend weights (Semantic: BlendWeight, SemanticIndex: 0)
|
|
BufferCount |
Gets the number of vertex element buffers contained in the mesh data.
|
|
ClearData()()()() |
Clears all data from the mesh data and invalidates vertex/index buffers.
|
|
Colors |
Gets or sets the vertex colors (Semantic: Color, SemanticIndex: 0)
|
|
ContainsBuffer(VertexSemantic) |
Queries if the mesh data's buffer map contains the vertex element buffer that
corresponds to the specified semantic and semantic index of 0.
|
|
ContainsBuffer(VertexSemantic, Int32) |
Queries if the mesh data's buffer map contains the vertex element buffer that
corresponds to the specified semantic and semantic index.
|
|
Equals(Object) |
(Inherited from Object.) |
|
Finalize()()()() |
Allows an Object to attempt to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection. (Inherited from Object.) |
|
GetBuffer(VertexSemantic) |
Gets a vertex element buffer from the mesh data's buffer map. This will always be the vertex element
with semantic index of 0.
|
|
GetBuffer(VertexSemantic, Int32) |
Gets a vertex element buffer from the mesh data's buffer map.
|
|
GetHashCode()()()() |
Serves as a hash function for a particular type. (Inherited from Object.) |
|
GetPrimitive(Int32) |
Gets the vertex position for the primitive specified by its
index in the mesh. Triangles return a list of 3 points and lines of 2 points.
|
|
GetPrimitive(Int32, array<Vector3>[]()[][]) |
Gets the vertex position for the primitive specified by its
index in the mesh. Triangles return a list of 3 points, and lines of 2 points.
|
|
GetPrimitiveIndices(Int32) |
Given the primitive index in this mesh (e.g. the first, second, third triangle,
and so on), return an index array of their vertex information. Supports all
the PrimitiveTypes (so triangles will return 3 points and lines 2 points), as well
as indexed/non-indexed vertex buffers.
Note, if short indices are used they will be returned as Int32's.
|
|
GetPrimitiveIndices(Int32, array<Int32>[]()[][]) |
Given the primitive index in this mesh (e.g. the first, second, third triangle,
and so on), return an index array of their vertex information. Supports all
the PrimitiveTypes (so triangles will return 3 points and lines 2 points), as well
as indexed/non-indexed vertex buffers.
Note, if short indices are used they will be returned as Int32's.
|
|
GetType()()()() |
Gets the Type of the current instance. (Inherited from Object.) |
|
GetVertexIndex(Int32, Int32) |
Given the position of a primitive in the mesh, and an index, get the
indexing used for that primitive's vertex. E.g. for triangles, the pointIndex
index would be 0-2, lines 0-1, points 0.
|
|
IndexBuffer |
Gets the IndexBuffer contained in this mesh data, if it uses indexed primitives.
|
|
IndexBufferDirty |
Gets if the index buffer requires to be reconstructed, due to
data change.
|
|
IndexCount |
Gets the overall index count.
|
|
Indices |
Gets or sets the mesh data's indices. If set, UseIndexedPrimitives
is automatically set.
|
|
MemberwiseClone()()()() |
Creates a shallow copy of the current Object. (Inherited from Object.) |
|
Normals |
Gets or sets the vertex normals (Semantic: Normal, SemanticIndex: 0)
|
|
Positions |
Gets or sets the vertex positions (Semantic: Position, SemanticIndex: 0)
|
|
PrimitiveCount |
Gets the overall primitive count.
|
|
PrimitiveType |
Gets or sets the geometry primitive type.
|
|
Read(ISavableReader) |
Deserializes the object and populates it from the input.
|
|
Reconstruct()()()() |
Constructs the vertex and index buffers according to the vertex element buffers and index
information the mesh data contains at the time of the reconstruction. This typically is done
when the geometry is first being set up or if new vertex elements are added. Updating existing
data should be done via the UpdateVertexData and UpdateIndexData methods, as these allow for
data to be changed without reconstructing hardware resources.
|
|
RemoveBuffer(VertexSemantic) |
Removes a vertex element from the mesh data's buffer map. This will
always remove the buffer associated with the vertex semantic and semantic index of 0.
|
|
RemoveBuffer(VertexSemantic, Int32) |
Removes a vertex element from the mesh data's buffer map.
|
|
Tangents |
Gets or sets the vertex tangents (Semantic: Tangent, SemanticIndex: 0)
|
|
TextureCoordinates |
Gets or sets the vertex texture coordinates (Semantic: TextureCoordinate, SemanticIndex: 0)
|
|
ToString()()()() |
(Inherited from Object.) |
|
TransformNormals(Transform, Boolean) |
Transforms each vertex normal by the specified Scale-Rotation (SR) transform. If the vertex buffer
has been constructed, this updates that, otherwise it just updates the CPU copy.
|
|
TransformNormals(Matrix, Boolean) |
Transforms each vertex normal by the specified Scale-Rotation (SR) matrix. If the vertex buffer
has been constructed, this updates that, otherwise it just updates the CPU copy.
|
|
TransformPositions(Transform) |
Transforms each vertex position by the specified SRT transformation. If the vertex buffer
has been constructed, this updates that, otherwise it just updates the CPU copy.
|
|
TransformPositions(Matrix) |
Transforms each vertex position by the specified matrix transformation. If the vertex buffer
has been constructed, this updates that, otherwise it just updates the CPU copy.
|
|
TranslatePositions(Single, Single, Single) |
Translates position vertex data by adding the specified translation. If the vertex buffer has
been constructed, this updates that, otherwise it just updates the CPU copy.
|
|
TranslatePositions(Vector3) |
Translates position vertex data. If the vertex buffer has been constructed,
this updates that, otherwise it just updates the CPU copy.
|
|
UpdateIndexData<(Of <<'(T>)>>)(DataBuffer<(Of <<'(T>)>>)) |
Updates the MeshData's index data. This applies to both the CPU copy and the GPU (IndexBuffer) copy, if
the latter exists. Error will occur trying to set data that is not valid for index type already
contained in the IndexBuffer.
|
|
UpdateIndexData<(Of <<'(T>)>>)(DataBuffer<(Of <<'(T>)>>), Int32, Int32) |
Updates the MeshData's index data. This applies to both the CPU copy and the GPU (IndexBuffer) copy, if
the latter exists. Error will occur trying to set data that is not valid for index type already
contained in the IndexBuffer.
|
|
UpdateIndexData<(Of <<'(T>)>>)(Int32, DataBuffer<(Of <<'(T>)>>), Int32, Int32) |
Updates the MeshData's index data. This applies to both the CPU copy and the GPU (IndexBuffer) copy, if
the latter exists. Error will occur trying to set data that is not valid for index type already
contained in the IndexBuffer.
|
|
UpdateIndexData<(Of <<'(T>)>>)(DataBuffer<(Of <<'(T>)>>), DataWriteOptions) |
Updates the MeshData's index data. This applies to both the CPU copy and the GPU (IndexBuffer) copy, if
the latter exists. Error will occur trying to set data that is not valid for index type already
contained in the IndexBuffer.
|
|
UpdateIndexData<(Of <<'(T>)>>)(DataBuffer<(Of <<'(T>)>>), Int32, Int32, DataWriteOptions) |
Updates the MeshData's index data. This applies to both the CPU copy and the GPU (IndexBuffer) copy, if
the latter exists. Error will occur trying to set data that is not valid for index type already
contained in the IndexBuffer.
|
|
UpdateIndexData<(Of <<'(T>)>>)(Int32, DataBuffer<(Of <<'(T>)>>), Int32, Int32, DataWriteOptions) |
Updates the MeshData's index data. This applies to both the CPU copy and the GPU (IndexBuffer) copy, if
the latter exists. Error will occur trying to set data that is not valid for index type already
contained in the IndexBuffer.
|
|
UpdatePrimitiveCount()()()() |
Updates the primitive count by using either index or vertex
data, depending on if indexed primitives compose the mesh data.
|
|
UpdateVertexCount()()()() |
Updates the number of vertices contained in the mesh data.
|
|
UpdateVertexData<(Of <<'(T>)>>)(VertexSemantic, DataBuffer<(Of <<'(T>)>>)) |
Updates the MeshData's vertex data. This applies to both the CPU copy and the GPU (VertexxBuffer) copy, if
the latter exists. Error will occur trying to set data that is not valid (either did not exist with an
already constructed vertex buffer, or type mismatch)
|
|
UpdateVertexData<(Of <<'(T>)>>)(VertexSemantic, DataBuffer<(Of <<'(T>)>>), Int32, Int32) |
Updates the MeshData's vertex data. This applies to both the CPU copy and the GPU (VertexxBuffer) copy, if
the latter exists. Error will occur trying to set data that is not valid (either did not exist with an
already constructed vertex buffer, or type mismatch)
|
|
UpdateVertexData<(Of <<'(T>)>>)(VertexSemantic, Int32, DataBuffer<(Of <<'(T>)>>), Int32, Int32) |
Updates the MeshData's vertex data. This applies to both the CPU copy and the GPU (VertexxBuffer) copy, if
the latter exists. Error will occur trying to set data that is not valid (either did not exist with an
already constructed vertex buffer, or type mismatch)
|
|
UpdateVertexData<(Of <<'(T>)>>)(VertexSemantic, DataBuffer<(Of <<'(T>)>>), DataWriteOptions) |
Updates the MeshData's vertex data. This applies to both the CPU copy and the GPU (VertexxBuffer) copy, if
the latter exists. Error will occur trying to set data that is not valid (either did not exist with an
already constructed vertex buffer, or type mismatch)
|
|
UpdateVertexData<(Of <<'(T>)>>)(VertexSemantic, DataBuffer<(Of <<'(T>)>>), Int32, Int32, DataWriteOptions) |
Updates the MeshData's vertex data. This applies to both the CPU copy and the GPU (VertexxBuffer) copy, if
the latter exists. Error will occur trying to set data that is not valid (either did not exist with an
already constructed vertex buffer, or type mismatch)
|
|
UpdateVertexData<(Of <<'(T>)>>)(VertexSemantic, Int32, DataBuffer<(Of <<'(T>)>>), Int32, Int32, DataWriteOptions) |
Updates the MeshData's vertex data. This applies to both the CPU copy and the GPU (VertexxBuffer) copy, if
the latter exists. Error will occur trying to set data that is not valid (either did not exist with an
already constructed vertex buffer, or type mismatch)
|
|
UpdateVertexData<(Of <<'(T>)>>)(VertexSemantic, Int32, Int32, DataBuffer<(Of <<'(T>)>>), Int32, Int32, DataWriteOptions) |
Updates the MeshData's vertex data. This applies to both the CPU copy and the GPU (VertexxBuffer) copy, if
the latter exists. Error will occur trying to set data that is not valid (either did not exist with an
already constructed vertex buffer, or type mismatch)
|
|
UseDynamicIndexBuffer |
Gets or sets if the geometry should use a dynamic index buffer.
|
|
UseDynamicVertexBuffer |
Gets or sets if the geometry should use a dynamic vertex buffer.
|
|
UseIndexedPrimitives |
Gets or sets if the geometry should be indexed data.
|
|
UsingShortIndices |
Gets if the mesh data is using 16-bit indices, otherwise they are 32-bit.
|
|
VertexBuffer |
Gets the VertexBuffer contained in this mesh data.
|
|
VertexBufferDirty |
Gets if the vertex buffer requires to be reconstructed, due to
data change.
|
|
VertexCount |
Gets the overall vertex count.
|
|
Write(ISavableWriter) |
Serializes the object and writes it to the output.
|
Inheritance Hierarchy
Object | |
MeshData |
Assembly: Tesla (Module: Tesla) Version: 0.5.0.0 (0.5.0.0)