class
Mesh
Primary class for holding geometry.
Stores data in the form of vertex buffers and optionally an index buffer, which may be bound to the pipeline for drawing. May contain multiple sub-meshes.
Public
Methods
~Mesh
Initialize
Initializes all the internal data of this object.
Must be called right after construction for new objects, or after deserialization for deserialized objects. If requested, render proxy is created and queued for initialization on the render thread.
WriteData
Updates the mesh with new data.
Provided data buffer will be locked until the operation completes.
- data
- Data of valid size and format to write to the subresource.
- discardEntireBuffer
- When true the existing contents of the resource you are updating will be discarded. This can make the operation faster. Resources with certain buffer types might require this flag to be in a specific state otherwise the operation will fail.
Returns: Async operation object you can use to track operation completion.
ReadData
Reads internal mesh data to the provided previously allocated buffer.
Provided data buffer will be locked until the operation completes.
- data
- Pre-allocated buffer of proper vertex/index format and size where data will be read to. You can use allocBuffer() to allocate a buffer of a correct format and size.
Returns: Async operation object you can use to track operation completion.
AllocBuffer
Allocates a buffer that exactly matches the size of this mesh.
This is a helper function, primarily meant for creating buffers when reading from, or writing to a mesh.
GetCachedData
Returns mesh data cached in the system memory.
If the mesh wasn't created with CPU cached usage flag this method will not return any data. Caller should not modify the returned data.
GetSkeleton
Gets the skeleton required for animation of this mesh, if any is available.
GetMorphShapes
Returns an object containing all shapes used for morph animation, if any are available.
staticDummy
Returns a dummy mesh, containing just one triangle.
Don't modify the returned mesh.
staticGetRttiStatic
staticCreate
Creates a new empty mesh.
Created mesh will have no sub-meshes.
- vertexCount
- Number of vertices in the mesh.
- indexCount
- Number of indices in the mesh.
- vertexDescription
- Vertex description structure that describes how are vertices organized in the vertex buffer. When binding a mesh to the pipeline you must ensure vertex description at least partially matches the input description of the currently bound vertex GPU program.
- flags
- Flags to control various mesh options.
- primitiveType
- Determines how should the provided indices be interpreted by the pipeline. Default option is a triangle list, where three indices represent a single triangle.
- indexType
- Size of indices, use smaller size for better performance, however be careful not to go over the number of vertices limited by the size.
staticCreate
Creates a new empty mesh.
- meshCreateInformation
- Descriptor containing the properties of the mesh to create.
staticCreate
Creates a new mesh from an existing mesh data.
Created mesh will match the vertex and index buffers described by the mesh data exactly. Mesh will have no sub-meshes.
- initialData
- Vertex and index data to initialize the mesh with.
- meshCreateInformation
- Descriptor containing the properties of the mesh to create. Vertex and index count, vertex descriptor and index type properties are ignored and are read from provided mesh data instead.
staticCreate
Creates a new mesh from an existing mesh data.
Created mesh will match the vertex and index buffers described by the mesh data exactly. Mesh will have no sub-meshes.
- initialData
- Vertex and index data to initialize the mesh with.
- flags
- Flags to control various mesh options.
- primitiveType
- Determines how should the provided indices be interpreted by the pipeline. Default option is a triangle strip, where three indices represent a single triangle.
Internal
Methods
Protected
Constructors
Mesh
Mesh
Methods
UpdateBounds
Updates bounds by calculating them from the vertices in the provided mesh data object.
CreateRenderProxy
Creates an object that contains render thread specific data and methods for this object.
Can be null if such object is not required.
CreateCpuBuffer
Creates buffers used for caching of CPU mesh data.
UpdateCpuBuffer
Updates the cached CPU buffers with new data.
Fields
mCPUData
mVertexDescription
mFlags
mIndexType
mSkeleton
mMorphShapes
Private
Constructors
Mesh
*********************************************************************