From 0ac1382eda6788c2839dd8be2bfd11a9ec8fc594 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@63.com>
Date: 星期四, 09 十二月 2021 15:50:43 +0800
Subject: [PATCH] #

---
 static/js/object/StoreShelf0.js |   69 ++++++++++++++++++++++++++++++++++
 1 files changed, 69 insertions(+), 0 deletions(-)

diff --git a/static/js/object/StoreShelf0.js b/static/js/object/StoreShelf0.js
new file mode 100644
index 0000000..8426485
--- /dev/null
+++ b/static/js/object/StoreShelf0.js
@@ -0,0 +1,69 @@
+function StoreShelf0(option) {
+    this.binLength = option.BinLength||50;//搴撲綅闀垮害
+    this.binWidth = option.BinWidth||50;//搴撲綅瀹�
+    this.binHeight = option.BinHeight||50;//搴撲綅楂�
+    this.binXNum = option.BinXNum||1;//搴撲綅X杞存柟鍚戝簱浣嶆暟閲�
+    this.binZNum = option.BinZNum||10;//搴撲綅Z杞存柟鍚戝簱浣嶆暟閲�
+    this.binYNum = option.BinYNum||10;//搴撲綅Y杞村簱浣嶆暟閲�
+    this.bottomHight = option.BottomHeight||20;//搴曞眰楂樺害锛屽簳灞�
+    this.positionX = option.Position.X||0;//搴撲綅浣嶇疆
+    this.positionY = option.Position.Y||0;//搴撲綅浣嶇疆
+    this.positionZ = option.Position.Z||0;//搴撲綅浣嶇疆
+    this.rackLengh = 3;//鏀灦鐨勯暱搴︼紝榛樿璁惧姩涓�3
+    this.rackWidth = 3;//鏀灦鐨勫搴︼紝榛樿璁惧畾涓�3
+
+    // 鏉愯川
+    let shelfMat = new THREE.MeshPhysicalMaterial({
+        color:0xfc8c00,
+        metalness: 1.0,
+        roughness: 0.6,
+    })
+
+    //瀹氫箟涓�涓粍鍚堜綋
+    let group = new THREE.Group();
+
+    // 璐ф灦鎬婚珮
+    let shelfHeight=this.bottomHight+(this.binYNum-1)*this.binHeight;
+    // 璐ф灦鎬诲
+    let shelfWidth=this.binZNum*this.binWidth;
+    // 鏀灦妯″瀷 + 鏉愯川
+    let rackBoxGeometry=new THREE.BoxGeometry(this.rackLengh,shelfHeight,this.rackWidth);
+    let rackObject=new THREE.Mesh(rackBoxGeometry, shelfMat, 0);
+    // 鎵樻澘妯″瀷 + 鏉愯川
+    let planeBoxGeometry = new THREE.BoxGeometry(this.binLength+this.rackLengh, 2, this.binWidth+this.rackWidth);
+    let planeObject=new THREE.Mesh(planeBoxGeometry, shelfMat, 0);
+
+    // Y杞村畾浣�
+    let positionY = this.positionY + shelfHeight / 2;
+
+    //宸︿晶鏀灦鏌辩殑X杞村畾浣�
+    let leftPositionX=this.positionX-this.binLength/2-this.rackLengh/2;
+    //鍙充晶鏀灦鏌辩殑X杞村畾浣�
+    let rightPositionX=this.positionX+this.binLength/2-this.rackLengh/2;
+
+    // 鍒濆鍖栨敮鏋舵ā鍨�
+    for(let i=0;i<=this.binZNum;i++) {
+        let leftRack = rackObject.clone();
+        let positionZ = this.positionZ - shelfWidth/2 + i*this.binWidth + this.rackWidth/2;
+        leftRack.position.set(leftPositionX,positionY,positionZ);
+        leftRack.updateMatrix();
+        group.add(leftRack);
+
+        let rightRack = rackObject.clone();
+        rightRack.position.set(rightPositionX,positionY,positionZ);
+        rightRack.updateMatrix();
+        group.add(rightRack);
+    }
+    // 鍒濆鍖栨墭鏉挎ā鍨�
+    for(let i = 0;i < this.binZNum;i++) {
+        for (let j = 0;j < this.binYNum;j++) {
+            let plane = planeObject.clone();
+            let positionY= this.positionY + this.bottomHight + j*this.binHeight + 1;
+            let positionZ= this.positionZ - shelfWidth/2 + i * this.binWidth + this.binWidth / 2+this.rackWidth/2;
+            plane.position.set(this.positionX-this.rackLengh/2,positionY,positionZ);
+            plane.updateMatrix();
+            group.add(plane);
+        }
+    }
+    return group;
+}

--
Gitblit v1.9.1