@sparkjsdev/spark 0.1.6 → 0.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +1,22 @@
1
+ import { FullScreenQuad } from 'three/addons/postprocessing/Pass.js';
1
2
  import { GsplatGenerator } from './SplatGenerator';
2
3
  import { SplatFileType } from './SplatLoader';
3
4
  import { DynoProgram, DynoProgramTemplate, DynoUniform } from './dyno';
4
5
  import { TPackedSplats } from './dyno/splats';
5
6
  import * as THREE from "three";
7
+ export type SplatEncoding = {
8
+ rgbMin?: number;
9
+ rgbMax?: number;
10
+ lnScaleMin?: number;
11
+ lnScaleMax?: number;
12
+ sh1Min?: number;
13
+ sh1Max?: number;
14
+ sh2Min?: number;
15
+ sh2Max?: number;
16
+ sh3Min?: number;
17
+ sh3Max?: number;
18
+ };
19
+ export declare const DEFAULT_SPLAT_ENCODING: SplatEncoding;
6
20
  export type PackedSplatsOptions = {
7
21
  url?: string;
8
22
  fileBytes?: Uint8Array | ArrayBuffer;
@@ -13,18 +27,24 @@ export type PackedSplatsOptions = {
13
27
  numSplats?: number;
14
28
  construct?: (splats: PackedSplats) => Promise<void> | void;
15
29
  extra?: Record<string, unknown>;
30
+ splatEncoding?: SplatEncoding;
16
31
  };
17
32
  export declare class PackedSplats {
18
33
  maxSplats: number;
19
34
  numSplats: number;
20
35
  packedArray: Uint32Array | null;
21
36
  extra: Record<string, unknown>;
37
+ splatEncoding?: SplatEncoding;
22
38
  initialized: Promise<PackedSplats>;
23
39
  isInitialized: boolean;
24
40
  target: THREE.WebGLArrayRenderTarget | null;
25
41
  source: THREE.DataArrayTexture | null;
26
42
  needsUpdate: boolean;
27
43
  dyno: DynoUniform<typeof TPackedSplats, "packedSplats">;
44
+ dynoRgbMinMaxLnScaleMinMax: DynoUniform<"vec4", "rgbMinMaxLnScaleMinMax">;
45
+ dynoSh1MinMax: DynoUniform<"vec2", "sh1MinMax">;
46
+ dynoSh2MinMax: DynoUniform<"vec2", "sh2MinMax">;
47
+ dynoSh3MinMax: DynoUniform<"vec2", "sh3MinMax">;
28
48
  constructor(options?: PackedSplatsOptions);
29
49
  reinitialize(options: PackedSplatsOptions): void;
30
50
  initialize(options: PackedSplatsOptions): void;
@@ -70,15 +90,13 @@ export declare class PackedSplats {
70
90
  };
71
91
  static programTemplate: DynoProgramTemplate | null;
72
92
  static generatorProgram: Map<GsplatGenerator, DynoProgram>;
73
- static geometry: THREE.PlaneGeometry;
74
- static mesh: THREE.Mesh<THREE.PlaneGeometry, THREE.RawShaderMaterial, THREE.Object3DEventMap>;
75
- static scene: THREE.Scene;
76
- static camera: THREE.Camera;
93
+ static fullScreenQuad: FullScreenQuad;
77
94
  }
78
95
  export declare const dynoPackedSplats: (packedSplats?: PackedSplats) => DynoPackedSplats;
79
96
  export declare class DynoPackedSplats extends DynoUniform<typeof TPackedSplats, "packedSplats", {
80
97
  texture: THREE.DataArrayTexture;
81
98
  numSplats: number;
99
+ rgbMinMaxLnScaleMinMax: THREE.Vector4;
82
100
  }> {
83
101
  packedSplats?: PackedSplats;
84
102
  constructor({ packedSplats }?: {
@@ -1,3 +1,4 @@
1
+ import { FullScreenQuad } from 'three/addons/postprocessing/Pass.js';
1
2
  import { Dyno } from './dyno';
2
3
  import { DynoProgram, DynoProgramTemplate } from './dyno/program';
3
4
  import * as THREE from "three";
@@ -43,8 +44,5 @@ export declare class Readback {
43
44
  getTexture(): THREE.DataArrayTexture | undefined;
44
45
  static programTemplate: DynoProgramTemplate | null;
45
46
  static readbackProgram: Map<Rgba8Readback, DynoProgram>;
46
- static geometry: THREE.PlaneGeometry;
47
- static mesh: THREE.Mesh<THREE.PlaneGeometry, THREE.RawShaderMaterial, THREE.Object3DEventMap>;
48
- static scene: THREE.Scene;
49
- static camera: THREE.Camera;
47
+ static fullScreenQuad: FullScreenQuad;
50
48
  }
@@ -1,33 +1,139 @@
1
+ import { SplatEncoding } from './PackedSplats';
1
2
  import { RgbaArray } from './RgbaArray';
2
3
  import { SparkViewpoint, SparkViewpointOptions } from './SparkViewpoint';
3
4
  import { SplatAccumulator } from './SplatAccumulator';
4
5
  import { SplatGenerator } from './SplatGenerator';
5
6
  import * as THREE from "three";
6
7
  export type SparkRendererOptions = {
8
+ /**
9
+ * Pass in your THREE.WebGLRenderer instance so Spark can perform work
10
+ * outside the usual render loop. Should be created with antialias: false
11
+ * (default setting) as WebGL anti-aliasing doesn't improve Gaussian Splatting
12
+ * rendering and significantly reduces performance.
13
+ */
7
14
  renderer: THREE.WebGLRenderer;
15
+ /**
16
+ * Whether to use premultiplied alpha when accumulating splat RGB
17
+ * @default true
18
+ */
19
+ premultipliedAlpha?: boolean;
20
+ /**
21
+ * Pass in a THREE.Clock to synchronize time-based effects across different
22
+ * systems. Alternatively, you can set the SparkRenderer properties time and
23
+ * deltaTime directly. (default: new THREE.Clock)
24
+ */
8
25
  clock?: THREE.Clock;
26
+ /**
27
+ * Controls whether to check and automatically update Gsplat collection after
28
+ * each frame render.
29
+ * @default true
30
+ */
9
31
  autoUpdate?: boolean;
32
+ /**
33
+ * Controls whether to update the Gsplats before or after rendering. For WebXR
34
+ * this must be false in order to complete rendering as soon as possible.
35
+ * @default false
36
+ */
10
37
  preUpdate?: boolean;
38
+ /**
39
+ * Distance threshold for SparkRenderer movement triggering a Gsplat update at
40
+ * the new origin.
41
+ * @default 1.0
42
+ */
11
43
  originDistance?: number;
44
+ /**
45
+ * Maximum standard deviations from the center to render Gaussians. Values
46
+ * Math.sqrt(5)..Math.sqrt(8) produce good results and can be tweaked for
47
+ * performance.
48
+ * @default Math.sqrt(8)
49
+ */
12
50
  maxStdDev?: number;
51
+ /**
52
+ * Maximum pixel radius for splat rendering.
53
+ * @default 512.0
54
+ */
55
+ maxPixelRadius?: number;
56
+ /**
57
+ * Minimum alpha value for splat rendering.
58
+ * @default 0.5 * (1.0 / 255.0)
59
+ */
60
+ minAlpha?: number;
61
+ /**
62
+ * Enable 2D Gaussian splatting rendering ability. When this mode is enabled,
63
+ * any scale x/y/z component that is exactly 0 (minimum quantized value) results
64
+ * in the other two non-0 axis being interpreted as an oriented 2D Gaussian Splat,
65
+ * rather instead of the usual projected 3DGS Z-slice. When reading PLY files,
66
+ * scale values less than e^-30 will be interpreted as 0.
67
+ * @default false
68
+ */
13
69
  enable2DGS?: boolean;
70
+ /**
71
+ * Scalar value to add to 2D splat covariance diagonal, effectively blurring +
72
+ * enlarging splats. In scenes trained without the Gsplat anti-aliasing tweak
73
+ * this value was typically 0.3, but with anti-aliasing it is 0.0
74
+ * @default 0.0
75
+ */
14
76
  preBlurAmount?: number;
77
+ /**
78
+ * Scalar value to add to 2D splat covarianve diagonal, with opacity adjustment
79
+ * to correctly account for "blurring" when anti-aliasing. Typically 0.3
80
+ * (equivalent to approx 0.5 pixel radius) in scenes trained with anti-aliasing.
81
+ */
15
82
  blurAmount?: number;
83
+ /**
84
+ * Depth-of-field distance to focal plane
85
+ */
16
86
  focalDistance?: number;
87
+ /**
88
+ * Full-width angle of aperture opening (in radians), 0.0 to disable
89
+ * @default 0.0
90
+ */
17
91
  apertureAngle?: number;
92
+ /**
93
+ * Modulate Gaussian kernel falloff. 0 means "no falloff, flat shading",
94
+ * while 1 is the normal Gaussian kernel.
95
+ * @default 1.0
96
+ */
18
97
  falloff?: number;
98
+ /**
99
+ * X/Y clipping boundary factor for Gsplat centers against view frustum.
100
+ * 1.0 clips any centers that are exactly out of bounds, while 1.4 clips
101
+ * centers that are 40% beyond the bounds.
102
+ * @default 1.4
103
+ */
19
104
  clipXY?: number;
105
+ /**
106
+ * Parameter to adjust projected splat scale calculation to match other renderers,
107
+ * similar to the same parameter in the MKellogg 3DGS renderer. Higher values will
108
+ * tend to sharpen the splats. A value 2.0 can be used to match the behavior of
109
+ * the PlayCanvas renderer.
110
+ * @default 1.0
111
+ */
20
112
  focalAdjustment?: number;
113
+ /**
114
+ * Configures the SparkViewpointOptions for the default SparkViewpoint
115
+ * associated with this SparkRenderer. Notable option: sortRadial (sort by
116
+ * radial distance or Z-depth)
117
+ */
21
118
  view?: SparkViewpointOptions;
119
+ /**
120
+ * Override the default splat encoding ranges for the PackedSplats.
121
+ * (default: undefined)
122
+ */
123
+ splatEncoding?: SplatEncoding;
22
124
  };
23
125
  export declare class SparkRenderer extends THREE.Mesh {
24
126
  renderer: THREE.WebGLRenderer;
127
+ premultipliedAlpha: boolean;
25
128
  material: THREE.ShaderMaterial;
26
129
  uniforms: ReturnType<typeof SparkRenderer.makeUniforms>;
27
130
  autoUpdate: boolean;
28
131
  preUpdate: boolean;
132
+ needsUpdate: boolean;
29
133
  originDistance: number;
30
134
  maxStdDev: number;
135
+ maxPixelRadius: number;
136
+ minAlpha: number;
31
137
  enable2DGS: boolean;
32
138
  preBlurAmount: number;
33
139
  blurAmount: number;
@@ -36,6 +142,7 @@ export declare class SparkRenderer extends THREE.Mesh {
36
142
  falloff: number;
37
143
  clipXY: number;
38
144
  focalAdjustment: number;
145
+ splatEncoding: SplatEncoding;
39
146
  splatTexture: null | {
40
147
  enable?: boolean;
41
148
  texture?: THREE.Data3DTexture;
@@ -59,6 +166,7 @@ export declare class SparkRenderer extends THREE.Mesh {
59
166
  private lastFrame;
60
167
  private lastUpdateTime;
61
168
  private defaultCameras;
169
+ private lastStochastic;
62
170
  viewpoint: SparkViewpoint;
63
171
  private pendingUpdate;
64
172
  private envViewpoint;
@@ -88,6 +196,15 @@ export declare class SparkRenderer extends THREE.Mesh {
88
196
  maxStdDev: {
89
197
  value: number;
90
198
  };
199
+ maxPixelRadius: {
200
+ value: number;
201
+ };
202
+ minAlpha: {
203
+ value: number;
204
+ };
205
+ stochastic: {
206
+ value: boolean;
207
+ };
91
208
  enable2DGS: {
92
209
  value: boolean;
93
210
  };
@@ -138,6 +255,9 @@ export declare class SparkRenderer extends THREE.Mesh {
138
255
  type: string;
139
256
  value: THREE.DataArrayTexture;
140
257
  };
258
+ rgbMinMaxLnScaleMinMax: {
259
+ value: THREE.Vector4;
260
+ };
141
261
  time: {
142
262
  value: number;
143
263
  };
@@ -3,21 +3,96 @@ import { SplatAccumulator } from './SplatAccumulator';
3
3
  import { SplatGeometry } from './SplatGeometry';
4
4
  import * as THREE from "three";
5
5
  export type SparkViewpointOptions = {
6
+ /**
7
+ * Controls whether to auto-update its sort order whenever the SparkRenderer
8
+ * updates the Gsplats. If you expect to render/display from this viewpoint
9
+ * most frames, set this to true.
10
+ * @default false
11
+ */
6
12
  autoUpdate?: boolean;
13
+ /**
14
+ * Set a THREE.Camera for this viewpoint to follow.
15
+ * @default undefined
16
+ */
7
17
  camera?: THREE.Camera;
18
+ /**
19
+ * Set an explicit view-to-world transformation matrix for this viewpoint (equivalent
20
+ * to camera.matrixWorld), overrides any camera setting.
21
+ * @default undefined
22
+ */
8
23
  viewToWorld?: THREE.Matrix4;
24
+ /**
25
+ * Configure viewpoint with an off-screen render target.
26
+ * @default undefined
27
+ */
9
28
  target?: {
29
+ /**
30
+ * Width of the render target in pixels.
31
+ */
10
32
  width: number;
33
+ /**
34
+ * Height of the render target in pixels.
35
+ */
11
36
  height: number;
37
+ /**
38
+ * If you want to be able to render a scene that depends on this target's
39
+ * output (for example, a recursive viewport), set this to true to enable
40
+ * double buffering.
41
+ * @default false
42
+ */
12
43
  doubleBuffer?: boolean;
44
+ /**
45
+ * Super-sampling factor for the render target. Values 1-4 are supported.
46
+ * Note that re-sampling back down to .width x .height is done on the CPU
47
+ * with simple averaging only when calling readTarget().
48
+ * @default 1
49
+ */
13
50
  superXY?: number;
14
51
  };
52
+ /**
53
+ * Callback function that is called when the render target texture is updated.
54
+ * Receives the texture as a parameter. Use this to update a viewport with
55
+ * the latest viewpoint render each frame.
56
+ * @default undefined
57
+ */
15
58
  onTextureUpdated?: (texture: THREE.Texture) => void;
59
+ /**
60
+ * Whether to sort splats radially (geometric distance) from the viewpoint (true)
61
+ * or by Z-depth (false). Most scenes are trained with the Z-depth sort metric
62
+ * and will render more accurately at certain viewpoints. However, radial sorting
63
+ * is more stable under viewpoint rotations.
64
+ * @default true
65
+ */
16
66
  sortRadial?: boolean;
67
+ /**
68
+ * Distance threshold for re-sorting splats. If the viewpoint moves more than
69
+ * this distance, splats will be re-sorted.
70
+ * @default 0.01 units
71
+ */
17
72
  sortDistance?: number;
73
+ /**
74
+ * View direction dot product threshold for re-sorting splats. For
75
+ * sortRadial: true we use 0.99 while sortRadial: false uses 0.999 because it is
76
+ * more sensitive to view direction.
77
+ * @default 0.99 if sortRadial else 0.999
78
+ */
18
79
  sortCoorient?: boolean;
80
+ /**
81
+ * Constant added to Z-depth to bias values into the positive range for
82
+ * sortRadial: false, but also used for culling Gsplats "well behind"
83
+ * the viewpoint origin
84
+ * @default 1.0
85
+ */
19
86
  depthBias?: number;
87
+ /**
88
+ * Set this to true if rendering a 360 to disable "behind the viewpoint"
89
+ * culling during sorting. This is set automatically when rendering 360 envMaps
90
+ * using the SparkRenderer.renderEnvMap() utility function.
91
+ * @default false
92
+ */
20
93
  sort360?: boolean;
94
+ sort32?: boolean;
95
+ stochastic?: boolean;
21
96
  };
22
97
  export declare class SparkViewpoint {
23
98
  spark: SparkRenderer;
@@ -37,6 +112,8 @@ export declare class SparkViewpoint {
37
112
  sortCoorient?: boolean;
38
113
  depthBias?: number;
39
114
  sort360?: boolean;
115
+ sort32?: boolean;
116
+ stochastic: boolean;
40
117
  display: {
41
118
  accumulator: SplatAccumulator;
42
119
  viewToWorld: THREE.Matrix4;
@@ -45,7 +122,8 @@ export declare class SparkViewpoint {
45
122
  private sorting;
46
123
  private pending;
47
124
  private sortingCheck;
48
- private readback;
125
+ private readback16;
126
+ private readback32;
49
127
  private orderingFreelist;
50
128
  constructor(options: SparkViewpointOptions & {
51
129
  spark: SparkRenderer;
@@ -1,5 +1,5 @@
1
1
  import { FileLoader, Loader, LoadingManager } from 'three';
2
- import { PackedSplats } from './PackedSplats';
2
+ import { PackedSplats, SplatEncoding } from './PackedSplats';
3
3
  import { SplatMesh } from './SplatMesh';
4
4
  export declare class SplatLoader extends Loader {
5
5
  fileLoader: FileLoader;
@@ -64,11 +64,12 @@ export declare function tryPcSogsZip(input: ArrayBuffer | Uint8Array): {
64
64
  name: string;
65
65
  json: PcSogsJson;
66
66
  } | undefined;
67
- export declare function unpackSplats({ input, extraFiles, fileType, pathOrUrl, }: {
67
+ export declare function unpackSplats({ input, extraFiles, fileType, pathOrUrl, splatEncoding, }: {
68
68
  input: Uint8Array | ArrayBuffer;
69
69
  extraFiles?: Record<string, ArrayBuffer>;
70
70
  fileType?: SplatFileType;
71
71
  pathOrUrl?: string;
72
+ splatEncoding?: SplatEncoding;
72
73
  }): Promise<{
73
74
  packedArray: Uint32Array;
74
75
  numSplats: number;
@@ -1,4 +1,4 @@
1
- import { PackedSplats } from './PackedSplats';
1
+ import { PackedSplats, SplatEncoding } from './PackedSplats';
2
2
  import { RgbaArray } from './RgbaArray';
3
3
  import { SplatEdit } from './SplatEdit';
4
4
  import { GsplatModifier, SplatGenerator, SplatTransformer } from './SplatGenerator';
@@ -23,6 +23,7 @@ export type SplatMeshOptions = {
23
23
  }) => void;
24
24
  objectModifier?: GsplatModifier;
25
25
  worldModifier?: GsplatModifier;
26
+ splatEncoding?: SplatEncoding;
26
27
  };
27
28
  export type SplatMeshContext = {
28
29
  transform: SplatTransformer;
@@ -65,6 +66,7 @@ export declare class SplatMesh extends SplatGenerator {
65
66
  pushSplat(center: THREE.Vector3, scales: THREE.Vector3, quaternion: THREE.Quaternion, opacity: number, color: THREE.Color): void;
66
67
  forEachSplat(callback: (index: number, center: THREE.Vector3, scales: THREE.Vector3, quaternion: THREE.Quaternion, opacity: number, color: THREE.Color) => void): void;
67
68
  dispose(): void;
69
+ getBoundingBox(centers_only?: boolean): THREE.Box3;
68
70
  constructGenerator(context: SplatMeshContext): void;
69
71
  updateGenerator(): void;
70
72
  update({ time, viewToWorld, deltaTime, globalEdits, }: {
@@ -1,5 +1,6 @@
1
+ import { SplatEncoding } from './PackedSplats';
1
2
  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;
2
- export declare function unpackAntiSplat(fileBytes: Uint8Array): {
3
+ export declare function unpackAntiSplat(fileBytes: Uint8Array, splatEncoding: SplatEncoding): {
3
4
  packedArray: Uint32Array;
4
5
  numSplats: number;
5
6
  };
@@ -1,6 +1,5 @@
1
1
  export declare const LN_SCALE_MIN = -12;
2
2
  export declare const LN_SCALE_MAX = 9;
3
- export declare const LN_RESCALE: number;
4
3
  export declare const SCALE_MIN: number;
5
4
  export declare const SCALE_MAX: number;
6
5
  export declare const LN_SCALE_ZERO = -30;
@@ -1,15 +1,17 @@
1
1
  import { Dyno } from './base';
2
2
  import { Gsplat } from './splats';
3
3
  import { DynoVal, DynoValue, HasDynoOut } from './value';
4
- export declare const outputPackedSplat: (gsplat: DynoVal<typeof Gsplat>) => OutputPackedSplat;
4
+ export declare const outputPackedSplat: (gsplat: DynoVal<typeof Gsplat>, rgbMinMaxLnScaleMinMax: DynoVal<"vec4">) => OutputPackedSplat;
5
5
  export declare const outputRgba8: (rgba8: DynoVal<"vec4">) => OutputRgba8;
6
6
  export declare class OutputPackedSplat extends Dyno<{
7
7
  gsplat: typeof Gsplat;
8
+ rgbMinMaxLnScaleMinMax: "vec4";
8
9
  }, {
9
10
  output: "uvec4";
10
11
  }> implements HasDynoOut<"uvec4"> {
11
- constructor({ gsplat }: {
12
+ constructor({ gsplat, rgbMinMaxLnScaleMinMax, }: {
12
13
  gsplat?: DynoVal<typeof Gsplat>;
14
+ rgbMinMaxLnScaleMinMax?: DynoVal<"vec4">;
13
15
  });
14
16
  dynoOut(): DynoValue<"uvec4">;
15
17
  }
@@ -19,3 +19,5 @@ export { type JointId, JointEnum, JOINT_IDS, NUM_JOINTS, JOINT_INDEX, JOINT_RADI
19
19
  export { SparkControls, FpsMovement, PointerControls } from './controls';
20
20
  export { isMobile, isAndroid, isOculus, flipPixels, pixelsToPngUrl, toHalf, fromHalf, floatToUint8, floatToSint8, Uint8ToFloat, Sint8ToFloat, setPackedSplat, unpackSplat, } from './utils';
21
21
  export * as utils from './utils';
22
+ export { LN_SCALE_MIN, LN_SCALE_MAX } from './defines';
23
+ export * as defines from './defines';
@@ -1,5 +1,6 @@
1
+ import { SplatEncoding } from './PackedSplats';
1
2
  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;
2
- export declare function unpackKsplat(fileBytes: Uint8Array): {
3
+ export declare function unpackKsplat(fileBytes: Uint8Array, splatEncoding: SplatEncoding): {
3
4
  packedArray: Uint32Array;
4
5
  numSplats: number;
5
6
  extra: Record<string, unknown>;
@@ -1,10 +1,11 @@
1
+ import { SplatEncoding } from './PackedSplats';
1
2
  import { PcSogsJson } from './SplatLoader';
2
- export declare function unpackPcSogs(json: PcSogsJson, extraFiles: Record<string, ArrayBuffer>): Promise<{
3
+ export declare function unpackPcSogs(json: PcSogsJson, extraFiles: Record<string, ArrayBuffer>, splatEncoding: SplatEncoding): Promise<{
3
4
  packedArray: Uint32Array;
4
5
  numSplats: number;
5
6
  extra: Record<string, unknown>;
6
7
  }>;
7
- export declare function unpackPcSogsZip(fileBytes: Uint8Array): Promise<{
8
+ export declare function unpackPcSogsZip(fileBytes: Uint8Array, splatEncoding: SplatEncoding): Promise<{
8
9
  packedArray: Uint32Array;
9
10
  numSplats: number;
10
11
  extra: Record<string, unknown>;
@@ -39,14 +39,33 @@ export declare class FreeList<T, Args> {
39
39
  free(item: T): void;
40
40
  disposeAll(): void;
41
41
  }
42
- 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;
42
+ 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?: {
43
+ rgbMin?: number;
44
+ rgbMax?: number;
45
+ lnScaleMin?: number;
46
+ lnScaleMax?: number;
47
+ }): void;
43
48
  export declare function setPackedSplatCenter(packedSplats: Uint32Array, index: number, x: number, y: number, z: number): void;
44
- export declare function setPackedSplatScales(packedSplats: Uint32Array, index: number, scaleX: number, scaleY: number, scaleZ: number): void;
49
+ export declare function setPackedSplatScales(packedSplats: Uint32Array, index: number, scaleX: number, scaleY: number, scaleZ: number, encoding?: {
50
+ lnScaleMin?: number;
51
+ lnScaleMax?: number;
52
+ }): void;
45
53
  export declare function setPackedSplatQuat(packedSplats: Uint32Array, index: number, quatX: number, quatY: number, quatZ: number, quatW: number): void;
46
- export declare function setPackedSplatRgba(packedSplats: Uint32Array, index: number, r: number, g: number, b: number, a: number): void;
47
- export declare function setPackedSplatRgb(packedSplats: Uint32Array, index: number, r: number, g: number, b: number): void;
54
+ export declare function setPackedSplatRgba(packedSplats: Uint32Array, index: number, r: number, g: number, b: number, a: number, encoding?: {
55
+ rgbMin?: number;
56
+ rgbMax?: number;
57
+ }): void;
58
+ export declare function setPackedSplatRgb(packedSplats: Uint32Array, index: number, r: number, g: number, b: number, encoding?: {
59
+ rgbMin?: number;
60
+ rgbMax?: number;
61
+ }): void;
48
62
  export declare function setPackedSplatOpacity(packedSplats: Uint32Array, index: number, opacity: number): void;
49
- export declare function unpackSplat(packedSplats: Uint32Array, index: number): {
63
+ export declare function unpackSplat(packedSplats: Uint32Array, index: number, encoding?: {
64
+ rgbMin?: number;
65
+ rgbMax?: number;
66
+ lnScaleMin?: number;
67
+ lnScaleMax?: number;
68
+ }): {
50
69
  center: THREE.Vector3;
51
70
  scales: THREE.Vector3;
52
71
  quaternion: THREE.Quaternion;
@@ -132,9 +151,18 @@ export declare function encodeQuatEulerXyz888(q: THREE.Quaternion): number;
132
151
  * and then converting them back to Euler angles in [-π, π] and to a quaternion.
133
152
  */
134
153
  export declare function decodeQuatEulerXyz888(encoded: number, out: THREE.Quaternion): THREE.Quaternion;
135
- export declare function encodeSh1Rgb(sh1Array: Uint32Array, index: number, sh1Rgb: Float32Array): void;
136
- export declare function encodeSh2Rgb(sh2Array: Uint32Array, index: number, sh2Rgb: Float32Array): void;
137
- export declare function encodeSh3Rgb(sh3Array: Uint32Array, index: number, sh3Rgb: Float32Array): void;
154
+ export declare function encodeSh1Rgb(sh1Array: Uint32Array, index: number, sh1Rgb: Float32Array, encoding?: {
155
+ sh1Min?: number;
156
+ sh1Max?: number;
157
+ }): void;
158
+ export declare function encodeSh2Rgb(sh2Array: Uint32Array, index: number, sh2Rgb: Float32Array, encoding?: {
159
+ sh2Min?: number;
160
+ sh2Max?: number;
161
+ }): void;
162
+ export declare function encodeSh3Rgb(sh3Array: Uint32Array, index: number, sh3Rgb: Float32Array, encoding?: {
163
+ sh3Min?: number;
164
+ sh3Max?: number;
165
+ }): void;
138
166
  export declare function decompressPartialGzip(fileBytes: Uint8Array, numBytes: number): Uint8Array;
139
167
  export declare class GunzipReader {
140
168
  fileBytes: Uint8Array;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sparkjsdev/spark",
3
- "version": "0.1.6",
3
+ "version": "0.1.8",
4
4
  "description": "An advanced 3D Gaussian Splatting renderer for THREE.js",
5
5
  "homepage": "https://sparkjs.dev/",
6
6
  "type": "module",