#
luxiaotao1123
2024-04-26 73e5e4f17c23a7f4832ea2bb36e1bd3799ab9ad9
src/components/shelf.jsx
@@ -2,18 +2,25 @@
import { useGLTF, useFBX } from '@react-three/drei';
import * as THREE from 'three';
import { MODEL_SHELF_SCALE } from '@/config/setting'
import { snapshot } from 'valtio';
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(() => {
        snapshot(state).models[no] = position;
    }, [props]);
    return (
        <>
            <group rotation-y={rotationY} position={position}>