| | |
| | | } |
| | | |
| | | 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: 0x708090 |
| | | }); |
| | | } |
| | | .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' ); |
| | |
| | | |
| | | clone.position.x = -17 + positionX; |
| | | clone.position.y = 5 + positionY; |
| | | clone.position.z = -7 + positionZ; |
| | | clone.position.z = -6 + positionZ; |
| | | that.object.addObject(clone); |
| | | }) |
| | | }); |