#
luxiaotao1123
2024-04-23 794d8a8a7de3bcfad9d6f813a0372bf46a3956eb
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
29
30
31
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;