import {MTLLoader} from "../lib/MTLLoader.js"; import {OBJLoader} from "../lib/OBJLoader.js"; import {Color} from "../three.module.js"; const xOffset = -1658; const yOffset = -553; const zOffset = -1800; const xOffset0 = -1407; const yOffset0 = 0; const zOffset0 = 490; function StoreConvey(object) { const manager = new THREE.LoadingManager(); let chain = null; new MTLLoader(manager) .setPath( '../static/model/obj/' ) .load( '链条输送机.mtl', function ( materials ) { materials.preload(); new OBJLoader( manager ) .setMaterials( materials ) .setPath( '../static/model/obj/' ) .load( '链条输送机.obj', function ( obj ) { chain = obj; chain.scale.set(0.03, 0.03, 0.025); chain.rotateY( -Math.PI / 2); chain.traverse (function (child) { if (child instanceof THREE.Mesh) { child.material = new THREE.MeshLambertMaterial({ color: 0xAAAAAA }); } }); for (let i = 0; i<24; i++) { let clone = chain.clone(); // roller.name = option.crnNo + "-body"; let offset = 0; if (i % 2 === 0) { offset = 90; } clone.position.x = xOffset0 + 56 + offset + Math.floor(i/2)*230; clone.position.y = yOffset0; clone.position.z = zOffset0 + 39; object.addObject( clone ); } for (let i = 0; i<24; i++) { let clone = chain.clone(); // roller.name = option.crnNo + "-body"; let offset = 0; if (i % 2 === 0) { offset = 90; } clone.position.x = xOffset0 + 56 + offset + Math.floor(i/2)*230; clone.position.y = yOffset0; clone.position.z = zOffset0 + 39 + 82; object.addObject( clone ); } for (let i = 0; i<24; i++) { var clone = chain.clone(); // roller.name = option.crnNo + "-body"; let offset = 0; if (i % 2 === 0) { offset = 90; } clone.position.x = xOffset0 + 56 + offset + Math.floor(i/2)*230; clone.position.y = yOffset0 + 310; clone.position.z = zOffset0 + 39; object.addObject( clone ); } for (let i = 0; i<24; i++) { let clone = chain.clone(); // roller.name = option.crnNo + "-body"; let offset = 0; if (i % 2 === 0) { offset = 90; } clone.position.x = xOffset0 + 56 + offset + Math.floor(i/2)*230; clone.position.y = yOffset0 + 310; clone.position.z = zOffset0 + 39 + 82; object.addObject( clone ); } }, null, null ); }); let roller = null; new MTLLoader(manager) .setPath( '../static/model/obj/' ) .load( '123.mtl', function ( materials ) { materials.preload(); new OBJLoader( manager ) .setMaterials( materials ) .setPath( '../static/model/obj/' ) .load( '123.obj', function ( obj ) { roller = obj; roller.traverse (function (child) { if (child instanceof THREE.Mesh) { child.material = new THREE.MeshLambertMaterial({ color: 0xCD6839 }); } }); roller.scale.set(1000, 1000, 1000); roller.rotateY(- Math.PI / 2); // roller.name = option.crnNo + "-body"; roller.position.x = xOffset; roller.position.y = yOffset; roller.position.z = zOffset; // object.addObject( roller ); }, null, null ); }); } export {StoreConvey}