From f9b82b114317e5d60f0537685b194da47136e478 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@63.com>
Date: 星期五, 07 一月 2022 09:45:30 +0800
Subject: [PATCH] #
---
static/js/object/StoreGoods.js | 48 +++++++++++++++++++++---------------------------
1 files changed, 21 insertions(+), 27 deletions(-)
diff --git a/static/js/object/StoreGoods.js b/static/js/object/StoreGoods.js
index 79c25a2..fe21954 100644
--- a/static/js/object/StoreGoods.js
+++ b/static/js/object/StoreGoods.js
@@ -21,36 +21,30 @@
}
const manager = new THREE.LoadingManager();
- new MTLLoader(manager)
+ new OBJLoader( manager )
.setPath( '../static/model/obj/' )
- .load( 'pallet.mtl', function ( materials ) {
- materials.preload();
- new OBJLoader( manager )
- .setMaterials( materials )
- .setPath( '../static/model/obj/' )
- .load( 'pallet.obj', function ( obj ) {
- obj.traverse (function (child) {
- child.castShadow = true;
- if (child instanceof THREE.Mesh) {
- child.material = new THREE.MeshLambertMaterial({
- color: 0x2F4F4F
- });
- }
+ .load( 'pallet.obj', function ( obj ) {
+ obj.traverse (function (child) {
+ child.castShadow = true;
+ if (child instanceof THREE.Mesh) {
+ child.material = new THREE.MeshLambertMaterial({
+ color: 0x708090
});
- obj.scale.set(4, 4, 3.5);
+ }
+ });
+ obj.scale.set(4, 4, 3.5);
- palletList.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;
+ palletList.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 = -18 + positionX;
- clone.position.y = 2 + positionY;
- clone.position.z = -46 + positionZ;
- that.object.addObject(clone);
- })
- }, null, null );
+ clone.position.x = -18 + positionX;
+ clone.position.y = 2 + positionY;
+ clone.position.z = -46 + positionZ;
+ that.object.addObject(clone);
+ })
});
const goodsWrapImg = new THREE.TextureLoader( manager ).load( '../static/img/goodsWrap.jpg' );
@@ -76,7 +70,7 @@
clone.position.x = -17 + positionX;
clone.position.y = 5 + positionY;
- clone.position.z = -7 + positionZ;
+ clone.position.z = -6 + positionZ;
that.object.addObject(clone);
})
});
--
Gitblit v1.9.1