Compare commits

...
3 Commits
Author SHA1 Message Date
TrèsAbhi 4f42a31f53 Reduce interval timing from 60fps to 200ms 2026-05-11 17:52:23 -05:00
TrèsAbhi 0b2e322112 disbale low tiers 2026-05-11 17:14:22 -05:00
TrèsAbhi 042a1afa74 remove cache from useModel 2026-05-11 16:18:54 -05:00
2 changed files with 11 additions and 23 deletions

No files matched your search

+2 -2
View File
@@ -103,7 +103,7 @@ export function Guesser() {
total: totalGuesses,
streak: streak,
});
}, 1000 / 60);
}, 1000 / 200);
return () => clearInterval(interval);
}, [correctGuesses, totalGuesses, streak]);
@@ -322,7 +322,7 @@ export function Guesser() {
? GuessState.Correct
: GuessState.Incorrect;
draft.totalGuesses++;
draft.correctGuesses += correct ? 1 : 0;
draft.correctGuesses += correct && draft.tiers.length === 10 ? 1 : 0;
draft.streak = correct ? draft.streak + 1 : 0;
});
} else {
+9 -21
View File
@@ -3,28 +3,16 @@ import { type ObjectMap, useLoader } from "@react-three/fiber";
import { Mesh, MeshStandardMaterial } from "three";
import { type GLTF, GLTFLoader } from "three-stdlib";
const cache: Record<
number,
{
gltf: GLTF & ObjectMap;
hasPbr: boolean;
}
> = {};
export function useModel(id: number) {
const gltf = useLoader(GLTFLoader, asset(`3d/tanks/models/${id}.glb`));
if (!cache[id]) {
cache[id] = {
gltf,
hasPbr: Object.values(gltf.nodes).some(
(node) =>
node instanceof Mesh &&
node.material instanceof MeshStandardMaterial &&
node.material.roughnessMap !== null
),
};
}
return cache[id];
return {
gltf,
hasPbr: Object.values(gltf.nodes).some(
(node) =>
node instanceof Mesh &&
node.material instanceof MeshStandardMaterial &&
node.material.roughnessMap !== null
),
};
}