#
luxiaotao1123
2024-04-23 1348954490cb03e7db623bfe407fda601a5df31c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import { useMemo } from 'react';
import { useGLTF } from '@react-three/drei';
import * as THREE from 'three';
import { MODEL_SHELF_SCALE } from '@/config/setting'
 
const Shelf = (props) => {
    const { position = [0, 300, 0], rotationY = 0 } = props;
 
    const { scene } = useGLTF('/models/shelf/row.glb');
    console.log(scene);
 
    const model = useMemo(() => scene.clone(), [scene]);
 
    return (
        <>
            <group rotation-y={rotationY} position={position}>
                <primitive
                    object={model}
                    castShadow
                    receiveShadow
                    scale={[MODEL_SHELF_SCALE, MODEL_SHELF_SCALE, MODEL_SHELF_SCALE]}
                />
            </group>
        </>
    )
}
 
export default Shelf;