illutions 0.25.0 → 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/CHANGELOG.md +34 -14
- package/dist/main.d.ts +205 -98
- package/dist/main.min.cjs +1 -1
- package/dist/main.min.js +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.26.0
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- Added TRAA as a WebGPU anti-aliasing mode through `cfg.post.aa.mode = 'traa'`.
|
|
8
|
+
- Added the `raycast.occlInterval` configuration to distribute pending marker occlusion checks evenly over a configurable time interval.
|
|
9
|
+
- Added the `raycast.occlMoveFactor` configuration to trigger new occlusion checks only after the object or camera exceeds a distance-relative movement threshold.
|
|
10
|
+
- Added `Raycast.setOccluders()` and `Raycast.resetOccluders()` to optionally restrict occlusion checks to selected scene objects.
|
|
11
|
+
- Added `Comp.trackOverlap()` and `Comp.untrackOverlap()` to manage component overlaps in screen space through the internal `CompCtrls`.
|
|
12
|
+
- Added `cfg.light.rectArea` to lazily load and initialize renderer-specific LTC data for `RectAreaLight` support.
|
|
13
|
+
|
|
14
|
+
### Changed
|
|
15
|
+
|
|
16
|
+
- Moved the shared SSR settings `maxDistance`, `thickness`, and `resolutionScale` from `cfg.post.webgl.ssr` and `cfg.post.webgpu.ssr` to `cfg.post.ssr`.
|
|
17
|
+
- Renamed the public `Raycast.trackSelectables()` and `Raycast.untrackSelectable()` methods to `Raycast.trackPickables()` and `Raycast.untrackPickables()`.
|
|
18
|
+
|
|
19
|
+
### Fixed
|
|
20
|
+
|
|
21
|
+
- Fixed the Inspector showing TRAA or an empty anti-aliasing mode for WebGL by falling back to FXAA when `cfg.post.aa.mode` is set to `'traa'`.
|
|
22
|
+
|
|
3
23
|
## 0.25.0
|
|
4
24
|
|
|
5
25
|
### Added
|
|
@@ -12,20 +32,20 @@
|
|
|
12
32
|
|
|
13
33
|
- Fixed `OBJ3D_POINTER_LEAVE` being emitted during pointer movement with a pressed mouse button and ensured touch pointers emit it after `OBJ3D_POINTER_UP` when contact ends.
|
|
14
34
|
|
|
15
|
-
## 0.24.1
|
|
16
|
-
|
|
17
|
-
### Added
|
|
18
|
-
|
|
19
|
-
- Added the `PROGRESSBAR_HIDDEN` event.
|
|
20
|
-
|
|
21
|
-
### Changed
|
|
22
|
-
|
|
23
|
-
- Renamed the `aaCfg` interface to `AaCfg`.
|
|
24
|
-
|
|
25
|
-
### Fixed
|
|
26
|
-
|
|
27
|
-
- Fixed an incorrect `objTarget.position` when enabling orbit or FPV controls after setting it in `Cam3D.onReady()`.
|
|
28
|
-
|
|
35
|
+
## 0.24.1
|
|
36
|
+
|
|
37
|
+
### Added
|
|
38
|
+
|
|
39
|
+
- Added the `PROGRESSBAR_HIDDEN` event.
|
|
40
|
+
|
|
41
|
+
### Changed
|
|
42
|
+
|
|
43
|
+
- Renamed the `aaCfg` interface to `AaCfg`.
|
|
44
|
+
|
|
45
|
+
### Fixed
|
|
46
|
+
|
|
47
|
+
- Fixed an incorrect `objTarget.position` when enabling orbit or FPV controls after setting it in `Cam3D.onReady()`.
|
|
48
|
+
|
|
29
49
|
## 0.24.0
|
|
30
50
|
|
|
31
51
|
### Added
|
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';
|
|
@@ -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
|
|
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;
|
|
@@ -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. */
|
|
@@ -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
|
|
535
|
-
private
|
|
536
|
-
|
|
537
|
-
|
|
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
|
|
555
|
+
follow({ obj }: {
|
|
544
556
|
obj: Obj3D | string;
|
|
545
|
-
enableOcclusionCheck?: boolean;
|
|
546
557
|
}): void;
|
|
547
|
-
|
|
548
|
-
|
|
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
|
|
@@ -620,6 +692,7 @@ export declare class Engine {
|
|
|
620
692
|
private renderPass;
|
|
621
693
|
private smaaPass;
|
|
622
694
|
private tslPass;
|
|
695
|
+
private aaNode;
|
|
623
696
|
/* Excluded from this release type: ssaoPass */
|
|
624
697
|
/* Excluded from this release type: gtaoNode */
|
|
625
698
|
/* Excluded from this release type: ssrPass */
|
|
@@ -665,7 +738,7 @@ export declare class Engine {
|
|
|
665
738
|
*
|
|
666
739
|
* {@link AnimEvent}
|
|
667
740
|
*/
|
|
668
|
-
|
|
741
|
+
animCamCurveTo({ camTarget, aimTarget, radiusOut, duration, ease }: {
|
|
669
742
|
camTarget: THREE_TYPE.Vector3 | string | Obj3D;
|
|
670
743
|
aimTarget?: THREE_TYPE.Vector3 | string | Obj3D;
|
|
671
744
|
radiusOut?: number;
|
|
@@ -689,7 +762,7 @@ export declare class Engine {
|
|
|
689
762
|
*
|
|
690
763
|
* {@link AnimEvent}
|
|
691
764
|
*/
|
|
692
|
-
|
|
765
|
+
animCamTo({ target, duration, ease, dist }: {
|
|
693
766
|
target: string | Obj3D;
|
|
694
767
|
duration?: number;
|
|
695
768
|
ease?: string;
|
|
@@ -746,7 +819,7 @@ export declare class Engine {
|
|
|
746
819
|
}): void;
|
|
747
820
|
private calcEaseArea;
|
|
748
821
|
/**
|
|
749
|
-
* Selects the active anti-aliasing mode. The modes `'fxaa'` and `'
|
|
822
|
+
* Selects the active anti-aliasing mode. The modes `'fxaa'`, `'smaa'` and `'traa'` lazy-load their required modules.
|
|
750
823
|
* @param aaMode - The anti-aliasing mode to use.
|
|
751
824
|
*/
|
|
752
825
|
enableAaMode(aaMode: Cfg['post']['aa']['mode']): Promise<void>;
|
|
@@ -1297,7 +1370,7 @@ export declare interface FpvCtrlsCfg {
|
|
|
1297
1370
|
/** @event Fired when an `FpvCtrls` event occurs and triggers the corresponding XState event. */
|
|
1298
1371
|
export declare interface FpvCtrlsEvent {
|
|
1299
1372
|
/** Identifies this event type. */
|
|
1300
|
-
type: 'FPVCTRLS_DISABLED' | 'FPVCTRLS_ENABLED' | 'FPVCTRLS_LOCK' | 'FPVCTRLS_UNLOCK'
|
|
1373
|
+
type: 'FPVCTRLS_DISABLED' | 'FPVCTRLS_ENABLED' | 'FPVCTRLS_LOCK' | 'FPVCTRLS_UNLOCK';
|
|
1301
1374
|
}
|
|
1302
1375
|
|
|
1303
1376
|
/**
|
|
@@ -1462,6 +1535,11 @@ export declare interface LightCfg {
|
|
|
1462
1535
|
* @default true
|
|
1463
1536
|
*/
|
|
1464
1537
|
castShadow: boolean;
|
|
1538
|
+
/**
|
|
1539
|
+
* Loads and initializes the renderer-specific LTC data required by RectAreaLight.
|
|
1540
|
+
* @default false
|
|
1541
|
+
*/
|
|
1542
|
+
rectArea: boolean;
|
|
1465
1543
|
/**
|
|
1466
1544
|
* Shadow map resolution along the horizontal axis.
|
|
1467
1545
|
* @default 512
|
|
@@ -1629,6 +1707,7 @@ declare class Modules {
|
|
|
1629
1707
|
fxaaShader: typeof FXAAShader | null;
|
|
1630
1708
|
smaaPassClass: typeof SMAAPass | null;
|
|
1631
1709
|
smaaNode: typeof smaa | null;
|
|
1710
|
+
traaNode: typeof traa | null;
|
|
1632
1711
|
ssaoPassClass: typeof SSAOPass | null;
|
|
1633
1712
|
gtaoNodeClass: typeof ao | null;
|
|
1634
1713
|
ssrNode: typeof ssr | null;
|
|
@@ -1644,6 +1723,9 @@ declare class Modules {
|
|
|
1644
1723
|
outputPassClass: typeof OutputPass | null;
|
|
1645
1724
|
renderPassClass: typeof RenderPass | null;
|
|
1646
1725
|
shaderPassClass: typeof ShaderPass | null;
|
|
1726
|
+
rectAreaLightNodeClass: typeof THREE_WEBGPU_TYPE.RectAreaLightNode | null;
|
|
1727
|
+
rectAreaLightTexturesLib: typeof RectAreaLightTexturesLib | null;
|
|
1728
|
+
rectAreaLightUniformsLib: typeof RectAreaLightUniformsLib | null;
|
|
1647
1729
|
orbitControlsClass: typeof OrbitControls | null;
|
|
1648
1730
|
pointerLockControlsClass: typeof PointerLockControls | null;
|
|
1649
1731
|
webGpuRendererClass: typeof THREE_WEBGPU_TYPE.WebGPURenderer | null;
|
|
@@ -1651,6 +1733,8 @@ declare class Modules {
|
|
|
1651
1733
|
tslPass: typeof THREE_WEBTSL_TYPE.pass | null;
|
|
1652
1734
|
tslMrt: typeof THREE_WEBTSL_TYPE.mrt | null;
|
|
1653
1735
|
tslOutput: typeof THREE_WEBTSL_TYPE.output | null;
|
|
1736
|
+
tslVelocity: typeof THREE_WEBTSL_TYPE.velocity | null;
|
|
1737
|
+
tslRenderOutput: typeof THREE_WEBTSL_TYPE.renderOutput | null;
|
|
1654
1738
|
tslNormalView: typeof THREE_WEBTSL_TYPE.normalView | null;
|
|
1655
1739
|
tslMetalness: typeof THREE_WEBTSL_TYPE.metalness | null;
|
|
1656
1740
|
tslRoughness: typeof THREE_WEBTSL_TYPE.roughness | null;
|
|
@@ -1677,6 +1761,7 @@ declare class Modules {
|
|
|
1677
1761
|
importMeshoptDecoder(): Promise<void>;
|
|
1678
1762
|
importOrbitCtrls(): Promise<void>;
|
|
1679
1763
|
importOutputPass(): Promise<void>;
|
|
1764
|
+
importRectAreaLight(webGpu: boolean): Promise<void>;
|
|
1680
1765
|
importRenderPass(): Promise<void>;
|
|
1681
1766
|
importSMAANode(aaMode: Cfg['post']['aa']['mode']): Promise<void>;
|
|
1682
1767
|
importSMAAPass(aaMode: Cfg['post']['aa']['mode']): Promise<void>;
|
|
@@ -1686,11 +1771,12 @@ declare class Modules {
|
|
|
1686
1771
|
importStatelyAi(): Promise<void>;
|
|
1687
1772
|
importThreeTsl(): Promise<void>;
|
|
1688
1773
|
importThreeWebGpu(): Promise<void>;
|
|
1774
|
+
importTRAANode(aaMode: Cfg['post']['aa']['mode']): Promise<void>;
|
|
1689
1775
|
importTweakpane(): Promise<void>;
|
|
1690
1776
|
}
|
|
1691
1777
|
|
|
1692
1778
|
/**
|
|
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.
|
|
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.
|
|
1694
1780
|
* @category 3D Objects
|
|
1695
1781
|
*/
|
|
1696
1782
|
export declare class Obj3D {
|
|
@@ -1714,17 +1800,23 @@ export declare class Obj3D {
|
|
|
1714
1800
|
* @public
|
|
1715
1801
|
*/
|
|
1716
1802
|
protected scene: Readonly<THREE_TYPE.Scene>;
|
|
1717
|
-
/** Whether occlusion checking is enabled for this object. Default: **false** */
|
|
1718
|
-
enableOcclusionCheck: boolean;
|
|
1719
1803
|
private readonly eventDispatcher;
|
|
1804
|
+
private posNdc;
|
|
1720
1805
|
private posScreen;
|
|
1721
1806
|
private posScreenLast;
|
|
1722
1807
|
private posWorld;
|
|
1723
1808
|
private posWorldLast;
|
|
1809
|
+
private posCamWorld;
|
|
1810
|
+
private posWorldOccl;
|
|
1811
|
+
private posCamWorldOccl;
|
|
1812
|
+
private quatWorld;
|
|
1813
|
+
private quatWorldLast;
|
|
1814
|
+
private rotWorld;
|
|
1724
1815
|
private visible;
|
|
1725
1816
|
private visibleFrustum;
|
|
1817
|
+
private visibleFrustumLast;
|
|
1726
1818
|
private visibleLast;
|
|
1727
|
-
|
|
1819
|
+
private visibleOccl;
|
|
1728
1820
|
/* Excluded from this release type: __constructor */
|
|
1729
1821
|
/**
|
|
1730
1822
|
* Registers a listener that is called whenever the specified event occurs.
|
|
@@ -1735,20 +1827,23 @@ export declare class Obj3D {
|
|
|
1735
1827
|
addEventListener<TType extends Obj3DEvent['type']>(type: TType, listener: (event: Extract<Obj3DEvent, {
|
|
1736
1828
|
type: TType;
|
|
1737
1829
|
}>) => void): Unsubscribe;
|
|
1738
|
-
private
|
|
1739
|
-
|
|
1740
|
-
|
|
1830
|
+
private calcFrustumVisibility;
|
|
1831
|
+
private calcPosScreen;
|
|
1832
|
+
/* Excluded from this release type: calcPosWorld */
|
|
1833
|
+
private calcPosOccl;
|
|
1834
|
+
private calcRotWorld;
|
|
1835
|
+
private calcVisibility;
|
|
1741
1836
|
/* Excluded from this release type: emitEvent */
|
|
1742
1837
|
/**
|
|
1743
1838
|
* Returns the object's screen position in canvas coordinates.
|
|
1744
1839
|
* @param cam3D - Camera used for projection to canvas coordinates.
|
|
1745
1840
|
* @returns The projected screen position in canvas coordinates, or `null` if no `THREE.Object3D` is assigned.
|
|
1746
1841
|
*/
|
|
1747
|
-
|
|
1842
|
+
getScreenPos(cam3D: Cam3D): {
|
|
1748
1843
|
x: number;
|
|
1749
1844
|
y: number;
|
|
1750
1845
|
} | null;
|
|
1751
|
-
|
|
1846
|
+
/* Excluded from this release type: hasEventListener */
|
|
1752
1847
|
/**
|
|
1753
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.
|
|
1754
1849
|
* @public
|
|
@@ -1780,7 +1875,7 @@ export declare class Obj3D {
|
|
|
1780
1875
|
removeEventListener<TType extends Obj3DEvent['type']>(type: TType, listener: (event: Extract<Obj3DEvent, {
|
|
1781
1876
|
type: TType;
|
|
1782
1877
|
}>) => void): void;
|
|
1783
|
-
private
|
|
1878
|
+
private resetEventState;
|
|
1784
1879
|
/* Excluded from this release type: start */
|
|
1785
1880
|
/* Excluded from this release type: traverse */
|
|
1786
1881
|
/* Excluded from this release type: update */
|
|
@@ -1790,7 +1885,15 @@ export declare class Obj3D {
|
|
|
1790
1885
|
export declare type Obj3DClass = new (canvas: HTMLElement, cfg: Cfg, name: string) => Objs3D;
|
|
1791
1886
|
|
|
1792
1887
|
/** Defines all event types supported by `Obj3D.addEventListener`. */
|
|
1793
|
-
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
|
+
}
|
|
1794
1897
|
|
|
1795
1898
|
/**
|
|
1796
1899
|
* Maps a record of Obj3D classes to a record of typed object instances.
|
|
@@ -1807,11 +1910,13 @@ export declare interface Obj3DPointerEvent {
|
|
|
1807
1910
|
type: 'OBJ3D_CLICK' | 'OBJ3D_POINTER_ENTER' | 'OBJ3D_POINTER_DOWN' | 'OBJ3D_POINTER_LEAVE' | 'OBJ3D_POINTER_MOVE' | 'OBJ3D_POINTER_UP';
|
|
1808
1911
|
/** Native pointer event from the active object interaction. */
|
|
1809
1912
|
event: PointerEvent;
|
|
1810
|
-
/** The name of the object
|
|
1913
|
+
/** The name of the object receiving the pointer event. */
|
|
1811
1914
|
objName: string;
|
|
1812
1915
|
}
|
|
1813
1916
|
|
|
1814
|
-
/**
|
|
1917
|
+
/**
|
|
1918
|
+
* @event Fired when the screen position of a 3D object changes.
|
|
1919
|
+
*/
|
|
1815
1920
|
export declare interface Obj3DPosScreenEvent {
|
|
1816
1921
|
/** Identifies this event type. */
|
|
1817
1922
|
type: 'OBJ3D_POS_SCREEN_CHANGED';
|
|
@@ -1819,7 +1924,9 @@ export declare interface Obj3DPosScreenEvent {
|
|
|
1819
1924
|
posScreen: THREE_TYPE.Vector2;
|
|
1820
1925
|
}
|
|
1821
1926
|
|
|
1822
|
-
/**
|
|
1927
|
+
/**
|
|
1928
|
+
* @event Fired when the world position of a 3D object changes.
|
|
1929
|
+
*/
|
|
1823
1930
|
export declare interface Obj3DPosWorldEvent {
|
|
1824
1931
|
/** Identifies this event type. */
|
|
1825
1932
|
type: 'OBJ3D_POS_WORLD_CHANGED';
|
|
@@ -1827,21 +1934,21 @@ export declare interface Obj3DPosWorldEvent {
|
|
|
1827
1934
|
posWorld: THREE_TYPE.Vector3;
|
|
1828
1935
|
}
|
|
1829
1936
|
|
|
1830
|
-
/**
|
|
1937
|
+
/**
|
|
1938
|
+
* @event Fired when the world rotation of a 3D object changes.
|
|
1939
|
+
*/
|
|
1831
1940
|
export declare interface Obj3DRotWorldEvent {
|
|
1832
1941
|
/** Identifies this event type. */
|
|
1833
1942
|
type: 'OBJ3D_ROT_WORLD_CHANGED';
|
|
1834
1943
|
/** The object's rotation in world coordinates. */
|
|
1835
1944
|
rotWorld: THREE_TYPE.Euler;
|
|
1836
|
-
/** The object's rotation projected into screen space. */
|
|
1837
|
-
rotScreen: THREE_TYPE.Euler;
|
|
1838
1945
|
}
|
|
1839
1946
|
|
|
1840
|
-
/** @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. */
|
|
1841
1948
|
export declare interface Obj3DVisibleEvent {
|
|
1842
1949
|
/** Identifies this event type. */
|
|
1843
1950
|
type: 'OBJ3D_VISIBLE_CHANGED';
|
|
1844
|
-
/**
|
|
1951
|
+
/** Whether the object is inside the camera frustum and not occluded. */
|
|
1845
1952
|
visible: boolean;
|
|
1846
1953
|
}
|
|
1847
1954
|
|
|
@@ -2045,16 +2152,20 @@ export declare class Raycast {
|
|
|
2045
2152
|
private readonly canvas;
|
|
2046
2153
|
private readonly cfg;
|
|
2047
2154
|
private readonly engine;
|
|
2048
|
-
private readonly events;
|
|
2049
2155
|
private readonly objs3D;
|
|
2050
|
-
private
|
|
2156
|
+
private raycasterPick;
|
|
2051
2157
|
private raycasterVisible;
|
|
2052
|
-
private
|
|
2158
|
+
private objsOccluders;
|
|
2159
|
+
private readonly objsOccls;
|
|
2160
|
+
private readonly objsPickables;
|
|
2053
2161
|
private objActive;
|
|
2054
2162
|
private objCandidate;
|
|
2055
2163
|
private closestObjCounter;
|
|
2164
|
+
private indexOcclNext;
|
|
2165
|
+
private timeOcclNext;
|
|
2056
2166
|
private isEnabled;
|
|
2057
|
-
private
|
|
2167
|
+
private callbackOccls;
|
|
2168
|
+
private callbackPointerHover;
|
|
2058
2169
|
private listenerClick;
|
|
2059
2170
|
private listenerCancel;
|
|
2060
2171
|
private listenerDown;
|
|
@@ -2068,18 +2179,14 @@ export declare class Raycast {
|
|
|
2068
2179
|
private dirCamToObj;
|
|
2069
2180
|
private posNdcPointer;
|
|
2070
2181
|
/* Excluded from this release type: __constructor */
|
|
2182
|
+
private checkOcclVisible;
|
|
2071
2183
|
/** Enables pointer-based raycasting and adds all necessary pointer event listeners and the frame update callback. */
|
|
2072
2184
|
enable(): void;
|
|
2073
2185
|
/** Disables pointer-based raycasting and removes all pointer event listeners and the frame update callback. */
|
|
2074
2186
|
disable(): void;
|
|
2075
|
-
private
|
|
2076
|
-
|
|
2077
|
-
|
|
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;
|
|
2187
|
+
private getObjAtPointer;
|
|
2188
|
+
private getOcclState;
|
|
2189
|
+
/* Excluded from this release type: getOcclVisible */
|
|
2083
2190
|
private onCanvasClick;
|
|
2084
2191
|
private onCanvasPointerLeave;
|
|
2085
2192
|
private onCanvasPointerMove;
|
|
@@ -2090,6 +2197,19 @@ export declare class Raycast {
|
|
|
2090
2197
|
private onPointerEnter;
|
|
2091
2198
|
private onPointerLeave;
|
|
2092
2199
|
private onPointerMove;
|
|
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;
|
|
2203
|
+
/**
|
|
2204
|
+
* Restricts occlusion raycasts to the specified scene objects. Without an explicit restriction, all scene objects are checked.
|
|
2205
|
+
*
|
|
2206
|
+
* @param params - Parameter object.
|
|
2207
|
+
* @param params.objs3D - The `Obj3D` instances that may block visibility.
|
|
2208
|
+
*/
|
|
2209
|
+
setOccluders({ objs3D }: {
|
|
2210
|
+
objs3D: Obj3D[];
|
|
2211
|
+
}): void;
|
|
2212
|
+
/* Excluded from this release type: trackOccl */
|
|
2093
2213
|
/**
|
|
2094
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
|
|
2095
2215
|
* (`pointermove`, `click`, `pointercancel`, `pointerdown`, `pointerleave`, `pointerup`).
|
|
@@ -2097,33 +2217,45 @@ export declare class Raycast {
|
|
|
2097
2217
|
* @param params - Parameter object.
|
|
2098
2218
|
* @param params.objs3D - The `Obj3D` instances to track.
|
|
2099
2219
|
*/
|
|
2100
|
-
|
|
2220
|
+
trackPickables({ objs3D }: {
|
|
2101
2221
|
objs3D: Obj3D[];
|
|
2102
2222
|
}): 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;
|
|
2223
|
+
/* Excluded from this release type: untrackOccl */
|
|
2109
2224
|
/**
|
|
2110
2225
|
* Stops tracking the specified scene objects for ray intersection detection. It automatically removes the pointer event listeners if no tracked objects remain.
|
|
2111
2226
|
*
|
|
2112
2227
|
* @param params - Parameter object.
|
|
2113
2228
|
* @param params.objs3D - The `Obj3D` instances to untrack.
|
|
2114
2229
|
*/
|
|
2115
|
-
|
|
2230
|
+
untrackPickables({ objs3D }: {
|
|
2116
2231
|
objs3D: Obj3D[];
|
|
2117
2232
|
}): void;
|
|
2118
|
-
|
|
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;
|
|
2119
2241
|
private updatePointerPosition;
|
|
2120
2242
|
}
|
|
2121
2243
|
|
|
2122
2244
|
/**
|
|
2123
|
-
* Defines the raycasting settings used to detect
|
|
2245
|
+
* Defines the raycasting settings used to detect pickable objects around the pointer.
|
|
2124
2246
|
* @category Cfg
|
|
2125
2247
|
*/
|
|
2126
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;
|
|
2127
2259
|
/**
|
|
2128
2260
|
* Circle radius around the pointer in pixels.
|
|
2129
2261
|
* @default 10
|
|
@@ -2224,7 +2356,7 @@ export declare interface RenderCfg {
|
|
|
2224
2356
|
* Whether renderer-level anti-aliasing is enabled.
|
|
2225
2357
|
* @default false
|
|
2226
2358
|
*/
|
|
2227
|
-
|
|
2359
|
+
antialias: boolean;
|
|
2228
2360
|
};
|
|
2229
2361
|
/**
|
|
2230
2362
|
* WebGL-specific renderer configuration.
|
|
@@ -2413,6 +2545,21 @@ export declare interface SsrCfg {
|
|
|
2413
2545
|
* @default false
|
|
2414
2546
|
*/
|
|
2415
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;
|
|
2416
2563
|
}
|
|
2417
2564
|
|
|
2418
2565
|
/**
|
|
@@ -2440,31 +2587,16 @@ export declare interface SsrWebGlCfg {
|
|
|
2440
2587
|
* @default false
|
|
2441
2588
|
*/
|
|
2442
2589
|
infiniteThick: boolean;
|
|
2443
|
-
/**
|
|
2444
|
-
* Controls the maximum distance a fragment can reflect.
|
|
2445
|
-
* @default 180
|
|
2446
|
-
*/
|
|
2447
|
-
maxDistance: number;
|
|
2448
2590
|
/**
|
|
2449
2591
|
* Reflection opacity value.
|
|
2450
2592
|
* @default 0.5
|
|
2451
2593
|
*/
|
|
2452
2594
|
opacity: number;
|
|
2453
|
-
/**
|
|
2454
|
-
* Controls the cutoff thickness in reflection calculations.
|
|
2455
|
-
* @default 0.018
|
|
2456
|
-
*/
|
|
2457
|
-
thickness: number;
|
|
2458
2595
|
/**
|
|
2459
2596
|
* Enables blur on reflections.
|
|
2460
2597
|
* @default true
|
|
2461
2598
|
*/
|
|
2462
2599
|
blur: boolean;
|
|
2463
|
-
/**
|
|
2464
|
-
* Resolution scale for effect computation.
|
|
2465
|
-
* @default 1
|
|
2466
|
-
*/
|
|
2467
|
-
resolutionScale: number;
|
|
2468
2600
|
/**
|
|
2469
2601
|
* Output configuration of the SSR pass.
|
|
2470
2602
|
* @default 0
|
|
@@ -2492,36 +2624,11 @@ export declare interface SsrWebGlCfg {
|
|
|
2492
2624
|
* @category Cfg
|
|
2493
2625
|
*/
|
|
2494
2626
|
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
2627
|
/**
|
|
2511
2628
|
* Reflection intensity value.
|
|
2512
2629
|
* @default 0.5
|
|
2513
2630
|
*/
|
|
2514
2631
|
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
2632
|
/**
|
|
2526
2633
|
* SSR quality factor.
|
|
2527
2634
|
* @default 0.5
|