I can't figure out why Firebug keeps throwing an error that says "THREE is not defined" for my var camera. It's confusing because I clearly see the THREE declaration on the right side 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 );
}