#
luxiaotao1123
2022-01-05 f9bad0ac4a11a56f2ab3048d19e7caf01cd9aa2d
static/js/object/StoreGoods.js
@@ -38,24 +38,48 @@
                        }
                    });
                    obj.scale.set(4, 4, 3.5);
                    obj.position.x = -1;
                    obj.position.y = 22;
                    obj.position.z = -46;
                    palletList.map(item => {
                        var clone = obj.clone();
                        let clone = obj.clone();
                        let positionX = that.shelf.positionX || 0;
                        let positionY = that.shelf.positionY || 0;
                        let positionZ = that.shelf.positionZ || 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 = 22 + positionY;
                        clone.position.y = 2 + positionY;
                        clone.position.z = -46 + positionZ;
                        that.object.addObject(clone);
                    })
                }, 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}