@doegis/core
Version:
DOE GIS API
3 lines (1 loc) • 666 B
JavaScript
import{prepareMarkerResources as e}from"../../support/engineContent/marker.js";import{RenderTexture as t}from"../core/material/RenderTexture.js";class r{constructor(e,t){this._textures=e,this._textureRepository=t,this._texturesByPrimitive=new Map}acquire(r){if(!this._texturesByPrimitive.has(r)){const i=e(this._textures,r),s=new t(this._textureRepository,i.texture.id);return this._texturesByPrimitive.set(r,{result:i,reference:s}),i.texture}return this._texturesByPrimitive.get(r).result.texture}destroy(){this._texturesByPrimitive.forEach((({result:e,reference:t})=>{t.dispose(),e.release()})),this._texturesByPrimitive.clear()}}export{r as MarkerTextureCache};