Skip to content

Commit

Permalink
refactor(stage): update controls
Browse files Browse the repository at this point in the history
  • Loading branch information
kwaa committed Oct 4, 2024
1 parent 1d9ccdf commit db86507
Showing 1 changed file with 28 additions and 12 deletions.
40 changes: 28 additions & 12 deletions src/components/stage.tsx
Original file line number Diff line number Diff line change
@@ -1,32 +1,48 @@
import { Environment, SoftShadows } from '@react-three/drei'
import { IfInSessionMode } from '@react-three/xr'
import { useControls } from 'leva'
import { folder, useControls } from 'leva'

export const Stage = ({ children }: React.PropsWithChildren) => {
const {
background,
backgroundBlurriness,
ground,
backgroundEnable,
backgroundIntensity,
backgroundRotation,
groundEnable,
groundHeight,
groundRadius,
groundScale,
// preset,
} = useControls('Stage', {
background: true,
backgroundBlurriness: {
max: 1,
min: 0,
value: 0.5,
},
ground: false,
background: folder({
backgroundBlurriness: {
max: 1,
min: 0,
value: 0.5,
},
backgroundEnable: true,
backgroundIntensity: 1,
backgroundRotation: [0, 0, 0],
}),
ground: folder({
groundEnable: false,
groundHeight: 39,
groundRadius: 100,
groundScale: 100,
}),
// preset: 'dawn',
})

return (
<>
<IfInSessionMode deny="immersive-ar">
<Environment
background={background}
background={backgroundEnable}
backgroundBlurriness={backgroundBlurriness}
backgroundIntensity={backgroundIntensity}
backgroundRotation={backgroundRotation}
files="https://cdn.jsdelivr.net/gh/pmndrs/drei-assets/hdri/kiara_1_dawn_1k.hdr"
ground={ground}
ground={groundEnable && { height: groundHeight, radius: groundRadius, scale: groundScale }}
// preset={preset as 'dawn'}
/>
</IfInSessionMode>
Expand Down

0 comments on commit db86507

Please sign in to comment.