mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-22 11:17:05 +02:00
feat: non-pbr tank lighting and model cache
This commit is contained in:
1 parent
ea480aa365
commit
a32ee2a344
7 files changed
+47
-13
No files matched your search
@@ -1,7 +1,11 @@
|
||||
import { useLoader } from '@react-three/fiber';
|
||||
import { GLTFLoader } from 'three-stdlib';
|
||||
import { ObjectMap, useLoader } from '@react-three/fiber';
|
||||
import { GLTF, GLTFLoader } from 'three-stdlib';
|
||||
import { asset } from '../core/blitzkrieg/asset';
|
||||
|
||||
const cache: Record<number, GLTF & ObjectMap> = {};
|
||||
|
||||
export function useArmor(id: number) {
|
||||
return useLoader(GLTFLoader, asset(`3d/tanks/armor/${id}.glb`));
|
||||
const gltf = useLoader(GLTFLoader, asset(`3d/tanks/armor/${id}.glb`));
|
||||
if (!cache[id]) cache[id] = gltf;
|
||||
return cache[id];
|
||||
}
|
||||
Reference in new issue
Block a user