smart shadow updates

This commit is contained in:
tresabhi committed 2026-11-30 22:42:12 -06:00
1 parent 3078dfeb10
commit a3e7908cd2
11 files changed
+110 -15

No files matched your search

@@ -0,0 +1,27 @@
import { ContactShadows } from "@react-three/drei";
import { Tankopedia } from "../stores/tankopedia";
import { TankopediaDisplay } from "../stores/tankopediaPersistent/constants";
/**
* drei's ContactShadows, but only redrawn when the scene changes instead of
* every frame. drei resets its frame count on every render, so re-rendering
* with frames={1} draws it once more.
*/
export function TankopediaContactShadows() {
const display = Tankopedia.use((state) => state.display);
if (display === TankopediaDisplay.StaticArmor) return null;
return (
<ContactShadows
frames={1}
width={1.5}
height={1.5}
near={0}
far={1}
opacity={2 ** 1}
blur={2 ** 1}
resolution={2 ** 6}
/>
);
}