chunk-VW76IV6V.js 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. import {
  2. a2 as a,
  3. a3 as a2,
  4. b,
  5. c,
  6. d2 as d,
  7. d4 as d2,
  8. e2,
  9. e6 as e3,
  10. e8 as e4,
  11. h,
  12. h3 as h2,
  13. h4 as h3,
  14. i3 as i,
  15. i4 as i2,
  16. n2,
  17. n3,
  18. n4,
  19. o as o2,
  20. o2 as o3,
  21. o4 as o5,
  22. o7,
  23. p,
  24. p2,
  25. r2 as r,
  26. s,
  27. s2,
  28. t,
  29. u2 as u,
  30. u3 as u2,
  31. v,
  32. v2,
  33. x
  34. } from "./chunk-5242SYQJ.js";
  35. import {
  36. o2 as o4
  37. } from "./chunk-LDMWL65U.js";
  38. import {
  39. e
  40. } from "./chunk-UUVY36LI.js";
  41. import {
  42. f,
  43. n,
  44. o2 as o,
  45. o3 as o6
  46. } from "./chunk-FQZKJNXZ.js";
  47. import {
  48. O
  49. } from "./chunk-RUM3DXFX.js";
  50. // node_modules/@arcgis/core/chunks/RealisticTree.glsl.js
  51. function I(I2) {
  52. const R2 = new o(), { vertex: z, fragment: k, varyings: G } = R2;
  53. return v(z, I2), R2.include(o5), G.add("vpos", "vec3"), R2.include(s, I2), R2.include(p, I2), R2.include(a, I2), I2.output !== h.Color && I2.output !== h.Alpha || (c(R2.vertex, I2), R2.include(o2, I2), R2.include(r, I2), I2.offsetBackfaces && R2.include(e3), I2.instancedColor && R2.attributes.add(O.INSTANCECOLOR, "vec4"), G.add("vNormalWorld", "vec3"), G.add("localvpos", "vec3"), I2.hasMultipassTerrain && G.add("depth", "float"), R2.include(o3, I2), R2.include(d2, I2), R2.include(i, I2), R2.include(e4, I2), z.uniforms.add(new e("externalColor", (e5) => e5.externalColor)), G.add("vcolorExt", "vec4"), z.code.add(n`
  54. void main(void) {
  55. forwardNormalizedVertexColor();
  56. vcolorExt = externalColor;
  57. ${I2.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. ${I2.offsetBackfaces ? "gl_Position = offsetBackfacingClipPosition(gl_Position, vpos, vNormalWorld, cameraPosition);" : ""}
  71. }
  72. ${I2.hasMultipassTerrain ? n`depth = (view * vec4(vpos, 1.0)).z;` : ""}
  73. forwardLinearDepth();
  74. forwardTextureCoordinates();
  75. }
  76. `)), I2.output === h.Alpha && (R2.include(u, I2), R2.include(s2, I2), R2.include(n4, I2), k.uniforms.add([new o6("opacity", (e5) => e5.opacity), new o6("layerOpacity", (e5) => e5.layerOpacity)]), I2.hasColorTexture && k.uniforms.add(new f("tex", (e5) => e5.texture)), k.include(i2), k.code.add(n`
  77. void main() {
  78. discardBySlice(vpos);
  79. ${I2.hasMultipassTerrain ? n`terrainDepthTest(gl_FragCoord, depth);` : ""}
  80. ${I2.hasColorTexture ? n`
  81. vec4 texColor = texture2D(tex, ${I2.hasColorTextureTransform ? n`colorUV` : n`vuv0`});
  82. ${I2.textureAlphaPremultiplied ? "texColor.rgb /= texColor.a;" : ""}
  83. discardOrAdjustAlpha(texColor);` : n`vec4 texColor = vec4(1.0);`}
  84. ${I2.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. `)), I2.output === h.Color && (R2.include(u, I2), R2.include(p2, I2), R2.include(n2, I2), R2.include(s2, I2), R2.include(I2.instancedDoublePrecision ? h3 : v2, I2), R2.include(n4, I2), c(R2.fragment, I2), o7(k), h2(k), u2(k), k.uniforms.add([z.uniforms.get("localOrigin"), z.uniforms.get("view"), new e2("ambient", (e5) => e5.ambient), new e2("diffuse", (e5) => e5.diffuse), new o6("opacity", (e5) => e5.opacity), new o6("layerOpacity", (e5) => e5.layerOpacity)]), I2.hasColorTexture && k.uniforms.add(new f("tex", (e5) => e5.texture)), R2.include(x, I2), R2.include(n3, I2), k.include(i2), R2.extensions.add("GL_OES_standard_derivatives"), a2(k), k.code.add(n`
  88. void main() {
  89. discardBySlice(vpos);
  90. ${I2.hasMultipassTerrain ? n`terrainDepthTest(gl_FragCoord, depth);` : ""}
  91. ${I2.hasColorTexture ? n`
  92. vec4 texColor = texture2D(tex, ${I2.hasColorTextureTransform ? n`colorUV` : n`vuv0`});
  93. ${I2.textureAlphaPremultiplied ? "texColor.rgb /= texColor.a;" : ""}
  94. discardOrAdjustAlpha(texColor);` : n`vec4 texColor = vec4(1.0);`}
  95. vec3 viewDirection = normalize(vpos - cameraPosition);
  96. ${I2.pbrMode === d.Normal ? "applyPBRFactors();" : ""}
  97. float ssao = evaluateAmbientOcclusionInverse();
  98. ssao *= getBakedOcclusion();
  99. float additionalAmbientScale = additionalDirectedAmbientLight(vpos + localOrigin);
  100. vec3 additionalLight = ssao * mainLightIntensity * additionalAmbientScale * ambientBoostFactor * lightingGlobalFactor;
  101. ${I2.receiveShadows ? "float shadow = readShadowMap(vpos, linearDepth);" : I2.spherical ? "float shadow = lightingGlobalFactor * (1.0 - additionalAmbientScale);" : "float shadow = 0.0;"}
  102. vec3 matColor = max(ambient, diffuse);
  103. ${I2.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. ${I2.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, -mainLightDirection), 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 * mainLightIntensity;`}
  118. ${I2.pbrMode === d.Normal || I2.pbrMode === d.Schematic ? I2.spherical ? n`vec3 normalGround = normalize(vpos + localOrigin);` : n`vec3 normalGround = vec3(0.0, 0.0, 1.0);` : n``}
  119. ${I2.pbrMode === d.Normal || I2.pbrMode === d.Schematic ? n`
  120. float additionalAmbientIrradiance = additionalAmbientIrradianceFactor * mainLightIntensity[2];
  121. ${I2.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. ${I2.transparencyPassType === o4.Color ? n`gl_FragColor = premultiplyAlpha(gl_FragColor);` : n``}
  127. }
  128. `)), R2.include(b, I2), R2;
  129. }
  130. var R = Object.freeze(Object.defineProperty({ __proto__: null, build: I }, Symbol.toStringTag, { value: "Module" }));
  131. export {
  132. I,
  133. R
  134. };
  135. //# sourceMappingURL=chunk-VW76IV6V.js.map