class RendererMeshData

Inherits: IScriptExportable

Contains mesh vertex and index data used for initializing, updating and reading mesh data from Mesh.

Public

Methods

GetPositions

void GetPositions(Vector3 *buffer, u32 size)

Reads the vertex positions into the provided output buffer.

Data will be copied and potentially uncompressed to fit the output format as needed.

buffer
Pre-allocated buffer to output the position data to.
size
Size of the pre-allocated buffer. Must be big enough to fit all contents (numVertices * sizeof(Vector3)).

SetPositions

void SetPositions(Vector3 *buffer, u32 size)

Writes the vertex positions from the provided output buffer.

Data will be copied and potentially compressed to fit the internal mesh data format as needed.

buffer
Pre-allocated buffer to read the position data from.
size
Size of the input buffer. Must be (numVertices * sizeof(Vector3)).

GetNormals

void GetNormals(Vector3 *buffer, u32 size)

Reads the vertex normals into the provided output buffer.

Data will be copied and potentially uncompressed to fit the output format as needed.

buffer
Pre-allocated buffer to output the normal data to.
size
Size of the pre-allocated buffer. Must be big enough to fit all contents (numVertices * sizeof(Vector3)).

SetNormals

void SetNormals(Vector3 *buffer, u32 size)

Writes the vertex normals from the provided output buffer.

Data will be copied and potentially compressed to fit the internal mesh data format as needed.

buffer
Pre-allocated buffer to read the normal data from.
size
Size of the input buffer. Must be (numVertices * sizeof(Vector3)).

GetTangents

void GetTangents(Vector4 *buffer, u32 size)

Reads the vertex tangents into the provided output buffer.

Data will be copied and potentially uncompressed to fit the output format as needed.

buffer
Pre-allocated buffer to output the tangent data to.
size
Size of the pre-allocated buffer. Must be big enough to fit all contents (numVertices * sizeof(Vector4)).

SetTangents

void SetTangents(Vector4 *buffer, u32 size)

Writes the vertex tangents from the provided output buffer.

Data will be copied and potentially compressed to fit the internal mesh data format as needed.

buffer
Pre-allocated buffer to read the tangent data from.
size
Size of the input buffer. Must be (numVertices * sizeof(Vector4)).

GetColors

void GetColors(Color *buffer, u32 size)

Reads the vertex colors into the provided output buffer.

Data will be copied and potentially uncompressed to fit the output format as needed.

buffer
Pre-allocated buffer to output the color data to.
size
Size of the pre-allocated buffer. Must be big enough to fit all contents (numVertices * sizeof(Color)).

SetColors

void SetColors(Color *buffer, u32 size)

Writes the vertex colors from the provided output buffer.

Data will be copied and potentially compressed to fit the internal mesh data format as needed.

buffer
Pre-allocated buffer to read the color data from.
size
Size of the input buffer. Must be (numVertices * sizeof(Color)).

SetColors

void SetColors(u32 *buffer, u32 size)

Writes the vertex colors from the provided output buffer.

Data will be copied and potentially compressed to fit the internal mesh data format as needed.

buffer
Pre-allocated buffer to read the color data from. Colors should be in RGBA format.
size
Size of the input buffer. Must be (numVertices * sizeof(u32)).

GetUV0

void GetUV0(Vector2 *buffer, u32 size)

Reads the first UV channel coordinates into the provided output buffer.

Data will be copied and potentially uncompressed to fit the output format as needed.

buffer
Pre-allocated buffer to output the coordinate data to.
size
Size of the pre-allocated buffer. Must be big enough to fit all contents (numVertices * sizeof(Vector2)).

SetUV0

void SetUV0(Vector2 *buffer, u32 size)

Writes the first UV channel coordinates from the provided output buffer.

Data will be copied and potentially compressed to fit the internal mesh data format as needed.

buffer
Pre-allocated buffer to read the coordinate data from.
size
Size of the input buffer. Must be (numVertices * sizeof(Vector2)).

GetUV1

void GetUV1(Vector2 *buffer, u32 size)

Reads the second UV channel coordinates into the provided output buffer.

Data will be copied and potentially uncompressed to fit the output format as needed.

buffer
Pre-allocated buffer to output the coordinate data to.
size
Size of the pre-allocated buffer. Must be big enough to fit all contents (numVertices * sizeof(Vector2)).

SetUV1

void SetUV1(Vector2 *buffer, u32 size)

Writes the second UV channel coordinates from the provided output buffer.

Data will be copied and potentially compressed to fit the internal mesh data format as needed.

buffer
Pre-allocated buffer to read the coordinate data from.
size
Size of the input buffer. Must be (numVertices * sizeof(Vector2)).

GetBoneWeights

void GetBoneWeights(BoneWeight *buffer, u32 size)

Reads the bone weights and indices into the provided output buffer.

Data will be copied and potentially uncompressed to fit the output format as needed.

buffer
Pre-allocated buffer to output the bone weight data to.
size
Size of the pre-allocated buffer. Must be big enough to fit all contents (numVertices * sizeof(BoneWeight)).

SetBoneWeights

void SetBoneWeights(BoneWeight *buffer, u32 size)

Writes the bone weights and indices from the provided output buffer.

Data will be copied and potentially compressed to fit the internal mesh data format as needed.

buffer
Pre-allocated buffer to read the bone weight data from.
size
Size of the input buffer. Must be (numVertices * sizeof(BoneWeight)).

GetIndices

void GetIndices(u32 *buffer, u32 size)

Reads the indices into the provided output buffer.

Data will be copied and potentially uncompressed to fit the output format as needed.

buffer
Pre-allocated buffer to output the index data to.
size
Size of the pre-allocated buffer. Must be big enough to fit all contents (numVertices * sizeof(i32)).

SetIndices

void SetIndices(u32 *buffer, u32 size)

Writes the indices from the provided output buffer.

Data will be copied and potentially compressed to fit the internal mesh data format as needed.

buffer
Pre-allocated buffer to read the index data from.
size
Size of the input buffer. Must be (numVertices * sizeof(i32)).

GetData

SPtr<MeshData> GetData() const

Returns the underlying MeshData structure.

staticCreate

static SPtr<RendererMeshData> Create(u32 numVertices, u32 numIndices, VertexLayout layout, IndexType indexType = IT_32BIT)

Creates a new empty mesh data structure.

staticCreate

static SPtr<RendererMeshData> Create(const SPtr<MeshData> &meshData)

Creates a new mesh data structure using an existing mesh data buffer.

staticVertexLayoutVertexDesc

static SPtr<VertexDescription> VertexLayoutVertexDesc(VertexLayout type)

Creates a vertex descriptor from a vertex layout enum.

staticConvert

static SPtr<MeshData> Convert(const SPtr<MeshData> &meshData)

Converts a generic mesh data into mesh data format expected by the renderer.

Private

Constructors

RendererMeshData

RendererMeshData(u32 numVertices, u32 numIndices, VertexLayout layout, IndexType indexType = IT_32BIT)

RendererMeshData

RendererMeshData(const SPtr<MeshData> &meshData)

Fields

mMeshData

SPtr<MeshData> mMeshData