| | |
| | | |
| | | initCamera = () => { |
| | | const camera = new THREE.PerspectiveCamera(70, this.getFullWidth() / this.getFullHeight(), 1, 60000); |
| | | camera.position.set(-300, 300, 300); |
| | | camera.position.set(-300, 800, 300); |
| | | this.scene.add(camera); |
| | | return camera; |
| | | } |
| | |
| | | scene.add(ambientLight); |
| | | |
| | | const spotLight = new THREE.SpotLight(0xffffff, 8); |
| | | spotLight.position.set(-300, 300, 0); |
| | | spotLight.position.set(-300, 1000, 0); |
| | | spotLight.angle = Math.PI / 4; // 角度 |
| | | spotLight.distance = 800; // 距离 |
| | | spotLight.decay = 0; // 光衰 |
| | |
| | | if (res?.data && shelfThree) { |
| | | shelfThree.generateMesh((scene) => { |
| | | for (const item of res.data) { |
| | | console.log(item); |
| | | const { row, bay, lev } = Utils.parseLocNo(item.locNo); |
| | | console.log(row, bay, lev); |
| | | // shelf |
| | | const shelfMesh = new THREE.Mesh(new THREE.BoxGeometry(100, 40, 100), new THREE.MeshStandardMaterial({ |
| | | color: '#222f3e', |
| | | })); |
| | | shelfMesh.position.set(0, 20, 0); |
| | | shelfMesh.position.set(0, 20 + 100 * (lev - 1), 0); |
| | | scene.add(shelfMesh) |
| | | |
| | | // pallet |
| | | const palletMesh = new THREE.Mesh(new THREE.BoxGeometry(100, 60, 100), new THREE.MeshStandardMaterial({ |
| | | color: '#b33939', |
| | | })); |
| | | palletMesh.position.set(0, 70, 0); |
| | | palletMesh.position.set(0, 70 + 100 * (lev - 1), 0); |
| | | scene.add(palletMesh) |
| | | } |
| | | }); |
| | |
| | | } else { |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | export const parseLocNo = (locNo) => { |
| | | if (!locNo || typeof locNo !== 'string') { |
| | | return null; |
| | | } |
| | | const locParseArr = locNo.split('-'); |
| | | return { |
| | | row: locParseArr?.[0], |
| | | bay: locParseArr?.[1], |
| | | lev: locParseArr?.[2], |
| | | } |
| | | } |