playcanvas
Version:
Open-source WebGL/WebGPU 3D engine for the web
21 lines (18 loc) • 674 B
JavaScript
import { RefCountedCache } from '../../core/ref-counted-cache.js';
// Pure static class, implementing the cache of lightmaps generated at runtime using Lightmapper
// this allows us to automatically release realtime baked lightmaps when mesh instances using them are destroyed
class LightmapCache {
// add texture reference to lightmap cache
static incRef(texture) {
this.cache.incRef(texture);
}
// remove texture reference from lightmap cache
static decRef(texture) {
this.cache.decRef(texture);
}
static destroy() {
this.cache.destroy();
}
}
LightmapCache.cache = new RefCountedCache();
export { LightmapCache };