illutions 0.27.1 → 0.29.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 -0
- package/dist/main.d.ts +219 -75
- package/dist/main.min.cjs +1 -1
- package/dist/main.min.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,39 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.29.0
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- Added protected `Mesh3D.setTexture()` to assign unused GLTF images by name to the `ColorMap`, `LightMap`, or `AlphaMap` material slot, with optional UV channel and light map intensity settings; registered textures are updated across progressive model levels.
|
|
8
|
+
- Added the exported `TextureSlot` union for the supported material slots.
|
|
9
|
+
|
|
10
|
+
## 0.28.0
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- Added `Mesh3D.animMaterialColor()`, `Mesh3D.animMaterialNumeric()`, and `Mesh3D.setMaterialProperties()` as object-bound counterparts to the existing `Engine` material methods.
|
|
15
|
+
- Added the optional `needsUpdate` parameter to `Engine.animMaterialNumeric()`, `Engine.setMaterialProperties()`, `Mesh3D.animMaterialNumeric()`, and `Mesh3D.setMaterialProperties()` to request material recompilation.
|
|
16
|
+
- Added degree-based horizontal orbit constraints through `orbitCtrls.minAzimuthAngle` and `orbitCtrls.maxAzimuthAngle`.
|
|
17
|
+
- Added `ModelLoadedEvent` with `Model_Loaded` for a single model and numbered `Model1_Loaded`, `Model2_Loaded`, etc. events for progressive models.
|
|
18
|
+
- Added the `Model_Ready` event after the final progressive model variant has been applied and rendered.
|
|
19
|
+
- Added the exported `Collider` configuration and `Raycast.setColliders()` and `Raycast.clearColliders()` to configure named scene objects or `Obj3D` instances as occluders, pickables, or hidden colliders.
|
|
20
|
+
|
|
21
|
+
### Changed
|
|
22
|
+
|
|
23
|
+
- Replaced `Raycast.setOccluders()`, `Raycast.resetOccluders()`, `Raycast.trackPickables()`, and `Raycast.untrackPickables()` with the unified collider API.
|
|
24
|
+
- Renamed `Raycast.enable()` and `Raycast.disable()` to `Raycast.enablePickables()` and `Raycast.disablePickables()`.
|
|
25
|
+
- Renamed `raycast.occlInterval` to `raycast.occludeeInterval` and `raycast.occlMoveFactor` to `raycast.occlusionMoveFactor`.
|
|
26
|
+
- Changed progressive `ModelLoadingEvent` and `SceneRenderedEvent` types to numbered `Model1_Loading`, `Scene1_Rendered`, etc. events; unnumbered events remain available for a single model.
|
|
27
|
+
- Removed the `level` property from `ModelLoadingEvent`; the progressive model level is now identified by the event type.
|
|
28
|
+
- Removed the obsolete `fct` property from `ClipEvent`.
|
|
29
|
+
- Changed pointer raycasts so that registered occluders block pickables behind them.
|
|
30
|
+
|
|
31
|
+
### Fixed
|
|
32
|
+
|
|
33
|
+
- Corrected `CanvasPointerEvent` to expose `Canvas_Click`, `Canvas_Pointer_Enter`, and `Canvas_Pointer_Leave`.
|
|
34
|
+
- Added the already emitted `FpvCtrls_Disposed` event to `FpvCtrlsEvent`.
|
|
35
|
+
- Delayed the postprocessing noise check until `Model_Ready` so that postprocessing is not disabled before the final progressive model variant is rendered.
|
|
36
|
+
|
|
3
37
|
## 0.27.0
|
|
4
38
|
|
|
5
39
|
### Added
|
package/dist/main.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ import { DRACOLoader } from 'three/addons/loaders/DRACOLoader.js';
|
|
|
8
8
|
import { EffectComposer } from 'three/addons/postprocessing/EffectComposer.js';
|
|
9
9
|
import { EXRLoader } from 'three/addons/loaders/EXRLoader.js';
|
|
10
10
|
import { FXAAShader } from 'three/addons/shaders/FXAAShader.js';
|
|
11
|
+
import { GLTF } from 'three/addons/loaders/GLTFLoader.js';
|
|
11
12
|
import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js';
|
|
12
13
|
import { HDRLoader } from 'three/addons/loaders/HDRLoader.js';
|
|
13
14
|
import { KTX2Loader } from 'three/addons/loaders/KTX2Loader.js';
|
|
@@ -108,6 +109,7 @@ export declare class App<TClasses extends Classes = {}> {
|
|
|
108
109
|
readonly audio: Audio_2;
|
|
109
110
|
private readonly compCtrls;
|
|
110
111
|
readonly engine: Engine;
|
|
112
|
+
private readonly lib;
|
|
111
113
|
readonly envCtrls: EnvCtrls;
|
|
112
114
|
readonly events: Events;
|
|
113
115
|
readonly orbitCtrls: OrbitCtrls;
|
|
@@ -449,7 +451,7 @@ export declare interface CanvasKeyEvent {
|
|
|
449
451
|
/** @event Fired when the user uses the pointer on the canvas and triggers the corresponding XState event. */
|
|
450
452
|
export declare interface CanvasPointerEvent {
|
|
451
453
|
/** Identifies this event type. */
|
|
452
|
-
type: 'Canvas_Click' | '
|
|
454
|
+
type: 'Canvas_Click' | 'Canvas_Pointer_Enter' | 'Canvas_Pointer_Leave';
|
|
453
455
|
/** Native pointer event from the canvas interaction. */
|
|
454
456
|
event: PointerEvent;
|
|
455
457
|
}
|
|
@@ -516,14 +518,24 @@ export declare interface ClipEvent {
|
|
|
516
518
|
type: 'Clip_Start' | 'Clip_Complete' | 'Clip_Cancel' | 'Clip_Fade_Start' | 'Clip_Fade_Complete' | 'Clip_Speed_Start' | 'Clip_Speed_Complete';
|
|
517
519
|
/** The name of the affected `THREE.AnimationClip`. */
|
|
518
520
|
clipName: string;
|
|
519
|
-
/** The name of the calling method. */
|
|
520
|
-
fct: string;
|
|
521
521
|
/** The associated animation action, when available. */
|
|
522
522
|
action?: THREE_TYPE.AnimationAction;
|
|
523
523
|
/** Whether the clip weight is fading in or out. */
|
|
524
524
|
fadeMode?: ActionFadeMode;
|
|
525
525
|
}
|
|
526
526
|
|
|
527
|
+
/** Defines how a scene object participates in raycasting. */
|
|
528
|
+
export declare interface Collider {
|
|
529
|
+
/** Scene object or scene-object name used for raycasting. */
|
|
530
|
+
obj: Obj3D | string;
|
|
531
|
+
/** Hides the object while it is registered as a collider. */
|
|
532
|
+
hide?: boolean;
|
|
533
|
+
/** Allows the object to occlude tracked occludees and pickables. */
|
|
534
|
+
occluder?: boolean;
|
|
535
|
+
/** Allows the object to emit pointer events. */
|
|
536
|
+
pickable?: boolean;
|
|
537
|
+
}
|
|
538
|
+
|
|
527
539
|
declare type ColorNode = THREE_WEBGPU_TYPE.Node<'vec4'>;
|
|
528
540
|
|
|
529
541
|
/**
|
|
@@ -673,6 +685,7 @@ export declare class Engine {
|
|
|
673
685
|
/* Excluded from this release type: scene */
|
|
674
686
|
private readonly cam3D;
|
|
675
687
|
private readonly events;
|
|
688
|
+
private readonly lib;
|
|
676
689
|
private readonly modules;
|
|
677
690
|
private readonly objs3D;
|
|
678
691
|
private readonly cfg;
|
|
@@ -705,6 +718,7 @@ export declare class Engine {
|
|
|
705
718
|
private hemisphereLight;
|
|
706
719
|
private powerMode;
|
|
707
720
|
private postNoise;
|
|
721
|
+
private postNoiseCheck;
|
|
708
722
|
private dTs;
|
|
709
723
|
private dT;
|
|
710
724
|
private dTFrameMax;
|
|
@@ -787,7 +801,7 @@ export declare class Engine {
|
|
|
787
801
|
*
|
|
788
802
|
* {@link AnimEvent}
|
|
789
803
|
*/
|
|
790
|
-
animMaterialColor({ mesh,
|
|
804
|
+
animMaterialColor({ mesh, ...params }: {
|
|
791
805
|
mesh: string;
|
|
792
806
|
duration?: number;
|
|
793
807
|
ease?: string;
|
|
@@ -803,6 +817,7 @@ export declare class Engine {
|
|
|
803
817
|
* @param params.infinite - If `true`, the animation loops infinitely. Default: **false**
|
|
804
818
|
* @param params.duration - The animation duration in seconds. Default: **0**
|
|
805
819
|
* @param params.ease - The easing function name for GSAP. Default: **'power1.inOut'**
|
|
820
|
+
* @param params.needsUpdate - Requests one material recompilation when the animation starts. Default: **false**
|
|
806
821
|
*
|
|
807
822
|
* @remarks
|
|
808
823
|
* Additional properties of `params` can specify one or more material numeric fields to animate (e.g. `metalness`, `roughness`, `opacity`, ...) with their target numeric values. Only the **first** provided
|
|
@@ -812,12 +827,13 @@ export declare class Engine {
|
|
|
812
827
|
*
|
|
813
828
|
* {@link AnimFadeEvent}
|
|
814
829
|
*/
|
|
815
|
-
animMaterialNumeric({ mesh,
|
|
830
|
+
animMaterialNumeric({ mesh, needsUpdate, ...params }: {
|
|
816
831
|
mesh: string;
|
|
817
832
|
startValue?: number | null;
|
|
818
833
|
infinite?: boolean;
|
|
819
834
|
duration?: number;
|
|
820
835
|
ease?: string;
|
|
836
|
+
needsUpdate?: boolean;
|
|
821
837
|
[key: string]: any;
|
|
822
838
|
}): void;
|
|
823
839
|
private calcEaseArea;
|
|
@@ -990,13 +1006,15 @@ export declare class Engine {
|
|
|
990
1006
|
*
|
|
991
1007
|
* @param params - Parameter object for setting material properties.
|
|
992
1008
|
* @param params.obj - The name of the mesh whose material properties should be modified.
|
|
1009
|
+
* @param params.needsUpdate - Requests material recompilation after applying the properties. Default: **false**
|
|
993
1010
|
*
|
|
994
1011
|
* @remarks
|
|
995
1012
|
* Additional properties of `params` can define one or more material fields to update (e.g. `color`, `roughness`, `metalness`, `map`, `emissiveMap`, ...), each with its target value. Texture paths provided
|
|
996
1013
|
* as strings are loaded asynchronously and assigned to the corresponding material slots. Unsupported or mismatched property types are ignored with a warning in debug mode.
|
|
997
1014
|
*/
|
|
998
|
-
setMaterialProperties({ obj, ...props }: {
|
|
1015
|
+
setMaterialProperties({ obj, needsUpdate, ...props }: {
|
|
999
1016
|
obj: string;
|
|
1017
|
+
needsUpdate?: boolean;
|
|
1000
1018
|
[key: string]: any;
|
|
1001
1019
|
}): void;
|
|
1002
1020
|
/* Excluded from this release type: setPostWebGl */
|
|
@@ -1204,7 +1222,9 @@ export declare class Events {
|
|
|
1204
1222
|
/* Excluded from this release type: audioLoaded */
|
|
1205
1223
|
/* Excluded from this release type: clip */
|
|
1206
1224
|
/* Excluded from this release type: modelError */
|
|
1225
|
+
/* Excluded from this release type: modelLoaded */
|
|
1207
1226
|
/* Excluded from this release type: modelLoading */
|
|
1227
|
+
/* Excluded from this release type: sceneRendered */
|
|
1208
1228
|
/**
|
|
1209
1229
|
* Sends an event to the state machine and optionally logs a debug message to the console.
|
|
1210
1230
|
* @param event - Any XState event object (must include a `type` property) to be dispatched to the actor.
|
|
@@ -1392,7 +1412,7 @@ export declare interface FpvCtrlsCfg {
|
|
|
1392
1412
|
/** @event Fired when an `FpvCtrls` event occurs and triggers the corresponding XState event. */
|
|
1393
1413
|
export declare interface FpvCtrlsEvent {
|
|
1394
1414
|
/** Identifies this event type. */
|
|
1395
|
-
type: 'FpvCtrls_Disabled' | 'FpvCtrls_Enabled' | 'FpvCtrls_Lock' | 'FpvCtrls_Unlock';
|
|
1415
|
+
type: 'FpvCtrls_Disabled' | 'FpvCtrls_Disposed' | 'FpvCtrls_Enabled' | 'FpvCtrls_Lock' | 'FpvCtrls_Unlock';
|
|
1396
1416
|
}
|
|
1397
1417
|
|
|
1398
1418
|
/**
|
|
@@ -1522,6 +1542,8 @@ export declare interface InfoBoxCfg {
|
|
|
1522
1542
|
logsPerSecond: number;
|
|
1523
1543
|
}
|
|
1524
1544
|
|
|
1545
|
+
/* Excluded from this release type: Lib */
|
|
1546
|
+
|
|
1525
1547
|
/**
|
|
1526
1548
|
* The `Light3D` class represents a managed light source.
|
|
1527
1549
|
* @category 3D Objects
|
|
@@ -1639,7 +1661,64 @@ export declare class Mesh3D extends Obj3D {
|
|
|
1639
1661
|
groundReflector: ReflectorForSSRPass | null;
|
|
1640
1662
|
/** Objects that participate in the screen-space reflection (SSR) effect. These objects are used for reflective rendering in the scene. */
|
|
1641
1663
|
reflectivesSSR: THREE_TYPE.Object3D[];
|
|
1664
|
+
private model;
|
|
1665
|
+
/* Excluded from this release type: lib */
|
|
1642
1666
|
/* Excluded from this release type: __constructor */
|
|
1667
|
+
/**
|
|
1668
|
+
* Animates one or more color properties of this mesh's material.
|
|
1669
|
+
* @param params - Animation parameters and target material color properties such as `color` or `emissive`.
|
|
1670
|
+
* @param params.duration - Animation duration in seconds. Default: **0**
|
|
1671
|
+
* @param params.ease - GSAP easing function name. Default: **'power1.inOut'**
|
|
1672
|
+
*/
|
|
1673
|
+
animMaterialColor(params: {
|
|
1674
|
+
duration?: number;
|
|
1675
|
+
ease?: string;
|
|
1676
|
+
} & {
|
|
1677
|
+
[key: string]: string | number | THREE_TYPE.Color;
|
|
1678
|
+
}): void;
|
|
1679
|
+
/**
|
|
1680
|
+
* Animates the first numeric material property passed for this mesh.
|
|
1681
|
+
* @param params - Animation parameters and the target numeric material property.
|
|
1682
|
+
* @param params.startValue - Starting value. Defaults to the current material value.
|
|
1683
|
+
* @param params.infinite - Whether the animation repeats indefinitely. Default: **false**
|
|
1684
|
+
* @param params.duration - Animation duration in seconds. Default: **0**
|
|
1685
|
+
* @param params.ease - GSAP easing function name. Default: **'power1.inOut'**
|
|
1686
|
+
* @param params.needsUpdate - Requests one material recompilation when the animation starts. Default: **false**
|
|
1687
|
+
*/
|
|
1688
|
+
animMaterialNumeric({ needsUpdate, ...params }: {
|
|
1689
|
+
startValue?: number | null;
|
|
1690
|
+
infinite?: boolean;
|
|
1691
|
+
duration?: number;
|
|
1692
|
+
ease?: string;
|
|
1693
|
+
needsUpdate?: boolean;
|
|
1694
|
+
[key: string]: any;
|
|
1695
|
+
}): void;
|
|
1696
|
+
/**
|
|
1697
|
+
* Updates one or more material properties of this mesh.
|
|
1698
|
+
* @param properties - Material properties to update. Texture paths are supported for `map` and `emissiveMap`.
|
|
1699
|
+
* @param properties.needsUpdate - Requests material recompilation after applying the properties. Default: **false**
|
|
1700
|
+
*/
|
|
1701
|
+
setMaterialProperties({ needsUpdate, ...properties }: {
|
|
1702
|
+
needsUpdate?: boolean;
|
|
1703
|
+
[key: string]: any;
|
|
1704
|
+
}): void;
|
|
1705
|
+
/**
|
|
1706
|
+
* Loads an unused texture embedded in the current GLTF and assigns it to a material.
|
|
1707
|
+
* @param options - Unused texture assignment settings.
|
|
1708
|
+
* @param options.name - Name of the GLTF image used by the texture.
|
|
1709
|
+
* @param options.material - Material that receives the unused texture.
|
|
1710
|
+
* @param options.slot - Target material texture slot. See {@link TextureSlot}.
|
|
1711
|
+
* @param options.lightMapIntensity - Light map intensity used for `LightMap`. Default: **1**
|
|
1712
|
+
* @param options.channel - Texture UV channel. Default: **1**
|
|
1713
|
+
* @public
|
|
1714
|
+
*/
|
|
1715
|
+
protected setTexture({ name, material, slot, lightMapIntensity, channel }: {
|
|
1716
|
+
name: string;
|
|
1717
|
+
material: THREE_TYPE.MeshBasicMaterial | THREE_TYPE.MeshStandardMaterial;
|
|
1718
|
+
slot: TextureSlot;
|
|
1719
|
+
lightMapIntensity?: number;
|
|
1720
|
+
channel?: number;
|
|
1721
|
+
}): void;
|
|
1643
1722
|
/**
|
|
1644
1723
|
* Called for each traversed mesh during GLTF parsing. Stores the current `THREE.Mesh` in `this.obj`.
|
|
1645
1724
|
* @param objGltf - The currently traversed mesh.
|
|
@@ -1649,6 +1728,7 @@ export declare class Mesh3D extends Obj3D {
|
|
|
1649
1728
|
* {@includeCode ../../examples/mesh3D-cube.ts}
|
|
1650
1729
|
*/
|
|
1651
1730
|
protected onTraverse(objGltf: THREE_TYPE.Mesh): void;
|
|
1731
|
+
/* Excluded from this release type: setModel */
|
|
1652
1732
|
/* Excluded from this release type: setReflectivesSSR */
|
|
1653
1733
|
/* Excluded from this release type: traverse */
|
|
1654
1734
|
}
|
|
@@ -1675,6 +1755,41 @@ export declare interface MeshCfg {
|
|
|
1675
1755
|
frustumCulled: boolean;
|
|
1676
1756
|
}
|
|
1677
1757
|
|
|
1758
|
+
declare class Model {
|
|
1759
|
+
private readonly canvas;
|
|
1760
|
+
private readonly cfg;
|
|
1761
|
+
private readonly events;
|
|
1762
|
+
private readonly modules;
|
|
1763
|
+
private readonly renderer;
|
|
1764
|
+
private readonly initFirstScene;
|
|
1765
|
+
private readonly reportModelReady;
|
|
1766
|
+
private readonly rendererReady;
|
|
1767
|
+
private readonly waitForRender;
|
|
1768
|
+
/* Excluded from this release type: sceneReady */
|
|
1769
|
+
private resolveSceneReady;
|
|
1770
|
+
private rejectSceneReady;
|
|
1771
|
+
private gltf;
|
|
1772
|
+
private meshes;
|
|
1773
|
+
private scene;
|
|
1774
|
+
private readonly textsUsed;
|
|
1775
|
+
private readonly textsUnused;
|
|
1776
|
+
constructor({ canvas, cfg, events, modules, renderer, rendererReady, initFirstScene: initFirstScene, reportModelReady, waitForRender }: ModelParams);
|
|
1777
|
+
private addMaterials;
|
|
1778
|
+
private addText;
|
|
1779
|
+
private addTextUnused;
|
|
1780
|
+
private loadTextsUnused;
|
|
1781
|
+
private applyTextsUnused;
|
|
1782
|
+
private disposeObsoleteResources;
|
|
1783
|
+
/* Excluded from this release type: load */
|
|
1784
|
+
private loadGltf;
|
|
1785
|
+
private loadTextUnused;
|
|
1786
|
+
private reportError;
|
|
1787
|
+
/* Excluded from this release type: setTextUsed */
|
|
1788
|
+
private updateMaterials;
|
|
1789
|
+
private updateMeshes;
|
|
1790
|
+
private updateTextImages;
|
|
1791
|
+
}
|
|
1792
|
+
|
|
1678
1793
|
/**
|
|
1679
1794
|
* Defines the GLTF/GLB model loading settings used to fetch models and configure optional Draco decoding.
|
|
1680
1795
|
* @category Cfg
|
|
@@ -1717,14 +1832,36 @@ export declare interface ModelErrorEvent {
|
|
|
1717
1832
|
error: Error;
|
|
1718
1833
|
}
|
|
1719
1834
|
|
|
1835
|
+
/** @event Fired after a model asset has finished loading and parsing. */
|
|
1836
|
+
export declare interface ModelLoadedEvent {
|
|
1837
|
+
/** Identifies the loaded model. */
|
|
1838
|
+
type: 'Model_Loaded' | `Model${number}_Loaded`;
|
|
1839
|
+
}
|
|
1840
|
+
|
|
1720
1841
|
/** @event Fired while model assets are loading and triggers the corresponding XState event. */
|
|
1721
1842
|
export declare interface ModelLoadingEvent {
|
|
1722
|
-
/** Identifies
|
|
1723
|
-
type: 'Model_Loading'
|
|
1843
|
+
/** Identifies the loading model. */
|
|
1844
|
+
type: 'Model_Loading' | `Model${number}_Loading`;
|
|
1724
1845
|
/** Loading progress in percent (0-100). */
|
|
1725
1846
|
loading: number;
|
|
1726
|
-
|
|
1727
|
-
|
|
1847
|
+
}
|
|
1848
|
+
|
|
1849
|
+
declare interface ModelParams {
|
|
1850
|
+
canvas: HTMLElement;
|
|
1851
|
+
cfg: Cfg;
|
|
1852
|
+
events: Events;
|
|
1853
|
+
modules: Modules;
|
|
1854
|
+
renderer: Renderer_2;
|
|
1855
|
+
rendererReady: Promise<void> | null;
|
|
1856
|
+
initFirstScene: (gltf: GLTF) => Map<string, THREE_TYPE.Mesh>;
|
|
1857
|
+
reportModelReady: () => void;
|
|
1858
|
+
waitForRender: () => Promise<void>;
|
|
1859
|
+
}
|
|
1860
|
+
|
|
1861
|
+
/** @event Fired after the final progressive model variant has been applied and rendered and triggers the corresponding XState event. */
|
|
1862
|
+
export declare interface ModelReadyEvent {
|
|
1863
|
+
/** Identifies this event type. */
|
|
1864
|
+
type: 'Model_Ready';
|
|
1728
1865
|
}
|
|
1729
1866
|
|
|
1730
1867
|
declare class Modules {
|
|
@@ -1980,6 +2117,12 @@ export declare interface Obj3DVisibleEvent {
|
|
|
1980
2117
|
|
|
1981
2118
|
export declare type Objs3D = Cam3D | Light3D | Mesh3D | Obj3D;
|
|
1982
2119
|
|
|
2120
|
+
declare interface OccludeeState {
|
|
2121
|
+
obj: THREE_TYPE.Object3D;
|
|
2122
|
+
needsCheck: boolean;
|
|
2123
|
+
visible: boolean;
|
|
2124
|
+
}
|
|
2125
|
+
|
|
1983
2126
|
/**
|
|
1984
2127
|
* Integrates three.js OrbitControls directly in the engine's render loop, supporting runtime updates and dynamic enabling/disabling.
|
|
1985
2128
|
* @category Core
|
|
@@ -2081,6 +2224,11 @@ export declare interface OrbitCtrlsCfg {
|
|
|
2081
2224
|
* @default false
|
|
2082
2225
|
*/
|
|
2083
2226
|
load: boolean;
|
|
2227
|
+
/**
|
|
2228
|
+
* Maximum allowed horizontal orbit angle in degrees.
|
|
2229
|
+
* @default Infinity
|
|
2230
|
+
*/
|
|
2231
|
+
maxAzimuthAngle: number;
|
|
2084
2232
|
/**
|
|
2085
2233
|
* Maximum allowed distance between the camera and the target.
|
|
2086
2234
|
* @default Infinity
|
|
@@ -2091,6 +2239,11 @@ export declare interface OrbitCtrlsCfg {
|
|
|
2091
2239
|
* @default 180
|
|
2092
2240
|
*/
|
|
2093
2241
|
maxPolarAngle: number;
|
|
2242
|
+
/**
|
|
2243
|
+
* Minimum allowed horizontal orbit angle in degrees.
|
|
2244
|
+
* @default -Infinity
|
|
2245
|
+
*/
|
|
2246
|
+
minAzimuthAngle: number;
|
|
2094
2247
|
/**
|
|
2095
2248
|
* Minimum allowed distance between the camera and the target.
|
|
2096
2249
|
* @default 0
|
|
@@ -2168,9 +2321,7 @@ export declare interface ProgressBarHiddenEvent {
|
|
|
2168
2321
|
}
|
|
2169
2322
|
|
|
2170
2323
|
/**
|
|
2171
|
-
*
|
|
2172
|
-
* the application state. The class dynamically enables or disables pointer listeners depending on the number of tracked objects. It also handles pointer events (click, down, up, move, enter, leave) for the
|
|
2173
|
-
* intersected 3D objects.
|
|
2324
|
+
* Manages collider-based occlusion and pointer picking in a `THREE.Scene`. Collider roles determine which objects block rays, emit pointer events, or remain hidden while participating in raycasting.
|
|
2174
2325
|
* @category Core
|
|
2175
2326
|
*/
|
|
2176
2327
|
export declare class Raycast {
|
|
@@ -2178,19 +2329,23 @@ export declare class Raycast {
|
|
|
2178
2329
|
private readonly canvas;
|
|
2179
2330
|
private readonly cfg;
|
|
2180
2331
|
private readonly engine;
|
|
2332
|
+
private readonly events;
|
|
2181
2333
|
private readonly objs3D;
|
|
2182
2334
|
private raycasterPick;
|
|
2183
2335
|
private raycasterVisible;
|
|
2336
|
+
private colliders;
|
|
2337
|
+
private objsColliders;
|
|
2184
2338
|
private objsOccluders;
|
|
2185
|
-
private readonly
|
|
2186
|
-
private
|
|
2339
|
+
private readonly objsOccludees;
|
|
2340
|
+
private hasPickables;
|
|
2341
|
+
private useSceneAsOccluder;
|
|
2187
2342
|
private objActive;
|
|
2188
2343
|
private objCandidate;
|
|
2189
2344
|
private closestObjCounter;
|
|
2190
|
-
private
|
|
2191
|
-
private
|
|
2192
|
-
private
|
|
2193
|
-
private
|
|
2345
|
+
private indexOccludeeNext;
|
|
2346
|
+
private pickablesEnabled;
|
|
2347
|
+
private timeOccludeeNext;
|
|
2348
|
+
private callbackOccludees;
|
|
2194
2349
|
private callbackPointerHover;
|
|
2195
2350
|
private listenerClick;
|
|
2196
2351
|
private listenerCancel;
|
|
@@ -2205,14 +2360,19 @@ export declare class Raycast {
|
|
|
2205
2360
|
private dirCamToObj;
|
|
2206
2361
|
private posNdcPointer;
|
|
2207
2362
|
/* Excluded from this release type: __constructor */
|
|
2208
|
-
private
|
|
2209
|
-
/**
|
|
2210
|
-
|
|
2211
|
-
/**
|
|
2212
|
-
|
|
2363
|
+
private checkOccludeeVisible;
|
|
2364
|
+
/** Removes all colliders and restores scene objects hidden by `setColliders()`. */
|
|
2365
|
+
clearColliders(): void;
|
|
2366
|
+
/** Enables pickable raycasting and its pointer event listeners. */
|
|
2367
|
+
enablePickables(): void;
|
|
2368
|
+
/** Disables pickable raycasting without removing the collider configuration. */
|
|
2369
|
+
disablePickables(): void;
|
|
2370
|
+
private getColliderState;
|
|
2371
|
+
private getPickableHit;
|
|
2213
2372
|
private getObjAtPointer;
|
|
2214
|
-
private
|
|
2215
|
-
/* Excluded from this release type:
|
|
2373
|
+
private emitPointerEvent;
|
|
2374
|
+
/* Excluded from this release type: getOccludeeState */
|
|
2375
|
+
/* Excluded from this release type: getOccludeeVisible */
|
|
2216
2376
|
private onCanvasClick;
|
|
2217
2377
|
private onCanvasPointerLeave;
|
|
2218
2378
|
private onCanvasPointerMove;
|
|
@@ -2220,49 +2380,20 @@ export declare class Raycast {
|
|
|
2220
2380
|
private onCanvasPointerDown;
|
|
2221
2381
|
private onCanvasPointerExit;
|
|
2222
2382
|
private onCanvasPointerUp;
|
|
2223
|
-
private onPointerEnter;
|
|
2224
|
-
private onPointerLeave;
|
|
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 */
|
|
2239
2383
|
/**
|
|
2240
|
-
*
|
|
2241
|
-
*
|
|
2242
|
-
*
|
|
2243
|
-
* @param params - Parameter object.
|
|
2244
|
-
* @param params.objs3D - The `Obj3D` instances to track.
|
|
2384
|
+
* Replaces the current raycast colliders. The complete scene is used for occlusion until this method or `clearColliders()` is called for the first time.
|
|
2385
|
+
* @param colliders - Scene objects and their occluder, pickable, and visibility roles.
|
|
2245
2386
|
*/
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
/* Excluded from this release type: untrackOccl */
|
|
2250
|
-
/**
|
|
2251
|
-
* Stops tracking the specified scene objects for ray intersection detection. It automatically removes the pointer event listeners if no tracked objects remain.
|
|
2252
|
-
*
|
|
2253
|
-
* @param params - Parameter object.
|
|
2254
|
-
* @param params.objs3D - The `Obj3D` instances to untrack.
|
|
2255
|
-
*/
|
|
2256
|
-
untrackPickables({ objs3D }: {
|
|
2257
|
-
objs3D: Obj3D[];
|
|
2258
|
-
}): void;
|
|
2387
|
+
setColliders(colliders: Collider[]): void;
|
|
2388
|
+
/* Excluded from this release type: trackOccludee */
|
|
2389
|
+
/* Excluded from this release type: untrackOccludee */
|
|
2259
2390
|
/**
|
|
2260
2391
|
* Registers and executes a low-level extension function with access to the public `Raycast` API.
|
|
2261
2392
|
* @param extension - Function that receives the current `Raycast` instance and can use its public members and methods.
|
|
2262
2393
|
* @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
2394
|
*/
|
|
2264
2395
|
use(extension: (raycast: Raycast) => void): void;
|
|
2265
|
-
private
|
|
2396
|
+
private updateOccludees;
|
|
2266
2397
|
private updatePointerHover;
|
|
2267
2398
|
private updatePointerPosition;
|
|
2268
2399
|
}
|
|
@@ -2272,16 +2403,6 @@ export declare class Raycast {
|
|
|
2272
2403
|
* @category Cfg
|
|
2273
2404
|
*/
|
|
2274
2405
|
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;
|
|
2285
2406
|
/**
|
|
2286
2407
|
* Circle radius around the pointer in pixels.
|
|
2287
2408
|
* @default 10
|
|
@@ -2297,6 +2418,16 @@ export declare interface RaycastCfg {
|
|
|
2297
2418
|
* @default 5
|
|
2298
2419
|
*/
|
|
2299
2420
|
countClosestObjs: number;
|
|
2421
|
+
/**
|
|
2422
|
+
* Time in milliseconds over which all pending occludee checks are distributed once. A value of `0` processes all pending checks in one frame.
|
|
2423
|
+
* @default 0
|
|
2424
|
+
*/
|
|
2425
|
+
occludeeInterval: number;
|
|
2426
|
+
/**
|
|
2427
|
+
* Relative movement threshold used to request a new occlusion check. The value is multiplied by the current distance between the camera and the tracked occludee. A value of `0` reacts to every position change.
|
|
2428
|
+
* @default 0.01
|
|
2429
|
+
*/
|
|
2430
|
+
occlusionMoveFactor: number;
|
|
2300
2431
|
}
|
|
2301
2432
|
|
|
2302
2433
|
/**
|
|
@@ -2407,6 +2538,8 @@ export declare interface RenderCfg {
|
|
|
2407
2538
|
/** Defines the available renderer backends. */
|
|
2408
2539
|
export declare type Renderer = 'webgl' | 'webgpu' | 'auto';
|
|
2409
2540
|
|
|
2541
|
+
declare type Renderer_2 = THREE_TYPE.WebGLRenderer | THREE_WEBGPU_TYPE.WebGPURenderer;
|
|
2542
|
+
|
|
2410
2543
|
/**
|
|
2411
2544
|
* Defines the scene settings used to configure background, environment, model, fog and lights.
|
|
2412
2545
|
* @category Cfg
|
|
@@ -2436,10 +2569,10 @@ export declare interface SceneReadyEvent {
|
|
|
2436
2569
|
type: 'Scene_Ready';
|
|
2437
2570
|
}
|
|
2438
2571
|
|
|
2439
|
-
/** @event Fired after the scene has been rendered for the first time and triggers the corresponding XState event. */
|
|
2572
|
+
/** @event Fired after the scene or a progressive scene variant has been rendered for the first time and triggers the corresponding XState event. */
|
|
2440
2573
|
export declare interface SceneRenderedEvent {
|
|
2441
|
-
/** Identifies
|
|
2442
|
-
type: 'Scene_Rendered'
|
|
2574
|
+
/** Identifies the rendered scene or progressive scene variant. */
|
|
2575
|
+
type: 'Scene_Rendered' | `Scene${number}_Rendered`;
|
|
2443
2576
|
}
|
|
2444
2577
|
|
|
2445
2578
|
/**
|
|
@@ -2712,6 +2845,17 @@ export declare interface StateMachineCfg {
|
|
|
2712
2845
|
*/
|
|
2713
2846
|
export declare type StopMode = 'all' | 'last' | 'none';
|
|
2714
2847
|
|
|
2848
|
+
/**
|
|
2849
|
+
* Defines the material texture slots available for unused GLTF images.
|
|
2850
|
+
*
|
|
2851
|
+
* - `ColorMap` assigns the texture to `map`. Use it with a `MeshBasicMaterial` for a fully baked color texture.
|
|
2852
|
+
* - `LightMap` assigns the texture to the `lightMap` slot and requires a `MeshStandardMaterial`.
|
|
2853
|
+
* - `AlphaMap` assigns a separate alpha texture to the `alphaMap` slot, which GLTF does not support natively.
|
|
2854
|
+
*/
|
|
2855
|
+
export declare type TextureSlot = 'ColorMap' | 'LightMap' | 'AlphaMap';
|
|
2856
|
+
|
|
2857
|
+
/* Excluded from this release type: TextUsed */
|
|
2858
|
+
|
|
2715
2859
|
/** Function returned by an event subscription. Calling it removes the associated listener. */
|
|
2716
2860
|
export declare type Unsubscribe = () => void;
|
|
2717
2861
|
|