#
luxiaotao1123
2024-04-26 07e8e33114cf97a8f10b871d6e4c5d3addd28c7a
#
3个文件已修改
13 ■■■■ 已修改文件
src/components/box.jsx 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/shelf.jsx 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/store/index.js 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/box.jsx
@@ -4,10 +4,12 @@
import * as THREE from 'three';
import { MODEL_BOX_SCALE } from '@/config/setting'
import * as Common from '../utils/common';
import { useStore } from '@/store';
const Box = (props) => {
    const { position = [0, 300, 0], rotationY = 0 } = props;
    const state = useStore();
    const boxModel = useMemo(() => {
        const fbx = useFBX('/models/box/box.fbx');
        if (!fbx.castShadow) {
@@ -18,8 +20,8 @@
    }, [])
    useEffect(() => {
    }, []);
        console.log(state.shelfList['1-1-1']);
    }, [props]);
    return (
        <>
src/components/shelf.jsx
@@ -2,7 +2,6 @@
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';
@@ -18,7 +17,7 @@
    }, [])
    useEffect(() => {
        snapshot(state).models[no] = position;
        state.shelfList[no] = position;
    }, [props]);
    return (
src/store/index.js
@@ -4,7 +4,7 @@
const store = proxy(
    {
        text: 'Hello World',
        shelf: {},
        shelfList: {},
    }
);