#
luxiaotao1123
2021-12-17 c087c4b39244d8da62aa4119258500b411b79ffc
#
2个文件已修改
4个文件已添加
1个文件已删除
120 ■■■■ 已修改文件
static/img/floor/hardwood2_bump.jpg 补丁 | 查看 | 原始文档 | blame | 历史
static/img/floor/hardwood2_diffuse.jpg 补丁 | 查看 | 原始文档 | blame | 历史
static/img/floor/hardwood2_roughness.jpg 补丁 | 查看 | 原始文档 | blame | 历史
static/js/app.js 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
static/js/object/Floor.js 95 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
static/js/object/RouteLine.js 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
views/index.html 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
static/img/floor/hardwood2_bump.jpg
static/img/floor/hardwood2_diffuse.jpg
static/img/floor/hardwood2_roughness.jpg
static/js/app.js
@@ -179,13 +179,16 @@
            // plane.position.y = - 200;
            // plane.receiveShadow = true;
            // this.addObject(plane);
            //
            // const helper = new THREE.PolarGridHelper( 2000, 100 );
            const helper = new THREE.GridHelper( 8000, 300 );
            helper.position.y = - 0;
            helper.material.opacity = 0.25;
            helper.material.transparent = true;
            this.addObject( helper );
            // this.addObject(new Floor({position: {}}))
        }
        this.initStoreObjects = function (object) {
            if (this.firstTime === 1) {
@@ -212,7 +215,6 @@
                        }
                    }
                }
            }
        }
static/js/object/Floor.js
New file
@@ -0,0 +1,95 @@
/**
 * 地板
 * @param option
 * @constructor
 */
function Floor(option) {
    this.length = option.length || 5000;
    this.width = option.width || 5000;
    this.height = option.height || 1;
    this.Name = option.objName;
    this.positionX = option.position.x || 0;
    this.positionY = option.position.y || 0;
    this.positionZ = option.position.z || 0;
    this.style = option.style || {color: 0xFF0000};
    // 材质
    // var texture = null;
    // var material = new THREE.MeshPhongMaterial({map: texture, color: option.style.color});
    // if (option.style.image != null) {
    //     texture = new THREE.TextureLoader().load(option.style.image);
    //     if (option.style.allowRepeat === 1) {
    //         texture.repeat.x = option.length / 128;
    //         texture.repeat.y = option.width / 128;
    //         texture.repeat.y = 5;
    //         texture.wrapS = texture.wrapT = THREE.RepeatWrapping;
    //
    //     }
    //     material = new THREE.MeshPhongMaterial({map: texture});
    // }
    var floorMat = new THREE.MeshStandardMaterial( {
        roughness: 0.8,
        color: 0xffffff,
        metalness: 0.2,
        bumpScale: 0.0005
    } );
    const textureLoader = new THREE.TextureLoader();
    textureLoader.load( "../static/img/floor/hardwood2_diffuse.jpg", function ( map ) {
        map.wrapS = THREE.RepeatWrapping;
        map.wrapT = THREE.RepeatWrapping;
        map.anisotropy = 4;
        map.repeat.set( 10, 24 );
        map.encoding = THREE.sRGBEncoding;
        floorMat.map = map;
        floorMat.needsUpdate = true;
    } );
    textureLoader.load( "../static/img/floor/hardwood2_bump.jpg", function ( map ) {
        map.wrapS = THREE.RepeatWrapping;
        map.wrapT = THREE.RepeatWrapping;
        map.anisotropy = 4;
        map.repeat.set( 10, 24 );
        floorMat.bumpMap = map;
        floorMat.needsUpdate = true;
    } );
    textureLoader.load( "../static/img/floor/hardwood2_roughness.jpg", function ( map ) {
        map.wrapS = THREE.RepeatWrapping;
        map.wrapT = THREE.RepeatWrapping;
        map.anisotropy = 4;
        map.repeat.set( 10, 24 );
        floorMat.roughnessMap = map;
        floorMat.needsUpdate = true;
    } );
    const floorGeometry = new THREE.PlaneGeometry( this.length, this.width );
    const floorMesh = new THREE.Mesh( floorGeometry, floorMat );
    floorMesh.receiveShadow = true;
    floorMesh.rotation.x = - Math.PI / 2.0;
    return floorMesh;
    // if (option.style.transparent === 1) {
    //     material.transparent = true;
    // }
    // if (option.style.depthTest === 0) {
    //     material.depthTest = false;
    // }
    // material.opacity = option.style.opacity;
    // // 模型
    // let cubeGeometry = new THREE.BoxGeometry(this.length, this.height, this.width);
    //
    // let cube = new THREE.Mesh(cubeGeometry, material);
    // cube.name = this.Name;
    // cube.position.x = this.positionX;
    // cube.position.y = this.positionY;
    // cube.position.z = this.positionZ;
    // return cube;
}
static/js/object/RouteLine.js
File was deleted
views/index.html
@@ -20,8 +20,8 @@
<!--        <script type="text/javascript" src="../static/js/object/StoreShelf.js"></script>-->
        <script type="text/javascript" src="../static/js/object/StoreGoods.js"></script>
        <script type="text/javascript" src="../static/js/object/Route.js"></script>
        <script type="text/javascript" src="../static/js/object/RouteLine.js"></script>
        <script type="text/javascript" src="../static/js/object/CrnTask.js"></script>
        <script type="text/javascript" src="../static/js/object/Floor.js"></script>
        <script type="text/javascript" src="../static/js/lib/btnHide.js"></script>
    </head>
    <body style="position: relative">