decode

abstract fun decode(compressedBuffer: ByteArray, attributeIds: Map<String, Int>): DracoMesh

Decode a single Draco-compressed primitive into vertex / index arrays.

Return

the decoded mesh. Implementations populate only the attributes requested in attributeIds; null-valued fields are honored as "absent" by downstream GltfReader code, which falls back to the regular accessors where applicable.

Parameters

compressedBuffer

the bytes of the bufferView referenced by KHR_draco_mesh_compression.bufferView. Already sliced — the implementation should treat byte 0 as the start of the Draco stream.

attributeIds

map from glTF semantic name (POSITION, NORMAL, TEXCOORD_0, COLOR_0) to the Draco-side attribute id supplied by the KHR_draco_mesh_compression.attributes JSON object. The decoder pulls each attribute by id from the decoded Draco mesh and emits it under the matching semantic.

Throws

for malformed Draco buffers. The layer translates this into a tile-level failure (the affected tile transitions to FAILED).