app/static/js/main.js
// called first, populates scene and initializes renderer
called first, populates scene and initializes renderer
called first populates scene and initializes renderer
function init() {
    var container = document.getElementById( 'container' );
    scene = new THREE.Scene();
    clock = new THREE.Clock();
    camera = new THREE.PerspectiveCamera( 45, window.innerWidth / window.innerHeight, 1, 10000 );
    camera.position.set(0, 100, 0);
    camera.lookAt(new THREE.Vector3(0,0,0));
    grid = new THREE.GridHelper( 200, 20, 0xffffff, 0xffffff );
     scene.add( grid );
     set up renderer
    renderer = new THREE.WebGLRenderer({preserveDrawingBuffer: true});
    renderer.setPixelRatio( window.devicePixelRatio );
    renderer.setSize( window.innerWidth, window.innerHeight );
    container.appendChild( renderer.domElement );
    raycaster = new THREE.Raycaster();
    raycaster.params.Points.threshold = threshold;
    stats = new Stats();
    container.appendChild( stats.dom );
    controls = new THREE.OrbitControls( camera, renderer.domElement );
    evaluators = [];
    evaluation = new Evaluation();
    window.addEventListener( 'resize', onWindowResize, false );
    document.getElementById('container').addEventListener( 'mousemove', onDocumentMouseMove, false );
    document.getElementById('container').addEventListener( 'mousedown', onDocumentMouseDown, false );
    document.getElementById('container').addEventListener( 'mouseup', onDocumentMouseUp, false );
    document.addEventListener( 'mousemove', updateMouse, false );
    document.getElementById( 'save' ).addEventListener( 'click', save, false );
    document.getElementById( 'next_frame' ).addEventListener( 'click', next_frame, false );
    document.getElementById( 'move' ).addEventListener( 'click', moveMode, false );
    document.getElementById( 'move2D' ).addEventListener( 'click', move2DMode, false );
    document.getElementById( 'file_input' ).addEventListener( 'change', upload_files, false );
    document.addEventListener("keydown", onKeyDown);  or however you are calling your method
    document.addEventListener("keyup", onKeyUp);
    document.getElementById( 'record' ).addEventListener( 'click', toggleRecord, false );
}
function init ( ) { var container = document . getElementById ( 'container' ) ; scene = new THREE . Scene ( ) ; clock = new THREE . Clock ( ) ; camera = new THREE . PerspectiveCamera ( 45 , window . innerWidth / window . innerHeight , 1 , 10000 ) ; camera . position . set ( 0 , 100 , 0 ) ; camera . lookAt ( new THREE . Vector3 ( 0 , 0 , 0 ) ) ; grid = new THREE . GridHelper ( 200 , 20 , 0xffffff , 0xffffff ) ; renderer = new THREE . WebGLRenderer ( { preserveDrawingBuffer : true } ) ; renderer . setPixelRatio ( window . devicePixelRatio ) ; renderer . setSize ( window . innerWidth , window . innerHeight ) ; container . appendChild ( renderer . domElement ) ; raycaster = new THREE . Raycaster ( ) ; raycaster . params . Points . threshold = threshold ; stats = new Stats ( ) ; container . appendChild ( stats . dom ) ; controls = new THREE . OrbitControls ( camera , renderer . domElement ) ; evaluators = [ ] ; evaluation = new Evaluation ( ) ; window . addEventListener ( 'resize' , onWindowResize , false ) ; document . getElementById ( 'container' ) . addEventListener ( 'mousemove' , onDocumentMouseMove , false ) ; document . getElementById ( 'container' ) . addEventListener ( 'mousedown' , onDocumentMouseDown , false ) ; document . getElementById ( 'container' ) . addEventListener ( 'mouseup' , onDocumentMouseUp , false ) ; document . addEventListener ( 'mousemove' , updateMouse , false ) ; document . getElementById ( 'save' ) . addEventListener ( 'click' , save , false ) ; document . getElementById ( 'next_frame' ) . addEventListener ( 'click' , next_frame , false ) ; document . getElementById ( 'move' ) . addEventListener ( 'click' , moveMode , false ) ; document . getElementById ( 'move2D' ) . addEventListener ( 'click' , move2DMode , false ) ; document . getElementById ( 'file_input' ) . addEventListener ( 'change' , upload_files , false ) ; document . addEventListener ( "keydown" , onKeyDown ) ; document . addEventListener ( "keyup" , onKeyUp ) ; document . getElementById ( 'record' ) . addEventListener ( 'click' , toggleRecord , false ) ; }
called first, populates scene and initializes renderer
called first populates scene and initializes renderer
// set up PerspectiveCamera // // scene.add( grid ); // set up renderer // // // //or however you are calling your method