@arcgis/core 5.1.0-next.105 → 5.1.0-next.106

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 (383) hide show
  1. package/analysis/AreaMeasurementAnalysis.d.ts +5 -5
  2. package/analysis/DimensionAnalysis.d.ts +3 -3
  3. package/analysis/DimensionSimpleStyle.d.ts +2 -2
  4. package/analysis/DirectLineMeasurementAnalysis.d.ts +4 -4
  5. package/analysis/DistanceMeasurementAnalysis.d.ts +4 -4
  6. package/analysis/ElevationProfileAnalysis.d.ts +3 -3
  7. package/analysis/LengthDimension.d.ts +2 -2
  8. package/analysis/LineOfSightAnalysis.d.ts +4 -4
  9. package/analysis/ShadowCast/DiscreteOptions.d.ts +7 -3
  10. package/analysis/ShadowCast/MinDurationOptions.d.ts +5 -1
  11. package/analysis/ShadowCast/TotalDurationOptions.d.ts +7 -3
  12. package/analysis/ShadowCast/types.d.ts +1 -1
  13. package/analysis/ShadowCastAnalysis.d.ts +11 -6
  14. package/analysis/SliceAnalysis.d.ts +4 -4
  15. package/analysis/SlicePlane.d.ts +3 -3
  16. package/analysis/Viewshed.d.ts +2 -2
  17. package/analysis/ViewshedAnalysis.d.ts +3 -3
  18. package/analysis/VolumeMeasurement/VolumeMeasurementCutFillOptions.d.ts +1 -1
  19. package/analysis/VolumeMeasurementAnalysis.d.ts +3 -3
  20. package/applications/Components/imageryUtils.d.ts +24 -0
  21. package/applications/Components/layerUtils.d.ts +21 -0
  22. package/applications/Components/layerUtils.js +2 -0
  23. package/applications/Components/templateUtils.d.ts +11 -1
  24. package/applications/Components/templateUtils.js +1 -1
  25. package/arcgisGlobal.d.ts +1 -0
  26. package/assets/components/assets/icon/buttons16.json +1 -0
  27. package/assets/components/assets/icon/buttons24.json +1 -0
  28. package/assets/components/assets/icon/buttons32.json +1 -0
  29. package/assets/components/assets/icon/entityTypes16.json +1 -0
  30. package/assets/components/assets/icon/entityTypes24.json +1 -0
  31. package/assets/components/assets/icon/entityTypes32.json +1 -0
  32. package/assets/esri/core/t9n/Units_ar.json +1 -1
  33. package/assets/esri/core/t9n/Units_bg.json +1 -1
  34. package/assets/esri/core/t9n/Units_bs.json +1 -1
  35. package/assets/esri/core/t9n/Units_ca.json +1 -1
  36. package/assets/esri/core/t9n/Units_cs.json +1 -1
  37. package/assets/esri/core/t9n/Units_da.json +1 -1
  38. package/assets/esri/core/t9n/Units_de.json +1 -1
  39. package/assets/esri/core/t9n/Units_el.json +1 -1
  40. package/assets/esri/core/t9n/Units_es.json +1 -1
  41. package/assets/esri/core/t9n/Units_et.json +1 -1
  42. package/assets/esri/core/t9n/Units_fi.json +1 -1
  43. package/assets/esri/core/t9n/Units_fr.json +1 -1
  44. package/assets/esri/core/t9n/Units_he.json +1 -1
  45. package/assets/esri/core/t9n/Units_hr.json +1 -1
  46. package/assets/esri/core/t9n/Units_hu.json +1 -1
  47. package/assets/esri/core/t9n/Units_id.json +1 -1
  48. package/assets/esri/core/t9n/Units_it.json +1 -1
  49. package/assets/esri/core/t9n/Units_ja.json +1 -1
  50. package/assets/esri/core/t9n/Units_ko.json +1 -1
  51. package/assets/esri/core/t9n/Units_lt.json +1 -1
  52. package/assets/esri/core/t9n/Units_lv.json +1 -1
  53. package/assets/esri/core/t9n/Units_nl.json +1 -1
  54. package/assets/esri/core/t9n/Units_no.json +1 -1
  55. package/assets/esri/core/t9n/Units_pl.json +1 -1
  56. package/assets/esri/core/t9n/Units_pt-BR.json +1 -1
  57. package/assets/esri/core/t9n/Units_pt-PT.json +1 -1
  58. package/assets/esri/core/t9n/Units_ro.json +1 -1
  59. package/assets/esri/core/t9n/Units_ru.json +1 -1
  60. package/assets/esri/core/t9n/Units_sk.json +1 -1
  61. package/assets/esri/core/t9n/Units_sl.json +1 -1
  62. package/assets/esri/core/t9n/Units_sr.json +1 -1
  63. package/assets/esri/core/t9n/Units_sv.json +1 -1
  64. package/assets/esri/core/t9n/Units_th.json +1 -1
  65. package/assets/esri/core/t9n/Units_tr.json +1 -1
  66. package/assets/esri/core/t9n/Units_uk.json +1 -1
  67. package/assets/esri/core/t9n/Units_vi.json +1 -1
  68. package/assets/esri/core/t9n/Units_zh-CN.json +1 -1
  69. package/assets/esri/core/t9n/Units_zh-HK.json +1 -1
  70. package/assets/esri/core/t9n/Units_zh-TW.json +1 -1
  71. package/assets/esri/core/workers/RemoteClient.js +1 -1
  72. package/assets/esri/core/workers/chunks/{6854b28853f5dd195110.js → 01c70c27aa3a955e2928.js} +1 -1
  73. package/assets/esri/core/workers/chunks/{2dced41ff2aa1bd86665.js → 065dd2fdc834146423c7.js} +1 -1
  74. package/assets/esri/core/workers/chunks/{a0e72b107991ba38a9f0.js → 15920af0c4f46773b06e.js} +1 -1
  75. package/assets/esri/core/workers/chunks/179c9fe4ac83b42e5976.js +1 -0
  76. package/assets/esri/core/workers/chunks/1d1929f98d941179be29.js +2 -0
  77. package/assets/esri/core/workers/chunks/{24247ee93f43fff5e596.js.LICENSE.txt → 1d1929f98d941179be29.js.LICENSE.txt} +1 -3
  78. package/assets/esri/core/workers/chunks/1ebb613bbe09fcf274d8.js +1 -0
  79. package/assets/esri/core/workers/chunks/24b43fb12fc3009fdc30.js +1 -0
  80. package/assets/esri/core/workers/chunks/2b9661700743d1f9717e.js +1 -0
  81. package/assets/esri/core/workers/chunks/2f0a3b22fc46d832e240.js +1 -0
  82. package/assets/esri/core/workers/chunks/340f2c996f62f7f5ceae.js +1 -0
  83. package/assets/esri/core/workers/chunks/549d348ca181d06aefb7.js +2 -0
  84. package/assets/esri/core/workers/chunks/{7485d59d60d61737d662.js → 55b765c72d13b3b911f9.js} +1 -1
  85. package/assets/esri/core/workers/chunks/5cdf87e7a59ace38df87.js +1 -0
  86. package/assets/esri/core/workers/chunks/622bdd1b9d5d292ec12b.js +1 -0
  87. package/assets/esri/core/workers/chunks/{359dbfbfb9acfb18bc6e.js → 63ea4191d441efd2f146.js} +1 -1
  88. package/assets/esri/core/workers/chunks/69c9eb93553b006b640d.js +2 -0
  89. package/assets/esri/core/workers/chunks/6d20d741b8ae1a45b422.js +1 -0
  90. package/assets/esri/core/workers/chunks/702a3ef9e1b3442cbee7.js +1 -0
  91. package/assets/esri/core/workers/chunks/762e23466308f22d7076.js +1 -0
  92. package/assets/esri/core/workers/chunks/{52219561c144e5cb4442.js → 770611659b38066a6228.js} +1 -1
  93. package/assets/esri/core/workers/chunks/{e90afd914f2ccd4f5374.js → 7ce60331f94ee0a5d674.js} +6 -6
  94. package/assets/esri/core/workers/chunks/7e02e5c6979090fe3ea7.js +1 -0
  95. package/assets/esri/core/workers/chunks/825db2ea15308ee6e5dc.js +1 -0
  96. package/assets/esri/core/workers/chunks/8330302096d4312a4393.js +1 -0
  97. package/assets/esri/core/workers/chunks/885eac78a76184efa1e5.js +1 -0
  98. package/assets/esri/core/workers/chunks/{79dc7045d9a2d43ba8df.js → 890b7a1153b7f65eba9a.js} +1 -1
  99. package/assets/esri/core/workers/chunks/{44636ef119c6a576470b.js → 94eab215bab3e4e0e5b5.js} +1 -1
  100. package/assets/esri/core/workers/chunks/95dee5853c6e89f15ea9.js +1 -0
  101. package/assets/esri/core/workers/chunks/a5b9ae4c93f9af7589f2.js +1 -0
  102. package/assets/esri/core/workers/chunks/{fb415b01f0f1d644832d.js → a8ae00e06f98e04aee8e.js} +1 -1
  103. package/assets/esri/core/workers/chunks/aaad0d3e82ed917d3886.js +1 -0
  104. package/assets/esri/core/workers/chunks/b3e8ab68fc38306f13c6.js +1 -0
  105. package/assets/esri/core/workers/chunks/{39a8e6c9d710d3faea3c.js → b9850fe7dcdaed0c327c.js} +1 -1
  106. package/assets/esri/core/workers/chunks/{f7e386ece75afb6e4be5.js → bc249bb667f0564ad093.js} +1 -1
  107. package/assets/esri/core/workers/chunks/{9b89cc85c1b5d561df7c.js → bd59cb5abc67e46f1b2c.js} +2 -2
  108. package/assets/esri/core/workers/chunks/{a943bd2e6fb7443c2b66.js → be817be7c81fb630122f.js} +1 -1
  109. package/assets/esri/core/workers/chunks/c4872cf3b71d00f450e1.js +1 -0
  110. package/assets/esri/core/workers/chunks/c5ab346a226df1894302.js +1 -0
  111. package/assets/esri/core/workers/chunks/{1e8d5bfc5f8c2664190c.js → d859c046a3ea42530bff.js} +1 -1
  112. package/assets/esri/core/workers/chunks/da29cf0e64065631a470.js +1 -0
  113. package/assets/esri/core/workers/chunks/{7617bd0f3a70dfe61637.js → dcba6c766eee8b90381a.js} +1 -1
  114. package/assets/esri/core/workers/chunks/ddebc1dc10a2d207389f.js +1 -0
  115. package/assets/esri/core/workers/chunks/e393fd61deb2e7f22ee6.js +1 -0
  116. package/assets/esri/core/workers/chunks/ea2bf7c543cc536400b7.js +30 -0
  117. package/assets/esri/core/workers/chunks/ece30bfd5c49b8d99752.js +1 -0
  118. package/assets/esri/core/workers/chunks/ecf4d07917efc97eb991.js +1 -0
  119. package/assets/esri/core/workers/chunks/ee56290e600cbeb25a00.js +1 -0
  120. package/assets/esri/core/workers/chunks/f52c6efc5a2abf5ac845.js +1 -0
  121. package/assets/esri/core/workers/chunks/f7fe17a22390a24d6df8.js +2 -0
  122. package/assets/esri/core/workers/chunks/f9324420f2c6ac240f63.js +1 -0
  123. package/assets/esri/core/workers/chunks/{855bf811cd79b97c169a.js → fae2c8f053927559fff0.js} +1 -1
  124. package/assets/esri/core/workers/chunks/fc1fe1f58a65a1694c09.js +1 -0
  125. package/assets/esri/themes/base/widgets/_BatchAttributeForm.scss +84 -1
  126. package/assets/esri/themes/dark/main.css +1 -1
  127. package/assets/esri/themes/light/main.css +1 -1
  128. package/assets/esri/themes/light/view.css +1 -1
  129. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm.json +1 -1
  130. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_en.json +1 -1
  131. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ar.json +1 -1
  132. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_bg.json +1 -1
  133. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_bs.json +1 -1
  134. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ca.json +1 -1
  135. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_cs.json +1 -1
  136. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_da.json +1 -1
  137. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_de.json +1 -1
  138. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_el.json +1 -1
  139. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_es.json +1 -1
  140. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_et.json +1 -1
  141. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_fi.json +1 -1
  142. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_fr.json +1 -1
  143. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_he.json +1 -1
  144. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_hr.json +1 -1
  145. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_hu.json +1 -1
  146. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_id.json +1 -1
  147. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_it.json +1 -1
  148. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ja.json +1 -1
  149. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ko.json +1 -1
  150. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_lt.json +1 -1
  151. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_lv.json +1 -1
  152. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_nl.json +1 -1
  153. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_no.json +1 -1
  154. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_pl.json +1 -1
  155. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_pt-BR.json +1 -1
  156. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_pt-PT.json +1 -1
  157. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ro.json +1 -1
  158. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ru.json +1 -1
  159. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_sk.json +1 -1
  160. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_sl.json +1 -1
  161. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_sr.json +1 -1
  162. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_sv.json +1 -1
  163. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_th.json +1 -1
  164. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_tr.json +1 -1
  165. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_uk.json +1 -1
  166. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_vi.json +1 -1
  167. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_zh-CN.json +1 -1
  168. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_zh-HK.json +1 -1
  169. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_zh-TW.json +1 -1
  170. package/chunks/ComponentShader.glsl.js +11 -15
  171. package/config.js +1 -1
  172. package/core/generatorUtils.js +2 -0
  173. package/core/libs/gl-matrix-2/factories/vec2f64.js +1 -1
  174. package/core/libs/gl-matrix-2/math/vec2.js +1 -1
  175. package/core/mathUtils.js +1 -1
  176. package/core/typedArrayUtil.js +1 -1
  177. package/geometry/HeightModelInfo.js +1 -1
  178. package/geometry/geometryEngine.d.ts +2 -2
  179. package/geometry/support/buffer/BufferView.js +1 -1
  180. package/geometry/support/vcsData.js +1 -1
  181. package/geometry/support/vcsLookup.js +1 -1
  182. package/kernel.js +1 -1
  183. package/layers/DimensionLayer.d.ts +5 -5
  184. package/layers/FeatureLayer.d.ts +2 -2
  185. package/layers/GaussianSplatLayer.d.ts +3 -3
  186. package/layers/LineOfSightLayer.d.ts +5 -5
  187. package/layers/ParquetLayer.d.ts +6 -4
  188. package/layers/SubtypeGroupLayer.d.ts +2 -2
  189. package/layers/ViewshedLayer.d.ts +3 -3
  190. package/layers/graphics/sources/ParquetSource.js +1 -1
  191. package/layers/graphics/sources/parquet/FileProvider.js +2 -0
  192. package/layers/graphics/sources/parquet/PortalParquetFileProvider.js +2 -0
  193. package/layers/graphics/sources/parquet/PortalParquetLayerFileProvider.js +2 -0
  194. package/layers/graphics/sources/parquet/UrlsFileProvider.js +2 -0
  195. package/layers/graphics/sources/parquet/createFileProvider.js +2 -0
  196. package/layers/graphics/sources/support/ParquetSourceWorker.js +1 -1
  197. package/layers/knowledgeGraph/KnowledgeGraphSublayer.d.ts +1 -1
  198. package/layers/raster/datasets/ImageAuxRaster.js +1 -1
  199. package/layers/raster/datasets/pixelReader.js +1 -1
  200. package/layers/raster/formats/JpgPlus.js +1 -1
  201. package/layers/raster/formats/RasterCodec.js +1 -1
  202. package/layers/raster/functions/clipUtils.js +1 -1
  203. package/layers/support/AggregateField.d.ts +2 -1
  204. package/layers/support/LayerContingentValuesCache.js +1 -1
  205. package/layers/support/SubtypeSublayer.d.ts +4 -4
  206. package/layers/support/parquetUtils.d.ts +18 -7
  207. package/layers/support/parquetUtils.js +1 -1
  208. package/layers/support/rasterFunctionUtils.d.ts +2 -2
  209. package/layers/video/VideoController.js +1 -1
  210. package/libs/parquet/parquet.js +1 -1
  211. package/linkChart/ChronologicalLayoutSettings.d.ts +1 -1
  212. package/networks/CircuitManager.d.ts +3 -3
  213. package/networks/UnitIdentifierManager.d.ts +1 -1
  214. package/networks/UnitIdentifierManager.js +1 -1
  215. package/networks/UtilityNetwork.d.ts +2 -2
  216. package/networks/UtilityNetwork.js +1 -1
  217. package/networks/support/Circuit.d.ts +1 -1
  218. package/networks/support/CircuitLocation.d.ts +1 -1
  219. package/networks/support/CircuitSection.d.ts +1 -1
  220. package/networks/support/Subcircuit.d.ts +1 -1
  221. package/networks/support/TraceJobInfo.js +1 -1
  222. package/networks/support/jsonTypes.d.ts +10 -3
  223. package/package.json +2 -2
  224. package/popup/FieldInfo.d.ts +4 -2
  225. package/popup/support/FieldInfoFormat.d.ts +3 -2
  226. package/rest/featureService/FeatureService.d.ts +1 -1
  227. package/rest/knowledgeGraph/FieldIndex.d.ts +1 -1
  228. package/rest/knowledgeGraph/GraphObjectType.d.ts +2 -2
  229. package/rest/knowledgeGraph/GraphSearch.d.ts +1 -1
  230. package/rest/knowledgeGraph/GraphSearchStreaming.d.ts +1 -1
  231. package/rest/networks/circuits/support/ExportCircuitsParameters.d.ts +19 -1
  232. package/rest/networks/circuits/support/ExportCircuitsResult.js +1 -1
  233. package/rest/networks/circuits/support/VerifyCircuitsParameters.d.ts +18 -10
  234. package/rest/networks/circuits/support/VerifyCircuitsParameters.js +1 -1
  235. package/rest/networks/support/TraceParameters.js +1 -1
  236. package/rest/networks/support/TraceResult.js +1 -1
  237. package/rest/networks/trace.js +1 -1
  238. package/rest/networks/unitIdentifiers/support/QueryUnitIdentifiersParameters.js +1 -1
  239. package/rest/support/AreasAndLengthsParameters.d.ts +1 -1
  240. package/rest/support/GeneralizeParameters.d.ts +1 -1
  241. package/rest/support/Query.d.ts +1 -1
  242. package/rest/support/RelationParameters.d.ts +1 -1
  243. package/rest/support/types.d.ts +1 -1
  244. package/support/revision.js +1 -1
  245. package/symbols/CIMSymbol.d.ts +1 -1
  246. package/views/2d/analysis/AreaMeasurementAnalysisView2D.d.ts +1 -0
  247. package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
  248. package/views/2d/layers/features/layerAdapters/ParquetLayerAdapter.js +1 -1
  249. package/views/2d/layers/features/sources/strategies/ParquetSnapshotLoadStrategy.js +1 -1
  250. package/views/2d/layers/features/sources/strategies/ParquetTileLoadStrategy.js +1 -1
  251. package/views/2d/layers/features/sources/strategies/chunks/ParquetSnapshotSourceChunk.js +1 -1
  252. package/views/2d/layers/features/sources/strategies/chunks/ParquetSourceChunk.js +1 -1
  253. package/views/3d/analysis/AreaMeasurementAnalysisView3D.d.ts +1 -0
  254. package/views/3d/analysis/DimensionAnalysisView3D.d.ts +7 -6
  255. package/views/3d/analysis/DirectLineMeasurementAnalysisView3D.d.ts +2 -0
  256. package/views/3d/analysis/LineOfSightAnalysisView3D.d.ts +2 -1
  257. package/views/3d/analysis/ShadowCastAnalysisView3D.d.ts +5 -1
  258. package/views/3d/analysis/SliceAnalysisView3D.d.ts +4 -3
  259. package/views/3d/analysis/Viewshed/ViewshedDrawToolRenderer.js +2 -0
  260. package/views/3d/analysis/Viewshed/ViewshedEditTool.js +1 -1
  261. package/views/3d/analysis/Viewshed/ViewshedInteractionVisuals.js +2 -0
  262. package/views/3d/analysis/Viewshed/ViewshedPlacementController.js +2 -0
  263. package/views/3d/analysis/Viewshed/ViewshedPlacementOperation.js +2 -0
  264. package/views/3d/analysis/Viewshed/ViewshedPlacementPointPlugin.js +2 -0
  265. package/views/3d/analysis/Viewshed/ViewshedPlacementRootPlugin.js +2 -0
  266. package/views/3d/analysis/Viewshed/ViewshedSnappingController.js +2 -0
  267. package/views/3d/analysis/Viewshed/ViewshedSubTool.js +1 -1
  268. package/views/3d/analysis/Viewshed/ViewshedSubVisualization.js +1 -1
  269. package/views/3d/analysis/Viewshed/ViewshedTool.js +1 -1
  270. package/views/3d/analysis/Viewshed/ViewshedTool2.js +1 -1
  271. package/views/3d/analysis/Viewshed/analysisViewRegister.js +1 -1
  272. package/views/3d/analysis/Viewshed/placementUtils.js +2 -0
  273. package/views/3d/analysis/Viewshed/toolLifecycleUtils.js +2 -0
  274. package/views/3d/analysis/Viewshed/viewshedSubToolUtils.js +1 -1
  275. package/views/3d/analysis/Viewshed/viewshedToolUtils.js +1 -1
  276. package/views/3d/analysis/ViewshedAnalysisView3D.d.ts +4 -3
  277. package/views/3d/analysis/ViewshedAnalysisView3D.js +1 -1
  278. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillController.js +1 -1
  279. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementShiftTool.js +1 -1
  280. package/views/3d/layers/GaussianSplatLayerView3D.js +1 -1
  281. package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.js +1 -1
  282. package/views/3d/layers/graphics/polygonUtils.js +1 -1
  283. package/views/3d/layers/support/UVWorkspace.js +2 -0
  284. package/views/3d/layers/support/patternUtils.js +1 -1
  285. package/views/3d/layers/support/uvUtils.js +1 -1
  286. package/views/3d/support/gaussianSplatting/GaussianSplatDataStore.js +1 -1
  287. package/views/3d/support/gaussianSplatting/GaussianSplatIntersectionHandler.js +1 -1
  288. package/views/3d/support/gaussianSplatting/GaussianSplatTextureAtlas.js +1 -1
  289. package/views/3d/support/gaussianSplatting/GaussianTile.js +1 -1
  290. package/views/3d/support/meshProcessing.js +1 -1
  291. package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
  292. package/views/3d/webgl-engine/core/shaderLibrary/TextureBackedBuffer.glsl.js +8 -8
  293. package/views/3d/webgl-engine/core/shaderLibrary/TextureBackedBufferFields.glsl.js +13 -9
  294. package/views/3d/webgl-engine/core/shaderLibrary/attributes/PathVertexPosition.glsl.js +63 -49
  295. package/views/3d/webgl-engine/lib/AttributeArray.js +1 -1
  296. package/views/3d/webgl-engine/lib/GaussianSplatRenderNode.js +1 -1
  297. package/views/3d/webgl-engine/lib/Geometry.js +1 -1
  298. package/views/3d/webgl-engine/lib/PathBuilder.js +1 -1
  299. package/views/3d/webgl-engine/lib/PathCapBuilder.js +1 -1
  300. package/views/3d/webgl-engine/lib/PathExtruder.js +1 -1
  301. package/views/3d/webgl-engine/lib/PathGeometry.js +1 -1
  302. package/views/3d/webgl-engine/lib/PathGeometryData.js +1 -1
  303. package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBackedBufferFieldCreation.js +1 -1
  304. package/views/3d/webgl-engine/materials/PathLayouts.js +2 -0
  305. package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
  306. package/views/3d/webgl-engine/materials/PathTechnique.js +1 -1
  307. package/views/3d/webgl-engine/materials/PathTechniqueConfiguration.js +1 -1
  308. package/views/3d/webgl-engine/materials/PatternMaterial.js +1 -1
  309. package/views/3d/webgl-engine/materials/internal/bufferWriterUtils.js +1 -1
  310. package/views/3d/webgl-engine/shaders/SphereDepthInterpolate.glsl.js +2 -3
  311. package/views/PopupView.d.ts +77 -1
  312. package/views/PopupView.js +1 -1
  313. package/views/layers/DimensionLayerView.d.ts +2 -1
  314. package/views/layers/LineOfSightLayerView.d.ts +2 -1
  315. package/views/layers/ViewshedLayerView.d.ts +2 -1
  316. package/webscene/Slide.js +1 -1
  317. package/widgets/Attachments/types.d.ts +1 -1
  318. package/widgets/BatchAttributeForm/BatchAttributeFormViewModel.d.ts +38 -5
  319. package/widgets/BatchAttributeForm/BatchAttributeFormViewModel.js +1 -1
  320. package/widgets/BatchAttributeForm/ReactiveContingentValuesManager.js +2 -0
  321. package/widgets/BatchAttributeForm/ReactiveGraphic.js +1 -1
  322. package/widgets/BatchAttributeForm/attachmentUtils.js +1 -1
  323. package/widgets/BatchAttributeForm/batchAttributeFormUtils.js +1 -1
  324. package/widgets/BatchAttributeForm/css.js +1 -1
  325. package/widgets/BatchAttributeForm/inputs/AttachmentElementInput.d.ts +11 -0
  326. package/widgets/BatchAttributeForm/inputs/AttachmentElementInput.js +1 -1
  327. package/widgets/BatchAttributeForm/inputs/FieldInput.d.ts +77 -0
  328. package/widgets/BatchAttributeForm/inputs/FieldInput.js +1 -1
  329. package/widgets/BatchAttributeForm/inputs/support/createBatchFormInputs.js +1 -1
  330. package/widgets/BatchAttributeForm/inputs/support/inputUtils.js +1 -1
  331. package/widgets/BatchAttributeForm/interfaceUtils.js +2 -0
  332. package/widgets/BatchAttributeForm/templates/support/createBatchFormTemplate.js +1 -1
  333. package/widgets/BatchAttributeForm/types.d.ts +30 -2
  334. package/widgets/BatchAttributeForm.d.ts +52 -1
  335. package/widgets/BatchAttributeForm.js +1 -1
  336. package/widgets/CoordinateConversion/CoordinateConversionViewModel.js +1 -1
  337. package/widgets/Editor.d.ts +1 -1
  338. package/widgets/FeatureTable/FieldColumn.js +1 -1
  339. package/widgets/FeatureTable/support/FeatureStore.js +1 -1
  340. package/widgets/LayerList/LayerListItem.js +1 -1
  341. package/widgets/TimeSlider.d.ts +3 -3
  342. package/widgets/VideoPlayer/VideoPlayerViewModel.d.ts +10 -0
  343. package/widgets/VideoPlayer/VideoPlayerViewModel.js +1 -1
  344. package/widgets/support/ContingentValuesManager.js +1 -1
  345. package/widgets/support/forms/formUtils.js +1 -1
  346. package/assets/esri/core/workers/chunks/11b0d3a825fe50dd1e84.js +0 -1
  347. package/assets/esri/core/workers/chunks/130851b81f04e6a008cd.js +0 -1
  348. package/assets/esri/core/workers/chunks/1a3426276dc82a8a80f2.js +0 -1
  349. package/assets/esri/core/workers/chunks/1c8a21b7b60c0709e6b2.js +0 -1
  350. package/assets/esri/core/workers/chunks/24247ee93f43fff5e596.js +0 -2
  351. package/assets/esri/core/workers/chunks/276cb6a1cdd26d0e1444.js +0 -1
  352. package/assets/esri/core/workers/chunks/2f903bd3a2611e7f0946.js +0 -30
  353. package/assets/esri/core/workers/chunks/2fda38219d778f0447b5.js +0 -1
  354. package/assets/esri/core/workers/chunks/38d7430d2370b69334d7.js +0 -1
  355. package/assets/esri/core/workers/chunks/39d6032d79720935910d.js +0 -1
  356. package/assets/esri/core/workers/chunks/5dafd35801dca4229aed.js +0 -1
  357. package/assets/esri/core/workers/chunks/642be1619c0e76355cb6.js +0 -1
  358. package/assets/esri/core/workers/chunks/6d66dc77af8d112c33c6.js +0 -1
  359. package/assets/esri/core/workers/chunks/7b3642195d6d3ea9b830.js +0 -1
  360. package/assets/esri/core/workers/chunks/7b66691d133dabd87ce6.js +0 -1
  361. package/assets/esri/core/workers/chunks/7e57029ec958f6423d5d.js +0 -2
  362. package/assets/esri/core/workers/chunks/8042e001545e2782499c.js +0 -1
  363. package/assets/esri/core/workers/chunks/881234f25c7814de8753.js +0 -1
  364. package/assets/esri/core/workers/chunks/8a7682071941c35f05c1.js +0 -1
  365. package/assets/esri/core/workers/chunks/8fdd57e2a0af647f1e3e.js +0 -1
  366. package/assets/esri/core/workers/chunks/90ea570f6b6ce8ca693b.js +0 -1
  367. package/assets/esri/core/workers/chunks/9373daa677dc767d7cf0.js +0 -1
  368. package/assets/esri/core/workers/chunks/95df6d2ebacc43ac5fa3.js +0 -1
  369. package/assets/esri/core/workers/chunks/a02ebdcb802d128c8eee.js +0 -1
  370. package/assets/esri/core/workers/chunks/adf72d87f0114aeade0e.js +0 -1
  371. package/assets/esri/core/workers/chunks/aec4a4cd7044fdbbbe34.js +0 -1
  372. package/assets/esri/core/workers/chunks/b1a21a4d7d73ad7d0e47.js +0 -1
  373. package/assets/esri/core/workers/chunks/b262478da29470abb72b.js +0 -2
  374. package/assets/esri/core/workers/chunks/b75e090a7e935ff870a3.js +0 -1
  375. package/assets/esri/core/workers/chunks/bacf0c9d5d3e084dea61.js +0 -1
  376. package/assets/esri/core/workers/chunks/c0e4fd6fa1d765275248.js +0 -2
  377. package/assets/esri/core/workers/chunks/cfaa6e205bfc0c94a1b1.js +0 -1
  378. package/assets/esri/core/workers/chunks/d3f08f1a9a250cd8a2c8.js +0 -1
  379. package/assets/esri/core/workers/chunks/dcb7a3ff59677b1cf0f1.js +0 -1
  380. /package/assets/esri/core/workers/chunks/{7e57029ec958f6423d5d.js.LICENSE.txt → 549d348ca181d06aefb7.js.LICENSE.txt} +0 -0
  381. /package/assets/esri/core/workers/chunks/{b262478da29470abb72b.js.LICENSE.txt → 69c9eb93553b006b640d.js.LICENSE.txt} +0 -0
  382. /package/assets/esri/core/workers/chunks/{9b89cc85c1b5d561df7c.js.LICENSE.txt → bd59cb5abc67e46f1b2c.js.LICENSE.txt} +0 -0
  383. /package/assets/esri/core/workers/chunks/{c0e4fd6fa1d765275248.js.LICENSE.txt → f7fe17a22390a24d6df8.js.LICENSE.txt} +0 -0
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{volumeMeasurementConfiguration as t}from"../../../../analysis/VolumeMeasurement/volumeMeasurementConfiguration.js";import r from"../../../../core/Accessor.js";import o from"../../../../core/Logger.js";import{debounce as i,isPromiseLike as n}from"../../../../core/promiseUtils.js";import{createVolume as s}from"../../../../core/quantity.js";import{whenOnce as a,watch as l,syncAndInitial as u}from"../../../../core/reactiveUtils.js";import{property as p,subclass as m}from"../../../../core/accessorSupport/decorators.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{sqrDist as d}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as h}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{scaleAndAdd as g}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{fromValues as f,clone as y,create as _}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as v}from"../../../../core/support/UpdatingHandles.js";import w from"../../../../geometry/Multipoint.js";import{projectOrLoad as j}from"../../../../geometry/projectionUtils.js";import{e as E}from"../../../../chunks/containsOperator.js";import{e as b}from"../../../../chunks/convexHullOperator.js";import{e as R}from"../../../../chunks/simplifyOperator.js";import{a as x}from"../../../../chunks/unionOperator.js";import{computeTranslationToOriginAndRotation as C}from"../../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{projectBoundingRect as T}from"../../../../geometry/projection/projectBoundingRect.js";import{fromExtent as G,intersects as L,create as O,empty as P}from"../../../../geometry/support/aaBoundingRect.js";import{isClockwise as D}from"../../../../geometry/support/coordsUtils.js";import{newDoubleArray as H}from"../../../../geometry/support/DoubleArray.js";import{f as V}from"../../../../chunks/vec3.js";import I from"../../../../symbols/support/ElevationInfo.js";import{logFailedGeometryProjectionError as M}from"../support/projectionUtils.js";import{VolumeMeasurementCutFillComputation as U}from"./VolumeMeasurementCutFillComputation.js";import{VolumeMeasurementInsufficientDataError as N,VolumeMeasurementPerimeterTooLargeError as k,VolumeMeasurementUnsupportedCoordinateSystemError as A,VolumeMeasurementUnsupportedLayerTransparencyError as F}from"./volumeMeasurementErrors.js";import{VolumeMeasurementRawResult as S}from"./VolumeMeasurementRawResult.js";import W from"./VolumeMeasurementResult.js";import{ElevationContext as z}from"../../layers/graphics/ElevationContext.js";import{getElevationAtPoint as q}from"../../support/ElevationProvider.js";import{polygonToRenderInfoElevationAligned as B}from"../../support/renderInfoUtils/polygon.js";import{IteratorPreorder as Z}from"../../terrain/tileUtils.js";import{CutFillComputationRenderNode as J,TargetGeometryRenderInfo as K}from"../../webgl-engine/lib/CutFillComputationRenderNode.js";import{GeometryWorkerHandle as Q}from"../../../support/GeometryWorkerHandle.js";import{isIntegratedMeshLayerView as X}from"../../../support/layerViewUtils.js";let Y=class extends r{constructor(e){super(e),this._measurementWorkerHandle=new Q,this._getElevationProvider=()=>this.view.elevationProvider,this.depthExtremaPositions=null,this._updatingHandles=new v,this._rawResult=null,this._sufficientDataCoverage=!0,this._tileIterator=new Z,this._intersectingObbs=[],this._intersectingTiles=[],this._debouncedUpdate=i(async(e,t,r,o)=>{if(!this._computationRenderNode.done)return;const{renderCoordsHelper:i}=this.view,n=new U({extent:t,localOrigin:r,renderCoordsHelper:i});this._computationRenderNode.update(n,o),this._determineDataCoverage(n);const[s]=await Promise.allSettled([this._measurementWorkerHandle.areaHorizontal(e,{returnLength:!0}),a(()=>this._computationRenderNode.done).then(()=>{this._updateDepthExtremaPositions(n,this._computationRenderNode.getResult())})]);if(this.error)return void(this._rawResult=null);const l=this._computationRenderNode.getResult();this._updateResult(n,l,"fulfilled"===s.status?s.value:null)}),this._determineDataCoverage=e=>{const{elevationAlignedGeometry:t}=this,{frustum:r}=this._computationRenderNode,{cameraDimensions:o}=e;t&&r&&(this._intersectingObbs.length=0,this._imLayerViewsAffectingMeasurement.forEach(e=>{this._findIntersectingObbs(e,r)}),this._intersectingObbs.length?this._sufficientDataCoverage=this._sufficientIntegratedMeshCoverage(t,o):(this._findIntersectingTerrainTiles(t),this._sufficientDataCoverage=this._sufficientTerrainCoverage(o)))}}initialize(){const e=this.view;this._computationRenderNode=new J({view:e}),this.addHandles([this._createElevationUpdateHandle(),l(()=>({projectedGeometry:this._projectedGeometry,localOrigin:this._localOrigin,targetGeometryRenderInfo:this._targetGeometryRenderInfo}),({projectedGeometry:e,localOrigin:t,targetGeometryRenderInfo:r})=>{const o=e?.extent;if(!(e&&o&&t&&r))return this._rawResult=null,void(this._sufficientDataCoverage=!0);this._updatingHandles.consumePromise(this._debouncedUpdate(e,o,t,r))},u)])}destroy(){this._updatingHandles.destroy(),this._computationRenderNode.destroy(),this._measurementWorkerHandle.destroy()}get _projectedGeometry(){const e=this.analysis.geometry;if(!e||!this.analysis.valid)return null;const t=R(e),r=j(t,this.view.spatialReference);return r.pending?(this._updatingHandles.consumePromise(r.pending),null):(t&&!r.geometry&&M(this.analysis,e.spatialReference,o.getLogger(this)),r.geometry)}get _localOrigin(){const e=this._projectedGeometry?.extent;return e?f(e.center.x,e.center.y,0):null}get elevationAlignedGeometry(){const e=this._projectedGeometry;if(!e)return null;const t=e.clone();return $(this._getElevationProvider(),t),t}get targetGeometry(){const{elevationAlignedGeometry:e}=this;if(!e)return null;const t=this.analysis.measureType,{effectiveTargetElevation:r}=this.analysisViewData;if("stockpile"===t||null==r)return e;const o=e.clone();return o.rings.forEach(e=>e.forEach(e=>e[2]=r)),o}get _targetGeometryRenderInfo(){const e=this.targetGeometry,t=this._projectedGeometry?.extent,r=this._localOrigin;if(!e||!t||!r)return null;const{elevationProvider:o,renderCoordsHelper:i}=this.view,s=B(e,o,i,z.fromElevationInfo(new I({mode:"absolute-height"})));if(n(s))return this._updatingHandles.consumePromise(s),null;if(null==s)return null;const{positions:a,polygonIndices:l,vertexCount:u}=s,p=H(3*u),m=c(),d=c();return C(t.spatialReference,r,m,i.spatialReference),d[12]=-m[12],d[13]=-m[13],d[14]=-m[14],V(p,a,d),new K(p,l)}get updating(){return this._computationRenderNode.updating||this._updatingHandles.updating}get result(){const e=this._rawResult,{volume:t,area:r,length:o}=this.analysisViewData.effectiveDisplayUnits;return e?new W({measureType:this.analysis.measureType,rawResult:e,volumeUnit:t,areaUnit:r,lengthUnit:o}):null}get error(){return this._unsupportedCoordinateSystemError??this._unsupportedLayerTransparencyError??this._perimeterTooLargeError??this._insufficientDataError}get _imLayerViewsAffectingMeasurement(){return this.view.allLayerViews.filter(e=>X(e)).filter(e=>e.visible&&!e.suspended)}get _insufficientDataError(){return this._sufficientDataCoverage?null:new N}get _perimeterTooLargeError(){return this._perimeterTooLargeLocalError??this._perimeterTooLargeGlobalError}get _perimeterTooLargeLocalError(){const{spatialReference:e,state:{isLocal:r}}=this.view;if(!r||!e.isWebMercator)return null;const o=this._perimeterForError,{maxPerimeterLocalWebMercator:i}=t;return null!=o&&o>i?new k:null}get _perimeterTooLargeGlobalError(){if(!this.view.state.isGlobal)return null;const e=this._perimeterForError,{maxPerimeterGlobal:r}=t;return null!=e&&e>r?new k:null}get _unsupportedCoordinateSystemError(){return this.view.state.isLocal&&this.view.spatialReference.isGeographic?new A:null}get _unsupportedLayerTransparencyError(){return this.view.map.ground&&this.view.map.ground.opacity<1?new F:null}get _perimeterForError(){const{targetGeometry:e}=this;if(null==e)return null;let t=null;for(const r of e.rings){if(!D(r))continue;const e=te(re(r));t=e?Math.max(t??0,e):t}return null!=t?t*e.spatialReference.metersPerUnit:null}_createElevationUpdateHandle(){const e=e=>{const t=this._projectedGeometry?.extent;"ground"===e.context&&t&&(T(e.extent,e.spatialReference,ie,this.view.spatialReference),G(t,ne),L(ie,ne)&&(this._getElevationProvider=()=>this.view.elevationProvider))};return this.view.elevationProvider.on("elevation-change",t=>e(t))}_updateResult(e,t,r){const{unitInMeters:o}=this.view.renderCoordsHelper,{dimensions:{width:i,height:n},cameraNearFar:{near:a,far:l}}=e,u=i/t.width*(n/t.height),p=ee(t.cut.totalDepth,a,l)*u,m=ee(t.fill.totalDepth,a,l)*u,c=o**3;this._rawResult=new S({cutVolume:s(Math.abs(p*c),"cubic-meters"),fillVolume:s(m*c,"cubic-meters"),area:r?.area,perimeter:r?.length})}_updateDepthExtremaPositions(e,t){const{dimensions:{width:r,height:o},cameraNearFar:{near:i,far:n},cameraPositionRenderSpace:s,northVector:a,eastVector:l,upVector:u}=e,p=e=>{const{depthExtremum:p,depthExtremumCoords:[m,c],totalDepth:d}=e,h=y(s);return 0!==d&&(g(h,h,l,r*(m/t.width-.5)),g(h,h,a,o*(c/t.height-.5))),g(h,h,u,-ee(p,i,n)),h};this.depthExtremaPositions={cut:p(t.cut),fill:p(t.fill)}}_findIntersectingObbs(e,t){const r=this._intersectingObbs;"integrated-mesh-3d"===e.type&&e.getVisibleNodes().forEach(o=>{e.isNodeLoaded(o.index)&&o.geometryObbInRenderSR?.intersectsFrustum(t)&&r.push(o.geometryObbInRenderSR)}),"integrated-mesh-3dtiles"===e.type&&e.forEachVisibleComponentObject(({obb:e})=>{e.intersectsFrustum(t)&&r.push(e)})}_sufficientIntegratedMeshCoverage(e,t){const{renderCoordsHelper:r,spatialReference:o}=this.view,i=[],n=new w({spatialReference:o});if(this._intersectingObbs.forEach(e=>{if(oe(e.radius,t)&&(e.getCorners(ae),n.points.length=0,ae.forEach(e=>{const t=r.fromRenderCoords(e,le,o);t&&n.addPoint([t[0],t[1]])}),n.points.length)){const e=b(n);"polygon"===e?.type&&i.push(e)}}),!i.length)return!1;const s=x(i);return!!s&&E(s,e)}_findIntersectingTerrainTiles(e){const{basemapTerrain:t}=this.view;if(this._intersectingTiles.length=0,!e.extent)return;G(e.extent,se);const r=this._tileIterator;r.reset(t.rootTiles);for(let o=r.next();o;o=r.next())o.intersectsExtent(se)?o.rendered&&this._intersectingTiles.push(o):r.skipSubtree()}_sufficientTerrainCoverage(e){const{basemapTerrain:{tilingScheme:t}}=this.view;if(!this._intersectingTiles.length)return!1;const r=256/t.pixelSize;return this._intersectingTiles.every(t=>oe(t.radius*r,e))}};function $(e,t){t.hasZ=!0,t.rings.forEach(t=>t.forEach(t=>t[2]=q(e,t,"ground")??0))}function ee(e,t,r){return e*(r-t)+t}function te(e){if(!e)return null;let t=null,r=null,o=0;for(const i of e)t||(t=[i[0],i[1]]),r?o+=d(r,i):r=[0,0],r[0]=i[0],r[1]=i[1];return t&&r&&(o+=d(r,t)),Math.sqrt(o)}function*re(e){const t=h();for(let r=0;r<e.length;r++)t[0]=e[r][0],t[1]=e[r][1],yield t}e([p()],Y.prototype,"_projectedGeometry",null),e([p()],Y.prototype,"_localOrigin",null),e([p()],Y.prototype,"_getElevationProvider",void 0),e([p()],Y.prototype,"elevationAlignedGeometry",null),e([p()],Y.prototype,"targetGeometry",null),e([p()],Y.prototype,"_targetGeometryRenderInfo",null),e([p({constructOnly:!0})],Y.prototype,"analysis",void 0),e([p({constructOnly:!0})],Y.prototype,"analysisViewData",void 0),e([p({constructOnly:!0})],Y.prototype,"view",void 0),e([p()],Y.prototype,"updating",null),e([p()],Y.prototype,"result",null),e([p()],Y.prototype,"depthExtremaPositions",void 0),e([p()],Y.prototype,"error",null),e([p()],Y.prototype,"_imLayerViewsAffectingMeasurement",null),e([p()],Y.prototype,"_insufficientDataError",null),e([p()],Y.prototype,"_perimeterTooLargeError",null),e([p()],Y.prototype,"_perimeterTooLargeLocalError",null),e([p()],Y.prototype,"_perimeterTooLargeGlobalError",null),e([p()],Y.prototype,"_unsupportedCoordinateSystemError",null),e([p()],Y.prototype,"_unsupportedLayerTransparencyError",null),e([p()],Y.prototype,"_perimeterForError",null),e([p()],Y.prototype,"_computationRenderNode",void 0),e([p({readOnly:!0})],Y.prototype,"_updatingHandles",void 0),e([p()],Y.prototype,"_rawResult",void 0),e([p()],Y.prototype,"_sufficientDataCoverage",void 0),Y=e([m("esri.views.3d.analysis.VolumeMeasurement.VolumeMeasurementCutFillController")],Y);const oe=(e,t)=>e<(t.width+t.height)/2,ie=P(),ne=P(),se=O(),ae=new Array(8).fill(0).map(()=>_()),le=_();export{Y as VolumeMeasurementCutFillController};
2
+ import{__decorate as e}from"tslib";import{volumeMeasurementConfiguration as t}from"../../../../analysis/VolumeMeasurement/volumeMeasurementConfiguration.js";import r from"../../../../core/Accessor.js";import o from"../../../../core/Logger.js";import{debounce as i,isPromiseLike as n}from"../../../../core/promiseUtils.js";import{createVolume as s}from"../../../../core/quantity.js";import{whenOnce as a,watch as l,syncAndInitial as u}from"../../../../core/reactiveUtils.js";import{property as p,subclass as m}from"../../../../core/accessorSupport/decorators.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{sqrDist as d}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as h}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{scaleAndAdd as g}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{fromValues as f,clone as y,create as _}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as v}from"../../../../core/support/UpdatingHandles.js";import w from"../../../../geometry/Multipoint.js";import{projectOrLoad as E}from"../../../../geometry/projectionUtils.js";import{e as j}from"../../../../chunks/containsOperator.js";import{e as b}from"../../../../chunks/convexHullOperator.js";import{e as R}from"../../../../chunks/simplifyOperator.js";import{a as x}from"../../../../chunks/unionOperator.js";import{computeTranslationToOriginAndRotation as C}from"../../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{projectBoundingRect as T}from"../../../../geometry/projection/projectBoundingRect.js";import{fromExtent as G,intersects as L,create as O,empty as P}from"../../../../geometry/support/aaBoundingRect.js";import{isClockwise as D}from"../../../../geometry/support/coordsUtils.js";import{newDoubleArray as H}from"../../../../geometry/support/DoubleArray.js";import{f as V}from"../../../../chunks/vec3.js";import I from"../../../../symbols/support/ElevationInfo.js";import{logFailedGeometryProjectionError as M}from"../support/projectionUtils.js";import{VolumeMeasurementCutFillComputation as U}from"./VolumeMeasurementCutFillComputation.js";import{VolumeMeasurementInsufficientDataError as N,VolumeMeasurementPerimeterTooLargeError as k,VolumeMeasurementUnsupportedCoordinateSystemError as A,VolumeMeasurementUnsupportedLayerTransparencyError as F}from"./volumeMeasurementErrors.js";import{VolumeMeasurementRawResult as S}from"./VolumeMeasurementRawResult.js";import W from"./VolumeMeasurementResult.js";import{ElevationContext as z}from"../../layers/graphics/ElevationContext.js";import{getElevationAtPoint as q}from"../../support/ElevationProvider.js";import{polygonToRenderInfoElevationAligned as B}from"../../support/renderInfoUtils/polygon.js";import{IteratorPreorder as Z}from"../../terrain/tileUtils.js";import{CutFillComputationRenderNode as J,TargetGeometryRenderInfo as K}from"../../webgl-engine/lib/CutFillComputationRenderNode.js";import{GeometryWorkerHandle as Q}from"../../../support/GeometryWorkerHandle.js";import{isIntegratedMeshLayerView as X}from"../../../support/layerViewUtils.js";let Y=class extends r{constructor(e){super(e),this._measurementWorkerHandle=new Q,this._getElevationProvider=()=>this.view.elevationProvider,this.depthExtremaPositions=null,this._updatingHandles=new v,this._rawResult=null,this._sufficientDataCoverage=!0,this._tileIterator=new Z,this._intersectingObbs=[],this._intersectingTiles=[],this._debouncedUpdate=i(async(e,t,r,o)=>{if(!this._computationRenderNode.done)return;const{renderCoordsHelper:i}=this.view,n=new U({extent:t,localOrigin:r,renderCoordsHelper:i});this._computationRenderNode.update(n,o),this._determineDataCoverage(n);const[s]=await Promise.allSettled([this._measurementWorkerHandle.areaHorizontal(e,{returnLength:!0}),a(()=>this._computationRenderNode.done).then(()=>{this._updateDepthExtremaPositions(n,this._computationRenderNode.getResult())})]);if(this.error)return void(this._rawResult=null);const l=this._computationRenderNode.getResult();this._updateResult(n,l,"fulfilled"===s.status?s.value:null)}),this._determineDataCoverage=e=>{const{elevationAlignedGeometry:t}=this,{frustum:r}=this._computationRenderNode,{cameraDimensions:o}=e;t&&r&&(this._intersectingObbs.length=0,this._imLayerViewsAffectingMeasurement.forEach(e=>{this._findIntersectingObbs(e,r)}),this._intersectingObbs.length?this._sufficientDataCoverage=this._sufficientIntegratedMeshCoverage(t,o):(this._findIntersectingTerrainTiles(t),this._sufficientDataCoverage=this._sufficientTerrainCoverage(o)))}}initialize(){const e=this.view;this._computationRenderNode=new J({view:e}),this.addHandles([this._createElevationUpdateHandle(),l(()=>({projectedGeometry:this._projectedGeometry,localOrigin:this._localOrigin,targetGeometryRenderInfo:this._targetGeometryRenderInfo,transparencyError:!!this._unsupportedLayerTransparencyError}),({projectedGeometry:e,localOrigin:t,targetGeometryRenderInfo:r,transparencyError:o})=>{const i=e?.extent;if(!e||!i||!t||!r||o)return this._rawResult=null,void(this._sufficientDataCoverage=!0);this._updatingHandles.consumePromise(this._debouncedUpdate(e,i,t,r))},u)])}destroy(){this._updatingHandles.destroy(),this._computationRenderNode.destroy(),this._measurementWorkerHandle.destroy()}get _projectedGeometry(){const e=this.analysis.geometry;if(!e||!this.analysis.valid)return null;const t=R(e),r=E(t,this.view.spatialReference);return r.pending?(this._updatingHandles.consumePromise(r.pending),null):(t&&!r.geometry&&M(this.analysis,e.spatialReference,o.getLogger(this)),r.geometry)}get _localOrigin(){const e=this._projectedGeometry?.extent;return e?f(e.center.x,e.center.y,0):null}get elevationAlignedGeometry(){const e=this._projectedGeometry;if(!e)return null;const t=e.clone();return $(this._getElevationProvider(),t),t}get targetGeometry(){const{elevationAlignedGeometry:e}=this;if(!e)return null;const t=this.analysis.measureType,{effectiveTargetElevation:r}=this.analysisViewData;if("stockpile"===t||null==r)return e;const o=e.clone();return o.rings.forEach(e=>e.forEach(e=>e[2]=r)),o}get _targetGeometryRenderInfo(){const e=this.targetGeometry,t=this._projectedGeometry?.extent,r=this._localOrigin;if(!e||!t||!r)return null;const{elevationProvider:o,renderCoordsHelper:i}=this.view,s=B(e,o,i,z.fromElevationInfo(new I({mode:"absolute-height"})));if(n(s))return this._updatingHandles.consumePromise(s),null;if(null==s)return null;const{positions:a,polygonIndices:l,vertexCount:u}=s,p=H(3*u),m=c(),d=c();return C(t.spatialReference,r,m,i.spatialReference),d[12]=-m[12],d[13]=-m[13],d[14]=-m[14],V(p,a,d),new K(p,l)}get updating(){return this._computationRenderNode.updating||this._updatingHandles.updating}get result(){const e=this._rawResult,{volume:t,area:r,length:o}=this.analysisViewData.effectiveDisplayUnits;return e?new W({measureType:this.analysis.measureType,rawResult:e,volumeUnit:t,areaUnit:r,lengthUnit:o}):null}get error(){return this._unsupportedCoordinateSystemError??this._unsupportedLayerTransparencyError??this._perimeterTooLargeError??this._insufficientDataError}get _imLayerViewsAffectingMeasurement(){return this.view.allLayerViews.filter(e=>X(e)).filter(e=>e.visible&&!e.suspended)}get _insufficientDataError(){return this._sufficientDataCoverage?null:new N}get _perimeterTooLargeError(){return this._perimeterTooLargeLocalError??this._perimeterTooLargeGlobalError}get _perimeterTooLargeLocalError(){const{spatialReference:e,state:{isLocal:r}}=this.view;if(!r||!e.isWebMercator)return null;const o=this._perimeterForError,{maxPerimeterLocalWebMercator:i}=t;return null!=o&&o>i?new k:null}get _perimeterTooLargeGlobalError(){if(!this.view.state.isGlobal)return null;const e=this._perimeterForError,{maxPerimeterGlobal:r}=t;return null!=e&&e>r?new k:null}get _unsupportedCoordinateSystemError(){return this.view.state.isLocal&&this.view.spatialReference.isGeographic?new A:null}get _unsupportedLayerTransparencyError(){return this.view.map.ground&&this.view.map.ground.opacity<1?new F:null}get _perimeterForError(){const{targetGeometry:e}=this;if(null==e)return null;let t=null;for(const r of e.rings){if(!D(r))continue;const e=te(re(r));t=e?Math.max(t??0,e):t}return null!=t?t*e.spatialReference.metersPerUnit:null}_createElevationUpdateHandle(){const e=e=>{const t=this._projectedGeometry?.extent;"ground"===e.context&&t&&(T(e.extent,e.spatialReference,ie,this.view.spatialReference),G(t,ne),L(ie,ne)&&(this._getElevationProvider=()=>this.view.elevationProvider))};return this.view.elevationProvider.on("elevation-change",t=>e(t))}_updateResult(e,t,r){const{unitInMeters:o}=this.view.renderCoordsHelper,{dimensions:{width:i,height:n},cameraNearFar:{near:a,far:l}}=e,u=i/t.width*(n/t.height),p=ee(t.cut.totalDepth,a,l)*u,m=ee(t.fill.totalDepth,a,l)*u,c=o**3;this._rawResult=new S({cutVolume:s(Math.abs(p*c),"cubic-meters"),fillVolume:s(m*c,"cubic-meters"),area:r?.area,perimeter:r?.length})}_updateDepthExtremaPositions(e,t){const{dimensions:{width:r,height:o},cameraNearFar:{near:i,far:n},cameraPositionRenderSpace:s,northVector:a,eastVector:l,upVector:u}=e,p=e=>{const{depthExtremum:p,depthExtremumCoords:[m,c],totalDepth:d}=e,h=y(s);return 0!==d&&(g(h,h,l,r*(m/t.width-.5)),g(h,h,a,o*(c/t.height-.5))),g(h,h,u,-ee(p,i,n)),h};this.depthExtremaPositions={cut:p(t.cut),fill:p(t.fill)}}_findIntersectingObbs(e,t){const r=this._intersectingObbs;"integrated-mesh-3d"===e.type&&e.getVisibleNodes().forEach(o=>{e.isNodeLoaded(o.index)&&o.geometryObbInRenderSR?.intersectsFrustum(t)&&r.push(o.geometryObbInRenderSR)}),"integrated-mesh-3dtiles"===e.type&&e.forEachVisibleComponentObject(({obb:e})=>{e.intersectsFrustum(t)&&r.push(e)})}_sufficientIntegratedMeshCoverage(e,t){const{renderCoordsHelper:r,spatialReference:o}=this.view,i=[],n=new w({spatialReference:o});if(this._intersectingObbs.forEach(e=>{if(oe(e.radius,t)&&(e.getCorners(ae),n.points.length=0,ae.forEach(e=>{const t=r.fromRenderCoords(e,le,o);t&&n.addPoint([t[0],t[1]])}),n.points.length)){const e=b(n);"polygon"===e?.type&&i.push(e)}}),!i.length)return!1;const s=x(i);return!!s&&j(s,e)}_findIntersectingTerrainTiles(e){const{basemapTerrain:t}=this.view;if(this._intersectingTiles.length=0,!e.extent)return;G(e.extent,se);const r=this._tileIterator;r.reset(t.rootTiles);for(let o=r.next();o;o=r.next())o.intersectsExtent(se)?o.rendered&&this._intersectingTiles.push(o):r.skipSubtree()}_sufficientTerrainCoverage(e){const{basemapTerrain:{tilingScheme:t}}=this.view;if(!this._intersectingTiles.length)return!1;const r=256/t.pixelSize;return this._intersectingTiles.every(t=>oe(t.radius*r,e))}};function $(e,t){t.hasZ=!0,t.rings.forEach(t=>t.forEach(t=>t[2]=q(e,t,"ground")??0))}function ee(e,t,r){return e*(r-t)+t}function te(e){if(!e)return null;let t=null,r=null,o=0;for(const i of e)t||(t=[i[0],i[1]]),r?o+=d(r,i):r=[0,0],r[0]=i[0],r[1]=i[1];return t&&r&&(o+=d(r,t)),Math.sqrt(o)}function*re(e){const t=h();for(let r=0;r<e.length;r++)t[0]=e[r][0],t[1]=e[r][1],yield t}e([p()],Y.prototype,"_projectedGeometry",null),e([p()],Y.prototype,"_localOrigin",null),e([p()],Y.prototype,"_getElevationProvider",void 0),e([p()],Y.prototype,"elevationAlignedGeometry",null),e([p()],Y.prototype,"targetGeometry",null),e([p()],Y.prototype,"_targetGeometryRenderInfo",null),e([p({constructOnly:!0})],Y.prototype,"analysis",void 0),e([p({constructOnly:!0})],Y.prototype,"analysisViewData",void 0),e([p({constructOnly:!0})],Y.prototype,"view",void 0),e([p()],Y.prototype,"updating",null),e([p()],Y.prototype,"result",null),e([p()],Y.prototype,"depthExtremaPositions",void 0),e([p()],Y.prototype,"error",null),e([p()],Y.prototype,"_imLayerViewsAffectingMeasurement",null),e([p()],Y.prototype,"_insufficientDataError",null),e([p()],Y.prototype,"_perimeterTooLargeError",null),e([p()],Y.prototype,"_perimeterTooLargeLocalError",null),e([p()],Y.prototype,"_perimeterTooLargeGlobalError",null),e([p()],Y.prototype,"_unsupportedCoordinateSystemError",null),e([p()],Y.prototype,"_unsupportedLayerTransparencyError",null),e([p()],Y.prototype,"_perimeterForError",null),e([p()],Y.prototype,"_computationRenderNode",void 0),e([p({readOnly:!0})],Y.prototype,"_updatingHandles",void 0),e([p()],Y.prototype,"_rawResult",void 0),e([p()],Y.prototype,"_sufficientDataCoverage",void 0),Y=e([m("esri.views.3d.analysis.VolumeMeasurement.VolumeMeasurementCutFillController")],Y);const oe=(e,t)=>e<(t.width+t.height)/2,ie=P(),ne=P(),se=O(),ae=new Array(8).fill(0).map(()=>_()),le=_();export{Y as VolumeMeasurementCutFillController};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as t}from"tslib";import{deg2rad as i}from"../../../../core/mathUtils.js";import{valueInUnit as o}from"../../../../core/quantity.js";import{watch as e,sync as s,syncAndInitial as n}from"../../../../core/reactiveUtils.js";import{verticalLengthUnitFromSpatialReference as a,convertUnit as r}from"../../../../core/units.js";import{property as l,subclass as p}from"../../../../core/accessorSupport/decorators.js";import{rotateZ as h}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{subtract as c,lerp as u}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{fromArray as d,clone as m}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{sv3d as f,sm4d as v}from"../../../../geometry/support/vectorStacks.js";import{IsShiftEdgeOnScreenFlag as y}from"../Slice/sliceToolUtils.js";import{calculateTranslateRotateFromBases as _}from"../../interactive/manipulatorUtils.js";import{screenToZConstrained as w}from"../../interactive/editingTools/dragEventPipeline3D.js";import{ShiftManipulator as g}from"../../interactive/manipulators/ShiftManipulator.js";import{createManipulatorDragEventPipeline as T,addMapTranslation as M}from"../../../interactive/dragEventPipeline.js";import{InteractiveToolBase as U}from"../../../interactive/InteractiveToolBase.js";import j from"../../../interactive/sketch/SketchOptions.js";import O from"../../../interactive/sketch/Units.js";import{makeTooltip as k,enterInputModeIfAvailable as V}from"../../../interactive/tooltip/tooltipCommonUtils.js";import{ElevationTooltipInfo as E}from"../../../interactive/tooltip/infos/ElevationTooltipInfo.js";import{elevationFromZ as I}from"../../../support/euclideanLengthMeasurementUtils.js";let S=class extends U{constructor(t){super(t),this.multiTouchEnabled=!1,this.sketchOptions=new j}initialize(){const{view:t}=this;this._shiftManipulator=new g(t,0,8),this._shiftManipulator.state|=y,this.manipulators.add(this._shiftManipulator),this.addHandles([this._createDragPipeline(),e(()=>this.analysisViewData.targetGeometry,()=>this._updateManipulatorPosition(),s),e(()=>this._showManipulator,t=>this._updateManipulatorVisibility(t),n)]),this._initializeTooltip(),this.finishToolCreation()}_initializeTooltip(){const{view:t}=this;this.tooltip=k(()=>({view:t,options:this.sketchOptions.tooltips})),this._tooltipInfo=new E({sketchOptions:this.sketchOptions}),this.sketchOptions.tooltips.placement="trailing",this._updateSketchOptions(),this.addHandles([e(()=>this.analysisViewData.effectiveTargetElevation,()=>this._updateTooltip()),e(()=>this._shouldShowTooltip,t=>{t?this._showTooltip():this._hideTooltip()}),this.tooltip.on("commit",()=>{const t=this._tooltipInfo.elevation.actual,i=a(this.view.spatialReference);if(null==t||null==i)return;const e=o(t,i);this._updateValue(e,{recordUndo:this.analysis.cutFillOptions.targetElevation})}),e(()=>[this.analysis.displayUnits.elevation,this.analysis.inputUnits.elevation],()=>this._updateSketchOptions(),n)])}destroy(){this._shiftManipulator.destroy(),this.tooltip.destroy()}onInputEvent(t){if(!this.destroyed&&!V(t,this.tooltip))return super.onInputEvent(t)}get _shouldShowTooltip(){return this.hasFocusedManipulators||"input"===this.tooltip.mode}get _showManipulator(){const{interactive:t,targetGeometry:i,visible:o}=this.analysisViewData,{measureType:e}=this.analysis;return o&&t&&null!=i&&"cut-fill"===e}_createDragPipeline(){return T(this._shiftManipulator,(t,i,o)=>{const e=m(t.renderLocation),s=this.analysis.inputUnits.elevation??"meters",n=a(this.view.spatialReference);let l;i.next(w(this.view,e,this.view.spatialReference)).next(M()).next(t=>{if("start"===t.action){const{targetElevation:t}=this.analysis.cutFillOptions;l=t&&n?r(t,s,n):void 0}return this._updateValue(null!=l?l+t.translationZ:t.mapEnd.z,"end"===t.action?{recordUndo:l}:void 0),t}),o.next(()=>{this._updateValue(l)})})}_updateManipulatorPosition(){const{targetGeometry:t}=this.analysisViewData,{renderCoordsHelper:o}=this.view;if(!t)return;const e=.5,s=t.rings[0],n=d(s[0]),a=d(s[1]);o.toRenderCoords(n,t.spatialReference,n),o.toRenderCoords(a,t.spatialReference,a);const r=f.get();c(r,a,n);const l=f.get();u(l,n,a,e);const p=o.worldBasisAtPosition(l,1,f.get()),y=o.worldBasisAtPosition(l,0,f.get()),w=_(p,y,l,v.get()),g=o.headingAtPosition(l,r),T=t.isClockwise(t.rings[0])?-Math.PI/2:Math.PI/2;h(w,w,i(g)+T),w[12]=0,w[13]=0,w[14]=0,this._shiftManipulator.renderLocation=m(l),this._shiftManipulator.modelTransform=w}_updateManipulatorVisibility(t){this._shiftManipulator.available=t}_updateValue(t,i){const o=I(t,this.view.spatialReference);if(null==o)return;const e=this.analysis.inputUnits.elevation??"meters",s=r(o.value,o.unit,e),n=t=>{this.analysis.cutFillOptions.targetElevation=t};if(n(s),i&&"recordUndo"in i){const t=i.recordUndo;this.emit("record-undo",{apply:()=>n(s),undo:()=>n(t)})}}_getUpdatedTooltipInfo(){const{effectiveTargetElevation:t}=this.analysisViewData;return t?(this._tooltipInfo.elevation.actual=I(t,this.view.spatialReference),this._tooltipInfo):this._tooltipInfo}_updateTooltip(){this._shouldShowTooltip&&(this.tooltip.info=this._getUpdatedTooltipInfo())}_showTooltip(){this._updateTooltip()}_hideTooltip(){this.tooltip?.clear()}_updateSketchOptions(){const{analysis:t}=this,{displayUnits:i,inputUnits:o}=t;this.sketchOptions.values.inputUnits=new O({verticalLength:o.elevation}),this.sketchOptions.values.displayUnits=new O({verticalLength:i.elevation})}};t([l()],S.prototype,"multiTouchEnabled",void 0),t([l({constructOnly:!0})],S.prototype,"analysis",void 0),t([l({constructOnly:!0})],S.prototype,"view",void 0),t([l({constructOnly:!0})],S.prototype,"analysisViewData",void 0),t([l({constructOnly:!0,type:j})],S.prototype,"sketchOptions",void 0),t([l()],S.prototype,"_shouldShowTooltip",null),t([l()],S.prototype,"_showManipulator",null),S=t([p("esri.views.3d.analysis.VolumeMeasurement.VolumeMeasurementShiftTool")],S);export{S as VolumeMeasurementShiftTool};
2
+ import{__decorate as t}from"tslib";import{deg2rad as i}from"../../../../core/mathUtils.js";import{valueInUnit as o}from"../../../../core/quantity.js";import{watch as e,sync as s,syncAndInitial as n}from"../../../../core/reactiveUtils.js";import{verticalLengthUnitFromSpatialReference as a,convertUnit as r}from"../../../../core/units.js";import{property as l,subclass as p}from"../../../../core/accessorSupport/decorators.js";import{rotateZ as h}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{subtract as c,lerp as u}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{fromArray as d,clone as m}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{sv3d as f,sm4d as v}from"../../../../geometry/support/vectorStacks.js";import{IsShiftEdgeOnScreenFlag as y}from"../Slice/sliceToolUtils.js";import{calculateTranslateRotateFromBases as _}from"../../interactive/manipulatorUtils.js";import{screenToZConstrained as w}from"../../interactive/editingTools/dragEventPipeline3D.js";import{ShiftManipulator as g}from"../../interactive/manipulators/ShiftManipulator.js";import{createManipulatorDragEventPipeline as T,addMapTranslation as M}from"../../../interactive/dragEventPipeline.js";import{InteractiveToolBase as U}from"../../../interactive/InteractiveToolBase.js";import j from"../../../interactive/sketch/SketchOptions.js";import O from"../../../interactive/sketch/Units.js";import{makeTooltip as k,enterInputModeIfAvailable as V}from"../../../interactive/tooltip/tooltipCommonUtils.js";import{ElevationTooltipInfo as E}from"../../../interactive/tooltip/infos/ElevationTooltipInfo.js";import{elevationFromZ as I}from"../../../support/euclideanLengthMeasurementUtils.js";let S=class extends U{constructor(t){super(t),this.multiTouchEnabled=!1,this.sketchOptions=new j}initialize(){const{view:t}=this;this._shiftManipulator=new g(t,0,8),this._shiftManipulator.state|=y,this.manipulators.add(this._shiftManipulator),this.addHandles([this._createDragPipeline(),e(()=>this.analysisViewData.targetGeometry,()=>this._updateManipulatorPosition(),s),e(()=>this._showManipulator,t=>this._updateManipulatorVisibility(t),n)]),this._initializeTooltip(),this.finishToolCreation()}_initializeTooltip(){const{view:t}=this;this.tooltip=k(()=>({view:t,options:this.sketchOptions.tooltips})),this._tooltipInfo=new E({sketchOptions:this.sketchOptions}),this.sketchOptions.tooltips.placement="trailing",this._updateSketchOptions(),this.addHandles([e(()=>this.analysisViewData.effectiveTargetElevation,()=>this._updateTooltip()),e(()=>this._shouldShowTooltip,t=>{t?this._showTooltip():this._hideTooltip()}),this.tooltip.on("commit",()=>{const t=this._tooltipInfo.elevation.actual,i=a(this.view.spatialReference);if(null==t||null==i)return;const e=o(t,i);this._updateValue(e,{recordUndo:this.analysis.cutFillOptions.targetElevation})}),e(()=>[this.analysis.displayUnits.elevation,this.analysis.inputUnits.elevation],()=>this._updateSketchOptions(),n)])}destroy(){this._shiftManipulator.destroy(),this.tooltip.destroy()}onInputEvent(t){if(!this.destroyed&&!V(t,this.tooltip))return super.onInputEvent(t)}get _shouldShowTooltip(){return this._showManipulator&&(this.hasFocusedManipulators||"input"===this.tooltip.mode)}get _showManipulator(){const{interactive:t,targetGeometry:i,visible:o}=this.analysisViewData,{measureType:e}=this.analysis;return o&&t&&null!=i&&"cut-fill"===e}_createDragPipeline(){return T(this._shiftManipulator,(t,i,o)=>{const e=m(t.renderLocation),s=this.analysis.inputUnits.elevation??"meters",n=a(this.view.spatialReference);let l;i.next(w(this.view,e,this.view.spatialReference)).next(M()).next(t=>{if("start"===t.action){const{targetElevation:t}=this.analysis.cutFillOptions;l=t&&n?r(t,s,n):void 0}return this._updateValue(null!=l?l+t.translationZ:t.mapEnd.z,"end"===t.action?{recordUndo:l}:void 0),t}),o.next(()=>{this._updateValue(l)})})}_updateManipulatorPosition(){const{targetGeometry:t}=this.analysisViewData,{renderCoordsHelper:o}=this.view;if(!t)return;const e=.5,s=t.rings[0],n=d(s[0]),a=d(s[1]);o.toRenderCoords(n,t.spatialReference,n),o.toRenderCoords(a,t.spatialReference,a);const r=f.get();c(r,a,n);const l=f.get();u(l,n,a,e);const p=o.worldBasisAtPosition(l,1,f.get()),y=o.worldBasisAtPosition(l,0,f.get()),w=_(p,y,l,v.get()),g=o.headingAtPosition(l,r),T=t.isClockwise(t.rings[0])?-Math.PI/2:Math.PI/2;h(w,w,i(g)+T),w[12]=0,w[13]=0,w[14]=0,this._shiftManipulator.renderLocation=m(l),this._shiftManipulator.modelTransform=w}_updateManipulatorVisibility(t){this._shiftManipulator.available=t}_updateValue(t,i){const o=I(t,this.view.spatialReference);if(null==o)return;const e=this.analysis.inputUnits.elevation??"meters",s=r(o.value,o.unit,e),n=t=>{this.analysis.cutFillOptions.targetElevation=t};if(n(s),i&&"recordUndo"in i){const t=i.recordUndo;this.emit("record-undo",{apply:()=>n(s),undo:()=>n(t)})}}_getUpdatedTooltipInfo(){const{effectiveTargetElevation:t}=this.analysisViewData;return t?(this._tooltipInfo.elevation.actual=I(t,this.view.spatialReference),this._tooltipInfo):this._tooltipInfo}_updateTooltip(){this._shouldShowTooltip&&(this.tooltip.info=this._getUpdatedTooltipInfo())}_showTooltip(){this._updateTooltip()}_hideTooltip(){this.tooltip?.clear()}_updateSketchOptions(){const{analysis:t}=this,{displayUnits:i,inputUnits:o}=t;this.sketchOptions.values.inputUnits=new O({verticalLength:o.elevation}),this.sketchOptions.values.displayUnits=new O({verticalLength:i.elevation})}};t([l()],S.prototype,"multiTouchEnabled",void 0),t([l({constructOnly:!0})],S.prototype,"analysis",void 0),t([l({constructOnly:!0})],S.prototype,"view",void 0),t([l({constructOnly:!0})],S.prototype,"analysisViewData",void 0),t([l({constructOnly:!0,type:j})],S.prototype,"sketchOptions",void 0),t([l()],S.prototype,"_shouldShowTooltip",null),t([l()],S.prototype,"_showManipulator",null),S=t([p("esri.views.3d.analysis.VolumeMeasurement.VolumeMeasurementShiftTool")],S);export{S as VolumeMeasurementShiftTool};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import"../../../core/has.js";import t from"../../../core/Logger.js";import{removeMaybe as i}from"../../../core/maybe.js";import{watch as s,initial as r}from"../../../core/reactiveUtils.js";import{unitFromRESTJSON as a,convertUnit as n}from"../../../core/units.js";import{property as l,subclass as o}from"../../../core/accessorSupport/decorators.js";import{fromValues as h}from"../../../core/libs/gl-matrix-2/factories/quatf64.js";import{getReferenceEllipsoid as d}from"../../../geometry/ellipsoidUtils.js";import u from"../../../geometry/HeightModelInfo.js";import{create as c}from"../../../geometry/support/aaBoundingBox.js";import{isCompatible as m}from"../../../geometry/support/heightModelInfoUtils.js";import{isPlateCarree as p,isWebMercator as f,equals as g,isGeographic as _}from"../../../geometry/support/spatialReferenceUtils.js";import y from"../../../geometry/support/WKIDUnitConversion.js";import{getHeightModelInfoFromVCS as w}from"../../../layers/support/tiles3DUtils.js";import{getElevationOffsetInMeters as v}from"../../../support/elevationInfoUtils.js";import{getMetersPerUnit as S}from"../../../symbols/support/unitConversionUtils.js";import{GaussianSplatLayerViewPerformanceInfo as b}from"./GaussianSplatLayerViewPerformanceInfo.js";import{LayerView3D as C}from"./LayerView3D.js";import{addLayerViewToWasm as x,getLyr3DWasm as M,removeLayerViewFromWasm as T}from"./Lyr3DWasm.js";import{LayerElevationProvider as H}from"./i3s/LayerElevationProvider.js";import{ElevationRange as I}from"../support/ElevationRange.js";import{projectToBoundingBox as A}from"../support/extentUtils.js";import{Obb as R}from"../support/orientedBoundingBox.js";import{splatPageSizeInU32 as P,packedGaussianSizeInU32 as j,splatPageSizeInU32WithoutHeader as F,gaussiansPerSplatPage as G,elementsPerSplatPage as O,splatAtlasTextureWidth as U}from"../support/gaussianSplatting/GaussianSplatAtlasPages.js";import{GaussianSplatDataStore as E}from"../support/gaussianSplatting/GaussianSplatDataStore.js";import{GaussianSplatFadeHelper as V}from"../support/gaussianSplatting/GaussianSplatFadeHelper.js";import{GaussianSplatIntersectionHandler as L}from"../support/gaussianSplatting/GaussianSplatIntersectionHandler.js";import{GaussianTile as B}from"../support/gaussianSplatting/GaussianTile.js";import{GaussianSplatRenderNode as z}from"../webgl-engine/lib/GaussianSplatRenderNode.js";import{GaussianSplatShadowRenderNode as k}from"../webgl-engine/lib/GaussianSplatShadowRenderNode.js";import N from"../../layers/LayerView.js";import{spatialReferenceIncompatibleError as q,isInEffectiveScaleRange as D}from"../../support/layerViewUtils.js";import{TaskPriority as W}from"../../support/Scheduler.js";var $;const X=()=>t.getLogger("esri.views.3d.layers.GaussianSplatLayerView3D"),Z=3,Y=Z*Z;let J=class extends(C(N)){static{$=this}static{this.createRenderableBatchSize=64}constructor(e){super(e),this.type="gaussian-splat-3d",this.ignoresMemoryFactor=!1,this._tileHandles=new Map,this._pageBuffer=new Uint32Array(P),this._tmpTilesWithChangedVisibility=new Array,this._currentLyr3dVisibilityChange=0,this._tileFadeInsAwaitingInitialSort=new Map,this._tileFadeOutsAwaitingInitialSort=new Map,this._tmpSortedTileHandles=new Set,this._createRenderableAbortController=new AbortController,this._wasmLayerId=-1,this._metersPerVCSUnit=1,this._usedTileMemory=0,this._cacheTileMemory=0,this._useEsriCrs=!1,this.fullExtentInLocalViewSpatialReference=null,this._suspendedHandle=null,this._conversionBuffer=new ArrayBuffer(4),this._u32View=new Uint32Array(this._conversionBuffer),this._f32View=new Float32Array(this._conversionBuffer);const t=e.view.resourceController;this._memCache=t.memoryController.newCache(`GaussianSplat-${this.uid}`,e=>this._deleteTile(e)),this._frameTask=t.scheduler.registerTask(W.GAUSSIAN_SPLAT_TEXTURE_ATLAS)}get _clippingBox(){if(!this.view?.clippingArea)return null;const e=c();return A(this.view.clippingArea,e,this.view.renderSpatialReference)?e:null}get clippingBox(){return this._renderNode?.clippingBox??null}initialize(){if(!this._canProjectWithoutEngine())throw q("layer",this.layer.spatialReference.wkid,this.view.renderSpatialReference?.wkid);const e=x(this).then(e=>{this._wasmLayerId=e,this._renderNode=new z({view:this.view,layerView:this}),this.data=new E(this._renderNode,(e,t)=>this._onSortComplete(e,t)),this._shadowRenderNode=new k({view:this.view,layerView:this}),this.fadeHelper=new V(this),this._intersectionHandler=new L(this),this.view.sceneIntersectionHelper.addIntersectionHandler(this._intersectionHandler),this._elevationProvider=new H({view:this.view,layerElevationSource:this,intersectionHandler:this._intersectionHandler}),this.view.elevationProvider.register(2,this._elevationProvider),this.addHandles([s(()=>this.layer.elevationInfo,e=>this._elevationInfoChanged(e)),s(()=>this.slicePlaneEnabled,e=>this._slicePlaneEnabledChanged(e),r)]),this._suspendedHandle=s(()=>this.suspended,e=>this._wasm?.setEnabled(this,!e),r),this.addHandles([s(()=>this._clippingBox,e=>this._renderNode.clippingBox=e,r)]),this.setMaximumGaussianCount(this.view.qualitySettings.gaussianSplat.maximumNumberOfGaussians)});this.addHandles([s(()=>this.view.qualitySettings.fadeDuration,e=>{this.fadeHelper.onFadeDurationChanged(e),this.data.fadingTexture.updateTexture(this.data.textureAtlas.pageAllocator.pageCount)}),s(()=>this.view.qualitySettings.gaussianSplat.maximumNumberOfGaussians,e=>this.setMaximumGaussianCount(e*this.view.quality)),s(()=>this.view.quality,e=>this.setMaximumGaussianCount(this.view.qualitySettings.gaussianSplat.maximumNumberOfGaussians*e))]),this.addResolvingPromise(e)}get wasmLayerId(){return this._wasmLayerId}get metersPerVCSUnit(){return this._metersPerVCSUnit}get tileHandles(){return this._tileHandles}get _wasm(){return M(this.view)}get usedMemory(){return this._usedTileMemory+(this.data?.usedMemory??0)}get cachedMemory(){return this._cacheTileMemory}get unloadedMemory(){return 0}get useEsriCrs(){return this._useEsriCrs}get elevationProvider(){return this._elevationProvider}get elevationOffset(){return v(this.layer.elevationInfo)}get elevationRange(){const e=this.fullExtent;return e?.zmin&&e?.zmax?new I(e.zmin,e.zmax):null}getElevationRange(e){return this._intersectionHandler.getElevationRange(e)}get fullExtent(){return this.layer.fullExtent}get visibleAtCurrentScale(){return D(this.layer.effectiveScaleRange,this.view.scale)}isUpdating(){const e=this._wasm;return!(this._wasmLayerId<0||null==e)&&(e.isUpdating(this._wasmLayerId)||this.data.updating||this.fadeHelper.updating)}updatingFlagChanged(){this.notifyChange("updating")}async createRenderable(e){const t=e.meshData;if(null==t.data)throw new Error("meshData.data undefined");if(t.desc=JSON.parse(t.desc),null==t.desc)throw new Error("meshData.desc undefined");const i=t.desc.prims[0],s=i.vertexCount;if(0===s)return{memUsageBytes:0,numGaussians:0};const r=i.atrbs[0].view,a=i.atrbs[0].view.byteCount,n=i.atrbs[0].view.byteOffset;let l=null;if("U32"!==r.type)return X().warnOnce("unexpected meshData.data format"),{memUsageBytes:0,numGaussians:0};l=new Uint32Array(t.data.buffer,n,a/4);const o=this.extractHeader(l),u=2.048,c=o.tileOrigin.x*u,m=o.tileOrigin.y*u,p=o.tileOrigin.z*u;let f=null;if(t.desc.obb){const e=t.desc.obb.quaternion;f=new R(t.desc.obb.center,t.desc.obb.halfSize,h(...e))}f||(X().warnOnce("encountered tile without a bounding box"),f=new R);const g=this.view.state.isGlobal,_=g?d(this.view.spatialReference).radius:0,y={handle:e.handle,bufferView:l,totalGaussians:s,packedHeader:o.packedHeader,tileOrigin:{x:c,y:m,z:p},invPosScale:o.invPosScale,obb:f,origin:{x:f.centerX,y:f.centerY,z:f.centerZ},isGlobal:g,ellipsoidRadius:_};return this._frameTask.scheduleGenerator(e=>this._createRenderableTask(y,e),this._createRenderableAbortController.signal)}*_createRenderableTask(e,t){const{handle:i,bufferView:s,totalGaussians:r,packedHeader:a,tileOrigin:n,invPosScale:l,obb:o,origin:h,isGlobal:d,ellipsoidRadius:u}=e,c=n.x,m=n.y,p=n.z,f=h.x,g=h.y,_=h.z,y=new Uint32Array(r),w=new Float32Array(3*r),v=new Uint32Array(r),S=new Uint32Array(r),b=new Array,C=Math.ceil(r/G);for(let I=0;I<C;I++){let e=this.data.textureAtlas.requestPage();if(null===e&&(this._freeInvisibleTiles(),e=this.data.textureAtlas.requestPage()),null===e)return X().warnOnce("ran out of gaussian splat memory"),{memUsageBytes:0,numGaussians:0};b.push(e);const i=r-I*G,n=Math.min(i,G),l=I*G,o=O*e;for(let t=0;t<n;t++)y[l+t]=o+t;const h=I*F;this._pageBuffer.set(s.subarray(h,h+n*j)),this._pageBuffer.set(a,F);const d=e*O,u=d%U,c=Math.floor(d/U);this.data.textureAtlas.update(u,c,this._pageBuffer),t.madeProgress()&&(t=yield)}let x=1/0,M=-1/0,T=1/0,H=-1/0,A=0,R=-1,P=0;for(let I=0;I<r;I++){const e=I*j,{rawX:i,rawY:r,rawZ:a}=this._extractGaussianPosition(s,e),n=s[e],o=s[e+2],h=o>>>10&255,u=o>>>18&255,y=o>>>26&63|(3&s[e+3])<<6,b=h|u<<8|y<<16,C=Math.max(h,u,y),F=i*l+c,G=r*l+m,O=a*l+p;if(w[A]=F-f,w[A+1]=G-g,w[A+2]=O-_,d){const e=F*F+G*G+O*O;T=Math.min(T,e),H=Math.max(H,e)}else x=Math.min(x,O),M=Math.max(M,O);v[I]=n,S[I]=b,C>R&&(R=C),A+=3,P++,P===$.createRenderableBatchSize&&(P=0,t.madeProgress()&&(t=yield))}P>0&&t.madeProgress(),d&&(x=Math.sqrt(T)-u,M=Math.sqrt(H)-u);const E=this._extractGaussianSplatMbsRadiusSquared(R),{fullExtent:V}=this.layer;V?.hasZ&&V.zmax&&V.zmin&&(x=Math.max(x,V.zmin),M=Math.min(M,V.zmax));const L=new I(x,M),z=new B(i,o,y,b,w,v,S,r,E,L);return this._memCache.put(`${z.handle}`,z),this._tileHandles.set(i,z),this._cacheTileMemory+=z.usedMemory,{memUsageBytes:z.usedMemory,numGaussians:r}}_extractGaussianPosition(e,t){const i=e[t+1];return{rawX:16383&i,rawY:i>>>14&16383,rawZ:i>>>28&15|(1023&e[t+2])<<4}}_extractGaussianSplatMbsRadiusSquared(e){return Math.exp(e/8-20)*Y}freeRenderable(e){this._tileFadeInsAwaitingInitialSort.delete(e),this._tileFadeOutsAwaitingInitialSort.delete(e);const t=this._tileHandles.get(e);if(t){0!==t.lifecycleState?(this.fadeHelper.onTileDiscarded(t),this._usedTileMemory-=t.usedMemory,this._intersectionHandler.removeTile(t)):this._cacheTileMemory-=t.usedMemory,t.pageIds.forEach(e=>this.data.textureAtlas.freePage(e)),this.freeObject(t),this._tileHandles.delete(e)}this.updateGaussians()}freeObject(e){this._memCache.pop(`${e.handle}`)}notifyTileObbsChanged(e){this._elevationProvider&&this._elevationProvider.notifyObjectsChangedFunctional(t=>{for(const i of e)t(i.obb)})}setRenderableVisibility(e,t,i){const s=this._currentLyr3dVisibilityChange+1;let r=!1;for(let a=0;a<i;a++){const i=this._tileHandles.get(e[a]);if(!i)continue;const n=t[a]?this._prepareTileFadeIn(i,s):this._prepareTileFadeOut(i,s);r||=n}r&&(this._currentLyr3dVisibilityChange=s,this.updateGaussians())}_prepareTileFadeIn(e,t){const i=this._tileFadeOutsAwaitingInitialSort.delete(e.handle);return 2===e.lifecycleState?(this.fadeHelper.fadeTile(e,0),i):this._tileFadeInsAwaitingInitialSort.get(e.handle)!==t?(0===e.lifecycleState&&this._popTileFromCache(e),e.lifecycleState=1,this._tileFadeInsAwaitingInitialSort.set(e.handle,t),!0):i}_prepareTileFadeOut(e,t){const i=this._tileFadeInsAwaitingInitialSort.delete(e.handle);return i&&1===e.lifecycleState&&(this.moveTileToCache(e),e.lifecycleState=0),2!==e.lifecycleState?i:this._tileFadeOutsAwaitingInitialSort.get(e.handle)!==t?(this._tileFadeOutsAwaitingInitialSort.set(e.handle,t),!0):i}_onSortComplete(e,t){const i=this._tmpTilesWithChangedVisibility;i.length=0;const s=this._tmpSortedTileHandles;s.clear();for(let a=0;a<e.length;a++){const t=e[a];s.add(t.handle)}let r=this._triggerFadeIns(t,s,i);r=this._triggerFadeOuts(t,i),s.clear(),i.length>0&&this.notifyTileObbsChanged(i),r&&this.updateGaussians()}_triggerFadeIns(e,t,i){let s=!1;for(const[r,a]of this._tileFadeInsAwaitingInitialSort){if(a>e||!t.has(r))continue;const n=this._tileHandles.get(r);if(!n){this._tileFadeInsAwaitingInitialSort.delete(r);continue}const l=0===n.lifecycleState;2!==n.lifecycleState&&(n.lifecycleState=2,l&&this._popTileFromCache(n),i.push(n),s=!0),this.fadeHelper.fadeTile(n,0),this._tileFadeInsAwaitingInitialSort.delete(r)}return s}_triggerFadeOuts(e,t){let i=!1;for(const[s,r]of this._tileFadeOutsAwaitingInitialSort){if(r>e)continue;const a=this._tileHandles.get(s);if(a){const e=2===a.lifecycleState;this.fadeHelper.fadeTile(a,1),e&&0===a.lifecycleState&&(t.push(a),i=!0)}this._tileFadeOutsAwaitingInitialSort.delete(s)}return i}_popTileFromCache(e){this._usedTileMemory+=e.usedMemory,this._cacheTileMemory-=e.usedMemory,this._intersectionHandler.addTile(e),this._memCache.pop(`${e.handle}`)}moveTileToCache(e){this._usedTileMemory-=e.usedMemory,this._cacheTileMemory+=e.usedMemory,this._intersectionHandler.removeTile(e),this._memCache.put(`${e.handle}`,e)}destroy(){this._createRenderableAbortController.abort(),T(this),this._suspendedHandle&&(this._suspendedHandle=i(this._suspendedHandle)),this._intersectionHandler&&(this.view.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler),this._intersectionHandler=null),this._elevationProvider&&this.view.elevationProvider&&(this._elevationProvider.notifyObjectsChangedFunctional(e=>{for(const t of this._tileHandles.values())e(t.obb)}),this.view.elevationProvider.unregister(this._elevationProvider),this._elevationProvider=null),this._frameTask.remove(),this._shadowRenderNode.destroy(),this._renderNode.destroy(),this.data.destroy(),this._memCache.destroy()}_canProjectWithoutEngine(){if(1===this.view.state.viewingMode)return!0;if(p(this.view.renderSpatialReference)||f(this.view.renderSpatialReference))return!0;if(this.layer.esriCrsSpatialReference&&g(this.layer.esriCrsSpatialReference,this.view.renderSpatialReference)){if(115700===this.layer.esriCrsSpatialReference.vcsWkid)return!1;let e=w(this.layer.esriCrsSpatialReference);if(!e){const t=this.layer.esriCrsSpatialReference;let i="meters";!_(t)&&t.wkid&&-1!==t.wkid&&(i=a(y.units[y[t.wkid]])),i&&(e=new u({heightModel:"gravity-related-height",heightUnit:i}))}const t=this.view.heightModelInfo;return this._useEsriCrs=0===m(e,t,!1),this._useEsriCrs&&(e&&(this._metersPerVCSUnit=n(1,e.heightUnit,"meters")),this.fullExtentInLocalViewSpatialReference=this.layer.esriCrsFullExtent),this._useEsriCrs}return!1}_elevationInfoChanged(e){if(e?.offset)if(this._useEsriCrs){const t=S(e?.unit)/this._metersPerVCSUnit,i=e?.offset??0;this._wasm?.setLayerOffset(this,i*t)}else this._wasm?.setLayerOffset(this,v(e));else this._wasm?.setLayerOffset(this,0)}_slicePlaneEnabledChanged(e){this._renderNode&&(this._renderNode.slicePlaneEnabled=e),this._intersectionHandler&&(this._intersectionHandler.slicePlaneEnabled=e)}updateGaussians(){const e=new Array;for(const t of this._tileHandles.values())0!==t.lifecycleState&&e.push(t);this.data.updateGaussianVisibility(e,this._currentLyr3dVisibilityChange),this.notifyChange("updating")}setMaximumGaussianCount(e){this._wasm?.setMaximumGaussianSplatCount(e)}_freeInvisibleTiles(){for(const e of this._tileHandles.values())0===e.lifecycleState&&this._deleteTile(e)}extractHeader(e){const t=e.length-4,i=this.reinterpretU32AsFloat(e[t]),s=this.reinterpretU32AsFloat(e[t+1]),r=this.reinterpretU32AsFloat(e[t+2]),a=1/(1<<(255&e[t+3]));return{packedHeader:e.subarray(t,t+4),tileOrigin:{x:i,y:s,z:r},invPosScale:a}}_deleteTile(e){this._wasm?.onRenderableEvicted(this,e.handle,e.usedMemory),this.freeRenderable(e.handle)}reinterpretU32AsFloat(e){return this._u32View[0]=e,this._f32View[0]}get performanceInfo(){let e=0,t=0;this._tileHandles.forEach(i=>{0===i.lifecycleState?t++:e++});const i=this.data?.textureAtlasMemory??0,s=this.data?.orderTextureMemory??0,r=this.data?.fadingTextureMemory??0,a=this.data?.sortBufferMemory??0;return new b(this.usedMemory,e,this._usedTileMemory,t,this._cacheTileMemory,i,s,r,a)}get test(){}};e([l()],J.prototype,"layer",void 0),e([l({readOnly:!0})],J.prototype,"_clippingBox",null),e([l()],J.prototype,"elevationOffset",null),e([l({readOnly:!0})],J.prototype,"visibleAtCurrentScale",null),e([l()],J.prototype,"fullExtentInLocalViewSpatialReference",void 0),J=$=e([o("esri.views.3d.layers.GaussianSplatLayerView3D")],J);const K=J;export{K as default};
2
+ import{__decorate as e}from"tslib";import"../../../core/has.js";import t from"../../../core/Logger.js";import{removeMaybe as i}from"../../../core/maybe.js";import{watch as s,initial as r}from"../../../core/reactiveUtils.js";import{unitFromRESTJSON as a,convertUnit as n}from"../../../core/units.js";import{property as l,subclass as o}from"../../../core/accessorSupport/decorators.js";import{fromValues as h}from"../../../core/libs/gl-matrix-2/factories/quatf64.js";import{getReferenceEllipsoid as d}from"../../../geometry/ellipsoidUtils.js";import u from"../../../geometry/HeightModelInfo.js";import{create as c}from"../../../geometry/support/aaBoundingBox.js";import{isCompatible as m}from"../../../geometry/support/heightModelInfoUtils.js";import{isPlateCarree as p,isWebMercator as f,equals as g,isGeographic as y}from"../../../geometry/support/spatialReferenceUtils.js";import _ from"../../../geometry/support/WKIDUnitConversion.js";import{getHeightModelInfoFromVCS as w}from"../../../layers/support/tiles3DUtils.js";import{getElevationOffsetInMeters as v}from"../../../support/elevationInfoUtils.js";import{getMetersPerUnit as S}from"../../../symbols/support/unitConversionUtils.js";import{GaussianSplatLayerViewPerformanceInfo as b}from"./GaussianSplatLayerViewPerformanceInfo.js";import{LayerView3D as C}from"./LayerView3D.js";import{addLayerViewToWasm as M,getLyr3DWasm as x,removeLayerViewFromWasm as I}from"./Lyr3DWasm.js";import{LayerElevationProvider as T}from"./i3s/LayerElevationProvider.js";import{ElevationRange as H}from"../support/ElevationRange.js";import{projectToBoundingBox as A}from"../support/extentUtils.js";import{Obb as R}from"../support/orientedBoundingBox.js";import{splatPageSizeInU32 as P,packedGaussianSizeInU32 as j,splatPageSizeInU32WithoutHeader as F,gaussiansPerSplatPage as O,elementsPerSplatPage as G,splatAtlasTextureWidth as U}from"../support/gaussianSplatting/GaussianSplatAtlasPages.js";import{GaussianSplatDataStore as E}from"../support/gaussianSplatting/GaussianSplatDataStore.js";import{GaussianSplatFadeHelper as V}from"../support/gaussianSplatting/GaussianSplatFadeHelper.js";import{GaussianSplatIntersectionHandler as L}from"../support/gaussianSplatting/GaussianSplatIntersectionHandler.js";import{GaussianTile as B}from"../support/gaussianSplatting/GaussianTile.js";import{GaussianSplatRenderNode as z}from"../webgl-engine/lib/GaussianSplatRenderNode.js";import{GaussianSplatShadowRenderNode as k}from"../webgl-engine/lib/GaussianSplatShadowRenderNode.js";import N from"../../layers/LayerView.js";import{spatialReferenceIncompatibleError as q,isInEffectiveScaleRange as D}from"../../support/layerViewUtils.js";import{TaskPriority as W}from"../../support/Scheduler.js";var $;const X=()=>t.getLogger("esri.views.3d.layers.GaussianSplatLayerView3D"),Z=3,J=Z*Z,K=255,Y=(()=>{const e=new Int16Array(K+1);e[0]=-255;for(let t=1;t<e.length;t++)e[t]=Math.round(16*Math.log(t/K));return e})();let Q=class extends(C(N)){static{$=this}static{this.createRenderableBatchSize=64}constructor(e){super(e),this.type="gaussian-splat-3d",this.ignoresMemoryFactor=!1,this._tileHandles=new Map,this._pageBuffer=new Uint32Array(P),this._tmpTilesWithChangedVisibility=new Array,this._currentLyr3dVisibilityChange=0,this._tileFadeInsAwaitingInitialSort=new Map,this._tileFadeOutsAwaitingInitialSort=new Map,this._tmpSortedTileHandles=new Set,this._createRenderableAbortController=new AbortController,this._wasmLayerId=-1,this._metersPerVCSUnit=1,this._usedTileMemory=0,this._cacheTileMemory=0,this._useEsriCrs=!1,this.fullExtentInLocalViewSpatialReference=null,this._suspendedHandle=null,this._conversionBuffer=new ArrayBuffer(4),this._u32View=new Uint32Array(this._conversionBuffer),this._f32View=new Float32Array(this._conversionBuffer);const t=e.view.resourceController;this._memCache=t.memoryController.newCache(`GaussianSplat-${this.uid}`,e=>this._deleteTile(e)),this._frameTask=t.scheduler.registerTask(W.GAUSSIAN_SPLAT_TEXTURE_ATLAS)}get _clippingBox(){if(!this.view?.clippingArea)return null;const e=c();return A(this.view.clippingArea,e,this.view.renderSpatialReference)?e:null}get clippingBox(){return this._renderNode?.clippingBox??null}initialize(){if(!this._canProjectWithoutEngine())throw q("layer",this.layer.spatialReference.wkid,this.view.renderSpatialReference?.wkid);const e=M(this).then(e=>{this._wasmLayerId=e,this._renderNode=new z({view:this.view,layerView:this}),this.data=new E(this._renderNode,(e,t)=>this._onSortComplete(e,t)),this._shadowRenderNode=new k({view:this.view,layerView:this}),this.fadeHelper=new V(this),this._intersectionHandler=new L(this),this.view.sceneIntersectionHelper.addIntersectionHandler(this._intersectionHandler),this._elevationProvider=new T({view:this.view,layerElevationSource:this,intersectionHandler:this._intersectionHandler}),this.view.elevationProvider.register(2,this._elevationProvider),this.addHandles([s(()=>this.layer.elevationInfo,e=>this._elevationInfoChanged(e)),s(()=>this.slicePlaneEnabled,e=>this._slicePlaneEnabledChanged(e),r)]),this._suspendedHandle=s(()=>this.suspended,e=>this._wasm?.setEnabled(this,!e),r),this.addHandles([s(()=>this._clippingBox,e=>this._renderNode.clippingBox=e,r)]),this.setMaximumGaussianCount(this.view.qualitySettings.gaussianSplat.maximumNumberOfGaussians)});this.addHandles([s(()=>this.view.qualitySettings.fadeDuration,e=>{this.fadeHelper.onFadeDurationChanged(e),this.data.fadingTexture.updateTexture(this.data.textureAtlas.pageAllocator.pageCount)}),s(()=>this.view.qualitySettings.gaussianSplat.maximumNumberOfGaussians,e=>this.setMaximumGaussianCount(e*this.view.quality)),s(()=>this.view.quality,e=>this.setMaximumGaussianCount(this.view.qualitySettings.gaussianSplat.maximumNumberOfGaussians*e))]),this.addResolvingPromise(e)}get wasmLayerId(){return this._wasmLayerId}get metersPerVCSUnit(){return this._metersPerVCSUnit}get tileHandles(){return this._tileHandles}get _wasm(){return x(this.view)}get usedMemory(){return this._usedTileMemory+(this.data?.usedMemory??0)}get cachedMemory(){return this._cacheTileMemory}get unloadedMemory(){return 0}get useEsriCrs(){return this._useEsriCrs}get elevationProvider(){return this._elevationProvider}get elevationOffset(){return v(this.layer.elevationInfo)}get elevationRange(){const e=this.fullExtent;return e?.zmin&&e?.zmax?new H(e.zmin,e.zmax):null}getElevationRange(e){return this._intersectionHandler.getElevationRange(e)}get fullExtent(){return this.layer.fullExtent}get visibleAtCurrentScale(){return D(this.layer.effectiveScaleRange,this.view.scale)}isUpdating(){const e=this._wasm;return!(this._wasmLayerId<0||null==e)&&(e.isUpdating(this._wasmLayerId)||this.data.updating||this.fadeHelper.updating)}updatingFlagChanged(){this.notifyChange("updating")}async createRenderable(e){const t=e.meshData;if(null==t.data)throw new Error("meshData.data undefined");if(t.desc=JSON.parse(t.desc),null==t.desc)throw new Error("meshData.desc undefined");const i=t.desc.prims[0],s=i.vertexCount;if(0===s)return{memUsageBytes:0,numGaussians:0};const r=i.atrbs[0].view,a=i.atrbs[0].view.byteCount,n=i.atrbs[0].view.byteOffset;let l=null;if("U32"!==r.type)return X().warnOnce("unexpected meshData.data format"),{memUsageBytes:0,numGaussians:0};l=new Uint32Array(t.data.buffer,n,a/4);const o=this.extractHeader(l),u=2.048,c=o.tileOrigin.x*u,m=o.tileOrigin.y*u,p=o.tileOrigin.z*u;let f=null;if(t.desc.obb){const e=t.desc.obb.quaternion;f=new R(t.desc.obb.center,t.desc.obb.halfSize,h(...e))}f||(X().warnOnce("encountered tile without a bounding box"),f=new R);const g=this.view.state.isGlobal,y=g?d(this.view.spatialReference).radius:0,_={handle:e.handle,bufferView:l,totalGaussians:s,packedHeader:o.packedHeader,tileOrigin:{x:c,y:m,z:p},invPosScale:o.invPosScale,obb:f,origin:{x:f.centerX,y:f.centerY,z:f.centerZ},isGlobal:g,ellipsoidRadius:y};return this._frameTask.scheduleGenerator(e=>this._createRenderableTask(_,e),this._createRenderableAbortController.signal)}*_createRenderableTask(e,t){const{handle:i,bufferView:s,totalGaussians:r,packedHeader:a,tileOrigin:n,invPosScale:l,obb:o,origin:h,isGlobal:d,ellipsoidRadius:u}=e,c=n.x,m=n.y,p=n.z,f=h.x,g=h.y,y=h.z,_=new Uint32Array(r),w=new Float32Array(3*r),v=new Uint32Array(r),S=new Uint32Array(r),b=new Array,C=Math.ceil(r/O);for(let H=0;H<C;H++){let e=this.data.textureAtlas.requestPage();if(null===e&&(this._freeInvisibleTiles(),e=this.data.textureAtlas.requestPage()),null===e)return X().warnOnce("ran out of gaussian splat memory"),{memUsageBytes:0,numGaussians:0};b.push(e);const i=r-H*O,n=Math.min(i,O),l=H*O,o=G*e;for(let t=0;t<n;t++)_[l+t]=o+t;const h=H*F;this._pageBuffer.set(s.subarray(h,h+n*j)),this._pageBuffer.set(a,F);const d=e*G,u=d%U,c=Math.floor(d/U);this.data.textureAtlas.update(u,c,this._pageBuffer),t.madeProgress()&&(t=yield)}let M=1/0,x=-1/0,I=1/0,T=-1/0,A=0,R=-1,P=0;for(let H=0;H<r;H++){const e=H*j,i=s[e],r=s[e+1],a=s[e+2],n=s[e+3],o=16383&r,h=r>>>14&16383,u=r>>>28&15|(1023&a)<<4,_=Y[n>>>24],b=(a>>>10&255)+_,C=(a>>>18&255)+_,F=(a>>>26&63|(3&n)<<6)+_,O=b>0?b:0,G=C>0?C:0,U=F>0?F:0,E=O|G<<8|U<<16,V=Math.max(O,G,U),L=o*l+c,B=h*l+m,z=u*l+p;if(w[A]=L-f,w[A+1]=B-g,w[A+2]=z-y,d){const e=L*L+B*B+z*z;I=Math.min(I,e),T=Math.max(T,e)}else M=Math.min(M,z),x=Math.max(x,z);v[H]=i,S[H]=E,V>R&&(R=V),A+=3,P++,P===$.createRenderableBatchSize&&(P=0,t.madeProgress()&&(t=yield))}P>0&&t.madeProgress(),d&&(M=Math.sqrt(I)-u,x=Math.sqrt(T)-u);const E=this._extractGaussianSplatMbsRadiusSquared(R),{fullExtent:V}=this.layer;V?.hasZ&&V.zmax&&V.zmin&&(M=Math.max(M,V.zmin),x=Math.min(x,V.zmax));const L=new H(M,x),z=new B(i,o,_,b,w,v,S,r,E,L);return this._memCache.put(`${z.handle}`,z),this._tileHandles.set(i,z),this._cacheTileMemory+=z.usedMemory,{memUsageBytes:z.usedMemory,numGaussians:r}}_extractGaussianSplatMbsRadiusSquared(e){return Math.exp(e/8-20)*J}freeRenderable(e){this._tileFadeInsAwaitingInitialSort.delete(e),this._tileFadeOutsAwaitingInitialSort.delete(e);let t=!1;const i=this._tileHandles.get(e);if(i){0!==i.lifecycleState?(t=!0,this.fadeHelper.onTileDiscarded(i),this._usedTileMemory-=i.usedMemory,this._intersectionHandler.removeTile(i)):this._cacheTileMemory-=i.usedMemory,i.pageIds.forEach(e=>this.data.textureAtlas.freePage(e)),this.freeObject(i),this._tileHandles.delete(e)}t&&this.updateGaussians()}freeObject(e){this._memCache.pop(`${e.handle}`)}notifyTileObbsChanged(e){this._elevationProvider&&this._elevationProvider.notifyObjectsChangedFunctional(t=>{for(const i of e)t(i.obb)})}setRenderableVisibility(e,t,i){const s=this._currentLyr3dVisibilityChange+1;let r=!1;for(let a=0;a<i;a++){const i=this._tileHandles.get(e[a]);if(!i)continue;const n=t[a]?this._prepareTileFadeIn(i,s):this._prepareTileFadeOut(i,s);r||=n}r&&(this._currentLyr3dVisibilityChange=s,this.updateGaussians())}_prepareTileFadeIn(e,t){const i=this._tileFadeOutsAwaitingInitialSort.delete(e.handle);return 2===e.lifecycleState?(this.fadeHelper.fadeTile(e,0),!1):this._tileFadeInsAwaitingInitialSort.get(e.handle)!==t?(0===e.lifecycleState&&this._popTileFromCache(e),e.lifecycleState=1,this._tileFadeInsAwaitingInitialSort.set(e.handle,t),!0):i}_prepareTileFadeOut(e,t){const i=this._tileFadeInsAwaitingInitialSort.delete(e.handle);return i&&1===e.lifecycleState&&(this.moveTileToCache(e),e.lifecycleState=0),2!==e.lifecycleState?i:this._tileFadeOutsAwaitingInitialSort.get(e.handle)!==t?(this._tileFadeOutsAwaitingInitialSort.set(e.handle,t),!0):i}_onSortComplete(e,t){const i=this._tmpTilesWithChangedVisibility;i.length=0;const s=this._tmpSortedTileHandles;s.clear();for(let a=0;a<e.length;a++){const t=e[a];s.add(t.handle)}this._triggerFadeIns(t,s,i);const r=this._triggerFadeOuts(t,i);s.clear(),i.length>0&&this.notifyTileObbsChanged(i),r&&this.updateGaussians()}_triggerFadeIns(e,t,i){for(const[s,r]of this._tileFadeInsAwaitingInitialSort){if(r>e||!t.has(s))continue;const a=this._tileHandles.get(s);if(!a){this._tileFadeInsAwaitingInitialSort.delete(s);continue}const n=0===a.lifecycleState;2!==a.lifecycleState&&(a.lifecycleState=2,n&&this._popTileFromCache(a),i.push(a)),this.fadeHelper.fadeTile(a,0),this._tileFadeInsAwaitingInitialSort.delete(s)}}_triggerFadeOuts(e,t){let i=!1;for(const[s,r]of this._tileFadeOutsAwaitingInitialSort){if(r>e)continue;const a=this._tileHandles.get(s);if(a){const e=2===a.lifecycleState;this.fadeHelper.fadeTile(a,1),e&&0===a.lifecycleState&&(t.push(a),i=!0)}this._tileFadeOutsAwaitingInitialSort.delete(s)}return i}_popTileFromCache(e){this._usedTileMemory+=e.usedMemory,this._cacheTileMemory-=e.usedMemory,this._intersectionHandler.addTile(e),this._memCache.pop(`${e.handle}`)}moveTileToCache(e){this._usedTileMemory-=e.usedMemory,this._cacheTileMemory+=e.usedMemory,this._intersectionHandler.removeTile(e),this._memCache.put(`${e.handle}`,e)}destroy(){this._createRenderableAbortController.abort(),I(this),this._suspendedHandle&&(this._suspendedHandle=i(this._suspendedHandle)),this._intersectionHandler&&(this.view.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler),this._intersectionHandler=null),this._elevationProvider&&this.view.elevationProvider&&(this._elevationProvider.notifyObjectsChangedFunctional(e=>{for(const t of this._tileHandles.values())e(t.obb)}),this.view.elevationProvider.unregister(this._elevationProvider),this._elevationProvider=null),this._frameTask.remove(),this._shadowRenderNode.destroy(),this._renderNode.destroy(),this.data.destroy(),this._memCache.destroy()}_canProjectWithoutEngine(){if(1===this.view.state.viewingMode)return!0;if(p(this.view.renderSpatialReference)||f(this.view.renderSpatialReference))return!0;if(this.layer.esriCrsSpatialReference&&g(this.layer.esriCrsSpatialReference,this.view.renderSpatialReference)){if(115700===this.layer.esriCrsSpatialReference.vcsWkid)return!1;let e=w(this.layer.esriCrsSpatialReference);if(!e){const t=this.layer.esriCrsSpatialReference;let i="meters";!y(t)&&t.wkid&&-1!==t.wkid&&(i=a(_.units[_[t.wkid]])),i&&(e=new u({heightModel:"gravity-related-height",heightUnit:i}))}const t=this.view.heightModelInfo;return this._useEsriCrs=0===m(e,t,!1),this._useEsriCrs&&(e&&(this._metersPerVCSUnit=n(1,e.heightUnit,"meters")),this.fullExtentInLocalViewSpatialReference=this.layer.esriCrsFullExtent),this._useEsriCrs}return!1}_elevationInfoChanged(e){if(e?.offset)if(this._useEsriCrs){const t=S(e?.unit)/this._metersPerVCSUnit,i=e?.offset??0;this._wasm?.setLayerOffset(this,i*t)}else this._wasm?.setLayerOffset(this,v(e));else this._wasm?.setLayerOffset(this,0)}_slicePlaneEnabledChanged(e){this._renderNode&&(this._renderNode.slicePlaneEnabled=e),this._intersectionHandler&&(this._intersectionHandler.slicePlaneEnabled=e)}updateGaussians(){const e=new Array;for(const t of this._tileHandles.values())0!==t.lifecycleState&&e.push(t);this.data.updateGaussianVisibility(e,this._currentLyr3dVisibilityChange),this.notifyChange("updating")}setMaximumGaussianCount(e){this._wasm?.setMaximumGaussianSplatCount(e)}_freeInvisibleTiles(){for(const e of this._tileHandles.values())0===e.lifecycleState&&this._deleteTile(e)}extractHeader(e){const t=e.length-4,i=this.reinterpretU32AsFloat(e[t]),s=this.reinterpretU32AsFloat(e[t+1]),r=this.reinterpretU32AsFloat(e[t+2]),a=1/(1<<(255&e[t+3]));return{packedHeader:e.subarray(t,t+4),tileOrigin:{x:i,y:s,z:r},invPosScale:a}}_deleteTile(e){this._wasm?.onRenderableEvicted(this,e.handle,e.usedMemory),this.freeRenderable(e.handle)}reinterpretU32AsFloat(e){return this._u32View[0]=e,this._f32View[0]}get performanceInfo(){let e=0,t=0;this._tileHandles.forEach(i=>{0===i.lifecycleState?t++:e++});const i=this.data?.textureAtlasMemory??0,s=this.data?.orderTextureMemory??0,r=this.data?.fadingTextureMemory??0,a=this.data?.sortBufferMemory??0;return new b(this.usedMemory,e,this._usedTileMemory,t,this._cacheTileMemory,i,s,r,a)}get test(){}};e([l()],Q.prototype,"layer",void 0),e([l({readOnly:!0})],Q.prototype,"_clippingBox",null),e([l()],Q.prototype,"elevationOffset",null),e([l({readOnly:!0})],Q.prototype,"visibleAtCurrentScale",null),e([l()],Q.prototype,"fullExtentInLocalViewSpatialReference",void 0),Q=$=e([o("esri.views.3d.layers.GaussianSplatLayerView3D")],Q);const ee=Q;export{ee as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import has from"../../../../core/has.js";import{pt2px as e}from"../../../../core/screenUtils.js";import{ZEROS as t}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{fromBuffer as r,intersectsClippingArea as i,empty as s,expandWithAABB as o,create as n}from"../../../../geometry/support/aaBoundingBox.js";import{newDoubleArray as a}from"../../../../geometry/support/DoubleArray.js";import{newFloatArray as l}from"../../../../geometry/support/FloatArray.js";import{elevationModeChangeUpdateType as c,needsElevationUpdates2D as p}from"./elevationAlignmentUtils.js";import{Graphics3DDrapedGraphicLayer as h}from"./Graphics3DDrapedGraphicLayer.js";import{Graphics3DObject3DGraphicLayer as u}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as d}from"./Graphics3DSymbolLayer.js";import{mixinColorAndOpacity as m}from"./graphicUtils.js";import{parseCapType as _,computeSymbolLayerIndex as g}from"./lineUtils.js";import{geometryAsPolygon as y,createColorGeometry as f,PolygonCreationDataBase as v}from"./polygonUtils.js";import{initFastSymbolUpdatesState as x,updateFastSymbolUpdatesState as S,getAttributeValue as b,ConvertOptions as C}from"../support/FastSymbolUpdates.js";import{createMaterial as P,uvElevationAligner as D}from"../support/patternUtils.js";import{createMapSpaceUVCoords as O,createMapSpaceUVCoordsDraped as U}from"../support/uvUtils.js";import{createGeometry as j}from"../../support/engineContent/line.js";import{loadTessellationUtils as w,preloadedPolygonToRenderInfoElevationAligned as G,preloadedPolygonToRenderInfoDraped as A}from"../../support/renderInfoUtils/polygon.js";import{Object3D as E}from"../../webgl-engine/lib/Object3D.js";import{RenderGeometry as I}from"../../webgl-engine/lib/RenderGeometry.js";import{isScreenSizePerspectiveEnabled as V}from"../../webgl-engine/lib/screenSizePerspectiveUtils.js";import{getStipplePatternForLinePattern as L}from"../../webgl-engine/materials/lineStippleUtils.js";import{PatternMaterial as M}from"../../webgl-engine/materials/PatternMaterial.js";import{RibbonLineMaterial as R}from"../../webgl-engine/materials/RibbonLineMaterial.js";const z=["polyline","polygon","extent"];class B extends d{static{this.elevationModeChangeTypes={definedChanged:2,staysOnTheGround:0,onTheGroundChanged:2}}constructor(e,t,r,i){super(e,t,r,i,k(t)),this._needsUV=!1,this._materials=[]}async doLoad(){this._fastUpdates=x(this._context.renderer,this._vvConvertOptions),await w()}get _materialColor(){return this.symbolLayer.material?.color}get _emissiveStrength(){if(has("enable-feature:emissive-on-none-volumetrics")){const e=this.symbolLayer.material?.emissive;return("color"===e?.source?e?.strength:void 0)??0}return 0}_createMaterials(){if(this._materials.length>0)return;const t=this._materialColor,r=this._getCombinedOpacityAndColor(t);this._materials[0]=P(this.symbolLayer,{color:r,forceTransparentMode:this.needsDrivenTransparentPass,discardInvisibleFragments:!0,hasVertexColors:this._drivenProperties.color||this._drivenProperties.opacity,draped:this.draped,hasSlicePlane:this._context.slicePlaneEnabled,emissiveStrength:this._emissiveStrength,...this._fastUpdates?.materialParameters}),this._needsUV=this._materials[0]instanceof M;const i=this.symbolLayer.outline;if(W(i)){const t=L(i.pattern);this._materials[1]=new R({width:e(i.size),color:this._getOutlineColor(),polygonOffset:3,polygonOffsetIndex:g(this._renderPriority,this._renderPriorityStep),hasSlicePlane:this._context.slicePlaneEnabled,isClosed:!0,stipplePattern:t,cap:_(i.patternCap||"butt"),screenSizePerspective:this._outlineScreenSizePerspective},this.view.state.isGlobal)}}get _outlineScreenSizePerspective(){return!this.draped&&V(this._context.layer.screenSizePerspectiveEnabled)?this.view.screenSizePerspective.parameters:null}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,z,this.symbolLayer.type))return null;const r=this._getDrivenUInt8Color(e.renderingInfo,this._materialColor,!1),i=this.createElevationContextForGraphic(t);return this.ensureDrapedStatus("on-the-ground"===i.mode),this._createMaterials(),this.draped?this._createAsOverlay(e.renderingInfo,t,r):this._createAs3DShape(e.renderingInfo,t,r,i)}applyRendererDiff(e,t){for(const r in e.diff){if("visualVariables"!==r)return 0;if(!S(this._fastUpdates,t,this._vvConvertOptions))return 0;this._materials[0]?.setParameters(this._fastUpdates.materialParameters)}return 2}layerOpacityChanged(){if(null!=this._materials[0]){const e=this._materials[0].parameters.color,t=this._materialColor,r=this._getCombinedOpacity(t);this._materials[0].setParameters({color:[e[0],e[1],e[2],r],forceTransparentMode:this.needsDrivenTransparentPass})}if(null!=this._materials[1]){const e=this._materials[1].parameters.color;this._materials[1].setParameters({color:[e[0],e[1],e[2],this._getOutlineOpacity()]})}}layerScreenSizePerspectiveChanged(){this._materials[1]?.setParameters({screenSizePerspective:this._outlineScreenSizePerspective})}layerElevationInfoChanged(e,t,r){const i=this._elevationContext.mode,s=c(B.elevationModeChangeTypes,r,i);if(1!==s)return s;const o=p(i);return this.updateGraphics3DGraphicElevationInfo(e,t,()=>o)}slicePlaneEnabledChanged(){if(this._materials[0]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),this._materials[1]){const e={hasSlicePlane:this._context.slicePlaneEnabled};this._materials[1].setParameters(e)}return!0}physicalBasedRenderingChanged(){return!0}_createAs3DShape(e,t,r,i){const s=y(t.geometry);if(!s)return null;const o=G(s,this._context.elevationProvider,this._context.renderCoordsHelper,i,{projectIfNearlyVertical:!0,outlineOutput:"vertex-data"});if(null==o)return null;const n=new T(o,r,this._context.layerViewUid,t.uid),c=n.renderData.vertexCount;if(this._needsUV&&(n.uvMapSpace=l(4*c,!0),n.boundingRect=a(9),O(n.uvMapSpace,n.boundingRect,n.renderData.positions,this._context.renderCoordsHelper)),n.olidColor=this._context.stage.renderView?.getObjectAndLayerIdColor(n),this._createAs3DShapeFill(e,n),this._materials[1]&&this._createAs3DShapeOutline(n),this._logGeometryCreationWarnings(n.renderData,s.rings,"rings","FillSymbol3DLayer"),0===n.outGeometries.length)return null;const h=new E({geometries:n.outGeometries,castShadow:!1,layerViewUid:this._context.layerViewUid,graphicUid:t.uid}),d=new u(this,h,null,D,i);return d.alignedSampledElevation=n.renderData.sampledElevation,d.needsElevationUpdates=p(i.mode),d}_createAs3DShapeFill(e,t){const{mapPositions:s,positions:o,polygonIndices:n,polygonIndexCount:a}=t.renderData;if(0===a)return;if(null!=this._context.clippingExtent&&(r(s,F),!i(F,this._context.clippingExtent)))return;const l=this._fastUpdates?.visualVariables.color,c=f({material:this._materials[0],indices:n,mapPositions:s,attributeData:{position:o,color:l?null:t.color,colorFeature:l?b(l,e.color):null,uvMapSpace:this._needsUV?t.uvMapSpace:null,boundingRect:this._needsUV?t.boundingRect:null,olidColor:t.olidColor}});t.outGeometries.push(c)}_createAs3DShapeOutline(e){if(null==this._materials[1])return;const{outline:t}=e.renderData;if("vertex-data"!==t.output)return;const{outlines:s}=t;if(null!=s&&0!==s.length)for(const{mapPositions:o,position:n}of s){if(null!=this._context.clippingExtent&&(r(o,F),!i(F,this._context.clippingExtent)))continue;const t=j(this._materials[1],{overlayInfo:null,removeDuplicateStartEnd:!0,mapPositions:o,attributeData:{position:n}},e.olidColor);e.outGeometries.push(t)}}_createAsOverlay(e,t,r){const i=y(t.geometry);if(null==i)return null;this._materials[0].renderPriority=this._renderPriority+this._renderPriorityStep/2,null!=this._materials[1]&&(this._materials[1].renderPriority=this._renderPriority);const o=A(i,{drapedSpatialReference:this._context.overlaySR,outlineOutput:"vertex-data"});if(null==o)return null;const n=new H(o,r,this._context.layerViewUid,t.uid);return this._needsUV&&(n.uvMapSpace=l(4*n.renderData.vertexCount,!0),U(n.uvMapSpace,n.renderData.positions,this._context.overlaySR,this._context.graphicsCoreOwner.view.state.viewingMode)),n.outBoundingBox=s(),n.olidColor=this._context.stage.renderView?.getObjectAndLayerIdColor(n),this._createAsOverlayFill(e,n),this._materials[1]&&this._createAsOverlayOutline(n),this._logGeometryCreationWarnings(n.renderData,i.rings,"rings","FillSymbol3DLayer"),new h(this,n.outGeometries,n.outBoundingBox,this._context.drapeSourceRenderer)}_createAsOverlayFill(e,t){const{positions:s,polygonIndices:n,polygonIndexCount:a}=t.renderData;if(0===a)return;const l=r(s,F);if(!i(l,this._context.clippingExtent))return;o(t.outBoundingBox,l);const c=this._fastUpdates?.visualVariables.color,p=f({material:this._materials[0],indices:n,attributeData:{position:s,color:c?null:t.color,colorFeature:c?b(c,e.color):null,uvMapSpace:this._needsUV?t.uvMapSpace:null,olidColor:t.olidColor}});t.outGeometries.push(new I(p,t))}_createAsOverlayOutline(e){if(null==this._materials[1])return;const{outline:t}=e.renderData;if("vertex-data"!==t.output)return;const{outlines:s}=t;for(const{position:n}of s){if(r(n,F),!i(F,this._context.clippingExtent))continue;o(e.outBoundingBox,F);const t=j(this._materials[1],{overlayInfo:{spatialReference:this._context.overlaySR,renderCoordsHelper:this._context.renderCoordsHelper},removeDuplicateStartEnd:!0,attributeData:{position:n}},e.olidColor);e.outGeometries.push(new I(t,e))}}_getOutlineOpacity(){const e=this.symbolLayer?.outline?.color;return(this.draped?1:this._getLayerOpacity())*(null!=e?e.a:0)}_getOutlineColor(){const e=this.symbolLayer?.outline?.color,t=this._getOutlineOpacity();return m(e?.toUnitRGB(),t)}test(){return{...super.test(),createAsOverlay:(e,t,r)=>this._createAsOverlay(e,t,r),createAs3DShape:(e,t,r,i)=>this._createAs3DShape(e,t,r,i)}}get _vvConvertOptions(){return new C({supports:{size:!1,color:!0,rotation:!1,opacity:!1},fallbackColor:this._materialColor?.toUnitRGBA()??t})}}const F=n();class T extends v{constructor(e,t,r,i){super(e,r,i),this.color=t}}class H extends v{constructor(e,t,r,i){super(e,r,i),this.color=t}}function W(e){return null!=e?.size&&e.size>0&&null!=e.color&&(null==e.pattern||"style"!==e.pattern.type||"none"!==e.pattern.style)}function k(e){return 1===(e.material?.color?.a??0)}export{B as Graphics3DPolygonFillSymbolLayer};
2
+ import has from"../../../../core/has.js";import{pt2px as e}from"../../../../core/screenUtils.js";import{ZEROS as t}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{fromBuffer as r,intersectsClippingArea as i,empty as s,expandWithAABB as n,create as o}from"../../../../geometry/support/aaBoundingBox.js";import{newDoubleArray as a,doubleSubArray as l}from"../../../../geometry/support/DoubleArray.js";import{newFloatArray as c}from"../../../../geometry/support/FloatArray.js";import{getContinuousIndexArray as p}from"../../../../geometry/support/Indices.js";import{elevationModeChangeUpdateType as u,needsElevationUpdates2D as h}from"./elevationAlignmentUtils.js";import{Graphics3DDrapedGraphicLayer as d}from"./Graphics3DDrapedGraphicLayer.js";import{Graphics3DObject3DGraphicLayer as m}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as _}from"./Graphics3DSymbolLayer.js";import{mixinColorAndOpacity as g}from"./graphicUtils.js";import{parseCapType as y,computeSymbolLayerIndex as f}from"./lineUtils.js";import{geometryAsPolygon as v,createColorGeometry as x,PolygonCreationDataBase as b}from"./polygonUtils.js";import{initFastSymbolUpdatesState as S,updateFastSymbolUpdatesState as C,getAttributeValue as P,ConvertOptions as D}from"../support/FastSymbolUpdates.js";import{createMaterial as O,uvElevationAligner as U}from"../support/patternUtils.js";import{writeMapSpaceUVCoordsPerConnectedPart as j,writeMapSpaceUVCoordsDraped as w}from"../support/uvUtils.js";import{createGeometry as I}from"../../support/engineContent/line.js";import{loadTessellationUtils as G,preloadedPolygonToRenderInfoElevationAligned as A,preloadedPolygonToRenderInfoDraped as E}from"../../support/renderInfoUtils/polygon.js";import{Object3D as R}from"../../webgl-engine/lib/Object3D.js";import{RenderGeometry as V}from"../../webgl-engine/lib/RenderGeometry.js";import{isScreenSizePerspectiveEnabled as L}from"../../webgl-engine/lib/screenSizePerspectiveUtils.js";import{getStipplePatternForLinePattern as M}from"../../webgl-engine/materials/lineStippleUtils.js";import{PatternMaterial as z}from"../../webgl-engine/materials/PatternMaterial.js";import{RibbonLineMaterial as B}from"../../webgl-engine/materials/RibbonLineMaterial.js";const F=["polyline","polygon","extent"];class T extends _{static{this.elevationModeChangeTypes={definedChanged:2,staysOnTheGround:0,onTheGroundChanged:2}}constructor(e,t,r,i){super(e,t,r,i,q(t)),this._needsUV=!1,this._materials=[]}async doLoad(){this._fastUpdates=S(this._context.renderer,this._vvConvertOptions),await G()}get _materialColor(){return this.symbolLayer.material?.color}get _emissiveStrength(){if(has("enable-feature:emissive-on-none-volumetrics")){const e=this.symbolLayer.material?.emissive;return("color"===e?.source?e?.strength:void 0)??0}return 0}_createMaterials(){if(this._materials.length>0)return;const t=this._materialColor,r=this._getCombinedOpacityAndColor(t);this._materials[0]=O(this.symbolLayer,{color:r,forceTransparentMode:this.needsDrivenTransparentPass,discardInvisibleFragments:!0,hasVertexColors:this._drivenProperties.color||this._drivenProperties.opacity,draped:this.draped,hasSlicePlane:this._context.slicePlaneEnabled,emissiveStrength:this._emissiveStrength,...this._fastUpdates?.materialParameters}),this._needsUV=this._materials[0]instanceof z;const i=this.symbolLayer.outline;if(N(i)){const t=M(i.pattern);this._materials[1]=new B({width:e(i.size),color:this._getOutlineColor(),polygonOffset:3,polygonOffsetIndex:f(this._renderPriority,this._renderPriorityStep),hasSlicePlane:this._context.slicePlaneEnabled,isClosed:!0,stipplePattern:t,cap:y(i.patternCap||"butt"),screenSizePerspective:this._outlineScreenSizePerspective},this.view.state.isGlobal)}}get _outlineScreenSizePerspective(){return!this.draped&&L(this._context.layer.screenSizePerspectiveEnabled)?this.view.screenSizePerspective.parameters:null}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,F,this.symbolLayer.type))return null;const r=this._getDrivenUInt8Color(e.renderingInfo,this._materialColor,!1),i=this.createElevationContextForGraphic(t);return this.ensureDrapedStatus("on-the-ground"===i.mode),this._createMaterials(),this.draped?this._createAsOverlay(e.renderingInfo,t,r):this._createAs3DShape(e.renderingInfo,t,r,i)}applyRendererDiff(e,t){for(const r in e.diff){if("visualVariables"!==r)return 0;if(!C(this._fastUpdates,t,this._vvConvertOptions))return 0;this._materials[0]?.setParameters(this._fastUpdates.materialParameters)}return 2}layerOpacityChanged(){if(null!=this._materials[0]){const e=this._materials[0].parameters.color,t=this._materialColor,r=this._getCombinedOpacity(t);this._materials[0].setParameters({color:[e[0],e[1],e[2],r],forceTransparentMode:this.needsDrivenTransparentPass})}if(null!=this._materials[1]){const e=this._materials[1].parameters.color;this._materials[1].setParameters({color:[e[0],e[1],e[2],this._getOutlineOpacity()]})}}layerScreenSizePerspectiveChanged(){this._materials[1]?.setParameters({screenSizePerspective:this._outlineScreenSizePerspective})}layerElevationInfoChanged(e,t,r){const i=this._elevationContext.mode,s=u(T.elevationModeChangeTypes,r,i);if(1!==s)return s;const n=h(i);return this.updateGraphics3DGraphicElevationInfo(e,t,()=>n)}slicePlaneEnabledChanged(){if(this._materials[0]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),this._materials[1]){const e={hasSlicePlane:this._context.slicePlaneEnabled};this._materials[1].setParameters(e)}return!0}physicalBasedRenderingChanged(){return!0}_createAs3DShape(e,t,r,i){const s=v(t.geometry);if(!s)return null;const n=A(s,this._context.elevationProvider,this._context.renderCoordsHelper,i,{projectIfNearlyVertical:!0,outlineOutput:"vertex-data"});if(null==n)return null;const o=new W(n,r,this._context.layerViewUid,t.uid),u=o.renderData.vertexCount;if(this._needsUV){o.uvMapSpace=c(4*u,!0),o.textureElementIndices=new Array(u),o.boundingRect=a(o.renderData.polygonIndices.length/3*9);const e=j(o.uvMapSpace,o.boundingRect,o.textureElementIndices,o.renderData.positions,o.renderData.polygonIndices,this._context.renderCoordsHelper);o.boundingRect=l(o.boundingRect,0,9*e),o.boundingRectIndices=p(e)}if(o.olidColor=this._context.stage.renderView?.getObjectAndLayerIdColor(o),this._createAs3DShapeFill(e,o),this._materials[1]&&this._createAs3DShapeOutline(o),this._logGeometryCreationWarnings(o.renderData,s.rings,"rings","FillSymbol3DLayer"),0===o.outGeometries.length)return null;const d=new R({geometries:o.outGeometries,castShadow:!1,layerViewUid:this._context.layerViewUid,graphicUid:t.uid}),_=new m(this,d,null,U,i);return _.alignedSampledElevation=o.renderData.sampledElevation,_.needsElevationUpdates=h(i.mode),_}_createAs3DShapeFill(e,t){const{mapPositions:s,positions:n,polygonIndices:o,polygonIndexCount:a}=t.renderData;if(0===a)return;if(null!=this._context.clippingExtent&&(r(s,H),!i(H,this._context.clippingExtent)))return;const l=this._fastUpdates?.visualVariables.color,c=x({material:this._materials[0],indices:o,mapPositions:s,attributeData:{position:n,color:l?null:t.color,colorFeature:l?P(l,e.color):null,uvMapSpace:this._needsUV?t.uvMapSpace:null,boundingRect:this._needsUV?t.boundingRect:null,textureElementIndices:this._needsUV?t.textureElementIndices:null,boundingRectIndices:this._needsUV?t.boundingRectIndices:null,olidColor:t.olidColor}});t.outGeometries.push(c)}_createAs3DShapeOutline(e){if(null==this._materials[1])return;const{outline:t}=e.renderData;if("vertex-data"!==t.output)return;const{outlines:s}=t;if(null!=s&&0!==s.length)for(const{mapPositions:n,position:o}of s){if(null!=this._context.clippingExtent&&(r(n,H),!i(H,this._context.clippingExtent)))continue;const t=I(this._materials[1],{overlayInfo:null,removeDuplicateStartEnd:!0,mapPositions:n,attributeData:{position:o}},e.olidColor);e.outGeometries.push(t)}}_createAsOverlay(e,t,r){const i=v(t.geometry);if(null==i)return null;this._materials[0].renderPriority=this._renderPriority+this._renderPriorityStep/2,null!=this._materials[1]&&(this._materials[1].renderPriority=this._renderPriority);const n=E(i,{drapedSpatialReference:this._context.overlaySR,outlineOutput:"vertex-data"});if(null==n)return null;const o=new k(n,r,this._context.layerViewUid,t.uid);return this._needsUV&&(o.uvMapSpace=c(4*o.renderData.vertexCount,!0),w(o.uvMapSpace,o.renderData.positions,this._context.overlaySR,this._context.graphicsCoreOwner.view.state.viewingMode)),o.outBoundingBox=s(),o.olidColor=this._context.stage.renderView?.getObjectAndLayerIdColor(o),this._createAsOverlayFill(e,o),this._materials[1]&&this._createAsOverlayOutline(o),this._logGeometryCreationWarnings(o.renderData,i.rings,"rings","FillSymbol3DLayer"),new d(this,o.outGeometries,o.outBoundingBox,this._context.drapeSourceRenderer)}_createAsOverlayFill(e,t){const{positions:s,polygonIndices:o,polygonIndexCount:a}=t.renderData;if(0===a)return;const l=r(s,H);if(!i(l,this._context.clippingExtent))return;n(t.outBoundingBox,l);const c=this._fastUpdates?.visualVariables.color,p=x({material:this._materials[0],indices:o,attributeData:{position:s,color:c?null:t.color,colorFeature:c?P(c,e.color):null,uvMapSpace:this._needsUV?t.uvMapSpace:null,olidColor:t.olidColor}});t.outGeometries.push(new V(p,t))}_createAsOverlayOutline(e){if(null==this._materials[1])return;const{outline:t}=e.renderData;if("vertex-data"!==t.output)return;const{outlines:s}=t;for(const{position:o}of s){if(r(o,H),!i(H,this._context.clippingExtent))continue;n(e.outBoundingBox,H);const t=I(this._materials[1],{overlayInfo:{spatialReference:this._context.overlaySR,renderCoordsHelper:this._context.renderCoordsHelper},removeDuplicateStartEnd:!0,attributeData:{position:o}},e.olidColor);e.outGeometries.push(new V(t,e))}}_getOutlineOpacity(){const e=this.symbolLayer?.outline?.color;return(this.draped?1:this._getLayerOpacity())*(null!=e?e.a:0)}_getOutlineColor(){const e=this.symbolLayer?.outline?.color,t=this._getOutlineOpacity();return g(e?.toUnitRGB(),t)}test(){return{...super.test(),createAsOverlay:(e,t,r)=>this._createAsOverlay(e,t,r),createAs3DShape:(e,t,r,i)=>this._createAs3DShape(e,t,r,i)}}get _vvConvertOptions(){return new D({supports:{size:!1,color:!0,rotation:!1,opacity:!1},fallbackColor:this._materialColor?.toUnitRGBA()??t})}}const H=o();class W extends b{constructor(e,t,r,i){super(e,r,i),this.color=t}}class k extends b{constructor(e,t,r,i){super(e,r,i),this.color=t}}function N(e){return null!=e?.size&&e.size>0&&null!=e.color&&(null==e.pattern||"style"!==e.pattern.type||"none"!==e.pattern.style)}function q(e){return 1===(e.material?.color?.a??0)}export{T as Graphics3DPolygonFillSymbolLayer};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import t from"../../../../geometry/Extent.js";import e from"../../../../geometry/Polygon.js";import{getContinuousIndexArray as i,getZeroIndexArray as o}from"../../../../geometry/support/Indices.js";import{Attribute as a}from"../../webgl-engine/lib/Attribute.js";import{Geometry as r}from"../../webgl-engine/lib/Geometry.js";function n(t){const e=t.attributeData.position.length/3,n=i(e),u=[["position",new a(t.attributeData.position,n,3,!0)]],{boundingRect:s}=t.attributeData,p=null!=s,l=p?[0]:o(e);return null!=t.attributeData.colorFeature?u.push(["colorFeatureAttribute",new a([t.attributeData.colorFeature],l,1,!0)]):t.attributeData.color&&u.push(["color",new a(t.attributeData.color,l,4,!0)]),t.attributeData.uvMapSpace&&u.push(["uvMapSpace",new a(t.attributeData.uvMapSpace,n,4,!0)]),p&&u.push(["boundingRect",new a(s,l,9,!0)]),new r(t.material,u,t.mapPositions,0,t.attributeData.olidColor,void 0,void 0,t.indices)}function u(t,e=null){const o=t.attributeData.position.length/3,n=i(o),u=[["position",new a(t.attributeData.position,n,3,!0)],["uv0",new a(t.attributeData.uv0,n,2,!0)]];return new r(t.material,u,t.mapPositions,0,e,void 0,void 0,t.indices)}function s(i){switch(i.type){case"extent":if(i instanceof t)return e.fromExtent(i);break;case"polygon":return i}return null}class p{constructor(t,e,i){this.renderData=t,this.layerViewUid=e,this.graphicUid=i,this.outGeometries=new Array}}export{p as PolygonCreationDataBase,n as createColorGeometry,u as createWaterGeometry,s as geometryAsPolygon};
2
+ import t from"../../../../geometry/Extent.js";import e from"../../../../geometry/Polygon.js";import{getContinuousIndexArray as i,getZeroIndexArray as o}from"../../../../geometry/support/Indices.js";import{Attribute as n}from"../../webgl-engine/lib/Attribute.js";import{Geometry as r}from"../../webgl-engine/lib/Geometry.js";function a(t){const e=t.attributeData.position.length/3,a=i(e),u=[["position",new n(t.attributeData.position,a,3,!0)]],{boundingRect:s,textureElementIndices:l,boundingRectIndices:c}=t.attributeData,p=null!=s,b=o(p?c?.length??1:e);return null!=t.attributeData.colorFeature?u.push(["colorFeatureAttribute",new n([t.attributeData.colorFeature],b,1,!0)]):t.attributeData.color&&u.push(["color",new n(t.attributeData.color,b,4,!0)]),t.attributeData.uvMapSpace&&u.push(["uvMapSpace",new n(t.attributeData.uvMapSpace,a,4,!0)]),p&&(u.push(["boundingRect",new n(s,c??[0],9,!0)]),null!=l&&u.push(["textureElementIndex",new n(l,a,1,!0)])),new r(t.material,u,t.mapPositions,0,t.attributeData.olidColor,void 0,void 0,t.indices)}function u(t,e=null){const o=t.attributeData.position.length/3,a=i(o),u=[["position",new n(t.attributeData.position,a,3,!0)],["uv0",new n(t.attributeData.uv0,a,2,!0)]];return new r(t.material,u,t.mapPositions,0,e,void 0,void 0,t.indices)}function s(i){switch(i.type){case"extent":if(i instanceof t)return e.fromExtent(i);break;case"polygon":return i}return null}class l{constructor(t,e,i){this.renderData=t,this.layerViewUid=e,this.graphicUid=i,this.outGeometries=new Array}}export{l as PolygonCreationDataBase,a as createColorGeometry,u as createWaterGeometry,s as geometryAsPolygon};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
+ import{roundDownToNearest as t}from"../../../../core/mathUtils.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as i}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as o}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{set as n,dot as e,subtract as a,scale as r,add as _,copy as h,scaleAndAdd as u,normalize as m,cross as l}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as f}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{newDoubleArray as c}from"../../../../geometry/support/DoubleArray.js";import{create as B,fromArray as p,getNormal as d}from"../../../../geometry/support/plane.js";class V{constructor(){this._mean=f(),this._plane=B(),this._u=f(),this._v=f(),this._w=f(),this._minBound=o(),this._maxBound=o(),this._bound1=f(),this._bound2=f(),this._bound3=f(),this._mapBasis=s(),this._east=f(),this._north=f(),this._up=f(),this._flatPositionBuffer=null}_initializeUVBasis(){n(this._u,1,0,0),n(this._v,0,1,0),n(this._w,0,0,1)}_resetUVBounds(){i(this._minBound,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),i(this._maxBound,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY)}_forEachVertexOffset(t,s,i){if(null!=t)for(const o of t)i(3*o);else for(let o=0;o<3*s;o+=3)i(o)}_updateUVBounds(t,s=null){const i=this._getVertexCount(t,s);this._forEachVertexOffset(s,i,s=>this._updateUVBoundsForPoint(t,s))}_updateUVBoundsForPoint(t,s){n(I,t[s],t[s+1],t[s+2]);const i=e(this._u,I),o=e(this._v,I);this._minBound[0]=Math.min(this._minBound[0],i),this._minBound[1]=Math.min(this._minBound[1],o),this._maxBound[0]=Math.max(this._maxBound[0],i),this._maxBound[1]=Math.max(this._maxBound[1],o)}prepareUVFrame(t,s,o,e=null){if(null!=e&&0===e.length)return this._initializeUVBasis(),n(this._mean,0,0,0),i(this._minBound,0,0),i(this._maxBound,0,0),[0,0];this._initializeUVBasis(),this._computeMeanVertexPosition(t,e);const a=null==e?t:this._toFlatPositionBuffer(t,e);return p(this._plane,a)&&this._calculatePlanarUVcoordinateSystem(s),this._resetUVBounds(),this._updateUVBounds(t,e),b(this._minBound[0],this._minBound[1],o)}_toFlatPositionBuffer(t,s){const i=3*s.length;null!=this._flatPositionBuffer&&this._flatPositionBuffer.length===i||(this._flatPositionBuffer=c(i));const{_flatPositionBuffer:o}=this;let n=0;for(const e of s){const s=3*e;o[n++]=t[s],o[n++]=t[s+1],o[n++]=t[s+2]}return o}_writeMapSpaceUVForPoint(t,s,i,o,a,r,_,h){n(I,i,o,a),t[s]=(e(this._u,I)-r)/h,t[s+1]=(e(this._v,I)-_)/h,t[s+2]=r/h,t[s+3]=_/h}writeMapSpaceUVs(t,s,i,o,n,e=null){const a=this._getVertexCount(s,e);this._forEachVertexOffset(e,a,e=>{const a=e/3*4;this._writeMapSpaceUVForPoint(t,a,s[e],s[e+1],s[e+2],i,o,n)})}writeBoundingRect(t,s){const{_bound1:i,_bound2:o,_bound3:n,_maxBound:h,_minBound:u,_u:m,_v:l,_w:f,_mean:c}=this,B=e(f,c);x(i,u[0],u[1],B,m,l,f),x(o,h[0],u[1],B,m,l,f),x(n,u[0],h[1],B,m,l,f),a(o,o,i),r(o,o,.5),a(n,n,i),r(n,n,.5),_(i,i,o),_(i,i,n);for(let e=0;e<3;++e)t[s+e]=i[e],t[s+e+3]=o[e],t[s+e+6]=n[e]}_calculatePlanarUVcoordinateSystem(t){const s=this._u,i=this._v,o=this._w,a=this._east,_=this._north,f=this._up;null!=t?(t.basisMatrixAtPosition(this._mean,this._mapBasis),n(a,this._mapBasis[0],this._mapBasis[1],this._mapBasis[2]),n(_,this._mapBasis[4],this._mapBasis[5],this._mapBasis[6]),n(f,this._mapBasis[8],this._mapBasis[9],this._mapBasis[10])):(n(a,1,0,0),n(_,0,1,0),n(f,0,0,1));const c=d(this._plane);h(P,c),e(P,f)<0&&r(P,P,-1),h(o,P);const B=e(P,_),p=e(P,a);Math.abs(B)>Math.abs(p)?(u(s,a,P,-p),m(s,s),l(i,s,P),m(i,i),r(i,i,-1)):(u(i,_,P,-B),m(i,i),l(s,i,P),m(s,s))}_computeMeanVertexPosition(t,s=null){const i=this._getVertexCount(t,s);if(0===i)return void n(this._mean,0,0,0);const o=g;n(o,0,0,0),this._forEachVertexOffset(s,i,s=>{o[0]+=t[s],o[1]+=t[s+1],o[2]+=t[s+2]}),r(this._mean,o,1/i)}_getVertexCount(t,s){return null==s?t.length/3:s.length}}function x(t,s,i,o,e,a,r){n(t,s*e[0]+i*a[0]+o*r[0],s*e[1]+i*a[1]+o*r[1],s*e[2]+i*a[2]+o*r[2])}function b(s,i,o){return[t(s,o),t(i,o)]}const I=f(),P=f(),g=f();export{V as UVWorkspace,b as computeUVCellStart};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{fromValues as t}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{perVertexElevationAligner as e}from"../graphics/ElevationAligners.js";import{createMapSpaceUVCoords as r}from"./uvUtils.js";import{ColorMaterial as a}from"../../webgl-engine/materials/ColorMaterial.js";import{PatternMaterial as n}from"../../webgl-engine/materials/PatternMaterial.js";function o(e,r){r.useIndexing=!0;const o=e?.pattern;return null==o||"solid"===o.style?new a(r):"none"===o.style?(r.color=t(0,0,0,0),r.forceTransparentMode=!0,new a(r)):(r.style=i(o.style),new n(r))}function i(t){switch(t){case"horizontal":return 0;case"vertical":return 1;case"cross":return 2;case"forward-diagonal":return 3;case"backward-diagonal":return 4;case"diagonal-cross":return 5;default:return}}function s(t){return t.material instanceof n&&!t.material.parameters.draped}function c(t,e){if(s(t)){const a=t.attributes.get("position").data,n=t.getMutableAttribute("uvMapSpace").data,o=t.getMutableAttribute("boundingRect").data;r(n,o,a,e)}}function l(t,r,a,n,o){const i=e(t,r,a,n,o),s=t.stageObject.geometries;for(const e of s)c(e,o);return i}export{o as createMaterial,i as parsePatternStyle,s as requiresUVUpdates,c as updateMapSpaceUVCoords,l as uvElevationAligner};
2
+ import{fromValues as t}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{perVertexElevationAligner as e}from"../graphics/ElevationAligners.js";import{writeMapSpaceUVCoordsPerConnectedPart as r,writeMapSpaceUVCoords as a}from"./uvUtils.js";import{ColorMaterial as n}from"../../webgl-engine/materials/ColorMaterial.js";import{PatternMaterial as i}from"../../webgl-engine/materials/PatternMaterial.js";function o(e,r){r.useIndexing=!0;const a=e?.pattern;return null==a||"solid"===a.style?new n(r):"none"===a.style?(r.color=t(0,0,0,0),r.forceTransparentMode=!0,new n(r)):(r.style=s(a.style),new i(r))}function s(t){switch(t){case"horizontal":return 0;case"vertical":return 1;case"cross":return 2;case"forward-diagonal":return 3;case"backward-diagonal":return 4;case"diagonal-cross":return 5;default:return}}function l(t){return t.material instanceof i&&!t.material.parameters.draped}function c(t,e){if(l(t)){const n=t.attributes.get("position").data,i=t.getMutableAttribute("uvMapSpace").data,o=t.getMutableAttribute("boundingRect"),s=t.getMutableAttribute("textureElementIndex");if(null!=s&&null!=t.drawIndices)return void r(i,o.data,s.data,n,t.drawIndices,e);a(i,o.data,n,e)}}function u(t,r,a,n,i){const o=e(t,r,a,n,i),s=t.stageObject.geometries;for(const e of s)c(e,i);return o}export{o as createMaterial,s as parsePatternStyle,l as requiresUVUpdates,c as updateMapSpaceUVCoords,u as uvElevationAligner};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{create as t}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as o}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{set as e,dot as s,subtract as i,scale as m,add as n,copy as a,scaleAndAdd as c,normalize as l,cross as f}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as I}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as N}from"../../../../geometry/ellipsoidUtils.js";import{lonLatToWebMercatorComparable as h}from"../../../../geometry/projection/projectors.js";import{newDoubleArray as p}from"../../../../geometry/support/DoubleArray.js";import{fromArray as g,getNormal as b,create as u}from"../../../../geometry/support/plane.js";function T(t,r,e,s,i=1){if(e.isGeographic&&1===s){const t=p(r.length),o=r.length,s=N(e);for(let e=0;e<o;e+=3)h(r,e,t,e,s);r=t}o(_,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY);for(let o=0;o<r.length;o+=3)_[0]=Math.min(_[0],r[o]),_[1]=Math.min(_[1],r[o+1]);const m=_[0]%i,n=_[1]%i,a=_[0]-m,c=_[1]-n;for(let o=0;o<r.length;o+=3){const e=o/3*4;t[e]=(r[o]-a)/i,t[e+1]=(r[o+1]-c)/i,t[e+2]=a/i,t[e+3]=c/i}}function j(t,r,a,c,l=1){e(F,1,0,0),e(V,0,1,0),e(Y,0,0,1),U(x,a),g(E,a)&&O(E,F,V,Y,c,x),o(_,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),o(y,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY);for(let o=0;o<a.length;o+=3){e(M,a[o],a[o+1],a[o+2]);const t=s(F,M),r=s(V,M);_[0]=Math.min(_[0],t),_[1]=Math.min(_[1],r),y[0]=Math.max(y[0],t),y[1]=Math.max(y[1],r)}const f=s(Y,x);q(P,_[0],_[1],f,F,V,Y),q(v,y[0],_[1],f,F,V,Y),q(A,_[0],y[1],f,F,V,Y),i(v,v,P),m(v,v,.5),i(A,A,P),m(A,A,.5),n(P,P,v),n(P,P,A);const I=_[0]%l,N=_[1]%l,h=_[0]-I,p=_[1]-N;for(let o=0;o<a.length;o+=3){e(M,a[o],a[o+1],a[o+2]);const r=4*(o/3);t[r]=(s(F,M)-h)/l,t[r+1]=(s(V,M)-p)/l,t[r+2]=h/l,t[r+3]=p/l}for(let o=0;o<3;o++)r[o]=P[o],r[o+3]=v[o],r[o+6]=A[o]}const x=I(),M=I(),E=u(),F=I(),V=I(),Y=I(),_=r(),y=r(),P=I(),v=I(),A=I();function O(t,o,r,i,n,I){null!=n?(n.basisMatrixAtPosition(I,S),e(G,S[0],S[1],S[2]),e(d,S[4],S[5],S[6]),e(D,S[8],S[9],S[10])):(e(G,1,0,0),e(d,0,1,0),e(D,0,0,1));const N=b(t);s(N,D)<0&&m(N,N,-1),a(i,N);const h=s(N,d),p=s(N,G);Math.abs(h)>Math.abs(p)?(c(o,G,N,-p),l(o,o),f(r,o,N),l(r,r),m(r,r,-1)):(c(r,d,N,-h),l(r,r),f(o,r,N),l(o,o))}const S=t(),G=I(),d=I(),D=I();function U(t,o){e(k,0,0,0);for(let r=0;r<o.length-3;r+=3)k[0]+=o[r],k[1]+=o[r+1],k[2]+=o[r+2];m(t,k,1/(o.length/3-1))}const k=I();function q(t,o,r,s,i,m,n){e(t,o*i[0]+r*m[0]+s*n[0],o*i[1]+r*m[1]+s*n[1],o*i[2]+r*m[2]+s*n[2])}export{j as createMapSpaceUVCoords,T as createMapSpaceUVCoordsDraped};
2
+ import{getReferenceEllipsoid as t}from"../../../../geometry/ellipsoidUtils.js";import{lonLatToWebMercatorComparable as r}from"../../../../geometry/projection/projectors.js";import{newDoubleArray as e}from"../../../../geometry/support/DoubleArray.js";import{computeUVCellStart as o,UVWorkspace as n}from"./UVWorkspace.js";import{computeVertexConnectedTriangleComponents as i}from"../../support/meshProcessing.js";function s(n,i,s,p,c=1){if(0===i.length)return;if(s.isGeographic&&1===p){const o=e(i.length),n=i.length,p=t(s);for(let t=0;t<n;t+=3)r(i,t,o,t,p);i=o}let f=Number.POSITIVE_INFINITY,l=Number.POSITIVE_INFINITY;for(let t=0;t<i.length;t+=3)f=Math.min(f,i[t]),l=Math.min(l,i[t+1]);const[m,u]=o(f,l,c);for(let t=0;t<i.length;t+=3){const r=t/3*4;n[r]=(i[t]-m)/c,n[r+1]=(i[t+1]-u)/c,n[r+2]=m/c,n[r+3]=u/c}}function p(t,r,e,o,n=1){if(0===e.length)return;const i=m,[s,p]=i.prepareUVFrame(e,o,n);i.writeMapSpaceUVs(t,e,s,p,n),i.writeBoundingRect(r,0)}function c(t,r,e,o,n,s,p=1){const c=o.length/3,u=Math.floor(n.length/3);if(0===c||0===u)return 0;const a=m,[g,h]=i(n,u,c),I=new Array;for(let i=0;i<h;++i)I[i]=[];for(let i=0;i<c;++i)e[i]=-1;for(let i=0;i<u;++i){const t=g[i],r=n[3*i],o=n[3*i+1],s=n[3*i+2];f(e,I[t],r,t),f(e,I[t],o,t),f(e,I[t],s,t)}for(let i=0;i<c;++i)e[i]<0&&(e[i]=0,I[0].push(i));for(let i=0;i<h;++i)l(o,I[i],t,r,i,s,p,a);return h}function f(t,r,e,o){-1===t[e]&&(t[e]=o,r.push(e))}function l(t,r,e,o,n,i,s,p){const[c,f]=p.prepareUVFrame(t,i,s,r);p.writeMapSpaceUVs(e,t,c,f,s,r),p.writeBoundingRect(o,9*n)}const m=new n;export{p as writeMapSpaceUVCoords,s as writeMapSpaceUVCoordsDraped,c as writeMapSpaceUVCoordsPerConnectedPart};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{reallocGrowthFactor as e}from"../../../../core/arrayUtils.js";import{abortMaybe as t}from"../../../../core/maybe.js";import{estimateNumberArrayMemory as s}from"../../../../core/memoryEstimations.js";import{isAbortError as i}from"../../../../core/promiseUtils.js";import{signal as r}from"../../../../core/signal.js";import{Milliseconds as a,now as o}from"../../../../core/time.js";import{exactEquals as n,copy as l,normalize as h}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as u}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as d,exactEquals as _,intersects as c,copy as p}from"../../../../geometry/support/aaBoundingBox.js";import{makeScheduleFunction as f}from"../../layers/support/makeScheduleFunction.js";import{GaussianSplatSortWorkerHandle as m}from"../GaussianSplatWorkerHandle.js";import{GaussianSplatFadeTexture as g}from"./GaussianSplatFadeTexture.js";import{GaussianSplatOrderTexture as T}from"./GaussianSplatOrderTexture.js";import{GaussianSplatTextureAtlas as S}from"./GaussianSplatTextureAtlas.js";import{DepthRange as b}from"../../webgl-engine/lib/DepthRange.js";import{TaskPriority as y}from"../../../support/Scheduler.js";class C{constructor(e,t){this._updating=r(!1),this._useDeterministicSort=!1,this._sortBufferMemory=0,this.visibleGaussians=0,this._visibleTileDepthRange=new b,this._previousVisibleTileDepthRangeEye=u(),this._previousVisibleTileDepthRangeViewForward=u(),this._previousVisibleTileDepthRangeClippingBox=d(),this._latestSortedGaussianTilesVersion=0,this._previousVisibleTileDepthRangeTilesVersion=-1,this._previousVisibleTileDepthRangeHasClippingBox=!1,this._bufferCapacity=0,this._requestedLyr3dVisibilityChange=0,this._latestCompletedLyr3dVisibilityChange=0,this._latestUpdatedGaussianTiles=new Array,this._latestSortedGaussianTiles=new Array,this._nextCommittedVisibleGaussianTiles=new Array,this._cameraDirectionNormalized=u(),this._frameTask=null,this._workerHandle=null,this._sortAbortController=null,this._isSorting=!1,this._pendingSortTask=!1,this._scheduledSortStartTimeout=null,this._lastSortStartTime=a(-1/0),this._sortInterval=a(80),this._renderer=e,this._onSortComplete=t,this._orderTexture=new T(this._renderer.renderingContext),this._fadingTexture=new g(this._renderer.renderingContext),this._textureAtlas=new S(this._renderer.renderingContext,this._renderer.view.resourceController.memoryController,this._renderer.fboCache);const{resourceController:s}=this._renderer.view;this._workerHandle=new m(f(s)),this._frameTask=s.scheduler.registerTask(y.GAUSSIAN_SPLAT_SORTING)}get textureAtlas(){return this._textureAtlas}get orderTexture(){return this._orderTexture}get fadingTexture(){return this._fadingTexture}get textureAtlasMemory(){return this._textureAtlas.usedMemory}get orderTextureMemory(){return this._orderTexture.usedMemory}get fadingTextureMemory(){return this._fadingTexture.usedMemory}get sortBufferMemory(){return this._sortBufferMemory}get usedMemory(){return this.textureAtlasMemory+this.orderTextureMemory+this.fadingTextureMemory+this.sortBufferMemory}queryVisibleTileDepthRange(e,t){if(0===this.visibleGaussians)return null;const{eye:s,viewForward:i}=e,r=s[0],a=s[1],o=s[2],h=i[0],u=i[1],d=i[2],f=this._visibleTileDepthRange;if(this._previousVisibleTileDepthRangeTilesVersion===this._latestSortedGaussianTilesVersion&&n(this._previousVisibleTileDepthRangeEye,s)&&n(this._previousVisibleTileDepthRangeViewForward,i)&&(null==t?!this._previousVisibleTileDepthRangeHasClippingBox:this._previousVisibleTileDepthRangeHasClippingBox&&_(this._previousVisibleTileDepthRangeClippingBox,t)))return f.near<=f.far?f:null;let m=1/0,g=-1/0;const T=this._latestSortedGaussianTiles;for(let n=0;n<T.length;n++){const e=T[n];if(null!=t){const s=e.boundingBox;if(!c(s,t))continue}const s=h*(e.obbCenterX-r)+u*(e.obbCenterY-a)+d*(e.obbCenterZ-o),i=e.paddedMbsRadius,l=s-i;l<m&&(m=l);const _=s+i;_>g&&(g=_)}const S=m<=g;return S?f.set(m,g):f.set(1/0,-1/0),this._previousVisibleTileDepthRangeTilesVersion=this._latestSortedGaussianTilesVersion,this._previousVisibleTileDepthRangeHasClippingBox=null!=t,l(this._previousVisibleTileDepthRangeEye,s),l(this._previousVisibleTileDepthRangeViewForward,i),null!=t&&p(this._previousVisibleTileDepthRangeClippingBox,t),S?f:null}updateGaussianVisibility(e,t){this._latestUpdatedGaussianTiles=e,this._requestedLyr3dVisibilityChange=t,this.requestSort()}get updating(){return this._updating.value}destroy(){this._sortAbortController=t(this._sortAbortController),this._pendingSortTask=!1,this._updating.value=!1,null!=this._scheduledSortStartTimeout&&(clearTimeout(this._scheduledSortStartTimeout),this._scheduledSortStartTimeout=null),this._frameTask.remove(),this._workerHandle?.destroyWorkerAndSelf(),this._textureAtlas.destroy(),this._orderTexture.destroy(),this._fadingTexture.destroy()}requestSort(){return this._updating.value=!0,!this._pendingSortTask&&(this._pendingSortTask=!0,this._scheduleSortStart(),!0)}_scheduleSortStart(){if(this._isSorting)return;const e=o()-this._lastSortStartTime,t=this._sortInterval-e;t<=0?this._startSortIfRequired():null==this._scheduledSortStartTimeout&&(this._scheduledSortStartTimeout=setTimeout(()=>{this._scheduledSortStartTimeout=null,this._pendingSortTask&&!this._isSorting&&this._scheduleSortStart()},t))}_startSortIfRequired(){if(this._isSorting||!this._pendingSortTask)return;const e=new AbortController;this._sortAbortController=e,this._isSorting=!0,this._pendingSortTask=!1,this._lastSortStartTime=o(),this._sortOnWorker(e.signal).finally(()=>{this._sortAbortController===e&&(this._sortAbortController=null),this._handleSortComplete()})}_handleSortComplete(){this._isSorting=!1,this._pendingSortTask?this._scheduleSortStart():this._updating.value=!1}_clearBuffersAndTextures(){this._atlasIndicesBuffer=void 0,this._packedSortedAtlasIndicesBuffer=void 0,this._distancesBuffer=void 0,this._bufferCapacity=0,this._sortBufferMemory=0,this._orderTexture.clear(),this._textureAtlas.clear()}_computeExpandedCapacity(t,s){let i=Math.max(1,t);for(;i<s;)i=Math.ceil(i*e);return i}_ensureSortBufferCapacities(e){if(this._bufferCapacity<e){const t=this._computeExpandedCapacity(this._bufferCapacity,e);this._atlasIndicesBuffer=new Uint32Array(t),this._packedSortedAtlasIndicesBuffer=new Uint8Array(t*T.bytesPerPackedGaussianIndex),this._distancesBuffer=new Float64Array(t),this._bufferCapacity=t,this._sortBufferMemory=s(this._atlasIndicesBuffer,this._packedSortedAtlasIndicesBuffer,this._distancesBuffer)}}_clearAllBuffersAndTextures(){this._clearBuffersAndTextures(),this._latestSortedGaussianTiles.length=0,this._nextCommittedVisibleGaussianTiles.length=0,this._previousVisibleTileDepthRangeTilesVersion=-1,this._workerHandle?.clear()}async _sortOnWorker(e){try{if(0===this._latestUpdatedGaussianTiles.length)return this.visibleGaussians=0,this._clearAllBuffersAndTextures(),this._latestCompletedLyr3dVisibilityChange=this._requestedLyr3dVisibilityChange,this._onSortComplete(this._latestSortedGaussianTiles,this._latestCompletedLyr3dVisibilityChange),void this._renderer.requestRender(1);this._useDeterministicSort&&this._latestUpdatedGaussianTiles.sort((e,t)=>e.obb.centerX-t.obb.centerX||e.obb.centerY-t.obb.centerY||e.obb.centerZ-t.obb.centerZ);const t=this._latestUpdatedGaussianTiles,s=t.length,i=this._requestedLyr3dVisibilityChange;let r=0;for(let e=0;e<s;e++)r+=t[e].gaussianCount;this._ensureSortBufferCapacities(r),this._textureAtlas.ensureTextureAtlas(),h(this._cameraDirectionNormalized,this._renderer.camera.ray.direction);const a=this._cameraDirectionNormalized[0],o=this._cameraDirectionNormalized[1],n=this._cameraDirectionNormalized[2];let l=0;const u=this._atlasIndicesBuffer,d=this._distancesBuffer,_=this._renderer.clippingBox,p=this._nextCommittedVisibleGaussianTiles;p.length=0;let f=0;for(let e=0;e<s;e++){const s=t[e],{gaussianAtlasIndices:i,relativePositions:r,obb:h}=s,m=s.gaussianCount;if(null!=_&&!c(s.boundingBox,_))continue;const{centerX:g,centerY:T,centerZ:S}=h;u.set(i,l),p[f++]=s;const b=a*g+o*T+n*S,y=l+m;for(let e=l,t=0;e<y;e++,t+=3){const s=r[t],i=r[t+1],l=r[t+2];d[e]=s*a+i*o+l*n+b}l=y}if(p.length=f,0===l)return this.visibleGaussians=0,this._clearAllBuffersAndTextures(),this._latestCompletedLyr3dVisibilityChange=i,this._onSortComplete(this._latestSortedGaussianTiles,this._latestCompletedLyr3dVisibilityChange),void this._renderer.requestRender(1);const m={distances:this._distancesBuffer,atlasIndices:this._atlasIndicesBuffer,packedSortedAtlasIndices:this._packedSortedAtlasIndicesBuffer,numGaussians:l,preciseSort:this._useDeterministicSort},g=await(this._workerHandle?.sort(m,e));if(g&&(this._distancesBuffer=g.distances,this._atlasIndicesBuffer=g.atlasIndices,this._packedSortedAtlasIndicesBuffer=g.packedSortedAtlasIndices),e.aborted)return;const T=async e=>{this._orderTexture.setData(this._packedSortedAtlasIndicesBuffer,l);const t=this._latestSortedGaussianTiles;this._latestSortedGaussianTiles=p,this._nextCommittedVisibleGaussianTiles=t,this._latestSortedGaussianTilesVersion++,this._latestCompletedLyr3dVisibilityChange=i,this.visibleGaussians=l,this._onSortComplete(this._latestSortedGaussianTiles,this._latestCompletedLyr3dVisibilityChange),this._renderer.requestRender(1),e.madeProgress()};await this._frameTask.schedule(T,e)}catch(t){if(i(t))return}}set useDeterministicSort(e){this._useDeterministicSort=e}}export{C as GaussianSplatDataStore};
2
+ import{reallocGrowthFactor as e}from"../../../../core/arrayUtils.js";import{abortMaybe as t}from"../../../../core/maybe.js";import{estimateNumberArrayMemory as s}from"../../../../core/memoryEstimations.js";import{isAbortError as i}from"../../../../core/promiseUtils.js";import{signal as r}from"../../../../core/signal.js";import{Milliseconds as a,now as o}from"../../../../core/time.js";import{exactEquals as n,copy as l,normalize as h}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as u}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as d,exactEquals as _,intersects as c,copy as p}from"../../../../geometry/support/aaBoundingBox.js";import{makeScheduleFunction as f}from"../../layers/support/makeScheduleFunction.js";import{GaussianSplatSortWorkerHandle as m}from"../GaussianSplatWorkerHandle.js";import{GaussianSplatFadeTexture as g}from"./GaussianSplatFadeTexture.js";import{GaussianSplatOrderTexture as T}from"./GaussianSplatOrderTexture.js";import{GaussianSplatTextureAtlas as b}from"./GaussianSplatTextureAtlas.js";import{DepthRange as S}from"../../webgl-engine/lib/DepthRange.js";import{TaskPriority as y}from"../../../support/Scheduler.js";class C{constructor(e,t){this._updating=r(!1),this._useDeterministicSort=!1,this._sortBufferMemory=0,this.visibleGaussians=0,this._visibleTileDepthRange=new S,this._previousVisibleTileDepthRangeEye=u(),this._previousVisibleTileDepthRangeViewForward=u(),this._previousVisibleTileDepthRangeClippingBox=d(),this._latestSortedGaussianTilesVersion=0,this._previousVisibleTileDepthRangeTilesVersion=-1,this._previousVisibleTileDepthRangeHasClippingBox=!1,this._bufferCapacity=0,this._requestedLyr3dVisibilityChange=0,this._latestCompletedLyr3dVisibilityChange=0,this._latestUpdatedGaussianTiles=new Array,this._latestSortedGaussianTiles=new Array,this._nextCommittedVisibleGaussianTiles=new Array,this._cameraDirectionNormalized=u(),this._frameTask=null,this._workerHandle=null,this._sortAbortController=null,this._isSorting=!1,this._pendingSortTask=!1,this._scheduledSortStartTimeout=null,this._lastSortStartTime=a(-1/0),this._sortInterval=a(80),this._renderer=e,this._onSortComplete=t,this._orderTexture=new T(this._renderer.renderingContext),this._fadingTexture=new g(this._renderer.renderingContext),this._textureAtlas=new b(this._renderer.renderingContext,this._renderer.view.resourceController.memoryController,this._renderer.fboCache);const{resourceController:s}=this._renderer.view;this._workerHandle=new m(f(s)),this._frameTask=s.scheduler.registerTask(y.GAUSSIAN_SPLAT_SORTING)}get textureAtlas(){return this._textureAtlas}get orderTexture(){return this._orderTexture}get fadingTexture(){return this._fadingTexture}get textureAtlasMemory(){return this._textureAtlas.usedMemory}get orderTextureMemory(){return this._orderTexture.usedMemory}get fadingTextureMemory(){return this._fadingTexture.usedMemory}get sortBufferMemory(){return this._sortBufferMemory}get usedMemory(){return this.textureAtlasMemory+this.orderTextureMemory+this.fadingTextureMemory+this.sortBufferMemory}queryVisibleTileDepthRange(e,t){if(0===this.visibleGaussians)return null;const{eye:s,viewForward:i}=e,r=s[0],a=s[1],o=s[2],h=i[0],u=i[1],d=i[2],f=this._visibleTileDepthRange;if(this._previousVisibleTileDepthRangeTilesVersion===this._latestSortedGaussianTilesVersion&&n(this._previousVisibleTileDepthRangeEye,s)&&n(this._previousVisibleTileDepthRangeViewForward,i)&&(null==t?!this._previousVisibleTileDepthRangeHasClippingBox:this._previousVisibleTileDepthRangeHasClippingBox&&_(this._previousVisibleTileDepthRangeClippingBox,t)))return f.near<=f.far?f:null;let m=1/0,g=-1/0;const T=this._latestSortedGaussianTiles;for(let n=0;n<T.length;n++){const e=T[n];if(null!=t){const s=e.boundingBox;if(!c(s,t))continue}const s=h*(e.obbCenterX-r)+u*(e.obbCenterY-a)+d*(e.obbCenterZ-o),i=e.paddedMbsRadius,l=s-i;l<m&&(m=l);const _=s+i;_>g&&(g=_)}const b=m<=g;return b?f.set(m,g):f.set(1/0,-1/0),this._previousVisibleTileDepthRangeTilesVersion=this._latestSortedGaussianTilesVersion,this._previousVisibleTileDepthRangeHasClippingBox=null!=t,l(this._previousVisibleTileDepthRangeEye,s),l(this._previousVisibleTileDepthRangeViewForward,i),null!=t&&p(this._previousVisibleTileDepthRangeClippingBox,t),b?f:null}updateGaussianVisibility(e,t){this._latestUpdatedGaussianTiles=e,this._requestedLyr3dVisibilityChange=t,this.requestSort()}get updating(){return this._updating.value}destroy(){this._sortAbortController=t(this._sortAbortController),this._pendingSortTask=!1,this._updating.value=!1,null!=this._scheduledSortStartTimeout&&(clearTimeout(this._scheduledSortStartTimeout),this._scheduledSortStartTimeout=null),this._frameTask.remove(),this._workerHandle?.destroyWorkerAndSelf(),this._textureAtlas.destroy(),this._orderTexture.destroy(),this._fadingTexture.destroy()}requestSort(){return this._updating.value=!0,!this._pendingSortTask&&(this._pendingSortTask=!0,this._scheduleSortStart(),!0)}_scheduleSortStart(){if(this._isSorting)return;const e=o()-this._lastSortStartTime,t=this._sortInterval-e;t<=0?this._startSortIfRequired():null==this._scheduledSortStartTimeout&&(this._scheduledSortStartTimeout=setTimeout(()=>{this._scheduledSortStartTimeout=null,this._pendingSortTask&&!this._isSorting&&this._scheduleSortStart()},t))}_startSortIfRequired(){if(this._isSorting||!this._pendingSortTask)return;const e=new AbortController;this._sortAbortController=e,this._isSorting=!0,this._pendingSortTask=!1,this._lastSortStartTime=o(),this._sortOnWorker(e.signal).finally(()=>{this._sortAbortController===e&&(this._sortAbortController=null),this._handleSortComplete()})}_handleSortComplete(){this._isSorting=!1,this._pendingSortTask?this._scheduleSortStart():this._updating.value=!1}_clearBuffersAndTextures(){this._atlasIndicesBuffer=void 0,this._packedSortedAtlasIndicesBuffer=void 0,this._distancesBuffer=void 0,this._bufferCapacity=0,this._sortBufferMemory=0,this._orderTexture.clear(),this._textureAtlas.clear()}_computeExpandedCapacity(t,s){let i=Math.max(1,t);for(;i<s;)i=Math.ceil(i*e);return i}_ensureSortBufferCapacities(e){if(this._bufferCapacity<e){const t=this._computeExpandedCapacity(this._bufferCapacity,e);this._atlasIndicesBuffer=new Uint32Array(t),this._packedSortedAtlasIndicesBuffer=new Uint8Array(t*T.bytesPerPackedGaussianIndex),this._distancesBuffer=new Float64Array(t),this._bufferCapacity=t,this._sortBufferMemory=s(this._atlasIndicesBuffer,this._packedSortedAtlasIndicesBuffer,this._distancesBuffer)}}_clearAllBuffersAndTextures(){this._clearBuffersAndTextures(),this._latestSortedGaussianTiles.length=0,this._nextCommittedVisibleGaussianTiles.length=0,this._previousVisibleTileDepthRangeTilesVersion=-1,this._workerHandle?.clear()}async _sortOnWorker(e){try{if(0===this._latestUpdatedGaussianTiles.length)return this.visibleGaussians=0,this._clearAllBuffersAndTextures(),this._latestCompletedLyr3dVisibilityChange=this._requestedLyr3dVisibilityChange,this._onSortComplete(this._latestSortedGaussianTiles,this._latestCompletedLyr3dVisibilityChange),void this._renderer.requestRender(1);this._useDeterministicSort&&this._latestUpdatedGaussianTiles.sort((e,t)=>e.obb.centerX-t.obb.centerX||e.obb.centerY-t.obb.centerY||e.obb.centerZ-t.obb.centerZ);const t=this._latestUpdatedGaussianTiles,s=t.length,i=this._requestedLyr3dVisibilityChange;let r=0;for(let e=0;e<s;e++)r+=t[e].gaussianCount;this._ensureSortBufferCapacities(r),this._textureAtlas.ensureTextureAtlas();const a=this._renderer.camera;h(this._cameraDirectionNormalized,a.ray.direction);const o=this._cameraDirectionNormalized[0],n=this._cameraDirectionNormalized[1],l=this._cameraDirectionNormalized[2];let u=0;const d=this._atlasIndicesBuffer,_=this._distancesBuffer,p=this._renderer.clippingBox,f=this._nextCommittedVisibleGaussianTiles;f.length=0;let m=0;const{frustum:g}=a,T=this._renderer.tileCullingRevision,b=g[0],S=g[1],y=g[2],C=g[3],x=g[4],V=g[5];for(let e=0;e<s;e++){const s=t[e],{gaussianAtlasIndices:i,relativePositions:r,obbCenterX:a,obbCenterY:h,obbCenterZ:g,paddedMbsRadius:v}=s,A=s.gaussianCount;if(s.cullingRevision!==T){let e=null==p||c(s.boundingBox,p);if(e){const t=1.5*v;e=b[0]*a+b[1]*h+b[2]*g+b[3]<t&&S[0]*a+S[1]*h+S[2]*g+S[3]<t&&y[0]*a+y[1]*h+y[2]*g+y[3]<t&&C[0]*a+C[1]*h+C[2]*g+C[3]<t&&x[0]*a+x[1]*h+x[2]*g+x[3]<t&&V[0]*a+V[1]*h+V[2]*g+V[3]<t}s.cullingRevision=T,s.cullingVisible=e}if(!s.cullingVisible)continue;d.set(i,u),f[m++]=s;const B=o*a+n*h+l*g,G=u+A;for(let e=u,t=0;e<G;e++,t+=3){const s=r[t],i=r[t+1],a=r[t+2];_[e]=s*o+i*n+a*l+B}u=G}if(f.length=m,0===u)return this.visibleGaussians=0,this._clearAllBuffersAndTextures(),this._latestCompletedLyr3dVisibilityChange=i,this._onSortComplete(this._latestSortedGaussianTiles,this._latestCompletedLyr3dVisibilityChange),void this._renderer.requestRender(1);const v={distances:this._distancesBuffer,atlasIndices:this._atlasIndicesBuffer,packedSortedAtlasIndices:this._packedSortedAtlasIndicesBuffer,numGaussians:u,preciseSort:this._useDeterministicSort},A=await(this._workerHandle?.sort(v,e));if(A&&(this._distancesBuffer=A.distances,this._atlasIndicesBuffer=A.atlasIndices,this._packedSortedAtlasIndicesBuffer=A.packedSortedAtlasIndices),e.aborted)return;const B=async e=>{this._orderTexture.setData(this._packedSortedAtlasIndicesBuffer,u);const t=this._latestSortedGaussianTiles;this._latestSortedGaussianTiles=f,this._nextCommittedVisibleGaussianTiles=t,this._latestSortedGaussianTilesVersion++,this._latestCompletedLyr3dVisibilityChange=i,this.visibleGaussians=u,this._onSortComplete(this._latestSortedGaussianTiles,this._latestCompletedLyr3dVisibilityChange),this._renderer.requestRender(1),e.madeProgress()};await this._frameTask.schedule(B,e)}catch(t){if(i(t))return}}set useDeterministicSort(e){this._useDeterministicSort=e}}export{C as GaussianSplatDataStore};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{subtract as t,length as i,scale as e,negate as s,dot as n,transformQuatValues as o,set as r}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as l,fromValues as a}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{set as c}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{project as u}from"../../../../geometry/projectionUtils.js";import{intersects as d,contains as p}from"../../../../geometry/support/aaBoundingBox.js";import{fromExtent as f}from"../../../../geometry/support/aaBoundingRect.js";import{create as h}from"../../../../geometry/support/plane.js";import{fromPoints as m}from"../../../../geometry/support/ray.js";import{GaussianSplatTarget as g}from"../../layers/i3s/Intersector.js";import{createTileBVH as y}from"../../layers/support/Tiles3DBVH.js";import{ElevationRange as b}from"../ElevationRange.js";import{IntersectorResult as w}from"../../webgl-engine/lib/IntersectorResult.js";class v{constructor(t){this.layerView=t,this.type=0,this.slicePlaneEnabled=!1,this.isGround=!1,this._ellipsoidLocalRayOrigin=l(),this._ellipsoidLocalRayDir=l(),this.intersectionNormal=l(),this.intersectionRayDir=l(),this.intersectionPlane=h(),this.layerViewUid=t.uid;const i=t.view.viewingMode,e=(t.useEsriCrs?t.fullExtentInLocalViewSpatialReference:t.layer.fullExtent?u(t.layer.fullExtent,t.view.renderSpatialReference):void 0)??t.view.extent,s=f(e);this._bvh=y(i,s)}destroy(){this._bvh.destroy()}addTile(t){this._bvh.addTile(t)}removeTile(t){this._bvh.removeTile(t)}intersect(o,l,u,f,h,y){const{intersectionRayDir:b,intersectionPlane:v,layerViewUid:_,intersectionNormal:j}=this,E=m(u,f);t(b,f,u);const M=1/i(b);e(b,b,M),s(j,b),c(v,b[0],b[1],b[2],-n(b,u));const S=new x,V=new x,k=o.options.store,T=0===k,q=2===k,B=1===k||q,D=q?new Array:null,P=(t,i,e,s,n)=>(t.point=t.point?r(t.point,e,s,n):a(e,s,n),t.dist=i,t.normal=j,t.layerViewUid=_,t),U=u[0],I=u[1],L=u[2],G=b[0],C=b[1],A=b[2],N=this.layerView.clippingBox,O=t=>{const{relativePositions:i,packedRotations:e,packedScales:s,gaussianCount:n,obb:o,maxSplatMbsRadiusSquared:r}=t,a=o.centerX,c=o.centerY,d=o.centerZ;let p=-1;const h=N[0],m=N[1],g=N[2],y=N[3],b=N[4],w=N[5];for(let v=0,R=0;v<n;v++,R+=3){const t=i[R]+a,n=i[R+1]+c,o=i[R+2]+d;if(t<h||n<m||o<g||t>y||n>b||o>w)continue;const _=t-U,j=n-I,E=o-L,k=_*G+j*C+E*A;if(k<0&&k*k>r)continue;const N=k<0?0:k;if(_*_+j*j+E*E-N*N>r)continue;if(T&&null!=S.dist){p<0&&(p=Math.sqrt(r));if(Math.max(k-p,0)*M>=S.dist)continue}const O=this._intersectGaussianEllipsoid(_,j,E,G,C,A,e[v],s[v]);if(O<0)continue;const X=O*M;if(null!=l&&!l(u,f,X))continue;const Y=null==S.dist||X<S.dist,Z=B&&(null==V.dist||X>V.dist);if(!Y&&!Z&&!q)continue;const F=U+G*O,H=I+C*O,Q=L+A*O;if(Y&&P(S,X,F,H,Q),Z&&P(V,X,F,H,Q),q){const t=new x;D.push(P(t,X,F,H,Q))}}},X=t=>{const{relativePositions:i,packedRotations:e,packedScales:s,gaussianCount:n,obb:o,maxSplatMbsRadiusSquared:r}=t,a=o.centerX,c=o.centerY,d=o.centerZ;let p=-1;const h=U-a,m=I-c,g=L-d;for(let y=0,b=0;y<n;y++,b+=3){const t=i[b]-h,n=i[b+1]-m,o=i[b+2]-g,a=t*G+n*C+o*A;if(a<0&&a*a>r)continue;const c=a<0?0:a;if(t*t+n*n+o*o-c*c>r)continue;if(T&&null!=S.dist){p<0&&(p=Math.sqrt(r));if(Math.max(a-p,0)*M>=S.dist)continue}const d=this._intersectGaussianEllipsoid(t,n,o,G,C,A,e[y],s[y]);if(d<0)continue;const w=d*M;if(null!=l&&!l(u,f,w))continue;const v=null==S.dist||w<S.dist,R=B&&(null==V.dist||w>V.dist);if(!v&&!R&&!q)continue;const _=U+G*d,j=I+C*d,E=L+A*d;if(v&&P(S,w,_,j,E),R&&P(V,w,_,j,E),q){const t=new x;D.push(P(t,w,_,j,E))}}},Y=(t,i)=>{const{min:e,max:s}=t.obb.signedDistanceRangePlane(v);if(s<0)return;const n=e*M;if(!(T&&null!=S.dist&&S.dist<n)){if(null!=S.dist&&null!=V.dist){const t=s*M;if(S.dist<n&&V.dist>t)return}i?O(t):X(t)}},Z=t=>{Y(t,!1)},F=t=>{const i=t.boundingBox;d(i,N)&&Y(t,!p(N,i))};this._bvh.forEachTileIntersectingRay(u,f,null!=N?F:Z,y);const H=(t,i)=>{const{layerViewUid:e}=i,s=new g(i.point,e);t.set(0,s,i.dist,i.normal)};if(R(S)){const t=o.results.min;(null==t.distance||S.dist<t.distance)&&H(t,S)}if(R(V)&&B){const t=o.results.max;(null==t.distance||V.dist>t.distance)&&H(t,V)}if(q&&D?.length)for(const t of D){const i=new w(E);H(i,t),o.results.all.push(i)}}_intersectGaussianEllipsoid(t,i,e,s,n,r,l,a){const c=l>>>30,u=1023&l,d=l>>>10&1023,p=l>>>20&1023,f=(u&_)*j*(1-2*(u>>>9&1)),h=(d&_)*j*(1-2*(d>>>9&1)),m=(p&_)*j*(1-2*(p>>>9&1));let g,y,b,w;const v=f*f+h*h+m*m,R=Math.sqrt(Math.max(0,1-v));switch(c){case 0:g=R,y=m,b=h,w=f;break;case 1:g=m,y=R,b=h,w=f;break;case 2:g=m,y=h,b=R,w=f;break;default:g=m,y=h,b=f,w=R}const x=this._ellipsoidLocalRayOrigin;x[0]=-t,x[1]=-i,x[2]=-e,o(x,x,-g,-y,-b,w);const M=this._ellipsoidLocalRayDir;M[0]=s,M[1]=n,M[2]=r,o(M,M,-g,-y,-b,w);const V=S[255&a],k=S[a>>>8&255],T=S[a>>>16],q=x[0]*V,B=x[1]*k,D=x[2]*T,P=q*q+B*B+D*D;if(P<=1)return 0;const U=M[0]*V,I=M[1]*k,L=M[2]*T,G=U*U+I*I+L*L,C=q*U+B*I+D*L;if(C>0)return E;const A=C*C-G*(P-1);return A<0?E:(-C-Math.sqrt(A))/G}getElevationRange(t){return this._bvh.getElevationRangeIntersectingSphere(t)??new b(0,0)}}function R(t){return null!=t.dist&&null!=t.point}class x{constructor(){this.point=null,this.dist=null,this.normal=null,this.layerViewUid=""}}const _=511,j=Math.SQRT1_2/_,E=-1,M=3,S=(()=>{const t=new Float64Array(256);for(let i=0;i<t.length;i++)t[i]=Math.exp(10-i/16)/M;return t})();export{v as GaussianSplatIntersectionHandler};
2
+ import{subtract as t,length as i,scale as e,negate as s,dot as n,transformQuatValues as o,set as r}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as l,fromValues as a}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{set as c}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{project as u}from"../../../../geometry/projectionUtils.js";import{intersects as d,contains as p}from"../../../../geometry/support/aaBoundingBox.js";import{fromExtent as f}from"../../../../geometry/support/aaBoundingRect.js";import{create as h}from"../../../../geometry/support/plane.js";import{fromPoints as m}from"../../../../geometry/support/ray.js";import{GaussianSplatTarget as y}from"../../layers/i3s/Intersector.js";import{createTileBVH as g}from"../../layers/support/Tiles3DBVH.js";import{ElevationRange as b}from"../ElevationRange.js";import{IntersectorResult as w}from"../../webgl-engine/lib/IntersectorResult.js";class v{constructor(t){this.layerView=t,this.type=0,this.slicePlaneEnabled=!1,this.isGround=!1,this._ellipsoidLocalRayOrigin=l(),this._ellipsoidLocalRayDir=l(),this.intersectionNormal=l(),this.intersectionRayDir=l(),this.intersectionPlane=h(),this.layerViewUid=t.uid;const i=t.view.viewingMode,e=(t.useEsriCrs?t.fullExtentInLocalViewSpatialReference:t.layer.fullExtent?u(t.layer.fullExtent,t.view.renderSpatialReference):void 0)??t.view.extent,s=f(e);this._bvh=g(i,s)}destroy(){this._bvh.destroy()}addTile(t){this._bvh.addTile(t)}removeTile(t){this._bvh.removeTile(t)}intersect(o,l,u,f,h,g){const{intersectionRayDir:b,intersectionPlane:v,layerViewUid:_,intersectionNormal:j}=this,E=m(u,f);t(b,f,u);const M=1/i(b);e(b,b,M),s(j,b),c(v,b[0],b[1],b[2],-n(b,u));const S=new x,V=new x,k=o.options.store,T=0===k,q=2===k,B=1===k||q,D=q?new Array:null,P=(t,i,e,s,n)=>(t.point=t.point?r(t.point,e,s,n):a(e,s,n),t.dist=i,t.normal=j,t.layerViewUid=_,t),U=u[0],I=u[1],L=u[2],G=b[0],O=b[1],C=b[2],A=this.layerView.clippingBox,N=t=>{const{relativePositions:i,packedRotations:e,packedOpacityScaledScales:s,gaussianCount:n,obb:o,maxSplatMbsRadiusSquared:r}=t,a=o.centerX,c=o.centerY,d=o.centerZ;let p=-1;const h=A[0],m=A[1],y=A[2],g=A[3],b=A[4],w=A[5];for(let v=0,R=0;v<n;v++,R+=3){const t=i[R]+a,n=i[R+1]+c,o=i[R+2]+d;if(t<h||n<m||o<y||t>g||n>b||o>w)continue;const _=t-U,j=n-I,E=o-L,k=_*G+j*O+E*C;if(k<0&&k*k>r)continue;const A=k<0?0:k;if(_*_+j*j+E*E-A*A>r)continue;if(T&&null!=S.dist){p<0&&(p=Math.sqrt(r));if(Math.max(k-p,0)*M>=S.dist)continue}const N=this._intersectGaussianEllipsoid(_,j,E,G,O,C,e[v],s[v]);if(N<0)continue;const X=N*M;if(null!=l&&!l(u,f,X))continue;const Y=null==S.dist||X<S.dist,Z=B&&(null==V.dist||X>V.dist);if(!Y&&!Z&&!q)continue;const F=U+G*N,H=I+O*N,Q=L+C*N;if(Y&&P(S,X,F,H,Q),Z&&P(V,X,F,H,Q),q){const t=new x;D.push(P(t,X,F,H,Q))}}},X=t=>{const{relativePositions:i,packedRotations:e,packedOpacityScaledScales:s,gaussianCount:n,obb:o,maxSplatMbsRadiusSquared:r}=t,a=o.centerX,c=o.centerY,d=o.centerZ;let p=-1;const h=U-a,m=I-c,y=L-d;for(let g=0,b=0;g<n;g++,b+=3){const t=i[b]-h,n=i[b+1]-m,o=i[b+2]-y,a=t*G+n*O+o*C;if(a<0&&a*a>r)continue;const c=a<0?0:a;if(t*t+n*n+o*o-c*c>r)continue;if(T&&null!=S.dist){p<0&&(p=Math.sqrt(r));if(Math.max(a-p,0)*M>=S.dist)continue}const d=this._intersectGaussianEllipsoid(t,n,o,G,O,C,e[g],s[g]);if(d<0)continue;const w=d*M;if(null!=l&&!l(u,f,w))continue;const v=null==S.dist||w<S.dist,R=B&&(null==V.dist||w>V.dist);if(!v&&!R&&!q)continue;const _=U+G*d,j=I+O*d,E=L+C*d;if(v&&P(S,w,_,j,E),R&&P(V,w,_,j,E),q){const t=new x;D.push(P(t,w,_,j,E))}}},Y=(t,i)=>{const{min:e,max:s}=t.obb.signedDistanceRangePlane(v);if(s<0)return;const n=e*M;if(!(T&&null!=S.dist&&S.dist<n)){if(null!=S.dist&&null!=V.dist){const t=s*M;if(S.dist<n&&V.dist>t)return}i?N(t):X(t)}},Z=t=>{Y(t,!1)},F=t=>{const i=t.boundingBox;d(i,A)&&Y(t,!p(A,i))};this._bvh.forEachTileIntersectingRay(u,f,null!=A?F:Z,g);const H=(t,i)=>{const{layerViewUid:e}=i,s=new y(i.point,e);t.set(0,s,i.dist,i.normal)};if(R(S)){const t=o.results.min;(null==t.distance||S.dist<t.distance)&&H(t,S)}if(R(V)&&B){const t=o.results.max;(null==t.distance||V.dist>t.distance)&&H(t,V)}if(q&&D?.length)for(const t of D){const i=new w(E);H(i,t),o.results.all.push(i)}}_intersectGaussianEllipsoid(t,i,e,s,n,r,l,a){const c=l>>>30,u=1023&l,d=l>>>10&1023,p=l>>>20&1023,f=(u&_)*j*(1-2*(u>>>9&1)),h=(d&_)*j*(1-2*(d>>>9&1)),m=(p&_)*j*(1-2*(p>>>9&1));let y,g,b,w;const v=f*f+h*h+m*m,R=Math.sqrt(Math.max(0,1-v));switch(c){case 0:y=R,g=m,b=h,w=f;break;case 1:y=m,g=R,b=h,w=f;break;case 2:y=m,g=h,b=R,w=f;break;default:y=m,g=h,b=f,w=R}const x=this._ellipsoidLocalRayOrigin;x[0]=-t,x[1]=-i,x[2]=-e,o(x,x,-y,-g,-b,w);const M=this._ellipsoidLocalRayDir;M[0]=s,M[1]=n,M[2]=r,o(M,M,-y,-g,-b,w);const V=S[255&a],k=S[a>>>8&255],T=S[a>>>16],q=x[0]*V,B=x[1]*k,D=x[2]*T,P=q*q+B*B+D*D;if(P<=1)return 0;const U=M[0]*V,I=M[1]*k,L=M[2]*T,G=U*U+I*I+L*L,O=q*U+B*I+D*L;if(O>0)return E;const C=O*O-G*(P-1);return C<0?E:(-O-Math.sqrt(C))/G}getElevationRange(t){return this._bvh.getElevationRangeIntersectingSphere(t)??new b(0,0)}}function R(t){return null!=t.dist&&null!=t.point}class x{constructor(){this.point=null,this.dist=null,this.normal=null,this.layerViewUid=""}}const _=511,j=Math.SQRT1_2/_,E=-1,M=3,S=(()=>{const t=new Float64Array(256);for(let i=0;i<t.length;i++)t[i]=Math.exp(10-i/16)/M;return t})();export{v as GaussianSplatIntersectionHandler};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{reallocGrowthFactor as t}from"../../../../core/arrayUtils.js";import{initialSplatAtlasTextureHeight as e,GaussianSplatAtlasPages as s,splatAtlasTextureWidth as r,elementsPerSplatPage as a}from"./GaussianSplatAtlasPages.js";import{GaussianSplatOrderTexture as i}from"./GaussianSplatOrderTexture.js";import{PixelType as l,SizedPixelFormat as u}from"../../../webgl/enums.js";import{DisposableFramebufferObject as o}from"../../../webgl/FramebufferObject.js";import h from"../../../webgl/Texture.js";import{TextureDescriptor as p}from"../../../webgl/TextureDescriptor.js";class c{constructor(t,r,a){this._splatAtlasTextureHeight=e,this.texture=null,this._rctx=t,this._fboCache=a,this.pageAllocator=new s,this._cache=r.newCache("gaussian texture cache",t=>t.dispose())}get usedMemory(){return this.texture?.usedMemory??0}ensureTextureAtlas(){if(this.texture?.hasWebGLTextureObject)return;this.texture=null;const t=this._cache.pop("splatTextureAtlas");if(t)return void(this.texture=t);const e=new p;e.height=this._splatAtlasTextureHeight,e.width=r,e.pixelFormat=36249,e.dataType=l.UNSIGNED_INT,e.internalFormat=u.RGBA32UI,e.samplingMode=9728,e.wrapMode=33071,e.isImmutable=!0,this.texture=new h(this._rctx,e),this._updatePageAllocator()}grow(){if(!this.texture)return this.ensureTextureAtlas(),!1;const e=Math.floor(this._splatAtlasTextureHeight*t),s=Math.min(e,x);if(s<=this._splatAtlasTextureHeight)return!1;if(s*r>this._rctx.parameters.maxPreferredTexturePixels)return!1;const a=new o(this._rctx,this.texture),i=this._fboCache.acquire(r,s,"gaussian splat atlas resize",12);return this._rctx.blitFramebuffer(a,i.fbo,16384,9728,0,0,r,this._splatAtlasTextureHeight,0,0,r,this._splatAtlasTextureHeight),this.texture?.dispose(),this.texture=i.fbo?.detachColorTexture(),a.dispose(),i.dispose(),this._splatAtlasTextureHeight=s,this._updatePageAllocator(),!0}requestPage(){let t=this.pageAllocator.findFirstFreePage();return null===t&&this.grow()&&(t=this.pageAllocator.findFirstFreePage()),null!==t&&this.pageAllocator.allocate(t),t}freePage(t){this.pageAllocator.free(t)}update(t,e,s){this.ensureTextureAtlas(),this.texture.updateData(0,t,e,a,1,s)}_updatePageAllocator(){const t=r*this._splatAtlasTextureHeight/a;this.pageAllocator.pageCount!==t&&this.pageAllocator.resize(t)}clear(){this.texture&&(this._cache.put("splatTextureAtlas",this.texture),this.texture=null)}destroy(){this._cache.destroy(),this.texture?.dispose(),this.texture=null}}const x=2**(8*i.bytesPerPackedGaussianIndex)/r;export{c as GaussianSplatTextureAtlas};
2
+ import{reallocGrowthFactor as t}from"../../../../core/arrayUtils.js";import{initialSplatAtlasTextureHeight as e,GaussianSplatAtlasPages as s,splatAtlasTextureWidth as r,elementsPerSplatPage as a}from"./GaussianSplatAtlasPages.js";import{GaussianSplatOrderTexture as i}from"./GaussianSplatOrderTexture.js";import{PixelType as l,SizedPixelFormat as u}from"../../../webgl/enums.js";import{DisposableFramebufferObject as o}from"../../../webgl/FramebufferObject.js";import h from"../../../webgl/Texture.js";import{TextureDescriptor as p}from"../../../webgl/TextureDescriptor.js";class c{constructor(t,r,a){this._splatAtlasTextureHeight=e,this.texture=null,this._rctx=t,this._fboCache=a,this.pageAllocator=new s,this._cache=r.newCache("gaussian texture cache",t=>t.dispose())}get usedMemory(){return this.texture?.usedMemory??0}ensureTextureAtlas(){if(this.texture?.hasWebGLTextureObject)return;this.texture=null;const t=this._cache.pop("splatTextureAtlas");if(t)return void(this.texture=t);const e=new p;e.height=this._splatAtlasTextureHeight,e.width=r,e.pixelFormat=36249,e.dataType=l.UNSIGNED_INT,e.internalFormat=u.RGBA32UI,e.samplingMode=9728,e.wrapMode=33071,e.isImmutable=!0,this.texture=new h(this._rctx,e),this._updatePageAllocator()}grow(){if(!this.texture)return this.ensureTextureAtlas(),!1;const e=Math.floor(this._splatAtlasTextureHeight*t),s=Math.min(e,x);if(s<=this._splatAtlasTextureHeight)return!1;if(s*r>this._rctx.parameters.maxPreferredTexturePixels)return!1;const a=new o(this._rctx,this.texture),i=this._fboCache.acquire(r,s,"gaussian splat atlas resize",12);return this._rctx.blitFramebuffer(a,i.fbo,16384,9728,0,0,r,this._splatAtlasTextureHeight,0,0,r,this._splatAtlasTextureHeight),this.texture=i.fbo?.detachColorTexture(),a.dispose(),i.dispose(),this._splatAtlasTextureHeight=s,this._updatePageAllocator(),!0}requestPage(){let t=this.pageAllocator.findFirstFreePage();return null===t&&this.grow()&&(t=this.pageAllocator.findFirstFreePage()),null!==t&&this.pageAllocator.allocate(t),t}freePage(t){this.pageAllocator.free(t)}update(t,e,s){this.ensureTextureAtlas(),this.texture.updateData(0,t,e,a,1,s)}_updatePageAllocator(){const t=r*this._splatAtlasTextureHeight/a;this.pageAllocator.pageCount!==t&&this.pageAllocator.resize(t)}clear(){this.texture&&(this._cache.put("splatTextureAtlas",this.texture),this.texture=null)}destroy(){this._cache.destroy(),this.texture?.dispose(),this.texture=null}}const x=2**(8*i.bytesPerPackedGaussianIndex)/r;export{c as GaussianSplatTextureAtlas};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{estimateNumberArrayMemory as t}from"../../../../core/memoryEstimations.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as e,diameter as i}from"../../../../geometry/support/aaBoundingBox.js";class o{constructor(o,r,n,a,h,b,c,u,d,m){this.handle=o,this.obb=r,this.gaussianAtlasIndices=n,this.pageIds=a,this.relativePositions=h,this.packedRotations=b,this.packedScales=c,this.gaussianCount=u,this.maxSplatMbsRadiusSquared=d,this.elevationRange=m,this.bvhIntersectionGeneration=0,this.lifecycleState=0,this.fadeDirection=0,this.opacityModifier=0,this.usedMemory=t(this.gaussianAtlasIndices,this.pageIds,this.relativePositions,this.packedRotations,this.packedScales);const l=s();r.getCenter(l),this.obbCenterX=l[0],this.obbCenterY=l[1],this.obbCenterZ=l[2];const f=r.radius??-1;this._mbsRadius=f;const p=f<0?-1:f*f;this._mbsRadiusSquared=p;const g=r.halfSize;this._obbShortestHalfsize=g?Math.min(g[0],g[1],g[2]):0;const S=e();r.toAaBoundingBox(S),this.boundingBox=S;const R=f>=0?f:.5*i(S);this.paddedMbsRadius=R+Math.sqrt(Math.max(0,d))}boundingVolumeIntersectsRay(t,s){if(!this.obb)return!0;const{obbCenterX:e,obbCenterY:i,obbCenterZ:o}=this,r=e-t[0],n=i-t[1],a=o-t[2],h=r*s[0]+n*s[1]+a*s[2],b=r*r+n*n+a*a-h*h;return(this._mbsRadiusSquared<0||b<=this._mbsRadiusSquared)&&this.obb.intersectRay(t,s)}boundingVolumeIntersectsSphere(t){const s=this._mbsRadius;if(s<0)return!0;const e=t.center,i=t.radius,o=s+i,r=this.obbCenterX-e[0];if(r>o)return!1;const n=this.obbCenterY-e[1];if(n>o)return!1;const a=this.obbCenterZ-e[2];if(a>o)return!1;const h=r*r+n*n+a*a;if(h>o*o)return!1;if(h<=(this._obbShortestHalfsize+i)**2)return!0;return Math.sqrt(h)+s<=i||(this.obb?.intersectSphere(t)??!0)}}export{o as GaussianTile};
2
+ import{estimateNumberArrayMemory as t}from"../../../../core/memoryEstimations.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as i,diameter as e}from"../../../../geometry/support/aaBoundingBox.js";class o{constructor(o,n,r,a,h,c,b,u,d,l){this.handle=o,this.obb=n,this.gaussianAtlasIndices=r,this.pageIds=a,this.relativePositions=h,this.packedRotations=c,this.packedOpacityScaledScales=b,this.gaussianCount=u,this.maxSplatMbsRadiusSquared=d,this.elevationRange=l,this.bvhIntersectionGeneration=0,this.lifecycleState=0,this.cullingRevision=-1,this.cullingVisible=!1,this.fadeDirection=0,this.opacityModifier=0,this.usedMemory=t(this.gaussianAtlasIndices,this.pageIds,this.relativePositions,this.packedRotations,this.packedOpacityScaledScales);const m=s();n.getCenter(m),this.obbCenterX=m[0],this.obbCenterY=m[1],this.obbCenterZ=m[2];const p=n.radius??-1;this._mbsRadius=p;const f=p<0?-1:p*p;this._mbsRadiusSquared=f;const g=n.halfSize;this._obbShortestHalfsize=g?Math.min(g[0],g[1],g[2]):0;const S=i();n.toAaBoundingBox(S),this.boundingBox=S;const R=p>=0?p:.5*e(S);this.paddedMbsRadius=R+Math.sqrt(Math.max(0,d))}boundingVolumeIntersectsRay(t,s){if(!this.obb)return!0;const{obbCenterX:i,obbCenterY:e,obbCenterZ:o}=this,n=i-t[0],r=e-t[1],a=o-t[2],h=n*s[0]+r*s[1]+a*s[2],c=n*n+r*r+a*a-h*h;return(this._mbsRadiusSquared<0||c<=this._mbsRadiusSquared)&&this.obb.intersectRay(t,s)}boundingVolumeIntersectsSphere(t){const s=this._mbsRadius;if(s<0)return!0;const i=t.center,e=t.radius,o=s+e,n=this.obbCenterX-i[0];if(n>o)return!1;const r=this.obbCenterY-i[1];if(r>o)return!1;const a=this.obbCenterZ-i[2];if(a>o)return!1;const h=n*n+r*r+a*a;if(h>o*o)return!1;if(h<=(this._obbShortestHalfsize+e)**2)return!0;return Math.sqrt(h)+s<=e||(this.obb?.intersectSphere(t)??!0)}}export{o as GaussianTile};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- function t(t,o,n){const r=o/3,c=new Uint32Array(n+1),e=new Uint32Array(n+1),s=(t,o)=>{t<o?c[t+1]++:e[o+1]++};for(let x=0;x<r;x++){const o=t[3*x],n=t[3*x+1],r=t[3*x+2];s(o,n),s(n,r),s(r,o)}let f=0,l=0;for(let x=0;x<n;x++){const t=c[x+1],o=e[x+1];c[x+1]=f,e[x+1]=l,f+=t,l+=o}const i=new Uint32Array(6*r),a=c[n],w=(t,o,n)=>{if(t<o){const r=c[t+1]++;i[2*r]=o,i[2*r+1]=n}else{const r=e[o+1]++;i[2*a+2*r]=t,i[2*a+2*r+1]=n}};for(let x=0;x<r;x++){const o=t[3*x],n=t[3*x+1],r=t[3*x+2];w(o,n,x),w(n,r,x),w(r,o,x)}const y=(t,o)=>{const n=2*t,r=o-t;for(let c=1;c<r;c++){const t=i[n+2*c],o=i[n+2*c+1];let r=c-1;for(;r>=0&&i[n+2*r]>t;r--)i[n+2*r+2]=i[n+2*r],i[n+2*r+3]=i[n+2*r+1];i[n+2*r+2]=t,i[n+2*r+3]=o}};for(let x=0;x<n;x++)y(c[x],c[x+1]),y(a+e[x],a+e[x+1]);const A=new Int32Array(3*r),U=(o,n)=>o===t[3*n]?0:o===t[3*n+1]?1:o===t[3*n+2]?2:-1,u=(t,o)=>{const n=U(t,o);A[3*o+n]=-1},p=(t,o,n,r)=>{const c=U(t,o);A[3*o+c]=r;const e=U(n,r);A[3*r+e]=o};for(let x=0;x<n;x++){let t=c[x];const o=c[x+1];let n=e[x];const r=e[x+1];for(;t<o&&n<r;){const o=i[2*t],r=i[2*a+2*n];o===r?(p(x,i[2*t+1],r,i[2*a+2*n+1]),t++,n++):o<r?(u(x,i[2*t+1]),t++):(u(r,i[2*a+2*n+1]),n++)}for(;t<o;)u(x,i[2*t+1]),t++;for(;n<r;){u(i[2*a+2*n],i[2*a+2*n+1]),n++}}return A}export{t as computeNeighbors};
2
+ function t(t,n,o){const r=n/3,e=new Uint32Array(o+1),s=new Uint32Array(o+1),c=(t,n)=>{t<n?e[t+1]++:s[n+1]++};for(let U=0;U<r;U++){const n=t[3*U],o=t[3*U+1],r=t[3*U+2];c(n,o),c(o,r),c(r,n)}let f=0,l=0;for(let U=0;U<o;U++){const t=e[U+1],n=s[U+1];e[U+1]=f,s[U+1]=l,f+=t,l+=n}const i=new Uint32Array(6*r),u=e[o],p=(t,n,o)=>{if(t<n){const r=e[t+1]++;i[2*r]=n,i[2*r+1]=o}else{const r=s[n+1]++;i[2*u+2*r]=t,i[2*u+2*r+1]=o}};for(let U=0;U<r;U++){const n=t[3*U],o=t[3*U+1],r=t[3*U+2];p(n,o,U),p(o,r,U),p(r,n,U)}const a=(t,n)=>{const o=2*t,r=n-t;for(let e=1;e<r;e++){const t=i[o+2*e],n=i[o+2*e+1];let r=e-1;for(;r>=0&&i[o+2*r]>t;r--)i[o+2*r+2]=i[o+2*r],i[o+2*r+3]=i[o+2*r+1];i[o+2*r+2]=t,i[o+2*r+3]=n}};for(let U=0;U<o;U++)a(e[U],e[U+1]),a(u+s[U],u+s[U+1]);const h=new Int32Array(3*r),w=(n,o)=>n===t[3*o]?0:n===t[3*o+1]?1:n===t[3*o+2]?2:-1,y=(t,n)=>{const o=w(t,n);h[3*n+o]=-1},A=(t,n,o,r)=>{const e=w(t,n);h[3*n+e]=r;const s=w(o,r);h[3*r+s]=n};for(let U=0;U<o;U++){let t=e[U];const n=e[U+1];let o=s[U];const r=s[U+1];for(;t<n&&o<r;){const n=i[2*t],r=i[2*u+2*o];n===r?(A(U,i[2*t+1],r,i[2*u+2*o+1]),t++,o++):n<r?(y(U,i[2*t+1]),t++):(y(r,i[2*u+2*o+1]),o++)}for(;t<n;)y(U,i[2*t+1]),t++;for(;o<r;){y(i[2*u+2*o],i[2*u+2*o+1]),o++}}return h}function n(t,n,r){const e=o(t,n,r),s=new Array(n).fill(-1),c=new Array(r).fill(-1);let f=0;const l=[];for(let o=0;o<n;++o)if(-1===s[o]){for(s[o]=f,l.push(o);l.length>0;){const n=3*l.pop();for(let o=0;o<3;++o){const r=t[n+o];if(c[r]===f)continue;c[r]=f;const i=e[r];for(let t=0;t<i.length;++t){const n=i[t];-1===s[n]&&(s[n]=f,l.push(n))}}}f++}return[s,f]}function o(t,n,o){const r=new Array;for(let e=0;e<o;++e)r[e]=[];for(let e=0;e<n;++e)r[t[3*e]].push(e),r[t[3*e+1]].push(e),r[t[3*e+2]].push(e);return r}export{t as computeNeighbors,n as computeVertexConnectedTriangleComponents};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{ComponentTechnique as e}from"./ComponentTechnique.js";import{ComponentTechniqueConfiguration as t}from"./ComponentTechniqueConfiguration.js";import{MaterialBase as s}from"../../../core/material/MaterialBase.js";import{isColor as r}from"../../../core/shaderLibrary/ShaderOutput.js";import{hasShadowHighlights as a}from"../../../shaders/ReceiveShadowsConfiguration.js";class i extends s{constructor(e,s,r,a,i){super(),this.parameters=e,this.key=i;const n=l(e,r);this.usePBR=e.usePBR,this.hasParametersFromSource=e.hasParametersFromSource,this.isGround=e.isGround,this.slicePlaneEnabled=e.slicePlaneEnabled,this.isIntegratedMesh=e.isIntegratedMesh,this.applySSAO=e.applySSAO,this.hasEmissions=0!==n?3:0,this.materialPass=o(e,r),this._configuration=new t(a),this._initializeMaterialConfiguration(e,s,r)}destroy(){}acquireTechnique(t,s,r,a){const i=this._updateConfiguration(s,r);return t.get(e,i,a.layout)}_initializeMaterialConfiguration(e,t,s){const r=this._configuration;r.hasMetallicRoughnessTexture=e.hasMetallicRoughnessTexture,r.hasOcclusionTexture=e.hasOcclusionTexture,r.hasNormalTexture=e.hasNormalTexture,r.sphereDepthInterpolate=e.sphereDepthInterpolate&&r.spherical,r.ellipsoidMode=e.ellipsoidMode,r.doubleSidedMode=e.doubleSided?1:0,r.hasColorTexture=e.hasBaseColorTexture,r.cullFace=e.cullFace,r.alphaDiscardMode=e.alphaDiscardMode,r.hasVertexColors=t.hasVertexColors,r.textureCoordinateType=t.textureCoordinateType,r.shadeNormals=t.shadeNormals,r.normalType=t.hasNormals?1:2,r.polygonOffset=e.polygonOffset,r.vertexPositionRotationType=t.vertexPositionRotationType,r.vertexNormalRotationType=t.vertexNormalRotationType,r.componentDataType=s.componentDataType,r.emissionSource=l(e,s)}_updateConfiguration(e,t){const s=this._configuration,{identifier:i}=e,o=0===i;s.output=t.output,s.enableOITOffset=t.enableOITOffset,s.hasEmission=t.hasEmission&&o,s.renderOccluded=9===t.slot;const n=this.isIntegratedMesh?c(t)?u(t)?3:2:1:0;s.integratedMeshMode=n,s.pbrMode=3===n?4:this.usePBR?this.hasParametersFromSource?0!==s.shadeNormals&&this.isIntegratedMesh?0:2:1:0,s.hasSlicePlane=null!=t.slicePlane&&this.slicePlaneEnabled,s.isGroundSlice=s.hasSlicePlane&&this.isGround;const{materialPass:l}=this;s.transparent=o&&(1===l||2===l&&e.transparent||4===l)||s.isGroundSlice,s.hasHighlightMixTexture=2===i&&null!=t.highlightMixTexture,s.snowCover=o&&t.snowCover>0,s.vertexDiscardMode=o&&2===l?e.transparent?2:1:0;const h=r(t.output);return s.receiveAmbientOcclusion=h&&this.applySSAO&&!s.renderOccluded&&null!=t.ssao?.getTexture(),s.receiveGlobalIllumination=h&&this.applySSAO&&!s.renderOccluded&&t.globalIlluminationEnabled,s.hasOccludees=h&&t.hasOccludees,s.receiveShadows=h&&t.shadowMap.ready,s.hasShadowHighlights=a(s,t),s.screenSpaceReflections=t.hasScreenSpaceReflections,s.cloudReflections=h&&null!=t.clouds.data?.cubeMap?.colorTexture,s}}function o(e,t){const{alphaDiscardMode:s,isIntegratedMesh:r,slicePlaneEnabled:a}=e,{transparent:i,opaqueOverride:o}=t,n=e.isObjectTransparent,l=e.hasBaseColorTransparency;if(r)return n||a?4:3;if(n)return 1;if(0===o)return 0;if(l||0===s||3===s)return 1;switch(i){case 2:return 0;case 0:return 1;case 1:return 2}}function n(e){return e.hasEmissionTexture||e.hasEmissiveBaseColor}function l(e,t){const s=e.hasEmissionTexture,{emissiveSourceOverride:r}=t,a=1===r,i=2===r;return 2!==t.emissiveOverride&&(n(e)||2!==r)?n(e)?i?s?4:2:a?s?5:7:6:a?7:6:0}function u(e){return null!=e.overlay?.getTexture(3)}function c(e){return null!=e.overlay?.getTexture(1)}export{i as ComponentMaterial,o as computeMaterialPass,l as getEmissionSource};
2
+ import{ComponentTechnique as e}from"./ComponentTechnique.js";import{ComponentTechniqueConfiguration as t}from"./ComponentTechniqueConfiguration.js";import{MaterialBase as s}from"../../../core/material/MaterialBase.js";import{isColor as r}from"../../../core/shaderLibrary/ShaderOutput.js";import{hasShadowHighlights as a}from"../../../shaders/ReceiveShadowsConfiguration.js";import{isSphereDepthInterpolateActive as o}from"../../../shaders/SphereDepthInterpolate.glsl.js";class i extends s{constructor(e,s,r,a,o){super(),this.parameters=e,this.key=o;const i=h(e,r);this.usePBR=e.usePBR,this.hasParametersFromSource=e.hasParametersFromSource,this.isGround=e.isGround,this.slicePlaneEnabled=e.slicePlaneEnabled,this.isIntegratedMesh=e.isIntegratedMesh,this.applySSAO=e.applySSAO,this.hasEmissions=0!==i?3:0,this.materialPass=n(e,r),this._configuration=new t(a),this._supportsSphereDepthInterpolate=e.sphereDepthInterpolate&&this._configuration.spherical,this._initializeMaterialConfiguration(e,s,r)}destroy(){}acquireTechnique(t,s,r,a){const i=this._updateConfiguration(s,r);if(this._supportsSphereDepthInterpolate&&t.precompiling>0){i.sphereDepthInterpolate=!1;const s=t.get(e,i,a.layout);i.sphereDepthInterpolate=!0;const n=t.get(e,i,a.layout);return o(r.camera,i)?n:s}return t.get(e,i,a.layout)}_initializeMaterialConfiguration(e,t,s){const r=this._configuration;r.hasMetallicRoughnessTexture=e.hasMetallicRoughnessTexture,r.hasOcclusionTexture=e.hasOcclusionTexture,r.hasNormalTexture=e.hasNormalTexture,r.sphereDepthInterpolate=!1,r.ellipsoidMode=e.ellipsoidMode,r.doubleSidedMode=e.doubleSided?1:0,r.hasColorTexture=e.hasBaseColorTexture,r.cullFace=e.cullFace,r.alphaDiscardMode=e.alphaDiscardMode,r.hasVertexColors=t.hasVertexColors,r.textureCoordinateType=t.textureCoordinateType,r.shadeNormals=t.shadeNormals,r.normalType=t.hasNormals?1:2,r.polygonOffset=e.polygonOffset,r.vertexPositionRotationType=t.vertexPositionRotationType,r.vertexNormalRotationType=t.vertexNormalRotationType,r.componentDataType=s.componentDataType,r.emissionSource=h(e,s)}_updateConfiguration(e,t){const s=this._configuration,{identifier:i}=e,n=0===i;s.output=t.output,s.enableOITOffset=t.enableOITOffset,s.sphereDepthInterpolate=this._supportsSphereDepthInterpolate&&o(t.camera,s),s.hasEmission=t.hasEmission&&n,s.renderOccluded=9===t.slot;const l=this.isIntegratedMesh?c(t)?u(t)?3:2:1:0;s.integratedMeshMode=l,s.pbrMode=3===l?4:this.usePBR?this.hasParametersFromSource?0!==s.shadeNormals&&this.isIntegratedMesh?0:2:1:0,s.hasSlicePlane=null!=t.slicePlane&&this.slicePlaneEnabled,s.isGroundSlice=s.hasSlicePlane&&this.isGround;const{materialPass:h}=this;s.transparent=n&&(1===h||2===h&&e.transparent||4===h)||s.isGroundSlice,s.hasHighlightMixTexture=2===i&&null!=t.highlightMixTexture,s.snowCover=n&&t.snowCover>0,s.vertexDiscardMode=n&&2===h?e.transparent?2:1:0;const p=r(t.output);return s.receiveAmbientOcclusion=p&&this.applySSAO&&!s.renderOccluded&&null!=t.ssao?.getTexture(),s.receiveGlobalIllumination=p&&this.applySSAO&&!s.renderOccluded&&t.globalIlluminationEnabled,s.hasOccludees=p&&t.hasOccludees,s.receiveShadows=p&&t.shadowMap.ready,s.hasShadowHighlights=a(s,t),s.screenSpaceReflections=t.hasScreenSpaceReflections,s.cloudReflections=p&&null!=t.clouds.data?.cubeMap?.colorTexture,s}}function n(e,t){const{alphaDiscardMode:s,isIntegratedMesh:r,slicePlaneEnabled:a}=e,{transparent:o,opaqueOverride:i}=t,n=e.isObjectTransparent,l=e.hasBaseColorTransparency;if(r)return n||a?4:3;if(n)return 1;if(0===i)return 0;if(l||0===s||3===s)return 1;switch(o){case 2:return 0;case 0:return 1;case 1:return 2}}function l(e){return e.hasEmissionTexture||e.hasEmissiveBaseColor}function h(e,t){const s=e.hasEmissionTexture,{emissiveSourceOverride:r}=t,a=1===r,o=2===r;return 2!==t.emissiveOverride&&(l(e)||2!==r)?l(e)?o?s?4:2:a?s?5:7:6:a?7:6:0}function u(e){return null!=e.overlay?.getTexture(3)}function c(e){return null!=e.overlay?.getTexture(1)}export{i as ComponentMaterial,n as computeMaterialPass,h as getEmissionSource};
@@ -1,11 +1,11 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{generateUID as e}from"../../../../../core/uid.js";import{TextureBufferNaNSupportConfiguration as t,unpackFloat4x8 as o,unpackHalf2x8 as d,glslType as n,glslDecodeField as i}from"./TextureBackedBufferFields.glsl.js";import{glsl as r}from"../shaderModules/glsl.js";import{assert as a}from"../../lib/Util.js";const c=new t(!0),s=new t(!1);class u{constructor(t){this.moduleId=e(),this.namespace=`_tbb_${this.moduleId}_`;const{itemIndexAttribute:o,bufferUniform:d,layout:n}=t,i=t.fieldFilter??(()=>!0),r=t.enableNaNSupport?c:s;this.TextureBackedBufferModule=(e,t)=>f(this.namespace,e,t,o,d,n,i,r),this.getTextureAttribute=l(this.namespace)}}function f(e,t,c,s,u,f,l,h){const{vertex:$}=t;$.include(o,h),$.include(d,h);const x=`${e}tbbStride`,p=`${e}TextureBackedBufferItemData`,g=`${e}fetchTextureBackedBufferItemData`,b=m(e);for(const o of[x,p,g,b])a(o.length<1024,"Identifiers do not have a valid length");$.constants.add(x,"uint",f.texelStride),$.uniforms.add(u);const I=new Array;for(const o of f.fields.values())l(o.name,c)&&I.push(o);if(0===I.length)return;const B=[];for(let o=0;o<f.texelStride;++o)B.push(!1);for(const o of I)for(let e=0;e<o.numTexels;++e)B[o.startTexel+e]=!0;$.code.add(r`
3
- struct ${p} {`);for(const o of I)$.code.add(r`\t${n(o)} ${o.name};`);$.code.add(r`};`),$.code.add(r`
4
- ${p} ${g}(highp uint itemIndex) {
5
- ${p} itemData;
6
- highp uint index = itemIndex * ${x};
7
- highp uint rowWidth = uint(textureSize(${u.name}, 0).x);
2
+ import{generateUID as e}from"../../../../../core/uid.js";import{TextureBufferNaNSupportConfiguration as t,unpackFloat1x32 as o,unpackHalf1x16 as d,unpackInt1x16 as n,glslType as i,glslDecodeField as r}from"./TextureBackedBufferFields.glsl.js";import{glsl as a}from"../shaderModules/glsl.js";import{assert as c}from"../../lib/Util.js";const s=new t(!0),u=new t(!1);class f{constructor(t){this.moduleId=e(),this.namespace=`_tbb_${this.moduleId}_`;const{itemIndexAttribute:o,bufferUniform:d,layout:n}=t,i=t.fieldFilter??(()=>!0),r=t.enableNaNSupport?s:u;this.TextureBackedBufferModule=(e,t)=>l(this.namespace,e,t,o,d,n,i,r),this.getTextureAttribute=m(this.namespace)}}function l(e,t,s,u,f,l,m,$){const{vertex:x}=t;x.include(o,$),x.include(d,$),x.include(n);const p=`${e}tbbStride`,g=`${e}TextureBackedBufferItemData`,b=`${e}fetchTextureBackedBufferItemData`,I=h(e);for(const o of[p,g,b,I])c(o.length<1024,"Identifiers do not have a valid length");x.constants.add(p,"uint",l.texelStride),x.uniforms.add(f);const B=new Array;for(const o of l.fields.values())m(o.name,s)&&B.push(o);if(0===B.length)return;const w=[];for(let o=0;o<l.texelStride;++o)w.push(!1);for(const o of B)for(let e=0;e<o.numTexels;++e)w[o.startTexel+e]=!0;x.code.add(a`
3
+ struct ${g} {`);for(const o of B)x.code.add(a`\t${i(o)} ${o.name};`);x.code.add(a`};`),x.code.add(a`
4
+ ${g} ${b}(highp uint itemIndex) {
5
+ ${g} itemData;
6
+ highp uint index = itemIndex * ${p};
7
+ highp uint rowWidth = uint(textureSize(${f.name}, 0).x);
8
8
  int coordX = int(index % rowWidth);
9
9
  int coordY = int(index / rowWidth);
10
- `);for(let o=0;o<B.length;++o)!1!==B[o]&&$.code.add(r`lowp uvec4 texel${r.int(o)} = texelFetch(${u.name}, ivec2(coordX + ${r.int(o)}, coordY), 0);`);for(const o of I)$.code.add(r`itemData.${o.name} = ${i(o)};`);$.code.add(r`return itemData;
11
- }`),$.code.add(r`${p} ${b};`),$.main.add(r`${b} = ${g}(${s});`)}function l(e){const t=m(e);return e=>r`${t}.${e}`}function m(e){return`${e}ItemData`}export{u as TextureBackedBufferModule};
10
+ `);for(let o=0;o<w.length;++o)!1!==w[o]&&x.code.add(a`lowp uvec4 texel${a.int(o)} = texelFetch(${f.name}, ivec2(coordX + ${a.int(o)}, coordY), 0);`);for(const o of B)x.code.add(a`itemData.${o.name} = ${r(o)};`);x.code.add(a`return itemData;
11
+ }`),x.code.add(a`${g} ${I};`),x.main.add(a`${I} = ${b}(${u});`)}function m(e){const t=h(e);return e=>a`${t}.${e}`}function h(e){return`${e}ItemData`}export{f as TextureBackedBufferModule};
@@ -1,28 +1,32 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as t}from"tslib";import{hasNativeFloat16Array as n}from"../../../../../geometry/support/float16.js";import{FloatBindUniform as e}from"../shaderModules/FloatBindUniform.js";import{glsl as o,If as i}from"../shaderModules/glsl.js";import{ShaderTechniqueConfiguration as u,parameter as s}from"../shaderTechnique/ShaderTechniqueConfiguration.js";function r(t){switch(t.elementType){case"float":switch(t.elementCount){case 1:return o`float`;case 2:return o`vec2`;case 3:return o`vec3`;case 4:return o`vec4`;case 9:return o`mat3`;default:t.elementCount}break;case"int":switch(t.elementCount){case 1:return o`int`;case 2:return o`ivec2`;case 3:return o`ivec3`;case 4:return o`ivec4`;case 9:throw new Error("Invalid element count 9 for type int");default:t.elementCount}break;case"uint":switch(t.elementCount){case 1:return o`uint`;case 2:return o`uvec2`;case 3:return o`uvec3`;case 4:return o`uvec4`;case 9:throw new Error("Invalid element count 9 for type uint");default:t.elementCount}break;default:t.elementType}throw new Error("unsupported field")}const a=new e("const_NaN",()=>NaN,{supportsNaN:!0});class c extends u{constructor(t){super(),this.supportNaN=t}}function p(t,n){const e=n?.supportNaN;e&&(t.uniforms.add(a),t.code.add(o`bool bitsEncodeFloat16NaN(highp uint bits) {
2
+ import{__decorate as t}from"tslib";import{hasNativeFloat16Array as n}from"../../../../../geometry/support/float16.js";import{FloatBindUniform as e}from"../shaderModules/FloatBindUniform.js";import{glsl as i,If as u}from"../shaderModules/glsl.js";import{ShaderTechniqueConfiguration as o,parameter as s}from"../shaderTechnique/ShaderTechniqueConfiguration.js";function a(t){switch(t.elementType){case"float":switch(t.elementCount){case 1:return i`float`;case 2:return i`vec2`;case 3:return i`vec3`;case 4:return i`vec4`;case 9:return i`mat3`;default:t.elementCount}break;case"int":switch(t.elementCount){case 1:return i`int`;case 2:return i`ivec2`;case 3:return i`ivec3`;case 4:return i`ivec4`;case 9:throw new Error("Invalid element count 9 for type int");default:t.elementCount}break;case"uint":switch(t.elementCount){case 1:return i`uint`;case 2:return i`uvec2`;case 3:return i`uvec3`;case 4:return i`uvec4`;case 9:throw new Error("Invalid element count 9 for type uint");default:t.elementCount}break;default:t.elementType}throw new Error("unsupported field")}const r=new e("const_NaN",()=>NaN,{supportsNaN:!0});class c extends o{constructor(t){super(),this.supportNaN=t}}function p(t,n){const e=n?.supportNaN;e&&(t.uniforms.add(r),t.code.add(i`bool bitsEncodeFloat16NaN(highp uint bits) {
3
3
  const highp uint nanExponent = 0x00007c00u;
4
4
  highp uint exponent = bits & nanExponent;
5
5
  highp uint mantissa = bits & 0x000003ffu;
6
6
  return exponent == nanExponent && mantissa != 0u;
7
- }`)),t.code.add(o`
8
- mediump float unpackHalf2x8(highp uint bits0, highp uint bits1) {
7
+ }`)),t.code.add(i`
8
+ mediump float unpackHalf1x16(highp uint bits0, highp uint bits1) {
9
9
  highp uint halfBits = (bits1 << 8u) | bits0;
10
- ${i(e,o`
10
+ ${u(e,i`
11
11
  if (bitsEncodeFloat16NaN(halfBits)) {
12
12
  return const_NaN;
13
13
  }`)}
14
14
  return unpackHalf2x16(halfBits).x;
15
- }`)}function f(t,n){const e=n?.supportNaN;e&&(t.uniforms.add(a),t.code.add(o`bool bitsEncodeFloat32NaN(highp uint bits) {
15
+ }`)}function f(t,n){const e=n?.supportNaN;e&&(t.uniforms.add(r),t.code.add(i`bool bitsEncodeFloat32NaN(highp uint bits) {
16
16
  const highp uint nanExponent = 0x7f800000u;
17
17
  highp uint exponent = bits & nanExponent;
18
18
  highp uint mantissa = bits & 0x007fffffu;
19
19
  return exponent == nanExponent && mantissa != 0u;
20
- }`)),t.code.add(o`
21
- highp float unpackFloat4x8(highp uint bits0, highp uint bits1, highp uint bits2, highp uint bits3) {
20
+ }`)),t.code.add(i`
21
+ highp float unpackFloat1x32(highp uint bits0, highp uint bits1, highp uint bits2, highp uint bits3) {
22
22
  highp uint floatBits = (bits3 << 24u) |(bits2 << 16u) | (bits1 << 8u) | bits0;
23
- ${i(e,o`
23
+ ${u(e,i`
24
24
  if (bitsEncodeFloat32NaN(floatBits)) {
25
25
  return const_NaN;
26
26
  }`)}
27
27
  return uintBitsToFloat(floatBits);
28
- }`)}function l(t){const{fieldType:n}=t;return`${(0,m[n])(b(t))}`}function h(t,n){const e=[];for(let i=0;i<t.length;i+=4){const n=t[i],u=t[i+1],s=t[i+2],r=t[i+3],a=o`unpackFloat4x8(${`${n}, ${u}, ${s}, ${r}`})`;e.push(a)}return e.join(n)}function d(t){return o`vec3(${h(t,",\n\t")})`}function $(t){return o`mat3(${h(t,",\n")})`}t([s()],c.prototype,"supportNaN",void 0);const m={u8:t=>o`${t[0]}`,unorm8:t=>o`float(${t[0]})/255.0`,vec4unorm8:t=>o`vec4(${`${t[0]}, ${t[1]}, ${t[2]}, ${t[3]}`})/255.0`,f16:n?t=>o`unpackHalf2x8(${`${t[0]}, ${t[1]}`})`:t=>o`unpackFloat4x8(${`${t[0]}, ${t[1]}, ${t[2]}, ${t[3]}`})`,f32:t=>o`unpackFloat4x8(${`${t[0]}, ${t[1]}, ${t[2]}, ${t[3]}`})`,vec4u8:t=>o`uvec4(${`${t[0]}, ${t[1]}, ${t[2]}, ${t[3]}`})`,vec3f32:t=>d(t),mat3f32:t=>$(t)};function b(t){const{startTexel:n,byteOffset:e,texelByteStride:i,byteSize:u}=t;let s=n,r=e%i;const a=new Array;for(let c=0;c<u;++c){const t=o`texel${o.int(s)}.${x[r]}`;a.push(t),++r,r>=i&&(r=0,++s)}return a}const x=["x","y","z","w"];export{c as TextureBufferNaNSupportConfiguration,l as glslDecodeField,r as glslType,f as unpackFloat4x8,p as unpackHalf2x8};
28
+ }`)}function h(t){t.code.add(i`mediump int unpackInt1x16(highp uint bits0, highp uint bits1) {
29
+ highp uint rawBits = (bits1 << 8u) | bits0;
30
+ highp uint signExtendedBits = (rawBits & 0x8000u) != 0u ? (rawBits | 0xffff0000u) : rawBits;
31
+ return int(signExtendedBits);
32
+ }`)}function l(t){const{fieldType:n}=t;return`${(0,x[n])(b(t))}`}function d(t,n){const e=[];for(let u=0;u<t.length;u+=4){const n=t[u],o=t[u+1],s=t[u+2],a=t[u+3],r=i`unpackFloat1x32(${`${n}, ${o}, ${s}, ${a}`})`;e.push(r)}return e.join(n)}function $(t){return i`vec3(${d(t,",\n\t")})`}function m(t){return i`mat3(${d(t,",\n")})`}t([s()],c.prototype,"supportNaN",void 0);const x={u8:t=>i`${t[0]}`,unorm8:t=>i`float(${t[0]})/255.0`,vec4unorm8:t=>i`vec4(${`${t[0]}, ${t[1]}, ${t[2]}, ${t[3]}`})/255.0`,vec2snorm16:t=>i`max(vec2(unpackInt1x16(${`${t[0]}, ${t[1]}`}), unpackInt1x16(${`${t[2]}, ${t[3]}`}))/32767.0, vec2(-1.0))`,f16:n?t=>i`unpackHalf1x16(${`${t[0]}, ${t[1]}`})`:t=>i`unpackFloat1x32(${`${t[0]}, ${t[1]}, ${t[2]}, ${t[3]}`})`,f32:t=>i`unpackFloat1x32(${`${t[0]}, ${t[1]}, ${t[2]}, ${t[3]}`})`,vec4u8:t=>i`uvec4(${`${t[0]}, ${t[1]}, ${t[2]}, ${t[3]}`})`,vec3f32:t=>$(t),mat3f32:t=>m(t)};function b(t){const{startTexel:n,byteOffset:e,texelByteStride:u,byteSize:o}=t;let s=n,a=e%u;const r=new Array;for(let c=0;c<o;++c){const t=i`texel${i.int(s)}.${g[a]}`;r.push(t),++a,a>=u&&(a=0,++s)}return r}const g=["x","y","z","w"];export{c as TextureBufferNaNSupportConfiguration,l as glslDecodeField,a as glslType,f as unpackFloat1x32,p as unpackHalf1x16,h as unpackInt1x16};