RenderWare::Mesh struct

A structure that represents a basic mesh, made up of vertices and triangles.

By default it only has one vertex buffer, you can have more by using Mesh_ . A vertex and index buffer can be shared by multiple meshes, as each mesh specifies the vertex and index count. See IndexBuffer and VertexBuffer for more information.

Derived classes

template<int numBuffers = 1>
struct Mesh_

Public static variables

static const uint32_t TYPE

Constructors, destructors, conversion operators

Mesh()

Public functions

auto CalculateTriangleCount(D3DPRIMITIVETYPE primitiveType) -> size_t
Returns the number of triangles this mesh would use if the primitive type was the one specified.
void SetIndexBuffer(IndexBuffer* pBuffer)
Sets the IndexBuffer used by this mesh.
void SetIndicesCount(size_t nIndicesCount)
Sets the number of indicies used in this mesh.
void SetVertexBuffer(size_t nIndex, VertexBuffer* pVertexBuffer)
Sets the VertexBuffer used by this mesh at the given index.
void Render()
Renders this mesh.

Public variables

int instancedSize
D3DPRIMITIVETYPE primitiveType
IndexBuffer* pIndexBuffer
size_t triangleCount
size_t vertexBuffersCount
size_t firstIndex
size_t indicesCount
size_t firstVertex
size_t vertexCount
VertexBuffer* pVertexBuffers

Function documentation

size_t RenderWare::Mesh::CalculateTriangleCount(D3DPRIMITIVETYPE primitiveType)

Returns the number of triangles this mesh would use if the primitive type was the one specified.

Parameters
primitiveType The type of primitive, in the D3DPRIMITIVETYPE enum.

void RenderWare::Mesh::SetIndexBuffer(IndexBuffer* pBuffer)

Sets the IndexBuffer used by this mesh.

Parameters
pBuffer The new IndexBuffer.

The primitive type will be set to use the one the buffer uses. CalculateTriangleCount(D3DPRIMITIVETYPE) will be called to update the triangle count.

void RenderWare::Mesh::SetIndicesCount(size_t nIndicesCount)

Sets the number of indicies used in this mesh.

Parameters
nIndicesCount The new number of indices.

The primitive type will be set to use the one the index buffer uses. CalculateTriangleCount(D3DPRIMITIVETYPE) will be called to update the triangle count.

void RenderWare::Mesh::SetVertexBuffer(size_t nIndex, VertexBuffer* pVertexBuffer)

Sets the VertexBuffer used by this mesh at the given index.

Parameters
nIndex The index of the VertexBuffer, usually 0.
pVertexBuffer The VertexBuffer to use.

Meshes can use multiple vertex buffers, although usually only one is used. The index is expected to be lower than the amount of buffers specified using the templated parameter. The primitive type will be set to use the one the index buffer uses. CalculateTriangleCount(D3DPRIMITIVETYPE) will be called to update the triangle count.

void RenderWare::Mesh::Render()

Renders this mesh.

This will use the material set in the Renderer.