load texture
This commit is contained in:
parent
2d9326c098
commit
aabacdbc11
@ -1,10 +1,14 @@
|
||||
import { useThree, extend } from '@react-three/fiber'
|
||||
import { OrbitControls } from '@react-three/drei'
|
||||
import { OrbitControls, useTexture } from '@react-three/drei'
|
||||
import { DoubleSide } from 'three'
|
||||
|
||||
export default function Experience()
|
||||
{
|
||||
const { camera, gl } = useThree()
|
||||
// const harborSealRockTexture = useTexture('./MARS-Harbor-Seal-Rock-in-Jezero-Crater-cross-eyed-Manzoni_May-1662x2048.jpg')
|
||||
const goliathTexture = useTexture('https://tile.loc.gov/storage-services/service/pnp/stereo/1s00000/1s00000/1s00600/1s00612v.jpg')
|
||||
const texture = goliathTexture
|
||||
const {width, height} = texture.image
|
||||
|
||||
return <>
|
||||
<OrbitControls />
|
||||
@ -12,14 +16,9 @@ export default function Experience()
|
||||
<directionalLight position={ [ 1, 2, 3 ] } intensity={ 4.5 } />
|
||||
<ambientLight intensity={ 1.5 } />
|
||||
|
||||
<mesh position-y={ 5 } scale={ 10 }>
|
||||
<planeGeometry />
|
||||
<meshStandardMaterial color="blue" side={DoubleSide}/>
|
||||
</mesh>
|
||||
|
||||
<mesh position-y={ - 1 } rotation-x={ - Math.PI * 0.5 } scale={ 10 }>
|
||||
<planeGeometry />
|
||||
<meshStandardMaterial color="grey" side={DoubleSide}/>
|
||||
<mesh position-y={ 5 } scale={ .01 }>
|
||||
<planeGeometry args={[width, height]}/>
|
||||
<meshStandardMaterial map={texture} side={DoubleSide} />
|
||||
</mesh>
|
||||
</>
|
||||
}
|
@ -11,7 +11,7 @@ root.render(
|
||||
fov: 45,
|
||||
near: 0.1,
|
||||
far: 200,
|
||||
position: [ - 4, 3, 6 ]
|
||||
position: [ 0, 5, 20 ]
|
||||
} }
|
||||
>
|
||||
<Experience />
|
||||
|
Loading…
Reference in New Issue
Block a user