@sparkjsdev/spark 2.2.0 → 2.3.1
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.
- package/README.md +2 -2
- package/dist/assets/worker-BjrcU_V3.js.map +1 -0
- package/dist/assets/worker-Bqh5sdus.js.map +1 -0
- package/dist/spark.cjs.js +15281 -17548
- package/dist/spark.cjs.js.map +1 -1
- package/dist/spark.cjs.min.js +357 -358
- package/dist/spark.cjs.min.js.map +1 -1
- package/dist/spark.module.js +15398 -17778
- package/dist/spark.module.js.map +1 -1
- package/dist/spark.module.min.js +10769 -14498
- package/dist/spark.module.min.js.map +1 -1
- package/dist/types/ExtSplats.d.ts +6 -4
- package/dist/types/PackedSplats.d.ts +11 -9
- package/dist/types/Readback.d.ts +3 -3
- package/dist/types/RgbaArray.d.ts +3 -3
- package/dist/types/SparkPortals.d.ts +1 -1
- package/dist/types/SparkRenderer.d.ts +23 -6
- package/dist/types/SparkXr.d.ts +56 -74
- package/dist/types/SplatAccumulator.d.ts +6 -6
- package/dist/types/SplatEdit.d.ts +5 -1
- package/dist/types/SplatGenerator.d.ts +11 -3
- package/dist/types/SplatLoader.d.ts +5 -25
- package/dist/types/SplatMesh.d.ts +12 -10
- package/dist/types/SplatPager.d.ts +22 -4
- package/dist/types/SplatSkinning.d.ts +7 -7
- package/dist/types/SplatWorker.d.ts +1 -1
- package/dist/types/defines.d.ts +45 -47
- package/dist/types/dyno/base.d.ts +3 -3
- package/dist/types/dyno/convert.d.ts +3 -3
- package/dist/types/dyno/logic.d.ts +3 -3
- package/dist/types/dyno/math.d.ts +4 -4
- package/dist/types/dyno/mathTypes.d.ts +1 -1
- package/dist/types/dyno/output.d.ts +3 -3
- package/dist/types/dyno/program.d.ts +1 -1
- package/dist/types/dyno/splats.d.ts +2 -2
- package/dist/types/dyno/texture.d.ts +3 -3
- package/dist/types/dyno/transform.d.ts +2 -2
- package/dist/types/dyno/trig.d.ts +3 -3
- package/dist/types/dyno/uniforms.d.ts +3 -3
- package/dist/types/dyno/util.d.ts +3 -3
- package/dist/types/dyno/value.d.ts +2 -2
- package/dist/types/dyno/vecmat.d.ts +3 -3
- package/dist/types/dyno.d.ts +16 -16
- package/dist/types/generators/snow.d.ts +14 -14
- package/dist/types/generators/static.d.ts +1 -1
- package/dist/types/generators.d.ts +2 -2
- package/dist/types/hands.d.ts +29 -29
- package/dist/types/hooks.d.ts +14 -0
- package/dist/types/index.d.ts +25 -25
- package/dist/types/modifiers/depthColor.d.ts +7 -7
- package/dist/types/modifiers/normalColor.d.ts +3 -3
- package/dist/types/modifiers.d.ts +2 -2
- package/dist/types/splatConstructors.d.ts +2 -2
- package/dist/types/spz.d.ts +35 -4
- package/dist/types/utils.d.ts +4 -1
- package/dist/types/worker.d.ts +1 -1
- package/package.json +15 -9
- package/dist/assets/worker-D4QoimE1.js.map +0 -1
- package/dist/assets/worker-D5xrpgfn.js.map +0 -1
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import { RgbaArray } from './RgbaArray';
|
|
2
|
-
import { SplatSource } from './SplatMesh';
|
|
3
|
-
import { SplatFileType } from './defines';
|
|
4
|
-
import { DynoInt, DynoUniform, DynoUsampler2DArray, DynoVal, Gsplat, TExtSplats } from './dyno';
|
|
5
1
|
import * as THREE from "three";
|
|
2
|
+
import type { RgbaArray } from "./RgbaArray";
|
|
3
|
+
import type { SplatSource } from "./SplatMesh";
|
|
4
|
+
import { type SplatFileType } from "./defines";
|
|
5
|
+
import { DynoInt, DynoUniform, DynoUsampler2DArray, type DynoVal, type Gsplat, TExtSplats } from "./dyno";
|
|
6
6
|
export type ExtSplatsOptions = {
|
|
7
7
|
url?: string;
|
|
8
|
+
requestHeader?: Record<string, string>;
|
|
9
|
+
withCredentials?: boolean;
|
|
8
10
|
fileBytes?: Uint8Array | ArrayBuffer;
|
|
9
11
|
fileType?: SplatFileType;
|
|
10
12
|
fileName?: string;
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
import { FullScreenQuad } from 'three/addons/postprocessing/Pass.js';
|
|
2
|
-
import { RgbaArray } from './RgbaArray';
|
|
3
|
-
import { GsplatGenerator } from './SplatGenerator';
|
|
4
|
-
import { SplatSource } from './SplatMesh';
|
|
5
|
-
import { SplatEncoding, SplatFileType } from './defines';
|
|
6
|
-
import { DynoInt, DynoProgram, DynoProgramTemplate, DynoUniform, DynoUsampler2DArray, DynoVal, DynoVec3 } from './dyno';
|
|
7
|
-
import { Gsplat, TPackedSplats } from './dyno/splats';
|
|
8
1
|
import * as THREE from "three";
|
|
2
|
+
import { FullScreenQuad } from "three/addons/postprocessing/Pass.js";
|
|
3
|
+
import type { RgbaArray } from "./RgbaArray";
|
|
4
|
+
import type { GsplatGenerator } from "./SplatGenerator";
|
|
5
|
+
import type { SplatSource } from "./SplatMesh";
|
|
6
|
+
import { type SplatEncoding, type SplatFileType } from "./defines";
|
|
7
|
+
import { DynoInt, DynoProgram, DynoProgramTemplate, DynoUniform, DynoUsampler2DArray, type DynoVal, DynoVec3 } from "./dyno";
|
|
8
|
+
import { type Gsplat, TPackedSplats } from "./dyno/splats";
|
|
9
9
|
export type PackedSplatsOptions = {
|
|
10
10
|
url?: string;
|
|
11
|
+
requestHeader?: Record<string, string>;
|
|
12
|
+
withCredentials?: boolean;
|
|
11
13
|
fileBytes?: Uint8Array | ArrayBuffer;
|
|
12
14
|
fileType?: SplatFileType;
|
|
13
15
|
fileName?: string;
|
|
@@ -19,7 +21,7 @@ export type PackedSplatsOptions = {
|
|
|
19
21
|
construct?: (splats: PackedSplats) => Promise<void> | void;
|
|
20
22
|
onProgress?: (event: ProgressEvent) => void;
|
|
21
23
|
extra?: Record<string, unknown>;
|
|
22
|
-
splatEncoding?: SplatEncoding
|
|
24
|
+
splatEncoding?: Partial<SplatEncoding>;
|
|
23
25
|
lod?: boolean | "quality";
|
|
24
26
|
nonLod?: boolean;
|
|
25
27
|
lodAbove?: number;
|
|
@@ -31,7 +33,7 @@ export declare class PackedSplats implements SplatSource {
|
|
|
31
33
|
packedArray: Uint32Array | null;
|
|
32
34
|
extra: Record<string, unknown>;
|
|
33
35
|
maxSh: number;
|
|
34
|
-
splatEncoding
|
|
36
|
+
splatEncoding: SplatEncoding;
|
|
35
37
|
lod?: boolean | "quality";
|
|
36
38
|
nonLod?: boolean;
|
|
37
39
|
lodSplats?: PackedSplats;
|
package/dist/types/Readback.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { FullScreenQuad } from 'three/addons/postprocessing/Pass.js';
|
|
2
|
-
import { Dyno } from './dyno';
|
|
3
|
-
import { DynoProgram, DynoProgramTemplate } from './dyno/program';
|
|
4
1
|
import * as THREE from "three";
|
|
2
|
+
import { FullScreenQuad } from "three/addons/postprocessing/Pass.js";
|
|
3
|
+
import { type Dyno } from "./dyno";
|
|
4
|
+
import { DynoProgram, DynoProgramTemplate } from "./dyno/program";
|
|
5
5
|
export type Rgba8Readback = Dyno<{
|
|
6
6
|
index: "int";
|
|
7
7
|
}, {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { PackedSplats } from './PackedSplats';
|
|
2
|
-
import { Readback, Rgba8Readback } from './Readback';
|
|
3
|
-
import { DynoUniform, DynoVal } from './dyno';
|
|
4
1
|
import * as THREE from "three";
|
|
2
|
+
import { type PackedSplats } from "./PackedSplats";
|
|
3
|
+
import { Readback, type Rgba8Readback } from "./Readback";
|
|
4
|
+
import { DynoUniform, type DynoVal } from "./dyno";
|
|
5
5
|
export type RgbaArrayOptions = {
|
|
6
6
|
capacity?: number;
|
|
7
7
|
array?: Uint8Array;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { SparkRenderer, SparkRendererOptions } from './SparkRenderer';
|
|
2
1
|
import * as THREE from "three";
|
|
2
|
+
import { SparkRenderer, type SparkRendererOptions } from "./SparkRenderer";
|
|
3
3
|
/**
|
|
4
4
|
* Fragment shader for portal disk clipping.
|
|
5
5
|
* - diskRadius > 0: render "behind portal" only through the disk
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import { ExtSplats, PackedSplats, PagedSplats, SplatMesh, SplatPager } from '.';
|
|
2
|
-
import { SplatAccumulator } from './SplatAccumulator';
|
|
3
|
-
import { SplatWorker } from './SplatWorker';
|
|
4
1
|
import * as THREE from "three";
|
|
2
|
+
import { ExtSplats } from "./ExtSplats";
|
|
3
|
+
import { PackedSplats } from "./PackedSplats";
|
|
4
|
+
import { SplatAccumulator } from "./SplatAccumulator";
|
|
5
|
+
import { SplatMesh } from "./SplatMesh";
|
|
6
|
+
import { PagedSplats, SplatPager } from "./SplatPager";
|
|
7
|
+
import { SplatWorker } from "./SplatWorker";
|
|
5
8
|
export interface SparkRendererOptions {
|
|
6
9
|
/**
|
|
7
10
|
* Pass in your THREE.WebGLRenderer instance so Spark can perform work
|
|
@@ -12,7 +15,9 @@ export interface SparkRendererOptions {
|
|
|
12
15
|
renderer: THREE.WebGLRenderer;
|
|
13
16
|
/**
|
|
14
17
|
* Callback function to be called when SparkRenderer needs to re-render,
|
|
15
|
-
* for example when splat sort order or LoD updates complete.
|
|
18
|
+
* for example when splat sort order or LoD updates complete. May fire
|
|
19
|
+
* several times per frame; schedule a single render rather than rendering
|
|
20
|
+
* inside the callback.
|
|
16
21
|
*/
|
|
17
22
|
onDirty?: () => void;
|
|
18
23
|
/**
|
|
@@ -193,6 +198,14 @@ export interface SparkRendererOptions {
|
|
|
193
198
|
* @default 3
|
|
194
199
|
*/
|
|
195
200
|
numLodFetchers?: number;
|
|
201
|
+
/**
|
|
202
|
+
* How long (ms) a LoD SplatMesh can go unrendered (hidden or removed from the
|
|
203
|
+
* scene) before its LoD state is released: the worker-side tree is dropped and,
|
|
204
|
+
* for paged meshes, its resident pages are freed for other meshes. Rendering it
|
|
205
|
+
* again rebuilds the tree and refetches pages. Set to Infinity to never release.
|
|
206
|
+
* @default 3000
|
|
207
|
+
*/
|
|
208
|
+
lodCleanupTimeoutMs?: number;
|
|
196
209
|
/**
|
|
197
210
|
* Full-width angle in degrees of fixed foveation cone along the view direction
|
|
198
211
|
* with no foveation applied (full resolution, foveate=1.0). Set to 0 to disable.
|
|
@@ -319,7 +332,7 @@ export declare class SparkRenderer extends THREE.Mesh {
|
|
|
319
332
|
readonly timer: THREE.Timer;
|
|
320
333
|
private readonly ownsTimer;
|
|
321
334
|
lastFrame: number;
|
|
322
|
-
updateTimeoutId:
|
|
335
|
+
updateTimeoutId: ReturnType<typeof setTimeout> | undefined;
|
|
323
336
|
onDirty?: () => void;
|
|
324
337
|
dirty: boolean;
|
|
325
338
|
orderingTexture: THREE.DataTexture | null;
|
|
@@ -332,10 +345,11 @@ export declare class SparkRenderer extends THREE.Mesh {
|
|
|
332
345
|
sortDirty: boolean;
|
|
333
346
|
lastSortTime: number;
|
|
334
347
|
sortWorker: SplatWorker | null;
|
|
335
|
-
sortTimeoutId:
|
|
348
|
+
sortTimeoutId: ReturnType<typeof setTimeout> | undefined;
|
|
336
349
|
sortedCenter: THREE.Vector3;
|
|
337
350
|
sortedDir: THREE.Vector3;
|
|
338
351
|
readback32: Uint32Array<ArrayBuffer>;
|
|
352
|
+
private readonly initWatched;
|
|
339
353
|
enableLod: boolean;
|
|
340
354
|
enableDriveLod: boolean;
|
|
341
355
|
enableLodFetching: boolean;
|
|
@@ -347,6 +361,7 @@ export declare class SparkRenderer extends THREE.Mesh {
|
|
|
347
361
|
pagedExtSplats: boolean;
|
|
348
362
|
maxPagedSplats: number;
|
|
349
363
|
numLodFetchers: number;
|
|
364
|
+
lodCleanupTimeoutMs: number;
|
|
350
365
|
behindFoveate: number;
|
|
351
366
|
coneFov0: number;
|
|
352
367
|
coneFov: number;
|
|
@@ -516,6 +531,8 @@ export declare class SparkRenderer extends THREE.Mesh {
|
|
|
516
531
|
private ensureLodWorker;
|
|
517
532
|
defaultSplatTarget(): 500000 | 750000 | 1000000 | 1500000 | 2500000;
|
|
518
533
|
private driveLod;
|
|
534
|
+
/** Body of the LoD update, run with exclusive access to the LoD worker. */
|
|
535
|
+
private driveLodExclusive;
|
|
519
536
|
private initLodTree;
|
|
520
537
|
private pageSizeWarning;
|
|
521
538
|
private updateLodInstances;
|
package/dist/types/SparkXr.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { SplatMesh } from './SplatMesh';
|
|
2
1
|
import * as THREE from "three";
|
|
2
|
+
import { SplatMesh } from "./SplatMesh";
|
|
3
|
+
import { Hand, type JointId } from "./hands";
|
|
3
4
|
export interface SparkXrOptions {
|
|
4
5
|
renderer: THREE.WebGLRenderer;
|
|
5
6
|
element?: HTMLElement;
|
|
@@ -65,51 +66,6 @@ export declare const DEFAULT_CONTROLLER_GETMOVE: (gamepads: XrGamepads, sparkXr:
|
|
|
65
66
|
export declare const DEFAULT_CONTROLLER_GETROTATE: (gamepads: XrGamepads, sparkXr: SparkXr) => THREE.Vector3;
|
|
66
67
|
export declare const DEFAULT_CONTROLLER_GETFAST: (gamepads: XrGamepads, sparkXr: SparkXr) => boolean;
|
|
67
68
|
export declare const DEFAULT_CONTROLLER_GETSLOW: (gamepads: XrGamepads, sparkXr: SparkXr) => boolean;
|
|
68
|
-
export declare enum JointEnum {
|
|
69
|
-
w = "wrist",
|
|
70
|
-
t0 = "thumb-metacarpal",
|
|
71
|
-
t1 = "thumb-phalanx-proximal",
|
|
72
|
-
t2 = "thumb-phalanx-distal",
|
|
73
|
-
t3 = "thumb-tip",
|
|
74
|
-
i0 = "index-finger-metacarpal",
|
|
75
|
-
i1 = "index-finger-phalanx-proximal",
|
|
76
|
-
i2 = "index-finger-phalanx-intermediate",
|
|
77
|
-
i3 = "index-finger-phalanx-distal",
|
|
78
|
-
i4 = "index-finger-tip",
|
|
79
|
-
m0 = "middle-finger-metacarpal",
|
|
80
|
-
m1 = "middle-finger-phalanx-proximal",
|
|
81
|
-
m2 = "middle-finger-phalanx-intermediate",
|
|
82
|
-
m3 = "middle-finger-phalanx-distal",
|
|
83
|
-
m4 = "middle-finger-tip",
|
|
84
|
-
r0 = "ring-finger-metacarpal",
|
|
85
|
-
r1 = "ring-finger-phalanx-proximal",
|
|
86
|
-
r2 = "ring-finger-phalanx-intermediate",
|
|
87
|
-
r3 = "ring-finger-phalanx-distal",
|
|
88
|
-
r4 = "ring-finger-tip",
|
|
89
|
-
p0 = "pinky-finger-metacarpal",
|
|
90
|
-
p1 = "pinky-finger-phalanx-proximal",
|
|
91
|
-
p2 = "pinky-finger-phalanx-intermediate",
|
|
92
|
-
p3 = "pinky-finger-phalanx-distal",
|
|
93
|
-
p4 = "pinky-finger-tip"
|
|
94
|
-
}
|
|
95
|
-
export type JointId = keyof typeof JointEnum;
|
|
96
|
-
export declare const JOINT_IDS: JointId[];
|
|
97
|
-
export declare const NUM_JOINTS: number;
|
|
98
|
-
export declare const JOINT_INDEX: {
|
|
99
|
-
[key in JointId]: number;
|
|
100
|
-
};
|
|
101
|
-
export declare const JOINT_RADIUS: {
|
|
102
|
-
[key in JointId]: number;
|
|
103
|
-
};
|
|
104
|
-
export declare const JOINT_SEGMENTS: JointId[][];
|
|
105
|
-
export declare const JOINT_SEGMENT_STEPS: number[][];
|
|
106
|
-
export declare const JOINT_TIPS: JointId[];
|
|
107
|
-
export declare const FINGER_TIPS: JointId[];
|
|
108
|
-
export declare enum Hand {
|
|
109
|
-
left = "left",
|
|
110
|
-
right = "right"
|
|
111
|
-
}
|
|
112
|
-
export declare const HANDS: Hand[];
|
|
113
69
|
export type Joint = {
|
|
114
70
|
position: THREE.Vector3;
|
|
115
71
|
quaternion: THREE.Quaternion;
|
|
@@ -138,15 +94,36 @@ export declare class SparkXr {
|
|
|
138
94
|
private updateElement;
|
|
139
95
|
private static createButton;
|
|
140
96
|
xrSupported(): boolean;
|
|
141
|
-
static JointEnum:
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
97
|
+
static readonly JointEnum: {
|
|
98
|
+
readonly w: "wrist";
|
|
99
|
+
readonly t0: "thumb-metacarpal";
|
|
100
|
+
readonly t1: "thumb-phalanx-proximal";
|
|
101
|
+
readonly t2: "thumb-phalanx-distal";
|
|
102
|
+
readonly t3: "thumb-tip";
|
|
103
|
+
readonly i0: "index-finger-metacarpal";
|
|
104
|
+
readonly i1: "index-finger-phalanx-proximal";
|
|
105
|
+
readonly i2: "index-finger-phalanx-intermediate";
|
|
106
|
+
readonly i3: "index-finger-phalanx-distal";
|
|
107
|
+
readonly i4: "index-finger-tip";
|
|
108
|
+
readonly m0: "middle-finger-metacarpal";
|
|
109
|
+
readonly m1: "middle-finger-phalanx-proximal";
|
|
110
|
+
readonly m2: "middle-finger-phalanx-intermediate";
|
|
111
|
+
readonly m3: "middle-finger-phalanx-distal";
|
|
112
|
+
readonly m4: "middle-finger-tip";
|
|
113
|
+
readonly r0: "ring-finger-metacarpal";
|
|
114
|
+
readonly r1: "ring-finger-phalanx-proximal";
|
|
115
|
+
readonly r2: "ring-finger-phalanx-intermediate";
|
|
116
|
+
readonly r3: "ring-finger-phalanx-distal";
|
|
117
|
+
readonly r4: "ring-finger-tip";
|
|
118
|
+
readonly p0: "pinky-finger-metacarpal";
|
|
119
|
+
readonly p1: "pinky-finger-phalanx-proximal";
|
|
120
|
+
readonly p2: "pinky-finger-phalanx-intermediate";
|
|
121
|
+
readonly p3: "pinky-finger-phalanx-distal";
|
|
122
|
+
readonly p4: "pinky-finger-tip";
|
|
123
|
+
};
|
|
124
|
+
static readonly JOINT_IDS: ("i0" | "i1" | "i2" | "i3" | "i4" | "m0" | "m1" | "m2" | "m3" | "m4" | "p0" | "p1" | "p2" | "p3" | "p4" | "r0" | "r1" | "r2" | "r3" | "r4" | "t0" | "t1" | "t2" | "t3" | "w")[];
|
|
125
|
+
static readonly NUM_JOINTS: number;
|
|
126
|
+
static readonly JOINT_INDEX: {
|
|
150
127
|
i0: number;
|
|
151
128
|
i1: number;
|
|
152
129
|
i2: number;
|
|
@@ -157,23 +134,23 @@ export declare class SparkXr {
|
|
|
157
134
|
m2: number;
|
|
158
135
|
m3: number;
|
|
159
136
|
m4: number;
|
|
160
|
-
r0: number;
|
|
161
|
-
r1: number;
|
|
162
|
-
r2: number;
|
|
163
|
-
r3: number;
|
|
164
|
-
r4: number;
|
|
165
137
|
p0: number;
|
|
166
138
|
p1: number;
|
|
167
139
|
p2: number;
|
|
168
140
|
p3: number;
|
|
169
141
|
p4: number;
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
142
|
+
r0: number;
|
|
143
|
+
r1: number;
|
|
144
|
+
r2: number;
|
|
145
|
+
r3: number;
|
|
146
|
+
r4: number;
|
|
173
147
|
t0: number;
|
|
174
148
|
t1: number;
|
|
175
149
|
t2: number;
|
|
176
150
|
t3: number;
|
|
151
|
+
w: number;
|
|
152
|
+
};
|
|
153
|
+
static readonly JOINT_RADIUS: {
|
|
177
154
|
i0: number;
|
|
178
155
|
i1: number;
|
|
179
156
|
i2: number;
|
|
@@ -184,23 +161,28 @@ export declare class SparkXr {
|
|
|
184
161
|
m2: number;
|
|
185
162
|
m3: number;
|
|
186
163
|
m4: number;
|
|
187
|
-
r0: number;
|
|
188
|
-
r1: number;
|
|
189
|
-
r2: number;
|
|
190
|
-
r3: number;
|
|
191
|
-
r4: number;
|
|
192
164
|
p0: number;
|
|
193
165
|
p1: number;
|
|
194
166
|
p2: number;
|
|
195
167
|
p3: number;
|
|
196
168
|
p4: number;
|
|
169
|
+
r0: number;
|
|
170
|
+
r1: number;
|
|
171
|
+
r2: number;
|
|
172
|
+
r3: number;
|
|
173
|
+
r4: number;
|
|
174
|
+
t0: number;
|
|
175
|
+
t1: number;
|
|
176
|
+
t2: number;
|
|
177
|
+
t3: number;
|
|
178
|
+
w: number;
|
|
197
179
|
};
|
|
198
|
-
static JOINT_SEGMENTS: ("
|
|
199
|
-
static JOINT_SEGMENT_STEPS: number[][];
|
|
200
|
-
static JOINT_TIPS: ("
|
|
201
|
-
static FINGER_TIPS: ("
|
|
202
|
-
static Hand: typeof Hand;
|
|
203
|
-
static HANDS: Hand[];
|
|
180
|
+
static readonly JOINT_SEGMENTS: ("i0" | "i1" | "i2" | "i3" | "i4" | "m0" | "m1" | "m2" | "m3" | "m4" | "p0" | "p1" | "p2" | "p3" | "p4" | "r0" | "r1" | "r2" | "r3" | "r4" | "t0" | "t1" | "t2" | "t3" | "w")[][];
|
|
181
|
+
static readonly JOINT_SEGMENT_STEPS: number[][];
|
|
182
|
+
static readonly JOINT_TIPS: ("i0" | "i1" | "i2" | "i3" | "i4" | "m0" | "m1" | "m2" | "m3" | "m4" | "p0" | "p1" | "p2" | "p3" | "p4" | "r0" | "r1" | "r2" | "r3" | "r4" | "t0" | "t1" | "t2" | "t3" | "w")[];
|
|
183
|
+
static readonly FINGER_TIPS: ("i0" | "i1" | "i2" | "i3" | "i4" | "m0" | "m1" | "m2" | "m3" | "m4" | "p0" | "p1" | "p2" | "p3" | "p4" | "r0" | "r1" | "r2" | "r3" | "r4" | "t0" | "t1" | "t2" | "t3" | "w")[];
|
|
184
|
+
static readonly Hand: typeof Hand;
|
|
185
|
+
static readonly HANDS: Hand[];
|
|
204
186
|
left(): XrHand;
|
|
205
187
|
right(): XrHand;
|
|
206
188
|
updateControllers(camera: THREE.Camera): void;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { FullScreenQuad } from 'three/addons/postprocessing/Pass.js';
|
|
2
|
-
import { Readback } from './Readback';
|
|
3
|
-
import { CovSplatGenerator, GsplatGenerator, SplatGenerator } from './SplatGenerator';
|
|
4
|
-
import { SplatMesh } from './SplatMesh';
|
|
5
|
-
import { DynoBool, DynoProgram, DynoProgramTemplate, DynoUsampler2DArray, DynoVec3 } from './dyno';
|
|
6
1
|
import * as THREE from "three";
|
|
2
|
+
import { FullScreenQuad } from "three/addons/postprocessing/Pass.js";
|
|
3
|
+
import { Readback } from "./Readback";
|
|
4
|
+
import { type CovSplatGenerator, type GsplatGenerator, SplatGenerator } from "./SplatGenerator";
|
|
5
|
+
import { SplatMesh } from "./SplatMesh";
|
|
6
|
+
import { DynoBool, DynoProgram, DynoProgramTemplate, DynoUsampler2DArray, DynoVec3 } from "./dyno";
|
|
7
7
|
export type GeneratorMapping = {
|
|
8
8
|
node: SplatGenerator;
|
|
9
9
|
generator?: GsplatGenerator;
|
|
@@ -58,7 +58,7 @@ export declare class SplatAccumulator {
|
|
|
58
58
|
};
|
|
59
59
|
static programExtTemplate: DynoProgramTemplate;
|
|
60
60
|
static programTemplate: DynoProgramTemplate;
|
|
61
|
-
static generatorProgram: WeakMap<
|
|
61
|
+
static generatorProgram: WeakMap<CovSplatGenerator | GsplatGenerator, DynoProgram>;
|
|
62
62
|
static fullScreenQuad: FullScreenQuad;
|
|
63
63
|
generate({ generator, covGenerator, base, count, renderer, }: {
|
|
64
64
|
generator?: GsplatGenerator;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { CovSplat, DynoUniform, DynoVal, Gsplat } from './dyno';
|
|
2
1
|
import * as THREE from "three";
|
|
2
|
+
import { CovSplat, DynoUniform, type DynoVal, Gsplat } from "./dyno";
|
|
3
3
|
export declare enum SplatEditSdfType {
|
|
4
4
|
ALL = "all",
|
|
5
5
|
PLANE = "plane",
|
|
@@ -24,6 +24,7 @@ export type SplatEditSdfOptions = {
|
|
|
24
24
|
radius?: number;
|
|
25
25
|
};
|
|
26
26
|
export declare class SplatEditSdf extends THREE.Object3D {
|
|
27
|
+
readonly isSplatEditSdf = true;
|
|
27
28
|
type: SplatEditSdfType;
|
|
28
29
|
invert: boolean;
|
|
29
30
|
opacity: number;
|
|
@@ -32,6 +33,7 @@ export declare class SplatEditSdf extends THREE.Object3D {
|
|
|
32
33
|
radius: number;
|
|
33
34
|
constructor(options?: SplatEditSdfOptions);
|
|
34
35
|
}
|
|
36
|
+
export declare function isSplatEditSdf(obj: THREE.Object3D): obj is SplatEditSdf;
|
|
35
37
|
export type SplatEditOptions = {
|
|
36
38
|
name?: string;
|
|
37
39
|
rgbaBlendMode?: SplatEditRgbaBlendMode;
|
|
@@ -41,6 +43,7 @@ export type SplatEditOptions = {
|
|
|
41
43
|
sdfs?: SplatEditSdf[];
|
|
42
44
|
};
|
|
43
45
|
export declare class SplatEdit extends THREE.Object3D {
|
|
46
|
+
readonly isSplatEdit = true;
|
|
44
47
|
ordering: number;
|
|
45
48
|
rgbaBlendMode: SplatEditRgbaBlendMode;
|
|
46
49
|
sdfSmooth: number;
|
|
@@ -52,6 +55,7 @@ export declare class SplatEdit extends THREE.Object3D {
|
|
|
52
55
|
addSdf(sdf: SplatEditSdf): void;
|
|
53
56
|
removeSdf(sdf: SplatEditSdf): void;
|
|
54
57
|
}
|
|
58
|
+
export declare function isSplatEdit(obj: THREE.Object3D): obj is SplatEdit;
|
|
55
59
|
export declare class SplatEdits {
|
|
56
60
|
maxSdfs: number;
|
|
57
61
|
numSdfs: number;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { SplatEdit } from './SplatEdit';
|
|
2
|
-
import { CovSplat, Dyno, DynoFloat, DynoMat3, DynoVal, DynoVec3, DynoVec4, Gsplat } from './dyno';
|
|
3
1
|
import * as THREE from "three";
|
|
2
|
+
import type { SplatEdit } from "./SplatEdit";
|
|
3
|
+
import { CovSplat, Dyno, DynoFloat, DynoMat3, type DynoVal, DynoVec3, DynoVec4, Gsplat } from "./dyno";
|
|
4
4
|
export type GsplatGenerator = Dyno<{
|
|
5
5
|
index: "int";
|
|
6
6
|
}, {
|
|
@@ -62,7 +62,15 @@ export interface FrameUpdateContext {
|
|
|
62
62
|
texture: THREE.DataTexture;
|
|
63
63
|
};
|
|
64
64
|
}
|
|
65
|
-
export
|
|
65
|
+
export interface SplatGeneratorEventMap extends THREE.Object3DEventMap {
|
|
66
|
+
/**
|
|
67
|
+
* Dispatched when asynchronous initialization completes and the splats are
|
|
68
|
+
* ready to render. Not dispatched for splats that are initialized on
|
|
69
|
+
* construction
|
|
70
|
+
*/
|
|
71
|
+
initialized: object;
|
|
72
|
+
}
|
|
73
|
+
export declare class SplatGenerator extends THREE.Object3D<SplatGeneratorEventMap> {
|
|
66
74
|
numSplats: number;
|
|
67
75
|
generator?: GsplatGenerator;
|
|
68
76
|
covGenerator?: CovSplatGenerator;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { FileLoader, Loader, LoadingManager } from
|
|
2
|
-
import { ExtSplats } from
|
|
3
|
-
import { PackedSplats } from
|
|
4
|
-
import { SplatMesh } from
|
|
5
|
-
import { SplatFileType } from
|
|
1
|
+
import { FileLoader, Loader, type LoadingManager } from "three";
|
|
2
|
+
import { ExtSplats } from "./ExtSplats";
|
|
3
|
+
import { PackedSplats } from "./PackedSplats";
|
|
4
|
+
import { SplatMesh } from "./SplatMesh";
|
|
5
|
+
import { SplatFileType } from "./defines";
|
|
6
6
|
export declare class SplatLoader extends Loader {
|
|
7
7
|
fileLoader: FileLoader;
|
|
8
8
|
constructor(manager?: LoadingManager);
|
|
@@ -142,23 +142,3 @@ export declare class SplatData {
|
|
|
142
142
|
setSh2(index: number, sh2: Float32Array): void;
|
|
143
143
|
setSh3(index: number, sh3: Float32Array): void;
|
|
144
144
|
}
|
|
145
|
-
export type FileInput = {
|
|
146
|
-
fileBytes: Uint8Array;
|
|
147
|
-
fileType?: SplatFileType;
|
|
148
|
-
pathOrUrl?: string;
|
|
149
|
-
transform?: {
|
|
150
|
-
translate?: number[];
|
|
151
|
-
quaternion?: number[];
|
|
152
|
-
scale?: number;
|
|
153
|
-
};
|
|
154
|
-
};
|
|
155
|
-
export type TranscodeSpzInput = {
|
|
156
|
-
inputs: FileInput[];
|
|
157
|
-
maxSh?: number;
|
|
158
|
-
clipXyz?: {
|
|
159
|
-
min: number[];
|
|
160
|
-
max: number[];
|
|
161
|
-
};
|
|
162
|
-
fractionalBits?: number;
|
|
163
|
-
opacityThreshold?: number;
|
|
164
|
-
};
|
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
import { ExtSplats } from './ExtSplats';
|
|
2
|
-
import { PackedSplats } from './PackedSplats';
|
|
3
|
-
import { RgbaArray, TRgbaArray } from './RgbaArray';
|
|
4
|
-
import { SplatEdit, SplatEdits } from './SplatEdit';
|
|
5
|
-
import { CovSplatModifier, CovSplatTransformer, FrameUpdateContext, GsplatModifier, SplatGenerator, SplatTransformer } from './SplatGenerator';
|
|
6
|
-
import { PagedSplats, SplatPager } from './SplatPager';
|
|
7
|
-
import { SplatSkinning } from './SplatSkinning';
|
|
8
|
-
import { SplatEncoding, SplatFileType } from './defines';
|
|
9
|
-
import { DynoBool, DynoFloat, DynoInt, DynoUsampler2D, DynoVal, DynoVec4, Gsplat } from './dyno';
|
|
10
1
|
import * as THREE from "three";
|
|
2
|
+
import { ExtSplats } from "./ExtSplats";
|
|
3
|
+
import { PackedSplats } from "./PackedSplats";
|
|
4
|
+
import { type RgbaArray, TRgbaArray } from "./RgbaArray";
|
|
5
|
+
import { type SplatEdit, SplatEdits } from "./SplatEdit";
|
|
6
|
+
import { type CovSplatModifier, CovSplatTransformer, type FrameUpdateContext, type GsplatModifier, SplatGenerator, SplatTransformer } from "./SplatGenerator";
|
|
7
|
+
import { PagedSplats, SplatPager } from "./SplatPager";
|
|
8
|
+
import type { SplatSkinning } from "./SplatSkinning";
|
|
9
|
+
import { type SplatEncoding, type SplatFileType } from "./defines";
|
|
10
|
+
import { DynoBool, DynoFloat, DynoInt, DynoUsampler2D, type DynoVal, DynoVec4, Gsplat } from "./dyno";
|
|
11
11
|
export type SplatMeshOptions = {
|
|
12
12
|
url?: string;
|
|
13
|
+
requestHeader?: Record<string, string>;
|
|
14
|
+
withCredentials?: boolean;
|
|
13
15
|
fileBytes?: Uint8Array | ArrayBuffer;
|
|
14
16
|
fileType?: SplatFileType;
|
|
15
17
|
fileName?: string;
|
|
@@ -35,7 +37,7 @@ export type SplatMeshOptions = {
|
|
|
35
37
|
worldModifiers?: GsplatModifier[];
|
|
36
38
|
covObjectModifiers?: CovSplatModifier[];
|
|
37
39
|
covWorldModifiers?: CovSplatModifier[];
|
|
38
|
-
splatEncoding?: SplatEncoding
|
|
40
|
+
splatEncoding?: Partial<SplatEncoding>;
|
|
39
41
|
extSplats?: boolean | ExtSplats;
|
|
40
42
|
covSplats?: boolean;
|
|
41
43
|
lod?: boolean | "quality";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { dyno } from '.';
|
|
2
|
-
import { SplatSource } from './SplatMesh';
|
|
3
|
-
import { ExtResult, PackedResult, RadMeta, SplatEncoding, SplatFileType } from './defines';
|
|
4
1
|
import * as THREE from "three";
|
|
2
|
+
import type { SplatSource } from "./SplatMesh";
|
|
3
|
+
import { type ExtResult, type PackedResult, type RadMeta, type SplatEncoding, SplatFileType } from "./defines";
|
|
4
|
+
import * as dyno from "./dyno";
|
|
5
5
|
export interface PagedSplatsOptions {
|
|
6
6
|
pager?: SplatPager;
|
|
7
7
|
rootUrl?: string;
|
|
@@ -44,7 +44,9 @@ export declare class PagedSplats implements SplatSource {
|
|
|
44
44
|
chunksStart: number;
|
|
45
45
|
}>;
|
|
46
46
|
chunkUrl(chunk: number): string;
|
|
47
|
-
fetchDecodeChunk(chunk: number): Promise<
|
|
47
|
+
fetchDecodeChunk(chunk: number): Promise<ExtResult | PackedResult>;
|
|
48
|
+
/** Draw nothing until the next update(), keeping the indices texture allocated. */
|
|
49
|
+
clear(): void;
|
|
48
50
|
update(numSplats: number, indices: Uint32Array): void;
|
|
49
51
|
prepareFetchSplat(): void;
|
|
50
52
|
getNumSplats(): number;
|
|
@@ -86,6 +88,11 @@ export interface SplatPagerOptions {
|
|
|
86
88
|
* @default 3
|
|
87
89
|
*/
|
|
88
90
|
numFetchers?: number;
|
|
91
|
+
/**
|
|
92
|
+
* Called after each chunk fetch attempt settles (success or failure);
|
|
93
|
+
* a render is needed to page in the chunk or retry.
|
|
94
|
+
*/
|
|
95
|
+
onUpdate: () => void;
|
|
89
96
|
}
|
|
90
97
|
export declare class SplatPager {
|
|
91
98
|
readonly renderer: THREE.WebGLRenderer;
|
|
@@ -97,6 +104,7 @@ export declare class SplatPager {
|
|
|
97
104
|
curSh: number;
|
|
98
105
|
autoDrive: boolean;
|
|
99
106
|
numFetchers: number;
|
|
107
|
+
onUpdate?: () => void;
|
|
100
108
|
fetchPause: number;
|
|
101
109
|
splatsChunkToPage: Map<PagedSplats, ({
|
|
102
110
|
page: number;
|
|
@@ -186,6 +194,16 @@ export declare class SplatPager {
|
|
|
186
194
|
private allocateFreeable;
|
|
187
195
|
private processFetched;
|
|
188
196
|
processUploads(): void;
|
|
197
|
+
/** True while chunk requests are in flight. */
|
|
198
|
+
isFetching(): boolean;
|
|
199
|
+
/**
|
|
200
|
+
* True while fetched chunks, uploads, or tree updates wait for Spark to
|
|
201
|
+
* consume them. Uploads already handed to Spark (flushed by its next LoD
|
|
202
|
+
* traverse via processUploads) are not counted.
|
|
203
|
+
*/
|
|
204
|
+
hasQueued(): boolean;
|
|
205
|
+
/** True while chunks are being fetched or are waiting to be paged in. */
|
|
206
|
+
isPending(): boolean;
|
|
189
207
|
consumeLodTreeUpdates(): {
|
|
190
208
|
splats: PagedSplats;
|
|
191
209
|
page: number;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { SplatMesh } from './SplatMesh';
|
|
2
|
-
import { CovSplat, DynoUniform, DynoVal, Gsplat } from './dyno';
|
|
3
1
|
import * as THREE from "three";
|
|
2
|
+
import type { SplatMesh } from "./SplatMesh";
|
|
3
|
+
import { CovSplat, DynoUniform, type DynoVal, Gsplat } from "./dyno";
|
|
4
4
|
export declare enum SplatSkinningMode {
|
|
5
5
|
DUAL_QUATERNION = "dual_quaternion",
|
|
6
6
|
LINEAR_BLEND = "linear_blend"
|
|
@@ -41,11 +41,11 @@ export declare class SplatSkinning {
|
|
|
41
41
|
setBoneMatrix(boneIndex: number, matrix: THREE.Matrix4): void;
|
|
42
42
|
setSplatBones(splatIndex: number, boneIndices: THREE.Vector4, weights: THREE.Vector4): void;
|
|
43
43
|
updateBones(): void;
|
|
44
|
-
private static UNIT_SCALE;
|
|
45
|
-
private static relQuat;
|
|
46
|
-
private static relPos;
|
|
47
|
-
private static dual;
|
|
48
|
-
private static skinMat;
|
|
44
|
+
private static readonly UNIT_SCALE;
|
|
45
|
+
private static readonly relQuat;
|
|
46
|
+
private static readonly relPos;
|
|
47
|
+
private static readonly dual;
|
|
48
|
+
private static readonly skinMat;
|
|
49
49
|
}
|
|
50
50
|
export declare const GsplatSkinning: {
|
|
51
51
|
type: "GsplatSkinning";
|