import { a3 as a, a4 as a2, c, c2, c3, c4, d, d2, d4 as d3, e2 as e, e4 as e2, e5 as e3, e6 as e4, f2 as f, h3 as h, i2 as i, i3 as i2, i4 as i3, i5 as i4, l, m3 as m, m4 as m2, n, n3 as n2, n4 as n3, o, o2, o4 as o3, o6 as o4, r3 as r, s, s2, t, t2, u } from "./chunk-OBMTYN3I.js"; import { O as O2 } from "./chunk-EPIK5VPD.js"; import { O } from "./chunk-XXBIV3TZ.js"; // node_modules/@arcgis/core/views/3d/webgl-engine/core/shaderModules/Matrix4Uniform.js var o5 = class extends i { constructor(r2) { super(r2, "mat4"); } }; // node_modules/@arcgis/core/chunks/RealisticTree.glsl.js function B(B2) { const V2 = new i4(), I = V2.vertex.code, R = V2.fragment.code, z = d3(V2, B2); return V2.include(o3), V2.varyings.add("vpos", "vec3"), V2.include(s, B2), V2.include(m, B2), V2.include(a, B2), B2.output !== o.Color && B2.output !== o.Alpha || (c2(V2.vertex, B2), V2.include(o2, B2), V2.include(r), B2.offsetBackfaces && V2.include(e2), B2.instancedColor && V2.attributes.add(O.INSTANCECOLOR, "vec4"), V2.varyings.add("vNormalWorld", "vec3"), V2.varyings.add("localvpos", "vec3"), B2.hasMultipassTerrain && V2.varyings.add("depth", "float"), V2.include(d, B2), V2.include(t2, B2), V2.include(i2, B2), V2.include(e3, B2), V2.vertex.uniforms.add(new e4("externalColor", (e5) => e5.externalColor)), V2.varyings.add("vcolorExt", "vec4"), I.add(n` void main(void) { forwardNormalizedVertexColor(); vcolorExt = externalColor; ${B2.instancedColor ? "vcolorExt *= instanceColor;" : ""} vcolorExt *= vvColor(); vcolorExt *= getSymbolColor(); forwardColorMixMode(); if (vcolorExt.a < ${n.float(t)}) { gl_Position = vec4(1e38, 1e38, 1e38, 1.0); } else { vpos = calculateVPos(); localvpos = vpos - view[3].xyz; vpos = subtractOrigin(vpos); vNormalWorld = dpNormal(vvLocalNormal(normalModel())); vpos = addVerticalOffset(vpos, localOrigin); gl_Position = transformPosition(proj, view, vpos); ${B2.offsetBackfaces ? "gl_Position = offsetBackfacingClipPosition(gl_Position, vpos, vNormalWorld, cameraPosition);" : ""} } ${B2.hasMultipassTerrain ? n`depth = (view * vec4(vpos, 1.0)).z;` : ""} forwardLinearDepth(); forwardTextureCoordinates(); } `)), B2.output === o.Alpha && (V2.include(u, B2), V2.include(s2, B2), V2.include(n3, B2), V2.fragment.uniforms.add([new o4("opacity", (e5) => e5.opacity), new o4("layerOpacity", (e5) => e5.layerOpacity), new o5("view")]), B2.hasColorTexture && V2.fragment.uniforms.add(new c("tex", (e5) => e5.texture)), V2.fragment.include(i3), R.add(n` void main() { discardBySlice(vpos); ${B2.hasMultipassTerrain ? n`terrainDepthTest(gl_FragCoord, depth);` : ""} ${B2.hasColorTexture ? n` vec4 texColor = texture2D(tex, vuv0); ${B2.textureAlphaPremultiplied ? "texColor.rgb /= texColor.a;" : ""} discardOrAdjustAlpha(texColor);` : n`vec4 texColor = vec4(1.0);`} ${B2.hasVertexColors ? n`float opacity_ = layerOpacity * mixExternalOpacity(vColor.a * opacity, texColor.a, vcolorExt.a, int(colorMixMode));` : n`float opacity_ = layerOpacity * mixExternalOpacity(opacity, texColor.a, vcolorExt.a, int(colorMixMode));`} gl_FragColor = vec4(opacity_); } `)), B2.output === o.Color && (V2.include(u, B2), V2.include(m2, B2), V2.include(a2, B2), V2.include(s2, B2), V2.include(B2.instancedDoublePrecision ? h : c4, B2), V2.include(n3, B2), c2(V2.fragment, B2), V2.fragment.uniforms.add([z, new e("ambient", (e5) => e5.ambient), new e("diffuse", (e5) => e5.diffuse), new o4("opacity", (e5) => e5.opacity), new o4("layerOpacity", (e5) => e5.layerOpacity), new o5("view"), new o4("lightingGlobalFactor", (e5, o6) => o6.lighting.globalFactor), new e("lightingMainIntensity", (e5, o6) => o6.lighting.mainLight.intensity)]), V2.fragment.constants.add("ambientBoostFactor", "float", c3), B2.hasColorTexture && V2.fragment.uniforms.add(new c("tex", (e5) => e5.texture)), V2.include(d2, B2), V2.include(n2, B2), V2.fragment.include(i3), V2.extensions.add("GL_OES_standard_derivatives"), R.add(n` void main() { discardBySlice(vpos); ${B2.hasMultipassTerrain ? n`terrainDepthTest(gl_FragCoord, depth);` : ""} ${B2.hasColorTexture ? n` vec4 texColor = texture2D(tex, vuv0); ${B2.textureAlphaPremultiplied ? "texColor.rgb /= texColor.a;" : ""} discardOrAdjustAlpha(texColor);` : n`vec4 texColor = vec4(1.0);`} vec3 viewDirection = normalize(vpos - cameraPosition); ${B2.pbrMode === l.Normal ? "applyPBRFactors();" : ""} float ssao = evaluateAmbientOcclusionInverse(); ssao *= getBakedOcclusion(); float additionalAmbientScale = additionalDirectedAmbientLight(vpos + localOrigin); vec3 additionalLight = ssao * lightingMainIntensity * additionalAmbientScale * ambientBoostFactor * lightingGlobalFactor; ${B2.receiveShadows ? "float shadow = readShadowMap(vpos, linearDepth);" : B2.spherical ? "float shadow = lightingGlobalFactor * (1.0 - additionalAmbientScale);" : "float shadow = 0.0;"} vec3 matColor = max(ambient, diffuse); ${B2.hasVertexColors ? n` vec3 albedo = mixExternalColor(vColor.rgb * matColor, texColor.rgb, vcolorExt.rgb, int(colorMixMode)); float opacity_ = layerOpacity * mixExternalOpacity(vColor.a * opacity, texColor.a, vcolorExt.a, int(colorMixMode));` : n` vec3 albedo = mixExternalColor(matColor, texColor.rgb, vcolorExt.rgb, int(colorMixMode)); float opacity_ = layerOpacity * mixExternalOpacity(opacity, texColor.a, vcolorExt.a, int(colorMixMode));`} ${B2.snowCover ? n`albedo = mix(albedo, vec3(1), 0.9);` : n``} ${n` vec3 shadingNormal = normalize(vNormalWorld); albedo *= 1.2; vec3 viewForward = vec3(view[0][2], view[1][2], view[2][2]); float alignmentLightView = clamp(dot(viewForward, -lightingMainDirection), 0.0, 1.0); float transmittance = 1.0 - clamp(dot(viewForward, shadingNormal), 0.0, 1.0); float treeRadialFalloff = vColor.r; float backLightFactor = 0.5 * treeRadialFalloff * alignmentLightView * transmittance * (1.0 - shadow); additionalLight += backLightFactor * lightingMainIntensity;`} ${B2.pbrMode === l.Normal || B2.pbrMode === l.Schematic ? B2.spherical ? n`vec3 normalGround = normalize(vpos + localOrigin);` : n`vec3 normalGround = vec3(0.0, 0.0, 1.0);` : n``} ${B2.pbrMode === l.Normal || B2.pbrMode === l.Schematic ? n` float additionalAmbientIrradiance = additionalAmbientIrradianceFactor * lightingMainIntensity[2]; ${B2.snowCover ? n` mrr = vec3(0.0, 1.0, 0.04); emission = vec3(0.0);` : ""} vec3 shadedColor = evaluateSceneLightingPBR(shadingNormal, albedo, shadow, 1.0 - ssao, additionalLight, viewDirection, normalGround, mrr, emission, additionalAmbientIrradiance);` : n`vec3 shadedColor = evaluateSceneLighting(shadingNormal, albedo, shadow, 1.0 - ssao, additionalLight);`} gl_FragColor = highlightSlice(vec4(shadedColor, opacity_), vpos); ${B2.transparencyPassType === O2.Color ? n`gl_FragColor = premultiplyAlpha(gl_FragColor);` : n``} } `)), V2.include(f, B2), V2; } var V = Object.freeze(Object.defineProperty({ __proto__: null, build: B }, Symbol.toStringTag, { value: "Module" })); export { B, V }; //# sourceMappingURL=chunk-NKUISUYG.js.map