assimp
assimp copied to clipboard
Bug: Invalid accessor without data in mesh while loading draco compressed data
Describe the bug
I'm trying to load a glb file compressed using:
gltf-pipeline -i
Assimp import fails with:
Invalid accessor without data in mesh meshes[0] ("Cube")
at
Accessor::Indexer data = prim.indices->GetIndexer();
if (!data.IsValid()) {
throw DeadlyImportError("GLTF: Invalid accessor without data in mesh ", getContextForErrorMessages(mesh.id, mesh.name));
}
because data is nullptr
To Reproduce Attached sample glasses.zip
Expected behavior Loads correctly
Screenshots N/A
Platform (please complete the following information):
- OS: Linux debian sid
- Browser [e.g. chrome, safari]
- Version [e.g. 22]
Additional context Meshlab exposes same problem, the model is correctly loaded by threejs gltf loader + draco wasm
waiting for patch
In assimp/code/AssetLib/glTF2/glTF2Asset.inl file I removed the following part in SetDecodedIndexBuffer_Draco function and it works.
// If accessor uses the same size as draco implementation, copy the draco buffer directly
// Usually uint32_t but shouldn't assume
if (sizeof(dracoMesh.face(draco::FaceIndex(0))[0]) == componentBytes) {
memcpy(decodedIndexBuffer->GetPointer(), &dracoMesh.face(draco::FaceIndex(0))[0], decodedIndexBuffer->byteLength);
return;
}