Skip to content

Commit

Permalink
fix: add types to enviroment preset (#363)
Browse files Browse the repository at this point in the history
  • Loading branch information
SaraVieira authored Apr 10, 2021
1 parent e50a849 commit 2860370
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/core/Environment.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { CubeTexture, CubeTextureLoader, Texture, PMREMGenerator, Scene } from '
import { RGBELoader } from 'three-stdlib'
import { useAsset } from 'use-asset'

import { presetsObj } from '../helpers/environment-assets'
import { presetsObj, PresetsType } from '../helpers/environment-assets'

function getTexture(texture: Texture | CubeTexture, gen: PMREMGenerator, isCubeMap: boolean) {
if (isCubeMap) {
Expand All @@ -20,7 +20,7 @@ type Props = {
background?: boolean
files?: string | string[]
path?: string
preset?: string
preset?: PresetsType
scene?: Scene
}

Expand Down
3 changes: 2 additions & 1 deletion src/core/Stage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ import * as THREE from 'three'
import { useThree } from '@react-three/fiber'
import { Environment } from './Environment'
import { ContactShadows } from './ContactShadows'
import { PresetsType } from '../helpers/environment-assets'

type Props = JSX.IntrinsicElements['group'] & {
contactShadow?: boolean
shadows?: boolean
adjustCamera?: boolean
environment?: string
environment?: PresetsType
intensity?: number
controls?: React.MutableRefObject<{ update(): void; target: THREE.Vector3 }>
}
Expand Down
2 changes: 2 additions & 0 deletions src/helpers/environment-assets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@ export const presetsObj = {
park: 'rooitou_park_1k.hdr',
lobby: 'st_fagans_interior_1k.hdr',
}

export type PresetsType = keyof typeof presetsObj

1 comment on commit 2860370

@vercel
Copy link

@vercel vercel bot commented on 2860370 Apr 10, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.