illutions 0.21.6
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/LICENSE +21 -0
- package/README.md +47 -0
- package/dist/main.d.ts +2479 -0
- package/dist/main.min.cjs +8 -0
- package/dist/main.min.js +8 -0
- package/package.json +36 -0
package/dist/main.d.ts
ADDED
|
@@ -0,0 +1,2479 @@
|
|
|
1
|
+
import { AnyEventObject } from 'xstate';
|
|
2
|
+
import { AnyStateMachine } from 'xstate';
|
|
3
|
+
import { default as default_2 } from 'three/addons/tsl/display/GTAONode.js';
|
|
4
|
+
import { default as default_3 } from 'three/addons/tsl/display/SSRNode.js';
|
|
5
|
+
import { DRACOLoader } from 'three/addons/loaders/DRACOLoader.js';
|
|
6
|
+
import { EffectComposer } from 'three/addons/postprocessing/EffectComposer.js';
|
|
7
|
+
import { EXRLoader } from 'three/addons/loaders/EXRLoader.js';
|
|
8
|
+
import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js';
|
|
9
|
+
import { HDRLoader } from 'three/addons/loaders/HDRLoader.js';
|
|
10
|
+
import { KTX2Loader } from 'three/addons/loaders/KTX2Loader.js';
|
|
11
|
+
import { MeshoptDecoder } from 'three/addons/libs/meshopt_decoder.module.js';
|
|
12
|
+
import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
|
|
13
|
+
import { OrbitControls as OrbitControls_2 } from 'three/examples/jsm/controls/OrbitControls.js';
|
|
14
|
+
import { OutputPass } from 'three/addons/postprocessing/OutputPass.js';
|
|
15
|
+
import { PointerLockControls } from 'three/addons/controls/PointerLockControls.js';
|
|
16
|
+
import { PointerLockControls as PointerLockControls_2 } from 'three/examples/jsm/controls/PointerLockControls.js';
|
|
17
|
+
import { ReflectorForSSRPass } from 'three/addons/objects/ReflectorForSSRPass.js';
|
|
18
|
+
import { RenderPass } from 'three/addons/postprocessing/RenderPass.js';
|
|
19
|
+
import { ShaderPass } from 'three/addons/postprocessing/ShaderPass.js';
|
|
20
|
+
import { SSAOPass } from 'three/addons/postprocessing/SSAOPass.js';
|
|
21
|
+
import { SSRPass } from 'three/addons/postprocessing/SSRPass.js';
|
|
22
|
+
import type * as THREE_TYPE from 'three';
|
|
23
|
+
import type * as THREE_WEBGPU_TYPE from 'three/webgpu';
|
|
24
|
+
import type * as THREE_WEBTSL_TYPE from 'three/tsl';
|
|
25
|
+
|
|
26
|
+
/** Defines the shared anti-aliasing settings.
|
|
27
|
+
* @category Cfg
|
|
28
|
+
*/
|
|
29
|
+
export declare interface aaCfg {
|
|
30
|
+
/**
|
|
31
|
+
* Whether the GUI anti-aliasing dropdown is open.
|
|
32
|
+
* @default false
|
|
33
|
+
*/
|
|
34
|
+
guiOpened: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Selects the anti-aliasing mode.
|
|
37
|
+
* @default 'none'
|
|
38
|
+
*/
|
|
39
|
+
mode: 'none' | 'fxaa' | 'smaa';
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** Defines the ambient light settings controlling global scene illumination.
|
|
43
|
+
* @category Cfg
|
|
44
|
+
*/
|
|
45
|
+
export declare interface AmbientlightCfg {
|
|
46
|
+
/**
|
|
47
|
+
* Activates the ambient light in the scene.
|
|
48
|
+
* @default false
|
|
49
|
+
*/
|
|
50
|
+
enable: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Light color applied uniformly to all objects.
|
|
53
|
+
* @default 0xffffff
|
|
54
|
+
*/
|
|
55
|
+
color: THREE_TYPE.ColorRepresentation;
|
|
56
|
+
/**
|
|
57
|
+
* Intensity of the ambient light.
|
|
58
|
+
* @default 1
|
|
59
|
+
*/
|
|
60
|
+
intensity: number;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/** @event Fired when an object animation starts or finishes and triggers the corresponding XState event. */
|
|
64
|
+
export declare interface AnimEvent {
|
|
65
|
+
/** Identifies this event type. */
|
|
66
|
+
type: 'ANIM_COMPLETE' | 'ANIM_START';
|
|
67
|
+
/** The name of the `THREE.Object3D` whose animation changed state. */
|
|
68
|
+
objName: string;
|
|
69
|
+
/** The name of the calling method. */
|
|
70
|
+
fct: string;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/** @event Fired when a material fade animation starts or finishes and triggers the corresponding XState event. */
|
|
74
|
+
export declare interface AnimFadeEvent {
|
|
75
|
+
/** Identifies this event type. */
|
|
76
|
+
type: 'ANIM_FADE_COMPLETE' | 'ANIM_FADE_START';
|
|
77
|
+
/** The name of the `THREE.Mesh` whose material fade changed state. */
|
|
78
|
+
objName: string;
|
|
79
|
+
/** The name of the calling method. */
|
|
80
|
+
fct: string;
|
|
81
|
+
/** The material property being faded. */
|
|
82
|
+
property: string;
|
|
83
|
+
/** The target value used for the fade operation. */
|
|
84
|
+
value: any;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Represents the central controller of the illutions 3D engine. The class initializes and manages all core modules of the engine, such as `Audio`, `Engine`, `Raycast` and `StateMachine`.
|
|
89
|
+
* It provides an entry point for creating and controlling a complete 3D scene.
|
|
90
|
+
* @category Core
|
|
91
|
+
*/
|
|
92
|
+
export declare class App<TClasses extends Classes = {}> {
|
|
93
|
+
readonly audio: Audio_2;
|
|
94
|
+
readonly cfgCtrl: CfgCtrl;
|
|
95
|
+
readonly engine: Engine;
|
|
96
|
+
readonly envCtrls: EnvCtrls;
|
|
97
|
+
readonly events: Events;
|
|
98
|
+
readonly orbitCtrls: OrbitCtrls;
|
|
99
|
+
readonly fpvCtrls: FpvCtrls;
|
|
100
|
+
readonly raycast: Raycast;
|
|
101
|
+
readonly stateMachine: StateMachine;
|
|
102
|
+
private cam3D;
|
|
103
|
+
private readonly gui;
|
|
104
|
+
readonly comps: CompInsts<NonNullable<TClasses['comps']>>;
|
|
105
|
+
readonly objs3D: Obj3DInsts<NonNullable<TClasses['objs3D']>>;
|
|
106
|
+
/* Excluded from this release type: __constructor */
|
|
107
|
+
init(cfg: Cfg): Promise<void>;
|
|
108
|
+
/**
|
|
109
|
+
* Asynchronously creates and initializes a new `App` instance, which acts as the central entry point of the application. After successful validation, this method constructs a fully configured App object that manages 3D objects, web components, application state, and runtime dependencies. This method is typically called once during application startup to ensure a consistent initialization sequence, guaranteeing that all required configuration values and checks are completed before the main logic begins execution.
|
|
110
|
+
* @param cfg - A `Cfg` object containing initialization parameters, runtime settings, and optional debug options.
|
|
111
|
+
* @param classes - Class registry for components and 3D objects. Default: **empty object**
|
|
112
|
+
* @param createStateMachine - Factory function that receives the fully created `App` instance and returns a state machine.
|
|
113
|
+
*
|
|
114
|
+
* @returns A promise that resolves when the app startup sequence has completed or when a startup error has been caught.
|
|
115
|
+
*
|
|
116
|
+
* **Example**
|
|
117
|
+
* {@includeCode ../examples/app-run.ts}
|
|
118
|
+
*/
|
|
119
|
+
static run<TClasses extends Classes = {}>(cfg?: Cfg, classes?: TClasses, createStateMachine?: (app: App<TClasses>) => AnyStateMachine): Promise<void>;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* The `Audio` class manages audio playback within a Three.js scene. It handles loading, attaching, fading, and controlling global and positional audio sources, and ensures smooth transitions and automatic
|
|
124
|
+
* AudioContext management.
|
|
125
|
+
* @category Core
|
|
126
|
+
*/
|
|
127
|
+
declare class Audio_2 {
|
|
128
|
+
private readonly cfg;
|
|
129
|
+
private readonly ctx;
|
|
130
|
+
private readonly loader;
|
|
131
|
+
private readonly engine;
|
|
132
|
+
private readonly sounds;
|
|
133
|
+
private audioCfgLast;
|
|
134
|
+
private callback;
|
|
135
|
+
private listener;
|
|
136
|
+
/* Excluded from this release type: __constructor */
|
|
137
|
+
private attachSoundTo;
|
|
138
|
+
/**
|
|
139
|
+
* Checks whether an audio source with the given name is loaded.
|
|
140
|
+
* @param params - Parameter object.
|
|
141
|
+
* @param params.name - The name of the audio.
|
|
142
|
+
* @returns True if the audio is loaded, otherwise false.
|
|
143
|
+
*/
|
|
144
|
+
isLoaded({ name }: {
|
|
145
|
+
name: string;
|
|
146
|
+
}): boolean;
|
|
147
|
+
/**
|
|
148
|
+
* Checks whether an audio source with the given name is currently playing.
|
|
149
|
+
* @param params - Parameter object.
|
|
150
|
+
* @param params.name - The name of the audio.
|
|
151
|
+
* @returns True if the audio is playing, otherwise false.
|
|
152
|
+
*/
|
|
153
|
+
isPlaying({ name }: {
|
|
154
|
+
name: string;
|
|
155
|
+
}): boolean;
|
|
156
|
+
/**
|
|
157
|
+
* Loads an audio file and plays it once loaded with a smooth fade-in.
|
|
158
|
+
* @param params - The parameters for loading and playing an audio.
|
|
159
|
+
* @param params.name - Unique name of the audio.
|
|
160
|
+
* @param params.url - Path or URL to the audio file.
|
|
161
|
+
* @param params.object - The name of the object to attach the audio to for positional audio. Pass an empty string for global audio.
|
|
162
|
+
* @param params.volume - The target playback volume. Default: **0**
|
|
163
|
+
* @param params.fade - The fade-in duration of the audio in seconds. Default: **2**
|
|
164
|
+
* @param params.loop - Whether the audio should loop. Default: **true**
|
|
165
|
+
*/
|
|
166
|
+
loadAndPlay({ name, url, object, volume, fade, loop }: {
|
|
167
|
+
name: string;
|
|
168
|
+
url: string;
|
|
169
|
+
object: string;
|
|
170
|
+
volume?: number;
|
|
171
|
+
fade?: number;
|
|
172
|
+
loop?: boolean;
|
|
173
|
+
}): void;
|
|
174
|
+
/**
|
|
175
|
+
* Plays an already loaded audio with a smooth fade-in.
|
|
176
|
+
* @param params - Parameter object.
|
|
177
|
+
* @param params.name - The name of the audio to play.
|
|
178
|
+
*/
|
|
179
|
+
play({ name }: {
|
|
180
|
+
name: string;
|
|
181
|
+
}): void;
|
|
182
|
+
private setAttribute;
|
|
183
|
+
private setAudioContext;
|
|
184
|
+
/**
|
|
185
|
+
* Creates a `THREE.AudioListener` and attaches it to the specified object.
|
|
186
|
+
*
|
|
187
|
+
* @param params - Parameter object.
|
|
188
|
+
* @param params.object - The name of the scene object to attach the listener to.
|
|
189
|
+
*/
|
|
190
|
+
setListener({ object: name }: {
|
|
191
|
+
object: string;
|
|
192
|
+
}): void;
|
|
193
|
+
private setAllPositionalSoundsCfg;
|
|
194
|
+
private setPositionalSoundCfg;
|
|
195
|
+
/**
|
|
196
|
+
* Stops the playback of an audio with a smooth fade-out.
|
|
197
|
+
* @param params - Parameter object.
|
|
198
|
+
* @param params.name - The name of the audio to stop.
|
|
199
|
+
*/
|
|
200
|
+
stop({ name }: {
|
|
201
|
+
name: string;
|
|
202
|
+
}): void;
|
|
203
|
+
/**
|
|
204
|
+
* Registers and executes a low-level extension function with access to the public `Audio` API.
|
|
205
|
+
* @param extension - Function that receives the current `Audio` instance and can use its public members and methods.
|
|
206
|
+
* @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.
|
|
207
|
+
*/
|
|
208
|
+
use(extension: (audio: Audio_2) => void): void;
|
|
209
|
+
/* Excluded from this release type: update */
|
|
210
|
+
}
|
|
211
|
+
export { Audio_2 as Audio }
|
|
212
|
+
|
|
213
|
+
/** Defines the audio settings used for playback timing and distance-based spatial attenuation.
|
|
214
|
+
* @category Cfg
|
|
215
|
+
*/
|
|
216
|
+
export declare interface AudioCfg {
|
|
217
|
+
/**
|
|
218
|
+
* Whether the GUI audio dropdown is open.
|
|
219
|
+
* @default false
|
|
220
|
+
*/
|
|
221
|
+
guiOpened: boolean;
|
|
222
|
+
/**
|
|
223
|
+
* The default sound start offset in milliseconds.
|
|
224
|
+
* @default 200
|
|
225
|
+
*/
|
|
226
|
+
delayPlaySound: number;
|
|
227
|
+
/**
|
|
228
|
+
* The reference distance after which the attenuation begins.
|
|
229
|
+
* @default 1
|
|
230
|
+
*/
|
|
231
|
+
refDistance: number;
|
|
232
|
+
/**
|
|
233
|
+
* Determines how quickly the volume falls off with distance.
|
|
234
|
+
* @default 5
|
|
235
|
+
*/
|
|
236
|
+
rolloffFactor: number;
|
|
237
|
+
/**
|
|
238
|
+
* The maximum distance at which the sound is still audible.
|
|
239
|
+
* @default 1000
|
|
240
|
+
*/
|
|
241
|
+
maxDistance: number;
|
|
242
|
+
/**
|
|
243
|
+
* The distance attenuation model used.
|
|
244
|
+
* @default 'exponential'
|
|
245
|
+
*/
|
|
246
|
+
distanceModel: 'linear' | 'inverse' | 'exponential';
|
|
247
|
+
/**
|
|
248
|
+
* The angle inside the cone where there is no attenuation.
|
|
249
|
+
* @default 360
|
|
250
|
+
*/
|
|
251
|
+
coneInnerAngle: number;
|
|
252
|
+
/**
|
|
253
|
+
* The angle outside the cone where full attenuation is applied.
|
|
254
|
+
* @default 360
|
|
255
|
+
*/
|
|
256
|
+
coneOuterAngle: number;
|
|
257
|
+
/**
|
|
258
|
+
* The gain factor outside the cone.
|
|
259
|
+
* @default 0
|
|
260
|
+
*/
|
|
261
|
+
coneOuterGain: number;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
/**
|
|
265
|
+
* Wraps a `THREE.Camera` and provides a structured interface for configuring and controlling camera settings.
|
|
266
|
+
* @category 3D Objects
|
|
267
|
+
*/
|
|
268
|
+
export declare class Cam3D extends Obj3D {
|
|
269
|
+
/* Excluded from this release type: lookMode */
|
|
270
|
+
/**
|
|
271
|
+
* The `THREE.Camera` instance used for rendering the scene. It can represent different camera types, such as perspective or orthographic.
|
|
272
|
+
* @default `THREE.PerspectiveCamera`
|
|
273
|
+
*/
|
|
274
|
+
readonly obj: THREE_TYPE.Camera;
|
|
275
|
+
/** Reference to the original `THREE.Camera` loaded from the GLTF scene. */
|
|
276
|
+
objGltf: THREE_TYPE.Camera | null;
|
|
277
|
+
/** Target object used as the camera look-at target. */
|
|
278
|
+
objTarget: THREE_TYPE.Object3D;
|
|
279
|
+
/** Reference to the original target `THREE.Object3D` loaded from the GLTF scene. */
|
|
280
|
+
targetGltf: THREE_TYPE.Object3D | null;
|
|
281
|
+
private readonly tmpVec;
|
|
282
|
+
/* Excluded from this release type: __constructor */
|
|
283
|
+
/**
|
|
284
|
+
* Called once for a camera found while traversing a GLTF scene. Copies the traversed camera type, projection settings, and world transform to `obj`.
|
|
285
|
+
* @param objGltf - The GLTF `THREE.Camera` object.
|
|
286
|
+
* @public
|
|
287
|
+
*
|
|
288
|
+
* **Example**
|
|
289
|
+
* {@includeCode ../../examples/cam3d-dollycamera.ts}
|
|
290
|
+
*/
|
|
291
|
+
protected onTraverse(objGltf: THREE_TYPE.Camera): void;
|
|
292
|
+
/* Excluded from this release type: traverse */
|
|
293
|
+
/* Excluded from this release type: update */
|
|
294
|
+
/* Excluded from this release type: updateCanvasResize */
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
/** Defines the shared camera settings used to position, orient and clip the scene view.
|
|
298
|
+
* @category Cfg
|
|
299
|
+
*/
|
|
300
|
+
export declare interface CamBaseCfg {
|
|
301
|
+
/**
|
|
302
|
+
* The distance to the near clipping plane.
|
|
303
|
+
* @default 0.1
|
|
304
|
+
*/
|
|
305
|
+
near: number;
|
|
306
|
+
/**
|
|
307
|
+
* The distance to the far clipping plane.
|
|
308
|
+
* @default 1000
|
|
309
|
+
*/
|
|
310
|
+
far: number;
|
|
311
|
+
/**
|
|
312
|
+
* The point in 3D space the camera should look at.
|
|
313
|
+
* @default { x: 0, y: 0, z: 0 }
|
|
314
|
+
*/
|
|
315
|
+
lookAt: {
|
|
316
|
+
x: number;
|
|
317
|
+
y: number;
|
|
318
|
+
z: number;
|
|
319
|
+
};
|
|
320
|
+
/**
|
|
321
|
+
* The default position of the camera in 3D space.
|
|
322
|
+
* @default { x: 0, y: 0.5, z: 0.5 }
|
|
323
|
+
*/
|
|
324
|
+
position: {
|
|
325
|
+
x: number;
|
|
326
|
+
y: number;
|
|
327
|
+
z: number;
|
|
328
|
+
};
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
export declare type CamCfg = CamPerspectiveCfg | CamOrthographicCfg;
|
|
332
|
+
|
|
333
|
+
/** Defines the orthographic camera settings used to render the scene without perspective distortion.
|
|
334
|
+
* @category Cfg
|
|
335
|
+
*/
|
|
336
|
+
export declare interface CamOrthographicCfg extends CamBaseCfg {
|
|
337
|
+
/**
|
|
338
|
+
* The camera type.
|
|
339
|
+
* @default 'orthographic'
|
|
340
|
+
*/
|
|
341
|
+
type: 'orthographic';
|
|
342
|
+
/**
|
|
343
|
+
* Camera frustum left plane.
|
|
344
|
+
* @default -1
|
|
345
|
+
*/
|
|
346
|
+
left: number;
|
|
347
|
+
/**
|
|
348
|
+
* Camera frustum right plane.
|
|
349
|
+
* @default 1
|
|
350
|
+
*/
|
|
351
|
+
right: number;
|
|
352
|
+
/**
|
|
353
|
+
* Camera frustum top plane.
|
|
354
|
+
* @default 1
|
|
355
|
+
*/
|
|
356
|
+
top: number;
|
|
357
|
+
/**
|
|
358
|
+
* Camera frustum bottom plane.
|
|
359
|
+
* @default -1
|
|
360
|
+
*/
|
|
361
|
+
bottom: number;
|
|
362
|
+
/** @private */
|
|
363
|
+
fov?: never;
|
|
364
|
+
/** @private */
|
|
365
|
+
aspect?: never;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
/** Defines the perspective camera settings used to render the scene with depth perception.
|
|
369
|
+
* @category Cfg
|
|
370
|
+
*/
|
|
371
|
+
export declare interface CamPerspectiveCfg extends CamBaseCfg {
|
|
372
|
+
/**
|
|
373
|
+
* The camera type.
|
|
374
|
+
* @default 'perspective'
|
|
375
|
+
*/
|
|
376
|
+
type: 'perspective';
|
|
377
|
+
/**
|
|
378
|
+
* Vertical field of view in degrees.
|
|
379
|
+
* @default 75
|
|
380
|
+
*/
|
|
381
|
+
fov: number;
|
|
382
|
+
/** @private */
|
|
383
|
+
left?: never;
|
|
384
|
+
/** @private */
|
|
385
|
+
right?: never;
|
|
386
|
+
/** @private */
|
|
387
|
+
top?: never;
|
|
388
|
+
/** @private */
|
|
389
|
+
bottom?: never;
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
/** @event Fired when the user uses keys while the canvas has focus and triggers the corresponding XState event. */
|
|
393
|
+
export declare interface CanvasKeyEvent {
|
|
394
|
+
/** Identifies this event type. */
|
|
395
|
+
type: 'CANVAS_KEY_DOWN' | 'CANVAS_KEY_UP';
|
|
396
|
+
/** Native keyboard event from the canvas interaction. */
|
|
397
|
+
event: KeyboardEvent;
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
/** @event Fired when the user uses the pointer on the canvas and triggers the corresponding XState event. */
|
|
401
|
+
export declare interface CanvasPointerEvent {
|
|
402
|
+
/** Identifies this event type. */
|
|
403
|
+
type: 'CANVAS_CLICK' | 'CANVAS_POINTER_DOWN' | 'CANVAS_POINTER_MOVE' | 'CANVAS_POINTER_UP';
|
|
404
|
+
/** Native pointer event from the canvas interaction. */
|
|
405
|
+
event: PointerEvent;
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
/** Defines the full configuration structure used to initialize the application.
|
|
409
|
+
* @category Cfg
|
|
410
|
+
*/
|
|
411
|
+
export declare interface Cfg {
|
|
412
|
+
/** Audio settings. */
|
|
413
|
+
audio: AudioCfg;
|
|
414
|
+
/** Camera settings. */
|
|
415
|
+
cam: CamCfg;
|
|
416
|
+
/** Debug settings. */
|
|
417
|
+
debug: DebugCfg;
|
|
418
|
+
/** Environment controls settings. */
|
|
419
|
+
envCtrls: EnvCtrlsCfg;
|
|
420
|
+
/** Light and shadow settings. */
|
|
421
|
+
light: LightCfg;
|
|
422
|
+
/** Menu bar settings. */
|
|
423
|
+
menuBar: MenuBarCfg;
|
|
424
|
+
/** Default mesh settings. */
|
|
425
|
+
mesh: MeshCfg;
|
|
426
|
+
/** GLTF/GLB model settings. */
|
|
427
|
+
model: ModelCfg;
|
|
428
|
+
/** Orbit controls settings. */
|
|
429
|
+
orbitCtrls: OrbitCtrlsCfg;
|
|
430
|
+
/** First-person controls settings. */
|
|
431
|
+
fpvCtrls: FpvCtrlsCfg;
|
|
432
|
+
/** Post-processing settings. */
|
|
433
|
+
post: PostCfg;
|
|
434
|
+
/** Renderer settings. */
|
|
435
|
+
render: RenderCfg;
|
|
436
|
+
/** Raycasting settings. */
|
|
437
|
+
raycast: RaycastCfg;
|
|
438
|
+
/** Scene settings. */
|
|
439
|
+
scene: SceneCfg;
|
|
440
|
+
/** State machine settings. */
|
|
441
|
+
stateMachine: StateMachineCfg;
|
|
442
|
+
/** Runtime statistics settings. */
|
|
443
|
+
stats: StatsCfg;
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
/** Defines the static configuration that is applied at compile-time. For runtime updates use {@link CfgCtrl}. */
|
|
447
|
+
export declare const cfg: Cfg;
|
|
448
|
+
|
|
449
|
+
/**
|
|
450
|
+
* Controls configuration options at runtime.
|
|
451
|
+
* @category Core
|
|
452
|
+
*/
|
|
453
|
+
export declare class CfgCtrl {
|
|
454
|
+
private cfg;
|
|
455
|
+
/* Excluded from this release type: __constructor */
|
|
456
|
+
/**
|
|
457
|
+
* Applies runtime updates to `AudioCfg`.
|
|
458
|
+
*
|
|
459
|
+
* @param params - Partial audio settings to apply.
|
|
460
|
+
* @param params.refDistance - {@link AudioCfg.refDistance}.
|
|
461
|
+
* @param params.rolloffFactor - {@link AudioCfg.rolloffFactor}.
|
|
462
|
+
* @param params.maxDistance - {@link AudioCfg.maxDistance}.
|
|
463
|
+
* @param params.distanceModel - {@link AudioCfg.distanceModel}.
|
|
464
|
+
* @param params.coneInnerAngle - {@link AudioCfg.coneInnerAngle}.
|
|
465
|
+
* @param params.coneOuterAngle - {@link AudioCfg.coneOuterAngle}.
|
|
466
|
+
* @param params.coneOuterGain - {@link AudioCfg.coneOuterGain}.
|
|
467
|
+
*/
|
|
468
|
+
setAudio(params: Partial<AudioCfg>): void;
|
|
469
|
+
/**
|
|
470
|
+
* Applies runtime updates to `RenderCfg`.
|
|
471
|
+
*
|
|
472
|
+
* @param params - Partial render settings to apply.
|
|
473
|
+
* @param params.fpsLimiter - {@link RenderCfg.fpsLimiter}.
|
|
474
|
+
* @param params.deltaTimesMax - {@link RenderCfg.deltaTimesMax}.
|
|
475
|
+
*/
|
|
476
|
+
setRender(params: Partial<RenderCfg>): void;
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
/**
|
|
480
|
+
* Groups optional class registries for `Obj3D` and `Comp`.
|
|
481
|
+
*
|
|
482
|
+
* @typeParam TObj3DClasses - Record of named 3D object class constructors.
|
|
483
|
+
* @typeParam TCompClasses - Record of named component class constructors.
|
|
484
|
+
*
|
|
485
|
+
* @example
|
|
486
|
+
* type MyClasses = Classes<{ cube: typeof Cube }, { marker: typeof Marker }>;
|
|
487
|
+
*/
|
|
488
|
+
export declare type Classes<TObj3DClasses extends Record<string, Obj3DClass> = {}, TCompClasses extends Record<string, CompClass> = {}> = {
|
|
489
|
+
objs3D?: TObj3DClasses;
|
|
490
|
+
comps?: TCompClasses;
|
|
491
|
+
};
|
|
492
|
+
|
|
493
|
+
/** @event Fired when a clip starts or finishes playing and triggers the corresponding XState event. */
|
|
494
|
+
export declare interface ClipEvent {
|
|
495
|
+
/** Identifies this event type. */
|
|
496
|
+
type: 'CLIP_START' | 'CLIP_COMPLETE';
|
|
497
|
+
/** The name of the `THREE.AnimationClip` that changed state. */
|
|
498
|
+
clipName: string;
|
|
499
|
+
/** The name of the calling method. */
|
|
500
|
+
fct: string;
|
|
501
|
+
/** The associated animation action, when available. */
|
|
502
|
+
action?: THREE_TYPE.AnimationAction;
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
/** @event Fired when a clip fade starts, completes, or fade-out starts/completes and triggers the corresponding XState event. */
|
|
506
|
+
export declare interface ClipFadeEvent {
|
|
507
|
+
/** Identifies this event type. */
|
|
508
|
+
type: 'CLIP_FADE_START' | 'CLIP_FADE_COMPLETE' | 'CLIP_FADEOUT_COMPLETE' | 'CLIP_FADEOUT_START';
|
|
509
|
+
/** The name of the `THREE.AnimationClip` whose fade changed state. */
|
|
510
|
+
clipName: string;
|
|
511
|
+
/** The name of the calling method. */
|
|
512
|
+
fct: string;
|
|
513
|
+
/** The associated animation action, when available. */
|
|
514
|
+
action?: THREE_TYPE.AnimationAction;
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
/**
|
|
518
|
+
* Represents a reusable web-component logic unit bound to a custom element that participates in the scene lifecycle.
|
|
519
|
+
* @category Components
|
|
520
|
+
*/
|
|
521
|
+
export declare class Comp extends HTMLElement {
|
|
522
|
+
/** The root HTML element that hosts the visual container for the engine. */
|
|
523
|
+
canvas: Readonly<HTMLElement>;
|
|
524
|
+
cfg: Cfg;
|
|
525
|
+
cfgCtrl: Readonly<CfgCtrl>;
|
|
526
|
+
comps: Map<string, Comp[]> | null;
|
|
527
|
+
events: Readonly<Events>;
|
|
528
|
+
objs3D: Map<string, Obj3D>;
|
|
529
|
+
private unsubFollow;
|
|
530
|
+
private unsubVisible;
|
|
531
|
+
/**
|
|
532
|
+
* Makes this component follow an `Obj3D` by subscribing to updates of its screen position.
|
|
533
|
+
*
|
|
534
|
+
* @param params - The follow parameters.
|
|
535
|
+
* @param params.obj - The `Obj3D` to follow in the scene.
|
|
536
|
+
* @param params.enableOcclusionCheck - Whether to enable occlusion visibility checks. Default: **false**
|
|
537
|
+
*/
|
|
538
|
+
follow({ obj, enableOcclusionCheck }: {
|
|
539
|
+
obj: Obj3D | string;
|
|
540
|
+
enableOcclusionCheck?: boolean;
|
|
541
|
+
}): void;
|
|
542
|
+
/** Stops this component from following the currently subscribed {@link Obj3D}. */
|
|
543
|
+
unfollow(): void;
|
|
544
|
+
/**
|
|
545
|
+
* 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.
|
|
546
|
+
* @public
|
|
547
|
+
*
|
|
548
|
+
* **Example**
|
|
549
|
+
* {@includeCode ../../examples/comp-onready.ts}
|
|
550
|
+
*/
|
|
551
|
+
protected onReady(): void;
|
|
552
|
+
/**
|
|
553
|
+
* Called once after the `THREE.Scene` is initialized, before an existing GLTF model is loaded.
|
|
554
|
+
* @public
|
|
555
|
+
*/
|
|
556
|
+
protected onStart(): void;
|
|
557
|
+
/* Excluded from this release type: ready */
|
|
558
|
+
/* Excluded from this release type: start */
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
/** Constructor type for `Comp` classes. */
|
|
562
|
+
export declare type CompClass = new () => Comp;
|
|
563
|
+
|
|
564
|
+
/**
|
|
565
|
+
* Maps a record of Comp classes to a record of component instance arrays.
|
|
566
|
+
* { key1: typeof Comp1 } -> { key1: Comp1[] }
|
|
567
|
+
* @hidden
|
|
568
|
+
*/
|
|
569
|
+
export declare type CompInsts<T extends Record<string, CompClass>> = {
|
|
570
|
+
[K in keyof T]: InstanceType<T[K]>[];
|
|
571
|
+
};
|
|
572
|
+
|
|
573
|
+
/** Defines the debugging settings that can be toggled during development.
|
|
574
|
+
* @category Cfg
|
|
575
|
+
*/
|
|
576
|
+
export declare interface DebugCfg {
|
|
577
|
+
/**
|
|
578
|
+
* Controls how much debug information is written to the console.
|
|
579
|
+
*
|
|
580
|
+
* `'none'`: No debug messages are logged.
|
|
581
|
+
* `'xstate'`: Only logs events that were accepted by the state machine.
|
|
582
|
+
* `'all'`: Logs all debug messages.
|
|
583
|
+
* @default 'xstate'
|
|
584
|
+
*/
|
|
585
|
+
log: 'none' | 'xstate' | 'all';
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
/**
|
|
589
|
+
* The `Engine` class serves as the core runtime of the illutions Engine. It initializes and manages the Three.js scene, renderer, camera, lighting, post-processing, and loaded models. The class orchestrates
|
|
590
|
+
* 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
|
|
591
|
+
* all scene components.
|
|
592
|
+
* @category Core
|
|
593
|
+
*/
|
|
594
|
+
export declare class Engine {
|
|
595
|
+
/* Excluded from this release type: scene */
|
|
596
|
+
private readonly cam3D;
|
|
597
|
+
private readonly events;
|
|
598
|
+
private readonly modules;
|
|
599
|
+
private readonly comps;
|
|
600
|
+
private readonly objs3D;
|
|
601
|
+
private readonly cfg;
|
|
602
|
+
private readonly stats;
|
|
603
|
+
private actionObserver;
|
|
604
|
+
private gltf;
|
|
605
|
+
private mixer;
|
|
606
|
+
private composer;
|
|
607
|
+
/* Excluded from this release type: renderer */
|
|
608
|
+
private renderPipeline;
|
|
609
|
+
/* Excluded from this release type: modelReady */
|
|
610
|
+
/* Excluded from this release type: rendererReady */
|
|
611
|
+
private callbacks;
|
|
612
|
+
private canvas;
|
|
613
|
+
private fxaaPass;
|
|
614
|
+
private outputPass;
|
|
615
|
+
private renderPass;
|
|
616
|
+
private smaaPass;
|
|
617
|
+
private tslPass;
|
|
618
|
+
/* Excluded from this release type: ssaoPass */
|
|
619
|
+
/* Excluded from this release type: gtaoNode */
|
|
620
|
+
/* Excluded from this release type: ssrPass */
|
|
621
|
+
/* Excluded from this release type: ssrNode */
|
|
622
|
+
/* Excluded from this release type: groundReflector */
|
|
623
|
+
private reflectivesSSR;
|
|
624
|
+
private ambientLight;
|
|
625
|
+
private hemisphereLight;
|
|
626
|
+
private powerMode;
|
|
627
|
+
private postAuto;
|
|
628
|
+
private dTs;
|
|
629
|
+
private dT;
|
|
630
|
+
private dTFrameMax;
|
|
631
|
+
private gpuFps;
|
|
632
|
+
private timeGsap;
|
|
633
|
+
private timeLast;
|
|
634
|
+
private timeLastFrame;
|
|
635
|
+
private resizeTimeout;
|
|
636
|
+
private resizeDelay;
|
|
637
|
+
/* Excluded from this release type: __constructor */
|
|
638
|
+
/* Excluded from this release type: init */
|
|
639
|
+
private initWebGpuRenderer;
|
|
640
|
+
private isPostEnabled;
|
|
641
|
+
/**
|
|
642
|
+
* Registers a callback that is executed on every requestAnimationFrame update.
|
|
643
|
+
* @param {(deltaTime: number) => void} cb - Callback executed once per frame with `deltaTime`.
|
|
644
|
+
*/
|
|
645
|
+
addOnFrameUpdate(cb: (deltaTime: number) => void): void;
|
|
646
|
+
/**
|
|
647
|
+
* Animates the camera on a curved path towards a target position while optionally updating the camera's look-at target.
|
|
648
|
+
*
|
|
649
|
+
* @param params - Parameter object for the animation.
|
|
650
|
+
* @param params.camTarget - The target the camera should move toward.
|
|
651
|
+
* @param params.aimTarget - The target the camera should face during or after the animation.
|
|
652
|
+
* @param params.radiusOut - The outward curve radius used to shape the camera path. Default: **1**
|
|
653
|
+
* @param params.duration - The animation duration in seconds. Default: **2**
|
|
654
|
+
* @param params.ease - The easing function name for GSAP. Default: **'power1.inOut'**
|
|
655
|
+
*
|
|
656
|
+
* @remarks
|
|
657
|
+
* 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,
|
|
658
|
+
* the camera target position is interpolated towards the resolved aim position while the camera moves along the curve.
|
|
659
|
+
*
|
|
660
|
+
* **Events**
|
|
661
|
+
*
|
|
662
|
+
* {@link AnimEvent}
|
|
663
|
+
*/
|
|
664
|
+
animCamCurveToTarget({ camTarget, aimTarget, radiusOut, duration, ease }: {
|
|
665
|
+
camTarget: THREE_TYPE.Vector3 | string | Obj3D;
|
|
666
|
+
aimTarget?: THREE_TYPE.Vector3 | string | Obj3D;
|
|
667
|
+
radiusOut?: number;
|
|
668
|
+
duration?: number;
|
|
669
|
+
ease?: string;
|
|
670
|
+
}): void;
|
|
671
|
+
/**
|
|
672
|
+
* Animates the `THREE.PerspectiveCamera` towards a target object and frames it based on its own geometry. The camera keeps the resolved target object as the look-at target while its distance is calculated
|
|
673
|
+
* from the object's bounding size and the camera's field of view.
|
|
674
|
+
*
|
|
675
|
+
* @param params - Parameter object for the animation.
|
|
676
|
+
* @param params.target - The target object or the name of the target object.
|
|
677
|
+
* @param params.duration - The animation duration in seconds. Default: **1**
|
|
678
|
+
* @param params.ease - The easing function name for GSAP. Default: **'power2.inOut'**
|
|
679
|
+
* @param params.dist - Framing factor applied to the calculated camera distance. Default: **1**
|
|
680
|
+
*
|
|
681
|
+
* @remarks
|
|
682
|
+
* Only the target object's own geometry is used to calculate the bounding size. Child objects are intentionally ignored.
|
|
683
|
+
*
|
|
684
|
+
* **Events**
|
|
685
|
+
*
|
|
686
|
+
* {@link AnimEvent}
|
|
687
|
+
*/
|
|
688
|
+
animCamToObj({ target, duration, ease, dist }: {
|
|
689
|
+
target: string | Obj3D;
|
|
690
|
+
duration?: number;
|
|
691
|
+
ease?: string;
|
|
692
|
+
dist?: number;
|
|
693
|
+
}): void;
|
|
694
|
+
/**
|
|
695
|
+
* The method finds a Three.js mesh by name, validates that it has a material with color properties and animates them (e.g. color, emissive, ...).
|
|
696
|
+
*
|
|
697
|
+
* @param params - Parameter object for the animation.
|
|
698
|
+
* @param params.mesh - The name of the mesh object whose material color should be animated.
|
|
699
|
+
* @param params.duration - The animation duration in seconds. Default: **0**
|
|
700
|
+
* @param params.ease - The easing function name for GSAP. Default: **'power1.inOut'**
|
|
701
|
+
*
|
|
702
|
+
* @remarks
|
|
703
|
+
* 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,
|
|
704
|
+
* or `THREE.Color` instances.
|
|
705
|
+
*
|
|
706
|
+
* **Events**
|
|
707
|
+
*
|
|
708
|
+
* {@link AnimEvent}
|
|
709
|
+
*/
|
|
710
|
+
animMaterialColor({ mesh, duration, ease, ...colorProps }: {
|
|
711
|
+
mesh: string;
|
|
712
|
+
duration?: number;
|
|
713
|
+
ease?: string;
|
|
714
|
+
} & {
|
|
715
|
+
[key: string]: string | number | THREE_TYPE.Color;
|
|
716
|
+
}): void;
|
|
717
|
+
/**
|
|
718
|
+
* The method finds a Three.js mesh by name, validates that it has a material with numeric properties (e.g. `metalness`, `roughness`, `opacity`, etc.) and animates them over time using GSAP.
|
|
719
|
+
*
|
|
720
|
+
* @param params - Parameter object for the animation.
|
|
721
|
+
* @param params.mesh - The name of the mesh object whose material property will be animated.
|
|
722
|
+
* @param params.startValue - The starting value of the property. Default: **Current material's value**
|
|
723
|
+
* @param params.infinite - If `true`, the animation loops infinitely. Default: **false**
|
|
724
|
+
* @param params.duration - The animation duration in seconds. Default: **0**
|
|
725
|
+
* @param params.ease - The easing function name for GSAP. Default: **'power1.inOut'**
|
|
726
|
+
*
|
|
727
|
+
* @remarks
|
|
728
|
+
* 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
|
|
729
|
+
* property will be animated per call.
|
|
730
|
+
*
|
|
731
|
+
* **Events**
|
|
732
|
+
*
|
|
733
|
+
* {@link AnimFadeEvent}
|
|
734
|
+
*/
|
|
735
|
+
animMaterialNumeric({ mesh, startValue, infinite, duration, ease, ...props }: {
|
|
736
|
+
mesh: string;
|
|
737
|
+
startValue?: number | null;
|
|
738
|
+
infinite?: boolean;
|
|
739
|
+
duration?: number;
|
|
740
|
+
ease?: string;
|
|
741
|
+
[key: string]: any;
|
|
742
|
+
}): void;
|
|
743
|
+
private calcEaseArea;
|
|
744
|
+
/**
|
|
745
|
+
* Selects the active anti-aliasing mode. The modes `'fxaa'` and `'smaa'` lazy-load their required modules.
|
|
746
|
+
* @param aaMode - The anti-aliasing mode to use.
|
|
747
|
+
*/
|
|
748
|
+
enableAaMode(aaMode: Cfg['post']['aa']['mode']): Promise<void>;
|
|
749
|
+
/**
|
|
750
|
+
* Enables or disables screen-space ambient occlusion. Passing `true` lazy-loads the required module.
|
|
751
|
+
* @param enable - Whether SSAO should be enabled.
|
|
752
|
+
*/
|
|
753
|
+
enableSsao(enable: boolean): Promise<void>;
|
|
754
|
+
/**
|
|
755
|
+
* Enables or disables screen-space reflections. In WebGL mode, the SSR pass also synchronizes the ground reflector and the optional selective reflection objects. When SSR is disabled, the reflector is detached from the pass and hidden. Passing `true` lazy-loads the required module.
|
|
756
|
+
* @param enable - Whether SSR should be enabled.
|
|
757
|
+
*/
|
|
758
|
+
enableSsr(enable: boolean): Promise<void>;
|
|
759
|
+
private getPostAuto;
|
|
760
|
+
private loadModel;
|
|
761
|
+
private pauseObjActions;
|
|
762
|
+
/**
|
|
763
|
+
* The method finds a Three.js animation clip by name, validates that it exists within the loaded GLTF and plays it via the `THREE.AnimationMixer`. It supports fade-in/out speed transitions, reverse playback,
|
|
764
|
+
* and infinite looping of the clip.
|
|
765
|
+
*
|
|
766
|
+
* @param params - Parameter object for controlling the animation playback.
|
|
767
|
+
* @param params.obj - The name of the object whose animation clip should be played.
|
|
768
|
+
* @param params.clip - The name of the animation clip to play.
|
|
769
|
+
* @param params.pauseActions - Defines which other actions of the same object should be paused before playing this clip. Default: **'all'**
|
|
770
|
+
* @param params.reverse - If `true`, plays the clip in reverse. Default: **false**
|
|
771
|
+
* @param params.infinite - If `true`, the animation loops infinitely. Default: **false**
|
|
772
|
+
* @param params.reset - If `true`, resets the clip to its start position before playback. In reverse mode, it resets to the clip end. Default: **false**
|
|
773
|
+
* @param params.startSpeed - The initial playback speed at the beginning of the fade. Default: **0**
|
|
774
|
+
* @param params.endSpeed - The target playback speed at the end of the fade. Default: **1**
|
|
775
|
+
* @param params.duration - The duration in seconds for the fade transition between start and end speed. Default: **0**
|
|
776
|
+
* @param params.ease - The easing function name for GSAP. Default: **'power1.inOut'**
|
|
777
|
+
|
|
778
|
+
* @remarks
|
|
779
|
+
* The method interpolates `timeScale` of the `THREE.AnimationAction`, allowing smooth acceleration or deceleration of animation playback.
|
|
780
|
+
*
|
|
781
|
+
* **Events**
|
|
782
|
+
*
|
|
783
|
+
* {@link ClipEvent}
|
|
784
|
+
*/
|
|
785
|
+
playClip({ obj, clip: clipName, pauseActions, reverse, infinite, reset, startSpeed, endSpeed, duration, ease }: {
|
|
786
|
+
obj: string;
|
|
787
|
+
clip: string;
|
|
788
|
+
singleAction?: boolean;
|
|
789
|
+
pauseActions?: PauseObjectActions;
|
|
790
|
+
reverse?: boolean;
|
|
791
|
+
infinite?: boolean;
|
|
792
|
+
reset?: boolean;
|
|
793
|
+
startSpeed?: number;
|
|
794
|
+
endSpeed?: number;
|
|
795
|
+
duration?: number;
|
|
796
|
+
ease?: string;
|
|
797
|
+
}): void;
|
|
798
|
+
/**
|
|
799
|
+
* The method finds a camera animation clip by name, validates that it exists within the loaded GLTF and plays it via the `THREE.AnimationMixer`. It supports fade-in/out speed transitions, reverse playback,
|
|
800
|
+
* and infinite looping of the clip.
|
|
801
|
+
*
|
|
802
|
+
* @param params - Parameter object for controlling the animation playback.
|
|
803
|
+
* @param params.obj - The name of the camera object whose animation clip should be played.
|
|
804
|
+
* @param params.clip - The name of the camera object's animation clip to play.
|
|
805
|
+
* @param params.pauseActions - Defines which other actions of the same object should be paused before playing this clip. Default: **'all'**
|
|
806
|
+
* @param params.reverse - If `true`, plays the clip in reverse. Default: **false**
|
|
807
|
+
* @param params.infinite - If `true`, the animation loops infinitely. Default: **false**
|
|
808
|
+
* @param params.reset - If `true`, resets the clip to its start position before playback. In reverse mode, it resets to the clip end. Default: **false**
|
|
809
|
+
* @param params.startSpeed - The initial playback speed at the beginning of the fade. Default: **0**
|
|
810
|
+
* @param params.endSpeed - The target playback speed at the end of the fade. Default: **1**
|
|
811
|
+
* @param params.duration - The duration in seconds for the fade transition between start and end speed. Default: **0**
|
|
812
|
+
* @param params.ease - The easing function name for GSAP. Default: **'power1.inOut'**
|
|
813
|
+
*
|
|
814
|
+
* @remarks
|
|
815
|
+
* The method interpolates `timeScale` of the `THREE.AnimationAction`, allowing smooth acceleration or deceleration of camera animation playback.
|
|
816
|
+
*
|
|
817
|
+
* **Events**
|
|
818
|
+
*
|
|
819
|
+
* {@link ClipEvent}
|
|
820
|
+
*/
|
|
821
|
+
playClipCam({ obj, clip: clipName, pauseActions, reverse, infinite, reset, startSpeed, endSpeed, duration, ease }: {
|
|
822
|
+
obj: string;
|
|
823
|
+
clip: string;
|
|
824
|
+
pauseActions?: PauseObjectActions;
|
|
825
|
+
reverse?: boolean;
|
|
826
|
+
infinite?: boolean;
|
|
827
|
+
reset?: boolean;
|
|
828
|
+
startSpeed?: number;
|
|
829
|
+
endSpeed?: number;
|
|
830
|
+
duration?: number;
|
|
831
|
+
ease?: string;
|
|
832
|
+
}): void;
|
|
833
|
+
/** 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. */
|
|
834
|
+
removeAmbientLight(): void;
|
|
835
|
+
/** The method removes the existing `THREE.Fog` from the scene. If no fog exists, the method exits without performing any action. */
|
|
836
|
+
removeFog(): void;
|
|
837
|
+
/** 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. */
|
|
838
|
+
removeHemisphereLight(): void;
|
|
839
|
+
/**
|
|
840
|
+
* Removes a previously registered frame update callback.
|
|
841
|
+
* @param {(deltaTime: number) => void} cb - Callback to remove.
|
|
842
|
+
*/
|
|
843
|
+
removeOnFrameUpdate(cb: (deltaTime: number) => void): void;
|
|
844
|
+
/**
|
|
845
|
+
* The method creates or updates a Three.js `THREE.AmbientLight` instance in the scene.
|
|
846
|
+
*
|
|
847
|
+
* @param params - Parameter object for controlling the ambient light.
|
|
848
|
+
* @param params.color - The ambient light color. If omitted and the light already exists, the current color remains unchanged.
|
|
849
|
+
* @param params.intensity - The ambient light intensity. If omitted and the light already exists, the current intensity remains unchanged.
|
|
850
|
+
*
|
|
851
|
+
* @remarks
|
|
852
|
+
* 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,
|
|
853
|
+
* the scene reflects changes automatically on the next render call.
|
|
854
|
+
*/
|
|
855
|
+
setAmbientLight({ color, intensity }: {
|
|
856
|
+
color?: THREE_TYPE.ColorRepresentation;
|
|
857
|
+
intensity?: number;
|
|
858
|
+
}): void;
|
|
859
|
+
private setAnimationLoop;
|
|
860
|
+
/**
|
|
861
|
+
* The method creates or updates a Three.js `THREE.Fog` instance in the scene.
|
|
862
|
+
*
|
|
863
|
+
* @param params - Parameter object for controlling the fog.
|
|
864
|
+
* @param params.color - The fog color. If omitted and the fog already exists, the current color remains unchanged.
|
|
865
|
+
* @param params.near - The near distance where fog starts. If omitted and the fog already exists, the current near value remains unchanged.
|
|
866
|
+
* @param params.far - The far distance where fog ends. If omitted and the fog already exists, the current far value remains unchanged.
|
|
867
|
+
*
|
|
868
|
+
* @remarks
|
|
869
|
+
* 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
|
|
870
|
+
* on the next render call.
|
|
871
|
+
*/
|
|
872
|
+
setFog({ color, near, far }: {
|
|
873
|
+
color?: THREE_TYPE.ColorRepresentation;
|
|
874
|
+
near?: number;
|
|
875
|
+
far?: number;
|
|
876
|
+
}): void;
|
|
877
|
+
/* Excluded from this release type: setFxaaResolution */
|
|
878
|
+
/**
|
|
879
|
+
* The method creates or updates a Three.js `THREE.HemisphereLight` instance in the scene.
|
|
880
|
+
*
|
|
881
|
+
* @param params - Parameter object for controlling the hemisphere light.
|
|
882
|
+
* @param params.skyColor - The sky light color. If omitted and the light already exists, the current sky color remains unchanged.
|
|
883
|
+
* @param params.groundColor - The ground light color. If omitted and the light already exists, the current ground color remains unchanged.
|
|
884
|
+
* @param params.intensity - The hemisphere light intensity. If omitted and the light already exists, the current intensity remains unchanged.
|
|
885
|
+
*
|
|
886
|
+
* @remarks
|
|
887
|
+
* 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
|
|
888
|
+
* reflects changes automatically on the next render call.
|
|
889
|
+
*/
|
|
890
|
+
setHemisphereLight({ skyColor, groundColor, intensity }: {
|
|
891
|
+
skyColor?: THREE_TYPE.ColorRepresentation;
|
|
892
|
+
groundColor?: THREE_TYPE.ColorRepresentation;
|
|
893
|
+
intensity?: number;
|
|
894
|
+
}): void;
|
|
895
|
+
/**
|
|
896
|
+
* 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
|
|
897
|
+
* texture paths (`map`, `emissiveMap`), which are automatically loaded via `THREE.TextureLoader`.
|
|
898
|
+
*
|
|
899
|
+
* @param params - Parameter object for setting material properties.
|
|
900
|
+
* @param params.obj - The name of the mesh whose material properties should be modified.
|
|
901
|
+
*
|
|
902
|
+
* @remarks
|
|
903
|
+
* 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
|
|
904
|
+
* 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.
|
|
905
|
+
*/
|
|
906
|
+
setMaterialProperties({ obj, ...props }: {
|
|
907
|
+
obj: string;
|
|
908
|
+
[key: string]: any;
|
|
909
|
+
}): void;
|
|
910
|
+
/* Excluded from this release type: setPostWebGl */
|
|
911
|
+
/* Excluded from this release type: setPostWebGpu */
|
|
912
|
+
/**
|
|
913
|
+
* 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
|
|
914
|
+
* GSAP before stopping the clip completely.
|
|
915
|
+
*
|
|
916
|
+
* @param params - Parameter object for controlling the stop behavior.
|
|
917
|
+
* @param params.clipName - The name of the animation clip to stop.
|
|
918
|
+
* @param params.fadeOut - The fade-out duration in seconds before stopping the clip. Default: **0**
|
|
919
|
+
* @param params.ease - The easing function name for the fade-out transition. Default: **'power1.inOut'**
|
|
920
|
+
*
|
|
921
|
+
* @remarks
|
|
922
|
+
* The method gradually reduces the clip's playback speed to zero when `fadeOut` is greater than zero, allowing a visually smooth stop. Once completed, a `ClipFade` event with type `CLIP_FADEOUT_COMPLETE`
|
|
923
|
+
* is emitted. If no fade-out is specified, the clip stops immediately.
|
|
924
|
+
*
|
|
925
|
+
* **Events**
|
|
926
|
+
*
|
|
927
|
+
* {@link ClipFadeEvent}
|
|
928
|
+
*/
|
|
929
|
+
stopAnimClip({ clipName, fadeOut, ease }: {
|
|
930
|
+
clipName: string;
|
|
931
|
+
fadeOut?: number;
|
|
932
|
+
ease?: string;
|
|
933
|
+
}): void;
|
|
934
|
+
/** Toggles the browser fullscreen mode for the associated canvas element. */
|
|
935
|
+
toggleFullscreen(): void;
|
|
936
|
+
/**
|
|
937
|
+
* Registers and executes a low-level extension function with access to the public `Engine` API.
|
|
938
|
+
* @param extension - Function that receives the current `Engine` instance and can use its public members and methods.
|
|
939
|
+
* @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.
|
|
940
|
+
*/
|
|
941
|
+
use(extension: (engine: Engine) => void): void;
|
|
942
|
+
private update;
|
|
943
|
+
/** 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. */
|
|
944
|
+
updateCanvasResize(): void;
|
|
945
|
+
}
|
|
946
|
+
|
|
947
|
+
/**
|
|
948
|
+
* This class controls and manages `THREE.Scene.environment` and `THREE.Scene.background` textures (HDRI, EXR, standard textures), including environment lighting and optional animated rotation.
|
|
949
|
+
* @category Core
|
|
950
|
+
*/
|
|
951
|
+
export declare class EnvCtrls {
|
|
952
|
+
private cfg;
|
|
953
|
+
private engine;
|
|
954
|
+
private modules;
|
|
955
|
+
/* Excluded from this release type: envReady */
|
|
956
|
+
/* Excluded from this release type: textureReady */
|
|
957
|
+
private envEnabled;
|
|
958
|
+
private envInit;
|
|
959
|
+
private envIntensity;
|
|
960
|
+
private bgIntensity;
|
|
961
|
+
private bgBlurriness;
|
|
962
|
+
private rotation;
|
|
963
|
+
private rotationSpeed;
|
|
964
|
+
private timeBgRot;
|
|
965
|
+
private callback;
|
|
966
|
+
/* Excluded from this release type: __constructor */
|
|
967
|
+
/* Excluded from this release type: init */
|
|
968
|
+
private applyEnv;
|
|
969
|
+
/**
|
|
970
|
+
* Enables the environment system. Loads an environment texture and applies it to `THREE.Scene.environment` and `THREE.Scene.background`.
|
|
971
|
+
|
|
972
|
+
* @param params - Optional environment loading parameters. If provided, both `type` and `map` are required.
|
|
973
|
+
* @param params.type - Environment map type. Defaults to `cfg.envCtrls.type`.
|
|
974
|
+
* @param params.map - Environment map path or URL. Defaults to `cfg.envCtrls.map`.
|
|
975
|
+
*/
|
|
976
|
+
enable(params?: {
|
|
977
|
+
type: EnvCtrlsCfg["type"];
|
|
978
|
+
map: EnvCtrlsCfg["map"];
|
|
979
|
+
}): void;
|
|
980
|
+
/** Disables the environment system and resets all values. */
|
|
981
|
+
disable(): void;
|
|
982
|
+
/** Returns the current environment controls parameters. */
|
|
983
|
+
get(): Partial<EnvCtrlsCfg>;
|
|
984
|
+
/**
|
|
985
|
+
* Returns whether the environment system is currently enabled.
|
|
986
|
+
* @returns `true` if `EnvCtrls` is currently enabled, otherwise `false`.
|
|
987
|
+
*/
|
|
988
|
+
isEnabled(): boolean;
|
|
989
|
+
private loadTexture;
|
|
990
|
+
/**
|
|
991
|
+
* Sets one or multiple environment control parameters at runtime.
|
|
992
|
+
* @param params - Object containing any subset of environment control parameters.
|
|
993
|
+
*/
|
|
994
|
+
set(params: Partial<EnvCtrlsCfg>): void;
|
|
995
|
+
private setEnv;
|
|
996
|
+
private startEnv;
|
|
997
|
+
private update;
|
|
998
|
+
}
|
|
999
|
+
|
|
1000
|
+
/** Defines the environment controls settings for `THREE.Scene.environment` and `THREE.Scene.background`.
|
|
1001
|
+
* @category Cfg
|
|
1002
|
+
*/
|
|
1003
|
+
export declare interface EnvCtrlsCfg {
|
|
1004
|
+
/**
|
|
1005
|
+
* Sets the blurriness of the background.
|
|
1006
|
+
* @default 0
|
|
1007
|
+
*/
|
|
1008
|
+
backgroundBlurriness: number;
|
|
1009
|
+
/**
|
|
1010
|
+
* Attenuates the color of the background.
|
|
1011
|
+
* @default 0
|
|
1012
|
+
*/
|
|
1013
|
+
backgroundIntensity: number;
|
|
1014
|
+
/**
|
|
1015
|
+
* Enables or disables environment and background map handling.
|
|
1016
|
+
* @default false
|
|
1017
|
+
*/
|
|
1018
|
+
enable: boolean;
|
|
1019
|
+
/**
|
|
1020
|
+
* Attenuates the color of the environment.
|
|
1021
|
+
* @default 1.8
|
|
1022
|
+
*/
|
|
1023
|
+
environmentIntensity: number;
|
|
1024
|
+
/**
|
|
1025
|
+
* Loads the EXR or HDR loader via dynamic import.
|
|
1026
|
+
* @default false
|
|
1027
|
+
*/
|
|
1028
|
+
load: boolean;
|
|
1029
|
+
/**
|
|
1030
|
+
* Path to the environment map.
|
|
1031
|
+
* @default ''
|
|
1032
|
+
*/
|
|
1033
|
+
map: string;
|
|
1034
|
+
/**
|
|
1035
|
+
* Environment and background rotation values in degrees.
|
|
1036
|
+
* @default { x: 0, y: 0, z: 0 }
|
|
1037
|
+
*/
|
|
1038
|
+
rotation: {
|
|
1039
|
+
x: number;
|
|
1040
|
+
y: number;
|
|
1041
|
+
z: number;
|
|
1042
|
+
};
|
|
1043
|
+
/**
|
|
1044
|
+
* Rotation speed of the environment and background map.
|
|
1045
|
+
* @default 0
|
|
1046
|
+
*/
|
|
1047
|
+
rotationSpeed: number;
|
|
1048
|
+
/**
|
|
1049
|
+
* Specifies the type of environment map file.
|
|
1050
|
+
* @default 'exr'
|
|
1051
|
+
*/
|
|
1052
|
+
type: 'hdr' | 'exr' | 'texture';
|
|
1053
|
+
}
|
|
1054
|
+
|
|
1055
|
+
/**
|
|
1056
|
+
* Internal event dispatcher for the engine.
|
|
1057
|
+
* @category Core
|
|
1058
|
+
*/
|
|
1059
|
+
export declare class Events {
|
|
1060
|
+
private cfg;
|
|
1061
|
+
private stateMachine;
|
|
1062
|
+
private eventQueue;
|
|
1063
|
+
private isProcessingEvents;
|
|
1064
|
+
/* Excluded from this release type: __constructor */
|
|
1065
|
+
/** Queues callbacks and processes them sequentially to prevent re-entrant or simultaneous access to send(). */
|
|
1066
|
+
private enqueue;
|
|
1067
|
+
/* Excluded from this release type: anim */
|
|
1068
|
+
/* Excluded from this release type: animFade */
|
|
1069
|
+
/* Excluded from this release type: clip */
|
|
1070
|
+
/* Excluded from this release type: clipFade */
|
|
1071
|
+
/* Excluded from this release type: modelError */
|
|
1072
|
+
/* Excluded from this release type: modelLoading */
|
|
1073
|
+
/**
|
|
1074
|
+
* Sends an event to the state machine and optionally logs a debug message to the console.
|
|
1075
|
+
* @param event - Any XState event object (must include a `type` property) to be dispatched to the actor.
|
|
1076
|
+
* @param log - Information to log with the event.
|
|
1077
|
+
*/
|
|
1078
|
+
send(event: AnyEventObject, log?: string): void;
|
|
1079
|
+
/* Excluded from this release type: windowResize */
|
|
1080
|
+
}
|
|
1081
|
+
|
|
1082
|
+
/** Defines the fog settings controlling scene depth-based color attenuation.
|
|
1083
|
+
* @category Cfg
|
|
1084
|
+
*/
|
|
1085
|
+
export declare interface FogCfg {
|
|
1086
|
+
/**
|
|
1087
|
+
* Activates fog in the scene.
|
|
1088
|
+
* @default false
|
|
1089
|
+
*/
|
|
1090
|
+
enable: boolean;
|
|
1091
|
+
/**
|
|
1092
|
+
* Fog color value.
|
|
1093
|
+
* @default 0x000000
|
|
1094
|
+
*/
|
|
1095
|
+
color: THREE_TYPE.ColorRepresentation;
|
|
1096
|
+
/**
|
|
1097
|
+
* Distance at which fog begins.
|
|
1098
|
+
* @default 0
|
|
1099
|
+
*/
|
|
1100
|
+
near: number;
|
|
1101
|
+
/**
|
|
1102
|
+
* Distance at which fog ends.
|
|
1103
|
+
* @default 100
|
|
1104
|
+
*/
|
|
1105
|
+
far: number;
|
|
1106
|
+
}
|
|
1107
|
+
|
|
1108
|
+
/**
|
|
1109
|
+
* This class integrates three.js PointerLockControls directly in the engine's render loop, supporting runtime updates and dynamic enabling/disabling.
|
|
1110
|
+
* @category Core
|
|
1111
|
+
*/
|
|
1112
|
+
export declare class FpvCtrls {
|
|
1113
|
+
private readonly cam3D;
|
|
1114
|
+
private readonly canvas;
|
|
1115
|
+
private readonly cfg;
|
|
1116
|
+
private readonly engine;
|
|
1117
|
+
private readonly events;
|
|
1118
|
+
private readonly modules;
|
|
1119
|
+
/* Excluded from this release type: pointerLockCtrls */
|
|
1120
|
+
private minPolarAngle;
|
|
1121
|
+
private maxPolarAngle;
|
|
1122
|
+
private pointerSpeed;
|
|
1123
|
+
private keyMoveForward;
|
|
1124
|
+
private keyMoveLeft;
|
|
1125
|
+
private keyMoveBackward;
|
|
1126
|
+
private keyMoveRight;
|
|
1127
|
+
private keyMoveUp;
|
|
1128
|
+
private keyMoveDown;
|
|
1129
|
+
private isMoveForward;
|
|
1130
|
+
private isMoveLeft;
|
|
1131
|
+
private isMoveBackward;
|
|
1132
|
+
private isMoveRight;
|
|
1133
|
+
private isMoveUp;
|
|
1134
|
+
private isMoveDown;
|
|
1135
|
+
private callback;
|
|
1136
|
+
private readonly onClick;
|
|
1137
|
+
private readonly onKeyDown;
|
|
1138
|
+
private readonly onKeyUp;
|
|
1139
|
+
/* Excluded from this release type: __constructor */
|
|
1140
|
+
/** Creates three.js `PointerLockControls`. */
|
|
1141
|
+
create(): void;
|
|
1142
|
+
/** Disables three.js `PointerLockControls`. */
|
|
1143
|
+
disable(): void;
|
|
1144
|
+
/** Enables three.js `PointerLockControls` for the current camera. */
|
|
1145
|
+
enable(): void;
|
|
1146
|
+
/** Disposes three.js `PointerLockControls` and cleans up their runtime resources. */
|
|
1147
|
+
dispose(): void;
|
|
1148
|
+
/** Returns the current three.js `PointerLockControls` configuration. */
|
|
1149
|
+
get(): Partial<FpvCtrlsCfg>;
|
|
1150
|
+
/** Returns whether three.js `PointerLockControls` are enabled. */
|
|
1151
|
+
isEnabled(): boolean;
|
|
1152
|
+
/** Returns whether three.js `PointerLockControls` are currently locked. */
|
|
1153
|
+
isLocked(): boolean;
|
|
1154
|
+
/** Locks three.js `PointerLockControls` and starts pointer-look interaction. */
|
|
1155
|
+
lock(): void;
|
|
1156
|
+
/**
|
|
1157
|
+
* Moves the controlled camera forward.
|
|
1158
|
+
* @param distance - Distance to move in world units.
|
|
1159
|
+
*/
|
|
1160
|
+
moveForward(distance: number): void;
|
|
1161
|
+
/**
|
|
1162
|
+
* Moves the controlled camera to the right.
|
|
1163
|
+
* @param distance - Distance to move in world units.
|
|
1164
|
+
*/
|
|
1165
|
+
moveRight(distance: number): void;
|
|
1166
|
+
/**
|
|
1167
|
+
* Moves the controlled camera up.
|
|
1168
|
+
* @param distance - Distance to move in world units.
|
|
1169
|
+
*/
|
|
1170
|
+
moveUp(distance: number): void;
|
|
1171
|
+
/**
|
|
1172
|
+
* Updates one or more three.js `PointerLockControls` properties. `FpvCtrls` must be enabled.
|
|
1173
|
+
* @param params - Object containing any subset of first-person control parameters.
|
|
1174
|
+
*/
|
|
1175
|
+
set(params: Partial<FpvCtrlsCfg>): void;
|
|
1176
|
+
/** Unlocks three.js `PointerLockControls` and stops pointer-look interaction. */
|
|
1177
|
+
unlock(): void;
|
|
1178
|
+
/**
|
|
1179
|
+
* Registers and executes a low-level extension function with access to the public `FpvCtrls` API.
|
|
1180
|
+
*
|
|
1181
|
+
* @param extension - Function that receives the current `FpvCtrls` instance and can use its public members and methods.
|
|
1182
|
+
*
|
|
1183
|
+
* @remarks
|
|
1184
|
+
* 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.
|
|
1185
|
+
*/
|
|
1186
|
+
use(extension: (fpvctrls: FpvCtrls) => void): void;
|
|
1187
|
+
}
|
|
1188
|
+
|
|
1189
|
+
/** Defines the First Person View Controls settings used to move and rotate the camera inside a scene.
|
|
1190
|
+
* @category Cfg
|
|
1191
|
+
*/
|
|
1192
|
+
export declare interface FpvCtrlsCfg {
|
|
1193
|
+
/**
|
|
1194
|
+
* Enables First Person View Controls.
|
|
1195
|
+
* @default false
|
|
1196
|
+
*/
|
|
1197
|
+
enable: boolean;
|
|
1198
|
+
/**
|
|
1199
|
+
* Loads First Person View Controls via dynamic import.
|
|
1200
|
+
* @default false
|
|
1201
|
+
*/
|
|
1202
|
+
load: boolean;
|
|
1203
|
+
/**
|
|
1204
|
+
* Minimum allowed vertical look angle in radians.
|
|
1205
|
+
* @default 0
|
|
1206
|
+
*/
|
|
1207
|
+
minPolarAngle: number;
|
|
1208
|
+
/**
|
|
1209
|
+
* Maximum allowed vertical look angle in radians.
|
|
1210
|
+
* @default Math.PI
|
|
1211
|
+
*/
|
|
1212
|
+
maxPolarAngle: number;
|
|
1213
|
+
/**
|
|
1214
|
+
* Speed factor for pointer movement.
|
|
1215
|
+
* @default 0.1
|
|
1216
|
+
*/
|
|
1217
|
+
pointerSpeed: number;
|
|
1218
|
+
/**
|
|
1219
|
+
* KeyboardEvent.code for moving forward.
|
|
1220
|
+
* @default 'KeyW'
|
|
1221
|
+
*/
|
|
1222
|
+
keyMoveForward: string;
|
|
1223
|
+
/**
|
|
1224
|
+
* KeyboardEvent.code for moving left.
|
|
1225
|
+
* @default 'KeyA'
|
|
1226
|
+
*/
|
|
1227
|
+
keyMoveLeft: string;
|
|
1228
|
+
/**
|
|
1229
|
+
* KeyboardEvent.code for moving backward.
|
|
1230
|
+
* @default 'KeyS'
|
|
1231
|
+
*/
|
|
1232
|
+
keyMoveBackward: string;
|
|
1233
|
+
/**
|
|
1234
|
+
* KeyboardEvent.code for moving right.
|
|
1235
|
+
* @default 'KeyD'
|
|
1236
|
+
*/
|
|
1237
|
+
keyMoveRight: string;
|
|
1238
|
+
/**
|
|
1239
|
+
* KeyboardEvent.code for moving up.
|
|
1240
|
+
* @default 'KeyQ'
|
|
1241
|
+
*/
|
|
1242
|
+
keyMoveUp: string;
|
|
1243
|
+
/**
|
|
1244
|
+
* KeyboardEvent.code for moving down.
|
|
1245
|
+
* @default 'KeyE'
|
|
1246
|
+
*/
|
|
1247
|
+
keyMoveDown: string;
|
|
1248
|
+
}
|
|
1249
|
+
|
|
1250
|
+
/** @event Fired when an `FpvCtrls` event occurs and triggers the corresponding XState event. */
|
|
1251
|
+
export declare interface FpvCtrlsEvent {
|
|
1252
|
+
/** Identifies this event type. */
|
|
1253
|
+
type: 'FPVCTRLS_DISABLED' | 'FPVCTRLS_ENABLED' | 'FPVCTRLS_LOCK' | 'FPVCTRLS_UNLOCK' | 'FPVCTRLS_DISABLED';
|
|
1254
|
+
}
|
|
1255
|
+
|
|
1256
|
+
/** Defines the FXAA anti-aliasing settings used to smooth jagged edges in the rendered image.
|
|
1257
|
+
* @category Cfg
|
|
1258
|
+
*/
|
|
1259
|
+
export declare interface FxaaCfg {
|
|
1260
|
+
/**
|
|
1261
|
+
* Controls the sharpness used in the FXAA shader.
|
|
1262
|
+
* @default 0.5
|
|
1263
|
+
*/
|
|
1264
|
+
sharpness: number;
|
|
1265
|
+
}
|
|
1266
|
+
|
|
1267
|
+
/** Defines the hemisphere light settings controlling ambient sky and ground illumination.
|
|
1268
|
+
* @category Cfg
|
|
1269
|
+
*/
|
|
1270
|
+
export declare interface HemisphereCfg {
|
|
1271
|
+
/**
|
|
1272
|
+
* Activates the hemisphere light in the scene.
|
|
1273
|
+
* @default false
|
|
1274
|
+
*/
|
|
1275
|
+
enable: boolean;
|
|
1276
|
+
/**
|
|
1277
|
+
* Light color from above.
|
|
1278
|
+
* @default 0xffffbb
|
|
1279
|
+
*/
|
|
1280
|
+
skyColor: THREE_TYPE.ColorRepresentation;
|
|
1281
|
+
/**
|
|
1282
|
+
* Light color from below.
|
|
1283
|
+
* @default 0x080820
|
|
1284
|
+
*/
|
|
1285
|
+
groundColor: THREE_TYPE.ColorRepresentation;
|
|
1286
|
+
/**
|
|
1287
|
+
* Intensity of the hemisphere light.
|
|
1288
|
+
* @default 1
|
|
1289
|
+
*/
|
|
1290
|
+
intensity: number;
|
|
1291
|
+
}
|
|
1292
|
+
|
|
1293
|
+
/**
|
|
1294
|
+
* The `Light3D` class represents a managed light source.
|
|
1295
|
+
* @category 3D Objects
|
|
1296
|
+
*/
|
|
1297
|
+
export declare class Light3D extends Obj3D {
|
|
1298
|
+
/**
|
|
1299
|
+
* The underlying `THREE.Light` object that defines illumination parameters and behavior. It can be replaced to represent various light types such as point, directional, or spot lights.
|
|
1300
|
+
* @default `THREE.PointLight`
|
|
1301
|
+
* @public
|
|
1302
|
+
*/
|
|
1303
|
+
obj: THREE_TYPE.Light;
|
|
1304
|
+
/* Excluded from this release type: __constructor */
|
|
1305
|
+
/**
|
|
1306
|
+
* Called for each traversed light during `.gltf` parsing. Stores the current `THREE.Light` in `this.obj`.
|
|
1307
|
+
*
|
|
1308
|
+
* @param objGltf - The currently traversed `THREE.Light`.
|
|
1309
|
+
* @public
|
|
1310
|
+
*
|
|
1311
|
+
* **Example**
|
|
1312
|
+
* {@includeCode ../../examples/light3D-spot.ts}
|
|
1313
|
+
*/
|
|
1314
|
+
protected onTraverse(objGltf: THREE_TYPE.Light): void;
|
|
1315
|
+
/* Excluded from this release type: traverse */
|
|
1316
|
+
}
|
|
1317
|
+
|
|
1318
|
+
/** Defines the light shadow settings used to configure shadow map resolution and shadow camera limits.
|
|
1319
|
+
* @category Cfg
|
|
1320
|
+
*/
|
|
1321
|
+
export declare interface LightCfg {
|
|
1322
|
+
/**
|
|
1323
|
+
* Shadow map resolution along the horizontal axis.
|
|
1324
|
+
* @default 2048
|
|
1325
|
+
*/
|
|
1326
|
+
mapWidth: number;
|
|
1327
|
+
/**
|
|
1328
|
+
* Shadow map resolution along the vertical axis.
|
|
1329
|
+
* @default 2048
|
|
1330
|
+
*/
|
|
1331
|
+
mapHeight: number;
|
|
1332
|
+
/**
|
|
1333
|
+
* Constant shadow bias applied to reduce shadow acne.
|
|
1334
|
+
* @default -0.00002
|
|
1335
|
+
*/
|
|
1336
|
+
bias: number;
|
|
1337
|
+
/**
|
|
1338
|
+
* Normal-based shadow bias to further reduce shadow artifacts.
|
|
1339
|
+
* @default 0.005
|
|
1340
|
+
*/
|
|
1341
|
+
normalBias: number;
|
|
1342
|
+
/**
|
|
1343
|
+
* Near clipping plane of the light's shadow camera.
|
|
1344
|
+
* @default 0.1
|
|
1345
|
+
*/
|
|
1346
|
+
near: number;
|
|
1347
|
+
/**
|
|
1348
|
+
* Far clipping plane of the light's shadow camera.
|
|
1349
|
+
* @default 5
|
|
1350
|
+
*/
|
|
1351
|
+
far: number;
|
|
1352
|
+
}
|
|
1353
|
+
|
|
1354
|
+
/** Defines the menu bar settings used to display licensed UI controls and branding.
|
|
1355
|
+
* @category Cfg
|
|
1356
|
+
*/
|
|
1357
|
+
export declare interface MenuBarCfg {
|
|
1358
|
+
/**
|
|
1359
|
+
* Enables or disables the menu bar.
|
|
1360
|
+
* @default true
|
|
1361
|
+
*/
|
|
1362
|
+
enable: boolean;
|
|
1363
|
+
/**
|
|
1364
|
+
* Background color of the menu bar.
|
|
1365
|
+
* @default '#F40B5780'
|
|
1366
|
+
*/
|
|
1367
|
+
backgroundColor: THREE_TYPE.ColorRepresentation;
|
|
1368
|
+
/**
|
|
1369
|
+
* Encoded SVG logo used as the menu bar's CSS background image.
|
|
1370
|
+
* @default ''
|
|
1371
|
+
*/
|
|
1372
|
+
logo: string;
|
|
1373
|
+
}
|
|
1374
|
+
|
|
1375
|
+
/**
|
|
1376
|
+
* Manages 3D meshes in illutions. Wraps a `THREE.Mesh` and provides support for scene integration and optional screen-space reflection (SSR) features.
|
|
1377
|
+
* @category 3D Objects
|
|
1378
|
+
*/
|
|
1379
|
+
export declare class Mesh3D extends Obj3D {
|
|
1380
|
+
/**
|
|
1381
|
+
* The underlying `THREE.Mesh` used for rendering. It can be replaced with a custom mesh that uses different geometry or material settings.
|
|
1382
|
+
* @default `THREE.BoxGeometry`, `THREE.MeshPhysicalMaterial`
|
|
1383
|
+
*/
|
|
1384
|
+
obj: THREE_TYPE.Mesh;
|
|
1385
|
+
/** `ReflectorForSSRPass` surface used for screen-space reflections (SSR). When set, it renders dynamic reflections on a ground plane. */
|
|
1386
|
+
groundReflector: ReflectorForSSRPass | null;
|
|
1387
|
+
/** Objects that participate in the screen-space reflection (SSR) effect. These objects are used for reflective rendering in the scene. */
|
|
1388
|
+
reflectivesSSR: THREE_TYPE.Object3D[];
|
|
1389
|
+
/* Excluded from this release type: __constructor */
|
|
1390
|
+
/**
|
|
1391
|
+
* Called for each traversed mesh during GLTF parsing. Stores the current `THREE.Mesh` in `this.obj`.
|
|
1392
|
+
* @param objGltf - The currently traversed mesh.
|
|
1393
|
+
* @public
|
|
1394
|
+
*
|
|
1395
|
+
* **Example**
|
|
1396
|
+
* {@includeCode ../../examples/mesh3D-cube.ts}
|
|
1397
|
+
*/
|
|
1398
|
+
protected onTraverse(objGltf: THREE_TYPE.Mesh): void;
|
|
1399
|
+
/* Excluded from this release type: setReflectivesSSR */
|
|
1400
|
+
/* Excluded from this release type: traverse */
|
|
1401
|
+
}
|
|
1402
|
+
|
|
1403
|
+
/** Defines the mesh-specific rendering settings used to control shadows and frustum culling.
|
|
1404
|
+
* @category Cfg
|
|
1405
|
+
*/
|
|
1406
|
+
export declare interface MeshCfg {
|
|
1407
|
+
/**
|
|
1408
|
+
* If `true`, the mesh will cast shadows.
|
|
1409
|
+
* @default true
|
|
1410
|
+
*/
|
|
1411
|
+
castShadow: boolean;
|
|
1412
|
+
/**
|
|
1413
|
+
* If `true`, the mesh will receive shadows cast by other objects.
|
|
1414
|
+
* @default true
|
|
1415
|
+
*/
|
|
1416
|
+
receiveShadow: boolean;
|
|
1417
|
+
/**
|
|
1418
|
+
* If `true`, the mesh will be culled when outside the camera's frustum.
|
|
1419
|
+
* @default false
|
|
1420
|
+
*/
|
|
1421
|
+
frustumCulled: boolean;
|
|
1422
|
+
}
|
|
1423
|
+
|
|
1424
|
+
/** Defines the GLTF/GLB model loading settings used to fetch models and configure optional Draco decoding.
|
|
1425
|
+
* @category Cfg
|
|
1426
|
+
*/
|
|
1427
|
+
export declare interface ModelCfg {
|
|
1428
|
+
compression: {
|
|
1429
|
+
/**
|
|
1430
|
+
* Mesh compression used by the GLTF/GLB file.
|
|
1431
|
+
* @default 'none'
|
|
1432
|
+
*/
|
|
1433
|
+
mesh: 'none' | 'draco' | 'meshopt';
|
|
1434
|
+
/**
|
|
1435
|
+
* Texture compression used by the GLTF/GLB file.
|
|
1436
|
+
* @default 'none'
|
|
1437
|
+
*/
|
|
1438
|
+
texture: 'none' | 'webp' | 'ktx2';
|
|
1439
|
+
};
|
|
1440
|
+
/**
|
|
1441
|
+
* The file path of your GLTF/GLB scene model. Set to `null` if no model should be loaded.
|
|
1442
|
+
* @default null
|
|
1443
|
+
*/
|
|
1444
|
+
file: string | null;
|
|
1445
|
+
/**
|
|
1446
|
+
* Public path to the Draco decoder files.
|
|
1447
|
+
* @default '/draco/'
|
|
1448
|
+
*/
|
|
1449
|
+
decoderPath: string;
|
|
1450
|
+
/**
|
|
1451
|
+
* Shows a loading progress bar while the model is being fetched.
|
|
1452
|
+
* @default true
|
|
1453
|
+
*/
|
|
1454
|
+
progressBar: boolean;
|
|
1455
|
+
}
|
|
1456
|
+
|
|
1457
|
+
/** @event Fired when an error occurs while loading model assets and triggers the corresponding XState event. */
|
|
1458
|
+
export declare interface ModelErrorEvent {
|
|
1459
|
+
/** Identifies this event type. */
|
|
1460
|
+
type: 'MODEL_ERROR';
|
|
1461
|
+
/** The caught error object. */
|
|
1462
|
+
error: Error;
|
|
1463
|
+
}
|
|
1464
|
+
|
|
1465
|
+
/** @event Fired while model assets are loading and triggers the corresponding XState event. */
|
|
1466
|
+
export declare interface ModelLoadingEvent {
|
|
1467
|
+
/** Identifies this event type. */
|
|
1468
|
+
type: 'MODEL_LOADING';
|
|
1469
|
+
/** Loading progress in percent (0-100). */
|
|
1470
|
+
loading: number;
|
|
1471
|
+
}
|
|
1472
|
+
|
|
1473
|
+
declare class Modules {
|
|
1474
|
+
gpuTier: any;
|
|
1475
|
+
fxaaNode: any;
|
|
1476
|
+
fxaaShader: any;
|
|
1477
|
+
smaaPassClass: any;
|
|
1478
|
+
smaaNode: any;
|
|
1479
|
+
ssaoPassClass: any;
|
|
1480
|
+
gtaoNodeClass: any;
|
|
1481
|
+
ssrNode: any;
|
|
1482
|
+
ssrPassClass: any;
|
|
1483
|
+
paneClass: any;
|
|
1484
|
+
createBrowserInspector: any;
|
|
1485
|
+
effectComposerClass: typeof EffectComposer | null;
|
|
1486
|
+
envLoader: EXRLoader | HDRLoader | null;
|
|
1487
|
+
dracoLoader: DRACOLoader | null;
|
|
1488
|
+
gltfLoader: GLTFLoader | null;
|
|
1489
|
+
ktx2Loader: KTX2Loader | null;
|
|
1490
|
+
meshoptDecoder: typeof MeshoptDecoder | null;
|
|
1491
|
+
outputPassClass: typeof OutputPass | null;
|
|
1492
|
+
renderPassClass: typeof RenderPass | null;
|
|
1493
|
+
shaderPassClass: typeof ShaderPass | null;
|
|
1494
|
+
orbitControlsClass: typeof OrbitControls | null;
|
|
1495
|
+
pointerLockControlsClass: typeof PointerLockControls | null;
|
|
1496
|
+
webGpuRendererClass: typeof THREE_WEBGPU_TYPE.WebGPURenderer | null;
|
|
1497
|
+
renderPipelineClass: typeof THREE_WEBGPU_TYPE.RenderPipeline | null;
|
|
1498
|
+
tslPass: typeof THREE_WEBTSL_TYPE.pass | null;
|
|
1499
|
+
tslMrt: typeof THREE_WEBTSL_TYPE.mrt | null;
|
|
1500
|
+
tslOutput: typeof THREE_WEBTSL_TYPE.output | null;
|
|
1501
|
+
tslNormalView: typeof THREE_WEBTSL_TYPE.normalView | null;
|
|
1502
|
+
tslMetalness: typeof THREE_WEBTSL_TYPE.metalness | null;
|
|
1503
|
+
tslRoughness: typeof THREE_WEBTSL_TYPE.roughness | null;
|
|
1504
|
+
tslSample: typeof THREE_WEBTSL_TYPE.sample | null;
|
|
1505
|
+
tslVec2: typeof THREE_WEBTSL_TYPE.vec2 | null;
|
|
1506
|
+
tslVec3: typeof THREE_WEBTSL_TYPE.vec3 | null;
|
|
1507
|
+
tslVec4: typeof THREE_WEBTSL_TYPE.vec4 | null;
|
|
1508
|
+
tslFloat: typeof THREE_WEBTSL_TYPE.float | null;
|
|
1509
|
+
tslDirectionToColor: typeof THREE_WEBTSL_TYPE.directionToColor | null;
|
|
1510
|
+
tslColorToDirection: typeof THREE_WEBTSL_TYPE.colorToDirection | null;
|
|
1511
|
+
private cfg;
|
|
1512
|
+
constructor(cfg: Cfg);
|
|
1513
|
+
private consoleLog;
|
|
1514
|
+
importDracoLoader(): Promise<void>;
|
|
1515
|
+
importEffectComposer(): Promise<void>;
|
|
1516
|
+
importENVLoader(): Promise<void>;
|
|
1517
|
+
importFpvCtrls(): Promise<void>;
|
|
1518
|
+
importFXAANode(aaMode: Cfg['post']['aa']['mode']): Promise<void>;
|
|
1519
|
+
importFXAAShader(aaMode: Cfg['post']['aa']['mode']): Promise<void>;
|
|
1520
|
+
importGLTFLoader(): Promise<void>;
|
|
1521
|
+
importGpuDetect(): Promise<void>;
|
|
1522
|
+
importGtaoNode(enable: boolean): Promise<void>;
|
|
1523
|
+
importKTX2Loader(): Promise<void>;
|
|
1524
|
+
importMeshoptDecoder(): Promise<void>;
|
|
1525
|
+
importOrbitCtrls(): Promise<void>;
|
|
1526
|
+
importOutputPass(): Promise<void>;
|
|
1527
|
+
importRenderPass(): Promise<void>;
|
|
1528
|
+
importSMAANode(aaMode: Cfg['post']['aa']['mode']): Promise<void>;
|
|
1529
|
+
importSMAAPass(aaMode: Cfg['post']['aa']['mode']): Promise<void>;
|
|
1530
|
+
importSSAOPass(enable: boolean): Promise<void>;
|
|
1531
|
+
importSsrNode(enable: boolean): Promise<void>;
|
|
1532
|
+
importSsrPass(enable: boolean): Promise<void>;
|
|
1533
|
+
importStatelyAi(): Promise<void>;
|
|
1534
|
+
importThreeTsl(): Promise<void>;
|
|
1535
|
+
importThreeWebGpu(): Promise<void>;
|
|
1536
|
+
importTweakpane(): Promise<void>;
|
|
1537
|
+
}
|
|
1538
|
+
|
|
1539
|
+
/**
|
|
1540
|
+
* Wraps a `THREE.Object3D` and provides lifecycle hooks, scene integration, animation support, and position-change events. Extend this class to implement custom object behavior.
|
|
1541
|
+
* @category 3D Objects
|
|
1542
|
+
*/
|
|
1543
|
+
export declare class Obj3D {
|
|
1544
|
+
/** @public */
|
|
1545
|
+
protected canvas: HTMLElement;
|
|
1546
|
+
protected cfg: Cfg;
|
|
1547
|
+
/** @public */
|
|
1548
|
+
protected readonly cfgCtrl: Readonly<CfgCtrl>;
|
|
1549
|
+
/* Excluded from this release type: events */
|
|
1550
|
+
protected name: string;
|
|
1551
|
+
/** The managed `THREE.Object3D` instance for this object. It is `null` until a scene object is assigned. */
|
|
1552
|
+
obj: THREE_TYPE.Object3D | null;
|
|
1553
|
+
/** @public */
|
|
1554
|
+
protected objs3D: Map<string, Obj3D> | null;
|
|
1555
|
+
/* Excluded from this release type: raycast */
|
|
1556
|
+
/**
|
|
1557
|
+
* The active Three.js renderer used by this object. It is exposed for advanced use cases that require renderer-dependent Three.js APIs, such as reading the canvas size, pixel ratio, drawing buffer size, or updating renderer-based helper objects like cube cameras.
|
|
1558
|
+
* @public
|
|
1559
|
+
*/
|
|
1560
|
+
protected renderer: Readonly<THREE_TYPE.WebGLRenderer> | Readonly<THREE_WEBGPU_TYPE.WebGPURenderer>;
|
|
1561
|
+
/**
|
|
1562
|
+
* The `THREE.Scene` instance this object belongs to.
|
|
1563
|
+
* @public
|
|
1564
|
+
*/
|
|
1565
|
+
protected scene: Readonly<THREE_TYPE.Scene>;
|
|
1566
|
+
/** Whether occlusion checking is enabled for this object. Default: **false** */
|
|
1567
|
+
enableOcclusionCheck: boolean;
|
|
1568
|
+
private readonly eventDispatcher;
|
|
1569
|
+
private posScreen;
|
|
1570
|
+
private posScreenLast;
|
|
1571
|
+
private posWorld;
|
|
1572
|
+
private posWorldLast;
|
|
1573
|
+
private visible;
|
|
1574
|
+
private visibleFrustum;
|
|
1575
|
+
private visibleLast;
|
|
1576
|
+
/* Excluded from this release type: visibleOcclusion */
|
|
1577
|
+
/* Excluded from this release type: __constructor */
|
|
1578
|
+
/**
|
|
1579
|
+
* Registers a listener that is called whenever the specified event occurs.
|
|
1580
|
+
* @param type - The event type to listen for.
|
|
1581
|
+
* @param listener - Callback invoked when the event occurs.
|
|
1582
|
+
* @returns A function that unsubscribes the listener.
|
|
1583
|
+
*/
|
|
1584
|
+
addEventListener<TType extends Obj3DEvent['type']>(type: TType, listener: (event: Extract<Obj3DEvent, {
|
|
1585
|
+
type: TType;
|
|
1586
|
+
}>) => void): Unsubscribe;
|
|
1587
|
+
private calcScreenPos;
|
|
1588
|
+
protected checkWorldAndScreenPos(cam3D: Cam3D, obj: THREE_TYPE.Object3D): void;
|
|
1589
|
+
protected checkVisible(): void;
|
|
1590
|
+
/* Excluded from this release type: emitEvent */
|
|
1591
|
+
/**
|
|
1592
|
+
* Returns the object's screen position in canvas coordinates.
|
|
1593
|
+
* @param cam3D - Camera used for projection to canvas coordinates.
|
|
1594
|
+
* @returns The projected screen position in canvas coordinates, or `null` if no `THREE.Object3D` is assigned.
|
|
1595
|
+
*/
|
|
1596
|
+
getScreenPosition(cam3D: Cam3D): {
|
|
1597
|
+
x: number;
|
|
1598
|
+
y: number;
|
|
1599
|
+
} | null;
|
|
1600
|
+
private isVisibleFrustum;
|
|
1601
|
+
/**
|
|
1602
|
+
* 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.
|
|
1603
|
+
* @public
|
|
1604
|
+
*/
|
|
1605
|
+
protected onReady(): void;
|
|
1606
|
+
/**
|
|
1607
|
+
* Called once after the `THREE.Scene` is initialized, before an existing GLTF model is loaded.
|
|
1608
|
+
* @public
|
|
1609
|
+
*/
|
|
1610
|
+
protected onStart(): void;
|
|
1611
|
+
/**
|
|
1612
|
+
* Called once for each traversed child during GLTF parsing. Stores the currently traversed `THREE.Object3D` instance in `this.obj`.
|
|
1613
|
+
* @param objGltf - The traversed `THREE.Object3D` instance.
|
|
1614
|
+
* @public
|
|
1615
|
+
*/
|
|
1616
|
+
protected onTraverse(objGltf: THREE_TYPE.Object3D): void;
|
|
1617
|
+
/**
|
|
1618
|
+
* Called on every animation frame update.
|
|
1619
|
+
* @param deltaTime - Time elapsed since the previous frame in seconds.
|
|
1620
|
+
* @public
|
|
1621
|
+
*/
|
|
1622
|
+
protected onUpdate(deltaTime: number): void;
|
|
1623
|
+
/* Excluded from this release type: ready */
|
|
1624
|
+
/**
|
|
1625
|
+
* Removes a previously registered listener for the specified event.
|
|
1626
|
+
* @param type - The event type to remove the listener from.
|
|
1627
|
+
* @param listener - Callback to remove from the event listeners.
|
|
1628
|
+
*/
|
|
1629
|
+
removeEventListener<TType extends Obj3DEvent['type']>(type: TType, listener: (event: Extract<Obj3DEvent, {
|
|
1630
|
+
type: TType;
|
|
1631
|
+
}>) => void): void;
|
|
1632
|
+
private resetEventStateIfNoListeners;
|
|
1633
|
+
/* Excluded from this release type: start */
|
|
1634
|
+
/* Excluded from this release type: traverse */
|
|
1635
|
+
/* Excluded from this release type: update */
|
|
1636
|
+
}
|
|
1637
|
+
|
|
1638
|
+
/** Constructor type for `Obj3D` classes. */
|
|
1639
|
+
export declare type Obj3DClass = new (canvas: HTMLElement, cfg: Cfg, cfgCtrl: CfgCtrl, name: string) => Objs3D;
|
|
1640
|
+
|
|
1641
|
+
/** Defines all event types supported by `Obj3D.addEventListener`. */
|
|
1642
|
+
export declare type Obj3DEvent = Obj3DPosWorldEvent | Obj3DPosScreenEvent | Obj3DVisibleEvent | Obj3DPointerEvent;
|
|
1643
|
+
|
|
1644
|
+
/**
|
|
1645
|
+
* Maps a record of Obj3D classes to a record of typed object instances.
|
|
1646
|
+
* `{ key1: typeof Obj3D1 } -> { key1: Obj3D1 }`
|
|
1647
|
+
* @hidden
|
|
1648
|
+
*/
|
|
1649
|
+
export declare type Obj3DInsts<T extends Record<string, Obj3DClass>> = {
|
|
1650
|
+
[K in keyof T]: InstanceType<T[K]>;
|
|
1651
|
+
};
|
|
1652
|
+
|
|
1653
|
+
/** @event Fired when the user uses the pointer on an active object and triggers the corresponding XState event. */
|
|
1654
|
+
export declare interface Obj3DPointerEvent {
|
|
1655
|
+
/** Identifies this event type. */
|
|
1656
|
+
type: 'OBJ3D_CLICK' | 'OBJ3D_POINTER_ENTER' | 'OBJ3D_POINTER_DOWN' | 'OBJ3D_POINTER_LEAVE' | 'OBJ3D_POINTER_MOVE' | 'OBJ3D_POINTER_UP';
|
|
1657
|
+
/** Native pointer event from the active object interaction. */
|
|
1658
|
+
event: PointerEvent;
|
|
1659
|
+
/** The name of the object whose selected state changed. */
|
|
1660
|
+
objName: string;
|
|
1661
|
+
}
|
|
1662
|
+
|
|
1663
|
+
/** @event Fired when the screen position of a 3D object changes and triggers the corresponding XState event. */
|
|
1664
|
+
export declare interface Obj3DPosScreenEvent {
|
|
1665
|
+
/** Identifies this event type. */
|
|
1666
|
+
type: 'OBJ3D_POS_SCREEN_CHANGED';
|
|
1667
|
+
/** The object's position projected into screen space. */
|
|
1668
|
+
posScreen: THREE_TYPE.Vector2;
|
|
1669
|
+
}
|
|
1670
|
+
|
|
1671
|
+
/** @event Fired when the world position of a 3D object changes and triggers the corresponding XState event. */
|
|
1672
|
+
export declare interface Obj3DPosWorldEvent {
|
|
1673
|
+
/** Identifies this event type. */
|
|
1674
|
+
type: 'OBJ3D_POS_WORLD_CHANGED';
|
|
1675
|
+
/** The object's position in world coordinates. */
|
|
1676
|
+
posWorld: THREE_TYPE.Vector3;
|
|
1677
|
+
}
|
|
1678
|
+
|
|
1679
|
+
/** @event Fired when the world or screen rotation of a 3D object changes and triggers the corresponding XState event. */
|
|
1680
|
+
export declare interface Obj3DRotWorldEvent {
|
|
1681
|
+
/** Identifies this event type. */
|
|
1682
|
+
type: 'OBJ3D_ROT_WORLD_CHANGED';
|
|
1683
|
+
/** The object's rotation in world coordinates. */
|
|
1684
|
+
rotWorld: THREE_TYPE.Euler;
|
|
1685
|
+
/** The object's rotation projected into screen space. */
|
|
1686
|
+
rotScreen: THREE_TYPE.Euler;
|
|
1687
|
+
}
|
|
1688
|
+
|
|
1689
|
+
/** @event Fired when the visibility of a 3D object changes and triggers the corresponding XState event. */
|
|
1690
|
+
export declare interface Obj3DVisibleEvent {
|
|
1691
|
+
/** Identifies this event type. */
|
|
1692
|
+
type: 'OBJ3D_VISIBLE_CHANGED';
|
|
1693
|
+
/** The object's visibility status. */
|
|
1694
|
+
visible: boolean;
|
|
1695
|
+
}
|
|
1696
|
+
|
|
1697
|
+
export declare type Objs3D = Cam3D | Light3D | Mesh3D | Obj3D;
|
|
1698
|
+
|
|
1699
|
+
/**
|
|
1700
|
+
* Integrates three.js OrbitControls directly in the engine's render loop, supporting runtime updates and dynamic enabling/disabling.
|
|
1701
|
+
* @category Core
|
|
1702
|
+
*/
|
|
1703
|
+
export declare class OrbitCtrls {
|
|
1704
|
+
private readonly cam3D;
|
|
1705
|
+
private readonly canvas;
|
|
1706
|
+
private readonly cfg;
|
|
1707
|
+
private readonly engine;
|
|
1708
|
+
private readonly events;
|
|
1709
|
+
private readonly modules;
|
|
1710
|
+
orbitControls: OrbitControls_2 | null;
|
|
1711
|
+
private enableDamping;
|
|
1712
|
+
private dampingFactor;
|
|
1713
|
+
private minDistance;
|
|
1714
|
+
private maxDistance;
|
|
1715
|
+
private enableZoom;
|
|
1716
|
+
private zoomSpeed;
|
|
1717
|
+
private enableRotate;
|
|
1718
|
+
private rotateSpeed;
|
|
1719
|
+
private enablePan;
|
|
1720
|
+
private panSpeed;
|
|
1721
|
+
private autoRotate;
|
|
1722
|
+
private autoRotateSpeed;
|
|
1723
|
+
private minPolarAngle;
|
|
1724
|
+
private maxPolarAngle;
|
|
1725
|
+
private orbitCtrlsFirstChange;
|
|
1726
|
+
private callback;
|
|
1727
|
+
private listenerPointersStart;
|
|
1728
|
+
private listenerPointersEnd;
|
|
1729
|
+
private readonly touchPointerIds;
|
|
1730
|
+
/* Excluded from this release type: __constructor */
|
|
1731
|
+
/** Creates three.js `OrbitControls`. */
|
|
1732
|
+
create(): void;
|
|
1733
|
+
/** Disables three.js `OrbitControls` and cleans up the event listeners. */
|
|
1734
|
+
disable(): void;
|
|
1735
|
+
/** Enables three.js `OrbitControls` for the current camera. */
|
|
1736
|
+
enable(): void;
|
|
1737
|
+
/** Disposes three.js `OrbitControls` and removes them from the render loop. */
|
|
1738
|
+
dispose(): void;
|
|
1739
|
+
/**
|
|
1740
|
+
* Returns whether three.js `OrbitControls` are currently enabled.
|
|
1741
|
+
* @returns `true` if `OrbitControls` are currently enabled; otherwise, `false`.
|
|
1742
|
+
*/
|
|
1743
|
+
isEnabled(): boolean;
|
|
1744
|
+
/**
|
|
1745
|
+
* Updates one or more three.js `OrbitControls` properties. `OrbitCtrls` must be enabled.
|
|
1746
|
+
* @param params - Object containing any subset of orbit control parameters.
|
|
1747
|
+
*/
|
|
1748
|
+
set(params: Partial<OrbitCtrlsCfg>): void;
|
|
1749
|
+
/** Returns the current three.js `OrbitControls` configuration. */
|
|
1750
|
+
get(): Partial<OrbitCtrlsCfg>;
|
|
1751
|
+
/**
|
|
1752
|
+
* Registers and executes a low-level extension function with access to the public `OrbitCtrls` API.
|
|
1753
|
+
*
|
|
1754
|
+
* @param extension - Function that receives the current `OrbitCtrls` instance and can use its public members and methods.
|
|
1755
|
+
*
|
|
1756
|
+
* @remarks
|
|
1757
|
+
* This method is intended for advanced custom integrations where developers need direct access to the engine instance.
|
|
1758
|
+
* The extension is executed once immediately when `use()` is called.
|
|
1759
|
+
*/
|
|
1760
|
+
use(extension: (orbitCtrls: OrbitCtrls) => void): void;
|
|
1761
|
+
private updatePointersEnd;
|
|
1762
|
+
private updatePointersStart;
|
|
1763
|
+
}
|
|
1764
|
+
|
|
1765
|
+
/** Defines the Orbit Controls settings used to rotate, pan, zoom and constrain the camera around a target.
|
|
1766
|
+
* @category Cfg
|
|
1767
|
+
*/
|
|
1768
|
+
export declare interface OrbitCtrlsCfg {
|
|
1769
|
+
/**
|
|
1770
|
+
* Enables automatic camera rotation.
|
|
1771
|
+
* @default false
|
|
1772
|
+
*/
|
|
1773
|
+
autoRotate: boolean;
|
|
1774
|
+
/**
|
|
1775
|
+
* Rotation speed of automatic rotation.
|
|
1776
|
+
* @default 2.0
|
|
1777
|
+
*/
|
|
1778
|
+
autoRotateSpeed: number;
|
|
1779
|
+
/**
|
|
1780
|
+
* Amount of damping applied per frame.
|
|
1781
|
+
* @default 0.1
|
|
1782
|
+
*/
|
|
1783
|
+
dampingFactor: number;
|
|
1784
|
+
/**
|
|
1785
|
+
* Enables OrbitControls.
|
|
1786
|
+
* @default false
|
|
1787
|
+
*/
|
|
1788
|
+
enable: boolean;
|
|
1789
|
+
/**
|
|
1790
|
+
* Enables smooth inertia-like camera movement.
|
|
1791
|
+
* @default false
|
|
1792
|
+
*/
|
|
1793
|
+
enableDamping: boolean;
|
|
1794
|
+
/**
|
|
1795
|
+
* Enables or disables camera panning.
|
|
1796
|
+
* @default true
|
|
1797
|
+
*/
|
|
1798
|
+
enablePan: boolean;
|
|
1799
|
+
/**
|
|
1800
|
+
* Enables or disables camera rotation.
|
|
1801
|
+
* @default true
|
|
1802
|
+
*/
|
|
1803
|
+
enableRotate: boolean;
|
|
1804
|
+
/**
|
|
1805
|
+
* Enables or disables zoom interaction.
|
|
1806
|
+
* @default true
|
|
1807
|
+
*/
|
|
1808
|
+
enableZoom: boolean;
|
|
1809
|
+
/**
|
|
1810
|
+
* Loads OrbitControls via dynamic import.
|
|
1811
|
+
* @default false
|
|
1812
|
+
*/
|
|
1813
|
+
load: boolean;
|
|
1814
|
+
/**
|
|
1815
|
+
* Maximum allowed distance between the camera and the target.
|
|
1816
|
+
* @default Infinity
|
|
1817
|
+
*/
|
|
1818
|
+
maxDistance: number;
|
|
1819
|
+
/**
|
|
1820
|
+
* Maximum allowed vertical orbit angle in degrees.
|
|
1821
|
+
* @default 180
|
|
1822
|
+
*/
|
|
1823
|
+
maxPolarAngle: number;
|
|
1824
|
+
/**
|
|
1825
|
+
* Minimum allowed distance between the camera and the target.
|
|
1826
|
+
* @default 0
|
|
1827
|
+
*/
|
|
1828
|
+
minDistance: number;
|
|
1829
|
+
/**
|
|
1830
|
+
* Minimum allowed vertical orbit angle in degrees.
|
|
1831
|
+
* @default 0
|
|
1832
|
+
*/
|
|
1833
|
+
minPolarAngle: number;
|
|
1834
|
+
/**
|
|
1835
|
+
* Speed factor for panning movement.
|
|
1836
|
+
* @default 1.0
|
|
1837
|
+
*/
|
|
1838
|
+
panSpeed: number;
|
|
1839
|
+
/**
|
|
1840
|
+
* Speed factor for camera rotation.
|
|
1841
|
+
* @default 1.0
|
|
1842
|
+
*/
|
|
1843
|
+
rotateSpeed: number;
|
|
1844
|
+
/**
|
|
1845
|
+
* Speed factor for zooming.
|
|
1846
|
+
* @default 1.0
|
|
1847
|
+
*/
|
|
1848
|
+
zoomSpeed: number;
|
|
1849
|
+
}
|
|
1850
|
+
|
|
1851
|
+
/** @event Fired when an OrbitControls event occurs and triggers the corresponding XState event. */
|
|
1852
|
+
export declare interface OrbitCtrlsEvent {
|
|
1853
|
+
/** Identifies this event type. */
|
|
1854
|
+
type: 'ORBITCTRLS_CHANGED' | 'ORBITCTRLS_DISABLED' | 'ORBITCTRLS_ENABLED' | 'ORBITCTRLS_END' | 'ORBITCTRLS_START' | 'ORBITCTRLS_DISPOSED';
|
|
1855
|
+
}
|
|
1856
|
+
|
|
1857
|
+
/**
|
|
1858
|
+
* Defines which existing animation actions of the same object should be paused before a new clip is played.
|
|
1859
|
+
* - `'all'`: Pauses all actions of the object.
|
|
1860
|
+
* - `'finished'`: Pauses only actions of the object that are no longer active.
|
|
1861
|
+
* - `'last'`: Pauses only the last matching action of the object.
|
|
1862
|
+
* - `'none'`: Pauses no actions.
|
|
1863
|
+
*/
|
|
1864
|
+
export declare type PauseObjectActions = 'all' | 'finished' | 'last' | 'none';
|
|
1865
|
+
|
|
1866
|
+
/** Defines the post-processing settings used by the rendering pipeline.
|
|
1867
|
+
* @category Cfg
|
|
1868
|
+
*/
|
|
1869
|
+
export declare interface PostCfg {
|
|
1870
|
+
/**
|
|
1871
|
+
* Enables GPU-based auto activation for post-processing.
|
|
1872
|
+
* @default true
|
|
1873
|
+
*/
|
|
1874
|
+
auto: boolean;
|
|
1875
|
+
/**
|
|
1876
|
+
* Whether the GUI post-processing dropdown is open.
|
|
1877
|
+
* @default false
|
|
1878
|
+
*/
|
|
1879
|
+
guiOpened: boolean;
|
|
1880
|
+
/** Anti-aliasing settings. */
|
|
1881
|
+
aa: aaCfg;
|
|
1882
|
+
/** Shared SSAO settings. */
|
|
1883
|
+
ssao: SsaoCfg;
|
|
1884
|
+
/** Shared SSR settings. */
|
|
1885
|
+
ssr: SsrCfg;
|
|
1886
|
+
/** WebGL post-processing settings. */
|
|
1887
|
+
webgl: {
|
|
1888
|
+
/** WebGL anti-aliasing settings. */
|
|
1889
|
+
aa: {
|
|
1890
|
+
/** WebGL FXAA settings. */
|
|
1891
|
+
fxaa: FxaaCfg;
|
|
1892
|
+
};
|
|
1893
|
+
/** WebGL SSAO settings. */
|
|
1894
|
+
ssao: SsaoWebGlCfg;
|
|
1895
|
+
/** WebGL SSR settings. */
|
|
1896
|
+
ssr: SsrWebGlCfg;
|
|
1897
|
+
};
|
|
1898
|
+
/** WebGPU post-processing settings. */
|
|
1899
|
+
webgpu: {
|
|
1900
|
+
/** WebGPU SSAO settings. */
|
|
1901
|
+
ssao: SsaoWebGpuCfg;
|
|
1902
|
+
/** WebGPU SSR settings. */
|
|
1903
|
+
ssr: SsrWebGpuCfg;
|
|
1904
|
+
};
|
|
1905
|
+
}
|
|
1906
|
+
|
|
1907
|
+
/**
|
|
1908
|
+
* The Raycast class manages pointer-based raycasting in a `THREE.Scene`. It tracks specified objects, detects cursor intersections with them, and triggers intersection and non-intersection events via
|
|
1909
|
+
* the application state. The class dynamically enables or disables pointer listeners depending on the number of tracked objects. It also handles pointer events (click, down, up, move, enter, leave) for the
|
|
1910
|
+
* intersected 3D objects.
|
|
1911
|
+
* @category Core
|
|
1912
|
+
*/
|
|
1913
|
+
export declare class Raycast {
|
|
1914
|
+
private readonly cam3D;
|
|
1915
|
+
private readonly canvas;
|
|
1916
|
+
private readonly cfg;
|
|
1917
|
+
private readonly engine;
|
|
1918
|
+
private readonly events;
|
|
1919
|
+
private readonly objs3D;
|
|
1920
|
+
private raycasterSelect;
|
|
1921
|
+
private raycasterVisible;
|
|
1922
|
+
private objsSelectTracked;
|
|
1923
|
+
private objActive;
|
|
1924
|
+
private objCandidate;
|
|
1925
|
+
private closestObjCounter;
|
|
1926
|
+
private isEnabled;
|
|
1927
|
+
private callbackSelect;
|
|
1928
|
+
private listenerClick;
|
|
1929
|
+
private listenerDown;
|
|
1930
|
+
private listenerMove;
|
|
1931
|
+
private listenerUp;
|
|
1932
|
+
private pointerEvent;
|
|
1933
|
+
private posPrevPointerX;
|
|
1934
|
+
private posPrevPointerY;
|
|
1935
|
+
private posWorldObj;
|
|
1936
|
+
private dirCamToObj;
|
|
1937
|
+
private posNdcPointer;
|
|
1938
|
+
/* Excluded from this release type: __constructor */
|
|
1939
|
+
/** Enables pointer-based raycasting and adds all necessary pointer event listeners and the frame update callback. */
|
|
1940
|
+
enable(): void;
|
|
1941
|
+
/** Disables pointer-based raycasting and removes all pointer event listeners and the frame update callback. */
|
|
1942
|
+
disable(): void;
|
|
1943
|
+
/**
|
|
1944
|
+
* Checks whether an object's world position is visible from the active camera without being occluded.
|
|
1945
|
+
*
|
|
1946
|
+
* @param obj - The object whose visibility should be tested.
|
|
1947
|
+
* @returns `true` if no other object blocks the line of sight to the object's world position, otherwise `false`.
|
|
1948
|
+
*/
|
|
1949
|
+
isVisibleOcclusion(obj: THREE_TYPE.Object3D): boolean;
|
|
1950
|
+
private onClick;
|
|
1951
|
+
private onPointerDown;
|
|
1952
|
+
private onPointerEnter;
|
|
1953
|
+
private onPointerLeave;
|
|
1954
|
+
private onPointerMove;
|
|
1955
|
+
private onPointerUp;
|
|
1956
|
+
/**
|
|
1957
|
+
* Begins tracking a list of scene objects for pointer intersection detection. If the raycaster is not yet listening for pointer movements, this method automatically attaches pointer event listeners
|
|
1958
|
+
* (`pointermove`, `click`, `pointerdown`, `pointerup`).
|
|
1959
|
+
*
|
|
1960
|
+
* @param params - Parameter object.
|
|
1961
|
+
* @param params.objs3D - The `Obj3D` instances to track.
|
|
1962
|
+
*/
|
|
1963
|
+
trackSelectable({ objs3D }: {
|
|
1964
|
+
objs3D: Obj3D[];
|
|
1965
|
+
}): void;
|
|
1966
|
+
/**
|
|
1967
|
+
* Registers and executes a low-level extension function with access to the public `Raycast` API.
|
|
1968
|
+
* @param extension - Function that receives the current `Raycast` instance and can use its public members and methods.
|
|
1969
|
+
* @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.
|
|
1970
|
+
*/
|
|
1971
|
+
use(extension: (raycast: Raycast) => void): void;
|
|
1972
|
+
/**
|
|
1973
|
+
* Stops tracking the specified scene objects for ray intersection detection. It automatically removes the pointer event listeners if no tracked objects remain.
|
|
1974
|
+
*
|
|
1975
|
+
* @param params - Parameter object.
|
|
1976
|
+
* @param params.objs3D - The `Obj3D` instances to untrack.
|
|
1977
|
+
*/
|
|
1978
|
+
untrackSelectable({ objs3D }: {
|
|
1979
|
+
objs3D: Obj3D[];
|
|
1980
|
+
}): void;
|
|
1981
|
+
/* Excluded from this release type: updateSelect */
|
|
1982
|
+
private updatePointer;
|
|
1983
|
+
}
|
|
1984
|
+
|
|
1985
|
+
/** Defines the raycasting settings used to detect selectable objects around the pointer.
|
|
1986
|
+
* @category Cfg
|
|
1987
|
+
*/
|
|
1988
|
+
export declare interface RaycastCfg {
|
|
1989
|
+
/**
|
|
1990
|
+
* Circle radius around the pointer in pixels.
|
|
1991
|
+
* @default 10
|
|
1992
|
+
*/
|
|
1993
|
+
circleRadius: number;
|
|
1994
|
+
/**
|
|
1995
|
+
* Number of rays to cast around the circle.
|
|
1996
|
+
* @default 12
|
|
1997
|
+
*/
|
|
1998
|
+
circleSteps: number;
|
|
1999
|
+
/**
|
|
2000
|
+
* Number of closest objects to detect.
|
|
2001
|
+
* @default 5
|
|
2002
|
+
*/
|
|
2003
|
+
countClosestObjs: number;
|
|
2004
|
+
}
|
|
2005
|
+
|
|
2006
|
+
/** Defines the renderer settings used to control frame timing, resolution, shadows, tone mapping and output color space.
|
|
2007
|
+
* @category Cfg
|
|
2008
|
+
*/
|
|
2009
|
+
export declare interface RenderCfg {
|
|
2010
|
+
/**
|
|
2011
|
+
* Selects the rendering backend.
|
|
2012
|
+
*
|
|
2013
|
+
* - `webgl`: use `THREE.WebGLRenderer`
|
|
2014
|
+
* - `webgpu`: use `THREE.WebGPURenderer`
|
|
2015
|
+
* - `auto`: use WebGPU if supported, otherwise fall back to WebGL
|
|
2016
|
+
*
|
|
2017
|
+
* @default 'auto'
|
|
2018
|
+
*/
|
|
2019
|
+
api: Renderer;
|
|
2020
|
+
/**
|
|
2021
|
+
* Automatically updates the canvas, renderer, post-processing, camera and reflector sizes on window resize.
|
|
2022
|
+
* @default true
|
|
2023
|
+
*/
|
|
2024
|
+
autoResize?: boolean;
|
|
2025
|
+
/**
|
|
2026
|
+
* Whether the GUI render dropdown is open.
|
|
2027
|
+
* @default false
|
|
2028
|
+
*/
|
|
2029
|
+
guiOpened: boolean;
|
|
2030
|
+
/**
|
|
2031
|
+
* Enables or disables the maximum frames limiter.
|
|
2032
|
+
* @default true
|
|
2033
|
+
*/
|
|
2034
|
+
fpsLimiter: boolean;
|
|
2035
|
+
/**
|
|
2036
|
+
* Maximum frames per second.
|
|
2037
|
+
* @default 30
|
|
2038
|
+
*/
|
|
2039
|
+
fpsMax: number;
|
|
2040
|
+
/**
|
|
2041
|
+
* Maximum number of delta time history samples.
|
|
2042
|
+
* @default 10
|
|
2043
|
+
*/
|
|
2044
|
+
deltaTimesMax: number;
|
|
2045
|
+
/**
|
|
2046
|
+
* Activates the GUI module via lazy loading.
|
|
2047
|
+
* @default false
|
|
2048
|
+
*/
|
|
2049
|
+
gui: boolean;
|
|
2050
|
+
/**
|
|
2051
|
+
* Output color space.
|
|
2052
|
+
* @default THREE.SRGBColorSpace
|
|
2053
|
+
*/
|
|
2054
|
+
outputColorSpace: THREE_TYPE.ColorSpace;
|
|
2055
|
+
/**
|
|
2056
|
+
* Sets the renderer pixel ratio.
|
|
2057
|
+
* @default 1
|
|
2058
|
+
*/
|
|
2059
|
+
pixelRatio: number;
|
|
2060
|
+
/**
|
|
2061
|
+
* Enables or disables shadow maps.
|
|
2062
|
+
* @default true
|
|
2063
|
+
*/
|
|
2064
|
+
shadowMapEnabled: boolean;
|
|
2065
|
+
/**
|
|
2066
|
+
* Type of shadow map.
|
|
2067
|
+
* @default THREE.PCFShadowMap
|
|
2068
|
+
*/
|
|
2069
|
+
shadowMapType: THREE_TYPE.ShadowMapType;
|
|
2070
|
+
/**
|
|
2071
|
+
* Tone mapping algorithm.
|
|
2072
|
+
* @default THREE.ACESFilmicToneMapping
|
|
2073
|
+
*/
|
|
2074
|
+
toneMapping: THREE_TYPE.ToneMapping;
|
|
2075
|
+
/**
|
|
2076
|
+
* Tone mapping exposure value.
|
|
2077
|
+
* @default 1.0
|
|
2078
|
+
*/
|
|
2079
|
+
toneMappingExposure: number;
|
|
2080
|
+
/**
|
|
2081
|
+
* WebGL renderer configuration.
|
|
2082
|
+
*/
|
|
2083
|
+
webgl: {
|
|
2084
|
+
/**
|
|
2085
|
+
* Parameters passed to `THREE.WebGLRenderer`.
|
|
2086
|
+
* @default antialias: true, alpha: false, powerPreference: 'low-power'
|
|
2087
|
+
*/
|
|
2088
|
+
parameters: THREE_TYPE.WebGLRendererParameters;
|
|
2089
|
+
};
|
|
2090
|
+
/**
|
|
2091
|
+
* WebGPU renderer configuration.
|
|
2092
|
+
*/
|
|
2093
|
+
webgpu: {
|
|
2094
|
+
/**
|
|
2095
|
+
* Parameters passed to `THREE.WebGPURenderer`.
|
|
2096
|
+
* @default antialias: true, alpha: false
|
|
2097
|
+
*/
|
|
2098
|
+
parameters: WebGpuRendererParameters;
|
|
2099
|
+
};
|
|
2100
|
+
}
|
|
2101
|
+
|
|
2102
|
+
/** Defines the available renderer backends. */
|
|
2103
|
+
export declare type Renderer = 'webgl' | 'webgpu' | 'auto';
|
|
2104
|
+
|
|
2105
|
+
/** Defines the scene settings used to configure background, environment, model, fog and lights.
|
|
2106
|
+
* @category Cfg
|
|
2107
|
+
*/
|
|
2108
|
+
export declare interface SceneCfg {
|
|
2109
|
+
/**
|
|
2110
|
+
* Custom element tag in which the canvas is rendered.
|
|
2111
|
+
* @default 'comp-canvas'
|
|
2112
|
+
*/
|
|
2113
|
+
canvas: string;
|
|
2114
|
+
/**
|
|
2115
|
+
* Whether the GUI scene dropdown is open.
|
|
2116
|
+
* @default false
|
|
2117
|
+
*/
|
|
2118
|
+
guiOpened: boolean;
|
|
2119
|
+
/** Fog settings. */
|
|
2120
|
+
fog: FogCfg;
|
|
2121
|
+
/** Ambient light settings. */
|
|
2122
|
+
ambientlight: AmbientlightCfg;
|
|
2123
|
+
/** Hemisphere light settings. */
|
|
2124
|
+
hemisphere: HemisphereCfg;
|
|
2125
|
+
}
|
|
2126
|
+
|
|
2127
|
+
/** @event Fired when the scene is set up and ready and triggers the corresponding XState event. */
|
|
2128
|
+
export declare interface SceneReadyEvent {
|
|
2129
|
+
/** Identifies this event type. */
|
|
2130
|
+
type: 'SCENE_READY';
|
|
2131
|
+
}
|
|
2132
|
+
|
|
2133
|
+
/** @event Fired after the scene has been rendered for the first time and triggers the corresponding XState event. */
|
|
2134
|
+
export declare interface SceneRenderedEvent {
|
|
2135
|
+
/** Identifies this event type. */
|
|
2136
|
+
type: 'SCENE_RENDERED';
|
|
2137
|
+
}
|
|
2138
|
+
|
|
2139
|
+
/** Defines the SMAA anti-aliasing pass settings used to smooth jagged edges in the rendered image.
|
|
2140
|
+
* @category Cfg
|
|
2141
|
+
*/
|
|
2142
|
+
export declare interface SmaaCfg {
|
|
2143
|
+
/**
|
|
2144
|
+
* Enables or disables SMAA.
|
|
2145
|
+
* @default false
|
|
2146
|
+
*/
|
|
2147
|
+
enable: boolean;
|
|
2148
|
+
/**
|
|
2149
|
+
* Whether the GUI SMAA dropdown is open.
|
|
2150
|
+
* @default false
|
|
2151
|
+
*/
|
|
2152
|
+
guiOpened: boolean;
|
|
2153
|
+
}
|
|
2154
|
+
|
|
2155
|
+
/** Defines the screen-space ambient occlusion settings used to enhance depth and shading.
|
|
2156
|
+
* @category Cfg
|
|
2157
|
+
*/
|
|
2158
|
+
export declare interface SsaoCfg {
|
|
2159
|
+
/**
|
|
2160
|
+
* Imports the SSAO module dynamically and enables the SSAO effect.
|
|
2161
|
+
* @default false
|
|
2162
|
+
*/
|
|
2163
|
+
enable: boolean;
|
|
2164
|
+
/**
|
|
2165
|
+
* Whether the GUI SSAO dropdown is open.
|
|
2166
|
+
* @default false
|
|
2167
|
+
*/
|
|
2168
|
+
guiOpened: boolean;
|
|
2169
|
+
}
|
|
2170
|
+
|
|
2171
|
+
/** Defines the WebGL screen-space ambient occlusion settings.
|
|
2172
|
+
* @category Cfg
|
|
2173
|
+
*/
|
|
2174
|
+
export declare interface SsaoWebGlCfg {
|
|
2175
|
+
/**
|
|
2176
|
+
* Defines the radius of the ambient occlusion kernel.
|
|
2177
|
+
* @default 8
|
|
2178
|
+
*/
|
|
2179
|
+
kernelRadius: number;
|
|
2180
|
+
/**
|
|
2181
|
+
* Minimum distance between surfaces before AO applies.
|
|
2182
|
+
* @default 0.005
|
|
2183
|
+
*/
|
|
2184
|
+
minDistance: number;
|
|
2185
|
+
/**
|
|
2186
|
+
* Maximum distance for SSAO calculation.
|
|
2187
|
+
* @default 0.1
|
|
2188
|
+
*/
|
|
2189
|
+
maxDistance: number;
|
|
2190
|
+
}
|
|
2191
|
+
|
|
2192
|
+
/** Defines the WebGPU screen-space ambient occlusion settings.
|
|
2193
|
+
* @category Cfg
|
|
2194
|
+
*/
|
|
2195
|
+
export declare interface SsaoWebGpuCfg {
|
|
2196
|
+
/**
|
|
2197
|
+
* Defines the radius of the ambient occlusion in world space.
|
|
2198
|
+
* @default 0.25
|
|
2199
|
+
*/
|
|
2200
|
+
radius: number;
|
|
2201
|
+
/**
|
|
2202
|
+
* Defines the thickness used for the ambient occlusion calculation.
|
|
2203
|
+
* @default 1
|
|
2204
|
+
*/
|
|
2205
|
+
thickness: number;
|
|
2206
|
+
/**
|
|
2207
|
+
* Controls how strongly the AO is attenuated over distance.
|
|
2208
|
+
* @default 1
|
|
2209
|
+
*/
|
|
2210
|
+
distanceExponent: number;
|
|
2211
|
+
/**
|
|
2212
|
+
* Defines how quickly the AO fades with distance.
|
|
2213
|
+
* @default 1
|
|
2214
|
+
*/
|
|
2215
|
+
distanceFallOff: number;
|
|
2216
|
+
/**
|
|
2217
|
+
* Scales the strength of the ambient occlusion.
|
|
2218
|
+
* @default 1
|
|
2219
|
+
*/
|
|
2220
|
+
scale: number;
|
|
2221
|
+
/**
|
|
2222
|
+
* Defines the number of samples used to compute the AO.
|
|
2223
|
+
* @default 16
|
|
2224
|
+
*/
|
|
2225
|
+
samples: number;
|
|
2226
|
+
/**
|
|
2227
|
+
* Defines the render resolution scale of the AO effect.
|
|
2228
|
+
* @default 1
|
|
2229
|
+
*/
|
|
2230
|
+
resolutionScale: number;
|
|
2231
|
+
}
|
|
2232
|
+
|
|
2233
|
+
/** Defines the shared screen-space reflection settings.
|
|
2234
|
+
* @category Cfg
|
|
2235
|
+
*/
|
|
2236
|
+
export declare interface SsrCfg {
|
|
2237
|
+
/**
|
|
2238
|
+
* Imports the SSR module dynamically and enables the SSR effect.
|
|
2239
|
+
* @default false
|
|
2240
|
+
*/
|
|
2241
|
+
enable: boolean;
|
|
2242
|
+
/**
|
|
2243
|
+
* Whether the GUI SSR dropdown is open.
|
|
2244
|
+
* @default false
|
|
2245
|
+
*/
|
|
2246
|
+
guiOpened: boolean;
|
|
2247
|
+
}
|
|
2248
|
+
|
|
2249
|
+
/** Defines the WebGL screen-space reflection settings.
|
|
2250
|
+
* @category Cfg
|
|
2251
|
+
*/
|
|
2252
|
+
export declare interface SsrWebGlCfg {
|
|
2253
|
+
/**
|
|
2254
|
+
* Whether multiple light bounces are calculated for reflections.
|
|
2255
|
+
* @default false
|
|
2256
|
+
*/
|
|
2257
|
+
bouncing: boolean;
|
|
2258
|
+
/**
|
|
2259
|
+
* Enables distance-based attenuation of reflections.
|
|
2260
|
+
* @default true
|
|
2261
|
+
*/
|
|
2262
|
+
distanceAttenuation: boolean;
|
|
2263
|
+
/**
|
|
2264
|
+
* Enables fresnel-based reflections.
|
|
2265
|
+
* @default true
|
|
2266
|
+
*/
|
|
2267
|
+
fresnel: boolean;
|
|
2268
|
+
/**
|
|
2269
|
+
* Enables infinite-thickness reflection mode.
|
|
2270
|
+
* @default false
|
|
2271
|
+
*/
|
|
2272
|
+
infiniteThick: boolean;
|
|
2273
|
+
/**
|
|
2274
|
+
* Controls the maximum distance a fragment can reflect.
|
|
2275
|
+
* @default 180
|
|
2276
|
+
*/
|
|
2277
|
+
maxDistance: number;
|
|
2278
|
+
/**
|
|
2279
|
+
* Reflection opacity value.
|
|
2280
|
+
* @default 0.5
|
|
2281
|
+
*/
|
|
2282
|
+
opacity: number;
|
|
2283
|
+
/**
|
|
2284
|
+
* Controls the cutoff thickness in reflection calculations.
|
|
2285
|
+
* @default 0.018
|
|
2286
|
+
*/
|
|
2287
|
+
thickness: number;
|
|
2288
|
+
/**
|
|
2289
|
+
* Enables blur on reflections.
|
|
2290
|
+
* @default true
|
|
2291
|
+
*/
|
|
2292
|
+
blur: boolean;
|
|
2293
|
+
/**
|
|
2294
|
+
* Resolution scale for effect computation.
|
|
2295
|
+
* @default 1
|
|
2296
|
+
*/
|
|
2297
|
+
resolutionScale: number;
|
|
2298
|
+
/**
|
|
2299
|
+
* Output configuration of the SSR pass.
|
|
2300
|
+
* @default 0
|
|
2301
|
+
*/
|
|
2302
|
+
output: number;
|
|
2303
|
+
/**
|
|
2304
|
+
* Whether SSR only affects selected objects.
|
|
2305
|
+
* @default false
|
|
2306
|
+
*/
|
|
2307
|
+
selective: boolean;
|
|
2308
|
+
/**
|
|
2309
|
+
* Whether the pass clears before rendering.
|
|
2310
|
+
* @default true
|
|
2311
|
+
*/
|
|
2312
|
+
clear: boolean;
|
|
2313
|
+
/**
|
|
2314
|
+
* Maximum roughness threshold for reflective objects.
|
|
2315
|
+
* @default 0.5
|
|
2316
|
+
*/
|
|
2317
|
+
maxRoughness: number;
|
|
2318
|
+
}
|
|
2319
|
+
|
|
2320
|
+
/** Defines the WebGPU screen-space reflection settings.
|
|
2321
|
+
* @category Cfg
|
|
2322
|
+
*/
|
|
2323
|
+
export declare interface SsrWebGpuCfg {
|
|
2324
|
+
/**
|
|
2325
|
+
* Enables distance-based attenuation of reflections.
|
|
2326
|
+
* @default true
|
|
2327
|
+
*/
|
|
2328
|
+
distanceAttenuation: boolean;
|
|
2329
|
+
/**
|
|
2330
|
+
* Enables fresnel-based reflections.
|
|
2331
|
+
* @default true
|
|
2332
|
+
*/
|
|
2333
|
+
fresnel: boolean;
|
|
2334
|
+
/**
|
|
2335
|
+
* Maximum SSR ray distance.
|
|
2336
|
+
* @default 180
|
|
2337
|
+
*/
|
|
2338
|
+
maxDistance: number;
|
|
2339
|
+
/**
|
|
2340
|
+
* Reflection opacity value.
|
|
2341
|
+
* @default 0.5
|
|
2342
|
+
*/
|
|
2343
|
+
opacity: number;
|
|
2344
|
+
/**
|
|
2345
|
+
* Ray thickness used for SSR intersection tests.
|
|
2346
|
+
* @default 0.018
|
|
2347
|
+
*/
|
|
2348
|
+
thickness: number;
|
|
2349
|
+
/**
|
|
2350
|
+
* SSR render resolution scale.
|
|
2351
|
+
* @default 1
|
|
2352
|
+
*/
|
|
2353
|
+
resolutionScale: number;
|
|
2354
|
+
/**
|
|
2355
|
+
* SSR quality factor.
|
|
2356
|
+
* @default 0.5
|
|
2357
|
+
*/
|
|
2358
|
+
quality: number;
|
|
2359
|
+
/**
|
|
2360
|
+
* SSR blur quality level.
|
|
2361
|
+
* @default 1
|
|
2362
|
+
*/
|
|
2363
|
+
blurQuality: 1 | 2 | 3;
|
|
2364
|
+
}
|
|
2365
|
+
|
|
2366
|
+
/**
|
|
2367
|
+
* Manages the lifecycle of an XState state machine within the application. The class encapsulates the creation and execution of a state machine actor, providing a controlled interface to start, monitor,
|
|
2368
|
+
* and debug its runtime behavior.
|
|
2369
|
+
* @category Core
|
|
2370
|
+
*/
|
|
2371
|
+
export declare class StateMachine {
|
|
2372
|
+
private readonly cfg;
|
|
2373
|
+
private readonly modules;
|
|
2374
|
+
private actor;
|
|
2375
|
+
private lastState;
|
|
2376
|
+
private snapshot;
|
|
2377
|
+
private stateMachine;
|
|
2378
|
+
/* Excluded from this release type: __constructor */
|
|
2379
|
+
/* Excluded from this release type: sendEvent */
|
|
2380
|
+
/**
|
|
2381
|
+
* Starts the provided XState state machine and initializes its corresponding actor.
|
|
2382
|
+
* @param stateMachine - A fully constructed XState 5 machine.
|
|
2383
|
+
*
|
|
2384
|
+
* **Example**
|
|
2385
|
+
* {@includeCode ../examples/app-statemachine.ts}
|
|
2386
|
+
|
|
2387
|
+
*/
|
|
2388
|
+
start(stateMachine: AnyStateMachine): void;
|
|
2389
|
+
}
|
|
2390
|
+
|
|
2391
|
+
/** Defines the application state machine settings used to control inspector-related state.
|
|
2392
|
+
* @category Cfg
|
|
2393
|
+
*/
|
|
2394
|
+
export declare interface StateMachineCfg {
|
|
2395
|
+
/**
|
|
2396
|
+
* Imports statelyai/inspect module dynamically and enables inspector mode.
|
|
2397
|
+
* @default false
|
|
2398
|
+
*/
|
|
2399
|
+
inspector: boolean;
|
|
2400
|
+
}
|
|
2401
|
+
|
|
2402
|
+
/** Defines the built-in engine stats panel settings used to display FPS, CPU/frame timing and renderer.info values.
|
|
2403
|
+
* @category Cfg
|
|
2404
|
+
*/
|
|
2405
|
+
export declare interface StatsCfg {
|
|
2406
|
+
/**
|
|
2407
|
+
* Enables or disables stats data collection.
|
|
2408
|
+
* @default true
|
|
2409
|
+
*/
|
|
2410
|
+
enabled: boolean;
|
|
2411
|
+
/**
|
|
2412
|
+
* Shows the FPS value.
|
|
2413
|
+
* @default true
|
|
2414
|
+
*/
|
|
2415
|
+
fps: boolean;
|
|
2416
|
+
/**
|
|
2417
|
+
* Shows the measured CPU/update time in milliseconds.
|
|
2418
|
+
* @default true
|
|
2419
|
+
*/
|
|
2420
|
+
cpu: boolean;
|
|
2421
|
+
/**
|
|
2422
|
+
* Shows the frame time in milliseconds.
|
|
2423
|
+
* @default true
|
|
2424
|
+
*/
|
|
2425
|
+
frame: boolean;
|
|
2426
|
+
/**
|
|
2427
|
+
* Shows renderer.info.render.calls.
|
|
2428
|
+
* @default true
|
|
2429
|
+
*/
|
|
2430
|
+
calls: boolean;
|
|
2431
|
+
/**
|
|
2432
|
+
* Shows renderer.info.render.triangles.
|
|
2433
|
+
* @default true
|
|
2434
|
+
*/
|
|
2435
|
+
triangles: boolean;
|
|
2436
|
+
/**
|
|
2437
|
+
* Shows renderer.info.render.lines.
|
|
2438
|
+
* @default true
|
|
2439
|
+
*/
|
|
2440
|
+
lines: boolean;
|
|
2441
|
+
/**
|
|
2442
|
+
* Shows renderer.info.render.points.
|
|
2443
|
+
* @default true
|
|
2444
|
+
*/
|
|
2445
|
+
points: boolean;
|
|
2446
|
+
/**
|
|
2447
|
+
* Shows renderer.info.memory.geometries.
|
|
2448
|
+
* @default true
|
|
2449
|
+
*/
|
|
2450
|
+
geometries: boolean;
|
|
2451
|
+
/**
|
|
2452
|
+
* Shows renderer.info.memory.textures.
|
|
2453
|
+
* @default true
|
|
2454
|
+
*/
|
|
2455
|
+
textures: boolean;
|
|
2456
|
+
/**
|
|
2457
|
+
* Shows the number of compiled WebGL programs from renderer.info.programs.
|
|
2458
|
+
* @default true
|
|
2459
|
+
*/
|
|
2460
|
+
programs: boolean;
|
|
2461
|
+
/**
|
|
2462
|
+
* Refresh rate of the displayed values.
|
|
2463
|
+
* @default 10
|
|
2464
|
+
*/
|
|
2465
|
+
logsPerSecond: number;
|
|
2466
|
+
}
|
|
2467
|
+
|
|
2468
|
+
/** Function returned by an event subscription. Calling it removes the associated listener. */
|
|
2469
|
+
export declare type Unsubscribe = () => void;
|
|
2470
|
+
|
|
2471
|
+
export declare type WebGpuRendererParameters = NonNullable<ConstructorParameters<typeof THREE_WEBGPU_TYPE.WebGPURenderer>[0]>;
|
|
2472
|
+
|
|
2473
|
+
/** @event Fired when the window size changes and triggers the corresponding XState event. */
|
|
2474
|
+
export declare interface WindowResizeEvent {
|
|
2475
|
+
/** Identifies this event type. */
|
|
2476
|
+
type: 'WINDOW_RESIZE';
|
|
2477
|
+
}
|
|
2478
|
+
|
|
2479
|
+
export { }
|