#
luxiaotao1123
2021-12-24 6246e243f2f644989acaff255f407900fd51f9f7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import {MTLLoader} from "../lib/MTLLoader.js";
import {OBJLoader} from "../lib/OBJLoader.js";
import * as THREE from '../three.module.js';
 
 
function StoreConvey(object) {
    let that = this;
    that.no = 0;
    that.objectType = null;
    that.position = null;
 
    let init = function () {
        that.no = object.no;
        that.objectType = object.objectType;
        that.position = object.position;
    };
    init();
 
    that.create = function (scene) {
        switch (that.objectType) {
            case "chain":
                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
                            });
                        }
                    });
                    obj.position.x = 0 + that.position.x;
                    obj.position.y = 0 + that.position.y;
                    obj.position.z = 0 + that.position.z;
                    scene.addObject( obj );
                    scene.conveyTypes.push({type: that.objectType, object: obj});
                } );
                break;
            case "roller":
                break;
            case "transport":
                break;
            default:
                break;
        }
    }
 
    this.clone = function (param) {
        let goods=param.clone();
        goods.position.set(this.positionX,this.positionY,this.positionZ);
        goods.uuid=this.no;
        goods.name=this.name;
        goods.type="StoreGoods";
        return goods;
    }
 
}
 
export {StoreConvey}