Update material handling to dispose of originals in model rendering and viewport host
This commit is contained in:
@@ -88,11 +88,17 @@ function applyWireframeMaterialPresentation(group: Group) {
|
||||
}
|
||||
|
||||
if (Array.isArray(maybeMesh.material)) {
|
||||
maybeMesh.material = maybeMesh.material.map((material) => createWireframeMaterial(material));
|
||||
const originalMaterials = maybeMesh.material;
|
||||
maybeMesh.material = originalMaterials.map((material) => createWireframeMaterial(material));
|
||||
for (const material of originalMaterials) {
|
||||
material.dispose();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
maybeMesh.material = createWireframeMaterial(maybeMesh.material);
|
||||
const originalMaterial = maybeMesh.material;
|
||||
maybeMesh.material = createWireframeMaterial(originalMaterial);
|
||||
originalMaterial.dispose();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -719,11 +719,17 @@ export class ViewportHost {
|
||||
}
|
||||
|
||||
if (Array.isArray(maybeMesh.material)) {
|
||||
maybeMesh.material = maybeMesh.material.map((material) => this.createWireframeDisplayMaterial(material));
|
||||
const originalMaterials = maybeMesh.material;
|
||||
maybeMesh.material = originalMaterials.map((material) => this.createWireframeDisplayMaterial(material));
|
||||
for (const material of originalMaterials) {
|
||||
material.dispose();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
maybeMesh.material = this.createWireframeDisplayMaterial(maybeMesh.material);
|
||||
const originalMaterial = maybeMesh.material;
|
||||
maybeMesh.material = this.createWireframeDisplayMaterial(originalMaterial);
|
||||
originalMaterial.dispose();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user