From c723ad78c8ec058e44a6c4b245af2927ac69b249 Mon Sep 17 00:00:00 2001 From: luxiaotao1123 <t1341870251@163.com> Date: 星期二, 30 四月 2024 11:59:40 +0800 Subject: [PATCH] # --- public/models/shelf/row.fbx | 0 src/config/setting.js | 2 +- public/models/shelf/row1.fbx | 0 public/models/shelf/row2.fbx | 0 src/components/shelf.jsx | 16 ++++++++++++++-- 5 files changed, 15 insertions(+), 3 deletions(-) diff --git a/public/models/shelf/row.fbx b/public/models/shelf/row.fbx index 3b331a6..62097c0 100644 --- a/public/models/shelf/row.fbx +++ b/public/models/shelf/row.fbx Binary files differ diff --git a/public/models/shelf/row1.fbx b/public/models/shelf/row1.fbx new file mode 100644 index 0000000..8a40fd0 --- /dev/null +++ b/public/models/shelf/row1.fbx Binary files differ diff --git a/public/models/shelf/row2.fbx b/public/models/shelf/row2.fbx new file mode 100644 index 0000000..5274850 --- /dev/null +++ b/public/models/shelf/row2.fbx Binary files differ diff --git a/src/components/shelf.jsx b/src/components/shelf.jsx index 5347d8a..67f246b 100644 --- a/src/components/shelf.jsx +++ b/src/components/shelf.jsx @@ -16,6 +16,16 @@ return useGLTF('/models/shelf/row.glb'); }, []) + const model = useMemo(() => { + const fbx = useFBX('/models/shelf/row2.fbx'); + if (!fbx.castShadow) { + Common.setShadow(fbx); + } + // Common.setColor(fbx) + fbx.scale.set(MODEL_SHELF_SCALE * 1.5, MODEL_SHELF_SCALE, MODEL_SHELF_SCALE); + return fbx.clone(); + }, []) + useEffect(() => { state.shelfList[no] = position; }, [props]); @@ -31,10 +41,12 @@ position={[0, 99, 0]} scale={50000} /> */} - <mesh position={[0, 100, 0]}> + + <primitive object={model} castShadow position={[0, 25, 0]} /> + {/* <mesh position={[0, 100, 0]}> <boxGeometry args={[150, 200, 30]} /> <meshStandardMaterial color={'orange'} transparent={true} opacity={.5} /> - </mesh> + </mesh> */} {/* <Box rotationY={0} position={[0, 0, 0]} /> */} </group> </> diff --git a/src/config/setting.js b/src/config/setting.js index e95ac6a..8f6845c 100644 --- a/src/config/setting.js +++ b/src/config/setting.js @@ -14,7 +14,7 @@ export const MODEL_BOX_SCALE = .5; -export const MODEL_SHELF_SCALE = 1; +export const MODEL_SHELF_SCALE = .6; // shelf scale & offset -- Gitblit v1.9.1