From f9bad0ac4a11a56f2ab3048d19e7caf01cd9aa2d Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@63.com>
Date: 星期三, 05 一月 2022 10:07:36 +0800
Subject: [PATCH] #

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

diff --git a/static/js/object/StoreGoods.js b/static/js/object/StoreGoods.js
index 37b1124..79c25a2 100644
--- a/static/js/object/StoreGoods.js
+++ b/static/js/object/StoreGoods.js
@@ -53,6 +53,33 @@
                 }, null, null );
         });
 
+    const goodsWrapImg = new THREE.TextureLoader( manager ).load( '../static/img/goodsWrap.jpg' );
+    const goodsImg = new THREE.TextureLoader( manager ).load( '../static/img/goods.jpg' );
+    new OBJLoader( manager ).load( '../static/model/obj/goods.obj', function ( obj ) {
+        obj.traverse (function (child) {
+            child.castShadow = true;
+            if (child instanceof THREE.Mesh) {
+                if (child.name === 'goods') {
+                    child.material.map = goodsImg;
+                } else if (child.name === "goods_wrap") {
+                    child.material.map = goodsWrapImg;
+                }
+            }
+        });
+        obj.scale.set(1, 1.2, 1.2);
+
+        goodsList.map(item => {
+            let clone = obj.clone();
+            let positionX = that.shelf.positionX || 0;
+            let positionY = that.shelf.bottomHight + (item.lev1-1)*that.shelf.binHeight || 0;
+            let positionZ = (item.bay1-1)*-that.shelf.binHeight || 0;
+
+            clone.position.x = -17 + positionX;
+            clone.position.y = 5 + positionY;
+            clone.position.z = -7 + positionZ;
+            that.object.addObject(clone);
+        })
+    });
 }
 
 export {StoreGoods}

--
Gitblit v1.9.1