UNPKG

@arcgis/core

Version:

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

21 lines (16 loc) 2.21 kB
/* All material copyright ESRI, All Rights Reserved, unless otherwise specified. See https://js.arcgis.com/4.33/esri/copyright.txt for details. */ import{ShaderOutput as e,isColorOrColorEmission as r}from"../views/3d/webgl-engine/core/shaderLibrary/ShaderOutput.js";import{SliceDraw as o}from"../views/3d/webgl-engine/core/shaderLibrary/Slice.glsl.js";import{Transform as i}from"../views/3d/webgl-engine/core/shaderLibrary/Transform.glsl.js";import{VertexColor as s}from"../views/3d/webgl-engine/core/shaderLibrary/attributes/VertexColor.glsl.js";import{OutputHighlight as t}from"../views/3d/webgl-engine/core/shaderLibrary/output/OutputHighlight.glsl.js";import{addProjViewLocalOrigin as l}from"../views/3d/webgl-engine/core/shaderLibrary/util/View.glsl.js";import{Float4PassUniform as a}from"../views/3d/webgl-engine/core/shaderModules/Float4PassUniform.js";import{FloatPassUniform as n}from"../views/3d/webgl-engine/core/shaderModules/FloatPassUniform.js";import{glsl as d}from"../views/3d/webgl-engine/core/shaderModules/glsl.js";import{VertexAttribute as c}from"../views/3d/webgl-engine/lib/VertexAttribute.js";import{ShaderBuilder as g}from"../views/webgl/ShaderBuilder.js";import{alphaCutoff as m}from"../webscene/support/AlphaCutoff.js";function u(u){const p=new g,{vertex:w,fragment:f,varyings:b}=p;return p.include(i,u),p.include(s,u),l(w,u),p.attributes.add(c.POSITION,"vec3"),b.add("vpos","vec3",{invariant:!0}),w.main.add(d`vpos = position; forwardNormalizedVertexColor(); gl_Position = transformPosition(proj, view, vpos);`),p.include(t,u),p.fragment.include(o,u),f.uniforms.add(new n("alphaCoverage",((e,r)=>Math.min(1,e.width*r.camera.pixelRatio)))),u.hasVertexColors||f.uniforms.add(new a("constantColor",(e=>e.color))),f.main.add(d` discardBySlice(vpos); vec4 color = ${u.hasVertexColors?"vColor":"constantColor"}; ${u.output===e.ObjectAndLayerIdColor?"color.a = 1.0;":""} if (color.a < ${d.float(m)}) { discard; } ${r(u.output)?d`fragColor = applySlice(color, vpos);`:""} calculateOcclusionAndOutputHighlight(); `),p}const p=Object.freeze(Object.defineProperty({__proto__:null,build:u},Symbol.toStringTag,{value:"Module"}));export{p as N,u as b};