@arcgis/core 4.32.0-next.20250106 → 4.32.0-next.20250108

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 (228) hide show
  1. package/AttributeBinsGraphic.js +5 -0
  2. package/README.md +1 -1
  3. package/WebLinkChart.js +1 -1
  4. package/applications/MapViewer/templateUtils.js +1 -1
  5. package/assets/esri/core/workers/RemoteClient.js +1 -1
  6. package/assets/esri/core/workers/chunks/000771f8eefcd6af0fda.js +1 -0
  7. package/assets/esri/core/workers/chunks/{9372d08ba8bf3342c48f.js → 011ccfd3acee83e7dc68.js} +1 -1
  8. package/assets/esri/core/workers/chunks/03af4a51043677ffcd0f.js +1 -0
  9. package/assets/esri/core/workers/chunks/{d07da8b63d83af179a2c.js → 05943caacfd28c383810.js} +1 -1
  10. package/assets/esri/core/workers/chunks/{9f495ad57cdbfa90c5b8.js → 095aeb19e2207c8361ca.js} +1 -1
  11. package/assets/esri/core/workers/chunks/{67c7bdc0c91a8f803ea8.js → 11cb25dfab7c8467897a.js} +1 -1
  12. package/assets/esri/core/workers/chunks/{07304287ed5244fa4e12.js → 12b2c8251ec2d0e2ca46.js} +1 -1
  13. package/assets/esri/core/workers/chunks/{42aa697b4718b75b8cb2.js → 1abeba63bf623a746d5c.js} +2 -2
  14. package/assets/esri/core/workers/chunks/{42aa697b4718b75b8cb2.js.LICENSE.txt → 1abeba63bf623a746d5c.js.LICENSE.txt} +1 -1
  15. package/assets/esri/core/workers/chunks/{a57cead317eb2fc9afd8.js → 206194cf069ad4bcc3ad.js} +1 -1
  16. package/assets/esri/core/workers/chunks/24a597ae32a2083a50a5.js +1 -0
  17. package/assets/esri/core/workers/chunks/{0673d811c496143fc3d4.js → 2779cf112299b612a73a.js} +1 -1
  18. package/assets/esri/core/workers/chunks/{bd37c9cc720587665fd3.js → 304b88ade7551130ad3a.js} +1 -1
  19. package/assets/esri/core/workers/chunks/{aedff36d3fec86abb9fb.js → 30a84ddf0384bb52fdbe.js} +1 -1
  20. package/assets/esri/core/workers/chunks/{367af4aa7e170c8553e3.js → 33a13544b9e5f4f20bce.js} +1 -1
  21. package/assets/esri/core/workers/chunks/{dce55e7f76adecc055c3.js → 35d9457109d0631a1ca8.js} +1 -1
  22. package/assets/esri/core/workers/chunks/{3a90163b76b0bc7f21d2.js → 3767defbd9c4b2e86886.js} +1 -1
  23. package/assets/esri/core/workers/chunks/3a3e9701e5d7b05f41b7.js +1 -0
  24. package/assets/esri/core/workers/chunks/{9a498f2c007f4d78d4dd.js → 4234539a9721104acafb.js} +1 -1
  25. package/assets/esri/core/workers/chunks/{76fa5c7c87831ad25cde.js → 435c037ccba71f1e22d3.js} +1 -1
  26. package/assets/esri/core/workers/chunks/4387c47ae1b36d770f1d.js +1 -0
  27. package/assets/esri/core/workers/chunks/44ec3c77339b9765aaa4.js +1 -0
  28. package/assets/esri/core/workers/chunks/4b77c8d994498899631a.js +1 -0
  29. package/assets/esri/core/workers/chunks/510cb8647841fec436c8.js +1 -0
  30. package/assets/esri/core/workers/chunks/{f9af0473878d960a02f2.js → 58485909e1cfeb52c01e.js} +1 -1
  31. package/assets/esri/core/workers/chunks/5b61a1e7ac60a02a906d.js +1 -0
  32. package/assets/esri/core/workers/chunks/62f8949a2d9076f3c1ea.js +2 -0
  33. package/assets/esri/core/workers/chunks/{c8cd6ba5600d8ff8db0b.js.LICENSE.txt → 62f8949a2d9076f3c1ea.js.LICENSE.txt} +1 -1
  34. package/assets/esri/core/workers/chunks/{664aa401887b59abd7b7.js → 6400f39a965900f66ce7.js} +1 -1
  35. package/assets/esri/core/workers/chunks/{ddce265c46e4dfeb6c6d.js → 66d40a486aa3caa76106.js} +1 -1
  36. package/assets/esri/core/workers/chunks/6b3ee691646fbc39445c.js +1 -0
  37. package/assets/esri/core/workers/chunks/{533a7fd64b17bb294545.js → 6c58f792e2ae3736f662.js} +1 -1
  38. package/assets/esri/core/workers/chunks/{370b230fd2d7703d0698.js → 6efb36bc2205203ff44d.js} +2 -2
  39. package/assets/esri/core/workers/chunks/{370b230fd2d7703d0698.js.LICENSE.txt → 6efb36bc2205203ff44d.js.LICENSE.txt} +1 -1
  40. package/assets/esri/core/workers/chunks/76a7114a69264f5c07b0.js +2 -0
  41. package/assets/esri/core/workers/chunks/{005727711cca0614c2ab.js.LICENSE.txt → 76a7114a69264f5c07b0.js.LICENSE.txt} +1 -1
  42. package/assets/esri/core/workers/chunks/{a90611cdc86190799560.js → 7a43fda8984549a084b8.js} +1 -1
  43. package/assets/esri/core/workers/chunks/7b753da3b8a6d75abf20.js +1 -0
  44. package/assets/esri/core/workers/chunks/{ca1e186f136abb23ae4b.js → 7d0fc25ce1f74adcfeb6.js} +1 -1
  45. package/assets/esri/core/workers/chunks/{9b020c47ca9ff5de9bb8.js → 7db356976198c4df76c1.js} +1 -1
  46. package/assets/esri/core/workers/chunks/{9ad7d095e614e7e8d7f5.js → 7df076d15b7b7a66dcee.js} +1 -1
  47. package/assets/esri/core/workers/chunks/{955421ee2247965244f0.js → 7fe92f072d3641ec4662.js} +1 -1
  48. package/assets/esri/core/workers/chunks/{4c56698cf1c669371865.js → 81816410cb1453938593.js} +1 -1
  49. package/assets/esri/core/workers/chunks/{4ffaa2c5ab47a599ee9f.js → 82266ca8002554198208.js} +1 -1
  50. package/assets/esri/core/workers/chunks/{88c68881cbdf4e911832.js → 89286d8f59844724cd16.js} +1 -1
  51. package/assets/esri/core/workers/chunks/{f19d3c855f6e93544918.js → 8be0151a24c9af76a976.js} +1 -1
  52. package/assets/esri/core/workers/chunks/{d9e396adf3354ee68339.js → 8f2b2d2dc9935b0d2039.js} +1 -1
  53. package/assets/esri/core/workers/chunks/907a91266e25cc4b9d42.js +1 -0
  54. package/assets/esri/core/workers/chunks/{a77aa86896bbb0e088df.js → 9857491cafa0278d9ae6.js} +1 -1
  55. package/assets/esri/core/workers/chunks/{993db7646a8fc60179eb.js → 98da074899c82f0ded0b.js} +1 -1
  56. package/assets/esri/core/workers/chunks/{3bb94da29dac3367ecc6.js → a1edd3f68e691ea39594.js} +1 -1
  57. package/assets/esri/core/workers/chunks/a8ec4189ec3b37d5ff74.js +1 -0
  58. package/assets/esri/core/workers/chunks/{6a4305eb1e52b80ecb5c.js → b8ea84adff5619040494.js} +3 -3
  59. package/assets/esri/core/workers/chunks/c4374b6bc5c8dc6435c7.js +1 -0
  60. package/assets/esri/core/workers/chunks/c5a928dcff7dc8a8cc9f.js +2 -0
  61. package/assets/esri/core/workers/chunks/{f4e3db71d1adae717535.js.LICENSE.txt → c5a928dcff7dc8a8cc9f.js.LICENSE.txt} +1 -1
  62. package/assets/esri/core/workers/chunks/cac79b64a7dade8bf486.js +2 -0
  63. package/assets/esri/core/workers/chunks/{bf0a0ca7fdac98f06a89.js.LICENSE.txt → cac79b64a7dade8bf486.js.LICENSE.txt} +1 -1
  64. package/assets/esri/core/workers/chunks/cd92b80de7e9f982f9a9.js +1 -0
  65. package/assets/esri/core/workers/chunks/{2cccaf50134c65944e0a.js → d0876eed5249b029f9f0.js} +1 -1
  66. package/assets/esri/core/workers/chunks/{178f606c8896ae5f39de.js → d1dbbab4a4c6072c182f.js} +1 -1
  67. package/assets/esri/core/workers/chunks/{8e42fb623f56942958d8.js → d74b5dc60f02892d03e7.js} +1 -1
  68. package/assets/esri/core/workers/chunks/e27b8674a3492db51f2e.js +1 -0
  69. package/assets/esri/core/workers/chunks/{756c2f7c8659deab6c96.js → e2d987c39a6ef318511c.js} +2 -2
  70. package/assets/esri/core/workers/chunks/{756c2f7c8659deab6c96.js.LICENSE.txt → e2d987c39a6ef318511c.js.LICENSE.txt} +1 -1
  71. package/assets/esri/core/workers/chunks/{943428cf643e87ccfaad.js → e7e26b71f9eb28421936.js} +1 -1
  72. package/assets/esri/core/workers/chunks/{f0adabf6d71a27f3183b.js → e80b0646a7e0e466ea65.js} +1 -1
  73. package/assets/esri/core/workers/chunks/e9c21907fabcedbd32ae.js +1 -0
  74. package/assets/esri/core/workers/chunks/{3ed7c8138231de3a3b96.js → f8c960df1dabab120c70.js} +1 -1
  75. package/assets/esri/core/workers/chunks/{fdd8a5eb07466541f1f9.js → fd95b19f02d8dfef2baf.js} +1 -1
  76. package/assets/esri/widgets/support/GridControls/t9n/GridControls_ja.json +1 -1
  77. package/chunks/CrackAndCluster-CfzXpEle.js +1 -1
  78. package/chunks/LineSeries.js +1 -1
  79. package/chunks/OperatorProject.js +1 -1
  80. package/chunks/Pattern.glsl.js +1 -1
  81. package/chunks/QuadraticBezier.js +1 -1
  82. package/chunks/Transformation2D.js +1 -1
  83. package/chunks/bufferOperator.js +1 -1
  84. package/chunks/chartUtilsAm5.js +1 -1
  85. package/chunks/geodesicBufferOperator.js +1 -1
  86. package/chunks/lyr3DWorker.js +1 -1
  87. package/chunks/terrainUtilsPlanar.js +1 -1
  88. package/chunks/terrainUtilsSpherical.js +1 -1
  89. package/chunks/vxlLayer.js +1 -1
  90. package/geometry/operators/graphicBufferOperator.js +1 -1
  91. package/geometry/support/meshUtils/primitives.js +1 -1
  92. package/geometry/support/meshVertexSpaceUtils.js +1 -1
  93. package/geometry/support/triangle.js +1 -1
  94. package/interfaces.d.ts +186 -96
  95. package/layers/LinkChartLayer.js +1 -1
  96. package/layers/MapNotesLayer.js +1 -1
  97. package/layers/MediaLayer.js +1 -1
  98. package/layers/graphics/data/QueryEngineResult.js +1 -1
  99. package/layers/graphics/data/queryUtils.js +1 -1
  100. package/layers/graphics/data/queryValidationUtils.js +1 -1
  101. package/layers/graphics/sources/WFSSource.js +1 -1
  102. package/layers/support/ImageElement.js +1 -1
  103. package/layers/support/VideoElement.js +1 -1
  104. package/layers/support/capabilities.js +1 -1
  105. package/layers/support/featureLayerUtils.js +1 -1
  106. package/layers/support/rasterFunctions/rasterProjectionHelper.js +1 -1
  107. package/layers/support/serviceCapabilitiesUtils.js +1 -1
  108. package/layers/video/VideoController.js +1 -1
  109. package/linkChart/OrganicLayoutSettings.js +1 -1
  110. package/package.json +4 -4
  111. package/renderers/RasterStretchRenderer.js +1 -1
  112. package/rest/query/executeAttributeBinsQuery.js +1 -1
  113. package/rest/support/AttributeBinsFeatureSet.js +5 -0
  114. package/rest/support/AttributeBinsQuery.js +1 -1
  115. package/rest/support/BinParametersAttributes.js +1 -1
  116. package/rest/support/BinParametersBase.js +1 -1
  117. package/rest/support/DateBinParameters.js +1 -1
  118. package/rest/support/FeatureSet.js +1 -1
  119. package/rest/support/NormalizationBinParametersMixin.js +1 -1
  120. package/rest/support/Query.js +1 -1
  121. package/rest/support/TopFeaturesQuery.js +1 -1
  122. package/smartMapping/renderers/color.js +1 -1
  123. package/smartMapping/renderers/dotDensity.js +1 -1
  124. package/smartMapping/renderers/pieChart.js +1 -1
  125. package/smartMapping/renderers/size.js +1 -1
  126. package/smartMapping/renderers/univariateColorSize.js +1 -1
  127. package/smartMapping/statistics/summaryStatisticsForAttributes.js +1 -1
  128. package/support/mediaLayerUtils.js +5 -0
  129. package/support/revision.js +1 -1
  130. package/symbols/cim/CIMSymbolDrawHelper.js +1 -1
  131. package/symbols/cim/cimAnalyzer.js +1 -1
  132. package/symbols/cim/placements/PlacementInsidePolygon.js +1 -1
  133. package/views/2d/AnimationManager.js +1 -1
  134. package/views/2d/engine/Bitmap.js +1 -1
  135. package/views/2d/engine/BitmapContainer.js +1 -1
  136. package/views/2d/engine/BitmapTileContainer.js +1 -1
  137. package/views/2d/engine/vectorTiles/buckets/FillBucket.js +1 -1
  138. package/views/2d/engine/webgl/Overlay.js +1 -1
  139. package/views/2d/engine/webgl/SDFConverter.js +1 -1
  140. package/views/2d/engine/webgl/mesh/templates/shapingUtils.js +1 -1
  141. package/views/2d/engine/webgl/shaderGraph/techniques/bitmap/BitmapTechnique.js +1 -1
  142. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/hittestUtils.js +1 -1
  143. package/views/2d/layers/FeatureLayerView2D.js +1 -1
  144. package/views/2d/layers/features/processor/ClusterStrategy.js +1 -1
  145. package/views/2d/layers/features/support/GraphicsReader.js +1 -1
  146. package/views/2d/navigation/MapViewNavigation.js +1 -1
  147. package/views/2d/support/HighlightGroup.js +1 -1
  148. package/views/3d/analysis/Dimension/lengthDimensionUtils.js +1 -1
  149. package/views/3d/analysis/Slice/ShiftManipulator.js +1 -1
  150. package/views/3d/analysis/Viewshed/FieldOfViewManipulation.js +1 -1
  151. package/views/3d/analysis/Viewshed/ViewshedSubTool.js +1 -1
  152. package/views/3d/analysis/support/measurementUtils.js +1 -1
  153. package/views/3d/environment/CloudsParameters.js +1 -1
  154. package/views/3d/environment/MarsAtmosphere.js +1 -1
  155. package/views/3d/interactive/editingTools/transform/ScaleRotateTransform.js +1 -1
  156. package/views/3d/layers/MediaLayerView3D.js +1 -1
  157. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  158. package/views/3d/layers/graphics/placementUtils.js +1 -1
  159. package/views/3d/layers/i3s/I3SUtil.js +1 -1
  160. package/views/3d/layers/support/FeatureTileVisibility3D.js +1 -1
  161. package/views/3d/state/NearFarHeuristic.js +1 -1
  162. package/views/3d/state/helpers/SceneIntersectionHelper.js +1 -1
  163. package/views/3d/support/HighlightGroup.js +1 -1
  164. package/views/3d/terrain/SphericalPatch.js +1 -1
  165. package/views/3d/terrain/TerrainRenderer.js +1 -1
  166. package/views/3d/terrain/TerrainSurface.js +1 -1
  167. package/views/3d/terrain/TilePerLayerInfo.js +1 -1
  168. package/views/3d/terrain/TileRenderer.js +1 -1
  169. package/views/3d/terrain/TileTexture.js +1 -1
  170. package/views/3d/terrain/terrainUtilsPlanar.js +1 -1
  171. package/views/3d/terrain/terrainUtilsSpherical.js +1 -1
  172. package/views/3d/webgl-engine/collections/Component/ComponentIntersectionData.js +1 -1
  173. package/views/3d/webgl-engine/collections/Component/SourceGeometry.js +1 -1
  174. package/views/3d/webgl-engine/effects/bloom/BloomRenderNode.js +1 -1
  175. package/views/3d/webgl-engine/lib/PathProfile.js +1 -1
  176. package/views/3d/webgl-engine/lib/depthRangeUtils.js +1 -1
  177. package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
  178. package/views/3d/webgl-engine/shaders/OutputColorHighlightOID.glsl.js +4 -4
  179. package/views/SceneView.js +1 -1
  180. package/views/View.js +1 -1
  181. package/views/draw/support/HighlightHelper.js +1 -1
  182. package/views/input/BrowserEventSource.js +1 -1
  183. package/views/layers/DimensionLayerView.js +1 -1
  184. package/views/layers/MediaLayerView.js +1 -1
  185. package/views/support/HighlightGroup.d.ts +4 -0
  186. package/views/support/HighlightGroup.js +5 -0
  187. package/views/webgl/Texture.js +1 -1
  188. package/views/webgl/textureUtils.js +5 -0
  189. package/webscene/Slide.js +1 -1
  190. package/widgets/BasemapLayerList.js +1 -1
  191. package/widgets/BuildingExplorer/BuildingLevelPicker/BuildingLevelPicker.js +1 -1
  192. package/widgets/CatalogLayerList.js +1 -1
  193. package/widgets/Editor/UpdateRecordWorkflow.js +1 -1
  194. package/widgets/Editor/UpdateWorkflow.js +1 -1
  195. package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
  196. package/widgets/FeatureTable/Grid/Grid.js +1 -1
  197. package/widgets/FeatureTable/support/exportUtils.js +1 -1
  198. package/widgets/FeatureTable/support/tableUtils.js +1 -1
  199. package/widgets/LayerList/support/layerListUtils.js +1 -1
  200. package/widgets/LayerList.js +1 -1
  201. package/widgets/Legend/styles/support/relationshipUtils.js +1 -1
  202. package/widgets/PanoramicViewer/utils.js +1 -1
  203. package/widgets/ScaleRangeSlider/ScaleRangeSliderViewModel.js +1 -1
  204. package/widgets/Sketch/SketchViewModel.js +1 -1
  205. package/widgets/TableList.js +1 -1
  206. package/widgets/support/ColorPicker.js +1 -1
  207. package/assets/esri/core/workers/chunks/005727711cca0614c2ab.js +0 -2
  208. package/assets/esri/core/workers/chunks/0a3bf1b74cce1b6b7ed8.js +0 -1
  209. package/assets/esri/core/workers/chunks/0d2411a941c42acb8cc2.js +0 -1
  210. package/assets/esri/core/workers/chunks/127c82cdb229434883b6.js +0 -1
  211. package/assets/esri/core/workers/chunks/13720b1d97fb7d80e972.js +0 -1
  212. package/assets/esri/core/workers/chunks/14b87f3dd9942e6b19d0.js +0 -1
  213. package/assets/esri/core/workers/chunks/16530347bd78dc6c2fcd.js +0 -1
  214. package/assets/esri/core/workers/chunks/1a713cc601c6fcd97d2f.js +0 -1
  215. package/assets/esri/core/workers/chunks/3029354194f1a3030c5c.js +0 -1
  216. package/assets/esri/core/workers/chunks/318a39b56851e707edad.js +0 -1
  217. package/assets/esri/core/workers/chunks/53cd990b2c988518de6d.js +0 -1
  218. package/assets/esri/core/workers/chunks/5a0eb9dfe668cf290462.js +0 -1
  219. package/assets/esri/core/workers/chunks/66b411119b8ffb99b9dc.js +0 -1
  220. package/assets/esri/core/workers/chunks/8cd2c9ec1e541836b81c.js +0 -1
  221. package/assets/esri/core/workers/chunks/9f0ebeae8a3ba360284b.js +0 -1
  222. package/assets/esri/core/workers/chunks/a3cef3837f4df9ab022e.js +0 -1
  223. package/assets/esri/core/workers/chunks/bf0a0ca7fdac98f06a89.js +0 -2
  224. package/assets/esri/core/workers/chunks/c8cd6ba5600d8ff8db0b.js +0 -2
  225. package/assets/esri/core/workers/chunks/ea250d66089967976c05.js +0 -1
  226. package/assets/esri/core/workers/chunks/ecf317c6c790b3cc83bf.js +0 -1
  227. package/assets/esri/core/workers/chunks/f4e3db71d1adae717535.js +0 -2
  228. package/views/2d/support/HighlightGroup.d.ts +0 -4
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import"../../../core/has.js";import{disposeMaybe as r,releaseMaybe as s}from"../../../core/maybe.js";import{watch as o,sync as i}from"../../../core/reactiveUtils.js";import{property as a}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as n}from"../../../core/accessorSupport/decorators/subclass.js";import{set as c,copy as u}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{ZEROS as p}from"../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{fromValues as l}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isBaseLayer as d,isGroupLayer as m}from"../../../layers/support/layerUtils.js";import{BlendLayersPassParameters as h}from"./BlendLayersTechnique.js";import{TextureUpdate as f}from"./interfaces.js";import{LayerClass as _}from"./LayerClass.js";import{NeighborIndex as T}from"./NeighborIndex.js";import{isImageWithType as y}from"./TerrainData.js";import{isBlendableLayerView as g,isVectorTileLayerView as x,isVectorTileRenderInfo as b,isImageryTileRenderInfo as I,isImageSourceRenderInfo as w,isTextureTileRenderInfo as j,isVectorTilePerLayerInfo as A}from"./terrainUtils.js";import{ActivationTime as O}from"./TextureFader.js";import{TextureReference as C}from"./TextureReference.js";import{TileCompositor as P}from"./TileCompositor.js";import{TileRenderInfo as k}from"./TileRenderInfo.js";import D from"./TileTexture.js";import{TileUpdate as E}from"./TileUpdate.js";import{fallsWithinLayerView as L}from"./tileUtils.js";import{blendModeFromString as R}from"../webgl-engine/core/shaderLibrary/output/BlendOptions.js";import{BlendLayersOutput as M}from"../webgl-engine/core/shaderLibrary/terrain/BlendLayersOutput.js";import{createEmptyTexture as N}from"../webgl-engine/lib/glUtil3D.js";import{isCompressionCandidate as B}from"../../support/TextureCompressionHelper.js";import{TextureSamplingMode as S,TextureWrapMode as U,PixelFormat as G}from"../../webgl/enums.js";import{Texture as v}from"../../webgl/Texture.js";import{TextureDescriptor as F}from"../../webgl/TextureDescriptor.js";class H{constructor(e,t,r,s,o,i){this.start=e,this.end=t,this.blendMode=r,this.opacity=s,this.output=o,this.baseOpacity=i}}let q=class extends t{constructor(e){super(e),this._passParameters=new h,this._backgroundTexture=null,this._backgroundColor=null,this._backgroundDirty=!1}initialize(){this._maxAnisotropy=this.rctx.parameters.maxMaxAnisotropy,this._compositor=new P(this.rctx,this.techniques),this._ensureBackgroundTexture(this.tileSize),this.texturesBeingCompressed=0}dispose(){this._compositor=r(this._compositor),this._backgroundTexture=s(this._backgroundTexture)}get backgroundIsGrid(){return null==this._backgroundColor}get backgroundColor(){return this._backgroundColor}updateHeading(e){this._compositor?.updateHeading(e)}updateTileTexture(e,t){if(!e.renderData)return;const r=e.surface,s=r.baseOpacity;let o=0,i=0,a=this.tileSize,n=!1,c=!1;const u=r.view.state.contentPixelRatio;let p=!1;J.clear(),K.length=0;const l=e.layerInfo[_.MAP];let h=0,T=null;for(;h<l.length;h++){const t=r.layerViewByIndex(h,_.MAP),f=t.layer,y=!L(e,t),b=f.opacity,I=t.fullOpacity;if(c=c||d(f),g(t)){let e="normal"!==t.layer.blendMode;if(m(f.parent)){const t=f.parent.uid;null!=t&&""!==t&&(e=X(f.parent)||e)}e&&(p=e,n=!1)}if((y||0===b)&&!p){l[h].pendingUpdates&=~(E.TEXTURE_NOFADING&E.TEXTURE_FADING);continue}++i;const w=x(t),j=z(e,h,w);if(j){if(l[h].pendingUpdates&=~(E.TEXTURE_NOFADING&E.TEXTURE_FADING),m(f.parent)){const e=f.parent.uid;null!=e&&""!==e&&W(f.parent,h)}w?a=Math.max(a,this.tileSize*u):1===s&&1===I&&(t.isOpaque||this._dataToTexture(j)&&j.sourceLayerInfo.data.descriptor.isOpaque)&&(n=!0),++o,null===T&&(T=h)}}const y=a/this.tileSize,b=this._ensureBackgroundTexture(this.tileSize);0!==o&&null!==T?1===o&&!p&&this._useLayerTexture(e,T)||this._composeLayers(e,t,h-1,c,a,y,!n||p,J,p):$(e,i,b,t!==f.FADING)}_ensureBackgroundTexture(e){return null==this._backgroundTexture&&(this._backgroundTexture=this._buildTexture(e,!1),this._backgroundDirty=!0),this._backgroundDirty&&(this._compositor.bind(e),this._passParameters.offset=p,this._passParameters.scale=1,this._passParameters.opacity=1,this.backgroundColor&&(this._passParameters.backgroundColor=this.backgroundColor),this._compositor.drawBackground(this._passParameters,null!=this.backgroundColor),this._compositor.copyFBOToTexture(this._backgroundTexture),this._compositor.unbind(),this._backgroundDirty=!1),this._backgroundTexture}_useLayerTexture(e,t){const r=e.surface.layerViewByIndex(t,_.MAP),s=d(r.layer),o=s?e.surface.baseOpacity:1,i=s?1:e.surface.baseOpacity,a=r.fullOpacity,n=z(e,t,!1);return!!this._dataToTexture(n)&&(e.renderData.setTextureReference(new C(n.sourceLayerInfo.data,f.FADING,l(n.offset[0],n.offset[1],n.scale,n.scale),o,i,a)),!0)}_composeLayers(e,t,r,s,o,i,a,n,c){this._compositor.ensureBuffer(o);const u=e.surface.baseOpacity;let l=!1,m=S.LINEAR_MIPMAP_LINEAR,h=!1,f=0;for(let j=r;j>=0;j--){const t=e.surface.layerViewByIndex(j,_.MAP),r=t.layer,T=x(t),y=z(e,j,T),w=r.opacity,A=!L(e,t);if(!y||(0===w||A)&&!c)continue;const O=!d(r)&&!l;O&&(l=!0);let C=!1;n.forEach((e=>{e.start===j&&(e.output=s?M.Composite:a&&O?this.backgroundIsGrid?M.GridComposite:M.ColorComposite:M.Composite,e.baseOpacity=O?u:1,K.push(e),this._compositor.openGroup(o),C=!0)}));const P=0===f,k=C?M.GroupBackgroundComposite:a&&P?this.backgroundIsGrid?M.GridComposite:M.ColorComposite:M.Composite,D=R[g(t)?t.layer.blendMode:"normal"];for(this._passParameters.baseOpacity=O&&!C&&u<1?u:1,this._passParameters.opacity=w,b(y)?h=this._compositor.drawVectorData(this._passParameters,k,o,D,y,i,this.tileSize,h):I(y)?(this._compositor.drawRasterData(this._passParameters,k,o,D,y),V(y)&&(m=S.NEAREST)):this._dataToTexture(y)&&(this._passParameters.texture=y.sourceLayerInfo.data.texture,this._passParameters.offset=y.offset,this._passParameters.scale=y.scale,this._compositor.drawImageData(this._passParameters,k,o,D));K.length>0&&K[K.length-1].end===j;){const e=K.pop();this._passParameters.baseOpacity=e.baseOpacity,this._passParameters.opacity=e.opacity,this._passParameters.offset=p,this._passParameters.scale=1,this._compositor.drawGroup(this._passParameters,e.output,o,R[e.blendMode])}f++}const T=e.renderData,y=c||l&&u<1,w=T.ensureTexture(o,y,t,(()=>this._buildTexture(o,y,m)));this._compositor.copyFBOToTexture(w),this._compositor.unbind(),T.setTextureReference(new C(w,t,Y,l?1:u,0,1))}_dataToTexture(e){if(w(e)){const t=e.sourceLayerInfo;t.data=this._buildTexture(t.data,!0),e.tile.setMemoryDirty()}return j(e)}setBackground(e){this._backgroundColor!==e&&(this._backgroundColor=e,this._backgroundDirty=!0)}_buildTexture(e,t,r=S.LINEAR_MIPMAP_LINEAR){if(null==e)return null;const s=new F;s.wrapMode=U.CLAMP_TO_EDGE,s.samplingMode=r,s.maxAnisotropy=this._maxAnisotropy,s.preMultiplyAlpha=!0,s.flipped=!0,s.hasMipmap=!0,t||(s.pixelFormat=G.RGB);const o=this.rctx;let i;if("number"==typeof e)s.width=s.height=e,i=this._buildTileTexture(s,e);else if(y(e))s.isOpaque=e.isOpaque,s.isOpaque&&(s.pixelFormat=G.RGB),i=this._buildTileTexture(s,e.element.width,e.element);else try{s.width=e.width,s.height=e.height,i=this._buildTileTexture(s,e.width,e)}catch(n){i=new D(N(o)),console.warn("TileRenderer: failed to execute 'texImage2D', cross-origin image may not be loaded.")}const a=o.bindTexture(i.texture,v.TEXTURE_UNIT_FOR_UPDATES);return i.generateMipmap(),o.bindTexture(a,v.TEXTURE_UNIT_FOR_UPDATES),i}_buildTileTexture(e,t,r){const s=`${t} ${e.pixelFormat}`,a=this.cache.pop(s),n=B(r);if(a)return a.retain(),n&&a.texture.enableCompression(!0),a.texture.setData(r),a;e.shouldCompress=n;const c=new v(this.rctx,e);return c.setData(r)&&(this.texturesBeingCompressed++,this.addHandles([o((()=>c.isCompressing),(e=>{e?this.texturesBeingCompressed++:this.texturesBeingCompressed--}),i)])),new D(c,this.cache)}get test(){}};function z(e,t,r){Q.layerIndex=t,Q.vtlNeighborInfos.clear();const s=e.layerInfo[_.MAP][t];if(c(Q.offset,0,0),Q.tile=e,Q.scale=1,Q.sourceLod=e.lij,Q.sourceLayerInfo=s,Q.isVTLBackground=r,s.data)return r&&e.forEachLoadedNeighbor(((r,o)=>{if(r.level!==e.level)return;const i=r.layerInfo[_.MAP][t];if(!A(i)||s.data===i.data)return;const a=Q.vtlNeighborInfos.pushNew();a.offset=Z[o],a.sourceLod=r.lij,a.sourceLayerInfo=i})),Q;const o=s.upsampleInfo,i=o?.tile?.layerInfo[_.MAP][t];return i?(Q.tile=o.tile,u(Q.offset,o.offset),Q.scale=o.scale,Q.sourceLod=o.tile.lij,Q.sourceLayerInfo=i,Q):r?Q:null}function V(e){const t=e.sourceLayerInfo.data;return!!t.source&&"nearest"===t.interpolation}function X(e){let t="normal"!==e.blendMode;return m(e.parent)&&(t=X(e.parent)||t),t}function W(e,t){m(e.parent)&&W(e.parent,t);const r=e.uid;if(null!=r&&""!==r){const s=J.get(r);s?s.start=t:J.set(r,new H(t,t,e.blendMode,e.opacity,M.Composite,1))}}function $(e,t,r,s){const o=e.renderData,i=!s&&null!=o.textureReference&&(e.surface.view.layerViewManager.updating||t>0)?O.Delayed:O.Immediate;o.setTextureReference(new C(r,f.FADING,Y,e.surface.baseOpacity,0,1),i)}e([a({constructOnly:!0})],q.prototype,"rctx",void 0),e([a({constructOnly:!0})],q.prototype,"techniques",void 0),e([a({constructOnly:!0})],q.prototype,"cache",void 0),e([a()],q.prototype,"tileSize",void 0),e([a()],q.prototype,"texturesBeingCompressed",void 0),q=e([n("esri.views.3d.terrain.TileRenderer")],q);const J=new Map,K=new Array,Q=new k,Y=l(0,0,1,1),Z=new Array;Z[T.NORTH]=[0,-1],Z[T.NORTH_EAST]=[-1,-1],Z[T.EAST]=[-1,0],Z[T.SOUTH_EAST]=[-1,1],Z[T.SOUTH]=[0,1],Z[T.SOUTH_WEST]=[1,1],Z[T.WEST]=[1,0],Z[T.NORTH_WEST]=[1,-1];export{H as GroupInfo,q as TileRenderer};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import"../../../core/has.js";import{disposeMaybe as r,releaseMaybe as s}from"../../../core/maybe.js";import{watch as o,sync as i}from"../../../core/reactiveUtils.js";import{property as a}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as n}from"../../../core/accessorSupport/decorators/subclass.js";import{set as c,copy as u}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{ZEROS as p}from"../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{fromValues as l}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isBaseLayer as d,isGroupLayer as m}from"../../../layers/support/layerUtils.js";import{BlendLayersPassParameters as h}from"./BlendLayersTechnique.js";import{TextureUpdate as f}from"./interfaces.js";import{LayerClass as _}from"./LayerClass.js";import{NeighborIndex as T}from"./NeighborIndex.js";import{isImageWithType as y}from"./TerrainData.js";import{isBlendableLayerView as g,isVectorTileLayerView as x,isVectorTileRenderInfo as b,isImageryTileRenderInfo as I,isImageSourceRenderInfo as w,isTextureTileRenderInfo as j,isVectorTilePerLayerInfo as A}from"./terrainUtils.js";import{ActivationTime as O}from"./TextureFader.js";import{TextureReference as C}from"./TextureReference.js";import{TileCompositor as P}from"./TileCompositor.js";import{TileRenderInfo as k}from"./TileRenderInfo.js";import D from"./TileTexture.js";import{TileUpdate as E}from"./TileUpdate.js";import{fallsWithinLayerView as L}from"./tileUtils.js";import{blendModeFromString as R}from"../webgl-engine/core/shaderLibrary/output/BlendOptions.js";import{BlendLayersOutput as M}from"../webgl-engine/core/shaderLibrary/terrain/BlendLayersOutput.js";import{createEmptyTexture as N}from"../webgl-engine/lib/glUtil3D.js";import{isCompressionCandidate as B}from"../../support/TextureCompressionHelper.js";import{TextureSamplingMode as S,TextureWrapMode as U,PixelFormat as G}from"../../webgl/enums.js";import{Texture as v}from"../../webgl/Texture.js";import{TextureDescriptor as F}from"../../webgl/TextureDescriptor.js";class H{constructor(e,t,r,s,o,i){this.start=e,this.end=t,this.blendMode=r,this.opacity=s,this.output=o,this.baseOpacity=i}}let q=class extends t{constructor(e){super(e),this._passParameters=new h,this._backgroundTexture=null,this._backgroundColor=null,this._backgroundDirty=!1}initialize(){this._maxAnisotropy=this.rctx.parameters.maxMaxAnisotropy,this._compositor=new P(this.rctx,this.techniques),this._ensureBackgroundTexture(this.tileSize),this.texturesBeingCompressed=0}dispose(){this._compositor=r(this._compositor),this._backgroundTexture=s(this._backgroundTexture)}get backgroundIsGrid(){return null==this._backgroundColor}get backgroundColor(){return this._backgroundColor}updateHeading(e){this._compositor?.updateHeading(e)}updateTileTexture(e,t){if(!e.renderData)return;const r=e.surface,s=r.baseOpacity;let o=0,i=0,a=this.tileSize,n=!1,c=!1;const u=r.view.state.contentPixelRatio;let p=!1;J.clear(),K.length=0;const l=e.layerInfo[_.MAP];let h=0,T=null;for(;h<l.length;h++){const t=r.layerViewByIndex(h,_.MAP),f=t.layer,y=!L(e,t),b=f.opacity,I=t.fullOpacity;if(c=c||d(f),g(t)){let e="normal"!==t.layer.blendMode;if(m(f.parent)){const t=f.parent.uid;null!=t&&""!==t&&(e=X(f.parent)||e)}e&&(p=e,n=!1)}if((y||0===b)&&!p){l[h].pendingUpdates&=~(E.TEXTURE_NOFADING&E.TEXTURE_FADING);continue}++i;const w=x(t),j=z(e,h,w);if(j){if(l[h].pendingUpdates&=~(E.TEXTURE_NOFADING&E.TEXTURE_FADING),m(f.parent)){const e=f.parent.uid;null!=e&&""!==e&&W(f.parent,h)}w?a=Math.max(a,this.tileSize*u):1===s&&1===I&&(t.isOpaque||this._dataToTexture(j)&&j.sourceLayerInfo.data.descriptor.isOpaque)&&(n=!0),++o,null===T&&(T=h)}}const y=a/this.tileSize,b=this._ensureBackgroundTexture(this.tileSize);0!==o&&null!==T?1===o&&!p&&this._useLayerTexture(e,T)||this._composeLayers(e,t,h-1,c,a,y,!n||p,J,p):$(e,i,b,t!==f.FADING)}_ensureBackgroundTexture(e){return null==this._backgroundTexture&&(this._backgroundTexture=this._buildTexture(e,!1),this._backgroundDirty=!0),this._backgroundDirty&&(this._compositor.bind(e),this._passParameters.offset=p,this._passParameters.scale=1,this._passParameters.opacity=1,this.backgroundColor&&(this._passParameters.backgroundColor=this.backgroundColor),this._compositor.drawBackground(this._passParameters,null!=this.backgroundColor),this._compositor.copyFBOToTexture(this._backgroundTexture),this._compositor.unbind(),this._backgroundDirty=!1),this._backgroundTexture}_useLayerTexture(e,t){const r=e.surface.layerViewByIndex(t,_.MAP),s=d(r.layer),o=s?e.surface.baseOpacity:1,i=s?1:e.surface.baseOpacity,a=r.fullOpacity,n=z(e,t,!1);return!!this._dataToTexture(n)&&(e.renderData.setTextureReference(new C(n.sourceLayerInfo.data,f.FADING,l(n.offset[0],n.offset[1],n.scale,n.scale),o,i,a)),!0)}_composeLayers(e,t,r,s,o,i,a,n,c){this._compositor.ensureBuffer(o);const u=e.surface.baseOpacity;let l=!1,m=S.LINEAR_MIPMAP_LINEAR,h=!1,f=0;for(let j=r;j>=0;j--){const t=e.surface.layerViewByIndex(j,_.MAP),r=t.layer,T=x(t),y=z(e,j,T),w=r.opacity,A=!L(e,t);if(!y||(0===w||A)&&!c)continue;const O=!d(r)&&!l;O&&(l=!0);let C=!1;n.forEach((e=>{e.start===j&&(e.output=s?M.Composite:a&&O?this.backgroundIsGrid?M.GridComposite:M.ColorComposite:M.Composite,e.baseOpacity=O?u:1,K.push(e),this._compositor.openGroup(o),C=!0)}));const P=0===f,k=C?M.GroupBackgroundComposite:a&&P?this.backgroundIsGrid?M.GridComposite:M.ColorComposite:M.Composite,D=R[g(t)?t.layer.blendMode:"normal"];for(this._passParameters.baseOpacity=O&&!C&&u<1?u:1,this._passParameters.opacity=w,b(y)?h=this._compositor.drawVectorData(this._passParameters,k,o,D,y,i,this.tileSize,h):I(y)?(this._compositor.drawRasterData(this._passParameters,k,o,D,y),V(y)&&(m=S.NEAREST)):this._dataToTexture(y)&&(this._passParameters.texture=y.sourceLayerInfo.data.texture,this._passParameters.offset=y.offset,this._passParameters.scale=y.scale,this._compositor.drawImageData(this._passParameters,k,o,D));K.length>0&&K[K.length-1].end===j;){const e=K.pop();this._passParameters.baseOpacity=e.baseOpacity,this._passParameters.opacity=e.opacity,this._passParameters.offset=p,this._passParameters.scale=1,this._compositor.drawGroup(this._passParameters,e.output,o,R[e.blendMode])}f++}const T=e.renderData,y=c||l&&u<1,w=T.ensureTexture(o,y,t,(()=>this._buildTexture(o,y,m)));this._compositor.copyFBOToTexture(w),this._compositor.unbind(),T.setTextureReference(new C(w,t,Y,l?1:u,0,1))}_dataToTexture(e){if(w(e)){const t=e.sourceLayerInfo;t.data=this._buildTexture(t.data,!0),e.tile.setMemoryDirty()}return j(e)}setBackground(e){this._backgroundColor!==e&&(this._backgroundColor=e,this._backgroundDirty=!0)}_buildTexture(e,t,r=S.LINEAR_MIPMAP_LINEAR){if(null==e)return null;const s=new F;s.wrapMode=U.CLAMP_TO_EDGE,s.samplingMode=r,s.maxAnisotropy=this._maxAnisotropy,s.preMultiplyAlpha=!0,s.flipped=!0,s.hasMipmap=!0,t||(s.pixelFormat=G.RGB);const o=this.rctx;let i;if("number"==typeof e)s.width=s.height=e,i=this._buildTileTexture(s,e);else if(y(e))s.isOpaque=e.isOpaque,s.isOpaque&&(s.pixelFormat=G.RGB),i=this._buildTileTexture(s,e.element.width,e.element);else try{s.width=e.width,s.height=e.height,i=this._buildTileTexture(s,e.width,e)}catch(n){i=new D(N(o)),console.warn("TileRenderer: failed to execute 'texImage2D', cross-origin image may not be loaded.")}const a=o.bindTexture(i.texture,v.TEXTURE_UNIT_FOR_UPDATES);return i.generateMipmap(),o.bindTexture(a,v.TEXTURE_UNIT_FOR_UPDATES),i}_buildTileTexture(e,t,r){const s=`${t} ${e.pixelFormat}`,a=this.cache.pop(s)??this.cache.pop(s+"compressed"),n=B(r);if(a)return a.retain(),n&&a.texture.enableCompression(!0),a.texture.setData(r),a;e.shouldCompress=n;const c=new v(this.rctx,e);return c.setData(r)&&(this.texturesBeingCompressed++,this.addHandles([o((()=>c.isCompressing),(e=>{e?this.texturesBeingCompressed++:this.texturesBeingCompressed--}),i)])),new D(c,this.cache)}get test(){}};function z(e,t,r){Q.layerIndex=t,Q.vtlNeighborInfos.clear();const s=e.layerInfo[_.MAP][t];if(c(Q.offset,0,0),Q.tile=e,Q.scale=1,Q.sourceLod=e.lij,Q.sourceLayerInfo=s,Q.isVTLBackground=r,s.data)return r&&e.forEachLoadedNeighbor(((r,o)=>{if(r.level!==e.level)return;const i=r.layerInfo[_.MAP][t];if(!A(i)||s.data===i.data)return;const a=Q.vtlNeighborInfos.pushNew();a.offset=Z[o],a.sourceLod=r.lij,a.sourceLayerInfo=i})),Q;const o=s.upsampleInfo,i=o?.tile?.layerInfo[_.MAP][t];return i&&o.tile?(Q.tile=o.tile,u(Q.offset,o.offset),Q.scale=o.scale,Q.sourceLod=o.tile.lij,Q.sourceLayerInfo=i,Q):r?Q:null}function V(e){const t=e.sourceLayerInfo.data;return!!t.source&&"nearest"===t.interpolation}function X(e){let t="normal"!==e.blendMode;return m(e.parent)&&(t=X(e.parent)||t),t}function W(e,t){m(e.parent)&&W(e.parent,t);const r=e.uid;if(null!=r&&""!==r){const s=J.get(r);s?s.start=t:J.set(r,new H(t,t,e.blendMode,e.opacity,M.Composite,1))}}function $(e,t,r,s){const o=e.renderData,i=!s&&null!=o.textureReference&&(e.surface.view.layerViewManager.updating||t>0)?O.Delayed:O.Immediate;o.setTextureReference(new C(r,f.FADING,Y,e.surface.baseOpacity,0,1),i)}e([a({constructOnly:!0})],q.prototype,"rctx",void 0),e([a({constructOnly:!0})],q.prototype,"techniques",void 0),e([a({constructOnly:!0})],q.prototype,"cache",void 0),e([a()],q.prototype,"tileSize",void 0),e([a()],q.prototype,"texturesBeingCompressed",void 0),q=e([n("esri.views.3d.terrain.TileRenderer")],q);const J=new Map,K=new Array,Q=new k,Y=l(0,0,1,1),Z=new Array;Z[T.NORTH]=[0,-1],Z[T.NORTH_EAST]=[-1,-1],Z[T.EAST]=[-1,0],Z[T.SOUTH_EAST]=[-1,1],Z[T.SOUTH]=[0,1],Z[T.SOUTH_WEST]=[1,1],Z[T.WEST]=[1,0],Z[T.NORTH_WEST]=[1,-1];export{H as GroupInfo,q as TileRenderer};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- class t{constructor(t,e){this._texture=t,this._cache=e,this.type="tile-texture",this._refCount=1}retain(){++this._refCount}release(){if(--this._refCount,0===this._refCount)if(this._cache&&!this._texture.isCompressing){const t=`${this._texture.descriptor.width} ${this._texture.descriptor.pixelFormat}`;this._cache.put(t,this)}else this.dispose()}dispose(){this._texture.dispose()}get texture(){return this._texture}generateMipmap(){this._texture.generateMipmap()}get descriptor(){return this._texture.descriptor}get cachedMemory(){return this._texture.usedMemory}}export{t as default};
5
+ import{isCompressedTexture as e}from"../../webgl/textureUtils.js";class t{constructor(e,t){this._texture=e,this._cache=t,this.type="tile-texture",this._refCount=1}retain(){++this._refCount}release(){--this._refCount,0===this._refCount&&(this._cache?(this._texture.isCompressing&&this._texture.abortCompression(),this._cache.put(this._generateCacheKey(),this)):this.dispose())}dispose(){this._texture.dispose()}get texture(){return this._texture}generateMipmap(){this._texture.generateMipmap()}_generateCacheKey(){return`${this._texture.descriptor.width} ${this._texture.descriptor.pixelFormat}`+(e(this._texture)?"compressed":"")}get descriptor(){return this._texture.descriptor}get cachedMemory(){return this._texture.usedMemory}}export{t as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import"../../../core/Error.js";import"../../../chunks/vec32.js";import"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import"../../../geometry/support/aaBoundingRect.js";import"../support/supportedSpatialReference.js";import"./TerrainConst.js";import"./TilingScheme.js";export{c as checkIfTileInfoSupportedForViewSR,i as isInsideExtent,a as tiltToExtentEdge}from"../../../chunks/terrainUtilsPlanar.js";
5
+ import"../../../core/Error.js";import"../../../geometry/support/aaBoundingRect.js";import"../support/supportedSpatialReference.js";import"./TerrainConst.js";import"./TilingScheme.js";export{c as checkIfTileInfoSupportedForViewSR}from"../../../chunks/terrainUtilsPlanar.js";
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import"../../../core/Error.js";import"../support/supportedSpatialReference.js";import"./TilingScheme.js";export{c as checkIfTileInfoSupportedForViewSR,i as isInsideExtent,a as tiltToExtentEdge}from"../../../chunks/terrainUtilsSpherical.js";
5
+ import"../../../core/Error.js";import"../support/supportedSpatialReference.js";import"./TilingScheme.js";export{c as checkIfTileInfoSupportedForViewSR}from"../../../chunks/terrainUtilsSpherical.js";
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{clamp as t}from"../../../../../core/mathUtils.js";import{create as e}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as i}from"../../../../../geometry/support/aaBoundingBox.js";import{intersectRayTriangles as n,MeshIntersectionOptions as r}from"../../lib/RayIntersections.js";const s=200,o=40,a=.8,c=10,h=1e-6;function l(t,e,i){const n=e,r=i;let s=0,o=1/0;for(let a=0;a<3;++a){{const e=t[a];if(n[a]<e){if(r[a]<=h)return!1;const t=(e-n[a])/r[a];s=Math.max(s,t)}else if(r[a]<=-h){const t=(e-n[a])/r[a];o=Math.min(o,t)}if(s>o)return!1}{const e=t[a+3];if(n[a]>e){if(r[a]>=-h)return!1;const t=(e-n[a])/r[a];s=Math.max(s,t)}else if(r[a]>=h){const t=(e-n[a])/r[a];o=Math.min(o,t)}if(s>o)return!1}}return!0}class d{constructor(t,e,i,n,r){this.aabb=t,this.axis=e,this.d=i,this.midStartIndex=n,this.rightStartIndex=r}}class f{constructor(i,n,r,s){this.globalTriangleVertexIndices=i,this.firstTriangleIndex=n,this.positions=s,this._rayDirection=e(),this._callback=R,this._intersectionOptions=I,this.bspNodeTree=new Array;const h=r-n,l=new(h<N?Uint8Array:h<b?Uint16Array:Uint32Array)(h);this.triangleIndexMap=l;for(let t=0;t<h;++t)l[t]=t;{const e=p(i,n,r,s.data,s.stride),f=t(Math.log2(h/o),2,c),m=(t,i,n)=>{const r=x(l,e,t,i),s=i-t;if(s<=o){const e=new d(r,void 0,0,t,i);return this.bspNodeTree.push(e),e}const{axis:c,midValue:h}=y(r),u=g(l,e,t,i,c,h),p=(t,e)=>{if(n>f)return;const i=e-t;return i<o||i>=a*s?void 0:m(t,e,n+1)},N=new d(r,c,h,u.next,u.mid);return this.bspNodeTree.push(N),N.leftNode=p(t,u.next),N.rightNode=p(u.mid,i),N};m(0,h,0)}}intersectRayTriangleRange(t,e){if(t>=e)return;const i=this.positions;n(this._rayFrom,this._rayDirection,t,e,this.globalTriangleVertexIndices,i.data,i.stride,this._intersectionOptions.normalRequired,this._callback,this.triangleIndexMap,this.firstTriangleIndex),f.numFacesTested+=e-t}intersectRay(t,e,i,n){f.numFacesTested=0;const r=t,s=e,o=s[0]-r[0],a=s[1]-r[1],c=s[2]-r[2];if(o*o+a*a+c*c<h)return;this._rayFrom=r;const l=this._rayDirection;l[0]=o,l[1]=a,l[2]=c;const d=this.triangleIndexMap.length;this._callback=n,this._intersectionOptions=i,this.intersectRayBSP(this.bspNodeTree[0],0,d),this._callback=R,this._intersectionOptions=I}intersectRayBSP(t,e,i){const n=this._rayFrom,r=this._rayDirection;if(!l(t.aabb,n,r))return;const s=t.axis,o=t.d;if(n[s]<o||r[s]<0){const i=e,n=t.midStartIndex;if(i<n){const e=t.leftNode;void 0!==e?this.intersectRayBSP(e,i,n):this.intersectRayTriangleRange(i,n)}}if(this.intersectRayTriangleRange(t.midStartIndex,t.rightStartIndex),n[s]>o||r[s]>0){const e=t.rightStartIndex,n=i;if(e<n){const i=t.rightNode;void 0!==i?this.intersectRayBSP(i,e,n):this.intersectRayTriangleRange(e,n)}}}get estimatedMemoryUsage(){return this.triangleIndexMap.byteLength}}f.numFacesTested=0;const m=[1/0,1/0,1/0],u=[-1/0,-1/0,-1/0];function g(t,e,i,n,r,s){let o=i,a=n;for(;o<a;){const i=t[o];e[6*i+r+3]<=s?++o:(--a,t[o]=t[a],t[a]=i)}let c=o;for(a=n;c<a;){const i=t[a-1];e[6*i+r]>=s?--a:(t[a-1]=t[c],t[c]=i,++c)}return{next:o,mid:c}}function x(t,e,n,r){if(r<=n)return i(NaN,NaN,NaN,NaN,NaN,NaN);{const i=6*t[n];for(let t=0;t<3;++t)m[t]=e[i+0+t],u[t]=e[i+3+t]}for(let i=n+1;i<r;++i){const n=6*t[i];for(let t=0;t<3;++t)m[t]=Math.min(m[t],e[n+0+t]),u[t]=Math.max(u[t],e[n+3+t])}return i(m[0],m[1],m[2],u[0],u[1],u[2])}function y(t){const e=t[3]-t[0],i=t[4]-t[1],n=t[5]-t[2],r=e>i?e>n?0:i>n?1:2:i>n?1:n>e?2:0;return{axis:r,midValue:(t[r]+t[r+3])/2}}function p(t,e,i,n,r){const s=i-e,o=new Float32Array(6*s);for(let a=0;a<s;++a){const i=3*(a+e),s=t[i]*r,c=t[i+1]*r,h=t[i+2]*r;for(let t=0;t<3;++t){const e=n[s+t],i=n[c+t],r=n[h+t];o[6*a+t]=Math.min(e,i,r),o[6*a+3+t]=Math.max(e,i,r)}}return o}const N=255,b=65535,I=new r,R=()=>{};export{f as ComponentIntersectionData,s as componentMinimalSizeForIntersectionData};
5
+ import{clamp as t}from"../../../../../core/mathUtils.js";import{create as e}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as i}from"../../../../../geometry/support/aaBoundingBox.js";import{intersectRayTriangles as n,MeshIntersectionOptions as r}from"../../lib/RayIntersections.js";const s=200,o=40,a=.8,c=10,h=1e-6;function l(t,e,i){const n=e,r=i;let s=0,o=1/0;for(let a=0;a<3;++a){{const e=t[a];if(n[a]<e){if(r[a]<=h)return!1;const t=(e-n[a])/r[a];s=Math.max(s,t)}else if(r[a]<=-1e-6){const t=(e-n[a])/r[a];o=Math.min(o,t)}if(s>o)return!1}{const e=t[a+3];if(n[a]>e){if(r[a]>=-1e-6)return!1;const t=(e-n[a])/r[a];s=Math.max(s,t)}else if(r[a]>=h){const t=(e-n[a])/r[a];o=Math.min(o,t)}if(s>o)return!1}}return!0}class d{constructor(t,e,i,n,r){this.aabb=t,this.axis=e,this.d=i,this.midStartIndex=n,this.rightStartIndex=r}}class f{constructor(i,n,r,s){this.globalTriangleVertexIndices=i,this.firstTriangleIndex=n,this.positions=s,this._rayDirection=e(),this._callback=R,this._intersectionOptions=I,this.bspNodeTree=new Array;const h=r-n,l=new(h<N?Uint8Array:h<b?Uint16Array:Uint32Array)(h);this.triangleIndexMap=l;for(let t=0;t<h;++t)l[t]=t;{const e=p(i,n,r,s.data,s.stride),f=t(Math.log2(h/o),2,c),m=(t,i,n)=>{const r=x(l,e,t,i),s=i-t;if(s<=o){const e=new d(r,void 0,0,t,i);return this.bspNodeTree.push(e),e}const{axis:c,midValue:h}=y(r),u=g(l,e,t,i,c,h),p=(t,e)=>{if(n>f)return;const i=e-t;return i<o||i>=a*s?void 0:m(t,e,n+1)},N=new d(r,c,h,u.next,u.mid);return this.bspNodeTree.push(N),N.leftNode=p(t,u.next),N.rightNode=p(u.mid,i),N};m(0,h,0)}}intersectRayTriangleRange(t,e){if(t>=e)return;const i=this.positions;n(this._rayFrom,this._rayDirection,t,e,this.globalTriangleVertexIndices,i.data,i.stride,this._intersectionOptions.normalRequired,this._callback,this.triangleIndexMap,this.firstTriangleIndex),f.numFacesTested+=e-t}intersectRay(t,e,i,n){f.numFacesTested=0;const r=t,s=e,o=s[0]-r[0],a=s[1]-r[1],c=s[2]-r[2];if(o*o+a*a+c*c<h)return;this._rayFrom=r;const l=this._rayDirection;l[0]=o,l[1]=a,l[2]=c;const d=this.triangleIndexMap.length;this._callback=n,this._intersectionOptions=i,this.intersectRayBSP(this.bspNodeTree[0],0,d),this._callback=R,this._intersectionOptions=I}intersectRayBSP(t,e,i){const n=this._rayFrom,r=this._rayDirection;if(!l(t.aabb,n,r))return;const s=t.axis,o=t.d;if(n[s]<o||r[s]<0){const i=e,n=t.midStartIndex;if(i<n){const e=t.leftNode;void 0!==e?this.intersectRayBSP(e,i,n):this.intersectRayTriangleRange(i,n)}}if(this.intersectRayTriangleRange(t.midStartIndex,t.rightStartIndex),n[s]>o||r[s]>0){const e=t.rightStartIndex,n=i;if(e<n){const i=t.rightNode;void 0!==i?this.intersectRayBSP(i,e,n):this.intersectRayTriangleRange(e,n)}}}get estimatedMemoryUsage(){return this.triangleIndexMap.byteLength}}f.numFacesTested=0;const m=[1/0,1/0,1/0],u=[-1/0,-1/0,-1/0];function g(t,e,i,n,r,s){let o=i,a=n;for(;o<a;){const i=t[o];e[6*i+r+3]<=s?++o:(--a,t[o]=t[a],t[a]=i)}let c=o;for(a=n;c<a;){const i=t[a-1];e[6*i+r]>=s?--a:(t[a-1]=t[c],t[c]=i,++c)}return{next:o,mid:c}}function x(t,e,n,r){if(r<=n)return i(NaN,NaN,NaN,NaN,NaN,NaN);{const i=6*t[n];for(let t=0;t<3;++t)m[t]=e[i+0+t],u[t]=e[i+3+t]}for(let i=n+1;i<r;++i){const n=6*t[i];for(let t=0;t<3;++t)m[t]=Math.min(m[t],e[n+0+t]),u[t]=Math.max(u[t],e[n+3+t])}return i(m[0],m[1],m[2],u[0],u[1],u[2])}function y(t){const e=t[3]-t[0],i=t[4]-t[1],n=t[5]-t[2],r=e>i?e>n?0:i>n?1:2:i>n?1:n>e?2:0;return{axis:r,midValue:(t[r]+t[r+3])/2}}function p(t,e,i,n,r){const s=i-e,o=new Float32Array(6*s);for(let a=0;a<s;++a){const i=3*(a+e),s=t[i]*r,c=t[i+1]*r,h=t[i+2]*r;for(let t=0;t<3;++t){const e=n[s+t],i=n[c+t],r=n[h+t];o[6*a+t]=Math.min(e,i,r),o[6*a+3+t]=Math.max(e,i,r)}}return o}const N=255,b=65535,I=new r,R=()=>{};export{f as ComponentIntersectionData,s as componentMinimalSizeForIntersectionData};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{newLayout as e}from"../../../support/buffer/InterleavedLayout.js";import{TextureCoordinateType as r}from"../../core/shaderLibrary/attributes/TextureCoordinateAttribute.glsl.js";import{NoParameters as t}from"../../core/shaderModules/interfaces.js";import{VertexAttribute as o}from"../../lib/VertexAttribute.js";class s extends t{constructor(e,r,t,o,s){super(),this.colors=e,this.textureCoordinates=r,this.hasNormals=t,this.shadeNormals=o,this.applySSAO=s}}function a(t){const s=e().vec3f(o.POSITION);return t.hasNormals&&s.vec2i16(o.NORMALCOMPRESSED,{glNormalized:!0}),t.textureCoordinates===r.Default?s.vec2f(o.UV0):t.textureCoordinates===r.Atlas&&(s.vec2f(o.UV0),s.vec4u16(o.UVREGION,{glNormalized:!0})),t.colors&&s.vec4u8(o.COLOR,{glNormalized:!0}),s}export{s as GeometryParameters,a as createVertexBufferLayout};
5
+ import{newLayout as r}from"../../../support/buffer/InterleavedLayout.js";import{TextureCoordinateType as e}from"../../core/shaderLibrary/attributes/TextureCoordinateAttribute.glsl.js";import{NoParameters as t}from"../../core/shaderModules/interfaces.js";import{VertexAttribute as o}from"../../lib/VertexAttribute.js";class s extends t{constructor(r,e,t,o,s){super(),this.colors=r,this.textureCoordinates=e,this.hasNormals=t,this.shadeNormals=o,this.applySSAO=s}}function a({hasNormals:t,textureCoordinates:s,colors:a}){const i=r().vec3f(o.POSITION);return t&&i.vec2i16(o.NORMALCOMPRESSED,{glNormalized:!0}),s===e.Default?i.vec2f(o.UV0):s===e.Atlas&&(i.vec2f(o.UV0),i.vec4u16(o.UVREGION,{glNormalized:!0})),a&&i.vec4u8(o.COLOR,{glNormalized:!0}),i}export{s as GeometryParameters,a as createVertexBufferLayout};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/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 o}from"../../../../../core/accessorSupport/decorators/subclass.js";import{RenderCategory as r}from"../../../webgl.js";import s from"../../../webgl/RenderNode.js";import{a as i,B as a}from"../../../../../chunks/BloomComposition.glsl.js";import{BloomCompositionTechniqueConfiguration as l}from"./BloomCompositionTechniqueConfiguration.js";import{BloomCompositionTechnique as m}from"./BloomTechnique.js";import{RenderRequestType as c}from"../../lib/basicInterfaces.js";import{ColorAttachment as u,FramebufferBit as n}from"../../../../webgl/enums.js";let h=class extends s{constructor(e){super(e),this.consumes={required:[r.COMPOSITE,"emissive"]},this.produces=r.COMPOSITE,this._configuration=new l,this._bloomParameters=new i,this._blurScale=3.06,this._bloomResults=new Array}destroy(){}precompile(){this._configuration.bloomStage=a.BlurHorizontal,this.techniques.precompile(m,this._configuration),this._configuration.bloomStage=a.BlurVertical,this.techniques.precompile(m,this._configuration),this._configuration.bloomStage=a.Composite,this.techniques.precompile(m,this._configuration)}render(e){const t=e.find((({name:e})=>e===r.COMPOSITE)),o=t.getAttachment(u.COLOR_ATTACHMENT1)?.attachment;if(!o)return t;this._configuration.bloomStage=a.BlurHorizontal;const s=this.techniques.acquire(m,this._configuration);this._configuration.bloomStage=a.BlurVertical;const i=this.techniques.acquire(m,this._configuration);this._configuration.bloomStage=a.Composite;const l=this.techniques.acquire(m,this._configuration);if(!(s.compiled&&i.compiled&&l.compiled))return s.release(),i.release(),l.release(),this.requestRender(c.UPDATE),t;const h=t.getTexture(),b=this.renderingContext,p=this.fboCache,_=this.bindParameters,{fullWidth:g,fullHeight:f}=this.bindParameters.camera,T=(e,t,o,r,s)=>{b.bindFramebuffer(e.fbo),b.setViewport(0,0,o,r),b.setClearColor(0,0,0,0),b.clear(n.COLOR),b.bindTechnique(t,_,s),b.screen.draw()};let d=g/2,C=f/2;const P=5,R=this._bloomParameters.blurRadius;let x=o;for(let r=0;r<P;r++){const e=p.acquire(d,C,"bloomHorizontal");this._bloomParameters.colorTexture=x,T(e,s,d,C,this._bloomParameters);const t=p.acquire(d,C,"bloomVertical");this._bloomParameters.colorTexture=e.getTexture(),T(t,i,d,C,this._bloomParameters),e.release(),this._bloomResults[r]=t,d=Math.ceil(d/2),C=Math.ceil(C/2),x=this._bloomResults[r].getTexture(),this._bloomParameters.blurRadius*=this._blurScale}s.release(),i.release();const q=this.acquireOutputFramebuffer();this._bloomParameters.colorTexture=h;for(let r=0;r<P;r++)this._bloomParameters.bloomTexture0=this._bloomResults[0].getTexture(),this._bloomParameters.bloomTexture1=this._bloomResults[1].getTexture(),this._bloomParameters.bloomTexture2=this._bloomResults[2].getTexture(),this._bloomParameters.bloomTexture3=this._bloomResults[3].getTexture(),this._bloomParameters.bloomTexture4=this._bloomResults[4].getTexture();return this._bloomParameters.blurRadius=R,T(q,l,g,f,this._bloomParameters),this._bloomResults.forEach((e=>e.release())),l.release(),q.attachDepth(t.getAttachment(this.gl.DEPTH_STENCIL_ATTACHMENT)),q.attachColor(t.getAttachment(u.COLOR_ATTACHMENT1),u.COLOR_ATTACHMENT1),q}};e([t()],h.prototype,"consumes",void 0),e([t()],h.prototype,"produces",void 0),e([t({constructOnly:!0})],h.prototype,"techniques",void 0),h=e([o("esri.views.3d.webgl-engine.effects.bloom.BloomRenderNode")],h);export{h as BloomRenderNode};
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 o}from"../../../../../core/accessorSupport/decorators/subclass.js";import{RenderCategory as r}from"../../../webgl.js";import s from"../../../webgl/RenderNode.js";import{a as i,B as a}from"../../../../../chunks/BloomComposition.glsl.js";import{BloomCompositionTechniqueConfiguration as l}from"./BloomCompositionTechniqueConfiguration.js";import{BloomCompositionTechnique as m}from"./BloomTechnique.js";import{RenderRequestType as u}from"../../lib/basicInterfaces.js";import{ColorAttachment as n,FramebufferBit as c}from"../../../../webgl/enums.js";let h=class extends s{get techniques(){return this.view._stage.renderView.techniques}constructor(e){super(e),this.consumes={required:[r.COMPOSITE,"emissive"]},this.produces=r.COMPOSITE,this._configuration=new l,this._bloomParameters=new i,this._blurScale=3.06,this._bloomResults=new Array}destroy(){}precompile(){this._configuration.bloomStage=a.BlurHorizontal,this.techniques.precompile(m,this._configuration),this._configuration.bloomStage=a.BlurVertical,this.techniques.precompile(m,this._configuration),this._configuration.bloomStage=a.Composite,this.techniques.precompile(m,this._configuration)}render(e){const t=e.find((({name:e})=>e===r.COMPOSITE)),o=t.getAttachment(n.COLOR_ATTACHMENT1)?.attachment;if(!o)return t;this._configuration.bloomStage=a.BlurHorizontal;const s=this.techniques.acquire(m,this._configuration);this._configuration.bloomStage=a.BlurVertical;const i=this.techniques.acquire(m,this._configuration);this._configuration.bloomStage=a.Composite;const l=this.techniques.acquire(m,this._configuration);if(!(s.compiled&&i.compiled&&l.compiled))return s.release(),i.release(),l.release(),this.requestRender(u.UPDATE),t;const h=t.getTexture(),b=this.renderingContext,p=this.fboCache,_=this.bindParameters,{fullWidth:g,fullHeight:f}=this.bindParameters.camera,T=(e,t,o,r,s)=>{b.bindFramebuffer(e.fbo),b.setViewport(0,0,o,r),b.setClearColor(0,0,0,0),b.clear(c.COLOR),b.bindTechnique(t,_,s),b.screen.draw()};let d=Math.round(g/2),C=Math.round(f/2);const P=5,q=this._bloomParameters.blurRadius;let R=o;for(let r=0;r<P;r++){const e=p.acquire(d,C,"bloomHorizontal");this._bloomParameters.colorTexture=R,T(e,s,d,C,this._bloomParameters);const t=p.acquire(d,C,"bloomVertical");this._bloomParameters.colorTexture=e.getTexture(),T(t,i,d,C,this._bloomParameters),e.release(),this._bloomResults[r]=t,d=Math.ceil(d/2),C=Math.ceil(C/2),R=this._bloomResults[r].getTexture(),this._bloomParameters.blurRadius*=this._blurScale}s.release(),i.release();const x=this.acquireOutputFramebuffer();this._bloomParameters.colorTexture=h;for(let r=0;r<P;r++)this._bloomParameters.bloomTexture0=this._bloomResults[0].getTexture(),this._bloomParameters.bloomTexture1=this._bloomResults[1].getTexture(),this._bloomParameters.bloomTexture2=this._bloomResults[2].getTexture(),this._bloomParameters.bloomTexture3=this._bloomResults[3].getTexture(),this._bloomParameters.bloomTexture4=this._bloomResults[4].getTexture();return this._bloomParameters.blurRadius=q,T(x,l,g,f,this._bloomParameters),this._bloomResults.forEach((e=>e.release())),l.release(),x.attachDepth(t.getAttachment(this.gl.DEPTH_STENCIL_ATTACHMENT)),x.attachColor(t.getAttachment(n.COLOR_ATTACHMENT1),n.COLOR_ATTACHMENT1),x}};e([t()],h.prototype,"consumes",void 0),e([t()],h.prototype,"produces",void 0),e([t({readOnly:!0})],h.prototype,"techniques",null),h=e([o("esri.views.3d.webgl-engine.effects.bloom.BloomRenderNode")],h);export{h 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.32/esri/copyright.txt for details.
4
4
  */
5
- import{estimateNumberArrayMemory as t}from"../../../../core/memoryEstimations.js";import{fromValues as e,clone as s}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{pathNumCircleProfileSubdivisions as o}from"../../layers/graphics/Graphics3DPathSymbolLayerConstants.js";class r{constructor(){this.vertices=new Array,this.normals=new Array,this.indices=new Array,this.poles=new Array,this.poleIndices=new Array}addVertex(t,e){return this.vertices.push(s(t)),this.normals.push(s(e)),this.vertices.length-1}addPole(t,e=null){return this.poles.push({position:s(t),normal:e?s(e):null}),this.poles.length-1}addSegment(t,e=null){this.indices.push(t.v0),this.indices.push(t.v1),e&&(this.poleIndices.push(e.v0),this.poleIndices.push(e.v1))}get numSegments(){return this.indices.length/2}translate(t,e){for(const s of this.vertices)s[0]+=t,s[1]+=e;for(const s of this.poles)s.position[0]+=t,s.position[1]+=e}get usedMemory(){return this.vertices.length*t(this.vertices[0])*2+t(this.indices)}}const n={top:[0,-.5],bottom:[0,.5]};function i(t){const s=.5,i=o,d=new r,a={v0:0,v1:0};d.addPole(e(0,0));for(let o=0;o<i;++o){const t=2*o*Math.PI/i,r=Math.cos(t),n=Math.sin(t),a=e(r*s,n*s),c=e(r,n);d.addVertex(a,c)}for(let e=0;e<i-1;++e){const t={v0:e,v1:e+1};d.addSegment(t,a)}const c={v0:i-1,v1:0};if(d.addSegment(c,a),"center"!==t){const e=n[t];d.translate(e[0],e[1])}return d}const d={center:i("center"),top:i("top"),bottom:i("bottom")},a={center:c("center"),top:c("top"),bottom:c("bottom")};function c(t){const s=1,o=1,i=new r,d=e(.5*-s,.5*-o),a=e(.5*s,.5*-o),c=e(.5*s,.5*o),h=e(.5*-s,.5*o),l=e(0,-1),v=e(1,0),m=e(0,1),p=e(-1,0);if(i.addPole(e(0,.5*o),m),i.addPole(e(0,.5*o)),i.addPole(e(0,.5*-o)),i.addPole(e(0,.5*-o),l),i.addVertex(d,l),i.addVertex(a,l),i.addSegment({v0:0,v1:1},{v0:3,v1:3}),i.addVertex(a,v),i.addVertex(c,v),i.addSegment({v0:2,v1:3},{v0:2,v1:1}),i.addVertex(c,m),i.addVertex(h,m),i.addSegment({v0:4,v1:5},{v0:0,v1:0}),i.addVertex(h,p),i.addVertex(d,p),i.addSegment({v0:6,v1:7},{v0:1,v1:2}),"center"!==t){const e=n[t];i.translate(e[0],e[1])}return i}export{r as PathProfile,d as circleProfiles,a as quadProfiles};
5
+ import{estimateNumberArrayMemory as t}from"../../../../core/memoryEstimations.js";import{fromValues as e,clone as s}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{pathNumCircleProfileSubdivisions as o}from"../../layers/graphics/Graphics3DPathSymbolLayerConstants.js";class r{constructor(){this.vertices=new Array,this.normals=new Array,this.indices=new Array,this.poles=new Array,this.poleIndices=new Array}addVertex(t,e){return this.vertices.push(s(t)),this.normals.push(s(e)),this.vertices.length-1}addPole(t,e=null){return this.poles.push({position:s(t),normal:e?s(e):null}),this.poles.length-1}addSegment(t,e=null){this.indices.push(t.v0),this.indices.push(t.v1),e&&(this.poleIndices.push(e.v0),this.poleIndices.push(e.v1))}get numSegments(){return this.indices.length/2}translate(t,e){for(const s of this.vertices)s[0]+=t,s[1]+=e;for(const s of this.poles)s.position[0]+=t,s.position[1]+=e}get usedMemory(){return this.vertices.length*t(this.vertices[0])*2+t(this.indices)}}const n={top:[0,-.5],bottom:[0,.5]};function i(t){const s=.5,i=o,d=new r,a={v0:0,v1:0};d.addPole(e(0,0));for(let o=0;o<i;++o){const t=2*o*Math.PI/i,r=Math.cos(t),n=Math.sin(t),a=e(r*s,n*s),c=e(r,n);d.addVertex(a,c)}for(let e=0;e<i-1;++e){const t={v0:e,v1:e+1};d.addSegment(t,a)}const c={v0:i-1,v1:0};if(d.addSegment(c,a),"center"!==t){const e=n[t];d.translate(e[0],e[1])}return d}const d={center:i("center"),top:i("top"),bottom:i("bottom")},a={center:c("center"),top:c("top"),bottom:c("bottom")};function c(t){const s=1,o=1,i=new r,d=e(-.5,-.5),a=e(.5*s,-.5),c=e(.5*s,.5*o),h=e(-.5,.5*o),l=e(0,-1),v=e(1,0),m=e(0,1),p=e(-1,0);if(i.addPole(e(0,.5*o),m),i.addPole(e(0,.5*o)),i.addPole(e(0,-.5)),i.addPole(e(0,-.5),l),i.addVertex(d,l),i.addVertex(a,l),i.addSegment({v0:0,v1:1},{v0:3,v1:3}),i.addVertex(a,v),i.addVertex(c,v),i.addSegment({v0:2,v1:3},{v0:2,v1:1}),i.addVertex(c,m),i.addVertex(h,m),i.addSegment({v0:4,v1:5},{v0:0,v1:0}),i.addVertex(h,p),i.addVertex(d,p),i.addSegment({v0:6,v1:7},{v0:1,v1:2}),"center"!==t){const e=n[t];i.translate(e[0],e[1])}return i}export{r as PathProfile,d as circleProfiles,a as quadProfiles};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../core/PooledArray.js";import{multiply as t}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{t as n}from"../../../../chunks/vec32.js";import{l as i}from"../../../../chunks/vec42.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{intersectsSphere as a}from"../../../../geometry/support/frustum.js";import{a as o,g as h,c as f}from"../../../../chunks/sphere.js";import{maxScale as c}from"../../support/mathUtils.js";import{DepthRange as l}from"./DepthRange.js";import u from"./Octree.js";import{assert as d}from"./Util.js";var _;!function(e){e[e.SHADOW_CASTERS=0]="SHADOW_CASTERS",e[e.FULL_SCENE=1]="FULL_SCENE"}(_||(_={}));const m=1e4,g=100,p=500,b=500,C=.1;function R(e,t,r,n=_.SHADOW_CASTERS){let i=0;if(!t.some((e=>!!e.material&&(i+=e.numGeometries,i>=m))))return y.compute(e,t,n);const s=new l;return r.forAll((t=>s.union(A(e,t)))),s}function A(e,t){if(!t.visible)return;const r=new l,n=t.getSpatialQueryAccelerator();return n?O(r,e,n):w(r,e,t.objects),r}function O(e,t,r){const{eye:n,viewForward:i,frustum:s}=t,a=e=>e.visible,o=r.objectCount;if(o<p)P.set(t.near,Math.min(e.near,t.far)),r.forEachInDepthRange(n,i,u.DepthOrder.FRONT_TO_BACK,P,((r,n)=>{j(e,t,r),P.far=e.near,n.setRange(P)}),s,a),P.set(Math.max(e.far,t.near),t.far),r.forEachInDepthRange(n,i,u.DepthOrder.BACK_TO_FRONT,P,((r,n)=>{j(e,t,r),P.near=e.far,n.setRange(P)}),s,a);else{const n=Math.max(Math.min(o,b),Math.ceil(o*C)),h=r.findClosest(i,u.DepthOrder.FRONT_TO_BACK,s,a,n),f=r.findClosest(i,u.DepthOrder.BACK_TO_FRONT,s,a,n);h&&f&&(S(e,t,h.boundingVolumeWorldSpace.bounds),S(e,t,f.boundingVolumeWorldSpace.bounds))}}function w(e,t,r){W.clear(),r.forAll((e=>{e.visible&&0!==e.geometries.length&&W.add(e)})),W.empty||(W.sort(t),P.set(t.near,Math.min(e.near,t.far)),W.forEachInDepthRange(P,u.DepthOrder.FRONT_TO_BACK,((r,n)=>{n<e.near&&j(e,t,r)})),P.set(Math.max(e.far,t.near),t.far),W.forEachInDepthRange(P,u.DepthOrder.BACK_TO_FRONT,((t,r,n)=>{e.far=Math.max(e.far,n)})))}function j(e,r,n){if(!n.visible)return;if(!a(r.frustum,n.boundingVolumeWorldSpace.bounds))return;const i=n.transformation,s=N;n.geometries.forEach((n=>{t(s,i,n.transformation);const a=c(s);M(e,r,n.boundingInfo,s,a)}))}function M(e,t,r,i,s){if(null==r)return;n(o(I),r.center,i);const{eye:h,viewForward:f}=t,c=f[0]*(I[0]-h[0])+f[1]*(I[1]-h[1])+f[2]*(I[2]-h[2]);if(I[3]=r.radius*s,!(c-I[3]>e.near&&c+I[3]<e.far)&&a(t.frustum,I))if(r.radius>g&&r.getChildren())for(const n of r.getChildren())M(e,t,n,i,s);else K.unionDepthRangeWithAABB(e,t.viewProjectionMatrix,i,r.bbMin,r.bbMax)}function S(e,t,r){const n=t.eye,i=t.viewForward,s=(r[0]-n[0])*i[0]+(r[1]-n[1])*i[1]+(r[2]-n[2])*i[2];e.near=Math.min(e.near,s-r[3]),e.far=Math.max(e.far,s+r[3])}class v{constructor(){this._items=new e({allocator:e=>e||{object:null,distance:0,near:0,far:0},deallocator:e=>(e.object=null,e.distance=0,e.near=0,e.far=0,e)})}get length(){return this._items.length}get empty(){return 0===this._items.length}clear(){this._items.clear()}add(e){this._items.pushNew().object=e}sort(e){const t=e.eye,r=e.viewForward;this._items.forAll((e=>{const n=e.object.boundingVolumeWorldSpace.bounds,i=(n[0]-t[0])*r[0]+(n[1]-t[1])*r[1]+(n[2]-t[2])*r[2];e.distance=i,e.near=i-n[3],e.far=i+n[3]})),this._items.sort(((e,t)=>e.distance-t.distance))}forEachInDepthRange(e,t,r){if(t===u.DepthOrder.FRONT_TO_BACK)for(let n=0;n<this._items.length;++n){const t=this._items.data[n];t.far<e.near||t.near>e.far||r(t.object,t.near,t.far)}else for(let n=this._items.length-1;n>=0;--n){const t=this._items.data[n];t.far<e.near||t.near>e.far||r(t.object,t.near,t.far)}}}class B{constructor(){this._geometries=new Array,this._near=[],this._far=[],this._nearCandidates=[],this._farCandidates=[],this._looseRange=new l(0,0)}compute(e,t,r){this._reset();const{viewMatrix:n}=e;t.forAll((e=>{e.forEachGeometry((e=>{if(!e.visible||r===_.SHADOW_CASTERS&&!e.castShadow)return;const t=e.boundingSphere,i=n[2]*t[0]+n[6]*t[1]+n[10]*t[2]+n[14],s=i-t[3],a=i+t[3];this._geometries.push(e),this._near.push(-a),this._far.push(-s)}))}));const i=new l;if(0===this._geometries.length)return i;for(let h=0;h<this._geometries.length;++h)this._near[h]>i.far&&(i.far=this._near[h]),this._near[h]>2&&this._far[h]<i.near&&(i.near=this._far[h]);const s=this._looseRange;s.near=Math.max(.5*i.near,2),s.far=2*i.far;let a=0,o=0;for(let h=0;h<this._geometries.length;++h)this._near[h]<i.near&&(this._near[h]>=s.near?i.near=this._near[h]:this._nearCandidates[a++]=h),this._far[h]>i.far&&(this._far[h]<=s.far?i.far=this._far[h]:this._farCandidates[o++]=h);if(0===this._nearCandidates.length&&0===this._farCandidates.length)return i;this._nearCandidates.sort(((e,t)=>this._near[e]<this._near[t]?-1:this._near[e]>this._near[t]?1:0)),this._farCandidates.sort(((e,t)=>this._far[e]<this._far[t]?1:this._far[e]>this._far[t]?-1:0));for(let h=0;h<this._nearCandidates.length;++h){const t=this._nearCandidates[h];if(this._near[t]<i.near){const r=this._geometries[t],{boundingInfo:n,shaderTransformation:s}=r;this._includeNearBoundingInfoRec(e,n,s,i)}}for(let h=0;h<this._farCandidates.length;++h){const t=this._farCandidates[h];if(this._far[t]>i.far){const r=this._geometries[t],{boundingInfo:n,shaderTransformation:s}=r;this._includeFarBoundingInfoRec(e,n,s,i)}}return this._reset(),i}_reset(){this._geometries.length=0,this._near.length=0,this._far.length=0,this._nearCandidates.length=0,this._farCandidates.length=0}_isOutsideSidePlanes(e,t){const r=o(e),n=h(e);return t[0][0]*r[0]+t[0][1]*r[1]+t[0][2]*r[2]+t[0][3]>n||t[1][0]*r[0]+t[1][1]*r[1]+t[1][2]*r[2]+t[1][3]>n||t[2][0]*r[0]+t[2][1]*r[1]+t[2][2]*r[2]+t[2][3]>n||t[3][0]*r[0]+t[3][1]*r[1]+t[3][2]*r[2]+t[3][3]>n}_includeNearBoundingInfoRec(e,t,r,i){if(null==t)return;const s=t.center;n(o(I),s,r),I[3]=t.radius*c(r);const{frustum:a}=e;if(this._isOutsideSidePlanes(I,a))return;const h=I[0],f=I[1],l=I[2],u=I[3],{viewMatrix:d}=e,_=d[2]*h+d[6]*f+d[10]*l+d[14],m=_+u;if(!(-(_-u)<2||-m>=i.near))if(-m>this._looseRange.near)i.near=-m;else{if(u>g){const n=t.getChildren();if(void 0!==n){for(const t of n)this._includeNearBoundingInfoRec(e,t,r,i);return}}K.unionDepthRangeWithAABB(i,e.viewProjectionMatrix,r,t.bbMin,t.bbMax)}}_includeFarBoundingInfoRec(e,t,r,i){if(null==t)return;const s=t.center;n(o(I),s,r),I[3]=t.radius*c(r);const{frustum:a}=e;if(this._isOutsideSidePlanes(I,a))return;const h=I[0],f=I[1],l=I[2],u=I[3],{viewMatrix:d}=e,_=d[2]*h+d[6]*f+d[10]*l+d[14]-u;if(!(-_<=i.far))if(-_<this._looseRange.far)i.far=-_;else{if(u>g){const n=t.getChildren();if(void 0!==n){for(const t of n)this._includeFarBoundingInfoRec(e,t,r,i);return}}K.unionDepthRangeWithAABB(i,e.viewProjectionMatrix,r,t.bbMin,t.bbMax)}}}class D{constructor(){this._modelViewProj=r(),this._clipPosition=[s(),s(),s(),s(),s(),s(),s(),s()]}unionDepthRangeWithAABB(e,r,n,i,s){const a=this._modelViewProj;t(a,r,n);let o=!1;for(let t=0;t<8;++t){const e=this._clipPosition[t],r=0===t||3===t||4===t||7===t?i[0]:s[0],n=0===t||1===t||4===t||5===t?i[1]:s[1],o=t<4?i[2]:s[2];e[0]=a[0]*r+a[4]*n+a[8]*o+a[12],e[1]=a[1]*r+a[5]*n+a[9]*o+a[13],e[2]=a[2]*r+a[6]*n+a[10]*o+a[14],e[3]=a[3]*r+a[7]*n+a[11]*o+a[15]}for(let t=0;t<12;++t){const r=x(this._clipPosition[E[t][0]],this._clipPosition[E[t][1]],this._clipPosition[E[t][2]]);let n=!0;for(let e=0;e<r.length;++e){if(r[e][3]>=2){n=!1;break}}if(!n){o=!0;for(let t=0;t<r.length;++t){const n=r[t][3];Number.isFinite(n)&&(e.near=Math.min(n,e.near),e.far=Math.max(n,e.far))}}}return o}}function x(e,t,r){let n=[e,t,r];for(let i=0;i<4;++i){const e=n;n=[];for(let t=0;t<e.length;++t){const r=e[t],s=e[(t+1)%e.length];T(s,i)?(T(r,i)||n.push(F(r,s,i)),n.push(s)):T(r,i)&&n.push(F(r,s,i))}}return n}function T(e,t){return 0===t?e[0]>=-e[3]:1===t?e[1]>=-e[3]:2===t?e[0]<=e[3]:3===t?e[1]<=e[3]:void d(!1)}function F(e,t,r){let n=0;return 0===r?n=(-e[3]-e[0])/(t[0]-e[0]+t[3]-e[3]):1===r?n=(-e[3]-e[1])/(t[1]-e[1]+t[3]-e[3]):2===r?n=(e[3]-e[0])/(t[0]-e[0]-t[3]+e[3]):3===r&&(n=(e[3]-e[1])/(t[1]-e[1]-t[3]+e[3])),i(s(),e,t,n)}const E=[[0,1,3],[2,3,1],[1,5,2],[6,2,5],[5,4,6],[7,6,4],[4,0,7],[3,7,0],[3,2,7],[6,7,2],[4,5,0],[1,0,5]],I=f(),N=r(),P=new l,W=new v,y=new B,K=new D;export{B as DepthRangeFromRenderGeometries,_ as DepthRangeMode,R as depthRangeFromScene};
5
+ import e from"../../../../core/PooledArray.js";import{multiply as t}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{t as n}from"../../../../chunks/vec32.js";import{l as i}from"../../../../chunks/vec42.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{intersectsSphere as a}from"../../../../geometry/support/frustum.js";import{a as o,g as h,c as f}from"../../../../chunks/sphere.js";import{maxScale as c}from"../../support/mathUtils.js";import{DepthRange as l}from"./DepthRange.js";import u from"./Octree.js";import{assert as d}from"./Util.js";var _;!function(e){e[e.SHADOW_CASTERS=0]="SHADOW_CASTERS",e[e.FULL_SCENE=1]="FULL_SCENE"}(_||(_={}));const m=1e4,g=100,p=500,b=500,C=.1;function R(e,t,r,n=_.SHADOW_CASTERS){let i=0;if(!t.some((e=>!!e.material&&(i+=e.numGeometries,i>=m))))return y.compute(e,t,n);const s=new l;return r.forAll((t=>s.union(A(e,t)))),s}function A(e,t){if(!t.visible)return;const r=new l,n=t.getSpatialQueryAccelerator();return n?O(r,e,n):w(r,e,t.objects),r}function O(e,t,r){const{eye:n,viewForward:i,frustum:s}=t,a=e=>e.visible,o=r.objectCount;if(o<p)P.set(t.near,Math.min(e.near,t.far)),r.forEachInDepthRange(n,i,u.DepthOrder.FRONT_TO_BACK,P,((r,n)=>{j(e,t,r),P.far=e.near,n.setRange(P)}),s,a),P.set(Math.max(e.far,t.near),t.far),r.forEachInDepthRange(n,i,u.DepthOrder.BACK_TO_FRONT,P,((r,n)=>{j(e,t,r),P.near=e.far,n.setRange(P)}),s,a);else{const n=Math.max(Math.min(o,b),Math.ceil(o*C)),h=r.findClosest(i,u.DepthOrder.FRONT_TO_BACK,s,a,n),f=r.findClosest(i,u.DepthOrder.BACK_TO_FRONT,s,a,n);h&&f&&(S(e,t,h.boundingVolumeWorldSpace.bounds),S(e,t,f.boundingVolumeWorldSpace.bounds))}}function w(e,t,r){W.clear(),r.forAll((e=>{e.visible&&0!==e.geometries.length&&W.add(e)})),W.empty||(W.sort(t),P.set(t.near,Math.min(e.near,t.far)),W.forEachInDepthRange(P,u.DepthOrder.FRONT_TO_BACK,((r,n)=>{n<e.near&&j(e,t,r)})),P.set(Math.max(e.far,t.near),t.far),W.forEachInDepthRange(P,u.DepthOrder.BACK_TO_FRONT,((t,r,n)=>{e.far=Math.max(e.far,n)})))}function j(e,r,n){if(!n.visible)return;if(!a(r.frustum,n.boundingVolumeWorldSpace.bounds))return;const i=n.transformation,s=N;n.geometries.forEach((n=>{t(s,i,n.transformation);const a=c(s);M(e,r,n.boundingInfo,s,a)}))}function M(e,t,r,i,s){if(null==r)return;n(o(I),r.center,i);const{eye:h,viewForward:f}=t,c=f[0]*(I[0]-h[0])+f[1]*(I[1]-h[1])+f[2]*(I[2]-h[2]);if(I[3]=r.radius*s,!(c-I[3]>e.near&&c+I[3]<e.far)&&a(t.frustum,I))if(r.radius>g&&r.getChildren())for(const n of r.getChildren())M(e,t,n,i,s);else K.unionDepthRangeWithAABB(e,t.viewProjectionMatrix,i,r.bbMin,r.bbMax)}function S(e,t,r){const n=t.eye,i=t.viewForward,s=(r[0]-n[0])*i[0]+(r[1]-n[1])*i[1]+(r[2]-n[2])*i[2];e.near=Math.min(e.near,s-r[3]),e.far=Math.max(e.far,s+r[3])}class v{constructor(){this._items=new e({allocator:e=>e||{object:null,distance:0,near:0,far:0},deallocator:e=>(e.object=null,e.distance=0,e.near=0,e.far=0,e)})}get length(){return this._items.length}get empty(){return 0===this._items.length}clear(){this._items.clear()}add(e){this._items.pushNew().object=e}sort(e){const t=e.eye,r=e.viewForward;this._items.forAll((e=>{const n=e.object.boundingVolumeWorldSpace.bounds,i=(n[0]-t[0])*r[0]+(n[1]-t[1])*r[1]+(n[2]-t[2])*r[2];e.distance=i,e.near=i-n[3],e.far=i+n[3]})),this._items.sort(((e,t)=>e.distance-t.distance))}forEachInDepthRange(e,t,r){if(t===u.DepthOrder.FRONT_TO_BACK)for(let n=0;n<this._items.length;++n){const t=this._items.data[n];t.far<e.near||t.near>e.far||r(t.object,t.near,t.far)}else for(let n=this._items.length-1;n>=0;--n){const t=this._items.data[n];t.far<e.near||t.near>e.far||r(t.object,t.near,t.far)}}}class B{constructor(){this._geometries=new Array,this._near=[],this._far=[],this._nearCandidates=[],this._farCandidates=[],this._looseRange=new l(0,0)}compute(e,t,r){this._reset();const{viewMatrix:n}=e;t.forAll((e=>{e.forEachGeometry((e=>{if(!e.visible||r===_.SHADOW_CASTERS&&!e.castShadow)return;const t=e.boundingSphere,i=n[2]*t[0]+n[6]*t[1]+n[10]*t[2]+n[14],s=i-t[3],a=i+t[3];this._geometries.push(e),this._near.push(-a),this._far.push(-s)}))}));const i=new l;if(0===this._geometries.length)return i;for(let h=0;h<this._geometries.length;++h)this._near[h]>i.far&&(i.far=this._near[h]),this._near[h]>2&&this._far[h]<i.near&&(i.near=this._far[h]);const s=this._looseRange;s.near=Math.max(.5*i.near,2),s.far=2*i.far;let a=0,o=0;for(let h=0;h<this._geometries.length;++h)this._near[h]<i.near&&(this._near[h]>=s.near?i.near=this._near[h]:this._nearCandidates[a++]=h),this._far[h]>i.far&&(this._far[h]<=s.far?i.far=this._far[h]:this._farCandidates[o++]=h);if(0===this._nearCandidates.length&&0===this._farCandidates.length)return i;this._nearCandidates.sort(((e,t)=>this._near[e]<this._near[t]?-1:this._near[e]>this._near[t]?1:0)),this._farCandidates.sort(((e,t)=>this._far[e]<this._far[t]?1:this._far[e]>this._far[t]?-1:0));for(let h=0;h<this._nearCandidates.length;++h){const t=this._nearCandidates[h];if(this._near[t]<i.near){const r=this._geometries[t],{boundingInfo:n,shaderTransformation:s}=r;this._includeNearBoundingInfoRec(e,n,s,i)}}for(let h=0;h<this._farCandidates.length;++h){const t=this._farCandidates[h];if(this._far[t]>i.far){const r=this._geometries[t],{boundingInfo:n,shaderTransformation:s}=r;this._includeFarBoundingInfoRec(e,n,s,i)}}return this._reset(),i}_reset(){this._geometries.length=0,this._near.length=0,this._far.length=0,this._nearCandidates.length=0,this._farCandidates.length=0}_isOutsideSidePlanes(e,t){const r=o(e),n=h(e);return t[0][0]*r[0]+t[0][1]*r[1]+t[0][2]*r[2]+t[0][3]>n||t[1][0]*r[0]+t[1][1]*r[1]+t[1][2]*r[2]+t[1][3]>n||t[2][0]*r[0]+t[2][1]*r[1]+t[2][2]*r[2]+t[2][3]>n||t[3][0]*r[0]+t[3][1]*r[1]+t[3][2]*r[2]+t[3][3]>n}_includeNearBoundingInfoRec(e,t,r,i){if(null==t)return;const s=t.center;n(o(I),s,r),I[3]=t.radius*c(r);const{frustum:a}=e;if(this._isOutsideSidePlanes(I,a))return;const h=I[0],f=I[1],l=I[2],u=I[3],{viewMatrix:d}=e,_=d[2]*h+d[6]*f+d[10]*l+d[14],m=_+u;if(!(-(_-u)<2||-m>=i.near))if(-m>this._looseRange.near)i.near=-m;else{if(u>g){const n=t.getChildren();if(void 0!==n){for(const t of n)this._includeNearBoundingInfoRec(e,t,r,i);return}}K.unionDepthRangeWithAABB(i,e.viewProjectionMatrix,r,t.bbMin,t.bbMax)}}_includeFarBoundingInfoRec(e,t,r,i){if(null==t)return;const s=t.center;n(o(I),s,r),I[3]=t.radius*c(r);const{frustum:a}=e;if(this._isOutsideSidePlanes(I,a))return;const[h,f,l,u]=I,{viewMatrix:d}=e,_=d[2]*h+d[6]*f+d[10]*l+d[14]-u;if(!(-_<=i.far))if(-_<this._looseRange.far)i.far=-_;else{if(u>g){const n=t.getChildren();if(void 0!==n){for(const t of n)this._includeFarBoundingInfoRec(e,t,r,i);return}}K.unionDepthRangeWithAABB(i,e.viewProjectionMatrix,r,t.bbMin,t.bbMax)}}}class D{constructor(){this._modelViewProj=r(),this._clipPosition=[s(),s(),s(),s(),s(),s(),s(),s()]}unionDepthRangeWithAABB(e,r,n,i,s){const a=this._modelViewProj;t(a,r,n);let o=!1;for(let t=0;t<8;++t){const e=this._clipPosition[t],r=0===t||3===t||4===t||7===t?i[0]:s[0],n=0===t||1===t||4===t||5===t?i[1]:s[1],o=t<4?i[2]:s[2];e[0]=a[0]*r+a[4]*n+a[8]*o+a[12],e[1]=a[1]*r+a[5]*n+a[9]*o+a[13],e[2]=a[2]*r+a[6]*n+a[10]*o+a[14],e[3]=a[3]*r+a[7]*n+a[11]*o+a[15]}for(let t=0;t<12;++t){const r=x(this._clipPosition[E[t][0]],this._clipPosition[E[t][1]],this._clipPosition[E[t][2]]);let n=!0;for(let e=0;e<r.length;++e){if(r[e][3]>=2){n=!1;break}}if(!n){o=!0;for(let t=0;t<r.length;++t){const n=r[t][3];Number.isFinite(n)&&(e.near=Math.min(n,e.near),e.far=Math.max(n,e.far))}}}return o}}function x(e,t,r){let n=[e,t,r];for(let i=0;i<4;++i){const e=n;n=[];for(let t=0;t<e.length;++t){const r=e[t],s=e[(t+1)%e.length];T(s,i)?(T(r,i)||n.push(F(r,s,i)),n.push(s)):T(r,i)&&n.push(F(r,s,i))}}return n}function T(e,t){return 0===t?e[0]>=-e[3]:1===t?e[1]>=-e[3]:2===t?e[0]<=e[3]:3===t?e[1]<=e[3]:void d(!1)}function F(e,t,r){let n=0;return 0===r?n=(-e[3]-e[0])/(t[0]-e[0]+t[3]-e[3]):1===r?n=(-e[3]-e[1])/(t[1]-e[1]+t[3]-e[3]):2===r?n=(e[3]-e[0])/(t[0]-e[0]-t[3]+e[3]):3===r&&(n=(e[3]-e[1])/(t[1]-e[1]-t[3]+e[3])),i(s(),e,t,n)}const E=[[0,1,3],[2,3,1],[1,5,2],[6,2,5],[5,4,6],[7,6,4],[4,0,7],[3,7,0],[3,2,7],[6,7,2],[4,5,0],[1,0,5]],I=f(),N=r(),P=new l,W=new v,y=new B,K=new D;export{B as DepthRangeFromRenderGeometries,_ as DepthRangeMode,R as depthRangeFromScene};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../../chunks/tslib.es6.js";import t from"../../../../../core/Accessor.js";import{equals as r,binaryIndexOf as s}from"../../../../../core/arrayUtils.js";import"../../../../../core/has.js";import n from"../../../../../core/Logger.js";import{clamp as i}from"../../../../../core/mathUtils.js";import{disposeMaybe as o,destroyMaybe as a}from"../../../../../core/maybe.js";import{isAbortError as c,onAbortOrThrow as l}from"../../../../../core/promiseUtils.js";import{property as d}from"../../../../../core/accessorSupport/decorators/property.js";import{subclass as h}from"../../../../../core/accessorSupport/decorators/subclass.js";import{fromMat4 as u,transpose as m,invert as g}from"../../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as f}from"../../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as p}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{i as _,c as b,a as y,f as j}from"../../../../../chunks/vec32.js";import{create as O,clone as w}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as E}from"../../../../../core/support/UpdatingHandles.js";import{a as v,g as x}from"../../../../../chunks/sphere.js";import{c as M}from"../../../../../chunks/vec33.js";import{ViewingMode as R}from"../../../../ViewingMode.js";import{encodeElevationOffset as T}from"../../collections/Component/Material/shader/ComponentData.glsl.js";import{TwoVectorPosition as A}from"../../core/util/TwoVectorPosition.js";import{Attribute as C}from"../Attribute.js";import{GridLocalOriginFactory as D}from"../GridLocalOriginFactory.js";import{applyToModelMatrix as P}from"../localOriginHelper.js";import{LocalOriginManager as U}from"../LocalOriginManager.js";import{Object3D as L}from"../Object3D.js";import{VertexArrayObject as k}from"../VertexArrayObject.js";import{VertexAttribute as I}from"../VertexAttribute.js";import{VertexLayout as S,EdgeInputBufferLayout as B,vertexAttributeLocations as V,glVertexLayout as q}from"./bufferLayouts.js";import{RegularEdgeBufferWriter as H,SilhouetteEdgeBufferWriter as G}from"./edgeBufferWriters.js";import{EdgeRenderer as N,lineWidthFractionFactor as W,extensionLengthOffset as z}from"./EdgeRenderer.js";import{EdgePassParameters as F}from"./EdgeShaderParameters.js";import{EdgeWorkerHandle as K}from"./EdgeWorkerHandle.js";import"./interfaces.js";import{generateStrokesTexture as J}from"./strokes.js";import{determineRendererType as Q,determineEdgeTransparency as X,determineObjectTransparency as Y,fillComponentBufferIndices as Z}from"./util.js";import{BufferManager as $}from"../TextureBackedBuffer/BufferManager.js";import{EdgeSilhouette as ee}from"../../shaders/sources/edgeRenderer/EdgeUtil.glsl.js";import{BufferObject as te}from"../../../../webgl/BufferObject.js";import{Usage as re}from"../../../../webgl/enums.js";const se=128;let ne=class extends t{constructor(e){super(e),this._updatingHandles=new E,this._objectEntries=new Map,this._pendingDeletions=new Map,this._renderers=new Map,this._gpuMemoryUsage=0,this._workerAbort=new AbortController,this._tmpModelPosition=O(),this._localOrigins=new U(new D(e.renderSR));const t=S.createBuffer(4);for(let r=0;r<4;r++)t.sideness.set(r,0,0===r||3===r?0:1),t.sideness.set(r,1,0===r||1===r?0:1);this._verticesBufferObject=te.createVertex(e.rctx,re.STATIC_DRAW,t.buffer)}initialize(){this._worker=new K(this.schedule),this._componentColorManager=new $(this.rctx,3)}destroy(){this.destroyed||(this._objectEntries.forEach((e=>this._discardObjectEntry(e))),this._objectEntries.clear(),this._pendingDeletions.forEach((e=>this._discardObjectEntry(e))),this._pendingDeletions.clear(),this._strokesTexture=o(this._strokesTexture),this._componentColorManager=a(this._componentColorManager),this._workerAbort.abort(),this._worker.destroy(),this._verticesBufferObject.dispose(),this._renderers.clear(),this._updatingHandles.destroy(),this._set("schedule",we))}get updating(){return this._updatingHandles.updating}get usedMemory(){return this._gpuMemoryUsage}shouldRender(){return this._renderers.size>0}async addComponentObject(e,t,r,s,n,i,o){if(this.hasObject(e))return this._getObjectMemoryUsage(e);let a;const c=new ae(null,new Promise((e=>a=e)),e.obb.center,e.obb.radius);this._objectEntries.set(e,c);const l=await this._updatingHandles.addPromise(this._addComponentGeometry(e.transform,c,t,r,s,n,i,o));return this.setNeedsRender(),a(),l}async addOrUpdateObject3D(e,t,r,s){if(this.destroyed)return void n.getLogger(this).warn("Attempt to add an object to a destroyed instance");const i=new AbortController;let o;const a=e.boundingVolumeWorldSpace.bounds,l=new ae(i,new Promise((e=>o=e)),v(a),x(a)),d=this._objectEntries.get(e);d&&(this._pendingDeletions.has(e)?this._discardObjectEntry(d):this._pendingDeletions.set(e,d)),this._objectEntries.set(e,l);try{const n=new Array;if(e.geometries.length>1&&oe(e))n.push(this._addObjectMergedGeometries(e,l,t,r,s));else for(const i of e.geometries)i.material.supportsEdges&&n.push(this._addGeometry(e,l,i,t,r,s));await this._updatingHandles.addPromise(Promise.all(n)),this._removePendingDeletion(e)}catch(h){c(h)?this._discardObjectEntry(l):this._removePendingDeletion(e)}finally{this.setNeedsRender(),o()}}removeObject(e){const t=this._objectEntries.get(e);this._objectEntries.delete(e),this._discardObjectEntry(t),this._removePendingDeletion(e)}_removePendingDeletion(e){const t=this._pendingDeletions.get(e);this._pendingDeletions.delete(e),this._discardObjectEntry(t)}async _getObjectEntry(e){const t=this._objectEntries.get(e);if(!t)throw new Error("no object");return await t.loaded,null==t.loaded?null:t}fastUpdateObject3DEdgesTransform(e){if(this.destroyed)return!1;const t=this._objectEntries.get(e);if(!t)return!1;const{geometries:r}=e,{renderables:s}=t;if(0===r.length||0===s.length)return!0;if(s.length>1)return!1;const[n]=s,i=n.transform;if(!(i instanceof de))return!1;const[o]=r;if(o.localOrigin!==i.origin.origin)return!1;const a=p(),c=this._computeModelTransformWithLocalOrigin(e,o,a);return n.transform=new de(a,c),this.setNeedsRender(),!0}_discardObjectEntry(e){e&&(e.abort?.abort(),e.renderables.length&&(e.renderables.forEach((e=>this._removeRenderable(e))),this.setNeedsRender()),e.loaded=null)}hasObject(e){return this._objectEntries.has(e)}async updateAllComponentOpacities(e,t){const r=await this._updatingHandles.addPromise(this._getObjectEntry(e));if(null==r)return;const s=Array.isArray(t)?e=>t[e]:()=>t;r.renderables.forEach((e=>{const t=e.components.meta.length;for(let r=0;r<t;r++){const t=s(r),n=e.components.meta[r],i=n.index;n.material.opacity=t,e.components.buffer.textureBuffer.setDataElement(i,1,3,255*t)}this._updateTransparency(e)})),this.setNeedsRender()}async _getObjectMemoryUsage(e){const t=await this._getObjectEntry(e);return t?t.renderables.reduce(((e,t)=>e+t.statistics.gpuMemoryUsage),0):0}async updateAllComponentMaterials(e,t,r,s){const n=e instanceof L,i=Q(t),o=N.getKey(i,r,n),a=await this._updatingHandles.addPromise(this._getObjectEntry(e));null!=a&&(a.renderables.forEach((e=>{if(o!==e.rendererKey){const t=this._renderers.get(e.rendererKey),s=this._acquireRenderer(i,r,n);t.removeRenderable(e),--t.refCount,e.rendererKey=o,s.addRenderable(e)}if(Array.isArray(t))for(let r=0;r<t.length;r++)e.components.meta[r].material=t[r];else e.components.meta[0].material=t;s&&me(e.components),this._updateTransparency(e)})),this.setNeedsRender())}async updateAllVerticalOffsets(e,t){const r=await this._updatingHandles.addPromise(this._getObjectEntry(e));null!=r&&this._updateAllVerticalOffsets(r,t)}_updateAllVerticalOffsets(e,t){e.renderables.forEach((e=>{const r=e.components.meta;for(let s=0;s<r.length;s++)e.components.meta[s].verticalOffset=t?.[s]??0;me(e.components)})),this.setNeedsRender()}async updateObjectVisibility(e,t){const r=await this._updatingHandles.addPromise(this._getObjectEntry(e));r&&(r.renderables.forEach((e=>e.visible=t)),this.setNeedsRender())}render(e,t){if(null==this._componentColorManager)return;this._localOrigins.updateViewMatrices(e.camera.viewMatrix);const r=e.camera.viewInverseTransposeMatrix,s=O(),n=new A;let i=0,o=0;if(this._renderers.forEach((r=>{0!==r.refCount?(++this.techniques.precompiling,r.forEachRenderable((t=>{t.visible&&(i+=t.statistics.averageEdgeLength,o++,t.regular&&r.acquireTechnique(e,!1).release(),t.silhouette&&r.acquireTechnique(e,!0).release())}),t),--this.techniques.precompiling):this._renderers.delete(r.key)})),this._componentColorManager.garbageCollect(),this._componentColorManager.updateTextures(),0===o)return;const a=new F(40*i/o,t);_(s,r[3],r[7],r[11]),n.set(s),b(a.transformWorldFromViewTH,n.high),b(a.transformWorldFromViewTL,n.low),u(a.transformViewFromCameraRelativeRS,e.camera.viewMatrix),m(Oe,a.transformViewFromCameraRelativeRS),g(a.transformNormalViewFromGlobal,Oe),a.transformProjFromView=e.camera.projectionMatrix,this._updateObjectCameraDistances(e),this._renderers.forEach((t=>{ge(t,e,a),fe(t,e,a)}))}_updateTransparency(e){const t=X(e.components.meta),r=Y(e.components.meta);t===e.edgeTransparency&&r===e.objectTransparency||(e.edgeTransparency=t,e.objectTransparency=r,this._renderers.get(e.rendererKey).setRenderablesDirty())}_computeModelTransformWithLocalOrigin(e,t,r){e.getCombinedShaderTransformation(t,r);const s=null!=t.localOrigin?this._localOrigins.register(t.localOrigin):this._localOrigins.acquire(_(this._tmpModelPosition,r[12],r[13],r[14]));return t.localOrigin=s.origin,P(s.origin.vec3,r),s}_createComponentBuffers(e){if(null==this._componentColorManager)return null;const t=new Array,r=this._componentColorManager.getBuffer(e.length);for(let n=0;n<e.length;n++){const s=e[n],i=r.acquireIndex();t.push({index:i,verticalOffset:0,material:s})}const s=new ce(r,t);return me(s),s}_extractEdges(e,t,r,s,n,i,o=i.length){return o<se&&(n=!0),this._worker.process({data:r,indices:i,indicesLength:o,writerSettings:t,skipDeduplicate:s},e,n)}_createRenderable(e,t,r,s,n){const i=t=>new le(new k(this.rctx,V,new Map([["vertices",q],["instances",t===ee.REGULAR?H.glLayout:G.glLayout]]),new Map([["vertices",this._verticesBufferObject],["instances",te.createVertex(this.rctx,re.STATIC_DRAW,t===ee.REGULAR?e.regular.instancesData.buffer:e.silhouette.instancesData.buffer)]])),t===ee.REGULAR?e.regular.lodInfo:e.silhouette.lodInfo),o=e.regular.lodInfo.lengths.length>0?i(ee.REGULAR):null,a=e.silhouette.lodInfo.lengths.length>0?i(ee.SILHOUETTE):null,c=(o?.vao.cachedMemory??0)+(a?.vao.cachedMemory??0);return new he(o,a,{gpuMemoryUsage:c,externalMemoryUsage:n,averageEdgeLength:e.averageEdgeLength},r,X(t.meta),Y(t.meta),t,s)}async _addGeometry(e,t,r,s,n,i){if(r.edgeIndicesLength<=0)return;const o=r.attributes.get(I.POSITION),a=p(),c=this._computeModelTransformWithLocalOrigin(e,r,a),l=new je(o,a,c);return this._addPositionData(t,l,r.edgeIndicesLength,s,n,i)}async _addPositionData(e,t,r,s,n,i=!1){if(null==e.loaded)return;const o=this._createComponentBuffers([s]);if(null==o)return;const a=this._acquireRenderer(s.type,n,!0),{modelTransform:c,origin:l}=t,d=t.position.indices,h=t.position,u=h.data.length/h.size,m=B.createBuffer(u);for(let p=0;p<u;p++)m.position.set(p,0,h.data[p*h.size]),m.position.set(p,1,h.data[p*h.size+1]),m.position.set(p,2,h.data[p*h.size+2]);Z(o.meta,[0,m.componentIndex.count],m.componentIndex);const g=await this._updatingHandles.addPromise(this._extractEdges(e.abort?.signal||this._workerAbort.signal,a.writerSettings,m,!1,i,d,r));if(null==e.loaded)return;const f=this._createRenderable(g,o,new de(c,l),a.key,!1);e.renderables.push(f),a.addRenderable(f),this._gpuMemoryUsage+=f.statistics.gpuMemoryUsage}async _addComponentGeometry(e,t,r,s,n,i,o,a){if(null==t.loaded)return 0;const c=this._createComponentBuffers(i);if(null==c)return 0;const l=Q(i),d=this._acquireRenderer(l,o||!1,!1),h=B.createBuffer(r.length/3);M(h.position.typedBuffer,r,h.position.typedBufferStride,3),Z(c.meta,n,h.componentIndex,s);const u=!0,m=d.writerSettings,g=await this._updatingHandles.addPromise(this._extractEdges(this._workerAbort.signal,m,h,u,!1,s));if(null==t.loaded)return 0;const f=this._createRenderable(g,c,e,d.key,!0);return t.renderables.push(f),d.addRenderable(f),this._updateAllVerticalOffsets(t,a),f.statistics.gpuMemoryUsage}async _addObjectMergedGeometries(e,t,r,s,n){const i=new Map;let o=0,a=0,c=null;const l=e.geometries.filter((e=>{if(e.edgeIndicesLength<=0||!e.material.supportsEdges)return!1;!c&&e.localOrigin&&(c=e);const t=e.attributes.get(I.POSITION);return a+=t.data.length/t.size,o+=e.edgeIndicesLength,!0}));if(0===l.length)return;const d=a>=65536?Uint32Array:Uint16Array,h=o?new d(o):null,u=[];let m=0;l.forEach((e=>{const t=e.attributes.get(I.POSITION),r=t.indices;let s=i.get(t.data);if(null==s){s=u.length/3;for(let e=0;e<t.data.length;e+=t.size)u.push(t.data[e]),u.push(t.data[e+1]),u.push(t.data[e+2]);i.set(t.data,s)}for(let n=0;n<e.edgeIndicesLength;n++)h[m++]=s+r[n]}));const g=c||e.geometries[0],f=p(),_=this._computeModelTransformWithLocalOrigin(e,g,f);for(let p=0;p<e.geometries.length;p++)e.geometries[p].localOrigin=_.origin;const b=new je(new C(u,h,3),f,_);await this._updatingHandles.addPromise(this._addPositionData(t,b,h.length,r,s,n))}_acquireRenderer(e,t,r){const s=N.getKey(e,t,r);let n=this._renderers.get(s);return null==this._strokesTexture&&(this._strokesTexture=J(this.rctx)),n||(n=new N(this.rctx,this.techniques,{type:e,hasSlicePlane:t,strokesTexture:this._strokesTexture,legacy:r,spherical:this.viewingMode===R.Global}),this._renderers.set(s,n)),++n.refCount,n}_removeRenderable(e){ie(e.regular),ie(e.silhouette);const t=this._renderers.get(e.rendererKey);if(t){t.removeRenderable(e),--t.refCount,this._localOrigins.release(e.transform.origin),this._gpuMemoryUsage-=e.statistics.externalMemoryUsage?0:e.statistics.gpuMemoryUsage;for(const t of e.components.meta)e.components.buffer.releaseIndex(t.index)}}_updateObjectCameraDistances(e){const t=e.camera.eye,r=e.camera.viewForward,s=O(),n=e=>{y(s,e.center,t);const n=j(s,r),i=e.radius,o=n<-i?1/0:n<i?0:n-i;e.renderables.forEach((e=>e.distanceToCamera=o))};this._objectEntries.forEach(n),this._pendingDeletions.forEach(n)}get test(){}};function ie(e){e?.vao&&(e.vao.vertexBuffers.get("instances")?.dispose(),e.vao.disposeVAOOnly(),e.vao=null)}function oe(e){let t=null,s=null;for(const n of e.geometries){if(n.material.supportsEdges){if(t){if(!r(t,n.transformation))return!1}else t=n.transformation;if(s||null==n.localOrigin){if(null!=s?.localOrigin&&null!=n.localOrigin&&s.localOrigin.id!==n.localOrigin.id)return!1}else s=n}}return!0}e([d({constructOnly:!0})],ne.prototype,"rctx",void 0),e([d({constructOnly:!0})],ne.prototype,"renderSR",void 0),e([d({constructOnly:!0})],ne.prototype,"viewingMode",void 0),e([d({constructOnly:!0})],ne.prototype,"techniques",void 0),e([d({constructOnly:!0})],ne.prototype,"setNeedsRender",void 0),e([d({constructOnly:!0})],ne.prototype,"schedule",void 0),e([d({readOnly:!0})],ne.prototype,"_updatingHandles",void 0),e([d({readOnly:!0})],ne.prototype,"updating",null),ne=e([h("esri.views.3d.webgl-engine.lib.edgeRendering.EdgeView")],ne);class ae{constructor(e,t,r,s){this.abort=e,this.radius=s,this.renderables=new Array;const n=e?l(e.signal,(()=>e.abort())):null;this.loaded=t,this.loaded.then((()=>{null!=this.loaded&&(this.loaded=!0),this.abort=null,n?.remove()})),this.center=w(r)}}class ce{constructor(e,t){this.buffer=e,this.meta=t}}class le{constructor(e,t){this.vao=e,this.lod=t}}class de{constructor(e,t){this.modelMatrix=e,this.origin=t}}class he{constructor(e,t,r,s,n,i,o,a){this.regular=e,this.silhouette=t,this.statistics=r,this.transform=s,this.edgeTransparency=n,this.objectTransparency=i,this.components=o,this.rendererKey=a,this.distanceToCamera=0,this.visible=!0}}class ue extends he{}function me(e){const{meta:t,buffer:r}=e,s=new Uint8Array(4);for(let n=0;n<t.length;n++){const e=t[n].material,o=t[n].index,a=i(Math.round(e.size*W),0,255),c=i(e.extensionLength,-z,255-z)+z,l=255*e.opacity,d=e.color,h=255*d[0],u=255*d[1],m=255*d[2],g=255*d[3];r.textureBuffer.setData(o,0,h,u,m,g),r.textureBuffer.setData(o,1,a,c,e.type,l),T(t[n].verticalOffset,s),r.textureBuffer.setData(o,2,s[0],s[1],s[2],s[3])}}function ge(e,t,r){let s,n;const i=r.transparency,o=t.camera.perScreenPixelRatio;e.forEachRenderable((i=>{if(!pe(i)||!i.visible)return;s??=e.acquireTechnique(t,!1),n??=e.rctx.bindTechnique(s,t,r);const a=ye(i.regular.lod.lengths,i.distanceToCamera,o);e.renderRegularEdges(n,i,r,t,a)}),i),s?.release()}function fe(e,t,r){let s,n;const i=r.transparency,o=t.camera.perScreenPixelRatio;e.forEachRenderable((i=>{if(!be(i)||!i.visible)return;s??=e.acquireTechnique(t,!0),n??=e.rctx.bindTechnique(s,t,r);const a=ye(i.silhouette.lod.lengths,i.distanceToCamera,o);e.renderSilhouetteEdges(n,i,r,t,a)}),i),s?.release()}function pe(e){return null!=e.regular}class _e extends he{}function be(e){return null!=e.silhouette}function ye(e,t,r){const n=t*r,i=s(e,n,!0);return-1===i?n<e[0]?e.length:0:e.length-i}class je{constructor(e,t,r){this.position=e,this.modelTransform=t,this.origin=r}}const Oe=f(),we=()=>Promise.reject();export{ne as EdgeView,de as LegacyTransform,ue as RegularRenderable,he as Renderable,_e as SilhouetteRenderable};
5
+ import{_ as e}from"../../../../../chunks/tslib.es6.js";import t from"../../../../../core/Accessor.js";import{equals as r,binaryIndexOf as s}from"../../../../../core/arrayUtils.js";import"../../../../../core/has.js";import n from"../../../../../core/Logger.js";import{clamp as i}from"../../../../../core/mathUtils.js";import{disposeMaybe as o,destroyMaybe as a}from"../../../../../core/maybe.js";import{isAbortError as c,onAbortOrThrow as l}from"../../../../../core/promiseUtils.js";import{property as d}from"../../../../../core/accessorSupport/decorators/property.js";import{subclass as h}from"../../../../../core/accessorSupport/decorators/subclass.js";import{fromMat4 as u,transpose as m,invert as g}from"../../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as f}from"../../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as p}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{i as _,c as b,a as y,f as j}from"../../../../../chunks/vec32.js";import{create as O,clone as w}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as E}from"../../../../../core/support/UpdatingHandles.js";import{a as v,g as x}from"../../../../../chunks/sphere.js";import{c as M}from"../../../../../chunks/vec33.js";import{ViewingMode as R}from"../../../../ViewingMode.js";import{encodeElevationOffset as T}from"../../collections/Component/Material/shader/ComponentData.glsl.js";import{TwoVectorPosition as A}from"../../core/util/TwoVectorPosition.js";import{Attribute as C}from"../Attribute.js";import{GridLocalOriginFactory as D}from"../GridLocalOriginFactory.js";import{applyToModelMatrix as P}from"../localOriginHelper.js";import{LocalOriginManager as U}from"../LocalOriginManager.js";import{Object3D as L}from"../Object3D.js";import{VertexArrayObject as k}from"../VertexArrayObject.js";import{VertexAttribute as I}from"../VertexAttribute.js";import{VertexLayout as S,EdgeInputBufferLayout as B,vertexAttributeLocations as V,glVertexLayout as q}from"./bufferLayouts.js";import{RegularEdgeBufferWriter as H,SilhouetteEdgeBufferWriter as G}from"./edgeBufferWriters.js";import{EdgeRenderer as N,lineWidthFractionFactor as W,extensionLengthOffset as z}from"./EdgeRenderer.js";import{EdgePassParameters as F}from"./EdgeShaderParameters.js";import{EdgeWorkerHandle as K}from"./EdgeWorkerHandle.js";import"./interfaces.js";import{generateStrokesTexture as J}from"./strokes.js";import{determineRendererType as Q,determineEdgeTransparency as X,determineObjectTransparency as Y,fillComponentBufferIndices as Z}from"./util.js";import{BufferManager as $}from"../TextureBackedBuffer/BufferManager.js";import{EdgeSilhouette as ee}from"../../shaders/sources/edgeRenderer/EdgeUtil.glsl.js";import{BufferObject as te}from"../../../../webgl/BufferObject.js";import{Usage as re}from"../../../../webgl/enums.js";const se=128;let ne=class extends t{constructor(e){super(e),this._updatingHandles=new E,this._objectEntries=new Map,this._pendingDeletions=new Map,this._renderers=new Map,this._gpuMemoryUsage=0,this._workerAbort=new AbortController,this._tmpModelPosition=O(),this._localOrigins=new U(new D(e.renderSR));const t=S.createBuffer(4);for(let r=0;r<4;r++)t.sideness.set(r,0,0===r||3===r?0:1),t.sideness.set(r,1,0===r||1===r?0:1);this._verticesBufferObject=te.createVertex(e.rctx,re.STATIC_DRAW,t.buffer)}initialize(){this._worker=new K(this.schedule),this._componentColorManager=new $(this.rctx,3)}destroy(){this.destroyed||(this._objectEntries.forEach((e=>this._discardObjectEntry(e))),this._objectEntries.clear(),this._pendingDeletions.forEach((e=>this._discardObjectEntry(e))),this._pendingDeletions.clear(),this._strokesTexture=o(this._strokesTexture),this._componentColorManager=a(this._componentColorManager),this._workerAbort.abort(),this._worker.destroy(),this._verticesBufferObject.dispose(),this._renderers.clear(),this._updatingHandles.destroy(),this._set("schedule",we))}get updating(){return this._updatingHandles.updating}get usedMemory(){return this._gpuMemoryUsage}shouldRender(){return this._renderers.size>0}async addComponentObject(e,t,r,s,n,i,o){if(this.hasObject(e))return this._getObjectMemoryUsage(e);let a;const c=new ae(null,new Promise((e=>a=e)),e.obb.center,e.obb.radius);this._objectEntries.set(e,c);const l=await this._updatingHandles.addPromise(this._addComponentGeometry(e.transform,c,t,r,s,n,i,o));return this.setNeedsRender(),a(),l}async addOrUpdateObject3D(e,t,r,s){if(this.destroyed)return void n.getLogger(this).warn("Attempt to add an object to a destroyed instance");const i=new AbortController;let o;const a=e.boundingVolumeWorldSpace.bounds,l=new ae(i,new Promise((e=>o=e)),v(a),x(a)),d=this._objectEntries.get(e);d&&(this._pendingDeletions.has(e)?this._discardObjectEntry(d):this._pendingDeletions.set(e,d)),this._objectEntries.set(e,l);try{const n=new Array;if(e.geometries.length>1&&oe(e))n.push(this._addObjectMergedGeometries(e,l,t,r,s));else for(const i of e.geometries)i.material.supportsEdges&&n.push(this._addGeometry(e,l,i,t,r,s));await this._updatingHandles.addPromise(Promise.all(n)),this._removePendingDeletion(e)}catch(h){c(h)?this._discardObjectEntry(l):this._removePendingDeletion(e)}finally{this.setNeedsRender(),o()}}removeObject(e){const t=this._objectEntries.get(e);this._objectEntries.delete(e),this._discardObjectEntry(t),this._removePendingDeletion(e)}_removePendingDeletion(e){const t=this._pendingDeletions.get(e);this._pendingDeletions.delete(e),this._discardObjectEntry(t)}async _getObjectEntry(e){const t=this._objectEntries.get(e);if(!t)throw new Error("no object");return await t.loaded,null==t.loaded?null:t}fastUpdateObject3DEdgesTransform(e){if(this.destroyed)return!1;const t=this._objectEntries.get(e);if(!t)return!1;const{geometries:r}=e,{renderables:s}=t;if(0===r.length||0===s.length)return!0;if(s.length>1)return!1;const[n]=s,i=n.transform;if(!(i instanceof de))return!1;const[o]=r;if(o.localOrigin!==i.origin.origin)return!1;const a=p(),c=this._computeModelTransformWithLocalOrigin(e,o,a);return n.transform=new de(a,c),this.setNeedsRender(),!0}_discardObjectEntry(e){e&&(e.abort?.abort(),e.renderables.length&&(e.renderables.forEach((e=>this._removeRenderable(e))),this.setNeedsRender()),e.loaded=null)}hasObject(e){return this._objectEntries.has(e)}async updateAllComponentOpacities(e,t){const r=await this._updatingHandles.addPromise(this._getObjectEntry(e));if(null==r)return;const s=Array.isArray(t)?e=>t[e]:()=>t;r.renderables.forEach((e=>{const t=e.components.meta.length;for(let r=0;r<t;r++){const t=s(r),n=e.components.meta[r],i=n.index;n.material.opacity=t,e.components.buffer.textureBuffer.setDataElement(i,1,3,255*t)}this._updateTransparency(e)})),this.setNeedsRender()}async _getObjectMemoryUsage(e){const t=await this._getObjectEntry(e);return t?t.renderables.reduce(((e,t)=>e+t.statistics.gpuMemoryUsage),0):0}async updateAllComponentMaterials(e,t,r,s){const n=e instanceof L,i=Q(t),o=N.getKey(i,r,n),a=await this._updatingHandles.addPromise(this._getObjectEntry(e));null!=a&&(a.renderables.forEach((e=>{if(o!==e.rendererKey){const t=this._renderers.get(e.rendererKey),s=this._acquireRenderer(i,r,n);t.removeRenderable(e),--t.refCount,e.rendererKey=o,s.addRenderable(e)}if(Array.isArray(t))for(let r=0;r<t.length;r++)e.components.meta[r].material=t[r];else e.components.meta[0].material=t;s&&me(e.components),this._updateTransparency(e)})),this.setNeedsRender())}async updateAllVerticalOffsets(e,t){const r=await this._updatingHandles.addPromise(this._getObjectEntry(e));null!=r&&this._updateAllVerticalOffsets(r,t)}_updateAllVerticalOffsets(e,t){e.renderables.forEach((e=>{const r=e.components.meta;for(let s=0;s<r.length;s++)e.components.meta[s].verticalOffset=t?.[s]??0;me(e.components)})),this.setNeedsRender()}async updateObjectVisibility(e,t){const r=await this._updatingHandles.addPromise(this._getObjectEntry(e));r&&(r.renderables.forEach((e=>e.visible=t)),this.setNeedsRender())}render(e,t){if(null==this._componentColorManager)return;this._localOrigins.updateViewMatrices(e.camera.viewMatrix);const r=e.camera.viewInverseTransposeMatrix,s=O(),n=new A;let i=0,o=0;if(this._renderers.forEach((r=>{0!==r.refCount?(++this.techniques.precompiling,r.forEachRenderable((t=>{t.visible&&(i+=t.statistics.averageEdgeLength,o++,t.regular&&r.acquireTechnique(e,!1).release(),t.silhouette&&r.acquireTechnique(e,!0).release())}),t),--this.techniques.precompiling):this._renderers.delete(r.key)})),this._componentColorManager.garbageCollect(),this._componentColorManager.updateTextures(),0===o)return;const a=new F(40*i/o,t);_(s,r[3],r[7],r[11]),n.set(s),b(a.transformWorldFromViewTH,n.high),b(a.transformWorldFromViewTL,n.low),u(a.transformViewFromCameraRelativeRS,e.camera.viewMatrix),m(Oe,a.transformViewFromCameraRelativeRS),g(a.transformNormalViewFromGlobal,Oe),a.transformProjFromView=e.camera.projectionMatrix,this._updateObjectCameraDistances(e),this._renderers.forEach((t=>{ge(t,e,a),fe(t,e,a)}))}_updateTransparency(e){const t=X(e.components.meta),r=Y(e.components.meta);t===e.edgeTransparency&&r===e.objectTransparency||(e.edgeTransparency=t,e.objectTransparency=r,this._renderers.get(e.rendererKey).setRenderablesDirty())}_computeModelTransformWithLocalOrigin(e,t,r){e.getCombinedShaderTransformation(t,r);const s=null!=t.localOrigin?this._localOrigins.register(t.localOrigin):this._localOrigins.acquire(_(this._tmpModelPosition,r[12],r[13],r[14]));return t.localOrigin=s.origin,P(s.origin.vec3,r),s}_createComponentBuffers(e){if(null==this._componentColorManager)return null;const t=new Array,r=this._componentColorManager.getBuffer(e.length);for(let n=0;n<e.length;n++){const s=e[n],i=r.acquireIndex();t.push({index:i,verticalOffset:0,material:s})}const s=new ce(r,t);return me(s),s}_extractEdges(e,t,r,s,n,i,o=i.length){return o<se&&(n=!0),this._worker.process({data:r,indices:i,indicesLength:o,writerSettings:t,skipDeduplicate:s},e,n)}_createRenderable(e,t,r,s,n){const i=t=>new le(new k(this.rctx,V,new Map([["vertices",q],["instances",t===ee.REGULAR?H.glLayout:G.glLayout]]),new Map([["vertices",this._verticesBufferObject],["instances",te.createVertex(this.rctx,re.STATIC_DRAW,t===ee.REGULAR?e.regular.instancesData.buffer:e.silhouette.instancesData.buffer)]])),t===ee.REGULAR?e.regular.lodInfo:e.silhouette.lodInfo),o=e.regular.lodInfo.lengths.length>0?i(ee.REGULAR):null,a=e.silhouette.lodInfo.lengths.length>0?i(ee.SILHOUETTE):null,c=(o?.vao.cachedMemory??0)+(a?.vao.cachedMemory??0);return new he(o,a,{gpuMemoryUsage:c,externalMemoryUsage:n,averageEdgeLength:e.averageEdgeLength},r,X(t.meta),Y(t.meta),t,s)}async _addGeometry(e,t,r,s,n,i){if(r.edgeIndicesLength<=0)return;const o=r.attributes.get(I.POSITION),a=p(),c=this._computeModelTransformWithLocalOrigin(e,r,a),l=new je(o,a,c);return this._addPositionData(t,l,r.edgeIndicesLength,s,n,i)}async _addPositionData(e,t,r,s,n,i=!1){if(null==e.loaded)return;const o=this._createComponentBuffers([s]);if(null==o)return;const a=this._acquireRenderer(s.type,n,!0),{modelTransform:c,origin:l}=t,d=t.position.indices,h=t.position,u=h.data.length/h.size,m=B.createBuffer(u);for(let p=0;p<u;p++)m.position.set(p,0,h.data[p*h.size]),m.position.set(p,1,h.data[p*h.size+1]),m.position.set(p,2,h.data[p*h.size+2]);Z(o.meta,[0,m.componentIndex.count],m.componentIndex);const g=await this._updatingHandles.addPromise(this._extractEdges(e.abort?.signal||this._workerAbort.signal,a.writerSettings,m,!1,i,d,r));if(null==e.loaded)return;const f=this._createRenderable(g,o,new de(c,l),a.key,!1);e.renderables.push(f),a.addRenderable(f),this._gpuMemoryUsage+=f.statistics.gpuMemoryUsage}async _addComponentGeometry(e,t,r,s,n,i,o,a){if(null==t.loaded)return 0;const c=this._createComponentBuffers(i);if(null==c)return 0;const l=Q(i),d=this._acquireRenderer(l,o||!1,!1),h=B.createBuffer(r.length/3);M(h.position.typedBuffer,r,h.position.typedBufferStride,3),Z(c.meta,n,h.componentIndex,s);const u=!0,m=d.writerSettings,g=await this._updatingHandles.addPromise(this._extractEdges(this._workerAbort.signal,m,h,u,!1,s));if(null==t.loaded)return 0;const f=this._createRenderable(g,c,e,d.key,!0);return t.renderables.push(f),d.addRenderable(f),this._updateAllVerticalOffsets(t,a),f.statistics.gpuMemoryUsage}async _addObjectMergedGeometries(e,t,r,s,n){const i=new Map;let o=0,a=0,c=null;const l=e.geometries.filter((e=>{if(e.edgeIndicesLength<=0||!e.material.supportsEdges)return!1;!c&&e.localOrigin&&(c=e);const t=e.attributes.get(I.POSITION);return a+=t.data.length/t.size,o+=e.edgeIndicesLength,!0}));if(0===l.length)return;const d=a>=65536?Uint32Array:Uint16Array,h=o?new d(o):null,u=[];let m=0;l.forEach((e=>{const t=e.attributes.get(I.POSITION),r=t.indices;let s=i.get(t.data);if(null==s){s=u.length/3;for(let e=0;e<t.data.length;e+=t.size)u.push(t.data[e]),u.push(t.data[e+1]),u.push(t.data[e+2]);i.set(t.data,s)}for(let n=0;n<e.edgeIndicesLength;n++)h[m++]=s+r[n]}));const g=c||e.geometries[0],f=p(),_=this._computeModelTransformWithLocalOrigin(e,g,f);for(let p=0;p<e.geometries.length;p++)e.geometries[p].localOrigin=_.origin;const b=new je(new C(u,h,3),f,_);await this._updatingHandles.addPromise(this._addPositionData(t,b,h.length,r,s,n))}_acquireRenderer(e,t,r){const s=N.getKey(e,t,r);let n=this._renderers.get(s);return null==this._strokesTexture&&(this._strokesTexture=J(this.rctx)),n||(n=new N(this.rctx,this.techniques,{type:e,hasSlicePlane:t,strokesTexture:this._strokesTexture,legacy:r,spherical:this.viewingMode===R.Global}),this._renderers.set(s,n)),++n.refCount,n}_removeRenderable(e){ie(e.regular),ie(e.silhouette);const t=this._renderers.get(e.rendererKey);if(t){t.removeRenderable(e),--t.refCount,this._localOrigins.release(e.transform.origin),this._gpuMemoryUsage-=e.statistics.externalMemoryUsage?0:e.statistics.gpuMemoryUsage;for(const t of e.components.meta)e.components.buffer.releaseIndex(t.index)}}_updateObjectCameraDistances(e){const t=e.camera.eye,r=e.camera.viewForward,s=O(),n=e=>{y(s,e.center,t);const n=j(s,r),i=e.radius,o=n<-i?1/0:n<i?0:n-i;e.renderables.forEach((e=>e.distanceToCamera=o))};this._objectEntries.forEach(n),this._pendingDeletions.forEach(n)}get test(){}};function ie(e){e?.vao&&(e.vao.vertexBuffers.get("instances")?.dispose(),e.vao.disposeVAOOnly(),e.vao=null)}function oe(e){let t=null,s=null;for(const n of e.geometries){if(n.material.supportsEdges){if(t){if(!r(t,n.transformation))return!1}else t=n.transformation;if(s||null==n.localOrigin){if(null!=s?.localOrigin&&null!=n.localOrigin&&s.localOrigin.id!==n.localOrigin.id)return!1}else s=n}}return!0}e([d({constructOnly:!0})],ne.prototype,"rctx",void 0),e([d({constructOnly:!0})],ne.prototype,"renderSR",void 0),e([d({constructOnly:!0})],ne.prototype,"viewingMode",void 0),e([d({constructOnly:!0})],ne.prototype,"techniques",void 0),e([d({constructOnly:!0})],ne.prototype,"setNeedsRender",void 0),e([d({constructOnly:!0})],ne.prototype,"schedule",void 0),e([d({readOnly:!0})],ne.prototype,"_updatingHandles",void 0),e([d({readOnly:!0})],ne.prototype,"updating",null),ne=e([h("esri.views.3d.webgl-engine.lib.edgeRendering.EdgeView")],ne);class ae{constructor(e,t,r,s){this.abort=e,this.radius=s,this.renderables=new Array;const n=e?l(e.signal,(()=>e.abort())):null;this.loaded=t,this.loaded.then((()=>{null!=this.loaded&&(this.loaded=!0),this.abort=null,n?.remove()})),this.center=w(r)}}class ce{constructor(e,t){this.buffer=e,this.meta=t}}class le{constructor(e,t){this.vao=e,this.lod=t}}class de{constructor(e,t){this.modelMatrix=e,this.origin=t}}class he{constructor(e,t,r,s,n,i,o,a){this.regular=e,this.silhouette=t,this.statistics=r,this.transform=s,this.edgeTransparency=n,this.objectTransparency=i,this.components=o,this.rendererKey=a,this.distanceToCamera=0,this.visible=!0}}class ue extends he{}function me(e){const{meta:t,buffer:r}=e,s=new Uint8Array(4);for(let n=0;n<t.length;n++){const e=t[n].material,o=t[n].index,a=i(Math.round(e.size*W),0,255),c=i(e.extensionLength,-128,255-z)+z,l=255*e.opacity,d=e.color,h=255*d[0],u=255*d[1],m=255*d[2],g=255*d[3];r.textureBuffer.setData(o,0,h,u,m,g),r.textureBuffer.setData(o,1,a,c,e.type,l),T(t[n].verticalOffset,s),r.textureBuffer.setData(o,2,s[0],s[1],s[2],s[3])}}function ge(e,t,r){let s,n;const i=r.transparency,o=t.camera.perScreenPixelRatio;e.forEachRenderable((i=>{if(!pe(i)||!i.visible)return;s??=e.acquireTechnique(t,!1),n??=e.rctx.bindTechnique(s,t,r);const a=ye(i.regular.lod.lengths,i.distanceToCamera,o);e.renderRegularEdges(n,i,r,t,a)}),i),s?.release()}function fe(e,t,r){let s,n;const i=r.transparency,o=t.camera.perScreenPixelRatio;e.forEachRenderable((i=>{if(!be(i)||!i.visible)return;s??=e.acquireTechnique(t,!0),n??=e.rctx.bindTechnique(s,t,r);const a=ye(i.silhouette.lod.lengths,i.distanceToCamera,o);e.renderSilhouetteEdges(n,i,r,t,a)}),i),s?.release()}function pe(e){return null!=e.regular}class _e extends he{}function be(e){return null!=e.silhouette}function ye(e,t,r){const n=t*r,i=s(e,n,!0);return-1===i?n<e[0]?e.length:0:e.length-i}class je{constructor(e,t,r){this.position=e,this.modelTransform=t,this.origin=r}}const Oe=f(),we=()=>Promise.reject();export{ne as EdgeView,de as LegacyTransform,ue as RegularRenderable,he as Renderable,_e as SilhouetteRenderable};
@@ -2,17 +2,17 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{ShaderOutput as o,isColorEmission as r,isColorOrColorEmission as l}from"../core/shaderLibrary/ShaderOutput.js";import{Emissions as t}from"../core/shaderLibrary/output/Emissions.glsl.js";import{OutputHighlight as i}from"../core/shaderLibrary/output/OutputHighlight.glsl.js";import{alphaCutoff as a}from"../core/shaderLibrary/util/AlphaCutoff.js";import{ColorConversion as s}from"../core/shaderLibrary/util/ColorConversion.glsl.js";import{glsl as e,If as u}from"../core/shaderModules/interfaces.js";import{OITPass as n}from"../lib/OITPass.js";function p(p,d){p.include(i,d),p.include(t,d),p.fragment.include(s);const f=d.output===o.ObjectAndLayerIdColor,c=r(d.output)&&d.oitPass!==n.ColorAlpha,m=l(d.output)&&d.oitPass===n.ColorAlpha,g=l(d.output)&&d.oitPass!==n.ColorAlpha,h=d.discardInvisibleFragments;let C=0;(g||c||m)&&p.outputs.add("fragColor","vec4",C++),c&&p.outputs.add("fragEmission","vec4",C++),m&&p.outputs.add("fragAlpha","float",C++),p.fragment.code.add(e`
5
+ import{ShaderOutput as o,isColorEmission as r,isColorOrColorEmission as l}from"../core/shaderLibrary/ShaderOutput.js";import{Emissions as t}from"../core/shaderLibrary/output/Emissions.glsl.js";import{OutputHighlight as i}from"../core/shaderLibrary/output/OutputHighlight.glsl.js";import{alphaCutoff as a}from"../core/shaderLibrary/util/AlphaCutoff.js";import{ColorConversion as s}from"../core/shaderLibrary/util/ColorConversion.glsl.js";import{glsl as e,If as u}from"../core/shaderModules/interfaces.js";import{OITPass as n}from"../lib/OITPass.js";function p(p,d){p.include(i,d),p.include(t,d),p.fragment.include(s);const f=d.output===o.ObjectAndLayerIdColor,c=r(d.output)&&d.oitPass!==n.ColorAlpha,m=l(d.output)&&d.oitPass===n.ColorAlpha,C=l(d.output)&&d.oitPass!==n.ColorAlpha,g=d.discardInvisibleFragments;let h=0;(C||c||m)&&p.outputs.add("fragColor","vec4",h++),c&&p.outputs.add("fragEmission","vec4",h++),m&&p.outputs.add("fragAlpha","float",h++),p.fragment.code.add(e`
6
6
  void outputColorHighlightOID(vec4 finalColor, const in vec3 vWorldPosition) {
7
7
  ${u(f,"finalColor.a = 1.0;")}
8
8
 
9
- ${u(h,`if (finalColor.a < ${e.float(a)}) { discard; }`)}
9
+ ${u(g,`if (finalColor.a < ${e.float(a)}) { discard; }`)}
10
10
 
11
11
  finalColor = applySlice(finalColor, vWorldPosition);
12
12
  ${u(m,e`fragColor = premultiplyAlpha(finalColor);
13
13
  fragAlpha = finalColor.a;`)}
14
- ${u(g,"fragColor = finalColor;")}
15
- ${u(c,"fragEmission = getEmissions();")}
14
+ ${u(C,"fragColor = finalColor;")}
15
+ ${u(c,"fragEmission = finalColor.a * getEmissions();")}
16
16
  calculateOcclusionAndOutputHighlight();
17
17
  ${u(f,"outputObjectAndLayerIdColor();")}
18
18
  }
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import t from"../Camera.js";import"../geometry.js";import i from"../Viewpoint.js";import r from"../core/Collection.js";import{byId as s}from"../core/domUtils.js";import n from"../core/Error.js";import{on as a}from"../core/events.js";import{makeHandle as o,handlesGroup as l}from"../core/handleUtils.js";import has from"../core/has.js";import p from"../core/Logger.js";import{destroyMaybe as h,maybeProperty as d}from"../core/maybe.js";import{ObservableChangesType as c}from"../core/ObservableChangesType.js";import{throwIfAborted as u}from"../core/promiseUtils.js";import{on as g,watch as m,initial as y,syncAndInitial as f,whenOnce as w,sync as v}from"../core/reactiveUtils.js";import{setFrameDuration as _}from"../core/scheduling.js";import{createScreenPoint as b,createScreenPointArray as M}from"../core/screenUtils.js";import{getMetersPerUnitForSR as S}from"../core/unitUtils.js";import{initialize as V}from"../core/workers/workers.js";import{property as j}from"../core/accessorSupport/decorators/property.js";import{cast as R}from"../core/accessorSupport/decorators/cast.js";import"../core/RandomLCG.js";import{subclass as C}from"../core/accessorSupport/decorators/subclass.js";import{ensureType as T,ensureClass as O}from"../core/accessorSupport/ensureType.js";import{overrideDefaultsFrom as x}from"../core/accessorSupport/overrideDefaultsFrom.js";import{create as E}from"../core/libs/gl-matrix-2/factories/vec3f64.js";import{owningCollectionProperty as L}from"../core/support/OwningCollection.js";import H from"../geometry/HeightModelInfo.js";import{canProjectWithoutEngine as A,project as P}from"../geometry/projection.js";import{projectBoundingRect as I}from"../geometry/projection/projectBoundingRect.js";import{projectPointToVector as G}from"../geometry/projection/projectPointToVector.js";import{create as D,toExtent as U}from"../geometry/support/aaBoundingRect.js";import{B as F,a as W}from"../chunks/boundedPlane.js";import{renderSRFromViewSR as k}from"../geometry/support/coordinateSystem.js";import{getResolutionForScale as q}from"../geometry/support/scaleUtils.js";import{isImageryTileLayer as z,isTiledLayer as B,isVoxelLayer as N,isIntegratedMeshLayer as Q}from"../layers/support/layerUtils.js";import{AnalysesCollection as Y}from"../support/AnalysesCollection.js";import{BreakpointsOwner as Z}from"./BreakpointsOwner.js";import{DOMContainer as $}from"./DOMContainer.js";import J from"./GroundView.js";import{PopupView as K}from"./PopupView.js";import X from"./View.js";import ee from"./ViewAnimation.js";import{ViewingMode as te,stringFromViewingMode as ie,viewingModeFromString as re}from"./ViewingMode.js";import{layerView3DImporter as se}from"./3d/layerViewModuleImportUtils.js";import ne from"./3d/analysis/AnalysisViewManager3D.js";import{Constraints as ae}from"./3d/constraints/Constraints.js";import{EnvironmentManager as oe}from"./3d/environment/EnvironmentManager.js";import le from"./3d/environment/SceneViewEnvironment.js";import pe from"./3d/input/SceneInputManager.js";import{GraphicsDeconflictor as he}from"./3d/layers/graphics/GraphicsDeconflictor.js";import{Labeler as de}from"./3d/layers/graphics/Labeler.js";import{FeatureTileTree3D as ce}from"./3d/layers/support/FeatureTileTree3D.js";import ue from"./3d/state/ViewState.js";import{ViewStateManager as ge}from"./3d/state/ViewStateManager.js";import{SceneIntersectionHelper as me}from"./3d/state/helpers/SceneIntersectionHelper.js";import{CombinedElevationProvider as ye}from"./3d/support/CombinedElevationProvider.js";import{debugFlags as fe}from"./3d/support/debugFlags.js";import we from"./3d/support/DisplayQualityProfile.js";import{getElevationAtPoint as ve}from"./3d/support/ElevationProvider.js";import{makeDefaultHighlightGroups as _e,HighlightGroup as be}from"./3d/support/HighlightGroup.js";import Me from"./3d/support/HighlightOptions.js";import{toMap as Se,hitTest as Ve}from"./3d/support/hitTest.js";import{popupHitTest as je}from"./3d/support/popupHitTest.js";import Re from"./3d/support/QualitySettings.js";import{RenderCoordsHelper as Ce}from"./3d/support/RenderCoordsHelper.js";import{newResourceController as Te}from"./3d/support/ResourceController.js";import Oe from"./3d/support/SceneViewPerformanceInfo.js";import{SharedSymbolResources as xe}from"./3d/support/SharedSymbolResources.js";import{TextureCollection as Ee}from"./3d/support/TextureCollection.js";import{PointsOfInterest as Le}from"./3d/support/pointsOfInterest/PointsOfInterest.js";import He from"./3d/terrain/TerrainSurface.js";import{isSurfaceLayerView as Ae,getTiledLayerInfo as Pe,checkIfTileInfoSupportedForView as Ie}from"./3d/terrain/terrainUtils.js";import{Stage as Ge}from"./3d/webgl-engine/Stage.js";import{olidEnabled as De}from"./3d/webgl-engine/effects/geometry/olidUtils.js";import{defaultTolerance as Ue}from"./3d/webgl-engine/lib/Intersector.js";import{terrainId as Fe}from"./3d/webgl-engine/lib/verticalOffsetUtils.js";import{defaultHighlightName as We}from"./support/HighlightDefaults.js";import{occludeesSupported as ke}from"./support/layerViewUtils.js";import{PropertiesPool as qe}from"./support/PropertiesPool.js";import{isSupportedScreenPointEvent as ze,createScreenPointFromSupportedEvent as Be}from"./support/screenUtils.js";import{isSpatialReferenceSupported as Ne}from"./support/spatialReferenceSupport.js";import{initializeTextureCompressionWorker as Qe,destroyTextureCompressionWorker as Ye}from"./support/TextureCompressionHelper.js";import{check as Ze}from"./support/WebGLRequirements.js";import $e from"./ui/DefaultUI.js";import Je from"./ui/3d/DefaultUI3D.js";import Ke from"../webscene/Environment.js";import Xe from"../geometry/Extent.js";import et from"../geometry/SpatialReference.js";import tt from"../geometry/Point.js";let it=class extends(Z(K($(X)))){constructor(e){super(e),this._userClippingArea=null,this._clippingArea=null,this._initialDefaultSpatialReference=null,this._overrideDefaultEnvironmentOnly=!0,this._createGraphicsViewController=null,this._resolveWhenReady=[],this._propertiesPool=new qe({slicePlane:F},this),this._resourceController=Te(this),this._defaultToMapOptions={include:new Set},this._defaultHitTestOptions={exclude:new Set},this.deconflictor=new he({view:this}),this.labeler=new de({view:this,deconflictor:this.deconflictor.labels}),this.sharedSymbolResources=null,this.analyses=new Y,this.basemapTerrain=null,this.elevationProvider=null,this.canvas=null,this.constraints=new ae,this.environment=new le,this.environmentManager=new oe,this.floors=new r,this.fullOpacity=1,this.graphicsView=null,this.analysisViewManager=new ne({view:this}),this.groundView=null,this.map=null,this.screenSizePerspectiveEnabled=!0,this.state=new ue({view:this}),this.spatialReference=null,this.alphaCompositingEnabled=!1,this.preserveDrawingBufferEnabled=!1,this.supersampleScreenshotsEnabled=!0,this.type="3d",this.ui=new Je,this._numUpdating=0,this._lastUpdateTime=0,this.updatingProgress=.5,this.highlights=_e(),this.focusAreaView=null,V();const t=(e=null)=>{null!=e&&e.type===c.MOVE||(this._updatingChanged(),this.map&&this.map.allLayers.forEach((async e=>{try{await e.when()}catch{}this._updatingChanged()})))};this.addHandles([g((()=>this.map?.allLayers),"after-changes",(e=>t(e)),{onListenerAdd:()=>t(),onListenerRemove:()=>t(),sync:!0}),this.allLayerViews.on("after-changes",(e=>this._updateUpdatingMonitors(e))),m((()=>this.map),(e=>{e&&"load"in e&&e.load&&e.load().catch((()=>{}))}))]),this.inputManager=new pe({view:this}),this.stateManager=new ge({view:this})}initialize(){if(has("enable-feature:esri-compress-textures")){const e=Qe(this,this.resourceController);this.addResolvingPromise(e.promise)}this.groundView=new J({view:this}),this._updateUpdatingMonitors();const e=()=>this._updateDefaultToMapOptions();this.addHandles(g((()=>this.map?.allLayers),"after-changes",e,{onListenerAdd:e,onListenerRemove:e})),this.updatingHandles.add((()=>this.qualitySettings.memoryLimit),(e=>{this.resourceController&&(this.resourceController.memoryController.maxMemory=e)}),y),this.updatingHandles.add((()=>this.qualitySettings.additionalCacheMemory),(e=>{this.resourceController&&(this.resourceController.memoryController.additionalCacheMemory=e)}),y),this.updatingHandles.add((()=>this.qualitySettings.frameRate??0),(e=>_(e>0?1e3/Math.ceil(e):0)),y),this.updatingHandles.add((()=>this.map?.ground),e,f),this.updatingHandles.add((()=>this.map?.ground?.opacity),(()=>this._updateDefaultHitTestOptions()),f),this.addHandles(m((()=>this.spatialReference),(()=>this.notifyChange("clippingArea")),v))}destroy(){this.destroyed||(Ye(this),this.updatingHandles.removeAll(),this.invalidate(),this.activeTool=null,this.layerViewManager.clear(),this._set("analysisViewManager",h(this.analysisViewManager)),this._exitSurface(),this._disposeGraphicsView(),this.sharedSymbolResources=h(this.sharedSymbolResources),this._set("labeler",h(this.labeler)),this._set("deconflictor",h(this.deconflictor)),this._resourceController=h(this._resourceController),this._set("stateManager",h(this.stateManager)),this._set("inputManager",h(this.inputManager)),this.state.destroy(),this.highlights.destroy(),this._propertiesPool.destroy(),this.removeHandles("updatingMonitors"),this._set("environmentManager",h(this.environmentManager)),this._set("environment",h(this.environment)),this.groundView=h(this.groundView),this._exitBasemapTerrain(),this._stage?.destroy())}get renderSpatialReference(){return this.renderCoordsHelper&&this.renderCoordsHelper.spatialReference}get basemapSpatialReference(){return this.basemapTerrain?.spatialReference}get animation(){return this.state?.animation}get camera(){return this.stateManager?.camera}set camera(e){this.stateManager&&(this.stateManager.camera=e)}get contentCamera(){return this.stateManager?.contentCamera}set contentCamera(e){this.stateManager&&(this.stateManager.contentCamera=e)}installContentCameraReset(e={sticky:!1}){return this.stateManager.installContentCameraReset(e)}get center(){return this.stateManager?.center}set center(e){this.stateManager&&(this.stateManager.center=e)}get clippingArea(){if("global"===this.viewingMode)return null;const e=this.map;let t=this._userClippingArea||d(e,"clippingArea");return!this._userClippingArea&&!d(e,"clippingEnabled")||null==t?(this._clippingArea=null,null):t instanceof Xe?this.spatialReference&&(t=rt(t,this.spatialReference),null==t)?(p.getLogger(this).error("#clippingArea","setting clippingArea with incompatible SpatialReference"),this._clippingArea):(t=t.clone(),null==t.intersection(this._groundAndLayersExtent)&&(t.xmin=t.xmax,t.ymin=t.ymax),t.zmin=void 0,t.zmax=void 0,t.equals(this._clippingArea)||(this._clippingArea=t),this._clippingArea):(p.getLogger(this).error("#clippingArea","only clippingArea geometries of type Extent are supported"),this._clippingArea)}set clippingArea(e){this.ready&&"global"===this.viewingMode&&null!=e?p.getLogger(this).error("#clippingArea=","Clipping area is only supported in local viewingMode"):this._userClippingArea=e}get renderDataExtent(){if(this.state.viewingMode===te.Global)return null;const e=this.renderSpatialReference,t=this.dataExtent;return null==t||null==e||t.spatialReference.equals(e)?t:rt(t,e)}get tileInfo(){return this.basemapTerrain?.tilingScheme?.toTileInfo()}get dataExtent(){let e=this._groundAndLayersExtent;const t=this.spatialReference||et.WGS84,i=rt(this.clippingArea,t);null!=i&&(e=null!=e?e.intersection(i):i);const r=this._get("dataExtent");return null!=e&&e.equals(r)?r:e}get _groundAndLayersExtent(){const e=this.spatialReference||et.WGS84;let t;const i=i=>{const r=rt(i,e);null!=r&&(null!=t?t.union(r):t=r.clone())},r=this.basemapTerrain;if(r?.spatialReference){const e=r.groundExtent;i(new Xe({xmin:e[0],ymin:e[1],zmin:0,xmax:e[2],ymax:e[3],zmax:0,spatialReference:r.spatialReference}))}if(this.map){const e=e=>{null==e.fullExtent||"graphics"===e.type&&e.internal||i(e.fullExtent)};this.map.allLayers.forEach((t=>e(t)))}if(null==t)return null;t.hasZ?(t.zmin=Math.min(0,t.zmin??0),t.zmax=Math.max(0,t.zmax??0)):(t.zmin=0,t.zmax=0);const s=this._get("_groundAndLayersExtent");return t.equals(s)?s:t}castEnvironment(e){return e?e instanceof le?e:e instanceof Ke?this.environment?.cloneWithWebsceneEnvironment(e)??le.fromWebsceneEnvironment(e):T(le,e):new le}get extent(){return this.stateManager?.extent}set extent(e){this.stateManager&&(this.stateManager.extent=e)}get screenCenter(){return this.stateManager?.screenCenter}get frustum(){return this.stateManager?.frustum}get initialExtentRequired(){return this.stateManager&&!this.stateManager.hasInitialView}get defaultsFromMapSettings(){return{required:{tileInfo:!1,heightModelInfo:!0,extent:!1}}}get interacting(){return this.navigating||(this.toolViewManager?.interacting??!1)}get stationary(){return!this.animation&&!this.resizing&&(this.state?.stationary??!0)}get navigating(){return this.state?.navigating??!1}get padding(){return this.stateManager?.padding}set padding(e){this.stateManager&&(this.stateManager.padding=e)}set qualityProfile(e){we.isValidProfile(e)&&(we.apply(e,this.qualitySettings),this._set("qualityProfile",e))}get qualityProfile(){return this._get("qualityProfile")||we.getDefaultProfile()}set slicePlane(e){if(null!=this._stage&&(this._stage.renderer.slicePlane=e),null==e)return void this._set("slicePlane",null);const t=this._propertiesPool.get("slicePlane");W(e,t),this._set("slicePlane",t)}get typeSpecificPreconditionsReady(){return!!this.viewingMode&&!!this.stateManager?.preinit(this.spatialReference)}get resolution(){return null!=this.spatialReference?q(this.scale,this.spatialReference):0}get scale(){return this.stateManager?.scale}set scale(e){this.stateManager&&(this.stateManager.scale=e)}get heightModelInfo(){const e=this.getDefaultHeightModelInfo();return null!=e?H.deriveUnitFromSR(e,this.spatialReference):null}get updating(){if(this.destroyed)return!1;let e=0,t=this.layerViewManager.updating,i=t?this.layerViewManager.updatingRemaining:0;this.allLayerViews.forEach((r=>{if(r.isFulfilled()){if(r.updating){if(t=!0,r.suspended||Ae(r))return;++i,e+=r.updatingProgress}}else++i}));for(const s of this._updatingObjects)if(null!=s&&s.updating){const t=.1;i+=t,e+=.5*t}for(const s of this._updatingObjectsWithProgress)null!=s&&s.updating&&(++i,e+=s.updatingProgress);const r=!this.stateManager.test.updatingIgnoreRenderState&&this.state.updating;if(t=!!(t||i>0||this.updatingHandles.updating||!this.ready||!this.stationary||r||this._createGraphicsViewController||this.inputManager?.updating||this.map?.allLayers?.some((e=>!e.isFulfilled()))||this.textures?.updating),t?(this._numUpdating=Math.max(i,this._numUpdating),e+=this._numUpdating-i):this._numUpdating=0,this._numUpdating>0?e/=this._numUpdating:e=t?0:1,this._get("updatingProgress")!==e){const i=performance.now();if(e<1){const t=Math.min((i-this._lastUpdateTime)/2e3,1);e=this.updatingProgress*(1-t)+e*t}this._set("updatingProgress",e),this._lastUpdateTime=t&&e<1?i:0}return t}get _updatingObjects(){return[this.graphicsView,this.basemapView,this._resourceController,this._stage,this.featureTiles,this.pointsOfInterest,this.environmentManager,this.overlay,this._featureTreeDebugger,this.toolViewManager,this.analysisViewManager]}get _updatingObjectsWithProgress(){return[this.deconflictor,this.labeler,this.basemapTerrain]}get viewingMode(){const e=this._predeterminedViewingMode;if(null!=e)return ie(e);const t=this.spatialReference;return t?null!=this.defaultsFromMap?.viewingMode&&t.equals(this.defaultsFromMap.spatialReference)?ie(this.defaultsFromMap.viewingMode):Ne(t,te.Global)?"global":"local":"global"}set viewingMode(e){this.ready?p.getLogger(this).error("#viewingMode","viewingMode cannot be set once view is ready"):this._overrideIfSome("viewingMode",e)}get viewpoint(){return this.stateManager?.viewpoint}set viewpoint(e){this.stateManager&&(this.stateManager.viewpoint=e)}get visibleArea(){return this.stateManager?.visibleArea}get zoom(){return this.stateManager.zoom}set zoom(e){this.stateManager&&(this.stateManager.zoom=e)}get highlightOptions(){return this.highlights.find((({name:e})=>e===We))?.options??new Me}set highlightOptions(e){for(const t of this.highlights)if(t.name===We)return void(t.options=e)}get resourceController(){return this._resourceController}get quality(){return this._resourceController?.memoryController?.memoryFactor??1}get resolutionScale(){return Math.sqrt(Math.min(1,this.quality/.75))}get performanceInfo(){return new Oe(this)}on(e,t,i,r){const s=this.viewEvents.on(e,t,i,r);return s||super.on(e,t)}hasEventListener(e){return super.hasEventListener(e)||this.viewEvents.hasHandler(e)}toMap(e,t){if(!this.ready)return p.getLogger(this).error("#toMap()","Scene view cannot be used before it is ready"),null;const i=ze(e)?Be(this,e):e;return Se(this,i,t,this._defaultToMapOptions)}toScreen(e){if(!this.ready)return p.getLogger(this).error("#toScreen()","Scene view cannot be used before it is ready"),null;const t=(null==e.z?ve(this.elevationProvider,e):null)??0;return G(e,st,this.renderSpatialReference,t),this.state.camera.projectToScreen(st,nt),b(nt[0],nt[1])}pixelSizeAt(e,t){if(!this.ready)return p.getLogger(this).error("#pixelSizeAt()","Scene view cannot be used before it is ready"),null;if(!e)return 0;const i=this.renderSpatialReference;G(e,st,i);const r=this.state.camera.computeScreenPixelSizeAt(st);return t&&i!==t?r*S(i)/S(t):r}overlayPixelSizeInMapUnits(e){const t=this.basemapTerrain.overlayManager;return t?t.overlayPixelSizeInMapUnits(e,(()=>this.pixelSizeAt(e))):1}hitTest(e,t){if(!this.ready)return p.getLogger(this).error("#hitTest()","Scene view cannot be used before it is ready"),null;const i=ze(e)?Be(this,e):e;return Ve(this,i,t,this._defaultHitTestOptions)}async popupHitTest(e){return je(this,e)}goTo(e,t){return this.updatingHandles.addPromise(this.stateManager.goTo(e,t))}async whenAnalysisView(e){if(null==e.parent)throw new n("view:no-analysisview-for-analysis","The analysis has not been added to view.analyses",{analysis:e});switch(e.parent.type){case"line-of-sight":case"dimension":case"viewshed":return(await this.whenLayerView(e.parent)).whenAnalysisView();default:return this.analysisViewManager.whenAnalysisView(e)}}whenLayerView(e){return super.whenLayerView(e)}async takeScreenshot(e){const t=await this._completeSettings(e);await this.whenReady();const i=await this._stage.renderView.takeScreenshot(t);return(await import("./support/screenshotUtils.js")).encode(i,t,this._pixelFormat())}async _takeScreenshot(e){const t=await this._completeSettings(e);await this.whenReady();const i=await this._stage.renderView.takeScreenshot(t);return(await import("./support/screenshotUtils.js")).encodeData(i,this._pixelFormat())}async _takeScreenshotWithObjectAndLayerId(e){const t=await this._completeSettings(e);await this.whenReady();const i=await this._stage.renderView.takeScreenshotWithOID(t),{encodeData:r}=await import("./support/screenshotUtils.js");return[r(i[0],this._pixelFormat()),r(i[1],this._pixelFormat())]}async _completeSettings(e){const{toRenderSettings:t,screenshotSuperSampleSettings:i}=await import("./support/screenshotUtils.js"),r=t(e,this);return r.pixelRatio/=this.state.pixelRatio,i(r,this.supersampleScreenshotsEnabled,this.padding)}_pixelFormat(){return{flipY:!0,premultipliedAlpha:this._stage.renderView.getAlpha()}}get test(){}async takeScreenshotWithObjectAndLayerId(e){if(!De())throw new n("360vr:objectAndLayerId-rendering-disabled","has enable-feature:objectAndLayerId-rendering must be true");const{encode:t}=await import("./support/screenshotUtils.js"),i=await this._completeSettings(e);await this.whenReady();const r=await this._stage.renderView.takeScreenshotWithOID(i),s=t(r[0],i,this._pixelFormat()),a=await this._completeSettings(e);a.format="png";return[s,t(r[1],a,this._pixelFormat())]}getColorToObjectAndLayerIdMapping(){const e=this._stage.renderView.olidRenderHelper;if(e)return e.getColorToObjectAndLayerIdMapping();throw new n("360vr:objectAndLayerId-rendering-disabled","has enable-feature:objectAndLayerId-rendering must be true")}addUpdatingPromise(e){return this.updatingHandles.addPromise(e)}importLayerView(e){return se.importLayerView(e)}hasLayerViewModule(e){return se.hasLayerViewModule(e)}forceDOMReadyCycle(){this.forceReadyCycle()}getDefaultSpatialReference(){return this.map&&"initialViewProperties"in this.map&&this.map.initialViewProperties?.spatialReference||this.defaultsFromMap?.spatialReference||this.defaultsFromMap?.ready&&this._initialDefaultSpatialReference||null}async validate(){let e=Ze(this.type);const t=has("safari");if(t&&t<9&&(e=new n("sceneview:browser-not-supported","This browser is not supported by SceneView (Safari < 9)",{type:"safari",requiredVersion:9,detectedVersion:t})),null!=e)throw p.getLogger(this).warn("#validate()",e.message),e}get _predeterminedViewingMode(){const e=this._isOverridden("viewingMode")?this._get("viewingMode"):(this.map&&"initialViewProperties"in this.map?this.map.initialViewProperties?.viewingMode:null)??null;return null!=e?re(e):null}getSpatialReferenceSupport(e,t){const i=this._predeterminedViewingMode;if(null!=i)return this._validateSpatialReferenceForViewingMode(e,t,i)?{constraints:this._makeSpatialReferenceConstraints(e,t,i)}:null;const r=this._validateSpatialReferenceForViewingMode(e,t,te.Local),s=this._validateSpatialReferenceForViewingMode(e,t,te.Global);return r||s?r&&s?{constraints:this._makeSpatialReferenceConstraints(e,t,null)}:r?{constraints:this._makeSpatialReferenceConstraints(e,t,te.Local)}:{constraints:this._makeSpatialReferenceConstraints(e,t,te.Global)}:null}_validateSpatialReferenceForViewingMode(e,t,i){return!!Ne(e,i)&&(null==t||(!!z(t)||(!B(t)||null!=Pe(t,e,i))&&(!N(t)||i!==te.Global)))}_makeSpatialReferenceConstraints(e,t,i){if(null==t)return[{spatialReference:e,viewingMode:i}];const{isWebMercator:r,isWGS84:s}=e;if(z(t)&&(r||s)){return!s||i===te.Local||null===Ie(t.tileInfo,t.fullExtent,e,te.Global)?[{spatialReference:e,viewingMode:i},{spatialReference:et.WebMercator,viewingMode:i}]:[{spatialReference:r?et.WGS84:et.WebMercator,viewingMode:i}]}return B(t)||N(t)||!r&&!s?B(t)&&r&&i!==te.Global?[{spatialReference:e,viewingMode:i},{spatialReference:et.WGS84,viewingMode:te.Local}]:[{spatialReference:e,viewingMode:i}]:[{spatialReference:e,viewingMode:i},{spatialReference:r?et.WGS84:et.WebMercator,viewingMode:i}]}_validateSpatialReference(e){const t=null!=this.getSpatialReferenceSupport(e),i=this._predeterminedViewingMode;return t||(null!=i?p.getLogger(this).warnOnce(`Spatial reference defined on view not supported in ${ie(i)} viewing mode.`):e.isGeographic&&p.getLogger(this).warnOnce("Spatial reference is geographic but not supported.")),t}whenReady(){return new Promise((e=>{this.ready?e(this):this._resolveWhenReady.push(e)}))}trackGraphicState(e){if(!e.graphic)return p.getLogger(this).error("trackGraphicState","GraphicState.graphic must not be null or undefined to start tracking"),null;const t=this.getViewForGraphic(e.graphic);let i=null,r=!1;const s=t=>{!r&&null!=t&&"processor"in t&&"graphics-3d"===t.processor?.type&&t.processor.graphicsCore&&(i=t.processor.graphicsCore.trackGraphicState(e))};return null!=t?s(t):this.whenViewForGraphic(e.graphic,{waitForLayer:!0}).then((e=>s(e)),(()=>{})).catch((()=>{})),o((()=>{r=!0,null!=i&&(i.remove(),i=null)}))}highlight(e){if(Array.isArray(e))return l(e.map((e=>this.highlight(e))));if(r.isCollection(e))return l(e.toArray().map((e=>this.highlight(e))));const t=this.getViewForGraphic(e);return t&&"highlight"in t?t.highlight(e):o()}maskOccludee(e){if(!e)return p.getLogger(this).error("maskOccludee","GraphicState.graphic must not be null or undefined to mask an occludee"),null;const t=this.getViewForGraphic(e);let i=null,r=!1;const s=t=>{!r&&null!=t&&ke(t)&&(i=t.maskOccludee(e))};return null!=t?s(t):this.whenViewForGraphic(e,{waitForLayer:!0}).then((e=>s(e)),(()=>{})).catch((()=>{})),o((()=>{r=!0,null!=i&&(i.remove(),i=null)}))}getViewForGraphic(e){return e.layer===this.graphics?this.graphicsView:e.layer?this.allLayerViews.find((t=>t.layer===e.layer)):null}graphicChanged(e){null!=this.graphicsView&&this.graphicsView.graphicChanged(e)}async whenViewForGraphic(e,t){if(e.layer===this)return await w((()=>this.graphicsView)),this.graphicsView;if(!e.layer||!this.map)throw new n("no-view-for-graphic");return t&&t.waitForLayer&&!this.map.allLayers.includes(e.layer)?new Promise(((t,i)=>{const r=this.map.allLayers.on("change",(s=>{s.added.includes(e.layer)&&(r.remove(),this.whenLayerView(e.layer).then(t,i))}))})):this.whenLayerView(e.layer)}_initBasemapTerrain(){this._set("basemapTerrain",new He({view:this})),this._set("elevationProvider",new ye({view:this})),this.elevationProvider.register("ground",this.basemapTerrain)}_exitBasemapTerrain(){this.basemapTerrain&&(this.elevationProvider.unregister(this.basemapTerrain),this.elevationProvider.destroy(),this._set("elevationProvider",null),this.basemapTerrain.destroy(),this._set("basemapTerrain",null))}_initGlobe(){this._initCoordinateSystem(),this.state.createInitialCamera(),this._initBasemapTerrain(),this._set("pointsOfInterest",new Le({view:this})),this._set("featureTiles",new ce({renderCoordsHelper:this.renderCoordsHelper,cameraOnSurface:this.pointsOfInterest.cameraOnSurface,focus:this.pointsOfInterest.focus,tilingSchemeOwner:this.basemapTerrain,viewState:this.state,scheduler:this._resourceController.scheduler,terrain:this.basemapTerrain}));const e=()=>{const e=this.basemapTerrain?.extent;if(this.clippingArea||e)if(e&&this.basemapTerrain.spatialReference){const e=null!=this.basemapTerrain.extent&&null!=this.basemapTerrain.spatialReference?P(U(this.basemapTerrain.extent,this.basemapTerrain.spatialReference),this.spatialReference):null;this.clippingArea?this.featureTiles.filterExtent=this.clippingArea.intersection(e):this.featureTiles.filterExtent=e}else this.featureTiles.filterExtent=this.clippingArea;else this.featureTiles.filterExtent=null};this.addHandles([this.updatingHandles.add((()=>fe.FEATURE_TILE_TREE_SHOW_TILES),(e=>{e&&this.featureTiles&&!this._featureTreeDebugger?this.updatingHandles.addPromise(import("./3d/layers/support/FeatureTileTree3DDebugger.js")).then((({FeatureTileTree3DDebugger:e})=>{!this._featureTreeDebugger&&fe.FEATURE_TILE_TREE_SHOW_TILES&&(this._featureTreeDebugger=new e({view:this}))})):e||!this._featureTreeDebugger||fe.FEATURE_TILE_TREE_SHOW_TILES||(this._featureTreeDebugger.destroy(),this._featureTreeDebugger=null)}),f),this.updatingHandles.add((()=>this.clippingArea),e,f),this.updatingHandles.add((()=>this.basemapTerrain.extent),e,f)],"feature-tiles"),this.stateManager.init()}_exitGlobe(){this.featureTiles&&(this.stateManager.exit(),this.removeHandles("render-coords-helper"),this.removeHandles("feature-tiles"),this._set("featureTiles",h(this.featureTiles)),this._set("pointsOfInterest",h(this.pointsOfInterest)),this._exitBasemapTerrain(),this.state.reset(),this._exitCoordinateSystem())}_initCoordinateSystem(){if(this.spatialReference){const e=this.spatialReference,t=this.state.isGlobal,i=k(t,e);i!==this.renderSpatialReference&&(this._set("renderCoordsHelper",Ce.create(this.state.viewingMode,i)),t||this.addHandles(m((()=>this.basemapTerrain?.extent),(e=>{const t=this.renderCoordsHelper.spatialReference;null==e||0===e[0]&&0===e[1]&&0===e[2]&&0===e[3]||!I(e,this.basemapTerrain.spatialReference,at,t)||(this.renderCoordsHelper.extent=at)}),v),"render-coords-helper"),this.sceneIntersectionHelper&&this.sceneIntersectionHelper.setTolerance(Ue/this.renderCoordsHelper.unitInMeters))}else this._set("renderCoordsHelper",null)}_exitCoordinateSystem(){this.removeHandles("render-coords-helper"),this._set("renderCoordsHelper",null)}_updatingChanged(){this.notifyChange("updating")}_updateUpdatingMonitors(e=null){null!=e&&e.type===c.MOVE||(this.removeHandles("updatingMonitors"),this.allLayerViews.forEach((e=>{e.destroyed||(this.addHandles(m((()=>[e.updating,e.updatingProgress]),(()=>this._updatingChanged()),v),"updatingMonitors"),e.when((()=>this._updatingChanged()),(()=>this._updatingChanged())))})),this._updatingChanged())}async _prepareScreenshotOverlay(){this.overlay&&await this.overlay.prepare()}_renderScreenshotOverlay(e,t,i){if(!this.overlay||!this.overlay.hasVisibleItems)return i;const r=e.getContext("2d");return r.putImageData(i,0,0),this.overlay.renderCanvas(e,{disableDecorations:t}),r.getImageData(0,0,i.width,i.height)}_initStage(){const e={deactivatedWebGLExtensions:this.deactivatedWebGLExtensions,debugWebGLExtensions:this.debugWebGLExtensions,alpha:this.alphaCompositingEnabled,preserveDrawingBuffer:this.preserveDrawingBufferEnabled,canvas:this.renderCanvas,screenshot:{prepareOverlay:()=>this._prepareScreenshotOverlay(),renderOverlay:(e,t,i)=>this._renderScreenshotOverlay(e,t,i)}},t=new me(this.state.viewingMode,(e=>this._stage.layers.forAll(e)),this);this._set("sceneIntersectionHelper",t);const i=s(this.surface);this._stage=new Ge({view:this,options:e,container:i}),this._stage.renderer.slicePlane=this.slicePlane,this.addHandles([this.updatingHandles.add((()=>this.qualitySettings.highQualityTransparency),(e=>this._stage.renderer.setParameters({highQualityTransparency:e})),y),this.on("pointer-move",(()=>this._stage?.renderer.resetAnimation())),a(this._stage.renderView.canvas,"webglcontextlost",(e=>{this.fatalError=new n("webgl-context-lost",e.statusMessage)}))],"stage"),this.renderCoordsHelper&&this.sceneIntersectionHelper.setTolerance(Ue/this.renderCoordsHelper.unitInMeters),this._set("canvas",this._stage.renderView.canvas)}_exitStage(){this._set("sceneIntersectionHelper",null),this._stage=h(this._stage),this.removeHandles("stage"),this._set("canvas",null)}_initSurface(e){this._exitSurface(),this._initStage(),this._initGlobe(),this.sharedSymbolResources=new xe({view:this,viewingMode:e,resourceController:this._resourceController,pointsOfInterest:this.pointsOfInterest,viewState:this.state})}_exitSurface(){this.sharedSymbolResources&&(this.sharedSymbolResources.objectResourceCache.destroy(),this.sharedSymbolResources.destroy(),this.sharedSymbolResources=null,this._exitGlobe(),this._exitStage())}_createGraphicsViewIfNeeded(){if(this.graphicsView||this._createGraphicsViewController)return;if(0===this.graphics.length)return;this.removeHandles("graphics-view"),this._createGraphicsViewController=new AbortController;const e=()=>{this._createGraphicsViewController=null,this._updatingChanged()};this._createGraphicsViewAsync(this._createGraphicsViewController.signal).then(e,e),this._updatingChanged()}async _createGraphicsViewAsync(e){const t=(await import("./3d/layers/GraphicsView3D.js")).default;u(e),await w((()=>this.basemapTerrain?.ready),e),this._set("graphicsView",new t({view:this}))}_disposeGraphicsView(){this._createGraphicsViewController&&(this._createGraphicsViewController.abort(),this._createGraphicsViewController=null),this.removeHandles("graphics-view"),null!=this.graphicsView&&(this.removeHandles(this.graphicsView.processor.layer.id),this.graphicsView.destroy(),this._set("graphicsView",null))}_startup(){const e=re(this.viewingMode);e===te.Global&&(this._clippingArea=null),this._initSurface(e),this._set("ready",!0),this.addHandles(g((()=>this.graphics),"after-changes",(()=>this._createGraphicsViewIfNeeded())),"graphics-view"),this._createGraphicsViewIfNeeded();const t=this.map&&"initialViewProperties"in this.map?this.map.initialViewProperties:null,i=t?.environment;i&&(this._overrideDefaultEnvironmentOnly?x(this.environment,i):this.environment=this.environment.cloneWithWebsceneEnvironment(i)),this.timeExtent=t?.timeExtent,this.labeler.setup(),this.environmentManager.connectView(this),this.inputManager.connect(),this._set("textures",new Ee(this._stage,this.resourceController.scheduler));const r=this._resolveWhenReady;this._resolveWhenReady=[],r.forEach((e=>e(this)))}_teardown(){this._initialDefaultSpatialReference=null,this.inputManager.disconnect(),this.environmentManager.disconnectView(),this._overrideDefaultEnvironmentOnly=!1,this.labeler.dispose(),this._disposeGraphicsView(),this.removeHandles("graphics-view"),this._set("textures",h(this.textures)),this._exitSurface(),this._set("ready",!1)}_updateDefaultToMapOptions(){if(this._defaultToMapOptions.include.clear(),this.map){this.map.ground&&this._defaultToMapOptions.include.add(Fe);for(const e of this.map.allLayers.items)Q(e.type)&&this._defaultToMapOptions.include.add(e.uid)}}_updateDefaultHitTestOptions(){if(this._defaultHitTestOptions.exclude.clear(),this.map){this.map.ground&&this.map.ground.opacity<1&&this._defaultHitTestOptions.exclude.add(Fe);for(const e of this.map.allLayers.items)Q(e.type)&&e.opacity<1&&this._defaultHitTestOptions.exclude.add(e.uid)}}};function rt(e,t){return null!=e&&A(e.spatialReference,t)?P(e,t):null}it.type="3d",e([j()],it.prototype,"_userClippingArea",void 0),e([j()],it.prototype,"_resourceController",void 0),e([j()],it.prototype,"_stage",void 0),e([j({readOnly:!0})],it.prototype,"deconflictor",void 0),e([j({readOnly:!0})],it.prototype,"labeler",void 0),e([j(L(Y,"analyses"))],it.prototype,"analyses",void 0),e([j({type:ee,readOnly:!0})],it.prototype,"animation",null),e([j({readOnly:!0})],it.prototype,"basemapTerrain",void 0),e([j({readOnly:!0})],it.prototype,"elevationProvider",void 0),e([j()],it.prototype,"camera",null),e([j({type:t})],it.prototype,"contentCamera",null),e([j({readOnly:!0})],it.prototype,"canvas",void 0),e([j({type:tt})],it.prototype,"center",null),e([j({type:Xe})],it.prototype,"clippingArea",null),e([j({type:ae})],it.prototype,"constraints",void 0),e([j({type:Xe,readOnly:!0})],it.prototype,"renderDataExtent",null),e([j({readOnly:!0})],it.prototype,"tileInfo",null),e([j({type:Xe,readOnly:!0})],it.prototype,"dataExtent",null),e([j({type:Xe,readOnly:!0})],it.prototype,"_groundAndLayersExtent",null),e([j({type:le})],it.prototype,"environment",void 0),e([R("environment")],it.prototype,"castEnvironment",null),e([j({readOnly:!0})],it.prototype,"environmentManager",void 0),e([j({type:Xe})],it.prototype,"extent",null),e([j()],it.prototype,"floors",void 0),e([j()],it.prototype,"screenCenter",null),e([j()],it.prototype,"frustum",null),e([j({type:Number,readOnly:!0})],it.prototype,"fullOpacity",void 0),e([j({readOnly:!0})],it.prototype,"graphicsView",void 0),e([j({readOnly:!0})],it.prototype,"analysisViewManager",void 0),e([j()],it.prototype,"groundView",void 0),e([j({type:Boolean})],it.prototype,"initialExtentRequired",null),e([j()],it.prototype,"defaultsFromMapSettings",null),e([j()],it.prototype,"interacting",null),e([j()],it.prototype,"stationary",null),e([j()],it.prototype,"navigating",null),e([j()],it.prototype,"map",void 0),e([j()],it.prototype,"padding",null),e([j({type:Le,readOnly:!0})],it.prototype,"pointsOfInterest",void 0),e([j({type:ce,readOnly:!0})],it.prototype,"featureTiles",void 0),e([j()],it.prototype,"_featureTreeDebugger",void 0),e([j({type:Boolean})],it.prototype,"screenSizePerspectiveEnabled",void 0),e([j({constructOnly:!0})],it.prototype,"deactivatedWebGLExtensions",void 0),e([j({constructOnly:!0})],it.prototype,"debugWebGLExtensions",void 0),e([j({constructOnly:!0})],it.prototype,"renderCanvas",void 0),e([j({constructOnly:!0})],it.prototype,"state",void 0),e([j({readOnly:!0})],it.prototype,"inputManager",void 0),e([j({readOnly:!0})],it.prototype,"stateManager",void 0),e([j({type:["low","medium","high"]})],it.prototype,"qualityProfile",null),e([j({type:Re,get(){let e=this._get("qualitySettings");return e||(e=new Re,we.apply(this.qualityProfile,e)),e}})],it.prototype,"qualitySettings",void 0),e([j()],it.prototype,"slicePlane",null),e([j({readOnly:!0})],it.prototype,"typeSpecificPreconditionsReady",null),e([j({readOnly:!0})],it.prototype,"renderCoordsHelper",void 0),e([j({readOnly:!0})],it.prototype,"sceneIntersectionHelper",void 0),e([j({type:Number,dependsOn:["scale","spatialReference"],readOnly:!0})],it.prototype,"resolution",null),e([j({type:Number})],it.prototype,"scale",null),e([j()],it.prototype,"heightModelInfo",null),e([j()],it.prototype,"spatialReference",void 0),e([j({type:Boolean,constructOnly:!0})],it.prototype,"alphaCompositingEnabled",void 0),e([j({constructOnly:!0})],it.prototype,"preserveDrawingBufferEnabled",void 0),e([j({type:Boolean})],it.prototype,"supersampleScreenshotsEnabled",void 0),e([j({readOnly:!0})],it.prototype,"type",void 0),e([j(),R((e=>e instanceof $e?e:O(Je,e)))],it.prototype,"ui",void 0),e([j({type:Boolean,readOnly:!0,dependsOn:["graphicsView.updating","basemapView.updating","basemapTerrain.updating","layerViewManager.updating","layerViewManager.updatingRemaining","_resourceController.updating","_stage.updating","featureTiles.updating","pointsOfInterest.updating","environmentManager.updating","overlay.updating","updatingHandles.updating","featureTreeDebugger.updating","labeler.updating","deconflictor.updating","ready","stationary","inputManager.updating","toolViewManager.updating","analysisViewManager.updating","state.updating","textures.updating"]})],it.prototype,"updating",null),e([j()],it.prototype,"_updatingObjects",null),e([j()],it.prototype,"_updatingObjectsWithProgress",null),e([j({type:Number,readOnly:!0,dependsOn:["updating"]})],it.prototype,"updatingProgress",void 0),e([j({type:["global","local"]})],it.prototype,"viewingMode",null),e([j({type:i})],it.prototype,"viewpoint",null),e([j({readOnly:!0})],it.prototype,"visibleArea",null),e([j({type:Number})],it.prototype,"zoom",null),e([j({type:Me})],it.prototype,"highlightOptions",null),e([j({type:r.ofType(be)})],it.prototype,"highlights",void 0),e([j({readOnly:!0})],it.prototype,"quality",null),e([j({readOnly:!0})],it.prototype,"resolutionScale",null),e([j()],it.prototype,"textures",void 0),it=e([C("esri.views.SceneView")],it);const st=E(),nt=M(),at=D(),ot=it;export{ot as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import t from"../Camera.js";import"../geometry.js";import i from"../Viewpoint.js";import r from"../core/Collection.js";import{byId as s}from"../core/domUtils.js";import n from"../core/Error.js";import{on as a}from"../core/events.js";import{makeHandle as o,handlesGroup as l}from"../core/handleUtils.js";import has from"../core/has.js";import p from"../core/Logger.js";import{destroyMaybe as h,maybeProperty as d}from"../core/maybe.js";import{ObservableChangesType as c}from"../core/ObservableChangesType.js";import{throwIfAborted as u}from"../core/promiseUtils.js";import{on as g,watch as m,initial as y,syncAndInitial as f,whenOnce as w,sync as v}from"../core/reactiveUtils.js";import{setFrameDuration as _}from"../core/scheduling.js";import{createScreenPoint as b,createScreenPointArray as M}from"../core/screenUtils.js";import{getMetersPerUnitForSR as S}from"../core/unitUtils.js";import{initialize as V}from"../core/workers/workers.js";import{property as j}from"../core/accessorSupport/decorators/property.js";import{cast as R}from"../core/accessorSupport/decorators/cast.js";import"../core/RandomLCG.js";import{subclass as C}from"../core/accessorSupport/decorators/subclass.js";import{ensureType as T,ensureClass as O}from"../core/accessorSupport/ensureType.js";import{overrideDefaultsFrom as x}from"../core/accessorSupport/overrideDefaultsFrom.js";import{create as E}from"../core/libs/gl-matrix-2/factories/vec3f64.js";import{owningCollectionProperty as L}from"../core/support/OwningCollection.js";import H from"../geometry/HeightModelInfo.js";import{canProjectWithoutEngine as A,project as P}from"../geometry/projection.js";import{projectBoundingRect as I}from"../geometry/projection/projectBoundingRect.js";import{projectPointToVector as G}from"../geometry/projection/projectPointToVector.js";import{create as D,toExtent as U}from"../geometry/support/aaBoundingRect.js";import{B as F,a as W}from"../chunks/boundedPlane.js";import{renderSRFromViewSR as k}from"../geometry/support/coordinateSystem.js";import{getResolutionForScale as q}from"../geometry/support/scaleUtils.js";import{isImageryTileLayer as z,isTiledLayer as B,isVoxelLayer as N,isIntegratedMeshLayer as Q}from"../layers/support/layerUtils.js";import{AnalysesCollection as Y}from"../support/AnalysesCollection.js";import{BreakpointsOwner as Z}from"./BreakpointsOwner.js";import{DOMContainer as $}from"./DOMContainer.js";import J from"./GroundView.js";import{PopupView as K}from"./PopupView.js";import X from"./View.js";import ee from"./ViewAnimation.js";import{ViewingMode as te,stringFromViewingMode as ie,viewingModeFromString as re}from"./ViewingMode.js";import{layerView3DImporter as se}from"./3d/layerViewModuleImportUtils.js";import ne from"./3d/analysis/AnalysisViewManager3D.js";import{Constraints as ae}from"./3d/constraints/Constraints.js";import{EnvironmentManager as oe}from"./3d/environment/EnvironmentManager.js";import le from"./3d/environment/SceneViewEnvironment.js";import pe from"./3d/input/SceneInputManager.js";import{GraphicsDeconflictor as he}from"./3d/layers/graphics/GraphicsDeconflictor.js";import{Labeler as de}from"./3d/layers/graphics/Labeler.js";import{FeatureTileTree3D as ce}from"./3d/layers/support/FeatureTileTree3D.js";import ue from"./3d/state/ViewState.js";import{ViewStateManager as ge}from"./3d/state/ViewStateManager.js";import{SceneIntersectionHelper as me}from"./3d/state/helpers/SceneIntersectionHelper.js";import{CombinedElevationProvider as ye}from"./3d/support/CombinedElevationProvider.js";import{debugFlags as fe}from"./3d/support/debugFlags.js";import we from"./3d/support/DisplayQualityProfile.js";import{getElevationAtPoint as ve}from"./3d/support/ElevationProvider.js";import{makeDefaultHighlightGroups as _e,HighlightGroup as be}from"./3d/support/HighlightGroup.js";import Me from"./3d/support/HighlightOptions.js";import{toMap as Se,hitTest as Ve}from"./3d/support/hitTest.js";import{popupHitTest as je}from"./3d/support/popupHitTest.js";import Re from"./3d/support/QualitySettings.js";import{RenderCoordsHelper as Ce}from"./3d/support/RenderCoordsHelper.js";import{newResourceController as Te}from"./3d/support/ResourceController.js";import Oe from"./3d/support/SceneViewPerformanceInfo.js";import{SharedSymbolResources as xe}from"./3d/support/SharedSymbolResources.js";import{TextureCollection as Ee}from"./3d/support/TextureCollection.js";import{PointsOfInterest as Le}from"./3d/support/pointsOfInterest/PointsOfInterest.js";import He from"./3d/terrain/TerrainSurface.js";import{isSurfaceLayerView as Ae,getTiledLayerInfo as Pe,checkIfTileInfoSupportedForView as Ie}from"./3d/terrain/terrainUtils.js";import{Stage as Ge}from"./3d/webgl-engine/Stage.js";import{olidEnabled as De}from"./3d/webgl-engine/effects/geometry/olidUtils.js";import{defaultTolerance as Ue}from"./3d/webgl-engine/lib/Intersector.js";import{terrainId as Fe}from"./3d/webgl-engine/lib/verticalOffsetUtils.js";import{defaultHighlightName as We}from"./support/HighlightDefaults.js";import{occludeesSupported as ke}from"./support/layerViewUtils.js";import{PropertiesPool as qe}from"./support/PropertiesPool.js";import{isSupportedScreenPointEvent as ze,createScreenPointFromSupportedEvent as Be}from"./support/screenUtils.js";import{isSpatialReferenceSupported as Ne}from"./support/spatialReferenceSupport.js";import{initializeTextureCompressionWorker as Qe,destroyTextureCompressionWorker as Ye}from"./support/TextureCompressionHelper.js";import{check as Ze}from"./support/WebGLRequirements.js";import $e from"./ui/DefaultUI.js";import Je from"./ui/3d/DefaultUI3D.js";import Ke from"../webscene/Environment.js";import Xe from"../geometry/Extent.js";import et from"../geometry/SpatialReference.js";import tt from"../geometry/Point.js";let it=class extends(Z(K($(X)))){constructor(e){super(e),this._userClippingArea=null,this._clippingArea=null,this._initialDefaultSpatialReference=null,this._overrideDefaultEnvironmentOnly=!0,this._createGraphicsViewController=null,this._resolveWhenReady=[],this._propertiesPool=new qe({slicePlane:F},this),this._resourceController=Te(this),this._defaultToMapOptions={include:new Set},this._defaultHitTestOptions={exclude:new Set},this.deconflictor=new he({view:this}),this.labeler=new de({view:this,deconflictor:this.deconflictor.labels}),this.sharedSymbolResources=null,this.analyses=new Y,this.basemapTerrain=null,this.elevationProvider=null,this.canvas=null,this.constraints=new ae,this.environment=new le,this.environmentManager=new oe,this.floors=new r,this.fullOpacity=1,this.graphicsView=null,this.analysisViewManager=new ne({view:this}),this.groundView=null,this.map=null,this.screenSizePerspectiveEnabled=!0,this.state=new ue({view:this}),this.spatialReference=null,this.alphaCompositingEnabled=!1,this.preserveDrawingBufferEnabled=!1,this.supersampleScreenshotsEnabled=!0,this.type="3d",this.ui=new Je,this._numUpdating=0,this._lastUpdateTime=0,this.updatingProgress=.5,this.highlights=_e(),this.focusAreaView=null,V();const t=(e=null)=>{null!=e&&e.type===c.MOVE||(this._updatingChanged(),this.map&&this.map.allLayers.forEach((async e=>{try{await e.when()}catch{}this._updatingChanged()})))};this.addHandles([g((()=>this.map?.allLayers),"after-changes",(e=>t(e)),{onListenerAdd:()=>t(),onListenerRemove:()=>t(),sync:!0}),this.allLayerViews.on("after-changes",(e=>this._updateUpdatingMonitors(e))),m((()=>this.map),(e=>{e&&"load"in e&&e.load&&e.load().catch((()=>{}))}))]),this.inputManager=new pe({view:this}),this.stateManager=new ge({view:this})}initialize(){if(has("enable-feature:esri-compress-textures")){const e=Qe(this,this.resourceController);this.addResolvingPromise(e.promise)}this.groundView=new J({view:this}),this._updateUpdatingMonitors();const e=()=>this._updateDefaultToMapOptions();this.addHandles(g((()=>this.map?.allLayers),"after-changes",e,{onListenerAdd:e,onListenerRemove:e})),this.updatingHandles.add((()=>this.qualitySettings.memoryLimit),(e=>{this.resourceController&&(this.resourceController.memoryController.maxMemory=e)}),y),this.updatingHandles.add((()=>this.qualitySettings.additionalCacheMemory),(e=>{this.resourceController&&(this.resourceController.memoryController.additionalCacheMemory=e)}),y),this.updatingHandles.add((()=>this.qualitySettings.frameRate??0),(e=>_(e>0?1e3/Math.ceil(e):0)),y),this.updatingHandles.add((()=>this.map?.ground),e,f),this.updatingHandles.add((()=>this.map?.ground?.opacity),(()=>this._updateDefaultHitTestOptions()),f),this.addHandles(m((()=>this.spatialReference),(()=>this.notifyChange("clippingArea")),v))}destroy(){this.destroyed||(Ye(this),this.updatingHandles.removeAll(),this.invalidate(),this.activeTool=null,this.layerViewManager.clear(),this._set("analysisViewManager",h(this.analysisViewManager)),this._exitSurface(),this._disposeGraphicsView(),this.sharedSymbolResources=h(this.sharedSymbolResources),this._set("labeler",h(this.labeler)),this._set("deconflictor",h(this.deconflictor)),this._resourceController=h(this._resourceController),this._set("stateManager",h(this.stateManager)),this._set("inputManager",h(this.inputManager)),this.state.destroy(),this.highlights.destroy(),this._propertiesPool.destroy(),this.removeHandles("updatingMonitors"),this._set("environmentManager",h(this.environmentManager)),this._set("environment",h(this.environment)),this.groundView=h(this.groundView),this._exitBasemapTerrain(),this._stage?.destroy())}get renderSpatialReference(){return this.renderCoordsHelper&&this.renderCoordsHelper.spatialReference}get basemapSpatialReference(){return this.basemapTerrain?.spatialReference}get animation(){return this.state?.animation}get camera(){return this.stateManager?.camera}set camera(e){this.stateManager&&(this.stateManager.camera=e)}get contentCamera(){return this.stateManager?.contentCamera}set contentCamera(e){this.stateManager&&(this.stateManager.contentCamera=e)}installContentCameraReset(e={sticky:!1}){return this.stateManager.installContentCameraReset(e)}get center(){return this.stateManager?.center}set center(e){this.stateManager&&(this.stateManager.center=e)}get clippingArea(){if("global"===this.viewingMode)return null;const e=this.map;let t=this._userClippingArea||d(e,"clippingArea");return!this._userClippingArea&&!d(e,"clippingEnabled")||null==t?(this._clippingArea=null,null):t instanceof Xe?this.spatialReference&&(t=rt(t,this.spatialReference),null==t)?(p.getLogger(this).error("#clippingArea","setting clippingArea with incompatible SpatialReference"),this._clippingArea):(t=t.clone(),null==t.intersection(this._groundAndLayersExtent)&&(t.xmin=t.xmax,t.ymin=t.ymax),t.zmin=void 0,t.zmax=void 0,t.equals(this._clippingArea)||(this._clippingArea=t),this._clippingArea):(p.getLogger(this).error("#clippingArea","only clippingArea geometries of type Extent are supported"),this._clippingArea)}set clippingArea(e){this.ready&&"global"===this.viewingMode&&null!=e?p.getLogger(this).error("#clippingArea=","Clipping area is only supported in local viewingMode"):this._userClippingArea=e}get renderDataExtent(){if(this.state.viewingMode===te.Global)return null;const e=this.renderSpatialReference,t=this.dataExtent;return null==t||null==e||t.spatialReference.equals(e)?t:rt(t,e)}get tileInfo(){return this.basemapTerrain?.tilingScheme?.toTileInfo()}get dataExtent(){let e=this._groundAndLayersExtent;const t=this.spatialReference||et.WGS84,i=rt(this.clippingArea,t);null!=i&&(e=null!=e?e.intersection(i):i);const r=this._get("dataExtent");return null!=e&&e.equals(r)?r:e}get _groundAndLayersExtent(){const e=this.spatialReference||et.WGS84;let t;const i=i=>{const r=rt(i,e);null!=r&&(null!=t?t.union(r):t=r.clone())},r=this.basemapTerrain;if(r?.spatialReference){const e=r.groundExtent;i(new Xe({xmin:e[0],ymin:e[1],zmin:0,xmax:e[2],ymax:e[3],zmax:0,spatialReference:r.spatialReference}))}if(this.map){const e=e=>{null==e.fullExtent||"graphics"===e.type&&e.internal||i(e.fullExtent)};this.map.allLayers.forEach((t=>e(t)))}if(null==t)return null;t.hasZ?(t.zmin=Math.min(0,t.zmin??0),t.zmax=Math.max(0,t.zmax??0)):(t.zmin=0,t.zmax=0);const s=this._get("_groundAndLayersExtent");return t.equals(s)?s:t}castEnvironment(e){return e?e instanceof le?e:e instanceof Ke?this.environment?.cloneWithWebsceneEnvironment(e)??le.fromWebsceneEnvironment(e):T(le,e):new le}get extent(){return this.stateManager?.extent}set extent(e){this.stateManager&&(this.stateManager.extent=e)}get screenCenter(){return this.stateManager?.screenCenter}get frustum(){return this.stateManager?.frustum}get initialExtentRequired(){return this.stateManager&&!this.stateManager.hasInitialView}get defaultsFromMapSettings(){return{required:{tileInfo:!1,heightModelInfo:!0,extent:!1}}}get interacting(){return this.navigating||(this.toolViewManager?.interacting??!1)}get stationary(){return!this.animation&&!this.resizing&&(this.state?.stationary??!0)}get navigating(){return this.state?.navigating??!1}get padding(){return this.stateManager?.padding}set padding(e){this.stateManager&&(this.stateManager.padding=e)}set qualityProfile(e){we.isValidProfile(e)&&(we.apply(e,this.qualitySettings),this._set("qualityProfile",e))}get qualityProfile(){return this._get("qualityProfile")||we.getDefaultProfile()}set slicePlane(e){if(null!=this._stage&&(this._stage.renderer.slicePlane=e),null==e)return void this._set("slicePlane",null);const t=this._propertiesPool.get("slicePlane");W(e,t),this._set("slicePlane",t)}get typeSpecificPreconditionsReady(){return!!this.viewingMode&&!!this.stateManager?.preinit(this.spatialReference)}get resolution(){return null!=this.spatialReference?q(this.scale,this.spatialReference):0}get scale(){return this.stateManager?.scale}set scale(e){this.stateManager&&(this.stateManager.scale=e)}get heightModelInfo(){const e=this.getDefaultHeightModelInfo();return null!=e?H.deriveUnitFromSR(e,this.spatialReference):null}get updating(){if(this.destroyed)return!1;let e=0,t=this.layerViewManager.updating,i=t?this.layerViewManager.updatingRemaining:0;this.allLayerViews.forEach((r=>{if(r.isFulfilled()){if(r.updating){if(t=!0,r.suspended||Ae(r))return;++i,e+=r.updatingProgress}}else++i}));for(const s of this._updatingObjects)if(null!=s&&s.updating){const t=.1;i+=t,e+=.5*t}for(const s of this._updatingObjectsWithProgress)null!=s&&s.updating&&(++i,e+=s.updatingProgress);const r=!this.stateManager.test.updatingIgnoreRenderState&&this.state.updating;if(t=!!(t||i>0||this.updatingHandles.updating||!this.ready||!this.stationary||r||this._createGraphicsViewController||this.inputManager?.updating||this.map?.allLayers?.some((e=>!e.isFulfilled()))||this.textures?.updating),t?(this._numUpdating=Math.max(i,this._numUpdating),e+=this._numUpdating-i):this._numUpdating=0,this._numUpdating>0?e/=this._numUpdating:e=t?0:1,this._get("updatingProgress")!==e){const i=performance.now();if(e<1){const t=Math.min((i-this._lastUpdateTime)/2e3,1);e=this.updatingProgress*(1-t)+e*t}this._set("updatingProgress",e),this._lastUpdateTime=t&&e<1?i:0}return t}get _updatingObjects(){return[this.graphicsView,this.basemapView,this._resourceController,this._stage,this.featureTiles,this.pointsOfInterest,this.environmentManager,this.overlay,this._featureTreeDebugger,this.toolViewManager,this.analysisViewManager]}get _updatingObjectsWithProgress(){return[this.deconflictor,this.labeler,this.basemapTerrain]}get viewingMode(){const e=this._predeterminedViewingMode;if(null!=e)return ie(e);const t=this.spatialReference;return t?null!=this.defaultsFromMap?.viewingMode&&t.equals(this.defaultsFromMap.spatialReference)?ie(this.defaultsFromMap.viewingMode):Ne(t,te.Global)?"global":"local":"global"}set viewingMode(e){this.ready?p.getLogger(this).error("#viewingMode","viewingMode cannot be set once view is ready"):this._overrideIfSome("viewingMode",e)}get viewpoint(){return this.stateManager?.viewpoint}set viewpoint(e){this.stateManager&&(this.stateManager.viewpoint=e)}get visibleArea(){return this.stateManager?.visibleArea}get zoom(){return this.stateManager.zoom}set zoom(e){this.stateManager&&(this.stateManager.zoom=e)}get highlightOptions(){return this.highlights.find((({name:e})=>e===We))?.options??new Me}set highlightOptions(e){for(const t of this.highlights)if(t.name===We)return void(t.options=e)}get resourceController(){return this._resourceController}get quality(){return this._resourceController?.memoryController?.memoryFactor??1}get resolutionScale(){return Math.sqrt(Math.min(1,this.quality/.75))}get performanceInfo(){return new Oe(this)}on(e,t,i,r){const s=this.viewEvents.on(e,t,i,r);return s||super.on(e,t)}hasEventListener(e){return super.hasEventListener(e)||this.viewEvents.hasHandler(e)}toMap(e,t){if(!this.ready)return p.getLogger(this).error("#toMap()","Scene view cannot be used before it is ready"),null;const i=ze(e)?Be(this,e):e;return Se(this,i,t,this._defaultToMapOptions)}toScreen(e){if(!this.ready)return p.getLogger(this).error("#toScreen()","Scene view cannot be used before it is ready"),null;const t=(null==e.z?ve(this.elevationProvider,e):null)??0;return G(e,st,this.renderSpatialReference,t),this.state.camera.projectToScreen(st,nt),b(nt[0],nt[1])}pixelSizeAt(e,t){if(!this.ready)return p.getLogger(this).error("#pixelSizeAt()","Scene view cannot be used before it is ready"),null;if(!e)return 0;const i=this.renderSpatialReference;G(e,st,i);const r=this.state.camera.computeScreenPixelSizeAt(st);return t&&i!==t?r*S(i)/S(t):r}overlayPixelSizeInMapUnits(e){const t=this.basemapTerrain.overlayManager;return t?t.overlayPixelSizeInMapUnits(e,(()=>this.pixelSizeAt(e))):1}hitTest(e,t){if(!this.ready)return p.getLogger(this).error("#hitTest()","Scene view cannot be used before it is ready"),null;const i=ze(e)?Be(this,e):e;return Ve(this,i,t,this._defaultHitTestOptions)}async popupHitTest(e){return je(this,e)}goTo(e,t){return this.updatingHandles.addPromise(this.stateManager.goTo(e,t))}async whenAnalysisView(e){if(null==e.parent)throw new n("view:no-analysisview-for-analysis","The analysis has not been added to view.analyses",{analysis:e});switch(e.parent.type){case"line-of-sight":case"dimension":case"viewshed":return(await this.whenLayerView(e.parent)).whenAnalysisView();default:return this.analysisViewManager.whenAnalysisView(e)}}whenLayerView(e){return super.whenLayerView(e)}async takeScreenshot(e){const t=await this._completeSettings(e);await this.whenReady();const i=await this._stage.renderView.takeScreenshot(t);return(await import("./support/screenshotUtils.js")).encode(i,t,this._pixelFormat())}async _takeScreenshot(e){const t=await this._completeSettings(e);await this.whenReady();const i=await this._stage.renderView.takeScreenshot(t);return(await import("./support/screenshotUtils.js")).encodeData(i,this._pixelFormat())}async _takeScreenshotWithObjectAndLayerId(e){const t=await this._completeSettings(e);await this.whenReady();const i=await this._stage.renderView.takeScreenshotWithOID(t),{encodeData:r}=await import("./support/screenshotUtils.js");return[r(i[0],this._pixelFormat()),r(i[1],this._pixelFormat())]}async _completeSettings(e){const{toRenderSettings:t,screenshotSuperSampleSettings:i}=await import("./support/screenshotUtils.js"),r=t(e,this);return r.pixelRatio/=this.state.pixelRatio,i(r,this.supersampleScreenshotsEnabled,this.padding)}_pixelFormat(){return{flipY:!0,premultipliedAlpha:this._stage.renderView.getAlpha()}}get test(){}async takeScreenshotWithObjectAndLayerId(e){if(!De())throw new n("360vr:objectAndLayerId-rendering-disabled","has enable-feature:objectAndLayerId-rendering must be true");const{encode:t}=await import("./support/screenshotUtils.js"),i=await this._completeSettings(e);await this.whenReady();const r=await this._stage.renderView.takeScreenshotWithOID(i),s=t(r[0],i,this._pixelFormat()),a=await this._completeSettings(e);a.format="png";return[s,t(r[1],a,this._pixelFormat())]}getColorToObjectAndLayerIdMapping(){const e=this._stage.renderView.olidRenderHelper;if(e)return e.getColorToObjectAndLayerIdMapping();throw new n("360vr:objectAndLayerId-rendering-disabled","has enable-feature:objectAndLayerId-rendering must be true")}addUpdatingPromise(e){return this.updatingHandles.addPromise(e)}importLayerView(e){return se.importLayerView(e)}hasLayerViewModule(e){return se.hasLayerViewModule(e)}forceDOMReadyCycle(){this.forceReadyCycle()}getDefaultSpatialReference(){return this.map&&"initialViewProperties"in this.map&&this.map.initialViewProperties?.spatialReference||this.defaultsFromMap?.spatialReference||this.defaultsFromMap?.ready&&this._initialDefaultSpatialReference||null}async validate(){let e=Ze(this.type);const t=has("safari");if(t&&t<9&&(e=new n("sceneview:browser-not-supported","This browser is not supported by SceneView (Safari < 9)",{type:"safari",requiredVersion:9,detectedVersion:t})),null!=e)throw p.getLogger(this).warn("#validate()",e.message),e}get _predeterminedViewingMode(){const e=this._isOverridden("viewingMode")?this._get("viewingMode"):(this.map&&"initialViewProperties"in this.map?this.map.initialViewProperties?.viewingMode:null)??null;return null!=e?re(e):null}getSpatialReferenceSupport(e,t){const i=this._predeterminedViewingMode;if(null!=i)return this._validateSpatialReferenceForViewingMode(e,t,i)?{constraints:this._makeSpatialReferenceConstraints(e,t,i)}:null;const r=this._validateSpatialReferenceForViewingMode(e,t,te.Local),s=this._validateSpatialReferenceForViewingMode(e,t,te.Global);return r||s?r&&s?{constraints:this._makeSpatialReferenceConstraints(e,t,null)}:r?{constraints:this._makeSpatialReferenceConstraints(e,t,te.Local)}:{constraints:this._makeSpatialReferenceConstraints(e,t,te.Global)}:null}_validateSpatialReferenceForViewingMode(e,t,i){return!!Ne(e,i)&&(null==t||(!!z(t)||(!B(t)||null!=Pe(t,e,i))&&(!N(t)||i!==te.Global)))}_makeSpatialReferenceConstraints(e,t,i){if(null==t)return[{spatialReference:e,viewingMode:i}];const{isWebMercator:r,isWGS84:s}=e;if(z(t)&&(r||s)){return!s||i===te.Local||null===Ie(t.tileInfo,t.fullExtent,e,te.Global)?[{spatialReference:e,viewingMode:i},{spatialReference:et.WebMercator,viewingMode:i}]:[{spatialReference:r?et.WGS84:et.WebMercator,viewingMode:i}]}return B(t)||N(t)||!r&&!s?B(t)&&r&&i!==te.Global?[{spatialReference:e,viewingMode:i},{spatialReference:et.WGS84,viewingMode:te.Local}]:[{spatialReference:e,viewingMode:i}]:[{spatialReference:e,viewingMode:i},{spatialReference:r?et.WGS84:et.WebMercator,viewingMode:i}]}_validateSpatialReference(e){const t=null!=this.getSpatialReferenceSupport(e),i=this._predeterminedViewingMode;return t||(null!=i?p.getLogger(this).warnOnce(`Spatial reference defined on view not supported in ${ie(i)} viewing mode.`):e.isGeographic&&p.getLogger(this).warnOnce("Spatial reference is geographic but not supported.")),t}whenReady(){return new Promise((e=>{this.ready?e(this):this._resolveWhenReady.push(e)}))}trackGraphicState(e){if(!e.graphic)return p.getLogger(this).error("trackGraphicState","GraphicState.graphic must not be null or undefined to start tracking"),null;const t=this.getViewForGraphic(e.graphic);let i=null,r=!1;const s=t=>{!r&&null!=t&&"processor"in t&&"graphics-3d"===t.processor?.type&&t.processor.graphicsCore&&(i=t.processor.graphicsCore.trackGraphicState(e))};return null!=t?s(t):this.whenViewForGraphic(e.graphic,{waitForLayer:!0}).then((e=>s(e)),(()=>{})).catch((()=>{})),o((()=>{r=!0,null!=i&&(i.remove(),i=null)}))}highlight(e){if(Array.isArray(e))return l(e.map((e=>this.highlight(e))));if(r.isCollection(e))return l(e.toArray().map((e=>this.highlight(e))));const t=this.getViewForGraphic(e);return t&&"highlight"in t?t.highlight(e):o()}maskOccludee(e){if(!e)return p.getLogger(this).error("maskOccludee","GraphicState.graphic must not be null or undefined to mask an occludee"),null;const t=this.getViewForGraphic(e);let i=null,r=!1;const s=t=>{!r&&null!=t&&ke(t)&&(i=t.maskOccludee(e))};return null!=t?s(t):this.whenViewForGraphic(e,{waitForLayer:!0}).then((e=>s(e)),(()=>{})).catch((()=>{})),o((()=>{r=!0,null!=i&&(i.remove(),i=null)}))}getViewForGraphic(e){return e.layer===this.graphics?this.graphicsView:e.layer?this.allLayerViews.filter((e=>"media-3d"!==e.type)).find((t=>t.layer===e.layer)):null}graphicChanged(e){null!=this.graphicsView&&this.graphicsView.graphicChanged(e)}async whenViewForGraphic(e,t){if(e.layer===this)return await w((()=>this.graphicsView)),this.graphicsView;if(!e.layer||!this.map)throw new n("no-view-for-graphic");return t&&t.waitForLayer&&!this.map.allLayers.includes(e.layer)?new Promise(((t,i)=>{const r=this.map.allLayers.on("change",(s=>{s.added.includes(e.layer)&&(r.remove(),this.whenLayerView(e.layer).then(t,i))}))})):this.whenLayerView(e.layer)}_initBasemapTerrain(){this._set("basemapTerrain",new He({view:this})),this._set("elevationProvider",new ye({view:this})),this.elevationProvider.register("ground",this.basemapTerrain)}_exitBasemapTerrain(){this.basemapTerrain&&(this.elevationProvider.unregister(this.basemapTerrain),this.elevationProvider.destroy(),this._set("elevationProvider",null),this.basemapTerrain.destroy(),this._set("basemapTerrain",null))}_initGlobe(){this._initCoordinateSystem(),this.state.createInitialCamera(),this._initBasemapTerrain(),this._set("pointsOfInterest",new Le({view:this})),this._set("featureTiles",new ce({renderCoordsHelper:this.renderCoordsHelper,cameraOnSurface:this.pointsOfInterest.cameraOnSurface,focus:this.pointsOfInterest.focus,tilingSchemeOwner:this.basemapTerrain,viewState:this.state,scheduler:this._resourceController.scheduler,terrain:this.basemapTerrain}));const e=()=>{const e=this.basemapTerrain?.extent;if(this.clippingArea||e)if(e&&this.basemapTerrain.spatialReference){const e=null!=this.basemapTerrain.extent&&null!=this.basemapTerrain.spatialReference?P(U(this.basemapTerrain.extent,this.basemapTerrain.spatialReference),this.spatialReference):null;this.clippingArea?this.featureTiles.filterExtent=this.clippingArea.intersection(e):this.featureTiles.filterExtent=e}else this.featureTiles.filterExtent=this.clippingArea;else this.featureTiles.filterExtent=null};this.addHandles([this.updatingHandles.add((()=>fe.FEATURE_TILE_TREE_SHOW_TILES),(e=>{e&&this.featureTiles&&!this._featureTreeDebugger?this.updatingHandles.addPromise(import("./3d/layers/support/FeatureTileTree3DDebugger.js")).then((({FeatureTileTree3DDebugger:e})=>{!this._featureTreeDebugger&&fe.FEATURE_TILE_TREE_SHOW_TILES&&(this._featureTreeDebugger=new e({view:this}))})):e||!this._featureTreeDebugger||fe.FEATURE_TILE_TREE_SHOW_TILES||(this._featureTreeDebugger.destroy(),this._featureTreeDebugger=null)}),f),this.updatingHandles.add((()=>this.clippingArea),e,f),this.updatingHandles.add((()=>this.basemapTerrain.extent),e,f)],"feature-tiles"),this.stateManager.init()}_exitGlobe(){this.featureTiles&&(this.stateManager.exit(),this.removeHandles("render-coords-helper"),this.removeHandles("feature-tiles"),this._set("featureTiles",h(this.featureTiles)),this._set("pointsOfInterest",h(this.pointsOfInterest)),this._exitBasemapTerrain(),this.state.reset(),this._exitCoordinateSystem())}_initCoordinateSystem(){if(this.spatialReference){const e=this.spatialReference,t=this.state.isGlobal,i=k(t,e);i!==this.renderSpatialReference&&(this._set("renderCoordsHelper",Ce.create(this.state.viewingMode,i)),t||this.addHandles(m((()=>this.basemapTerrain?.extent),(e=>{const t=this.renderCoordsHelper.spatialReference;null==e||0===e[0]&&0===e[1]&&0===e[2]&&0===e[3]||!I(e,this.basemapTerrain.spatialReference,at,t)||(this.renderCoordsHelper.extent=at)}),v),"render-coords-helper"),this.sceneIntersectionHelper&&this.sceneIntersectionHelper.setTolerance(Ue/this.renderCoordsHelper.unitInMeters))}else this._set("renderCoordsHelper",null)}_exitCoordinateSystem(){this.removeHandles("render-coords-helper"),this._set("renderCoordsHelper",null)}_updatingChanged(){this.notifyChange("updating")}_updateUpdatingMonitors(e=null){null!=e&&e.type===c.MOVE||(this.removeHandles("updatingMonitors"),this.allLayerViews.forEach((e=>{e.destroyed||(this.addHandles(m((()=>[e.updating,e.updatingProgress]),(()=>this._updatingChanged()),v),"updatingMonitors"),e.when((()=>this._updatingChanged()),(()=>this._updatingChanged())))})),this._updatingChanged())}async _prepareScreenshotOverlay(){this.overlay&&await this.overlay.prepare()}_renderScreenshotOverlay(e,t,i){if(!this.overlay||!this.overlay.hasVisibleItems)return i;const r=e.getContext("2d");return r.putImageData(i,0,0),this.overlay.renderCanvas(e,{disableDecorations:t}),r.getImageData(0,0,i.width,i.height)}_initStage(){const e={deactivatedWebGLExtensions:this.deactivatedWebGLExtensions,debugWebGLExtensions:this.debugWebGLExtensions,alpha:this.alphaCompositingEnabled,preserveDrawingBuffer:this.preserveDrawingBufferEnabled,canvas:this.renderCanvas,screenshot:{prepareOverlay:()=>this._prepareScreenshotOverlay(),renderOverlay:(e,t,i)=>this._renderScreenshotOverlay(e,t,i)}},t=new me(this.state.viewingMode,(e=>this._stage.layers.forAll(e)),this);this._set("sceneIntersectionHelper",t);const i=s(this.surface);this._stage=new Ge({view:this,options:e,container:i}),this._stage.renderer.slicePlane=this.slicePlane,this.addHandles([this.updatingHandles.add((()=>this.qualitySettings.highQualityTransparency),(e=>this._stage.renderer.setParameters({highQualityTransparency:e})),y),this.on("pointer-move",(()=>this._stage?.renderer.resetAnimation())),a(this._stage.renderView.canvas,"webglcontextlost",(e=>{this.fatalError=new n("webgl-context-lost",e.statusMessage)}))],"stage"),this.renderCoordsHelper&&this.sceneIntersectionHelper.setTolerance(Ue/this.renderCoordsHelper.unitInMeters),this._set("canvas",this._stage.renderView.canvas)}_exitStage(){this._set("sceneIntersectionHelper",null),this._stage=h(this._stage),this.removeHandles("stage"),this._set("canvas",null)}_initSurface(e){this._exitSurface(),this._initStage(),this._initGlobe(),this.sharedSymbolResources=new xe({view:this,viewingMode:e,resourceController:this._resourceController,pointsOfInterest:this.pointsOfInterest,viewState:this.state})}_exitSurface(){this.sharedSymbolResources&&(this.sharedSymbolResources.objectResourceCache.destroy(),this.sharedSymbolResources.destroy(),this.sharedSymbolResources=null,this._exitGlobe(),this._exitStage())}_createGraphicsViewIfNeeded(){if(this.graphicsView||this._createGraphicsViewController)return;if(0===this.graphics.length)return;this.removeHandles("graphics-view"),this._createGraphicsViewController=new AbortController;const e=()=>{this._createGraphicsViewController=null,this._updatingChanged()};this._createGraphicsViewAsync(this._createGraphicsViewController.signal).then(e,e),this._updatingChanged()}async _createGraphicsViewAsync(e){const t=(await import("./3d/layers/GraphicsView3D.js")).default;u(e),await w((()=>this.basemapTerrain?.ready),e),this._set("graphicsView",new t({view:this}))}_disposeGraphicsView(){this._createGraphicsViewController&&(this._createGraphicsViewController.abort(),this._createGraphicsViewController=null),this.removeHandles("graphics-view"),null!=this.graphicsView&&(this.removeHandles(this.graphicsView.processor.layer.id),this.graphicsView.destroy(),this._set("graphicsView",null))}_startup(){const e=re(this.viewingMode);e===te.Global&&(this._clippingArea=null),this._initSurface(e),this._set("ready",!0),this.addHandles(g((()=>this.graphics),"after-changes",(()=>this._createGraphicsViewIfNeeded())),"graphics-view"),this._createGraphicsViewIfNeeded();const t=this.map&&"initialViewProperties"in this.map?this.map.initialViewProperties:null,i=t?.environment;i&&(this._overrideDefaultEnvironmentOnly?x(this.environment,i):this.environment=this.environment.cloneWithWebsceneEnvironment(i)),this.timeExtent=t?.timeExtent,this.labeler.setup(),this.environmentManager.connectView(this),this.inputManager.connect(),this._set("textures",new Ee(this._stage,this.resourceController.scheduler));const r=this._resolveWhenReady;this._resolveWhenReady=[],r.forEach((e=>e(this)))}_teardown(){this._initialDefaultSpatialReference=null,this.inputManager.disconnect(),this.environmentManager.disconnectView(),this._overrideDefaultEnvironmentOnly=!1,this.labeler.dispose(),this._disposeGraphicsView(),this.removeHandles("graphics-view"),this._set("textures",h(this.textures)),this._exitSurface(),this._set("ready",!1)}_updateDefaultToMapOptions(){if(this._defaultToMapOptions.include.clear(),this.map){this.map.ground&&this._defaultToMapOptions.include.add(Fe);for(const e of this.map.allLayers.items)Q(e.type)&&this._defaultToMapOptions.include.add(e.uid)}}_updateDefaultHitTestOptions(){if(this._defaultHitTestOptions.exclude.clear(),this.map){this.map.ground&&this.map.ground.opacity<1&&this._defaultHitTestOptions.exclude.add(Fe);for(const e of this.map.allLayers.items)Q(e.type)&&e.opacity<1&&this._defaultHitTestOptions.exclude.add(e.uid)}}};function rt(e,t){return null!=e&&A(e.spatialReference,t)?P(e,t):null}it.type="3d",e([j()],it.prototype,"_userClippingArea",void 0),e([j()],it.prototype,"_resourceController",void 0),e([j()],it.prototype,"_stage",void 0),e([j({readOnly:!0})],it.prototype,"deconflictor",void 0),e([j({readOnly:!0})],it.prototype,"labeler",void 0),e([j(L(Y,"analyses"))],it.prototype,"analyses",void 0),e([j({type:ee,readOnly:!0})],it.prototype,"animation",null),e([j({readOnly:!0})],it.prototype,"basemapTerrain",void 0),e([j({readOnly:!0})],it.prototype,"elevationProvider",void 0),e([j()],it.prototype,"camera",null),e([j({type:t})],it.prototype,"contentCamera",null),e([j({readOnly:!0})],it.prototype,"canvas",void 0),e([j({type:tt})],it.prototype,"center",null),e([j({type:Xe})],it.prototype,"clippingArea",null),e([j({type:ae})],it.prototype,"constraints",void 0),e([j({type:Xe,readOnly:!0})],it.prototype,"renderDataExtent",null),e([j({readOnly:!0})],it.prototype,"tileInfo",null),e([j({type:Xe,readOnly:!0})],it.prototype,"dataExtent",null),e([j({type:Xe,readOnly:!0})],it.prototype,"_groundAndLayersExtent",null),e([j({type:le})],it.prototype,"environment",void 0),e([R("environment")],it.prototype,"castEnvironment",null),e([j({readOnly:!0})],it.prototype,"environmentManager",void 0),e([j({type:Xe})],it.prototype,"extent",null),e([j()],it.prototype,"floors",void 0),e([j()],it.prototype,"screenCenter",null),e([j()],it.prototype,"frustum",null),e([j({type:Number,readOnly:!0})],it.prototype,"fullOpacity",void 0),e([j({readOnly:!0})],it.prototype,"graphicsView",void 0),e([j({readOnly:!0})],it.prototype,"analysisViewManager",void 0),e([j()],it.prototype,"groundView",void 0),e([j({type:Boolean})],it.prototype,"initialExtentRequired",null),e([j()],it.prototype,"defaultsFromMapSettings",null),e([j()],it.prototype,"interacting",null),e([j()],it.prototype,"stationary",null),e([j()],it.prototype,"navigating",null),e([j()],it.prototype,"map",void 0),e([j()],it.prototype,"padding",null),e([j({type:Le,readOnly:!0})],it.prototype,"pointsOfInterest",void 0),e([j({type:ce,readOnly:!0})],it.prototype,"featureTiles",void 0),e([j()],it.prototype,"_featureTreeDebugger",void 0),e([j({type:Boolean})],it.prototype,"screenSizePerspectiveEnabled",void 0),e([j({constructOnly:!0})],it.prototype,"deactivatedWebGLExtensions",void 0),e([j({constructOnly:!0})],it.prototype,"debugWebGLExtensions",void 0),e([j({constructOnly:!0})],it.prototype,"renderCanvas",void 0),e([j({constructOnly:!0})],it.prototype,"state",void 0),e([j({readOnly:!0})],it.prototype,"inputManager",void 0),e([j({readOnly:!0})],it.prototype,"stateManager",void 0),e([j({type:["low","medium","high"]})],it.prototype,"qualityProfile",null),e([j({type:Re,get(){let e=this._get("qualitySettings");return e||(e=new Re,we.apply(this.qualityProfile,e)),e}})],it.prototype,"qualitySettings",void 0),e([j()],it.prototype,"slicePlane",null),e([j({readOnly:!0})],it.prototype,"typeSpecificPreconditionsReady",null),e([j({readOnly:!0})],it.prototype,"renderCoordsHelper",void 0),e([j({readOnly:!0})],it.prototype,"sceneIntersectionHelper",void 0),e([j({type:Number,dependsOn:["scale","spatialReference"],readOnly:!0})],it.prototype,"resolution",null),e([j({type:Number})],it.prototype,"scale",null),e([j()],it.prototype,"heightModelInfo",null),e([j()],it.prototype,"spatialReference",void 0),e([j({type:Boolean,constructOnly:!0})],it.prototype,"alphaCompositingEnabled",void 0),e([j({constructOnly:!0})],it.prototype,"preserveDrawingBufferEnabled",void 0),e([j({type:Boolean})],it.prototype,"supersampleScreenshotsEnabled",void 0),e([j({readOnly:!0})],it.prototype,"type",void 0),e([j(),R((e=>e instanceof $e?e:O(Je,e)))],it.prototype,"ui",void 0),e([j({type:Boolean,readOnly:!0,dependsOn:["graphicsView.updating","basemapView.updating","basemapTerrain.updating","layerViewManager.updating","layerViewManager.updatingRemaining","_resourceController.updating","_stage.updating","featureTiles.updating","pointsOfInterest.updating","environmentManager.updating","overlay.updating","updatingHandles.updating","featureTreeDebugger.updating","labeler.updating","deconflictor.updating","ready","stationary","inputManager.updating","toolViewManager.updating","analysisViewManager.updating","state.updating","textures.updating"]})],it.prototype,"updating",null),e([j()],it.prototype,"_updatingObjects",null),e([j()],it.prototype,"_updatingObjectsWithProgress",null),e([j({type:Number,readOnly:!0,dependsOn:["updating"]})],it.prototype,"updatingProgress",void 0),e([j({type:["global","local"]})],it.prototype,"viewingMode",null),e([j({type:i})],it.prototype,"viewpoint",null),e([j({readOnly:!0})],it.prototype,"visibleArea",null),e([j({type:Number})],it.prototype,"zoom",null),e([j({type:Me})],it.prototype,"highlightOptions",null),e([j({type:r.ofType(be)})],it.prototype,"highlights",void 0),e([j({readOnly:!0})],it.prototype,"quality",null),e([j({readOnly:!0})],it.prototype,"resolutionScale",null),e([j()],it.prototype,"textures",void 0),it=e([C("esri.views.SceneView")],it);const st=E(),nt=M(),at=D(),ot=it;export{ot as default};