class MeshWeightedTriangles

Calculates and stores per-triangle weights that can be used for easily picking a random triangle on a mesh, ensuring larger triangles are picked more likely.

Public

Constructors

MeshWeightedTriangles

MeshWeightedTriangles() = default

MeshWeightedTriangles

MeshWeightedTriangles(const MeshData &meshData)

Methods

Calculate

void Calculate(const MeshData &meshData)

Updates the weights from the provided mesh data.

GetTriangle

void GetTriangle(const Random &random, std::array<u32, 3> &indices) const

Find a random triangle on the mesh and outputs its vertex indices.

Private

Fields

mWeights

Vector<TriangleWeight> mWeights