Browse Source

gobj: TexturePool.release_all_textures() also clears preloadedImages

rdb 4 years ago
parent
commit
4237d98067
1 changed files with 13 additions and 0 deletions
  1. 13 0
      panda/src/gobj/texturePool.cxx

+ 13 - 0
panda/src/gobj/texturePool.cxx

@@ -30,6 +30,10 @@
 
 #include <algorithm>
 
+#ifdef __EMSCRIPTEN__
+#include <emscripten.h>
+#endif
+
 using std::istream;
 using std::ostream;
 using std::string;
@@ -973,6 +977,15 @@ ns_release_all_textures() {
 
   // Blow away the cache of resolved relative filenames.
   _relpath_lookup.clear();
+
+#ifdef __EMSCRIPTEN__
+  // Also empty the emscripten preload cache.
+  EM_ASM({
+    if (Module["preloadedImages"]) {
+      Module["preloadedImages"] = {};
+    }
+  });
+#endif
 }
 
 /**