
/*
 *
 *  (c) BU Web Advanced
 *
 *
*/



var container = document.getElementById("container");


var renderer = new THREE.WebGLRenderer({ antialias: true });
// var renderer = new THREE.CanvasRenderer();
renderer.setSize(container.offsetWidth, container.offsetHeight);
container.appendChild( renderer.domElement );


var scene = new THREE.Scene();


var camera = new THREE.PerspectiveCamera( 45, container.offsetWidth / container.offsetHeight, 1, 4000 );
camera.position.set( 0, 2, 10 );
scene.add( camera );


var light = new THREE.DirectionalLight( 0xffffff, 1.5);
light.position.set(0, 1, 1);
scene.add( light );



var mesh = new THREE.Mesh();

var material = new THREE.MeshLambertMaterial({ color: "#188AE7" });
material.side = THREE.DoubleSide;

loader = new THREE.JSONLoader();
loader.load("models/myModel.js", onLoadComplete)



function onLoadComplete(geometry)
{
  mesh = new THREE.Mesh(geometry, material);
  scene.add(mesh);
}






loop();


function loop(){
  requestAnimationFrame( loop );
  renderer.render(scene, camera);

  mesh.rotation.y += .01

}


function changeCamera() {
    alert("fly to...")
}






window.onresize = function() {

  $("canvas")[0].width = container.offsetWidth;
  $("canvas")[0].height = container.offsetHeight;
  
  renderer.setSize(container.offsetWidth, container.offsetHeight);
  camera.aspect = container.offsetWidth / container.offsetHeight;
  camera.updateProjectionMatrix();
}














/*

###### SNIPPETS ###########








// jquery Variable Counter
$({meineVar:1}).animate({meineVar:0},{
  step: function(){
  }
})



MeshLambertMaterial



2,.6,2.5

*/