소스 검색

Fix bug when disposing the water material (Cannot read property '_framebuffer' of undefined), because customrendertarget were not deleted from the array

Temechon 9 년 전
부모
커밋
60fbf3f42f

+ 9 - 0
materialsLibrary/dist/babylon.waterMaterial.js

@@ -582,6 +582,15 @@ var BABYLON;
             if (this.bumpTexture) {
             if (this.bumpTexture) {
                 this.bumpTexture.dispose();
                 this.bumpTexture.dispose();
             }
             }
+            var index = this.getScene().customRenderTargets.indexOf(this._refractionRTT);
+            if (index != -1) {
+                this.getScene().customRenderTargets.splice(index, 1);
+            }
+            index = -1;
+            index = this.getScene().customRenderTargets.indexOf(this._reflectionRTT);
+            if (index != -1) {
+                this.getScene().customRenderTargets.splice(index, 1);
+            }
             if (this._reflectionRTT) {
             if (this._reflectionRTT) {
                 this._reflectionRTT.dispose();
                 this._reflectionRTT.dispose();
             }
             }

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 1 - 1
materialsLibrary/dist/babylon.waterMaterial.min.js


+ 11 - 0
materialsLibrary/materials/water/babylon.waterMaterial.ts

@@ -695,6 +695,17 @@ module BABYLON {
             if (this.bumpTexture) {
             if (this.bumpTexture) {
                 this.bumpTexture.dispose();
                 this.bumpTexture.dispose();
             }
             }
+
+            var index = this.getScene().customRenderTargets.indexOf(this._refractionRTT);
+            if (index != -1){
+                this.getScene().customRenderTargets.splice(index, 1);
+            }
+            index = -1;
+            index = this.getScene().customRenderTargets.indexOf(this._reflectionRTT);
+            if (index != -1){
+                this.getScene().customRenderTargets.splice(index, 1);
+            }
+
             if (this._reflectionRTT) {
             if (this._reflectionRTT) {
                 this._reflectionRTT.dispose();
                 this._reflectionRTT.dispose();
             }
             }