Skip to content

Instantly share code, notes, and snippets.

@hugohil
Created October 24, 2015 15:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hugohil/c5afe17c6aa24b46a8a6 to your computer and use it in GitHub Desktop.
Save hugohil/c5afe17c6aa24b46a8a6 to your computer and use it in GitHub Desktop.
OBJ Loader
(function() {
var scene, camera, renderer;
var geometry, material, mesh;
init();
animate();
function init() {
scene = new THREE.Scene();
camera = new THREE.PerspectiveCamera( 75, window.innerWidth / window.innerHeight, 1, 10000 );
var loader = new OBJMTLLoader();
var ship = undefined;
loader.load(
"http://avgp.github.io/h2g2three/models/FeisarShip.obj",
"http://avgp.github.io/h2g2three/models/FeisarShip.mtl",
function (obj3d) {
window.thing = obj3d;
obj3d.scale.set(0.8, 0.8, 0.8);
scene.add(obj3d);
ship = obj3d;
});
renderer = new THREE.WebGLRenderer();
renderer.setSize( window.innerWidth, window.innerHeight );
document.body.appendChild( renderer.domElement );
}
function animate() {
requestAnimationFrame( animate );
renderer.render( scene, camera );
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment