feat: moved to astro

This commit is contained in:
TrèsAbhi committed 2024-09-14 18:32:36 -05:00
1 parent 292df5f5d9
commit a1721eb05e
150 files changed
+386 -363

No files matched your search

+22
View File
@@ -0,0 +1,22 @@
import { asset } from '@blitzkit/core';
import { ObjectMap, useLoader } from '@react-three/fiber';
import { GLTF, GLTFLoader } from 'three-stdlib';
const cache: Record<
number,
{ gltf: GLTF & ObjectMap; hasDynamicArmor: boolean }
> = {};
export function useArmor(id: number) {
const gltf = useLoader(GLTFLoader, asset(`3d/tanks/armor/${id}.glb`));
if (!cache[id]) {
cache[id] = {
gltf,
hasDynamicArmor: Object.values(gltf.nodes).some(
(node) =>
node.name.includes('state_00') || node.name.includes('state_01'),
),
};
}
return cache[id];
}