Skip to content

@relu-interactives/spatial-ecs


@relu-interactives/spatial-ecs / index / loadSharedGltf

Function: loadSharedGltf() ​

ts
function loadSharedGltf(url, load): Promise<GLTF>;

Defined in: utils/modelCache.ts:39

Load a GLTF once per URL and share the parsed result, so repeated spawns of the same model skip both the fetch and the parse. The cached scene must never be mounted directly (an Object3D has a single parent) — mount a cloneModelScene() of it. Failed loads are evicted so a retry re-fetches.

Parameters ​

ParameterType
urlstring
load() => Promise<GLTF>

Returns ​

Promise<GLTF>