这节算是给这个车间场景收个尾,等了几天并没有人发设备模型给我,只能自己找了一个凑合用了。加载模型之前,首先要把货架上的料箱合并,以防加载模型之后因模型数量多出现卡顿,方法和之前介绍的合并传送带方法相同,代码如下:
//初始化料箱
initCube(){
let cubeList = [];
const textureLoader = new THREE.TextureLoader();
let texture = textureLoader.load("/static/images/box.png",)
const material = new THREE.MeshBasicMaterial({map: texture});
for(let q=0; q<this.shelfList.length;q++){
for(let i=0;i<this.layerNum;i++){
for(let j=0;j<this.columnNum;j++){
let x = this.shelfList[q].positionX;
let y = this.shelfList[q].positionY + 2 + j * (this.plane.planeLength / 3)
let z = this.shelfList[q].positionZ + i * (this.holder.holderHeight + this.plane.planeHeight)-9
cubeList.push(this.addCube(x - 2, y, z));
cubeList.push(this.addCube(x +