From 0c6906bf442053ab667c0e49c302002e3921281e Mon Sep 17 00:00:00 2001
From: whycq <whycq>
Date: 星期四, 09 十二月 2021 16:55:15 +0800
Subject: [PATCH] Merge branch 'dev' of http://47.97.1.152:5880/r/ASRS-3D into dev
---
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..c30aae0
--- /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, 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;
+ //鍙充晶鏀灦鏌辩殑X杞村畾浣�
+ 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;
+ 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;
+ plane.position.set(this.positionX-this.rackLengh/2,positionY,positionZ);
+ plane.updateMatrix();
+ group.add(plane);
+ }
+ }
+ return group;
+}
--
Gitblit v1.9.1