@arcgis/core 4.33.0-next.20250311 → 4.33.0-next.20250313

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 (162) hide show
  1. package/Basemap.js +1 -1
  2. package/assets/esri/core/workers/RemoteClient.js +1 -1
  3. package/assets/esri/core/workers/chunks/025f8b72d7d8b5cccb0f.js +1 -0
  4. package/assets/esri/core/workers/chunks/{5b1b93665c93955491c4.js → 08bfceab05b5ea02bb4e.js} +106 -107
  5. package/assets/esri/core/workers/chunks/{bc988b9d3990380be907.js → 0a98dc3ea67ce97a6e7b.js} +1 -1
  6. package/assets/esri/core/workers/chunks/0e5c77d043ed4641556f.js +1 -0
  7. package/assets/esri/core/workers/chunks/10fc47b441ae49ef4db8.js +1 -0
  8. package/assets/esri/core/workers/chunks/{eacab4bd6eb58e545f73.js → 11f9d7cd95891596b716.js} +1 -1
  9. package/assets/esri/core/workers/chunks/{4263eee3247aaf4e64bf.js → 147e412de9972da16a1d.js} +1 -1
  10. package/assets/esri/core/workers/chunks/4908b36ef448bfe1f448.js +1 -0
  11. package/assets/esri/core/workers/chunks/4d95cc85f4b73e857b1f.js +1 -0
  12. package/assets/esri/core/workers/chunks/54ace3e4802934f3f9f2.js +1 -0
  13. package/assets/esri/core/workers/chunks/5820808c7659460969d4.js +1 -0
  14. package/assets/esri/core/workers/chunks/6388fdacb434a266b039.js +314 -0
  15. package/assets/esri/core/workers/chunks/add0770399a63b7635b5.js +1 -0
  16. package/assets/esri/core/workers/chunks/b2f8702a9f54fff23ad9.js +1 -0
  17. package/assets/esri/core/workers/chunks/b8b8425e8b1246cdc86d.js +1 -0
  18. package/assets/esri/core/workers/chunks/d0fbd4c6bffe0cb98d14.js +1 -0
  19. package/assets/esri/core/workers/chunks/{2c227d97d00b3849f441.js → d459c790a3b89ac53d2d.js} +1 -1
  20. package/assets/esri/core/workers/chunks/dd6f18bbab50be139d20.js +1 -0
  21. package/assets/esri/core/workers/chunks/de6864e120243cf0bee8.js +1 -0
  22. package/assets/esri/core/workers/chunks/fc7ce48c7b31a4665a9b.js +1 -0
  23. package/assets/esri/core/workers/chunks/fe6e7ac83cd2293d576e.js +1 -0
  24. package/chunks/ComponentShader.glsl.js +7 -8
  25. package/chunks/DefaultMaterial.glsl.js +21 -21
  26. package/chunks/HighlightApply.glsl.js +27 -132
  27. package/chunks/{SingleHighlightBlur.glsl.js → HighlightBlur.glsl.js} +4 -4
  28. package/chunks/HighlightDownsample.glsl.js +8 -8
  29. package/chunks/HighlightToSingle.glsl.js +2 -2
  30. package/chunks/Pattern.glsl.js +23 -25
  31. package/chunks/RealisticTree.glsl.js +12 -12
  32. package/chunks/ShadowHighlight.glsl.js +5 -6
  33. package/chunks/Terrain.glsl.js +30 -31
  34. package/core/LRUCache.js +1 -1
  35. package/core/MemCache.js +1 -1
  36. package/core/has.js +1 -1
  37. package/geometry/support/ShortArray.js +5 -0
  38. package/interfaces.d.ts +18 -4
  39. package/layers/support/layerUtils.js +1 -1
  40. package/layers/video/VideoController.js +1 -1
  41. package/package.json +1 -1
  42. package/support/revision.js +1 -1
  43. package/views/2d/engine/vectorTiles/VectorTileContainer.js +1 -1
  44. package/views/2d/engine/webgl/Painter.js +1 -1
  45. package/views/2d/engine/webgl/WorldExtentClipRenderer.js +1 -1
  46. package/views/2d/engine/webgl/effects/FeatureEffect.js +1 -1
  47. package/views/2d/engine/webgl/effects/HighlightEffect.js +1 -1
  48. package/views/2d/engine/webgl/effects/HittestEffect.js +1 -1
  49. package/views/2d/layers/imagery/BaseImageryTileSubView2D.js +1 -1
  50. package/views/2d/layers/imagery/ImageryTileView2D.js +1 -1
  51. package/views/2d/layers/imagery/VectorFieldTileView2D.js +1 -1
  52. package/views/3d/analysis/Viewshed/ViewshedComputedData.js +1 -1
  53. package/views/3d/analysis/ViewshedAnalysisView3D.js +1 -1
  54. package/views/3d/environment/ChapmanAtmosphere.js +1 -1
  55. package/views/3d/environment/CloudsRenderer.js +1 -1
  56. package/views/3d/environment/EnvironmentManager.js +1 -1
  57. package/views/3d/environment/Fog.js +1 -1
  58. package/views/3d/environment/Precipitation.js +1 -1
  59. package/views/3d/layers/graphics/Graphics3DDrapedGraphicLayer.js +1 -1
  60. package/views/3d/layers/graphics/Graphics3DGraphic.js +1 -1
  61. package/views/3d/layers/graphics/Graphics3DLodInstanceGraphicLayer.js +1 -1
  62. package/views/3d/layers/graphics/Graphics3DObject3DGraphicLayer.js +1 -1
  63. package/views/3d/layers/graphics/Graphics3DPathSymbolLayer.js +1 -1
  64. package/views/3d/layers/graphics/LabelInfo.js +1 -1
  65. package/views/3d/layers/graphics/pipeline/Feature3DPipeline.js +1 -1
  66. package/views/3d/layers/graphics/pipeline/Feature3DPipelineWorker.js +1 -1
  67. package/views/3d/layers/graphics/pipeline/Feature3DPipelineWorkerHandle.js +1 -1
  68. package/views/3d/layers/graphics/pipeline/featureData/processingUtils.js +1 -1
  69. package/views/3d/layers/graphics/pipeline/rendering/DirectRenderer.js +1 -1
  70. package/views/3d/layers/graphics/pipeline/rendering/FeaturePipelineRenderManager.js +1 -1
  71. package/views/3d/layers/graphics/pipeline/rendering/LodRenderer.js +1 -1
  72. package/views/3d/layers/graphics/pipeline/rendering/RenderCommandContext.js +1 -1
  73. package/views/3d/layers/graphics/pipeline/symbolization/TestObjectSymbol.js +1 -1
  74. package/views/3d/layers/graphics/pipeline/symbolization/TestSymbol.js +1 -1
  75. package/views/3d/layers/graphics/pipeline/utils.js +1 -1
  76. package/views/3d/layers/support/FeatureTileFetcher3D.js +1 -1
  77. package/views/3d/support/flowUtils.js +5 -0
  78. package/views/3d/terrain/OverlayRenderTargets.js +1 -1
  79. package/views/3d/terrain/OverlayRenderer.js +1 -1
  80. package/views/3d/terrain/TileRenderer.js +1 -1
  81. package/views/3d/webgl/ManagedFBO.js +1 -1
  82. package/views/3d/webgl/formats.js +1 -1
  83. package/views/3d/webgl-engine/core/FBOCache.js +1 -1
  84. package/views/3d/webgl-engine/core/shaderLibrary/HighlightCellGridScreenSpacePass.glsl.js +2 -2
  85. package/views/3d/webgl-engine/core/shaderLibrary/HighlightReadBitmap.glsl.js +3 -3
  86. package/views/3d/webgl-engine/core/shaderLibrary/attributes/PathVertexPosition.glsl.js +63 -77
  87. package/views/3d/webgl-engine/core/shaderLibrary/attributes/VertexPosition.glsl.js +6 -6
  88. package/views/3d/webgl-engine/core/shaderLibrary/output/OutputHighlight.glsl.js +7 -8
  89. package/views/3d/webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js +18 -18
  90. package/views/3d/webgl-engine/core/shaderModules/UintTexture2DBindUniform.js +5 -0
  91. package/views/3d/webgl-engine/core/shaderModules/UintTexture2DDrawUniform.js +5 -0
  92. package/views/3d/webgl-engine/core/shaderModules/UintTexture2DPassUniform.js +5 -0
  93. package/views/3d/webgl-engine/effects/bloom/BloomRenderNode.js +1 -1
  94. package/views/3d/webgl-engine/effects/debug/RenderNodeVisualizerNode.js +1 -1
  95. package/views/3d/webgl-engine/effects/focusArea/FocusAreaColorNode.js +1 -1
  96. package/views/3d/webgl-engine/effects/focusArea/FocusAreaMaskNode.js +1 -1
  97. package/views/3d/webgl-engine/effects/haze/Haze.js +1 -1
  98. package/views/3d/webgl-engine/effects/highlight/Highlight.js +1 -1
  99. package/views/3d/webgl-engine/effects/highlight/HighlightBlurTechnique.js +5 -0
  100. package/views/3d/webgl-engine/effects/highlight/ShadowHighlight.js +1 -1
  101. package/views/3d/webgl-engine/effects/transparency/OITBlend.js +1 -1
  102. package/views/3d/webgl-engine/effects/transparency/OITBlendTechnique.js +1 -1
  103. package/views/3d/webgl-engine/lib/MainFramebuffer.js +1 -1
  104. package/views/3d/webgl-engine/lib/Normals.js +1 -1
  105. package/views/3d/webgl-engine/lib/Object3D.js +1 -1
  106. package/views/3d/webgl-engine/lib/OrderIndependentTransparency.js +1 -1
  107. package/views/3d/webgl-engine/lib/PathBuilder.js +1 -1
  108. package/views/3d/webgl-engine/lib/PathGeometryData.js +1 -1
  109. package/views/3d/webgl-engine/lib/Program.js +1 -1
  110. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  111. package/views/3d/webgl-engine/lib/VertexAttribute.js +1 -1
  112. package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
  113. package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
  114. package/views/3d/webgl-engine/materials/PathTechnique.js +1 -1
  115. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  116. package/views/3d/webgl-engine/materials/internal/bufferWriterUtils.js +1 -1
  117. package/views/3d/webgl-engine/parts/Model.js +1 -1
  118. package/views/3d/webgl-engine/shaders/DefaultMaterial.glsl.js +1 -1
  119. package/views/3d/webgl-engine/shaders/HighlightApply.glsl.js +1 -1
  120. package/views/3d/webgl-engine/shaders/{SingleHighlightBlur.glsl.js → HighlightBlur.glsl.js} +1 -1
  121. package/views/3d/webgl-engine/shaders/HighlightDownsample.glsl.js +1 -1
  122. package/views/3d/webgl-engine/shaders/HighlightToSingle.glsl.js +1 -1
  123. package/views/3d/webgl-engine/shaders/RealisticTree.glsl.js +1 -1
  124. package/views/3d/webgl-engine/shaders/ShadowHighlight.glsl.js +1 -1
  125. package/views/3d/webgl-engine/shaders/Terrain.glsl.js +1 -1
  126. package/views/FocusAreas.js +1 -1
  127. package/views/animation/easing.js +1 -1
  128. package/views/support/imageReprojection.js +1 -1
  129. package/views/support/projectionUtils.js +1 -1
  130. package/views/webgl/FramebufferObject.js +1 -1
  131. package/views/webgl/RenderingContext.js +1 -1
  132. package/views/webgl/ShaderBuilder.js +1 -1
  133. package/views/webgl/ShaderTranspiler.js +1 -1
  134. package/views/webgl/ValidatedTextureDescriptor.js +1 -1
  135. package/views/webgl/enums.js +1 -1
  136. package/widgets/Editor/EditorViewModel.js +1 -1
  137. package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
  138. package/widgets/FloorFilter/FloorFilterViewModel.js +1 -1
  139. package/widgets/OrientedImageryViewer.js +1 -1
  140. package/widgets/support/GoTo.js +1 -1
  141. package/widgets/support/goToUtils.js +1 -1
  142. package/assets/esri/core/workers/chunks/0137c17f15d79134b4ca.js +0 -314
  143. package/assets/esri/core/workers/chunks/15fe629cd4da1bb2169f.js +0 -1
  144. package/assets/esri/core/workers/chunks/3bbf7f89bc37c01b453b.js +0 -1
  145. package/assets/esri/core/workers/chunks/40f2c8022fd583c43f42.js +0 -1
  146. package/assets/esri/core/workers/chunks/4f2bb248dd258b493663.js +0 -1
  147. package/assets/esri/core/workers/chunks/5295e685ae839087c568.js +0 -1
  148. package/assets/esri/core/workers/chunks/54b115ecf446b4095d3e.js +0 -1
  149. package/assets/esri/core/workers/chunks/5a536de1ecae424bad05.js +0 -1
  150. package/assets/esri/core/workers/chunks/7ca9230681d05ef89059.js +0 -1
  151. package/assets/esri/core/workers/chunks/8196ff250c0de00104f7.js +0 -1
  152. package/assets/esri/core/workers/chunks/840c02610d845114ace7.js +0 -1
  153. package/assets/esri/core/workers/chunks/a4228101f709f0bb9a3d.js +0 -1
  154. package/assets/esri/core/workers/chunks/be883ebdbaf11647b718.js +0 -1
  155. package/assets/esri/core/workers/chunks/d374d2a1487faee3672d.js +0 -1
  156. package/assets/esri/core/workers/chunks/dbdca19978fbee8dc106.js +0 -1
  157. package/assets/esri/core/workers/chunks/ffd28a9b1d8db3a731f4.js +0 -1
  158. package/chunks/SingleHighlightApply.glsl.js +0 -32
  159. package/views/3d/webgl-engine/core/shaderLibrary/attributes/PositionAttribute.glsl.js +0 -5
  160. package/views/3d/webgl-engine/effects/highlight/SingleHighlightApplyTechnique.js +0 -5
  161. package/views/3d/webgl-engine/effects/highlight/SingleHighlightBlurTechnique.js +0 -5
  162. package/views/3d/webgl-engine/shaders/SingleHighlightApply.glsl.js +0 -5
@@ -2,8 +2,8 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{create as r}from"../../../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as o}from"../../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{create as e}from"../../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{PositionAttribute as t}from"./PositionAttribute.glsl.js";import{DoublePrecision as i}from"../util/DoublePrecision.glsl.js";import{Float3DrawUniform as a}from"../../shaderModules/Float3DrawUniform.js";import{Float3PassUniform as m}from"../../shaderModules/Float3PassUniform.js";import{glsl as s}from"../../shaderModules/glsl.js";import{Matrix3DrawUniform as l}from"../../shaderModules/Matrix3DrawUniform.js";import{Matrix3PassUniform as d}from"../../shaderModules/Matrix3PassUniform.js";import{Matrix4PassUniform as n}from"../../shaderModules/Matrix4PassUniform.js";import{NoParameters as f}from"../../../../../webgl/NoParameters.js";function v(r,o){r.include(t);const{vertex:e,varyings:f,fragment:v}=r;e.include(i,o),f.add("vPositionWorldCameraRelative","vec3"),f.add("vPosition_view","vec3",{invariant:!0}),e.uniforms.add(new m("transformWorldFromViewTH",(r=>r.transformWorldFromViewTH)),new m("transformWorldFromViewTL",(r=>r.transformWorldFromViewTL)),new d("transformViewFromCameraRelativeRS",(r=>r.transformViewFromCameraRelativeRS)),new n("transformProjFromView",(r=>r.transformProjFromView)),new l("transformWorldFromModelRS",(r=>r.transformWorldFromModelRS)),new a("transformWorldFromModelTH",(r=>r.transformWorldFromModelTH)),new a("transformWorldFromModelTL",(r=>r.transformWorldFromModelTL))),e.code.add(s`vec3 positionWorldCameraRelative() {
6
- vec3 rotatedModelPosition = transformWorldFromModelRS * positionModel();
5
+ import{create as r}from"../../../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as o}from"../../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{create as e}from"../../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{DoublePrecision as t}from"../util/DoublePrecision.glsl.js";import{Float3DrawUniform as a}from"../../shaderModules/Float3DrawUniform.js";import{Float3PassUniform as i}from"../../shaderModules/Float3PassUniform.js";import{glsl as m}from"../../shaderModules/glsl.js";import{Matrix3DrawUniform as s}from"../../shaderModules/Matrix3DrawUniform.js";import{Matrix3PassUniform as d}from"../../shaderModules/Matrix3PassUniform.js";import{Matrix4PassUniform as l}from"../../shaderModules/Matrix4PassUniform.js";import{VertexAttribute as n}from"../../../lib/VertexAttribute.js";import{NoParameters as f}from"../../../../../webgl/NoParameters.js";function v(r,o){const{attributes:e,vertex:f,varyings:v,fragment:F}=r;f.include(t,o),e.add(n.POSITION,"vec3"),v.add("vPositionWorldCameraRelative","vec3"),v.add("vPosition_view","vec3",{invariant:!0}),f.uniforms.add(new i("transformWorldFromViewTH",(r=>r.transformWorldFromViewTH)),new i("transformWorldFromViewTL",(r=>r.transformWorldFromViewTL)),new d("transformViewFromCameraRelativeRS",(r=>r.transformViewFromCameraRelativeRS)),new l("transformProjFromView",(r=>r.transformProjFromView)),new s("transformWorldFromModelRS",(r=>r.transformWorldFromModelRS)),new a("transformWorldFromModelTH",(r=>r.transformWorldFromModelTH)),new a("transformWorldFromModelTL",(r=>r.transformWorldFromModelTL))),f.code.add(m`vec3 positionWorldCameraRelative() {
6
+ vec3 rotatedModelPosition = transformWorldFromModelRS * position;
7
7
  vec3 transform_CameraRelativeFromModel = dpAdd(
8
8
  transformWorldFromModelTL,
9
9
  transformWorldFromModelTH,
@@ -11,18 +11,18 @@ transformWorldFromModelTH,
11
11
  -transformWorldFromViewTH
12
12
  );
13
13
  return transform_CameraRelativeFromModel + rotatedModelPosition;
14
- }`),e.code.add(s`
14
+ }`),f.code.add(m`
15
15
  void forwardPosition(float fOffset) {
16
16
  vPositionWorldCameraRelative = positionWorldCameraRelative();
17
17
  if (fOffset != 0.0) {
18
- vPositionWorldCameraRelative += fOffset * ${o.spherical?s`normalize(transformWorldFromViewTL + vPositionWorldCameraRelative)`:s`vec3(0.0, 0.0, 1.0)`};
18
+ vPositionWorldCameraRelative += fOffset * ${o.spherical?m`normalize(transformWorldFromViewTL + vPositionWorldCameraRelative)`:m`vec3(0.0, 0.0, 1.0)`};
19
19
  }
20
20
 
21
21
  vPosition_view = transformViewFromCameraRelativeRS * vPositionWorldCameraRelative;
22
22
  gl_Position = transformProjFromView * vec4(vPosition_view, 1.0);
23
23
  }
24
- `),v.uniforms.add(new m("transformWorldFromViewTL",(r=>r.transformWorldFromViewTL))),e.code.add(s`vec3 positionWorld() {
24
+ `),F.uniforms.add(new i("transformWorldFromViewTL",(r=>r.transformWorldFromViewTL))),f.code.add(m`vec3 positionWorld() {
25
25
  return transformWorldFromViewTL + vPositionWorldCameraRelative;
26
- }`),v.code.add(s`vec3 positionWorld() {
26
+ }`),F.code.add(m`vec3 positionWorld() {
27
27
  return transformWorldFromViewTL + vPositionWorldCameraRelative;
28
28
  }`)}class F extends f{constructor(){super(...arguments),this.transformWorldFromViewTH=e(),this.transformWorldFromViewTL=e(),this.transformViewFromCameraRelativeRS=r(),this.transformProjFromView=o()}}class w extends f{constructor(){super(...arguments),this.transformWorldFromModelRS=r(),this.transformWorldFromModelTH=e(),this.transformWorldFromModelTL=e()}}export{v as VertexPosition,w as VertexPositionDrawParameters,F as VertexPositionPassParameters};
@@ -2,13 +2,13 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{HighlightReadBitmap as i}from"../HighlightReadBitmap.glsl.js";import{ShaderOutput as t}from"../ShaderOutput.js";import{glsl as e}from"../../shaderModules/glsl.js";import{Integer2BindUniform as l}from"../../shaderModules/Integer2BindUniform.js";import{IntegerBindUniform as h}from"../../shaderModules/IntegerBindUniform.js";import{Texture2DBindUniform as g}from"../../shaderModules/Texture2DBindUniform.js";function d(d,u){const{fragment:o}=d;u.output===t.Highlight?(o.uniforms.add(new g("depthTexture",(i=>i.mainDepth)),new g("highlightTexture",(i=>i.highlightMixTexture)),new h("highlightLevel",(i=>i.highlightLevel??0)),new l("highlightMixOrigin",(i=>i.highlightMixOrigin))),d.outputs.add("fragHighlight","vec2",0),d.include(i),o.code.add(e`vec2 getAccumulatedHighlight() {
6
- return texelFetch(highlightTexture, ivec2(gl_FragCoord.xy) - highlightMixOrigin, 0).rg;
5
+ import{HighlightReadBitmap as i}from"../HighlightReadBitmap.glsl.js";import{ShaderOutput as e}from"../ShaderOutput.js";import{glsl as t}from"../../shaderModules/glsl.js";import{Integer2BindUniform as h}from"../../shaderModules/Integer2BindUniform.js";import{IntegerBindUniform as l}from"../../shaderModules/IntegerBindUniform.js";import{Texture2DBindUniform as g}from"../../shaderModules/Texture2DBindUniform.js";import{UintTexture2DPassUniform as d}from"../../shaderModules/UintTexture2DPassUniform.js";function u(u,o){const{fragment:r}=u;o.output===e.Highlight?(r.uniforms.add(new g("depthTexture",(i=>i.mainDepth)),new d("highlightMixTexture",((i,e)=>e.highlightMixTexture)),new l("highlightLevel",(i=>i.highlightLevel??0)),new h("highlightMixOrigin",(i=>i.highlightMixOrigin))),u.outputs.add("fragHighlight","uvec2",0),u.include(i),r.code.add(t`uvec2 getAccumulatedHighlight() {
6
+ return texelFetch(highlightMixTexture, ivec2(gl_FragCoord.xy) - highlightMixOrigin, 0).rg;
7
7
  }
8
8
  void outputHighlight(bool occluded) {
9
9
  if (highlightLevel == 0) {
10
10
  uint bits = occluded ? 3u : 1u;
11
- fragHighlight = vec2(float(bits) / 255.0, 0.0);
11
+ fragHighlight = uvec2(bits, 0);
12
12
  } else {
13
13
  int ll = (highlightLevel & 3) << 1;
14
14
  int li = (highlightLevel >> 2) & 3;
@@ -18,9 +18,8 @@ bits = 3u << ll;
18
18
  } else {
19
19
  bits = 1u << ll;
20
20
  }
21
- vec2 combinedHighlight = getAccumulatedHighlight();
22
- uint accumulatedI = uint(combinedHighlight[li] * 255.0);
23
- combinedHighlight[li] = float(bits | accumulatedI) / 255.0;
21
+ uvec2 combinedHighlight = getAccumulatedHighlight();
22
+ combinedHighlight[li] |= bits;
24
23
  fragHighlight = combinedHighlight;
25
24
  }
26
25
  }
@@ -30,8 +29,8 @@ return gl_FragCoord.z > sceneDepth + 5e-7;
30
29
  }
31
30
  void calculateOcclusionAndOutputHighlight() {
32
31
  outputHighlight(isHighlightOccluded());
33
- }`),u.canHaveOverlay&&o.code.add(e`void calculateOcclusionAndOutputHighlightOverlay(vec2 highlightToAdd) {
32
+ }`),o.canHaveOverlay&&r.code.add(t`void calculateOcclusionAndOutputHighlightOverlay(uvec2 highlightToAdd) {
34
33
  uint levelBits = readLevelBits(highlightToAdd, highlightLevel);
35
34
  if ((levelBits & 1u) == 0u) { discard; }
36
35
  outputHighlight(isHighlightOccluded());
37
- }`)):o.code.add(e`void calculateOcclusionAndOutputHighlight() {}`)}export{d as OutputHighlight};
36
+ }`)):r.code.add(t`void calculateOcclusionAndOutputHighlight() {}`)}export{u as OutputHighlight};
@@ -2,7 +2,7 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{create as e}from"../../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{hasArea as o,width as r,height as t}from"../../../../../../geometry/support/aaBoundingRect.js";import{OverlayIndex as a}from"../../../../terrain/interfaces.js";import{OverlayContent as l}from"../../../../terrain/OverlayContent.js";import{RenderPassIdentifier as i}from"../../renderPasses/RenderPassIdentifier.js";import{isColorOrColorEmission as n,ShaderOutput as v}from"../ShaderOutput.js";import{addMainLightDirection as d,addMainLightIntensity as s}from"../shading/MainLighting.glsl.js";import{PBRMode as c}from"../shading/PhysicallyBasedRenderingParameters.glsl.js";import{Water as x}from"../shading/Water.glsl.js";import{Float4DrawUniform as u}from"../../shaderModules/Float4DrawUniform.js";import{FloatPassUniform as y}from"../../shaderModules/FloatPassUniform.js";import{glsl as m}from"../../shaderModules/glsl.js";import{Texture2DPassUniform as p}from"../../shaderModules/Texture2DPassUniform.js";import{Uniform as f}from"../../../../../webgl/Uniform.js";var C;function g(e,o){const{vertex:r,fragment:t}=e;r.uniforms.add(new u("overlayTexOffset",((e,o)=>b(e,o))),new u("overlayTexScale",((e,o)=>V(e,o)))),t.constants.add("overlayOpacity","float",1),t.uniforms.add(new p("ovColorTex",((e,o)=>T(e,o)))),h(e,o)}function O(e,o){const{vertex:r,fragment:t}=e;r.uniforms.add(new w("overlayTexOffset"),new w("overlayTexScale")),t.uniforms.add(new y("overlayOpacity",(e=>e.overlayOpacity)),new p("ovColorTex",((e,o)=>o.overlay?.getTexture(e.overlayContent)))),h(e,o)}function h(e,o){const r=o.pbrMode===c.Water||o.pbrMode===c.WaterOnIntegratedMesh||o.pbrMode===c.TerrainWithWater;r&&e.include(x,o);const{vertex:t,fragment:a}=e;e.varyings.add("vtcOverlay","vec4"),t.code.add(m`void setOverlayVTC(in vec2 uv) {
5
+ import{create as e}from"../../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{hasArea as o,width as r,height as t}from"../../../../../../geometry/support/aaBoundingRect.js";import{OverlayIndex as a}from"../../../../terrain/interfaces.js";import{OverlayContent as l}from"../../../../terrain/OverlayContent.js";import{RenderPassIdentifier as i}from"../../renderPasses/RenderPassIdentifier.js";import{ShaderOutput as n,isColorOrColorEmission as s}from"../ShaderOutput.js";import{addMainLightDirection as d,addMainLightIntensity as v}from"../shading/MainLighting.glsl.js";import{PBRMode as c}from"../shading/PhysicallyBasedRenderingParameters.glsl.js";import{Water as u}from"../shading/Water.glsl.js";import{Float4DrawUniform as x}from"../../shaderModules/Float4DrawUniform.js";import{FloatPassUniform as y}from"../../shaderModules/FloatPassUniform.js";import{glsl as m}from"../../shaderModules/glsl.js";import{Texture2DPassUniform as p}from"../../shaderModules/Texture2DPassUniform.js";import{UintTexture2DPassUniform as f}from"../../shaderModules/UintTexture2DPassUniform.js";import{Uniform as g}from"../../../../../webgl/Uniform.js";var h;function C(e,o){const{vertex:r,fragment:t}=e;r.uniforms.add(new x("overlayTexOffset",((e,o)=>V(e,o))),new x("overlayTexScale",((e,o)=>I(e,o)))),t.constants.add("overlayOpacity","float",1),t.uniforms.add(new p("ovColorTex",((e,o)=>b(e,o)))),T(e,o)}function O(e,o){const{vertex:r,fragment:t}=e,{output:a}=o;r.uniforms.add(new M("overlayTexOffset"),new M("overlayTexScale")),t.uniforms.add(new y("overlayOpacity",(e=>e.overlayOpacity))),a!==n.Highlight&&t.uniforms.add(new p("ovColorTex",((e,o)=>o.overlay?.getTexture(e.overlayContent)))),T(e,o)}function T(e,o){const r=o.pbrMode===c.Water||o.pbrMode===c.WaterOnIntegratedMesh||o.pbrMode===c.TerrainWithWater;r&&e.include(u,o);const{vertex:t,fragment:a,varyings:i}=e;i.add("vtcOverlay","vec4");const{output:s}=o,x=s===n.Highlight;t.code.add(m`void setOverlayVTC(in vec2 uv) {
6
6
  vtcOverlay = vec4(uv, uv) * overlayTexScale + overlayTexOffset;
7
7
  }`),a.code.add(m`bool isValid(vec2 uv, vec2 dxdy) {
8
8
  return (uv.x >= 0.0 + dxdy.x) && (uv.x <= 1.0 - dxdy.x) && (uv.y >= 0.0 + dxdy.y) && (uv.y <= 1.0 - dxdy.y);
@@ -13,17 +13,7 @@ vec4 color1 = texture(ov0Tex, vec2(texCoords.z * 0.5 + 0.5, texCoords.w));
13
13
  bool isValid0 = isValid(texCoords.xy, fwidth(texCoords.xy));
14
14
  bool isValid1 = isValid(texCoords.zw, vec2(0.0, 0.0));
15
15
  return mix(color1 * float(isValid1), color0, float(isValid0));
16
- }`),a.code.add(m`vec4 getCombinedOverlayColor() {
17
- return overlayOpacity * getOverlayColor(ovColorTex, vtcOverlay);
18
- }`),a.code.add(m`vec4 getOverlayColorTexel() {
19
- vec4 texCoords = vtcOverlay;
20
- vec2 texDim = vec2(textureSize(ovColorTex, 0));
21
- vec4 color0 = texelFetch(ovColorTex, ivec2(vec2(texCoords.x * 0.5, texCoords.y) * texDim), 0);
22
- vec4 color1 = texelFetch(ovColorTex, ivec2(vec2(texCoords.z * 0.5 + 0.5, texCoords.w) * texDim), 0);
23
- bool isValid0 = isValid(texCoords.xy, fwidth(texCoords.xy));
24
- bool isValid1 = isValid(texCoords.zw, vec2(0.0, 0.0));
25
- return mix(color1 * float(isValid1), color0, float(isValid0));
26
- }`),a.code.add(m`vec2 getAllOverlayHighlightValuesEncoded() {
16
+ }`),x?(a.uniforms.add(new f("overlayHighlightTexture",((e,o)=>o.overlay?.getTexture(l.Highlight)))),a.code.add(m`uvec2 getAllOverlayHighlightValuesEncoded() {
27
17
  vec4 texCoords = vtcOverlay;
28
18
  vec2 uvInner = texCoords.xy;
29
19
  vec2 uvOuter = texCoords.zw;
@@ -31,17 +21,27 @@ bool isValidInner = isValid(uvInner, fwidth(uvInner));
31
21
  bool isValidOuter = isValid(uvOuter, vec2(0.0, 0.0));
32
22
  vec2 texelCoordInner = uvInner * vec2(0.5, 1.0);
33
23
  vec2 texelCoordOuter = uvOuter * vec2(0.5, 1.0) + vec2(0.5,0.0);
34
- vec2 texDim = vec2(textureSize(ovColorTex, 0));
35
- vec2 texelValueInner = texelFetch(ovColorTex, ivec2(texelCoordInner * texDim), 0).rg;
36
- vec2 texelValueOuter = texelFetch(ovColorTex, ivec2(texelCoordOuter * texDim), 0).rg;
24
+ vec2 texDim = vec2(textureSize(overlayHighlightTexture, 0));
25
+ uvec2 texelValueInner = texelFetch(overlayHighlightTexture, ivec2(texelCoordInner * texDim), 0).rg;
26
+ uvec2 texelValueOuter = texelFetch(overlayHighlightTexture, ivec2(texelCoordOuter * texDim), 0).rg;
37
27
  return
38
28
  isValidInner ? texelValueInner :
39
29
  isValidOuter ? texelValueOuter :
40
- vec2(0.0);
41
- }`),r&&(d(a),s(a),a.code.add(m`vec4 getOverlayWaterColor(vec4 maskInput, vec4 colorInput, vec3 vposEyeDir,
30
+ uvec2(0);
31
+ }`)):(a.code.add(m`vec4 getCombinedOverlayColor() {
32
+ return overlayOpacity * getOverlayColor(ovColorTex, vtcOverlay);
33
+ }`),a.code.add(m`vec4 getOverlayColorTexel() {
34
+ vec4 texCoords = vtcOverlay;
35
+ vec2 texDim = vec2(textureSize(ovColorTex, 0));
36
+ vec4 color0 = texelFetch(ovColorTex, ivec2(vec2(texCoords.x * 0.5, texCoords.y) * texDim), 0);
37
+ vec4 color1 = texelFetch(ovColorTex, ivec2(vec2(texCoords.z * 0.5 + 0.5, texCoords.w) * texDim), 0);
38
+ bool isValid0 = isValid(texCoords.xy, fwidth(texCoords.xy));
39
+ bool isValid1 = isValid(texCoords.zw, vec2(0.0, 0.0));
40
+ return mix(color1 * float(isValid1), color0, float(isValid0));
41
+ }`)),r&&(d(a),v(a),a.code.add(m`vec4 getOverlayWaterColor(vec4 maskInput, vec4 colorInput, vec3 vposEyeDir,
42
42
  float shadow, vec3 localUp, mat3 tbn, vec3 position, vec3 positionWorld) {
43
43
  vec3 n = normalize(tbn * (2.0 * maskInput.rgb - vec3(1.0)));
44
44
  vec3 v = vposEyeDir;
45
45
  vec3 final = getSeaColor(n, v, mainLightDirection, colorInput.rgb, mainLightIntensity, localUp, 1.0 - shadow, maskInput.w, position, positionWorld);
46
46
  return vec4(final, colorInput.w);
47
- }`))}function T(e,o){return e.identifier===i.Material&&n(e.output)?o.overlay?.getTexture(l.ColorNoRasterImage):e.identifier===i.Material&&e.output===v.ObjectAndLayerIdColor?o.overlay?.getTexture(l.ObjectAndLayerIdColor):e.identifier===i.Highlight?o.overlay?.getTexture(l.Highlight):null}function b(e,l){const i=l.overlay?.overlays[a.INNER]?.extent;o(i)&&(I[0]=e.toMapSpace[0]/r(i)-i[0]/r(i),I[1]=e.toMapSpace[1]/t(i)-i[1]/t(i));const n=l.overlay?.overlays[a.OUTER]?.extent;return o(n)&&(I[2]=e.toMapSpace[0]/r(n)-n[0]/r(n),I[3]=e.toMapSpace[1]/t(n)-n[1]/t(n)),I}function V(e,l){const i=l.overlay?.overlays[a.INNER]?.extent;o(i)&&(I[0]=e.toMapSpace[2]/r(i),I[1]=e.toMapSpace[3]/t(i));const n=l.overlay?.overlays[a.OUTER]?.extent;return o(n)&&(I[2]=e.toMapSpace[2]/r(n),I[3]=e.toMapSpace[3]/t(n)),I}!function(e){e[e.Disabled=0]="Disabled",e[e.Enabled=1]="Enabled",e[e.EnabledWithWater=2]="EnabledWithWater",e[e.COUNT=3]="COUNT"}(C||(C={}));const I=e();class w extends f{constructor(e){super(e,"vec4")}}export{g as OverlayIM,C as OverlayMode,O as OverlayTerrain,T as getIMColorTexture};
47
+ }`))}function b(e,o){return e.identifier===i.Material&&s(e.output)?o.overlay?.getTexture(l.ColorNoRasterImage):e.identifier===i.Material&&e.output===n.ObjectAndLayerIdColor?o.overlay?.getTexture(l.ObjectAndLayerIdColor):e.identifier===i.Highlight?o.overlay?.getTexture(l.Highlight):null}function V(e,l){const i=l.overlay?.overlays[a.INNER]?.extent;o(i)&&(w[0]=e.toMapSpace[0]/r(i)-i[0]/r(i),w[1]=e.toMapSpace[1]/t(i)-i[1]/t(i));const n=l.overlay?.overlays[a.OUTER]?.extent;return o(n)&&(w[2]=e.toMapSpace[0]/r(n)-n[0]/r(n),w[3]=e.toMapSpace[1]/t(n)-n[1]/t(n)),w}function I(e,l){const i=l.overlay?.overlays[a.INNER]?.extent;o(i)&&(w[0]=e.toMapSpace[2]/r(i),w[1]=e.toMapSpace[3]/t(i));const n=l.overlay?.overlays[a.OUTER]?.extent;return o(n)&&(w[2]=e.toMapSpace[2]/r(n),w[3]=e.toMapSpace[3]/t(n)),w}!function(e){e[e.Disabled=0]="Disabled",e[e.Enabled=1]="Enabled",e[e.EnabledWithWater=2]="EnabledWithWater",e[e.COUNT=3]="COUNT"}(h||(h={}));const w=e();class M extends g{constructor(e){super(e,"vec4")}}export{C as OverlayIM,h as OverlayMode,O as OverlayTerrain,b as getIMColorTexture};
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
+ */
5
+ import{BindType as r}from"../../../../webgl/BindType.js";import{Uniform as e}from"../../../../webgl/Uniform.js";class o extends e{constructor(e,o){super(e,"usampler2D",r.Bind,((r,s)=>r.bindTexture(e,o(s))))}}export{o as UintTexture2DBindUniform};
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
+ */
5
+ import{BindType as r}from"../../../../webgl/BindType.js";import{Uniform as e}from"../../../../webgl/Uniform.js";class o extends e{constructor(e,o){super(e,"usampler2D",r.Draw,((r,s,t)=>r.bindTexture(e,o(s,t))))}}export{o as UintTexture2DDrawUniform};
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
+ */
5
+ import{BindType as r}from"../../../../webgl/BindType.js";import{Uniform as e}from"../../../../webgl/Uniform.js";class s extends e{constructor(e,s){super(e,"usampler2D",r.Pass,((r,o,t)=>r.bindTexture(e,s(o,t))))}}export{s as UintTexture2DPassUniform};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../../chunks/tslib.es6.js";import{lerp as t}from"../../../../../core/mathUtils.js";import{watch as r,syncAndInitial as s}from"../../../../../core/reactiveUtils.js";import{property as o}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as i}from"../../../../../core/accessorSupport/decorators/subclass.js";import{RenderCategory as a}from"../../../webgl.js";import m from"../../../webgl/RenderNode.js";import{b as l,c as u,a as n}from"../../../../../chunks/BloomBlur.glsl.js";import{BloomBlurTechnique as h}from"./BloomBlurTechnique.js";import{BloomBlurTechniqueConfiguration as c}from"./BloomBlurTechniqueConfiguration.js";import{a as p,e as b}from"../../../../../chunks/BloomComposition.glsl.js";import{BloomCompositionTechnique as d}from"./BloomCompositionTechnique.js";import{a as _}from"../../../../../chunks/BloomDepthAdjust.glsl.js";import{BloomDepthAdjustTechnique as g}from"./BloomDepthAdjustTechnique.js";import{RenderRequestType as f}from"../../lib/basicInterfaces.js";import{ColorAttachment as P,FramebufferBit as T}from"../../../../webgl/enums.js";let C=class extends m{constructor(e){super(e),this.consumes={required:[a.COMPOSITE,"emissive"]},this.produces=a.COMPOSITE,this._blurHorizontalConfiguration=new c,this._blurVerticalConfiguration=new c,this._compositionParameters=new p,this._depthAdjustParameters=new _,this._blurParameters=new l,this._blurScale=3.06,this._bloomResults=new Array}initialize(){this.addHandles([r((()=>this._updateFogParameters()),(()=>{}),s)])}destroy(){}_updateFogParameters(){const e=this.view.environment.weather;if("sunny"===e.type||"cloudy"===e.type)this._blurParameters.blurRadius=u[e.type],this._compositionParameters.exposure=b[e.type];else{const r="foggy"===e.type?e.fogStrength:e.precipitation;this._blurParameters.blurRadius=t(u[e.type],.004,r),this._compositionParameters.exposure=t(3,b[e.type],1-r)}this.requestRender(f.UPDATE)}precompile(){this._blurHorizontalConfiguration.bloomStage=n.Horizontal,this._blurVerticalConfiguration.bloomStage=n.Vertical,this.techniques.precompile(h,this._blurHorizontalConfiguration),this.techniques.precompile(h,this._blurVerticalConfiguration),this.techniques.precompile(d),this.techniques.precompile(g)}render(e){const t=e.find((({name:e})=>e===a.COMPOSITE)),r=t.getAttachment(P.COLOR_ATTACHMENT1)?.attachment;if(!r)return t;const s=this.techniques.get(h,this._blurHorizontalConfiguration),o=this.techniques.get(h,this._blurVerticalConfiguration),i=this.techniques.get(d),m=this.techniques.get(g);if(!(s.compiled&&o.compiled&&i.compiled&&m.compiled))return this.requestRender(f.UPDATE),t;const l=t.getTexture(),u=this.fboCache,{fullWidth:n,fullHeight:c}=this.bindParameters.camera,p=this.renderingContext,b=u.acquire(n,c,"emissiveDepthAdjusted");this._depthAdjustParameters.color=r,this._prepareFBO(b,n,c),p.bindTechnique(m,this.bindParameters,this._depthAdjustParameters),p.screen.draw();let _=b.getTexture(),T=Math.round(n/2),C=Math.round(c/2);const j=5,q=this._blurParameters.blurRadius;for(let a=0;a<j;a++){const e=u.acquire(T,C,"bloomHorizontal");this._blurParameters.color=_,this._prepareFBO(e,T,C),p.bindTechnique(s,this.bindParameters,this._blurParameters),p.screen.draw(),0===a&&b.release();const t=u.acquire(T,C,"bloomVertical");this._blurParameters.color=e.getTexture(),this._prepareFBO(t,T,C),p.bindTechnique(o,this.bindParameters,this._blurParameters),p.screen.draw(),e.release(),this._bloomResults[a]=t,T=Math.ceil(T/2),C=Math.ceil(C/2),_=this._bloomResults[a].getTexture(),this._blurParameters.blurRadius*=this._blurScale}this._blurParameters.blurRadius=q,this._compositionParameters.color=l,this._compositionParameters.bloomTexture0=this._bloomResults[0].getTexture(),this._compositionParameters.bloomTexture1=this._bloomResults[1].getTexture(),this._compositionParameters.bloomTexture2=this._bloomResults[2].getTexture(),this._compositionParameters.bloomTexture3=this._bloomResults[3].getTexture(),this._compositionParameters.bloomTexture4=this._bloomResults[4].getTexture();const R=this.acquireOutputFramebuffer();return this._prepareFBO(R,n,c),p.bindTechnique(i,this.bindParameters,this._compositionParameters),p.screen.draw(),this._bloomResults.forEach((e=>e.release())),R.attachDepth(t.getAttachment(this.gl.DEPTH_STENCIL_ATTACHMENT)),R.attachColor(t.getAttachment(P.COLOR_ATTACHMENT1),P.COLOR_ATTACHMENT1),R}_prepareFBO(e,t,r){const s=this.renderingContext;s.bindFramebuffer(e.fbo),s.setViewport(0,0,t,r),s.setClearColor(0,0,0,0),s.clear(T.COLOR)}get test(){return{compositionParameters:this._compositionParameters,depthAdjustParameters:this._depthAdjustParameters,blurParameters:this._blurParameters}}};e([o()],C.prototype,"consumes",void 0),e([o()],C.prototype,"produces",void 0),C=e([i("esri.views.3d.webgl-engine.effects.bloom.BloomRenderNode")],C);export{C as BloomRenderNode};
5
+ import{_ as e}from"../../../../../chunks/tslib.es6.js";import{lerp as t}from"../../../../../core/mathUtils.js";import{watch as r,syncAndInitial as s}from"../../../../../core/reactiveUtils.js";import{property as o}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as i}from"../../../../../core/accessorSupport/decorators/subclass.js";import{RenderCategory as a}from"../../../webgl.js";import m from"../../../webgl/RenderNode.js";import{b as u,c as l,a as n}from"../../../../../chunks/BloomBlur.glsl.js";import{BloomBlurTechnique as h}from"./BloomBlurTechnique.js";import{BloomBlurTechniqueConfiguration as c}from"./BloomBlurTechniqueConfiguration.js";import{a as p,e as b}from"../../../../../chunks/BloomComposition.glsl.js";import{BloomCompositionTechnique as d}from"./BloomCompositionTechnique.js";import{a as _}from"../../../../../chunks/BloomDepthAdjust.glsl.js";import{BloomDepthAdjustTechnique as g}from"./BloomDepthAdjustTechnique.js";import{RenderRequestType as f}from"../../lib/basicInterfaces.js";import{ColorAttachment1 as P,DepthStencilAttachment as j,FramebufferBit as T}from"../../../../webgl/enums.js";let q=class extends m{constructor(e){super(e),this.consumes={required:[a.COMPOSITE,"emissive"]},this.produces=a.COMPOSITE,this._blurHorizontalConfiguration=new c,this._blurVerticalConfiguration=new c,this._compositionParameters=new p,this._depthAdjustParameters=new _,this._blurParameters=new u,this._blurScale=3.06,this._bloomResults=new Array}initialize(){this.addHandles([r((()=>this._updateFogParameters()),(()=>{}),s)])}destroy(){}_updateFogParameters(){const e=this.view.environment.weather;if("sunny"===e.type||"cloudy"===e.type)this._blurParameters.blurRadius=l[e.type],this._compositionParameters.exposure=b[e.type];else{const r="foggy"===e.type?e.fogStrength:e.precipitation;this._blurParameters.blurRadius=t(l[e.type],.004,r),this._compositionParameters.exposure=t(3,b[e.type],1-r)}this.requestRender(f.UPDATE)}precompile(){this._blurHorizontalConfiguration.bloomStage=n.Horizontal,this._blurVerticalConfiguration.bloomStage=n.Vertical,this.techniques.precompile(h,this._blurHorizontalConfiguration),this.techniques.precompile(h,this._blurVerticalConfiguration),this.techniques.precompile(d),this.techniques.precompile(g)}render(e){const t=e.find((({name:e})=>e===a.COMPOSITE)),r=t.getAttachment(P)?.attachment;if(!r)return t;const s=this.techniques.get(h,this._blurHorizontalConfiguration),o=this.techniques.get(h,this._blurVerticalConfiguration),i=this.techniques.get(d),m=this.techniques.get(g);if(!(s.compiled&&o.compiled&&i.compiled&&m.compiled))return this.requestRender(f.UPDATE),t;const u=t.getTexture(),l=this.fboCache,{fullWidth:n,fullHeight:c}=this.bindParameters.camera,p=this.renderingContext,b=l.acquire(n,c,"emissiveDepthAdjusted");this._depthAdjustParameters.color=r,this._prepareFBO(b,n,c),p.bindTechnique(m,this.bindParameters,this._depthAdjustParameters),p.screen.draw();let _=b.getTexture(),T=Math.round(n/2),q=Math.round(c/2);const C=5,x=this._blurParameters.blurRadius;for(let a=0;a<C;a++){const e=l.acquire(T,q,"bloomHorizontal");this._blurParameters.color=_,this._prepareFBO(e,T,q),p.bindTechnique(s,this.bindParameters,this._blurParameters),p.screen.draw(),0===a&&b.release();const t=l.acquire(T,q,"bloomVertical");this._blurParameters.color=e.getTexture(),this._prepareFBO(t,T,q),p.bindTechnique(o,this.bindParameters,this._blurParameters),p.screen.draw(),e.release(),this._bloomResults[a]=t,T=Math.ceil(T/2),q=Math.ceil(q/2),_=this._bloomResults[a].getTexture(),this._blurParameters.blurRadius*=this._blurScale}this._blurParameters.blurRadius=x,this._compositionParameters.color=u,this._compositionParameters.bloomTexture0=this._bloomResults[0].getTexture(),this._compositionParameters.bloomTexture1=this._bloomResults[1].getTexture(),this._compositionParameters.bloomTexture2=this._bloomResults[2].getTexture(),this._compositionParameters.bloomTexture3=this._bloomResults[3].getTexture(),this._compositionParameters.bloomTexture4=this._bloomResults[4].getTexture();const R=this.acquireOutputFramebuffer();return this._prepareFBO(R,n,c),p.bindTechnique(i,this.bindParameters,this._compositionParameters),p.screen.draw(),this._bloomResults.forEach((e=>e.release())),R.attachDepth(t.getAttachment(j)),R.attachColor(t.getAttachment(P),P),R}_prepareFBO(e,t,r){const s=this.renderingContext;s.bindFramebuffer(e.fbo),s.setViewport(0,0,t,r),s.setClearColor(0,0,0,0),s.clear(T.COLOR)}get test(){return{compositionParameters:this._compositionParameters,depthAdjustParameters:this._depthAdjustParameters,blurParameters:this._blurParameters}}};e([o()],q.prototype,"consumes",void 0),e([o()],q.prototype,"produces",void 0),q=e([i("esri.views.3d.webgl-engine.effects.bloom.BloomRenderNode")],q);export{q as BloomRenderNode};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../../chunks/tslib.es6.js";import{property as r}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as o}from"../../../../../core/accessorSupport/decorators/subclass.js";import{ZEROS as t}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{RenderCategory as n}from"../../../webgl.js";import{ColorFormat as i}from"../../../webgl/formats.js";import s from"../../../webgl/RenderNode.js";import{If as c,glsl as a}from"../../core/shaderModules/glsl.js";import{Default3D as l}from"../../lib/DefaultVertexAttributeLocations.js";import{FramebufferBit as u,ColorAttachment as h,BlendFactor as p,SizedPixelFormat as d,PixelFormat as f,DataType as m}from"../../../../webgl/enums.js";import{alphaCutoff as v}from"../../../../../webscene/support/AlphaCutoff.js";let x=class extends s{constructor(e){super(e),this.destroyedCB=null,this.produces=n.FINAL,this.consumes={required:[n.FINAL]},this.clearColor=t,this._focusedFBOType=0,this._program=new Map}destroy(){this._program.forEach((e=>e.dispose())),this._program.clear(),this.destroyedCB()}render(e){const r=e.find((({name:e})=>e===n.FINAL));if(!this._focusedFBO)return r;const o=this.renderingContext;o.bindFramebuffer(r.fbo),o.setClearColor(0,0,0,0),o.clear(u.COLOR);const t=this._ensureShader(o,!1,0);return o.useProgram(t),o.bindTexture(this._focusedFBO.getTexture(),0),t.setUniform1i("colorTex",0),t.setUniform1i("inputType",this._focusedFBOType),3===this._focusedFBOType&&t.setUniform2fv("nearFar",this.camera.nearFar),o.screen.draw(),r}getDownscaledFBO(e,r,o,t,n,s){o===g.ON&&(n=e.width,s=e.height);const c=this.renderingContext,{colorTexture:a,depthStencilTexture:l}=e,f=a?.descriptor,m=this._ensureShader(c,null!=l,r),v=this.fboCache.acquire(n,s,"fbo visualizer"),x=!f?.hasMipmap&&!f?.isImmutable;x&&a?.generateMipmap(),c.useProgram(m),c.bindFramebuffer(v.fbo);let T=0;const F=[h.COLOR_ATTACHMENT0],C=null!=l;if(c.bindTexture(a,T),m.setUniform1i("colorTex",T),l){T++,c.bindTexture(l,T),m.setUniform1i("depthTex",T);const e=h.COLOR_ATTACHMENT0+T;v.acquireColor(e,i.RGBA,"depth to color"),F.push(e)}for(let u=0;u<r;u++){T++;const r=h.COLOR_ATTACHMENT0+T,o=C?1:0;c.bindTexture(e.getColorTexture(r-o),T),m.setUniform1i("colorTex"+(T-o-1),T),v.acquireColor(r,i.RGBA),F.push(r)}c.gl.drawBuffers(F);const b=c.getViewport();c.setViewport(0,0,n,s),c.setClearColor(0,0,0,0),c.clear(u.COLOR),c.setBlendingEnabled(!0),c.setBlendFunction(p.ONE,p.ONE_MINUS_SRC_ALPHA);const O="linear-depth"===t||t.includes("shadow"),_="overlay highlight"===t||"highlights"===t||"highlight mix"===t,y="highlight coverage"===t,A=f?.internalFormat,w=O?3:_?5:y?6:A===d.R16F||A===d.R32F||A===d.R8?1:A===d.RG8?2:A===d.RGBA16F?4:0;return m.setUniform1i("inputType",w),O&&m.setUniform2fv("nearFar",this.camera.nearFar),c.screen.draw(),c.bindFramebuffer(null),c.setViewport(b.x,b.y,b.width,b.height),o===g.ON&&(this._focusedFBO=v,this._focusedFBOType=w),x&&e.colorTexture?.clearMipmap(),v}clearFocusedFBO(){this._focusedFBO=null}getPreviewContent(e,r,o,t){if(!o)return null;const n=this.renderingContext,i=this.fboCache.acquire(e,r,"fbo visualizer");n.bindFramebuffer(i?.fbo),n.setClearColor(this.clearColor[0],this.clearColor[1],this.clearColor[2],this.clearColor[3]),n.clear(u.COLOR),n.setBlendingEnabled(!0),n.setBlendFunction(p.ONE,p.ONE_MINUS_SRC_ALPHA),n.setViewport(0,0,e,r);const s=this._ensureShader(n,!1,0);n.useProgram(s),n.bindTexture(o.getColorTexture(t),0),s.setUniform1i("colorTex",0),s.setUniform1i("inputType",0),n.screen.draw();const c=new ImageData(new Uint8ClampedArray(e*r*4),e,r);return n.gl.readPixels(0,0,e,r,f.RGBA,m.UNSIGNED_BYTE,new Uint8Array(c.data.buffer)),n.bindFramebuffer(null),i?.release(),c}_ensureShader(e,r,o){const t={hasDepth:r,attachments:o},n=this._program.get(t);if(n)return n;const i="#version 300 es\n in vec2 position;\n out vec2 uv;\n\n void main() {\n gl_Position = vec4(position, 0.0, 1.0);\n uv = position * 0.5 + vec2(0.5);\n }",s=(e,r)=>{let o="";const t=e?2:1;for(let n=0;n<r;n++)o+=`layout(location = ${a.int(t+n)}) out vec4 fragColor${a.int(n)};\n uniform sampler2D colorTex${a.int(n)};`;return o},u=e=>{let r="";for(let o=0;o<e;o++)r+=`fragColor${a.int(o)} = texture(colorTex${a.int(o)}, uv);`;return r},h=`#version 300 es\n precision highp float;\n\n in vec2 uv;\n uniform sampler2D colorTex;\n layout(location = 0) out vec4 fragColor;\n ${c(r,"layout(location = 1) out vec4 fragDepth;\n uniform sampler2D depthTex;")}\n ${s(r,o)}\n uniform int inputType;\n uniform vec2 nearFar;\n\n // Factors to convert rgba back to float\n const vec4 RGBA_2_FLOAT_FACTORS = vec4(\n 255.0 / (256.0),\n 255.0 / (256.0 * 256.0),\n 255.0 / (256.0 * 256.0 * 256.0),\n 255.0 / (256.0 * 256.0 * 256.0 * 256.0)\n );\n\n\n float rgbaTofloat(vec4 rgba) {\n // Convert components from 0->1 back to 0->255 and then add the components together with their corresponding\n // fixed point factors, i.e. (256^1, 256^2, 256^3, 256^4)\n return dot(rgba, RGBA_2_FLOAT_FACTORS);\n }\n\n float linearDepthFromFloat(float depth) {\n depth = pow(depth, 0.2);\n return -(depth * (nearFar[1] - nearFar[0]) + nearFar[0]);\n }\n\n float linearDepthFromRGBA(vec4 depth) {\n return linearDepthFromFloat(rgbaTofloat(depth));\n }\n\n float linearDepthFromTexture(sampler2D depthTex, vec2 uv) {\n ivec2 iuv = ivec2(uv * vec2(textureSize(depthTex, 0)));\n return linearDepthFromRGBA(texelFetch(depthTex, iuv, 0));\n }\n\n void main() {\n vec4 color;\n if(inputType == 1) {\n color = vec4(vec3(texture(colorTex, uv).r), 1.0);\n } else if(inputType == 2) {\n color = vec4(texture(colorTex, uv).rg, 0.0, 1.0);\n } else if(inputType == 3) {\n float depth = 1.0 - ((-linearDepthFromTexture(colorTex, uv) - nearFar[0]) / (nearFar[1] - nearFar[0]));\n color = vec4(vec3(depth), depth >= 0.999 ? 0.0 : 1.0);\n } else if(inputType == 4) {\n color = texture(colorTex, uv);\n color = vec4(color.rgb / color.a, color.a);\n } else if(inputType == 5) {\n vec2 texDim = vec2(textureSize(colorTex, 0));\n ivec2 iuv = ivec2(uv*texDim);\n vec2 hh = texelFetch(colorTex,iuv,0).rg;\n uvec2 uhh = uvec2(vec2(hh) * 255.0);\n color = vec4(\n ((uhh.x & 0x3u) != 0u) ? 1.0 : 0.0,\n ((uhh.x & 0xcu) != 0u) ? 1.0 : 0.0,\n ((uhh.y & 0xfu) != 0u) ? 1.0 : 0.0,\n 1.0);\n } else if(inputType == 6) {\n vec2 texDim = vec2(textureSize(colorTex, 0));\n ivec2 iuv = ivec2(uv*texDim);\n uvec2 hh = uvec2(texelFetch(colorTex,iuv,0).rg * 255.0);\n color = vec4(\n ((hh & uvec2(0x55u)) != uvec2(0u)) ? 1.0 : 0.0,\n ((hh & uvec2(0xaau)) != uvec2(0u)) ? 1.0 : 0.0,\n 0.0,\n 1.0);\n } else {\n color = texture(colorTex, uv);\n }\n\n\n if(color.a < ${a.float(v)})\n discard;\n else {\n fragColor = color;\n ${c(r,"float depth = 1.0 - pow(texture(depthTex, uv).r, 10.0);\n fragDepth = vec4(vec3(depth), depth < 0.000001 ? 0.0 : 1.0);")}\n ${c(o>0,u(o))}\n }\n }`;return this._program.set(t,e.programCache.acquire(i,h,l)),this._program.get(t)}};var g;e([r()],x.prototype,"destroyedCB",void 0),e([r()],x.prototype,"produces",void 0),e([r()],x.prototype,"consumes",void 0),e([r()],x.prototype,"clearColor",void 0),x=e([o("esri.views.3d.webgl-engine.effects.debug.RenderNodeVisualizerNode")],x),function(e){e[e.ON=0]="ON",e[e.OFF=1]="OFF"}(g||(g={}));export{g as FocusState,x as RenderNodeVisualizerNode};
5
+ import{_ as e}from"../../../../../chunks/tslib.es6.js";import{property as r}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as t}from"../../../../../core/accessorSupport/decorators/subclass.js";import{ZEROS as o}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{RenderCategory as n}from"../../../webgl.js";import{ColorFormat as i}from"../../../webgl/formats.js";import c from"../../../webgl/RenderNode.js";import{If as s,glsl as a}from"../../core/shaderModules/glsl.js";import{Default3D as l}from"../../lib/DefaultVertexAttributeLocations.js";import{FramebufferBit as u,ColorAttachment0 as p,BlendFactor as h,SizedPixelFormat as f,PixelFormat as d,DataType as m}from"../../../../webgl/enums.js";import{alphaCutoff as v}from"../../../../../webscene/support/AlphaCutoff.js";let g=class extends c{constructor(e){super(e),this.destroyedCB=null,this.produces=n.FINAL,this.consumes={required:[n.FINAL]},this.clearColor=o,this._focusedFBOType=0,this._program=new Map}destroy(){this._program.forEach((e=>e.dispose())),this._program.clear(),this.destroyedCB()}render(e){const r=e.find((({name:e})=>e===n.FINAL));if(!this._focusedFBO)return r;const t=this.renderingContext;t.bindFramebuffer(r.fbo),t.setClearColor(0,0,0,0),t.clear(u.COLOR);const o=this._focusedFBO.getTexture(),i=[F(o)],c=this._ensureShader(t,!1,i);return t.useProgram(c),t.bindTexture(o,0),c.setUniform1i("colorTex",0),c.setUniform1i("inputType",this._focusedFBOType),3===this._focusedFBOType&&c.setUniform2fv("nearFar",this.camera.nearFar),t.screen.draw(),r}getDownscaledFBO(e,r,t,o,n,c){t===x.ON&&(n=e.width,c=e.height);const s=[];for(let i=0;i<Math.min(r+1,e.colorAttachments.length);++i){const r=e.getColorTexture(p+i);r&&s.push(F(r))}const a=this.renderingContext,{colorTexture:l,depthStencilTexture:d}=e,m=l?.descriptor,v=this._ensureShader(a,null!=d,s),g=this.fboCache.acquire(n,c,"fbo visualizer");let T=!1;l&&(T="float"===s[0]&&!l.descriptor.hasMipmap,T&&e.colorTexture?.generateMipmap()),a.useProgram(v),a.bindFramebuffer(g.fbo);let R=0;const b=[p],C=null!=d;if(a.bindTexture(l,R),v.setUniform1i("colorTex",R),d){R++,a.bindTexture(d,R),v.setUniform1i("depthTex",R);const e=p+R;g.acquireColor(e,i.RGBA,"depth to color"),b.push(e)}for(let u=0;u<r;u++){R++;const r=p+R,t=C?1:0;a.bindTexture(e.getColorTexture(r-t),R),v.setUniform1i("colorTex"+(R-t-1),R),g.acquireColor(r,i.RGBA),b.push(r)}a.gl.drawBuffers(b);const B=a.getViewport();a.setViewport(0,0,n,c),a.setClearColor(0,0,0,0),a.clear(u.COLOR),a.setBlendingEnabled(!0),a.setBlendFunction(h.ONE,h.ONE_MINUS_SRC_ALPHA);const A="linear-depth"===o||o.includes("shadow"),_="overlay highlight"===o||"highlights"===o||"highlight mix"===o,I="highlight coverage"===o,y=m?.internalFormat,G=A?3:_?5:I?6:y===f.R16F||y===f.R32F||y===f.R8?1:y===f.RG8?2:y===f.RGBA16F?4:y===f.RG8UI?7:0;return v.setUniform1i("inputType",G),A&&v.setUniform2fv("nearFar",this.camera.nearFar),a.screen.draw(),a.bindFramebuffer(null),a.setViewport(B.x,B.y,B.width,B.height),t===x.ON&&(this._focusedFBO=g,this._focusedFBOType=G),T&&e.colorTexture?.clearMipmap(),g}clearFocusedFBO(){this._focusedFBO=null}getPreviewContent(e,r,t,o){if(!t)return null;const n=this.renderingContext,i=this.fboCache.acquire(e,r,"fbo visualizer");n.bindFramebuffer(i?.fbo),n.setClearColor(this.clearColor[0],this.clearColor[1],this.clearColor[2],this.clearColor[3]),n.clear(u.COLOR),n.setBlendingEnabled(!0),n.setBlendFunction(h.ONE,h.ONE_MINUS_SRC_ALPHA);const c=t.getColorTexture(o);n.setViewport(0,0,e,r);const s=this._ensureShader(n,!1,[F(c)]);n.useProgram(s),n.bindTexture(c,0),s.setUniform1i("colorTex",0),s.setUniform1i("inputType",0),n.screen.draw();const a=new ImageData(new Uint8ClampedArray(e*r*4),e,r);return n.gl.readPixels(0,0,e,r,d.RGBA,m.UNSIGNED_BYTE,new Uint8Array(a.data.buffer)),n.bindFramebuffer(null),i?.release(),a}_ensureShader(e,r,t){const o={hasDepthAttachment:r,colorAttachmentTypes:t},n=this._program.get(o);if(n)return n;const i="#version 300 es\n in vec2 position;\n out vec2 uv;\n\n void main() {\n gl_Position = vec4(position, 0.0, 1.0);\n uv = position * 0.5 + vec2(0.5);\n }",c=(e,r)=>{let t="";const o=e?2:1;for(let n=0;n<r.length-1;n++){const e=r[n+1];t+=`layout(location = ${a.int(o+n)}) out vec4 fragColor${a.int(n)};\n uniform ${T(e)} colorTex${a.int(n)};`}return t},u=e=>{let r="";for(let t=0;t<e.length-1;t++){const o=e[t+1],n=`texture(colorTex${a.int(t)}, uv)`,i="float"===o?n:`vec4( vec2(${n}), 0.0, 1.0)`;r+=`fragColor${a.int(t)} = ${i};`}return r},p=`#version 300 es\n precision highp float;\n precision highp usampler2D;\n\n in vec2 uv;\n uniform ${T(t[0])} colorTex;\n layout(location = 0) out vec4 fragColor;\n ${s(r,"layout(location = 1) out vec4 fragDepth;\n uniform sampler2D depthTex;")}\n ${c(r,t)}\n uniform int inputType;\n uniform vec2 nearFar;\n\n // Factors to convert rgba back to float\n const vec4 RGBA_2_FLOAT_FACTORS = vec4(\n 255.0 / (256.0),\n 255.0 / (256.0 * 256.0),\n 255.0 / (256.0 * 256.0 * 256.0),\n 255.0 / (256.0 * 256.0 * 256.0 * 256.0)\n );\n\n\n float rgbaTofloat(vec4 rgba) {\n // Convert components from 0->1 back to 0->255 and then add the components together with their corresponding\n // fixed point factors, i.e. (256^1, 256^2, 256^3, 256^4)\n return dot(rgba, RGBA_2_FLOAT_FACTORS);\n }\n\n float linearDepthFromFloat(float depth) {\n depth = pow(depth, 0.2);\n return -(depth * (nearFar[1] - nearFar[0]) + nearFar[0]);\n }\n\n float linearDepthFromRGBA(vec4 depth) {\n return linearDepthFromFloat(rgbaTofloat(depth));\n }\n\n ${"float"===t[0]?"float linearDepthFromTexture(sampler2D depthTex, vec2 uv) {\n ivec2 iuv = ivec2(uv * vec2(textureSize(depthTex, 0)));\n return linearDepthFromRGBA(texelFetch(depthTex, iuv, 0));\n }":"float linearDepthFromTexture(usampler2D depthTex, vec2 uv) {\n ivec2 iuv = ivec2(uv * vec2(textureSize(depthTex, 0)));\n return linearDepthFromRGBA(vec4(texelFetch(depthTex, iuv, 0)) * 255.0);\n }"}\n\n void main() {\n vec4 color;\n if (inputType == 1) {\n color = vec4(vec3(texture(colorTex, uv).r), 1.0);\n } else if (inputType == 2) {\n color = vec4(texture(colorTex, uv).rg, 0.0, 1.0);\n } else if (inputType == 3) {\n float depth = 1.0 - ((-linearDepthFromTexture(colorTex, uv) - nearFar[0]) / (nearFar[1] - nearFar[0]));\n color = vec4(vec3(depth), depth >= 0.999 ? 0.0 : 1.0);\n } else if (inputType == 4) {\n color = vec4(texture(colorTex, uv));\n color = vec4(color.rgb / color.a, color.a);\n } else if (inputType == 5) {\n color = vec4(texture(colorTex, uv)) * 255.0;\n color = vec4(color.rgb / color.a, color.a);\n } else if(inputType == 6) {\n vec2 texDim = vec2(textureSize(colorTex, 0));\n ivec2 iuv = ivec2(uv*texDim);\n uvec2 hh = uvec2(texelFetch(colorTex,iuv,0).rg);\n color = vec4(\n ((hh & uvec2(0x55u)) != uvec2(0u)) ? 1.0 : 0.0,\n ((hh & uvec2(0xaau)) != uvec2(0u)) ? 1.0 : 0.0,\n 0.0,\n 1.0);\n } else {\n color = vec4(texture(colorTex, uv));\n }\n\n\n if(color.a < ${a.float(v)})\n discard;\n else {\n fragColor = color;\n ${s(r,"float depth = 1.0 - pow(texture(depthTex, uv).r, 10.0);\n fragDepth = vec4(vec3(depth), depth < 0.000001 ? 0.0 : 1.0);")}\n ${s(t.length>1,u(t))}\n }\n }`;return this._program.set(o,e.programCache.acquire(i,p,l)),this._program.get(o)}};var x;function T(e){switch(e){case"float":return"sampler2D";case"uint":return"usampler2D";case"int":return"isampler2D"}}function F(e){if(!e)return"float";const{internalFormat:r}=e.descriptor;switch(r){case f.R8I:case f.R16I:case f.R32I:case f.RG8I:case f.RG16I:case f.RG32I:case f.RGB8I:case f.RGB16I:case f.RGB32I:case f.RGBA8I:case f.RGBA16I:case f.RGBA32I:return"int";case f.R8UI:case f.R16UI:case f.R32UI:case f.RG8UI:case f.RG16UI:case f.RG32UI:case f.RGB8UI:case f.RGB16UI:case f.RGB32UI:case f.RGBA8UI:case f.RGBA16UI:case f.RGBA32UI:return"uint";default:return"float"}}e([r()],g.prototype,"destroyedCB",void 0),e([r()],g.prototype,"produces",void 0),e([r()],g.prototype,"consumes",void 0),e([r()],g.prototype,"clearColor",void 0),g=e([t("esri.views.3d.webgl-engine.effects.debug.RenderNodeVisualizerNode")],g),function(e){e[e.ON=0]="ON",e[e.OFF=1]="OFF"}(x||(x={}));export{x as FocusState,g as RenderNodeVisualizerNode};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../../chunks/tslib.es6.js";import{property as r}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as s}from"../../../../../core/accessorSupport/decorators/subclass.js";import{RenderCategory as o,InternalRenderCategory as t}from"../../../webgl.js";import i from"../../../webgl/RenderNode.js";import{FocusAreaColorTechnique as c}from"./FocusAreaColorTechnique.js";import{F as a}from"../../../../../chunks/FocusAreaColor.glsl.js";let n=class extends i{constructor(e){super({...e,view:e.focusAreas.view}),this.consumes={required:[o.COMPOSITE,t.FOCUSAREA]},this.produces=o.COMPOSITE,this._passParameters=new a}precompile(){this.techniques.precompile(c)}render(e){const r=this.techniques.get(c),s=e.find((({name:e})=>e===o.COMPOSITE));if(!r.compiled)return this.requestRender(),s;const i=this.bindParameters,a=i.camera,n=a.fullViewport[2],p=a.fullViewport[3],m=e.find((({name:e})=>e===t.FOCUSAREA)),h=this.fboCache.acquire(n,p,this.produces),d=this.renderingContext;return d.gl.clear(d.gl.STENCIL_BUFFER_BIT),d.bindFramebuffer(h.fbo),this._passParameters.color=s.getTexture(),this._passParameters.focusArea=m.getTexture(),this._passParameters.effect=u[this.focusAreas.style],d.bindTechnique(r,i,this._passParameters),d.screen.draw(),h.attachDepth(s.getAttachment(this.gl.DEPTH_STENCIL_ATTACHMENT)),h}};var p;e([r()],n.prototype,"consumes",void 0),e([r()],n.prototype,"produces",void 0),e([r({constructOnly:!0})],n.prototype,"focusAreas",void 0),n=e([s("esri.views.3d.webgl-engine.effects.focusArea.FocusAreaColorNode")],n),function(e){e[e.NONE=0]="NONE",e[e.BRIGHT=1]="BRIGHT",e[e.DARK=2]="DARK"}(p||(p={}));const u={none:p.NONE,bright:p.BRIGHT,dark:p.DARK};export{n as FocusAreaColorNode};
5
+ import{_ as e}from"../../../../../chunks/tslib.es6.js";import{property as r}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as s}from"../../../../../core/accessorSupport/decorators/subclass.js";import{RenderCategory as o,InternalRenderCategory as t}from"../../../webgl.js";import i from"../../../webgl/RenderNode.js";import{FocusAreaColorTechnique as c}from"./FocusAreaColorTechnique.js";import{F as a}from"../../../../../chunks/FocusAreaColor.glsl.js";import{FramebufferBit as n,DepthStencilAttachment as p}from"../../../../webgl/enums.js";let m=class extends i{constructor(e){super({...e,view:e.focusAreas.view}),this.consumes={required:[o.COMPOSITE,t.FOCUSAREA]},this.produces=o.COMPOSITE,this._passParameters=new a}precompile(){this.techniques.precompile(c)}render(e){const r=this.techniques.get(c),s=e.find((({name:e})=>e===o.COMPOSITE));if(!r.compiled)return this.requestRender(),s;const i=this.bindParameters,a=i.camera,m=a.fullViewport[2],u=a.fullViewport[3],h=e.find((({name:e})=>e===t.FOCUSAREA)),d=this.fboCache.acquire(m,u,this.produces),l=this.renderingContext;return l.clear(n.STENCIL),l.bindFramebuffer(d.fbo),this._passParameters.color=s.getTexture(),this._passParameters.focusArea=h.getTexture(),this._passParameters.effect=f[this.focusAreas.style],l.bindTechnique(r,i,this._passParameters),l.screen.draw(),d.attachDepth(s.getAttachment(p)),d}};var u;e([r()],m.prototype,"consumes",void 0),e([r()],m.prototype,"produces",void 0),e([r({constructOnly:!0})],m.prototype,"focusAreas",void 0),m=e([s("esri.views.3d.webgl-engine.effects.focusArea.FocusAreaColorNode")],m),function(e){e[e.NONE=0]="NONE",e[e.BRIGHT=1]="BRIGHT",e[e.DARK=2]="DARK"}(u||(u={}));const f={none:u.NONE,bright:u.BRIGHT,dark:u.DARK};export{m as FocusAreaColorNode};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../../chunks/tslib.es6.js";import{property as t}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as s}from"../../../../../core/accessorSupport/decorators/subclass.js";import{InternalRenderCategory as r,RenderCategory as o}from"../../../webgl.js";import{ColorFormat as i}from"../../../webgl/formats.js";import n from"../../../webgl/RenderNode.js";import{FocusAreaMaskTechnique as a}from"./FocusAreaMaskTechnique.js";import{Default3D as c}from"../../lib/DefaultVertexAttributeLocations.js";import{Pos3 as h}from"../../lib/DefaultVertexBufferLayouts.js";import{VertexArrayObject as p}from"../../lib/VertexArrayObject.js";import{F as l}from"../../../../../chunks/FocusAreaMask.glsl.js";import{BufferObject as u}from"../../../../webgl/BufferObject.js";import{FramebufferBit as m,Face as d,StencilOperation as g,CompareFunction as f,PrimitiveType as A,Usage as E}from"../../../../webgl/enums.js";import{noParameters as _}from"../../../../webgl/NoParameters.js";let b=class extends n{constructor(e){super({...e,view:e.focusAreas.view}),this.consumes={required:[r.FOCUSAREA,o.TRANSPARENT]},this.produces=r.FOCUSAREA,this._vaos=new Array,this._counts=new Array,this._origins=new Array,this._maskParameters=new l}initialize(){this.updateGeometries()}destroy(){this._vaos.forEach((e=>e.dispose())),this._vaos.length=this._counts.length=this._origins.length=0}precompile(){this.techniques.precompile(a)}render(e){const t=this.techniques.get(a),s=this.bindParameters,n=s.camera,c=n.fullViewport[2],h=n.fullViewport[3],p=this.fboCache.acquire(c,h,r.FOCUSAREA,i.RGBA);if(!t.compiled||!this._vaos)return this.requestRender(),p;const l=e.find((({name:e})=>e===o.TRANSPARENT)),u=this.renderingContext;p.attachDepth(l.getAttachment(this.gl.DEPTH_STENCIL_ATTACHMENT)),u.bindFramebuffer(p.fbo),u.clear(m.COLOR|m.STENCIL),u.setViewport(0,0,c,h),u.gl.clearStencil(0),u.gl.clear(u.gl.STENCIL_BUFFER_BIT),u.setClearStencil(0);const E=u.bindTechnique(t,s);u.setFaceCullingEnabled(!1),u.setStencilTestEnabled(!0),u.setStencilOpSeparate(d.FRONT,g.KEEP,g.INCR_WRAP,g.KEEP),u.setStencilOpSeparate(d.BACK,g.KEEP,g.DECR_WRAP,g.KEEP),u.setDepthWriteEnabled(!1);for(let r=0;r<this._vaos.length;r++){const e=this._vaos[r],t=this._counts[r];this._maskParameters.origin=this._origins[r],E.bindDraw(s,_,this._maskParameters),u.bindVAO(e),u.setStencilWriteMask(255),u.setStencilFunction(f.ALWAYS,0,255),u.setColorMask(!1,!1,!1,!1),u.drawArrays(A.TRIANGLES,0,t),u.setStencilWriteMask(0),u.setStencilFunction(f.NOTEQUAL,0,255),u.setColorMask(!0,!0,!0,!0),u.drawArrays(A.TRIANGLES,0,t)}return p}updateGeometries(){if(!this.view._stage)return;this._vaos.forEach((e=>e.dispose())),this._vaos.length=this._counts.length=this._origins.length=0;const e=this.focusAreas.geometries;for(const t of e){const e=new Array,s=t.indicesBottom;for(let n=0;n<s.length;n++)e.push(t.positions[3*(s[n]-1)]),e.push(t.positions[3*(s[n]-1)+1]),e.push(t.positions[3*(s[n]-1)+2]);const r=t.indicesExtruded;for(let n=0;n<r.length;n++)e.push(t.positions[3*r[n]]),e.push(t.positions[3*r[n]+1]),e.push(t.positions[3*r[n]+2]);const o=new Float32Array(e),i=new p(this.renderingContext,c,new Map([["geometry",h]]),new Map([["geometry",u.createVertex(this.renderingContext,E.STATIC_DRAW,o)]]));this._vaos.push(i),this._counts.push(s.length+r.length),this._origins.push(t.origin)}this.requestRender()}};e([t()],b.prototype,"consumes",void 0),e([t()],b.prototype,"produces",void 0),e([t({constructOnly:!0})],b.prototype,"focusAreas",void 0),b=e([s("esri.views.3d.webgl-engine.effects.focusArea.FocusAreaMaskNode")],b);class w{constructor(e,t,s,r,o,i){this.positions=e,this.indicesBottom=t,this.indicesExtruded=s,this.height=r,this.origin=o,this.color=i}}var R;!function(e){e[e.NONE=0]="NONE",e[e.BRIGHT=1]="BRIGHT",e[e.DARK=2]="DARK"}(R||(R={}));export{R as FocusAreaEffect,w as FocusAreaGeometry,b as FocusAreaMaskNode};
5
+ import{_ as e}from"../../../../../chunks/tslib.es6.js";import{property as t}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as s}from"../../../../../core/accessorSupport/decorators/subclass.js";import{InternalRenderCategory as r,RenderCategory as o}from"../../../webgl.js";import{ColorFormat as i}from"../../../webgl/formats.js";import n from"../../../webgl/RenderNode.js";import{FocusAreaMaskTechnique as a}from"./FocusAreaMaskTechnique.js";import{Default3D as c}from"../../lib/DefaultVertexAttributeLocations.js";import{Pos3 as h}from"../../lib/DefaultVertexBufferLayouts.js";import{VertexArrayObject as p}from"../../lib/VertexArrayObject.js";import{F as u}from"../../../../../chunks/FocusAreaMask.glsl.js";import{BufferObject as l}from"../../../../webgl/BufferObject.js";import{DepthStencilAttachment as m,FramebufferBit as d,Face as f,StencilOperation as g,CompareFunction as A,PrimitiveType as E,Usage as b}from"../../../../webgl/enums.js";import{noParameters as _}from"../../../../webgl/NoParameters.js";let w=class extends n{constructor(e){super({...e,view:e.focusAreas.view}),this.consumes={required:[r.FOCUSAREA,o.TRANSPARENT]},this.produces=r.FOCUSAREA,this._vaos=new Array,this._counts=new Array,this._origins=new Array,this._maskParameters=new u}initialize(){this.updateGeometries()}destroy(){this._vaos.forEach((e=>e.dispose())),this._vaos.length=this._counts.length=this._origins.length=0}precompile(){this.techniques.precompile(a)}render(e){const t=this.techniques.get(a),s=this.bindParameters,n=s.camera,c=n.fullViewport[2],h=n.fullViewport[3],p=this.fboCache.acquire(c,h,r.FOCUSAREA,i.RGBA);if(!t.compiled||!this._vaos)return this.requestRender(),p;const u=e.find((({name:e})=>e===o.TRANSPARENT)),l=this.renderingContext;p.attachDepth(u.getAttachment(m)),l.bindFramebuffer(p.fbo),l.clear(d.COLOR|d.STENCIL),l.setViewport(0,0,c,h),l.clear(d.STENCIL,0);const b=l.bindTechnique(t,s);l.setFaceCullingEnabled(!1),l.setStencilTestEnabled(!0),l.setStencilOpSeparate(f.FRONT,g.KEEP,g.INCR_WRAP,g.KEEP),l.setStencilOpSeparate(f.BACK,g.KEEP,g.DECR_WRAP,g.KEEP),l.setDepthWriteEnabled(!1);for(let r=0;r<this._vaos.length;r++){const e=this._vaos[r],t=this._counts[r];this._maskParameters.origin=this._origins[r],b.bindDraw(s,_,this._maskParameters),l.bindVAO(e),l.setDepthTestEnabled(!0),l.setStencilWriteMask(255),l.setStencilFunction(A.ALWAYS,0,255),l.setColorMask(!1,!1,!1,!1),l.drawArrays(E.TRIANGLES,0,t),l.setDepthTestEnabled(!1),l.setStencilWriteMask(0),l.setStencilFunction(A.NOTEQUAL,0,255),l.setColorMask(!0,!0,!0,!0),l.drawArrays(E.TRIANGLES,0,t)}return p}updateGeometries(){if(!this.view._stage)return;this._vaos.forEach((e=>e.dispose())),this._vaos.length=this._counts.length=this._origins.length=0;const e=this.focusAreas.geometries;for(const t of e){const e=new Array,s=t.indicesBottom;for(let n=0;n<s.length;n++)e.push(t.positions[3*(s[n]-1)]),e.push(t.positions[3*(s[n]-1)+1]),e.push(t.positions[3*(s[n]-1)+2]);const r=t.indicesExtruded;for(let n=0;n<r.length;n++)e.push(t.positions[3*r[n]]),e.push(t.positions[3*r[n]+1]),e.push(t.positions[3*r[n]+2]);const o=new Float32Array(e),i=new p(this.renderingContext,c,new Map([["geometry",h]]),new Map([["geometry",l.createVertex(this.renderingContext,b.STATIC_DRAW,o)]]));this._vaos.push(i),this._counts.push(s.length+r.length),this._origins.push(t.origin)}this.requestRender()}};e([t()],w.prototype,"consumes",void 0),e([t()],w.prototype,"produces",void 0),e([t({constructOnly:!0})],w.prototype,"focusAreas",void 0),w=e([s("esri.views.3d.webgl-engine.effects.focusArea.FocusAreaMaskNode")],w);class R{constructor(e,t,s,r,o,i){this.positions=e,this.indicesBottom=t,this.indicesExtruded=s,this.height=r,this.origin=o,this.color=i}}var S;!function(e){e[e.NONE=0]="NONE",e[e.BRIGHT=1]="BRIGHT",e[e.DARK=2]="DARK"}(S||(S={}));export{S as FocusAreaEffect,R as FocusAreaGeometry,w as FocusAreaMaskNode};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../../chunks/tslib.es6.js";import{lerp as t,clamp as s,smoothstep as r}from"../../../../../core/mathUtils.js";import{disposeMaybe as i}from"../../../../../core/maybe.js";import{watch as o,syncAndInitial as a}from"../../../../../core/reactiveUtils.js";import"../../../../../core/Logger.js";import"../../../../../core/has.js";import"../../../../../core/RandomLCG.js";import"../../../../../core/Error.js";import{subclass as n}from"../../../../../core/accessorSupport/decorators/subclass.js";import{set as m}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{l as h,k as c}from"../../../../../chunks/vec32.js";import{s as p}from"../../../../../chunks/vec42.js";import{earth as u}from"../../../../../geometry/support/Ellipsoid.js";import{InternalRenderCategory as d}from"../../../webgl.js";import{ColorFormat as l}from"../../../webgl/formats.js";import{TransparentEnvironment as _}from"../TransparentEnvironment.js";import{H as f}from"../../../../../chunks/HazeCompositing.glsl.js";import{HazeCompositingTechnique as g}from"./HazeCompositingTechnique.js";import{HazePassParameters as b,HazeTechnique as w}from"./HazeTechnique.js";import{HazeTechniqueConfiguration as P}from"./HazeTechniqueConfiguration.js";import{createQuadVAO as j,Layout as T}from"../../lib/glUtil3D.js";import{applyTextureResizeModulo as v}from"../../lib/textureUtils.js";import{PrimitiveType as A}from"../../../../webgl/enums.js";let C=class extends _{constructor(e){super(e),this._compositingPassParameters=new f,this._passParameters=new b,this._hazeConfiguration=new P,this._vao=null,this.requireGeometryDepth=!0,this._oldAmount=1,this._newAmount=1,this._amount=this._newAmount;const t=e.view._stage.renderView.techniques;t.precompile(w,new P);const s=new P;s.reduced=!0,t.precompile(w,s),t.precompile(g)}initialize(){this.addHandles([o((()=>this.view.environment.atmosphereEnabled),(e=>e?this._enable():this._disable()),a),o((()=>this.view._stage?.renderer.renderContext.bind.clouds.fadeFactor??1),(e=>this._fade(e)),a),o((()=>this.view.environment.weather.type),(e=>this._newAmount="rainy"===e?0:1),a),o((()=>this.view._stage.renderer?.fullResolutionAtmosphere),(e=>this._hazeConfiguration.reduced=!e),a)])}_fade(e){e>=1?(this._amount=this._newAmount,this._oldAmount=this._newAmount):this._amount=e<=0?this._oldAmount:t(this._oldAmount,this._newAmount,e)}destroy(){this._vao=i(this._vao)}render(e){const s=e.find((({name:e})=>e===d.TRANSPARENT_ENVIRONMENT));if(!this.bindParameters.mainDepth)return s;const r=this.renderingContext;this._vao??=j(r,T.Pos2Tex);const i=this.techniques.get(w,this._hazeConfiguration);if(!i.compiled)return s;const o=s.getAttachment(r.gl.DEPTH_STENCIL_ATTACHMENT);if(this._update(),!this._hazeConfiguration.reduced)return s.detachDepth(),r.bindFramebuffer(s.fbo),r.bindTechnique(i,this.bindParameters,this._passParameters),this._renderCommon(r),s.attachDepth(o),s;const a=this.techniques.get(g);if(!a.compiled)return s;const n=r.getViewport(),m=this.camera,c=h(m.eye)-u.radius;let p;const _=u.atmosphereHeight;if(c<_){const e=Math.min(1,Math.max(0,c/_));p=t(.4,.5,e)}else{const e=Math.min(1,Math.max(0,(c-_)/(15*_)));p=t(.5,1,e)}const f=this.renderingContext.parameters.maxTextureSize,b=v(Math.round(p*m.fullViewport[2]),f),P=v(Math.round(p*m.fullViewport[3]),f);r.setViewport(0,0,b,P);const A=this.fboCache.acquire(b,P,"haze",l.RGBA);return r.bindFramebuffer(A.fbo),r.clearFramebuffer([0,0,0,1],!0,!0),r.bindTechnique(i,this.bindParameters,this._passParameters),this._renderCommon(r),r.setViewport(n.x,n.y,n.width,n.height),this._compositingPassParameters.color=A.getTexture(),s.detachDepth(),r.bindFramebuffer(s.fbo),r.bindTechnique(a,this.bindParameters,this._compositingPassParameters),r.screen.draw(),s.attachDepth(o),A.release(),s}_renderCommon(e){null!=this._vao&&(e.bindVAO(this._vao),e.drawArrays(A.TRIANGLE_STRIP,0,4))}_update(){const e=this.bindParameters.camera,i=c(e.eye),o=Math.sqrt(i),a=i-this._passParameters.radii[1]*this._passParameters.radii[1],n=s((o-this._passParameters.radii[0])/u.atmosphereHeight,0,1);p(this._passParameters.heightParameters,o,i,a,n);const h=this.view.basemapTerrain?.getLowerBoundRadius()??0;m(this._passParameters.radii,h,h+u.atmosphereHeight),this._passParameters.hazeStrength=t(t(.6,1,r(9500,10500,o-u.radius)),1,this._amount)}};C=e([n("esri.views.3d.webgl-engine.effects.haze.Haze")],C);export{C as Haze};
5
+ import{_ as e}from"../../../../../chunks/tslib.es6.js";import{lerp as t,clamp as s,smoothstep as r}from"../../../../../core/mathUtils.js";import{disposeMaybe as i}from"../../../../../core/maybe.js";import{watch as o,syncAndInitial as a}from"../../../../../core/reactiveUtils.js";import"../../../../../core/Logger.js";import"../../../../../core/has.js";import"../../../../../core/RandomLCG.js";import"../../../../../core/Error.js";import{subclass as n}from"../../../../../core/accessorSupport/decorators/subclass.js";import{set as m}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{l as h,k as c}from"../../../../../chunks/vec32.js";import{s as p}from"../../../../../chunks/vec42.js";import{earth as u}from"../../../../../geometry/support/Ellipsoid.js";import{InternalRenderCategory as d}from"../../../webgl.js";import{ColorFormat as l}from"../../../webgl/formats.js";import{TransparentEnvironment as f}from"../TransparentEnvironment.js";import{H as _}from"../../../../../chunks/HazeCompositing.glsl.js";import{HazeCompositingTechnique as g}from"./HazeCompositingTechnique.js";import{HazePassParameters as b,HazeTechnique as w}from"./HazeTechnique.js";import{HazeTechniqueConfiguration as P}from"./HazeTechniqueConfiguration.js";import{createQuadVAO as j,Layout as v}from"../../lib/glUtil3D.js";import{applyTextureResizeModulo as A}from"../../lib/textureUtils.js";import{DepthStencilAttachment as T,PrimitiveType as C}from"../../../../webgl/enums.js";let x=class extends f{constructor(e){super(e),this._compositingPassParameters=new _,this._passParameters=new b,this._hazeConfiguration=new P,this._vao=null,this.requireGeometryDepth=!0,this._oldAmount=1,this._newAmount=1,this._amount=this._newAmount;const t=e.view._stage.renderView.techniques;t.precompile(w,new P);const s=new P;s.reduced=!0,t.precompile(w,s),t.precompile(g)}initialize(){this.addHandles([o((()=>this.view.environment.atmosphereEnabled),(e=>e?this._enable():this._disable()),a),o((()=>this.view._stage?.renderer.renderContext.bind.clouds.fadeFactor??1),(e=>this._fade(e)),a),o((()=>this.view.environment.weather.type),(e=>this._newAmount="rainy"===e?0:1),a),o((()=>this.view._stage.renderer?.fullResolutionAtmosphere),(e=>this._hazeConfiguration.reduced=!e),a)])}_fade(e){e>=1?(this._amount=this._newAmount,this._oldAmount=this._newAmount):this._amount=e<=0?this._oldAmount:t(this._oldAmount,this._newAmount,e)}destroy(){this._vao=i(this._vao)}render(e){const s=e.find((({name:e})=>e===d.TRANSPARENT_ENVIRONMENT));if(!this.bindParameters.mainDepth)return s;const r=this.renderingContext;this._vao??=j(r,v.Pos2Tex);const i=this.techniques.get(w,this._hazeConfiguration);if(!i.compiled)return s;const o=s.getAttachment(T);if(this._update(),!this._hazeConfiguration.reduced)return s.detachDepth(),r.bindFramebuffer(s.fbo),r.bindTechnique(i,this.bindParameters,this._passParameters),this._renderCommon(r),s.attachDepth(o),s;const a=this.techniques.get(g);if(!a.compiled)return s;const n=r.getViewport(),m=this.camera,c=h(m.eye)-u.radius;let p;const f=u.atmosphereHeight;if(c<f){const e=Math.min(1,Math.max(0,c/f));p=t(.4,.5,e)}else{const e=Math.min(1,Math.max(0,(c-f)/(15*f)));p=t(.5,1,e)}const _=this.renderingContext.parameters.maxTextureSize,b=A(Math.round(p*m.fullViewport[2]),_),P=A(Math.round(p*m.fullViewport[3]),_);r.setViewport(0,0,b,P);const C=this.fboCache.acquire(b,P,"haze",l.RGBA);return r.bindFramebuffer(C.fbo),r.clearFramebuffer([0,0,0,1],!0,!0),r.bindTechnique(i,this.bindParameters,this._passParameters),this._renderCommon(r),r.setViewport(n.x,n.y,n.width,n.height),this._compositingPassParameters.color=C.getTexture(),s.detachDepth(),r.bindFramebuffer(s.fbo),r.bindTechnique(a,this.bindParameters,this._compositingPassParameters),r.screen.draw(),s.attachDepth(o),C.release(),s}_renderCommon(e){null!=this._vao&&(e.bindVAO(this._vao),e.drawArrays(C.TRIANGLE_STRIP,0,4))}_update(){const e=this.bindParameters.camera,i=c(e.eye),o=Math.sqrt(i),a=i-this._passParameters.radii[1]*this._passParameters.radii[1],n=s((o-this._passParameters.radii[0])/u.atmosphereHeight,0,1);p(this._passParameters.heightParameters,o,i,a,n);const h=this.view.basemapTerrain?.getLowerBoundRadius()??0;m(this._passParameters.radii,h,h+u.atmosphereHeight),this._passParameters.hazeStrength=t(t(.6,1,r(9500,10500,o-u.radius)),1,this._amount)}};x=e([n("esri.views.3d.webgl-engine.effects.haze.Haze")],x);export{x as Haze};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../../chunks/tslib.es6.js";import"../../../../../core/has.js";import{releaseMaybe as t,disposeMaybe as i}from"../../../../../core/maybe.js";import{watch as r,initial as s}from"../../../../../core/reactiveUtils.js";import{property as o}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as h}from"../../../../../core/accessorSupport/decorators/subclass.js";import{set as l}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{ZEROS as n}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{InternalRenderCategory as a}from"../../../webgl.js";import{ColorFormat as g}from"../../../webgl/formats.js";import c from"../../../webgl/RenderNode.js";import{HighlightApplyTechnique as u}from"./HighlightApplyTechnique.js";import{HighlightDownsampleTechnique as m}from"./HighlightDownsampleTechnique.js";import{HighlightPassParameters as p}from"./HighlightPassParameters.js";import{HighlightToSingleTechnique as d}from"./HighlightToSingleTechnique.js";import{SingleHighlightApplyTechnique as f}from"./SingleHighlightApplyTechnique.js";import{SingleHighlightBlurTechnique as b}from"./SingleHighlightBlurTechnique.js";import{RenderRequestType as T}from"../../lib/basicInterfaces.js";import{Default3D as w}from"../../lib/DefaultVertexAttributeLocations.js";import{NoVertex as x}from"../../lib/DefaultVertexBufferLayouts.js";import{VertexArrayObject as _}from"../../lib/VertexArrayObject.js";import{H as C,g as v}from"../../../../../chunks/HighlightDownsample.glsl.js";import{S as j}from"../../../../../chunks/SingleHighlightBlur.glsl.js";import{BufferObject as H}from"../../../../webgl/BufferObject.js";import{PixelFormat as q,TextureSamplingMode as P,FramebufferBit as R,Usage as D,TextureType as O,PrimitiveType as S,DataType as A}from"../../../../webgl/enums.js";import{Texture as E}from"../../../../webgl/Texture.js";import{TextureDescriptor as y}from"../../../../webgl/TextureDescriptor.js";let I=class extends c{constructor(){super(...arguments),this.produces=a.HIGHLIGHTS,this.consumes={required:[a.HIGHLIGHTS,"highlights"]},this._useMultipleHighlights=!1,this._downsampleDrawParameters=new C,this._passParameters=new p,this._singleHighlightBlurDrawParameters=new j,this._grid=new M}initialize(){this.addHandles([r((()=>this._updateOptionsTexture()),(()=>{}),s)])}destroy(){this._grid.coverage=t(this._grid.coverage),this._grid.vao=i(this._grid.vao),this._passParameters.highlightOptionsTexture=t(this._passParameters.highlightOptionsTexture)}_updateOptionsTexture(){if(null==this._passParameters.highlightOptionsTexture){const e=new y(16,2);e.internalFormat=q.RGBA,e.samplingMode=P.NEAREST,this._passParameters.highlightOptionsTexture=new E(this.renderingContext,e,null)}this._passParameters.highlightOptionsTexture.setData(U(this.view.state.highlights)),this.requestRender(T.UPDATE)}precompile(){this.techniques.precompile(m),this._useMultipleHighlights?this.techniques.precompile(u):(this.techniques.precompile(d),this.techniques.precompile(b),this.techniques.precompile(f))}render(e){const t=e.find((({name:e})=>e===a.HIGHLIGHTS)),{techniques:i,bindParameters:r,_passParameters:s,renderingContext:o}=this;if(!r.decorations)return t;const h=i.get(m);if(!h.compiled)return this.requestRender(T.UPDATE),t;const l=e.find((({name:e})=>"highlights"===e)).getTexture(),n=()=>{this._gridUpdateResources(l);const e=this._gridComputeCoverage(h,l,r),{horizontalCellCount:t,verticalCellCount:i}=e;return s.horizontalCellCount=t,s.verticalCellCount=i,s.coverageTexture=e.coverage?.getTexture(),e},g=e=>{const t=e.verticalCellCount*e.horizontalCellCount;o.bindVAO(e.vao),o.drawElementsInstanced(S.TRIANGLES,6,A.UNSIGNED_BYTE,0,t)},{camera:c}=r,u=()=>{o.bindFramebuffer(t.fbo),o.setViewport4fv(c.fullViewport)};return this._useMultipleHighlights?this._renderMultiple(l,n,g,u):this._renderSingle(l,n,g,u),s.highlightTexture=null,s.coverageTexture=null,t}_renderMultiple(e,t,i,r){const{techniques:s,bindParameters:o,_passParameters:h,renderingContext:l}=this,n=s.get(u);if(!n.compiled)return void this.requestRender(T.UPDATE);const a=t();h.highlightTexture=e,h.pixelRatio=o.camera.pixelRatio,l.bindTechnique(n,o,h),r(),i(a)}_renderSingle(e,t,i,r){const{fboCache:s,techniques:o,bindParameters:h,_passParameters:n,renderingContext:a}=this,c=o.get(d),u=o.get(b),m=o.get(f);if(!m.compiled||!u.compiled||!c.compiled)return void this.requestRender(T.UPDATE);const p=t(),{width:w,height:x}=e.descriptor;n.highlightTexture=e;const{camera:_}=h,{fullWidth:C,fullHeight:v,pixelRatio:j}=_,H=Math.ceil(C/j),q=Math.ceil(v/j),{_singleHighlightBlurDrawParameters:P}=this,D=this.view._stage.renderView.renderer,{highlights:O}=h;for(let d=0;d<O.length;++d){const{name:e}=O[d];if(!D.hasHighlight(e))continue;n.highlightLevel=d,a.setClearColor(0,0,0,0);const t=s.acquire(w,x,"single highlight",g.RG);a.bindFramebuffer(t.fbo),a.setViewport(0,0,w,x),a.clear(R.COLOR),a.bindTechnique(c,h,n),i(p),P.blurInput=t.getTexture(),l(P.blurSize,1/H,0);const o=s.acquire(H,q,"single highlight blur h",g.RG);a.unbindTexture(o.fbo?.colorTexture),a.bindFramebuffer(o.fbo),a.setViewport(0,0,H,q),a.clear(R.COLOR),a.bindTechnique(u,h,n,P),i(p),t.release(),l(P.blurSize,0,1/q),n.singleHighlightBlurTexture=o.getTexture(),r(),a.bindTechnique(m,h,n,P),i(p),o.release()}}_gridUpdateResources(e){const t=this._grid,{width:i,height:r}=e.descriptor;if(t.horizontalCellCount=Math.ceil(i/v),t.verticalCellCount=Math.ceil(r/v),t.vao)return;const s=this.renderingContext,o=H.createIndex(s,D.STATIC_DRAW,F);t.vao=new _(s,w,new Map([["geometry",x]]),new Map([["geometry",H.createVertex(s,D.STATIC_DRAW)]]),o)}_gridComputeCoverage(e,t,i){const r=this.renderingContext,s=this._grid,o=t.descriptor,h=Math.ceil(o.width/v),l=Math.ceil(o.height/v);this._downsampleDrawParameters.input=t,s.coverage?.release();const n=this.fboCache.acquire(h,l,"highlight coverage",g.RG);return s.coverage=n,r.bindFramebuffer(n.fbo),r.bindTechnique(e,i,this._passParameters,this._downsampleDrawParameters),r.setViewport(0,0,h,l),r.screen.draw(),s}get test(){}};e([o()],I.prototype,"produces",void 0),e([o()],I.prototype,"consumes",void 0),I=e([h("esri.views.3d.webgl-engine.effects.highlight.Highlight")],I);class M{constructor(){this.coverage=null,this.vao=null,this.verticalCellCount=0,this.horizontalCellCount=0,this.viewportWidth=0,this.viewportHeight=0}}function U(e){const t=new Uint8Array(128);let i=0;for(const r of e){const e=4*i,s=4*i+64;++i;const{color:o}=r,h=r.haloColor??o;t[e+0]=o.r,t[e+1]=o.g,t[e+2]=o.b,t[e+3]=r.fillOpacity*o.a*255,t[s+0]=h.r,t[s+1]=h.g,t[s+2]=h.b,t[s+3]=r.haloOpacity*h.a*255}return t}let G=0;function L(e){let t=0;for(const r of e){const{name:e}=r;t+=e.length;const{color:i,fillOpacity:s,haloColor:o,haloOpacity:h}=r;t+=i.r+i.g+i.b+i.a+s,t+=o?o.r+o.g+o.b+o.a+h:0}const i=e.at(0);if(i){const{shadowOpacity:e,shadowDifference:r,shadowColor:s}=i;t+=e+r+s.r+s.g+s.b+s.a}return G+++(t>=0?0:1)}const F=new Uint8Array([0,1,2,2,1,3]);function V(e,t,i,r,s,o=0){const h=r.highlights,a=h.length>1?t.acquire(i.width,i.height,"highlight mix",g.RG):null;if(a){const t=e.getBoundFramebufferObject();e.bindFramebuffer(a.fbo),e.clearFramebuffer(n),e.bindFramebuffer(t)}const c=a?.getTexture();r.highlightMixTexture=c,l(r.highlightMixOrigin,o,0),h.forEach(((t,h)=>{h>0&&(e.bindTexture(c,E.TEXTURE_UNIT_FOR_UPDATES),e.gl.copyTexSubImage2D(O.TEXTURE_2D,0,0,0,o,0,i.width,i.height),e.bindTexture(null,E.TEXTURE_UNIT_FOR_UPDATES)),e.clear(R.DEPTH),r.highlightLevel=h,s()})),r.highlightLevel=null,r.highlightMixTexture=null,a?.release()}export{I as Highlight,V as renderHighlightBuffer,L as trackHighlightOptions};
5
+ import{_ as e}from"../../../../../chunks/tslib.es6.js";import"../../../../../core/has.js";import{releaseMaybe as t,disposeMaybe as r}from"../../../../../core/maybe.js";import{watch as i,initial as s}from"../../../../../core/reactiveUtils.js";import{property as o}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as h}from"../../../../../core/accessorSupport/decorators/subclass.js";import{set as n}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{InternalRenderCategory as l}from"../../../webgl.js";import{ColorFormat as a}from"../../../webgl/formats.js";import g from"../../../webgl/RenderNode.js";import{HighlightApplyTechnique as c}from"./HighlightApplyTechnique.js";import{HighlightBlurTechnique as u}from"./HighlightBlurTechnique.js";import{HighlightDownsampleTechnique as m}from"./HighlightDownsampleTechnique.js";import{HighlightPassParameters as p}from"./HighlightPassParameters.js";import{HighlightToSingleTechnique as d}from"./HighlightToSingleTechnique.js";import{RenderRequestType as f}from"../../lib/basicInterfaces.js";import{Default3D as b}from"../../lib/DefaultVertexAttributeLocations.js";import{NoVertex as T}from"../../lib/DefaultVertexBufferLayouts.js";import{VertexArrayObject as w}from"../../lib/VertexArrayObject.js";import{H as x}from"../../../../../chunks/HighlightBlur.glsl.js";import{H as C,g as v}from"../../../../../chunks/HighlightDownsample.glsl.js";import{BufferObject as _}from"../../../../webgl/BufferObject.js";import{PixelFormat as j,TextureSamplingMode as H,FramebufferBit as P,Usage as R,TextureType as O,PrimitiveType as q,DataType as D}from"../../../../webgl/enums.js";import{Texture as I}from"../../../../webgl/Texture.js";import{TextureDescriptor as y}from"../../../../webgl/TextureDescriptor.js";let A=class extends g{constructor(){super(...arguments),this.produces=l.HIGHLIGHTS,this.consumes={required:[l.HIGHLIGHTS,"highlights"]},this._downsampleDrawParameters=new C,this._passParameters=new p,this._highlightBlurDrawParameters=new x,this._grid=new U}initialize(){this.addHandles([i((()=>this._updateOptionsTexture()),(()=>{}),s)])}destroy(){this._grid.coverage=t(this._grid.coverage),this._grid.vao=r(this._grid.vao),this._passParameters.highlightOptionsTexture=t(this._passParameters.highlightOptionsTexture)}_updateOptionsTexture(){if(null==this._passParameters.highlightOptionsTexture){const e=new y(16,2);e.internalFormat=j.RGBA,e.samplingMode=H.NEAREST,this._passParameters.highlightOptionsTexture=new I(this.renderingContext,e,null)}this._passParameters.highlightOptionsTexture.setData(E(this.view.state.highlights)),this.requestRender(f.UPDATE)}precompile(){this.techniques.precompile(m),this.techniques.precompile(d),this.techniques.precompile(u),this.techniques.precompile(c)}render(e){const t=e.find((({name:e})=>e===l.HIGHLIGHTS)),{techniques:r,bindParameters:i,_passParameters:s,renderingContext:o}=this;if(!i.decorations)return t;const h=r.get(m);if(!h.compiled)return this.requestRender(f.UPDATE),t;const n=e.find((({name:e})=>"highlights"===e)).getTexture();s.highlightTexture=n;const a=()=>{this._gridUpdateResources(n);const e=this._gridComputeCoverage(h,n,i),{horizontalCellCount:t,verticalCellCount:r}=e;return s.horizontalCellCount=t,s.verticalCellCount=r,s.coverageTexture=e.coverage?.getTexture(),e},g=e=>{const t=e.verticalCellCount*e.horizontalCellCount;o.bindVAO(e.vao),o.drawElementsInstanced(q.TRIANGLES,6,D.UNSIGNED_BYTE,0,t)},{camera:c}=i,u=()=>{o.bindFramebuffer(t.fbo),o.setViewport4fv(c.fullViewport)};return this._renderHighlightPostprocess(n,a,g,u),s.highlightTexture=null,s.coverageTexture=null,t}_renderHighlightPostprocess(e,t,r,i){const{fboCache:s,techniques:o,bindParameters:h,_passParameters:l,renderingContext:g}=this,m=o.get(d),p=o.get(u),b=o.get(c);if(!b.compiled||!p.compiled||!m.compiled)return void this.requestRender(f.UPDATE);l.highlightTexture=e;const T=t(),{width:w,height:x}=e.descriptor;l.highlightTexture=e;const{camera:C}=h,{fullWidth:v,fullHeight:_,pixelRatio:j}=C,H=Math.ceil(v/j),R=Math.ceil(_/j),{_highlightBlurDrawParameters:O}=this,q=this.view._stage.renderView.renderer,{highlights:D}=h;for(let c=0;c<D.length;++c){const{name:e}=D[c];if(!q.hasHighlight(e))continue;l.highlightLevel=c,g.setClearColor(0,0,0,0);const t=s.acquire(w,x,"single highlight",a.RG);g.bindFramebuffer(t.fbo),g.setViewport(0,0,w,x),g.clear(P.COLOR),g.bindTechnique(m,h,l),r(T),O.blurInput=t.getTexture(),n(O.blurSize,1/H,0);const o=s.acquire(H,R,"single highlight blur h",a.RG);g.unbindTexture(o.fbo?.colorTexture),g.bindFramebuffer(o.fbo),g.setViewport(0,0,H,R),g.clear(P.COLOR),g.bindTechnique(p,h,l,O),r(T),t.release(),n(O.blurSize,0,1/R),l.highlightBlurTexture=o.getTexture(),i(),g.bindTechnique(b,h,l,O),r(T),o.release()}}_gridUpdateResources(e){const t=this._grid,{width:r,height:i}=e.descriptor;if(t.horizontalCellCount=Math.ceil(r/v),t.verticalCellCount=Math.ceil(i/v),t.vao)return;const s=this.renderingContext,o=_.createIndex(s,R.STATIC_DRAW,L);t.vao=new w(s,b,new Map([["geometry",T]]),new Map([["geometry",_.createVertex(s,R.STATIC_DRAW)]]),o)}_gridComputeCoverage(e,t,r){const i=this.renderingContext,s=this._grid,o=t.descriptor,h=Math.ceil(o.width/v),n=Math.ceil(o.height/v);this._downsampleDrawParameters.input=t;const{highlights:l}=r;s.coverage?.release();const g=this.fboCache.acquire(h,n,"highlight coverage",l.length>B?a.RG8UI:a.R8UI);return s.coverage=g,i.bindFramebuffer(g.fbo),i.bindTechnique(e,r,this._passParameters,this._downsampleDrawParameters),i.setViewport(0,0,h,n),i.screen.draw(),s}get test(){}};e([o()],A.prototype,"produces",void 0),e([o()],A.prototype,"consumes",void 0),A=e([h("esri.views.3d.webgl-engine.effects.highlight.Highlight")],A);class U{constructor(){this.coverage=null,this.vao=null,this.verticalCellCount=0,this.horizontalCellCount=0,this.viewportWidth=0,this.viewportHeight=0}}function E(e){const t=new Uint8Array(128);let r=0;for(const i of e){const e=4*r,s=4*r+64;++r;const{color:o}=i,h=i.haloColor??o;t[e+0]=o.r,t[e+1]=o.g,t[e+2]=o.b,t[e+3]=i.fillOpacity*o.a*255,t[s+0]=h.r,t[s+1]=h.g,t[s+2]=h.b,t[s+3]=i.haloOpacity*h.a*255}return t}let S=0;function G(e){let t=0;for(const i of e){const{name:e}=i;t+=e.length;const{color:r,fillOpacity:s,haloColor:o,haloOpacity:h}=i;t+=r.r+r.g+r.b+r.a+s,t+=o?o.r+o.g+o.b+o.a+h:0}const r=e.at(0);if(r){const{shadowOpacity:e,shadowDifference:i,shadowColor:s}=r;t+=e+i+s.r+s.g+s.b+s.a}return S+++(t>=0?0:1)}const L=new Uint8Array([0,1,2,2,1,3]);function M(e,t,r,i,s,o=0){const{highlights:h}=i,l=h.length>1?t.acquire(r.width,r.height,"highlight mix",h.length>B?a.RG8UI:a.R8UI):null,{gl:g}=e;if(l){const t=e.getBoundFramebufferObject();e.bindFramebuffer(l.fbo),g.clearBufferuiv(g.COLOR,0,[0,0,0,0]),e.bindFramebuffer(t)}const c=l?.getTexture();i.highlightMixTexture=c,n(i.highlightMixOrigin,o,0),h.forEach(((t,h)=>{if(h>0){const t=I.TEXTURE_UNIT_FOR_UPDATES;e.bindTexture(c,t),e.setActiveTexture(t),g.copyTexSubImage2D(O.TEXTURE_2D,0,0,0,o,0,r.width,r.height),e.bindTexture(null,t)}e.clear(P.DEPTH),i.highlightLevel=h,s()})),i.highlightLevel=null,i.highlightMixTexture=null,l?.release()}const B=4;export{A as Highlight,B as maxHighlightsPerChannel,M as renderHighlightBuffer,G as trackHighlightOptions};
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
+ */
5
+ import{ReloadableShaderModule as e}from"../../core/shaderTechnique/ReloadableShaderModule.js";import{ShaderTechnique as r}from"../../core/shaderTechnique/ShaderTechnique.js";import{a as i}from"../../../../../chunks/HighlightBlur.glsl.js";import{makePipelineState as o,defaultColorWrite as s}from"../../../../webgl/renderState.js";class l extends r{constructor(r,o){super(r,o,new e(i,(()=>import("../../shaders/HighlightBlur.glsl.js"))))}initializePipeline(){return o({colorWrite:s})}}export{l as HighlightBlurTechnique};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../../chunks/tslib.es6.js";import{unitRGBAFromColor as s}from"../../../../../core/colorUtils.js";import{smoothstep as t,clamp as i}from"../../../../../core/mathUtils.js";import{watch as r,syncAndInitial as a}from"../../../../../core/reactiveUtils.js";import{property as o}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as h}from"../../../../../core/accessorSupport/decorators/subclass.js";import{n as c,i as p,f as n}from"../../../../../chunks/vec32.js";import{create as m}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ViewingMode as d}from"../../../../ViewingMode.js";import{RenderCategory as l}from"../../../webgl.js";import g from"../../../webgl/RenderNode.js";import{ShadowHighlightPassParameters as u,ShadowHighlightTechnique as f}from"./ShadowHighlightTechnique.js";import{RenderRequestType as w}from"../../lib/basicInterfaces.js";import{defaultShadowOpacity as _,defaultShadowDifference as O,defaultShadowColor as y}from"../../../../support/HighlightDefaults.js";const P=1/512,b=4e4,j=5e4;let v=class extends g{constructor(e){super(e),this.produces=l.COMPOSITE,this.consumes={required:[l.COMPOSITE,"highlights"]},this._passParameters=new u,this._maxOpacity=1,this._shadowDifference=.2}initialize(){this.addHandles([r((()=>this.view.highlightOptions.shadowOpacity),(e=>{this._passParameters.shadowOpacity=e??_,this._updateOccludedShadowOpacity(),this._ensureMaxOpacity()}),a),r((()=>this.view.highlightOptions.shadowDifference),(e=>{this._shadowDifference=e??O,this._updateOccludedShadowOpacity(),this._ensureMaxOpacity()}),a),r((()=>this.view.highlightOptions.shadowColor),(e=>{this._passParameters.shadowColor=s(e??y),this._ensureMaxOpacity()}),a)])}_updateOccludedShadowOpacity(){this._passParameters.occludedShadowOpacity=this._passParameters.shadowOpacity*(1-this._shadowDifference)}_ensureMaxOpacity(){const e=Math.max(this._passParameters.shadowOpacity,this._passParameters.occludedShadowOpacity);this._maxOpacity=e*this._passParameters.shadowColor[3],this.requestRender(w.UPDATE)}precompile(){this.techniques.precompile(f)}render(e){const s=e.find((({name:e})=>e===l.COMPOSITE)),t=this.bindParameters;if(!t.shadowHighlightsVisible||!t.depth||!this._ensureIfVisible(t.camera,t.lighting.mainLight.direction))return s;const i=this.techniques.get(f);if(i.compiled){this._passParameters.highlight=e.find((({name:e})=>"highlights"===e))?.getTexture(),this._passParameters.origin=t.camera.center;const r=this.renderingContext;r.bindFramebuffer(s.fbo),r.bindTechnique(i,t,this._passParameters),r.screen.draw()}else this.requestRender(w.UPDATE);return s}_ensureIfVisible(e,s){this._passParameters.opacityElevation=1-t(b,j,e.relativeElevation);const r=this.viewingMode===d.Global?c(x,e.center):p(x,0,0,1),a=n(r,s);return this._passParameters.dayNightTerminator=t(0,1,i(30*a,0,1)),this._maxOpacity*this._passParameters.opacityElevation*this._passParameters.dayNightTerminator>=P}};e([o()],v.prototype,"produces",void 0),e([o()],v.prototype,"consumes",void 0),e([o({constructOnly:!0})],v.prototype,"viewingMode",void 0),v=e([h("esri.views.3d.webgl-engine.effects.highlight.ShadowHighlight")],v);const x=m();export{v as ShadowHighlight};
5
+ import{_ as e}from"../../../../../chunks/tslib.es6.js";import{unitRGBAFromColor as s}from"../../../../../core/colorUtils.js";import{smoothstep as t,clamp as i}from"../../../../../core/mathUtils.js";import{watch as r,syncAndInitial as a}from"../../../../../core/reactiveUtils.js";import{property as o}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as h}from"../../../../../core/accessorSupport/decorators/subclass.js";import{n as c,i as p,f as n}from"../../../../../chunks/vec32.js";import{create as m}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ViewingMode as d}from"../../../../ViewingMode.js";import{RenderCategory as l}from"../../../webgl.js";import g from"../../../webgl/RenderNode.js";import{ShadowHighlightPassParameters as u,ShadowHighlightTechnique as f}from"./ShadowHighlightTechnique.js";import{RenderRequestType as w}from"../../lib/basicInterfaces.js";import{defaultShadowOpacity as _,defaultShadowDifference as O,defaultShadowColor as y}from"../../../../support/HighlightDefaults.js";const P=1/512,b=4e4,j=5e4;let v=class extends g{constructor(e){super(e),this.produces=l.COMPOSITE,this.consumes={required:[l.COMPOSITE,"highlights"]},this._passParameters=new u,this._maxOpacity=1,this._shadowDifference=.2}initialize(){this.addHandles([r((()=>this.view.highlightOptions.shadowOpacity),(e=>{this._passParameters.shadowOpacity=e??_,this._updateOccludedShadowOpacity(),this._ensureMaxOpacity()}),a),r((()=>this.view.highlightOptions.shadowDifference),(e=>{this._shadowDifference=e??O,this._updateOccludedShadowOpacity(),this._ensureMaxOpacity()}),a),r((()=>this.view.highlightOptions.shadowColor),(e=>{this._passParameters.shadowColor=s(e??y),this._ensureMaxOpacity()}),a)])}_updateOccludedShadowOpacity(){this._passParameters.occludedShadowOpacity=this._passParameters.shadowOpacity*(1-this._shadowDifference)}_ensureMaxOpacity(){const e=Math.max(this._passParameters.shadowOpacity,this._passParameters.occludedShadowOpacity);this._maxOpacity=e*this._passParameters.shadowColor[3],this.requestRender(w.UPDATE)}precompile(){this.techniques.precompile(f)}render(e){const s=e.find((({name:e})=>e===l.COMPOSITE)),t=this.bindParameters;if(!t.shadowHighlightsVisible||!t.depth||!this._ensureIfVisible(t.camera,t.lighting.mainLight.direction))return s;const i=this.techniques.get(f);if(i.compiled){this._passParameters.highlightTexture=e.find((({name:e})=>"highlights"===e))?.getTexture(),this._passParameters.origin=t.camera.center;const r=this.renderingContext;r.bindFramebuffer(s.fbo),r.bindTechnique(i,t,this._passParameters),r.screen.draw()}else this.requestRender(w.UPDATE);return s}_ensureIfVisible(e,s){this._passParameters.opacityElevation=1-t(b,j,e.relativeElevation);const r=this.viewingMode===d.Global?c(x,e.center):p(x,0,0,1),a=n(r,s);return this._passParameters.dayNightTerminator=t(0,1,i(30*a,0,1)),this._maxOpacity*this._passParameters.opacityElevation*this._passParameters.dayNightTerminator>=P}};e([o()],v.prototype,"produces",void 0),e([o()],v.prototype,"consumes",void 0),e([o({constructOnly:!0})],v.prototype,"viewingMode",void 0),v=e([h("esri.views.3d.webgl-engine.effects.highlight.ShadowHighlight")],v);const x=m();export{v as ShadowHighlight};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{O as e}from"../../../../../chunks/OITBlend.glsl.js";import{OITBlendTechnique as t}from"./OITBlendTechnique.js";import{OITBlendTechniqueConfiguration as i}from"./OITBlendTechniqueConfiguration.js";import{ColorAttachment as r}from"../../../../webgl/enums.js";class s{constructor(r){this._techniques=r,this._parameters=new e,this._configuration=new i,r.precompile(t,this._configuration),this._configuration.hasEmission=!0,r.precompile(t,this._configuration)}blend(e,i,s,n,o){this._parameters.colorTexture=i.getTexture(),o&&(this._parameters.emissionTexture=i.getTexture(r.COLOR_ATTACHMENT1),this._parameters.emissionFrontFaceTexture=s.getTexture(r.COLOR_ATTACHMENT1)),this._parameters.alphaTexture=i.getTexture(o?r.COLOR_ATTACHMENT2:r.COLOR_ATTACHMENT1),this._parameters.frontFaceTexture=s.getTexture(),this._configuration.hasEmission=o;const a=this._techniques.get(t,this._configuration);e.bindTechnique(a,n,this._parameters),e.screen.draw()}}export{s as OITBlend};
5
+ import{O as e}from"../../../../../chunks/OITBlend.glsl.js";import{OITBlendTechnique as t}from"./OITBlendTechnique.js";import{OITBlendTechniqueConfiguration as i}from"./OITBlendTechniqueConfiguration.js";import{ColorAttachment1 as r,ColorAttachment2 as s}from"../../../../webgl/enums.js";class n{constructor(r){this._techniques=r,this._parameters=new e,this._configuration=new i,r.precompile(t,this._configuration),this._configuration.hasEmission=!0,r.precompile(t,this._configuration)}blend(e,i,n,o,a){this._parameters.colorTexture=i.getTexture(),a&&(this._parameters.emissionTexture=i.getTexture(r),this._parameters.emissionFrontFaceTexture=n.getTexture(r)),this._parameters.alphaTexture=i.getTexture(a?s:r),this._parameters.frontFaceTexture=n.getTexture(),this._configuration.hasEmission=a;const u=this._techniques.get(t,this._configuration);e.bindTechnique(u,o,this._parameters),e.screen.draw()}}export{n as OITBlend};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{ReloadableShaderModule as e}from"../../core/shaderTechnique/ReloadableShaderModule.js";import{ShaderTechnique as r}from"../../core/shaderTechnique/ShaderTechnique.js";import{a as s}from"../../../../../chunks/OITBlend.glsl.js";import{ColorAttachment as o}from"../../../../webgl/enums.js";import{makePipelineState as i,premultipliedAlphaToPremultipliedAlpha as n,defaultColorWrite as l}from"../../../../webgl/renderState.js";class t extends r{constructor(r,o){super(r,o,new e(s,(()=>import("./OITBlend.glsl.js"))))}initializePipeline(e){return i({blending:n,colorWrite:l,drawBuffers:e.hasEmission?{buffers:[o.COLOR_ATTACHMENT0,o.COLOR_ATTACHMENT1]}:{buffers:[o.COLOR_ATTACHMENT0]}})}}export{t as OITBlendTechnique};
5
+ import{ReloadableShaderModule as e}from"../../core/shaderTechnique/ReloadableShaderModule.js";import{ShaderTechnique as r}from"../../core/shaderTechnique/ShaderTechnique.js";import{a as s}from"../../../../../chunks/OITBlend.glsl.js";import{ColorAttachment0 as o,ColorAttachment1 as i}from"../../../../webgl/enums.js";import{makePipelineState as n,premultipliedAlphaToPremultipliedAlpha as l,defaultColorWrite as t}from"../../../../webgl/renderState.js";class a extends r{constructor(r,o){super(r,o,new e(s,(()=>import("./OITBlend.glsl.js"))))}initializePipeline(e){return n({blending:l,colorWrite:t,drawBuffers:e.hasEmission?{buffers:[o,i]}:{buffers:[o]}})}}export{a as OITBlendTechnique};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{releaseMaybe as e}from"../../../../core/maybe.js";import{c as t}from"../../../../chunks/vec42.js";import{ZEROS as i}from"../../../../core/libs/gl-matrix-2/factories/vec4f32.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{ColorFormat as r,DepthFormat as o}from"../../webgl/formats.js";import{ViewportSize as h}from"./BindParameters.js";import{FramebufferBit as c,ColorAttachment as l}from"../../../webgl/enums.js";import{ensureAttachmentMaxSize as _}from"../../../webgl/FramebufferObject.js";class a{constructor(e){this._fbos=e,this._requiresEmission=!1,this._size=new h(0,0),this._clearColor=s()}dispose(){this._color=e(this._color),this.releaseDepth()}initialize(e,i,s,r){this._size.width=e,this._size.height=i,_(this._size,this._fbos.rctx.parameters.maxTextureSize);const o=this._color;return this._color=null,this.releaseDepth(),this._requiresEmission=r,t(this._clearColor,s),o}releaseDepth(){this._color?.detachDepth(),this._depth=e(this._depth)}update(e){const t=this._ensureColor();t.attachDepth(this.depth),this._color=e(t)}bind(){const e=null==this._color;if(this.color.attachDepth(this.depth),this._fbos.rctx.bindFramebuffer(this.color.fbo),e){const e=this._fbos.rctx;e.setClearStencil(0),e.setClearColor(this._clearColor[0],this._clearColor[1],this._clearColor[2],this._clearColor[3]),e.clear(c.COLOR|c.DEPTH|c.STENCIL),this._requiresEmission&&e.gl.clearBufferfv(e.gl.COLOR,1,i)}}_acquireColor(){return this._requiresEmission?this._fbos.acquire(this._size.width,this._size.height,"acquired-color").acquireColor(l.COLOR_ATTACHMENT1,r.RGBA,"emissive"):this._fbos.acquire(this._size.width,this._size.height,"acquired-color")}_acquireDepth(){return this._fbos.acquireDepth(o.DEPTH_STENCIL_TEXTURE,this._size.width,this._size.height,"depth")}get size(){return this._size}get color(){return this._ensureColor()}get depth(){return this._depth??=this._acquireDepth(),this._depth}_ensureColor(){return this._color??=this._acquireColor(),this._color}}export{a as MainFramebuffer};
5
+ import{releaseMaybe as e}from"../../../../core/maybe.js";import{c as t}from"../../../../chunks/vec42.js";import{ZEROS as i}from"../../../../core/libs/gl-matrix-2/factories/vec4f32.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{ColorFormat as r,DepthFormat as o}from"../../webgl/formats.js";import{ViewportSize as h}from"./BindParameters.js";import{FramebufferBit as c,ColorAttachment1 as l}from"../../../webgl/enums.js";import{ensureAttachmentMaxSize as _}from"../../../webgl/FramebufferObject.js";class a{constructor(e){this._fbos=e,this._requiresEmission=!1,this._size=new h(0,0),this._clearColor=s()}dispose(){this._color=e(this._color),this.releaseDepth()}initialize(e,i,s,r){this._size.width=e,this._size.height=i,_(this._size,this._fbos.rctx.parameters.maxTextureSize);const o=this._color;return this._color=null,this.releaseDepth(),this._requiresEmission=r,t(this._clearColor,s),o}releaseDepth(){this._color?.detachDepth(),this._depth=e(this._depth)}update(e){const t=this._ensureColor();t.attachDepth(this.depth),this._color=e(t)}bind(){const e=null==this._color;if(this.color.attachDepth(this.depth),this._fbos.rctx.bindFramebuffer(this.color.fbo),e){const e=this._fbos.rctx;e.setClearStencil(0),e.setClearColor(this._clearColor[0],this._clearColor[1],this._clearColor[2],this._clearColor[3]),e.clear(c.COLOR|c.DEPTH|c.STENCIL),this._requiresEmission&&e.gl.clearBufferfv(e.gl.COLOR,1,i)}}_acquireColor(){return this._requiresEmission?this._fbos.acquire(this._size.width,this._size.height,"acquired-color").acquireColor(l,r.RGBA16F,"emissive"):this._fbos.acquire(this._size.width,this._size.height,"acquired-color")}_acquireDepth(){return this._fbos.acquireDepth(o.DEPTH_STENCIL_TEXTURE,this._size.width,this._size.height,"depth")}get size(){return this._size}get color(){return this._ensureColor()}get depth(){return this._depth??=this._acquireDepth(),this._depth}_ensureColor(){return this._color??=this._acquireColor(),this._color}}export{a as MainFramebuffer};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{clamp as t}from"../../../../core/mathUtils.js";import{q as n,n as r}from"../../../../chunks/vec32.js";import{create as o}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{newFloatArray as a}from"../../../../geometry/support/FloatArray.js";function s(t,n,r,o,a,s=2){const e=1/(Math.abs(r)+Math.abs(o)+Math.abs(a)),c=r*e,f=o*e,h=a<=0?(c>=0?1:-1)*(1-Math.abs(f)):c,u=a<=0?(f>=0?1:-1)*(1-Math.abs(c)):f,l=n*s;t[l]=i(h),t[l+1]=i(u)}function e(t){const n=t.length/3,r=new Int16Array(2*n);let o=0;for(let a=0;a<n;++a)s(r,a,t[o++],t[o++],t[o++]);return r}function c(t,r){const a=t.length/3,e=new Int16Array(2*a);let c=0;const f=o();for(let o=0;o<a;++o)f[0]=t[c++],f[1]=t[c++],f[2]=t[c++],n(f,f,r),s(e,o,f[0],f[1],f[2]);return e}function f(t,n,o,a=2){const s=o*a,e=u(n[s]),c=u(n[s+1]),f=1-Math.abs(e)-Math.abs(c);t[2]=f,f<0?(t[0]=(e>=0?1:-1)*(1-Math.abs(c)),t[1]=(c>=0?1:-1)*(1-Math.abs(e))):(t[0]=e,t[1]=c),r(t,t)}function h(t,n=2){const r=t.length/n,s=a(3*r),e=o();let c=0;for(let o=0;o<r;++o)f(e,t,o,n),s[c++]=e[0],s[c++]=e[1],s[c++]=e[2];return s}function i(n){return t(Math.round(32767*n),-32767,32767)}function u(n){return t(n/32767,-1,1)}export{c as compressAndTransformNormals,s as compressNormal,e as compressNormals,u as decodeInt16,f as decompressNormal,h as decompressNormals,i as encodeInt16};
5
+ import{clamp as t}from"../../../../core/mathUtils.js";import{q as r,n as o}from"../../../../chunks/vec32.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{newFloatArray as a}from"../../../../geometry/support/FloatArray.js";import{newShortArray as s}from"../../../../geometry/support/ShortArray.js";function e(t,r,o,n,a,s=2){const e=1/(Math.abs(o)+Math.abs(n)+Math.abs(a)),c=o*e,f=n*e,u=a<=0?(c>=0?1:-1)*(1-Math.abs(f)):c,h=a<=0?(f>=0?1:-1)*(1-Math.abs(c)):f,m=r*s;t[m]=i(u),t[m+1]=i(h)}function c(t){const r=t.length/3,o=s(2*r);let n=0;for(let a=0;a<r;++a)e(o,a,t[n++],t[n++],t[n++]);return o}function f(t,o){const a=t.length/3,s=new Int16Array(2*a);let c=0;const f=n();for(let n=0;n<a;++n)f[0]=t[c++],f[1]=t[c++],f[2]=t[c++],r(f,f,o),e(s,n,f[0],f[1],f[2]);return s}function u(t,r,n,a=2){const s=n*a,e=m(r[s]),c=m(r[s+1]),f=1-Math.abs(e)-Math.abs(c);return t[2]=f,f<0?(t[0]=(e>=0?1:-1)*(1-Math.abs(c)),t[1]=(c>=0?1:-1)*(1-Math.abs(e))):(t[0]=e,t[1]=c),o(t,t)}function h(t,r=2){const o=t.length/r,s=a(3*o),e=n();let c=0;for(let n=0;n<o;++n)u(e,t,n,r),s[c++]=e[0],s[c++]=e[1],s[c++]=e[2];return s}function i(r){return t(Math.round(32767*r),-32767,32767)}function m(r){return t(r/32767,-1,1)}export{f as compressAndTransformNormals,e as compressNormal,c as compressNormals,m as decodeInt16,u as decompressNormal,h as decompressNormals,i as encodeInt16};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import"../../../../core/has.js";import{copy as t,multiply as e,hasIdentityRotation as i}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as s,create as r}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{m as o,t as a,j as n,i as m,g as h,p as c,c as l}from"../../../../chunks/vec32.js";import{fromValues as d,create as u}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{a as g,c as f}from"../../../../chunks/sphere.js";import{maxScale as b}from"../../support/mathUtils.js";import{Object3DState as _}from"./basicInterfaces.js";import{ContentObject as p}from"./ContentObject.js";import{ContentObjectType as v}from"./ContentObjectType.js";import{Object3DOccludeeStateID as j,Object3DHighlightStateID as y}from"./Object3DStateID.js";import{assert as S}from"./Util.js";import{affectsGeometry as x}from"./VertexAttribute.js";import{addObject3DStateID as V,removeObject3DStateID as O}from"../materials/renderers/utils.js";class A extends p{get geometries(){return this._geometries}get transformation(){return this._transformation??s}set transformation(e){this._transformation=t(this._transformation??r(),e),this._invalidateBoundingVolume(),this._emit("transformationChanged",this)}get shaderTransformation(){return this._shaderTransformation}set shaderTransformation(e){this._shaderTransformation=e?t(this._shaderTransformation??r(),e):null,this._invalidateBoundingVolume(),this._emit("shaderTransformationChanged",this)}get effectiveTransformation(){return this.shaderTransformation??this.transformation}constructor(t={}){super(),this.type=v.Object,this._shaderTransformation=null,this._parentLayer=null,this._visible=!0,this.castShadow=t.castShadow??!0,this.usesVerticalDistanceToGround=t.usesVerticalDistanceToGround??!1,this.graphicUid=t.graphicUid,this.layerUid=t.layerUid,t.isElevationSource&&(this.lastValidElevationBB=new L),this._geometries=t.geometries?Array.from(t.geometries):new Array}dispose(){this._geometries.length=0}get parentLayer(){return this._parentLayer}set parentLayer(t){S(null==this._parentLayer||null==t,"Object3D can only be added to a single Layer"),this._parentLayer=t}addGeometry(t){t.visible=this._visible,this._geometries.push(t),this._emit("geometryAdded",{object:this,geometry:t}),this._invalidateBoundingVolume()}removeGeometry(t){const e=this._geometries.splice(t,1)[0];e&&(this._emit("geometryRemoved",{object:this,geometry:e}),this._invalidateBoundingVolume())}removeAllGeometries(){for(;this._geometries.length>0;)this.removeGeometry(0)}geometryVertexAttributeUpdated(t,e,i=!1){this._emit("attributesChanged",{object:this,geometry:t,attribute:e,sync:i}),x(e)&&this._invalidateBoundingVolume()}get visible(){return this._visible}set visible(t){if(this._visible!==t){this._visible=t;for(const t of this._geometries)t.visible=this._visible;this._emit("visibilityChanged",this)}}maskOccludee(){const t=new j;for(const e of this._geometries)e.occludees=V(e.occludees,t);return this._emit("occlusionChanged",this),t}removeOcclude(t){for(const e of this._geometries)e.occludees=O(e.occludees,t);this._emit("occlusionChanged",this)}highlight(t){const e=new y(t);for(const i of this._geometries)i.addHighlight(e);return this._emit("highlightChanged",this),e}removeHighlight(t){for(const e of this._geometries)e.removeHighlight(t);this._emit("highlightChanged",this)}removeStateID(t){t.channel===_.Highlight?this.removeHighlight(t):this.removeOcclude(t)}getCombinedStaticTransformation(t,i){return e(i,this.transformation,t.transformation)}getCombinedShaderTransformation(t,i=r()){return e(i,this.effectiveTransformation,t.transformation)}get boundingVolumeWorldSpace(){return this._bvWorldSpace||(this._bvWorldSpace=this._bvWorldSpace||new M,this._validateBoundingVolume(this._bvWorldSpace,E.WorldSpace)),this._bvWorldSpace}get boundingVolumeObjectSpace(){return this._bvObjectSpace||(this._bvObjectSpace=this._bvObjectSpace||new M,this._validateBoundingVolume(this._bvObjectSpace,E.ObjectSpace)),this._bvObjectSpace}_validateBoundingVolume(t,e){const i=e===E.ObjectSpace;for(const s of this._geometries){const e=s.boundingInfo;e&&T(e,t,i?s.transformation:this.getCombinedShaderTransformation(s))}o(g(t.bounds),t.min,t.max,.5);for(const s of this._geometries){const e=s.boundingInfo;if(null==e)continue;const r=i?s.transformation:this.getCombinedShaderTransformation(s),o=b(r);a(W,e.center,r);const m=n(W,g(t.bounds)),h=e.radius*o;t.bounds[3]=Math.max(t.bounds[3],m+h)}}_invalidateBoundingVolume(){const t=this._bvWorldSpace?.bounds;this._bvObjectSpace=this._bvWorldSpace=void 0,this._parentLayer&&t&&this._parentLayer.notifyObjectBBChanged(this,t)}_emit(t,e){this._parentLayer&&this._parentLayer.events.emit(t,e)}get test(){}}class L{constructor(){this.min=d(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),this.max=d(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE)}isEmpty(){return this.max[0]<this.min[0]&&this.max[1]<this.min[1]&&this.max[2]<this.min[2]}}class M extends L{constructor(){super(...arguments),this.bounds=f()}}function T(t,e,s){const r=t.bbMin,o=t.bbMax;if(i(s)){const t=m(C,s[12],s[13],s[14]);h(B,r,t),h(U,o,t);for(let i=0;i<3;++i)e.min[i]=Math.min(e.min[i],B[i]),e.max[i]=Math.max(e.max[i],U[i])}else if(a(B,r,s),c(r,o))for(let i=0;i<3;++i)e.min[i]=Math.min(e.min[i],B[i]),e.max[i]=Math.max(e.max[i],B[i]);else{a(U,o,s);for(let t=0;t<3;++t)e.min[t]=Math.min(e.min[t],B[t],U[t]),e.max[t]=Math.max(e.max[t],B[t],U[t]);for(let t=0;t<3;++t){l(B,r),l(U,o),B[t]=o[t],U[t]=r[t],a(B,B,s),a(U,U,s);for(let t=0;t<3;++t)e.min[t]=Math.min(e.min[t],B[t],U[t]),e.max[t]=Math.max(e.max[t],B[t],U[t])}}}const C=u(),B=u(),U=u(),W=u();var E;!function(t){t[t.WorldSpace=0]="WorldSpace",t[t.ObjectSpace=1]="ObjectSpace"}(E||(E={}));export{M as BoundingVolume,A as Object3D};
5
+ import"../../../../core/has.js";import{copy as t,multiply as e,hasIdentityRotation as i}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as s,create as r}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{m as o,t as a,j as n,i as h,g as m,p as c,c as l}from"../../../../chunks/vec32.js";import{fromValues as d,create as g}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{a as u,c as f}from"../../../../chunks/sphere.js";import{maxScale as _}from"../../support/mathUtils.js";import{Object3DState as b}from"./basicInterfaces.js";import{ContentObject as p}from"./ContentObject.js";import{ContentObjectType as v}from"./ContentObjectType.js";import{Object3DOccludeeStateID as j,Object3DHighlightStateID as S}from"./Object3DStateID.js";import{assert as y}from"./Util.js";import{affectsGeometry as x}from"./VertexAttribute.js";import{addObject3DStateID as V,removeObject3DStateID as O}from"../materials/renderers/utils.js";class A extends p{get geometries(){return this._geometries}get transformation(){return this._transformation??s}set transformation(e){this._transformation=t(this._transformation??r(),e),this._invalidateBoundingVolume(),this._emit("transformationChanged",this)}get shaderTransformation(){return this._shaderTransformation}set shaderTransformation(e){this._shaderTransformation=e?t(this._shaderTransformation??r(),e):null,this._invalidateBoundingVolume(),this._emit("shaderTransformationChanged",this)}get effectiveTransformation(){return this.shaderTransformation??this.transformation}constructor(t={}){super(),this.type=v.Object,this._shaderTransformation=null,this._parentLayer=null,this._visible=!0,this._highlightIds=new Set,this.castShadow=t.castShadow??!0,this.usesVerticalDistanceToGround=t.usesVerticalDistanceToGround??!1,this.graphicUid=t.graphicUid,this.layerUid=t.layerUid,t.isElevationSource&&(this.lastValidElevationBB=new C),this._geometries=t.geometries?Array.from(t.geometries):new Array}dispose(){this._geometries.length=0}get parentLayer(){return this._parentLayer}set parentLayer(t){y(null==this._parentLayer||null==t,"Object3D can only be added to a single Layer"),this._parentLayer=t}addGeometry(t){t.visible=this._visible,this._geometries.push(t);for(const e of this._highlightIds)t.addHighlight(e);this._emit("geometryAdded",{object:this,geometry:t}),this._highlightIds.size&&this._emit("highlightChanged",this),this._invalidateBoundingVolume()}removeGeometry(t){const e=this._geometries.splice(t,1)[0];if(e){for(const t of this._highlightIds)e.removeHighlight(t);this._emit("geometryRemoved",{object:this,geometry:e}),this._highlightIds.size&&this._emit("highlightChanged",this),this._invalidateBoundingVolume()}}removeAllGeometries(){for(;this._geometries.length>0;)this.removeGeometry(0)}geometryVertexAttributeUpdated(t,e,i=!1){this._emit("attributesChanged",{object:this,geometry:t,attribute:e,sync:i}),x(e)&&this._invalidateBoundingVolume()}get visible(){return this._visible}set visible(t){if(this._visible!==t){this._visible=t;for(const t of this._geometries)t.visible=this._visible;this._emit("visibilityChanged",this)}}maskOccludee(){const t=new j;for(const e of this._geometries)e.occludees=V(e.occludees,t);return this._emit("occlusionChanged",this),t}removeOcclude(t){for(const e of this._geometries)e.occludees=O(e.occludees,t);this._emit("occlusionChanged",this)}highlight(t){const e=new S(t);for(const i of this._geometries)i.addHighlight(e);return this._emit("highlightChanged",this),this._highlightIds.add(e),e}removeHighlight(t){this._highlightIds.delete(t);for(const e of this._geometries)e.removeHighlight(t);this._emit("highlightChanged",this)}removeStateID(t){t.channel===b.Highlight?this.removeHighlight(t):this.removeOcclude(t)}getCombinedStaticTransformation(t,i){return e(i,this.transformation,t.transformation)}getCombinedShaderTransformation(t,i=r()){return e(i,this.effectiveTransformation,t.transformation)}get boundingVolumeWorldSpace(){return this._bvWorldSpace||(this._bvWorldSpace=this._bvWorldSpace||new L,this._validateBoundingVolume(this._bvWorldSpace,W.WorldSpace)),this._bvWorldSpace}get boundingVolumeObjectSpace(){return this._bvObjectSpace||(this._bvObjectSpace=this._bvObjectSpace||new L,this._validateBoundingVolume(this._bvObjectSpace,W.ObjectSpace)),this._bvObjectSpace}_validateBoundingVolume(t,e){const i=e===W.ObjectSpace;for(const s of this._geometries){const e=s.boundingInfo;e&&M(e,t,i?s.transformation:this.getCombinedShaderTransformation(s))}o(u(t.bounds),t.min,t.max,.5);for(const s of this._geometries){const e=s.boundingInfo;if(null==e)continue;const r=i?s.transformation:this.getCombinedShaderTransformation(s),o=_(r);a(I,e.center,r);const h=n(I,u(t.bounds)),m=e.radius*o;t.bounds[3]=Math.max(t.bounds[3],h+m)}}_invalidateBoundingVolume(){const t=this._bvWorldSpace?.bounds;this._bvObjectSpace=this._bvWorldSpace=void 0,this._parentLayer&&t&&this._parentLayer.notifyObjectBBChanged(this,t)}_emit(t,e){this._parentLayer&&this._parentLayer.events.emit(t,e)}get test(){}}class C{constructor(){this.min=d(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),this.max=d(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE)}isEmpty(){return this.max[0]<this.min[0]&&this.max[1]<this.min[1]&&this.max[2]<this.min[2]}}class L extends C{constructor(){super(...arguments),this.bounds=f()}}function M(t,e,s){const r=t.bbMin,o=t.bbMax;if(i(s)){const t=h(T,s[12],s[13],s[14]);m(B,r,t),m(U,o,t);for(let i=0;i<3;++i)e.min[i]=Math.min(e.min[i],B[i]),e.max[i]=Math.max(e.max[i],U[i])}else if(a(B,r,s),c(r,o))for(let i=0;i<3;++i)e.min[i]=Math.min(e.min[i],B[i]),e.max[i]=Math.max(e.max[i],B[i]);else{a(U,o,s);for(let t=0;t<3;++t)e.min[t]=Math.min(e.min[t],B[t],U[t]),e.max[t]=Math.max(e.max[t],B[t],U[t]);for(let t=0;t<3;++t){l(B,r),l(U,o),B[t]=o[t],U[t]=r[t],a(B,B,s),a(U,U,s);for(let t=0;t<3;++t)e.min[t]=Math.min(e.min[t],B[t],U[t]),e.max[t]=Math.max(e.max[t],B[t],U[t])}}}const T=g(),B=g(),U=g(),I=g();var W;!function(t){t[t.WorldSpace=0]="WorldSpace",t[t.ObjectSpace=1]="ObjectSpace"}(W||(W={}));export{L as BoundingVolume,A as Object3D};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{isColorEmission as r}from"../core/shaderLibrary/ShaderOutput.js";import{OITPass as e}from"./OITPass.js";import{BlendFactor as n,CompareFunction as t,ColorAttachment as o}from"../../../webgl/enums.js";import{separateBlendingParams as u,premultipliedAlphaToPremultipliedAlpha as s,defaultDepthWrite as c}from"../../../webgl/renderState.js";const O=u(n.ONE,n.ZERO,n.ONE,n.ONE_MINUS_SRC_ALPHA);function T(r){return r===e.FrontFace?null:O}function a(r){switch(r){case e.NONE:return s;case e.ColorAlpha:return O;case e.FrontFace:case e.COUNT:return null}}function l(r){if(r.draped)return null;switch(r.oitPass){case e.NONE:case e.FrontFace:return r.writeDepth?c:null;case e.ColorAlpha:case e.COUNT:return null}}const A=5e5,C={factor:-1,units:-2};function N(r){return r?C:null}function f(r,n=t.LESS){return r===e.NONE||r===e.FrontFace?n:t.LEQUAL}function i(n,t){const u=r(t);return n===e.ColorAlpha?u?{buffers:[o.COLOR_ATTACHMENT0,o.COLOR_ATTACHMENT1,o.COLOR_ATTACHMENT2]}:{buffers:[o.COLOR_ATTACHMENT0,o.COLOR_ATTACHMENT1]}:u?{buffers:[o.COLOR_ATTACHMENT0,o.COLOR_ATTACHMENT1]}:null}export{C as OITPolygonOffset,A as OITPolygonOffsetLimit,a as blending,O as blendingColorAlpha,l as depthWrite,i as getDrawBuffers,N as getOITPolygonOffset,T as oitBlending,f as oitDepthTest};
5
+ import{isColorEmission as r}from"../core/shaderLibrary/ShaderOutput.js";import{OITPass as e}from"./OITPass.js";import{BlendFactor as n,CompareFunction as t,ColorAttachment0 as o,ColorAttachment1 as u,ColorAttachment2 as s}from"../../../webgl/enums.js";import{separateBlendingParams as c,premultipliedAlphaToPremultipliedAlpha as a,defaultDepthWrite as l}from"../../../webgl/renderState.js";const f=c(n.ONE,n.ZERO,n.ONE,n.ONE_MINUS_SRC_ALPHA);function i(r){return r===e.FrontFace?null:f}function N(r){switch(r){case e.NONE:return a;case e.ColorAlpha:return f;case e.FrontFace:case e.COUNT:return null}}function p(r){if(r.draped)return null;switch(r.oitPass){case e.NONE:case e.FrontFace:return r.writeDepth?l:null;case e.ColorAlpha:case e.COUNT:return null}}const O=5e5,m={factor:-1,units:-2};function E(r){return r?m:null}function h(r,n=t.LESS){return r===e.NONE||r===e.FrontFace?n:t.LEQUAL}function F(n,t){const c=r(t);return n===e.ColorAlpha?c?{buffers:[o,u,s]}:{buffers:[o,u]}:c?{buffers:[o,u]}:null}export{m as OITPolygonOffset,O as OITPolygonOffsetLimit,N as blending,f as blendingColorAlpha,p as depthWrite,F as getDrawBuffers,E as getOITPolygonOffset,i as oitBlending,h as oitDepthTest};