MCPcopy Index your code
hub / github.com/sparkjsdev/spark / getTextureSize

Function getTextureSize

src/utils.ts:803–821  ·  view source on GitHub ↗
(numSplats: number)

Source from the content-addressed store, hash-verified

801// This is done so the entire set of splats can be covered by min/max coords across
802// each dimension.
803export function getTextureSize(numSplats: number): {
804 width: number;
805 height: number;
806 depth: number;
807 maxSplats: number;
808} {
809 // Compute a texture array size that is large enough to fit numSplats.
810 // The width is always 2048, the height sized to fit the splats but no larger than 2048.
811 // The depth is the number of layers needed to fit the splats.
812 // maxSplats is computed as the new total available splats that can be stored.
813 const width = SPLAT_TEX_WIDTH;
814 const height = Math.max(
815 SPLAT_TEX_MIN_HEIGHT,
816 Math.min(SPLAT_TEX_HEIGHT, Math.ceil(numSplats / width)),
817 );
818 const depth = Math.ceil(numSplats / (width * height));
819 const maxSplats = width * height * depth;
820 return { width, height, depth, maxSplats };
821}
822
823export function computeMaxSplats(numSplats: number): number {
824 // Compute the size of a Gsplat array texture (2048x2048xD) that can fit

Callers 15

ensureShTexturesMethod · 0.90
ensureSplatsMethod · 0.90
ensureSplatsShMethod · 0.90
ensureGenerateMethod · 0.90
maybeUpdateSourceMethod · 0.90
PackedSplatsClass · 0.90
extractSplatsMethod · 0.90
unpackSplatsFunction · 0.90
constructorMethod · 0.90
constructorMethod · 0.90
ensureCapacityMethod · 0.90
ensureShTexturesMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected