chunk-NKUISUYG.js 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. import {
  2. a3 as a,
  3. a4 as a2,
  4. c,
  5. c2,
  6. c3,
  7. c4,
  8. d,
  9. d2,
  10. d4 as d3,
  11. e2 as e,
  12. e4 as e2,
  13. e5 as e3,
  14. e6 as e4,
  15. f2 as f,
  16. h3 as h,
  17. i2 as i,
  18. i3 as i2,
  19. i4 as i3,
  20. i5 as i4,
  21. l,
  22. m3 as m,
  23. m4 as m2,
  24. n,
  25. n3 as n2,
  26. n4 as n3,
  27. o,
  28. o2,
  29. o4 as o3,
  30. o6 as o4,
  31. r3 as r,
  32. s,
  33. s2,
  34. t,
  35. t2,
  36. u
  37. } from "./chunk-OBMTYN3I.js";
  38. import {
  39. O as O2
  40. } from "./chunk-EPIK5VPD.js";
  41. import {
  42. O
  43. } from "./chunk-XXBIV3TZ.js";
  44. // node_modules/@arcgis/core/views/3d/webgl-engine/core/shaderModules/Matrix4Uniform.js
  45. var o5 = class extends i {
  46. constructor(r2) {
  47. super(r2, "mat4");
  48. }
  49. };
  50. // node_modules/@arcgis/core/chunks/RealisticTree.glsl.js
  51. function B(B2) {
  52. const V2 = new i4(), I = V2.vertex.code, R = V2.fragment.code, z = d3(V2, B2);
  53. 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`
  54. void main(void) {
  55. forwardNormalizedVertexColor();
  56. vcolorExt = externalColor;
  57. ${B2.instancedColor ? "vcolorExt *= instanceColor;" : ""}
  58. vcolorExt *= vvColor();
  59. vcolorExt *= getSymbolColor();
  60. forwardColorMixMode();
  61. if (vcolorExt.a < ${n.float(t)}) {
  62. gl_Position = vec4(1e38, 1e38, 1e38, 1.0);
  63. } else {
  64. vpos = calculateVPos();
  65. localvpos = vpos - view[3].xyz;
  66. vpos = subtractOrigin(vpos);
  67. vNormalWorld = dpNormal(vvLocalNormal(normalModel()));
  68. vpos = addVerticalOffset(vpos, localOrigin);
  69. gl_Position = transformPosition(proj, view, vpos);
  70. ${B2.offsetBackfaces ? "gl_Position = offsetBackfacingClipPosition(gl_Position, vpos, vNormalWorld, cameraPosition);" : ""}
  71. }
  72. ${B2.hasMultipassTerrain ? n`depth = (view * vec4(vpos, 1.0)).z;` : ""}
  73. forwardLinearDepth();
  74. forwardTextureCoordinates();
  75. }
  76. `)), 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`
  77. void main() {
  78. discardBySlice(vpos);
  79. ${B2.hasMultipassTerrain ? n`terrainDepthTest(gl_FragCoord, depth);` : ""}
  80. ${B2.hasColorTexture ? n`
  81. vec4 texColor = texture2D(tex, vuv0);
  82. ${B2.textureAlphaPremultiplied ? "texColor.rgb /= texColor.a;" : ""}
  83. discardOrAdjustAlpha(texColor);` : n`vec4 texColor = vec4(1.0);`}
  84. ${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));`}
  85. gl_FragColor = vec4(opacity_);
  86. }
  87. `)), 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`
  88. void main() {
  89. discardBySlice(vpos);
  90. ${B2.hasMultipassTerrain ? n`terrainDepthTest(gl_FragCoord, depth);` : ""}
  91. ${B2.hasColorTexture ? n`
  92. vec4 texColor = texture2D(tex, vuv0);
  93. ${B2.textureAlphaPremultiplied ? "texColor.rgb /= texColor.a;" : ""}
  94. discardOrAdjustAlpha(texColor);` : n`vec4 texColor = vec4(1.0);`}
  95. vec3 viewDirection = normalize(vpos - cameraPosition);
  96. ${B2.pbrMode === l.Normal ? "applyPBRFactors();" : ""}
  97. float ssao = evaluateAmbientOcclusionInverse();
  98. ssao *= getBakedOcclusion();
  99. float additionalAmbientScale = additionalDirectedAmbientLight(vpos + localOrigin);
  100. vec3 additionalLight = ssao * lightingMainIntensity * additionalAmbientScale * ambientBoostFactor * lightingGlobalFactor;
  101. ${B2.receiveShadows ? "float shadow = readShadowMap(vpos, linearDepth);" : B2.spherical ? "float shadow = lightingGlobalFactor * (1.0 - additionalAmbientScale);" : "float shadow = 0.0;"}
  102. vec3 matColor = max(ambient, diffuse);
  103. ${B2.hasVertexColors ? n`
  104. vec3 albedo = mixExternalColor(vColor.rgb * matColor, texColor.rgb, vcolorExt.rgb, int(colorMixMode));
  105. float opacity_ = layerOpacity * mixExternalOpacity(vColor.a * opacity, texColor.a, vcolorExt.a, int(colorMixMode));` : n`
  106. vec3 albedo = mixExternalColor(matColor, texColor.rgb, vcolorExt.rgb, int(colorMixMode));
  107. float opacity_ = layerOpacity * mixExternalOpacity(opacity, texColor.a, vcolorExt.a, int(colorMixMode));`}
  108. ${B2.snowCover ? n`albedo = mix(albedo, vec3(1), 0.9);` : n``}
  109. ${n`
  110. vec3 shadingNormal = normalize(vNormalWorld);
  111. albedo *= 1.2;
  112. vec3 viewForward = vec3(view[0][2], view[1][2], view[2][2]);
  113. float alignmentLightView = clamp(dot(viewForward, -lightingMainDirection), 0.0, 1.0);
  114. float transmittance = 1.0 - clamp(dot(viewForward, shadingNormal), 0.0, 1.0);
  115. float treeRadialFalloff = vColor.r;
  116. float backLightFactor = 0.5 * treeRadialFalloff * alignmentLightView * transmittance * (1.0 - shadow);
  117. additionalLight += backLightFactor * lightingMainIntensity;`}
  118. ${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``}
  119. ${B2.pbrMode === l.Normal || B2.pbrMode === l.Schematic ? n`
  120. float additionalAmbientIrradiance = additionalAmbientIrradianceFactor * lightingMainIntensity[2];
  121. ${B2.snowCover ? n`
  122. mrr = vec3(0.0, 1.0, 0.04);
  123. emission = vec3(0.0);` : ""}
  124. 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);`}
  125. gl_FragColor = highlightSlice(vec4(shadedColor, opacity_), vpos);
  126. ${B2.transparencyPassType === O2.Color ? n`gl_FragColor = premultiplyAlpha(gl_FragColor);` : n``}
  127. }
  128. `)), V2.include(f, B2), V2;
  129. }
  130. var V = Object.freeze(Object.defineProperty({ __proto__: null, build: B }, Symbol.toStringTag, { value: "Module" }));
  131. export {
  132. B,
  133. V
  134. };
  135. //# sourceMappingURL=chunk-NKUISUYG.js.map