import { useHookstate } from '@hookstate/core' import React from 'react' import { useTranslation } from 'react-i18next' import { Color } from 'three' import { Engine } from '@xrengine/engine/src/ecs/classes/Engine' import { FogType } from '@xrengine/engine/src/scene/constants/FogType' import { getFogSceneMetadataState } from '@xrengine/engine/src/scene/systems/FogSystem' import ColorInput from '../inputs/ColorInput' import InputGroup from '../inputs/InputGroup' import NumericInputGroup from '../inputs/NumericInputGroup' import SelectInput from '../inputs/SelectInput' import PropertyGroup from './PropertyGroup' const FogTypeOptions = [ { label: 'Disabled', value: FogType.Disabled }, { label: 'Linear', value: FogType.Linear }, { label: 'Exponential', value: FogType.Exponential }, { label: 'Brownian Motion', value: FogType.Brownian }, { label: 'Height', value: FogType.Height } ] export const FogSettingsEditor = () => { const { t } = useTranslation() const fogState = useHookstate(getFogSceneMetadataState(Engine.instance.currentWorld)) const fog = fogState.get({ noproxy: true }) return ( fogState.type.set(val)} /> {fog.type !== FogType.Disabled && ( <> fogState.color.set('#' + val.getHexString())} /> {fog.type === FogType.Linear ? ( <> fogState.near.set(val)} /> fogState.far.set(val)} /> ) : ( <> fogState.density.set(val)} /> {fog.type !== FogType.Exponential && ( fogState.height.set(val)} /> )} {fog.type === FogType.Brownian && ( fogState.timeScale.set(val)} /> )} )} )} ) }