google / bigwheels

BigWheels is a cross-platform, API agnostic framework to build graphics applications.
Apache License 2.0
94 stars 35 forks source link

[glTF] Support meshes without indices #474

Open footballhead opened 5 months ago

footballhead commented 5 months ago

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:

footballhead commented 2 months ago

There's evidence that this is partly implemented but incomplete. In GltfLoader::LoadMeshData (scene_gltf_loader.cpp):

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