So I've taken a class in Three.js only to find out I haven't been educated in how to load models. I found a model on Turbosquid.com <http://storage2.turbosquid.com/Download/index.php?ID=717563_8377529>, and successfully converted it to JSON using convert_obj_three.py.
I've surfed for good code and found a few decent examples on stackoverflow, but for some reason when I run it in chrome, I get no model.
<html>
<head></head>
<body>
<script src="http://threejs.org/build/three.js"></script>
<script>
var scene = new THREE.Scene();
var camera = new THREE.PerspectiveCamera(75, window.innerWidth/window.innerHeight, 0.1, 1000);
var geometry;
var renderer = new THREE.WebGLRenderer();
renderer.setSize(window.innerWidth, window.innerHeight);
document.body.appendChild(renderer.domElement);
var material = new THREE.MeshBasicMaterial({color: 0x00ff00});
loader = new THREE.JSONLoader();
loader.load( "LeePerrySmith.js", function( geometry ) {
mesh = new THREE.Mesh( geometry, new THREE.MeshBasicMaterial() );
mesh.scale.set( 10, 10, 10 );
mesh.position.y = 0;
mesh.position.x = 0;
mesh.scale.set( 100, 100, 100 );
scene.add( mesh );
mesh.side = THREE.DoubleSide;
alert("hit");
} );
camera.position.z = 5;
var render = function () {
renderer.render(scene, camera);
};
render();
</script>
</body>
I am storing both the HTML file and the e100.js model file in the same directory. Is there some pathing that I am not aware of?