Optionaloptions: LoadAssetContainerOptionsimport { loadModelContainer3D, isModelContainerLoaded, releaseModelContainer } from '@datamoc/mwg/3d/models';
declare const scene: import('@babylonjs/core/scene.js').Scene;
const container = await loadModelContainer3D('models/tree.glb', scene);
const treeA = container.instantiateModelsToScene();
const treeB = container.instantiateModelsToScene(); // a second, independent copy - no re-fetch
console.log(isModelContainerLoaded('models/tree.glb')); // true
releaseModelContainer('models/tree.glb'); // frees the container once every copy is placed
Loads a model once per resolved source and caches the in-flight/loaded
AssetContainer, so a second call for the same source returns the same container instead of importing and parsing it again over the network. A container is not itself scene content - callcontainer.instantiateModelsToScene()for each independent copy a game wants to place, which is Babylon's own way to get several unaliased instances of one loaded model without a second fetch;loadModel3Dimports straight into the scene instead, for the common case of only ever wanting one copy.Only caches when
sourceis a string (an asset path or already-resolved URI) - aFileor in-memory byte view has no stable identity to key a cache on, so those always load fresh, the same wayloadModel3Dnever tries to resolve them as a path either.