123456789101112131415 |
- /*
- All material copyright ESRI, All Rights Reserved, unless otherwise specified.
- See https://js.arcgis.com/4.25/esri/copyright.txt for details.
- */
- import{ScreenSpacePass as e}from"../views/3d/webgl-engine/core/shaderLibrary/ScreenSpacePass.js";import{DiscardOrAdjustAlphaBlend as r}from"../views/3d/webgl-engine/core/shaderLibrary/util/DiscardOrAdjustAlphaBlend.glsl.js";import{FloatPassUniform as i}from"../views/3d/webgl-engine/core/shaderModules/FloatPassUniform.js";import{glsl as s}from"../views/3d/webgl-engine/core/shaderModules/interfaces.js";import{ShaderBuilder as o}from"../views/3d/webgl-engine/core/shaderModules/ShaderBuilder.js";import{Texture2DPassUniform as n}from"../views/3d/webgl-engine/core/shaderModules/Texture2DPassUniform.js";function t(t){const a=new o;a.include(e),a.include(r);const{usesHalfFloat:d}=t;return a.fragment.uniforms.add([new n("densityMap",(e=>e.densityMap)),new n("tex",(e=>e.colorRamp)),new i("densityNormalizer",(e=>1/(e.maxDensity-e.minDensity))),new i("minDensity",(e=>e.minDensity))]),a.fragment.uniforms.add(new i("densityMultiplier",(e=>3/(e.searchRadius*e.searchRadius*Math.PI)))),d&&a.constants.add("compressionFactor","float",4),a.fragment.code.add(s`
- void main() {
- float density = texture2D(densityMap, uv).r * densityMultiplier${d?s` * compressionFactor`:""};
- float densityRatio = (density - minDensity) * densityNormalizer;
- vec4 color = texture2D(tex, vec2(clamp(densityRatio, 0.0, 1.0), 0.5));
- discardOrAdjustAlpha(color);
- gl_FragColor = color;
- }
- `),a}const a=Object.freeze(Object.defineProperty({__proto__:null,build:t},Symbol.toStringTag,{value:"Module"}));export{a as H,t as b};
|