@arcgis/core 5.0.0-next.73 → 5.0.0-next.75

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 (304) hide show
  1. package/Color.d.ts +8 -0
  2. package/WebDocument2D.d.ts +5 -30
  3. package/analysis/ElevationProfile/ElevationProfileLineQuery.d.ts +1 -1
  4. package/assets/esri/core/workers/RemoteClient.js +1 -1
  5. package/assets/esri/core/workers/chunks/0b666327e8090a6e6f6a.js +1 -0
  6. package/assets/esri/core/workers/chunks/16a7edb381621085a631.js +1 -0
  7. package/assets/esri/core/workers/chunks/{e246b256347a281c13fd.js → 22288b62da20a7a78a4f.js} +1 -1
  8. package/assets/esri/core/workers/chunks/{7e37a3005f2ad2c0a918.js → 23cf4cbc389d2b50e968.js} +1 -1
  9. package/assets/esri/core/workers/chunks/4750f55a289bc0cf3d77.js +1 -0
  10. package/assets/esri/core/workers/chunks/{935a6dccb88557f98189.js → 76b516b8c110ad983bf6.js} +8 -6
  11. package/assets/esri/core/workers/chunks/a5181292b309b8249bd8.js +1 -0
  12. package/assets/esri/core/workers/chunks/ae733ee050f27f7d8924.js +1 -0
  13. package/assets/esri/core/workers/chunks/{64985e9b6e2edb3ceb37.js → b498db9715a722c52995.js} +45 -58
  14. package/assets/esri/core/workers/chunks/befeca51530bba5e8073.js +1 -0
  15. package/assets/esri/core/workers/chunks/cd788ed111e1e35cf9c8.js +1 -0
  16. package/assets/esri/core/workers/chunks/f35021214e534d5e0446.js +1 -0
  17. package/assets/esri/themes/base/widgets/_FeatureTable.scss +99 -22
  18. package/assets/esri/themes/dark/main.css +1 -1
  19. package/assets/esri/themes/light/main.css +1 -1
  20. package/assets/esri/themes/light/view.css +1 -1
  21. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable.json +1 -1
  22. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_ar.json +1 -1
  23. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_bg.json +1 -1
  24. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_bs.json +1 -1
  25. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_ca.json +1 -1
  26. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_cs.json +1 -1
  27. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_da.json +1 -1
  28. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_de.json +1 -1
  29. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_el.json +1 -1
  30. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_en.json +1 -1
  31. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_es.json +1 -1
  32. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_et.json +1 -1
  33. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_fi.json +1 -1
  34. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_fr.json +1 -1
  35. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_he.json +1 -1
  36. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_hr.json +1 -1
  37. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_hu.json +1 -1
  38. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_id.json +1 -1
  39. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_it.json +1 -1
  40. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_ja.json +1 -1
  41. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_ko.json +1 -1
  42. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_lt.json +1 -1
  43. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_lv.json +1 -1
  44. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_nl.json +1 -1
  45. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_no.json +1 -1
  46. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_pl.json +1 -1
  47. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_pt-BR.json +1 -1
  48. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_pt-PT.json +1 -1
  49. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_ro.json +1 -1
  50. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_ru.json +1 -1
  51. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_sk.json +1 -1
  52. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_sl.json +1 -1
  53. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_sr.json +1 -1
  54. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_sv.json +1 -1
  55. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_th.json +1 -1
  56. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_tr.json +1 -1
  57. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_uk.json +1 -1
  58. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_vi.json +1 -1
  59. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_zh-CN.json +1 -1
  60. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_zh-HK.json +1 -1
  61. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_zh-TW.json +1 -1
  62. package/chunks/ComponentShader.glsl.js +1 -1
  63. package/chunks/GlowBlur.glsl.js +2 -3
  64. package/chunks/HUDMaterial.glsl.js +43 -56
  65. package/config.d.ts +6 -8
  66. package/config.js +1 -1
  67. package/core/Collection.d.ts +27 -1
  68. package/core/types.d.ts +0 -23
  69. package/core/urlUtils.d.ts +10 -0
  70. package/geometry/support/MeshTexture.d.ts +0 -2
  71. package/geometry/support/MeshVertexAttributes.d.ts +0 -2
  72. package/identity/IdentityManagerBase.d.ts +3 -6
  73. package/interfaces.d.ts +3 -3
  74. package/kernel.js +1 -1
  75. package/layers/BaseDynamicLayer.d.ts +1 -4
  76. package/layers/BaseElevationLayer.d.ts +3 -6
  77. package/layers/BuildingSceneLayer.d.ts +1 -4
  78. package/layers/CSVLayer.d.ts +1 -4
  79. package/layers/CatalogLayer.d.ts +1 -4
  80. package/layers/DimensionLayer.d.ts +1 -4
  81. package/layers/ElevationLayer.d.ts +3 -6
  82. package/layers/FeatureLayer.d.ts +1 -4
  83. package/layers/GaussianSplatLayer.d.ts +0 -1
  84. package/layers/GeoJSONLayer.d.ts +1 -4
  85. package/layers/GeoRSSLayer.d.ts +1 -4
  86. package/layers/GraphicsLayer.d.ts +1 -4
  87. package/layers/GroupLayer.d.ts +1 -4
  88. package/layers/ImageryLayer.d.ts +1 -4
  89. package/layers/ImageryTileLayer.d.ts +1 -4
  90. package/layers/IntegratedMesh3DTilesLayer.d.ts +1 -4
  91. package/layers/IntegratedMeshLayer.d.ts +1 -4
  92. package/layers/KMLLayer.d.ts +1 -4
  93. package/layers/Layer.d.ts +2 -6
  94. package/layers/LineOfSightLayer.d.ts +1 -4
  95. package/layers/MapImageLayer.d.ts +1 -4
  96. package/layers/MapNotesLayer.d.ts +1 -4
  97. package/layers/MediaLayer.d.ts +1 -4
  98. package/layers/OGCFeatureLayer.d.ts +1 -4
  99. package/layers/OrientedImageryLayer.d.ts +1 -4
  100. package/layers/ParquetLayer.d.ts +1 -4
  101. package/layers/PointCloudLayer.d.ts +1 -4
  102. package/layers/RouteLayer.d.ts +2 -5
  103. package/layers/SceneLayer.d.ts +1 -4
  104. package/layers/SubtypeGroupLayer.d.ts +1 -12
  105. package/layers/TileLayer.d.ts +1 -4
  106. package/layers/UnknownLayer.d.ts +1 -4
  107. package/layers/UnsupportedLayer.d.ts +1 -4
  108. package/layers/VectorTileLayer.d.ts +1 -4
  109. package/layers/VideoLayer.d.ts +1 -4
  110. package/layers/ViewshedLayer.d.ts +1 -4
  111. package/layers/VoxelLayer.d.ts +1 -4
  112. package/layers/WCSLayer.d.ts +1 -4
  113. package/layers/WFSLayer.d.ts +1 -4
  114. package/layers/WMSLayer.d.ts +1 -4
  115. package/layers/WMTSLayer.d.ts +1 -4
  116. package/layers/catalog/CatalogDynamicGroupLayer.d.ts +1 -4
  117. package/layers/catalog/CatalogFootprintLayer.d.ts +1 -4
  118. package/layers/knowledgeGraph/KnowledgeGraphSublayer.d.ts +1 -6
  119. package/layers/mixins/EditBusLayer.d.ts +0 -1
  120. package/layers/mixins/PublishableLayer.d.ts +15 -0
  121. package/layers/support/FeatureFilter.d.ts +0 -1
  122. package/layers/support/MosaicRule.d.ts +0 -4
  123. package/layers/support/PublishingInfo.d.ts +1 -1
  124. package/layers/support/types.d.ts +2 -2
  125. package/layers/types.d.ts +19 -6
  126. package/package.json +1 -1
  127. package/portal/PortalUser.d.ts +1 -1
  128. package/renderers/support/RendererLegendOptions.d.ts +0 -1
  129. package/request/types.d.ts +0 -1
  130. package/rest/support/NormalizationBinParametersMixin.d.ts +18 -20
  131. package/rest/support/PrintTemplate.d.ts +0 -1
  132. package/rest/support/RelationshipQuery.d.ts +1 -10
  133. package/rest/support/types.d.ts +29 -3
  134. package/smartMapping/heuristics/binLevel.d.ts +1 -1
  135. package/smartMapping/heuristics/scaleRange.d.ts +1 -1
  136. package/smartMapping/heuristics/sizeRange.d.ts +1 -1
  137. package/smartMapping/heuristics/types.d.ts +0 -2
  138. package/smartMapping/labels/bins.d.ts +1 -1
  139. package/smartMapping/labels/clusters.d.ts +1 -1
  140. package/smartMapping/popup/clusters.d.ts +1 -1
  141. package/smartMapping/popup/templates.d.ts +1 -1
  142. package/smartMapping/raster/renderers/classBreaks.d.ts +1 -1
  143. package/smartMapping/raster/renderers/colormap.d.ts +1 -1
  144. package/smartMapping/raster/renderers/flow.d.ts +0 -1
  145. package/smartMapping/raster/renderers/rgb.d.ts +1 -1
  146. package/smartMapping/raster/renderers/shadedRelief.d.ts +0 -1
  147. package/smartMapping/raster/renderers/stretch.d.ts +1 -1
  148. package/smartMapping/raster/renderers/uniqueValue.d.ts +0 -1
  149. package/smartMapping/raster/renderers/vectorField.d.ts +0 -1
  150. package/smartMapping/raster/support/utils.d.ts +0 -2
  151. package/smartMapping/renderers/color.d.ts +6 -6
  152. package/smartMapping/renderers/dotDensity.d.ts +0 -1
  153. package/smartMapping/renderers/heatmap.d.ts +1 -1
  154. package/smartMapping/renderers/location.d.ts +0 -1
  155. package/smartMapping/renderers/opacity.d.ts +1 -1
  156. package/smartMapping/renderers/pieChart.d.ts +0 -2
  157. package/smartMapping/renderers/predominance.d.ts +0 -1
  158. package/smartMapping/renderers/relationship.d.ts +0 -1
  159. package/smartMapping/renderers/size.d.ts +4 -6
  160. package/smartMapping/renderers/type.d.ts +9 -5
  161. package/smartMapping/renderers/univariateColorSize.d.ts +2 -2
  162. package/smartMapping/statistics/classBreaks.d.ts +1 -1
  163. package/smartMapping/statistics/heatmapStatistics.d.ts +1 -1
  164. package/smartMapping/statistics/histogram.d.ts +1 -1
  165. package/smartMapping/statistics/predominantCategories.d.ts +1 -1
  166. package/smartMapping/statistics/summaryStatistics.d.ts +1 -1
  167. package/smartMapping/statistics/summaryStatisticsForAge.d.ts +1 -1
  168. package/smartMapping/statistics/support/ageUtils.d.ts +1 -1
  169. package/smartMapping/statistics/types.d.ts +26 -8
  170. package/smartMapping/statistics/uniqueValues.d.ts +1 -1
  171. package/smartMapping/symbology/color.d.ts +4 -4
  172. package/smartMapping/symbology/dotDensity.d.ts +3 -3
  173. package/smartMapping/symbology/flow.d.ts +3 -3
  174. package/smartMapping/symbology/heatmap.d.ts +3 -3
  175. package/smartMapping/symbology/location.d.ts +1 -1
  176. package/smartMapping/symbology/pieChart.d.ts +3 -3
  177. package/smartMapping/symbology/predominance.d.ts +3 -3
  178. package/smartMapping/symbology/relationship.d.ts +3 -3
  179. package/smartMapping/symbology/size.d.ts +1 -1
  180. package/smartMapping/symbology/support/colorRamps.d.ts +1 -1
  181. package/smartMapping/symbology/type.d.ts +3 -3
  182. package/support/revision.js +1 -1
  183. package/symbols/cim/types.d.ts +0 -12
  184. package/symbols/support/symbolUtils.d.ts +1 -1
  185. package/views/2d/MapViewConstraints.d.ts +2 -10
  186. package/views/2d/engine/brushes.js +1 -1
  187. package/views/2d/engine/vectorTiles/GlyphMosaic.js +1 -1
  188. package/views/2d/engine/vectorTiles/MemoryBuffer.js +1 -1
  189. package/views/2d/engine/vectorTiles/RenderBucket.js +1 -1
  190. package/views/2d/engine/vectorTiles/SpriteMosaic.js +1 -1
  191. package/views/2d/engine/vectorTiles/VTLPainter3D.js +1 -1
  192. package/views/2d/engine/vectorTiles/VectorTileContainer.js +1 -1
  193. package/views/2d/engine/vectorTiles/VertexMemoryBuffer.js +1 -1
  194. package/views/2d/engine/vectorTiles/shaders/VTLBackgroundMaterial.js +1 -1
  195. package/views/2d/engine/vectorTiles/shaders/VTLCircleMaterial.js +1 -1
  196. package/views/2d/engine/vectorTiles/shaders/VTLFillMaterial.js +1 -1
  197. package/views/2d/engine/vectorTiles/shaders/VTLLineMaterial.js +1 -1
  198. package/views/2d/engine/vectorTiles/shaders/VTLMaterial.js +1 -1
  199. package/views/2d/engine/vectorTiles/shaders/VTLSymbolMaterial.js +1 -1
  200. package/views/2d/engine/vectorTiles/style/StyleLayer.js +1 -1
  201. package/views/2d/engine/webgl/Painter.js +1 -1
  202. package/views/2d/engine/webgl/RenderingDevice.js +5 -0
  203. package/views/2d/engine/webgl/WGLContainer.js +1 -1
  204. package/views/2d/engine/webgl/meshing/Mesh.js +1 -1
  205. package/views/2d/engine/webgl/number.js +1 -1
  206. package/views/2d/engine/webgl/shaderGraph/graph/glsl.js +1 -1
  207. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/vector-tiles/VTLShaderBackground.js +5 -0
  208. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/vector-tiles/VTLShaderCircle.js +5 -0
  209. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/vector-tiles/VTLShaderFill.js +5 -0
  210. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/vector-tiles/VTLShaderIcon.js +5 -0
  211. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/vector-tiles/VTLShaderLine.js +5 -0
  212. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/vector-tiles/VTLShaderOutline.js +5 -0
  213. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/vector-tiles/VTLShaderText.js +5 -0
  214. package/views/2d/engine/webgl/shaderGraph/techniques/vectorTiles/VTLTechniqueBackground.js +5 -0
  215. package/views/2d/engine/webgl/shaderGraph/techniques/vectorTiles/VTLTechniqueCircle.js +5 -0
  216. package/views/2d/engine/webgl/shaderGraph/techniques/vectorTiles/VTLTechniqueFill.js +5 -0
  217. package/views/2d/engine/webgl/shaderGraph/techniques/vectorTiles/VTLTechniqueLine.js +5 -0
  218. package/views/2d/engine/webgl/shaderGraph/techniques/vectorTiles/VTLTechniqueSymbol.js +5 -0
  219. package/views/2d/engine/webgl/shaderGraph/techniques/vectorTiles/VTLTechniques.js +5 -0
  220. package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
  221. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  222. package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
  223. package/views/3d/layers/graphics/Graphics3DTextSymbolLayer.js +1 -1
  224. package/views/3d/layers/i3s/meshUtils.js +1 -1
  225. package/views/3d/state/NearFarHeuristic.js +1 -1
  226. package/views/3d/webgl-engine/collections/Component/ComponentObjectCollection.js +1 -1
  227. package/views/3d/webgl-engine/collections/Component/Material/ComponentData.glsl.js +1 -1
  228. package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
  229. package/views/3d/webgl-engine/collections/Component/Material/ComponentTechniqueConfiguration.js +1 -1
  230. package/views/3d/webgl-engine/core/shaderLibrary/attributes/VertexNormal.glsl.js +6 -4
  231. package/views/3d/webgl-engine/core/shaderLibrary/attributes/VertexPosition.glsl.js +18 -14
  232. package/views/3d/webgl-engine/effects/glow/GlowBlur.glsl.js +1 -1
  233. package/views/3d/webgl-engine/effects/glow/GlowRenderNode.js +1 -1
  234. package/views/3d/webgl-engine/lib/edgeRendering/EdgeShaderTechniqueConfiguration.js +1 -1
  235. package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
  236. package/views/3d/webgl-engine/shaders/HUDMaterial.glsl.js +1 -1
  237. package/views/3d/webgl-engine/shaders/HUDMaterialTechniqueConfiguration.js +1 -1
  238. package/views/3d/webgl-engine/shaders/sources/edgeRenderer/EdgeUtil.glsl.js +23 -20
  239. package/views/BreakpointsOwner.d.ts +2 -2
  240. package/views/LinkChartView.d.ts +0 -2
  241. package/views/View2D.d.ts +3 -15
  242. package/views/input/types.d.ts +2 -13
  243. package/views/layers/BuildingComponentSublayerView.d.ts +0 -1
  244. package/views/types.d.ts +2 -9
  245. package/views/webgl/RenderingContext.js +1 -1
  246. package/views/webgl/VertexArrayObject.js +1 -1
  247. package/views/webgl/renderState.js +1 -1
  248. package/webdoc/ips/SmoothingProperties.d.ts +1 -1
  249. package/webdoc/ips/SmoothingProperties.js +1 -1
  250. package/widgets/BasemapLayerList/BasemapLayerListVisibleElements.d.ts +10 -10
  251. package/widgets/BasemapLayerList/types.d.ts +6 -1
  252. package/widgets/Bookmarks/BookmarksVisibleElements.d.ts +0 -9
  253. package/widgets/Bookmarks/types.d.ts +0 -4
  254. package/widgets/CatalogLayerList/CatalogLayerListVisibleElements.d.ts +2 -2
  255. package/widgets/CatalogLayerList/types.d.ts +5 -1
  256. package/widgets/Editor/VisibleElements.d.ts +0 -11
  257. package/widgets/ElevationProfile/types.d.ts +1 -1
  258. package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
  259. package/widgets/FeatureTable/FieldColumn.d.ts +0 -1
  260. package/widgets/FeatureTable/VisibleElements.d.ts +2 -16
  261. package/widgets/FeatureTable/support/AttachmentsViewOptions.d.ts +5 -3
  262. package/widgets/FeatureTable/support/AttachmentsViewOptions.js +1 -1
  263. package/widgets/FeatureTable/support/FeatureStore.js +1 -1
  264. package/widgets/FeatureTable.js +1 -1
  265. package/widgets/Features/FeaturesViewModel.d.ts +3 -27
  266. package/widgets/Features/FeaturesVisibleElements.d.ts +4 -4
  267. package/widgets/LayerList/LayerListViewModel.d.ts +20 -5
  268. package/widgets/LayerList/LayerListVisibleElements.d.ts +10 -12
  269. package/widgets/LayerList/ListItem.d.ts +33 -0
  270. package/widgets/LayerList/ListItemPanel.d.ts +8 -2
  271. package/widgets/LayerList/types.d.ts +58 -15
  272. package/widgets/Legend/support/ActiveLayerInfo.js +1 -1
  273. package/widgets/Popup/PopupVisibleElements.d.ts +6 -6
  274. package/widgets/Popup/types.d.ts +1 -1
  275. package/widgets/ScaleRangeSlider/ScaleRanges.d.ts +1 -1
  276. package/widgets/Sketch/CreateToolVisibilityMap.d.ts +0 -4
  277. package/widgets/Sketch/VisibleElements.d.ts +0 -2
  278. package/widgets/Sketch/types.d.ts +1 -1
  279. package/widgets/TableList/ListItemPanel.d.ts +8 -0
  280. package/widgets/TableList/TableListViewModel.d.ts +9 -14
  281. package/widgets/TableList/TableListVisibleElements.d.ts +9 -11
  282. package/widgets/TableList/types.d.ts +13 -7
  283. package/widgets/support/SnappingControls/VisibleElements.d.ts +0 -4
  284. package/widgets/types.d.ts +1 -9
  285. package/assets/esri/core/workers/chunks/1d8fc0239c907ff5d1e8.js +0 -1
  286. package/assets/esri/core/workers/chunks/562cddaf63985e53ee6e.js +0 -1
  287. package/assets/esri/core/workers/chunks/b899b4e7979c13b99526.js +0 -1
  288. package/assets/esri/core/workers/chunks/d0ae8752419d5b761190.js +0 -1
  289. package/assets/esri/core/workers/chunks/df2ba5f9d57080fca183.js +0 -1
  290. package/assets/esri/core/workers/chunks/ee175fd4ec706f7878c0.js +0 -1
  291. package/assets/esri/core/workers/chunks/fc00d7278b43df813c54.js +0 -1
  292. package/layers/mixins/ScaleRange.d.ts +0 -16
  293. package/views/2d/engine/vectorTiles/shaders/Programs.js +0 -5
  294. package/views/2d/engine/vectorTiles/shaders/VTLMaterialManager.js +0 -5
  295. package/views/2d/engine/vectorTiles/shaders/sources/resolver.js +0 -5
  296. package/views/2d/engine/vectorTiles/shaders/sources/shaderRepository.js +0 -5
  297. package/views/2d/engine/vtlBrushes.js +0 -5
  298. package/views/2d/engine/webgl/brushes/WGLBrushVTLBackground.js +0 -5
  299. package/views/2d/engine/webgl/brushes/WGLBrushVTLCircle.js +0 -5
  300. package/views/2d/engine/webgl/brushes/WGLBrushVTLFill.js +0 -5
  301. package/views/2d/engine/webgl/brushes/WGLBrushVTLLine.js +0 -5
  302. package/views/2d/engine/webgl/brushes/WGLBrushVTLSymbol.js +0 -5
  303. package/views/3d/webgl-engine/effects/glow/GlowPresets.glsl.js +0 -5
  304. package/widgets/FeatureTable/support/FeatureStore.d.ts +0 -1
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{result as e,createTask as t}from"../../../../core/asyncUtils.js";import r from"../../../../core/Error.js";import{clone as i}from"../../../../core/lang.js";import{abortMaybe as s,releaseMaybe as a}from"../../../../core/maybe.js";import{throwIfAbortError as o,throwIfAborted as n}from"../../../../core/promiseUtils.js";import{pt2px as l,px2pt as c}from"../../../../core/screenUtils.js";import{numericHash as h}from"../../../../core/string.js";import{dataComponents as u}from"../../../../core/urlUtils.js";import{fromValues as m,create as d}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{fromValues as p,create as _}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as f,ZEROS as y,fromValues as g}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{projectPointToVector as x}from"../../../../geometry/projection/projectPointToVector.js";import{containsPoint as b}from"../../../../geometry/support/aaBoundingBox.js";import v from"../../../../layers/support/FieldsIndex.js";import{createRendererExpression as S}from"../../../../support/ArcadeExpression.js";import{CIMSymbolHelper as P}from"../../../../symbols/cim/CIMSymbolHelper.js";import{evaluateValueOrFunction as w}from"../../../../symbols/cim/utils.js";import{scaleCIMSymbol as z}from"../../../../symbols/support/cimSymbolUtils.js";import{defaultIconPrimitive as C}from"../../../../symbols/support/primitives.js";import R from"../../../../symbols/support/Symbol3DAnchorPosition2D.js";import{getIconHref as M}from"../../../../symbols/support/utils.js";import{transparentUnit as I}from"./constants.js";import{perObjectElevationAligner as O}from"./ElevationAligners.js";import{elevationModeChangeUpdateType as j,needsElevationUpdates2D as T}from"./elevationAlignmentUtils.js";import{focusAreaHUDColor as F}from"./focusAreaStyle.js";import{Graphics3DDrapedGraphicLayer as E}from"./Graphics3DDrapedGraphicLayer.js";import{Graphics3DObject3DGraphicLayer as U}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as D}from"./Graphics3DSymbolLayer.js";import{validateSymbolLayerSize as V}from"./graphicUtils.js";import{namedAnchorToHUDMaterialAnchorPos as G}from"./placementUtils.js";import{placePointOnGeometry as L,updateStageObjectGeometry as A,getLocalOriginForPoint as H,extendPointGraphicElevationContext as k,createStageObject as B}from"./pointUtils.js";import{initFastSymbolUpdatesState as $,updateFastSymbolUpdatesState as q,evaluateModelTransformScale as N,ConvertOptions as J}from"../support/FastSymbolUpdates.js";import{createTexture as Z,requiresHalfTexelOffset as W,defaultBoundingBox as K,defaultSymbolSizeRatio as Q,defaultTexSize as X}from"../../support/engineContent/sdfPrimitives.js";import{drapedZ as Y}from"../../terrain/OverlayRenderer.js";import{VerticalOffsetParameters as ee}from"../../webgl-engine/core/shaderLibrary/attributes/VerticalOffset.glsl.js";import{createPointGeometry as te}from"../../webgl-engine/lib/GeometryUtil.js";import{ManagedTexture as re}from"../../webgl-engine/lib/ManagedTexture.js";import{RenderGeometry as ie}from"../../webgl-engine/lib/RenderGeometry.js";import{HUDMaterial as se}from"../../webgl-engine/materials/HUDMaterial.js";const ae=p(0,0,1),oe=16,ne=1.5,le=[X*Q,X*Q];class ce extends D{static{this.PRIMITIVE_SIZE=le}getCachedSize(){return{size:this._getIconSize()}}static{this.elevationModeChangeTypes={definedChanged:1,staysOnTheGround:0,onTheGroundChanged:2}}constructor(e,t,r,i){super(e,t,r,i,fe(t)),this._cimData=null,this._overrideHelperClass=null,this._arcadeInfo=null,this._cimSymbolMaterials=new Map,this._cimSymbolTextures=new Map,this._cimMaterialParametersInfo=null,this._cimScaleFactorOrFunction=null,this._size=null,this._symbolTextureRatio=1,this._outlineSize=0,this._textureHandle=null,this._patchTask=null,this._elevationOptions={supportsOffsetAdjustment:!0,supportsOnTheGround:!0}}async doLoad(e){this._validateOrThrow();const t=this._prepareMaterialParameters(),r=this._getPrimitive();if(null!=r)this._prepareResourcesPrimitive(t,r);else{const r=M(this.symbolLayer),i=me(r);null!=i?await this._prepareResourcesCIM(t,JSON.parse(i),e):await this._prepareResourcesHref(t,r,e)}}_validateOrThrow(){if(this._drivenProperties.size)return;const e=V(this._getIconSize());if(e)throw new r("graphics3diconsymbollayer:invalid-size",e)}_getIconSize(){const e=this.symbolLayer,t=Math.round(null!=e.size?l(e.size):oe);return this._drivenProperties.size?Math.max(t,64):t}_generateTextureCIM(e,t){const r=this._overrideHelperClass;let s=this._cimData;if(r&&s&&s.symbol||this.logger.error("Can't create texture, CIM data is undefined"),s.primitiveOverrides){s=i(s);const a=s.primitiveOverrides;r.evaluateOverrides(a,e,this._arcadeInfo.geometryType,null,null,t.layer.fieldsIndex),r.applyOverrides(s.symbol,a)}const a=h(JSON.stringify(s));let o=this._cimSymbolTextures.get(a);if(o)return o;const n=this._context.sharedResources.cimSymbolRasterizer,l=this._context.renderer&&"dictionary"===this._context.renderer.type?this._context.renderer.fieldMap:null;l&&r.applyDictionaryTextOverrides(s.symbol,e,l,null);const c=null!=this._cimScaleFactorOrFunction?w(this._cimScaleFactorOrFunction,e):1;1!==c&&s.symbol&&z(s.symbol,c,!0);const u=P.getEnvelope(s,null,n.resourceManager);if(u?.width&&u.height){const e=u.x+u.width/2,t=u.y+u.height/2,r=n.rasterize({type:"cim",data:s},u.width,u.height,e,t,1,"esriGeometryPoint",0,null,this._context.graphicsCoreOwner.view.state.rasterPixelRatio),i=new R({x:-u.x/u.width-.5,y:(u.height+u.y)/u.height-.5});this._cimMaterialParametersInfo.anchorPosition=de("relative",i),o=new re(r,{width:r?.width??1,height:r?.height??1,reloadable:!0})}else o=new re(new ImageData(1,1),{width:1,height:1,reloadable:!0});return this._cimSymbolTextures.set(a,o),this._context.stage.addTexture(o),o}_prepareMaterialParameters(){const e={anchorPosition:de(this.symbolLayer.anchor,this.symbolLayer.anchorPosition),rotation:this.symbolLayer.angle},t=this.symbol;he(t)&&(e.verticalOffset=new ee(t.verticalOffset)),this._context.screenSizePerspectiveEnabled&&(e.screenSizePerspective=this.view.screenSizePerspective.parameters),(0!==e.rotation||this._drivenProperties.rotation)&&(e.hasRotation=!0);const r=this.symbolLayer.occludedVisibility?.mode??"hidden",i=this.view.basemapTerrain,s=!i.opaque&&!i.invisible;return e.useVisibilityPixel=s&&"hidden"===r,e.occludedVisibilityMode=this.symbolLayer.occludedVisibility?.mode??"hidden",e.occludedFragmentFade=!1,e.horizonCullingEnabled=this._context.spherical,e.hasSlicePlane=this._context.slicePlaneEnabled,e}_prepareResourcesPrimitive(e,t){const r=this._getOutlineSize();if(ue(t)&&0===r)throw new Error("Nothing to render");if(this._outlineSize=r,e.color=this._getFillColor(),e.outlineColor=this._getOutlineColor(),e.outlineSize=this._outlineSize,null!=this._context.sharedResources.textures){const r=this._context.sharedResources.textures.fromData(`${t}-icon`,()=>Z(t));this._textureHandle=r,e.textureId=r.managedTexture.id}e.textureIsSignedDistanceField=!0,e.sampleSignedDistanceFieldTexelCenter=W(t),e.distanceFieldBoundingBox=K;const i=this._getIconSize();this._size=[i,i],this._symbolTextureRatio=1/Q,this._createMaterial(e)}async _prepareResourcesHref(t,i,s){this._outlineSize=this._getOutlineSize(),t.color=this._getFillColor(),t.outlineColor=this._getOutlineColor(),t.outlineSize=this._outlineSize,t.textureIsSignedDistanceField=!1;const a=this._getIconSize(),n=a*this._context.graphicsCoreOwner.view.state.rasterPixelRatio;if(null!=this._context.sharedResources.textures){const l=await e(this._context.sharedResources.textures.fromUrl(i,n,{signal:s}));if(!1===l.ok){o(l.error);throw new r("graphics3diconsymbollayer:request-failed",`Failed to load (Request for icon resource failed: ${i})`)}this._textureHandle=l.value;const c=l.value.managedTexture;this._size=pe(c,a),t.textureId=c.id}this._createMaterial(t)}async _prepareResourcesCIM(e,t,r){const{OverrideHelper:i}=await import("../../../../symbols/cim/OverrideHelper.js");if(this._overrideHelperClass=i,this._cimData=t,!this._context.sharedResources.cimSymbolRasterizer){const e=(await import("../../../../symbols/cim/CIMSymbolRasterizer.js")).CIMSymbolRasterizer;n(r),this._context.sharedResources.cimSymbolRasterizer??=new e(this._context.renderCoordsHelper.spatialReference)}const s=this._context.sharedResources.cimSymbolRasterizer,a=[],o=t,l=o?.symbol;P.fetchResources(l,s.resourceManager,a,r),P.fetchFonts(l,s.resourceManager,a);const c=this._context.layer.fields?this._context.layer.fields.map(e=>e.toJSON()):[],h=this._context.renderCoordsHelper.spatialReference;if(this._arcadeInfo={spatialReference:h,fields:c,geometryType:"esriGeometryPoint"},o?.primitiveOverrides&&a.push(i.createRenderExpressions(o.primitiveOverrides,this._arcadeInfo)),a.length>0&&(await Promise.all(a),n(r)),this._context.renderer&&"dictionary"===this._context.renderer.type&&this._context.renderer.scaleExpression){const e=this._context.renderer;if(e.scaleExpression){const t=e.scaleExpression,r=await S(t,this._context.layer.spatialReference),{default:i}=await import("../../../2d/arcade/callExpressionWithFeature.js"),s=new v(c);this._cimScaleFactorOrFunction=(e,t,a)=>{const o=i(r,e,{$view:a},"esriGeometryPoint",s,t);return null!==o?o:1}}}n(r),this._cimMaterialParametersInfo=e,this._cimMaterialParametersInfo.color=this._getFillColor(),this._cimMaterialParametersInfo.outlineColor=[0,0,0,0],this._cimMaterialParametersInfo.outlineSize=0,this._cimMaterialParametersInfo.textureIsSignedDistanceField=!1}_getPrimitive(){return _e(this.symbolLayer)}_getOutlineSize(){let e=0;const t=this.symbolLayer;if(null!=t.outline?.size)return Math.max(l(t.outline.size),0);return e=ue(this._getPrimitive())?ne:0,Math.max(e,0)}_getOutlineColor(){const e=this._getLayerOpacity(),t=this.symbolLayer,r=t?.outline?.color;if(null!=r){const t=r.toUnitRGB(),i=r.a*e;return[t[0],t[1],t[2],i]}return[0,0,0,0]}_getFillColor(){if(ue(this._getPrimitive()))return I;const e=null==this._getPrimitive(),t=this._materialColor;return this._getCombinedOpacityAndColor(t,{hasIntrinsicColor:e})}get _materialColor(){return this.symbolLayer.material?.color}get _fastVisualVariableFallbackColor(){const e=this._materialColor;if(null==e){return null==this._getPrimitive()?f:y}return e.toUnitRGBA()}_getFallbackSize(){const e=this._getIconSize(),{symbolLayer:{size:t}}=this;return(null!=t?Math.round(l(t)):oe)/e}_createMaterial(e){const t=this._context.spherical;if(this._cimData){this._fastUpdates=null;let r=e.textureId?this._cimSymbolMaterials.get(e.textureId):null;return r||(r=new se(e,t),this._cimSymbolMaterials.set(e.textureId??0,r)),r}this._fastUpdates=$(this._context.renderer,this._fastVisualVariableConvertOptions()),this._fastUpdates&&(e={...e,...this._fastUpdates.materialParameters}),this._materials[0]=new se(e,t),e.isFocused=!1;const r=this.view.map?.focusAreas.style;return e.color=F(e.color,r),e.outlineColor=F(e.outlineColor,r),this._materials[1]=new se(e,t),this._materials[0]}_setDrapingDependentMaterialParameters(){this.draped&&(this._forEachMaterial(e=>{e.setParameters({verticalOffset:null,screenSizePerspective:null,useVisibilityPixel:!1,hasSlicePlane:!1,shaderPolygonOffset:0,draped:this.draped})}),this.layerOpacityChanged())}destroy(){super.destroy(),this._patchTask=s(this._patchTask),this._materials.length=0,this._cimSymbolMaterials.clear(),this._cimSymbolTextures.forEach(e=>this._context.stage.removeTexture(e)),this._cimSymbolTextures.clear(),this._textureHandle=a(this._textureHandle)}_getScaleFactor({size:e},t){if(!this._drivenProperties.size)return 1;if(null==e)return this._getFallbackSize();const[r,i,s]=e;return"symbol-value"===r?1:"number"==typeof r&&isFinite(r)?l(r)/t:"number"==typeof s&&isFinite(s)?l(s)/t:1}_getDrivenRotation(e){return this._drivenProperties.rotation?e.heading??0:0}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry))return null;const r=L(t.geometry);if(null==r)return this.logger.warn(`unsupported geometry type for text symbol: ${t.geometry.type}`),null;let i,s=[0,0];const a=this.view.focusAreasView?.containsGeometry(r)??!0;if(this._cimData){if(!this._cimData.symbol)return null;const r=this._generateTextureCIM(t,e),o={textureId:r.id,isFocused:a,...this._cimMaterialParametersInfo};i=this._createMaterial(o);const n=this._context.graphicsCoreOwner.view.state.rasterPixelRatio;s=[r.parameters.width/n,r.parameters.height/n]}else s=this._size,i=a?this._materials[0]:this._materials[1];if(null==r)return this.logger.warn(`unsupported geometry type for icon symbol: ${t.geometry.type}`),null;const o=e.renderingInfo,n=this._getDrivenUInt8Color(o,this._materialColor,null==this._getPrimitive()),l=this._getDrivenRotation(o);let c=1;if(!this._fastUpdates?.visualVariables.size){const e=s[0]>s[1]?s[0]:s[1];c=this._getScaleFactor(o,e)}c*=this._symbolTextureRatio;const h=m(s[0]*c,s[1]*c),u=this.createElevationContextForGraphic(t);return this.ensureDrapedStatus("on-the-ground"===u.mode)&&this._setDrapingDependentMaterialParameters(),this.draped?this._createAsOverlay(t,r,i,n,l,h):this._createAs3DShape(t,r,i,n,l,h,u,t.uid)}terrainTransparencyChanged(){return this.draped}layerOpacityChanged(){const e=this._getFillColor(),t=this._getOutlineColor();this._forEachMaterial(r=>{r.setParameters({color:e}),r.setParameters({outlineColor:t})})}layerScreenSizePerspectiveChanged(){const e=this._context.screenSizePerspectiveEnabled&&!this.draped?this.view.screenSizePerspective.parameters:null;this._forEachMaterial(t=>{t.setParameters({screenSizePerspective:e})})}updateGeometry(e,t){const r=e.geometry;if(this.draped||!r||!this._validateGeometry(r))return!1;const{elevationContext:i,stageObject:s}=t;if(i.mode!==this.getGeometryElevationMode(r))return!1;const a=L(r);if(!a)return!1;i.updateFeatureExpressionFeature(e,this._context.layer);const o=A(s,this._context,a,i);if(null==o)return!1;const n=H(this._context,a);return s.geometries[0].localOrigin===n&&(t.alignedSampledElevation=o,k(t,a,this._context.elevationProvider),!0)}layerElevationInfoChanged(e,t,r){const i=this._elevationContext.mode,s=j(ce.elevationModeChangeTypes,r,i);if(1!==s)return s;const a=T(i)||"absolute-height"===i;return this.updateGraphics3DGraphicElevationInfo(e,t,()=>a)}slicePlaneEnabledChanged(){return this.draped||this._forEachMaterial(e=>{e.setParameters({hasSlicePlane:this._context.slicePlaneEnabled})}),!0}physicalBasedRenderingChanged(){return!0}get pixelRatioChanged(){return null!=this._getPrimitive()}applyRendererDiff(e,t){for(const r in e.diff){if("visualVariables"!==r)return 0;if(!q(this._fastUpdates,t,this._fastVisualVariableConvertOptions()))return 0;this._materials[0]?.setParameters(this._fastUpdates.materialParameters)}return 2}get needsUpdateFocus(){return!0}prepareSymbolLayerPatch(e){if(this._patchTask?.abort(),"partial"!==e.diff.type)return;const t=e.diff.diff;this._preparePatchResource(e,t),this._preparePatchRotation(e,t)}_preparePatchResource(i,l){if(!l.resource||"partial"!==l.resource.type)return;const c=l.resource.diff;if("complete"!==c?.href?.type)return;const h=c.href.newValue,{textures:u}=this._context.sharedResources;if(null==h||null==u||null!=me(h))return;const m=this._getIconSize(),d=m*this._context.graphicsCoreOwner.view.state.pixelRatio;i.symbolLayerStatePatches.push(()=>{this._patchTask=s(this._patchTask),this._patchTask=t(t=>this._context.schedule(async(t,i)=>{const s=await e(u.fromUrl(h,d,{signal:i}));n(i);const l=!s.ok;if(l&&o(s.error),this._textureHandle=a(this._textureHandle),this._patchTask=null,l){this._forEachMaterial(e=>{e.visible=!1,e.setParameters({textureId:null})});const e=`Failed to load (Request for icon resource failed: ${h})`;return void this.logger.error(new r("graphics3diconsymbollayer:request-failed",e))}this._textureHandle=s.value;const c=s.value.managedTexture;this._size=pe(c,m),this._forEachMaterial(e=>{e.setParameters({textureId:c.id}),e.visible=!0})},t))}),delete c.href}_preparePatchRotation(e,t){if(!t.angle||"complete"!==t.angle.type)return;const r=t.angle.newValue??0,i=0!==r||this._drivenProperties.rotation;e.symbolLayerStatePatches.push(()=>{this._forEachMaterial(e=>e.setParameters({rotation:r,hasRotation:i}))}),delete t.angle}_defaultElevationInfoNoZ(){return ye}_createAs3DShape(e,t,r,i,s,a,o,n){const l=this.getFastUpdateAttrValues(e),c=this._context.layerViewUid,h=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:n,layerViewUid:c}),u=te(r,{normal:ae,color:i,rotation:s,size:a,centerOffsetAndDistance:ge,featureAttribute:l,olidColor:h}),m=B(this._context,t,u,o,n);if(null==m)return null;const d=new U(this,m.object,null,O,o);return d.hiddenIfDeconflicted=!0,d.alignedSampledElevation=m.sampledElevation,d.needsElevationUpdates=T(o.mode)||"absolute-height"===o.mode,d.getScreenSize=this._createScreenSizeGetter(a,l),d.calculateRelativeScreenBounds=e=>r.calculateRelativeScreenBounds(d.getScreenSize(),1,e),k(d,t,this._context.elevationProvider),d}_createAsOverlay(e,t,r,i,s,a){r.renderPriority=this._renderPriority;const o=_();x(t,o,this._context.overlaySR),o[2]=Y;const n=this._context.clippingExtent;if(null!=n&&!b(n,o))return null;const l=this.getFastUpdateAttrValues(e),c=e.uid,h=this._context.layerViewUid,u=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:c,layerViewUid:h}),m=te(r,{normal:ae,position:o,color:i,rotation:s,size:a,featureAttribute:l,olidColor:u}),d=new ie(m,{layerViewUid:h,graphicUid:c}),p=new E(this,[d],null,this._context.drapeSourceRenderer);return p.getScreenSize=this._createScreenSizeGetter(a,l),p.calculateRelativeScreenBounds=e=>r.calculateRelativeScreenBounds(p.getScreenSize(),1,e),p}_createScreenSizeGetter(e,t){const r=this._outlineSize+2;if(this._fastUpdates&&t){const i=e[0]/this._symbolTextureRatio,s=e[1]/this._symbolTextureRatio;return(e=d())=>{const[a,o]=N(xe,this._fastUpdates.materialParameters,t);return e[0]=a*i+r,e[1]=o*s+r,e}}const i=e[0]/this._symbolTextureRatio+r,s=e[1]/this._symbolTextureRatio+r;return(e=d())=>(e[0]=i,e[1]=s,e)}_fastVisualVariableConvertOptions(){const e=Math.max(this._size[0],this._size[1]),t=p(e,e,e),r=c(1),i=e*r,s=p(i,i,i),a=this._getFallbackSize();return new J({supports:{size:!0,color:!0,rotation:!0,opacity:!1},modelSize:t,symbolSize:s,unitInMeters:r,fallbackColor:this._fastVisualVariableFallbackColor,fallbackSize:p(a,a,a)})}_forEachMaterial(e){this._materials.forEach(e),this._cimSymbolMaterials.forEach(e)}test(){return{...super.test(),material:this._materials[0]}}}function he(e){return e&&"point-3d"===e.type&&e.hasVisibleVerticalOffset()}function ue(e){return null!=e&&("cross"===e||"x"===e)}function me(e){const t=u(e);return"application/json"===t?.mediaType?t.data:void 0}function de(e,t){return"relative"===e?m((t.x||0)+.5,.5-(t.y||0)):e in G?G[e]:G.center}function pe({parameters:e},t){const r=(e.width??1)/(e.height??1);return r>1?[t,Math.round(t/r)]:[Math.round(t*r),t]}function _e(e){return e.resource?.href?null:e.resource?.primitive??C}function fe(e){return 1===(e.material?.color?.a??0)&&null!=_e(e)}const ye={mode:"relative-to-ground",offset:0},ge=g(0,0,0,1),xe=_();export{ce as Graphics3DIconSymbolLayer};
5
+ import{result as e,createTask as t}from"../../../../core/asyncUtils.js";import r from"../../../../core/Error.js";import{clone as i}from"../../../../core/lang.js";import{abortMaybe as s,releaseMaybe as a}from"../../../../core/maybe.js";import{throwIfAbortError as o,throwIfAborted as n}from"../../../../core/promiseUtils.js";import{pt2px as l,px2pt as c}from"../../../../core/screenUtils.js";import{numericHash as h}from"../../../../core/string.js";import{dataComponents as u}from"../../../../core/urlUtils.js";import{fromValues as m,create as d}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{fromValues as p,create as _}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as f,ZEROS as y,fromValues as g}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{projectPointToVector as x}from"../../../../geometry/projection/projectPointToVector.js";import{containsPoint as b}from"../../../../geometry/support/aaBoundingBox.js";import v from"../../../../layers/support/FieldsIndex.js";import{createRendererExpression as S}from"../../../../support/ArcadeExpression.js";import{CIMSymbolHelper as P}from"../../../../symbols/cim/CIMSymbolHelper.js";import{evaluateValueOrFunction as w}from"../../../../symbols/cim/utils.js";import{scaleCIMSymbol as z}from"../../../../symbols/support/cimSymbolUtils.js";import{defaultIconPrimitive as C}from"../../../../symbols/support/primitives.js";import R from"../../../../symbols/support/Symbol3DAnchorPosition2D.js";import{getIconHref as M}from"../../../../symbols/support/utils.js";import{transparentUnit as I}from"./constants.js";import{perObjectElevationAligner as O}from"./ElevationAligners.js";import{elevationModeChangeUpdateType as j,needsElevationUpdates2D as T}from"./elevationAlignmentUtils.js";import{focusAreaHUDColor as F}from"./focusAreaStyle.js";import{Graphics3DDrapedGraphicLayer as E}from"./Graphics3DDrapedGraphicLayer.js";import{Graphics3DObject3DGraphicLayer as U}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as D}from"./Graphics3DSymbolLayer.js";import{validateSymbolLayerSize as V}from"./graphicUtils.js";import{namedAnchorToHUDMaterialAnchorPos as G}from"./placementUtils.js";import{placePointOnGeometry as L,updateStageObjectGeometry as A,getLocalOriginForPoint as H,extendPointGraphicElevationContext as k,createStageObject as B}from"./pointUtils.js";import{initFastSymbolUpdatesState as $,updateFastSymbolUpdatesState as q,evaluateModelTransformScale as N,ConvertOptions as J}from"../support/FastSymbolUpdates.js";import{createTexture as Z,requiresHalfTexelOffset as W,defaultBoundingBox as K,defaultSymbolSizeRatio as Q,defaultTexSize as X}from"../../support/engineContent/sdfPrimitives.js";import{drapedZ as Y}from"../../terrain/OverlayRenderer.js";import{VerticalOffsetParameters as ee}from"../../webgl-engine/core/shaderLibrary/attributes/VerticalOffset.glsl.js";import{createPointGeometry as te}from"../../webgl-engine/lib/GeometryUtil.js";import{ManagedTexture as re}from"../../webgl-engine/lib/ManagedTexture.js";import{RenderGeometry as ie}from"../../webgl-engine/lib/RenderGeometry.js";import{HUDMaterial as se}from"../../webgl-engine/materials/HUDMaterial.js";const ae=p(0,0,1),oe=16,ne=1.5,le=[X*Q,X*Q];class ce extends D{static{this.PRIMITIVE_SIZE=le}getCachedSize(){return{size:this._getIconSize()}}static{this.elevationModeChangeTypes={definedChanged:1,staysOnTheGround:0,onTheGroundChanged:2}}constructor(e,t,r,i){super(e,t,r,i,fe(t)),this._cimData=null,this._overrideHelperClass=null,this._arcadeInfo=null,this._cimSymbolMaterials=new Map,this._cimSymbolTextures=new Map,this._cimMaterialParametersInfo=null,this._cimScaleFactorOrFunction=null,this._size=null,this._symbolTextureRatio=1,this._outlineSize=0,this._textureHandle=null,this._patchTask=null,this._elevationOptions={supportsOffsetAdjustment:!0,supportsOnTheGround:!0}}async doLoad(e){this._validateOrThrow();const t=this._prepareMaterialParameters(),r=this._getPrimitive();if(null!=r)this._prepareResourcesPrimitive(t,r);else{const r=M(this.symbolLayer),i=me(r);null!=i?await this._prepareResourcesCIM(t,JSON.parse(i),e):await this._prepareResourcesHref(t,r,e)}}_validateOrThrow(){if(this._drivenProperties.size)return;const e=V(this._getIconSize());if(e)throw new r("graphics3diconsymbollayer:invalid-size",e)}_getIconSize(){const e=this.symbolLayer,t=Math.round(null!=e.size?l(e.size):oe);return this._drivenProperties.size?Math.max(t,64):t}_generateTextureCIM(e,t){const r=this._overrideHelperClass;let s=this._cimData;if(r&&s&&s.symbol||this.logger.error("Can't create texture, CIM data is undefined"),s.primitiveOverrides){s=i(s);const a=s.primitiveOverrides;r.evaluateOverrides(a,e,this._arcadeInfo.geometryType,null,null,t.layer.fieldsIndex),r.applyOverrides(s.symbol,a)}const a=h(JSON.stringify(s));let o=this._cimSymbolTextures.get(a);if(o)return o;const n=this._context.sharedResources.cimSymbolRasterizer,l=this._context.renderer&&"dictionary"===this._context.renderer.type?this._context.renderer.fieldMap:null;l&&r.applyDictionaryTextOverrides(s.symbol,e,l,null);const c=null!=this._cimScaleFactorOrFunction?w(this._cimScaleFactorOrFunction,e):1;1!==c&&s.symbol&&z(s.symbol,c,!0);const u=P.getEnvelope(s,null,n.resourceManager);if(u?.width&&u.height){const e=u.x+u.width/2,t=u.y+u.height/2,r=n.rasterize({type:"cim",data:s},u.width,u.height,e,t,1,"esriGeometryPoint",0,null,this._context.graphicsCoreOwner.view.state.rasterPixelRatio),i=new R({x:-u.x/u.width-.5,y:(u.height+u.y)/u.height-.5});this._cimMaterialParametersInfo.anchorPosition=de("relative",i),o=new re(r,{width:r?.width??1,height:r?.height??1,reloadable:!0})}else o=new re(new ImageData(1,1),{width:1,height:1,reloadable:!0});return this._cimSymbolTextures.set(a,o),this._context.stage.addTexture(o),o}_prepareMaterialParameters(){const e={anchorPosition:de(this.symbolLayer.anchor,this.symbolLayer.anchorPosition),rotation:this.symbolLayer.angle},t=this.symbol;he(t)&&(e.verticalOffset=new ee(t.verticalOffset)),this._context.screenSizePerspectiveEnabled&&(e.screenSizePerspective=this.view.screenSizePerspective.parameters),(0!==e.rotation||this._drivenProperties.rotation)&&(e.hasRotation=!0);const r=this.symbolLayer.occludedVisibility?.mode??"hidden",i=this.view.basemapTerrain,s=!i.opaque&&!i.invisible;return e.useVisibilityPixel=s&&"hidden"===r,e.occludedVisibilityMode=r,e.occludedFragmentFade=!1,e.hasSlicePlane=this._context.slicePlaneEnabled,e}_prepareResourcesPrimitive(e,t){const r=this._getOutlineSize();if(ue(t)&&0===r)throw new Error("Nothing to render");if(this._outlineSize=r,e.color=this._getFillColor(),e.outlineColor=this._getOutlineColor(),e.outlineSize=this._outlineSize,null!=this._context.sharedResources.textures){const r=this._context.sharedResources.textures.fromData(`${t}-icon`,()=>Z(t));this._textureHandle=r,e.textureId=r.managedTexture.id}e.textureIsSignedDistanceField=!0,e.sampleSignedDistanceFieldTexelCenter=W(t),e.distanceFieldBoundingBox=K;const i=this._getIconSize();this._size=[i,i],this._symbolTextureRatio=1/Q,this._createMaterial(e)}async _prepareResourcesHref(t,i,s){this._outlineSize=this._getOutlineSize(),t.color=this._getFillColor(),t.outlineColor=this._getOutlineColor(),t.outlineSize=this._outlineSize,t.textureIsSignedDistanceField=!1;const a=this._getIconSize(),n=a*this._context.graphicsCoreOwner.view.state.rasterPixelRatio;if(null!=this._context.sharedResources.textures){const l=await e(this._context.sharedResources.textures.fromUrl(i,n,{signal:s}));if(!1===l.ok){o(l.error);throw new r("graphics3diconsymbollayer:request-failed",`Failed to load (Request for icon resource failed: ${i})`)}this._textureHandle=l.value;const c=l.value.managedTexture;this._size=pe(c,a),t.textureId=c.id}this._createMaterial(t)}async _prepareResourcesCIM(e,t,r){const{OverrideHelper:i}=await import("../../../../symbols/cim/OverrideHelper.js");if(this._overrideHelperClass=i,this._cimData=t,!this._context.sharedResources.cimSymbolRasterizer){const e=(await import("../../../../symbols/cim/CIMSymbolRasterizer.js")).CIMSymbolRasterizer;n(r),this._context.sharedResources.cimSymbolRasterizer??=new e(this._context.renderCoordsHelper.spatialReference)}const s=this._context.sharedResources.cimSymbolRasterizer,a=[],o=t,l=o?.symbol;P.fetchResources(l,s.resourceManager,a,r),P.fetchFonts(l,s.resourceManager,a);const c=this._context.layer.fields?this._context.layer.fields.map(e=>e.toJSON()):[],h=this._context.renderCoordsHelper.spatialReference;if(this._arcadeInfo={spatialReference:h,fields:c,geometryType:"esriGeometryPoint"},o?.primitiveOverrides&&a.push(i.createRenderExpressions(o.primitiveOverrides,this._arcadeInfo)),a.length>0&&(await Promise.all(a),n(r)),this._context.renderer&&"dictionary"===this._context.renderer.type&&this._context.renderer.scaleExpression){const e=this._context.renderer;if(e.scaleExpression){const t=e.scaleExpression,r=await S(t,this._context.layer.spatialReference),{default:i}=await import("../../../2d/arcade/callExpressionWithFeature.js"),s=new v(c);this._cimScaleFactorOrFunction=(e,t,a)=>{const o=i(r,e,{$view:a},"esriGeometryPoint",s,t);return null!==o?o:1}}}n(r),this._cimMaterialParametersInfo=e,this._cimMaterialParametersInfo.color=this._getFillColor(),this._cimMaterialParametersInfo.outlineColor=[0,0,0,0],this._cimMaterialParametersInfo.outlineSize=0,this._cimMaterialParametersInfo.textureIsSignedDistanceField=!1}_getPrimitive(){return _e(this.symbolLayer)}_getOutlineSize(){let e=0;const t=this.symbolLayer;if(null!=t.outline?.size)return Math.max(l(t.outline.size),0);return e=ue(this._getPrimitive())?ne:0,Math.max(e,0)}_getOutlineColor(){const e=this._getLayerOpacity(),t=this.symbolLayer,r=t?.outline?.color;if(null!=r){const t=r.toUnitRGB(),i=r.a*e;return[t[0],t[1],t[2],i]}return[0,0,0,0]}_getFillColor(){if(ue(this._getPrimitive()))return I;const e=null==this._getPrimitive(),t=this._materialColor;return this._getCombinedOpacityAndColor(t,{hasIntrinsicColor:e})}get _materialColor(){return this.symbolLayer.material?.color}get _fastVisualVariableFallbackColor(){const e=this._materialColor;if(null==e){return null==this._getPrimitive()?f:y}return e.toUnitRGBA()}_getFallbackSize(){const e=this._getIconSize(),{symbolLayer:{size:t}}=this;return(null!=t?Math.round(l(t)):oe)/e}_createMaterial(e){const t=this._context.spherical;if(this._cimData){this._fastUpdates=null;let r=e.textureId?this._cimSymbolMaterials.get(e.textureId):null;return r||(r=new se(e,t),this._cimSymbolMaterials.set(e.textureId??0,r)),r}this._fastUpdates=$(this._context.renderer,this._fastVisualVariableConvertOptions()),this._fastUpdates&&(e={...e,...this._fastUpdates.materialParameters}),this._materials[0]=new se(e,t),e.isFocused=!1;const r=this.view.map?.focusAreas.style;return e.color=F(e.color,r),e.outlineColor=F(e.outlineColor,r),this._materials[1]=new se(e,t),this._materials[0]}_setDrapingDependentMaterialParameters(){this.draped&&(this._forEachMaterial(e=>{e.setParameters({verticalOffset:null,screenSizePerspective:null,useVisibilityPixel:!1,hasSlicePlane:!1,shaderPolygonOffset:0,draped:this.draped})}),this.layerOpacityChanged())}destroy(){super.destroy(),this._patchTask=s(this._patchTask),this._materials.length=0,this._cimSymbolMaterials.clear(),this._cimSymbolTextures.forEach(e=>this._context.stage.removeTexture(e)),this._cimSymbolTextures.clear(),this._textureHandle=a(this._textureHandle)}_getScaleFactor({size:e},t){if(!this._drivenProperties.size)return 1;if(null==e)return this._getFallbackSize();const[r,i,s]=e;return"symbol-value"===r?1:"number"==typeof r&&isFinite(r)?l(r)/t:"number"==typeof s&&isFinite(s)?l(s)/t:1}_getDrivenRotation(e){return this._drivenProperties.rotation?e.heading??0:0}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry))return null;const r=L(t.geometry);if(null==r)return this.logger.warn(`unsupported geometry type for text symbol: ${t.geometry.type}`),null;let i,s=[0,0];const a=this.view.focusAreasView?.containsGeometry(r)??!0;if(this._cimData){if(!this._cimData.symbol)return null;const r=this._generateTextureCIM(t,e),o={textureId:r.id,isFocused:a,...this._cimMaterialParametersInfo};i=this._createMaterial(o);const n=this._context.graphicsCoreOwner.view.state.rasterPixelRatio;s=[r.parameters.width/n,r.parameters.height/n]}else s=this._size,i=a?this._materials[0]:this._materials[1];if(null==r)return this.logger.warn(`unsupported geometry type for icon symbol: ${t.geometry.type}`),null;const o=e.renderingInfo,n=this._getDrivenUInt8Color(o,this._materialColor,null==this._getPrimitive()),l=this._getDrivenRotation(o);let c=1;if(!this._fastUpdates?.visualVariables.size){const e=s[0]>s[1]?s[0]:s[1];c=this._getScaleFactor(o,e)}c*=this._symbolTextureRatio;const h=m(s[0]*c,s[1]*c),u=this.createElevationContextForGraphic(t);return this.ensureDrapedStatus("on-the-ground"===u.mode)&&this._setDrapingDependentMaterialParameters(),this.draped?this._createAsOverlay(t,r,i,n,l,h):this._createAs3DShape(t,r,i,n,l,h,u,t.uid)}terrainTransparencyChanged(){return this.draped}layerOpacityChanged(){const e=this._getFillColor(),t=this._getOutlineColor();this._forEachMaterial(r=>{r.setParameters({color:e}),r.setParameters({outlineColor:t})})}layerScreenSizePerspectiveChanged(){const e=this._context.screenSizePerspectiveEnabled&&!this.draped?this.view.screenSizePerspective.parameters:null;this._forEachMaterial(t=>{t.setParameters({screenSizePerspective:e})})}updateGeometry(e,t){const r=e.geometry;if(this.draped||!r||!this._validateGeometry(r))return!1;const{elevationContext:i,stageObject:s}=t;if(i.mode!==this.getGeometryElevationMode(r))return!1;const a=L(r);if(!a)return!1;i.updateFeatureExpressionFeature(e,this._context.layer);const o=A(s,this._context,a,i);if(null==o)return!1;const n=H(this._context,a);return s.geometries[0].localOrigin===n&&(t.alignedSampledElevation=o,k(t,a,this._context.elevationProvider),!0)}layerElevationInfoChanged(e,t,r){const i=this._elevationContext.mode,s=j(ce.elevationModeChangeTypes,r,i);if(1!==s)return s;const a=T(i)||"absolute-height"===i;return this.updateGraphics3DGraphicElevationInfo(e,t,()=>a)}slicePlaneEnabledChanged(){return this.draped||this._forEachMaterial(e=>{e.setParameters({hasSlicePlane:this._context.slicePlaneEnabled})}),!0}physicalBasedRenderingChanged(){return!0}get pixelRatioChanged(){return null!=this._getPrimitive()}applyRendererDiff(e,t){for(const r in e.diff){if("visualVariables"!==r)return 0;if(!q(this._fastUpdates,t,this._fastVisualVariableConvertOptions()))return 0;this._materials[0]?.setParameters(this._fastUpdates.materialParameters)}return 2}get needsUpdateFocus(){return!0}prepareSymbolLayerPatch(e){if(this._patchTask?.abort(),"partial"!==e.diff.type)return;const t=e.diff.diff;this._preparePatchResource(e,t),this._preparePatchRotation(e,t)}_preparePatchResource(i,l){if(!l.resource||"partial"!==l.resource.type)return;const c=l.resource.diff;if("complete"!==c?.href?.type)return;const h=c.href.newValue,{textures:u}=this._context.sharedResources;if(null==h||null==u||null!=me(h))return;const m=this._getIconSize(),d=m*this._context.graphicsCoreOwner.view.state.pixelRatio;i.symbolLayerStatePatches.push(()=>{this._patchTask=s(this._patchTask),this._patchTask=t(t=>this._context.schedule(async(t,i)=>{const s=await e(u.fromUrl(h,d,{signal:i}));n(i);const l=!s.ok;if(l&&o(s.error),this._textureHandle=a(this._textureHandle),this._patchTask=null,l){this._forEachMaterial(e=>{e.visible=!1,e.setParameters({textureId:null})});const e=`Failed to load (Request for icon resource failed: ${h})`;return void this.logger.error(new r("graphics3diconsymbollayer:request-failed",e))}this._textureHandle=s.value;const c=s.value.managedTexture;this._size=pe(c,m),this._forEachMaterial(e=>{e.setParameters({textureId:c.id}),e.visible=!0})},t))}),delete c.href}_preparePatchRotation(e,t){if(!t.angle||"complete"!==t.angle.type)return;const r=t.angle.newValue??0,i=0!==r||this._drivenProperties.rotation;e.symbolLayerStatePatches.push(()=>{this._forEachMaterial(e=>e.setParameters({rotation:r,hasRotation:i}))}),delete t.angle}_defaultElevationInfoNoZ(){return ye}_createAs3DShape(e,t,r,i,s,a,o,n){const l=this.getFastUpdateAttrValues(e),c=this._context.layerViewUid,h=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:n,layerViewUid:c}),u=te(r,{normal:ae,color:i,rotation:s,size:a,centerOffsetAndDistance:ge,featureAttribute:l,olidColor:h}),m=B(this._context,t,u,o,n);if(null==m)return null;const d=new U(this,m.object,null,O,o);return d.hiddenIfDeconflicted=!0,d.alignedSampledElevation=m.sampledElevation,d.needsElevationUpdates=T(o.mode)||"absolute-height"===o.mode,d.getScreenSize=this._createScreenSizeGetter(a,l),d.calculateRelativeScreenBounds=e=>r.calculateRelativeScreenBounds(d.getScreenSize(),1,e),k(d,t,this._context.elevationProvider),d}_createAsOverlay(e,t,r,i,s,a){r.renderPriority=this._renderPriority;const o=_();x(t,o,this._context.overlaySR),o[2]=Y;const n=this._context.clippingExtent;if(null!=n&&!b(n,o))return null;const l=this.getFastUpdateAttrValues(e),c=e.uid,h=this._context.layerViewUid,u=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:c,layerViewUid:h}),m=te(r,{normal:ae,position:o,color:i,rotation:s,size:a,featureAttribute:l,olidColor:u}),d=new ie(m,{layerViewUid:h,graphicUid:c}),p=new E(this,[d],null,this._context.drapeSourceRenderer);return p.getScreenSize=this._createScreenSizeGetter(a,l),p.calculateRelativeScreenBounds=e=>r.calculateRelativeScreenBounds(p.getScreenSize(),1,e),p}_createScreenSizeGetter(e,t){const r=this._outlineSize+2;if(this._fastUpdates&&t){const i=e[0]/this._symbolTextureRatio,s=e[1]/this._symbolTextureRatio;return(e=d())=>{const[a,o]=N(xe,this._fastUpdates.materialParameters,t);return e[0]=a*i+r,e[1]=o*s+r,e}}const i=e[0]/this._symbolTextureRatio+r,s=e[1]/this._symbolTextureRatio+r;return(e=d())=>(e[0]=i,e[1]=s,e)}_fastVisualVariableConvertOptions(){const e=Math.max(this._size[0],this._size[1]),t=p(e,e,e),r=c(1),i=e*r,s=p(i,i,i),a=this._getFallbackSize();return new J({supports:{size:!0,color:!0,rotation:!0,opacity:!1},modelSize:t,symbolSize:s,unitInMeters:r,fallbackColor:this._fastVisualVariableFallbackColor,fallbackSize:p(a,a,a)})}_forEachMaterial(e){this._materials.forEach(e),this._cimSymbolMaterials.forEach(e)}test(){return{...super.test(),material:this._materials[0]}}}function he(e){return e&&"point-3d"===e.type&&e.hasVisibleVerticalOffset()}function ue(e){return null!=e&&("cross"===e||"x"===e)}function me(e){const t=u(e);return"application/json"===t?.mediaType?t.data:void 0}function de(e,t){return"relative"===e?m((t.x||0)+.5,.5-(t.y||0)):e in G?G[e]:G.center}function pe({parameters:e},t){const r=(e.width??1)/(e.height??1);return r>1?[t,Math.round(t/r)]:[Math.round(t*r),t]}function _e(e){return e.resource?.href?null:e.resource?.primitive??C}function fe(e){return 1===(e.material?.color?.a??0)&&null!=_e(e)}const ye={mode:"relative-to-ground",offset:0},ge=g(0,0,0,1),xe=_();export{ce as Graphics3DIconSymbolLayer};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../core/Error.js";import{releaseMaybe as t}from"../../../../core/maybe.js";import{isPromiseLike as i}from"../../../../core/promiseUtils.js";import{pt2px as r}from"../../../../core/screenUtils.js";import{fromValues as s,ZEROS as n,create as o}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{freeze as a}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as l}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{hasCalloutSupport as c,textSymbolLayerSupportsVerticalOffset as m}from"../../../../symbols/callouts/calloutUtils.js";import{perObjectElevationAligner as d}from"./ElevationAligners.js";import{needsElevationUpdates2D as h}from"./elevationAlignmentUtils.js";import{focusAreaHUDColor as f}from"./focusAreaStyle.js";import{Graphics3DObject3DGraphicLayer as p}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DObjectMetadata as u}from"./Graphics3DObjectMetadata.js";import{Graphics3DSymbolLayer as g}from"./Graphics3DSymbolLayer.js";import{validateSymbolLayerSize as y}from"./graphicUtils.js";import{LabelPlacement as v,LabelParameters as b}from"./LabelParameters.js";import{verticalScreenOffsetFromAlignment as x,verticalPlacementFromAlignment as P,textRenderAlignmentFromHorizontalPlacement as O,horizontalPlacementToAnchorX as w,anchorFromPlacements as S,namedAnchorToHUDMaterialAnchorPos as j}from"./placementUtils.js";import{placePointOnGeometry as _,updateStageObjectGeometry as E,getLocalOriginForPoint as z,extendPointGraphicElevationContext as L,createStageObject as C}from"./pointUtils.js";import{getFontMetrics as F}from"../../webgl-engine/lib/FontMetrics.js";import{createPointGeometry as G}from"../../webgl-engine/lib/GeometryUtil.js";import{TextRenderParameters as A}from"../../webgl-engine/lib/TextRenderParameters.js";import U from"../../webgl-engine/lib/TextTextureFactory.js";import{HUDMaterial as D}from"../../webgl-engine/materials/HUDMaterial.js";const V=a(0,0,1);class R extends g{constructor(e,t,i,r){super(e,t,i,r),this._elevationOptions={supportsOffsetAdjustment:!0,supportsOnTheGround:!1},this.ensureDrapedStatus(!1)}async doLoad(){if(!this._drivenProperties.size){const t=y(this.symbolLayer.size);if(t)throw new e("graphics3dtextsymbollayer:invalid-size",t)}await this._createTextRenderParameters()}async _createTextRenderParameters(){const e=this._context.graphicsCoreOwner.view.state.rasterPixelRatio;this._textRenderParameters=await A.fromSymbol(this.symbolLayer,e)}destroy(){super.destroy()}createGraphics3DGraphic(e){const t=e.graphic,i=_(t.geometry);if(null==i)return this.logger.warn(`unsupported geometry type for text symbol: ${t.geometry.type}`),null;const r=this.view.focusAreasView?.containsGeometry(i)??!0,s=this.symbolLayer.text;if(null==s||""===s)return null;const n=c(this.symbol)&&this.symbol.hasVisibleVerticalOffset()?this.symbol.verticalOffset:null;if(null!=n&&!m(this.symbolLayer))return this.logger.errorOncePerTick(`Callouts and vertical offset on text symbols are currently only supported with 'center' horizontal alignment (not with '${this.symbolLayer.horizontalAlignment}' alignment)`),null;const{verticalAlignment:o}=this.symbolLayer,a=new v(n);x(o,a.screenOffset);const l=new b(a,this.symbolLayer.horizontalAlignment,P(o));return l.isFocused=r??l.isFocused,this._createAs3DShape(t,i,s,l)}get needsUpdateFocus(){return!0}createLabel(e,t,i,r,s){const n=e.graphic,o=_(n.geometry);if(null==o)return this.logger.warn(`unsupported geometry type for label: ${n.geometry.type}`),null;const a=this.view.focusAreasView?.containsGeometry(o)??!0,l=t.text;return!l||/^\s+$/.test(l)?null:(t.isFocused=a??t.isFocused,this._createAs3DShape(n,o,l,t,i,r,s))}createElevationContextForGraphic(e,t=0){const i=super.createElevationContextForGraphic(e);return i.addOffsetRenderUnits(t),i}updateElevationContextForGraphic(e,t,i=0){super.updateElevationContextForGraphic(e,t),e.addOffsetRenderUnits(i)}layerOpacityChanged(){return this.logger.warn("layer opacity change not yet implemented in Graphics3DTextSymbolLayer"),!1}layerScreenSizePerspectiveChanged(e,t){const i=!this.draped&&this._context.screenSizePerspectiveEnabled,r=i?this.view.screenSizePerspective.labelParameters:null,s=i?this.view.screenSizePerspective.parameters:null;T(e,t,e=>{for(const t of e.stageObject.geometries)t.material.setParameters({screenSizePerspective:r,screenSizePerspectiveAlignment:s})})}layerElevationInfoChanged(e,t){return T(e,t,(e,t)=>{this.graphics3DGraphicLayerElevationInfoChanged(t,e)}),1}slicePlaneEnabledChanged(e,t){return T(e,t,e=>{for(const t of e.stageObject.geometries)t.material.setParameters({hasSlicePlane:this._context.slicePlaneEnabled})}),!0}terrainTransparencyChanged(){return this.draped}physicalBasedRenderingChanged(){return!0}get pixelRatioChanged(){return!1}graphics3DGraphicLayerElevationInfoChanged(e,t){const{elevationContext:i,metadata:r}=t;this.updateElevationContextForGraphic(i,e,r?.elevationOffset??0),t.needsElevationUpdates=h(i.mode)||"absolute-height"===i.mode}updateGeometry(e,t){const i=e.geometry;if(this.draped||!i||!this._validateGeometry(i))return!1;const{elevationContext:r,stageObject:s}=t;if(r.mode!==this.getGeometryElevationMode(i))return!1;const n=_(i);if(!n)return!1;r.updateFeatureExpressionFeature(e,this._context.layer);const o=E(s,this._context,n,r);if(null==o)return!1;const a=z(this._context,n);return s.geometries[0].localOrigin===a&&(t.alignedSampledElevation=o,L(t,n,this._context.elevationProvider),!0)}_defaultElevationInfoNoZ(){return I}_createAs3DShape(e,a,c,m,g,y=null,v=()=>m.placement.elevationOffset){const b=this.createElevationContextForGraphic(e,m.placement.elevationOffset),x=e.uid;let P=null,w=null;if(null==y){const e=O(m.horizontalPlacement);P=new U(c,e,this._textRenderParameters);let r=null;if(null!=this._context.sharedResources.textures){w=this._context.sharedResources.textures.fromData(P.key,()=>P.create()),w.managedTexture.events.on("unloaded",()=>r=t(r));const e=this._context.stage.renderView.textures.acquire(w.managedTexture.id);if(null==e||i(e))return w.release(),null;r=e}}const S=this.symbolLayer.occludedVisibility?.mode??"hidden",j=this.view.basemapTerrain,_=!j.opaque&&!j.invisible,E=M(P,m),z={useVisibilityPixel:_&&"hidden"===S,occludedVisibilityMode:this.symbolLayer.occludedVisibility?.mode??"hidden",occludedFragmentFade:!1,horizonCullingEnabled:this._context.spherical,screenOffset:m.placement.screenOffset,anchorPosition:E,polygonOffset:!0,color:[1,1,1,1],centerOffsetUnits:m.placement.centerOffsetUnits,depthEnabled:!1,drawAsLabel:!0,isLabel:!0,isFocused:m.isFocused};if("polyline"===e.geometry?.type&&(z.shaderPolygonOffset=1e-4),y?z.textureId=y.id:w&&(z.textureId=w.managedTexture.id),null!=m.placement.verticalOffset){const{screenLength:e,minWorldLength:t,maxWorldLength:i}=m.placement.verticalOffset;z.verticalOffset={screenLength:r(e),minWorldLength:t||0,maxWorldLength:null!=i?i:1/0}}const A=this._context.graphicsCoreOwner.view.focusAreasView?.polygons.length,R={screenOffset:z.screenOffset,anchorPosition:E,centerOffsetUnits:z.centerOffsetUnits,verticalOffset:z.verticalOffset,shaderPolygonOffset:z.shaderPolygonOffset,useVisibilityPixel:z.useVisibilityPixel,occludedVisibilityMode:z.occludedVisibilityMode,isFocused:m.isFocused,focusStyle:this.view.map?.focusAreas.style??"none"};if(this._context.screenSizePerspectiveEnabled){const{parameters:e,labelParameters:t}=this.view.screenSizePerspective,i=F(this._textRenderParameters);z.screenSizePerspective=t,z.screenSizePerspectiveMinPixelReferenceSize=i.maxHeight,z.screenSizePerspectiveAlignment=e,R.fontHeight=i.maxHeight}z.hasSlicePlane=this._context.slicePlaneEnabled;const T=this._context.spherical,I=g?JSON.stringify(R):"";let H=g?.get(I);if(null==H){if(!m.isFocused&&A){const e=this.view.map?.focusAreas.style;z.color=f(z.color,e),z.outlineColor=f(z.outlineColor,e)}H=new D(z,T),g?.set(I,H)}const W=m.placement.translation,$=P?s(P.displayWidth,P.displayHeight):n,k=m.placement.centerOffset,q=V,N=y?l(0,0,0,0):null,B=G(H,{normal:q,position:W,size:$,centerOffsetAndDistance:k,uvi:N}),J=C(this._context,a,B,b,x);if(null==J)return null;const Y=(t,i,r,s,n,o)=>{const a=v()||m.placement.elevationOffset;return this.updateElevationContextForGraphic(i,e,a),d(t,i,r,s,n,o)},Z=new p(this,J.object,w,Y,b);Z.alignedSampledElevation=J.sampledElevation,Z.hiddenIfDeconflicted=!0,Z.needsElevationUpdates=h(b.mode)||"absolute-height"===b.mode,Z.getScreenSize=(e=o())=>(e[0]=P?P.displayWidth:m.displaySize[0],e[1]=P?P.displayHeight:m.displaySize[1],e);const K=new u(m.placement.elevationOffset,c);return Z.metadata=K,L(Z,a,this._context.elevationProvider),Z}}function T(e,t,i){e?.forEach(e=>{const r=t(e);null!=r&&i(r,e.graphic)})}function M(e,t){if("baseline"===t.verticalPlacement){const i=w[t.horizontalPlacement],r=null!=e?e.baselineAnchorY:0;return s(i,r)}const i=S(t.horizontalPlacement,t.verticalPlacement);return j[i]}const I={mode:"relative-to-ground",offset:0};export{R as Graphics3DTextSymbolLayer};
5
+ import e from"../../../../core/Error.js";import{releaseMaybe as t}from"../../../../core/maybe.js";import{isPromiseLike as r}from"../../../../core/promiseUtils.js";import{pt2px as i}from"../../../../core/screenUtils.js";import{fromValues as s,ZEROS as n,create as o}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{freeze as a}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as l}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{hasCalloutSupport as c,textSymbolLayerSupportsVerticalOffset as m}from"../../../../symbols/callouts/calloutUtils.js";import{perObjectElevationAligner as d}from"./ElevationAligners.js";import{needsElevationUpdates2D as h}from"./elevationAlignmentUtils.js";import{focusAreaHUDColor as f}from"./focusAreaStyle.js";import{Graphics3DObject3DGraphicLayer as p}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DObjectMetadata as u}from"./Graphics3DObjectMetadata.js";import{Graphics3DSymbolLayer as g}from"./Graphics3DSymbolLayer.js";import{validateSymbolLayerSize as y}from"./graphicUtils.js";import{LabelPlacement as v,LabelParameters as b}from"./LabelParameters.js";import{verticalScreenOffsetFromAlignment as x,verticalPlacementFromAlignment as P,textRenderAlignmentFromHorizontalPlacement as O,horizontalPlacementToAnchorX as w,anchorFromPlacements as S,namedAnchorToHUDMaterialAnchorPos as j}from"./placementUtils.js";import{placePointOnGeometry as _,updateStageObjectGeometry as E,getLocalOriginForPoint as z,extendPointGraphicElevationContext as L,createStageObject as C}from"./pointUtils.js";import{getFontMetrics as F}from"../../webgl-engine/lib/FontMetrics.js";import{createPointGeometry as G}from"../../webgl-engine/lib/GeometryUtil.js";import{TextRenderParameters as A}from"../../webgl-engine/lib/TextRenderParameters.js";import U from"../../webgl-engine/lib/TextTextureFactory.js";import{HUDMaterial as D}from"../../webgl-engine/materials/HUDMaterial.js";const R=a(0,0,1);class V extends g{constructor(e,t,r,i){super(e,t,r,i),this._elevationOptions={supportsOffsetAdjustment:!0,supportsOnTheGround:!1},this.ensureDrapedStatus(!1)}async doLoad(){if(!this._drivenProperties.size){const t=y(this.symbolLayer.size);if(t)throw new e("graphics3dtextsymbollayer:invalid-size",t)}await this._createTextRenderParameters()}async _createTextRenderParameters(){const e=this._context.graphicsCoreOwner.view.state.rasterPixelRatio;this._textRenderParameters=await A.fromSymbol(this.symbolLayer,e)}destroy(){super.destroy()}createGraphics3DGraphic(e){const t=e.graphic,r=_(t.geometry);if(null==r)return this.logger.warn(`unsupported geometry type for text symbol: ${t.geometry.type}`),null;const i=this.view.focusAreasView?.containsGeometry(r)??!0,s=this.symbolLayer.text;if(null==s||""===s)return null;const n=c(this.symbol)&&this.symbol.hasVisibleVerticalOffset()?this.symbol.verticalOffset:null;if(null!=n&&!m(this.symbolLayer))return this.logger.errorOncePerTick(`Callouts and vertical offset on text symbols are currently only supported with 'center' horizontal alignment (not with '${this.symbolLayer.horizontalAlignment}' alignment)`),null;const{verticalAlignment:o}=this.symbolLayer,a=new v(n);x(o,a.screenOffset);const l=new b(a,this.symbolLayer.horizontalAlignment,P(o));return l.isFocused=i??l.isFocused,this._createAs3DShape(t,r,s,l)}get needsUpdateFocus(){return!0}createLabel(e,t,r,i,s){const n=e.graphic,o=_(n.geometry);if(null==o)return this.logger.warn(`unsupported geometry type for label: ${n.geometry.type}`),null;const a=this.view.focusAreasView?.containsGeometry(o)??!0,l=t.text;return!l||/^\s+$/.test(l)?null:(t.isFocused=a??t.isFocused,this._createAs3DShape(n,o,l,t,r,i,s))}createElevationContextForGraphic(e,t=0){const r=super.createElevationContextForGraphic(e);return r.addOffsetRenderUnits(t),r}updateElevationContextForGraphic(e,t,r=0){super.updateElevationContextForGraphic(e,t),e.addOffsetRenderUnits(r)}layerOpacityChanged(){return this.logger.warn("layer opacity change not yet implemented in Graphics3DTextSymbolLayer"),!1}layerScreenSizePerspectiveChanged(e,t){const r=!this.draped&&this._context.screenSizePerspectiveEnabled,i=r?this.view.screenSizePerspective.labelParameters:null,s=r?this.view.screenSizePerspective.parameters:null;T(e,t,e=>{for(const t of e.stageObject.geometries)t.material.setParameters({screenSizePerspective:i,screenSizePerspectiveAlignment:s})})}layerElevationInfoChanged(e,t){return T(e,t,(e,t)=>{this.graphics3DGraphicLayerElevationInfoChanged(t,e)}),1}slicePlaneEnabledChanged(e,t){return T(e,t,e=>{for(const t of e.stageObject.geometries)t.material.setParameters({hasSlicePlane:this._context.slicePlaneEnabled})}),!0}terrainTransparencyChanged(){return this.draped}physicalBasedRenderingChanged(){return!0}get pixelRatioChanged(){return!1}graphics3DGraphicLayerElevationInfoChanged(e,t){const{elevationContext:r,metadata:i}=t;this.updateElevationContextForGraphic(r,e,i?.elevationOffset??0),t.needsElevationUpdates=h(r.mode)||"absolute-height"===r.mode}updateGeometry(e,t){const r=e.geometry;if(this.draped||!r||!this._validateGeometry(r))return!1;const{elevationContext:i,stageObject:s}=t;if(i.mode!==this.getGeometryElevationMode(r))return!1;const n=_(r);if(!n)return!1;i.updateFeatureExpressionFeature(e,this._context.layer);const o=E(s,this._context,n,i);if(null==o)return!1;const a=z(this._context,n);return s.geometries[0].localOrigin===a&&(t.alignedSampledElevation=o,L(t,n,this._context.elevationProvider),!0)}_defaultElevationInfoNoZ(){return I}_createAs3DShape(e,a,c,m,g,y=null,v=()=>m.placement.elevationOffset){const b=this.createElevationContextForGraphic(e,m.placement.elevationOffset),x=e.uid;let P=null,w=null;if(null==y){const e=O(m.horizontalPlacement);P=new U(c,e,this._textRenderParameters);let i=null;if(null!=this._context.sharedResources.textures){w=this._context.sharedResources.textures.fromData(P.key,()=>P.create()),w.managedTexture.events.on("unloaded",()=>i=t(i));const e=this._context.stage.renderView.textures.acquire(w.managedTexture.id);if(null==e||r(e))return w.release(),null;i=e}}const S=this.symbolLayer.occludedVisibility?.mode??"hidden",j=this.view.basemapTerrain,_=!j.opaque&&!j.invisible,E=M(P,m),z={useVisibilityPixel:_&&"hidden"===S,occludedVisibilityMode:S,occludedFragmentFade:!1,screenOffset:m.placement.screenOffset,anchorPosition:E,polygonOffset:!0,color:[1,1,1,1],centerOffsetUnits:m.placement.centerOffsetUnits,depthEnabled:!1,drawAsLabel:!0,isLabel:!0,isFocused:m.isFocused};if("polyline"===e.geometry?.type&&(z.shaderPolygonOffset=1e-4),y?z.textureId=y.id:w&&(z.textureId=w.managedTexture.id),null!=m.placement.verticalOffset){const{screenLength:e,minWorldLength:t,maxWorldLength:r}=m.placement.verticalOffset;z.verticalOffset={screenLength:i(e),minWorldLength:t||0,maxWorldLength:null!=r?r:1/0}}const A=this._context.graphicsCoreOwner.view.focusAreasView?.polygons.length,V={screenOffset:z.screenOffset,anchorPosition:E,centerOffsetUnits:z.centerOffsetUnits,verticalOffset:z.verticalOffset,shaderPolygonOffset:z.shaderPolygonOffset,useVisibilityPixel:z.useVisibilityPixel,occludedVisibilityMode:z.occludedVisibilityMode,isFocused:m.isFocused,focusStyle:this.view.map?.focusAreas.style??"none"};if(this._context.screenSizePerspectiveEnabled){const{parameters:e,labelParameters:t}=this.view.screenSizePerspective,r=F(this._textRenderParameters);z.screenSizePerspective=t,z.screenSizePerspectiveMinPixelReferenceSize=r.maxHeight,z.screenSizePerspectiveAlignment=e,V.fontHeight=r.maxHeight}z.hasSlicePlane=this._context.slicePlaneEnabled;const T=this._context.spherical,I=g?JSON.stringify(V):"";let H=g?.get(I);if(null==H){if(!m.isFocused&&A){const e=this.view.map?.focusAreas.style;z.color=f(z.color,e),z.outlineColor=f(z.outlineColor,e)}H=new D(z,T),g?.set(I,H)}const W=m.placement.translation,$=P?s(P.displayWidth,P.displayHeight):n,k=m.placement.centerOffset,q=R,N=y?l(0,0,0,0):null,B=G(H,{normal:q,position:W,size:$,centerOffsetAndDistance:k,uvi:N}),J=C(this._context,a,B,b,x);if(null==J)return null;const Y=(t,r,i,s,n,o)=>{const a=v()||m.placement.elevationOffset;return this.updateElevationContextForGraphic(r,e,a),d(t,r,i,s,n,o)},Z=new p(this,J.object,w,Y,b);Z.alignedSampledElevation=J.sampledElevation,Z.hiddenIfDeconflicted=!0,Z.needsElevationUpdates=h(b.mode)||"absolute-height"===b.mode,Z.getScreenSize=(e=o())=>(e[0]=P?P.displayWidth:m.displaySize[0],e[1]=P?P.displayHeight:m.displaySize[1],e);const K=new u(m.placement.elevationOffset,c);return Z.metadata=K,L(Z,a,this._context.elevationProvider),Z}}function T(e,t,r){e?.forEach(e=>{const i=t(e);null!=i&&r(i,e.graphic)})}function M(e,t){if("baseline"===t.verticalPlacement){const r=w[t.horizontalPlacement],i=null!=e?e.baselineAnchorY:0;return s(r,i)}const r=S(t.horizontalPlacement,t.verticalPlacement);return j[r]}const I={mode:"relative-to-ground",offset:0};export{V as Graphics3DTextSymbolLayer};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../core/Error.js";import t from"../../../../geometry/Mesh.js";import{projectBuffer as r}from"../../../../geometry/projection/projectBuffer.js";import{toExtent as o}from"../../../../geometry/support/aaBoundingBox.js";import n from"../../../../geometry/support/MeshGeoreferencedVertexSpace.js";import a from"../../../../geometry/support/MeshVertexAttributes.js";import{b as s,a as i}from"../../../../chunks/vec3.js";import{Metadata as c}from"../../../../geometry/support/meshUtils/Metadata.js";function l(e){const r=new c,o=e.spatialReference??e.layerView.view.spatialReference;return r.externalSources.add({extent:e.extent??m(e,o),source:{type:"loadable",load:t=>p(t,e)}}),new t({metadata:r,vertexSpace:new n,spatialReference:o})}function m({layerView:e,nodeIndex:t,featureIndex:n},a){const s=e.getAABB(t,n);if(!s)return null;const i=e.view.spatialReference;return i.equals(a)||r(s,i,0,s,a,0),o(s,a)}async function p(t,{layerView:o,nodeIndex:n,featureIndex:c}){const l=o.getNodeComponentHandle(n);if(!l?.intersectionGeometry)throw new e("i3s-layer-view-geometry-missing","Cannot load mesh because scene layer view data is no longer available.");const m={indices:null,data:null,stride:0,startIndex:0,endIndex:0};l.intersectionGeometry.getComponentPositions(c,m);const{indices:p,data:d,stride:f,startIndex:u,endIndex:x}=m,y=new Float64Array(3*(x-u));let w=0;for(let e=u;e<x;e+=3){const t=f*p[e],r=f*p[e+1],o=f*p[e+2];y[w++]=d[t],y[w++]=d[t+1],y[w++]=d[t+2],y[w++]=d[r],y[w++]=d[r+1],y[w++]=d[r+2],y[w++]=d[o],y[w++]=d[o+1],y[w++]=d[o+2]}const g=l.transform;s(y,y,g.rotationScale),i(y,y,g.position),r(y,o.view.renderSpatialReference,0,y,t.spatialReference,0),t.vertexAttributes=new a({position:y})}export{l as createMesh};
5
+ import e from"../../../../core/Error.js";import t from"../../../../geometry/Mesh.js";import{projectBuffer as r}from"../../../../geometry/projection/projectBuffer.js";import{toExtent as o}from"../../../../geometry/support/aaBoundingBox.js";import n from"../../../../geometry/support/MeshGeoreferencedVertexSpace.js";import a from"../../../../geometry/support/MeshVertexAttributes.js";import{b as s,a as i}from"../../../../chunks/vec3.js";import{Metadata as c}from"../../../../geometry/support/meshUtils/Metadata.js";function l(e){const r=new c,o=e.spatialReference??e.layerView.view.spatialReference;return r.externalSources.add({extent:e.extent??m(e,o),source:{type:"loadable",load:t=>p(t,e)}}),new t({metadata:r,vertexSpace:new n,spatialReference:o})}function m({layerView:e,nodeIndex:t,featureIndex:n},a){const s=e.getAABB(t,n);if(!s)return null;const i=e.view.spatialReference;return i.equals(a)||r(s,i,0,s,a,0),o(s,a)}async function p(t,{layerView:o,nodeIndex:n,featureIndex:c}){const l=o.getNodeComponentHandle(n);if(!l?.intersectionGeometry)throw new e("i3s-layer-view-geometry-missing","Cannot load mesh because scene layer view data is no longer available.");const m={indices:null,data:null,stride:0,startIndex:0,endIndex:0};l.intersectionGeometry.getComponentPositions(c,m);const{indices:p,data:d,stride:f,startIndex:u,endIndex:x}=m,y=new Float64Array(3*(x-u));let w=0;for(let e=u;e<x;e+=3){const t=f*p[e],r=f*p[e+1],o=f*p[e+2];y[w++]=d[t],y[w++]=d[t+1],y[w++]=d[t+2],y[w++]=d[r],y[w++]=d[r+1],y[w++]=d[r+2],y[w++]=d[o],y[w++]=d[o+1],y[w++]=d[o+2]}const{transform:g}=l;s(y,y,g.rotationScale),i(y,y,g.position),r(y,o.view.renderSpatialReference,0,y,t.spatialReference,0),t.vertexAttributes=new a({position:y})}export{l as createMesh};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{acosClamped as e,lerp as t,clamp as i}from"../../../core/mathUtils.js";import{getMetersPerUnitForSR as r}from"../../../core/units.js";import{b as n,n as s,j as a,g as o,e as m}from"../../../chunks/vec32.js";import{create as c}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as h}from"../../../geometry/ellipsoidUtils.js";import l from"../../../geometry/Extent.js";import{create as u,fromValues as p}from"../../../geometry/support/ray.js";import{Sphere as x}from"../../../geometry/support/sphere.js";import{computeInnerAltitudeFade as f}from"../environment/atmosphereUtils.js";import{DepthRange as M}from"../webgl-engine/lib/DepthRange.js";function _(e,t,i){return 1===e?new y(t,i):new d(t,i)}class d{constructor(e,t){this._elevationProvider=e,this._referenceEllipsoid=h(t),this._unitInMeters=r(t,this._referenceEllipsoid.metersPerDegree)}compute(e,r,n,a){const{eye:c,center:h}=e;let u=c[2]*this._unitInMeters;const p=u,x=u-a,f=this._elevationProvider?.visibleElevationRange;f&&(u=x>=0?p-this._unitInMeters*f.minElevation:this._unitInMeters*f.maxElevation-p),r??=new l({xmin:0,ymin:0,zmin:0,xmax:0,ymax:0,zmax:0});const M={x:r.xmax-r.xmin,y:r.ymax-r.ymin,z:4*Math.max(r.xmax-r.xmin,r.ymax-r.ymin)},_=Math.max(M.x,M.y,M.z);m(P,h,c),F[0]=P[0]>0?r.xmax:r.xmin,F[1]=P[1]>0?r.ymax:r.ymin,F[2]=P[2]>0?_/2:-_/2,m(F,F,c),s(P,P);const d=1.1*o(F,P)*this._unitInMeters,y=Math.sqrt(u*(u+2*this._referenceEllipsoid.radius)),E=Math.max(r.xmax-r.xmin,r.ymax-r.ymin),g=E*w*this._unitInMeters,I=E*D*this._unitInMeters,b=i((u-I)/(g-I),0,1)**3,R=Math.min(t(y,d,b),y)*Math.max(Math.log(Math.abs(x)),1);return v(Math.min(R,Math.max(34064e4,_))/this._unitInMeters,j,this._unitInMeters,z)}computeFarDistance(e,t,i){return i}}class y{constructor(e,t){this._elevationProvider=e,this._referenceEllipsoid=h(t)}compute(r,c,h,l){const{eye:u}=r,x=n(u),_=x-this._referenceEllipsoid.radius,d=this._computeVirtualAltitude(_,l),y=this._elevationProvider?.visibleElevationRange.maxElevation??0,w=f(d),D=this._computeFarDistance(x,d,l,h.far),A=(Math.log(d)-E)/(g-E);v(D,i(j-A*(j-I),I,j),1,z);const V=this._referenceEllipsoid.radius+y,q=this._referenceEllipsoid.radius+this._referenceEllipsoid.atmosphereHeight,k=Math.max(V,q),H=x-k;if(w>0&&H>b){const i=s(F,a(F,r.eye,-1)),c=s(P,r.viewForward),l=e(o(i,c)),u=.5*r.fovY,x=Math.cos(u);let f=M.Infinite.near;if(l<=u)f=H*x;else{const e=s(F,r.viewUp),t=Math.tan(u),i=a(F,e,t),o=s(F,m(F,c,i)),h=p(r.eye,o,U);if(R.radius=k,R.intersectRay(h,F)){const e=m(F,F,r.eye);f=n(e)*x}}const _=.99*Math.min(h.near,f);_<M.Infinite.near&&_>z.near&&(z.near=t(z.near,_,w))}return z}computeFarDistance(e,t,i){const r=n(e),s=r-this._referenceEllipsoid.radius,a=this._computeVirtualAltitude(s,t);return this._computeFarDistance(r,a,t,i)}_computeFarDistance(e,t,i,r){const n=this._referenceEllipsoid.radius,s=n+Math.min(0,i),a=f(t),o=Math.sqrt(t*(t+2*s)),m=o+Math.max(Math.min(.2*o,.01*n),r);return a<.5?m:1.2*(e+n)}_computeVirtualAltitude(e,t){const i=Math.abs(e-t);return Math.max(i,Math.abs(e))}}function v(e,t,i,r){const n=b/i,s=e/t;return s>n?(r.far=e,r.near=s):(r.near=n,r.far=r.near*t),r}const E=7.983,g=16.994,j=2e4,I=100,b=2,w=.001,D=1e-4,F=c(),P=c(),z={near:0,far:0},R=new x,U=u();export{y as NearFarHeuristicGlobal,_ as createNearFarHeuristic,b as minNearDistanceInMeters};
5
+ import{acosClamped as e,lerp as t,clamp as i}from"../../../core/mathUtils.js";import{getMetersPerUnitForSR as r}from"../../../core/units.js";import{b as a,n,j as s,g as o,e as m,h as c}from"../../../chunks/vec32.js";import{create as h}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as l}from"../../../geometry/ellipsoidUtils.js";import p from"../../../geometry/Extent.js";import{create as u,fromValues as x}from"../../../geometry/support/ray.js";import{Sphere as f}from"../../../geometry/support/sphere.js";import{computeInnerAltitudeFade as M}from"../environment/atmosphereUtils.js";import{DepthRange as y}from"../webgl-engine/lib/DepthRange.js";function d(e,t,i){return 1===e?new _(t,i):new v(t,i)}class v{constructor(e,t){this._elevationProvider=e,this._referenceEllipsoid=l(t),this._unitInMeters=r(t,this._referenceEllipsoid.metersPerDegree)}compute(e,r,a,s){const{eye:h,center:l}=e,p=this._unitInMeters,u=h[2]*p,x=u-s,f=this._elevationProvider?.visibleElevationRange,M=f?x>=0?u-p*f.minElevation:p*f.maxElevation-u:u,y=r??V,d={x:y.xmax-y.xmin,y:y.ymax-y.ymin,z:4*Math.max(y.xmax-y.xmin,y.ymax-y.ymin)},v=Math.max(d.x,d.y,d.z),_=m(I,l,h),E=c(z,_[0]>0?y.xmax:y.xmin,_[1]>0?y.ymax:y.ymin,_[2]>0?v/2:-v/2);m(E,E,h),n(_,_);const j=1.1*o(E,_)*p,w=Math.abs(x),D=Math.sqrt(w*(w+2*this._referenceEllipsoid.radius)),U=Math.max(y.xmax-y.xmin,y.ymax-y.ymin),A=U*P*p,q=i((M-A)/(U*F*p-A),0,1)**3,k=Math.min(t(D,j,q),D)*Math.max(Math.log(Math.abs(x)),1);return g(Math.min(k,Math.max(34064e4,v))/p,b,p,R)}computeFarDistance(e,t,i){return i}}class _{constructor(e,t){this._elevationProvider=e,this._referenceEllipsoid=l(t)}compute(r,c,h,l){const{eye:p}=r,u=a(p),f=this._referenceEllipsoid.radius,d=u-f,v=this._computeVirtualAltitude(d,l),_=this._elevationProvider?.visibleElevationRange.maxElevation??0,F=M(v),P=this._computeFarDistance(u,v,l,h.far),V=(Math.log(v)-E)/(j-E);g(P,i(b-V*(b-w),w,b),1,R);const q=f+_,k=f+this._referenceEllipsoid.atmosphereHeight,H=Math.max(q,k),Y=u-H;if(F>0&&Y>D){const i=n(z,s(z,r.eye,-1)),c=n(I,r.viewForward),l=e(o(i,c)),p=.5*r.fovY,u=Math.cos(p);let f=y.Infinite.near;if(l<=p)f=Y*u;else{const e=n(z,r.viewUp),t=Math.tan(p),i=s(z,e,t),o=n(z,m(z,c,i)),h=x(r.eye,o,A);if(U.radius=H,U.intersectRay(h,z)){const e=m(z,z,r.eye);f=a(e)*u}}const M=.99*Math.min(h.near,f);M<y.Infinite.near&&M>R.near&&(R.near=t(R.near,M,F))}return R}computeFarDistance(e,t,i){const r=a(e),n=r-this._referenceEllipsoid.radius,s=this._computeVirtualAltitude(n,t);return this._computeFarDistance(r,s,t,i)}_computeFarDistance(e,t,i,r){const a=this._referenceEllipsoid.radius,n=a+Math.min(0,i),s=M(t),o=Math.sqrt(t*(t+2*n)),m=o+Math.max(Math.min(.2*o,.01*a),r);return s<.5?m:1.2*(e+a)}_computeVirtualAltitude(e,t){const i=Math.abs(e-t);return Math.max(i,Math.abs(e))}}function g(e,t,i,r){const a=D/i,n=e/t;return n>a?(r.far=e,r.near=n):(r.near=a,r.far=r.near*t),r}const E=7.983,j=16.994,b=2e4,w=100,D=2,F=.001,P=1e-4,z=h(),I=h(),R={near:0,far:0},U=new f,A=u(),V=new p({xmin:0,ymin:0,zmin:0,xmax:0,ymax:0,zmax:0});export{_ as NearFarHeuristicGlobal,d as createNearFarHeuristic,D as minNearDistanceInMeters};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import"../../../../../core/has.js";import e from"../../../../../core/Logger.js";import t from"../../../../../core/PooledArray.js";import{isTypedArray as i}from"../../../../../core/typedArrayUtil.js";import{clone as n}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as o}from"../../../../../geometry/support/aaBoundingBox.js";import{compactIndices as r}from"../../../../../geometry/support/Indices.js";import{c as s}from"../../../../../chunks/vec3.js";import{c as a}from"../../../../../chunks/vec33.js";import{ComponentData as c}from"./ComponentData.js";import{ComponentObject as l}from"./ComponentObject.js";import{IntersectionGeometry as m}from"./IntersectionGeometry.js";import{Renderable as h}from"./Renderable.js";import{RenderGeometry as p}from"./RenderGeometry.js";import{RenderSubmitSystem as f}from"./RenderSubmitSystem.js";import{ComponentMaterial as g}from"./Material/ComponentMaterial.js";import{VertexArrayObject as d}from"../../lib/VertexArrayObject.js";import{getVerticalOffsetI3S as u}from"../../lib/verticalOffsetUtils.js";import{BufferManager as b}from"../../lib/TextureBackedBuffer/BufferManager.js";import{getComponentDataLayout as y,IndexGlLayout as v}from"../../materials/DefaultLayouts.js";import{BufferObject as _}from"../../../../webgl/BufferObject.js";import{PrimitiveType as C}from"../../../../webgl/enums.js";import{VertexBuffer as M}from"../../../../webgl/VertexBuffer.js";const j=()=>e.getLogger("esri.views.3d.webgl-engine.collections.Component.ComponentObjectCollection");class O{constructor(e,i,n){this._renderManager=e,this._viewingMode=i,this._sphericalSpatialReference=n,this._elevationRangeCacheVerticalOffset=NaN,this._elevationRangeCacheMin=NaN,this._elevationRangeCacheMax=NaN,this._activeHighlightOptions=new Map,this._visible=new t,this._hidden=new t,this._renderSubmit=new f(this),this._renderManager.register(this._renderSubmit),this._componentBufferManager=new b(e.rctx,y())}destroy(){this._componentBufferManager.destroy(),this._componentBufferManager=null,this._visible.forAll(e=>e.destroy()),this._visible.prune(),this._hidden.forAll(e=>e.destroy()),this._hidden.prune(),this._renderSubmit.destroy()}createObject(e,t){const{geometry:i}=e,n=new c(this._componentBufferManager,r(i.componentOffsets)),o=this._createRenderable(e,t,n),s=new m(this._viewingMode,i.positions,n,e.elevationAlignable),a=new l(e.transform,e.obb.clone(),n,o,s);return(a.visible?this._visible:this._hidden).push(a),a}destroyObject(e){const t=e;(t.visible?this._visible:this._hidden).removeUnordered(t),t.destroy(),this._notifyDirty()}setObjectVisibility(e,t){const i=e;t!==i.visible&&(t?(this._hidden.removeUnordered(i),this._visible.push(i)):(this._visible.removeUnordered(i),this._hidden.push(i)),i.visible=t,this._notifyDirty())}preSubmit(e){const{camera:t}=e;this._componentBufferManager.updateTextures(),this.visibleObjects.forAll(e=>e.updateCameraDerivedParameters(t))}updateMaterial(e,t){const i=e;i.updateMaterial(t),i.renderable.material.dirty&&this._notifyDirty()}getObjectOpacity(e){return e.renderable.material.objectOpacity}updateObjectOpacity(e,t){const{renderable:i}=e,{material:n}=i;t!==n.objectOpacity&&(n.update({objectOpacity:t}),n.dirty&&this._notifyDirty())}isSliceplaneEnabled(e){return e.renderable.material.slicePlaneEnabled}setAllComponentVisibilities(e,t){const i=e;i.componentData.visibility.reset(t),i.componentData.markVisibilityDirty(),this._notifyDirty()}forEachVisibleComponent(e,t){return e.componentData.visibility.forEachComponent(t)}getComponentCount(e){const t=e,{componentData:i}=t,n=i.visibility.componentCount;return{visible:n,invisible:i.count-n}}setComponentData(e,t){e.setComponentData(t,this._viewingMode),this._elevationRangeCacheVerticalOffset=NaN,this._notifyDirty()}getComponentAabb(e,t,i,n=!1){e.intersectionGeometry.getComponentAabb(t,i);const o=e,r=o.componentData.verticalOffsets;if(n||null==r)return i;const s=r[t];if(2===this._viewingMode||0===s)return i[2]+=s,i[5]+=s,i;const a=u(s);return a.localOrigin=o.transform.position,a.applyToAabb(i)}getComponentObb(e){return e.obb}getObjectTransform(e){return e.transform}getComponentPositions(e,t,i){return e.intersectionGeometry.getComponentPositions(t,i)}expandRangeWithComponentObjectElevationRange(e,t,i,n){Number.isNaN(this._elevationRangeCacheVerticalOffset)||this._elevationRangeCacheVerticalOffset!==t||n.expandElevationRangeValues(this._elevationRangeCacheMin,this._elevationRangeCacheMax);const o=e,{componentData:r}=o,s=r.count,{verticalOffsets:a}=r,{intersectionGeometry:c}=o,l=2===this._viewingMode,m=c.getComponentAabbs(),h=w;let p=1/0,f=-1/0;for(let g=0;g<s;g++){const e=6*g,r=a?.[g]??0;let s=1/0,c=-1/0;if(l)s=m[e+2]+r+t,c=m[e+5]+r+t;else{if(h[0]=m[e],h[1]=m[e+1],h[2]=m[e+2],h[3]=m[e+3],h[4]=m[e+4],h[5]=m[e+5],0!==r){const e=u(r);e.localOrigin=o.transform.position,e.applyToAabb(h)}const s=Math.max(Math.abs(h[3]),Math.abs(h[0])),a=Math.max(Math.abs(h[4]),Math.abs(h[1])),c=t+h[5]+i;n.expandElevationRangeValues(t+h[2],Math.sqrt(s*s+a*a+c*c)-i)}n.expandElevationRangeValues(s,c),p=Math.min(p,s),f=Math.max(f,c)}this._elevationRangeCacheVerticalOffset=t,this._elevationRangeCacheMin=p,this._elevationRangeCacheMax=f}intersect(e,t,i,n,o,r){const s=e,{transform:a,componentData:c,intersectionGeometry:l}=s;return null!=n&&(n.localOrigin=a.position),l.intersect(t,i,n,c.verticalOffsets,a,o,r)}addEdges(e,t,i,n,o){const r=e,{indices:s,positions:a}=r.intersectionGeometry,c=r.componentData.offsets;return t.addComponentObject(r,a,s,c,i,n,o)}async extractEdgeInformation(e,t,i){const o=e,r=o.componentData.visibility;if(r.allInvisible()){const{extractComponentsEdgeLocationsLayout:e}=await import("../../lib/edgeRendering/edgeProcessing.js");return{buffer:e.createBuffer(0),origin:[0,0,0]}}const{indices:c,positions:l}=o.intersectionGeometry,m=o.componentData.offsets,{EdgeInputBufferLayout:h}=await import("../../lib/edgeRendering/bufferLayouts.js"),p=h.createBuffer(l.length/3);a(p.position.typedBuffer,l,p.position.typedBufferStride,3),s(p.position,p.position,o.transform.rotationScale),this._setComponentIndices(p.componentIndex,c,m);const f=p.count,g=this._computeVisibilityIndices(c,r,m,f);return{origin:n(o.transform.position),buffer:await t.extractComponentsEdgeLocations({indices:g,indicesLength:g.length,skipDeduplicate:!0,data:p,writerSettings:{reducedPrecision:!1,variants:0}},i)}}_setComponentIndices(e,t,i){let n=0;for(let o=0;o<i.length-1;o++){const r=i[o],s=i[o+1];for(let i=r;i<s;i++){const o=t?t[i]:i;e.set(o,n)}n++}}_computeVisibilityIndices(e,t,n,o){if(e&&t.allVisible())return e;let r=0;t.forEachComponentRange((e,t)=>(r+=n[t]-n[e],!0));const s=i(e)?2===e?.BYTES_PER_ELEMENT||o<=65536?new Uint16Array(r):new Uint32Array(r):new Array(r);let a=0;return t.forEachComponentRange((t,i)=>{const o=n[t],r=n[i];for(let n=o;n<r;n++)s[a++]=e?e[n]:n;return!0}),s}addComponentHighlight(e,t,i){const n=e;{const e=this._activeHighlightOptions.get(i)??0;this._activeHighlightOptions.set(i,e+1)}n.addComponentHighlight(t,i)&&this._notifyDirty()}removeComponentHighlight(e,t,i){const n=e.removeComponentHighlight(t,i);"notfound"!==n&&(this._removeActiveHighlight(i),n&&this._notifyDirty())}_removeActiveHighlight(e,t=1){const i=this._activeHighlightOptions.get(e);if(void 0===i)j().warn(`Removing non-existing highlight "${e}".`);else{const n=i-t;n<0&&j().warn(`Removing non-existing highlight "${e}".`),n<=0?this._activeHighlightOptions.delete(e):this._activeHighlightOptions.set(e,n)}}clearHighlights(e){const t=e,{componentData:i}=t,{componentHighlights:n}=t.componentData;if(n.size>0){for(const e of n)this._removeActiveHighlight(e[0],e[1][i.count]);t.clearHighlights(),this._notifyDirty()}}hasHighlight(e){return this._activeHighlightOptions.has(e)}getObjectGPUMemoryUsage(e){return e.renderable.meta.gpuMemoryEstimate}get visibleObjects(){return this._visible}_createRenderable(e,t,i){const n=this._renderManager.rctx,o=e.geometry,r=o.parameters.layout,s=new M(n,r,o.vertices.data),a=o.indices?_.createIndex(n,35044,o.indices):null,c=new Uint16Array(o.vertices.count);for(let h=0;h<i.count;h++){const e=i.offsets[h],t=i.offsets[h+1],n=i.materialDataIndices[h];if(null!=o.indices)for(let i=e;i<t;i++){c[o.indices[i]]=n}else for(let i=e;i<t;i++)c[i]=n}const l=new M(n,v,c.buffer),m=new g(t,e.transform,e.toMapSpace,e.obb.radius<D,this._sphericalSpatialReference,n.driverTest.floatBufferBlend.result),f=new d(n,new Map([["geometry",s],["componentIndices",l]]),a),u=new p(f,C.TRIANGLES,o.parameters,null!=a),b={cameraDepthSquared:.5,gpuMemoryEstimate:s.usedMemory+l.usedMemory+(null!=a?a.usedMemory:0)};return new h(m,u,b)}_notifyDirty(){this._renderManager.notifyDirty()}}const w=o(),D=5e4;export{O as ComponentObjectCollection};
5
+ import"../../../../../core/has.js";import e from"../../../../../core/Logger.js";import t from"../../../../../core/PooledArray.js";import{isTypedArray as i}from"../../../../../core/typedArrayUtil.js";import{clone as n}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as o}from"../../../../../geometry/support/aaBoundingBox.js";import{compactIndices as r}from"../../../../../geometry/support/Indices.js";import{c as s}from"../../../../../chunks/vec3.js";import{c as a}from"../../../../../chunks/vec33.js";import{ComponentData as c}from"./ComponentData.js";import{ComponentObject as l}from"./ComponentObject.js";import{IntersectionGeometry as m}from"./IntersectionGeometry.js";import{Renderable as h}from"./Renderable.js";import{RenderGeometry as p}from"./RenderGeometry.js";import{RenderSubmitSystem as f}from"./RenderSubmitSystem.js";import{ComponentMaterial as g}from"./Material/ComponentMaterial.js";import{VertexArrayObject as d}from"../../lib/VertexArrayObject.js";import{getVerticalOffsetI3S as u}from"../../lib/verticalOffsetUtils.js";import{BufferManager as b}from"../../lib/TextureBackedBuffer/BufferManager.js";import{getComponentDataLayout as y,IndexGlLayout as v}from"../../materials/DefaultLayouts.js";import{BufferObject as _}from"../../../../webgl/BufferObject.js";import{PrimitiveType as C}from"../../../../webgl/enums.js";import{VertexBuffer as M}from"../../../../webgl/VertexBuffer.js";const j=()=>e.getLogger("esri.views.3d.webgl-engine.collections.Component.ComponentObjectCollection");class O{constructor(e,i,n){this._renderManager=e,this._viewingMode=i,this._sphericalSpatialReference=n,this._elevationRangeCacheVerticalOffset=NaN,this._elevationRangeCacheMin=NaN,this._elevationRangeCacheMax=NaN,this._activeHighlightOptions=new Map,this._visible=new t,this._hidden=new t,this._renderSubmit=new f(this),this._renderManager.register(this._renderSubmit),this._componentBufferManager=new b(e.rctx,y())}destroy(){this._componentBufferManager.destroy(),this._componentBufferManager=null,this._visible.forAll(e=>e.destroy()),this._visible.prune(),this._hidden.forAll(e=>e.destroy()),this._hidden.prune(),this._renderSubmit.destroy()}createObject(e,t){const{geometry:i}=e,n=new c(this._componentBufferManager,r(i.componentOffsets)),o=this._createRenderable(e,t,n),s=new m(this._viewingMode,i.positions,n,e.elevationAlignable),a=new l(e.transform,e.obb.clone(),n,o,s);return(a.visible?this._visible:this._hidden).push(a),a}destroyObject(e){const t=e;(t.visible?this._visible:this._hidden).removeUnordered(t),t.destroy(),this._notifyDirty()}setObjectVisibility(e,t){const i=e;t!==i.visible&&(t?(this._hidden.removeUnordered(i),this._visible.push(i)):(this._visible.removeUnordered(i),this._hidden.push(i)),i.visible=t,this._notifyDirty())}preSubmit(e){const{camera:t}=e;this._componentBufferManager.updateTextures(),this.visibleObjects.forAll(e=>e.updateCameraDerivedParameters(t))}updateMaterial(e,t){const i=e;i.updateMaterial(t),i.renderable.material.dirty&&this._notifyDirty()}getObjectOpacity(e){return e.renderable.material.objectOpacity}updateObjectOpacity(e,t){const{renderable:i}=e,{material:n}=i;t!==n.objectOpacity&&(n.update({objectOpacity:t}),n.dirty&&this._notifyDirty())}isSliceplaneEnabled(e){return e.renderable.material.slicePlaneEnabled}setAllComponentVisibilities(e,t){const i=e;i.componentData.visibility.reset(t),i.componentData.markVisibilityDirty(),this._notifyDirty()}forEachVisibleComponent(e,t){return e.componentData.visibility.forEachComponent(t)}getComponentCount(e){const t=e,{componentData:i}=t,n=i.visibility.componentCount;return{visible:n,invisible:i.count-n}}setComponentData(e,t){e.setComponentData(t,this._viewingMode),this._elevationRangeCacheVerticalOffset=NaN,this._notifyDirty()}getComponentAabb(e,t,i,n=!1){e.intersectionGeometry.getComponentAabb(t,i);const o=e,r=o.componentData.verticalOffsets;if(n||null==r)return i;const s=r[t];if(2===this._viewingMode||0===s)return i[2]+=s,i[5]+=s,i;const a=u(s);return a.localOrigin=o.transform.position,a.applyToAabb(i)}getComponentObb(e){return e.obb}getObjectTransform(e){return e.transform}getComponentPositions(e,t,i){return e.intersectionGeometry.getComponentPositions(t,i)}expandRangeWithComponentObjectElevationRange(e,t,i,n){Number.isNaN(this._elevationRangeCacheVerticalOffset)||this._elevationRangeCacheVerticalOffset!==t||n.expandElevationRangeValues(this._elevationRangeCacheMin,this._elevationRangeCacheMax);const o=e,{componentData:r}=o,s=r.count,{verticalOffsets:a}=r,{intersectionGeometry:c}=o,l=2===this._viewingMode,m=c.getComponentAabbs(),h=w;let p=1/0,f=-1/0;for(let g=0;g<s;g++){const e=6*g,r=a?.[g]??0;let s=1/0,c=-1/0;if(l)s=m[e+2]+r+t,c=m[e+5]+r+t;else{if(h[0]=m[e],h[1]=m[e+1],h[2]=m[e+2],h[3]=m[e+3],h[4]=m[e+4],h[5]=m[e+5],0!==r){const e=u(r);e.localOrigin=o.transform.position,e.applyToAabb(h)}const s=Math.max(Math.abs(h[3]),Math.abs(h[0])),a=Math.max(Math.abs(h[4]),Math.abs(h[1])),c=t+h[5]+i;n.expandElevationRangeValues(t+h[2],Math.sqrt(s*s+a*a+c*c)-i)}n.expandElevationRangeValues(s,c),p=Math.min(p,s),f=Math.max(f,c)}this._elevationRangeCacheVerticalOffset=t,this._elevationRangeCacheMin=p,this._elevationRangeCacheMax=f}intersect(e,t,i,n,o,r){const s=e,{transform:a,componentData:c,intersectionGeometry:l}=s;return null!=n&&(n.localOrigin=a.position),l.intersect(t,i,n,c.verticalOffsets,a,o,r)}addEdges(e,t,i,n,o){const r=e,{indices:s,positions:a}=r.intersectionGeometry,c=r.componentData.offsets;return t.addComponentObject(r,a,s,c,i,n,o)}async extractEdgeInformation(e,t,i){const o=e,r=o.componentData.visibility;if(r.allInvisible()){const{extractComponentsEdgeLocationsLayout:e}=await import("../../lib/edgeRendering/edgeProcessing.js");return{buffer:e.createBuffer(0),origin:[0,0,0]}}const{indices:c,positions:l}=o.intersectionGeometry,m=o.componentData.offsets,{EdgeInputBufferLayout:h}=await import("../../lib/edgeRendering/bufferLayouts.js"),p=h.createBuffer(l.length/3);a(p.position.typedBuffer,l,p.position.typedBufferStride,3),s(p.position,p.position,o.transform.rotationScale),this._setComponentIndices(p.componentIndex,c,m);const f=p.count,g=this._computeVisibilityIndices(c,r,m,f);return{origin:n(o.transform.position),buffer:await t.extractComponentsEdgeLocations({indices:g,indicesLength:g.length,skipDeduplicate:!0,data:p,writerSettings:{reducedPrecision:!1,variants:0}},i)}}_setComponentIndices(e,t,i){let n=0;for(let o=0;o<i.length-1;o++){const r=i[o],s=i[o+1];for(let i=r;i<s;i++){const o=t?t[i]:i;e.set(o,n)}n++}}_computeVisibilityIndices(e,t,n,o){if(e&&t.allVisible())return e;let r=0;t.forEachComponentRange((e,t)=>(r+=n[t]-n[e],!0));const s=i(e)?2===e?.BYTES_PER_ELEMENT||o<=65536?new Uint16Array(r):new Uint32Array(r):new Array(r);let a=0;return t.forEachComponentRange((t,i)=>{const o=n[t],r=n[i];for(let n=o;n<r;n++)s[a++]=e?e[n]:n;return!0}),s}addComponentHighlight(e,t,i){const n=e;{const e=this._activeHighlightOptions.get(i)??0;this._activeHighlightOptions.set(i,e+1)}n.addComponentHighlight(t,i)&&this._notifyDirty()}removeComponentHighlight(e,t,i){const n=e.removeComponentHighlight(t,i);"notfound"!==n&&(this._removeActiveHighlight(i),n&&this._notifyDirty())}_removeActiveHighlight(e,t=1){const i=this._activeHighlightOptions.get(e);if(void 0===i)j().warn(`Removing non-existing highlight "${e}".`);else{const n=i-t;n<0&&j().warn(`Removing non-existing highlight "${e}".`),n<=0?this._activeHighlightOptions.delete(e):this._activeHighlightOptions.set(e,n)}}clearHighlights(e){const t=e,{componentData:i}=t,{componentHighlights:n}=t.componentData;if(n.size>0){for(const e of n)this._removeActiveHighlight(e[0],e[1][i.count]);t.clearHighlights(),this._notifyDirty()}}hasHighlight(e){return this._activeHighlightOptions.has(e)}getObjectGPUMemoryUsage(e){return e.renderable.meta.gpuMemoryEstimate}get visibleObjects(){return this._visible}_createRenderable(e,t,i){const n=this._renderManager.rctx,o=e.geometry,r=o.parameters.layout,s=new M(n,r,o.vertices.data),a=o.indices?_.createIndex(n,35044,o.indices):null,c=new Uint16Array(o.vertices.count);for(let h=0;h<i.count;h++){const e=i.offsets[h],t=i.offsets[h+1],n=i.materialDataIndices[h];if(null!=o.indices)for(let i=e;i<t;i++){c[o.indices[i]]=n}else for(let i=e;i<t;i++)c[i]=n}const l=new M(n,v,c.buffer),m=new d(n,new Map([["geometry",s],["componentIndices",l]]),a),f=new p(m,C.TRIANGLES,o.parameters,null!=a),u=new g(t,f.parameters,e.transform,e.toMapSpace,e.obb.radius<D,this._sphericalSpatialReference,n.driverTest.floatBufferBlend.result),b={cameraDepthSquared:.5,gpuMemoryEstimate:s.usedMemory+l.usedMemory+(null!=a?a.usedMemory:0)};return new h(u,f,b)}_notifyDirty(){this._renderManager.notifyDirty()}}const w=o(),D=5e4;export{O as ComponentObjectCollection};
@@ -2,7 +2,7 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{DecodeSymbolColor as o}from"./DecodeSymbolColor.glsl.js";import{TextureBackedBufferModule as e}from"../../../core/shaderLibrary/TextureBackedBuffer.glsl.js";import{Float4DrawUniform as r}from"../../../core/shaderModules/Float4DrawUniform.js";import{FloatDrawUniform as t}from"../../../core/shaderModules/FloatDrawUniform.js";import{glsl as d,If as n}from"../../../core/shaderModules/glsl.js";import{IntegerDrawUniform as a}from"../../../core/shaderModules/IntegerDrawUniform.js";import{Texture2DUintDrawUniform as l}from"../../../core/shaderModules/Texture2DUintDrawUniform.js";import{olidEnabled as i}from"../../../effects/geometry/olidUtils.js";import{componentDataLayout as s,componentDataOlidLayout as c}from"../../../materials/DefaultLayouts.js";function u(o,e){switch(e.componentData){case 1:return p(o,e);case 0:return M(o,e);case 2:return;default:e.componentData}}const m=(o,e)=>"emissiveSourceMode"===o||"emissiveStrength"===o?e.hasEmission:"olidColor"!==o||9===e.output,v=new l("componentTextureBuffer",o=>o.textureBackedBuffer?.texture),C=new e(s,"componentIndex",v,m),f=new e(c,"componentIndex",v,m);function x(){return i()?f:C}function p(e,r){const{vertex:t,fragment:a}=e,{output:l,hasEmission:i}=r,s=9===l,{getTextureAttribute:c,TextureBackedBufferModule:u}=x();e.include(u,r),e.attributes.add("componentIndex","uint"),e.varyings.add("vExternalColorMixMode","mediump float"),e.varyings.add("vExternalColor","vec4"),s&&e.varyings.add("vObjectAndLayerIdColor","vec4"),i&&(e.varyings.add("emissiveStrength","float"),e.varyings.add("emissiveSource","int")),e.include(o),t.code.add(d`
5
+ import{DecodeSymbolColor as o}from"./DecodeSymbolColor.glsl.js";import{TextureBackedBufferModule as e}from"../../../core/shaderLibrary/TextureBackedBuffer.glsl.js";import{Float4DrawUniform as r}from"../../../core/shaderModules/Float4DrawUniform.js";import{FloatDrawUniform as t}from"../../../core/shaderModules/FloatDrawUniform.js";import{glsl as d,If as n}from"../../../core/shaderModules/glsl.js";import{IntegerDrawUniform as a}from"../../../core/shaderModules/IntegerDrawUniform.js";import{Texture2DUintDrawUniform as l}from"../../../core/shaderModules/Texture2DUintDrawUniform.js";import{olidEnabled as i}from"../../../effects/geometry/olidUtils.js";import{componentDataLayout as s,componentDataOlidLayout as c}from"../../../materials/DefaultLayouts.js";function u(o,e){switch(e.componentDataType){case 1:return p(o,e);case 0:return M(o,e);case 2:return;default:e.componentDataType}}const m=(o,e)=>"emissiveSourceMode"===o||"emissiveStrength"===o?e.hasEmission:"olidColor"!==o||9===e.output,v=new l("componentTextureBuffer",o=>o.textureBackedBuffer?.texture),C=new e(s,"componentIndex",v,m),f=new e(c,"componentIndex",v,m);function x(){return i()?f:C}function p(e,r){const{vertex:t,fragment:a}=e,{output:l,hasEmission:i}=r,s=9===l,{getTextureAttribute:c,TextureBackedBufferModule:u}=x();e.include(u,r),e.attributes.add("componentIndex","uint"),e.varyings.add("vExternalColorMixMode","mediump float"),e.varyings.add("vExternalColor","vec4"),s&&e.varyings.add("vObjectAndLayerIdColor","vec4"),i&&(e.varyings.add("emissiveStrength","float"),e.varyings.add("emissiveSource","int")),e.include(o),t.code.add(d`
6
6
  float readElevationOffset() {
7
7
  return ${c("elevationOffset")};
8
8
  }
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import{invert as t,transpose as s}from"../../../../../../core/libs/gl-matrix-2/math/mat3.js";import{clone as o}from"../../../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{m as r,J as i}from"../../../../../../chunks/vec32.js";import{freeze as a,ZEROS as n}from"../../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{v as l}from"../../../../../../chunks/vec42.js";import{ones as u,clone as h}from"../../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{ComponentTechnique as p}from"./ComponentTechnique.js";import{ComponentTechniqueConfiguration as c}from"./ComponentTechniqueConfiguration.js";import{parameter as d,parameterBlock as m,MaterialBase as v,MaterialParameterBlock as f}from"../../../core/material/MaterialBase.js";import{isColor as g}from"../../../core/shaderLibrary/ShaderOutput.js";import{TwoVectorPosition as x}from"../../../core/util/TwoVectorPosition.js";import{advancedMRRFactors as y}from"../../../materials/pbrUtils.js";import{defaultHighlightName as b}from"../../../../../support/HighlightDefaults.js";class T extends v{constructor(e,r,i,n,l,h){super(),this.toMapSpace=i,this.useENUForGlobalOverlayUV=n,this.floatBufferBlendSupported=h,this.usePBR=!1,this.hasParametersFromSource=!1,this.sphereDepthInterpolate=!1,this.mrrFactors=y,this.baseColorTexture=null,this.metallicRoughnessTexture=null,this.normalTexture=null,this.occlusionTexture=null,this.emissionTexture=null,this.emissiveBaseColor=a(0,0,0),this.componentParameters=new M(u(),1,0,0,0),this.textureBackedBuffer=null;const p=o(r.rotationScale);t(p,p),s(p,p),this.transformNormalGlobalFromModel=p;const d=new x(r.position);this.transformWorldFromModelTL=d.low,this.transformWorldFromModelTH=d.high,this.transformWorldFromModelRS=r.rotationScale,this.baseColor=e.baseColor,this.usePBR=e.usePBR,this.hasParametersFromSource=e.hasParametersFromSource,this.sphereDepthInterpolate=e.sphereDepthInterpolate,this.mrrFactors=e.mrrFactors,this.baseColorTexture=e.baseColorTexture,this.metallicRoughnessTexture=e.metallicRoughnessTexture,this.normalTexture=e.normalTexture,this.occlusionTexture=e.occlusionTexture,this.emissionTexture=e.emissionTexture,this.emissiveBaseColor=e.emissiveBaseColor,this.doubleSided=e.doubleSided,this.cullFace=e.cullFace,this.isGround=e.isGround,this.slicePlaneEnabled=e.slicePlaneEnabled,this.objectOpacity=e.objectOpacity,this.textureAlphaCutoff=e.textureAlphaCutoff,this.alphaDiscardMode=e.alphaDiscardMode,this.isIntegratedMesh=e.isIntegratedMesh,this.polygonOffsetEnabled=e.polygonOffsetEnabled,this.ellipsoidMode=e.ellipsoidMode,this._configuration=new c(l),this._updateMaterialConfiguration()}dispose(){this.baseColorTexture=null,this.metallicRoughnessTexture=null,this.emissionTexture=null,this.occlusionTexture=null,this.normalTexture=null}get _hasEmissiveBase(){return null!=this.emissionTexture||!r(this.emissiveBaseColor,n)}get _hasEmissiveStrength(){return 2!==this.componentParameters.emissiveOverride}get hasEmissions(){return this.floatBufferBlendSupported&&this._hasEmissiveStrength&&(this._hasEmissiveBase||2!==this.componentParameters.emissiveSourceOverride)}get texture(){return this.baseColorTexture?.texture}get textureMetallicRoughness(){return this.metallicRoughnessTexture?.texture}get textureEmissive(){return this.emissionTexture?.texture}get textureOcclusion(){return this.occlusionTexture?.texture}get textureNormal(){return this.normalTexture?.texture}acquireTechnique(e,t,s,o){const r=this._updateConfiguration(t,s,o);return e.get(p,r,o.layout)}_updateConfiguration(e,t,s){return this._updateMaterialConfiguration(),this._updateDrawConfiguration(e,t,s)}_updateMaterialConfiguration(){if(!this.dirty)return;const e=this._configuration;e.hasMetallicRoughnessTexture=null!=this.metallicRoughnessTexture,e.hasOcclusionTexture=null!=this.occlusionTexture,e.hasNormalTexture=null!=this.normalTexture,e.sphereDepthInterpolate=this.sphereDepthInterpolate&&e.spherical,e.ellipsoidMode=this.ellipsoidMode,e.componentData=this.componentParameters.componentDataType,e.cullFace=this.cullFace,e.doubleSidedMode=this.doubleSided?1:0,e.hasColorTexture=null!=this.baseColorTexture,e.alphaDiscardMode=this.alphaDiscardMode,e.hasPolygonOffset=this.polygonOffsetEnabled,this._setClean()}_updateDrawConfiguration(e,t,s){const o=this._configuration,r=e.identifier,i=0===r;o.hasEmission=t.hasEmission&&i,o.renderOccluded=10===t.slot,o.hasVertexColors=s.hasVertexColors,o.hasNormals=s.hasNormals,o.textureCoordinateType=s.textureCoordinateType,o.oitPass=i?t.oitPass:0,o.terrainDepthTest=i&&t.terrainDepthTest,o.cullAboveTerrain=!!i&&t.cullAboveTerrain,o.integratedMeshMode=this.isIntegratedMesh?P(t)?O(t)?3:2:1:0,o.pbrMode=3===o.integratedMeshMode?4:this.usePBR?this.hasParametersFromSource?s.shadeNormals&&this.isIntegratedMesh?0:2:1:0;const a=1===this.componentParameters.emissiveSourceOverride,n=2===this.componentParameters.emissiveSourceOverride,l=null!=this.emissionTexture;o.emissionSource=this.hasEmissions?this._hasEmissiveBase?n?l?4:2:a?l?5:7:6:a?7:6:0,o.shadeNormals=s.shadeNormals,o.normalType=o.hasNormals?1:2;const u=null!=t.slicePlane&&this.slicePlaneEnabled;o.hasSlicePlane=u,o.isGroundSlice=u&&this.isGround;const h=this._computeMaterialPass();o.blendingEnabled=1===h||2===h||4===h||o.isGroundSlice,o.hasHighlightMixTexture=2===r&&null!=t.highlightMixTexture,o.output=e.output,o.snowCover=i&&t.snowCover>0,o.vertexDiscardMode=i&&2===h?e.transparent?2:1:0,o.olidColor=i&&9===e.output;const p=i&&g(e.output);return o.receiveAmbientOcclusion=p&&s.applySSAO&&null!=t.ssao?.getTexture(),o.hasOccludees=p&&t.hasOccludees,o.receiveShadows=p&&t.shadowMap.ready,o.screenSpaceReflections=p&&null!=t.ssr.lastFrameColor,o.cloudReflections=p&&null!=t.clouds.data?.cubeMap?.colorTexture,o}submit(e,t,s){if(this.objectOpacity<=0)return;const{componentData:o,renderable:r}=s,{geometry:i}=r,a=r.meta.cameraDepthSquared;o.updateHighlights(t.highlights);const{geometryRanges:n,highlightRangesMap:l,shadowmapRanges:u}=o,h=e=>e.submitDraw(this,i,n,a);switch(this._computeMaterialPass()){case 0:h(e.opaque);break;case 1:h(e.transparent);break;case 2:h(e.opaque),h(e.transparent);break;case 3:h(e.integratedMesh),B(t)&&h(e.occludedGround),C(t)&&h(e.highlightIntegratedMesh);break;case 4:h(e.transparentIntegratedMesh)}if(2!==this.componentParameters.castShadows){if(null!=l)for(const t of l)t[0]===b&&e.highlightShadowMap.submitDraw(this,i,t[1],a,t[0]);null!=u&&e.defaultShadowMap.submitDraw(this,i,u,a),h(e.shadowMap)}if(null!=l)for(const p of l)e.highlight.submitDraw(this,i,p[1],a,p[0]);t.viewshedEnabled&&h(e.viewshedShadowMap)}_computeMaterialPass(){if(this.isIntegratedMesh)return this.objectOpacity<1?4:3;if(this.objectOpacity<1)return this.isIntegratedMesh?4:1;if(0===this.componentParameters.opaqueOverride)return 0;if(this.baseColor[3]<1||0===this.alphaDiscardMode||3===this.alphaDiscardMode)return 1;switch(this.componentParameters.transparent){case 2:return 0;case 0:return 1;case 1:return 2}}update(e){void 0!==e.usePBR&&(this.usePBR=e.usePBR),void 0!==e.objectOpacity&&(this.objectOpacity=e.objectOpacity),void 0!==e.slicePlaneEnabled&&(this.slicePlaneEnabled=e.slicePlaneEnabled),void 0!==e.polygonOffsetEnabled&&(this.polygonOffsetEnabled=e.polygonOffsetEnabled),void 0!==e.textureBackedBuffer&&(this.textureBackedBuffer=e.textureBackedBuffer),void 0!==e.componentParameters&&(this.componentParameters=e.componentParameters)}}e([d({vectorOps:l})],T.prototype,"baseColor",void 0),e([d()],T.prototype,"usePBR",void 0),e([d()],T.prototype,"hasParametersFromSource",void 0),e([d()],T.prototype,"sphereDepthInterpolate",void 0),e([d({vectorOps:i})],T.prototype,"mrrFactors",void 0),e([d({dispose:!0})],T.prototype,"baseColorTexture",void 0),e([d({dispose:!0})],T.prototype,"metallicRoughnessTexture",void 0),e([d({dispose:!0})],T.prototype,"normalTexture",void 0),e([d({dispose:!0})],T.prototype,"occlusionTexture",void 0),e([d({dispose:!0})],T.prototype,"emissionTexture",void 0),e([d({vectorOps:i})],T.prototype,"emissiveBaseColor",void 0),e([d()],T.prototype,"doubleSided",void 0),e([d()],T.prototype,"cullFace",void 0),e([d()],T.prototype,"isGround",void 0),e([d()],T.prototype,"slicePlaneEnabled",void 0),e([m()],T.prototype,"componentParameters",void 0),e([d()],T.prototype,"textureBackedBuffer",void 0),e([d()],T.prototype,"objectOpacity",void 0),e([d()],T.prototype,"textureAlphaCutoff",void 0),e([d()],T.prototype,"alphaDiscardMode",void 0),e([d()],T.prototype,"isIntegratedMesh",void 0),e([d()],T.prototype,"polygonOffsetEnabled",void 0),e([d()],T.prototype,"ellipsoidMode",void 0);class M extends f{constructor(e,t,s,o,r){super(),this.castShadows=r,this.componentDataType=0,this.externalColor=h(e),this.externalColorMixMode=t,this.emissiveStrength=s,this.emissiveSource=o}get transparent(){return this.externalColor[3]<1?0:2}get opaqueOverride(){return 3===this.externalColorMixMode&&1===this.externalColor[3]?0:2}get emissiveOverride(){return this.emissiveStrength>0?0:2}get emissiveSourceOverride(){return 1===this.emissiveSource?0:2}}e([d({vectorOps:l})],M.prototype,"externalColor",void 0),e([d()],M.prototype,"externalColorMixMode",void 0),e([d()],M.prototype,"emissiveStrength",void 0),e([d()],M.prototype,"emissiveSource",void 0);class S extends f{constructor(e,t,s,o,r){super(),this.componentDataType=1,this.transparent=e,this.opaqueOverride=t,this.emissiveOverride=s,this.emissiveSourceOverride=o,this.castShadows=r}}function C(e){return null!=e.overlay?.getTexture(2)}function O(e){return null!=e.overlay?.getTexture(3)}function P(e){return null!=e.overlay?.getTexture(1)}function B(e){return null!=e.overlay?.getTexture(e.overlay?.allSourcesOccluders?1:4)}e([d()],S.prototype,"transparent",void 0),e([d()],S.prototype,"opaqueOverride",void 0),e([d()],S.prototype,"emissiveOverride",void 0),e([d()],S.prototype,"emissiveSourceOverride",void 0),e([d()],S.prototype,"castShadows",void 0);export{T as ComponentMaterial,M as ComponentParametersUniform,S as ComponentParametersVarying};
5
+ import{__decorate as e}from"tslib";import{invert as t,transpose as o,exactEquals as s}from"../../../../../../core/libs/gl-matrix-2/math/mat3.js";import{clone as r,IDENTITY as i}from"../../../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{m as a,J as n}from"../../../../../../chunks/vec32.js";import{ZEROS as l}from"../../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{v as h}from"../../../../../../chunks/vec42.js";import{ones as u,clone as p}from"../../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{ComponentTechnique as d}from"./ComponentTechnique.js";import{ComponentTechniqueConfiguration as c}from"./ComponentTechniqueConfiguration.js";import{parameter as m,parameterBlock as v,MaterialBase as f,MaterialParameterBlock as g}from"../../../core/material/MaterialBase.js";import{isColor as x}from"../../../core/shaderLibrary/ShaderOutput.js";import{TwoVectorPosition as y}from"../../../core/util/TwoVectorPosition.js";import{defaultHighlightName as b}from"../../../../../support/HighlightDefaults.js";class T extends f{constructor(e,a,n,l,h,p,d){super(),this.toMapSpace=l,this.useENUForGlobalOverlayUV=h,this.floatBufferBlendSupported=d,this.componentParameters=new M(u(),1,0,0,0);const m=r(n.rotationScale);t(m,m),o(m,m),this.transformNormalGlobalFromModel=m;const v=new y(n.position);this.transformWorldFromModelTL=v.low,this.transformWorldFromModelTH=v.high,this.transformWorldFromModelRS=n.rotationScale,this.baseColor=e.baseColor,this.usePBR=e.usePBR,this.hasParametersFromSource=e.hasParametersFromSource,this.sphereDepthInterpolate=e.sphereDepthInterpolate,this.mrrFactors=e.mrrFactors,this.baseColorTexture=e.baseColorTexture,this.metallicRoughnessTexture=e.metallicRoughnessTexture,this.normalTexture=e.normalTexture,this.occlusionTexture=e.occlusionTexture,this.emissionTexture=e.emissionTexture,this.emissiveBaseColor=e.emissiveBaseColor,this.doubleSided=e.doubleSided,this.cullFace=e.cullFace,this.isGround=e.isGround,this.slicePlaneEnabled=e.slicePlaneEnabled,this.objectOpacity=e.objectOpacity,this.textureAlphaCutoff=e.textureAlphaCutoff,this.alphaDiscardMode=e.alphaDiscardMode,this.isIntegratedMesh=e.isIntegratedMesh,this.polygonOffsetEnabled=e.polygonOffsetEnabled,this.ellipsoidMode=e.ellipsoidMode,this.hasVertexColors=a.hasVertexColors,this.textureCoordinateType=a.textureCoordinateType,this.shadeNormals=a.shadeNormals,this.hasNormals=a.hasNormals,this.applySSAO=a.applySSAO,this._configuration=new c(p),this._initializeMaterialConfiguration(),this._updateMaterialConfiguration(),this._configuration.hasModelRotationScale=!s(n.rotationScale,i)}dispose(){this.baseColorTexture?.dispose(),this.metallicRoughnessTexture?.dispose(),this.emissionTexture?.dispose(),this.occlusionTexture?.dispose(),this.normalTexture?.dispose()}get _hasEmissiveBase(){return null!=this.emissionTexture||!a(this.emissiveBaseColor,l)}get _hasEmissiveStrength(){return 2!==this.componentParameters.emissiveOverride}get hasEmissions(){return this.floatBufferBlendSupported&&this._hasEmissiveStrength&&(this._hasEmissiveBase||2!==this.componentParameters.emissiveSourceOverride)}get texture(){return this.baseColorTexture?.texture}get textureMetallicRoughness(){return this.metallicRoughnessTexture?.texture}get textureEmissive(){return this.emissionTexture?.texture}get textureOcclusion(){return this.occlusionTexture?.texture}get textureNormal(){return this.normalTexture?.texture}acquireTechnique(e,t,o,s){const r=this._updateConfiguration(t,o);return e.get(d,r,s.layout)}_updateConfiguration(e,t){return this._updateMaterialConfiguration(),this._updateDrawConfiguration(e,t)}_initializeMaterialConfiguration(){const e=this._configuration;e.hasMetallicRoughnessTexture=null!=this.metallicRoughnessTexture,e.hasOcclusionTexture=null!=this.occlusionTexture,e.hasNormalTexture=null!=this.normalTexture,e.sphereDepthInterpolate=this.sphereDepthInterpolate&&e.spherical,e.ellipsoidMode=this.ellipsoidMode,e.cullFace=this.cullFace,e.doubleSidedMode=this.doubleSided?1:0,e.hasColorTexture=null!=this.baseColorTexture,e.alphaDiscardMode=this.alphaDiscardMode,e.hasVertexColors=this.hasVertexColors,e.textureCoordinateType=this.textureCoordinateType,e.shadeNormals=this.shadeNormals,e.normalType=this.hasNormals?1:2}_updateMaterialConfiguration(){if(!this.dirty)return;const e=this._configuration;e.componentDataType=this.componentParameters.componentDataType,e.hasPolygonOffset=this.polygonOffsetEnabled,this._setClean()}_updateDrawConfiguration(e,t){const o=this._configuration,s=e.identifier,r=0===s;o.hasEmission=t.hasEmission&&r,o.renderOccluded=10===t.slot,o.oitPass=r?t.oitPass:0,o.terrainDepthTest=r&&t.terrainDepthTest,o.cullAboveTerrain=!!r&&t.cullAboveTerrain;const i=this.isIntegratedMesh?P(t)?O(t)?3:2:1:0;o.integratedMeshMode=i,o.pbrMode=3===i?4:this.usePBR?this.hasParametersFromSource?this.shadeNormals&&this.isIntegratedMesh?0:2:1:0;const a=1===this.componentParameters.emissiveSourceOverride,n=2===this.componentParameters.emissiveSourceOverride,l=null!=this.emissionTexture;o.emissionSource=this.hasEmissions?this._hasEmissiveBase?n?l?4:2:a?l?5:7:6:a?7:6:0;const h=null!=t.slicePlane&&this.slicePlaneEnabled;o.hasSlicePlane=h;const u=h&&this.isGround;o.isGroundSlice=u;const p=this._computeMaterialPass();o.blendingEnabled=1===p||2===p||4===p||u,o.hasHighlightMixTexture=2===s&&null!=t.highlightMixTexture,o.output=e.output,o.snowCover=r&&t.snowCover>0,o.vertexDiscardMode=r&&2===p?e.transparent?2:1:0;const d=r&&x(e.output);return o.receiveAmbientOcclusion=d&&this.applySSAO&&null!=t.ssao?.getTexture(),o.hasOccludees=d&&t.hasOccludees,o.receiveShadows=d&&t.shadowMap.ready,o.screenSpaceReflections=d&&null!=t.ssr.lastFrameColor,o.cloudReflections=d&&null!=t.clouds.data?.cubeMap?.colorTexture,o}submit(e,t,o){if(this.objectOpacity<=0)return;const{componentData:s,renderable:r}=o,{geometry:i}=r,a=r.meta.cameraDepthSquared;s.updateHighlights(t.highlights);const{geometryRanges:n,highlightRangesMap:l,shadowmapRanges:h}=s,u=e=>e.submitDraw(this,i,n,a);switch(this._computeMaterialPass()){case 0:u(e.opaque);break;case 1:u(e.transparent);break;case 2:u(e.opaque),u(e.transparent);break;case 3:u(e.integratedMesh),w(t)&&u(e.occludedGround),C(t)&&u(e.highlightIntegratedMesh);break;case 4:u(e.transparentIntegratedMesh)}if(2!==this.componentParameters.castShadows){if(null!=l)for(const t of l)t[0]===b&&e.highlightShadowMap.submitDraw(this,i,t[1],a,t[0]);null!=h&&e.defaultShadowMap.submitDraw(this,i,h,a),u(e.shadowMap)}if(null!=l)for(const p of l)e.highlight.submitDraw(this,i,p[1],a,p[0]);t.viewshedEnabled&&u(e.viewshedShadowMap)}_computeMaterialPass(){if(this.isIntegratedMesh)return this.objectOpacity<1?4:3;if(this.objectOpacity<1)return this.isIntegratedMesh?4:1;if(0===this.componentParameters.opaqueOverride)return 0;if(this.baseColor[3]<1||0===this.alphaDiscardMode||3===this.alphaDiscardMode)return 1;switch(this.componentParameters.transparent){case 2:return 0;case 0:return 1;case 1:return 2}}update(e){void 0!==e.usePBR&&(this.usePBR=e.usePBR),void 0!==e.objectOpacity&&(this.objectOpacity=e.objectOpacity),void 0!==e.slicePlaneEnabled&&(this.slicePlaneEnabled=e.slicePlaneEnabled),void 0!==e.polygonOffsetEnabled&&(this.polygonOffsetEnabled=e.polygonOffsetEnabled),void 0!==e.textureBackedBuffer&&(this.textureBackedBuffer=e.textureBackedBuffer),void 0!==e.componentParameters&&(this.componentParameters=e.componentParameters)}}e([m({vectorOps:h})],T.prototype,"baseColor",void 0),e([m()],T.prototype,"hasParametersFromSource",void 0),e([m()],T.prototype,"sphereDepthInterpolate",void 0),e([m({vectorOps:n})],T.prototype,"mrrFactors",void 0),e([m({dispose:!0})],T.prototype,"baseColorTexture",void 0),e([m({dispose:!0})],T.prototype,"metallicRoughnessTexture",void 0),e([m({dispose:!0})],T.prototype,"normalTexture",void 0),e([m({dispose:!0})],T.prototype,"occlusionTexture",void 0),e([m({dispose:!0})],T.prototype,"emissionTexture",void 0),e([m({vectorOps:n})],T.prototype,"emissiveBaseColor",void 0),e([m()],T.prototype,"doubleSided",void 0),e([m()],T.prototype,"cullFace",void 0),e([m()],T.prototype,"isGround",void 0),e([v()],T.prototype,"componentParameters",void 0),e([m()],T.prototype,"textureAlphaCutoff",void 0),e([m()],T.prototype,"alphaDiscardMode",void 0),e([m()],T.prototype,"isIntegratedMesh",void 0),e([m()],T.prototype,"ellipsoidMode",void 0),e([m()],T.prototype,"hasVertexColors",void 0),e([m()],T.prototype,"textureCoordinateType",void 0),e([m()],T.prototype,"shadeNormals",void 0),e([m()],T.prototype,"hasNormals",void 0),e([m()],T.prototype,"applySSAO",void 0),e([m()],T.prototype,"textureBackedBuffer",void 0),e([m()],T.prototype,"objectOpacity",void 0),e([m()],T.prototype,"polygonOffsetEnabled",void 0),e([m()],T.prototype,"slicePlaneEnabled",void 0),e([m()],T.prototype,"usePBR",void 0);class M extends g{constructor(e,t,o,s,r){super(),this.castShadows=r,this.componentDataType=0,this.externalColor=p(e),this.externalColorMixMode=t,this.emissiveStrength=o,this.emissiveSource=s}get transparent(){return this.externalColor[3]<1?0:2}get opaqueOverride(){return 3===this.externalColorMixMode&&1===this.externalColor[3]?0:2}get emissiveOverride(){return this.emissiveStrength>0?0:2}get emissiveSourceOverride(){return 1===this.emissiveSource?0:2}}e([m({vectorOps:h})],M.prototype,"externalColor",void 0),e([m()],M.prototype,"externalColorMixMode",void 0),e([m()],M.prototype,"emissiveStrength",void 0),e([m()],M.prototype,"emissiveSource",void 0);class S extends g{constructor(e,t,o,s,r){super(),this.componentDataType=1,this.transparent=e,this.opaqueOverride=t,this.emissiveOverride=o,this.emissiveSourceOverride=s,this.castShadows=r}}function C(e){return null!=e.overlay?.getTexture(2)}function O(e){return null!=e.overlay?.getTexture(3)}function P(e){return null!=e.overlay?.getTexture(1)}function w(e){return null!=e.overlay?.getTexture(e.overlay?.allSourcesOccluders?1:4)}e([m()],S.prototype,"transparent",void 0),e([m()],S.prototype,"opaqueOverride",void 0),e([m()],S.prototype,"emissiveOverride",void 0),e([m()],S.prototype,"emissiveSourceOverride",void 0),e([m()],S.prototype,"castShadows",void 0);export{T as ComponentMaterial,M as ComponentParametersUniform,S as ComponentParametersVarying};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import{isColorHighlightOrOLID as t}from"../../../core/shaderLibrary/ShaderOutput.js";import{parameter as o}from"../../../core/shaderTechnique/ShaderTechniqueConfiguration.js";import{SphereDepthInterpolateConfiguration as i}from"../../../shaders/SphereDepthInterpolate.glsl.js";class s extends i{constructor(e){super(),this.sphericalSR=e,this.output=0,this.textureCoordinateType=0,this.componentData=0,this.cullFace=2,this.vertexDiscardMode=0,this.doubleSidedMode=2,this.alphaDiscardMode=1,this.integratedMeshMode=0,this.oitPass=0,this.pbrMode=0,this.normalType=0,this.emissionSource=0,this.hasEmission=!1,this.hasVertexColors=!1,this.hasNormals=!1,this.shadeNormals=!0,this.hasSlicePlane=!1,this.isGroundSlice=!1,this.hasColorTexture=!1,this.hasHighlightMixTexture=!1,this.receiveAmbientOcclusion=!0,this.receiveShadows=!0,this.blendingEnabled=!0,this.screenSpaceReflections=!1,this.hasPolygonOffset=!1,this.hasMetallicRoughnessTexture=!1,this.hasOcclusionTexture=!1,this.hasNormalTexture=!1,this.hasOccludees=!1,this.terrainDepthTest=!1,this.cullAboveTerrain=!1,this.hasNormalTextureTransform=!1,this.cloudReflections=!0,this.snowCover=!1,this.olidColor=!1,this.renderOccluded=!1,this.sphereDepthInterpolate=!1,this.discardInvisibleFragments=!1,this.oitPremultipliedAlpha=!1,this.occlusionPass=!1,this.bindType=2,this.useCustomDTRExponentForWater=!1,this.hasVertexTangents=!1,this.hasSliceTranslatedView=!1,this.highStepCount=!1,this.instanced=!1,this.instancedDoublePrecision=!1,this.hasModelTransformation=!1,this.useFillLights=!0,this.draped=!1}get spherical(){return 0!==this.sphericalSR}get overlayEnabled(){return(2===this.integratedMeshMode||3===this.integratedMeshMode)&&t(this.output)}get hasWater(){return 3===this.pbrMode||4===this.pbrMode||6===this.pbrMode}}e([o({count:10})],s.prototype,"output",void 0),e([o({count:3})],s.prototype,"textureCoordinateType",void 0),e([o({count:2})],s.prototype,"componentData",void 0),e([o({count:3})],s.prototype,"cullFace",void 0),e([o({count:3})],s.prototype,"vertexDiscardMode",void 0),e([o({count:3})],s.prototype,"doubleSidedMode",void 0),e([o({count:4})],s.prototype,"alphaDiscardMode",void 0),e([o({count:4})],s.prototype,"integratedMeshMode",void 0),e([o({count:3})],s.prototype,"oitPass",void 0),e([o({count:7})],s.prototype,"pbrMode",void 0),e([o({count:3})],s.prototype,"normalType",void 0),e([o({count:8})],s.prototype,"emissionSource",void 0),e([o()],s.prototype,"hasEmission",void 0),e([o()],s.prototype,"hasVertexColors",void 0),e([o()],s.prototype,"hasNormals",void 0),e([o()],s.prototype,"shadeNormals",void 0),e([o()],s.prototype,"hasSlicePlane",void 0),e([o()],s.prototype,"isGroundSlice",void 0),e([o()],s.prototype,"hasColorTexture",void 0),e([o()],s.prototype,"hasHighlightMixTexture",void 0),e([o()],s.prototype,"receiveAmbientOcclusion",void 0),e([o()],s.prototype,"receiveShadows",void 0),e([o()],s.prototype,"blendingEnabled",void 0),e([o()],s.prototype,"screenSpaceReflections",void 0),e([o()],s.prototype,"hasPolygonOffset",void 0),e([o()],s.prototype,"hasMetallicRoughnessTexture",void 0),e([o()],s.prototype,"hasOcclusionTexture",void 0),e([o()],s.prototype,"hasNormalTexture",void 0),e([o()],s.prototype,"hasOccludees",void 0),e([o()],s.prototype,"terrainDepthTest",void 0),e([o()],s.prototype,"cullAboveTerrain",void 0),e([o()],s.prototype,"hasNormalTextureTransform",void 0),e([o()],s.prototype,"cloudReflections",void 0),e([o()],s.prototype,"snowCover",void 0),e([o()],s.prototype,"olidColor",void 0),e([o()],s.prototype,"renderOccluded",void 0),e([o()],s.prototype,"sphereDepthInterpolate",void 0);export{s as ComponentTechniqueConfiguration};
5
+ import{__decorate as e}from"tslib";import{isColorHighlightOrOLID as t}from"../../../core/shaderLibrary/ShaderOutput.js";import{parameter as o}from"../../../core/shaderTechnique/ShaderTechniqueConfiguration.js";import{SphereDepthInterpolateConfiguration as i}from"../../../shaders/SphereDepthInterpolate.glsl.js";class s extends i{constructor(e){super(),this.sphericalSR=e,this.output=0,this.textureCoordinateType=0,this.componentDataType=0,this.cullFace=2,this.vertexDiscardMode=0,this.doubleSidedMode=2,this.alphaDiscardMode=1,this.integratedMeshMode=0,this.oitPass=0,this.pbrMode=0,this.normalType=0,this.emissionSource=0,this.hasEmission=!1,this.hasVertexColors=!1,this.shadeNormals=!0,this.hasSlicePlane=!1,this.isGroundSlice=!1,this.hasColorTexture=!1,this.hasHighlightMixTexture=!1,this.receiveAmbientOcclusion=!0,this.receiveShadows=!0,this.blendingEnabled=!0,this.screenSpaceReflections=!1,this.hasPolygonOffset=!1,this.hasMetallicRoughnessTexture=!1,this.hasOcclusionTexture=!1,this.hasNormalTexture=!1,this.hasOccludees=!1,this.terrainDepthTest=!1,this.cullAboveTerrain=!1,this.hasNormalTextureTransform=!1,this.cloudReflections=!0,this.snowCover=!1,this.renderOccluded=!1,this.sphereDepthInterpolate=!1,this.hasModelRotationScale=!0,this.discardInvisibleFragments=!1,this.oitPremultipliedAlpha=!1,this.occlusionPass=!1,this.bindType=2,this.useCustomDTRExponentForWater=!1,this.hasVertexTangents=!1,this.hasSliceTranslatedView=!1,this.highStepCount=!1,this.instanced=!1,this.instancedDoublePrecision=!1,this.hasModelTransformation=!1,this.useFillLights=!0,this.draped=!1}get spherical(){return 0!==this.sphericalSR}get overlayEnabled(){return(2===this.integratedMeshMode||3===this.integratedMeshMode)&&t(this.output)}get hasWater(){return 3===this.pbrMode||4===this.pbrMode||6===this.pbrMode}}e([o({count:10})],s.prototype,"output",void 0),e([o({count:3})],s.prototype,"textureCoordinateType",void 0),e([o({count:2})],s.prototype,"componentDataType",void 0),e([o({count:3})],s.prototype,"cullFace",void 0),e([o({count:3})],s.prototype,"vertexDiscardMode",void 0),e([o({count:3})],s.prototype,"doubleSidedMode",void 0),e([o({count:4})],s.prototype,"alphaDiscardMode",void 0),e([o({count:4})],s.prototype,"integratedMeshMode",void 0),e([o({count:3})],s.prototype,"oitPass",void 0),e([o({count:7})],s.prototype,"pbrMode",void 0),e([o({count:3})],s.prototype,"normalType",void 0),e([o({count:8})],s.prototype,"emissionSource",void 0),e([o()],s.prototype,"hasEmission",void 0),e([o()],s.prototype,"hasVertexColors",void 0),e([o()],s.prototype,"shadeNormals",void 0),e([o()],s.prototype,"hasSlicePlane",void 0),e([o()],s.prototype,"isGroundSlice",void 0),e([o()],s.prototype,"hasColorTexture",void 0),e([o()],s.prototype,"hasHighlightMixTexture",void 0),e([o()],s.prototype,"receiveAmbientOcclusion",void 0),e([o()],s.prototype,"receiveShadows",void 0),e([o()],s.prototype,"blendingEnabled",void 0),e([o()],s.prototype,"screenSpaceReflections",void 0),e([o()],s.prototype,"hasPolygonOffset",void 0),e([o()],s.prototype,"hasMetallicRoughnessTexture",void 0),e([o()],s.prototype,"hasOcclusionTexture",void 0),e([o()],s.prototype,"hasNormalTexture",void 0),e([o()],s.prototype,"hasOccludees",void 0),e([o()],s.prototype,"terrainDepthTest",void 0),e([o()],s.prototype,"cullAboveTerrain",void 0),e([o()],s.prototype,"hasNormalTextureTransform",void 0),e([o()],s.prototype,"cloudReflections",void 0),e([o()],s.prototype,"snowCover",void 0),e([o()],s.prototype,"renderOccluded",void 0),e([o()],s.prototype,"sphereDepthInterpolate",void 0),e([o()],s.prototype,"hasModelRotationScale",void 0);export{s as ComponentTechniqueConfiguration};
@@ -2,7 +2,9 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{create as r}from"../../../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as o}from"../../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{NormalAttribute as a}from"./NormalAttribute.glsl.js";import{VertexPositionPassParameters as l,VertexPositionDrawParameters as e}from"./VertexPosition.glsl.js";import{glsl as m}from"../../shaderModules/glsl.js";import{Matrix3DrawUniform as s}from"../../shaderModules/Matrix3DrawUniform.js";import{Matrix3PassUniform as t}from"../../shaderModules/Matrix3PassUniform.js";function i(r,o){switch(o.normalType){case 0:case 1:r.include(a,o),r.varyings.add("vNormalWorld","vec3"),r.varyings.add("vNormalView","vec3"),r.vertex.uniforms.add(new s("transformNormalGlobalFromModel",r=>r.transformNormalGlobalFromModel),new t("transformNormalViewFromGlobal",r=>r.transformNormalViewFromGlobal)).code.add(m`void forwardNormal() {
6
- vNormalWorld = transformNormalGlobalFromModel * normalModel();
7
- vNormalView = transformNormalViewFromGlobal * vNormalWorld;
8
- }`);break;case 2:r.vertex.code.add(m`void forwardNormal() {}`);break;default:o.normalType;case 3:}}class d extends l{constructor(){super(...arguments),this.transformNormalViewFromGlobal=r()}}class f extends e{constructor(){super(...arguments),this.transformNormalGlobalFromModel=r(),this.toMapSpace=o()}}export{i as VertexNormal,f as VertexNormalDrawParameters,d as VertexNormalPassParameters};
5
+ import{create as o}from"../../../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as r}from"../../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{NormalAttribute as a}from"./NormalAttribute.glsl.js";import{VertexPositionPassParameters as l,VertexPositionDrawParameters as e}from"./VertexPosition.glsl.js";import{glsl as m,If as s}from"../../shaderModules/glsl.js";import{Matrix3DrawUniform as t}from"../../shaderModules/Matrix3DrawUniform.js";import{Matrix3PassUniform as i}from"../../shaderModules/Matrix3PassUniform.js";function d(o,r){const{vertex:l,varyings:e}=o;switch(r.normalType){case 0:case 1:{o.include(a,r),e.add("vNormalWorld","vec3"),e.add("vNormalView","vec3"),l.uniforms.add(new i("transformNormalViewFromGlobal",o=>o.transformNormalViewFromGlobal));const{hasModelRotationScale:d}=r;d&&l.uniforms.add(new t("transformNormalGlobalFromModel",o=>o.transformNormalGlobalFromModel)),l.code.add(m`
6
+ void forwardNormal() {
7
+ vNormalWorld = ${s(d,m`transformNormalGlobalFromModel * `)} normalModel();
8
+ vNormalView = transformNormalViewFromGlobal * vNormalWorld;
9
+ }
10
+ `);break}case 2:o.vertex.code.add(m`void forwardNormal() {}`);break;default:r.normalType;case 3:}}class n extends l{constructor(){super(...arguments),this.transformNormalViewFromGlobal=o()}}class c extends e{constructor(){super(...arguments),this.transformNormalGlobalFromModel=o(),this.toMapSpace=r()}}export{d as VertexNormal,c as VertexNormalDrawParameters,n as VertexNormalPassParameters};
@@ -2,27 +2,31 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{create as r}from"../../../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as o}from"../../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{DoublePrecision as e}from"../util/DoublePrecision.glsl.js";import{Float3DrawUniform as a}from"../../shaderModules/Float3DrawUniform.js";import{Float3PassUniform as i}from"../../shaderModules/Float3PassUniform.js";import{glsl as t}from"../../shaderModules/glsl.js";import{Matrix3DrawUniform as m}from"../../shaderModules/Matrix3DrawUniform.js";import{Matrix3PassUniform as s}from"../../shaderModules/Matrix3PassUniform.js";import{Matrix4BindUniform as d}from"../../shaderModules/Matrix4BindUniform.js";import{NoParameters as l}from"../../../../../webgl/NoParameters.js";function n(r,o){const{attributes:l,vertex:n,varyings:f,fragment:v}=r;n.include(e,o),l.add("position","vec3"),f.add("vPositionWorldCameraRelative","vec3"),f.add("vPosition_view","vec3",{invariant:!0}),n.uniforms.add(new i("transformWorldFromViewTH",r=>r.transformWorldFromViewTH),new i("transformWorldFromViewTL",r=>r.transformWorldFromViewTL),new s("transformViewFromCameraRelativeRS",r=>r.transformViewFromCameraRelativeRS),new d("transformProjFromView",r=>r.camera.projectionMatrix),new m("transformWorldFromModelRS",r=>r.transformWorldFromModelRS),new a("transformWorldFromModelTH",r=>r.transformWorldFromModelTH),new a("transformWorldFromModelTL",r=>r.transformWorldFromModelTL)),n.code.add(t`vec3 positionWorldCameraRelative() {
6
- vec3 rotatedModelPosition = transformWorldFromModelRS * position;
7
- vec3 transform_CameraRelativeFromModel = dpAdd(
8
- transformWorldFromModelTL,
9
- transformWorldFromModelTH,
10
- -transformWorldFromViewTL,
11
- -transformWorldFromViewTH
12
- );
13
- return transform_CameraRelativeFromModel + rotatedModelPosition;
14
- }`),n.code.add(t`
5
+ import{create as r}from"../../../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as o}from"../../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{DoublePrecision as e}from"../util/DoublePrecision.glsl.js";import{Float3DrawUniform as a}from"../../shaderModules/Float3DrawUniform.js";import{Float3PassUniform as t}from"../../shaderModules/Float3PassUniform.js";import{If as i,glsl as m}from"../../shaderModules/glsl.js";import{Matrix3DrawUniform as s}from"../../shaderModules/Matrix3DrawUniform.js";import{Matrix3PassUniform as d}from"../../shaderModules/Matrix3PassUniform.js";import{Matrix4BindUniform as l}from"../../shaderModules/Matrix4BindUniform.js";import{NoParameters as n}from"../../../../../webgl/NoParameters.js";function f(r,o){const{attributes:n,vertex:f,varyings:v,fragment:W}=r;f.include(e,o),n.add("position","vec3"),v.add("vPositionWorldCameraRelative","vec3"),v.add("vPosition_view","vec3",{invariant:!0}),f.uniforms.add(new t("transformWorldFromViewTH",r=>r.transformWorldFromViewTH),new t("transformWorldFromViewTL",r=>r.transformWorldFromViewTL),new d("transformViewFromCameraRelativeRS",r=>r.transformViewFromCameraRelativeRS),new l("transformProjFromView",r=>r.camera.projectionMatrix),new a("transformWorldFromModelTH",r=>r.transformWorldFromModelTH),new a("transformWorldFromModelTL",r=>r.transformWorldFromModelTL));const{hasModelRotationScale:c}=o;c&&f.uniforms.add(new s("transformWorldFromModelRS",r=>r.transformWorldFromModelRS)),f.code.add(m`
6
+ vec3 positionWorldCameraRelative() {
7
+ vec3 rotatedModelPosition = ${i(c,m`transformWorldFromModelRS * `)} position;
8
+
9
+ vec3 transform_CameraRelativeFromModel = dpAdd(
10
+ transformWorldFromModelTL,
11
+ transformWorldFromModelTH,
12
+ -transformWorldFromViewTL,
13
+ -transformWorldFromViewTH
14
+ );
15
+
16
+ return transform_CameraRelativeFromModel + rotatedModelPosition;
17
+ }
18
+ `),f.code.add(m`
15
19
  void forwardPosition(float fOffset) {
16
20
  vPositionWorldCameraRelative = positionWorldCameraRelative();
17
21
  if (fOffset != 0.0) {
18
- vPositionWorldCameraRelative += fOffset * ${o.spherical?t`normalize(transformWorldFromViewTL + vPositionWorldCameraRelative)`:t`vec3(0.0, 0.0, 1.0)`};
22
+ vPositionWorldCameraRelative += fOffset * ${o.spherical?m`normalize(transformWorldFromViewTL + vPositionWorldCameraRelative)`:m`vec3(0.0, 0.0, 1.0)`};
19
23
  }
20
24
 
21
25
  vPosition_view = transformViewFromCameraRelativeRS * vPositionWorldCameraRelative;
22
26
  gl_Position = transformProjFromView * vec4(vPosition_view, 1.0);
23
27
  }
24
- `),v.uniforms.add(new i("transformWorldFromViewTL",r=>r.transformWorldFromViewTL)),n.code.add(t`vec3 positionWorld() {
28
+ `),W.uniforms.add(new t("transformWorldFromViewTL",r=>r.transformWorldFromViewTL)),f.code.add(m`vec3 positionWorld() {
25
29
  return transformWorldFromViewTL + vPositionWorldCameraRelative;
26
- }`),v.code.add(t`vec3 positionWorld() {
30
+ }`),W.code.add(m`vec3 positionWorld() {
27
31
  return transformWorldFromViewTL + vPositionWorldCameraRelative;
28
- }`)}class f extends l{constructor(){super(...arguments),this.transformWorldFromViewTH=o(),this.transformWorldFromViewTL=o(),this.transformViewFromCameraRelativeRS=r()}}class v extends l{constructor(){super(...arguments),this.transformWorldFromModelRS=r(),this.transformWorldFromModelTH=o(),this.transformWorldFromModelTL=o()}}export{n as VertexPosition,v as VertexPositionDrawParameters,f as VertexPositionPassParameters};
32
+ }`)}class v extends n{constructor(){super(...arguments),this.transformWorldFromViewTH=o(),this.transformWorldFromViewTL=o(),this.transformViewFromCameraRelativeRS=r()}}class W extends n{constructor(){super(...arguments),this.transformWorldFromModelRS=r(),this.transformWorldFromModelTH=o(),this.transformWorldFromModelTL=o()}}export{f as VertexPosition,W as VertexPositionDrawParameters,v as VertexPositionPassParameters};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import"../../../../../core/mathUtils.js";import"../../core/shaderLibrary/ScreenSpacePass.glsl.js";import"../../core/shaderLibrary/shading/Gamma.glsl.js";import"../../core/shaderModules/FloatPassUniform.js";import"../../core/shaderModules/glsl.js";import"../../core/shaderModules/Texture2DPassUniform.js";import"./GlowPresets.glsl.js";import"../../../../webgl/NoParameters.js";import"../../../../webgl/ShaderBuilder.js";export{G as GlowBlurPassParameters,b as build}from"../../../../../chunks/GlowBlur.glsl.js";
5
+ import"../../../../../core/mathUtils.js";import"../../core/shaderLibrary/ScreenSpacePass.glsl.js";import"../../core/shaderLibrary/shading/Gamma.glsl.js";import"../../core/shaderModules/FloatPassUniform.js";import"../../core/shaderModules/glsl.js";import"../../core/shaderModules/Texture2DPassUniform.js";import"../../../../webgl/NoParameters.js";import"../../../../webgl/ShaderBuilder.js";export{G as GlowBlurPassParameters,b as build}from"../../../../../chunks/GlowBlur.glsl.js";
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import{lerp as t}from"../../../../../core/mathUtils.js";import{watch as i,syncAndInitial as s}from"../../../../../core/reactiveUtils.js";import{property as r,subclass as o}from"../../../../../core/accessorSupport/decorators.js";import{b as a}from"../../../../../chunks/vec32.js";import{ZEROS as n}from"../../../../../core/libs/gl-matrix-2/factories/vec4f32.js";import{getReferenceEllipsoid as h}from"../../../../../geometry/ellipsoidUtils.js";import{InternalRenderCategory as l}from"../../../webgl.js";import{TransparentEnvironment as m}from"../TransparentEnvironment.js";import{G as c}from"../../../../../chunks/GlowBlur.glsl.js";import{GlowBlurTechnique as u}from"./GlowBlurTechnique.js";import{GlowBlurTechniqueConfiguration as p}from"./GlowBlurTechniqueConfiguration.js";import{G as d,a as g}from"../../../../../chunks/GlowComposition.glsl.js";import{GlowCompositionTechnique as _}from"./GlowCompositionTechnique.js";import{GlowCompositionTechniqueConfiguration as f}from"./GlowCompositionTechniqueConfiguration.js";import{blurRadiusPresets as b}from"./GlowPresets.glsl.js";import{ColorAttachment1 as w,DepthStencilAttachment as P}from"../../../../webgl/enums.js";let T=class extends m{constructor(e){super(e),this.consumes={required:[l.TRANSPARENT_ENVIRONMENT,"emissive"]},this.produces=l.TRANSPARENT_ENVIRONMENT,this._blurHorizontalConfiguration=new p,this._blurVerticalConfiguration=new p,this._compositionConfiguration=new f,this._compositionParameters=new d,this._blurParameters=new c,this._blurScale=3.06,this._glowEnabled=!1,this._glowResults=new Array,this._lodFactorsPresets={minDisperse:new g([.4,.18,.25,.12,.05,0]),maxDisperse:new g([0,0,.06,.12,.25,.57])};const t=h(e.view.spatialReference);this._atmosphereRadius=t.radius+t.atmosphereHeight;e.view.stage.renderView.techniques.precompile(_,this._compositionConfiguration)}initialize(){this.addHandles([i(()=>this._updateFogParameters(),()=>{},s),i(()=>this.view.qualitySettings.glow,e=>{this._glowEnabled=e,this.precompile(),this.requestRender(1)},s)])}_updateFogParameters(){const e=this.view.environment.weather;if("sunny"===e.type||"cloudy"===e.type)this._blurParameters.blurRadius=b[e.type],this._compositionParameters.distanceModifier=0;else{const i="foggy"===e.type?e.fogStrength:e.precipitation;this._blurParameters.blurRadius=t(b.cloudy,b[e.type],i),this._compositionParameters.distanceModifier="foggy"===e.type?t(3e-5,.005,e.fogStrength**3):t(4e-6,2e-4,(e.precipitation??0)**3)}this.requestRender(1)}precompile(){this._glowEnabled&&(this.techniques.precompile(u,this._blurHorizontalConfiguration),this._blurVerticalConfiguration.glowStage=1,this.techniques.precompile(u,this._blurVerticalConfiguration)),this._compositionConfiguration.blurEnabled=this._glowEnabled,this.techniques.precompile(_,this._compositionConfiguration)}render(e){const t=e.find(({name:e})=>e===l.TRANSPARENT_ENVIRONMENT),i=t.getAttachment(w);if(!i?.attachment)return t;const s=t.getAttachment(P);if(!this._glowEnabled){const e=this.techniques.get(_,this._compositionConfiguration);if(!e.compiled)return this.requestRender(1),t;const r=t.getTexture(),o=this.fboCache,{fullWidth:a,fullHeight:n}=this.bindParameters.camera,h=this.renderingContext,l=o.acquire(r.descriptor.width,r.descriptor.height,this.produces);return this._prepareFBO(l,a,n),this._compositionParameters.color=r,this._compositionParameters.emission=i.attachment,h.bindTechnique(e,this.bindParameters,this._compositionParameters),h.screen.draw(),l.attachDepth(s),l.attachColor(i,w),l}const r=this.techniques.get(u,this._blurHorizontalConfiguration),o=this.techniques.get(u,this._blurVerticalConfiguration),n=this.techniques.get(_,this._compositionConfiguration);if(!r.compiled||!o.compiled||!n.compiled)return this.requestRender(1),t;const h=t.getTexture(),m=this.fboCache,{fullWidth:c,fullHeight:p}=this.bindParameters.camera,d=this.renderingContext;let g=i.attachment,f=Math.ceil(c/2),b=Math.ceil(p/2);const T=5,R=this._blurParameters.blurRadius;for(let a=0;a<T;a++){const e=m.acquire(f,b,"glow horizontal",8);this._blurParameters.emissionsToDownsample=g,this._prepareFBO(e,f,b),d.bindTechnique(r,this.bindParameters,this._blurParameters),d.screen.draw();const t=m.acquire(f,b,"glow vertical",8);this._blurParameters.emissionsToDownsample=e.getTexture(),this._prepareFBO(t,f,b),d.bindTechnique(o,this.bindParameters,this._blurParameters),d.screen.draw(),e.release(),this._glowResults[a]=t,f=Math.ceil(f/2),b=Math.ceil(b/2),g=this._glowResults[a].getTexture(),this._blurParameters.blurRadius*=this._blurScale}this._blurParameters.blurRadius=R;const C=this.bindParameters.camera,q=a(C.eye);this._compositionParameters.atmosphereC=q**2-this._atmosphereRadius**2,this._compositionParameters.color=h,this._compositionParameters.emission=i.attachment,this._compositionParameters.lodTexture0=this._glowResults[0].getTexture(),this._compositionParameters.lodTexture1=this._glowResults[1].getTexture(),this._compositionParameters.lodTexture2=this._glowResults[2].getTexture(),this._compositionParameters.lodTexture3=this._glowResults[3].getTexture(),this._compositionParameters.lodTexture4=this._glowResults[4].getTexture(),this._compositionParameters.minDisperse=this._lodFactorsPresets.minDisperse,this._compositionParameters.maxDisperse=this._lodFactorsPresets.maxDisperse;const x=m.acquire(h.descriptor.width,h.descriptor.height,this.produces);return x.acquireColor(w,8,"emissive glow"),this._prepareFBO(x,c,p,!0),d.bindTechnique(n,this.bindParameters,this._compositionParameters),d.screen.draw(),this._glowResults.forEach(e=>e.release()),x.attachDepth(s),x}_prepareFBO(e,t,i,s=!1){const r=this.renderingContext;r.bindFramebuffer(e.fbo),r.setViewport(0,0,t,i),r.setClearColor(0,0,0,0),r.clear(16384),s&&r.clearBuffer(1,n)}get test(){return{compositionParameters:this._compositionParameters,blurParameters:this._blurParameters,setBlurLodCombination:e=>{this._compositionParameters.dispersionWeight=e},getPresets:this._lodFactorsPresets.minDisperse.presets,setMinDisperse:(e,t)=>{this._lodFactorsPresets.minDisperse.presets[e]=t},toggleTonemapping:e=>{this._compositionConfiguration.tonemappingEnabled=e,this.requestRender(1)}}}};e([r()],T.prototype,"consumes",void 0),e([r()],T.prototype,"produces",void 0),T=e([o("esri.views.3d.webgl-engine.effects.glow.GlowRenderNode")],T);export{T as GlowRenderNode};
5
+ import{__decorate as e}from"tslib";import{lerp as t}from"../../../../../core/mathUtils.js";import{watch as i,syncAndInitial as s}from"../../../../../core/reactiveUtils.js";import{property as r,subclass as o}from"../../../../../core/accessorSupport/decorators.js";import{b as a}from"../../../../../chunks/vec32.js";import{ZEROS as n}from"../../../../../core/libs/gl-matrix-2/factories/vec4f32.js";import{getReferenceEllipsoid as h}from"../../../../../geometry/ellipsoidUtils.js";import{InternalRenderCategory as l}from"../../../webgl.js";import{TransparentEnvironment as m}from"../TransparentEnvironment.js";import{G as c}from"../../../../../chunks/GlowBlur.glsl.js";import{GlowBlurTechnique as u}from"./GlowBlurTechnique.js";import{GlowBlurTechniqueConfiguration as p}from"./GlowBlurTechniqueConfiguration.js";import{G as d,a as g}from"../../../../../chunks/GlowComposition.glsl.js";import{GlowCompositionTechnique as _}from"./GlowCompositionTechnique.js";import{GlowCompositionTechniqueConfiguration as f}from"./GlowCompositionTechniqueConfiguration.js";import{ColorAttachment1 as w,DepthStencilAttachment as b}from"../../../../webgl/enums.js";let P=class extends m{constructor(e){super(e),this.consumes={required:[l.TRANSPARENT_ENVIRONMENT,"emissive"]},this.produces=l.TRANSPARENT_ENVIRONMENT,this._blurHorizontalConfiguration=new p,this._blurVerticalConfiguration=new p,this._compositionConfiguration=new f,this._compositionParameters=new d,this._blurParameters=new c,this._blurScalePerLod=3.06,this._logicalBlurRadius=.0037,this._glowEnabled=!1,this._glowResults=new Array,this._lodFactorsPresets={minDisperse:new g([.4,.18,.25,.12,.05,0]),maxDisperse:new g([0,0,.06,.12,.25,.57])};const t=h(e.view.spatialReference);this._atmosphereRadius=t.radius+t.atmosphereHeight;e.view.stage.renderView.techniques.precompile(_,this._compositionConfiguration)}initialize(){this.addHandles([i(()=>this._updateFogParameters(),()=>{},s),i(()=>this.view.qualitySettings.glow,e=>{this._glowEnabled=e,this.precompile(),this.requestRender(1)},s)])}_updateFogParameters(){const e=this.view.environment.weather;"sunny"===e.type||"cloudy"===e.type?this._compositionParameters.distanceModifier=0:this._compositionParameters.distanceModifier="foggy"===e.type?t(3e-5,.005,e.fogStrength**3):t(4e-6,2e-4,(e.precipitation??0)**3),this.requestRender(1)}precompile(){this._glowEnabled&&(this.techniques.precompile(u,this._blurHorizontalConfiguration),this._blurVerticalConfiguration.glowStage=1,this.techniques.precompile(u,this._blurVerticalConfiguration)),this._compositionConfiguration.blurEnabled=this._glowEnabled,this.techniques.precompile(_,this._compositionConfiguration)}render(e){const t=e.find(({name:e})=>e===l.TRANSPARENT_ENVIRONMENT),i=t.getAttachment(w);if(!i?.attachment)return t;const s=t.getAttachment(b);if(!this._glowEnabled){const e=this.techniques.get(_,this._compositionConfiguration);if(!e.compiled)return this.requestRender(1),t;const r=t.getTexture(),o=this.fboCache,{fullWidth:a,fullHeight:n}=this.bindParameters.camera,h=this.renderingContext,l=o.acquire(r.descriptor.width,r.descriptor.height,this.produces);return this._prepareFBO(l,a,n),this._compositionParameters.color=r,this._compositionParameters.emission=i.attachment,h.bindTechnique(e,this.bindParameters,this._compositionParameters),h.screen.draw(),l.attachDepth(s),l.attachColor(i,w),l}const r=this.techniques.get(u,this._blurHorizontalConfiguration),o=this.techniques.get(u,this._blurVerticalConfiguration),n=this.techniques.get(_,this._compositionConfiguration);if(!r.compiled||!o.compiled||!n.compiled)return this.requestRender(1),t;const h=t.getTexture(),m=this.fboCache,{fullWidth:c,fullHeight:p}=this.bindParameters.camera,d=this.renderingContext;let g=i.attachment,f=Math.ceil(c/2),P=Math.ceil(p/2);const T=5;this._blurParameters.blurRadius=this._logicalBlurRadius;for(let a=0;a<T;a++){const e=m.acquire(f,P,"glow horizontal",8);this._blurParameters.emissionsToDownsample=g,this._prepareFBO(e,f,P),d.bindTechnique(r,this.bindParameters,this._blurParameters),d.screen.draw();const t=m.acquire(f,P,"glow vertical",8);this._blurParameters.emissionsToDownsample=e.getTexture(),this._prepareFBO(t,f,P),d.bindTechnique(o,this.bindParameters,this._blurParameters),d.screen.draw(),e.release(),this._glowResults[a]=t,f=Math.ceil(f/2),P=Math.ceil(P/2),g=this._glowResults[a].getTexture(),this._blurParameters.blurRadius*=this._blurScalePerLod}const R=this.bindParameters.camera,C=a(R.eye);this._compositionParameters.atmosphereC=C**2-this._atmosphereRadius**2,this._compositionParameters.color=h,this._compositionParameters.emission=i.attachment,this._compositionParameters.lodTexture0=this._glowResults[0].getTexture(),this._compositionParameters.lodTexture1=this._glowResults[1].getTexture(),this._compositionParameters.lodTexture2=this._glowResults[2].getTexture(),this._compositionParameters.lodTexture3=this._glowResults[3].getTexture(),this._compositionParameters.lodTexture4=this._glowResults[4].getTexture(),this._compositionParameters.minDisperse=this._lodFactorsPresets.minDisperse,this._compositionParameters.maxDisperse=this._lodFactorsPresets.maxDisperse;const q=m.acquire(h.descriptor.width,h.descriptor.height,this.produces);return q.acquireColor(w,8,"emissive glow"),this._prepareFBO(q,c,p,!0),d.bindTechnique(n,this.bindParameters,this._compositionParameters),d.screen.draw(),this._glowResults.forEach(e=>e.release()),q.attachDepth(s),q}_prepareFBO(e,t,i,s=!1){const r=this.renderingContext;r.bindFramebuffer(e.fbo),r.setViewport(0,0,t,i),r.setClearColor(0,0,0,0),r.clear(16384),s&&r.clearBuffer(1,n)}get test(){return{compositionParameters:this._compositionParameters,blurParameters:this._blurParameters,setBlurLodCombination:e=>{this._compositionParameters.dispersionWeight=e},getPresets:this._lodFactorsPresets.minDisperse.presets,setMinDisperse:(e,t)=>{this._lodFactorsPresets.minDisperse.presets[e]=t},toggleTonemapping:e=>{this._compositionConfiguration.tonemappingEnabled=e,this.requestRender(1)}}}};e([r()],P.prototype,"consumes",void 0),e([r()],P.prototype,"produces",void 0),P=e([o("esri.views.3d.webgl-engine.effects.glow.GlowRenderNode")],P);export{P as GlowRenderNode};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as t}from"tslib";import{parameter as e}from"../../core/shaderTechnique/ShaderTechniqueConfiguration.js";import{DefaultTechniqueConfiguration as o}from"../../materials/DefaultTechniqueConfiguration.js";class i extends o{constructor(){super(...arguments),this.type=0,this.silhouette=!1,this.legacy=!1,this.terrainDepthTest=!1,this.cullAboveTerrain=!1,this.spherical=!1,this.occlusionPass=!1,this.normalType=1}}t([e({count:3})],i.prototype,"type",void 0),t([e()],i.prototype,"silhouette",void 0),t([e()],i.prototype,"legacy",void 0),t([e()],i.prototype,"terrainDepthTest",void 0),t([e()],i.prototype,"cullAboveTerrain",void 0),t([e()],i.prototype,"spherical",void 0);export{i as EdgeShaderTechniqueConfiguration};
5
+ import{__decorate as t}from"tslib";import{parameter as e}from"../../core/shaderTechnique/ShaderTechniqueConfiguration.js";import{DefaultTechniqueConfiguration as o}from"../../materials/DefaultTechniqueConfiguration.js";class i extends o{constructor(){super(...arguments),this.type=0,this.silhouette=!1,this.legacy=!1,this.terrainDepthTest=!1,this.cullAboveTerrain=!1,this.spherical=!1,this.hasModelRotationScale=!0,this.occlusionPass=!1,this.normalType=1}}t([e({count:3})],i.prototype,"type",void 0),t([e()],i.prototype,"silhouette",void 0),t([e()],i.prototype,"legacy",void 0),t([e()],i.prototype,"terrainDepthTest",void 0),t([e()],i.prototype,"cullAboveTerrain",void 0),t([e()],i.prototype,"spherical",void 0);export{i as EdgeShaderTechniqueConfiguration};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{clamp as e,deg2rad as t}from"../../../../core/mathUtils.js";import{fromMat4 as i}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{invert as r}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as n,rotate as o}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as l,create as c}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{h as u,p as f,n as p,e as h,j as d,t as m,c as g,d as b,b as v,B as x,a as S,g as y,i as z}from"../../../../chunks/vec32.js";import{create as O,fromValues as P}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromArray as _,create as j,freeze as R}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{create as D}from"../../../../geometry/support/aaBoundingRect.js";import{BufferViewVec4u8 as M}from"../../../../geometry/support/buffer/BufferView.js";import{evaluateModelTransformScale as V}from"../../layers/support/FastSymbolUpdates.js";import{debugFlags as C}from"../../support/debugFlags.js";import{isColorHighlightOrOLID as A,isColor as F}from"../core/shaderLibrary/ShaderOutput.js";import{HUDVerticalPixelOffset as w}from"../core/shaderLibrary/hud/HUD.glsl.js";import{GLTextureMaterialBindParameters as T,GLTextureMaterial as E}from"../lib/GLTextureMaterial.js";import{Material as L}from"../lib/Material.js";import{SeparateScreenSizePerspectiveEvaluators as U}from"../lib/screenSizePerspectiveUtils.js";import{assert as B}from"../lib/Util.js";import{writePosition as I,writeNormal as W,writeColor as H,writeBufferVec2 as G,writeBufferFloat as N,writeBufferVec4 as X,writeBufferVec4Zeros as Y,writeOlidColor as q}from"./internal/bufferWriterUtils.js";import{verticalOffsetAtDistance as k}from"./internal/MaterialUtil.js";import{c as J,f as K}from"../../../../chunks/HUDMaterial.glsl.js";import{getInstanceLayout as Q,baseLayout as Z,HUDMaterialTechnique as $}from"../shaders/HUDMaterialTechnique.js";import{HUDMaterialTechniqueConfiguration as ee}from"../shaders/HUDMaterialTechniqueConfiguration.js";import{alphaCutoff as te}from"../../../../webscene/support/AlphaCutoff.js";class ie extends L{constructor(e,t){super(e,je),this.produces=new Map([[14,e=>A(e)&&!this.parameters.drawAsLabel],[15,e=>A(e)&&this.parameters.drawAsLabel],[13,()=>this.parameters.useVisibilityPixel],[19,e=>this.parameters.draped&&A(e)]]),this._visible=!0,this._configuration=new ee(t)}getConfiguration(e,t){const i=this.parameters.draped;return super.getConfiguration(e,t,this._configuration),this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasVerticalOffset=!!this.parameters.verticalOffset,this._configuration.hasScreenSizePerspective=!!this.parameters.screenSizePerspective,this._configuration.screenCenterOffsetUnitsEnabled="screen"===this.parameters.centerOffsetUnits,this._configuration.hasPolygonOffset=this.parameters.polygonOffset,this._configuration.draped=i,this._configuration.visibilityPixelEnabled=this.parameters.useVisibilityPixel,this._configuration.pixelSnappingEnabled=this.parameters.pixelSnappingEnabled,this._configuration.signedDistanceFieldEnabled=this.parameters.textureIsSignedDistanceField,this._configuration.sampleSignedDistanceFieldTexelCenter=this.parameters.sampleSignedDistanceFieldTexelCenter,this._configuration.hasRotation=this.parameters.hasRotation,this._configuration.hasVVSize=!!this.parameters.vvSize,this._configuration.hasVVColor=!!this.parameters.vvColor,this._configuration.occlusionPass=13===t.slot,this._configuration.occludedFragmentFade=!i&&this.parameters.occludedFragmentFade,this._configuration.horizonCullingEnabled=this.parameters.horizonCullingEnabled,this._configuration.isFocused=this.parameters.isFocused,this._configuration.depthTestEnabled=this.parameters.depthEnabled||13===t.slot,F(e)&&(this._configuration.debugDrawLabelBorder=!!C.LABELS_SHOW_BORDER),this._configuration.oitPass=t.oitPass,this._configuration.terrainDepthTest=t.terrainDepthTest,this._configuration.cullAboveTerrain=t.cullAboveTerrain,this._configuration}intersect(e,t,s,a,n,o){const{options:{selectionMode:l,hud:c,excludeLabels:S},point:y,camera:z}=s,{parameters:P}=this;if(!l||!c||S&&P.isLabel||!e.visible||!y||!z)return;const j=e.attributes.get("featureAttribute"),R=null==j?null:_(j.data,Se),{scaleX:D,scaleY:M}=De(R,P,z.pixelRatio),V=e.attributes.get("position"),C=e.attributes.get("size"),A=e.attributes.get("normal"),F=e.attributes.get("rotation"),w=e.attributes.get("centerOffsetAndDistance");B(V.size>=3);const T=J(P),E="screen"===this.parameters.centerOffsetUnits;for(let _=0;_<V.data.length/V.size;_++){const e=_*V.size;u(le,V.data[e],V.data[e+1],V.data[e+2]),f(le,le,t),f(le,le,z.viewMatrix);const a=_*w.size;if(u(ve,w.data[a],w.data[a+1],w.data[a+2]),!E&&(le[0]+=ve[0],le[1]+=ve[1],0!==ve[2])){const e=ve[2];p(ve,le),h(le,le,d(ve,ve,e))}const n=_*A.size;u(ce,A.data[n],A.data[n+1],A.data[n+2]),m(ce,ce,i(me,t));const{normal:l,cosAngle:c}=ae(ce,z,ye),S=Ve(this.parameters,le,c,z,oe);if(g(le,le,l,S),z.applyProjection(le,ue),ue[0]>-1){E&&(ve[0]||ve[1])&&(ue[0]+=ve[0]*z.pixelRatio,0!==ve[1]&&(ue[1]+=oe.alignmentEvaluator.apply(ve[1])*z.pixelRatio),z.unapplyProjection(ue,le)),ue[0]+=this.parameters.screenOffset[0]*z.pixelRatio,ue[1]+=this.parameters.screenOffset[1]*z.pixelRatio,ue[0]=Math.floor(ue[0]),ue[1]=Math.floor(ue[1]);const e=_*C.size;Pe[0]=C.data[e],Pe[1]=C.data[e+1],oe.evaluator.applyVec2(Pe,Pe);const t=ze*z.pixelRatio;let i=0;if(P.textureIsSignedDistanceField){i=Math.min(P.outlineSize,.5*Pe[0])*z.pixelRatio/2}Pe[0]*=D,Pe[1]*=M;const a=_*F.size,n=P.rotation+F.data[a];if(ne(y,ue[0],ue[1],Pe,t,i,n,P,T)){const e=s.ray;if(f(pe,le,r(ge,z.viewMatrix)),ue[0]=y[0],ue[1]=y[1],z.unprojectFromRenderScreen(ue,le)){const t=O();b(t,e.direction);const i=1/v(t);d(t,t,i);o(x(e.origin,le)*i,t,-1,pe)}}}}}intersectDraped(e,t,i,s,r){const a=e.attributes.get("position"),n=e.attributes.get("size"),o=e.attributes.get("rotation"),l=this.parameters,c=J(l),u=e.attributes.get("featureAttribute"),f=null==u?null:_(u.data,Se),{scaleX:p,scaleY:h}=De(f,l,e.screenToWorldRatio),d=Oe*e.screenToWorldRatio;for(let m=0;m<a.data.length/a.size;m++){const t=m*a.size,u=a.data[t],f=a.data[t+1],g=m*n.size;Pe[0]=n.data[g],Pe[1]=n.data[g+1];let b=0;if(l.textureIsSignedDistanceField){b=Math.min(l.outlineSize,.5*Pe[0])*e.screenToWorldRatio/2}Pe[0]*=p,Pe[1]*=h;const v=m*o.size,x=l.rotation+o.data[v];ne(i,u,f,Pe,d,b,x,l,c)&&s(r.distance,r.normal,-1)}}createBufferWriter(){return new Re}applyShaderOffsets(e,t,s,r,a,n,o){m(fe,s,i(me,r));const l=ae(fe,n,ye),c=Me(v(t),n),u=Ve(this.parameters,t,l.cosAngle,n,o);g(t,t,l.normal,u+c),g(e,e,fe,u+c);const f=a[3]+u;this._applyPolygonOffsetView(t,l,f,n,t),this._applyCenterOffsetView(t,a,t)}applyShaderOffsetsNDC(e,t,i,s,r){return this._applyCenterOffsetNDC(e,t,i,s),null!=r&&b(r,s),this._applyPolygonOffsetNDC(s,t,i,s),s}_applyPolygonOffsetView(t,i,s,r,a){const n=r.aboveGround?1:-1;let o=Math.sign(s);0===o&&(o=n);const l=n*o;if(this.parameters.shaderPolygonOffset<=0)return b(a,t);const c=e(Math.abs(i.cosAngle),.01,1),u=1-Math.sqrt(1-c*c)/c/r.viewport[2];return d(a,t,l>0?u:1/u),a}_applyCenterOffsetView(e,t,i){const s="screen"!==this.parameters.centerOffsetUnits;return i!==e&&b(i,e),s&&(i[0]+=t[0],i[1]+=t[1],t[2]&&(p(ce,i),S(i,i,d(ce,ce,t[2])))),i}_applyCenterOffsetNDC(e,t,i,s){const r="screen"!==this.parameters.centerOffsetUnits;return s!==e&&b(s,e),r||(s[0]+=t[0]/i.fullWidth*2,s[1]+=t[1]/i.fullHeight*2),s}_applyPolygonOffsetNDC(e,t,i,s){const r=this.parameters.shaderPolygonOffset;if(e!==s&&b(s,e),r){const e=i.aboveGround?1:-1,a=e*Math.sign(t[3]);s[2]-=(a||e)*r}return s}set visible(e){this._visible=e}get visible(){const{color:e,outlineSize:t,outlineColor:i}=this.parameters,s=e[3]>=te||t>=te&&i[3]>=te;return this._visible&&s}createGLMaterial(e){return new se(e)}calculateRelativeScreenBounds(e,t,i=D()){return re(this.parameters,e,t,i),i[2]=i[0]+e[0],i[3]=i[1]+e[1],i}}class se extends E{constructor(e){super({...e,...e.material.parameters})}beginSlot(e){return this.updateTexture(this._material.parameters.textureId),this._material.setParameters(this.textureBindParameters),this.getTechnique($,e)}}function re(e,t,i,s){s[0]=e.anchorPosition[0]*-t[0]+e.screenOffset[0]*i,s[1]=e.anchorPosition[1]*-t[1]+e.screenOffset[1]*i}function ae(e,t,i){return f(i.normal,e,t.viewInverseTransposeMatrix),i.cosAngle=y(i.normal,_e),i}function ne(e,i,s,r,a,l,c,u,f){let p=i-a-r[0]*f[0],h=p+r[0]+2*a,d=s-a-r[1]*f[1],m=d+r[1]+2*a;const g=u.distanceFieldBoundingBox;return u.textureIsSignedDistanceField&&null!=g&&(p+=r[0]*g[0],d+=r[1]*g[1],h-=r[0]*(1-g[2]),m-=r[1]*(1-g[3]),p-=l,h+=l,d-=l,m+=l),n(de,i,s),o(he,e,de,t(c)),he[0]>p&&he[0]<h&&he[1]>d&&he[1]<m}const oe=new U,le=O(),ce=O(),ue=j(),fe=O(),pe=O(),he=c(),de=c(),me=s(),ge=a(),be=j(),ve=O(),xe=O(),Se=j(),ye={normal:O(),cosAngle:0},ze=1,Oe=2,Pe=l(0,0),_e=P(0,0,1);class je extends T{constructor(){super(...arguments),this.renderOccluded=1,this.testsTransparentRenderOrder=0,this.isDecoration=!1,this.color=R(1,1,1,1),this.polygonOffset=!1,this.anchorPosition=l(.5,.5),this.screenOffset=[0,0],this.shaderPolygonOffset=1e-5,this.textureIsSignedDistanceField=!1,this.sampleSignedDistanceFieldTexelCenter=!1,this.outlineColor=R(1,1,1,1),this.outlineSize=0,this.distanceFieldBoundingBox=j(),this.rotation=0,this.hasRotation=!1,this.vvSizeEnabled=!1,this.vvSize=null,this.vvColor=null,this.vvOpacity=null,this.vvSymbolAnchor=null,this.vvSymbolRotationMatrix=null,this.hasSlicePlane=!1,this.pixelSnappingEnabled=!0,this.useVisibilityPixel=!0,this.occludedFragmentFade=!1,this.horizonCullingEnabled=!1,this.occludedVisibilityMode="hidden",this.centerOffsetUnits="world",this.drawAsLabel=!1,this.depthEnabled=!0,this.isFocused=!0,this.focusStyle="bright",this.draped=!1,this.isLabel=!1}get hasVVSize(){return!!this.vvSize}get hasVVColor(){return!!this.vvColor}get hasVVOpacity(){return!!this.vvOpacity}}class Re{constructor(){this.layout=Q(),this.baseInstanceLayout=Z}elementCount(e){return e.get("position").indices.length}elementCountBaseInstance(e){return e.get("uv0").indices.length}write(e,t,i,s,r,a){const{position:n,normal:o,color:l,size:c,rotation:u,centerOffsetAndDistance:f,featureAttribute:p,uvi:h}=r;I(i.get("position"),e,n,a),W(i.get("normal"),t,o,a);const d=i.get("position").indices.length;let m=0,g=0,b=K,v=K;const x=i.get("uvi")?.data;x&&x.length>=4&&(m=x[0],g=x[1],b=x[2],v=x[3]);for(let S=0;S<d;++S){const e=a+S;h.setValues(e,m,g,b,v)}if(H(i.get("color"),4,l,a),G(i.get("size"),c,a),N(i.get("rotation"),u,a),i.get("centerOffsetAndDistance")?X(i.get("centerOffsetAndDistance"),f,a):Y(f,a,d),i.get("featureAttribute")?X(i.get("featureAttribute"),p,a):Y(p,a,d),null!=s){const e=i.get("position")?.indices;if(e){const t=e.length,i=r.getField("olidColor",M);q(s,i,t,a)}}return{numVerticesPerItem:1,numItems:d}}writeBaseInstance(e,t){const{uv0:i}=t;G(e.get("uv0"),i,0)}intersect(e,t,i,s,a,n,o){const{options:{selectionMode:l,hud:c,excludeLabels:m},point:S,camera:y}=s;if(!l||!c||m&&t.isLabel||!S)return;const P=this.layout.createView(e),{position:_,normal:j,rotation:R,size:D,featureAttribute:M,centerOffsetAndDistance:V}=P,C="screen"===t.centerOffsetUnits,A=J(t);if(null==_||null==j||null==R||null==D||null==V||null==y)return;const F=null==M?null:M.getVec(0,Se),{scaleX:w,scaleY:T}=De(F,t,y.pixelRatio),E=_.count;for(let L=0;L<E;L++){if(_.getVec(L,le),null!=i&&z(le,le,i),f(le,le,y.viewMatrix),V.getVec(L,be),u(ve,be[0],be[1],be[2]),!C&&(le[0]+=ve[0],le[1]+=ve[1],0!==ve[2])){const e=ve[2];p(ve,le),h(le,le,d(ve,ve,e))}j.getVec(L,ce),ae(ce,y,ye);const e=Ve(t,le,ye.cosAngle,y,oe);if(g(le,le,ye.normal,e),y.applyProjection(le,ue),ue[0]>-1){C&&(ve[0]||ve[1])&&(ue[0]+=ve[0]*y.pixelRatio,0!==ve[1]&&(ue[1]+=oe.alignmentEvaluator.apply(ve[1])*y.pixelRatio),y.unapplyProjection(ue,le)),ue[0]+=t.screenOffset[0]*y.pixelRatio,ue[1]+=t.screenOffset[1]*y.pixelRatio,ue[0]=Math.floor(ue[0]),ue[1]=Math.floor(ue[1]),D.getVec(L,Pe),oe.evaluator.applyVec2(Pe,Pe);const e=ze*y.pixelRatio;let i=0;if(t.textureIsSignedDistanceField){i=Math.min(t.outlineSize,.5*Pe[0])*y.pixelRatio/2}Pe[0]*=w,Pe[1]*=T;const a=R.get(L),n=t.rotation+a;if(ne(S,ue[0],ue[1],Pe,e,i,n,t,A)){const e=s.ray;if(f(pe,le,r(ge,y.viewMatrix)),ue[0]=S[0],ue[1]=S[1],y.unprojectFromRenderScreen(ue,le)){const t=O();b(t,e.direction);const i=1/v(t);d(t,t,i);o(x(e.origin,le)*i,t,L,pe)}}}}}}function De(e,t,i){return null==e||null==t.vvSize?{scaleX:i,scaleY:i}:(V(xe,t,e),{scaleX:xe[0]*i,scaleY:xe[1]*i})}function Me(e,t){const i=t.computeRenderPixelSizeAtDist(e)*w;return(t.aboveGround?1:-1)*i}function Ve(e,t,i,s,r){if(!e.verticalOffset?.screenLength){const s=v(t);return r.update(i,s,e.screenSizePerspective,e.screenSizePerspectiveMinPixelReferenceSize,e.screenSizePerspectiveAlignment,null),0}const a=v(t),n=e.screenSizePerspectiveAlignment??e.screenSizePerspective,o=k(s,a,e.verticalOffset,i,n,e.screenSizePerspectiveMinPixelReferenceSize);return r.update(i,a,e.screenSizePerspective,e.screenSizePerspectiveMinPixelReferenceSize,e.screenSizePerspectiveAlignment,null),o}export{ie as HUDMaterial,je as Parameters};
5
+ import{clamp as e,deg2rad as t}from"../../../../core/mathUtils.js";import{fromMat4 as i}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{invert as r}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as n,rotate as o}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as l,create as c}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{h as u,p as f,n as p,e as h,j as d,t as m,c as g,d as b,b as v,B as x,a as S,g as y,i as O}from"../../../../chunks/vec32.js";import{create as z,fromValues as P}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromArray as _,create as j,freeze as R}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{create as D}from"../../../../geometry/support/aaBoundingRect.js";import{BufferViewVec4u8 as M}from"../../../../geometry/support/buffer/BufferView.js";import{evaluateModelTransformScale as V}from"../../layers/support/FastSymbolUpdates.js";import{debugFlags as A}from"../../support/debugFlags.js";import{isColorHighlightOrOLID as C,isColor as F}from"../core/shaderLibrary/ShaderOutput.js";import{HUDVerticalPixelOffset as w}from"../core/shaderLibrary/hud/HUD.glsl.js";import{GLTextureMaterialBindParameters as T,GLTextureMaterial as L}from"../lib/GLTextureMaterial.js";import{Material as U}from"../lib/Material.js";import{SeparateScreenSizePerspectiveEvaluators as B}from"../lib/screenSizePerspectiveUtils.js";import{assert as E}from"../lib/Util.js";import{writePosition as I,writeNormal as W,writeColor as H,writeBufferVec2 as G,writeBufferFloat as N,writeBufferVec4 as X,writeBufferVec4Zeros as Y,writeOlidColor as q}from"./internal/bufferWriterUtils.js";import{verticalOffsetAtDistance as k}from"./internal/MaterialUtil.js";import{c as J,f as K}from"../../../../chunks/HUDMaterial.glsl.js";import{getInstanceLayout as Q,baseLayout as Z,HUDMaterialTechnique as $}from"../shaders/HUDMaterialTechnique.js";import{HUDMaterialTechniqueConfiguration as ee}from"../shaders/HUDMaterialTechniqueConfiguration.js";import{alphaCutoff as te}from"../../../../webscene/support/AlphaCutoff.js";class ie extends U{constructor(e,t){super(e,je),this.produces=new Map([[14,e=>C(e)&&!this.parameters.drawAsLabel],[15,e=>C(e)&&this.parameters.drawAsLabel],[13,()=>this.parameters.useVisibilityPixel],[19,e=>this.parameters.draped&&C(e)]]),this._visible=!0,this._configuration=new ee(t)}getConfiguration(e,t){const i=this.parameters.draped;return super.getConfiguration(e,t,this._configuration),this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasVerticalOffset=!!this.parameters.verticalOffset,this._configuration.hasScreenSizePerspective=!!this.parameters.screenSizePerspective,this._configuration.screenCenterOffsetUnitsEnabled="screen"===this.parameters.centerOffsetUnits,this._configuration.hasPolygonOffset=this.parameters.polygonOffset,this._configuration.draped=i,this._configuration.visibilityPixelEnabled=this.parameters.useVisibilityPixel,this._configuration.pixelSnappingEnabled=this.parameters.pixelSnappingEnabled,this._configuration.signedDistanceFieldEnabled=this.parameters.textureIsSignedDistanceField,this._configuration.sampleSignedDistanceFieldTexelCenter=this.parameters.sampleSignedDistanceFieldTexelCenter,this._configuration.hasRotation=this.parameters.hasRotation,this._configuration.hasVVSize=!!this.parameters.vvSize,this._configuration.hasVVColor=!!this.parameters.vvColor,this._configuration.occlusionPass=13===t.slot,this._configuration.occludedFragmentFade=!i&&this.parameters.occludedFragmentFade,this._configuration.isFocused=this.parameters.isFocused,this._configuration.depthTestEnabled=this.parameters.depthEnabled||13===t.slot,F(e)&&(this._configuration.debugDrawLabelBorder=!!A.LABELS_SHOW_BORDER),this._configuration.oitPass=t.oitPass,this._configuration.terrainDepthTest=t.terrainDepthTest,this._configuration.cullAboveTerrain=t.cullAboveTerrain,this._configuration}intersect(e,t,s,a,n,o){const{options:{selectionMode:l,hud:c,excludeLabels:S},point:y,camera:O}=s,{parameters:P}=this;if(!l||!c||S&&P.isLabel||!e.visible||!y||!O)return;const j=e.attributes.get("featureAttribute"),R=null==j?null:_(j.data,Se),{scaleX:D,scaleY:M}=De(R,P,O.pixelRatio),V=e.attributes.get("position"),A=e.attributes.get("size"),C=e.attributes.get("normal"),F=e.attributes.get("rotation"),w=e.attributes.get("centerOffsetAndDistance");E(V.size>=3);const T=J(P),L="screen"===this.parameters.centerOffsetUnits;for(let _=0;_<V.data.length/V.size;_++){const e=_*V.size;u(le,V.data[e],V.data[e+1],V.data[e+2]),f(le,le,t),f(le,le,O.viewMatrix);const a=_*w.size;if(u(ve,w.data[a],w.data[a+1],w.data[a+2]),!L&&(le[0]+=ve[0],le[1]+=ve[1],0!==ve[2])){const e=ve[2];p(ve,le),h(le,le,d(ve,ve,e))}const n=_*C.size;u(ce,C.data[n],C.data[n+1],C.data[n+2]),m(ce,ce,i(me,t));const{normal:l,cosAngle:c}=ae(ce,O,ye),S=Ve(this.parameters,le,c,O,oe);if(g(le,le,l,S),O.applyProjection(le,ue),ue[0]>-1){L&&(ve[0]||ve[1])&&(ue[0]+=ve[0]*O.pixelRatio,0!==ve[1]&&(ue[1]+=oe.alignmentEvaluator.apply(ve[1])*O.pixelRatio),O.unapplyProjection(ue,le)),ue[0]+=this.parameters.screenOffset[0]*O.pixelRatio,ue[1]+=this.parameters.screenOffset[1]*O.pixelRatio,ue[0]=Math.floor(ue[0]),ue[1]=Math.floor(ue[1]);const e=_*A.size;Pe[0]=A.data[e],Pe[1]=A.data[e+1],oe.evaluator.applyVec2(Pe,Pe);const t=Oe*O.pixelRatio;let i=0;if(P.textureIsSignedDistanceField){i=Math.min(P.outlineSize,.5*Pe[0])*O.pixelRatio/2}Pe[0]*=D,Pe[1]*=M;const a=_*F.size,n=P.rotation+F.data[a];if(ne(y,ue[0],ue[1],Pe,t,i,n,P,T)){const e=s.ray;if(f(pe,le,r(ge,O.viewMatrix)),ue[0]=y[0],ue[1]=y[1],O.unprojectFromRenderScreen(ue,le)){const t=z();b(t,e.direction);const i=1/v(t);d(t,t,i);o(x(e.origin,le)*i,t,-1,pe)}}}}}intersectDraped(e,t,i,s,r){const a=e.attributes.get("position"),n=e.attributes.get("size"),o=e.attributes.get("rotation"),l=this.parameters,c=J(l),u=e.attributes.get("featureAttribute"),f=null==u?null:_(u.data,Se),{scaleX:p,scaleY:h}=De(f,l,e.screenToWorldRatio),d=ze*e.screenToWorldRatio;for(let m=0;m<a.data.length/a.size;m++){const t=m*a.size,u=a.data[t],f=a.data[t+1],g=m*n.size;Pe[0]=n.data[g],Pe[1]=n.data[g+1];let b=0;if(l.textureIsSignedDistanceField){b=Math.min(l.outlineSize,.5*Pe[0])*e.screenToWorldRatio/2}Pe[0]*=p,Pe[1]*=h;const v=m*o.size,x=l.rotation+o.data[v];ne(i,u,f,Pe,d,b,x,l,c)&&s(r.distance,r.normal,-1)}}createBufferWriter(){return new Re}applyShaderOffsets(e,t,s,r,a,n,o){m(fe,s,i(me,r));const l=ae(fe,n,ye),c=Me(v(t),n),u=Ve(this.parameters,t,l.cosAngle,n,o);g(t,t,l.normal,u+c),g(e,e,fe,u+c);const f=a[3]+u;this._applyPolygonOffsetView(t,l,f,n,t),this._applyCenterOffsetView(t,a,t)}applyShaderOffsetsNDC(e,t,i,s,r){return this._applyCenterOffsetNDC(e,t,i,s),null!=r&&b(r,s),this._applyPolygonOffsetNDC(s,t,i,s),s}_applyPolygonOffsetView(t,i,s,r,a){const n=r.aboveGround?1:-1;let o=Math.sign(s);0===o&&(o=n);const l=n*o;if(this.parameters.shaderPolygonOffset<=0)return b(a,t);const c=e(Math.abs(i.cosAngle),.01,1),u=1-Math.sqrt(1-c*c)/c/r.viewport[2];return d(a,t,l>0?u:1/u),a}_applyCenterOffsetView(e,t,i){const s="screen"!==this.parameters.centerOffsetUnits;return i!==e&&b(i,e),s&&(i[0]+=t[0],i[1]+=t[1],t[2]&&(p(ce,i),S(i,i,d(ce,ce,t[2])))),i}_applyCenterOffsetNDC(e,t,i,s){const r="screen"!==this.parameters.centerOffsetUnits;return s!==e&&b(s,e),r||(s[0]+=t[0]/i.fullWidth*2,s[1]+=t[1]/i.fullHeight*2),s}_applyPolygonOffsetNDC(e,t,i,s){const r=this.parameters.shaderPolygonOffset;if(e!==s&&b(s,e),r){const e=i.aboveGround?1:-1,a=e*Math.sign(t[3]);s[2]-=(a||e)*r}return s}set visible(e){this._visible=e}get visible(){const{color:e,outlineSize:t,outlineColor:i}=this.parameters,s=e[3]>=te||t>=te&&i[3]>=te;return this._visible&&s}createGLMaterial(e){return new se(e)}calculateRelativeScreenBounds(e,t,i=D()){return re(this.parameters,e,t,i),i[2]=i[0]+e[0],i[3]=i[1]+e[1],i}}class se extends L{constructor(e){super({...e,...e.material.parameters})}beginSlot(e){return this.updateTexture(this._material.parameters.textureId),this._material.setParameters(this.textureBindParameters),this.getTechnique($,e)}}function re(e,t,i,s){s[0]=e.anchorPosition[0]*-t[0]+e.screenOffset[0]*i,s[1]=e.anchorPosition[1]*-t[1]+e.screenOffset[1]*i}function ae(e,t,i){return f(i.normal,e,t.viewInverseTransposeMatrix),i.cosAngle=y(i.normal,_e),i}function ne(e,i,s,r,a,l,c,u,f){let p=i-a-r[0]*f[0],h=p+r[0]+2*a,d=s-a-r[1]*f[1],m=d+r[1]+2*a;const g=u.distanceFieldBoundingBox;return u.textureIsSignedDistanceField&&null!=g&&(p+=r[0]*g[0],d+=r[1]*g[1],h-=r[0]*(1-g[2]),m-=r[1]*(1-g[3]),p-=l,h+=l,d-=l,m+=l),n(de,i,s),o(he,e,de,t(c)),he[0]>p&&he[0]<h&&he[1]>d&&he[1]<m}const oe=new B,le=z(),ce=z(),ue=j(),fe=z(),pe=z(),he=c(),de=c(),me=s(),ge=a(),be=j(),ve=z(),xe=z(),Se=j(),ye={normal:z(),cosAngle:0},Oe=1,ze=2,Pe=l(0,0),_e=P(0,0,1);class je extends T{constructor(){super(...arguments),this.renderOccluded=1,this.testsTransparentRenderOrder=0,this.isDecoration=!1,this.color=R(1,1,1,1),this.polygonOffset=!1,this.anchorPosition=l(.5,.5),this.screenOffset=[0,0],this.shaderPolygonOffset=1e-5,this.textureIsSignedDistanceField=!1,this.sampleSignedDistanceFieldTexelCenter=!1,this.outlineColor=R(1,1,1,1),this.outlineSize=0,this.distanceFieldBoundingBox=j(),this.rotation=0,this.hasRotation=!1,this.vvSizeEnabled=!1,this.vvSize=null,this.vvColor=null,this.vvOpacity=null,this.vvSymbolAnchor=null,this.vvSymbolRotationMatrix=null,this.hasSlicePlane=!1,this.pixelSnappingEnabled=!0,this.useVisibilityPixel=!0,this.occludedFragmentFade=!1,this.occludedVisibilityMode="hidden",this.centerOffsetUnits="world",this.drawAsLabel=!1,this.depthEnabled=!0,this.isFocused=!0,this.focusStyle="bright",this.draped=!1,this.isLabel=!1}get hasVVSize(){return!!this.vvSize}get hasVVColor(){return!!this.vvColor}get hasVVOpacity(){return!!this.vvOpacity}}class Re{constructor(){this.layout=Q(),this.baseInstanceLayout=Z}elementCount(e){return e.get("position").indices.length}elementCountBaseInstance(e){return e.get("uv0").indices.length}write(e,t,i,s,r,a){const{position:n,normal:o,color:l,size:c,rotation:u,centerOffsetAndDistance:f,featureAttribute:p,uvi:h}=r;I(i.get("position"),e,n,a),W(i.get("normal"),t,o,a);const d=i.get("position").indices.length;let m=0,g=0,b=K,v=K;const x=i.get("uvi")?.data;x&&x.length>=4&&(m=x[0],g=x[1],b=x[2],v=x[3]);for(let S=0;S<d;++S){const e=a+S;h.setValues(e,m,g,b,v)}if(H(i.get("color"),4,l,a),G(i.get("size"),c,a),N(i.get("rotation"),u,a),i.get("centerOffsetAndDistance")?X(i.get("centerOffsetAndDistance"),f,a):Y(f,a,d),i.get("featureAttribute")?X(i.get("featureAttribute"),p,a):Y(p,a,d),null!=s){const e=i.get("position")?.indices;if(e){const t=e.length,i=r.getField("olidColor",M);q(s,i,t,a)}}return{numVerticesPerItem:1,numItems:d}}writeBaseInstance(e,t){const{uv0:i}=t;G(e.get("uv0"),i,0)}intersect(e,t,i,s,a,n,o){const{options:{selectionMode:l,hud:c,excludeLabels:m},point:S,camera:y}=s;if(!l||!c||m&&t.isLabel||!S)return;const P=this.layout.createView(e),{position:_,normal:j,rotation:R,size:D,featureAttribute:M,centerOffsetAndDistance:V}=P,A="screen"===t.centerOffsetUnits,C=J(t);if(null==_||null==j||null==R||null==D||null==V||null==y)return;const F=null==M?null:M.getVec(0,Se),{scaleX:w,scaleY:T}=De(F,t,y.pixelRatio),L=_.count;for(let U=0;U<L;U++){if(_.getVec(U,le),null!=i&&O(le,le,i),f(le,le,y.viewMatrix),V.getVec(U,be),u(ve,be[0],be[1],be[2]),!A&&(le[0]+=ve[0],le[1]+=ve[1],0!==ve[2])){const e=ve[2];p(ve,le),h(le,le,d(ve,ve,e))}j.getVec(U,ce),ae(ce,y,ye);const e=Ve(t,le,ye.cosAngle,y,oe);if(g(le,le,ye.normal,e),y.applyProjection(le,ue),ue[0]>-1){A&&(ve[0]||ve[1])&&(ue[0]+=ve[0]*y.pixelRatio,0!==ve[1]&&(ue[1]+=oe.alignmentEvaluator.apply(ve[1])*y.pixelRatio),y.unapplyProjection(ue,le)),ue[0]+=t.screenOffset[0]*y.pixelRatio,ue[1]+=t.screenOffset[1]*y.pixelRatio,ue[0]=Math.floor(ue[0]),ue[1]=Math.floor(ue[1]),D.getVec(U,Pe),oe.evaluator.applyVec2(Pe,Pe);const e=Oe*y.pixelRatio;let i=0;if(t.textureIsSignedDistanceField){i=Math.min(t.outlineSize,.5*Pe[0])*y.pixelRatio/2}Pe[0]*=w,Pe[1]*=T;const a=R.get(U),n=t.rotation+a;if(ne(S,ue[0],ue[1],Pe,e,i,n,t,C)){const e=s.ray;if(f(pe,le,r(ge,y.viewMatrix)),ue[0]=S[0],ue[1]=S[1],y.unprojectFromRenderScreen(ue,le)){const t=z();b(t,e.direction);const i=1/v(t);d(t,t,i);o(x(e.origin,le)*i,t,U,pe)}}}}}}function De(e,t,i){return null==e||null==t.vvSize?{scaleX:i,scaleY:i}:(V(xe,t,e),{scaleX:xe[0]*i,scaleY:xe[1]*i})}function Me(e,t){const i=t.computeRenderPixelSizeAtDist(e)*w;return(t.aboveGround?1:-1)*i}function Ve(e,t,i,s,r){if(!e.verticalOffset?.screenLength){const s=v(t);return r.update(i,s,e.screenSizePerspective,e.screenSizePerspectiveMinPixelReferenceSize,e.screenSizePerspectiveAlignment,null),0}const a=v(t),n=e.screenSizePerspectiveAlignment??e.screenSizePerspective,o=k(s,a,e.verticalOffset,i,n,e.screenSizePerspectiveMinPixelReferenceSize);return r.update(i,a,e.screenSizePerspective,e.screenSizePerspectiveMinPixelReferenceSize,e.screenSizePerspectiveAlignment,null),o}export{ie as HUDMaterial,je as Parameters};