function init() {
    /**
   * Rendering loop
   */
    function animate() {
        // render
        controls.update();

        if (ready) {
            renderer.render(scene, camera);
        }

        stats.update();

        // request new frame
        requestAnimationFrame(function() {
            animate();
        });
    }

    // renderer
    threeD = document.getElementById('r3d');
    renderer = new THREE.WebGLRenderer({
        alpha: true
    });
    renderer.setSize(threeD.offsetWidth, threeD.offsetHeight);
    threeD.appendChild(renderer.domElement);

    // stats
    stats = new Stats();
    threeD.appendChild(stats.domElement);

    // scene
    scene = new THREE.Scene();

    // camera
    camera = new THREE.PerspectiveCamera(45, threeD.offsetWidth / threeD.offsetHeight, 0.1, 100000);
    camera.position.x = 150;
    camera.position.y = 400;
    camera.position.z = -350;
    camera.up.set(-0.42, 0.86, 0.26);

    // controls
    controls = new AMI.TrackballControl(camera, threeD);
    controls.rotateSpeed = 5.5;
    controls.zoomSpeed = 1.2;
    controls.panSpeed = 0.8;
    controls.staticMoving = true;
    controls.dynamicDampingFactor = 0.3;

    threeD.addEventListener('mousedown', onMouseDown, false);
    threeD.addEventListener('mouseup', onMouseUp, false);
    window.addEventListener('resize', onWindowResize, false);

    // start rendering loop
    animate();
}
function init() {
    
    function animate() {
        
        controls.update();

        if (ready) {
            renderer.render(scene, camera);
        }

        stats.update();

        
        requestAnimationFrame(function() {
            animate();
        });
    }

    
    threeD = document.getElementById('r3d');
    renderer = new THREE.WebGLRenderer({
        alpha: true
    });
    renderer.setSize(threeD.offsetWidth, threeD.offsetHeight);
    threeD.appendChild(renderer.domElement);

    
    stats = new Stats();
    threeD.appendChild(stats.domElement);

    
    scene = new THREE.Scene();

    
    camera = new THREE.PerspectiveCamera(45, threeD.offsetWidth / threeD.offsetHeight, 0.1, 100000);
    camera.position.x = 150;
    camera.position.y = 400;
    camera.position.z = -350;
    camera.up.set(-0.42, 0.86, 0.26);

    
    controls = new AMI.TrackballControl(camera, threeD);
    controls.rotateSpeed = 5.5;
    controls.zoomSpeed = 1.2;
    controls.panSpeed = 0.8;
    controls.staticMoving = true;
    controls.dynamicDampingFactor = 0.3;

    threeD.addEventListener('mousedown', onMouseDown, false);
    threeD.addEventListener('mouseup', onMouseUp, false);
    window.addEventListener('resize', onWindowResize, false);

    
    animate();
}
function init ( ) { /**
   * Rendering loop
   */ function animate ( ) { // render controls . update ( ) ; if ( ready ) { renderer . render ( scene , camera ) ; } stats . update ( ) ; // request new frame requestAnimationFrame ( function ( ) { animate ( ) ; } ) ; } // renderer threeD = document . getElementById ( 'r3d' ) ; renderer = new THREE . WebGLRenderer ( { alpha : true } ) ; renderer . setSize ( threeD . offsetWidth , threeD . offsetHeight ) ; threeD . appendChild ( renderer . domElement ) ; // stats stats = new Stats ( ) ; threeD . appendChild ( stats . domElement ) ; // scene scene = new THREE . Scene ( ) ; // camera camera = new THREE . PerspectiveCamera ( 45 , threeD . offsetWidth / threeD . offsetHeight , 0.1 , 100000 ) ; camera . position . x = 150 ; camera . position . y = 400 ; camera . position . z = - 350 ; camera . up . set ( - 0.42 , 0.86 , 0.26 ) ; // controls controls = new AMI . TrackballControl ( camera , threeD ) ; controls . rotateSpeed = 5.5 ; controls . zoomSpeed = 1.2 ; controls . panSpeed = 0.8 ; controls . staticMoving = true ; controls . dynamicDampingFactor = 0.3 ; threeD . addEventListener ( 'mousedown' , onMouseDown , false ) ; threeD . addEventListener ( 'mouseup' , onMouseUp , false ) ; window . addEventListener ( 'resize' , onWindowResize , false ) ; // start rendering loop animate ( ) ; }
Init the scene
Init the scene