I use Tools LoadFile to load glb, which retrieves the buffer from the callback and then uses IndexDB or other storage to store the buffer. I found that even when loading a large number of glb files for the first time, there is still a problem of texture distortion. I found that the material parsed by each buffer is correct, but the texture may be from another model
_load(scene: Scene, option: any) {
const { id, projectId, url, name, fileName, position } = option;
Tools.LoadFile(
url,
buf => {
SceneLoader.ImportMesh(
undefined,
'',
new Uint8Array(buf as ArrayBuffer),
scene,
(meshes, particleSystems, skeletons, animationGroups, transformNodes, geometries, lights) => {
console.log('result::', meshes, transformNodes);
meshes[0].id = projectId || id;
meshes[0].position.fromArray(position);
meshes[0].name = name;
return {
meshes,
particleSystems,
skeletons,
animationGroups,
transformNodes,
geometries,
lights,
};
},
progress => {
console.log('load progress', progress);
},
error => {
console.log('load error::', error);
},
'.glb',
);
},
undefined,
undefined,
true,
);
}
Using my method to load more than one model simultaneously externally will result in texture distortion issues
I try to retrieve the buffer synchronously or asynchronously, but this situation occurs