MCPcopy
hub / github.com/sparkjsdev/spark / preloadSplats

Function preloadSplats

examples/js/preloader.js:24–41  ·  view source on GitHub ↗
(assets, loading_icon_color = "white")

Source from the content-addressed store, hash-verified

22
23// preload splats, returning a map [filename -> SplatMesh]
24export async function preloadSplats(assets, loading_icon_color = "white") {
25 addLoader(loading_icon_color);
26 const map = {};
27 await Promise.all(
28 assets.map(async (asset) => {
29 const splatURL = await getAssetFileURL(asset);
30 return new Promise((resolve) => {
31 map[asset] = new SplatMesh({
32 url: splatURL,
33 onLoad: () => resolve(),
34 });
35 });
36 }),
37 );
38
39 removeLoader();
40 return map;
41}

Callers

nothing calls this directly

Calls 3

getAssetFileURLFunction · 0.90
addLoaderFunction · 0.85
removeLoaderFunction · 0.85

Tested by

no test coverage detected