Bump dist build

This commit is contained in:
sparkjsdev[bot]
2025-07-23 17:06:34 +00:00
parent f60c2b0cf9
commit b829d125ab
24 changed files with 5084 additions and 4363 deletions
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
-1
View File
@@ -1 +0,0 @@
036a74f83f15454b92ba145ae743052e65ea1ee1
+305 -87
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+112 -83
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+305 -87
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+4262 -4081
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+20
View File
@@ -4,6 +4,19 @@ import { SplatFileType } from './SplatLoader';
import { DynoProgram, DynoProgramTemplate, DynoUniform } from './dyno'; import { DynoProgram, DynoProgramTemplate, DynoUniform } from './dyno';
import { TPackedSplats } from './dyno/splats'; import { TPackedSplats } from './dyno/splats';
import * as THREE from "three"; import * as THREE from "three";
export type SplatEncoding = {
rgbMin?: number;
rgbMax?: number;
lnScaleMin?: number;
lnScaleMax?: number;
sh1Min?: number;
sh1Max?: number;
sh2Min?: number;
sh2Max?: number;
sh3Min?: number;
sh3Max?: number;
};
export declare const DEFAULT_SPLAT_ENCODING: SplatEncoding;
export type PackedSplatsOptions = { export type PackedSplatsOptions = {
url?: string; url?: string;
fileBytes?: Uint8Array | ArrayBuffer; fileBytes?: Uint8Array | ArrayBuffer;
@@ -14,18 +27,24 @@ export type PackedSplatsOptions = {
numSplats?: number; numSplats?: number;
construct?: (splats: PackedSplats) => Promise<void> | void; construct?: (splats: PackedSplats) => Promise<void> | void;
extra?: Record<string, unknown>; extra?: Record<string, unknown>;
splatEncoding?: SplatEncoding;
}; };
export declare class PackedSplats { export declare class PackedSplats {
maxSplats: number; maxSplats: number;
numSplats: number; numSplats: number;
packedArray: Uint32Array | null; packedArray: Uint32Array | null;
extra: Record<string, unknown>; extra: Record<string, unknown>;
splatEncoding?: SplatEncoding;
initialized: Promise<PackedSplats>; initialized: Promise<PackedSplats>;
isInitialized: boolean; isInitialized: boolean;
target: THREE.WebGLArrayRenderTarget | null; target: THREE.WebGLArrayRenderTarget | null;
source: THREE.DataArrayTexture | null; source: THREE.DataArrayTexture | null;
needsUpdate: boolean; needsUpdate: boolean;
dyno: DynoUniform<typeof TPackedSplats, "packedSplats">; dyno: DynoUniform<typeof TPackedSplats, "packedSplats">;
dynoRgbMinMaxLnScaleMinMax: DynoUniform<"vec4", "rgbMinMaxLnScaleMinMax">;
dynoSh1MinMax: DynoUniform<"vec2", "sh1MinMax">;
dynoSh2MinMax: DynoUniform<"vec2", "sh2MinMax">;
dynoSh3MinMax: DynoUniform<"vec2", "sh3MinMax">;
constructor(options?: PackedSplatsOptions); constructor(options?: PackedSplatsOptions);
reinitialize(options: PackedSplatsOptions): void; reinitialize(options: PackedSplatsOptions): void;
initialize(options: PackedSplatsOptions): void; initialize(options: PackedSplatsOptions): void;
@@ -77,6 +96,7 @@ export declare const dynoPackedSplats: (packedSplats?: PackedSplats) => DynoPack
export declare class DynoPackedSplats extends DynoUniform<typeof TPackedSplats, "packedSplats", { export declare class DynoPackedSplats extends DynoUniform<typeof TPackedSplats, "packedSplats", {
texture: THREE.DataArrayTexture; texture: THREE.DataArrayTexture;
numSplats: number; numSplats: number;
rgbMinMaxLnScaleMinMax: THREE.Vector4;
}> { }> {
packedSplats?: PackedSplats; packedSplats?: PackedSplats;
constructor({ packedSplats }?: { constructor({ packedSplats }?: {
+20
View File
@@ -1,3 +1,4 @@
import { SplatEncoding } from './PackedSplats';
import { RgbaArray } from './RgbaArray'; import { RgbaArray } from './RgbaArray';
import { SparkViewpoint, SparkViewpointOptions } from './SparkViewpoint'; import { SparkViewpoint, SparkViewpointOptions } from './SparkViewpoint';
import { SplatAccumulator } from './SplatAccumulator'; import { SplatAccumulator } from './SplatAccumulator';
@@ -11,6 +12,11 @@ export type SparkRendererOptions = {
* rendering and significantly reduces performance. * rendering and significantly reduces performance.
*/ */
renderer: THREE.WebGLRenderer; renderer: THREE.WebGLRenderer;
/**
* Whether to use premultiplied alpha when accumulating splat RGB
* @default true
*/
premultipliedAlpha?: boolean;
/** /**
* Pass in a THREE.Clock to synchronize time-based effects across different * Pass in a THREE.Clock to synchronize time-based effects across different
* systems. Alternatively, you can set the SparkRenderer properties time and * systems. Alternatively, you can set the SparkRenderer properties time and
@@ -110,13 +116,20 @@ export type SparkRendererOptions = {
* radial distance or Z-depth) * radial distance or Z-depth)
*/ */
view?: SparkViewpointOptions; view?: SparkViewpointOptions;
/**
* Override the default splat encoding ranges for the PackedSplats.
* (default: undefined)
*/
splatEncoding?: SplatEncoding;
}; };
export declare class SparkRenderer extends THREE.Mesh { export declare class SparkRenderer extends THREE.Mesh {
renderer: THREE.WebGLRenderer; renderer: THREE.WebGLRenderer;
premultipliedAlpha: boolean;
material: THREE.ShaderMaterial; material: THREE.ShaderMaterial;
uniforms: ReturnType<typeof SparkRenderer.makeUniforms>; uniforms: ReturnType<typeof SparkRenderer.makeUniforms>;
autoUpdate: boolean; autoUpdate: boolean;
preUpdate: boolean; preUpdate: boolean;
needsUpdate: boolean;
originDistance: number; originDistance: number;
maxStdDev: number; maxStdDev: number;
maxPixelRadius: number; maxPixelRadius: number;
@@ -129,6 +142,7 @@ export declare class SparkRenderer extends THREE.Mesh {
falloff: number; falloff: number;
clipXY: number; clipXY: number;
focalAdjustment: number; focalAdjustment: number;
splatEncoding: SplatEncoding;
splatTexture: null | { splatTexture: null | {
enable?: boolean; enable?: boolean;
texture?: THREE.Data3DTexture; texture?: THREE.Data3DTexture;
@@ -237,12 +251,18 @@ export declare class SparkRenderer extends THREE.Mesh {
type: string; type: string;
value: THREE.DataArrayTexture; value: THREE.DataArrayTexture;
}; };
rgbMinMaxLnScaleMinMax: {
value: THREE.Vector4;
};
time: { time: {
value: number; value: number;
}; };
deltaTime: { deltaTime: {
value: number; value: number;
}; };
premultipliedAlpha: {
value: boolean;
};
encodeLinear: { encodeLinear: {
value: boolean; value: boolean;
}; };
+3 -2
View File
@@ -1,5 +1,5 @@
import { FileLoader, Loader, LoadingManager } from 'three'; import { FileLoader, Loader, LoadingManager } from 'three';
import { PackedSplats } from './PackedSplats'; import { PackedSplats, SplatEncoding } from './PackedSplats';
import { SplatMesh } from './SplatMesh'; import { SplatMesh } from './SplatMesh';
export declare class SplatLoader extends Loader { export declare class SplatLoader extends Loader {
fileLoader: FileLoader; fileLoader: FileLoader;
@@ -64,11 +64,12 @@ export declare function tryPcSogsZip(input: ArrayBuffer | Uint8Array): {
name: string; name: string;
json: PcSogsJson; json: PcSogsJson;
} | undefined; } | undefined;
export declare function unpackSplats({ input, extraFiles, fileType, pathOrUrl, }: { export declare function unpackSplats({ input, extraFiles, fileType, pathOrUrl, splatEncoding, }: {
input: Uint8Array | ArrayBuffer; input: Uint8Array | ArrayBuffer;
extraFiles?: Record<string, ArrayBuffer>; extraFiles?: Record<string, ArrayBuffer>;
fileType?: SplatFileType; fileType?: SplatFileType;
pathOrUrl?: string; pathOrUrl?: string;
splatEncoding?: SplatEncoding;
}): Promise<{ }): Promise<{
packedArray: Uint32Array; packedArray: Uint32Array;
numSplats: number; numSplats: number;
+2 -1
View File
@@ -1,4 +1,4 @@
import { PackedSplats } from './PackedSplats'; import { PackedSplats, SplatEncoding } from './PackedSplats';
import { RgbaArray } from './RgbaArray'; import { RgbaArray } from './RgbaArray';
import { SplatEdit } from './SplatEdit'; import { SplatEdit } from './SplatEdit';
import { GsplatModifier, SplatGenerator, SplatTransformer } from './SplatGenerator'; import { GsplatModifier, SplatGenerator, SplatTransformer } from './SplatGenerator';
@@ -23,6 +23,7 @@ export type SplatMeshOptions = {
}) => void; }) => void;
objectModifier?: GsplatModifier; objectModifier?: GsplatModifier;
worldModifier?: GsplatModifier; worldModifier?: GsplatModifier;
splatEncoding?: SplatEncoding;
}; };
export type SplatMeshContext = { export type SplatMeshContext = {
transform: SplatTransformer; transform: SplatTransformer;
+2 -1
View File
@@ -1,5 +1,6 @@
import { SplatEncoding } from './PackedSplats';
export declare function decodeAntiSplat(fileBytes: Uint8Array, initNumSplats: (numSplats: number) => void, splatCallback: (index: number, x: number, y: number, z: number, scaleX: number, scaleY: number, scaleZ: number, quatX: number, quatY: number, quatZ: number, quatW: number, opacity: number, r: number, g: number, b: number) => void): void; export declare function decodeAntiSplat(fileBytes: Uint8Array, initNumSplats: (numSplats: number) => void, splatCallback: (index: number, x: number, y: number, z: number, scaleX: number, scaleY: number, scaleZ: number, quatX: number, quatY: number, quatZ: number, quatW: number, opacity: number, r: number, g: number, b: number) => void): void;
export declare function unpackAntiSplat(fileBytes: Uint8Array): { export declare function unpackAntiSplat(fileBytes: Uint8Array, splatEncoding: SplatEncoding): {
packedArray: Uint32Array; packedArray: Uint32Array;
numSplats: number; numSplats: number;
}; };
-1
View File
@@ -1,6 +1,5 @@
export declare const LN_SCALE_MIN = -12; export declare const LN_SCALE_MIN = -12;
export declare const LN_SCALE_MAX = 9; export declare const LN_SCALE_MAX = 9;
export declare const LN_RESCALE: number;
export declare const SCALE_MIN: number; export declare const SCALE_MIN: number;
export declare const SCALE_MAX: number; export declare const SCALE_MAX: number;
export declare const LN_SCALE_ZERO = -30; export declare const LN_SCALE_ZERO = -30;
+4 -2
View File
@@ -1,15 +1,17 @@
import { Dyno } from './base'; import { Dyno } from './base';
import { Gsplat } from './splats'; import { Gsplat } from './splats';
import { DynoVal, DynoValue, HasDynoOut } from './value'; import { DynoVal, DynoValue, HasDynoOut } from './value';
export declare const outputPackedSplat: (gsplat: DynoVal<typeof Gsplat>) => OutputPackedSplat; export declare const outputPackedSplat: (gsplat: DynoVal<typeof Gsplat>, rgbMinMaxLnScaleMinMax: DynoVal<"vec4">) => OutputPackedSplat;
export declare const outputRgba8: (rgba8: DynoVal<"vec4">) => OutputRgba8; export declare const outputRgba8: (rgba8: DynoVal<"vec4">) => OutputRgba8;
export declare class OutputPackedSplat extends Dyno<{ export declare class OutputPackedSplat extends Dyno<{
gsplat: typeof Gsplat; gsplat: typeof Gsplat;
rgbMinMaxLnScaleMinMax: "vec4";
}, { }, {
output: "uvec4"; output: "uvec4";
}> implements HasDynoOut<"uvec4"> { }> implements HasDynoOut<"uvec4"> {
constructor({ gsplat }: { constructor({ gsplat, rgbMinMaxLnScaleMinMax, }: {
gsplat?: DynoVal<typeof Gsplat>; gsplat?: DynoVal<typeof Gsplat>;
rgbMinMaxLnScaleMinMax?: DynoVal<"vec4">;
}); });
dynoOut(): DynoValue<"uvec4">; dynoOut(): DynoValue<"uvec4">;
} }
+2
View File
@@ -19,3 +19,5 @@ export { type JointId, JointEnum, JOINT_IDS, NUM_JOINTS, JOINT_INDEX, JOINT_RADI
export { SparkControls, FpsMovement, PointerControls } from './controls'; export { SparkControls, FpsMovement, PointerControls } from './controls';
export { isMobile, isAndroid, isOculus, flipPixels, pixelsToPngUrl, toHalf, fromHalf, floatToUint8, floatToSint8, Uint8ToFloat, Sint8ToFloat, setPackedSplat, unpackSplat, } from './utils'; export { isMobile, isAndroid, isOculus, flipPixels, pixelsToPngUrl, toHalf, fromHalf, floatToUint8, floatToSint8, Uint8ToFloat, Sint8ToFloat, setPackedSplat, unpackSplat, } from './utils';
export * as utils from './utils'; export * as utils from './utils';
export { LN_SCALE_MIN, LN_SCALE_MAX } from './defines';
export * as defines from './defines';
+2 -1
View File
@@ -1,5 +1,6 @@
import { SplatEncoding } from './PackedSplats';
export declare function decodeKsplat(fileBytes: Uint8Array, initNumSplats: (numSplats: number) => void, splatCallback: (index: number, x: number, y: number, z: number, scaleX: number, scaleY: number, scaleZ: number, quatX: number, quatY: number, quatZ: number, quatW: number, opacity: number, r: number, g: number, b: number) => void, shCallback?: (index: number, sh1: Float32Array, sh2?: Float32Array, sh3?: Float32Array) => void): void; export declare function decodeKsplat(fileBytes: Uint8Array, initNumSplats: (numSplats: number) => void, splatCallback: (index: number, x: number, y: number, z: number, scaleX: number, scaleY: number, scaleZ: number, quatX: number, quatY: number, quatZ: number, quatW: number, opacity: number, r: number, g: number, b: number) => void, shCallback?: (index: number, sh1: Float32Array, sh2?: Float32Array, sh3?: Float32Array) => void): void;
export declare function unpackKsplat(fileBytes: Uint8Array): { export declare function unpackKsplat(fileBytes: Uint8Array, splatEncoding: SplatEncoding): {
packedArray: Uint32Array; packedArray: Uint32Array;
numSplats: number; numSplats: number;
extra: Record<string, unknown>; extra: Record<string, unknown>;
+3 -2
View File
@@ -1,10 +1,11 @@
import { SplatEncoding } from './PackedSplats';
import { PcSogsJson } from './SplatLoader'; import { PcSogsJson } from './SplatLoader';
export declare function unpackPcSogs(json: PcSogsJson, extraFiles: Record<string, ArrayBuffer>): Promise<{ export declare function unpackPcSogs(json: PcSogsJson, extraFiles: Record<string, ArrayBuffer>, splatEncoding: SplatEncoding): Promise<{
packedArray: Uint32Array; packedArray: Uint32Array;
numSplats: number; numSplats: number;
extra: Record<string, unknown>; extra: Record<string, unknown>;
}>; }>;
export declare function unpackPcSogsZip(fileBytes: Uint8Array): Promise<{ export declare function unpackPcSogsZip(fileBytes: Uint8Array, splatEncoding: SplatEncoding): Promise<{
packedArray: Uint32Array; packedArray: Uint32Array;
numSplats: number; numSplats: number;
extra: Record<string, unknown>; extra: Record<string, unknown>;
+36 -8
View File
@@ -39,14 +39,33 @@ export declare class FreeList<T, Args> {
free(item: T): void; free(item: T): void;
disposeAll(): void; disposeAll(): void;
} }
export declare function setPackedSplat(packedSplats: Uint32Array, index: number, x: number, y: number, z: number, scaleX: number, scaleY: number, scaleZ: number, quatX: number, quatY: number, quatZ: number, quatW: number, opacity: number, r: number, g: number, b: number): void; export declare function setPackedSplat(packedSplats: Uint32Array, index: number, x: number, y: number, z: number, scaleX: number, scaleY: number, scaleZ: number, quatX: number, quatY: number, quatZ: number, quatW: number, opacity: number, r: number, g: number, b: number, encoding?: {
rgbMin?: number;
rgbMax?: number;
lnScaleMin?: number;
lnScaleMax?: number;
}): void;
export declare function setPackedSplatCenter(packedSplats: Uint32Array, index: number, x: number, y: number, z: number): void; export declare function setPackedSplatCenter(packedSplats: Uint32Array, index: number, x: number, y: number, z: number): void;
export declare function setPackedSplatScales(packedSplats: Uint32Array, index: number, scaleX: number, scaleY: number, scaleZ: number): void; export declare function setPackedSplatScales(packedSplats: Uint32Array, index: number, scaleX: number, scaleY: number, scaleZ: number, encoding?: {
lnScaleMin?: number;
lnScaleMax?: number;
}): void;
export declare function setPackedSplatQuat(packedSplats: Uint32Array, index: number, quatX: number, quatY: number, quatZ: number, quatW: number): void; export declare function setPackedSplatQuat(packedSplats: Uint32Array, index: number, quatX: number, quatY: number, quatZ: number, quatW: number): void;
export declare function setPackedSplatRgba(packedSplats: Uint32Array, index: number, r: number, g: number, b: number, a: number): void; export declare function setPackedSplatRgba(packedSplats: Uint32Array, index: number, r: number, g: number, b: number, a: number, encoding?: {
export declare function setPackedSplatRgb(packedSplats: Uint32Array, index: number, r: number, g: number, b: number): void; rgbMin?: number;
rgbMax?: number;
}): void;
export declare function setPackedSplatRgb(packedSplats: Uint32Array, index: number, r: number, g: number, b: number, encoding?: {
rgbMin?: number;
rgbMax?: number;
}): void;
export declare function setPackedSplatOpacity(packedSplats: Uint32Array, index: number, opacity: number): void; export declare function setPackedSplatOpacity(packedSplats: Uint32Array, index: number, opacity: number): void;
export declare function unpackSplat(packedSplats: Uint32Array, index: number): { export declare function unpackSplat(packedSplats: Uint32Array, index: number, encoding?: {
rgbMin?: number;
rgbMax?: number;
lnScaleMin?: number;
lnScaleMax?: number;
}): {
center: THREE.Vector3; center: THREE.Vector3;
scales: THREE.Vector3; scales: THREE.Vector3;
quaternion: THREE.Quaternion; quaternion: THREE.Quaternion;
@@ -132,9 +151,18 @@ export declare function encodeQuatEulerXyz888(q: THREE.Quaternion): number;
* and then converting them back to Euler angles in [-π, π] and to a quaternion. * and then converting them back to Euler angles in [-π, π] and to a quaternion.
*/ */
export declare function decodeQuatEulerXyz888(encoded: number, out: THREE.Quaternion): THREE.Quaternion; export declare function decodeQuatEulerXyz888(encoded: number, out: THREE.Quaternion): THREE.Quaternion;
export declare function encodeSh1Rgb(sh1Array: Uint32Array, index: number, sh1Rgb: Float32Array): void; export declare function encodeSh1Rgb(sh1Array: Uint32Array, index: number, sh1Rgb: Float32Array, encoding?: {
export declare function encodeSh2Rgb(sh2Array: Uint32Array, index: number, sh2Rgb: Float32Array): void; sh1Min?: number;
export declare function encodeSh3Rgb(sh3Array: Uint32Array, index: number, sh3Rgb: Float32Array): void; sh1Max?: number;
}): void;
export declare function encodeSh2Rgb(sh2Array: Uint32Array, index: number, sh2Rgb: Float32Array, encoding?: {
sh2Min?: number;
sh2Max?: number;
}): void;
export declare function encodeSh3Rgb(sh3Array: Uint32Array, index: number, sh3Rgb: Float32Array, encoding?: {
sh3Min?: number;
sh3Max?: number;
}): void;
export declare function decompressPartialGzip(fileBytes: Uint8Array, numBytes: number): Uint8Array; export declare function decompressPartialGzip(fileBytes: Uint8Array, numBytes: number): Uint8Array;
export declare class GunzipReader { export declare class GunzipReader {
fileBytes: Uint8Array; fileBytes: Uint8Array;