@gnsx/three 0.184.9 → 0.184.11

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.
@@ -30567,6 +30567,53 @@ class RenderObjects {
30567
30567
 
30568
30568
  }
30569
30569
 
30570
+ // WITH_GENESYS
30571
+ /**
30572
+ * Disposes every {@link RenderObject} associated with `scene`.
30573
+ *
30574
+ * @param {Scene} scene - The scene being removed.
30575
+ */
30576
+ disposeSceneResources( scene ) {
30577
+
30578
+ const renderObjects = Array.from( this._renderObjects );
30579
+
30580
+ for ( const renderObject of renderObjects ) {
30581
+
30582
+ if ( renderObject.scene === scene ) {
30583
+
30584
+ renderObject.dispose();
30585
+
30586
+ }
30587
+
30588
+ }
30589
+
30590
+ }
30591
+
30592
+ /**
30593
+ * Disposes every {@link RenderObject} for `object` drawn with `scene`.
30594
+ * Call before disposing a renderer-owned mesh (e.g. background skybox) so WebGPU
30595
+ * bindings are released while the renderer keeps running.
30596
+ *
30597
+ * @param {Object3D} object - The 3D object.
30598
+ * @param {Scene} scene - The scene reference used when the object was rendered.
30599
+ */
30600
+ disposeObjectResources( object, scene ) {
30601
+
30602
+ const renderObjects = Array.from( this._renderObjects );
30603
+
30604
+ for ( const renderObject of renderObjects ) {
30605
+
30606
+ if ( renderObject.object === object && renderObject.scene === scene ) {
30607
+
30608
+ renderObject.dispose();
30609
+
30610
+ }
30611
+
30612
+ }
30613
+
30614
+ }
30615
+ // !WITH_GENESYS
30616
+
30570
30617
  /**
30571
30618
  * Factory method for creating render objects with the given list of parameters.
30572
30619
  *
@@ -48685,6 +48732,39 @@ class Background extends DataMap {
48685
48732
 
48686
48733
  }
48687
48734
 
48735
+ // WITH_GENESYS
48736
+ /**
48737
+ * Disposes the renderer-owned background skybox mesh (material and geometry)
48738
+ * for `scene` and clears cached mesh state.
48739
+ *
48740
+ * Does not dispose {@link Scene#background}.
48741
+ *
48742
+ * @param {Scene} scene - The scene.
48743
+ */
48744
+ disposeScene( scene ) {
48745
+
48746
+ if ( this.has( scene ) === false ) return;
48747
+
48748
+ const sceneData = this.get( scene );
48749
+
48750
+ const backgroundMesh = sceneData.backgroundMesh;
48751
+
48752
+ if ( backgroundMesh !== undefined ) {
48753
+
48754
+ this.renderer._objects.disposeObjectResources( backgroundMesh, scene );
48755
+
48756
+ backgroundMesh.material.dispose();
48757
+ backgroundMesh.geometry.dispose();
48758
+
48759
+ delete sceneData.backgroundMesh;
48760
+ delete sceneData.backgroundMeshNode;
48761
+ delete sceneData.backgroundCacheKey;
48762
+
48763
+ }
48764
+
48765
+ }
48766
+ // !WITH_GENESYS
48767
+
48688
48768
  /**
48689
48769
  * Updates the background for the given scene. Depending on how `Scene.background`
48690
48770
  * or `Scene.backgroundNode` are configured, this method might configure a simple clear
@@ -55427,6 +55507,30 @@ class NodeManager extends DataMap {
55427
55507
 
55428
55508
  }
55429
55509
 
55510
+ // WITH_GENESYS
55511
+ /**
55512
+ * Clears cached background and environment node state for `scene`.
55513
+ *
55514
+ * Does not call `texture.dispose()` on {@link Scene#background} or
55515
+ * {@link Scene#environment}.
55516
+ *
55517
+ * @param {Scene} scene - The scene.
55518
+ */
55519
+ clearSceneBackgroundAndEnvironmentNodes( scene ) {
55520
+
55521
+ if ( this.has( scene ) === false ) return;
55522
+
55523
+ const sceneData = this.get( scene );
55524
+
55525
+ delete sceneData.backgroundNode;
55526
+ delete sceneData.background;
55527
+ delete sceneData.backgroundBlurriness;
55528
+ delete sceneData.environmentNode;
55529
+ delete sceneData.environment;
55530
+
55531
+ }
55532
+ // !WITH_GENESYS
55533
+
55430
55534
  /**
55431
55535
  * This method is part of the caching of nodes which are used to represents the
55432
55536
  * scene's background, fog or environment.
@@ -60927,6 +61031,28 @@ class Renderer {
60927
61031
 
60928
61032
  }
60929
61033
 
61034
+ // WITH_GENESYS
61035
+ /**
61036
+ * Releases renderer resources scoped to `scene` when the scene is removed but
61037
+ * this renderer instance continues to run. Disposes matching {@link RenderObject}s,
61038
+ * the internal background skybox mesh, and cached background/environment nodes.
61039
+ *
61040
+ * Does not call `texture.dispose()` on {@link Scene#background} or
61041
+ * {@link Scene#environment}; the caller remains responsible for those textures.
61042
+ *
61043
+ * @param {Scene} scene - The scene being removed.
61044
+ */
61045
+ disposeSceneResources( scene ) {
61046
+
61047
+ if ( this._initialized !== true ) return;
61048
+
61049
+ this._objects.disposeSceneResources( scene );
61050
+ this._nodes.clearSceneBackgroundAndEnvironmentNodes( scene );
61051
+ this._background.disposeScene( scene );
61052
+
61053
+ }
61054
+ // !WITH_GENESYS
61055
+
60930
61056
  /**
60931
61057
  * Sets the given render target. Calling this method means the renderer does not
60932
61058
  * target the default framebuffer (meaning the canvas) anymore but a custom framebuffer.