For some reason, in console log, i see onProgress fired twice. I have one GLTF model to load but load manager is treating it like I have two models. if I add another model it will do the same, it will load total 4 models but in reality, it is two.
Here is my console log:
Here is my code:
let manager = new THREE.LoadingManager();
manager.onStart = function ( url, itemsLoaded, itemsTotal ) {
console.log( 'Started loading file: ' + url + '.\nLoaded ' + itemsLoaded + ' of ' + itemsTotal + ' files.' );
};
manager.onLoad = function ( ) {
console.log( 'Loading complete!');
};
manager.onProgress = function ( url, itemsLoaded, itemsTotal ) {
console.log( 'Loading file: ' + url + '.\nLoaded ' + itemsLoaded + ' of ' + itemsTotal + ' files.' );
};
manager.onError = function ( url ) {
console.log( 'There was an error loading ' + url );
};
this.loader = new GLTFLoader(manager);
this.loader.load(model1, (gltf) => {
gltf.scene.traverse(function(child) {
child.material = mat;
let pos = gltf.scene.children[0].children[0].geometry.attributes.position;
let count = pos.count/3
let bary = []
for (let index = 0; index < count; index++) {
bary.push(0,0,1, 0,1,0, 1,0,0)
}
bary = new Float32Array(bary)
gltf.scene.children[0].children[0].geometry.setAttribute('barycentric', new THREE.BufferAttribute(bary,3))
}
);
this.supamesh = gltf.scene.children[0].children[0]
this.supamesh.geometry.center();
this.scene.add(this.supamesh);
})