illutions 0.33.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 +49 -0
- package/dist/main.d.ts +852 -289
- 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
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { AnyEventObject } from 'xstate';
|
|
2
2
|
import { AnyStateMachine } from 'xstate';
|
|
3
|
+
import { degToRad } from 'three/src/math/MathUtils.js';
|
|
3
4
|
import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls.js';
|
|
5
|
+
import { radToDeg } from 'three/src/math/MathUtils.js';
|
|
4
6
|
import { ReflectorForSSRPass } from 'three/addons/objects/ReflectorForSSRPass.js';
|
|
5
7
|
import type * as THREE_TYPE from 'three';
|
|
6
8
|
import type * as THREE_WEBGPU_TYPE from 'three/webgpu';
|
|
@@ -17,7 +19,10 @@ export declare interface AaCfg {
|
|
|
17
19
|
guiOpened: boolean;
|
|
18
20
|
}
|
|
19
21
|
|
|
20
|
-
/**
|
|
22
|
+
/**
|
|
23
|
+
* Anti-aliasing modes available across rendering backends; 'none' disables smoothing.
|
|
24
|
+
* See {@link AaModeWebGl} and {@link AaModeWebGpu} for backend-specific values.
|
|
25
|
+
*/
|
|
21
26
|
export declare type AaMode = AaModeWebGl | AaModeWebGpu;
|
|
22
27
|
|
|
23
28
|
/** Anti-aliasing modes available with WebGL. */
|
|
@@ -26,8 +31,6 @@ export declare type AaModeWebGl = 'none' | 'fxaa' | 'smaa';
|
|
|
26
31
|
/** Anti-aliasing modes available with WebGPU. */
|
|
27
32
|
export declare type AaModeWebGpu = 'none' | 'fxaa' | 'smaa' | 'traa';
|
|
28
33
|
|
|
29
|
-
export declare type ActionFadeMode = 'in' | 'out';
|
|
30
|
-
|
|
31
34
|
/**
|
|
32
35
|
* Controls uniform ambient illumination.
|
|
33
36
|
* @category Cfg
|
|
@@ -52,6 +55,7 @@ export declare interface AmbientlightCfg {
|
|
|
52
55
|
|
|
53
56
|
/** @event Fired when an object or material color animation starts, completes, or is canceled. */
|
|
54
57
|
export declare interface AnimEvent {
|
|
58
|
+
/** Event identifier used to select listeners and state machine transitions. */
|
|
55
59
|
type: 'Anim_Complete' | 'Anim_Start' | 'Anim_Cancel';
|
|
56
60
|
/** The name of the `THREE.Object3D` whose animation changed state. */
|
|
57
61
|
objName: string;
|
|
@@ -61,6 +65,7 @@ export declare interface AnimEvent {
|
|
|
61
65
|
|
|
62
66
|
/** @event Fired when a material color or numeric property animation starts, completes, or is canceled. */
|
|
63
67
|
export declare interface AnimMaterialEvent {
|
|
68
|
+
/** Event identifier used to select listeners and state machine transitions. */
|
|
64
69
|
type: 'Anim_Material_Complete' | 'Anim_Material_Start' | 'Anim_Material_Cancel';
|
|
65
70
|
/** The name of the material whose animation changed state. */
|
|
66
71
|
materialName: string;
|
|
@@ -70,31 +75,94 @@ export declare interface AnimMaterialEvent {
|
|
|
70
75
|
values: Record<string, number | string>;
|
|
71
76
|
}
|
|
72
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
|
+
|
|
73
134
|
/**
|
|
74
135
|
* Starts the application and provides access to its components and runtime systems.
|
|
75
136
|
* @category Core
|
|
76
137
|
*/
|
|
77
|
-
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. */
|
|
78
140
|
readonly audio: Audio_2;
|
|
141
|
+
/** Controls any loaded model clip by name, without requiring asset registration. */
|
|
142
|
+
readonly clips: Clips;
|
|
79
143
|
private readonly ctrl;
|
|
80
144
|
readonly engine: Engine;
|
|
81
|
-
private readonly model;
|
|
82
145
|
readonly envCtrls: EnvCtrls;
|
|
83
146
|
readonly events: Events;
|
|
84
|
-
readonly orbitCtrls: OrbitCtrls;
|
|
85
147
|
readonly fpvCtrls: FpvCtrls;
|
|
148
|
+
private readonly model;
|
|
149
|
+
readonly orbitCtrls: OrbitCtrls;
|
|
86
150
|
readonly raycast: Raycast;
|
|
87
151
|
readonly scene: Scene;
|
|
88
152
|
readonly stateMachine: StateMachine;
|
|
89
153
|
private readonly webCtrls;
|
|
90
154
|
private cam3D;
|
|
91
|
-
|
|
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>;
|
|
92
160
|
private objs3DMap;
|
|
93
161
|
private websMap;
|
|
94
162
|
/**
|
|
95
163
|
* Starts the application, loads the initial scene resources, and connects components and the optional state machine. Startup errors are caught and logged.
|
|
96
164
|
* @param cfg - Startup settings. Defaults to the exported `cfg`.
|
|
97
|
-
* @param
|
|
165
|
+
* @param assets - Scene Component, Web Component, Clip, and Sound class registrations with optional parameters. Default: **empty object**
|
|
98
166
|
* @param createStateMachine - Factory function that receives the fully created `App` instance and returns a state machine.
|
|
99
167
|
*
|
|
100
168
|
* @returns Resolves after startup completes or a startup error is caught.
|
|
@@ -102,11 +170,35 @@ export declare class App<TComps extends Comps = {}> {
|
|
|
102
170
|
* **Example**
|
|
103
171
|
* {@includeCode ../../../apps-doc/examples/app-run.ts}
|
|
104
172
|
*/
|
|
105
|
-
static run<
|
|
173
|
+
static run<TAssets extends Assets = {}>(cfg?: Cfg, assets?: TAssets, createStateMachine?: (app: App<TAssets>) => AnyStateMachine): Promise<void>;
|
|
106
174
|
}
|
|
107
175
|
|
|
108
176
|
/**
|
|
109
|
-
*
|
|
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.
|
|
110
202
|
* @category Core
|
|
111
203
|
*/
|
|
112
204
|
declare class Audio_2 {
|
|
@@ -116,78 +208,75 @@ declare class Audio_2 {
|
|
|
116
208
|
private readonly events;
|
|
117
209
|
private readonly params;
|
|
118
210
|
private readonly scene;
|
|
119
|
-
private readonly
|
|
211
|
+
private readonly soundActions;
|
|
212
|
+
private readonly soundInsts;
|
|
120
213
|
private attachSoundTo;
|
|
121
|
-
|
|
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;
|
|
122
223
|
/**
|
|
123
224
|
* Returns the shared positional sound defaults.
|
|
124
225
|
*/
|
|
125
226
|
get(): SoundParamsPos;
|
|
227
|
+
private emitEvent;
|
|
228
|
+
private getSound;
|
|
126
229
|
/**
|
|
127
230
|
* Checks whether a named sound is loaded.
|
|
128
231
|
* @param params - Sound selection.
|
|
129
|
-
* @param params.name - Sound name.
|
|
130
232
|
*/
|
|
131
233
|
isLoaded({ name }: {
|
|
132
234
|
name: string;
|
|
133
235
|
}): boolean;
|
|
134
236
|
/**
|
|
135
|
-
* 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.
|
|
136
238
|
* @param params - Sound selection.
|
|
137
|
-
* @param params.name - Sound name.
|
|
138
239
|
*/
|
|
139
240
|
isPlaying({ name }: {
|
|
140
241
|
name: string;
|
|
141
242
|
}): boolean;
|
|
142
243
|
private loadSound;
|
|
143
244
|
/**
|
|
144
|
-
* 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
|
|
145
248
|
* @param params - The sound options.
|
|
146
249
|
*/
|
|
147
250
|
load(params: SoundParams): void;
|
|
148
251
|
/**
|
|
149
252
|
* Loads an audio file and plays it automatically when loading is complete.
|
|
150
|
-
*
|
|
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
|
|
151
257
|
* @param params - The sound options.
|
|
152
|
-
* @param params.time - Fade-in duration for this start in seconds. Defaults to 0 (no fade).
|
|
153
|
-
* @param params.ease - GSAP easing for the fade-in. Defaults to linear ('none').
|
|
154
258
|
*/
|
|
155
|
-
|
|
156
|
-
time?: number;
|
|
157
|
-
ease?: string;
|
|
158
|
-
} & SoundParams): void;
|
|
259
|
+
loadAndStart({ time, ease, ...params }: SoundLoadAndStartOptions): void;
|
|
159
260
|
/**
|
|
160
|
-
*
|
|
161
|
-
*
|
|
162
|
-
*
|
|
163
|
-
* @param params - Sound selection.
|
|
164
|
-
* @param params.name - Loaded sound name.
|
|
165
|
-
* @param params.time - Fade-in duration in seconds. Defaults to 0 (no fade).
|
|
166
|
-
* @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}.
|
|
167
264
|
*/
|
|
168
|
-
|
|
169
|
-
name: string;
|
|
170
|
-
time?: number;
|
|
171
|
-
ease?: string;
|
|
172
|
-
}): void;
|
|
265
|
+
pause({ name, fadeOut }: SoundPauseOptions): void;
|
|
173
266
|
/**
|
|
174
|
-
*
|
|
175
|
-
* @
|
|
176
|
-
* @param params
|
|
177
|
-
* @param params.time - Fade-out duration in seconds. Defaults to 0 (no fade).
|
|
178
|
-
* @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}.
|
|
179
270
|
*/
|
|
180
|
-
|
|
181
|
-
name: string;
|
|
182
|
-
time?: number;
|
|
183
|
-
ease?: string;
|
|
184
|
-
}): void;
|
|
271
|
+
resume({ name, fadeIn }: SoundResumeOptions): void;
|
|
185
272
|
/**
|
|
186
|
-
* 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.
|
|
187
274
|
*/
|
|
188
|
-
|
|
275
|
+
resumeContext(): void;
|
|
276
|
+
private runSound;
|
|
189
277
|
/**
|
|
190
278
|
* Updates shared positional defaults without replacing individual sound overrides.
|
|
279
|
+
* @inlineType SoundParamsPos
|
|
191
280
|
* @param params - Positional defaults to update; omitted values remain unchanged.
|
|
192
281
|
*/
|
|
193
282
|
set(params: Partial<SoundParamsPos>): void;
|
|
@@ -201,28 +290,21 @@ declare class Audio_2 {
|
|
|
201
290
|
setListener({ obj }: {
|
|
202
291
|
obj: string | Cam3D;
|
|
203
292
|
}): void;
|
|
293
|
+
private setSoundParamsPositional;
|
|
204
294
|
/**
|
|
205
|
-
*
|
|
206
|
-
*
|
|
207
|
-
* @
|
|
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.
|
|
208
299
|
*/
|
|
209
|
-
|
|
210
|
-
name: string;
|
|
211
|
-
volume?: number;
|
|
212
|
-
} & Partial<SoundParamsPos>): void;
|
|
213
|
-
private setSoundParamsPos;
|
|
300
|
+
start({ name, time, ease }: SoundStartOptions): void;
|
|
214
301
|
/**
|
|
215
|
-
* Stops a
|
|
216
|
-
* @
|
|
217
|
-
* @param params
|
|
218
|
-
* @param params.time - Fade-out duration in seconds. Defaults to 0 (no fade).
|
|
219
|
-
* @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.
|
|
220
305
|
*/
|
|
221
|
-
stop({ name, time, ease }:
|
|
222
|
-
|
|
223
|
-
time?: number;
|
|
224
|
-
ease?: string;
|
|
225
|
-
}): void;
|
|
306
|
+
stop({ name, time, ease }: SoundStopOptions): void;
|
|
307
|
+
private tweenSound;
|
|
226
308
|
/**
|
|
227
309
|
* Runs an extension callback immediately with access to the public API.
|
|
228
310
|
* @param extension - Callback receiving this `Audio` instance.
|
|
@@ -253,9 +335,10 @@ export declare interface AudioCfg extends SoundParamsPos {
|
|
|
253
335
|
delayLoadSound: number;
|
|
254
336
|
}
|
|
255
337
|
|
|
256
|
-
/** @event Fired when a sound finishes loading, starts
|
|
338
|
+
/** @event Fired when a sound finishes loading, starts, pauses, resumes, finishes naturally, or is stopped. */
|
|
257
339
|
export declare interface AudioEvent {
|
|
258
|
-
|
|
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';
|
|
259
342
|
/** The unique name assigned to the sound. */
|
|
260
343
|
soundName: string;
|
|
261
344
|
}
|
|
@@ -284,6 +367,7 @@ export declare class Cam3D extends Obj3D {
|
|
|
284
367
|
/** Reference to the original target `THREE.Object3D` loaded from the GLTF scene. */
|
|
285
368
|
targetGltf: THREE_TYPE.Object3D | null;
|
|
286
369
|
private readonly tmpVec;
|
|
370
|
+
animVelRotTo(params: Parameters<Obj3D['animVelRotTo']>[0]): void;
|
|
287
371
|
/**
|
|
288
372
|
* Called when a matching GLTF camera is found. Adopts its projection and world transform when the camera types match.
|
|
289
373
|
* @param objGltf - The GLTF `THREE.Camera` object.
|
|
@@ -315,8 +399,11 @@ export declare interface CamBaseCfg {
|
|
|
315
399
|
* @default { x: 0, y: 0, z: 0 }
|
|
316
400
|
*/
|
|
317
401
|
lookAt: {
|
|
402
|
+
/** X coordinate in scene units. */
|
|
318
403
|
x: number;
|
|
404
|
+
/** Y coordinate in scene units. */
|
|
319
405
|
y: number;
|
|
406
|
+
/** Z coordinate in scene units. */
|
|
320
407
|
z: number;
|
|
321
408
|
};
|
|
322
409
|
/**
|
|
@@ -324,8 +411,11 @@ export declare interface CamBaseCfg {
|
|
|
324
411
|
* @default { x: 0, y: 0.5, z: 0.5 }
|
|
325
412
|
*/
|
|
326
413
|
position: {
|
|
414
|
+
/** X coordinate in scene units. */
|
|
327
415
|
x: number;
|
|
416
|
+
/** Y coordinate in scene units. */
|
|
328
417
|
y: number;
|
|
418
|
+
/** Z coordinate in scene units. */
|
|
329
419
|
z: number;
|
|
330
420
|
};
|
|
331
421
|
}
|
|
@@ -387,6 +477,7 @@ export declare interface CamPerspectiveCfg {
|
|
|
387
477
|
|
|
388
478
|
/** @event Fired when a key is pressed or released while the canvas has focus. */
|
|
389
479
|
export declare interface CanvasKeyEvent {
|
|
480
|
+
/** Event identifier used to select listeners and state machine transitions. */
|
|
390
481
|
type: 'Canvas_Key_Down' | 'Canvas_Key_Up';
|
|
391
482
|
/** Native keyboard event from the canvas interaction. */
|
|
392
483
|
event: KeyboardEvent;
|
|
@@ -394,6 +485,7 @@ export declare interface CanvasKeyEvent {
|
|
|
394
485
|
|
|
395
486
|
/** @event Fired when the pointer clicks, enters, or leaves the canvas. */
|
|
396
487
|
export declare interface CanvasPointerEvent {
|
|
488
|
+
/** Event identifier used to select listeners and state machine transitions. */
|
|
397
489
|
type: 'Canvas_Click' | 'Canvas_Pointer_Enter' | 'Canvas_Pointer_Leave';
|
|
398
490
|
/** Native pointer event from the canvas interaction. */
|
|
399
491
|
event: PointerEvent;
|
|
@@ -443,22 +535,301 @@ export declare const cfg: Cfg;
|
|
|
443
535
|
|
|
444
536
|
/** Configuration values accepted by `setCfg`. */
|
|
445
537
|
export declare type CfgSet = DeepPartial<Cfg> & {
|
|
538
|
+
/** Partial rendering settings. See {@link RenderCfg}. */
|
|
446
539
|
render?: DeepPartial<RenderCfg> & {
|
|
540
|
+
/** Rendering profiles restricted to compatible effect combinations. See {@link RenderProfileValidCfg}. */
|
|
447
541
|
profile?: RenderProfileValidCfg;
|
|
448
542
|
};
|
|
449
543
|
};
|
|
450
544
|
|
|
451
|
-
/**
|
|
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. */
|
|
452
642
|
export declare interface ClipEvent {
|
|
453
|
-
|
|
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';
|
|
454
645
|
/** The name of the affected `THREE.AnimationClip`. */
|
|
455
646
|
clipName: string;
|
|
456
647
|
/** The associated animation action, when available. */
|
|
457
648
|
action?: THREE_TYPE.AnimationAction;
|
|
458
649
|
/** Whether the clip weight is fading in or out. */
|
|
459
|
-
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;
|
|
460
655
|
}
|
|
461
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
|
+
|
|
462
833
|
/**
|
|
463
834
|
* Uses a `Mesh3D` for pointer picking or occlusion and optionally maps raycast events to another rendered mesh.
|
|
464
835
|
* @category Scene Components
|
|
@@ -483,20 +854,6 @@ export declare interface Coll3DParams extends Obj3DParams {
|
|
|
483
854
|
occluder?: boolean;
|
|
484
855
|
}
|
|
485
856
|
|
|
486
|
-
/**
|
|
487
|
-
* Groups the optional scene and web component definitions used by the app.
|
|
488
|
-
*
|
|
489
|
-
* @typeParam TScene - Record of named scene component classes or entries with initial parameters.
|
|
490
|
-
* @typeParam TWeb - Record of named web component classes or entries with initial parameters.
|
|
491
|
-
*
|
|
492
|
-
* @example
|
|
493
|
-
* type MyComps = Comps<{ cube: typeof Cube }, { marker: typeof Marker }>;
|
|
494
|
-
*/
|
|
495
|
-
export declare type Comps<TScene extends Record<string, SceneEntry> = {}, TWeb extends Record<string, WebEntry> = {}> = {
|
|
496
|
-
scene?: TScene;
|
|
497
|
-
web?: TWeb;
|
|
498
|
-
};
|
|
499
|
-
|
|
500
857
|
/**
|
|
501
858
|
* Shared component settings.
|
|
502
859
|
* @category Cfg
|
|
@@ -507,8 +864,10 @@ export declare interface CompsCfg {
|
|
|
507
864
|
}
|
|
508
865
|
|
|
509
866
|
/** Registered scene components and web component instances available at runtime. */
|
|
510
|
-
export declare type CompsInsts<T extends
|
|
867
|
+
export declare type CompsInsts<T extends Assets> = {
|
|
868
|
+
/** Scene component instances keyed by registration name. */
|
|
511
869
|
scene: SceneInsts<NonNullable<T['scene']>>;
|
|
870
|
+
/** Web component instance arrays keyed by registration name. */
|
|
512
871
|
web: WebInsts<NonNullable<T['web']>>;
|
|
513
872
|
};
|
|
514
873
|
|
|
@@ -524,29 +883,35 @@ export declare interface CompsOverlapCfg {
|
|
|
524
883
|
padding: number;
|
|
525
884
|
}
|
|
526
885
|
|
|
886
|
+
/** Coordinate space used for transformations. */
|
|
887
|
+
export declare type CoordinateSpace = 'parent' | 'local' | 'world';
|
|
888
|
+
|
|
527
889
|
/**
|
|
528
890
|
* Controls diagnostic console output.
|
|
529
891
|
* @category Cfg
|
|
530
892
|
*/
|
|
531
893
|
export declare interface DebugCfg {
|
|
532
894
|
/**
|
|
533
|
-
*
|
|
534
|
-
*
|
|
535
|
-
* - `'none'`: No debug messages are logged.
|
|
536
|
-
* - `'xstate'`: Only logs events that were accepted by the state machine.
|
|
537
|
-
* - `'all'`: Logs all debug messages.
|
|
895
|
+
* See {@link DebugLog}.
|
|
538
896
|
* @default 'xstate'
|
|
539
897
|
*/
|
|
540
898
|
log: DebugLog;
|
|
541
899
|
}
|
|
542
900
|
|
|
543
|
-
/**
|
|
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
|
+
*/
|
|
544
907
|
export declare type DebugLog = 'none' | 'xstate' | 'all';
|
|
545
908
|
|
|
546
909
|
declare type DeepPartial<T> = T extends readonly unknown[] ? T : T extends object ? {
|
|
547
910
|
[P in keyof T]?: DeepPartial<T[P]>;
|
|
548
911
|
} : T;
|
|
549
912
|
|
|
913
|
+
export { degToRad }
|
|
914
|
+
|
|
550
915
|
/**
|
|
551
916
|
* Renders the scene and controls post-processing and adaptive performance.
|
|
552
917
|
* @category Core
|
|
@@ -554,6 +919,7 @@ declare type DeepPartial<T> = T extends readonly unknown[] ? T : T extends objec
|
|
|
554
919
|
export declare class Engine {
|
|
555
920
|
private readonly cam3D;
|
|
556
921
|
private readonly cfg;
|
|
922
|
+
private readonly clips;
|
|
557
923
|
private readonly events;
|
|
558
924
|
private readonly modules;
|
|
559
925
|
private readonly objs3D;
|
|
@@ -594,14 +960,14 @@ export declare class Engine {
|
|
|
594
960
|
*/
|
|
595
961
|
addOnFrameUpdate(cb: (deltaTime: number) => void): void;
|
|
596
962
|
/**
|
|
597
|
-
* Switches edge smoothing at runtime, loading the selected effect when needed.
|
|
598
|
-
* @param aaMode -
|
|
963
|
+
* Switches edge smoothing at runtime, loading the selected effect when needed.
|
|
964
|
+
* @param aaMode - See {@link AaMode}.
|
|
599
965
|
*/
|
|
600
966
|
enableAaMode(aaMode: AaMode): Promise<void>;
|
|
601
967
|
/**
|
|
602
|
-
* Switches screen-space lighting at runtime.
|
|
968
|
+
* Switches screen-space lighting at runtime.
|
|
603
969
|
* SSGI requires TRAA, a perspective camera, and compatible WebGPU hardware.
|
|
604
|
-
* @param sslMode -
|
|
970
|
+
* @param sslMode - See {@link SslMode}.
|
|
605
971
|
*/
|
|
606
972
|
enableSslMode(sslMode: SslMode): Promise<void>;
|
|
607
973
|
/**
|
|
@@ -662,10 +1028,10 @@ export declare class EnvCtrls {
|
|
|
662
1028
|
private disposePrevBgd;
|
|
663
1029
|
private disposeText;
|
|
664
1030
|
/**
|
|
665
|
-
* Loads and applies
|
|
1031
|
+
* Loads and applies the configured environment maps. See {@link EnvCtrlsCfg}.
|
|
666
1032
|
* @param params - Optional environment loading parameters. If provided, both `type` and `map` are required.
|
|
667
|
-
* @param params.type -
|
|
668
|
-
* @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`.
|
|
669
1035
|
*/
|
|
670
1036
|
enable(params?: {
|
|
671
1037
|
type: EnvCtrlsCfg["type"];
|
|
@@ -674,7 +1040,7 @@ export declare class EnvCtrls {
|
|
|
674
1040
|
/** Removes environment lighting and background maps, cancels pending updates, and stops rotation. */
|
|
675
1041
|
disable(): void;
|
|
676
1042
|
/**
|
|
677
|
-
* Returns a snapshot of
|
|
1043
|
+
* Returns a snapshot of rotation, rotation speed, intensities, and background blurriness. See {@link EnvCtrlsCfg}.
|
|
678
1044
|
*/
|
|
679
1045
|
get(): Partial<EnvCtrlsCfg>;
|
|
680
1046
|
/**
|
|
@@ -685,7 +1051,7 @@ export declare class EnvCtrls {
|
|
|
685
1051
|
private loadText;
|
|
686
1052
|
/**
|
|
687
1053
|
* Updates supported environment control values at runtime.
|
|
688
|
-
* @param params -
|
|
1054
|
+
* @param params - Supported runtime settings to change; omitted values remain unchanged. See {@link EnvCtrlsCfg}.
|
|
689
1055
|
*/
|
|
690
1056
|
set(params: Partial<EnvCtrlsCfg>): void;
|
|
691
1057
|
private setEnv;
|
|
@@ -739,16 +1105,19 @@ export declare interface EnvCtrlsCfg {
|
|
|
739
1105
|
*/
|
|
740
1106
|
map: string[];
|
|
741
1107
|
/**
|
|
742
|
-
* Environment and background rotation values in
|
|
1108
|
+
* Environment and background rotation values in radians.
|
|
743
1109
|
* @default { x: 0, y: 0, z: 0 }
|
|
744
1110
|
*/
|
|
745
1111
|
rotation: {
|
|
1112
|
+
/** Rotation around the X axis in radians. */
|
|
746
1113
|
x: number;
|
|
1114
|
+
/** Rotation around the Y axis in radians. */
|
|
747
1115
|
y: number;
|
|
1116
|
+
/** Rotation around the Z axis in radians. */
|
|
748
1117
|
z: number;
|
|
749
1118
|
};
|
|
750
1119
|
/**
|
|
751
|
-
* Environment and background rotation speed in
|
|
1120
|
+
* Environment and background rotation speed in radians per second.
|
|
752
1121
|
* @default 0
|
|
753
1122
|
*/
|
|
754
1123
|
rotationSpeed: number;
|
|
@@ -761,6 +1130,7 @@ export declare interface EnvCtrlsCfg {
|
|
|
761
1130
|
|
|
762
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. */
|
|
763
1132
|
export declare interface EnvLoadedEvent {
|
|
1133
|
+
/** Event identifier used to select listeners and state machine transitions. */
|
|
764
1134
|
type: 'Env_Loaded';
|
|
765
1135
|
}
|
|
766
1136
|
|
|
@@ -782,13 +1152,6 @@ export declare class Events {
|
|
|
782
1152
|
send(event: AnyEventObject, log?: string): void;
|
|
783
1153
|
}
|
|
784
1154
|
|
|
785
|
-
/**
|
|
786
|
-
* Controls what happens after the final animation loop.
|
|
787
|
-
* - `'hold'`: Keeps the action enabled and holds its final pose.
|
|
788
|
-
* - `'fadeOut'`: Fades out over `fadeTimeFinish` seconds, or stops immediately when the duration is `0`.
|
|
789
|
-
*/
|
|
790
|
-
export declare type FinishMode = 'hold' | 'fadeOut';
|
|
791
|
-
|
|
792
1155
|
/**
|
|
793
1156
|
* Blends distant objects into the fog color.
|
|
794
1157
|
* @category Cfg
|
|
@@ -966,6 +1329,7 @@ export declare interface FpvCtrlsCfg {
|
|
|
966
1329
|
|
|
967
1330
|
/** @event Fired when first-person controls are enabled, disabled, disposed, locked, or unlocked. */
|
|
968
1331
|
export declare interface FpvCtrlsEvent {
|
|
1332
|
+
/** Event identifier used to select listeners and state machine transitions. */
|
|
969
1333
|
type: 'FpvCtrls_Disabled' | 'FpvCtrls_Disposed' | 'FpvCtrls_Enabled' | 'FpvCtrls_Lock' | 'FpvCtrls_Unlock';
|
|
970
1334
|
}
|
|
971
1335
|
|
|
@@ -1322,6 +1686,7 @@ export declare interface MeshCfg {
|
|
|
1322
1686
|
* @category Cfg
|
|
1323
1687
|
*/
|
|
1324
1688
|
export declare interface ModelCfg {
|
|
1689
|
+
/** Mesh and texture compression formats used by the model assets. */
|
|
1325
1690
|
compress: {
|
|
1326
1691
|
/**
|
|
1327
1692
|
* Mesh compression used by the GLTF/GLB file.
|
|
@@ -1353,6 +1718,7 @@ export declare interface ModelCfg {
|
|
|
1353
1718
|
|
|
1354
1719
|
/** @event Fired when model loading fails. */
|
|
1355
1720
|
export declare interface ModelErrorEvent {
|
|
1721
|
+
/** Event identifier used to select listeners and state machine transitions. */
|
|
1356
1722
|
type: 'Model_Error';
|
|
1357
1723
|
/** The caught error object. */
|
|
1358
1724
|
error: Error;
|
|
@@ -1374,6 +1740,7 @@ export declare interface ModelLoadingEvent {
|
|
|
1374
1740
|
|
|
1375
1741
|
/** @event Fired after the final progressive model has been applied and rendered. */
|
|
1376
1742
|
export declare interface ModelReadyEvent {
|
|
1743
|
+
/** Event identifier used to select listeners and state machine transitions. */
|
|
1377
1744
|
type: 'Model_Ready';
|
|
1378
1745
|
}
|
|
1379
1746
|
|
|
@@ -1394,10 +1761,9 @@ export declare class Obj3D {
|
|
|
1394
1761
|
/** @public */
|
|
1395
1762
|
protected canvas: HTMLElement;
|
|
1396
1763
|
protected cfg: Cfg;
|
|
1397
|
-
protected name: string;
|
|
1398
1764
|
/** The managed `THREE.Object3D` instance for this object. It is `null` until a scene object is assigned. */
|
|
1399
1765
|
obj: THREE_TYPE.Object3D | null;
|
|
1400
|
-
/** 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. */
|
|
1401
1767
|
protected objs3D: Map<string, Obj3D> | null;
|
|
1402
1768
|
/**
|
|
1403
1769
|
* Active renderer for custom rendering integrations.
|
|
@@ -1409,23 +1775,31 @@ export declare class Obj3D {
|
|
|
1409
1775
|
* @public
|
|
1410
1776
|
*/
|
|
1411
1777
|
scene: Scene;
|
|
1412
|
-
private
|
|
1413
|
-
private
|
|
1778
|
+
private coordTransl;
|
|
1779
|
+
private coordRot;
|
|
1780
|
+
private readonly tweensVel;
|
|
1781
|
+
private readonly posNdc;
|
|
1782
|
+
private readonly posScreen;
|
|
1414
1783
|
private posScreenLast;
|
|
1415
|
-
private posWorld;
|
|
1784
|
+
private readonly posWorld;
|
|
1416
1785
|
private posWorldLast;
|
|
1417
|
-
private posCamWorld;
|
|
1786
|
+
private readonly posCamWorld;
|
|
1418
1787
|
private posWorldOccl;
|
|
1419
1788
|
private posCamWorldOccl;
|
|
1420
|
-
private
|
|
1421
|
-
private
|
|
1422
|
-
private
|
|
1423
|
-
private
|
|
1789
|
+
private readonly orientWorld;
|
|
1790
|
+
private orientWorldLast;
|
|
1791
|
+
private readonly orientAnglesWorld;
|
|
1792
|
+
private readonly velQuat;
|
|
1793
|
+
private readonly velRotAxis;
|
|
1794
|
+
private readonly velRotWorldToParent;
|
|
1795
|
+
private readonly velTranslFrame;
|
|
1796
|
+
private readonly velTranslWorldToParent;
|
|
1424
1797
|
private inFrustum;
|
|
1425
1798
|
private inFrustumLast;
|
|
1426
|
-
private visibleLast;
|
|
1427
1799
|
private occluded;
|
|
1428
1800
|
private objHidden;
|
|
1801
|
+
private visible;
|
|
1802
|
+
private visibleLast;
|
|
1429
1803
|
private visibleBeforeHidden;
|
|
1430
1804
|
/**
|
|
1431
1805
|
* Subscribes to an object event.
|
|
@@ -1436,11 +1810,93 @@ export declare class Obj3D {
|
|
|
1436
1810
|
addEventListener<TType extends Obj3DEvent['type']>(type: TType, listener: (event: Extract<Obj3DEvent, {
|
|
1437
1811
|
type: TType;
|
|
1438
1812
|
}>) => void): Unsubscribe;
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1813
|
+
/**
|
|
1814
|
+
* Animates this object's orientation in radians through {@link Scene.animRotTo}.
|
|
1815
|
+
* @inlineType ObjRotOptions
|
|
1816
|
+
* @param params - Target orientation and animation settings, without an object parameter.
|
|
1817
|
+
*/
|
|
1818
|
+
animRotTo({ x, y, z, path, order, space, time, ease }: ObjRotOptions): void;
|
|
1819
|
+
/**
|
|
1820
|
+
* Animates this object's scale through {@link Scene.animScaleTo}.
|
|
1821
|
+
* @inlineType ObjScaleOptions
|
|
1822
|
+
* @param params - Target scale and animation settings, without an object parameter.
|
|
1823
|
+
*/
|
|
1824
|
+
animScaleTo({ x, y, z, time, ease }: ObjScaleOptions): void;
|
|
1825
|
+
/**
|
|
1826
|
+
* Animates this object's position through {@link Scene.animTranslTo}.
|
|
1827
|
+
* @inlineType ObjTranslOptions
|
|
1828
|
+
* @param params - Target position and animation settings, without an object parameter.
|
|
1829
|
+
*/
|
|
1830
|
+
animTranslTo({ x, y, z, space, time, ease }: ObjTranslOptions): void;
|
|
1831
|
+
/**
|
|
1832
|
+
* Animates angular velocity in radians per second. World rotation requires uniformly scaled parents.
|
|
1833
|
+
* @param params - Target angular velocity and animation settings.
|
|
1834
|
+
* @param params.vx - Target velocity around X; omitted axes remain unchanged.
|
|
1835
|
+
* @param params.vy - Target velocity around Y.
|
|
1836
|
+
* @param params.vz - Target velocity around Z.
|
|
1837
|
+
* @param params.space - Coordinate space. Default: **'local'**
|
|
1838
|
+
* @param params.time - Duration in seconds. Default: **0** (immediate).
|
|
1839
|
+
* @param params.ease - GSAP easing. Default: **'none'** (linear).
|
|
1840
|
+
* @remarks
|
|
1841
|
+
* Emits {@link AnimEvent}: `Anim_Start`, `Anim_Complete`, or `Anim_Cancel` when replaced.
|
|
1842
|
+
* Completion means the target velocity is reached; motion continues unless the target is zero.
|
|
1843
|
+
* With `time: 0`, start and completion are emitted immediately.
|
|
1844
|
+
*/
|
|
1845
|
+
animVelRotTo({ vx, vy, vz, space, time, ease }: {
|
|
1846
|
+
vx?: number;
|
|
1847
|
+
vy?: number;
|
|
1848
|
+
vz?: number;
|
|
1849
|
+
space?: CoordinateSpace;
|
|
1850
|
+
time?: number;
|
|
1851
|
+
ease?: string;
|
|
1852
|
+
}): void;
|
|
1853
|
+
/**
|
|
1854
|
+
* Animates additive local scale velocity in scale units per second.
|
|
1855
|
+
* @param params - Target scale velocity and animation settings.
|
|
1856
|
+
* @param params.vx - Target velocity along X; omitted axes remain unchanged.
|
|
1857
|
+
* @param params.vy - Target velocity along Y.
|
|
1858
|
+
* @param params.vz - Target velocity along Z.
|
|
1859
|
+
* @param params.time - Duration in seconds. Default: **0** (immediate).
|
|
1860
|
+
* @param params.ease - GSAP easing. Default: **'none'** (linear).
|
|
1861
|
+
* @remarks
|
|
1862
|
+
* Emits {@link AnimEvent}: `Anim_Start`, `Anim_Complete`, or `Anim_Cancel` when replaced.
|
|
1863
|
+
* Completion means the target velocity is reached; motion continues unless the target is zero.
|
|
1864
|
+
* With `time: 0`, start and completion are emitted immediately.
|
|
1865
|
+
*/
|
|
1866
|
+
animVelScaleTo({ vx, vy, vz, time, ease }: {
|
|
1867
|
+
vx?: number;
|
|
1868
|
+
vy?: number;
|
|
1869
|
+
vz?: number;
|
|
1870
|
+
time?: number;
|
|
1871
|
+
ease?: string;
|
|
1872
|
+
}): void;
|
|
1873
|
+
private animVelTo;
|
|
1874
|
+
/**
|
|
1875
|
+
* Animates translation velocity in coordinate units per second. Parent scaling affects parent and local movement.
|
|
1876
|
+
* @param params - Target translation velocity and animation settings.
|
|
1877
|
+
* @param params.vx - Target velocity along X; omitted axes remain unchanged.
|
|
1878
|
+
* @param params.vy - Target velocity along Y.
|
|
1879
|
+
* @param params.vz - Target velocity along Z.
|
|
1880
|
+
* @param params.space - Coordinate space. Default: **'parent'**
|
|
1881
|
+
* @param params.time - Duration in seconds. Default: **0** (immediate).
|
|
1882
|
+
* @param params.ease - GSAP easing. Default: **'none'** (linear).
|
|
1883
|
+
* @remarks
|
|
1884
|
+
* Emits {@link AnimEvent}: `Anim_Start`, `Anim_Complete`, or `Anim_Cancel` when replaced.
|
|
1885
|
+
* Completion means the target velocity is reached; motion continues unless the target is zero.
|
|
1886
|
+
* With `time: 0`, start and completion are emitted immediately.
|
|
1887
|
+
*/
|
|
1888
|
+
animVelTranslTo({ vx, vy, vz, space, time, ease }: {
|
|
1889
|
+
vx?: number;
|
|
1890
|
+
vy?: number;
|
|
1891
|
+
vz?: number;
|
|
1892
|
+
space?: CoordinateSpace;
|
|
1893
|
+
time?: number;
|
|
1894
|
+
ease?: string;
|
|
1895
|
+
}): void;
|
|
1896
|
+
private checkFrustumVisible;
|
|
1897
|
+
private checkPosOccl;
|
|
1898
|
+
private checkPosScreen;
|
|
1899
|
+
private checkRotWorld;
|
|
1444
1900
|
/**
|
|
1445
1901
|
* Returns the object's screen position in canvas coordinates.
|
|
1446
1902
|
* @param cam3D - Camera used for projection to canvas coordinates.
|
|
@@ -1481,6 +1937,7 @@ export declare class Obj3D {
|
|
|
1481
1937
|
type: TType;
|
|
1482
1938
|
}>) => void): void;
|
|
1483
1939
|
private resetEventState;
|
|
1940
|
+
private updVisible;
|
|
1484
1941
|
}
|
|
1485
1942
|
|
|
1486
1943
|
/** Object events available to registered listeners. */
|
|
@@ -1488,6 +1945,7 @@ export declare type Obj3DEvent = Obj3DPosWorldEvent | Obj3DPosScreenEvent | Obj3
|
|
|
1488
1945
|
|
|
1489
1946
|
/** @event Fired when the frustum visibility of a 3D object changes. */
|
|
1490
1947
|
export declare interface Obj3DFrustumEvent {
|
|
1948
|
+
/** Event identifier used to select listeners and state machine transitions. */
|
|
1491
1949
|
type: 'Obj3D_Frustum_Changed';
|
|
1492
1950
|
/** Whether the object's world position is inside the camera frustum. */
|
|
1493
1951
|
visibleFrustum: boolean;
|
|
@@ -1495,12 +1953,15 @@ export declare interface Obj3DFrustumEvent {
|
|
|
1495
1953
|
|
|
1496
1954
|
/** Initial parameters shared by all `Obj3D` classes. */
|
|
1497
1955
|
export declare interface Obj3DParams {
|
|
1956
|
+
/** Model object name, matched without regard to case. Defaults to the registration key. */
|
|
1957
|
+
name?: string;
|
|
1498
1958
|
/** Hides the underlying Three.js object from rendering without disabling raycasting. */
|
|
1499
1959
|
hidden?: boolean;
|
|
1500
1960
|
}
|
|
1501
1961
|
|
|
1502
1962
|
/** @event Fired when the pointer interacts with a pickable object. */
|
|
1503
1963
|
export declare interface Obj3DPointerEvent {
|
|
1964
|
+
/** Event identifier used to select listeners and state machine transitions. */
|
|
1504
1965
|
type: 'Obj3D_Click' | 'Obj3D_Pointer_Enter' | 'Obj3D_Pointer_Down' | 'Obj3D_Pointer_Leave' | 'Obj3D_Pointer_Move' | 'Obj3D_Pointer_Up';
|
|
1505
1966
|
/** Native pointer event from the active object interaction. */
|
|
1506
1967
|
event: PointerEvent;
|
|
@@ -1512,6 +1973,7 @@ export declare interface Obj3DPointerEvent {
|
|
|
1512
1973
|
* @event Fired when the screen position of a 3D object changes.
|
|
1513
1974
|
*/
|
|
1514
1975
|
export declare interface Obj3DPosScreenEvent {
|
|
1976
|
+
/** Event identifier used to select listeners and state machine transitions. */
|
|
1515
1977
|
type: 'Obj3D_Pos_Screen_Changed';
|
|
1516
1978
|
/** The object's position projected into screen space. */
|
|
1517
1979
|
posScreen: THREE_TYPE.Vector2;
|
|
@@ -1521,6 +1983,7 @@ export declare interface Obj3DPosScreenEvent {
|
|
|
1521
1983
|
* @event Fired when the world position of a 3D object changes.
|
|
1522
1984
|
*/
|
|
1523
1985
|
export declare interface Obj3DPosWorldEvent {
|
|
1986
|
+
/** Event identifier used to select listeners and state machine transitions. */
|
|
1524
1987
|
type: 'Obj3D_Pos_World_Changed';
|
|
1525
1988
|
/** The object's position in world coordinates. */
|
|
1526
1989
|
posWorld: THREE_TYPE.Vector3;
|
|
@@ -1530,6 +1993,7 @@ export declare interface Obj3DPosWorldEvent {
|
|
|
1530
1993
|
* @event Fired when the world rotation of a 3D object changes.
|
|
1531
1994
|
*/
|
|
1532
1995
|
export declare interface Obj3DRotWorldEvent {
|
|
1996
|
+
/** Event identifier used to select listeners and state machine transitions. */
|
|
1533
1997
|
type: 'Obj3D_Rot_World_Changed';
|
|
1534
1998
|
/** The object's rotation in world coordinates. */
|
|
1535
1999
|
rotWorld: THREE_TYPE.Euler;
|
|
@@ -1537,13 +2001,21 @@ export declare interface Obj3DRotWorldEvent {
|
|
|
1537
2001
|
|
|
1538
2002
|
/** @event Fired when an object's combined hidden, frustum, and occlusion visibility changes. */
|
|
1539
2003
|
export declare interface Obj3DVisibleEvent {
|
|
2004
|
+
/** Event identifier used to select listeners and state machine transitions. */
|
|
1540
2005
|
type: 'Obj3D_Visible_Changed';
|
|
1541
2006
|
/** Whether the object is not hidden, is inside the camera frustum, and is not occluded. */
|
|
1542
2007
|
visible: boolean;
|
|
1543
2008
|
}
|
|
1544
2009
|
|
|
2010
|
+
declare type ObjRotOptions = Omit<AnimRotOptions, 'obj'>;
|
|
2011
|
+
|
|
2012
|
+
/** Scene object component types managed by the framework. */
|
|
1545
2013
|
export declare type Objs3D = Cam3D | Light3D | Mesh3D | Obj3D;
|
|
1546
2014
|
|
|
2015
|
+
declare type ObjScaleOptions = Omit<AnimScaleOptions, 'obj'>;
|
|
2016
|
+
|
|
2017
|
+
declare type ObjTranslOptions = Omit<AnimTranslOptions, 'obj'>;
|
|
2018
|
+
|
|
1547
2019
|
/**
|
|
1548
2020
|
* Controls camera orbit, panning, and zooming around a target.
|
|
1549
2021
|
* @category Core
|
|
@@ -1648,7 +2120,7 @@ export declare interface OrbitCtrlsCfg {
|
|
|
1648
2120
|
*/
|
|
1649
2121
|
load: boolean;
|
|
1650
2122
|
/**
|
|
1651
|
-
* Maximum allowed horizontal orbit angle in
|
|
2123
|
+
* Maximum allowed horizontal orbit angle in radians.
|
|
1652
2124
|
* @default Infinity
|
|
1653
2125
|
*/
|
|
1654
2126
|
maxAzimuthAngle: number;
|
|
@@ -1658,12 +2130,12 @@ export declare interface OrbitCtrlsCfg {
|
|
|
1658
2130
|
*/
|
|
1659
2131
|
maxDistance: number;
|
|
1660
2132
|
/**
|
|
1661
|
-
* Maximum allowed vertical orbit angle in
|
|
1662
|
-
* @default
|
|
2133
|
+
* Maximum allowed vertical orbit angle in radians.
|
|
2134
|
+
* @default Math.PI
|
|
1663
2135
|
*/
|
|
1664
2136
|
maxPolarAngle: number;
|
|
1665
2137
|
/**
|
|
1666
|
-
* Minimum allowed horizontal orbit angle in
|
|
2138
|
+
* Minimum allowed horizontal orbit angle in radians.
|
|
1667
2139
|
* @default -Infinity
|
|
1668
2140
|
*/
|
|
1669
2141
|
minAzimuthAngle: number;
|
|
@@ -1673,7 +2145,7 @@ export declare interface OrbitCtrlsCfg {
|
|
|
1673
2145
|
*/
|
|
1674
2146
|
minDistance: number;
|
|
1675
2147
|
/**
|
|
1676
|
-
* Minimum allowed vertical orbit angle in
|
|
2148
|
+
* Minimum allowed vertical orbit angle in radians.
|
|
1677
2149
|
* @default 0
|
|
1678
2150
|
*/
|
|
1679
2151
|
minPolarAngle: number;
|
|
@@ -1696,6 +2168,7 @@ export declare interface OrbitCtrlsCfg {
|
|
|
1696
2168
|
|
|
1697
2169
|
/** @event Fired when orbit interaction starts, changes, or ends, or controls are enabled, disabled, or disposed. */
|
|
1698
2170
|
export declare interface OrbitCtrlsEvent {
|
|
2171
|
+
/** Event identifier used to select listeners and state machine transitions. */
|
|
1699
2172
|
type: 'OrbitCtrls_Changed' | 'OrbitCtrls_Disabled' | 'OrbitCtrls_Enabled' | 'OrbitCtrls_End' | 'OrbitCtrls_Start' | 'OrbitCtrls_Disposed';
|
|
1700
2173
|
}
|
|
1701
2174
|
|
|
@@ -1740,9 +2213,12 @@ export declare interface PostCfg {
|
|
|
1740
2213
|
|
|
1741
2214
|
/** @event Fired after the loading progress bar has finished hiding. */
|
|
1742
2215
|
export declare interface ProgressBarHiddenEvent {
|
|
2216
|
+
/** Event identifier used to select listeners and state machine transitions. */
|
|
1743
2217
|
type: 'ProgressBar_Hidden';
|
|
1744
2218
|
}
|
|
1745
2219
|
|
|
2220
|
+
export { radToDeg }
|
|
2221
|
+
|
|
1746
2222
|
/**
|
|
1747
2223
|
* Manages collider-based occlusion and pointer picking in a `THREE.Scene`. Collider roles determine which objects block rays, emit pointer events, or remain hidden while participating in raycasting.
|
|
1748
2224
|
* @category Core
|
|
@@ -1864,12 +2340,7 @@ export declare interface RenderCfg {
|
|
|
1864
2340
|
*/
|
|
1865
2341
|
adaptiveGfx: boolean;
|
|
1866
2342
|
/**
|
|
1867
|
-
*
|
|
1868
|
-
*
|
|
1869
|
-
* - `webgl`: use `THREE.WebGLRenderer`
|
|
1870
|
-
* - `webgpu`: use `THREE.WebGPURenderer`
|
|
1871
|
-
* - `auto`: use WebGPU if supported, otherwise fall back to WebGL
|
|
1872
|
-
*
|
|
2343
|
+
* See {@link Renderer}.
|
|
1873
2344
|
* @default 'auto'
|
|
1874
2345
|
*/
|
|
1875
2346
|
api: Renderer;
|
|
@@ -1953,14 +2424,17 @@ export declare interface RenderCfg {
|
|
|
1953
2424
|
* WebGPU-specific renderer configuration.
|
|
1954
2425
|
*/
|
|
1955
2426
|
webgpu: {
|
|
1956
|
-
/**
|
|
1957
|
-
* Parameters passed to `THREE.WebGPURenderer`.
|
|
1958
|
-
*/
|
|
2427
|
+
/** See {@link WebGpuRendererParams}. */
|
|
1959
2428
|
params: WebGpuRendererParams;
|
|
1960
2429
|
};
|
|
1961
2430
|
}
|
|
1962
2431
|
|
|
1963
|
-
/**
|
|
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
|
+
*/
|
|
1964
2438
|
export declare type Renderer = 'webgl' | 'webgpu' | 'auto';
|
|
1965
2439
|
|
|
1966
2440
|
/** Complete effect selections for both rendering backends. */
|
|
@@ -2046,12 +2520,13 @@ export declare type RenderProfileWebGpu = {
|
|
|
2046
2520
|
});
|
|
2047
2521
|
|
|
2048
2522
|
/**
|
|
2049
|
-
* Controls scene contents, camera animation, materials,
|
|
2523
|
+
* Controls scene contents, camera animation, materials, and lighting.
|
|
2050
2524
|
* @category Core
|
|
2051
2525
|
*/
|
|
2052
2526
|
export declare class Scene {
|
|
2053
|
-
private readonly cfg;
|
|
2054
2527
|
private readonly cam3D;
|
|
2528
|
+
private readonly cfg;
|
|
2529
|
+
private readonly clips;
|
|
2055
2530
|
private readonly events;
|
|
2056
2531
|
private readonly objs3D;
|
|
2057
2532
|
private readonly tweensObj;
|
|
@@ -2124,7 +2599,7 @@ export declare class Scene {
|
|
|
2124
2599
|
/**
|
|
2125
2600
|
* Animates all assigned materials of an object, optionally including descendant meshes.
|
|
2126
2601
|
* @param params - Target material values and shared animation settings.
|
|
2127
|
-
* @param params.obj -
|
|
2602
|
+
* @param params.obj - Exact Three.js object name.
|
|
2128
2603
|
* @param params.recursive - Includes descendant meshes. Default: **false**
|
|
2129
2604
|
* @param params.infinite - Repeats each animation indefinitely. Default: **false**
|
|
2130
2605
|
* @param params.time - Duration in seconds. Default: **0**
|
|
@@ -2135,7 +2610,7 @@ export declare class Scene {
|
|
|
2135
2610
|
* Each shared material is animated once. Tweens and {@link AnimMaterialEvent} are managed per material.
|
|
2136
2611
|
*/
|
|
2137
2612
|
animMaterialsTo({ obj, recursive, ...params }: {
|
|
2138
|
-
obj: string
|
|
2613
|
+
obj: string;
|
|
2139
2614
|
recursive?: boolean;
|
|
2140
2615
|
infinite?: boolean;
|
|
2141
2616
|
time?: number;
|
|
@@ -2144,127 +2619,40 @@ export declare class Scene {
|
|
|
2144
2619
|
[key: string]: any;
|
|
2145
2620
|
}): void;
|
|
2146
2621
|
/**
|
|
2147
|
-
* Animates
|
|
2148
|
-
* @
|
|
2149
|
-
* @param params
|
|
2150
|
-
* @param params.pos - Target local position; omitted axes remain unchanged.
|
|
2151
|
-
* @param params.rot - Target local Euler angles in degrees, using the object's Euler order.
|
|
2152
|
-
* @param params.scale - Target local scale; omitted axes remain unchanged.
|
|
2153
|
-
* @param params.time - Duration in seconds. Default: **1**. A value of 0 applies the values immediately.
|
|
2154
|
-
* @param params.ease - GSAP easing function. Default: **'power2.inOut'**
|
|
2155
|
-
*
|
|
2622
|
+
* Animates orientation from its current value using Euler angles in radians.
|
|
2623
|
+
* @inlineType AnimRotOptions
|
|
2624
|
+
* @param params - Target object, orientation, and animation settings.
|
|
2156
2625
|
* @remarks
|
|
2157
|
-
*
|
|
2158
|
-
*
|
|
2626
|
+
* Euler interpolation supports full turns. Each call starts from the current orientation without retaining previous turns.
|
|
2627
|
+
* Quaternion interpolation takes the shortest path; omitted Euler axes may change during interpolation.
|
|
2628
|
+
* World targets account for moving parents. The caller is responsible for non-uniform parent scaling.
|
|
2159
2629
|
* Cameras switch to free look mode. The caller coordinates other animations and controls.
|
|
2160
|
-
* A new call cancels the
|
|
2630
|
+
* A new call cancels only the previous orientation animation of the same object.
|
|
2161
2631
|
* Emits {@link AnimEvent}: `Anim_Start`, `Anim_Complete`, or `Anim_Cancel` when replaced.
|
|
2162
2632
|
*/
|
|
2163
|
-
|
|
2164
|
-
obj: string | Obj3D;
|
|
2165
|
-
pos?: {
|
|
2166
|
-
x?: number;
|
|
2167
|
-
y?: number;
|
|
2168
|
-
z?: number;
|
|
2169
|
-
};
|
|
2170
|
-
rot?: {
|
|
2171
|
-
x?: number;
|
|
2172
|
-
y?: number;
|
|
2173
|
-
z?: number;
|
|
2174
|
-
};
|
|
2175
|
-
scale?: {
|
|
2176
|
-
x?: number;
|
|
2177
|
-
y?: number;
|
|
2178
|
-
z?: number;
|
|
2179
|
-
};
|
|
2180
|
-
time?: number;
|
|
2181
|
-
ease?: string;
|
|
2182
|
-
}): void;
|
|
2183
|
-
private getMtrls;
|
|
2184
|
-
private getObjectName;
|
|
2633
|
+
animRotTo({ obj, x, y, z, path, order, space, time, ease }: AnimRotOptions): void;
|
|
2185
2634
|
/**
|
|
2186
|
-
*
|
|
2187
|
-
*
|
|
2188
|
-
* @param params -
|
|
2189
|
-
* @param params.layer - The freely named layer used to group animation actions.
|
|
2190
|
-
* @param params.clip - The name of the animation clip to play.
|
|
2191
|
-
* @param params.modeBlend - How the action is blended with other active actions. Default: **'normal'**
|
|
2192
|
-
* @param params.modeFinish - Whether the final pose is held or faded out after the final loop. Default: **'hold'**
|
|
2193
|
-
* @param params.modeLoop - Number of plays or `'infinite'` for endless looping. Default: **1**
|
|
2194
|
-
* @param params.modeStop - Which previous actions of the same layer are stopped before playback. Default: **'all'**
|
|
2195
|
-
* @param params.fadeTime - Duration in seconds for fading affected previous actions out and the new action in. Default: **0**
|
|
2196
|
-
* @param params.fadeTimeFinish - Duration in seconds for `modeFinish: 'fadeOut'`. Default: **0**
|
|
2197
|
-
* @param params.reverse - If `true`, plays the clip in reverse. Default: **false**
|
|
2198
|
-
* @param params.reset - If `true`, resets the clip before a new playback. Default: **false**
|
|
2199
|
-
* @param params.speedStart - Initial playback speed for speed interpolation. Default: **0**
|
|
2200
|
-
* @param params.speedEnd - Target playback speed. Default: **1**
|
|
2201
|
-
* @param params.speedTime - Duration in seconds for speed interpolation. Default: **0**
|
|
2202
|
-
* @param params.speedEase - GSAP easing function name. Default: **'power1.inOut'**
|
|
2203
|
-
*
|
|
2635
|
+
* Animates selected local scale axes from their current values.
|
|
2636
|
+
* @inlineType AnimScaleOptions
|
|
2637
|
+
* @param params - Target object, scale, and animation settings.
|
|
2204
2638
|
* @remarks
|
|
2205
|
-
*
|
|
2206
|
-
*
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
* **Events**
|
|
2210
|
-
*
|
|
2211
|
-
* {@link ClipEvent}
|
|
2212
|
-
*/
|
|
2213
|
-
playClip({ layer, clip: clipName, modeBlend, modeFinish, modeLoop, modeStop, fadeTime, fadeTimeFinish, reverse, reset, speedStart, speedEnd, speedTime, speedEase }: {
|
|
2214
|
-
layer: string;
|
|
2215
|
-
clip: string;
|
|
2216
|
-
singleAction?: boolean;
|
|
2217
|
-
modeBlend?: BlendMode;
|
|
2218
|
-
modeFinish?: FinishMode;
|
|
2219
|
-
modeLoop?: LoopMode;
|
|
2220
|
-
modeStop?: StopMode;
|
|
2221
|
-
fadeTime?: number;
|
|
2222
|
-
fadeTimeFinish?: number;
|
|
2223
|
-
reverse?: boolean;
|
|
2224
|
-
reset?: boolean;
|
|
2225
|
-
speedStart?: number;
|
|
2226
|
-
speedEnd?: number;
|
|
2227
|
-
speedTime?: number;
|
|
2228
|
-
speedEase?: string;
|
|
2229
|
-
}): void;
|
|
2639
|
+
* A new call cancels only the previous scale animation of the same object.
|
|
2640
|
+
* Emits {@link AnimEvent}: `Anim_Start`, `Anim_Complete`, or `Anim_Cancel` when replaced.
|
|
2641
|
+
*/
|
|
2642
|
+
animScaleTo({ obj, x, y, z, time, ease }: AnimScaleOptions): void;
|
|
2230
2643
|
/**
|
|
2231
|
-
*
|
|
2232
|
-
*
|
|
2233
|
-
* @param params -
|
|
2234
|
-
* @param params.layer - The freely named layer used to group camera animation actions.
|
|
2235
|
-
* @param params.clip - The name of the camera animation clip to play.
|
|
2236
|
-
* @param params.modeBlend - How the action is blended with other active actions. Default: **'normal'**
|
|
2237
|
-
* @param params.modeLoop - Number of plays or `'infinite'` for endless looping. Default: **1**
|
|
2238
|
-
* @param params.modeStop - Which previous actions of the same layer are stopped before playback. Default: **'all'**
|
|
2239
|
-
* @param params.fadeTime - Duration in seconds for fading affected previous actions out and the new action in. Default: **0**
|
|
2240
|
-
* @param params.reverse - If `true`, plays the clip in reverse. Default: **false**
|
|
2241
|
-
* @param params.reset - If `true`, resets the clip before a new playback. Default: **false**
|
|
2242
|
-
* @param params.speedStart - Initial playback speed for speed interpolation. Default: **0**
|
|
2243
|
-
* @param params.speedEnd - Target playback speed. Default: **1**
|
|
2244
|
-
* @param params.speedTime - Duration in seconds for speed interpolation. Default: **0**
|
|
2245
|
-
* @param params.speedEase - GSAP easing function name. Default: **'power1.inOut'**
|
|
2246
|
-
*
|
|
2644
|
+
* Animates selected position axes from their current values in parent or world space.
|
|
2645
|
+
* @inlineType AnimTranslOptions
|
|
2646
|
+
* @param params - Target object, position, and animation settings.
|
|
2247
2647
|
* @remarks
|
|
2248
|
-
*
|
|
2249
|
-
*
|
|
2250
|
-
*
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
clip: string;
|
|
2257
|
-
modeBlend?: BlendMode;
|
|
2258
|
-
modeLoop?: LoopMode;
|
|
2259
|
-
modeStop?: StopMode;
|
|
2260
|
-
fadeTime?: number;
|
|
2261
|
-
reverse?: boolean;
|
|
2262
|
-
reset?: boolean;
|
|
2263
|
-
speedStart?: number;
|
|
2264
|
-
speedEnd?: number;
|
|
2265
|
-
speedTime?: number;
|
|
2266
|
-
speedEase?: string;
|
|
2267
|
-
}): void;
|
|
2648
|
+
* World targets account for moving parents. Cameras switch to free look mode.
|
|
2649
|
+
* A new call cancels only the previous position animation of the same object.
|
|
2650
|
+
* Emits {@link AnimEvent}: `Anim_Start`, `Anim_Complete`, or `Anim_Cancel` when replaced.
|
|
2651
|
+
*/
|
|
2652
|
+
animTranslTo({ obj, x, y, z, space, time, ease }: AnimTranslOptions): void;
|
|
2653
|
+
private getMtrls;
|
|
2654
|
+
private getObj;
|
|
2655
|
+
private getObj3D;
|
|
2268
2656
|
/**
|
|
2269
2657
|
* Removes the built-in ambient light and releases its resources.
|
|
2270
2658
|
*/
|
|
@@ -2328,7 +2716,7 @@ export declare class Scene {
|
|
|
2328
2716
|
/**
|
|
2329
2717
|
* Updates all assigned materials of an object, optionally including descendant meshes.
|
|
2330
2718
|
* @param params - Target material values, such as `color`, `roughness`, or `map`.
|
|
2331
|
-
* @param params.obj -
|
|
2719
|
+
* @param params.obj - Exact Three.js object name.
|
|
2332
2720
|
* @param params.recursive - Includes descendant meshes. Default: **false**
|
|
2333
2721
|
* @param params.needsUpdate - Recompiles materials after applying the values. Default: **false**
|
|
2334
2722
|
*
|
|
@@ -2336,26 +2724,11 @@ export declare class Scene {
|
|
|
2336
2724
|
* Each shared material is updated once. Texture paths for `map` and `emissiveMap` load asynchronously.
|
|
2337
2725
|
*/
|
|
2338
2726
|
setMaterialsProps({ obj, recursive, ...props }: {
|
|
2339
|
-
obj: string
|
|
2727
|
+
obj: string;
|
|
2340
2728
|
recursive?: boolean;
|
|
2341
2729
|
needsUpdate?: boolean;
|
|
2342
2730
|
[key: string]: any;
|
|
2343
2731
|
}): void;
|
|
2344
|
-
/**
|
|
2345
|
-
* Stops a named animation clip, optionally slowing it to a halt first.
|
|
2346
|
-
* @param params - Stop settings.
|
|
2347
|
-
* @param params.clipName - Animation clip name.
|
|
2348
|
-
* @param params.speedTime - Slowdown duration in seconds. Default: **0**
|
|
2349
|
-
* @param params.speedEase - GSAP easing function for the slowdown. Default: **'power1.inOut'**
|
|
2350
|
-
*
|
|
2351
|
-
* @remarks
|
|
2352
|
-
* A slowdown emits `Clip_Speed_Start` and `Clip_Speed_Complete`, followed by `Clip_Cancel`. A duration of `0` cancels immediately. See {@link ClipEvent}.
|
|
2353
|
-
*/
|
|
2354
|
-
stopClip({ clipName, speedTime, speedEase }: {
|
|
2355
|
-
clipName: string;
|
|
2356
|
-
speedTime?: number;
|
|
2357
|
-
speedEase?: string;
|
|
2358
|
-
}): void;
|
|
2359
2732
|
}
|
|
2360
2733
|
|
|
2361
2734
|
/**
|
|
@@ -2386,6 +2759,7 @@ export declare type SceneClass = new (canvas: HTMLElement, cfg: Cfg, name: strin
|
|
|
2386
2759
|
|
|
2387
2760
|
/** Scene component class with optional initial parameters. */
|
|
2388
2761
|
export declare type SceneEntry<TClass extends SceneClass = SceneClass> = TClass | {
|
|
2762
|
+
/** Scene component class to instantiate. */
|
|
2389
2763
|
class: TClass;
|
|
2390
2764
|
/**
|
|
2391
2765
|
* Initial parameters assigned to a scene component class when the app starts. Accepts `Obj3DParams` or `Coll3DParams`, depending on the registered `class`. */
|
|
@@ -2405,6 +2779,7 @@ export declare type SceneInsts<T extends Record<string, SceneEntry>> = {
|
|
|
2405
2779
|
|
|
2406
2780
|
/** @event Fired when the initial scene resources and component readiness hooks are complete. */
|
|
2407
2781
|
export declare interface SceneReadyEvent {
|
|
2782
|
+
/** Event identifier used to select listeners and state machine transitions. */
|
|
2408
2783
|
type: 'Scene_Ready';
|
|
2409
2784
|
}
|
|
2410
2785
|
|
|
@@ -2439,6 +2814,142 @@ export declare interface SmaaCfg {
|
|
|
2439
2814
|
guiOpened: boolean;
|
|
2440
2815
|
}
|
|
2441
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
|
+
|
|
2442
2953
|
/**
|
|
2443
2954
|
* Parameters used to load a global or positional audio source.
|
|
2444
2955
|
* @category Cfg
|
|
@@ -2446,7 +2957,7 @@ export declare interface SmaaCfg {
|
|
|
2446
2957
|
export declare interface SoundParams extends Partial<SoundParamsPos> {
|
|
2447
2958
|
/**
|
|
2448
2959
|
* Whether playback should loop.
|
|
2449
|
-
* @default
|
|
2960
|
+
* @default false
|
|
2450
2961
|
*/
|
|
2451
2962
|
loop?: boolean;
|
|
2452
2963
|
/**
|
|
@@ -2456,7 +2967,7 @@ export declare interface SoundParams extends Partial<SoundParamsPos> {
|
|
|
2456
2967
|
/**
|
|
2457
2968
|
* Scene object name or Obj3D component for positional audio. Use an empty string for global audio.
|
|
2458
2969
|
*/
|
|
2459
|
-
|
|
2970
|
+
parent: string | Obj3D;
|
|
2460
2971
|
/**
|
|
2461
2972
|
* Path or URL to the audio file.
|
|
2462
2973
|
*/
|
|
@@ -2510,6 +3021,53 @@ export declare interface SoundParamsPos {
|
|
|
2510
3021
|
coneOuterGain: number;
|
|
2511
3022
|
}
|
|
2512
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
|
+
|
|
2513
3071
|
/**
|
|
2514
3072
|
* Controls contact shading with WebGL SSAO.
|
|
2515
3073
|
* @category Cfg
|
|
@@ -2570,7 +3128,10 @@ export declare interface SslCfg {
|
|
|
2570
3128
|
guiOpened: boolean;
|
|
2571
3129
|
}
|
|
2572
3130
|
|
|
2573
|
-
/**
|
|
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
|
+
*/
|
|
2574
3135
|
export declare type SslMode = SslModeWebGl | SslModeWebGpu;
|
|
2575
3136
|
|
|
2576
3137
|
/** Screen-space lighting modes available with WebGL. */
|
|
@@ -2719,27 +3280,23 @@ export declare interface StateMachineCfg {
|
|
|
2719
3280
|
inspector: boolean;
|
|
2720
3281
|
}
|
|
2721
3282
|
|
|
2722
|
-
/**
|
|
2723
|
-
* Controls which active animations on the same layer stop before a new animation plays.
|
|
2724
|
-
* - `'all'`: Stops all previous active actions.
|
|
2725
|
-
* - `'last'`: Stops only the most recently played previous active action.
|
|
2726
|
-
* - `'none'`: Keeps all previous active actions running.
|
|
2727
|
-
*/
|
|
2728
|
-
export declare type StopMode = 'all' | 'last' | 'none';
|
|
2729
|
-
|
|
2730
3283
|
/** Removes the listener associated with an event subscription. */
|
|
2731
3284
|
export declare type Unsubscribe = () => void;
|
|
2732
3285
|
|
|
2733
3286
|
/**
|
|
2734
3287
|
* Connects a custom HTML element to the scene lifecycle and object visibility.
|
|
3288
|
+
* @typeParam TScene - Scene Component registrations from `assets.scene`.
|
|
2735
3289
|
* @category Web Components
|
|
2736
3290
|
*/
|
|
2737
|
-
export declare class Web extends HTMLElement {
|
|
3291
|
+
export declare class Web<TScene extends Record<string, SceneEntry> = {}> extends HTMLElement {
|
|
2738
3292
|
/** Element that hosts the rendered canvas. */
|
|
2739
3293
|
canvas: Readonly<HTMLElement>;
|
|
2740
3294
|
cfg: Cfg;
|
|
2741
3295
|
events: Readonly<Events>;
|
|
2742
|
-
|
|
3296
|
+
/** Registered Scene Component instances, keyed by their Assets names. Use from `onReady()` onward. */
|
|
3297
|
+
comps: {
|
|
3298
|
+
scene: SceneInsts<TScene>;
|
|
3299
|
+
};
|
|
2743
3300
|
webs: Map<string, Web[]> | null;
|
|
2744
3301
|
private obj3DFollow;
|
|
2745
3302
|
private visible;
|
|
@@ -2757,7 +3314,7 @@ export declare class Web extends HTMLElement {
|
|
|
2757
3314
|
* @param params.obj - The `Obj3D` to follow in the scene.
|
|
2758
3315
|
*/
|
|
2759
3316
|
follow({ obj }: {
|
|
2760
|
-
obj: Obj3D
|
|
3317
|
+
obj: Obj3D;
|
|
2761
3318
|
}): void;
|
|
2762
3319
|
/**
|
|
2763
3320
|
* Applies the combined followed-object and overlap visibility.
|
|
@@ -2794,13 +3351,16 @@ export declare type WebClass = new () => Web;
|
|
|
2794
3351
|
|
|
2795
3352
|
/** Web component class with optional initial parameters. */
|
|
2796
3353
|
export declare type WebEntry<TClass extends WebClass = WebClass> = TClass | {
|
|
3354
|
+
/** Web component class to register. */
|
|
2797
3355
|
class: TClass;
|
|
3356
|
+
/** Initial values assigned to the registered web component. See {@link WebParams}. */
|
|
2798
3357
|
params?: WebParams;
|
|
2799
3358
|
};
|
|
2800
3359
|
|
|
3360
|
+
/** Web component events available to registered listeners. */
|
|
2801
3361
|
export declare type WebEvent = WebOverlapEvent | WebVisibleEvent;
|
|
2802
3362
|
|
|
2803
|
-
/**
|
|
3363
|
+
/** Parameters passed to `THREE.WebGPURenderer`. */
|
|
2804
3364
|
export declare type WebGpuRendererParams = NonNullable<ConstructorParameters<typeof THREE_WEBGPU_TYPE.WebGPURenderer>[0]>;
|
|
2805
3365
|
|
|
2806
3366
|
/**
|
|
@@ -2816,6 +3376,7 @@ export declare type WebInsts<T extends Record<string, WebEntry>> = {
|
|
|
2816
3376
|
|
|
2817
3377
|
/** @event Fired when a web component becomes overlapped or unobstructed. */
|
|
2818
3378
|
export declare interface WebOverlapEvent {
|
|
3379
|
+
/** Event identifier used to select listeners and state machine transitions. */
|
|
2819
3380
|
type: 'Web_Overlap_Changed';
|
|
2820
3381
|
/** The affected web component. */
|
|
2821
3382
|
web: Web;
|
|
@@ -2828,6 +3389,7 @@ export declare type WebParams = Record<string, unknown>;
|
|
|
2828
3389
|
|
|
2829
3390
|
/** @event Fired when a web component's combined object and overlap visibility changes. */
|
|
2830
3391
|
export declare interface WebVisibleEvent {
|
|
3392
|
+
/** Event identifier used to select listeners and state machine transitions. */
|
|
2831
3393
|
type: 'Web_Visible_Changed';
|
|
2832
3394
|
/** The affected web component. */
|
|
2833
3395
|
web: Web;
|
|
@@ -2837,6 +3399,7 @@ export declare interface WebVisibleEvent {
|
|
|
2837
3399
|
|
|
2838
3400
|
/** @event Fired when the window size changes. */
|
|
2839
3401
|
export declare interface WindowResizeEvent {
|
|
3402
|
+
/** Event identifier used to select listeners and state machine transitions. */
|
|
2840
3403
|
type: 'Window_Resize';
|
|
2841
3404
|
}
|
|
2842
3405
|
|