mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 19:49:50 +02:00
feat: start of monorepo
This commit is contained in:
1 parent
14f39d71ac
commit
73c7bdf0c0
260 files changed
+1236
-1235
No files matched your search
@@ -0,0 +1,22 @@
|
||||
import { ObjectMap, useLoader } from '@react-three/fiber';
|
||||
import { GLTF, GLTFLoader } from 'three-stdlib';
|
||||
import { asset } from '../core/blitzkit/asset';
|
||||
|
||||
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];
|
||||
}
|
||||
Reference in new issue
Block a user