Only count primitives made up of triangles in glTF meshes

This commit is contained in:
Paul Melis 2024-06-04 17:17:29 +02:00
parent de978c951c
commit 145284b7f1

View File

@ -4969,9 +4969,14 @@ static Model LoadGLTF(const char *fileName)
cgltf_mesh *mesh = node->mesh;
if (!mesh)
continue;
primitivesCount += mesh->primitives_count;
for (unsigned int p = 0; p < mesh->primitives_count; p++)
{
if (mesh->primitives[p].type == cgltf_primitive_type_triangles)
primitivesCount++;
}
TRACELOG(LOG_DEBUG, " > Primitives count based on hierarchy: %i", primitivesCount);
}
TRACELOG(LOG_DEBUG, " > Primitives (triangles only) count based on hierarchy : %i", primitivesCount);
// Load our model data: meshes and materials
model.meshCount = primitivesCount;