mirror of
https://github.com/storytold/spark.git
synced 2026-10-13 23:52:44 +00:00
SPZ writing, exporting, & viewer. Creates a new npm run to-spz which runs scripts/to-spz.js to convert any Gsplat input file to compress .spz. Also includes a configurable viewer examples/viewer that can load splats via drag-n-drop, from url query param, the URL text list, can edit sets of SplatMesh, and export composite .SPZ with some filters. Refactored some loading code from worker.ts to loader files so they can be called from Nodejs. Created api transcodeSpz with options to combine multiple source Gsplat files into one without losing coding quality along the way.
This commit is contained in:
committed by
Diego Marcos Segura
parent
b4257bcd64
commit
156bbf400e
@@ -624,6 +624,19 @@ export function getTextureSize(numSplats: number): {
|
||||
return { width, height, depth, maxSplats };
|
||||
}
|
||||
|
||||
export function computeMaxSplats(numSplats: number): number {
|
||||
// Compute the size of a Gsplat array texture (2048x2048xD) that can fit
|
||||
// numSplats splats, and return the total number of splats that can be stored
|
||||
// in such a texture.
|
||||
const width = SPLAT_TEX_WIDTH;
|
||||
const height = Math.max(
|
||||
SPLAT_TEX_MIN_HEIGHT,
|
||||
Math.min(SPLAT_TEX_HEIGHT, Math.ceil(numSplats / width)),
|
||||
);
|
||||
const depth = Math.ceil(numSplats / (width * height));
|
||||
return width * height * depth;
|
||||
}
|
||||
|
||||
// Heuristic function to determine if we are running on a mobile device.
|
||||
export function isMobile(): boolean {
|
||||
if (navigator.maxTouchPoints > 0) {
|
||||
|
||||
Reference in New Issue
Block a user