lundi 1 décembre 2014

Three.js camera rotation error


Firebug is throwing an error saying that "THREE is not defined" on my var camera and I honestly cannot see why. The error doesn't make any sense to me because as I see it; there is a defined THREE right that on the right hand of the equals sign.



init();
animate();

function init()
{
var camera = new THREE.PerspectiveCamera( 75, window.innerWidth / window.innerHeight, 0.1, 1000 );
camera.position.z = 500;

var controls = new THREE.TrackballControls( camera );
controls.addEventListener('change', render);

var scene = new THREE.Scene();

var geometry = new THREE.BoxGeometry(100, 100, 100);
var material = new THREE.MeshBasicMaterial();

var mesh = new THREE.Mesh( geometry, material );
scene.add(mesh);

var renderer = new THREE.WebGLRenderer();
renderer.setSize(window.innerWidth, window.innerHeight);
document.body.appendChild( renderer.domElement );
}

function animate()
{
requestAnimationFrame( animate );
controls.update();
}

function render()
{
renderer.render( scene, camera );
}




Aucun commentaire:

Enregistrer un commentaire