|
@@ -191,13 +191,23 @@ export class MultiMaterial extends Material {
|
|
* Dispose the material and release its associated resources
|
|
* Dispose the material and release its associated resources
|
|
* @param forceDisposeEffect Define if we want to force disposing the associated effect (if false the shader is not released and could be reuse later on)
|
|
* @param forceDisposeEffect Define if we want to force disposing the associated effect (if false the shader is not released and could be reuse later on)
|
|
* @param forceDisposeTextures Define if we want to force disposing the associated textures (if false, they will not be disposed and can still be use elsewhere in the app)
|
|
* @param forceDisposeTextures Define if we want to force disposing the associated textures (if false, they will not be disposed and can still be use elsewhere in the app)
|
|
|
|
+ * @param forceDisposeChildren Define if we want to force disposing the associated submaterials (if false, they will not be disposed and can still be use elsewhere in the app)
|
|
*/
|
|
*/
|
|
- public dispose(forceDisposeEffect?: boolean, forceDisposeTextures?: boolean): void {
|
|
|
|
|
|
+ public dispose(forceDisposeEffect?: boolean, forceDisposeTextures?: boolean, forceDisposeChildren?: boolean): void {
|
|
var scene = this.getScene();
|
|
var scene = this.getScene();
|
|
if (!scene) {
|
|
if (!scene) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ if (forceDisposeChildren === true) {
|
|
|
|
+ for (var index = 0; index < this.subMaterials.length; index++) {
|
|
|
|
+ var subMaterial = this.subMaterials[index];
|
|
|
|
+ if (subMaterial) {
|
|
|
|
+ subMaterial.dispose(forceDisposeEffect, forceDisposeTextures);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
var index = scene.multiMaterials.indexOf(this);
|
|
var index = scene.multiMaterials.indexOf(this);
|
|
if (index >= 0) {
|
|
if (index >= 0) {
|
|
scene.multiMaterials.splice(index, 1);
|
|
scene.multiMaterials.splice(index, 1);
|