浏览代码

Dispose of texture when block disposed

Popov72 4 年之前
父节点
当前提交
f0e6f7a029

+ 5 - 0
src/Materials/Node/Blocks/Dual/currentScreenBlock.ts

@@ -300,6 +300,11 @@ export class CurrentScreenBlock extends NodeMaterialBlock {
             this.texture = Texture.Parse(serializationObject.texture, scene, rootUrl) as Texture;
         }
     }
+
+    public dispose() {
+        super.dispose();
+        this.texture?.dispose();
+    }
 }
 
 _TypeStore.RegisteredTypes["BABYLON.CurrentScreenBlock"] = CurrentScreenBlock;

+ 5 - 0
src/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.ts

@@ -459,6 +459,11 @@ export abstract class ReflectionTextureBaseBlock extends NodeMaterialBlock {
             }
         }
     }
+
+    public dispose() {
+        super.dispose();
+        this.texture?.dispose();
+    }
 }
 
 _TypeStore.RegisteredTypes["BABYLON.ReflectionTextureBaseBlock"] = ReflectionTextureBaseBlock;

+ 5 - 0
src/Materials/Node/Blocks/Dual/textureBlock.ts

@@ -449,6 +449,11 @@ export class TextureBlock extends NodeMaterialBlock {
             this.texture = Texture.Parse(serializationObject.texture, scene, rootUrl) as Texture;
         }
     }
+
+    public dispose() {
+        super.dispose();
+        this.texture?.dispose();
+    }
 }
 
 _TypeStore.RegisteredTypes["BABYLON.TextureBlock"] = TextureBlock;

+ 5 - 0
src/Materials/Node/Blocks/PBR/refractionBlock.ts

@@ -349,6 +349,11 @@ export class RefractionBlock extends NodeMaterialBlock {
         this.linkRefractionWithTransparency = serializationObject.linkRefractionWithTransparency;
         this.invertRefractionY = serializationObject.invertRefractionY;
     }
+
+    public dispose() {
+        super.dispose();
+        this.texture?.dispose();
+    }
 }
 
 _TypeStore.RegisteredTypes["BABYLON.RefractionBlock"] = RefractionBlock;

+ 5 - 0
src/Materials/Node/Blocks/Particle/particleTextureBlock.ts

@@ -218,6 +218,11 @@ export class ParticleTextureBlock extends NodeMaterialBlock {
             this.texture = Texture.Parse(serializationObject.texture, scene, rootUrl) as Texture;
         }
     }
+
+    public dispose() {
+        super.dispose();
+        this.texture?.dispose();
+    }
 }
 
 _TypeStore.RegisteredTypes["BABYLON.ParticleTextureBlock"] = ParticleTextureBlock;