One issue I'm facing involves loading a model in this manner:
var Beech;
var loader = new THREE.JSONLoader();
loader.load( "./models/trees/Beech/Beech.json", function( geometry, materials ) {
Beech = addMorphTree(geometry,materials,0.5); });
and utilizing it like so :
function addMorphTree(geometry,material,scale){
mat=new THREE.MeshFaceMaterial( material );
mat.side=THREE.DoubleSide;
Tree = new THREE.Mesh( geometry,mat);
Tree.scale.set(scale,scale,scale);
//Tree.position.set(x,y,z);
Tree.rotation.x = Math.PI/2;
//scene.add( Tree );
return Tree;}
I am wondering how I can use the 'Beech' variable to create duplicates of the model without having to load it repeatedly. When attempting to use
scene.add(Beech);
outside the loader, the model fails to appear. I've come across similar queries, but the solutions involve adding the model to the scene inside the loader.