#
luxiaotao1123
2024-04-28 201321e7379ebc00a80fd48415ece152481801fb
src/components/shelf.jsx
@@ -2,18 +2,24 @@
import { useGLTF, useFBX } from '@react-three/drei';
import * as THREE from 'three';
import { MODEL_SHELF_SCALE } from '@/config/setting'
import { useStore } from '@/store';
import { DRACOLoader } from 'three/examples/jsm/loaders/DRACOLoader';
import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader';
import Box from './box';
import * as Common from '../utils/common';
const Shelf = (props) => {
    const { position = [0, 300, 0], rotationY = 0 } = props;
    const { no, position = [0, 300, 0], rotationY = 0 } = props;
    const state = useStore();
    const { nodes, materials } = useMemo(() => {
        return useGLTF('/models/shelf/row.glb');
    }, [])
    useEffect(() => {
        state.shelfList[no] = position;
    }, [props]);
    return (
        <>
            <group rotation-y={rotationY} position={position}>