Kaynağa Gözat

clean dispose

Benjamin Guignabert 4 yıl önce
ebeveyn
işleme
7f9300413d

+ 5 - 3
src/Materials/Textures/prePassRenderTarget.ts

@@ -101,13 +101,15 @@ export class PrePassRenderTarget extends MultiRenderTarget {
      * Diposes this render target
      */
     public dispose() {
+        var scene = this._scene;
+
         super.dispose();
 
-        if (this._scene && this._scene.prePassRenderer) {
-            const index = this._scene.prePassRenderer.renderTargets.indexOf(this);
+        if (scene && scene.prePassRenderer) {
+            const index = scene.prePassRenderer.renderTargets.indexOf(this);
 
             if (index !== -1) {
-                this._scene.prePassRenderer.renderTargets.splice(index, 1);
+                scene.prePassRenderer.renderTargets.splice(index, 1);
             }
         }
 

+ 3 - 2
src/Rendering/prePassRendererSceneComponent.ts

@@ -187,14 +187,15 @@ export class PrePassRendererSceneComponent implements ISceneComponent {
      * context lost for instance.
      */
     public rebuild(): void {
-        // Nothing to do for this component
+        this.scene.disablePrePassRenderer();
+        this.scene.enablePrePassRenderer();
     }
 
     /**
      * Disposes the component and the associated ressources
      */
     public dispose(): void {
-        // Nothing to do for this component
+        this.scene.disablePrePassRenderer();
     }
 
 }

+ 3 - 1
src/Rendering/subSurfaceConfiguration.ts

@@ -157,7 +157,9 @@ export class SubSurfaceConfiguration implements PrePassEffectConfiguration {
      */
     public dispose() {
         this.clearAllDiffusionProfiles();
-        this.postProcess.dispose();
+        if (this.postProcess) {
+            this.postProcess.dispose();
+        }
     }
 
     /**

+ 2 - 2
tests/validation/config.json

@@ -1117,8 +1117,8 @@
         {
             "title": "Prepass SSAO + point light",
             "renderCount": 10,
-            "playgroundId": "#XDNVAY#5",
-            "referenceImage": "prepass-ssao-point-light.png"
+            "playgroundId": "#XDNVAY#6",
+                "referenceImage": "prepass-ssao-point-light.png"
         },
         {
             "title": "Prepass SSAO + on/off post-process",