UNPKG

@doegis/core

Version:

DOE GIS API

3 lines (1 loc) 1.13 kB
import{disposeMaybe as e}from"../../../core/maybe.js";import{c as t}from"../../../chunks/vec2f32.js";import{TargetType as s,DepthStencilTargetType as i,TextureType as r,PixelFormat as o,PixelType as a,TextureWrapMode as h,TextureSamplingMode as p}from"../../webgl/enums.js";import{FramebufferObject as _}from"../../webgl/FramebufferObject.js";class f{constructor(e,f){this._size=t(),this._fbo=null,this._fbo=new _(e,{colorTarget:s.TEXTURE,depthStencilTarget:i.NONE},{target:r.TEXTURE_2D,pixelFormat:o.RGBA,dataType:a.UNSIGNED_BYTE,wrapMode:h.CLAMP_TO_EDGE,samplingMode:p.LINEAR_MIPMAP_LINEAR,hasMipmap:f,maxAnisotropy:8,width:0,height:0})}dispose(){this._fbo=e(this._fbo)}getTexture(){return this._fbo?this._fbo.colorTexture:null}isValid(){return null!==this._fbo}resize(e,t){this._size[0]=e,this._size[1]=t,this._fbo.resize(this._size[0],this._size[1])}bind(e){e.bindFramebuffer(this._fbo)}generateMipMap(){const e=this._fbo.colorTexture;e.descriptor.hasMipmap&&e.generateMipmap()}disposeRenderTargetMemory(){this._fbo?.resize(0,0)}get gpuMemoryUsage(){return this._fbo?.gpuMemoryUsage??0}}export{f as OverlayFramebufferObject};