chunk-WDB6D6R7.js 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277
  1. import {
  2. a as a2,
  3. a2 as a3,
  4. a3 as a4,
  5. b,
  6. c,
  7. d,
  8. d2,
  9. d4 as d3,
  10. e2 as e4,
  11. e3 as e5,
  12. e4 as e6,
  13. e6 as e7,
  14. e8,
  15. h,
  16. h3 as h2,
  17. h4 as h3,
  18. i,
  19. i3 as i2,
  20. i4 as i3,
  21. n as n3,
  22. n2 as n4,
  23. n3 as n5,
  24. n4 as n6,
  25. o as o3,
  26. o2 as o4,
  27. o4 as o6,
  28. p,
  29. p2,
  30. r2 as r3,
  31. s,
  32. s2,
  33. t,
  34. u2 as u3,
  35. u3 as u4,
  36. v,
  37. v2,
  38. x
  39. } from "./chunk-5242SYQJ.js";
  40. import {
  41. o2 as o5
  42. } from "./chunk-LDMWL65U.js";
  43. import {
  44. u as u2
  45. } from "./chunk-2UEXES4O.js";
  46. import {
  47. e as e2
  48. } from "./chunk-UUVY36LI.js";
  49. import {
  50. a,
  51. e2 as e3,
  52. f,
  53. n as n2,
  54. o2,
  55. o3 as o7,
  56. r as r2,
  57. u
  58. } from "./chunk-FQZKJNXZ.js";
  59. import {
  60. O
  61. } from "./chunk-RUM3DXFX.js";
  62. import {
  63. o
  64. } from "./chunk-44FMXGSC.js";
  65. import {
  66. e
  67. } from "./chunk-IQBIGNPU.js";
  68. import {
  69. n
  70. } from "./chunk-O6VYMEIX.js";
  71. import {
  72. r
  73. } from "./chunk-YXWMMD76.js";
  74. // node_modules/@arcgis/core/views/3d/webgl-engine/core/shaderLibrary/shading/Normals.glsl.js
  75. function e9(e10, o8) {
  76. const n8 = e10.fragment;
  77. switch (n8.code.add(n2`struct ShadingNormalParameters {
  78. vec3 normalView;
  79. vec3 viewDirection;
  80. } shadingParams;`), o8.doubleSidedMode) {
  81. case i4.None:
  82. n8.code.add(n2`vec3 shadingNormal(ShadingNormalParameters params) {
  83. return normalize(params.normalView);
  84. }`);
  85. break;
  86. case i4.View:
  87. n8.code.add(n2`vec3 shadingNormal(ShadingNormalParameters params) {
  88. return dot(params.normalView, params.viewDirection) > 0.0 ? normalize(-params.normalView) : normalize(params.normalView);
  89. }`);
  90. break;
  91. case i4.WindingOrder:
  92. n8.code.add(n2`vec3 shadingNormal(ShadingNormalParameters params) {
  93. return gl_FrontFacing ? normalize(params.normalView) : normalize(-params.normalView);
  94. }`);
  95. break;
  96. default:
  97. n(o8.doubleSidedMode);
  98. case i4.COUNT:
  99. }
  100. }
  101. var i4;
  102. !function(a5) {
  103. a5[a5.None = 0] = "None", a5[a5.View = 1] = "View", a5[a5.WindingOrder = 2] = "WindingOrder", a5[a5.COUNT = 3] = "COUNT";
  104. }(i4 || (i4 = {}));
  105. // node_modules/@arcgis/core/views/3d/webgl-engine/core/shaderLibrary/shading/ComputeNormalTexture.glsl.js
  106. function c2(c3, u5) {
  107. const l = c3.fragment;
  108. if (u5.hasVertexTangents ? (c3.attributes.add(O.TANGENT, "vec4"), c3.varyings.add("vTangent", "vec4"), u5.doubleSidedMode === i4.WindingOrder ? l.code.add(n2`mat3 computeTangentSpace(vec3 normal) {
  109. float tangentHeadedness = gl_FrontFacing ? vTangent.w : -vTangent.w;
  110. vec3 tangent = normalize(gl_FrontFacing ? vTangent.xyz : -vTangent.xyz);
  111. vec3 bitangent = cross(normal, tangent) * tangentHeadedness;
  112. return mat3(tangent, bitangent, normal);
  113. }`) : l.code.add(n2`mat3 computeTangentSpace(vec3 normal) {
  114. float tangentHeadedness = vTangent.w;
  115. vec3 tangent = normalize(vTangent.xyz);
  116. vec3 bitangent = cross(normal, tangent) * tangentHeadedness;
  117. return mat3(tangent, bitangent, normal);
  118. }`)) : (c3.extensions.add("GL_OES_standard_derivatives"), l.code.add(n2`mat3 computeTangentSpace(vec3 normal, vec3 pos, vec2 st) {
  119. vec3 Q1 = dFdx(pos);
  120. vec3 Q2 = dFdy(pos);
  121. vec2 stx = dFdx(st);
  122. vec2 sty = dFdy(st);
  123. float det = stx.t * sty.s - sty.t * stx.s;
  124. vec3 T = stx.t * Q2 - sty.t * Q1;
  125. T = T - normal * dot(normal, T);
  126. T *= inversesqrt(max(dot(T,T), 1.e-10));
  127. vec3 B = sign(det) * cross(normal, T);
  128. return mat3(T, B, normal);
  129. }`)), u5.textureCoordinateType !== d.None) {
  130. c3.include(a2, u5);
  131. const e10 = u5.supportsTextureAtlas ? u5.hasWebGL2Context ? e3.None : e3.Size : e3.None;
  132. l.uniforms.add(u5.pbrTextureBindType === a.Pass ? u("normalTexture", (e11) => e11.textureNormal, e10) : u2("normalTexture", (e11) => e11.textureNormal, e10)), l.code.add(n2`
  133. vec3 computeTextureNormal(mat3 tangentSpace, vec2 uv) {
  134. vtc.uv = uv;
  135. ${u5.supportsTextureAtlas ? n2`vtc.size = ${r2(u5, "normalTexture")};` : ""}
  136. vec3 rawNormal = textureLookup(normalTexture, vtc).rgb * 2.0 - 1.0;
  137. return tangentSpace * rawNormal;
  138. }
  139. `);
  140. }
  141. }
  142. // node_modules/@arcgis/core/views/3d/webgl-engine/core/shaderLibrary/shading/TextureTransformUV.glsl.js
  143. function s3(s4) {
  144. s4.vertex.uniforms.add(new e5("colorTextureTransformMatrix", (o8) => r(o8.colorTextureTransformMatrix) ? o8.colorTextureTransformMatrix : e())), s4.varyings.add("colorUV", "vec2"), s4.vertex.code.add(n2`void forwardColorUV(){
  145. colorUV = (colorTextureTransformMatrix * vec3(vuv0, 1.0)).xy;
  146. }`);
  147. }
  148. function i5(s4) {
  149. s4.vertex.uniforms.add(new e5("normalTextureTransformMatrix", (o8) => r(o8.normalTextureTransformMatrix) ? o8.normalTextureTransformMatrix : e())), s4.varyings.add("normalUV", "vec2"), s4.vertex.code.add(n2`void forwardNormalUV(){
  150. normalUV = (normalTextureTransformMatrix * vec3(vuv0, 1.0)).xy;
  151. }`);
  152. }
  153. function t2(s4) {
  154. s4.vertex.uniforms.add(new e5("emissiveTextureTransformMatrix", (o8) => r(o8.emissiveTextureTransformMatrix) ? o8.emissiveTextureTransformMatrix : e())), s4.varyings.add("emissiveUV", "vec2"), s4.vertex.code.add(n2`void forwardEmissiveUV(){
  155. emissiveUV = (emissiveTextureTransformMatrix * vec3(vuv0, 1.0)).xy;
  156. }`);
  157. }
  158. function n7(s4) {
  159. s4.vertex.uniforms.add(new e5("occlusionTextureTransformMatrix", (o8) => r(o8.occlusionTextureTransformMatrix) ? o8.occlusionTextureTransformMatrix : e())), s4.varyings.add("occlusionUV", "vec2"), s4.vertex.code.add(n2`void forwardOcclusionUV(){
  160. occlusionUV = (occlusionTextureTransformMatrix * vec3(vuv0, 1.0)).xy;
  161. }`);
  162. }
  163. function x2(s4) {
  164. s4.vertex.uniforms.add(new e5("metallicRoughnessTextureTransformMatrix", (o8) => r(o8.metallicRoughnessTextureTransformMatrix) ? o8.metallicRoughnessTextureTransformMatrix : e())), s4.varyings.add("metallicRoughnessUV", "vec2"), s4.vertex.code.add(n2`void forwardMetallicRoughnessUV(){
  165. metallicRoughnessUV = (metallicRoughnessTextureTransformMatrix * vec3(vuv0, 1.0)).xy;
  166. }`);
  167. }
  168. // node_modules/@arcgis/core/chunks/DefaultMaterial.glsl.js
  169. function Q(Q2) {
  170. const X2 = new o2(), { vertex: Y, fragment: Z, varyings: ee } = X2;
  171. return v(Y, Q2), X2.include(o6), ee.add("vpos", "vec3"), X2.include(s, Q2), X2.include(p, Q2), X2.include(a3, Q2), Q2.hasColorTextureTransform && X2.include(s3), Q2.output !== h.Color && Q2.output !== h.Alpha || (Q2.hasNormalTextureTransform && X2.include(i5), Q2.hasEmissionTextureTransform && X2.include(t2), Q2.hasOcclusionTextureTransform && X2.include(n7), Q2.hasMetallicRoughnessTextureTransform && X2.include(x2), c(Y, Q2), X2.include(o3, Q2), X2.include(r3, Q2), Q2.normalType === i.Attribute && Q2.offsetBackfaces && X2.include(e7), X2.include(c2, Q2), X2.include(n3, Q2), Q2.instancedColor && X2.attributes.add(O.INSTANCECOLOR, "vec4"), ee.add("localvpos", "vec3"), X2.include(o4, Q2), X2.include(d3, Q2), X2.include(i2, Q2), X2.include(e8, Q2), Y.uniforms.add(new e2("externalColor", (e10) => e10.externalColor)), ee.add("vcolorExt", "vec4"), Q2.hasMultipassTerrain && ee.add("depth", "float"), Q2.hasModelTransformation && Y.uniforms.add(new e6("model", (o8) => r(o8.modelTransformation) ? o8.modelTransformation : o)), Y.code.add(n2`
  172. void main(void) {
  173. forwardNormalizedVertexColor();
  174. vcolorExt = externalColor;
  175. ${Q2.instancedColor ? "vcolorExt *= instanceColor;" : ""}
  176. vcolorExt *= vvColor();
  177. vcolorExt *= getSymbolColor();
  178. forwardColorMixMode();
  179. if (vcolorExt.a < ${n2.float(t)}) {
  180. gl_Position = vec4(1e38, 1e38, 1e38, 1.0);
  181. } else {
  182. vpos = calculateVPos();
  183. localvpos = vpos - view[3].xyz;
  184. vpos = subtractOrigin(vpos);
  185. ${Q2.normalType === i.Attribute ? n2`vNormalWorld = dpNormal(vvLocalNormal(normalModel()));` : ""}
  186. vpos = addVerticalOffset(vpos, localOrigin);
  187. ${Q2.hasVertexTangents ? "vTangent = dpTransformVertexTangent(tangent);" : ""}
  188. gl_Position = transformPosition(proj, view, ${Q2.hasModelTransformation ? "model," : ""} vpos);
  189. ${Q2.normalType === i.Attribute && Q2.offsetBackfaces ? "gl_Position = offsetBackfacingClipPosition(gl_Position, vpos, vNormalWorld, cameraPosition);" : ""}
  190. }
  191. ${Q2.hasMultipassTerrain ? "depth = (view * vec4(vpos, 1.0)).z;" : ""}
  192. forwardLinearDepth();
  193. forwardTextureCoordinates();
  194. ${Q2.hasColorTextureTransform ? n2`forwardColorUV();` : ""}
  195. ${Q2.hasNormalTextureTransform ? n2`forwardNormalUV();` : ""}
  196. ${Q2.hasEmissionTextureTransform ? n2`forwardEmissiveUV();` : ""}
  197. ${Q2.hasOcclusionTextureTransform ? n2`forwardOcclusionUV();` : ""}
  198. ${Q2.hasMetallicRoughnessTextureTransform ? n2`forwardMetallicRoughnessUV();` : ""}
  199. }
  200. `)), Q2.output === h.Alpha && (X2.include(u3, Q2), X2.include(s2, Q2), X2.include(n6, Q2), Z.uniforms.add([new o7("opacity", (e10) => e10.opacity), new o7("layerOpacity", (e10) => e10.layerOpacity)]), Q2.hasColorTexture && Z.uniforms.add(new f("tex", (e10) => e10.texture)), Z.include(i3), Z.code.add(n2`
  201. void main() {
  202. discardBySlice(vpos);
  203. ${Q2.hasMultipassTerrain ? "terrainDepthTest(gl_FragCoord, depth);" : ""}
  204. ${Q2.hasColorTexture ? n2`
  205. vec4 texColor = texture2D(tex, ${Q2.hasColorTextureTransform ? n2`colorUV` : n2`vuv0`});
  206. ${Q2.textureAlphaPremultiplied ? "texColor.rgb /= texColor.a;" : ""}
  207. discardOrAdjustAlpha(texColor);` : n2`vec4 texColor = vec4(1.0);`}
  208. ${Q2.hasVertexColors ? n2`float opacity_ = layerOpacity * mixExternalOpacity(vColor.a * opacity, texColor.a, vcolorExt.a, int(colorMixMode));` : n2`float opacity_ = layerOpacity * mixExternalOpacity(opacity, texColor.a, vcolorExt.a, int(colorMixMode));`}
  209. gl_FragColor = vec4(opacity_);
  210. }
  211. `)), Q2.output === h.Color && (X2.include(u3, Q2), X2.include(p2, Q2), X2.include(n4, Q2), X2.include(s2, Q2), X2.include(Q2.instancedDoublePrecision ? h3 : v2, Q2), X2.include(n6, Q2), c(Z, Q2), Z.uniforms.add([Y.uniforms.get("localOrigin"), new e4("ambient", (e10) => e10.ambient), new e4("diffuse", (e10) => e10.diffuse), new o7("opacity", (e10) => e10.opacity), new o7("layerOpacity", (e10) => e10.layerOpacity)]), Q2.hasColorTexture && Z.uniforms.add(new f("tex", (e10) => e10.texture)), X2.include(x, Q2), X2.include(n5, Q2), Z.include(i3), X2.include(e9, Q2), h2(Z), u4(Z), a4(Z), Z.code.add(n2`
  212. void main() {
  213. discardBySlice(vpos);
  214. ${Q2.hasMultipassTerrain ? "terrainDepthTest(gl_FragCoord, depth);" : ""}
  215. ${Q2.hasColorTexture ? n2`
  216. vec4 texColor = texture2D(tex, ${Q2.hasColorTextureTransform ? n2`colorUV` : n2`vuv0`});
  217. ${Q2.textureAlphaPremultiplied ? "texColor.rgb /= texColor.a;" : ""}
  218. discardOrAdjustAlpha(texColor);` : n2`vec4 texColor = vec4(1.0);`}
  219. shadingParams.viewDirection = normalize(vpos - cameraPosition);
  220. ${Q2.normalType === i.ScreenDerivative ? n2`
  221. vec3 normal = screenDerivativeNormal(localvpos);` : n2`
  222. shadingParams.normalView = vNormalWorld;
  223. vec3 normal = shadingNormal(shadingParams);`}
  224. ${Q2.pbrMode === d2.Normal ? "applyPBRFactors();" : ""}
  225. float ssao = evaluateAmbientOcclusionInverse();
  226. ssao *= getBakedOcclusion();
  227. vec3 posWorld = vpos + localOrigin;
  228. float additionalAmbientScale = additionalDirectedAmbientLight(posWorld);
  229. float shadow = ${Q2.receiveShadows ? "readShadowMap(vpos, linearDepth)" : Q2.spherical ? "lightingGlobalFactor * (1.0 - additionalAmbientScale)" : "0.0"};
  230. vec3 matColor = max(ambient, diffuse);
  231. ${Q2.hasVertexColors ? n2`
  232. vec3 albedo = mixExternalColor(vColor.rgb * matColor, texColor.rgb, vcolorExt.rgb, int(colorMixMode));
  233. float opacity_ = layerOpacity * mixExternalOpacity(vColor.a * opacity, texColor.a, vcolorExt.a, int(colorMixMode));` : n2`
  234. vec3 albedo = mixExternalColor(matColor, texColor.rgb, vcolorExt.rgb, int(colorMixMode));
  235. float opacity_ = layerOpacity * mixExternalOpacity(opacity, texColor.a, vcolorExt.a, int(colorMixMode));`}
  236. ${Q2.hasNormalTexture ? n2`
  237. mat3 tangentSpace = ${Q2.hasVertexTangents ? "computeTangentSpace(normal);" : "computeTangentSpace(normal, vpos, vuv0);"}
  238. vec3 shadingNormal = computeTextureNormal(tangentSpace, vuv0);` : n2`vec3 shadingNormal = normal;`}
  239. vec3 normalGround = ${Q2.spherical ? n2`normalize(posWorld);` : n2`vec3(0.0, 0.0, 1.0);`}
  240. ${Q2.snowCover ? n2`
  241. float snow = smoothstep(0.5, 0.55, dot(normal, normalGround));
  242. albedo = mix(albedo, vec3(1), snow);
  243. shadingNormal = mix(shadingNormal, normal, snow);
  244. ssao = mix(ssao, 1.0, snow);` : ""}
  245. vec3 additionalLight = ssao * mainLightIntensity * additionalAmbientScale * ambientBoostFactor * lightingGlobalFactor;
  246. ${Q2.pbrMode === d2.Normal || Q2.pbrMode === d2.Schematic ? n2`
  247. float additionalAmbientIrradiance = additionalAmbientIrradianceFactor * mainLightIntensity[2];
  248. ${Q2.snowCover ? n2`
  249. mrr = mix(mrr, vec3(0.0, 1.0, 0.04), snow);
  250. emission = mix(emission, vec3(0.0), snow);` : ""}
  251. vec3 shadedColor = evaluateSceneLightingPBR(shadingNormal, albedo, shadow, 1.0 - ssao, additionalLight, shadingParams.viewDirection, normalGround, mrr, emission, additionalAmbientIrradiance);` : n2`vec3 shadedColor = evaluateSceneLighting(shadingNormal, albedo, shadow, 1.0 - ssao, additionalLight);`}
  252. gl_FragColor = highlightSlice(vec4(shadedColor, opacity_), vpos);
  253. ${Q2.transparencyPassType === o5.Color ? n2`gl_FragColor = premultiplyAlpha(gl_FragColor);` : ""}
  254. }
  255. `)), X2.include(b, Q2), X2;
  256. }
  257. var X = Object.freeze(Object.defineProperty({ __proto__: null, build: Q }, Symbol.toStringTag, { value: "Module" }));
  258. export {
  259. i4 as i,
  260. Q,
  261. X
  262. };
  263. //# sourceMappingURL=chunk-WDB6D6R7.js.map