@gnsx/three 0.184.7 → 0.184.8

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.
@@ -9867,6 +9867,32 @@ class RendererReferenceNode extends ReferenceBaseNode {
9867
9867
  */
9868
9868
  const rendererReference = ( name, type, renderer = null ) => new RendererReferenceNode( name, type, renderer );
9869
9869
 
9870
+ // WITH_GENESYS
9871
+ /**
9872
+ * Clears strong links from a {@link RendererReferenceNode} to a disposed renderer.
9873
+ * Module-level nodes (e.g. `toneMappingExposure`) set `.reference` each frame via
9874
+ * `updateReference()` and are not cleared by {@link Renderer#dispose} otherwise.
9875
+ *
9876
+ * @param {RendererReferenceNode} node - The reference node to detach.
9877
+ * @param {Renderer} renderer - The renderer being disposed.
9878
+ */
9879
+ function detachRendererReference( node, renderer ) {
9880
+
9881
+ if ( node.reference === renderer ) {
9882
+
9883
+ node.reference = null;
9884
+
9885
+ }
9886
+
9887
+ if ( node.renderer === renderer ) {
9888
+
9889
+ node.renderer = null;
9890
+
9891
+ }
9892
+
9893
+ }
9894
+ // !WITH_GENESYS
9895
+
9870
9896
  /**
9871
9897
  * This node represents a tone mapping operation.
9872
9898
  *
@@ -30384,6 +30410,7 @@ class RenderObjects {
30384
30410
  */
30385
30411
  this.chainMaps = {};
30386
30412
 
30413
+ // WITH_GENESYS
30387
30414
  /**
30388
30415
  * Strongly tracks every render object created through {@link createRenderObject}
30389
30416
  * so {@link dispose} can iterate them. ChainMap is `WeakMap`-backed and not
@@ -30398,6 +30425,7 @@ class RenderObjects {
30398
30425
  * @type {Set<RenderObject>}
30399
30426
  */
30400
30427
  this._renderObjects = new Set();
30428
+ // !WITH_GENESYS
30401
30429
 
30402
30430
  }
30403
30431
 
@@ -30499,6 +30527,7 @@ class RenderObjects {
30499
30527
  */
30500
30528
  dispose() {
30501
30529
 
30530
+ // WITH_GENESYS
30502
30531
  // Snapshot first: `RenderObject.dispose()` fires `onDispose` which
30503
30532
  // mutates `_renderObjects` (and the chain map). Iterating the live set
30504
30533
  // would skip entries.
@@ -30511,6 +30540,7 @@ class RenderObjects {
30511
30540
 
30512
30541
  }
30513
30542
 
30543
+ // !WITH_GENESYS
30514
30544
  this.chainMaps = {};
30515
30545
 
30516
30546
  }
@@ -30537,7 +30567,9 @@ class RenderObjects {
30537
30567
 
30538
30568
  const renderObject = new RenderObject( nodes, geometries, renderer, object, material, scene, camera, lightsNode, renderContext, clippingContext );
30539
30569
 
30570
+ // WITH_GENESYS
30540
30571
  this._renderObjects.add( renderObject );
30572
+ // !WITH_GENESYS
30541
30573
 
30542
30574
  renderObject.onDispose = () => {
30543
30575
 
@@ -30547,7 +30579,9 @@ class RenderObjects {
30547
30579
 
30548
30580
  chainMap.delete( renderObject.getChainArray() );
30549
30581
 
30582
+ // WITH_GENESYS
30550
30583
  this._renderObjects.delete( renderObject );
30584
+ // !WITH_GENESYS
30551
30585
 
30552
30586
  };
30553
30587
 
@@ -33634,6 +33668,7 @@ class Textures extends DataMap {
33634
33668
  */
33635
33669
  this._htmlTextures = new Set();
33636
33670
 
33671
+ // WITH_GENESYS
33637
33672
  /**
33638
33673
  * Strongly tracks every texture that has had a `'dispose'` listener
33639
33674
  * installed by {@link updateTexture}. `DataMap` is `WeakMap`-backed and
@@ -33655,6 +33690,7 @@ class Textures extends DataMap {
33655
33690
  * @type {Set<RenderTarget>}
33656
33691
  */
33657
33692
  this._renderTargets = new Set();
33693
+ // !WITH_GENESYS
33658
33694
 
33659
33695
  }
33660
33696
 
@@ -33782,7 +33818,9 @@ class Textures extends DataMap {
33782
33818
 
33783
33819
  renderTarget.addEventListener( 'dispose', renderTargetData.onDispose );
33784
33820
 
33821
+ // WITH_GENESYS
33785
33822
  this._renderTargets.add( renderTarget );
33823
+ // !WITH_GENESYS
33786
33824
 
33787
33825
  }
33788
33826
 
@@ -34004,7 +34042,9 @@ class Textures extends DataMap {
34004
34042
 
34005
34043
  texture.addEventListener( 'dispose', textureData.onDispose );
34006
34044
 
34045
+ // WITH_GENESYS
34007
34046
  this._textures.add( texture );
34047
+ // !WITH_GENESYS
34008
34048
 
34009
34049
  }
34010
34050
 
@@ -34174,7 +34214,9 @@ class Textures extends DataMap {
34174
34214
  this.delete( renderTarget );
34175
34215
  this.backend.delete( renderTarget );
34176
34216
 
34217
+ // WITH_GENESYS
34177
34218
  this._renderTargets.delete( renderTarget );
34219
+ // !WITH_GENESYS
34178
34220
 
34179
34221
  this.info.memory.renderTargets --;
34180
34222
 
@@ -34225,7 +34267,9 @@ class Textures extends DataMap {
34225
34267
 
34226
34268
  this.delete( texture );
34227
34269
 
34270
+ // WITH_GENESYS
34228
34271
  this._textures.delete( texture );
34272
+ // !WITH_GENESYS
34229
34273
 
34230
34274
  this.info.destroyTexture( texture );
34231
34275
 
@@ -34233,6 +34277,7 @@ class Textures extends DataMap {
34233
34277
 
34234
34278
  }
34235
34279
 
34280
+ // WITH_GENESYS
34236
34281
  /**
34237
34282
  * Frees internal resources. Destroys every tracked render target and
34238
34283
  * texture so the `'dispose'` listeners installed by {@link updateTexture}
@@ -34268,6 +34313,7 @@ class Textures extends DataMap {
34268
34313
  super.dispose();
34269
34314
 
34270
34315
  }
34316
+ // !WITH_GENESYS
34271
34317
 
34272
34318
  }
34273
34319
 
@@ -47786,6 +47832,7 @@ var TSL = /*#__PURE__*/Object.freeze({
47786
47832
  densityFogFactor: densityFogFactor,
47787
47833
  depth: depth,
47788
47834
  depthPass: depthPass,
47835
+ detachRendererReference: detachRendererReference,
47789
47836
  determinant: determinant,
47790
47837
  difference: difference,
47791
47838
  diffuseColor: diffuseColor,
@@ -60519,13 +60566,20 @@ class Renderer {
60519
60566
 
60520
60567
  } );
60521
60568
 
60569
+ // WITH_GENESYS
60522
60570
  // Drop the strong reference to the active `RenderContext` so module-level
60523
60571
  // `WeakMap<RenderContext, …>` caches can release entries once
60524
60572
  // `_renderContexts.dispose()` has cleared its dictionary.
60525
60573
  this._currentRenderContext = null;
60574
+ // !WITH_GENESYS
60526
60575
 
60527
60576
  }
60528
60577
 
60578
+ // WITH_GENESYS
60579
+ // Module-level TSL `toneMappingExposure` retains the last renderer in `.reference`.
60580
+ detachRendererReference( toneMappingExposure, this );
60581
+ // !WITH_GENESYS
60582
+
60529
60583
  this.setRenderTarget( null );
60530
60584
  this.setAnimationLoop( null );
60531
60585