@gnsx/three 0.184.9 → 0.184.10
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/build/three.webgpu.js +126 -0
- package/build/three.webgpu.min.js +1 -1
- package/build/three.webgpu.nodes.js +126 -0
- package/build/three.webgpu.nodes.min.js +1 -1
- package/package.json +1 -1
- package/src/renderers/common/Background.js +33 -0
- package/src/renderers/common/RenderObjects.js +47 -0
- package/src/renderers/common/Renderer.js +22 -0
- package/src/renderers/common/nodes/NodeManager.js +24 -0
package/package.json
CHANGED
|
@@ -44,6 +44,39 @@ class Background extends DataMap {
|
|
|
44
44
|
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
+
// WITH_GENESYS
|
|
48
|
+
/**
|
|
49
|
+
* Disposes the renderer-owned background skybox mesh (material and geometry)
|
|
50
|
+
* for `scene` and clears cached mesh state.
|
|
51
|
+
*
|
|
52
|
+
* Does not dispose {@link Scene#background}.
|
|
53
|
+
*
|
|
54
|
+
* @param {Scene} scene - The scene.
|
|
55
|
+
*/
|
|
56
|
+
disposeScene( scene ) {
|
|
57
|
+
|
|
58
|
+
if ( this.has( scene ) === false ) return;
|
|
59
|
+
|
|
60
|
+
const sceneData = this.get( scene );
|
|
61
|
+
|
|
62
|
+
const backgroundMesh = sceneData.backgroundMesh;
|
|
63
|
+
|
|
64
|
+
if ( backgroundMesh !== undefined ) {
|
|
65
|
+
|
|
66
|
+
this.renderer._objects.disposeObjectResources( backgroundMesh, scene );
|
|
67
|
+
|
|
68
|
+
backgroundMesh.material.dispose();
|
|
69
|
+
backgroundMesh.geometry.dispose();
|
|
70
|
+
|
|
71
|
+
delete sceneData.backgroundMesh;
|
|
72
|
+
delete sceneData.backgroundMeshNode;
|
|
73
|
+
delete sceneData.backgroundCacheKey;
|
|
74
|
+
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
}
|
|
78
|
+
// !WITH_GENESYS
|
|
79
|
+
|
|
47
80
|
/**
|
|
48
81
|
* Updates the background for the given scene. Depending on how `Scene.background`
|
|
49
82
|
* or `Scene.backgroundNode` are configured, this method might configure a simple clear
|
|
@@ -207,6 +207,53 @@ class RenderObjects {
|
|
|
207
207
|
|
|
208
208
|
}
|
|
209
209
|
|
|
210
|
+
// WITH_GENESYS
|
|
211
|
+
/**
|
|
212
|
+
* Disposes every {@link RenderObject} associated with `scene`.
|
|
213
|
+
*
|
|
214
|
+
* @param {Scene} scene - The scene being removed.
|
|
215
|
+
*/
|
|
216
|
+
disposeSceneResources( scene ) {
|
|
217
|
+
|
|
218
|
+
const renderObjects = Array.from( this._renderObjects );
|
|
219
|
+
|
|
220
|
+
for ( const renderObject of renderObjects ) {
|
|
221
|
+
|
|
222
|
+
if ( renderObject.scene === scene ) {
|
|
223
|
+
|
|
224
|
+
renderObject.dispose();
|
|
225
|
+
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* Disposes every {@link RenderObject} for `object` drawn with `scene`.
|
|
234
|
+
* Call before disposing a renderer-owned mesh (e.g. background skybox) so WebGPU
|
|
235
|
+
* bindings are released while the renderer keeps running.
|
|
236
|
+
*
|
|
237
|
+
* @param {Object3D} object - The 3D object.
|
|
238
|
+
* @param {Scene} scene - The scene reference used when the object was rendered.
|
|
239
|
+
*/
|
|
240
|
+
disposeObjectResources( object, scene ) {
|
|
241
|
+
|
|
242
|
+
const renderObjects = Array.from( this._renderObjects );
|
|
243
|
+
|
|
244
|
+
for ( const renderObject of renderObjects ) {
|
|
245
|
+
|
|
246
|
+
if ( renderObject.object === object && renderObject.scene === scene ) {
|
|
247
|
+
|
|
248
|
+
renderObject.dispose();
|
|
249
|
+
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
}
|
|
255
|
+
// !WITH_GENESYS
|
|
256
|
+
|
|
210
257
|
/**
|
|
211
258
|
* Factory method for creating render objects with the given list of parameters.
|
|
212
259
|
*
|
|
@@ -2556,6 +2556,28 @@ class Renderer {
|
|
|
2556
2556
|
|
|
2557
2557
|
}
|
|
2558
2558
|
|
|
2559
|
+
// WITH_GENESYS
|
|
2560
|
+
/**
|
|
2561
|
+
* Releases renderer resources scoped to `scene` when the scene is removed but
|
|
2562
|
+
* this renderer instance continues to run. Disposes matching {@link RenderObject}s,
|
|
2563
|
+
* the internal background skybox mesh, and cached background/environment nodes.
|
|
2564
|
+
*
|
|
2565
|
+
* Does not call `texture.dispose()` on {@link Scene#background} or
|
|
2566
|
+
* {@link Scene#environment}; the caller remains responsible for those textures.
|
|
2567
|
+
*
|
|
2568
|
+
* @param {Scene} scene - The scene being removed.
|
|
2569
|
+
*/
|
|
2570
|
+
disposeSceneResources( scene ) {
|
|
2571
|
+
|
|
2572
|
+
if ( this._initialized !== true ) return;
|
|
2573
|
+
|
|
2574
|
+
this._objects.disposeSceneResources( scene );
|
|
2575
|
+
this._nodes.clearSceneBackgroundAndEnvironmentNodes( scene );
|
|
2576
|
+
this._background.disposeScene( scene );
|
|
2577
|
+
|
|
2578
|
+
}
|
|
2579
|
+
// !WITH_GENESYS
|
|
2580
|
+
|
|
2559
2581
|
/**
|
|
2560
2582
|
* Sets the given render target. Calling this method means the renderer does not
|
|
2561
2583
|
* target the default framebuffer (meaning the canvas) anymore but a custom framebuffer.
|
|
@@ -693,6 +693,30 @@ class NodeManager extends DataMap {
|
|
|
693
693
|
|
|
694
694
|
}
|
|
695
695
|
|
|
696
|
+
// WITH_GENESYS
|
|
697
|
+
/**
|
|
698
|
+
* Clears cached background and environment node state for `scene`.
|
|
699
|
+
*
|
|
700
|
+
* Does not call `texture.dispose()` on {@link Scene#background} or
|
|
701
|
+
* {@link Scene#environment}.
|
|
702
|
+
*
|
|
703
|
+
* @param {Scene} scene - The scene.
|
|
704
|
+
*/
|
|
705
|
+
clearSceneBackgroundAndEnvironmentNodes( scene ) {
|
|
706
|
+
|
|
707
|
+
if ( this.has( scene ) === false ) return;
|
|
708
|
+
|
|
709
|
+
const sceneData = this.get( scene );
|
|
710
|
+
|
|
711
|
+
delete sceneData.backgroundNode;
|
|
712
|
+
delete sceneData.background;
|
|
713
|
+
delete sceneData.backgroundBlurriness;
|
|
714
|
+
delete sceneData.environmentNode;
|
|
715
|
+
delete sceneData.environment;
|
|
716
|
+
|
|
717
|
+
}
|
|
718
|
+
// !WITH_GENESYS
|
|
719
|
+
|
|
696
720
|
/**
|
|
697
721
|
* This method is part of the caching of nodes which are used to represents the
|
|
698
722
|
* scene's background, fog or environment.
|