From ae42e4243a79e61b71679ed1349544e4fa642c3e Mon Sep 17 00:00:00 2001 From: Victor Giers Date: Mon, 18 May 2026 16:02:47 +0200 Subject: [PATCH] Add material texture cache cleanup method --- src/viewport-three/viewport-host.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/viewport-three/viewport-host.ts b/src/viewport-three/viewport-host.ts index 5c4e28a4..86ae2352 100644 --- a/src/viewport-three/viewport-host.ts +++ b/src/viewport-three/viewport-host.ts @@ -10743,6 +10743,14 @@ export class ViewportHost { } } + private clearMaterialTextureCache() { + for (const cachedTexture of this.materialTextureCache.values()) { + disposeMaterialTextureSet(cachedTexture.textureSet); + } + + this.materialTextureCache.clear(); + } + private getOrCreateTextureSet(material: MaterialDef) { const signature = createMaterialSignature(material, this.loadedImageAssets); const cachedTexture = this.materialTextureCache.get(material.id);