New file |
| | |
| | | const shelfData = [ |
| | | { |
| | | x: 200, |
| | | y: -1000, |
| | | width: 200, |
| | | height: 2000, |
| | | tunnelNumber: 'T1', |
| | | }, |
| | | { |
| | | x: 200, |
| | | y: -50, |
| | | width: 1300, |
| | | height: 100, |
| | | tunnelNumber: 'T2', |
| | | }, |
| | | ]; |
| | | |
| | | export default shelfData; |
| | |
| | | |
| | | return ( |
| | | <> |
| | | <group rotation-y={rotationY} scale={0.5} position={position}> |
| | | <group rotation-y={rotationY} position={position}> |
| | | <primitive object={boxModel} castShadow /> |
| | | </group> |
| | | </> |
New file |
| | |
| | | import { useState, useMemo, useRef, useEffect } from 'react'; |
| | | import { useGLTF } from '@react-three/drei'; |
| | | import { MODEL_SHELF_SCALE } from '@/config/setting'; |
| | | import * as Common from '../utils/common'; |
| | | |
| | | const Shelf = (props) => { |
| | | const { position = [0, 300, 0], rotationY = 0 } = props; |
| | | |
| | | const model = useMemo(() => { |
| | | const fbx = useGLTF('/models/shelf/row.glb'); |
| | | if (!fbx.castShadow) { |
| | | Common.setShadow(fbx); |
| | | } |
| | | fbx.scale.set(MODEL_SHELF_SCALE, MODEL_SHELF_SCALE, MODEL_SHELF_SCALE); |
| | | return fbx.clone(); |
| | | }, []) |
| | | |
| | | useEffect(() => { |
| | | |
| | | }, []); |
| | | |
| | | return ( |
| | | <> |
| | | <group rotation-y={rotationY} position={position}> |
| | | <primitive object={model} castShadow /> |
| | | </group> |
| | | </> |
| | | ) |
| | | } |
| | | |
| | | export default Shelf; |
| | |
| | | |
| | | export const MODEL_AGV_SCALE = .5; |
| | | |
| | | export const MODEL_BOX_SCALE = 1; |
| | | export const MODEL_BOX_SCALE = .5; |
| | | |
| | | export const MODEL_SHELF_SCALE = 1; |
| | |
| | | import { useState, useEffect, useRef, useMemo } from 'react'; |
| | | import { useFrame } from '@react-three/fiber'; |
| | | import * as THREE from 'three'; |
| | | import Agv from '../components/agv'; |
| | | import Box from '../components/box'; |
| | | import tunnelData from '../assets/data/tunnel'; |
| | | import Tunnel from '../components/tunnel'; |
| | | import Shelf from '../components/shelf'; |
| | | import Box from '../components/box'; |
| | | import Agv from '../components/agv'; |
| | | |
| | | import tunnelData from '@/assets/data/tunnel'; |
| | | import shelfData from '@/assets/data/shelf'; |
| | | import agvRealDataList from '@/assets/data/agv'; |
| | | import { INTERVAL_TIME } from '@/config/setting' |
| | | |
| | |
| | | }, []) |
| | | |
| | | const tunnelEl = useMemo(() => { |
| | | return tunnelData.map((tunnel, index) => <Tunnel key={index} {...tunnel} />) |
| | | return tunnelData.map((data, index) => <Tunnel key={index} {...data} />) |
| | | }, []); |
| | | |
| | | const shelfEl = useMemo(() => { |
| | | return shelfData.map((data, index) => <Shelf key={index} {...data} />) |
| | | }, []); |
| | | |
| | | const agvEl = useMemo(() => { |
| | |
| | | <> |
| | | <group> |
| | | {tunnelEl} |
| | | {shelfEl} |
| | | {agvEl} |
| | | {boxEl} |
| | | </group> |