Many tutorials suggest using the JSONLoader
when loading a Three.js model into a scene:
var loader = new THREE.JSONLoader();
var createMesh = function(geometry) {
var zmesh = new THREE.Mesh( geometry, new THREE.MeshFaceMaterial() );
zmesh.position.set( 0, 0, 0 );
zmesh.scale.set( 3, 3, 3 );
zmesh.overdraw = true;
scene.add(zmesh);
};
loader.load("the_model.js", createMesh);
But what if I have a JavaScript file that is already loaded with a <script>
tag?
var the_model = {
"metadata" : {
"formatVersion" : 3.1,
.......................
},
"scale" : 1.000000,
"materials" : [ {
........................
}
Is there a way to integrate this var the_model
with Three.js?
Replacing it for geometry did not yield the desired result.