function initObjects(callback) {
        boardModel = new THREE.Mesh(new THREE.CubeGeometry(squareSize * 10 + 20, 5, squareSize * 10 + 20), materials.boardMaterial);
        boardModel.position.set(squareSize * 5, -0.02, squareSize * 5);
        scene.add(boardModel);

        // create the board squares
        var squareMaterial = materials.boardMaterial;

        for (var row = 0; row < 10; row++) {
            for (var col = 0; col < 10; col++) {
                var square = new THREE.Mesh(new THREE.PlaneGeometry(squareSize, squareSize, 1, 0), squareMaterial);
         
                square.position.x = col * squareSize + squareSize / 2;
                square.position.z = row * squareSize + squareSize / 2;

                square.position.y = 2.5;
         
                square.rotation.x = -90 * Math.PI / 180;

                var egh = new THREE.EdgesHelper( square, 0xd3d3d3 );
                egh.material.linewidth = 2;
                egh.position.x = col * squareSize + squareSize / 2;
                egh.position.z = row * squareSize + squareSize / 2;

                egh.position.y = 2.5;
         
                egh.rotation.x = -90 * Math.PI / 180;
                scene.add( egh );
         
                scene.add(square);


            
            }
        }

        var oppBoardModel = new THREE.Mesh(new THREE.CubeGeometry(squareSize * 10 + 20, squareSize * 10 + 20, 5), materials.boardMaterial);
        oppBoardModel.position.set(squareSize * 5 , (squareSize * 5 + 10), -(0.02 + 10));
        scene.add(oppBoardModel);
        

        var oppSquareMaterial = materials.boardMaterial;


        for (var row = 0; row < 10; row++) {
            for (var col = 0; col < 10; col++) {
               // squareMaterial = materials.squareMaterial;
         
                var square = new THREE.Mesh(new THREE.PlaneGeometry(squareSize, squareSize, 1, 1), oppSquareMaterial);
         
                square.position.x = col * squareSize + squareSize / 2;
                square.position.y = row * squareSize + squareSize / 2 + 10;

                square.position.z = 2.5 - 10;
        
                var egh = new THREE.EdgesHelper( square, 0xd3d3d3 );
                egh.material.linewidth = 2;
                egh.position.x = col * squareSize + squareSize / 2;
                egh.position.z = row * squareSize + squareSize / 2;

                egh.position.y = 2.5;
         
                egh.rotation.x = -90 * Math.PI / 180;
                scene.add( egh );
         
                scene.add(square);
            }
        }
        
        geometries.textGeom = new THREE.CubeGeometry(squareSize * 5, squareSize * 2, 0 );
        geometries.pieceGeom = new THREE.CubeGeometry(squareSize / 3, squareSize *2, squareSize / 3);
        
        
        hitPiece = new THREE.Mesh(geometries.pieceGeom, materials.hitMaterial);
        missPiece = new THREE.Mesh(geometries.pieceGeom, materials.missMaterial);

        text = new THREE.Mesh(geometries.textGeom, materials.textMaterial);
        text.position.set(-50, 50, 0);
        scene.add(text);

        myTurnMsg = new THREE.Mesh(geometries.textGeom, materials.myTurnMaterial);
        myTurnMsg.position.set(-50, 50, 0);
        oppTurnMsg = new THREE.Mesh(geometries.textGeom, materials.othersTurnMaterial);
        oppTurnMsg.position.set(-50, 50, 0);

        winMsg = new THREE.Mesh(geometries.textGeom, materials.winMaterial);
        winMsg.position.set(-50, 50, 0);

        looseMsg = new THREE.Mesh(geometries.textGeom, materials.looseMaterial);
        looseMsg.position.set(-50, 50, 0);

        geometries.planeGeometry = new THREE.PlaneGeometry(squareSize, squareSize, 20, 20);

        missPlane = new THREE.Mesh(geometries.planeGeometry.clone(), materials.customMaterial2);
        missPlane.rotation.x = -0.5*Math.PI;

        hitOpp = new THREE.Mesh(geometries.planeGeometry, materials.customMaterial);

        missOpp = new THREE.Mesh(geometries.planeGeometry, materials.customMaterial2)



        geometries.explosion = new THREE.IcosahedronGeometry(4, 4);
        hitPlane = new THREE.Mesh(geometries.explosion, materials.explosionMaterial);
        
        // missPlane.position.set(5, 2.60, 5);
        // scene.add(missPlane);
        // splash = true;

        // setTimeout(function(){
        //     splash = false;
        // }, 3000);

        callback();
    }
/**
     * Initialize the objects.
     * @param {Object} callback Function to call when the objects have been loaded.
     */
Initialize the objects.
@param {Object} callback Function to call when the objects have been loaded.
Initialize the objects . @param { Object } callback Function to call when the objects have been loaded .
function initObjects(callback) {
        boardModel = new THREE.Mesh(new THREE.CubeGeometry(squareSize * 10 + 20, 5, squareSize * 10 + 20), materials.boardMaterial);
        boardModel.position.set(squareSize * 5, -0.02, squareSize * 5);
        scene.add(boardModel);
        var squareMaterial = materials.boardMaterial;
        for (var row = 0; row < 10; row++) {
            for (var col = 0; col < 10; col++) {
                var square = new THREE.Mesh(new THREE.PlaneGeometry(squareSize, squareSize, 1, 0), squareMaterial);
                square.position.x = col * squareSize + squareSize / 2;
                square.position.z = row * squareSize + squareSize / 2;
                square.position.y = 2.5;
                square.rotation.x = -90 * Math.PI / 180;
                var egh = new THREE.EdgesHelper( square, 0xd3d3d3 );
                egh.material.linewidth = 2;
                egh.position.x = col * squareSize + squareSize / 2;
                egh.position.z = row * squareSize + squareSize / 2;
                egh.position.y = 2.5;
                egh.rotation.x = -90 * Math.PI / 180;
                scene.add( egh );
                scene.add(square);
            }
        }
        var oppBoardModel = new THREE.Mesh(new THREE.CubeGeometry(squareSize * 10 + 20, squareSize * 10 + 20, 5), materials.boardMaterial);
        oppBoardModel.position.set(squareSize * 5 , (squareSize * 5 + 10), -(0.02 + 10));
        scene.add(oppBoardModel);
        var oppSquareMaterial = materials.boardMaterial;
        for (var row = 0; row < 10; row++) {
            for (var col = 0; col < 10; col++) {
                var square = new THREE.Mesh(new THREE.PlaneGeometry(squareSize, squareSize, 1, 1), oppSquareMaterial);
                square.position.x = col * squareSize + squareSize / 2;
                square.position.y = row * squareSize + squareSize / 2 + 10;
                square.position.z = 2.5 - 10;
                var egh = new THREE.EdgesHelper( square, 0xd3d3d3 );
                egh.material.linewidth = 2;
                egh.position.x = col * squareSize + squareSize / 2;
                egh.position.z = row * squareSize + squareSize / 2;
                egh.position.y = 2.5;
                egh.rotation.x = -90 * Math.PI / 180;
                scene.add( egh );
                scene.add(square);
            }
        }
        geometries.textGeom = new THREE.CubeGeometry(squareSize * 5, squareSize * 2, 0 );
        geometries.pieceGeom = new THREE.CubeGeometry(squareSize / 3, squareSize *2, squareSize / 3);
        hitPiece = new THREE.Mesh(geometries.pieceGeom, materials.hitMaterial);
        missPiece = new THREE.Mesh(geometries.pieceGeom, materials.missMaterial);
        text = new THREE.Mesh(geometries.textGeom, materials.textMaterial);
        text.position.set(-50, 50, 0);
        scene.add(text);
        myTurnMsg = new THREE.Mesh(geometries.textGeom, materials.myTurnMaterial);
        myTurnMsg.position.set(-50, 50, 0);
        oppTurnMsg = new THREE.Mesh(geometries.textGeom, materials.othersTurnMaterial);
        oppTurnMsg.position.set(-50, 50, 0);
        winMsg = new THREE.Mesh(geometries.textGeom, materials.winMaterial);
        winMsg.position.set(-50, 50, 0);
        looseMsg = new THREE.Mesh(geometries.textGeom, materials.looseMaterial);
        looseMsg.position.set(-50, 50, 0);
        geometries.planeGeometry = new THREE.PlaneGeometry(squareSize, squareSize, 20, 20);
        missPlane = new THREE.Mesh(geometries.planeGeometry.clone(), materials.customMaterial2);
        missPlane.rotation.x = -0.5*Math.PI;
        hitOpp = new THREE.Mesh(geometries.planeGeometry, materials.customMaterial);
        missOpp = new THREE.Mesh(geometries.planeGeometry, materials.customMaterial2)
        geometries.explosion = new THREE.IcosahedronGeometry(4, 4);
        hitPlane = new THREE.Mesh(geometries.explosion, materials.explosionMaterial);
        callback();
    }
function initObjects ( callback ) { boardModel = new THREE . Mesh ( new THREE . CubeGeometry ( squareSize * 10 + 20 , 5 , squareSize * 10 + 20 ) , materials . boardMaterial ) ; boardModel . position . set ( squareSize * 5 , - 0.02 , squareSize * 5 ) ; scene . add ( boardModel ) ; var squareMaterial = materials . boardMaterial ; for ( var row = 0 ; row < 10 ; row ++ ) { for ( var col = 0 ; col < 10 ; col ++ ) { var square = new THREE . Mesh ( new THREE . PlaneGeometry ( squareSize , squareSize , 1 , 0 ) , squareMaterial ) ; square . position . x = col * squareSize + squareSize / 2 ; square . position . z = row * squareSize + squareSize / 2 ; square . position . y = 2.5 ; square . rotation . x = - 90 * Math . PI / 180 ; var egh = new THREE . EdgesHelper ( square , 0xd3d3d3 ) ; egh . material . linewidth = 2 ; egh . position . x = col * squareSize + squareSize / 2 ; egh . position . z = row * squareSize + squareSize / 2 ; egh . position . y = 2.5 ; egh . rotation . x = - 90 * Math . PI / 180 ; scene . add ( egh ) ; scene . add ( square ) ; } } var oppBoardModel = new THREE . Mesh ( new THREE . CubeGeometry ( squareSize * 10 + 20 , squareSize * 10 + 20 , 5 ) , materials . boardMaterial ) ; oppBoardModel . position . set ( squareSize * 5 , ( squareSize * 5 + 10 ) , - ( 0.02 + 10 ) ) ; scene . add ( oppBoardModel ) ; var oppSquareMaterial = materials . boardMaterial ; for ( var row = 0 ; row < 10 ; row ++ ) { for ( var col = 0 ; col < 10 ; col ++ ) { var square = new THREE . Mesh ( new THREE . PlaneGeometry ( squareSize , squareSize , 1 , 1 ) , oppSquareMaterial ) ; square . position . x = col * squareSize + squareSize / 2 ; square . position . y = row * squareSize + squareSize / 2 + 10 ; square . position . z = 2.5 - 10 ; var egh = new THREE . EdgesHelper ( square , 0xd3d3d3 ) ; egh . material . linewidth = 2 ; egh . position . x = col * squareSize + squareSize / 2 ; egh . position . z = row * squareSize + squareSize / 2 ; egh . position . y = 2.5 ; egh . rotation . x = - 90 * Math . PI / 180 ; scene . add ( egh ) ; scene . add ( square ) ; } } geometries . textGeom = new THREE . CubeGeometry ( squareSize * 5 , squareSize * 2 , 0 ) ; geometries . pieceGeom = new THREE . CubeGeometry ( squareSize / 3 , squareSize * 2 , squareSize / 3 ) ; hitPiece = new THREE . Mesh ( geometries . pieceGeom , materials . hitMaterial ) ; missPiece = new THREE . Mesh ( geometries . pieceGeom , materials . missMaterial ) ; text = new THREE . Mesh ( geometries . textGeom , materials . textMaterial ) ; text . position . set ( - 50 , 50 , 0 ) ; scene . add ( text ) ; myTurnMsg = new THREE . Mesh ( geometries . textGeom , materials . myTurnMaterial ) ; myTurnMsg . position . set ( - 50 , 50 , 0 ) ; oppTurnMsg = new THREE . Mesh ( geometries . textGeom , materials . othersTurnMaterial ) ; oppTurnMsg . position . set ( - 50 , 50 , 0 ) ; winMsg = new THREE . Mesh ( geometries . textGeom , materials . winMaterial ) ; winMsg . position . set ( - 50 , 50 , 0 ) ; looseMsg = new THREE . Mesh ( geometries . textGeom , materials . looseMaterial ) ; looseMsg . position . set ( - 50 , 50 , 0 ) ; geometries . planeGeometry = new THREE . PlaneGeometry ( squareSize , squareSize , 20 , 20 ) ; missPlane = new THREE . Mesh ( geometries . planeGeometry . clone ( ) , materials . customMaterial2 ) ; missPlane . rotation . x = - 0.5 * Math . PI ; hitOpp = new THREE . Mesh ( geometries . planeGeometry , materials . customMaterial ) ; missOpp = new THREE . Mesh ( geometries . planeGeometry , materials . customMaterial2 ) geometries . explosion = new THREE . IcosahedronGeometry ( 4 , 4 ) ; hitPlane = new THREE . Mesh ( geometries . explosion , materials . explosionMaterial ) ; callback ( ) ; }
Initialize the objects.
Initialize the objects .
// create the board squares // squareMaterial = materials.squareMaterial; // missPlane.position.set(5, 2.60, 5); // scene.add(missPlane); // splash = true; // setTimeout(function(){ //     splash = false; // }, 3000);