Spaces:
Running on Zero
Running on Zero
Download scripts/prepare_viewer_assets.cjs from ritianyu/SplatAnything: direct link, hf CLI and curl.
- Browser
- Download file 929 Bytes
-
https://huggingface.co/spaces/ritianyu/SplatAnything/resolve/main/scripts/prepare_viewer_assets.cjs
- Command line
-
hf download hf://spaces/ritianyu/SplatAnything/scripts/prepare_viewer_assets.cjs
-
curl -L -o prepare_viewer_assets.cjs https://huggingface.co/spaces/ritianyu/SplatAnything/resolve/main/scripts/prepare_viewer_assets.cjs
929 Bytes
| // Serve one pinned viewer bundle for every newly reconstructed scene. | |
| const fs = require('node:fs'); | |
| const path = require('node:path'); | |
| (async () => { | |
| const {html, css, js} = await import('@playcanvas/supersplat-viewer'); | |
| const anchor = 'const { app, camera, renderer } = await createApp(canvas, config);'; | |
| if (!js.includes(anchor)) throw new Error('Unsupported SuperSplat viewer version'); | |
| const patched = js.replace(anchor, anchor + '\n app.scene.gsplat.minPixelSize = 0;\n app.scene.gsplat.minContribution = 0;') | |
| .replaceAll('gsplat.minContribution = 1;', 'gsplat.minContribution = 0;'); | |
| const target = process.argv[2]; | |
| fs.mkdirSync(target, {recursive: true}); | |
| for (const [name, value] of Object.entries({'index.js': patched, 'index.css': css, 'viewer.html': html})) { | |
| fs.writeFileSync(path.join(target, name), value); | |
| } | |
| })().catch(error => { console.error(error.message); process.exit(1); }); | |