Is there a way to load a JSON model just once and then add it to the scene multiple times?
I am currently calling the model loading function twice, but I believe there might be a more efficient solution out there. If anyone has a working example or suggestion, I would greatly appreciate it.
var loader = new THREE.JSONLoader();
loader.load( "models/model1.js", meshloader1("models/model1.js"));
loader.load( "models/model1.js", meshloader2("models/model1.js"));
function meshloader1(fileName){
return function(geometry){
mesh1 = new THREE.Mesh(geometry, material);
mesh1 .position.set( 0, 0, 0 );
mesh1 .scale.set( 1, 1, 1 );
scene.add(mesh1 );
}
}
function meshloader2(fileName){
return function(geometry){
mesh2 = new THREE.Mesh(geometry, material);
mesh2 .position.set( 0, 0, 0 );
mesh2 .scale.set( 1, 1, 1 );
scene.add(mesh2 );
}
}