mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-25 11:39:51 +01:00
Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4f42a31f53 | ||
|
|
0b2e322112 | ||
|
|
042a1afa74 |
No files matched your search
@@ -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 {
|
||||
|
||||
@@ -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
|
||||
),
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user