UNPKG

@arcgis/core

Version:

ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API

14 lines (13 loc) 829 B
/* All material copyright ESRI, All Rights Reserved, unless otherwise specified. See https://js.arcgis.com/4.32/esri/copyright.txt for details. */ import{ShaderOutput as t}from"../ShaderOutput.js";import{Rgba4FloatEncoding as a}from"../util/RgbaFloat16Encoding.glsl.js";import{glsl as o}from"../../shaderModules/glsl.js";function e(e,l){switch(l.output){case t.Shadow:case t.ShadowHighlight:case t.ShadowExcludeHighlight:case t.ViewshedShadow:e.fragment.include(a),e.fragment.code.add(o`float _calculateFragDepth(const in float depth) { const float SLOPE_SCALE = 2.0; const float BIAS = 20.0 * .000015259; float m = max(abs(dFdx(depth)), abs(dFdy(depth))); return depth + SLOPE_SCALE * m + BIAS; } void outputDepth(float _linearDepth) { fragColor = floatToRgba4(_calculateFragDepth(_linearDepth)); }`)}}export{e as OutputDepth};