Fix glb loading;

This commit is contained in:
bjorn 2021-11-05 18:47:03 -07:00
parent 998b355e30
commit 6fb5885e9b
1 changed files with 4 additions and 2 deletions

View File

@ -513,12 +513,14 @@ ModelData* lovrModelDataInitGltf(ModelData* model, Blob* source, ModelDataIO* io
else { token += NOM_VALUE(json, token); }
}
Blob* blob = model->blobs[buffer->blob];
// If this is the glb binary data, increment the offset to account for the file header
if (buffer->data && buffer->data == source->data && glb) {
if (glb && blob == source) {
buffer->offset += binOffset;
}
buffer->data = (char*) model->blobs[buffer->blob]->data + buffer->offset;
buffer->data = (char*) blob->data + buffer->offset;
}
}