Files
healer-man/src/scene/AdaptiveGraphicsQuality.tsx
T
2026-08-30 14:16:56 -04:00

27 lines
734 B
TypeScript

import { PerformanceMonitor } from "@react-three/drei";
import type { GameplayFrameRateLimit } from "../game/frameRateSettings";
import {
dprForPerformanceFactor,
performanceBoundsForFrameRate,
} from "./adaptiveGraphicsQualityMath";
export function AdaptiveGraphicsQuality({
frameRateLimit,
onDprChange,
}: {
readonly frameRateLimit: GameplayFrameRateLimit;
readonly onDprChange: (dpr: number) => void;
}) {
return (
<PerformanceMonitor
factor={1}
iterations={6}
ms={250}
step={0.25}
threshold={0.75}
bounds={(refreshRate) => performanceBoundsForFrameRate(frameRateLimit, refreshRate)}
onChange={({ factor }) => onDprChange(dprForPerformanceFactor(factor))}
/>
);
}