@polarfront-lab/ionian 3.0.4 → 3.0.6-hotfix.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/dist/index.d.ts +2 -0
- package/dist/ionian.iife.js +1 -1
- package/dist/ionian.iife.js.map +1 -1
- package/dist/ionian.js +33 -12
- package/dist/ionian.js.map +1 -1
- package/package.json +1 -1
package/dist/ionian.js
CHANGED
|
@@ -451,7 +451,7 @@ class DataTextureService {
|
|
|
451
451
|
this.dataTextures.set(asset.uuid, dataTexture);
|
|
452
452
|
return dataTexture;
|
|
453
453
|
}
|
|
454
|
-
|
|
454
|
+
dispose() {
|
|
455
455
|
this.dataTextures.forEach((texture) => texture.dispose());
|
|
456
456
|
this.dataTextures.clear();
|
|
457
457
|
if (this.currentAtlas) {
|
|
@@ -541,6 +541,8 @@ function sampleMesh(meshData, size) {
|
|
|
541
541
|
data[4 * index + 3] = (Math.random() - 0.5) * 0.01;
|
|
542
542
|
}
|
|
543
543
|
}
|
|
544
|
+
geometry.dispose();
|
|
545
|
+
material.dispose();
|
|
544
546
|
return data;
|
|
545
547
|
}
|
|
546
548
|
const instanceFragmentShader = `
|
|
@@ -705,14 +707,15 @@ class InstancedMeshManager {
|
|
|
705
707
|
/**
|
|
706
708
|
* Resizes or replaces the instanced mesh.
|
|
707
709
|
* @param size The new size of the instanced mesh.
|
|
708
|
-
* @returns
|
|
710
|
+
* @returns The updated instanced mesh.
|
|
709
711
|
*/
|
|
710
712
|
resize(size) {
|
|
711
|
-
if (this.size === size) return
|
|
713
|
+
if (this.size === size) return this.mesh;
|
|
712
714
|
this.size = size;
|
|
713
715
|
const prev = this.mesh;
|
|
714
716
|
this.mesh = this.createInstancedMesh(size, prev.geometry, prev.material);
|
|
715
|
-
|
|
717
|
+
prev.dispose();
|
|
718
|
+
return this.mesh;
|
|
716
719
|
}
|
|
717
720
|
/**
|
|
718
721
|
* Disposes the resources used by the InstancedMeshManager.
|
|
@@ -721,6 +724,7 @@ class InstancedMeshManager {
|
|
|
721
724
|
this.mesh.dispose();
|
|
722
725
|
this.geometries.forEach((geometry) => geometry.dispose());
|
|
723
726
|
this.shaderMaterial.dispose();
|
|
727
|
+
this.fallbackGeometry.dispose();
|
|
724
728
|
this.uvRefsCache.clear();
|
|
725
729
|
this.geometries.clear();
|
|
726
730
|
}
|
|
@@ -1660,9 +1664,19 @@ class TransitionService {
|
|
|
1660
1664
|
__publicField(this, "transitions", /* @__PURE__ */ new Map());
|
|
1661
1665
|
__publicField(this, "execStatus");
|
|
1662
1666
|
__publicField(this, "ongoingTransitions", /* @__PURE__ */ new Map());
|
|
1667
|
+
__publicField(this, "boundHandleTransitionCancelled");
|
|
1663
1668
|
this.eventEmitter = eventEmitter;
|
|
1664
1669
|
this.execStatus = new ExecutionStatusMap();
|
|
1665
|
-
this.
|
|
1670
|
+
this.boundHandleTransitionCancelled = this.handleTransitionCancelledEvent.bind(this);
|
|
1671
|
+
this.eventEmitter.on("transitionCancelled", this.boundHandleTransitionCancelled);
|
|
1672
|
+
}
|
|
1673
|
+
dispose() {
|
|
1674
|
+
this.eventEmitter.off("transitionCancelled", this.boundHandleTransitionCancelled);
|
|
1675
|
+
this.ongoingTransitions.forEach((transition) => {
|
|
1676
|
+
transition.cancelled = true;
|
|
1677
|
+
});
|
|
1678
|
+
this.ongoingTransitions.clear();
|
|
1679
|
+
this.transitions.clear();
|
|
1666
1680
|
}
|
|
1667
1681
|
/**
|
|
1668
1682
|
* Enqueues a transition.
|
|
@@ -1755,10 +1769,15 @@ class ParticlesEngine {
|
|
|
1755
1769
|
__publicField(this, "meshSequenceAtlasTexture", null);
|
|
1756
1770
|
// ADDED: To store the generated atlas
|
|
1757
1771
|
__publicField(this, "eventEmitter");
|
|
1772
|
+
// Bound event handlers for proper cleanup
|
|
1773
|
+
__publicField(this, "boundHandleServiceStateUpdated");
|
|
1774
|
+
__publicField(this, "boundHandleInteractionPositionUpdated");
|
|
1758
1775
|
const { scene, renderer, camera, textureSize, useIntersection = true } = params;
|
|
1759
1776
|
this.eventEmitter = new DefaultEventEmitter();
|
|
1760
1777
|
this.serviceStates = this.getInitialServiceStates();
|
|
1761
|
-
this.
|
|
1778
|
+
this.boundHandleServiceStateUpdated = this.handleServiceStateUpdated.bind(this);
|
|
1779
|
+
this.boundHandleInteractionPositionUpdated = this.handleInteractionPositionUpdated.bind(this);
|
|
1780
|
+
this.eventEmitter.on("serviceStateUpdated", this.boundHandleServiceStateUpdated);
|
|
1762
1781
|
this.scene = scene;
|
|
1763
1782
|
this.renderer = renderer;
|
|
1764
1783
|
this.engineState = this.initialEngineState(params);
|
|
@@ -1771,7 +1790,7 @@ class ParticlesEngine {
|
|
|
1771
1790
|
this.intersectionService = new IntersectionService(this.eventEmitter, camera);
|
|
1772
1791
|
if (!useIntersection) this.intersectionService.setActive(false);
|
|
1773
1792
|
this.setOverallProgress(0, false);
|
|
1774
|
-
this.eventEmitter.on("interactionPositionUpdated", this.
|
|
1793
|
+
this.eventEmitter.on("interactionPositionUpdated", this.boundHandleInteractionPositionUpdated);
|
|
1775
1794
|
}
|
|
1776
1795
|
/**
|
|
1777
1796
|
* Renders the scene.
|
|
@@ -1799,10 +1818,9 @@ class ParticlesEngine {
|
|
|
1799
1818
|
this.engineState.textureSize = size;
|
|
1800
1819
|
this.dataTextureManager.setTextureSize(size);
|
|
1801
1820
|
this.simulationRendererService.setTextureSize(size);
|
|
1821
|
+
this.scene.remove(this.instancedMeshManager.getMesh());
|
|
1802
1822
|
this.instancedMeshManager.resize(size);
|
|
1803
|
-
|
|
1804
|
-
await this.setMeshSequence(this.engineState.meshSequence);
|
|
1805
|
-
}
|
|
1823
|
+
this.scene.add(this.instancedMeshManager.getMesh());
|
|
1806
1824
|
if (this.engineState.meshSequence.length > 0) {
|
|
1807
1825
|
await this.setMeshSequence(this.engineState.meshSequence);
|
|
1808
1826
|
}
|
|
@@ -1980,16 +1998,19 @@ class ParticlesEngine {
|
|
|
1980
1998
|
* Disposes the resources used by the engine.
|
|
1981
1999
|
*/
|
|
1982
2000
|
dispose() {
|
|
1983
|
-
var _a, _b, _c, _d, _e, _f;
|
|
2001
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
1984
2002
|
if (this.scene && this.instancedMeshManager) {
|
|
1985
2003
|
this.scene.remove(this.instancedMeshManager.getMesh());
|
|
1986
2004
|
}
|
|
2005
|
+
this.eventEmitter.off("serviceStateUpdated", this.boundHandleServiceStateUpdated);
|
|
2006
|
+
this.eventEmitter.off("interactionPositionUpdated", this.boundHandleInteractionPositionUpdated);
|
|
1987
2007
|
(_a = this.simulationRendererService) == null ? void 0 : _a.dispose();
|
|
1988
2008
|
(_b = this.instancedMeshManager) == null ? void 0 : _b.dispose();
|
|
1989
2009
|
(_c = this.intersectionService) == null ? void 0 : _c.dispose();
|
|
1990
2010
|
(_d = this.assetService) == null ? void 0 : _d.dispose();
|
|
1991
2011
|
(_e = this.dataTextureManager) == null ? void 0 : _e.dispose();
|
|
1992
|
-
(_f = this.
|
|
2012
|
+
(_f = this.transitionService) == null ? void 0 : _f.dispose();
|
|
2013
|
+
(_g = this.eventEmitter) == null ? void 0 : _g.dispose();
|
|
1993
2014
|
}
|
|
1994
2015
|
initialEngineState(params) {
|
|
1995
2016
|
return {
|