illutions 0.34.0 → 0.35.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/CHANGELOG.md +34 -0
- package/dist/main.d.ts +717 -291
- package/dist/main.min.cjs +1 -1
- package/dist/main.min.js +1 -1
- package/package.json +1 -1
package/dist/main.d.ts
CHANGED
|
@@ -19,7 +19,10 @@ export declare interface AaCfg {
|
|
|
19
19
|
guiOpened: boolean;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
/**
|
|
22
|
+
/**
|
|
23
|
+
* Anti-aliasing modes available across rendering backends; 'none' disables smoothing.
|
|
24
|
+
* See {@link AaModeWebGl} and {@link AaModeWebGpu} for backend-specific values.
|
|
25
|
+
*/
|
|
23
26
|
export declare type AaMode = AaModeWebGl | AaModeWebGpu;
|
|
24
27
|
|
|
25
28
|
/** Anti-aliasing modes available with WebGL. */
|
|
@@ -28,8 +31,6 @@ export declare type AaModeWebGl = 'none' | 'fxaa' | 'smaa';
|
|
|
28
31
|
/** Anti-aliasing modes available with WebGPU. */
|
|
29
32
|
export declare type AaModeWebGpu = 'none' | 'fxaa' | 'smaa' | 'traa';
|
|
30
33
|
|
|
31
|
-
export declare type ActionFadeMode = 'in' | 'out';
|
|
32
|
-
|
|
33
34
|
/**
|
|
34
35
|
* Controls uniform ambient illumination.
|
|
35
36
|
* @category Cfg
|
|
@@ -54,6 +55,7 @@ export declare interface AmbientlightCfg {
|
|
|
54
55
|
|
|
55
56
|
/** @event Fired when an object or material color animation starts, completes, or is canceled. */
|
|
56
57
|
export declare interface AnimEvent {
|
|
58
|
+
/** Event identifier used to select listeners and state machine transitions. */
|
|
57
59
|
type: 'Anim_Complete' | 'Anim_Start' | 'Anim_Cancel';
|
|
58
60
|
/** The name of the `THREE.Object3D` whose animation changed state. */
|
|
59
61
|
objName: string;
|
|
@@ -63,6 +65,7 @@ export declare interface AnimEvent {
|
|
|
63
65
|
|
|
64
66
|
/** @event Fired when a material color or numeric property animation starts, completes, or is canceled. */
|
|
65
67
|
export declare interface AnimMaterialEvent {
|
|
68
|
+
/** Event identifier used to select listeners and state machine transitions. */
|
|
66
69
|
type: 'Anim_Material_Complete' | 'Anim_Material_Start' | 'Anim_Material_Cancel';
|
|
67
70
|
/** The name of the material whose animation changed state. */
|
|
68
71
|
materialName: string;
|
|
@@ -72,31 +75,94 @@ export declare interface AnimMaterialEvent {
|
|
|
72
75
|
values: Record<string, number | string>;
|
|
73
76
|
}
|
|
74
77
|
|
|
78
|
+
/** Target object, orientation, and animation settings shared by rotation methods. */
|
|
79
|
+
declare interface AnimRotOptions {
|
|
80
|
+
/** Exact Three.js object name, including cameras. */
|
|
81
|
+
obj: string;
|
|
82
|
+
/** Target X angle in radians; omitted axes keep their starting target angles. */
|
|
83
|
+
x?: number;
|
|
84
|
+
/** Target Y angle in radians. */
|
|
85
|
+
y?: number;
|
|
86
|
+
/** Target Z angle in radians. */
|
|
87
|
+
z?: number;
|
|
88
|
+
/** Rotation interpolation. Default: **'euler'**; **'quat'** takes the shortest orientation path. */
|
|
89
|
+
path?: 'euler' | 'quat';
|
|
90
|
+
/** Euler order for interpreting angles in both paths. Default: **'XYZ'** */
|
|
91
|
+
order?: THREE_TYPE.EulerOrder;
|
|
92
|
+
/** Orientation space. Default: **'parent'** */
|
|
93
|
+
space?: 'parent' | 'world';
|
|
94
|
+
/** Duration in seconds. Default: **1**. A value of 0 applies the values immediately. */
|
|
95
|
+
time?: number;
|
|
96
|
+
/** GSAP easing function. Default: **'power2.inOut'** */
|
|
97
|
+
ease?: string;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/** Target object, scale, and animation settings shared by scaling methods. */
|
|
101
|
+
declare interface AnimScaleOptions {
|
|
102
|
+
/** Exact Three.js object name, including cameras. */
|
|
103
|
+
obj: string;
|
|
104
|
+
/** Target X scale; omitted axes remain unchanged. */
|
|
105
|
+
x?: number;
|
|
106
|
+
/** Target Y scale. */
|
|
107
|
+
y?: number;
|
|
108
|
+
/** Target Z scale. */
|
|
109
|
+
z?: number;
|
|
110
|
+
/** Duration in seconds. Default: **1**. A value of 0 applies the values immediately. */
|
|
111
|
+
time?: number;
|
|
112
|
+
/** GSAP easing function. Default: **'power2.inOut'** */
|
|
113
|
+
ease?: string;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/** Target object, position, and animation settings shared by translation methods. */
|
|
117
|
+
declare interface AnimTranslOptions {
|
|
118
|
+
/** Exact Three.js object name, including cameras. */
|
|
119
|
+
obj: string;
|
|
120
|
+
/** Target X position; omitted axes keep their starting values. */
|
|
121
|
+
x?: number;
|
|
122
|
+
/** Target Y position. */
|
|
123
|
+
y?: number;
|
|
124
|
+
/** Target Z position. */
|
|
125
|
+
z?: number;
|
|
126
|
+
/** Position space. Default: **'parent'** */
|
|
127
|
+
space?: 'parent' | 'world';
|
|
128
|
+
/** Duration in seconds. Default: **1**. A value of 0 applies the values immediately. */
|
|
129
|
+
time?: number;
|
|
130
|
+
/** GSAP easing function. Default: **'power2.inOut'** */
|
|
131
|
+
ease?: string;
|
|
132
|
+
}
|
|
133
|
+
|
|
75
134
|
/**
|
|
76
135
|
* Starts the application and provides access to its components and runtime systems.
|
|
77
136
|
* @category Core
|
|
78
137
|
*/
|
|
79
|
-
export declare class App<
|
|
138
|
+
export declare class App<TAssets extends Assets = {}> {
|
|
139
|
+
/** Controls loaded sounds by their case-sensitive names and provides shared listener and positional settings. */
|
|
80
140
|
readonly audio: Audio_2;
|
|
141
|
+
/** Controls any loaded model clip by name, without requiring asset registration. */
|
|
142
|
+
readonly clips: Clips;
|
|
81
143
|
private readonly ctrl;
|
|
82
144
|
readonly engine: Engine;
|
|
83
|
-
private readonly model;
|
|
84
145
|
readonly envCtrls: EnvCtrls;
|
|
85
146
|
readonly events: Events;
|
|
86
|
-
readonly orbitCtrls: OrbitCtrls;
|
|
87
147
|
readonly fpvCtrls: FpvCtrls;
|
|
148
|
+
private readonly model;
|
|
149
|
+
readonly orbitCtrls: OrbitCtrls;
|
|
88
150
|
readonly raycast: Raycast;
|
|
89
151
|
readonly scene: Scene;
|
|
90
152
|
readonly stateMachine: StateMachine;
|
|
91
153
|
private readonly webCtrls;
|
|
92
154
|
private cam3D;
|
|
93
|
-
|
|
155
|
+
/** Registered Clip instances keyed as in assets.clips. Their obj remains null until model animation assignment. */
|
|
156
|
+
readonly clip: ClipsInsts<TAssets>;
|
|
157
|
+
/** Registered Sound instances keyed as in assets.sounds. Call load() or loadAndStart() to load their sources. */
|
|
158
|
+
readonly sound: SoundsInsts<TAssets>;
|
|
159
|
+
readonly comps: CompsInsts<TAssets>;
|
|
94
160
|
private objs3DMap;
|
|
95
161
|
private websMap;
|
|
96
162
|
/**
|
|
97
163
|
* Starts the application, loads the initial scene resources, and connects components and the optional state machine. Startup errors are caught and logged.
|
|
98
164
|
* @param cfg - Startup settings. Defaults to the exported `cfg`.
|
|
99
|
-
* @param
|
|
165
|
+
* @param assets - Scene Component, Web Component, Clip, and Sound class registrations with optional parameters. Default: **empty object**
|
|
100
166
|
* @param createStateMachine - Factory function that receives the fully created `App` instance and returns a state machine.
|
|
101
167
|
*
|
|
102
168
|
* @returns Resolves after startup completes or a startup error is caught.
|
|
@@ -104,11 +170,35 @@ export declare class App<TComps extends Comps = {}> {
|
|
|
104
170
|
* **Example**
|
|
105
171
|
* {@includeCode ../../../apps-doc/examples/app-run.ts}
|
|
106
172
|
*/
|
|
107
|
-
static run<
|
|
173
|
+
static run<TAssets extends Assets = {}>(cfg?: Cfg, assets?: TAssets, createStateMachine?: (app: App<TAssets>) => AnyStateMachine): Promise<void>;
|
|
108
174
|
}
|
|
109
175
|
|
|
110
176
|
/**
|
|
111
|
-
*
|
|
177
|
+
* Groups the optional scene components, web components, animation clips, and sounds used by the app.
|
|
178
|
+
*
|
|
179
|
+
* @typeParam TScene - Record of named scene component classes or entries with initial parameters.
|
|
180
|
+
* @typeParam TWeb - Record of named web component classes or entries with initial parameters.
|
|
181
|
+
* @typeParam TClips - Record of named clip classes or entries with initial parameters.
|
|
182
|
+
* @typeParam TSounds - Record of named sound classes or entries with initial loading defaults.
|
|
183
|
+
*
|
|
184
|
+
* @example
|
|
185
|
+
* type MyAssets = Assets<{ cube: typeof Cube }, { marker: typeof Marker }>;
|
|
186
|
+
*/
|
|
187
|
+
export declare type Assets<TScene extends Record<string, SceneEntry> = {}, TWeb extends Record<string, WebEntry> = {}, TClips extends Record<string, ClipEntry> = {}, TSounds extends Record<string, SoundEntry> = {}> = {
|
|
188
|
+
/** Clip classes or entries keyed by application name. Model names default to these keys; see {@link ClipParams}. */
|
|
189
|
+
clips?: TClips;
|
|
190
|
+
/** Sound classes or entries keyed by application name. Registration does not load audio; see {@link SoundInstParams}. */
|
|
191
|
+
sounds?: TSounds;
|
|
192
|
+
/** Scene component definitions keyed by registration name. */
|
|
193
|
+
scene?: TScene;
|
|
194
|
+
/** Web component definitions keyed by registration name. */
|
|
195
|
+
web?: TWeb;
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* Loads and controls global and positional audio by case-sensitive sound name.
|
|
200
|
+
* Use App.sound for registered Sound instances with the same playback behavior.
|
|
201
|
+
* Set a listener before loading. Events are sent to the application before registered sound listeners.
|
|
112
202
|
* @category Core
|
|
113
203
|
*/
|
|
114
204
|
declare class Audio_2 {
|
|
@@ -118,78 +208,75 @@ declare class Audio_2 {
|
|
|
118
208
|
private readonly events;
|
|
119
209
|
private readonly params;
|
|
120
210
|
private readonly scene;
|
|
121
|
-
private readonly
|
|
211
|
+
private readonly soundActions;
|
|
212
|
+
private readonly soundInsts;
|
|
122
213
|
private attachSoundTo;
|
|
123
|
-
|
|
214
|
+
/**
|
|
215
|
+
* Changes volume, playback speed, and loop on a loaded sound. Spatial overrides are load-time options.
|
|
216
|
+
* A paused sound continues at its current position. Omitted settings remain unchanged.
|
|
217
|
+
* The optional fade transitions volume and speed together; loop changes immediately.
|
|
218
|
+
* Replaces the current transition and pending pause or stop. Does not start a stopped or finished sound.
|
|
219
|
+
* @inlineType SoundChangeOptions
|
|
220
|
+
* @param params - Sound settings to change; see {@link SoundTween} for transition settings.
|
|
221
|
+
*/
|
|
222
|
+
change({ name, volume, speed, loop, fade }: SoundChangeOptions): void;
|
|
124
223
|
/**
|
|
125
224
|
* Returns the shared positional sound defaults.
|
|
126
225
|
*/
|
|
127
226
|
get(): SoundParamsPos;
|
|
227
|
+
private emitEvent;
|
|
228
|
+
private getSound;
|
|
128
229
|
/**
|
|
129
230
|
* Checks whether a named sound is loaded.
|
|
130
231
|
* @param params - Sound selection.
|
|
131
|
-
* @param params.name - Sound name.
|
|
132
232
|
*/
|
|
133
233
|
isLoaded({ name }: {
|
|
134
234
|
name: string;
|
|
135
235
|
}): boolean;
|
|
136
236
|
/**
|
|
137
|
-
* Checks whether a named sound
|
|
237
|
+
* Checks whether a named sound has the playing state. Paused sounds return false; change({ speed: 0 }) alone does not pause the state.
|
|
138
238
|
* @param params - Sound selection.
|
|
139
|
-
* @param params.name - Sound name.
|
|
140
239
|
*/
|
|
141
240
|
isPlaying({ name }: {
|
|
142
241
|
name: string;
|
|
143
242
|
}): boolean;
|
|
144
243
|
private loadSound;
|
|
145
244
|
/**
|
|
146
|
-
* Loads an audio file without playing it
|
|
245
|
+
* Loads an audio file without playing it. For a registered Sound, assigns obj and calls onReady() before Audio_Loaded.
|
|
246
|
+
* Per-sound positional overrides are applied at load time; omitted settings inherit the shared defaults.
|
|
247
|
+
* @inlineType SoundParams
|
|
147
248
|
* @param params - The sound options.
|
|
148
249
|
*/
|
|
149
250
|
load(params: SoundParams): void;
|
|
150
251
|
/**
|
|
151
252
|
* Loads an audio file and plays it automatically when loading is complete.
|
|
152
|
-
*
|
|
253
|
+
* Calls a registered Sound.onReady(), then sends Audio_Loaded before automatic playback.
|
|
254
|
+
* A playback or change() call in either handler supersedes the automatic start.
|
|
255
|
+
* Resumes the audio context and waits for the configured delayLoadSound before loading.
|
|
256
|
+
* @inlineType SoundLoadAndStartOptions
|
|
153
257
|
* @param params - The sound options.
|
|
154
|
-
* @param params.time - Fade-in duration for this start in seconds. Defaults to 0 (no fade).
|
|
155
|
-
* @param params.ease - GSAP easing for the fade-in. Defaults to linear ('none').
|
|
156
258
|
*/
|
|
157
|
-
|
|
158
|
-
time?: number;
|
|
159
|
-
ease?: string;
|
|
160
|
-
} & SoundParams): void;
|
|
259
|
+
loadAndStart({ time, ease, ...params }: SoundLoadAndStartOptions): void;
|
|
161
260
|
/**
|
|
162
|
-
*
|
|
163
|
-
*
|
|
164
|
-
*
|
|
165
|
-
* @param params - Sound selection.
|
|
166
|
-
* @param params.name - Loaded sound name.
|
|
167
|
-
* @param params.time - Fade-in duration in seconds. Defaults to 0 (no fade).
|
|
168
|
-
* @param params.ease - GSAP easing for the fade-in. Defaults to linear ('none').
|
|
261
|
+
* Fades a sound out, then holds its position by setting playback speed to zero.
|
|
262
|
+
* @inlineType SoundPauseOptions
|
|
263
|
+
* @param params - Sound name and optional fade-out settings; see {@link SoundTween}.
|
|
169
264
|
*/
|
|
170
|
-
|
|
171
|
-
name: string;
|
|
172
|
-
time?: number;
|
|
173
|
-
ease?: string;
|
|
174
|
-
}): void;
|
|
265
|
+
pause({ name, fadeOut }: SoundPauseOptions): void;
|
|
175
266
|
/**
|
|
176
|
-
*
|
|
177
|
-
* @
|
|
178
|
-
* @param params
|
|
179
|
-
* @param params.time - Fade-out duration in seconds. Defaults to 0 (no fade).
|
|
180
|
-
* @param params.ease - GSAP easing for the fade-out. Defaults to linear ('none').
|
|
267
|
+
* Continues a paused sound at its retained position and speed, optionally fading in.
|
|
268
|
+
* @inlineType SoundResumeOptions
|
|
269
|
+
* @param params - Sound name and optional fade-in settings; see {@link SoundTween}.
|
|
181
270
|
*/
|
|
182
|
-
|
|
183
|
-
name: string;
|
|
184
|
-
time?: number;
|
|
185
|
-
ease?: string;
|
|
186
|
-
}): void;
|
|
271
|
+
resume({ name, fadeIn }: SoundResumeOptions): void;
|
|
187
272
|
/**
|
|
188
|
-
* Resumes the Web Audio context after a user gesture.
|
|
273
|
+
* Resumes the Web Audio context after a user gesture without resuming an individually paused sound.
|
|
189
274
|
*/
|
|
190
|
-
|
|
275
|
+
resumeContext(): void;
|
|
276
|
+
private runSound;
|
|
191
277
|
/**
|
|
192
278
|
* Updates shared positional defaults without replacing individual sound overrides.
|
|
279
|
+
* @inlineType SoundParamsPos
|
|
193
280
|
* @param params - Positional defaults to update; omitted values remain unchanged.
|
|
194
281
|
*/
|
|
195
282
|
set(params: Partial<SoundParamsPos>): void;
|
|
@@ -203,28 +290,21 @@ declare class Audio_2 {
|
|
|
203
290
|
setListener({ obj }: {
|
|
204
291
|
obj: string | Cam3D;
|
|
205
292
|
}): void;
|
|
293
|
+
private setSoundParamsPositional;
|
|
206
294
|
/**
|
|
207
|
-
*
|
|
208
|
-
*
|
|
209
|
-
* @
|
|
295
|
+
* Starts a loaded sound from the beginning, replacing its previous playback and transitions.
|
|
296
|
+
* When using load(), call this after the matching Audio_Loaded event.
|
|
297
|
+
* @inlineType SoundStartOptions
|
|
298
|
+
* @param params - Sound name and optional fade-in time/ease. The default is immediate.
|
|
210
299
|
*/
|
|
211
|
-
|
|
212
|
-
name: string;
|
|
213
|
-
volume?: number;
|
|
214
|
-
} & Partial<SoundParamsPos>): void;
|
|
215
|
-
private setSoundParamsPos;
|
|
300
|
+
start({ name, time, ease }: SoundStartOptions): void;
|
|
216
301
|
/**
|
|
217
|
-
* Stops a
|
|
218
|
-
* @
|
|
219
|
-
* @param params
|
|
220
|
-
* @param params.time - Fade-out duration in seconds. Defaults to 0 (no fade).
|
|
221
|
-
* @param params.ease - GSAP easing for the fade-out. Defaults to linear ('none').
|
|
302
|
+
* Stops a sound and resets its position, optionally fading out first.
|
|
303
|
+
* @inlineType SoundStopOptions
|
|
304
|
+
* @param params - Sound name and optional fade-out time/ease. The default is immediate.
|
|
222
305
|
*/
|
|
223
|
-
stop({ name, time, ease }:
|
|
224
|
-
|
|
225
|
-
time?: number;
|
|
226
|
-
ease?: string;
|
|
227
|
-
}): void;
|
|
306
|
+
stop({ name, time, ease }: SoundStopOptions): void;
|
|
307
|
+
private tweenSound;
|
|
228
308
|
/**
|
|
229
309
|
* Runs an extension callback immediately with access to the public API.
|
|
230
310
|
* @param extension - Callback receiving this `Audio` instance.
|
|
@@ -255,9 +335,10 @@ export declare interface AudioCfg extends SoundParamsPos {
|
|
|
255
335
|
delayLoadSound: number;
|
|
256
336
|
}
|
|
257
337
|
|
|
258
|
-
/** @event Fired when a sound finishes loading, starts
|
|
338
|
+
/** @event Fired when a sound finishes loading, starts, pauses, resumes, finishes naturally, or is stopped. */
|
|
259
339
|
export declare interface AudioEvent {
|
|
260
|
-
|
|
340
|
+
/** Event identifier used to select listeners and state machine transitions. */
|
|
341
|
+
type: 'Audio_Loaded' | 'Audio_Start' | 'Audio_Finished' | 'Audio_Stop' | 'Audio_Pause' | 'Audio_Resume';
|
|
261
342
|
/** The unique name assigned to the sound. */
|
|
262
343
|
soundName: string;
|
|
263
344
|
}
|
|
@@ -318,8 +399,11 @@ export declare interface CamBaseCfg {
|
|
|
318
399
|
* @default { x: 0, y: 0, z: 0 }
|
|
319
400
|
*/
|
|
320
401
|
lookAt: {
|
|
402
|
+
/** X coordinate in scene units. */
|
|
321
403
|
x: number;
|
|
404
|
+
/** Y coordinate in scene units. */
|
|
322
405
|
y: number;
|
|
406
|
+
/** Z coordinate in scene units. */
|
|
323
407
|
z: number;
|
|
324
408
|
};
|
|
325
409
|
/**
|
|
@@ -327,8 +411,11 @@ export declare interface CamBaseCfg {
|
|
|
327
411
|
* @default { x: 0, y: 0.5, z: 0.5 }
|
|
328
412
|
*/
|
|
329
413
|
position: {
|
|
414
|
+
/** X coordinate in scene units. */
|
|
330
415
|
x: number;
|
|
416
|
+
/** Y coordinate in scene units. */
|
|
331
417
|
y: number;
|
|
418
|
+
/** Z coordinate in scene units. */
|
|
332
419
|
z: number;
|
|
333
420
|
};
|
|
334
421
|
}
|
|
@@ -390,6 +477,7 @@ export declare interface CamPerspectiveCfg {
|
|
|
390
477
|
|
|
391
478
|
/** @event Fired when a key is pressed or released while the canvas has focus. */
|
|
392
479
|
export declare interface CanvasKeyEvent {
|
|
480
|
+
/** Event identifier used to select listeners and state machine transitions. */
|
|
393
481
|
type: 'Canvas_Key_Down' | 'Canvas_Key_Up';
|
|
394
482
|
/** Native keyboard event from the canvas interaction. */
|
|
395
483
|
event: KeyboardEvent;
|
|
@@ -397,6 +485,7 @@ export declare interface CanvasKeyEvent {
|
|
|
397
485
|
|
|
398
486
|
/** @event Fired when the pointer clicks, enters, or leaves the canvas. */
|
|
399
487
|
export declare interface CanvasPointerEvent {
|
|
488
|
+
/** Event identifier used to select listeners and state machine transitions. */
|
|
400
489
|
type: 'Canvas_Click' | 'Canvas_Pointer_Enter' | 'Canvas_Pointer_Leave';
|
|
401
490
|
/** Native pointer event from the canvas interaction. */
|
|
402
491
|
event: PointerEvent;
|
|
@@ -446,22 +535,301 @@ export declare const cfg: Cfg;
|
|
|
446
535
|
|
|
447
536
|
/** Configuration values accepted by `setCfg`. */
|
|
448
537
|
export declare type CfgSet = DeepPartial<Cfg> & {
|
|
538
|
+
/** Partial rendering settings. See {@link RenderCfg}. */
|
|
449
539
|
render?: DeepPartial<RenderCfg> & {
|
|
540
|
+
/** Rendering profiles restricted to compatible effect combinations. See {@link RenderProfileValidCfg}. */
|
|
450
541
|
profile?: RenderProfileValidCfg;
|
|
451
542
|
};
|
|
452
543
|
};
|
|
453
544
|
|
|
454
|
-
/**
|
|
545
|
+
/**
|
|
546
|
+
* Provides playback controls and listeners for a model animation registered in assets.clips.
|
|
547
|
+
* Extend this class to add custom behavior. Instances are exposed through App.clip.
|
|
548
|
+
* Playback controls have no effect until obj is assigned. Listeners can be registered before readiness and remain registered across restarts.
|
|
549
|
+
* @category Core
|
|
550
|
+
*/
|
|
551
|
+
export declare class Clip {
|
|
552
|
+
private clips;
|
|
553
|
+
private readonly params;
|
|
554
|
+
/** The matched Three.js animation clip. Null until assigned before onReady() and Scene_Ready. */
|
|
555
|
+
obj: THREE_TYPE.AnimationClip | null;
|
|
556
|
+
/**
|
|
557
|
+
* Subscribes to an event from this clip.
|
|
558
|
+
* @returns A function that unsubscribes the listener.
|
|
559
|
+
*/
|
|
560
|
+
addEventListener<TType extends ClipEvent['type']>(type: TType, listener: (event: ClipEvent & {
|
|
561
|
+
type: TType;
|
|
562
|
+
}) => void): Unsubscribe;
|
|
563
|
+
/**
|
|
564
|
+
* Changes only the supplied settings of an active clip, preserving its position and markers.
|
|
565
|
+
* @inlineType ClipInstChangeOptions
|
|
566
|
+
* @param params - Optional loop, reverse, fade, and speed settings.
|
|
567
|
+
*
|
|
568
|
+
* @remarks
|
|
569
|
+
* A speed target of zero holds playback. A later speed update continues at the same position.
|
|
570
|
+
* Loop counts include completed repetitions, as in Three.js. See {@link ClipEvent}.
|
|
571
|
+
*/
|
|
572
|
+
change(params?: ClipInstChangeOptions): void;
|
|
573
|
+
/**
|
|
574
|
+
* Reduces playback speed to zero while retaining the clip's position and weight.
|
|
575
|
+
* @inlineType ClipInstPauseOptions
|
|
576
|
+
* @param params - Optional speed transition settings.
|
|
577
|
+
*/
|
|
578
|
+
pause(params?: ClipInstPauseOptions): void;
|
|
579
|
+
/** Unsubscribes a listener from this clip. */
|
|
580
|
+
removeEventListener<TType extends ClipEvent['type']>(type: TType, listener: (event: ClipEvent & {
|
|
581
|
+
type: TType;
|
|
582
|
+
}) => void): void;
|
|
583
|
+
/**
|
|
584
|
+
* Continues playback towards the speed retained when pause() was called.
|
|
585
|
+
* @inlineType ClipInstResumeOptions
|
|
586
|
+
* @param params - Optional speed transition settings.
|
|
587
|
+
*/
|
|
588
|
+
resume(params?: ClipInstResumeOptions): void;
|
|
589
|
+
/**
|
|
590
|
+
* Plays this clip, optionally fading in, changing speed, or replacing selected clips.
|
|
591
|
+
* @inlineType ClipInstStartOptions
|
|
592
|
+
* @param params - Clip playback settings.
|
|
593
|
+
*
|
|
594
|
+
* @remarks
|
|
595
|
+
* A new call restarts playback and replaces the previous settings and markers. Use change() to change an active clip.
|
|
596
|
+
* Finite clips hold their final pose and emit Clip_Finished. Crossfades share the fadeIn duration.
|
|
597
|
+
* See {@link ClipEvent}.
|
|
598
|
+
*/
|
|
599
|
+
start(params?: ClipInstStartOptions): void;
|
|
600
|
+
/**
|
|
601
|
+
* Stops this clip after its optional fade-out and speed-out transitions.
|
|
602
|
+
* @inlineType ClipInstStopOptions
|
|
603
|
+
* @param params - Outgoing transitions and clips to crossfade in.
|
|
604
|
+
*
|
|
605
|
+
* @remarks
|
|
606
|
+
* Crossfades share the fadeOut duration. Stopping does not wait for a loop boundary.
|
|
607
|
+
* Replaced transitions do not emit completion events. See {@link ClipEvent}.
|
|
608
|
+
*/
|
|
609
|
+
stop(params?: ClipInstStopOptions): void;
|
|
610
|
+
/** Called after the loaded animation clip and its controls are assigned, before Scene_Ready. */
|
|
611
|
+
protected onReady(): void;
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
/** Optional loop, reverse, fade, and speed settings. */
|
|
615
|
+
declare interface ClipChangeOptions {
|
|
616
|
+
/** Model animation clip name, matched without regard to case. */
|
|
617
|
+
clip: string;
|
|
618
|
+
/** The layer assigned when playback started. Default: **null**, selecting only clips in the shared unnamed layer. */
|
|
619
|
+
layer?: string | null;
|
|
620
|
+
/** Loop setting. See {@link LoopMode}. Omitted: unchanged. */
|
|
621
|
+
modeLoop?: LoopMode;
|
|
622
|
+
/** Playback direction without changing the clip position. Omitted: unchanged. Without speed, changes direction immediately; supply speed.time for a gradual change. */
|
|
623
|
+
reverse?: boolean;
|
|
624
|
+
/** Changes the active clip's blend weight. See {@link ClipTween}. Default `to`: **1**. Omitted: unchanged. */
|
|
625
|
+
fade?: ClipTween;
|
|
626
|
+
/** Changes playback speed. See {@link ClipTween}. Default `to`: **1**. Omitted: unchanged. */
|
|
627
|
+
speed?: ClipTween;
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
/** Clip classes available for registration. */
|
|
631
|
+
export declare type ClipClass = new (name: string, params?: ClipParams) => Clip;
|
|
632
|
+
|
|
633
|
+
/** Clip class with optional initial parameters. */
|
|
634
|
+
export declare type ClipEntry<TClass extends ClipClass = ClipClass> = TClass | {
|
|
635
|
+
/** Clip class to instantiate. */
|
|
636
|
+
class: TClass;
|
|
637
|
+
/** Model animation selection and basic playback defaults. */
|
|
638
|
+
params?: ClipParams;
|
|
639
|
+
};
|
|
640
|
+
|
|
641
|
+
/** @event Fired when clip playback, weight fading, or speed changes start or complete, or when playback is paused, resumed, or stopped. */
|
|
455
642
|
export declare interface ClipEvent {
|
|
456
|
-
|
|
643
|
+
/** Event identifier used to select listeners and state machine transitions. */
|
|
644
|
+
type: 'Clip_Start' | 'Clip_Finished' | 'Clip_Stop' | 'Clip_Pause' | 'Clip_Resume' | 'Clip_Fade_Start' | 'Clip_Fade_Complete' | 'Clip_Speed_Start' | 'Clip_Speed_Complete' | 'Clip_Loop' | 'Clip_Marker';
|
|
457
645
|
/** The name of the affected `THREE.AnimationClip`. */
|
|
458
646
|
clipName: string;
|
|
459
647
|
/** The associated animation action, when available. */
|
|
460
648
|
action?: THREE_TYPE.AnimationAction;
|
|
461
649
|
/** Whether the clip weight is fading in or out. */
|
|
462
|
-
fadeMode?:
|
|
650
|
+
fadeMode?: 'in' | 'out';
|
|
651
|
+
/** Completed loops for Clip_Loop, or the current one-based loop for Clip_Marker. */
|
|
652
|
+
loopCount?: number;
|
|
653
|
+
/** The name of the crossed marker. */
|
|
654
|
+
markerName?: string;
|
|
463
655
|
}
|
|
464
656
|
|
|
657
|
+
/** Settings for Clip.change(); the instance selects the model clip. */
|
|
658
|
+
declare type ClipInstChangeOptions = Omit<ClipChangeOptions, 'clip'>;
|
|
659
|
+
|
|
660
|
+
/** Speed transition for Clip.pause(); the instance selects the model clip. */
|
|
661
|
+
declare type ClipInstPauseOptions = Omit<ClipPauseOptions, 'clip'>;
|
|
662
|
+
|
|
663
|
+
/** Speed transition for Clip.resume(); the instance selects the model clip. */
|
|
664
|
+
declare type ClipInstResumeOptions = Omit<ClipResumeOptions, 'clip'>;
|
|
665
|
+
|
|
666
|
+
/** Maps application registration keys to concrete Clip instances, including subclass methods. The underlying clips are assigned before Scene_Ready. */
|
|
667
|
+
export declare type ClipInsts<T extends Record<string, ClipEntry>> = {
|
|
668
|
+
[K in keyof T]: T[K] extends ClipClass ? InstanceType<T[K]> : T[K] extends {
|
|
669
|
+
class: infer TClass extends ClipClass;
|
|
670
|
+
} ? InstanceType<TClass> : never;
|
|
671
|
+
};
|
|
672
|
+
|
|
673
|
+
/** Playback settings for Clip.start(); the instance selects the model clip. */
|
|
674
|
+
declare type ClipInstStartOptions = Omit<ClipStartOptions, 'clip'>;
|
|
675
|
+
|
|
676
|
+
/** Outgoing transitions for Clip.stop(); the instance selects the model clip. */
|
|
677
|
+
declare type ClipInstStopOptions = Omit<ClipStopOptions, 'clip'>;
|
|
678
|
+
|
|
679
|
+
/**
|
|
680
|
+
* Defines a named point in a clip that emits Clip_Marker when crossed during playback.
|
|
681
|
+
* Playback must advance by at most one clip duration per update (deltaTime * absolute speed <= clip duration).
|
|
682
|
+
*/
|
|
683
|
+
export declare type ClipMarker = {
|
|
684
|
+
/** Marker name included in the event as markerName. */
|
|
685
|
+
name: string;
|
|
686
|
+
/** Position in seconds within the animation clip. */
|
|
687
|
+
time: number;
|
|
688
|
+
};
|
|
689
|
+
|
|
690
|
+
/** Initial parameters for a registered clip. */
|
|
691
|
+
export declare interface ClipParams extends Pick<ClipStartOptions, 'modeLoop' | 'modeBlend' | 'reverse' | 'cam' | 'layer'> {
|
|
692
|
+
/** Model animation clip name, matched without regard to case. Defaults to the registration key. */
|
|
693
|
+
name?: string;
|
|
694
|
+
}
|
|
695
|
+
|
|
696
|
+
/** Clip selection and speed transition settings. */
|
|
697
|
+
declare interface ClipPauseOptions {
|
|
698
|
+
/** Model animation clip name, matched without regard to case. */
|
|
699
|
+
clip: string;
|
|
700
|
+
/** The layer assigned when playback started. Default: **null**. */
|
|
701
|
+
layer?: string | null;
|
|
702
|
+
/** Transition duration in seconds. Default: **1**. */
|
|
703
|
+
time?: number;
|
|
704
|
+
/** GSAP easing name. Default: **'power1.inOut'**. */
|
|
705
|
+
ease?: string;
|
|
706
|
+
}
|
|
707
|
+
|
|
708
|
+
/** Clip selection and speed transition settings. */
|
|
709
|
+
declare interface ClipResumeOptions {
|
|
710
|
+
/** Model animation clip name, matched without regard to case. */
|
|
711
|
+
clip: string;
|
|
712
|
+
/** The layer assigned when playback started. Default: **null**. */
|
|
713
|
+
layer?: string | null;
|
|
714
|
+
/** Transition duration in seconds. Default: **1**. */
|
|
715
|
+
time?: number;
|
|
716
|
+
/** GSAP easing name. Default: **'power1.inOut'**. */
|
|
717
|
+
ease?: string;
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
/**
|
|
721
|
+
* Controls loaded model animation clips by name through App.clips, including unregistered clips.
|
|
722
|
+
* Names are matched without regard to case; events retain the original model clip name.
|
|
723
|
+
* App.clip exposes registered Clip instances that delegate to these same controls.
|
|
724
|
+
* Wait for Scene_Ready before application playback. Supply the layer used by start() to subsequent controls.
|
|
725
|
+
* @category Core
|
|
726
|
+
*/
|
|
727
|
+
export declare class Clips {
|
|
728
|
+
private readonly cam3D;
|
|
729
|
+
private readonly events;
|
|
730
|
+
private mixer;
|
|
731
|
+
private readonly clips;
|
|
732
|
+
private readonly clipInsts;
|
|
733
|
+
private readonly clipActions;
|
|
734
|
+
private clipActionsFrame;
|
|
735
|
+
private readonly vec3Obj;
|
|
736
|
+
private readonly vec3Aim;
|
|
737
|
+
private getClip;
|
|
738
|
+
/**
|
|
739
|
+
* Changes only the supplied settings of an active clip, preserving its position and markers.
|
|
740
|
+
* @inlineType ClipChangeOptions
|
|
741
|
+
* @param params - Optional loop, reverse, fade, and speed settings.
|
|
742
|
+
*/
|
|
743
|
+
change({ clip, layer, modeLoop, reverse, fade, speed }: ClipChangeOptions): void;
|
|
744
|
+
private emitEvent;
|
|
745
|
+
private fadeTween;
|
|
746
|
+
private finished;
|
|
747
|
+
private loop;
|
|
748
|
+
/**
|
|
749
|
+
* Reduces playback speed to zero while retaining the clip's position and weight.
|
|
750
|
+
* @inlineType ClipPauseOptions
|
|
751
|
+
* @param params - Clip selection and speed transition settings.
|
|
752
|
+
*/
|
|
753
|
+
pause({ clip, layer, time, ease }: ClipPauseOptions): void;
|
|
754
|
+
/**
|
|
755
|
+
* Continues playback towards the speed retained when pause() was called.
|
|
756
|
+
* @inlineType ClipResumeOptions
|
|
757
|
+
* @param params - Clip selection and speed transition settings.
|
|
758
|
+
*/
|
|
759
|
+
resume({ clip, layer, time, ease }: ClipResumeOptions): void;
|
|
760
|
+
private speedTween;
|
|
761
|
+
/**
|
|
762
|
+
* Plays a model animation clip, optionally fading in, changing speed, or replacing selected clips.
|
|
763
|
+
* @inlineType ClipStartOptions
|
|
764
|
+
* @param params - Model clip name and playback settings. Starting restarts the clip; cam: true follows the exported camera and target.
|
|
765
|
+
*/
|
|
766
|
+
start({ clip, ...params }: ClipStartOptions): void;
|
|
767
|
+
private startClip;
|
|
768
|
+
/**
|
|
769
|
+
* Stops a model animation clip after its optional fade-out and speed-out transitions.
|
|
770
|
+
* @inlineType ClipStopOptions
|
|
771
|
+
* @param params - Clip selection, outgoing transitions, and clips to crossfade in.
|
|
772
|
+
*/
|
|
773
|
+
stop({ clip, layer, fadeOut, speedOut, crossfade }: ClipStopOptions): void;
|
|
774
|
+
private stopClip;
|
|
775
|
+
private stopTweens;
|
|
776
|
+
private updateCamera;
|
|
777
|
+
private updateEvents;
|
|
778
|
+
}
|
|
779
|
+
|
|
780
|
+
/** Typed clip instances exposed through App.clip for an Assets definition. */
|
|
781
|
+
export declare type ClipsInsts<T extends Assets> = ClipInsts<NonNullable<T['clips']>>;
|
|
782
|
+
|
|
783
|
+
/** Clip playback settings. */
|
|
784
|
+
declare interface ClipStartOptions {
|
|
785
|
+
/** Model animation clip name, matched without regard to case. */
|
|
786
|
+
clip: string;
|
|
787
|
+
/** Named layer used to group animation actions. Default: **null**, the shared unnamed layer. */
|
|
788
|
+
layer?: string | null;
|
|
789
|
+
/** Follow the exported camera and its target. Default: **false**. Coordinate camera controls in the application. */
|
|
790
|
+
cam?: boolean;
|
|
791
|
+
/** Blend mode. See {@link BlendMode}. Default: **'normal'** */
|
|
792
|
+
modeBlend?: BlendMode;
|
|
793
|
+
/** Loop setting. See {@link LoopMode}. Default: **1** */
|
|
794
|
+
modeLoop?: LoopMode;
|
|
795
|
+
/** If true, plays the clip in reverse. Default: **false** */
|
|
796
|
+
reverse?: boolean;
|
|
797
|
+
/** Blends the clip in. See {@link ClipTween}. Default `to`: **1**. Omitted: applies target **1** immediately. */
|
|
798
|
+
fadeIn?: ClipTween;
|
|
799
|
+
/** Changes playback speed. See {@link ClipTween}. Default `to`: **1**. Omitted: applies target **1** immediately. */
|
|
800
|
+
speedIn?: ClipTween;
|
|
801
|
+
/** Playback markers. See {@link ClipMarker}. Default: **[]** */
|
|
802
|
+
markers?: ClipMarker[];
|
|
803
|
+
/** Other clip names or references to fade out on the same layer, or 'all' for all other enabled clips on that layer. Default: **[]** */
|
|
804
|
+
crossfade?: 'all' | (string | Clip)[];
|
|
805
|
+
}
|
|
806
|
+
|
|
807
|
+
/** Clip selection, outgoing transitions, and clips to crossfade in. */
|
|
808
|
+
declare interface ClipStopOptions {
|
|
809
|
+
/** Model animation clip name, matched without regard to case. */
|
|
810
|
+
clip: string;
|
|
811
|
+
/** The layer assigned when playback started. Default: **null**, selecting only clips in the shared unnamed layer. */
|
|
812
|
+
layer?: string | null;
|
|
813
|
+
/** Blends the clip out before stopping. See {@link ClipTween}. Default `to`: **0**. Omitted: no outgoing transition. */
|
|
814
|
+
fadeOut?: ClipTween;
|
|
815
|
+
/** Changes playback speed before stopping. See {@link ClipTween}. Default `to`: **0**. Omitted: no outgoing transition. */
|
|
816
|
+
speedOut?: ClipTween;
|
|
817
|
+
/** Clip names or references to fade in on the same layer while this clip stops. Default: **[]** */
|
|
818
|
+
crossfade?: (string | Clip)[];
|
|
819
|
+
}
|
|
820
|
+
|
|
821
|
+
/** Describes a transition of a clip's blend weight or playback speed. */
|
|
822
|
+
export declare type ClipTween = {
|
|
823
|
+
/** Initial value. Omitted: the current weight or signed playback speed. Explicit speed values follow the clip's reverse setting. */
|
|
824
|
+
from?: number;
|
|
825
|
+
/** Target value. Its default depends on the method parameter. Speed targets follow the clip's reverse setting; zero holds playback. */
|
|
826
|
+
to?: number;
|
|
827
|
+
/** Transition duration in seconds. Default: **0** (applied immediately). */
|
|
828
|
+
time?: number;
|
|
829
|
+
/** GSAP easing function name. Default: **'power1.inOut'** */
|
|
830
|
+
ease?: string;
|
|
831
|
+
};
|
|
832
|
+
|
|
465
833
|
/**
|
|
466
834
|
* Uses a `Mesh3D` for pointer picking or occlusion and optionally maps raycast events to another rendered mesh.
|
|
467
835
|
* @category Scene Components
|
|
@@ -486,20 +854,6 @@ export declare interface Coll3DParams extends Obj3DParams {
|
|
|
486
854
|
occluder?: boolean;
|
|
487
855
|
}
|
|
488
856
|
|
|
489
|
-
/**
|
|
490
|
-
* Groups the optional scene and web component definitions used by the app.
|
|
491
|
-
*
|
|
492
|
-
* @typeParam TScene - Record of named scene component classes or entries with initial parameters.
|
|
493
|
-
* @typeParam TWeb - Record of named web component classes or entries with initial parameters.
|
|
494
|
-
*
|
|
495
|
-
* @example
|
|
496
|
-
* type MyComps = Comps<{ cube: typeof Cube }, { marker: typeof Marker }>;
|
|
497
|
-
*/
|
|
498
|
-
export declare type Comps<TScene extends Record<string, SceneEntry> = {}, TWeb extends Record<string, WebEntry> = {}> = {
|
|
499
|
-
scene?: TScene;
|
|
500
|
-
web?: TWeb;
|
|
501
|
-
};
|
|
502
|
-
|
|
503
857
|
/**
|
|
504
858
|
* Shared component settings.
|
|
505
859
|
* @category Cfg
|
|
@@ -510,8 +864,10 @@ export declare interface CompsCfg {
|
|
|
510
864
|
}
|
|
511
865
|
|
|
512
866
|
/** Registered scene components and web component instances available at runtime. */
|
|
513
|
-
export declare type CompsInsts<T extends
|
|
867
|
+
export declare type CompsInsts<T extends Assets> = {
|
|
868
|
+
/** Scene component instances keyed by registration name. */
|
|
514
869
|
scene: SceneInsts<NonNullable<T['scene']>>;
|
|
870
|
+
/** Web component instance arrays keyed by registration name. */
|
|
515
871
|
web: WebInsts<NonNullable<T['web']>>;
|
|
516
872
|
};
|
|
517
873
|
|
|
@@ -536,17 +892,18 @@ export declare type CoordinateSpace = 'parent' | 'local' | 'world';
|
|
|
536
892
|
*/
|
|
537
893
|
export declare interface DebugCfg {
|
|
538
894
|
/**
|
|
539
|
-
*
|
|
540
|
-
*
|
|
541
|
-
* - `'none'`: No debug messages are logged.
|
|
542
|
-
* - `'xstate'`: Only logs events that were accepted by the state machine.
|
|
543
|
-
* - `'all'`: Logs all debug messages.
|
|
895
|
+
* See {@link DebugLog}.
|
|
544
896
|
* @default 'xstate'
|
|
545
897
|
*/
|
|
546
898
|
log: DebugLog;
|
|
547
899
|
}
|
|
548
900
|
|
|
549
|
-
/**
|
|
901
|
+
/**
|
|
902
|
+
* Controls how much debug information is written to the console.
|
|
903
|
+
* - `'none'`: No debug messages are logged.
|
|
904
|
+
* - `'xstate'`: Only logs events that were accepted by the state machine.
|
|
905
|
+
* - `'all'`: Logs all debug messages.
|
|
906
|
+
*/
|
|
550
907
|
export declare type DebugLog = 'none' | 'xstate' | 'all';
|
|
551
908
|
|
|
552
909
|
declare type DeepPartial<T> = T extends readonly unknown[] ? T : T extends object ? {
|
|
@@ -562,6 +919,7 @@ export { degToRad }
|
|
|
562
919
|
export declare class Engine {
|
|
563
920
|
private readonly cam3D;
|
|
564
921
|
private readonly cfg;
|
|
922
|
+
private readonly clips;
|
|
565
923
|
private readonly events;
|
|
566
924
|
private readonly modules;
|
|
567
925
|
private readonly objs3D;
|
|
@@ -602,14 +960,14 @@ export declare class Engine {
|
|
|
602
960
|
*/
|
|
603
961
|
addOnFrameUpdate(cb: (deltaTime: number) => void): void;
|
|
604
962
|
/**
|
|
605
|
-
* Switches edge smoothing at runtime, loading the selected effect when needed.
|
|
606
|
-
* @param aaMode -
|
|
963
|
+
* Switches edge smoothing at runtime, loading the selected effect when needed.
|
|
964
|
+
* @param aaMode - See {@link AaMode}.
|
|
607
965
|
*/
|
|
608
966
|
enableAaMode(aaMode: AaMode): Promise<void>;
|
|
609
967
|
/**
|
|
610
|
-
* Switches screen-space lighting at runtime.
|
|
968
|
+
* Switches screen-space lighting at runtime.
|
|
611
969
|
* SSGI requires TRAA, a perspective camera, and compatible WebGPU hardware.
|
|
612
|
-
* @param sslMode -
|
|
970
|
+
* @param sslMode - See {@link SslMode}.
|
|
613
971
|
*/
|
|
614
972
|
enableSslMode(sslMode: SslMode): Promise<void>;
|
|
615
973
|
/**
|
|
@@ -670,10 +1028,10 @@ export declare class EnvCtrls {
|
|
|
670
1028
|
private disposePrevBgd;
|
|
671
1029
|
private disposeText;
|
|
672
1030
|
/**
|
|
673
|
-
* Loads and applies
|
|
1031
|
+
* Loads and applies the configured environment maps. See {@link EnvCtrlsCfg}.
|
|
674
1032
|
* @param params - Optional environment loading parameters. If provided, both `type` and `map` are required.
|
|
675
|
-
* @param params.type -
|
|
676
|
-
* @param params.map -
|
|
1033
|
+
* @param params.type - See {@link EnvCtrlsCfg.type}. Defaults to `cfg.envCtrls.type`.
|
|
1034
|
+
* @param params.map - See {@link EnvCtrlsCfg.map}. Defaults to `cfg.envCtrls.map`.
|
|
677
1035
|
*/
|
|
678
1036
|
enable(params?: {
|
|
679
1037
|
type: EnvCtrlsCfg["type"];
|
|
@@ -682,7 +1040,7 @@ export declare class EnvCtrls {
|
|
|
682
1040
|
/** Removes environment lighting and background maps, cancels pending updates, and stops rotation. */
|
|
683
1041
|
disable(): void;
|
|
684
1042
|
/**
|
|
685
|
-
* Returns a snapshot of
|
|
1043
|
+
* Returns a snapshot of rotation, rotation speed, intensities, and background blurriness. See {@link EnvCtrlsCfg}.
|
|
686
1044
|
*/
|
|
687
1045
|
get(): Partial<EnvCtrlsCfg>;
|
|
688
1046
|
/**
|
|
@@ -693,7 +1051,7 @@ export declare class EnvCtrls {
|
|
|
693
1051
|
private loadText;
|
|
694
1052
|
/**
|
|
695
1053
|
* Updates supported environment control values at runtime.
|
|
696
|
-
* @param params -
|
|
1054
|
+
* @param params - Supported runtime settings to change; omitted values remain unchanged. See {@link EnvCtrlsCfg}.
|
|
697
1055
|
*/
|
|
698
1056
|
set(params: Partial<EnvCtrlsCfg>): void;
|
|
699
1057
|
private setEnv;
|
|
@@ -751,8 +1109,11 @@ export declare interface EnvCtrlsCfg {
|
|
|
751
1109
|
* @default { x: 0, y: 0, z: 0 }
|
|
752
1110
|
*/
|
|
753
1111
|
rotation: {
|
|
1112
|
+
/** Rotation around the X axis in radians. */
|
|
754
1113
|
x: number;
|
|
1114
|
+
/** Rotation around the Y axis in radians. */
|
|
755
1115
|
y: number;
|
|
1116
|
+
/** Rotation around the Z axis in radians. */
|
|
756
1117
|
z: number;
|
|
757
1118
|
};
|
|
758
1119
|
/**
|
|
@@ -769,6 +1130,7 @@ export declare interface EnvCtrlsCfg {
|
|
|
769
1130
|
|
|
770
1131
|
/** @event Fired after the initial environment is applied and all progressive background loading attempts have completed. Failed background maps may have been skipped. Canceled or superseded loads do not fire this event. */
|
|
771
1132
|
export declare interface EnvLoadedEvent {
|
|
1133
|
+
/** Event identifier used to select listeners and state machine transitions. */
|
|
772
1134
|
type: 'Env_Loaded';
|
|
773
1135
|
}
|
|
774
1136
|
|
|
@@ -790,13 +1152,6 @@ export declare class Events {
|
|
|
790
1152
|
send(event: AnyEventObject, log?: string): void;
|
|
791
1153
|
}
|
|
792
1154
|
|
|
793
|
-
/**
|
|
794
|
-
* Controls what happens after the final animation loop.
|
|
795
|
-
* - `'hold'`: Keeps the action enabled and holds its final pose.
|
|
796
|
-
* - `'fadeOut'`: Fades out over `fadeTimeFinish` seconds, or stops immediately when the duration is `0`.
|
|
797
|
-
*/
|
|
798
|
-
export declare type FinishMode = 'hold' | 'fadeOut';
|
|
799
|
-
|
|
800
1155
|
/**
|
|
801
1156
|
* Blends distant objects into the fog color.
|
|
802
1157
|
* @category Cfg
|
|
@@ -974,6 +1329,7 @@ export declare interface FpvCtrlsCfg {
|
|
|
974
1329
|
|
|
975
1330
|
/** @event Fired when first-person controls are enabled, disabled, disposed, locked, or unlocked. */
|
|
976
1331
|
export declare interface FpvCtrlsEvent {
|
|
1332
|
+
/** Event identifier used to select listeners and state machine transitions. */
|
|
977
1333
|
type: 'FpvCtrls_Disabled' | 'FpvCtrls_Disposed' | 'FpvCtrls_Enabled' | 'FpvCtrls_Lock' | 'FpvCtrls_Unlock';
|
|
978
1334
|
}
|
|
979
1335
|
|
|
@@ -1330,6 +1686,7 @@ export declare interface MeshCfg {
|
|
|
1330
1686
|
* @category Cfg
|
|
1331
1687
|
*/
|
|
1332
1688
|
export declare interface ModelCfg {
|
|
1689
|
+
/** Mesh and texture compression formats used by the model assets. */
|
|
1333
1690
|
compress: {
|
|
1334
1691
|
/**
|
|
1335
1692
|
* Mesh compression used by the GLTF/GLB file.
|
|
@@ -1361,6 +1718,7 @@ export declare interface ModelCfg {
|
|
|
1361
1718
|
|
|
1362
1719
|
/** @event Fired when model loading fails. */
|
|
1363
1720
|
export declare interface ModelErrorEvent {
|
|
1721
|
+
/** Event identifier used to select listeners and state machine transitions. */
|
|
1364
1722
|
type: 'Model_Error';
|
|
1365
1723
|
/** The caught error object. */
|
|
1366
1724
|
error: Error;
|
|
@@ -1382,6 +1740,7 @@ export declare interface ModelLoadingEvent {
|
|
|
1382
1740
|
|
|
1383
1741
|
/** @event Fired after the final progressive model has been applied and rendered. */
|
|
1384
1742
|
export declare interface ModelReadyEvent {
|
|
1743
|
+
/** Event identifier used to select listeners and state machine transitions. */
|
|
1385
1744
|
type: 'Model_Ready';
|
|
1386
1745
|
}
|
|
1387
1746
|
|
|
@@ -1402,10 +1761,9 @@ export declare class Obj3D {
|
|
|
1402
1761
|
/** @public */
|
|
1403
1762
|
protected canvas: HTMLElement;
|
|
1404
1763
|
protected cfg: Cfg;
|
|
1405
|
-
protected name: string;
|
|
1406
1764
|
/** The managed `THREE.Object3D` instance for this object. It is `null` until a scene object is assigned. */
|
|
1407
1765
|
obj: THREE_TYPE.Object3D | null;
|
|
1408
|
-
/** Contains all Scene Components registered through `comps.scene`, keyed by registration name. */
|
|
1766
|
+
/** Contains all Scene Components registered through `comps.scene`, keyed by lowercase registration name. */
|
|
1409
1767
|
protected objs3D: Map<string, Obj3D> | null;
|
|
1410
1768
|
/**
|
|
1411
1769
|
* Active renderer for custom rendering integrations.
|
|
@@ -1454,19 +1812,22 @@ export declare class Obj3D {
|
|
|
1454
1812
|
}>) => void): Unsubscribe;
|
|
1455
1813
|
/**
|
|
1456
1814
|
* Animates this object's orientation in radians through {@link Scene.animRotTo}.
|
|
1815
|
+
* @inlineType ObjRotOptions
|
|
1457
1816
|
* @param params - Target orientation and animation settings, without an object parameter.
|
|
1458
1817
|
*/
|
|
1459
|
-
animRotTo(
|
|
1818
|
+
animRotTo({ x, y, z, path, order, space, time, ease }: ObjRotOptions): void;
|
|
1460
1819
|
/**
|
|
1461
1820
|
* Animates this object's scale through {@link Scene.animScaleTo}.
|
|
1821
|
+
* @inlineType ObjScaleOptions
|
|
1462
1822
|
* @param params - Target scale and animation settings, without an object parameter.
|
|
1463
1823
|
*/
|
|
1464
|
-
animScaleTo(
|
|
1824
|
+
animScaleTo({ x, y, z, time, ease }: ObjScaleOptions): void;
|
|
1465
1825
|
/**
|
|
1466
1826
|
* Animates this object's position through {@link Scene.animTranslTo}.
|
|
1827
|
+
* @inlineType ObjTranslOptions
|
|
1467
1828
|
* @param params - Target position and animation settings, without an object parameter.
|
|
1468
1829
|
*/
|
|
1469
|
-
animTranslTo(
|
|
1830
|
+
animTranslTo({ x, y, z, space, time, ease }: ObjTranslOptions): void;
|
|
1470
1831
|
/**
|
|
1471
1832
|
* Animates angular velocity in radians per second. World rotation requires uniformly scaled parents.
|
|
1472
1833
|
* @param params - Target angular velocity and animation settings.
|
|
@@ -1584,6 +1945,7 @@ export declare type Obj3DEvent = Obj3DPosWorldEvent | Obj3DPosScreenEvent | Obj3
|
|
|
1584
1945
|
|
|
1585
1946
|
/** @event Fired when the frustum visibility of a 3D object changes. */
|
|
1586
1947
|
export declare interface Obj3DFrustumEvent {
|
|
1948
|
+
/** Event identifier used to select listeners and state machine transitions. */
|
|
1587
1949
|
type: 'Obj3D_Frustum_Changed';
|
|
1588
1950
|
/** Whether the object's world position is inside the camera frustum. */
|
|
1589
1951
|
visibleFrustum: boolean;
|
|
@@ -1591,12 +1953,15 @@ export declare interface Obj3DFrustumEvent {
|
|
|
1591
1953
|
|
|
1592
1954
|
/** Initial parameters shared by all `Obj3D` classes. */
|
|
1593
1955
|
export declare interface Obj3DParams {
|
|
1956
|
+
/** Model object name, matched without regard to case. Defaults to the registration key. */
|
|
1957
|
+
name?: string;
|
|
1594
1958
|
/** Hides the underlying Three.js object from rendering without disabling raycasting. */
|
|
1595
1959
|
hidden?: boolean;
|
|
1596
1960
|
}
|
|
1597
1961
|
|
|
1598
1962
|
/** @event Fired when the pointer interacts with a pickable object. */
|
|
1599
1963
|
export declare interface Obj3DPointerEvent {
|
|
1964
|
+
/** Event identifier used to select listeners and state machine transitions. */
|
|
1600
1965
|
type: 'Obj3D_Click' | 'Obj3D_Pointer_Enter' | 'Obj3D_Pointer_Down' | 'Obj3D_Pointer_Leave' | 'Obj3D_Pointer_Move' | 'Obj3D_Pointer_Up';
|
|
1601
1966
|
/** Native pointer event from the active object interaction. */
|
|
1602
1967
|
event: PointerEvent;
|
|
@@ -1608,6 +1973,7 @@ export declare interface Obj3DPointerEvent {
|
|
|
1608
1973
|
* @event Fired when the screen position of a 3D object changes.
|
|
1609
1974
|
*/
|
|
1610
1975
|
export declare interface Obj3DPosScreenEvent {
|
|
1976
|
+
/** Event identifier used to select listeners and state machine transitions. */
|
|
1611
1977
|
type: 'Obj3D_Pos_Screen_Changed';
|
|
1612
1978
|
/** The object's position projected into screen space. */
|
|
1613
1979
|
posScreen: THREE_TYPE.Vector2;
|
|
@@ -1617,6 +1983,7 @@ export declare interface Obj3DPosScreenEvent {
|
|
|
1617
1983
|
* @event Fired when the world position of a 3D object changes.
|
|
1618
1984
|
*/
|
|
1619
1985
|
export declare interface Obj3DPosWorldEvent {
|
|
1986
|
+
/** Event identifier used to select listeners and state machine transitions. */
|
|
1620
1987
|
type: 'Obj3D_Pos_World_Changed';
|
|
1621
1988
|
/** The object's position in world coordinates. */
|
|
1622
1989
|
posWorld: THREE_TYPE.Vector3;
|
|
@@ -1626,6 +1993,7 @@ export declare interface Obj3DPosWorldEvent {
|
|
|
1626
1993
|
* @event Fired when the world rotation of a 3D object changes.
|
|
1627
1994
|
*/
|
|
1628
1995
|
export declare interface Obj3DRotWorldEvent {
|
|
1996
|
+
/** Event identifier used to select listeners and state machine transitions. */
|
|
1629
1997
|
type: 'Obj3D_Rot_World_Changed';
|
|
1630
1998
|
/** The object's rotation in world coordinates. */
|
|
1631
1999
|
rotWorld: THREE_TYPE.Euler;
|
|
@@ -1633,13 +2001,21 @@ export declare interface Obj3DRotWorldEvent {
|
|
|
1633
2001
|
|
|
1634
2002
|
/** @event Fired when an object's combined hidden, frustum, and occlusion visibility changes. */
|
|
1635
2003
|
export declare interface Obj3DVisibleEvent {
|
|
2004
|
+
/** Event identifier used to select listeners and state machine transitions. */
|
|
1636
2005
|
type: 'Obj3D_Visible_Changed';
|
|
1637
2006
|
/** Whether the object is not hidden, is inside the camera frustum, and is not occluded. */
|
|
1638
2007
|
visible: boolean;
|
|
1639
2008
|
}
|
|
1640
2009
|
|
|
2010
|
+
declare type ObjRotOptions = Omit<AnimRotOptions, 'obj'>;
|
|
2011
|
+
|
|
2012
|
+
/** Scene object component types managed by the framework. */
|
|
1641
2013
|
export declare type Objs3D = Cam3D | Light3D | Mesh3D | Obj3D;
|
|
1642
2014
|
|
|
2015
|
+
declare type ObjScaleOptions = Omit<AnimScaleOptions, 'obj'>;
|
|
2016
|
+
|
|
2017
|
+
declare type ObjTranslOptions = Omit<AnimTranslOptions, 'obj'>;
|
|
2018
|
+
|
|
1643
2019
|
/**
|
|
1644
2020
|
* Controls camera orbit, panning, and zooming around a target.
|
|
1645
2021
|
* @category Core
|
|
@@ -1792,6 +2168,7 @@ export declare interface OrbitCtrlsCfg {
|
|
|
1792
2168
|
|
|
1793
2169
|
/** @event Fired when orbit interaction starts, changes, or ends, or controls are enabled, disabled, or disposed. */
|
|
1794
2170
|
export declare interface OrbitCtrlsEvent {
|
|
2171
|
+
/** Event identifier used to select listeners and state machine transitions. */
|
|
1795
2172
|
type: 'OrbitCtrls_Changed' | 'OrbitCtrls_Disabled' | 'OrbitCtrls_Enabled' | 'OrbitCtrls_End' | 'OrbitCtrls_Start' | 'OrbitCtrls_Disposed';
|
|
1796
2173
|
}
|
|
1797
2174
|
|
|
@@ -1836,6 +2213,7 @@ export declare interface PostCfg {
|
|
|
1836
2213
|
|
|
1837
2214
|
/** @event Fired after the loading progress bar has finished hiding. */
|
|
1838
2215
|
export declare interface ProgressBarHiddenEvent {
|
|
2216
|
+
/** Event identifier used to select listeners and state machine transitions. */
|
|
1839
2217
|
type: 'ProgressBar_Hidden';
|
|
1840
2218
|
}
|
|
1841
2219
|
|
|
@@ -1962,12 +2340,7 @@ export declare interface RenderCfg {
|
|
|
1962
2340
|
*/
|
|
1963
2341
|
adaptiveGfx: boolean;
|
|
1964
2342
|
/**
|
|
1965
|
-
*
|
|
1966
|
-
*
|
|
1967
|
-
* - `webgl`: use `THREE.WebGLRenderer`
|
|
1968
|
-
* - `webgpu`: use `THREE.WebGPURenderer`
|
|
1969
|
-
* - `auto`: use WebGPU if supported, otherwise fall back to WebGL
|
|
1970
|
-
*
|
|
2343
|
+
* See {@link Renderer}.
|
|
1971
2344
|
* @default 'auto'
|
|
1972
2345
|
*/
|
|
1973
2346
|
api: Renderer;
|
|
@@ -2051,14 +2424,17 @@ export declare interface RenderCfg {
|
|
|
2051
2424
|
* WebGPU-specific renderer configuration.
|
|
2052
2425
|
*/
|
|
2053
2426
|
webgpu: {
|
|
2054
|
-
/**
|
|
2055
|
-
* Parameters passed to `THREE.WebGPURenderer`.
|
|
2056
|
-
*/
|
|
2427
|
+
/** See {@link WebGpuRendererParams}. */
|
|
2057
2428
|
params: WebGpuRendererParams;
|
|
2058
2429
|
};
|
|
2059
2430
|
}
|
|
2060
2431
|
|
|
2061
|
-
/**
|
|
2432
|
+
/**
|
|
2433
|
+
* Selects the rendering backend.
|
|
2434
|
+
* - `'webgl'`: Uses `THREE.WebGLRenderer`.
|
|
2435
|
+
* - `'webgpu'`: Uses `THREE.WebGPURenderer`.
|
|
2436
|
+
* - `'auto'`: Uses WebGPU if supported, otherwise falls back to WebGL.
|
|
2437
|
+
*/
|
|
2062
2438
|
export declare type Renderer = 'webgl' | 'webgpu' | 'auto';
|
|
2063
2439
|
|
|
2064
2440
|
/** Complete effect selections for both rendering backends. */
|
|
@@ -2144,12 +2520,13 @@ export declare type RenderProfileWebGpu = {
|
|
|
2144
2520
|
});
|
|
2145
2521
|
|
|
2146
2522
|
/**
|
|
2147
|
-
* Controls scene contents, camera animation, materials,
|
|
2523
|
+
* Controls scene contents, camera animation, materials, and lighting.
|
|
2148
2524
|
* @category Core
|
|
2149
2525
|
*/
|
|
2150
2526
|
export declare class Scene {
|
|
2151
|
-
private readonly cfg;
|
|
2152
2527
|
private readonly cam3D;
|
|
2528
|
+
private readonly cfg;
|
|
2529
|
+
private readonly clips;
|
|
2153
2530
|
private readonly events;
|
|
2154
2531
|
private readonly objs3D;
|
|
2155
2532
|
private readonly tweensObj;
|
|
@@ -2222,7 +2599,7 @@ export declare class Scene {
|
|
|
2222
2599
|
/**
|
|
2223
2600
|
* Animates all assigned materials of an object, optionally including descendant meshes.
|
|
2224
2601
|
* @param params - Target material values and shared animation settings.
|
|
2225
|
-
* @param params.obj -
|
|
2602
|
+
* @param params.obj - Exact Three.js object name.
|
|
2226
2603
|
* @param params.recursive - Includes descendant meshes. Default: **false**
|
|
2227
2604
|
* @param params.infinite - Repeats each animation indefinitely. Default: **false**
|
|
2228
2605
|
* @param params.time - Duration in seconds. Default: **0**
|
|
@@ -2233,7 +2610,7 @@ export declare class Scene {
|
|
|
2233
2610
|
* Each shared material is animated once. Tweens and {@link AnimMaterialEvent} are managed per material.
|
|
2234
2611
|
*/
|
|
2235
2612
|
animMaterialsTo({ obj, recursive, ...params }: {
|
|
2236
|
-
obj: string
|
|
2613
|
+
obj: string;
|
|
2237
2614
|
recursive?: boolean;
|
|
2238
2615
|
infinite?: boolean;
|
|
2239
2616
|
time?: number;
|
|
@@ -2243,16 +2620,8 @@ export declare class Scene {
|
|
|
2243
2620
|
}): void;
|
|
2244
2621
|
/**
|
|
2245
2622
|
* Animates orientation from its current value using Euler angles in radians.
|
|
2623
|
+
* @inlineType AnimRotOptions
|
|
2246
2624
|
* @param params - Target object, orientation, and animation settings.
|
|
2247
|
-
* @param params.obj - Scene object name or component, including cameras.
|
|
2248
|
-
* @param params.x - Target X angle in radians; omitted axes keep their starting target angles.
|
|
2249
|
-
* @param params.y - Target Y angle in radians.
|
|
2250
|
-
* @param params.z - Target Z angle in radians.
|
|
2251
|
-
* @param params.path - Rotation interpolation. Default: **'euler'**; **'quat'** takes the shortest orientation path.
|
|
2252
|
-
* @param params.order - Euler order for interpreting angles in both paths. Default: **'XYZ'**
|
|
2253
|
-
* @param params.space - Orientation space. Default: **'parent'**
|
|
2254
|
-
* @param params.time - Duration in seconds. Default: **1**. A value of 0 applies the values immediately.
|
|
2255
|
-
* @param params.ease - GSAP easing function. Default: **'power2.inOut'**
|
|
2256
2625
|
* @remarks
|
|
2257
2626
|
* Euler interpolation supports full turns. Each call starts from the current orientation without retaining previous turns.
|
|
2258
2627
|
* Quaternion interpolation takes the shortest path; omitted Euler axes may change during interpolation.
|
|
@@ -2261,147 +2630,29 @@ export declare class Scene {
|
|
|
2261
2630
|
* A new call cancels only the previous orientation animation of the same object.
|
|
2262
2631
|
* Emits {@link AnimEvent}: `Anim_Start`, `Anim_Complete`, or `Anim_Cancel` when replaced.
|
|
2263
2632
|
*/
|
|
2264
|
-
animRotTo({ obj, x, y, z, path, order, space, time, ease }:
|
|
2265
|
-
obj: string | Obj3D;
|
|
2266
|
-
x?: number;
|
|
2267
|
-
y?: number;
|
|
2268
|
-
z?: number;
|
|
2269
|
-
path?: 'euler' | 'quat';
|
|
2270
|
-
order?: THREE_TYPE.EulerOrder;
|
|
2271
|
-
space?: 'parent' | 'world';
|
|
2272
|
-
time?: number;
|
|
2273
|
-
ease?: string;
|
|
2274
|
-
}): void;
|
|
2633
|
+
animRotTo({ obj, x, y, z, path, order, space, time, ease }: AnimRotOptions): void;
|
|
2275
2634
|
/**
|
|
2276
2635
|
* Animates selected local scale axes from their current values.
|
|
2636
|
+
* @inlineType AnimScaleOptions
|
|
2277
2637
|
* @param params - Target object, scale, and animation settings.
|
|
2278
|
-
* @param params.obj - Scene object name or component, including cameras.
|
|
2279
|
-
* @param params.x - Target X scale; omitted axes remain unchanged.
|
|
2280
|
-
* @param params.y - Target Y scale.
|
|
2281
|
-
* @param params.z - Target Z scale.
|
|
2282
|
-
* @param params.time - Duration in seconds. Default: **1**. A value of 0 applies the values immediately.
|
|
2283
|
-
* @param params.ease - GSAP easing function. Default: **'power2.inOut'**
|
|
2284
2638
|
* @remarks
|
|
2285
2639
|
* A new call cancels only the previous scale animation of the same object.
|
|
2286
2640
|
* Emits {@link AnimEvent}: `Anim_Start`, `Anim_Complete`, or `Anim_Cancel` when replaced.
|
|
2287
2641
|
*/
|
|
2288
|
-
animScaleTo({ obj, x, y, z, time, ease }:
|
|
2289
|
-
obj: string | Obj3D;
|
|
2290
|
-
x?: number;
|
|
2291
|
-
y?: number;
|
|
2292
|
-
z?: number;
|
|
2293
|
-
time?: number;
|
|
2294
|
-
ease?: string;
|
|
2295
|
-
}): void;
|
|
2642
|
+
animScaleTo({ obj, x, y, z, time, ease }: AnimScaleOptions): void;
|
|
2296
2643
|
/**
|
|
2297
2644
|
* Animates selected position axes from their current values in parent or world space.
|
|
2645
|
+
* @inlineType AnimTranslOptions
|
|
2298
2646
|
* @param params - Target object, position, and animation settings.
|
|
2299
|
-
* @param params.obj - Scene object name or component, including cameras.
|
|
2300
|
-
* @param params.x - Target X position; omitted axes keep their starting values.
|
|
2301
|
-
* @param params.y - Target Y position.
|
|
2302
|
-
* @param params.z - Target Z position.
|
|
2303
|
-
* @param params.space - Position space. Default: **'parent'**
|
|
2304
|
-
* @param params.time - Duration in seconds. Default: **1**. A value of 0 applies the values immediately.
|
|
2305
|
-
* @param params.ease - GSAP easing function. Default: **'power2.inOut'**
|
|
2306
2647
|
* @remarks
|
|
2307
2648
|
* World targets account for moving parents. Cameras switch to free look mode.
|
|
2308
2649
|
* A new call cancels only the previous position animation of the same object.
|
|
2309
2650
|
* Emits {@link AnimEvent}: `Anim_Start`, `Anim_Complete`, or `Anim_Cancel` when replaced.
|
|
2310
2651
|
*/
|
|
2311
|
-
animTranslTo({ obj, x, y, z, space, time, ease }:
|
|
2312
|
-
obj: string | Obj3D;
|
|
2313
|
-
x?: number;
|
|
2314
|
-
y?: number;
|
|
2315
|
-
z?: number;
|
|
2316
|
-
space?: 'parent' | 'world';
|
|
2317
|
-
time?: number;
|
|
2318
|
-
ease?: string;
|
|
2319
|
-
}): void;
|
|
2652
|
+
animTranslTo({ obj, x, y, z, space, time, ease }: AnimTranslOptions): void;
|
|
2320
2653
|
private getMtrls;
|
|
2321
2654
|
private getObj;
|
|
2322
|
-
|
|
2323
|
-
* Plays a named animation clip with blending, looping, and speed control.
|
|
2324
|
-
*
|
|
2325
|
-
* @param params - Parameters for controlling the animation playback.
|
|
2326
|
-
* @param params.layer - The freely named layer used to group animation actions.
|
|
2327
|
-
* @param params.clip - The name of the animation clip to play.
|
|
2328
|
-
* @param params.modeBlend - How the action is blended with other active actions. Default: **'normal'**
|
|
2329
|
-
* @param params.modeFinish - Whether the final pose is held or faded out after the final loop. Default: **'hold'**
|
|
2330
|
-
* @param params.modeLoop - Number of plays or `'infinite'` for endless looping. Default: **1**
|
|
2331
|
-
* @param params.modeStop - Which previous actions of the same layer are stopped before playback. Default: **'all'**
|
|
2332
|
-
* @param params.fadeTime - Duration in seconds for fading affected previous actions out and the new action in. Default: **0**
|
|
2333
|
-
* @param params.fadeTimeFinish - Duration in seconds for `modeFinish: 'fadeOut'`. Default: **0**
|
|
2334
|
-
* @param params.reverse - If `true`, plays the clip in reverse. Default: **false**
|
|
2335
|
-
* @param params.reset - If `true`, resets the clip before a new playback. Default: **false**
|
|
2336
|
-
* @param params.speedStart - Initial playback speed for speed interpolation. Default: **0**
|
|
2337
|
-
* @param params.speedEnd - Target playback speed. Default: **1**
|
|
2338
|
-
* @param params.speedTime - Duration in seconds for speed interpolation. Default: **0**
|
|
2339
|
-
* @param params.speedEase - GSAP easing function name. Default: **'power1.inOut'**
|
|
2340
|
-
*
|
|
2341
|
-
* @remarks
|
|
2342
|
-
* Playing an active or fading-in action again updates its speed without restarting it. Finished or stopped actions restart; fading-out actions resume from their current time and weight.
|
|
2343
|
-
*
|
|
2344
|
-
* `modeFinish` and `fadeTimeFinish` have no effect when `modeLoop` is `'infinite'`.
|
|
2345
|
-
*
|
|
2346
|
-
* **Events**
|
|
2347
|
-
*
|
|
2348
|
-
* {@link ClipEvent}
|
|
2349
|
-
*/
|
|
2350
|
-
playClip({ layer, clip: clipName, modeBlend, modeFinish, modeLoop, modeStop, fadeTime, fadeTimeFinish, reverse, reset, speedStart, speedEnd, speedTime, speedEase }: {
|
|
2351
|
-
layer: string;
|
|
2352
|
-
clip: string;
|
|
2353
|
-
singleAction?: boolean;
|
|
2354
|
-
modeBlend?: BlendMode;
|
|
2355
|
-
modeFinish?: FinishMode;
|
|
2356
|
-
modeLoop?: LoopMode;
|
|
2357
|
-
modeStop?: StopMode;
|
|
2358
|
-
fadeTime?: number;
|
|
2359
|
-
fadeTimeFinish?: number;
|
|
2360
|
-
reverse?: boolean;
|
|
2361
|
-
reset?: boolean;
|
|
2362
|
-
speedStart?: number;
|
|
2363
|
-
speedEnd?: number;
|
|
2364
|
-
speedTime?: number;
|
|
2365
|
-
speedEase?: string;
|
|
2366
|
-
}): void;
|
|
2367
|
-
/**
|
|
2368
|
-
* Plays a named camera animation clip with blending, looping, and speed control.
|
|
2369
|
-
*
|
|
2370
|
-
* @param params - Parameters for controlling the camera animation playback.
|
|
2371
|
-
* @param params.layer - The freely named layer used to group camera animation actions.
|
|
2372
|
-
* @param params.clip - The name of the camera animation clip to play.
|
|
2373
|
-
* @param params.modeBlend - How the action is blended with other active actions. Default: **'normal'**
|
|
2374
|
-
* @param params.modeLoop - Number of plays or `'infinite'` for endless looping. Default: **1**
|
|
2375
|
-
* @param params.modeStop - Which previous actions of the same layer are stopped before playback. Default: **'all'**
|
|
2376
|
-
* @param params.fadeTime - Duration in seconds for fading affected previous actions out and the new action in. Default: **0**
|
|
2377
|
-
* @param params.reverse - If `true`, plays the clip in reverse. Default: **false**
|
|
2378
|
-
* @param params.reset - If `true`, resets the clip before a new playback. Default: **false**
|
|
2379
|
-
* @param params.speedStart - Initial playback speed for speed interpolation. Default: **0**
|
|
2380
|
-
* @param params.speedEnd - Target playback speed. Default: **1**
|
|
2381
|
-
* @param params.speedTime - Duration in seconds for speed interpolation. Default: **0**
|
|
2382
|
-
* @param params.speedEase - GSAP easing function name. Default: **'power1.inOut'**
|
|
2383
|
-
*
|
|
2384
|
-
* @remarks
|
|
2385
|
-
* Playing an active or fading-in action again updates its speed without restarting it. Finished or stopped actions restart; fading-out actions resume from their current time and weight.
|
|
2386
|
-
*
|
|
2387
|
-
* **Events**
|
|
2388
|
-
*
|
|
2389
|
-
* {@link ClipEvent}
|
|
2390
|
-
*/
|
|
2391
|
-
playClipCam({ layer, clip: clipName, modeBlend, modeLoop, modeStop, fadeTime, reverse, reset, speedStart, speedEnd, speedTime, speedEase }: {
|
|
2392
|
-
layer: string;
|
|
2393
|
-
clip: string;
|
|
2394
|
-
modeBlend?: BlendMode;
|
|
2395
|
-
modeLoop?: LoopMode;
|
|
2396
|
-
modeStop?: StopMode;
|
|
2397
|
-
fadeTime?: number;
|
|
2398
|
-
reverse?: boolean;
|
|
2399
|
-
reset?: boolean;
|
|
2400
|
-
speedStart?: number;
|
|
2401
|
-
speedEnd?: number;
|
|
2402
|
-
speedTime?: number;
|
|
2403
|
-
speedEase?: string;
|
|
2404
|
-
}): void;
|
|
2655
|
+
private getObj3D;
|
|
2405
2656
|
/**
|
|
2406
2657
|
* Removes the built-in ambient light and releases its resources.
|
|
2407
2658
|
*/
|
|
@@ -2465,7 +2716,7 @@ export declare class Scene {
|
|
|
2465
2716
|
/**
|
|
2466
2717
|
* Updates all assigned materials of an object, optionally including descendant meshes.
|
|
2467
2718
|
* @param params - Target material values, such as `color`, `roughness`, or `map`.
|
|
2468
|
-
* @param params.obj -
|
|
2719
|
+
* @param params.obj - Exact Three.js object name.
|
|
2469
2720
|
* @param params.recursive - Includes descendant meshes. Default: **false**
|
|
2470
2721
|
* @param params.needsUpdate - Recompiles materials after applying the values. Default: **false**
|
|
2471
2722
|
*
|
|
@@ -2473,26 +2724,11 @@ export declare class Scene {
|
|
|
2473
2724
|
* Each shared material is updated once. Texture paths for `map` and `emissiveMap` load asynchronously.
|
|
2474
2725
|
*/
|
|
2475
2726
|
setMaterialsProps({ obj, recursive, ...props }: {
|
|
2476
|
-
obj: string
|
|
2727
|
+
obj: string;
|
|
2477
2728
|
recursive?: boolean;
|
|
2478
2729
|
needsUpdate?: boolean;
|
|
2479
2730
|
[key: string]: any;
|
|
2480
2731
|
}): void;
|
|
2481
|
-
/**
|
|
2482
|
-
* Stops a named animation clip, optionally slowing it to a halt first.
|
|
2483
|
-
* @param params - Stop settings.
|
|
2484
|
-
* @param params.clipName - Animation clip name.
|
|
2485
|
-
* @param params.speedTime - Slowdown duration in seconds. Default: **0**
|
|
2486
|
-
* @param params.speedEase - GSAP easing function for the slowdown. Default: **'power1.inOut'**
|
|
2487
|
-
*
|
|
2488
|
-
* @remarks
|
|
2489
|
-
* A slowdown emits `Clip_Speed_Start` and `Clip_Speed_Complete`, followed by `Clip_Cancel`. A duration of `0` cancels immediately. See {@link ClipEvent}.
|
|
2490
|
-
*/
|
|
2491
|
-
stopClip({ clipName, speedTime, speedEase }: {
|
|
2492
|
-
clipName: string;
|
|
2493
|
-
speedTime?: number;
|
|
2494
|
-
speedEase?: string;
|
|
2495
|
-
}): void;
|
|
2496
2732
|
}
|
|
2497
2733
|
|
|
2498
2734
|
/**
|
|
@@ -2523,6 +2759,7 @@ export declare type SceneClass = new (canvas: HTMLElement, cfg: Cfg, name: strin
|
|
|
2523
2759
|
|
|
2524
2760
|
/** Scene component class with optional initial parameters. */
|
|
2525
2761
|
export declare type SceneEntry<TClass extends SceneClass = SceneClass> = TClass | {
|
|
2762
|
+
/** Scene component class to instantiate. */
|
|
2526
2763
|
class: TClass;
|
|
2527
2764
|
/**
|
|
2528
2765
|
* Initial parameters assigned to a scene component class when the app starts. Accepts `Obj3DParams` or `Coll3DParams`, depending on the registered `class`. */
|
|
@@ -2542,6 +2779,7 @@ export declare type SceneInsts<T extends Record<string, SceneEntry>> = {
|
|
|
2542
2779
|
|
|
2543
2780
|
/** @event Fired when the initial scene resources and component readiness hooks are complete. */
|
|
2544
2781
|
export declare interface SceneReadyEvent {
|
|
2782
|
+
/** Event identifier used to select listeners and state machine transitions. */
|
|
2545
2783
|
type: 'Scene_Ready';
|
|
2546
2784
|
}
|
|
2547
2785
|
|
|
@@ -2576,6 +2814,142 @@ export declare interface SmaaCfg {
|
|
|
2576
2814
|
guiOpened: boolean;
|
|
2577
2815
|
}
|
|
2578
2816
|
|
|
2817
|
+
/**
|
|
2818
|
+
* Provides loading, playback controls, and listeners for a sound registered in assets.sounds.
|
|
2819
|
+
* Extend this class to implement custom sound behavior. Instances are exposed through App.sound.
|
|
2820
|
+
* Registration does not load audio. Set the Audio listener, then call load() or loadAndStart().
|
|
2821
|
+
* Playback controls have no effect until obj is assigned; loading calls merge registered defaults with supplied options.
|
|
2822
|
+
* @category Core
|
|
2823
|
+
*/
|
|
2824
|
+
export declare class Sound {
|
|
2825
|
+
private readonly audio;
|
|
2826
|
+
private readonly params;
|
|
2827
|
+
/** The loaded Three.js audio source. It is null until loading completes. */
|
|
2828
|
+
obj: THREE_TYPE.Audio<GainNode> | THREE_TYPE.PositionalAudio | null;
|
|
2829
|
+
/** Subscribes to this sound's events after application event handling. Listeners persist across restarts. Returns an unsubscribe function. */
|
|
2830
|
+
addEventListener<TType extends AudioEvent['type']>(type: TType, listener: (event: AudioEvent & {
|
|
2831
|
+
type: TType;
|
|
2832
|
+
}) => void): Unsubscribe;
|
|
2833
|
+
/**
|
|
2834
|
+
* Changes this sound's volume, speed, and loop through {@link Audio.change}.
|
|
2835
|
+
* A paused sound resumes; a stopped or finished sound remains stopped. Positional settings are load-time options.
|
|
2836
|
+
* @inlineType SoundInstChangeOptions
|
|
2837
|
+
* @param params - Settings and optional transitions.
|
|
2838
|
+
*/
|
|
2839
|
+
change(params?: SoundInstChangeOptions): void;
|
|
2840
|
+
/** Checks whether this sound is loaded. */
|
|
2841
|
+
isLoaded(): boolean;
|
|
2842
|
+
/** Checks whether this sound is playing. */
|
|
2843
|
+
isPlaying(): boolean;
|
|
2844
|
+
/**
|
|
2845
|
+
* Loads this sound using its registered defaults. Calls onReady() before Audio_Loaded is emitted.
|
|
2846
|
+
* @inlineType SoundInstLoadOptions
|
|
2847
|
+
* @param params - Loading overrides. Omitted settings use the registered values.
|
|
2848
|
+
*/
|
|
2849
|
+
load(params?: SoundInstLoadOptions): void;
|
|
2850
|
+
/**
|
|
2851
|
+
* Loads this sound and starts it after onReady() and Audio_Loaded.
|
|
2852
|
+
* Playback or change() calls in those handlers supersede automatic playback. The registered name cannot be overridden.
|
|
2853
|
+
* @inlineType SoundInstLoadAndStartOptions
|
|
2854
|
+
* @param params - Loading overrides and fade-in settings.
|
|
2855
|
+
*/
|
|
2856
|
+
loadAndStart(params?: SoundInstLoadAndStartOptions): void;
|
|
2857
|
+
/** Called after the audio source is loaded, configured, and attached, before Audio_Loaded is emitted. */
|
|
2858
|
+
protected onReady(): void;
|
|
2859
|
+
/**
|
|
2860
|
+
* Pauses this sound through {@link Audio.pause}.
|
|
2861
|
+
* @inlineType SoundInstPauseOptions
|
|
2862
|
+
* @param params - Optional fade-out settings.
|
|
2863
|
+
*/
|
|
2864
|
+
pause(params?: SoundInstPauseOptions): void;
|
|
2865
|
+
/** Unsubscribes a listener from this sound. */
|
|
2866
|
+
removeEventListener<TType extends AudioEvent['type']>(type: TType, listener: (event: AudioEvent & {
|
|
2867
|
+
type: TType;
|
|
2868
|
+
}) => void): void;
|
|
2869
|
+
/**
|
|
2870
|
+
* Resumes this sound through {@link Audio.resume}.
|
|
2871
|
+
* @inlineType SoundInstResumeOptions
|
|
2872
|
+
* @param params - Optional fade-in settings.
|
|
2873
|
+
*/
|
|
2874
|
+
resume(params?: SoundInstResumeOptions): void;
|
|
2875
|
+
/**
|
|
2876
|
+
* Starts this sound from the beginning through {@link Audio.start}.
|
|
2877
|
+
* @inlineType SoundInstStartOptions
|
|
2878
|
+
* @param params - Optional fade-in settings.
|
|
2879
|
+
*/
|
|
2880
|
+
start(params?: SoundInstStartOptions): void;
|
|
2881
|
+
/**
|
|
2882
|
+
* Stops this sound through {@link Audio.stop}.
|
|
2883
|
+
* @inlineType SoundInstStopOptions
|
|
2884
|
+
* @param params - Optional fade-out settings.
|
|
2885
|
+
*/
|
|
2886
|
+
stop(params?: SoundInstStopOptions): void;
|
|
2887
|
+
}
|
|
2888
|
+
|
|
2889
|
+
/** Volume, speed, and loop settings for an existing sound. Positional overrides are supplied when loading. Omitted settings remain unchanged. */
|
|
2890
|
+
declare interface SoundChangeOptions {
|
|
2891
|
+
/** Unique audio source name. */
|
|
2892
|
+
name: string;
|
|
2893
|
+
/** Target volume. */
|
|
2894
|
+
volume?: number;
|
|
2895
|
+
/** Target playback speed. Default playback speed: **1**. */
|
|
2896
|
+
speed?: number;
|
|
2897
|
+
/** Whether playback should loop. */
|
|
2898
|
+
loop?: boolean;
|
|
2899
|
+
/** Transition applied to the supplied numeric settings. Omitted: immediate. */
|
|
2900
|
+
fade?: SoundTween;
|
|
2901
|
+
}
|
|
2902
|
+
|
|
2903
|
+
/** Sound classes available for registration. */
|
|
2904
|
+
export declare type SoundClass = new (audio: Audio_2, name: string, params?: SoundInstParams) => Sound;
|
|
2905
|
+
|
|
2906
|
+
/** Sound class with optional loading defaults. */
|
|
2907
|
+
export declare type SoundEntry<TClass extends SoundClass = SoundClass> = TClass | {
|
|
2908
|
+
/** Sound class to instantiate. */
|
|
2909
|
+
class: TClass;
|
|
2910
|
+
/** Basic loading defaults merged with each load() or loadAndStart() call. The name is always the registration key. */
|
|
2911
|
+
params?: SoundInstParams;
|
|
2912
|
+
};
|
|
2913
|
+
|
|
2914
|
+
/** Settings for Sound.change(); the instance supplies its registered name. */
|
|
2915
|
+
declare type SoundInstChangeOptions = Omit<SoundChangeOptions, 'name'>;
|
|
2916
|
+
|
|
2917
|
+
/** Loading overrides and start fade merged with registered Sound defaults; the registered name is retained. */
|
|
2918
|
+
declare type SoundInstLoadAndStartOptions = Partial<Omit<SoundLoadAndStartOptions, 'name'>>;
|
|
2919
|
+
|
|
2920
|
+
/** Loading overrides merged with registered Sound defaults; the registered name is retained. */
|
|
2921
|
+
declare type SoundInstLoadOptions = Partial<Omit<SoundParams, 'name'>>;
|
|
2922
|
+
|
|
2923
|
+
/** Basic loading defaults for a registered sound. Its name is always the registration key. */
|
|
2924
|
+
export declare type SoundInstParams = Partial<Pick<SoundParams, 'url' | 'parent' | 'volume' | 'loop'>>;
|
|
2925
|
+
|
|
2926
|
+
/** Fade-out settings for Sound.pause(). */
|
|
2927
|
+
declare type SoundInstPauseOptions = Omit<SoundPauseOptions, 'name'>;
|
|
2928
|
+
|
|
2929
|
+
/** Fade-in settings for Sound.resume(). */
|
|
2930
|
+
declare type SoundInstResumeOptions = Omit<SoundResumeOptions, 'name'>;
|
|
2931
|
+
|
|
2932
|
+
/** Maps sound registrations to their concrete instances. */
|
|
2933
|
+
export declare type SoundInsts<T extends Record<string, SoundEntry>> = {
|
|
2934
|
+
[K in keyof T]: T[K] extends SoundClass ? InstanceType<T[K]> : T[K] extends {
|
|
2935
|
+
class: infer TClass extends SoundClass;
|
|
2936
|
+
} ? InstanceType<TClass> : never;
|
|
2937
|
+
};
|
|
2938
|
+
|
|
2939
|
+
/** Fade-in settings for Sound.start(), which restarts from the beginning. */
|
|
2940
|
+
declare type SoundInstStartOptions = Omit<SoundStartOptions, 'name'>;
|
|
2941
|
+
|
|
2942
|
+
/** Fade-out settings for Sound.stop(), which resets the position. */
|
|
2943
|
+
declare type SoundInstStopOptions = Omit<SoundStopOptions, 'name'>;
|
|
2944
|
+
|
|
2945
|
+
/** Loads a sound and starts it when loading is complete. */
|
|
2946
|
+
declare interface SoundLoadAndStartOptions extends SoundParams {
|
|
2947
|
+
/** Fade-in duration in seconds. Default: **0**. */
|
|
2948
|
+
time?: number;
|
|
2949
|
+
/** GSAP easing name. Default: **'none'**. */
|
|
2950
|
+
ease?: string;
|
|
2951
|
+
}
|
|
2952
|
+
|
|
2579
2953
|
/**
|
|
2580
2954
|
* Parameters used to load a global or positional audio source.
|
|
2581
2955
|
* @category Cfg
|
|
@@ -2583,7 +2957,7 @@ export declare interface SmaaCfg {
|
|
|
2583
2957
|
export declare interface SoundParams extends Partial<SoundParamsPos> {
|
|
2584
2958
|
/**
|
|
2585
2959
|
* Whether playback should loop.
|
|
2586
|
-
* @default
|
|
2960
|
+
* @default false
|
|
2587
2961
|
*/
|
|
2588
2962
|
loop?: boolean;
|
|
2589
2963
|
/**
|
|
@@ -2593,7 +2967,7 @@ export declare interface SoundParams extends Partial<SoundParamsPos> {
|
|
|
2593
2967
|
/**
|
|
2594
2968
|
* Scene object name or Obj3D component for positional audio. Use an empty string for global audio.
|
|
2595
2969
|
*/
|
|
2596
|
-
|
|
2970
|
+
parent: string | Obj3D;
|
|
2597
2971
|
/**
|
|
2598
2972
|
* Path or URL to the audio file.
|
|
2599
2973
|
*/
|
|
@@ -2647,6 +3021,53 @@ export declare interface SoundParamsPos {
|
|
|
2647
3021
|
coneOuterGain: number;
|
|
2648
3022
|
}
|
|
2649
3023
|
|
|
3024
|
+
/** Pauses a sound while retaining its position and playback speed. */
|
|
3025
|
+
declare interface SoundPauseOptions {
|
|
3026
|
+
/** Unique audio source name. */
|
|
3027
|
+
name: string;
|
|
3028
|
+
/** Fade-out before pausing. Omitted: immediate. */
|
|
3029
|
+
fadeOut?: SoundTween;
|
|
3030
|
+
}
|
|
3031
|
+
|
|
3032
|
+
/** Resumes a sound at its retained position and playback speed. */
|
|
3033
|
+
declare interface SoundResumeOptions {
|
|
3034
|
+
/** Unique audio source name. */
|
|
3035
|
+
name: string;
|
|
3036
|
+
/** Fade-in when resuming. Omitted: immediate. */
|
|
3037
|
+
fadeIn?: SoundTween;
|
|
3038
|
+
}
|
|
3039
|
+
|
|
3040
|
+
/** Typed sound instances exposed through App.sound for an Assets definition. */
|
|
3041
|
+
export declare type SoundsInsts<T extends Assets> = SoundInsts<NonNullable<T['sounds']>>;
|
|
3042
|
+
|
|
3043
|
+
/** Starts a loaded sound from the beginning. */
|
|
3044
|
+
declare interface SoundStartOptions {
|
|
3045
|
+
/** Unique audio source name. */
|
|
3046
|
+
name: string;
|
|
3047
|
+
/** Fade-in duration in seconds. Default: **0**. */
|
|
3048
|
+
time?: number;
|
|
3049
|
+
/** GSAP easing name. Default: **'none'**. */
|
|
3050
|
+
ease?: string;
|
|
3051
|
+
}
|
|
3052
|
+
|
|
3053
|
+
/** Stops a sound and resets its playback position. */
|
|
3054
|
+
declare interface SoundStopOptions {
|
|
3055
|
+
/** Unique audio source name. */
|
|
3056
|
+
name: string;
|
|
3057
|
+
/** Fade-out duration in seconds. Default: **0**. */
|
|
3058
|
+
time?: number;
|
|
3059
|
+
/** GSAP easing name. Default: **'none'**. */
|
|
3060
|
+
ease?: string;
|
|
3061
|
+
}
|
|
3062
|
+
|
|
3063
|
+
/** Transition settings for sound volume and playback speed. */
|
|
3064
|
+
export declare type SoundTween = {
|
|
3065
|
+
/** Fade duration in seconds. Defaults to `0` (immediate). */
|
|
3066
|
+
time?: number;
|
|
3067
|
+
/** GSAP easing name or expression. Defaults to `'none'` (linear). */
|
|
3068
|
+
ease?: string;
|
|
3069
|
+
};
|
|
3070
|
+
|
|
2650
3071
|
/**
|
|
2651
3072
|
* Controls contact shading with WebGL SSAO.
|
|
2652
3073
|
* @category Cfg
|
|
@@ -2707,7 +3128,10 @@ export declare interface SslCfg {
|
|
|
2707
3128
|
guiOpened: boolean;
|
|
2708
3129
|
}
|
|
2709
3130
|
|
|
2710
|
-
/**
|
|
3131
|
+
/**
|
|
3132
|
+
* Screen-space lighting modes available across rendering backends; 'none' disables screen-space lighting.
|
|
3133
|
+
* See {@link SslModeWebGl} and {@link SslModeWebGpu} for backend-specific values.
|
|
3134
|
+
*/
|
|
2711
3135
|
export declare type SslMode = SslModeWebGl | SslModeWebGpu;
|
|
2712
3136
|
|
|
2713
3137
|
/** Screen-space lighting modes available with WebGL. */
|
|
@@ -2856,27 +3280,23 @@ export declare interface StateMachineCfg {
|
|
|
2856
3280
|
inspector: boolean;
|
|
2857
3281
|
}
|
|
2858
3282
|
|
|
2859
|
-
/**
|
|
2860
|
-
* Controls which active animations on the same layer stop before a new animation plays.
|
|
2861
|
-
* - `'all'`: Stops all previous active actions.
|
|
2862
|
-
* - `'last'`: Stops only the most recently played previous active action.
|
|
2863
|
-
* - `'none'`: Keeps all previous active actions running.
|
|
2864
|
-
*/
|
|
2865
|
-
export declare type StopMode = 'all' | 'last' | 'none';
|
|
2866
|
-
|
|
2867
3283
|
/** Removes the listener associated with an event subscription. */
|
|
2868
3284
|
export declare type Unsubscribe = () => void;
|
|
2869
3285
|
|
|
2870
3286
|
/**
|
|
2871
3287
|
* Connects a custom HTML element to the scene lifecycle and object visibility.
|
|
3288
|
+
* @typeParam TScene - Scene Component registrations from `assets.scene`.
|
|
2872
3289
|
* @category Web Components
|
|
2873
3290
|
*/
|
|
2874
|
-
export declare class Web extends HTMLElement {
|
|
3291
|
+
export declare class Web<TScene extends Record<string, SceneEntry> = {}> extends HTMLElement {
|
|
2875
3292
|
/** Element that hosts the rendered canvas. */
|
|
2876
3293
|
canvas: Readonly<HTMLElement>;
|
|
2877
3294
|
cfg: Cfg;
|
|
2878
3295
|
events: Readonly<Events>;
|
|
2879
|
-
|
|
3296
|
+
/** Registered Scene Component instances, keyed by their Assets names. Use from `onReady()` onward. */
|
|
3297
|
+
comps: {
|
|
3298
|
+
scene: SceneInsts<TScene>;
|
|
3299
|
+
};
|
|
2880
3300
|
webs: Map<string, Web[]> | null;
|
|
2881
3301
|
private obj3DFollow;
|
|
2882
3302
|
private visible;
|
|
@@ -2894,7 +3314,7 @@ export declare class Web extends HTMLElement {
|
|
|
2894
3314
|
* @param params.obj - The `Obj3D` to follow in the scene.
|
|
2895
3315
|
*/
|
|
2896
3316
|
follow({ obj }: {
|
|
2897
|
-
obj: Obj3D
|
|
3317
|
+
obj: Obj3D;
|
|
2898
3318
|
}): void;
|
|
2899
3319
|
/**
|
|
2900
3320
|
* Applies the combined followed-object and overlap visibility.
|
|
@@ -2931,13 +3351,16 @@ export declare type WebClass = new () => Web;
|
|
|
2931
3351
|
|
|
2932
3352
|
/** Web component class with optional initial parameters. */
|
|
2933
3353
|
export declare type WebEntry<TClass extends WebClass = WebClass> = TClass | {
|
|
3354
|
+
/** Web component class to register. */
|
|
2934
3355
|
class: TClass;
|
|
3356
|
+
/** Initial values assigned to the registered web component. See {@link WebParams}. */
|
|
2935
3357
|
params?: WebParams;
|
|
2936
3358
|
};
|
|
2937
3359
|
|
|
3360
|
+
/** Web component events available to registered listeners. */
|
|
2938
3361
|
export declare type WebEvent = WebOverlapEvent | WebVisibleEvent;
|
|
2939
3362
|
|
|
2940
|
-
/**
|
|
3363
|
+
/** Parameters passed to `THREE.WebGPURenderer`. */
|
|
2941
3364
|
export declare type WebGpuRendererParams = NonNullable<ConstructorParameters<typeof THREE_WEBGPU_TYPE.WebGPURenderer>[0]>;
|
|
2942
3365
|
|
|
2943
3366
|
/**
|
|
@@ -2953,6 +3376,7 @@ export declare type WebInsts<T extends Record<string, WebEntry>> = {
|
|
|
2953
3376
|
|
|
2954
3377
|
/** @event Fired when a web component becomes overlapped or unobstructed. */
|
|
2955
3378
|
export declare interface WebOverlapEvent {
|
|
3379
|
+
/** Event identifier used to select listeners and state machine transitions. */
|
|
2956
3380
|
type: 'Web_Overlap_Changed';
|
|
2957
3381
|
/** The affected web component. */
|
|
2958
3382
|
web: Web;
|
|
@@ -2965,6 +3389,7 @@ export declare type WebParams = Record<string, unknown>;
|
|
|
2965
3389
|
|
|
2966
3390
|
/** @event Fired when a web component's combined object and overlap visibility changes. */
|
|
2967
3391
|
export declare interface WebVisibleEvent {
|
|
3392
|
+
/** Event identifier used to select listeners and state machine transitions. */
|
|
2968
3393
|
type: 'Web_Visible_Changed';
|
|
2969
3394
|
/** The affected web component. */
|
|
2970
3395
|
web: Web;
|
|
@@ -2974,6 +3399,7 @@ export declare interface WebVisibleEvent {
|
|
|
2974
3399
|
|
|
2975
3400
|
/** @event Fired when the window size changes. */
|
|
2976
3401
|
export declare interface WindowResizeEvent {
|
|
3402
|
+
/** Event identifier used to select listeners and state machine transitions. */
|
|
2977
3403
|
type: 'Window_Resize';
|
|
2978
3404
|
}
|
|
2979
3405
|
|