2024-01-29 19:30:45 -06:00
|
|
|
import { Environment } from '@react-three/drei';
|
2024-01-22 15:42:49 -06:00
|
|
|
import { useModel } from '../../../../../hooks/useModel';
|
2024-01-22 18:04:13 -06:00
|
|
|
import { useDuel } from '../../../../../stores/duel';
|
2024-02-01 12:28:56 -06:00
|
|
|
import { useTankopediaPersistent } from '../../../../../stores/tankopedia';
|
2024-01-22 15:42:49 -06:00
|
|
|
|
2024-01-22 18:04:13 -06:00
|
|
|
export function Lighting() {
|
|
|
|
|
const protagonist = useDuel((state) => state.protagonist!);
|
|
|
|
|
const { hasPbr } = useModel(protagonist.tank.id);
|
2024-02-01 12:28:56 -06:00
|
|
|
const showEnvironment = useTankopediaPersistent(
|
|
|
|
|
(state) => state.model.visual.showEnvironment,
|
|
|
|
|
);
|
2024-01-22 15:42:49 -06:00
|
|
|
|
2024-01-09 22:31:34 -06:00
|
|
|
return (
|
|
|
|
|
<>
|
2024-02-01 12:28:56 -06:00
|
|
|
<Environment preset="warehouse" background={showEnvironment} blur={0} />
|
2024-01-29 16:05:12 -06:00
|
|
|
<directionalLight
|
2024-01-09 22:31:34 -06:00
|
|
|
position={[1, 1, -1]}
|
2024-01-29 19:30:45 -06:00
|
|
|
intensity={hasPbr ? 1 : 5}
|
2024-01-09 22:31:34 -06:00
|
|
|
castShadow
|
|
|
|
|
color={'rgb(225, 225, 255)'}
|
|
|
|
|
/>
|
|
|
|
|
<directionalLight
|
|
|
|
|
position={[-1, 1, 1]}
|
2024-01-29 19:30:45 -06:00
|
|
|
intensity={hasPbr ? 1 : 4}
|
2024-01-09 22:31:34 -06:00
|
|
|
castShadow
|
2024-01-16 14:20:43 -06:00
|
|
|
color={'rgb(240, 255, 240)'}
|
2024-01-29 16:05:12 -06:00
|
|
|
/>
|
2024-01-09 22:31:34 -06:00
|
|
|
</>
|
|
|
|
|
);
|
|
|
|
|
}
|