/* COPYRIGHT Esri - https://js.arcgis.com/5.1.2/LICENSE.txt */
import{__decorate as t}from"tslib";import{uniform as e,define as r,UniformGroup as s}from"../../../../GraphShaderModule.js";import{negate as i,dot as o,Vec3 as a,Vec4 as u,Float as d}from"../../../../graph/glsl.js";import{getSurfaceValues as p}from"../surface.js";import{BaseRasterProcessorShader as l}from"./BaseRasterProcessorShader.js";class c extends s{}t([e(d)],c.prototype,"zlFactor",void 0);class g extends l{constructor(){super(...arguments),this.type="CurvatureShader"}_process(t){const e=p(this.texture,t,this.config.srcImageSize),r=e.get(3).add(e.get(5)).multiply(.5).subtract(e.get(4)),s=e.get(1).add(e.get(7)).multiply(.5).subtract(e.get(4)),{zlFactor:d}=this.curvatureConfig,{curvatureType:l}=this;let c;if("standard"===l)c=i(d).multiply(r.add(s));else{const t=e.get(2).subtract(e.get(0)).add(e.get(6)).subtract(e.get(8)).divide(4),u=e.get(5).subtract(e.get(3)).divide(2),p=e.get(1).subtract(e.get(7)).divide(2),g=u.multiply(u),m=p.multiply(p),n=u.multiply(p),y=d.divide(g.add(m));c="profile"===l?o(new a(r,s,t),new a(g,m,n)).multiply(y):o(new a(r,s,i(t)),new a(m,g,n)).multiply(i(y))}return new u(c,c,c,e.get(9))}}t([r],g.prototype,"curvatureType",void 0),t([e(c)],g.prototype,"curvatureConfig",void 0);export{g as CurvatureShader};
