function initEngine() {
        var skyBox;
        var viewWidth = containerEl.offsetWidth;
        var viewHeight = containerEl.offsetHeight;
        
        // instantiate the WebGL Renderer
        renderer = new THREE.WebGLRenderer({
            antialias: true
        });
        renderer.setSize(viewWidth, viewHeight);

        projector = new THREE.Projector();
        
        // create the scene
        scene = new THREE.Scene();
        
        // create camera
        camera = new THREE.PerspectiveCamera(35, viewWidth / viewHeight, 1, 1000);
        camera.position.set(squareSize * 5, 200, 300);
        cameraController = new THREE.OrbitControls(camera, containerEl);
        cameraController.target = new THREE.Vector3(squareSize * 5, squareSize * 2, 0);
        //
        scene.add(camera);

        texture_placeholder = document.createElement( 'canvas' );
        texture_placeholder.width = 128;
        texture_placeholder.height = 128;
        var context = texture_placeholder.getContext( '2d' );
        context.fillStyle = 'rgb( 200, 200, 200 )';
        context.fillRect( 0, 0, texture_placeholder.width, texture_placeholder.height );
        var materials = [
            loadTexture( '/images/skybox/posx.jpg' ), // right
            loadTexture( '/images/skybox/negx.jpg' ), // left
            loadTexture( '/images/skybox/posy.jpg' ), // top
            loadTexture( '/images/skybox/negy.jpg' ), // bottom
            loadTexture( '/images/skybox/posz.jpg' ), // back
            loadTexture( '/images/skybox/negz.jpg' )  // front
        ];
        skyBox = new THREE.Mesh( new THREE.BoxGeometry( 500, 500, 500, 7, 7, 7 ), new THREE.MultiMaterial( materials ) );
        skyBox.scale.x = - 1;
        scene.add(skyBox);
        
        containerEl.appendChild(renderer.domElement);


        // Set window resize with THREE extension
        var winResize   = new THREEx.WindowResize(renderer, camera, function(){
            return {width:containerEl.clientWidth, height: document.getElementById('content').clientHeight}
        });
    }
/**
     * Initialize some basic 3D engine elements. 
     */
Initialize some basic 3D engine elements.
Initialize some basic 3D engine elements .
function initEngine() {
        var skyBox;
        var viewWidth = containerEl.offsetWidth;
        var viewHeight = containerEl.offsetHeight;
        renderer = new THREE.WebGLRenderer({
            antialias: true
        });
        renderer.setSize(viewWidth, viewHeight);
        projector = new THREE.Projector();
        scene = new THREE.Scene();
        camera = new THREE.PerspectiveCamera(35, viewWidth / viewHeight, 1, 1000);
        camera.position.set(squareSize * 5, 200, 300);
        cameraController = new THREE.OrbitControls(camera, containerEl);
        cameraController.target = new THREE.Vector3(squareSize * 5, squareSize * 2, 0);
        scene.add(camera);
        texture_placeholder = document.createElement( 'canvas' );
        texture_placeholder.width = 128;
        texture_placeholder.height = 128;
        var context = texture_placeholder.getContext( '2d' );
        context.fillStyle = 'rgb( 200, 200, 200 )';
        context.fillRect( 0, 0, texture_placeholder.width, texture_placeholder.height );
        var materials = [
            loadTexture( '/images/skybox/posx.jpg' ),  right
            loadTexture( '/images/skybox/negx.jpg' ),  left
            loadTexture( '/images/skybox/posy.jpg' ),  top
            loadTexture( '/images/skybox/negy.jpg' ),  bottom
            loadTexture( '/images/skybox/posz.jpg' ),  back
            loadTexture( '/images/skybox/negz.jpg' )   front
        ];
        skyBox = new THREE.Mesh( new THREE.BoxGeometry( 500, 500, 500, 7, 7, 7 ), new THREE.MultiMaterial( materials ) );
        skyBox.scale.x = - 1;
        scene.add(skyBox);
        containerEl.appendChild(renderer.domElement);
         Set window resize with THREE extension
        var winResize   = new THREEx.WindowResize(renderer, camera, function(){
            return {width:containerEl.clientWidth, height: document.getElementById('content').clientHeight}
        });
    }
function initEngine ( ) { var skyBox ; var viewWidth = containerEl . offsetWidth ; var viewHeight = containerEl . offsetHeight ; renderer = new THREE . WebGLRenderer ( { antialias : true } ) ; renderer . setSize ( viewWidth , viewHeight ) ; projector = new THREE . Projector ( ) ; scene = new THREE . Scene ( ) ; camera = new THREE . PerspectiveCamera ( 35 , viewWidth / viewHeight , 1 , 1000 ) ; camera . position . set ( squareSize * 5 , 200 , 300 ) ; cameraController = new THREE . OrbitControls ( camera , containerEl ) ; cameraController . target = new THREE . Vector3 ( squareSize * 5 , squareSize * 2 , 0 ) ; scene . add ( camera ) ; texture_placeholder = document . createElement ( 'canvas' ) ; texture_placeholder . width = 128 ; texture_placeholder . height = 128 ; var context = texture_placeholder . getContext ( '2d' ) ; context . fillStyle = 'rgb( 200, 200, 200 )' ; context . fillRect ( 0 , 0 , texture_placeholder . width , texture_placeholder . height ) ; var materials = [ loadTexture ( '/images/skybox/posx.jpg' ) , loadTexture ( '/images/skybox/negx.jpg' ) , loadTexture ( '/images/skybox/posy.jpg' ) , loadTexture ( '/images/skybox/negy.jpg' ) , loadTexture ( '/images/skybox/posz.jpg' ) , loadTexture ( '/images/skybox/negz.jpg' ) ] ; skyBox = new THREE . Mesh ( new THREE . BoxGeometry ( 500 , 500 , 500 , 7 , 7 , 7 ) , new THREE . MultiMaterial ( materials ) ) ; skyBox . scale . x = - 1 ; scene . add ( skyBox ) ; containerEl . appendChild ( renderer . domElement ) ; var winResize = new THREEx . WindowResize ( renderer , camera , function ( ) { return { width : containerEl . clientWidth , height : document . getElementById ( 'content' ) . clientHeight } } ) ; }
Initialize some basic 3D engine elements.
Initialize some basic 3D engine elements .
// instantiate the WebGL Renderer // create the scene // create camera // // right // left // top // bottom // back // front // Set window resize with THREE extension