@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
16 lines (15 loc) • 2.13 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{SliceDraw as e}from"../views/3d/webgl-engine/core/shaderLibrary/Slice.glsl.js";import{terrainDepthTest as o}from"../views/3d/webgl-engine/core/shaderLibrary/shading/TerrainDepthTest.glsl.js";import{ColorConversion as r}from"../views/3d/webgl-engine/core/shaderLibrary/util/ColorConversion.glsl.js";import{addProjViewLocalOrigin as i}from"../views/3d/webgl-engine/core/shaderLibrary/util/View.glsl.js";import{Float2PassUniform as s}from"../views/3d/webgl-engine/core/shaderModules/Float2PassUniform.js";import{Float4PassUniform as l}from"../views/3d/webgl-engine/core/shaderModules/Float4PassUniform.js";import{glsl as t}from"../views/3d/webgl-engine/core/shaderModules/glsl.js";import{VertexAttribute as a}from"../views/3d/webgl-engine/lib/VertexAttribute.js";import{outputColorHighlightOID as d}from"../views/3d/webgl-engine/shaders/OutputColorHighlightOID.glsl.js";import{ShaderBuilder as n}from"../views/webgl/ShaderBuilder.js";function c(c){const v=new n,{vertex:g,fragment:m,varyings:u}=v;return v.fragment.include(e,c),v.include(o,c),v.include(d,c),i(g,c),v.attributes.add(a.POSITION,"vec3"),v.attributes.add(a.UV0,"vec2"),u.add("vUV","vec2"),u.add("vpos","vec3"),g.main.add(t`vUV = uv0;
vpos = position;
forwardViewPosDepth((view * vec4(position, 1.0)).xyz);
gl_Position = proj * view * vec4(position, 1.0);`),m.uniforms.add(new s("size",(e=>e.size))),m.uniforms.add(new l("color1",(e=>e.color1))),m.uniforms.add(new l("color2",(e=>e.color2))),m.include(r),m.main.add(t`discardByTerrainDepth();
vec2 uvScaled = vUV / (2.0 * size);
vec2 uv = fract(uvScaled - 0.25);
vec2 ab = clamp((abs(uv - 0.5) - 0.25) / fwidth(uvScaled), -0.5, 0.5);
float fade = smoothstep(0.25, 0.5, max(fwidth(uvScaled.x), fwidth(uvScaled.y)));
float t = mix(abs(ab.x + ab.y), 0.5, fade);
fragColor = mix(color2, color1, t);
outputColorHighlightOID(fragColor, vpos);`),v}const v=Object.freeze(Object.defineProperty({__proto__:null,build:c},Symbol.toStringTag,{value:"Module"}));export{v as C,c as b};