@speridlabs/visus 2.4.2 → 2.5.0

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/dist/main.d.ts CHANGED
@@ -1,5 +1,93 @@
1
1
  import * as THREE from 'three';
2
2
 
3
+ export declare class AnimationController implements AnimationState {
4
+ private _progress;
5
+ private _isPlaying;
6
+ private _isComplete;
7
+ private _startTime;
8
+ private _duration;
9
+ private _delay;
10
+ private _easing;
11
+ private _type;
12
+ private _autoPlay;
13
+ private _center;
14
+ constructor(options: AnimationOptions);
15
+ /** Current progress 0-1 (eased) */
16
+ get progress(): number;
17
+ get isPlaying(): boolean;
18
+ get isComplete(): boolean;
19
+ get type(): AnimationType;
20
+ get center(): THREE.Vector3;
21
+ /** Set the animation center point (typically bounding box center) */
22
+ setCenter(center: THREE.Vector3): void;
23
+ play(): void;
24
+ stop(): void;
25
+ reset(): void;
26
+ /** Skip to end state */
27
+ complete(): void;
28
+ /** Called from onBeforeRender - returns true if uniforms need update */
29
+ update(currentTime: number): boolean;
30
+ /** Should auto-play be triggered on load? */
31
+ shouldAutoPlay(): boolean;
32
+ }
33
+
34
+ /**
35
+ * Animation effect definition - SELF-CONTAINED
36
+ *
37
+ * Each effect provides its own GLSL code implementing the standard
38
+ * `applyAnimation` function signature. This code gets injected into
39
+ * the vertex shader template.
40
+ */
41
+ declare interface AnimationEffect_2 {
42
+ type: AnimationType;
43
+ defaultDuration: number;
44
+ /**
45
+ * GLSL code defining the applyAnimation function.
46
+ *
47
+ * MUST implement this exact signature:
48
+ * ```glsl
49
+ * void applyAnimation(
50
+ * inout vec3 position,
51
+ * inout vec3 scale,
52
+ * inout vec4 color,
53
+ * float progress,
54
+ * vec3 center
55
+ * )
56
+ * ```
57
+ *
58
+ * - position: splat center in model space
59
+ * - scale: splat scales in LOG SPACE (exp() applied AFTER animation)
60
+ * - color: RGBA color
61
+ * - progress: animation progress 0-1 (already eased)
62
+ * - center: bounding box center point
63
+ *
64
+ * **IMPORTANT**: `SplatMaterial.setAnimation()` injects a guard
65
+ * `if (animationProgress < 1.0)` around the call to `applyAnimation()`,
66
+ * so effect code will NEVER run at exactly `progress == 1.0`.
67
+ * Effects should be designed such that they converge to a no-op state
68
+ * as progress approaches 1.0 (e.g., all splats fully revealed, no
69
+ * additional transformations applied).
70
+ */
71
+ shaderCode: string;
72
+ }
73
+ export { AnimationEffect_2 as AnimationEffect }
74
+
75
+ export declare interface AnimationOptions {
76
+ delay?: number;
77
+ duration?: number;
78
+ autoPlay?: boolean;
79
+ easing?: EasingType;
80
+ type: AnimationType;
81
+ }
82
+
83
+ export declare interface AnimationState {
84
+ readonly progress: number;
85
+ readonly isPlaying: boolean;
86
+ readonly isComplete: boolean;
87
+ }
88
+
89
+ export declare type AnimationType = 'spread' | 'wave' | 'none';
90
+
3
91
  /**
4
92
  * Simplified bounding box class that tracks min/max points
5
93
  */
@@ -45,6 +133,10 @@ export declare class BoundingBox {
45
133
  clone(): BoundingBox;
46
134
  }
47
135
 
136
+ export declare type EasingType = 'linear' | 'easeInQuad' | 'easeOutQuad' | 'easeInOutQuad' | 'easeInCubic' | 'easeOutCubic' | 'easeInOutCubic' | 'easeOutExpo';
137
+
138
+ export declare const getEffect: (type: AnimationType) => AnimationEffect_2;
139
+
48
140
  /**
49
141
  * Class for loading PLY files with Gaussian Splat data
50
142
  */
@@ -52,7 +144,7 @@ export declare class PlyLoader extends THREE.Loader {
52
144
  private requestId;
53
145
  private worker;
54
146
  private pendingCallbacks;
55
- constructor(manager?: THREE.LoadingManager);
147
+ constructor(manager?: THREE.LoadingManager, options?: PlyLoaderOptions);
56
148
  /**
57
149
  * Handles messages received from the parsing worker
58
150
  * @param event The message event from the worker
@@ -90,11 +182,15 @@ export declare class PlyLoader extends THREE.Loader {
90
182
  private createWorkerCode;
91
183
  }
92
184
 
185
+ export declare interface PlyLoaderOptions {
186
+ withCredentials?: boolean;
187
+ }
188
+
93
189
  /**
94
190
  * Class for loading SOGS (Self Organizing Gaussians) files
95
191
  */
96
192
  export declare class SogsLoader extends THREE.Loader {
97
- constructor(manager?: THREE.LoadingManager);
193
+ constructor(manager?: THREE.LoadingManager, options?: SogsLoaderOptions);
98
194
  /**
99
195
  * Detect if a buffer is a ZIP file by checking magic bytes
100
196
  * ZIP files start with signature: PK\x03\x04 (0x50 0x4B 0x03 0x04)
@@ -120,6 +216,10 @@ export declare class SogsLoader extends THREE.Loader {
120
216
  private parseZipAsync;
121
217
  }
122
218
 
219
+ export declare interface SogsLoaderOptions {
220
+ withCredentials?: boolean;
221
+ }
222
+
123
223
  export declare class SplatData {
124
224
  numSplats: number;
125
225
  textureWidth: number;
@@ -139,6 +239,7 @@ export declare class SplatData {
139
239
 
140
240
  export declare class SplatMaterial extends THREE.ShaderMaterial {
141
241
  constructor(options?: SplatMaterialOptions);
242
+ private _shaderTemplate;
142
243
  setTexWidth(w: number): void;
143
244
  /**
144
245
  * Update the viewport size
@@ -167,6 +268,19 @@ export declare class SplatMaterial extends THREE.ShaderMaterial {
167
268
  * @param count Number of splats
168
269
  */
169
270
  setNumSplats(count: number): void;
271
+ /**
272
+ * Configure animation effect. Rebuilds shader with effect's GLSL code.
273
+ * @param effect - Animation effect to use (null to disable)
274
+ */
275
+ setAnimation(effect: AnimationEffect_2 | null): void;
276
+ /**
277
+ * Set animation progress (0 = start, 1 = complete/no animation)
278
+ */
279
+ setAnimationProgress(progress: number): void;
280
+ /**
281
+ * Set animation center point
282
+ */
283
+ setAnimationCenter(center: THREE.Vector3): void;
170
284
  }
171
285
 
172
286
  export declare interface SplatMaterialOptions {
@@ -184,6 +298,8 @@ export declare class SplatMesh extends THREE.Mesh {
184
298
  options: SplatMeshOptions;
185
299
  splatData: SplatData | null;
186
300
  textureManager: TextureManager;
301
+ /** Animation controller (null if no animation configured) */
302
+ animation: AnimationController | null;
187
303
  material: SplatMaterial;
188
304
  geometry: THREE.InstancedBufferGeometry;
189
305
  private lastCameraPositionLocal;
@@ -245,6 +361,8 @@ export declare class SplatMesh extends THREE.Mesh {
245
361
  export declare interface SplatMeshOptions extends SplatMaterialOptions {
246
362
  autoSort?: boolean;
247
363
  keepSplatData?: boolean;
364
+ /** Animation configuration */
365
+ animation?: AnimationOptions;
248
366
  }
249
367
 
250
368
  declare interface SplatRanges {