/* COPYRIGHT Esri - https://js.arcgis.com/5.0/LICENSE.txt */
import{__decorate as o}from"tslib";import{define as i,uniform as r,option as t}from"../../../GraphShaderModule.js";import{Vec4 as e,clamp as s,Float as l,Vec3 as a}from"../../../graph/glsl.js";import{BaseRasterColorizerShader as p}from"./BaseRasterColorizerShader.js";import{rgb2hsv as n,hsv2rgb as h}from"./colorConversion.js";import{lookupColor as m,ColormapConfig as d}from"./lut.js";import{getSurfaceValues as c,hillshade as f,HillshadeConfig as u}from"./surface.js";class g extends p{constructor(){super(...arguments),this.type="RasterColorizerShadedReliefShader",this.applyColormap=!1,this.isMultidirectional=!1}_colorize(o){const{texture:i}=this.config,r=c(i,o,this.config.srcImageSize),t=f(r,this.hillshadeConfig,this.isMultidirectional);if(!this.applyColormap)return new e(t.x,t.x,t.x,t.a);const{minValue:p,maxValue:d}=this.hillshadeConfig,u=this._getPixel(o),g=d.subtract(p),x=u.r.subtract(p),y=s(x.divide(g),new l(0),new l(1)),C=m(new e(y,y,y,1),new l(255),this.colormapConfig),w=n(C.xyz),j=h(new a(w.xy,t.x));return new e(j,C.a.multiply(t.a))}}o([i],g.prototype,"applyColormap",void 0),o([i],g.prototype,"isMultidirectional",void 0),o([r(u)],g.prototype,"hillshadeConfig",void 0),o([t(d)],g.prototype,"colormapConfig",void 0);export{g as RasterColorizerShadedReliefShader};
