Guest User

Untitled

a guest
Apr 25th, 2014
108
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. document.addEventListener("mousemove", onDocumentMouseMove, false );
  2.  
  3. // set the scene size
  4. var WIDTH = window.innerWidth,
  5. HEIGHT = window.innerWidth;
  6.  
  7. // set some camera attributes
  8. var VIEW_ANGLE = 75,
  9. ASPECT = WIDTH / HEIGHT,
  10. NEAR = 0.01,
  11. FAR = 100;
  12.  
  13. var camera, scene, renderer;
  14.  
  15. init();
  16. onWindowResize();
  17. animate();
  18.  
  19. function init()
  20. {
  21. // create renderer
  22. renderer = new THREE.WebGLRenderer();
  23. renderer.setSize(WIDTH, HEIGHT);
  24.  
  25. renderer.shadowMapEnabled = true;
  26. renderer.shadowMapSoft = true;
  27.  
  28. // create scene
  29. scene = new THREE.Scene();
  30. // create camera
  31. camera = new THREE.PerspectiveCamera( VIEW_ANGLE,
  32. ASPECT,
  33. NEAR,
  34. FAR );
  35. camera.position.z = 5;
  36. scene.add(camera);
  37.  
  38. // add this stuff in a container
  39. document.getElementById("container").appendChild(renderer.domElement);
  40.  
  41. window.addEventListener( 'resize', onWindowResize, false );
  42. }
  43.  
  44. function onWindowResize()
  45. {
  46. WIDTH = window.innerWidth;
  47. HEIGHT = window.innerHeight;
  48.  
  49. camera.aspect = window.innerWidth / window.innerHeight;
  50. camera.updateProjectionMatrix();
  51.  
  52. renderer.setSize( window.innerWidth, window.innerHeight );
  53.  
  54. render();
  55. }
  56.  
  57. function onDocumentMouseMove(event)
  58. {
  59. mouseX = ( event.clientX - (WIDTH / 2.0) );
  60. mouseY = ( event.clientY - (HEIGHT / 2.0) );
  61. }
  62.  
  63. function animate()
  64. {
  65. requestAnimationFrame(animate);
  66. render();
  67. update();
  68. }
  69.  
  70. function render()
  71. {
  72. renderer.render(scene, camera);
  73. }
  74.  
  75. function update()
  76. {
  77.  
  78. }
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×