Rename IndexType USHORT/UINT to U16/U32.

PiperOrigin-RevId: 906026433
Change-Id: I0016c1923560fc8517e5388ed6068d54b84d5923
This commit is contained in:
Haroon Qureshi
2026-04-26 14:55:26 -07:00
committed by Copybara-Service
parent 521d152ec5
commit b643f50b2a
5 changed files with 10 additions and 10 deletions
@@ -230,7 +230,7 @@ void ImguiBridge::Update() {
data.nvertices = cmds->VtxBuffer.Size;
data.nindices = cmds->IdxBuffer.Size;
data.indices = cmds->IdxBuffer.Data;
data.index_type = mjINDEX_TYPE_USHORT;
data.index_type = mjINDEX_TYPE_U16;
data.primitive_type = mjMESH_PRIMITIVE_TYPE_TRIANGLES;
meshes_.push_back(std::make_unique<Mesh>(scene_view_->GetEngine(), data));
@@ -445,8 +445,8 @@ static void UpdatemjrMeshData(mjrMeshData* data, const mjModel* model, int id,
data->nindices = data->nvertices;
data->indices = nullptr;
data->index_type = data->nvertices >= std::numeric_limits<uint16_t>::max()
? mjINDEX_TYPE_UINT
: mjINDEX_TYPE_USHORT;
? mjINDEX_TYPE_U32
: mjINDEX_TYPE_U16;
data->nattributes = has_uvs ? 3 : 2;
data->attributes[0].usage = mjVERTEX_ATTRIBUTE_USAGE_POSITION;
data->attributes[0].type = mjVERTEX_ATTRIBUTE_TYPE_FLOAT3;
@@ -492,7 +492,7 @@ void UpdateSkinFlexmjrMeshData(mjrMeshData* data, const mjModel* model,
data->nvertices = positions.size() / 3;
data->nindices = num_indices;
data->indices = indices.data();
data->index_type = mjINDEX_TYPE_UINT;
data->index_type = mjINDEX_TYPE_U32;
data->primitive_type = mjMESH_PRIMITIVE_TYPE_TRIANGLES;
data->compute_bounds = true;
data->release_callback = nullptr;
@@ -93,7 +93,7 @@ class BuiltinBuilder : mjrMeshData {
primitive_type_ == filament::backend::PrimitiveType::TRIANGLES
? mjMESH_PRIMITIVE_TYPE_TRIANGLES
: mjMESH_PRIMITIVE_TYPE_LINES;
index_type = mjINDEX_TYPE_USHORT;
index_type = mjINDEX_TYPE_U16;
bounds_min[0] = bounds_.getMin().x;
bounds_min[1] = bounds_.getMin().y;
bounds_min[2] = bounds_.getMin().z;
+3 -3
View File
@@ -262,7 +262,7 @@ void Mesh::BuildIndexBuffer(const mjrMeshData& data) {
return;
}
const int element_size = data.index_type == mjINDEX_TYPE_USHORT
const int element_size = data.index_type == mjINDEX_TYPE_U16
? sizeof(uint16_t)
: sizeof(uint32_t);
const int num_bytes = data.nindices * element_size;
@@ -277,7 +277,7 @@ void Mesh::BuildIndexBuffer(const mjrMeshData& data) {
delete[] sequence;
});
if (data.index_type == mjINDEX_TYPE_USHORT) {
if (data.index_type == mjINDEX_TYPE_U16) {
FillSequence<uint16_t>(sequence, num_bytes);
} else {
FillSequence<uint32_t>(sequence, num_bytes);
@@ -287,7 +287,7 @@ void Mesh::BuildIndexBuffer(const mjrMeshData& data) {
filament::IndexBuffer::Builder ib_builder;
ib_builder.indexCount(data.nindices);
ib_builder.bufferType(data.index_type == mjINDEX_TYPE_USHORT
ib_builder.bufferType(data.index_type == mjINDEX_TYPE_U16
? filament::IndexBuffer::IndexType::USHORT
: filament::IndexBuffer::IndexType::UINT);
index_buffer_ = ib_builder.build(*engine_);
+2 -2
View File
@@ -37,8 +37,8 @@ namespace mujoco {
// The type of data stored in an index buffer.
typedef enum mjrIndexType_ {
mjINDEX_TYPE_USHORT = 0,
mjINDEX_TYPE_UINT = 1,
mjINDEX_TYPE_U16 = 0,
mjINDEX_TYPE_U32 = 1,
} mjrIndexType;
// The type of primitive to be drawn by vertex data.