illutions 0.29.1 → 0.31.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 +233 -175
- package/LICENSE +29 -1
- package/README.md +26 -40
- package/dist/main.d.ts +997 -1135
- package/dist/main.min.cjs +1 -1
- package/dist/main.min.js +1 -1
- package/package.json +4 -4
package/dist/main.d.ts
CHANGED
|
@@ -1,42 +1,12 @@
|
|
|
1
1
|
import { AnyEventObject } from 'xstate';
|
|
2
2
|
import { AnyStateMachine } from 'xstate';
|
|
3
|
-
import {
|
|
4
|
-
import { createBrowserInspector } from '@statelyai/inspect';
|
|
5
|
-
import { default as default_2 } from 'three/addons/tsl/display/GTAONode.js';
|
|
6
|
-
import { default as default_3 } from 'three/addons/tsl/display/SSRNode.js';
|
|
7
|
-
import { DRACOLoader } from 'three/addons/loaders/DRACOLoader.js';
|
|
8
|
-
import { EffectComposer } from 'three/addons/postprocessing/EffectComposer.js';
|
|
9
|
-
import { EXRLoader } from 'three/addons/loaders/EXRLoader.js';
|
|
10
|
-
import { FXAAShader } from 'three/addons/shaders/FXAAShader.js';
|
|
11
|
-
import { GLTF } from 'three/addons/loaders/GLTFLoader.js';
|
|
12
|
-
import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js';
|
|
13
|
-
import { HDRLoader } from 'three/addons/loaders/HDRLoader.js';
|
|
14
|
-
import { KTX2Loader } from 'three/addons/loaders/KTX2Loader.js';
|
|
15
|
-
import { MeshoptDecoder } from 'three/addons/libs/meshopt_decoder.module.js';
|
|
16
|
-
import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
|
|
17
|
-
import { OrbitControls as OrbitControls_2 } from 'three/examples/jsm/controls/OrbitControls.js';
|
|
18
|
-
import { OutputPass } from 'three/addons/postprocessing/OutputPass.js';
|
|
19
|
-
import { Pane } from 'tweakpane';
|
|
20
|
-
import { PointerLockControls } from 'three/addons/controls/PointerLockControls.js';
|
|
21
|
-
import { PointerLockControls as PointerLockControls_2 } from 'three/examples/jsm/controls/PointerLockControls.js';
|
|
22
|
-
import { RectAreaLightTexturesLib } from 'three/addons/lights/RectAreaLightTexturesLib.js';
|
|
23
|
-
import { RectAreaLightUniformsLib } from 'three/addons/lights/RectAreaLightUniformsLib.js';
|
|
3
|
+
import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls.js';
|
|
24
4
|
import { ReflectorForSSRPass } from 'three/addons/objects/ReflectorForSSRPass.js';
|
|
25
|
-
import { RenderPass } from 'three/addons/postprocessing/RenderPass.js';
|
|
26
|
-
import { ShaderPass } from 'three/addons/postprocessing/ShaderPass.js';
|
|
27
|
-
import { smaa } from 'three/addons/tsl/display/SMAANode.js';
|
|
28
|
-
import { SMAAPass } from 'three/addons/postprocessing/SMAAPass.js';
|
|
29
|
-
import { SSAOPass } from 'three/addons/postprocessing/SSAOPass.js';
|
|
30
|
-
import { ssr } from 'three/addons/tsl/display/SSRNode.js';
|
|
31
|
-
import { SSRPass } from 'three/addons/postprocessing/SSRPass.js';
|
|
32
5
|
import type * as THREE_TYPE from 'three';
|
|
33
6
|
import type * as THREE_WEBGPU_TYPE from 'three/webgpu';
|
|
34
|
-
import type * as THREE_WEBTSL_TYPE from 'three/tsl';
|
|
35
|
-
import { TierResult } from 'detect-gpu';
|
|
36
|
-
import { traa } from 'three/addons/tsl/display/TRAANode.js';
|
|
37
7
|
|
|
38
8
|
/**
|
|
39
|
-
*
|
|
9
|
+
* Shared anti-aliasing Inspector settings.
|
|
40
10
|
* @category Cfg
|
|
41
11
|
*/
|
|
42
12
|
export declare interface AaCfg {
|
|
@@ -45,17 +15,21 @@ export declare interface AaCfg {
|
|
|
45
15
|
* @default false
|
|
46
16
|
*/
|
|
47
17
|
guiOpened: boolean;
|
|
48
|
-
/**
|
|
49
|
-
* Selects the anti-aliasing mode. TRAA automatically falls back to FXAA when WebGL is used.
|
|
50
|
-
* @default 'none'
|
|
51
|
-
*/
|
|
52
|
-
mode: 'none' | 'fxaa' | 'smaa' | 'traa';
|
|
53
18
|
}
|
|
54
19
|
|
|
20
|
+
/** Anti-aliasing modes available across rendering backends. */
|
|
21
|
+
export declare type AaMode = AaModeWebGl | AaModeWebGpu;
|
|
22
|
+
|
|
23
|
+
/** Anti-aliasing modes available with WebGL. */
|
|
24
|
+
export declare type AaModeWebGl = 'none' | 'fxaa' | 'smaa';
|
|
25
|
+
|
|
26
|
+
/** Anti-aliasing modes available with WebGPU. */
|
|
27
|
+
export declare type AaModeWebGpu = 'none' | 'fxaa' | 'smaa' | 'traa';
|
|
28
|
+
|
|
55
29
|
export declare type ActionFadeMode = 'in' | 'out';
|
|
56
30
|
|
|
57
31
|
/**
|
|
58
|
-
*
|
|
32
|
+
* Controls uniform ambient illumination.
|
|
59
33
|
* @category Cfg
|
|
60
34
|
*/
|
|
61
35
|
export declare interface AmbientlightCfg {
|
|
@@ -76,9 +50,8 @@ export declare interface AmbientlightCfg {
|
|
|
76
50
|
intensity: number;
|
|
77
51
|
}
|
|
78
52
|
|
|
79
|
-
/** @event Fired when an object
|
|
53
|
+
/** @event Fired when an object or material color animation starts or completes. */
|
|
80
54
|
export declare interface AnimEvent {
|
|
81
|
-
/** Identifies this event type. */
|
|
82
55
|
type: 'Anim_Complete' | 'Anim_Start';
|
|
83
56
|
/** The name of the `THREE.Object3D` whose animation changed state. */
|
|
84
57
|
objName: string;
|
|
@@ -86,9 +59,8 @@ export declare interface AnimEvent {
|
|
|
86
59
|
fct: string;
|
|
87
60
|
}
|
|
88
61
|
|
|
89
|
-
/** @event Fired when a material
|
|
62
|
+
/** @event Fired when a numeric material animation starts or completes. */
|
|
90
63
|
export declare interface AnimFadeEvent {
|
|
91
|
-
/** Identifies this event type. */
|
|
92
64
|
type: 'Anim_Fade_Complete' | 'Anim_Fade_Start';
|
|
93
65
|
/** The name of the `THREE.Mesh` whose material fade changed state. */
|
|
94
66
|
objName: string;
|
|
@@ -101,77 +73,70 @@ export declare interface AnimFadeEvent {
|
|
|
101
73
|
}
|
|
102
74
|
|
|
103
75
|
/**
|
|
104
|
-
*
|
|
105
|
-
* It provides an entry point for creating and controlling a complete 3D scene.
|
|
76
|
+
* Starts the application and provides access to its components and runtime systems.
|
|
106
77
|
* @category Core
|
|
107
78
|
*/
|
|
108
|
-
export declare class App<
|
|
79
|
+
export declare class App<TComps extends Comps = {}> {
|
|
109
80
|
readonly audio: Audio_2;
|
|
110
|
-
private readonly
|
|
81
|
+
private readonly ctrl;
|
|
111
82
|
readonly engine: Engine;
|
|
112
|
-
private readonly
|
|
83
|
+
private readonly model;
|
|
113
84
|
readonly envCtrls: EnvCtrls;
|
|
114
85
|
readonly events: Events;
|
|
115
86
|
readonly orbitCtrls: OrbitCtrls;
|
|
116
87
|
readonly fpvCtrls: FpvCtrls;
|
|
117
88
|
readonly raycast: Raycast;
|
|
89
|
+
readonly scene: Scene;
|
|
118
90
|
readonly stateMachine: StateMachine;
|
|
91
|
+
private readonly webCtrls;
|
|
119
92
|
private cam3D;
|
|
120
93
|
private readonly inspector;
|
|
121
|
-
readonly comps:
|
|
122
|
-
readonly objs3D: Obj3DInsts<NonNullable<TClasses['objs3D']>>;
|
|
123
|
-
private compsMap;
|
|
94
|
+
readonly comps: CompsInsts<TComps>;
|
|
124
95
|
private objs3DMap;
|
|
125
|
-
|
|
126
|
-
init(cfg: Cfg): Promise<void>;
|
|
96
|
+
private websMap;
|
|
127
97
|
/**
|
|
128
|
-
*
|
|
129
|
-
* @param cfg -
|
|
130
|
-
* @param
|
|
98
|
+
* Starts the application, loads the initial scene resources, and connects components and the optional state machine. Startup errors are caught and logged.
|
|
99
|
+
* @param cfg - Startup settings. Defaults to the exported `cfg`.
|
|
100
|
+
* @param comps - Scene Component and Web Component definitions. Default: **empty object**
|
|
131
101
|
* @param createStateMachine - Factory function that receives the fully created `App` instance and returns a state machine.
|
|
132
102
|
*
|
|
133
|
-
* @returns
|
|
103
|
+
* @returns Resolves after startup completes or a startup error is caught.
|
|
134
104
|
*
|
|
135
105
|
* **Example**
|
|
136
|
-
* {@includeCode
|
|
106
|
+
* {@includeCode ../../../apps-doc/examples/app-run.ts}
|
|
137
107
|
*/
|
|
138
|
-
static run<
|
|
108
|
+
static run<TComps extends Comps = {}>(cfg?: Cfg, comps?: TComps, createStateMachine?: (app: App<TComps>) => AnyStateMachine): Promise<void>;
|
|
139
109
|
}
|
|
140
110
|
|
|
141
111
|
/**
|
|
142
|
-
*
|
|
143
|
-
* AudioContext management.
|
|
112
|
+
* Loads and controls global and positional audio with volume fades.
|
|
144
113
|
* @category Core
|
|
145
114
|
*/
|
|
146
115
|
declare class Audio_2 {
|
|
147
116
|
private readonly ctx;
|
|
148
117
|
private readonly loader;
|
|
149
|
-
private readonly
|
|
118
|
+
private readonly scene;
|
|
150
119
|
private readonly events;
|
|
151
120
|
private readonly loadedSounds;
|
|
152
121
|
private readonly params;
|
|
153
122
|
private listener;
|
|
154
|
-
/* Excluded from this release type: __constructor */
|
|
155
123
|
private attachSoundTo;
|
|
156
124
|
/**
|
|
157
|
-
* Returns
|
|
158
|
-
* @returns A snapshot of the mutable audio settings.
|
|
125
|
+
* Returns a snapshot of playback timing and positional audio settings.
|
|
159
126
|
*/
|
|
160
127
|
get(): Partial<AudioCfg>;
|
|
161
128
|
/**
|
|
162
|
-
* Checks whether
|
|
163
|
-
* @param params -
|
|
164
|
-
* @param params.name -
|
|
165
|
-
* @returns True if the audio is loaded, otherwise false.
|
|
129
|
+
* Checks whether a named sound is loaded.
|
|
130
|
+
* @param params - Sound selection.
|
|
131
|
+
* @param params.name - Sound name.
|
|
166
132
|
*/
|
|
167
133
|
isLoaded({ name }: {
|
|
168
134
|
name: string;
|
|
169
135
|
}): boolean;
|
|
170
136
|
/**
|
|
171
|
-
* Checks whether
|
|
172
|
-
* @param params -
|
|
173
|
-
* @param params.name -
|
|
174
|
-
* @returns True if the audio is playing, otherwise false.
|
|
137
|
+
* Checks whether a named sound is playing.
|
|
138
|
+
* @param params - Sound selection.
|
|
139
|
+
* @param params.name - Sound name.
|
|
175
140
|
*/
|
|
176
141
|
isPlaying({ name }: {
|
|
177
142
|
name: string;
|
|
@@ -189,11 +154,11 @@ declare class Audio_2 {
|
|
|
189
154
|
*/
|
|
190
155
|
loadAndPlay({ name, url, object, volume, fade, loop }: SoundParams): void;
|
|
191
156
|
/**
|
|
192
|
-
* Plays
|
|
157
|
+
* Plays a loaded sound with a volume fade-in.
|
|
193
158
|
* When using {@link load}, call this method after receiving the matching `Audio_Loaded` event.
|
|
194
159
|
* This method does not wait for an audio file that is still loading.
|
|
195
|
-
* @param params -
|
|
196
|
-
* @param params.name -
|
|
160
|
+
* @param params - Sound selection.
|
|
161
|
+
* @param params.name - Loaded sound name.
|
|
197
162
|
*/
|
|
198
163
|
play({ name }: {
|
|
199
164
|
name: string;
|
|
@@ -205,10 +170,10 @@ declare class Audio_2 {
|
|
|
205
170
|
private setAttribute;
|
|
206
171
|
private setAudioContext;
|
|
207
172
|
/**
|
|
208
|
-
*
|
|
173
|
+
* Attaches an audio listener to a scene object or camera. Set a listener before loading sounds.
|
|
209
174
|
*
|
|
210
|
-
* @param params -
|
|
211
|
-
* @param params.object -
|
|
175
|
+
* @param params - Listener target.
|
|
176
|
+
* @param params.object - Scene object name or camera to attach the listener to.
|
|
212
177
|
*/
|
|
213
178
|
setListener({ object }: {
|
|
214
179
|
object: string | Cam3D;
|
|
@@ -221,24 +186,23 @@ declare class Audio_2 {
|
|
|
221
186
|
*/
|
|
222
187
|
set(params: Partial<AudioCfg>): void;
|
|
223
188
|
/**
|
|
224
|
-
*
|
|
225
|
-
* @param params -
|
|
226
|
-
* @param params.name -
|
|
189
|
+
* Fades out a playing sound and stops it.
|
|
190
|
+
* @param params - Sound selection.
|
|
191
|
+
* @param params.name - Sound name.
|
|
227
192
|
*/
|
|
228
193
|
stop({ name }: {
|
|
229
194
|
name: string;
|
|
230
195
|
}): void;
|
|
231
196
|
/**
|
|
232
|
-
*
|
|
233
|
-
* @param extension -
|
|
234
|
-
* @remarks This method is intended for advanced custom integrations where developers need direct access to the engine instance. The extension is executed once immediately when `use()` is called.
|
|
197
|
+
* Runs an extension callback immediately with access to the public API.
|
|
198
|
+
* @param extension - Callback receiving this `Audio` instance.
|
|
235
199
|
*/
|
|
236
200
|
use(extension: (audio: Audio_2) => void): void;
|
|
237
201
|
}
|
|
238
202
|
export { Audio_2 as Audio }
|
|
239
203
|
|
|
240
204
|
/**
|
|
241
|
-
*
|
|
205
|
+
* Controls playback timing and how positional sound fades with distance.
|
|
242
206
|
* @category Cfg
|
|
243
207
|
*/
|
|
244
208
|
export declare interface AudioCfg {
|
|
@@ -253,7 +217,7 @@ export declare interface AudioCfg {
|
|
|
253
217
|
*/
|
|
254
218
|
guiOpened: boolean;
|
|
255
219
|
/**
|
|
256
|
-
*
|
|
220
|
+
* Delay in milliseconds before loading audio for automatic playback.
|
|
257
221
|
* @default 200
|
|
258
222
|
*/
|
|
259
223
|
delayPlaySound: number;
|
|
@@ -268,7 +232,7 @@ export declare interface AudioCfg {
|
|
|
268
232
|
*/
|
|
269
233
|
rolloffFactor: number;
|
|
270
234
|
/**
|
|
271
|
-
*
|
|
235
|
+
* Distance beyond which linear attenuation stops reducing volume.
|
|
272
236
|
* @default 1000
|
|
273
237
|
*/
|
|
274
238
|
maxDistance: number;
|
|
@@ -278,12 +242,12 @@ export declare interface AudioCfg {
|
|
|
278
242
|
*/
|
|
279
243
|
distanceModel: 'linear' | 'inverse' | 'exponential';
|
|
280
244
|
/**
|
|
281
|
-
*
|
|
245
|
+
* Inner cone angle in degrees, within which sound is not attenuated.
|
|
282
246
|
* @default 360
|
|
283
247
|
*/
|
|
284
248
|
coneInnerAngle: number;
|
|
285
249
|
/**
|
|
286
|
-
*
|
|
250
|
+
* Outer cone angle in degrees, beyond which `coneOuterGain` applies.
|
|
287
251
|
* @default 360
|
|
288
252
|
*/
|
|
289
253
|
coneOuterAngle: number;
|
|
@@ -296,27 +260,25 @@ export declare interface AudioCfg {
|
|
|
296
260
|
|
|
297
261
|
/** @event Fired when an audio file has finished loading and is ready for playback. */
|
|
298
262
|
export declare interface AudioLoadedEvent {
|
|
299
|
-
/** Identifies this event type. */
|
|
300
263
|
type: 'Audio_Loaded';
|
|
301
264
|
/** The unique name assigned to the loaded sound. */
|
|
302
265
|
soundName: string;
|
|
303
266
|
}
|
|
304
267
|
|
|
305
268
|
/**
|
|
306
|
-
*
|
|
307
|
-
* - 'normal'
|
|
308
|
-
* - 'additive'
|
|
269
|
+
* Controls how an animation blends with other active animations.
|
|
270
|
+
* - `'normal'`: Blends the action's values with other normal actions according to their weights.
|
|
271
|
+
* - `'additive'`: Adds the action's values to the current animation result according to its weight.
|
|
309
272
|
*/
|
|
310
273
|
export declare type BlendMode = 'normal' | 'additive';
|
|
311
274
|
|
|
312
275
|
/**
|
|
313
|
-
*
|
|
314
|
-
* @category
|
|
276
|
+
* Controls the active camera and adopts compatible cameras from GLTF scenes.
|
|
277
|
+
* @category Scene Components
|
|
315
278
|
*/
|
|
316
279
|
export declare class Cam3D extends Obj3D {
|
|
317
|
-
/* Excluded from this release type: lookMode */
|
|
318
280
|
/**
|
|
319
|
-
*
|
|
281
|
+
* Active perspective or orthographic camera.
|
|
320
282
|
* @default `THREE.PerspectiveCamera`
|
|
321
283
|
*/
|
|
322
284
|
readonly obj: THREE_TYPE.Camera;
|
|
@@ -327,23 +289,19 @@ export declare class Cam3D extends Obj3D {
|
|
|
327
289
|
/** Reference to the original target `THREE.Object3D` loaded from the GLTF scene. */
|
|
328
290
|
targetGltf: THREE_TYPE.Object3D | null;
|
|
329
291
|
private readonly tmpVec;
|
|
330
|
-
/* Excluded from this release type: __constructor */
|
|
331
292
|
/**
|
|
332
|
-
* Called
|
|
293
|
+
* Called when a matching GLTF camera is found. Adopts its projection and world transform when the camera types match.
|
|
333
294
|
* @param objGltf - The GLTF `THREE.Camera` object.
|
|
334
295
|
* @public
|
|
335
296
|
*
|
|
336
297
|
* **Example**
|
|
337
|
-
* {@includeCode
|
|
298
|
+
* {@includeCode ../../../../apps-doc/examples/cam3d-dollycamera.ts}
|
|
338
299
|
*/
|
|
339
300
|
protected onTraverse(objGltf: THREE_TYPE.Camera): void;
|
|
340
|
-
/* Excluded from this release type: traverse */
|
|
341
|
-
/* Excluded from this release type: update */
|
|
342
|
-
/* Excluded from this release type: updateCanvasResize */
|
|
343
301
|
}
|
|
344
302
|
|
|
345
303
|
/**
|
|
346
|
-
*
|
|
304
|
+
* Controls camera position, viewing direction, and clipping distances.
|
|
347
305
|
* @category Cfg
|
|
348
306
|
*/
|
|
349
307
|
export declare interface CamBaseCfg {
|
|
@@ -377,18 +335,27 @@ export declare interface CamBaseCfg {
|
|
|
377
335
|
};
|
|
378
336
|
}
|
|
379
337
|
|
|
380
|
-
export declare type CamCfg = CamPerspectiveCfg | CamOrthographicCfg;
|
|
381
|
-
|
|
382
338
|
/**
|
|
383
|
-
*
|
|
339
|
+
* Selects the camera projection and controls the initial view.
|
|
384
340
|
* @category Cfg
|
|
385
341
|
*/
|
|
386
|
-
export declare interface
|
|
342
|
+
export declare interface CamCfg extends CamBaseCfg {
|
|
387
343
|
/**
|
|
388
|
-
* The camera type.
|
|
389
|
-
* @default '
|
|
344
|
+
* The active camera type.
|
|
345
|
+
* @default 'perspective'
|
|
390
346
|
*/
|
|
391
|
-
type: 'orthographic';
|
|
347
|
+
type: 'perspective' | 'orthographic';
|
|
348
|
+
/** Perspective camera projection settings. */
|
|
349
|
+
perspective: CamPerspectiveCfg;
|
|
350
|
+
/** Orthographic camera projection settings. */
|
|
351
|
+
orthographic: CamOrthographicCfg;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
/**
|
|
355
|
+
* Controls the visible area of an orthographic camera.
|
|
356
|
+
* @category Cfg
|
|
357
|
+
*/
|
|
358
|
+
export declare interface CamOrthographicCfg {
|
|
392
359
|
/**
|
|
393
360
|
* Camera frustum left plane.
|
|
394
361
|
* @default -1
|
|
@@ -409,61 +376,42 @@ export declare interface CamOrthographicCfg extends CamBaseCfg {
|
|
|
409
376
|
* @default -1
|
|
410
377
|
*/
|
|
411
378
|
bottom: number;
|
|
412
|
-
/** @private */
|
|
413
|
-
fov?: never;
|
|
414
|
-
/** @private */
|
|
415
|
-
aspect?: never;
|
|
416
379
|
}
|
|
417
380
|
|
|
418
381
|
/**
|
|
419
|
-
*
|
|
382
|
+
* Controls perspective projection.
|
|
420
383
|
* @category Cfg
|
|
421
384
|
*/
|
|
422
|
-
export declare interface CamPerspectiveCfg
|
|
423
|
-
/**
|
|
424
|
-
* The camera type.
|
|
425
|
-
* @default 'perspective'
|
|
426
|
-
*/
|
|
427
|
-
type: 'perspective';
|
|
385
|
+
export declare interface CamPerspectiveCfg {
|
|
428
386
|
/**
|
|
429
387
|
* Vertical field of view in degrees.
|
|
430
388
|
* @default 75
|
|
431
389
|
*/
|
|
432
390
|
fov: number;
|
|
433
|
-
/** @private */
|
|
434
|
-
left?: never;
|
|
435
|
-
/** @private */
|
|
436
|
-
right?: never;
|
|
437
|
-
/** @private */
|
|
438
|
-
top?: never;
|
|
439
|
-
/** @private */
|
|
440
|
-
bottom?: never;
|
|
441
391
|
}
|
|
442
392
|
|
|
443
|
-
/** @event Fired when
|
|
393
|
+
/** @event Fired when a key is pressed or released while the canvas has focus. */
|
|
444
394
|
export declare interface CanvasKeyEvent {
|
|
445
|
-
/** Identifies this event type. */
|
|
446
395
|
type: 'Canvas_Key_Down' | 'Canvas_Key_Up';
|
|
447
396
|
/** Native keyboard event from the canvas interaction. */
|
|
448
397
|
event: KeyboardEvent;
|
|
449
398
|
}
|
|
450
399
|
|
|
451
|
-
/** @event Fired when the
|
|
400
|
+
/** @event Fired when the pointer clicks, enters, or leaves the canvas. */
|
|
452
401
|
export declare interface CanvasPointerEvent {
|
|
453
|
-
/** Identifies this event type. */
|
|
454
402
|
type: 'Canvas_Click' | 'Canvas_Pointer_Enter' | 'Canvas_Pointer_Leave';
|
|
455
403
|
/** Native pointer event from the canvas interaction. */
|
|
456
404
|
event: PointerEvent;
|
|
457
405
|
}
|
|
458
406
|
|
|
459
407
|
/**
|
|
460
|
-
*
|
|
408
|
+
* Startup settings for the application.
|
|
461
409
|
* @category Cfg
|
|
462
410
|
*/
|
|
463
411
|
export declare interface Cfg {
|
|
464
412
|
/** Audio settings. */
|
|
465
413
|
audio: AudioCfg;
|
|
466
|
-
/** Camera settings. */
|
|
414
|
+
/** Camera settings for a perspective or orthographic camera. */
|
|
467
415
|
cam: CamCfg;
|
|
468
416
|
/** Component settings. */
|
|
469
417
|
comps: CompsCfg;
|
|
@@ -471,6 +419,8 @@ export declare interface Cfg {
|
|
|
471
419
|
debug: DebugCfg;
|
|
472
420
|
/** Environment controls settings. */
|
|
473
421
|
envCtrls: EnvCtrlsCfg;
|
|
422
|
+
/** First-person controls settings. */
|
|
423
|
+
fpvCtrls: FpvCtrlsCfg;
|
|
474
424
|
/** Default GUI settings. */
|
|
475
425
|
gui: GuiCfg;
|
|
476
426
|
/** Light and shadow settings. */
|
|
@@ -481,40 +431,30 @@ export declare interface Cfg {
|
|
|
481
431
|
model: ModelCfg;
|
|
482
432
|
/** Orbit controls settings. */
|
|
483
433
|
orbitCtrls: OrbitCtrlsCfg;
|
|
484
|
-
/** First-person controls settings. */
|
|
485
|
-
fpvCtrls: FpvCtrlsCfg;
|
|
486
434
|
/** Post-processing settings. */
|
|
487
435
|
post: PostCfg;
|
|
488
|
-
/** Renderer settings. */
|
|
489
|
-
render: RenderCfg;
|
|
490
436
|
/** Raycasting settings. */
|
|
491
437
|
raycast: RaycastCfg;
|
|
438
|
+
/** Renderer settings. */
|
|
439
|
+
render: RenderCfg;
|
|
492
440
|
/** Scene settings. */
|
|
493
441
|
scene: SceneCfg;
|
|
494
442
|
/** State machine settings. */
|
|
495
443
|
stateMachine: StateMachineCfg;
|
|
496
444
|
}
|
|
497
445
|
|
|
498
|
-
/**
|
|
446
|
+
/** Default startup settings, updated by `setCfg()`. */
|
|
499
447
|
export declare const cfg: Cfg;
|
|
500
448
|
|
|
501
|
-
/**
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
*
|
|
507
|
-
* @example
|
|
508
|
-
* type MyClasses = Classes<{ cube: typeof Cube }, { marker: typeof Marker }>;
|
|
509
|
-
*/
|
|
510
|
-
export declare type Classes<TObj3DClasses extends Record<string, Obj3DClass> = {}, TCompClasses extends Record<string, CompClass> = {}> = {
|
|
511
|
-
objs3D?: TObj3DClasses;
|
|
512
|
-
comps?: TCompClasses;
|
|
449
|
+
/** Configuration values accepted by `setCfg`. */
|
|
450
|
+
export declare type CfgSet = DeepPartial<Cfg> & {
|
|
451
|
+
render?: DeepPartial<RenderCfg> & {
|
|
452
|
+
profile?: RenderProfileValidCfg;
|
|
453
|
+
};
|
|
513
454
|
};
|
|
514
455
|
|
|
515
|
-
/** @event Fired when
|
|
456
|
+
/** @event Fired when clip playback, weight fading, or speed changes start or complete, or when playback is canceled. */
|
|
516
457
|
export declare interface ClipEvent {
|
|
517
|
-
/** Identifies this event type. */
|
|
518
458
|
type: 'Clip_Start' | 'Clip_Complete' | 'Clip_Cancel' | 'Clip_Fade_Start' | 'Clip_Fade_Complete' | 'Clip_Speed_Start' | 'Clip_Speed_Complete';
|
|
519
459
|
/** The name of the affected `THREE.AnimationClip`. */
|
|
520
460
|
clipName: string;
|
|
@@ -524,112 +464,46 @@ export declare interface ClipEvent {
|
|
|
524
464
|
fadeMode?: ActionFadeMode;
|
|
525
465
|
}
|
|
526
466
|
|
|
527
|
-
/** Defines how a scene object participates in raycasting. */
|
|
528
|
-
export declare interface Collider {
|
|
529
|
-
/** Scene object or scene-object name used for raycasting. */
|
|
530
|
-
obj: Obj3D | string;
|
|
531
|
-
/** Hides the object while it is registered as a collider. */
|
|
532
|
-
hide?: boolean;
|
|
533
|
-
/** Allows the object to occlude tracked occludees and pickables. */
|
|
534
|
-
occluder?: boolean;
|
|
535
|
-
/** Allows the object to emit pointer events. */
|
|
536
|
-
pickable?: boolean;
|
|
537
|
-
}
|
|
538
|
-
|
|
539
|
-
declare type ColorNode = THREE_WEBGPU_TYPE.Node<'vec4'>;
|
|
540
|
-
|
|
541
467
|
/**
|
|
542
|
-
*
|
|
543
|
-
* @category Components
|
|
468
|
+
* Uses a `Mesh3D` for pointer picking or occlusion and optionally maps raycast events to another rendered mesh.
|
|
469
|
+
* @category Scene Components
|
|
544
470
|
*/
|
|
545
|
-
export declare class
|
|
546
|
-
/** The
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
private
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
/**
|
|
562
|
-
|
|
563
|
-
*
|
|
564
|
-
* @param params - The follow parameters.
|
|
565
|
-
* @param params.obj - The `Obj3D` to follow in the scene.
|
|
566
|
-
*/
|
|
567
|
-
follow({ obj }: {
|
|
568
|
-
obj: Obj3D | string;
|
|
569
|
-
}): void;
|
|
570
|
-
/* Excluded from this release type: getObj3DFollow */
|
|
571
|
-
/* Excluded from this release type: isVisibleFollow */
|
|
572
|
-
/**
|
|
573
|
-
* Applies the combined followed-object and overlap visibility.
|
|
574
|
-
* @param visible - Whether the web component is visible after combining all visibility conditions.
|
|
575
|
-
*/
|
|
576
|
-
protected onVisibilityChanged(visible: boolean): void;
|
|
577
|
-
/**
|
|
578
|
-
* Called once after the `THREE.Scene`, the `THREE.WebGLRenderer` or `THREE.WebGPURenderer`, the `EnvCtrls` are initialized and an existing GLTF model has been loaded and traversed.
|
|
579
|
-
* @public
|
|
580
|
-
*
|
|
581
|
-
* **Example**
|
|
582
|
-
* {@includeCode ../../examples/ilu-onready.ts}
|
|
583
|
-
*/
|
|
584
|
-
protected onReady(): void;
|
|
585
|
-
/**
|
|
586
|
-
* Called once after the `THREE.Scene` is initialized, before an existing GLTF model is loaded.
|
|
587
|
-
* @public
|
|
588
|
-
*/
|
|
589
|
-
protected onStart(): void;
|
|
590
|
-
/* Excluded from this release type: ready */
|
|
591
|
-
/* Excluded from this release type: setVisibleOverlap */
|
|
592
|
-
/* Excluded from this release type: start */
|
|
593
|
-
/**
|
|
594
|
-
* Registers this component for screen-space overlap tracking using `cfg.comps.overlap.padding`.
|
|
595
|
-
* Farther registered components are hidden when their screen-space rectangles overlap.
|
|
596
|
-
*/
|
|
597
|
-
trackOverlap(): void;
|
|
598
|
-
/** Stops this component from following the currently subscribed {@link Obj3D}. */
|
|
599
|
-
unfollow(): void;
|
|
600
|
-
/** Stops screen-space overlap tracking and removes any overlap-based hiding from this component. */
|
|
601
|
-
untrackOverlap(): void;
|
|
602
|
-
private updateVisibility;
|
|
471
|
+
export declare class Coll3D extends Mesh3D {
|
|
472
|
+
/** The rendered mesh represented by this collider, or `null` when the collider represents itself. */
|
|
473
|
+
target: Mesh3D | null;
|
|
474
|
+
/** Allows this collider or its mesh descendants to emit pointer events. */
|
|
475
|
+
pickable: boolean;
|
|
476
|
+
/** Allows this collider or its mesh descendants to occlude tracked objects. */
|
|
477
|
+
occluder: boolean;
|
|
478
|
+
private readonly targetName;
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
/** Initial parameters for a mesh used as a raycast collider. */
|
|
482
|
+
export declare interface Coll3DParams extends Obj3DParams {
|
|
483
|
+
/** Name of the rendered `Mesh3D` represented by this collider. Without a target, the collider represents itself. */
|
|
484
|
+
target?: string;
|
|
485
|
+
/** Allows the collider to emit pointer events. */
|
|
486
|
+
pickable?: boolean;
|
|
487
|
+
/** Allows the collider to occlude tracked objects. */
|
|
488
|
+
occluder?: boolean;
|
|
603
489
|
}
|
|
604
490
|
|
|
605
|
-
/** Constructor type for `Comp` classes. */
|
|
606
|
-
export declare type CompClass = new () => Comp;
|
|
607
|
-
|
|
608
|
-
/* Excluded from this release type: CompCtrls */
|
|
609
|
-
|
|
610
|
-
export declare type CompEvent = CompOverlapEvent | CompVisibleEvent;
|
|
611
|
-
|
|
612
491
|
/**
|
|
613
|
-
*
|
|
614
|
-
*
|
|
615
|
-
* @
|
|
492
|
+
* Groups the optional scene and web component definitions used by the app.
|
|
493
|
+
*
|
|
494
|
+
* @typeParam TScene - Record of named scene component classes or entries with initial parameters.
|
|
495
|
+
* @typeParam TWeb - Record of named web component classes or entries with initial parameters.
|
|
496
|
+
*
|
|
497
|
+
* @example
|
|
498
|
+
* type MyComps = Comps<{ cube: typeof Cube }, { marker: typeof Marker }>;
|
|
616
499
|
*/
|
|
617
|
-
export declare type
|
|
618
|
-
|
|
500
|
+
export declare type Comps<TScene extends Record<string, SceneEntry> = {}, TWeb extends Record<string, WebEntry> = {}> = {
|
|
501
|
+
scene?: TScene;
|
|
502
|
+
web?: TWeb;
|
|
619
503
|
};
|
|
620
504
|
|
|
621
|
-
/** @event Fired when the overlap state of a web component changes and triggers the corresponding XState event. */
|
|
622
|
-
export declare interface CompOverlapEvent {
|
|
623
|
-
/** Identifies this event type. */
|
|
624
|
-
type: 'Comp_Overlap_Changed';
|
|
625
|
-
/** The affected web component. */
|
|
626
|
-
comp: Comp;
|
|
627
|
-
/** Whether the component is overlapped by a nearer component. */
|
|
628
|
-
overlapped: boolean;
|
|
629
|
-
}
|
|
630
|
-
|
|
631
505
|
/**
|
|
632
|
-
*
|
|
506
|
+
* Shared component settings.
|
|
633
507
|
* @category Cfg
|
|
634
508
|
*/
|
|
635
509
|
export declare interface CompsCfg {
|
|
@@ -637,8 +511,14 @@ export declare interface CompsCfg {
|
|
|
637
511
|
overlap: CompsOverlapCfg;
|
|
638
512
|
}
|
|
639
513
|
|
|
514
|
+
/** Registered scene components and web component instances available at runtime. */
|
|
515
|
+
export declare type CompsInsts<T extends Comps> = {
|
|
516
|
+
scene: SceneInsts<NonNullable<T['scene']>>;
|
|
517
|
+
web: WebInsts<NonNullable<T['web']>>;
|
|
518
|
+
};
|
|
519
|
+
|
|
640
520
|
/**
|
|
641
|
-
*
|
|
521
|
+
* Controls spacing when hiding overlapping web components.
|
|
642
522
|
* @category Cfg
|
|
643
523
|
*/
|
|
644
524
|
export declare interface CompsOverlapCfg {
|
|
@@ -649,467 +529,163 @@ export declare interface CompsOverlapCfg {
|
|
|
649
529
|
padding: number;
|
|
650
530
|
}
|
|
651
531
|
|
|
652
|
-
/** @event Fired when the combined 3D-object and overlap visibility of a web component changes and triggers the corresponding XState event. */
|
|
653
|
-
export declare interface CompVisibleEvent {
|
|
654
|
-
/** Identifies this event type. */
|
|
655
|
-
type: 'Comp_Visible_Changed';
|
|
656
|
-
/** The affected web component. */
|
|
657
|
-
comp: Comp;
|
|
658
|
-
/** Whether the component is visible after combining all visibility conditions. */
|
|
659
|
-
visible: boolean;
|
|
660
|
-
}
|
|
661
|
-
|
|
662
532
|
/**
|
|
663
|
-
*
|
|
533
|
+
* Controls diagnostic console output.
|
|
664
534
|
* @category Cfg
|
|
665
535
|
*/
|
|
666
536
|
export declare interface DebugCfg {
|
|
667
537
|
/**
|
|
668
538
|
* Controls how much debug information is written to the console.
|
|
669
539
|
*
|
|
670
|
-
* `'none'`: No debug messages are logged.
|
|
671
|
-
* `'xstate'`: Only logs events that were accepted by the state machine.
|
|
672
|
-
* `'all'`: Logs all debug messages.
|
|
540
|
+
* - `'none'`: No debug messages are logged.
|
|
541
|
+
* - `'xstate'`: Only logs events that were accepted by the state machine.
|
|
542
|
+
* - `'all'`: Logs all debug messages.
|
|
673
543
|
* @default 'xstate'
|
|
674
544
|
*/
|
|
675
|
-
log:
|
|
545
|
+
log: DebugLog;
|
|
676
546
|
}
|
|
677
547
|
|
|
548
|
+
/** @inheritDoc DebugCfg.log */
|
|
549
|
+
export declare type DebugLog = 'none' | 'xstate' | 'all';
|
|
550
|
+
|
|
551
|
+
declare type DeepPartial<T> = T extends readonly unknown[] ? T : T extends object ? {
|
|
552
|
+
[P in keyof T]?: DeepPartial<T[P]>;
|
|
553
|
+
} : T;
|
|
554
|
+
|
|
678
555
|
/**
|
|
679
|
-
*
|
|
680
|
-
* rendering, animation playback, and material updates, while integrating system events, raycasting, and performance monitoring. It provides the foundation for real-time interaction and visual consistency across
|
|
681
|
-
* all scene components.
|
|
556
|
+
* Renders the scene and controls post-processing and adaptive performance.
|
|
682
557
|
* @category Core
|
|
683
558
|
*/
|
|
684
559
|
export declare class Engine {
|
|
685
|
-
/* Excluded from this release type: scene */
|
|
686
560
|
private readonly cam3D;
|
|
561
|
+
private readonly cfg;
|
|
687
562
|
private readonly events;
|
|
688
|
-
private readonly lib;
|
|
689
563
|
private readonly modules;
|
|
690
564
|
private readonly objs3D;
|
|
691
|
-
private readonly
|
|
565
|
+
private readonly scene;
|
|
692
566
|
private readonly infoBox;
|
|
693
|
-
private readonly model;
|
|
694
|
-
private actionCtrls;
|
|
695
|
-
private gltf;
|
|
696
|
-
private mixer;
|
|
697
567
|
private callbacks;
|
|
698
568
|
private resolveWaitForRender;
|
|
699
569
|
private canvas;
|
|
700
570
|
private composer;
|
|
701
|
-
/* Excluded from this release type: renderer */
|
|
702
571
|
private renderPipeline;
|
|
703
|
-
|
|
704
|
-
|
|
572
|
+
private postProfile;
|
|
573
|
+
private postProfileLast;
|
|
705
574
|
private fxaaPass;
|
|
706
575
|
private outputPass;
|
|
707
576
|
private renderPass;
|
|
708
577
|
private smaaPass;
|
|
709
578
|
private tslPass;
|
|
710
579
|
private aaNode;
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
private
|
|
717
|
-
private
|
|
718
|
-
private
|
|
719
|
-
private
|
|
720
|
-
private
|
|
721
|
-
private postNoiseCheck;
|
|
580
|
+
private rttNode;
|
|
581
|
+
private traaWarmupContext;
|
|
582
|
+
private ecoButtonActive;
|
|
583
|
+
private gfxChanging;
|
|
584
|
+
private gfxIndex;
|
|
585
|
+
private gfxLevels;
|
|
586
|
+
private gfxMode;
|
|
587
|
+
private readonly gfxPostProfiles;
|
|
588
|
+
private gfxState;
|
|
589
|
+
private gfxDownOnly;
|
|
722
590
|
private dTs;
|
|
723
591
|
private dT;
|
|
724
|
-
private dTFrameMax;
|
|
725
|
-
private gpuFps;
|
|
726
592
|
private timeGsap;
|
|
727
593
|
private timeLast;
|
|
728
594
|
private timeLastFrame;
|
|
729
595
|
private resizeTimeout;
|
|
730
596
|
private resizeDelay;
|
|
731
|
-
/* Excluded from this release type: __constructor */
|
|
732
|
-
/* Excluded from this release type: init */
|
|
733
|
-
private initFirstScene;
|
|
734
|
-
private initWebGpuRenderer;
|
|
735
597
|
/**
|
|
736
|
-
*
|
|
737
|
-
* @param
|
|
598
|
+
* Runs a callback on each animation frame, including frames skipped by Eco Mode.
|
|
599
|
+
* @param cb - Callback receiving the elapsed time in seconds.
|
|
738
600
|
*/
|
|
739
601
|
addOnFrameUpdate(cb: (deltaTime: number) => void): void;
|
|
740
602
|
/**
|
|
741
|
-
*
|
|
742
|
-
*
|
|
743
|
-
* @param params - Parameter object for the animation.
|
|
744
|
-
* @param params.camTarget - The target the camera should move toward.
|
|
745
|
-
* @param params.aimTarget - The target the camera should face during or after the animation.
|
|
746
|
-
* @param params.radiusOut - The outward curve radius used to shape the camera path. Default: **1**
|
|
747
|
-
* @param params.duration - The animation duration in seconds. Default: **2**
|
|
748
|
-
* @param params.ease - The easing function name for GSAP. Default: **'power1.inOut'**
|
|
749
|
-
*
|
|
750
|
-
* @remarks
|
|
751
|
-
* The method resolves `camTarget` and optionally `aimTarget` to world positions and animates the camera position along a curved trajectory instead of a straight line. If `aimTarget` is provided,
|
|
752
|
-
* the camera target position is interpolated towards the resolved aim position while the camera moves along the curve.
|
|
753
|
-
*
|
|
754
|
-
* **Events**
|
|
755
|
-
*
|
|
756
|
-
* {@link AnimEvent}
|
|
603
|
+
* Switches edge smoothing at runtime, loading the selected effect when needed. TRAA is available only with WebGPU.
|
|
604
|
+
* @param aaMode - Anti-aliasing mode, or `none` to disable smoothing.
|
|
757
605
|
*/
|
|
758
|
-
|
|
759
|
-
camTarget: THREE_TYPE.Vector3 | string | Obj3D;
|
|
760
|
-
aimTarget?: THREE_TYPE.Vector3 | string | Obj3D;
|
|
761
|
-
radiusOut?: number;
|
|
762
|
-
duration?: number;
|
|
763
|
-
ease?: string;
|
|
764
|
-
}): void;
|
|
606
|
+
enableAaMode(aaMode: AaMode): Promise<void>;
|
|
765
607
|
/**
|
|
766
|
-
*
|
|
767
|
-
*
|
|
768
|
-
*
|
|
769
|
-
* @param params - Parameter object for the animation.
|
|
770
|
-
* @param params.target - The target object or the name of the target object.
|
|
771
|
-
* @param params.duration - The animation duration in seconds. Default: **1**
|
|
772
|
-
* @param params.ease - The easing function name for GSAP. Default: **'power2.inOut'**
|
|
773
|
-
* @param params.dist - Framing factor applied to the calculated camera distance. Default: **1**
|
|
774
|
-
*
|
|
775
|
-
* @remarks
|
|
776
|
-
* Only the target object's own geometry is used to calculate the bounding size. Child objects are intentionally ignored.
|
|
777
|
-
*
|
|
778
|
-
* **Events**
|
|
779
|
-
*
|
|
780
|
-
* {@link AnimEvent}
|
|
608
|
+
* Switches screen-space lighting at runtime. WebGL supports SSAO; WebGPU supports GTAO and SSGI.
|
|
609
|
+
* SSGI requires TRAA, a perspective camera, and compatible WebGPU hardware.
|
|
610
|
+
* @param sslMode - Lighting mode, or `none` to disable it.
|
|
781
611
|
*/
|
|
782
|
-
|
|
783
|
-
target: string | Obj3D;
|
|
784
|
-
duration?: number;
|
|
785
|
-
ease?: string;
|
|
786
|
-
dist?: number;
|
|
787
|
-
}): void;
|
|
612
|
+
enableSslMode(sslMode: SslMode): Promise<void>;
|
|
788
613
|
/**
|
|
789
|
-
*
|
|
790
|
-
*
|
|
791
|
-
* @param params - Parameter object for the animation.
|
|
792
|
-
* @param params.mesh - The name of the mesh object whose material color should be animated.
|
|
793
|
-
* @param params.duration - The animation duration in seconds. Default: **0**
|
|
794
|
-
* @param params.ease - The easing function name for GSAP. Default: **'power1.inOut'**
|
|
795
|
-
*
|
|
796
|
-
* @remarks
|
|
797
|
-
* Additional properties of `params` can specify one or more material color fields to animate (e.g. `color`, `emissive`, ...), with their target color values. Values may be color strings, numbers,
|
|
798
|
-
* or `THREE.Color` instances.
|
|
799
|
-
*
|
|
800
|
-
* **Events**
|
|
801
|
-
*
|
|
802
|
-
* {@link AnimEvent}
|
|
614
|
+
* Enables or disables screen-space reflections, loading the effect when needed. Disabling WebGL SSR also hides its ground reflector.
|
|
615
|
+
* @param enable - Whether to show reflections.
|
|
803
616
|
*/
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
duration?: number;
|
|
807
|
-
ease?: string;
|
|
808
|
-
} & {
|
|
809
|
-
[key: string]: string | number | THREE_TYPE.Color;
|
|
810
|
-
}): void;
|
|
617
|
+
enableSsr(enable: boolean): Promise<void>;
|
|
618
|
+
private isPostCfg;
|
|
811
619
|
/**
|
|
812
|
-
*
|
|
813
|
-
*
|
|
814
|
-
* @param params - Parameter object for the animation.
|
|
815
|
-
* @param params.mesh - The name of the mesh object whose material property will be animated.
|
|
816
|
-
* @param params.startValue - The starting value of the property. Default: **Current material's value**
|
|
817
|
-
* @param params.infinite - If `true`, the animation loops infinitely. Default: **false**
|
|
818
|
-
* @param params.duration - The animation duration in seconds. Default: **0**
|
|
819
|
-
* @param params.ease - The easing function name for GSAP. Default: **'power1.inOut'**
|
|
820
|
-
* @param params.needsUpdate - Requests one material recompilation when the animation starts. Default: **false**
|
|
821
|
-
*
|
|
822
|
-
* @remarks
|
|
823
|
-
* Additional properties of `params` can specify one or more material numeric fields to animate (e.g. `metalness`, `roughness`, `opacity`, ...) with their target numeric values. Only the **first** provided
|
|
824
|
-
* property will be animated per call.
|
|
825
|
-
*
|
|
826
|
-
* **Events**
|
|
827
|
-
*
|
|
828
|
-
* {@link AnimFadeEvent}
|
|
620
|
+
* Stops a registered animation-frame callback.
|
|
621
|
+
* @param cb - Previously registered callback.
|
|
829
622
|
*/
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
[key: string]: any;
|
|
838
|
-
}): void;
|
|
839
|
-
private calcEaseArea;
|
|
623
|
+
removeOnFrameUpdate(cb: (deltaTime: number) => void): void;
|
|
624
|
+
private setGfxLevel;
|
|
625
|
+
private setPostWebGl;
|
|
626
|
+
private setPostWebGpu;
|
|
627
|
+
/** Toggles the browser fullscreen mode for the associated canvas element. */
|
|
628
|
+
toggleFullscreen(): void;
|
|
629
|
+
private update;
|
|
840
630
|
/**
|
|
841
|
-
*
|
|
842
|
-
* @param aaMode - The anti-aliasing mode to use.
|
|
631
|
+
* Resizes the renderer, camera projection, post-processing, and reflections to fit the canvas.
|
|
843
632
|
*/
|
|
844
|
-
|
|
633
|
+
updateCanvasResize(): void;
|
|
845
634
|
/**
|
|
846
|
-
*
|
|
847
|
-
* @param
|
|
635
|
+
* Runs an extension callback immediately with access to the public API.
|
|
636
|
+
* @param extension - Callback receiving this `Engine` instance.
|
|
848
637
|
*/
|
|
849
|
-
|
|
638
|
+
use(extension: (engine: Engine) => void): void;
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
/**
|
|
642
|
+
* Controls environment lighting, the visible background, and their rotation. The first map supplies lighting and background; later maps update only the background.
|
|
643
|
+
* @category Core
|
|
644
|
+
*/
|
|
645
|
+
export declare class EnvCtrls {
|
|
646
|
+
private readonly cfg;
|
|
647
|
+
private readonly engine;
|
|
648
|
+
private readonly events;
|
|
649
|
+
private readonly modules;
|
|
650
|
+
private readonly scene;
|
|
651
|
+
private envEnabled;
|
|
652
|
+
private envInit;
|
|
653
|
+
private envLoadId;
|
|
654
|
+
private envIntensity;
|
|
655
|
+
private bgdIntensity;
|
|
656
|
+
private bgdBlurriness;
|
|
657
|
+
private rotation;
|
|
658
|
+
private rotationSpeed;
|
|
659
|
+
private envType;
|
|
660
|
+
private envMaps;
|
|
661
|
+
private envText;
|
|
662
|
+
private bgdText;
|
|
663
|
+
private callback;
|
|
664
|
+
private frameWaiters;
|
|
665
|
+
private timeBgdRot;
|
|
666
|
+
private applyBgds;
|
|
667
|
+
private applyEnv;
|
|
668
|
+
private disposePrevBgd;
|
|
669
|
+
private disposeText;
|
|
850
670
|
/**
|
|
851
|
-
*
|
|
852
|
-
* @param
|
|
671
|
+
* Loads and applies environment lighting and background maps. Later maps replace only the background.
|
|
672
|
+
* @param params - Optional environment loading parameters. If provided, both `type` and `map` are required.
|
|
673
|
+
* @param params.type - Environment map file type. Defaults to `cfg.envCtrls.type`.
|
|
674
|
+
* @param params.map - Ordered environment map paths. Defaults to `cfg.envCtrls.map`.
|
|
853
675
|
*/
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
676
|
+
enable(params?: {
|
|
677
|
+
type: EnvCtrlsCfg["type"];
|
|
678
|
+
map: EnvCtrlsCfg["map"];
|
|
679
|
+
}): void;
|
|
680
|
+
/** Removes environment lighting and background maps, cancels pending updates, and stops rotation. */
|
|
681
|
+
disable(): void;
|
|
858
682
|
/**
|
|
859
|
-
*
|
|
860
|
-
*
|
|
861
|
-
* @param params - Parameters for controlling the animation playback.
|
|
862
|
-
* @param params.layer - The freely named layer used to group animation actions.
|
|
863
|
-
* @param params.clip - The name of the animation clip to play.
|
|
864
|
-
* @param params.blendMode - How the action is blended with other active actions. Default: **'normal'**
|
|
865
|
-
* @param params.finishMode - Whether the final pose is held or faded out after the final loop. Default: **'hold'**
|
|
866
|
-
* @param params.loopMode - Number of plays or `'infinite'` for endless looping. Default: **1**
|
|
867
|
-
* @param params.stopMode - Which previous actions of the same layer are stopped before playback. Default: **'all'**
|
|
868
|
-
* @param params.fadeDuration - Duration in seconds for fading affected previous actions out and the new action in. Default: **0**
|
|
869
|
-
* @param params.fadeDurationFinish - Duration in seconds for `finishMode: 'fadeOut'`. Default: **0**
|
|
870
|
-
* @param params.reverse - If `true`, plays the clip in reverse. Default: **false**
|
|
871
|
-
* @param params.reset - If `true`, resets the clip before a new playback. Default: **false**
|
|
872
|
-
* @param params.startSpeed - Initial playback speed for speed interpolation. Default: **0**
|
|
873
|
-
* @param params.endSpeed - Target playback speed. Default: **1**
|
|
874
|
-
* @param params.duration - Duration in seconds for speed interpolation. Default: **0**
|
|
875
|
-
* @param params.ease - GSAP easing function name. Default: **'power1.inOut'**
|
|
876
|
-
*
|
|
877
|
-
* @remarks
|
|
878
|
-
* Calling a running or fading-in action again is ignored. A finished or stopped action starts again, while an unfinished fading-out action continues at its current time and fades back in from its current weight.
|
|
879
|
-
*
|
|
880
|
-
* `finishMode` and `fadeDurationFinish` have no effect when `loopMode` is `'infinite'`.
|
|
881
|
-
*
|
|
882
|
-
* **Events**
|
|
883
|
-
*
|
|
884
|
-
* {@link ClipEvent}
|
|
683
|
+
* Returns a snapshot of environment rotation, intensity, and background blurriness.
|
|
885
684
|
*/
|
|
886
|
-
|
|
887
|
-
layer: string;
|
|
888
|
-
clip: string;
|
|
889
|
-
singleAction?: boolean;
|
|
890
|
-
blendMode?: BlendMode;
|
|
891
|
-
finishMode?: FinishMode;
|
|
892
|
-
loopMode?: LoopMode;
|
|
893
|
-
stopMode?: StopMode;
|
|
894
|
-
fadeDuration?: number;
|
|
895
|
-
fadeDurationFinish?: number;
|
|
896
|
-
reverse?: boolean;
|
|
897
|
-
reset?: boolean;
|
|
898
|
-
startSpeed?: number;
|
|
899
|
-
endSpeed?: number;
|
|
900
|
-
duration?: number;
|
|
901
|
-
ease?: string;
|
|
902
|
-
}): void;
|
|
685
|
+
get(): Partial<EnvCtrlsCfg>;
|
|
903
686
|
/**
|
|
904
|
-
*
|
|
905
|
-
*
|
|
906
|
-
* @param params - Parameters for controlling the camera animation playback.
|
|
907
|
-
* @param params.layer - The freely named layer used to group camera animation actions.
|
|
908
|
-
* @param params.clip - The name of the camera animation clip to play.
|
|
909
|
-
* @param params.blendMode - How the action is blended with other active actions. Default: **'normal'**
|
|
910
|
-
* @param params.loopMode - Number of plays or `'infinite'` for endless looping. Default: **1**
|
|
911
|
-
* @param params.stopMode - Which previous actions of the same layer are stopped before playback. Default: **'all'**
|
|
912
|
-
* @param params.fadeDuration - Duration in seconds for fading affected previous actions out and the new action in. Default: **0**
|
|
913
|
-
* @param params.reverse - If `true`, plays the clip in reverse. Default: **false**
|
|
914
|
-
* @param params.reset - If `true`, resets the clip before a new playback. Default: **false**
|
|
915
|
-
* @param params.startSpeed - Initial playback speed for speed interpolation. Default: **0**
|
|
916
|
-
* @param params.endSpeed - Target playback speed. Default: **1**
|
|
917
|
-
* @param params.duration - Duration in seconds for speed interpolation. Default: **0**
|
|
918
|
-
* @param params.ease - GSAP easing function name. Default: **'power1.inOut'**
|
|
919
|
-
*
|
|
920
|
-
* @remarks
|
|
921
|
-
* Calling a running or fading-in action again is ignored. A finished or stopped action starts again, while an unfinished fading-out action continues at its current time and fades back in from its current weight.
|
|
922
|
-
*
|
|
923
|
-
* **Events**
|
|
924
|
-
*
|
|
925
|
-
* {@link ClipEvent}
|
|
926
|
-
*/
|
|
927
|
-
playClipCam({ layer, clip: clipName, blendMode, loopMode, stopMode, fadeDuration, reverse, reset, startSpeed, endSpeed, duration, ease }: {
|
|
928
|
-
layer: string;
|
|
929
|
-
clip: string;
|
|
930
|
-
blendMode?: BlendMode;
|
|
931
|
-
loopMode?: LoopMode;
|
|
932
|
-
stopMode?: StopMode;
|
|
933
|
-
fadeDuration?: number;
|
|
934
|
-
reverse?: boolean;
|
|
935
|
-
reset?: boolean;
|
|
936
|
-
startSpeed?: number;
|
|
937
|
-
endSpeed?: number;
|
|
938
|
-
duration?: number;
|
|
939
|
-
ease?: string;
|
|
940
|
-
}): void;
|
|
941
|
-
/** The method removes the existing `THREE.AmbientLight` from the scene and releases its resources. If no ambient light exists, the method exits without performing any action. */
|
|
942
|
-
removeAmbientLight(): void;
|
|
943
|
-
/** The method removes the existing `THREE.Fog` from the scene. If no fog exists, the method exits without performing any action. */
|
|
944
|
-
removeFog(): void;
|
|
945
|
-
/** The method removes the existing `THREE.HemisphereLight` from the scene and releases its resources. If no hemisphere light exists, the method exits without performing any action. */
|
|
946
|
-
removeHemisphereLight(): void;
|
|
947
|
-
/**
|
|
948
|
-
* Removes a previously registered frame update callback.
|
|
949
|
-
* @param {(deltaTime: number) => void} cb - Callback to remove.
|
|
950
|
-
*/
|
|
951
|
-
removeOnFrameUpdate(cb: (deltaTime: number) => void): void;
|
|
952
|
-
/**
|
|
953
|
-
* The method creates or updates a Three.js `THREE.AmbientLight` instance in the scene.
|
|
954
|
-
*
|
|
955
|
-
* @param params - Parameter object for controlling the ambient light.
|
|
956
|
-
* @param params.color - The ambient light color. If omitted and the light already exists, the current color remains unchanged.
|
|
957
|
-
* @param params.intensity - The ambient light intensity. If omitted and the light already exists, the current intensity remains unchanged.
|
|
958
|
-
*
|
|
959
|
-
* @remarks
|
|
960
|
-
* The method does not apply any default values when creating the light. Creation is skipped unless both `color` and `intensity` are defined. When updating an existing light,
|
|
961
|
-
* the scene reflects changes automatically on the next render call.
|
|
962
|
-
*/
|
|
963
|
-
setAmbientLight({ color, intensity }: {
|
|
964
|
-
color?: THREE_TYPE.ColorRepresentation;
|
|
965
|
-
intensity?: number;
|
|
966
|
-
}): void;
|
|
967
|
-
private setAnimationLoop;
|
|
968
|
-
/**
|
|
969
|
-
* The method creates or updates a Three.js `THREE.Fog` instance in the scene.
|
|
970
|
-
*
|
|
971
|
-
* @param params - Parameter object for controlling the fog.
|
|
972
|
-
* @param params.color - The fog color. If omitted and the fog already exists, the current color remains unchanged.
|
|
973
|
-
* @param params.near - The near distance where fog starts. If omitted and the fog already exists, the current near value remains unchanged.
|
|
974
|
-
* @param params.far - The far distance where fog ends. If omitted and the fog already exists, the current far value remains unchanged.
|
|
975
|
-
*
|
|
976
|
-
* @remarks
|
|
977
|
-
* The method does not apply any default values when creating the fog. Creation is skipped unless `color`, `near` and `far` are defined. When updating an existing fog, the scene reflects changes automatically
|
|
978
|
-
* on the next render call.
|
|
979
|
-
*/
|
|
980
|
-
setFog({ color, near, far }: {
|
|
981
|
-
color?: THREE_TYPE.ColorRepresentation;
|
|
982
|
-
near?: number;
|
|
983
|
-
far?: number;
|
|
984
|
-
}): void;
|
|
985
|
-
/* Excluded from this release type: setFxaaResolution */
|
|
986
|
-
/**
|
|
987
|
-
* The method creates or updates a Three.js `THREE.HemisphereLight` instance in the scene.
|
|
988
|
-
*
|
|
989
|
-
* @param params - Parameter object for controlling the hemisphere light.
|
|
990
|
-
* @param params.skyColor - The sky light color. If omitted and the light already exists, the current sky color remains unchanged.
|
|
991
|
-
* @param params.groundColor - The ground light color. If omitted and the light already exists, the current ground color remains unchanged.
|
|
992
|
-
* @param params.intensity - The hemisphere light intensity. If omitted and the light already exists, the current intensity remains unchanged.
|
|
993
|
-
*
|
|
994
|
-
* @remarks
|
|
995
|
-
* The method does not apply any default values when creating the light. Creation is skipped unless `skyColor`, `groundColor` and `intensity` are defined. When updating an existing light, the scene
|
|
996
|
-
* reflects changes automatically on the next render call.
|
|
997
|
-
*/
|
|
998
|
-
setHemisphereLight({ skyColor, groundColor, intensity }: {
|
|
999
|
-
skyColor?: THREE_TYPE.ColorRepresentation;
|
|
1000
|
-
groundColor?: THREE_TYPE.ColorRepresentation;
|
|
1001
|
-
intensity?: number;
|
|
1002
|
-
}): void;
|
|
1003
|
-
/**
|
|
1004
|
-
* The method finds a Three.js mesh by name, validates that it has a material, and updates one or more of its material properties at runtime. It supports both numeric and color values as well as
|
|
1005
|
-
* texture paths (`map`, `emissiveMap`), which are automatically loaded via `THREE.TextureLoader`.
|
|
1006
|
-
*
|
|
1007
|
-
* @param params - Parameter object for setting material properties.
|
|
1008
|
-
* @param params.obj - The name of the mesh whose material properties should be modified.
|
|
1009
|
-
* @param params.needsUpdate - Requests material recompilation after applying the properties. Default: **false**
|
|
1010
|
-
*
|
|
1011
|
-
* @remarks
|
|
1012
|
-
* Additional properties of `params` can define one or more material fields to update (e.g. `color`, `roughness`, `metalness`, `map`, `emissiveMap`, ...), each with its target value. Texture paths provided
|
|
1013
|
-
* as strings are loaded asynchronously and assigned to the corresponding material slots. Unsupported or mismatched property types are ignored with a warning in debug mode.
|
|
1014
|
-
*/
|
|
1015
|
-
setMaterialProperties({ obj, needsUpdate, ...props }: {
|
|
1016
|
-
obj: string;
|
|
1017
|
-
needsUpdate?: boolean;
|
|
1018
|
-
[key: string]: any;
|
|
1019
|
-
}): void;
|
|
1020
|
-
/* Excluded from this release type: setPostWebGl */
|
|
1021
|
-
/* Excluded from this release type: setPostWebGpu */
|
|
1022
|
-
/**
|
|
1023
|
-
* The method finds a Three.js animation clip by name, validates that it exists within the loaded GLTF, and stops its playback via the `THREE.AnimationMixer`. It supports smooth fade-out transitions using
|
|
1024
|
-
* GSAP before stopping the clip completely.
|
|
1025
|
-
*
|
|
1026
|
-
* @param params - Parameter object for controlling the stop behavior.
|
|
1027
|
-
* @param params.clipName - The name of the animation clip to stop.
|
|
1028
|
-
* @param params.fadeOut - The fade-out duration in seconds before stopping the clip. Default: **0**
|
|
1029
|
-
* @param params.ease - The easing function name for the fade-out transition. Default: **'power1.inOut'**
|
|
1030
|
-
*
|
|
1031
|
-
* @remarks
|
|
1032
|
-
* The method gradually reduces the clip's playback speed to zero when `fadeOut` is greater than zero. It emits `Clip_Speed_Start`, `Clip_Speed_Complete`, and finally `Clip_Cancel`.
|
|
1033
|
-
* If no speed transition is specified, the clip is canceled immediately.
|
|
1034
|
-
*
|
|
1035
|
-
* **Events**
|
|
1036
|
-
*
|
|
1037
|
-
* {@link ClipEvent}
|
|
1038
|
-
*/
|
|
1039
|
-
stopAnimClip({ clipName, fadeOut, ease }: {
|
|
1040
|
-
clipName: string;
|
|
1041
|
-
fadeOut?: number;
|
|
1042
|
-
ease?: string;
|
|
1043
|
-
}): void;
|
|
1044
|
-
/** Toggles the browser fullscreen mode for the associated canvas element. */
|
|
1045
|
-
toggleFullscreen(): void;
|
|
1046
|
-
/**
|
|
1047
|
-
* Registers and executes a low-level extension function with access to the public `Engine` API.
|
|
1048
|
-
* @param extension - Function that receives the current `Engine` instance and can use its public members and methods.
|
|
1049
|
-
* @remarks This method is intended for advanced custom integrations where developers need direct access to the engine instance. The extension is executed once immediately when `use()` is called.
|
|
1050
|
-
*/
|
|
1051
|
-
use(extension: (engine: Engine) => void): void;
|
|
1052
|
-
private update;
|
|
1053
|
-
/** Updates the renderer, post-processing composer, and ground reflector to match the current canvas size. Ensures that the rendering resolution and reflection buffers remain consistent when the viewport changes. */
|
|
1054
|
-
updateCanvasResize(): void;
|
|
1055
|
-
}
|
|
1056
|
-
|
|
1057
|
-
/**
|
|
1058
|
-
* Controls `THREE.Scene.environment` and `THREE.Scene.background` textures, including environment lighting and optional rotation.
|
|
1059
|
-
* The first configured map is used for environment lighting and the initial background. Additional maps replace only the visible background after loading.
|
|
1060
|
-
* WebGL uses a PMREM-processed texture for environment lighting while keeping the loaded texture for the visible background.
|
|
1061
|
-
* @category Core
|
|
1062
|
-
*/
|
|
1063
|
-
export declare class EnvCtrls {
|
|
1064
|
-
private cfg;
|
|
1065
|
-
private engine;
|
|
1066
|
-
private modules;
|
|
1067
|
-
/* Excluded from this release type: envReady */
|
|
1068
|
-
/* Excluded from this release type: textReady */
|
|
1069
|
-
/* Excluded from this release type: bgdReady */
|
|
1070
|
-
private envEnabled;
|
|
1071
|
-
private envInit;
|
|
1072
|
-
private envLoadId;
|
|
1073
|
-
private envIntensity;
|
|
1074
|
-
private bgdIntensity;
|
|
1075
|
-
private bgdBlurriness;
|
|
1076
|
-
private rotation;
|
|
1077
|
-
private rotationSpeed;
|
|
1078
|
-
private envType;
|
|
1079
|
-
private envMaps;
|
|
1080
|
-
private envText;
|
|
1081
|
-
private bgdText;
|
|
1082
|
-
private callback;
|
|
1083
|
-
private frameWaiters;
|
|
1084
|
-
private timeBgdRot;
|
|
1085
|
-
/* Excluded from this release type: __constructor */
|
|
1086
|
-
/* Excluded from this release type: init */
|
|
1087
|
-
private applyBgds;
|
|
1088
|
-
private applyEnv;
|
|
1089
|
-
private disposePrevBgd;
|
|
1090
|
-
private disposeText;
|
|
1091
|
-
/**
|
|
1092
|
-
* Enables environment and background handling.
|
|
1093
|
-
* The first map is applied to `THREE.Scene.environment` and `THREE.Scene.background`; additional maps load in order and replace only `THREE.Scene.background`.
|
|
1094
|
-
* WebGL uses a PMREM-processed texture for `THREE.Scene.environment` and the loaded texture for `THREE.Scene.background`.
|
|
1095
|
-
* @param params - Optional environment loading parameters. If provided, both `type` and `map` are required.
|
|
1096
|
-
* @param params.type - Environment map file type. Defaults to `cfg.envCtrls.type`.
|
|
1097
|
-
* @param params.map - Ordered environment map paths. Defaults to `cfg.envCtrls.map`.
|
|
1098
|
-
*/
|
|
1099
|
-
enable(params?: {
|
|
1100
|
-
type: EnvCtrlsCfg["type"];
|
|
1101
|
-
map: EnvCtrlsCfg["map"];
|
|
1102
|
-
}): void;
|
|
1103
|
-
/** Disables the environment system and resets all values. */
|
|
1104
|
-
disable(): void;
|
|
1105
|
-
/**
|
|
1106
|
-
* Returns the current runtime environment control values.
|
|
1107
|
-
* @returns A snapshot of the mutable runtime settings.
|
|
1108
|
-
*/
|
|
1109
|
-
get(): Partial<EnvCtrlsCfg>;
|
|
1110
|
-
/**
|
|
1111
|
-
* Returns whether the environment system is currently enabled.
|
|
1112
|
-
* @returns `true` if `EnvCtrls` is currently enabled, otherwise `false`.
|
|
687
|
+
* Checks whether an environment or background map is applied.
|
|
688
|
+
* @returns `true` when at least one map is applied.
|
|
1113
689
|
*/
|
|
1114
690
|
isEnabled(): boolean;
|
|
1115
691
|
private loadText;
|
|
@@ -1127,7 +703,7 @@ export declare class EnvCtrls {
|
|
|
1127
703
|
}
|
|
1128
704
|
|
|
1129
705
|
/**
|
|
1130
|
-
*
|
|
706
|
+
* Controls environment lighting and the visible background.
|
|
1131
707
|
* @category Cfg
|
|
1132
708
|
*/
|
|
1133
709
|
export declare interface EnvCtrlsCfg {
|
|
@@ -1137,7 +713,7 @@ export declare interface EnvCtrlsCfg {
|
|
|
1137
713
|
*/
|
|
1138
714
|
backgroundBlurriness: number;
|
|
1139
715
|
/**
|
|
1140
|
-
*
|
|
716
|
+
* Scales background brightness.
|
|
1141
717
|
* @default 0
|
|
1142
718
|
*/
|
|
1143
719
|
backgroundIntensity: number;
|
|
@@ -1152,12 +728,12 @@ export declare interface EnvCtrlsCfg {
|
|
|
1152
728
|
*/
|
|
1153
729
|
enable: boolean;
|
|
1154
730
|
/**
|
|
1155
|
-
*
|
|
731
|
+
* Scales environment lighting intensity.
|
|
1156
732
|
* @default 1.8
|
|
1157
733
|
*/
|
|
1158
734
|
environmentIntensity: number;
|
|
1159
735
|
/**
|
|
1160
|
-
*
|
|
736
|
+
* Prepares environment map loading without enabling environment lighting.
|
|
1161
737
|
* @default false
|
|
1162
738
|
*/
|
|
1163
739
|
load: boolean;
|
|
@@ -1178,7 +754,7 @@ export declare interface EnvCtrlsCfg {
|
|
|
1178
754
|
z: number;
|
|
1179
755
|
};
|
|
1180
756
|
/**
|
|
1181
|
-
*
|
|
757
|
+
* Environment and background rotation speed in degrees per second.
|
|
1182
758
|
* @default 0
|
|
1183
759
|
*/
|
|
1184
760
|
rotationSpeed: number;
|
|
@@ -1189,24 +765,13 @@ export declare interface EnvCtrlsCfg {
|
|
|
1189
765
|
type: 'hdr' | 'exr' | 'texture';
|
|
1190
766
|
}
|
|
1191
767
|
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
type: TType;
|
|
1196
|
-
}>;
|
|
1197
|
-
|
|
1198
|
-
declare class EventDispatcher<TEvent extends {
|
|
1199
|
-
type: string;
|
|
1200
|
-
}> {
|
|
1201
|
-
private readonly listeners;
|
|
1202
|
-
addEventListener<TType extends EventType<TEvent>>(type: TType, listener: Listener<EventByType<TEvent, TType>>): Unsubscribe;
|
|
1203
|
-
removeEventListener<TType extends EventType<TEvent>>(type: TType, listener: Listener<EventByType<TEvent, TType>>): void;
|
|
1204
|
-
emit(event: TEvent): void;
|
|
1205
|
-
listenerCount<TType extends EventType<TEvent>>(type: TType): number;
|
|
768
|
+
/** @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. */
|
|
769
|
+
export declare interface EnvLoadedEvent {
|
|
770
|
+
type: 'Env_Loaded';
|
|
1206
771
|
}
|
|
1207
772
|
|
|
1208
773
|
/**
|
|
1209
|
-
*
|
|
774
|
+
* Sends application and engine events to the state machine.
|
|
1210
775
|
* @category Core
|
|
1211
776
|
*/
|
|
1212
777
|
export declare class Events {
|
|
@@ -1214,39 +779,24 @@ export declare class Events {
|
|
|
1214
779
|
private stateMachine;
|
|
1215
780
|
private eventQueue;
|
|
1216
781
|
private isProcessingEvents;
|
|
1217
|
-
/* Excluded from this release type: __constructor */
|
|
1218
|
-
/** A nested snapshot.can() is only evaluated after the current event callback has completed. */
|
|
1219
782
|
private enqueue;
|
|
1220
|
-
/* Excluded from this release type: anim */
|
|
1221
|
-
/* Excluded from this release type: animFade */
|
|
1222
|
-
/* Excluded from this release type: audioLoaded */
|
|
1223
|
-
/* Excluded from this release type: clip */
|
|
1224
|
-
/* Excluded from this release type: modelError */
|
|
1225
|
-
/* Excluded from this release type: modelLoaded */
|
|
1226
|
-
/* Excluded from this release type: modelLoading */
|
|
1227
|
-
/* Excluded from this release type: sceneRendered */
|
|
1228
783
|
/**
|
|
1229
784
|
* Sends an event to the state machine and optionally logs a debug message to the console.
|
|
1230
|
-
* @param event -
|
|
785
|
+
* @param event - Event to send to the state machine.
|
|
1231
786
|
* @param log - Information to log with the event.
|
|
1232
787
|
*/
|
|
1233
788
|
send(event: AnyEventObject, log?: string): void;
|
|
1234
|
-
/* Excluded from this release type: windowResize */
|
|
1235
789
|
}
|
|
1236
790
|
|
|
1237
|
-
declare type EventType<TEvent extends {
|
|
1238
|
-
type: string;
|
|
1239
|
-
}> = TEvent['type'];
|
|
1240
|
-
|
|
1241
791
|
/**
|
|
1242
|
-
*
|
|
1243
|
-
* - 'hold'
|
|
1244
|
-
* - 'fadeOut'
|
|
792
|
+
* Controls what happens after the final animation loop.
|
|
793
|
+
* - `'hold'`: Keeps the action enabled and holds its final pose.
|
|
794
|
+
* - `'fadeOut'`: Fades out over `fadeDurationFinish` seconds, or stops immediately when the duration is `0`.
|
|
1245
795
|
*/
|
|
1246
796
|
export declare type FinishMode = 'hold' | 'fadeOut';
|
|
1247
797
|
|
|
1248
798
|
/**
|
|
1249
|
-
*
|
|
799
|
+
* Blends distant objects into the fog color.
|
|
1250
800
|
* @category Cfg
|
|
1251
801
|
*/
|
|
1252
802
|
export declare interface FogCfg {
|
|
@@ -1273,7 +823,7 @@ export declare interface FogCfg {
|
|
|
1273
823
|
}
|
|
1274
824
|
|
|
1275
825
|
/**
|
|
1276
|
-
*
|
|
826
|
+
* Controls first-person camera movement and pointer look.
|
|
1277
827
|
* @category Core
|
|
1278
828
|
*/
|
|
1279
829
|
export declare class FpvCtrls {
|
|
@@ -1282,7 +832,6 @@ export declare class FpvCtrls {
|
|
|
1282
832
|
private readonly engine;
|
|
1283
833
|
private readonly events;
|
|
1284
834
|
private readonly modules;
|
|
1285
|
-
/* Excluded from this release type: pointerLockCtrls */
|
|
1286
835
|
private readonly params;
|
|
1287
836
|
private isMoveForward;
|
|
1288
837
|
private isMoveLeft;
|
|
@@ -1294,25 +843,37 @@ export declare class FpvCtrls {
|
|
|
1294
843
|
private readonly onClick;
|
|
1295
844
|
private readonly onKeyDown;
|
|
1296
845
|
private readonly onKeyUp;
|
|
1297
|
-
|
|
1298
|
-
|
|
846
|
+
/**
|
|
847
|
+
* Prepares pointer-look controls without enabling them.
|
|
848
|
+
*/
|
|
1299
849
|
create(): void;
|
|
1300
|
-
/**
|
|
850
|
+
/**
|
|
851
|
+
* Stops first-person movement and releases pointer lock.
|
|
852
|
+
*/
|
|
1301
853
|
disable(): void;
|
|
1302
|
-
/**
|
|
854
|
+
/**
|
|
855
|
+
* Enables first-person movement and pointer-look interaction.
|
|
856
|
+
*/
|
|
1303
857
|
enable(): void;
|
|
1304
|
-
/**
|
|
858
|
+
/**
|
|
859
|
+
* Releases pointer-look controls and their event listeners.
|
|
860
|
+
*/
|
|
1305
861
|
dispose(): void;
|
|
1306
862
|
/**
|
|
1307
|
-
* Returns the
|
|
1308
|
-
* @returns A snapshot of the mutable first-person control settings.
|
|
863
|
+
* Returns a snapshot of the current first-person control settings.
|
|
1309
864
|
*/
|
|
1310
865
|
get(): Partial<FpvCtrlsCfg>;
|
|
1311
|
-
/**
|
|
866
|
+
/**
|
|
867
|
+
* Checks whether first-person controls are enabled.
|
|
868
|
+
*/
|
|
1312
869
|
isEnabled(): boolean;
|
|
1313
|
-
/**
|
|
870
|
+
/**
|
|
871
|
+
* Checks whether pointer lock is active.
|
|
872
|
+
*/
|
|
1314
873
|
isLocked(): boolean;
|
|
1315
|
-
/**
|
|
874
|
+
/**
|
|
875
|
+
* Requests pointer lock to control the viewing direction.
|
|
876
|
+
*/
|
|
1316
877
|
lock(): void;
|
|
1317
878
|
/**
|
|
1318
879
|
* Moves the controlled camera forward.
|
|
@@ -1330,25 +891,25 @@ export declare class FpvCtrls {
|
|
|
1330
891
|
*/
|
|
1331
892
|
moveUp(distance: number): void;
|
|
1332
893
|
/**
|
|
1333
|
-
* Updates
|
|
1334
|
-
* @param params -
|
|
894
|
+
* Updates first-person movement and pointer-look settings. Controls must already be created.
|
|
895
|
+
* @param params - Settings to change; omitted values remain unchanged.
|
|
1335
896
|
*/
|
|
1336
897
|
set(params: Partial<FpvCtrlsCfg>): void;
|
|
1337
|
-
/**
|
|
898
|
+
/**
|
|
899
|
+
* Releases pointer lock and stops pointer-look interaction.
|
|
900
|
+
*/
|
|
1338
901
|
unlock(): void;
|
|
1339
902
|
/**
|
|
1340
|
-
*
|
|
903
|
+
* Runs an extension callback immediately with access to the public API.
|
|
1341
904
|
*
|
|
1342
|
-
* @param extension -
|
|
905
|
+
* @param extension - Callback receiving this `FpvCtrls` instance.
|
|
1343
906
|
*
|
|
1344
|
-
* @remarks
|
|
1345
|
-
* This method is intended for advanced custom integrations where developers need direct access to the FpvCtrls instance. The extension is executed once immediately when `use()` is called.
|
|
1346
907
|
*/
|
|
1347
908
|
use(extension: (fpvctrls: FpvCtrls) => void): void;
|
|
1348
909
|
}
|
|
1349
910
|
|
|
1350
911
|
/**
|
|
1351
|
-
*
|
|
912
|
+
* Controls first-person camera movement and pointer look.
|
|
1352
913
|
* @category Cfg
|
|
1353
914
|
*/
|
|
1354
915
|
export declare interface FpvCtrlsCfg {
|
|
@@ -1358,7 +919,7 @@ export declare interface FpvCtrlsCfg {
|
|
|
1358
919
|
*/
|
|
1359
920
|
enable: boolean;
|
|
1360
921
|
/**
|
|
1361
|
-
*
|
|
922
|
+
* Prepares first-person controls without enabling them.
|
|
1362
923
|
* @default false
|
|
1363
924
|
*/
|
|
1364
925
|
load: boolean;
|
|
@@ -1409,14 +970,13 @@ export declare interface FpvCtrlsCfg {
|
|
|
1409
970
|
keyMoveDown: string;
|
|
1410
971
|
}
|
|
1411
972
|
|
|
1412
|
-
/** @event Fired when
|
|
973
|
+
/** @event Fired when first-person controls are enabled, disabled, disposed, locked, or unlocked. */
|
|
1413
974
|
export declare interface FpvCtrlsEvent {
|
|
1414
|
-
/** Identifies this event type. */
|
|
1415
975
|
type: 'FpvCtrls_Disabled' | 'FpvCtrls_Disposed' | 'FpvCtrls_Enabled' | 'FpvCtrls_Lock' | 'FpvCtrls_Unlock';
|
|
1416
976
|
}
|
|
1417
977
|
|
|
1418
978
|
/**
|
|
1419
|
-
*
|
|
979
|
+
* Controls edge smoothing with FXAA.
|
|
1420
980
|
* @category Cfg
|
|
1421
981
|
*/
|
|
1422
982
|
export declare interface FxaaCfg {
|
|
@@ -1427,29 +987,59 @@ export declare interface FxaaCfg {
|
|
|
1427
987
|
sharpness: number;
|
|
1428
988
|
}
|
|
1429
989
|
|
|
1430
|
-
|
|
990
|
+
/**
|
|
991
|
+
* Controls contact shading with GTAO.
|
|
992
|
+
* @category Cfg
|
|
993
|
+
*/
|
|
994
|
+
export declare interface GtaoCfg {
|
|
995
|
+
/**
|
|
996
|
+
* Ambient occlusion radius in world units.
|
|
997
|
+
* @default 0.25
|
|
998
|
+
*/
|
|
999
|
+
radius: number;
|
|
1000
|
+
/**
|
|
1001
|
+
* Assumed surface thickness for ambient occlusion.
|
|
1002
|
+
* @default 1
|
|
1003
|
+
*/
|
|
1004
|
+
thickness: number;
|
|
1005
|
+
/**
|
|
1006
|
+
* Scales the strength of the ambient occlusion.
|
|
1007
|
+
* @default 1
|
|
1008
|
+
*/
|
|
1009
|
+
scale: number;
|
|
1010
|
+
/**
|
|
1011
|
+
* Sample count for ambient occlusion; higher values increase GPU work.
|
|
1012
|
+
* @default 16
|
|
1013
|
+
*/
|
|
1014
|
+
samples: number;
|
|
1015
|
+
/**
|
|
1016
|
+
* Resolution scale for ambient occlusion.
|
|
1017
|
+
* @default 1
|
|
1018
|
+
*/
|
|
1019
|
+
resolutionScale: number;
|
|
1020
|
+
}
|
|
1431
1021
|
|
|
1432
1022
|
/**
|
|
1433
|
-
*
|
|
1023
|
+
* Controls runtime statistics, the Inspector, and the Menu Bar.
|
|
1434
1024
|
* @category Cfg
|
|
1435
1025
|
*/
|
|
1436
1026
|
export declare interface GuiCfg {
|
|
1437
|
-
/**
|
|
1027
|
+
/** Runtime statistics and renderer information. */
|
|
1438
1028
|
infoBox: InfoBoxCfg;
|
|
1439
|
-
/**
|
|
1029
|
+
/** Runtime Inspector settings. */
|
|
1440
1030
|
inspector: {
|
|
1441
1031
|
/**
|
|
1442
|
-
*
|
|
1032
|
+
* Enables the Inspector for tuning runtime settings.
|
|
1443
1033
|
* @default false
|
|
1444
1034
|
*/
|
|
1445
1035
|
enable: boolean;
|
|
1446
1036
|
};
|
|
1447
|
-
/**
|
|
1037
|
+
/** Menu Bar settings. */
|
|
1448
1038
|
menuBar: MenuBarCfg;
|
|
1449
1039
|
}
|
|
1450
1040
|
|
|
1451
1041
|
/**
|
|
1452
|
-
*
|
|
1042
|
+
* Controls ambient lighting from the sky and ground.
|
|
1453
1043
|
* @category Cfg
|
|
1454
1044
|
*/
|
|
1455
1045
|
export declare interface HemisphereCfg {
|
|
@@ -1475,21 +1065,13 @@ export declare interface HemisphereCfg {
|
|
|
1475
1065
|
intensity: number;
|
|
1476
1066
|
}
|
|
1477
1067
|
|
|
1478
|
-
declare interface ImageTexture {
|
|
1479
|
-
name: string;
|
|
1480
|
-
material: THREE_TYPE.MeshBasicMaterial | THREE_TYPE.MeshStandardMaterial;
|
|
1481
|
-
slot: TextureSlot;
|
|
1482
|
-
lightMapIntensity: number;
|
|
1483
|
-
channel: number;
|
|
1484
|
-
}
|
|
1485
|
-
|
|
1486
1068
|
/**
|
|
1487
|
-
*
|
|
1069
|
+
* Selects runtime statistics shown in the Info Bar.
|
|
1488
1070
|
* @category Cfg
|
|
1489
1071
|
*/
|
|
1490
1072
|
export declare interface InfoBoxCfg {
|
|
1491
1073
|
/**
|
|
1492
|
-
*
|
|
1074
|
+
* Displays the Info Bar and collects runtime statistics.
|
|
1493
1075
|
* @default false
|
|
1494
1076
|
*/
|
|
1495
1077
|
enable: boolean;
|
|
@@ -1509,76 +1091,72 @@ export declare interface InfoBoxCfg {
|
|
|
1509
1091
|
*/
|
|
1510
1092
|
frame: boolean;
|
|
1511
1093
|
/**
|
|
1512
|
-
* Shows
|
|
1094
|
+
* Shows the number of draw calls.
|
|
1513
1095
|
* @default true
|
|
1514
1096
|
*/
|
|
1515
1097
|
calls: boolean;
|
|
1516
1098
|
/**
|
|
1517
|
-
* Shows
|
|
1099
|
+
* Shows the number of rendered triangles.
|
|
1518
1100
|
* @default true
|
|
1519
1101
|
*/
|
|
1520
1102
|
triangles: boolean;
|
|
1521
1103
|
/**
|
|
1522
|
-
* Shows
|
|
1104
|
+
* Shows the number of rendered lines.
|
|
1523
1105
|
* @default true
|
|
1524
1106
|
*/
|
|
1525
1107
|
lines: boolean;
|
|
1526
1108
|
/**
|
|
1527
|
-
* Shows
|
|
1109
|
+
* Shows the number of rendered points.
|
|
1528
1110
|
* @default true
|
|
1529
1111
|
*/
|
|
1530
1112
|
points: boolean;
|
|
1531
1113
|
/**
|
|
1532
|
-
* Shows
|
|
1114
|
+
* Shows the number of allocated geometries.
|
|
1533
1115
|
* @default true
|
|
1534
1116
|
*/
|
|
1535
1117
|
geometries: boolean;
|
|
1536
1118
|
/**
|
|
1537
|
-
* Shows
|
|
1119
|
+
* Shows the number of allocated textures.
|
|
1538
1120
|
* @default true
|
|
1539
1121
|
*/
|
|
1540
1122
|
textures: boolean;
|
|
1541
1123
|
/**
|
|
1542
|
-
* Shows the number of compiled WebGL
|
|
1124
|
+
* Shows the number of compiled WebGL shader programs.
|
|
1543
1125
|
* @default true
|
|
1544
1126
|
*/
|
|
1545
1127
|
programs: boolean;
|
|
1546
1128
|
/**
|
|
1547
|
-
*
|
|
1129
|
+
* Number of display updates per second.
|
|
1548
1130
|
* @default 10
|
|
1549
1131
|
*/
|
|
1550
1132
|
logsPerSecond: number;
|
|
1551
1133
|
}
|
|
1552
1134
|
|
|
1553
|
-
/* Excluded from this release type: Lib */
|
|
1554
|
-
|
|
1555
1135
|
/**
|
|
1556
|
-
*
|
|
1557
|
-
* @category
|
|
1136
|
+
* Connects a light to the scene component lifecycle.
|
|
1137
|
+
* @category Scene Components
|
|
1558
1138
|
*/
|
|
1559
1139
|
export declare class Light3D extends Obj3D {
|
|
1560
1140
|
/**
|
|
1561
|
-
*
|
|
1141
|
+
* Light used by this component. Replace it to use another light type.
|
|
1562
1142
|
* @default `THREE.PointLight`
|
|
1563
1143
|
* @public
|
|
1564
1144
|
*/
|
|
1565
1145
|
obj: THREE_TYPE.Light;
|
|
1566
|
-
/* Excluded from this release type: __constructor */
|
|
1567
1146
|
/**
|
|
1568
|
-
* Called
|
|
1147
|
+
* Called when a matching GLTF light is found. Adopts the light for this component.
|
|
1569
1148
|
*
|
|
1570
1149
|
* @param objGltf - The currently traversed `THREE.Light`.
|
|
1571
1150
|
* @public
|
|
1572
1151
|
*
|
|
1573
1152
|
* **Example**
|
|
1574
|
-
* {@includeCode
|
|
1153
|
+
* {@includeCode ../../../../apps-doc/examples/light3d-spot.ts}
|
|
1575
1154
|
*/
|
|
1576
1155
|
protected onTraverse(objGltf: THREE_TYPE.Light): void;
|
|
1577
|
-
/* Excluded from this release type: traverse */
|
|
1578
1156
|
}
|
|
1579
1157
|
|
|
1580
1158
|
/**
|
|
1581
|
-
*
|
|
1159
|
+
* Controls light shadows and area-light support.
|
|
1582
1160
|
* @category Cfg
|
|
1583
1161
|
*/
|
|
1584
1162
|
export declare interface LightCfg {
|
|
@@ -1588,7 +1166,7 @@ export declare interface LightCfg {
|
|
|
1588
1166
|
*/
|
|
1589
1167
|
castShadow: boolean;
|
|
1590
1168
|
/**
|
|
1591
|
-
*
|
|
1169
|
+
* Enables rectangular area-light support.
|
|
1592
1170
|
* @default false
|
|
1593
1171
|
*/
|
|
1594
1172
|
rectArea: boolean;
|
|
@@ -1624,17 +1202,15 @@ export declare interface LightCfg {
|
|
|
1624
1202
|
far: number;
|
|
1625
1203
|
}
|
|
1626
1204
|
|
|
1627
|
-
declare type Listener<TEvent> = (event: TEvent) => void;
|
|
1628
|
-
|
|
1629
1205
|
/**
|
|
1630
|
-
*
|
|
1631
|
-
* - number: Plays the action the specified positive number of times.
|
|
1632
|
-
* - 'infinite'
|
|
1206
|
+
* Controls how often an animation plays.
|
|
1207
|
+
* - A positive number: Plays the action the specified positive number of times.
|
|
1208
|
+
* - `'infinite'`: Repeats the action indefinitely.
|
|
1633
1209
|
*/
|
|
1634
1210
|
export declare type LoopMode = number | 'infinite';
|
|
1635
1211
|
|
|
1636
1212
|
/**
|
|
1637
|
-
*
|
|
1213
|
+
* Controls the Menu Bar appearance and availability.
|
|
1638
1214
|
* @category Cfg
|
|
1639
1215
|
*/
|
|
1640
1216
|
export declare interface MenuBarCfg {
|
|
@@ -1656,22 +1232,20 @@ export declare interface MenuBarCfg {
|
|
|
1656
1232
|
}
|
|
1657
1233
|
|
|
1658
1234
|
/**
|
|
1659
|
-
*
|
|
1660
|
-
* @category
|
|
1235
|
+
* Controls a mesh, its materials, and optional screen-space reflections.
|
|
1236
|
+
* @category Scene Components
|
|
1661
1237
|
*/
|
|
1662
1238
|
export declare class Mesh3D extends Obj3D {
|
|
1663
1239
|
/**
|
|
1664
|
-
*
|
|
1240
|
+
* Mesh rendered by this component. Replace it to use custom geometry or materials.
|
|
1665
1241
|
* @default `THREE.BoxGeometry`, `THREE.MeshPhysicalMaterial`
|
|
1666
1242
|
*/
|
|
1667
1243
|
obj: THREE_TYPE.Mesh;
|
|
1668
1244
|
/** `ReflectorForSSRPass` surface used for screen-space reflections (SSR). When set, it renders dynamic reflections on a ground plane. */
|
|
1669
1245
|
groundReflector: ReflectorForSSRPass | null;
|
|
1670
|
-
/** Objects
|
|
1246
|
+
/** Objects selected for WebGL screen-space reflections. */
|
|
1671
1247
|
reflectivesSSR: THREE_TYPE.Object3D[];
|
|
1672
1248
|
private model;
|
|
1673
|
-
/* Excluded from this release type: lib */
|
|
1674
|
-
/* Excluded from this release type: __constructor */
|
|
1675
1249
|
/**
|
|
1676
1250
|
* Animates one or more color properties of this mesh's material.
|
|
1677
1251
|
* @param params - Animation parameters and target material color properties such as `color` or `emissive`.
|
|
@@ -1702,47 +1276,42 @@ export declare class Mesh3D extends Obj3D {
|
|
|
1702
1276
|
[key: string]: any;
|
|
1703
1277
|
}): void;
|
|
1704
1278
|
/**
|
|
1705
|
-
*
|
|
1706
|
-
* @param
|
|
1707
|
-
* @
|
|
1708
|
-
*/
|
|
1709
|
-
setMaterialProperties({ needsUpdate, ...properties }: {
|
|
1710
|
-
needsUpdate?: boolean;
|
|
1711
|
-
[key: string]: any;
|
|
1712
|
-
}): void;
|
|
1713
|
-
/**
|
|
1714
|
-
* Loads an unused texture embedded in the current GLTF and assigns it to a material.
|
|
1715
|
-
* @param options - Unused texture assignment settings.
|
|
1716
|
-
* @param options.name - Name of the GLTF image used by the texture.
|
|
1717
|
-
* @param options.material - Material that receives the unused texture.
|
|
1718
|
-
* @param options.slot - Target material texture slot. See {@link TextureSlot}.
|
|
1719
|
-
* @param options.lightMapIntensity - Light map intensity used for `LightMap`. Default: **1**
|
|
1720
|
-
* @param options.channel - Texture UV channel. Default: **1**
|
|
1279
|
+
* Returns an image texture requested from an unused GLTF image.
|
|
1280
|
+
* @param name - GLTF image name passed to {@link requestImageTexture} during `onStart()`.
|
|
1281
|
+
* @returns The initialized texture shared across progressive model levels.
|
|
1721
1282
|
* @public
|
|
1722
1283
|
*/
|
|
1723
|
-
protected
|
|
1724
|
-
name: string;
|
|
1725
|
-
material: THREE_TYPE.MeshBasicMaterial | THREE_TYPE.MeshStandardMaterial;
|
|
1726
|
-
slot: TextureSlot;
|
|
1727
|
-
lightMapIntensity?: number;
|
|
1728
|
-
channel?: number;
|
|
1729
|
-
}): void;
|
|
1284
|
+
protected getImageTexture(name: string): THREE_TYPE.Texture;
|
|
1730
1285
|
/**
|
|
1731
|
-
* Called
|
|
1286
|
+
* Called when a matching GLTF mesh is found. Adopts the mesh for this component.
|
|
1732
1287
|
* @param objGltf - The currently traversed mesh.
|
|
1733
1288
|
* @public
|
|
1734
1289
|
*
|
|
1735
1290
|
* **Example**
|
|
1736
|
-
* {@includeCode
|
|
1291
|
+
* {@includeCode ../../../../apps-doc/examples/mesh3d-cube.ts}
|
|
1737
1292
|
*/
|
|
1738
1293
|
protected onTraverse(objGltf: THREE_TYPE.Mesh): void;
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1294
|
+
/**
|
|
1295
|
+
* Requests a Three.js texture from an unused GLTF image for initialization before the model is traversed. Call this method from `onStart()` for every unused image that will be accessed later.
|
|
1296
|
+
* @param name - Name of the GLTF image.
|
|
1297
|
+
* @public
|
|
1298
|
+
*/
|
|
1299
|
+
protected requestImageTexture(name: string): void;
|
|
1300
|
+
/**
|
|
1301
|
+
* Updates one or more properties across all material slots of this mesh. Shared materials are modified in place.
|
|
1302
|
+
* @param properties - Material properties to update. Texture paths are supported for `map` and `emissiveMap`.
|
|
1303
|
+
* @param properties.recursive - Includes all descendant meshes when true. Default: **false**
|
|
1304
|
+
* @param properties.needsUpdate - Requests material recompilation after applying the properties. Default: **false**
|
|
1305
|
+
*/
|
|
1306
|
+
setMaterialProps({ recursive, needsUpdate, ...properties }: {
|
|
1307
|
+
recursive?: boolean;
|
|
1308
|
+
needsUpdate?: boolean;
|
|
1309
|
+
[key: string]: any;
|
|
1310
|
+
}): void;
|
|
1742
1311
|
}
|
|
1743
1312
|
|
|
1744
1313
|
/**
|
|
1745
|
-
*
|
|
1314
|
+
* Controls shadows and visibility culling for imported meshes.
|
|
1746
1315
|
* @category Cfg
|
|
1747
1316
|
*/
|
|
1748
1317
|
export declare interface MeshCfg {
|
|
@@ -1763,46 +1332,8 @@ export declare interface MeshCfg {
|
|
|
1763
1332
|
frustumCulled: boolean;
|
|
1764
1333
|
}
|
|
1765
1334
|
|
|
1766
|
-
declare class Model {
|
|
1767
|
-
private readonly canvas;
|
|
1768
|
-
private readonly cfg;
|
|
1769
|
-
private readonly events;
|
|
1770
|
-
private readonly modules;
|
|
1771
|
-
private readonly renderer;
|
|
1772
|
-
private readonly initFirstScene;
|
|
1773
|
-
private readonly reportModelReady;
|
|
1774
|
-
private readonly rendererReady;
|
|
1775
|
-
private readonly waitForRender;
|
|
1776
|
-
/* Excluded from this release type: sceneReady */
|
|
1777
|
-
private resolveSceneReady;
|
|
1778
|
-
private rejectSceneReady;
|
|
1779
|
-
private gltf;
|
|
1780
|
-
private meshes;
|
|
1781
|
-
private scene;
|
|
1782
|
-
private readonly imageTextures;
|
|
1783
|
-
private readonly imageTextureInits;
|
|
1784
|
-
private readonly textures;
|
|
1785
|
-
constructor({ canvas, cfg, events, modules, renderer, rendererReady, initFirstScene, reportModelReady, waitForRender }: ModelParams);
|
|
1786
|
-
private addMaterialsFromMesh;
|
|
1787
|
-
private addTexturesFromMaterial;
|
|
1788
|
-
private addTexture;
|
|
1789
|
-
private applyImageTexturesToMaterials;
|
|
1790
|
-
private disposeGeometries;
|
|
1791
|
-
private disposeSourceMaterials;
|
|
1792
|
-
private initImageTexture;
|
|
1793
|
-
private initImageTextures;
|
|
1794
|
-
private initTextures;
|
|
1795
|
-
/* Excluded from this release type: load */
|
|
1796
|
-
private loadGltf;
|
|
1797
|
-
private prepareImageTextures;
|
|
1798
|
-
/* Excluded from this release type: prepareImageTextureForMaterial */
|
|
1799
|
-
private reportError;
|
|
1800
|
-
private updateGeometries;
|
|
1801
|
-
private updateTextureImages;
|
|
1802
|
-
}
|
|
1803
|
-
|
|
1804
1335
|
/**
|
|
1805
|
-
*
|
|
1336
|
+
* Controls progressive GLTF/GLB loading and compression support.
|
|
1806
1337
|
* @category Cfg
|
|
1807
1338
|
*/
|
|
1808
1339
|
export declare interface ModelCfg {
|
|
@@ -1819,7 +1350,7 @@ export declare interface ModelCfg {
|
|
|
1819
1350
|
texture: 'none' | 'webp' | 'ktx2';
|
|
1820
1351
|
};
|
|
1821
1352
|
/**
|
|
1822
|
-
*
|
|
1353
|
+
* GLTF/GLB paths ordered from low to high quality. The first file initializes the scene; later files replace matching geometry and textured materials.
|
|
1823
1354
|
* @default []
|
|
1824
1355
|
*/
|
|
1825
1356
|
file: string[];
|
|
@@ -1835,9 +1366,8 @@ export declare interface ModelCfg {
|
|
|
1835
1366
|
progressBar: boolean;
|
|
1836
1367
|
}
|
|
1837
1368
|
|
|
1838
|
-
/** @event Fired when
|
|
1369
|
+
/** @event Fired when model loading fails. */
|
|
1839
1370
|
export declare interface ModelErrorEvent {
|
|
1840
|
-
/** Identifies this event type. */
|
|
1841
1371
|
type: 'Model_Error';
|
|
1842
1372
|
/** The caught error object. */
|
|
1843
1373
|
error: Error;
|
|
@@ -1849,7 +1379,7 @@ export declare interface ModelLoadedEvent {
|
|
|
1849
1379
|
type: 'Model_Loaded' | `Model${number}_Loaded`;
|
|
1850
1380
|
}
|
|
1851
1381
|
|
|
1852
|
-
/** @event Fired
|
|
1382
|
+
/** @event Fired as model loading progresses. */
|
|
1853
1383
|
export declare interface ModelLoadingEvent {
|
|
1854
1384
|
/** Identifies the loading model. */
|
|
1855
1385
|
type: 'Model_Loading' | `Model${number}_Loading`;
|
|
@@ -1857,124 +1387,43 @@ export declare interface ModelLoadingEvent {
|
|
|
1857
1387
|
loading: number;
|
|
1858
1388
|
}
|
|
1859
1389
|
|
|
1860
|
-
|
|
1861
|
-
canvas: HTMLElement;
|
|
1862
|
-
cfg: Cfg;
|
|
1863
|
-
events: Events;
|
|
1864
|
-
modules: Modules;
|
|
1865
|
-
renderer: Renderer_2;
|
|
1866
|
-
rendererReady: Promise<void> | null;
|
|
1867
|
-
initFirstScene: (gltf: GLTF) => Map<string, THREE_TYPE.Mesh>;
|
|
1868
|
-
reportModelReady: () => void;
|
|
1869
|
-
waitForRender: () => Promise<void>;
|
|
1870
|
-
}
|
|
1871
|
-
|
|
1872
|
-
/** @event Fired after the final progressive model variant has been applied and rendered and triggers the corresponding XState event. */
|
|
1390
|
+
/** @event Fired after the final progressive model has been applied and rendered. */
|
|
1873
1391
|
export declare interface ModelReadyEvent {
|
|
1874
|
-
/** Identifies this event type. */
|
|
1875
1392
|
type: 'Model_Ready';
|
|
1876
1393
|
}
|
|
1877
1394
|
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
gtaoNodeClass: typeof ao | null;
|
|
1887
|
-
ssrNode: typeof ssr | null;
|
|
1888
|
-
ssrPassClass: typeof SSRPass | null;
|
|
1889
|
-
paneClass: typeof Pane | null;
|
|
1890
|
-
createBrowserInspector: typeof createBrowserInspector | null;
|
|
1891
|
-
effectComposerClass: typeof EffectComposer | null;
|
|
1892
|
-
envLoader: EXRLoader | HDRLoader | null;
|
|
1893
|
-
dracoLoader: DRACOLoader | null;
|
|
1894
|
-
gltfLoader: GLTFLoader | null;
|
|
1895
|
-
ktx2Loader: KTX2Loader | null;
|
|
1896
|
-
meshoptDecoder: typeof MeshoptDecoder | null;
|
|
1897
|
-
outputPassClass: typeof OutputPass | null;
|
|
1898
|
-
renderPassClass: typeof RenderPass | null;
|
|
1899
|
-
shaderPassClass: typeof ShaderPass | null;
|
|
1900
|
-
rectAreaLightNodeClass: typeof THREE_WEBGPU_TYPE.RectAreaLightNode | null;
|
|
1901
|
-
rectAreaLightTexturesLib: typeof RectAreaLightTexturesLib | null;
|
|
1902
|
-
rectAreaLightUniformsLib: typeof RectAreaLightUniformsLib | null;
|
|
1903
|
-
orbitControlsClass: typeof OrbitControls | null;
|
|
1904
|
-
pointerLockControlsClass: typeof PointerLockControls | null;
|
|
1905
|
-
webGpuRendererClass: typeof THREE_WEBGPU_TYPE.WebGPURenderer | null;
|
|
1906
|
-
renderPipelineClass: typeof THREE_WEBGPU_TYPE.RenderPipeline | null;
|
|
1907
|
-
tslPass: typeof THREE_WEBTSL_TYPE.pass | null;
|
|
1908
|
-
tslMrt: typeof THREE_WEBTSL_TYPE.mrt | null;
|
|
1909
|
-
tslOutput: typeof THREE_WEBTSL_TYPE.output | null;
|
|
1910
|
-
tslVelocity: typeof THREE_WEBTSL_TYPE.velocity | null;
|
|
1911
|
-
tslRenderOutput: typeof THREE_WEBTSL_TYPE.renderOutput | null;
|
|
1912
|
-
tslNormalView: typeof THREE_WEBTSL_TYPE.normalView | null;
|
|
1913
|
-
tslMetalness: typeof THREE_WEBTSL_TYPE.metalness | null;
|
|
1914
|
-
tslRoughness: typeof THREE_WEBTSL_TYPE.roughness | null;
|
|
1915
|
-
tslSample: typeof THREE_WEBTSL_TYPE.sample | null;
|
|
1916
|
-
tslVec2: typeof THREE_WEBTSL_TYPE.vec2 | null;
|
|
1917
|
-
tslVec3: typeof THREE_WEBTSL_TYPE.vec3 | null;
|
|
1918
|
-
tslVec4: typeof THREE_WEBTSL_TYPE.vec4 | null;
|
|
1919
|
-
tslFloat: typeof THREE_WEBTSL_TYPE.float | null;
|
|
1920
|
-
packNormalToRGB: typeof THREE_WEBTSL_TYPE.packNormalToRGB | null;
|
|
1921
|
-
unpackRGBToNormal: typeof THREE_WEBTSL_TYPE.unpackRGBToNormal | null;
|
|
1922
|
-
private cfg;
|
|
1923
|
-
constructor(cfg: Cfg);
|
|
1924
|
-
private consoleLog;
|
|
1925
|
-
importDracoLoader(): Promise<void>;
|
|
1926
|
-
importEffectComposer(): Promise<void>;
|
|
1927
|
-
importENVLoader(): Promise<void>;
|
|
1928
|
-
importFpvCtrls(): Promise<void>;
|
|
1929
|
-
importFXAANode(aaMode: Cfg['post']['aa']['mode']): Promise<void>;
|
|
1930
|
-
importFXAAShader(aaMode: Cfg['post']['aa']['mode']): Promise<void>;
|
|
1931
|
-
importGLTFLoader(): Promise<void>;
|
|
1932
|
-
importGpuDetect(): Promise<void>;
|
|
1933
|
-
importGtaoNode(enable: boolean): Promise<void>;
|
|
1934
|
-
importKTX2Loader(): Promise<void>;
|
|
1935
|
-
importMeshoptDecoder(): Promise<void>;
|
|
1936
|
-
importOrbitCtrls(): Promise<void>;
|
|
1937
|
-
importOutputPass(): Promise<void>;
|
|
1938
|
-
importRectAreaLight(webGpu: boolean): Promise<void>;
|
|
1939
|
-
importRenderPass(): Promise<void>;
|
|
1940
|
-
importSMAANode(aaMode: Cfg['post']['aa']['mode']): Promise<void>;
|
|
1941
|
-
importSMAAPass(aaMode: Cfg['post']['aa']['mode']): Promise<void>;
|
|
1942
|
-
importSSAOPass(enable: boolean): Promise<void>;
|
|
1943
|
-
importSsrNode(enable: boolean): Promise<void>;
|
|
1944
|
-
importSsrPass(enable: boolean): Promise<void>;
|
|
1945
|
-
importStatelyAi(): Promise<void>;
|
|
1946
|
-
importThreeTsl(): Promise<void>;
|
|
1947
|
-
importThreeWebGpu(): Promise<void>;
|
|
1948
|
-
importTRAANode(aaMode: Cfg['post']['aa']['mode']): Promise<void>;
|
|
1949
|
-
importTweakpane(): Promise<void>;
|
|
1950
|
-
}
|
|
1395
|
+
/**
|
|
1396
|
+
* Controls where multisample anti-aliasing smooths edges.
|
|
1397
|
+
*
|
|
1398
|
+
* - `'none'`: Disables MSAA.
|
|
1399
|
+
* - `'render'`: Applies MSAA only while rendering the scene.
|
|
1400
|
+
* - `'post'`: Also applies MSAA to supported post-processing scene targets.
|
|
1401
|
+
*/
|
|
1402
|
+
export declare type MsaaMode = 'none' | 'render' | 'post';
|
|
1951
1403
|
|
|
1952
1404
|
/**
|
|
1953
1405
|
* Wraps a `THREE.Object3D` and provides lifecycle hooks, scene integration, animation support, and position-, rotation- and visibility-change events. Extend this class to implement custom object behavior.
|
|
1954
|
-
* @category
|
|
1406
|
+
* @category Scene Components
|
|
1955
1407
|
*/
|
|
1956
1408
|
export declare class Obj3D {
|
|
1957
1409
|
/** @public */
|
|
1958
1410
|
protected canvas: HTMLElement;
|
|
1959
1411
|
protected cfg: Cfg;
|
|
1960
|
-
/* Excluded from this release type: events */
|
|
1961
1412
|
protected name: string;
|
|
1962
1413
|
/** The managed `THREE.Object3D` instance for this object. It is `null` until a scene object is assigned. */
|
|
1963
1414
|
obj: THREE_TYPE.Object3D | null;
|
|
1964
|
-
/**
|
|
1415
|
+
/** Contains all Scene Components registered through `comps.scene`, keyed by registration name. */
|
|
1965
1416
|
protected objs3D: Map<string, Obj3D> | null;
|
|
1966
|
-
/* Excluded from this release type: raycast */
|
|
1967
1417
|
/**
|
|
1968
|
-
*
|
|
1418
|
+
* Active renderer for custom rendering integrations.
|
|
1969
1419
|
* @public
|
|
1970
1420
|
*/
|
|
1971
1421
|
protected renderer: Readonly<THREE_TYPE.WebGLRenderer> | Readonly<THREE_WEBGPU_TYPE.WebGPURenderer>;
|
|
1972
1422
|
/**
|
|
1973
|
-
* The
|
|
1423
|
+
* The Illutions scene this component belongs to. Use `scene.obj` for direct Three.js scene access.
|
|
1974
1424
|
* @public
|
|
1975
1425
|
*/
|
|
1976
|
-
|
|
1977
|
-
/* Excluded from this release type: eventDispatcher */
|
|
1426
|
+
scene: Scene;
|
|
1978
1427
|
private posNdc;
|
|
1979
1428
|
private posScreen;
|
|
1980
1429
|
private posScreenLast;
|
|
@@ -1987,13 +1436,14 @@ export declare class Obj3D {
|
|
|
1987
1436
|
private quatWorldLast;
|
|
1988
1437
|
private rotWorld;
|
|
1989
1438
|
private visible;
|
|
1990
|
-
private
|
|
1991
|
-
private
|
|
1439
|
+
private inFrustum;
|
|
1440
|
+
private inFrustumLast;
|
|
1992
1441
|
private visibleLast;
|
|
1993
|
-
private
|
|
1994
|
-
|
|
1442
|
+
private occluded;
|
|
1443
|
+
private objHidden;
|
|
1444
|
+
private visibleBeforeHidden;
|
|
1995
1445
|
/**
|
|
1996
|
-
*
|
|
1446
|
+
* Subscribes to an object event.
|
|
1997
1447
|
* @param type - The event type to listen for.
|
|
1998
1448
|
* @param listener - Callback invoked when the event occurs.
|
|
1999
1449
|
* @returns A function that unsubscribes the listener.
|
|
@@ -2003,11 +1453,9 @@ export declare class Obj3D {
|
|
|
2003
1453
|
}>) => void): Unsubscribe;
|
|
2004
1454
|
private calcFrustumVisibility;
|
|
2005
1455
|
private calcPosScreen;
|
|
2006
|
-
/* Excluded from this release type: calcPosWorld */
|
|
2007
1456
|
private calcPosOccl;
|
|
2008
1457
|
private calcRotWorld;
|
|
2009
1458
|
private calcVisibility;
|
|
2010
|
-
/* Excluded from this release type: emitEvent */
|
|
2011
1459
|
/**
|
|
2012
1460
|
* Returns the object's screen position in canvas coordinates.
|
|
2013
1461
|
* @param cam3D - Camera used for projection to canvas coordinates.
|
|
@@ -2017,19 +1465,18 @@ export declare class Obj3D {
|
|
|
2017
1465
|
x: number;
|
|
2018
1466
|
y: number;
|
|
2019
1467
|
} | null;
|
|
2020
|
-
/* Excluded from this release type: hasEventListener */
|
|
2021
1468
|
/**
|
|
2022
|
-
* Called once
|
|
1469
|
+
* Called once when the scene, renderer, and initial environment are ready and, if configured, the first model has been loaded and traversed.
|
|
2023
1470
|
* @public
|
|
2024
1471
|
*/
|
|
2025
1472
|
protected onReady(): void;
|
|
2026
1473
|
/**
|
|
2027
|
-
* Called once after the
|
|
1474
|
+
* Called once after the scene is initialized, before model loading begins.
|
|
2028
1475
|
* @public
|
|
2029
1476
|
*/
|
|
2030
1477
|
protected onStart(): void;
|
|
2031
1478
|
/**
|
|
2032
|
-
* Called
|
|
1479
|
+
* Called for each matching object found during GLTF traversal. Adopts the object for this component.
|
|
2033
1480
|
* @param objGltf - The traversed `THREE.Object3D` instance.
|
|
2034
1481
|
* @public
|
|
2035
1482
|
*/
|
|
@@ -2040,9 +1487,8 @@ export declare class Obj3D {
|
|
|
2040
1487
|
* @public
|
|
2041
1488
|
*/
|
|
2042
1489
|
protected onUpdate(deltaTime: number): void;
|
|
2043
|
-
/* Excluded from this release type: ready */
|
|
2044
1490
|
/**
|
|
2045
|
-
*
|
|
1491
|
+
* Unsubscribes a listener from an object event.
|
|
2046
1492
|
* @param type - The event type to remove the listener from.
|
|
2047
1493
|
* @param listener - Callback to remove from the event listeners.
|
|
2048
1494
|
*/
|
|
@@ -2050,37 +1496,26 @@ export declare class Obj3D {
|
|
|
2050
1496
|
type: TType;
|
|
2051
1497
|
}>) => void): void;
|
|
2052
1498
|
private resetEventState;
|
|
2053
|
-
/* Excluded from this release type: start */
|
|
2054
|
-
/* Excluded from this release type: traverse */
|
|
2055
|
-
/* Excluded from this release type: update */
|
|
2056
1499
|
}
|
|
2057
1500
|
|
|
2058
|
-
/**
|
|
2059
|
-
export declare type Obj3DClass = new (canvas: HTMLElement, cfg: Cfg, name: string) => Objs3D;
|
|
2060
|
-
|
|
2061
|
-
/** Defines all event types supported by `Obj3D.addEventListener`. */
|
|
1501
|
+
/** Object events available to registered listeners. */
|
|
2062
1502
|
export declare type Obj3DEvent = Obj3DPosWorldEvent | Obj3DPosScreenEvent | Obj3DRotWorldEvent | Obj3DFrustumEvent | Obj3DVisibleEvent | Obj3DPointerEvent;
|
|
2063
1503
|
|
|
2064
1504
|
/** @event Fired when the frustum visibility of a 3D object changes. */
|
|
2065
1505
|
export declare interface Obj3DFrustumEvent {
|
|
2066
|
-
/** Identifies this event type. */
|
|
2067
1506
|
type: 'Obj3D_Frustum_Changed';
|
|
2068
1507
|
/** Whether the object's world position is inside the camera frustum. */
|
|
2069
1508
|
visibleFrustum: boolean;
|
|
2070
1509
|
}
|
|
2071
1510
|
|
|
2072
|
-
/**
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
export declare type Obj3DInsts<T extends Record<string, Obj3DClass>> = {
|
|
2078
|
-
[K in keyof T]: InstanceType<T[K]>;
|
|
2079
|
-
};
|
|
1511
|
+
/** Initial parameters shared by all `Obj3D` classes. */
|
|
1512
|
+
export declare interface Obj3DParams {
|
|
1513
|
+
/** Hides the underlying Three.js object from rendering without disabling raycasting. */
|
|
1514
|
+
hidden?: boolean;
|
|
1515
|
+
}
|
|
2080
1516
|
|
|
2081
|
-
/** @event Fired when the
|
|
1517
|
+
/** @event Fired when the pointer interacts with a pickable object. */
|
|
2082
1518
|
export declare interface Obj3DPointerEvent {
|
|
2083
|
-
/** Identifies this event type. */
|
|
2084
1519
|
type: 'Obj3D_Click' | 'Obj3D_Pointer_Enter' | 'Obj3D_Pointer_Down' | 'Obj3D_Pointer_Leave' | 'Obj3D_Pointer_Move' | 'Obj3D_Pointer_Up';
|
|
2085
1520
|
/** Native pointer event from the active object interaction. */
|
|
2086
1521
|
event: PointerEvent;
|
|
@@ -2092,7 +1527,6 @@ export declare interface Obj3DPointerEvent {
|
|
|
2092
1527
|
* @event Fired when the screen position of a 3D object changes.
|
|
2093
1528
|
*/
|
|
2094
1529
|
export declare interface Obj3DPosScreenEvent {
|
|
2095
|
-
/** Identifies this event type. */
|
|
2096
1530
|
type: 'Obj3D_Pos_Screen_Changed';
|
|
2097
1531
|
/** The object's position projected into screen space. */
|
|
2098
1532
|
posScreen: THREE_TYPE.Vector2;
|
|
@@ -2102,7 +1536,6 @@ export declare interface Obj3DPosScreenEvent {
|
|
|
2102
1536
|
* @event Fired when the world position of a 3D object changes.
|
|
2103
1537
|
*/
|
|
2104
1538
|
export declare interface Obj3DPosWorldEvent {
|
|
2105
|
-
/** Identifies this event type. */
|
|
2106
1539
|
type: 'Obj3D_Pos_World_Changed';
|
|
2107
1540
|
/** The object's position in world coordinates. */
|
|
2108
1541
|
posWorld: THREE_TYPE.Vector3;
|
|
@@ -2112,30 +1545,22 @@ export declare interface Obj3DPosWorldEvent {
|
|
|
2112
1545
|
* @event Fired when the world rotation of a 3D object changes.
|
|
2113
1546
|
*/
|
|
2114
1547
|
export declare interface Obj3DRotWorldEvent {
|
|
2115
|
-
/** Identifies this event type. */
|
|
2116
1548
|
type: 'Obj3D_Rot_World_Changed';
|
|
2117
1549
|
/** The object's rotation in world coordinates. */
|
|
2118
1550
|
rotWorld: THREE_TYPE.Euler;
|
|
2119
1551
|
}
|
|
2120
1552
|
|
|
2121
|
-
/** @event Fired when
|
|
1553
|
+
/** @event Fired when an object's combined hidden, frustum, and occlusion visibility changes. */
|
|
2122
1554
|
export declare interface Obj3DVisibleEvent {
|
|
2123
|
-
/** Identifies this event type. */
|
|
2124
1555
|
type: 'Obj3D_Visible_Changed';
|
|
2125
|
-
/** Whether the object is inside the camera frustum and not occluded. */
|
|
1556
|
+
/** Whether the object is not hidden, is inside the camera frustum, and is not occluded. */
|
|
2126
1557
|
visible: boolean;
|
|
2127
1558
|
}
|
|
2128
1559
|
|
|
2129
1560
|
export declare type Objs3D = Cam3D | Light3D | Mesh3D | Obj3D;
|
|
2130
1561
|
|
|
2131
|
-
declare interface OccludeeState {
|
|
2132
|
-
obj: THREE_TYPE.Object3D;
|
|
2133
|
-
needsCheck: boolean;
|
|
2134
|
-
visible: boolean;
|
|
2135
|
-
}
|
|
2136
|
-
|
|
2137
1562
|
/**
|
|
2138
|
-
*
|
|
1563
|
+
* Controls camera orbit, panning, and zooming around a target.
|
|
2139
1564
|
* @category Core
|
|
2140
1565
|
*/
|
|
2141
1566
|
export declare class OrbitCtrls {
|
|
@@ -2144,49 +1569,52 @@ export declare class OrbitCtrls {
|
|
|
2144
1569
|
private readonly engine;
|
|
2145
1570
|
private readonly events;
|
|
2146
1571
|
private readonly modules;
|
|
2147
|
-
orbitControls:
|
|
1572
|
+
orbitControls: OrbitControls | null;
|
|
2148
1573
|
private readonly params;
|
|
2149
1574
|
private orbitCtrlsFirstChange;
|
|
2150
1575
|
private callback;
|
|
2151
1576
|
private readonly touchPointerIds;
|
|
2152
|
-
|
|
2153
|
-
|
|
1577
|
+
/**
|
|
1578
|
+
* Prepares orbit controls without enabling them.
|
|
1579
|
+
*/
|
|
2154
1580
|
create(): void;
|
|
2155
|
-
/**
|
|
1581
|
+
/**
|
|
1582
|
+
* Stops orbit interaction and automatic camera updates.
|
|
1583
|
+
*/
|
|
2156
1584
|
disable(): void;
|
|
2157
|
-
/**
|
|
1585
|
+
/**
|
|
1586
|
+
* Enables camera orbit, panning, and zooming.
|
|
1587
|
+
*/
|
|
2158
1588
|
enable(): void;
|
|
2159
|
-
/**
|
|
1589
|
+
/**
|
|
1590
|
+
* Releases orbit controls and stops their camera updates.
|
|
1591
|
+
*/
|
|
2160
1592
|
dispose(): void;
|
|
2161
1593
|
/**
|
|
2162
|
-
* Returns the
|
|
2163
|
-
* @returns A snapshot of the mutable orbit control settings.
|
|
1594
|
+
* Returns a snapshot of the current orbit control settings.
|
|
2164
1595
|
*/
|
|
2165
1596
|
get(): Partial<OrbitCtrlsCfg>;
|
|
2166
1597
|
/**
|
|
2167
|
-
*
|
|
2168
|
-
* @returns `true` if `OrbitControls` are currently enabled; otherwise, `false`.
|
|
1598
|
+
* Checks whether orbit controls are enabled.
|
|
2169
1599
|
*/
|
|
2170
1600
|
isEnabled(): boolean;
|
|
2171
1601
|
/**
|
|
2172
|
-
* Updates
|
|
2173
|
-
* @param params -
|
|
1602
|
+
* Updates orbit, panning, and zoom settings. Controls must already be created.
|
|
1603
|
+
* @param params - Settings to change; omitted values remain unchanged.
|
|
2174
1604
|
*/
|
|
2175
1605
|
set(params: Partial<OrbitCtrlsCfg>): void;
|
|
2176
1606
|
/**
|
|
2177
|
-
*
|
|
1607
|
+
* Runs an extension callback immediately with access to the public API.
|
|
2178
1608
|
*
|
|
2179
|
-
* @param extension -
|
|
1609
|
+
* @param extension - Callback receiving this `OrbitCtrls` instance.
|
|
2180
1610
|
*
|
|
2181
|
-
* @remarks
|
|
2182
|
-
* This method is intended for advanced custom integrations where developers need direct access to the engine instance.
|
|
2183
1611
|
* The extension is executed once immediately when `use()` is called.
|
|
2184
1612
|
*/
|
|
2185
1613
|
use(extension: (orbitCtrls: OrbitCtrls) => void): void;
|
|
2186
1614
|
}
|
|
2187
1615
|
|
|
2188
1616
|
/**
|
|
2189
|
-
*
|
|
1617
|
+
* Controls camera orbit, panning, zooming, and movement limits.
|
|
2190
1618
|
* @category Cfg
|
|
2191
1619
|
*/
|
|
2192
1620
|
export declare interface OrbitCtrlsCfg {
|
|
@@ -2196,7 +1624,7 @@ export declare interface OrbitCtrlsCfg {
|
|
|
2196
1624
|
*/
|
|
2197
1625
|
autoRotate: boolean;
|
|
2198
1626
|
/**
|
|
2199
|
-
*
|
|
1627
|
+
* Speed of automatic camera rotation.
|
|
2200
1628
|
* @default 2.0
|
|
2201
1629
|
*/
|
|
2202
1630
|
autoRotateSpeed: number;
|
|
@@ -2231,7 +1659,7 @@ export declare interface OrbitCtrlsCfg {
|
|
|
2231
1659
|
*/
|
|
2232
1660
|
enableZoom: boolean;
|
|
2233
1661
|
/**
|
|
2234
|
-
*
|
|
1662
|
+
* Prepares orbit controls without enabling them.
|
|
2235
1663
|
* @default false
|
|
2236
1664
|
*/
|
|
2237
1665
|
load: boolean;
|
|
@@ -2282,14 +1710,13 @@ export declare interface OrbitCtrlsCfg {
|
|
|
2282
1710
|
zoomSpeed: number;
|
|
2283
1711
|
}
|
|
2284
1712
|
|
|
2285
|
-
/** @event Fired when
|
|
1713
|
+
/** @event Fired when orbit interaction starts, changes, or ends, or controls are enabled, disabled, or disposed. */
|
|
2286
1714
|
export declare interface OrbitCtrlsEvent {
|
|
2287
|
-
/** Identifies this event type. */
|
|
2288
1715
|
type: 'OrbitCtrls_Changed' | 'OrbitCtrls_Disabled' | 'OrbitCtrls_Enabled' | 'OrbitCtrls_End' | 'OrbitCtrls_Start' | 'OrbitCtrls_Disposed';
|
|
2289
1716
|
}
|
|
2290
1717
|
|
|
2291
1718
|
/**
|
|
2292
|
-
*
|
|
1719
|
+
* Tunes post-processing effects selected by the renderer profiles.
|
|
2293
1720
|
* @category Cfg
|
|
2294
1721
|
*/
|
|
2295
1722
|
export declare interface PostCfg {
|
|
@@ -2300,8 +1727,8 @@ export declare interface PostCfg {
|
|
|
2300
1727
|
guiOpened: boolean;
|
|
2301
1728
|
/** Anti-aliasing settings. */
|
|
2302
1729
|
aa: AaCfg;
|
|
2303
|
-
/** Shared
|
|
2304
|
-
|
|
1730
|
+
/** Shared screen-space lighting settings. */
|
|
1731
|
+
ssl: SslCfg;
|
|
2305
1732
|
/** Shared SSR settings. */
|
|
2306
1733
|
ssr: SsrCfg;
|
|
2307
1734
|
/** WebGL post-processing settings. */
|
|
@@ -2312,22 +1739,23 @@ export declare interface PostCfg {
|
|
|
2312
1739
|
fxaa: FxaaCfg;
|
|
2313
1740
|
};
|
|
2314
1741
|
/** WebGL SSAO settings. */
|
|
2315
|
-
ssao:
|
|
1742
|
+
ssao: SsaoCfg;
|
|
2316
1743
|
/** WebGL SSR settings. */
|
|
2317
1744
|
ssr: SsrWebGlCfg;
|
|
2318
1745
|
};
|
|
2319
1746
|
/** WebGPU post-processing settings. */
|
|
2320
1747
|
webgpu: {
|
|
2321
|
-
/** WebGPU
|
|
2322
|
-
|
|
1748
|
+
/** WebGPU GTAO settings. */
|
|
1749
|
+
gtao: GtaoCfg;
|
|
1750
|
+
/** WebGPU SSGI settings. */
|
|
1751
|
+
ssgi: SsgiCfg;
|
|
2323
1752
|
/** WebGPU SSR settings. */
|
|
2324
1753
|
ssr: SsrWebGpuCfg;
|
|
2325
1754
|
};
|
|
2326
1755
|
}
|
|
2327
1756
|
|
|
2328
|
-
/** @event Fired after the progress bar has finished hiding
|
|
1757
|
+
/** @event Fired after the loading progress bar has finished hiding. */
|
|
2329
1758
|
export declare interface ProgressBarHiddenEvent {
|
|
2330
|
-
/** Identifies this event type. */
|
|
2331
1759
|
type: 'ProgressBar_Hidden';
|
|
2332
1760
|
}
|
|
2333
1761
|
|
|
@@ -2342,6 +1770,7 @@ export declare class Raycast {
|
|
|
2342
1770
|
private readonly engine;
|
|
2343
1771
|
private readonly events;
|
|
2344
1772
|
private readonly objs3D;
|
|
1773
|
+
private readonly scene;
|
|
2345
1774
|
private raycasterPick;
|
|
2346
1775
|
private raycasterVisible;
|
|
2347
1776
|
private colliders;
|
|
@@ -2370,10 +1799,12 @@ export declare class Raycast {
|
|
|
2370
1799
|
private posWorldObj;
|
|
2371
1800
|
private dirCamToObj;
|
|
2372
1801
|
private posNdcPointer;
|
|
2373
|
-
/* Excluded from this release type: __constructor */
|
|
2374
1802
|
private checkOccludeeVisible;
|
|
2375
|
-
/**
|
|
2376
|
-
|
|
1803
|
+
/**
|
|
1804
|
+
* Removes existing scene objects from raycasting and resets their collider roles.
|
|
1805
|
+
* @param objs - Registered `Coll3D` instances to remove.
|
|
1806
|
+
*/
|
|
1807
|
+
clearColliders(objs: Coll3D[]): void;
|
|
2377
1808
|
/** Enables pickable raycasting and its pointer event listeners. */
|
|
2378
1809
|
enablePickables(): void;
|
|
2379
1810
|
/** Disables pickable raycasting without removing the collider configuration. */
|
|
@@ -2382,8 +1813,8 @@ export declare class Raycast {
|
|
|
2382
1813
|
private getPickableHit;
|
|
2383
1814
|
private getObjAtPointer;
|
|
2384
1815
|
private emitPointerEvent;
|
|
2385
|
-
|
|
2386
|
-
|
|
1816
|
+
private invalidateOccludees;
|
|
1817
|
+
private rebuildColliderCaches;
|
|
2387
1818
|
private onCanvasClick;
|
|
2388
1819
|
private onCanvasPointerLeave;
|
|
2389
1820
|
private onCanvasPointerMove;
|
|
@@ -2392,16 +1823,13 @@ export declare class Raycast {
|
|
|
2392
1823
|
private onCanvasPointerExit;
|
|
2393
1824
|
private onCanvasPointerUp;
|
|
2394
1825
|
/**
|
|
2395
|
-
*
|
|
2396
|
-
* @param
|
|
1826
|
+
* Adds or updates existing scene objects as raycast colliders. The complete scene is used for occlusion until this method or `clearColliders()` is called for the first time.
|
|
1827
|
+
* @param colls3D - Registered `Coll3D` instances to add or update.
|
|
2397
1828
|
*/
|
|
2398
|
-
setColliders(
|
|
2399
|
-
/* Excluded from this release type: trackOccludee */
|
|
2400
|
-
/* Excluded from this release type: untrackOccludee */
|
|
1829
|
+
setColliders(colls3D: Coll3D[]): void;
|
|
2401
1830
|
/**
|
|
2402
|
-
*
|
|
2403
|
-
* @param extension -
|
|
2404
|
-
* @remarks This method is intended for advanced custom integrations where developers need direct access to the engine instance. The extension is executed once immediately when `use()` is called.
|
|
1831
|
+
* Runs an extension callback immediately with access to the public API.
|
|
1832
|
+
* @param extension - Callback receiving this `Raycast` instance.
|
|
2405
1833
|
*/
|
|
2406
1834
|
use(extension: (raycast: Raycast) => void): void;
|
|
2407
1835
|
private updateOccludees;
|
|
@@ -2410,7 +1838,7 @@ export declare class Raycast {
|
|
|
2410
1838
|
}
|
|
2411
1839
|
|
|
2412
1840
|
/**
|
|
2413
|
-
*
|
|
1841
|
+
* Controls pointer picking and occlusion checks.
|
|
2414
1842
|
* @category Cfg
|
|
2415
1843
|
*/
|
|
2416
1844
|
export declare interface RaycastCfg {
|
|
@@ -2425,12 +1853,12 @@ export declare interface RaycastCfg {
|
|
|
2425
1853
|
*/
|
|
2426
1854
|
circleSteps: number;
|
|
2427
1855
|
/**
|
|
2428
|
-
* Number of closest
|
|
1856
|
+
* Number of consecutive closest-object detections required before the active hover target changes.
|
|
2429
1857
|
* @default 5
|
|
2430
1858
|
*/
|
|
2431
1859
|
countClosestObjs: number;
|
|
2432
1860
|
/**
|
|
2433
|
-
* Time in milliseconds over which
|
|
1861
|
+
* Time in milliseconds over which pending occlusion checks are spread. A value of `0` processes them all in one frame.
|
|
2434
1862
|
* @default 0
|
|
2435
1863
|
*/
|
|
2436
1864
|
occludeeInterval: number;
|
|
@@ -2442,10 +1870,15 @@ export declare interface RaycastCfg {
|
|
|
2442
1870
|
}
|
|
2443
1871
|
|
|
2444
1872
|
/**
|
|
2445
|
-
*
|
|
1873
|
+
* Controls rendering quality, performance, shadows, and color output.
|
|
2446
1874
|
* @category Cfg
|
|
2447
1875
|
*/
|
|
2448
1876
|
export declare interface RenderCfg {
|
|
1877
|
+
/**
|
|
1878
|
+
* Enables or disables adaptive graphics quality selection.
|
|
1879
|
+
* @default false
|
|
1880
|
+
*/
|
|
1881
|
+
adaptiveGfx: boolean;
|
|
2449
1882
|
/**
|
|
2450
1883
|
* Selects the rendering backend.
|
|
2451
1884
|
*
|
|
@@ -2460,27 +1893,27 @@ export declare interface RenderCfg {
|
|
|
2460
1893
|
* Automatically updates the canvas, renderer, post-processing, camera and reflector sizes on window resize.
|
|
2461
1894
|
* @default true
|
|
2462
1895
|
*/
|
|
2463
|
-
autoResize
|
|
2464
|
-
/**
|
|
2465
|
-
* Whether the GUI render dropdown is open.
|
|
2466
|
-
* @default false
|
|
2467
|
-
*/
|
|
2468
|
-
guiOpened: boolean;
|
|
1896
|
+
autoResize: boolean;
|
|
2469
1897
|
/**
|
|
2470
|
-
* Enables or disables
|
|
1898
|
+
* Enables or disables Eco mode availability.
|
|
2471
1899
|
* @default true
|
|
2472
1900
|
*/
|
|
2473
|
-
|
|
1901
|
+
ecoMode: boolean;
|
|
2474
1902
|
/**
|
|
2475
|
-
*
|
|
1903
|
+
* Minimum rendering FPS to preserve when Eco Mode skips frames.
|
|
2476
1904
|
* @default 30
|
|
2477
1905
|
*/
|
|
2478
|
-
|
|
1906
|
+
fpsMin: number;
|
|
2479
1907
|
/**
|
|
2480
|
-
*
|
|
2481
|
-
* @default
|
|
1908
|
+
* Number of recent frame timings used to evaluate performance.
|
|
1909
|
+
* @default 20
|
|
2482
1910
|
*/
|
|
2483
1911
|
deltaTimesMax: number;
|
|
1912
|
+
/**
|
|
1913
|
+
* Whether the GUI render dropdown is open.
|
|
1914
|
+
* @default false
|
|
1915
|
+
*/
|
|
1916
|
+
guiOpened: boolean;
|
|
2484
1917
|
/**
|
|
2485
1918
|
* Output color space.
|
|
2486
1919
|
* @default THREE.SRGBColorSpace
|
|
@@ -2520,12 +1953,9 @@ export declare interface RenderCfg {
|
|
|
2520
1953
|
* @default false
|
|
2521
1954
|
*/
|
|
2522
1955
|
alpha: boolean;
|
|
2523
|
-
/**
|
|
2524
|
-
* Whether renderer-level anti-aliasing is enabled.
|
|
2525
|
-
* @default false
|
|
2526
|
-
*/
|
|
2527
|
-
antialias: boolean;
|
|
2528
1956
|
};
|
|
1957
|
+
/** Renderer feature profiles. */
|
|
1958
|
+
profile: RenderProfileCfg;
|
|
2529
1959
|
/**
|
|
2530
1960
|
* WebGL-specific renderer configuration.
|
|
2531
1961
|
*/
|
|
@@ -2546,18 +1976,348 @@ export declare interface RenderCfg {
|
|
|
2546
1976
|
};
|
|
2547
1977
|
}
|
|
2548
1978
|
|
|
2549
|
-
/**
|
|
1979
|
+
/** @inheritDoc RenderCfg.api */
|
|
2550
1980
|
export declare type Renderer = 'webgl' | 'webgpu' | 'auto';
|
|
2551
1981
|
|
|
2552
|
-
|
|
1982
|
+
/** Complete effect selections for both rendering backends. */
|
|
1983
|
+
export declare interface RenderProfileCfg {
|
|
1984
|
+
/** Resolved WebGL rendering profile. */
|
|
1985
|
+
webgl: RenderProfileWebGl;
|
|
1986
|
+
/** Resolved WebGPU rendering profile. */
|
|
1987
|
+
webgpu: RenderProfileWebGpu;
|
|
1988
|
+
}
|
|
1989
|
+
|
|
1990
|
+
/** Overrides renderer effects while preserving unspecified defaults and valid combinations. */
|
|
1991
|
+
export declare interface RenderProfileValidCfg {
|
|
1992
|
+
/** WebGL effect overrides. */
|
|
1993
|
+
webgl?: Partial<RenderProfileWebGl>;
|
|
1994
|
+
/** Compatible WebGPU effect overrides. */
|
|
1995
|
+
webgpu?: {
|
|
1996
|
+
/** Disables MSAA or applies it only to the renderer. */
|
|
1997
|
+
msaa?: Exclude<MsaaMode, 'post'>;
|
|
1998
|
+
/** Selects non-temporal anti-aliasing. */
|
|
1999
|
+
aa?: Exclude<AaModeWebGpu, 'traa'>;
|
|
2000
|
+
/** Selects ambient occlusion without indirect illumination. */
|
|
2001
|
+
ssl?: Exclude<SslModeWebGpu, 'ssgi'>;
|
|
2002
|
+
/** Enables screen-space reflections. */
|
|
2003
|
+
ssr?: boolean;
|
|
2004
|
+
} | {
|
|
2005
|
+
/** Applies MSAA to the renderer and post-processing. */
|
|
2006
|
+
msaa: 'post';
|
|
2007
|
+
/** Selects non-temporal anti-aliasing. */
|
|
2008
|
+
aa?: Exclude<AaModeWebGpu, 'traa'>;
|
|
2009
|
+
/** Post-processing MSAA does not support screen-space lighting. */
|
|
2010
|
+
ssl?: 'none';
|
|
2011
|
+
/** Enables screen-space reflections. */
|
|
2012
|
+
ssr?: boolean;
|
|
2013
|
+
} | {
|
|
2014
|
+
/** Disables MSAA or applies it only to the renderer. */
|
|
2015
|
+
msaa?: Exclude<MsaaMode, 'post'>;
|
|
2016
|
+
/** Selects Temporal Reprojection Anti-Aliasing. */
|
|
2017
|
+
aa: 'traa';
|
|
2018
|
+
/** Selects screen-space lighting. */
|
|
2019
|
+
ssl?: SslModeWebGpu;
|
|
2020
|
+
/** Enables screen-space reflections. */
|
|
2021
|
+
ssr?: boolean;
|
|
2022
|
+
};
|
|
2023
|
+
}
|
|
2024
|
+
|
|
2025
|
+
/** Selects MSAA, anti-aliasing, ambient occlusion, and reflections for WebGL. */
|
|
2026
|
+
export declare type RenderProfileWebGl = {
|
|
2027
|
+
/** Selects where MSAA is applied. */
|
|
2028
|
+
msaa: MsaaMode;
|
|
2029
|
+
/** Selects the anti-aliasing mode. */
|
|
2030
|
+
aa: AaModeWebGl;
|
|
2031
|
+
/** Selects screen-space ambient occlusion. */
|
|
2032
|
+
ssl: SslModeWebGl;
|
|
2033
|
+
/** Enables screen-space reflections. */
|
|
2034
|
+
ssr: boolean;
|
|
2035
|
+
};
|
|
2036
|
+
|
|
2037
|
+
/** Selects compatible WebGPU effects. SSGI requires TRAA; post-processing MSAA excludes TRAA and screen-space lighting. */
|
|
2038
|
+
export declare type RenderProfileWebGpu = {
|
|
2039
|
+
/** Enables screen-space reflections. */
|
|
2040
|
+
ssr: boolean;
|
|
2041
|
+
} & ({
|
|
2042
|
+
/** Disables MSAA or applies it only to the renderer. */
|
|
2043
|
+
msaa: Exclude<MsaaMode, 'post'>;
|
|
2044
|
+
/** Selects a non-temporal anti-aliasing mode. */
|
|
2045
|
+
aa: Exclude<AaModeWebGpu, 'traa'>;
|
|
2046
|
+
/** Selects screen-space lighting without SSGI. */
|
|
2047
|
+
ssl: Exclude<SslModeWebGpu, 'ssgi'>;
|
|
2048
|
+
} | {
|
|
2049
|
+
/** Applies MSAA to the renderer and post-processing. */
|
|
2050
|
+
msaa: 'post';
|
|
2051
|
+
/** Selects a non-temporal anti-aliasing mode. */
|
|
2052
|
+
aa: Exclude<AaModeWebGpu, 'traa'>;
|
|
2053
|
+
/** Post-processing MSAA does not support screen-space lighting. */
|
|
2054
|
+
ssl: 'none';
|
|
2055
|
+
} | {
|
|
2056
|
+
/** TRAA cannot be combined with post-processing MSAA. */
|
|
2057
|
+
msaa: Exclude<MsaaMode, 'post'>;
|
|
2058
|
+
/** Selects Temporal Reprojection Anti-Aliasing. */
|
|
2059
|
+
aa: 'traa';
|
|
2060
|
+
/** Selects screen-space lighting. */
|
|
2061
|
+
ssl: SslModeWebGpu;
|
|
2062
|
+
});
|
|
2063
|
+
|
|
2064
|
+
/**
|
|
2065
|
+
* Controls scene contents, camera animation, materials, lighting, and clip playback.
|
|
2066
|
+
* @category Core
|
|
2067
|
+
*/
|
|
2068
|
+
export declare class Scene {
|
|
2069
|
+
private readonly cfg;
|
|
2070
|
+
private readonly cam3D;
|
|
2071
|
+
private readonly events;
|
|
2072
|
+
private readonly objs3D;
|
|
2073
|
+
private ambientLight;
|
|
2074
|
+
private hemisphereLight;
|
|
2075
|
+
readonly obj: THREE_TYPE.Scene;
|
|
2076
|
+
/**
|
|
2077
|
+
* Moves the camera along a curved path, optionally turning it toward a new target.
|
|
2078
|
+
* @param params - Camera movement settings.
|
|
2079
|
+
* @param params.camTarget - Destination position or object.
|
|
2080
|
+
* @param params.aimTarget - Position or object to look at while moving.
|
|
2081
|
+
* @param params.radiusOut - Outward curve radius. Default: **1**
|
|
2082
|
+
* @param params.duration - Duration in seconds. Default: **2**
|
|
2083
|
+
* @param params.ease - GSAP easing function. Default: **'power1.inOut'**
|
|
2084
|
+
*
|
|
2085
|
+
* @remarks
|
|
2086
|
+
* Emits {@link AnimEvent} when the animation starts and completes.
|
|
2087
|
+
*/
|
|
2088
|
+
animCamCurveTo({ camTarget, aimTarget, radiusOut, duration, ease }: {
|
|
2089
|
+
camTarget: THREE_TYPE.Vector3 | string | Obj3D;
|
|
2090
|
+
aimTarget?: THREE_TYPE.Vector3 | string | Obj3D;
|
|
2091
|
+
radiusOut?: number;
|
|
2092
|
+
duration?: number;
|
|
2093
|
+
ease?: string;
|
|
2094
|
+
}): void;
|
|
2095
|
+
/**
|
|
2096
|
+
* Moves a perspective camera to frame an object while looking at it. Only the object's own geometry is used; child objects are excluded.
|
|
2097
|
+
* @param params - Camera movement settings.
|
|
2098
|
+
* @param params.target - Object or scene object name to frame.
|
|
2099
|
+
* @param params.duration - Duration in seconds. Default: **1**
|
|
2100
|
+
* @param params.ease - GSAP easing function. Default: **'power2.inOut'**
|
|
2101
|
+
* @param params.dist - Multiplier for the calculated camera distance. Default: **1.25**
|
|
2102
|
+
*
|
|
2103
|
+
* @remarks
|
|
2104
|
+
* Emits {@link AnimEvent} when the animation starts and completes.
|
|
2105
|
+
*/
|
|
2106
|
+
animCamTo({ target, duration, ease, dist }: {
|
|
2107
|
+
target: string | Obj3D;
|
|
2108
|
+
duration?: number;
|
|
2109
|
+
ease?: string;
|
|
2110
|
+
dist?: number;
|
|
2111
|
+
}): void;
|
|
2112
|
+
/**
|
|
2113
|
+
* Animates one or more material colors on a mesh.
|
|
2114
|
+
* @param params - Target colors, such as `color` or `emissive`, and animation settings.
|
|
2115
|
+
* @param params.mesh - Scene mesh name or `Mesh3D` component.
|
|
2116
|
+
* @param params.duration - Duration in seconds. Default: **0**
|
|
2117
|
+
* @param params.ease - GSAP easing function. Default: **'power1.inOut'**
|
|
2118
|
+
*
|
|
2119
|
+
* @remarks
|
|
2120
|
+
* Colors may be strings, numbers, or `THREE.Color` values. Emits {@link AnimFadeEvent} when the animation starts and completes.
|
|
2121
|
+
*/
|
|
2122
|
+
animMaterialColor({ mesh, duration, ease, ...colorProps }: {
|
|
2123
|
+
mesh: string | Mesh3D;
|
|
2124
|
+
duration?: number;
|
|
2125
|
+
ease?: string;
|
|
2126
|
+
} & {
|
|
2127
|
+
[key: string]: string | number | THREE_TYPE.Color | Mesh3D;
|
|
2128
|
+
}): void;
|
|
2129
|
+
/**
|
|
2130
|
+
* Animates a numeric material property on a mesh. Only the first supplied property is animated.
|
|
2131
|
+
* @param params - Target value and animation settings.
|
|
2132
|
+
* @param params.mesh - Scene mesh name or `Mesh3D` component.
|
|
2133
|
+
* @param params.startValue - Starting value. Defaults to the current material value.
|
|
2134
|
+
* @param params.infinite - Repeats the animation indefinitely. Default: **false**
|
|
2135
|
+
* @param params.duration - Duration in seconds. Default: **0**
|
|
2136
|
+
* @param params.ease - GSAP easing function. Default: **'power1.inOut'**
|
|
2137
|
+
* @param params.needsUpdate - Recompiles the material when animation starts. Default: **false**
|
|
2138
|
+
*
|
|
2139
|
+
* @remarks
|
|
2140
|
+
* Emits {@link AnimFadeEvent} when the animation starts and completes.
|
|
2141
|
+
*/
|
|
2142
|
+
animMaterialNumeric({ mesh, needsUpdate, startValue, infinite, duration, ease, ...props }: {
|
|
2143
|
+
mesh: string | Mesh3D;
|
|
2144
|
+
startValue?: number | null;
|
|
2145
|
+
infinite?: boolean;
|
|
2146
|
+
duration?: number;
|
|
2147
|
+
ease?: string;
|
|
2148
|
+
needsUpdate?: boolean;
|
|
2149
|
+
[key: string]: any;
|
|
2150
|
+
}): void;
|
|
2151
|
+
private calcEaseArea;
|
|
2152
|
+
/**
|
|
2153
|
+
* Plays a named animation clip with blending, looping, and speed control.
|
|
2154
|
+
*
|
|
2155
|
+
* @param params - Parameters for controlling the animation playback.
|
|
2156
|
+
* @param params.layer - The freely named layer used to group animation actions.
|
|
2157
|
+
* @param params.clip - The name of the animation clip to play.
|
|
2158
|
+
* @param params.blendMode - How the action is blended with other active actions. Default: **'normal'**
|
|
2159
|
+
* @param params.finishMode - Whether the final pose is held or faded out after the final loop. Default: **'hold'**
|
|
2160
|
+
* @param params.loopMode - Number of plays or `'infinite'` for endless looping. Default: **1**
|
|
2161
|
+
* @param params.stopMode - Which previous actions of the same layer are stopped before playback. Default: **'all'**
|
|
2162
|
+
* @param params.fadeDuration - Duration in seconds for fading affected previous actions out and the new action in. Default: **0**
|
|
2163
|
+
* @param params.fadeDurationFinish - Duration in seconds for `finishMode: 'fadeOut'`. Default: **0**
|
|
2164
|
+
* @param params.reverse - If `true`, plays the clip in reverse. Default: **false**
|
|
2165
|
+
* @param params.reset - If `true`, resets the clip before a new playback. Default: **false**
|
|
2166
|
+
* @param params.startSpeed - Initial playback speed for speed interpolation. Default: **0**
|
|
2167
|
+
* @param params.endSpeed - Target playback speed. Default: **1**
|
|
2168
|
+
* @param params.duration - Duration in seconds for speed interpolation. Default: **0**
|
|
2169
|
+
* @param params.ease - GSAP easing function name. Default: **'power1.inOut'**
|
|
2170
|
+
*
|
|
2171
|
+
* @remarks
|
|
2172
|
+
* 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.
|
|
2173
|
+
*
|
|
2174
|
+
* `finishMode` and `fadeDurationFinish` have no effect when `loopMode` is `'infinite'`.
|
|
2175
|
+
*
|
|
2176
|
+
* **Events**
|
|
2177
|
+
*
|
|
2178
|
+
* {@link ClipEvent}
|
|
2179
|
+
*/
|
|
2180
|
+
playClip({ layer, clip: clipName, blendMode, finishMode, loopMode, stopMode, fadeDuration, fadeDurationFinish, reverse, reset, startSpeed, endSpeed, duration, ease }: {
|
|
2181
|
+
layer: string;
|
|
2182
|
+
clip: string;
|
|
2183
|
+
singleAction?: boolean;
|
|
2184
|
+
blendMode?: BlendMode;
|
|
2185
|
+
finishMode?: FinishMode;
|
|
2186
|
+
loopMode?: LoopMode;
|
|
2187
|
+
stopMode?: StopMode;
|
|
2188
|
+
fadeDuration?: number;
|
|
2189
|
+
fadeDurationFinish?: number;
|
|
2190
|
+
reverse?: boolean;
|
|
2191
|
+
reset?: boolean;
|
|
2192
|
+
startSpeed?: number;
|
|
2193
|
+
endSpeed?: number;
|
|
2194
|
+
duration?: number;
|
|
2195
|
+
ease?: string;
|
|
2196
|
+
}): void;
|
|
2197
|
+
/**
|
|
2198
|
+
* Plays a named camera animation clip with blending, looping, and speed control.
|
|
2199
|
+
*
|
|
2200
|
+
* @param params - Parameters for controlling the camera animation playback.
|
|
2201
|
+
* @param params.layer - The freely named layer used to group camera animation actions.
|
|
2202
|
+
* @param params.clip - The name of the camera animation clip to play.
|
|
2203
|
+
* @param params.blendMode - How the action is blended with other active actions. Default: **'normal'**
|
|
2204
|
+
* @param params.loopMode - Number of plays or `'infinite'` for endless looping. Default: **1**
|
|
2205
|
+
* @param params.stopMode - Which previous actions of the same layer are stopped before playback. Default: **'all'**
|
|
2206
|
+
* @param params.fadeDuration - Duration in seconds for fading affected previous actions out and the new action in. Default: **0**
|
|
2207
|
+
* @param params.reverse - If `true`, plays the clip in reverse. Default: **false**
|
|
2208
|
+
* @param params.reset - If `true`, resets the clip before a new playback. Default: **false**
|
|
2209
|
+
* @param params.startSpeed - Initial playback speed for speed interpolation. Default: **0**
|
|
2210
|
+
* @param params.endSpeed - Target playback speed. Default: **1**
|
|
2211
|
+
* @param params.duration - Duration in seconds for speed interpolation. Default: **0**
|
|
2212
|
+
* @param params.ease - GSAP easing function name. Default: **'power1.inOut'**
|
|
2213
|
+
*
|
|
2214
|
+
* @remarks
|
|
2215
|
+
* 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.
|
|
2216
|
+
*
|
|
2217
|
+
* **Events**
|
|
2218
|
+
*
|
|
2219
|
+
* {@link ClipEvent}
|
|
2220
|
+
*/
|
|
2221
|
+
playClipCam({ layer, clip: clipName, blendMode, loopMode, stopMode, fadeDuration, reverse, reset, startSpeed, endSpeed, duration, ease }: {
|
|
2222
|
+
layer: string;
|
|
2223
|
+
clip: string;
|
|
2224
|
+
blendMode?: BlendMode;
|
|
2225
|
+
loopMode?: LoopMode;
|
|
2226
|
+
stopMode?: StopMode;
|
|
2227
|
+
fadeDuration?: number;
|
|
2228
|
+
reverse?: boolean;
|
|
2229
|
+
reset?: boolean;
|
|
2230
|
+
startSpeed?: number;
|
|
2231
|
+
endSpeed?: number;
|
|
2232
|
+
duration?: number;
|
|
2233
|
+
ease?: string;
|
|
2234
|
+
}): void;
|
|
2235
|
+
/**
|
|
2236
|
+
* Removes the built-in ambient light and releases its resources.
|
|
2237
|
+
*/
|
|
2238
|
+
removeAmbientLight(): void;
|
|
2239
|
+
/**
|
|
2240
|
+
* Removes scene fog.
|
|
2241
|
+
*/
|
|
2242
|
+
removeFog(): void;
|
|
2243
|
+
/**
|
|
2244
|
+
* Removes the built-in hemisphere light and releases its resources.
|
|
2245
|
+
*/
|
|
2246
|
+
removeHemisphereLight(): void;
|
|
2247
|
+
/**
|
|
2248
|
+
* Creates or updates uniform ambient lighting. Creation requires both color and intensity; omitted values remain unchanged when updating.
|
|
2249
|
+
* @param params - Ambient light settings.
|
|
2250
|
+
* @param params.color - Light color.
|
|
2251
|
+
* @param params.intensity - Light intensity.
|
|
2252
|
+
*/
|
|
2253
|
+
setAmbientLight({ color, intensity }: {
|
|
2254
|
+
color?: THREE_TYPE.ColorRepresentation;
|
|
2255
|
+
intensity?: number;
|
|
2256
|
+
}): void;
|
|
2257
|
+
/**
|
|
2258
|
+
* Creates or updates distance-based scene fog. Creation requires all three settings; omitted values remain unchanged when updating.
|
|
2259
|
+
* @param params - Fog settings.
|
|
2260
|
+
* @param params.color - Fog color.
|
|
2261
|
+
* @param params.near - Distance at which fog begins.
|
|
2262
|
+
* @param params.far - Distance at which fog fully obscures objects.
|
|
2263
|
+
*/
|
|
2264
|
+
setFog({ color, near, far }: {
|
|
2265
|
+
color?: THREE_TYPE.ColorRepresentation;
|
|
2266
|
+
near?: number;
|
|
2267
|
+
far?: number;
|
|
2268
|
+
}): void;
|
|
2269
|
+
/**
|
|
2270
|
+
* Creates or updates ambient sky and ground lighting. Creation requires all three settings; omitted values remain unchanged when updating.
|
|
2271
|
+
* @param params - Hemisphere light settings.
|
|
2272
|
+
* @param params.skyColor - Light color from above.
|
|
2273
|
+
* @param params.groundColor - Light color from below.
|
|
2274
|
+
* @param params.intensity - Light intensity.
|
|
2275
|
+
*/
|
|
2276
|
+
setHemisphereLight({ skyColor, groundColor, intensity }: {
|
|
2277
|
+
skyColor?: THREE_TYPE.ColorRepresentation;
|
|
2278
|
+
groundColor?: THREE_TYPE.ColorRepresentation;
|
|
2279
|
+
intensity?: number;
|
|
2280
|
+
}): void;
|
|
2281
|
+
/**
|
|
2282
|
+
* Updates all material slots on a mesh, optionally including its descendants. Shared materials also affect other objects that use them.
|
|
2283
|
+
* @param params - Target material values, such as `color`, `roughness`, or `map`.
|
|
2284
|
+
* @param params.obj - Scene object name or `Mesh3D` component.
|
|
2285
|
+
* @param params.recursive - Includes descendant meshes. Default: **false**
|
|
2286
|
+
* @param params.needsUpdate - Recompiles materials after applying the values. Default: **false**
|
|
2287
|
+
*
|
|
2288
|
+
* @remarks
|
|
2289
|
+
* Texture paths for `map` and `emissiveMap` load asynchronously. Unsupported values are skipped with a warning.
|
|
2290
|
+
*/
|
|
2291
|
+
setMaterialProps({ obj, recursive, needsUpdate, ...props }: {
|
|
2292
|
+
obj: string | Mesh3D;
|
|
2293
|
+
recursive?: boolean;
|
|
2294
|
+
needsUpdate?: boolean;
|
|
2295
|
+
[key: string]: any;
|
|
2296
|
+
}): void;
|
|
2297
|
+
/**
|
|
2298
|
+
* Stops a named animation clip, optionally slowing it to a halt first.
|
|
2299
|
+
* @param params - Stop settings.
|
|
2300
|
+
* @param params.clipName - Animation clip name.
|
|
2301
|
+
* @param params.fadeOut - Slowdown duration in seconds. Default: **0**
|
|
2302
|
+
* @param params.ease - GSAP easing function for the slowdown. Default: **'power1.inOut'**
|
|
2303
|
+
*
|
|
2304
|
+
* @remarks
|
|
2305
|
+
* A slowdown emits `Clip_Speed_Start` and `Clip_Speed_Complete`, followed by `Clip_Cancel`. A duration of `0` cancels immediately. See {@link ClipEvent}.
|
|
2306
|
+
*/
|
|
2307
|
+
stopAnimClip({ clipName, fadeOut, ease }: {
|
|
2308
|
+
clipName: string;
|
|
2309
|
+
fadeOut?: number;
|
|
2310
|
+
ease?: string;
|
|
2311
|
+
}): void;
|
|
2312
|
+
}
|
|
2553
2313
|
|
|
2554
2314
|
/**
|
|
2555
|
-
*
|
|
2315
|
+
* Controls the canvas, fog, and built-in scene lights.
|
|
2556
2316
|
* @category Cfg
|
|
2557
2317
|
*/
|
|
2558
2318
|
export declare interface SceneCfg {
|
|
2559
2319
|
/**
|
|
2560
|
-
*
|
|
2320
|
+
* Selector for the element that hosts the rendered canvas.
|
|
2561
2321
|
* @default 'ilu-canvas'
|
|
2562
2322
|
*/
|
|
2563
2323
|
canvas: string;
|
|
@@ -2574,20 +2334,49 @@ export declare interface SceneCfg {
|
|
|
2574
2334
|
hemisphere: HemisphereCfg;
|
|
2575
2335
|
}
|
|
2576
2336
|
|
|
2577
|
-
/**
|
|
2337
|
+
/** Scene component classes available for registration. */
|
|
2338
|
+
export declare type SceneClass = new (canvas: HTMLElement, cfg: Cfg, name: string, params?: Obj3DParams) => Objs3D;
|
|
2339
|
+
|
|
2340
|
+
/** Scene component class with optional initial parameters. */
|
|
2341
|
+
export declare type SceneEntry<TClass extends SceneClass = SceneClass> = TClass | {
|
|
2342
|
+
class: TClass;
|
|
2343
|
+
/**
|
|
2344
|
+
* Initial parameters assigned to a scene component class when the app starts. Accepts `Obj3DParams` or `Coll3DParams`, depending on the registered `class`. */
|
|
2345
|
+
params?: ConstructorParameters<TClass>[3];
|
|
2346
|
+
};
|
|
2347
|
+
|
|
2348
|
+
/**
|
|
2349
|
+
* Maps a record of Scene Component classes or entries to a record of typed object instances.
|
|
2350
|
+
* `{ key1: typeof SceneComp1 } -> { key1: SceneComp1 }`
|
|
2351
|
+
* @hidden
|
|
2352
|
+
*/
|
|
2353
|
+
export declare type SceneInsts<T extends Record<string, SceneEntry>> = {
|
|
2354
|
+
[K in keyof T]: T[K] extends SceneClass ? InstanceType<T[K]> : T[K] extends {
|
|
2355
|
+
class: infer TClass extends SceneClass;
|
|
2356
|
+
} ? InstanceType<TClass> : never;
|
|
2357
|
+
};
|
|
2358
|
+
|
|
2359
|
+
/** @event Fired when the initial scene resources and component readiness hooks are complete. */
|
|
2578
2360
|
export declare interface SceneReadyEvent {
|
|
2579
|
-
/** Identifies this event type. */
|
|
2580
2361
|
type: 'Scene_Ready';
|
|
2581
2362
|
}
|
|
2582
2363
|
|
|
2583
|
-
/** @event Fired after the scene or a progressive
|
|
2364
|
+
/** @event Fired after the initial scene or a progressive model level is rendered for the first time. */
|
|
2584
2365
|
export declare interface SceneRenderedEvent {
|
|
2585
2366
|
/** Identifies the rendered scene or progressive scene variant. */
|
|
2586
2367
|
type: 'Scene_Rendered' | `Scene${number}_Rendered`;
|
|
2587
2368
|
}
|
|
2588
2369
|
|
|
2589
2370
|
/**
|
|
2590
|
-
*
|
|
2371
|
+
* Updates startup settings while preserving unspecified defaults. Nested settings are merged; supplied arrays replace existing arrays.
|
|
2372
|
+
* @param value - Configuration values that override the framework defaults.
|
|
2373
|
+
* @returns The configured `cfg` object.
|
|
2374
|
+
* @category Cfg
|
|
2375
|
+
*/
|
|
2376
|
+
export declare function setCfg(value: CfgSet): Cfg;
|
|
2377
|
+
|
|
2378
|
+
/**
|
|
2379
|
+
* Controls edge smoothing with SMAA.
|
|
2591
2380
|
* @category Cfg
|
|
2592
2381
|
*/
|
|
2593
2382
|
export declare interface SmaaCfg {
|
|
@@ -2620,29 +2409,12 @@ export declare type SoundParams = {
|
|
|
2620
2409
|
};
|
|
2621
2410
|
|
|
2622
2411
|
/**
|
|
2623
|
-
*
|
|
2412
|
+
* Controls contact shading with WebGL SSAO.
|
|
2624
2413
|
* @category Cfg
|
|
2625
2414
|
*/
|
|
2626
2415
|
export declare interface SsaoCfg {
|
|
2627
2416
|
/**
|
|
2628
|
-
*
|
|
2629
|
-
* @default false
|
|
2630
|
-
*/
|
|
2631
|
-
enable: boolean;
|
|
2632
|
-
/**
|
|
2633
|
-
* Whether the GUI SSAO dropdown is open.
|
|
2634
|
-
* @default false
|
|
2635
|
-
*/
|
|
2636
|
-
guiOpened: boolean;
|
|
2637
|
-
}
|
|
2638
|
-
|
|
2639
|
-
/**
|
|
2640
|
-
* Defines the WebGL screen-space ambient occlusion settings.
|
|
2641
|
-
* @category Cfg
|
|
2642
|
-
*/
|
|
2643
|
-
export declare interface SsaoWebGlCfg {
|
|
2644
|
-
/**
|
|
2645
|
-
* Defines the radius of the ambient occlusion kernel.
|
|
2417
|
+
* Sampling radius for ambient occlusion.
|
|
2646
2418
|
* @default 8
|
|
2647
2419
|
*/
|
|
2648
2420
|
kernelRadius: number;
|
|
@@ -2658,58 +2430,58 @@ export declare interface SsaoWebGlCfg {
|
|
|
2658
2430
|
maxDistance: number;
|
|
2659
2431
|
}
|
|
2660
2432
|
|
|
2433
|
+
/** Controls ambient occlusion and indirect diffuse lighting with WebGPU SSGI. */
|
|
2434
|
+
export declare interface SsgiCfg {
|
|
2435
|
+
/** Whether the GUI SSGI dropdown is open. */
|
|
2436
|
+
guiOpened: boolean;
|
|
2437
|
+
/** Number of per-pixel hemisphere slices. */
|
|
2438
|
+
sliceCount: number;
|
|
2439
|
+
/** Number of samples taken along each side of a hemisphere slice. */
|
|
2440
|
+
stepCount: number;
|
|
2441
|
+
/** Strength of the ambient occlusion component. */
|
|
2442
|
+
aoIntensity: number;
|
|
2443
|
+
/** Strength of the indirect diffuse lighting component. */
|
|
2444
|
+
giIntensity: number;
|
|
2445
|
+
/** Effective sampling radius. */
|
|
2446
|
+
radius: number;
|
|
2447
|
+
/** Whether the sample distance is evaluated in screen space. */
|
|
2448
|
+
useScreenSpaceSampling: boolean;
|
|
2449
|
+
/** Exponent controlling sample distribution. */
|
|
2450
|
+
expFactor: number;
|
|
2451
|
+
/** Assumed thickness of screen-space geometry. */
|
|
2452
|
+
thickness: number;
|
|
2453
|
+
/** Whether thickness grows with distance. */
|
|
2454
|
+
useLinearThickness: boolean;
|
|
2455
|
+
/** Amount of lighting emitted by back-facing surfaces. */
|
|
2456
|
+
backfaceLighting: number;
|
|
2457
|
+
}
|
|
2458
|
+
|
|
2661
2459
|
/**
|
|
2662
|
-
*
|
|
2460
|
+
* Shared screen-space lighting Inspector settings.
|
|
2663
2461
|
* @category Cfg
|
|
2664
2462
|
*/
|
|
2665
|
-
export declare interface
|
|
2666
|
-
/**
|
|
2667
|
-
* Defines the radius of the ambient occlusion in world space.
|
|
2668
|
-
* @default 0.25
|
|
2669
|
-
*/
|
|
2670
|
-
radius: number;
|
|
2463
|
+
export declare interface SslCfg {
|
|
2671
2464
|
/**
|
|
2672
|
-
*
|
|
2673
|
-
* @default
|
|
2674
|
-
*/
|
|
2675
|
-
thickness: number;
|
|
2676
|
-
/**
|
|
2677
|
-
* Controls how strongly the AO is attenuated over distance.
|
|
2678
|
-
* @default 1
|
|
2679
|
-
*/
|
|
2680
|
-
distanceExponent: number;
|
|
2681
|
-
/**
|
|
2682
|
-
* Defines how quickly the AO fades with distance.
|
|
2683
|
-
* @default 1
|
|
2684
|
-
*/
|
|
2685
|
-
distanceFallOff: number;
|
|
2686
|
-
/**
|
|
2687
|
-
* Scales the strength of the ambient occlusion.
|
|
2688
|
-
* @default 1
|
|
2689
|
-
*/
|
|
2690
|
-
scale: number;
|
|
2691
|
-
/**
|
|
2692
|
-
* Defines the number of samples used to compute the AO.
|
|
2693
|
-
* @default 16
|
|
2694
|
-
*/
|
|
2695
|
-
samples: number;
|
|
2696
|
-
/**
|
|
2697
|
-
* Defines the render resolution scale of the AO effect.
|
|
2698
|
-
* @default 1
|
|
2465
|
+
* Whether the GUI SSL dropdown is open.
|
|
2466
|
+
* @default false
|
|
2699
2467
|
*/
|
|
2700
|
-
|
|
2468
|
+
guiOpened: boolean;
|
|
2701
2469
|
}
|
|
2702
2470
|
|
|
2471
|
+
/** Screen-space lighting modes available across rendering backends. */
|
|
2472
|
+
export declare type SslMode = SslModeWebGl | SslModeWebGpu;
|
|
2473
|
+
|
|
2474
|
+
/** Screen-space lighting modes available with WebGL. */
|
|
2475
|
+
export declare type SslModeWebGl = 'none' | 'ssao';
|
|
2476
|
+
|
|
2477
|
+
/** Screen-space lighting modes available with WebGPU. */
|
|
2478
|
+
export declare type SslModeWebGpu = 'none' | 'gtao' | 'ssgi';
|
|
2479
|
+
|
|
2703
2480
|
/**
|
|
2704
|
-
*
|
|
2481
|
+
* Shared screen-space reflection parameters.
|
|
2705
2482
|
* @category Cfg
|
|
2706
2483
|
*/
|
|
2707
2484
|
export declare interface SsrCfg {
|
|
2708
|
-
/**
|
|
2709
|
-
* Imports the SSR module dynamically and enables the SSR effect.
|
|
2710
|
-
* @default false
|
|
2711
|
-
*/
|
|
2712
|
-
enable: boolean;
|
|
2713
2485
|
/**
|
|
2714
2486
|
* Whether the GUI SSR dropdown is open.
|
|
2715
2487
|
* @default false
|
|
@@ -2733,7 +2505,7 @@ export declare interface SsrCfg {
|
|
|
2733
2505
|
}
|
|
2734
2506
|
|
|
2735
2507
|
/**
|
|
2736
|
-
*
|
|
2508
|
+
* Tunes screen-space reflections with WebGL.
|
|
2737
2509
|
* @category Cfg
|
|
2738
2510
|
*/
|
|
2739
2511
|
export declare interface SsrWebGlCfg {
|
|
@@ -2748,7 +2520,7 @@ export declare interface SsrWebGlCfg {
|
|
|
2748
2520
|
*/
|
|
2749
2521
|
distanceAttenuation: boolean;
|
|
2750
2522
|
/**
|
|
2751
|
-
*
|
|
2523
|
+
* Strengthens reflections at grazing viewing angles using the Fresnel effect.
|
|
2752
2524
|
* @default true
|
|
2753
2525
|
*/
|
|
2754
2526
|
fresnel: boolean;
|
|
@@ -2790,7 +2562,7 @@ export declare interface SsrWebGlCfg {
|
|
|
2790
2562
|
}
|
|
2791
2563
|
|
|
2792
2564
|
/**
|
|
2793
|
-
*
|
|
2565
|
+
* Tunes screen-space reflections with WebGPU.
|
|
2794
2566
|
* @category Cfg
|
|
2795
2567
|
*/
|
|
2796
2568
|
export declare interface SsrWebGpuCfg {
|
|
@@ -2812,8 +2584,7 @@ export declare interface SsrWebGpuCfg {
|
|
|
2812
2584
|
}
|
|
2813
2585
|
|
|
2814
2586
|
/**
|
|
2815
|
-
*
|
|
2816
|
-
* and debug its runtime behavior.
|
|
2587
|
+
* Starts the application state machine and manages its XState actor.
|
|
2817
2588
|
* @category Core
|
|
2818
2589
|
*/
|
|
2819
2590
|
export declare class StateMachine {
|
|
@@ -2823,56 +2594,147 @@ export declare class StateMachine {
|
|
|
2823
2594
|
private lastState;
|
|
2824
2595
|
private snapshot;
|
|
2825
2596
|
private stateMachine;
|
|
2826
|
-
/* Excluded from this release type: __constructor */
|
|
2827
|
-
/* Excluded from this release type: sendEvent */
|
|
2828
2597
|
/**
|
|
2829
|
-
* Starts the
|
|
2598
|
+
* Starts the supplied state machine.
|
|
2830
2599
|
* @param stateMachine - A fully constructed XState 5 machine.
|
|
2831
2600
|
*
|
|
2832
2601
|
* **Example**
|
|
2833
|
-
* {@includeCode
|
|
2602
|
+
* {@includeCode ../../../apps-doc/examples/app-statemachine.ts}
|
|
2834
2603
|
|
|
2835
2604
|
*/
|
|
2836
2605
|
start(stateMachine: AnyStateMachine): void;
|
|
2837
2606
|
}
|
|
2838
2607
|
|
|
2839
2608
|
/**
|
|
2840
|
-
*
|
|
2609
|
+
* Controls state-machine inspection.
|
|
2841
2610
|
* @category Cfg
|
|
2842
2611
|
*/
|
|
2843
2612
|
export declare interface StateMachineCfg {
|
|
2844
2613
|
/**
|
|
2845
|
-
*
|
|
2614
|
+
* Enables the Stately Inspector to visualize states and transitions.
|
|
2846
2615
|
* @default false
|
|
2847
2616
|
*/
|
|
2848
2617
|
inspector: boolean;
|
|
2849
2618
|
}
|
|
2850
2619
|
|
|
2851
2620
|
/**
|
|
2852
|
-
*
|
|
2853
|
-
* - 'all'
|
|
2854
|
-
* - 'last'
|
|
2855
|
-
* - 'none'
|
|
2621
|
+
* Controls which active animations on the same layer stop before a new animation plays.
|
|
2622
|
+
* - `'all'`: Stops all previous active actions.
|
|
2623
|
+
* - `'last'`: Stops only the most recently played previous active action.
|
|
2624
|
+
* - `'none'`: Keeps all previous active actions running.
|
|
2856
2625
|
*/
|
|
2857
2626
|
export declare type StopMode = 'all' | 'last' | 'none';
|
|
2858
2627
|
|
|
2628
|
+
/** Removes the listener associated with an event subscription. */
|
|
2629
|
+
export declare type Unsubscribe = () => void;
|
|
2630
|
+
|
|
2859
2631
|
/**
|
|
2860
|
-
*
|
|
2861
|
-
*
|
|
2862
|
-
* - `ColorMap` assigns the texture to `map`. Use it with a `MeshBasicMaterial` for a fully baked color texture.
|
|
2863
|
-
* - `LightMap` assigns the texture to the `lightMap` slot and requires a `MeshStandardMaterial`.
|
|
2864
|
-
* - `AlphaMap` assigns a separate alpha texture to the `alphaMap` slot, which GLTF does not support natively.
|
|
2632
|
+
* Connects a custom HTML element to the scene lifecycle and object visibility.
|
|
2633
|
+
* @category Web Components
|
|
2865
2634
|
*/
|
|
2866
|
-
export declare
|
|
2635
|
+
export declare class Web extends HTMLElement {
|
|
2636
|
+
/** Element that hosts the rendered canvas. */
|
|
2637
|
+
canvas: Readonly<HTMLElement>;
|
|
2638
|
+
cfg: Cfg;
|
|
2639
|
+
events: Readonly<Events>;
|
|
2640
|
+
objs3D: Map<string, Obj3D>;
|
|
2641
|
+
webs: Map<string, Web[]> | null;
|
|
2642
|
+
private obj3DFollow;
|
|
2643
|
+
private visible;
|
|
2644
|
+
private visibleFollow;
|
|
2645
|
+
private visibleOverlap;
|
|
2646
|
+
private webCtrls;
|
|
2647
|
+
private unSubFollow;
|
|
2648
|
+
private unSubVisible;
|
|
2649
|
+
private clearFollow;
|
|
2650
|
+
private emitEvent;
|
|
2651
|
+
/**
|
|
2652
|
+
* Makes this component follow an `Obj3D` by subscribing to updates of its screen position and combined visibility.
|
|
2653
|
+
*
|
|
2654
|
+
* @param params - The follow parameters.
|
|
2655
|
+
* @param params.obj - The `Obj3D` to follow in the scene.
|
|
2656
|
+
*/
|
|
2657
|
+
follow({ obj }: {
|
|
2658
|
+
obj: Obj3D | string;
|
|
2659
|
+
}): void;
|
|
2660
|
+
/**
|
|
2661
|
+
* Applies the combined followed-object and overlap visibility.
|
|
2662
|
+
* @param visible - Whether the web component is visible after combining all visibility conditions.
|
|
2663
|
+
*/
|
|
2664
|
+
protected onVisibilityChanged(visible: boolean): void;
|
|
2665
|
+
/**
|
|
2666
|
+
* Called once when the scene, renderer, and initial environment are ready and, if configured, the first model has been loaded and traversed.
|
|
2667
|
+
* @public
|
|
2668
|
+
*
|
|
2669
|
+
* **Example**
|
|
2670
|
+
* {@includeCode ../../../../apps-doc/examples/marker-onready.ts}
|
|
2671
|
+
*/
|
|
2672
|
+
protected onReady(): void;
|
|
2673
|
+
/**
|
|
2674
|
+
* Called once after the scene is initialized, before model loading begins.
|
|
2675
|
+
* @public
|
|
2676
|
+
*/
|
|
2677
|
+
protected onStart(): void;
|
|
2678
|
+
/**
|
|
2679
|
+
* Registers this component for screen-space overlap tracking using `cfg.comps.overlap.padding`.
|
|
2680
|
+
* Farther registered components are hidden when their screen-space rectangles overlap.
|
|
2681
|
+
*/
|
|
2682
|
+
trackOverlap(): void;
|
|
2683
|
+
/** Stops this component from following the currently subscribed {@link Obj3D}. */
|
|
2684
|
+
unfollow(): void;
|
|
2685
|
+
/** Stops screen-space overlap tracking and removes any overlap-based hiding from this component. */
|
|
2686
|
+
untrackOverlap(): void;
|
|
2687
|
+
private updateVisibility;
|
|
2688
|
+
}
|
|
2867
2689
|
|
|
2868
|
-
/**
|
|
2869
|
-
export declare type
|
|
2690
|
+
/** Web component classes available for registration. */
|
|
2691
|
+
export declare type WebClass = new () => Web;
|
|
2870
2692
|
|
|
2693
|
+
/** Web component class with optional initial parameters. */
|
|
2694
|
+
export declare type WebEntry<TClass extends WebClass = WebClass> = TClass | {
|
|
2695
|
+
class: TClass;
|
|
2696
|
+
params?: WebParams;
|
|
2697
|
+
};
|
|
2698
|
+
|
|
2699
|
+
export declare type WebEvent = WebOverlapEvent | WebVisibleEvent;
|
|
2700
|
+
|
|
2701
|
+
/** @inheritDoc RenderCfg.webgpu.params */
|
|
2871
2702
|
export declare type WebGpuRendererParams = NonNullable<ConstructorParameters<typeof THREE_WEBGPU_TYPE.WebGPURenderer>[0]>;
|
|
2872
2703
|
|
|
2873
|
-
/**
|
|
2704
|
+
/**
|
|
2705
|
+
* Maps a record of Web Component classes or entries to a record of component instance arrays.
|
|
2706
|
+
* `{ key1: typeof Web1 } -> { key1: Web1[] }`
|
|
2707
|
+
* @hidden
|
|
2708
|
+
*/
|
|
2709
|
+
export declare type WebInsts<T extends Record<string, WebEntry>> = {
|
|
2710
|
+
[K in keyof T]: T[K] extends WebClass ? InstanceType<T[K]>[] : T[K] extends {
|
|
2711
|
+
class: infer TClass extends WebClass;
|
|
2712
|
+
} ? InstanceType<TClass>[] : never;
|
|
2713
|
+
};
|
|
2714
|
+
|
|
2715
|
+
/** @event Fired when a web component becomes overlapped or unobstructed. */
|
|
2716
|
+
export declare interface WebOverlapEvent {
|
|
2717
|
+
type: 'Web_Overlap_Changed';
|
|
2718
|
+
/** The affected web component. */
|
|
2719
|
+
web: Web;
|
|
2720
|
+
/** Whether the component is overlapped by a nearer component. */
|
|
2721
|
+
overlapped: boolean;
|
|
2722
|
+
}
|
|
2723
|
+
|
|
2724
|
+
/** Initial parameters assigned to a web component class when the app starts. */
|
|
2725
|
+
export declare type WebParams = Record<string, unknown>;
|
|
2726
|
+
|
|
2727
|
+
/** @event Fired when a web component's combined object and overlap visibility changes. */
|
|
2728
|
+
export declare interface WebVisibleEvent {
|
|
2729
|
+
type: 'Web_Visible_Changed';
|
|
2730
|
+
/** The affected web component. */
|
|
2731
|
+
web: Web;
|
|
2732
|
+
/** Whether the component is visible after combining all visibility conditions. */
|
|
2733
|
+
visible: boolean;
|
|
2734
|
+
}
|
|
2735
|
+
|
|
2736
|
+
/** @event Fired when the window size changes. */
|
|
2874
2737
|
export declare interface WindowResizeEvent {
|
|
2875
|
-
/** Identifies this event type. */
|
|
2876
2738
|
type: 'Window_Resize';
|
|
2877
2739
|
}
|
|
2878
2740
|
|