Skip to content

Commit

Permalink
Always have writtenResourceMap be defined
Browse files Browse the repository at this point in the history
  • Loading branch information
lilleyse committed Mar 30, 2020
1 parent 3a1a446 commit 427db9b
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/writeResources.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ function writeResources(gltf, options) {
ForEach.image(gltf, function(image, i) {
writeImage(gltf, image, i, writtenResourceMap, options);
ForEach.compressedImage(image, function(compressedImage) {
writeImage(gltf, compressedImage, i, options);
writeImage(gltf, compressedImage, i, writtenResourceMap, options);
});
});

Expand All @@ -61,20 +61,20 @@ function writeResources(gltf, options) {
});

// Buffers need to be written last because images and shaders may write to new buffers
removeUnusedElements(gltf, ['acessor', 'bufferView', 'buffer']);
removeUnusedElements(gltf, ['accessor', 'bufferView', 'buffer']);
mergeBuffers(gltf, options.name);

ForEach.buffer(gltf, function(buffer, bufferId) {
writeBuffer(gltf, buffer, bufferId, options);
writeBuffer(gltf, buffer, bufferId, writtenResourceMap, options);
});
return gltf;
}

function writeBuffer(gltf, buffer, i, options) {
function writeBuffer(gltf, buffer, i, writtenResourceMap, options) {
if (defined(options.bufferStorage) && !options.separateBuffers) {
writeBufferStorage(buffer, options);
} else {
writeResource(gltf, buffer, i, options.separateBuffers, true, '.bin', undefined, options);
writeResource(gltf, buffer, i, options.separateBuffers, true, '.bin', writtenResourceMap, options);
}
}

Expand Down

0 comments on commit 427db9b

Please sign in to comment.