Skip to main content

MeshIndices

The MeshIndices class encapsulates index data used by mesh geometries to define how vertices are connected into primitives such as points, lines, triangles, and more complex topologies like quadrilaterals and tetrahedrons. Each MeshIndices instance has a specific type and format, allowing for flexible representation of both renderable geometry and auxiliary information like materials, groups, joints, and edges.

#include <format/TellusimMesh.h>

Constructors

explicit MeshIndices(const char *name = nullptr)
MeshIndices(Type type, Format format, const char *name = nullptr)
MeshIndices(Type type, Format format, uint32_t size, const char *name = nullptr)

Methods

Clear indices.

void clear()

Indices name.

void setName(const char *name)
String getName() const

Create indices.

void create(Type type, Format format, uint32_t size = 0)

Indices type.

Type getType() const
static const char *getTypeName(Type type)
const char *getTypeName() const
bool isUnknown() const
bool isPoint() const
bool isLine() const
bool isTriangle() const
bool isQuadrilateral() const
bool isTetrahedron() const
bool isPrimitive() const
bool isSolid() const
bool isVolume() const
bool isMaterial() const
bool isGroup() const
bool isJoint() const
bool isEdge() const
uint32_t getPrimitiveSize() const

Indices format.

Format getFormat() const
const char *getFormatName() const

Indices geometry.

void setGeometry(MeshGeometry &geometry, bool check = true)
const MeshGeometry getGeometry() const
MeshGeometry getGeometry()

Indices size.

void setSize(uint32_t size, bool discard = true, bool clear = false)
uint32_t getSize() const
uint32_t getStride() const
size_t getBytes() const

Indices data.

void setData(uint32_t value, uint32_t size = 0, uint32_t offset = 0)
void setData(const void *src, Format format = FormatUnknown, uint32_t size = 0, uint32_t repeat = 1)
void getData(void *dest, Format format = FormatUnknown, uint32_t size = 0, uint32_t repeat = 1) const
const void *getData() const
void *getData()

Indices values.

void set(uint32_t index, uint32_t value)
void set(uint32_t index, uint32_t value_0, uint32_t value_1)
void set(uint32_t index, uint32_t value_0, uint32_t value_1, uint32_t value_2)
void set(uint32_t index, uint32_t value_0, uint32_t value_1, uint32_t value_2, uint32_t value_3)
uint32_t get(uint32_t index) const
void get(uint32_t index, uint32_t &value_0, uint32_t &value_1) const
void get(uint32_t index, uint32_t &value_0, uint32_t &value_1, uint32_t &value_2) const
void get(uint32_t index, uint32_t &value_0, uint32_t &value_1, uint32_t &value_2, uint32_t &value_3) const

Indices pointers.

const void *getPtr(uint32_t index) const
void *getPtr(uint32_t index)

Direct indices flag.

bool isDirect() const

Uniform indices flag.

bool isUniform() const

Indices range.

uint32_t getMinIndex() const
uint32_t getMaxIndex() const

Compare indices.

int32_t compare(const MeshIndices &indices) const

Add indices.

void addIndices(const MeshIndices &indices, uint32_t offset, bool expand = false)

Convert indices to format.

MeshIndices toFormat(Format format) const

Convert indices to type.

MeshIndices toType(Type type) const
MeshIndices toType(Type type, const MeshAttribute &position_attribute) const

Memory usage.

size_t getMemory() const

Enums

Type

Indices types.

NameValueDescription
TypeUnknown0
TypePoint1Point indices.
TypeLine2Line indices.
TypeTriangle3Triangle indices.
TypeQuadrilateral4Quadrilateral indices.
TypeTetrahedron5Tetrahedron indices.
TypeMaterial6Material indices.
TypeIsland7Island count indices.
TypeGroup8Smooth mask indices.
TypeJoint9Joint indices.
TypeEdge10Edge indices.
NumTypes11