illutions 0.28.0 → 0.29.1
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 +41 -28
- package/README.md +3 -0
- package/dist/main.d.ts +89 -0
- package/dist/main.min.cjs +1 -1
- package/dist/main.min.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,32 +1,45 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
## 0.
|
|
4
|
-
|
|
5
|
-
###
|
|
6
|
-
|
|
7
|
-
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
-
|
|
21
|
-
-
|
|
22
|
-
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
3
|
+
## 0.29.1
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
|
|
7
|
+
- Fixed progressive model loading so textures belonging to materials not currently assigned to a mesh are updated through all model quality levels.
|
|
8
|
+
|
|
9
|
+
## 0.29.0
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
|
|
13
|
+
- 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.
|
|
14
|
+
- Added the exported `TextureSlot` union for the supported material slots.
|
|
15
|
+
|
|
16
|
+
## 0.28.0
|
|
17
|
+
|
|
18
|
+
### Added
|
|
19
|
+
|
|
20
|
+
- Added `Mesh3D.animMaterialColor()`, `Mesh3D.animMaterialNumeric()`, and `Mesh3D.setMaterialProperties()` as object-bound counterparts to the existing `Engine` material methods.
|
|
21
|
+
- Added the optional `needsUpdate` parameter to `Engine.animMaterialNumeric()`, `Engine.setMaterialProperties()`, `Mesh3D.animMaterialNumeric()`, and `Mesh3D.setMaterialProperties()` to request material recompilation.
|
|
22
|
+
- Added degree-based horizontal orbit constraints through `orbitCtrls.minAzimuthAngle` and `orbitCtrls.maxAzimuthAngle`.
|
|
23
|
+
- Added `ModelLoadedEvent` with `Model_Loaded` for a single model and numbered `Model1_Loaded`, `Model2_Loaded`, etc. events for progressive models.
|
|
24
|
+
- Added the `Model_Ready` event after the final progressive model variant has been applied and rendered.
|
|
25
|
+
- 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.
|
|
26
|
+
|
|
27
|
+
### Changed
|
|
28
|
+
|
|
29
|
+
- Replaced `Raycast.setOccluders()`, `Raycast.resetOccluders()`, `Raycast.trackPickables()`, and `Raycast.untrackPickables()` with the unified collider API.
|
|
30
|
+
- Renamed `Raycast.enable()` and `Raycast.disable()` to `Raycast.enablePickables()` and `Raycast.disablePickables()`.
|
|
31
|
+
- Renamed `raycast.occlInterval` to `raycast.occludeeInterval` and `raycast.occlMoveFactor` to `raycast.occlusionMoveFactor`.
|
|
32
|
+
- Changed progressive `ModelLoadingEvent` and `SceneRenderedEvent` types to numbered `Model1_Loading`, `Scene1_Rendered`, etc. events; unnumbered events remain available for a single model.
|
|
33
|
+
- Removed the `level` property from `ModelLoadingEvent`; the progressive model level is now identified by the event type.
|
|
34
|
+
- Removed the obsolete `fct` property from `ClipEvent`.
|
|
35
|
+
- Changed pointer raycasts so that registered occluders block pickables behind them.
|
|
36
|
+
|
|
37
|
+
### Fixed
|
|
38
|
+
|
|
39
|
+
- Corrected `CanvasPointerEvent` to expose `Canvas_Click`, `Canvas_Pointer_Enter`, and `Canvas_Pointer_Leave`.
|
|
40
|
+
- Added the already emitted `FpvCtrls_Disposed` event to `FpvCtrlsEvent`.
|
|
41
|
+
- Delayed the postprocessing noise check until `Model_Ready` so that postprocessing is not disabled before the final progressive model variant is rendered.
|
|
42
|
+
|
|
30
43
|
## 0.27.0
|
|
31
44
|
|
|
32
45
|
### Added
|
|
@@ -159,4 +172,4 @@
|
|
|
159
172
|
|
|
160
173
|
### Changed
|
|
161
174
|
|
|
162
|
-
- Added `cfg.audio.enable` to the configuration.
|
|
175
|
+
- Added `cfg.audio.enable` to the configuration.
|
package/README.md
CHANGED
|
@@ -19,6 +19,9 @@ Coordinate GLTF animation clips, GSAP transitions, camera paths and custom dolly
|
|
|
19
19
|
**Progressive model and HDRI loading**
|
|
20
20
|
Load ordered model levels and environment maps progressively for faster initial presentation and seamless quality upgrades.
|
|
21
21
|
|
|
22
|
+
**Flexible baked texture workflows**
|
|
23
|
+
Assign embedded GLTF textures by name to any object and material as light maps, fully baked combined color maps or alpha maps.
|
|
24
|
+
|
|
22
25
|
**XState-powered application logic**
|
|
23
26
|
Model complex application flows as predictable and inspectable state machines with integrated XState 5 usage.
|
|
24
27
|
|
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';
|
|
@@ -1474,6 +1475,14 @@ export declare interface HemisphereCfg {
|
|
|
1474
1475
|
intensity: number;
|
|
1475
1476
|
}
|
|
1476
1477
|
|
|
1478
|
+
declare interface ImageTexture {
|
|
1479
|
+
name: string;
|
|
1480
|
+
material: THREE_TYPE.MeshBasicMaterial | THREE_TYPE.MeshStandardMaterial;
|
|
1481
|
+
slot: TextureSlot;
|
|
1482
|
+
lightMapIntensity: number;
|
|
1483
|
+
channel: number;
|
|
1484
|
+
}
|
|
1485
|
+
|
|
1477
1486
|
/**
|
|
1478
1487
|
* Defines the built-in engine infobox settings used to display FPS, CPU/frame timing and renderer.info values.
|
|
1479
1488
|
* @category Cfg
|
|
@@ -1660,6 +1669,7 @@ export declare class Mesh3D extends Obj3D {
|
|
|
1660
1669
|
groundReflector: ReflectorForSSRPass | null;
|
|
1661
1670
|
/** Objects that participate in the screen-space reflection (SSR) effect. These objects are used for reflective rendering in the scene. */
|
|
1662
1671
|
reflectivesSSR: THREE_TYPE.Object3D[];
|
|
1672
|
+
private model;
|
|
1663
1673
|
/* Excluded from this release type: lib */
|
|
1664
1674
|
/* Excluded from this release type: __constructor */
|
|
1665
1675
|
/**
|
|
@@ -1700,6 +1710,23 @@ export declare class Mesh3D extends Obj3D {
|
|
|
1700
1710
|
needsUpdate?: boolean;
|
|
1701
1711
|
[key: string]: any;
|
|
1702
1712
|
}): void;
|
|
1713
|
+
/**
|
|
1714
|
+
* Loads an unused texture embedded in the current GLTF and assigns it to a material.
|
|
1715
|
+
* @param options - Unused texture assignment settings.
|
|
1716
|
+
* @param options.name - Name of the GLTF image used by the texture.
|
|
1717
|
+
* @param options.material - Material that receives the unused texture.
|
|
1718
|
+
* @param options.slot - Target material texture slot. See {@link TextureSlot}.
|
|
1719
|
+
* @param options.lightMapIntensity - Light map intensity used for `LightMap`. Default: **1**
|
|
1720
|
+
* @param options.channel - Texture UV channel. Default: **1**
|
|
1721
|
+
* @public
|
|
1722
|
+
*/
|
|
1723
|
+
protected setTexture({ name, material, slot, lightMapIntensity, channel }: {
|
|
1724
|
+
name: string;
|
|
1725
|
+
material: THREE_TYPE.MeshBasicMaterial | THREE_TYPE.MeshStandardMaterial;
|
|
1726
|
+
slot: TextureSlot;
|
|
1727
|
+
lightMapIntensity?: number;
|
|
1728
|
+
channel?: number;
|
|
1729
|
+
}): void;
|
|
1703
1730
|
/**
|
|
1704
1731
|
* Called for each traversed mesh during GLTF parsing. Stores the current `THREE.Mesh` in `this.obj`.
|
|
1705
1732
|
* @param objGltf - The currently traversed mesh.
|
|
@@ -1709,6 +1736,7 @@ export declare class Mesh3D extends Obj3D {
|
|
|
1709
1736
|
* {@includeCode ../../examples/mesh3D-cube.ts}
|
|
1710
1737
|
*/
|
|
1711
1738
|
protected onTraverse(objGltf: THREE_TYPE.Mesh): void;
|
|
1739
|
+
/* Excluded from this release type: setModel */
|
|
1712
1740
|
/* Excluded from this release type: setReflectivesSSR */
|
|
1713
1741
|
/* Excluded from this release type: traverse */
|
|
1714
1742
|
}
|
|
@@ -1735,6 +1763,44 @@ export declare interface MeshCfg {
|
|
|
1735
1763
|
frustumCulled: boolean;
|
|
1736
1764
|
}
|
|
1737
1765
|
|
|
1766
|
+
declare class Model {
|
|
1767
|
+
private readonly canvas;
|
|
1768
|
+
private readonly cfg;
|
|
1769
|
+
private readonly events;
|
|
1770
|
+
private readonly modules;
|
|
1771
|
+
private readonly renderer;
|
|
1772
|
+
private readonly initFirstScene;
|
|
1773
|
+
private readonly reportModelReady;
|
|
1774
|
+
private readonly rendererReady;
|
|
1775
|
+
private readonly waitForRender;
|
|
1776
|
+
/* Excluded from this release type: sceneReady */
|
|
1777
|
+
private resolveSceneReady;
|
|
1778
|
+
private rejectSceneReady;
|
|
1779
|
+
private gltf;
|
|
1780
|
+
private meshes;
|
|
1781
|
+
private scene;
|
|
1782
|
+
private readonly imageTextures;
|
|
1783
|
+
private readonly imageTextureInits;
|
|
1784
|
+
private readonly textures;
|
|
1785
|
+
constructor({ canvas, cfg, events, modules, renderer, rendererReady, initFirstScene, reportModelReady, waitForRender }: ModelParams);
|
|
1786
|
+
private addMaterialsFromMesh;
|
|
1787
|
+
private addTexturesFromMaterial;
|
|
1788
|
+
private addTexture;
|
|
1789
|
+
private applyImageTexturesToMaterials;
|
|
1790
|
+
private disposeGeometries;
|
|
1791
|
+
private disposeSourceMaterials;
|
|
1792
|
+
private initImageTexture;
|
|
1793
|
+
private initImageTextures;
|
|
1794
|
+
private initTextures;
|
|
1795
|
+
/* Excluded from this release type: load */
|
|
1796
|
+
private loadGltf;
|
|
1797
|
+
private prepareImageTextures;
|
|
1798
|
+
/* Excluded from this release type: prepareImageTextureForMaterial */
|
|
1799
|
+
private reportError;
|
|
1800
|
+
private updateGeometries;
|
|
1801
|
+
private updateTextureImages;
|
|
1802
|
+
}
|
|
1803
|
+
|
|
1738
1804
|
/**
|
|
1739
1805
|
* Defines the GLTF/GLB model loading settings used to fetch models and configure optional Draco decoding.
|
|
1740
1806
|
* @category Cfg
|
|
@@ -1791,6 +1857,18 @@ export declare interface ModelLoadingEvent {
|
|
|
1791
1857
|
loading: number;
|
|
1792
1858
|
}
|
|
1793
1859
|
|
|
1860
|
+
declare interface ModelParams {
|
|
1861
|
+
canvas: HTMLElement;
|
|
1862
|
+
cfg: Cfg;
|
|
1863
|
+
events: Events;
|
|
1864
|
+
modules: Modules;
|
|
1865
|
+
renderer: Renderer_2;
|
|
1866
|
+
rendererReady: Promise<void> | null;
|
|
1867
|
+
initFirstScene: (gltf: GLTF) => Map<string, THREE_TYPE.Mesh>;
|
|
1868
|
+
reportModelReady: () => void;
|
|
1869
|
+
waitForRender: () => Promise<void>;
|
|
1870
|
+
}
|
|
1871
|
+
|
|
1794
1872
|
/** @event Fired after the final progressive model variant has been applied and rendered and triggers the corresponding XState event. */
|
|
1795
1873
|
export declare interface ModelReadyEvent {
|
|
1796
1874
|
/** Identifies this event type. */
|
|
@@ -2471,6 +2549,8 @@ export declare interface RenderCfg {
|
|
|
2471
2549
|
/** Defines the available renderer backends. */
|
|
2472
2550
|
export declare type Renderer = 'webgl' | 'webgpu' | 'auto';
|
|
2473
2551
|
|
|
2552
|
+
declare type Renderer_2 = THREE_TYPE.WebGLRenderer | THREE_WEBGPU_TYPE.WebGPURenderer;
|
|
2553
|
+
|
|
2474
2554
|
/**
|
|
2475
2555
|
* Defines the scene settings used to configure background, environment, model, fog and lights.
|
|
2476
2556
|
* @category Cfg
|
|
@@ -2776,6 +2856,15 @@ export declare interface StateMachineCfg {
|
|
|
2776
2856
|
*/
|
|
2777
2857
|
export declare type StopMode = 'all' | 'last' | 'none';
|
|
2778
2858
|
|
|
2859
|
+
/**
|
|
2860
|
+
* Defines the material texture slots available for unused GLTF images.
|
|
2861
|
+
*
|
|
2862
|
+
* - `ColorMap` assigns the texture to `map`. Use it with a `MeshBasicMaterial` for a fully baked color texture.
|
|
2863
|
+
* - `LightMap` assigns the texture to the `lightMap` slot and requires a `MeshStandardMaterial`.
|
|
2864
|
+
* - `AlphaMap` assigns a separate alpha texture to the `alphaMap` slot, which GLTF does not support natively.
|
|
2865
|
+
*/
|
|
2866
|
+
export declare type TextureSlot = 'ColorMap' | 'LightMap' | 'AlphaMap';
|
|
2867
|
+
|
|
2779
2868
|
/** Function returned by an event subscription. Calling it removes the associated listener. */
|
|
2780
2869
|
export declare type Unsubscribe = () => void;
|
|
2781
2870
|
|