@arcgis/core 4.28.0-next.20230720 → 4.28.0-next.20230721

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 (261) hide show
  1. package/Color.js +1 -1
  2. package/analysis/AreaMeasurementAnalysis.js +1 -1
  3. package/arcade/arcadeCompiler.js +1 -1
  4. package/arcade/featureSetUtils.js +1 -1
  5. package/arcade/featureset/actions/Top.js +1 -1
  6. package/arcade/featureset/sources/FeatureLayerDynamic.js +1 -1
  7. package/arcade/featureset/support/FeatureSet.js +1 -1
  8. package/arcade/featureset/support/FeatureSetIterator.js +1 -1
  9. package/arcade/functions/convertdirection.js +1 -1
  10. package/arcade/functions/featuresetbase.js +1 -1
  11. package/arcade/functions/geomasync.js +1 -1
  12. package/arcade/functions/geomsync.js +1 -1
  13. package/arcade/lib/comment-handler.js +1 -1
  14. package/arcade/lib/parser.js +1 -1
  15. package/arcade/lib/scanner.js +1 -1
  16. package/assets/esri/core/workers/RemoteClient.js +1 -1
  17. package/assets/esri/core/workers/chunks/{75c28da8d0b02d612d69.js → 040b3fc9c9c0736dd893.js} +1 -1
  18. package/assets/esri/core/workers/chunks/0652f6a8d5221e978033.js +1 -0
  19. package/assets/esri/core/workers/chunks/{c13b332afdb3f6be1ec9.js → 092fda62b6f62c2e4869.js} +1 -1
  20. package/assets/esri/core/workers/chunks/{57e0ad037188bd2997e7.js → 0af18a96cbd4e2d35436.js} +1 -1
  21. package/assets/esri/core/workers/chunks/0b5eeec0f66c87a46a0c.js +1 -0
  22. package/assets/esri/core/workers/chunks/{68e568b67b6fb34393db.js → 0cad2b991d0d0fd07846.js} +1 -1
  23. package/assets/esri/core/workers/chunks/0dccbc6c2559fdc0c2ad.js +1 -0
  24. package/assets/esri/core/workers/chunks/256a82f6f6e1405fbcc6.js +1 -0
  25. package/assets/esri/core/workers/chunks/{bb9213899049e1db90da.js → 2c57c9bd71637c5bed8a.js} +1 -1
  26. package/assets/esri/core/workers/chunks/2cdbabcbfe32286ec78d.js +1 -0
  27. package/assets/esri/core/workers/chunks/{2b1c83453a862e01954b.js → 2d9d80b2d0042a9c09fb.js} +1 -1
  28. package/assets/esri/core/workers/chunks/2f9aec2238ff6cb99e09.js +1 -0
  29. package/assets/esri/core/workers/chunks/{7dbd3e6406fb3e3a1a8f.js → 3cf748c025f3936c1cb2.js} +1 -1
  30. package/assets/esri/core/workers/chunks/4481d1103363434f16da.js +1 -0
  31. package/assets/esri/core/workers/chunks/5ae325e6a795c72eac6c.js +1 -0
  32. package/assets/esri/core/workers/chunks/5e4dde2886a1027b4b96.js +1 -0
  33. package/assets/esri/core/workers/chunks/730eb7e5f617fdab4f10.js +1 -0
  34. package/assets/esri/core/workers/chunks/{5a2e6bed9431cf4f42b1.js → 740dc67038f554431f1b.js} +1 -1
  35. package/assets/esri/core/workers/chunks/{09178454bda15bb7929a.js → 7fbdfd1527582c52f9b6.js} +1 -1
  36. package/assets/esri/core/workers/chunks/{1c026947505a9ff94a53.js → 807742f38885fa90b4fe.js} +1 -1
  37. package/assets/esri/core/workers/chunks/82dfbc175b52c7a10475.js +1 -0
  38. package/assets/esri/core/workers/chunks/870a05451e074b58f19a.js +1 -0
  39. package/assets/esri/core/workers/chunks/8c5a8c1dfb086069bb06.js +1 -0
  40. package/assets/esri/core/workers/chunks/99a5a434e0bad48c7a5c.js +1 -0
  41. package/assets/esri/core/workers/chunks/9a5916c66dad91d01d5b.js +1 -0
  42. package/assets/esri/core/workers/chunks/9c133fd8c1fbd0295b86.js +1 -0
  43. package/assets/esri/core/workers/chunks/9cddb504079d396779ea.js +1 -0
  44. package/assets/esri/core/workers/chunks/a3a1d4f32e518e97d071.js +1 -0
  45. package/assets/esri/core/workers/chunks/{9548aa449fe3a300c015.js → a4fa40dc77e116c954ac.js} +1 -1
  46. package/assets/esri/core/workers/chunks/a54ec9929a7db879d5db.js +1 -0
  47. package/assets/esri/core/workers/chunks/afc5b84693757fda2bc8.js +1 -0
  48. package/assets/esri/core/workers/chunks/{591b5c277cfd3a4101a4.js → b08f2a4aa94087c6c367.js} +1 -1
  49. package/assets/esri/core/workers/chunks/c0e12f6a7bb2360e4c21.js +1 -0
  50. package/assets/esri/core/workers/chunks/c8e656cd470a17f538e9.js +1 -0
  51. package/assets/esri/core/workers/chunks/d0e203405f95e14b1399.js +1 -0
  52. package/assets/esri/core/workers/chunks/{ec72f492f24e67e008ae.js → d8e58dc14d3495f0830c.js} +1 -1
  53. package/assets/esri/core/workers/chunks/ddc393a012588f799f42.js +1 -0
  54. package/assets/esri/core/workers/chunks/de3baa85b1639c25458d.js +1 -0
  55. package/assets/esri/core/workers/chunks/e66cea26064ba8353af0.js +1 -0
  56. package/assets/esri/core/workers/chunks/ea478f2f4a19463e13fd.js +1 -0
  57. package/assets/esri/core/workers/chunks/eba197e45507f56f3ed0.js +1 -0
  58. package/assets/esri/core/workers/chunks/ebd006fcd568a7731115.js +1 -0
  59. package/assets/esri/core/workers/chunks/ef9a9a7d66d818720e20.js +1 -0
  60. package/assets/esri/core/workers/chunks/f3b458f55236566c940b.js +1 -0
  61. package/assets/esri/core/workers/chunks/fd0a91b9e0216cc269c3.js +1 -0
  62. package/assets/esri/core/workers/chunks/{a4fe220a912b1f428e49.js → fdd6403a8390d629392b.js} +1 -1
  63. package/assets/esri/themes/base/widgets/_Directions.scss +13 -7
  64. package/assets/esri/themes/dark/main.css +1 -1
  65. package/assets/esri/themes/light/main.css +1 -1
  66. package/assets/esri/themes/light/view.css +1 -1
  67. package/chunks/array.js +1 -1
  68. package/core/Collection.js +1 -1
  69. package/core/accessorSupport/decorators/subclass.js +1 -1
  70. package/core/accessorSupport/ensureType.js +1 -1
  71. package/core/accessorSupport/get.js +1 -1
  72. package/core/accessorSupport/tracking.js +1 -1
  73. package/core/accessorSupport/utils.js +1 -1
  74. package/core/libs/rbush/PooledRBush.js +1 -1
  75. package/core/urlUtils.js +1 -1
  76. package/geometry/GeometryCursor.js +1 -1
  77. package/geometry/support/TileClipper.js +1 -1
  78. package/geometry/support/geodesicUtils.js +1 -1
  79. package/interfaces.d.ts +7 -1
  80. package/layers/LinkChartLayer.js +1 -1
  81. package/layers/VectorTileLayer.js +1 -1
  82. package/layers/VoxelLayer.js +1 -1
  83. package/layers/WCSLayer.js +1 -1
  84. package/layers/effects/EffectView.js +1 -1
  85. package/layers/graphics/sources/geojson/geojson.js +1 -1
  86. package/layers/knowledgeGraph/KnowledgeGraphLayerDataManager.js +1 -1
  87. package/layers/mixins/ArcGISCachedService.js +1 -1
  88. package/layers/support/ElevationQuery.js +1 -1
  89. package/layers/support/MultidimensionalSubset.js +1 -1
  90. package/layers/support/TileInfo.js +1 -1
  91. package/layers/support/TileInfoTilemapCache.js +1 -1
  92. package/layers/support/TilemapCache.js +1 -1
  93. package/layers/support/rasterDatasets/multidimensionalUtils.js +1 -1
  94. package/layers/support/rasterDatasets/pamParser.js +1 -1
  95. package/layers/support/rasterDatasets/wcsCoverageParser.js +1 -1
  96. package/layers/support/rasterFormats/Raw.js +1 -1
  97. package/layers/support/rasterFormats/TiffDecoder.js +1 -1
  98. package/layers/support/rasterFunctions/ExtractBandFunction.js +1 -1
  99. package/layers/support/rasterFunctions/colormaps.js +1 -1
  100. package/layers/support/rasterFunctions/pixelUtils.js +1 -1
  101. package/layers/support/rasterFunctions/rasterProjectionHelper.js +1 -1
  102. package/layers/video/VideoController.js +1 -1
  103. package/layers/voxel/VoxelDimension.js +1 -1
  104. package/layers/voxel/VoxelTransferFunctionStyle.js +1 -1
  105. package/layers/voxel/VoxelVolume.js +1 -1
  106. package/package.json +1 -1
  107. package/renderers/support/RasterSymbolizer.js +1 -1
  108. package/renderers/support/colorRampUtils.js +1 -1
  109. package/renderers/visualVariables/support/visualVariableUtils.js +1 -1
  110. package/rest/query/operations/pbfDehydratedFeatureSet.js +1 -1
  111. package/rest/query/operations/pbfJSONFeatureSet.js +1 -1
  112. package/rest/support/generateRendererUtils.js +1 -1
  113. package/smartMapping/raster/renderers/classBreaks.js +1 -1
  114. package/smartMapping/renderers/color.js +1 -1
  115. package/smartMapping/renderers/support/utils.js +1 -1
  116. package/smartMapping/renderers/type.js +1 -1
  117. package/smartMapping/renderers/univariateColorSize.js +1 -1
  118. package/smartMapping/support/adapters/support/utils.js +1 -1
  119. package/statistics/utils.js +1 -1
  120. package/support/revision.js +1 -1
  121. package/symbols/cim/CIMSymbolDrawHelper.js +1 -1
  122. package/symbols/cim/GeometryWalker.js +1 -1
  123. package/symbols/cim/cimAnalyzer.js +1 -1
  124. package/symbols/cim/effects/EffectArrow.js +1 -1
  125. package/symbols/cim/effects/EffectControlMeasureLine.js +1 -1
  126. package/symbols/support/symbolUtils.js +1 -1
  127. package/views/2d/constraints/ZoomConstraint.js +1 -1
  128. package/views/2d/engine/flow/dataUtils.js +1 -1
  129. package/views/2d/engine/flow/utils.js +1 -1
  130. package/views/2d/engine/vectorTiles/VectorTile.js +1 -1
  131. package/views/2d/engine/vectorTiles/VectorTileContainer.js +1 -1
  132. package/views/2d/engine/vectorTiles/expression/expression.js +1 -1
  133. package/views/2d/engine/vectorTiles/style/VectorTileSource.js +1 -1
  134. package/views/2d/engine/vectorTiles/tileInfoUtils.js +1 -1
  135. package/views/2d/engine/webgl/TurboLine.js +1 -1
  136. package/views/2d/engine/webgl/mesh/MeshData.js +1 -1
  137. package/views/2d/engine/webgl/mesh/templates/shapingUtils.js +1 -1
  138. package/views/2d/interactive/editingTools/ControlPointsTransformTool.js +1 -1
  139. package/views/2d/interactive/editingTools/draw/DrawGraphicTool2D.js +1 -1
  140. package/views/2d/layers/BaseLayerView2D.js +1 -1
  141. package/views/2d/layers/BaseLayerViewGL2D.js +1 -1
  142. package/views/2d/layers/BitmapTileLayerView2D.js +1 -1
  143. package/views/2d/layers/MediaLayerView2D.js +1 -1
  144. package/views/2d/layers/TileLayerView2D.js +1 -1
  145. package/views/2d/layers/VectorTileLayerView2D.js +1 -1
  146. package/views/2d/layers/WMTSLayerView2D.js +1 -1
  147. package/views/2d/layers/features/support/rendererUtils.js +1 -1
  148. package/views/2d/layers/imagery/BaseImageryTileSubView2D.js +1 -1
  149. package/views/2d/layers/support/vectorTileDebugUtils.js +5 -0
  150. package/views/2d/tiling/TileInfoView.js +1 -1
  151. package/views/2d/tiling/TileInfoViewPOT.js +1 -1
  152. package/views/2d/tiling/TileQueue.js +1 -1
  153. package/views/2d/tiling.js +1 -1
  154. package/views/3d/analysis/Slice/sliceToolUtils.js +1 -1
  155. package/views/3d/environment/ChapmanAtmosphere.js +1 -1
  156. package/views/3d/interactive/editingTools/moveGraphic/GraphicMoveTool.js +1 -1
  157. package/views/3d/layers/ImageryTileLayerView3D.js +1 -1
  158. package/views/3d/layers/TiledLayerView3D.js +1 -1
  159. package/views/3d/layers/VectorTileLayerView3D.js +1 -1
  160. package/views/3d/layers/graphics/Deconflictor.js +1 -1
  161. package/views/3d/layers/support/FeatureTileFetcher3D.js +1 -1
  162. package/views/3d/layers/support/featureReference.js +1 -1
  163. package/views/3d/support/LaserLineRenderer.js +1 -1
  164. package/views/3d/terrain/Overlay.js +1 -1
  165. package/views/3d/terrain/OverlayFramebufferObject.js +1 -1
  166. package/views/3d/terrain/OverlayRenderTarget.js +1 -1
  167. package/views/3d/terrain/OverlayRenderer.js +1 -1
  168. package/views/3d/terrain/TerrainRenderer.js +1 -1
  169. package/views/3d/terrain/TileCompositor.js +1 -1
  170. package/views/3d/terrain/TileRenderer.js +1 -1
  171. package/views/3d/terrain/TilingScheme.js +1 -1
  172. package/views/3d/webgl-engine/collections/Component/ComponentData.js +1 -1
  173. package/views/3d/webgl-engine/core/shaderModules/interfaces.js +1 -1
  174. package/views/3d/webgl-engine/effects/ScreenSpaceGeometry.js +1 -1
  175. package/views/3d/webgl-engine/effects/SmaaRenderPass.js +1 -1
  176. package/views/3d/webgl-engine/lib/CompositingHelper.js +1 -1
  177. package/views/3d/webgl-engine/lib/GeometryUtil.js +1 -1
  178. package/views/3d/webgl-engine/lib/PathBuilder.js +1 -1
  179. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  180. package/views/3d/webgl-engine/lib/RenderingContext.js +1 -1
  181. package/views/3d/webgl-engine/lib/SortedRenderGeometryRenderer.js +1 -1
  182. package/views/3d/webgl-engine/lib/WebGLLayer.js +1 -1
  183. package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
  184. package/views/3d/webgl-engine/parts/RenderView.js +1 -1
  185. package/views/3d/webgl-engine/parts/requireUtils.js +1 -1
  186. package/views/MapView.js +1 -1
  187. package/views/animation/pointToPoint/Path.js +1 -1
  188. package/views/draw/DrawOperation.js +1 -1
  189. package/views/draw/support/Reshape.js +1 -1
  190. package/views/draw/support/createUtils.js +1 -1
  191. package/views/interactive/SegmentLabels.js +1 -1
  192. package/views/interactive/editGeometry/EditGeometry.js +1 -1
  193. package/views/interactive/editGeometry/EditGeometryOperations.js +1 -1
  194. package/views/interactive/editGeometry/operations/UndoGroup.js +1 -1
  195. package/views/layers/GroupLayerView.js +1 -1
  196. package/views/webgl/ProgramCache.js +1 -1
  197. package/webscene/spec-certification/api.js +1 -1
  198. package/webscene/spec-certification/spec.js +1 -1
  199. package/webscene/spec-certification/utils.js +1 -1
  200. package/widgets/BuildingExplorer/BuildingNumericFilterViewModel.js +1 -1
  201. package/widgets/BuildingExplorer/BuildingPhase.js +1 -1
  202. package/widgets/BuildingExplorer/support/validation.js +1 -1
  203. package/widgets/Directions/support/resources.js +1 -1
  204. package/widgets/Directions.js +1 -1
  205. package/widgets/Editor/UpdateRecordWorkflow.js +1 -1
  206. package/widgets/FeatureForm/FeatureFormViewModel.js +1 -1
  207. package/widgets/FeatureForm/FieldInput.js +1 -1
  208. package/widgets/FeatureForm/FormExpressionsManager.js +1 -1
  209. package/widgets/FeatureForm.js +1 -1
  210. package/widgets/Features.js +1 -1
  211. package/widgets/Histogram/HistogramViewModel.js +1 -1
  212. package/widgets/HistogramRangeSlider/HistogramRangeSliderViewModel.js +1 -1
  213. package/widgets/Legend/styles/Card.js +1 -1
  214. package/widgets/Legend/styles/support/univariateUtils.js +1 -1
  215. package/widgets/Legend/support/ActiveLayerInfo.js +1 -1
  216. package/widgets/Legend/support/colorRampUtils.js +1 -1
  217. package/widgets/Legend/support/sizeRampUtils.js +1 -1
  218. package/widgets/Legend/support/utils.js +1 -1
  219. package/widgets/Popup.js +1 -1
  220. package/widgets/ScaleRangeSlider/ScaleRangeSliderViewModel.js +1 -1
  221. package/widgets/ScaleRangeSlider/ScaleRanges.js +1 -1
  222. package/widgets/ValuePicker/ValuePickerSlider.js +1 -1
  223. package/widgets/smartMapping/ClassedSizeSlider.js +1 -1
  224. package/widgets/smartMapping/ColorSizeSlider.js +1 -1
  225. package/widgets/smartMapping/HeatmapSlider/HeatmapSliderViewModel.js +1 -1
  226. package/widgets/smartMapping/SizeSlider.js +1 -1
  227. package/widgets/smartMapping/SmartMappingPrimaryHandleSliderViewModel.js +1 -1
  228. package/widgets/smartMapping/SmartMappingSliderViewModel.js +1 -1
  229. package/assets/esri/core/workers/chunks/0210f4c2e1f3ed13041b.js +0 -1
  230. package/assets/esri/core/workers/chunks/07bb40162d97d098bc19.js +0 -1
  231. package/assets/esri/core/workers/chunks/0a18317566c1fcb68422.js +0 -1
  232. package/assets/esri/core/workers/chunks/0de65e03db8c611af9fb.js +0 -1
  233. package/assets/esri/core/workers/chunks/1a60d23a92bcf91dbb22.js +0 -1
  234. package/assets/esri/core/workers/chunks/205a0b34b698d5329854.js +0 -1
  235. package/assets/esri/core/workers/chunks/25211d5904ee9d5f4a9d.js +0 -1
  236. package/assets/esri/core/workers/chunks/26b12d1ea713c1e07701.js +0 -1
  237. package/assets/esri/core/workers/chunks/2bfa7ee324c32a56b0d3.js +0 -1
  238. package/assets/esri/core/workers/chunks/4510a17839405146130b.js +0 -1
  239. package/assets/esri/core/workers/chunks/524156c3f5383c2dd0e3.js +0 -1
  240. package/assets/esri/core/workers/chunks/59666ecb7c2c1f5a13b2.js +0 -1
  241. package/assets/esri/core/workers/chunks/5c005c9514354c77ec27.js +0 -1
  242. package/assets/esri/core/workers/chunks/620ec5c75561183d3d73.js +0 -1
  243. package/assets/esri/core/workers/chunks/68512670816f59c0e6a5.js +0 -1
  244. package/assets/esri/core/workers/chunks/6c7374ebc18b46b3480a.js +0 -1
  245. package/assets/esri/core/workers/chunks/75ba2af92da232067adb.js +0 -1
  246. package/assets/esri/core/workers/chunks/7c1f0598a016516dcec3.js +0 -1
  247. package/assets/esri/core/workers/chunks/8dcec8d1b670d2b7ea2b.js +0 -1
  248. package/assets/esri/core/workers/chunks/8e07dfb6fc2673b640cb.js +0 -1
  249. package/assets/esri/core/workers/chunks/9050b167355588b7003d.js +0 -1
  250. package/assets/esri/core/workers/chunks/9230d68799f0b0b9ef36.js +0 -1
  251. package/assets/esri/core/workers/chunks/af4083f2aad5f5d49dde.js +0 -1
  252. package/assets/esri/core/workers/chunks/b0a57718a0765d1c8df0.js +0 -1
  253. package/assets/esri/core/workers/chunks/b431b81a7bf45dd527da.js +0 -1
  254. package/assets/esri/core/workers/chunks/bda311ad48efdb265939.js +0 -1
  255. package/assets/esri/core/workers/chunks/d5cce09fbe16cbb8fee4.js +0 -1
  256. package/assets/esri/core/workers/chunks/da547c3cabe4a89c3ce6.js +0 -1
  257. package/assets/esri/core/workers/chunks/dd295fa57b45b7ec4ec5.js +0 -1
  258. package/assets/esri/core/workers/chunks/f553b464e969d45bf451.js +0 -1
  259. package/assets/esri/core/workers/chunks/f5865294983eb160de8c.js +0 -1
  260. package/assets/esri/core/workers/chunks/fdb7b1fbdb6fe091ad83.js +0 -1
  261. package/views/2d/tiling/PagedTileQueue.js +0 -5
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import r from"../../../core/Evented.js";import{someMap as t}from"../../../core/MapUtils.js";import{releaseMaybe as s,disposeMaybe as i,destroyMaybe as o}from"../../../core/maybe.js";import a from"../../../core/PooledArray.js";import{watch as n,syncAndInitial as h,on as d}from"../../../core/reactiveUtils.js";import{someSet as l}from"../../../core/SetUtils.js";import{property as c}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import{subclass as u}from"../../../core/accessorSupport/decorators/subclass.js";import{x as p,f as m}from"../../../chunks/mat4.js";import{s as _}from"../../../chunks/vec3.js";import{f as g}from"../../../chunks/vec3f64.js";import{ViewingMode as y}from"../../ViewingMode.js";import{DrapeTargetType as R,DrapeSourceType as f,DrapedRenderGroup as T}from"../layers/interfaces.js";import b from"../support/debugFlags.js";import{OverlayIndex as w,RenderTargetType as v}from"./interfaces.js";import{Overlay as x}from"./Overlay.js";import{OverlayRenderTarget as D}from"./OverlayRenderTarget.js";import{ColorFormat as S}from"../webgl-engine/core/FBOCache.js";import{ShaderOutput as P}from"../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{T as O}from"../../../chunks/TextureOnly.glsl.js";import{ShaderTechniqueRepository as j}from"../webgl-engine/core/shaderTechnique/ShaderTechniqueRepository.js";import{SyncRenderPlugin as E}from"../webgl-engine/effects/RenderPlugin.js";import{Camera as C}from"../webgl-engine/lib/Camera.js";import{GLMaterialRepository as A}from"../webgl-engine/lib/GLMaterialRepository.js";import{createEmptyDepthTexture as M}from"../webgl-engine/lib/glUtil3D.js";import{GridLocalOriginFactory as q}from"../webgl-engine/lib/GridLocalOriginFactory.js";import{RenderOccludedFlag as W}from"../webgl-engine/lib/Material.js";import{OverlayRenderContext as L}from"../webgl-engine/lib/RenderContext.js";import{RenderSlot as F}from"../webgl-engine/lib/RenderSlot.js";import{ShadowMap as H}from"../webgl-engine/lib/ShadowMap.js";import{SortedRenderGeometryRenderer as V}from"../webgl-engine/lib/SortedRenderGeometryRenderer.js";import{SSAOHelper as U}from"../webgl-engine/lib/SSAOHelper.js";import{TextureTechnique as I}from"../webgl-engine/lib/TextureTechnique.js";import{TextureTechniqueConfiguration as k}from"../webgl-engine/lib/TextureTechniqueConfiguration.js";import{TransparencyPassType as N}from"../webgl-engine/lib/TransparencyPassType.js";import{UpdatePolicy as G}from"../webgl-engine/lib/UpdatePolicy.js";import{AmbientLight as B}from"../webgl-engine/lighting/Lightsources.js";import{O as z}from"../../../chunks/OverlayCompositing.glsl.js";import{OverlayCompositingTechnique as Y}from"../webgl-engine/shaders/OverlayCompositingTechnique.js";import{TaskPriority as X,noBudget as J}from"../../support/Scheduler.js";import{ClearBufferBit as K,TextureSamplingMode as Q}from"../../webgl/enums.js";import{Texture as Z}from"../../webgl/Texture.js";import{TextureDescriptor as $}from"../../webgl/TextureDescriptor.js";let ee=class extends E{get _bindParameters(){return this._renderContext.bindParameters}get _rctx(){return this.view._stage.renderView.renderingContext}get rctx(){return this._rctx}get materialRepository(){return this._materialRepository}get screenToWorldRatio(){return this._screenToWorldRatio}get localOriginFactory(){return this._localOriginFactory}constructor(e){super(e),this._overlays=null,this._overlayRenderTarget=null,this._overlayParameters=new z,this._hasHighlights=!1,this._rendersOccluded=!1,this._hasWater=!1,this._renderers=new Map,this._sortedDrapeSourceRenderersDirty=!1,this._sortedRenderers=new a,this._passParameters=new O,this._materialRepository=null,this._screenToWorldRatio=1,this._localOriginFactory=null,this._camera=new C,this.worldToPCSRatio=1,this.events=new r,this.longitudeCyclical=null,this.renderSlots=[F.DRAPED_MATERIAL,F.DRAPED_WATER]}initialize(){const e=this.view._stage.renderer.fboCache,r=this.view._stage.renderView,{waterTextureRepository:t,stippleTextureRepository:s,markerTextureRepository:i}=r;this._shaderTechniqueRepository=new j({rctx:this._rctx,viewingMode:y.Local,stippleTextureRepository:s,markerTextureRepository:i,waterTextureRepository:t}),this._renderContext=new L(this._rctx,new H(e,this.view.state.viewingMode),new U(this.view,e,this._shaderTechniqueRepository,(()=>{}))),this.addHandles([n((()=>t.updating),(()=>this.events.emit("content-changed")),h),n((()=>this.spatialReference),(e=>this._localOriginFactory=new q(e)),h),d((()=>this.view.allLayerViews),"after-changes",(()=>this._sortedDrapeSourceRenderersDirty=!0))]),this._materialRepository=new A(r.textureRepository,this._shaderTechniqueRepository,(e=>{(e.renderOccluded&ie)>0!==this._rendersOccluded&&this._updateRendersOccluded(),this.events.emit("content-changed"),this.notifyChange("updating"),this.notifyChange("isEmpty")}),(()=>this.events.emit("content-changed"))),this._bindParameters.slot=F.DRAPED_MATERIAL,this._bindParameters.mainDepth=M(this._rctx),this._camera.near=1,this._camera.far=1e4,this._camera.relativeElevation=null,this._bindParameters.camera=this._camera,this._bindParameters.transparencyPassType=N.NONE,this._bindParameters.newLighting.noonFactor=0,this._bindParameters.newLighting.globalFactor=0,this._bindParameters.newLighting.set([new B(g(1,1,1))]),this.addHandles(this.view.resourceController.scheduler.registerTask(X.STAGE,this))}destroy(){this._renderers.forEach((e=>e.destroy())),this._renderers.clear(),this._debugTextureTechnique=s(this._debugTextureTechnique),this._passParameters.texture=i(this._passParameters.texture),this._bindParameters.mainDepth=i(this._bindParameters.mainDepth),this._shaderTechniqueRepository=o(this._shaderTechniqueRepository),this.disposeOverlays()}canRender(e){return e===F.DRAPED_MATERIAL||e===F.DRAPED_WATER}initializeRenderContext(e){this.pluginContext=e}uninitializeRenderContext(){}render(){}get updating(){return this._sortedDrapeSourceRenderersDirty||t(this._renderers,(e=>e.updating))}get hasOverlays(){return null!=this._overlays&&null!=this._overlayRenderTarget}get usedMemory(){return(this._overlayRenderTarget?.gpuMemoryUsage??0)+Array.from(this._renderers.values()).reduce(((e,r)=>e+r.usedMemory),0)}createGeometryDrapeSourceRenderer(e){return this.createDrapeSourceRenderer(e,V)}createDrapeSourceRenderer(e,r,t){const s=this._renderers.get(e);null!=s&&s.destroy();const i=new r({...t,rendererContext:this,drapeSource:e});return this._renderers.set(e,i),this._sortedDrapeSourceRenderersDirty=!0,"fullOpacity"in e&&this.addHandles(n((()=>e.fullOpacity),(()=>this.events.emit("content-changed"))),e),i}removeDrapeSourceRenderer(e){if(null==e)return;const r=this._renderers.get(e);null!=r&&(this._sortedDrapeSourceRenderersDirty=!0,this._renderers.delete(e),this.removeHandles(e),r.destroy())}computeValidity(){return this._overlayRenderTarget?.computeValidity()??0}releaseRenderTargets(){this._overlayRenderTarget?.dispose()}get overlays(){return this._overlays??[]}ensureDrapeTargets(e){null!=this._overlays&&this._overlays.forEach((r=>r.hasTargetWithoutRasterImage=l(e,(e=>e.drapeTargetType===R.WithoutRasterImage))))}ensureDrapeSources(e){null!=this._overlays&&this._overlays.forEach((r=>{r.hasDrapedFeatureSource=l(e,(e=>e.drapeSourceType===f.Features)),r.hasDrapedRasterSource=l(e,(e=>e.drapeSourceType===f.RasterImage))}))}ensureOverlays(e,r,t=this._bindParameters.overlayStretch){null==this._overlays&&(this._overlayRenderTarget=new D(this.view._stage.renderer.fboCache),this._overlays=[new x(w.INNER,this._overlayRenderTarget),new x(w.OUTER,this._overlayRenderTarget)]),this.ensureDrapeTargets(e),this.ensureDrapeSources(r),this._bindParameters.overlayStretch=t}disposeOverlays(){this._overlays=null,this._overlayRenderTarget=i(this._overlayRenderTarget),this.events.emit("textures-disposed")}get running(){return this.updating}runTask(e){this._processDrapeSources(e,(()=>!0))}_processDrapeSources(e,r){let t=!1;for(const[s,i]of this._renderers){if(e.done)break;(s.destroyed||r(s))&&(i.commitChanges()&&(t=!0,e.madeProgress()))}this._sortedDrapeSourceRenderersDirty&&(this._sortedDrapeSourceRenderersDirty=!1,t=!0,this._updateSortedDrapeSourceRenderers()),t&&(null!=this._overlays&&0===this._renderers.size&&this.disposeOverlays(),this.notifyChange("updating"),this.notifyChange("isEmpty"),this.events.emit("content-changed"),this._updateHasHighlights(),this._updateRendersOccluded(),this._updateHasWater())}processSyncDrapeSources(){this._processDrapeSources(J,(e=>e.updatePolicy===G.SYNC))}get isEmpty(){return!b.OVERLAY_DRAW_DEBUG_TEXTURE&&!t(this._renderers,(e=>!e.isEmpty))}get hasHighlights(){return this._hasHighlights}get hasWater(){return this._hasWater}get rendersOccluded(){return this._rendersOccluded}updateAnimation(e){let r=!1;return this._renderers.forEach((t=>r=t.updateAnimation(e)||r)),r}updateDrapeSourceOrder(){this._sortedDrapeSourceRenderersDirty=!0}drawTarget(e,r,t){const s=e.canvasGeometries;if(0===s.numViews)return;const{alignPixelEnabled:i,contentPixelRatio:o}=t;this._screenToWorldRatio=o*e.mapUnitsPerPixel/this._bindParameters.overlayStretch;const a=r.output;if(this.isEmpty||a===P.Highlight&&!this.hasHighlights||a===P.Normal&&!this.hasWater||!e.hasSomeSizedView())return;const n=this._rctx;this._camera.pixelRatio=e.pixelRatio*o,this._renderContext.output=a,this._bindParameters.alignPixelEnabled=i,this._bindParameters.screenToWorldRatio=this._screenToWorldRatio,this._bindParameters.screenToPCSRatio=this._screenToWorldRatio*this.worldToPCSRatio,this._bindParameters.slot=a===P.Normal?F.DRAPED_WATER:F.DRAPED_MATERIAL,e.applyViewport(this._rctx);const h=2*e.resolution,d=e.resolution,l=r.fbo;if(l.bind(n,h,d),e.index===w.INNER&&(n.setClearColor(0,0,0,0),n.clearSafe(K.COLOR_BUFFER_BIT)),r.type===v.Occluded&&(this._renderContext.renderOccludedMask=ie),b.OVERLAY_DRAW_DEBUG_TEXTURE&&r.type!==v.Occluded)for(let c=0;c<s.numViews;c++)this._setViewParameters(s.extents[c],e),this._ensureDebugPatternResources(e.resolution,te[e.index]),this._rctx.bindTechnique(this._debugTextureTechnique,this._passParameters,null),this.pluginContext.screen.draw();this._sortedRenderers.forAll((({drapeSource:t,renderer:i})=>{if(r.type===v.ColorNoRasterImage&&t.drapeSourceType===f.RasterImage)return;const{fullOpacity:o}=t,c=null!=o&&o<1&&a===P.Color?this.bindTemporaryFramebuffer(h,d):null;for(let r=0;r<s.numViews;r++)this._setViewParameters(s.extents[r],e),i.render(this._renderContext);if(c){l.bind(n,h,d),this._overlayParameters.texture=c.colorTexture,this._overlayParameters.opacity=o,this._overlayParameters.overlayIndex=e.index;const r=this.pluginContext.techniqueRepository.acquire(Y);this._rctx.bindTechnique(r,this._overlayParameters,this._renderContext.bindParameters),this.pluginContext.screen.draw(),r.release(),c.release()}})),n.bindFramebuffer(null),l.generateMipMap(),this._renderContext.resetRenderOccludedMask()}bindTemporaryFramebuffer(e,r){const t=this.view._stage.renderer.fboCache,s=t.acquire(S.RGBA,e,r);return t.rctx.bindFramebuffer(s.fbo),t.rctx.clearSafe(K.COLOR_BUFFER_BIT),s}async reloadShaders(){await this._shaderTechniqueRepository.reloadAll()}notifyContentChanged(){this.events.emit("content-changed")}intersect(e,r,t,s){let i=0;for(const o of this._renderers.values())i=o.intersect?.(e,r,t,s,i)??i}_updateSortedDrapeSourceRenderers(){if(this._sortedRenderers.clear(),0===this._renderers.size)return;const e=this.view.map.allLayers;this._renderers.forEach(((r,t)=>{const s=e.indexOf(t.layer),i=s>=0,o=this._renderers.size*(t.renderGroup??(i?T.MapLayer:T.ViewLayer))+(i?s:0);this._sortedRenderers.push(new re(t,r,o))})),this._sortedRenderers.sort(((e,r)=>e.index-r.index))}_setViewParameters(e,r){const t=this._camera;t.viewport=[0,0,r.resolution,r.resolution],p(t.projectionMatrix,0,e[2]-e[0],0,e[3]-e[1],t.near,t.far),m(t.viewMatrix,[-e[0],-e[1],0])}_updateHasWater(){const e=t(this._renderers,(e=>e.hasWater));e!==this._hasWater&&(this._hasWater=e,this.events.emit("has-water",e))}_updateHasHighlights(){const e=t(this._renderers,(e=>e.hasHighlights));e!==this._hasHighlights&&(this._hasHighlights=e,this.events.emit("has-highlights",e))}_updateRendersOccluded(){const e=t(this._renderers,(e=>e.rendersOccluded));e!==this._rendersOccluded&&(this._rendersOccluded=e,this.events.emit("renders-occluded",e))}_ensureDebugPatternResources(e,r){if(_(this._passParameters.color,r[0],r[1],r[2]),this._passParameters.texture)return;const t=new Uint8Array(e*e*4);let s=0;for(let a=0;a<e;a++)for(let r=0;r<e;r++){const i=Math.floor(r/10),o=Math.floor(a/10);i<2||o<2||10*i>e-20||10*o>e-20?(t[s++]=255,t[s++]=255,t[s++]=255,t[s++]=255):(t[s++]=255,t[s++]=255,t[s++]=255,t[s++]=1&i&&1&o?1&r^1&a?0:255:1&i^1&o?0:128)}const i=new $(e);i.samplingMode=Q.NEAREST,this._passParameters.texture=new Z(this._rctx,i,t);const o=new k;o.hasAlpha=!0,this._debugTextureTechnique=this._shaderTechniqueRepository.acquire(I,o)}get test(){return{drapedRenderers:Array.from(this._renderers.values()),getDrapeSourceRenderer:e=>this._renderers.get(e)}}};e([c()],ee.prototype,"_sortedDrapeSourceRenderersDirty",void 0),e([c({autoDestroy:!0})],ee.prototype,"_shaderTechniqueRepository",void 0),e([c({constructOnly:!0})],ee.prototype,"view",void 0),e([c()],ee.prototype,"worldToPCSRatio",void 0),e([c()],ee.prototype,"spatialReference",void 0),e([c({type:Boolean,readOnly:!0})],ee.prototype,"updating",null),e([c()],ee.prototype,"isEmpty",null),ee=e([u("esri.views.3d.terrain.OverlayRenderer")],ee);class re{constructor(e,r,t){this.drapeSource=e,this.renderer=r,this.index=t}}const te=[[1,.5,.5],[.5,.5,1]],se=-2,ie=W.OccludeAndTransparent;export{se as DRAPED_Z,ee as OverlayRenderer,ie as overlayRenderOccludedFlag};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import r from"../../../core/Evented.js";import{someMap as t}from"../../../core/MapUtils.js";import{releaseMaybe as s,disposeMaybe as i,destroyMaybe as o}from"../../../core/maybe.js";import a from"../../../core/PooledArray.js";import{watch as n,syncAndInitial as h,on as d}from"../../../core/reactiveUtils.js";import{someSet as l}from"../../../core/SetUtils.js";import{property as c}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import{subclass as u}from"../../../core/accessorSupport/decorators/subclass.js";import{x as p,f as m}from"../../../chunks/mat4.js";import{s as _}from"../../../chunks/vec3.js";import{f as g}from"../../../chunks/vec3f64.js";import{ViewingMode as y}from"../../ViewingMode.js";import{DrapeTargetType as R,DrapeSourceType as f,DrapedRenderGroup as T}from"../layers/interfaces.js";import b from"../support/debugFlags.js";import{OverlayIndex as w,RenderTargetType as v}from"./interfaces.js";import{Overlay as x}from"./Overlay.js";import{OverlayRenderTarget as D}from"./OverlayRenderTarget.js";import{ColorFormat as S}from"../webgl-engine/core/FBOCache.js";import{ShaderOutput as P}from"../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{OverlayMode as O}from"../webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js";import{T as j}from"../../../chunks/TextureOnly.glsl.js";import{ShaderTechniqueRepository as E}from"../webgl-engine/core/shaderTechnique/ShaderTechniqueRepository.js";import{SyncRenderPlugin as C}from"../webgl-engine/effects/RenderPlugin.js";import{Camera as A}from"../webgl-engine/lib/Camera.js";import{GLMaterialRepository as W}from"../webgl-engine/lib/GLMaterialRepository.js";import{createEmptyDepthTexture as M}from"../webgl-engine/lib/glUtil3D.js";import{GridLocalOriginFactory as q}from"../webgl-engine/lib/GridLocalOriginFactory.js";import{RenderOccludedFlag as L}from"../webgl-engine/lib/Material.js";import{OverlayRenderContext as F}from"../webgl-engine/lib/RenderContext.js";import{RenderSlot as H}from"../webgl-engine/lib/RenderSlot.js";import{ShadowMap as V}from"../webgl-engine/lib/ShadowMap.js";import{SortedRenderGeometryRenderer as U}from"../webgl-engine/lib/SortedRenderGeometryRenderer.js";import{SSAOHelper as I}from"../webgl-engine/lib/SSAOHelper.js";import{TextureTechnique as k}from"../webgl-engine/lib/TextureTechnique.js";import{TextureTechniqueConfiguration as N}from"../webgl-engine/lib/TextureTechniqueConfiguration.js";import{TransparencyPassType as G}from"../webgl-engine/lib/TransparencyPassType.js";import{UpdatePolicy as B}from"../webgl-engine/lib/UpdatePolicy.js";import{AmbientLight as z}from"../webgl-engine/lighting/Lightsources.js";import{O as Y}from"../../../chunks/OverlayCompositing.glsl.js";import{OverlayCompositingTechnique as X}from"../webgl-engine/shaders/OverlayCompositingTechnique.js";import{TaskPriority as J,noBudget as K}from"../../support/Scheduler.js";import{ClearBufferBit as Q,TextureSamplingMode as Z}from"../../webgl/enums.js";import{Texture as $}from"../../webgl/Texture.js";import{TextureDescriptor as ee}from"../../webgl/TextureDescriptor.js";let re=class extends C{get _bindParameters(){return this._renderContext.bindParameters}get _rctx(){return this.view._stage.renderView.renderingContext}get rctx(){return this._rctx}get materialRepository(){return this._materialRepository}get screenToWorldRatio(){return this._screenToWorldRatio}get localOriginFactory(){return this._localOriginFactory}constructor(e){super(e),this._overlays=null,this._overlayRenderTarget=null,this._overlayParameters=new Y,this._hasHighlights=!1,this._rendersOccluded=!1,this._hasWater=!1,this._renderers=new Map,this._sortedDrapeSourceRenderersDirty=!1,this._sortedRenderers=new a,this._passParameters=new j,this._materialRepository=null,this._screenToWorldRatio=1,this._localOriginFactory=null,this._camera=new A,this.worldToPCSRatio=1,this.events=new r,this.longitudeCyclical=null,this.renderSlots=[H.DRAPED_MATERIAL,H.DRAPED_WATER]}initialize(){const e=this.view._stage.renderer.fboCache,r=this.view._stage.renderView,{waterTextureRepository:t,stippleTextureRepository:s,markerTextureRepository:i}=r;this._shaderTechniqueRepository=new E({rctx:this._rctx,viewingMode:y.Local,stippleTextureRepository:s,markerTextureRepository:i,waterTextureRepository:t}),this._renderContext=new F(this._rctx,new V(e,this.view.state.viewingMode),new I(this.view,e,this._shaderTechniqueRepository,(()=>{}))),this.addHandles([n((()=>t.updating),(()=>this.events.emit("content-changed")),h),n((()=>this.spatialReference),(e=>this._localOriginFactory=new q(e)),h),d((()=>this.view.allLayerViews),"after-changes",(()=>this._sortedDrapeSourceRenderersDirty=!0))]),this._materialRepository=new W(r.textureRepository,this._shaderTechniqueRepository,(e=>{(e.renderOccluded&oe)>0!==this._rendersOccluded&&this._updateRendersOccluded(),this.events.emit("content-changed"),this.notifyChange("updating"),this.notifyChange("isEmpty")}),(()=>this.events.emit("content-changed"))),this._bindParameters.slot=H.DRAPED_MATERIAL,this._bindParameters.mainDepth=M(this._rctx),this._camera.near=1,this._camera.far=1e4,this._camera.relativeElevation=null,this._bindParameters.camera=this._camera,this._bindParameters.transparencyPassType=G.NONE,this._bindParameters.newLighting.noonFactor=0,this._bindParameters.newLighting.globalFactor=0,this._bindParameters.newLighting.set([new z(g(1,1,1))]),this.addHandles(this.view.resourceController.scheduler.registerTask(J.STAGE,this))}destroy(){this._renderers.forEach((e=>e.destroy())),this._renderers.clear(),this._debugTextureTechnique=s(this._debugTextureTechnique),this._passParameters.texture=i(this._passParameters.texture),this._bindParameters.mainDepth=i(this._bindParameters.mainDepth),this._shaderTechniqueRepository=o(this._shaderTechniqueRepository),this.disposeOverlays()}canRender(e){return e===H.DRAPED_MATERIAL||e===H.DRAPED_WATER}initializeRenderContext(e){this.pluginContext=e}uninitializeRenderContext(){}render(){}get updating(){return this._sortedDrapeSourceRenderersDirty||t(this._renderers,(e=>e.updating))}get hasOverlays(){return null!=this._overlays&&null!=this._overlayRenderTarget}get usedMemory(){return(this._overlayRenderTarget?.gpuMemoryUsage??0)+Array.from(this._renderers.values()).reduce(((e,r)=>e+r.usedMemory),0)}createGeometryDrapeSourceRenderer(e){return this.createDrapeSourceRenderer(e,U)}createDrapeSourceRenderer(e,r,t){const s=this._renderers.get(e);null!=s&&s.destroy();const i=new r({...t,rendererContext:this,drapeSource:e});return this._renderers.set(e,i),this._sortedDrapeSourceRenderersDirty=!0,"fullOpacity"in e&&this.addHandles(n((()=>e.fullOpacity),(()=>this.events.emit("content-changed"))),e),i}removeDrapeSourceRenderer(e){if(null==e)return;const r=this._renderers.get(e);null!=r&&(this._sortedDrapeSourceRenderersDirty=!0,this._renderers.delete(e),this.removeHandles(e),r.destroy())}computeValidity(){return this._overlayRenderTarget?.computeValidity()??0}releaseRenderTargets(){this._overlayRenderTarget?.dispose()}get overlays(){return this._overlays??[]}ensureDrapeTargets(e){null!=this._overlays&&this._overlays.forEach((r=>r.hasTargetWithoutRasterImage=l(e,(e=>e.drapeTargetType===R.WithoutRasterImage))))}ensureDrapeSources(e){null!=this._overlays&&this._overlays.forEach((r=>{r.hasDrapedFeatureSource=l(e,(e=>e.drapeSourceType===f.Features)),r.hasDrapedRasterSource=l(e,(e=>e.drapeSourceType===f.RasterImage))}))}ensureOverlays(e,r,t=this._bindParameters.overlayStretch){null==this._overlays&&(this._overlayRenderTarget=new D(this.view._stage.renderer.fboCache),this._overlays=[new x(w.INNER,this._overlayRenderTarget),new x(w.OUTER,this._overlayRenderTarget)]),this.ensureDrapeTargets(e),this.ensureDrapeSources(r),this._bindParameters.overlayStretch=t}disposeOverlays(){this._overlays=null,this._overlayRenderTarget=i(this._overlayRenderTarget),this.events.emit("textures-disposed")}get running(){return this.updating}runTask(e){this._processDrapeSources(e,(()=>!0))}_processDrapeSources(e,r){let t=!1;for(const[s,i]of this._renderers){if(e.done)break;(s.destroyed||r(s))&&(i.commitChanges()&&(t=!0,e.madeProgress()))}this._sortedDrapeSourceRenderersDirty&&(this._sortedDrapeSourceRenderersDirty=!1,t=!0,this._updateSortedDrapeSourceRenderers()),t&&(null!=this._overlays&&0===this._renderers.size&&this.disposeOverlays(),this.notifyChange("updating"),this.notifyChange("isEmpty"),this.events.emit("content-changed"),this._updateHasHighlights(),this._updateRendersOccluded(),this._updateHasWater())}processSyncDrapeSources(){this._processDrapeSources(K,(e=>e.updatePolicy===B.SYNC))}get isEmpty(){return!b.OVERLAY_DRAW_DEBUG_TEXTURE&&!t(this._renderers,(e=>!e.isEmpty))}get hasHighlights(){return this._hasHighlights}get hasWater(){return this._hasWater}get rendersOccluded(){return this._rendersOccluded}get mode(){return this.isEmpty?O.Disabled:this._overlayRenderTarget?.getTexture(v.Water)?O.EnabledWithWater:this._overlayRenderTarget?.getTexture(v.Color)?O.Enabled:O.Disabled}updateAnimation(e){let r=!1;return this._renderers.forEach((t=>r=t.updateAnimation(e)||r)),r}updateDrapeSourceOrder(){this._sortedDrapeSourceRenderersDirty=!0}drawTarget(e,r,t){const s=e.canvasGeometries;if(0===s.numViews)return;const{alignPixelEnabled:i,contentPixelRatio:o}=t;this._screenToWorldRatio=o*e.mapUnitsPerPixel/this._bindParameters.overlayStretch;const a=r.output;if(this.isEmpty||a===P.Highlight&&!this.hasHighlights||a===P.Normal&&!this.hasWater||!e.hasSomeSizedView())return;const n=this._rctx;this._camera.pixelRatio=e.pixelRatio*o,this._renderContext.output=a,this._bindParameters.alignPixelEnabled=i,this._bindParameters.screenToWorldRatio=this._screenToWorldRatio,this._bindParameters.screenToPCSRatio=this._screenToWorldRatio*this.worldToPCSRatio,this._bindParameters.slot=a===P.Normal?H.DRAPED_WATER:H.DRAPED_MATERIAL;const h=b.OVERLAY_DRAW_DEBUG_TEXTURE&&r.type!==v.Occluded;if(!h&&!this._sortedRenderers.some((({renderer:e})=>e.shouldRender(this._renderContext))))return;e.applyViewport(this._rctx);const d=2*e.resolution,l=e.resolution,c=r.fbo;if(c.bind(n,d,l),e.index===w.INNER&&(n.setClearColor(0,0,0,0),n.clearSafe(Q.COLOR_BUFFER_BIT)),r.type===v.Occluded&&(this._renderContext.renderOccludedMask=oe),h)for(let u=0;u<s.numViews;u++)this._setViewParameters(s.extents[u],e),this._ensureDebugPatternResources(e.resolution,se[e.index]),this._rctx.bindTechnique(this._debugTextureTechnique,this._passParameters,null),this._rctx.screen.draw();this._sortedRenderers.forAll((({drapeSource:t,renderer:i})=>{if(r.type===v.ColorNoRasterImage&&t.drapeSourceType===f.RasterImage)return;const{fullOpacity:o}=t,h=null!=o&&o<1&&a===P.Color?this.bindTemporaryFramebuffer(d,l):null;for(let r=0;r<s.numViews;r++)this._setViewParameters(s.extents[r],e),i.render(this._renderContext);if(h){c.bind(n,d,l),this._overlayParameters.texture=h.colorTexture,this._overlayParameters.opacity=o,this._overlayParameters.overlayIndex=e.index;const r=this.pluginContext.techniqueRepository.acquire(X);this._rctx.bindTechnique(r,this._overlayParameters,this._renderContext.bindParameters),this._rctx.screen.draw(),r.release(),h.release()}})),n.bindFramebuffer(null),c.generateMipMap(),this._renderContext.resetRenderOccludedMask()}bindTemporaryFramebuffer(e,r){const t=this.view._stage.renderer.fboCache,s=t.acquire(S.RGBA,e,r);return t.rctx.bindFramebuffer(s.fbo),t.rctx.clearSafe(Q.COLOR_BUFFER_BIT),s}async reloadShaders(){await this._shaderTechniqueRepository.reloadAll()}notifyContentChanged(){this.events.emit("content-changed")}intersect(e,r,t,s){let i=0;for(const o of this._renderers.values())i=o.intersect?.(e,r,t,s,i)??i}_updateSortedDrapeSourceRenderers(){if(this._sortedRenderers.clear(),0===this._renderers.size)return;const e=this.view.map.allLayers;this._renderers.forEach(((r,t)=>{const s=e.indexOf(t.layer),i=s>=0,o=this._renderers.size*(t.renderGroup??(i?T.MapLayer:T.ViewLayer))+(i?s:0);this._sortedRenderers.push(new te(t,r,o))})),this._sortedRenderers.sort(((e,r)=>e.index-r.index))}_setViewParameters(e,r){const t=this._camera;t.viewport=[0,0,r.resolution,r.resolution],p(t.projectionMatrix,0,e[2]-e[0],0,e[3]-e[1],t.near,t.far),m(t.viewMatrix,[-e[0],-e[1],0])}_updateHasWater(){const e=t(this._renderers,(e=>e.hasWater));e!==this._hasWater&&(this._hasWater=e,this.events.emit("has-water",e))}_updateHasHighlights(){const e=t(this._renderers,(e=>e.hasHighlights));e!==this._hasHighlights&&(this._hasHighlights=e,this.events.emit("has-highlights",e))}_updateRendersOccluded(){const e=t(this._renderers,(e=>e.rendersOccluded));e!==this._rendersOccluded&&(this._rendersOccluded=e,this.events.emit("renders-occluded",e))}_ensureDebugPatternResources(e,r){if(_(this._passParameters.color,r[0],r[1],r[2]),this._passParameters.texture)return;const t=new Uint8Array(e*e*4);let s=0;for(let a=0;a<e;a++)for(let r=0;r<e;r++){const i=Math.floor(r/10),o=Math.floor(a/10);i<2||o<2||10*i>e-20||10*o>e-20?(t[s++]=255,t[s++]=255,t[s++]=255,t[s++]=255):(t[s++]=255,t[s++]=255,t[s++]=255,t[s++]=1&i&&1&o?1&r^1&a?0:255:1&i^1&o?0:128)}const i=new ee(e);i.samplingMode=Z.NEAREST,this._passParameters.texture=new $(this._rctx,i,t);const o=new N;o.hasAlpha=!0,this._debugTextureTechnique=this._shaderTechniqueRepository.acquire(k,o)}get test(){return{drapedRenderers:Array.from(this._renderers.values()),getDrapeSourceRenderer:e=>this._renderers.get(e)}}};e([c()],re.prototype,"_sortedDrapeSourceRenderersDirty",void 0),e([c({autoDestroy:!0})],re.prototype,"_shaderTechniqueRepository",void 0),e([c({constructOnly:!0})],re.prototype,"view",void 0),e([c()],re.prototype,"worldToPCSRatio",void 0),e([c()],re.prototype,"spatialReference",void 0),e([c({type:Boolean,readOnly:!0})],re.prototype,"updating",null),e([c()],re.prototype,"isEmpty",null),re=e([u("esri.views.3d.terrain.OverlayRenderer")],re);class te{constructor(e,r,t){this.drapeSource=e,this.renderer=r,this.index=t}}const se=[[1,.5,.5],[.5,.5,1]],ie=-2,oe=L.OccludeAndTransparent;export{ie as DRAPED_Z,re as OverlayRenderer,oe as overlayRenderOccludedFlag};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Color.js";import{disposeMaybe as i}from"../../../core/maybe.js";import r from"../../../core/ObjectPool.js";import{property as s}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import{subclass as n}from"../../../core/accessorSupport/decorators/subclass.js";import{I as o}from"../../../chunks/mat4f64.js";import{b as a,s as l,e as h}from"../../../chunks/vec3.js";import{Z as u,f as c,c as d}from"../../../chunks/vec3f64.js";import{Z as p}from"../../../chunks/vec4f64.js";import{create as _,set as f}from"../../../geometry/support/aaBoundingBox.js";import{BufferViewVec3f as m}from"../../../geometry/support/buffer/BufferView.js";import{ViewingMode as g}from"../../ViewingMode.js";import{TextureUpdate as b}from"./interfaces.js";import{LayerClass as y}from"./LayerClass.js";import{OverlaySource as T}from"./Overlay.js";import{overlayRenderOccludedFlag as R}from"./OverlayRenderer.js";import{clearCaches as O}from"./PatchGeometry.js";import{PatchRenderData as x}from"./PatchRenderData.js";import{RenderOrder as C}from"./RenderOrder.js";import{ENABLE_TERRAIN_INTERNAL_CHECKS as v}from"./terrainUtils.js";import{TileRenderer as D}from"./TileRenderer.js";import{TileUpdate as P}from"./TileUpdate.js";import{IteratorPreorder as S,sortTiles as E,compareTiles as q}from"./tileUtils.js";import{componentMinimalSizeForIntersectionData as A,ComponentIntersectionData as w}from"../webgl-engine/collections/Component/ComponentIntersectionData.js";import{ShaderOutput as N}from"../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{OverlayMode as j}from"../webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js";import{T as G}from"../../../chunks/Terrain.glsl.js";import{TileBlendInput as I}from"../webgl-engine/core/shaderLibrary/terrain/TileBlendInput.js";import{SyncPrepareRenderPlugin as L}from"../webgl-engine/effects/RenderPlugin.js";import{Attribute as F}from"../webgl-engine/lib/Attribute.js";import{RenderRequestType as U}from"../webgl-engine/lib/basicInterfaces.js";import{createEmptyTexture as k}from"../webgl-engine/lib/glUtil3D.js";import{newIntersectorResult as B}from"../webgl-engine/lib/Intersector.js";import{IntersectorType as M,StoreResults as z}from"../webgl-engine/lib/IntersectorInterfaces.js";import{RenderOccludedFlag as V}from"../webgl-engine/lib/Material.js";import{RenderSlot as H}from"../webgl-engine/lib/RenderSlot.js";import{getSettings as W}from"../webgl-engine/lib/screenSizePerspectiveUtils.js";import{VertexAttribute as Y}from"../webgl-engine/lib/VertexAttribute.js";import{TERRAIN_ID as Q,getVerticalOffsetTerrain as X}from"../webgl-engine/lib/verticalOffsetUtils.js";import{DrawParameters as Z}from"../webgl-engine/materials/DrawParameters.js";import{intersectAabbInvDirBefore as K,intersectTriangles as J}from"../webgl-engine/materials/internal/MaterialUtil.js";import{TerrainTechnique as $}from"../webgl-engine/shaders/TerrainTechnique.js";import{TerrainTechniqueConfiguration as ee}from"../webgl-engine/shaders/TerrainTechniqueConfiguration.js";import{PrimitiveType as te}from"../../webgl/enums.js";const ie=7,re=10,se=_();var ne;!function(e){e[e.Opaque=0]="Opaque",e[e.Semitransparent=1]="Semitransparent",e[e.TransparentWithDraped=2]="TransparentWithDraped",e[e.Empty=3]="Empty"}(ne||(ne={}));let oe=class extends L{get _isGlobal(){return this._stage.viewingMode===g.Global}get _techniques(){return this._context.techniqueRepository}get _rctx(){return this._context.renderContext.rctx}constructor(e){super(e),this.type=M.TERRAIN,this.isGround=!0,this.renderSlots=[H.OPAQUE_TERRAIN,H.TRANSPARENT_TERRAIN,H.OCCLUDED_TERRAIN],this._tileSize=256,this._techniqueConfiguration=new ee,this._passParameters=new G,this._renderDataPool=new r(x),this._patchGroups=new Map,this._patchGroupsDirty=!0,this._patchSortingDirty=!0,this._tileIterator=new S,this._highestVisibleLODTile=null,this._visible=!0,this._transparencyState=ne.Opaque,this._castShadows=!0,this._emptyTex=null,this._tileRenderer=null,this._stencilEnabledLayerExtents=new Array,this._numTilesRendered=0,this._numTilesCulled=0,this._numOriginsRendered=0,this.needsHighlight=!1,this.renderOccludedFlags=V.Occlude}initialize(){this._stage.addRenderPlugin(this)}destroy(){this._stage.removeRenderPlugin(this),O()}canRender(){return this._visible&&!!this._rootTiles&&!this.renderingDisabled}requiresOutput(e){return e===N.Depth&&this._overlayRenderer.hasWater||e===N.Highlight&&this.needsHighlight}set renderingDisabled(e){this._set("renderingDisabled",!!e),this.setDirty()}set transparency(e){this._transparencyState!==e&&(this._techniqueConfiguration.invisible=e===ne.TransparentWithDraped||e===ne.Empty,this._transparencyState=e,this.setNeedsRender())}get transparency(){return this._transparencyState}get renderPatchBorders(){return!!this._techniqueConfiguration.tileBorders}set renderPatchBorders(e){this._techniqueConfiguration.tileBorders!==e&&(this._techniqueConfiguration.tileBorders=e,this.setNeedsRender(),this.notifyChange("renderPatchBorders"))}get visualizeNormals(){return!!this._techniqueConfiguration.visualizeNormals}set visualizeNormals(e){this._techniqueConfiguration.visualizeNormals!==e&&(this._techniqueConfiguration.visualizeNormals=e,this.setNeedsRender(),this.notifyChange("visualizeNormals"))}get cullBackFaces(){return this._techniqueConfiguration.backfaceCullingEnabled}set cullBackFaces(e){this._techniqueConfiguration.backfaceCullingEnabled!==e&&(this._techniqueConfiguration.backfaceCullingEnabled=e,this.notifyChange("cullBackFaces"),this.setNeedsRender())}set renderOrder(e){this._set("renderOrder",e),this._setSortingDirty()}get layerUid(){return Q}get slicePlaneEnabled(){return this._techniqueConfiguration.hasSlicePlane}set slicePlaneEnabled(e){this._techniqueConfiguration.hasSlicePlane!==e&&(this._techniqueConfiguration.hasSlicePlane=e,this.setNeedsRender())}set textureFadingEnabled(e){this._techniqueConfiguration.textureFadingEnabled!==e&&(this._techniqueConfiguration.textureFadingEnabled=e,this.setNeedsRender())}set pbrMode(e){this._techniqueConfiguration.pbrMode!==e&&(this._techniqueConfiguration.pbrMode=e,this.setNeedsRender())}setDebugScreenSizePerspective(e){this._techniqueConfiguration.screenSizePerspective!==e&&(this._techniqueConfiguration.screenSizePerspective=e,this.setNeedsRender())}setRootTiles(e){this._rootTiles=e,this.setDirty()}setNeedsHighlight(e){this.needsHighlight=e,this.setNeedsRender()}setRenderOccludedOverlay(e){this.renderOccludedFlags=e?R:V.Occlude,this.setNeedsRender()}setStencilEnabledLayerExtents(e){this._stencilEnabledLayerExtents=e,this._setSortingDirty()}setTileSize(e){this._tileSize=e,null!=this._tileRenderer&&(this._tileRenderer.tileSize=e),this.setDirty()}_prepareTileForLoading(e){e.renderData||(e.renderData=this._renderDataPool.acquire(),e.renderData.init(e),e.renderData.localOrigin=this._getLocalOriginOfTile(e))}loadTile(e){this._prepareTileForLoading(e),this.updateTileGeometryState(e),this.updateTileTexture(e,P.TEXTURE_FADING)}updateTileTexture(e,t){null!=this._tileRenderer&&(this._tileRenderer.updateTileTexture(e,t===P.TEXTURE_FADING?b.FADING:b.UNFADED),this.setNeedsRender(),e.resetPendingUpdate(t))}updateTileGeometryState(e){for(const i of e.layerInfo[y.ELEVATION])i.pendingUpdates&=~P.GEOMETRY;e.resetPendingUpdate(P.GEOMETRY);const t=e.renderData.updateGeometryState();return t&&this.setDirty(),t}updateGeometryIfNeeded(e){e.isLoaded&&e.renderData.updateGeometryIfNeeded(this._rctx)}unloadTile(e){const t=e.renderData;t&&(t.releaseGeometry(),this._renderDataPool.release(t),t.clear(),e.renderData=null,e.setMemoryDirty(),this.setDirty())}_getLocalOriginOfTile(e){const t=re-ie,i=Math.max(0,Math.floor((e.level-t)/ie)*ie);if(this._isGlobal&&0===i)return u;for(;e.parent&&e.level>i;)e=e.parent;return e.centerAtSeaLevel}setVisibility(e){this._visible=e,this.setDirty()}getStats(){return{numTilesRendered:this._numTilesRendered,numTilesCulled:this._numTilesCulled,numOriginsRendered:this._numOriginsRendered}}set wireframe(e){this._get("wireframe")!==e&&(this._set("wireframe",e),this.setNeedsRender())}setDirty(e=U.UPDATE){this._patchGroupsDirty=!0,this._context.requestRender(e)}_setSortingDirty(e=U.UPDATE){this._patchSortingDirty=!0,this._context.requestRender(e)}setNeedsRender(e=U.UPDATE){this._context.requestRender(e)}initializeRenderContext(e){this._context=e,this._tileRenderer=new D(this._rctx,this._tileSize,this._techniques,this._cache),this.updateTileBackground(),this._emptyTex=k(this._rctx)}uninitializeRenderContext(){this._emptyTex=i(this._emptyTex),this._tileRenderer=i(this._tileRenderer)}intersect(e,t,i,r){if(!this._rootTiles||e.options.selectOpaqueTerrainOnly&&e.options.selectionMode&&this.transparency!==ne.Opaque)return;const s=ae,n=le;a(s,r,i),l(n,1/s[0],1/s[1],1/s[2]);const u=e.results.min,c=e.results.max,d=e.results.ground,p=e.options.store===z.MIN,_=!!e.results.ground.target,g=X(e.verticalOffset),b=e.tolerance;let y,T=p&&null!=u.dist?u.dist:1/0;const R=l=>{const _=l.renderData;if(!_?.vao)return;const R=_.geometry;f(se,R.boundingBox);const O=_.localOrigin;null!=g&&(g.localOrigin=O,g.applyToAabb(se));const x=se;if(he[0]=i[0]-O[0],he[1]=i[1]-O[1],he[2]=i[2]-O[2],!K(x,he,n,b,T))return;const C=(e,t,i)=>{e.set(this.type,l,t,i,o),T=p&&null!=u.dist?u.dist:1/0},v=(n,o)=>{if(null!=o&&n>=0&&(e.options.backfacesTerrain||h(o,s)<0)&&(e.options.invisibleTerrain||!e.options.selectionMode||null==t||t(i,r,n))){if((null==d.dist||n<d.dist)&&C(d,n,o),e.options.isFiltered)return;e.options.store===z.ALL&&(null==y?(y=B(e.ray),C(y,n,o),e.results.all.push(y)):n<y.dist&&C(y,n,o)),(null==u.dist||n<u.dist)&&C(u,n,o),e.options.store!==z.MIN&&(null==c.dist||n>c.dist)&&C(c,n,o)}},D=ue;a(D,r,O);const P=R.indices,S=R.vertexAttributes,E=S.getField(Y.POSITION,m),q=new F(E.typedBuffer,3,!1,S.stride/4),N=R.indexCount/3;if(!g&&N>A){const e=l.renderData;null==e.intersectionData&&(e.intersectionData=new w(P,0,N,q)),e.intersectionData.intersectRay({r0:he,r1:D},v)}else J(he,D,0,N,P,q,null,g,v)},O=this._rootTiles;if(null!=O){(()=>{const t=this._tileIterator;t.reset(O);const r=e.options.invisibleTerrain;for(let e=t.next();e;e=t.next())!(e.visible||r&&e.intersectsClippingArea)||null==g&&!e.intersectsRay(i,s,b,T)||_&&this._useStencilForTile(e)?t.skipSubtree():R(e)})()}}processScaleRangeQueries(e,t){if(!t.done)for(this._updatePatchGroups();e.updating&&!t.done;){e.prepare();for(const t of this._patchGroups.values())for(const i of t)null!=i.renderData?.textureReference&&e.queriesForTile(i);e.process(),t.madeProgress()}}prepareTechnique(e){if(e.bindParameters.slot===H.OCCLUDED_TERRAIN){if(0==(e.renderOccludedMask&R))return null}else{const t=this.transparency===ne.Opaque?H.OPAQUE_TERRAIN:H.TRANSPARENT_TERRAIN;if(e.bindParameters.slot!==t)return null}switch(e.output){case N.Color:return this.transparency===ne.Empty?null:(this._techniqueConfiguration.hasScreenSpaceReflections=null!=e.bindParameters.ssr.lastFrameColor,this._techniqueConfiguration.hasCloudsReflections=null!=e.bindParameters.cloudsFade.data,this._techniqueConfiguration.receiveShadows=e.bindParameters.shadowMap.ready,this._techniqueConfiguration.receiveAmbientOcclusion=e.bindParameters.ssaoHelper.active,this._techniqueConfiguration.overlayMode=this._overlayRenderer.isEmpty?j.Disabled:this._overlayRenderer.hasWater?j.EnabledWithWater:j.Enabled,this._updateTechnique(N.Color,e.bindParameters.slot===H.OCCLUDED_TERRAIN));case N.Shadow:case N.ShadowExcludeHighlight:return this._castShadows&&1===e.bindParameters.lighting.globalFactor?(this._techniqueConfiguration.receiveShadows=this._techniqueConfiguration.receiveAmbientOcclusion=!1,this._updateTechnique(N.Shadow,!1)):null;case N.Depth:return this.transparency===ne.Empty?null:(this._techniqueConfiguration.receiveShadows=this._techniqueConfiguration.receiveAmbientOcclusion=!1,this._updateTechnique(N.Depth,!1));case N.Normal:return this.transparency===ne.Empty?null:(this._techniqueConfiguration.receiveShadows=this._techniqueConfiguration.receiveAmbientOcclusion=!1,this._updateTechnique(N.Normal,!1));case N.ObjectAndLayerIdColor:return this.transparency===ne.Empty?null:this._updateTechnique(N.ObjectAndLayerIdColor,!1);case N.Highlight:return this.transparency!==ne.Empty&&this.needsHighlight?(this._techniqueConfiguration.receiveShadows=this._techniqueConfiguration.receiveAmbientOcclusion=!1,this._updateTechnique(N.Highlight,!1)):null}return null}render(e,t){switch(this._updatePatchGroups(),t.useStencil=!1,e.output){case N.Color:{const i=e.bindParameters.slot===H.OCCLUDED_TERRAIN?T.Occluded:T.ColorAndWater;this._renderMaterialPass(e,t,i);break}case N.Depth:case N.Normal:this._renderAuxiliaryPass(e,t,T.ColorAndWater);break;case N.Highlight:this._renderAuxiliaryPass(e,t,T.Highlight);break;case N.Shadow:case N.ShadowExcludeHighlight:this._renderAuxiliaryPass(e,t,T.None);break;case N.ObjectAndLayerIdColor:this._renderAuxiliaryPass(e,t,T.ObjectAndLayerIdColor)}}_renderMaterialPass(e,t,i){const{rctx:r}=e;this._passParameters.overlaySource=i,r.bindTechnique(t,this._passParameters,e.bindParameters),this._numTilesRendered=0,this._numTilesCulled=0,this._numOriginsRendered=0,this._renderPatchGroups(e,t,i)}_renderAuxiliaryPass(e,t,i){const r=e.rctx;this._passParameters.overlaySource=i,r.bindTechnique(t,this._passParameters,e.bindParameters),this._renderPatchGroupsAuxiliary(e,t,i)}updateTileBackground(e=null){if(null==this._tileRenderer)return;const i=this._tileRenderer;let r=null;if(null!=e){const i=t.toUnitRGBA(e);r=c(i[0]||0,i[1]||0,i[2]||0)}i.setBackground(r),this._allTiles.forAll((e=>i.updateTileTexture(e,b.FADING))),this._techniqueConfiguration.tileBlendInput=i.backgroundIsGrid?I.GridComposite:null!=i.backgroundColor?I.ColorComposite:I.LayerOnly,this.setNeedsRender()}_updatePatchGroups(){if(this._patchGroupsDirty&&(this._highestVisibleLODTile=null,this._rebuildPatchGroups(),this._patchGroupsDirty=!1,this._patchSortingDirty=!0),this._patchSortingDirty&&this.renderOrder!==C.NONE){const e=Array.from(this._patchGroups.values()),t=this._stencilEnabledLayerExtents;for(const i of e)E(this.renderOrder,i,t);e.sort(((e,t)=>q(e[0],t[0],this.renderOrder))),this._patchGroups=new Map(e.map((e=>[e[0].renderData.localOrigin,e]))),this._patchSortingDirty=!1}}_rebuildPatchGroups(){const e=this._rootTiles;if(null!=e){e[0]?.surface.checkAllTilesWaterproofness(),this._patchGroups.clear();for(const t of e)this._rebuildPatchGroupsForRootTile(t)}}_rebuildPatchGroupsForRootTile(e){const t=this._tileIterator;for(t.resetOne(e);!t.done;){const e=t.next(),i=e.renderData;if(!i){this._numTilesCulled++;continue}if(!e.visible){this._numTilesCulled++,t.skipSubtree();continue}const r=i.localOrigin;let s=this._patchGroups.get(r);s||(s=new Array,this._patchGroups.set(r,s)),s.push(e),(!this._highestVisibleLODTile||e.elevationLevel>this._highestVisibleLODTile.elevationLevel)&&(this._highestVisibleLODTile=e),t.skipSubtree()}}_useStencilForTile(e){for(const t of this._stencilEnabledLayerExtents)if(e.intersectsExtent(t))return!0;return!1}_renderPatchGroupsAuxiliary(e,t,i){const r=this._stencilEnabledLayerExtents.length>0;this._patchGroups.forEach((s=>{const n=s[0].renderData.localOrigin;t.program.bindDraw(new Z(n),e.bindParameters,this._passParameters);for(let o=0;o<s.length;o++)this._renderPatch(e,t,s[o],te.TRIANGLES,r,i)})),e.rctx.bindVAO(null)}_renderPatchGroups(e,t,i){const r=e.bindParameters.camera,s=t.program;if(this._techniqueConfiguration.screenSizePerspective&&this.pointsOfInterest){const e=W(this._stage.viewingMode,this._ellipsoidRadius),t=this.pointsOfInterest.centerOnSurfaceFrequent.distance;e.update({distance:t,fovY:r.fovY})}const n=this._stencilEnabledLayerExtents.length>0,o=i===T.Occluded;o&&(s.bindTexture("tex",this._emptyTex),s.setUniform3fv("textureOpacities",u),s.setUniform4fv("texOffsetAndScale",p));const a=null!=this._tileRenderer&&null!=this._tileRenderer.backgroundColor?this._tileRenderer.backgroundColor:u;this._techniqueConfiguration.tileBlendInput===I.ColorComposite&&s.setUniform3fv("backgroundColor",a);const l=this.wireframe?te.LINES:te.TRIANGLES;this._techniqueConfiguration.textureFadingEnabled&&s.bindTexture("texNext",this._emptyTex);const h=this._patchGroups;for(const u of h.values()){const r=u[0].renderData.localOrigin;t.program.bindDraw(new Z(r),e.bindParameters,this._passParameters),this._numOriginsRendered++;for(const a of u){const r=a.renderData,h=r.textureReference;if(null!=h){if(!o){s.setUniform4fv("texOffsetAndScale",h.offsetAndScale),s.bindTexture("tex",h.texture.texture);const e=r.textureFadeFactor,t=e<1?r.nextTextureReference:null;this._techniqueConfiguration.textureFadingEnabled&&null!=t&&e<1?(s.setUniform1f("fadeFactor",e),s.setUniform4fv("nextTexOffsetAndScale",t.offsetAndScale),s.setUniform3fv("nextTexOpacities",t.opacities),s.bindTexture("texNext",t.texture.texture)):s.setUniform1f("fadeFactor",1),r.textureIsFading&&this.setNeedsRender(),s.setUniform3fv("textureOpacities",h.opacities)}this._renderPatch(e,t,a,l,n,i),a.renderOrder=this._numTilesRendered,this._numTilesRendered++}}}e.rctx.bindVAO(null)}_renderPatch(e,t,i,r,s,n){const o=i.renderData,a=o.vao,l=a.indexBuffer;if(null==l)return void(v&&console.error("Rendered tile with no indices: ",i.lij," : ",o));const h=t.program;n===T.None||this._overlayRenderer.isEmpty||this._bindOverlayPatchData(h,o.overlay),s&&(t.useStencil=this._useStencilForTile(i),t.bindPipelineState(e.rctx,e.bindParameters.slot));const u=o.geometry.indexCount;e.rctx.bindVAO(a),h.assertCompatibleVertexAttributeLocations(a),e.rctx.drawElements(r,u,l.indexType,0)}_bindOverlayPatchData(e,t){e.setUniform4fv("overlayTexOffset",t.offsets),e.setUniform4fv("overlayTexScale",t.scales)}_updateTechnique(e,t){return this._techniqueConfiguration.output=e,this._techniqueConfiguration.renderOccluded=t,this._shaderTechnique=this._techniques.releaseAndAcquire($,this._techniqueConfiguration,this._shaderTechnique),this._shaderTechnique}get test(){return{tileRenderer:this._tileRenderer}}};e([s({constructOnly:!0})],oe.prototype,"_overlayRenderer",void 0),e([s({constructOnly:!0})],oe.prototype,"_stage",void 0),e([s({readOnly:!0})],oe.prototype,"_isGlobal",null),e([s({constructOnly:!0})],oe.prototype,"_allTiles",void 0),e([s({constructOnly:!0})],oe.prototype,"_cache",void 0),e([s({constructOnly:!0})],oe.prototype,"_ellipsoidRadius",void 0),e([s({value:!1})],oe.prototype,"renderingDisabled",null),e([s()],oe.prototype,"renderPatchBorders",null),e([s()],oe.prototype,"visualizeNormals",null),e([s()],oe.prototype,"cullBackFaces",null),e([s({value:C.FRONT_TO_BACK})],oe.prototype,"renderOrder",null),e([s()],oe.prototype,"wireframe",null),oe=e([n("esri.views.3d.terrain.TerrainRenderer")],oe);const ae=d(),le=d(),he=d(),ue=d();export{oe as TerrainRenderer,ne as TransparencyMode};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Color.js";import{disposeMaybe as i}from"../../../core/maybe.js";import r from"../../../core/ObjectPool.js";import{property as s}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import{subclass as n}from"../../../core/accessorSupport/decorators/subclass.js";import{I as o}from"../../../chunks/mat4f64.js";import{b as a,s as l,e as h}from"../../../chunks/vec3.js";import{Z as u,f as c,c as d}from"../../../chunks/vec3f64.js";import{Z as p}from"../../../chunks/vec4f64.js";import{create as _,set as f}from"../../../geometry/support/aaBoundingBox.js";import{BufferViewVec3f as m}from"../../../geometry/support/buffer/BufferView.js";import{ViewingMode as g}from"../../ViewingMode.js";import{TextureUpdate as b}from"./interfaces.js";import{LayerClass as y}from"./LayerClass.js";import{OverlaySource as T}from"./Overlay.js";import{overlayRenderOccludedFlag as R}from"./OverlayRenderer.js";import{clearCaches as x}from"./PatchGeometry.js";import{PatchRenderData as O}from"./PatchRenderData.js";import{RenderOrder as C}from"./RenderOrder.js";import{ENABLE_TERRAIN_INTERNAL_CHECKS as v}from"./terrainUtils.js";import{TileRenderer as D}from"./TileRenderer.js";import{TileUpdate as P}from"./TileUpdate.js";import{IteratorPreorder as S,sortTiles as q,compareTiles as E}from"./tileUtils.js";import{componentMinimalSizeForIntersectionData as A,ComponentIntersectionData as w}from"../webgl-engine/collections/Component/ComponentIntersectionData.js";import{ShaderOutput as N}from"../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{T as j}from"../../../chunks/Terrain.glsl.js";import{TileBlendInput as G}from"../webgl-engine/core/shaderLibrary/terrain/TileBlendInput.js";import{SyncPrepareRenderPlugin as I}from"../webgl-engine/effects/RenderPlugin.js";import{Attribute as L}from"../webgl-engine/lib/Attribute.js";import{RenderRequestType as F}from"../webgl-engine/lib/basicInterfaces.js";import{createEmptyTexture as U}from"../webgl-engine/lib/glUtil3D.js";import{newIntersectorResult as k}from"../webgl-engine/lib/Intersector.js";import{IntersectorType as B,StoreResults as M}from"../webgl-engine/lib/IntersectorInterfaces.js";import{RenderOccludedFlag as z}from"../webgl-engine/lib/Material.js";import{RenderSlot as V}from"../webgl-engine/lib/RenderSlot.js";import{getSettings as H}from"../webgl-engine/lib/screenSizePerspectiveUtils.js";import{VertexAttribute as W}from"../webgl-engine/lib/VertexAttribute.js";import{TERRAIN_ID as Y,getVerticalOffsetTerrain as Q}from"../webgl-engine/lib/verticalOffsetUtils.js";import{DrawParameters as X}from"../webgl-engine/materials/DrawParameters.js";import{intersectAabbInvDirBefore as Z,intersectTriangles as K}from"../webgl-engine/materials/internal/MaterialUtil.js";import{TerrainTechnique as J}from"../webgl-engine/shaders/TerrainTechnique.js";import{TerrainTechniqueConfiguration as $}from"../webgl-engine/shaders/TerrainTechniqueConfiguration.js";import{PrimitiveType as ee}from"../../webgl/enums.js";const te=7,ie=10,re=_();var se;!function(e){e[e.Opaque=0]="Opaque",e[e.Semitransparent=1]="Semitransparent",e[e.TransparentWithDraped=2]="TransparentWithDraped",e[e.Empty=3]="Empty"}(se||(se={}));let ne=class extends I{get _isGlobal(){return this._stage.viewingMode===g.Global}get _techniques(){return this._context.techniqueRepository}get _rctx(){return this._context.renderContext.rctx}constructor(e){super(e),this.type=B.TERRAIN,this.isGround=!0,this.renderSlots=[V.OPAQUE_TERRAIN,V.TRANSPARENT_TERRAIN,V.OCCLUDED_TERRAIN],this._tileSize=256,this._techniqueConfiguration=new $,this._passParameters=new j,this._renderDataPool=new r(O),this._patchGroups=new Map,this._patchGroupsDirty=!0,this._patchSortingDirty=!0,this._tileIterator=new S,this._highestVisibleLODTile=null,this._visible=!0,this._transparencyState=se.Opaque,this._castShadows=!0,this._emptyTex=null,this._tileRenderer=null,this._stencilEnabledLayerExtents=new Array,this._numTilesRendered=0,this._numTilesCulled=0,this._numOriginsRendered=0,this.needsHighlight=!1,this.renderOccludedFlags=z.Occlude}initialize(){this._stage.addRenderPlugin(this)}destroy(){this._stage.removeRenderPlugin(this),x()}canRender(){return this._visible&&!!this._rootTiles&&!this.renderingDisabled}requiresOutput(e){return e===N.Depth&&this._overlayRenderer.hasWater||e===N.Highlight&&this.needsHighlight}set renderingDisabled(e){this._set("renderingDisabled",!!e),this.setDirty()}set transparency(e){this._transparencyState!==e&&(this._techniqueConfiguration.invisible=e===se.TransparentWithDraped||e===se.Empty,this._transparencyState=e,this.setNeedsRender())}get transparency(){return this._transparencyState}get renderPatchBorders(){return!!this._techniqueConfiguration.tileBorders}set renderPatchBorders(e){this._techniqueConfiguration.tileBorders!==e&&(this._techniqueConfiguration.tileBorders=e,this.setNeedsRender(),this.notifyChange("renderPatchBorders"))}get visualizeNormals(){return!!this._techniqueConfiguration.visualizeNormals}set visualizeNormals(e){this._techniqueConfiguration.visualizeNormals!==e&&(this._techniqueConfiguration.visualizeNormals=e,this.setNeedsRender(),this.notifyChange("visualizeNormals"))}get cullBackFaces(){return this._techniqueConfiguration.backfaceCullingEnabled}set cullBackFaces(e){this._techniqueConfiguration.backfaceCullingEnabled!==e&&(this._techniqueConfiguration.backfaceCullingEnabled=e,this.notifyChange("cullBackFaces"),this.setNeedsRender())}set renderOrder(e){this._set("renderOrder",e),this._setSortingDirty()}get layerUid(){return Y}get slicePlaneEnabled(){return this._techniqueConfiguration.hasSlicePlane}set slicePlaneEnabled(e){this._techniqueConfiguration.hasSlicePlane!==e&&(this._techniqueConfiguration.hasSlicePlane=e,this.setNeedsRender())}set textureFadingEnabled(e){this._techniqueConfiguration.textureFadingEnabled!==e&&(this._techniqueConfiguration.textureFadingEnabled=e,this.setNeedsRender())}set pbrMode(e){this._techniqueConfiguration.pbrMode!==e&&(this._techniqueConfiguration.pbrMode=e,this.setNeedsRender())}setDebugScreenSizePerspective(e){this._techniqueConfiguration.screenSizePerspective!==e&&(this._techniqueConfiguration.screenSizePerspective=e,this.setNeedsRender())}setRootTiles(e){this._rootTiles=e,this.setDirty()}setNeedsHighlight(e){this.needsHighlight=e,this.setNeedsRender()}setRenderOccludedOverlay(e){this.renderOccludedFlags=e?R:z.Occlude,this.setNeedsRender()}setStencilEnabledLayerExtents(e){this._stencilEnabledLayerExtents=e,this._setSortingDirty()}setTileSize(e){this._tileSize=e,null!=this._tileRenderer&&(this._tileRenderer.tileSize=e),this.setDirty()}_prepareTileForLoading(e){e.renderData||(e.renderData=this._renderDataPool.acquire(),e.renderData.init(e),e.renderData.localOrigin=this._getLocalOriginOfTile(e))}loadTile(e){this._prepareTileForLoading(e),this.updateTileGeometryState(e),this.updateTileTexture(e,P.TEXTURE_FADING)}updateTileTexture(e,t){null!=this._tileRenderer&&(this._tileRenderer.updateTileTexture(e,t===P.TEXTURE_FADING?b.FADING:b.UNFADED),this.setNeedsRender(),e.resetPendingUpdate(t))}updateTileGeometryState(e){for(const i of e.layerInfo[y.ELEVATION])i.pendingUpdates&=~P.GEOMETRY;e.resetPendingUpdate(P.GEOMETRY);const t=e.renderData.updateGeometryState();return t&&this.setDirty(),t}updateGeometryIfNeeded(e){e.isLoaded&&e.renderData.updateGeometryIfNeeded(this._rctx)}unloadTile(e){const t=e.renderData;t&&(t.releaseGeometry(),this._renderDataPool.release(t),t.clear(),e.renderData=null,e.setMemoryDirty(),this.setDirty())}_getLocalOriginOfTile(e){const t=ie-te,i=Math.max(0,Math.floor((e.level-t)/te)*te);if(this._isGlobal&&0===i)return u;for(;e.parent&&e.level>i;)e=e.parent;return e.centerAtSeaLevel}setVisibility(e){this._visible=e,this.setDirty()}getStats(){return{numTilesRendered:this._numTilesRendered,numTilesCulled:this._numTilesCulled,numOriginsRendered:this._numOriginsRendered}}set wireframe(e){this._get("wireframe")!==e&&(this._set("wireframe",e),this.setNeedsRender())}setDirty(e=F.UPDATE){this._patchGroupsDirty=!0,this._context.requestRender(e)}_setSortingDirty(e=F.UPDATE){this._patchSortingDirty=!0,this._context.requestRender(e)}setNeedsRender(e=F.UPDATE){this._context.requestRender(e)}initializeRenderContext(e){this._context=e,this._tileRenderer=new D(this._rctx,this._tileSize,this._techniques,this._cache),this.updateTileBackground(),this._emptyTex=U(this._rctx)}uninitializeRenderContext(){this._emptyTex=i(this._emptyTex),this._tileRenderer=i(this._tileRenderer)}intersect(e,t,i,r){if(!this._rootTiles||e.options.selectOpaqueTerrainOnly&&e.options.selectionMode&&this.transparency!==se.Opaque)return;const s=oe,n=ae;a(s,r,i),l(n,1/s[0],1/s[1],1/s[2]);const u=e.results.min,c=e.results.max,d=e.results.ground,p=e.options.store===M.MIN,_=!!e.results.ground.target,g=Q(e.verticalOffset),b=e.tolerance;let y,T=p&&null!=u.dist?u.dist:1/0;const R=l=>{const _=l.renderData;if(!_?.vao)return;const R=_.geometry;f(re,R.boundingBox);const x=_.localOrigin;null!=g&&(g.localOrigin=x,g.applyToAabb(re));const O=re;if(le[0]=i[0]-x[0],le[1]=i[1]-x[1],le[2]=i[2]-x[2],!Z(O,le,n,b,T))return;const C=(e,t,i)=>{e.set(this.type,l,t,i,o),T=p&&null!=u.dist?u.dist:1/0},v=(n,o)=>{if(null!=o&&n>=0&&(e.options.backfacesTerrain||h(o,s)<0)&&(e.options.invisibleTerrain||!e.options.selectionMode||null==t||t(i,r,n))){if((null==d.dist||n<d.dist)&&C(d,n,o),e.options.isFiltered)return;e.options.store===M.ALL&&(null==y?(y=k(e.ray),C(y,n,o),e.results.all.push(y)):n<y.dist&&C(y,n,o)),(null==u.dist||n<u.dist)&&C(u,n,o),e.options.store!==M.MIN&&(null==c.dist||n>c.dist)&&C(c,n,o)}},D=he;a(D,r,x);const P=R.indices,S=R.vertexAttributes,q=S.getField(W.POSITION,m),E=new L(q.typedBuffer,3,!1,S.stride/4),N=R.indexCount/3;if(!g&&N>A){const e=l.renderData;null==e.intersectionData&&(e.intersectionData=new w(P,0,N,E)),e.intersectionData.intersectRay({r0:le,r1:D},v)}else K(le,D,0,N,P,E,null,g,v)},x=this._rootTiles;if(null!=x){(()=>{const t=this._tileIterator;t.reset(x);const r=e.options.invisibleTerrain;for(let e=t.next();e;e=t.next())!(e.visible||r&&e.intersectsClippingArea)||null==g&&!e.intersectsRay(i,s,b,T)||_&&this._useStencilForTile(e)?t.skipSubtree():R(e)})()}}processScaleRangeQueries(e,t){if(!t.done)for(this._updatePatchGroups();e.updating&&!t.done;){e.prepare();for(const t of this._patchGroups.values())for(const i of t)null!=i.renderData?.textureReference&&e.queriesForTile(i);e.process(),t.madeProgress()}}prepareTechnique(e){if(e.bindParameters.slot===V.OCCLUDED_TERRAIN){if(0==(e.renderOccludedMask&R))return null}else{const t=this.transparency===se.Opaque?V.OPAQUE_TERRAIN:V.TRANSPARENT_TERRAIN;if(e.bindParameters.slot!==t)return null}switch(e.output){case N.Color:return this.transparency===se.Empty?null:(this._techniqueConfiguration.hasScreenSpaceReflections=null!=e.bindParameters.ssr.lastFrameColor,this._techniqueConfiguration.hasCloudsReflections=null!=e.bindParameters.cloudsFade.data,this._techniqueConfiguration.receiveShadows=e.bindParameters.shadowMap.ready,this._techniqueConfiguration.receiveAmbientOcclusion=e.bindParameters.ssaoHelper.active,this._techniqueConfiguration.overlayMode=this._overlayRenderer.mode,this._updateTechnique(N.Color,e.bindParameters.slot===V.OCCLUDED_TERRAIN));case N.Shadow:case N.ShadowExcludeHighlight:return this._castShadows&&1===e.bindParameters.lighting.globalFactor?(this._techniqueConfiguration.receiveShadows=this._techniqueConfiguration.receiveAmbientOcclusion=!1,this._updateTechnique(N.Shadow,!1)):null;case N.Depth:return this.transparency===se.Empty?null:(this._techniqueConfiguration.receiveShadows=this._techniqueConfiguration.receiveAmbientOcclusion=!1,this._updateTechnique(N.Depth,!1));case N.Normal:return this.transparency===se.Empty?null:(this._techniqueConfiguration.receiveShadows=this._techniqueConfiguration.receiveAmbientOcclusion=!1,this._updateTechnique(N.Normal,!1));case N.ObjectAndLayerIdColor:return this.transparency===se.Empty?null:this._updateTechnique(N.ObjectAndLayerIdColor,!1);case N.Highlight:return this.transparency!==se.Empty&&this.needsHighlight?(this._techniqueConfiguration.receiveShadows=this._techniqueConfiguration.receiveAmbientOcclusion=!1,this._updateTechnique(N.Highlight,!1)):null}return null}render(e,t){switch(this._updatePatchGroups(),t.useStencil=!1,e.output){case N.Color:{const i=e.bindParameters.slot===V.OCCLUDED_TERRAIN?T.Occluded:T.ColorAndWater;this._renderMaterialPass(e,t,i);break}case N.Depth:case N.Normal:this._renderAuxiliaryPass(e,t,T.ColorAndWater);break;case N.Highlight:this._renderAuxiliaryPass(e,t,T.Highlight);break;case N.Shadow:case N.ShadowExcludeHighlight:this._renderAuxiliaryPass(e,t,T.None);break;case N.ObjectAndLayerIdColor:this._renderAuxiliaryPass(e,t,T.ObjectAndLayerIdColor)}}_renderMaterialPass(e,t,i){const{rctx:r}=e;this._passParameters.overlaySource=i,r.bindTechnique(t,this._passParameters,e.bindParameters),this._numTilesRendered=0,this._numTilesCulled=0,this._numOriginsRendered=0,this._renderPatchGroups(e,t,i)}_renderAuxiliaryPass(e,t,i){const r=e.rctx;this._passParameters.overlaySource=i,r.bindTechnique(t,this._passParameters,e.bindParameters),this._renderPatchGroupsAuxiliary(e,t,i)}updateTileBackground(e=null){if(null==this._tileRenderer)return;const i=this._tileRenderer;let r=null;if(null!=e){const i=t.toUnitRGBA(e);r=c(i[0]||0,i[1]||0,i[2]||0)}i.setBackground(r),this._allTiles.forAll((e=>i.updateTileTexture(e,b.FADING))),this._techniqueConfiguration.tileBlendInput=i.backgroundIsGrid?G.GridComposite:null!=i.backgroundColor?G.ColorComposite:G.LayerOnly,this.setNeedsRender()}_updatePatchGroups(){if(this._patchGroupsDirty&&(this._highestVisibleLODTile=null,this._rebuildPatchGroups(),this._patchGroupsDirty=!1,this._patchSortingDirty=!0),this._patchSortingDirty&&this.renderOrder!==C.NONE){const e=Array.from(this._patchGroups.values()),t=this._stencilEnabledLayerExtents;for(const i of e)q(this.renderOrder,i,t);e.sort(((e,t)=>E(e[0],t[0],this.renderOrder))),this._patchGroups=new Map(e.map((e=>[e[0].renderData.localOrigin,e]))),this._patchSortingDirty=!1}}_rebuildPatchGroups(){const e=this._rootTiles;if(null!=e){e[0]?.surface.checkAllTilesWaterproofness(),this._patchGroups.clear();for(const t of e)this._rebuildPatchGroupsForRootTile(t)}}_rebuildPatchGroupsForRootTile(e){const t=this._tileIterator;for(t.resetOne(e);!t.done;){const e=t.next(),i=e.renderData;if(!i){this._numTilesCulled++;continue}if(!e.visible){this._numTilesCulled++,t.skipSubtree();continue}const r=i.localOrigin;let s=this._patchGroups.get(r);s||(s=new Array,this._patchGroups.set(r,s)),s.push(e),(!this._highestVisibleLODTile||e.elevationLevel>this._highestVisibleLODTile.elevationLevel)&&(this._highestVisibleLODTile=e),t.skipSubtree()}}_useStencilForTile(e){for(const t of this._stencilEnabledLayerExtents)if(e.intersectsExtent(t))return!0;return!1}_renderPatchGroupsAuxiliary(e,t,i){const r=this._stencilEnabledLayerExtents.length>0;this._patchGroups.forEach((s=>{const n=s[0].renderData.localOrigin;t.program.bindDraw(new X(n),e.bindParameters,this._passParameters);for(let o=0;o<s.length;o++)this._renderPatch(e,t,s[o],ee.TRIANGLES,r,i)})),e.rctx.bindVAO(null)}_renderPatchGroups(e,t,i){const r=e.bindParameters.camera,s=t.program;if(this._techniqueConfiguration.screenSizePerspective&&this.pointsOfInterest){const e=H(this._stage.viewingMode,this._ellipsoidRadius),t=this.pointsOfInterest.centerOnSurfaceFrequent.distance;e.update({distance:t,fovY:r.fovY})}const n=this._stencilEnabledLayerExtents.length>0,o=i===T.Occluded;o&&(s.bindTexture("tex",this._emptyTex),s.setUniform3fv("textureOpacities",u),s.setUniform4fv("texOffsetAndScale",p));const a=null!=this._tileRenderer&&null!=this._tileRenderer.backgroundColor?this._tileRenderer.backgroundColor:u;this._techniqueConfiguration.tileBlendInput===G.ColorComposite&&s.setUniform3fv("backgroundColor",a);const l=this.wireframe?ee.LINES:ee.TRIANGLES;this._techniqueConfiguration.textureFadingEnabled&&s.bindTexture("texNext",this._emptyTex);const h=this._patchGroups;for(const u of h.values()){const r=u[0].renderData.localOrigin;t.program.bindDraw(new X(r),e.bindParameters,this._passParameters),this._numOriginsRendered++;for(const a of u){const r=a.renderData,h=r.textureReference;if(null!=h){if(!o){s.setUniform4fv("texOffsetAndScale",h.offsetAndScale),s.bindTexture("tex",h.texture.texture);const e=r.textureFadeFactor,t=e<1?r.nextTextureReference:null;this._techniqueConfiguration.textureFadingEnabled&&null!=t&&e<1?(s.setUniform1f("fadeFactor",e),s.setUniform4fv("nextTexOffsetAndScale",t.offsetAndScale),s.setUniform3fv("nextTexOpacities",t.opacities),s.bindTexture("texNext",t.texture.texture)):s.setUniform1f("fadeFactor",1),r.textureIsFading&&this.setNeedsRender(),s.setUniform3fv("textureOpacities",h.opacities)}this._renderPatch(e,t,a,l,n,i),a.renderOrder=this._numTilesRendered,this._numTilesRendered++}}}e.rctx.bindVAO(null)}_renderPatch(e,t,i,r,s,n){const o=i.renderData,a=o.vao,l=a.indexBuffer;if(null==l)return void(v&&console.error("Rendered tile with no indices: ",i.lij," : ",o));const h=t.program;n===T.None||this._overlayRenderer.isEmpty||this._bindOverlayPatchData(h,o.overlay),s&&(t.useStencil=this._useStencilForTile(i),t.bindPipelineState(e.rctx,e.bindParameters.slot));const u=o.geometry.indexCount;e.rctx.bindVAO(a),h.assertCompatibleVertexAttributeLocations(a),e.rctx.drawElements(r,u,l.indexType,0)}_bindOverlayPatchData(e,t){e.setUniform4fv("overlayTexOffset",t.offsets),e.setUniform4fv("overlayTexScale",t.scales)}_updateTechnique(e,t){return this._techniqueConfiguration.output=e,this._techniqueConfiguration.renderOccluded=t,this._shaderTechnique=this._techniques.releaseAndAcquire(J,this._techniqueConfiguration,this._shaderTechnique),this._shaderTechnique}get test(){return{tileRenderer:this._tileRenderer}}};e([s({constructOnly:!0})],ne.prototype,"_overlayRenderer",void 0),e([s({constructOnly:!0})],ne.prototype,"_stage",void 0),e([s({readOnly:!0})],ne.prototype,"_isGlobal",null),e([s({constructOnly:!0})],ne.prototype,"_allTiles",void 0),e([s({constructOnly:!0})],ne.prototype,"_cache",void 0),e([s({constructOnly:!0})],ne.prototype,"_ellipsoidRadius",void 0),e([s({value:!1})],ne.prototype,"renderingDisabled",null),e([s()],ne.prototype,"renderPatchBorders",null),e([s()],ne.prototype,"visualizeNormals",null),e([s()],ne.prototype,"cullBackFaces",null),e([s({value:C.FRONT_TO_BACK})],ne.prototype,"renderOrder",null),e([s()],ne.prototype,"wireframe",null),ne=e([n("esri.views.3d.terrain.TerrainRenderer")],ne);const oe=d(),ae=d(),le=d(),he=d();export{ne as TerrainRenderer,se as TransparencyMode};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../core/Logger.js";import{disposeMaybe as t,releaseMaybe as r}from"../../../core/maybe.js";import{Z as i}from"../../../chunks/vec2f64.js";import{RasterColorizerStretchType as s}from"../../2d/engine/imagery/enums.js";import{VectorTileRendererHelper3D as o}from"../../2d/engine/vectorTiles/VectorTileRendererHelper3D.js";import{BlendLayersTechniqueConfiguration as n,BlendLayersTechnique as a}from"./BlendLayersTechnique.js";import{LayerClass as l}from"./LayerClass.js";import{RasterColorizerTechniqueConfiguration as h,RasterColorizerTechnique as u}from"./RasterColorizerTechnique.js";import{MultiSizeFramebuffer as c}from"./support/MultiSizeFramebuffer.js";import{LayerBlendMode as d}from"../webgl-engine/core/shaderLibrary/output/BlendOptions.js";import{PremultipliedAlphaSource as _,BlendLayersOutput as f,BaseOpacityMode as p}from"../webgl-engine/core/shaderLibrary/terrain/TileBackground.glsl.js";import{a as b}from"../../../chunks/BlendLayers.glsl.js";import{BindParameters as g}from"../webgl-engine/lib/BindParameters.js";import{Pos2Tex as m}from"../webgl-engine/lib/DefaultVertexBufferLayouts.js";import{createQuadVAO as T}from"../webgl-engine/lib/glUtil3D.js";import{PrimitiveType as y,ClearBufferBit as x,TextureType as C}from"../../webgl/enums.js";import{Texture as B}from"../../webgl/Texture.js";import{vertexCount as q}from"../../webgl/Util.js";const O=e.getLogger("esri.views.3d.terrain");class L{constructor(e,t){this._rctx=e,this._techniqueRepository=t,this._fbos=[],this._vectorTileHelper=new o,this._bindParameters=new g(null,null,null),this._blendLayersTechniqueConfig=new n,this._current=0,this._lastUsedIds=new Array,this._lastCreatedBufferId=0,this._onHoldIds=new Array,this._vaoQuad=T(this._rctx,m)}dispose(){this._fbos.forEach(t),this._fbos=null,this._vtFBO=t(this._vtFBO),this._vaoQuad=t(this._vaoQuad),this._vectorTileHelper=t(this._vectorTileHelper),this._backgroundTechnique=r(this._backgroundTechnique),this._applyOpacityTechnique=r(this._applyOpacityTechnique),this._blendLayersTechnique=r(this._blendLayersTechnique)}_getBlendLayersTechnique(e,t,r,i=_.Off,s=b.BelowLayer){return this._blendLayersTechniqueConfig.output=t,this._blendLayersTechniqueConfig.blendMode=e,this._blendLayersTechniqueConfig.baseOpacityMode=r,this._blendLayersTechniqueConfig.premultipliedSource=i,this._blendLayersTechniqueConfig.background=s,this._blendLayersTechnique=this._techniqueRepository.releaseAndAcquire(a,this._blendLayersTechniqueConfig,this._blendLayersTechnique),this._blendLayersTechnique}drawBackground(e,t){const r=this._getBlendLayersTechnique(d.Normal,t?f.ColorComposite:f.GridComposite,p.NotRequired,_.Off,b.Only),i=this._rctx.bindTechnique(r,e,this._bindParameters);this._render(i)}_render(e){this._rctx.bindVAO(this._vaoQuad),e.assertCompatibleVertexAttributeLocations(this._vaoQuad),this._rctx.drawArrays(y.TRIANGLE_STRIP,0,q(this._vaoQuad,"geometry"))}drawGroup(e,t,r,i,s,o=_.On){t===f.Composite&&(e.fboTexture=this._fbos[this.getLastOnHoldId()].get(r).colorTexture),e.texture=this.currentFBO(r).colorTexture,this.closeGroup(r);const n=this._getBlendLayersTechnique(i,t,s,o),a=this._rctx.bindTechnique(n,e,this._bindParameters);this._render(a)}drawRasterData(e,t,r,i,s,o=_.Off){if(null==e.texture)return;e.fboTexture=t===f.GroupBackgroundComposite||i===d.Normal&&s===p.NotRequired&&o===_.Off?null:this.switch(r).colorTexture;const n=this._getBlendLayersTechnique(i,t,s,o),a=this._rctx.bindTechnique(n,e,this._bindParameters);this._render(a)}drawImageryTileData(e,t,r,i,s,o){const n=o.sourceLayerInfo.data;if(!n.source)return;if(o.tile.surface.layerViewByIndex(o.layerIndex,l.MAP).ensureSymbolizerParameters(n),!n.bind(this._rctx))return;e.fboTexture=i===d.Normal&&s===p.NotRequired?null:this.switch(r).colorTexture;const a=this._getRasterColorizerTechnique(n,t,i,s);n.opacity=e.opacity;const h=n.getUniforms();h.scale=o.scale,h.offset=o.offset,h.backgroundColor=e.backgroundColor,h.fboTexture=e.fboTexture,h.baseOpacity=e.baseOpacity;const u=this._rctx.bindTechnique(a,h,null);this._render(u)}_getRasterColorizerTechnique(e,t,r,i){const o=e.symbolizerParameters,n=["stretch","lut","hillshade"].indexOf(o.type);return null==this._rasterColorizerConfig&&(this._rasterColorizerConfig=new h,this._rctx.gl.getExtension("WEBGL_color_buffer_float"),this._rctx.gl.getExtension("OES_texture_float")),this._rasterColorizerConfig.output=t,this._rasterColorizerConfig.blendMode=r,this._rasterColorizerConfig.baseOpacityMode=i,this._rasterColorizerConfig.colorizerType=n,this._rasterColorizerConfig.applyColormap=!!o.colormap,this._rasterColorizerConfig.requireBilinearWithNN=e.isBilinearWithStretchColorRamp,this._rasterColorizerConfig.stretchType=e.hasStretchTypeNone()?s.Noop:s.PerBand,this._rasterColorizerTechnique=this._techniqueRepository.releaseAndAcquire(u,this._rasterColorizerConfig,this._rasterColorizerTechnique),this._rasterColorizerTechnique}drawVectorData(e,t,r,s,o,n,a,h,u){const b=this._rctx,g=n.sourceLayerInfo.data,m=n.tile.surface.layerViewByIndex(n.layerIndex,l.MAP),T=o===p.Required||e.opacity<1||s!==d.Normal||t!==f.Composite,y=T?_.On:_.Off;this._getBlendLayersTechnique(s,t,o,y).bindPipelineState(b);let C=null,B=null;T?(B=this.currentFBO(r),null==this._vtFBO&&(this._vtFBO=new c(this._rctx)),C=this._vtFBO.get(r),b.bindFramebuffer(C),this._clearCurrentFBO()):u&&b.clearSafe(x.DEPTH_BUFFER_BIT);try{this._vectorTileHelper.render(b,n.sourceLod,g,m.painter,m.layer.styleRepository,m.schemaHelper,Math.round(1/n.scale),n.offset,h,a,m.contentZoom),n.vtlNeighborInfos.forAll((e=>this._vectorTileHelper.renderSymbols(b,e.sourceLod,e.sourceLayerInfo.data,m.painter,m.layer.styleRepository,m.schemaHelper,1,e.offset,h,a,m.contentZoom)))}catch(q){O.warnOnce("A render call containing vector tiles did not resolve correctly.",q)}return null==C||(b.bindFramebuffer(B),e.texture=C.colorTexture,e.offset=i,e.scale=1,this.drawRasterData(e,t,r,s,o,y),u)}copyFBOToTexture(e){const t=this._rctx,r=t.bindTexture(e.texture,B.TEXTURE_UNIT_FOR_UPDATES),i=e.descriptor;t.gl.copyTexImage2D(C.TEXTURE_2D,0,i.pixelFormat,0,0,i.width,i.height,0),e.generateMipmap(),t.bindTexture(r,B.TEXTURE_UNIT_FOR_UPDATES)}_clearCurrentFBO(){this._rctx.setClearColor(0,0,0,0),this._rctx.setClearDepth(1),this._rctx.clearSafe(x.COLOR_BUFFER_BIT|x.DEPTH_BUFFER_BIT)}_initFBO(e,t,r){this._rctx.bindFramebuffer(e),r&&(this._rctx.setViewport(0,0,t,t),this._clearCurrentFBO())}ensureBuffer(e){this._lastUsedIds.length=0,this._lastUsedIds.push(1),this._lastCreatedBufferId=1,this._onHoldIds.length=0,this.bind(e)}bind(e,t=0,r=!0){if(this._current=t,t>=this._fbos.length)for(let i=this._fbos.length;i<=t;i++)this._fbos.push(new c(this._rctx));this._initFBO(this._fbos[t].get(e),e,r)}_bindNextFreeBuffer(e){this._lastUsedIds.length>0?this.bind(e,this._lastUsedIds.pop()):(this._lastCreatedBufferId++,this.bind(e,this._lastCreatedBufferId))}openGroup(e){this._onHoldIds.push(this._current),this._bindNextFreeBuffer(e)}switch(e){const t=this.currentFBO(e),r=this._current;return this._bindNextFreeBuffer(e),this._lastUsedIds.push(r),t}getLastOnHoldId(){return this._onHoldIds.at(-1)}closeGroup(e){const t=this._current;this._bindNextFreeBuffer(e),this._lastUsedIds.push(t),this._lastUsedIds.push(this._onHoldIds.pop())}unbind(){this._rctx.bindFramebuffer(null)}currentFBO(e){return this._fbos[this._current].get(e)}}export{L as TileCompositor};
5
+ import e from"../../../core/Logger.js";import{disposeMaybe as t,releaseMaybe as r}from"../../../core/maybe.js";import{Z as i}from"../../../chunks/vec2f64.js";import{RasterColorizerStretchType as s}from"../../2d/engine/imagery/enums.js";import{VectorTileRendererHelper3D as o}from"../../2d/engine/vectorTiles/VectorTileRendererHelper3D.js";import{BlendLayersTechniqueConfiguration as n,BlendLayersTechnique as a}from"./BlendLayersTechnique.js";import{LayerClass as l}from"./LayerClass.js";import{RasterColorizerTechniqueConfiguration as h,RasterColorizerTechnique as u}from"./RasterColorizerTechnique.js";import{MultiSizeFramebuffer as c}from"./support/MultiSizeFramebuffer.js";import{LayerBlendMode as d}from"../webgl-engine/core/shaderLibrary/output/BlendOptions.js";import{PremultipliedAlphaSource as _,BlendLayersOutput as f,BaseOpacityMode as p}from"../webgl-engine/core/shaderLibrary/terrain/TileBackground.glsl.js";import{a as b}from"../../../chunks/BlendLayers.glsl.js";import{BindParameters as g}from"../webgl-engine/lib/BindParameters.js";import{Pos2Tex as m}from"../webgl-engine/lib/DefaultVertexBufferLayouts.js";import{createQuadVAO as T}from"../webgl-engine/lib/glUtil3D.js";import{PrimitiveType as y,ClearBufferBit as x,TextureType as C}from"../../webgl/enums.js";import{Texture as B}from"../../webgl/Texture.js";import{vertexCount as q}from"../../webgl/Util.js";const O=e.getLogger("esri.views.3d.terrain");class I{constructor(e,t){this._rctx=e,this._techniqueRepository=t,this._fbos=[],this._vectorTileHelper=new o,this._bindParameters=new g(null,null,null),this._blendLayersTechniqueConfig=new n,this._current=0,this._lastUsedIds=new Array,this._lastCreatedBufferId=0,this._onHoldIds=new Array,this._vaoQuad=T(this._rctx,m)}dispose(){this._fbos.forEach(t),this._fbos=null,this._vtFBO=t(this._vtFBO),this._vaoQuad=t(this._vaoQuad),this._vectorTileHelper=t(this._vectorTileHelper),this._backgroundTechnique=r(this._backgroundTechnique),this._applyOpacityTechnique=r(this._applyOpacityTechnique),this._blendLayersTechnique=r(this._blendLayersTechnique)}_getBlendLayersTechnique(e,t,r,i=_.Off,s=b.BelowLayer){return this._blendLayersTechniqueConfig.output=t,this._blendLayersTechniqueConfig.blendMode=e,this._blendLayersTechniqueConfig.baseOpacityMode=r,this._blendLayersTechniqueConfig.premultipliedSource=i,this._blendLayersTechniqueConfig.background=s,this._blendLayersTechnique=this._techniqueRepository.releaseAndAcquire(a,this._blendLayersTechniqueConfig,this._blendLayersTechnique),this._blendLayersTechnique}drawBackground(e,t){const r=this._getBlendLayersTechnique(d.Normal,t?f.ColorComposite:f.GridComposite,p.NotRequired,_.Off,b.Only),i=this._rctx.bindTechnique(r,e,this._bindParameters);this._render(i)}_render(e){this._rctx.bindVAO(this._vaoQuad),e.assertCompatibleVertexAttributeLocations(this._vaoQuad),this._rctx.drawArrays(y.TRIANGLE_STRIP,0,q(this._vaoQuad,"geometry"))}drawGroup(e,t,r,i,s,o=_.On){t===f.Composite&&(e.fboTexture=this._fbos[this.getLastOnHoldId()].get(r).colorTexture),e.texture=this.currentFBO(r).colorTexture,this.closeGroup(r);const n=this._getBlendLayersTechnique(i,t,s,o),a=this._rctx.bindTechnique(n,e,this._bindParameters);this._render(a)}drawRasterData(e,t,r,i,s,o=_.Off){if(null==e.texture)return;e.fboTexture=t===f.GroupBackgroundComposite||i===d.Normal&&s===p.NotRequired&&o===_.Off?null:this.switch(r).colorTexture;const n=this._getBlendLayersTechnique(i,t,s,o),a=this._rctx.bindTechnique(n,e,this._bindParameters);this._render(a)}drawImageryTileData(e,t,r,i,s,o){const n=o.sourceLayerInfo.data;if(!n.source)return;if(o.tile.surface.layerViewByIndex(o.layerIndex,l.MAP).ensureSymbolizerParameters(n),!n.bind(this._rctx))return;e.fboTexture=i===d.Normal&&s===p.NotRequired?null:this.switch(r).colorTexture;const a=this._getRasterColorizerTechnique(n,t,i,s);n.opacity=e.opacity;const h=n.getUniforms();h.scale=o.scale,h.offset=o.offset,h.backgroundColor=e.backgroundColor,h.fboTexture=e.fboTexture,h.baseOpacity=e.baseOpacity;const u=this._rctx.bindTechnique(a,h,null);this._render(u)}_getRasterColorizerTechnique(e,t,r,i){const o=e.symbolizerParameters,n=["stretch","lut","hillshade"].indexOf(o.type);return null==this._rasterColorizerConfig&&(this._rasterColorizerConfig=new h,this._rctx.gl.getExtension("WEBGL_color_buffer_float"),this._rctx.gl.getExtension("OES_texture_float")),this._rasterColorizerConfig.output=t,this._rasterColorizerConfig.blendMode=r,this._rasterColorizerConfig.baseOpacityMode=i,this._rasterColorizerConfig.colorizerType=n,this._rasterColorizerConfig.applyColormap=!!o.colormap,this._rasterColorizerConfig.requireBilinearWithNN=e.isBilinearWithStretchColorRamp,this._rasterColorizerConfig.stretchType=e.hasStretchTypeNone()?s.Noop:s.PerBand,this._rasterColorizerTechnique=this._techniqueRepository.releaseAndAcquire(u,this._rasterColorizerConfig,this._rasterColorizerTechnique),this._rasterColorizerTechnique}drawVectorData(e,t,r,s,o,n,a,h,u){const b=this._rctx,g=n.sourceLayerInfo.data,m=n.tile.surface.layerViewByIndex(n.layerIndex,l.MAP),T=o===p.Required||e.opacity<1||s!==d.Normal||t!==f.Composite,y=T?_.On:_.Off;this._getBlendLayersTechnique(s,t,o,y).bindPipelineState(b);let C=null,B=null;T?(B=this.currentFBO(r),null==this._vtFBO&&(this._vtFBO=new c(this._rctx)),C=this._vtFBO.get(r),b.bindFramebuffer(C),this._clearCurrentFBO()):u&&b.clearSafe(x.DEPTH_BUFFER_BIT);try{this._vectorTileHelper.render(b,n.sourceLod,g,m.painter,m.layer.styleRepository,m.schemaHelper,Math.round(1/n.scale),n.offset,h,a,m.contentZoom),n.vtlNeighborInfos.forAll((e=>this._vectorTileHelper.renderSymbols(b,e.sourceLod,e.sourceLayerInfo.data,m.painter,m.layer.styleRepository,m.schemaHelper,1,e.offset,h,a,m.contentZoom)))}catch(q){O.warnOnce("A render call containing vector tiles did not resolve correctly.",q)}return null==C||(b.bindFramebuffer(B),e.texture=C.colorTexture,e.offset=i,e.scale=1,this.drawRasterData(e,t,r,s,o,y),u)}copyFBOToTexture(e){const t=this._rctx,r=t.bindTexture(e.texture,B.TEXTURE_UNIT_FOR_UPDATES),i=e.descriptor;t.gl.copyTexImage2D(C.TEXTURE_2D,0,i.pixelFormat,0,0,i.width,i.height,0),e.generateMipmap(),t.bindTexture(r,B.TEXTURE_UNIT_FOR_UPDATES)}_clearCurrentFBO(){this._rctx.setClearColor(0,0,0,0),this._rctx.setClearDepth(1),this._rctx.clearSafe(x.COLOR_BUFFER_BIT|x.DEPTH_BUFFER_BIT)}_initFBO(e,t,r){this._rctx.bindFramebuffer(e),r&&(this._rctx.setViewport(0,0,t,t),this._clearCurrentFBO())}ensureBuffer(e){this._lastUsedIds.length=0,this._lastUsedIds.push(1),this._lastCreatedBufferId=1,this._onHoldIds.length=0,this.bind(e)}bind(e,t=0,r=!0){if(this._current=t,t>=this._fbos.length)for(let i=this._fbos.length;i<=t;i++)this._fbos.push(new c(this._rctx));this._initFBO(this._fbos[t].get(e),e,r)}_bindNextFreeBuffer(e){this._lastUsedIds.length>0?this.bind(e,this._lastUsedIds.pop()):(this._lastCreatedBufferId++,this.bind(e,this._lastCreatedBufferId))}openGroup(e){this._onHoldIds.push(this._current),this._bindNextFreeBuffer(e)}switch(e){const t=this.currentFBO(e),r=this._current;return this._bindNextFreeBuffer(e),this._lastUsedIds.push(r),t}getLastOnHoldId(){return this._onHoldIds[this._onHoldIds.length-1]}closeGroup(e){const t=this._current;this._bindNextFreeBuffer(e),this._lastUsedIds.push(t),this._lastUsedIds.push(this._onHoldIds.pop())}unbind(){this._rctx.bindFramebuffer(null)}currentFBO(e){return this._fbos[this._current].get(e)}}export{I as TileCompositor};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{disposeMaybe as e,releaseMaybe as t}from"../../../core/maybe.js";import{s as r,j as s}from"../../../chunks/vec2.js";import{Z as o}from"../../../chunks/vec2f64.js";import{isBaseLayer as a,isGroupLayer as i}from"../../../layers/support/layerUtils.js";import{ImageWithType as n}from"../support/StreamDataLoader.js";import{BlendLayersPassParameters as c}from"./BlendLayersTechnique.js";import{TextureUpdate as u}from"./interfaces.js";import{NeighborIndex as l}from"./ITile.js";import{LayerClass as p}from"./LayerClass.js";import{isBlendableLayerView as h,isVectorTileLayerView as d,isVectorTileRenderInfo as m,isImageryTileRenderInfo as _,isRasterTileRenderInfo as f,isTextureTileRenderInfo as T,isVectorTilePerLayerInfo as y}from"./terrainUtils.js";import{ActivationTime as g}from"./TextureFader.js";import{TextureReference as b}from"./TextureReference.js";import{TileCompositor as x}from"./TileCompositor.js";import{TileRenderInfo as w}from"./TileRenderInfo.js";import I from"./TileTexture.js";import{TileUpdate as k}from"./TileUpdate.js";import{blendModeFromString as A}from"../webgl-engine/core/shaderLibrary/output/BlendOptions.js";import{BaseOpacityMode as P,BlendLayersOutput as E}from"../webgl-engine/core/shaderLibrary/terrain/TileBackground.glsl.js";import{createEmptyTexture as R}from"../webgl-engine/lib/glUtil3D.js";import{TextureSamplingMode as M,TextureWrapMode as D,PixelFormat as O}from"../../webgl/enums.js";import{Texture as j}from"../../webgl/Texture.js";import{TextureDescriptor as L}from"../../webgl/TextureDescriptor.js";class N{constructor(e,t,r,s){this.start=e,this.end=t,this.blendMode=r,this.opacity=s}}class C{constructor(e,t,r,s){this._rctx=e,this.tileSize=t,this._techniques=r,this._cache=s,this._passParameters=new c,this._backgroundTexture=null,this._backgroundColor=null,this._backgroundDirty=!1,this._maxAnisotropy=this._rctx.parameters.maxMaxAnisotropy,this._composition=new x(this._rctx,this._techniques),this._ensureBackgroundTexture(this.tileSize)}dispose(){this._composition=e(this._composition),this._backgroundTexture=t(this._backgroundTexture)}get backgroundIsGrid(){return null==this._backgroundColor}get backgroundColor(){return this._backgroundColor}updateTileTexture(e,t){if(!e.renderData)return;const r=e.surface,s=r.baseOpacity;let o=0,n=0,c=this.tileSize,u=!1;const l=r.view.state.contentPixelRatio;let m=!1;z.clear(),H.length=0;const _=e.layerInfo[p.MAP];let f=_.length,T=0,y=null;for(;T<_.length;T++){const t=r.layerViewByIndex(T,p.MAP),g=t.layer.opacity;F[T]=g;const b=t.fullOpacity;if(q[T]=b,a(t.layer)&&f>=_.length&&(f=T),h(t)){v[T]=t.layer.blendMode;let e="normal"!==t.layer.blendMode;if(i(t.layer.parent)){const r=U(t.layer.parent);null!=r&&""!==r&&(e=B(t.layer.parent)||e)}e&&(m=e,u=!1)}if(0===g&&!m){_[T].pendingUpdates&=~(k.TEXTURE_NOFADING&k.TEXTURE_FADING);continue}++n;const x=S(e,T);if(x){if(_[T].pendingUpdates&=~(k.TEXTURE_NOFADING&k.TEXTURE_FADING),i(t.layer.parent)){const e=U(t.layer.parent);null!=e&&""!==e&&G(t.layer.parent,T)}d(t)?c=Math.max(c,this.tileSize*l):1===s&&1===b&&(t.isOpaque||this._dataToTexture(x)&&x.sourceLayerInfo.data.descriptor.isOpaque)&&(u=!0),++o,null===y&&(y=T)}}const g=c/this.tileSize;0!==o&&null!==y?1===o&&!m&&this._useLayerTexture(e,y,f,q[y])||this._composeMapLayers(e,t,T-1,f,F,v,c,g,!u||m,z,m):this._useBackgroundTexture(e,n)}_ensureBackgroundTexture(e){return null==this._backgroundTexture&&(this._backgroundTexture=this._buildTexture(e,!1),this._backgroundDirty=!0),this._backgroundDirty&&(this._composition.bind(e),this._passParameters.offset=o,this._passParameters.scale=1,this._passParameters.opacity=1,null!=this.backgroundColor&&(this._passParameters.backgroundColor=this.backgroundColor),this._composition.drawBackground(this._passParameters,null!=this.backgroundColor),this._composition.copyFBOToTexture(this._backgroundTexture),this._composition.unbind(),this._backgroundDirty=!1),this._backgroundTexture}_useBackgroundTexture(e,t){const r=this._ensureBackgroundTexture(this.tileSize);let s=g.Immediate;(e.surface.view.layerViewManager.updating||t>0)&&(s=g.Delayed);const o=e.renderData;null==o.textureReference&&(s=g.Immediate),o.setTextureReference(new b(r,u.FADING,V,e.surface.baseOpacity,0,1),s)}_useLayerTexture(e,t,r,s){const o=t<r,a=o?1:e.surface.baseOpacity,i=o?e.surface.baseOpacity:1,n=S(e,t);return!!this._dataToTexture(n)&&(e.renderData.setTextureReference(new b(n.sourceLayerInfo.data,u.FADING,n,a,i,s)),!0)}_composeMapLayers(e,t,r,s,a,i,n,c,u,l,p){this._composition.ensureBuffer(n);const h=e.surface.baseOpacity;let d=!1,f=M.LINEAR_MIPMAP_LINEAR,T=!1,y=0;for(let b=r;b>=0;b--){const t=S(e,b);if(!t||0===a[b]&&!p)continue;const r=b<s&&h<1&&!d;r&&(d=!0),this._passParameters.baseOpacity=r?h:1;const g=this._passParameters.baseOpacity<1?P.Required:P.NotRequired;let x=!1;l.forEach((e=>{e.start===b&&(H.push(e),this._composition.openGroup(n),x=!0)}));const w=0===y,I=x?E.GroupBackgroundComposite:u&&w?this.backgroundIsGrid?E.GridComposite:E.ColorComposite:E.Composite,k=A[i[b]];for(m(t)?(this._passParameters.opacity=a[b],T=this._composition.drawVectorData(this._passParameters,I,n,k,g,t,c,this.tileSize,T)):_(t)?(this._passParameters.opacity=a[b],this._composition.drawImageryTileData(this._passParameters,I,n,k,g,t),this._hasNearestInterpolation(t)&&(f=M.NEAREST)):this._dataToTexture(t)&&(this._passParameters.texture=t.sourceLayerInfo.data.texture,this._passParameters.offset=t.offset,this._passParameters.scale=t.scale,this._passParameters.opacity=a[b],this._composition.drawRasterData(this._passParameters,I,n,k,g));H.length>0&&H.at(-1).end===b;){const e=H.pop();this._passParameters.opacity=e.opacity,this._passParameters.offset=o,this._passParameters.scale=1;const t=u&&w?this.backgroundIsGrid?E.GridComposite:E.ColorComposite:E.Composite;this._composition.drawGroup(this._passParameters,t,n,A[e.blendMode],g)}y++}const g=e.renderData,x=p||d&&h<1,w=g.ensureTexture(n,x,(()=>this._buildTexture(n,x,f)));this._composition.copyFBOToTexture(w),this._composition.unbind(),g.setTextureReference(new b(w,t,V,d?1:h,0,1))}_hasNearestInterpolation(e){const t=e.sourceLayerInfo.data;return!!t.source&&"nearest"===t.interpolation}_dataToTexture(e){if(f(e)){const t=e.sourceLayerInfo;t.data=this._buildTexture(t.data,!0),e.tile.setMemoryDirty()}return T(e)}setBackground(e){this._backgroundColor!==e&&(this._backgroundColor=e,this._backgroundDirty=!0)}_buildTexture(e,t,r=M.LINEAR_MIPMAP_LINEAR){if(null==e)return null;const s=new L;s.wrapMode=D.CLAMP_TO_EDGE,s.samplingMode=r,s.maxAnisotropy=this._maxAnisotropy,s.preMultiplyAlpha=!0,s.flipped=!0,s.hasMipmap=!0,t||(s.pixelFormat=O.RGB);const o=this._rctx;let a;if("number"==typeof e){s.width=s.height=e;const t=`${e} ${s.pixelFormat}`,r=this._cache.pop(t);r?(r.retain(),a=r):a=new I(new j(o,s),this._cache)}else if(e instanceof n)s.isOpaque=e.isOpaque,s.isOpaque&&(s.pixelFormat=O.RGB),a=new I(new j(o,s,e.image)),e.release();else try{s.width=e.width,s.height=e.height,a=new I(new j(o,s,e))}catch(c){a=new I(R(o)),console.warn("TileRenderer: failed to execute 'texImage2D', cross-origin image may not be loaded.")}const i=o.bindTexture(a.texture,j.TEXTURE_UNIT_FOR_UPDATES);return a.generateMipmap(),o.bindTexture(i,j.TEXTURE_UNIT_FOR_UPDATES),a}get test(){return{backgroundTexture:this._backgroundTexture}}}function S(e,t){X.layerIndex=t,X.vtlNeighborInfos.clear();const o=e.layerInfo[p.MAP][t];if(o.data)return r(X.offset,0,0),X.tile=e,X.scale=1,X.sourceLod=e.lij,X.sourceLayerInfo=o,m(X)&&e.forEachLoadedNeighbor(((r,s)=>{if(r.level!==e.level)return;const a=r.layerInfo[p.MAP][t];if(!y(a)||o.data===a.data)return;const i=X.vtlNeighborInfos.pushNew();i.offset=W[s],i.sourceLod=r.lij,i.sourceLayerInfo=a})),X;const a=o.upsampleInfo;if(a){const e=a.tile.layerInfo[p.MAP][t];return X.tile=a.tile,s(X.offset,a.offset),X.scale=a.scale,X.sourceLod=a.tile.lij,X.sourceLayerInfo=e,X}return null}function U(e){return e.uid}function B(e){let t="normal"!==e.blendMode;return i(e.parent)&&(t=B(e.parent)||t),t}function G(e,t){i(e.parent)&&G(e.parent,t);const r=U(e);if(null!=r&&""!==r){const s=z.get(r);s?s.start=t:z.set(r,new N(t,t,e.blendMode,e.opacity))}}const F=new Array,q=new Array,v=new Array,z=new Map,H=new Array,X=new w,V={offset:[0,0],scale:1},W=new Array;W[l.NORTH]=[0,-1],W[l.NORTH_EAST]=[-1,-1],W[l.EAST]=[-1,0],W[l.SOUTH_EAST]=[-1,1],W[l.SOUTH]=[0,1],W[l.SOUTH_WEST]=[1,1],W[l.WEST]=[1,0],W[l.NORTH_WEST]=[1,-1];export{N as GroupInfo,C as TileRenderer};
5
+ import{disposeMaybe as e,releaseMaybe as t}from"../../../core/maybe.js";import{s as r,j as s}from"../../../chunks/vec2.js";import{Z as o}from"../../../chunks/vec2f64.js";import{isBaseLayer as a,isGroupLayer as i}from"../../../layers/support/layerUtils.js";import{ImageWithType as n}from"../support/StreamDataLoader.js";import{BlendLayersPassParameters as c}from"./BlendLayersTechnique.js";import{TextureUpdate as u}from"./interfaces.js";import{NeighborIndex as l}from"./ITile.js";import{LayerClass as p}from"./LayerClass.js";import{isBlendableLayerView as h,isVectorTileLayerView as d,isVectorTileRenderInfo as m,isImageryTileRenderInfo as _,isRasterTileRenderInfo as f,isTextureTileRenderInfo as T,isVectorTilePerLayerInfo as y}from"./terrainUtils.js";import{ActivationTime as g}from"./TextureFader.js";import{TextureReference as b}from"./TextureReference.js";import{TileCompositor as x}from"./TileCompositor.js";import{TileRenderInfo as w}from"./TileRenderInfo.js";import I from"./TileTexture.js";import{TileUpdate as k}from"./TileUpdate.js";import{blendModeFromString as A}from"../webgl-engine/core/shaderLibrary/output/BlendOptions.js";import{BaseOpacityMode as P,BlendLayersOutput as E}from"../webgl-engine/core/shaderLibrary/terrain/TileBackground.glsl.js";import{createEmptyTexture as R}from"../webgl-engine/lib/glUtil3D.js";import{TextureSamplingMode as M,TextureWrapMode as D,PixelFormat as O}from"../../webgl/enums.js";import{Texture as j}from"../../webgl/Texture.js";import{TextureDescriptor as L}from"../../webgl/TextureDescriptor.js";class N{constructor(e,t,r,s){this.start=e,this.end=t,this.blendMode=r,this.opacity=s}}class C{constructor(e,t,r,s){this._rctx=e,this.tileSize=t,this._techniques=r,this._cache=s,this._passParameters=new c,this._backgroundTexture=null,this._backgroundColor=null,this._backgroundDirty=!1,this._maxAnisotropy=this._rctx.parameters.maxMaxAnisotropy,this._composition=new x(this._rctx,this._techniques),this._ensureBackgroundTexture(this.tileSize)}dispose(){this._composition=e(this._composition),this._backgroundTexture=t(this._backgroundTexture)}get backgroundIsGrid(){return null==this._backgroundColor}get backgroundColor(){return this._backgroundColor}updateTileTexture(e,t){if(!e.renderData)return;const r=e.surface,s=r.baseOpacity;let o=0,n=0,c=this.tileSize,u=!1;const l=r.view.state.contentPixelRatio;let m=!1;z.clear(),H.length=0;const _=e.layerInfo[p.MAP];let f=_.length,T=0,y=null;for(;T<_.length;T++){const t=r.layerViewByIndex(T,p.MAP),g=t.layer.opacity;F[T]=g;const b=t.fullOpacity;if(q[T]=b,a(t.layer)&&f>=_.length&&(f=T),h(t)){v[T]=t.layer.blendMode;let e="normal"!==t.layer.blendMode;if(i(t.layer.parent)){const r=U(t.layer.parent);null!=r&&""!==r&&(e=B(t.layer.parent)||e)}e&&(m=e,u=!1)}if(0===g&&!m){_[T].pendingUpdates&=~(k.TEXTURE_NOFADING&k.TEXTURE_FADING);continue}++n;const x=S(e,T);if(x){if(_[T].pendingUpdates&=~(k.TEXTURE_NOFADING&k.TEXTURE_FADING),i(t.layer.parent)){const e=U(t.layer.parent);null!=e&&""!==e&&G(t.layer.parent,T)}d(t)?c=Math.max(c,this.tileSize*l):1===s&&1===b&&(t.isOpaque||this._dataToTexture(x)&&x.sourceLayerInfo.data.descriptor.isOpaque)&&(u=!0),++o,null===y&&(y=T)}}const g=c/this.tileSize;0!==o&&null!==y?1===o&&!m&&this._useLayerTexture(e,y,f,q[y])||this._composeMapLayers(e,t,T-1,f,F,v,c,g,!u||m,z,m):this._useBackgroundTexture(e,n)}_ensureBackgroundTexture(e){return null==this._backgroundTexture&&(this._backgroundTexture=this._buildTexture(e,!1),this._backgroundDirty=!0),this._backgroundDirty&&(this._composition.bind(e),this._passParameters.offset=o,this._passParameters.scale=1,this._passParameters.opacity=1,null!=this.backgroundColor&&(this._passParameters.backgroundColor=this.backgroundColor),this._composition.drawBackground(this._passParameters,null!=this.backgroundColor),this._composition.copyFBOToTexture(this._backgroundTexture),this._composition.unbind(),this._backgroundDirty=!1),this._backgroundTexture}_useBackgroundTexture(e,t){const r=this._ensureBackgroundTexture(this.tileSize);let s=g.Immediate;(e.surface.view.layerViewManager.updating||t>0)&&(s=g.Delayed);const o=e.renderData;null==o.textureReference&&(s=g.Immediate),o.setTextureReference(new b(r,u.FADING,V,e.surface.baseOpacity,0,1),s)}_useLayerTexture(e,t,r,s){const o=t<r,a=o?1:e.surface.baseOpacity,i=o?e.surface.baseOpacity:1,n=S(e,t);return!!this._dataToTexture(n)&&(e.renderData.setTextureReference(new b(n.sourceLayerInfo.data,u.FADING,n,a,i,s)),!0)}_composeMapLayers(e,t,r,s,a,i,n,c,u,l,p){this._composition.ensureBuffer(n);const h=e.surface.baseOpacity;let d=!1,f=M.LINEAR_MIPMAP_LINEAR,T=!1,y=0;for(let b=r;b>=0;b--){const t=S(e,b);if(!t||0===a[b]&&!p)continue;const r=b<s&&h<1&&!d;r&&(d=!0),this._passParameters.baseOpacity=r?h:1;const g=this._passParameters.baseOpacity<1?P.Required:P.NotRequired;let x=!1;l.forEach((e=>{e.start===b&&(H.push(e),this._composition.openGroup(n),x=!0)}));const w=0===y,I=x?E.GroupBackgroundComposite:u&&w?this.backgroundIsGrid?E.GridComposite:E.ColorComposite:E.Composite,k=A[i[b]];for(m(t)?(this._passParameters.opacity=a[b],T=this._composition.drawVectorData(this._passParameters,I,n,k,g,t,c,this.tileSize,T)):_(t)?(this._passParameters.opacity=a[b],this._composition.drawImageryTileData(this._passParameters,I,n,k,g,t),this._hasNearestInterpolation(t)&&(f=M.NEAREST)):this._dataToTexture(t)&&(this._passParameters.texture=t.sourceLayerInfo.data.texture,this._passParameters.offset=t.offset,this._passParameters.scale=t.scale,this._passParameters.opacity=a[b],this._composition.drawRasterData(this._passParameters,I,n,k,g));H.length>0&&H[H.length-1].end===b;){const e=H.pop();this._passParameters.opacity=e.opacity,this._passParameters.offset=o,this._passParameters.scale=1;const t=u&&w?this.backgroundIsGrid?E.GridComposite:E.ColorComposite:E.Composite;this._composition.drawGroup(this._passParameters,t,n,A[e.blendMode],g)}y++}const g=e.renderData,x=p||d&&h<1,w=g.ensureTexture(n,x,(()=>this._buildTexture(n,x,f)));this._composition.copyFBOToTexture(w),this._composition.unbind(),g.setTextureReference(new b(w,t,V,d?1:h,0,1))}_hasNearestInterpolation(e){const t=e.sourceLayerInfo.data;return!!t.source&&"nearest"===t.interpolation}_dataToTexture(e){if(f(e)){const t=e.sourceLayerInfo;t.data=this._buildTexture(t.data,!0),e.tile.setMemoryDirty()}return T(e)}setBackground(e){this._backgroundColor!==e&&(this._backgroundColor=e,this._backgroundDirty=!0)}_buildTexture(e,t,r=M.LINEAR_MIPMAP_LINEAR){if(null==e)return null;const s=new L;s.wrapMode=D.CLAMP_TO_EDGE,s.samplingMode=r,s.maxAnisotropy=this._maxAnisotropy,s.preMultiplyAlpha=!0,s.flipped=!0,s.hasMipmap=!0,t||(s.pixelFormat=O.RGB);const o=this._rctx;let a;if("number"==typeof e){s.width=s.height=e;const t=`${e} ${s.pixelFormat}`,r=this._cache.pop(t);r?(r.retain(),a=r):a=new I(new j(o,s),this._cache)}else if(e instanceof n)s.isOpaque=e.isOpaque,s.isOpaque&&(s.pixelFormat=O.RGB),a=new I(new j(o,s,e.image)),e.release();else try{s.width=e.width,s.height=e.height,a=new I(new j(o,s,e))}catch(c){a=new I(R(o)),console.warn("TileRenderer: failed to execute 'texImage2D', cross-origin image may not be loaded.")}const i=o.bindTexture(a.texture,j.TEXTURE_UNIT_FOR_UPDATES);return a.generateMipmap(),o.bindTexture(i,j.TEXTURE_UNIT_FOR_UPDATES),a}get test(){return{backgroundTexture:this._backgroundTexture}}}function S(e,t){X.layerIndex=t,X.vtlNeighborInfos.clear();const o=e.layerInfo[p.MAP][t];if(o.data)return r(X.offset,0,0),X.tile=e,X.scale=1,X.sourceLod=e.lij,X.sourceLayerInfo=o,m(X)&&e.forEachLoadedNeighbor(((r,s)=>{if(r.level!==e.level)return;const a=r.layerInfo[p.MAP][t];if(!y(a)||o.data===a.data)return;const i=X.vtlNeighborInfos.pushNew();i.offset=W[s],i.sourceLod=r.lij,i.sourceLayerInfo=a})),X;const a=o.upsampleInfo;if(a){const e=a.tile.layerInfo[p.MAP][t];return X.tile=a.tile,s(X.offset,a.offset),X.scale=a.scale,X.sourceLod=a.tile.lij,X.sourceLayerInfo=e,X}return null}function U(e){return e.uid}function B(e){let t="normal"!==e.blendMode;return i(e.parent)&&(t=B(e.parent)||t),t}function G(e,t){i(e.parent)&&G(e.parent,t);const r=U(e);if(null!=r&&""!==r){const s=z.get(r);s?s.start=t:z.set(r,new N(t,t,e.blendMode,e.opacity))}}const F=new Array,q=new Array,v=new Array,z=new Map,H=new Array,X=new w,V={offset:[0,0],scale:1},W=new Array;W[l.NORTH]=[0,-1],W[l.NORTH_EAST]=[-1,-1],W[l.EAST]=[-1,0],W[l.SOUTH_EAST]=[-1,1],W[l.SOUTH]=[0,1],W[l.SOUTH_WEST]=[1,1],W[l.WEST]=[1,0],W[l.NORTH_WEST]=[1,-1];export{N as GroupInfo,C 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.28/esri/copyright.txt for details.
4
4
  */
5
- import"../../../geometry.js";import e from"../../../core/Error.js";import{deg2rad as i,floatEqualAbsolute as t,floatEqualRelative as s}from"../../../core/mathUtils.js";import{getMetersPerUnitForSR as r}from"../../../core/unitUtils.js";import n from"../../../geometry/Extent.js";import{canProjectToWGS84ComparableLonLat as l}from"../../../geometry/projection.js";import o from"../../../geometry/SpatialReference.js";import{create as a}from"../../../geometry/support/aaBoundingRect.js";import{isMars as h,isMoon as c}from"../../../geometry/support/spatialReferenceUtils.js";import{x2lon as m,y2lat as u}from"../../../geometry/support/webMercatorUtils.js";import p from"../../../layers/support/LOD.js";import g from"../../../layers/support/TileInfo.js";import f from"../../../geometry/Point.js";const x=12;class v{constructor(e){const i=v.checkUnsupported(e);if(null!=i)throw i;const t=e;this.spatialReference=t.spatialReference,this._isWebMercator=this.spatialReference.isWebMercator,this._isGCS=l(this.spatialReference)||h(this.spatialReference)||c(this.spatialReference),this.origin=[t.origin.x,t.origin.y],this.pixelSize=t.size[0],this.dpi=t.dpi;const s=t.lods.reduce(((e,i,t)=>(i.level<e.min&&(e.min=i.level,e.minIndex=t),e.max=Math.max(e.max,i.level),e)),{min:1/0,minIndex:0,max:-1/0}),r=t.lods[s.minIndex],n=2**r.level;let o=r.resolution*n,a=r.scale*n;this.levels=new Array(s.max+1);for(let l=0;l<this.levels.length;l++)this.levels[l]={resolution:o,scale:a,tileSize:[o*t.size[0],o*t.size[1]]},o/=2,a/=2}clone(){return new v(this.toTileInfo())}toTileInfo(){return new g({dpi:this.dpi,origin:new f({x:this.origin[0],y:this.origin[1],spatialReference:this.spatialReference}),size:[this.pixelSize,this.pixelSize],spatialReference:this.spatialReference,lods:this.levels.map(((e,i)=>new p({level:i,scale:e.scale,resolution:e.resolution})))})}getExtent(e,i,t,s){const r=this.levels[e],n=r.tileSize[0],l=r.tileSize[1];s[0]=this.origin[0]+t*n,s[2]=this.origin[0]+(t+1)*n,s[3]=this.origin[1]-i*l,s[1]=this.origin[1]-(i+1)*l}convertExtentToRadians(e,t){this._isWebMercator?(t[0]=m(e[0]),t[1]=u(e[1]),t[2]=m(e[2]),t[3]=u(e[3])):this._isGCS&&(t[0]=i(e[0]),t[1]=i(e[1]),t[2]=i(e[2]),t[3]=i(e[3]))}getExtentGeometry(e,i,t,s=new n){return this.getExtent(e,i,t,M),s.spatialReference=this.spatialReference,s.xmin=M[0],s.ymin=M[1],s.xmax=M[2],s.ymax=M[3],s.zmin=void 0,s.zmax=void 0,s}ensureMaxLod(e){if(null==e)return!1;let i=!1;for(;this.levels.length<=e;){const e=this.levels.at(-1),t=e.resolution/2;this.levels.push({resolution:t,scale:e.scale/2,tileSize:[t*this.pixelSize,t*this.pixelSize]}),i=!0}return i}capMaxLod(e){this.levels.length>e+1&&(this.levels.length=e+1)}getMaxLod(){return this.levels.length-1}scaleAtLevel(e){return this.levels[0].scale/2**e}levelAtScale(e){const i=this.levels[0].scale;return e>=i?0:Math.log(i/e)*Math.LOG2E}resolutionAtLevel(e){return this.levels[0].resolution/2**e}compatibleWith(e){if(!(e instanceof v)){if(v.checkUnsupported(e))return!1;e=new v(e)}if(!e.spatialReference.equals(this.spatialReference))return!1;if(e.pixelSize!==this.pixelSize)return!1;const i=Math.min(this.levels.length,e.levels.length)-1,s=this.levels[i].resolution;let r=.5*s;if(!t(e.origin[0],this.origin[0],r)||!t(e.origin[1],this.origin[1],r))return!1;return r=.5*s/2**i/this.pixelSize*x,t(s,e.levels[i].resolution,r)}rootTilesInExtent(e,i=null,t=1/0){const s=new Array,r=this.levels[0].tileSize;if(null==e||0===r[0]||0===r[1])return s;v.computeRowColExtent(e,r,this.origin,M);let n=M[1],l=M[3],o=M[0],a=M[2];const h=a-o,c=l-n;if(h*c>t){const e=Math.floor(Math.sqrt(t));c>e&&(n=n+Math.floor(.5*c)-Math.floor(.5*e),l=n+e),h>e&&(o=o+Math.floor(.5*h)-Math.floor(.5*e),a=o+e)}for(let m=n;m<l;m++)for(let e=o;e<a;e++)s.push([0,m,e]);return null!=i&&(i[0]=this.origin[0]+o*r[0],i[1]=this.origin[1]-l*r[1],i[2]=this.origin[0]+a*r[0],i[3]=this.origin[1]-n*r[1]),s}static computeRowColExtent(e,i,t,s){const r=.001*(e[2]-e[0]+(e[3]-e[1]));s[0]=Math.max(0,Math.floor((e[0]+r-t[0])/i[0])),s[2]=Math.max(0,Math.ceil((e[2]-r-t[0])/i[0])),s[1]=Math.max(0,Math.floor((t[1]-e[3]+r)/i[1])),s[3]=Math.max(0,Math.ceil((t[1]-e[1]-r)/i[1]))}static isPowerOfTwo(e){const i=e.lods,t=i[0].resolution*2**i[0].level;return!i.some((e=>!s(e.resolution,t/2**e.level)))}static hasGapInLevels(e){const i=e.lods.map((e=>e.level));i.sort(((e,i)=>e-i));for(let t=1;t<i.length;t++)if(i[t]!==i[0]+t)return!0;return!1}static tileSizeSupported(e){const i=e.size[1];return i===e.size[0]&&0==(i&i-1)&&i>=128&&i<=512}static hasOriginPerLODs(e){const i=e.origin;return e.lods.some((e=>null!=e.origin&&(e.origin[0]!==i.x||e.origin[1]!==i.y)))}static getMissingTileInfoError(){return new e("tilingscheme:tile-info-missing","Tiling scheme must have tiling information")}static checkUnsupported(i){return null==i?w():i.lods.length<1?new e("tilingscheme:generic","Tiling scheme must have at least one level"):v.isPowerOfTwo(i)?v.hasGapInLevels(i)?new e("tilingscheme:gaps","Tiling scheme levels must not have gaps between min and max level"):v.tileSizeSupported(i)?v.hasOriginPerLODs(i)?new e("tilingscheme:multiple-origin","Tiling scheme levels must not have their own origin"):null:new e("tilingscheme:tile-size","Tiles must be square and size must be one of [128, 256, 512]"):new e("tilingscheme:power-of-two","Tiling scheme must be power of two")}static fromExtent(e,i){const t=e[2]-e[0],s=e[3]-e[1],n=r(i),l=1.2*Math.max(t,s),o=256,a=96,h=.0254,c=new v(new g({size:[o,o],origin:new f({x:e[0]-.5*(l-t),y:e[3]+.5*(l-s)}),lods:[new p({level:0,resolution:l/o,scale:1/(o/a*h/(l*n))})],spatialReference:i}));return c.ensureMaxLod(20),c}static makeWebMercatorAuxiliarySphere(e){const i=new v(v.WebMercatorAuxiliarySphereTileInfo);return i.ensureMaxLod(e),i}static makeGCSWithTileSize(e,i=256,t=16){const s=256/i,r=new v(new g({size:[i,i],origin:new f({x:-180,y:90,spatialReference:e}),spatialReference:e,lods:[new p({level:0,resolution:.703125*s,scale:295497598.570834*s})]}));return r.ensureMaxLod(t),r}get test(){return{isWebMercator:this._isWebMercator,isGCS:this._isGCS}}}function w(){return new e("tilingscheme:tile-info-missing","Tiling scheme must have tiling information")}v.WebMercatorAuxiliarySphereTileInfo=new g({size:[256,256],origin:new f({x:-20037508.342787,y:20037508.342787,spatialReference:o.WebMercator}),spatialReference:o.WebMercator,lods:[new p({level:0,resolution:156543.03392800014,scale:591657527.591555})]}),v.WebMercatorAuxiliarySphere=v.makeWebMercatorAuxiliarySphere(19);const M=a();export{v as TilingScheme,w as getMissingTileInfoError};
5
+ import"../../../geometry.js";import e from"../../../core/Error.js";import{deg2rad as i,floatEqualAbsolute as t,floatEqualRelative as s}from"../../../core/mathUtils.js";import{getMetersPerUnitForSR as r}from"../../../core/unitUtils.js";import n from"../../../geometry/Extent.js";import{canProjectToWGS84ComparableLonLat as l}from"../../../geometry/projection.js";import o from"../../../geometry/SpatialReference.js";import{create as a}from"../../../geometry/support/aaBoundingRect.js";import{isMars as h,isMoon as c}from"../../../geometry/support/spatialReferenceUtils.js";import{x2lon as m,y2lat as u}from"../../../geometry/support/webMercatorUtils.js";import p from"../../../layers/support/LOD.js";import g from"../../../layers/support/TileInfo.js";import f from"../../../geometry/Point.js";const x=12;class v{constructor(e){const i=v.checkUnsupported(e);if(null!=i)throw i;const t=e;this.spatialReference=t.spatialReference,this._isWebMercator=this.spatialReference.isWebMercator,this._isGCS=l(this.spatialReference)||h(this.spatialReference)||c(this.spatialReference),this.origin=[t.origin.x,t.origin.y],this.pixelSize=t.size[0],this.dpi=t.dpi;const s=t.lods.reduce(((e,i,t)=>(i.level<e.min&&(e.min=i.level,e.minIndex=t),e.max=Math.max(e.max,i.level),e)),{min:1/0,minIndex:0,max:-1/0}),r=t.lods[s.minIndex],n=2**r.level;let o=r.resolution*n,a=r.scale*n;this.levels=new Array(s.max+1);for(let l=0;l<this.levels.length;l++)this.levels[l]={resolution:o,scale:a,tileSize:[o*t.size[0],o*t.size[1]]},o/=2,a/=2}clone(){return new v(this.toTileInfo())}toTileInfo(){return new g({dpi:this.dpi,origin:new f({x:this.origin[0],y:this.origin[1],spatialReference:this.spatialReference}),size:[this.pixelSize,this.pixelSize],spatialReference:this.spatialReference,lods:this.levels.map(((e,i)=>new p({level:i,scale:e.scale,resolution:e.resolution})))})}getExtent(e,i,t,s){const r=this.levels[e],n=r.tileSize[0],l=r.tileSize[1];s[0]=this.origin[0]+t*n,s[2]=this.origin[0]+(t+1)*n,s[3]=this.origin[1]-i*l,s[1]=this.origin[1]-(i+1)*l}convertExtentToRadians(e,t){this._isWebMercator?(t[0]=m(e[0]),t[1]=u(e[1]),t[2]=m(e[2]),t[3]=u(e[3])):this._isGCS&&(t[0]=i(e[0]),t[1]=i(e[1]),t[2]=i(e[2]),t[3]=i(e[3]))}getExtentGeometry(e,i,t,s=new n){return this.getExtent(e,i,t,M),s.spatialReference=this.spatialReference,s.xmin=M[0],s.ymin=M[1],s.xmax=M[2],s.ymax=M[3],s.zmin=void 0,s.zmax=void 0,s}ensureMaxLod(e){if(null==e)return!1;let i=!1;for(;this.levels.length<=e;){const e=this.levels[this.levels.length-1],t=e.resolution/2;this.levels.push({resolution:t,scale:e.scale/2,tileSize:[t*this.pixelSize,t*this.pixelSize]}),i=!0}return i}capMaxLod(e){this.levels.length>e+1&&(this.levels.length=e+1)}getMaxLod(){return this.levels.length-1}scaleAtLevel(e){return this.levels[0].scale/2**e}levelAtScale(e){const i=this.levels[0].scale;return e>=i?0:Math.log(i/e)*Math.LOG2E}resolutionAtLevel(e){return this.levels[0].resolution/2**e}compatibleWith(e){if(!(e instanceof v)){if(v.checkUnsupported(e))return!1;e=new v(e)}if(!e.spatialReference.equals(this.spatialReference))return!1;if(e.pixelSize!==this.pixelSize)return!1;const i=Math.min(this.levels.length,e.levels.length)-1,s=this.levels[i].resolution;let r=.5*s;if(!t(e.origin[0],this.origin[0],r)||!t(e.origin[1],this.origin[1],r))return!1;return r=.5*s/2**i/this.pixelSize*x,t(s,e.levels[i].resolution,r)}rootTilesInExtent(e,i=null,t=1/0){const s=new Array,r=this.levels[0].tileSize;if(null==e||0===r[0]||0===r[1])return s;v.computeRowColExtent(e,r,this.origin,M);let n=M[1],l=M[3],o=M[0],a=M[2];const h=a-o,c=l-n;if(h*c>t){const e=Math.floor(Math.sqrt(t));c>e&&(n=n+Math.floor(.5*c)-Math.floor(.5*e),l=n+e),h>e&&(o=o+Math.floor(.5*h)-Math.floor(.5*e),a=o+e)}for(let m=n;m<l;m++)for(let e=o;e<a;e++)s.push([0,m,e]);return null!=i&&(i[0]=this.origin[0]+o*r[0],i[1]=this.origin[1]-l*r[1],i[2]=this.origin[0]+a*r[0],i[3]=this.origin[1]-n*r[1]),s}static computeRowColExtent(e,i,t,s){const r=.001*(e[2]-e[0]+(e[3]-e[1]));s[0]=Math.max(0,Math.floor((e[0]+r-t[0])/i[0])),s[2]=Math.max(0,Math.ceil((e[2]-r-t[0])/i[0])),s[1]=Math.max(0,Math.floor((t[1]-e[3]+r)/i[1])),s[3]=Math.max(0,Math.ceil((t[1]-e[1]-r)/i[1]))}static isPowerOfTwo(e){const i=e.lods,t=i[0].resolution*2**i[0].level;return!i.some((e=>!s(e.resolution,t/2**e.level)))}static hasGapInLevels(e){const i=e.lods.map((e=>e.level));i.sort(((e,i)=>e-i));for(let t=1;t<i.length;t++)if(i[t]!==i[0]+t)return!0;return!1}static tileSizeSupported(e){const i=e.size[1];return i===e.size[0]&&0==(i&i-1)&&i>=128&&i<=512}static hasOriginPerLODs(e){const i=e.origin;return e.lods.some((e=>null!=e.origin&&(e.origin[0]!==i.x||e.origin[1]!==i.y)))}static getMissingTileInfoError(){return new e("tilingscheme:tile-info-missing","Tiling scheme must have tiling information")}static checkUnsupported(i){return null==i?w():i.lods.length<1?new e("tilingscheme:generic","Tiling scheme must have at least one level"):v.isPowerOfTwo(i)?v.hasGapInLevels(i)?new e("tilingscheme:gaps","Tiling scheme levels must not have gaps between min and max level"):v.tileSizeSupported(i)?v.hasOriginPerLODs(i)?new e("tilingscheme:multiple-origin","Tiling scheme levels must not have their own origin"):null:new e("tilingscheme:tile-size","Tiles must be square and size must be one of [128, 256, 512]"):new e("tilingscheme:power-of-two","Tiling scheme must be power of two")}static fromExtent(e,i){const t=e[2]-e[0],s=e[3]-e[1],n=r(i),l=1.2*Math.max(t,s),o=256,a=96,h=.0254,c=new v(new g({size:[o,o],origin:new f({x:e[0]-.5*(l-t),y:e[3]+.5*(l-s)}),lods:[new p({level:0,resolution:l/o,scale:1/(o/a*h/(l*n))})],spatialReference:i}));return c.ensureMaxLod(20),c}static makeWebMercatorAuxiliarySphere(e){const i=new v(v.WebMercatorAuxiliarySphereTileInfo);return i.ensureMaxLod(e),i}static makeGCSWithTileSize(e,i=256,t=16){const s=256/i,r=new v(new g({size:[i,i],origin:new f({x:-180,y:90,spatialReference:e}),spatialReference:e,lods:[new p({level:0,resolution:.703125*s,scale:295497598.570834*s})]}));return r.ensureMaxLod(t),r}get test(){return{isWebMercator:this._isWebMercator,isGCS:this._isGCS}}}function w(){return new e("tilingscheme:tile-info-missing","Tiling scheme must have tiling information")}v.WebMercatorAuxiliarySphereTileInfo=new g({size:[256,256],origin:new f({x:-20037508.342787,y:20037508.342787,spatialReference:o.WebMercator}),spatialReference:o.WebMercator,lods:[new p({level:0,resolution:156543.03392800014,scale:591657527.591555})]}),v.WebMercatorAuxiliarySphere=v.makeWebMercatorAuxiliarySphere(19);const M=a();export{v as TilingScheme,w as getMissingTileInfoError};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{ComponentRangeRunLengthEncoded as t}from"./IndexRange/ComponentRangeRunLengthEncoded.js";class e{constructor(e,h){this.offsets=h,this.pickability=null,this.highlightCounts=null,this.verticalOffsets=null,this.cachedGeometryRanges=null,this.cachedHighlightRanges=null,this.cachedDefaultRanges=null;const i=this.count;this.visibility=new t(i),this.materialDataBuffer=e.getBuffer(i),this.materialDataIndices=new Uint16Array(i);for(let t=0;t<i;t++)this.materialDataIndices[t]=this.materialDataBuffer.acquireIndex()}destroy(){for(let t=0;t<this.count;t++)this.materialDataBuffer.releaseIndex(this.materialDataIndices[t])}get count(){return this.offsets.length-1}get geometryRanges(){return null==this.cachedGeometryRanges&&(this.cachedGeometryRanges=this.visibility.computeOffsetRanges(this.offsets)),this.cachedGeometryRanges}get highlightRanges(){return null==this.highlightCounts?null:(this._updateCachedHighlightRanges(),this.cachedHighlightRanges)}get defaultShadowMapRanges(){return null==this.highlightCounts?this.geometryRanges:(this._updateCachedHighlightRanges(),this.cachedDefaultRanges)}highlightsDirty(){this.cachedHighlightRanges=null,this.cachedDefaultRanges=null}visibilityDirty(){this.cachedGeometryRanges=null,this.highlightsDirty()}_updateCachedHighlightRanges(){if((null==this.cachedHighlightRanges||null==this.cachedDefaultRanges)&&null!=this.highlightCounts){const{highlightRanges:t,defaultRanges:e}=h(this.highlightCounts,this.visibility,this.offsets);this.cachedHighlightRanges=t,this.cachedDefaultRanges=e}}}function h(t,e,h){const i=[],s=[];let a=h.length,n=h.length;return e.forEachComponent((e=>(t[e]>0?(a!==e-1&&(i.length&&i.push(h[a+1]-i.at(-1)),i.push(h[e])),a=e):(n!==e-1&&(s.length&&s.push(h[n+1]-s.at(-1)),s.push(h[e])),n=e),!0))),i.length&&i.push(h[a+1]-i.at(-1)),s.length&&s.push(h[n+1]-s.at(-1)),{highlightRanges:i,defaultRanges:s}}export{e as default};
5
+ import{ComponentRangeRunLengthEncoded as t}from"./IndexRange/ComponentRangeRunLengthEncoded.js";class e{constructor(e,h){this.offsets=h,this.pickability=null,this.highlightCounts=null,this.verticalOffsets=null,this.cachedGeometryRanges=null,this.cachedHighlightRanges=null,this.cachedDefaultRanges=null;const i=this.count;this.visibility=new t(i),this.materialDataBuffer=e.getBuffer(i),this.materialDataIndices=new Uint16Array(i);for(let t=0;t<i;t++)this.materialDataIndices[t]=this.materialDataBuffer.acquireIndex()}destroy(){for(let t=0;t<this.count;t++)this.materialDataBuffer.releaseIndex(this.materialDataIndices[t])}get count(){return this.offsets.length-1}get geometryRanges(){return null==this.cachedGeometryRanges&&(this.cachedGeometryRanges=this.visibility.computeOffsetRanges(this.offsets)),this.cachedGeometryRanges}get highlightRanges(){return null==this.highlightCounts?null:(this._updateCachedHighlightRanges(),this.cachedHighlightRanges)}get defaultShadowMapRanges(){return null==this.highlightCounts?this.geometryRanges:(this._updateCachedHighlightRanges(),this.cachedDefaultRanges)}highlightsDirty(){this.cachedHighlightRanges=null,this.cachedDefaultRanges=null}visibilityDirty(){this.cachedGeometryRanges=null,this.highlightsDirty()}_updateCachedHighlightRanges(){if((null==this.cachedHighlightRanges||null==this.cachedDefaultRanges)&&null!=this.highlightCounts){const{highlightRanges:t,defaultRanges:e}=h(this.highlightCounts,this.visibility,this.offsets);this.cachedHighlightRanges=t,this.cachedDefaultRanges=e}}}function h(t,e,h){const i=[],s=[];let a=h.length,n=h.length;return e.forEachComponent((e=>(t[e]>0?(a!==e-1&&(i.length&&i.push(h[a+1]-i[i.length-1]),i.push(h[e])),a=e):(n!==e-1&&(s.length&&s.push(h[n+1]-s[s.length-1]),s.push(h[e])),n=e),!0))),i.length&&i.push(h[a+1]-i[i.length-1]),s.length&&s.push(h[n+1]-s[s.length-1]),{highlightRanges:i,defaultRanges:s}}export{e 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.28/esri/copyright.txt for details.
4
4
  */
5
- class t{}const n=t;function o(t,...n){let o="";for(let r=0;r<n.length;r++)o+=t[r]+n[r];return o+=t.at(-1),o}!function(t){function n(t){return Math.round(t).toString()}function o(t){return t.toPrecision(8)}t.int=n,t.float=o}(o||(o={}));export{n as NoParameters,o as glsl};
5
+ class t{}const n=t;function o(t,...n){let o="";for(let r=0;r<n.length;r++)o+=t[r]+n[r];return o+=t[t.length-1],o}!function(t){function n(t){return Math.round(t).toString()}function o(t){return t.toPrecision(8)}t.int=n,t.float=o}(o||(o={}));export{n as NoParameters,o as glsl};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{disposeMaybe as r}from"../../../../core/maybe.js";import{createScreenSizeTriangleVAO as t}from"../lib/glUtil3D.js";import{PrimitiveType as s}from"../../../webgl/enums.js";class o{constructor(r){this._rctx=r,this._vao=t(r)}destroy(){r(this._vao)}draw(){this._rctx.bindVAO(this._vao),this._rctx.drawArrays(s.TRIANGLES,0,3)}}export{o as ScreenSpaceGeometry};
5
+ import{disposeMaybe as t}from"../../../../core/maybe.js";import{createScreenSizeTriangleVAO as r}from"../lib/glUtil3D.js";import{PrimitiveType as s}from"../../../webgl/enums.js";class o{constructor(t){this._rctx=t,this._vao=r(t)}destroy(){this._vao=t(this._vao)}draw(){null!=this._vao&&(this._rctx.bindVAO(this._vao),this._rctx.drawArrays(s.TRIANGLES,0,3))}get test(){return{cachedWebGLObjects:this._vao?.glName?2:0}}}export{o as ScreenSpaceGeometry};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../chunks/tslib.es6.js";import{abortMaybe as t,disposeMaybe as r}from"../../../../core/maybe.js";import{isAbortError as s,throwIfAborted as i,isAborted as o}from"../../../../core/promiseUtils.js";import{watch as a,syncAndInitial as n}from"../../../../core/reactiveUtils.js";import{property as l}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import{subclass as h}from"../../../../core/accessorSupport/decorators/subclass.js";import{requestImage as c}from"../../../../support/requestImageUtils.js";import{ColorFormat as u}from"../core/FBOCache.js";import{SyncRenderPlugin as m}from"./RenderPlugin.js";import{BlendWeightsTechnique as d}from"../lib/BlendWeightsTechnique.js";import{BlurTechnique as p}from"../lib/BlurTechnique.js";import{EdgeDetectTechnique as _}from"../lib/EdgeDetectTechnique.js";import{RenderFeature as b}from"../lib/RenderFeature.js";import{RenderSlot as x}from"../lib/RenderSlot.js";import{SMAAPassParameters as T}from"../shaders/SMAAPassParameters.js";import{PixelFormat as f,TextureSamplingMode as g,ClearBufferBit as C,TextureWrapMode as R}from"../../../webgl/enums.js";import{Texture as j}from"../../../webgl/Texture.js";import{TextureDescriptor as w}from"../../../webgl/TextureDescriptor.js";let E=class extends m{constructor(e){super(e),this.renderSlots=[x.ANTIALIASING],this._context=null,this._areaTexture=null,this._searchTexture=null,this._isEnabled=!1,this._smaaParameters=new T}canRender(){return this._isEnabled&&null!=this._context}requiresOutput(){return!1}get updating(){return null!=this._abortController}initializeRenderContext(e){this._context=e,this.addHandles([a((()=>this.view.qualitySettings.antialiasingEnabled),(e=>e||this._context?.isFeatureEnabled(b.Antialiasing)?this.enable():this.disable()),n)])}renderFeatureChanged(){this.view.qualitySettings.antialiasingEnabled||this._context?.isFeatureEnabled(b.Antialiasing)?this.enable():this.disable()}uninitializeRenderContext(){this.disable(),this._context=null}enable(){if(this._isEnabled||!this._context||this._abortController)return;this._abortController=new AbortController;const e=this._abortController.signal;import("./SmaaRenderPassData.js").then((t=>this._loadTextures(this._context,t,e))).then((()=>{this._context?.requestRender(),this._abortController=null})).catch((e=>{s(e)||this._dispose()}))}_loadTextures(e,t,r){return i(r),e?Promise.all([c(t.areaTexture).then((t=>q(e.fbos.rctx,g.LINEAR,f.RGB,t))),c(t.searchTexure).then((t=>q(e.fbos.rctx,g.NEAREST,f.LUMINANCE,t)))]).then((([e,t])=>{o(r)?(e.dispose(),t.dispose(),i(r)):(this._areaTexture=e,this._searchTexture=t,this._isEnabled=!0)})):Promise.reject()}disable(){this._abortController=t(this._abortController),this._dispose()}_dispose(){this._areaTexture=r(this._areaTexture),this._searchTexture=r(this._searchTexture),this._isEnabled=!1}render(e){if(!this._isEnabled||!this._context)return;const t=e.offscreenRenderingHelper.colorTexture,r=t.descriptor.width,s=t.descriptor.height,i=this._context.fbos,o=e.bindParameters.output,a=this._context.fbos.rctx;a.setViewport(0,0,r,s);const n=i.acquire(u.RG,r,s);a.bindFramebuffer(n.fbo),a.setClearColor(0,0,0,1),a.clear(C.COLOR_BUFFER_BIT),this._smaaParameters.color=t;const l=this._context.techniqueRepository.acquire(_);a.bindTechnique(l,this._smaaParameters,null),this._context.screen.draw(),l.release();const h=i.acquire(u.RGBA,r,s);a.bindFramebuffer(h.fbo),a.setClearColor(0,0,1,1),a.clear(C.COLOR_BUFFER_BIT),this._smaaParameters.inputTexture=n.colorTexture,this._smaaParameters.areaTexture=this._areaTexture,this._smaaParameters.searchTexture=this._searchTexture;const c=this._context.techniqueRepository.acquire(d);a.bindTechnique(c,this._smaaParameters,null),this._context.screen.draw(),c.release(),a.bindFramebuffer(o),n.release(),a.setClearColor(0,1,0,1),a.clear(C.COLOR_BUFFER_BIT),this._smaaParameters.inputTexture=h.colorTexture;const m=this._context.techniqueRepository.acquire(p);a.bindTechnique(m,this._smaaParameters,null),this._context.screen.draw(),m.release(),h.release()}};function q(e,t,r,s){const i=new w;return i.pixelFormat=r,i.wrapMode=R.CLAMP_TO_EDGE,i.width=s.width,i.height=s.height,i.samplingMode=t,new j(e,i,s)}e([l({constructOnly:!0})],E.prototype,"view",void 0),e([l()],E.prototype,"_context",void 0),e([l()],E.prototype,"_abortController",void 0),e([l({readOnly:!0})],E.prototype,"updating",null),E=e([h("esri.views.3d.webgl-engine.lib.SmaaRenderPass")],E);export{E as SmaaRenderPass};
5
+ import{_ as e}from"../../../../chunks/tslib.es6.js";import{abortMaybe as t,disposeMaybe as r}from"../../../../core/maybe.js";import{isAbortError as s,throwIfAborted as i,isAborted as o}from"../../../../core/promiseUtils.js";import{watch as a,syncAndInitial as n}from"../../../../core/reactiveUtils.js";import{property as l}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import{subclass as h}from"../../../../core/accessorSupport/decorators/subclass.js";import{requestImage as c}from"../../../../support/requestImageUtils.js";import{ColorFormat as u}from"../core/FBOCache.js";import{SyncRenderPlugin as m}from"./RenderPlugin.js";import{BlendWeightsTechnique as d}from"../lib/BlendWeightsTechnique.js";import{BlurTechnique as p}from"../lib/BlurTechnique.js";import{EdgeDetectTechnique as _}from"../lib/EdgeDetectTechnique.js";import{RenderFeature as b}from"../lib/RenderFeature.js";import{RenderSlot as x}from"../lib/RenderSlot.js";import{SMAAPassParameters as T}from"../shaders/SMAAPassParameters.js";import{PixelFormat as f,TextureSamplingMode as g,ClearBufferBit as C,TextureWrapMode as R}from"../../../webgl/enums.js";import{Texture as j}from"../../../webgl/Texture.js";import{TextureDescriptor as w}from"../../../webgl/TextureDescriptor.js";let E=class extends m{constructor(e){super(e),this.renderSlots=[x.ANTIALIASING],this._context=null,this._areaTexture=null,this._searchTexture=null,this._isEnabled=!1,this._smaaParameters=new T}canRender(){return this._isEnabled&&null!=this._context}requiresOutput(){return!1}get updating(){return null!=this._abortController}initializeRenderContext(e){this._context=e,this.addHandles([a((()=>this.view.qualitySettings.antialiasingEnabled),(e=>e||this._context?.isFeatureEnabled(b.Antialiasing)?this.enable():this.disable()),n)])}renderFeatureChanged(){this.view.qualitySettings.antialiasingEnabled||this._context?.isFeatureEnabled(b.Antialiasing)?this.enable():this.disable()}uninitializeRenderContext(){this.disable(),this._context=null}enable(){if(this._isEnabled||!this._context||this._abortController)return;this._abortController=new AbortController;const e=this._abortController.signal;import("./SmaaRenderPassData.js").then((t=>this._loadTextures(this._context,t,e))).then((()=>{this._context?.requestRender(),this._abortController=null})).catch((e=>{s(e)||this._dispose()}))}_loadTextures(e,t,r){return i(r),e?Promise.all([c(t.areaTexture).then((t=>q(e.fbos.rctx,g.LINEAR,f.RGB,t))),c(t.searchTexure).then((t=>q(e.fbos.rctx,g.NEAREST,f.LUMINANCE,t)))]).then((([e,t])=>{o(r)?(e.dispose(),t.dispose(),i(r)):(this._areaTexture=e,this._searchTexture=t,this._isEnabled=!0)})):Promise.reject()}disable(){this._abortController=t(this._abortController),this._dispose()}_dispose(){this._areaTexture=r(this._areaTexture),this._searchTexture=r(this._searchTexture),this._isEnabled=!1}render(e){if(!this._isEnabled||!this._context)return;const t=e.offscreenRenderingHelper.colorTexture,r=t.descriptor.width,s=t.descriptor.height,i=this._context.fbos,o=e.bindParameters.output,a=this._context.fbos.rctx;a.setViewport(0,0,r,s);const n=i.acquire(u.RG,r,s);a.bindFramebuffer(n.fbo),a.setClearColor(0,0,0,1),a.clear(C.COLOR_BUFFER_BIT),this._smaaParameters.color=t;const l=this._context.techniqueRepository.acquire(_);a.bindTechnique(l,this._smaaParameters,null),a.screen.draw(),l.release();const h=i.acquire(u.RGBA,r,s);a.bindFramebuffer(h.fbo),a.setClearColor(0,0,1,1),a.clear(C.COLOR_BUFFER_BIT),this._smaaParameters.inputTexture=n.colorTexture,this._smaaParameters.areaTexture=this._areaTexture,this._smaaParameters.searchTexture=this._searchTexture;const c=this._context.techniqueRepository.acquire(d);a.bindTechnique(c,this._smaaParameters,null),a.screen.draw(),c.release(),a.bindFramebuffer(o),n.release(),a.setClearColor(0,1,0,1),a.clear(C.COLOR_BUFFER_BIT),this._smaaParameters.inputTexture=h.colorTexture;const m=this._context.techniqueRepository.acquire(p);a.bindTechnique(m,this._smaaParameters,null),a.screen.draw(),m.release(),h.release()}};function q(e,t,r,s){const i=new w;return i.pixelFormat=r,i.wrapMode=R.CLAMP_TO_EDGE,i.width=s.width,i.height=s.height,i.samplingMode=t,new j(e,i,s)}e([l({constructOnly:!0})],E.prototype,"view",void 0),e([l()],E.prototype,"_context",void 0),e([l()],E.prototype,"_abortController",void 0),e([l({readOnly:!0})],E.prototype,"updating",null),E=e([h("esri.views.3d.webgl-engine.lib.SmaaRenderPass")],E);export{E as SmaaRenderPass};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{C as s}from"../../../../chunks/Compositing.glsl.js";import{CompositingTechnique as t}from"../shaders/CompositingTechnique.js";import{CompositingTechniqueConfiguration as e,AlphaMode as i}from"../shaders/CompositingTechniqueConfiguration.js";import{H as r}from"../../../../chunks/HUDCompositing.glsl.js";import{HUDCompositingTechnique as o}from"../shaders/HUDCompositingTechnique.js";import{O as a}from"../../../../chunks/OITCompositing.glsl.js";import{OITCompositingTechnique as h}from"../shaders/OITCompositingTechnique.js";class n{constructor(t,i,o){this._rctx=t,this._techniqueRepository=i,this._screen=o,this._configuration=new e,this._passParameters=new s,this._oitParameters=new a,this._hudParameters=new r}compositeOIT(s,t,e,i){this._oitParameters.colorTexture=t,this._oitParameters.alphaTexture=e,this._oitParameters.frontFaceTexture=i;const r=this._techniqueRepository.acquire(h);this._rctx.bindTechnique(r,this._oitParameters,s),this._screen.draw(),r.release()}compositeHUD(s,t){this._hudParameters.texture=t;const e=this._techniqueRepository.acquire(o);this._rctx.bindTechnique(e,this._hudParameters,s),this._screen.draw(),e.release()}composite(s,e,r=i.None,o=1){this._configuration.alphaMode=r,this._configuration.hasOpacityFactor=1!==o,this._passParameters.texture=e,this._passParameters.opacity=o;const a=this._techniqueRepository.acquire(t,this._configuration);this._rctx.bindTechnique(a,this._passParameters,s),this._screen.draw(),a.release()}}export{n as default};
5
+ import{C as s}from"../../../../chunks/Compositing.glsl.js";import{CompositingTechnique as t}from"../shaders/CompositingTechnique.js";import{CompositingTechniqueConfiguration as e,AlphaMode as i}from"../shaders/CompositingTechniqueConfiguration.js";import{H as r}from"../../../../chunks/HUDCompositing.glsl.js";import{HUDCompositingTechnique as o}from"../shaders/HUDCompositingTechnique.js";import{O as a}from"../../../../chunks/OITCompositing.glsl.js";import{OITCompositingTechnique as h}from"../shaders/OITCompositingTechnique.js";class n{constructor(t,i){this._rctx=t,this._techniqueRepository=i,this._configuration=new e,this._passParameters=new s,this._oitParameters=new a,this._hudParameters=new r}compositeOIT(s,t,e,i){this._oitParameters.colorTexture=t,this._oitParameters.alphaTexture=e,this._oitParameters.frontFaceTexture=i;const r=this._techniqueRepository.acquire(h);this._rctx.bindTechnique(r,this._oitParameters,s),this._rctx.screen.draw(),r.release()}compositeHUD(s,t){this._hudParameters.texture=t;const e=this._techniqueRepository.acquire(o);this._rctx.bindTechnique(e,this._hudParameters,s),this._rctx.screen.draw(),e.release()}composite(s,e,r=i.None,o=1){this._configuration.alphaMode=r,this._configuration.hasOpacityFactor=1!==o,this._passParameters.texture=e,this._passParameters.opacity=o;const a=this._techniqueRepository.acquire(t,this._configuration);this._rctx.bindTechnique(a,this._passParameters,s),this._rctx.screen.draw(),a.release()}}export{n 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.28/esri/copyright.txt for details.
4
4
  */
5
- import{b as t,f as n,n as e,g as s,a as o,e as r,s as h,c as l,m as u}from"../../../../chunks/vec3.js";import{f as c,b as a,a as p}from"../../../../chunks/vec3f32.js";import{c as f}from"../../../../chunks/vec3f64.js";import{newDoubleArray as O}from"../../../../geometry/support/DoubleArray.js";import{newFloatArray as i,floatArrayFrom as I}from"../../../../geometry/support/FloatArray.js";import{getZeroIndexArray as w,getContinuousIndexArray as g}from"../../../../geometry/support/Indices.js";import{create as M,fromPositionAndNormal as A,intersectRay as m}from"../../../../geometry/support/plane.js";import{wrap as N}from"../../../../geometry/support/ray.js";import{Attribute as y}from"./Attribute.js";import{Vec3Compact as P}from"./BufferVectorMath.js";import{ContentObjectType as T}from"./ContentObjectType.js";import{Geometry as S}from"./Geometry.js";import{assert as R}from"./Util.js";import{VertexAttribute as L}from"./VertexAttribute.js";const b=P,d=[[-.5,-.5,.5],[.5,-.5,.5],[.5,.5,.5],[-.5,.5,.5],[-.5,-.5,-.5],[.5,-.5,-.5],[.5,.5,-.5],[-.5,.5,-.5]],j=[0,0,1,-1,0,0,1,0,0,0,-1,0,0,1,0,0,0,-1],U=[0,0,1,0,1,1,0,1],V=[0,1,2,2,3,0,4,0,3,3,7,4,1,5,6,6,2,1,1,0,4,4,5,1,3,2,6,6,7,3,5,4,7,7,6,5],v=new Array(36);for(let At=0;At<6;At++)for(let t=0;t<6;t++)v[6*At+t]=At;const x=new Array(36);for(let At=0;At<6;At++)x[6*At]=0,x[6*At+1]=1,x[6*At+2]=2,x[6*At+3]=2,x[6*At+4]=3,x[6*At+5]=0;function F(t,n){Array.isArray(n)||(n=[n,n,n]);const e=new Array(24);for(let s=0;s<8;s++)e[3*s]=d[s][0]*n[0],e[3*s+1]=d[s][1]*n[1],e[3*s+2]=d[s][2]*n[2];return new S(t,[[L.POSITION,new y(e,3,!0)],[L.NORMAL,new y(j,3)],[L.UV0,new y(U,2)]],[[L.POSITION,V],[L.NORMAL,v],[L.UV0,x]])}const C=[[-.5,0,-.5],[.5,0,-.5],[.5,0,.5],[-.5,0,.5],[0,-.5,0],[0,.5,0]],E=[0,1,-1,1,1,0,0,1,1,-1,1,0,0,-1,-1,1,-1,0,0,-1,1,-1,-1,0],G=[5,1,0,5,2,1,5,3,2,5,0,3,4,0,1,4,1,2,4,2,3,4,3,0],k=[0,0,0,1,1,1,2,2,2,3,3,3,4,4,4,5,5,5,6,6,6,7,7,7];function q(t,n){Array.isArray(n)||(n=[n,n,n]);const e=new Array(18);for(let s=0;s<6;s++)e[3*s]=C[s][0]*n[0],e[3*s+1]=C[s][1]*n[1],e[3*s+2]=C[s][2]*n[2];return new S(t,[[L.POSITION,new y(e,3,!0)],[L.NORMAL,new y(E,3)]],[[L.POSITION,G],[L.NORMAL,k]])}const B=c(-.5,0,-.5),z=c(.5,0,-.5),D=c(0,0,.5),X=c(0,.5,0),Z=a(),H=a(),J=a(),K=a(),Q=a();t(Z,B,X),t(H,B,z),n(J,Z,H),e(J,J),t(Z,z,X),t(H,z,D),n(K,Z,H),e(K,K),t(Z,D,X),t(H,D,B),n(Q,Z,H),e(Q,Q);const W=[B,z,D,X],Y=[0,-1,0,J[0],J[1],J[2],K[0],K[1],K[2],Q[0],Q[1],Q[2]],$=[0,1,2,3,1,0,3,2,1,3,0,2],_=[0,0,0,1,1,1,2,2,2,3,3,3];function tt(t,n){Array.isArray(n)||(n=[n,n,n]);const e=new Array(12);for(let s=0;s<4;s++)e[3*s]=W[s][0]*n[0],e[3*s+1]=W[s][1]*n[1],e[3*s+2]=W[s][2]*n[2];return new S(t,[[L.POSITION,new y(e,3,!0)],[L.NORMAL,new y(Y,3)]],[[L.POSITION,$],[L.NORMAL,_]])}function nt(t,n,e,s,o={uv:!0}){const r=-Math.PI,h=2*Math.PI,l=-Math.PI/2,u=Math.PI,c=Math.max(3,Math.floor(e)),a=Math.max(2,Math.floor(s)),p=(c+1)*(a+1),f=i(3*p),O=i(3*p),I=i(2*p),g=[];let M=0;for(let i=0;i<=a;i++){const t=[],e=i/a,s=l+e*u,o=Math.cos(s);for(let l=0;l<=c;l++){const u=l/c,a=r+u*h,p=Math.cos(a)*o,i=Math.sin(s),w=-Math.sin(a)*o;f[3*M]=p*n,f[3*M+1]=i*n,f[3*M+2]=w*n,O[3*M]=p,O[3*M+1]=i,O[3*M+2]=w,I[2*M]=u,I[2*M+1]=e,t.push(M),++M}g.push(t)}const A=new Array;for(let i=0;i<a;i++)for(let t=0;t<c;t++){const n=g[i][t],e=g[i][t+1],s=g[i+1][t+1],o=g[i+1][t];0===i?(A.push(n),A.push(s),A.push(o)):i===a-1?(A.push(n),A.push(e),A.push(s)):(A.push(n),A.push(e),A.push(s),A.push(s),A.push(o),A.push(n))}const m=[[L.POSITION,A],[L.NORMAL,A]],N=[[L.POSITION,new y(f,3,!0)],[L.NORMAL,new y(O,3,!0)]];return o.uv&&(N.push([L.UV0,new y(I,2,!0)]),m.push([L.UV0,A])),o.offset&&(m[0][0]=L.OFFSET,N[0][0]=L.OFFSET,m.push([L.POSITION,w(A.length)]),N.push([L.POSITION,new y(Float64Array.from(o.offset),3,!0)])),new S(t,N,m)}function et(t,n,e,s){const{vertexAttributes:o,indices:r}=st(n,e,s);return new S(t,o,r)}function st(t,n,e){const s=t;let o,r;if(e)o=[0,-1,0,1,0,0,0,0,1,-1,0,0,0,0,-1,0,1,0],r=[0,1,2,0,2,3,0,3,4,0,4,1,1,5,2,2,5,3,3,5,4,4,5,1];else{const t=s*(1+Math.sqrt(5))/2;o=[-s,t,0,s,t,0,-s,-t,0,s,-t,0,0,-s,t,0,s,t,0,-s,-t,0,s,-t,t,0,-s,t,0,s,-t,0,-s,-t,0,s],r=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1]}for(let a=0;a<o.length;a+=3)b.scale(o,a,t/b.length(o,a));let h={};function l(n,e){n>e&&([n,e]=[e,n]);const s=n.toString()+"."+e.toString();if(h[s])return h[s];let r=o.length;return o.length+=3,b.add(o,3*n,o,3*e,o,r),b.scale(o,r,t/b.length(o,r)),r/=3,h[s]=r,r}for(let a=0;a<n;a++){const t=r.length,n=new Array(4*t);for(let e=0;e<t;e+=3){const t=r[e],s=r[e+1],o=r[e+2],h=l(t,s),u=l(s,o),c=l(o,t),a=4*e;n[a]=t,n[a+1]=h,n[a+2]=c,n[a+3]=s,n[a+4]=u,n[a+5]=h,n[a+6]=o,n[a+7]=c,n[a+8]=u,n[a+9]=h,n[a+10]=u,n[a+11]=c}r=n,h={}}const u=I(o);for(let a=0;a<u.length;a+=3)b.normalize(u,a);const c=[[L.POSITION,r],[L.NORMAL,r]];return{vertexAttributes:[[L.POSITION,new y(I(o),3,!0)],[L.NORMAL,new y(u,3,!0)]],indices:c}}function ot(t,n,e,s,o,r,h,l,u=null){const c=e?[e[0],e[1],e[2]]:[0,0,0],a=n?[n[0],n[1],n[2]]:[0,0,1];h=h||[0,0];const p=s?[255*s[0],255*s[1],255*s[2],s.length>3?255*s[3]:255]:[255,255,255,255],f=null!=o&&2===o.length?o:[1,1],O=[[L.POSITION,new y(c,3,!0)],[L.NORMAL,new y(a,3,!0)],[L.UV0,new y(h,h.length)],[L.COLOR,new y(p,4,!0)],[L.SIZE,new y(f,2)]];if(null!=r){const t=[r[0],r[1],r[2],r[3]];O.push([L.AUXPOS1,new y(t,4)])}if(null!=l){const t=[l[0],l[1],l[2],l[3]];O.push([L.FEATUREATTRIBUTE,new y(t,4)])}return new S(t,O,null,null,T.Point,u)}const rt=[[-1,-1,0],[1,-1,0],[1,1,0],[-1,1,0]];function ht(t,n=rt){const e=new Array(12);for(let a=0;a<4;a++)for(let t=0;t<3;t++)e[3*a+t]=n[a][t];const s=[0,1,2,2,3,0],o=[0,0,1],r=[0,0,0,0,0,0],h=[0,0,1,0,1,1,0,1],l=[255,255,255,255],u=[[L.POSITION,s],[L.NORMAL,r],[L.UV0,s],[L.COLOR,r]],c=[[L.POSITION,new y(e,3,!0)],[L.NORMAL,new y(o,3,!0)],[L.UV0,new y(h,2,!0)],[L.COLOR,new y(l,4,!0)]];return new S(t,c,u)}function lt(t,n,e,s,o,r=!0,h=!0){let l=0;const u=e,a=n;let p=c(0,l,0),f=c(0,l+a,0),O=c(0,-1,0),I=c(0,1,0);o&&(l=a,f=c(0,0,0),p=c(0,l,0),O=c(0,1,0),I=c(0,-1,0));const w=[f,p],g=[O,I],M=s+2,A=Math.sqrt(a*a+u*u);if(o)for(let i=s-1;i>=0;i--){const t=i*(2*Math.PI/s),n=c(Math.cos(t)*u,l,Math.sin(t)*u);w.push(n);const e=c(a*Math.cos(t)/A,-u/A,a*Math.sin(t)/A);g.push(e)}else for(let i=0;i<s;i++){const t=i*(2*Math.PI/s),n=c(Math.cos(t)*u,l,Math.sin(t)*u);w.push(n);const e=c(a*Math.cos(t)/A,u/A,a*Math.sin(t)/A);g.push(e)}const m=new Array,N=new Array;if(r){for(let t=3;t<w.length;t++)m.push(1),m.push(t-1),m.push(t),N.push(0),N.push(0),N.push(0);m.push(w.length-1),m.push(2),m.push(1),N.push(0),N.push(0),N.push(0)}if(h){for(let t=3;t<w.length;t++)m.push(t),m.push(t-1),m.push(0),N.push(t),N.push(t-1),N.push(1);m.push(0),m.push(2),m.push(w.length-1),N.push(1),N.push(2),N.push(g.length-1)}const P=i(3*M);for(let c=0;c<M;c++)P[3*c]=w[c][0],P[3*c+1]=w[c][1],P[3*c+2]=w[c][2];const T=i(3*M);for(let c=0;c<M;c++)T[3*c]=g[c][0],T[3*c+1]=g[c][1],T[3*c+2]=g[c][2];const R=[[L.POSITION,m],[L.NORMAL,N]],b=[[L.POSITION,new y(P,3,!0)],[L.NORMAL,new y(T,3,!0)]];return new S(t,b,R)}function ut(t,l,u,f,O,I,w){const g=O?p(O):c(1,0,0),M=I?p(I):c(0,0,0);w??=!0;const A=a();e(A,g);const m=a();s(m,A,Math.abs(l));const N=a();s(N,m,-.5),o(N,N,M);const P=c(0,1,0);Math.abs(1-r(A,P))<.2&&h(P,0,0,1);const T=a();n(T,A,P),e(T,T),n(P,T,A);const R=2*f+(w?2:0),b=f+(w?2:0),d=i(3*R),j=i(3*b),U=i(2*R),V=new Array(3*f*(w?4:2)),v=new Array(3*f*(w?4:2));w&&(d[3*(R-2)]=N[0],d[3*(R-2)+1]=N[1],d[3*(R-2)+2]=N[2],U[2*(R-2)]=0,U[2*(R-2)+1]=0,d[3*(R-1)]=d[3*(R-2)]+m[0],d[3*(R-1)+1]=d[3*(R-2)+1]+m[1],d[3*(R-1)+2]=d[3*(R-2)+2]+m[2],U[2*(R-1)]=1,U[2*(R-1)+1]=1,j[3*(b-2)]=-A[0],j[3*(b-2)+1]=-A[1],j[3*(b-2)+2]=-A[2],j[3*(b-1)]=A[0],j[3*(b-1)+1]=A[1],j[3*(b-1)+2]=A[2]);const x=(t,n,e)=>{V[t]=n,v[t]=e};let F=0;const C=a(),E=a();for(let n=0;n<f;n++){const t=n*(2*Math.PI/f);s(C,P,Math.sin(t)),s(E,T,Math.cos(t)),o(C,C,E),j[3*n]=C[0],j[3*n+1]=C[1],j[3*n+2]=C[2],s(C,C,u),o(C,C,N),d[3*n]=C[0],d[3*n+1]=C[1],d[3*n+2]=C[2],U[2*n]=n/f,U[2*n+1]=0,d[3*(n+f)]=d[3*n]+m[0],d[3*(n+f)+1]=d[3*n+1]+m[1],d[3*(n+f)+2]=d[3*n+2]+m[2],U[2*(n+f)]=n/f,U[2*n+1]=1;const e=(n+1)%f;x(F++,n,n),x(F++,n+f,n),x(F++,e,e),x(F++,e,e),x(F++,n+f,n),x(F++,e+f,e)}if(w){for(let t=0;t<f;t++){const n=(t+1)%f;x(F++,R-2,b-2),x(F++,t,b-2),x(F++,n,b-2)}for(let t=0;t<f;t++){const n=(t+1)%f;x(F++,t+f,b-1),x(F++,R-1,b-1),x(F++,n+f,b-1)}}const G=[[L.POSITION,V],[L.NORMAL,v],[L.UV0,V]],k=[[L.POSITION,new y(d,3,!0)],[L.NORMAL,new y(j,3,!0)],[L.UV0,new y(U,2,!0)]];return new S(t,k,G)}function ct(t,n,e,s,o,r){s=s||10,o=null==o||o,R(n.length>1);const h=[[0,0,0]],l=[],u=[];for(let c=0;c<s;c++){l.push([0,-c-1,-(c+1)%s-1]);const t=c/s*2*Math.PI;u.push([Math.cos(t)*e,Math.sin(t)*e])}return at(t,u,n,h,l,o,r)}function at(r,u,p,O,I,w,g=c(0,0,0)){const P=u.length,T=i(p.length*P*3+(6*O.length||0)),R=i(p.length*P*3+(O?6:0)),b=new Array,d=new Array;let j=0,U=0;const V=a(),v=a(),x=a(),F=a(),C=a(),E=a(),G=a(),k=f(),q=a(),B=a(),z=a(),D=a(),X=a(),Z=M();h(q,0,1,0),t(v,p[1],p[0]),e(v,v),w?(o(k,p[0],g),e(x,k)):h(x,0,0,1),wt(v,x,q,q,C,x,gt),l(F,x),l(D,C);for(let t=0;t<O.length;t++)s(E,C,O[t][0]),s(k,x,O[t][2]),o(E,E,k),o(E,E,p[0]),T[j++]=E[0],T[j++]=E[1],T[j++]=E[2];R[U++]=-v[0],R[U++]=-v[1],R[U++]=-v[2];for(let t=0;t<I.length;t++)b.push(I[t][0]>0?I[t][0]:-I[t][0]-1+O.length),b.push(I[t][1]>0?I[t][1]:-I[t][1]-1+O.length),b.push(I[t][2]>0?I[t][2]:-I[t][2]-1+O.length),d.push(0),d.push(0),d.push(0);let H=O.length;const J=O.length-1;for(let h=0;h<p.length;h++){let r=!1;if(h>0){l(V,v),h<p.length-1?(t(v,p[h+1],p[h]),e(v,v)):r=!0,o(B,V,v),e(B,B),o(z,p[h-1],F),A(p[h],B,Z);m(Z,N(z,V),k)?(t(k,k,p[h]),e(x,k),n(C,B,x),e(C,C)):wt(B,F,D,q,C,x,gt),l(F,x),l(D,C)}w&&(o(k,p[h],g),e(X,k));for(let t=0;t<P;t++)if(s(E,C,u[t][0]),s(k,x,u[t][1]),o(E,E,k),e(G,E),R[U++]=G[0],R[U++]=G[1],R[U++]=G[2],o(E,E,p[h]),T[j++]=E[0],T[j++]=E[1],T[j++]=E[2],!r){const n=(t+1)%P;b.push(H+t),b.push(H+P+t),b.push(H+n),b.push(H+n),b.push(H+P+t),b.push(H+P+n);for(let t=0;t<6;t++){const n=b.length-6;d.push(b[n+t]-J)}}H+=P}const K=p.at(-1);for(let t=0;t<O.length;t++)s(E,C,O[t][0]),s(k,x,O[t][1]),o(E,E,k),o(E,E,K),T[j++]=E[0],T[j++]=E[1],T[j++]=E[2];const Q=U/3;R[U++]=v[0],R[U++]=v[1],R[U++]=v[2];const W=H-P;for(let t=0;t<I.length;t++)b.push(I[t][0]>=0?H+I[t][0]:-I[t][0]-1+W),b.push(I[t][2]>=0?H+I[t][2]:-I[t][2]-1+W),b.push(I[t][1]>=0?H+I[t][1]:-I[t][1]-1+W),d.push(Q),d.push(Q),d.push(Q);const Y=[[L.POSITION,b],[L.NORMAL,d]],$=[[L.POSITION,new y(T,3,!0)],[L.NORMAL,new y(R,3,!0)]];return new S(r,$,Y)}function pt(t,n,e,s){R(n.length>1,"createPolylineGeometry(): polyline needs at least 2 points"),R(3===n[0].length,"createPolylineGeometry(): malformed vertex"),R(null==e||e.length===n.length,"createPolylineGeometry: need same number of points and normals"),R(null==e||3===e[0].length,"createPolylineGeometry(): malformed normal");const o=O(3*n.length),r=new Array(2*(n.length-1));let h=0,l=0;for(let a=0;a<n.length;a++){for(let t=0;t<3;t++)o[h++]=n[a][t];a>0&&(r[l++]=a-1,r[l++]=a)}const u=[],c=[];if(u.push([L.POSITION,r]),c.push([L.POSITION,new y(o,3,!0)]),e){const t=i(3*e.length);let s=0;for(let o=0;o<n.length;o++)for(let n=0;n<3;n++)t[s++]=e[o][n];u.push([L.NORMAL,r]),c.push([L.NORMAL,new y(t,3,!0)])}return s&&(c.push([L.COLOR,new y(s,4)]),u.push([L.COLOR,g(s.length/4)])),new S(t,c,u,null,T.Line)}function ft(t,n,e,s,o,r=0){const h=new Array(18),l=[[-e,r,o/2],[s,r,o/2],[0,n+r,o/2],[-e,r,-o/2],[s,r,-o/2],[0,n+r,-o/2]],u=[0,1,2,3,0,2,2,5,3,1,4,5,5,2,1,1,0,3,3,4,1,4,3,5];for(let c=0;c<6;c++)h[3*c]=l[c][0],h[3*c+1]=l[c][1],h[3*c+2]=l[c][2];return new S(t,[[L.POSITION,new y(h,3,!0)]],[[L.POSITION,u]])}function Ot(t,n){const e=t.getMutableAttribute(L.POSITION).data;for(let s=0;s<e.length;s+=3){const t=e[s],o=e[s+1],r=e[s+2];h(Mt,t,o,r),u(Mt,Mt,n),e[s]=Mt[0],e[s+1]=Mt[1],e[s+2]=Mt[2]}}function it(t,n=t){const e=t.vertexAttributes,s=e.get(L.POSITION).data,o=e.get(L.NORMAL).data;if(o){const t=n.getMutableAttribute(L.NORMAL).data;for(let n=0;n<o.length;n+=3){const e=o[n+1];t[n+1]=-o[n+2],t[n+2]=e}}if(s){const t=n.getMutableAttribute(L.POSITION).data;for(let n=0;n<s.length;n+=3){const e=s[n+1];t[n+1]=-s[n+2],t[n+2]=e}}}function It(t,s,o,h,l){return!(Math.abs(r(s,t))>l)&&(n(o,t,s),e(o,o),n(h,o,t),e(h,h),!0)}function wt(t,n,e,s,o,r,h){return It(t,n,o,r,h)||It(t,e,o,r,h)||It(t,s,o,r,h)}const gt=.99619469809,Mt=a();export{it as cgToGIS,F as createBoxGeometry,lt as createConeGeometry,ut as createCylinderGeometry,q as createDiamondGeometry,ft as createExtrudedTriangle,at as createPathExtrusionGeometry,ot as createPointGeometry,st as createPolySphereData,et as createPolySphereGeometry,pt as createPolylineGeometry,nt as createSphereGeometry,ht as createSquareGeometry,tt as createTetrahedronGeometry,ct as createTubeGeometry,wt as makeOrthoBasisDirUpFallback,Ot as transformInPlace};
5
+ import{b as t,f as n,n as e,g as s,a as o,e as r,s as h,c as l,m as u}from"../../../../chunks/vec3.js";import{f as c,b as a,a as p}from"../../../../chunks/vec3f32.js";import{c as f}from"../../../../chunks/vec3f64.js";import{newDoubleArray as O}from"../../../../geometry/support/DoubleArray.js";import{newFloatArray as i,floatArrayFrom as I}from"../../../../geometry/support/FloatArray.js";import{getZeroIndexArray as w,getContinuousIndexArray as g}from"../../../../geometry/support/Indices.js";import{create as M,fromPositionAndNormal as A,intersectRay as m}from"../../../../geometry/support/plane.js";import{wrap as N}from"../../../../geometry/support/ray.js";import{Attribute as y}from"./Attribute.js";import{Vec3Compact as P}from"./BufferVectorMath.js";import{ContentObjectType as T}from"./ContentObjectType.js";import{Geometry as S}from"./Geometry.js";import{assert as R}from"./Util.js";import{VertexAttribute as L}from"./VertexAttribute.js";const b=P,d=[[-.5,-.5,.5],[.5,-.5,.5],[.5,.5,.5],[-.5,.5,.5],[-.5,-.5,-.5],[.5,-.5,-.5],[.5,.5,-.5],[-.5,.5,-.5]],j=[0,0,1,-1,0,0,1,0,0,0,-1,0,0,1,0,0,0,-1],U=[0,0,1,0,1,1,0,1],V=[0,1,2,2,3,0,4,0,3,3,7,4,1,5,6,6,2,1,1,0,4,4,5,1,3,2,6,6,7,3,5,4,7,7,6,5],v=new Array(36);for(let At=0;At<6;At++)for(let t=0;t<6;t++)v[6*At+t]=At;const x=new Array(36);for(let At=0;At<6;At++)x[6*At]=0,x[6*At+1]=1,x[6*At+2]=2,x[6*At+3]=2,x[6*At+4]=3,x[6*At+5]=0;function F(t,n){Array.isArray(n)||(n=[n,n,n]);const e=new Array(24);for(let s=0;s<8;s++)e[3*s]=d[s][0]*n[0],e[3*s+1]=d[s][1]*n[1],e[3*s+2]=d[s][2]*n[2];return new S(t,[[L.POSITION,new y(e,3,!0)],[L.NORMAL,new y(j,3)],[L.UV0,new y(U,2)]],[[L.POSITION,V],[L.NORMAL,v],[L.UV0,x]])}const C=[[-.5,0,-.5],[.5,0,-.5],[.5,0,.5],[-.5,0,.5],[0,-.5,0],[0,.5,0]],E=[0,1,-1,1,1,0,0,1,1,-1,1,0,0,-1,-1,1,-1,0,0,-1,1,-1,-1,0],G=[5,1,0,5,2,1,5,3,2,5,0,3,4,0,1,4,1,2,4,2,3,4,3,0],k=[0,0,0,1,1,1,2,2,2,3,3,3,4,4,4,5,5,5,6,6,6,7,7,7];function q(t,n){Array.isArray(n)||(n=[n,n,n]);const e=new Array(18);for(let s=0;s<6;s++)e[3*s]=C[s][0]*n[0],e[3*s+1]=C[s][1]*n[1],e[3*s+2]=C[s][2]*n[2];return new S(t,[[L.POSITION,new y(e,3,!0)],[L.NORMAL,new y(E,3)]],[[L.POSITION,G],[L.NORMAL,k]])}const B=c(-.5,0,-.5),z=c(.5,0,-.5),D=c(0,0,.5),X=c(0,.5,0),Z=a(),H=a(),J=a(),K=a(),Q=a();t(Z,B,X),t(H,B,z),n(J,Z,H),e(J,J),t(Z,z,X),t(H,z,D),n(K,Z,H),e(K,K),t(Z,D,X),t(H,D,B),n(Q,Z,H),e(Q,Q);const W=[B,z,D,X],Y=[0,-1,0,J[0],J[1],J[2],K[0],K[1],K[2],Q[0],Q[1],Q[2]],$=[0,1,2,3,1,0,3,2,1,3,0,2],_=[0,0,0,1,1,1,2,2,2,3,3,3];function tt(t,n){Array.isArray(n)||(n=[n,n,n]);const e=new Array(12);for(let s=0;s<4;s++)e[3*s]=W[s][0]*n[0],e[3*s+1]=W[s][1]*n[1],e[3*s+2]=W[s][2]*n[2];return new S(t,[[L.POSITION,new y(e,3,!0)],[L.NORMAL,new y(Y,3)]],[[L.POSITION,$],[L.NORMAL,_]])}function nt(t,n,e,s,o={uv:!0}){const r=-Math.PI,h=2*Math.PI,l=-Math.PI/2,u=Math.PI,c=Math.max(3,Math.floor(e)),a=Math.max(2,Math.floor(s)),p=(c+1)*(a+1),f=i(3*p),O=i(3*p),I=i(2*p),g=[];let M=0;for(let i=0;i<=a;i++){const t=[],e=i/a,s=l+e*u,o=Math.cos(s);for(let l=0;l<=c;l++){const u=l/c,a=r+u*h,p=Math.cos(a)*o,i=Math.sin(s),w=-Math.sin(a)*o;f[3*M]=p*n,f[3*M+1]=i*n,f[3*M+2]=w*n,O[3*M]=p,O[3*M+1]=i,O[3*M+2]=w,I[2*M]=u,I[2*M+1]=e,t.push(M),++M}g.push(t)}const A=new Array;for(let i=0;i<a;i++)for(let t=0;t<c;t++){const n=g[i][t],e=g[i][t+1],s=g[i+1][t+1],o=g[i+1][t];0===i?(A.push(n),A.push(s),A.push(o)):i===a-1?(A.push(n),A.push(e),A.push(s)):(A.push(n),A.push(e),A.push(s),A.push(s),A.push(o),A.push(n))}const m=[[L.POSITION,A],[L.NORMAL,A]],N=[[L.POSITION,new y(f,3,!0)],[L.NORMAL,new y(O,3,!0)]];return o.uv&&(N.push([L.UV0,new y(I,2,!0)]),m.push([L.UV0,A])),o.offset&&(m[0][0]=L.OFFSET,N[0][0]=L.OFFSET,m.push([L.POSITION,w(A.length)]),N.push([L.POSITION,new y(Float64Array.from(o.offset),3,!0)])),new S(t,N,m)}function et(t,n,e,s){const{vertexAttributes:o,indices:r}=st(n,e,s);return new S(t,o,r)}function st(t,n,e){const s=t;let o,r;if(e)o=[0,-1,0,1,0,0,0,0,1,-1,0,0,0,0,-1,0,1,0],r=[0,1,2,0,2,3,0,3,4,0,4,1,1,5,2,2,5,3,3,5,4,4,5,1];else{const t=s*(1+Math.sqrt(5))/2;o=[-s,t,0,s,t,0,-s,-t,0,s,-t,0,0,-s,t,0,s,t,0,-s,-t,0,s,-t,t,0,-s,t,0,s,-t,0,-s,-t,0,s],r=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1]}for(let a=0;a<o.length;a+=3)b.scale(o,a,t/b.length(o,a));let h={};function l(n,e){n>e&&([n,e]=[e,n]);const s=n.toString()+"."+e.toString();if(h[s])return h[s];let r=o.length;return o.length+=3,b.add(o,3*n,o,3*e,o,r),b.scale(o,r,t/b.length(o,r)),r/=3,h[s]=r,r}for(let a=0;a<n;a++){const t=r.length,n=new Array(4*t);for(let e=0;e<t;e+=3){const t=r[e],s=r[e+1],o=r[e+2],h=l(t,s),u=l(s,o),c=l(o,t),a=4*e;n[a]=t,n[a+1]=h,n[a+2]=c,n[a+3]=s,n[a+4]=u,n[a+5]=h,n[a+6]=o,n[a+7]=c,n[a+8]=u,n[a+9]=h,n[a+10]=u,n[a+11]=c}r=n,h={}}const u=I(o);for(let a=0;a<u.length;a+=3)b.normalize(u,a);const c=[[L.POSITION,r],[L.NORMAL,r]];return{vertexAttributes:[[L.POSITION,new y(I(o),3,!0)],[L.NORMAL,new y(u,3,!0)]],indices:c}}function ot(t,n,e,s,o,r,h,l,u=null){const c=e?[e[0],e[1],e[2]]:[0,0,0],a=n?[n[0],n[1],n[2]]:[0,0,1];h=h||[0,0];const p=s?[255*s[0],255*s[1],255*s[2],s.length>3?255*s[3]:255]:[255,255,255,255],f=null!=o&&2===o.length?o:[1,1],O=[[L.POSITION,new y(c,3,!0)],[L.NORMAL,new y(a,3,!0)],[L.UV0,new y(h,h.length)],[L.COLOR,new y(p,4,!0)],[L.SIZE,new y(f,2)]];if(null!=r){const t=[r[0],r[1],r[2],r[3]];O.push([L.AUXPOS1,new y(t,4)])}if(null!=l){const t=[l[0],l[1],l[2],l[3]];O.push([L.FEATUREATTRIBUTE,new y(t,4)])}return new S(t,O,null,null,T.Point,u)}const rt=[[-1,-1,0],[1,-1,0],[1,1,0],[-1,1,0]];function ht(t,n=rt){const e=new Array(12);for(let a=0;a<4;a++)for(let t=0;t<3;t++)e[3*a+t]=n[a][t];const s=[0,1,2,2,3,0],o=[0,0,1],r=[0,0,0,0,0,0],h=[0,0,1,0,1,1,0,1],l=[255,255,255,255],u=[[L.POSITION,s],[L.NORMAL,r],[L.UV0,s],[L.COLOR,r]],c=[[L.POSITION,new y(e,3,!0)],[L.NORMAL,new y(o,3,!0)],[L.UV0,new y(h,2,!0)],[L.COLOR,new y(l,4,!0)]];return new S(t,c,u)}function lt(t,n,e,s,o,r=!0,h=!0){let l=0;const u=e,a=n;let p=c(0,l,0),f=c(0,l+a,0),O=c(0,-1,0),I=c(0,1,0);o&&(l=a,f=c(0,0,0),p=c(0,l,0),O=c(0,1,0),I=c(0,-1,0));const w=[f,p],g=[O,I],M=s+2,A=Math.sqrt(a*a+u*u);if(o)for(let i=s-1;i>=0;i--){const t=i*(2*Math.PI/s),n=c(Math.cos(t)*u,l,Math.sin(t)*u);w.push(n);const e=c(a*Math.cos(t)/A,-u/A,a*Math.sin(t)/A);g.push(e)}else for(let i=0;i<s;i++){const t=i*(2*Math.PI/s),n=c(Math.cos(t)*u,l,Math.sin(t)*u);w.push(n);const e=c(a*Math.cos(t)/A,u/A,a*Math.sin(t)/A);g.push(e)}const m=new Array,N=new Array;if(r){for(let t=3;t<w.length;t++)m.push(1),m.push(t-1),m.push(t),N.push(0),N.push(0),N.push(0);m.push(w.length-1),m.push(2),m.push(1),N.push(0),N.push(0),N.push(0)}if(h){for(let t=3;t<w.length;t++)m.push(t),m.push(t-1),m.push(0),N.push(t),N.push(t-1),N.push(1);m.push(0),m.push(2),m.push(w.length-1),N.push(1),N.push(2),N.push(g.length-1)}const P=i(3*M);for(let c=0;c<M;c++)P[3*c]=w[c][0],P[3*c+1]=w[c][1],P[3*c+2]=w[c][2];const T=i(3*M);for(let c=0;c<M;c++)T[3*c]=g[c][0],T[3*c+1]=g[c][1],T[3*c+2]=g[c][2];const R=[[L.POSITION,m],[L.NORMAL,N]],b=[[L.POSITION,new y(P,3,!0)],[L.NORMAL,new y(T,3,!0)]];return new S(t,b,R)}function ut(t,l,u,f,O,I,w){const g=O?p(O):c(1,0,0),M=I?p(I):c(0,0,0);w??=!0;const A=a();e(A,g);const m=a();s(m,A,Math.abs(l));const N=a();s(N,m,-.5),o(N,N,M);const P=c(0,1,0);Math.abs(1-r(A,P))<.2&&h(P,0,0,1);const T=a();n(T,A,P),e(T,T),n(P,T,A);const R=2*f+(w?2:0),b=f+(w?2:0),d=i(3*R),j=i(3*b),U=i(2*R),V=new Array(3*f*(w?4:2)),v=new Array(3*f*(w?4:2));w&&(d[3*(R-2)]=N[0],d[3*(R-2)+1]=N[1],d[3*(R-2)+2]=N[2],U[2*(R-2)]=0,U[2*(R-2)+1]=0,d[3*(R-1)]=d[3*(R-2)]+m[0],d[3*(R-1)+1]=d[3*(R-2)+1]+m[1],d[3*(R-1)+2]=d[3*(R-2)+2]+m[2],U[2*(R-1)]=1,U[2*(R-1)+1]=1,j[3*(b-2)]=-A[0],j[3*(b-2)+1]=-A[1],j[3*(b-2)+2]=-A[2],j[3*(b-1)]=A[0],j[3*(b-1)+1]=A[1],j[3*(b-1)+2]=A[2]);const x=(t,n,e)=>{V[t]=n,v[t]=e};let F=0;const C=a(),E=a();for(let n=0;n<f;n++){const t=n*(2*Math.PI/f);s(C,P,Math.sin(t)),s(E,T,Math.cos(t)),o(C,C,E),j[3*n]=C[0],j[3*n+1]=C[1],j[3*n+2]=C[2],s(C,C,u),o(C,C,N),d[3*n]=C[0],d[3*n+1]=C[1],d[3*n+2]=C[2],U[2*n]=n/f,U[2*n+1]=0,d[3*(n+f)]=d[3*n]+m[0],d[3*(n+f)+1]=d[3*n+1]+m[1],d[3*(n+f)+2]=d[3*n+2]+m[2],U[2*(n+f)]=n/f,U[2*n+1]=1;const e=(n+1)%f;x(F++,n,n),x(F++,n+f,n),x(F++,e,e),x(F++,e,e),x(F++,n+f,n),x(F++,e+f,e)}if(w){for(let t=0;t<f;t++){const n=(t+1)%f;x(F++,R-2,b-2),x(F++,t,b-2),x(F++,n,b-2)}for(let t=0;t<f;t++){const n=(t+1)%f;x(F++,t+f,b-1),x(F++,R-1,b-1),x(F++,n+f,b-1)}}const G=[[L.POSITION,V],[L.NORMAL,v],[L.UV0,V]],k=[[L.POSITION,new y(d,3,!0)],[L.NORMAL,new y(j,3,!0)],[L.UV0,new y(U,2,!0)]];return new S(t,k,G)}function ct(t,n,e,s,o,r){s=s||10,o=null==o||o,R(n.length>1);const h=[[0,0,0]],l=[],u=[];for(let c=0;c<s;c++){l.push([0,-c-1,-(c+1)%s-1]);const t=c/s*2*Math.PI;u.push([Math.cos(t)*e,Math.sin(t)*e])}return at(t,u,n,h,l,o,r)}function at(r,u,p,O,I,w,g=c(0,0,0)){const P=u.length,T=i(p.length*P*3+(6*O.length||0)),R=i(p.length*P*3+(O?6:0)),b=new Array,d=new Array;let j=0,U=0;const V=a(),v=a(),x=a(),F=a(),C=a(),E=a(),G=a(),k=f(),q=a(),B=a(),z=a(),D=a(),X=a(),Z=M();h(q,0,1,0),t(v,p[1],p[0]),e(v,v),w?(o(k,p[0],g),e(x,k)):h(x,0,0,1),wt(v,x,q,q,C,x,gt),l(F,x),l(D,C);for(let t=0;t<O.length;t++)s(E,C,O[t][0]),s(k,x,O[t][2]),o(E,E,k),o(E,E,p[0]),T[j++]=E[0],T[j++]=E[1],T[j++]=E[2];R[U++]=-v[0],R[U++]=-v[1],R[U++]=-v[2];for(let t=0;t<I.length;t++)b.push(I[t][0]>0?I[t][0]:-I[t][0]-1+O.length),b.push(I[t][1]>0?I[t][1]:-I[t][1]-1+O.length),b.push(I[t][2]>0?I[t][2]:-I[t][2]-1+O.length),d.push(0),d.push(0),d.push(0);let H=O.length;const J=O.length-1;for(let h=0;h<p.length;h++){let r=!1;if(h>0){l(V,v),h<p.length-1?(t(v,p[h+1],p[h]),e(v,v)):r=!0,o(B,V,v),e(B,B),o(z,p[h-1],F),A(p[h],B,Z);m(Z,N(z,V),k)?(t(k,k,p[h]),e(x,k),n(C,B,x),e(C,C)):wt(B,F,D,q,C,x,gt),l(F,x),l(D,C)}w&&(o(k,p[h],g),e(X,k));for(let t=0;t<P;t++)if(s(E,C,u[t][0]),s(k,x,u[t][1]),o(E,E,k),e(G,E),R[U++]=G[0],R[U++]=G[1],R[U++]=G[2],o(E,E,p[h]),T[j++]=E[0],T[j++]=E[1],T[j++]=E[2],!r){const n=(t+1)%P;b.push(H+t),b.push(H+P+t),b.push(H+n),b.push(H+n),b.push(H+P+t),b.push(H+P+n);for(let t=0;t<6;t++){const n=b.length-6;d.push(b[n+t]-J)}}H+=P}const K=p[p.length-1];for(let t=0;t<O.length;t++)s(E,C,O[t][0]),s(k,x,O[t][1]),o(E,E,k),o(E,E,K),T[j++]=E[0],T[j++]=E[1],T[j++]=E[2];const Q=U/3;R[U++]=v[0],R[U++]=v[1],R[U++]=v[2];const W=H-P;for(let t=0;t<I.length;t++)b.push(I[t][0]>=0?H+I[t][0]:-I[t][0]-1+W),b.push(I[t][2]>=0?H+I[t][2]:-I[t][2]-1+W),b.push(I[t][1]>=0?H+I[t][1]:-I[t][1]-1+W),d.push(Q),d.push(Q),d.push(Q);const Y=[[L.POSITION,b],[L.NORMAL,d]],$=[[L.POSITION,new y(T,3,!0)],[L.NORMAL,new y(R,3,!0)]];return new S(r,$,Y)}function pt(t,n,e,s){R(n.length>1,"createPolylineGeometry(): polyline needs at least 2 points"),R(3===n[0].length,"createPolylineGeometry(): malformed vertex"),R(null==e||e.length===n.length,"createPolylineGeometry: need same number of points and normals"),R(null==e||3===e[0].length,"createPolylineGeometry(): malformed normal");const o=O(3*n.length),r=new Array(2*(n.length-1));let h=0,l=0;for(let a=0;a<n.length;a++){for(let t=0;t<3;t++)o[h++]=n[a][t];a>0&&(r[l++]=a-1,r[l++]=a)}const u=[],c=[];if(u.push([L.POSITION,r]),c.push([L.POSITION,new y(o,3,!0)]),e){const t=i(3*e.length);let s=0;for(let o=0;o<n.length;o++)for(let n=0;n<3;n++)t[s++]=e[o][n];u.push([L.NORMAL,r]),c.push([L.NORMAL,new y(t,3,!0)])}return s&&(c.push([L.COLOR,new y(s,4)]),u.push([L.COLOR,g(s.length/4)])),new S(t,c,u,null,T.Line)}function ft(t,n,e,s,o,r=0){const h=new Array(18),l=[[-e,r,o/2],[s,r,o/2],[0,n+r,o/2],[-e,r,-o/2],[s,r,-o/2],[0,n+r,-o/2]],u=[0,1,2,3,0,2,2,5,3,1,4,5,5,2,1,1,0,3,3,4,1,4,3,5];for(let c=0;c<6;c++)h[3*c]=l[c][0],h[3*c+1]=l[c][1],h[3*c+2]=l[c][2];return new S(t,[[L.POSITION,new y(h,3,!0)]],[[L.POSITION,u]])}function Ot(t,n){const e=t.getMutableAttribute(L.POSITION).data;for(let s=0;s<e.length;s+=3){const t=e[s],o=e[s+1],r=e[s+2];h(Mt,t,o,r),u(Mt,Mt,n),e[s]=Mt[0],e[s+1]=Mt[1],e[s+2]=Mt[2]}}function it(t,n=t){const e=t.vertexAttributes,s=e.get(L.POSITION).data,o=e.get(L.NORMAL).data;if(o){const t=n.getMutableAttribute(L.NORMAL).data;for(let n=0;n<o.length;n+=3){const e=o[n+1];t[n+1]=-o[n+2],t[n+2]=e}}if(s){const t=n.getMutableAttribute(L.POSITION).data;for(let n=0;n<s.length;n+=3){const e=s[n+1];t[n+1]=-s[n+2],t[n+2]=e}}}function It(t,s,o,h,l){return!(Math.abs(r(s,t))>l)&&(n(o,t,s),e(o,o),n(h,o,t),e(h,h),!0)}function wt(t,n,e,s,o,r,h){return It(t,n,o,r,h)||It(t,e,o,r,h)||It(t,s,o,r,h)}const gt=.99619469809,Mt=a();export{it as cgToGIS,F as createBoxGeometry,lt as createConeGeometry,ut as createCylinderGeometry,q as createDiamondGeometry,ft as createExtrudedTriangle,at as createPathExtrusionGeometry,ot as createPointGeometry,st as createPolySphereData,et as createPolySphereGeometry,pt as createPolylineGeometry,nt as createSphereGeometry,ht as createSquareGeometry,tt as createTetrahedronGeometry,ct as createTubeGeometry,wt as makeOrthoBasisDirUpFallback,Ot as transformInPlace};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{newFloatArray as t,floatSubArray as e}from"../../../../geometry/support/FloatArray.js";import{newIntArray as i,compactIndices as s}from"../../../../geometry/support/Indices.js";class r{constructor(s,r,o,h,p,n={}){this.path=s,this.profile=r,this.extruder=o,this.startCap=h,this.endCap=p,this.options=n,this._extrusionVertexCount=0;const l=this.path.vertices.length-2;this.numExtrusionProfiles=o.numProfilesPerJoin()*l+2,this.numVerticesTotal=r.vertices.length*this.numExtrusionProfiles,this.startCap.vertexBufferStart=this.numVerticesTotal;const a=this.startCap.numVertices;this.numVerticesTotal+=a,this.endCap.vertexBufferStart=this.numVerticesTotal;const u=this.endCap.numVertices;this.numVerticesTotal+=u,this.pathVertexData=i(1*this.numVerticesTotal),this.profileRightAxes=t(4*this.numVerticesTotal),this.profileUpAxes=t(4*this.numVerticesTotal),this.profileVertexAndNormals=t(4*this.numVerticesTotal),this.positions=e(s.positions,s.offset,3*s.vertices.length),this._rebuildGeometry(),this.buildTopology()}emitVertex(t,e,i,s,r){const o=4*this._extrusionVertexCount;if(this.profileRightAxes[o]=e.right[0],this.profileRightAxes[o+1]=e.right[1],this.profileRightAxes[o+2]=e.right[2],this.profileUpAxes[o]=e.up[0],this.profileUpAxes[o+1]=e.up[1],this.profileUpAxes[o+2]=e.up[2],this.profileVertexAndNormals[o]=i[0],this.profileVertexAndNormals[o+1]=i[1],this.profileVertexAndNormals[o+2]=s[0],this.profileVertexAndNormals[o+3]=s[1],this.pathVertexData[this._extrusionVertexCount]=t,r){const e=this.path.vertices[t],i=e.maxStretchDistance;this.profileRightAxes[o+3]=e.rotationRight[0]*i,this.profileUpAxes[o+3]=e.rotationRight[1]*i}else this.profileRightAxes[o+3]=0,this.profileUpAxes[o+3]=0;++this._extrusionVertexCount}emitCapVertex(t,e,i,s,r,o){const h=4*this._extrusionVertexCount;this.profileRightAxes[h]=e.right[0],this.profileRightAxes[h+1]=e.right[1],this.profileRightAxes[h+2]=e.right[2],this.profileRightAxes[h+3]=r,this.profileUpAxes[h]=e.up[0],this.profileUpAxes[h+1]=e.up[1],this.profileUpAxes[h+2]=e.up[2],this.profileUpAxes[h+3]=o,this.profileVertexAndNormals[h]=i[0],this.profileVertexAndNormals[h+1]=i[1],this.profileVertexAndNormals[h+2]=s[0],this.profileVertexAndNormals[h+3]=s[1],this.pathVertexData[this._extrusionVertexCount]=t,++this._extrusionVertexCount}_rebuildGeometry(){this._extrusionVertexCount=0;const{positions:t,offset:i,vertices:s}=this.path;this.positions=e(t,i,3*s.length);let r=0;const o=(t,e,i,s,o)=>this.emitCapVertex(r,t,e,i,s,o),h=(t,e,i,s)=>this.emitVertex(r,t,e,i,s);for(this.startCap.rebuildConnectingProfileGeometry(s[r],this.profile,o),r=1;r<s.length-1;++r)this.extruder.extrude(s[r],this.profile,h);this.endCap.rebuildConnectingProfileGeometry(s[r],this.profile,o),r=0,this.startCap.rebuildCapGeometry(s[r],o),r=s.length-1,this.endCap.rebuildCapGeometry(s[r],o)}buildTopology(){const t=this.profile.vertices.length,e=this.profile.numSegments,i=this.numExtrusionProfiles-1;let r=3*(2*(e*i));this.startCap.indexBufferStart=r,this.startCap.firstProfileVertexIndex=0,r+=this.startCap.numIndices,this.endCap.indexBufferStart=r,this.endCap.firstProfileVertexIndex=t*(this.numExtrusionProfiles-1);const o=new Array,h=new Array,p=new Array,n=(t,e,i)=>{o.push(t),o.push(e),o.push(i),h.push(t),h.push(e),h.push(i),p.push(this.pathVertexData[t]),p.push(this.pathVertexData[e]),p.push(this.pathVertexData[i])};for(let s=0;s<e;++s){const e=this.profile.indices[2*s],r=this.profile.indices[2*s+1];for(let s=0;s<i;++s){const i=s*t+e,o=(s+1)*t+r,h=s*t+r;n(i,(s+1)*t+e,o),n(i,o,h)}}this.startCap.buildTopology(this.path.vertices[0],n),this.endCap.buildTopology(this.path.vertices.at(-1),n),this.vertexIndices=s(o),this.normalIndices=s(h),this.pathVertexIndices=s(p)}onPathChanged(){this._rebuildGeometry()}}export{r as PathBuilder};
5
+ import{newFloatArray as t,floatSubArray as e}from"../../../../geometry/support/FloatArray.js";import{newIntArray as i,compactIndices as s}from"../../../../geometry/support/Indices.js";class r{constructor(s,r,h,o,p,n={}){this.path=s,this.profile=r,this.extruder=h,this.startCap=o,this.endCap=p,this.options=n,this._extrusionVertexCount=0;const l=this.path.vertices.length-2;this.numExtrusionProfiles=h.numProfilesPerJoin()*l+2,this.numVerticesTotal=r.vertices.length*this.numExtrusionProfiles,this.startCap.vertexBufferStart=this.numVerticesTotal;const a=this.startCap.numVertices;this.numVerticesTotal+=a,this.endCap.vertexBufferStart=this.numVerticesTotal;const u=this.endCap.numVertices;this.numVerticesTotal+=u,this.pathVertexData=i(1*this.numVerticesTotal),this.profileRightAxes=t(4*this.numVerticesTotal),this.profileUpAxes=t(4*this.numVerticesTotal),this.profileVertexAndNormals=t(4*this.numVerticesTotal),this.positions=e(s.positions,s.offset,3*s.vertices.length),this._rebuildGeometry(),this.buildTopology()}emitVertex(t,e,i,s,r){const h=4*this._extrusionVertexCount;if(this.profileRightAxes[h]=e.right[0],this.profileRightAxes[h+1]=e.right[1],this.profileRightAxes[h+2]=e.right[2],this.profileUpAxes[h]=e.up[0],this.profileUpAxes[h+1]=e.up[1],this.profileUpAxes[h+2]=e.up[2],this.profileVertexAndNormals[h]=i[0],this.profileVertexAndNormals[h+1]=i[1],this.profileVertexAndNormals[h+2]=s[0],this.profileVertexAndNormals[h+3]=s[1],this.pathVertexData[this._extrusionVertexCount]=t,r){const e=this.path.vertices[t],i=e.maxStretchDistance;this.profileRightAxes[h+3]=e.rotationRight[0]*i,this.profileUpAxes[h+3]=e.rotationRight[1]*i}else this.profileRightAxes[h+3]=0,this.profileUpAxes[h+3]=0;++this._extrusionVertexCount}emitCapVertex(t,e,i,s,r,h){const o=4*this._extrusionVertexCount;this.profileRightAxes[o]=e.right[0],this.profileRightAxes[o+1]=e.right[1],this.profileRightAxes[o+2]=e.right[2],this.profileRightAxes[o+3]=r,this.profileUpAxes[o]=e.up[0],this.profileUpAxes[o+1]=e.up[1],this.profileUpAxes[o+2]=e.up[2],this.profileUpAxes[o+3]=h,this.profileVertexAndNormals[o]=i[0],this.profileVertexAndNormals[o+1]=i[1],this.profileVertexAndNormals[o+2]=s[0],this.profileVertexAndNormals[o+3]=s[1],this.pathVertexData[this._extrusionVertexCount]=t,++this._extrusionVertexCount}_rebuildGeometry(){this._extrusionVertexCount=0;const{positions:t,offset:i,vertices:s}=this.path;this.positions=e(t,i,3*s.length);let r=0;const h=(t,e,i,s,h)=>this.emitCapVertex(r,t,e,i,s,h),o=(t,e,i,s)=>this.emitVertex(r,t,e,i,s);for(this.startCap.rebuildConnectingProfileGeometry(s[r],this.profile,h),r=1;r<s.length-1;++r)this.extruder.extrude(s[r],this.profile,o);this.endCap.rebuildConnectingProfileGeometry(s[r],this.profile,h),r=0,this.startCap.rebuildCapGeometry(s[r],h),r=s.length-1,this.endCap.rebuildCapGeometry(s[r],h)}buildTopology(){const t=this.profile.vertices.length,e=this.profile.numSegments,i=this.numExtrusionProfiles-1;let r=3*(2*(e*i));this.startCap.indexBufferStart=r,this.startCap.firstProfileVertexIndex=0,r+=this.startCap.numIndices,this.endCap.indexBufferStart=r,this.endCap.firstProfileVertexIndex=t*(this.numExtrusionProfiles-1);const h=new Array,o=new Array,p=new Array,n=(t,e,i)=>{h.push(t),h.push(e),h.push(i),o.push(t),o.push(e),o.push(i),p.push(this.pathVertexData[t]),p.push(this.pathVertexData[e]),p.push(this.pathVertexData[i])};for(let s=0;s<e;++s){const e=this.profile.indices[2*s],r=this.profile.indices[2*s+1];for(let s=0;s<i;++s){const i=s*t+e,h=(s+1)*t+r,o=s*t+r;n(i,(s+1)*t+e,h),n(i,h,o)}}this.startCap.buildTopology(this.path.vertices[0],n),this.endCap.buildTopology(this.path.vertices[this.path.vertices.length-1],n),this.vertexIndices=s(h),this.normalIndices=s(o),this.pathVertexIndices=s(p)}onPathChanged(){this._rebuildGeometry()}}export{r as PathBuilder};