| | |
| | | let rackBoxGeometry=new THREE.BoxGeometry(this.rackLengh,shelfHeight,this.rackWidth); |
| | | // 托板模型 + 材质 |
| | | let planeBoxGeometry = new THREE.BoxGeometry(this.binLength, 2, this.binWidth+this.rackWidth); // 覆盖多一根支架宽度 |
| | | let planeRackBoxGeometry = new THREE.BoxGeometry(3, 2, this.binWidth+this.rackWidth); |
| | | |
| | | // Y轴定位 |
| | | let positionY = this.positionY + shelfHeight / 2; |
| | |
| | | // 初始化托板模型 |
| | | for(let i = 0;i < this.binZNum;i++) { |
| | | for (let j = 0;j <= this.binYNum;j++) { |
| | | if (j !== this.binYNum) { |
| | | let leftClone = planeRackBoxGeometry.clone(); |
| | | let positionY = this.positionY + this.bottomHight + j*this.binHeight + 1; |
| | | let positionZ = - ( this.positionZ + i * this.binWidth + this.binWidth/2 ); |
| | | transform.position.set(this.positionX - 16, positionY, positionZ); |
| | | transform.updateMatrix(); |
| | | leftClone.applyMatrix4(transform.matrix); |
| | | geometries.push(leftClone); |
| | | |
| | | let rightClone = planeRackBoxGeometry.clone(); |
| | | positionY = this.positionY + this.bottomHight + j*this.binHeight + 1; |
| | | positionZ = - ( this.positionZ + i * this.binWidth + this.binWidth/2 ); |
| | | transform.position.set(this.positionX + 13, positionY, positionZ); |
| | | transform.updateMatrix(); |
| | | rightClone.applyMatrix4(transform.matrix); |
| | | geometries.push(rightClone); |
| | | } else { |
| | | let clone = planeBoxGeometry.clone(); |
| | | let positionY= this.positionY + this.bottomHight + j*this.binHeight + 1; |
| | | let positionZ= - ( this.positionZ + i * this.binWidth + this.binWidth/2 ); |
| | |
| | | geometries.push(clone); |
| | | } |
| | | } |
| | | } |
| | | |
| | | let mergedGeometry = BufferGeometryUtils.mergeBufferGeometries(geometries); |
| | | let mesh = new THREE.Mesh(mergedGeometry, shelfMat); |