illutions 0.24.1 → 0.26.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,12 +45,14 @@ 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
 
54
+ export declare type ActionFadeMode = 'in' | 'out';
55
+
51
56
  /**
52
57
  * Defines the ambient light settings controlling global scene illumination.
53
58
  * @category Cfg
@@ -95,12 +100,13 @@ export declare interface AnimFadeEvent {
95
100
  }
96
101
 
97
102
  /**
98
- * 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.
99
104
  * It provides an entry point for creating and controlling a complete 3D scene.
100
105
  * @category Core
101
106
  */
102
107
  export declare class App<TClasses extends Classes = {}> {
103
108
  readonly audio: Audio_2;
109
+ private readonly compCtrls;
104
110
  readonly engine: Engine;
105
111
  readonly envCtrls: EnvCtrls;
106
112
  readonly events: Events;
@@ -296,8 +302,8 @@ export declare interface AudioLoadedEvent {
296
302
 
297
303
  /**
298
304
  * Defines how an animation action is blended with other active actions.
299
- * - `'normal'`: Blends the action's values with other normal actions according to their weights.
300
- * - `'additive'`: Adds the action's values to the current animation result according to its weight.
305
+ * - 'normal': Blends the action's values with other normal actions according to their weights.
306
+ * - 'additive': Adds the action's values to the current animation result according to its weight.
301
307
  */
302
308
  export declare type BlendMode = 'normal' | 'additive';
303
309
 
@@ -457,6 +463,8 @@ export declare interface Cfg {
457
463
  audio: AudioCfg;
458
464
  /** Camera settings. */
459
465
  cam: CamCfg;
466
+ /** Component settings. */
467
+ comps: CompsCfg;
460
468
  /** Debug settings. */
461
469
  debug: DebugCfg;
462
470
  /** Environment controls settings. */
@@ -502,28 +510,18 @@ export declare type Classes<TObj3DClasses extends Record<string, Obj3DClass> = {
502
510
  comps?: TCompClasses;
503
511
  };
504
512
 
505
- /** @event Fired when a clip starts or finishes playing and triggers the corresponding XState event. */
513
+ /** @event Fired when a clip starts, completes, is canceled, fades its weight, or changes its playback speed. */
506
514
  export declare interface ClipEvent {
507
515
  /** Identifies this event type. */
508
- type: 'CLIP_START' | 'CLIP_COMPLETE';
509
- /** The name of the `THREE.AnimationClip` that 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
- /** @event Fired when a clip fade starts, completes, or fade-out starts/completes and triggers the corresponding XState event. */
518
- export declare interface ClipFadeEvent {
519
- /** Identifies this event type. */
520
- type: 'CLIP_FADE_START' | 'CLIP_FADE_COMPLETE' | 'CLIP_FADEOUT_COMPLETE' | 'CLIP_FADEOUT_START';
521
- /** The name of the `THREE.AnimationClip` whose fade changed state. */
516
+ type: 'CLIP_START' | 'CLIP_COMPLETE' | 'CLIP_CANCEL' | 'CLIP_FADE_START' | 'CLIP_FADE_COMPLETE' | 'CLIP_SPEED_START' | 'CLIP_SPEED_COMPLETE';
517
+ /** The name of the affected `THREE.AnimationClip`. */
522
518
  clipName: string;
523
519
  /** The name of the calling method. */
524
520
  fct: string;
525
521
  /** The associated animation action, when available. */
526
522
  action?: THREE_TYPE.AnimationAction;
523
+ /** Whether the clip weight is fading in or out. */
524
+ fadeMode?: ActionFadeMode;
527
525
  }
528
526
 
529
527
  declare type ColorNode = THREE_WEBGPU_TYPE.Node<'vec4'>;
@@ -539,21 +537,31 @@ export declare class Comp extends HTMLElement {
539
537
  comps: Map<string, Comp[]> | null;
540
538
  events: Readonly<Events>;
541
539
  objs3D: Map<string, Obj3D>;
542
- private unsubFollow;
543
- private unsubVisible;
544
- /**
545
- * 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.
546
551
  *
547
552
  * @param params - The follow parameters.
548
553
  * @param params.obj - The `Obj3D` to follow in the scene.
549
- * @param params.enableOcclusionCheck - Whether to enable occlusion visibility checks. Default: **false**
550
554
  */
551
- follow({ obj, enableOcclusionCheck }: {
555
+ follow({ obj }: {
552
556
  obj: Obj3D | string;
553
- enableOcclusionCheck?: boolean;
554
557
  }): void;
555
- /** Stops this component from following the currently subscribed {@link Obj3D}. */
556
- 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;
557
565
  /**
558
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.
559
567
  * @public
@@ -568,12 +576,27 @@ export declare class Comp extends HTMLElement {
568
576
  */
569
577
  protected onStart(): void;
570
578
  /* Excluded from this release type: ready */
579
+ /* Excluded from this release type: setVisibleOverlap */
571
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;
572
591
  }
573
592
 
574
593
  /** Constructor type for `Comp` classes. */
575
594
  export declare type CompClass = new () => Comp;
576
595
 
596
+ /* Excluded from this release type: CompCtrls */
597
+
598
+ export declare type CompEvent = CompOverlapEvent | CompVisibleEvent;
599
+
577
600
  /**
578
601
  * Maps a record of Comp classes to a record of component instance arrays.
579
602
  * { key1: typeof Comp1 } -> { key1: Comp1[] }
@@ -583,6 +606,47 @@ export declare type CompInsts<T extends Record<string, CompClass>> = {
583
606
  [K in keyof T]: InstanceType<T[K]>[];
584
607
  };
585
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
+
586
650
  /**
587
651
  * Defines the debugging settings that can be toggled during development.
588
652
  * @category Cfg
@@ -610,12 +674,10 @@ export declare class Engine {
610
674
  private readonly cam3D;
611
675
  private readonly events;
612
676
  private readonly modules;
613
- private readonly comps;
614
677
  private readonly objs3D;
615
678
  private readonly cfg;
616
679
  private readonly infoBox;
617
- private actionObserver;
618
- private readonly objActions;
680
+ private actionCtrls;
619
681
  private gltf;
620
682
  private mixer;
621
683
  private callbacks;
@@ -630,6 +692,7 @@ export declare class Engine {
630
692
  private renderPass;
631
693
  private smaaPass;
632
694
  private tslPass;
695
+ private aaNode;
633
696
  /* Excluded from this release type: ssaoPass */
634
697
  /* Excluded from this release type: gtaoNode */
635
698
  /* Excluded from this release type: ssrPass */
@@ -652,7 +715,6 @@ export declare class Engine {
652
715
  /* Excluded from this release type: __constructor */
653
716
  /* Excluded from this release type: init */
654
717
  private initWebGpuRenderer;
655
- private addActionToObj;
656
718
  /**
657
719
  * Registers a callback that is executed on every requestAnimationFrame update.
658
720
  * @param {(deltaTime: number) => void} cb - Callback executed once per frame with `deltaTime`.
@@ -676,7 +738,7 @@ export declare class Engine {
676
738
  *
677
739
  * {@link AnimEvent}
678
740
  */
679
- animCamCurveToTarget({ camTarget, aimTarget, radiusOut, duration, ease }: {
741
+ animCamCurveTo({ camTarget, aimTarget, radiusOut, duration, ease }: {
680
742
  camTarget: THREE_TYPE.Vector3 | string | Obj3D;
681
743
  aimTarget?: THREE_TYPE.Vector3 | string | Obj3D;
682
744
  radiusOut?: number;
@@ -700,7 +762,7 @@ export declare class Engine {
700
762
  *
701
763
  * {@link AnimEvent}
702
764
  */
703
- animCamToObj({ target, duration, ease, dist }: {
765
+ animCamTo({ target, duration, ease, dist }: {
704
766
  target: string | Obj3D;
705
767
  duration?: number;
706
768
  ease?: string;
@@ -756,10 +818,8 @@ export declare class Engine {
756
818
  [key: string]: any;
757
819
  }): void;
758
820
  private calcEaseArea;
759
- private stopObjActions;
760
- private finishAction;
761
821
  /**
762
- * Selects the active anti-aliasing mode. The modes `'fxaa'` and `'smaa'` lazy-load their required modules.
822
+ * Selects the active anti-aliasing mode. The modes `'fxaa'`, `'smaa'` and `'traa'` lazy-load their required modules.
763
823
  * @param aaMode - The anti-aliasing mode to use.
764
824
  */
765
825
  enableAaMode(aaMode: Cfg['post']['aa']['mode']): Promise<void>;
@@ -781,35 +841,37 @@ export declare class Engine {
781
841
  * Finds a Three.js animation clip by name and plays it through the `THREE.AnimationMixer`.
782
842
  *
783
843
  * @param params - Parameters for controlling the animation playback.
784
- * @param params.obj - The name of the object whose animation clip should be played.
844
+ * @param params.layer - The freely named layer used to group animation actions.
785
845
  * @param params.clip - The name of the animation clip to play.
786
846
  * @param params.blendMode - How the action is blended with other active actions. Default: **'normal'**
787
847
  * @param params.finishMode - Whether the final pose is held or faded out after the final loop. Default: **'hold'**
788
- * @param params.loop - Number of plays or `'infinite'` for endless looping. Default: **1**
789
- * @param params.stopMode - Which previous actions of the same object are stopped before playback. Default: **'all'**
848
+ * @param params.loopMode - Number of plays or `'infinite'` for endless looping. Default: **1**
849
+ * @param params.stopMode - Which previous actions of the same layer are stopped before playback. Default: **'all'**
790
850
  * @param params.fadeDuration - Duration in seconds for fading affected previous actions out and the new action in. Default: **0**
791
851
  * @param params.fadeDurationFinish - Duration in seconds for `finishMode: 'fadeOut'`. Default: **0**
792
852
  * @param params.reverse - If `true`, plays the clip in reverse. Default: **false**
793
- * @param params.reset - If `true`, resets the clip before playback. Default: **false**
853
+ * @param params.reset - If `true`, resets the clip before a new playback. Default: **false**
794
854
  * @param params.startSpeed - Initial playback speed for speed interpolation. Default: **0**
795
855
  * @param params.endSpeed - Target playback speed. Default: **1**
796
856
  * @param params.duration - Duration in seconds for speed interpolation. Default: **0**
797
857
  * @param params.ease - GSAP easing function name. Default: **'power1.inOut'**
798
858
  *
799
859
  * @remarks
800
- * `finishMode` and `fadeDurationFinish` have no effect when `loop` is `'infinite'`.
860
+ * Calling a running or fading-in action again is ignored. A finished or stopped action starts again, while an unfinished fading-out action continues at its current time and fades back in from its current weight.
861
+ *
862
+ * `finishMode` and `fadeDurationFinish` have no effect when `loopMode` is `'infinite'`.
801
863
  *
802
864
  * **Events**
803
865
  *
804
866
  * {@link ClipEvent}
805
867
  */
806
- playClip({ obj, clip: clipName, blendMode, finishMode, loop, stopMode, fadeDuration, fadeDurationFinish, reverse, reset, startSpeed, endSpeed, duration, ease }: {
807
- obj: string;
868
+ playClip({ layer, clip: clipName, blendMode, finishMode, loopMode, stopMode, fadeDuration, fadeDurationFinish, reverse, reset, startSpeed, endSpeed, duration, ease }: {
869
+ layer: string;
808
870
  clip: string;
809
871
  singleAction?: boolean;
810
872
  blendMode?: BlendMode;
811
873
  finishMode?: FinishMode;
812
- loop?: LoopMode;
874
+ loopMode?: LoopMode;
813
875
  stopMode?: StopMode;
814
876
  fadeDuration?: number;
815
877
  fadeDurationFinish?: number;
@@ -824,30 +886,31 @@ export declare class Engine {
824
886
  * Finds a camera animation clip by name and plays it through the `THREE.AnimationMixer`.
825
887
  *
826
888
  * @param params - Parameters for controlling the camera animation playback.
827
- * @param params.obj - The name of the camera object whose animation clip should be played.
889
+ * @param params.layer - The freely named layer used to group camera animation actions.
828
890
  * @param params.clip - The name of the camera animation clip to play.
829
891
  * @param params.blendMode - How the action is blended with other active actions. Default: **'normal'**
830
- * @param params.loop - Number of plays or `'infinite'` for endless looping. Default: **1**
831
- * @param params.stopMode - Which previous actions of the same object are stopped before playback. Default: **'all'**
892
+ * @param params.loopMode - Number of plays or `'infinite'` for endless looping. Default: **1**
893
+ * @param params.stopMode - Which previous actions of the same layer are stopped before playback. Default: **'all'**
832
894
  * @param params.fadeDuration - Duration in seconds for fading affected previous actions out and the new action in. Default: **0**
833
-
834
895
  * @param params.reverse - If `true`, plays the clip in reverse. Default: **false**
835
- * @param params.reset - If `true`, resets the clip before playback. Default: **false**
896
+ * @param params.reset - If `true`, resets the clip before a new playback. Default: **false**
836
897
  * @param params.startSpeed - Initial playback speed for speed interpolation. Default: **0**
837
898
  * @param params.endSpeed - Target playback speed. Default: **1**
838
899
  * @param params.duration - Duration in seconds for speed interpolation. Default: **0**
839
900
  * @param params.ease - GSAP easing function name. Default: **'power1.inOut'**
840
901
  *
841
-
902
+ * @remarks
903
+ * Calling a running or fading-in action again is ignored. A finished or stopped action starts again, while an unfinished fading-out action continues at its current time and fades back in from its current weight.
904
+ *
842
905
  * **Events**
843
906
  *
844
907
  * {@link ClipEvent}
845
908
  */
846
- playClipCam({ obj, clip: clipName, blendMode, loop, stopMode, fadeDuration, reverse, reset, startSpeed, endSpeed, duration, ease }: {
847
- obj: string;
909
+ playClipCam({ layer, clip: clipName, blendMode, loopMode, stopMode, fadeDuration, reverse, reset, startSpeed, endSpeed, duration, ease }: {
910
+ layer: string;
848
911
  clip: string;
849
912
  blendMode?: BlendMode;
850
- loop?: LoopMode;
913
+ loopMode?: LoopMode;
851
914
  stopMode?: StopMode;
852
915
  fadeDuration?: number;
853
916
  reverse?: boolean;
@@ -946,12 +1009,12 @@ export declare class Engine {
946
1009
  * @param params.ease - The easing function name for the fade-out transition. Default: **'power1.inOut'**
947
1010
  *
948
1011
  * @remarks
949
- * 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`
950
- * is emitted. If no fade-out is specified, the clip stops immediately.
1012
+ * 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`.
1013
+ * If no speed transition is specified, the clip is canceled immediately.
951
1014
  *
952
1015
  * **Events**
953
1016
  *
954
- * {@link ClipFadeEvent}
1017
+ * {@link ClipEvent}
955
1018
  */
956
1019
  stopAnimClip({ clipName, fadeOut, ease }: {
957
1020
  clipName: string;
@@ -1122,7 +1185,6 @@ export declare class Events {
1122
1185
  /* Excluded from this release type: animFade */
1123
1186
  /* Excluded from this release type: audioLoaded */
1124
1187
  /* Excluded from this release type: clip */
1125
- /* Excluded from this release type: clipFade */
1126
1188
  /* Excluded from this release type: modelError */
1127
1189
  /* Excluded from this release type: modelLoading */
1128
1190
  /**
@@ -1136,8 +1198,8 @@ export declare class Events {
1136
1198
 
1137
1199
  /**
1138
1200
  * Defines how an animation action behaves after its final loop.
1139
- * - `'hold'`: Keeps the action enabled and holds its final pose.
1140
- * - `'fadeOut'`: Fades the action out using `fadeDurationFinish`, or disables it immediately when the duration is `0`.
1201
+ * - 'hold': Keeps the action enabled and holds its final pose.
1202
+ * - 'fadeOut': Fades the action out using fadeDurationFinish, or disables it immediately when the duration is 0.
1141
1203
  */
1142
1204
  export declare type FinishMode = 'hold' | 'fadeOut';
1143
1205
 
@@ -1308,7 +1370,7 @@ export declare interface FpvCtrlsCfg {
1308
1370
  /** @event Fired when an `FpvCtrls` event occurs and triggers the corresponding XState event. */
1309
1371
  export declare interface FpvCtrlsEvent {
1310
1372
  /** Identifies this event type. */
1311
- type: 'FPVCTRLS_DISABLED' | 'FPVCTRLS_ENABLED' | 'FPVCTRLS_LOCK' | 'FPVCTRLS_UNLOCK' | 'FPVCTRLS_DISABLED';
1373
+ type: 'FPVCTRLS_DISABLED' | 'FPVCTRLS_ENABLED' | 'FPVCTRLS_LOCK' | 'FPVCTRLS_UNLOCK';
1312
1374
  }
1313
1375
 
1314
1376
  /**
@@ -1473,6 +1535,11 @@ export declare interface LightCfg {
1473
1535
  * @default true
1474
1536
  */
1475
1537
  castShadow: boolean;
1538
+ /**
1539
+ * Loads and initializes the renderer-specific LTC data required by RectAreaLight.
1540
+ * @default false
1541
+ */
1542
+ rectArea: boolean;
1476
1543
  /**
1477
1544
  * Shadow map resolution along the horizontal axis.
1478
1545
  * @default 512
@@ -1507,8 +1574,8 @@ export declare interface LightCfg {
1507
1574
 
1508
1575
  /**
1509
1576
  * Defines how often an animation action is played.
1510
- * - `number`: Plays the action the specified positive number of times.
1511
- * - `'infinite'`: Repeats the action indefinitely.
1577
+ * - number: Plays the action the specified positive number of times.
1578
+ * - 'infinite': Repeats the action indefinitely.
1512
1579
  */
1513
1580
  export declare type LoopMode = number | 'infinite';
1514
1581
 
@@ -1640,6 +1707,7 @@ declare class Modules {
1640
1707
  fxaaShader: typeof FXAAShader | null;
1641
1708
  smaaPassClass: typeof SMAAPass | null;
1642
1709
  smaaNode: typeof smaa | null;
1710
+ traaNode: typeof traa | null;
1643
1711
  ssaoPassClass: typeof SSAOPass | null;
1644
1712
  gtaoNodeClass: typeof ao | null;
1645
1713
  ssrNode: typeof ssr | null;
@@ -1655,6 +1723,9 @@ declare class Modules {
1655
1723
  outputPassClass: typeof OutputPass | null;
1656
1724
  renderPassClass: typeof RenderPass | null;
1657
1725
  shaderPassClass: typeof ShaderPass | null;
1726
+ rectAreaLightNodeClass: typeof THREE_WEBGPU_TYPE.RectAreaLightNode | null;
1727
+ rectAreaLightTexturesLib: typeof RectAreaLightTexturesLib | null;
1728
+ rectAreaLightUniformsLib: typeof RectAreaLightUniformsLib | null;
1658
1729
  orbitControlsClass: typeof OrbitControls | null;
1659
1730
  pointerLockControlsClass: typeof PointerLockControls | null;
1660
1731
  webGpuRendererClass: typeof THREE_WEBGPU_TYPE.WebGPURenderer | null;
@@ -1662,6 +1733,8 @@ declare class Modules {
1662
1733
  tslPass: typeof THREE_WEBTSL_TYPE.pass | null;
1663
1734
  tslMrt: typeof THREE_WEBTSL_TYPE.mrt | null;
1664
1735
  tslOutput: typeof THREE_WEBTSL_TYPE.output | null;
1736
+ tslVelocity: typeof THREE_WEBTSL_TYPE.velocity | null;
1737
+ tslRenderOutput: typeof THREE_WEBTSL_TYPE.renderOutput | null;
1665
1738
  tslNormalView: typeof THREE_WEBTSL_TYPE.normalView | null;
1666
1739
  tslMetalness: typeof THREE_WEBTSL_TYPE.metalness | null;
1667
1740
  tslRoughness: typeof THREE_WEBTSL_TYPE.roughness | null;
@@ -1688,6 +1761,7 @@ declare class Modules {
1688
1761
  importMeshoptDecoder(): Promise<void>;
1689
1762
  importOrbitCtrls(): Promise<void>;
1690
1763
  importOutputPass(): Promise<void>;
1764
+ importRectAreaLight(webGpu: boolean): Promise<void>;
1691
1765
  importRenderPass(): Promise<void>;
1692
1766
  importSMAANode(aaMode: Cfg['post']['aa']['mode']): Promise<void>;
1693
1767
  importSMAAPass(aaMode: Cfg['post']['aa']['mode']): Promise<void>;
@@ -1697,11 +1771,12 @@ declare class Modules {
1697
1771
  importStatelyAi(): Promise<void>;
1698
1772
  importThreeTsl(): Promise<void>;
1699
1773
  importThreeWebGpu(): Promise<void>;
1774
+ importTRAANode(aaMode: Cfg['post']['aa']['mode']): Promise<void>;
1700
1775
  importTweakpane(): Promise<void>;
1701
1776
  }
1702
1777
 
1703
1778
  /**
1704
- * Wraps a `THREE.Object3D` and provides lifecycle hooks, scene integration, animation support, and position-change events. Extend this class to implement custom object behavior.
1779
+ * 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.
1705
1780
  * @category 3D Objects
1706
1781
  */
1707
1782
  export declare class Obj3D {
@@ -1725,17 +1800,23 @@ export declare class Obj3D {
1725
1800
  * @public
1726
1801
  */
1727
1802
  protected scene: Readonly<THREE_TYPE.Scene>;
1728
- /** Whether occlusion checking is enabled for this object. Default: **false** */
1729
- enableOcclusionCheck: boolean;
1730
1803
  private readonly eventDispatcher;
1804
+ private posNdc;
1731
1805
  private posScreen;
1732
1806
  private posScreenLast;
1733
1807
  private posWorld;
1734
1808
  private posWorldLast;
1809
+ private posCamWorld;
1810
+ private posWorldOccl;
1811
+ private posCamWorldOccl;
1812
+ private quatWorld;
1813
+ private quatWorldLast;
1814
+ private rotWorld;
1735
1815
  private visible;
1736
1816
  private visibleFrustum;
1817
+ private visibleFrustumLast;
1737
1818
  private visibleLast;
1738
- /* Excluded from this release type: visibleOcclusion */
1819
+ private visibleOccl;
1739
1820
  /* Excluded from this release type: __constructor */
1740
1821
  /**
1741
1822
  * Registers a listener that is called whenever the specified event occurs.
@@ -1746,20 +1827,23 @@ export declare class Obj3D {
1746
1827
  addEventListener<TType extends Obj3DEvent['type']>(type: TType, listener: (event: Extract<Obj3DEvent, {
1747
1828
  type: TType;
1748
1829
  }>) => void): Unsubscribe;
1749
- private calcScreenPos;
1750
- protected checkWorldAndScreenPos(cam3D: Cam3D, obj: THREE_TYPE.Object3D): void;
1751
- protected checkVisible(): void;
1830
+ private calcFrustumVisibility;
1831
+ private calcPosScreen;
1832
+ /* Excluded from this release type: calcPosWorld */
1833
+ private calcPosOccl;
1834
+ private calcRotWorld;
1835
+ private calcVisibility;
1752
1836
  /* Excluded from this release type: emitEvent */
1753
1837
  /**
1754
1838
  * Returns the object's screen position in canvas coordinates.
1755
1839
  * @param cam3D - Camera used for projection to canvas coordinates.
1756
1840
  * @returns The projected screen position in canvas coordinates, or `null` if no `THREE.Object3D` is assigned.
1757
1841
  */
1758
- getScreenPosition(cam3D: Cam3D): {
1842
+ getScreenPos(cam3D: Cam3D): {
1759
1843
  x: number;
1760
1844
  y: number;
1761
1845
  } | null;
1762
- private isVisibleFrustum;
1846
+ /* Excluded from this release type: hasEventListener */
1763
1847
  /**
1764
1848
  * 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.
1765
1849
  * @public
@@ -1791,7 +1875,7 @@ export declare class Obj3D {
1791
1875
  removeEventListener<TType extends Obj3DEvent['type']>(type: TType, listener: (event: Extract<Obj3DEvent, {
1792
1876
  type: TType;
1793
1877
  }>) => void): void;
1794
- private resetEventStateIfNoListeners;
1878
+ private resetEventState;
1795
1879
  /* Excluded from this release type: start */
1796
1880
  /* Excluded from this release type: traverse */
1797
1881
  /* Excluded from this release type: update */
@@ -1801,7 +1885,15 @@ export declare class Obj3D {
1801
1885
  export declare type Obj3DClass = new (canvas: HTMLElement, cfg: Cfg, name: string) => Objs3D;
1802
1886
 
1803
1887
  /** Defines all event types supported by `Obj3D.addEventListener`. */
1804
- export declare type Obj3DEvent = Obj3DPosWorldEvent | Obj3DPosScreenEvent | Obj3DVisibleEvent | Obj3DPointerEvent;
1888
+ export declare type Obj3DEvent = Obj3DPosWorldEvent | Obj3DPosScreenEvent | Obj3DRotWorldEvent | Obj3DFrustumEvent | Obj3DVisibleEvent | Obj3DPointerEvent;
1889
+
1890
+ /** @event Fired when the frustum visibility of a 3D object changes. */
1891
+ export declare interface Obj3DFrustumEvent {
1892
+ /** Identifies this event type. */
1893
+ type: 'OBJ3D_FRUSTUM_CHANGED';
1894
+ /** Whether the object's world position is inside the camera frustum. */
1895
+ visibleFrustum: boolean;
1896
+ }
1805
1897
 
1806
1898
  /**
1807
1899
  * Maps a record of Obj3D classes to a record of typed object instances.
@@ -1818,11 +1910,13 @@ export declare interface Obj3DPointerEvent {
1818
1910
  type: 'OBJ3D_CLICK' | 'OBJ3D_POINTER_ENTER' | 'OBJ3D_POINTER_DOWN' | 'OBJ3D_POINTER_LEAVE' | 'OBJ3D_POINTER_MOVE' | 'OBJ3D_POINTER_UP';
1819
1911
  /** Native pointer event from the active object interaction. */
1820
1912
  event: PointerEvent;
1821
- /** The name of the object whose selected state changed. */
1913
+ /** The name of the object receiving the pointer event. */
1822
1914
  objName: string;
1823
1915
  }
1824
1916
 
1825
- /** @event Fired when the screen position of a 3D object changes and triggers the corresponding XState event. */
1917
+ /**
1918
+ * @event Fired when the screen position of a 3D object changes.
1919
+ */
1826
1920
  export declare interface Obj3DPosScreenEvent {
1827
1921
  /** Identifies this event type. */
1828
1922
  type: 'OBJ3D_POS_SCREEN_CHANGED';
@@ -1830,7 +1924,9 @@ export declare interface Obj3DPosScreenEvent {
1830
1924
  posScreen: THREE_TYPE.Vector2;
1831
1925
  }
1832
1926
 
1833
- /** @event Fired when the world position of a 3D object changes and triggers the corresponding XState event. */
1927
+ /**
1928
+ * @event Fired when the world position of a 3D object changes.
1929
+ */
1834
1930
  export declare interface Obj3DPosWorldEvent {
1835
1931
  /** Identifies this event type. */
1836
1932
  type: 'OBJ3D_POS_WORLD_CHANGED';
@@ -1838,21 +1934,21 @@ export declare interface Obj3DPosWorldEvent {
1838
1934
  posWorld: THREE_TYPE.Vector3;
1839
1935
  }
1840
1936
 
1841
- /** @event Fired when the world or screen rotation of a 3D object changes and triggers the corresponding XState event. */
1937
+ /**
1938
+ * @event Fired when the world rotation of a 3D object changes.
1939
+ */
1842
1940
  export declare interface Obj3DRotWorldEvent {
1843
1941
  /** Identifies this event type. */
1844
1942
  type: 'OBJ3D_ROT_WORLD_CHANGED';
1845
1943
  /** The object's rotation in world coordinates. */
1846
1944
  rotWorld: THREE_TYPE.Euler;
1847
- /** The object's rotation projected into screen space. */
1848
- rotScreen: THREE_TYPE.Euler;
1849
1945
  }
1850
1946
 
1851
- /** @event Fired when the visibility of a 3D object changes and triggers the corresponding XState event. */
1947
+ /** @event Fired when the combined frustum and occlusion visibility of a 3D object changes and triggers the corresponding XState event. */
1852
1948
  export declare interface Obj3DVisibleEvent {
1853
1949
  /** Identifies this event type. */
1854
1950
  type: 'OBJ3D_VISIBLE_CHANGED';
1855
- /** The object's visibility status. */
1951
+ /** Whether the object is inside the camera frustum and not occluded. */
1856
1952
  visible: boolean;
1857
1953
  }
1858
1954
 
@@ -2056,78 +2152,110 @@ export declare class Raycast {
2056
2152
  private readonly canvas;
2057
2153
  private readonly cfg;
2058
2154
  private readonly engine;
2059
- private readonly events;
2060
2155
  private readonly objs3D;
2061
- private raycasterSelect;
2156
+ private raycasterPick;
2062
2157
  private raycasterVisible;
2063
- private objsSelectTracked;
2158
+ private objsOccluders;
2159
+ private readonly objsOccls;
2160
+ private readonly objsPickables;
2064
2161
  private objActive;
2065
2162
  private objCandidate;
2066
2163
  private closestObjCounter;
2164
+ private indexOcclNext;
2165
+ private timeOcclNext;
2067
2166
  private isEnabled;
2068
- private callbackSelect;
2167
+ private callbackOccls;
2168
+ private callbackPointerHover;
2069
2169
  private listenerClick;
2170
+ private listenerCancel;
2070
2171
  private listenerDown;
2172
+ private listenerLeave;
2071
2173
  private listenerMove;
2072
2174
  private listenerUp;
2073
- private pointerEvent;
2175
+ private eventPointerMove;
2074
2176
  private posPrevPointerX;
2075
2177
  private posPrevPointerY;
2076
2178
  private posWorldObj;
2077
2179
  private dirCamToObj;
2078
2180
  private posNdcPointer;
2079
2181
  /* Excluded from this release type: __constructor */
2182
+ private checkOcclVisible;
2080
2183
  /** Enables pointer-based raycasting and adds all necessary pointer event listeners and the frame update callback. */
2081
2184
  enable(): void;
2082
2185
  /** Disables pointer-based raycasting and removes all pointer event listeners and the frame update callback. */
2083
2186
  disable(): void;
2084
- /**
2085
- * Checks whether an object's world position is visible from the active camera without being occluded.
2086
- *
2087
- * @param obj - The object whose visibility should be tested.
2088
- * @returns `true` if no other object blocks the line of sight to the object's world position, otherwise `false`.
2089
- */
2090
- isVisibleOcclusion(obj: THREE_TYPE.Object3D): boolean;
2091
- private onClick;
2092
- private onPointerDown;
2187
+ private getObjAtPointer;
2188
+ private getOcclState;
2189
+ /* Excluded from this release type: getOcclVisible */
2190
+ private onCanvasClick;
2191
+ private onCanvasPointerLeave;
2192
+ private onCanvasPointerMove;
2193
+ private onCanvasPointerCancel;
2194
+ private onCanvasPointerDown;
2195
+ private onCanvasPointerExit;
2196
+ private onCanvasPointerUp;
2093
2197
  private onPointerEnter;
2094
2198
  private onPointerLeave;
2095
2199
  private onPointerMove;
2096
- private onPointerUp;
2200
+ /* Excluded from this release type: resetOcclState */
2201
+ /** Removes the explicit occlusion-object restriction so that all scene objects are checked again. */
2202
+ resetOccluders(): void;
2097
2203
  /**
2098
- * 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
2099
- * (`pointermove`, `click`, `pointerdown`, `pointerup`).
2204
+ * Restricts occlusion raycasts to the specified scene objects. Without an explicit restriction, all scene objects are checked.
2100
2205
  *
2101
2206
  * @param params - Parameter object.
2102
- * @param params.objs3D - The `Obj3D` instances to track.
2207
+ * @param params.objs3D - The `Obj3D` instances that may block visibility.
2103
2208
  */
2104
- trackSelectables({ objs3D }: {
2209
+ setOccluders({ objs3D }: {
2105
2210
  objs3D: Obj3D[];
2106
2211
  }): void;
2212
+ /* Excluded from this release type: trackOccl */
2107
2213
  /**
2108
- * Registers and executes a low-level extension function with access to the public `Raycast` API.
2109
- * @param extension - Function that receives the current `Raycast` instance and can use its public members and methods.
2110
- * @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.
2214
+ * 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
2215
+ * (`pointermove`, `click`, `pointercancel`, `pointerdown`, `pointerleave`, `pointerup`).
2216
+ *
2217
+ * @param params - Parameter object.
2218
+ * @param params.objs3D - The `Obj3D` instances to track.
2111
2219
  */
2112
- use(extension: (raycast: Raycast) => void): void;
2220
+ trackPickables({ objs3D }: {
2221
+ objs3D: Obj3D[];
2222
+ }): void;
2223
+ /* Excluded from this release type: untrackOccl */
2113
2224
  /**
2114
2225
  * Stops tracking the specified scene objects for ray intersection detection. It automatically removes the pointer event listeners if no tracked objects remain.
2115
2226
  *
2116
2227
  * @param params - Parameter object.
2117
2228
  * @param params.objs3D - The `Obj3D` instances to untrack.
2118
2229
  */
2119
- untrackSelectable({ objs3D }: {
2230
+ untrackPickables({ objs3D }: {
2120
2231
  objs3D: Obj3D[];
2121
2232
  }): void;
2122
- /* Excluded from this release type: updateSelect */
2123
- private updatePointer;
2233
+ /**
2234
+ * Registers and executes a low-level extension function with access to the public `Raycast` API.
2235
+ * @param extension - Function that receives the current `Raycast` instance and can use its public members and methods.
2236
+ * @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.
2237
+ */
2238
+ use(extension: (raycast: Raycast) => void): void;
2239
+ private updateOccls;
2240
+ private updatePointerHover;
2241
+ private updatePointerPosition;
2124
2242
  }
2125
2243
 
2126
2244
  /**
2127
- * Defines the raycasting settings used to detect selectable objects around the pointer.
2245
+ * Defines the raycasting settings used to detect pickable objects around the pointer.
2128
2246
  * @category Cfg
2129
2247
  */
2130
2248
  export declare interface RaycastCfg {
2249
+ /**
2250
+ * Time in milliseconds over which all pending occlusion checks are distributed once. A value of `0` processes all pending checks in one frame.
2251
+ * @default 0
2252
+ */
2253
+ occlInterval: number;
2254
+ /**
2255
+ * 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.
2256
+ * @default 0.01
2257
+ */
2258
+ occlMoveFactor: number;
2131
2259
  /**
2132
2260
  * Circle radius around the pointer in pixels.
2133
2261
  * @default 10
@@ -2228,7 +2356,7 @@ export declare interface RenderCfg {
2228
2356
  * Whether renderer-level anti-aliasing is enabled.
2229
2357
  * @default false
2230
2358
  */
2231
- aa: boolean;
2359
+ antialias: boolean;
2232
2360
  };
2233
2361
  /**
2234
2362
  * WebGL-specific renderer configuration.
@@ -2417,6 +2545,21 @@ export declare interface SsrCfg {
2417
2545
  * @default false
2418
2546
  */
2419
2547
  guiOpened: boolean;
2548
+ /**
2549
+ * Controls the maximum distance a fragment can reflect.
2550
+ * @default 180
2551
+ */
2552
+ maxDistance: number;
2553
+ /**
2554
+ * Controls the cutoff thickness in reflection calculations.
2555
+ * @default 0.018
2556
+ */
2557
+ thickness: number;
2558
+ /**
2559
+ * Resolution scale for effect computation.
2560
+ * @default 1
2561
+ */
2562
+ resolutionScale: number;
2420
2563
  }
2421
2564
 
2422
2565
  /**
@@ -2444,31 +2587,16 @@ export declare interface SsrWebGlCfg {
2444
2587
  * @default false
2445
2588
  */
2446
2589
  infiniteThick: boolean;
2447
- /**
2448
- * Controls the maximum distance a fragment can reflect.
2449
- * @default 180
2450
- */
2451
- maxDistance: number;
2452
2590
  /**
2453
2591
  * Reflection opacity value.
2454
2592
  * @default 0.5
2455
2593
  */
2456
2594
  opacity: number;
2457
- /**
2458
- * Controls the cutoff thickness in reflection calculations.
2459
- * @default 0.018
2460
- */
2461
- thickness: number;
2462
2595
  /**
2463
2596
  * Enables blur on reflections.
2464
2597
  * @default true
2465
2598
  */
2466
2599
  blur: boolean;
2467
- /**
2468
- * Resolution scale for effect computation.
2469
- * @default 1
2470
- */
2471
- resolutionScale: number;
2472
2600
  /**
2473
2601
  * Output configuration of the SSR pass.
2474
2602
  * @default 0
@@ -2496,36 +2624,11 @@ export declare interface SsrWebGlCfg {
2496
2624
  * @category Cfg
2497
2625
  */
2498
2626
  export declare interface SsrWebGpuCfg {
2499
- /**
2500
- * Enables distance-based attenuation of reflections.
2501
- * @default true
2502
- */
2503
- distanceAttenuation: boolean;
2504
- /**
2505
- * Enables fresnel-based reflections.
2506
- * @default true
2507
- */
2508
- fresnel: boolean;
2509
- /**
2510
- * Maximum SSR ray distance.
2511
- * @default 180
2512
- */
2513
- maxDistance: number;
2514
2627
  /**
2515
2628
  * Reflection intensity value.
2516
2629
  * @default 0.5
2517
2630
  */
2518
2631
  intensity: number;
2519
- /**
2520
- * Ray thickness used for SSR intersection tests.
2521
- * @default 0.018
2522
- */
2523
- thickness: number;
2524
- /**
2525
- * SSR render resolution scale.
2526
- * @default 1
2527
- */
2528
- resolutionScale: number;
2529
2632
  /**
2530
2633
  * SSR quality factor.
2531
2634
  * @default 0.5
@@ -2576,10 +2679,10 @@ export declare interface StateMachineCfg {
2576
2679
  }
2577
2680
 
2578
2681
  /**
2579
- * Defines which previous active animation actions of the same object are stopped before a new action is played.
2580
- * - `'all'`: Stops all previous active actions.
2581
- * - `'last'`: Stops only the most recently played previous active action.
2582
- * - `'none'`: Keeps all previous active actions running.
2682
+ * Defines which previous active animation actions of the same layer are stopped before a new action is played.
2683
+ * - 'all': Stops all previous active actions.
2684
+ * - 'last': Stops only the most recently played previous active action.
2685
+ * - 'none': Keeps all previous active actions running.
2583
2686
  */
2584
2687
  export declare type StopMode = 'all' | 'last' | 'none';
2585
2688