UNPKG

@arcgis/core

Version:

ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API

3 lines (2 loc) 2.11 kB
/* COPYRIGHT Esri - https://js.arcgis.com/5.0.8/LICENSE.txt */ import"../../../../../core/has.js";import{BitBlitRenderer as e}from"../BitBlitRenderer.js";import{Effect as t}from"./Effect.js";import s from"./highlight/HighlightRenderer.js";import r from"./highlight/HighlightSurfaces.js";const i=4,h=4/i;class d extends t{constructor(){super(...arguments),this.defines=["highlight"],this._hlRenderer=new s,this._width=void 0,this._height=void 0,this._boundFBO=null,this._hlSurfaces=new r,this._adjustedWidth=void 0,this._adjustedHeight=void 0,this._blitRenderer=new e}dispose(){this._hlSurfaces?.dispose(),this._hlRenderer?.dispose(),this._boundFBO=null}bind(e){const{context:t,painter:s}=e,{width:r,height:i}=t.getViewport(),h=s.getFbos().effect0;this.setup(e,r,i),t.bindFramebuffer(h),t.setColorMask(!0,!0,!0,!0),t.setClearColor(0,0,0,0),t.clear(16384)}unbind(){}setup({context:e},t,s){this._width=t,this._height=s;const r=t%i,d=s%i;t+=r<i/2?-r:i-r,s+=d<i/2?-d:i-d,this._adjustedWidth=t,this._adjustedHeight=s,this._boundFBO=e.getBoundFramebufferObject();const l=Math.round(t*h),o=Math.round(s*h);this._hlRenderer.setup(e,l,o),this._hlSurfaces.setup(e,l,o)}draw(e){const{context:t,passOptions:s}=e,r=s.activeGradient,i=t.getBoundFramebufferObject();t.setViewport(0,0,this._adjustedWidth*h,this._adjustedHeight*h),t.bindFramebuffer(this._hlSurfaces.sharedBlur1Fbo),t.setStencilTestEnabled(!1),t.setClearColor(0,0,0,0),t.clear(16384),this._blitRenderer.render(t,i.colorTexture,9728,1),t.setStencilTestEnabled(!1),t.setBlendingEnabled(!1),t.setColorMask(!1,!1,!1,!0),t.bindFramebuffer(this._hlSurfaces.sharedBlur2Fbo),t.setClearColor(0,0,0,0),t.clear(16384),this._hlRenderer.preBlur(t,this._hlSurfaces.sharedBlur1Tex),t.bindFramebuffer(this._hlSurfaces.sharedBlur1Fbo),t.setClearColor(0,0,0,0),t.clear(16384),this._hlRenderer.finalBlur(t,this._hlSurfaces.sharedBlur2Tex),t.bindFramebuffer(this._boundFBO),t.setBlendingEnabled(!0),t.setColorMask(!0,!0,!0,!0),t.setViewport(0,0,this._width,this._height),this._hlRenderer.renderHighlight(t,this._hlSurfaces.sharedBlur1Tex,r),this._boundFBO=null}}export{d as default};