/*
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 e}from"tslib";import{uniform as t,define as o,UniformGroup as i}from"../../../../GraphShaderModule.js";import{pow as r,Vec2 as p,sqrt as s,atan as l,Vec4 as d,Float as u}from"../../../../graph/glsl.js";import{getSurfaceValues as c,computeDeltaZ as m}from"../surface.js";import{BaseRasterProcessorShader as a}from"./BaseRasterProcessorShader.js";import{roundOutput as n}from"./math.js";class y extends i{}e([t(u)],y.prototype,"pixelSizePower",void 0),e([t(u)],y.prototype,"pixelSizeFactor",void 0),e([t(u)],y.prototype,"zFactor",void 0),e([t(p)],y.prototype,"cellSize",void 0);class h extends a{constructor(){super(...arguments),this.type="SlopeShader",this.isOutputRounded=!1,this.percentRise=!1}_process(e){const{cellSize:t,pixelSizePower:o,pixelSizeFactor:i,zFactor:u}=this.slopeConfig,a=r(t,new p(o)).multiply(i).add(u).divide(t.multiply(8)),{texture:y}=this.config,h=c(y,e,this.config.srcImageSize),{x:f,y:S}=m(h,a),x=s(f.multiply(f).add(S.multiply(S))),z=this.percentRise?x.multiply(100):l(x).multiply(57.2957795),v=new d(z,z,z,h[9]);return this.isOutputRounded?n(v):v}}e([o],h.prototype,"isOutputRounded",void 0),e([o],h.prototype,"percentRise",void 0),e([t(y)],h.prototype,"slopeConfig",void 0);export{h as SlopeShader};
