@arcgis/core 5.2.0-next.50 → 5.2.0-next.51

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 (39) hide show
  1. package/assets/esri/core/workers/RemoteClient.js +1 -1
  2. package/assets/esri/core/workers/chunks/{de50a19944617cd426b8.js → 0ffd0190adfed8e5937a.js} +1 -1
  3. package/assets/esri/core/workers/chunks/{877c848beaf9a939862c.js → 290fbc6d32c799841ccc.js} +1 -1
  4. package/assets/esri/core/workers/chunks/{851bcc75acac4a2f199b.js → 2d6d2d4df05bba9fa4a6.js} +1 -1
  5. package/assets/esri/core/workers/chunks/{304a22c580ce103480cb.js → 2fbb00a29faeaa02912b.js} +1 -1
  6. package/assets/esri/core/workers/chunks/{9d0a9d465ec3a8ba1ed2.js → 5d6d07ecebf881ad913f.js} +1 -1
  7. package/assets/esri/core/workers/chunks/{0037a878499d8a512772.js → 61d3fcb419d6bf7e355e.js} +38 -19
  8. package/assets/esri/core/workers/chunks/{cdb331b58e22f8c1c988.js → 77f19d204a4673b1e676.js} +2 -2
  9. package/assets/esri/core/workers/chunks/{1bc45872d22d61dbd7d1.js → 7e2bf6dd26c3cf0b49b0.js} +1 -1
  10. package/assets/esri/core/workers/chunks/{baac90da0703891d59c4.js → 847ce06b14a921cd16f0.js} +1 -1
  11. package/assets/esri/core/workers/chunks/a1fcef22b6151a7f7917.js +1 -0
  12. package/assets/esri/core/workers/chunks/{0ea374f7b16745b9bbc7.js → a239f1e82dde4f7ada32.js} +1 -1
  13. package/assets/esri/core/workers/chunks/{47af3525396f890f2a6b.js → c38992b250731137cb1a.js} +1 -1
  14. package/assets/esri/core/workers/chunks/{5ec8b02e097cf6718462.js → ce719d3aec8b52bfe160.js} +1 -1
  15. package/assets/esri/core/workers/chunks/{b0b37c67a14a4dfb6538.js → cef7f4237539574f0730.js} +1 -1
  16. package/chunks/CutFillMinMaxDepth.glsl.js +1 -1
  17. package/chunks/CutFillReduction.glsl.js +5 -14
  18. package/chunks/CutFillTotalDepth.glsl.js +1 -1
  19. package/chunks/GlobalIllumination.glsl.js +41 -30
  20. package/chunks/GlobalIlluminationBlur.glsl.js +19 -11
  21. package/chunks/GlobalIlluminationUpscale.glsl.js +10 -10
  22. package/config.js +1 -1
  23. package/core/types.d.ts +5 -1
  24. package/kernel.js +1 -1
  25. package/package.json +3 -3
  26. package/support/revision.js +1 -1
  27. package/views/3d/analysis/LineOfSight/LineOfSightTool2.js +1 -1
  28. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillController.js +1 -1
  29. package/views/3d/support/hitTest.js +1 -1
  30. package/views/3d/webgl-engine/core/FBOCacheFormats.js +1 -1
  31. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIllumination.js +1 -1
  32. package/views/3d/webgl-engine/lib/CutFillComputation.js +1 -1
  33. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  34. package/views/3d/webgl-engine/shaders/CutFillReductionTechniqueConfiguration.js +1 -1
  35. package/views/SceneView.d.ts +24 -12
  36. package/widgets/LineOfSight/LineOfSightViewModel.js +1 -1
  37. package/widgets/support/AnalysisViewModelMixin.js +1 -1
  38. package/assets/esri/core/workers/chunks/5ce168ae45ab7e7a71d1.js +0 -1
  39. /package/assets/esri/core/workers/chunks/{cdb331b58e22f8c1c988.js.LICENSE.txt → 77f19d204a4673b1e676.js.LICENSE.txt} +0 -0
@@ -1,28 +1,28 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{ScreenSpacePass as e}from"../views/3d/webgl-engine/core/shaderLibrary/ScreenSpacePass.glsl.js";import{ReadDepthLastFrame as a}from"../views/3d/webgl-engine/core/shaderLibrary/output/ReadDepthLastFrame.glsl.js";import{Gamma as t}from"../views/3d/webgl-engine/core/shaderLibrary/shading/Gamma.glsl.js";import{addMainLightDirection as r}from"../views/3d/webgl-engine/core/shaderLibrary/shading/MainLighting.glsl.js";import{ScreenSpaceRayMarching as o}from"../views/3d/webgl-engine/core/shaderLibrary/shading/ScreenSpaceRayMarching.glsl.js";import{CameraSpace as i}from"../views/3d/webgl-engine/core/shaderLibrary/util/CameraSpace.glsl.js";import{FloatBindUniform as l}from"../views/3d/webgl-engine/core/shaderModules/FloatBindUniform.js";import{FloatPassUniform as n}from"../views/3d/webgl-engine/core/shaderModules/FloatPassUniform.js";import{glsl as s,If as c}from"../views/3d/webgl-engine/core/shaderModules/glsl.js";import{Matrix4BindUniform as m}from"../views/3d/webgl-engine/core/shaderModules/Matrix4BindUniform.js";import{Texture2DBindUniform as h}from"../views/3d/webgl-engine/core/shaderModules/Texture2DBindUniform.js";import{Texture2DPassUniform as d}from"../views/3d/webgl-engine/core/shaderModules/Texture2DPassUniform.js";import{GlobalIlluminationColorQuantization as u}from"../views/3d/webgl-engine/effects/globalIllumination/GlobalIlluminationColorQuantization.glsl.js";import{floatBlendReductionFactor as p}from"../views/3d/webgl-engine/shaders/floatBlendScale.glsl.js";import{ColorAttachment1 as g,SizedPixelFormat as f}from"../views/webgl/enums.js";import{NoParameters as x}from"../views/webgl/NoParameters.js";import{ShaderBuilder as v}from"../views/webgl/ShaderBuilder.js";const M=.01,b=.008,y=.002,w=.5,S=.02,W=.1,D=.008,F=.012,R=.008,j=40,B=.095,I=.008,C=60,z=2,G=.0039,P=.25,T=.15,E=25,$=.15,L=.5,O=1,V=1,U=16;class N extends x{constructor(){super(...arguments),this.projScale=1,this.scaleGlobalIllumination=1,this.accumulatedFrames=0,this.temporalSampleFrame=0,this.rayMarchMinReach=$,this.rayMarchMaxReach=L,this.rayMarchWorldReach=E,this.rayMarchMinReachEmissionWeight=O,this.rayMarchMaxReachEmissionWeight=V,this.rayMarchMaxSteps=U,this.colorBleedWeight=T}}function k(x){const T=new v,E=T.fragment;T.include(e),T.include(i),r(E),E.include(a),E.include(t),E.include(u),T.include(o,x),E.uniforms.add(new d("normalMap",e=>e.normalTexture),new d("depthMap",e=>e.depthTexture),new h("lastFrameColorTexture",e=>e.reprojection.lastFrameColor?.getTexture()),new h("lastFrameDepthTexture",e=>e.reprojection.lastFrameDepth?.attachment),new h("lastFrameGlobalIlluminationTexture",e=>e.globalIllumination?.getTexture()),new h("lastFrameGlobalIlluminationWeightTexture",e=>e.globalIllumination?.getTexture(g)),new m("reprojectionViewMatrix",e=>e.reprojection.viewMatrix),new m("view",e=>e.camera.viewMatrix),new n("accumulatedFrames",e=>e.accumulatedFrames),new n("temporalSampleFrame",e=>e.temporalSampleFrame),new n("scaleGlobalIllumination",e=>e.scaleGlobalIllumination)),E.uniforms.add(new n("rayMarchMinReach",e=>e.rayMarchMinReach),new n("rayMarchMaxReach",e=>e.rayMarchMaxReach),new n("rayMarchWorldReach",e=>e.rayMarchWorldReach),new n("rayMarchMinReachEmissionWeight",e=>e.rayMarchMinReachEmissionWeight),new n("rayMarchMaxReachEmissionWeight",e=>e.rayMarchMaxReachEmissionWeight),new n("rayMarchMaxSteps",e=>e.rayMarchMaxSteps),new n("colorBleedWeight",e=>e.colorBleedWeight));const{hasEmission:$,hasColor:L}=x;return $&&E.uniforms.add(new l("inputScale",e=>e.reprojection.lastFrameEmission?.attachment.descriptor.internalFormat===f.RGBA8?p:1),new h("lastFrameEmissionTexture",e=>e.reprojection.lastFrameEmission?.attachment)),E.code.add(s`
2
+ import{ScreenSpacePass as e}from"../views/3d/webgl-engine/core/shaderLibrary/ScreenSpacePass.glsl.js";import{ReadDepthLastFrame as a}from"../views/3d/webgl-engine/core/shaderLibrary/output/ReadDepthLastFrame.glsl.js";import{Gamma as t}from"../views/3d/webgl-engine/core/shaderLibrary/shading/Gamma.glsl.js";import{addMainLightDirection as r}from"../views/3d/webgl-engine/core/shaderLibrary/shading/MainLighting.glsl.js";import{ScreenSpaceRayMarching as o}from"../views/3d/webgl-engine/core/shaderLibrary/shading/ScreenSpaceRayMarching.glsl.js";import{CameraSpace as l}from"../views/3d/webgl-engine/core/shaderLibrary/util/CameraSpace.glsl.js";import{FloatBindUniform as i}from"../views/3d/webgl-engine/core/shaderModules/FloatBindUniform.js";import{FloatPassUniform as n}from"../views/3d/webgl-engine/core/shaderModules/FloatPassUniform.js";import{glsl as c,If as s}from"../views/3d/webgl-engine/core/shaderModules/glsl.js";import{Matrix4BindUniform as m}from"../views/3d/webgl-engine/core/shaderModules/Matrix4BindUniform.js";import{Texture2DBindUniform as h}from"../views/3d/webgl-engine/core/shaderModules/Texture2DBindUniform.js";import{Texture2DPassUniform as d}from"../views/3d/webgl-engine/core/shaderModules/Texture2DPassUniform.js";import{GlobalIlluminationColorQuantization as u}from"../views/3d/webgl-engine/effects/globalIllumination/GlobalIlluminationColorQuantization.glsl.js";import{floatBlendReductionFactor as p}from"../views/3d/webgl-engine/shaders/floatBlendScale.glsl.js";import{ColorAttachment1 as g,SizedPixelFormat as f}from"../views/webgl/enums.js";import{NoParameters as x}from"../views/webgl/NoParameters.js";import{ShaderBuilder as v}from"../views/webgl/ShaderBuilder.js";const y=.01,M=.008,b=.002,w=.5,S=.02,W=.1,D=.008,F=.3,R=.008,B=150,j=.095,I=.008,C=60,z=2,G=.0039,P=.25,T=.012,$=0,E=6,L=.15,O=25,V=.15,U=.5,N=1,k=1,Q=16;class H extends x{constructor(){super(...arguments),this.projScale=1,this.scaleGlobalIllumination=1,this.accumulatedFrames=0,this.temporalSampleFrame=0,this.rayMarchMinReach=V,this.rayMarchMaxReach=U,this.rayMarchWorldReach=O,this.rayMarchMinReachEmissionWeight=N,this.rayMarchMaxReachEmissionWeight=k,this.rayMarchMaxSteps=Q,this.colorBleedWeight=L,this.highQualityIdleColorBlendStart=F}}function _(x){const F=new v,L=F.fragment;F.include(e),F.include(l),r(L),L.include(a),L.include(t),L.include(u),F.include(o,x),L.uniforms.add(new d("normalMap",e=>e.normalTexture),new d("depthMap",e=>e.depthTexture),new h("lastFrameColorTexture",e=>e.reprojection.lastFrameColor?.getTexture()),new h("lastFrameDepthTexture",e=>e.reprojection.lastFrameDepth?.attachment),new h("lastFrameGlobalIlluminationTexture",e=>e.globalIllumination?.getTexture()),new h("lastFrameGlobalIlluminationWeightTexture",e=>e.globalIllumination?.getTexture(g)),new m("reprojectionViewMatrix",e=>e.reprojection.viewMatrix),new m("view",e=>e.camera.viewMatrix),new n("accumulatedFrames",e=>e.accumulatedFrames),new n("temporalSampleFrame",e=>e.temporalSampleFrame),new n("scaleGlobalIllumination",e=>e.scaleGlobalIllumination)),L.uniforms.add(new n("rayMarchMinReach",e=>e.rayMarchMinReach),new n("rayMarchMaxReach",e=>e.rayMarchMaxReach),new n("rayMarchWorldReach",e=>e.rayMarchWorldReach),new n("rayMarchMinReachEmissionWeight",e=>e.rayMarchMinReachEmissionWeight),new n("rayMarchMaxReachEmissionWeight",e=>e.rayMarchMaxReachEmissionWeight),new n("rayMarchMaxSteps",e=>e.rayMarchMaxSteps),new n("colorBleedWeight",e=>e.colorBleedWeight),new n("highQualityIdleColorBlendStart",e=>e.highQualityIdleColorBlendStart));const{hasEmission:O,hasColor:V}=x;return O&&L.uniforms.add(new i("inputScale",e=>e.reprojection.lastFrameEmission?.attachment.descriptor.internalFormat===f.RGBA8?p:1),new h("lastFrameEmissionTexture",e=>e.reprojection.lastFrameEmission?.attachment)),L.code.add(c`
3
3
  float computeIdleColorBlendWeight(float accumulatedFrames) {
4
4
  float idleColorBlendProgress = clamp(
5
- accumulatedFrames / ${s.float(j)},
5
+ accumulatedFrames / ${c.float(B)},
6
6
  0.0,
7
7
  1.0
8
8
  );
9
9
  return mix(
10
- ${s.float(F)},
11
- ${s.float(R)},
12
- idleColorBlendProgress
10
+ highQualityIdleColorBlendStart,
11
+ ${c.float(R)},
12
+ pow(idleColorBlendProgress, 1./5.)
13
13
  );
14
14
  }
15
15
 
16
16
  float computeIdleOcclusionBlendWeight(float accumulatedFrames) {
17
17
  float idleOcclusionBlendProgress = clamp(
18
- accumulatedFrames / ${s.float(C)},
18
+ accumulatedFrames / ${c.float(C)},
19
19
  0.0,
20
20
  1.0
21
21
  );
22
22
  return mix(
23
- ${s.float(B)},
24
- ${s.float(I)},
25
- pow(idleOcclusionBlendProgress, ${s.float(z)})
23
+ ${c.float(j)},
24
+ ${c.float(I)},
25
+ pow(idleOcclusionBlendProgress, ${c.float(z)})
26
26
  );
27
27
  }
28
28
 
@@ -77,13 +77,13 @@ import{ScreenSpacePass as e}from"../views/3d/webgl-engine/core/shaderLibrary/Scr
77
77
 
78
78
  return value * 2.0 - 1.0;
79
79
  }
80
- `),T.outputs.add("fragGlobalIllumination","vec4",0),T.outputs.add("fragWeight","float",1),E.main.add(s`
80
+ `),F.outputs.add("fragGlobalIllumination","vec4",0),F.outputs.add("fragWeight","vec2",1),L.main.add(c`
81
81
  float depth = depthFromTexture(depthMap, uv);
82
82
 
83
83
  // Early out if depth is out of range, such as in the sky
84
84
  if (depth >= 1.0 || depth <= 0.0) {
85
85
  fragGlobalIllumination = vec4(0.0, 0.0, 0.0, 1.0);
86
- fragWeight = 0.0;
86
+ fragWeight = vec2(0.0);
87
87
  return;
88
88
  }
89
89
 
@@ -92,7 +92,7 @@ import{ScreenSpacePass as e}from"../views/3d/webgl-engine/core/shaderLibrary/Scr
92
92
  vec4 normal4 = texelFetch(normalMap, iuv, 0);
93
93
  if (normal4.a != 1.0) {
94
94
  fragGlobalIllumination = vec4(0.0, 0.0, 0.0, 1.0);
95
- fragWeight = 0.0;
95
+ fragWeight = vec2(0.0);
96
96
  return;
97
97
  }
98
98
  vec3 normal = normalize(normal4.xyz * 2.0 - 1.0);
@@ -117,7 +117,7 @@ import{ScreenSpacePass as e}from"../views/3d/webgl-engine/core/shaderLibrary/Scr
117
117
  float idleColorBlendWeight = computeIdleColorBlendWeight(accumulatedFrames);
118
118
  float idleOcclusionBlendWeight = computeIdleOcclusionBlendWeight(accumulatedFrames);
119
119
  float reprojectionDepthMismatch = abs((lastFrameDepthViewPos + reprojectedViewPos.z) / max(lastFrameDepthViewPos, reprojectedViewPos.z));
120
- bool hasReprojectionMismatch = reprojectionDepthMismatch > ${s.float(M)};
120
+ bool hasReprojectionMismatch = reprojectionDepthMismatch > ${c.float(y)};
121
121
  bool isScaledGlobalIllumination = scaleGlobalIllumination < 1.0;
122
122
  bool isLowQualityEdgePixel = isScaledGlobalIllumination && isEdgeDepth(currentPixelDepth, uv);
123
123
  bool resetColorHistory = false;
@@ -126,7 +126,7 @@ import{ScreenSpacePass as e}from"../views/3d/webgl-engine/core/shaderLibrary/Scr
126
126
  if (hasReprojectionMismatch) {
127
127
  if (isLowQualityEdgePixel) {
128
128
  steps = 1;
129
- occlusionBlendWeight = ${s.float(b)};
129
+ occlusionBlendWeight = ${c.float(M)};
130
130
  resetColorHistory = true;
131
131
  } else {
132
132
  steps = 6;
@@ -135,15 +135,15 @@ import{ScreenSpacePass as e}from"../views/3d/webgl-engine/core/shaderLibrary/Scr
135
135
  }
136
136
  } else {
137
137
  steps = 1;
138
- if (historyOcclusionBlendWeight > ${s.float(w)}) {
139
- occlusionBlendWeight = ${s.float(W)};
140
- colorBlendWeight = ${s.float(D)};
141
- } else if (historyOcclusionBlendWeight > ${s.float(S)}) {
138
+ if (historyOcclusionBlendWeight > ${c.float(w)}) {
139
+ occlusionBlendWeight = ${c.float(W)};
140
+ colorBlendWeight = ${c.float(D)};
141
+ } else if (historyOcclusionBlendWeight > ${c.float(S)}) {
142
142
  occlusionBlendWeight = historyOcclusionBlendWeight - 0.05;
143
- colorBlendWeight = ${s.float(D)};
143
+ colorBlendWeight = ${c.float(D)};
144
144
  } else {
145
- occlusionBlendWeight = isScaledGlobalIllumination ? ${s.float(b)} : idleOcclusionBlendWeight;
146
- colorBlendWeight = isScaledGlobalIllumination ? ${s.float(y)} : idleColorBlendWeight;
145
+ occlusionBlendWeight = isScaledGlobalIllumination ? ${c.float(M)} : idleOcclusionBlendWeight;
146
+ colorBlendWeight = isScaledGlobalIllumination ? ${c.float(b)} : idleColorBlendWeight;
147
147
  }
148
148
  }
149
149
 
@@ -154,6 +154,17 @@ import{ScreenSpacePass as e}from"../views/3d/webgl-engine/core/shaderLibrary/Scr
154
154
 
155
155
  // For each ray determine if it hits geometry and accumulate occlusion or color
156
156
  float stepSize = 1.0 / float(steps);
157
+ ${s(V,c`
158
+ float colorBleedScale = mix(
159
+ 1.0,
160
+ ${c.float($)},
161
+ smoothstep(
162
+ ${c.float(T)},
163
+ highQualityIdleColorBlendStart,
164
+ colorBlendWeight
165
+ )
166
+ );
167
+ `)}
157
168
  for (int i = 0; i < steps; ++i) {
158
169
  float sampleIndex = float(i * temporalSampleStride + int(temporalFrameOffset));
159
170
  randomDirectionSample = blueNoiseDither(floor(gl_FragCoord.xy), sampleIndex);
@@ -173,21 +184,21 @@ import{ScreenSpacePass as e}from"../views/3d/webgl-engine/core/shaderLibrary/Scr
173
184
  );
174
185
 
175
186
  if (hit.z > 0.0) {
176
- ${c(L,s`
187
+ ${s(V,c`
177
188
  // Emission and color bleed - Reproject the current receiver and sampled hit to estimate bounced color
178
189
  vec3 receiverColor = texture(lastFrameColorTexture, reprojectedCoordinate.xy).rgb;
179
190
 
180
191
  vec2 hitReprojectedCoordinate = reprojectionCoordinate(hit);
181
192
  vec3 sourceColor = texture(lastFrameColorTexture, hitReprojectedCoordinate).rgb;
182
193
  vec3 sourceColorLinear = linearizeGamma(sourceColor);
183
- vec3 sourceEmission = ${c($,"texture(lastFrameEmissionTexture, hitReprojectedCoordinate).xyz * inputScale","vec3(0.0)")};
194
+ vec3 sourceEmission = ${s(O,"texture(lastFrameEmissionTexture, hitReprojectedCoordinate).xyz * inputScale","vec3(0.0)")};
184
195
 
185
196
  float emissionWeight = mix(
186
197
  rayMarchMinReachEmissionWeight,
187
198
  rayMarchMaxReachEmissionWeight,
188
199
  (rayMarchScreenReach - rayMarchMinReach) / max(rayMarchMaxReach - rayMarchMinReach, 0.00001)
189
200
  );
190
- fragGlobalIllumination.rgb += ((sourceColorLinear * colorBleedWeight) + sourceEmission * emissionWeight) * stepSize;
201
+ fragGlobalIllumination.rgb += ((sourceColorLinear * colorBleedWeight * colorBleedScale) + sourceEmission * emissionWeight) * stepSize;
191
202
  `)}
192
203
  } else {
193
204
  // Occlusion - heuristic modulating sky intensity based on angle to main light
@@ -201,17 +212,17 @@ import{ScreenSpacePass as e}from"../views/3d/webgl-engine/core/shaderLibrary/Scr
201
212
 
202
213
  // Rendering trick add noise to reduce accumulation artifacts
203
214
  float accumulationDither = occlusionBlendWeight < 1.0
204
- ? randomDirectionSample.b * ${s.float(G)}
215
+ ? randomDirectionSample.b * ${c.float(G)}
205
216
  : 0.0;
206
217
 
207
- ${c(L,s`
218
+ ${s(V,c`
208
219
  // Accumulate color
209
220
  vec3 lastFrameColor = lastFrameGlobalIllumination.rgb;
210
- float colorDitherScale = isScaledGlobalIllumination ? ${s.float(P)} : 1.0;
221
+ float colorDitherScale = isScaledGlobalIllumination ? ${c.float(P)} : 1.0;
211
222
  fragGlobalIllumination.rgb = resetColorHistory
212
223
  ? vec3(0.0)
213
224
  : mix(lastFrameColor + accumulationDither * colorDitherScale, fragGlobalIllumination.rgb, colorBlendWeight);
214
- `,s`
225
+ `,c`
215
226
  fragGlobalIllumination.rgb = vec3(0.0);
216
227
  `)}
217
228
  fragGlobalIllumination.rgb = quantizeGlobalIlluminationColor(fragGlobalIllumination.rgb);
@@ -219,5 +230,5 @@ import{ScreenSpacePass as e}from"../views/3d/webgl-engine/core/shaderLibrary/Scr
219
230
  // Accumulate occlusion
220
231
  fragGlobalIllumination.a = mix(lastFrameGlobalIllumination.a + accumulationDither, fragGlobalIllumination.a, occlusionBlendWeight);
221
232
 
222
- fragWeight = occlusionBlendWeight;
223
- `),T}const H=Object.freeze(Object.defineProperty({__proto__:null,GlobalIlluminationPassParameters:N,build:k,defaultColorBleedWeight:T,defaultRayMarchMaxReach:L,defaultRayMarchMaxReachEmissionWeight:V,defaultRayMarchMaxSteps:U,defaultRayMarchMinReach:$,defaultRayMarchMinReachEmissionWeight:O,defaultRayMarchWorldReach:E},Symbol.toStringTag,{value:"Module"}));export{N as G,H as a,U as b,k as c,L as d,T as e,V as f,$ as g,O as h,E as i};
233
+ fragWeight = vec2(occlusionBlendWeight, colorBlendWeight * ${c.float(E)});
234
+ `),F}const q=Object.freeze(Object.defineProperty({__proto__:null,GlobalIlluminationPassParameters:H,build:_,defaultColorBleedWeight:L,defaultRayMarchMaxReach:U,defaultRayMarchMaxReachEmissionWeight:k,defaultRayMarchMaxSteps:Q,defaultRayMarchMinReach:V,defaultRayMarchMinReachEmissionWeight:N,defaultRayMarchWorldReach:O},Symbol.toStringTag,{value:"Module"}));export{H as G,q as a,Q as b,_ as c,U as d,L as e,k as f,V as g,N as h,O as i};
@@ -1,5 +1,5 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{create as e}from"../core/libs/gl-matrix-2/factories/vec2f64.js";import{ScreenSpacePass as l}from"../views/3d/webgl-engine/core/shaderLibrary/ScreenSpacePass.glsl.js";import{ReadDepth as o}from"../views/3d/webgl-engine/core/shaderLibrary/output/ReadDepth.glsl.js";import{GlobalIlluminationWeights as i}from"../views/3d/webgl-engine/core/shaderLibrary/shading/GlobalIlluminationWeights.glsl.js";import{CameraSpace as t}from"../views/3d/webgl-engine/core/shaderLibrary/util/CameraSpace.glsl.js";import{BooleanBindUniform as a}from"../views/3d/webgl-engine/core/shaderModules/BooleanBindUniform.js";import{Float2DrawUniform as n}from"../views/3d/webgl-engine/core/shaderModules/Float2DrawUniform.js";import{FloatPassUniform as s}from"../views/3d/webgl-engine/core/shaderModules/FloatPassUniform.js";import{glsl as r}from"../views/3d/webgl-engine/core/shaderModules/glsl.js";import{Texture2DDrawUniform as m}from"../views/3d/webgl-engine/core/shaderModules/Texture2DDrawUniform.js";import{Texture2DPassUniform as u}from"../views/3d/webgl-engine/core/shaderModules/Texture2DPassUniform.js";import{GlobalIlluminationColorQuantization as c}from"../views/3d/webgl-engine/effects/globalIllumination/GlobalIlluminationColorQuantization.glsl.js";import{ditherNoise as p}from"../views/3d/webgl-engine/shaders/ditherNoise.glsl.js";import{FloatBlendScaleConfiguration as d}from"../views/3d/webgl-engine/shaders/floatBlendScale.glsl.js";import{NoParameters as h}from"../views/webgl/NoParameters.js";import{ShaderBuilder as f}from"../views/webgl/ShaderBuilder.js";const g=4;class b extends h{constructor(){super(...arguments),this.blurSize=e()}}function S(){const e=new f,d=e.fragment;e.include(l),e.include(t),e.include(i);const h=(g+3)/2,b=1/(2*h*h);d.include(o),d.include(p,w),d.include(c);const S=5e4;d.uniforms.add(new a("hasEmission",e=>e.hasEmission),new u("depthMap",e=>e.depthTexture),new u("normalMap",e=>e.normalTexture),new m("globalIlluminationTexture",e=>e.texture),new m("globalIlluminationWeightTexture",e=>e.weightTexture),new n("blurSize",e=>e.blurSize),new s("scaleGlobalIllumination",e=>e.scaleGlobalIllumination),new s("projScale",(e,l)=>{const o=l.camera.distance;return o>S?Math.max(0,e.projScale-(o-S)):e.projScale}));const v=.1,W=400,I=.03,O=.08,x=1.5,D=1/32768,j=.85;return d.code.add(r`
2
+ import{create as e}from"../core/libs/gl-matrix-2/factories/vec2f64.js";import{ScreenSpacePass as l}from"../views/3d/webgl-engine/core/shaderLibrary/ScreenSpacePass.glsl.js";import{ReadDepth as o}from"../views/3d/webgl-engine/core/shaderLibrary/output/ReadDepth.glsl.js";import{GlobalIlluminationWeights as i}from"../views/3d/webgl-engine/core/shaderLibrary/shading/GlobalIlluminationWeights.glsl.js";import{CameraSpace as t}from"../views/3d/webgl-engine/core/shaderLibrary/util/CameraSpace.glsl.js";import{BooleanBindUniform as a}from"../views/3d/webgl-engine/core/shaderModules/BooleanBindUniform.js";import{Float2DrawUniform as n}from"../views/3d/webgl-engine/core/shaderModules/Float2DrawUniform.js";import{FloatPassUniform as s}from"../views/3d/webgl-engine/core/shaderModules/FloatPassUniform.js";import{glsl as r}from"../views/3d/webgl-engine/core/shaderModules/glsl.js";import{Texture2DDrawUniform as u}from"../views/3d/webgl-engine/core/shaderModules/Texture2DDrawUniform.js";import{Texture2DPassUniform as m}from"../views/3d/webgl-engine/core/shaderModules/Texture2DPassUniform.js";import{GlobalIlluminationColorQuantization as c}from"../views/3d/webgl-engine/effects/globalIllumination/GlobalIlluminationColorQuantization.glsl.js";import{ditherNoise as p}from"../views/3d/webgl-engine/shaders/ditherNoise.glsl.js";import{FloatBlendScaleConfiguration as d}from"../views/3d/webgl-engine/shaders/floatBlendScale.glsl.js";import{NoParameters as h}from"../views/webgl/NoParameters.js";import{ShaderBuilder as f}from"../views/webgl/ShaderBuilder.js";const g=4,b=.2,S=2.5;class w extends h{constructor(){super(...arguments),this.blurSize=e()}}function v(){const e=new f,d=e.fragment;e.include(l),e.include(t),e.include(i);const h=(g+3)/2,w=1/(2*h*h);d.include(o),d.include(p,W),d.include(c);const v=5e4;d.uniforms.add(new a("hasEmission",e=>null!=e.reprojection.lastFrameEmission),new m("depthMap",e=>e.depthTexture),new m("normalMap",e=>e.normalTexture),new u("globalIlluminationTexture",e=>e.texture),new u("globalIlluminationWeightTexture",e=>e.weightTexture),new n("blurSize",e=>e.blurSize),new s("scaleGlobalIllumination",e=>e.scaleGlobalIllumination),new s("projScale",(e,l)=>{const o=l.camera.distance;return o>v?Math.max(0,e.projScale-(o-v)):e.projScale}));const I=.1,x=400,O=.03,j=.08,D=1.5,G=1/32768,B=.85;return d.code.add(r`
3
3
  void accumulateBlurSample(
4
4
  vec2 sampleUv,
5
5
  float sampleOffset,
@@ -22,10 +22,10 @@ import{create as e}from"../core/libs/gl-matrix-2/factories/vec2f64.js";import{Sc
22
22
  float normalSimilarityWeight = globalIlluminationNormalSimilarityWeight(sampleNormal, centerNormal);
23
23
  float depthNormalCorrection = globalIlluminationDepthNormalCorrection(sampleNormal);
24
24
  vec3 emission = sampleGlobalIllumination.rgb;
25
- float emissionSpatialWeightMultiplier = isScaledGlobalIllumination ? ${r.float(W)} : 1.0;
25
+ float emissionSpatialWeightMultiplier = isScaledGlobalIllumination ? ${r.float(x)} : 1.0;
26
26
 
27
27
  float emissionWeight = exp(
28
- -sampleOffset * sampleOffset * ${r.float(b)} * ${r.float(v)} * emissionSpatialWeightMultiplier
28
+ -sampleOffset * sampleOffset * ${r.float(w)} * ${r.float(I)} * emissionSpatialWeightMultiplier
29
29
  - depthDelta * depthDelta * depthSharpness * depthNormalCorrection
30
30
  );
31
31
  emissionWeight *= normalSimilarityWeight;
@@ -36,9 +36,9 @@ import{create as e}from"../core/libs/gl-matrix-2/factories/vec2f64.js";import{Sc
36
36
  return;
37
37
  }
38
38
 
39
- float occlusionSpatialKernelScale = centerOcclusionBlendWeight > ${r.float(I)}
40
- ? ${r.float(O)}
41
- : ${r.float(x)};
39
+ float occlusionSpatialKernelScale = centerOcclusionBlendWeight > ${r.float(O)}
40
+ ? ${r.float(j)}
41
+ : ${r.float(D)};
42
42
  float occlusionWeight = exp(-sampleOffset * sampleOffset * occlusionSpatialKernelScale - depthDelta * depthDelta * depthSharpness);
43
43
  occlusionWeight *= normalSimilarityWeight;
44
44
  occlusionWeightSum += occlusionWeight;
@@ -50,8 +50,9 @@ import{create as e}from"../core/libs/gl-matrix-2/factories/vec2f64.js";import{Sc
50
50
 
51
51
  vec4 centerGlobalIllumination = texture(globalIlluminationTexture, uv);
52
52
  float centerOcclusionBlendWeight = texture(globalIlluminationWeightTexture, uv).r;
53
+ float centerColorBlendWeight = texture(globalIlluminationWeightTexture, uv).g;
53
54
  bool isScaledGlobalIllumination = scaleGlobalIllumination < 1.0;
54
- bool shouldReuseCenterOcclusion = isScaledGlobalIllumination && centerOcclusionBlendWeight <= ${r.float(I)};
55
+ bool shouldReuseCenterOcclusion = isScaledGlobalIllumination && centerOcclusionBlendWeight <= ${r.float(O)};
55
56
  bool shouldSkipLowQualityBlur = !hasEmission && shouldReuseCenterOcclusion;
56
57
  if (shouldSkipLowQualityBlur) {
57
58
  fragColor = vec4(
@@ -67,9 +68,16 @@ import{create as e}from"../core/libs/gl-matrix-2/factories/vec2f64.js";import{Sc
67
68
  float occlusionWeightSum = 0.0;
68
69
 
69
70
  float depthSharpness = globalIlluminationDepthSharpness(projScale, centerDepth);
71
+ float lowQualityBlurScale = hasEmission
72
+ ? mix(
73
+ 1.0,
74
+ ${r.float(S)},
75
+ smoothstep(0.0, ${r.float(b)}, centerColorBlendWeight)
76
+ )
77
+ : 1.0;
70
78
  for (int sampleOffset = -${r.int(g)}; sampleOffset <= ${r.int(g)}; ++sampleOffset) {
71
79
  float sampleOffsetFloat = float(sampleOffset);
72
- vec2 sampleUv = uv + sampleOffsetFloat * blurSize;
80
+ vec2 sampleUv = uv + sampleOffsetFloat * blurSize * lowQualityBlurScale;
73
81
  accumulateBlurSample(
74
82
  sampleUv,
75
83
  sampleOffsetFloat,
@@ -89,8 +97,8 @@ import{create as e}from"../core/libs/gl-matrix-2/factories/vec2f64.js";import{Sc
89
97
  vec3 blurredEmission = (emissionSum / emissionWeightSum).rgb;
90
98
 
91
99
  // Dither the blurred color to reduce quantization banding and wrong color accumulation.
92
- float dither = ditherNoise(vec4(blurredEmission, occlusion)) - ${r.float(D)};
93
- blurredEmission += isScaledGlobalIllumination ? ${r.float(j)} * dither : dither;
100
+ float dither = ditherNoise(vec4(blurredEmission, occlusion)) - ${r.float(G)};
101
+ blurredEmission += isScaledGlobalIllumination ? ${r.float(B)} * dither : dither;
94
102
 
95
103
  fragColor = vec4(quantizeGlobalIlluminationColor(blurredEmission), occlusion);
96
- `),e}const w=new d;w.useFloatBlend=!1;const v=Object.freeze(Object.defineProperty({__proto__:null,GlobalIlluminationBlurDrawParameters:b,build:S},Symbol.toStringTag,{value:"Module"}));export{b as G,v as a,S as b};
104
+ `),e}const W=new d;W.useFloatBlend=!1;const I=Object.freeze(Object.defineProperty({__proto__:null,GlobalIlluminationBlurDrawParameters:w,build:v},Symbol.toStringTag,{value:"Module"}));export{w as G,I as a,v as b};
@@ -1,5 +1,5 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{ScreenSpacePass as e}from"../views/3d/webgl-engine/core/shaderLibrary/ScreenSpacePass.glsl.js";import{ReadDepth as t}from"../views/3d/webgl-engine/core/shaderLibrary/output/ReadDepth.glsl.js";import{GlobalIlluminationWeights as l}from"../views/3d/webgl-engine/core/shaderLibrary/shading/GlobalIlluminationWeights.glsl.js";import{CameraSpace as r}from"../views/3d/webgl-engine/core/shaderLibrary/util/CameraSpace.glsl.js";import{FloatPassUniform as a}from"../views/3d/webgl-engine/core/shaderModules/FloatPassUniform.js";import{glsl as i}from"../views/3d/webgl-engine/core/shaderModules/glsl.js";import{Texture2DDrawUniform as o}from"../views/3d/webgl-engine/core/shaderModules/Texture2DDrawUniform.js";import{Texture2DPassUniform as n}from"../views/3d/webgl-engine/core/shaderModules/Texture2DPassUniform.js";import{GlobalIlluminationColorQuantization as h}from"../views/3d/webgl-engine/effects/globalIllumination/GlobalIlluminationColorQuantization.glsl.js";import{NoParameters as u}from"../views/webgl/NoParameters.js";import{ShaderBuilder as s}from"../views/webgl/ShaderBuilder.js";const m=5e4,c=100;class g extends u{}function p(){const u=new s,g=u.fragment;return u.include(e),u.include(r),u.include(l),g.include(t),g.include(h),g.uniforms.add(new n("depthMap",e=>e.depthTexture),new n("normalMap",e=>e.normalTexture),new o("tex",e=>e.colorTexture),new o("globalIlluminationWeightTexture",e=>e.weightTexture),new a("projScale",(e,t)=>{const l=t.camera.distance;return l>m?Math.max(0,e.projScale-(l-m)):e.projScale})),g.code.add(i`
2
+ import{ScreenSpacePass as e}from"../views/3d/webgl-engine/core/shaderLibrary/ScreenSpacePass.glsl.js";import{ReadDepth as t}from"../views/3d/webgl-engine/core/shaderLibrary/output/ReadDepth.glsl.js";import{GlobalIlluminationWeights as l}from"../views/3d/webgl-engine/core/shaderLibrary/shading/GlobalIlluminationWeights.glsl.js";import{CameraSpace as r}from"../views/3d/webgl-engine/core/shaderLibrary/util/CameraSpace.glsl.js";import{FloatPassUniform as a}from"../views/3d/webgl-engine/core/shaderModules/FloatPassUniform.js";import{glsl as i}from"../views/3d/webgl-engine/core/shaderModules/glsl.js";import{Texture2DDrawUniform as o}from"../views/3d/webgl-engine/core/shaderModules/Texture2DDrawUniform.js";import{Texture2DPassUniform as n}from"../views/3d/webgl-engine/core/shaderModules/Texture2DPassUniform.js";import{GlobalIlluminationColorQuantization as h}from"../views/3d/webgl-engine/effects/globalIllumination/GlobalIlluminationColorQuantization.glsl.js";import{NoParameters as u}from"../views/webgl/NoParameters.js";import{ShaderBuilder as s}from"../views/webgl/ShaderBuilder.js";const c=5e4,g=100;class m extends u{}function p(){const u=new s,m=u.fragment;return u.include(e),u.include(r),u.include(l),m.include(t),m.include(h),m.uniforms.add(new n("depthMap",e=>e.depthTexture),new n("normalMap",e=>e.normalTexture),new o("tex",e=>e.colorTexture),new o("globalIlluminationWeightTexture",e=>e.weightTexture),new a("projScale",(e,t)=>{const l=t.camera.distance;return l>c?Math.max(0,e.projScale-(l-c)):e.projScale})),m.code.add(i`
3
3
  float computeDepthWeight(float sampleDepth, float centerDepth, float depthSharpness) {
4
4
  float depthDelta = abs(sampleDepth - centerDepth);
5
5
  return exp(-0.08 - depthDelta * depthDelta * depthSharpness);
@@ -11,10 +11,10 @@ import{ScreenSpacePass as e}from"../views/3d/webgl-engine/core/shaderLibrary/Scr
11
11
  return texelFetch(normalTexture, normalTexel, 0).xyz;
12
12
  }
13
13
 
14
- void sampleJointBilateralUpscale(vec2 sampleUv, out vec4 upscaledColor, out float upscaledWeight) {
14
+ void sampleJointBilateralUpscale(vec2 sampleUv, out vec4 upscaledColor, out vec2 upscaledWeight) {
15
15
  float centerDepth = linearDepthFromTexture(depthMap, sampleUv);
16
16
  vec3 centerNormal = normalFromTexture(normalMap, sampleUv);
17
- float depthSharpness = ${i.float(c)} * globalIlluminationDepthSharpness(projScale, centerDepth, centerNormal);
17
+ float depthSharpness = ${i.float(g)} * globalIlluminationDepthSharpness(projScale, centerDepth, centerNormal);
18
18
 
19
19
  vec2 lowResTextureSize = vec2(textureSize(tex, 0));
20
20
  vec2 texelPosition = sampleUv * lowResTextureSize - 0.5;
@@ -30,10 +30,10 @@ import{ScreenSpacePass as e}from"../views/3d/webgl-engine/core/shaderLibrary/Scr
30
30
  vec4 color10 = texture(tex, uv10);
31
31
  vec4 color01 = texture(tex, uv01);
32
32
  vec4 color11 = texture(tex, uv11);
33
- float weight00 = texture(globalIlluminationWeightTexture, uv00).r;
34
- float weight10 = texture(globalIlluminationWeightTexture, uv10).r;
35
- float weight01 = texture(globalIlluminationWeightTexture, uv01).r;
36
- float weight11 = texture(globalIlluminationWeightTexture, uv11).r;
33
+ vec2 weight00 = texture(globalIlluminationWeightTexture, uv00).rg;
34
+ vec2 weight10 = texture(globalIlluminationWeightTexture, uv10).rg;
35
+ vec2 weight01 = texture(globalIlluminationWeightTexture, uv01).rg;
36
+ vec2 weight11 = texture(globalIlluminationWeightTexture, uv11).rg;
37
37
 
38
38
  float depth00 = linearDepthFromTexture(depthMap, uv00);
39
39
  float depth10 = linearDepthFromTexture(depthMap, uv10);
@@ -60,7 +60,7 @@ import{ScreenSpacePass as e}from"../views/3d/webgl-engine/core/shaderLibrary/Scr
60
60
  // Fall back to the nearest low-resolution texel when all bilateral weights collapse.
61
61
  vec2 nearestUv = (floor(texelPosition + 0.5) + vec2(0.5)) / lowResTextureSize;
62
62
  upscaledColor = texture(tex, nearestUv);
63
- upscaledWeight = texture(globalIlluminationWeightTexture, nearestUv).r;
63
+ upscaledWeight = texture(globalIlluminationWeightTexture, nearestUv).rg;
64
64
  return;
65
65
  }
66
66
 
@@ -78,5 +78,5 @@ import{ScreenSpacePass as e}from"../views/3d/webgl-engine/core/shaderLibrary/Scr
78
78
  weight11 * jointBilateralWeight11
79
79
  ) / jointBilateralWeightSum;
80
80
  }
81
- `),u.outputs.add("fragColor","vec4",0),u.outputs.add("fragWeight","float",1),g.main.add(i`sampleJointBilateralUpscale(uv, fragColor, fragWeight);
82
- fragColor.rgb = quantizeGlobalIlluminationColor(fragColor.rgb);`),u}const d=Object.freeze(Object.defineProperty({__proto__:null,GlobalIlluminationUpscaleDrawParameters:g,build:p},Symbol.toStringTag,{value:"Module"}));export{g as G,d as a,p as b};
81
+ `),u.outputs.add("fragColor","vec4",0),u.outputs.add("fragWeight","vec2",1),m.main.add(i`sampleJointBilateralUpscale(uv, fragColor, fragWeight);
82
+ fragColor.rgb = quantizeGlobalIlluminationColor(fragColor.rgb);`),u}const v=Object.freeze(Object.defineProperty({__proto__:null,GlobalIlluminationUpscaleDrawParameters:m,build:p},Symbol.toStringTag,{value:"Module"}));export{m as G,v as a,p as b};
package/config.js CHANGED
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import"./core/has.js";import{deepMerge as e}from"./core/object.js";const s={apiKey:void 0,apiKeys:{scopes:[]},applicationName:"",applicationUrl:globalThis.location?.href,assetsPath:"",fontsUrl:"https://static.arcgis.com/fonts",geometryServiceUrl:"https://utility.arcgisonline.com/arcgis/rest/services/Geometry/GeometryServer",geoRSSServiceUrl:"https://utility.arcgis.com/sharing/rss",kmlServiceUrl:"https://utility.arcgis.com/sharing/kml",userPrivilegesApplied:!0,portalUrl:"https://www.arcgis.com",respectPrefersReducedMotion:!0,routeServiceUrl:"https://route-api.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World",workers:{loaderConfig:{has:{},paths:{},map:{},packages:[]}},request:{crossOriginNoCorsDomains:null,httpsDomains:["arcgis.com","arcgisonline.com","esrikr.com","premiumservices.blackbridge.com","esripremium.accuweather.com","gbm.digitalglobe.com","firstlook.digitalglobe.com","msi.digitalglobe.com"],interceptors:[],internalInterceptors:[],maxUrlLength:2e3,priority:"high",proxyRules:[],proxyUrl:null,timeout:62e3,trustedServers:[],useIdentity:!0},log:{interceptors:[],level:null}};if(globalThis.esriConfig&&(e(s,globalThis.esriConfig,!0),delete s.has),!s.assetsPath){{const e="5.2.0-next.50";s.assetsPath=`https://cdn.jsdelivr.net/npm/@arcgis/core@${e}/assets`}s.defaultAssetsPath=s.assetsPath}export{s as default};
2
+ import"./core/has.js";import{deepMerge as e}from"./core/object.js";const s={apiKey:void 0,apiKeys:{scopes:[]},applicationName:"",applicationUrl:globalThis.location?.href,assetsPath:"",fontsUrl:"https://static.arcgis.com/fonts",geometryServiceUrl:"https://utility.arcgisonline.com/arcgis/rest/services/Geometry/GeometryServer",geoRSSServiceUrl:"https://utility.arcgis.com/sharing/rss",kmlServiceUrl:"https://utility.arcgis.com/sharing/kml",userPrivilegesApplied:!0,portalUrl:"https://www.arcgis.com",respectPrefersReducedMotion:!0,routeServiceUrl:"https://route-api.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World",workers:{loaderConfig:{has:{},paths:{},map:{},packages:[]}},request:{crossOriginNoCorsDomains:null,httpsDomains:["arcgis.com","arcgisonline.com","esrikr.com","premiumservices.blackbridge.com","esripremium.accuweather.com","gbm.digitalglobe.com","firstlook.digitalglobe.com","msi.digitalglobe.com"],interceptors:[],internalInterceptors:[],maxUrlLength:2e3,priority:"high",proxyRules:[],proxyUrl:null,timeout:62e3,trustedServers:[],useIdentity:!0},log:{interceptors:[],level:null}};if(globalThis.esriConfig&&(e(s,globalThis.esriConfig,!0),delete s.has),!s.assetsPath){{const e="5.2.0-next.51";s.assetsPath=`https://cdn.jsdelivr.net/npm/@arcgis/core@${e}/assets`}s.defaultAssetsPath=s.assetsPath}export{s as default};
package/core/types.d.ts CHANGED
@@ -20,7 +20,11 @@ export interface ScreenPoint {
20
20
  y: number;
21
21
  }
22
22
 
23
- /** @since 5.1 */
23
+ /**
24
+ * Rectangle on the screen in DOM/CSS coordinate space.
25
+ *
26
+ * @since 5.1
27
+ */
24
28
  export interface ScreenRect {
25
29
  /**
26
30
  * The x coordinate in pixels.
package/kernel.js CHANGED
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import has from"./core/has.js";import{addQueryParameter as o}from"./core/urlUtils.js";export{buildDate,commitHash as revision}from"./support/revision.js";Symbol.dispose??=Symbol("Symbol.dispose"),Symbol.asyncDispose??=Symbol("Symbol.asyncDispose");const e="5.2";let s,r=e;function i(o){s=o}function t(e){const r=s?.findCredential(e);return r?.token?o(e,"token",r.token):e}r="5.2.0-next.50",has("host-webworker")||globalThis.$arcgis||Object.defineProperty(globalThis,"$arcgis",{configurable:!1,enumerable:!0,writable:!1,value:{}}),has("host-webworker");export{t as addTokenParameter,r as fullVersion,s as id,i as setId,e as version};
2
+ import has from"./core/has.js";import{addQueryParameter as o}from"./core/urlUtils.js";export{buildDate,commitHash as revision}from"./support/revision.js";Symbol.dispose??=Symbol("Symbol.dispose"),Symbol.asyncDispose??=Symbol("Symbol.asyncDispose");const e="5.2";let s,r=e;function i(o){s=o}function t(e){const r=s?.findCredential(e);return r?.token?o(e,"token",r.token):e}r="5.2.0-next.51",has("host-webworker")||globalThis.$arcgis||Object.defineProperty(globalThis,"$arcgis",{configurable:!1,enumerable:!0,writable:!1,value:{}}),has("host-webworker");export{t as addTokenParameter,r as fullVersion,s as id,i as setId,e as version};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcgis/core",
3
- "version": "5.2.0-next.50",
3
+ "version": "5.2.0-next.51",
4
4
  "type": "module",
5
5
  "homepage": "https://js.arcgis.com",
6
6
  "description": "ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API",
@@ -20,11 +20,11 @@
20
20
  "license": "SEE LICENSE IN LICENSE.md",
21
21
  "dependencies": {
22
22
  "@amcharts/amcharts5": "~5.19.1",
23
- "@arcgis/toolkit": "^5.2.0-next.44",
23
+ "@arcgis/toolkit": "^5.2.0-next.47",
24
24
  "@esri/arcgis-html-sanitizer": "~4.1.0",
25
25
  "@esri/calcite-components": "^5.1.1",
26
26
  "@vaadin/grid": "~25.2.4",
27
- "@zip.js/zip.js": "~2.8.26",
27
+ "@zip.js/zip.js": "~2.8.31",
28
28
  "luxon": "~3.7.2",
29
29
  "marked": "~18.0.6",
30
30
  "tslib": "^2.8.1"
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- const e="20260716",b="dc5b3be59fa05ccbe5ee292bd3d3f2381e560205";export{e as buildDate,b as commitHash};
2
+ const e="20260717",a="7ae5913acf27eeea92fcae2484b4e1897e57d7c9";export{e as buildDate,a as commitHash};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as t}from"tslib";import{makeHandle as e}from"../../../../core/handleUtils.js";import"../../../../core/has.js";import{watch as i,syncAndInitial as s}from"../../../../core/reactiveUtils.js";import{property as o,subclass as a}from"../../../../core/accessorSupport/decorators.js";import{LineOfSightPlacementController as n}from"./LineOfSightPlacementController.js";import{LineOfSightRayIntersector as r}from"./LineOfSightRayIntersector.js";import{LineOfSightReshapeTool3D as l}from"./LineOfSightReshapeTool3D.js";import{ExclusiveOperationManager as h}from"../../../analysis/ExclusiveOperationManager.js";import{ViewEventPriorities as c}from"../../../input/InputManager.js";import{AnalysisToolBase as p}from"../../../interactive/AnalysisToolBase.js";import{deactivevateTool as v}from"../../../interactive/interactiveToolUtils.js";import{sketchKeys as d}from"../../../interactive/keybindings.js";const y={ready:"ready",creating:"creating",created:"created"};let _=class extends p{constructor(t){super(t),this._operationManager=new h,this._syncingActiveTool=!1,this.analysisViewData=null,this.removeIncompleteOnCancel=!1,this._reshapeIntersector=new r({view:t.view}),this._reshapeTool=new l({analysis:t.analysis,analysisViewData:t.analysisViewData,intersector:this._reshapeIntersector,view:t.view}),this._placementController=new n({...t,parent:this,shouldPreventVertexAdd:(t,e)=>this._reshapeTool.hasManipulatorAt(t,e)})}get active(){return this._reshapeTool.active||this._placementController.active}get canRedo(){return this._activeUndoRedoComponent?.canRedo??!1}get canUndo(){return this._activeUndoRedoComponent?.canUndo??!1}get state(){return this._placementController.active?y.creating:null!=this.analysis.observer?.position?y.created:y.ready}get cursor(){return this._placementController.active?"crosshair":null}get updating(){return this._reshapeTool.updating||this._placementController.updating}initialize(){this.addHandles([this.view.on("key-down",t=>this._onKeyDown(t),c.WIDGET),i(()=>({editable:this.editable,interactive:this.analysisViewData.interactive,placementActive:this._placementController.active,valid:this.analysis.valid,visible:this.visible}),()=>this._syncActiveTool(),s),i(()=>this.state===y.created,t=>{t?this.finishToolCreation():this._set("created",!1)},s),i(()=>this.analysisViewData.visible,t=>{this.visible=t},s),i(()=>{const{analysis:t}=this,{observer:e,targets:i}=t;return{observer:e,observerPosition:e?.position,observerElevationInfo:e?.elevationInfo,observerFeature:e?.feature,targets:i.toArray().map(t=>[t,t.position,t.elevationInfo,t.feature])}},()=>this._syncItemsFromAnalysis(),s),i(()=>this.editable,t=>{this.analysisViewData.editable=t},s)])}destroy(){this._operationManager.destroy(),this._reshapeTool.stop(),this._placementController.stop(),this._reshapeTool.destroy(),this._placementController.destroy(),this._reshapeIntersector.destroy()}place(t){return this.analysisViewData.interactive=!0,this._operationManager.start("place",async(t,o)=>{const a=this.analysis.clone();let n=!1,r=!1;const l=()=>{r||(r=!0,this.stop(),o.aborted||!this.analysis.valid||this.analysis.equals(a)?t.reject():t.resolve({}))};t.handles.push(e(()=>this.stop()),i(()=>this._placementController.active,t=>{t?n=!0:n&&l()},s)),this.continue()},t)}activate(){this.view.focus(),this.analysisViewData.interactive=!0,this._syncActiveTool(),this.analysis.valid||this._placementController.active||this.continue()}deactivate(){this.onDeactivate()}continue(){this.analysisViewData.interactive=!0,this._placementController.continue()}stop(){this._placementController.stop(),this._placementController.placementElevationInfo=null,this._syncActiveTool()}redo(){this._activeUndoRedoComponent?.redo()}undo(){this._activeUndoRedoComponent?.undo()}get testInfo(){}onEditableChange(){this.analysisViewData.editable=this.editable,this._reshapeTool.setEditableFlag(1,!0),this._reshapeTool.setEditableFlag(0,this.editable),this._syncActiveTool()}_hideReshapeTool(){this._reshapeTool.stop(),this._reshapeTool.visible=!1}_onKeyDown(t){const e=t.key;e===d.undo&&this.canUndo?(t.stopPropagation(),this.undo()):e===d.redo&&this.canRedo?(t.stopPropagation(),this.redo()):e===d.cancel&&!this.active&&this._reshapeTool.hasSelection&&this._reshapeTool.clearSelection()}get _activeUndoRedoComponent(){return this.analysisViewData.interactive?this._placementController.active||!this._canActivateReshapeTool?this._placementController.active?this._placementController:null:this._reshapeTool:null}get _canActivateReshapeTool(){return this.visible&&this.editable&&this.analysis.valid&&null!=this.analysis.observer?.position}_syncActiveTool(){if(!this._syncingActiveTool){this._syncingActiveTool=!0;try{const t=this.analysisViewData.interactive,e=this._canActivateReshapeTool;if(this._placementController.visible=this.visible&&t,this._reshapeTool.isParentToolInteracting=t&&this._placementController.active,!t)return this._placementController.stop(),this._hideReshapeTool(),this.analysisViewData.cursorTarget=null,void v(this.view,this);if(this._placementController.active||!e)return this._hideReshapeTool(),void v(this.view,this);if(this._reshapeTool.visible=!0,this.analysisViewData.cursorTarget=null,!this._reshapeTool.active&&!this._reshapeTool.hasSelection){const t=this.analysis.targets.at(-1);null!=t&&this._reshapeTool.applySelection({type:"target",target:t})}v(this.view,this)}finally{this._syncingActiveTool=!1}}}_syncItemsFromAnalysis(){this._syncActiveTool()}};t([o({constructOnly:!0})],_.prototype,"view",void 0),t([o({constructOnly:!0})],_.prototype,"analysis",void 0),t([o({constructOnly:!0})],_.prototype,"analysisViewData",void 0),t([o()],_.prototype,"active",null),t([o()],_.prototype,"canRedo",null),t([o()],_.prototype,"canUndo",null),t([o()],_.prototype,"state",null),t([o()],_.prototype,"cursor",null),t([o()],_.prototype,"updating",null),t([o()],_.prototype,"removeIncompleteOnCancel",void 0),t([o()],_.prototype,"_canActivateReshapeTool",null),_=t([a("esri.views.3d.analysis.LineOfSight.LineOfSightTool2")],_);export{_ as LineOfSightTool2};
2
+ import{__decorate as t}from"tslib";import{makeHandle as e}from"../../../../core/handleUtils.js";import"../../../../core/has.js";import{watch as i,syncAndInitial as s}from"../../../../core/reactiveUtils.js";import{property as o,subclass as a}from"../../../../core/accessorSupport/decorators.js";import{LineOfSightPlacementController as n}from"./LineOfSightPlacementController.js";import{LineOfSightRayIntersector as r}from"./LineOfSightRayIntersector.js";import{LineOfSightReshapeTool3D as l}from"./LineOfSightReshapeTool3D.js";import{ExclusiveOperationManager as h}from"../../../analysis/ExclusiveOperationManager.js";import{ViewEventPriorities as c}from"../../../input/InputManager.js";import{AnalysisToolBase as p}from"../../../interactive/AnalysisToolBase.js";import{deactivevateTool as v}from"../../../interactive/interactiveToolUtils.js";import{sketchKeys as d}from"../../../interactive/keybindings.js";const y={ready:"ready",creating:"creating",created:"created"};let _=class extends p{constructor(t){super(t),this._operationManager=new h,this._syncingActiveTool=!1,this.analysisViewData=null,this.removeIncompleteOnCancel=!1,this._reshapeIntersector=new r({view:t.view}),this._reshapeTool=new l({analysis:t.analysis,analysisViewData:t.analysisViewData,intersector:this._reshapeIntersector,view:t.view}),this._placementController=new n({...t,parent:this,shouldPreventVertexAdd:(t,e)=>this._reshapeTool.hasManipulatorAt(t,e)})}get active(){return this._reshapeTool.active||this._placementController.active}get canRedo(){return this._activeUndoRedoComponent?.canRedo??!1}get canUndo(){return this._activeUndoRedoComponent?.canUndo??!1}get state(){return this._placementController.active?y.creating:null!=this.analysis.observer?.position?y.created:y.ready}get cursor(){return this._placementController.active?"crosshair":null}get updating(){return this._reshapeTool.updating||this._placementController.updating}initialize(){this.addHandles([this.view.on("key-down",t=>this._onKeyDown(t),c.WIDGET),i(()=>({editable:this.editable,interactive:this.analysisViewData.interactive,placementActive:this._placementController.active,valid:this.analysis.valid,visible:this.visible}),()=>this._syncActiveTool(),s),i(()=>this.state===y.created,t=>{t?this.finishToolCreation():this._set("created",!1)},s),i(()=>this.analysisViewData.visible,t=>{this.visible=t},s),i(()=>{const{analysis:t}=this,{observer:e,targets:i}=t;return{observer:e,observerPosition:e?.position,observerElevationInfo:e?.elevationInfo,observerFeature:e?.feature,targets:i.toArray().map(t=>[t,t.position,t.elevationInfo,t.feature])}},()=>this._syncItemsFromAnalysis(),s),i(()=>this.editable,t=>{this.analysisViewData.editable=t},s)])}destroy(){this._operationManager.destroy(),this._reshapeTool.stop(),this._placementController.stop(),this._reshapeTool.destroy(),this._placementController.destroy(),this._reshapeIntersector.destroy()}place(t){return this.analysisViewData.interactive=!0,this._operationManager.start("place",async(t,o)=>{const a=this.analysis.clone();let n=!1,r=!1;const l=()=>{if(!r){if(r=!0,this.stop(),!this.analysis.valid)return this.analysis.clear(),void t.reject();o.aborted||this.analysis.equals(a)?t.reject():t.resolve({})}};t.handles.push(e(()=>this.stop()),i(()=>this._placementController.active,t=>{t?n=!0:n&&l()},s)),this.continue()},t)}activate(){this.view.focus(),this.analysisViewData.interactive=!0,this._syncActiveTool(),this.analysis.valid||this._placementController.active||this.continue()}deactivate(){this.onDeactivate()}continue(){this.analysisViewData.interactive=!0,this._placementController.continue()}stop(){this._placementController.stop(),this._placementController.placementElevationInfo=null,this._syncActiveTool()}redo(){this._activeUndoRedoComponent?.redo()}undo(){this._activeUndoRedoComponent?.undo()}get testInfo(){}onEditableChange(){this.analysisViewData.editable=this.editable,this._reshapeTool.setEditableFlag(1,!0),this._reshapeTool.setEditableFlag(0,this.editable),this._syncActiveTool()}_hideReshapeTool(){this._reshapeTool.stop(),this._reshapeTool.visible=!1}_onKeyDown(t){const e=t.key;e===d.undo&&this.canUndo?(t.stopPropagation(),this.undo()):e===d.redo&&this.canRedo?(t.stopPropagation(),this.redo()):e===d.cancel&&!this.active&&this._reshapeTool.hasSelection&&this._reshapeTool.clearSelection()}get _activeUndoRedoComponent(){return this.analysisViewData.interactive?this._placementController.active||!this._canActivateReshapeTool?this._placementController.active?this._placementController:null:this._reshapeTool:null}get _canActivateReshapeTool(){return this.visible&&this.editable&&this.analysis.valid&&null!=this.analysis.observer?.position}_syncActiveTool(){if(!this._syncingActiveTool){this._syncingActiveTool=!0;try{const t=this.analysisViewData.interactive,e=this._canActivateReshapeTool;if(this._placementController.visible=this.visible&&t,this._reshapeTool.isParentToolInteracting=t&&this._placementController.active,!t)return this._placementController.stop(),this._hideReshapeTool(),this.analysisViewData.cursorTarget=null,void v(this.view,this);if(this._placementController.active)return this._reshapeTool.stop(),this._reshapeTool.visible=this.visible,void v(this.view,this);if(!e)return this._hideReshapeTool(),void v(this.view,this);if(this._reshapeTool.visible=!0,this.analysisViewData.cursorTarget=null,!this._reshapeTool.active&&!this._reshapeTool.hasSelection){const t=this.analysis.targets.at(-1);null!=t&&this._reshapeTool.applySelection({type:"target",target:t})}v(this.view,this)}finally{this._syncingActiveTool=!1}}}_syncItemsFromAnalysis(){this._syncActiveTool()}};t([o({constructOnly:!0})],_.prototype,"view",void 0),t([o({constructOnly:!0})],_.prototype,"analysis",void 0),t([o({constructOnly:!0})],_.prototype,"analysisViewData",void 0),t([o()],_.prototype,"active",null),t([o()],_.prototype,"canRedo",null),t([o()],_.prototype,"canUndo",null),t([o()],_.prototype,"state",null),t([o()],_.prototype,"cursor",null),t([o()],_.prototype,"updating",null),t([o()],_.prototype,"removeIncompleteOnCancel",void 0),t([o()],_.prototype,"_canActivateReshapeTool",null),_=t([a("esri.views.3d.analysis.LineOfSight.LineOfSightTool2")],_);export{_ as LineOfSightTool2};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{volumeMeasurementConfiguration as t}from"../../../../analysis/VolumeMeasurement/volumeMeasurementConfiguration.js";import r from"../../../../core/Accessor.js";import o from"../../../../core/Logger.js";import{debounce as i,isPromiseLike as n}from"../../../../core/promiseUtils.js";import{createVolume as s}from"../../../../core/quantity.js";import{whenOnce as a,watch as l}from"../../../../core/reactiveUtils.js";import{property as u,subclass as p}from"../../../../core/accessorSupport/decorators.js";import{runUntracked as m}from"../../../../core/accessorSupport/tracking.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{setAxes as h}from"../../../../core/libs/gl-matrix-2/math/quat.js";import{create as d}from"../../../../core/libs/gl-matrix-2/factories/quatf64.js";import{sqrDist as f}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as g}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{scaleAndAdd as y,scale as _,set as v,negate as b}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as w,fromValues as j,clone as E}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as R}from"../../../../core/support/UpdatingHandles.js";import x from"../../../../geometry/Multipoint.js";import{projectOrLoad as C}from"../../../../geometry/projectionUtils.js";import{e as T}from"../../../../chunks/containsOperator.js";import{e as O}from"../../../../chunks/convexHullOperator.js";import{e as L}from"../../../../chunks/simplifyOperator.js";import{e as G}from"../../../../chunks/unionOperator.js";import{computeTranslationToOriginAndRotation as V}from"../../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{projectBoundingRect as D}from"../../../../geometry/projection/projectBoundingRect.js";import{empty as H,create as M,fromExtent as I,intersects as P}from"../../../../geometry/support/aaBoundingRect.js";import{vectorCoordinates as U}from"../../../../geometry/support/coordinateSystem.js";import{isClockwise as S}from"../../../../geometry/support/coordsUtils.js";import{newDoubleArray as k}from"../../../../geometry/support/DoubleArray.js";import{t as A}from"../../../../chunks/vec3.js";import F from"../../../../symbols/support/ElevationInfo.js";import{logFailedGeometryProjectionError as W}from"../support/projectionUtils.js";import{VolumeMeasurementCutFillComputation as q}from"./VolumeMeasurementCutFillComputation.js";import{VolumeMeasurementInsufficientDataError as B,VolumeMeasurementPerimeterTooLargeError as N,VolumeMeasurementUnsupportedCoordinateSystemError as z,VolumeMeasurementUnsupportedLayerTransparencyError as Z}from"./volumeMeasurementErrors.js";import{VolumeMeasurementRawResult as J}from"./VolumeMeasurementRawResult.js";import K from"./VolumeMeasurementResult.js";import{ElevationContext as Q}from"../../layers/graphics/ElevationContext.js";import{getElevationAtPoint as X}from"../../support/ElevationProvider.js";import{Obb as Y}from"../../support/orientedBoundingBox.js";import{polygonToRenderInfoElevationAligned as $}from"../../support/renderInfoUtils/polygon.js";import{IteratorPreorder as ee}from"../../terrain/tileUtils.js";import{CutFillComputation as te,TargetGeometryRenderInfo as re}from"../../webgl-engine/lib/CutFillComputation.js";import{GeometryWorkerHandle as oe}from"../../../support/GeometryWorkerHandle.js";import{isIntegratedMeshLayerView as ie}from"../../../support/layerViewUtils.js";let ne=class extends r{constructor(e){super(e),this._measurementWorkerHandle=new oe,this.depthExtremaPositions=null,this.analysisObb=null,this._updatingHandles=new R,this._rawResult=null,this._sufficientDataCoverage=!0,this._tileIterator=new ee,this._intersectingObbs=[],this._intersectingTiles=[],this._debouncedUpdate=i(async(e,t,r,o)=>{if(!this._computation.done)return;const{renderCoordsHelper:i}=this.view,n=new q({extent:t,localOrigin:r,renderCoordsHelper:i});this._computation.update(n,o),this._determineDataCoverage(n,e);const[s]=await Promise.allSettled([this._measurementWorkerHandle.areaHorizontal(e,{returnLength:!0}),a(()=>this._computation.done).then(()=>{this._updateDepthExtremaPositions(n,this._computation.getResult())})]);if(this.error)return void(this._rawResult=null);const l=this._computation.getResult();this._updateResult(n,l,"fulfilled"===s.status?s.value:null)}),this._determineDataCoverage=(e,t)=>{const{frustum:r}=this._computation,{cameraDimensions:o}=e;t.extent&&r&&(this._intersectingObbs.length=0,this._imLayerViewsAffectingMeasurement.forEach(e=>{this._findIntersectingObbs(e,r)}),this._intersectingObbs.length?this._sufficientDataCoverage=this._sufficientIntegratedMeshCoverage(t,o):(this._findIntersectingTerrainTiles(t.extent),this._sufficientDataCoverage=this._sufficientTerrainCoverage(o)))}}initialize(){const e=this.view;this._computation=new te({view:e}),this.addHandles([this._createElevationUpdateHandle(),l(()=>({localOrigin:this._localOrigin,targetGeometryRenderInfo:this._targetGeometryRenderInfo,transparencyError:!!this._unsupportedLayerTransparencyError}),({localOrigin:e,targetGeometryRenderInfo:t,transparencyError:r})=>{const o=this._projectedGeometry,i=o?.extent;if(!o||!i||!e||!t||r)return this._rawResult=null,this.depthExtremaPositions=null,this.analysisObb=null,void(this._sufficientDataCoverage=!0);this._updatingHandles.consumePromise(this._debouncedUpdate(o,i,e,t))})])}destroy(){this._updatingHandles.destroy(),this._computation.destroy(),this._measurementWorkerHandle.destroy()}get _projectedGeometry(){const e=this.analysis.geometry;if(!e||!this.analysis.valid)return null;const t=L(e),r=C(t,this.view.spatialReference);return r.pending?(this._updatingHandles.consumePromise(r.pending),null):(t&&!r.geometry&&W(this.analysis,e.spatialReference,o.getLogger(this)),r.geometry)}get _localOrigin(){const e=this._projectedGeometry?.extent;return e?j(e.center.x,e.center.y,0):null}get elevationAlignedGeometry(){const e=this._projectedGeometry;return e?m(()=>{const t=e.clone();return se(this.view.elevationProvider,t),t}):null}get targetGeometry(){const{elevationAlignedGeometry:e}=this;if(!e)return null;const t=this.analysis.measureType,{effectiveTargetElevation:r}=this.analysisViewData;if("stockpile"===t||null==r)return e;const o=e.clone();return o.rings.forEach(e=>e.forEach(e=>e[2]=r)),o}get _targetGeometryRenderInfo(){const e=this.targetGeometry,t=this._localOrigin;if(!e||!t)return null;const{elevationProvider:r,renderCoordsHelper:o}=this.view,i=$(e,r,o,Q.fromElevationInfo(new F({mode:"absolute-height"})));if(n(i))return this._updatingHandles.consumePromise(i),null;if(null==i)return null;const{positions:s,polygonIndices:a,vertexCount:l}=i,u=k(3*l),p=c(),m=c();return V(e.spatialReference,t,p,o.spatialReference),m[12]=-p[12],m[13]=-p[13],m[14]=-p[14],A(u,s,m),new re(u,a)}get updating(){return this._computation.updating||this._updatingHandles.updating}get result(){const e=this._rawResult,{volume:t,area:r,length:o}=this.analysisViewData.effectiveDisplayUnits;return e?new K({measureType:this.analysis.measureType,rawResult:e,volumeUnit:t,areaUnit:r,lengthUnit:o}):null}get error(){return this._unsupportedCoordinateSystemError??this._unsupportedLayerTransparencyError??this._perimeterTooLargeError??this._insufficientDataError}get _imLayerViewsAffectingMeasurement(){return this.view.allLayerViews.filter(e=>ie(e)).filter(e=>e.visible&&!e.suspended)}get _insufficientDataError(){return this._sufficientDataCoverage?null:new B}get _perimeterTooLargeError(){return this._perimeterTooLargeLocalError??this._perimeterTooLargeGlobalError}get _perimeterTooLargeLocalError(){const{spatialReference:e,state:{isLocal:r}}=this.view;if(!r||!e.isWebMercator)return null;const o=this._perimeterForError,{maxPerimeterLocalWebMercator:i}=t;return null!=o&&o>i?new N:null}get _perimeterTooLargeGlobalError(){if(!this.view.state.isGlobal)return null;const e=this._perimeterForError,{maxPerimeterGlobal:r}=t;return null!=e&&e>r?new N:null}get _unsupportedCoordinateSystemError(){return this.view.state.isLocal&&this.view.spatialReference.isGeographic?new z:null}get _unsupportedLayerTransparencyError(){return this.view.map.ground&&this.view.map.ground.opacity<1?new Z:null}get _perimeterForError(){const e=this._projectedGeometry;if(null==e)return null;let t=null;for(const r of e.rings){if(!S(r))continue;const e=ue(pe(r));t=e?Math.max(t??0,e):t}return null!=t?t*e.spatialReference.metersPerUnit:null}_createElevationUpdateHandle(){const e=e=>{const t=this._projectedGeometry?.extent;"ground"===e.context&&t&&(D(e.extent,e.spatialReference,ce,this.view.spatialReference),I(t,he),P(ce,he)&&this.notifyChange("elevationAlignedGeometry"))};return this.view.elevationProvider.on("elevation-change",t=>e(t))}_updateResult(e,t,r){const{unitInMeters:o}=this.view.renderCoordsHelper,{dimensions:{width:i,height:n},cameraNearFar:{near:a,far:l}}=e,u=i/t.width*(n/t.height),p=ae(t.cut.totalDepth,a,l)*u,m=ae(t.fill.totalDepth,a,l)*u,c=o**3;this._rawResult=new J({cutVolume:s(Math.abs(p*c),"cubic-meters"),fillVolume:s(m*c,"cubic-meters"),area:r?.area,perimeter:r?.length})}_updateDepthExtremaPositions(e,t){const{dimensions:{width:r,height:o},cameraNearFar:{near:i,far:n},cameraPositionRenderSpace:s,northVector:a,eastVector:l,upVector:u}=e,p=e=>{const{depthExtremum:p,depthExtremumCoords:[m,c],totalDepth:h}=e,d=E(s);return 0!==h&&(y(d,d,l,r*(m/t.width-.5)),y(d,d,a,o*(c/t.height-.5))),y(d,d,u,-ae(p,i,n)),d},m={cut:p(t.cut),fill:p(t.fill)};this.depthExtremaPositions=m,this.analysisObb=le(e,m)}_findIntersectingObbs(e,t){const r=this._intersectingObbs;"integrated-mesh-3d"===e.type&&e.getVisibleNodes().forEach(o=>{e.isNodeLoaded(o.index)&&o.geometryObbInRenderSR?.intersectsFrustum(t)&&r.push(o.geometryObbInRenderSR)}),"integrated-mesh-3dtiles"===e.type&&e.forEachVisibleComponentObject(({obb:e})=>{e.intersectsFrustum(t)&&r.push(e)})}_sufficientIntegratedMeshCoverage(e,t){const{renderCoordsHelper:r,spatialReference:o}=this.view,i=[],n=new x({spatialReference:o});if(this._intersectingObbs.forEach(e=>{if(me(e.radius,t)&&(e.getCorners(we),n.points.length=0,we.forEach(e=>{const t=r.fromRenderCoords(e,je,o);t&&n.addPoint([t[0],t[1]])}),n.points.length)){const e=O(n);"polygon"===e?.type&&i.push(e)}}),!i.length)return!1;const s=G(i);return!!s&&T(s,e)}_findIntersectingTerrainTiles(e){const{basemapTerrain:t}=this.view;this._intersectingTiles.length=0,I(e,de);const r=this._tileIterator;r.reset(t.rootTiles);for(let o=r.next();o;o=r.next())o.intersectsExtent(de)?o.rendered&&this._intersectingTiles.push(o):r.skipSubtree()}_sufficientTerrainCoverage(e){const{basemapTerrain:{tilingScheme:t}}=this.view;if(!this._intersectingTiles.length)return!1;const r=256/t.pixelSize;return this._intersectingTiles.every(t=>me(t.radius*r,e))}};function se(e,t){t.hasZ=!0,t.rings.forEach(t=>t.forEach(t=>t[2]=X(e,t,"ground")??0))}function ae(e,t,r){return e*(r-t)+t}function le(e,t){const{boundingRect:r,eastVector:o,northVector:i,upVector:n}=e;U(t.cut,o,i,n,fe),U(t.fill,o,i,n,ge);const s=.5*(r[0]+r[2]),a=.5*(r[1]+r[3]),l=Math.min(fe[2],ge[2]),u=Math.max(fe[2],ge[2]),p=.5*(l+u);return _(ye,o,s),y(ye,ye,i,a),y(ye,ye,n,p),v(_e,.5*(r[2]-r[0]),.5*(r[3]-r[1]),.5*(u-l)),b(ve,n),new Y(ye,_e,h(be,ve,o,i))}function ue(e){if(!e)return null;let t=null,r=null,o=0;for(const i of e)t||(t=[i[0],i[1]]),r?o+=f(r,i):r=[0,0],r[0]=i[0],r[1]=i[1];return t&&r&&(o+=f(r,t)),Math.sqrt(o)}function*pe(e){const t=g();for(let r=0;r<e.length;r++)t[0]=e[r][0],t[1]=e[r][1],yield t}e([u()],ne.prototype,"_projectedGeometry",null),e([u()],ne.prototype,"_localOrigin",null),e([u()],ne.prototype,"elevationAlignedGeometry",null),e([u()],ne.prototype,"targetGeometry",null),e([u()],ne.prototype,"_targetGeometryRenderInfo",null),e([u({constructOnly:!0})],ne.prototype,"analysis",void 0),e([u({constructOnly:!0})],ne.prototype,"analysisViewData",void 0),e([u({constructOnly:!0})],ne.prototype,"view",void 0),e([u()],ne.prototype,"updating",null),e([u()],ne.prototype,"result",null),e([u()],ne.prototype,"depthExtremaPositions",void 0),e([u()],ne.prototype,"analysisObb",void 0),e([u()],ne.prototype,"error",null),e([u()],ne.prototype,"_imLayerViewsAffectingMeasurement",null),e([u()],ne.prototype,"_insufficientDataError",null),e([u()],ne.prototype,"_perimeterTooLargeError",null),e([u()],ne.prototype,"_perimeterTooLargeLocalError",null),e([u()],ne.prototype,"_perimeterTooLargeGlobalError",null),e([u()],ne.prototype,"_unsupportedCoordinateSystemError",null),e([u()],ne.prototype,"_unsupportedLayerTransparencyError",null),e([u()],ne.prototype,"_perimeterForError",null),e([u()],ne.prototype,"_computation",void 0),e([u({readOnly:!0})],ne.prototype,"_updatingHandles",void 0),e([u()],ne.prototype,"_rawResult",void 0),e([u()],ne.prototype,"_sufficientDataCoverage",void 0),ne=e([p("esri.views.3d.analysis.VolumeMeasurement.VolumeMeasurementCutFillController")],ne);const me=(e,t)=>e<(t.width+t.height)/2,ce=H(),he=H(),de=M(),fe=w(),ge=w(),ye=w(),_e=w(),ve=w(),be=d(),we=new Array(8).fill(0).map(()=>w()),je=w();export{ne as VolumeMeasurementCutFillController};
2
+ import{__decorate as e}from"tslib";import{volumeMeasurementConfiguration as t}from"../../../../analysis/VolumeMeasurement/volumeMeasurementConfiguration.js";import r from"../../../../core/Accessor.js";import o from"../../../../core/Logger.js";import{debounce as i,isPromiseLike as n}from"../../../../core/promiseUtils.js";import{createVolume as s}from"../../../../core/quantity.js";import{whenOnce as a,watch as l}from"../../../../core/reactiveUtils.js";import{property as u,subclass as p}from"../../../../core/accessorSupport/decorators.js";import{runUntracked as m}from"../../../../core/accessorSupport/tracking.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{setAxes as h}from"../../../../core/libs/gl-matrix-2/math/quat.js";import{create as d}from"../../../../core/libs/gl-matrix-2/factories/quatf64.js";import{sqrDist as f}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as g}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{scaleAndAdd as y,scale as _,set as v,negate as b}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as w,fromValues as j,clone as E}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as x}from"../../../../core/support/UpdatingHandles.js";import R from"../../../../geometry/Multipoint.js";import{projectOrLoad as C}from"../../../../geometry/projectionUtils.js";import{e as T}from"../../../../chunks/containsOperator.js";import{e as O}from"../../../../chunks/convexHullOperator.js";import{e as L}from"../../../../chunks/simplifyOperator.js";import{e as G}from"../../../../chunks/unionOperator.js";import{computeTranslationToOriginAndRotation as V}from"../../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{projectBoundingRect as D}from"../../../../geometry/projection/projectBoundingRect.js";import{empty as H,create as M,fromExtent as I,intersects as P}from"../../../../geometry/support/aaBoundingRect.js";import{vectorCoordinates as U}from"../../../../geometry/support/coordinateSystem.js";import{isClockwise as S}from"../../../../geometry/support/coordsUtils.js";import{newDoubleArray as k}from"../../../../geometry/support/DoubleArray.js";import{t as A}from"../../../../chunks/vec3.js";import F from"../../../../symbols/support/ElevationInfo.js";import{logFailedGeometryProjectionError as W}from"../support/projectionUtils.js";import{VolumeMeasurementCutFillComputation as q}from"./VolumeMeasurementCutFillComputation.js";import{VolumeMeasurementInsufficientDataError as B,VolumeMeasurementPerimeterTooLargeError as N,VolumeMeasurementUnsupportedCoordinateSystemError as z,VolumeMeasurementUnsupportedLayerTransparencyError as Z}from"./volumeMeasurementErrors.js";import{VolumeMeasurementRawResult as J}from"./VolumeMeasurementRawResult.js";import K from"./VolumeMeasurementResult.js";import{ElevationContext as Q}from"../../layers/graphics/ElevationContext.js";import{getElevationAtPoint as X}from"../../support/ElevationProvider.js";import{Obb as Y}from"../../support/orientedBoundingBox.js";import{polygonToRenderInfoElevationAligned as $}from"../../support/renderInfoUtils/polygon.js";import{IteratorPreorder as ee}from"../../terrain/tileUtils.js";import{CutFillComputation as te,TargetGeometryRenderInfo as re}from"../../webgl-engine/lib/CutFillComputation.js";import{GeometryWorkerHandle as oe}from"../../../support/GeometryWorkerHandle.js";import{isIntegratedMeshLayerView as ie}from"../../../support/layerViewUtils.js";let ne=class extends r{constructor(e){super(e),this._measurementWorkerHandle=new oe,this.depthExtremaPositions=null,this.analysisObb=null,this._updatingHandles=new x,this._rawResult=null,this._sufficientDataCoverage=!0,this._tileIterator=new ee,this._intersectingObbs=[],this._intersectingTiles=[],this._debouncedUpdate=i(async(e,t,r,o)=>{if(!this._computation.done)return;const{renderCoordsHelper:i}=this.view,n=new q({extent:t,localOrigin:r,renderCoordsHelper:i});this._computation.update(n,o),this._determineDataCoverage(n,e);const[s]=await Promise.allSettled([this._measurementWorkerHandle.areaHorizontal(e,{returnLength:!0}),a(()=>this._computation.done).then(()=>{this._updateDepthExtremaPositions(n,this._computation.result)})]);if(this.error)return void(this._rawResult=null);const l=this._computation.result;this._updateResult(n,l,"fulfilled"===s.status?s.value:null)}),this._determineDataCoverage=(e,t)=>{const{frustum:r}=this._computation,{cameraDimensions:o}=e;t.extent&&r&&(this._intersectingObbs.length=0,this._imLayerViewsAffectingMeasurement.forEach(e=>{this._findIntersectingObbs(e,r)}),this._intersectingObbs.length?this._sufficientDataCoverage=this._sufficientIntegratedMeshCoverage(t,o):(this._findIntersectingTerrainTiles(t.extent),this._sufficientDataCoverage=this._sufficientTerrainCoverage(o)))}}initialize(){const e=this.view;this._computation=new te({view:e}),this.addHandles([this._createElevationUpdateHandle(),l(()=>({localOrigin:this._localOrigin,targetGeometryRenderInfo:this._targetGeometryRenderInfo,transparencyError:!!this._unsupportedLayerTransparencyError}),({localOrigin:e,targetGeometryRenderInfo:t,transparencyError:r})=>{const o=this._projectedGeometry,i=o?.extent;if(!o||!i||!e||!t||r)return this._rawResult=null,this.depthExtremaPositions=null,this.analysisObb=null,void(this._sufficientDataCoverage=!0);this._updatingHandles.consumePromise(this._debouncedUpdate(o,i,e,t))})])}destroy(){this._updatingHandles.destroy(),this._computation.destroy(),this._measurementWorkerHandle.destroy()}get _projectedGeometry(){const e=this.analysis.geometry;if(!e||!this.analysis.valid)return null;const t=L(e),r=C(t,this.view.spatialReference);return r.pending?(this._updatingHandles.consumePromise(r.pending),null):(t&&!r.geometry&&W(this.analysis,e.spatialReference,o.getLogger(this)),r.geometry)}get _localOrigin(){const e=this._projectedGeometry?.extent;return e?j(e.center.x,e.center.y,0):null}get elevationAlignedGeometry(){const e=this._projectedGeometry;return e?m(()=>{const t=e.clone();return se(this.view.elevationProvider,t),t}):null}get targetGeometry(){const{elevationAlignedGeometry:e}=this;if(!e)return null;const t=this.analysis.measureType,{effectiveTargetElevation:r}=this.analysisViewData;if("stockpile"===t||null==r)return e;const o=e.clone();return o.rings.forEach(e=>e.forEach(e=>e[2]=r)),o}get _targetGeometryRenderInfo(){const e=this.targetGeometry,t=this._localOrigin;if(!e||!t)return null;const{elevationProvider:r,renderCoordsHelper:o}=this.view,i=$(e,r,o,Q.fromElevationInfo(new F({mode:"absolute-height"})));if(n(i))return this._updatingHandles.consumePromise(i),null;if(null==i)return null;const{positions:s,polygonIndices:a,vertexCount:l}=i,u=k(3*l),p=c(),m=c();return V(e.spatialReference,t,p,o.spatialReference),m[12]=-p[12],m[13]=-p[13],m[14]=-p[14],A(u,s,m),new re(u,a)}get updating(){return this._computation.updating||this._updatingHandles.updating}get result(){const e=this._rawResult,{volume:t,area:r,length:o}=this.analysisViewData.effectiveDisplayUnits;return e?new K({measureType:this.analysis.measureType,rawResult:e,volumeUnit:t,areaUnit:r,lengthUnit:o}):null}get error(){return this._unsupportedCoordinateSystemError??this._unsupportedLayerTransparencyError??this._perimeterTooLargeError??this._insufficientDataError}get _imLayerViewsAffectingMeasurement(){return this.view.allLayerViews.filter(e=>ie(e)).filter(e=>e.visible&&!e.suspended)}get _insufficientDataError(){return this._sufficientDataCoverage?null:new B}get _perimeterTooLargeError(){return this._perimeterTooLargeLocalError??this._perimeterTooLargeGlobalError}get _perimeterTooLargeLocalError(){const{spatialReference:e,state:{isLocal:r}}=this.view;if(!r||!e.isWebMercator)return null;const o=this._perimeterForError,{maxPerimeterLocalWebMercator:i}=t;return null!=o&&o>i?new N:null}get _perimeterTooLargeGlobalError(){if(!this.view.state.isGlobal)return null;const e=this._perimeterForError,{maxPerimeterGlobal:r}=t;return null!=e&&e>r?new N:null}get _unsupportedCoordinateSystemError(){return this.view.state.isLocal&&this.view.spatialReference.isGeographic?new z:null}get _unsupportedLayerTransparencyError(){return this.view.map.ground&&this.view.map.ground.opacity<1?new Z:null}get _perimeterForError(){const e=this._projectedGeometry;if(null==e)return null;let t=null;for(const r of e.rings){if(!S(r))continue;const e=ue(pe(r));t=e?Math.max(t??0,e):t}return null!=t?t*e.spatialReference.metersPerUnit:null}_createElevationUpdateHandle(){const e=e=>{const t=this._projectedGeometry?.extent;"ground"===e.context&&t&&(D(e.extent,e.spatialReference,ce,this.view.spatialReference),I(t,he),P(ce,he)&&this.notifyChange("elevationAlignedGeometry"))};return this.view.elevationProvider.on("elevation-change",t=>e(t))}_updateResult(e,t,r){if(!t)return;const{unitInMeters:o}=this.view.renderCoordsHelper,{dimensions:{width:i,height:n},cameraNearFar:{near:a,far:l}}=e,u=i/t.width*(n/t.height),p=ae(t.cut.totalDepth,a,l)*u,m=ae(t.fill.totalDepth,a,l)*u,c=o**3;this._rawResult=new J({cutVolume:s(Math.abs(p*c),"cubic-meters"),fillVolume:s(m*c,"cubic-meters"),area:r?.area,perimeter:r?.length})}_updateDepthExtremaPositions(e,t){if(!t)return;const{dimensions:{width:r,height:o},cameraNearFar:{near:i,far:n},cameraPositionRenderSpace:s,northVector:a,eastVector:l,upVector:u}=e,p=e=>{const{depthExtremum:p,depthExtremumCoords:[m,c],totalDepth:h}=e,d=E(s);return 0!==h&&(y(d,d,l,r*(m/t.width-.5)),y(d,d,a,o*(c/t.height-.5))),y(d,d,u,-ae(p,i,n)),d},m={cut:p(t.cut),fill:p(t.fill)};this.depthExtremaPositions=m,this.analysisObb=le(e,m)}_findIntersectingObbs(e,t){const r=this._intersectingObbs;"integrated-mesh-3d"===e.type&&e.getVisibleNodes().forEach(o=>{e.isNodeLoaded(o.index)&&o.geometryObbInRenderSR?.intersectsFrustum(t)&&r.push(o.geometryObbInRenderSR)}),"integrated-mesh-3dtiles"===e.type&&e.forEachVisibleComponentObject(({obb:e})=>{e.intersectsFrustum(t)&&r.push(e)})}_sufficientIntegratedMeshCoverage(e,t){const{renderCoordsHelper:r,spatialReference:o}=this.view,i=[],n=new R({spatialReference:o});if(this._intersectingObbs.forEach(e=>{if(me(e.radius,t)&&(e.getCorners(we),n.points.length=0,we.forEach(e=>{const t=r.fromRenderCoords(e,je,o);t&&n.addPoint([t[0],t[1]])}),n.points.length)){const e=O(n);"polygon"===e?.type&&i.push(e)}}),!i.length)return!1;const s=G(i);return!!s&&T(s,e)}_findIntersectingTerrainTiles(e){const{basemapTerrain:t}=this.view;this._intersectingTiles.length=0,I(e,de);const r=this._tileIterator;r.reset(t.rootTiles);for(let o=r.next();o;o=r.next())o.intersectsExtent(de)?o.rendered&&this._intersectingTiles.push(o):r.skipSubtree()}_sufficientTerrainCoverage(e){const{basemapTerrain:{tilingScheme:t}}=this.view;if(!this._intersectingTiles.length)return!1;const r=256/t.pixelSize;return this._intersectingTiles.every(t=>me(t.radius*r,e))}};function se(e,t){t.hasZ=!0,t.rings.forEach(t=>t.forEach(t=>t[2]=X(e,t,"ground")??0))}function ae(e,t,r){return e*(r-t)+t}function le(e,t){const{boundingRect:r,eastVector:o,northVector:i,upVector:n}=e;U(t.cut,o,i,n,fe),U(t.fill,o,i,n,ge);const s=.5*(r[0]+r[2]),a=.5*(r[1]+r[3]),l=Math.min(fe[2],ge[2]),u=Math.max(fe[2],ge[2]),p=.5*(l+u);return _(ye,o,s),y(ye,ye,i,a),y(ye,ye,n,p),v(_e,.5*(r[2]-r[0]),.5*(r[3]-r[1]),.5*(u-l)),b(ve,n),new Y(ye,_e,h(be,ve,o,i))}function ue(e){if(!e)return null;let t=null,r=null,o=0;for(const i of e)t||(t=[i[0],i[1]]),r?o+=f(r,i):r=[0,0],r[0]=i[0],r[1]=i[1];return t&&r&&(o+=f(r,t)),Math.sqrt(o)}function*pe(e){const t=g();for(let r=0;r<e.length;r++)t[0]=e[r][0],t[1]=e[r][1],yield t}e([u()],ne.prototype,"_projectedGeometry",null),e([u()],ne.prototype,"_localOrigin",null),e([u()],ne.prototype,"elevationAlignedGeometry",null),e([u()],ne.prototype,"targetGeometry",null),e([u()],ne.prototype,"_targetGeometryRenderInfo",null),e([u({constructOnly:!0})],ne.prototype,"analysis",void 0),e([u({constructOnly:!0})],ne.prototype,"analysisViewData",void 0),e([u({constructOnly:!0})],ne.prototype,"view",void 0),e([u()],ne.prototype,"updating",null),e([u()],ne.prototype,"result",null),e([u()],ne.prototype,"depthExtremaPositions",void 0),e([u()],ne.prototype,"analysisObb",void 0),e([u()],ne.prototype,"error",null),e([u()],ne.prototype,"_imLayerViewsAffectingMeasurement",null),e([u()],ne.prototype,"_insufficientDataError",null),e([u()],ne.prototype,"_perimeterTooLargeError",null),e([u()],ne.prototype,"_perimeterTooLargeLocalError",null),e([u()],ne.prototype,"_perimeterTooLargeGlobalError",null),e([u()],ne.prototype,"_unsupportedCoordinateSystemError",null),e([u()],ne.prototype,"_unsupportedLayerTransparencyError",null),e([u()],ne.prototype,"_perimeterForError",null),e([u()],ne.prototype,"_computation",void 0),e([u({readOnly:!0})],ne.prototype,"_updatingHandles",void 0),e([u()],ne.prototype,"_rawResult",void 0),e([u()],ne.prototype,"_sufficientDataCoverage",void 0),ne=e([p("esri.views.3d.analysis.VolumeMeasurement.VolumeMeasurementCutFillController")],ne);const me=(e,t)=>e<(t.width+t.height)/2,ce=H(),he=H(),de=M(),fe=w(),ge=w(),ye=w(),_e=w(),ve=w(),be=d(),we=new Array(8).fill(0).map(()=>w()),je=w();export{ne as VolumeMeasurementCutFillController};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import e from"../../../Graphic.js";import{isIterable as n}from"../../../core/iteratorUtils.js";import{screenPointObjectToArray as t,isScreenPolygon as i,isScreenRect as r,createScreenPointArray as s,createScreenPoint as o}from"../../../core/screenUtils.js";import{create as l}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import c from"../../../geometry/Point.js";import a from"../../../geometry/SpatialReference.js";import{projectVectorToVector as u}from"../../../geometry/projection/projectVectorToVector.js";import{fallbackObjectIDAttribute as d}from"../../../layers/LayerConstants.js";import{isIntegratedMeshLayer as p}from"../../../layers/support/layerUtils.js";import{debugFlags as f}from"./debugFlags.js";import{getElevationAtPoint as m}from"./ElevationProvider.js";import{getGraphicHitDedupeKey as g,resolveOrderedIntersectionHits as y}from"./intersectionHitUtils.js";import{Intersector as h}from"../webgl-engine/lib/Intersector.js";import{isValidIntersectorResultRay as w}from"../webgl-engine/lib/IntersectorResult.js";import{toHit as b,toOwner as x}from"../webgl-engine/lib/intersectorUtilsConversions.js";import{terrainId as E}from"../webgl-engine/lib/verticalOffsetUtils.js";async function S(e,n,t,o){const l=t?v(e,t):o;if(i(n))return U(e,n,l,t?.excludeLabels);if(r(n))return U(e,j(n),l,t?.excludeLabels);const c=n,a=s(c.x,c.y);l.requiresGroundFeedback=!0,l.enableDraped=!0;const u=new h(e.state.viewingMode);u.options.selectionMode=!0,u.options.store=2,u.options.excludeLabels=t?.excludeLabels??!1,e.sceneIntersectionHelper.intersectIntersectorScreen(a,u,l);const d=await V(e,u.results.all,l.graphics,{getDistance:e=>e.distanceInRenderSpace,getMapPoint:n=>R(e,n),stopAtSupportSurface:!0}),m=u.results.ground,g=x(m,e),y=null!=g&&"type"in g&&p(g)?g:null,b={screenPoint:c,results:d,ground:{mapPoint:R(e,m),distance:w(m)?m.distanceInRenderSpace:0,layer:y}};return f.SCENEVIEW_HITTEST_RETURN_INTERSECTOR&&(b.intersector=u),b}async function U(e,n,i,r){i.enableDraped=!0;const s=new h(e.state.viewingMode);s.options.selectionMode=!0,s.options.store=2,s.options.excludeLabels=r??!1,await e.sceneIntersectionHelper.intersectIntersectorScreenPolygon(n.map(e=>t(e)),s,i);const l={screenPoint:o(0,0),results:await V(e,s.polygonResults.all,i.graphics,{getDistance:e=>e.distance,getMapPoint:()=>null}),ground:{mapPoint:null,distance:0,layer:null}};return f.SCENEVIEW_HITTEST_RETURN_INTERSECTOR&&(l.intersector=s),l}function j(e){return[o(e.x,e.y),o(e.x+e.width,e.y),o(e.x+e.width,e.y+e.height),o(e.x,e.y+e.height)]}function I(e,n,i,r){const s=i?v(e,i):r,o=!(!s.graphics?.include&&!s.graphics?.exclude),l=!(!s.mediaElements?.include&&!s.mediaElements?.exclude),c=t(n);s.enableDraped=s.include&&!s.include.has(E)||s.exclude?.has(E);const a=e.sceneIntersectionHelper,u=new h(e.state.viewingMode);if(u.options.selectionMode=!0,u.options.store=o||l?2:0,u.options.excludeLabels=i?.excludeLabels??!1,a.intersectIntersectorScreen(c,u,s),o||l){for(const n of u.results.all){const t=b(n,e);if(null==t)return R(e,n);if(o&&("graphic"!==t.type||P(s.graphics,t.graphic)))return R(e,n);if(l&&("media"!==t.type||M(s.mediaElements,t.element)))return R(e,n)}return null}return R(e,u.results.min)}async function V(e,n,t,i){const r=y(e,i.stopAtSupportSurface?function*(){for(const t of n){yield t;const n=x(t,e);if(null!=n&&(n===e.map.ground||"type"in n&&p(n)))break}}():n,{getDedupeKey:e=>"graphic"===e.type?T(e.graphic):null,filterHit:e=>"graphic"!==e.type||P(t,e.graphic)}),s=new Array;for await(const{input:o,hit:l}of r){const e=i.getMapPoint(o),n=i.getDistance(o);if("media"===l.type){const t=e?l.element.toSource(e):null;s.push({...l,mapPoint:e,distance:n,sourcePoint:t})}else s.push({...l,mapPoint:e,distance:n})}return s}function R(e,n,t){return n.getIntersectionPoint(W)?(t=L(e,W,t),7===n.intersector&&e.basemapTerrain&&(t.z=m(e.basemapTerrain,t)??0),t):null}function T(e){const n=e.getObjectId()??e.attributes?.[d];return e.origin&&null!=n?`o-${e.origin.id}-${n}`:`u-${g(e)}`}function P(e,n){return M(e,T(n))}function M(e,n){return null==e||(null==e.include||e.include.has(n))&&(null==e.exclude||!e.exclude.has(n))}function L(e,n,t){let i=e.spatialReference||a.WGS84;return u(n,e.renderSpatialReference,W,i)?n=W:(i=a.WGS84,u(n,e.renderSpatialReference,W,i)&&(n=W)),t?(t.x=n[0],t.y=n[1],t.z=n[2],t.spatialReference=i):t=new c(n,i),t}function v(e,n){const t=D(e,n.include,0),i=D(e,n.exclude,1);return{include:t.layerViewUids,exclude:i.layerViewUids,graphics:{include:t.graphicUids,exclude:i.graphicUids},mediaElements:{include:t.mediaElements,exclude:i.mediaElements}}}function D(t,i,r,s=new H){if(!i)return s;if(i instanceof e)G(s,T(i)),0===r&&(null!=t.graphicsView&&i.layer===t?N(s,t.graphicsView.uid):i.layer&&C(s,t,i.layer.uid));else if("layer"in i&&"element"in i)O(s,i.element),0===r&&C(s,t,i.layer.uid);else if(n(i))for(const e of i)e===t.graphics&&null!=t.graphicsView?N(s,t.graphicsView.uid):e===t.map.ground?N(s,E):D(t,e,r,s);else"layer"in i&&_(s,t,i),"uid"in i&&C(s,t,i.uid);return s}class H{constructor(){this.layerViewUids=null,this.graphicUids=null,this.mediaElements=null}}function C(e,n,t){const i=n.allLayerViews.find(e=>e.layer.uid===t);i&&N(e,i.uid)}function N(e,n){e.layerViewUids??=new Map,e.layerViewUids.set(n,!0)}function _(e,n,t){const i=n.allLayerViews.find(e=>e.layer.uid===t.layer.uid);if(!i)return;e.layerViewUids??=new Map;const r=e.layerViewUids.get(i.uid);!0!==r&&(r?r.add(t.id):e.layerViewUids.set(i.uid,new Set([t.id])))}function G(e,n){e.graphicUids??=new Set,e.graphicUids.add(n)}function O(e,n){e.mediaElements??=new Set,e.mediaElements.add(n)}const W=l();export{L as computeMapPointFromVec3d,v as externalToInternalIntersectOptions,S as hitTest,R as intersectResultToMapPoint,P as testGraphicUidFilter,I as toMap};
2
+ import e from"../../../Graphic.js";import{isIterable as n}from"../../../core/iteratorUtils.js";import{screenPointObjectToArray as t,isScreenPolygon as i,isScreenRect as r,createScreenPointArray as s,createScreenPoint as o}from"../../../core/screenUtils.js";import{create as l}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import c from"../../../geometry/Point.js";import a from"../../../geometry/SpatialReference.js";import{projectVectorToVector as u}from"../../../geometry/projection/projectVectorToVector.js";import{fallbackObjectIDAttribute as d}from"../../../layers/LayerConstants.js";import{isIntegratedMeshLayer as p}from"../../../layers/support/layerUtils.js";import{debugFlags as f}from"./debugFlags.js";import{getElevationAtPoint as m}from"./ElevationProvider.js";import{getGraphicHitDedupeKey as g,resolveOrderedIntersectionHits as y}from"./intersectionHitUtils.js";import{Intersector as h}from"../webgl-engine/lib/Intersector.js";import{isValidIntersectorResultRay as w}from"../webgl-engine/lib/IntersectorResult.js";import{toHit as b,toOwner as x}from"../webgl-engine/lib/intersectorUtilsConversions.js";import{terrainId as E}from"../webgl-engine/lib/verticalOffsetUtils.js";async function S(e,n,t,o){const l=t?v(e,t):o;if(i(n))return U(e,n,l,t?.excludeLabels);if(r(n))return U(e,j(n),l,t?.excludeLabels);const c=n,a=s(c.x,c.y);l.requiresGroundFeedback=!0,l.enableDraped=!0;const u=new h(e.state.viewingMode);u.options.selectionMode=!0,u.options.store=2,u.options.excludeLabels=t?.excludeLabels??!1,e.sceneIntersectionHelper.intersectIntersectorScreen(a,u,l);const d=await V(e,u.results.all,l.graphics,{getDistance:e=>e.distanceInRenderSpace,getMapPoint:n=>R(e,n),stopAtSupportSurface:!0}),m=u.results.ground,g=x(m,e),y=null!=g&&"type"in g&&p(g)?g:null,b={screenPoint:c,results:d,ground:{mapPoint:R(e,m),distance:w(m)?m.distanceInRenderSpace:0,layer:y}};return f.SCENEVIEW_HITTEST_RETURN_INTERSECTOR&&(b.intersector=u),b}async function U(e,n,i,r){i.enableDraped=!0;const s=new h(e.state.viewingMode);s.options.selectionMode=!0,s.options.store=2,s.options.excludeLabels=r??!1,await e.sceneIntersectionHelper.intersectIntersectorScreenPolygon(n.map(e=>t(e)),s,i);const o={screenPoint:null,results:await V(e,s.polygonResults.all,i.graphics,{getDistance:e=>e.distance,getMapPoint:()=>null}),ground:{mapPoint:null,distance:0,layer:null}};return f.SCENEVIEW_HITTEST_RETURN_INTERSECTOR&&(o.intersector=s),o}function j(e){return[o(e.x,e.y),o(e.x+e.width,e.y),o(e.x+e.width,e.y+e.height),o(e.x,e.y+e.height)]}function I(e,n,i,r){const s=i?v(e,i):r,o=!(!s.graphics?.include&&!s.graphics?.exclude),l=!(!s.mediaElements?.include&&!s.mediaElements?.exclude),c=t(n);s.enableDraped=s.include&&!s.include.has(E)||s.exclude?.has(E);const a=e.sceneIntersectionHelper,u=new h(e.state.viewingMode);if(u.options.selectionMode=!0,u.options.store=o||l?2:0,u.options.excludeLabels=i?.excludeLabels??!1,a.intersectIntersectorScreen(c,u,s),o||l){for(const n of u.results.all){const t=b(n,e);if(null==t)return R(e,n);if(o&&("graphic"!==t.type||P(s.graphics,t.graphic)))return R(e,n);if(l&&("media"!==t.type||M(s.mediaElements,t.element)))return R(e,n)}return null}return R(e,u.results.min)}async function V(e,n,t,i){const r=y(e,i.stopAtSupportSurface?function*(){for(const t of n){yield t;const n=x(t,e);if(null!=n&&(n===e.map.ground||"type"in n&&p(n)))break}}():n,{getDedupeKey:e=>"graphic"===e.type?T(e.graphic):null,filterHit:e=>"graphic"!==e.type||P(t,e.graphic)}),s=new Array;for await(const{input:o,hit:l}of r){const e=i.getMapPoint(o),n=i.getDistance(o);if("media"===l.type){const t=e?l.element.toSource(e):null;s.push({...l,mapPoint:e,distance:n,sourcePoint:t})}else s.push({...l,mapPoint:e,distance:n})}return s}function R(e,n,t){return n.getIntersectionPoint(W)?(t=L(e,W,t),7===n.intersector&&e.basemapTerrain&&(t.z=m(e.basemapTerrain,t)??0),t):null}function T(e){const n=e.getObjectId()??e.attributes?.[d];return e.origin&&null!=n?`o-${e.origin.id}-${n}`:`u-${g(e)}`}function P(e,n){return M(e,T(n))}function M(e,n){return null==e||(null==e.include||e.include.has(n))&&(null==e.exclude||!e.exclude.has(n))}function L(e,n,t){let i=e.spatialReference||a.WGS84;return u(n,e.renderSpatialReference,W,i)?n=W:(i=a.WGS84,u(n,e.renderSpatialReference,W,i)&&(n=W)),t?(t.x=n[0],t.y=n[1],t.z=n[2],t.spatialReference=i):t=new c(n,i),t}function v(e,n){const t=D(e,n.include,0),i=D(e,n.exclude,1);return{include:t.layerViewUids,exclude:i.layerViewUids,graphics:{include:t.graphicUids,exclude:i.graphicUids},mediaElements:{include:t.mediaElements,exclude:i.mediaElements}}}function D(t,i,r,s=new H){if(!i)return s;if(i instanceof e)G(s,T(i)),0===r&&(null!=t.graphicsView&&i.layer===t?N(s,t.graphicsView.uid):i.layer&&C(s,t,i.layer.uid));else if("layer"in i&&"element"in i)O(s,i.element),0===r&&C(s,t,i.layer.uid);else if(n(i))for(const e of i)e===t.graphics&&null!=t.graphicsView?N(s,t.graphicsView.uid):e===t.map.ground?N(s,E):D(t,e,r,s);else"layer"in i&&_(s,t,i),"uid"in i&&C(s,t,i.uid);return s}class H{constructor(){this.layerViewUids=null,this.graphicUids=null,this.mediaElements=null}}function C(e,n,t){const i=n.allLayerViews.find(e=>e.layer.uid===t);i&&N(e,i.uid)}function N(e,n){e.layerViewUids??=new Map,e.layerViewUids.set(n,!0)}function _(e,n,t){const i=n.allLayerViews.find(e=>e.layer.uid===t.layer.uid);if(!i)return;e.layerViewUids??=new Map;const r=e.layerViewUids.get(i.uid);!0!==r&&(r?r.add(t.id):e.layerViewUids.set(i.uid,new Set([t.id])))}function G(e,n){e.graphicUids??=new Set,e.graphicUids.add(n)}function O(e,n){e.mediaElements??=new Set,e.mediaElements.add(n)}const W=l();export{L as computeMapPointFromVec3d,v as externalToInternalIntersectOptions,S as hitTest,R as intersectResultToMapPoint,P as testGraphicUidFilter,I as toMap};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{SizedPixelFormat as e,PixelType as n,SizedDepthStencilFormat as r,SizedDepthFormat as a}from"../../../webgl/enums.js";import{TextureDescriptor as t}from"../../../webgl/TextureDescriptor.js";import{isSizedDepthFormat as o}from"../../../webgl/textureUtils.js";function s(e){switch(e){case 0:return"R8UNORM";case 1:return"R8UINT";case 2:return"RG8UNORM";case 3:return"RG8UINT";case 4:return"RGBA4UNORM";case 5:return"RGBA8UNORM";case 6:return"RGBA8UNORM_MIPMAP";case 7:return"R16FLOAT";case 8:return"RGBA16FLOAT";case 9:return"RGBA16FLOAT_MIPMAP";case 10:return"R32FLOAT";case 11:return"RG32FLOAT";case 12:return"RGBA32UINT";case 13:return"COUNT"}}function p(e){switch(e){case 13:return"DEPTH16";case 14:return"DEPTH24_STENCIL8"}}function i(e){return T(e)?p(e):s(e)}function T(e){return e>=13}const m=new t;m.pixelFormat=6403,m.internalFormat=e.R8,m.wrapMode=33071;const F=new t;F.pixelFormat=36244,F.internalFormat=e.R8UI,F.wrapMode=33071,F.samplingMode=9728;const c=new t;c.pixelFormat=33319,c.internalFormat=e.RG8,c.wrapMode=33071;const l=new t;l.pixelFormat=33320,l.internalFormat=e.RG8UI,l.wrapMode=33071,l.samplingMode=9728;const N=new t;N.internalFormat=e.RGBA4,N.dataType=n.UNSIGNED_SHORT_4_4_4_4,N.wrapMode=33071;const M=new t;M.wrapMode=33071;const R=new t;R.wrapMode=33071,R.samplingMode=9987,R.hasMipmap=!0,R.maxAnisotropy=8;const w=new t;w.pixelFormat=6403,w.dataType=n.HALF_FLOAT,w.internalFormat=e.R16F,w.samplingMode=9728;const _=new t;_.dataType=n.HALF_FLOAT,_.internalFormat=e.RGBA16F,_.wrapMode=33071;const u=new t;u.dataType=n.HALF_FLOAT,u.internalFormat=e.RGBA16F,u.wrapMode=33071,u.samplingMode=9987,u.hasMipmap=!0,u.maxAnisotropy=8;const A=new t;A.pixelFormat=6403,A.dataType=n.FLOAT,A.internalFormat=e.R32F,A.samplingMode=9728;const d=new t;d.pixelFormat=33319,d.dataType=n.FLOAT,d.internalFormat=e.RG32F,d.samplingMode=9728;const O=new t;O.pixelFormat=36249,O.dataType=n.UNSIGNED_INT,O.internalFormat=e.RGBA32UI,O.samplingMode=9728,O.wrapMode=33071;const E={0:m,1:F,2:c,3:l,4:N,5:M,6:R,7:w,8:_,9:u,10:A,11:d,12:O,13:null},I={[a.DEPTH_COMPONENT16]:n.UNSIGNED_SHORT,[a.DEPTH_COMPONENT24]:n.UNSIGNED_INT,[a.DEPTH_COMPONENT32F]:n.FLOAT,[r.DEPTH24_STENCIL8]:n.UNSIGNED_INT_24_8,[r.DEPTH32F_STENCIL8]:n.FLOAT_32_UNSIGNED_INT_24_8_REV},G={14:L(r.DEPTH24_STENCIL8),13:L(a.DEPTH_COMPONENT16)};function L(e){const n=new t;return n.pixelFormat=o(e)?6402:34041,n.dataType=I[e],n.samplingMode=9728,n.wrapMode=33071,n.internalFormat=e,n.hasMipmap=!1,n.isImmutable=!0,n}export{E as ColorFormats,G as DepthTextureFormats,i as formatString,T as isDepthFormat};
2
+ import{SizedPixelFormat as e,PixelType as n,SizedDepthStencilFormat as r,SizedDepthFormat as a}from"../../../webgl/enums.js";import{TextureDescriptor as t}from"../../../webgl/TextureDescriptor.js";import{isSizedDepthFormat as o}from"../../../webgl/textureUtils.js";function s(e){switch(e){case 0:return"R8UNORM";case 1:return"R8UINT";case 2:return"RG8UNORM";case 3:return"RG8UINT";case 4:return"RGBA4UNORM";case 5:return"RGBA8UNORM";case 6:return"RGBA8UNORM_MIPMAP";case 7:return"R16FLOAT";case 8:return"RGBA16FLOAT";case 9:return"RGBA16FLOAT_MIPMAP";case 10:return"R32FLOAT";case 11:return"RGBA32FLOAT";case 12:return"RGBA32UINT";case 13:return"COUNT"}}function p(e){switch(e){case 13:return"DEPTH16";case 14:return"DEPTH24_STENCIL8"}}function i(e){return T(e)?p(e):s(e)}function T(e){return e>=13}const m=new t;m.pixelFormat=6403,m.internalFormat=e.R8,m.wrapMode=33071;const F=new t;F.pixelFormat=36244,F.internalFormat=e.R8UI,F.wrapMode=33071,F.samplingMode=9728;const c=new t;c.pixelFormat=33319,c.internalFormat=e.RG8,c.wrapMode=33071;const l=new t;l.pixelFormat=33320,l.internalFormat=e.RG8UI,l.wrapMode=33071,l.samplingMode=9728;const N=new t;N.internalFormat=e.RGBA4,N.dataType=n.UNSIGNED_SHORT_4_4_4_4,N.wrapMode=33071;const M=new t;M.wrapMode=33071;const R=new t;R.wrapMode=33071,R.samplingMode=9987,R.hasMipmap=!0,R.maxAnisotropy=8;const A=new t;A.pixelFormat=6403,A.dataType=n.HALF_FLOAT,A.internalFormat=e.R16F,A.samplingMode=9728;const w=new t;w.dataType=n.HALF_FLOAT,w.internalFormat=e.RGBA16F,w.wrapMode=33071;const _=new t;_.dataType=n.HALF_FLOAT,_.internalFormat=e.RGBA16F,_.wrapMode=33071,_.samplingMode=9987,_.hasMipmap=!0,_.maxAnisotropy=8;const u=new t;u.pixelFormat=6403,u.dataType=n.FLOAT,u.internalFormat=e.R32F,u.samplingMode=9728;const d=new t;d.pixelFormat=6408,d.dataType=n.FLOAT,d.internalFormat=e.RGBA32F,d.samplingMode=9728;const O=new t;O.pixelFormat=36249,O.dataType=n.UNSIGNED_INT,O.internalFormat=e.RGBA32UI,O.samplingMode=9728,O.wrapMode=33071;const E={0:m,1:F,2:c,3:l,4:N,5:M,6:R,7:A,8:w,9:_,10:u,11:d,12:O,13:null},I={[a.DEPTH_COMPONENT16]:n.UNSIGNED_SHORT,[a.DEPTH_COMPONENT24]:n.UNSIGNED_INT,[a.DEPTH_COMPONENT32F]:n.FLOAT,[r.DEPTH24_STENCIL8]:n.UNSIGNED_INT_24_8,[r.DEPTH32F_STENCIL8]:n.FLOAT_32_UNSIGNED_INT_24_8_REV},G={14:L(r.DEPTH24_STENCIL8),13:L(a.DEPTH_COMPONENT16)};function L(e){const n=new t;return n.pixelFormat=o(e)?6402:34041,n.dataType=I[e],n.samplingMode=9728,n.wrapMode=33071,n.internalFormat=e,n.hasMipmap=!1,n.isImmutable=!0,n}export{E as ColorFormats,G as DepthTextureFormats,i as formatString,T as isDepthFormat};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{releaseMaybe as t}from"../../../../../core/maybe.js";import{watch as r,syncAndInitial as s}from"../../../../../core/reactiveUtils.js";import{property as a,subclass as i}from"../../../../../core/accessorSupport/decorators.js";import{set as l}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{InternalRenderCategory as o}from"../../../webgl.js";import u from"../../../webgl/RenderNode.js";import{G as n}from"../../../../../chunks/GlobalIllumination.glsl.js";import{G as m}from"../../../../../chunks/GlobalIlluminationBlur.glsl.js";import{GlobalIlluminationBlurTechnique as h}from"./GlobalIlluminationBlurTechnique.js";import{GlobalIlluminationTechnique as c}from"./GlobalIlluminationTechnique.js";import{GlobalIlluminationTechniqueConfiguration as p}from"./GlobalIlluminationTechniqueConfiguration.js";import{G as _}from"../../../../../chunks/GlobalIlluminationUpscale.glsl.js";import{GlobalIlluminationUpscaleTechnique as d}from"./GlobalIlluminationUpscaleTechnique.js";import{DepthStencilAttachment as f,ColorAttachment1 as b}from"../../../../webgl/enums.js";const g=1;let w=class extends u{constructor(e){super(e),this.consumes={required:["normals"]},this.produces=o.AMBIENT_ILLUMINATION,this._passParameters=new n,this._drawParameters=new m,this._drawParametersUpscale=new _,this._maxFrames=256,this._lowQualityResolutionScale=.25,this._configuration=new p,this._lastOutput=null,this._isGlobalIlluminationUpdate=!1,this._resetBuffer=!1}initialize(){this.addHandles(r(()=>this.view.stage.renderer.hasGlobalIllumination,()=>{this._reset(),this._requestRender()},s))}destroy(){this._lastOutput=t(this._lastOutput)}resetAccumulatedFrames(){this._isGlobalIlluminationUpdate||this._reset()}render(e){if(this._passParameters.accumulatedFrames>=this._maxFrames)return this._lastOutput?.retain(),this._lastOutput;const t=e.find(({name:e})=>"normals"===e),r=t?.getTexture(),s=t?.getTexture(f),a=this._mode;if(!r||!s)return this._emptyOutput;if(0===a)return this._resetBuffer=!1,this._emptyOutput;if(!this._canRender)return this._resetBuffer=!1,this._requestRender(),this._emptyOutput;const i=this.bindParameters;this._configuration.hasEmission=!!i.reprojection.lastFrameEmission;const u=this.techniques.getCompiled(c,this._configuration),n=this.techniques.getCompiled(h),m=1===a,p=m?this._lowQualityResolutionScale:1,_=m?this.techniques.getCompiled(d):null;if(!u||!n||m&&!_)return this._requestRender(),this._emptyOutput;const w=this.renderingContext,{camera:P}=i;this._passParameters.normalTexture=r,this._passParameters.depthTexture=s,this._passParameters.projScale=1/P.computeScreenPixelSizeAtDist(1),this._passParameters.scaleGlobalIllumination=p;const{fullWidth:I,fullHeight:x}=P,T=Math.max(1,Math.floor(I*p)),q=Math.max(1,Math.floor(x*p)),F=this.fboCache.acquire(T,q,"global illumination input").acquireColor(b,0);w.bindFramebuffer(F.fbo),w.setViewport(0,0,T,q),w.bindTechnique(u,i,this._passParameters,this._drawParameters),w.screen.draw();const O=F.obtainAttachment(b),C=Math.max(1,Math.round(T/g)),G=Math.max(1,Math.round(q/g)),j=this.fboCache.acquire(C,G,"global illumination blur horizontal");w.bindFramebuffer(j.fbo),this._drawParameters.texture=F.getTexture(),this._drawParameters.weightTexture=O.attachment,l(this._drawParameters.blurSize,0,g/q),w.bindTechnique(n,i,this._passParameters,this._drawParameters),w.setViewport(0,0,C,G),w.screen.draw(),F.release();const y=m?"global illumination blur vertical":o.AMBIENT_ILLUMINATION,M=this.fboCache.acquire(C,G,y);w.bindFramebuffer(M.fbo),w.setViewport(0,0,C,G),w.setClearColor(1,1,1,0),w.clear(16384),this._drawParameters.texture=j.getTexture(),this._drawParameters.weightTexture=O.attachment,l(this._drawParameters.blurSize,g/C,0),w.bindTechnique(n,i,this._passParameters,this._drawParameters),w.setViewport(0,0,C,G),w.screen.draw(),j.release(),M.attachColor(O,b),O.release();let R=M;return _&&(R=this.fboCache.acquire(I,x,o.AMBIENT_ILLUMINATION).acquireColor(b,0),w.bindFramebuffer(R.fbo),w.setViewport(0,0,I,x),w.setClearColor(1,1,1,0),w.clear(16384),this._drawParametersUpscale.colorTexture=M.getTexture(),this._drawParametersUpscale.weightTexture=M.getTexture(b),w.bindTechnique(_,i,this._passParameters,this._drawParametersUpscale),w.screen.draw(),M.release()),w.setViewport4fv(P.fullViewport),this._passParameters.temporalSampleFrame=(this._passParameters.temporalSampleFrame+1)%64,++this._passParameters.accumulatedFrames,this._storeOutput(R),this._passParameters.accumulatedFrames<this._maxFrames&&this._requestRender(),R}_requestRender(){this._isGlobalIlluminationUpdate=!0,this.requestRender(1),this._isGlobalIlluminationUpdate=!1}_storeOutput(e){this._lastOutput!==e&&(this._lastOutput=t(this._lastOutput),this._lastOutput=e,this._lastOutput.retain())}get _emptyOutput(){const e=this.renderingContext,{fullWidth:t,fullHeight:r}=this.bindParameters.camera,s=this.fboCache.acquire(t,r,o.AMBIENT_ILLUMINATION).acquireColor(b,0);return e.bindFramebuffer(s.fbo),e.setViewport(0,0,t,r),e.clearBuffer(0,[0,0,0,1]),e.clearBuffer(1,[0,0,0,0]),s}get _canRender(){const{reprojection:e,hasEmission:t,globalIllumination:r}=this.bindParameters;return!(!e.lastFrameColor||t&&!e.lastFrameEmission||!e.lastFrameDepth||!r||this._resetBuffer)}get _mode(){const{hasGlobalIlluminationHighQuality:e,hasGlobalIllumination:t}=this.view.stage.renderer;return e?2:t?1:0}_reset(){this._passParameters.accumulatedFrames=0,this._lastOutput=t(this._lastOutput)}get test(){const e=this;return{passParameters:this._passParameters,configuration:this._configuration,get maxFrames(){return e._maxFrames},set maxFrames(t){e._maxFrames=t},get lowQualityResolutionScale(){return e._lowQualityResolutionScale},set lowQualityResolutionScale(t){e._lowQualityResolutionScale=t},get mode(){return e._mode},restartAccumulation:()=>{this._reset(),this._passParameters.temporalSampleFrame=0,this._resetBuffer=!0,this._requestRender()}}}};e([a()],w.prototype,"consumes",void 0),e([a()],w.prototype,"produces",void 0),w=e([i("esri.views.3d.webgl-engine.effects.globalIllumination.GlobalIllumination")],w);export{w as GlobalIllumination,g as blurSizePixels};
2
+ import{__decorate as e}from"tslib";import{releaseMaybe as t}from"../../../../../core/maybe.js";import{watch as s,syncAndInitial as r}from"../../../../../core/reactiveUtils.js";import{property as a,subclass as i}from"../../../../../core/accessorSupport/decorators.js";import{set as l}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{InternalRenderCategory as o}from"../../../webgl.js";import u from"../../../webgl/RenderNode.js";import{G as n}from"../../../../../chunks/GlobalIllumination.glsl.js";import{G as m}from"../../../../../chunks/GlobalIlluminationBlur.glsl.js";import{GlobalIlluminationBlurTechnique as h}from"./GlobalIlluminationBlurTechnique.js";import{GlobalIlluminationTechnique as c}from"./GlobalIlluminationTechnique.js";import{GlobalIlluminationTechniqueConfiguration as p}from"./GlobalIlluminationTechniqueConfiguration.js";import{G as _}from"../../../../../chunks/GlobalIlluminationUpscale.glsl.js";import{GlobalIlluminationUpscaleTechnique as d}from"./GlobalIlluminationUpscaleTechnique.js";import{DepthStencilAttachment as f,ColorAttachment1 as b}from"../../../../webgl/enums.js";const g=1,w=100;let P=class extends u{constructor(e){super(e),this.consumes={required:["normals"]},this.produces=o.AMBIENT_ILLUMINATION,this._passParameters=new n,this._drawParameters=new m,this._drawParametersUpscale=new _,this._maxFrames=256,this._lowQualityResolutionScale=.25,this._configuration=new p,this._lastOutput=null,this._isGlobalIlluminationUpdate=!1,this._resetBuffer=!1}initialize(){this.addHandles(s(()=>this.view.stage.renderer.hasGlobalIllumination,()=>{this._reset(),this._requestRender()},r))}destroy(){this._lastOutput=t(this._lastOutput)}resetAccumulatedFrames(){this._isGlobalIlluminationUpdate||!(this._passParameters.accumulatedFrames>w)&&this._configuration.hasEmission||this._reset()}render(e){if(this._passParameters.accumulatedFrames>=this._maxFrames)return this._lastOutput?.retain(),this._lastOutput;const t=e.find(({name:e})=>"normals"===e),s=t?.getTexture(),r=t?.getTexture(f),a=this._mode;if(!s||!r)return this._emptyOutput;if(0===a)return this._resetBuffer=!1,this._emptyOutput;if(!this._canRender)return this._resetBuffer=!1,this._requestRender(),this._emptyOutput;const i=this.bindParameters;this._configuration.hasEmission=!!i.reprojection.lastFrameEmission;const u=this.techniques.getCompiled(c,this._configuration),n=this.techniques.getCompiled(h),m=1===a,p=m?this._lowQualityResolutionScale:1,_=m?this.techniques.getCompiled(d):null;if(!u||!n||m&&!_)return this._requestRender(),this._emptyOutput;const w=this.renderingContext,{camera:P}=i;this._passParameters.normalTexture=s,this._passParameters.depthTexture=r,this._passParameters.projScale=1/P.computeScreenPixelSizeAtDist(1),this._passParameters.scaleGlobalIllumination=p;const{fullWidth:I,fullHeight:x}=P,T=Math.max(1,Math.floor(I*p)),q=Math.max(1,Math.floor(x*p)),F=this.fboCache.acquire(T,q,"global illumination input").acquireColor(b,2);w.bindFramebuffer(F.fbo),w.setViewport(0,0,T,q),w.bindTechnique(u,i,this._passParameters,this._drawParameters),w.screen.draw();const O=F.obtainAttachment(b),C=Math.max(1,Math.round(T/g)),G=Math.max(1,Math.round(q/g)),j=this.fboCache.acquire(C,G,"global illumination blur horizontal");w.bindFramebuffer(j.fbo),this._drawParameters.texture=F.getTexture(),this._drawParameters.weightTexture=O.attachment,l(this._drawParameters.blurSize,0,g/q),w.bindTechnique(n,i,this._passParameters,this._drawParameters),w.setViewport(0,0,C,G),w.screen.draw(),F.release();const y=m?"global illumination blur vertical":o.AMBIENT_ILLUMINATION,M=this.fboCache.acquire(C,G,y);w.bindFramebuffer(M.fbo),w.setViewport(0,0,C,G),w.setClearColor(1,1,1,0),w.clear(16384),this._drawParameters.texture=j.getTexture(),this._drawParameters.weightTexture=O.attachment,l(this._drawParameters.blurSize,g/C,0),w.bindTechnique(n,i,this._passParameters,this._drawParameters),w.setViewport(0,0,C,G),w.screen.draw(),j.release(),M.attachColor(O,b),O.release();let R=M;return _&&(R=this.fboCache.acquire(I,x,o.AMBIENT_ILLUMINATION).acquireColor(b,2),w.bindFramebuffer(R.fbo),w.setViewport(0,0,I,x),w.setClearColor(1,1,1,0),w.clear(16384),this._drawParametersUpscale.colorTexture=M.getTexture(),this._drawParametersUpscale.weightTexture=M.getTexture(b),w.bindTechnique(_,i,this._passParameters,this._drawParametersUpscale),w.screen.draw(),M.release()),w.setViewport4fv(P.fullViewport),this._passParameters.temporalSampleFrame=(this._passParameters.temporalSampleFrame+1)%64,++this._passParameters.accumulatedFrames,this._storeOutput(R),this._passParameters.accumulatedFrames<this._maxFrames&&this._requestRender(),R}_requestRender(){this._isGlobalIlluminationUpdate=!0,this.requestRender(1),this._isGlobalIlluminationUpdate=!1}_storeOutput(e){this._lastOutput!==e&&(this._lastOutput=t(this._lastOutput),this._lastOutput=e,this._lastOutput.retain())}get _emptyOutput(){const e=this.renderingContext,{fullWidth:t,fullHeight:s}=this.bindParameters.camera,r=this.fboCache.acquire(t,s,o.AMBIENT_ILLUMINATION).acquireColor(b,2);return e.bindFramebuffer(r.fbo),e.setViewport(0,0,t,s),e.clearBuffer(0,[0,0,0,1]),e.clearBuffer(1,[0,0,0,0]),r}get _canRender(){const{reprojection:e,hasEmission:t,globalIllumination:s}=this.bindParameters;return!(!e.lastFrameColor||t&&!e.lastFrameEmission||!e.lastFrameDepth||!s||this._resetBuffer)}get _mode(){const{hasGlobalIlluminationHighQuality:e,hasGlobalIllumination:t}=this.view.stage.renderer;return e?2:t?1:0}_reset(){this._passParameters.accumulatedFrames=0,this._lastOutput=t(this._lastOutput)}get test(){const e=this;return{passParameters:this._passParameters,configuration:this._configuration,get maxFrames(){return e._maxFrames},set maxFrames(t){e._maxFrames=t},get lowQualityResolutionScale(){return e._lowQualityResolutionScale},set lowQualityResolutionScale(t){e._lowQualityResolutionScale=t},get mode(){return e._mode},restartAccumulation:()=>{this._reset(),this._passParameters.temporalSampleFrame=0,this._resetBuffer=!0,this._requestRender()}}}};e([a()],P.prototype,"consumes",void 0),e([a()],P.prototype,"produces",void 0),P=e([i("esri.views.3d.webgl-engine.effects.globalIllumination.GlobalIllumination")],P);export{P as GlobalIllumination,g as blurSizePixels};