@arcgis/core 6.0.0-next.42 → 6.0.0-next.43

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 (489) hide show
  1. package/Basemap.js +1 -1
  2. package/Graphic.js +1 -1
  3. package/Ground.js +1 -1
  4. package/WebDocument2D.js +1 -1
  5. package/WebScene.js +1 -1
  6. package/analysis/ElevationProfile/ElevationProfileLineScene.d.ts +1 -0
  7. package/analysis/ElevationProfileAnalysis.d.ts +15 -0
  8. package/analysis/LineOfSightAnalysis.d.ts +6 -1
  9. package/analysis/ShadowCastAnalysis.d.ts +18 -22
  10. package/analysis/ShadowCastAnalysis.js +1 -1
  11. package/analysis/ViewshedAnalysis.d.ts +6 -1
  12. package/applications/Components/analysisUtils.d.ts +6 -0
  13. package/applications/Components/analysisUtils.js +1 -1
  14. package/arcade/ArcadeModuleResolver.js +1 -1
  15. package/arcade/arcadeCompiler.js +1 -1
  16. package/arcade/featureset/actions/Adapted.js +1 -1
  17. package/arcade/featureset/sources/FeatureLayerMemory.js +1 -1
  18. package/arcade/featureset/support/FeatureSet.js +1 -1
  19. package/arcade/featureset/support/shared.js +1 -1
  20. package/arcade/featureset/support/sqlUtils.js +1 -1
  21. package/arcade/functions/knowledgegraph.js +1 -1
  22. package/arcade/functions/maths.js +1 -1
  23. package/assets/esri/core/workers/RemoteClient.js +1 -1
  24. package/assets/esri/core/workers/chunks/{2f54e4feb554c1a7b9c4.js → 02debe67e6fef9d88bdd.js} +1 -1
  25. package/assets/esri/core/workers/chunks/{bd046399e05e759e0bc2.js → 035204000954973b0ebc.js} +1 -1
  26. package/assets/esri/core/workers/chunks/05225506fdba0c827407.js +1 -0
  27. package/assets/esri/core/workers/chunks/{4c73c493dabe949c2512.js → 077b755688346e0dc8d3.js} +1 -1
  28. package/assets/esri/core/workers/chunks/0c1d8e0c2eae21f97fc0.js +1 -0
  29. package/assets/esri/core/workers/chunks/105865a4d8cb4ddf8a8a.js +1 -0
  30. package/assets/esri/core/workers/chunks/{afe3e89737fb45189a99.js → 14ed0c34b910eba3434e.js} +1 -1
  31. package/assets/esri/core/workers/chunks/{f67b37253d6d05d1e339.js → 14ef986665b4a1f6ccdc.js} +1 -1
  32. package/assets/esri/core/workers/chunks/158cbf4075d3eca83a6a.js +1 -0
  33. package/assets/esri/core/workers/chunks/{a03f15f2cbc3fed291c2.js → 15f2b27b8edc0d53e399.js} +1 -1
  34. package/assets/esri/core/workers/chunks/181d24ced5ef6b1f959b.js +1 -0
  35. package/assets/esri/core/workers/chunks/18dbee576b7b9dbe69fb.js +1 -0
  36. package/assets/esri/core/workers/chunks/1aebb8fe0692058bf2fb.js +1 -0
  37. package/assets/esri/core/workers/chunks/1cdb55d9a5ab1a5e3f08.js +1 -0
  38. package/assets/esri/core/workers/chunks/{cf2e5f827cea7d7319ce.js → 1e5c5029b0653047a769.js} +1 -1
  39. package/assets/esri/core/workers/chunks/20db6e844708d3e71437.js +1 -0
  40. package/assets/esri/core/workers/chunks/21a4c3d8265aca775616.js +1 -0
  41. package/assets/esri/core/workers/chunks/23fff0505e02fd364909.js +1 -0
  42. package/assets/esri/core/workers/chunks/286e3e050b29e6158e6f.js +1 -0
  43. package/assets/esri/core/workers/chunks/29ef9d357e30082d267a.js +1 -0
  44. package/assets/esri/core/workers/chunks/29feef121b0916fb90bf.js +1 -0
  45. package/assets/esri/core/workers/chunks/2ef91e8da260454f46d8.js +1 -0
  46. package/assets/esri/core/workers/chunks/32b9bedd4bb0504f0b1d.js +1 -0
  47. package/assets/esri/core/workers/chunks/{279089a6a3f08022c678.js → 361d620b3f91868b1490.js} +1 -1
  48. package/assets/esri/core/workers/chunks/37c16e20f022ca27cdae.js +1 -0
  49. package/assets/esri/core/workers/chunks/380aefa522dfeccb8c65.js +1 -0
  50. package/assets/esri/core/workers/chunks/394ae3199c78a94c6a2a.js +1 -0
  51. package/assets/esri/core/workers/chunks/{fdd2b35388f9fe42b623.js → 3a90b6eafa92f1a68ac5.js} +1 -1
  52. package/assets/esri/core/workers/chunks/{6a65fc1a2931230fe994.js → 3bb1e06861cd0563ed9f.js} +1 -1
  53. package/assets/esri/core/workers/chunks/3f92afa58c895bf87e62.js +1 -0
  54. package/assets/esri/core/workers/chunks/422784ceae0d511868a0.js +1 -0
  55. package/assets/esri/core/workers/chunks/44782e8318dc47cb08a0.js +1 -0
  56. package/assets/esri/core/workers/chunks/{5882f349f3771868e67f.js → 4521f72ab0ea872e5d7c.js} +1 -1
  57. package/assets/esri/core/workers/chunks/45b5a61c4e9fbd9ca0b3.js +1 -0
  58. package/assets/esri/core/workers/chunks/47af220003adfca2167e.js +1 -0
  59. package/assets/esri/core/workers/chunks/487500443a6037d3599f.js +1 -0
  60. package/assets/esri/core/workers/chunks/4a4fab74442c3d914505.js +1 -0
  61. package/assets/esri/core/workers/chunks/4a8903fb1a5d30a68df9.js +1 -0
  62. package/assets/esri/core/workers/chunks/4d818b231e6d1fa73cc5.js +1 -0
  63. package/assets/esri/core/workers/chunks/{e0cf6e1e21d0ee739009.js → 4e03aa5518d46a36661c.js} +1 -1
  64. package/assets/esri/core/workers/chunks/{1a614bac5db42c6263f8.js → 4fe10650ba3cd30aa9a2.js} +1 -1
  65. package/assets/esri/core/workers/chunks/50b8b1cce0a5f77c8372.js +1 -0
  66. package/assets/esri/core/workers/chunks/5470a29a69010c8361c4.js +1 -0
  67. package/assets/esri/core/workers/chunks/564d7f2e58fbc16853c0.js +1 -0
  68. package/assets/esri/core/workers/chunks/5c2e79f2ca401741bf3e.js +1 -0
  69. package/assets/esri/core/workers/chunks/5c9ab86bec07264dc9f2.js +1 -0
  70. package/assets/esri/core/workers/chunks/{04d55ed51e8b2683c4b4.js → 5d908a823b324bafda1e.js} +1 -1
  71. package/assets/esri/core/workers/chunks/5e6d6676a5c47c0e132a.js +1 -0
  72. package/assets/esri/core/workers/chunks/5fd4d3cb3c9350131a59.js +1 -0
  73. package/assets/esri/core/workers/chunks/60637f38159e9bf68d4e.js +1 -0
  74. package/assets/esri/core/workers/chunks/69b73251257088ce7099.js +1 -0
  75. package/assets/esri/core/workers/chunks/6cd17c3a254a0b5c2476.js +1 -0
  76. package/assets/esri/core/workers/chunks/{06102715e9a8f218e07c.js → 6f3732e7ba2d031ba789.js} +1 -1
  77. package/assets/esri/core/workers/chunks/7191ab31fa040a7c561e.js +1 -0
  78. package/assets/esri/core/workers/chunks/71ba848c3352ea3ff96f.js +1 -0
  79. package/assets/esri/core/workers/chunks/76dc8e3264a456f33e61.js +1 -0
  80. package/assets/esri/core/workers/chunks/77d80b6d65d761214a7c.js +1 -0
  81. package/assets/esri/core/workers/chunks/{e2430bc3a1edeb5c3266.js → 78a69594c82d37aecbfb.js} +1 -1
  82. package/assets/esri/core/workers/chunks/{787c1a8bda7d745633f2.js → 81b9894e81cce3490984.js} +1 -1
  83. package/assets/esri/core/workers/chunks/85cd525705eec6803dd3.js +1 -0
  84. package/assets/esri/core/workers/chunks/863f04cacdc843d3f208.js +1 -0
  85. package/assets/esri/core/workers/chunks/8766832c7253557da8fe.js +1 -0
  86. package/assets/esri/core/workers/chunks/87992070008812f8ae6f.js +1 -0
  87. package/assets/esri/core/workers/chunks/892fd2c3533ce46a9258.js +1 -0
  88. package/assets/esri/core/workers/chunks/89b9d716d96135d4f057.js +1 -0
  89. package/assets/esri/core/workers/chunks/{4b2d392ad8e381bfd6b3.js → 89e9ebc8d5c1022cb265.js} +1 -1
  90. package/assets/esri/core/workers/chunks/8b38798ac6d774185238.js +1 -0
  91. package/assets/esri/core/workers/chunks/8b53369cace136ed1329.js +1 -0
  92. package/assets/esri/core/workers/chunks/8ba4f5e1912edf397947.js +1 -0
  93. package/assets/esri/core/workers/chunks/{987424121cf30b0f3c50.js → 8d3e92a3367a3ddc02bd.js} +1 -1
  94. package/assets/esri/core/workers/chunks/8e7a3b1b088c160f4db7.js +1 -0
  95. package/assets/esri/core/workers/chunks/8f4fba4d2339c91c8b3f.js +1 -0
  96. package/assets/esri/core/workers/chunks/{45aaefbdffe5e15dfb24.js → 919a6aedf38e9631ee09.js} +1 -1
  97. package/assets/esri/core/workers/chunks/{487c46d5245cfb35c4bb.js → 921917e53bac82693ec8.js} +1 -1
  98. package/assets/esri/core/workers/chunks/92809b209b68abcb97ee.js +1 -0
  99. package/assets/esri/core/workers/chunks/{beccbfff549902733c4e.js → 9869c696e6321c8db0a9.js} +1 -1
  100. package/assets/esri/core/workers/chunks/98957dba728c93506e50.js +1 -0
  101. package/assets/esri/core/workers/chunks/99ffb839407cb3c26ad8.js +1 -0
  102. package/assets/esri/core/workers/chunks/9b517c8d26a86dedb921.js +1 -0
  103. package/assets/esri/core/workers/chunks/{cb2329d1ea72ce5cc057.js → 9c3f56f22e9baa80a387.js} +1 -1
  104. package/assets/esri/core/workers/chunks/{1860104c2b33f68785dd.js → 9d0976f5979c4f9154dc.js} +1 -1
  105. package/assets/esri/core/workers/chunks/9fe1812aad6e566aea31.js +1 -0
  106. package/assets/esri/core/workers/chunks/a1602995ef96beb7df29.js +1 -0
  107. package/assets/esri/core/workers/chunks/{dff845574c0037a1dca6.js → a332e31165b65a6fb92e.js} +1 -1
  108. package/assets/esri/core/workers/chunks/a553478664a688f32488.js +1 -0
  109. package/assets/esri/core/workers/chunks/a7937b06f4b0860c7671.js +1 -0
  110. package/assets/esri/core/workers/chunks/{1980fd7ae1617ef4d19d.js → a95186214f1206efd8ed.js} +1 -1
  111. package/assets/esri/core/workers/chunks/{853563c66ecf58d53d36.js → ab60e8fbe0f92340616a.js} +1 -1
  112. package/assets/esri/core/workers/chunks/acea0946049136578354.js +1 -0
  113. package/assets/esri/core/workers/chunks/{342a97974a78007b25e0.js → ad94f54b4c88b3a047bc.js} +1 -1
  114. package/assets/esri/core/workers/chunks/ae29fec228e70a93ced1.js +1 -0
  115. package/assets/esri/core/workers/chunks/ae6dc159be974ca0e8da.js +1 -0
  116. package/assets/esri/core/workers/chunks/ae70972bf88d586fd453.js +1 -0
  117. package/assets/esri/core/workers/chunks/b021fa4654ede1d04279.js +1 -0
  118. package/assets/esri/core/workers/chunks/b03f32f02858244c6cd0.js +1 -0
  119. package/assets/esri/core/workers/chunks/b2d922ecc2c4899dbee1.js +1 -0
  120. package/assets/esri/core/workers/chunks/b42e50ec6b819f669400.js +1 -0
  121. package/assets/esri/core/workers/chunks/b6a82775b83d20599635.js +1 -0
  122. package/assets/esri/core/workers/chunks/b6d365b9198b74b05338.js +1 -0
  123. package/assets/esri/core/workers/chunks/{48c6230b8a6d3a8a7906.js → bc21241bc9acb83d1b1c.js} +1 -1
  124. package/assets/esri/core/workers/chunks/bd02d927b0b4991b61c5.js +1 -0
  125. package/assets/esri/core/workers/chunks/bdf1c4c038d556527483.js +1 -0
  126. package/assets/esri/core/workers/chunks/c1273f14a5ef3d81de0d.js +1 -0
  127. package/assets/esri/core/workers/chunks/c752f1e732bb019f657d.js +1 -0
  128. package/assets/esri/core/workers/chunks/{3f74c61359b4bd6dcf00.js → c7f49493bd548d5dc1e0.js} +1 -1
  129. package/assets/esri/core/workers/chunks/{36bafcc29ac133a05558.js → c86d3af148b28ded5875.js} +10 -10
  130. package/assets/esri/core/workers/chunks/{692f0093c444fcc752b5.js → cadd60fa4370284c7ae3.js} +1 -1
  131. package/assets/esri/core/workers/chunks/{d5e251cddd41d643510c.js → cb62326b6526cde429c1.js} +1 -1
  132. package/assets/esri/core/workers/chunks/cd8304b1db83d48c57db.js +1 -0
  133. package/assets/esri/core/workers/chunks/cdf0c7706d3e1221f49b.js +1 -0
  134. package/assets/esri/core/workers/chunks/d00dd961a5b79f563123.js +1 -0
  135. package/assets/esri/core/workers/chunks/d893c3bb093104d3db95.js +1 -0
  136. package/assets/esri/core/workers/chunks/d8fb1d9da16492574a11.js +1 -0
  137. package/assets/esri/core/workers/chunks/{520f499d79fa71f262c7.js → dd7e4c94a88452425750.js} +1 -1
  138. package/assets/esri/core/workers/chunks/ddb4689624d091922471.js +1 -0
  139. package/assets/esri/core/workers/chunks/df32a3fe81d60f0d7462.js +1 -0
  140. package/assets/esri/core/workers/chunks/dfc6b33f51dc81f3a7be.js +1 -0
  141. package/assets/esri/core/workers/chunks/e55934eb4a17a5b24c94.js +1 -0
  142. package/assets/esri/core/workers/chunks/{5473409fee59db80f87d.js → e5bdfef7c2cc5354be52.js} +1 -1
  143. package/assets/esri/core/workers/chunks/e8cdec961e9cff1cb73b.js +1 -0
  144. package/assets/esri/core/workers/chunks/{446d172834f8675f1202.js → eaf720dfdf6ceca31249.js} +1 -1
  145. package/assets/esri/core/workers/chunks/ef274db3fa260eadf371.js +1 -0
  146. package/assets/esri/core/workers/chunks/efca82a4dc494f57380b.js +1 -0
  147. package/assets/esri/core/workers/chunks/f05990e6fb378e2e1a3b.js +1 -0
  148. package/assets/esri/core/workers/chunks/f0fc89cdf50a40913c02.js +1 -0
  149. package/assets/esri/core/workers/chunks/{8b5dcc4282772bf6b675.js → f11eaab5354cc6aa9569.js} +1 -1
  150. package/assets/esri/core/workers/chunks/f1c2f7c7ce4bd4096eb0.js +1 -0
  151. package/assets/esri/core/workers/chunks/f4e63c5f82b8c2bbfacb.js +1 -0
  152. package/assets/esri/core/workers/chunks/f86ff791a10c802879ec.js +1 -0
  153. package/assets/esri/core/workers/chunks/{7452b5ae971a9ff2e6e9.js → fdffefd7de540272a8a6.js} +1 -1
  154. package/assets/esri/core/workers/chunks/fe0248af95d3f37e099e.js +1 -0
  155. package/chunks/languageUtils.js +1 -1
  156. package/config.js +1 -1
  157. package/core/Accessor.js +1 -1
  158. package/core/Collection.js +1 -1
  159. package/core/LRUCache.js +1 -1
  160. package/core/MapUtils.js +1 -1
  161. package/core/Version.js +1 -1
  162. package/core/asyncUtils.js +1 -1
  163. package/core/fontUtils.js +1 -1
  164. package/core/has.js +1 -1
  165. package/core/sql/SqlInterval.js +1 -1
  166. package/core/sql/WhereClause.js +1 -1
  167. package/core/sql/writeUtils.js +1 -1
  168. package/core/sql.js +1 -1
  169. package/core/urlUtils.js +1 -1
  170. package/editing/sharedTemplates/executor/builders/pointAtIntersectionVerticesOfLine.js +1 -1
  171. package/editing/sharedTemplates/executor/builders/polygonBoundary.js +1 -1
  172. package/editing/sharedTemplates/executor/builders/support/builderUtils.js +1 -1
  173. package/editing/sharedTemplates/executor/support/createFeatureServiceEdit.js +1 -1
  174. package/geometry/Point.js +1 -1
  175. package/geometry/Polygon.js +1 -1
  176. package/geometry/SpatialReference.js +1 -1
  177. package/geometry/support/webMercatorUtils.js +1 -1
  178. package/kernel.js +1 -1
  179. package/layers/FeatureLayer.js +1 -1
  180. package/layers/GeoJSONLayer.d.ts +5 -1
  181. package/layers/GeospatialPDFLayer.js +1 -1
  182. package/layers/KnowledgeGraphLayer.js +1 -1
  183. package/layers/LineOfSightLayer.d.ts +6 -1
  184. package/layers/LinkChartLayer.js +1 -1
  185. package/layers/Lyr3DWasmPerSceneView.js +1 -1
  186. package/layers/SubtypeGroupLayer.js +1 -1
  187. package/layers/TileLayer.js +1 -1
  188. package/layers/VectorTileLayer.d.ts +53 -0
  189. package/layers/VectorTileLayer.js +1 -1
  190. package/layers/VideoLayer.js +1 -1
  191. package/layers/ViewshedLayer.d.ts +6 -1
  192. package/layers/VoxelLayer.js +1 -1
  193. package/layers/effects/jsonUtils.js +1 -1
  194. package/layers/geospatialPDF/GeospatialPDFLayerWorker.js +1 -1
  195. package/layers/geospatialPDF/GeospatialPDFWorkerClient.js +1 -1
  196. package/layers/graphics/data/QueryEngineResult.js +1 -1
  197. package/layers/graphics/data/projectionSupport.js +1 -1
  198. package/layers/graphics/sources/connections/WebSocketConnection.js +1 -1
  199. package/layers/graphics/sources/geojson/GeoJSONSourceWorker.js +1 -1
  200. package/layers/graphics/sources/geojson/geojson.js +1 -1
  201. package/layers/graphics/sources/parquet/FileProvider.js +1 -1
  202. package/layers/graphics/sources/support/QueryTask.js +1 -1
  203. package/layers/graphics/sources/support/uploads.js +1 -1
  204. package/layers/knowledgeGraph/cypherUtils.js +1 -1
  205. package/layers/mixins/refresh.js +1 -1
  206. package/layers/ogc/ogcFeatureUtils.js +1 -1
  207. package/layers/ogc/wfsUtils.js +1 -1
  208. package/layers/parquet.js +1 -1
  209. package/layers/raster/datasets/BaseRaster.js +1 -1
  210. package/layers/raster/datasets/GeospatialPDFRaster.js +1 -1
  211. package/layers/raster/datasets/TIFFRaster.js +1 -1
  212. package/layers/raster/datasets/wcsCoverageParser.js +1 -1
  213. package/layers/raster/formats/Lerc.js +1 -1
  214. package/layers/support/ClientSideConnection.js +1 -1
  215. package/layers/support/ElevationSampler.js +1 -1
  216. package/layers/support/MultidimensionalSubset.js +1 -1
  217. package/layers/support/SpriteSource.js +1 -1
  218. package/layers/support/TileInfo.js +1 -1
  219. package/layers/support/fieldUtils.js +1 -1
  220. package/layers/support/infoFor3D.js +1 -1
  221. package/layers/support/vectorTileLayerLoader.js +1 -1
  222. package/layers/support/wmsUtils.js +1 -1
  223. package/layers/support/wmtsUtils.js +1 -1
  224. package/layers/video/videoUtils.js +1 -1
  225. package/libs/lyr3d/Lyr3DModule.js +1 -1
  226. package/linkChart/utils.js +1 -1
  227. package/networks/support/Circuit.js +1 -1
  228. package/networks/support/CircuitSection.js +1 -1
  229. package/package.json +2 -2
  230. package/portal/Portal.js +1 -1
  231. package/portal/PortalItemResource.js +1 -1
  232. package/portal/PortalQueryParams.js +1 -1
  233. package/renderers/HeatmapRenderer.js +1 -1
  234. package/renderers/UniqueValueRenderer.js +1 -1
  235. package/rest/knowledgeGraphService.js +1 -1
  236. package/rest/query/operations/pbfFeatureServiceParser.js +1 -1
  237. package/rest/query/operations/queryAttachments.js +1 -1
  238. package/symbols/cim/placements/PlacementInsidePolygon.js +1 -1
  239. package/symbols/cim/types.d.ts +15 -11
  240. package/symbols/support/previewSymbol3D.js +1 -1
  241. package/tables/support/templateUtils.js +1 -1
  242. package/views/2d/engine/vectorTiles/SourceLayerData.js +1 -1
  243. package/views/2d/engine/vectorTiles/SpriteMosaic.js +1 -1
  244. package/views/2d/engine/vectorTiles/TileHandler.js +1 -1
  245. package/views/2d/engine/vectorTiles/TileHandler3D.js +1 -1
  246. package/views/2d/engine/vectorTiles/TileManager.js +1 -1
  247. package/views/2d/engine/vectorTiles/TileParser.js +1 -1
  248. package/views/2d/engine/vectorTiles/VectorTileFeatureIndex.js +1 -1
  249. package/views/2d/engine/vectorTiles/VectorTileSourceData.js +2 -0
  250. package/views/2d/engine/vectorTiles/WorkerTile.js +1 -1
  251. package/views/2d/engine/vectorTiles/WorkerTileHandler.js +1 -1
  252. package/views/2d/engine/vectorTiles/buckets/SymbolBucket.js +1 -1
  253. package/views/2d/engine/vectorTiles/expression/expression.js +1 -1
  254. package/views/2d/engine/vectorTiles/style/Filter.js +1 -1
  255. package/views/2d/engine/vectorTiles/style/GeoJSONVectorTileSourceWorker.js +1 -1
  256. package/views/2d/engine/vectorTiles/style/StyleProperty.js +1 -1
  257. package/views/2d/engine/webgl/mesh/MeshData.js +1 -1
  258. package/views/2d/engine/webgl/mesh/factories/MeshWriterGroupCoordinator.js +1 -1
  259. package/views/2d/engine/webgl/shaderGraph/graph/ShaderGraphContext.js +4 -4
  260. package/views/2d/interactive/editingTools/draw/DrawGraphicTool2D.js +1 -1
  261. package/views/2d/layers/VectorTileLayerView2D.js +1 -1
  262. package/views/2d/layers/features/Processor.js +1 -1
  263. package/views/2d/layers/features/support/TileStore.js +1 -1
  264. package/views/2d/layers/graphics/GraphicsView2D.js +1 -1
  265. package/views/2d/tiling/TileKey.js +1 -1
  266. package/views/2d/tiling/TileStrategy.js +1 -1
  267. package/views/3d/analysis/Dimension/LengthDimensionComputation.js +1 -1
  268. package/views/3d/analysis/LineOfSight/LineOfSightManipulators.js +1 -1
  269. package/views/3d/analysis/ShadowCastAnalysisView3D.js +1 -1
  270. package/views/3d/analysis/images/generateTextures.js +1 -1
  271. package/views/3d/environment/EnvironmentView.js +1 -1
  272. package/views/3d/interactive/editingTools/draw/DrawGraphicTool3D.js +1 -1
  273. package/views/3d/interactive/editingTools/manipulations/MoveZManipulation.js +1 -1
  274. package/views/3d/interactive/visualElements/PointVisualElement.js +1 -1
  275. package/views/3d/layers/I3SMeshView3D.js +1 -1
  276. package/views/3d/layers/IntegratedMeshLayerView3D.js +1 -1
  277. package/views/3d/layers/VectorTileLayerView3D.js +1 -1
  278. package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
  279. package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
  280. package/views/3d/layers/graphics/Graphics3DFeatureProcessor.js +1 -1
  281. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  282. package/views/3d/layers/graphics/Graphics3DObjectSymbolLayer.js +1 -1
  283. package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.js +1 -1
  284. package/views/3d/layers/graphics/Graphics3DSymbol.js +1 -1
  285. package/views/3d/layers/graphics/Graphics3DSymbolCreationContext.js +1 -1
  286. package/views/3d/layers/graphics/Graphics3DWaterSymbolLayer.js +1 -1
  287. package/views/3d/layers/graphics/MeshFastUpdateProcessor.js +1 -1
  288. package/views/3d/layers/graphics/defaultSymbolComplexity.js +1 -1
  289. package/views/3d/layers/graphics/objectResourceUtils.js +1 -1
  290. package/views/3d/layers/graphics/polygonUtils.js +1 -1
  291. package/views/3d/layers/graphics/wosrLoader.js +1 -1
  292. package/views/3d/layers/i3s/I3SAsyncElevationUpdater.js +1 -1
  293. package/views/3d/layers/i3s/I3SClientNodeLoader.js +1 -1
  294. package/views/3d/layers/i3s/I3SQueryEngine.js +1 -1
  295. package/views/3d/layers/i3s/LayerElevationProvider.js +1 -1
  296. package/views/3d/layers/support/StageLayerElevationProvider.js +1 -1
  297. package/views/3d/state/ConstraintsManager.js +1 -1
  298. package/views/3d/state/controllers/GroundNavigationController.js +1 -1
  299. package/views/3d/support/QualityProfile.js +1 -1
  300. package/views/3d/support/TextureCollection.js +1 -1
  301. package/views/3d/terrain/PatchGeometryFactory.js +1 -1
  302. package/views/3d/terrain/TerrainRenderer.js +1 -1
  303. package/views/3d/terrain/Tile.js +1 -1
  304. package/views/3d/webgl-engine/collections/Component/ComponentObject.js +1 -1
  305. package/views/3d/webgl-engine/collections/Component/ComponentObjectCollection.js +1 -1
  306. package/views/3d/webgl-engine/core/shaderTechnique/ShaderTechnique.js +1 -1
  307. package/views/3d/webgl-engine/effects/laserlines/LaserLineRenderer.js +1 -1
  308. package/views/3d/webgl-engine/effects/laserlines/LaserlinePathTechniqueConfiguration.js +1 -1
  309. package/views/3d/webgl-engine/lib/BindParameters.js +1 -1
  310. package/views/3d/webgl-engine/lib/CutFill.js +1 -1
  311. package/views/3d/webgl-engine/lib/OrderIndependentTransparency.js +1 -1
  312. package/views/3d/webgl-engine/lib/TextureRepository.js +1 -1
  313. package/views/3d/webgl-engine/lib/TriangleIntersectionData.js +1 -1
  314. package/views/3d/webgl-engine/materials/ColorMaterial.js +1 -1
  315. package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
  316. package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
  317. package/views/3d/webgl-engine/materials/TriangleMaterial.js +1 -1
  318. package/views/3d/webgl-engine/materials/intersectWithPolygonOffset.js +1 -1
  319. package/views/3d/webgl-engine/shaders/DefaultMaterialTechnique.js +1 -1
  320. package/views/SceneView.js +1 -1
  321. package/views/SelectionManager.js +1 -1
  322. package/views/analysis/ElevationProfile/ElevationProfileChart.js +2 -2
  323. package/views/analysis/ElevationProfile/elevationProfileChartBoundsUtils.js +1 -1
  324. package/views/draw/DrawAction.js +1 -1
  325. package/views/draw/support/PluginContext.js +1 -1
  326. package/views/interactive/sketch/normalizedPoint.js +1 -1
  327. package/views/interactive/tooltip/fields/TooltipFieldElevation.js +1 -1
  328. package/views/interactive/tooltip/fields/TooltipFieldOrientation.js +1 -1
  329. package/views/interactive/tooltip/fields/TooltipFieldSize.js +1 -1
  330. package/widgets/AreaMeasurement2D/AreaMeasurement2DViewModel.js +1 -1
  331. package/widgets/Attachments.js +1 -1
  332. package/widgets/Attribution/AttributionViewModel.js +1 -1
  333. package/widgets/BasemapGallery/BasemapGalleryViewModel.js +1 -1
  334. package/widgets/BasemapLayerList/BasemapLayerListViewModel.js +1 -1
  335. package/widgets/BasemapToggle/BasemapToggleViewModel.js +1 -1
  336. package/widgets/BatchAttributeForm/ReactiveContingentValuesManager.js +1 -1
  337. package/widgets/BatchAttributeForm/inputs/AttachmentElementInput.js +1 -1
  338. package/widgets/BatchAttributeForm.js +1 -1
  339. package/widgets/Bookmarks/BookmarksViewModel.js +1 -1
  340. package/widgets/BuildingExplorer/BuildingExplorerViewModel.js +1 -1
  341. package/widgets/BuildingExplorer/BuildingNumericFilterViewModel.js +1 -1
  342. package/widgets/CatalogLayerList/CatalogLayerListViewModel.js +1 -1
  343. package/widgets/CatalogLayerList.js +1 -1
  344. package/widgets/Compass/CompassViewModel.js +1 -1
  345. package/widgets/CoordinateConversion/support/Format.js +1 -1
  346. package/widgets/CoordinateConversion/support/formatUtils.js +1 -1
  347. package/widgets/Daylight/DaylightViewModel.js +1 -1
  348. package/widgets/DistanceMeasurement2D/DistanceMeasurement2DViewModel.js +1 -1
  349. package/widgets/Editor/support/SketchController.js +1 -1
  350. package/widgets/ElevationProfile/ElevationProfileLine.js +1 -1
  351. package/widgets/ElevationProfile/ElevationProfileViewModel.js +1 -1
  352. package/widgets/Expand/ExpandViewModel.js +1 -1
  353. package/widgets/Expand.js +1 -1
  354. package/widgets/Feature/FeatureMedia.js +1 -1
  355. package/widgets/Feature/FeatureViewModel.js +1 -1
  356. package/widgets/Feature.js +1 -1
  357. package/widgets/FeatureForm.js +1 -1
  358. package/widgets/FeatureTemplates.js +1 -1
  359. package/widgets/Features/FeaturesViewModel.js +1 -1
  360. package/widgets/Features.js +1 -1
  361. package/widgets/FloorFilter/FloorFilterViewModel.js +1 -1
  362. package/widgets/Fullscreen/FullscreenViewModel.js +1 -1
  363. package/widgets/Histogram/HistogramViewModel.js +1 -1
  364. package/widgets/Histogram.js +1 -1
  365. package/widgets/HistogramRangeSlider/HistogramRangeSliderViewModel.js +1 -1
  366. package/widgets/Home/HomeViewModel.js +1 -1
  367. package/widgets/LayerList/LayerListViewModel.js +1 -1
  368. package/widgets/Legend/LegendViewModel.js +1 -1
  369. package/widgets/Legend/styles/card/CardView.js +1 -1
  370. package/widgets/Legend/styles/classic/ClassicView.js +1 -1
  371. package/widgets/Locate/LocateViewModel.js +1 -1
  372. package/widgets/Locate.js +1 -1
  373. package/widgets/NavigationToggle/NavigationToggleViewModel.js +1 -1
  374. package/widgets/NavigationToggle.js +1 -1
  375. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  376. package/widgets/OrientedImageryViewer/galleryUtils.js +1 -1
  377. package/widgets/OrientedImageryViewer/services/SuperimposeService.js +1 -1
  378. package/widgets/OrientedImageryViewer/support/urlUtils.js +1 -1
  379. package/widgets/ScaleRangeSlider/ScaleRangeSliderViewModel.js +1 -1
  380. package/widgets/Search.js +1 -1
  381. package/widgets/ShadowCast/DiscreteOptions.js +1 -1
  382. package/widgets/ShadowCast/DurationOptions.js +1 -1
  383. package/widgets/ShadowCast/ShadowCastViewModel.js +1 -1
  384. package/widgets/ShadowCast/ThresholdOptions.js +1 -1
  385. package/widgets/Sketch.js +1 -1
  386. package/widgets/Slider/SliderViewModel.js +1 -1
  387. package/widgets/Slider.js +1 -1
  388. package/widgets/TableList/TableListViewModel.js +1 -1
  389. package/widgets/TimeSlider/TimeSliderViewModel.js +1 -1
  390. package/widgets/Weather/WeatherViewModel.js +1 -1
  391. package/widgets/Widget.js +1 -1
  392. package/widgets/Zoom/ZoomViewModel.js +1 -1
  393. package/widgets/support/AnalysisViewModelMixin.js +1 -1
  394. package/widgets/support/GridControls.js +1 -1
  395. package/widgets/support/dateUtils.js +1 -1
  396. package/assets/esri/core/workers/chunks/00d43f02119167531d1b.js +0 -1
  397. package/assets/esri/core/workers/chunks/0696fa44a04b99738d7b.js +0 -1
  398. package/assets/esri/core/workers/chunks/091ec4fe83038f3558f4.js +0 -1
  399. package/assets/esri/core/workers/chunks/098ac10877d92fde1006.js +0 -1
  400. package/assets/esri/core/workers/chunks/0a29d87b6e58a3c6df8f.js +0 -1
  401. package/assets/esri/core/workers/chunks/0d04353843ccb7440342.js +0 -1
  402. package/assets/esri/core/workers/chunks/0d87cb6417672de95d53.js +0 -1
  403. package/assets/esri/core/workers/chunks/1132e28aaa5825b10b6e.js +0 -1
  404. package/assets/esri/core/workers/chunks/1380cec385426673f294.js +0 -1
  405. package/assets/esri/core/workers/chunks/1b24a40c0fa197014873.js +0 -1
  406. package/assets/esri/core/workers/chunks/1c7096eb48a3a7f27d4f.js +0 -1
  407. package/assets/esri/core/workers/chunks/1cc03067f8405285057c.js +0 -1
  408. package/assets/esri/core/workers/chunks/1f76f6dcdae9f55389cb.js +0 -1
  409. package/assets/esri/core/workers/chunks/21e1d423ee33f916547e.js +0 -1
  410. package/assets/esri/core/workers/chunks/247617c0dbae2386ab3b.js +0 -1
  411. package/assets/esri/core/workers/chunks/25657f70c5f04a4ed978.js +0 -1
  412. package/assets/esri/core/workers/chunks/2690d5fcd9d5ca92ebf6.js +0 -1
  413. package/assets/esri/core/workers/chunks/2853606099602f73d379.js +0 -1
  414. package/assets/esri/core/workers/chunks/28ed020d9995b6577be5.js +0 -1
  415. package/assets/esri/core/workers/chunks/2b27d3bc492e000bbe58.js +0 -1
  416. package/assets/esri/core/workers/chunks/2d64a13c2303e9cae613.js +0 -1
  417. package/assets/esri/core/workers/chunks/36e5f070009b29b7ac3d.js +0 -1
  418. package/assets/esri/core/workers/chunks/3b5e9e0b180dc10491ec.js +0 -1
  419. package/assets/esri/core/workers/chunks/46edd6c9ed6701e6b975.js +0 -1
  420. package/assets/esri/core/workers/chunks/4e17665dd9048c300d87.js +0 -1
  421. package/assets/esri/core/workers/chunks/4e4f747de424941a0bfa.js +0 -1
  422. package/assets/esri/core/workers/chunks/4e8e322b469657ac22e2.js +0 -1
  423. package/assets/esri/core/workers/chunks/5396b6e99a0546a25d19.js +0 -1
  424. package/assets/esri/core/workers/chunks/553a8bf5bc5c56d1bcaf.js +0 -1
  425. package/assets/esri/core/workers/chunks/55c0c074e4afe05f5d4d.js +0 -1
  426. package/assets/esri/core/workers/chunks/5bfb962ca192f90a2724.js +0 -1
  427. package/assets/esri/core/workers/chunks/60c8eedd06080edab3e3.js +0 -1
  428. package/assets/esri/core/workers/chunks/61d36730564c5ac5edab.js +0 -1
  429. package/assets/esri/core/workers/chunks/6588725275c75fae0d9c.js +0 -1
  430. package/assets/esri/core/workers/chunks/661c6324529dd17b297e.js +0 -1
  431. package/assets/esri/core/workers/chunks/6699fac01ccd842851ba.js +0 -1
  432. package/assets/esri/core/workers/chunks/672a5390182b20d632be.js +0 -1
  433. package/assets/esri/core/workers/chunks/67caef2ecf0dc5f2eed3.js +0 -1
  434. package/assets/esri/core/workers/chunks/68dd1fd2025c7125ead1.js +0 -1
  435. package/assets/esri/core/workers/chunks/68fd7b314377d27aaa54.js +0 -1
  436. package/assets/esri/core/workers/chunks/69627b2634da64dd885f.js +0 -1
  437. package/assets/esri/core/workers/chunks/6f2e7e663229b223b4df.js +0 -1
  438. package/assets/esri/core/workers/chunks/7390af96250e89194332.js +0 -1
  439. package/assets/esri/core/workers/chunks/7b45ac83e279fe9516a5.js +0 -1
  440. package/assets/esri/core/workers/chunks/7e0ed6e8f7b77e43f628.js +0 -1
  441. package/assets/esri/core/workers/chunks/832c887fdc5af4c08cf2.js +0 -1
  442. package/assets/esri/core/workers/chunks/84fb27e3425515cd0e3f.js +0 -1
  443. package/assets/esri/core/workers/chunks/8502274806ea52308822.js +0 -1
  444. package/assets/esri/core/workers/chunks/867502158997cb2d6406.js +0 -1
  445. package/assets/esri/core/workers/chunks/8ceb6697e8adbeffe019.js +0 -1
  446. package/assets/esri/core/workers/chunks/8e391b5b82429f39791e.js +0 -1
  447. package/assets/esri/core/workers/chunks/8e6276ddd8d094c61f08.js +0 -1
  448. package/assets/esri/core/workers/chunks/8fe22c2370219f25c15b.js +0 -1
  449. package/assets/esri/core/workers/chunks/90d797ab82d4a68ba32f.js +0 -1
  450. package/assets/esri/core/workers/chunks/91586bf29492735e692d.js +0 -1
  451. package/assets/esri/core/workers/chunks/96f87c8efd4b11b37686.js +0 -1
  452. package/assets/esri/core/workers/chunks/9826baa3c15ea2062669.js +0 -1
  453. package/assets/esri/core/workers/chunks/9c3de54513bf8619271c.js +0 -1
  454. package/assets/esri/core/workers/chunks/a125650edbed802e419a.js +0 -1
  455. package/assets/esri/core/workers/chunks/a18c3cbe505a19d29569.js +0 -1
  456. package/assets/esri/core/workers/chunks/a422a801e55fa125546e.js +0 -1
  457. package/assets/esri/core/workers/chunks/a5f17e9a025ac2b6e1bf.js +0 -1
  458. package/assets/esri/core/workers/chunks/a6e846361bf5dd3a11c7.js +0 -1
  459. package/assets/esri/core/workers/chunks/a91dc05a6a609d04ed04.js +0 -1
  460. package/assets/esri/core/workers/chunks/a99c50b4e1c7568210e1.js +0 -1
  461. package/assets/esri/core/workers/chunks/ab48faea5432e2dbd45c.js +0 -1
  462. package/assets/esri/core/workers/chunks/ac107079342251a984dd.js +0 -1
  463. package/assets/esri/core/workers/chunks/acf4737ba509cbd73cce.js +0 -1
  464. package/assets/esri/core/workers/chunks/b7205620ca248f4efc88.js +0 -1
  465. package/assets/esri/core/workers/chunks/bbddeb1c893ff8bbae5d.js +0 -1
  466. package/assets/esri/core/workers/chunks/bc2e2bdf1194e6e9eb5e.js +0 -1
  467. package/assets/esri/core/workers/chunks/c0eb27263f608dc3684b.js +0 -1
  468. package/assets/esri/core/workers/chunks/c3ba1a3247e14f6b7b3a.js +0 -1
  469. package/assets/esri/core/workers/chunks/c5d0a034ff31d5954571.js +0 -1
  470. package/assets/esri/core/workers/chunks/c8057b47c7c6c02a0bda.js +0 -1
  471. package/assets/esri/core/workers/chunks/ca21786e519c914fc9e1.js +0 -1
  472. package/assets/esri/core/workers/chunks/cd46d9b4a8de644e7332.js +0 -1
  473. package/assets/esri/core/workers/chunks/d4c8673ca65df874a7ce.js +0 -1
  474. package/assets/esri/core/workers/chunks/da1e6962ba0c85c37953.js +0 -1
  475. package/assets/esri/core/workers/chunks/dcdf837a452dc0cac582.js +0 -1
  476. package/assets/esri/core/workers/chunks/e0864ca82ffa3c9a0776.js +0 -1
  477. package/assets/esri/core/workers/chunks/e69cd62f824ce7a22fa0.js +0 -1
  478. package/assets/esri/core/workers/chunks/e9457a67befc61e11095.js +0 -1
  479. package/assets/esri/core/workers/chunks/f190a3124d6d03417d73.js +0 -1
  480. package/assets/esri/core/workers/chunks/f4135779bfdaf349352a.js +0 -1
  481. package/assets/esri/core/workers/chunks/f6bd7b52745b82ba73dc.js +0 -1
  482. package/assets/esri/core/workers/chunks/fbe3a3b9d6c8c0b52f65.js +0 -1
  483. package/assets/esri/core/workers/chunks/fc77eb7683e708774168.js +0 -1
  484. package/assets/esri/core/workers/chunks/fe7184993ef5713d13fb.js +0 -1
  485. package/assets/esri/core/workers/chunks/fecaf0bc28aeea4d15db.js +0 -1
  486. package/views/2d/engine/vectorTiles/style/VectorTilePbfWriter.js +0 -2
  487. package/views/2d/engine/vectorTiles/style/encodeVectorTileFeatures.js +0 -2
  488. package/views/2d/layers/features/support/FeatureSetReaderVectorTileFeatureCursor.js +0 -2
  489. /package/views/2d/engine/vectorTiles/{Feature.js → PbfFeature.js} +0 -0
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{throwIfAborted as e}from"../../../../core/promiseUtils.js";import{pt2px as t}from"../../../../core/screenUtils.js";import{identity as n,scale as r,translate as i,copy as a}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as o}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{length as s,negate as c,copy as l,multiply as u,add as d,set as f}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{fromArray as p,ONES as m,ZEROS as h,fromValues as g,create as _}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ZEROS as v,ONES as y,create as b}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{computeTranslationToOriginAndRotation as x}from"../../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{projectPointToVector as S}from"../../../../geometry/projection/projectPointToVector.js";import{create as C,size as w,containsPoint as T,center as E}from"../../../../geometry/support/aaBoundingBox.js";import{getEmissiveMode as ee}from"../../../../symbols/support/materialUtils.js";import{defaultObjectPrimitive as D}from"../../../../symbols/support/primitives.js";import{objectSymbolLayerPrimitiveBoundingBox as te,objectSymbolLayerSizeWithResourceSize as O}from"../../../../symbols/support/symbolLayerUtils3D.js";import{estimateNumVerticesForLods as ne,defaultSymbolLayerMemoryComplexity as re}from"./defaultSymbolComplexity.js";import{perLodInstanceElevationAligner as ie}from"./ElevationAligners.js";import{needsElevationUpdates3D as k,SampleElevationInfo as A,evaluateElevationInfoAtPoint as j}from"./elevationAlignmentUtils.js";import{preparePatchEmissiveStrength as M}from"./emissiveUtils.js";import{Graphics3DLodInstanceGraphicLayer as ae}from"./Graphics3DLodInstanceGraphicLayer.js";import{Graphics3DSymbolLayer as oe,nanFallbackColor as N}from"./Graphics3DSymbolLayer.js";import{validateSymbolLayerSize as P,computeObjectScale as F,computeObjectRotation as I}from"./graphicUtils.js";import{makeLodResources as se}from"./lodResourceUtils.js";import{fetch as ce}from"./objectResourceUtils.js";import{placePointOnGeometry as L,extendPointGraphicElevationContext as R}from"./pointUtils.js";import{isValidPrimitive as z,primitiveLodResources as B}from"./primitiveObjectSymbolUtils.js";import{SymbolComplexity as V}from"./SymbolComplexity.js";import{getResourceUrlFromSymbolStyle as H}from"./webStyleUtils.js";import{initFastSymbolUpdatesState as U,updateFastSymbolUpdatesState as W,ConvertOptions as le,evaluateModelTransformScale as ue,evaluateModelTransform as de}from"../support/FastSymbolUpdates.js";import{VerticalOffsetParameters as fe}from"../../webgl-engine/core/shaderLibrary/attributes/VerticalOffset.glsl.js";import{LodRenderer as pe}from"../../webgl-engine/lib/lodRendering/LodRenderer.js";import{DefaultMaterial as me}from"../../webgl-engine/materials/DefaultMaterial.js";import{schematicMRRFactors as he}from"../../webgl-engine/materials/pbrUtils.js";class G{constructor(e,t,n,r,i,a,o,s,c,l,u=null){this.lodResources=e,this.lodRenderer=t,this.stageResources=n,this.resourceSize=r,this.isEsriSymbolResource=i,this.isWosr=a,this.resourceBoundingBox=o,this.symbolSize=s,this.extentPadding=c,this.physicalBasedRenderingEnabled=l,this.pivotOffset=u}}class ge extends oe{getCachedSize(){let[e,t,n]=this._resources==null?[1,1,1]:this._resources.symbolSize;return{width:e,depth:t,height:n}}constructor(e,t,n,r){super(e,t,n,r,_e(t)),this._resources=null,this._instanceIndexToGraphicUid=new Map,this._hasLoadedPBRTextures=!1,this._disposeResourceHandles=[],this.skipHighSymbolLodsChanged=!1,this.ensureDrapedStatus(!1),this._hasLoadedPBRTextures=n.physicalBasedRenderingEnabled}async doLoad(e){if(!this._drivenProperties.size){let e=P(this.symbolLayer);if(e)throw Error(e)}if(this._isPrimitive){let t=this.symbolLayer.resource,n=t&&z(t?.primitive)?t.primitive:D;this._resources=await this._createResourcesForPrimitive(n,e)}else{let t=(await H(this.symbol.styleOrigin))?.href??this.symbolLayer.resource?.href;this._resources=await this._createResourcesForUrl(t,e)}this.layerOpacityChanged(),this.slicePlaneEnabledChanged(),this.physicalBasedRenderingChanged(),this.updateComplexity()}get extentPadding(){return this._resources==null?0:this._resources.extentPadding}get _isPrimitive(){return this._primitive!=null}get lodRenderer(){return this._resources?.lodRenderer}get materials(){return this._resources?.stageResources.materials??[]}async _createResourcesForPrimitive(t,n){let r=this.symbolLayer,i=C(te(t)),a=p(w(i)),o=p(O(a,r)),c=s(o),l=r.material?.emissive,u=(l?.source===`color`?l?.strength:void 0)??0,d={usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0,mrrFactors:he,ambient:m,diffuse:m,opacity:1,hasSlicePlane:this._context.slicePlaneEnabled,castShadows:r.castShadows,emissiveStrengthFromSymbol:u,emissiveSource:1,offsetTransparentBackfaces:!1,drivenOpacity:this.needsDrivenTransparentPass},f=!!d.usePBR,h=this.symbol;h.type===`point-3d`&&h.verticalOffset&&(d.verticalOffset=new fe(h.verticalOffset),d.castShadows=!1),this._context.screenSizePerspectiveEnabled&&(d.screenSizePerspective=this.view.screenSizePerspective.parameters),d.externalColor=this._hasDrivenColorOrOpacity?N:this._materialColor?.toUnitRGBA()??v,this._fastUpdates=U(this._context.renderer,this._fastVisualVariableConvertOptions(i,o,a,null)),d.instanced=!0,this._fastUpdates?(Object.assign(d,this._fastUpdates.materialParameters),d.instancedFeatureAttribute=!0):this._hasDrivenColorOrOpacity&&(d.instancedColor=!0);let g=new me(d,this._context);g.setParameters({cullFace:J(g.transparent)});let _=B(t,g);if(!_)throw Error(`Unknown object symbol primitive: ${t}`);let y=await this._createStageResources(_,f,n);e(n);let b=await this._createLodRenderer(_,n);return new G(_,b,y,a,!1,!1,i,o,c,f)}async _createResourcesForUrl(n,r){let i={instanced:!0,hasSlicePlane:this._context.slicePlaneEnabled,castShadows:this.symbolLayer.castShadows},a={spherical:this._context.spherical,materialParameters:i,cache:this._context.sharedResources.objectResourceCache,compressionOptions:{compressionTracker:this._context.compressionTracker,compressionCallback:()=>this.updateComplexity()}};this._fastUpdates=U(this._context.renderer,this._fastVisualVariableConvertOptions(null,null,null,null)),this._fastUpdates?(Object.assign(a.materialParameters,this._fastUpdates.materialParameters),a.materialParameters.instancedFeatureAttribute=!0):this._hasDrivenColorOrOpacity&&(a.materialParameters.instancedColor=!0);let o=this.symbol;if(o.type===`point-3d`&&o.verticalOffset){let{screenLength:e,minWorldLength:n,maxWorldLength:r}=o.verticalOffset;a.materialParameters.verticalOffset={screenLength:t(e),minWorldLength:n||0,maxWorldLength:r??1/0},a.materialParameters.castShadows=!1}let c=this._context.physicalBasedRenderingEnabled;a.signal=r,a.usePBR=c,a.useEmissive=this.view.stage.renderView.renderingContext.driverTest.floatBufferBlend.result,a.skipHighLods=this._context.skipHighSymbolLods;let l=this.symbolLayer.material;a.materialParameters.emissiveStrengthFromSymbol=l?.emissive?.strength??1,a.materialParameters.emissiveSource=ee(l?.emissive?.source??`emissive`);let u=await ce(n,a),d=u.isEsriSymbolResource,f=u.isWosr,m=se(u.lods),h=this._context,g=this._getExternalColorParameters(l),_=this.needsDrivenTransparentPass,v=m.getMaterials();v.forEach(e=>{e.setParameters({...g,drivenOpacity:_}),h.screenSizePerspectiveEnabled&&e.setParameters({screenSizePerspective:this.view.screenSizePerspective.parameters})});let y=u.referenceBoundingBox,b=p(w(y)),x=p(m.levels[0].pivotOffset),S=p(O(b,this.symbolLayer)),C=s(S),T=this._fastUpdates;W(T,this._context.renderer,this._fastVisualVariableConvertOptions(y,S,b,x))&&v.forEach(e=>e.setParameters(T.materialParameters));let E=await this._createStageResources(m,c,r);e(r);let D=await this._createLodRenderer(m,r);return new G(m,D,E,b,d,f,y,S,C,c,x)}_addDisposeResource(e){this._disposeResourceHandles.push(e)}async _createStageResources(t,n,r){let i=this._context.stage,a=t.getMaterials();n!==this._context.physicalBasedRenderingEnabled&&this.physicalBasedRenderingChanged();let o=t.getTextures();return i.addTextures(o),this._addDisposeResource(()=>{o.forEach(e=>e.unload()),i.removeTextures(o)}),await Promise.all(o.map(e=>this._context.stage.schedule(()=>e.load(i.renderView.renderingContext),r))),e(r),{materials:a,textures:o,geometries:t.getEngineGeometries()}}async _createLodRenderer(e,t){let n=this._context.stage,r={layerViewUid:this._context.layerViewUid,graphicUid:e=>this._instanceIndexToGraphicUid.get(e),notifyGraphicGeometryChanged:e=>this._context.notifyGraphicGeometryChanged(this._instanceIndexToGraphicUid.get(e)),notifyGraphicVisibilityChanged:e=>this._context.notifyGraphicVisibilityChanged(this._instanceIndexToGraphicUid.get(e))},i=this._fastUpdates,o=new pe({symbol:e,metadata:r,shaderTransformation:i?{applyTransform:(e,t,n)=>{e.getFeatureAttribute(t,Q),a(n,de(i.materialParameters,Q,n))},scaleFactor:(e,t,n)=>{t.getFeatureAttribute(n,Q),ue(e,i.materialParameters,Q)}}:null},this._context.scheduler);return o.slicePlaneEnabled=this._context.slicePlaneEnabled,this._addDisposeResource(()=>{n.removeRenderPlugin(o),o.destroy()}),await n.addRenderPlugin(o,t),o}_getExternalColorParameters(e){let t={};if(t.externalColor=N,!this._drivenProperties.color&&e?.color!=null){let n=e.color.toUnitRGBA();this._drivenProperties.opacity&&(n[3]=NaN),t.externalColor=n}return t}destroy(){super.destroy(),this._cleanupResources()}_cleanupResources(){this._disposeResourceHandles.forEach(e=>e()),this._disposeResourceHandles.length=0,this._resources=null}createGraphics3DGraphic(e){let t=e.graphic;if(!this._validateGeometry(t.geometry))return null;let n=L(t.geometry);if(n==null)return this.logger.warn(`unsupported geometry type for object symbol: ${t.geometry.type}`),null;let r=this.createElevationContextForGraphic(t),i=e.renderingInfo;return this._createAs3DShape(n,i,r,t.uid)}notifyDestroyGraphicLayer(e){this._instanceIndexToGraphicUid.delete(e.instanceIndex)}graphicLayerToGraphicId(){return 0}layerOpacityChanged(){if(this._resources==null)return;let e=this._getLayerOpacity(),t=this._resources.stageResources.materials;for(let n=0;n<t.length;n++){let r=t[n];r.setParameters({layerOpacity:e}),this._isPrimitive&&r.setParameters({cullFace:J(r.transparent)})}}layerScreenSizePerspectiveChanged(){if(this._resources==null)return;let e=this._context.screenSizePerspectiveEnabled?this.view.screenSizePerspective.parameters:null;for(let t of this._resources.stageResources.materials)t.setParameters({screenSizePerspective:e})}layerElevationInfoChanged(e,t){return this.updateGraphics3DGraphicElevationInfo(e,t,k)}slicePlaneEnabledChanged(){if(this._resources==null)return!0;this._resources.lodRenderer.slicePlaneEnabled=this._context.slicePlaneEnabled;for(let e of this._resources.stageResources.materials)e.setParameters({hasSlicePlane:this._context.slicePlaneEnabled});return!0}physicalBasedRenderingChanged(){if(this._resources==null)return!0;let{stageResources:e,isWosr:t}=this._resources;for(let n of e.materials)this._isPrimitive?n.setParameters({usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0}):t||n.setParameters({usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!1});return this._hasLoadedPBRTextures===!1&&this._context.physicalBasedRenderingEnabled===!0?(this._hasLoadedPBRTextures=!0,!1):!0}applyRendererDiff(e,t){if(this._resources==null)return 0;let{stageResources:{materials:n},lodRenderer:r,resourceBoundingBox:i,symbolSize:a,resourceSize:o,pivotOffset:s}=this._resources;for(let c in e.diff)switch(c){case`visualVariables`:if(W(this._fastUpdates,t,this._fastVisualVariableConvertOptions(i,a,o,s))){for(let e of n)e.setParameters(this._fastUpdates.materialParameters);r.notifyShaderTransformationChanged()}else return 0;break;default:return 0}return 2}computeComplexity(){if(this._resources==null)return super.computeComplexity();let e=this._resources.lodResources,t=ne(e.levels),n=e.computeUsedMemory(),r={...re(this.symbol,this.symbolLayer),resourceBytes:n};return new V({verticesPerFeature:t,memory:r})}_hasLodRenderer(){return this._resources!=null}_createAs3DShape(e,t,n,r){if(!this._hasLodRenderer()||this._resources==null)return null;let i=this.getFastUpdateAttrValues(t),a=this._context.clippingExtent;if(S(e,Y,this._context.elevationProvider.spatialReference),a!=null&&!T(a,Y))return null;let o=q(n),s=this._computeGlobalTransform(e,n,Z,$),c=this._computeLocalTransform(this._resources,this.symbolLayer,t,X),l=this._resources.lodRenderer.instanceData,u=l.addInstance();this._instanceIndexToGraphicUid.set(u,r),l.setLocalTransform(u,c,!1),l.setGlobalTransform(u,s),i&&l.setFeatureAttribute(u,i),this._fastUpdates==null&&this._hasDrivenColorOrOpacity&&l.setColor(u,this._getDrivenUInt8ColorWithNaNSupport(t,this._materialColor,!this._isPrimitive));let d=this._context.stage.renderView.olidRenderHelper;if(d){let e=d.getObjectAndLayerIdColor({graphicUid:r,layerViewUid:this._context.layerViewUid});l.setObjectAndLayerIdColor(u,e)}let f=new ae(this,u,ie,n,this._context.stage.view.state.highlightOrderMap);return o&&(f.alignedSampledElevation=$.sampledElevation),f.needsElevationUpdates=k(n.mode),R(f,e,this._context.elevationProvider),f}_computeGlobalTransform(e,t,n,r){return j(e,this._context.elevationProvider,t,this._context.renderCoordsHelper,r),Y[0]=e.x,Y[1]=e.y,Y[2]=r.z,x(e.spatialReference,Y,n,this._context.renderCoordsHelper.spatialReference),n}_computeLocalTransform(e,t,r,i){return n(i),this._applyObjectRotationVisualVariables(r,!1,i),this._applyObjectRotation(t,!0,i),this._applyObjectScale(e,r,i),this._applyAnchor(e,t,i),i}_applyObjectScale(e,t,n){if(this._fastUpdates?.requiresShaderTransformation)return;let i=this._drivenProperties.size&&t.size?t.size.output:e.symbolSize,a=F(i,e.symbolSize,e.resourceSize,this._context.renderCoordsHelper.unitInMeters);if(a[0]!==1||a[1]!==1||a[2]!==1)r(n,n,a);else return}prepareSymbolLayerPatch(e){if(e.diff.type!==`partial`)return;let t=e.diff.diff;this._preparePatchTransform(e,t),this._preparePatchColor(e,t),this._preparePatchEmissive(e,t)}updateGeometry(e,t){if(this._resources==null)return!0;let n=e.geometry;if(!n)return!1;let r=L(n);if(r==null)return!1;let i=this.getGeometryElevationMode(n),{elevationContext:a}=t;return a.mode===i&&(a.updateFeatureExpressionFeature(e,this._context.layer),this._computeGlobalTransform(r,a,Z,$),q(a)&&(t.alignedSampledElevation=$.sampledElevation),this._resources.lodRenderer.instanceData.setGlobalTransform(t.instanceIndex,Z,!0),R(t,r,this._context.elevationProvider),!0)}_preparePatchTransform(e,t){if(!t.heading&&!t.tilt&&!t.roll&&!t.width&&!t.height&&!t.depth&&!t.anchor&&!t.anchorPosition||this._resources==null)return;let n=(e,t,n)=>(e!=null&&e.type===`complete`?e.newValue:t)??n,r=n(t.heading,this.symbolLayer.heading,0),i=n(t.tilt,this.symbolLayer.tilt,0),a=n(t.roll,this.symbolLayer.roll,0),o=n(t.width,this.symbolLayer.width,void 0),s=n(t.height,this.symbolLayer.height,void 0),c=n(t.depth,this.symbolLayer.depth,void 0),l=n(t.anchor,this.symbolLayer.anchor,void 0),u=n(t.anchorPosition,this.symbolLayer.anchorPosition,void 0);delete t.heading,delete t.tilt,delete t.roll,delete t.width,delete t.height,delete t.depth,delete t.anchor,delete t.anchorPosition;let d={heading:r,tilt:i,roll:a,anchor:l,anchorPosition:u},f=this._resources;this.loadStatus===1&&e.symbolLayerStatePatches.push(()=>{f.symbolSize=p(O(f.resourceSize,{width:o,height:s,depth:c,isPrimitive:this._isPrimitive}))}),e.graphics3DGraphicPatches.push(({instanceIndex:e},t)=>{let n=this._computeLocalTransform(f,d,t,X);f.lodRenderer.instanceData.setLocalTransform(e,n,!0)})}_preparePatchColor(e,t){if(!t.material||t.material.type!==`partial`)return;let n=t.material.diff;if(!n.color||n.color.type!==`complete`||n.color.newValue==null||n.color.oldValue==null)return;let r=n.color.newValue,i=r==null?y:r.toUnitRGBA();delete n.color;let a=this._resources;if(a==null)return;let o=this._isPrimitive;e.graphics3DGraphicPatches.push(({instanceIndex:e})=>{if(this._hasDrivenColorOrOpacity)a.lodRenderer.instanceData.setColor(e,i);else{let e={externalColor:i};for(let t of a.stageResources.materials)t.setParameters(e),o&&t.setParameters({cullFace:J(t.transparent)})}})}_preparePatchEmissive(e,t){return M(e,t,e=>{this._resources?.stageResources.materials.forEach(t=>{if(!this._isPrimitive){t.setParameters({emissiveStrengthFromSymbol:e??1});return}let n=this.symbolLayer.material?.emissive?.source===`color`;t.setParameters({emissiveStrengthFromSymbol:n?e??0:0})})},this.view.stage.renderView.renderingContext.driverTest.floatBufferBlend.result)}_applyObjectRotationVisualVariables(e,t,n){this._fastUpdates?.requiresShaderTransformation&&t||I(e.heading?.output,e.tilt?.output,e.roll?.output,n)}_applyObjectRotation(e,t,n){this._fastUpdates?.requiresShaderTransformation&&t||I(e.heading,e.tilt,e.roll,n)}_applyAnchor(e,t,n){if(this._fastUpdates?.requiresShaderTransformation)return;let r=K(e.resourceBoundingBox,e.pivotOffset,t);r&&i(n,n,r)}_fastVisualVariableConvertOptions(e,t,n,r){let i=e==null?m:p(w(e)),a=e==null?h:K(e,r,this.symbolLayer),o=this._context.renderCoordsHelper.unitInMeters,s=F(t??void 0,t,n,o),c=g(this.symbolLayer.tilt||0,this.symbolLayer.roll||0,this.symbolLayer.heading||0);return new le({supports:{size:!0,color:!0,rotation:!0,opacity:!1},modelSize:i,symbolSize:t??m,unitInMeters:o,anchor:a,scale:s,rotation:c,fallbackColor:this._getFallbackOpacityAndColor(),fallbackSize:s})}get _primitive(){let{resource:e}=this.symbolLayer;return e?.href==null?e?.primitive??D:null}_getFallbackOpacityAndColor(){return this._materialColor?.toUnitRGBA()??(this._isPrimitive?v:N)}get _materialColor(){return this.symbolLayer.material?.color}}function K(e,t,n){let r=_();switch(n.anchor){case`center`:l(r,E(e)),c(r,r);break;case`top`:{let t=E(e);f(r,-t[0],-t[1],-e[5]);break}case`bottom`:{let t=E(e);f(r,-t[0],-t[1],-e[2]);break}case`relative`:{let t=E(e),i=w(e),a=n.anchorPosition,o=a?g(a.x,a.y,a.z):h;u(r,i,o),d(r,r,t),c(r,r);break}default:t==null?l(r,h):c(r,t)}return r}function q(e){return e.mode!==`absolute-height`}function _e(e){return(e.material?.color?.a??1)===1&&e.resource?.href==null}function J(e){return e?0:2}const Y=_(),X=o(),Z=o(),Q=b(),$=new A;export{ge as Graphics3DObjectSymbolLayer};
2
+ import{throwIfAborted as e}from"../../../../core/promiseUtils.js";import{pt2px as t}from"../../../../core/screenUtils.js";import{identity as n,scale as r,translate as i,copy as a}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as o}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{length as s,negate as c,copy as l,multiply as u,add as d,set as f}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{fromArray as p,ONES as m,ZEROS as h,fromValues as g,create as _}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ZEROS as v,ONES as y,create as b}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{computeTranslationToOriginAndRotation as x}from"../../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{projectPointToVector as S}from"../../../../geometry/projection/projectPointToVector.js";import{create as C,size as w,containsPoint as T,center as E}from"../../../../geometry/support/aaBoundingBox.js";import{getEmissiveMode as ee}from"../../../../symbols/support/materialUtils.js";import{defaultObjectPrimitive as D}from"../../../../symbols/support/primitives.js";import{objectSymbolLayerPrimitiveBoundingBox as te,objectSymbolLayerSizeWithResourceSize as O}from"../../../../symbols/support/symbolLayerUtils3D.js";import{estimateNumVerticesForLods as ne,defaultSymbolLayerMemoryComplexity as re}from"./defaultSymbolComplexity.js";import{perLodInstanceElevationAligner as ie}from"./ElevationAligners.js";import{needsElevationUpdates3D as k,SampleElevationInfo as A,evaluateElevationInfoAtPoint as j}from"./elevationAlignmentUtils.js";import{preparePatchEmissiveStrength as M}from"./emissiveUtils.js";import{Graphics3DLodInstanceGraphicLayer as ae}from"./Graphics3DLodInstanceGraphicLayer.js";import{Graphics3DSymbolLayer as oe,nanFallbackColor as N}from"./Graphics3DSymbolLayer.js";import{validateSymbolLayerSize as P,computeObjectScale as F,computeObjectRotation as I}from"./graphicUtils.js";import{makeLodResources as se}from"./lodResourceUtils.js";import{fetch as ce}from"./objectResourceUtils.js";import{placePointOnGeometry as L,extendPointGraphicElevationContext as R}from"./pointUtils.js";import{isValidPrimitive as z,primitiveLodResources as B}from"./primitiveObjectSymbolUtils.js";import{SymbolComplexity as V}from"./SymbolComplexity.js";import{getResourceUrlFromSymbolStyle as H}from"./webStyleUtils.js";import{initFastSymbolUpdatesState as U,updateFastSymbolUpdatesState as W,ConvertOptions as le,evaluateModelTransformScale as ue,evaluateModelTransform as de}from"../support/FastSymbolUpdates.js";import{VerticalOffsetParameters as fe}from"../../webgl-engine/core/shaderLibrary/attributes/VerticalOffset.glsl.js";import{LodRenderer as pe}from"../../webgl-engine/lib/lodRendering/LodRenderer.js";import{DefaultMaterial as me}from"../../webgl-engine/materials/DefaultMaterial.js";import{schematicMRRFactors as he}from"../../webgl-engine/materials/pbrUtils.js";class G{constructor(e,t,n,r,i,a,o,s,c,l,u=null){this.lodResources=e,this.lodRenderer=t,this.stageResources=n,this.resourceSize=r,this.isEsriSymbolResource=i,this.isWosr=a,this.resourceBoundingBox=o,this.symbolSize=s,this.extentPadding=c,this.physicalBasedRenderingEnabled=l,this.pivotOffset=u}}class ge extends oe{getCachedSize(){let[e,t,n]=this._resources==null?[1,1,1]:this._resources.symbolSize;return{width:e,depth:t,height:n}}constructor(e,t,n,r){super(e,t,n,r,_e(t)),this._resources=null,this._instanceIndexToGraphicUid=new Map,this._hasLoadedPBRTextures=!1,this._disposeResourceHandles=[],this.skipHighSymbolLodsChanged=!1,this.ensureDrapedStatus(!1),this._hasLoadedPBRTextures=n.physicalBasedRenderingEnabled}async doLoad(e){if(!this._drivenProperties.size){let e=P(this.symbolLayer);if(e)throw Error(e)}if(this._isPrimitive){let t=this.symbolLayer.resource,n=t&&z(t?.primitive)?t.primitive:D;this._resources=await this._createResourcesForPrimitive(n,e)}else{let t=(await H(this.symbol.styleOrigin))?.href??this.symbolLayer.resource?.href;this._resources=await this._createResourcesForUrl(t,e)}this.layerOpacityChanged(),this.slicePlaneEnabledChanged(),this.physicalBasedRenderingChanged(),this.updateComplexity()}get extentPadding(){return this._resources==null?0:this._resources.extentPadding}get _isPrimitive(){return this._primitive!=null}get lodRenderer(){return this._resources?.lodRenderer}get materials(){return this._resources?.stageResources.materials??[]}async _createResourcesForPrimitive(t,n){let r=this.symbolLayer,i=C(te(t)),a=p(w(i)),o=p(O(a,r)),c=s(o),l=r.material?.emissive,u=(l?.source===`color`?l?.strength:void 0)??0,d={usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0,mrrFactors:he,ambient:m,diffuse:m,opacity:1,hasSlicePlane:this._context.slicePlaneEnabled,castShadows:r.castShadows,emissiveStrengthFromSymbol:u,emissiveSource:1,offsetTransparentBackfaces:!1,drivenOpacity:this.needsDrivenTransparentPass},f=!!d.usePBR,h=this.symbol;h.type===`point-3d`&&h.verticalOffset&&(d.verticalOffset=new fe(h.verticalOffset),d.castShadows=!1),this._context.screenSizePerspectiveEnabled&&(d.screenSizePerspective=this.view.screenSizePerspective.parameters),d.externalColor=this._hasDrivenColorOrOpacity?N:this._materialColor?.toUnitRGBA()??v,this._fastUpdates=U(this._context.renderer,this._fastVisualVariableConvertOptions(i,o,a,null)),d.instanced=!0,this._fastUpdates?(Object.assign(d,this._fastUpdates.materialParameters),d.instancedFeatureAttribute=!0):this._hasDrivenColorOrOpacity&&(d.instancedColor=!0);let g=new me(d,this._context.spherical);g.setParameters({cullFace:J(g.transparent)});let _=B(t,g);if(!_)throw Error(`Unknown object symbol primitive: ${t}`);let y=await this._createStageResources(_,f,n);e(n);let b=await this._createLodRenderer(_,n);return new G(_,b,y,a,!1,!1,i,o,c,f)}async _createResourcesForUrl(n,r){let i={instanced:!0,hasSlicePlane:this._context.slicePlaneEnabled,castShadows:this.symbolLayer.castShadows},a={spherical:this._context.spherical,materialParameters:i,cache:this._context.sharedResources.objectResourceCache,compressionOptions:{compressionTracker:this._context.compressionTracker,compressionCallback:()=>this.updateComplexity()}};this._fastUpdates=U(this._context.renderer,this._fastVisualVariableConvertOptions(null,null,null,null)),this._fastUpdates?(Object.assign(a.materialParameters,this._fastUpdates.materialParameters),a.materialParameters.instancedFeatureAttribute=!0):this._hasDrivenColorOrOpacity&&(a.materialParameters.instancedColor=!0);let o=this.symbol;if(o.type===`point-3d`&&o.verticalOffset){let{screenLength:e,minWorldLength:n,maxWorldLength:r}=o.verticalOffset;a.materialParameters.verticalOffset={screenLength:t(e),minWorldLength:n||0,maxWorldLength:r??1/0},a.materialParameters.castShadows=!1}let c=this._context.physicalBasedRenderingEnabled;a.signal=r,a.usePBR=c,a.useEmissive=this.view.stage.renderView.renderingContext.driverTest.floatBufferBlend.result,a.skipHighLods=this._context.skipHighSymbolLods;let l=this.symbolLayer.material;a.materialParameters.emissiveStrengthFromSymbol=l?.emissive?.strength??1,a.materialParameters.emissiveSource=ee(l?.emissive?.source??`emissive`);let u=await ce(n,a),d=u.isEsriSymbolResource,f=u.isWosr,m=se(u.lods),h=this._context,g=this._getExternalColorParameters(l),_=this.needsDrivenTransparentPass,v=m.getMaterials();v.forEach(e=>{e.setParameters({...g,drivenOpacity:_}),h.screenSizePerspectiveEnabled&&e.setParameters({screenSizePerspective:this.view.screenSizePerspective.parameters})});let y=u.referenceBoundingBox,b=p(w(y)),x=p(m.levels[0].pivotOffset),S=p(O(b,this.symbolLayer)),C=s(S),T=this._fastUpdates;W(T,this._context.renderer,this._fastVisualVariableConvertOptions(y,S,b,x))&&v.forEach(e=>e.setParameters(T.materialParameters));let E=await this._createStageResources(m,c,r);e(r);let D=await this._createLodRenderer(m,r);return new G(m,D,E,b,d,f,y,S,C,c,x)}_addDisposeResource(e){this._disposeResourceHandles.push(e)}async _createStageResources(t,n,r){let i=this._context.stage,a=t.getMaterials();n!==this._context.physicalBasedRenderingEnabled&&this.physicalBasedRenderingChanged();let o=t.getTextures();return i.addTextures(o),this._addDisposeResource(()=>{o.forEach(e=>e.unload()),i.removeTextures(o)}),await Promise.all(o.map(e=>this._context.stage.schedule(()=>e.load(i.renderView.renderingContext),r))),e(r),{materials:a,textures:o,geometries:t.getEngineGeometries()}}async _createLodRenderer(e,t){let n=this._context.stage,r={layerViewUid:this._context.layerViewUid,graphicUid:e=>this._instanceIndexToGraphicUid.get(e),notifyGraphicGeometryChanged:e=>this._context.notifyGraphicGeometryChanged(this._instanceIndexToGraphicUid.get(e)),notifyGraphicVisibilityChanged:e=>this._context.notifyGraphicVisibilityChanged(this._instanceIndexToGraphicUid.get(e))},i=this._fastUpdates,o=new pe({symbol:e,metadata:r,shaderTransformation:i?{applyTransform:(e,t,n)=>{e.getFeatureAttribute(t,Q),a(n,de(i.materialParameters,Q,n))},scaleFactor:(e,t,n)=>{t.getFeatureAttribute(n,Q),ue(e,i.materialParameters,Q)}}:null},this._context.scheduler);return o.slicePlaneEnabled=this._context.slicePlaneEnabled,this._addDisposeResource(()=>{n.removeRenderPlugin(o),o.destroy()}),await n.addRenderPlugin(o,t),o}_getExternalColorParameters(e){let t={};if(t.externalColor=N,!this._drivenProperties.color&&e?.color!=null){let n=e.color.toUnitRGBA();this._drivenProperties.opacity&&(n[3]=NaN),t.externalColor=n}return t}destroy(){super.destroy(),this._cleanupResources()}_cleanupResources(){this._disposeResourceHandles.forEach(e=>e()),this._disposeResourceHandles.length=0,this._resources=null}createGraphics3DGraphic(e){let t=e.graphic;if(!this._validateGeometry(t.geometry))return null;let n=L(t.geometry);if(n==null)return this.logger.warn(`unsupported geometry type for object symbol: ${t.geometry.type}`),null;let r=this.createElevationContextForGraphic(t),i=e.renderingInfo;return this._createAs3DShape(n,i,r,t.uid)}notifyDestroyGraphicLayer(e){this._instanceIndexToGraphicUid.delete(e.instanceIndex)}graphicLayerToGraphicId(){return 0}layerOpacityChanged(){if(this._resources==null)return;let e=this._getLayerOpacity(),t=this._resources.stageResources.materials;for(let n=0;n<t.length;n++){let r=t[n];r.setParameters({layerOpacity:e}),this._isPrimitive&&r.setParameters({cullFace:J(r.transparent)})}}layerScreenSizePerspectiveChanged(){if(this._resources==null)return;let e=this._context.screenSizePerspectiveEnabled?this.view.screenSizePerspective.parameters:null;for(let t of this._resources.stageResources.materials)t.setParameters({screenSizePerspective:e})}layerElevationInfoChanged(e,t){return this.updateGraphics3DGraphicElevationInfo(e,t,k)}slicePlaneEnabledChanged(){if(this._resources==null)return!0;this._resources.lodRenderer.slicePlaneEnabled=this._context.slicePlaneEnabled;for(let e of this._resources.stageResources.materials)e.setParameters({hasSlicePlane:this._context.slicePlaneEnabled});return!0}physicalBasedRenderingChanged(){if(this._resources==null)return!0;let{stageResources:e,isWosr:t}=this._resources;for(let n of e.materials)this._isPrimitive?n.setParameters({usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0}):t||n.setParameters({usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!1});return this._hasLoadedPBRTextures===!1&&this._context.physicalBasedRenderingEnabled===!0?(this._hasLoadedPBRTextures=!0,!1):!0}applyRendererDiff(e,t){if(this._resources==null)return 0;let{stageResources:{materials:n},lodRenderer:r,resourceBoundingBox:i,symbolSize:a,resourceSize:o,pivotOffset:s}=this._resources;for(let c in e.diff)switch(c){case`visualVariables`:if(W(this._fastUpdates,t,this._fastVisualVariableConvertOptions(i,a,o,s))){for(let e of n)e.setParameters(this._fastUpdates.materialParameters);r.notifyShaderTransformationChanged()}else return 0;break;default:return 0}return 2}computeComplexity(){if(this._resources==null)return super.computeComplexity();let e=this._resources.lodResources,t=ne(e.levels),n=e.computeUsedMemory(),r={...re(this.symbol,this.symbolLayer),resourceBytes:n};return new V({verticesPerFeature:t,memory:r})}_hasLodRenderer(){return this._resources!=null}_createAs3DShape(e,t,n,r){if(!this._hasLodRenderer()||this._resources==null)return null;let i=this.getFastUpdateAttrValues(t),a=this._context.clippingExtent;if(S(e,Y,this._context.elevationProvider.spatialReference),a!=null&&!T(a,Y))return null;let o=q(n),s=this._computeGlobalTransform(e,n,Z,$),c=this._computeLocalTransform(this._resources,this.symbolLayer,t,X),l=this._resources.lodRenderer.instanceData,u=l.addInstance();this._instanceIndexToGraphicUid.set(u,r),l.setLocalTransform(u,c,!1),l.setGlobalTransform(u,s),i&&l.setFeatureAttribute(u,i),this._fastUpdates==null&&this._hasDrivenColorOrOpacity&&l.setColor(u,this._getDrivenUInt8ColorWithNaNSupport(t,this._materialColor,!this._isPrimitive));let d=this._context.stage.renderView.olidRenderHelper;if(d){let e=d.getObjectAndLayerIdColor({graphicUid:r,layerViewUid:this._context.layerViewUid});l.setObjectAndLayerIdColor(u,e)}let f=new ae(this,u,ie,n,this._context.stage.view.state.highlightOrderMap);return o&&(f.alignedSampledElevation=$.sampledElevation),f.needsElevationUpdates=k(n.mode),R(f,e,this._context.elevationProvider),f}_computeGlobalTransform(e,t,n,r){return j(e,this._context.elevationProvider,t,this._context.renderCoordsHelper,r),Y[0]=e.x,Y[1]=e.y,Y[2]=r.z,x(e.spatialReference,Y,n,this._context.renderCoordsHelper.spatialReference),n}_computeLocalTransform(e,t,r,i){return n(i),this._applyObjectRotationVisualVariables(r,!1,i),this._applyObjectRotation(t,!0,i),this._applyObjectScale(e,r,i),this._applyAnchor(e,t,i),i}_applyObjectScale(e,t,n){if(this._fastUpdates?.requiresShaderTransformation)return;let i=this._drivenProperties.size&&t.size?t.size.output:e.symbolSize,a=F(i,e.symbolSize,e.resourceSize,this._context.renderCoordsHelper.unitInMeters);if(a[0]!==1||a[1]!==1||a[2]!==1)r(n,n,a);else return}prepareSymbolLayerPatch(e){if(e.diff.type!==`partial`)return;let t=e.diff.diff;this._preparePatchTransform(e,t),this._preparePatchColor(e,t),this._preparePatchEmissive(e,t)}updateGeometry(e,t){if(this._resources==null)return!0;let n=e.geometry;if(!n)return!1;let r=L(n);if(r==null)return!1;let i=this.getGeometryElevationMode(n),{elevationContext:a}=t;return a.mode===i&&(a.updateFeatureExpressionFeature(e,this._context.layer),this._computeGlobalTransform(r,a,Z,$),q(a)&&(t.alignedSampledElevation=$.sampledElevation),this._resources.lodRenderer.instanceData.setGlobalTransform(t.instanceIndex,Z,!0),R(t,r,this._context.elevationProvider),!0)}_preparePatchTransform(e,t){if(!t.heading&&!t.tilt&&!t.roll&&!t.width&&!t.height&&!t.depth&&!t.anchor&&!t.anchorPosition||this._resources==null)return;let n=(e,t,n)=>(e!=null&&e.type===`complete`?e.newValue:t)??n,r=n(t.heading,this.symbolLayer.heading,0),i=n(t.tilt,this.symbolLayer.tilt,0),a=n(t.roll,this.symbolLayer.roll,0),o=n(t.width,this.symbolLayer.width,void 0),s=n(t.height,this.symbolLayer.height,void 0),c=n(t.depth,this.symbolLayer.depth,void 0),l=n(t.anchor,this.symbolLayer.anchor,void 0),u=n(t.anchorPosition,this.symbolLayer.anchorPosition,void 0);delete t.heading,delete t.tilt,delete t.roll,delete t.width,delete t.height,delete t.depth,delete t.anchor,delete t.anchorPosition;let d={heading:r,tilt:i,roll:a,anchor:l,anchorPosition:u},f=this._resources;this.loadStatus===1&&e.symbolLayerStatePatches.push(()=>{f.symbolSize=p(O(f.resourceSize,{width:o,height:s,depth:c,isPrimitive:this._isPrimitive}))}),e.graphics3DGraphicPatches.push(({instanceIndex:e},t)=>{let n=this._computeLocalTransform(f,d,t,X);f.lodRenderer.instanceData.setLocalTransform(e,n,!0)})}_preparePatchColor(e,t){if(!t.material||t.material.type!==`partial`)return;let n=t.material.diff;if(!n.color||n.color.type!==`complete`||n.color.newValue==null||n.color.oldValue==null)return;let r=n.color.newValue,i=r==null?y:r.toUnitRGBA();delete n.color;let a=this._resources;if(a==null)return;let o=this._isPrimitive;e.graphics3DGraphicPatches.push(({instanceIndex:e})=>{if(this._hasDrivenColorOrOpacity)a.lodRenderer.instanceData.setColor(e,i);else{let e={externalColor:i};for(let t of a.stageResources.materials)t.setParameters(e),o&&t.setParameters({cullFace:J(t.transparent)})}})}_preparePatchEmissive(e,t){return M(e,t,e=>{this._resources?.stageResources.materials.forEach(t=>{if(!this._isPrimitive){t.setParameters({emissiveStrengthFromSymbol:e??1});return}let n=this.symbolLayer.material?.emissive?.source===`color`;t.setParameters({emissiveStrengthFromSymbol:n?e??0:0})})},this.view.stage.renderView.renderingContext.driverTest.floatBufferBlend.result)}_applyObjectRotationVisualVariables(e,t,n){this._fastUpdates?.requiresShaderTransformation&&t||I(e.heading?.output,e.tilt?.output,e.roll?.output,n)}_applyObjectRotation(e,t,n){this._fastUpdates?.requiresShaderTransformation&&t||I(e.heading,e.tilt,e.roll,n)}_applyAnchor(e,t,n){if(this._fastUpdates?.requiresShaderTransformation)return;let r=K(e.resourceBoundingBox,e.pivotOffset,t);r&&i(n,n,r)}_fastVisualVariableConvertOptions(e,t,n,r){let i=e==null?m:p(w(e)),a=e==null?h:K(e,r,this.symbolLayer),o=this._context.renderCoordsHelper.unitInMeters,s=F(t??void 0,t,n,o),c=g(this.symbolLayer.tilt||0,this.symbolLayer.roll||0,this.symbolLayer.heading||0);return new le({supports:{size:!0,color:!0,rotation:!0,opacity:!1},modelSize:i,symbolSize:t??m,unitInMeters:o,anchor:a,scale:s,rotation:c,fallbackColor:this._getFallbackOpacityAndColor(),fallbackSize:s})}get _primitive(){let{resource:e}=this.symbolLayer;return e?.href==null?e?.primitive??D:null}_getFallbackOpacityAndColor(){return this._materialColor?.toUnitRGBA()??(this._isPrimitive?v:N)}get _materialColor(){return this.symbolLayer.material?.color}}function K(e,t,n){let r=_();switch(n.anchor){case`center`:l(r,E(e)),c(r,r);break;case`top`:{let t=E(e);f(r,-t[0],-t[1],-e[5]);break}case`bottom`:{let t=E(e);f(r,-t[0],-t[1],-e[2]);break}case`relative`:{let t=E(e),i=w(e),a=n.anchorPosition,o=a?g(a.x,a.y,a.z):h;u(r,i,o),d(r,r,t),c(r,r);break}default:t==null?l(r,h):c(r,t)}return r}function q(e){return e.mode!==`absolute-height`}function _e(e){return(e.material?.color?.a??1)===1&&e.resource?.href==null}function J(e){return e?0:2}const Y=_(),X=o(),Z=o(),Q=b(),$=new A;export{ge as Graphics3DObjectSymbolLayer};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{pt2px as e}from"../../../../core/screenUtils.js";import{ZEROS as t}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{fromBuffer as n,intersectsClippingArea as r,empty as i,expandWithAABB as a,create as o}from"../../../../geometry/support/aaBoundingBox.js";import{newDoubleArray as s,doubleSubArray as c}from"../../../../geometry/support/DoubleArray.js";import{newFloatArray as l}from"../../../../geometry/support/FloatArray.js";import{getContinuousIndexArray as u}from"../../../../geometry/support/Indices.js";import{isDrivenOpacityFallbackAlwaysOpaque as d}from"../../../../renderers/visualVariables/support/visualVariableUtils.js";import{elevationModeChangeUpdateType as f,needsElevationUpdates2D as p}from"./elevationAlignmentUtils.js";import{Graphics3DDrapedGraphicLayer as m}from"./Graphics3DDrapedGraphicLayer.js";import{Graphics3DObject3DGraphicLayer as h}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as g}from"./Graphics3DSymbolLayer.js";import{mixinColorAndOpacity as _}from"./graphicUtils.js";import{parseCapType as v,computeSymbolLayerIndex as y}from"./lineUtils.js";import{geometryAsPolygon as b,createColorGeometry as x,PolygonCreationDataBase as S}from"./polygonUtils.js";import{initFastSymbolUpdatesState as C,updateFastSymbolUpdatesState as w,getAttributeValue as T,ConvertOptions as E}from"../support/FastSymbolUpdates.js";import{createMaterial as D,uvElevationAligner as O}from"../support/patternUtils.js";import{writeMapSpaceUVCoordsPerConnectedPart as k,writeMapSpaceUVCoordsDraped as A}from"../support/uvUtils.js";import{createGeometry as j}from"../../support/engineContent/line.js";import{loadTessellationUtils as M,preloadedPolygonToRenderInfoElevationAligned as N,preloadedPolygonToRenderInfoDraped as P}from"../../support/renderInfoUtils/polygon.js";import{Object3D as F}from"../../webgl-engine/lib/Object3D.js";import{RenderGeometry as I}from"../../webgl-engine/lib/RenderGeometry.js";import{isScreenSizePerspectiveEnabled as L}from"../../webgl-engine/lib/screenSizePerspectiveUtils.js";import{getStipplePatternForLinePattern as R}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 V=[`polyline`,`polygon`,`extent`];class H extends g{static{this.elevationModeChangeTypes={definedChanged:2,staysOnTheGround:0,onTheGroundChanged:2}}constructor(e,t,n,r){super(e,t,n,r,d(t)),this._needsUV=!1,this._materials=[]}async doLoad(){this._fastUpdates=C(this._context.renderer,this._vvConvertOptions),await M()}get _materialColor(){return this.symbolLayer.material?.color}get _emissiveStrength(){let e=this.symbolLayer.material?.emissive;return(e?.source===`color`?e?.strength:void 0)??0}_createMaterials(){if(this._materials.length>0)return;let{_materialColor:t,draped:n}=this,r=this._getCombinedOpacityAndColor(t);this._materials[0]=D(this.symbolLayer,{color:r,forceTransparentMode:this.needsDrivenTransparentPass,hasVertexColors:this._drivenProperties.color||this._drivenProperties.opacity,draped:n,hasSlicePlane:this._context.slicePlaneEnabled,emissiveStrength:this._emissiveStrength,...this._fastUpdates?.materialParameters}),this._needsUV=this._materials[0]instanceof z;let i=this.symbolLayer.outline;if(K(i)){let t=R(i.pattern),n=v(i.pattern?i.patternCap||`butt`:`square`);this._materials[1]=new B({width:e(i.size),color:this._getOutlineColor(),polygonOffset:3,polygonOffsetIndex:y(this._renderPriority,this._renderPriorityStep),hasSlicePlane:this._context.slicePlaneEnabled,isClosed:!0,stipplePattern:t,cap:n,screenSizePerspective:this._outlineScreenSizePerspective},this.view)}}get _outlineScreenSizePerspective(){return!this.draped&&L(this._context.layer.screenSizePerspectiveEnabled)?this.view.screenSizePerspective.parameters:null}createGraphics3DGraphic(e){let t=e.graphic;if(!this._validateGeometry(t.geometry,V,this.symbolLayer.type))return null;let n=this._getDrivenUInt8Color(e.renderingInfo,this._materialColor,!1),r=this.createElevationContextForGraphic(t);return this.ensureDrapedStatus(r.mode===`on-the-ground`),this._createMaterials(),this.draped?this._createAsOverlay(e.renderingInfo,t,n):this._createAs3DShape(e.renderingInfo,t,n,r)}applyRendererDiff(e,t){for(let n in e.diff)switch(n){case`visualVariables`:if(w(this._fastUpdates,t,this._vvConvertOptions))this._materials[0]?.setParameters(this._fastUpdates.materialParameters);else return 0;break;default:return 0}return 2}layerOpacityChanged(){if(this._materials[0]!=null){let e=this._materials[0].parameters.color,t=this._materialColor,n=this._getCombinedOpacity(t);this._materials[0].setParameters({color:[e[0],e[1],e[2],n],forceTransparentMode:this.needsDrivenTransparentPass})}if(this._materials[1]!=null){let 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,n){let r=this._elevationContext.mode,i=f(H.elevationModeChangeTypes,n,r);if(i!==1)return i;let a=p(r);return this.updateGraphics3DGraphicElevationInfo(e,t,()=>a)}slicePlaneEnabledChanged(){if(this._materials[0]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),this._materials[1]){let e={hasSlicePlane:this._context.slicePlaneEnabled};this._materials[1].setParameters(e)}return!0}physicalBasedRenderingChanged(){return!0}_containsRenderableGeometry(e){return e.polygonIndexCount>0?!0:this._materials[1]==null?!1:e.outline.output===`vertex-data`?e.outline.outlines.length>0:e.outlineIndexCount>0}_createAs3DShape(e,t,n,r){let i=b(t.geometry);if(!i)return null;let a=N(i,this._context.elevationProvider,this._context.renderCoordsHelper,r,{projectIfNearlyVertical:!0,outlineOutput:`vertex-data`,owner:this._context.layer});if(a==null)return null;let o=new W(a,n,this._context.layerViewUid,t.uid),d=o.renderData.vertexCount;if(this._needsUV){o.uvMapSpace=l(d*4,!0),o.textureElementIndices=Array(d),o.boundingRect=s(9*(o.renderData.polygonIndices.length/3));let e=k(o.uvMapSpace,o.boundingRect,o.textureElementIndices,o.renderData.positions,o.renderData.polygonIndices,this._context.renderCoordsHelper);o.boundingRect=c(o.boundingRect,0,9*e),o.boundingRectIndices=u(e)}if(o.olidColor=this._context.stage.renderView?.getObjectAndLayerIdColor(o),this._createAs3DShapeFill(e,o),this._materials[1]&&this._createAs3DShapeOutline(o),this._logGeometryCreationWarnings(o.renderData,i.rings,`rings`,`FillSymbol3DLayer`),o.outGeometries.length===0)return null;let f=new F({geometries:o.outGeometries,castShadow:!1,layerViewUid:this._context.layerViewUid,graphicUid:t.uid}),m=new h(this,f,null,O,r);return m.alignedSampledElevation=o.renderData.sampledElevation,m.needsElevationUpdates=p(r.mode),m}_createAs3DShapeFill(e,t){let{mapPositions:i,positions:a,polygonIndices:o,polygonIndexCount:s}=t.renderData;if(s===0||this._context.clippingExtent!=null&&(n(i,U),!r(U,this._context.clippingExtent)))return;let c=this._fastUpdates?.visualVariables.color,l=x({material:this._materials[0],indices:o,mapPositions:i,attributeData:{position:a,color:c?null:t.color,colorFeature:c?T(c,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(l)}_createAs3DShapeOutline(e){if(this._materials[1]==null)return;let{outline:t}=e.renderData;if(t.output!==`vertex-data`)return;let{outlines:i}=t;if(i!=null&&i.length!==0)for(let{mapPositions:t,position:a}of i){if(this._context.clippingExtent!=null&&(n(t,U),!r(U,this._context.clippingExtent)))continue;let i=j(this._materials[1],{overlayInfo:null,removeDuplicateStartEnd:!0,mapPositions:t,attributeData:{position:a}},e.olidColor);e.outGeometries.push(i)}}_createAsOverlay(e,t,n){let r=b(t.geometry);if(r==null)return null;this._materials[0].renderPriority=this._renderPriority+this._renderPriorityStep/2,this._materials[1]!=null&&(this._materials[1].renderPriority=this._renderPriority);let a=P(r,{drapedSpatialReference:this._context.overlaySR,outlineOutput:`vertex-data`,owner:this._context.layer});if(a==null)return null;let o=new G(a,n,this._context.layerViewUid,t.uid);return this._needsUV&&(o.uvMapSpace=l(o.renderData.vertexCount*4,!0),A(o.uvMapSpace,o.renderData.positions,this._context.overlaySR,this._context.graphicsCoreOwner.view.state.viewingMode)),o.outBoundingBox=i(),o.olidColor=this._context.stage.renderView?.getObjectAndLayerIdColor(o),this._createAsOverlayFill(e,o),this._materials[1]&&this._createAsOverlayOutline(o),this._logGeometryCreationWarnings(o.renderData,r.rings,`rings`,`FillSymbol3DLayer`),new m(this,o.outGeometries,o.outBoundingBox,this._context.drapeSourceRenderer)}_createAsOverlayFill(e,t){let{positions:i,polygonIndices:o,polygonIndexCount:s}=t.renderData;if(s===0)return;let c=n(i,U);if(!r(c,this._context.clippingExtent))return;a(t.outBoundingBox,c);let l=this._fastUpdates?.visualVariables.color,u=x({material:this._materials[0],indices:o,attributeData:{position:i,color:l?null:t.color,colorFeature:l?T(l,e.color):null,uvMapSpace:this._needsUV?t.uvMapSpace:null,olidColor:t.olidColor}});t.outGeometries.push(new I(u,t))}_createAsOverlayOutline(e){if(this._materials[1]==null)return;let{outline:t}=e.renderData;if(t.output!==`vertex-data`)return;let{outlines:i}=t;for(let{position:t}of i){if(n(t,U),!r(U,this._context.clippingExtent))continue;a(e.outBoundingBox,U);let i=j(this._materials[1],{overlayInfo:{spatialReference:this._context.overlaySR,renderCoordsHelper:this._context.renderCoordsHelper},removeDuplicateStartEnd:!0,attributeData:{position:t}},e.olidColor);e.outGeometries.push(new I(i,e))}}_getOutlineOpacity(){let e=this.symbolLayer?.outline?.color;return(this.draped?1:this._getLayerOpacity())*(e==null?0:e.a)}_getOutlineColor(){let e=this.symbolLayer?.outline?.color,t=this._getOutlineOpacity();return _(e?.toUnitRGB(),t)}test(){return{...super.test(),createAsOverlay:(e,t,n)=>this._createAsOverlay(e,t,n),createAs3DShape:(e,t,n,r)=>this._createAs3DShape(e,t,n,r)}}get _vvConvertOptions(){return new E({supports:{size:!1,color:!0,rotation:!1,opacity:!1},fallbackColor:this._materialColor?.toUnitRGBA()??t})}}const U=o();class W extends S{constructor(e,t,n,r){super(e,n,r),this.color=t}}class G extends S{constructor(e,t,n,r){super(e,n,r),this.color=t}}function K(e){return e?.size!=null&&e.size>0&&e.color!=null&&(e.pattern==null||e.pattern.type!==`style`||e.pattern.style!==`none`)}export{H as Graphics3DPolygonFillSymbolLayer};
2
+ import{pt2px as e}from"../../../../core/screenUtils.js";import{ZEROS as t}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{fromBuffer as n,intersectsClippingArea as r,empty as i,expandWithAABB as a,create as o}from"../../../../geometry/support/aaBoundingBox.js";import{newDoubleArray as s,doubleSubArray as c}from"../../../../geometry/support/DoubleArray.js";import{newFloatArray as l}from"../../../../geometry/support/FloatArray.js";import{getContinuousIndexArray as u}from"../../../../geometry/support/Indices.js";import{isDrivenOpacityFallbackAlwaysOpaque as d}from"../../../../renderers/visualVariables/support/visualVariableUtils.js";import{elevationModeChangeUpdateType as f,needsElevationUpdates2D as p}from"./elevationAlignmentUtils.js";import{Graphics3DDrapedGraphicLayer as m}from"./Graphics3DDrapedGraphicLayer.js";import{Graphics3DObject3DGraphicLayer as h}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as g}from"./Graphics3DSymbolLayer.js";import{mixinColorAndOpacity as _}from"./graphicUtils.js";import{parseCapType as v,computeSymbolLayerIndex as y}from"./lineUtils.js";import{geometryAsPolygon as b,createColorGeometry as x,PolygonCreationDataBase as S}from"./polygonUtils.js";import{initFastSymbolUpdatesState as C,updateFastSymbolUpdatesState as w,getAttributeValue as T,ConvertOptions as E}from"../support/FastSymbolUpdates.js";import{createMaterial as D,uvElevationAligner as O}from"../support/patternUtils.js";import{writeMapSpaceUVCoordsPerConnectedPart as k,writeMapSpaceUVCoordsDraped as A}from"../support/uvUtils.js";import{createGeometry as j}from"../../support/engineContent/line.js";import{loadTessellationUtils as M,preloadedPolygonToRenderInfoElevationAligned as N,preloadedPolygonToRenderInfoDraped as P}from"../../support/renderInfoUtils/polygon.js";import{Object3D as F}from"../../webgl-engine/lib/Object3D.js";import{RenderGeometry as I}from"../../webgl-engine/lib/RenderGeometry.js";import{isScreenSizePerspectiveEnabled as L}from"../../webgl-engine/lib/screenSizePerspectiveUtils.js";import{getStipplePatternForLinePattern as R}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 V=[`polyline`,`polygon`,`extent`];class H extends g{static{this.elevationModeChangeTypes={definedChanged:2,staysOnTheGround:0,onTheGroundChanged:2}}constructor(e,t,n,r){super(e,t,n,r,d(t)),this._needsUV=!1,this._materials=[]}async doLoad(){this._fastUpdates=C(this._context.renderer,this._vvConvertOptions),await M()}get _materialColor(){return this.symbolLayer.material?.color}get _emissiveStrength(){let e=this.symbolLayer.material?.emissive;return(e?.source===`color`?e?.strength:void 0)??0}_createMaterials(){if(this._materials.length>0)return;let{_materialColor:t,draped:n}=this,r=this._getCombinedOpacityAndColor(t);this._materials[0]=D(this.symbolLayer,{color:r,forceTransparentMode:this.needsDrivenTransparentPass,hasVertexColors:this._drivenProperties.color||this._drivenProperties.opacity,draped:n,hasSlicePlane:this._context.slicePlaneEnabled,emissiveStrength:this._emissiveStrength,...this._fastUpdates?.materialParameters}),this._needsUV=this._materials[0]instanceof z;let i=this.symbolLayer.outline;if(K(i)){let t=R(i.pattern),n=v(i.pattern?i.patternCap||`butt`:`square`);this._materials[1]=new B({width:e(i.size),color:this._getOutlineColor(),polygonOffset:3,polygonOffsetIndex:y(this._renderPriority,this._renderPriorityStep),hasSlicePlane:this._context.slicePlaneEnabled,isClosed:!0,stipplePattern:t,cap:n,screenSizePerspective:this._outlineScreenSizePerspective},this.view)}}get _outlineScreenSizePerspective(){return!this.draped&&L(this._context.layer.screenSizePerspectiveEnabled)?this.view.screenSizePerspective.parameters:null}createGraphics3DGraphic(e){let t=e.graphic;if(!this._validateGeometry(t.geometry,V,this.symbolLayer.type))return null;let n=this._getDrivenUInt8Color(e.renderingInfo,this._materialColor,!1),r=this.createElevationContextForGraphic(t);return this.ensureDrapedStatus(r.mode===`on-the-ground`),this._createMaterials(),this.draped?this._createAsOverlay(e.renderingInfo,t,n):this._createAs3DShape(e.renderingInfo,t,n,r)}applyRendererDiff(e,t){for(let n in e.diff)switch(n){case`visualVariables`:if(w(this._fastUpdates,t,this._vvConvertOptions))this._materials[0]?.setParameters(this._fastUpdates.materialParameters);else return 0;break;default:return 0}return 2}layerOpacityChanged(){if(this._materials[0]!=null){let e=this._materials[0].parameters.color,t=this._materialColor,n=this._getCombinedOpacity(t);this._materials[0].setParameters({color:[e[0],e[1],e[2],n],forceTransparentMode:this.needsDrivenTransparentPass})}if(this._materials[1]!=null){let 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,n){let r=this._elevationContext.mode,i=f(H.elevationModeChangeTypes,n,r);if(i!==1)return i;let a=p(r);return this.updateGraphics3DGraphicElevationInfo(e,t,()=>a)}slicePlaneEnabledChanged(){if(this._materials[0]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),this._materials[1]){let e={hasSlicePlane:this._context.slicePlaneEnabled};this._materials[1].setParameters(e)}return!0}physicalBasedRenderingChanged(){return!0}_containsRenderableGeometry(e){return e.polygonIndexCount>0?!0:this._materials[1]==null?!1:e.outline.output===`vertex-data`?e.outline.outlines.length>0:e.outlineIndexCount>0}_createAs3DShape(e,t,n,r){let i=b(t.geometry);if(!i)return null;let a=N(i,this._context.elevationProvider,this._context.renderCoordsHelper,r,{projectIfNearlyVertical:!0,outlineOutput:`vertex-data`,owner:this._context.layer});if(a==null)return null;let o=new W(a,n,this._context.layerViewUid,t.uid),d=o.renderInfo.vertexCount;if(this._needsUV){o.uvMapSpace=l(d*4,!0),o.textureElementIndices=Array(d),o.boundingRect=s(9*(o.renderInfo.polygonIndices.length/3));let e=k(o.uvMapSpace,o.boundingRect,o.textureElementIndices,o.renderInfo.positions,o.renderInfo.polygonIndices,this._context.renderCoordsHelper);o.boundingRect=c(o.boundingRect,0,9*e),o.boundingRectIndices=u(e)}if(o.olidColor=this._context.stage.renderView?.getObjectAndLayerIdColor(o),this._createAs3DShapeFill(e,o),this._materials[1]&&this._createAs3DShapeOutline(o),this._logGeometryCreationWarnings(o.renderInfo,i.rings,`rings`,`FillSymbol3DLayer`),o.outGeometries.length===0)return null;let f=new F({geometries:o.outGeometries,castShadow:!1,layerViewUid:this._context.layerViewUid,graphicUid:t.uid}),m=new h(this,f,null,O,r);return m.alignedSampledElevation=o.renderInfo.sampledElevation,m.needsElevationUpdates=p(r.mode),m}_createAs3DShapeFill(e,t){let{mapPositions:i,positions:a,polygonIndices:o,polygonIndexCount:s}=t.renderInfo;if(s===0||this._context.clippingExtent!=null&&(n(i,U),!r(U,this._context.clippingExtent)))return;let c=this._fastUpdates?.visualVariables.color,l=x({material:this._materials[0],indices:o,mapPositions:i,attributeData:{position:a,color:c?null:t.color,colorFeature:c?T(c,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(l)}_createAs3DShapeOutline(e){if(this._materials[1]==null)return;let{outline:t}=e.renderInfo;if(t.output!==`vertex-data`)return;let{outlines:i}=t;if(i!=null&&i.length!==0)for(let{mapPositions:t,position:a}of i){if(this._context.clippingExtent!=null&&(n(t,U),!r(U,this._context.clippingExtent)))continue;let i=j(this._materials[1],{overlayInfo:null,removeDuplicateStartEnd:!0,mapPositions:t,attributeData:{position:a}},e.olidColor);e.outGeometries.push(i)}}_createAsOverlay(e,t,n){let r=b(t.geometry);if(r==null)return null;this._materials[0].renderPriority=this._renderPriority+this._renderPriorityStep/2,this._materials[1]!=null&&(this._materials[1].renderPriority=this._renderPriority);let a=P(r,{drapedSpatialReference:this._context.overlaySR,outlineOutput:`vertex-data`,owner:this._context.layer});if(a==null)return null;let o=new G(a,n,this._context.layerViewUid,t.uid);return this._needsUV&&(o.uvMapSpace=l(o.renderInfo.vertexCount*4,!0),A(o.uvMapSpace,o.renderInfo.positions,this._context.overlaySR,this._context.graphicsCoreOwner.view.state.viewingMode)),o.outBoundingBox=i(),o.olidColor=this._context.stage.renderView?.getObjectAndLayerIdColor(o),this._createAsOverlayFill(e,o),this._materials[1]&&this._createAsOverlayOutline(o),this._logGeometryCreationWarnings(o.renderInfo,r.rings,`rings`,`FillSymbol3DLayer`),new m(this,o.outGeometries,o.outBoundingBox,this._context.drapeSourceRenderer)}_createAsOverlayFill(e,t){let{positions:i,polygonIndices:o,polygonIndexCount:s}=t.renderInfo;if(s===0)return;let c=n(i,U);if(!r(c,this._context.clippingExtent))return;a(t.outBoundingBox,c);let l=this._fastUpdates?.visualVariables.color,u=x({material:this._materials[0],indices:o,attributeData:{position:i,color:l?null:t.color,colorFeature:l?T(l,e.color):null,uvMapSpace:this._needsUV?t.uvMapSpace:null,olidColor:t.olidColor}});t.outGeometries.push(new I(u,t))}_createAsOverlayOutline(e){if(this._materials[1]==null)return;let{outline:t}=e.renderInfo;if(t.output!==`vertex-data`)return;let{outlines:i}=t;for(let{position:t}of i){if(n(t,U),!r(U,this._context.clippingExtent))continue;a(e.outBoundingBox,U);let i=j(this._materials[1],{overlayInfo:{spatialReference:this._context.overlaySR,renderCoordsHelper:this._context.renderCoordsHelper},removeDuplicateStartEnd:!0,attributeData:{position:t}},e.olidColor);e.outGeometries.push(new I(i,e))}}_getOutlineOpacity(){let e=this.symbolLayer?.outline?.color;return(this.draped?1:this._getLayerOpacity())*(e==null?0:e.a)}_getOutlineColor(){let e=this.symbolLayer?.outline?.color,t=this._getOutlineOpacity();return _(e?.toUnitRGB(),t)}test(){return{...super.test(),createAsOverlay:(e,t,n)=>this._createAsOverlay(e,t,n),createAs3DShape:(e,t,n,r)=>this._createAs3DShape(e,t,n,r)}}get _vvConvertOptions(){return new E({supports:{size:!1,color:!0,rotation:!1,opacity:!1},fallbackColor:this._materialColor?.toUnitRGBA()??t})}}const U=o();class W extends S{constructor(e,t,n,r){super(e,n,r),this.color=t}}class G extends S{constructor(e,t,n,r){super(e,n,r),this.color=t}}function K(e){return e?.size!=null&&e.size>0&&e.color!=null&&(e.pattern==null||e.pattern.type!==`style`||e.pattern.style!==`none`)}export{H as Graphics3DPolygonFillSymbolLayer};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{isSome as e}from"../../../../core/arrayUtils.js";import{forEach as t}from"../../../../core/asyncUtils.js";import"../../../../core/has.js";import{onAbortOrThrow as n,throwIfAborted as r}from"../../../../core/promiseUtils.js";import{aggregateSymbolComplexity as i}from"./defaultSymbolComplexity.js";import{Graphics3DGraphic as a}from"./Graphics3DGraphic.js";import{Graphics3DSymbolLayerCreationContext as o}from"./Graphics3DSymbolCreationContext.js";import{Loadable as s}from"./Loadable.js";import{AggregateSymbolComplexity as c}from"./SymbolComplexity.js";import{getSymbolMemorySize as l}from"./symbolMemory.js";class u extends s{set symbol(e){this._symbol=e,e.symbolLayers.forEach((t,n)=>{let r=this.symbolLayers[n];r!=null&&(r.symbol=e,r.symbolLayer=t)})}get symbol(){return this._symbol}constructor(e,t,n){super(t.schedule),this._symbol=e,this._context=t,this._backgroundLayers=n,this._destroyed=!1,this.symbolLayers=[],this.referenced=0,this._extentPadding=0}async doLoad(e){let i=this._symbol.symbolLayers;this._extentPadding=0,this._backgroundLayers&&(i=this._backgroundLayers.concat(i));let a=i.length;for(;this.symbolLayers.length<i.length;)this.symbolLayers.push(null);this.symbolLayers.length=i.length;let o=[];if(!d){let{make:e}=await(f??=import(`./Graphics3DSymbolLayerFactory.js`).catch(e=>{throw f=null,e}));d=e}for(let t=0;t<a;t++){let r=i.at(t);if(r.enabled===!1)continue;p.renderPriority=1-(1+t)/a,p.renderPriorityStep=1/a,p.ignoreDrivers=r.ignoreDrivers;let s=d(this.symbol,r,this._context,p),c=n(e,()=>{this.symbolLayers[t]=null,s.destroy()});c&&o.push(c),this.symbolLayers[t]=s}if(await t(this.symbolLayers,async(e,t)=>{if(e!=null)try{await e.load(),this._extentPadding+=Math.max(this._extentPadding,e.extentPadding)}catch{this.symbolLayers[t]=null}}),o.forEach(e=>e.remove()),r(e),this.symbolLayers.length&&!this.symbolLayers.some(e=>!!e))throw Error()}getSymbolLayerSize(e){let t=this.symbolLayers[e];return t==null?null:t.getCachedSize()}get extentPadding(){return this._extentPadding}get symbologySnappingSupported(){return this.symbolLayers.some(e=>e?.queryForSnapping)}get needsUpdateFocus(){return this.symbolLayers.some(e=>e?.needsUpdateFocus===!0)}createGraphics3DGraphic(e,t){let{graphic:n}=e,r=this.symbolLayers.map(t=>t?.createGraphics3DGraphic(e)??null);return new a(n,t||this,r,e.reportGraphicSourceMemory)}get complexity(){let e=new c;return this.symbolLayers.forEach(t=>i(t?.complexity,e)),e}globalPropertyChanged(e,t){let n=this.symbolLayers.length;for(let r=0;r<n;r++){let n=this.symbolLayers[r];if(n!=null&&!n.globalPropertyChanged(e,t,e=>{let t=e.layers[r];return t?.type===`object3d`||t?.type===`buffer`?t:null}))return!1}return!0}applyRendererDiff(e,t){return this.loadStatus===1?this.symbolLayers.reduce((n,r)=>n!==0&&r!=null?Math.min(n,r.applyRendererDiff(e,t)):n,2):0}prepareSymbolPatch(e){if(this.loadStatus===2||e.diff.type!==`partial`)return;let t=e.diff.diff;if(!t.symbolLayers||t.symbolLayers.type!==`partial`)return;let n=t.symbolLayers.diff;this.symbolLayers.forEach((t,r)=>{if(t==null)return;let i=n[r];if(i){let n={diff:i,graphics3DGraphicPatches:[],symbolLayerStatePatches:[]};t.prepareSymbolLayerPatch(n),e.symbolStatePatches.push(...n.symbolLayerStatePatches),n.graphics3DGraphicPatches.length&&e.graphics3DGraphicPatches.push((e,t)=>{let i=e.layers[r];i!=null&&n.graphics3DGraphicPatches.forEach(e=>e(i,t))})}})}updateGeometry(e){return this._updateGeometryOrTransform(e,(t,n)=>t.updateGeometry?t.updateGeometry(e.graphic,n):!1)}updateMeshTransform(e,t,n,r,i){return this._updateGeometryOrTransform(e,(e,a)=>e.updateMeshTransform?e.updateMeshTransform(a,t,n,r,i):!1)}_updateGeometryOrTransform(e,t){for(let n=0;n<this.symbolLayers.length;n++){let r=this.symbolLayers[n];if(r==null)continue;let i=e.layers[n];if(!i||!t(r,i))return!1}return!0}onRemoveGraphic(e){for(let t=0;t<this.symbolLayers.length;t++){let n=this.symbolLayers[t];if(n==null)continue;let r=e.layers[t];r!=null&&n.onRemoveGraphic(r)}}getFastUpdateStatus(){let e=!1,t=!1;for(let n of this.symbolLayers)if(n!=null){if(n.loadStatus===0)return 3;n.isFastUpdatesEnabled()?t=!0:e=!0}return t?e?2:1:e?0:4}async queryForSnapping(t,n,i,a){let o=this.symbolLayers.filter(e).filter(e=>e.queryForSnapping!=null).map(e=>e.queryForSnapping(t,n,i,a)),s=await Promise.all(o);return r(a),s.flat()}destroy(){if(!this.destroyed){super.destroy();for(let e of this.symbolLayers)e?.destroy();this.symbolLayers.length=0,this._destroyed=!0}}get destroyed(){return this._destroyed}get usedMemory(){return l(this)}}let d=null,f=null;const p=new o;export{u as Graphics3DSymbol};
2
+ import{isSome as e}from"../../../../core/arrayUtils.js";import{forEach as t}from"../../../../core/asyncUtils.js";import n from"../../../../core/Error.js";import"../../../../core/has.js";import{onAbortOrThrow as r,throwIfAborted as i}from"../../../../core/promiseUtils.js";import{aggregateSymbolComplexity as a}from"./defaultSymbolComplexity.js";import{Graphics3DGraphic as o}from"./Graphics3DGraphic.js";import{Graphics3DSymbolLayerCreationContext as s}from"./Graphics3DSymbolCreationContext.js";import{Loadable as c}from"./Loadable.js";import{AggregateSymbolComplexity as l}from"./SymbolComplexity.js";import{getSymbolMemorySize as u}from"./symbolMemory.js";class d extends c{set symbol(e){this._symbol=e,e.symbolLayers.forEach((t,n)=>{let r=this.symbolLayers[n];r!=null&&(r.symbol=e,r.symbolLayer=t)})}get symbol(){return this._symbol}constructor(e,t,n){super(t.schedule),this._symbol=e,this._context=t,this._backgroundLayers=n,this._destroyed=!1,this.symbolLayers=[],this.referenced=0,this._extentPadding=0}async doLoad(e){let a=this._symbol.symbolLayers;this._extentPadding=0,this._backgroundLayers&&(a=this._backgroundLayers.concat(a));let o=a.length;for(;this.symbolLayers.length<a.length;)this.symbolLayers.push(null);this.symbolLayers.length=a.length;let s=[];if(!f){let{make:e}=await(p??=import(`./Graphics3DSymbolLayerFactory.js`).catch(e=>{throw p=null,e}));f=e}for(let t=0;t<o;t++){let n=a.at(t);if(n.enabled===!1)continue;m.renderPriority=1-(1+t)/o,m.renderPriorityStep=1/o,m.ignoreDrivers=n.ignoreDrivers;let i=f(this.symbol,n,this._context,m),c=r(e,()=>{this.symbolLayers[t]=null,i.destroy()});c&&s.push(c),this.symbolLayers[t]=i}let c;if(await t(this.symbolLayers,async(e,t)=>{if(e!=null)try{await e.load(),this._extentPadding+=Math.max(this._extentPadding,e.extentPadding)}catch(e){this.symbolLayers[t]=null,c??=e}}),s.forEach(e=>e.remove()),i(e),this.symbolLayers.length&&!this.symbolLayers.some(e=>!!e))throw c??new n(`graphics3dsymbol:load`,`No symbollayers loaded`)}getSymbolLayerSize(e){let t=this.symbolLayers[e];return t==null?null:t.getCachedSize()}get extentPadding(){return this._extentPadding}get symbologySnappingSupported(){return this.symbolLayers.some(e=>e?.queryForSnapping)}get needsUpdateFocus(){return this.symbolLayers.some(e=>e?.needsUpdateFocus===!0)}createGraphics3DGraphic(e,t){let{graphic:n}=e,r=this.symbolLayers.map(t=>t?.createGraphics3DGraphic(e)??null);return new o(n,t||this,r,e.reportGraphicSourceMemory)}get complexity(){let e=new l;return this.symbolLayers.forEach(t=>a(t?.complexity,e)),e}globalPropertyChanged(e,t){let n=this.symbolLayers.length;for(let r=0;r<n;r++){let n=this.symbolLayers[r];if(n!=null&&!n.globalPropertyChanged(e,t,e=>{let t=e.layers[r];return t?.type===`object3d`||t?.type===`buffer`?t:null}))return!1}return!0}applyRendererDiff(e,t){return this.loadStatus===1?this.symbolLayers.reduce((n,r)=>n!==0&&r!=null?Math.min(n,r.applyRendererDiff(e,t)):n,2):0}prepareSymbolPatch(e){if(this.loadStatus===2||e.diff.type!==`partial`)return;let t=e.diff.diff;if(!t.symbolLayers||t.symbolLayers.type!==`partial`)return;let n=t.symbolLayers.diff;this.symbolLayers.forEach((t,r)=>{if(t==null)return;let i=n[r];if(i){let n={diff:i,graphics3DGraphicPatches:[],symbolLayerStatePatches:[]};t.prepareSymbolLayerPatch(n),e.symbolStatePatches.push(...n.symbolLayerStatePatches),n.graphics3DGraphicPatches.length&&e.graphics3DGraphicPatches.push((e,t)=>{let i=e.layers[r];i!=null&&n.graphics3DGraphicPatches.forEach(e=>e(i,t))})}})}updateGeometry(e){return this._updateGeometryOrTransform(e,(t,n)=>t.updateGeometry?t.updateGeometry(e.graphic,n):!1)}updateMeshTransform(e,t,n,r,i){return this._updateGeometryOrTransform(e,(e,a)=>e.updateMeshTransform?e.updateMeshTransform(a,t,n,r,i):!1)}_updateGeometryOrTransform(e,t){for(let n=0;n<this.symbolLayers.length;n++){let r=this.symbolLayers[n];if(r==null)continue;let i=e.layers[n];if(!i||!t(r,i))return!1}return!0}onRemoveGraphic(e){for(let t=0;t<this.symbolLayers.length;t++){let n=this.symbolLayers[t];if(n==null)continue;let r=e.layers[t];r!=null&&n.onRemoveGraphic(r)}}getFastUpdateStatus(){let e=!1,t=!1;for(let n of this.symbolLayers)if(n!=null){if(n.loadStatus===0)return 3;n.isFastUpdatesEnabled()?t=!0:e=!0}return t?e?2:1:e?0:4}async queryForSnapping(t,n,r,a){let o=this.symbolLayers.filter(e).filter(e=>e.queryForSnapping!=null).map(e=>e.queryForSnapping(t,n,r,a)),s=await Promise.all(o);return i(a),s.flat()}destroy(){if(!this.destroyed){super.destroy();for(let e of this.symbolLayers)e?.destroy();this.symbolLayers.length=0,this._destroyed=!0}}get destroyed(){return this._destroyed}get usedMemory(){return u(this)}}let f=null,p=null;const m=new s;export{d as Graphics3DSymbol};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- class e{constructor(e,t,n,r){this.scheduler=e,this.schedule=t,this.layerViewUid=n,this.compressionTracker=r,this.sharedResources=null,this.elevationProvider=null,this.renderer=null,this.stage=null,this.clippingExtent=null,this.renderCoordsHelper=null,this.overlaySR=null,this.layer=null,this.drapeSourceRenderer=null,this.graphicsCoreOwner=null,this.localOriginFactory=null,this.featureExpressionInfoContext=null,this.focusAreaStyle=null,this.screenSizePerspectiveEnabled=!0,this.slicePlaneEnabled=!1,this.physicalBasedRenderingEnabled=!1,this.skipHighSymbolLods=!1,this.isAsync=!1}get spherical(){return this.stage.view.state.viewingMode===1}}class t{constructor(){this.renderPriority=0,this.renderPriorityStep=1,this.ignoreDrivers=!1}}export{e as Graphics3DSymbolCreationContext,t as Graphics3DSymbolLayerCreationContext};
2
+ class e{constructor(e,t,n,r){this.scheduler=e,this.schedule=t,this.layerViewUid=n,this.compressionTracker=r,this.sharedResources=null,this.elevationProvider=null,this.renderer=null,this.stage=null,this.clippingExtent=null,this.renderCoordsHelper=null,this.overlaySR=null,this.layer=null,this.drapeSourceRenderer=null,this.graphicsCoreOwner=null,this.localOriginFactory=null,this.featureExpressionInfoContext=null,this.focusAreaStyle=null,this.screenSizePerspectiveEnabled=!0,this.slicePlaneEnabled=!1,this.physicalBasedRenderingEnabled=!1,this.skipHighSymbolLods=!1,this.isAsync=!1}get spherical(){return this.stage.view.state.isGlobal}}class t{constructor(){this.renderPriority=0,this.renderPriorityStep=1,this.ignoreDrivers=!1}}export{e as Graphics3DSymbolCreationContext,t as Graphics3DSymbolLayerCreationContext};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{getMetersPerUnitForSR as e}from"../../../../core/units.js";import{fromValues as t,create as n}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{scale as i}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{toRadian as a}from"../../../../core/libs/gl-matrix-2/math/common.js";import{fromBuffer as o,intersectsClippingArea as s,empty as c,expandWithAABB as l,create as u,center as d}from"../../../../geometry/support/aaBoundingBox.js";import{empty as f,expandXYInPlace as p,create as m}from"../../../../geometry/support/aaBoundingRect.js";import{BufferViewVec3f as h,BufferViewVec2f as g,BufferViewVec4u8 as _}from"../../../../geometry/support/buffer/BufferView.js";import{perBufferVertexElevationAligner as v}from"./ElevationAligners.js";import{elevationModeChangeUpdateType as y,needsElevationUpdates2D as b}from"./elevationAlignmentUtils.js";import{Graphics3DBufferGraphicLayer as x}from"./Graphics3DBufferGraphicLayer.js";import{Graphics3DDrapedBufferGraphicLayer as S}from"./Graphics3DDrapedBufferGraphicLayer.js";import{Graphics3DSymbolLayer as C}from"./Graphics3DSymbolLayer.js";import{geometryAsPolygon as w,PolygonCreationDataBase as T}from"./polygonUtils.js";import{loadTessellationUtils as E,preloadedPolygonToRenderInfoElevationAligned as D,preloadedPolygonToRenderInfoDraped as O}from"../../support/renderInfoUtils/polygon.js";import{BufferGeometry as k}from"../../webgl-engine/lib/BufferGeometry.js";import{BufferObject3D as A}from"../../webgl-engine/lib/BufferObject3D.js";import{Buffers as j}from"../../webgl-engine/lib/Buffers.js";import{Parameters as M,WaterMaterial as N,getWaterLayout as P}from"../../webgl-engine/materials/WaterMaterial.js";import{wavePresets as F}from"../../webgl-engine/materials/internal/waterMaterialUtils.js";const I=[`polyline`,`polygon`,`extent`];class L extends C{static{this.elevationModeChangeTypes={definedChanged:2,staysOnTheGround:0,onTheGroundChanged:2}}constructor(e,t,n,r){super(e,t,n,r)}async doLoad(){await E()}createGraphics3DGraphic(e){let t=e.graphic;if(!this._validateGeometry(t.geometry,I,this.symbolLayer.type))return null;let n=this.createElevationContextForGraphic(t);return this.ensureDrapedStatus(n.mode===`on-the-ground`),this.ensureMaterial(),this.draped?this._createAsOverlay(t):this._createAs3DShape(t,n,t.uid)}ensureMaterial(){if(this._materials[0])return;let e=new M,n=this.symbolLayer.color.toUnitRGBA();n[3]*=this._getLayerOpacity(),e.color=n,e.transparent=n[3]<1||this.needsDrivenTransparentPass,e.waveDirection=this.symbolLayer.waveDirection==null?t(0,0):R(this.symbolLayer.waveDirection);let r=this.symbolLayer.waveStrength+`-`+this.symbolLayer.waterbodySize,i=F[r];e.waveStrength=i.waveStrength,e.waveTextureRepeat=i.textureRepeat,e.waveVelocity=i.waveVelocity,e.flowStrength=i.perturbationStrength,e.hasSlicePlane=this._context.slicePlaneEnabled,e.draped=this.draped,e.useIndexing=!0,this._materials[0]=new N(e,this._context)}layerOpacityChanged(){if(this._materials[0]==null)return;let e=this._materials[0].parameters.color,t=this.symbolLayer.color.a*this._getLayerOpacity(),n=t<1||this.needsDrivenTransparentPass;this._materials[0].setParameters({color:[e[0],e[1],e[2],t],transparent:n})}layerScreenSizePerspectiveChanged(){}layerElevationInfoChanged(e,t,n){let r=this._elevationContext.mode,i=y(L.elevationModeChangeTypes,n,r);if(i!==1)return i;let a=b(r);return this.updateGraphics3DGraphicElevationInfo(e,t,()=>a)}slicePlaneEnabledChanged(){return this._materials[0]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),!0}physicalBasedRenderingChanged(){return!0}get needsDrivenTransparentPass(){return!1}_createAs3DShape(e,t,n){let r=w(e.geometry);if(r==null)return null;let i=D(r,this._context.elevationProvider,this._context.renderCoordsHelper,t,{owner:this._context.layer});if(i==null)return null;let a=new W(i,this._context.layerViewUid,e.uid);if(a.olidColor=this._context.stage.renderView?.getObjectAndLayerIdColor(a),this._create3DShapeGeometries(a),this._logGeometryCreationWarnings(a.renderData,r.rings,`rings`,`WaterSymbol3DLayer`),a.outGeometries.length===0)return null;let o=new A({geometries:a.outGeometries,castShadow:!1,layerViewUid:this._context.layerViewUid,graphicUid:n}),s=new x(this,o,null,v,t);return s.alignedSampledElevation=a.renderData.sampledElevation,s.needsElevationUpdates=b(t.mode),s}_create3DShapeGeometries(e){let{mapPositions:t}=e.renderData;if(e.renderData.polygonIndexCount===0||this._context.clippingExtent!=null&&(o(t,V),!s(V,this._context.clippingExtent)))return;let n=z(e.renderData,this._materials[0],this._context.localOriginFactory,this._context.elevationProvider.spatialReference,e.olidColor,e.layerViewUid,e.graphicUid);e.outGeometries.push(n)}_createAsOverlay(e){let t=w(e.geometry);if(t==null)return null;this._materials[0].renderPriority=this._renderPriority;let n=O(t,{drapedSpatialReference:this._context.overlaySR,owner:this._context.layer});if(n==null)return null;let r=new G(n,this._context.layerViewUid,e.uid);return r.olidColor=this._context.stage.renderView?.getObjectAndLayerIdColor(r),r.outBoundingBox=c(),this._createAsOverlayWater(r),this._logGeometryCreationWarnings(r.renderData,t.rings,`rings`,`WaterSymbol3DLayer`),r.outGeometries.length===0?null:new S(this,r.outGeometries,r.outBoundingBox,this._context.drapeSourceRenderer)}_createAsOverlayWater(e){let{positions:t}=e.renderData;if(o(t,V),!s(V,this._context.clippingExtent)||(l(e.outBoundingBox,V),e.renderData.polygonIndexCount===0))return;let n=z(e.renderData,this._materials[0],this._context.drapeSourceRenderer.rendererContext.localOriginFactory,this._context.overlaySR,e.olidColor,e.layerViewUid,e.graphicUid);e.outGeometries.push(n)}test(){return{...super.test(),create3DShape:e=>this._createAs3DShape(e.graphic,e.elevationContext,e.graphicUid),ensureMaterial:()=>this.ensureMaterial()}}}function R(e){let t=n(),r=a(e);return t[0]=Math.sin(r),t[1]=Math.cos(r),t}function z(t,n,r,a,s,c,l){let{positions:u,polygonIndices:m,vertexCount:v}=t,y=`mapPositions`in t?t.mapPositions:null,b=y??u;o(u,V),d(V,U);let x=r.getOrigin(U),S=P().createBuffer(v),C=S.getField(`position`,h),w=S.getField(`uv0`,g),T=S.getField(`olidColor`,_),E=e(a);f(H);for(let e=0;e<v;e++)p(H,b[e*3],b[e*3+1]);i(H,H,E);let[D,O]=H,A=D-D%B,M=O-O%B,N=x.vec3;for(let e=0;e<v;e++){let t=e*3;C.setValues(e,u[t]-N[0],u[t+1]-N[1],u[t+2]-N[2]),w.setValues(e,(b[t]*E-A)/B,(b[t+1]*E-M)/B),T!=null&&s!=null&&T.setVec(e,s)}let F=new k(n,new j(S,void 0,m),x,y);return F.layerViewUid=c,F.graphicUid=l,F}const B=100,V=u(),H=m(),U=r();class W extends T{}class G extends T{}export{L as Graphics3DWaterSymbolLayer,z as createWaterGeometry,R as headingVectorFromAngle};
2
+ import{getMetersPerUnitForSR as e}from"../../../../core/units.js";import{fromValues as t,create as n}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{scale as i}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{toRadian as a}from"../../../../core/libs/gl-matrix-2/math/common.js";import{fromBuffer as o,intersectsClippingArea as s,empty as c,expandWithAABB as l,create as u,center as d}from"../../../../geometry/support/aaBoundingBox.js";import{empty as f,expandXYInPlace as p,create as m}from"../../../../geometry/support/aaBoundingRect.js";import{BufferViewVec3f as h,BufferViewVec2f as g,BufferViewVec4u8 as _}from"../../../../geometry/support/buffer/BufferView.js";import{perBufferVertexElevationAligner as v}from"./ElevationAligners.js";import{elevationModeChangeUpdateType as y,needsElevationUpdates2D as b}from"./elevationAlignmentUtils.js";import{Graphics3DBufferGraphicLayer as x}from"./Graphics3DBufferGraphicLayer.js";import{Graphics3DDrapedBufferGraphicLayer as S}from"./Graphics3DDrapedBufferGraphicLayer.js";import{Graphics3DSymbolLayer as C}from"./Graphics3DSymbolLayer.js";import{geometryAsPolygon as w,PolygonCreationDataBase as T}from"./polygonUtils.js";import{loadTessellationUtils as E,preloadedPolygonToRenderInfoElevationAligned as D,preloadedPolygonToRenderInfoDraped as O}from"../../support/renderInfoUtils/polygon.js";import{BufferGeometry as k}from"../../webgl-engine/lib/BufferGeometry.js";import{BufferObject3D as A}from"../../webgl-engine/lib/BufferObject3D.js";import{Buffers as j}from"../../webgl-engine/lib/Buffers.js";import{Parameters as M,WaterMaterial as N,getWaterLayout as P}from"../../webgl-engine/materials/WaterMaterial.js";import{wavePresets as F}from"../../webgl-engine/materials/internal/waterMaterialUtils.js";const I=[`polyline`,`polygon`,`extent`];class L extends C{static{this.elevationModeChangeTypes={definedChanged:2,staysOnTheGround:0,onTheGroundChanged:2}}constructor(e,t,n,r){super(e,t,n,r)}async doLoad(){await E()}createGraphics3DGraphic(e){let t=e.graphic;if(!this._validateGeometry(t.geometry,I,this.symbolLayer.type))return null;let n=this.createElevationContextForGraphic(t);return this.ensureDrapedStatus(n.mode===`on-the-ground`),this.ensureMaterial(),this.draped?this._createAsOverlay(t):this._createAs3DShape(t,n,t.uid)}ensureMaterial(){if(this._materials[0])return;let e=new M,n=this.symbolLayer.color.toUnitRGBA();n[3]*=this._getLayerOpacity(),e.color=n,e.transparent=n[3]<1||this.needsDrivenTransparentPass,e.waveDirection=this.symbolLayer.waveDirection==null?t(0,0):R(this.symbolLayer.waveDirection);let r=this.symbolLayer.waveStrength+`-`+this.symbolLayer.waterbodySize,i=F[r];e.waveStrength=i.waveStrength,e.waveTextureRepeat=i.textureRepeat,e.waveVelocity=i.waveVelocity,e.flowStrength=i.perturbationStrength,e.hasSlicePlane=this._context.slicePlaneEnabled,e.draped=this.draped,e.useIndexing=!0,this._materials[0]=new N(e,this._context)}layerOpacityChanged(){if(this._materials[0]==null)return;let e=this._materials[0].parameters.color,t=this.symbolLayer.color.a*this._getLayerOpacity(),n=t<1||this.needsDrivenTransparentPass;this._materials[0].setParameters({color:[e[0],e[1],e[2],t],transparent:n})}layerScreenSizePerspectiveChanged(){}layerElevationInfoChanged(e,t,n){let r=this._elevationContext.mode,i=y(L.elevationModeChangeTypes,n,r);if(i!==1)return i;let a=b(r);return this.updateGraphics3DGraphicElevationInfo(e,t,()=>a)}slicePlaneEnabledChanged(){return this._materials[0]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),!0}physicalBasedRenderingChanged(){return!0}get needsDrivenTransparentPass(){return!1}_createAs3DShape(e,t,n){let r=w(e.geometry);if(r==null)return null;let i=D(r,this._context.elevationProvider,this._context.renderCoordsHelper,t,{owner:this._context.layer});if(i==null)return null;let a=new W(i,this._context.layerViewUid,e.uid);if(a.olidColor=this._context.stage.renderView?.getObjectAndLayerIdColor(a),this._create3DShapeGeometries(a),this._logGeometryCreationWarnings(a.renderInfo,r.rings,`rings`,`WaterSymbol3DLayer`),a.outGeometries.length===0)return null;let o=new A({geometries:a.outGeometries,castShadow:!1,layerViewUid:this._context.layerViewUid,graphicUid:n}),s=new x(this,o,null,v,t);return s.alignedSampledElevation=a.renderInfo.sampledElevation,s.needsElevationUpdates=b(t.mode),s}_create3DShapeGeometries(e){let{mapPositions:t}=e.renderInfo;if(e.renderInfo.polygonIndexCount===0||this._context.clippingExtent!=null&&(o(t,V),!s(V,this._context.clippingExtent)))return;let n=z(e.renderInfo,this._materials[0],this._context.localOriginFactory,this._context.elevationProvider.spatialReference,e.olidColor,e.layerViewUid,e.graphicUid);e.outGeometries.push(n)}_createAsOverlay(e){let t=w(e.geometry);if(t==null)return null;this._materials[0].renderPriority=this._renderPriority;let n=O(t,{drapedSpatialReference:this._context.overlaySR,owner:this._context.layer});if(n==null)return null;let r=new G(n,this._context.layerViewUid,e.uid);return r.olidColor=this._context.stage.renderView?.getObjectAndLayerIdColor(r),r.outBoundingBox=c(),this._createAsOverlayWater(r),this._logGeometryCreationWarnings(r.renderInfo,t.rings,`rings`,`WaterSymbol3DLayer`),r.outGeometries.length===0?null:new S(this,r.outGeometries,r.outBoundingBox,this._context.drapeSourceRenderer)}_createAsOverlayWater(e){let{positions:t}=e.renderInfo;if(o(t,V),!s(V,this._context.clippingExtent)||(l(e.outBoundingBox,V),e.renderInfo.polygonIndexCount===0))return;let n=z(e.renderInfo,this._materials[0],this._context.drapeSourceRenderer.rendererContext.localOriginFactory,this._context.overlaySR,e.olidColor,e.layerViewUid,e.graphicUid);e.outGeometries.push(n)}test(){return{...super.test(),create3DShape:e=>this._createAs3DShape(e.graphic,e.elevationContext,e.graphicUid),ensureMaterial:()=>this.ensureMaterial()}}}function R(e){let t=n(),r=a(e);return t[0]=Math.sin(r),t[1]=Math.cos(r),t}function z(t,n,r,a,s,c,l){let{positions:u,polygonIndices:m,vertexCount:v}=t,y=`mapPositions`in t?t.mapPositions:null,b=y??u;o(u,V),d(V,U);let x=r.getOrigin(U),S=P().createBuffer(v),C=S.getField(`position`,h),w=S.getField(`uv0`,g),T=S.getField(`olidColor`,_),E=e(a);f(H);for(let e=0;e<v;e++)p(H,b[e*3],b[e*3+1]);i(H,H,E);let[D,O]=H,A=D-D%B,M=O-O%B,N=x.vec3;for(let e=0;e<v;e++){let t=e*3;C.setValues(e,u[t]-N[0],u[t+1]-N[1],u[t+2]-N[2]),w.setValues(e,(b[t]*E-A)/B,(b[t+1]*E-M)/B),T!=null&&s!=null&&T.setVec(e,s)}let F=new k(n,new j(S,void 0,m),x,y);return F.layerViewUid=c,F.graphicUid=l,F}const B=100,V=u(),H=m(),U=r();class W extends T{}class G extends T{}export{L as Graphics3DWaterSymbolLayer,z as createWaterGeometry,R as headingVectorFromAngle};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{DefaultMaterial as e}from"../../webgl-engine/materials/DefaultMaterial.js";class t{constructor(){this._fastTransformOriginalMaterials=new Map,this._fastTransformClonedMaterials=new Map,this._graphicReferenceCount=0}enable(t,n,r,i=!1){t.enableFastTransformUpdates(t=>{if(this._graphicReferenceCount<=1){if(this._fastTransformOriginalMaterials.has(t))return t;let e=n.byMaterial(t);return this._fastTransformOriginalMaterials.set(t,e),n.delete(t),t}let i=new e(t.parameters,r);return this._fastTransformClonedMaterials.set(i,t),i},r.localOriginFactory,i)}disable(e,t){let n=new Set,r=new Set;e.disableFastTransformUpdates(e=>{if(!this._fastTransformClonedMaterials.has(e)){let i=e,a=this._fastTransformOriginalMaterials.get(i);return t.has(a.uid)?(n.add(i),t.byUid(a.uid).material):(r.add(i),a.material)}let i=e,a=this._fastTransformClonedMaterials.get(i);return this._fastTransformClonedMaterials.delete(i),a});for(let e of n)this._fastTransformOriginalMaterials.delete(e);for(let e of r){let n=this._fastTransformOriginalMaterials.get(e);this._fastTransformOriginalMaterials.delete(e),t.set(n.uid,n)}}onAddGraphic(){this._graphicReferenceCount++}onRemoveGraphic(e,t){this._graphicReferenceCount--,this.disable(e,t)}forEachMaterialInfo(e){this._fastTransformOriginalMaterials.forEach(e)}forEachClonedMaterial(e){this._fastTransformClonedMaterials.forEach(e)}destroy(){this._fastTransformClonedMaterials.clear(),this._fastTransformOriginalMaterials.clear()}}class n{constructor(){this._byUid=new Map,this._byMaterial=new Map}get materials(){return Array.from(this._byUid.values(),e=>e.material)}byUid(e){return this._byUid.get(e)}byMaterial(e){return this._byMaterial.get(e)}set(e,t){this._byUid.set(e,t),this._byMaterial.set(t.material,t)}delete(e){let t=this._byMaterial.get(e)?.uid;t&&(this._byUid.delete(t),this._byMaterial.delete(e))}has(e){return this._byUid.has(e)}forEachMaterialInfo(e){this._byUid.forEach(e)}clear(){this._byUid.clear(),this._byMaterial.clear()}}export{n as MaterialInfoCache,t as MeshFastUpdateProcessor};
2
+ import{DefaultMaterial as e}from"../../webgl-engine/materials/DefaultMaterial.js";class t{constructor(){this._fastTransformOriginalMaterials=new Map,this._fastTransformClonedMaterials=new Map,this._graphicReferenceCount=0}enable(t,n,r,i=!1){t.enableFastTransformUpdates(t=>{if(this._graphicReferenceCount<=1){if(this._fastTransformOriginalMaterials.has(t))return t;let e=n.byMaterial(t);return this._fastTransformOriginalMaterials.set(t,e),n.delete(t),t}let i=new e(t.parameters,r.spherical);return this._fastTransformClonedMaterials.set(i,t),i},r.localOriginFactory,i)}disable(e,t){let n=new Set,r=new Set;e.disableFastTransformUpdates(e=>{if(!this._fastTransformClonedMaterials.has(e)){let i=e,a=this._fastTransformOriginalMaterials.get(i);return t.has(a.uid)?(n.add(i),t.byUid(a.uid).material):(r.add(i),a.material)}let i=e,a=this._fastTransformClonedMaterials.get(i);return this._fastTransformClonedMaterials.delete(i),a});for(let e of n)this._fastTransformOriginalMaterials.delete(e);for(let e of r){let n=this._fastTransformOriginalMaterials.get(e);this._fastTransformOriginalMaterials.delete(e),t.set(n.uid,n)}}onAddGraphic(){this._graphicReferenceCount++}onRemoveGraphic(e,t){this._graphicReferenceCount--,this.disable(e,t)}forEachMaterialInfo(e){this._fastTransformOriginalMaterials.forEach(e)}forEachClonedMaterial(e){this._fastTransformClonedMaterials.forEach(e)}destroy(){this._fastTransformClonedMaterials.clear(),this._fastTransformOriginalMaterials.clear()}}class n{constructor(){this._byUid=new Map,this._byMaterial=new Map}get materials(){return Array.from(this._byUid.values(),e=>e.material)}byUid(e){return this._byUid.get(e)}byMaterial(e){return this._byMaterial.get(e)}set(e,t){this._byUid.set(e,t),this._byMaterial.set(t.material,t)}delete(e){let t=this._byMaterial.get(e)?.uid;t&&(this._byUid.delete(t),this._byMaterial.delete(e))}has(e){return this._byUid.has(e)}forEachMaterialInfo(e){this._byUid.forEach(e)}clear(){this._byUid.clear(),this._byMaterial.clear()}}export{n as MaterialInfoCache,t as MeshFastUpdateProcessor};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import has from"../../../../core/has.js";import{defaultObjectPrimitive as e}from"../../../../symbols/support/primitives.js";import{pathNumJoinSubdivisions as t,pathNumCircleProfileSubdivisions as n,pathNumRoundCapExtrusionSubdivisions as r}from"./Graphics3DPathSymbolLayerConstants.js";import{primitiveLodResources as i}from"./primitiveObjectSymbolUtils.js";import{EstimatedSymbolComplexity as a,AggregateSymbolComplexity as o,SymbolComplexity as s}from"./SymbolComplexity.js";import{hasEdges as c}from"../support/edgeUtils.js";import{DefaultMaterial as l}from"../../webgl-engine/materials/DefaultMaterial.js";const u=new a({});function d(e){if(e.type===`web-style`)return u;let t=new o;return e.symbolLayers.forEach(n=>f(m(e,n),t)),t}function f(e,t){e&&(t.verticesPerFeature+=e.verticesPerFeature,t.verticesPerCoordinate+=e.verticesPerCoordinate,t.drawCallsPerFeature+=e.drawCallsPerFeature,t.memory.bytesPerFeature+=e.memory.bytesPerFeature,t.memory.bytesPerFeatureLabel+=e.memory.bytesPerFeatureLabel,t.memory.resourceBytes+=e.memory.resourceBytes,t.memory.draped.bytesPerFeature+=e.memory.bytesPerFeature,t.memory.draped.bytesPerFeatureLabel+=e.memory.bytesPerFeatureLabel,t.estimated||=e.estimated,t.numComplexities++)}const p={};function m(i,o){let l=h(i,o),u=c(o)?2:0;switch(o.type){case`extrude`:return new s({verticesPerFeature:-12,verticesPerCoordinate:12,drawCallsPerFeature:u,memory:l});case`fill`:if(i.type===`mesh-3d`)return new s({drawCallsPerFeature:u,memory:l});if(o.outline!=null&&o.outline.size>0)return new s({verticesPerFeature:-12,verticesPerCoordinate:9,memory:l});case`water`:return new s({verticesPerFeature:-6,verticesPerCoordinate:3,memory:l});case`line`:return new s({verticesPerFeature:-6,verticesPerCoordinate:6,memory:l});case`object`:return o.resource?.href?new a({verticesPerFeature:100,memory:l}):{...g(o.resource?.primitive??e),memory:l};case`path`:{let e=0;switch(o.profile){case`circle`:e=n;break;case`quad`:e=4;break;default:o.profile;return}let i=e*2,a=e*t*2,c=a+i,u=-2*a-i;switch(o.cap){case`none`:break;case`butt`:case`square`:u+=2*(e-1);break;case`round`:u+=2*(e*(r-1)*2+e);break;default:return}return new s({verticesPerFeature:u,verticesPerCoordinate:c,memory:l})}case`text`:{let e=i.type===`label-3d`?0:2;return new s({verticesPerFeature:6,memory:l,drawCallsPerFeature:e})}case`icon`:return new s({verticesPerFeature:6,memory:l});default:return}}function h(e,t){let n=e.type===`point-3d`;switch(t.type){case`extrude`:return t.edges&&t.edges.size>0?v.EXTRUDE_EDGES:v.EXTRUDE;case`fill`:return t.outline!=null&&t.outline.size>0?v.FILL_OUTLINE:v.FILL;case`water`:return v.FILL;case`line`:return t.join===`round`?v.LINE_ROUND:v.LINE_MITER;case`path`:switch(t.join){case`round`:switch(t.profile){case`circle`:return v.PATH_ROUND_CIRCLE;case`quad`:return v.PATH_ROUND_QUAD;default:t.profile;return}case`miter`:case`bevel`:switch(t.profile){case`circle`:return v.PATH_MITER_CIRCLE;case`quad`:return v.PATH_MITER_QUAD;default:t.profile;return}default:return}case`object`:return n?v.OBJECT_POINT:v.OBJECT_POLYGON;case`icon`:case`text`:return n?v.ICON_POINT:v.ICON_POLYGON;default:return}}function g(e){let t=p[e];if(t)return t;let n=_(i(e,new l({},{spherical:!0})).levels);return p[e]=new s({verticesPerFeature:n}),p[e]}function _(e){return e.reduce((e,t,n)=>e+t.numVertices*(1/10**n),0)/e.reduce((e,t,n)=>e+1/10**n,0)}const v={ICON_POINT:{bytesPerFeature:2395,bytesPerFeatureLabel:4343,resourceBytes:0,draped:{bytesPerFeature:1662,bytesPerFeatureLabel:4409}},ICON_POLYGON:{bytesPerFeature:2750,bytesPerFeatureLabel:4219,resourceBytes:0,draped:{bytesPerFeature:2007,bytesPerFeatureLabel:4289}},OBJECT_POINT:{bytesPerFeature:1315,bytesPerFeatureLabel:4378,resourceBytes:0,draped:{bytesPerFeature:1315,bytesPerFeatureLabel:4378}},OBJECT_POLYGON:{bytesPerFeature:1642,bytesPerFeatureLabel:4239,resourceBytes:0,draped:{bytesPerFeature:1642,bytesPerFeatureLabel:4239}},LINE_MITER:{bytesPerFeature:2443,bytesPerFeatureLabel:4282,resourceBytes:0,draped:{bytesPerFeature:1906,bytesPerFeatureLabel:4210}},LINE_ROUND:{bytesPerFeature:2449,bytesPerFeatureLabel:4246,resourceBytes:0,draped:{bytesPerFeature:1911,bytesPerFeatureLabel:4290}},PATH_MITER_CIRCLE:{bytesPerFeature:3335,bytesPerFeatureLabel:4343,resourceBytes:0,draped:{bytesPerFeature:3335,bytesPerFeatureLabel:4343}},PATH_ROUND_CIRCLE:{bytesPerFeature:3365,bytesPerFeatureLabel:4326,resourceBytes:0,draped:{bytesPerFeature:3365,bytesPerFeatureLabel:4326}},PATH_MITER_QUAD:{bytesPerFeature:3373,bytesPerFeatureLabel:4406,resourceBytes:0,draped:{bytesPerFeature:3373,bytesPerFeatureLabel:4406}},PATH_ROUND_QUAD:{bytesPerFeature:3309,bytesPerFeatureLabel:4426,resourceBytes:0,draped:{bytesPerFeature:3309,bytesPerFeatureLabel:4426}},FILL:{bytesPerFeature:2416,bytesPerFeatureLabel:4281,resourceBytes:0,draped:{bytesPerFeature:1894,bytesPerFeatureLabel:4238}},FILL_OUTLINE:{bytesPerFeature:3286,bytesPerFeatureLabel:4281,resourceBytes:0,draped:{bytesPerFeature:2826,bytesPerFeatureLabel:4205}},EXTRUDE:{bytesPerFeature:3657,bytesPerFeatureLabel:4222,resourceBytes:0,draped:{bytesPerFeature:3657,bytesPerFeatureLabel:4222}},EXTRUDE_EDGES:{bytesPerFeature:4505,bytesPerFeatureLabel:4364,resourceBytes:0,draped:{bytesPerFeature:4505,bytesPerFeatureLabel:4364}}};if(has(`esri-tests-disable-symbol-memory-estimators`))for(let e in v){let t=v[e];t.bytesPerFeature=0,t.bytesPerFeatureLabel=0,t.draped.bytesPerFeature=0,t.draped.bytesPerFeatureLabel=0}export{f as aggregateSymbolComplexity,d as defaultSymbolComplexity,m as defaultSymbolLayerComplexity,h as defaultSymbolLayerMemoryComplexity,u as emptySymbolComplexity,_ as estimateNumVerticesForLods,v as memoryEstimators};
2
+ import has from"../../../../core/has.js";import{defaultObjectPrimitive as e}from"../../../../symbols/support/primitives.js";import{pathNumJoinSubdivisions as t,pathNumCircleProfileSubdivisions as n,pathNumRoundCapExtrusionSubdivisions as r}from"./Graphics3DPathSymbolLayerConstants.js";import{primitiveLodResources as i}from"./primitiveObjectSymbolUtils.js";import{EstimatedSymbolComplexity as a,AggregateSymbolComplexity as o,SymbolComplexity as s}from"./SymbolComplexity.js";import{hasEdges as c}from"../support/edgeUtils.js";import{DefaultMaterial as l}from"../../webgl-engine/materials/DefaultMaterial.js";const u=new a({});function d(e){if(e.type===`web-style`)return u;let t=new o;return e.symbolLayers.forEach(n=>f(m(e,n),t)),t}function f(e,t){e&&(t.verticesPerFeature+=e.verticesPerFeature,t.verticesPerCoordinate+=e.verticesPerCoordinate,t.drawCallsPerFeature+=e.drawCallsPerFeature,t.memory.bytesPerFeature+=e.memory.bytesPerFeature,t.memory.bytesPerFeatureLabel+=e.memory.bytesPerFeatureLabel,t.memory.resourceBytes+=e.memory.resourceBytes,t.memory.draped.bytesPerFeature+=e.memory.bytesPerFeature,t.memory.draped.bytesPerFeatureLabel+=e.memory.bytesPerFeatureLabel,t.estimated||=e.estimated,t.numComplexities++)}const p={};function m(i,o){let l=h(i,o),u=c(o)?2:0;switch(o.type){case`extrude`:return new s({verticesPerFeature:-12,verticesPerCoordinate:12,drawCallsPerFeature:u,memory:l});case`fill`:if(i.type===`mesh-3d`)return new s({drawCallsPerFeature:u,memory:l});if(o.outline!=null&&o.outline.size>0)return new s({verticesPerFeature:-12,verticesPerCoordinate:9,memory:l});case`water`:return new s({verticesPerFeature:-6,verticesPerCoordinate:3,memory:l});case`line`:return new s({verticesPerFeature:-6,verticesPerCoordinate:6,memory:l});case`object`:return o.resource?.href?new a({verticesPerFeature:100,memory:l}):{...g(o.resource?.primitive??e),memory:l};case`path`:{let e=0;switch(o.profile){case`circle`:e=n;break;case`quad`:e=4;break;default:o.profile;return}let i=e*2,a=e*t*2,c=a+i,u=-2*a-i;switch(o.cap){case`none`:break;case`butt`:case`square`:u+=2*(e-1);break;case`round`:u+=2*(e*(r-1)*2+e);break;default:return}return new s({verticesPerFeature:u,verticesPerCoordinate:c,memory:l})}case`text`:{let e=i.type===`label-3d`?0:2;return new s({verticesPerFeature:6,memory:l,drawCallsPerFeature:e})}case`icon`:return new s({verticesPerFeature:6,memory:l});default:return}}function h(e,t){let n=e.type===`point-3d`;switch(t.type){case`extrude`:return t.edges&&t.edges.size>0?v.EXTRUDE_EDGES:v.EXTRUDE;case`fill`:return t.outline!=null&&t.outline.size>0?v.FILL_OUTLINE:v.FILL;case`water`:return v.FILL;case`line`:return t.join===`round`?v.LINE_ROUND:v.LINE_MITER;case`path`:switch(t.join){case`round`:switch(t.profile){case`circle`:return v.PATH_ROUND_CIRCLE;case`quad`:return v.PATH_ROUND_QUAD;default:t.profile;return}case`miter`:case`bevel`:switch(t.profile){case`circle`:return v.PATH_MITER_CIRCLE;case`quad`:return v.PATH_MITER_QUAD;default:t.profile;return}default:return}case`object`:return n?v.OBJECT_POINT:v.OBJECT_POLYGON;case`icon`:case`text`:return n?v.ICON_POINT:v.ICON_POLYGON;default:return}}function g(e){let t=p[e];if(t)return t;let n=_(i(e,new l({},!0)).levels);return p[e]=new s({verticesPerFeature:n}),p[e]}function _(e){return e.reduce((e,t,n)=>e+t.numVertices*(1/10**n),0)/e.reduce((e,t,n)=>e+1/10**n,0)}const v={ICON_POINT:{bytesPerFeature:2395,bytesPerFeatureLabel:4343,resourceBytes:0,draped:{bytesPerFeature:1662,bytesPerFeatureLabel:4409}},ICON_POLYGON:{bytesPerFeature:2750,bytesPerFeatureLabel:4219,resourceBytes:0,draped:{bytesPerFeature:2007,bytesPerFeatureLabel:4289}},OBJECT_POINT:{bytesPerFeature:1315,bytesPerFeatureLabel:4378,resourceBytes:0,draped:{bytesPerFeature:1315,bytesPerFeatureLabel:4378}},OBJECT_POLYGON:{bytesPerFeature:1642,bytesPerFeatureLabel:4239,resourceBytes:0,draped:{bytesPerFeature:1642,bytesPerFeatureLabel:4239}},LINE_MITER:{bytesPerFeature:2443,bytesPerFeatureLabel:4282,resourceBytes:0,draped:{bytesPerFeature:1906,bytesPerFeatureLabel:4210}},LINE_ROUND:{bytesPerFeature:2449,bytesPerFeatureLabel:4246,resourceBytes:0,draped:{bytesPerFeature:1911,bytesPerFeatureLabel:4290}},PATH_MITER_CIRCLE:{bytesPerFeature:3335,bytesPerFeatureLabel:4343,resourceBytes:0,draped:{bytesPerFeature:3335,bytesPerFeatureLabel:4343}},PATH_ROUND_CIRCLE:{bytesPerFeature:3365,bytesPerFeatureLabel:4326,resourceBytes:0,draped:{bytesPerFeature:3365,bytesPerFeatureLabel:4326}},PATH_MITER_QUAD:{bytesPerFeature:3373,bytesPerFeatureLabel:4406,resourceBytes:0,draped:{bytesPerFeature:3373,bytesPerFeatureLabel:4406}},PATH_ROUND_QUAD:{bytesPerFeature:3309,bytesPerFeatureLabel:4426,resourceBytes:0,draped:{bytesPerFeature:3309,bytesPerFeatureLabel:4426}},FILL:{bytesPerFeature:2416,bytesPerFeatureLabel:4281,resourceBytes:0,draped:{bytesPerFeature:1894,bytesPerFeatureLabel:4238}},FILL_OUTLINE:{bytesPerFeature:3286,bytesPerFeatureLabel:4281,resourceBytes:0,draped:{bytesPerFeature:2826,bytesPerFeatureLabel:4205}},EXTRUDE:{bytesPerFeature:3657,bytesPerFeatureLabel:4222,resourceBytes:0,draped:{bytesPerFeature:3657,bytesPerFeatureLabel:4222}},EXTRUDE_EDGES:{bytesPerFeature:4505,bytesPerFeatureLabel:4364,resourceBytes:0,draped:{bytesPerFeature:4505,bytesPerFeatureLabel:4364}}};if(has(`esri-tests-disable-symbol-memory-estimators`))for(let e in v){let t=v[e];t.bytesPerFeature=0,t.bytesPerFeatureLabel=0,t.draped.bytesPerFeature=0,t.draped.bytesPerFeatureLabel=0}export{f as aggregateSymbolComplexity,d as defaultSymbolComplexity,m as defaultSymbolLayerComplexity,h as defaultSymbolLayerMemoryComplexity,u as emptySymbolComplexity,_ as estimateNumVerticesForLods,v as memoryEstimators};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{delinearize as e,colorGamma as t}from"../../../../colorUtils.js";import{adjustStaticAGOUrl as n}from"../../../../core/devEnvironmentUtils.js";import{hasScaling as r}from"../../../../core/mathUtils.js";import{normalFromMat4 as i,fromMat4 as a}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as o}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{invert as s}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{ONES as l}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{transformMat4 as u,subtract as d,divide as f,length as p,normalize as m,lerp as h}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{ZEROS as g,create as _}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{empty as v,expandWithAABB as y}from"../../../../geometry/support/aaBoundingBox.js";import{newFloatArray as b}from"../../../../geometry/support/FloatArray.js";import{BufferViewVec3f as x,BufferViewVec4f as S,BufferViewVec4u8 as C,BufferViewVec4u16 as w,BufferViewVec3u8 as T,BufferViewVec3u16 as E}from"../../../../geometry/support/buffer/BufferView.js";import{t as D,b as ee,n as O,f as k}from"../../../../chunks/vec3.js";import{t as A,b as j}from"../../../../chunks/vec4.js";import{a as M}from"../../../../chunks/vec2.js";import{DefaultLoadingContext as N}from"../../glTF/DefaultLoadingContext.js";import{convertPrimitiveToTriangles as P}from"../../glTF/internal/indexUtils.js";import{isEncodedMeshTexture as F}from"../../glTF/internal/resourceUtils.js";import{getTransformMatrix as I}from"../../glTF/internal/TextureTransformUtils.js";import{ProcessedObjectResource as L}from"./ProcessedObjectResource.js";import{load as R,processLoadResult as z}from"./wosrLoader.js";import{Attribute as B}from"../../webgl-engine/lib/Attribute.js";import{Geometry as V}from"../../webgl-engine/lib/Geometry.js";import{ManagedTexture as H}from"../../webgl-engine/lib/ManagedTexture.js";import{DefaultMaterial as U}from"../../webgl-engine/materials/DefaultMaterial.js";import{useSchematicPBR as W,schematicMRRFactors as G,esriSymbologyMRRFactors as K,advancedMRRFactors as q}from"../../webgl-engine/materials/pbrUtils.js";async function J(e,t){let r=Y(n(e));if(r.fileType===`wosr`){let e=await(t.cache?t.cache.loadWOSR(r.url,t):R(r.url,t)),{engineResources:n,referenceBoundingBox:i}=z(e,t);return{lods:n,referenceBoundingBox:i,isEsriSymbolResource:!1,isWosr:!0}}let i;if(t.cache)i=await t.cache.loadGLTF(r.url,t,!!t.usePBR,!!t.useEmissive);else{let{loadGLTF:e}=await import(`../../glTF/loader.js`);i=await e(new N,r.url,t,t.usePBR,t.useEmissive)}let{engineResources:a,referenceBoundingBox:o}=X(i,t,r.specifiedLodIndex);return{lods:a,referenceBoundingBox:o,isEsriSymbolResource:i.meta.isEsriSymbolResource,isWosr:!1}}function Y(e){let t=e.match(/(.*\.(gltf|glb))(\?lod=([0-9]+))?$/);return t?{fileType:`gltf`,url:t[1],specifiedLodIndex:t[4]==null?null:Number(t[4])}:{fileType:e.match(/(.*\.(json|json\.gz))$/)?`wosr`:`unknown`,url:e,specifiedLodIndex:null}}function X(e,t,n){let r=e.model,i=e.meta,a=r.meta?.ESRI_proxyEllipsoid,o=i.isEsriSymbolResource&&a!=null&&i.ESRI_webstyle===`EsriRealisticTreesStyle`;o&&!e.customMeta.esriTreeRendering&&(e.customMeta.esriTreeRendering=!0,ne(e,a));let s=!!t.usePBR,c=i.isEsriSymbolResource?{usePBR:s,isSchematic:!1,treeRendering:o,mrrFactors:K}:{usePBR:s,isSchematic:!1,treeRendering:!1,mrrFactors:q},l={...t.materialParameters,treeRendering:o},u=[],d=new Map,f=new Map,p=r.lods.length,m=v();return r.lods.forEach((e,i)=>{let a=t.skipHighLods===!0&&(p>1&&i===0||p>3&&i===1)||t.skipHighLods===!1&&n!=null&&i!==n;if(a&&i!==0)return;let s=new L(e.name,e.lodThreshold,[0,0,0]);e.parts.forEach(e=>{let n=a?new U({},t):Z(r,e,s,c,l,d,f,t,o),{geometry:u,vertexCount:p}=Q(e,n??new U({},t)),h=u.boundingInfo;h!=null&&i===0&&y(m,h.box),n!=null&&(s.stageResources.geometries.push(u),s.numberOfVertices+=p)}),a||u.push(s)}),{engineResources:u,referenceBoundingBox:m}}function Z(t,n,r,i,a,o,s,c,u){let d=t.materials.get(n.material);if(d==null)return null;let{normal:f,color:p,texCoord0:m,tangent:h}=n.attributes,_=n.material+(f?`_normal`:``)+(p?`_color`:``)+(m?`_texCoord0`:``)+(h?`_tangent`:``),v=n.attributes.texCoord0!=null,y=n.attributes.normal!=null,b=te(d.alphaMode);if(!o.has(_)){if(v){let e=(e,n=!1,r=!1)=>{if(e!=null&&!s.has(e)){let i=t.textures.get(e);if(i){let t=i.data,a=n&&!F(t)?c.compressionOptions:void 0;s.set(e,new H(F(t)?t.data:t,{...i.parameters,preMultiplyAlpha:!F(t)&&r,encoding:F(t)?t.encoding:void 0,compressionOptions:a}))}}},n=b!==1&&!u;e(d.colorTexture,n,b!==1),e(d.normalTexture),e(d.occlusionTexture,!0),e(d.emissiveTexture),e(d.metallicRoughnessTexture,!0)}let r=e(d.color[0]),f=e(d.color[1]),p=e(d.color[2]),m=d.colorTexture!=null&&v?s.get(d.colorTexture):null,h=W(d),x=d.normalTextureTransform?.scale==null?l:d.normalTextureTransform?.scale;o.set(_,new U({...i,customDepthTest:1,textureAlphaMode:b,textureAlphaCutoff:d.alphaCutoff,diffuse:[r,f,p],ambient:[r,f,p],opacity:d.alphaMode===`OPAQUE`?1:d.opacity,doubleSided:d.doubleSided,doubleSidedType:`winding-order`,cullFace:d.doubleSided?0:2,hasVertexColors:!!n.attributes.color,hasVertexTangents:!!n.attributes.tangent,normalType:y?0:2,castShadows:!0,receiveShadows:d.receiveShadows,receiveAmbientOcclusion:d.receiveAmbientOcclusion,unlit:d.unlit,textureId:m?.id,colorMixMode:d.colorMixMode,normalTextureId:d.normalTexture!=null&&v?s.get(d.normalTexture).id:void 0,textureAlphaPremultiplied:m!=null&&!!m.parameters.preMultiplyAlpha,occlusionTextureId:d.occlusionTexture!=null&&v?s.get(d.occlusionTexture).id:void 0,emissiveTextureId:d.emissiveTexture!=null&&v&&!d.unlit?s.get(d.emissiveTexture).id:void 0,metallicRoughnessTextureId:d.metallicRoughnessTexture!=null&&v?s.get(d.metallicRoughnessTexture).id:void 0,emissiveBaseColor:d.unlit?g:[d.emissiveFactor[0],d.emissiveFactor[1],d.emissiveFactor[2]],emissiveStrengthKHR:d.emissiveStrengthKHR==null?1:d.emissiveStrengthKHR,emissiveStrengthFromSymbol:a.emissiveStrengthFromSymbol==null?void 0:a.emissiveStrengthFromSymbol,mrrFactors:h?G:[d.metallicFactor,d.roughnessFactor,i.mrrFactors[2]],isSchematic:h,colorTextureTransformMatrix:I(d.colorTextureTransform),normalTextureTransformMatrix:I(d.normalTextureTransform),scale:[x[0],x[1]],occlusionTextureTransformMatrix:I(d.occlusionTextureTransform),emissiveTextureTransformMatrix:I(d.emissiveTextureTransform),metallicRoughnessTextureTransformMatrix:I(d.metallicRoughnessTextureTransform),...a},c))}let x=o.get(_);if(r.stageResources.materials.push(x),v){let e=e=>{e!=null&&r.stageResources.textures.push(s.get(e))};e(d.colorTexture),e(d.normalTexture),e(d.occlusionTexture),e(d.emissiveTexture),e(d.metallicRoughnessTexture)}return x}function Q(e,t){let n=e.attributes.position.count,o=P(e.indices||n,e.primitiveType),s=b(3*n),{typedBuffer:c,typedBufferStride:l}=e.attributes.position;D(s,c,e.transform,3,l);let u=[[`position`,new B(s,o,3,!0)]];if(e.attributes.normal!=null){let t=b(3*n),{typedBuffer:a,typedBufferStride:s}=e.attributes.normal;i($,e.transform),ee(t,a,$,3,s),r($)&&O(t,t),u.push([`normal`,new B(t,o,3,!0)])}if(e.attributes.tangent!=null){let t=b(4*n),{typedBuffer:i,typedBufferStride:s}=e.attributes.tangent;a($,e.transform),A(t,i,$,4,s),r($)&&O(t,t,4),u.push([`tangent`,new B(t,o,4,!0)])}if(e.attributes.texCoord0!=null){let t=b(2*n),{typedBuffer:r,typedBufferStride:i}=e.attributes.texCoord0;M(t,r,2,i),u.push([`uv0`,new B(t,o,2,!0)])}let d=e.attributes.color;if(d!=null){let t=new Uint8Array(4*n);d.elementCount===4?d instanceof S?j(t,d,1,255):(d instanceof C||d instanceof w)&&j(t,d,1/255,255):(t.fill(255),d instanceof x?k(t,d.typedBuffer,1,255,4,d.typedBufferStride):(e.attributes.color instanceof T||e.attributes.color instanceof E)&&k(t,d.typedBuffer,1/255,255,4,e.attributes.color.typedBufferStride)),u.push([`color`,new B(t,o,4,!0)])}return{geometry:new V(t,u),vertexCount:n}}const $=o();function te(e){switch(e){case`BLEND`:return 0;case`MASK`:return 2;case`OPAQUE`:case null:case void 0:return 1}}function ne(e,n){for(let r=0;r<e.model.lods.length;++r){let i=e.model.lods[r];for(let a of i.parts){let i=a.attributes.normal;if(i==null)return;let o=a.attributes.position,l=o.count,g=_(),v=_(),y=_(),b=new Float32Array(4*l),C=new Float32Array(3*l),w=s(c(),a.transform),T=0,E=0;for(let s=0;s<l;s++){o.getVec(s,v),i.getVec(s,g),u(v,v,a.transform),d(y,v,n.center),f(y,y,n.radius);let c=y[2],l=p(y),_=Math.min(.45+.55*l*l,1)**t;f(y,y,n.radius),w!==null&&u(y,y,w),m(y,y),r+1!==e.model.lods.length&&e.model.lods.length>1&&(c>-1?h(y,y,g,.2):h(y,y,g,Math.min(-4*c-3.8,1))),C[T]=y[0],C[T+1]=y[1],C[T+2]=y[2],T+=3,b[E]=_,b[E+1]=_,b[E+2]=_,b[E+3]=1,E+=4}a.attributes.normal=new x(C.buffer),a.attributes.color=new S(b.buffer)}}}export{J as fetch,Y as parseUrl};
2
+ import{delinearize as e,colorGamma as t}from"../../../../colorUtils.js";import{adjustStaticAGOUrl as n}from"../../../../core/devEnvironmentUtils.js";import{hasScaling as r}from"../../../../core/mathUtils.js";import{normalFromMat4 as i,fromMat4 as a}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as o}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{invert as s}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{ONES as l}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{transformMat4 as u,subtract as d,divide as f,length as p,normalize as m,lerp as h}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{ZEROS as g,create as _}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{empty as v,expandWithAABB as y}from"../../../../geometry/support/aaBoundingBox.js";import{newFloatArray as b}from"../../../../geometry/support/FloatArray.js";import{BufferViewVec3f as x,BufferViewVec4f as S,BufferViewVec4u8 as C,BufferViewVec4u16 as w,BufferViewVec3u8 as T,BufferViewVec3u16 as E}from"../../../../geometry/support/buffer/BufferView.js";import{t as D,b as ee,n as O,f as k}from"../../../../chunks/vec3.js";import{t as A,b as j}from"../../../../chunks/vec4.js";import{a as M}from"../../../../chunks/vec2.js";import{DefaultLoadingContext as N}from"../../glTF/DefaultLoadingContext.js";import{convertPrimitiveToTriangles as P}from"../../glTF/internal/indexUtils.js";import{isEncodedMeshTexture as F}from"../../glTF/internal/resourceUtils.js";import{getTransformMatrix as I}from"../../glTF/internal/TextureTransformUtils.js";import{ProcessedObjectResource as L}from"./ProcessedObjectResource.js";import{load as R,processLoadResult as z}from"./wosrLoader.js";import{Attribute as B}from"../../webgl-engine/lib/Attribute.js";import{Geometry as V}from"../../webgl-engine/lib/Geometry.js";import{ManagedTexture as H}from"../../webgl-engine/lib/ManagedTexture.js";import{DefaultMaterial as U}from"../../webgl-engine/materials/DefaultMaterial.js";import{useSchematicPBR as W,schematicMRRFactors as G,esriSymbologyMRRFactors as K,advancedMRRFactors as q}from"../../webgl-engine/materials/pbrUtils.js";async function J(e,t){let r=Y(n(e));if(r.fileType===`wosr`){let e=await(t.cache?t.cache.loadWOSR(r.url,t):R(r.url,t)),{engineResources:n,referenceBoundingBox:i}=z(e,t);return{lods:n,referenceBoundingBox:i,isEsriSymbolResource:!1,isWosr:!0}}let i;if(t.cache)i=await t.cache.loadGLTF(r.url,t,!!t.usePBR,!!t.useEmissive);else{let{loadGLTF:e}=await import(`../../glTF/loader.js`);i=await e(new N,r.url,t,t.usePBR,t.useEmissive)}let{engineResources:a,referenceBoundingBox:o}=X(i,t,r.specifiedLodIndex);return{lods:a,referenceBoundingBox:o,isEsriSymbolResource:i.meta.isEsriSymbolResource,isWosr:!1}}function Y(e){let t=e.match(/(.*\.(gltf|glb))(\?lod=([0-9]+))?$/);return t?{fileType:`gltf`,url:t[1],specifiedLodIndex:t[4]==null?null:Number(t[4])}:{fileType:e.match(/(.*\.(json|json\.gz))$/)?`wosr`:`unknown`,url:e,specifiedLodIndex:null}}function X(e,t,n){let r=e.model,i=e.meta,a=r.meta?.ESRI_proxyEllipsoid,o=i.isEsriSymbolResource&&a!=null&&i.ESRI_webstyle===`EsriRealisticTreesStyle`;o&&!e.customMeta.esriTreeRendering&&(e.customMeta.esriTreeRendering=!0,ne(e,a));let s=!!t.usePBR,c=i.isEsriSymbolResource?{usePBR:s,isSchematic:!1,treeRendering:o,mrrFactors:K}:{usePBR:s,isSchematic:!1,treeRendering:!1,mrrFactors:q},l={...t.materialParameters,treeRendering:o},u=[],d=new Map,f=new Map,p=r.lods.length,m=v();return r.lods.forEach((e,i)=>{let a=t.skipHighLods===!0&&(p>1&&i===0||p>3&&i===1)||t.skipHighLods===!1&&n!=null&&i!==n;if(a&&i!==0)return;let s=new L(e.name,e.lodThreshold,[0,0,0]);e.parts.forEach(e=>{let n=a?new U({},t.spherical):Z(r,e,s,c,l,d,f,t,o),{geometry:u,vertexCount:p}=Q(e,n??new U({},t.spherical)),h=u.boundingInfo;h!=null&&i===0&&y(m,h.box),n!=null&&(s.stageResources.geometries.push(u),s.numberOfVertices+=p)}),a||u.push(s)}),{engineResources:u,referenceBoundingBox:m}}function Z(t,n,r,i,a,o,s,c,u){let d=t.materials.get(n.material);if(d==null)return null;let{normal:f,color:p,texCoord0:m,tangent:h}=n.attributes,_=n.material+(f?`_normal`:``)+(p?`_color`:``)+(m?`_texCoord0`:``)+(h?`_tangent`:``),v=n.attributes.texCoord0!=null,y=n.attributes.normal!=null,b=te(d.alphaMode);if(!o.has(_)){if(v){let e=(e,n=!1,r=!1)=>{if(e!=null&&!s.has(e)){let i=t.textures.get(e);if(i){let t=i.data,a=n&&!F(t)?c.compressionOptions:void 0;s.set(e,new H(F(t)?t.data:t,{...i.parameters,preMultiplyAlpha:!F(t)&&r,encoding:F(t)?t.encoding:void 0,compressionOptions:a}))}}},n=b!==1&&!u;e(d.colorTexture,n,b!==1),e(d.normalTexture),e(d.occlusionTexture,!0),e(d.emissiveTexture),e(d.metallicRoughnessTexture,!0)}let r=e(d.color[0]),f=e(d.color[1]),p=e(d.color[2]),m=d.colorTexture!=null&&v?s.get(d.colorTexture):null,h=W(d),x=d.normalTextureTransform?.scale==null?l:d.normalTextureTransform?.scale;o.set(_,new U({...i,customDepthTest:1,textureAlphaMode:b,textureAlphaCutoff:d.alphaCutoff,diffuse:[r,f,p],ambient:[r,f,p],opacity:d.alphaMode===`OPAQUE`?1:d.opacity,doubleSided:d.doubleSided,doubleSidedType:`winding-order`,cullFace:d.doubleSided?0:2,hasVertexColors:!!n.attributes.color,hasVertexTangents:!!n.attributes.tangent,normalType:y?0:2,castShadows:!0,receiveShadows:d.receiveShadows,receiveAmbientOcclusion:d.receiveAmbientOcclusion,unlit:d.unlit,textureId:m?.id,colorMixMode:d.colorMixMode,normalTextureId:d.normalTexture!=null&&v?s.get(d.normalTexture).id:void 0,textureAlphaPremultiplied:m!=null&&!!m.parameters.preMultiplyAlpha,occlusionTextureId:d.occlusionTexture!=null&&v?s.get(d.occlusionTexture).id:void 0,emissiveTextureId:d.emissiveTexture!=null&&v&&!d.unlit?s.get(d.emissiveTexture).id:void 0,metallicRoughnessTextureId:d.metallicRoughnessTexture!=null&&v?s.get(d.metallicRoughnessTexture).id:void 0,emissiveBaseColor:d.unlit?g:[d.emissiveFactor[0],d.emissiveFactor[1],d.emissiveFactor[2]],emissiveStrengthKHR:d.emissiveStrengthKHR==null?1:d.emissiveStrengthKHR,emissiveStrengthFromSymbol:a.emissiveStrengthFromSymbol==null?void 0:a.emissiveStrengthFromSymbol,mrrFactors:h?G:[d.metallicFactor,d.roughnessFactor,i.mrrFactors[2]],isSchematic:h,colorTextureTransformMatrix:I(d.colorTextureTransform),normalTextureTransformMatrix:I(d.normalTextureTransform),scale:[x[0],x[1]],occlusionTextureTransformMatrix:I(d.occlusionTextureTransform),emissiveTextureTransformMatrix:I(d.emissiveTextureTransform),metallicRoughnessTextureTransformMatrix:I(d.metallicRoughnessTextureTransform),...a},c.spherical))}let x=o.get(_);if(r.stageResources.materials.push(x),v){let e=e=>{e!=null&&r.stageResources.textures.push(s.get(e))};e(d.colorTexture),e(d.normalTexture),e(d.occlusionTexture),e(d.emissiveTexture),e(d.metallicRoughnessTexture)}return x}function Q(e,t){let n=e.attributes.position.count,o=P(e.indices||n,e.primitiveType),s=b(3*n),{typedBuffer:c,typedBufferStride:l}=e.attributes.position;D(s,c,e.transform,3,l);let u=[[`position`,new B(s,o,3,!0)]];if(e.attributes.normal!=null){let t=b(3*n),{typedBuffer:a,typedBufferStride:s}=e.attributes.normal;i($,e.transform),ee(t,a,$,3,s),r($)&&O(t,t),u.push([`normal`,new B(t,o,3,!0)])}if(e.attributes.tangent!=null){let t=b(4*n),{typedBuffer:i,typedBufferStride:s}=e.attributes.tangent;a($,e.transform),A(t,i,$,4,s),r($)&&O(t,t,4),u.push([`tangent`,new B(t,o,4,!0)])}if(e.attributes.texCoord0!=null){let t=b(2*n),{typedBuffer:r,typedBufferStride:i}=e.attributes.texCoord0;M(t,r,2,i),u.push([`uv0`,new B(t,o,2,!0)])}let d=e.attributes.color;if(d!=null){let t=new Uint8Array(4*n);d.elementCount===4?d instanceof S?j(t,d,1,255):(d instanceof C||d instanceof w)&&j(t,d,1/255,255):(t.fill(255),d instanceof x?k(t,d.typedBuffer,1,255,4,d.typedBufferStride):(e.attributes.color instanceof T||e.attributes.color instanceof E)&&k(t,d.typedBuffer,1/255,255,4,e.attributes.color.typedBufferStride)),u.push([`color`,new B(t,o,4,!0)])}return{geometry:new V(t,u),vertexCount:n}}const $=o();function te(e){switch(e){case`BLEND`:return 0;case`MASK`:return 2;case`OPAQUE`:case null:case void 0:return 1}}function ne(e,n){for(let r=0;r<e.model.lods.length;++r){let i=e.model.lods[r];for(let a of i.parts){let i=a.attributes.normal;if(i==null)return;let o=a.attributes.position,l=o.count,g=_(),v=_(),y=_(),b=new Float32Array(4*l),C=new Float32Array(3*l),w=s(c(),a.transform),T=0,E=0;for(let s=0;s<l;s++){o.getVec(s,v),i.getVec(s,g),u(v,v,a.transform),d(y,v,n.center),f(y,y,n.radius);let c=y[2],l=p(y),_=Math.min(.45+.55*l*l,1)**t;f(y,y,n.radius),w!==null&&u(y,y,w),m(y,y),r+1!==e.model.lods.length&&e.model.lods.length>1&&(c>-1?h(y,y,g,.2):h(y,y,g,Math.min(-4*c-3.8,1))),C[T]=y[0],C[T+1]=y[1],C[T+2]=y[2],T+=3,b[E]=_,b[E+1]=_,b[E+2]=_,b[E+3]=1,E+=4}a.attributes.normal=new x(C.buffer),a.attributes.color=new S(b.buffer)}}}export{J as fetch,Y as parseUrl};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import e from"../../../../geometry/Extent.js";import t from"../../../../geometry/Polygon.js";import{getContinuousIndexArray as n,getZeroIndexArray as r}from"../../../../geometry/support/Indices.js";import{addOlidAttribute as i}from"./olidUtils.js";import{Attribute as a}from"../../webgl-engine/lib/Attribute.js";import{Geometry as o}from"../../webgl-engine/lib/Geometry.js";function s(e){let t=e.attributeData.position.length/3,s=n(t),c=[[`position`,new a(e.attributeData.position,s,3,!0)]],{boundingRect:l,textureElementIndices:u,boundingRectIndices:d}=e.attributeData,f=l!=null,p=f?d?.length??1:t,m=r(p);e.attributeData.colorFeature==null?e.attributeData.color&&c.push([`color`,new a(e.attributeData.color,m,4,!0)]):c.push([`colorFeatureAttribute`,new a([e.attributeData.colorFeature],m,1,!0)]),e.attributeData.uvMapSpace&&c.push([`uvMapSpace`,new a(e.attributeData.uvMapSpace,s,4,!0)]),f&&(c.push([`boundingRect`,new a(l,d??[0],9,!0)]),u!=null&&c.push([`textureElementIndex`,new a(u,s,1,!0)]));let h=e.attributeData.olidColor;return h!=null&&i(c,h,r(t)),new o(e.material,c,e.mapPositions,void 0,void 0,e.indices)}function c(n){switch(n.type){case`extent`:if(n instanceof e)return t.fromExtent(n);break;case`polygon`:return n}return null}class l{constructor(e,t,n){this.renderData=e,this.layerViewUid=t,this.graphicUid=n,this.outGeometries=[]}}export{l as PolygonCreationDataBase,s as createColorGeometry,c as geometryAsPolygon};
2
+ import e from"../../../../geometry/Extent.js";import t from"../../../../geometry/Polygon.js";import{getContinuousIndexArray as n,getZeroIndexArray as r}from"../../../../geometry/support/Indices.js";import{addOlidAttribute as i}from"./olidUtils.js";import{Attribute as a}from"../../webgl-engine/lib/Attribute.js";import{Geometry as o}from"../../webgl-engine/lib/Geometry.js";function s(e){let t=e.attributeData.position.length/3,s=n(t),c=[[`position`,new a(e.attributeData.position,s,3,!0)]],{boundingRect:l,textureElementIndices:u,boundingRectIndices:d}=e.attributeData,f=l!=null,p=f?d?.length??1:t,m=r(p);e.attributeData.colorFeature==null?e.attributeData.color&&c.push([`color`,new a(e.attributeData.color,m,4,!0)]):c.push([`colorFeatureAttribute`,new a([e.attributeData.colorFeature],m,1,!0)]),e.attributeData.uvMapSpace&&c.push([`uvMapSpace`,new a(e.attributeData.uvMapSpace,s,4,!0)]),f&&(c.push([`boundingRect`,new a(l,d??[0],9,!0)]),u!=null&&c.push([`textureElementIndex`,new a(u,s,1,!0)]));let h=e.attributeData.olidColor;return h!=null&&i(c,h,r(t)),new o(e.material,c,e.mapPositions,void 0,void 0,e.indices)}function c(n){switch(n.type){case`extent`:if(n instanceof e)return t.fromExtent(n);break;case`polygon`:return n}return null}class l{constructor(e,t,n){this.renderInfo=e,this.layerViewUid=t,this.graphicUid=n,this.outGeometries=[]}}export{l as PolygonCreationDataBase,s as createColorGeometry,c as geometryAsPolygon};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import e from"../../../../request.js";import{result as t}from"../../../../core/asyncUtils.js";import n from"../../../../core/Error.js";import r from"../../../../core/Logger.js";import{estimateNestedObjectMemory as i}from"../../../../core/memoryEstimations.js";import{NestedMap as a}from"../../../../core/NestedMap.js";import{throwIfAbortError as o}from"../../../../core/promiseUtils.js";import s from"../../../../core/Version.js";import{fromArray as c}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{empty as l,expandWithAABB as u}from"../../../../geometry/support/aaBoundingBox.js";import{getContinuousIndexArray as d}from"../../../../geometry/support/Indices.js";import{requestImage as f}from"../../../../request/image.js";import{Attribute as p}from"../../webgl-engine/lib/Attribute.js";import{Geometry as m}from"../../webgl-engine/lib/Geometry.js";import{ManagedTexture as h}from"../../webgl-engine/lib/ManagedTexture.js";import{DefaultMaterial as g}from"../../webgl-engine/materials/DefaultMaterial.js";const _=()=>r.getLogger(`esri.views.3d.layers.graphics.objectResourceUtils`);class v{constructor(e,t,n){this.resource=e,this.textures=t,this.usedMemory=n}}async function y(e,t){let n=await b(e,t),r=await T(n.textureDefinitions??{},t),a=0;for(let e in r)if(r.hasOwnProperty(e)){let t=r[e];a+=t?.image?t.image.width*t.image.height*4:0}return new v(n,r,a+i(n))}async function b(n,r){let i=await t(e(n,r));if(i.ok)return i.value.data;o(i.error),x(i.error)}function x(e){throw new n(``,`Request for object resource failed: ${e}`)}function S(e){let t=e.params,n=t.topology,r=!0;switch(t.vertexAttributes||(_().warn(`Geometry must specify vertex attributes`),r=!1),t.topology){case`PerAttributeArray`:break;case`Indexed`:case null:case void 0:{let e=t.faces;if(!e)_().warn(`Indexed geometries must specify faces`),r=!1;else if(t.vertexAttributes)for(let n in t.vertexAttributes){let t=e[n];t?.values?(t.valueType!=null&&t.valueType!==`UInt32`&&(_().warn(`Unsupported indexed geometry indices type '${t.valueType}', only UInt32 is currently supported`),r=!1),t.valuesPerElement!=null&&t.valuesPerElement!==1&&(_().warn(`Unsupported indexed geometry values per element '${t.valuesPerElement}', only 1 is currently supported`),r=!1)):(_().warn(`Indexed geometry does not specify face indices for '${n}' attribute`),r=!1)}break}default:_().warn(`Unsupported topology '${n}'`),r=!1}e.params.material||(_().warn(`Geometry requires material`),r=!1);let i=e.params.vertexAttributes;for(let e in i)i[e].values||(_().warn(`Geometries with externally defined attributes are not yet supported`),r=!1);return r}function C(e,t){let n=[],r=[],i=[],o=new a,l=e.resource,u=s.parse(l.version||`1.0`,`wosr`);O.validate(u);let f=l.model.name,_=l.model.geometries,v=l.materialDefinitions??{},y=e.textures,b=0,x=new Map;for(let e=0;e<_.length;e++){let a=_[e];if(!S(a))continue;let s=D(a),l=a.params.vertexAttributes,u=[],f=e=>{if(a.params.topology===`PerAttributeArray`)return null;let t=a.params.faces;for(let n in t)if(n===e)return t[n].values;return null},C=l.position,w=C.values.length/C.valuesPerElement;for(let e in l){let t=l[e],n=t.values,r=f(e)??d(w);u.push([e,new p(n,r,t.valuesPerElement,!0)])}let T=s.texture,O=y&&y[T];if(O&&!x.has(T)){let{image:e,parameters:t}=O,n=new h(e,t);r.push(n),x.set(T,n)}let k=x.get(T),A=k?k.id:void 0,j=s.material,M=o.get(j,T);if(M==null){let e=v[j.slice(j.lastIndexOf(`/`)+1)].params;e.transparency===1&&(e.transparency=0);let n=O?E(O.alphaChannelUsage):void 0,r={ambient:c(e.diffuse),diffuse:c(e.diffuse),opacity:1-(e.transparency||0),textureAlphaMode:n,textureAlphaCutoff:.33,textureId:A,doubleSided:!0,cullFace:0,colorMixMode:e.externalColorMixMode||`tint`,textureAlphaPremultiplied:O?.parameters.preMultiplyAlpha??!1};t?.materialParameters&&Object.assign(r,t.materialParameters),M=new g(r,t),o.set(j,T,M)}i.push(M);let N=new m(M,u);b+=u.find(e=>e[0]===`position`)?.[1]?.indices.length??0,n.push(N)}return{engineResources:[{name:f,stageResources:{textures:r,materials:i,geometries:n},pivotOffset:l.model.pivotOffset,numberOfVertices:b,lodThreshold:null}],referenceBoundingBox:w(n)}}function w(e){let t=l();return e.forEach(e=>{let n=e.boundingInfo;n!=null&&u(t,n.box)}),t}async function T(e,t){let n=[];for(let r in e){let i=e[r],a=i.images[0].data;if(!a){_().warn(`Externally referenced texture data is not yet supported`);continue}let o=i.encoding+`;base64,`+a,s=`/textureDefinitions/`+r,c=i.channels===`rgba`?i.alphaChannelUsage||`transparency`:`none`,l={noUnpackFlip:!0,wrap:{s:10497,t:10497},preMultiplyAlpha:E(c)!==1},u=t?.disableTextures?Promise.resolve(null):f(o,t);n.push(u.then(e=>({refId:s,image:e,parameters:l,alphaChannelUsage:c})))}let r=await Promise.all(n),i={};for(let e of r)i[e.refId]=e;return i}function E(e){switch(e){case`mask`:return 2;case`maskAndTransparency`:return 3;case`none`:return 1;case`transparency`:return 0;default:return 0}}function D(e){let t=e.params;return{id:1,material:t.material,texture:t.texture,region:t.texture}}const O=new s(1,2,`wosr`);export{v as LoaderResultWOSR,T as createTextureResources,y as load,C as processLoadResult};
2
+ import e from"../../../../request.js";import{result as t}from"../../../../core/asyncUtils.js";import n from"../../../../core/Error.js";import r from"../../../../core/Logger.js";import{estimateNestedObjectMemory as i}from"../../../../core/memoryEstimations.js";import{NestedMap as a}from"../../../../core/NestedMap.js";import{throwIfAbortError as o}from"../../../../core/promiseUtils.js";import s from"../../../../core/Version.js";import{fromArray as c}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{empty as l,expandWithAABB as u}from"../../../../geometry/support/aaBoundingBox.js";import{getContinuousIndexArray as d}from"../../../../geometry/support/Indices.js";import{requestImage as f}from"../../../../request/image.js";import{Attribute as p}from"../../webgl-engine/lib/Attribute.js";import{Geometry as m}from"../../webgl-engine/lib/Geometry.js";import{ManagedTexture as h}from"../../webgl-engine/lib/ManagedTexture.js";import{DefaultMaterial as g}from"../../webgl-engine/materials/DefaultMaterial.js";const _=()=>r.getLogger(`esri.views.3d.layers.graphics.objectResourceUtils`);class v{constructor(e,t,n){this.resource=e,this.textures=t,this.usedMemory=n}}async function y(e,t){let n=await b(e,t),r=await T(n.textureDefinitions??{},t),a=0;for(let e in r)if(r.hasOwnProperty(e)){let t=r[e];a+=t?.image?t.image.width*t.image.height*4:0}return new v(n,r,a+i(n))}async function b(n,r){let i=await t(e(n,r));if(i.ok)return i.value.data;o(i.error),x(i.error)}function x(e){throw new n(`request:wosr`,`Request for object resource failed: ${e}`)}function S(e){let t=e.params,n=t.topology,r=!0;switch(t.vertexAttributes||(_().warn(`Geometry must specify vertex attributes`),r=!1),t.topology){case`PerAttributeArray`:break;case`Indexed`:case null:case void 0:{let e=t.faces;if(!e)_().warn(`Indexed geometries must specify faces`),r=!1;else if(t.vertexAttributes)for(let n in t.vertexAttributes){let t=e[n];t?.values?(t.valueType!=null&&t.valueType!==`UInt32`&&(_().warn(`Unsupported indexed geometry indices type '${t.valueType}', only UInt32 is currently supported`),r=!1),t.valuesPerElement!=null&&t.valuesPerElement!==1&&(_().warn(`Unsupported indexed geometry values per element '${t.valuesPerElement}', only 1 is currently supported`),r=!1)):(_().warn(`Indexed geometry does not specify face indices for '${n}' attribute`),r=!1)}break}default:_().warn(`Unsupported topology '${n}'`),r=!1}e.params.material||(_().warn(`Geometry requires material`),r=!1);let i=e.params.vertexAttributes;for(let e in i)i[e].values||(_().warn(`Geometries with externally defined attributes are not yet supported`),r=!1);return r}function C(e,t){let n=[],r=[],i=[],o=new a,l=e.resource,u=s.parse(l.version||`1.0`,`wosr`);O.validate(u);let f=l.model.name,_=l.model.geometries,v=l.materialDefinitions??{},y=e.textures,b=0,x=new Map;for(let e=0;e<_.length;e++){let a=_[e];if(!S(a))continue;let s=D(a),l=a.params.vertexAttributes,u=[],f=e=>{if(a.params.topology===`PerAttributeArray`)return null;let t=a.params.faces;for(let n in t)if(n===e)return t[n].values;return null},C=l.position,w=C.values.length/C.valuesPerElement;for(let e in l){let t=l[e],n=t.values,r=f(e)??d(w);u.push([e,new p(n,r,t.valuesPerElement,!0)])}let T=s.texture,O=y&&y[T];if(O&&!x.has(T)){let{image:e,parameters:t}=O,n=new h(e,t);r.push(n),x.set(T,n)}let k=x.get(T),A=k?k.id:void 0,j=s.material,M=o.get(j,T);if(M==null){let e=v[j.slice(j.lastIndexOf(`/`)+1)].params;e.transparency===1&&(e.transparency=0);let n=O?E(O.alphaChannelUsage):void 0,r={ambient:c(e.diffuse),diffuse:c(e.diffuse),opacity:1-(e.transparency||0),textureAlphaMode:n,textureAlphaCutoff:.33,textureId:A,doubleSided:!0,cullFace:0,colorMixMode:e.externalColorMixMode||`tint`,textureAlphaPremultiplied:O?.parameters.preMultiplyAlpha??!1};t?.materialParameters&&Object.assign(r,t.materialParameters),M=new g(r,t.spherical),o.set(j,T,M)}i.push(M);let N=new m(M,u);b+=u.find(e=>e[0]===`position`)?.[1]?.indices.length??0,n.push(N)}return{engineResources:[{name:f,stageResources:{textures:r,materials:i,geometries:n},pivotOffset:l.model.pivotOffset,numberOfVertices:b,lodThreshold:null}],referenceBoundingBox:w(n)}}function w(e){let t=l();return e.forEach(e=>{let n=e.boundingInfo;n!=null&&u(t,n.box)}),t}async function T(e,t){let n=[];for(let r in e){let i=e[r],a=i.images[0].data;if(!a){_().warn(`Externally referenced texture data is not yet supported`);continue}let o=i.encoding+`;base64,`+a,s=`/textureDefinitions/`+r,c=i.channels===`rgba`?i.alphaChannelUsage||`transparency`:`none`,l={noUnpackFlip:!0,wrap:{s:10497,t:10497},preMultiplyAlpha:E(c)!==1},u=t?.disableTextures?Promise.resolve(null):f(o,t);n.push(u.then(e=>({refId:s,image:e,parameters:l,alphaChannelUsage:c})))}let r=await Promise.all(n),i={};for(let e of r)i[e.refId]=e;return i}function E(e){switch(e){case`mask`:return 2;case`maskAndTransparency`:return 3;case`none`:return 1;case`transparency`:return 0;default:return 0}}function D(e){let t=e.params;return{id:1,material:t.material,texture:t.texture,region:t.texture}}const O=new s(1,2,`wosr`);export{v as LoaderResultWOSR,T as createTextureResources,y as load,C as processLoadResult};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{property as n,subclass as r}from"../../../../core/accessorSupport/decorators.js";import{ExtentSet as i}from"../graphics/ExtentSet.js";import{TaskPriority as a}from"../../../support/Scheduler.js";let o=class extends t{constructor(e,t,n,r){super({}),this._updateExtent=t,this._updateNode=n,this._getElevationMode=r,this.readyToRun=!1,this._extentSet=new i,this._nodeSet=new Set;let a=this._taskPriority,o=e.registerTask(this._taskPriority,this);this.addHandles(o),this._task=o,this._lastTaskPriority=a}destroy(){this._extentSet.destroy()}get _taskPriority(){let e=this._getElevationMode();return e&&e===1?a.ELEVATION_ALIGNMENT_SCENE:a.ELEVATION_ALIGNMENT}_updateTaskPriority(){let e=this._taskPriority;e!==this._lastTaskPriority&&(this._task.priority=e,this._lastTaskPriority=e)}addExtent(e){this._extentSet.add(e),this._updateTaskPriority(),this.readyToRun=!0}schedule(e){this._nodeSet.add(e),this._updateTaskPriority(),this.readyToRun=!0}remove(e){this._nodeSet.delete(e),this._updateRunning()}runTask(e){let t=this._extentSet;for(e.run(()=>t.merge(e));!t.empty&&!e.done;)this._updateExtent(t.pop())?.forAll(e=>this.schedule(e)),e.madeProgress();if(e.done)return;let n=this._nodeSet;for(let t of n)if(n.delete(t),this._updateNode(t),e.madeProgress(),e.done)break;this._updateRunning()}_updateRunning(){this.readyToRun=this._nodeSet.size>0||this._extentSet.size>0}};e([n()],o.prototype,`readyToRun`,void 0),o=e([r(`esri.views.3d.layers.i3s.I3SAsyncElevationUpdater`)],o);export{o as I3SAsyncElevationUpdater};
2
+ import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{property as n,subclass as r}from"../../../../core/accessorSupport/decorators.js";import{ExtentSet as i}from"../graphics/ExtentSet.js";import{TaskPriority as a}from"../../../support/Scheduler.js";let o=class extends t{constructor(e,t,n,r){super(),this._updateExtent=t,this._updateNode=n,this._getElevationMode=r,this.readyToRun=!1,this._extentSet=new i,this._nodeSet=new Set;let a=this._taskPriority,o=e.registerTask(this._taskPriority,this);this.addHandles(o),this._task=o,this._lastTaskPriority=a}destroy(){this._extentSet.destroy()}get _taskPriority(){let e=this._getElevationMode();return e&&e===1?a.ELEVATION_ALIGNMENT_SCENE:a.ELEVATION_ALIGNMENT}_updateTaskPriority(){let e=this._taskPriority;e!==this._lastTaskPriority&&(this._task.priority=e,this._lastTaskPriority=e)}addExtent(e){this._extentSet.add(e),this._updateTaskPriority(),this.readyToRun=!0}schedule(e){this._nodeSet.add(e),this._updateTaskPriority(),this.readyToRun=!0}remove(e){this._nodeSet.delete(e),this._updateRunning()}runTask(e){let t=this._extentSet;for(e.run(()=>t.merge(e));!t.empty&&!e.done;)this._updateExtent(t.pop())?.forAll(e=>this.schedule(e)),e.madeProgress();if(e.done)return;let n=this._nodeSet;for(let t of n)if(n.delete(t),this._updateNode(t),e.madeProgress(),e.done)break;this._updateRunning()}_updateRunning(){this.readyToRun=this._nodeSet.size>0||this._extentSet.size>0}};e([n()],o.prototype,`readyToRun`,void 0),o=e([r(`esri.views.3d.layers.i3s.I3SAsyncElevationUpdater`)],o);export{o as I3SAsyncElevationUpdater};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import e from"../../../../core/Error.js";import{assertIsSome as t}from"../../../../core/maybe.js";import{MinPriority as n}from"../../../../core/MemCache.js";import{throwIfAborted as r}from"../../../../core/promiseUtils.js";import{generateUUID as i}from"../../../../core/uuid.js";import{normalFromMat4 as a}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as o}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{exactEquals as s}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{ONES as c}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{projectBoundingSphere as l}from"../../../../geometry/projection/projectBoundingSphere.js";import{ensurePackedArray as u}from"../../../../geometry/support/DoubleArray.js";import{isRelativeVertexSpace as d}from"../../../../geometry/support/meshVertexSpaceUtils.js";import{Sphere as f}from"../../../../geometry/support/sphere.js";import{CachedMeshData as p}from"./CachedMeshData.js";import{convertMeshMaterialToPBRMaterial as m}from"./I3SClientMaterialUtil.js";class h{constructor(e,t,n,r,i,a){this.id=e,this.version=t,this.mbs=n,this.oid=r,this.componentNodeIds=i,this.unloadedMesh=a,this.type=`mesh`}}class g{constructor(e,t,n){this.id=e,this.meshNodeInfo=t,this.componentIndex=n,this.type=`mesh-component`,this.textureData=new Map}get mbs(){return this.meshNodeInfo.mbs}}class _{constructor(e,t,n,r){this._uid=e,this._worker=r,this._id2Meta=new Map,this._oid2Meta=new Map,this._indexSR=t.indexSR,this._vertexSR=t.vertexSR,this._renderSR=t.renderSR,this._memCache=n.newCache(`sl-client-mesh-data-${this._uid}`)}get uid(){return this._uid}get worker(){return this._worker}get indexSR(){return this._indexSR}get renderSR(){return this._renderSR}createMeshNodeInfo(e,t){let n=`mesh${t}`,r=e.extent,i=r.spatialReference,a=this._indexSR,o=y(r,e.origin);l(o,i,o,a);let s=C(e);return new h(n,s,o,t,[],e)}addMeshNode(t,n){if(this.getMeshNodeIndex(n.oid)!=null)throw new e(`scenelayer`,`I3SClientNodeLoader: client side mesh for feature oid=${n.oid} already exists`);n.nodeIndex=t,this._id2Meta.set(n.id,n),this._oid2Meta.set(n.oid,n)}getMeshNodeIndex(e){let t=this._oid2Meta.get(e);return t==null||t.type!==`mesh`?null:t.nodeIndex}getMeshNodeInfo(e){let t=this._oid2Meta.values();for(let n of t)if(n.type===`mesh`&&n.id===e)return n;return null}removeNode(e){let t=this._id2Meta.get(e);t!=null&&(this._id2Meta.delete(e),t.type===`mesh`&&this._oid2Meta.delete(t.oid))}async loadNodeJSON(t){let n=this._id2Meta.get(t);if(n==null)throw new e(`scenelayer`,`I3SClientNodeLoader::loadNodeJSON unable to find node ${t}`);switch(n.type){case`mesh`:return this._loadMeshNodeJSON(n);case`mesh-component`:return v(n);default:throw new e(`scenelayer`,`I3SClientNodeLoader::loadNodeJSON unable to handle node ${t}`)}}async _loadMeshNodeJSON(e){let t=e.id,n=(await this._getMeshData(e)).loadedMesh;if(n.components==null||n.components.length===0)return{id:t,mbs:e.mbs.toVec4()};let r=[],i=n.components;for(let n=0;n<i.length;++n){let i=`${t}-component${n}`,a=new g(i,e,n);this._id2Meta.set(a.id,a),e.componentNodeIds.push(i),r.push({id:a.id,mbs:a.mbs.toVec4()})}return{id:t,mbs:e.mbs.toVec4(),children:r}}updateNodeIndex(e,t,n){let r=this._id2Meta.get(e);r?.type===`mesh`&&(r.nodeIndex=n)}async loadNodeData(n,i){let a=this._id2Meta.get(n);if(a==null||a.type!==`mesh-component`)throw new e(`scenelayer`,`Failed to load client node data for node ${n} (unexpected node info)`);let o=a.meshNodeInfo,s=await this._getMeshData(o),c=s.loadedMesh,l=o.oid;if(c.components==null)throw new e(`scenelayer`,`Failed to load client node data for node ${n} (unexpected null reference)`);let d=c.components[a.componentIndex],{material:f,requiredTextures:p,textureData:h}=await m(d.material);if(h!=null)for(let e of h)e!=null&&a.textureData.set(e.id,e);let{vertexSpace:g,origin:_,transform:v}=c,y=[_.x,_.y,_.z??0];s.projectionPromise||=(t(this._worker,`SceneLayerWorker is needed to project mesh`),this._worker.project({positions:c.vertexAttributes.position,localMatrix:v?.localMatrix,vertexSpace:g.toJSON(),origin:y,inSpatialReference:c.spatialReference.toJSON(),outSpatialReference:this._vertexSR.toJSON()},i));let{projected:S,original:C,projectedOrigin:w}=await s.projectionPromise,T=u(w);c.vertexAttributes.position=C;let{transformed:E,original:D}=await b(d,s,this._worker,i);c.vertexAttributes.normal=D,r(i);let{geometryBuffer:O,geometryDescriptor:k}=x(S,d.faces,E,c.vertexAttributes.uv,c.vertexAttributes.color,l);return{geometryData:{featureDataPosition:T,featureIds:[],geometries:[{params:{material:f},type:`ArrayBufferView`}]},attributeDataInfo:{attributeData:{},loadedAttributes:[]},geometryBuffer:O,geometryDescriptor:k,requiredTextures:p,textureData:h,normalReferenceFrame:this._vertexSR.isGeographic?`east-north-up`:`vertex-reference-frame`}}async loadAttributes(e,t){let n=e.numFeatures,r={};for(let{field:{name:e}}of t)r[e]=Array(n);return r}async loadTextures(e,t){let n=e.id,r=this._id2Meta.get(n);if(r==null||r.type!==`mesh-component`)throw Error(`Failed to load textures for node ${e.id} (unexpected node info)`);let i=[];for(let e of t)i.push(r.textureData.get(e.id)||null);return i}async _getMeshData(e){let t=e.version;return this._memCache.get(t)??(e.loadMeshPromise??=(async()=>{let r=e.unloadedMesh.clone();await r.load();let i=new p(r);return this._memCache.put(t,i,n),e.loadMeshPromise=null,i})(),e.loadMeshPromise)}}async function v(e){return{id:e.id,version:e.meshNodeInfo.version,mbs:e.mbs.toVec4(),isEmpty:!1}}function y(e,t){let{spatialReference:n}=e,r=[1,-1],i=[e.width*.5,e.height*.5,e.hasZ?(e.zmax-e.zmin)*.5:0],a=n.isGeographic?n.metersPerUnit:1,o=e.center,s=0;if(e.hasZ)for(let e=0;e<2;++e)for(let n=0;n<2;++n)for(let c=0;c<2;++c){let l=(o.x+r[e]*i[0]-t.x)*a,u=(o.y+r[n]*i[1]-t.y)*a,d=o.z+r[c]*i[2]-t.z;s=Math.max(l*l+u*u+d*d,s)}else for(let e=0;e<2;++e)for(let n=0;n<2;++n){let c=(o.x+r[e]*i[0]-t.x)*a,l=(o.y+r[n]*i[1]-t.y)*a;s=Math.max(c*c+l*l,s)}return new f(t.x,t.y,t.z??0,Math.sqrt(s))}async function b(e,n,r,i){let{transform:l,vertexAttributes:u}=n.loadedMesh,d=e.shading===`source`?u.normal:null;if(d==null||l==null||l.rotationAngle===0&&s(l.scale,c))return{transformed:d,original:u.normal};if(!n.normalsTransformPromise){t(r,`SceneLayerWorker is needed to transform mesh normals`);let e=o();a(e,l.localMatrix),n.normalsTransformPromise=r.transformNormals({normalMatrix:e,normals:d},i)}return n.normalsTransformPromise}function x(e,t,n,r,i,a){let o=(t?.length??0)/3,s=o*3,c=w+w,l=c;c+=s*3*T;let u=n!=null,d=c;u&&(c+=s*3*T);let f=r!=null,p=c;f&&(c+=s*2*T);let m=i!=null,h=c;m&&(c+=s*4*E);let g=c;c+=1*D;let _=c;c+=2*w;let v=new ArrayBuffer(c),y=new Uint8Array(v);S(y,0,s),S(y,w,1);let b=new Float32Array(v,l),x=n==null?null:new Float32Array(v,d),C=r==null?null:new Float32Array(v,p),O=i==null?null:new Uint8Array(v,h);for(let a=0;a<o;++a){let o=a*3;for(let s=0;s<3;++s){let c=t[o+s],l=c*3,u=a*9+s*3;if(b[u]=e[l],b[u+1]=e[l+1],b[u+2]=e[l+2],x&&(x[u]=n[l],x[u+1]=n[l+1],x[u+2]=n[l+2]),C){let e=c*2,t=a*6+s*2;C[t]=r[e],C[t+1]=r[e+1]}if(O){let e=c*4,t=a*12+s*4;O[t]=i[e],O[t+1]=i[e+1],O[t+2]=i[e+2],O[t+3]=i[e+3]}}}return S(y,g,a),S(y,g+w,a/2**32),S(y,_,0),S(y,_+w,o-1),{geometryBuffer:v,geometryDescriptor:{isDraco:!1,isLegacy:!0,color:m,normal:u,uv0:f,uvRegion:!1,featureIndex:!0}}}function S(e,t,n){e[t]=255&n,e[t+1]=255&n>>8,e[t+2]=255&n>>16,e[t+3]=255&n>>24}function C(e){let t=e.metadata.displaySource?.source;if(t?.type!==`service`)return i();let n=t.assets.reduce((e,t)=>e+t.makeHash(),``),r=JSON.stringify(e.transform?.toJSON()??``),a=d(e.vertexSpace)?JSON.stringify(e.vertexSpace.origin):``,o=JSON.stringify(e.spatialReference);return n+r+a+o}const w=4,T=4,E=1,D=8;export{g as ClientMeshComponentNodeInfo,h as ClientMeshNodeInfo,_ as I3SClientNodeLoader,y as createSphereFromExtent,T as sizeOfFloat32,w as sizeOfInt32,D as sizeOfUInt64,E as sizeOfUInt8,b as transformNormals};
2
+ import e from"../../../../core/Error.js";import{assertIsSome as t}from"../../../../core/maybe.js";import{MinPriority as n}from"../../../../core/MemCache.js";import{throwIfAborted as r}from"../../../../core/promiseUtils.js";import{generateUUID as i}from"../../../../core/uuid.js";import{normalFromMat4 as a}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as o}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{exactEquals as s}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{ONES as c}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{projectBoundingSphere as l}from"../../../../geometry/projection/projectBoundingSphere.js";import{ensurePackedArray as u}from"../../../../geometry/support/DoubleArray.js";import{isRelativeVertexSpace as d}from"../../../../geometry/support/meshVertexSpaceUtils.js";import{Sphere as f}from"../../../../geometry/support/sphere.js";import{CachedMeshData as p}from"./CachedMeshData.js";import{convertMeshMaterialToPBRMaterial as m}from"./I3SClientMaterialUtil.js";class h{constructor(e,t,n,r,i,a){this.id=e,this.version=t,this.mbs=n,this.oid=r,this.componentNodeIds=i,this.unloadedMesh=a,this.type=`mesh`}}class g{constructor(e,t,n){this.id=e,this.meshNodeInfo=t,this.componentIndex=n,this.type=`mesh-component`,this.textureData=new Map}get mbs(){return this.meshNodeInfo.mbs}}class _{constructor(e,t,n,r){this._uid=e,this._worker=r,this._id2Meta=new Map,this._oid2Meta=new Map,this._indexSR=t.indexSR,this._vertexSR=t.vertexSR,this._renderSR=t.renderSR,this._memCache=n.newCache(`sl-client-mesh-data-${this._uid}`)}get uid(){return this._uid}get worker(){return this._worker}get indexSR(){return this._indexSR}get renderSR(){return this._renderSR}createMeshNodeInfo(e,t){let n=`mesh${t}`,r=e.extent,i=r.spatialReference,a=this._indexSR,o=y(r,e.origin);l(o,i,o,a);let s=C(e);return new h(n,s,o,t,[],e)}addMeshNode(t,n){if(this.getMeshNodeIndex(n.oid)!=null)throw new e(`scenelayer`,`I3SClientNodeLoader: client side mesh for feature oid=${n.oid} already exists`);n.nodeIndex=t,this._id2Meta.set(n.id,n),this._oid2Meta.set(n.oid,n)}getMeshNodeIndex(e){let t=this._oid2Meta.get(e);return t==null||t.type!==`mesh`?null:t.nodeIndex}getMeshNodeInfo(e){let t=this._oid2Meta.values();for(let n of t)if(n.type===`mesh`&&n.id===e)return n;return null}removeNode(e){let t=this._id2Meta.get(e);t!=null&&(this._id2Meta.delete(e),t.type===`mesh`&&this._oid2Meta.delete(t.oid))}async loadNodeJSON(t){let n=this._id2Meta.get(t);if(n==null)throw new e(`scenelayer`,`I3SClientNodeLoader::loadNodeJSON unable to find node ${t}`);switch(n.type){case`mesh`:return this._loadMeshNodeJSON(n);case`mesh-component`:return v(n);default:throw new e(`scenelayer`,`I3SClientNodeLoader::loadNodeJSON unable to handle node ${t}`)}}async _loadMeshNodeJSON(e){let t=e.id,n=(await this._getMeshData(e)).loadedMesh;if(n.components==null||n.components.length===0)return{id:t,mbs:e.mbs.toVec4()};let r=[],i=n.components;for(let n=0;n<i.length;++n){let i=`${t}-component${n}`,a=new g(i,e,n);this._id2Meta.set(a.id,a),e.componentNodeIds.push(i),r.push({id:a.id,mbs:a.mbs.toVec4()})}return{id:t,mbs:e.mbs.toVec4(),children:r}}updateNodeIndex(e,t,n){let r=this._id2Meta.get(e);r?.type===`mesh`&&(r.nodeIndex=n)}async loadNodeData(n,i){let a=this._id2Meta.get(n);if(a==null||a.type!==`mesh-component`)throw new e(`scenelayer`,`Failed to load client node data for node ${n} (unexpected node info)`);let o=a.meshNodeInfo,s=await this._getMeshData(o),c=s.loadedMesh,l=o.oid;if(c.components==null)throw new e(`scenelayer`,`Failed to load client node data for node ${n} (unexpected null reference)`);let d=c.components[a.componentIndex],{material:f,requiredTextures:p,textureData:h}=await m(d.material);if(h!=null)for(let e of h)e!=null&&a.textureData.set(e.id,e);let{vertexSpace:g,origin:_,transform:v}=c,y=[_.x,_.y,_.z??0];s.projectionPromise||=(t(this._worker,`SceneLayerWorker is needed to project mesh`),this._worker.project({positions:c.vertexAttributes.position,localMatrix:v?.localMatrix,vertexSpace:g.toJSON(),origin:y,inSpatialReference:c.spatialReference.toJSON(),outSpatialReference:this._vertexSR.toJSON()},i));let{projected:S,original:C,projectedOrigin:w}=await s.projectionPromise,T=u(w);c.vertexAttributes.position=C;let{transformed:E,original:D}=await b(d,s,this._worker,i);c.vertexAttributes.normal=D,r(i);let{geometryBuffer:O,geometryDescriptor:k}=x(S,d.faces,E,c.vertexAttributes.uv,c.vertexAttributes.color,l);return{geometryData:{featureDataPosition:T,featureIds:[],geometries:[{params:{material:f},type:`ArrayBufferView`}]},attributeDataInfo:{attributeData:{},loadedAttributes:[]},geometryBuffer:O,geometryDescriptor:k,requiredTextures:p,textureData:h,normalReferenceFrame:this._vertexSR.isGeographic?`east-north-up`:`vertex-reference-frame`}}async loadAttributes(e,t){let n=e.numFeatures,r={};for(let{field:{name:e}}of t)r[e]=Array(n);return r}async loadTextures(e,t){let n=e.id,r=this._id2Meta.get(n);if(r==null||r.type!==`mesh-component`)throw Error(`Failed to load textures for node ${e.id} (unexpected node info)`);return Array.from(t,e=>r.textureData.get(e.id)||null)}async _getMeshData(e){let t=e.version;return this._memCache.get(t)??(e.loadMeshPromise??=(async()=>{let r=e.unloadedMesh.clone();await r.load();let i=new p(r);return this._memCache.put(t,i,n),e.loadMeshPromise=null,i})(),e.loadMeshPromise)}}async function v(e){return{id:e.id,version:e.meshNodeInfo.version,mbs:e.mbs.toVec4(),isEmpty:!1}}function y(e,t){let{spatialReference:n}=e,r=[1,-1],i=[e.width*.5,e.height*.5,e.hasZ?(e.zmax-e.zmin)*.5:0],a=n.isGeographic?n.metersPerUnit:1,o=e.center,s=0;if(e.hasZ)for(let e=0;e<2;++e)for(let n=0;n<2;++n)for(let c=0;c<2;++c){let l=(o.x+r[e]*i[0]-t.x)*a,u=(o.y+r[n]*i[1]-t.y)*a,d=o.z+r[c]*i[2]-t.z;s=Math.max(l*l+u*u+d*d,s)}else for(let e=0;e<2;++e)for(let n=0;n<2;++n){let c=(o.x+r[e]*i[0]-t.x)*a,l=(o.y+r[n]*i[1]-t.y)*a;s=Math.max(c*c+l*l,s)}return new f(t.x,t.y,t.z??0,Math.sqrt(s))}async function b(e,n,r,i){let{transform:l,vertexAttributes:u}=n.loadedMesh,d=e.shading===`source`?u.normal:null;if(d==null||l==null||l.rotationAngle===0&&s(l.scale,c))return{transformed:d,original:u.normal};if(!n.normalsTransformPromise){t(r,`SceneLayerWorker is needed to transform mesh normals`);let e=o();a(e,l.localMatrix),n.normalsTransformPromise=r.transformNormals({normalMatrix:e,normals:d},i)}return n.normalsTransformPromise}function x(e,t,n,r,i,a){let o=(t?.length??0)/3,s=o*3,c=w+w,l=c;c+=s*3*T;let u=n!=null,d=c;u&&(c+=s*3*T);let f=r!=null,p=c;f&&(c+=s*2*T);let m=i!=null,h=c;m&&(c+=s*4*E);let g=c;c+=1*D;let _=c;c+=2*w;let v=new ArrayBuffer(c),y=new Uint8Array(v);S(y,0,s),S(y,w,1);let b=new Float32Array(v,l),x=n==null?null:new Float32Array(v,d),C=r==null?null:new Float32Array(v,p),O=i==null?null:new Uint8Array(v,h);for(let a=0;a<o;++a){let o=a*3;for(let s=0;s<3;++s){let c=t[o+s],l=c*3,u=a*9+s*3;if(b[u]=e[l],b[u+1]=e[l+1],b[u+2]=e[l+2],x&&(x[u]=n[l],x[u+1]=n[l+1],x[u+2]=n[l+2]),C){let e=c*2,t=a*6+s*2;C[t]=r[e],C[t+1]=r[e+1]}if(O){let e=c*4,t=a*12+s*4;O[t]=i[e],O[t+1]=i[e+1],O[t+2]=i[e+2],O[t+3]=i[e+3]}}}return S(y,g,a),S(y,g+w,a/2**32),S(y,_,0),S(y,_+w,o-1),{geometryBuffer:v,geometryDescriptor:{isDraco:!1,isLegacy:!0,color:m,normal:u,uv0:f,uvRegion:!1,featureIndex:!0}}}function S(e,t,n){e[t]=255&n,e[t+1]=255&n>>8,e[t+2]=255&n>>16,e[t+3]=255&n>>24}function C(e){let t=e.metadata.displaySource?.source;if(t?.type!==`service`)return i();let n=t.assets.reduce((e,t)=>e+t.makeHash(),``),r=JSON.stringify(e.transform?.toJSON()??``),a=d(e.vertexSpace)?JSON.stringify(e.vertexSpace.origin):``,o=JSON.stringify(e.spatialReference);return n+r+a+o}const w=4,T=4,E=1,D=8;export{g as ClientMeshComponentNodeInfo,h as ClientMeshNodeInfo,_ as I3SClientNodeLoader,y as createSphereFromExtent,T as sizeOfFloat32,w as sizeOfInt32,D as sizeOfUInt64,E as sizeOfUInt8,b as transformNormals};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{destroyMaybe as n}from"../../../../core/maybe.js";import{watch as r,sync as i}from"../../../../core/reactiveUtils.js";import{property as a,subclass as o}from"../../../../core/accessorSupport/decorators.js";import s from"../../../../geometry/Extent.js";import{fallbackObjectIDAttribute as c}from"../../../../layers/LayerConstants.js";import{QueryEngine as l}from"../../../../layers/graphics/data/QueryEngine.js";import u from"../../../../layers/support/FieldsIndex.js";import d from"../../../../rest/support/FeatureSet.js";import f from"../../../../rest/support/Query.js";const p=l;let m=class extends t{constructor(e){super(e)}initialize(){this.addHandles(this.layerView.on(`visible-geometry-changed`,()=>this.spatialIndex.events.emit(`changed`))),this.addHandles(r(()=>this.layerView.availableFields,()=>this._dataQueryEngineInstance=n(this._dataQueryEngineInstance),i))}destroy(){this._dataQueryEngineInstance=n(this._dataQueryEngineInstance),this._set(`layerView`,null)}get spatialReference(){return this.layerView.view.spatialReference}get layer(){return this.layerView.layer}get defaultQueryJSON(){return new f({outSpatialReference:this.spatialReference}).toJSON()}get _dataQueryEngine(){return this._ensureDataQueryEngine()}async executeQueryForCount(e,t){return this._dataQueryEngine.executeQueryForCount(this._ensureQueryJSON(e),t)}async executeQueryForExtent(e,t){let{count:n,extent:r}=await this._dataQueryEngine.executeQueryForExtent(this._ensureQueryJSON(e),t);return{count:n,extent:s.fromJSON(r)}}async executeQueryForIds(e,t){return this._dataQueryEngine.executeQueryForIds(this._ensureQueryJSON(e),t)}async executeQuery(e,t){let n=this._ensureQueryJSON(e),r=await this._dataQueryEngine.executeQuery(n,t);if(e?.returnGeometry){let{processQueryGeometries:e}=await import(`./I3SQueryResultGeometry.js`);return e(this.layerView,r)}return d.fromJSON(r)}_ensureQueryJSON(e){return e==null?this.defaultQueryJSON:e.toJSON()}_ensureDataQueryEngine(){if(this._dataQueryEngineInstance)return this._dataQueryEngineInstance;let e=this.layer.objectIdField||c,t=this.layer.fieldsIndex?.toJSON()||new u([]),n=this.layerView.view.resourceController.scheduler,r=this.spatialReference.toJSON(),i=this.priority,a=this.spatialIndex,o=this.layerView.availableFields??[];return this._dataQueryEngineInstance=new p({hasZ:!0,hasM:!1,geometryType:`esriGeometryPolygon`,fieldsIndex:t,timeInfo:null,spatialReference:r,featureIdInfo:{type:`object-id`,fieldName:e},featureStore:a,scheduler:n,priority:i,availableFields:o}),this._dataQueryEngineInstance}};e([a({constructOnly:!0})],m.prototype,`layerView`,void 0),e([a({constructOnly:!0})],m.prototype,`priority`,void 0),e([a({constructOnly:!0})],m.prototype,`spatialIndex`,void 0),e([a()],m.prototype,`spatialReference`,null),e([a()],m.prototype,`layer`,null),e([a()],m.prototype,`defaultQueryJSON`,null),m=e([o(`esri.views.3d.layers.i3s.I3SQueryEngine`)],m);export{m as I3SQueryEngine};
2
+ import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{destroyMaybe as n}from"../../../../core/maybe.js";import{watch as r,sync as i}from"../../../../core/reactiveUtils.js";import{property as a,subclass as o}from"../../../../core/accessorSupport/decorators.js";import s from"../../../../geometry/Extent.js";import{fallbackObjectIDAttribute as c}from"../../../../layers/LayerConstants.js";import{QueryEngine as l}from"../../../../layers/graphics/data/QueryEngine.js";import u from"../../../../layers/support/FieldsIndex.js";import d from"../../../../rest/support/FeatureSet.js";import f from"../../../../rest/support/Query.js";const p=l;let m=class extends t{constructor(e){super(e)}initialize(){this.addHandles(this.layerView.on(`visible-geometry-changed`,()=>this.spatialIndex.events.emit(`changed`))),this.addHandles(r(()=>[this.layerView.availableFields,this.layer.timeInfo?.toJSON()],()=>this._dataQueryEngineInstance=n(this._dataQueryEngineInstance),i))}destroy(){this._dataQueryEngineInstance=n(this._dataQueryEngineInstance),this._set(`layerView`,null)}get spatialReference(){return this.layerView.view.spatialReference}get layer(){return this.layerView.layer}get defaultQueryJSON(){return new f({outSpatialReference:this.spatialReference}).toJSON()}get _dataQueryEngine(){return this._ensureDataQueryEngine()}async executeQueryForCount(e,t){return this._dataQueryEngine.executeQueryForCount(this._ensureQueryJSON(e),t)}async executeQueryForExtent(e,t){let{count:n,extent:r}=await this._dataQueryEngine.executeQueryForExtent(this._ensureQueryJSON(e),t);return{count:n,extent:s.fromJSON(r)}}async executeQueryForIds(e,t){return this._dataQueryEngine.executeQueryForIds(this._ensureQueryJSON(e),t)}async executeQuery(e,t){let n=this._ensureQueryJSON(e),r=await this._dataQueryEngine.executeQuery(n,t);if(e?.returnGeometry){let{processQueryGeometries:e}=await import(`./I3SQueryResultGeometry.js`);return e(this.layerView,r)}return d.fromJSON(r)}_ensureQueryJSON(e){return e==null?this.defaultQueryJSON:e.toJSON()}_ensureDataQueryEngine(){if(this._dataQueryEngineInstance)return this._dataQueryEngineInstance;let e=this.layer.objectIdField||c,t=this.layer.fieldsIndex?.toJSON()||new u([]),n=this.layerView.view.resourceController.scheduler,r=this.spatialReference.toJSON(),i=this.priority,a=this.spatialIndex,o=this.layerView.availableFields??[];return this._dataQueryEngineInstance=new p({hasZ:!0,hasM:!1,geometryType:`esriGeometryPolygon`,fieldsIndex:t,timeInfo:this.layer.timeInfo?.toJSON(),spatialReference:r,featureIdInfo:{type:`object-id`,fieldName:e},featureStore:a,scheduler:n,priority:i,availableFields:o}),this._dataQueryEngineInstance}};e([a({constructOnly:!0})],m.prototype,`layerView`,void 0),e([a({constructOnly:!0})],m.prototype,`priority`,void 0),e([a({constructOnly:!0})],m.prototype,`spatialIndex`,void 0),e([a()],m.prototype,`spatialReference`,null),e([a()],m.prototype,`layer`,null),e([a()],m.prototype,`defaultQueryJSON`,null),m=e([o(`esri.views.3d.layers.i3s.I3SQueryEngine`)],m);export{m as I3SQueryEngine};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{EventedAccessor as t}from"../../../../core/Evented.js";import n from"../../../../core/Logger.js";import{property as r,subclass as i}from"../../../../core/accessorSupport/decorators.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/quatf64.js";import{set as o,transformQuatValues as s}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{canProjectWithoutEngine as l}from"../../../../geometry/projectionUtils.js";import{projectBoundingRect as u}from"../../../../geometry/projection/projectBoundingRect.js";import{projectBoundingSphere as d}from"../../../../geometry/projection/projectBoundingSphere.js";import{create as f,allFinite as p,fromExtent as m}from"../../../../geometry/support/aaBoundingRect.js";import{getInfo as h}from"../../../../geometry/support/spatialReferenceUtils.js";import{Sphere as g}from"../../../../geometry/support/sphere.js";import{ElevationRange as _}from"../../support/ElevationRange.js";import{ElevationUpdateEvent as v}from"../../support/ElevationUpdateEvent.js";import{ProjectedElevationUpdateExtent as y,calculateElevationUpdateExtents as b,fullWorldElevationUpdateExtent as x,planetCenterProximityToleranceMeters as S}from"../../support/elevationUpdateExtentUtils.js";import{Intersector as C}from"../../webgl-engine/lib/Intersector.js";let w=class extends t{constructor(e){super(e),this._renderCoordsHelper=e.view.renderCoordsHelper,this._renderSR=this._renderCoordsHelper.spatialReference,this._layerElevationSource=e.layerElevationSource,this._projectedExtent=new y(this._renderCoordsHelper)}initialize(){this._intersector=new C(this.view.state.viewingMode),this._intersector.options.store=0,this._intersector.options.normalRequired=!1}get spatialReference(){return this.view?.elevationProvider?.spatialReference}getElevation(e,t,r,i){let a=this._renderCoordsHelper,s=o(E,e,t,r);if(!a.toRenderCoords(s,i,s))return n.getLogger(this).error(`could not project point to compute elevation`),null;let{layerElevationSource:c,_intersector:l,intersectionHandler:u}=this,d=c.elevationRange;if(d==null||d.isEmpty)return null;let f=d.minElevation,p=d.maxElevation,m=Math.max(1,(p-f)/2),h=a.setAltitude(k,p+m,s),g=a.setAltitude(A,f-m,s);return l.reset(h,g,this.view.state.camera),u.intersectRay(l,null,h,g,null,!0),l.results.min.getIntersectionPoint(s)?a.getAltitude(s):null}getElevations(e,t,n){let{groundSpatialReference:r}=this.view;for(let i=0;i<t;++i){let t=i*3,a=e[t],o=e[t+1],s=this.getElevation(a,o,0,r);n(i,s)}}getSphereElevationRange(e,t){return d(e,t,T,this._renderSR),this._layerElevationSource.getElevationRange(T)}getRootElevationRange(){let e=this.layerElevationSource.fullExtent;return e?.hasZ?new _(e.zmin,e.zmax):null}notifyObjectsChanged(e){this._notifyObjectsChanged(e.length,t=>{for(let n of e)if(!t(n))break})}notifyObjectsChangedFunctional(e,t){this._notifyObjectsChanged(e,t)}notifyObjectChanged(e){this._notifyObjectsChanged(1,t=>{t(e)})}_notifyObjectsChanged(e,t){if(e===0)return;let n=this.spatialReference;if(n==null)return;if(!l(this._renderSR,n)){this._emitFullExtentElevationChange(n);return}let r=new Float64Array(4*e),i=!1,a=0;t(e=>this._computeObjectExtent(e,r,a,n)?(a++,!0):(i=!0,!1)),i?this._emitFullExtentElevationChange(n):this._emitElevationChangeEvents(r,n)}_computeObjectExtent(e,t,n,r){if(this.view.state.viewingMode===1&&P(e))return!1;let i=this._projectedExtent;return E[0]=e.centerX,E[1]=e.centerY,E[2]=e.centerZ,i.reset(E,e.radius,r),!this._expandExtent(e,i,r)||!p(i.extent)?!1:(t.set(i.extent,4*n),!0)}_emitElevationChangeEvents(e,t){for(let n of b(e,t))this._emitElevationChangeEvent(n,t)}_emitFullExtentElevationChange(e){let t=f(),n=this._layerElevationSource.fullExtent;if(n!=null&&u(m(n,M),n.spatialReference,t,e)&&p(t)){this._emitElevationChangeEvent(t,e);return}let r=h(e);r!=null&&this._emitElevationChangeEvent(x(e,r),e)}_emitElevationChangeEvent(e,t){let n=new v(t,e,this.intersectionHandler.isGround?`ground`:`scene`);this.emit(`elevation-change`,n)}_expandExtent(e,t,n){e.getCorners(O);for(let e=0;e<8;++e){let r=O[e];if(t.addRenderPoint(r,n)==null)return!1}for(let e=0;e<D.length;e+=2)if(!t.addRenderEdge(O[D[e]],O[D[e+1]],n))return!1;return!0}};e([r({constructOnly:!0})],w.prototype,`layerElevationSource`,void 0),e([r({constructOnly:!0})],w.prototype,`intersectionHandler`,void 0),e([r({constructOnly:!0})],w.prototype,`view`,void 0),e([r()],w.prototype,`spatialReference`,null),w=e([i(`esri.views.3d.layers.i3s.LayerElevationProvider`)],w);const T=new g,E=c(),D=[0,1,2,3,4,5,6,7,0,2,1,3,4,6,5,7,0,4,1,5,2,6,3,7],O=Array.from({length:8},()=>c()),k=c(),A=c(),j=a(),M=f(),N=c();function P(e){N[0]=-e.centerX,N[1]=-e.centerY,N[2]=-e.centerZ,e.getQuaternion(j),s(N,N,-j[0],-j[1],-j[2],j[3]);let t=Math.max(Math.abs(N[0])-e.halfSizeX,0),n=Math.max(Math.abs(N[1])-e.halfSizeY,0),r=Math.max(Math.abs(N[2])-e.halfSizeZ,0);return t*t+n*n+r*r<=S*S}export{w as LayerElevationProvider};
2
+ import{__decorate as e}from"tslib";import{EventedAccessor as t}from"../../../../core/Evented.js";import n from"../../../../core/Logger.js";import{property as r,subclass as i}from"../../../../core/accessorSupport/decorators.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/quatf64.js";import{set as o,transformQuatValues as s}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{canProjectWithoutEngine as l}from"../../../../geometry/projectionUtils.js";import{projectBoundingRect as u}from"../../../../geometry/projection/projectBoundingRect.js";import{projectBoundingSphere as d}from"../../../../geometry/projection/projectBoundingSphere.js";import{create as f,allFinite as p,fromExtent as m}from"../../../../geometry/support/aaBoundingRect.js";import{getInfo as h}from"../../../../geometry/support/spatialReferenceUtils.js";import{Sphere as g}from"../../../../geometry/support/sphere.js";import{ElevationRange as _}from"../../support/ElevationRange.js";import{ElevationUpdateEvent as v}from"../../support/ElevationUpdateEvent.js";import{ProjectedElevationUpdateExtent as y,calculateElevationUpdateExtents as b,fullWorldElevationUpdateExtent as x,planetCenterProximityToleranceMeters as S}from"../../support/elevationUpdateExtentUtils.js";import{Intersector as C}from"../../webgl-engine/lib/Intersector.js";let w=class extends t{constructor(e){super(e),this._renderCoordsHelper=e.view.renderCoordsHelper,this._renderSR=this._renderCoordsHelper.spatialReference,this._layerElevationSource=e.layerElevationSource,this._projectedExtent=new y(this._renderCoordsHelper)}initialize(){this._intersector=new C(this.view.state.viewingMode),this._intersector.options.store=0,this._intersector.options.normalRequired=!1}get spatialReference(){return this.view?.elevationProvider?.spatialReference}getElevation(e,t,r,i){let a=this._renderCoordsHelper,s=o(E,e,t,r);if(!a.toRenderCoords(s,i,s))return n.getLogger(this).error(`could not project point to compute elevation`),null;let{layerElevationSource:c,_intersector:l,intersectionHandler:u}=this,d=c.elevationRange;if(d==null||d.isEmpty)return null;let f=d.minElevation,p=d.maxElevation,m=Math.max(1,(p-f)/2),h=a.setAltitude(k,p+m,s),g=a.setAltitude(A,f-m,s);return l.reset(h,g,this.view.state.camera),u.intersectRay(l,null,h,g,null,!0),l.results.min.getIntersectionPoint(s)?a.getAltitude(s):null}getElevations(e,t,n){let{groundSpatialReference:r}=this.view;for(let i=0;i<t;++i){let t=i*3,a=e[t],o=e[t+1],s=this.getElevation(a,o,0,r);n(i,s)}}getSphereElevationRange(e,t){return d(e,t,T,this._renderSR),this._layerElevationSource.getElevationRange(T)}getRootElevationRange(){let e=this.layerElevationSource.fullExtent;return e?.hasZ?new _(e.zmin,e.zmax):null}notifyObjectsChanged(e){this._notifyObjectsChanged(e.length,t=>{for(let n of e)if(!t(n))break})}notifyObjectsChangedFunctional(e,t){this._notifyObjectsChanged(e,t)}notifyObjectChanged(e){this._notifyObjectsChanged(1,t=>{t(e)})}_notifyObjectsChanged(e,t){if(e===0)return;let n=this.spatialReference;if(n==null)return;if(!l(this._renderSR,n)){this._emitFullExtentElevationChange(n);return}let r=new Float64Array(4*e),i=!1,a=0;t(e=>this._computeObjectExtent(e,r,a,n)?(a++,!0):(i=!0,!1)),i?this._emitFullExtentElevationChange(n):this._emitElevationChangeEvents(r,n)}_computeObjectExtent(e,t,n,r){if(this.view.state.isGlobal&&P(e))return!1;let i=this._projectedExtent;return E[0]=e.centerX,E[1]=e.centerY,E[2]=e.centerZ,i.reset(E,e.radius,r),!this._expandExtent(e,i,r)||!p(i.extent)?!1:(t.set(i.extent,4*n),!0)}_emitElevationChangeEvents(e,t){for(let n of b(e,t))this._emitElevationChangeEvent(n,t)}_emitFullExtentElevationChange(e){let t=f(),n=this._layerElevationSource.fullExtent;if(n!=null&&u(m(n,M),n.spatialReference,t,e)&&p(t)){this._emitElevationChangeEvent(t,e);return}let r=h(e);r!=null&&this._emitElevationChangeEvent(x(e,r),e)}_emitElevationChangeEvent(e,t){let n=new v(t,e,this.intersectionHandler.isGround?`ground`:`scene`);this.emit(`elevation-change`,n)}_expandExtent(e,t,n){e.getCorners(O);for(let e=0;e<8;++e){let r=O[e];if(t.addRenderPoint(r,n)==null)return!1}for(let e=0;e<D.length;e+=2)if(!t.addRenderEdge(O[D[e]],O[D[e+1]],n))return!1;return!0}};e([r({constructOnly:!0})],w.prototype,`layerElevationSource`,void 0),e([r({constructOnly:!0})],w.prototype,`intersectionHandler`,void 0),e([r({constructOnly:!0})],w.prototype,`view`,void 0),e([r()],w.prototype,`spatialReference`,null),w=e([i(`esri.views.3d.layers.i3s.LayerElevationProvider`)],w);const T=new g,E=c(),D=[0,1,2,3,4,5,6,7,0,2,1,3,4,6,5,7,0,4,1,5,2,6,3,7],O=Array.from({length:8},()=>c()),k=c(),A=c(),j=a(),M=f(),N=c();function P(e){N[0]=-e.centerX,N[1]=-e.centerY,N[2]=-e.centerZ,e.getQuaternion(j),s(N,N,-j[0],-j[1],-j[2],j[3]);let t=Math.max(Math.abs(N[0])-e.halfSizeX,0),n=Math.max(Math.abs(N[1])-e.halfSizeY,0),r=Math.max(Math.abs(N[2])-e.halfSizeZ,0);return t*t+n*n+r*r<=S*S}export{w as LayerElevationProvider};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{EventedAccessor as t}from"../../../../core/Evented.js";import n from"../../../../core/Logger.js";import{getMetersPerVerticalUnitForSR as r}from"../../../../core/units.js";import{property as i,subclass as a}from"../../../../core/accessorSupport/decorators.js";import{copy as o}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as s,ZEROS as c}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{isEmpty as l,copy as u,center as d,diameter as f,squaredDistanceToPoint as p}from"../../../../geometry/support/aaBoundingBox.js";import{allFinite as m}from"../../../../geometry/support/aaBoundingRect.js";import{getInfo as h}from"../../../../geometry/support/spatialReferenceUtils.js";import{getMetersPerUnit as g}from"../../../../symbols/support/unitConversionUtils.js";import{ElevationUpdateEvent as _}from"../../support/ElevationUpdateEvent.js";import{ProjectedElevationUpdateExtent as v,calculateElevationUpdateExtents as y,fullWorldElevationUpdateExtent as b,planetCenterProximityToleranceMeters as x}from"../../support/elevationUpdateExtentUtils.js";import{affectsGeometry as S}from"../../webgl-engine/lib/affectsGeometry.js";import{Intersector as C}from"../../webgl-engine/lib/Intersector.js";const w=Symbol(`layerHandles`);let T=class extends t{get spatialReference(){return this.view.spatialReference}constructor(e){super(e),this._elevationOffset=0}initialize(){this._renderCoordsHelper=this.view.renderCoordsHelper,this._projectedExtent=new v(this._renderCoordsHelper),this._intersectLayers=[this.stageLayer],this._intersector=new C(this.view.state.viewingMode),this._intersector.options.store=0;let[e,t]=this._computeLayerElevationRange(this.spatialReference,this.stageLayer);this._zmin=e,this._zmax=t;let n=this.stageLayer.events;this.addHandles([n.on([`layerObjectAdded`,`layerObjectRemoved`,`transformationChanged`,`shaderTransformationChanged`],e=>this._objectChanged(e)),n.on(`geometriesChanged`,({object:e})=>this._objectChanged(e)),n.on(`attributesChanged`,({attribute:e,object:t})=>S(e)&&this._objectChanged(t))],w)}destroy(){this.removeHandles(w)}elevationInfoChanged(){let e=this.layer==null?null:this.layer.elevationInfo;if(e!=null&&e.mode!==`on-the-ground`){let t=r(this.layer.spatialReference),n=g(e.unit??`meters`);this._elevationOffset=(e.offset??0)*n/t}else this._elevationOffset=0}getElevation(e,t,r,i){if(j[0]=e,j[1]=t,j[2]=r,!this._renderCoordsHelper.toRenderCoords(j,i,j))return n.getLogger(this).error(`could not project point for elevation alignment`),null;let a=this._elevationOffset,o=this._zmin+a,s=this._zmax+a;return this._renderCoordsHelper.setAltitude(N,s,j),this._renderCoordsHelper.setAltitude(P,o,j),this._intersector.reset(N,P,null),this._intersector.intersect(this._intersectLayers,null,1,null,e=>!!e.lastValidElevationBB),this._intersector.results.min.getIntersectionPoint(j)?this._renderCoordsHelper.getAltitude(j):null}_objectChanged(e){let t=this.spatialReference;if(!e.lastValidElevationBB||!t)return;let n=e.lastValidElevationBB,{box:r,sphere:i}=e.boundingVolumeWorldSpace;if(this.view.state.viewingMode===1&&(!l(n)&&E(n)||E(r))){this._emitFullExtentElevationChange(t),u(n,r);return}let a=!l(n),o=new Float64Array(a?8:4),s=1/0,c=-1/0,d=!1;if(a&&(this._resetProjectedExtent(n,t),this._expandExtent(t,n,k,this._projectedExtent)||(d=!0),m(this._projectedExtent.extent)?(s=Math.min(s,k[0]),c=Math.max(c,k[1]),o.set(this._projectedExtent.extent)):d=!0),this._projectedExtent.reset(i.center,i.radius,t),this._expandExtent(t,r,D,this._projectedExtent)||(d=!0),m(this._projectedExtent.extent)?(s=Math.min(s,D[0]),c=Math.max(c,D[1]),o.set(this._projectedExtent.extent,a?4:0)):d=!0,d){this._emitFullExtentElevationChange(t),u(n,r);return}let f=y(o,t);f.length>0&&(this._zmin=Math.min(this._zmin,s),this._zmax=Math.max(this._zmax,c));for(let e of f)this._emitElevationChangeEvent(e,t);u(n,r)}_computeLayerElevationRange(e,t){let n=1/0,r=-1/0;return e!=null&&t.objects.forEach(t=>{this._expandExtent(e,t.boundingVolumeWorldSpace.box,O)&&(n=Math.min(n,O[0]),r=Math.max(r,O[1]))}),[n,r]}_expandExtent(e,t,n,r=null){n[0]=1/0,n[1]=-1/0;for(let i=0;i<8;++i){j[0]=t[i&1?0:3],j[1]=t[i&2?1:4],j[2]=t[i&4?2:5];let a=r==null?this._renderCoordsHelper.fromRenderCoords(j,j,e):r.addRenderPoint(j,e);if(a!=null)n[0]=Math.min(n[0],a[2]),n[1]=Math.max(n[1],a[2]);else if(r!=null)return!1;if(r!=null){for(let n=0;n<3;++n)if(!(i&1<<n)&&(o(M,j),M[n]=t[n],!r.addRenderEdge(j,M,e)))return!1}}return!0}_emitFullExtentElevationChange(e){let t=h(e);t!=null&&this._emitElevationChangeEvent(b(e,t),e)}_emitElevationChangeEvent(e,t){let n=new _(t,e);this.emit(`elevation-change`,n)}_resetProjectedExtent(e,t){d(e,A),this._projectedExtent.reset(A,.5*f(e),t)}};e([i({constructOnly:!0})],T.prototype,`layer`,void 0),e([i({constructOnly:!0})],T.prototype,`stageLayer`,void 0),e([i({constructOnly:!0})],T.prototype,`view`,void 0),e([i()],T.prototype,`spatialReference`,null),T=e([a(`esri.views.3d.layers.support.StageLayerElevationProvider`)],T);function E(e){return p(e,c)<=x*x}const D=new Float64Array(2),O=new Float64Array(2),k=new Float64Array(2),A=s(),j=s(),M=s(),N=s(),P=s();export{T as StageLayerElevationProvider};
2
+ import{__decorate as e}from"tslib";import{EventedAccessor as t}from"../../../../core/Evented.js";import n from"../../../../core/Logger.js";import{getMetersPerVerticalUnitForSR as r}from"../../../../core/units.js";import{property as i,subclass as a}from"../../../../core/accessorSupport/decorators.js";import{copy as o}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as s,ZEROS as c}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{isEmpty as l,copy as u,center as d,diameter as f,squaredDistanceToPoint as p}from"../../../../geometry/support/aaBoundingBox.js";import{allFinite as m}from"../../../../geometry/support/aaBoundingRect.js";import{getInfo as h}from"../../../../geometry/support/spatialReferenceUtils.js";import{getMetersPerUnit as g}from"../../../../symbols/support/unitConversionUtils.js";import{ElevationUpdateEvent as _}from"../../support/ElevationUpdateEvent.js";import{ProjectedElevationUpdateExtent as v,calculateElevationUpdateExtents as y,fullWorldElevationUpdateExtent as b,planetCenterProximityToleranceMeters as x}from"../../support/elevationUpdateExtentUtils.js";import{affectsGeometry as S}from"../../webgl-engine/lib/affectsGeometry.js";import{Intersector as C}from"../../webgl-engine/lib/Intersector.js";const w=Symbol(`layerHandles`);let T=class extends t{get spatialReference(){return this.view.spatialReference}constructor(e){super(e),this._elevationOffset=0}initialize(){this._renderCoordsHelper=this.view.renderCoordsHelper,this._projectedExtent=new v(this._renderCoordsHelper),this._intersectLayers=[this.stageLayer],this._intersector=new C(this.view.state.viewingMode),this._intersector.options.store=0;let[e,t]=this._computeLayerElevationRange(this.spatialReference,this.stageLayer);this._zmin=e,this._zmax=t;let n=this.stageLayer.events;this.addHandles([n.on([`layerObjectAdded`,`layerObjectRemoved`,`transformationChanged`,`shaderTransformationChanged`],e=>this._objectChanged(e)),n.on(`geometriesChanged`,({object:e})=>this._objectChanged(e)),n.on(`attributesChanged`,({attribute:e,object:t})=>S(e)&&this._objectChanged(t))],w)}destroy(){this.removeHandles(w)}elevationInfoChanged(){let e=this.layer==null?null:this.layer.elevationInfo;if(e!=null&&e.mode!==`on-the-ground`){let t=r(this.layer.spatialReference),n=g(e.unit??`meters`);this._elevationOffset=(e.offset??0)*n/t}else this._elevationOffset=0}getElevation(e,t,r,i){if(j[0]=e,j[1]=t,j[2]=r,!this._renderCoordsHelper.toRenderCoords(j,i,j))return n.getLogger(this).error(`could not project point for elevation alignment`),null;let a=this._elevationOffset,o=this._zmin+a,s=this._zmax+a;return this._renderCoordsHelper.setAltitude(N,s,j),this._renderCoordsHelper.setAltitude(P,o,j),this._intersector.reset(N,P,this.stageLayer.stage.view.state.camera),this._intersector.intersect(this._intersectLayers,null,1,null,e=>!!e.lastValidElevationBB),this._intersector.results.min.getIntersectionPoint(j)?this._renderCoordsHelper.getAltitude(j):null}_objectChanged(e){let t=this.spatialReference;if(!e.lastValidElevationBB||!t)return;let n=e.lastValidElevationBB,{box:r,sphere:i}=e.boundingVolumeWorldSpace;if(this.view.state.isGlobal&&(!l(n)&&E(n)||E(r))){this._emitFullExtentElevationChange(t),u(n,r);return}let a=!l(n),o=new Float64Array(a?8:4),s=1/0,c=-1/0,d=!1;if(a&&(this._resetProjectedExtent(n,t),this._expandExtent(t,n,k,this._projectedExtent)||(d=!0),m(this._projectedExtent.extent)?(s=Math.min(s,k[0]),c=Math.max(c,k[1]),o.set(this._projectedExtent.extent)):d=!0),this._projectedExtent.reset(i.center,i.radius,t),this._expandExtent(t,r,D,this._projectedExtent)||(d=!0),m(this._projectedExtent.extent)?(s=Math.min(s,D[0]),c=Math.max(c,D[1]),o.set(this._projectedExtent.extent,a?4:0)):d=!0,d){this._emitFullExtentElevationChange(t),u(n,r);return}let f=y(o,t);f.length>0&&(this._zmin=Math.min(this._zmin,s),this._zmax=Math.max(this._zmax,c));for(let e of f)this._emitElevationChangeEvent(e,t);u(n,r)}_computeLayerElevationRange(e,t){let n=1/0,r=-1/0;return e!=null&&t.objects.forEach(t=>{this._expandExtent(e,t.boundingVolumeWorldSpace.box,O)&&(n=Math.min(n,O[0]),r=Math.max(r,O[1]))}),[n,r]}_expandExtent(e,t,n,r=null){n[0]=1/0,n[1]=-1/0;for(let i=0;i<8;++i){j[0]=t[i&1?0:3],j[1]=t[i&2?1:4],j[2]=t[i&4?2:5];let a=r==null?this._renderCoordsHelper.fromRenderCoords(j,j,e):r.addRenderPoint(j,e);if(a!=null)n[0]=Math.min(n[0],a[2]),n[1]=Math.max(n[1],a[2]);else if(r!=null)return!1;if(r!=null){for(let n=0;n<3;++n)if(!(i&1<<n)&&(o(M,j),M[n]=t[n],!r.addRenderEdge(j,M,e)))return!1}}return!0}_emitFullExtentElevationChange(e){let t=h(e);t!=null&&this._emitElevationChangeEvent(b(e,t),e)}_emitElevationChangeEvent(e,t){let n=new _(t,e);this.emit(`elevation-change`,n)}_resetProjectedExtent(e,t){d(e,A),this._projectedExtent.reset(A,.5*f(e),t)}};e([i({constructOnly:!0})],T.prototype,`layer`,void 0),e([i({constructOnly:!0})],T.prototype,`stageLayer`,void 0),e([i({constructOnly:!0})],T.prototype,`view`,void 0),e([i()],T.prototype,`spatialReference`,null),T=e([a(`esri.views.3d.layers.support.StageLayerElevationProvider`)],T);function E(e){return p(e,c)<=x*x}const D=new Float64Array(2),O=new Float64Array(2),k=new Float64Array(2),A=s(),j=s(),M=s(),N=s(),P=s();export{T as StageLayerElevationProvider};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import{deg2rad as n,rad2deg as r}from"../../../core/mathUtils.js";import{watch as i,sync as a,initial as o}from"../../../core/reactiveUtils.js";import{property as s,subclass as c}from"../../../core/accessorSupport/decorators.js";import{applyAll as l}from"../camera/constraintUtils.js";import{surfaceElevationBelowRenderLocation as u}from"../camera/intersectionUtils.js";import{ConstraintOptions as d}from"../camera/constraintUtils/ConstraintOptions.js";import{createNearFarHeuristic as f}from"./NearFarHeuristic.js";import{SurfaceCollisionConstraint as p}from"./SurfaceCollisionConstraint.js";let m=class extends t{constructor(e){super(e),this.nearFarHeuristic=f(e.view.state.viewingMode,e.view.groundView,e.view.renderCoordsHelper.spatialReference)}initialize(){let e=()=>this._updateNearFar();this.addHandles([i(()=>[this.view.constraints.clipDistance.near,this.view.constraints.clipDistance.far],()=>this._clipDistanceNearFarChanged()),this.view.state.events.on(`before-camera-change`,({camera:e,sceneDepthRange:t})=>this._updateCameraNearFar(e,t)),i(()=>this.view.constraints.clipDistance.mode,e),i(()=>this.view.navigation.mode,e,a),i(()=>this.view.stage.renderer.sceneDepthRange.value,e,a),i(()=>this.view.renderDataExtent,e,a),i(()=>this.view.groundView.visibleElevationRange,e,a),i(()=>[this.view.constraints.altitude.min,this.view.constraints.altitude.max],()=>this._updateAltitude(),a),i(()=>this.view.constraints.tilt.max,()=>this._updateTiltMax(),a),i(()=>this.view.constraints.tilt.mode,()=>this._updateTilt(),a),i(()=>this.view.state?.camera,()=>this._updateTiltAutoMax(),a),i(()=>[this.view.map?.ground?.navigationConstraint?.type,this.view.state.constraints.collision.enabled],()=>this._updateCollision(),a)]),this.view.state.isLocal&&this.addHandles(i(()=>this.view.renderDataExtent,e=>this._updateLocalSurfaceDistance(e),o)),this._updateNearFar(),this.view.state.viewingMode!==2&&this._updateAltitude(),this._updateTilt(),this._updateCollision(),this._set(`surfaceCollisionConstraint`,new p({view:this.view}))}destroy(){this.surfaceCollisionConstraint&&(this.surfaceCollisionConstraint.destroy(),this._set(`surfaceCollisionConstraint`,null))}_clipDistanceNearFarChanged(){let e=this.view.constraints.clipDistance;e.mode!==`auto`&&this.view.state.updateCamera(t=>h(t,e))}_updateNearFar(){let{state:e}=this.view;e.updateCamera(e=>this._updateCameraNearFar(e)),e.updateContentCameraIfPresent()}_updateCameraNearFar(e,t){let n=this.view.constraints.clipDistance;n.mode===`manual`?h(e,n):this._updateCameraNearFarAuto(e,n,t)}_updateCameraNearFarAuto(e,t,n=this.view.stage.renderer.sceneDepthRange.value){if(this.view.navigation.mode.type===`ground`)e.near=this.view.navigation.mode.nearOverride,e.far=this.view.navigation.mode.farOverride;else{let t=u(this.view,e.eye),r=this.nearFarHeuristic.compute(e,this.view.renderDataExtent,n,t);e.near=r.near,e.far=r.far}t&&t.autoUpdate(e.near,e.far)}_updateCollision(){let e=this.view.map?.ground?.navigationConstraint?.type,t=!e||e===`stay-above`,n=this.view.state.constraints.collision;t!==n.enabled&&(n.enabled=t,t&&this._reapplyConstraints(8),this.view.constraints.tilt.mode===`auto`&&this._updateTiltAuto())}_updateAltitude(){let e=this.view.constraints.altitude;this.view.state.viewingMode===1?this.view.state.constraints.altitude={min:e.min,max:e.max}:this.view.state.constraints.altitude=null,this._reapplyConstraints()}_updateTiltMax(){let e=this.view.constraints.tilt;e.mode!==`auto`&&(this._updateTiltManual(e),this._reapplyConstraints())}_updateTilt(){let e=this.view.constraints.tilt;e.mode===`manual`?this._updateTiltManual(e):this._updateTiltAuto(),this._reapplyConstraints()}_updateTiltManual(e){let t=this.view.state.constraints;t.tilt=t.createConstantMaxTilt(n(e.max))}_updateTiltAuto(){let e=this.view.state.constraints;e.tilt=e.createDefaultTilt(),this._updateTiltAutoMax()}_updateTiltAutoMax(){let e=this.view.constraints.tilt;if(e.mode!==`auto`)return;let t=this.view.state.constraints;if(t.tilt){let n=t.tilt(this.view.state.camera.distance).max;e.autoUpdate(r(n))}}_updateLocalSurfaceDistance(e){if(e==null)return;let t=Math.max(e.width,e.height);if(t<=0)return;e.zmax!=null&&e.zmin!=null&&(t=Math.max(t,e.zmax-e.zmin));let n=this.view.state,r=3*t/Math.atan(n.camera.fov/2);r!==n.constraints.distance&&(n.constraints.distance=r)}_reapplyConstraints(e=15){this.view.state.updateCamera(t=>{let n=t.clone();l(this.view,t,new d(e,0,null),t,n),this.surfaceCollisionConstraint?.setSourceCamera(n)})}};e([s({constructOnly:!0})],m.prototype,`view`,void 0),e([s({readOnly:!0})],m.prototype,`surfaceCollisionConstraint`,void 0),m=e([c(`esri.views.3d.state.ConstraintsManager`)],m);function h(e,t){t&&(e.near=t.near,e.far=t.far)}export{m as ConstraintsManager};
2
+ import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import{deg2rad as n,rad2deg as r}from"../../../core/mathUtils.js";import{watch as i,sync as a,initial as o}from"../../../core/reactiveUtils.js";import{property as s,subclass as c}from"../../../core/accessorSupport/decorators.js";import{applyAll as l}from"../camera/constraintUtils.js";import{surfaceElevationBelowRenderLocation as u}from"../camera/intersectionUtils.js";import{ConstraintOptions as d}from"../camera/constraintUtils/ConstraintOptions.js";import{createNearFarHeuristic as f}from"./NearFarHeuristic.js";import{SurfaceCollisionConstraint as p}from"./SurfaceCollisionConstraint.js";let m=class extends t{constructor(e){super(e),this.nearFarHeuristic=f(e.view.state.viewingMode,e.view.groundView,e.view.renderCoordsHelper.spatialReference)}initialize(){let e=()=>this._updateNearFar();this.addHandles([i(()=>[this.view.constraints.clipDistance.near,this.view.constraints.clipDistance.far],()=>this._clipDistanceNearFarChanged()),this.view.state.events.on(`before-camera-change`,({camera:e,sceneDepthRange:t})=>this._updateCameraNearFar(e,t)),i(()=>this.view.constraints.clipDistance.mode,e),i(()=>this.view.navigation.mode,e,a),i(()=>this.view.stage.renderer.sceneDepthRange.value,e,a),i(()=>this.view.renderDataExtent,e,a),i(()=>this.view.groundView.visibleElevationRange,e,a),i(()=>[this.view.constraints.altitude.min,this.view.constraints.altitude.max],()=>this._updateAltitude(),a),i(()=>this.view.constraints.tilt.max,()=>this._updateTiltMax(),a),i(()=>this.view.constraints.tilt.mode,()=>this._updateTilt(),a),i(()=>this.view.state?.camera,()=>this._updateTiltAutoMax(),a),i(()=>[this.view.map?.ground?.navigationConstraint?.type,this.view.state.constraints.collision.enabled],()=>this._updateCollision(),a)]),this.view.state.isLocal&&this.addHandles(i(()=>this.view.renderDataExtent,e=>this._updateLocalSurfaceDistance(e),o)),this._updateNearFar(),this.view.state.viewingMode!==2&&this._updateAltitude(),this._updateTilt(),this._updateCollision(),this._set(`surfaceCollisionConstraint`,new p({view:this.view}))}destroy(){this.surfaceCollisionConstraint&&(this.surfaceCollisionConstraint.destroy(),this._set(`surfaceCollisionConstraint`,null))}_clipDistanceNearFarChanged(){let e=this.view.constraints.clipDistance;e.mode!==`auto`&&this.view.state.updateCamera(t=>h(t,e))}_updateNearFar(){let{state:e}=this.view;e.updateCamera(e=>this._updateCameraNearFar(e)),e.updateContentCameraIfPresent()}_updateCameraNearFar(e,t){let n=this.view.constraints.clipDistance;n.mode===`manual`?h(e,n):this._updateCameraNearFarAuto(e,n,t)}_updateCameraNearFarAuto(e,t,n=this.view.stage.renderer.sceneDepthRange.value){if(this.view.navigation.mode.type===`ground`)e.near=this.view.navigation.mode.nearOverride,e.far=this.view.navigation.mode.farOverride;else{let t=u(this.view,e.eye),r=this.nearFarHeuristic.compute(e,this.view.renderDataExtent,n,t);e.near=r.near,e.far=r.far}t&&t.autoUpdate(e.near,e.far)}_updateCollision(){let e=this.view.map?.ground?.navigationConstraint?.type,t=!e||e===`stay-above`,n=this.view.state.constraints.collision;t!==n.enabled&&(n.enabled=t,t&&this._reapplyConstraints(8),this.view.constraints.tilt.mode===`auto`&&this._updateTiltAuto())}_updateAltitude(){let e=this.view.constraints.altitude;this.view.state.isGlobal?this.view.state.constraints.altitude={min:e.min,max:e.max}:this.view.state.constraints.altitude=null,this._reapplyConstraints()}_updateTiltMax(){let e=this.view.constraints.tilt;e.mode!==`auto`&&(this._updateTiltManual(e),this._reapplyConstraints())}_updateTilt(){let e=this.view.constraints.tilt;e.mode===`manual`?this._updateTiltManual(e):this._updateTiltAuto(),this._reapplyConstraints()}_updateTiltManual(e){let t=this.view.state.constraints;t.tilt=t.createConstantMaxTilt(n(e.max))}_updateTiltAuto(){let e=this.view.state.constraints;e.tilt=e.createDefaultTilt(),this._updateTiltAutoMax()}_updateTiltAutoMax(){let e=this.view.constraints.tilt;if(e.mode!==`auto`)return;let t=this.view.state.constraints;if(t.tilt){let n=t.tilt(this.view.state.camera.distance).max;e.autoUpdate(r(n))}}_updateLocalSurfaceDistance(e){if(e==null)return;let t=Math.max(e.width,e.height);if(t<=0)return;e.zmax!=null&&e.zmin!=null&&(t=Math.max(t,e.zmax-e.zmin));let n=this.view.state,r=3*t/Math.atan(n.camera.fov/2);r!==n.constraints.distance&&(n.constraints.distance=r)}_reapplyConstraints(e=15){this.view.state.updateCamera(t=>{let n=t.clone();l(this.view,t,new d(e,0,null),t,n),this.surfaceCollisionConstraint?.setSourceCamera(n)})}};e([s({constructOnly:!0})],m.prototype,`view`,void 0),e([s({readOnly:!0})],m.prototype,`surfaceCollisionConstraint`,void 0),m=e([c(`esri.views.3d.state.ConstraintsManager`)],m);function h(e,t){t&&(e.near=t.near,e.far=t.far)}export{m as ConstraintsManager};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{prefersReducedMotion as t}from"../../../../core/a11yUtils.js";import{createScreenPointArray as n,screenPointObjectToArray as r}from"../../../../core/screenUtils.js";import{subclass as i}from"../../../../core/accessorSupport/decorators.js";import{copy as a,distance as o}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{scaleAndAdd as s,dot as c,crossAndNormalize as l,scale as u,add as d}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as f}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as p}from"../../../../geometry/ellipsoidUtils.js";import{create as m,fromPositionAndNormal as h}from"../../../../geometry/support/plane.js";import{Sphere as g}from"../../../../geometry/support/sphere.js";import{pixelDistanceToInteractionFactor as _}from"../../camera/constraintUtils.js";import{ConstraintOptions as v}from"../../camera/constraintUtils/ConstraintOptions.js";import{InteractiveController as y}from"./InteractiveController.js";import{GroundNavigationMomentumController as b}from"./momentum/GroundNavigationMomentumController.js";import{findSphereHorizonY as x,computeHorizonPaddingLimits as S,findPlaneHorizonY as C,findGroundNavigationGrabLocation as w,groundNavigationConstants as T}from"../utils/groundNavigationUtils.js";import{OffsetCorrectionController as E}from"../utils/OffsetCorrectionController.js";import D from"../../webgl/RenderCamera.js";import{GroundNavigationMomentumEstimator as O}from"../../../navigation/GroundNavigationMomentumEstimator.js";let k=class extends y{constructor(e){super(e),this._drag=null,this._validState=!0,this._adjustedScenePoint=f(),this._momentumEstimator=new O,this._referenceSphere=new g,this._referencePlane=m(),this._tmp3d=f(),this._screenPointArray=n(),this._forwardRopeComponent=f(),this._sidewaysRopeComponent=f(),this._ropeTranslation=f(),this._beginScreenPoint=n(),this._screenPickPoint=n(),this._horizonY=null,this._horizonPadding=null,this._ropeScreenHeight=1,this._ropePlane=m(),this._pointerOverHorizonVelocityAdjustment=1,this._beginCamera=new D,this._constraintOptions=new v(15,6,0,this._beginCamera)}initialize(){this._offsetCorrectionController=new E(this.view)}stepController(e,t){this._drag&&=(this.currentCamera.copyFrom(this.startCamera),this._panningRopePull(this._drag,e),t.copyFrom(this.currentCamera),null)}get isGlobalMode(){return this.view.state.viewingMode===1}get momentumEnabled(){return this.view.navigation.momentumEnabled&&this.view.animationsEnabled&&!t()}begin(e){this.running&&(r(e.center,this._screenPickPoint),Math.abs(this._screenPickPoint[0]-this.view.width/2)<.1&&(this._screenPickPoint[0]+=1),a(this._beginScreenPoint,this._screenPickPoint),this._prepareGroundNavigation(),this._beginCamera.copyFrom(this.startCamera))}update(e){this.running&&this._validState&&(this._drag=e,this.updateInteractive())}end(e){return this.finishController(),this.createMomentum()}_initHorizonValues(){this.isGlobalMode?this._globalInitHorizonValues():this._localInitHorizonValues()}_globalInitHorizonValues(){this._referenceSphere.radius=p(this.view.spatialReference).radius,this._horizonY=x(this.startCamera,this._referenceSphere,this._screenPickPoint),this._horizonPadding=this._horizonY==null?null:S(this.startCamera,this._horizonY)}_localInitHorizonValues(){let e=f();this.view.renderCoordsHelper.worldUpAtPosition(this.startCamera.eye,e);let t=f();s(t,this.startCamera.eye,e,-this.startCamera.relativeElevation),h(t,e,this._referencePlane),this._horizonY=C(this.startCamera,this._referencePlane),this._horizonPadding=S(this.startCamera,this._horizonY)}_prepareGroundNavigation(){if(this._initHorizonValues(),!this._horizonY||!this._horizonPadding)return;if(this._momentumEstimator.reset(),this._ropeScreenHeight=this.startCamera.fullHeight/this.startCamera.pixelRatio,!w({view:this.view,originalScreenPoint:this._beginScreenPoint,horizonY:this._horizonY,horizonPadding:this._horizonPadding,outTranslation:this._ropeTranslation,outGrabLocation:this._adjustedScenePoint})){this._validState=!1;return}let e=f();this.view.renderCoordsHelper.worldUpAtPosition(this.startCamera.eye,e);let t=this.startCamera.viewRight,n=c(this._ropeTranslation,t),r=l(f(),e,t),i=c(this._ropeTranslation,r);u(this._forwardRopeComponent,r,i),u(this._sidewaysRopeComponent,t,n),h(this._adjustedScenePoint,e,this._ropePlane);let a=this._ropeScreenHeight-this._beginScreenPoint[1],o=this._ropeScreenHeight-this._horizonPadding[0];this._pointerOverHorizonVelocityAdjustment=o===0?1:Math.max(a/o,1)}_panningRopePull(e,t){if(!this._horizonY||!this._horizonPadding)return;let n=r(e.center,this._screenPointArray),i=this.startCamera.fullWidth/this.startCamera.pixelRatio*.5,a=(this._ropeScreenHeight-n[1])/(this._ropeScreenHeight-this._beginScreenPoint[1]),c=1-a,l=(n[0]-i)/(this._beginScreenPoint[0]-i),f=c*T.ySpeedMultiplier*this._pointerOverHorizonVelocityAdjustment,p=(c*T.xSpeedMultiplier+a*((1-l)*T.xSpeedMultiplier))*this._pointerOverHorizonVelocityAdjustment;u(this._ropeTranslation,this._forwardRopeComponent,f),s(this._ropeTranslation,this._ropeTranslation,this._sidewaysRopeComponent,p),this.currentCamera.eye=d(this._tmp3d,this.startCamera.eye,this._ropeTranslation),this.currentCamera.center=d(this._tmp3d,this.startCamera.center,this._ropeTranslation),this.momentumEnabled&&this._momentumEstimator.update(n,this._ropeTranslation,e.timestamp*.001),this._constraintOptions.interactionFactor=_(o(this._beginScreenPoint,n)),this._constraintOptions.interactionDirection=this._ropeTranslation,this._offsetCorrectionController.smoothlyCorrectGroundElevation({camera:this.currentCamera,deltaTime:t,constraintOptions:this._constraintOptions}),this._constraintOptions.interactionDirection=null}createMomentum(){let e=this.momentumEnabled&&this._momentumEstimator.createMomentum();return e?new b({view:this.view,momentum:e}):null}};k=e([i(`esri.views.3d.state.controllers.GroundNavigationController`)],k);export{k as GroundNavigationController};
2
+ import{__decorate as e}from"tslib";import{prefersReducedMotion as t}from"../../../../core/a11yUtils.js";import{createScreenPointArray as n,screenPointObjectToArray as r}from"../../../../core/screenUtils.js";import{subclass as i}from"../../../../core/accessorSupport/decorators.js";import{copy as a,distance as o}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{scaleAndAdd as s,dot as c,crossAndNormalize as l,scale as u,add as d}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as f}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as p}from"../../../../geometry/ellipsoidUtils.js";import{create as m,fromPositionAndNormal as h}from"../../../../geometry/support/plane.js";import{Sphere as g}from"../../../../geometry/support/sphere.js";import{pixelDistanceToInteractionFactor as _}from"../../camera/constraintUtils.js";import{ConstraintOptions as v}from"../../camera/constraintUtils/ConstraintOptions.js";import{InteractiveController as y}from"./InteractiveController.js";import{GroundNavigationMomentumController as b}from"./momentum/GroundNavigationMomentumController.js";import{findSphereHorizonY as x,computeHorizonPaddingLimits as S,findPlaneHorizonY as C,findGroundNavigationGrabLocation as w,groundNavigationConstants as T}from"../utils/groundNavigationUtils.js";import{OffsetCorrectionController as E}from"../utils/OffsetCorrectionController.js";import D from"../../webgl/RenderCamera.js";import{GroundNavigationMomentumEstimator as O}from"../../../navigation/GroundNavigationMomentumEstimator.js";let k=class extends y{constructor(e){super(e),this._drag=null,this._validState=!0,this._adjustedScenePoint=f(),this._momentumEstimator=new O,this._referenceSphere=new g,this._referencePlane=m(),this._tmp3d=f(),this._screenPointArray=n(),this._forwardRopeComponent=f(),this._sidewaysRopeComponent=f(),this._ropeTranslation=f(),this._beginScreenPoint=n(),this._screenPickPoint=n(),this._horizonY=null,this._horizonPadding=null,this._ropeScreenHeight=1,this._ropePlane=m(),this._pointerOverHorizonVelocityAdjustment=1,this._beginCamera=new D,this._constraintOptions=new v(15,6,0,this._beginCamera)}initialize(){this._offsetCorrectionController=new E(this.view)}stepController(e,t){this._drag&&=(this.currentCamera.copyFrom(this.startCamera),this._panningRopePull(this._drag,e),t.copyFrom(this.currentCamera),null)}get isGlobalMode(){return this.view.state.isGlobal}get momentumEnabled(){return this.view.navigation.momentumEnabled&&this.view.animationsEnabled&&!t()}begin(e){this.running&&(r(e.center,this._screenPickPoint),Math.abs(this._screenPickPoint[0]-this.view.width/2)<.1&&(this._screenPickPoint[0]+=1),a(this._beginScreenPoint,this._screenPickPoint),this._prepareGroundNavigation(),this._beginCamera.copyFrom(this.startCamera))}update(e){this.running&&this._validState&&(this._drag=e,this.updateInteractive())}end(e){return this.finishController(),this.createMomentum()}_initHorizonValues(){this.isGlobalMode?this._globalInitHorizonValues():this._localInitHorizonValues()}_globalInitHorizonValues(){this._referenceSphere.radius=p(this.view.spatialReference).radius,this._horizonY=x(this.startCamera,this._referenceSphere,this._screenPickPoint),this._horizonPadding=this._horizonY==null?null:S(this.startCamera,this._horizonY)}_localInitHorizonValues(){let e=f();this.view.renderCoordsHelper.worldUpAtPosition(this.startCamera.eye,e);let t=f();s(t,this.startCamera.eye,e,-this.startCamera.relativeElevation),h(t,e,this._referencePlane),this._horizonY=C(this.startCamera,this._referencePlane),this._horizonPadding=S(this.startCamera,this._horizonY)}_prepareGroundNavigation(){if(this._initHorizonValues(),!this._horizonY||!this._horizonPadding)return;if(this._momentumEstimator.reset(),this._ropeScreenHeight=this.startCamera.fullHeight/this.startCamera.pixelRatio,!w({view:this.view,originalScreenPoint:this._beginScreenPoint,horizonY:this._horizonY,horizonPadding:this._horizonPadding,outTranslation:this._ropeTranslation,outGrabLocation:this._adjustedScenePoint})){this._validState=!1;return}let e=f();this.view.renderCoordsHelper.worldUpAtPosition(this.startCamera.eye,e);let t=this.startCamera.viewRight,n=c(this._ropeTranslation,t),r=l(f(),e,t),i=c(this._ropeTranslation,r);u(this._forwardRopeComponent,r,i),u(this._sidewaysRopeComponent,t,n),h(this._adjustedScenePoint,e,this._ropePlane);let a=this._ropeScreenHeight-this._beginScreenPoint[1],o=this._ropeScreenHeight-this._horizonPadding[0];this._pointerOverHorizonVelocityAdjustment=o===0?1:Math.max(a/o,1)}_panningRopePull(e,t){if(!this._horizonY||!this._horizonPadding)return;let n=r(e.center,this._screenPointArray),i=this.startCamera.fullWidth/this.startCamera.pixelRatio*.5,a=(this._ropeScreenHeight-n[1])/(this._ropeScreenHeight-this._beginScreenPoint[1]),c=1-a,l=(n[0]-i)/(this._beginScreenPoint[0]-i),f=c*T.ySpeedMultiplier*this._pointerOverHorizonVelocityAdjustment,p=(c*T.xSpeedMultiplier+a*((1-l)*T.xSpeedMultiplier))*this._pointerOverHorizonVelocityAdjustment;u(this._ropeTranslation,this._forwardRopeComponent,f),s(this._ropeTranslation,this._ropeTranslation,this._sidewaysRopeComponent,p),this.currentCamera.eye=d(this._tmp3d,this.startCamera.eye,this._ropeTranslation),this.currentCamera.center=d(this._tmp3d,this.startCamera.center,this._ropeTranslation),this.momentumEnabled&&this._momentumEstimator.update(n,this._ropeTranslation,e.timestamp*.001),this._constraintOptions.interactionFactor=_(o(this._beginScreenPoint,n)),this._constraintOptions.interactionDirection=this._ropeTranslation,this._offsetCorrectionController.smoothlyCorrectGroundElevation({camera:this.currentCamera,deltaTime:t,constraintOptions:this._constraintOptions}),this._constraintOptions.interactionDirection=null}createMomentum(){let e=this.momentumEnabled&&this._momentumEstimator.createMomentum();return e?new b({view:this.view,momentum:e}):null}};k=e([i(`esri.views.3d.state.controllers.GroundNavigationController`)],k);export{k as GroundNavigationController};