bigwheels
bigwheels copied to clipboard
[glTF] Support meshes without indices
GltfLoader::LoadMeshData currently complains when a mesh lacks indices. However, meshes are allowed to not have indices. 5.24.2 says:
When this is undefined, the primitive defines non-indexed geometry
This would allow BigWheels to load and render:
There's evidence that this is partly implemented but incomplete. In GltfLoader::LoadMeshData (scene_gltf_loader.cpp):
-
GetFormat()can returnFORMAT_UNDEFINEDwhen indices are missing (pGltfPrimitive->indices == nullptr). There's a comment that says: "It's valid for this to be UNDEFINED, means the primitive doesn't have any index data." - There's a code path involving
genTopologyIndices. This is set totruewhenindexFormat == grfx::FORMAT_UNDEFINED. This factors into code that populatestargetGeometry.
However, there's also an independent check for IsNull() very early on when BatchInfos are being made:
// We require index data so bail if there isn't index data.
if (IsNull(pGltfPrimitive->indices)) {
PPX_ASSERT_MSG(false, "GLTF mesh primitive does not have index data");
return ppx::ERROR_SCENE_INVALID_SOURCE_GEOMETRY_INDEX_DATA;
}
Additionally, none of the staging/target buffer sizing code considers the case where indexFormat == grfx::FORMAT_UNDEFINED