@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
15 lines (14 loc) • 1.83 kB
JavaScript
/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.32/esri/copyright.txt for details.
*/
import{ScreenSpacePass as e}from"../views/3d/webgl-engine/core/shaderLibrary/ScreenSpacePass.glsl.js";import{ReadDepth as r}from"../views/3d/webgl-engine/core/shaderLibrary/output/ReadDepth.glsl.js";import{Float2PassUniform as a}from"../views/3d/webgl-engine/core/shaderModules/Float2PassUniform.js";import{FloatPassUniform as o}from"../views/3d/webgl-engine/core/shaderModules/FloatPassUniform.js";import{glsl as t}from"../views/3d/webgl-engine/core/shaderModules/glsl.js";import{Texture2DPassUniform as s}from"../views/3d/webgl-engine/core/shaderModules/Texture2DPassUniform.js";import{NoParameters as i}from"../views/webgl/NoParameters.js";import{ShaderBuilder as l}from"../views/webgl/ShaderBuilder.js";class n extends i{constructor(){super(...arguments),this.depthDistanceModifier=1.5}}function d(){const i=new l,n=i.fragment;return i.include(e),n.include(r),n.uniforms.add(new s("colorTexture",(e=>e.color)),new s("depthTexture",((e,r)=>r.mainDepth)),new a("nearFar",((e,r)=>r.camera.nearFar)),new o("depthDistanceModifier",(e=>e.depthDistanceModifier))),n.main.add(t`vec4 emissiveValue = texture(colorTexture, uv);
float depthSample = depthFromTexture(depthTexture, uv);
if(depthSample < 1.0 && depthSample > 0.0) {
float linearDepth = -linearizeDepth(depthSample);
float distNearFar = (nearFar[1] - nearFar[0]);
float linearDepthNorm = 1.0 - ((linearDepth - nearFar[0]) / distNearFar);
fragColor = emissiveValue * pow(linearDepthNorm, depthDistanceModifier);
} else {
fragColor = emissiveValue;
}`),i}const m=Object.freeze(Object.defineProperty({__proto__:null,BloomDepthAdjustPassParameters:n,build:d},Symbol.toStringTag,{value:"Module"}));export{m as B,n as a,d as b};