Utilizing THREE.js Loading Manager allows me to verify if the object or texture has been loaded successfully.
var Mesh;
var TLoader = new THREE.TextureLoader(manager);
var manager = new THREE.LoadingManager();
manager.onProgress = function ( item, loaded, total ) {
console.log( item, loaded, total );
};
manager.onLoad = function()
{
console.log(Renderer.domElement.toDataURL());
}
function renderModel(path,texture) {
var Material = new THREE.MeshPhongMaterial({shading: THREE.SmoothShading});
Material.side = THREE.DoubleSide;
var Loader = new THREE.JSONLoader(manager);
Loader.load(path,function(geometry){
geometry.mergeVertices();
geometry.computeFaceNormals();
geometry.computeVertexNormals();
TLoader.load(texture,function(texture){
Mesh = new THREE.Mesh(geometry, Material);
Mesh.material.map =texture;
Scene.add(Mesh);
});
});
}
I execute the renderModel function in a loop. However, the output of 'console.log(Renderer.domElement.toDataURL())' within the manager.onload function only captures images of certain 3D models and not all present in the scene.
My goal is to obtain 'Renderer.domElement.toDataURL()' once all the 3D models have been rendered in the scene.
Currently, only a few models are captured in the image output, even though all items are loaded in the scene.