fix: consistent lighting in static mode

This commit is contained in:
TrèsAbhi committed 2024-10-24 15:37:14 -05:00
1 parent e17470e419
commit f1c50c2531
1 file changed
+6 -2
@@ -2,10 +2,14 @@ import { Environment } from '@react-three/drei';
import { useModel } from '../../../../../../hooks/useModel'; import { useModel } from '../../../../../../hooks/useModel';
import { Duel } from '../../../../../../stores/duel'; import { Duel } from '../../../../../../stores/duel';
import { TankopediaPersistent } from '../../../../../../stores/tankopediaPersistent'; import { TankopediaPersistent } from '../../../../../../stores/tankopediaPersistent';
import { TankopediaDisplay } from '../../../../../../stores/tankopediaPersistent/constants';
export function Lighting() { export function Lighting() {
const protagonist = Duel.use((state) => state.protagonist); const protagonist = Duel.use((state) => state.protagonist);
const display = TankopediaPersistent.use((state) => state.display);
const { hasPbr } = useModel(protagonist.tank.id); const { hasPbr } = useModel(protagonist.tank.id);
const isBrighterLighting =
hasPbr && display !== TankopediaDisplay.StaticArmor;
const showEnvironment = TankopediaPersistent.use( const showEnvironment = TankopediaPersistent.use(
(state) => state.showEnvironment, (state) => state.showEnvironment,
); );
@@ -17,13 +21,13 @@ export function Lighting() {
<directionalLight <directionalLight
position={[1, 1, -1]} position={[1, 1, -1]}
intensity={hasPbr ? 1 : 5} intensity={isBrighterLighting ? 5 : 1}
castShadow castShadow
color={'rgb(225, 225, 255)'} color={'rgb(225, 225, 255)'}
/> />
<directionalLight <directionalLight
position={[-1, 1, 1]} position={[-1, 1, 1]}
intensity={hasPbr ? 1 : 4} intensity={isBrighterLighting ? 4 : 1}
castShadow castShadow
color={'rgb(240, 255, 240)'} color={'rgb(240, 255, 240)'}
/> />