js/util.js
/**
 * Add a simple ground plance to the provided scene
 * 
 * @param {THREE.Scene} scene 
 */
Add a simple ground plance to the provided scene


Add a simple ground plance to the provided scene
function addLargeGroundPlane(scene, useTexture) {
    var withTexture = (useTexture !== undefined) ? useTexture : false;
    var planeGeometry = new THREE.PlaneGeometry(10000, 10000);
    var planeMaterial = new THREE.MeshPhongMaterial({
        color: 0xffffff
    });
    if (withTexture) {
        var textureLoader = new THREE.TextureLoader();
        planeMaterial.map = textureLoader.load("../../assets/textures/general/floor-wood.jpg");
        planeMaterial.map.wrapS = THREE.RepeatWrapping; 
        planeMaterial.map.wrapT = THREE.RepeatWrapping; 
        planeMaterial.map.repeat.set(80,80)
    }
    var plane = new THREE.Mesh(planeGeometry, planeMaterial);
    plane.receiveShadow = true;
    plane.rotation.x = -0.5 * Math.PI;
    plane.position.x = 0;
    plane.position.y = 0;
    plane.position.z = 0;
    scene.add(plane);
    return plane;
}
function addLargeGroundPlane ( scene , useTexture ) { var withTexture = ( useTexture !== undefined ) ? useTexture : false ; var planeGeometry = new THREE . PlaneGeometry ( 10000 , 10000 ) ; var planeMaterial = new THREE . MeshPhongMaterial ( { color : 0xffffff } ) ; if ( withTexture ) { var textureLoader = new THREE . TextureLoader ( ) ; planeMaterial . map = textureLoader . load ( "../../assets/textures/general/floor-wood.jpg" ) ; planeMaterial . map . wrapS = THREE . RepeatWrapping ; planeMaterial . map . wrapT = THREE . RepeatWrapping ; planeMaterial . map . repeat . set ( 80 , 80 ) } var plane = new THREE . Mesh ( planeGeometry , planeMaterial ) ; plane . receiveShadow = true ; plane . rotation . x = - 0.5 * Math . PI ; plane . position . x = 0 ; plane . position . y = 0 ; plane . position . z = 0 ; scene . add ( plane ) ; return plane ; }
Add a simple ground plance to the provided scene
Add a simple ground plance to the provided scene
// create the ground plane // rotate and position the plane