@arcgis/core 5.1.0-next.72 → 5.1.0-next.73

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (104) hide show
  1. package/assets/esri/core/workers/RemoteClient.js +1 -1
  2. package/assets/esri/core/workers/chunks/{b801631b58e6fc6cec8a.js → 0ae360bf253adee46737.js} +1 -1
  3. package/assets/esri/core/workers/chunks/{b495f14d90abe8d1a558.js → 12e575a6d2b008b8fc2b.js} +1 -1
  4. package/assets/esri/core/workers/chunks/{61ef14e42bc09b787d89.js → 13e60f19f436b8d683ae.js} +1 -1
  5. package/assets/esri/core/workers/chunks/{7e6ccf9f3e756186e93e.js → 29e76256e3e867e80520.js} +1 -1
  6. package/assets/esri/core/workers/chunks/{bea70be8e38b8c83ccd2.js → 30f04dc001eaf838d64c.js} +1 -1
  7. package/assets/esri/core/workers/chunks/{628f56c09838eb9c573b.js → 422824e407b550170c8c.js} +1 -1
  8. package/assets/esri/core/workers/chunks/{68b47a5a50e0b5fffca2.js → 5c663d5f98bdfa29151b.js} +1 -1
  9. package/assets/esri/core/workers/chunks/{ae0a572cbbdd9815ee2e.js → 62b3e933f548ce354b99.js} +1 -1
  10. package/assets/esri/core/workers/chunks/{6f9ea461c268c421f9c9.js → 7951d93f5f15aa76f49c.js} +1 -1
  11. package/assets/esri/core/workers/chunks/{b79058f5bda6fcac22f8.js → 80ace1c7203c5059525d.js} +1 -1
  12. package/assets/esri/core/workers/chunks/{b92794def31592a6a25f.js → 8d75f6f27c1c17c33992.js} +1 -1
  13. package/assets/esri/core/workers/chunks/95d82c619dcbec2e1050.js +1 -0
  14. package/assets/esri/core/workers/chunks/9eb4ae556950e1d0124d.js +2 -0
  15. package/assets/esri/core/workers/chunks/{02876e434dc91c42b2f4.js → a78bc340a794fd332667.js} +1 -1
  16. package/assets/esri/core/workers/chunks/{1edd39c7c4acdc591d10.js → a809b811121099a87a98.js} +1 -1
  17. package/assets/esri/core/workers/chunks/abdf146b35e179b5b245.js +1 -0
  18. package/assets/esri/core/workers/chunks/{d2aa75816e84b1e7fd25.js → afc0baf86ece710ef867.js} +1 -1
  19. package/assets/esri/core/workers/chunks/b6cadb8a579241adcb86.js +1 -0
  20. package/assets/esri/core/workers/chunks/{3cd9bd20e75ba4d5b294.js → b9848bdbaf3d9ac93d54.js} +1 -1
  21. package/assets/esri/core/workers/chunks/{b475f5492c6e3fd4cca8.js → bef27a25fbc4a6e19ec0.js} +1 -1
  22. package/assets/esri/core/workers/chunks/{a65d576e90179a2b5400.js → c5507480344176fad241.js} +1 -1
  23. package/assets/esri/core/workers/chunks/c70df6ed190f9ebcf6aa.js +1 -0
  24. package/assets/esri/core/workers/chunks/cd7159600ce132e32d04.js +1 -0
  25. package/assets/esri/core/workers/chunks/{dec6d41d614105e6fd93.js → cfe246adb5e6cb6f0cfc.js} +1 -1
  26. package/assets/esri/core/workers/chunks/{91a0227a64a944af3286.js → d17fcfc502f0e0fa6523.js} +2 -2
  27. package/assets/esri/core/workers/chunks/d65b1234867f7d773d50.js +2 -0
  28. package/assets/esri/core/workers/chunks/{aa1a3a849aba84cf585b.js → e1bc9ad767e08dc18bbc.js} +1 -1
  29. package/assets/esri/core/workers/chunks/e25a684eb9f025bdcc01.js +1 -0
  30. package/assets/esri/core/workers/chunks/e272411e2c9378aa8496.js +1312 -0
  31. package/assets/esri/core/workers/chunks/{0d96e39380fd84cea9ba.js → f207b3be0714cc50030a.js} +1 -1
  32. package/assets/esri/core/workers/chunks/f53805c7a84203305b2c.js +1 -0
  33. package/assets/esri/core/workers/chunks/{c1838822b096d5f36a8b.js → f5c57ff48ca505ed701d.js} +1 -1
  34. package/chunks/GlobalIllumination.glsl.js +186 -116
  35. package/chunks/GlobalIlluminationBlur.glsl.js +81 -61
  36. package/chunks/GlobalIlluminationUpscale.glsl.js +66 -0
  37. package/config.js +1 -1
  38. package/form/elements/FieldElement.d.ts +3 -2
  39. package/form/elements/inputs/Input.d.ts +1 -1
  40. package/form/elements/inputs/MultipleChoiceInput.d.ts +65 -0
  41. package/form/elements/inputs/MultipleChoiceInput.js +2 -0
  42. package/form/elements/inputs/inputUtils.js +1 -1
  43. package/form/elements/inputs/multipleChoice/Choice.d.ts +30 -0
  44. package/form/elements/inputs/multipleChoice/Choice.js +2 -0
  45. package/form/elements/inputs/multipleChoice/OtherChoice.d.ts +28 -0
  46. package/form/elements/inputs/multipleChoice/OtherChoice.js +2 -0
  47. package/form/elements/inputs.d.ts +11 -2
  48. package/form/elements/inputs.js +1 -1
  49. package/form/support/formUtils.js +1 -1
  50. package/interfaces.d.ts +28 -0
  51. package/kernel.js +1 -1
  52. package/layers/Lyr3DWasmPerSceneView.js +1 -1
  53. package/package.json +2 -2
  54. package/support/revision.js +1 -1
  55. package/third-party-notices.txt +7 -29
  56. package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
  57. package/views/3d/environment/EnvironmentManager.js +1 -1
  58. package/views/3d/layers/I3SMeshView3D.js +1 -1
  59. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  60. package/views/3d/support/orientedBoundingBox.js +1 -1
  61. package/views/3d/terrain/TerrainRenderer.js +1 -1
  62. package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
  63. package/views/3d/webgl-engine/core/shaderLibrary/shading/GlobalIlluminationWeights.glsl.js +21 -0
  64. package/views/3d/webgl-engine/core/shaderLibrary/shading/ReadGlobalIllumination.glsl.js +11 -7
  65. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIllumination.glsl.js +2 -0
  66. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIllumination.js +1 -1
  67. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIlluminationBlur.glsl.js +2 -0
  68. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIlluminationBlurTechnique.js +1 -1
  69. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIlluminationTechnique.js +1 -1
  70. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIlluminationUpscale.glsl.js +2 -0
  71. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIlluminationUpscaleTechnique.js +2 -0
  72. package/views/3d/webgl-engine/effects/glow/GlowRenderNode.js +1 -1
  73. package/views/3d/webgl-engine/lib/BindParameters.js +1 -1
  74. package/views/3d/webgl-engine/lib/RenderFeature.js +1 -1
  75. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  76. package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
  77. package/views/interactive/sketch/SketchOptions.d.ts +3 -1
  78. package/views/interactive/sketch/SketchTooltipOptions.d.ts +6 -0
  79. package/views/support/Scheduler.js +1 -1
  80. package/widgets/BatchAttributeForm/BatchAttributeFormViewModel.js +1 -1
  81. package/widgets/BatchAttributeForm/batchAttributeFormUtils.js +1 -1
  82. package/widgets/BatchAttributeForm/inputs/SingleFeatureInputAdapter.js +2 -0
  83. package/widgets/BatchAttributeForm/inputs/TextElementInput.d.ts +28 -4
  84. package/widgets/BatchAttributeForm/inputs/TextElementInput.js +1 -1
  85. package/widgets/BatchAttributeForm/templates/AttachmentElementTemplate.js +2 -0
  86. package/widgets/BatchAttributeForm/templates/support/createBatchFormTemplate.js +1 -1
  87. package/widgets/BatchAttributeForm/templates/support/hashElementTemplate.js +1 -1
  88. package/widgets/BatchAttributeForm/templates/support/templateUtils.js +1 -1
  89. package/widgets/Search/support/layerSearchUtils.js +1 -1
  90. package/widgets/support/widgetUtils.js +1 -1
  91. package/assets/esri/core/workers/chunks/85edbb072a2ce6c1bb30.js +0 -2
  92. package/assets/esri/core/workers/chunks/943cf0653a2b7de16a4f.js +0 -1
  93. package/assets/esri/core/workers/chunks/a37fc886227365f7ecd5.js +0 -1
  94. package/assets/esri/core/workers/chunks/d0c3ab70f390cd579fed.js +0 -1
  95. package/assets/esri/core/workers/chunks/d4a9eb4470cc6a1f67fc.js +0 -2
  96. package/assets/esri/core/workers/chunks/dca595fdd5e1a571e441.js +0 -1
  97. package/assets/esri/core/workers/chunks/de583214195eff13cb00.js +0 -1140
  98. package/assets/esri/core/workers/chunks/df8143b72ef94806c992.js +0 -1
  99. package/assets/esri/core/workers/chunks/ef013a77950c1902de11.js +0 -1
  100. package/views/3d/webgl-engine/core/shaderLibrary/shading/EncodingColor.glsl.js +0 -7
  101. package/views/3d/webgl-engine/shaders/GlobalIllumination.glsl.js +0 -2
  102. package/views/3d/webgl-engine/shaders/GlobalIlluminationBlur.glsl.js +0 -2
  103. /package/assets/esri/core/workers/chunks/{85edbb072a2ce6c1bb30.js.LICENSE.txt → 9eb4ae556950e1d0124d.js.LICENSE.txt} +0 -0
  104. /package/assets/esri/core/workers/chunks/{d4a9eb4470cc6a1f67fc.js.LICENSE.txt → d65b1234867f7d773d50.js.LICENSE.txt} +0 -0
@@ -0,0 +1,1312 @@
1
+ "use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[1951,5647],{28491(e,t,o){o.d(t,{D:()=>W,b:()=>A});var r=o(32680),a=o(49255),n=o(68317),i=o(76597),s=o(24321),l=o(2585),c=o(43519),u=o(96336),d=o(39014),m=o(53466),h=o(92700),f=o(72824),p=o(35640),v=o(40261),g=o(77695),x=o(71651),b=o(32971),w=o(98619),y=o(62602),M=o(22393),S=o(59469),T=o(32482),C=o(51406),I=o(43259),_=o(58614),z=o(27950),P=o(77949),F=o(33079),O=o(71988),D=o(20304),H=o(31821),j=o(63761),B=o(27832),N=o(43616),R=o(73541),E=o(14113),G=o(49788);function A(e){const t=new E.N5,{attributes:o,vertex:A,fragment:W,varyings:L}=t,{output:V,normalType:U,offsetBackfaces:k,spherical:q,snowCover:$,pbrMode:Z,textureAlphaPremultiplied:Y,instancedDoublePrecision:J,hasVertexColors:K,hasVertexTangents:X,hasColorTexture:Q,hasNormalTexture:ee,hasNormalTextureTransform:te,hasColorTextureTransform:oe}=e;if((0,P.NB)(A,e),o.add("position","vec3"),A.inputs.add("position",()=>"position"),L.add("vpos","vec3",{invariant:!0}),t.include(I.A,e),t.include(l.B,e),t.include(p.Ge,e),t.include(C.q2,e),!(0,a._o)(V))return t.include(v.E,e),t;t.include(C.Sx,e),t.include(C.MU,e),t.include(C.O1,e),t.include(C.QM,e),(0,P.yu)(A,e),t.include(u.Y,e),t.include(i.d);const re=0===U||1===U;return re&&k&&t.include(r.M),t.include(g.J,e),t.include(f.Mh,e),t.include(s.v,e),L.add("vPositionLocal","vec3"),t.include(m.U,e),t.include(d.K,e),t.include(h.c,e),A.uniforms.add(new O.E("externalColor",e=>e.externalColor,{supportsNaN:!0})),L.add("vcolorExt","vec4"),A.include(c.WD),A.include(c.oF),t.include(J?T.QH:T.LA,e),A.main.add(H.H`
2
+ forwardVertexColor();
3
+
4
+ MaskedColor maskedColor =
5
+ applySymbolColor(applyVVColor(applyInstanceColor(createMaskedFromNaNColor(externalColor))));
6
+
7
+ vcolorExt = maskedColor.color;
8
+ forwardColorMixMode(maskedColor.mask);
9
+
10
+ vpos = getVertexInLocalOriginSpace();
11
+ vPositionLocal = vpos - view[3].xyz;
12
+ vpos = subtractOrigin(vpos);
13
+ ${(0,H.If)(re,"vNormalWorld = dpNormal(vvLocalNormal(normalModel()));")}
14
+ vpos = addVerticalOffset(vpos, localOrigin);
15
+ ${(0,H.If)(X,"vTangent = dpTransformVertexTangent(tangent);")}
16
+ gl_Position = transformPosition(proj, view, vpos);
17
+ ${(0,H.If)(re&&k,"gl_Position = offsetBackfacingClipPosition(gl_Position, vpos, vNormalWorld, cameraPosition);")}
18
+
19
+ forwardTextureCoordinates();
20
+ forwardColorUV();
21
+ forwardNormalUV();
22
+ forwardEmissiveUV();
23
+ forwardOcclusionUV();
24
+ forwardMetallicRoughnessUV();
25
+
26
+ if (opacityMixMode != ${H.H.int(N.Um.ignore)} && vcolorExt.a < ${H.H.float(G.Q)}) {
27
+ gl_Position = vec4(1e38, 1e38, 1e38, 1.0);
28
+ }
29
+ forwardLinearDepthToReadShadowMap();
30
+ `),W.include(b.kA,e),W.include(x.n,e),t.include(_.S,e),W.include(n.HQ,e),t.include(R.D,e),(0,P.yu)(W,e),W.uniforms.add(A.uniforms.get("localOrigin"),new F.t("ambient",e=>e.ambient),new F.t("diffuse",e=>e.diffuse),new D.m("opacity",e=>e.opacity),new D.m("layerOpacity",e=>e.layerOpacity)),Q&&W.uniforms.add(new j.N("tex",e=>e.texture)),t.include(S._,e),W.include(M.c,e),W.include(z.N),t.include(y.r,e),W.include(B.b,e),(0,b.a8)(W),(0,b.eU)(W),(0,w.O4)(W),W.main.add(H.H`
31
+ discardBySlice(vpos);
32
+ ${Q?H.H`
33
+ vec4 texColor = texture(tex, ${oe?"colorUV":"vuv0"});
34
+ ${(0,H.If)(Y,"texColor.rgb /= texColor.a;")}
35
+ discardOrAdjustAlpha(texColor);`:H.H`vec4 texColor = vec4(1.0);`}
36
+ shadingParams.viewDirection = normalize(vpos - cameraPosition);
37
+ ${2===U?H.H`vec3 normal = screenDerivativeNormal(vPositionLocal);`:H.H`shadingParams.normalView = vNormalWorld;
38
+ vec3 normal = shadingNormal(shadingParams);`}
39
+ applyPBRFactors();
40
+ float ssao = evaluateAmbientOcclusionInverse() * getBakedOcclusion();
41
+
42
+ vec3 posWorld = vpos + localOrigin;
43
+
44
+ float additionalAmbientScale = additionalDirectedAmbientLight(posWorld);
45
+ float shadow = readShadow(additionalAmbientScale, vpos);
46
+
47
+ vec3 matColor = max(ambient, diffuse);
48
+ vec3 albedo = mixExternalColor(${(0,H.If)(K,"vColor.rgb *")} matColor, texColor.rgb, vcolorExt.rgb, colorMixMode);
49
+ float opacity_ = layerOpacity * mixExternalOpacity(${(0,H.If)(K,"vColor.a * ")} opacity, texColor.a, vcolorExt.a, opacityMixMode);
50
+
51
+ ${ee?`mat3 tangentSpace = computeTangentSpace(${X?"normal":"normal, vpos, vuv0"});\n vec3 shadingNormal = computeTextureNormal(tangentSpace, ${te?"normalUV":"vuv0"});`:"vec3 shadingNormal = normal;"}
52
+ vec3 normalGround = ${q?"normalize(posWorld);":"vec3(0.0, 0.0, 1.0);"}
53
+
54
+ ${(0,H.If)($,H.H`
55
+ float snow = getSnow(normal, normalGround);
56
+ albedo = mix(albedo, vec3(1), snow);
57
+ shadingNormal = mix(shadingNormal, normal, snow);
58
+ ssao = mix(ssao, 1.0, snow);`)}
59
+
60
+ vec3 additionalLight = ssao * mainLightIntensity * additionalAmbientScale * ambientBoostFactor * lightingGlobalFactor;
61
+
62
+ ${1===Z||2===Z?H.H`
63
+ float additionalAmbientIrradiance = additionalAmbientIrradianceFactor * mainLightIntensity[2];
64
+ ${(0,H.If)($,"mrr = applySnowToMRR(mrr, snow);")}
65
+ vec3 shadedColor = evaluateSceneLightingPBR(shadingNormal, albedo, shadow, 1.0 - ssao, additionalLight, shadingParams.viewDirection, normalGround, mrr, additionalAmbientIrradiance);`:H.H`vec3 shadedColor = evaluateSceneLighting(shadingNormal, albedo, shadow, 1.0 - ssao, additionalLight);`}
66
+ vec4 finalColor = vec4(shadedColor, opacity_);
67
+ outputColorHighlightOLID(applySlice(finalColor, vpos), albedo ${(0,H.If)($,", snow")});
68
+ `),t}const W=Object.freeze(Object.defineProperty({__proto__:null,build:A},Symbol.toStringTag,{value:"Module"}))},587(e,t,o){o.d(t,{G:()=>v,a:()=>x,b:()=>g});var r=o(82048),a=o(92573),n=o(98619),i=o(96608),s=o(34845),l=o(20304),c=o(31821),u=o(58029),d=o(12791),m=o(63761),h=o(63907),f=o(65786),p=o(14113);class v extends f.Y{constructor(){super(...arguments),this.projScale=1,this.scaleGlobalIllumination=1,this.accumulatedFrames=0,this.frameCount=0}}function g(e){const t=new p.N5,o=t.fragment;return t.include(r.c),t.include(s.Ir),(0,n.Gc)(o),o.include(a.V),t.include(i.t,{highStepCount:!1,screenSpaceReflections:!0}),o.uniforms.add(new m.N("normalMap",e=>e.normalTexture),new m.N("depthMap",e=>e.depthTexture),new m.N("lastFrameDepthTexture",(e,t)=>t.reprojection.lastFrameDepth?.attachment),new d.x("lastFrameGlobalIlluminationTexture",e=>e.globalIllumination?.getTexture()),new d.x("lastFrameGlobalIlluminationWeightTexture",e=>e.globalIllumination?.getTexture(h.yI)),new u.F("reprojectionViewMatrix",e=>e.reprojection.viewMatrix),new u.F("view",e=>e.camera.viewMatrix),new l.m("accumulatedFramesGI",e=>e.accumulatedFrames),new l.m("frameCount",e=>e.frameCount),new l.m("scaleGlobalIllumination",e=>e.scaleGlobalIllumination),new m.N("blueNoiseTex",e=>e.noiseTexture)),e.hasEmission&&o.uniforms.add(new m.N("lastFrameEmissionTexture",(e,t)=>t.reprojection.lastFrameEmission?.attachment)),o.constants.add("timeSamplesSize","float",64),o.constants.add("blueNoiseGridSize","float",8),o.code.add(c.H`
69
+ float computeIdleEmissionBlendWeight(float accumulatedFrames) {
70
+ float idleEmissionBlendProgress = clamp(
71
+ accumulatedFrames / ${c.H.float(40)},
72
+ 0.0,
73
+ 1.0
74
+ );
75
+ return mix(
76
+ ${c.H.float(.012)},
77
+ ${c.H.float(.008)},
78
+ idleEmissionBlendProgress
79
+ );
80
+ }
81
+
82
+ float computeIdleOcclusionBlendWeight(float accumulatedFrames) {
83
+ float idleOcclusionBlendProgress = clamp(
84
+ accumulatedFrames / ${c.H.float(60)},
85
+ 0.0,
86
+ 1.0
87
+ );
88
+ return mix(
89
+ ${c.H.float(.095)},
90
+ ${c.H.float(.008)},
91
+ pow(idleOcclusionBlendProgress, ${c.H.float(2)})
92
+ );
93
+ }
94
+
95
+ // Blue noise value based on a texture lookup
96
+ vec4 randomDirection(float index) {
97
+ vec2 textureOffset = vec2(mod(index, blueNoiseGridSize), floor(index / blueNoiseGridSize)) * timeSamplesSize;
98
+ vec2 noiseCoord = textureOffset + mod(
99
+ floor(uv * vec2(textureSize(normalMap, 0)) * scaleGlobalIllumination),
100
+ vec2(timeSamplesSize)
101
+ );
102
+ vec4 blueNoiseValue = texelFetch(blueNoiseTex, ivec2(noiseCoord), 0);
103
+
104
+ return 2.0 * blueNoiseValue - 1.0;
105
+ }
106
+
107
+ bool isEdgeDepth(float centerDepth, vec2 sampleUv) {
108
+ vec2 texelSize = 1.0 / vec2(textureSize(depthMap, 0));
109
+ float depthLeft = linearizeDepth(depthFromTexture(depthMap, sampleUv + vec2(-texelSize.x, 0.0)));
110
+ float depthRight = linearizeDepth(depthFromTexture(depthMap, sampleUv + vec2(texelSize.x, 0.0)));
111
+ float depthUp = linearizeDepth(depthFromTexture(depthMap, sampleUv + vec2(0.0, texelSize.y)));
112
+ float depthDown = linearizeDepth(depthFromTexture(depthMap, sampleUv + vec2(0.0, -texelSize.y)));
113
+
114
+ float maxDifference = max(max(abs(centerDepth - depthLeft), abs(centerDepth - depthRight)), max(abs(centerDepth - depthUp), abs(centerDepth - depthDown)));
115
+
116
+ return abs(maxDifference / centerDepth) > 0.01;
117
+ }
118
+
119
+ vec3 sampleCosineHemisphere(vec2 u) {
120
+ float phi = 6.28318530718 * u.x;
121
+ float radius = sqrt(u.y);
122
+ float x = radius * cos(phi);
123
+ float y = radius * sin(phi);
124
+ float z = sqrt(max(0.0, 1.0 - u.y));
125
+
126
+ return vec3(x, y, z);
127
+ }
128
+
129
+ mat3 basisFromNormal(vec3 n) {
130
+ vec3 up = abs(n.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0);
131
+ vec3 tangent = normalize(cross(up, n));
132
+ vec3 bitangent = cross(n, tangent);
133
+
134
+ return mat3(tangent, bitangent, n);
135
+ }
136
+ `),t.outputs.add("fragGlobalIllumination","vec4",0),t.outputs.add("fragWeight","float",1),o.main.add(c.H`
137
+ float depth = depthFromTexture(depthMap, uv);
138
+
139
+ // Early out if depth is out of range, such as in the sky
140
+ if (depth >= 1.0 || depth <= 0.0) {
141
+ fragGlobalIllumination = vec4(0.0, 0.0, 0.0, 1.0);
142
+ fragWeight = 0.0;
143
+ return;
144
+ }
145
+
146
+ // Get the normal of current fragment
147
+ ivec2 iuv = ivec2(uv * vec2(textureSize(normalMap, 0)));
148
+ vec4 normal4 = texelFetch(normalMap, iuv, 0);
149
+ if (normal4.a != 1.0) {
150
+ fragGlobalIllumination = vec4(0.0, 0.0, 0.0, 1.0);
151
+ fragWeight = 0.0;
152
+ return;
153
+ }
154
+ vec3 normal = normalize(normal4.xyz * 2.0 - 1.0);
155
+
156
+ // Reconstruct view space position of current fragment
157
+ float currentPixelDepth = linearizeDepth(depth);
158
+ vec3 currentPixelPos = reconstructPosition(uv * vec2(textureSize(normalMap, 0)), currentPixelDepth);
159
+ vec4 viewPos = vec4(currentPixelPos, 1.0);
160
+
161
+ // Reproject current view position to last frame
162
+ vec4 reprojectedViewPos = reprojectionViewMatrix * viewPos;
163
+ vec4 reprojectedCoordinate = applyProjectionMat(proj, reprojectedViewPos.xyz);
164
+
165
+ // Read last frame reprojected depth and GI value.
166
+ float lastFrameDepthViewPos = -linearDepthFromTextureLastFrame(lastFrameDepthTexture, reprojectedCoordinate.xy);
167
+ vec4 lastFrameGlobalIllumination = texture(lastFrameGlobalIlluminationTexture, reprojectedCoordinate.xy);
168
+ float historyOcclusionBlendWeight = texture(lastFrameGlobalIlluminationWeightTexture, reprojectedCoordinate.xy).r;
169
+
170
+ int steps;
171
+ float occlusionBlendWeight = 1.0;
172
+ float emissionBlendWeight = 1.0;
173
+ float idleEmissionBlendWeight = computeIdleEmissionBlendWeight(accumulatedFramesGI);
174
+ float idleOcclusionBlendWeight = computeIdleOcclusionBlendWeight(accumulatedFramesGI);
175
+ float reprojectionDepthMismatch = abs((lastFrameDepthViewPos + reprojectedViewPos.z) / max(lastFrameDepthViewPos, reprojectedViewPos.z));
176
+ bool hasReprojectionMismatch = reprojectionDepthMismatch > ${c.H.float(.01)};
177
+ bool isScaledGlobalIllumination = scaleGlobalIllumination < 1.0;
178
+ bool isLowQualityEdgePixel = isScaledGlobalIllumination && isEdgeDepth(currentPixelDepth, uv);
179
+ bool resetEmissionHistory = false;
180
+
181
+ // Heuristic to determine blending weights and number of steps for occlusion and emission
182
+ if (hasReprojectionMismatch) {
183
+ if (isLowQualityEdgePixel) {
184
+ steps = 1;
185
+ occlusionBlendWeight = ${c.H.float(.008)};
186
+ resetEmissionHistory = true;
187
+ } else {
188
+ steps = 6;
189
+ occlusionBlendWeight = 1.0;
190
+ resetEmissionHistory = true;
191
+ }
192
+ } else {
193
+ steps = 1;
194
+ if (historyOcclusionBlendWeight > ${c.H.float(.5)}) {
195
+ occlusionBlendWeight = ${c.H.float(.1)};
196
+ emissionBlendWeight = ${c.H.float(.008)};
197
+ } else if (historyOcclusionBlendWeight > ${c.H.float(.02)}) {
198
+ occlusionBlendWeight = historyOcclusionBlendWeight - 0.05;
199
+ emissionBlendWeight = ${c.H.float(.008)};
200
+ } else {
201
+ occlusionBlendWeight = isScaledGlobalIllumination ? ${c.H.float(.008)} : idleOcclusionBlendWeight;
202
+ emissionBlendWeight = isScaledGlobalIllumination ? ${c.H.float(.002)} : idleEmissionBlendWeight;
203
+ }
204
+ }
205
+
206
+ vec4 randomDirectionSample;
207
+ mat3 normalBasis = basisFromNormal(normal);
208
+ int temporalSampleStride = min(64 / steps, 6);
209
+ float temporalFrameOffset = mod(frameCount, float(64 / steps));
210
+
211
+ // For each ray determine if it hits geometry and calculate occlusion and emission values
212
+ float stepSize = 1.0 / float(steps);
213
+ for (int i = 0; i < steps; ++i) {
214
+ float sampleIndex = float(i * temporalSampleStride + int(temporalFrameOffset));
215
+ randomDirectionSample = randomDirection(sampleIndex);
216
+ vec2 hemisphereSample = randomDirectionSample.rg * 0.5 + 0.5;
217
+ vec3 rayDirection = normalBasis * sampleCosineHemisphere(hemisphereSample);
218
+ vec3 hit = screenSpaceIntersection(rayDirection, viewPos.xyz, normalize(viewPos.xyz), normal, randomDirectionSample.a * 0.5 + 0.5, true);
219
+
220
+ if (hit.z > 0.0) {
221
+ // Emission - reproject to get and accumulate emission from last frame
222
+ vec2 hitReprojectedCoordinate = reprojectionCoordinate(hit);
223
+ vec3 emissionColor = ${(0,c.If)(e.hasEmission,"texture(lastFrameEmissionTexture, hitReprojectedCoordinate).xyz","vec3(0.0)")};
224
+
225
+ fragGlobalIllumination.rgb += emissionColor * stepSize;
226
+ } else {
227
+ // Occlusion - heuristic modulating sky intensity based on angle to main light
228
+ vec4 viewMainLightDirection = view * vec4(mainLightDirection, 0.0);
229
+ float skyModulation = pow(max(dot(rayDirection, viewMainLightDirection.xyz), 0.0), 3.0) * 5.5;
230
+ float skyFacingWeight = clamp(3.5 * dot(viewMainLightDirection.xyz, normal), 0.0, 1.0);
231
+ skyModulation = mix(1.0, skyModulation * 0.2 + 0.8, skyFacingWeight);
232
+ fragGlobalIllumination.a += skyModulation * stepSize;
233
+ }
234
+ }
235
+
236
+ // Rendering trick add noise to reduce accumulation artifacts
237
+ float accumulationDither = occlusionBlendWeight < 1.0
238
+ ? randomDirectionSample.b * ${c.H.float(.0039)}
239
+ : 0.0;
240
+
241
+ // Accumulate occlusion
242
+ // Accumulate emission
243
+ vec3 lastFrameEmission = lastFrameGlobalIllumination.rgb;
244
+ float emissionDitherScale = isScaledGlobalIllumination ? ${c.H.float(.25)} : 1.0;
245
+ fragGlobalIllumination.rgb = resetEmissionHistory
246
+ ? vec3(0.0)
247
+ : mix(lastFrameEmission + accumulationDither * emissionDitherScale, fragGlobalIllumination.rgb, emissionBlendWeight);
248
+
249
+ // Accumulate occlusion
250
+ fragGlobalIllumination.a = mix(lastFrameGlobalIllumination.a + accumulationDither, fragGlobalIllumination.a, occlusionBlendWeight);
251
+
252
+ fragWeight = occlusionBlendWeight;
253
+ `),t}const x=Object.freeze(Object.defineProperty({__proto__:null,GlobalIlluminationPassParameters:v,build:g},Symbol.toStringTag,{value:"Module"}))},52516(e,t,o){o.d(t,{G:()=>v,a:()=>x,b:()=>g});var r=o(48163),a=o(82048),n=o(52540),i=o(72885),s=o(34845),l=o(32976),c=o(68259),u=o(20304),d=o(31821),m=o(15976),h=o(63761),f=o(65786),p=o(14113);class v extends f.Y{constructor(){super(...arguments),this.blurSize=(0,r.vt)()}}function g(){const e=new p.N5,t=e.fragment;e.include(a.c),e.include(s.Ir),e.include(i.Q);return t.include(n.E),t.uniforms.add(new l.o("hasEmission",e=>e.hasEmission),new h.N("depthMap",e=>e.depthTexture),new h.N("normalMap",e=>e.normalTexture),new m.o("globalIlluminationTexture",e=>e.texture),new m.o("globalIlluminationWeightTexture",e=>e.weightTexture),new c.t("blurSize",e=>e.blurSize),new u.m("scaleGlobalIllumination",e=>e.scaleGlobalIllumination),new u.m("projScale",(e,t)=>{const o=t.camera.distance;return o>5e4?Math.max(0,e.projScale-(o-5e4)):e.projScale})),t.code.add(d.H`
254
+ void accumulateBlurSample(
255
+ vec2 sampleUv,
256
+ float sampleOffset,
257
+ float centerDepth,
258
+ vec3 centerNormal,
259
+ float depthSharpness,
260
+ bool skipOcclusionBlur,
261
+ inout float emissionWeightSum,
262
+ inout vec3 emissionSum,
263
+ inout float occlusionWeightSum,
264
+ inout float occlusionSum,
265
+ float centerOcclusionBlendWeight
266
+ ) {
267
+ vec4 sampleGlobalIllumination = texture(globalIlluminationTexture, sampleUv);
268
+ vec3 sampleNormal = texture(normalMap, sampleUv).rgb;
269
+ float sampleDepth = linearDepthFromTexture(depthMap, sampleUv);
270
+
271
+ float depthDelta = sampleDepth - centerDepth;
272
+ bool isScaledGlobalIllumination = scaleGlobalIllumination < 1.0;
273
+ float normalSimilarityWeight = globalIlluminationNormalSimilarityWeight(sampleNormal, centerNormal);
274
+ float depthNormalCorrection = globalIlluminationDepthNormalCorrection(sampleNormal);
275
+ vec3 emission = sampleGlobalIllumination.rgb;
276
+ float emissionSpatialWeightMultiplier = isScaledGlobalIllumination ? ${d.H.float(400)} : 1.0;
277
+
278
+ float emissionWeight = exp(
279
+ -sampleOffset * sampleOffset * ${d.H.float(1/24.5)} * ${d.H.float(.1)} * emissionSpatialWeightMultiplier
280
+ - depthDelta * depthDelta * depthSharpness * depthNormalCorrection
281
+ );
282
+ emissionWeight *= normalSimilarityWeight;
283
+ emissionWeightSum += emissionWeight;
284
+ emissionSum += emissionWeight * emission;
285
+
286
+ if (skipOcclusionBlur) {
287
+ return;
288
+ }
289
+
290
+ float occlusionSpatialKernelScale = centerOcclusionBlendWeight > ${d.H.float(.03)}
291
+ ? ${d.H.float(.08)}
292
+ : ${d.H.float(1.5)};
293
+ float occlusionWeight = exp(-sampleOffset * sampleOffset * occlusionSpatialKernelScale - depthDelta * depthDelta * depthSharpness);
294
+ occlusionWeight *= normalSimilarityWeight;
295
+ occlusionWeightSum += occlusionWeight;
296
+ occlusionSum += occlusionWeight * sampleGlobalIllumination.a;
297
+ }
298
+ `),t.main.add(d.H`
299
+ vec3 emissionSum = vec3(0.0);
300
+ float emissionWeightSum = 0.0;
301
+
302
+ vec4 centerGlobalIllumination = texture(globalIlluminationTexture, uv);
303
+ float centerOcclusionBlendWeight = texture(globalIlluminationWeightTexture, uv).r;
304
+ bool isScaledGlobalIllumination = scaleGlobalIllumination < 1.0;
305
+ bool shouldReuseCenterOcclusion = isScaledGlobalIllumination && centerOcclusionBlendWeight <= ${d.H.float(.03)};
306
+ bool shouldSkipLowQualityBlur = !hasEmission && shouldReuseCenterOcclusion;
307
+ if (shouldSkipLowQualityBlur) {
308
+ fragColor = centerGlobalIllumination;
309
+ return;
310
+ }
311
+
312
+ float centerDepth = linearDepthFromTexture(depthMap, uv);
313
+ vec3 centerNormal = texture(normalMap, uv).rgb;
314
+ float occlusionSum = 0.0;
315
+ float occlusionWeightSum = 0.0;
316
+
317
+ float depthSharpness = globalIlluminationDepthSharpness(projScale, centerDepth);
318
+ for (int sampleOffset = -${d.H.int(4)}; sampleOffset <= ${d.H.int(4)}; ++sampleOffset) {
319
+ float sampleOffsetFloat = float(sampleOffset);
320
+ vec2 sampleUv = uv + sampleOffsetFloat * blurSize;
321
+ accumulateBlurSample(
322
+ sampleUv,
323
+ sampleOffsetFloat,
324
+ centerDepth,
325
+ centerNormal,
326
+ depthSharpness,
327
+ shouldReuseCenterOcclusion,
328
+ emissionWeightSum,
329
+ emissionSum,
330
+ occlusionWeightSum,
331
+ occlusionSum,
332
+ centerOcclusionBlendWeight
333
+ );
334
+ }
335
+
336
+ vec3 blurredEmission = (emissionSum / emissionWeightSum).rgb;
337
+ float occlusion = shouldReuseCenterOcclusion ? centerGlobalIllumination.a : occlusionSum / occlusionWeightSum;
338
+ fragColor = vec4(blurredEmission, occlusion);
339
+ `),e}const x=Object.freeze(Object.defineProperty({__proto__:null,GlobalIlluminationBlurDrawParameters:v,build:g},Symbol.toStringTag,{value:"Module"}))},50704(e,t,o){o.d(t,{G:()=>h,a:()=>p,b:()=>f});var r=o(82048),a=o(52540),n=o(72885),i=o(34845),s=o(20304),l=o(31821),c=o(15976),u=o(63761),d=o(65786),m=o(14113);class h extends d.Y{}function f(){const e=new m.N5,t=e.fragment;return e.include(r.c),e.include(i.Ir),e.include(n.Q),t.include(a.E),t.uniforms.add(new u.N("depthMap",e=>e.depthTexture),new u.N("normalMap",e=>e.normalTexture),new c.o("tex",e=>e.colorTexture),new c.o("globalIlluminationWeightTexture",e=>e.weightTexture),new s.m("scaleGlobalIllumination",e=>e.scaleGlobalIllumination),new s.m("projScale",(e,t)=>{const o=t.camera.distance;return o>5e4?Math.max(0,e.projScale-(o-5e4)):e.projScale})),t.code.add(l.H`float computeDepthWeight(float sampleDepth, float centerDepth, float depthSharpness) {
340
+ float depthDelta = abs(sampleDepth - centerDepth);
341
+ return exp(-0.08 - depthDelta * depthDelta * depthSharpness);
342
+ }
343
+ vec3 normalFromTexture(sampler2D normalTexture, vec2 uv) {
344
+ ivec2 normalTextureSize = textureSize(normalTexture, 0);
345
+ ivec2 normalTexel = clamp(ivec2(uv * vec2(normalTextureSize)), ivec2(0), normalTextureSize - ivec2(1));
346
+ return texelFetch(normalTexture, normalTexel, 0).xyz;
347
+ }
348
+ void sampleJointBilateralUpscale(vec2 sampleUv, out vec4 upscaledColor, out float upscaledWeight) {
349
+ float centerDepth = linearDepthFromTexture(depthMap, sampleUv);
350
+ vec3 centerNormal = normalFromTexture(normalMap, sampleUv);
351
+ float depthSharpness = globalIlluminationDepthSharpness(projScale, centerDepth, centerNormal);
352
+ vec2 lowResTextureSize = vec2(textureSize(tex, 0));
353
+ vec2 texelPosition = sampleUv * lowResTextureSize - 0.5;
354
+ vec2 texelBase = floor(texelPosition);
355
+ vec2 bilinearWeightsFraction = fract(texelPosition);
356
+ vec2 uv00 = (texelBase + vec2(0.5, 0.5)) / lowResTextureSize;
357
+ vec2 uv10 = (texelBase + vec2(1.5, 0.5)) / lowResTextureSize;
358
+ vec2 uv01 = (texelBase + vec2(0.5, 1.5)) / lowResTextureSize;
359
+ vec2 uv11 = (texelBase + vec2(1.5, 1.5)) / lowResTextureSize;
360
+ vec4 color00 = texture(tex, uv00);
361
+ vec4 color10 = texture(tex, uv10);
362
+ vec4 color01 = texture(tex, uv01);
363
+ vec4 color11 = texture(tex, uv11);
364
+ float weight00 = texture(globalIlluminationWeightTexture, uv00).r;
365
+ float weight10 = texture(globalIlluminationWeightTexture, uv10).r;
366
+ float weight01 = texture(globalIlluminationWeightTexture, uv01).r;
367
+ float weight11 = texture(globalIlluminationWeightTexture, uv11).r;
368
+ float depth00 = linearDepthFromTexture(depthMap, uv00);
369
+ float depth10 = linearDepthFromTexture(depthMap, uv10);
370
+ float depth01 = linearDepthFromTexture(depthMap, uv01);
371
+ float depth11 = linearDepthFromTexture(depthMap, uv11);
372
+ vec3 normal00 = normalFromTexture(normalMap, uv00);
373
+ vec3 normal10 = normalFromTexture(normalMap, uv10);
374
+ vec3 normal01 = normalFromTexture(normalMap, uv01);
375
+ vec3 normal11 = normalFromTexture(normalMap, uv11);
376
+ float bilinearWeight00 = (1.0 - bilinearWeightsFraction.x) * (1.0 - bilinearWeightsFraction.y);
377
+ float bilinearWeight10 = bilinearWeightsFraction.x * (1.0 - bilinearWeightsFraction.y);
378
+ float bilinearWeight01 = (1.0 - bilinearWeightsFraction.x) * bilinearWeightsFraction.y;
379
+ float bilinearWeight11 = bilinearWeightsFraction.x * bilinearWeightsFraction.y;
380
+ float jointBilateralWeight00 = bilinearWeight00 * computeDepthWeight(depth00, centerDepth, depthSharpness) * globalIlluminationNormalSimilarityWeight(normal00, centerNormal);
381
+ float jointBilateralWeight10 = bilinearWeight10 * computeDepthWeight(depth10, centerDepth, depthSharpness) * globalIlluminationNormalSimilarityWeight(normal10, centerNormal);
382
+ float jointBilateralWeight01 = bilinearWeight01 * computeDepthWeight(depth01, centerDepth, depthSharpness) * globalIlluminationNormalSimilarityWeight(normal01, centerNormal);
383
+ float jointBilateralWeight11 = bilinearWeight11 * computeDepthWeight(depth11, centerDepth, depthSharpness) * globalIlluminationNormalSimilarityWeight(normal11, centerNormal);
384
+ float jointBilateralWeightSum = jointBilateralWeight00 + jointBilateralWeight10 + jointBilateralWeight01 + jointBilateralWeight11;
385
+ if (jointBilateralWeightSum < 0.0001) {
386
+ vec2 nearestUv = (floor(texelPosition + 0.5) + vec2(0.5)) / lowResTextureSize;
387
+ upscaledColor = texture(tex, nearestUv);
388
+ upscaledWeight = texture(globalIlluminationWeightTexture, nearestUv).r;
389
+ return;
390
+ }
391
+ upscaledColor = (
392
+ color00 * jointBilateralWeight00 +
393
+ color10 * jointBilateralWeight10 +
394
+ color01 * jointBilateralWeight01 +
395
+ color11 * jointBilateralWeight11
396
+ ) / jointBilateralWeightSum;
397
+ upscaledWeight = (
398
+ weight00 * jointBilateralWeight00 +
399
+ weight10 * jointBilateralWeight10 +
400
+ weight01 * jointBilateralWeight01 +
401
+ weight11 * jointBilateralWeight11
402
+ ) / jointBilateralWeightSum;
403
+ }`),e.outputs.add("fragColor","vec4",0),e.outputs.add("fragWeight","float",1),t.main.add(l.H`sampleJointBilateralUpscale(uv, fragColor, fragWeight);`),e}const p=Object.freeze(Object.defineProperty({__proto__:null,GlobalIlluminationUpscaleDrawParameters:h,build:f},Symbol.toStringTag,{value:"Module"}))},57323(e,t,o){o.d(t,{R:()=>R,b:()=>N});var r=o(32680),a=o(49255),n=o(68317),i=o(76597),s=o(24321),l=o(2585),c=o(43519),u=o(96336),d=o(39014),m=o(53466),h=o(92700),f=o(35640),p=o(40261),v=o(71651),g=o(32971),x=o(98619),b=o(22393),w=o(59469),y=o(32482),M=o(43259),S=o(58614),T=o(27950),C=o(77949),I=o(33079),_=o(71988),z=o(20304),P=o(31821),F=o(63761),O=o(27832),D=o(43616),H=o(26934),j=o(73541),B=o(14113);function N(e){const t=new B.N5,{attributes:o,vertex:N,fragment:R,varyings:E}=t,{output:G,offsetBackfaces:A,pbrMode:W,snowCover:L,spherical:V}=e,U=1===W||2===W;if((0,C.NB)(N,e),o.add("position","vec3"),N.inputs.add("position",()=>"position"),E.add("vpos","vec3",{invariant:!0}),t.include(M.A,e),t.include(l.B,e),t.include(f.Ge,e),!(0,a._o)(G))return t.include(p.E,e),t;(0,C.yu)(t.vertex,e),t.include(u.Y,e),t.include(i.d),A&&t.include(r.M),E.add("vNormalWorld","vec3"),E.add("localvpos","vec3",{invariant:!0}),t.include(m.U,e),t.include(d.K,e),t.include(s.v,e),t.include(h.c,e),N.include(c.WD),N.include(c.oF),N.uniforms.add(new _.E("externalColor",e=>e.externalColor,{supportsNaN:!0})),E.add("vcolorExt","vec4"),t.include(e.instancedDoublePrecision?y.QH:y.LA,e),N.include(H.Q),N.main.add(P.H`
404
+ forwardVertexColor();
405
+
406
+ MaskedColor maskedColorExt =
407
+ applySymbolColor(applyVVColor(applyInstanceColor(createMaskedFromNaNColor(externalColor))));
408
+
409
+ vcolorExt = maskedColorExt.color;
410
+ forwardColorMixMode(maskedColorExt.mask);
411
+
412
+ bool alphaCut = opacityMixMode != ${P.H.int(D.Um.ignore)} && vcolorExt.a < alphaCutoff;
413
+ vpos = getVertexInLocalOriginSpace();
414
+
415
+ localvpos = vpos - view[3].xyz;
416
+ vpos = subtractOrigin(vpos);
417
+ vNormalWorld = dpNormal(vvLocalNormal(normalModel()));
418
+ vpos = addVerticalOffset(vpos, localOrigin);
419
+ vec4 basePosition = transformPosition(proj, view, vpos);
420
+
421
+ forwardTextureCoordinates();
422
+ forwardLinearDepthToReadShadowMap();
423
+ gl_Position = alphaCut ? vec4(1e38, 1e38, 1e38, 1.0) :
424
+ ${(0,P.If)(A,"offsetBackfacingClipPosition(basePosition, vpos, vNormalWorld, cameraPosition);","basePosition;")}
425
+ `);const{hasColorTexture:k,hasColorTextureTransform:q}=e;return R.include(g.kA,e),R.include(v.n,e),t.include(S.S,e),R.include(n.HQ,e),t.include(j.D,e),(0,C.yu)(R,e),(0,x.Gc)(R),(0,g.a8)(R),(0,g.eU)(R),R.uniforms.add(N.uniforms.get("localOrigin"),N.uniforms.get("view"),new I.t("ambient",e=>e.ambient),new I.t("diffuse",e=>e.diffuse),new z.m("opacity",e=>e.opacity),new z.m("layerOpacity",e=>e.layerOpacity)),k&&R.uniforms.add(new F.N("tex",e=>e.texture)),t.include(w._,e),R.include(b.c,e),R.include(T.N),R.include(O.b,e),(0,x.O4)(R),R.main.add(P.H`
426
+ discardBySlice(vpos);
427
+ vec4 texColor = ${k?`texture(tex, ${q?"colorUV":"vuv0"})`:" vec4(1.0)"};
428
+ ${(0,P.If)(k,`${(0,P.If)(e.textureAlphaPremultiplied,"texColor.rgb /= texColor.a;")}\n discardOrAdjustAlpha(texColor);`)}
429
+ vec3 viewDirection = normalize(vpos - cameraPosition);
430
+ applyPBRFactors();
431
+ float ssao = evaluateAmbientOcclusionInverse();
432
+ ssao *= getBakedOcclusion();
433
+
434
+ float additionalAmbientScale = additionalDirectedAmbientLight(vpos + localOrigin);
435
+ vec3 additionalLight = ssao * mainLightIntensity * additionalAmbientScale * ambientBoostFactor * lightingGlobalFactor;
436
+ float shadow = readShadow(additionalAmbientScale, vpos);
437
+ vec3 matColor = max(ambient, diffuse);
438
+ ${e.hasVertexColors?P.H`vec3 albedo = mixExternalColor(vColor.rgb * matColor, texColor.rgb, vcolorExt.rgb, colorMixMode);
439
+ float opacity_ = layerOpacity * mixExternalOpacity(vColor.a * opacity, texColor.a, vcolorExt.a, opacityMixMode);`:P.H`vec3 albedo = mixExternalColor(matColor, texColor.rgb, vcolorExt.rgb, colorMixMode);
440
+ float opacity_ = layerOpacity * mixExternalOpacity(opacity, texColor.a, vcolorExt.a, opacityMixMode);`}
441
+
442
+ vec3 shadingNormal = normalize(vNormalWorld);
443
+ vec3 groundNormal = ${V?"normalize(vpos + localOrigin)":"vec3(0.0, 0.0, 1.0)"};
444
+
445
+ ${(0,P.If)(L,"vec3 faceNormal = screenDerivativeNormal(vpos);\n float snow = getRealisticTreeSnow(faceNormal, shadingNormal, groundNormal);\n albedo = mix(albedo, vec3(1), snow);")}
446
+
447
+ ${P.H`albedo *= 1.2;
448
+ vec3 viewForward = vec3(view[0][2], view[1][2], view[2][2]);
449
+ float alignmentLightView = clamp(dot(viewForward, -mainLightDirection), 0.0, 1.0);
450
+ float transmittance = 1.0 - clamp(dot(viewForward, shadingNormal), 0.0, 1.0);
451
+ float treeRadialFalloff = vColor.r;
452
+ float backLightFactor = 0.5 * treeRadialFalloff * alignmentLightView * transmittance * (1.0 - shadow);
453
+ additionalLight += backLightFactor * mainLightIntensity;`}
454
+
455
+ ${U?P.H`float additionalAmbientIrradiance = additionalAmbientIrradianceFactor * mainLightIntensity[2];
456
+ ${(0,P.If)(L,"mrr = applySnowToMRR(mrr, snow);")}
457
+ vec3 shadedColor = evaluateSceneLightingPBR(shadingNormal, albedo, shadow, 1.0 - ssao, additionalLight, viewDirection, groundNormal, mrr, additionalAmbientIrradiance);`:P.H`vec3 shadedColor = evaluateSceneLighting(shadingNormal, albedo, shadow, 1.0 - ssao, additionalLight);`}
458
+ vec4 finalColor = vec4(shadedColor, opacity_);
459
+ outputColorHighlightOLID(applySlice(finalColor, vpos), albedo ${(0,P.If)(L,", 1.0")});`),t}const R=Object.freeze(Object.defineProperty({__proto__:null,build:N},Symbol.toStringTag,{value:"Module"}))},15581(e,t,o){o.d(t,{S:()=>b,b:()=>v,g:()=>g});var r=o(37585),a=o(48163),n=o(82048),i=o(52540),s=o(65261),l=o(34845),c=o(77108),u=o(47286),d=o(33094),m=o(20304),h=o(31821),f=o(63761),p=o(14113);function v(){const e=new p.N5,t=e.fragment;return e.include(n.c),e.include(l.Ir),t.include(i.E),t.include(s.C),t.uniforms.add(new d.U("radius",e=>g(e.camera))).code.add(h.H`vec3 sphere[16] = vec3[16](
460
+ vec3(0.186937, 0.0, 0.0),
461
+ vec3(0.700542, 0.0, 0.0),
462
+ vec3(-0.864858, -0.481795, -0.111713),
463
+ vec3(-0.624773, 0.102853, -0.730153),
464
+ vec3(-0.387172, 0.260319, 0.007229),
465
+ vec3(-0.222367, -0.642631, -0.707697),
466
+ vec3(-0.01336, -0.014956, 0.169662),
467
+ vec3(0.122575, 0.1544, -0.456944),
468
+ vec3(-0.177141, 0.85997, -0.42346),
469
+ vec3(-0.131631, 0.814545, 0.524355),
470
+ vec3(-0.779469, 0.007991, 0.624833),
471
+ vec3(0.308092, 0.209288,0.35969),
472
+ vec3(0.359331, -0.184533, -0.377458),
473
+ vec3(0.192633, -0.482999, -0.065284),
474
+ vec3(0.233538, 0.293706, -0.055139),
475
+ vec3(0.417709, -0.386701, 0.442449)
476
+ );
477
+ float fallOffFunction(float vv, float vn, float bias) {
478
+ float f = max(radius * radius - vv, 0.0);
479
+ return f * f * f * max(vn - bias, 0.0);
480
+ }`),t.code.add(h.H`float aoValueFromPositionsAndNormal(vec3 C, vec3 n_C, vec3 Q) {
481
+ vec3 v = Q - C;
482
+ float vv = dot(v, v);
483
+ float vn = dot(normalize(v), n_C);
484
+ return fallOffFunction(vv, vn, 0.1);
485
+ }`),e.outputs.add("fragOcclusion","float"),t.uniforms.add(new f.N("normalMap",e=>e.normalTexture),new f.N("depthMap",e=>e.depthTexture),new m.m("projScale",e=>e.projScale),new f.N("rnm",e=>e.noiseTexture),new u.G("rnmScale",(e,t)=>(0,r.hZ)(x,t.camera.fullWidth/e.noiseTexture.descriptor.width,t.camera.fullHeight/e.noiseTexture.descriptor.height)),new m.m("intensity",e=>e.intensity),new c.E("screenSize",e=>(0,r.hZ)(x,e.camera.fullWidth,e.camera.fullHeight))).main.add(h.H`
486
+ float depth = depthFromTexture(depthMap, uv);
487
+
488
+ // Early out if depth is out of range, such as in the sky
489
+ if (depth >= 1.0 || depth <= 0.0) {
490
+ fragOcclusion = 1.0;
491
+ return;
492
+ }
493
+
494
+ // get the normal of current fragment
495
+ ivec2 iuv = ivec2(uv * vec2(textureSize(normalMap, 0)));
496
+ vec4 norm4 = texelFetch(normalMap, iuv, 0);
497
+ if(norm4.a != 1.0) {
498
+ fragOcclusion = 1.0;
499
+ return;
500
+ }
501
+ vec3 norm = normalize(norm4.xyz * 2.0 - 1.0);
502
+
503
+ float currentPixelDepth = linearizeDepth(depth);
504
+ vec3 currentPixelPos = reconstructPosition(gl_FragCoord.xy, currentPixelDepth);
505
+
506
+ float sum = 0.0;
507
+ vec3 tapPixelPos;
508
+
509
+ vec3 fres = normalize(2.0 * texture(rnm, uv * rnmScale).xyz - 1.0);
510
+
511
+ // note: the factor 2.0 should not be necessary, but makes ssao much nicer.
512
+ // bug or deviation from CE somewhere else?
513
+ float ps = projScale / (2.0 * currentPixelPos.z * zScale.x + zScale.y);
514
+
515
+ for(int i = 0; i < ${h.H.int(16)}; ++i) {
516
+ vec2 unitOffset = reflect(sphere[i], fres).xy;
517
+ vec2 offset = vec2(-unitOffset * radius * ps);
518
+
519
+ // don't use current or very nearby samples
520
+ if( abs(offset.x) < 2.0 || abs(offset.y) < 2.0){
521
+ continue;
522
+ }
523
+
524
+ vec2 tc = vec2(gl_FragCoord.xy + offset);
525
+ if (tc.x < 0.0 || tc.y < 0.0 || tc.x > screenSize.x || tc.y > screenSize.y) continue;
526
+ vec2 tcTap = tc / screenSize;
527
+ float occluderFragmentDepth = linearDepthFromTexture(depthMap, tcTap);
528
+
529
+ tapPixelPos = reconstructPosition(tc, occluderFragmentDepth);
530
+
531
+ sum += aoValueFromPositionsAndNormal(currentPixelPos, norm, tapPixelPos);
532
+ }
533
+
534
+ // output the result
535
+ float A = max(1.0 - sum * intensity / float(${h.H.int(16)}), 0.0);
536
+
537
+ // Anti-tone map to reduce contrast and drag dark region farther: (x^0.2 + 1.2 * x^4) / 2.2
538
+ A = (pow(A, 0.2) + 1.2 * pow(A, 4.0)) * INV_GAMMA;
539
+
540
+ fragOcclusion = A;
541
+ `),e}function g(e){return Math.max(10,20*e.computeScreenPixelSizeAtDist(Math.abs(4*e.relativeElevation)))}const x=(0,a.vt)(),b=Object.freeze(Object.defineProperty({__proto__:null,build:v,getRadius:g},Symbol.toStringTag,{value:"Module"}))},95774(e,t,o){o.d(t,{S:()=>m,b:()=>d});var r=o(82048),a=o(52540),n=o(68259),i=o(20304),s=o(31821),l=o(15976),c=o(63761),u=o(14113);function d(){const e=new u.N5,t=e.fragment;return e.include(r.c),t.include(a.E),t.uniforms.add(new c.N("depthMap",e=>e.depthTexture),new l.o("tex",e=>e.colorTexture),new n.t("blurSize",e=>e.blurSize),new i.m("projScale",(e,t)=>{const o=t.camera.distance;return o>5e4?Math.max(0,e.projScale-(o-5e4)):e.projScale})),t.code.add(s.H`
542
+ void blurFunction(vec2 uv, float r, float center_d, float sharpness, inout float wTotal, inout float bTotal) {
543
+ float c = texture(tex, uv).r;
544
+ float d = linearDepthFromTexture(depthMap, uv);
545
+
546
+ float ddiff = d - center_d;
547
+
548
+ float w = exp(-r * r * ${s.H.float(.08)} - ddiff * ddiff * sharpness);
549
+ wTotal += w;
550
+ bTotal += w * c;
551
+ }
552
+ `),e.outputs.add("fragBlur","float"),t.main.add(s.H`
553
+ float b = 0.0;
554
+ float w_total = 0.0;
555
+
556
+ float center_d = linearDepthFromTexture(depthMap, uv);
557
+
558
+ float sharpness = -0.05 * projScale / center_d;
559
+ for (int r = -${s.H.int(4)}; r <= ${s.H.int(4)}; ++r) {
560
+ float rf = float(r);
561
+ vec2 uvOffset = uv + rf * blurSize;
562
+ blurFunction(uvOffset, rf, center_d, sharpness, w_total, b);
563
+ }
564
+ fragBlur = b / w_total;`),e}const m=Object.freeze(Object.defineProperty({__proto__:null,build:d},Symbol.toStringTag,{value:"Module"}))},43609(e,t,o){o.d(t,{a:()=>n,f:()=>i,n:()=>a});var r=o(34275);function a(e,t){n(e.typedBuffer,t.typedBuffer,e.typedBufferStride,t.typedBufferStride)}function n(e,t,o=2,a=o){const n=t.length/2;let i=0,s=0;if(!(0,r.iu)(t)||(0,r.dk)(t)){for(let r=0;r<n;++r)e[i]=t[s],e[i+1]=t[s+1],i+=o,s+=a;return}const l=(0,r.a3)(t);if((0,r.JI)(t))for(let r=0;r<n;++r)e[i]=Math.max(t[s]/l,-1),e[i+1]=Math.max(t[s+1]/l,-1),i+=o,s+=a;else for(let r=0;r<n;++r)e[i]=t[s]/l,e[i+1]=t[s+1]/l,i+=o,s+=a}function i(e,t,o,r){const a=e.typedBuffer,n=e.typedBufferStride,i=r?.count??e.count;let s=(r?.dstIndex??0)*n;for(let e=0;e<i;++e)a[s]=t,a[s+1]=o,s+=n}Object.freeze(Object.defineProperty({__proto__:null,fill:i,normalizeIntegerBuffer:n,normalizeIntegerBufferView:a},Symbol.toStringTag,{value:"Module"}))},73354(e,t,o){o.d(t,{a:()=>m,b:()=>l,c:()=>s,d:()=>n,e:()=>h,f:()=>d,l:()=>u,n:()=>f,t:()=>i});var r=o(40876),a=(o(44208),o(72727));function n(e,t,o){i(e.typedBuffer,t.typedBuffer,o,e.typedBufferStride,t.typedBufferStride)}function i(e,t,o,r=3,n=r){const i=(0,a.k)(e.length,r,3),s=(0,a.k)(t.length,n,3),l=Math.min(i,s),c=o[0],u=o[1],d=o[2],m=o[4],h=o[5],f=o[6],p=o[8],v=o[9],g=o[10],x=o[12],b=o[13],w=o[14];let y=0,M=0;for(let o=0;o<l;o++){const o=t[y],a=t[y+1],i=t[y+2];e[M]=c*o+m*a+p*i+x,e[M+1]=u*o+h*a+v*i+b,e[M+2]=d*o+f*a+g*i+w,y+=n,M+=r}return e}function s(e,t,o){l(e.typedBuffer,t.typedBuffer,o,e.typedBufferStride,t.typedBufferStride)}function l(e,t,o,r=3,n=r){const i=(0,a.k)(e.length,r,3),s=(0,a.k)(t.length,n,3),l=Math.min(i,s),c=o[0],u=o[1],d=o[2],m=o[3],h=o[4],f=o[5],p=o[6],v=o[7],g=o[8];let x=0,b=0;for(let o=0;o<l;o++){const o=t[x],a=t[x+1],i=t[x+2];e[b]=c*o+m*a+p*i,e[b+1]=u*o+h*a+v*i,e[b+2]=d*o+f*a+g*i,x+=n,b+=r}}function c(e,t,o,r=3,a=r){const n=Math.min(e.length/r,t.length/a);let i=0,s=0;for(let l=0;l<n;l++)e[s]=o*t[i],e[s+1]=o*t[i+1],e[s+2]=o*t[i+2],i+=a,s+=r;return e}function u(e,t,o,r){d(e.typedBuffer,t.typedBuffer,o,r,e.typedBufferStride,t.typedBufferStride)}function d(e,t,o,a,n=3,i=n){const s=Math.min(e.length/n,t.length/i);let l=0,c=0;const u=1/r.Tf;for(let r=0;r<s;r++)e[c]=a*(o*t[l])**u,e[c+1]=a*(o*t[l+1])**u,e[c+2]=a*(o*t[l+2])**u,l+=i,c+=n}function m(e,t,o,r=3,n=r){const i=(0,a.k)(e.length,r,3),s=(0,a.k)(t.length,n,3),l=Math.min(i,s);let c=0,u=0;for(let a=0;a<l;a++)e[u]=t[c]+o[0],e[u+1]=t[c+1]+o[1],e[u+2]=t[c+2]+o[2],c+=n,u+=r;return e}function h(e,t){f(e.typedBuffer,t.typedBuffer,e.typedBufferStride,t.typedBufferStride)}function f(e,t,o=3,r=o){const a=Math.min(e.length/o,t.length/r);let n=0,i=0;for(let s=0;s<a;s++){const a=t[n],s=t[n+1],l=t[n+2],c=a*a+s*s+l*l;if(c>0){const t=1/Math.sqrt(c);e[i]=t*a,e[i+1]=t*s,e[i+2]=t*l}n+=r,i+=o}}Object.freeze(Object.defineProperty({__proto__:null,linearToSRGB:d,linearToSRGBView:u,normalize:f,normalizeView:h,scale:c,scaleView:function(e,t,o){c(e.typedBuffer,t.typedBuffer,o,e.typedBufferStride,t.typedBufferStride)},shiftRight:function(e,t,o){const r=Math.min(e.count,t.count),a=e.typedBuffer,n=e.typedBufferStride,i=t.typedBuffer,s=t.typedBufferStride;let l=0,c=0;for(let e=0;e<r;e++)a[c]=i[l]>>o,a[c+1]=i[l+1]>>o,a[c+2]=i[l+2]>>o,l+=s,c+=n},transformMat3:l,transformMat3View:s,transformMat4:i,transformMat4View:n,translate:m},Symbol.toStringTag,{value:"Module"}))},69052(e,t,o){o.d(t,{hr:()=>a,ie:()=>l,uC:()=>s});var r=o(34727);class a{constructor(e,t){this.min=e,this.max=t,this.range=t-e}normalize(e,t=0,o=!1){return n(this.range,this.min,this.max,e,t,o)}clamp(e,t=0){return(0,r.qE)(e-t,this.min,this.max)+t}monotonic(e,t,o){return e<t?t:t+i(this.range,e-t,o)}minimalMonotonic(e,t,o){return n(this.range,e,e+this.range,t,o)}center(e,t,o){return t=this.monotonic(e,t,o),this.normalize((e+t)/2,o)}diff(e,t,o){return this.monotonic(e,t,o)-e}shortestSignedDiff(e,t){e=this.normalize(e);const o=(t=this.normalize(t))-e,r=t<e?this.minimalMonotonic(e,t)-e:t-this.minimalMonotonic(t,e);return Math.abs(o)<Math.abs(r)?o:r}contains(e,t,o){return t=this.minimalMonotonic(e,t),(o=this.minimalMonotonic(e,o))>e&&o<t}}function n(e,t,o,r,a=0,n=!1){return(r-=a)<t?r+=i(e,t-r):r>o&&(r-=i(e,r-o)),n&&r===o&&(r=t),r+a}function i(e,t,o=0){return Math.ceil((t-o)/e)*e+o}const s=new a(0,2*Math.PI),l=(new a(-Math.PI,Math.PI),new a(0,360))},46140(e,t,o){o.d(t,{A:()=>a});var r=o(49186);class a{constructor(e,t,o=""){this.major=e,this.minor=t,this._context=o}lessThan(e,t){return this.major<e||e===this.major&&this.minor<t}greaterEqual(e,t){return!this.lessThan(e,t)}toString(){return`${this.major}.${this.minor}`}validate(e){if(this.major!==e.major){const t=this._context&&this._context+":",o=this._context&&this._context+" ";throw new r.A(t+"unsupported-version",`Required major ${o}version is '${this.major}', but got '\${version.major}.\${version.minor}'`,{version:e})}}clone(){return new a(this.major,this.minor,this._context)}static parse(e,t=""){const[o,n]=e.split("."),i=/^\s*\d+\s*$/;if(!o?.match||!i.test(o))throw new r.A((t&&t+":")+"invalid-version","Expected major version to be a number, but got '${version}'",{version:e});if(!n?.match||!i.test(n))throw new r.A((t&&t+":")+"invalid-version","Expected minor version to be a number, but got '${version}'",{version:e});const s=parseInt(o,10),l=parseInt(n,10);return new a(s,l,t)}}},61473(e,t,o){function r(e){return e=e||globalThis.location.hostname,c.some(t=>null!=e?.match(t))}function a(e,t){return e?(t=t||globalThis.location.hostname)?null!=t.match(n)||null!=t.match(s)?e.replace("static.arcgis.com","staticdev.arcgis.com"):null!=t.match(i)||null!=t.match(l)?e.replace("static.arcgis.com","staticqa.arcgis.com"):e:e:null}o.d(t,{EM:()=>a,b5:()=>r});const n=/^devext\.arcgis\.com$/,i=/^qaext\.arcgis\.com$/,s=/^[\w-]*\.mapsdevext\.arcgis\.com$/,l=/^[\w-]*\.mapsqa\.arcgis\.com$/,c=[/^([\w-]*\.)?[\w-]*\.zrh-dev-local\.esri\.com$/,n,i,/^jsapps\.esri\.com$/,s,l]},82534(e,t,o){function r(){return[0,0,0,1]}function a(e){return[e[0],e[1],e[2],e[3]]}o.d(t,{o8:()=>a,vt:()=>r,zK:()=>n});const n=[0,0,0,1];Object.freeze(Object.defineProperty({__proto__:null,IDENTITY:n,clone:a,create:r,fromValues:function(e,t,o,r){return[e,t,o,r]}},Symbol.toStringTag,{value:"Module"}))},88340(e,t,o){function r(){return new Float32Array(2)}function a(e,t){const o=new Float32Array(2);return o[0]=e,o[1]=t,o}function n(){return r()}function i(){return a(1,1)}function s(){return a(1,0)}function l(){return a(0,1)}o.d(t,{Un:()=>u,fA:()=>a,uY:()=>c,vt:()=>r});const c=n(),u=i(),d=s(),m=l();Object.freeze(Object.defineProperty({__proto__:null,ONES:u,UNIT_X:d,UNIT_Y:m,ZEROS:c,clone:function(e){const t=new Float32Array(2);return t[0]=e[0],t[1]=e[1],t},create:r,fromValues:a,ones:i,unitX:s,unitY:l,zeros:n},Symbol.toStringTag,{value:"Module"}))},48163(e,t,o){function r(){return[0,0]}function a(e){return[e[0],e[1]]}function n(e,t){return[e,t]}function i(){return n(1,1)}function s(){return n(1,0)}function l(){return n(0,1)}o.d(t,{Un:()=>c,fA:()=>n,o8:()=>a,vt:()=>r});const c=i(),u=s(),d=l();Object.freeze(Object.defineProperty({__proto__:null,ONES:c,UNIT_X:u,UNIT_Y:d,ZEROS:[0,0],clone:a,create:r,freeze:function(e,t){return[e,t]},fromArray:function(e,t=[0,0]){const o=Math.min(2,e.length);for(let r=0;r<o;++r)t[r]=e[r];return t},fromValues:n,ones:i,unitX:s,unitY:l,zeros:function(){return[0,0]}},Symbol.toStringTag,{value:"Module"}))},91829(e,t,o){function r(){return[0,0,0,0]}function a(e,t,o,r){return[e,t,o,r]}function n(e,t,o,r){return[e,t,o,r]}function i(){return a(1,1,1,1)}function s(){return a(1,0,0,0)}function l(){return a(0,1,0,0)}function c(){return a(0,0,1,0)}function u(){return a(0,0,0,1)}o.d(t,{CN:()=>n,Un:()=>m,fA:()=>a,uY:()=>d,vt:()=>r});const d=[0,0,0,0],m=i(),h=s(),f=l(),p=c(),v=u();Object.freeze(Object.defineProperty({__proto__:null,ONES:m,UNIT_W:v,UNIT_X:h,UNIT_Y:f,UNIT_Z:p,ZEROS:d,clone:function(e){return[e[0],e[1],e[2],e[3]]},create:r,freeze:n,fromArray:function(e,t=[0,0,0,0]){const o=Math.min(4,e.length);for(let r=0;r<o;++r)t[r]=e[r];return t},fromValues:a,ones:i,unitW:u,unitX:s,unitY:l,unitZ:c,zeros:function(){return[0,0,0,0]}},Symbol.toStringTag,{value:"Module"}))},78955(e,t,o){o.d(t,{Bw:()=>v,C:()=>a,Cc:()=>w,LI:()=>m,Om:()=>b,S8:()=>x,T9:()=>d,WQ:()=>i,Z0:()=>y,aI:()=>S,hG:()=>p,hZ:()=>n,hs:()=>h,jk:()=>u,m3:()=>g,t2:()=>M});var r=o(34304);function a(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}function n(e,t,o,r,a){return e[0]=t,e[1]=o,e[2]=r,e[3]=a,e}function i(e,t,o){return e[0]=t[0]+o[0],e[1]=t[1]+o[1],e[2]=t[2]+o[2],e[3]=t[3]+o[3],e}function s(e,t,o){return e[0]=t[0]-o[0],e[1]=t[1]-o[1],e[2]=t[2]-o[2],e[3]=t[3]-o[3],e}function l(e,t,o){return e[0]=t[0]*o[0],e[1]=t[1]*o[1],e[2]=t[2]*o[2],e[3]=t[3]*o[3],e}function c(e,t,o){return e[0]=t[0]/o[0],e[1]=t[1]/o[1],e[2]=t[2]/o[2],e[3]=t[3]/o[3],e}function u(e,t,o){return e[0]=Math.min(t[0],o[0]),e[1]=Math.min(t[1],o[1]),e[2]=Math.min(t[2],o[2]),e[3]=Math.min(t[3],o[3]),e}function d(e,t,o){return e[0]=Math.max(t[0],o[0]),e[1]=Math.max(t[1],o[1]),e[2]=Math.max(t[2],o[2]),e[3]=Math.max(t[3],o[3]),e}function m(e,t){return e[0]=Math.round(t[0]),e[1]=Math.round(t[1]),e[2]=Math.round(t[2]),e[3]=Math.round(t[3]),e}function h(e,t,o){return e[0]=t[0]*o,e[1]=t[1]*o,e[2]=t[2]*o,e[3]=t[3]*o,e}function f(e,t){const o=t[0]-e[0],r=t[1]-e[1],a=t[2]-e[2],n=t[3]-e[3];return Math.sqrt(o*o+r*r+a*a+n*n)}function p(e,t){const o=t[0]-e[0],r=t[1]-e[1],a=t[2]-e[2],n=t[3]-e[3];return o*o+r*r+a*a+n*n}function v(e){const t=e[0],o=e[1],r=e[2],a=e[3];return Math.sqrt(t*t+o*o+r*r+a*a)}function g(e){const t=e[0],o=e[1],r=e[2],a=e[3];return t*t+o*o+r*r+a*a}function x(e,t){const o=t[0],r=t[1],a=t[2],n=t[3];let i=o*o+r*r+a*a+n*n;return i>0&&(i=1/Math.sqrt(i),e[0]=o*i,e[1]=r*i,e[2]=a*i,e[3]=n*i),e}function b(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]}function w(e,t,o,r){const a=t[0],n=t[1],i=t[2],s=t[3];return e[0]=a+r*(o[0]-a),e[1]=n+r*(o[1]-n),e[2]=i+r*(o[2]-i),e[3]=s+r*(o[3]-s),e}function y(e,t,o){const r=t[0],a=t[1],n=t[2],i=t[3];return e[0]=o[0]*r+o[4]*a+o[8]*n+o[12]*i,e[1]=o[1]*r+o[5]*a+o[9]*n+o[13]*i,e[2]=o[2]*r+o[6]*a+o[10]*n+o[14]*i,e[3]=o[3]*r+o[7]*a+o[11]*n+o[15]*i,e}function M(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]}function S(e,t){const o=e[0],a=e[1],n=e[2],i=e[3],s=t[0],l=t[1],c=t[2],u=t[3],d=(0,r.FD)();return Math.abs(o-s)<=d*Math.max(1,Math.abs(o),Math.abs(s))&&Math.abs(a-l)<=d*Math.max(1,Math.abs(a),Math.abs(l))&&Math.abs(n-c)<=d*Math.max(1,Math.abs(n),Math.abs(c))&&Math.abs(i-u)<=d*Math.max(1,Math.abs(i),Math.abs(u))}const T=s,C=l,I=c,_=f,z=p,P=v,F=g;Object.freeze(Object.defineProperty({__proto__:null,add:i,ceil:function(e,t){return e[0]=Math.ceil(t[0]),e[1]=Math.ceil(t[1]),e[2]=Math.ceil(t[2]),e[3]=Math.ceil(t[3]),e},copy:a,copyVec3:function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e},dist:_,distance:f,div:I,divide:c,dot:b,equals:S,exactEquals:M,floor:function(e,t){return e[0]=Math.floor(t[0]),e[1]=Math.floor(t[1]),e[2]=Math.floor(t[2]),e[3]=Math.floor(t[3]),e},inverse:function(e,t){return e[0]=1/t[0],e[1]=1/t[1],e[2]=1/t[2],e[3]=1/t[3],e},len:P,length:v,lerp:w,max:d,min:u,mul:C,multiply:l,negate:function(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=-t[3],e},normalize:x,random:function(e,t=1){const o=r.Ov;let a,n,i,s,l,c;do{a=2*o()-1,n=2*o()-1,l=a*a+n*n}while(l>=1);do{i=2*o()-1,s=2*o()-1,c=i*i+s*s}while(c>=1);const u=Math.sqrt((1-l)/c);return e[0]=t*a,e[1]=t*n,e[2]=t*i*u,e[3]=t*s*u,e},round:m,scale:h,scaleAndAdd:function(e,t,o,r){return e[0]=t[0]+o[0]*r,e[1]=t[1]+o[1]*r,e[2]=t[2]+o[2]*r,e[3]=t[3]+o[3]*r,e},set:n,sqrDist:z,sqrLen:F,squaredDistance:p,squaredLength:g,str:function(e){return"vec4("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+")"},sub:T,subtract:s,transformMat4:y,transformQuat:function(e,t,o){const r=t[0],a=t[1],n=t[2],i=o[0],s=o[1],l=o[2],c=o[3],u=c*r+s*n-l*a,d=c*a+l*r-i*n,m=c*n+i*a-s*r,h=-i*r-s*a-l*n;return e[0]=u*c+h*-i+d*-l-m*-s,e[1]=d*c+h*-s+m*-i-u*-l,e[2]=m*c+h*-l+u*-s-d*-i,e[3]=t[3],e}},Symbol.toStringTag,{value:"Module"}))},69397(e,t,o){o.d(t,{Qf:()=>l,Qh:()=>i,RS:()=>a,Ul:()=>h,i5:()=>m,lM:()=>n,qK:()=>u});var r=o(34275);const a=16;function n(e){if(!e)return 0;let t=u;for(const o in e)e.hasOwnProperty(o)&&(t+=s(e[o],!1));return t}function i(e){if(!e)return 0;if("number"==typeof e[0])return l(e);if(Array.isArray(e))return function(e){const t=e.length;if(0===t||"number"==typeof e[0])return c(e,8);let o=d;for(let r=0;r<t;r++)o+=s(e[r]);return o}(e);let t=u;for(const o in e)e.hasOwnProperty(o)&&(t+=s(e[o]));return t}function s(e,t=!0){switch(typeof e){case"object":return t?i(e):u;case"string":return function(e){return 32+e.length}(e);case"number":return a;case"boolean":return 4;default:return 8}}function l(...e){return e.reduce((e,t)=>e+(t?(0,r.iu)(t)?t.byteLength+m:Array.isArray(t)?c(t,a):0:0),0)}function c(e,t){return d+e.length*t}const u=32,d=16,m=145,h=64},65806(e,t,o){o.d(t,{g:()=>i});var r=o(51850),a=o(91218),n=o(9762);function i(e,t,o,r){if((0,a.canProjectWithoutEngine)(e.spatialReference,o))return s[0]=e.x,s[1]=e.y,s[2]=e.z??0,(0,n.projectBuffer)(s,e.spatialReference,0,t,o,0);const i=(0,a.tryProject)(e,o,r);return!!i&&(t[0]=i.x,t[1]=i.y,t[2]=i.z??0,!0)}const s=(0,r.vt)()},27993(e,t,o){o.d(t,{F:()=>s});var r=o(91218),a=o(16930),n=o(9762),i=o(65806);function s(e,t,o,a){return!(null==t||null==a||e.length<2)&&((0,r.canProjectWithoutEngine)(t,a)?(0,n.projectBuffer)(e,t,0,o,a,0,1):(l.x=e[0],l.y=e[1],l.z=e[2],l.spatialReference=t,(0,i.g)(l,o,a)))}const l={x:0,y:0,z:0,hasZ:!0,hasM:!1,spatialReference:a.A.WGS84,type:"point"}},72727(e,t,o){function r(e,t,o){if(t<=0)return 0;const r=e-o;return r<0?0:Math.floor(r/t)+1}o.d(t,{k:()=>r}),o(53966)},17136(e,t,o){o.d(t,{Y_:()=>z,O7:()=>I,el:()=>C});var r=o(92602),a=o(69052),n=o(49186),i=o(53966),s=o(39829),l=o(82799),c=o(16930),u=o(80754),d=o(21325),m=o(28735),h=o(11254),f=o(60408),p=o(65864),v=o(2272),g=o(84952),x=o(92300);const b=()=>i.A.getLogger("esri.geometry.support.normalizeUtils");function w(e){return"polygon"===e[0].type}function y(e){return"polyline"===e[0].type}function M(e,t,o){if(t){const t=function(e,t){if(!(e instanceof l.A||e instanceof s.A)){const e="straightLineDensify: the input geometry is neither polyline nor polygon";throw b().error(e),new n.A("internal:geometry",e)}const o=(0,u.r8)(e),r=[];for(const e of o){const o=[];r.push(o),o.push([e[0][0],e[0][1]]);for(let r=0;r<e.length-1;r++){const a=e[r][0],n=e[r][1],i=e[r+1][0],s=e[r+1][1],l=Math.sqrt((i-a)*(i-a)+(s-n)*(s-n)),c=(s-n)/l,u=(i-a)/l,d=l/t;if(d>1){for(let e=1;e<=d-1;e++){const r=e*t,i=u*r+a,s=c*r+n;o.push([i,s])}const e=(l+Math.floor(d-1)*t)/2,r=u*e+a,i=c*e+n;o.push([r,i])}o.push([i,s])}}return function(e){return"polygon"===e.type}(e)?new s.A({rings:r,spatialReference:e.spatialReference}):new l.A({paths:r,spatialReference:e.spatialReference})}(e,1e6);e=(0,m.ci)(t,!0)}return o&&(e=(0,u.kS)(e,o)),e}function S(e,t,o){if(Array.isArray(e)){const r=e[0];if(r>t){const o=(0,u.kd)(r,t);e[0]=r+o*(-2*t)}else if(r<o){const t=(0,u.kd)(r,o);e[0]=r+t*(-2*o)}}else{const r=e.x;if(r>t){const o=(0,u.kd)(r,t);e=e.clone().offset(o*(-2*t),0)}else if(r<o){const t=(0,u.kd)(r,o);e=e.clone().offset(t*(-2*o),0)}}return e}function T(e,t){let o=-1;for(let r=0;r<t.cutIndexes.length;r++){const a=t.cutIndexes[r],n=t.geometries[r],i=(0,u.r8)(n);for(let e=0;e<i.length;e++){const t=i[e];t.some(o=>{if(o[0]<180)return!0;{let o=0;for(let e=0;e<t.length;e++){const r=t[e][0];o=r>o?r:o}o=Number(o.toFixed(9));const r=-360*(0,u.kd)(o,180);for(let o=0;o<t.length;o++){const t=n.getPoint(e,o);n.setPoint(e,o,t.clone().offset(r,0))}return!0}})}if(a===o){if(w(e))for(const t of(0,u.r8)(n))e[a]=e[a].addRing(t);else if(y(e))for(const t of(0,u.r8)(n))e[a]=e[a].addPath(t)}else o=a,e[a]=n}return e}async function C(e,t,o){if(!Array.isArray(e))return C([e],t);t&&"string"!=typeof t&&b().warn("normalizeCentralMeridian()","The url object is deprecated, use the url string instead");const a="string"==typeof t?t:t?.url??r.A.geometryServiceUrl;let n,i,c,w,y,I,_,z,P=0;const F=[],O=[];for(const t of e)if(null!=t)if(n||(n=t.spatialReference,i=(0,d.Vp)(n),c=n.isWebMercator,I=c?102100:4326,w=u.j7[I].maxX,y=u.j7[I].minX,_=u.j7[I].plus180Line,z=u.j7[I].minus180Line),i)if("mesh"===t.type)O.push(t);else if("point"===t.type)O.push(S(t.clone(),w,y));else if("multipoint"===t.type){const e=t.clone();e.points=e.points.map(e=>S(e,w,y)),O.push(e)}else if("extent"===t.type){const e=t.clone()._normalize(!1,!1,i);O.push(e.rings?new s.A(e):e)}else if(t.extent){const e=t.extent,o=(0,u.kd)(e.xmin,y)*(2*w);let r=0===o?t.clone():(0,u.kS)(t.clone(),o);e.offset(o,0);let{xmin:a,xmax:n}=e;a=Number(a.toFixed(9)),n=Number(n.toFixed(9)),e.intersects(_)&&n!==w?(P=n>P?n:P,r=M(r,c),F.push(r),O.push("cut")):e.intersects(z)&&a!==y?(P=n*(2*w)>P?n*(2*w):P,r=M(r,c,360),F.push(r),O.push("cut")):O.push(r)}else O.push(t.clone());else O.push(t);else O.push(t);let D=(0,u.kd)(P,w),H=-90;const j=D,B=new l.A;for(;D>0;){const e=360*D-180;B.addPath([[e,H],[e,-1*H]]),H*=-1,D--}if(F.length>0&&j>0){const t=T(F,await async function(e,t,o,r){const a=(0,v.Dl)(e),n=t[0].spatialReference,i={...r,responseType:"json",query:{...a.query,f:"json",sr:(0,d.YX)(n),target:JSON.stringify({geometryType:(0,f.$B)(t[0]),geometries:t}),cutter:JSON.stringify(o)}},s=await(0,h.A)(a.path+"/cut",i),{cutIndexes:l,geometries:c=[]}=s.data;return{cutIndexes:l,geometries:c.map(e=>{const t=(0,p.rS)(e);return t.spatialReference=n,t})}}(a,F,B,o)),r=[],n=[];for(let o=0;o<O.length;o++){const a=O[o];if("cut"!==a)n.push(a);else{const a=t.shift(),i=e[o];null!=i&&"polygon"===i.type&&i.rings&&i.rings.length>1&&a.rings.length>=i.rings.length?(r.push(a),n.push("simplify")):n.push(c?(0,m.Gh)(a):a)}}if(!r.length)return n;const i=await async function(e,t,o){const r="string"==typeof e?(0,g.An)(e):e,a=t[0].spatialReference,n=(0,f.$B)(t[0]),i={...o,query:{...r.query,f:"json",sr:(0,d.YX)(a),geometries:JSON.stringify((0,x.X)(t))}},{data:s}=await(0,h.A)(r.path+"/simplify",i);return(0,x.V)(s.geometries,n,a)}(a,r,o),s=[];for(let e=0;e<n.length;e++){const t=n[e];"simplify"!==t?s.push(t):s.push(c?(0,m.Gh)(i.shift()):i.shift())}return s}const N=[];for(let e=0;e<O.length;e++){const t=O[e];if("cut"!==t)N.push(t);else{const e=F.shift();N.push(!0===c?(0,m.Gh)(e):e)}}return N}function I(e,t,o){const r=(0,d.Vp)(o);if(null==r)return e;const[a,n]=r.valid,i=2*n;let s=0,l=0;t>n?s=Math.ceil(Math.abs(t-n)/i):t<a&&(s=-Math.ceil(Math.abs(t-a)/i)),e>n?l=Math.ceil(Math.abs(e-n)/i):e<a&&(l=-Math.ceil(Math.abs(e-a)/i));let c=e+(s-l)*i;const u=c-t;return u>n?c-=i:u<a&&(c+=i),c}function _(e){const t=(0,d.Vp)(e);if(null==t)return null;const[o,r]=t.valid;return new a.hr(o,r)}const z=_(c.A.WGS84);_(c.A.WebMercator)},80754(e,t,o){o.d(t,{j7:()=>i,kS:()=>l,kd:()=>s,r8:()=>c});var r=o(82799),a=o(16930),n=o(60408);const i={102100:{maxX:20037508.342788905,minX:-20037508.342788905,plus180Line:new r.A({paths:[[[20037508.342788905,-20037508.342788905],[20037508.342788905,20037508.342788905]]],spatialReference:a.A.WebMercator}),minus180Line:new r.A({paths:[[[-20037508.342788905,-20037508.342788905],[-20037508.342788905,20037508.342788905]]],spatialReference:a.A.WebMercator})},4326:{maxX:180,minX:-180,plus180Line:new r.A({paths:[[[180,-180],[180,180]]],spatialReference:a.A.WGS84}),minus180Line:new r.A({paths:[[[-180,-180],[-180,180]]],spatialReference:a.A.WGS84})}};function s(e,t){return Math.ceil((e-t)/(2*t))}function l(e,t){const o=c(e);for(const e of o)for(const o of e)o[0]+=t;return e}function c(e){return(0,n.Bi)(e)?e.rings:e.paths}},27921(e,t,o){o.d(t,{$Q:()=>w,C:()=>s,Cr:()=>u,O_:()=>c,Qj:()=>l,T7:()=>x,Tj:()=>b,lU:()=>d,mN:()=>y,vE:()=>M,vt:()=>i});var r=o(34727),a=o(35522),n=o(51850);function i(e=S){return[e[0],e[1],e[2],e[3]]}function s(e,t){return function(e,t,o,r,a=i()){return a[0]=e,a[1]=t,a[2]=o,a[3]=r,a}(t[0],t[1],t[2],t[3],e)}function l(e){return e}function c(e,t,o){const r=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],a=Math.abs(r-1)>1e-5&&r>1e-12?1/Math.sqrt(r):1;return o[0]=t[0]*a,o[1]=t[1]*a,o[2]=t[2]*a,o[3]=-(o[0]*e[0]+o[1]*e[1]+o[2]*e[2]),o}function u(e,t,o,r=i()){const a=o[0]-t[0],n=o[1]-t[1],s=o[2]-t[2],l=e[0]-t[0],c=e[1]-t[1],u=e[2]-t[2],d=n*u-s*c,m=s*l-a*u,h=a*c-n*l,f=d*d+m*m+h*h,p=Math.abs(f-1)>1e-5&&f>1e-12?1/Math.sqrt(f):1;return r[0]=d*p,r[1]=m*p,r[2]=h*p,r[3]=-(r[0]*e[0]+r[1]*e[1]+r[2]*e[2]),r}function d(e,t,o,r=0,n=Math.floor(o*(1/3)),i=Math.floor(o*(2/3))){if(o<3)return!1;t(h,r);let s=n,l=!1;for(;s<o-1&&!l;)t(f,s),s++,l=!(0,a.t2)(h,f);if(!l)return!1;for(s=Math.max(s,i),l=!1;s<o&&!l;)t(p,s),s++,(0,a.Re)(v,h,f),(0,a.S8)(v,v),(0,a.Re)(g,f,p),(0,a.S8)(g,g),l=!(0,a.t2)(h,p)&&!(0,a.t2)(f,p)&&Math.abs((0,a.Om)(v,g))<m;return l?(u(h,f,p,e),!0):(0!==r||1!==n||2!==i)&&d(e,t,o,0,1,2)}o(78955),o(44280),o(32114),o(32728);const m=.99619469809,h=(0,n.vt)(),f=(0,n.vt)(),p=(0,n.vt)(),v=(0,n.vt)(),g=(0,n.vt)();function x(e,t,o){return function(e){return 0===e||1===e}(M(e,t.origin,t.vector,0,o))}function b(e,t){return y(e,t)>=0}function w(e,t){const o=(0,a.Om)(e,t.ray.direction),r=-y(e,t.ray.origin);if(r<0&&o>=0)return!1;if(o>-1e-6&&o<1e-6)return r>0;if((r<0||o<0)&&!(r<0&&o<0))return!0;const n=r/o;return o>0?n<t.c1&&(t.c1=n):n>t.c0&&(t.c0=n),t.c0<=t.c1}function y(e,t){return(0,a.Om)(e,t)+e[3]}function M(e,t,o,n,i){const s=(0,a.Om)(e,o),l=y(e,t);if(0===s)return l>=0?2:3;let c=-l/s;return 1&n&&(c=(0,r.qE)(c,0,1)),!(4&n)&&c<0||!(8&n)&&c>1?l>=0?2:3:((0,a.WQ)(i,t,(0,a.hs)(i,o,c)),l>=0?0:1)}const S=[0,0,1,0]},44280(e,t,o){o.d(t,{g7:()=>s,gr:()=>i});var r=o(34727),a=o(35522),n=o(51850);function i(e,t){return(0,a.Om)(e,t)/(0,a.Bw)(e)}function s(e,t){const o=(0,a.Om)(e,t)/((0,a.Bw)(e)*(0,a.Bw)(t));return-(0,r.XM)(o)}(0,n.vt)(),(0,n.vt)()},32114(e,t,o){o.d(t,{Rc:()=>h,J8:()=>f,rq:()=>d,Km:()=>m}),o(44208);var r=o(26390),a=o(29242),n=o(9093),i=o(82534),s=o(48163),l=o(51850),c=o(91829);class u{constructor(e){this._create=e,this._items=new Array,this._itemsPtr=0}get(){return 0===this._itemsPtr&&(0,r.d)(()=>this._reset()),this._itemsPtr>=this._items.length&&this._items.push(this._create()),this._items[this._itemsPtr++]}_reset(){const e=2*this._itemsPtr;this._items.length>e&&(this._items.length=e),this._itemsPtr=0}static createVec2f64(){return new u(s.vt)}static createVec3f64(){return new u(l.vt)}static createVec4f64(){return new u(c.vt)}static createMat3f64(){return new u(a.vt)}static createMat4f64(){return new u(n.vt)}static createQuatf64(){return new u(i.vt)}get test(){}}u.createVec2f64();const d=u.createVec3f64(),m=u.createVec4f64(),h=(u.createMat3f64(),u.createMat4f64()),f=u.createQuatf64()},38969(e,t,o){o.d(t,{i:()=>a});var r=o(37955);function a(e,t){return new Promise((o,a)=>{e.readyState>=HTMLMediaElement.HAVE_CURRENT_DATA?o():(t((0,r.Oo)(e,"canplay",o)),t((0,r.Oo)(e,"error",a)))})}},92300(e,t,o){o.d(t,{V:()=>i,X:()=>n});var r=o(60408),a=o(65864);function n(e){return{geometryType:(0,r.$B)(e[0]),geometries:e.map(e=>e.toJSON())}}function i(e,t,o){const r=(0,a.xD)(t);return e.map(e=>{const t=r.fromJSON(e);return t.spatialReference=o,t})}},21015(e,t,o){o.d(t,{R:()=>l});var r=o(11254),a=o(60999),n=o(49186),i=o(17676),s=o(84952);class l{constructor(e=e=>e){this._resolveURI=e}async loadJSON(e,t){return this._load("json",e,t)}async loadBinary(e,t){return(0,s.DB)(e)?((0,i.Te)(t),(0,s.lJ)(e)):this._load("array-buffer",e,t)}async loadImage(e,t){return this._load("image",e,t)}async _load(e,t,o){t=this._resolveURI(t);const s=await(0,a.Ke)((0,r.A)(t,{responseType:e,...o}));if(s.ok)return s.value.data;throw(0,i.QP)(s.error),new n.A("gltf-loader-request-error",`Request for resource failed: ${s.error}`)}}},84498(e,t,o){o.d(t,{x:()=>i});var r=o(34275),a=o(97146),n=o(63907);function i(e,t){switch(t){case n.WR.TRIANGLES:return function(e){return"number"==typeof e?(0,a.tM)(e):(0,r.mg)(e)?new Uint16Array(e):e}(e);case n.WR.TRIANGLE_STRIP:return function(e){const t="number"==typeof e?e:e.length;if(t<3)return[];const o=t-2,r=(0,a.my)(3*o);if("number"==typeof e){let e=0;for(let t=0;t<o;t+=1)t%2==0?(r[e++]=t,r[e++]=t+1,r[e++]=t+2):(r[e++]=t+1,r[e++]=t,r[e++]=t+2)}else{let t=0;for(let a=0;a<o;a+=1)a%2==0?(r[t++]=e[a],r[t++]=e[a+1],r[t++]=e[a+2]):(r[t++]=e[a+1],r[t++]=e[a],r[t++]=e[a+2])}return r}(e);case n.WR.TRIANGLE_FAN:return function(e){const t="number"==typeof e?e:e.length;if(t<3)return new Uint16Array(0);const o=t-2,r=o<=65536?new Uint16Array(3*o):new Uint32Array(3*o);if("number"==typeof e){let e=0;for(let t=0;t<o;++t)r[e++]=0,r[e++]=t+1,r[e++]=t+2;return r}const a=e[0];let n=e[1],i=0;for(let t=0;t<o;++t){const o=e[t+2];r[i++]=a,r[i++]=n,r[i++]=o,n=o}return r}(e)}}},51530(e,t,o){o.d(t,{KB:()=>i,Xi:()=>a,pn:()=>s,x3:()=>n});var r=o(44208);class a{constructor(e){this.data=e,this.type="encoded-mesh-texture",this.encoding="image/ktx2"}}function n(e){return"encoded-mesh-texture"===e?.type}async function i(e){const t=new Blob([e]),o=await t.text();return JSON.parse(o)}async function s(e,t){if("image/ktx2"===t)return new a(e);const o=new Blob([e],{type:t});let n=URL.createObjectURL(o);switch(t){case"image/jpeg":n+="#.jpg";break;case"image/png":n+="#.png"}const i=new Image;if((0,r.A)("esri-iPhone"))return new Promise((e,t)=>{const o=()=>{a(),e(i)},r=e=>{a(),t(e)},a=()=>{URL.revokeObjectURL(n),i.removeEventListener("load",o),i.removeEventListener("error",r)};i.addEventListener("load",o),i.addEventListener("error",r),i.src=n});try{i.src=n,await i.decode()}catch(e){console.warn("Failed decoding HTMLImageElement")}return URL.revokeObjectURL(n),i}},5644(e,t,o){o.d(t,{fetch:()=>wt});var r=o(40876),a=o(61473),n=o(34727),i=o(77690),s=o(29242),l=o(58083),c=o(9093),u=o(48163),d=o(35522),m=o(51850),h=o(70328),f=o(34275);function p(e,t=!1){return e<=f.y9?t?new Array(e).fill(0):new Array(e):new Float32Array(e)}var v=o(13030),g=o(73354),x=o(50867),b=o(43609),w=o(21015),y=o(84498),M=o(51530),S=o(88340);function T(e){if(null==e)return null;const t=null!=e.offset?e.offset:S.uY,o=null!=e.rotation?e.rotation:0,r=null!=e.scale?e.scale:S.Un,a=(0,s.fA)(1,0,0,0,1,0,t[0],t[1],1),n=(0,s.fA)(Math.cos(o),-Math.sin(o),0,Math.sin(o),Math.cos(o),0,0,0,1),l=(0,s.fA)(r[0],0,0,0,r[1],0,0,0,1),c=(0,s.vt)();return(0,i.lw)(c,n,l),(0,i.lw)(c,a,c),c}class C{constructor(){this.geometries=new Array,this.materials=new Array,this.textures=new Array}}class I{constructor(e,t,o){this.name=e,this.lodThreshold=t,this.pivotOffset=o,this.stageResources=new C,this.numberOfVertices=0}}var _=o(11254),z=o(60999),P=o(49186),F=o(53966),O=o(69397);class D{constructor(){this._outer=new Map}clear(){this._outer.clear()}get empty(){return 0===this._outer.size}get outerSize(){return this._outer.size}get size(){let e=0;for(const t of this._outer.values())e+=t.size;return e}get(e,t){return this._outer.get(e)?.get(t)}getInner(e){return this._outer.get(e)}set(e,t,o){const r=this._outer.get(e);r?r.set(t,o):this._outer.set(e,new Map([[t,o]]))}delete(e,t){const o=this._outer.get(e);o&&(o.delete(t),0===o.size&&this._outer.delete(e))}pop(e,t){const o=this.get(e,t);return this.delete(e,t),o}*outerMap(){for(const e of this._outer)yield e}*values(){for(const e of this._outer.values())yield*e.values()}*[Symbol.iterator](){for(const[e,t]of this._outer)for(const[o,r]of t)yield[e,o,r]}forEach(e){this._outer.forEach((t,o)=>e(t,o))}forAll(e){this._outer.forEach((t,o)=>t.forEach((t,r)=>e(t,o,r)))}copy(){const e=new D;return this.forAll((t,o,r)=>e.set(o,r,t)),e}}var H=o(17676),j=o(46140),B=o(97146),N=o(31217),R=o(46610),E=o(63500),G=o(18845),A=o(49255),W=o(97768),L=o(92130),V=o(65786);class U extends L.A{constructor(e){super(e),this._numLoading=0,this._disposed=!1,this._textures=e.textures,this.updateTexture(e.textureId),this._acquire(e.normalTextureId,e=>this._textureNormal=e),this._acquire(e.emissiveTextureId,e=>this._textureEmissive=e),this._acquire(e.occlusionTextureId,e=>this._textureOcclusion=e),this._acquire(e.metallicRoughnessTextureId,e=>this._textureMetallicRoughness=e)}dispose(){super.dispose(),this._texture=(0,W.Gz)(this._texture),this._textureNormal=(0,W.Gz)(this._textureNormal),this._textureEmissive=(0,W.Gz)(this._textureEmissive),this._textureOcclusion=(0,W.Gz)(this._textureOcclusion),this._textureMetallicRoughness=(0,W.Gz)(this._textureMetallicRoughness),this._disposed=!0}ensureResources(e){return 0===this._numLoading?2:1}get textureBindParameters(){return new q(this._texture?.texture??null,this._textureNormal?.texture??null,this._textureEmissive?.texture??null,this._textureOcclusion?.texture??null,this._textureMetallicRoughness?.texture??null)}updateTexture(e){null!=this._texture&&e===this._texture.id||(this._texture=(0,W.Gz)(this._texture),this._acquire(e,e=>this._texture=e))}_acquire(e,t){if(null==e)return void t(null);const o=this._textures.acquire(e);if((0,H.$X)(o))return++this._numLoading,void o.then(e=>{if(this._disposed)return(0,W.Gz)(e),void t(null);t(e)}).finally(()=>--this._numLoading);t(o)}}class k extends V.Y{constructor(e=null){super(),this.textureEmissive=e}}class q extends k{constructor(e,t,o,r,a,n,i){super(o),this.texture=e,this.textureNormal=t,this.textureOcclusion=r,this.textureMetallicRoughness=a,this.scale=n,this.normalTextureTransformMatrix=i}}var $=o(11725),Z=o(620);class Y{constructor(e=0,t=!1,o=!0){this.tolerance=e,this.isVerticalRay=t,this.normalRequired=o}}const J=(0,h.vt)();function K(e,t,o,r,a,n){if(!e.visible)return;const i=(0,d.jb)(ue,r,o),{tolerance:s}=t,l=new Y(s,!1,t.options.normalRequired);if(e.boundingInfo)(0,Z.vA)(0===e.type),Q(e.boundingInfo,o,i,s,a,l,n);else{const t=e.positionAttribute,r=e.primitivePositionIndices;!function(e,t,o,r,a,n,i,s,l,c){const u=t,m=de,h=Math.abs(u[0]),f=Math.abs(u[1]),p=Math.abs(u[2]),v=h>=f?h>=p?0:2:f>=p?1:2,g=v,x=u[g]<0?2:1,b=(v+x)%3,w=(v+(3-x))%3,y=u[b]/u[g],M=u[w]/u[g],S=1/u[g],T=te,C=oe,I=re,{normalRequired:_}=l;for(let t=o;t<r;++t){const o=3*t,r=i*a[o];(0,d.hZ)(m[0],n[r+0],n[r+1],n[r+2]);const l=i*a[o+1];(0,d.hZ)(m[1],n[l+0],n[l+1],n[l+2]);const u=i*a[o+2];(0,d.hZ)(m[2],n[u+0],n[u+1],n[u+2]),s&&((0,d.C)(m[0],s.applyToVertex(m[0][0],m[0][1],m[0][2],t)),(0,d.C)(m[1],s.applyToVertex(m[1][0],m[1][1],m[1][2],t)),(0,d.C)(m[2],s.applyToVertex(m[2][0],m[2][1],m[2][2],t))),(0,d.jb)(T,m[0],e),(0,d.jb)(C,m[1],e),(0,d.jb)(I,m[2],e);const h=T[b]-y*T[g],f=T[w]-M*T[g],p=C[b]-y*C[g],v=C[w]-M*C[g],x=I[b]-y*I[g],z=I[w]-M*I[g],P=x*v-z*p,F=h*z-f*x,O=p*f-v*h;if((P<0||F<0||O<0)&&(P>0||F>0||O>0))continue;const D=P+F+O;if(0===D)continue;const H=P*(S*T[g])+F*(S*C[g])+O*(S*I[g]);if(H*Math.sign(D)<0)continue;const j=H/D;j>=0&&c(j,_?ne(m):null,t)}}(o,i,0,r.length/3,r,t.data,t.stride,a,l,n)}}const X=(0,m.vt)();function Q(e,t,o,r,a,n,i){if(null==e)return;const s=function(e,t){return(0,d.hZ)(t,1/e[0],1/e[1],1/e[2])}(o,X);if((0,h.Ne)(J,e.bbMin),(0,h.vI)(J,e.bbMax),null!=a&&a.applyToAabb(J),function(e,t,o,r){return function(e,t,o,r){const a=(e[0]-r-t[0])*o[0],n=(e[3]+r-t[0])*o[0];let i=Math.min(a,n),s=Math.max(a,n);const l=(e[1]-r-t[1])*o[1],c=(e[4]+r-t[1])*o[1];if(s=Math.min(s,Math.max(l,c)),s<0)return!1;if(i=Math.max(i,Math.min(l,c)),i>s)return!1;const u=(e[2]-r-t[2])*o[2],d=(e[5]+r-t[2])*o[2];return s=Math.min(s,Math.max(u,d)),!(s<0)&&(i=Math.max(i,Math.min(u,d)),!(i>s)&&i<1/0)}(e,t,o,r)}(J,t,s,r)){const{primitiveIndices:s,position:l}=e,c=s?s.length:l.indices.length/3;if(c>le){const s=e.getChildren();if(void 0!==s){for(const e of s)Q(e,t,o,r,a,n,i);return}}!function(e,t,o,r,a,n,i,s,l,c,u){const d=e[0],m=e[1],h=e[2],f=t[0],p=t[1],v=t[2],{normalRequired:g}=c;for(let e=0;e<r;++e){const t=s[e],o=3*t,r=i*a[o];let c=n[r],x=n[r+1],b=n[r+2];const w=i*a[o+1];let y=n[w],M=n[w+1],S=n[w+2];const T=i*a[o+2];let C=n[T],I=n[T+1],_=n[T+2];null!=l&&([c,x,b]=l.applyToVertex(c,x,b,e),[y,M,S]=l.applyToVertex(y,M,S,e),[C,I,_]=l.applyToVertex(C,I,_,e));const z=y-c,P=M-x,F=S-b,O=C-c,D=I-x,H=_-b,j=p*H-D*v,B=v*O-H*f,N=f*D-O*p,R=z*j+P*B+F*N;if(Math.abs(R)<=ce)continue;const E=d-c,G=m-x,A=h-b,W=E*j+G*B+A*N;if(R>0){if(W<0||W>R)continue}else if(W>0||W<R)continue;const L=G*F-P*A,V=A*z-F*E,U=E*P-z*G,k=f*L+p*V+v*U;if(R>0){if(k<0||W+k>R)continue}else if(k>0||W+k<R)continue;const q=(O*L+D*V+H*U)/R;q>=0&&u(q,g?ae(z,P,F,O,D,H,ee):null,t)}}(t,o,0,c,l.indices,l.data,l.stride,s,a,n,i)}}const ee=(0,m.vt)();const te=(0,m.vt)(),oe=(0,m.vt)(),re=(0,m.vt)();function ae(e,t,o,r,a,n,i){return(0,d.hZ)(ie,e,t,o),(0,d.hZ)(se,r,a,n),(0,d.$A)(i,ie,se),(0,d.S8)(i,i),i}function ne(e){return(0,d.jb)(ie,e[1],e[0]),(0,d.jb)(se,e[2],e[0]),(0,d.$A)(ee,ie,se),(0,d.S8)(ee,ee),ee}const ie=(0,m.vt)(),se=(0,m.vt)(),le=1e3,ce=1e-7,ue=(0,m.vt)(),de=[(0,m.vt)(),(0,m.vt)(),(0,m.vt)()];var me=o(16396),he=o(59907);class fe{constructor(e){this.layout=e}elementCount(e){return e.get("position").indices.length}write(e,t,o,r,a,n){return(0,he.vJ)(o,r,this.layout,e,t,a,n)}}var pe=o(33442),ve=o(43616),ge=o(5482),xe=o(91429),be=o(91829),we=o(4431),ye=o(1843),Me=o(72824),Se=o(13840),Te=o(98958),Ce=o(16943),Ie=o(33524),_e=o(56133),ze=o(4576);o(66289);var Pe=o(69622),Fe=o(65529),Oe=o(32728);class De{constructor(e){this.localTransform=e.localTransform,this.globalTransform=e.globalTransform,this.modelOrigin=e.modelOrigin,this.model=e.instanceModel,this.modelNormal=e.instanceModelNormal,this.modelScaleFactors=e.modelScaleFactors,this.boundingSphere=e.boundingSphere,this.featureAttribute=e.getField("instanceFeatureAttribute",v.Eq),this.color=e.getField("instanceColor",v.XP),this.olidColor=e.getField("instanceOlidColor",v.XP),this.state=e.getField("state",v.SL),this.lodLevel=e.getField("lodLevel",v.SL)}}let He=class extends Pe.A{constructor(e,t){super(e),this.events=new Fe.bk,this._capacity=0,this._size=0,this._next=0,this._highlightOptionsMap=new Map,this._highlightOptionsMapPrev=new Map,this._layout=function(e){return Be(je.clone(),e).u8("state").u8("lodLevel")}(t),this._capacity=Ae,this._buffer=this._layout.createBuffer(this._capacity),this._view=new De(this._buffer)}get capacity(){return this._capacity}get size(){return this._size}get view(){return this._view}addInstance(){this._size+1>this._capacity&&this._grow();const e=this._findSlot();return this._view.state.set(e,1),this._size++,this.events.emit("instances-changed"),e}removeInstance(e){const t=this._view.state;(0,Z.vA)(e>=0&&e<this._capacity&&!!(1&t.get(e)),"invalid instance handle"),this._getStateFlag(e,18)?this._setStateFlags(e,32):this.freeInstance(e),this.events.emit("instances-changed")}freeInstance(e){const t=this._view.state;(0,Z.vA)(e>=0&&e<this._capacity&&!!(1&t.get(e)),"invalid instance handle"),t.set(e,0),this._size--}setLocalTransform(e,t,o=!0){this._view.localTransform.setMat(e,t),o&&this.updateModelTransform(e)}getLocalTransform(e,t){this._view.localTransform.getMat(e,t)}setGlobalTransform(e,t,o=!0){this._view.globalTransform.setMat(e,t),o&&this.updateModelTransform(e)}getGlobalTransform(e,t){this._view.globalTransform.getMat(e,t)}updateModelTransform(e){const t=this._view,o=Ne,r=Re;t.localTransform.getMat(e,Ee),t.globalTransform.getMat(e,Ge);const a=(0,l.lw)(Ge,Ge,Ee);(0,d.hZ)(o,a[12],a[13],a[14]),t.modelOrigin.setVec(e,o),(0,i.z0)(r,a),t.model.setMat(e,r);const n=(0,Oe.wp)(Ne,a);n.sort(),t.modelScaleFactors.set(e,0,n[1]),t.modelScaleFactors.set(e,1,n[2]),(0,i.B8)(r,r),(0,i.mg)(r,r),t.modelNormal.setMat(e,r),this._setStateFlags(e,64),this.events.emit("instance-transform-changed",{index:e})}getModelTransform(e,t){const o=this._view;o.model.getMat(e,Re),o.modelOrigin.getVec(e,Ne),t[0]=Re[0],t[1]=Re[1],t[2]=Re[2],t[3]=0,t[4]=Re[3],t[5]=Re[4],t[6]=Re[5],t[7]=0,t[8]=Re[6],t[9]=Re[7],t[10]=Re[8],t[11]=0,t[12]=Ne[0],t[13]=Ne[1],t[14]=Ne[2],t[15]=1}applyShaderTransformation(e,t){null!=this.shaderTransformation&&this.shaderTransformation.applyTransform(this,e,t)}getCombinedModelTransform(e,t){return this.getModelTransform(e,t),null!=this.shaderTransformation&&this.shaderTransformation.applyTransform(this,e,t),t}getCombinedLocalTransform(e,t){this._view.localTransform.getMat(e,t),null!=this.shaderTransformation&&this.shaderTransformation.applyTransform(this,e,t)}getCombinedMaxScaleFactor(e){let t=this._view.modelScaleFactors.get(e,1);return null!=this.shaderTransformation&&(this.shaderTransformation.scaleFactor(Ne,this,e),t*=Math.max(Ne[0],Ne[1],Ne[2])),t}getCombinedMedianScaleFactor(e){let t=this._view.modelScaleFactors.get(e,0);return null!=this.shaderTransformation&&(this.shaderTransformation.scaleFactor(Ne,this,e),t*=function(e,t,o){return Math.max(Math.min(e,t),Math.min(Math.max(e,t),o))}(Ne[0],Ne[1],Ne[2])),t}getModel(e,t){this._view.model.getMat(e,t)}setFeatureAttribute(e,t){this._view.featureAttribute?.setVec(e,t)}getFeatureAttribute(e,t){this._view.featureAttribute?.getVec(e,t)}setColor(e,t){this._view.color?.setVec(e,t)}setObjectAndLayerIdColor(e,t){this._view.olidColor?.setVec(e,t)}setVisible(e,t){t!==this.getVisible(e)&&(this._setStateFlag(e,4,t),this.events.emit("instance-visibility-changed",{index:e}))}getVisible(e){return this._getStateFlag(e,4)}setHighlight(e,t){const{_highlightOptionsMap:o}=this,r=o.get(e);t?t!==r&&(o.set(e,t),this._setStateFlag(e,8,!0),this.events.emit("instance-highlight-changed")):r&&(o.delete(e),this._setStateFlag(e,8,!1),this.events.emit("instance-highlight-changed"))}get highlightOptionsMap(){return this._highlightOptionsMap}getHighlightStateFlag(e){return this._getStateFlag(e,8)}geHighlightOptionsPrev(e){const t=this._highlightOptionsMapPrev.get(e)??null;return this._highlightOptionsMapPrev.delete(e),t}getHighlightName(e){const t=this.highlightOptionsMap.get(e)??null;return t?this._highlightOptionsMapPrev.set(e,t):this._highlightOptionsMapPrev.delete(e),t}getState(e){return this._view.state.get(e)}getLodLevel(e){return this._view.lodLevel.get(e)}countFlags(e){let t=0;for(let o=0;o<this._capacity;++o)this.getState(o)&e&&++t;return t}_setStateFlags(e,t){const o=this._view.state;t=o.get(e)|t,o.set(e,t)}_clearStateFlags(e,t){const o=this._view.state;t=o.get(e)&~t,o.set(e,t)}_setStateFlag(e,t,o){o?this._setStateFlags(e,t):this._clearStateFlags(e,t)}_getStateFlag(e,t){return!!(this._view.state.get(e)&t)}_grow(){this._capacity=Math.max(Ae,Math.floor(this._capacity*ze.Ji)),this._buffer=this._layout.createBuffer(this._capacity).copyFrom(this._buffer),this._view=new De(this._buffer)}_findSlot(){const e=this._view.state;let t=this._next;for(;1&e.get(t);)t=t+1===this._capacity?0:t+1;return this._next=t+1===this._capacity?0:t+1,t}};(0,ge.Cg)([(0,xe.MZ)({constructOnly:!0})],He.prototype,"shaderTransformation",void 0),(0,ge.Cg)([(0,xe.MZ)()],He.prototype,"_size",void 0),(0,ge.Cg)([(0,xe.MZ)({readOnly:!0})],He.prototype,"size",null),He=(0,ge.Cg)([(0,xe.$K)("esri.views.3d.webgl-engine.lib.lodRendering.InstanceData")],He);const je=(0,ye.BP)().mat4f64("localTransform").mat4f64("globalTransform").vec4f64("boundingSphere").vec3f64("modelOrigin").mat3f("instanceModel").mat3f("instanceModelNormal").vec2f("modelScaleFactors");function Be(e,t){return t.instancedFeatureAttribute&&e.vec4f("instanceFeatureAttribute"),t.instancedColor&&e.vec4u8("instanceColor"),(0,Ce.E)()&&e.vec4u8("instanceOlidColor"),e}const Ne=(0,m.vt)(),Re=(0,s.vt)(),Ee=(0,c.vt)(),Ge=(0,c.vt)(),Ae=64,We=(0,ye.BP)().vec3f("instanceModelOriginHi").vec3f("instanceModelOriginLo").mat3f("instanceModel").mat3f("instanceModelNormal");var Le=o(74810),Ve=o(28491),Ue=o(90644),ke=o(49788);class qe extends Me.Zo{constructor(){super(...arguments),this.isSchematic=!1,this.usePBR=!1,this.mrrFactors=Le.mb,this.hasVertexColors=!1,this.hasSymbolColors=!1,this.doubleSided=!1,this.doubleSidedType="normal",this.cullFace=2,this.instanced=!1,this.instancedFeatureAttribute=!1,this.instancedColor=!1,this.instanceColorEncodesAlphaIgnore=!1,this.emissiveStrengthFromSymbol=0,this.emissiveStrengthKHR=1,this.emissiveSource=1,this.emissiveBaseColor=m.uY,this.instancedDoublePrecision=!1,this.normalType=0,this.receiveShadows=!0,this.receiveAmbientOcclusion=!0,this.castShadows=!0,this.ambient=(0,m.CN)(.2,.2,.2),this.diffuse=(0,m.CN)(.8,.8,.8),this.externalColor=(0,be.fA)(1,1,1,1),this.colorMixMode="multiply",this.opacity=1,this.layerOpacity=1,this.origin=(0,m.vt)(),this.hasSlicePlane=!1,this.offsetTransparentBackfaces=!1,this.vvSize=null,this.vvColor=null,this.vvOpacity=null,this.modelTransformation=null,this.drivenOpacity=!1,this.writeDepth=!0,this.customDepthTest=0,this.textureAlphaMode=0,this.textureAlphaCutoff=ke.Q,this.textureAlphaPremultiplied=!1,this.renderOccluded=1,this.testsTransparentRenderOrder=0,this.isDecoration=!1}get hasVVSize(){return!!this.vvSize}get hasVVColor(){return!!this.vvColor}get hasVVOpacity(){return!!this.vvOpacity}}Me.gy;let $e=class extends Te.w{constructor(e,t){let r=(0,we.U)(Je(t));t.instanced&&t.instancedDoublePrecision&&(r=r.concat((0,we.U)(function(e){return Be(We.clone(),e)}(t)))),super(e,t,r),this.shader=new Se.r(Ve.D,()=>o.e(5141).then(o.bind(o,5141))),this.ignoreUnused=!0}_makePipeline(e,t){const{output:o,transparent:r,cullFace:a,customDepthTest:n,hasOccludees:i}=e;return(0,Ue.Ey)({blending:r?(0,Ie.Yf)(o):null,culling:Ye(e)?(0,Ue.Xt)(a):null,depthTest:(0,Ie.mt)(o,Ze(n)),depthWrite:(0,Ie.z5)(e),colorWrite:Ue.kn,stencilWrite:i?_e.v0:null,stencilTest:i?t?_e.a9:_e.qh:null,polygonOffset:(0,pe.sG)(e)})}initializePipeline(e){return this._occludeePipelineState=this._makePipeline(e,!0),this._makePipeline(e,!1)}getPipeline(e,t){return t?this._occludeePipelineState:super.getPipeline(e)}};function Ze(e){switch(e){case 1:return 515;case 0:case 3:return 513;case 2:return 516}}function Ye(e){return 0!==e.cullFace||!e.hasSlicePlane&&!e.transparent&&!e.doubleSidedMode}function Je(e){const t=(0,ye.BP)().vec3f("position");return 1===e.normalType?t.vec2i16("normalCompressed",{glNormalized:!0}):t.vec3f("normal"),e.hasVertexTangents&&t.vec4f("tangent"),e.hasTextures&&t.vec2f16("uv0"),e.hasVertexColors&&t.vec4u8("color",{glNormalized:!0}),e.hasSymbolColors&&t.vec4u8("symbolColor"),!e.instanced&&(0,Ce.E)()&&t.vec4u8("olidColor"),t}$e=(0,ge.Cg)([(0,xe.$K)("esri.views.3d.webgl-engine.shaders.DefaultMaterialTechnique")],$e);var Ke=o(51976),Xe=o(47724);class Qe extends Xe.L{constructor(e){super(),this.spherical=e,this.alphaDiscardMode=1,this.doubleSidedMode=0,this.pbrMode=0,this.cullFace=0,this.normalType=0,this.customDepthTest=0,this.emissionSource=0,this.hasVertexColors=!1,this.hasSymbolColors=!1,this.hasVerticalOffset=!1,this.hasColorTexture=!1,this.hasMetallicRoughnessTexture=!1,this.hasOcclusionTexture=!1,this.hasNormalTexture=!1,this.hasScreenSizePerspective=!1,this.hasVertexTangents=!1,this.hasOccludees=!1,this.instanced=!1,this.instancedDoublePrecision=!1,this.hasModelTransformation=!1,this.offsetBackfaces=!1,this.hasVVSize=!1,this.hasVVColor=!1,this.receiveShadows=!1,this.hasShadowHighlights=!1,this.receiveAmbientOcclusion=!1,this.receiveGlobalIllumination=!1,this.textureAlphaPremultiplied=!1,this.instancedFeatureAttribute=!1,this.instancedColor=!1,this.writeDepth=!0,this.snowCover=!1,this.hasColorTextureTransform=!1,this.hasEmissionTextureTransform=!1,this.hasNormalTextureTransform=!1,this.hasOcclusionTextureTransform=!1,this.hasMetallicRoughnessTextureTransform=!1,this.useCustomDTRExponentForWater=!1,this.useFillLights=!0,this.draped=!1}get textureCoordinateType(){return this.hasTextures?1:0}get hasTextures(){return this.hasColorTexture||this.hasNormalTexture||this.hasMetallicRoughnessTexture||3===this.emissionSource||this.hasOcclusionTexture}get hasVVInstancing(){return this.instanced}get discardInvisibleFragments(){return this.transparent}}(0,ge.Cg)([(0,Ke.W)({count:4})],Qe.prototype,"alphaDiscardMode",void 0),(0,ge.Cg)([(0,Ke.W)({count:3})],Qe.prototype,"doubleSidedMode",void 0),(0,ge.Cg)([(0,Ke.W)({count:7})],Qe.prototype,"pbrMode",void 0),(0,ge.Cg)([(0,Ke.W)({count:3})],Qe.prototype,"cullFace",void 0),(0,ge.Cg)([(0,Ke.W)({count:3})],Qe.prototype,"normalType",void 0),(0,ge.Cg)([(0,Ke.W)({count:3})],Qe.prototype,"customDepthTest",void 0),(0,ge.Cg)([(0,Ke.W)({count:8})],Qe.prototype,"emissionSource",void 0),(0,ge.Cg)([(0,Ke.W)()],Qe.prototype,"hasVertexColors",void 0),(0,ge.Cg)([(0,Ke.W)()],Qe.prototype,"hasSymbolColors",void 0),(0,ge.Cg)([(0,Ke.W)()],Qe.prototype,"hasVerticalOffset",void 0),(0,ge.Cg)([(0,Ke.W)()],Qe.prototype,"hasColorTexture",void 0),(0,ge.Cg)([(0,Ke.W)()],Qe.prototype,"hasMetallicRoughnessTexture",void 0),(0,ge.Cg)([(0,Ke.W)()],Qe.prototype,"hasOcclusionTexture",void 0),(0,ge.Cg)([(0,Ke.W)()],Qe.prototype,"hasNormalTexture",void 0),(0,ge.Cg)([(0,Ke.W)()],Qe.prototype,"hasScreenSizePerspective",void 0),(0,ge.Cg)([(0,Ke.W)()],Qe.prototype,"hasVertexTangents",void 0),(0,ge.Cg)([(0,Ke.W)()],Qe.prototype,"hasOccludees",void 0),(0,ge.Cg)([(0,Ke.W)()],Qe.prototype,"instanced",void 0),(0,ge.Cg)([(0,Ke.W)()],Qe.prototype,"instancedDoublePrecision",void 0),(0,ge.Cg)([(0,Ke.W)()],Qe.prototype,"hasModelTransformation",void 0),(0,ge.Cg)([(0,Ke.W)()],Qe.prototype,"offsetBackfaces",void 0),(0,ge.Cg)([(0,Ke.W)()],Qe.prototype,"hasVVSize",void 0),(0,ge.Cg)([(0,Ke.W)()],Qe.prototype,"hasVVColor",void 0),(0,ge.Cg)([(0,Ke.W)()],Qe.prototype,"receiveShadows",void 0),(0,ge.Cg)([(0,Ke.W)()],Qe.prototype,"hasShadowHighlights",void 0),(0,ge.Cg)([(0,Ke.W)()],Qe.prototype,"receiveAmbientOcclusion",void 0),(0,ge.Cg)([(0,Ke.W)()],Qe.prototype,"receiveGlobalIllumination",void 0),(0,ge.Cg)([(0,Ke.W)()],Qe.prototype,"textureAlphaPremultiplied",void 0),(0,ge.Cg)([(0,Ke.W)()],Qe.prototype,"instancedFeatureAttribute",void 0),(0,ge.Cg)([(0,Ke.W)()],Qe.prototype,"instancedColor",void 0),(0,ge.Cg)([(0,Ke.W)()],Qe.prototype,"writeDepth",void 0),(0,ge.Cg)([(0,Ke.W)()],Qe.prototype,"snowCover",void 0),(0,ge.Cg)([(0,Ke.W)()],Qe.prototype,"hasColorTextureTransform",void 0),(0,ge.Cg)([(0,Ke.W)()],Qe.prototype,"hasEmissionTextureTransform",void 0),(0,ge.Cg)([(0,Ke.W)()],Qe.prototype,"hasNormalTextureTransform",void 0),(0,ge.Cg)([(0,Ke.W)()],Qe.prototype,"hasOcclusionTextureTransform",void 0),(0,ge.Cg)([(0,Ke.W)()],Qe.prototype,"hasMetallicRoughnessTextureTransform",void 0);var et=o(57323);let tt=class extends $e{constructor(){super(...arguments),this.shader=new Se.r(et.R,()=>o.e(2314).then(o.bind(o,39933)))}};tt=(0,ge.Cg)([(0,xe.$K)("esri.views.3d.webgl-engine.shaders.RealisticTreeTechnique")],tt);class ot extends Ke.K{constructor(){super(...arguments),this.receiveShadows=!0}}(0,ge.Cg)([(0,Ke.W)()],ot.prototype,"receiveShadows",void 0);class rt extends $.i{constructor(e,t){super(e,nt),this.materialType="default",this.supportsEdges=!0,this.intersectDraped=void 0,this.produces=new Map([[2,e=>(0,A.uw)(e)&&!this.transparent],[4,e=>(0,A.uw)(e)&&this.transparent&&this.parameters.writeDepth],[8,e=>(0,A.uw)(e)&&this.transparent&&!this.parameters.writeDepth]]),this._layout=Je(this.parameters),this._configuration=new Qe(t.spherical)}isVisibleForOutput(e){return 5!==e&&7!==e&&6!==e||this.parameters.castShadows}get visible(){const{layerOpacity:e,colorMixMode:t,opacity:o,externalColor:r}=this.parameters;return e*("replace"===t?1:o)*("ignore"===t||isNaN(r[3])?1:r[3])>=ke.Q}get _hasEmissiveBase(){return!!this.parameters.emissiveTextureId||!(0,d.t2)(this.parameters.emissiveBaseColor,m.uY)}get hasEmissions(){return this.parameters.emissiveStrength>0&&(0===this.parameters.emissiveSource&&this._hasEmissiveBase||1===this.parameters.emissiveSource)?this.transparent?2:1:0}updateConfiguration(e){super.updateConfiguration(e);const{parameters:t,_configuration:o}=this;o.hasNormalTexture=t.hasNormalTexture,o.hasColorTexture=t.hasColorTexture,o.hasMetallicRoughnessTexture=t.hasMetallicRoughnessTexture,o.hasOcclusionTexture=t.hasOcclusionTexture;const{treeRendering:r,doubleSided:a,doubleSidedType:n}=t;o.hasVertexTangents=!r&&t.hasVertexTangents,o.instanced=t.instanced,o.instancedDoublePrecision=t.instancedDoublePrecision,o.hasVVColor=!!t.vvColor,o.hasVVSize=!!t.vvSize,o.hasVerticalOffset=null!=t.verticalOffset,o.hasScreenSizePerspective=null!=t.screenSizePerspective,o.hasSlicePlane=t.hasSlicePlane,o.alphaDiscardMode=t.textureAlphaMode,o.normalType=r?0:t.normalType,o.transparent=this.transparent,o.enableOITOffset=e.enableOITOffset,o.writeDepth=t.writeDepth,o.customDepthTest=t.customDepthTest??0,o.hasOccludees=e.hasOccludees,o.cullFace=t.hasSlicePlane?0:t.cullFace,o.hasModelTransformation=!r&&null!=t.modelTransformation,o.hasVertexColors=t.hasVertexColors,o.hasSymbolColors=t.hasSymbolColors,o.doubleSidedMode=r?2:a&&"normal"===n?1:a&&"winding-order"===n?2:0,o.instancedFeatureAttribute=t.instancedFeatureAttribute,o.instancedColor=t.instancedColor,(0,A._o)(e.output)?(o.receiveShadows=t.receiveShadows,o.hasShadowHighlights=function(e,t){return e.receiveShadows&&null!=t.shadowHighlight?.getTexture()}(o,e),o.receiveAmbientOcclusion=t.receiveAmbientOcclusion&&null!=e.ssao,o.receiveGlobalIllumination=t.receiveAmbientOcclusion&&e.globalIlluminationEnabled):o.receiveShadows=o.hasShadowHighlights=o.receiveAmbientOcclusion=!1,o.textureAlphaPremultiplied=!!t.textureAlphaPremultiplied,o.pbrMode=t.usePBR?t.isSchematic?2:1:0,o.emissionSource=t.emissionSource,o.offsetBackfaces=!(!this.transparent||!t.offsetTransparentBackfaces),o.snowCover=e.snowCover>0,o.hasColorTextureTransform=!!t.colorTextureTransformMatrix,o.hasNormalTextureTransform=!!t.normalTextureTransformMatrix,o.hasEmissionTextureTransform=!!t.emissiveTextureTransformMatrix,o.hasOcclusionTextureTransform=!!t.occlusionTextureTransformMatrix,o.hasMetallicRoughnessTextureTransform=!!t.metallicRoughnessTextureTransformMatrix}intersect(e,t,o,r,a,n){if(null!=this.parameters.verticalOffset){const e=o.camera;(0,d.hZ)(dt,t[12],t[13],t[14]);let n=null;switch(o.viewingMode){case 1:n=(0,d.S8)(ct,dt);break;case 2:n=(0,d.C)(ct,lt)}const i=(0,d.Re)(mt,dt,e.eye),s=(0,d.Bw)(i),l=(0,d.hs)(i,i,1/s);let c=null;this.parameters.screenSizePerspective&&(c=(0,d.Om)(n,l));const u=(0,ve.kE)(e,s,this.parameters.verticalOffset,c??0,this.parameters.screenSizePerspective,null);(0,d.hs)(n,n,u),(0,d.ei)(ut,n,o.transform.inverseRotation),r=(0,d.Re)(it,r,ut),a=(0,d.Re)(st,a,ut)}n=(0,pe.b6)(n,this._configuration,r,a),K(e,o,r,a,(0,me.ou)(o.verticalOffset),n)}createGLMaterial(e){return new at(e)}createBufferWriter(){return new fe(this._layout)}get transparent(){return function(e){const{drivenOpacity:t,opacity:o,externalColor:r,layerOpacity:a,texture:n,textureId:i,textureAlphaMode:s,colorMixMode:l}=e,c=r[3];return t||o<1&&"replace"!==l||c<1&&"ignore"!==l||a<1||(null!=n||null!=i)&&1!==s&&2!==s&&"replace"!==l}(this.parameters)}}class at extends U{constructor(e){super({...e,...e.material.parameters})}beginSlot(e){this._material.setParameters({receiveShadows:e.shadowMap.enabled});const t=this._material.parameters;this.updateTexture(t.textureId);const o=e.camera.viewInverseTransposeMatrix;return(0,d.hZ)(t.origin,o[3],o[7],o[11]),this._material.setParameters(this.textureBindParameters),this.getTechnique(t.treeRendering?tt:$e,e)}}class nt extends qe{constructor(){super(...arguments),this.treeRendering=!1,this.useIndexing=!1,this.hasVertexTangents=!1}get hasNormalTexture(){return!this.treeRendering&&!!this.normalTextureId}get hasColorTexture(){return!!this.textureId}get hasMetallicRoughnessTexture(){return!this.treeRendering&&!!this.metallicRoughnessTextureId}get hasOcclusionTexture(){return!this.treeRendering&&!!this.occlusionTextureId}get emissiveStrength(){return this.emissiveStrengthFromSymbol*this.emissiveStrengthKHR}get emissionSource(){return this.treeRendering?0:null!=this.emissiveTextureId&&0===this.emissiveSource?3:0===this.emissiveSource?2:1}get hasTextures(){return this.hasColorTexture||this.hasNormalTexture||this.hasMetallicRoughnessTexture||3===this.emissionSource||this.hasOcclusionTexture}}const it=(0,m.vt)(),st=(0,m.vt)(),lt=(0,m.fA)(0,0,1),ct=(0,m.vt)(),ut=(0,m.vt)(),dt=(0,m.vt)(),mt=(0,m.vt)(),ht=()=>F.A.getLogger("esri.views.3d.layers.graphics.objectResourceUtils");class ft{constructor(e,t,o){this.resource=e,this.textures=t,this.usedMemory=o}}function pt(e){const t=e.params,o=t.topology;let r=!0;switch(t.vertexAttributes||(ht().warn("Geometry must specify vertex attributes"),r=!1),t.topology){case"PerAttributeArray":break;case"Indexed":case null:case void 0:{const e=t.faces;if(e){if(t.vertexAttributes)for(const o in t.vertexAttributes){const t=e[o];t?.values?(null!=t.valueType&&"UInt32"!==t.valueType&&(ht().warn(`Unsupported indexed geometry indices type '${t.valueType}', only UInt32 is currently supported`),r=!1),null!=t.valuesPerElement&&1!==t.valuesPerElement&&(ht().warn(`Unsupported indexed geometry values per element '${t.valuesPerElement}', only 1 is currently supported`),r=!1)):(ht().warn(`Indexed geometry does not specify face indices for '${o}' attribute`),r=!1)}}else ht().warn("Indexed geometries must specify faces"),r=!1;break}default:ht().warn(`Unsupported topology '${o}'`),r=!1}e.params.material||(ht().warn("Geometry requires material"),r=!1);const a=e.params.vertexAttributes;for(const e in a)a[e].values||(ht().warn("Geometries with externally defined attributes are not yet supported"),r=!1);return r}function vt(e){const t=(0,h.Ie)();return e.forEach(e=>{const o=e.boundingInfo;null!=o&&((0,h.iT)(t,o.bbMin),(0,h.iT)(t,o.bbMax))}),t}function gt(e){switch(e){case"mask":return 2;case"maskAndTransparency":return 3;case"none":return 1;default:return 0}}function xt(e){const t=e.params;return{id:1,material:t.material,texture:t.texture,region:t.texture}}const bt=new j.A(1,2,"wosr");async function wt(e,t){const s=function(e){const t=e.match(/(.*\.(gltf|glb))(\?lod=([0-9]+))?$/);return t?{fileType:"gltf",url:t[1],specifiedLodIndex:null!=t[4]?Number(t[4]):null}:e.match(/(.*\.(json|json\.gz))$/)?{fileType:"wosr",url:e,specifiedLodIndex:null}:{fileType:"unknown",url:e,specifiedLodIndex:null}}((0,a.EM)(e));if("wosr"===s.fileType){const e=await(t.cache?t.cache.loadWOSR(s.url,t):async function(e,t){const o=await async function(e,t){const o=await(0,z.Ke)((0,_.A)(e,t));if(o.ok)return o.value.data;(0,H.QP)(o.error),function(e){throw new P.A("",`Request for object resource failed: ${e}`)}(o.error)}(e,t),r=await async function(e,t){const o=new Array;for(const r in e){const a=e[r],n=a.images[0].data;if(!n){ht().warn("Externally referenced texture data is not yet supported");continue}const i=a.encoding+";base64,"+n,s="/textureDefinitions/"+r,l="rgba"===a.channels?a.alphaChannelUsage||"transparency":"none",c={noUnpackFlip:!0,wrap:{s:10497,t:10497},preMultiplyAlpha:1!==gt(l)},u=t?.disableTextures?Promise.resolve(null):(0,N.D)(i,t);o.push(u.then(e=>({refId:s,image:e,parameters:c,alphaChannelUsage:l})))}const r=await Promise.all(o),a={};for(const e of r)a[e.refId]=e;return a}(o.textureDefinitions??{},t);let a=0;for(const e in r)if(r.hasOwnProperty(e)){const t=r[e];a+=t?.image?t.image.width*t.image.height*4:0}return new ft(o,r,a+(0,O.Qh)(o))}(s.url,t)),{engineResources:o,referenceBoundingBox:r}=function(e,t){const o=new Array,r=new Array,a=new Array,n=new D,i=e.resource,s=j.A.parse(i.version||"1.0","wosr");bt.validate(s);const l=i.model.name,c=i.model.geometries,u=i.materialDefinitions??{},d=e.textures;let h=0;const f=new Map;for(let e=0;e<c.length;e++){const i=c[e];if(!pt(i))continue;const s=xt(i),l=i.params.vertexAttributes,p=[],v=e=>{if("PerAttributeArray"===i.params.topology)return null;const t=i.params.faces;for(const o in t)if(o===e)return t[o].values;return null},g=l.position,x=g.values.length/g.valuesPerElement;for(const e in l){const t=l[e],o=t.values,r=v(e)??(0,B.tM)(x);p.push([e,new R.n(o,r,t.valuesPerElement,!0)])}const b=s.texture,w=d&&d[b];if(w&&!f.has(b)){const{image:e,parameters:t}=w,o=new G.h(e,t);r.push(o),f.set(b,o)}const y=f.get(b),M=y?y.id:void 0,S=s.material;let T=n.get(S,b);if(null==T){const e=u[S.slice(S.lastIndexOf("/")+1)].params;1===e.transparency&&(e.transparency=0);const o=w?gt(w.alphaChannelUsage):void 0,r={ambient:(0,m.ci)(e.diffuse),diffuse:(0,m.ci)(e.diffuse),opacity:1-(e.transparency||0),textureAlphaMode:o,textureAlphaCutoff:.33,textureId:M,doubleSided:!0,cullFace:0,colorMixMode:e.externalColorMixMode||"tint",textureAlphaPremultiplied:w?.parameters.preMultiplyAlpha??!1};t?.materialParameters&&Object.assign(r,t.materialParameters),T=new rt(r,t),n.set(S,b,T)}a.push(T);const C=new E.V(T,p);h+=p.find(e=>"position"===e[0])?.[1]?.indices.length??0,o.push(C)}return{engineResources:[{name:l,stageResources:{textures:r,materials:a,geometries:o},pivotOffset:i.model.pivotOffset,numberOfVertices:h,lodThreshold:null}],referenceBoundingBox:vt(o)}}(e,t);return{lods:o,referenceBoundingBox:r,isEsriSymbolResource:!1,isWosr:!0}}let f;if(t.cache)f=await t.cache.loadGLTF(s.url,t,!!t.usePBR,!!t.useEmissive);else{const{loadGLTF:e}=await o.e(1698).then(o.bind(o,51698));f=await e(new w.R,s.url,t,t.usePBR,t.useEmissive)}const{engineResources:S,referenceBoundingBox:C}=function(e,t,o){const a=e.model,s=e.meta,f=a.meta?.ESRI_proxyEllipsoid,w=s.isEsriSymbolResource&&null!=f&&"EsriRealisticTreesStyle"===s.ESRI_webstyle;w&&!e.customMeta.esriTreeRendering&&(e.customMeta.esriTreeRendering=!0,function(e,t){for(let o=0;o<e.model.lods.length;++o){const a=e.model.lods[o];for(const n of a.parts){const a=n.attributes.normal;if(null==a)return;const i=n.attributes.position,s=i.count,u=(0,m.vt)(),h=(0,m.vt)(),f=(0,m.vt)(),p=new Float32Array(4*s),g=new Float32Array(3*s),x=(0,l.B8)((0,c.vt)(),n.transform);let b=0,w=0;for(let l=0;l<s;l++){i.getVec(l,h),a.getVec(l,u),(0,d.Z0)(h,h,n.transform),(0,d.Re)(f,h,t.center),(0,d.Qr)(f,f,t.radius);const s=f[2],c=(0,d.Bw)(f),m=Math.min(.45+.55*c*c,1)**r.Tf;(0,d.Qr)(f,f,t.radius),null!==x&&(0,d.Z0)(f,f,x),(0,d.S8)(f,f),o+1!==e.model.lods.length&&e.model.lods.length>1&&(0,d.Cc)(f,f,u,s>-1?.2:Math.min(-4*s-3.8,1)),g[b]=f[0],g[b+1]=f[1],g[b+2]=f[2],b+=3,p[w]=m,p[w+1]=m,p[w+2]=m,p[w+3]=1,w+=4}n.attributes.normal=new v.xs(g.buffer),n.attributes.color=new v.Eq(p.buffer)}}}(e,f));const S=!!t.usePBR,C=s.isEsriSymbolResource?{usePBR:S,isSchematic:!1,treeRendering:w,mrrFactors:Le.SY}:{usePBR:S,isSchematic:!1,treeRendering:!1,mrrFactors:Le.mb},_={...t.materialParameters,treeRendering:w},z=new Array,P=new Map,F=new Map,O=a.lods.length,D=(0,h.Ie)();return a.lods.forEach((e,s)=>{const l=!0===t.skipHighLods&&(O>1&&0===s||O>3&&1===s)||!1===t.skipHighLods&&null!=o&&s!==o;if(l&&0!==s)return;const c=new I(e.name,e.lodThreshold,[0,0,0]);e.parts.forEach(e=>{const o=l?new rt({},t):function(e,t,o,a,n,i,s,l,c){const d=e.materials.get(t.material);if(null==d)return null;const{normal:m,color:h,texCoord0:f,tangent:p}=t.attributes,v=t.material+(m?"_normal":"")+(h?"_color":"")+(f?"_texCoord0":"")+(p?"_tangent":""),g=null!=t.attributes.texCoord0,x=null!=t.attributes.normal,b=function(e){switch(e){case"BLEND":return 0;case"MASK":return 2;case"OPAQUE":case null:case void 0:return 1}}(d.alphaMode);if(!i.has(v)){if(g){const t=(t,o=!1,r=!1)=>{if(null!=t&&!s.has(t)){const a=e.textures.get(t);if(a){const e=a.data,n=o&&!(0,M.x3)(e)?l.compressionOptions:void 0;s.set(t,new G.h((0,M.x3)(e)?e.data:e,{...a.parameters,preMultiplyAlpha:!(0,M.x3)(e)&&r,encoding:(0,M.x3)(e)?e.encoding:void 0,compressionOptions:n}))}}},o=1!==b&&!c;t(d.colorTexture,o,1!==b),t(d.normalTexture),t(d.occlusionTexture,!0),t(d.emissiveTexture),t(d.metallicRoughnessTexture,!0)}const o=(0,r.xV)(d.color[0]),m=(0,r.xV)(d.color[1]),h=(0,r.xV)(d.color[2]),f=null!=d.colorTexture&&g?s.get(d.colorTexture):null,p=(0,Le.Jr)(d),w=null!=d.normalTextureTransform?.scale?d.normalTextureTransform?.scale:u.Un;i.set(v,new rt({...a,customDepthTest:1,textureAlphaMode:b,textureAlphaCutoff:d.alphaCutoff,diffuse:[o,m,h],ambient:[o,m,h],opacity:"OPAQUE"===d.alphaMode?1:d.opacity,doubleSided:d.doubleSided,doubleSidedType:"winding-order",cullFace:d.doubleSided?0:2,hasVertexColors:!!t.attributes.color,hasVertexTangents:!!t.attributes.tangent,normalType:x?0:2,castShadows:!0,receiveShadows:d.receiveShadows,receiveAmbientOcclusion:d.receiveAmbientOcclusion,textureId:null!=f?f.id:void 0,colorMixMode:d.colorMixMode,normalTextureId:null!=d.normalTexture&&g?s.get(d.normalTexture).id:void 0,textureAlphaPremultiplied:null!=f&&!!f.parameters.preMultiplyAlpha,occlusionTextureId:null!=d.occlusionTexture&&g?s.get(d.occlusionTexture).id:void 0,emissiveTextureId:null!=d.emissiveTexture&&g?s.get(d.emissiveTexture).id:void 0,metallicRoughnessTextureId:null!=d.metallicRoughnessTexture&&g?s.get(d.metallicRoughnessTexture).id:void 0,emissiveBaseColor:[d.emissiveFactor[0],d.emissiveFactor[1],d.emissiveFactor[2]],emissiveStrengthKHR:null!=d.emissiveStrengthKHR?d.emissiveStrengthKHR:1,emissiveStrengthFromSymbol:null!=n.emissiveStrengthFromSymbol?n.emissiveStrengthFromSymbol:void 0,mrrFactors:p?Le.Bt:[d.metallicFactor,d.roughnessFactor,a.mrrFactors[2]],isSchematic:p,colorTextureTransformMatrix:T(d.colorTextureTransform),normalTextureTransformMatrix:T(d.normalTextureTransform),scale:[w[0],w[1]],occlusionTextureTransformMatrix:T(d.occlusionTextureTransform),emissiveTextureTransformMatrix:T(d.emissiveTextureTransform),metallicRoughnessTextureTransformMatrix:T(d.metallicRoughnessTextureTransform),...n},l))}const w=i.get(v);if(o.stageResources.materials.push(w),g){const e=e=>{null!=e&&o.stageResources.textures.push(s.get(e))};e(d.colorTexture),e(d.normalTexture),e(d.occlusionTexture),e(d.emissiveTexture),e(d.metallicRoughnessTexture)}return w}(a,e,c,C,_,P,F,t,w),{geometry:d,vertexCount:m}=function(e,t){const o=e.attributes.position.count,r=(0,y.x)(e.indices||o,e.primitiveType),a=p(3*o),{typedBuffer:s,typedBufferStride:l}=e.attributes.position;(0,g.t)(a,s,e.transform,3,l);const c=[["position",new R.n(a,r,3,!0)]];if(null!=e.attributes.normal){const t=p(3*o),{typedBuffer:a,typedBufferStride:s}=e.attributes.normal;(0,i.Ge)(yt,e.transform),(0,g.b)(t,a,yt,3,s),(0,n.or)(yt)&&(0,g.n)(t,t),c.push(["normal",new R.n(t,r,3,!0)])}if(null!=e.attributes.tangent){const t=p(4*o),{typedBuffer:a,typedBufferStride:s}=e.attributes.tangent;(0,i.z0)(yt,e.transform),(0,x.t)(t,a,yt,4,s),(0,n.or)(yt)&&(0,g.n)(t,t,4),c.push(["tangent",new R.n(t,r,4,!0)])}if(null!=e.attributes.texCoord0){const t=p(2*o),{typedBuffer:a,typedBufferStride:n}=e.attributes.texCoord0;(0,b.a)(t,a,2,n),c.push(["uv0",new R.n(t,r,2,!0)])}const u=e.attributes.color;if(null!=u){const t=new Uint8Array(4*o);4===u.elementCount?u instanceof v.Eq?(0,x.b)(t,u,1,255):(u instanceof v.XP||u instanceof v.Uz)&&(0,x.b)(t,u,1/255,255):(t.fill(255),u instanceof v.xs?(0,g.f)(t,u.typedBuffer,1,255,4,u.typedBufferStride):(e.attributes.color instanceof v.eI||e.attributes.color instanceof v.nS)&&(0,g.f)(t,u.typedBuffer,1/255,255,4,e.attributes.color.typedBufferStride)),c.push(["color",new R.n(t,r,4,!0)])}return{geometry:new E.V(t,c),vertexCount:o}}(e,o??new rt({},t)),f=d.boundingInfo;null!=f&&0===s&&((0,h.iT)(D,f.bbMin),(0,h.iT)(D,f.bbMax)),null!=o&&(c.stageResources.geometries.push(d),c.numberOfVertices+=m)}),l||z.push(c)}),{engineResources:z,referenceBoundingBox:D}}(f,t,s.specifiedLodIndex);return{lods:S,referenceBoundingBox:C,isEsriSymbolResource:f.meta.isEsriSymbolResource,isWosr:!1}}const yt=(0,s.vt)()},32728(e,t,o){o.d(t,{YH:()=>s,hG:()=>n,nu:()=>l,wp:()=>i}),o(34727);var r=o(35522),a=o(51850);function n(e){const t=e[0]*e[0]+e[4]*e[4]+e[8]*e[8],o=e[1]*e[1]+e[5]*e[5]+e[9]*e[9],r=e[2]*e[2]+e[6]*e[6]+e[10]*e[10];return Math.sqrt(Math.max(t,o,r))}function i(e,t){const o=Math.sqrt(t[0]*t[0]+t[4]*t[4]+t[8]*t[8]),a=Math.sqrt(t[1]*t[1]+t[5]*t[5]+t[9]*t[9]),n=Math.sqrt(t[2]*t[2]+t[6]*t[6]+t[10]*t[10]);return(0,r.hZ)(e,o,a,n),e}function s(e,t,o){o=o||e;const a=(0,r.Om)(e,t);(0,r.hZ)(o,e[0]-a*t[0],e[1]-a*t[1],e[2]-a*t[2]),(0,r.S8)(o,o)}function l(e,t,o,n=(0,a.vt)()){const i=(0,r.Bw)(e),s=(0,r.Bw)(t),l=(0,r.Om)(e,t)/(i*s);if(l<.9999999999999999){const a=Math.acos(l),d=((1-o)*i+o*s)/Math.sin(a),m=d/i*Math.sin((1-o)*a),h=d/s*Math.sin(o*a);return(0,r.hs)(c,e,m),(0,r.hs)(u,t,h),(0,r.WQ)(n,c,u)}return(0,r.Cc)(n,e,t,o)}(0,a.vt)(),(0,a.vt)(),(0,a.vt)();const c=(0,a.vt)(),u=(0,a.vt)()},46686(e,t,o){o.d(t,{o:()=>a});var r=o(31821);function a(e,t){t&&e.varyings.add("linearDepth","float",{invariant:!0}),e.vertex.code.add(r.H`
565
+ void forwardLinearDepth(float _linearDepth) { ${(0,r.If)(t,"linearDepth = _linearDepth;")} }
566
+ `)}},33120(e,t,o){o.d(t,{i$:()=>i,xJ:()=>n}),o(46686),o(62308);var r=o(77108),a=o(31821);function n(e){e.vertex.uniforms.add(new r.E("nearFar",e=>e.camera.nearFar))}function i(e){e.vertex.code.add(a.H`float calculateLinearDepth(vec2 nearFar,float z) {
567
+ return (-z - nearFar[0]) / (nearFar[1] - nearFar[0]);
568
+ }`)}},32680(e,t,o){o.d(t,{M:()=>a});var r=o(31821);function a(e){e.vertex.code.add(r.H`vec4 offsetBackfacingClipPosition(vec4 posClip, vec3 posWorld, vec3 normalWorld, vec3 camPosWorld) {
569
+ vec3 camToVert = posWorld - camPosWorld;
570
+ bool isBackface = dot(camToVert, normalWorld) > 0.0;
571
+ if (isBackface) {
572
+ posClip.z += 0.0000003 * posClip.w;
573
+ }
574
+ return posClip;
575
+ }`)}},49255(e,t,o){function r(e){return function(e){return c(e)||4===e}(e)||function(e){return 5===(t=e)||6===t||7===t||8===e||9===e;var t}(e)}function a(e){return 10===e||11===e}function n(e){return l(e)||a(e)}function i(e){return 1===e}function s(e){return 2===e}function l(e){return 0===e||function(e){return i(e)||s(e)}(e)}function c(e){return function(e){return l(e)||a(e)}(e)||u(e)}function u(e){return 3===e}o.d(t,{Ex:()=>a,Rb:()=>s,Sp:()=>i,_o:()=>l,eh:()=>u,gr:()=>c,i3:()=>n,uw:()=>r})},76597(e,t,o){o.d(t,{d:()=>n});var r=o(33120),a=o(31821);function n(e){(0,r.i$)(e),e.vertex.code.add(a.H`vec4 transformPositionWithDepth(mat4 proj, mat4 view, vec3 pos, vec2 nearFar, out float depth) {
576
+ vec4 eye = view * vec4(pos, 1.0);
577
+ depth = calculateLinearDepth(nearFar,eye.z);
578
+ return proj * eye;
579
+ }`),e.vertex.code.add(a.H`vec4 transformPosition(mat4 proj, mat4 view, vec3 pos) {
580
+ return proj * (view * vec4(pos, 1.0));
581
+ }`)}},24321(e,t,o){o.d(t,{v:()=>n});var r=o(43519),a=o(31821);function n(e,t){t.instancedColor?(e.attributes.add("instanceColor","vec4"),e.vertex.include(r.WD),e.vertex.include(r.Y1),e.vertex.include(r.ML),e.vertex.code.add(a.H`
582
+ MaskedColor applyInstanceColor(MaskedColor color) {
583
+ return multiplyMaskedColors( color, createMaskedFromUInt8NaNColor(${"instanceColor"}));
584
+ }
585
+ `)):e.vertex.code.add(a.H`MaskedColor applyInstanceColor(MaskedColor color) {
586
+ return color;
587
+ }`)}},2585(e,t,o){o.d(t,{B:()=>g});var r=o(77690),a=o(29242),n=o(9093),i=o(35522),s=o(51850),l=o(26425),c=o(77949),u=o(23205),d=o(31821),m=o(35644),h=o(74333);class f extends h.n{constructor(e,t,o){super(e,"mat4",1,(r,a,n)=>r.setUniformMatrix4fv(e,t(a,n),o))}}var p=o(28449);o(65786).Y;const v=(0,a.vt)();function g(e,t){const{hasModelTransformation:o,instancedDoublePrecision:a,instanced:s,output:h,hasVertexTangents:g}=t;o&&(e.vertex.uniforms.add(new f("model",e=>e.modelTransformation??n.zK)),e.vertex.uniforms.add(new m.k("normalLocalOriginFromModel",e=>((0,r.Ge)(v,e.modelTransformation??n.zK),v)))),s&&a&&(e.attributes.add("instanceModelOriginHi","vec3"),e.attributes.add("instanceModelOriginLo","vec3"),e.attributes.add("instanceModel","mat3"),e.attributes.add("instanceModelNormal","mat3"));const b=e.vertex;a&&(b.include(l.u),b.uniforms.add(new u.d("viewOriginHi",e=>(0,p.Zo)((0,i.hZ)(x,e.camera.viewInverseTransposeMatrix[3],e.camera.viewInverseTransposeMatrix[7],e.camera.viewInverseTransposeMatrix[11]),x)),new u.d("viewOriginLo",e=>(0,p.jA)((0,i.hZ)(x,e.camera.viewInverseTransposeMatrix[3],e.camera.viewInverseTransposeMatrix[7],e.camera.viewInverseTransposeMatrix[11]),x)))),b.code.add(d.H`
588
+ vec3 getVertexInLocalOriginSpace() {
589
+ return ${o?a?"(model * vec4(instanceModel * localPosition().xyz, 1.0)).xyz":"(model * localPosition()).xyz":a?"instanceModel * localPosition().xyz":"localPosition().xyz"};
590
+ }
591
+
592
+ vec3 subtractOrigin(vec3 _pos) {
593
+ ${a?d.H`
594
+ // Issue: (should be resolved now with invariant position) https://devtopia.esri.com/WebGIS/arcgis-js-api/issues/56280
595
+ vec3 originDelta = dpAdd(viewOriginHi, viewOriginLo, -instanceModelOriginHi, -instanceModelOriginLo);
596
+ return _pos - originDelta;`:"return vpos;"}
597
+ }
598
+ `),b.code.add(d.H`
599
+ vec3 dpNormal(vec4 _normal) {
600
+ return normalize(${o?a?"normalLocalOriginFromModel * (instanceModelNormal * _normal.xyz)":"normalLocalOriginFromModel * _normal.xyz":a?"instanceModelNormal * _normal.xyz":"_normal.xyz"});
601
+ }
602
+ `),4===h&&((0,c.S7)(b),b.code.add(d.H`
603
+ vec3 dpNormalView(vec4 _normal) {
604
+ return normalize((viewNormal * ${o?a?"vec4(normalLocalOriginFromModel * (instanceModelNormal * _normal.xyz), 1.0)":"vec4(normalLocalOriginFromModel * _normal.xyz, 1.0)":a?"vec4(instanceModelNormal * _normal.xyz, 1.0)":"_normal"}).xyz);
605
+ }
606
+ `)),g&&b.code.add(d.H`
607
+ vec4 dpTransformVertexTangent(vec4 _tangent) {
608
+ ${o?a?"return vec4(normalLocalOriginFromModel * (instanceModelNormal * _tangent.xyz), _tangent.w);":"return vec4(normalLocalOriginFromModel * _tangent.xyz, _tangent.w);":a?"return vec4(instanceModelNormal * _tangent.xyz, _tangent.w);":"return _tangent;"}
609
+ }`)}const x=(0,s.vt)()},96336(e,t,o){o.d(t,{Y:()=>a});var r=o(31821);function a(e,t){switch(e.fragment.code.add(r.H`vec3 screenDerivativeNormal(vec3 positionView) {
610
+ return normalize(cross(dFdx(positionView), dFdy(positionView)));
611
+ }`),t.normalType){case 1:e.attributes.add("normalCompressed","vec2"),e.vertex.code.add(r.H`vec3 decompressNormal(vec2 normal) {
612
+ float z = 1.0 - abs(normal.x) - abs(normal.y);
613
+ return vec3(normal + sign(normal) * min(z, 0.0), z);
614
+ }
615
+ vec3 normalModel() {
616
+ return decompressNormal(normalCompressed);
617
+ }`);break;case 0:e.attributes.add("normal","vec3"),e.vertex.code.add(r.H`vec3 normalModel() {
618
+ return normal;
619
+ }`);break;default:t.normalType;case 2:case 3:}}},39014(e,t,o){o.d(t,{K:()=>s});var r=o(43519),a=o(31821),n=o(93588),i=o(43616);function s(e,t){e.varyings.add("colorMixMode","int"),e.varyings.add("opacityMixMode","int"),e.vertex.uniforms.add(new n.c("symbolColorMixMode",e=>i.Um[e.colorMixMode])),t.hasSymbolColors?(e.vertex.include(r.WD),e.vertex.include(r.Y1),e.vertex.include(r.ML),e.attributes.add("symbolColor","vec4"),e.vertex.code.add(a.H`
620
+ MaskedColor applySymbolColor(MaskedColor color) {
621
+ return multiplyMaskedColors(color, createMaskedFromUInt8NaNColor(${"symbolColor"}));
622
+ }
623
+ `)):e.vertex.code.add(a.H`MaskedColor applySymbolColor(MaskedColor color) {
624
+ return color;
625
+ }`),e.vertex.code.add(a.H`
626
+ void forwardColorMixMode(bvec4 mask) {
627
+ colorMixMode = mask.r ? ${a.H.int(i.Um.ignore)} : symbolColorMixMode;
628
+ opacityMixMode = mask.a ? ${a.H.int(i.Um.ignore)} : symbolColorMixMode;
629
+ }
630
+ `)}},53466(e,t,o){o.d(t,{U:()=>a});var r=o(31821);function a(e,t){switch(t.textureCoordinateType){case 1:return e.attributes.add("uv0","vec2"),e.varyings.add("vuv0","vec2"),void e.vertex.code.add(r.H`void forwardTextureCoordinates() { vuv0 = uv0; }`);case 2:return e.attributes.add("uv0","vec2"),e.attributes.add("uvRegion","vec4"),e.varyings.add("vuv0","vec2"),e.varyings.add("vuvRegion","vec4"),void e.vertex.code.add(r.H`void forwardTextureCoordinates() {
631
+ vuv0 = uv0;
632
+ vuvRegion = uvRegion;
633
+ }`);default:t.textureCoordinateType;case 0:return void e.vertex.code.add(r.H`void forwardTextureCoordinates() {}`);case 3:return}}},92700(e,t,o){o.d(t,{c:()=>a});var r=o(31821);function a(e,t){t.hasVertexColors?(e.attributes.add("color","vec4"),e.varyings.add("vColor","vec4"),e.vertex.code.add(r.H`void forwardVertexColor() { vColor = color; }`)):e.vertex.code.add(r.H`void forwardVertexColor() {}`)}},72824(e,t,o){o.d(t,{Mh:()=>u,Zo:()=>d,gy:()=>m});var r=o(29242),a=o(91829),n=o(96336),i=o(62308),s=o(31821),l=o(98353),c=o(35644);function u(e,t){const{vertex:o,varyings:r}=e;switch(t.normalType){case 0:case 1:{e.include(n.Y,t),r.add("vNormalWorld","vec3"),r.add("vNormalView","vec3"),o.uniforms.add(new c.k("transformNormalViewFromGlobal",e=>e.transformNormalViewFromGlobal));const{vertexNormalRotationType:a}=t,i=1===a;i&&o.uniforms.add(new l.h("transformNormalGlobalFromModel",e=>e.transformNormalGlobalFromModel)),o.code.add(s.H`
634
+ ${(0,s.If)(i,s.H`
635
+ mat3 normalModelTransformation() {
636
+ return transformNormalGlobalFromModel;
637
+ }
638
+ `)}
639
+
640
+ void forwardNormal() {
641
+ vNormalWorld = ${(0,s.If)(i,s.H`normalModelTransformation() * `)}normalModel();
642
+ vNormalView = transformNormalViewFromGlobal * vNormalWorld;
643
+ }
644
+ `);break}case 2:e.vertex.code.add(s.H`void forwardNormal() {}`);break;default:t.normalType;case 3:}}class d extends i.dO{constructor(){super(...arguments),this.transformNormalViewFromGlobal=(0,r.vt)()}}class m extends i.EM{constructor(){super(...arguments),this.transformNormalGlobalFromModel=(0,r.vt)(),this.toMapSpace=(0,a.vt)()}}},62308(e,t,o){o.d(t,{EM:()=>s,dO:()=>i});var r=o(29242),a=o(51850);(o(26425),o(40710),o(33079),o(31821),o(74333)).n,o(98353),o(35644),o(58029),o(63761);var n=o(65786);class i extends n.Y{constructor(){super(...arguments),this.transformWorldFromViewTH=(0,a.vt)(),this.transformWorldFromViewTL=(0,a.vt)(),this.transformViewFromCameraRelativeRS=(0,r.vt)(),this.transformationTexture=null}}class s extends n.Y{constructor(){super(...arguments),this.transformWorldFromModelRS=(0,r.vt)(),this.transformWorldFromModelTH=(0,a.vt)(),this.transformWorldFromModelTL=(0,a.vt)(),this.transformationDrawId=0}}},99208(e,t,o){o.d(t,{r:()=>i});var r=o(53466),a=o(31821);function n(e){e.fragment.code.add(a.H`vec4 textureAtlasLookup(sampler2D tex, vec2 textureCoordinates, vec4 atlasRegion) {
645
+ vec2 atlasScale = atlasRegion.zw - atlasRegion.xy;
646
+ vec2 uvAtlas = fract(textureCoordinates) * atlasScale + atlasRegion.xy;
647
+ float maxdUV = 0.125;
648
+ vec2 dUVdx = clamp(dFdx(textureCoordinates), -maxdUV, maxdUV) * atlasScale;
649
+ vec2 dUVdy = clamp(dFdy(textureCoordinates), -maxdUV, maxdUV) * atlasScale;
650
+ return textureGrad(tex, uvAtlas, dUVdx, dUVdy);
651
+ }`)}function i(e,t){const{textureCoordinateType:o}=t;if(0===o||3===o)return;e.include(r.U,t);const i=2===o;i&&e.include(n),e.fragment.code.add(a.H`
652
+ vec4 textureLookup(sampler2D tex, vec2 uv) {
653
+ return ${i?"textureAtlasLookup(tex, uv, vuvRegion)":"texture(tex, uv)"};
654
+ }
655
+ `)}},35640(e,t,o){o.d(t,{Ge:()=>c});var r=o(78955),a=o(91829),n=o(52587),i=o(77949),s=o(71988),l=o(31821);function c(e,t){const o=e.vertex;t.hasVerticalOffset?(function(e){e.uniforms.add(new s.E("verticalOffset",(e,t)=>{const{minWorldLength:o,maxWorldLength:a,screenLength:n}=e.verticalOffset,i=Math.tan(.5*t.camera.fovY)/(.5*t.camera.fullViewport[3]),s=t.camera.pixelRatio||1;return(0,r.hZ)(u,n*s,i,o,a)}))}(o),t.hasScreenSizePerspective&&(e.include(n.Y6),(0,n.OH)(o),(0,i.yu)(e.vertex,t)),o.code.add(l.H`
656
+ vec3 calculateVerticalOffset(vec3 worldPos, vec3 localOrigin) {
657
+ float viewDistance = length((view * vec4(worldPos, 1.0)).xyz);
658
+ ${t.spherical?l.H`vec3 worldNormal = normalize(worldPos + localOrigin);`:l.H`vec3 worldNormal = vec3(0.0, 0.0, 1.0);`}
659
+ ${t.hasScreenSizePerspective?l.H`
660
+ float cosAngle = dot(worldNormal, normalize(worldPos - cameraPosition));
661
+ float verticalOffsetScreenHeight = screenSizePerspectiveScaleFloat(verticalOffset.x, abs(cosAngle), viewDistance, screenSizePerspectiveAlignment);`:l.H`
662
+ float verticalOffsetScreenHeight = verticalOffset.x;`}
663
+ // Screen sized offset in world space, used for example for line callouts
664
+ float worldOffset = clamp(verticalOffsetScreenHeight * verticalOffset.y * viewDistance, verticalOffset.z, verticalOffset.w);
665
+ return worldNormal * worldOffset;
666
+ }
667
+
668
+ vec3 addVerticalOffset(vec3 worldPos, vec3 localOrigin) {
669
+ return worldPos + calculateVerticalOffset(worldPos, localOrigin);
670
+ }
671
+ `)):o.code.add(l.H`vec3 addVerticalOffset(vec3 worldPos, vec3 localOrigin) { return worldPos; }`)}const u=(0,a.vt)()},40261(e,t,o){o.d(t,{E:()=>g});var r=o(33120),a=o(68317),n=o(76597),i=o(96336),s=o(36782),l=o(53466),c=o(72824),u=o(31821);function d(e,t){switch(t.output){case 5:case 6:case 7:case 8:e.fragment.code.add(u.H`float _calculateFragDepth(const in float depth) {
672
+ const float SLOPE_SCALE = 2.0;
673
+ const float BIAS = 20.0 * .000015259;
674
+ float m = max(abs(dFdx(depth)), abs(dFdy(depth)));
675
+ return depth + SLOPE_SCALE * m + BIAS;
676
+ }
677
+ void outputDepth(float _linearDepth){
678
+ float fragDepth = _calculateFragDepth(_linearDepth);
679
+ gl_FragDepth = fragDepth;
680
+ }`);break;case 9:e.fragment.code.add(u.H`void outputDepth(float _linearDepth){
681
+ gl_FragDepth = _linearDepth;
682
+ }`)}}var m=o(3871),h=o(43259),f=o(58614),p=o(77949),v=o(63761);function g(e,t){const{vertex:o,fragment:g,varyings:x}=e,{hasColorTexture:b,alphaDiscardMode:w}=t,y=b&&1!==w,{output:M,normalType:S,hasColorTextureTransform:T}=t;switch(M){case 3:(0,p.NB)(o,t),e.include(n.d),g.include(a.HQ,t),e.include(l.U,t),y&&g.uniforms.add(new v.N("tex",e=>e.texture)),o.main.add(u.H`vpos = getVertexInLocalOriginSpace();
683
+ vpos = subtractOrigin(vpos);
684
+ vpos = addVerticalOffset(vpos, localOrigin);
685
+ gl_Position = transformPosition(proj, view, vpos);
686
+ forwardTextureCoordinates();`),e.include(f.S,t),g.main.add(u.H`
687
+ discardBySlice(vpos);
688
+ ${(0,u.If)(y,u.H`vec4 texColor = texture(tex, ${T?"colorUV":"vuv0"});
689
+ discardOrAdjustAlpha(texColor);`)}`);break;case 5:case 6:case 7:case 8:case 11:(0,p.NB)(o,t),e.include(n.d),e.include(l.U,t),e.include(h.A,t),e.include(d,t),g.include(a.HQ,t),e.include(s.g,t),(0,r.xJ)(e),x.add("depth","float",{invariant:!0}),y&&g.uniforms.add(new v.N("tex",e=>e.texture)),o.main.add(u.H`vpos = getVertexInLocalOriginSpace();
690
+ vpos = subtractOrigin(vpos);
691
+ vpos = addVerticalOffset(vpos, localOrigin);
692
+ gl_Position = transformPositionWithDepth(proj, view, vpos, nearFar, depth);
693
+ forwardTextureCoordinates();
694
+ forwardObjectAndLayerIdColor();`),e.include(f.S,t),g.main.add(u.H`
695
+ discardBySlice(vpos);
696
+ ${(0,u.If)(y,u.H`vec4 texColor = texture(tex, ${T?"colorUV":"vuv0"});
697
+ discardOrAdjustAlpha(texColor);`)}
698
+ ${11===M?u.H`outputObjectAndLayerIdColor();`:u.H`outputDepth(depth);`}`);break;case 4:{(0,p.NB)(o,t),e.include(n.d),e.include(i.Y,t),e.include(c.Mh,t),e.include(l.U,t),e.include(h.A,t),y&&g.uniforms.add(new v.N("tex",e=>e.texture)),2===S&&x.add("vPositionView","vec3",{invariant:!0});const r=0===S||1===S;o.main.add(u.H`
699
+ vpos = getVertexInLocalOriginSpace();
700
+ ${r?u.H`vNormalWorld = dpNormalView(vvLocalNormal(normalModel()));`:u.H`vPositionView = (view * vec4(vpos, 1.0)).xyz;`}
701
+ vpos = subtractOrigin(vpos);
702
+ vpos = addVerticalOffset(vpos, localOrigin);
703
+ gl_Position = transformPosition(proj, view, vpos);
704
+ forwardTextureCoordinates();`),g.include(a.HQ,t),e.include(f.S,t),g.main.add(u.H`
705
+ discardBySlice(vpos);
706
+ ${(0,u.If)(y,u.H`vec4 texColor = texture(tex, ${T?"colorUV":"vuv0"});
707
+ discardOrAdjustAlpha(texColor);`)}
708
+
709
+ ${2===S?u.H`vec3 normal = screenDerivativeNormal(vPositionView);`:u.H`vec3 normal = normalize(vNormalWorld);
710
+ if (gl_FrontFacing == false){
711
+ normal = -normal;
712
+ }`}
713
+ fragColor = vec4(0.5 + 0.5 * normal, 1.0);`);break}case 10:(0,p.NB)(o,t),e.include(n.d),e.include(l.U,t),e.include(h.A,t),y&&g.uniforms.add(new v.N("tex",e=>e.texture)),o.main.add(u.H`vpos = getVertexInLocalOriginSpace();
714
+ vpos = subtractOrigin(vpos);
715
+ vpos = addVerticalOffset(vpos, localOrigin);
716
+ gl_Position = transformPosition(proj, view, vpos);
717
+ forwardTextureCoordinates();`),g.include(a.HQ,t),e.include(f.S,t),e.include(m.Q,t),g.main.add(u.H`
718
+ discardBySlice(vpos);
719
+ ${(0,u.If)(y,u.H`vec4 texColor = texture(tex, ${T?"colorUV":"vuv0"});
720
+ discardOrAdjustAlpha(texColor);`)}
721
+ calculateOcclusionAndOutputHighlight();`)}}},22911(e,t,o){o.d(t,{NL:()=>p});var r=o(34727),a=o(49255),n=o(99208),i=o(65261),s=o(40710),l=o(33079),c=o(28421),u=o(20304),d=o(31821),m=o(15976),h=o(63761),f=o(66211);function p(e,t){if(!(0,a._o)(t.output))return;e.fragment.include(i.C);const{emissionSource:o,hasEmissiveTextureTransform:p,bindType:v,useFloatBlend:g}=t,x=3===o||4===o||5===o;x&&(e.include(n.r,t),e.fragment.uniforms.add(1===v?new h.N("texEmission",e=>e.textureEmissive):new m.o("texEmission",e=>e.textureEmissive)));const b=2===o||x;b&&e.fragment.uniforms.add(1===v?new l.t("emissiveBaseColor",e=>e.emissiveBaseColor):new s.W("emissiveBaseColor",e=>e.emissiveBaseColor));const w=0!==o;if(w&&7!==o&&6!==o&&4!==o&&5!==o){const t=e=>null!=e?g?e:(0,r.qE)(e,0,f.m):0;e.fragment.uniforms.add(1===v?new u.m("emissiveStrength",e=>t(e.emissiveStrength)):new c.J("emissiveStrength",e=>t(e.emissiveStrength)))}const y=7===o,M=5===o,S=1===o||6===o||y;e.fragment.code.add(d.H`
722
+ vec4 getEmissions(vec3 symbolColor) {
723
+ vec4 emissions = ${b?M?"emissiveSource == 0 ? vec4(emissiveBaseColor, 1.0): vec4(linearizeGamma(symbolColor), 1.0)":"vec4(emissiveBaseColor, 1.0)":S?y?"emissiveSource == 0 ? vec4(0.0): vec4(linearizeGamma(symbolColor), 1.0)":"vec4(linearizeGamma(symbolColor), 1.0)":"vec4(0.0)"};
724
+ ${(0,d.If)(x,`${(0,d.If)(M,`if(emissiveSource == 0) {\n vec4 emissiveFromTex = textureLookup(texEmission, ${p?"emissiveUV":"vuv0"});\n emissions *= vec4(linearizeGamma(emissiveFromTex.rgb), emissiveFromTex.a);\n }`,`vec4 emissiveFromTex = textureLookup(texEmission, ${p?"emissiveUV":"vuv0"});\n emissions *= vec4(linearizeGamma(emissiveFromTex.rgb), emissiveFromTex.a);`)}\n emissions.w = emissions.rgb == vec3(0.0) ? 0.0: emissions.w;`)}
725
+ ${(0,d.If)(w,`emissions.rgb *= emissiveStrength * ${d.H.float(1)};`)}
726
+ return emissions;
727
+ }
728
+ `)}},52540(e,t,o){o.d(t,{E:()=>s,l:()=>l});var r=o(37585),a=o(48163),n=o(77108),i=o(31821);function s(e){e.uniforms.add(new n.E("zProjectionMap",e=>l(e.camera))),e.code.add(i.H`float linearizeDepth(float depth, vec2 zProjectionConstants) {
729
+ float depthNdc = depth * 2.0 - 1.0;
730
+ return -(zProjectionConstants[0] / (depthNdc + zProjectionConstants[1] + 1e-7));
731
+ }
732
+ float linearizeDepth(float depth) {
733
+ return linearizeDepth(depth, zProjectionMap);
734
+ }`),e.code.add(i.H`float delinearizeDepth(float linearDepth) {
735
+ float c1 = zProjectionMap[0];
736
+ float c2 = zProjectionMap[1];
737
+ float depthNdc = (-c1/linearDepth) - c2 - 1e-7;
738
+ float depthNonlinear01 = (depthNdc + 1.0 ) / 2.0;
739
+ return depthNonlinear01;
740
+ }`),e.code.add(i.H`float depthFromTexture(sampler2D depthTexture, vec2 uv) {
741
+ ivec2 iuv = ivec2(uv * vec2(textureSize(depthTexture, 0)));
742
+ return texelFetch(depthTexture, iuv, 0).r;
743
+ }`),e.code.add(i.H`float linearDepthFromTexture(sampler2D depthTexture, vec2 uv) {
744
+ return linearizeDepth(depthFromTexture(depthTexture, uv));
745
+ }`)}function l(e){const t=e.projectionMatrix;return(0,r.hZ)(c,t[14],t[10])}const c=(0,a.vt)()},92573(e,t,o){o.d(t,{V:()=>i});var r=o(52540),a=o(77108),n=o(31821);function i(e){e.include(r.E),e.uniforms.add(new a.E("zProjectionMapLastFrame",e=>(0,r.l)(e.reprojection.lastFrameCamera))),e.code.add(n.H`float linearDepthFromTextureLastFrame(sampler2D depthTexture, vec2 uv) {
746
+ return linearizeDepth(depthFromTexture(depthTexture, uv), zProjectionMapLastFrame);
747
+ }`)}},77695(e,t,o){o.d(t,{J:()=>m});var r=o(29242),a=o(48163),n=o(99208),i=o(68259),s=o(47286),l=o(31821),c=o(35644),u=o(15976),d=o(63761);function m(e,t){return function(e,t){const o=e.fragment,{hasVertexTangents:m,doubleSidedMode:h,hasNormalTexture:f,textureCoordinateType:p,bindType:v,hasNormalTextureTransform:g}=t;m?(e.attributes.add("tangent","vec4"),e.varyings.add("vTangent","vec4"),2===h?o.code.add(l.H`mat3 computeTangentSpace(vec3 normal) {
748
+ float tangentHeadedness = gl_FrontFacing ? vTangent.w : -vTangent.w;
749
+ vec3 tangent = normalize(gl_FrontFacing ? vTangent.xyz : -vTangent.xyz);
750
+ vec3 bitangent = cross(normal, tangent) * tangentHeadedness;
751
+ return mat3(tangent, bitangent, normal);
752
+ }`):o.code.add(l.H`mat3 computeTangentSpace(vec3 normal) {
753
+ float tangentHeadedness = vTangent.w;
754
+ vec3 tangent = normalize(vTangent.xyz);
755
+ vec3 bitangent = cross(normal, tangent) * tangentHeadedness;
756
+ return mat3(tangent, bitangent, normal);
757
+ }`)):o.code.add(l.H`mat3 computeTangentSpace(vec3 normal, vec3 pos, vec2 st) {
758
+ vec3 Q1 = dFdx(pos);
759
+ vec3 Q2 = dFdy(pos);
760
+ vec2 stx = dFdx(st);
761
+ vec2 sty = dFdy(st);
762
+ float det = stx.t * sty.s - sty.t * stx.s;
763
+ vec3 T = stx.t * Q2 - sty.t * Q1;
764
+ T = T - normal * dot(normal, T);
765
+ T *= inversesqrt(max(dot(T,T), 1.e-10));
766
+ vec3 B = sign(det) * cross(normal, T);
767
+ return mat3(T, B, normal);
768
+ }`),f&&0!==p&&(e.include(n.r,t),o.uniforms.add(1===v?new d.N("normalTexture",e=>e.textureNormal):new u.o("normalTexture",e=>e.textureNormal)),g&&(o.uniforms.add(1===v?new s.G("scale",e=>e.scale??a.Un):new i.t("scale",e=>e.scale??a.Un)),o.uniforms.add(new c.k("normalTextureTransformMatrix",e=>e.normalTextureTransformMatrix??r.zK))),o.code.add(l.H`vec3 computeTextureNormal(mat3 tangentSpace, vec2 uv) {
769
+ vec3 rawNormal = textureLookup(normalTexture, uv).rgb * 2.0 - 1.0;`),g&&o.code.add(l.H`mat3 normalRotation = mat3(normalTextureTransformMatrix[0][0]/scale[0], normalTextureTransformMatrix[0][1]/scale[1], 0.0,
770
+ normalTextureTransformMatrix[1][0]/scale[0], normalTextureTransformMatrix[1][1]/scale[1], 0.0,
771
+ 0.0, 0.0, 0.0 );
772
+ rawNormal.xy = (normalRotation * vec3(rawNormal.x, rawNormal.y, 1.0)).xy;`),o.code.add(l.H`return tangentSpace * rawNormal;
773
+ }`))}(e,t)}},71651(e,t,o){o.d(t,{n:()=>D});var r=o(31821),a=o(12791),n=o(5482),i=o(34727),s=o(97768),l=o(36708),c=o(78659),u=o(91429),d=o(37585),m=o(2016),h=o(48375);var f=o(15581),p=o(13840),v=o(98958),g=o(95774),x=o(90644);let b=class extends v.w{constructor(){super(...arguments),this.shader=new p.r(g.S,()=>o.e(1285).then(o.bind(o,91285)))}initializePipeline(){return(0,x.Ey)({colorWrite:x.kn})}};b=(0,n.Cg)([(0,u.$K)("esri.views.3d.webgl-engine.effects.ssao.SSAOBlurTechnique")],b);var w=o(48163),y=o(65786);class M extends y.Y{constructor(){super(...arguments),this.projScale=1}}class S extends M{constructor(){super(...arguments),this.intensity=1}}class T extends y.Y{}class C extends T{constructor(){super(...arguments),this.blurSize=(0,w.vt)()}}let I=class extends v.w{constructor(){super(...arguments),this.shader=new p.r(f.S,()=>o.e(6122).then(o.bind(o,86122)))}initializePipeline(){return(0,x.Ey)({colorWrite:x.kn})}};I=(0,n.Cg)([(0,u.$K)("esri.views.3d.webgl-engine.effects.ssao.SSAOTechnique")],I);var _=o(63907),z=o(76284),P=o(67171);let F=class extends h.A{constructor(e){super(e),this.consumes={required:["normals"]},this.produces=m.OG.AMBIENT_ILLUMINATION,this._enableTime=(0,c.l5)(0),this._passParameters=new S,this._drawParameters=new C}initialize(){const e=Uint8Array.from(atob("eXKEvZaUc66cjIKElE1jlJ6MjJ6Ufkl+jn2fcXp5jBx7c6KEflSGiXuXeW6OWs+tfqZ2Yot2Y7Zzfo2BhniEj3xoiXuXj4eGZpqEaHKDWjSMe7palFlzc3BziYOGlFVzg6Zzg7CUY5JrjFF7eYJ4jIKEcyyEonSXe7qUfqZ7j3xofqZ2c4R5lFZ5Y0WUbppoe1l2cIh2ezyUho+BcHN2cG6DbpqJhqp2e1GcezhrdldzjFGUcyxjc3aRjDyEc1h7Sl17c6aMjH92pb6Mjpd4dnqBjMOEhqZleIOBYzB7gYx+fnqGjJuEkWlwnCx7fGl+c4hjfGyRe5qMlNOMfnqGhIWHc6OMi4GDc6aMfqZuc6aMzqJzlKZ+lJ6Me3qRfoFue0WUhoR5UraEa6qMkXiPjMOMlJOGe7JrUqKMjK6MeYRzdod+Sl17boiPc6qEeYBlcIh2c1WEe7GDiWCDa0WMjEmMdod+Y0WcdntzhmN8WjyMjKJjiXtzgYxYaGd+a89zlEV7e2GJfnd+lF1rcK5zc4p5cHuBhL6EcXp5eYB7fnh8iX6HjIKEeaxuiYOGc66RfG2Ja5hzjlGMjEmMe9OEgXuPfHyGhPeEdl6JY02McGuMfnqGhFiMa3WJfnx2l4hwcG1uhmN8c0WMc39og1GBbrCEjE2EZY+JcIh2cIuGhIWHe0mEhIVrc09+gY5+eYBlnCyMhGCDl3drfmmMgX15aGd+gYx+fnuRfnhzY1SMsluJfnd+hm98WtNrcIuGh4SEj0qPdkqOjFF7jNNjdnqBgaqUjMt7boeBhnZ4jDR7c5pze4GGjEFrhLqMjHyMc0mUhKZze4WEa117kWlwbpqJjHZ2eX2Bc09zeId+e0V7WlF7jHJ2l72BfId8l3eBgXyBe897jGl7c66cgW+Xc76EjKNbgaSEjGx4fId8jFFjgZB8cG6DhlFziZhrcIh2fH6HgUqBgXiPY8dahGFzjEmMhEFre2dxhoBzc5SGfleGe6alc7aUeYBlhKqUdlp+cH5za4OEczxza0Gcc4J2jHZ5iXuXjH2Jh5yRjH2JcFx+hImBjH+MpddCl3dreZeJjIt8ZW18bm1zjoSEeIOBlF9oh3N7hlqBY4+UeYFwhLJjeYFwaGd+gUqBYxiEYot2fqZ2ondzhL6EYyiEY02Ea0VjgZB8doaGjHxoc66cjEGEiXuXiXWMiZhreHx8frGMe75rY02Ec5pzfnhzlEp4a3VzjM+EhFFza3mUY7Zza1V5e2iMfGyRcziEhDyEkXZ2Y4OBnCx7g5t2eyBjgV6EhEFrcIh2dod+c4Z+nJ5zjm15jEmUeYxijJp7nL6clIpjhoR5WrZraGd+fnuRa6pzlIiMg6ZzfHx5foh+eX1ufnB5eX1ufnB5aJt7UqKMjIh+e3aBfm5lbYSBhGFze6J4c39oc0mUc4Z+e0V7fKFVe0WEdoaGY02Ec4Z+Y02EZYWBfH6HgU1+gY5+hIWUgW+XjJ57ebWRhFVScHuBfJ6PhBx7WqJzlM+Ujpd4gHZziX6HjHmEgZN+lJt5boiPe2GJgX+GjIGJgHZzeaxufnB5hF2JtdN7jJ57hp57hK6ElFVzg6ZzbmiEbndzhIWHe3uJfoFue3qRhJd2j3xoc65zlE1jc3p8lE1jhniEgXJ7e657vZaUc3qBh52BhIF4aHKDa9drgY5+c52GWqZzbpqJe8tjnM+UhIeMfo2BfGl+hG1zSmmMjKJjZVaGgX15c1lze0mEp4OHa3mUhIWHhDyclJ6MeYOJkXiPc0VzhFiMlKaEboSJa5Jze41re3qRhn+HZYWBe0mEc4p5fnORbox5lEp4hGFjhGGEjJuEc1WEhLZjeHeGa7KlfHx2hLaMeX1ugY5+hIWHhKGPjMN7c1WEho1zhoBzZYx7fnhzlJt5exyUhFFziXtzfmmMa6qMYyiEiXxweV12kZSMeWqXSl17fnhzxmmMrVGEe1mcc4p5eHeGjK6MgY5+doaGa6pzlGV7g1qBh4KHkXiPeW6OaKqafqZ2eXZ5e1V7jGd7boSJc3BzhJd2e0mcYot2h1RoY8dahK6EQmWEWjx7e1l2lL6UgXyBdnR4eU9zc0VreX1umqaBhld7fo2Bc6KEc5Z+hDyEcIeBWtNrfHyGe5qMhMuMe5qMhEGEbVVupcNzg3aHhIF4boeBe0mEdlptc39ofFl5Y8uUlJOGiYt2UmGEcyxjjGx4jFF7a657ZYWBnElzhp57iXtrgZN+tfOEhIOBjE2HgU1+e8tjjKNbiWCDhE15gUqBgYN7fnqGc66ce9d7iYSBj0qPcG6DnGGcT3eGa6qMZY+JlIiMl4hwc3aRdnqBlGV7eHJ2hLZjfnuRhDyEeX6MSk17g6Z+c6aUjHmEhIF4gXyBc76EZW18fGl+fkl+jCxrhoVwhDyUhIqGlL2DlI6EhJd2tdN7eYORhEGMa2Faa6pzc3Bzc4R5lIRznM+UY9eMhDycc5Z+c4p5c4iGY117pb6MgXuPrbJafnx2eYOJeXZ5e657hDyEcziElKZjfoB5eHeGj4WRhGGEe6KGeX1utTStc76EhFGJnCyMa5hzfH6HnNeceYB7hmN8gYuMhIVrczSMgYF8h3N7c5pza5hzjJqEYIRdgYuMlL2DeYRzhGGEeX1uhLaEc4iGeZ1zdl6JhrVteX6Me2iMfm5lWqJzSpqEa6pzdnmchHx2c6OMhNdrhoR5g3aHczxzeW52gV6Ejm15frGMc0Vzc4Z+l3drfniJe+9rWq5rlF1rhGGEhoVwe9OEfoh+e7pac09+c3qBY0lrhDycdnp2lJ6MiYOGhGCDc3aRlL2DlJt5doaGdnp2gYF8gWeOjF2Uc4R5c5Z+jEmMe7KEc4mEeYJ4dmyBe0mcgXiPbqJ7eYB7fmGGiYSJjICGlF1reZ2PnElzbpqJfH6Hc39oe4WEc5eJhK6EhqyJc3qBgZB8c09+hEmEaHKDhFGJc5SGiXWMUpaEa89zc6OMnCyMiXtrho+Be5qMc7KEjJ57dmN+hKGPjICGbmiEe7prdod+hGCDdnmchBx7eX6MkXZ2hGGEa657hm98jFFjY5JreYOJgY2EjHZ2a295Y3FajJ6Mc1J+YzB7e4WBjF2Uc4R5eV12gYxzg1qBeId+c9OUc5pzjFFjgY5+hFiMlIaPhoR5lIpjjIKBlNdSe7KEeX2BfrGMhIqGc65zjE2UhK6EklZ+QmWEeziMWqZza3VzdnR4foh+gYF8n3iJiZhrnKp7gYF8eId+lJ6Me1lrcIuGjKJjhmN8c66MjFF7a6prjJ6UnJ5zezyUfruRWlF7nI5zfHyGe657h4SEe8tjhBx7jFFjc09+c39ojICMeZeJeXt+YzRzjHZ2c0WEcIeBeXZ5onSXkVR+gYJ+eYFwdldzgYF7eX2BjJ6UiXuXlE1jh4SEe1mchLJjc4Z+hqZ7eXZ5bm1zlL6Ue5p7iWeGhKqUY5pzjKJjcIeBe8t7gXyBYIRdlEp4a3mGnK6EfmmMZpqEfFl5gYxzjKZuhGFjhoKGhHx2fnx2eXuMe3aBiWeGvbKMe6KGa5hzYzB7gZOBlGV7hmN8hqZlYot2Y117a6pzc6KEfId8foB5rctrfneJfJ6PcHN2hFiMc5pzjH92c0VzgY2EcElzdmCBlFVzg1GBc65zY4OBboeBcHiBeYJ4ewxzfHx5lIRzlEmEnLKEbk1zfJ6PhmN8eYBljBiEnMOEiXxwezyUcIeBe76EdsKEeX2BdnR4jGWUrXWMjGd7fkl+j4WRlEGMa5Jzho+BhDyEfnqMeXt+g3aHlE1jczClhNN7ZW18eHx8hGFjZW18iXWMjKJjhH57gYuMcIuGWjyMe4ZtjJuExmmMj4WRdntzi4GDhFFzYIRdnGGcjJp7Y0F7e4WEkbCGiX57fnSHa657a6prhBCMe3Z+SmmMjH92eHJ2hK6EY1FzexhrvbKMnI5za4OEfnd+eXuMhImBe897hLaMjN+EfG+BeIOBhF1+eZeJi4GDkXZ2eXKEgZ6Ejpd4c2GHa1V5e5KUfqZuhCx7jKp7lLZrg11+hHx2hFWUoot2nI5zgbh5mo9zvZaUe3qRbqKMfqZ2kbCGhFiM"),e=>e.charCodeAt(0)),t=new P.R(32);t.wrapMode=33071,t.pixelFormat=6407,t.wrapMode=10497,t.hasMipmap=!0,this._passParameters.noiseTexture=new z.A(this.renderingContext,t,e),this.addHandles((0,l.wB)(()=>this.view.stage.renderer.hasAmbientIllumination,()=>this._enableTime=(0,c.l5)(0)))}destroy(){this._passParameters.noiseTexture=(0,s.WD)(this._passParameters.noiseTexture)}precompile(){this.techniques.precompile(I),this.techniques.precompile(b)}render(e){const t=e.find(({name:e})=>"normals"===e),o=t?.getTexture(),r=t?.getTexture(_.nI);if(!o||!r)return;const a=this.techniques.getCompiled(I),n=this.techniques.getCompiled(b);if(!a||!n)return this._enableTime=(0,c.l5)(performance.now()),void this.requestRender(1);0===this._enableTime&&(this._enableTime=(0,c.l5)(performance.now()));const s=this.renderingContext,l=this.view.qualitySettings.fadeDuration,u=this.bindParameters,h=u.camera,p=h.relativeElevation,v=(0,i.qE)((5e5-p)/2e5,0,1),g=l>0?Math.min(l,performance.now()-this._enableTime)/l:1,x=g*v;this._passParameters.normalTexture=o,this._passParameters.depthTexture=r,this._passParameters.projScale=1/h.computeScreenPixelSizeAtDist(1),this._passParameters.intensity=4*O/(0,f.g)(h)**6*x;const w=h.fullViewport[2],y=h.fullViewport[3],M=this.fboCache.acquire(w,y,"ssao input",2);s.bindFramebuffer(M.fbo),s.setViewport(0,0,w,y),s.bindTechnique(a,u,this._passParameters,this._drawParameters),s.screen.draw();const S=Math.round(w/2),T=Math.round(y/2),C=this.fboCache.acquire(S,T,"ssao blur",0);s.bindFramebuffer(C.fbo),this._drawParameters.colorTexture=M.getTexture(),(0,d.hZ)(this._drawParameters.blurSize,0,2/y),s.bindTechnique(n,u,this._passParameters,this._drawParameters),s.setViewport(0,0,S,T),s.screen.draw(),M.release();const z=this.fboCache.acquire(S,T,m.OG.AMBIENT_ILLUMINATION,0);return s.bindFramebuffer(z.fbo),s.setViewport(0,0,w,y),s.setClearColor(1,1,1,0),s.clear(16384),this._drawParameters.colorTexture=C.getTexture(),(0,d.hZ)(this._drawParameters.blurSize,2/w,0),s.bindTechnique(n,u,this._passParameters,this._drawParameters),s.setViewport(0,0,S,T),s.screen.draw(),s.setViewport4fv(h.fullViewport),C.release(),g<1&&this.requestRender(2),z}};(0,n.Cg)([(0,u.MZ)()],F.prototype,"consumes",void 0),(0,n.Cg)([(0,u.MZ)()],F.prototype,"produces",void 0),F=(0,n.Cg)([(0,u.$K)("esri.views.3d.webgl-engine.effects.ssao.SSAO")],F);const O=.5;function D(e,t){t.receiveAmbientOcclusion?(e.uniforms.add(new a.x("ssaoTex",e=>e.ssao?.getTexture())),e.constants.add("blurSizePixelsInverse","float",.5),e.code.add(r.H`float evaluateAmbientOcclusionInverse() {
774
+ vec2 ssaoTextureSizeInverse = 1.0 / vec2(textureSize(ssaoTex, 0));
775
+ return texture(ssaoTex, gl_FragCoord.xy * blurSizePixelsInverse * ssaoTextureSizeInverse).r;
776
+ }
777
+ float evaluateAmbientOcclusion() {
778
+ return 1.0 - evaluateAmbientOcclusionInverse();
779
+ }`)):e.code.add(r.H`float evaluateAmbientOcclusionInverse() { return 1.0; }
780
+ float evaluateAmbientOcclusion() { return 0.0; }`)}},32971(e,t,o){o.d(t,{kA:()=>q,a8:()=>U,eU:()=>k});var r=o(74333);class a extends r.n{constructor(e,t,o,r){super(e,"float",0,(t,a)=>t.setUniform1fv(e,o(a),r),t)}}var n=o(31821);function i(e,t){e.uniforms.add(new a("shR",9,({lighting:e})=>e.sh.r),new a("shG",9,({lighting:e})=>e.sh.g),new a("shB",9,({lighting:e})=>e.sh.b)),e.code.add(n.H`vec3 calculateAmbientIrradiance(vec3 normal) {
781
+ vec3 ambientLight = 0.282095 * vec3(shR[0], shG[0], shB[0]);
782
+ vec4 sh1 = vec4(
783
+ 0.488603 * normal.x,
784
+ 0.488603 * normal.z,
785
+ 0.488603 * normal.y,
786
+ 1.092548 * normal.x * normal.y
787
+ );
788
+ vec4 sh2 = vec4(
789
+ 1.092548 * normal.y * normal.z,
790
+ 0.315392 * (3.0 * normal.z * normal.z - 1.0),
791
+ 1.092548 * normal.x * normal.z,
792
+ 0.546274 * (normal.x * normal.x - normal.y * normal.y)
793
+ );
794
+ vec4 lightingAmbientSH_R1 = vec4(shR[1], shR[2], shR[3], shR[4]);
795
+ vec4 lightingAmbientSH_G1 = vec4(shG[1], shG[2], shG[3], shG[4]);
796
+ vec4 lightingAmbientSH_B1 = vec4(shB[1], shB[2], shB[3], shB[4]);
797
+ ambientLight += vec3(
798
+ dot(lightingAmbientSH_R1, sh1),
799
+ dot(lightingAmbientSH_G1, sh1),
800
+ dot(lightingAmbientSH_B1, sh1)
801
+ );
802
+ vec4 lightingAmbientSH_R2 = vec4(shR[5], shR[6], shR[7], shR[8]);
803
+ vec4 lightingAmbientSH_G2 = vec4(shG[5], shG[6], shG[7], shG[8]);
804
+ vec4 lightingAmbientSH_B2 = vec4(shB[5], shB[6], shB[7], shB[8]);
805
+ ambientLight += vec3(
806
+ dot(lightingAmbientSH_R2, sh2),
807
+ dot(lightingAmbientSH_G2, sh2),
808
+ dot(lightingAmbientSH_B2, sh2)
809
+ );
810
+ return ambientLight;
811
+ }`),1!==t.pbrMode&&2!==t.pbrMode||e.code.add(n.H`const vec3 skyTransmittance = vec3(0.9, 0.9, 1.0);
812
+ vec3 calculateAmbientRadiance()
813
+ {
814
+ vec3 ambientLight = 1.2 * (0.282095 * vec3(shR[0], shG[0], shB[0])) - 0.2;
815
+ return ambientLight *= skyTransmittance;
816
+ }`)}var s=o(71651),l=o(65261),c=o(98619),u=o(22393),d=o(89786),m=o(32976),h=o(12791),f=o(5482),p=(o(44208),o(53966)),v=o(97768),g=o(17676),x=o(36708),b=o(91429),w=o(37585),y=o(31217),M=o(2016),S=o(48375),T=o(587),C=o(52516),I=o(13840),_=o(98958),z=o(90644);let P=class extends _.w{constructor(){super(...arguments),this.shader=new I.r(C.a,()=>o.e(2013).then(o.bind(o,42013)))}initializePipeline(){return(0,z.Ey)({colorWrite:z.kn})}};P=(0,f.Cg)([(0,b.$K)("esri.views.3d.webgl-engine.effects.globalIllumination.GlobalIlluminationBlurTechnique")],P);let F=class extends _.w{constructor(){super(...arguments),this.shader=new I.r(T.a,()=>o.e(9794).then(o.bind(o,89794)))}initializePipeline(){return(0,z.Ey)({colorWrite:z.kn})}};F=(0,f.Cg)([(0,b.$K)("esri.views.3d.webgl-engine.effects.globalIllumination.GlobalIlluminationTechnique")],F);var O=o(51976);class D extends O.K{constructor(){super(...arguments),this.hasEmission=!1}}(0,f.Cg)([(0,O.W)()],D.prototype,"hasEmission",void 0);var H=o(50704);let j=class extends _.w{constructor(){super(...arguments),this.shader=new I.r(H.a,()=>o.e(7891).then(o.bind(o,37891)))}initializePipeline(){return(0,z.Ey)({colorWrite:z.kn})}};j=(0,f.Cg)([(0,b.$K)("esri.views.3d.webgl-engine.effects.globalIllumination.GlobalIlluminationUpscaleTechnique")],j);var B=o(63907),N=o(76284),R=o(67171);let E=class extends S.A{constructor(e){super(e),this.consumes={required:["normals"]},this.produces=M.OG.AMBIENT_ILLUMINATION,this._passParameters=new T.G,this._drawParameters=new C.G,this._drawParametersUpscale=new H.G,this._maxFrames=255,this._configuration=new D,this._resetBuffer=!1}async initialize(){this._abortController=new AbortController;const e=this._abortController.signal;try{const t=(await o.e(5354).then(o.bind(o,45354))).data;(0,g.Te)(e),await this._loadBlueNoiseTexture(t,e),(0,g.Te)(e)}catch(e){(0,g.zf)(e)||p.A.getLogger(this).errorOnce("Failed to load blue noise texture:",e)}this.addHandles((0,x.wB)(()=>this.view.stage.renderer.hasGlobalIllumination,()=>{this.resetAccumulation(),this.requestRender(1)},x.pc))}precompile(){this._canRender&&(this._configuration.hasEmission=this.bindParameters.hasEmission,this.techniques.precompile(F,this._configuration),this.techniques.precompile(P),this.techniques.precompile(j))}destroy(){this._abortController=(0,v.DC)(this._abortController),this._passParameters.noiseTexture=(0,v.WD)(this._passParameters.noiseTexture)}render(e){const t=e.find(({name:e})=>"normals"===e),o=t?.getTexture(),r=t?.getTexture(B.nI),a=this._mode;if(!o||!r)return this._emptyOutput;if(2!==a&&this.resetAccumulation(),0===a)return this._resetBuffer=!1,this._emptyOutput;if(!this._canRender)return this._resetBuffer=!1,this.requestRender(1),this._emptyOutput;const n=this.bindParameters;this._configuration.hasEmission=n.hasEmission;const i=this.techniques.getCompiled(F,this._configuration),s=this.techniques.getCompiled(P),l=1===a?.25:1,c=l<1,u=c?this.techniques.getCompiled(j):null;if(!i||!s||c&&!u)return this.requestRender(1),this._emptyOutput;const d=this.renderingContext,{camera:m}=n;this._passParameters.normalTexture=o,this._passParameters.depthTexture=r,this._passParameters.projScale=1/m.computeScreenPixelSizeAtDist(1),this._passParameters.scaleGlobalIllumination=l;const{fullWidth:h,fullHeight:f}=m,p=Math.max(1,Math.floor(h*l)),v=Math.max(1,Math.floor(f*l)),g=this.fboCache.acquire(p,v,"global illumination input").acquireColor(B.yI,0);d.bindFramebuffer(g.fbo),d.setViewport(0,0,p,v),d.bindTechnique(i,n,this._passParameters,this._drawParameters),d.screen.draw();const x=g.obtainAttachment(B.yI),b=Math.max(1,Math.round(p/1)),y=Math.max(1,Math.round(v/1)),S=this.fboCache.acquire(b,y,"global illumination blur horizontal");d.bindFramebuffer(S.fbo),this._drawParameters.texture=g.getTexture(),this._drawParameters.weightTexture=x.attachment,(0,w.hZ)(this._drawParameters.blurSize,0,1/v),d.bindTechnique(s,n,this._passParameters,this._drawParameters),d.setViewport(0,0,b,y),d.screen.draw(),g.release();const T=c?"global illumination blur vertical":M.OG.AMBIENT_ILLUMINATION,C=this.fboCache.acquire(b,y,T);d.bindFramebuffer(C.fbo),d.setViewport(0,0,b,y),d.setClearColor(1,1,1,0),d.clear(16384),this._drawParameters.texture=S.getTexture(),this._drawParameters.weightTexture=x.attachment,(0,w.hZ)(this._drawParameters.blurSize,1/b,0),d.bindTechnique(s,n,this._passParameters,this._drawParameters),d.setViewport(0,0,b,y),d.screen.draw(),S.release(),C.attachColor(x,B.yI),x.release();let I=C;return u&&(I=this.fboCache.acquire(h,f,M.OG.AMBIENT_ILLUMINATION).acquireColor(B.yI,0),d.bindFramebuffer(I.fbo),d.setViewport(0,0,h,f),d.setClearColor(1,1,1,0),d.clear(16384),this._drawParametersUpscale.colorTexture=C.getTexture(),this._drawParametersUpscale.weightTexture=C.getTexture(B.yI),d.bindTechnique(u,n,this._passParameters,this._drawParametersUpscale),d.screen.draw(),C.release()),d.setViewport4fv(m.fullViewport),this._passParameters.frameCount=(this._passParameters.frameCount+1)%64,++this._passParameters.accumulatedFrames,this._passParameters.accumulatedFrames<this._maxFrames&&this.requestRender(1),I}get _emptyOutput(){const e=this.renderingContext,{fullWidth:t,fullHeight:o}=this.bindParameters.camera,r=this.fboCache.acquire(t,o,M.OG.AMBIENT_ILLUMINATION).acquireColor(B.yI,0);return e.bindFramebuffer(r.fbo),e.setViewport(0,0,t,o),e.clearBuffer(0,[0,0,0,1]),e.clearBuffer(1,[0,0,0,0]),r}async _loadBlueNoiseTexture(e,t){(0,g.Te)(t);const o=await(0,y.D)(e,{signal:t});if((0,g.Te)(t),!o)return;const r=new R.R;r.internalFormat=B.H0.RGBA8,r.wrapMode=10497,r.isImmutable=!0,this._passParameters.noiseTexture=new N.A(this.renderingContext,r,o)}get _canRender(){const e=this.bindParameters;return!(!this._passParameters.noiseTexture||e.hasEmission&&!e.reprojection.lastFrameEmission||!e.reprojection.lastFrameDepth||!e.globalIllumination||this._resetBuffer)}get _mode(){const{hasGlobalIlluminationHighQuality:e,hasGlobalIllumination:t}=this.view.stage.renderer;return e?2:t?1:0}resetAccumulation(){this._passParameters.accumulatedFrames=0}get test(){}};function G(e,t){t.receiveGlobalIllumination?(e.uniforms.add(new m.o("hasGlobalIlluminationTexture",e=>null!=e.globalIllumination),new h.x("globalIlluminationTexture",e=>e.globalIllumination?.getTexture())),e.constants.add("blurSizePixelsInverse","float",1),e.code.add(n.H`vec3 readGlobalIlluminationOcclusionInverse() {
817
+ if (!hasGlobalIlluminationTexture) {
818
+ return vec3(1.0);
819
+ }
820
+ ivec2 texel = ivec2(gl_FragCoord.xy * blurSizePixelsInverse);
821
+ return vec3(texelFetch(globalIlluminationTexture, texel, 0).a);
822
+ }
823
+ vec3 readGlobalIlluminationOcclusion() {
824
+ return 1.0 - readGlobalIlluminationOcclusionInverse();
825
+ }
826
+ vec4 readGlobalIlluminationEmissionInverse() {
827
+ if (!hasGlobalIlluminationTexture) {
828
+ return vec4(1.0);
829
+ }
830
+ ivec2 texel = ivec2(gl_FragCoord.xy * blurSizePixelsInverse);
831
+ return 1.0 - vec4(texelFetch(globalIlluminationTexture, texel, 0).rgb, 0.0);
832
+ }
833
+ vec4 readGlobalIlluminationEmission() {
834
+ return max((1.0 - readGlobalIlluminationEmissionInverse() - 0.01) / 0.99, 0.0);
835
+ }`)):e.code.add(n.H`vec3 readGlobalIlluminationOcclusionInverse() { return vec3(1.0); }
836
+ vec3 readGlobalIlluminationOcclusion() { return vec3(0.0); }
837
+ vec4 readGlobalIlluminationEmissionInverse() { return vec4(1.0); }
838
+ vec4 readGlobalIlluminationEmission() { return vec4(0.0); }`)}(0,f.Cg)([(0,b.MZ)()],E.prototype,"consumes",void 0),(0,f.Cg)([(0,b.MZ)()],E.prototype,"produces",void 0),(0,f.Cg)([(0,b.MZ)()],E.prototype,"_abortController",void 0),E=(0,f.Cg)([(0,b.$K)("esri.views.3d.webgl-engine.effects.globalIllumination.GlobalIllumination")],E);var A=o(33094),W=o(57226);function L(e){e.code.add(n.H`float mapChannel(float x, vec2 p) {
839
+ return (x < p.x) ? mix(0.0, p.y, x/p.x) : mix(p.y, 1.0, (x - p.x) / (1.0 - p.x) );
840
+ }`),e.code.add(n.H`vec3 blackLevelSoftCompression(vec3 color, float averageAmbientRadiance) {
841
+ vec2 p = vec2(0.02, 0.0075) * averageAmbientRadiance;
842
+ return vec3(mapChannel(color.x, p), mapChannel(color.y, p), mapChannel(color.z, p));
843
+ }`)}function V(e){e.code.add(n.H`vec3 tonemapACES(vec3 x) {
844
+ return clamp((x * (2.51 * x + 0.03)) / (x * (2.43 * x + 0.59) + 0.14), 0.0, 1.0);
845
+ }`),e.code.add(n.H`vec3 tonemapKhronosNeutral(vec3 color, float exposure) {
846
+ const float startCompression = 0.76;
847
+ const float desaturation = 0.15;
848
+ color *= exposure;
849
+ float x = min( color.r, min( color.g, color.b ) );
850
+ float offset = x < 0.08 ? x - 6.25 * x * x : 0.04;
851
+ color -= offset;
852
+ float peak = max( color.r, max( color.g, color.b ) );
853
+ if ( peak < startCompression ) {
854
+ return color;
855
+ }
856
+ float d = 1.0 - startCompression;
857
+ float newPeak = 1.0 - d * d / ( peak + d - startCompression );
858
+ color *= newPeak / peak;
859
+ float g = 1.0 - 1.0 / ( desaturation * ( peak - newPeak ) + 1.0 );
860
+ return mix( color, vec3( newPeak ), g );
861
+ }`)}function U(e){e.constants.add("ambientBoostFactor","float",W.uH)}function k(e){e.uniforms.add(new A.U("lightingGlobalFactor",e=>e.lighting.globalFactor))}function q(e,t){const{pbrMode:o,spherical:r,hasColorTexture:a,receiveGlobalIllumination:h}=t;e.include(l.C),e.include(G,t),e.include(s.n,t),0!==o&&e.include(u.c,t),e.include(i,t),e.include(d.p),e.include(V,t);const f=!(2===o&&!a);f&&e.include(L),U(e),k(e),(0,c.Gc)(e),e.code.add(n.H`
862
+ float additionalDirectedAmbientLight(float lightAlignment) {
863
+ return smoothstep(0.0, 1.0, clamp(lightAlignment * 2.5, 0.0, 1.0));
864
+ }
865
+
866
+ float additionalDirectedAmbientLight(vec3 vPosWorld) {
867
+ float lightAlignment = dot(${r?n.H`normalize(vPosWorld)`:n.H`vec3(0.0, 0.0, 1.0)`}, mainLightDirection);
868
+ return smoothstep(0.0, 1.0, clamp(lightAlignment * 2.5, 0.0, 1.0));
869
+ }
870
+ `),(0,c.O4)(e),e.code.add(n.H`vec3 evaluateAdditionalLighting(float ambientOcclusion, vec3 vPosWorld) {
871
+ float additionalAmbientScale = additionalDirectedAmbientLight(vPosWorld);
872
+ return (1.0 - ambientOcclusion) * additionalAmbientScale * ambientBoostFactor * lightingGlobalFactor * mainLightIntensity;
873
+ }`);const p=h?"globalIlluminationOcclusion":"ssao",v=h?.75:1,g=h?1.5:1;switch(o){case 0:case 4:case 3:e.include(c.Vt),e.code.add(n.H`vec3 evaluateSceneLighting(vec3 normalWorld, vec3 albedo, float shadow, float ssao, vec3 additionalLight) {
874
+ vec3 mainLighting = applyShading(normalWorld, shadow);
875
+ vec3 ambientLighting = calculateAmbientIrradiance(normalWorld) * (1.0 - ssao);
876
+ vec3 albedoLinear = linearizeGamma(albedo);
877
+ vec3 totalLight = mainLighting + ambientLighting + additionalLight;
878
+ totalLight = min(totalLight, vec3(PI));
879
+ vec3 outColor = vec3((albedoLinear / PI) * totalLight);
880
+ return delinearizeGamma(outColor);
881
+ }`);break;case 1:case 2:{const o=h?.35:.2;e.code.add(n.H`
882
+ const float fillLightIntensity = 0.25;
883
+ const float horizonLightDiffusion = 0.4;
884
+ const float additionalAmbientIrradianceFactor = 0.02;
885
+ const float groundReflectance = ${n.H.float(o)};
886
+
887
+ vec3 evaluateSceneLightingPBR(vec3 normal, vec3 albedo, float shadow, float ssao, vec3 additionalLight,
888
+ vec3 viewDirection, vec3 upDirection, vec3 mrr, float additionalAmbientIrradiance) {
889
+ PBRShadingInfo inputs;
890
+ calculatePBRInputs(inputs, normal, viewDirection, upDirection, albedo, mrr);
891
+
892
+ ${(0,n.If)(h,n.H`vec3 globalIlluminationOcclusion = min(1.2 * readGlobalIlluminationOcclusion(), 1.0);`)}
893
+ `),t.useFillLights?e.uniforms.add(new m.o("hasFillLights",e=>e.enableFillLights)):e.constants.add("hasFillLights","bool",!1),e.code.add(n.H`
894
+ vec3 ambientDir = vec3(5.0 * upDirection[1] - upDirection[0] * upDirection[2], - 5.0 * upDirection[0] - upDirection[2] * upDirection[1], upDirection[1] * upDirection[1] + upDirection[0] * upDirection[0]);
895
+ ambientDir = ambientDir != vec3(0.0) ? normalize(ambientDir) : normalize(vec3(5.0, -1.0, 0.0));
896
+
897
+ inputs.NdotAmbDir = hasFillLights ? abs(dot(normal, ambientDir)) : 1.0;
898
+
899
+ // Calculate the irradiance components: sun, fill lights and the sky.
900
+ vec3 mainLightIrradianceComponent = ${n.H.float(v)} * inputs.NdotL * (1.0 - shadow) * mainLightIntensity;
901
+ vec3 fillLightsIrradianceComponent = inputs.NdotAmbDir * mainLightIntensity * fillLightIntensity;
902
+ // calculate ambient irradiance for localView and additionalLight for globalView
903
+ vec3 ambientLightIrradianceComponent = ${n.H.float(g)} * calculateAmbientIrradiance(normal) * (1.0 - ${p}) + additionalLight;
904
+
905
+ // Assemble the overall irradiance of the sky that illuminates the surface
906
+ inputs.skyIrradianceToSurface = ambientLightIrradianceComponent + mainLightIrradianceComponent + fillLightsIrradianceComponent ;
907
+ // Assemble the overall irradiance of the ground that illuminates the surface. for this we use the simple model that changes only the sky irradiance by the groundReflectance
908
+ inputs.groundIrradianceToSurface = groundReflectance * ambientLightIrradianceComponent + mainLightIrradianceComponent + fillLightsIrradianceComponent ;
909
+ `),e.uniforms.add(new A.U("lightingSpecularStrength",e=>e.lighting.mainLight.specularStrength),new A.U("lightingEnvironmentStrength",e=>e.lighting.mainLight.environmentStrength)).code.add(n.H`
910
+ vec3 horizonRingDir = inputs.RdotUP * upDirection - inputs.reflectedView;
911
+ vec3 horizonRingH = normalize(horizonRingDir - viewDirection);
912
+ inputs.NdotH_Horizon = dot(normal, horizonRingH);
913
+
914
+ vec3 mainLightRadianceComponent = lightingSpecularStrength * normalDistribution(inputs.NdotH, inputs.roughness) * mainLightIntensity * (1.0 - shadow);
915
+ vec3 horizonLightRadianceComponent = lightingEnvironmentStrength * normalDistribution(inputs.NdotH_Horizon, min(inputs.roughness + horizonLightDiffusion, 1.0)) * mainLightIntensity * fillLightIntensity;
916
+
917
+ // calculateAmbientRadiance for localView and additionalLight for global view
918
+ vec3 ambientLightRadianceComponent = lightingEnvironmentStrength * calculateAmbientRadiance() * (1.0 - ${p}) + additionalLight;
919
+ float normalDirectionModifier = mix(1., min(mix(0.1, 2.0, (inputs.NdotUP + 1.) * 0.5), 1.0), clamp(inputs.roughness * 5.0, 0.0 , 1.0));
920
+
921
+ // Assemble the overall radiance of the sky that illuminates the surface
922
+ inputs.skyRadianceToSurface = (ambientLightRadianceComponent + horizonLightRadianceComponent) * normalDirectionModifier + mainLightRadianceComponent;
923
+
924
+ // Assemble the overall radiance of the ground that illuminates the surface. for this we use the simple model that changes only the sky radiance by the groundReflectance
925
+ inputs.groundRadianceToSurface = 0.5 * groundReflectance * (ambientLightRadianceComponent + horizonLightRadianceComponent) * normalDirectionModifier + mainLightRadianceComponent;
926
+
927
+ // Calculate average ambient radiance - This is used in the gamut mapping process to determine the black level for compression
928
+ inputs.averageAmbientRadiance = ambientLightIrradianceComponent[1] * (1.0 + groundReflectance);
929
+ `),e.code.add(n.H`
930
+ vec3 reflectedColorComponent = evaluateEnvironmentIllumination(inputs);
931
+ vec3 additionalMaterialReflectanceComponent = inputs.albedoLinear * additionalAmbientIrradiance;
932
+ vec3 outColorLinear = reflectedColorComponent + additionalMaterialReflectanceComponent;
933
+
934
+ ${(0,n.If)(h,n.H`
935
+ vec3 globalIlluminationEmission = 2.25 * (0.75 * inputs.albedoLinear + 0.25) * readGlobalIlluminationEmission().rgb;
936
+ outColorLinear += globalIlluminationEmission;`)}
937
+
938
+ ${f?n.H`vec3 adjustedOutColorLinear = blackLevelSoftCompression(outColorLinear, inputs.averageAmbientRadiance);`:n.H`vec3 adjustedOutColorLinear = max(vec3(0.0), outColorLinear - 0.005 * inputs.averageAmbientRadiance);`}
939
+
940
+ return delinearizeGamma(adjustedOutColorLinear);
941
+ }
942
+ `);break}case 5:case 6:{const t=h?.35:.5,o=h?.75:1,r=h?1.5:1;(0,c.Gc)(e),(0,c.O4)(e),e.code.add(n.H`
943
+ const float roughnessTerrain = 0.5;
944
+ const float specularityTerrain = ${n.H.float(t)};
945
+
946
+ vec3 evaluatePBRSimplifiedLighting(vec3 normal, vec3 albedo, float shadow, float ssao, vec3 additionalLight, vec3 viewDirection, vec3 upDirection) {
947
+ PBRShadingInfo inputs;
948
+ calculateSimplifiedInputs(inputs, normal, viewDirection, upDirection, albedo);
949
+
950
+ ${(0,n.If)(h,n.H`vec3 globalIlluminationOcclusion = min(1.2 * readGlobalIlluminationOcclusion(), 1.0);`)}
951
+
952
+ vec3 mainLightIrradianceComponent = ${n.H.float(o)} * (1.0 - shadow) * inputs.NdotL * mainLightIntensity;
953
+ vec3 ambientLightIrradianceComponent = ${n.H.float(r)} * calculateAmbientIrradiance(normal) * (1.0 - ${p}) + additionalLight;
954
+ vec3 ambientSky = ambientLightIrradianceComponent + mainLightIrradianceComponent;
955
+
956
+ vec3 indirectDiffuse = ((1.0 - inputs.NdotUP) * mainLightIrradianceComponent + (1.0 + inputs.NdotUP ) * ambientSky) * 0.5;
957
+ vec3 outDiffColor = inputs.albedoLinear * (1.0 - inputs.f0) * indirectDiffuse / PI;
958
+
959
+ vec3 mainLightRadianceComponent = normalDistribution(inputs.NdotH, roughnessTerrain) * mainLightIntensity;
960
+ vec2 dfg = prefilteredDFGAnalytical(roughnessTerrain, inputs.NdotV);
961
+ vec3 specularColor = inputs.f0 * dfg.x + inputs.f90 * dfg.y;
962
+ vec3 specularComponent = specularityTerrain * specularColor * mainLightRadianceComponent;
963
+
964
+ vec3 outColorLinear = outDiffColor + specularComponent;
965
+
966
+ ${(0,n.If)(h,n.H`
967
+ vec3 globalIlluminationEmission = 2.25 * (0.75 * inputs.albedoLinear + 0.25) * readGlobalIlluminationEmission().rgb;
968
+ outColorLinear += globalIlluminationEmission;`)}
969
+
970
+ return delinearizeGamma(outColorLinear);
971
+ }
972
+ `);break}}}},65261(e,t,o){o.d(t,{C:()=>n});var r=o(40876),a=o(31821);function n(e){e.constants.add("GAMMA","float",r.Tf).constants.add("INV_GAMMA","float",1/r.Tf).code.add(a.H`vec3 delinearizeGamma(vec3 color) {
973
+ return pow(color, vec3(INV_GAMMA));
974
+ }
975
+ vec4 delinearizeGamma(vec4 color) {
976
+ return vec4(delinearizeGamma(color.rgb), color.a);
977
+ }
978
+ vec3 linearizeGamma(vec3 color) {
979
+ return pow(color, vec3(GAMMA));
980
+ }`)}},72885(e,t,o){o.d(t,{Q:()=>a});var r=o(31821);function a(e){e.fragment.code.add(r.H`
981
+ float globalIlluminationNormalSimilarityWeight(vec3 sampleNormal, vec3 centerNormal) {
982
+ bool isScaledGlobalIllumination = scaleGlobalIllumination < 1.0;
983
+ float normalSimilarityMultiplier = isScaledGlobalIllumination ? ${r.H.float(.4)} : 1.0;
984
+ return clamp(1.0 - ${r.H.float(15.3)} * length(sampleNormal - centerNormal) * normalSimilarityMultiplier, 0.0, 1.0);
985
+ }
986
+
987
+ float globalIlluminationDepthNormalCorrection(vec3 encodedNormal) {
988
+ vec3 decodedNormal = normalize(encodedNormal * 2.0 - 1.0);
989
+ return pow(max((1.0 - abs(decodedNormal.x)) * (1.0 - abs(decodedNormal.y)), 0.01), ${r.H.float(5)});
990
+ }
991
+
992
+ float globalIlluminationDepthSharpness(float projScale, float depth) {
993
+ return ${r.H.float(-.05)} * projScale / depth;
994
+ }
995
+
996
+ float globalIlluminationDepthSharpness(float projScale, float depth, vec3 encodedNormal) {
997
+ return globalIlluminationDepthSharpness(projScale, depth) * globalIlluminationDepthNormalCorrection(encodedNormal);
998
+ }
999
+ `)}},98619(e,t,o){o.d(t,{Gc:()=>n,O4:()=>i,Vt:()=>s});var r=o(23205),a=o(31821);function n(e){e.uniforms.add(new r.d("mainLightDirection",e=>e.lighting.mainLight.direction))}function i(e){e.uniforms.add(new r.d("mainLightIntensity",e=>e.lighting.mainLight.intensity))}function s(e){n(e),i(e),e.code.add(a.H`vec3 applyShading(vec3 shadingNormal, float shadow) {
1000
+ float dotVal = clamp(dot(shadingNormal, mainLightDirection), 0.0, 1.0);
1001
+ return mainLightIntensity * ((1.0 - shadow) * dotVal);
1002
+ }`)}},62602(e,t,o){o.d(t,{r:()=>a});var r=o(31821);function a(e,t){const o=e.fragment;switch(o.code.add(r.H`struct ShadingNormalParameters {
1003
+ vec3 normalView;
1004
+ vec3 viewDirection;
1005
+ } shadingParams;`),t.doubleSidedMode){case 0:o.code.add(r.H`vec3 shadingNormal(ShadingNormalParameters params) {
1006
+ return normalize(params.normalView);
1007
+ }`);break;case 1:o.code.add(r.H`vec3 shadingNormal(ShadingNormalParameters params) {
1008
+ return dot(params.normalView, params.viewDirection) > 0.0 ? normalize(-params.normalView) : normalize(params.normalView);
1009
+ }`);break;case 2:o.code.add(r.H`vec3 shadingNormal(ShadingNormalParameters params) {
1010
+ return gl_FrontFacing ? normalize(params.normalView) : normalize(-params.normalView);
1011
+ }`);break;default:t.doubleSidedMode;case 3:}}},22393(e,t,o){o.d(t,{c:()=>s});var r=o(31821);function a(e){e.code.add(r.H`vec3 evaluateDiffuseIlluminationHemisphere(vec3 ambientGround, vec3 ambientSky, float NdotNG) {
1012
+ return ((1.0 - NdotNG) * ambientGround + (1.0 + NdotNG) * ambientSky) * 0.5;
1013
+ }`),e.code.add(r.H`float integratedRadiance(float cosTheta2, float roughness) {
1014
+ return (cosTheta2 - 1.0) / (cosTheta2 * (1.0 - roughness * roughness) - 1.0);
1015
+ }`),e.code.add(r.H`vec3 evaluateSpecularIlluminationHemisphere(vec3 ambientGround, vec3 ambientSky, float RdotNG, float roughness) {
1016
+ float cosTheta2 = 1.0 - RdotNG * RdotNG;
1017
+ float intRadTheta = integratedRadiance(cosTheta2, roughness);
1018
+ float ground = RdotNG < 0.0 ? 1.0 - intRadTheta : 1.0 + intRadTheta;
1019
+ float sky = 2.0 - ground;
1020
+ return (ground * ambientGround + sky * ambientSky) * 0.5;
1021
+ }`)}var n=o(65261),i=o(89786);function s(e,t){e.include(n.C),e.include(i.p),1!==t.pbrMode&&2!==t.pbrMode&&5!==t.pbrMode&&6!==t.pbrMode||(e.code.add(r.H`float normalDistribution(float NdotH, float roughness)
1022
+ {
1023
+ float a = NdotH * roughness;
1024
+ float b = roughness / (1.0 - NdotH * NdotH + a * a);
1025
+ return b * b * INV_PI;
1026
+ }`),e.code.add(r.H`const vec4 c0 = vec4(-1.0, -0.0275, -0.572, 0.022);
1027
+ const vec4 c1 = vec4( 1.0, 0.0425, 1.040, -0.040);
1028
+ const vec2 c2 = vec2(-1.04, 1.04);
1029
+ vec2 prefilteredDFGAnalytical(float roughness, float NdotV) {
1030
+ vec4 r = roughness * c0 + c1;
1031
+ float a004 = min(r.x * r.x, exp2(-9.28 * NdotV)) * r.x + r.y;
1032
+ return c2 * a004 + r.zw;
1033
+ }`),e.code.add(r.H`struct PBRShadingInfo
1034
+ {
1035
+ float NdotV;
1036
+ float NdotL;
1037
+ float LdotH;
1038
+ float NdotUP;
1039
+ float RdotUP;
1040
+ float NdotAmbDir;
1041
+ float NdotH_Horizon;
1042
+ float NdotH;
1043
+ vec3 skyRadianceToSurface;
1044
+ vec3 groundRadianceToSurface;
1045
+ vec3 skyIrradianceToSurface;
1046
+ vec3 groundIrradianceToSurface;
1047
+ vec3 reflectedView;
1048
+ float averageAmbientRadiance;
1049
+ vec3 albedoLinear;
1050
+ vec3 f0;
1051
+ vec3 f90;
1052
+ vec3 diffuseColor;
1053
+ float metalness;
1054
+ float roughness;
1055
+ };`),e.code.add(r.H`void calculateCommonInputs(out PBRShadingInfo inputs, vec3 normal, vec3 viewDirection, vec3 upDirection, vec3 albedo) {
1056
+ vec3 h = normalize(mainLightDirection - viewDirection);
1057
+ inputs.NdotV = clamp(abs(dot(normal, -viewDirection)), 0.001, 1.0);
1058
+ inputs.NdotUP = clamp(dot(normal, upDirection), -1.0, 1.0);
1059
+ inputs.reflectedView = normalize(reflect(-viewDirection, normal));
1060
+ inputs.RdotUP = clamp(dot(inputs.reflectedView, upDirection), -1.0, 1.0);
1061
+ inputs.albedoLinear = linearizeGamma(albedo);
1062
+ inputs.NdotH = clamp(dot(normal, h), 0.0, 1.0);
1063
+ inputs.NdotL = clamp(dot(normal, mainLightDirection), 0.001, 1.0);
1064
+ }`)),1!==t.pbrMode&&2!==t.pbrMode||(e.include(a),e.code.add(r.H`vec3 evaluateEnvironmentIllumination(PBRShadingInfo inputs) {
1065
+ vec3 indirectDiffuse = evaluateDiffuseIlluminationHemisphere(inputs.groundIrradianceToSurface, inputs.skyIrradianceToSurface, inputs.NdotUP);
1066
+ vec3 indirectSpecular = evaluateSpecularIlluminationHemisphere(inputs.groundRadianceToSurface, inputs.skyRadianceToSurface, inputs.RdotUP, inputs.roughness);
1067
+ vec3 diffuseComponent = inputs.diffuseColor * indirectDiffuse * INV_PI;
1068
+ vec2 dfg = prefilteredDFGAnalytical(inputs.roughness, inputs.NdotV);
1069
+ vec3 specularColor = inputs.f0 * dfg.x + inputs.f90 * dfg.y;
1070
+ vec3 specularComponent = specularColor * indirectSpecular;
1071
+ return (diffuseComponent + specularComponent);
1072
+ }`),e.code.add(r.H`void calculatePBRInputs(out PBRShadingInfo inputs, vec3 normal, vec3 viewDirection, vec3 upDirection, vec3 albedo, vec3 mrr) {
1073
+ calculateCommonInputs(inputs, normal, viewDirection, upDirection, albedo);
1074
+ inputs.metalness = mrr[0];
1075
+ inputs.roughness = clamp(mrr[1] * mrr[1], 0.001, 0.99);
1076
+ inputs.f0 = (0.16 * mrr[2] * mrr[2]) * (1.0 - inputs.metalness) + inputs.albedoLinear * inputs.metalness;
1077
+ inputs.f90 = vec3(clamp(dot(inputs.f0, vec3(50.0 * 0.33)), 0.0, 1.0));
1078
+ inputs.diffuseColor = inputs.albedoLinear * (vec3(1.0) - inputs.f0) * (1.0 - inputs.metalness);
1079
+ }`)),5!==t.pbrMode&&6!==t.pbrMode||e.code.add(r.H`const vec3 fresnelReflectionSimplified = vec3(0.04);
1080
+ void calculateSimplifiedInputs(out PBRShadingInfo inputs, vec3 normal, vec3 viewDirection, vec3 upDirection, vec3 albedo) {
1081
+ calculateCommonInputs(inputs, normal, viewDirection, upDirection, albedo);
1082
+ float lightness = 0.3 * inputs.albedoLinear[0] + 0.5 * inputs.albedoLinear[1] + 0.2 * inputs.albedoLinear[2];
1083
+ inputs.f0 = (0.85 * lightness + 0.15) * fresnelReflectionSimplified;
1084
+ inputs.f90 = vec3(clamp(dot(inputs.f0, vec3(50.0 * 0.33)), 0.0, 1.0));
1085
+ }`)}},59469(e,t,o){o.d(t,{_:()=>c});var r=o(99208),a=o(40710),n=o(33079),i=o(31821),s=o(15976),l=o(63761);function c(e,t){const o=t.pbrMode,c=e.fragment;if(2!==o&&0!==o&&1!==o)return void c.code.add(i.H`void applyPBRFactors() {}`);if(0===o)return void c.code.add(i.H`void applyPBRFactors() {}
1086
+ float getBakedOcclusion() { return 1.0; }`);if(2===o)return void c.code.add(i.H`vec3 mrr = vec3(0.0, 0.6, 0.2);
1087
+ float occlusion = 1.0;
1088
+ void applyPBRFactors() {}
1089
+ float getBakedOcclusion() { return 1.0; }`);const{hasMetallicRoughnessTexture:u,hasMetallicRoughnessTextureTransform:d,hasOcclusionTexture:m,hasOcclusionTextureTransform:h,bindType:f}=t;(u||m)&&e.include(r.r,t),c.code.add(i.H`vec3 mrr;
1090
+ float occlusion;`),u&&c.uniforms.add(1===f?new l.N("texMetallicRoughness",e=>e.textureMetallicRoughness):new s.o("texMetallicRoughness",e=>e.textureMetallicRoughness)),m&&c.uniforms.add(1===f?new l.N("texOcclusion",e=>e.textureOcclusion):new s.o("texOcclusion",e=>e.textureOcclusion)),c.uniforms.add(1===f?new n.t("mrrFactors",e=>e.mrrFactors):new a.W("mrrFactors",e=>e.mrrFactors)),c.code.add(i.H`
1091
+ ${(0,i.If)(u,i.H`void applyMetallicRoughness(vec2 uv) {
1092
+ vec3 metallicRoughness = textureLookup(texMetallicRoughness, uv).rgb;
1093
+ mrr[0] *= metallicRoughness.b;
1094
+ mrr[1] *= metallicRoughness.g;
1095
+ }`)}
1096
+
1097
+ ${(0,i.If)(m,"void applyOcclusion(vec2 uv) { occlusion *= textureLookup(texOcclusion, uv).r; }")}
1098
+
1099
+ float getBakedOcclusion() {
1100
+ return ${m?"occlusion":"1.0"};
1101
+ }
1102
+
1103
+ void applyPBRFactors() {
1104
+ mrr = mrrFactors;
1105
+ occlusion = 1.0;
1106
+
1107
+ ${(0,i.If)(u,`applyMetallicRoughness(${d?"metallicRoughnessUV":"vuv0"});`)}
1108
+ ${(0,i.If)(m,`applyOcclusion(${h?"occlusionUV":"vuv0"});`)}
1109
+ }
1110
+ `)}(o(74810),o(65786)).Y},32482(e,t,o){o.d(t,{LA:()=>M,QH:()=>y}),o(51850);var r=o(46686),a=o(49255),n=o(31821);function i(e,t){const o=(0,a._o)(t.output)&&t.receiveShadows;o&&(0,r.o)(e,!0),e.vertex.code.add(n.H`
1111
+ void forwardLinearDepthToReadShadowMap() { ${(0,n.If)(o,"forwardLinearDepth(gl_Position.w);")} }
1112
+ `)}var s=o(14314),l=o(35818),c=o(74333);class u extends c.n{constructor(e,t,o,r){super(e,"mat4",2,(o,a,n,i)=>o.setUniformMatrices4fv(e,t(a,n,i),r),o)}}class d extends c.n{constructor(e,t,o,r){super(e,"mat4",1,(o,a,n)=>o.setUniformMatrices4fv(e,t(a,n),r),o)}}var m=o(65786);function h(e){e.uniforms.add(new d("shadowMapMatrix",(e,t)=>t.shadowMap.getShadowMapMatrices(e.origin),4)),e.include(p)}function f(e){e.uniforms.add(new u("shadowMapMatrix",(e,t)=>t.shadowMap.getShadowMapMatrices(e.origin),4)),e.include(p)}function p(e){e.uniforms.add(new s.I("cascadeDistances",e=>e.shadowMap.cascadeDistances),new l.W("numCascades",e=>e.shadowMap.numCascades)),e.code.add(v)}m.Y;const v=n.H`const vec3 invalidShadowmapUVZ = vec3(0.0, 0.0, -1.0);
1113
+ vec3 lightSpacePosition(vec3 _vpos, mat4 mat) {
1114
+ vec4 lv = mat * vec4(_vpos, 1.0);
1115
+ lv.xy /= lv.w;
1116
+ return 0.5 * lv.xyz + vec3(0.5);
1117
+ }
1118
+ vec2 cascadeCoordinates(int i, ivec2 textureSize, vec3 lvpos) {
1119
+ float xScale = float(textureSize.y) / float(textureSize.x);
1120
+ return vec2((float(i) + lvpos.x) * xScale, lvpos.y);
1121
+ }
1122
+ vec3 calculateUVZShadow(in vec3 _worldPos, in float _linearDepth, in ivec2 shadowMapSize) {
1123
+ int i = _linearDepth < cascadeDistances[1] ? 0 : _linearDepth < cascadeDistances[2] ? 1 : _linearDepth < cascadeDistances[3] ? 2 : 3;
1124
+ if (i >= numCascades) {
1125
+ return invalidShadowmapUVZ;
1126
+ }
1127
+ mat4 shadowMatrix = i == 0 ? shadowMapMatrix[0] : i == 1 ? shadowMapMatrix[1] : i == 2 ? shadowMapMatrix[2] : shadowMapMatrix[3];
1128
+ vec3 lvpos = lightSpacePosition(_worldPos, shadowMatrix);
1129
+ if (lvpos.z >= 1.0 || lvpos.x < 0.0 || lvpos.x > 1.0 || lvpos.y < 0.0 || lvpos.y > 1.0) {
1130
+ return invalidShadowmapUVZ;
1131
+ }
1132
+ vec2 uvShadow = cascadeCoordinates(i, shadowMapSize, lvpos);
1133
+ return vec3(uvShadow, lvpos.z);
1134
+ }`;function g(e){e.code.add(n.H`float readShadowMapUVZ(vec3 uvzShadow, sampler2DShadow _shadowMap) {
1135
+ return texture(_shadowMap, uvzShadow);
1136
+ }`)}o(32976);var x=o(33094),b=o(12791);class w extends c.n{constructor(e,t){super(e,"sampler2DShadow",0,(o,r)=>o.bindTexture(e,t(r)))}}function y(e,t){t.receiveShadows&&e.fragment.include(h),S(e,t)}function M(e,t){t.receiveShadows&&e.fragment.include(f),S(e,t)}function S(e,t){e.fragment.uniforms.add(new x.U("lightingGlobalFactor",e=>e.lighting.globalFactor));const{hasShadowHighlights:o,receiveShadows:r,spherical:a}=t;e.include(i,t),r&&function(e,t){(function(e,t){e.include(g),e.uniforms.add(T()),t&&e.uniforms.add(new b.x("shadowHighlight",({shadowHighlight:e})=>e?.getTexture())),e.code.add(n.H`
1137
+ float readShadowMaps(const in vec3 uvzShadow) {
1138
+ if (uvzShadow.z < 0.0) {
1139
+ return 0.0;
1140
+ }
1141
+
1142
+ float shadow1 = readShadowMapUVZ(uvzShadow, shadowMap);
1143
+ ${(0,n.If)(t,"float shadow2 = texelFetch(shadowHighlight, ivec2(gl_FragCoord.xy), 0).r;\n return shadow1 > shadow2 ? shadow1 : shadow2;","return shadow1;")}
1144
+ }
1145
+ `)})(e,t),function(e){e.code.add(n.H`float readShadowMap(const in vec3 _worldPos, float _linearDepth) {
1146
+ vec3 uvzShadow = calculateUVZShadow(_worldPos, _linearDepth, textureSize(shadowMap, 0));
1147
+ return readShadowMaps(uvzShadow);
1148
+ }`)}(e)}(e.fragment,o),e.fragment.code.add(n.H`
1149
+ float readShadow(float additionalAmbientScale, vec3 vpos) {
1150
+ return ${r?"max(lightingGlobalFactor * (1.0 - additionalAmbientScale), readShadowMap(vpos, linearDepth))":(0,n.If)(a,"lightingGlobalFactor * (1.0 - additionalAmbientScale)","0.0")};
1151
+ }
1152
+ `)}function T(){return new w("shadowMap",({shadowMap:e})=>e.getOutput(5)??e.getOutput(7))}m.Y},96608(e,t,o){o.d(t,{t:()=>c});var r=o(52540),a=o(77108),n=o(33094),i=o(31821),s=o(58029),l=o(12791);function c(e,t){if(!t.screenSpaceReflections)return;const o=e.fragment;o.include(r.E),o.uniforms.add(new a.E("nearFar",e=>e.camera.nearFar),new l.x("depthMap",e=>e.depth?.attachment),new s.F("proj",e=>e.camera.projectionMatrix),new n.U("invResolutionHeight",e=>1/e.camera.height),new s.F("reprojectionMatrix",e=>e.reprojection.matrix)).code.add(i.H`
1153
+ vec2 reprojectionCoordinate(vec3 projectionCoordinate)
1154
+ {
1155
+ vec4 zw = proj * vec4(0.0, 0.0, -projectionCoordinate.z, 1.0);
1156
+ vec4 reprojectedCoord = reprojectionMatrix * vec4(zw.w * (projectionCoordinate.xy * 2.0 - 1.0), zw.z, zw.w);
1157
+ reprojectedCoord.xy /= reprojectedCoord.w;
1158
+ return reprojectedCoord.xy * 0.5 + 0.5;
1159
+ }
1160
+
1161
+ vec4 applyProjectionMat(mat4 projectionMat, vec3 x)
1162
+ {
1163
+ vec4 projectedCoord = projectionMat * vec4(x, 1.0);
1164
+ projectedCoord.xy /= projectedCoord.w;
1165
+ projectedCoord.xy = projectedCoord.xy*0.5 + 0.5;
1166
+ return projectedCoord;
1167
+ }
1168
+
1169
+ vec3 screenSpaceIntersection(vec3 dir, vec3 startPosition, vec3 viewDir, vec3 normal, float offset, bool globalIllumination)
1170
+ {
1171
+ vec3 viewPos = startPosition;
1172
+ vec3 viewPosEnd = startPosition;
1173
+
1174
+ // Project the start position to the screen
1175
+ vec4 projectedCoordStart = applyProjectionMat(proj, viewPos);
1176
+ vec3 Q0 = viewPos / projectedCoordStart.w; // homogeneous camera space
1177
+ float k0 = 1.0/ projectedCoordStart.w;
1178
+
1179
+ // advance the position in the direction of the reflection
1180
+ viewPos += dir;
1181
+
1182
+ vec4 projectedCoordVanishingPoint = applyProjectionMat(proj, dir);
1183
+
1184
+ // Project the advanced position to the screen
1185
+ vec4 projectedCoordEnd = applyProjectionMat(proj, viewPos);
1186
+ vec3 Q1 = viewPos / projectedCoordEnd.w; // homogeneous camera space
1187
+ float k1 = 1.0/ projectedCoordEnd.w;
1188
+
1189
+ // calculate the reflection direction in the screen space
1190
+ vec2 projectedCoordDir = (projectedCoordEnd.xy - projectedCoordStart.xy);
1191
+ vec2 projectedCoordDistVanishingPoint = (projectedCoordVanishingPoint.xy - projectedCoordStart.xy);
1192
+
1193
+ float maxReach = globalIllumination ? 0.15 : 1.0;
1194
+ float distMod = min(globalIllumination ? length(projectedCoordDistVanishingPoint.xy) : abs(projectedCoordDistVanishingPoint.y), maxReach);
1195
+
1196
+ float projectedCoordDirLength = length(projectedCoordDir);
1197
+ int maxSteps = globalIllumination ? 16 : ${t.highStepCount?"150":"75"};
1198
+ float maxSt = float(maxSteps);
1199
+
1200
+ // normalize the projection direction depending on maximum steps
1201
+ // this determines how blocky the reflection looks
1202
+ vec2 dP = distMod * (projectedCoordDir)/(maxSt * projectedCoordDirLength);
1203
+
1204
+ // Normalize the homogeneous camera space coordinates
1205
+ vec3 dQ = distMod * (Q1 - Q0)/(maxSt * projectedCoordDirLength);
1206
+ float dk = distMod * (k1 - k0)/(maxSt * projectedCoordDirLength);
1207
+
1208
+ // initialize the variables for ray marching
1209
+ vec2 P = projectedCoordStart.xy;
1210
+ vec3 Q = Q0;
1211
+ float k = k0;
1212
+ float rayStartZ = -startPosition.z; // estimated ray start depth value
1213
+ float rayEndZ = -startPosition.z; // estimated ray end depth value
1214
+ float prevEstimateZ = -startPosition.z;
1215
+ float rayDiffZ = 0.0;
1216
+ float dDepth;
1217
+ float depth;
1218
+ float rayDiffZOld = 0.0;
1219
+
1220
+ // early outs
1221
+ if (dot(normal, dir) < 0.0 || dot(-viewDir, normal) < 0.0)
1222
+ return vec3(P, 0.0);
1223
+ float dDepthBefore = 0.0;
1224
+
1225
+ P = clamp(P + offset * dP, vec2(0.0), vec2(0.999));
1226
+ Q.z += offset * dQ.z;
1227
+ k += offset * dk;
1228
+
1229
+ for(int i = 0; i < maxSteps-1; i++)
1230
+ {
1231
+ depth = -linearDepthFromTexture(depthMap, P); // get linear depth from the depth buffer
1232
+
1233
+ // estimate depth of the marching ray
1234
+ rayStartZ = prevEstimateZ;
1235
+ dDepth = -rayStartZ - depth;
1236
+ rayEndZ = (dQ.z * 0.5 + Q.z)/ ((dk * 0.5 + k));
1237
+ rayDiffZ = rayEndZ- rayStartZ;
1238
+ prevEstimateZ = rayEndZ;
1239
+
1240
+ if(-rayEndZ > nearFar[1] || -rayEndZ < nearFar[0] || P.y < 0.0 || P.y > 1.0 )
1241
+ {
1242
+ return vec3(P, 0.);
1243
+ }
1244
+
1245
+ // If we detect a hit - return the intersection point, two conditions:
1246
+ // - dDepth > 0.0 - sampled point depth is in front of estimated depth
1247
+ // - if difference between dDepth and rayDiffZOld is not too large
1248
+ // - if difference between dDepth and 0.025/abs(k) is not too large
1249
+ // - if the sampled depth is not behind far plane or in front of near plane
1250
+
1251
+ if((dDepth) < 0.025/abs(k) + abs(rayDiffZ) && dDepth > 0.0 && depth > nearFar[0] && depth < nearFar[1] && abs(P.y - projectedCoordStart.y) > invResolutionHeight)
1252
+ {
1253
+ float weight = dDepth / (dDepth - dDepthBefore);
1254
+ vec2 Pf = mix(P - dP, P, 1.0 - weight);
1255
+ if (abs(Pf.y - projectedCoordStart.y) > invResolutionHeight) {
1256
+ return vec3(Pf, depth);
1257
+ }
1258
+ else {
1259
+ return vec3(P, depth);
1260
+ }
1261
+ }
1262
+
1263
+ if (globalIllumination && (P.x <= 0.0 || P.x >= 1.0)) {
1264
+ return vec3(P, 0.0);
1265
+ }
1266
+
1267
+ // continue with ray marching
1268
+ // Clamp to 0.999 to avoid sampling edge artifacts for water reflections
1269
+ P = P + dP;
1270
+ Q.z += dQ.z;
1271
+ k += dk;
1272
+ rayDiffZOld = rayDiffZ;
1273
+ dDepthBefore = dDepth;
1274
+
1275
+ // Clamp to 0.999 to avoid sampling edge artifacts for water reflections
1276
+ if (!globalIllumination) {
1277
+ P = clamp(P, vec2(0.0), vec2(0.999));
1278
+ }
1279
+ }
1280
+ return vec3(P, 0.0);
1281
+ }
1282
+ `)}},51406(e,t,o){o.d(t,{MU:()=>l,O1:()=>c,QM:()=>u,Sx:()=>s,q2:()=>i});var r=o(29242),a=o(31821),n=o(35644);function i(e,t){t.hasColorTextureTransform?(e.varyings.add("colorUV","vec2"),e.vertex.uniforms.add(new n.k("colorTextureTransformMatrix",e=>e.colorTextureTransformMatrix??r.zK)).code.add(a.H`void forwardColorUV(){
1283
+ colorUV = (colorTextureTransformMatrix * vec3(vuv0, 1.0)).xy;
1284
+ }`)):e.vertex.code.add(a.H`void forwardColorUV(){}`)}function s(e,t){t.hasNormalTextureTransform&&0!==t.textureCoordinateType?(e.varyings.add("normalUV","vec2"),e.vertex.uniforms.add(new n.k("normalTextureTransformMatrix",e=>e.normalTextureTransformMatrix??r.zK)).code.add(a.H`void forwardNormalUV(){
1285
+ normalUV = (normalTextureTransformMatrix * vec3(vuv0, 1.0)).xy;
1286
+ }`)):e.vertex.code.add(a.H`void forwardNormalUV(){}`)}function l(e,t){t.hasEmissionTextureTransform&&0!==t.textureCoordinateType?(e.varyings.add("emissiveUV","vec2"),e.vertex.uniforms.add(new n.k("emissiveTextureTransformMatrix",e=>e.emissiveTextureTransformMatrix??r.zK)).code.add(a.H`void forwardEmissiveUV(){
1287
+ emissiveUV = (emissiveTextureTransformMatrix * vec3(vuv0, 1.0)).xy;
1288
+ }`)):e.vertex.code.add(a.H`void forwardEmissiveUV(){}`)}function c(e,t){t.hasOcclusionTextureTransform&&0!==t.textureCoordinateType?(e.varyings.add("occlusionUV","vec2"),e.vertex.uniforms.add(new n.k("occlusionTextureTransformMatrix",e=>e.occlusionTextureTransformMatrix??r.zK)).code.add(a.H`void forwardOcclusionUV(){
1289
+ occlusionUV = (occlusionTextureTransformMatrix * vec3(vuv0, 1.0)).xy;
1290
+ }`)):e.vertex.code.add(a.H`void forwardOcclusionUV(){}`)}function u(e,t){t.hasMetallicRoughnessTextureTransform&&0!==t.textureCoordinateType?(e.varyings.add("metallicRoughnessUV","vec2"),e.vertex.uniforms.add(new n.k("metallicRoughnessTextureTransformMatrix",e=>e.metallicRoughnessTextureTransformMatrix??r.zK)).code.add(a.H`void forwardMetallicRoughnessUV(){
1291
+ metallicRoughnessUV = (metallicRoughnessTextureTransformMatrix * vec3(vuv0, 1.0)).xy;
1292
+ }`)):e.vertex.code.add(a.H`void forwardMetallicRoughnessUV(){}`)}},34845(e,t,o){o.d(t,{Ir:()=>u});var r=o(37585),a=o(48163),n=o(78955),i=o(91829),s=o(77108),l=o(14314),c=o(31821);function u(e){e.fragment.uniforms.add(new l.I("projInfo",e=>function(e){const t=e.projectionMatrix;return 0===t[11]?(0,n.hZ)(d,2/(e.fullWidth*t[0]),2/(e.fullHeight*t[5]),(1+t[12])/t[0],(1+t[13])/t[5]):(0,n.hZ)(d,-2/(e.fullWidth*t[0]),-2/(e.fullHeight*t[5]),(1-t[8])/t[0],(1-t[9])/t[5])}(e.camera))),e.fragment.uniforms.add(new s.E("zScale",e=>0===e.camera.projectionMatrix[11]?(0,r.hZ)(m,0,1):(0,r.hZ)(m,1,0))),e.fragment.code.add(c.H`vec3 reconstructPosition(vec2 fragCoord, float depth) {
1293
+ return vec3((fragCoord * projInfo.xy + projInfo.zw) * (zScale.x * depth + zScale.y), depth);
1294
+ }`)}const d=(0,i.vt)(),m=(0,a.vt)()},58614(e,t,o){o.d(t,{S:()=>i}),o(28421);var r=o(20304),a=o(31821),n=o(49788);function i(e,t){!function(e,t,o){const r=e.fragment,i=t.alphaDiscardMode,s=0===i;2!==i&&3!==i||r.uniforms.add(o),r.code.add(a.H`
1295
+ void discardOrAdjustAlpha(inout vec4 color) {
1296
+ ${1===i?"color.a = 1.0;":`if (color.a < ${s?a.H.float(n.Q):"textureAlphaCutoff"}) {\n discard;\n } ${(0,a.If)(2===i,"else { color.a = 1.0; }")}`}
1297
+ }
1298
+ `)}(e,t,new r.m("textureAlphaCutoff",e=>e.textureAlphaCutoff))}},26425(e,t,o){o.d(t,{u:()=>n});var r=o(33094),a=o(31821);function n(e){e.uniforms.add(new r.U("dpDummy",()=>1)).code.add(a.H`vec3 dpAdd(vec3 hiA, vec3 loA, vec3 hiB, vec3 loB) {
1299
+ vec3 hiD = hiA + hiB;
1300
+ vec3 loD = loA + loB;
1301
+ return dpDummy * hiD + loD;
1302
+ }`)}},32976(e,t,o){o.d(t,{o:()=>a});var r=o(74333);class a extends r.n{constructor(e,t){super(e,"bool",0,(o,r)=>o.setUniform1b(e,t(r)))}}},40710(e,t,o){o.d(t,{W:()=>a});var r=o(74333);class a extends r.n{constructor(e,t,o){super(e,"vec3",2,(r,a,n,i)=>r.setUniform3fv(e,t(a,n,i),o))}}},33079(e,t,o){o.d(t,{t:()=>a});var r=o(74333);class a extends r.n{constructor(e,t,o){super(e,"vec3",1,(r,a,n)=>r.setUniform3fv(e,t(a,n),o))}}},28421(e,t,o){o.d(t,{J:()=>a});var r=o(74333);class a extends r.n{constructor(e,t,o){super(e,"float",2,(r,a,n)=>r.setUniform1f(e,t(a,n),o))}}},20304(e,t,o){o.d(t,{m:()=>a});var r=o(74333);class a extends r.n{constructor(e,t,o){super(e,"float",1,(r,a,n)=>r.setUniform1f(e,t(a,n),o))}}},98353(e,t,o){o.d(t,{h:()=>a});var r=o(74333);class a extends r.n{constructor(e,t,o){super(e,"mat3",2,(r,a,n)=>r.setUniformMatrix3fv(e,t(a,n),o))}}},15976(e,t,o){o.d(t,{o:()=>a});var r=o(74333);class a extends r.n{constructor(e,t,o){super(e,"sampler2D",2,(r,a,n)=>r.bindTexture(e,t(a,n),o?.(a,n)))}}},63761(e,t,o){o.d(t,{N:()=>a});var r=o(74333);class a extends r.n{constructor(e,t){super(e,"sampler2D",1,(o,r,a)=>o.bindTexture(e,t(r,a)))}}},31821(e,t,o){o.d(t,{H:()=>r,If:()=>a});const r=(e,...t)=>{let o="";for(let r=0;r<t.length;r++)o+=e[r]+t[r];return o+=e[e.length-1],o};function a(e,t,o=""){return e?t:o}r.int=e=>e.toFixed(),r.uint=e=>`${Math.max(0,e).toFixed()}u`,r.hexuint=e=>`0x${Math.round(Math.max(0,e)).toString(16)}u`,r.float=e=>e.toPrecision(8)},27832(e,t,o){o.d(t,{b:()=>n});var r=o(33094),a=o(31821);function n(e,t){t.snowCover&&(e.uniforms.add(new r.U("snowCover",e=>e.snowCover)).code.add(a.H`float getSnow(vec3 normal, vec3 groundNormal) {
1303
+ return smoothstep(0.5, 0.55, dot(normal, groundNormal)) * snowCover;
1304
+ }
1305
+ float getRealisticTreeSnow(vec3 faceNormal, vec3 shadingNormal, vec3 groundNormal) {
1306
+ float snow = min(1.0, smoothstep(0.5, 0.55, dot(faceNormal, groundNormal)) +
1307
+ smoothstep(0.5, 0.55, dot(-faceNormal, groundNormal)) +
1308
+ smoothstep(0.0, 0.1, dot(shadingNormal, groundNormal)));
1309
+ return snow * snowCover;
1310
+ }`),e.code.add(a.H`vec3 applySnowToMRR(vec3 mrr, float snow) {
1311
+ return mix(mrr, vec3(0.0, 1.0, 0.04), snow);
1312
+ }`))}},74810(e,t,o){o.d(t,{Bt:()=>s,Jr:()=>n,SY:()=>l,mb:()=>i});var r=o(35522),a=o(51850);function n({normalTexture:e,metallicRoughnessTexture:t,metallicFactor:o,roughnessFactor:n,emissiveTexture:i,emissiveFactor:s,occlusionTexture:l}){return null==e&&null==t&&null==i&&(null==s||(0,r.t2)(s,a.uY))&&null==l&&(null==n||1===n)&&(null==o||1===o)}const i=(0,a.CN)(1,1,.5),s=(0,a.CN)(0,.6,.2),l=(0,a.CN)(0,1,.2)},66211(e,t,o){function r(e,t){t.useFloatBlend?(e.constants.add("floatBlendOutputScale","float",1),e.constants.add("floatBlendInputScale","float",1)):(e.constants.add("floatBlendOutputScale","float",1/a),e.constants.add("floatBlendInputScale","float",a))}o.d(t,{H:()=>r,m:()=>a});const a=16},74333(e,t,o){o.d(t,{n:()=>r});class r{constructor(e,t,o,r,a=null){if(this.name=e,this.type=t,this.arraySize=a,this.bind={0:null,1:null,2:null},r)switch(o){case void 0:break;case 0:this.bind[0]=r;break;case 1:this.bind[1]=r;break;case 2:this.bind[2]=r}}equals(e){return this.type===e.type&&this.name===e.name&&this.arraySize===e.arraySize}}}}]);