illutions 0.25.0 → 0.27.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/main.d.ts CHANGED
@@ -18,6 +18,8 @@ import { OutputPass } from 'three/addons/postprocessing/OutputPass.js';
18
18
  import { Pane } from 'tweakpane';
19
19
  import { PointerLockControls } from 'three/addons/controls/PointerLockControls.js';
20
20
  import { PointerLockControls as PointerLockControls_2 } from 'three/examples/jsm/controls/PointerLockControls.js';
21
+ import { RectAreaLightTexturesLib } from 'three/addons/lights/RectAreaLightTexturesLib.js';
22
+ import { RectAreaLightUniformsLib } from 'three/addons/lights/RectAreaLightUniformsLib.js';
21
23
  import { ReflectorForSSRPass } from 'three/addons/objects/ReflectorForSSRPass.js';
22
24
  import { RenderPass } from 'three/addons/postprocessing/RenderPass.js';
23
25
  import { ShaderPass } from 'three/addons/postprocessing/ShaderPass.js';
@@ -30,6 +32,7 @@ import type * as THREE_TYPE from 'three';
30
32
  import type * as THREE_WEBGPU_TYPE from 'three/webgpu';
31
33
  import type * as THREE_WEBTSL_TYPE from 'three/tsl';
32
34
  import { TierResult } from 'detect-gpu';
35
+ import { traa } from 'three/addons/tsl/display/TRAANode.js';
33
36
 
34
37
  /**
35
38
  * Defines the shared anti-aliasing settings.
@@ -42,10 +45,10 @@ export declare interface AaCfg {
42
45
  */
43
46
  guiOpened: boolean;
44
47
  /**
45
- * Selects the anti-aliasing mode.
48
+ * Selects the anti-aliasing mode. TRAA automatically falls back to FXAA when WebGL is used.
46
49
  * @default 'none'
47
50
  */
48
- mode: 'none' | 'fxaa' | 'smaa';
51
+ mode: 'none' | 'fxaa' | 'smaa' | 'traa';
49
52
  }
50
53
 
51
54
  export declare type ActionFadeMode = 'in' | 'out';
@@ -75,7 +78,7 @@ export declare interface AmbientlightCfg {
75
78
  /** @event Fired when an object animation starts or finishes and triggers the corresponding XState event. */
76
79
  export declare interface AnimEvent {
77
80
  /** Identifies this event type. */
78
- type: 'ANIM_COMPLETE' | 'ANIM_START';
81
+ type: 'Anim_Complete' | 'Anim_Start';
79
82
  /** The name of the `THREE.Object3D` whose animation changed state. */
80
83
  objName: string;
81
84
  /** The name of the calling method. */
@@ -85,7 +88,7 @@ export declare interface AnimEvent {
85
88
  /** @event Fired when a material fade animation starts or finishes and triggers the corresponding XState event. */
86
89
  export declare interface AnimFadeEvent {
87
90
  /** Identifies this event type. */
88
- type: 'ANIM_FADE_COMPLETE' | 'ANIM_FADE_START';
91
+ type: 'Anim_Fade_Complete' | 'Anim_Fade_Start';
89
92
  /** The name of the `THREE.Mesh` whose material fade changed state. */
90
93
  objName: string;
91
94
  /** The name of the calling method. */
@@ -97,12 +100,13 @@ export declare interface AnimFadeEvent {
97
100
  }
98
101
 
99
102
  /**
100
- * 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`.
103
+ * Represents the central controller of the illutions 3D engine. The class initializes and manages all core modules of the engine.
101
104
  * It provides an entry point for creating and controlling a complete 3D scene.
102
105
  * @category Core
103
106
  */
104
107
  export declare class App<TClasses extends Classes = {}> {
105
108
  readonly audio: Audio_2;
109
+ private readonly compCtrls;
106
110
  readonly engine: Engine;
107
111
  readonly envCtrls: EnvCtrls;
108
112
  readonly events: Events;
@@ -172,19 +176,19 @@ declare class Audio_2 {
172
176
  }): boolean;
173
177
  private loadSound;
174
178
  /**
175
- * Loads an audio file without playing it and sends an `AUDIO_LOADED` event when the sound is ready.
179
+ * Loads an audio file without playing it and sends an `Audio_Loaded` event when the sound is ready.
176
180
  * @param params - The sound options.
177
181
  */
178
182
  load({ name, url, object, volume, fade, loop }: SoundParams): void;
179
183
  /**
180
184
  * Loads an audio file and plays it automatically when loading is complete.
181
- * Use this method when no separate `AUDIO_LOADED` handling is required.
185
+ * Use this method when no separate `Audio_Loaded` handling is required.
182
186
  * @param params - The sound options.
183
187
  */
184
188
  loadAndPlay({ name, url, object, volume, fade, loop }: SoundParams): void;
185
189
  /**
186
190
  * Plays an audio that has finished loading, with a smooth fade-in.
187
- * When using {@link load}, call this method after receiving the matching `AUDIO_LOADED` event.
191
+ * When using {@link load}, call this method after receiving the matching `Audio_Loaded` event.
188
192
  * This method does not wait for an audio file that is still loading.
189
193
  * @param params - Parameter object.
190
194
  * @param params.name - The name of the loaded audio to play.
@@ -291,7 +295,7 @@ export declare interface AudioCfg {
291
295
  /** @event Fired when an audio file has finished loading and is ready for playback. */
292
296
  export declare interface AudioLoadedEvent {
293
297
  /** Identifies this event type. */
294
- type: 'AUDIO_LOADED';
298
+ type: 'Audio_Loaded';
295
299
  /** The unique name assigned to the loaded sound. */
296
300
  soundName: string;
297
301
  }
@@ -437,7 +441,7 @@ export declare interface CamPerspectiveCfg extends CamBaseCfg {
437
441
  /** @event Fired when the user uses keys while the canvas has focus and triggers the corresponding XState event. */
438
442
  export declare interface CanvasKeyEvent {
439
443
  /** Identifies this event type. */
440
- type: 'CANVAS_KEY_DOWN' | 'CANVAS_KEY_UP';
444
+ type: 'Canvas_Key_Down' | 'Canvas_Key_Up';
441
445
  /** Native keyboard event from the canvas interaction. */
442
446
  event: KeyboardEvent;
443
447
  }
@@ -445,7 +449,7 @@ export declare interface CanvasKeyEvent {
445
449
  /** @event Fired when the user uses the pointer on the canvas and triggers the corresponding XState event. */
446
450
  export declare interface CanvasPointerEvent {
447
451
  /** Identifies this event type. */
448
- type: 'CANVAS_CLICK' | 'CANVAS_POINTER_DOWN' | 'CANVAS_POINTER_MOVE' | 'CANVAS_POINTER_UP';
452
+ type: 'Canvas_Click' | 'Canvas_Pointer_Down' | 'Canvas_Pointer_Move' | 'Canvas_Pointer_Up';
449
453
  /** Native pointer event from the canvas interaction. */
450
454
  event: PointerEvent;
451
455
  }
@@ -459,6 +463,8 @@ export declare interface Cfg {
459
463
  audio: AudioCfg;
460
464
  /** Camera settings. */
461
465
  cam: CamCfg;
466
+ /** Component settings. */
467
+ comps: CompsCfg;
462
468
  /** Debug settings. */
463
469
  debug: DebugCfg;
464
470
  /** Environment controls settings. */
@@ -507,7 +513,7 @@ export declare type Classes<TObj3DClasses extends Record<string, Obj3DClass> = {
507
513
  /** @event Fired when a clip starts, completes, is canceled, fades its weight, or changes its playback speed. */
508
514
  export declare interface ClipEvent {
509
515
  /** Identifies this event type. */
510
- type: 'CLIP_START' | 'CLIP_COMPLETE' | 'CLIP_CANCEL' | 'CLIP_FADE_START' | 'CLIP_FADE_COMPLETE' | 'CLIP_SPEED_START' | 'CLIP_SPEED_COMPLETE';
516
+ type: 'Clip_Start' | 'Clip_Complete' | 'Clip_Cancel' | 'Clip_Fade_Start' | 'Clip_Fade_Complete' | 'Clip_Speed_Start' | 'Clip_Speed_Complete';
511
517
  /** The name of the affected `THREE.AnimationClip`. */
512
518
  clipName: string;
513
519
  /** The name of the calling method. */
@@ -531,21 +537,31 @@ export declare class Comp extends HTMLElement {
531
537
  comps: Map<string, Comp[]> | null;
532
538
  events: Readonly<Events>;
533
539
  objs3D: Map<string, Obj3D>;
534
- private unsubFollow;
535
- private unsubVisible;
536
- /**
537
- * Makes this component follow an `Obj3D` by subscribing to updates of its screen position.
540
+ private compCtrls;
541
+ private obj3DFollow;
542
+ private visible;
543
+ private visibleFollow;
544
+ private visibleOverlap;
545
+ private unSubFollow;
546
+ private unSubVisible;
547
+ private clearFollow;
548
+ private emitEvent;
549
+ /**
550
+ * Makes this component follow an `Obj3D` by subscribing to updates of its screen position and combined visibility.
538
551
  *
539
552
  * @param params - The follow parameters.
540
553
  * @param params.obj - The `Obj3D` to follow in the scene.
541
- * @param params.enableOcclusionCheck - Whether to enable occlusion visibility checks. Default: **false**
542
554
  */
543
- follow({ obj, enableOcclusionCheck }: {
555
+ follow({ obj }: {
544
556
  obj: Obj3D | string;
545
- enableOcclusionCheck?: boolean;
546
557
  }): void;
547
- /** Stops this component from following the currently subscribed {@link Obj3D}. */
548
- unfollow(): void;
558
+ /* Excluded from this release type: getObj3DFollow */
559
+ /* Excluded from this release type: isVisibleFollow */
560
+ /**
561
+ * Applies the combined followed-object and overlap visibility.
562
+ * @param visible - Whether the web component is visible after combining all visibility conditions.
563
+ */
564
+ protected onVisibilityChanged(visible: boolean): void;
549
565
  /**
550
566
  * 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.
551
567
  * @public
@@ -560,12 +576,27 @@ export declare class Comp extends HTMLElement {
560
576
  */
561
577
  protected onStart(): void;
562
578
  /* Excluded from this release type: ready */
579
+ /* Excluded from this release type: setVisibleOverlap */
563
580
  /* Excluded from this release type: start */
581
+ /**
582
+ * Registers this component for screen-space overlap tracking using `cfg.comps.overlap.padding`.
583
+ * Farther registered components are hidden when their screen-space rectangles overlap.
584
+ */
585
+ trackOverlap(): void;
586
+ /** Stops this component from following the currently subscribed {@link Obj3D}. */
587
+ unfollow(): void;
588
+ /** Stops screen-space overlap tracking and removes any overlap-based hiding from this component. */
589
+ untrackOverlap(): void;
590
+ private updateVisibility;
564
591
  }
565
592
 
566
593
  /** Constructor type for `Comp` classes. */
567
594
  export declare type CompClass = new () => Comp;
568
595
 
596
+ /* Excluded from this release type: CompCtrls */
597
+
598
+ export declare type CompEvent = CompOverlapEvent | CompVisibleEvent;
599
+
569
600
  /**
570
601
  * Maps a record of Comp classes to a record of component instance arrays.
571
602
  * { key1: typeof Comp1 } -> { key1: Comp1[] }
@@ -575,6 +606,47 @@ export declare type CompInsts<T extends Record<string, CompClass>> = {
575
606
  [K in keyof T]: InstanceType<T[K]>[];
576
607
  };
577
608
 
609
+ /** @event Fired when the overlap state of a web component changes and triggers the corresponding XState event. */
610
+ export declare interface CompOverlapEvent {
611
+ /** Identifies this event type. */
612
+ type: 'Comp_Overlap_Changed';
613
+ /** The affected web component. */
614
+ comp: Comp;
615
+ /** Whether the component is overlapped by a nearer component. */
616
+ overlapped: boolean;
617
+ }
618
+
619
+ /**
620
+ * Defines component settings.
621
+ * @category Cfg
622
+ */
623
+ export declare interface CompsCfg {
624
+ /** Screen-space overlap settings. */
625
+ overlap: CompsOverlapCfg;
626
+ }
627
+
628
+ /**
629
+ * Defines screen-space overlap settings for components.
630
+ * @category Cfg
631
+ */
632
+ export declare interface CompsOverlapCfg {
633
+ /**
634
+ * Minimum spacing in pixels between visible components.
635
+ * @default 20
636
+ */
637
+ padding: number;
638
+ }
639
+
640
+ /** @event Fired when the combined 3D-object and overlap visibility of a web component changes and triggers the corresponding XState event. */
641
+ export declare interface CompVisibleEvent {
642
+ /** Identifies this event type. */
643
+ type: 'Comp_Visible_Changed';
644
+ /** The affected web component. */
645
+ comp: Comp;
646
+ /** Whether the component is visible after combining all visibility conditions. */
647
+ visible: boolean;
648
+ }
649
+
578
650
  /**
579
651
  * Defines the debugging settings that can be toggled during development.
580
652
  * @category Cfg
@@ -605,10 +677,12 @@ export declare class Engine {
605
677
  private readonly objs3D;
606
678
  private readonly cfg;
607
679
  private readonly infoBox;
680
+ private readonly model;
608
681
  private actionCtrls;
609
682
  private gltf;
610
683
  private mixer;
611
684
  private callbacks;
685
+ private resolveWaitForRender;
612
686
  private canvas;
613
687
  private composer;
614
688
  /* Excluded from this release type: renderer */
@@ -620,6 +694,7 @@ export declare class Engine {
620
694
  private renderPass;
621
695
  private smaaPass;
622
696
  private tslPass;
697
+ private aaNode;
623
698
  /* Excluded from this release type: ssaoPass */
624
699
  /* Excluded from this release type: gtaoNode */
625
700
  /* Excluded from this release type: ssrPass */
@@ -641,6 +716,7 @@ export declare class Engine {
641
716
  private resizeDelay;
642
717
  /* Excluded from this release type: __constructor */
643
718
  /* Excluded from this release type: init */
719
+ private initFirstScene;
644
720
  private initWebGpuRenderer;
645
721
  /**
646
722
  * Registers a callback that is executed on every requestAnimationFrame update.
@@ -665,7 +741,7 @@ export declare class Engine {
665
741
  *
666
742
  * {@link AnimEvent}
667
743
  */
668
- animCamCurveToTarget({ camTarget, aimTarget, radiusOut, duration, ease }: {
744
+ animCamCurveTo({ camTarget, aimTarget, radiusOut, duration, ease }: {
669
745
  camTarget: THREE_TYPE.Vector3 | string | Obj3D;
670
746
  aimTarget?: THREE_TYPE.Vector3 | string | Obj3D;
671
747
  radiusOut?: number;
@@ -689,7 +765,7 @@ export declare class Engine {
689
765
  *
690
766
  * {@link AnimEvent}
691
767
  */
692
- animCamToObj({ target, duration, ease, dist }: {
768
+ animCamTo({ target, duration, ease, dist }: {
693
769
  target: string | Obj3D;
694
770
  duration?: number;
695
771
  ease?: string;
@@ -746,7 +822,7 @@ export declare class Engine {
746
822
  }): void;
747
823
  private calcEaseArea;
748
824
  /**
749
- * Selects the active anti-aliasing mode. The modes `'fxaa'` and `'smaa'` lazy-load their required modules.
825
+ * Selects the active anti-aliasing mode. The modes `'fxaa'`, `'smaa'` and `'traa'` lazy-load their required modules.
750
826
  * @param aaMode - The anti-aliasing mode to use.
751
827
  */
752
828
  enableAaMode(aaMode: Cfg['post']['aa']['mode']): Promise<void>;
@@ -763,7 +839,6 @@ export declare class Engine {
763
839
  private isPostCfg;
764
840
  /* Excluded from this release type: isPostEnabled */
765
841
  private isPostGpu;
766
- private loadScene;
767
842
  /**
768
843
  * Finds a Three.js animation clip by name and plays it through the `THREE.AnimationMixer`.
769
844
  *
@@ -936,7 +1011,7 @@ export declare class Engine {
936
1011
  * @param params.ease - The easing function name for the fade-out transition. Default: **'power1.inOut'**
937
1012
  *
938
1013
  * @remarks
939
- * The method gradually reduces the clip's playback speed to zero when `fadeOut` is greater than zero. It emits `CLIP_SPEED_START`, `CLIP_SPEED_COMPLETE`, and finally `CLIP_CANCEL`.
1014
+ * The method gradually reduces the clip's playback speed to zero when `fadeOut` is greater than zero. It emits `Clip_Speed_Start`, `Clip_Speed_Complete`, and finally `Clip_Cancel`.
940
1015
  * If no speed transition is specified, the clip is canceled immediately.
941
1016
  *
942
1017
  * **Events**
@@ -1096,6 +1171,22 @@ export declare interface EnvCtrlsCfg {
1096
1171
  type: 'hdr' | 'exr' | 'texture';
1097
1172
  }
1098
1173
 
1174
+ declare type EventByType<TEvent extends {
1175
+ type: string;
1176
+ }, TType extends EventType<TEvent>> = Extract<TEvent, {
1177
+ type: TType;
1178
+ }>;
1179
+
1180
+ declare class EventDispatcher<TEvent extends {
1181
+ type: string;
1182
+ }> {
1183
+ private readonly listeners;
1184
+ addEventListener<TType extends EventType<TEvent>>(type: TType, listener: Listener<EventByType<TEvent, TType>>): Unsubscribe;
1185
+ removeEventListener<TType extends EventType<TEvent>>(type: TType, listener: Listener<EventByType<TEvent, TType>>): void;
1186
+ emit(event: TEvent): void;
1187
+ listenerCount<TType extends EventType<TEvent>>(type: TType): number;
1188
+ }
1189
+
1099
1190
  /**
1100
1191
  * Internal event dispatcher for the engine.
1101
1192
  * @category Core
@@ -1106,7 +1197,7 @@ export declare class Events {
1106
1197
  private eventQueue;
1107
1198
  private isProcessingEvents;
1108
1199
  /* Excluded from this release type: __constructor */
1109
- /** Queues callbacks and processes them sequentially to prevent re-entrant or simultaneous access to send(). */
1200
+ /** A nested snapshot.can() is only evaluated after the current event callback has completed. */
1110
1201
  private enqueue;
1111
1202
  /* Excluded from this release type: anim */
1112
1203
  /* Excluded from this release type: animFade */
@@ -1123,6 +1214,10 @@ export declare class Events {
1123
1214
  /* Excluded from this release type: windowResize */
1124
1215
  }
1125
1216
 
1217
+ declare type EventType<TEvent extends {
1218
+ type: string;
1219
+ }> = TEvent['type'];
1220
+
1126
1221
  /**
1127
1222
  * Defines how an animation action behaves after its final loop.
1128
1223
  * - 'hold': Keeps the action enabled and holds its final pose.
@@ -1297,7 +1392,7 @@ export declare interface FpvCtrlsCfg {
1297
1392
  /** @event Fired when an `FpvCtrls` event occurs and triggers the corresponding XState event. */
1298
1393
  export declare interface FpvCtrlsEvent {
1299
1394
  /** Identifies this event type. */
1300
- type: 'FPVCTRLS_DISABLED' | 'FPVCTRLS_ENABLED' | 'FPVCTRLS_LOCK' | 'FPVCTRLS_UNLOCK' | 'FPVCTRLS_DISABLED';
1395
+ type: 'FpvCtrls_Disabled' | 'FpvCtrls_Enabled' | 'FpvCtrls_Lock' | 'FpvCtrls_Unlock';
1301
1396
  }
1302
1397
 
1303
1398
  /**
@@ -1462,6 +1557,11 @@ export declare interface LightCfg {
1462
1557
  * @default true
1463
1558
  */
1464
1559
  castShadow: boolean;
1560
+ /**
1561
+ * Loads and initializes the renderer-specific LTC data required by RectAreaLight.
1562
+ * @default false
1563
+ */
1564
+ rectArea: boolean;
1465
1565
  /**
1466
1566
  * Shadow map resolution along the horizontal axis.
1467
1567
  * @default 512
@@ -1494,6 +1594,8 @@ export declare interface LightCfg {
1494
1594
  far: number;
1495
1595
  }
1496
1596
 
1597
+ declare type Listener<TEvent> = (event: TEvent) => void;
1598
+
1497
1599
  /**
1498
1600
  * Defines how often an animation action is played.
1499
1601
  * - number: Plays the action the specified positive number of times.
@@ -1591,10 +1693,10 @@ export declare interface ModelCfg {
1591
1693
  texture: 'none' | 'webp' | 'ktx2';
1592
1694
  };
1593
1695
  /**
1594
- * The file path of your GLTF/GLB scene model. Set to `null` if no model should be loaded.
1595
- * @default null
1696
+ * An ordered list of non-empty, progressively higher-quality GLTF/GLB scene paths. The first file initializes the scene, subsequent files replace matching mesh geometries and textured materials in order.
1697
+ * @default []
1596
1698
  */
1597
- file: string | null;
1699
+ file: string[];
1598
1700
  /**
1599
1701
  * Public path to the Draco decoder files.
1600
1702
  * @default 'draco/'
@@ -1610,7 +1712,7 @@ export declare interface ModelCfg {
1610
1712
  /** @event Fired when an error occurs while loading model assets and triggers the corresponding XState event. */
1611
1713
  export declare interface ModelErrorEvent {
1612
1714
  /** Identifies this event type. */
1613
- type: 'MODEL_ERROR';
1715
+ type: 'Model_Error';
1614
1716
  /** The caught error object. */
1615
1717
  error: Error;
1616
1718
  }
@@ -1618,9 +1720,11 @@ export declare interface ModelErrorEvent {
1618
1720
  /** @event Fired while model assets are loading and triggers the corresponding XState event. */
1619
1721
  export declare interface ModelLoadingEvent {
1620
1722
  /** Identifies this event type. */
1621
- type: 'MODEL_LOADING';
1723
+ type: 'Model_Loading';
1622
1724
  /** Loading progress in percent (0-100). */
1623
1725
  loading: number;
1726
+ /** One-based index of the model level currently loading. */
1727
+ level: number;
1624
1728
  }
1625
1729
 
1626
1730
  declare class Modules {
@@ -1629,6 +1733,7 @@ declare class Modules {
1629
1733
  fxaaShader: typeof FXAAShader | null;
1630
1734
  smaaPassClass: typeof SMAAPass | null;
1631
1735
  smaaNode: typeof smaa | null;
1736
+ traaNode: typeof traa | null;
1632
1737
  ssaoPassClass: typeof SSAOPass | null;
1633
1738
  gtaoNodeClass: typeof ao | null;
1634
1739
  ssrNode: typeof ssr | null;
@@ -1644,6 +1749,9 @@ declare class Modules {
1644
1749
  outputPassClass: typeof OutputPass | null;
1645
1750
  renderPassClass: typeof RenderPass | null;
1646
1751
  shaderPassClass: typeof ShaderPass | null;
1752
+ rectAreaLightNodeClass: typeof THREE_WEBGPU_TYPE.RectAreaLightNode | null;
1753
+ rectAreaLightTexturesLib: typeof RectAreaLightTexturesLib | null;
1754
+ rectAreaLightUniformsLib: typeof RectAreaLightUniformsLib | null;
1647
1755
  orbitControlsClass: typeof OrbitControls | null;
1648
1756
  pointerLockControlsClass: typeof PointerLockControls | null;
1649
1757
  webGpuRendererClass: typeof THREE_WEBGPU_TYPE.WebGPURenderer | null;
@@ -1651,6 +1759,8 @@ declare class Modules {
1651
1759
  tslPass: typeof THREE_WEBTSL_TYPE.pass | null;
1652
1760
  tslMrt: typeof THREE_WEBTSL_TYPE.mrt | null;
1653
1761
  tslOutput: typeof THREE_WEBTSL_TYPE.output | null;
1762
+ tslVelocity: typeof THREE_WEBTSL_TYPE.velocity | null;
1763
+ tslRenderOutput: typeof THREE_WEBTSL_TYPE.renderOutput | null;
1654
1764
  tslNormalView: typeof THREE_WEBTSL_TYPE.normalView | null;
1655
1765
  tslMetalness: typeof THREE_WEBTSL_TYPE.metalness | null;
1656
1766
  tslRoughness: typeof THREE_WEBTSL_TYPE.roughness | null;
@@ -1677,6 +1787,7 @@ declare class Modules {
1677
1787
  importMeshoptDecoder(): Promise<void>;
1678
1788
  importOrbitCtrls(): Promise<void>;
1679
1789
  importOutputPass(): Promise<void>;
1790
+ importRectAreaLight(webGpu: boolean): Promise<void>;
1680
1791
  importRenderPass(): Promise<void>;
1681
1792
  importSMAANode(aaMode: Cfg['post']['aa']['mode']): Promise<void>;
1682
1793
  importSMAAPass(aaMode: Cfg['post']['aa']['mode']): Promise<void>;
@@ -1686,11 +1797,12 @@ declare class Modules {
1686
1797
  importStatelyAi(): Promise<void>;
1687
1798
  importThreeTsl(): Promise<void>;
1688
1799
  importThreeWebGpu(): Promise<void>;
1800
+ importTRAANode(aaMode: Cfg['post']['aa']['mode']): Promise<void>;
1689
1801
  importTweakpane(): Promise<void>;
1690
1802
  }
1691
1803
 
1692
1804
  /**
1693
- * Wraps a `THREE.Object3D` and provides lifecycle hooks, scene integration, animation support, and position-change events. Extend this class to implement custom object behavior.
1805
+ * Wraps a `THREE.Object3D` and provides lifecycle hooks, scene integration, animation support, and position-, rotation- and visibility-change events. Extend this class to implement custom object behavior.
1694
1806
  * @category 3D Objects
1695
1807
  */
1696
1808
  export declare class Obj3D {
@@ -1714,17 +1826,23 @@ export declare class Obj3D {
1714
1826
  * @public
1715
1827
  */
1716
1828
  protected scene: Readonly<THREE_TYPE.Scene>;
1717
- /** Whether occlusion checking is enabled for this object. Default: **false** */
1718
- enableOcclusionCheck: boolean;
1719
- private readonly eventDispatcher;
1829
+ /* Excluded from this release type: eventDispatcher */
1830
+ private posNdc;
1720
1831
  private posScreen;
1721
1832
  private posScreenLast;
1722
1833
  private posWorld;
1723
1834
  private posWorldLast;
1835
+ private posCamWorld;
1836
+ private posWorldOccl;
1837
+ private posCamWorldOccl;
1838
+ private quatWorld;
1839
+ private quatWorldLast;
1840
+ private rotWorld;
1724
1841
  private visible;
1725
1842
  private visibleFrustum;
1843
+ private visibleFrustumLast;
1726
1844
  private visibleLast;
1727
- /* Excluded from this release type: visibleOcclusion */
1845
+ private visibleOccl;
1728
1846
  /* Excluded from this release type: __constructor */
1729
1847
  /**
1730
1848
  * Registers a listener that is called whenever the specified event occurs.
@@ -1735,20 +1853,23 @@ export declare class Obj3D {
1735
1853
  addEventListener<TType extends Obj3DEvent['type']>(type: TType, listener: (event: Extract<Obj3DEvent, {
1736
1854
  type: TType;
1737
1855
  }>) => void): Unsubscribe;
1738
- private calcScreenPos;
1739
- protected checkWorldAndScreenPos(cam3D: Cam3D, obj: THREE_TYPE.Object3D): void;
1740
- protected checkVisible(): void;
1856
+ private calcFrustumVisibility;
1857
+ private calcPosScreen;
1858
+ /* Excluded from this release type: calcPosWorld */
1859
+ private calcPosOccl;
1860
+ private calcRotWorld;
1861
+ private calcVisibility;
1741
1862
  /* Excluded from this release type: emitEvent */
1742
1863
  /**
1743
1864
  * Returns the object's screen position in canvas coordinates.
1744
1865
  * @param cam3D - Camera used for projection to canvas coordinates.
1745
1866
  * @returns The projected screen position in canvas coordinates, or `null` if no `THREE.Object3D` is assigned.
1746
1867
  */
1747
- getScreenPosition(cam3D: Cam3D): {
1868
+ getScreenPos(cam3D: Cam3D): {
1748
1869
  x: number;
1749
1870
  y: number;
1750
1871
  } | null;
1751
- private isVisibleFrustum;
1872
+ /* Excluded from this release type: hasEventListener */
1752
1873
  /**
1753
1874
  * 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.
1754
1875
  * @public
@@ -1780,7 +1901,7 @@ export declare class Obj3D {
1780
1901
  removeEventListener<TType extends Obj3DEvent['type']>(type: TType, listener: (event: Extract<Obj3DEvent, {
1781
1902
  type: TType;
1782
1903
  }>) => void): void;
1783
- private resetEventStateIfNoListeners;
1904
+ private resetEventState;
1784
1905
  /* Excluded from this release type: start */
1785
1906
  /* Excluded from this release type: traverse */
1786
1907
  /* Excluded from this release type: update */
@@ -1790,7 +1911,15 @@ export declare class Obj3D {
1790
1911
  export declare type Obj3DClass = new (canvas: HTMLElement, cfg: Cfg, name: string) => Objs3D;
1791
1912
 
1792
1913
  /** Defines all event types supported by `Obj3D.addEventListener`. */
1793
- export declare type Obj3DEvent = Obj3DPosWorldEvent | Obj3DPosScreenEvent | Obj3DVisibleEvent | Obj3DPointerEvent;
1914
+ export declare type Obj3DEvent = Obj3DPosWorldEvent | Obj3DPosScreenEvent | Obj3DRotWorldEvent | Obj3DFrustumEvent | Obj3DVisibleEvent | Obj3DPointerEvent;
1915
+
1916
+ /** @event Fired when the frustum visibility of a 3D object changes. */
1917
+ export declare interface Obj3DFrustumEvent {
1918
+ /** Identifies this event type. */
1919
+ type: 'Obj3D_Frustum_Changed';
1920
+ /** Whether the object's world position is inside the camera frustum. */
1921
+ visibleFrustum: boolean;
1922
+ }
1794
1923
 
1795
1924
  /**
1796
1925
  * Maps a record of Obj3D classes to a record of typed object instances.
@@ -1804,44 +1933,48 @@ export declare type Obj3DInsts<T extends Record<string, Obj3DClass>> = {
1804
1933
  /** @event Fired when the user uses the pointer on an active object and triggers the corresponding XState event. */
1805
1934
  export declare interface Obj3DPointerEvent {
1806
1935
  /** Identifies this event type. */
1807
- type: 'OBJ3D_CLICK' | 'OBJ3D_POINTER_ENTER' | 'OBJ3D_POINTER_DOWN' | 'OBJ3D_POINTER_LEAVE' | 'OBJ3D_POINTER_MOVE' | 'OBJ3D_POINTER_UP';
1936
+ type: 'Obj3D_Click' | 'Obj3D_Pointer_Enter' | 'Obj3D_Pointer_Down' | 'Obj3D_Pointer_Leave' | 'Obj3D_Pointer_Move' | 'Obj3D_Pointer_Up';
1808
1937
  /** Native pointer event from the active object interaction. */
1809
1938
  event: PointerEvent;
1810
- /** The name of the object whose selected state changed. */
1939
+ /** The name of the object receiving the pointer event. */
1811
1940
  objName: string;
1812
1941
  }
1813
1942
 
1814
- /** @event Fired when the screen position of a 3D object changes and triggers the corresponding XState event. */
1943
+ /**
1944
+ * @event Fired when the screen position of a 3D object changes.
1945
+ */
1815
1946
  export declare interface Obj3DPosScreenEvent {
1816
1947
  /** Identifies this event type. */
1817
- type: 'OBJ3D_POS_SCREEN_CHANGED';
1948
+ type: 'Obj3D_Pos_Screen_Changed';
1818
1949
  /** The object's position projected into screen space. */
1819
1950
  posScreen: THREE_TYPE.Vector2;
1820
1951
  }
1821
1952
 
1822
- /** @event Fired when the world position of a 3D object changes and triggers the corresponding XState event. */
1953
+ /**
1954
+ * @event Fired when the world position of a 3D object changes.
1955
+ */
1823
1956
  export declare interface Obj3DPosWorldEvent {
1824
1957
  /** Identifies this event type. */
1825
- type: 'OBJ3D_POS_WORLD_CHANGED';
1958
+ type: 'Obj3D_Pos_World_Changed';
1826
1959
  /** The object's position in world coordinates. */
1827
1960
  posWorld: THREE_TYPE.Vector3;
1828
1961
  }
1829
1962
 
1830
- /** @event Fired when the world or screen rotation of a 3D object changes and triggers the corresponding XState event. */
1963
+ /**
1964
+ * @event Fired when the world rotation of a 3D object changes.
1965
+ */
1831
1966
  export declare interface Obj3DRotWorldEvent {
1832
1967
  /** Identifies this event type. */
1833
- type: 'OBJ3D_ROT_WORLD_CHANGED';
1968
+ type: 'Obj3D_Rot_World_Changed';
1834
1969
  /** The object's rotation in world coordinates. */
1835
1970
  rotWorld: THREE_TYPE.Euler;
1836
- /** The object's rotation projected into screen space. */
1837
- rotScreen: THREE_TYPE.Euler;
1838
1971
  }
1839
1972
 
1840
- /** @event Fired when the visibility of a 3D object changes and triggers the corresponding XState event. */
1973
+ /** @event Fired when the combined frustum and occlusion visibility of a 3D object changes and triggers the corresponding XState event. */
1841
1974
  export declare interface Obj3DVisibleEvent {
1842
1975
  /** Identifies this event type. */
1843
- type: 'OBJ3D_VISIBLE_CHANGED';
1844
- /** The object's visibility status. */
1976
+ type: 'Obj3D_Visible_Changed';
1977
+ /** Whether the object is inside the camera frustum and not occluded. */
1845
1978
  visible: boolean;
1846
1979
  }
1847
1980
 
@@ -1988,7 +2121,7 @@ export declare interface OrbitCtrlsCfg {
1988
2121
  /** @event Fired when an OrbitControls event occurs and triggers the corresponding XState event. */
1989
2122
  export declare interface OrbitCtrlsEvent {
1990
2123
  /** Identifies this event type. */
1991
- type: 'ORBITCTRLS_CHANGED' | 'ORBITCTRLS_DISABLED' | 'ORBITCTRLS_ENABLED' | 'ORBITCTRLS_END' | 'ORBITCTRLS_START' | 'ORBITCTRLS_DISPOSED';
2124
+ type: 'OrbitCtrls_Changed' | 'OrbitCtrls_Disabled' | 'OrbitCtrls_Enabled' | 'OrbitCtrls_End' | 'OrbitCtrls_Start' | 'OrbitCtrls_Disposed';
1992
2125
  }
1993
2126
 
1994
2127
  /**
@@ -2031,7 +2164,7 @@ export declare interface PostCfg {
2031
2164
  /** @event Fired after the progress bar has finished hiding and triggers the corresponding XState event. */
2032
2165
  export declare interface ProgressBarHiddenEvent {
2033
2166
  /** Identifies this event type. */
2034
- type: 'PROGRESSBAR_HIDDEN';
2167
+ type: 'ProgressBar_Hidden';
2035
2168
  }
2036
2169
 
2037
2170
  /**
@@ -2045,16 +2178,20 @@ export declare class Raycast {
2045
2178
  private readonly canvas;
2046
2179
  private readonly cfg;
2047
2180
  private readonly engine;
2048
- private readonly events;
2049
2181
  private readonly objs3D;
2050
- private raycasterSelect;
2182
+ private raycasterPick;
2051
2183
  private raycasterVisible;
2052
- private objsSelectTracked;
2184
+ private objsOccluders;
2185
+ private readonly objsOccls;
2186
+ private readonly objsPickables;
2053
2187
  private objActive;
2054
2188
  private objCandidate;
2055
2189
  private closestObjCounter;
2190
+ private indexOcclNext;
2191
+ private timeOcclNext;
2056
2192
  private isEnabled;
2057
- private callback;
2193
+ private callbackOccls;
2194
+ private callbackPointerHover;
2058
2195
  private listenerClick;
2059
2196
  private listenerCancel;
2060
2197
  private listenerDown;
@@ -2068,18 +2205,14 @@ export declare class Raycast {
2068
2205
  private dirCamToObj;
2069
2206
  private posNdcPointer;
2070
2207
  /* Excluded from this release type: __constructor */
2208
+ private checkOcclVisible;
2071
2209
  /** Enables pointer-based raycasting and adds all necessary pointer event listeners and the frame update callback. */
2072
2210
  enable(): void;
2073
2211
  /** Disables pointer-based raycasting and removes all pointer event listeners and the frame update callback. */
2074
2212
  disable(): void;
2075
- private getObjectAtPointer;
2076
- /**
2077
- * Checks whether an object's world position is visible from the active camera without being occluded.
2078
- *
2079
- * @param obj - The object whose visibility should be tested.
2080
- * @returns `true` if no other object blocks the line of sight to the object's world position, otherwise `false`.
2081
- */
2082
- isVisibleOcclusion(obj: THREE_TYPE.Object3D): boolean;
2213
+ private getObjAtPointer;
2214
+ private getOcclState;
2215
+ /* Excluded from this release type: getOcclVisible */
2083
2216
  private onCanvasClick;
2084
2217
  private onCanvasPointerLeave;
2085
2218
  private onCanvasPointerMove;
@@ -2090,6 +2223,19 @@ export declare class Raycast {
2090
2223
  private onPointerEnter;
2091
2224
  private onPointerLeave;
2092
2225
  private onPointerMove;
2226
+ /* Excluded from this release type: resetOcclState */
2227
+ /** Removes the explicit occlusion-object restriction so that all scene objects are checked again. */
2228
+ resetOccluders(): void;
2229
+ /**
2230
+ * Restricts occlusion raycasts to the specified scene objects. Without an explicit restriction, all scene objects are checked.
2231
+ *
2232
+ * @param params - Parameter object.
2233
+ * @param params.objs3D - The `Obj3D` instances that may block visibility.
2234
+ */
2235
+ setOccluders({ objs3D }: {
2236
+ objs3D: Obj3D[];
2237
+ }): void;
2238
+ /* Excluded from this release type: trackOccl */
2093
2239
  /**
2094
2240
  * 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
2095
2241
  * (`pointermove`, `click`, `pointercancel`, `pointerdown`, `pointerleave`, `pointerup`).
@@ -2097,33 +2243,45 @@ export declare class Raycast {
2097
2243
  * @param params - Parameter object.
2098
2244
  * @param params.objs3D - The `Obj3D` instances to track.
2099
2245
  */
2100
- trackSelectables({ objs3D }: {
2246
+ trackPickables({ objs3D }: {
2101
2247
  objs3D: Obj3D[];
2102
2248
  }): void;
2103
- /**
2104
- * Registers and executes a low-level extension function with access to the public `Raycast` API.
2105
- * @param extension - Function that receives the current `Raycast` instance and can use its public members and methods.
2106
- * @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.
2107
- */
2108
- use(extension: (raycast: Raycast) => void): void;
2249
+ /* Excluded from this release type: untrackOccl */
2109
2250
  /**
2110
2251
  * Stops tracking the specified scene objects for ray intersection detection. It automatically removes the pointer event listeners if no tracked objects remain.
2111
2252
  *
2112
2253
  * @param params - Parameter object.
2113
2254
  * @param params.objs3D - The `Obj3D` instances to untrack.
2114
2255
  */
2115
- untrackSelectable({ objs3D }: {
2256
+ untrackPickables({ objs3D }: {
2116
2257
  objs3D: Obj3D[];
2117
2258
  }): void;
2118
- /* Excluded from this release type: updatePointerHover */
2259
+ /**
2260
+ * Registers and executes a low-level extension function with access to the public `Raycast` API.
2261
+ * @param extension - Function that receives the current `Raycast` instance and can use its public members and methods.
2262
+ * @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.
2263
+ */
2264
+ use(extension: (raycast: Raycast) => void): void;
2265
+ private updateOccls;
2266
+ private updatePointerHover;
2119
2267
  private updatePointerPosition;
2120
2268
  }
2121
2269
 
2122
2270
  /**
2123
- * Defines the raycasting settings used to detect selectable objects around the pointer.
2271
+ * Defines the raycasting settings used to detect pickable objects around the pointer.
2124
2272
  * @category Cfg
2125
2273
  */
2126
2274
  export declare interface RaycastCfg {
2275
+ /**
2276
+ * Time in milliseconds over which all pending occlusion checks are distributed once. A value of `0` processes all pending checks in one frame.
2277
+ * @default 0
2278
+ */
2279
+ occlInterval: number;
2280
+ /**
2281
+ * Relative movement threshold used to request a new occlusion check. The value is multiplied by the current distance between the camera and the tracked object. A value of `0` reacts to every position change.
2282
+ * @default 0.01
2283
+ */
2284
+ occlMoveFactor: number;
2127
2285
  /**
2128
2286
  * Circle radius around the pointer in pixels.
2129
2287
  * @default 10
@@ -2224,7 +2382,7 @@ export declare interface RenderCfg {
2224
2382
  * Whether renderer-level anti-aliasing is enabled.
2225
2383
  * @default false
2226
2384
  */
2227
- aa: boolean;
2385
+ antialias: boolean;
2228
2386
  };
2229
2387
  /**
2230
2388
  * WebGL-specific renderer configuration.
@@ -2275,13 +2433,13 @@ export declare interface SceneCfg {
2275
2433
  /** @event Fired when the scene is set up and ready and triggers the corresponding XState event. */
2276
2434
  export declare interface SceneReadyEvent {
2277
2435
  /** Identifies this event type. */
2278
- type: 'SCENE_READY';
2436
+ type: 'Scene_Ready';
2279
2437
  }
2280
2438
 
2281
2439
  /** @event Fired after the scene has been rendered for the first time and triggers the corresponding XState event. */
2282
2440
  export declare interface SceneRenderedEvent {
2283
2441
  /** Identifies this event type. */
2284
- type: 'SCENE_RENDERED';
2442
+ type: 'Scene_Rendered';
2285
2443
  }
2286
2444
 
2287
2445
  /**
@@ -2413,6 +2571,21 @@ export declare interface SsrCfg {
2413
2571
  * @default false
2414
2572
  */
2415
2573
  guiOpened: boolean;
2574
+ /**
2575
+ * Controls the maximum distance a fragment can reflect.
2576
+ * @default 180
2577
+ */
2578
+ maxDistance: number;
2579
+ /**
2580
+ * Controls the cutoff thickness in reflection calculations.
2581
+ * @default 0.018
2582
+ */
2583
+ thickness: number;
2584
+ /**
2585
+ * Resolution scale for effect computation.
2586
+ * @default 1
2587
+ */
2588
+ resolutionScale: number;
2416
2589
  }
2417
2590
 
2418
2591
  /**
@@ -2440,31 +2613,16 @@ export declare interface SsrWebGlCfg {
2440
2613
  * @default false
2441
2614
  */
2442
2615
  infiniteThick: boolean;
2443
- /**
2444
- * Controls the maximum distance a fragment can reflect.
2445
- * @default 180
2446
- */
2447
- maxDistance: number;
2448
2616
  /**
2449
2617
  * Reflection opacity value.
2450
2618
  * @default 0.5
2451
2619
  */
2452
2620
  opacity: number;
2453
- /**
2454
- * Controls the cutoff thickness in reflection calculations.
2455
- * @default 0.018
2456
- */
2457
- thickness: number;
2458
2621
  /**
2459
2622
  * Enables blur on reflections.
2460
2623
  * @default true
2461
2624
  */
2462
2625
  blur: boolean;
2463
- /**
2464
- * Resolution scale for effect computation.
2465
- * @default 1
2466
- */
2467
- resolutionScale: number;
2468
2626
  /**
2469
2627
  * Output configuration of the SSR pass.
2470
2628
  * @default 0
@@ -2492,36 +2650,11 @@ export declare interface SsrWebGlCfg {
2492
2650
  * @category Cfg
2493
2651
  */
2494
2652
  export declare interface SsrWebGpuCfg {
2495
- /**
2496
- * Enables distance-based attenuation of reflections.
2497
- * @default true
2498
- */
2499
- distanceAttenuation: boolean;
2500
- /**
2501
- * Enables fresnel-based reflections.
2502
- * @default true
2503
- */
2504
- fresnel: boolean;
2505
- /**
2506
- * Maximum SSR ray distance.
2507
- * @default 180
2508
- */
2509
- maxDistance: number;
2510
2653
  /**
2511
2654
  * Reflection intensity value.
2512
2655
  * @default 0.5
2513
2656
  */
2514
2657
  intensity: number;
2515
- /**
2516
- * Ray thickness used for SSR intersection tests.
2517
- * @default 0.018
2518
- */
2519
- thickness: number;
2520
- /**
2521
- * SSR render resolution scale.
2522
- * @default 1
2523
- */
2524
- resolutionScale: number;
2525
2658
  /**
2526
2659
  * SSR quality factor.
2527
2660
  * @default 0.5
@@ -2587,7 +2720,7 @@ export declare type WebGpuRendererParams = NonNullable<ConstructorParameters<typ
2587
2720
  /** @event Fired when the window size changes and triggers the corresponding XState event. */
2588
2721
  export declare interface WindowResizeEvent {
2589
2722
  /** Identifies this event type. */
2590
- type: 'WINDOW_RESIZE';
2723
+ type: 'Window_Resize';
2591
2724
  }
2592
2725
 
2593
2726
  export { }