Skip to content

Instantly share code, notes, and snippets.

@natasv
Created August 7, 2016 08:34
Show Gist options
  • Save natasv/d41cc7511c38258f97bd16b69bfb0c3e to your computer and use it in GitHub Desktop.
Save natasv/d41cc7511c38258f97bd16b69bfb0c3e to your computer and use it in GitHub Desktop.
(function(){
'use strict';
var tau = Math.PI * 2;
var width, height;
var scene, camera, renderer, pointCloud;
function onDocumentReady(){
initialize();
//CODE
renderer.render(scene, camera);
}
function initialize(){
scene = new THREE.Scene();
camera = new THREE.PerspectiveCamera(120, 16 / 9, 1, 1000);
renderer = new THREE.WebGLRenderer();
document.body.appendChild(renderer.domElement);
window.addEventListener('resize', onWindowResize);
onWindowResize();
}
function onWindowResize(){
width = window.innerWidth;
height = window.innerHeight;
updateRendererSize();
}
function updateRendererSize(){
renderer.setSize(width, height);
camera.aspect = width / height;
camera.updateProjectionMatrix();
}
document.addEventListener('DOMContentLoaded', onDocumentReady);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment