class MeshEmissionHelper

Contains common functionality for particle mesh emitters.

Public

Methods

Initialize

bool Initialize(const HMesh &mesh, bool perVertex, bool skinning)

Initializes the emission helper if the provided mesh contains necessary data for particle emission.

Otherwise reports any issues in the log.

mesh
Mesh to validate.
perVertex
Set to true if particle emission is happening on mesh vertices.
skinning
Set to true if the mesh will be animated using skinning.

Returns: True if initialized, or false if issues were detected.

GetSequentialVertex

void GetSequentialVertex(Vector3 &position, Vector3 &normal, u32 &idx) const

Returns the next sequential vertex on the mesh and increments the internal counter so the next vertex is returned on the following call.

Loops around if end is reached. Returns vertex position, normal and index.

GetRandomVertex

void GetRandomVertex(const Random &random, Vector3 &position, Vector3 &normal, u32 &idx) const

Randomly picks a vertex on the mesh and returns its position, normal and index.

GetRandomEdge

void GetRandomEdge(const Random &random, std::array<Vector3, 2> &position, std::array<Vector3, 2> &normal, std::array<u32, 2> &idx) const

Randomly picks an edge on the mesh and returns the position, normal and indices of its vertices.

GetRandomTriangle

void GetRandomTriangle(const Random &random, std::array<Vector3, 3> &position, std::array<Vector3, 3> &normal, std::array<u32, 3> &idx) const

Randomly picks an triangle on the mesh and returns the position, normal and indices of its vertices.

GetBlendMatrix

Matrix4 GetBlendMatrix(const Matrix4 *bones, u32 vertexIdx) const

Evaluates a blend matrix for a vertex at the specified index.

Private

Fields

mWeightedTriangles

MeshWeightedTriangles mWeightedTriangles

mVertices

u8 * mVertices

mNormals

u8 * mNormals

mNumVertices

u32 mNumVertices

mVertexStride

u32 mVertexStride

m32BitNormals

bool m32BitNormals

mBoneIndices

u8 * mBoneIndices

mBoneWeights

u8 * mBoneWeights

mMeshData

SPtr<MeshData> mMeshData

mNextSequentialIdx

u32 mNextSequentialIdx