mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-24 03:59:50 +02:00
fix: consistent lighting in static mode
This commit is contained in:
1 parent
e17470e419
commit
f1c50c2531
1 file changed
+6
-2
+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)'}
|
||||||
/>
|
/>
|
||||||
|
|||||||
Reference in new issue
Block a user