From 79f43426a1a14980683f67ea5182b79af87e1178 Mon Sep 17 00:00:00 2001
From: whycq <whycq>
Date: 星期六, 11 十二月 2021 15:33:44 +0800
Subject: [PATCH] #

---
 static/js/object/StoreShelf0.js |   37 ++++++++++++++++---------------------
 1 files changed, 16 insertions(+), 21 deletions(-)

diff --git a/static/js/object/StoreShelf0.js b/static/js/object/StoreShelf0.js
index 8426485..3591c4a 100644
--- a/static/js/object/StoreShelf0.js
+++ b/static/js/object/StoreShelf0.js
@@ -1,24 +1,19 @@
 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.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 shelfMat = new THREE.MeshLambertMaterial({color:0x175EC0});//瀹氫箟鏀灦鍜屾墭鐩樼殑鏉愯川
     //瀹氫箟涓�涓粍鍚堜綋
     let group = new THREE.Group();
 
@@ -30,21 +25,21 @@
     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 planeBoxGeometry = new THREE.BoxGeometry(this.binLength, 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;
+    let leftPositionX=this.positionX-this.binLength/2;
     //鍙充晶鏀灦鏌辩殑X杞村畾浣�
-    let rightPositionX=this.positionX+this.binLength/2-this.rackLengh/2;
+    let rightPositionX=this.positionX+this.binLength/2 - this.rackLengh;    // 缂╄繘鏀灦闀垮害
 
     // 鍒濆鍖栨敮鏋舵ā鍨�
     for(let i=0;i<=this.binZNum;i++) {
         let leftRack = rackObject.clone();
-        let positionZ = this.positionZ - shelfWidth/2 + i*this.binWidth + this.rackWidth/2;
+        let positionZ = this.positionZ - shelfWidth/2 + i*this.binWidth;
         leftRack.position.set(leftPositionX,positionY,positionZ);
         leftRack.updateMatrix();
         group.add(leftRack);
@@ -59,7 +54,7 @@
         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;
+            let positionZ= this.positionZ - shelfWidth/2 + i * this.binWidth + this.binWidth/2;
             plane.position.set(this.positionX-this.rackLengh/2,positionY,positionZ);
             plane.updateMatrix();
             group.add(plane);

--
Gitblit v1.9.1