debug: add verbose logging and multiple loader fallbacks

This commit is contained in:
Andrey Flat 2026-04-23 15:09:41 +08:00
parent fe3b77ea30
commit 3bdaa4fc53

View file

@ -157,16 +157,26 @@
status.innerText = "Downloading compressed Splat..."; status.innerText = "Downloading compressed Splat...";
// Using the .splat file provided by user // Using the .splat file provided by user
// Try GSPLAT.Loader first, fallback to LoadAsync if needed console.log("GSPLAT object:", GSPLAT);
const loader = GSPLAT.Loader ? GSPLAT.Loader : GSPLAT; const loader = GSPLAT.Loader ? GSPLAT.Loader : GSPLAT;
await loader.loadAsync( console.log("Selected loader:", loader);
"/models/gs/nebula_rnd1.splat",
scene, // Try various loading methods
(progress) => { if (typeof GSPLAT.loadAsync === "function") {
const percent = Math.round(progress * 100); await GSPLAT.loadAsync("/models/gs/nebula_rnd1.splat", scene, (progress) => {
status.innerText = `Loading: ${percent}%`; status.innerText = `Loading: ${Math.round(progress * 100)}%`;
});
} else if (GSPLAT.Loader && typeof GSPLAT.Loader.LoadAsync === "function") {
await GSPLAT.Loader.LoadAsync("/models/gs/nebula_rnd1.splat", scene, (progress) => {
status.innerText = `Loading: ${Math.round(progress * 100)}%`;
});
} else if (typeof GSPLAT.PLYLoader === "object" && GSPLAT.PLYLoader.LoadAsync) {
await GSPLAT.PLYLoader.LoadAsync("/models/gs/nebula_rnd1.splat", scene, (progress) => {
status.innerText = `Loading: ${Math.round(progress * 100)}%`;
});
} else {
throw new Error("No valid loader found in GSPLAT library. Check console for structure.");
} }
);
loading.style.display = 'none'; loading.style.display = 'none';
// Animation loop // Animation loop