9
9
usePointToPointConstraint ,
10
10
useSphere ,
11
11
} from '@react-three/cannon'
12
+ import { useGLTF } from '@react-three/drei'
12
13
import type { BoxGeometryProps , MeshProps , MeshStandardMaterialProps , ThreeEvent } from '@react-three/fiber'
13
- import { Canvas , useFrame , useLoader } from '@react-three/fiber'
14
+ import { Canvas , useFrame } from '@react-three/fiber'
14
15
import type { ReactNode , RefObject } from 'react'
15
16
import {
16
17
createContext ,
@@ -25,7 +26,6 @@ import {
25
26
} from 'react'
26
27
import type { Group , Material , Mesh , Object3D , SpotLight } from 'three'
27
28
import type { GLTF } from 'three-stdlib/loaders/GLTFLoader'
28
- import { GLTFLoader } from 'three-stdlib/loaders/GLTFLoader'
29
29
30
30
import type { ShapeName } from './createConfig'
31
31
import { createRagdoll } from './createConfig'
@@ -206,7 +206,7 @@ interface CupGLTF extends GLTF {
206
206
}
207
207
208
208
function Mug ( ) {
209
- const { nodes, materials } = useLoader ( GLTFLoader , '/cup.glb' ) as CupGLTF
209
+ const { nodes, materials } = useGLTF ( '/cup.glb' ) as CupGLTF
210
210
const [ ref ] = useCylinder (
211
211
( ) => ( {
212
212
args : [ 0.6 , 0.6 , 1 , 16 ] ,
@@ -292,8 +292,16 @@ const Lamp = () => {
292
292
< mesh ref = { lamp } { ...bind } >
293
293
< coneGeometry attach = "geometry" args = { [ 2 , 2.5 , 32 ] } />
294
294
< meshStandardMaterial attach = "material" />
295
- < pointLight intensity = { 10 } distance = { 5 } />
296
- < spotLight ref = { light } position = { [ 0 , 20 , 0 ] } angle = { 0.4 } penumbra = { 1 } intensity = { 0.6 } castShadow />
295
+ < pointLight decay = { 5 } intensity = { 10 * Math . PI } />
296
+ < spotLight
297
+ angle = { 0.4 }
298
+ decay = { 0 }
299
+ penumbra = { 1 }
300
+ position = { [ 0 , 20 , 0 ] }
301
+ ref = { light }
302
+ intensity = { 0.6 * Math . PI }
303
+ castShadow
304
+ />
297
305
</ mesh >
298
306
</ >
299
307
)
@@ -322,15 +330,11 @@ export default () => (
322
330
orthographic
323
331
shadows
324
332
style = { { cursor : 'none' } }
325
- gl = { {
326
- // todo: stop using legacy lights
327
- useLegacyLights : true ,
328
- } }
329
333
>
330
334
< color attach = "background" args = { [ '#171720' ] } />
331
335
< fog attach = "fog" args = { [ '#171720' , 20 , 70 ] } />
332
- < ambientLight intensity = { 0.2 } />
333
- < pointLight position = { [ - 10 , - 10 , - 10 ] } color = "red" intensity = { 1.5 } />
336
+ < ambientLight intensity = { 0.2 * Math . PI } />
337
+ < pointLight decay = { 0 } position = { [ - 10 , - 10 , - 10 ] } color = "red" intensity = { 1.5 * Math . PI } />
334
338
< Physics iterations = { 15 } gravity = { [ 0 , - 200 , 0 ] } allowSleep = { false } >
335
339
< Cursor />
336
340
< Ragdoll position = { [ 0 , 0 , 0 ] } />
0 commit comments