#
luxiaotao1123
2021-12-25 978aa05175a89b195b7af5c5641a2b93511932df
#
2个文件已修改
118 ■■■■ 已修改文件
static/js/data/ConveyData.js 62 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
static/js/object/StoreConvey.js 56 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
static/js/data/ConveyData.js
@@ -2,56 +2,62 @@
    objects: [
        {
            no: '1',
            objectName: 'chain-1',
            objectType: 'chain',
            length: 2750,
            width: 800,
            height: 1,
            position: {
                x: 110,
                y: 0,
                z: 220
            },
            style:{
                color: 0x5F7480,
            rotateY: 0,
            traverse: {
                color: 0xAAAAAA,
                scale: {
                    x: 1,
                    y: 1,
                    z: 1
                }
            }
        },
        {
            no: '2',
            objectName: 'chain-2',
            objectType: 'chain',
            length: 2750,
            width: 800,
            height: 1,
            position: {
                x: 0,
                y: 0,
                z: 0
            },
            style:{
                color: 0x5F7480,
            }
        },
        {
            no: '2',
            objectName: 'roller-1',
            objectType: 'roller',
            length: 2750,
            width: 800,
            height: 1,
            position: {
                x: 0,
                y: 0,
                z: 0
            },
            style:{
            rotateY: Math.PI/2,
            traverse: {
                scale: {
                    x: 2,
                    y: 2,
                    z: 2
                },
                color: 0x5F7480,
            }
        },
        {
            no: '3',
            objectType: 'roller',
            position: {
                x: 210,
                y: 10,
                z: 120
            },
            rotateY: Math.PI/2,
            traverse: {
                scale: {
                    x: 2,
                    y: 2,
                    z: 2
                },
                color: 0x000000,
            }
        },
        {
            no: '3',
            objectName: 'transport-1',
            objectType: 'transport',
            objectType: 'transport1',
            length: 2750,
            width: 800,
            height: 1,
static/js/object/StoreConvey.js
@@ -43,15 +43,57 @@
                    });
                }
            });
            for (let k=0;k<chainList.length;k++) {
                let clone = obj.clone();
                clone.position.x = 0 + chainList[k].position.x;
                clone.position.y = 0 + chainList[k].position.y;
                clone.position.z = 0 + chainList[k].position.z;
                that.object.addObject( clone );
            }
            chainList.map(item => {
                that.object.addObject(customize(obj.clone(), item));
            })
        });
        new THREE.ObjectLoader().load( "../static/model/json/辊筒输送机.json", function (obj) {
            obj.traverse (function (child) {
                if (child instanceof THREE.Mesh) {
                    child.scale.set(1, 1, 1.8);
                    child.material = new THREE.MeshLambertMaterial({
                        color: 0xAAAAAA
                    });
                }
            });
            rollerList.map(item => {
                that.object.addObject(customize(obj.clone(), item));
            })
        });
        new THREE.ObjectLoader().load( "../static/model/json/顶升移栽.json", function (obj) {
            obj.traverse (function (child) {
                if (child instanceof THREE.Mesh) {
                    child.scale.set(1, 1, 1.8);
                    child.material = new THREE.MeshLambertMaterial({
                        color: 0xAAAAAA
                    });
                }
            });
            transportList.map(item => {
                that.object.addObject(customize(obj.clone(), item));
            })
        });
    }
    function customize(clone, info) {
        clone.position.x = 0 + info.position.x;
        clone.position.y = 0 + info.position.y;
        clone.position.z = 0 + info.position.z;
        clone.rotateY(info.rotateY);
        if (info.traverse !== undefined) {
            let traverse = info.traverse;
            clone.traverse (function (child) {
                if (child instanceof THREE.Mesh) {
                    child.scale.set(traverse.scale.x, traverse.scale.y, traverse.scale.z);
                    child.material = new THREE.MeshLambertMaterial({
                        color: traverse.color
                    });
                }
            });
        }
        return clone;
    }
}
export {StoreConvey}