assimp icon indicating copy to clipboard operation
assimp copied to clipboard

Bug: Invalid accessor without data in mesh while loading draco compressed data

Open sherpya opened this issue 3 years ago • 2 comments

Describe the bug

I'm trying to load a glb file compressed using:

gltf-pipeline -i -o --draco.compressionLevel=10

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

sherpya avatar Nov 06 '22 00:11 sherpya

waiting for patch

leapar avatar Mar 01 '23 02:03 leapar

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;
    }

enesaltinkaya avatar Dec 13 '23 20:12 enesaltinkaya