Skip to content

Commit

Permalink
chore: don't use every
Browse files Browse the repository at this point in the history
  • Loading branch information
zhuxudong committed Jul 7, 2023
1 parent ce566c6 commit 48c8418
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions packages/loader/src/gltf/parser/GLTFBufferParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export class GLTFBufferParser extends GLTFParser {
type: "json"
}).then((glTF: IGLTF) => {
context.glTF = glTF;
const { images, textures } = glTF;

const buffersPromise = Promise.all(
glTF.buffers.map((buffer: IBuffer) => {
Expand All @@ -41,11 +42,13 @@ export class GLTFBufferParser extends GLTFParser {
context.buffers = buffers;
});
// If the textures are all urls, process `GLTFBufferParser` and `GLTFTextureParser` pipelines in parallel.
if (glTF.textures && glTF.textures.every((texture) => glTF.images[texture.source])) {
context.buffersPromise = buffersPromise;
} else {
return buffersPromise;
for (let i in textures) {
if (images[textures[i].source].uri) {
return buffersPromise;
}
}
context.buffersPromise = buffersPromise;
return buffersPromise;
});
}
}
Expand Down

0 comments on commit 48c8418

Please sign in to comment.