feat: add render logic and orbital control for shirt model in r3f
This commit is contained in:
parent
f845668768
commit
12ae38e9dd
@ -1,6 +1,17 @@
|
|||||||
|
import { Suspense } from 'react';
|
||||||
|
import { Canvas } from "@react-three/fiber";
|
||||||
|
import { OrbitControls } from '@react-three/drei'
|
||||||
|
import { Model } from "./Model";
|
||||||
|
|
||||||
export default function App() {
|
export default function App() {
|
||||||
return (
|
return (
|
||||||
<></>
|
<Canvas camera={{ position: [0, 0, 5], fov: 45 }}>
|
||||||
);
|
<Suspense fallback={null}>
|
||||||
|
<Model />
|
||||||
|
</Suspense>
|
||||||
|
<ambientLight intensity={0.8} />
|
||||||
|
<directionalLight position={[3, 4, 5]} intensity={1.2} />
|
||||||
|
<OrbitControls />
|
||||||
|
</Canvas>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
8
reactt/shirt/src/Model.jsx
Normal file
8
reactt/shirt/src/Model.jsx
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
import { useGLTF } from '@react-three/drei'
|
||||||
|
|
||||||
|
export function Model() {
|
||||||
|
const { scene } = useGLTF('/models/ShirtBaked2.glb')
|
||||||
|
return <primitive object={scene} scale={5} position={[0, -1, 0]} />
|
||||||
|
}
|
||||||
|
|
||||||
|
useGLTF.preload('/models/ShirtBaked2.glb')
|
||||||
Loading…
x
Reference in New Issue
Block a user