mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-30 05:59:51 +01:00
fix: less aggressive light manager
This commit is contained in:
1 parent
d09f934b80
commit
7443f75347
1 file changed
+1
-3
+1
-3
@@ -5,7 +5,6 @@ import { useRef, useState } from "react";
|
|||||||
import { Color, SpotLight, SpotLightHelper } from "three";
|
import { Color, SpotLight, SpotLightHelper } from "three";
|
||||||
import { degToRad } from "three/src/math/MathUtils.js";
|
import { degToRad } from "three/src/math/MathUtils.js";
|
||||||
import { isHalloween } from "../../../../../../core/blitzkit/isHalloween";
|
import { isHalloween } from "../../../../../../core/blitzkit/isHalloween";
|
||||||
import { Tankopedia } from "../../../../../../stores/tankopedia";
|
|
||||||
import { HelpingSpotLight } from "../../../../../HelpingSpotLight";
|
import { HelpingSpotLight } from "../../../../../HelpingSpotLight";
|
||||||
|
|
||||||
const LIGHTS_COUNT = 5;
|
const LIGHTS_COUNT = 5;
|
||||||
@@ -19,7 +18,6 @@ const TARGET_FRAME_RATE = 30;
|
|||||||
|
|
||||||
export function Lighting() {
|
export function Lighting() {
|
||||||
const [cast, setCast] = useState(true);
|
const [cast, setCast] = useState(true);
|
||||||
const revealed = Tankopedia.use((state) => state.revealed);
|
|
||||||
|
|
||||||
const topLight = useRef<SpotLight>(null!);
|
const topLight = useRef<SpotLight>(null!);
|
||||||
const frontLight = useRef<SpotLight>(null!);
|
const frontLight = useRef<SpotLight>(null!);
|
||||||
@@ -31,7 +29,7 @@ export function Lighting() {
|
|||||||
const samples = useRef<number[]>([]);
|
const samples = useRef<number[]>([]);
|
||||||
|
|
||||||
useFrame(({ clock }) => {
|
useFrame(({ clock }) => {
|
||||||
if (!cast || !revealed) return;
|
if (!cast || clock.elapsedTime < TARGET_FRAME_RATE * N) return;
|
||||||
|
|
||||||
const dt = clock.elapsedTime - last.current;
|
const dt = clock.elapsedTime - last.current;
|
||||||
last.current = clock.elapsedTime;
|
last.current = clock.elapsedTime;
|
||||||
|
|||||||
Reference in new issue
Block a user