/*
All material copyright Esri, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
*/
import{__decorate as t,__param as e}from"tslib";import{location as i,uniform as s,define as l,input as o,UniformGroup as r}from"../../GraphShaderModule.js";import{Float as p,Vec3 as a,Vec4 as n,length as u,step as m,Vec2 as d}from"../../graph/glsl.js";import{AFeatureShader as y,FeatureVertexInput as h,FeatureFragmentInput as c}from"./AFeatureShader.js";import{getHeatmapCompressionFactor as f}from"./heatmapUtils.js";import{hittestMarker as w}from"./hittestUtils.js";class v extends h{}t([i(5,d)],v.prototype,"offset",void 0);class x extends c{}class g extends r{}t([s(p)],g.prototype,"radius",void 0),t([s(p)],g.prototype,"isFieldActive",void 0);class F extends y{constructor(){super(...arguments),this.type="HeatmapAccumulateShader",this.usesHalfFloatPrecision=!1}vertex(t){const{radius:e,isFieldActive:i}=this.kernelControls,s=t.offset,l=i.multiply(this.storage.getVVData(t.id).x).add(new p(1).subtract(i)),o=this.view.displayViewScreenMat3.multiply(new a(t.pos,1)).add(this.view.displayViewMat3.multiply(new a(s,0)).multiply(e)),r=this.clip(t.id);return{glPosition:new n(o.xy,r,1),offset:s,fieldValue:l,color:new n(0),...this.maybeRunHittest(t,{},null)}}fragment(t){const{offset:e,fieldValue:i}=t,s=u(e),l=m(s,new p(1)),o=new p(1).subtract(s.multiply(s)),r=o.multiply(o),a=l.multiply(r).multiply(i).multiply(new p(f(this.usesHalfFloatPrecision)));return this.getFragmentOutput(new n(a),t)}hittest(t){const{viewMat3:e,tileMat3:i}=this.view,s=e.multiply(i).multiply(new a(t.pos,1));return w(s.xy,this.kernelControls.radius,this.hittestRequest.position)}}t([l],F.prototype,"usesHalfFloatPrecision",void 0),t([s(g)],F.prototype,"kernelControls",void 0),t([e(0,o(v))],F.prototype,"vertex",null),t([e(0,o(x))],F.prototype,"fragment",null);export{x as HeatmapAccumulateFragmentInput,F as HeatmapAccumulateShader,v as HeatmapAccumulateVertexInput};
