@arcgis/core 4.23.0-next.20220126 → 4.23.0-next.20220130

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 (523) hide show
  1. package/arcade/featureset/sources/FeatureLayerDynamic.js +1 -1
  2. package/assets/esri/core/workers/RemoteClient.js +1 -1
  3. package/assets/esri/core/workers/chunks/02fbc76dfdc20e628c61.js +1 -0
  4. package/assets/esri/core/workers/chunks/0453fad5cb819797b4f6.js +1 -0
  5. package/assets/esri/core/workers/chunks/0463ba46df855a92b9c0.js +1 -0
  6. package/assets/esri/core/workers/chunks/0cd0a6eef51fc5b9ea61.js +1 -0
  7. package/assets/esri/core/workers/chunks/{97ec9eef0048760fa260.js → 0d02c6ad1f4688bfa374.js} +1 -1
  8. package/assets/esri/core/workers/chunks/0d684f16f37d5dc385dd.js +1 -0
  9. package/assets/esri/core/workers/chunks/0e17691520d890d34efb.js +1 -0
  10. package/assets/esri/core/workers/chunks/16b6d0f8378582c051c3.js +1 -0
  11. package/assets/esri/core/workers/chunks/{0ce1dc14280d6f188468.js → 17de7a324dfa7f57ad5d.js} +1 -1
  12. package/assets/esri/core/workers/chunks/{b313ab14a643273e7d09.js → 1877ab1b6a115dbba1c5.js} +1 -1
  13. package/assets/esri/core/workers/chunks/{c36f84daa7736878418d.js → 197ec52641aed20029c6.js} +1 -1
  14. package/assets/esri/core/workers/chunks/1b2a961f776a0b57e57a.js +1 -0
  15. package/assets/esri/core/workers/chunks/1b3fd66577b19aa5f2b6.js +1 -0
  16. package/assets/esri/core/workers/chunks/1c733b7db092a2a88ef3.js +1 -0
  17. package/assets/esri/core/workers/chunks/1f8c6a179e39fd4c5e6f.js +1 -0
  18. package/assets/esri/core/workers/chunks/2076fcbae63f1bfb7143.js +1 -0
  19. package/assets/esri/core/workers/chunks/{9387db408f496e7dd003.js → 214910032945dd2d86b0.js} +1 -1
  20. package/assets/esri/core/workers/chunks/27474b007988855bea9d.js +1 -0
  21. package/assets/esri/core/workers/chunks/281b89dbf5574fc642ae.js +1 -0
  22. package/assets/esri/core/workers/chunks/2c8fe9bc988c3c5760a5.js +1 -0
  23. package/assets/esri/core/workers/chunks/34b59d7099904dcb28b5.js +1 -0
  24. package/assets/esri/core/workers/chunks/357033117dfe61eb81ea.js +1 -0
  25. package/assets/esri/core/workers/chunks/{b2ebe4f6d100e15b512d.js → 37c03cfc19086ce631c6.js} +1 -1
  26. package/assets/esri/core/workers/chunks/386f86f961146f530aa7.js +1 -0
  27. package/assets/esri/core/workers/chunks/{e6165e17fbb07bfc40a1.js → 391e96192d1ec4e55ce2.js} +1 -1
  28. package/assets/esri/core/workers/chunks/44f0c3663b293afbd172.js +1 -0
  29. package/assets/esri/core/workers/chunks/483d5d8593d96d0f0b15.js +1 -0
  30. package/assets/esri/core/workers/chunks/{c959e0d1cf7dce0421b9.js → 48fa8aed6c24877b44c4.js} +1 -1
  31. package/assets/esri/core/workers/chunks/{438f0b5ae5c53ae4f06a.js → 4954fd86b48cc68b737c.js} +1 -1
  32. package/assets/esri/core/workers/chunks/49a1a633bb0d93764aae.js +1 -0
  33. package/assets/esri/core/workers/chunks/4ba6de8aa7e2960bad49.js +1 -0
  34. package/assets/esri/core/workers/chunks/4be35af7d6babbfe9d84.js +1 -0
  35. package/assets/esri/core/workers/chunks/5457962a70bd3c557a75.js +1 -0
  36. package/assets/esri/core/workers/chunks/57856b4a9b8784a69844.js +1 -0
  37. package/assets/esri/core/workers/chunks/{b9c177524b3e7de1ffd1.js → 5790d171072b3c7d108f.js} +1 -1
  38. package/assets/esri/core/workers/chunks/{5dfe1f8d520025e2118b.js → 57b349d1dbc0bed75b79.js} +1 -1
  39. package/assets/esri/core/workers/chunks/{97a28641b3b2fd31bea2.js → 5bcb3240b3c005e5fe72.js} +1 -1
  40. package/assets/esri/core/workers/chunks/5d11b97b667921d67ae7.js +1 -0
  41. package/assets/esri/core/workers/chunks/5dbe555a5a662ff3d9ce.js +1 -0
  42. package/assets/esri/core/workers/chunks/5ec98f4ddac707d0fbd1.js +1 -0
  43. package/assets/esri/core/workers/chunks/64b7e8d812ea8fcf269e.js +1 -0
  44. package/assets/esri/core/workers/chunks/{ba5eb394f098968c22d2.js → 655b55ac0cd533d7e9d7.js} +1 -1
  45. package/assets/esri/core/workers/chunks/{b0b036ad3ad3cd956747.js → 69fd99b7c76e9992ccf3.js} +1 -1
  46. package/assets/esri/core/workers/chunks/75d812955a473d0e8960.js +1 -0
  47. package/assets/esri/core/workers/chunks/7903a3e2e0faff0f86c0.js +1 -0
  48. package/assets/esri/core/workers/chunks/{cc146c57bbdac8029fd8.js → 7a5f5acfbd4ca1a5c1f3.js} +1 -1
  49. package/assets/esri/core/workers/chunks/83d00afae4406ec78bc9.js +1 -0
  50. package/assets/esri/core/workers/chunks/{434b16731c6a81f868ef.js → 85b1f36790df95b17659.js} +1 -1
  51. package/assets/esri/core/workers/chunks/89820b200ee44e678af5.js +1 -0
  52. package/assets/esri/core/workers/chunks/918bb7a7d901544a7367.js +1 -0
  53. package/assets/esri/core/workers/chunks/{94b8dbf859df71858d1c.js → 929c9b7cdab7c4ca3d87.js} +1 -1
  54. package/assets/esri/core/workers/chunks/949b2269457302ffc64b.js +1 -0
  55. package/assets/esri/core/workers/chunks/{601e697dc7414bda128a.js → 952980635afc7ec81804.js} +1 -1
  56. package/assets/esri/core/workers/chunks/9876a1bae350795fab36.js +1 -0
  57. package/assets/esri/core/workers/chunks/99619fcb772807c74f3b.js +1 -0
  58. package/assets/esri/core/workers/chunks/{010a71c2aa1b7681e191.js → 9d11f84e6c893b9d0019.js} +1 -1
  59. package/assets/esri/core/workers/chunks/a1930e4f035bc9aa1ae5.js +1 -0
  60. package/assets/esri/core/workers/chunks/a8692bffb76444c34760.js +1 -0
  61. package/assets/esri/core/workers/chunks/{f760a3e030b0f358a92a.js → aeaa1667c2d9f1b3366b.js} +1 -1
  62. package/assets/esri/core/workers/chunks/{3f343f792fd9f44d6f25.js → b3f5e91116112b0b612a.js} +1 -1
  63. package/assets/esri/core/workers/chunks/b97953694f42bfec1b3c.js +1 -0
  64. package/assets/esri/core/workers/chunks/b9e9cb354822c6d995a4.js +1 -0
  65. package/assets/esri/core/workers/chunks/ba762bcfd74af0bb8218.js +1 -0
  66. package/assets/esri/core/workers/chunks/{e4b84ca8ddfd48dd79b1.js → bac9fc90e6756e211160.js} +1 -1
  67. package/assets/esri/core/workers/chunks/{4c76146014dc15143ba3.js → be588873c16770ceb9ef.js} +1 -1
  68. package/assets/esri/core/workers/chunks/bf97a933ea3b220115e1.js +1 -0
  69. package/assets/esri/core/workers/chunks/bfedd6ebff817c9b31c0.js +1 -0
  70. package/assets/esri/core/workers/chunks/c093dff4592832ac0973.js +1 -0
  71. package/assets/esri/core/workers/chunks/c1135cb02ec46c491459.js +1 -0
  72. package/assets/esri/core/workers/chunks/{e4e2036373166c1d5cf5.js → c2253a9f29c1aabb2b75.js} +1 -1
  73. package/assets/esri/core/workers/chunks/d04fca5d46cca02500b7.js +1 -0
  74. package/assets/esri/core/workers/chunks/d08efbc349dd9f999497.js +1 -0
  75. package/assets/esri/core/workers/chunks/d1fe53b597351dc58305.js +1 -0
  76. package/assets/esri/core/workers/chunks/{a8b13fb804bb775e4967.js → db3c729ce0c0b2690dc9.js} +1 -1
  77. package/assets/esri/core/workers/chunks/dd13772a5e2eccc6a2bc.js +1 -0
  78. package/assets/esri/core/workers/chunks/dedc333a61081772ca7b.js +1 -0
  79. package/assets/esri/core/workers/chunks/{6f50a9647f026a8d4729.js → e0c8d61c7a85ce15499a.js} +1 -1
  80. package/assets/esri/core/workers/chunks/{199670a3a564ebe3bd79.js → e218bde41ffbcc5194f5.js} +1 -1
  81. package/assets/esri/core/workers/chunks/e21b211913aefde47e30.js +1 -0
  82. package/assets/esri/core/workers/chunks/e287f49184d076af17e2.js +1 -0
  83. package/assets/esri/core/workers/chunks/{bde1d5b0a7717350986e.js → e4019b63a1fe74e2c842.js} +1 -1
  84. package/assets/esri/core/workers/chunks/e8e775758b79c5a084c8.js +1 -0
  85. package/assets/esri/core/workers/chunks/e93dfdede0532a89ffa5.js +1 -0
  86. package/assets/esri/core/workers/chunks/ea595b0df5050eda2a13.js +1 -0
  87. package/assets/esri/core/workers/chunks/eb82ff10cef2bde6e57f.js +1 -0
  88. package/assets/esri/core/workers/chunks/ebc6f4764b82d4104c65.js +1 -0
  89. package/assets/esri/core/workers/chunks/{1305ef8717da6e902a55.js → ec10151a2a95e95a0bb5.js} +1 -1
  90. package/assets/esri/core/workers/chunks/eccba071ced2d922bb85.js +1 -0
  91. package/assets/esri/core/workers/chunks/ee6e0db58dc64410e687.js +1 -0
  92. package/assets/esri/core/workers/chunks/f0a9f161805fc7a30fc5.js +1 -0
  93. package/assets/esri/core/workers/chunks/f2124f4d0f2b8a91f0ea.js +1 -0
  94. package/assets/esri/core/workers/chunks/ff6abdc72076f3994659.js +981 -0
  95. package/assets/esri/libs/vxl/vxlLayer.wasm +0 -0
  96. package/assets/esri/themes/base/widgets/_Weather.scss +1 -1
  97. package/assets/esri/themes/dark/main.css +1 -1
  98. package/assets/esri/themes/dark-blue/main.css +1 -1
  99. package/assets/esri/themes/dark-green/main.css +1 -1
  100. package/assets/esri/themes/dark-purple/main.css +1 -1
  101. package/assets/esri/themes/dark-red/main.css +1 -1
  102. package/assets/esri/themes/light/main.css +1 -1
  103. package/assets/esri/themes/light/view.css +1 -1
  104. package/assets/esri/themes/light-blue/main.css +1 -1
  105. package/assets/esri/themes/light-green/main.css +1 -1
  106. package/assets/esri/themes/light-purple/main.css +1 -1
  107. package/assets/esri/themes/light-red/main.css +1 -1
  108. package/assets/esri/widgets/Weather/t9n/Weather.json +1 -1
  109. package/assets/esri/widgets/Weather/t9n/Weather_ar.json +1 -1
  110. package/assets/esri/widgets/Weather/t9n/Weather_bg.json +1 -1
  111. package/assets/esri/widgets/Weather/t9n/Weather_bs.json +1 -1
  112. package/assets/esri/widgets/Weather/t9n/Weather_ca.json +1 -1
  113. package/assets/esri/widgets/Weather/t9n/Weather_cs.json +1 -1
  114. package/assets/esri/widgets/Weather/t9n/Weather_da.json +1 -1
  115. package/assets/esri/widgets/Weather/t9n/Weather_de.json +1 -1
  116. package/assets/esri/widgets/Weather/t9n/Weather_el.json +1 -1
  117. package/assets/esri/widgets/Weather/t9n/Weather_en.json +1 -1
  118. package/assets/esri/widgets/Weather/t9n/Weather_es.json +1 -1
  119. package/assets/esri/widgets/Weather/t9n/Weather_et.json +1 -1
  120. package/assets/esri/widgets/Weather/t9n/Weather_fi.json +1 -1
  121. package/assets/esri/widgets/Weather/t9n/Weather_fr.json +1 -1
  122. package/assets/esri/widgets/Weather/t9n/Weather_he.json +1 -1
  123. package/assets/esri/widgets/Weather/t9n/Weather_hr.json +1 -1
  124. package/assets/esri/widgets/Weather/t9n/Weather_hu.json +1 -1
  125. package/assets/esri/widgets/Weather/t9n/Weather_id.json +1 -1
  126. package/assets/esri/widgets/Weather/t9n/Weather_it.json +1 -1
  127. package/assets/esri/widgets/Weather/t9n/Weather_ja.json +1 -1
  128. package/assets/esri/widgets/Weather/t9n/Weather_ko.json +1 -1
  129. package/assets/esri/widgets/Weather/t9n/Weather_lt.json +1 -1
  130. package/assets/esri/widgets/Weather/t9n/Weather_lv.json +1 -1
  131. package/assets/esri/widgets/Weather/t9n/Weather_nb.json +1 -1
  132. package/assets/esri/widgets/Weather/t9n/Weather_nl.json +1 -1
  133. package/assets/esri/widgets/Weather/t9n/Weather_pl.json +1 -1
  134. package/assets/esri/widgets/Weather/t9n/Weather_pt-BR.json +1 -1
  135. package/assets/esri/widgets/Weather/t9n/Weather_pt-PT.json +1 -1
  136. package/assets/esri/widgets/Weather/t9n/Weather_ro.json +1 -1
  137. package/assets/esri/widgets/Weather/t9n/Weather_ru.json +1 -1
  138. package/assets/esri/widgets/Weather/t9n/Weather_sk.json +1 -1
  139. package/assets/esri/widgets/Weather/t9n/Weather_sl.json +1 -1
  140. package/assets/esri/widgets/Weather/t9n/Weather_sr.json +1 -1
  141. package/assets/esri/widgets/Weather/t9n/Weather_sv.json +1 -1
  142. package/assets/esri/widgets/Weather/t9n/Weather_th.json +1 -1
  143. package/assets/esri/widgets/Weather/t9n/Weather_tr.json +1 -1
  144. package/assets/esri/widgets/Weather/t9n/Weather_uk.json +1 -1
  145. package/assets/esri/widgets/Weather/t9n/Weather_vi.json +1 -1
  146. package/assets/esri/widgets/Weather/t9n/Weather_zh-CN.json +1 -1
  147. package/assets/esri/widgets/Weather/t9n/Weather_zh-HK.json +1 -1
  148. package/assets/esri/widgets/Weather/t9n/Weather_zh-TW.json +1 -1
  149. package/chunks/BlendLayers.glsl.js +2 -2
  150. package/chunks/ChapmanAtmosphere.glsl.js +17 -17
  151. package/chunks/CheckerBoard.glsl.js +3 -3
  152. package/chunks/Clouds.glsl.js +2 -2
  153. package/chunks/CloudsComposition.glsl.js +1 -1
  154. package/chunks/ColorMaterial.glsl.js +12 -12
  155. package/chunks/ComponentShader.glsl.js +3 -3
  156. package/chunks/Compositing.glsl.js +1 -1
  157. package/chunks/DefaultMaterial.glsl.js +33 -33
  158. package/chunks/EdgeShaderProgram.glsl.js +7 -7
  159. package/chunks/Fog.glsl.js +10 -12
  160. package/chunks/HUDMaterial.glsl.js +2 -2
  161. package/chunks/HighlightComposition.glsl.js +5 -5
  162. package/chunks/ImageMaterial.glsl.js +6 -6
  163. package/chunks/LaserlinePath.glsl.js +8 -8
  164. package/chunks/LineCallout.glsl.js +6 -6
  165. package/chunks/MeasurementArrow.glsl.js +1 -1
  166. package/chunks/NativeLine.glsl.js +1 -1
  167. package/chunks/Path.glsl.js +5 -5
  168. package/chunks/Pattern.glsl.js +9 -9
  169. package/chunks/PointRenderer.glsl.js +14 -14
  170. package/chunks/Precipitation.glsl.js +91 -0
  171. package/chunks/RealisticTree.glsl.js +21 -21
  172. package/chunks/RibbonLine.glsl.js +11 -11
  173. package/chunks/SMAA.glsl.js +40 -40
  174. package/chunks/ShadedColorMaterial.glsl.js +12 -12
  175. package/chunks/ShadowCast.glsl.js +6 -6
  176. package/chunks/ShadowHighlight.glsl.js +4 -4
  177. package/chunks/SimpleAtmosphere.glsl.js +3 -3
  178. package/chunks/SlicePlaneMaterial.glsl.js +3 -3
  179. package/chunks/Stars.glsl.js +3 -3
  180. package/chunks/Terrain.glsl.js +11 -11
  181. package/chunks/TextureOnly.glsl.js +2 -2
  182. package/chunks/WaterSurface.glsl.js +5 -5
  183. package/chunks/boundedPlane.js +1 -1
  184. package/chunks/vxlLayer.js +1 -1
  185. package/core/accessorSupport/watch.js +1 -1
  186. package/core/clock.js +1 -1
  187. package/core/jsonMap.js +1 -1
  188. package/core/loadAll.js +1 -1
  189. package/core/promiseUtils.js +1 -1
  190. package/core/reactiveUtils.js +1 -1
  191. package/form/ExpressionInfo.js +1 -1
  192. package/geometry/support/frustum.js +1 -1
  193. package/geometry/support/plane.js +1 -1
  194. package/interfaces.d.ts +232 -38
  195. package/layers/VectorTileLayer.js +1 -1
  196. package/layers/graphics/controllers/I3SOnDemandController.js +1 -1
  197. package/layers/graphics/featureConversionUtils.js +1 -1
  198. package/layers/support/LayerContingentValuesCache.js +1 -1
  199. package/layers/support/TileInfo.js +1 -1
  200. package/package.json +1 -1
  201. package/rest/print.js +1 -1
  202. package/smartMapping/statistics/support/predominanceUtils.d.ts +4 -0
  203. package/support/arcadeOnDemand.js +1 -1
  204. package/support/featureFlags.js +1 -1
  205. package/support/revision.js +1 -1
  206. package/symbols/FillSymbol3DLayer.js +1 -1
  207. package/symbols/IconSymbol3DLayer.js +1 -1
  208. package/symbols/ObjectSymbol3DLayer.js +1 -1
  209. package/symbols/Symbol3D.js +1 -1
  210. package/symbols/WebStyleSymbol.js +1 -1
  211. package/symbols/cim/CIMSymbolRasterizer.js +1 -1
  212. package/symbols/support/IconSymbol3DLayerResource.js +1 -1
  213. package/symbols/support/ObjectSymbol3DLayerResource.js +1 -1
  214. package/symbols/support/Symbol3DAnchorPosition2D.js +1 -1
  215. package/symbols/support/Symbol3DAnchorPosition3D.js +1 -1
  216. package/symbols/support/Symbol3DFillMaterial.js +1 -1
  217. package/symbols/support/Symbol3DIconOutline.js +1 -1
  218. package/symbols/support/Symbol3DOutline.js +1 -1
  219. package/symbols/support/Thumbnail.js +1 -1
  220. package/symbols/support/webStyleSymbolUtils.js +1 -1
  221. package/views/2d/MapViewConstraints.js +1 -1
  222. package/views/2d/engine/vectorTiles/SchemaHelper.js +1 -1
  223. package/views/2d/viewpointUtils.js +1 -1
  224. package/views/3d/environment/ChapmanAtmosphere.glsl.js +1 -1
  225. package/views/3d/environment/ChapmanAtmosphere.js +1 -1
  226. package/views/3d/environment/CloudsComposition.glsl.js +1 -1
  227. package/views/3d/environment/CloudsGenerator.js +1 -1
  228. package/views/3d/environment/CloudsPresets.js +1 -1
  229. package/views/3d/environment/EnvironmentRenderer.js +1 -1
  230. package/views/3d/environment/Fog.glsl.js +1 -1
  231. package/views/3d/environment/Fog.js +1 -1
  232. package/views/3d/environment/PanoramicAtmosphere.js +1 -1
  233. package/views/3d/environment/Precipitation.glsl.js +5 -0
  234. package/views/3d/environment/Precipitation.js +5 -0
  235. package/views/3d/environment/PrecipitationTechnique.js +5 -0
  236. package/views/3d/environment/RainyWeather.js +1 -1
  237. package/views/3d/environment/SimpleAtmosphere.glsl.js +1 -1
  238. package/views/3d/environment/SimpleAtmosphere.js +1 -1
  239. package/views/3d/environment/SnowyWeather.js +5 -0
  240. package/views/3d/environment/Stars.glsl.js +1 -1
  241. package/views/3d/environment/Stars.js +1 -1
  242. package/views/3d/environment/weather.js +1 -1
  243. package/views/3d/interactive/analysisTools/slice/SliceTool.js +1 -1
  244. package/views/3d/interactive/analysisTools/slice/sliceToolUtils.js +1 -1
  245. package/views/3d/interactive/visualElements/ExtendedLineVisualElement.js +1 -1
  246. package/views/3d/interactive/visualElements/MeasurementAreaVisualElement.js +1 -1
  247. package/views/3d/interactive/visualElements/OutlineVisualElement.js +1 -1
  248. package/views/3d/interactive/visualElements/ParallelLineVisualElement.js +1 -1
  249. package/views/3d/interactive/visualElements/PointVisualElement.js +1 -1
  250. package/views/3d/interactive/visualElements/RightAngleQuadVisualElement.js +1 -1
  251. package/views/3d/layers/FeatureLayerViewBase3D.js +1 -1
  252. package/views/3d/layers/FeatureLikeLayerView3D.js +1 -1
  253. package/views/3d/layers/GraphicsLayerView3D.js +1 -1
  254. package/views/3d/layers/GraphicsView3D.js +1 -1
  255. package/views/3d/layers/I3SMeshView3D.js +1 -1
  256. package/views/3d/layers/VectorTileLayerView3D.js +1 -1
  257. package/views/3d/layers/graphics/Deconflictor.js +1 -1
  258. package/views/3d/layers/graphics/ElevationAligners.js +1 -1
  259. package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
  260. package/views/3d/layers/graphics/Graphics3DFeatureProcessor.js +1 -1
  261. package/views/3d/layers/graphics/Graphics3DLineCalloutSymbolLayer.js +1 -1
  262. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  263. package/views/3d/layers/graphics/Graphics3DObjectSymbolLayer.js +1 -1
  264. package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.js +1 -1
  265. package/views/3d/layers/graphics/GraphicsProcessor.js +1 -1
  266. package/views/3d/layers/graphics/graphicUtils.js +1 -1
  267. package/views/3d/layers/graphics/lineUtils.js +1 -1
  268. package/views/3d/layers/graphics/objectResourceUtils.js +1 -1
  269. package/views/3d/layers/graphics/polygonUtils.js +1 -1
  270. package/views/3d/layers/graphics/symbolComplexity.js +1 -1
  271. package/views/3d/layers/i3s/I3SBinaryReader.js +1 -1
  272. package/views/3d/layers/i3s/PointRenderer.js +1 -1
  273. package/views/3d/layers/support/HeatmapFeatureProcessor.js +5 -0
  274. package/views/3d/layers/support/overlayImageUtils.js +1 -1
  275. package/views/3d/layers/support/patternUtils.js +1 -1
  276. package/views/3d/state/controllers/local/PinchAndPanController.js +1 -1
  277. package/views/3d/support/FrustumExtentIntersection.js +1 -1
  278. package/views/3d/support/LaserLineRenderer.js +1 -1
  279. package/views/3d/support/LaserlinePathData.js +1 -1
  280. package/views/3d/support/sunUtils.js +1 -1
  281. package/views/3d/terrain/OverlayRenderer.js +1 -1
  282. package/views/3d/terrain/PatchGeometryFactory.js +1 -1
  283. package/views/3d/terrain/TerrainRenderer.js +1 -1
  284. package/views/3d/terrain/TerrainSurface.js +1 -1
  285. package/views/3d/terrain/Tile.js +1 -1
  286. package/views/3d/terrain/terrainUtils.js +1 -1
  287. package/views/3d/terrain/tileUtils.js +1 -1
  288. package/views/3d/webgl-engine/collections/Component/ComponentObjectCollection.js +1 -1
  289. package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
  290. package/views/3d/webgl-engine/collections/Component/Material/ComponentTechnique.js +1 -1
  291. package/views/3d/webgl-engine/collections/Component/Material/shader/ComponentData.glsl.js +10 -10
  292. package/views/3d/webgl-engine/collections/Component/Material/shader/ComponentShader.glsl.js +1 -1
  293. package/views/3d/webgl-engine/collections/Component/SourceGeometry.js +1 -1
  294. package/views/3d/webgl-engine/core/renderPasses/AllRenderPasses.js +1 -1
  295. package/views/3d/webgl-engine/core/renderPasses/RenderPassManager.js +1 -1
  296. package/views/3d/webgl-engine/core/shaderLibrary/ForwardLinearDepth.glsl.js +2 -2
  297. package/views/3d/webgl-engine/core/shaderLibrary/ScreenSizeScaling.glsl.js +2 -2
  298. package/views/3d/webgl-engine/core/shaderLibrary/ScreenSpacePass.js +2 -2
  299. package/views/3d/webgl-engine/core/shaderLibrary/attributes/InstancedDoublePrecision.glsl.js +2 -2
  300. package/views/3d/webgl-engine/core/shaderLibrary/attributes/NormalAttribute.glsl.js +4 -4
  301. package/views/3d/webgl-engine/core/shaderLibrary/attributes/PathVertexPosition.glsl.js +1 -1
  302. package/views/3d/webgl-engine/core/shaderLibrary/attributes/PositionAttribute.glsl.js +1 -1
  303. package/views/3d/webgl-engine/core/shaderLibrary/attributes/RibbonVertexPosition.glsl.js +1 -1
  304. package/views/3d/webgl-engine/core/shaderLibrary/attributes/SymbolColor.glsl.js +1 -1
  305. package/views/3d/webgl-engine/core/shaderLibrary/attributes/TextureCoordinateAttribute.glsl.js +3 -3
  306. package/views/3d/webgl-engine/core/shaderLibrary/attributes/VertexColor.glsl.js +1 -1
  307. package/views/3d/webgl-engine/core/shaderLibrary/attributes/VertexNormal.glsl.js +6 -6
  308. package/views/3d/webgl-engine/core/shaderLibrary/attributes/VertexPosition.glsl.js +12 -12
  309. package/views/3d/webgl-engine/core/shaderLibrary/attributes/VertexTextureCoordinates.glsl.js +4 -4
  310. package/views/3d/webgl-engine/core/shaderLibrary/attributes/VerticalOffset.glsl.js +1 -1
  311. package/views/3d/webgl-engine/core/shaderLibrary/default/DefaultMaterialAuxiliaryPasses.glsl.js +16 -16
  312. package/views/3d/webgl-engine/core/shaderLibrary/default/RealisticTree.glsl.js +1 -1
  313. package/views/3d/webgl-engine/core/shaderLibrary/hud/HUD.glsl.js +5 -5
  314. package/views/3d/webgl-engine/core/shaderLibrary/hud/HUDOcclusionPass.glsl.js +3 -3
  315. package/views/3d/webgl-engine/core/shaderLibrary/raster/BasicGrid.glsl.js +2 -2
  316. package/views/3d/webgl-engine/core/shaderLibrary/shading/ComputeMaterialColor.glsl.js +6 -6
  317. package/views/3d/webgl-engine/core/shaderLibrary/shading/ComputeNormalTexture.glsl.js +2 -2
  318. package/views/3d/webgl-engine/core/shaderLibrary/shading/ComputeShadingNormal.glsl.js +10 -11
  319. package/views/3d/webgl-engine/core/shaderLibrary/shading/LineStipple.glsl.js +2 -2
  320. package/views/3d/webgl-engine/core/shaderLibrary/shading/MultipassGeometryTest.glsl.js +2 -2
  321. package/views/3d/webgl-engine/core/shaderLibrary/shading/MultipassTerrainTest.glsl.js +2 -2
  322. package/views/3d/webgl-engine/core/shaderLibrary/shading/Normals.glsl.js +6 -6
  323. package/views/3d/webgl-engine/core/shaderLibrary/shading/ReadBaseColorTexture.glsl.js +4 -4
  324. package/views/3d/webgl-engine/core/shaderLibrary/shading/ReadShadowMap.glsl.js +6 -6
  325. package/views/3d/webgl-engine/core/shaderLibrary/shading/Reprojection.glsl.js +4 -4
  326. package/views/3d/webgl-engine/core/shaderLibrary/shading/ScreenSpaceReflections.glsl.js +5 -5
  327. package/views/3d/webgl-engine/core/shaderLibrary/shading/VisualVariables.glsl.js +1 -1
  328. package/views/3d/webgl-engine/core/shaderLibrary/shading/Water.glsl.js +10 -10
  329. package/views/3d/webgl-engine/core/shaderLibrary/terrain/Terrain.glsl.js +1 -1
  330. package/views/3d/webgl-engine/core/shaderLibrary/util/BlendLayers.glsl.js +1 -1
  331. package/views/3d/webgl-engine/core/shaderLibrary/util/CloudsParallaxShading.glsl.js +4 -4
  332. package/views/3d/webgl-engine/core/shaderLibrary/util/View.glsl.js +1 -1
  333. package/views/3d/webgl-engine/lib/Camera.js +1 -1
  334. package/views/3d/webgl-engine/lib/DefaultVertexAttributeLocations.js +1 -1
  335. package/views/3d/webgl-engine/lib/DefaultVertexBufferLayouts.js +1 -1
  336. package/views/3d/webgl-engine/lib/Geometry.js +1 -1
  337. package/views/3d/webgl-engine/lib/GeometryUtil.js +1 -1
  338. package/views/3d/webgl-engine/lib/GridLocalOriginFactory.js +1 -1
  339. package/views/3d/webgl-engine/lib/MagnifierHelper.js +1 -1
  340. package/views/3d/webgl-engine/lib/Material.js +1 -1
  341. package/views/3d/webgl-engine/lib/RenderGeometry.js +1 -1
  342. package/views/3d/webgl-engine/lib/RenderPluginManager.js +1 -1
  343. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  344. package/views/3d/webgl-engine/lib/SSAOHelper.js +1 -1
  345. package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
  346. package/views/3d/webgl-engine/lib/ShadowMap.js +1 -1
  347. package/views/3d/webgl-engine/lib/SmaaRenderPass.js +1 -1
  348. package/views/3d/webgl-engine/lib/TextTextureAtlas.js +1 -1
  349. package/views/3d/webgl-engine/lib/Texture.js +1 -1
  350. package/views/3d/webgl-engine/lib/TextureUniformName.js +4 -0
  351. package/views/3d/webgl-engine/lib/UniformName.js +4 -0
  352. package/views/3d/webgl-engine/lib/VertexAttribute.js +5 -0
  353. package/views/3d/webgl-engine/lib/basicInterfaces.js +1 -1
  354. package/views/3d/webgl-engine/lib/depthRangeUtils.js +1 -1
  355. package/views/3d/webgl-engine/lib/edgeRendering/EdgeRenderer.js +1 -1
  356. package/views/3d/webgl-engine/lib/edgeRendering/EdgeShaderTechnique.js +1 -1
  357. package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
  358. package/views/3d/webgl-engine/lib/edgeRendering/bufferLayouts.js +1 -1
  359. package/views/3d/webgl-engine/lib/lodRendering/InstanceData.js +1 -1
  360. package/views/3d/webgl-engine/lib/lodRendering/RenderInstanceData.js +1 -1
  361. package/views/3d/webgl-engine/lib/pathGeometryUtils.js +1 -1
  362. package/views/3d/webgl-engine/materials/CheckerBoardMaterial.js +1 -1
  363. package/views/3d/webgl-engine/materials/ColorMaterial.js +1 -1
  364. package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
  365. package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
  366. package/views/3d/webgl-engine/materials/ImageMaterial.js +1 -1
  367. package/views/3d/webgl-engine/materials/LineCalloutMaterial.js +1 -1
  368. package/views/3d/webgl-engine/materials/MeasurementArrowMaterial.js +1 -1
  369. package/views/3d/webgl-engine/materials/NativeLineMaterial.js +1 -1
  370. package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
  371. package/views/3d/webgl-engine/materials/PathTechnique.js +1 -1
  372. package/views/3d/webgl-engine/materials/PatternMaterial.js +1 -1
  373. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  374. package/views/3d/webgl-engine/materials/ShadedColorMaterial.js +1 -1
  375. package/views/3d/webgl-engine/materials/SlicePlaneMaterial.js +1 -1
  376. package/views/3d/webgl-engine/materials/VisualVariableMaterialParameters.js +1 -1
  377. package/views/3d/webgl-engine/materials/WaterTechnique.js +1 -1
  378. package/views/3d/webgl-engine/materials/internal/DefaultBufferWriter.js +1 -1
  379. package/views/3d/webgl-engine/materials/internal/MaterialUtil.js +1 -1
  380. package/views/3d/webgl-engine/materials/internal/bufferWriterUtils.js +1 -1
  381. package/views/3d/webgl-engine/materials/internal/waterMaterialUtils.js +1 -1
  382. package/views/3d/webgl-engine/shaders/CheckerBoard.glsl.js +1 -1
  383. package/views/3d/webgl-engine/shaders/CheckerBoardTechnique.js +1 -1
  384. package/views/3d/webgl-engine/shaders/ColorMaterial.glsl.js +1 -1
  385. package/views/3d/webgl-engine/shaders/ColorMaterialTechnique.js +1 -1
  386. package/views/3d/webgl-engine/shaders/DefaultMaterial.glsl.js +1 -1
  387. package/views/3d/webgl-engine/shaders/DefaultMaterialTechnique.js +1 -1
  388. package/views/3d/webgl-engine/shaders/HUDMaterial.glsl.js +1 -1
  389. package/views/3d/webgl-engine/shaders/HUDMaterialTechnique.js +1 -1
  390. package/views/3d/webgl-engine/shaders/HighlightComposition.glsl.js +1 -1
  391. package/views/3d/webgl-engine/shaders/HighlightTechnique.js +1 -1
  392. package/views/3d/webgl-engine/shaders/ImageMaterial.glsl.js +1 -1
  393. package/views/3d/webgl-engine/shaders/ImageMaterialTechnique.js +1 -1
  394. package/views/3d/webgl-engine/shaders/LaserlinePath.glsl.js +1 -1
  395. package/views/3d/webgl-engine/shaders/LaserlinePathTechnique.js +1 -1
  396. package/views/3d/webgl-engine/shaders/LineCallout.glsl.js +1 -1
  397. package/views/3d/webgl-engine/shaders/LineCalloutTechnique.js +1 -1
  398. package/views/3d/webgl-engine/shaders/Magnifier.glsl.js +1 -1
  399. package/views/3d/webgl-engine/shaders/MeasurementArrow.glsl.js +1 -1
  400. package/views/3d/webgl-engine/shaders/NativeLine.glsl.js +1 -1
  401. package/views/3d/webgl-engine/shaders/Pattern.glsl.js +1 -1
  402. package/views/3d/webgl-engine/shaders/PatternTechnique.js +1 -1
  403. package/views/3d/webgl-engine/shaders/PointRenderer.glsl.js +1 -1
  404. package/views/3d/webgl-engine/shaders/RealisticTreeTechnique.js +1 -1
  405. package/views/3d/webgl-engine/shaders/RibbonLine.glsl.js +1 -1
  406. package/views/3d/webgl-engine/shaders/RibbonLineTechnique.js +1 -1
  407. package/views/3d/webgl-engine/shaders/SMAA.glsl.js +1 -1
  408. package/views/3d/webgl-engine/shaders/ShadedColorMaterial.glsl.js +1 -1
  409. package/views/3d/webgl-engine/shaders/ShadedColorMaterialTechnique.js +1 -1
  410. package/views/3d/webgl-engine/shaders/ShadowCastTechnique.js +1 -1
  411. package/views/3d/webgl-engine/shaders/ShadowHighlightTechnique.js +1 -1
  412. package/views/3d/webgl-engine/shaders/SlicePlaneMaterial.glsl.js +1 -1
  413. package/views/3d/webgl-engine/shaders/WaterSurface.glsl.js +1 -1
  414. package/views/3d/webgl-engine/shaders/sources/edgeRenderer/AdjustProjectedPosition.glsl.js +10 -10
  415. package/views/3d/webgl-engine/shaders/sources/edgeRenderer/DiscardShortEdges.glsl.js +1 -1
  416. package/views/3d/webgl-engine/shaders/sources/edgeRenderer/EdgeShaderProgram.glsl.js +1 -1
  417. package/views/3d/webgl-engine/shaders/sources/edgeRenderer/EdgeUtil.glsl.js +21 -21
  418. package/views/3d/webgl-engine/shaders/sources/edgeRenderer/LineAmplitude.glsl.js +6 -6
  419. package/views/3d/webgl-engine/shaders/sources/edgeRenderer/LineOffset.glsl.js +13 -13
  420. package/views/3d/webgl-engine/shaders/sources/edgeRenderer/UnpackAttributes.glsl.js +6 -6
  421. package/views/MapView.js +1 -1
  422. package/views/SceneView.js +1 -1
  423. package/views/View.js +1 -1
  424. package/views/input/recognizers/DoubleTapDrag.js +1 -1
  425. package/views/input/recognizers/ImmediateDoubleClick.js +1 -1
  426. package/views/input/recognizers/PointerClickHoldAndDrag.js +1 -1
  427. package/views/input/recognizers/SingleAndDoubleClick.js +1 -1
  428. package/views/interactive/editGeometry/operations/OffsetEdgeVertex.js +1 -1
  429. package/views/support/DefaultsFromMap.js +1 -1
  430. package/views/support/WatchUpdatingTracking.js +1 -1
  431. package/views/support/projectionUtils.js +5 -0
  432. package/views/webgl/BufferObject.js +1 -1
  433. package/views/webgl/InstanceCounter.js +1 -1
  434. package/views/webgl/Program.js +1 -1
  435. package/webdoc/support/{Thumbnail.js → SlideThumbnail.js} +1 -1
  436. package/webmap/Bookmark.js +1 -1
  437. package/webmap/Version.js +1 -1
  438. package/webscene/Slide.js +1 -1
  439. package/webscene/Version.js +1 -1
  440. package/webscene/support/SlideVisibleLayer.js +1 -1
  441. package/widgets/AreaMeasurement3D/AreaMeasurement3DViewModel.js +1 -1
  442. package/widgets/BasemapGallery/BasemapGalleryViewModel.js +1 -1
  443. package/widgets/BasemapGallery/support/BasemapGalleryItem.js +1 -1
  444. package/widgets/BasemapGallery/support/basemapCompatibilityUtils.js +1 -1
  445. package/widgets/BasemapGallery.js +1 -1
  446. package/widgets/Bookmarks/BookmarksViewModel.js +1 -1
  447. package/widgets/Bookmarks.js +1 -1
  448. package/widgets/DirectLineMeasurement3D/DirectLineMeasurement3DViewModel.js +1 -1
  449. package/widgets/FeatureTemplates/FeatureTemplatesViewModel.js +1 -1
  450. package/widgets/LineOfSight/LineOfSightViewModel.js +1 -1
  451. package/widgets/Search/support/locatorUtils.js +1 -1
  452. package/widgets/Search.js +1 -1
  453. package/widgets/Slice/SliceViewModel.js +1 -1
  454. package/widgets/TimeSlider.js +1 -1
  455. package/widgets/Weather/WeatherViewModel.js +1 -1
  456. package/widgets/Weather/css.js +1 -1
  457. package/widgets/Weather/enums.js +5 -0
  458. package/widgets/Weather.js +1 -1
  459. package/widgets/support/InteractiveToolViewModel.js +1 -1
  460. package/assets/esri/core/workers/chunks/00c5bb5eecb0e89266df.js +0 -1
  461. package/assets/esri/core/workers/chunks/021a37e2b191298e80b7.js +0 -1
  462. package/assets/esri/core/workers/chunks/1370c92c40fd6271553c.js +0 -1
  463. package/assets/esri/core/workers/chunks/14bef72154b3a19561a7.js +0 -1
  464. package/assets/esri/core/workers/chunks/18668dc45eb9e35530df.js +0 -1
  465. package/assets/esri/core/workers/chunks/1e4d37c2b9dc83d20a11.js +0 -1
  466. package/assets/esri/core/workers/chunks/1fbcc8424452d0256bd6.js +0 -1
  467. package/assets/esri/core/workers/chunks/208a7e24e19fc5633dd7.js +0 -1
  468. package/assets/esri/core/workers/chunks/22b09e276c9b9f22f0f8.js +0 -1
  469. package/assets/esri/core/workers/chunks/23b15e7c2f96d260e16c.js +0 -1
  470. package/assets/esri/core/workers/chunks/25a3e9bc0b4c7e0d3165.js +0 -1
  471. package/assets/esri/core/workers/chunks/2792ca40f1e92849247c.js +0 -1
  472. package/assets/esri/core/workers/chunks/2a96f1bba9ce6883e5e0.js +0 -1
  473. package/assets/esri/core/workers/chunks/3231ee3e090bb4cac3fc.js +0 -1
  474. package/assets/esri/core/workers/chunks/36a3f6fb4d1d18fcb642.js +0 -1
  475. package/assets/esri/core/workers/chunks/36e250278b5622ccf068.js +0 -1
  476. package/assets/esri/core/workers/chunks/395ba088d4864588ff66.js +0 -1
  477. package/assets/esri/core/workers/chunks/3aa4194dc5497c57647f.js +0 -1
  478. package/assets/esri/core/workers/chunks/3cc77692b2eee27b9c9e.js +0 -1
  479. package/assets/esri/core/workers/chunks/40a1e713f63ec77110c0.js +0 -1
  480. package/assets/esri/core/workers/chunks/4385a268c2a64281d1c1.js +0 -1
  481. package/assets/esri/core/workers/chunks/46b4bb66a54bbd8e2e57.js +0 -1
  482. package/assets/esri/core/workers/chunks/4bfbf5a34c9207fdcf44.js +0 -1
  483. package/assets/esri/core/workers/chunks/5a4a5585ec8027079f32.js +0 -1
  484. package/assets/esri/core/workers/chunks/5d4863a92b03bebc1b54.js +0 -1
  485. package/assets/esri/core/workers/chunks/5d991b74d958005c26c4.js +0 -1
  486. package/assets/esri/core/workers/chunks/634b5ccd7a3ac67f855d.js +0 -1
  487. package/assets/esri/core/workers/chunks/662d13f68cf3ec92439b.js +0 -1
  488. package/assets/esri/core/workers/chunks/663ad15b86936eb06b69.js +0 -1
  489. package/assets/esri/core/workers/chunks/7bc5cc5dbf1b7b70ddac.js +0 -1
  490. package/assets/esri/core/workers/chunks/7d661129a0d8c466eeec.js +0 -1
  491. package/assets/esri/core/workers/chunks/8070972c0efb78523b68.js +0 -1
  492. package/assets/esri/core/workers/chunks/85e27fd949475f9a6bbc.js +0 -1
  493. package/assets/esri/core/workers/chunks/8b6ab6202a40fe622833.js +0 -1
  494. package/assets/esri/core/workers/chunks/96ab518eb6ba11333dee.js +0 -1
  495. package/assets/esri/core/workers/chunks/9796d54ff12b6429164a.js +0 -1
  496. package/assets/esri/core/workers/chunks/98986e6601b0366376b4.js +0 -1
  497. package/assets/esri/core/workers/chunks/9cdcf9309d6feda70185.js +0 -1
  498. package/assets/esri/core/workers/chunks/aa861b8eae6c85f3dad4.js +0 -1
  499. package/assets/esri/core/workers/chunks/aace7e1fef256bb961c9.js +0 -1
  500. package/assets/esri/core/workers/chunks/ad081d8e49e7f90c3c26.js +0 -1
  501. package/assets/esri/core/workers/chunks/af5694b4d278cf1db2d9.js +0 -1
  502. package/assets/esri/core/workers/chunks/afbb4f802ca5774f0326.js +0 -1
  503. package/assets/esri/core/workers/chunks/b2c5f92e3d7606297ca9.js +0 -1
  504. package/assets/esri/core/workers/chunks/b8316c6469a543029bc6.js +0 -1
  505. package/assets/esri/core/workers/chunks/ba615f118a3a8970ef25.js +0 -1
  506. package/assets/esri/core/workers/chunks/ba6654a885be4b7a43f0.js +0 -1
  507. package/assets/esri/core/workers/chunks/bf0a65b4be31959f921d.js +0 -1
  508. package/assets/esri/core/workers/chunks/c11474b702dfb94e8e87.js +0 -1
  509. package/assets/esri/core/workers/chunks/c890c7fca27170e3341f.js +0 -1
  510. package/assets/esri/core/workers/chunks/c976785f2391c77d8a30.js +0 -1
  511. package/assets/esri/core/workers/chunks/ca2f5faa01d99c21ec14.js +0 -1
  512. package/assets/esri/core/workers/chunks/cef4af64860ebbfc1c47.js +0 -1
  513. package/assets/esri/core/workers/chunks/cfbffa429d88e7709c3f.js +0 -1
  514. package/assets/esri/core/workers/chunks/d24c4fbc567486b1188f.js +0 -1
  515. package/assets/esri/core/workers/chunks/de6cff7b6cbbf99b20d1.js +0 -981
  516. package/assets/esri/core/workers/chunks/e4f93c55eaefab4192b5.js +0 -1
  517. package/assets/esri/core/workers/chunks/e59764ee8cf25d4f74e2.js +0 -1
  518. package/assets/esri/core/workers/chunks/ec89466f76d0ba22525e.js +0 -1
  519. package/assets/esri/core/workers/chunks/ee45618c45806ab654cb.js +0 -1
  520. package/assets/esri/core/workers/chunks/f467c8f1fce22f6f599c.js +0 -1
  521. package/assets/esri/core/workers/chunks/f4baa5ea2e42b1317941.js +0 -1
  522. package/assets/esri/core/workers/chunks/face43cf5abcd2f5bd9d.js +0 -1
  523. package/assets/esri/core/workers/chunks/ffaf091c6023225cf5aa.js +0 -1
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Color.js";import r from"../../../core/Accessor.js";import{isSome as i,isNone as s}from"../../../core/maybe.js";import n from"../../../core/ObjectPool.js";import{property as a}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as o}from"../../../core/accessorSupport/decorators/subclass.js";import{j as l}from"../../../chunks/mat4.js";import{c as d,I as h}from"../../../chunks/mat4f64.js";import{f as c,s as u,n as p,d as g}from"../../../chunks/vec3.js";import{Z as f,c as m}from"../../../chunks/vec3f64.js";import{s as T}from"../../../chunks/vec4.js";import{Z as R,c as b}from"../../../chunks/vec4f64.js";import{create as _,set as v,expandWithOffset as y}from"../../../geometry/support/aaBoundingBox.js";import{BufferViewVec3f as x}from"../../../geometry/support/buffer/BufferView.js";import{requestImage as A}from"../../../support/requestImageUtils.js";import{ViewingMode as D}from"../../ViewingMode.js";import{TextureUpdate as E,OverlayIndex as O}from"./interfaces.js";import{LayerClass as P}from"./LayerClass.js";import{OverlaySource as I}from"./Overlay.js";import{overlayRenderOccludedFlag as S}from"./OverlayRenderer.js";import{clearCaches as C,getGlobalSkirtGeometry as k,intersectSkirtsGlobal as N,intersectSkirtsLocal as q}from"./PatchGeometryFactory.js";import{PatchRenderData as w}from"./PatchRenderData.js";import{RenderOrder as L}from"./RenderOrder.js";import{ScaleRangeQueries as M}from"./ScaleRangeQueries.js";import{DEFAULT_TILE_BACKGROUND as G}from"./TerrainConst.js";import{TileRenderer as U}from"./TileRenderer.js";import{TileUpdate as j}from"./TileUpdate.js";import{IteratorPreorder as B,sortTiles as F,compareTiles as H}from"./tileUtils.js";import{componentMinimalSizeForIntersectionData as z,ComponentIntersectionData as V}from"../webgl-engine/collections/Component/ComponentIntersectionData.js";import{ShaderOutput as W}from"../webgl-engine/core/shaderLibrary/ShaderOutputOptions.js";import{bindSliceUniforms as Q}from"../webgl-engine/core/shaderLibrary/Slice.glsl.js";import{bindSSRUniforms as Y}from"../webgl-engine/core/shaderLibrary/shading/ScreenSpaceReflections.glsl.js";import{OverlayMode as X}from"../webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js";import{bindProjectionMatrix as Z}from"../webgl-engine/core/shaderLibrary/util/View.glsl.js";import{RenderRequestType as K,VertexAttribute as J}from"../webgl-engine/lib/basicInterfaces.js";import{createEmptyTexture as $}from"../webgl-engine/lib/glUtil3D.js";import{newIntersectorResult as ee}from"../webgl-engine/lib/Intersector.js";import{IntersectorType as te,StoreResults as re}from"../webgl-engine/lib/IntersectorInterfaces.js";import{RenderOccludedFlag as ie}from"../webgl-engine/lib/Material.js";import{RenderPass as se}from"../webgl-engine/lib/RenderPass.js";import{RenderSlot as ne}from"../webgl-engine/lib/RenderSlot.js";import{getSettings as ae}from"../webgl-engine/lib/screenSizePerspectiveUtils.js";import{TERRAIN_ID as oe,getVerticalOffsetTerrain as le}from"../webgl-engine/lib/verticalOffsetUtils.js";import{bindScreenSizePerspective as de,intersectAabbInvDirBefore as he,intersectTriangles as ce}from"../webgl-engine/materials/internal/MaterialUtil.js";import{TerrainTechniqueConfiguration as ue,TerrainTechnique as pe}from"../webgl-engine/shaders/TerrainTechnique.js";import{ClearBufferBit as ge,PrimitiveType as fe}from"../../webgl/enums.js";const me=7,Te=10,Re=_(),be=b();let _e=class extends r{constructor(e){super(e),this.type=te.TERRAIN,this.isGround=!0,this.tileSize=256,this.rctx=null,this._isTransparent=!1,this._scaleRangeQueries=new M,this.renderDataPool=new n(w),this._patchGroups=new Map,this.patchGroupsDirty=!0,this.tileIterator=new B,this.highestVisibleLODTile=null,this.visible=!0,this._opaque=!0,this._skirtScale=1,this._velvetOverground=!0,this.castShadows=!0,this._ssrEnabled=!1,this.emptyTex=null,this.tileRenderer=null,this.tileBackgroundInitialized=!1,this.tileBackgroundUpdating=!1,this.stencilEnabledLayerExtents=[],this.numTrianglesRendered=0,this.numTilesRendered=0,this.numTilesCulled=0,this.numOriginsRendered=0,this.overlayOpacity=1,this.needsHighlight=!1,this.renderOccludedFlags=ie.Occlude}get isGlobal(){return this.stage.viewingMode===D.Global}initialize(){const e=[ne.OPAQUE_TERRAIN,ne.TRANSPARENT_TERRAIN,ne.OCCLUDED_TERRAIN];this.stage.addRenderPlugin(e,this)}destroy(){this.stage.removeRenderPlugin(this),C()}get updating(){return!this.tileBackgroundInitialized||this.tileBackgroundUpdating}get canRender(){return this.visible&&!!this._rootTiles&&this.tileBackgroundInitialized&&!this.renderingDisabled}set renderingDisabled(e){this._set("renderingDisabled",!!e),this.setNeedsRender()}set opaque(e){this._opaque!==e&&(this._opaque=e,this.setNeedsRender())}get opaque(){return this._opaque&&!this.shaderTechniqueConfig.slicePlaneEnabled}get needsLinearDepth(){return this.overlayRenderer.hasWater}set isTransparent(e){this._isTransparent!==e&&(this._isTransparent=e,this.setNeedsRender())}get isTransparent(){return this._isTransparent}set skirtScale(e){e!==this._skirtScale&&(this._skirtScale=e,this.setNeedsRender())}get skirtScale(){return this._skirtScale}get renderPatchBorders(){return!!this.shaderTechniqueConfig.tileBorders}set renderPatchBorders(e){this.shaderTechniqueConfig.tileBorders!==e&&(this.shaderTechniqueConfig.tileBorders=e,this.setNeedsRender(),this.notifyChange("renderPatchBorders"))}get cullBackFaces(){return this.shaderTechniqueConfig.backfaceCullingEnabled}set cullBackFaces(e){this.shaderTechniqueConfig.backfaceCullingEnabled!==e&&(this.shaderTechniqueConfig.backfaceCullingEnabled=e,this.notifyChange("cullBackFaces"),this.setNeedsRender())}set renderOrder(e){this._set("renderOrder",e),this.setNeedsRender()}set velvetOverground(e){this._velvetOverground!==e&&(this._velvetOverground=e,this.setNeedsRender())}get layerUid(){return oe}get slicePlaneEnabled(){return this.shaderTechniqueConfig.slicePlaneEnabled}set slicePlaneEnabled(e){this.shaderTechniqueConfig.slicePlaneEnabled!==e&&(this.shaderTechniqueConfig.slicePlaneEnabled=e,this.setNeedsRender())}set textureFadingEnabled(e){this.shaderTechniqueConfig.textureFadingEnabled!==e&&(this.shaderTechniqueConfig.textureFadingEnabled=e,this.setNeedsRender())}setDebugScreenSizePerspective(e){this.shaderTechniqueConfig.screenSizePerspective!==e&&(this.shaderTechniqueConfig.screenSizePerspective=e,this.setNeedsRender())}setRootTiles(e){this._rootTiles=e,this.setNeedsRender()}setNeedsHighlight(e){this.needsHighlight=e,this.setNeedsRender()}setRenderOccludedOverlay(e){this.renderOccludedFlags=e?S:ie.Occlude,this.setNeedsRender()}setStencilEnabledLayerExtents(e){this.stencilEnabledLayerExtents=e,this.setNeedsRender()}setTileSize(e){this.tileSize=e,this.tileRenderer&&(this.tileRenderer.tileSize=e),this.setNeedsRender()}loadTile(e){e.renderData||(e.renderData=this.renderDataPool.acquire(),e.renderData.init(e),e.renderData.localOrigin=this._getLocalOriginOfTile(e)),this.updateTileGeometry(e),this.updateTileTexture(e,j.TEXTURE_FADING)}queryVisibleLevelRange(e,t,r,i){this._scaleRangeQueries.queryVisibleLevelRange(e,t,r,i),this.setNeedsRender()}updateTileTexture(e,t){this.tileRenderer&&this.tileBackgroundInitialized&&(this.tileRenderer.updateTileTexture(e,t===j.TEXTURE_FADING?E.FADING:E.UNFADED),this.setNeedsRender(),e.resetPendingUpdate(t))}updateTileGeometry(e){for(const t of e.layerInfo[P.ELEVATION])t.pendingUpdates&=~j.GEOMETRY;e.resetPendingUpdate(j.GEOMETRY),e.renderData.updateGeometry(this.rctx,this.wireframe)&&this.setNeedsRender()}unloadTile(e){e.renderData&&(e.renderData.releaseGeometry()&&this.setNeedsRender(),this.renderDataPool.release(e.renderData),e.renderData.clear(),e.renderData=null,e.setMemoryDirty(),this.setNeedsRender())}_getLocalOriginOfTile(e){const t=Te-me,r=Math.max(0,Math.floor((e.level-t)/me)*me);if(this.isGlobal&&0===r)return f;for(;e.parent&&e.level>r;)e=e.parent;return e.centerAtSeaLevel}setVisibility(e){this.visible=e,this.setNeedsRender()}getStats(){return{numTilesRendered:this.numTilesRendered,numTilesCulled:this.numTilesCulled,numTrianglesRendered:this.numTrianglesRendered,numOriginsRendered:this.numOriginsRendered}}set wireframe(e){this._get("wireframe")!==e&&(this._set("wireframe",e),this.allTiles.forAll((t=>{var r;return null==(r=t.renderData)?void 0:r.updateGeometry(this.rctx,e)})),this.setNeedsRender())}setNeedsRender(e=K.UPDATE){this.patchGroupsDirty=!0,this.context.requestRender(e)}setTileBackground(e){this.tileBackground=e,this._updateTileBackground()}initializeRenderContext(e){this.context=e,this.rctx=e.renderContext.rctx,this.shaderTechniques=e.shaderTechniqueRep,this.shaderTechniqueConfig=new ue,this.tileRenderer=new U(this.rctx,this.tileSize,this.shaderTechniques),this.tileBackground&&this._updateTileBackground(),this.emptyTex=$(this.rctx)}uninitializeRenderContext(){null!=this.emptyTex&&(this.emptyTex.dispose(),this.emptyTex=null),this.tileRenderer&&(this.tileRenderer.dispose(),this.tileRenderer=null)}intersect(e,t,r,n){if(!this._rootTiles||e.options.selectOpaqueTerrainOnly&&e.options.selectionMode&&!this._opaque)return;const a=De,o=Ee;c(a,n,r),u(o,1/a[0],1/a[1],1/a[2]);const l=e.results.min,d=e.results.max,p=e.results.ground,f=e.options.store===re.MIN,m=!!e.results.ground.target,T=le(e.verticalOffset),R=this._skirtScale,b=e.tolerance;let _,A=f&&i(l.dist)?l.dist:1/0;const D=u=>{const m=u.renderData;if(null==m)return;const D=m.geometryInfo;v(Re,D.boundingBox);const E=m.localOrigin;i(T)&&(T.localOrigin=E,T.applyToAabb(Re));const O=-R*D.skirtLength;if(0!==O){const e=u.up;y(Re,O*e[0],O*e[1],O*e[2])}const P=Re;if(Oe[0]=r[0]-E[0],Oe[1]=r[1]-E[1],Oe[2]=r[2]-E[2],!he(P,Oe,o,b,A))return;const I=(e,t,r)=>{e.set(this.type,u,t,r,h),A=f&&i(l.dist)?l.dist:1/0},S=(o,h)=>{if(i(h)&&o>=0&&(e.options.backfacesTerrain||g(h,a)<0)&&(e.options.invisibleTerrain||!e.options.selectionMode||null==t||t(r,n,o))){if((null==p.dist||o<p.dist)&&I(p,o,h),e.options.isFiltered)return;e.options.store===re.ALL&&(s(_)?(_=ee(e.ray),I(_,o,h),e.results.all.push(_)):o<_.dist&&I(_,o,h)),(null==l.dist||o<l.dist)&&I(l,o,h),e.options.store!==re.MIN&&(null==d.dist||o>d.dist)&&I(d,o,h)}},C=Pe;c(C,n,E);const w=D.indices,L=D.vertexAttributes,M={data:L.getField(J.POSITION,x).typedBuffer,size:3,stride:L.stride/4},G=D.numWithoutSkirtIndices/3;if(!i(T)&&G>z){const e=u.renderData;i(e.intersectionData)||(e.intersectionData=new V(w,0,G,M)),e.intersectionData.intersectRay({r0:Oe,r1:C},S)}else ce(Oe,C,0,G,w,M,null,T,S);if(0!==O){const e=w.length/3;if(this.isGlobal){const t=e-G;if(!i(T)&&t>z){const r=u.renderData;if(!i(r.skirtIntersectionData)){const i=k(w,G,e,L,O,E);r.skirtIntersectionData=new V(i.indices,0,t,{data:i.vertices,stride:3})}r.skirtIntersectionData.intersectRay({r0:Oe,r1:C},S)}else N(Oe,C,G,e,w,L,O,E,T,S)}else q(Oe,C,G,e,w,L,O,T,S)}},E=this._rootTiles;if(i(E)){(()=>{const t=this.tileIterator;t.reset(E);const s=e.options.invisibleTerrain;for(;!t.done;){const e=t.next();!(e.visible||s&&e.intersectsClippingArea)||!i(T)&&!e.intersectsRay(r,a,b,A,R)||m&&this._useStencilForTile(e)?t.skipSubtree():D(e)}})()}}prepareTechnique(e){if(e.slot===ne.OCCLUDED_TERRAIN){if(0==(e.renderOccludedMask&S))return null}else{const t=this.opaque?ne.OPAQUE_TERRAIN:ne.TRANSPARENT_TERRAIN;if(e.slot!==t)return null}switch(e.pass){case se.MATERIAL:{const t=e.shadowMap&&e.shadowMap.enabled;this.shaderTechniqueConfig.receiveShadows!==t&&(this.shaderTechniqueConfig.receiveShadows=t);const r=this.overlayRenderer.isEmpty()?X.Disabled:this.overlayRenderer.hasWater?X.EnabledWithWater:X.Enabled;this.shaderTechniqueConfig.overlayMode!==r&&(this.shaderTechniqueConfig.overlayMode=r);const i=e.slot===ne.OCCLUDED_TERRAIN?I.Occluded:I.ColorAndWater;return this._updateTechnique(W.Color,i===I.Occluded)}case se.MATERIAL_DEPTH_SHADOWMAP_ALL:case se.MATERIAL_DEPTH_SHADOWMAP_DEFAULT:return this.castShadows&&1===e.scenelightingData.globalFactor?this._updateTechnique(W.Shadow,!1):null;case se.MATERIAL_DEPTH:return this.isTransparent&&this.overlayRenderer.isEmpty()?null:this._updateTechnique(W.Depth,!1);case se.MATERIAL_NORMAL:return this._updateTechnique(W.Normal,!1);case se.MATERIAL_HIGHLIGHT:return this.needsHighlight?this._updateTechnique(W.Highlight,!1):null}return null}render(e,t){const r=e.pass,i=1===e.scenelightingData.globalFactor;switch(this._updatePatchGroups(),r){case se.MATERIAL:{const r=e.slot===ne.OCCLUDED_TERRAIN?I.Occluded:I.ColorAndWater;this._renderMaterialPass(e,t,r);break}case se.MATERIAL_DEPTH_SHADOWMAP_ALL:case se.MATERIAL_DEPTH_SHADOWMAP_DEFAULT:this.castShadows&&i&&this._renderAuxiliaryPass(e,t,I.None);break;case se.MATERIAL_DEPTH:this.isTransparent&&this.overlayRenderer.isEmpty()||this._renderAuxiliaryPass(e,t,I.None);break;case se.MATERIAL_NORMAL:this._renderAuxiliaryPass(e,t,I.None);break;case se.MATERIAL_HIGHLIGHT:this.needsHighlight&&(this._renderAuxiliaryPass(e,t,I.Highlight),e.rctx.clearSafe(ge.DEPTH_BUFFER_BIT))}this._scaleRangeQueries.hasPendingQueries()&&this.setNeedsRender()}_renderMaterialPass(e,t,r){const{rctx:i,camera:s}=e;this._ssrEnabled=e.ssrParams.ssrEnabled;const n=t.program;i.useProgram(n),this.shaderTechniqueConfig.overlayMode!==X.Disabled&&r===I.ColorAndWater&&e.ssrParams&&Y(n,e.ssrParams),e.shadowMap.bind(n),e.ssaoHelper.bind(n,e.camera),this._bindOverlayData(n,r),n.setUniformMatrix4fv("viewNormal",s.viewInverseTransposeMatrix),Z(n,s.projectionMatrix),e.scenelightingData.setUniforms(n,!0);const a=s.viewMatrix;u(Ae,a[12],a[13],a[14]),p(Ae,Ae),n.setUniform3fv("viewDirection",Ae),this.numTilesRendered=0,this.numTilesCulled=0,this.numTrianglesRendered=0,this.numOriginsRendered=0,this._scaleRangeQueries.prepareQueries(),this.opaque?this._renderPatchGroups(e,t,r):e.offscreenRenderingHelper.renderToTargets((()=>this._renderPatchGroups(e,t,r)),e.offscreenRenderingHelper.tmpColor,e.offscreenRenderingHelper.mainDepth,[0,0,0,0]),this._scaleRangeQueries.processQueries()}_renderAuxiliaryPass(e,t,r){const i=t.program;if(e.rctx.useProgram(i),e.pass===se.MATERIAL_HIGHLIGHT){const t=e.offscreenRenderingHelper;i.bindTexture(t.depthTexture,"depthTex"),i.setUniform4f("highlightViewportPixelSz",0,0,1/t.width,1/t.height)}else i.setUniformMatrix4fv("viewNormal",e.camera.viewInverseTransposeMatrix),e.pass!==se.MATERIAL_DEPTH&&e.pass!==se.MATERIAL_DEPTH_SHADOWMAP_ALL&&e.pass!==se.MATERIAL_DEPTH_SHADOWMAP_DEFAULT||i.setUniform2fv("nearFar",e.camera.nearFar);this._renderPatchGroupsAuxiliary(e,t,r)}_updateTileBackground(){if(!this.tileRenderer)return;this.tileBackgroundUpdating=!0;const e=()=>{this.tileBackgroundInitialized=!0,this.tileBackgroundUpdating=!1,this.shaderTechniqueConfig.useGrid=this.tileRenderer.backgroundIsGrid,this.shaderTechniqueConfig.hasBackgroundColor=!this.tileRenderer.backgroundIsGrid&&!!i(this.tileRenderer.backgroundColor),this.allTiles.forAll((e=>this.tileRenderer.updateTileTexture(e,E.FADING))),this.setNeedsRender()};if("string"==typeof this.tileBackground){const t=this.tileBackground;A(t).then((r=>{t===this.tileBackground&&this.tileRenderer&&(this.tileRenderer.setBackground(r,this.tileBackground===G),e())}))}else{const r=this.tileBackground?t.toUnitRGBA(this.tileBackground):[0,0,0,0];this.tileRenderer.setBackground(r,!1),e()}}_updatePatchGroups(){if(this.patchGroupsDirty){if(this.highestVisibleLODTile=null,this._rebuildPatchGroups(),this.renderOrder!==L.NONE){const e=Array.from(this._patchGroups.values());e.forEach((e=>F(this.renderOrder,e))),e.sort(((e,t)=>H(e[0],t[0],this.renderOrder))),this._patchGroups=new Map(e.map((e=>[e[0].renderData.localOrigin,e])))}this.patchGroupsDirty=!1}}_rebuildPatchGroups(){const e=this._rootTiles;if(!s(e)){this._patchGroups.clear();for(const t of e)this._rebuildPatchGroupsForRootTile(t)}}_rebuildPatchGroupsForRootTile(e){const t=this.tileIterator;for(t.resetOne(e);!t.done;){const e=t.next(),r=e.renderData;if(!r||e.visible)if(e.rendered){if(r){const i=this._patchGroups.get(r.localOrigin)||new Array;this._patchGroups.set(r.localOrigin,i),i.push(e),(!this.highestVisibleLODTile||e.vlevel>this.highestVisibleLODTile.vlevel)&&(this.highestVisibleLODTile=e),t.skipSubtree()}}else this.numTilesCulled++;else this.numTilesCulled++,t.skipSubtree()}}_useStencilForTile(e){for(const t of this.stencilEnabledLayerExtents)if(e.intersectsExtent(t))return!0;return!1}_renderPatchGroupsAuxiliary(e,t,r){const i=e.rctx;t.useStencil=!1,t.bindPipelineState(i,e.slot);const s=this.stencilEnabledLayerExtents.length>0,n=t.program;n.setUniformMatrix4fv("proj",e.camera.projectionMatrix),n.setUniform1f("skirtScale",this._skirtScale),r!==I.None&&this._bindOverlayData(n,r),this._patchGroups.forEach((i=>{const a=i[0].renderData.localOrigin;this._bindPatchGroupData(n,a,e.camera.eye,e.camera.viewMatrix);for(let n=0;n<i.length;n++)this._renderPatch(e,t,i[n],fe.TRIANGLES,s,r)})),e.rctx.bindVAO(null)}_renderPatchGroups(e,t,r){const n=e.rctx,a=e.camera,o=a.viewMatrix,l=t.program;if(t.useStencil=!1,t.bindPipelineState(n,e.slot),this.shaderTechniqueConfig.screenSizePerspective&&this.pointsOfInterest){const e=ae(this.stage.viewingMode,this.ellipsoidRadius),t=this.pointsOfInterest.centerOnSurfaceFrequent.distance;e.update({distance:t,fovY:a.fovY}),de(e,l,"screenSizePerspective")}const d=this.stencilEnabledLayerExtents.length>0,h=r===I.Occluded;h&&(l.bindTexture(this.emptyTex,"tex"),l.setUniform1f("blend",1),l.setUniform4fv("texOffsetAndScale",R));const c=i(this.tileRenderer.backgroundColor)?this.tileRenderer.backgroundColor:f;this.shaderTechniqueConfig.hasBackgroundColor&&l.setUniform3fv("backgroundColor",c);const u=h?0:this._skirtScale;l.setUniform1f("skirtScale",u);const p=this.wireframe?fe.LINES:fe.TRIANGLES;this.shaderTechniqueConfig.textureFadingEnabled&&l.bindTexture(this.emptyTex,"texNext"),this._patchGroups.forEach((n=>{const c=n[0].renderData.localOrigin;this._bindPatchGroupData(l,c,a.eye,o);const u=e.sliceHelper&&e.sliceHelper.plane;Q(l,t.configuration,u,c),e.shadowMap&&e.shadowMap.bindView(l,c),this.numOriginsRendered++;for(let a=0;a<n.length;a++){const o=n[a],c=o.renderData.textureReference;if(s(c))continue;if(!h){this._scaleRangeQueries.scaleQueriesForTile(o),ye(o.renderData.geometryInfo.uvOffsetAndScale,c.offsetAndScale,be),l.setUniform4fv("texOffsetAndScale",be),l.bindTexture(c.texture.texture,"tex");const e=o.renderData.textureFadeFactor,t=e<1?o.renderData.nextTextureReference:null;this.shaderTechniqueConfig.textureFadingEnabled&&i(t)&&e<1?(ye(o.renderData.geometryInfo.uvOffsetAndScale,t.offsetAndScale,be),l.setUniform1f("fadeFactor",e),l.setUniform4fv("nextTexOffsetAndScale",be),l.setUniform3fv("nextTexOpacities",t.opacities),l.bindTexture(t.texture.texture,"texNext")):l.setUniform1f("fadeFactor",1),o.renderData.textureIsFading&&this.setNeedsRender(),l.setUniform3fv("textureOpacities",c.opacities)}const u=this._renderPatch(e,t,o,p,d,r);o.renderOrder=this.numTilesRendered,this.numTilesRendered++,this.numTrianglesRendered+=u/3}})),n.bindVAO(null)}_renderPatch(e,t,r,i,n,a){if(s(r.renderData.vao.indexBuffer))return 0;const o=t.program;a!==I.None&&this._bindOverlayPatchData(o,r.renderData.overlay),n&&(t.useStencil=this._useStencilForTile(r),t.bindPipelineState(e.rctx,e.slot));const l=0===this._skirtScale?r.renderData.geometryInfo.numWithoutSkirtIndices:r.renderData.vao.indexBuffer.size;return e.rctx.bindVAO(r.renderData.vao),o.assertCompatibleVertexAttributeLocations(r.renderData.vao),e.rctx.drawElements(i,l,r.renderData.vao.indexBuffer.indexType,0),l}_bindPatchGroupData(e,t,r,i){e.setUniform3fv("origin",t),l(xe,i,t),e.setUniformMatrix4fv("view",xe),e.setUniform3f("camPos",r[0]-t[0],r[1]-t[1],r[2]-t[2])}_bindOverlayData(e,t){if(this.shaderTechniqueConfig.overlayMode===X.Disabled)return;e.setUniform1f("overlayOpacity",this.overlayOpacity);const r=this.overlayRenderer.overlays;if(r.length>O.INNER){const s=r[O.INNER],n=s.getColorTexture(t);if(e.bindTexture(i(n)?n:this.emptyTex,"ovColorTex"),this.shaderTechniqueConfig.overlayMode===X.EnabledWithWater){const r=s.getNormalTexture(t);e.bindTexture(i(r)?r:this.emptyTex,"ovWaterTex")}}}_bindOverlayPatchData(e,t){e.setUniform4fv("overlayTexOffset",t.offsets),e.setUniform4fv("overlayTexScale",t.scales)}_updateTechnique(e,t){return this.shaderTechniqueConfig.output=e,e===W.Color&&(this.shaderTechniqueConfig.atmosphere=this.isGlobal&&this._velvetOverground,this.shaderTechniqueConfig.ssrEnabled=this._ssrEnabled),this.shaderTechniqueConfig.renderOccluded=t,this.shaderTechniqueConfig.stencilEnabled=!1,this._shaderTechnique=this.shaderTechniques.releaseAndAcquire(pe,this.shaderTechniqueConfig,this._shaderTechnique),this._shaderTechnique}get test(){return{tileRenderer:this.tileRenderer}}};e([a()],_e.prototype,"tileBackgroundInitialized",void 0),e([a()],_e.prototype,"tileBackgroundUpdating",void 0),e([a({constructOnly:!0})],_e.prototype,"overlayRenderer",void 0),e([a({constructOnly:!0})],_e.prototype,"stage",void 0),e([a({readOnly:!0})],_e.prototype,"isGlobal",null),e([a({constructOnly:!0})],_e.prototype,"allTiles",void 0),e([a({constructOnly:!0})],_e.prototype,"ellipsoidRadius",void 0),e([a({readOnly:!0})],_e.prototype,"updating",null),e([a({value:!1})],_e.prototype,"renderingDisabled",null),e([a()],_e.prototype,"renderPatchBorders",null),e([a()],_e.prototype,"cullBackFaces",null),e([a({value:L.FRONT_TO_BACK})],_e.prototype,"renderOrder",null),e([a()],_e.prototype,"wireframe",null),_e=e([o("esri.views.3d.terrain.TerrainRenderer")],_e);const ve=_e;function ye(e,t,r){const i=e[0]*t[2]+t[0],s=e[1]*t[3]+t[1],n=e[2]*t[2],a=e[3]*t[3];T(r,i,s,n,a)}const xe=d(),Ae=m(),De=m(),Ee=m(),Oe=m(),Pe=m();export{ve as default};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Color.js";import r from"../../../core/Accessor.js";import{isSome as i,isNone as s}from"../../../core/maybe.js";import n from"../../../core/ObjectPool.js";import{property as a}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as o}from"../../../core/accessorSupport/decorators/subclass.js";import{j as l}from"../../../chunks/mat4.js";import{c as d,I as h}from"../../../chunks/mat4f64.js";import{f as c,s as u,n as p,d as g}from"../../../chunks/vec3.js";import{Z as f,c as m}from"../../../chunks/vec3f64.js";import{Z as T,c as R}from"../../../chunks/vec4f64.js";import{create as b,set as _,expandWithOffset as y}from"../../../geometry/support/aaBoundingBox.js";import{BufferViewVec3f as v}from"../../../geometry/support/buffer/BufferView.js";import{requestImage as x}from"../../../support/requestImageUtils.js";import{ViewingMode as A}from"../../ViewingMode.js";import{TextureUpdate as D,OverlayIndex as E}from"./interfaces.js";import{LayerClass as O}from"./LayerClass.js";import{OverlaySource as P}from"./Overlay.js";import{overlayRenderOccludedFlag as I}from"./OverlayRenderer.js";import{clearCaches as S,getGlobalSkirtGeometry as C,intersectSkirtsGlobal as k,intersectSkirtsLocal as N}from"./PatchGeometryFactory.js";import{PatchRenderData as w}from"./PatchRenderData.js";import{RenderOrder as q}from"./RenderOrder.js";import{ScaleRangeQueries as L}from"./ScaleRangeQueries.js";import{DEFAULT_TILE_BACKGROUND as M}from"./TerrainConst.js";import{TileRenderer as G}from"./TileRenderer.js";import{TileUpdate as U}from"./TileUpdate.js";import{IteratorPreorder as j,sortTiles as B,compareTiles as F}from"./tileUtils.js";import{componentMinimalSizeForIntersectionData as H,ComponentIntersectionData as z}from"../webgl-engine/collections/Component/ComponentIntersectionData.js";import{ShaderOutput as V}from"../webgl-engine/core/shaderLibrary/ShaderOutputOptions.js";import{bindSliceUniforms as W}from"../webgl-engine/core/shaderLibrary/Slice.glsl.js";import{bindSSRUniforms as Q}from"../webgl-engine/core/shaderLibrary/shading/ScreenSpaceReflections.glsl.js";import{OverlayMode as Y}from"../webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js";import{bindProjectionMatrix as X}from"../webgl-engine/core/shaderLibrary/util/View.glsl.js";import{RenderRequestType as Z}from"../webgl-engine/lib/basicInterfaces.js";import{createEmptyTexture as K}from"../webgl-engine/lib/glUtil3D.js";import{newIntersectorResult as J}from"../webgl-engine/lib/Intersector.js";import{IntersectorType as $,StoreResults as ee}from"../webgl-engine/lib/IntersectorInterfaces.js";import{RenderOccludedFlag as te}from"../webgl-engine/lib/Material.js";import{RenderPass as re}from"../webgl-engine/lib/RenderPass.js";import{RenderSlot as ie}from"../webgl-engine/lib/RenderSlot.js";import{getSettings as se}from"../webgl-engine/lib/screenSizePerspectiveUtils.js";import{VertexAttribute as ne}from"../webgl-engine/lib/VertexAttribute.js";import{TERRAIN_ID as ae,getVerticalOffsetTerrain as oe}from"../webgl-engine/lib/verticalOffsetUtils.js";import{bindScreenSizePerspective as le,intersectAabbInvDirBefore as de,intersectTriangles as he}from"../webgl-engine/materials/internal/MaterialUtil.js";import{TerrainTechniqueConfiguration as ce,TerrainTechnique as ue}from"../webgl-engine/shaders/TerrainTechnique.js";import{ClearBufferBit as pe,PrimitiveType as ge}from"../../webgl/enums.js";const fe=7,me=10,Te=b(),Re=R();let be=class extends r{constructor(e){super(e),this.type=$.TERRAIN,this.isGround=!0,this.tileSize=256,this.rctx=null,this._isTransparent=!1,this._scaleRangeQueries=new L,this.renderDataPool=new n(w),this._patchGroups=new Map,this.patchGroupsDirty=!0,this.tileIterator=new j,this.highestVisibleLODTile=null,this.visible=!0,this._opaque=!0,this._skirtScale=1,this._velvetOverground=!0,this.castShadows=!0,this._ssrEnabled=!1,this.emptyTex=null,this.tileRenderer=null,this.tileBackgroundInitialized=!1,this.tileBackgroundUpdating=!1,this.stencilEnabledLayerExtents=[],this.numTilesRendered=0,this.numTilesCulled=0,this.numOriginsRendered=0,this.overlayOpacity=1,this.needsHighlight=!1,this.renderOccludedFlags=te.Occlude}get isGlobal(){return this.stage.viewingMode===A.Global}initialize(){const e=[ie.OPAQUE_TERRAIN,ie.TRANSPARENT_TERRAIN,ie.OCCLUDED_TERRAIN];this.stage.addRenderPlugin(e,this)}destroy(){this.stage.removeRenderPlugin(this),S()}get updating(){return!this.tileBackgroundInitialized||this.tileBackgroundUpdating}get canRender(){return this.visible&&!!this._rootTiles&&this.tileBackgroundInitialized&&!this.renderingDisabled}set renderingDisabled(e){this._set("renderingDisabled",!!e),this.setNeedsRender()}set opaque(e){this._opaque!==e&&(this._opaque=e,this.setNeedsRender())}get opaque(){return this._opaque&&!this.shaderTechniqueConfig.slicePlaneEnabled}get needsLinearDepth(){return this.overlayRenderer.hasWater}set isTransparent(e){this._isTransparent!==e&&(this._isTransparent=e,this.setNeedsRender())}get isTransparent(){return this._isTransparent}set skirtScale(e){e!==this._skirtScale&&(this._skirtScale=e,this.setNeedsRender())}get skirtScale(){return this._skirtScale}get renderPatchBorders(){return!!this.shaderTechniqueConfig.tileBorders}set renderPatchBorders(e){this.shaderTechniqueConfig.tileBorders!==e&&(this.shaderTechniqueConfig.tileBorders=e,this.setNeedsRender(),this.notifyChange("renderPatchBorders"))}get cullBackFaces(){return this.shaderTechniqueConfig.backfaceCullingEnabled}set cullBackFaces(e){this.shaderTechniqueConfig.backfaceCullingEnabled!==e&&(this.shaderTechniqueConfig.backfaceCullingEnabled=e,this.notifyChange("cullBackFaces"),this.setNeedsRender())}set renderOrder(e){this._set("renderOrder",e),this.setNeedsRender()}set velvetOverground(e){this._velvetOverground!==e&&(this._velvetOverground=e,this.setNeedsRender())}get layerUid(){return ae}get slicePlaneEnabled(){return this.shaderTechniqueConfig.slicePlaneEnabled}set slicePlaneEnabled(e){this.shaderTechniqueConfig.slicePlaneEnabled!==e&&(this.shaderTechniqueConfig.slicePlaneEnabled=e,this.setNeedsRender())}set textureFadingEnabled(e){this.shaderTechniqueConfig.textureFadingEnabled!==e&&(this.shaderTechniqueConfig.textureFadingEnabled=e,this.setNeedsRender())}setDebugScreenSizePerspective(e){this.shaderTechniqueConfig.screenSizePerspective!==e&&(this.shaderTechniqueConfig.screenSizePerspective=e,this.setNeedsRender())}setRootTiles(e){this._rootTiles=e,this.setNeedsRender()}setNeedsHighlight(e){this.needsHighlight=e,this.setNeedsRender()}setRenderOccludedOverlay(e){this.renderOccludedFlags=e?I:te.Occlude,this.setNeedsRender()}setStencilEnabledLayerExtents(e){this.stencilEnabledLayerExtents=e,this.setNeedsRender()}setTileSize(e){this.tileSize=e,this.tileRenderer&&(this.tileRenderer.tileSize=e),this.setNeedsRender()}loadTile(e){e.renderData||(e.renderData=this.renderDataPool.acquire(),e.renderData.init(e),e.renderData.localOrigin=this._getLocalOriginOfTile(e)),this.updateTileGeometry(e),this.updateTileTexture(e,U.TEXTURE_FADING)}queryVisibleLevelRange(e,t,r,i){this._scaleRangeQueries.queryVisibleLevelRange(e,t,r,i),this.setNeedsRender()}updateTileTexture(e,t){this.tileRenderer&&this.tileBackgroundInitialized&&(this.tileRenderer.updateTileTexture(e,t===U.TEXTURE_FADING?D.FADING:D.UNFADED),this.setNeedsRender(),e.resetPendingUpdate(t))}updateTileGeometry(e){for(const t of e.layerInfo[O.ELEVATION])t.pendingUpdates&=~U.GEOMETRY;e.resetPendingUpdate(U.GEOMETRY),e.renderData.updateGeometry(this.rctx,this.wireframe)&&this.setNeedsRender()}unloadTile(e){e.renderData&&(e.renderData.releaseGeometry()&&this.setNeedsRender(),this.renderDataPool.release(e.renderData),e.renderData.clear(),e.renderData=null,e.setMemoryDirty(),this.setNeedsRender())}_getLocalOriginOfTile(e){const t=me-fe,r=Math.max(0,Math.floor((e.level-t)/fe)*fe);if(this.isGlobal&&0===r)return f;for(;e.parent&&e.level>r;)e=e.parent;return e.centerAtSeaLevel}setVisibility(e){this.visible=e,this.setNeedsRender()}getStats(){return{numTilesRendered:this.numTilesRendered,numTilesCulled:this.numTilesCulled,numOriginsRendered:this.numOriginsRendered}}set wireframe(e){this._get("wireframe")!==e&&(this._set("wireframe",e),this.allTiles.forAll((t=>{var r;return null==(r=t.renderData)?void 0:r.updateGeometry(this.rctx,e)})),this.setNeedsRender())}setNeedsRender(e=Z.UPDATE){this.patchGroupsDirty=!0,this.context.requestRender(e)}setTileBackground(e){this.tileBackground=e,this._updateTileBackground()}initializeRenderContext(e){this.context=e,this.rctx=e.renderContext.rctx,this.shaderTechniques=e.shaderTechniqueRep,this.shaderTechniqueConfig=new ce,this.tileRenderer=new G(this.rctx,this.tileSize,this.shaderTechniques),this.tileBackground&&this._updateTileBackground(),this.emptyTex=K(this.rctx)}uninitializeRenderContext(){null!=this.emptyTex&&(this.emptyTex.dispose(),this.emptyTex=null),this.tileRenderer&&(this.tileRenderer.dispose(),this.tileRenderer=null)}intersect(e,t,r,n){if(!this._rootTiles||e.options.selectOpaqueTerrainOnly&&e.options.selectionMode&&!this._opaque)return;const a=Ae,o=De;c(a,n,r),u(o,1/a[0],1/a[1],1/a[2]);const l=e.results.min,d=e.results.max,p=e.results.ground,f=e.options.store===ee.MIN,m=!!e.results.ground.target,T=oe(e.verticalOffset),R=this._skirtScale,b=e.tolerance;let x,A=f&&i(l.dist)?l.dist:1/0;const D=u=>{const m=u.renderData;if(null==m)return;const D=m.geometryInfo;_(Te,D.boundingBox);const E=m.localOrigin;i(T)&&(T.localOrigin=E,T.applyToAabb(Te));const O=-R*D.skirtLength;if(0!==O){const e=u.up;y(Te,O*e[0],O*e[1],O*e[2])}const P=Te;if(Ee[0]=r[0]-E[0],Ee[1]=r[1]-E[1],Ee[2]=r[2]-E[2],!de(P,Ee,o,b,A))return;const I=(e,t,r)=>{e.set(this.type,u,t,r,h),A=f&&i(l.dist)?l.dist:1/0},S=(o,h)=>{if(i(h)&&o>=0&&(e.options.backfacesTerrain||g(h,a)<0)&&(e.options.invisibleTerrain||!e.options.selectionMode||null==t||t(r,n,o))){if((null==p.dist||o<p.dist)&&I(p,o,h),e.options.isFiltered)return;e.options.store===ee.ALL&&(s(x)?(x=J(e.ray),I(x,o,h),e.results.all.push(x)):o<x.dist&&I(x,o,h)),(null==l.dist||o<l.dist)&&I(l,o,h),e.options.store!==ee.MIN&&(null==d.dist||o>d.dist)&&I(d,o,h)}},w=Oe;c(w,n,E);const q=D.indices,L=D.vertexAttributes,M={data:L.getField(ne.POSITION,v).typedBuffer,size:3,stride:L.stride/4},G=D.numWithoutSkirtIndices/3;if(!i(T)&&G>H){const e=u.renderData;i(e.intersectionData)||(e.intersectionData=new z(q,0,G,M)),e.intersectionData.intersectRay({r0:Ee,r1:w},S)}else he(Ee,w,0,G,q,M,null,T,S);if(0!==O){const e=q.length/3;if(this.isGlobal){const t=e-G;if(!i(T)&&t>H){const r=u.renderData;if(!i(r.skirtIntersectionData)){const i=C(q,G,e,L,O,E);r.skirtIntersectionData=new z(i.indices,0,t,{data:i.vertices,stride:3})}r.skirtIntersectionData.intersectRay({r0:Ee,r1:w},S)}else k(Ee,w,G,e,q,L,O,E,T,S)}else N(Ee,w,G,e,q,L,O,T,S)}},E=this._rootTiles;if(i(E)){(()=>{const t=this.tileIterator;t.reset(E);const s=e.options.invisibleTerrain;for(;!t.done;){const e=t.next();!(e.visible||s&&e.intersectsClippingArea)||!i(T)&&!e.intersectsRay(r,a,b,A,R)||m&&this._useStencilForTile(e)?t.skipSubtree():D(e)}})()}}prepareTechnique(e){if(e.slot===ie.OCCLUDED_TERRAIN){if(0==(e.renderOccludedMask&I))return null}else{const t=this.opaque?ie.OPAQUE_TERRAIN:ie.TRANSPARENT_TERRAIN;if(e.slot!==t)return null}switch(e.pass){case re.MATERIAL:{const t=e.shadowMap&&e.shadowMap.enabled;this.shaderTechniqueConfig.receiveShadows!==t&&(this.shaderTechniqueConfig.receiveShadows=t);const r=this.overlayRenderer.isEmpty()?Y.Disabled:this.overlayRenderer.hasWater?Y.EnabledWithWater:Y.Enabled;this.shaderTechniqueConfig.overlayMode!==r&&(this.shaderTechniqueConfig.overlayMode=r);const i=e.slot===ie.OCCLUDED_TERRAIN?P.Occluded:P.ColorAndWater;return this._updateTechnique(V.Color,i===P.Occluded)}case re.MATERIAL_DEPTH_SHADOWMAP_ALL:case re.MATERIAL_DEPTH_SHADOWMAP_DEFAULT:return this.castShadows&&1===e.scenelightingData.globalFactor?this._updateTechnique(V.Shadow,!1):null;case re.MATERIAL_DEPTH:return this.isTransparent&&this.overlayRenderer.isEmpty()?null:this._updateTechnique(V.Depth,!1);case re.MATERIAL_NORMAL:return this._updateTechnique(V.Normal,!1);case re.MATERIAL_HIGHLIGHT:return this.needsHighlight?this._updateTechnique(V.Highlight,!1):null}return null}render(e,t){const r=e.pass,i=1===e.scenelightingData.globalFactor;switch(this._updatePatchGroups(),r){case re.MATERIAL:{const r=e.slot===ie.OCCLUDED_TERRAIN?P.Occluded:P.ColorAndWater;this._renderMaterialPass(e,t,r);break}case re.MATERIAL_DEPTH_SHADOWMAP_ALL:case re.MATERIAL_DEPTH_SHADOWMAP_DEFAULT:this.castShadows&&i&&this._renderAuxiliaryPass(e,t,P.None);break;case re.MATERIAL_DEPTH:this.isTransparent&&this.overlayRenderer.isEmpty()||this._renderAuxiliaryPass(e,t,P.None);break;case re.MATERIAL_NORMAL:this._renderAuxiliaryPass(e,t,P.None);break;case re.MATERIAL_HIGHLIGHT:this.needsHighlight&&(this._renderAuxiliaryPass(e,t,P.Highlight),e.rctx.clearSafe(pe.DEPTH_BUFFER_BIT))}this._scaleRangeQueries.hasPendingQueries()&&this.setNeedsRender()}_renderMaterialPass(e,t,r){const{rctx:i,camera:s}=e;this._ssrEnabled=e.ssrParams.ssrEnabled;const n=t.program;i.useProgram(n),this.shaderTechniqueConfig.overlayMode!==Y.Disabled&&r===P.ColorAndWater&&e.ssrParams&&Q(n,e.ssrParams),e.shadowMap.bind(n),e.ssaoHelper.bind(n,e.camera),this._bindOverlayData(n,r),n.setUniformMatrix4fv("viewNormal",s.viewInverseTransposeMatrix),X(n,s.projectionMatrix),e.scenelightingData.setUniforms(n,!0);const a=s.viewMatrix;u(xe,a[12],a[13],a[14]),p(xe,xe),n.setUniform3fv("viewDirection",xe),this.numTilesRendered=0,this.numTilesCulled=0,this.numOriginsRendered=0,this._scaleRangeQueries.prepareQueries(),this.opaque?this._renderPatchGroups(e,t,r):e.offscreenRenderingHelper.renderToTargets((()=>this._renderPatchGroups(e,t,r)),e.offscreenRenderingHelper.tmpColor,e.offscreenRenderingHelper.mainDepth,[0,0,0,0]),this._scaleRangeQueries.processQueries()}_renderAuxiliaryPass(e,t,r){const i=t.program;if(e.rctx.useProgram(i),e.pass===re.MATERIAL_HIGHLIGHT){const t=e.offscreenRenderingHelper;i.bindTexture(t.depthTexture,"depthTex"),i.setUniform4f("highlightViewportPixelSz",0,0,1/t.width,1/t.height)}else i.setUniformMatrix4fv("viewNormal",e.camera.viewInverseTransposeMatrix),e.pass!==re.MATERIAL_DEPTH&&e.pass!==re.MATERIAL_DEPTH_SHADOWMAP_ALL&&e.pass!==re.MATERIAL_DEPTH_SHADOWMAP_DEFAULT||i.setUniform2fv("nearFar",e.camera.nearFar);this._renderPatchGroupsAuxiliary(e,t,r)}_updateTileBackground(){if(!this.tileRenderer)return;this.tileBackgroundUpdating=!0;const e=()=>{this.tileBackgroundInitialized=!0,this.tileBackgroundUpdating=!1,this.shaderTechniqueConfig.useGrid=this.tileRenderer.backgroundIsGrid,this.shaderTechniqueConfig.hasBackgroundColor=!this.tileRenderer.backgroundIsGrid&&!!i(this.tileRenderer.backgroundColor),this.allTiles.forAll((e=>this.tileRenderer.updateTileTexture(e,D.FADING))),this.setNeedsRender()};if("string"==typeof this.tileBackground){const t=this.tileBackground;x(t).then((r=>{t===this.tileBackground&&this.tileRenderer&&(this.tileRenderer.setBackground(r,this.tileBackground===M),e())}))}else{const r=this.tileBackground?t.toUnitRGBA(this.tileBackground):[0,0,0,0];this.tileRenderer.setBackground(r,!1),e()}}_updatePatchGroups(){if(this.patchGroupsDirty){if(this.highestVisibleLODTile=null,this._rebuildPatchGroups(),this.renderOrder!==q.NONE){const e=Array.from(this._patchGroups.values());e.forEach((e=>B(this.renderOrder,e))),e.sort(((e,t)=>F(e[0],t[0],this.renderOrder))),this._patchGroups=new Map(e.map((e=>[e[0].renderData.localOrigin,e])))}this.patchGroupsDirty=!1}}_rebuildPatchGroups(){const e=this._rootTiles;if(!s(e)){this._patchGroups.clear();for(const t of e)this._rebuildPatchGroupsForRootTile(t)}}_rebuildPatchGroupsForRootTile(e){const t=this.tileIterator;for(t.resetOne(e);!t.done;){const e=t.next(),r=e.renderData;if(!r||e.visible)if(e.rendered){if(r){const i=this._patchGroups.get(r.localOrigin)||new Array;this._patchGroups.set(r.localOrigin,i),i.push(e),(!this.highestVisibleLODTile||e.vlevel>this.highestVisibleLODTile.vlevel)&&(this.highestVisibleLODTile=e),t.skipSubtree()}}else this.numTilesCulled++;else this.numTilesCulled++,t.skipSubtree()}}_useStencilForTile(e){for(const t of this.stencilEnabledLayerExtents)if(e.intersectsExtent(t))return!0;return!1}_renderPatchGroupsAuxiliary(e,t,r){const i=e.rctx;t.useStencil=!1,t.bindPipelineState(i,e.slot);const s=this.stencilEnabledLayerExtents.length>0,n=t.program;n.setUniformMatrix4fv("proj",e.camera.projectionMatrix),n.setUniform1f("skirtScale",this._skirtScale),r!==P.None&&this._bindOverlayData(n,r),this._patchGroups.forEach((i=>{const a=i[0].renderData.localOrigin;this._bindPatchGroupData(n,a,e.camera.eye,e.camera.viewMatrix);for(let n=0;n<i.length;n++)this._renderPatch(e,t,i[n],ge.TRIANGLES,s,r)})),e.rctx.bindVAO(null)}_renderPatchGroups(e,t,r){const n=e.rctx,a=e.camera,o=a.viewMatrix,l=t.program;if(t.useStencil=!1,t.bindPipelineState(n,e.slot),this.shaderTechniqueConfig.screenSizePerspective&&this.pointsOfInterest){const e=se(this.stage.viewingMode,this.ellipsoidRadius),t=this.pointsOfInterest.centerOnSurfaceFrequent.distance;e.update({distance:t,fovY:a.fovY}),le(e,l,"screenSizePerspective")}const d=this.stencilEnabledLayerExtents.length>0,h=r===P.Occluded;h&&(l.bindTexture(this.emptyTex,"tex"),l.setUniform1f("blend",1),l.setUniform4fv("texOffsetAndScale",T));const c=i(this.tileRenderer.backgroundColor)?this.tileRenderer.backgroundColor:f;this.shaderTechniqueConfig.hasBackgroundColor&&l.setUniform3fv("backgroundColor",c);const u=h?0:this._skirtScale;l.setUniform1f("skirtScale",u);const p=this.wireframe?ge.LINES:ge.TRIANGLES;this.shaderTechniqueConfig.textureFadingEnabled&&l.bindTexture(this.emptyTex,"texNext"),this._patchGroups.forEach((n=>{const c=n[0].renderData.localOrigin;this._bindPatchGroupData(l,c,a.eye,o);const u=e.sliceHelper&&e.sliceHelper.plane;W(l,t.configuration,u,c),e.shadowMap&&e.shadowMap.bindView(l,c),this.numOriginsRendered++;for(let a=0;a<n.length;a++){const o=n[a],c=o.renderData.textureReference;if(!s(c)){if(!h){this._scaleRangeQueries.scaleQueriesForTile(o),ye(o.renderData.geometryInfo.uvOffsetAndScale,c.offsetAndScale,Re),l.setUniform4fv("texOffsetAndScale",Re),l.bindTexture(c.texture.texture,"tex");const e=o.renderData.textureFadeFactor,t=e<1?o.renderData.nextTextureReference:null;this.shaderTechniqueConfig.textureFadingEnabled&&i(t)&&e<1?(ye(o.renderData.geometryInfo.uvOffsetAndScale,t.offsetAndScale,Re),l.setUniform1f("fadeFactor",e),l.setUniform4fv("nextTexOffsetAndScale",Re),l.setUniform3fv("nextTexOpacities",t.opacities),l.bindTexture(t.texture.texture,"texNext")):l.setUniform1f("fadeFactor",1),o.renderData.textureIsFading&&this.setNeedsRender(),l.setUniform3fv("textureOpacities",c.opacities)}this._renderPatch(e,t,o,p,d,r),o.renderOrder=this.numTilesRendered,this.numTilesRendered++}}})),n.bindVAO(null)}_renderPatch(e,t,r,i,n,a){if(s(r.renderData.vao.indexBuffer))return;const o=t.program;a!==P.None&&this._bindOverlayPatchData(o,r.renderData.overlay),n&&(t.useStencil=this._useStencilForTile(r),t.bindPipelineState(e.rctx,e.slot));const l=0===this._skirtScale?r.renderData.geometryInfo.numWithoutSkirtIndices:r.renderData.vao.indexBuffer.size;e.rctx.bindVAO(r.renderData.vao),o.assertCompatibleVertexAttributeLocations(r.renderData.vao),e.rctx.drawElements(i,l,r.renderData.vao.indexBuffer.indexType,0)}_bindPatchGroupData(e,t,r,i){e.setUniform3fv("origin",t),l(ve,i,t),e.setUniformMatrix4fv("view",ve),e.setUniform3f("cameraPosition",r[0]-t[0],r[1]-t[1],r[2]-t[2])}_bindOverlayData(e,t){if(this.shaderTechniqueConfig.overlayMode===Y.Disabled)return;e.setUniform1f("overlayOpacity",this.overlayOpacity);const r=this.overlayRenderer.overlays;if(r.length>E.INNER){const s=r[E.INNER],n=s.getColorTexture(t);if(e.bindTexture(i(n)?n:this.emptyTex,"ovColorTex"),this.shaderTechniqueConfig.overlayMode===Y.EnabledWithWater){const r=s.getNormalTexture(t);e.bindTexture(i(r)?r:this.emptyTex,"ovWaterTex")}}}_bindOverlayPatchData(e,t){e.setUniform4fv("overlayTexOffset",t.offsets),e.setUniform4fv("overlayTexScale",t.scales)}_updateTechnique(e,t){return this.shaderTechniqueConfig.output=e,e===V.Color&&(this.shaderTechniqueConfig.atmosphere=this.isGlobal&&this._velvetOverground,this.shaderTechniqueConfig.ssrEnabled=this._ssrEnabled),this.shaderTechniqueConfig.renderOccluded=t,this.shaderTechniqueConfig.stencilEnabled=!1,this._shaderTechnique=this.shaderTechniques.releaseAndAcquire(ue,this.shaderTechniqueConfig,this._shaderTechnique),this._shaderTechnique}get test(){return{tileRenderer:this.tileRenderer}}};e([a()],be.prototype,"tileBackgroundInitialized",void 0),e([a()],be.prototype,"tileBackgroundUpdating",void 0),e([a({constructOnly:!0})],be.prototype,"overlayRenderer",void 0),e([a({constructOnly:!0})],be.prototype,"stage",void 0),e([a({readOnly:!0})],be.prototype,"isGlobal",null),e([a({constructOnly:!0})],be.prototype,"allTiles",void 0),e([a({constructOnly:!0})],be.prototype,"ellipsoidRadius",void 0),e([a({readOnly:!0})],be.prototype,"updating",null),e([a({value:!1})],be.prototype,"renderingDisabled",null),e([a()],be.prototype,"renderPatchBorders",null),e([a()],be.prototype,"cullBackFaces",null),e([a({value:q.FRONT_TO_BACK})],be.prototype,"renderOrder",null),e([a()],be.prototype,"wireframe",null),be=e([o("esri.views.3d.terrain.TerrainRenderer")],be);const _e=be;function ye(e,t,r){r[0]=e[0]*t[2]+t[0],r[1]=e[1]*t[3]+t[1],r[2]=e[2]*t[2],r[3]=e[3]*t[3]}const ve=d(),xe=m(),Ae=m(),De=m(),Ee=m(),Oe=m();export{_e as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Color.js";import i from"../../../core/Accessor.js";import{difference as r}from"../../../core/arrayUtils.js";import s from"../../../core/CollectionFlattener.js";import a from"../../../core/Evented.js";import n from"../../../core/Handles.js";import l from"../../../core/Logger.js";import{clamp as o}from"../../../core/mathUtils.js";import{releaseMaybe as h,destroyMaybe as d,isNone as u,isSome as p}from"../../../core/maybe.js";import c from"../../../core/ObjectPool.js";import _ from"../../../core/PooledArray.js";import{isAbortError as m,isAborted as g,createAbortError as y}from"../../../core/promiseUtils.js";import{watch as f,sync as T}from"../../../core/reactiveUtils.js";import{init as v}from"../../../core/watchUtils.js";import{aliasOf as w}from"../../../core/accessorSupport/decorators/aliasOf.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{property as S}from"../../../core/accessorSupport/decorators/property.js";import{subclass as L}from"../../../core/accessorSupport/decorators/subclass.js";import{m as x}from"../../../chunks/mat4.js";import{c as E}from"../../../chunks/mat4f64.js";import{g as D}from"../../../chunks/vec3.js";import{c as P}from"../../../chunks/vec3f64.js";import{c as C}from"../../../chunks/vec4f64.js";import{projectVectorToVector as R,projectPointToVector as U}from"../../../geometry/projection.js";import{getReferenceEllipsoid as j}from"../../../geometry/projectionEllipsoid.js";import{create as M,equals as b,intersection as I,containsPoint as A,empty as V,expand as O,intersectsSphere as k}from"../../../geometry/support/aaBoundingRect.js";import{create as q,copy as B}from"../../../geometry/support/frustum.js";import{isRefreshableLayer as N}from"../../../layers/mixins/RefreshableLayer.js";import{ElevationQueryTileCache as F}from"../../../layers/support/ElevationQueryTileCache.js";import{isBaseLayer as H}from"../../../layers/support/layerUtils.js";import{acquireDecoder as G}from"../../../layers/support/LercDecoder.js";import{printAllocations as W}from"../../2d/engine/vectorTiles/VectorTile.js";import Q from"../layers/ElevationLayerView3D.js";import{directionToHeadingTilt as X,scaleToZoom as z}from"../support/cameraUtils.js";import Y from"../support/debugFlags.js";import{toBoundingRect as $}from"../support/extentUtils.js";import{ClientType as K}from"../support/index.js";import{updatingProgress as J}from"../support/updatingProperties.js";import{ElevationBounds as Z}from"./ElevationBounds.js";import{sampleElevation as ee,ElevationData as te}from"./ElevationData.js";import{create as ie}from"./ExtentHelper.js";import{LODSnapping as re,TextureUpdate as se}from"./interfaces.js";import{LayerClass as ae,LayerClasses as ne}from"./LayerClass.js";import{OverlayManager as le}from"./OverlayManager.js";import{PlanarPatch as oe}from"./PlanarPatch.js";import{RenderOrder as he}from"./RenderOrder.js";import{SphericalPatch as de}from"./SphericalPatch.js";import{DEFAULT_TILE_BACKGROUND as ue,MAX_ROOT_TILES as pe,TOO_MANY_ROOT_TILES_AFTER_CHANGE_ERROR as ce,TOO_MANY_ROOT_TILES_FOR_LAYER_ERROR as _e,MAX_MEMORY_LOD_BIAS as me,ELEVATION_NODATA_VALUE as ge}from"./TerrainConst.js";import ye from"./TerrainRenderer.js";import fe from"./TerrainSurfacePerformanceInfo.js";import{weakAssert as Te,computeSkirtScale as ve,isSurfaceLayerView as we,isElevationLayerView as Se,isVectorTileLayerView as Le,useFetchTileForLayer as xe,isImageryTileLayerView as Ee,isTileLayerView as De,releaseTileData as Pe}from"./terrainUtils.js";import{SplitLimits as Ce,Tile as Re}from"./Tile.js";import{printAllocations as Ue}from"./TilePerLayerInfo.js";import{TileUpdate as je}from"./TileUpdate.js";import{IteratorPreorder as Me,IteratorPostorder as be,hasLoadableSiblings as Ie,sortTilesByPOI as Ae,sortTiles as Ve}from"./tileUtils.js";import{TilingSchemeLogic as Oe}from"./TilingSchemeLogic.js";import{UpsampleInfo as ke}from"./UpsampleInfo.js";import{RenderRequestType as qe}from"../webgl-engine/lib/basicInterfaces.js";import{ImmediateTask as Be,TaskPriority as Ne,noBudget as Fe}from"../../support/Scheduler.js";import{WatchUpdatingTracking as He}from"../../support/WatchUpdatingTracking.js";const Ge=l.getLogger("esri.views.3d.terrain.TerrainSurface"),We=.25;let Qe=class extends(a.EventedMixin(i)){constructor(e){super(e),this._elevationBounds=new Z,this._iteratorPool=new c(Me,(e=>e.remove=()=>this._iteratorPool.release(e))),this._postorderIterator=new be,this._hasPendingUpdates=!1,this._pendingUpdates=0,this._asyncWorkItems=0,this._allTilesDirty=!0,this._allTilesSorted=!0,this._visible=!1,this._usedMemory=Ke,this._performanceInfo=new fe,this._viewChanged=!1,this._inFrameTask=!1,this._viewChangeUpdateDirty=!1,this._eyePosRenderSR=P(),this._eyePosSurfaceSR=P(),this._splitLimits=new Ce,this._snapLevel=1/0,this._frustum=q(),this._viewProjectionMatrix=E(),this._layerViews=[new Array,new Array],this._layerIndexByUid=[new Map,new Map],this._basemapLayerViewHandles=new Map,this._handles=new n,this._watchUpdatingTracking=new He,this._frameTask=Be,this._allTiles=new _,this._upsampleInfoPool=new c(ke),this._rootTilesExtent=M(),this._maxNumUpdating=1,this.maxTextureScale=1.2,this.backgroundImage=ue,this.backgroundColor=null,this._layerViewsDirty=!1}initialize(){this._lercDecoder=G(this.view.resourceController),this._tilePool=this.view.state.isLocal?new c(oe):new c(de);const e=this.view.resourceController.memoryController;this._upsampleMapCache=e.newCache("esri.views.3d.terrain.upsample",(e=>e.unloadMapData())),this._elevationQueryCache=new F(e.newCache("elevation-query")),this._set("overlayManager",new le({surface:this})),this._handles.add([this.watch("overlayManager.hasHighlights",(e=>this._renderer.setNeedsHighlight(e))),this.watch("overlayManager.rendersOccluded",(e=>this._renderer.setRenderOccludedOverlay(e)))],"overlayManager"),this._renderer=new ye({overlayRenderer:this.overlayManager.renderer,ellipsoidRadius:j(this.view.spatialReference).radius,stage:this.view._stage,allTiles:this._allTiles}),this._handles.add([v(this,"baseOpacity",(e=>{this._handleLayerViewChanges(),this._updateBaseOpacity(e)}),!0),v(this,"_background",(()=>{this._handleLayerViewChanges(),this._renderer.setTileBackground(this._background)}),!0),this.view.watch("pointsOfInterest",(e=>{this._renderer.pointsOfInterest=e,this._watchUpdatingTracking.removeAll(),e&&this._watchUpdatingTracking.add((()=>e.focus.renderLocation),(()=>()=>this._allTilesSorted=!1))})),v(Y,"TERRAIN_TILE_TREE_SHOW_TILES",(e=>{e&&!this._treeDebugger?import("../layers/support/TerrainTileTree3DDebugger.js").then((({TerrainTileTree3DDebugger:e})=>{!this._treeDebugger&&Y.TERRAIN_TILE_TREE_SHOW_TILES&&(this._treeDebugger=new e({view:this.view}))})):e||(this._treeDebugger=d(this._treeDebugger))}))]),this._extentHelper=ie(this.viewingMode,{layers:this.view.map.allLayers,layerViews:this.view.allLayerViews,viewSpatialReference:this.view.spatialReference});const t=this.view.defaultsFromMap?new s({getCollections:()=>{var e,t,i;return null==(e=this.view)||null==(t=e.defaultsFromMap)||null==(i=t.mapCollections)?void 0:i.map((({layers:e})=>e))},getChildrenFunction:e=>e&&"layers"in e?e.layers:null}):this.view.map.allLayers,i=new Oe({layers:t,extentHelper:this._extentHelper,viewingMode:this.viewingMode,viewSpatialReference:this.view.spatialReference});this._set("tilingSchemeLogic",i),this._updateTilingScheme(),this._elevationDataRequester=this.view.resourceController.createStreamDataRequester(K.ELEVATION),this._mapDataRequester=this.view.resourceController.createStreamDataRequester(K.BASEMAP);const r=this.view.resourceController.scheduler;this._frameTask=r.registerTask(Ne.TERRAIN_SURFACE,this),this.view.resourceController.memoryController.events.on("quality-changed",(()=>this._viewChangeUpdate())),this._handles.add([v(this._extentHelper,"stencilEnabledExtents",(e=>this._renderer.setStencilEnabledLayerExtents(e))),this.tilingSchemeLogic.watch("tilingScheme",(()=>this._updateTilingScheme()),!0),v(this,"extent",(()=>this._updateRootTiles())),this.view.on("resize",(()=>this._viewChangeUpdate())),this.view.watch("state.camera",(()=>this._viewChangeUpdate()),!0),this.view.watch("state.contentCamera",(()=>this.view.state.fixedContentCamera&&this._viewChangeUpdate()),!0),this.view.watch("qualitySettings.tiledSurface.lodBias",(()=>this._viewChangeUpdate())),v(this.view,"qualitySettings.tiledSurface.textureFadeDuration",(e=>this._renderer.textureFadingEnabled=e>0)),this.view.watch("lodSnapping",(()=>this._viewChangeUpdate())),f((()=>this._userClippingExtent),(()=>this._updateClippingExtent()),T)]),this._handles.add(this.view.allLayerViews.on("after-changes",(()=>this._layerViewsDirty=!0))),this._layerViewsDirty=!0,this._handleLayerViewChanges()}destroy(){this._frameTask.remove(),this._handles.destroy(),this._watchUpdatingTracking.destroy(),this._lercDecoder=h(this._lercDecoder),this._removeAllTiles(),this._upsampleMapCache=d(this._upsampleMapCache),this._elevationQueryCache=d(this._elevationQueryCache),this._set("tilingSchemeLogic",d(this.tilingSchemeLogic)),this._extentHelper=d(this._extentHelper),this._basemapLayerViewHandles.forEach(((e,t)=>this._unregisterTiledLayerView(t))),this._elevationDataRequester=null,this._mapDataRequester=null,this._set("overlayManager",d(this.overlayManager)),this._tilePool=d(this._tilePool),Re.prune(),this._treeDebugger&&(this._treeDebugger.destroy(),this._treeDebugger=null),this._renderer=d(this._renderer),this._iteratorPool=d(this._iteratorPool),this._set("view",null),this._upsampleInfoPool=d(this._upsampleInfoPool),W(),Ue()}get renderer(){return this._renderer}get frustum(){return this._frustum}get snapLevel(){var e,t;const i=null==(e=this.view.pointsOfInterest)||null==(t=e.contentCameraOnSurface)?void 0:t.scale;if(i){const e=this.view.state.contentCamera;let t=X(this.view,e.eye,e.viewForward,e.up).tilt;t>90&&(t=180-t);const r=2*(t/90)**2,s=z(this.view,i)-r;Math.abs(this._snapLevel-s)>We&&(Math.round(s)!==Math.round(this._snapLevel)&&(this._viewChanged=!0),this._snapLevel=s)}return Math.round(this._snapLevel)}get lodSnapping(){return this.view.qualitySettings.tiledSurface.reduceTileLevelDifferences?re.ON:re.OFF}get upsampleInfoPool(){return this._upsampleInfoPool}get upsampleMapCache(){return this._upsampleMapCache}get elevationQueryCache(){return this._elevationQueryCache}get mapTileRequester(){return this._mapDataRequester}get _userClippingExtent(){const{spatialReference:e}=this,{clippingArea:t}=this.view;if(u(t)||u(e))return null;const i=M(),r=$(t,i,e)?i:null,s=this._get("extent");return b(r,s)?s:r}get extent(){const e=I(this.groundExtent,this._userClippingExtent,M()),t=this._get("extent");return b(e,t)?t:e}get groundExtent(){return p(this._tilingSchemeExtent)?this._tilingSchemeExtent:this._rootTilesExtent}get _tilingSchemeExtent(){var e;return null==(e=this.tilingSchemeLogic)?void 0:e.extent}get updating(){return this._hasPendingUpdates||(this._maxNumUpdating=1),!!((this._watchUpdatingTracking.updating||this._hasPendingUpdates||this._viewChanged||this._allTilesDirty||this._asyncWorkItems>0||!this._allTilesSorted||this._renderer.updating||this._layerViewsDirty)&&this.ready&&!this.suspended||this.overlayManager.updating||this._frameTask.updating)}get updatingProgressValue(){return this._maxNumUpdating=Math.max(this._pendingUpdates,this._maxNumUpdating),1-this._pendingUpdates/this._maxNumUpdating}get viewingMode(){return this.view.state.viewingMode}get ready(){return p(this.rootTiles)}set renderOrder(e){this._renderer.renderOrder=e,this._set("renderOrder",e)}set skirtScale(e){this._renderer.skirtScale=e}get skirtScale(){return this._renderer.skirtScale}get spatialReference(){var e,t;return null!=(e=null==(t=this.tilingScheme)?void 0:t.spatialReference)?e:null}get _background(){return null!=this.backgroundColor?this.backgroundColor:this.backgroundImage}set slicePlaneEnabled(e){var t,i;this._renderer.slicePlaneEnabled=e,this._set("slicePlaneEnabled",e),null==(t=this.view)||null==(i=t._stage)||i.renderView.setRenderParameters({opaqueTerrain:this.opaque})}set velvetOverground(e){e!==this.velvetOverground&&(this._renderer.velvetOverground=e),this._set("velvetOverground",e)}set visible(e){e!==this._visible&&(this._visible=e,this._renderer.setVisibility(e),this.suspended=!e)}get opaque(){return this._renderer.opaque}set suspended(e){this._set("suspended",e),this._viewChangeUpdate()}intersect(e,t,i,r){this._renderer.intersect(e,t,i,r)}getElevation(e,t,i,r){const s=this.getTileWithElevation(e,t,i,r,Je);return u(s)?null:ee(Je[0],Je[1],s.renderData.geometryState.samplerData)}getTileWithElevation(e,t,i,r,s=Je){var a;const n=this.rootTiles;if(u(n)||!n.length)return null;if(0===n[0].layerInfo[ae.ELEVATION].length)return null;if(s[0]=e,s[1]=t,s[2]=i,!R(s,r,s,null==(a=this.tilingScheme)?void 0:a.spatialReference))return Ge.error("TerrainSurface.getElevation(): could not project given point to tiling scheme coordinate system"),null;for(let l of n){if(!l.containsPoint(s))continue;for(;l&&!l.rendered&&!l.isLeaf;){let e=0;s[0]>.5*(l.extent[0]+l.extent[2])&&(e+=1),s[1]<.5*(l.extent[1]+l.extent[3])&&(e+=2),l=l.children[e]}const e=l.renderData;return(e?e.geometryState.samplerData:null)?l:null}return null}get elevationBounds(){return this._elevationBounds}getScale(e){if(this.tilingScheme){if(!U(e,Je,this.spatialReference))return Ge.error("TerrainSurface.getScale(): could not project given point to tiling scheme coordinate system"),null;const t=this.rootTiles;if(p(t))for(let e of t)if(e.containsPoint(Je)){for(;null!=e.children[0];){let t=0;Je[0]>e.children[0].extent[2]&&(t+=1),Je[1]<e.children[0].extent[1]&&(t+=2),e=e.children[t]}return this._getLodBiasCorrectedScale(e.level)}}return 1e100}getSphereScale(e,t){if(!this.tilingScheme)return null;if(!U(e,Je,this.spatialReference))return Ge.error("TerrainSurface.getSphereScale(): could not project given point to tiling scheme coordinate system"),null;Je[3]=t;let i=null;const r=e=>{if(e&&k(e.extent,Je))if(null!=e.children[0])for(const t of e.children)r(t);else{const t=this._getLodBiasCorrectedScale(e.level);i=null==i?t:Math.min(i,t)}},s=this.rootTiles;if(p(s))for(const a of s)r(a);return i}queryVisibleScaleRange(e,t,i,r){const s=t?this.tilingScheme.levelAtScale(t):0,a=i?this.tilingScheme.levelAtScale(i):1/0,n=this.lodBias;this._renderer.queryVisibleLevelRange(e,s+n,a+n,r)}_updateBaseOpacity(e){const t=this._renderer.opaque;this._renderer.opaque=e>=1,this._renderer.isTransparent=this._allTransparentSurfaceLayers();const i=t===this._renderer.opaque?se.UNFADED:se.IMMEDIATE;var r,s;i===se.IMMEDIATE&&(null==(r=this.view)||null==(s=r._stage)||s.renderView.setRenderParameters({opaqueTerrain:this.opaque}));this._updateTileTextures(i)}_updateTilingScheme(){const e=this.tilingSchemeLogic.tilingScheme;e!==this.tilingScheme&&(Te(!!e,"tiling scheme cannot be reset to undefined"),this.tilingScheme&&this._removeAllTiles(),this._set("tilingScheme",e),this._updateClippingExtent(),e&&(this._updateTiledLayers(),this._renderer.setTileSize(e.pixelSize),this.overlayManager.setSpatialReference(e.spatialReference),this._updateRootTiles()))}_acquireTile(e,t,i,r){const s=this._tilePool.acquire();return et[0]=e,et[1]=t,et[2]=i,s.init(et,r,this),s}_updateRootTiles(){const{extent:e,tilingScheme:t}=this;if(!t)return;const i=Ze;let s=t.rootTilesInExtent(e,i,5*pe);if(p(this.rootTiles)){if(s.length>pe)return void Ge.warn(ce);const e=this.rootTiles.map((e=>e.lij)),t=r(e,s,ze);if(t.removed.length>0||t.added.length>0){const e=this.rootTiles.filter((e=>!(t.removed.findIndex((t=>ze(t,e.lij)))>-1)||(this._purgeTile(e),!1)));t.added.forEach((t=>e.push(this._newRootTile(t)))),this._setRootTiles(e)}}else s.length>pe&&(Ge.warn(_e),s=t.rootTilesInExtent(e,i,pe)),this._setRootTiles(s.map((e=>this._newRootTile(e))));b(i,this._rootTilesExtent)||(this._rootTilesExtent=M(i)),this.visible=!0,this._viewChangeUpdate(),this.overlayManager.setPlacementDirty(),this.notifyChange("ready")}_newRootTile(e){const t=this._acquireTile(0,e[1],e[2],null);return t.shouldSplit(this._splitLimits,this._eyePosRenderSR,this.lodSnapping)===je.SPLIT&&t.setPendingUpdate(je.SPLIT),this._loadTile(t),t}_setRootTiles(e){if(this._set("rootTiles",e),this._allTiles.clear(),p(e)){const t=this._iteratorPool.acquire();for(t.reset(e);!t.done;)this._allTiles.push(t.next());t.remove()}this._renderer.setRootTiles(this.rootTiles),this._updateTilesVisibility(e)}_runViewChangeUpdateIfDirty(){this._viewChangeUpdateDirty&&(this._viewChangeUpdateDirty=!1,this._viewChangeUpdate())}_viewChangeUpdate(){this.view&&!this.suspended&&this.tilingScheme&&this._visible&&(this._inFrameTask?this._viewChangeUpdateDirty=!0:(this._viewChangeUpdateDirty=!1,this._updateViewDependentParameters(),this._updateSkirts(),this._updateTilesVisibility(this.rootTiles)))}_updateClippingStatus(e){e.updateClippingStatus(this.extent)&&e.resetPendingUpdate(je.GEOMETRY)&&this._updateTileGeometry(e)}_updateTilesVisibility(e){if(u(e))return;const t=Ie(e);let i=t?this._elevationBounds.min:1/0,r=t?this._elevationBounds.max:-1/0;const s=this.view.state.fixedContentCamera,a=this.extent,n=this._viewProjectionMatrix;this.setTileTreeDirty();const l=this._iteratorPool.acquire();for(l.reset(e);!l.done;){const e=l.next();e.updateClippingStatus(a)&&e.resetPendingUpdate(je.GEOMETRY)&&this._updateTileGeometry(e),e.setPendingUpdate(je.RENDERDATA);const t=e.updateVisibilityNow();s||t?(e.updateScreenDepth(n),e.renderData&&(i=Math.min(e.elevationBounds[0],i),r=Math.max(e.elevationBounds[1],r))):l.skipSubtree()}l.remove(),this._viewChanged=!0,this._allTilesDirty=!0,isFinite(i)&&isFinite(r)&&(this._elevationBounds.min===i&&this._elevationBounds.max===r||(this._elevationBounds.min=i,this._elevationBounds.max=r,this.emit("elevation-bounds-change",null)))}_updateViewDependentParameters(){const e=this.view.state.camera,t=this.view.state.contentCamera,i=Math.tan(.5*t.fovX),r=Math.tan(.5*t.fovY),s=this.tilingScheme.pixelSize,a=2**-this.lodBias*e.pixelRatio;this._splitLimits.aboveGround=e.aboveGround,this._splitLimits.fovX=i,this._splitLimits.fovY=r,this._splitLimits.relativeWidthLimit=s/e.width*this.maxTextureScale*a,this._splitLimits.relativeHeightLimit=s/e.height*this.maxTextureScale*a,this._splitLimits.maxLod=this.tilingScheme.getMaxLod(),this._splitLimits.angledSplitBias=this.view.qualitySettings.tiledSurface.angledSplitBias,this.view.state.fixedContentCamera?(u(this._splitLimits.frustum)&&(this._splitLimits.frustum=q()),B(t.frustum,this._splitLimits.frustum)):this._splitLimits.frustum=null,B(e.frustum,this._frustum),x(this._viewProjectionMatrix,t.projectionMatrix,t.viewMatrix),D(this._eyePosRenderSR,t.eye),R(e.eye,this.view.renderSpatialReference,this._eyePosSurfaceSR,this.spatialReference)}_updateSkirts(){const e=this.view.state.camera,t=this.view.state.constraints.collision.enabled?0:1.11*e.near;this.skirtScale=ve(this,this._eyePosSurfaceSR,t)}_updateRenderData(e){e.rendered&&!e.shouldLoad&&(Ye(e)?this._loadChildren(e):$e(e)&&this._loadParent(e))}_updateTileGeometry(e){e.updateVisibility(),this._renderer.updateTileGeometry(e),this._elevationUpdate(e),this._usedMemory=Ke}_updateTileTexture(e,t){const i=e.resetPendingUpdate(je.TEXTURE_FADING)?je.TEXTURE_FADING:!!e.resetPendingUpdate(je.TEXTURE_NOFADING)&&je.TEXTURE_NOFADING;i&&(this._renderer.updateTileTexture(e,i),this._usedMemory=Ke,t.madeProgress())}_elevationUpdate(e){it.spatialReference=this.spatialReference,it.tile=e,it.extent=e.extent,this.emit("elevation-change",it),A(e.extent,this._eyePosSurfaceSR)&&this._updateSkirts()}get running(){return this.updating&&this.ready&&!this.suspended}runTask(e){this._handleLayerViewChanges(e),this._frameTask.processQueue(e),this._inFrameTask=!0,this._pendingUpdates=0,this._hasPendingUpdates=!1,this._updateTileStatus(e),this._sortTiles(e);const t=!this.view.state.fixedContentCamera;this._mergeAndSplit(e,t),e.run((()=>this._updateElevation(e))),e.run((()=>this._updateTextures(e))),t||this._mergeAndSplit(e,!0),this._inFrameTask=!1,this._runViewChangeUpdateIfDirty(),e.done&&this.requestUpdate(),this.notifyChange("updatingProgressValue")}_updateTileStatus(e){if(!this._viewChanged||!this.rootTiles||e.done)return;this._viewChanged=!1;const t=this._iteratorPool.acquire();for(t.reset(this.rootTiles);!t.done;){const e=t.next();if(e.loadable){const i=e.shouldSplit(this._splitLimits,this._eyePosRenderSR,this.lodSnapping);if(i===je.SPLIT){e.resetPendingUpdate(je.MERGE),e.isLeaf&&(e.setPendingUpdate(je.SPLIT),t.skipSubtree());continue}e.resetPendingUpdate(je.SPLIT)&&e.updateAgentSuspension(),i===je.VSPLITMERGE&&e.updateAgents(ae.ELEVATION)}if(t.skipSubtree(),!e.isLeaf){e.setPendingUpdate(je.MERGE),e.resetPendingUpdate(je.SPLIT);const t=this._iteratorPool.acquire();t.resetOne(e);for(let e=t.next();!t.done;e=t.next())this._updateClippingStatus(e),e.updateVisibility(),e.loadable&&e.updateScreenDepth(this._viewProjectionMatrix);t.remove()}}t.remove(),this.requestUpdate(),e.madeProgress()}_sortTiles(e){e.done||this._allTilesSorted||(Ae(this._allTiles,this.view.pointsOfInterest.focus.renderLocation),this._allTilesSorted=!0,this._treeDebugger&&this._treeDebugger.update(),e.madeProgress())}_mergeAndSplit(e,t){if(this.suspended||e.done||!this._allTilesDirty)return;this._allTilesDirty=!1,this.requestUpdate();let i=0;for(;!e.done;){let r=!1;i=0;const s=!this._allTiles.some((s=>{if(i+=s.usedMemory,s.resetPendingUpdate(je.MERGE)){if(!t)return s.setPendingUpdate(je.MERGE),e.done;this._mergeTile(s),r=!0,e.madeProgress()}else s.resetPendingUpdate(je.SPLIT)&&(this._splitTile(s),r=!0,e.madeProgress());return!e.done&&s.resetPendingUpdate(je.RENDERDATA)&&(this._updateRenderData(s),e.madeProgress()),e.done}));if(r&&(this._allTilesSorted=!1,this._allTilesDirty=!0),s){if(this._usedMemory=i,!r)break;this._updateTilesVisibility(this.rootTiles)}else this._allTilesDirty=!0}0===i&&(this._allTilesDirty=!0),this._sortTiles(e)}_updateElevation(e){return this._allTiles.some((t=>(t.resetPendingUpdate(je.GEOMETRY)&&(this._updateTileGeometry(t),this._updateTileTexture(t,e),e.madeProgress()),e.done))),e.hasProgressed}_updateTextures(e){return this._allTiles.some((t=>(this._updateTileTexture(t,e),e.done))),e.hasProgressed}_updateClippingExtent(){this.spatialReference&&(this.updateTileOverlayParams(qe.UPDATE),this.overlayManager.setPlacementDirty(),this._updateRootTiles())}get lodBias(){const e=this.view.resourceController.memoryController.memoryFactor;return this.view.qualitySettings.tiledSurface.lodBias-(1-e)*me}_getLodBiasCorrectedScale(e){const t=this.tilingScheme.levels,i=o(e-this.lodBias,0,t.length-1),r=i-Math.floor(i);return t[Math.floor(i)].scale*(1-r)+t[Math.ceil(i)].scale*r}_removeAllTiles(){p(this.rootTiles)&&(this.rootTiles.forEach((e=>this._purgeTile(e))),this._setRootTiles(null),this.notifyChange("ready")),this._allTiles.clear(),this.visible=!1}_purgeChildTiles(e){if(e.isLeaf)return!1;let t=this._purgeTile(e.children[0]);return t=this._purgeTile(e.children[1])||t,t=this._purgeTile(e.children[2])||t,t=this._purgeTile(e.children[3])||t,e.unsetChildren(),t}_purgeTile(e){const t=this._purgeChildTiles(e)||e.rendered;return this._allTiles.removeUnordered(e),e.unload(this._renderer),this._tilePool.release(e),t}_splitTile(e){Te(e.isLeaf,"tile that is already split should not be split again!");const t=e.level+1,i=2*e.lij[1],r=2*e.lij[2];e.setChildren(this._createTile(t,i,r,e),this._createTile(t,i,r+1,e),this._createTile(t,i+1,r,e),this._createTile(t,i+1,r+1,e)),e.setPendingUpdate(je.RENDERDATA),e.updateAgentSuspension(),this._allTiles.pushArray(e.children),this._allTilesDirty=!0,this._emitTileScaleChange(e,t),++this._performanceInfo.numSplit}_emitTileScaleChange(e,t=e.level){rt.spatialReference=this.spatialReference,rt.extent=e.extent,rt.scale=this._getLodBiasCorrectedScale(t),this.emit("scale-change",rt)}_createTile(e,t,i,r){Te(!!r,"_createTile sanity check");const s=this._acquireTile(e,t,i,r);return s.updateClippingStatus(this.extent),s.loadable&&(s.updateScreenDepth(this._viewProjectionMatrix),s.shouldSplit(this._splitLimits,this._eyePosRenderSR,this.lodSnapping)===je.SPLIT&&s.setPendingUpdate(je.SPLIT)),s}_mergeTile(e){Te(!e.hasPendingUpdate(je.SPLIT),"_mergeTile sanity check"),this._purgeChildTiles(e)&&(Te(!e.renderData,"_mergeTile sanity check"),this._loadTile(e)),this._allTilesDirty=!0,++this._performanceInfo.numMerged,this._emitTileScaleChange(e)}_loadChildren(e){Te(e.rendered,"parent should be rendered"),e.unload(this._renderer),this._loadTile(e.children[0]),this._loadTile(e.children[1]),this._loadTile(e.children[2]),this._loadTile(e.children[3])}_loadParent(e){const t=e.parent;this._unloadChildren(t),this._loadTile(t)}_unloadChildren(e){e.isLeaf||(this._unloadChildren(e.children[0]),e.children[0].unload(this._renderer),this._unloadChildren(e.children[1]),e.children[1].unload(this._renderer),this._unloadChildren(e.children[2]),e.children[2].unload(this._renderer),this._unloadChildren(e.children[3]),e.children[3].unload(this._renderer))}_loadTile(e){e.load(this._renderer),e.setPendingUpdate(je.RENDERDATA),this.requestUpdate(),this._allTilesDirty=!0,this.overlayManager&&this.overlayManager.hasOverlays&&this.overlayManager.setTileParameters(e),this._elevationUpdate(e)}_elevationDataArrived(e,t,i){const r=new te(e.lij,e.extent,i);e.dataArrived(t,ae.ELEVATION,r);const s=[e],a=e.level,n=this._iteratorPool.acquire();for(n.reset(s);!n.done;){const e=n.next();e.findElevationBoundsForLayer(t,a),e.computeElevationBounds()}n.remove(),this._updateTilesVisibility(s)}_handleLayerViewChanges(e=Fe){if(!this._layerViewsDirty)return;this._layerViewsDirty=!1;let t=!1;const i=new Set;let r=-1;for(const s of this.view.allLayerViews.items)if(i.add(s.uid),we(s))if(this._basemapLayerViewHandles.has(s.uid)){const e=this._layerClassFromLayerView(s),i=this._layerIndexByUid[e].get(s.uid);i<r&&(t=!0),r=i}else this._registerTiledLayerView(s),s.layer.loaded&&(t=!0);this._basemapLayerViewHandles.forEach(((e,r)=>{i.has(r)||(this._unregisterTiledLayerView(r),t=!0)})),t&&this._updateTiledLayers(),this._renderer.isTransparent=this._allTransparentSurfaceLayers(),e.madeProgress()}_allTransparentSurfaceLayers(){let e=0===this.view.map.ground.opacity;for(const t of this.view.allLayerViews.items)if(we(t)&&!Se(t)&&!H(t.layer)&&0!==t.fullOpacity)return e=!1,e;return e}_layerClassFromLayerView(e){return Se(e)?ae.ELEVATION:ae.MAP}_registerTiledLayerView(e){const t=[],i=this._layerClassFromLayerView(e);t.push(e.watch("suspended",(()=>this._updateTiledLayers()))),t.push(e.watch("fullOpacity",(()=>this._updateTileTextures(se.UNFADED)))),t.push(e.layer.watch("effectiveScaleRange",(()=>this._restartAllAgents(i)))),e.on("data-changed",(()=>{const t=this._layerIndexByUid[i].get(e.uid);null!=t&&this._invalidateLayerData(t,i)})),this._basemapLayerViewHandles.set(e.uid,t)}_unregisterTiledLayerView(e){const t=this._basemapLayerViewHandles.get(e);if(t){for(let e=0;e<t.length;e++)t[e].remove();this._basemapLayerViewHandles.delete(e)}}_updateTiledLayers(){if(!this.tilingScheme||this.view.suspended)return;const e=this.view.allLayerViews,t=[[],[]];let i=null;const r=V();e.forEach((e=>{const s=e.layer;if(!s||e.suspended||!we(e))return;const a=e.fullExtent;if(!a)return void Ge.warn("Terrain: Map or elevation layer does not have fullExtent: "+s.id);if(!this.tilingScheme.compatibleWith(e.tileInfo))return void Ge.warn("Terrain: tiling scheme of layer "+s.id+" is incompatible with other tiled layers, will not be drawn");O(r,a,r);const n=this._layerClassFromLayerView(e);if(n===ae.MAP){const t=e.displayLevelRange;t.maxLevel!==1/0&&(null===i||t.maxLevel>i)&&(i=t.maxLevel)}t[n].push(e)}));for(const s of ne){const e=this._layerViews[s],i=t[s];i.reverse();const r=i.length;let a=e.length!==r;const n=new Array(r),l=new Array(e.length);this._layerIndexByUid[s].clear();for(let t=0;t<r;t++){const r=i[t].uid;this._layerIndexByUid[s].set(r,t);const o=e.indexOf(i[t]);n[t]=o,t!==o&&(a=!0),o>-1&&(l[o]=t)}if(a){const e=this._postorderIterator;for(e.reset(this.rootTiles);!e.done;)e.next().modifyLayers(l,n,s);this._layerViews[s]=i,this._restartAllAgents(s),this._updateTilesVisibility(this.rootTiles)}}this.tilingScheme.ensureMaxLod(i)&&this._viewChangeUpdate()}_restartAllAgents(e){const t=this._postorderIterator;for(t.reset(this.rootTiles);!t.done;){const i=t.next();i.restartAgents(e),e===ae.ELEVATION&&i.computeElevationBounds()}}layerViewByIndex(e,t){return this._layerViews[t][e]}numLayers(e){return this._layerViews[e].length}_updateTileTextures(e){this._allTiles.forAll((t=>{t.updateAgents(ae.MAP),e===se.IMMEDIATE?this.renderer.updateTileTexture(t,je.TEXTURE_NOFADING):t.updateRenderData(ae.MAP,e)})),this._renderer.isTransparent=this._allTransparentSurfaceLayers()}_invalidateLayerData(e,t){this._allTiles.forAll((i=>i.removeLayerAgent(e,t))),this._allTiles.forAll((i=>i.invalidateLayerData(e,t)))}setTileTreeDirty(){this._allTilesDirty=!0}requestRender(e=qe.UPDATE){this.renderer.setNeedsRender(e)}requestUpdate(){1==++this._pendingUpdates&&(this._hasPendingUpdates=!0)}requestTileData(e,t,i,r){const s=this.layerViewByIndex(t,i),a=s.layer;return!a.tilemapCache||Le(s)?this._requestTileData(e,i,s,r):(++this._asyncWorkItems,a.tilemapCache.fetchAvailability(e.lij[0],e.lij[1],e.lij[2],{...r,timeout:6e3}).then((()=>--this._asyncWorkItems)).catch((t=>{throw--this._asyncWorkItems,m(t)||this._dataMissing(e,i,s,{notInTilemap:!0}),t})).then((()=>this._frameTask.schedule((()=>this._requestTileData(e,i,s,r)),r.signal))))}_requestTileData(e,t,i,r){return t===ae.ELEVATION?this._requestElevationTileData(e,i,r):this._requestMapTileData(e,i,r)}_requestElevationTileData(e,t,i){if(!Se(t))return void Te(!1,"_requestElevationTileData can only be called for elevation layer views");const r=r=>{if(--this._asyncWorkItems,g(i))return;const s=this._layerIndexByUid[ae.ELEVATION].get(t.uid);null!=s?(this._usedMemory=Ke,this.requestUpdate(),this._elevationDataArrived(e,s,r)):Ge.warn("TerrainSurface: received data from unknown layer %d %s",ae.ELEVATION,e.lij.toString())},s=i=>{--this._asyncWorkItems,m(i)||(this._dataMissing(e,ae.ELEVATION,t,i),this.requestUpdate())};if(++this._asyncWorkItems,xe(t.layer))return t.layer.fetchTile(e.lij[0],e.lij[1],e.lij[2],{noDataValue:ge,signal:i.signal}).then((e=>{if(g(i))return Ge.warnOnce("A call to fetchTile resolved even though the request was aborted. fetchTile should not resolve if options.signal.aborted is true."),void s(y());this._frameTask.schedule((()=>r(e)),i.signal,s)}),s);const a=t.getTileUrl(e.lij[0],e.lij[1],e.lij[2]);return this._elevationDataRequester.request(a,"binary",i).then((e=>this._lercDecoder.decode(e,{noDataValue:ge},i.signal))).then((e=>{r({values:e.pixelData,width:e.width,height:e.height,noDataValue:e.noDataValue,minValue:e.minValue,maxValue:e.maxValue})}),s)}_requestMapTileData(e,t,i){if(t instanceof Q)return Promise.reject();++this._asyncWorkItems;const r=(r,s)=>{--this._asyncWorkItems,Pe(s),g(i)||(this._dataMissing(e,ae.MAP,t,r),this.requestUpdate())},s=e=>t=>r(t,e),a=r=>this._frameTask.schedule((()=>{--this._asyncWorkItems,this.requestUpdate(),g(i)?Pe(r):this._mapTileDataArrived(e,t,r)}),i.signal,s(r)).catch(s(r)),n=(e,t=null)=>this._frameTask.schedule((()=>r(e,t)));if(Le(t)){const r=t.schemaHelper.getLevelRowColumn(e.lij);return t.fetchTile(r[0],r[1],r[2],i).then(a,n)}if(Ee(t))return t.fetchTile(e.lij[0],e.lij[1],e.lij[2],i).then(a,n);if(De(t)&&xe(t.layer))return t.layer.fetchTile(e.lij[0],e.lij[1],e.lij[2],i).then((e=>{if(g(i))return Ge.warnOnce("A call to fetchTile resolved even though the request was aborted. fetchTile should not resolve if options.signal.aborted is true."),void n(y());a(e)}),n);let l=t.getTileUrl(e.lij[0],e.lij[1],e.lij[2]);N(t.layer)&&t.layer.refreshTimestamp&&(l+=`${l.includes("?")?"&":"?"}_ts=${t.layer.refreshTimestamp}`);const o=t.hasMixedImageFormats?"image+type":"image";return this._mapDataRequester.request(l,o,i).then(a,n)}_mapTileDataArrived(e,t,i){const r=this._layerIndexByUid[ae.MAP].get(t.uid);null!=r?e.dataArrived(r,ae.MAP,i):(Pe(i),Ge.warn("TerrainSurface: received data from unknown layer"))}_dataMissing(e,t,i,r){const s=this._layerIndexByUid[t].get(i.uid);null!=s?e.dataMissing(s,t,r):Ge.warn("TerrainSurface: received data from unknown layer")}updateTileOverlayParams(e){this.rootTiles&&this.overlayManager&&(this._allTiles.forAll((e=>{e.renderData&&this.overlayManager.setTileParameters(e)})),this._renderer.setNeedsRender(e))}get performanceInfo(){const e=this._performanceInfo;return e.numNodes=this._allTiles.length,e.numLeaves=e.numVisible=e.numRendered=e.numLoadedPerLevel.length=e.numRenderedPerLevel.length=0,this._allTiles.forAll((t=>{t.isLeaf&&e.numLeaves++;const i=t.level;t.renderData&&(e.numLoadedPerLevel[i]=(e.numLoadedPerLevel[i]||0)+1),t.visible&&(e.numVisible++,t.rendered&&(e.numRenderedPerLevel[i]=(e.numRenderedPerLevel[i]||0)+1,e.numRendered++))})),e}getUsedMemory(){return this.tilingScheme?(this._usedMemory===Ke&&(this._usedMemory=0,this._allTiles.forAll((e=>this._usedMemory+=e.usedMemory))),this._usedMemory):0}getUsedMemoryForLayerView(e){let t=0;const i=this._layerClassFromLayerView(e),r=this._layerIndexByUid[i].get(e.uid);return this._allTiles.forAll((e=>t+=e.getUsedMemoryForLayer(i,r))),t}getTile(e){if(u(e)||u(this.rootTiles))return null;const t=e.split("/").map((e=>+e));if(0===t[0])return this.rootTiles.find((e=>e.lij[1]===t[1]&&e.lij[2]===t[2]));const i=2**t[0],r=Math.floor(t[1]/i),s=Math.floor(t[2]/i);let a;if(this.rootTiles.some((e=>e.lij[1]===r&&e.lij[2]===s&&(a=e,!0))),a){let e=1<<t[0]-1;for(;a.lij[0]<t[0];){let i=t[1]&e?2:0;if((t[2]&e)>0&&i++,!a.children[i])return null;a=a.children[i],e>>=1}return Te(a.lij[0]===t[0]&&a.lij[1]===t[1]&&a.lij[2]===t[2],"not the right tile?"),a}return null}get test(){const e=this;return{renderer:e._renderer,lercDecoder:e._lercDecoder,forceReload:()=>{p(e.rootTiles)&&(e._mergeTile(e.rootTiles[0]),e._viewChangeUpdate())},getTiles:()=>e._allTiles.toArray(),getRenderedTiles(){tt.clear(),e._allTiles.forAll((e=>{e.visible&&e.rendered&&tt.push(e)}));const t=tt.toArray();return Ve(e.renderOrder,t),t},lockTilingScheme(t,i){e._extentHelper.defaultTiledLayersExtent=i,e.tilingSchemeLogic.test.lockTilingScheme(t)}}}};e([S()],Qe.prototype,"_renderer",void 0),e([S()],Qe.prototype,"_hasPendingUpdates",void 0),e([S()],Qe.prototype,"_asyncWorkItems",void 0),e([S()],Qe.prototype,"_allTilesDirty",void 0),e([S()],Qe.prototype,"_allTilesSorted",void 0),e([S()],Qe.prototype,"_viewChanged",void 0),e([S({readOnly:!0})],Qe.prototype,"_watchUpdatingTracking",void 0),e([S()],Qe.prototype,"_frameTask",void 0),e([S({readOnly:!0})],Qe.prototype,"snapLevel",null),e([S({readOnly:!0})],Qe.prototype,"lodSnapping",null),e([S({constructOnly:!0})],Qe.prototype,"view",void 0),e([S()],Qe.prototype,"_userClippingExtent",null),e([S()],Qe.prototype,"_rootTilesExtent",void 0),e([S({readOnly:!0})],Qe.prototype,"extent",null),e([S({readOnly:!0})],Qe.prototype,"groundExtent",null),e([S({readOnly:!0})],Qe.prototype,"_tilingSchemeExtent",null),e([S({readOnly:!0})],Qe.prototype,"updating",null),e([S(J)],Qe.prototype,"updatingProgress",void 0),e([S({readOnly:!0})],Qe.prototype,"updatingProgressValue",null),e([S()],Qe.prototype,"_maxNumUpdating",void 0),e([S({aliasOf:"view.map.ground.opacity"})],Qe.prototype,"baseOpacity",void 0),e([S({readOnly:!0})],Qe.prototype,"overlayManager",void 0),e([S({readOnly:!0})],Qe.prototype,"viewingMode",null),e([S()],Qe.prototype,"maxTextureScale",void 0),e([S({readOnly:!0})],Qe.prototype,"ready",null),e([S({value:he.FRONT_TO_BACK})],Qe.prototype,"renderOrder",null),e([S({readOnly:!0})],Qe.prototype,"rootTiles",void 0),e([S({readOnly:!0})],Qe.prototype,"spatialReference",null),e([S()],Qe.prototype,"backgroundImage",void 0),e([S({type:t,aliasOf:"view.map.ground.surfaceColor"})],Qe.prototype,"backgroundColor",void 0),e([S()],Qe.prototype,"_background",null),e([S({value:!1})],Qe.prototype,"slicePlaneEnabled",null),e([S({readOnly:!0})],Qe.prototype,"tilingScheme",void 0),e([S({readOnly:!0,aliasOf:"tilingSchemeLogic.tilingSchemeLocked"})],Qe.prototype,"tilingSchemeLocked",void 0),e([S({readOnly:!0,aliasOf:"tilingSchemeLogic.tilingSchemeDone"})],Qe.prototype,"tilingSchemeDone",void 0),e([S({readOnly:!0})],Qe.prototype,"tilingSchemeLogic",void 0),e([S({value:!0})],Qe.prototype,"velvetOverground",null),e([w("_renderer.wireframe")],Qe.prototype,"wireframe",void 0),e([S({value:!1})],Qe.prototype,"suspended",null),e([S({readOnly:!0,aliasOf:"view.qualitySettings.tiledSurface.textureFadeDuration"})],Qe.prototype,"textureFadeDuration",void 0),e([S()],Qe.prototype,"_layerViewsDirty",void 0),e([w("_renderer.renderPatchBorders")],Qe.prototype,"renderPatchBorders",void 0),e([w("_renderer.renderingDisabled")],Qe.prototype,"renderingDisabled",void 0),Qe=e([L("esri.views.3d.terrain.TerrainSurface")],Qe);const Xe=Qe;function ze(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}function Ye(e){return!e.isLeaf&&(e.children[0].shouldLoad||e.children[1].shouldLoad||e.children[2].shouldLoad||e.children[3].shouldLoad||Ye(e.children[0])||Ye(e.children[1])||Ye(e.children[2])||Ye(e.children[3]))}function $e(e){return e.isLeaf&&e.parent&&e.parent.shouldLoad}const Ke=-1,Je=C(),Ze=M(),et=[0,0,0],tt=new _,it={spatialReference:null,tile:null,extent:null,context:"ground"},rt={spatialReference:null,extent:null,scale:0};export{Xe as default};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Color.js";import i from"../../../core/Accessor.js";import{difference as r}from"../../../core/arrayUtils.js";import s from"../../../core/CollectionFlattener.js";import a from"../../../core/Evented.js";import n from"../../../core/Handles.js";import l from"../../../core/Logger.js";import{clamp as o}from"../../../core/mathUtils.js";import{releaseMaybe as h,destroyMaybe as d,isNone as u,isSome as p}from"../../../core/maybe.js";import c from"../../../core/ObjectPool.js";import _ from"../../../core/PooledArray.js";import{isAbortError as m,isAborted as g,createAbortError as y}from"../../../core/promiseUtils.js";import{watch as f,sync as T}from"../../../core/reactiveUtils.js";import{init as v}from"../../../core/watchUtils.js";import{aliasOf as w}from"../../../core/accessorSupport/decorators/aliasOf.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{property as S}from"../../../core/accessorSupport/decorators/property.js";import{subclass as L}from"../../../core/accessorSupport/decorators/subclass.js";import{m as x}from"../../../chunks/mat4.js";import{c as E}from"../../../chunks/mat4f64.js";import{g as D}from"../../../chunks/vec3.js";import{c as P}from"../../../chunks/vec3f64.js";import{c as C}from"../../../chunks/vec4f64.js";import{projectVectorToVector as R,projectPointToVector as U}from"../../../geometry/projection.js";import{getReferenceEllipsoid as j}from"../../../geometry/projectionEllipsoid.js";import{create as M,equals as b,intersection as I,containsPoint as A,empty as V,expand as O,intersectsSphere as k}from"../../../geometry/support/aaBoundingRect.js";import{create as q,copy as B}from"../../../geometry/support/frustum.js";import{isRefreshableLayer as N}from"../../../layers/mixins/RefreshableLayer.js";import{ElevationQueryTileCache as F}from"../../../layers/support/ElevationQueryTileCache.js";import{isBaseLayer as H}from"../../../layers/support/layerUtils.js";import{acquireDecoder as G}from"../../../layers/support/LercDecoder.js";import{printAllocations as W}from"../../2d/engine/vectorTiles/VectorTile.js";import Q from"../layers/ElevationLayerView3D.js";import{directionToHeadingTilt as X,scaleToZoom as z}from"../support/cameraUtils.js";import Y from"../support/debugFlags.js";import{toBoundingRect as $}from"../support/extentUtils.js";import{ClientType as K}from"../support/index.js";import{updatingProgress as J}from"../support/updatingProperties.js";import{ElevationBounds as Z}from"./ElevationBounds.js";import{sampleElevation as ee,ElevationData as te}from"./ElevationData.js";import{create as ie}from"./ExtentHelper.js";import{LODSnapping as re,TextureUpdate as se}from"./interfaces.js";import{LayerClass as ae,LayerClasses as ne}from"./LayerClass.js";import{OverlayManager as le}from"./OverlayManager.js";import{PlanarPatch as oe}from"./PlanarPatch.js";import{RenderOrder as he}from"./RenderOrder.js";import{SphericalPatch as de}from"./SphericalPatch.js";import{DEFAULT_TILE_BACKGROUND as ue,MAX_ROOT_TILES as pe,TOO_MANY_ROOT_TILES_AFTER_CHANGE_ERROR as ce,TOO_MANY_ROOT_TILES_FOR_LAYER_ERROR as _e,MAX_MEMORY_LOD_BIAS as me,ELEVATION_NODATA_VALUE as ge}from"./TerrainConst.js";import ye from"./TerrainRenderer.js";import fe from"./TerrainSurfacePerformanceInfo.js";import{weakAssert as Te,computeSkirtScale as ve,isSurfaceLayerView as we,isElevationLayerView as Se,isVectorTileLayerView as Le,useFetchTileForLayer as xe,isImageryTileLayerView as Ee,isTileLayerView as De,releaseTileData as Pe}from"./terrainUtils.js";import{SplitLimits as Ce,Tile as Re}from"./Tile.js";import{printAllocations as Ue}from"./TilePerLayerInfo.js";import{TileUpdate as je}from"./TileUpdate.js";import{IteratorPreorder as Me,IteratorPostorder as be,hasLoadableSiblings as Ie,sortTilesByPOI as Ae,sortTiles as Ve}from"./tileUtils.js";import{TilingSchemeLogic as Oe}from"./TilingSchemeLogic.js";import{UpsampleInfo as ke}from"./UpsampleInfo.js";import{RenderRequestType as qe}from"../webgl-engine/lib/basicInterfaces.js";import{ImmediateTask as Be,TaskPriority as Ne,noBudget as Fe}from"../../support/Scheduler.js";import{WatchUpdatingTracking as He}from"../../support/WatchUpdatingTracking.js";const Ge=l.getLogger("esri.views.3d.terrain.TerrainSurface"),We=.25;let Qe=class extends(a.EventedMixin(i)){constructor(e){super(e),this._elevationBounds=new Z,this._iteratorPool=new c(Me,(e=>e.remove=()=>this._iteratorPool.release(e))),this._postorderIterator=new be,this._hasPendingUpdates=!1,this._pendingUpdates=0,this._asyncWorkItems=0,this._allTilesDirty=!0,this._allTilesSorted=!0,this._visible=!1,this._usedMemory=Ke,this._performanceInfo=new fe,this._viewChanged=!1,this._inFrameTask=!1,this._viewChangeUpdateDirty=!1,this._eyePosRenderSR=P(),this._eyePosSurfaceSR=P(),this._splitLimits=new Ce,this._snapLevel=1/0,this._frustum=q(),this._viewProjectionMatrix=E(),this._layerViews=[new Array,new Array],this._layerIndexByUid=[new Map,new Map],this._basemapLayerViewHandles=new Map,this._handles=new n,this._watchUpdatingTracking=new He,this._frameTask=Be,this._allTiles=new _,this._upsampleInfoPool=new c(ke),this._rootTilesExtent=M(),this._maxNumUpdating=1,this.maxTextureScale=1.2,this.backgroundImage=ue,this.backgroundColor=null,this._layerViewsDirty=!1}initialize(){this._lercDecoder=G(this.view.resourceController),this._tilePool=this.view.state.isLocal?new c(oe):new c(de);const e=this.view.resourceController.memoryController;this._upsampleMapCache=e.newCache("esri.views.3d.terrain.upsample",(e=>e.unloadMapData())),this._elevationQueryCache=new F(e.newCache("elevation-query")),this._set("overlayManager",new le({surface:this})),this._handles.add([this.watch("overlayManager.hasHighlights",(e=>this._renderer.setNeedsHighlight(e))),this.watch("overlayManager.rendersOccluded",(e=>this._renderer.setRenderOccludedOverlay(e)))],"overlayManager"),this._renderer=new ye({overlayRenderer:this.overlayManager.renderer,ellipsoidRadius:j(this.view.spatialReference).radius,stage:this.view._stage,allTiles:this._allTiles}),this._handles.add([v(this,"baseOpacity",(e=>{this._handleLayerViewChanges(),this._updateBaseOpacity(e)}),!0),v(this,"_background",(()=>{this._handleLayerViewChanges(),this._renderer.setTileBackground(this._background)}),!0),this.view.watch("pointsOfInterest",(e=>{this._renderer.pointsOfInterest=e,this._watchUpdatingTracking.removeAll(),e&&this._watchUpdatingTracking.add((()=>e.focus.renderLocation),(()=>()=>this._allTilesSorted=!1))})),v(Y,"TERRAIN_TILE_TREE_SHOW_TILES",(e=>{e&&!this._treeDebugger?import("../layers/support/TerrainTileTree3DDebugger.js").then((({TerrainTileTree3DDebugger:e})=>{!this._treeDebugger&&Y.TERRAIN_TILE_TREE_SHOW_TILES&&(this._treeDebugger=new e({view:this.view}))})):e||(this._treeDebugger=d(this._treeDebugger))}))]),this._extentHelper=ie(this.viewingMode,{layers:this.view.map.allLayers,layerViews:this.view.allLayerViews,viewSpatialReference:this.view.spatialReference});const t=this.view.defaultsFromMap?new s({getCollections:()=>{var e,t,i;return null==(e=this.view)||null==(t=e.defaultsFromMap)||null==(i=t.mapCollections)?void 0:i.map((({layers:e})=>e))},getChildrenFunction:e=>e&&"layers"in e?e.layers:null}):this.view.map.allLayers,i=new Oe({layers:t,extentHelper:this._extentHelper,viewingMode:this.viewingMode,viewSpatialReference:this.view.spatialReference});this._set("tilingSchemeLogic",i),this._updateTilingScheme(),this._elevationDataRequester=this.view.resourceController.createStreamDataRequester(K.ELEVATION),this._mapDataRequester=this.view.resourceController.createStreamDataRequester(K.BASEMAP);const r=this.view.resourceController.scheduler;this._frameTask=r.registerTask(Ne.TERRAIN_SURFACE,this),this.view.resourceController.memoryController.events.on("quality-changed",(()=>this._viewChangeUpdate())),this._handles.add([v(this._extentHelper,"stencilEnabledExtents",(e=>this._renderer.setStencilEnabledLayerExtents(e))),this.tilingSchemeLogic.watch("tilingScheme",(()=>this._updateTilingScheme()),!0),v(this,"extent",(()=>this._updateRootTiles())),this.view.on("resize",(()=>this._viewChangeUpdate())),this.view.watch("state.camera",(()=>this._viewChangeUpdate()),!0),this.view.watch("state.contentCamera",(()=>this.view.state.fixedContentCamera&&this._viewChangeUpdate()),!0),this.view.watch("qualitySettings.tiledSurface.lodBias",(()=>this._viewChangeUpdate())),v(this.view,"qualitySettings.tiledSurface.textureFadeDuration",(e=>this._renderer.textureFadingEnabled=e>0)),this.view.watch("lodSnapping",(()=>this._viewChangeUpdate())),f((()=>this._userClippingExtent),(()=>this._updateClippingExtent()),T)]),this._handles.add(this.view.allLayerViews.on("after-changes",(()=>this._layerViewsDirty=!0))),this._layerViewsDirty=!0,this._handleLayerViewChanges()}destroy(){this._frameTask.remove(),this._handles.destroy(),this._watchUpdatingTracking.destroy(),this._lercDecoder=h(this._lercDecoder),this._removeAllTiles(),this._upsampleMapCache=d(this._upsampleMapCache),this._elevationQueryCache=d(this._elevationQueryCache),this._set("tilingSchemeLogic",d(this.tilingSchemeLogic)),this._extentHelper=d(this._extentHelper),this._basemapLayerViewHandles.forEach(((e,t)=>this._unregisterTiledLayerView(t))),this._elevationDataRequester=null,this._mapDataRequester=null,this._set("overlayManager",d(this.overlayManager)),this._tilePool=d(this._tilePool),Re.prune(),this._treeDebugger&&(this._treeDebugger.destroy(),this._treeDebugger=null),this._renderer=d(this._renderer),this._iteratorPool=d(this._iteratorPool),this._set("view",null),this._upsampleInfoPool=d(this._upsampleInfoPool),W(),Ue()}get renderer(){return this._renderer}get frustum(){return this._frustum}get snapLevel(){var e,t;const i=null==(e=this.view.pointsOfInterest)||null==(t=e.contentCameraOnSurface)?void 0:t.scale;if(i){const e=this.view.state.contentCamera;let t=X(this.view,e.eye,e.viewForward,e.up).tilt;t>90&&(t=180-t);const r=2*(t/90)**2,s=z(this.view,i)-r;Math.abs(this._snapLevel-s)>We&&(Math.round(s)!==Math.round(this._snapLevel)&&(this._viewChanged=!0),this._snapLevel=s)}return Math.round(this._snapLevel)}get lodSnapping(){return this.view.qualitySettings.tiledSurface.reduceTileLevelDifferences?re.ON:re.OFF}get upsampleInfoPool(){return this._upsampleInfoPool}get upsampleMapCache(){return this._upsampleMapCache}get elevationQueryCache(){return this._elevationQueryCache}get mapTileRequester(){return this._mapDataRequester}get _userClippingExtent(){const{spatialReference:e}=this,{clippingArea:t}=this.view;if(u(t)||u(e))return null;const i=M(),r=$(t,i,e)?i:null,s=this._get("extent");return b(r,s)?s:r}get extent(){const e=I(this.groundExtent,this._userClippingExtent,M()),t=this._get("extent");return b(e,t)?t:e}get groundExtent(){return p(this._tilingSchemeExtent)?this._tilingSchemeExtent:this._rootTilesExtent}get _tilingSchemeExtent(){var e;return null==(e=this.tilingSchemeLogic)?void 0:e.extent}get updating(){return this._hasPendingUpdates||(this._maxNumUpdating=1),!!((this._watchUpdatingTracking.updating||this._hasPendingUpdates||this._viewChanged||this._allTilesDirty||this._asyncWorkItems>0||!this._allTilesSorted||this._renderer.updating||this._layerViewsDirty)&&this.ready&&!this.suspended||this.overlayManager.updating||this._frameTask.updating)}get updatingProgressValue(){return this._maxNumUpdating=Math.max(this._pendingUpdates,this._maxNumUpdating),1-this._pendingUpdates/this._maxNumUpdating}get viewingMode(){return this.view.state.viewingMode}get ready(){return p(this.rootTiles)}set renderOrder(e){this._renderer.renderOrder=e,this._set("renderOrder",e)}set skirtScale(e){this._renderer.skirtScale=e}get skirtScale(){return this._renderer.skirtScale}get spatialReference(){var e,t;return null!=(e=null==(t=this.tilingScheme)?void 0:t.spatialReference)?e:null}get _background(){return null!=this.backgroundColor?this.backgroundColor:this.backgroundImage}set slicePlaneEnabled(e){var t,i;this._renderer.slicePlaneEnabled=e,this._set("slicePlaneEnabled",e),null==(t=this.view)||null==(i=t._stage)||i.renderView.setRenderParameters({opaqueTerrain:this.opaque})}set velvetOverground(e){e!==this.velvetOverground&&(this._renderer.velvetOverground=e),this._set("velvetOverground",e)}set visible(e){e!==this._visible&&(this._visible=e,this._renderer.setVisibility(e),this.suspended=!e)}get opaque(){return this._renderer.opaque}set suspended(e){this._set("suspended",e),this._viewChangeUpdate()}intersect(e,t,i,r){this._renderer.intersect(e,t,i,r)}getElevation(e,t,i,r){const s=this.getTileWithElevation(e,t,i,r,Je);return u(s)?null:ee(Je[0],Je[1],s.renderData.geometryState.samplerData)}getTileWithElevation(e,t,i,r,s=Je){var a;const n=this.rootTiles;if(u(n)||!n.length)return null;if(0===n[0].layerInfo[ae.ELEVATION].length)return null;if(s[0]=e,s[1]=t,s[2]=i,!R(s,r,s,null==(a=this.tilingScheme)?void 0:a.spatialReference))return Ge.error("TerrainSurface.getElevation(): could not project given point to tiling scheme coordinate system"),null;for(let l of n){if(!l.containsPoint(s))continue;for(;l&&!l.rendered&&!l.isLeaf;){let e=0;s[0]>.5*(l.extent[0]+l.extent[2])&&(e+=1),s[1]<.5*(l.extent[1]+l.extent[3])&&(e+=2),l=l.children[e]}const e=l.renderData;return(e?e.geometryState.samplerData:null)?l:null}return null}get elevationBounds(){return this._elevationBounds}getScale(e){if(this.tilingScheme){if(!U(e,Je,this.spatialReference))return Ge.error("TerrainSurface.getScale(): could not project given point to tiling scheme coordinate system"),null;const t=this.rootTiles;if(p(t))for(let e of t)if(e.containsPoint(Je)){for(;null!=e.children[0];){let t=0;Je[0]>e.children[0].extent[2]&&(t+=1),Je[1]<e.children[0].extent[1]&&(t+=2),e=e.children[t]}return this._getLodBiasCorrectedScale(e.level)}}return 1e100}getSphereScale(e,t){if(!this.tilingScheme)return null;if(!U(e,Je,this.spatialReference))return Ge.error("TerrainSurface.getSphereScale(): could not project given point to tiling scheme coordinate system"),null;Je[3]=t;let i=null;const r=e=>{if(e&&k(e.extent,Je))if(null!=e.children[0])for(const t of e.children)r(t);else{const t=this._getLodBiasCorrectedScale(e.level);i=null==i?t:Math.min(i,t)}},s=this.rootTiles;if(p(s))for(const a of s)r(a);return i}queryVisibleScaleRange(e,t,i,r){const s=t?this.tilingScheme.levelAtScale(t):0,a=i?this.tilingScheme.levelAtScale(i):1/0,n=this.lodBias;this._renderer.queryVisibleLevelRange(e,s+n,a+n,r)}_updateBaseOpacity(e){const t=this._renderer.opaque;this._renderer.opaque=e>=1,this._renderer.isTransparent=this._allTransparentSurfaceLayers();const i=t===this._renderer.opaque?se.UNFADED:se.IMMEDIATE;var r,s;i===se.IMMEDIATE&&(null==(r=this.view)||null==(s=r._stage)||s.renderView.setRenderParameters({opaqueTerrain:this.opaque}));this._updateTileTextures(i)}_updateTilingScheme(){const e=this.tilingSchemeLogic.tilingScheme;e!==this.tilingScheme&&(Te(!!e,"tiling scheme cannot be reset to undefined"),this.tilingScheme&&this._removeAllTiles(),this._set("tilingScheme",e),this._updateClippingExtent(),e&&(this._updateTiledLayers(),this._renderer.setTileSize(e.pixelSize),this.overlayManager.setSpatialReference(e.spatialReference),this._updateRootTiles()))}_acquireTile(e,t,i,r){const s=this._tilePool.acquire();return et[0]=e,et[1]=t,et[2]=i,s.init(et,r,this),s}_updateRootTiles(){const{extent:e,tilingScheme:t}=this;if(!t)return;const i=Ze;let s=t.rootTilesInExtent(e,i,5*pe);if(p(this.rootTiles)){if(s.length>pe)return void Ge.warn(ce);const e=this.rootTiles.map((e=>e.lij)),t=r(e,s,ze);if(t.removed.length>0||t.added.length>0){const e=this.rootTiles.filter((e=>!(t.removed.findIndex((t=>ze(t,e.lij)))>-1)||(this._purgeTile(e),!1)));t.added.forEach((t=>e.push(this._newRootTile(t)))),this._setRootTiles(e)}}else s.length>pe&&(Ge.warn(_e),s=t.rootTilesInExtent(e,i,pe)),this._setRootTiles(s.map((e=>this._newRootTile(e))));b(i,this._rootTilesExtent)||(this._rootTilesExtent=M(i)),this.visible=!0,this._viewChangeUpdate(),this.overlayManager.setPlacementDirty(),this.notifyChange("ready")}_newRootTile(e){const t=this._acquireTile(0,e[1],e[2],null);return t.shouldSplit(this._splitLimits,this._eyePosRenderSR,this.lodSnapping)===je.SPLIT&&t.setPendingUpdate(je.SPLIT),this._loadTile(t),t}_setRootTiles(e){if(this._set("rootTiles",e),this._allTiles.clear(),p(e)){const t=this._iteratorPool.acquire();for(t.reset(e);!t.done;)this._allTiles.push(t.next());t.remove()}this._renderer.setRootTiles(this.rootTiles),this._updateTilesVisibility(e)}_runViewChangeUpdateIfDirty(){this._viewChangeUpdateDirty&&(this._viewChangeUpdateDirty=!1,this._viewChangeUpdate())}_viewChangeUpdate(){this.view&&!this.suspended&&this.tilingScheme&&this._visible&&(this._inFrameTask?this._viewChangeUpdateDirty=!0:(this._viewChangeUpdateDirty=!1,this._updateViewDependentParameters(),this._updateSkirts(),this._updateTilesVisibility(this.rootTiles)))}_updateClippingStatus(e){e.updateClippingStatus(this.extent)&&e.resetPendingUpdate(je.GEOMETRY)&&this._updateTileGeometry(e)}_updateTilesVisibility(e){if(u(e))return;const t=Ie(e);let i=t?this._elevationBounds.min:1/0,r=t?this._elevationBounds.max:-1/0;const s=this.view.state.fixedContentCamera,a=this.extent,n=this._viewProjectionMatrix;this.setTileTreeDirty();const l=this._iteratorPool.acquire();for(l.reset(e);!l.done;){const e=l.next();e.updateClippingStatus(a)&&e.resetPendingUpdate(je.GEOMETRY)&&this._updateTileGeometry(e),e.setPendingUpdate(je.RENDERDATA);const t=e.computeVisibility();s||t?(e.updateScreenDepth(n),e.renderData&&(i=Math.min(e.elevationBounds[0],i),r=Math.max(e.elevationBounds[1],r))):l.skipSubtree()}l.remove(),this._viewChanged=!0,this._allTilesDirty=!0,isFinite(i)&&isFinite(r)&&(this._elevationBounds.min===i&&this._elevationBounds.max===r||(this._elevationBounds.min=i,this._elevationBounds.max=r,this.emit("elevation-bounds-change",null)))}_updateViewDependentParameters(){const e=this.view.state.camera,t=this.view.state.contentCamera,i=Math.tan(.5*t.fovX),r=Math.tan(.5*t.fovY),s=this.tilingScheme.pixelSize,a=2**-this.lodBias*e.pixelRatio;this._splitLimits.aboveGround=e.aboveGround,this._splitLimits.fovX=i,this._splitLimits.fovY=r,this._splitLimits.relativeWidthLimit=s/e.width*this.maxTextureScale*a,this._splitLimits.relativeHeightLimit=s/e.height*this.maxTextureScale*a,this._splitLimits.maxLod=this.tilingScheme.getMaxLod(),this._splitLimits.angledSplitBias=this.view.qualitySettings.tiledSurface.angledSplitBias,this.view.state.fixedContentCamera?(u(this._splitLimits.frustum)&&(this._splitLimits.frustum=q()),B(this._splitLimits.frustum,t.frustum)):this._splitLimits.frustum=null,B(this._frustum,e.frustum),x(this._viewProjectionMatrix,t.projectionMatrix,t.viewMatrix),D(this._eyePosRenderSR,t.eye),R(e.eye,this.view.renderSpatialReference,this._eyePosSurfaceSR,this.spatialReference)}_updateSkirts(){const e=this.view.state.camera,t=this.view.state.constraints.collision.enabled?0:1.11*e.near;this.skirtScale=ve(this,this._eyePosSurfaceSR,t)}_updateRenderData(e){e.rendered&&!e.shouldLoad&&(Ye(e)?this._loadChildren(e):$e(e)&&this._loadParent(e))}_updateTileGeometry(e){e.updateVisibility(),this._renderer.updateTileGeometry(e),this._elevationUpdate(e),this._usedMemory=Ke}_updateTileTexture(e,t){const i=e.resetPendingUpdate(je.TEXTURE_FADING)?je.TEXTURE_FADING:!!e.resetPendingUpdate(je.TEXTURE_NOFADING)&&je.TEXTURE_NOFADING;i&&(this._renderer.updateTileTexture(e,i),this._usedMemory=Ke,t.madeProgress())}_elevationUpdate(e){it.spatialReference=this.spatialReference,it.tile=e,it.extent=e.extent,this.emit("elevation-change",it),A(e.extent,this._eyePosSurfaceSR)&&this._updateSkirts()}get running(){return this.updating&&this.ready&&!this.suspended}runTask(e){this._handleLayerViewChanges(e),this._frameTask.processQueue(e),this._inFrameTask=!0,this._pendingUpdates=0,this._hasPendingUpdates=!1,this._updateTileStatus(e),this._sortTiles(e);const t=!this.view.state.fixedContentCamera;this._mergeAndSplit(e,t),e.run((()=>this._updateElevation(e))),e.run((()=>this._updateTextures(e))),t||this._mergeAndSplit(e,!0),this._inFrameTask=!1,this._runViewChangeUpdateIfDirty(),e.done&&this.requestUpdate(),this.notifyChange("updatingProgressValue")}_updateTileStatus(e){if(!this._viewChanged||!this.rootTiles||e.done)return;this._viewChanged=!1;const t=this._iteratorPool.acquire();for(t.reset(this.rootTiles);!t.done;){const e=t.next();if(e.loadable){const i=e.shouldSplit(this._splitLimits,this._eyePosRenderSR,this.lodSnapping);if(i===je.SPLIT){e.resetPendingUpdate(je.MERGE),e.isLeaf&&(e.setPendingUpdate(je.SPLIT),t.skipSubtree());continue}e.resetPendingUpdate(je.SPLIT)&&e.updateAgentSuspension(),i===je.VSPLITMERGE&&e.updateAgents(ae.ELEVATION)}if(t.skipSubtree(),!e.isLeaf){e.setPendingUpdate(je.MERGE),e.resetPendingUpdate(je.SPLIT);const t=this._iteratorPool.acquire();t.resetOne(e);for(let e=t.next();!t.done;e=t.next())this._updateClippingStatus(e),e.updateVisibility(),e.loadable&&e.updateScreenDepth(this._viewProjectionMatrix);t.remove()}}t.remove(),this.requestUpdate(),e.madeProgress()}_sortTiles(e){e.done||this._allTilesSorted||(Ae(this._allTiles,this.view.pointsOfInterest.focus.renderLocation),this._allTilesSorted=!0,this._treeDebugger&&this._treeDebugger.update(),e.madeProgress())}_mergeAndSplit(e,t){if(this.suspended||e.done||!this._allTilesDirty)return;this._allTilesDirty=!1,this.requestUpdate();let i=0;for(;!e.done;){let r=!1;i=0;const s=!this._allTiles.some((s=>{if(i+=s.usedMemory,s.resetPendingUpdate(je.MERGE)){if(!t)return s.setPendingUpdate(je.MERGE),e.done;this._mergeTile(s),r=!0,e.madeProgress()}else s.resetPendingUpdate(je.SPLIT)&&(this._splitTile(s),r=!0,e.madeProgress());return!e.done&&s.resetPendingUpdate(je.RENDERDATA)&&(this._updateRenderData(s),e.madeProgress()),e.done}));if(r&&(this._allTilesSorted=!1,this._allTilesDirty=!0),s){if(this._usedMemory=i,!r)break;this._updateTilesVisibility(this.rootTiles)}else this._allTilesDirty=!0}0===i&&(this._allTilesDirty=!0),this._sortTiles(e)}_updateElevation(e){return this._allTiles.some((t=>(t.resetPendingUpdate(je.GEOMETRY)&&(this._updateTileGeometry(t),this._updateTileTexture(t,e),e.madeProgress()),e.done))),e.hasProgressed}_updateTextures(e){return this._allTiles.some((t=>(this._updateTileTexture(t,e),e.done))),e.hasProgressed}_updateClippingExtent(){this.spatialReference&&(this.updateTileOverlayParams(qe.UPDATE),this.overlayManager.setPlacementDirty(),this._updateRootTiles())}get lodBias(){const e=this.view.resourceController.memoryController.memoryFactor;return this.view.qualitySettings.tiledSurface.lodBias-(1-e)*me}_getLodBiasCorrectedScale(e){const t=this.tilingScheme.levels,i=o(e-this.lodBias,0,t.length-1),r=i-Math.floor(i);return t[Math.floor(i)].scale*(1-r)+t[Math.ceil(i)].scale*r}_removeAllTiles(){p(this.rootTiles)&&(this.rootTiles.forEach((e=>this._purgeTile(e))),this._setRootTiles(null),this.notifyChange("ready")),this._allTiles.clear(),this.visible=!1}_purgeChildTiles(e){if(e.isLeaf)return!1;let t=this._purgeTile(e.children[0]);return t=this._purgeTile(e.children[1])||t,t=this._purgeTile(e.children[2])||t,t=this._purgeTile(e.children[3])||t,e.unsetChildren(),t}_purgeTile(e){const t=this._purgeChildTiles(e)||e.rendered;return this._allTiles.removeUnordered(e),e.unload(this._renderer),this._tilePool.release(e),t}_splitTile(e){Te(e.isLeaf,"tile that is already split should not be split again!");const t=e.level+1,i=2*e.lij[1],r=2*e.lij[2];e.setChildren(this._createTile(t,i,r,e),this._createTile(t,i,r+1,e),this._createTile(t,i+1,r,e),this._createTile(t,i+1,r+1,e)),e.setPendingUpdate(je.RENDERDATA),e.updateAgentSuspension(),this._allTiles.pushArray(e.children),this._allTilesDirty=!0,this._emitTileScaleChange(e,t),++this._performanceInfo.numSplit}_emitTileScaleChange(e,t=e.level){rt.spatialReference=this.spatialReference,rt.extent=e.extent,rt.scale=this._getLodBiasCorrectedScale(t),this.emit("scale-change",rt)}_createTile(e,t,i,r){Te(!!r,"_createTile sanity check");const s=this._acquireTile(e,t,i,r);return s.updateClippingStatus(this.extent),s.loadable&&(s.updateScreenDepth(this._viewProjectionMatrix),s.shouldSplit(this._splitLimits,this._eyePosRenderSR,this.lodSnapping)===je.SPLIT&&s.setPendingUpdate(je.SPLIT)),s}_mergeTile(e){Te(!e.hasPendingUpdate(je.SPLIT),"_mergeTile sanity check"),this._purgeChildTiles(e)&&(Te(!e.renderData,"_mergeTile sanity check"),this._loadTile(e)),this._allTilesDirty=!0,++this._performanceInfo.numMerged,this._emitTileScaleChange(e)}_loadChildren(e){Te(e.rendered,"parent should be rendered"),e.unload(this._renderer),this._loadTile(e.children[0]),this._loadTile(e.children[1]),this._loadTile(e.children[2]),this._loadTile(e.children[3])}_loadParent(e){const t=e.parent;this._unloadChildren(t),this._loadTile(t)}_unloadChildren(e){e.isLeaf||(this._unloadChildren(e.children[0]),e.children[0].unload(this._renderer),this._unloadChildren(e.children[1]),e.children[1].unload(this._renderer),this._unloadChildren(e.children[2]),e.children[2].unload(this._renderer),this._unloadChildren(e.children[3]),e.children[3].unload(this._renderer))}_loadTile(e){e.load(this._renderer),e.setPendingUpdate(je.RENDERDATA),this.requestUpdate(),this._allTilesDirty=!0,this.overlayManager&&this.overlayManager.hasOverlays&&this.overlayManager.setTileParameters(e),this._elevationUpdate(e)}_elevationDataArrived(e,t,i){const r=new te(e.lij,e.extent,i);e.dataArrived(t,ae.ELEVATION,r);const s=[e],a=e.level,n=this._iteratorPool.acquire();for(n.reset(s);!n.done;){const e=n.next();e.findElevationBoundsForLayer(t,a),e.computeElevationBounds()}n.remove(),this._updateTilesVisibility(s)}_handleLayerViewChanges(e=Fe){if(!this._layerViewsDirty)return;this._layerViewsDirty=!1;let t=!1;const i=new Set;let r=-1;for(const s of this.view.allLayerViews.items)if(i.add(s.uid),we(s))if(this._basemapLayerViewHandles.has(s.uid)){const e=this._layerClassFromLayerView(s),i=this._layerIndexByUid[e].get(s.uid);i<r&&(t=!0),r=i}else this._registerTiledLayerView(s),s.layer.loaded&&(t=!0);this._basemapLayerViewHandles.forEach(((e,r)=>{i.has(r)||(this._unregisterTiledLayerView(r),t=!0)})),t&&this._updateTiledLayers(),this._renderer.isTransparent=this._allTransparentSurfaceLayers(),e.madeProgress()}_allTransparentSurfaceLayers(){let e=0===this.view.map.ground.opacity;for(const t of this.view.allLayerViews.items)if(we(t)&&!Se(t)&&!H(t.layer)&&0!==t.fullOpacity)return e=!1,e;return e}_layerClassFromLayerView(e){return Se(e)?ae.ELEVATION:ae.MAP}_registerTiledLayerView(e){const t=[],i=this._layerClassFromLayerView(e);t.push(e.watch("suspended",(()=>this._updateTiledLayers()))),t.push(e.watch("fullOpacity",(()=>this._updateTileTextures(se.UNFADED)))),t.push(e.layer.watch("effectiveScaleRange",(()=>this._restartAllAgents(i)))),e.on("data-changed",(()=>{const t=this._layerIndexByUid[i].get(e.uid);null!=t&&this._invalidateLayerData(t,i)})),this._basemapLayerViewHandles.set(e.uid,t)}_unregisterTiledLayerView(e){const t=this._basemapLayerViewHandles.get(e);if(t){for(let e=0;e<t.length;e++)t[e].remove();this._basemapLayerViewHandles.delete(e)}}_updateTiledLayers(){if(!this.tilingScheme||this.view.suspended)return;const e=this.view.allLayerViews,t=[[],[]];let i=null;const r=V();e.forEach((e=>{const s=e.layer;if(!s||e.suspended||!we(e))return;const a=e.fullExtent;if(!a)return void Ge.warn("Terrain: Map or elevation layer does not have fullExtent: "+s.id);if(!this.tilingScheme.compatibleWith(e.tileInfo))return void Ge.warn("Terrain: tiling scheme of layer "+s.id+" is incompatible with other tiled layers, will not be drawn");O(r,a,r);const n=this._layerClassFromLayerView(e);if(n===ae.MAP){const t=e.displayLevelRange;t.maxLevel!==1/0&&(null===i||t.maxLevel>i)&&(i=t.maxLevel)}t[n].push(e)}));for(const s of ne){const e=this._layerViews[s],i=t[s];i.reverse();const r=i.length;let a=e.length!==r;const n=new Array(r),l=new Array(e.length);this._layerIndexByUid[s].clear();for(let t=0;t<r;t++){const r=i[t].uid;this._layerIndexByUid[s].set(r,t);const o=e.indexOf(i[t]);n[t]=o,t!==o&&(a=!0),o>-1&&(l[o]=t)}if(a){const e=this._postorderIterator;for(e.reset(this.rootTiles);!e.done;)e.next().modifyLayers(l,n,s);this._layerViews[s]=i,this._restartAllAgents(s),this._updateTilesVisibility(this.rootTiles)}}this.tilingScheme.ensureMaxLod(i)&&this._viewChangeUpdate()}_restartAllAgents(e){const t=this._postorderIterator;for(t.reset(this.rootTiles);!t.done;){const i=t.next();i.restartAgents(e),e===ae.ELEVATION&&i.computeElevationBounds()}}layerViewByIndex(e,t){return this._layerViews[t][e]}numLayers(e){return this._layerViews[e].length}_updateTileTextures(e){this._allTiles.forAll((t=>{t.updateAgents(ae.MAP),e===se.IMMEDIATE?this.renderer.updateTileTexture(t,je.TEXTURE_NOFADING):t.updateRenderData(ae.MAP,e)})),this._renderer.isTransparent=this._allTransparentSurfaceLayers()}_invalidateLayerData(e,t){this._allTiles.forAll((i=>i.removeLayerAgent(e,t))),this._allTiles.forAll((i=>i.invalidateLayerData(e,t)))}setTileTreeDirty(){this._allTilesDirty=!0}requestRender(e=qe.UPDATE){this.renderer.setNeedsRender(e)}requestUpdate(){1==++this._pendingUpdates&&(this._hasPendingUpdates=!0)}requestTileData(e,t,i,r){const s=this.layerViewByIndex(t,i),a=s.layer;return!a.tilemapCache||Le(s)?this._requestTileData(e,i,s,r):(++this._asyncWorkItems,a.tilemapCache.fetchAvailability(e.lij[0],e.lij[1],e.lij[2],{...r,timeout:6e3}).then((()=>--this._asyncWorkItems)).catch((t=>{throw--this._asyncWorkItems,m(t)||this._dataMissing(e,i,s,{notInTilemap:!0}),t})).then((()=>this._frameTask.schedule((()=>this._requestTileData(e,i,s,r)),r.signal))))}_requestTileData(e,t,i,r){return t===ae.ELEVATION?this._requestElevationTileData(e,i,r):this._requestMapTileData(e,i,r)}_requestElevationTileData(e,t,i){if(!Se(t))return void Te(!1,"_requestElevationTileData can only be called for elevation layer views");const r=r=>{if(--this._asyncWorkItems,g(i))return;const s=this._layerIndexByUid[ae.ELEVATION].get(t.uid);null!=s?(this._usedMemory=Ke,this.requestUpdate(),this._elevationDataArrived(e,s,r)):Ge.warn("TerrainSurface: received data from unknown layer %d %s",ae.ELEVATION,e.lij.toString())},s=i=>{--this._asyncWorkItems,m(i)||(this._dataMissing(e,ae.ELEVATION,t,i),this.requestUpdate())};if(++this._asyncWorkItems,xe(t.layer))return t.layer.fetchTile(e.lij[0],e.lij[1],e.lij[2],{noDataValue:ge,signal:i.signal}).then((e=>{if(g(i))return Ge.warnOnce("A call to fetchTile resolved even though the request was aborted. fetchTile should not resolve if options.signal.aborted is true."),void s(y());this._frameTask.schedule((()=>r(e)),i.signal,s)}),s);const a=t.getTileUrl(e.lij[0],e.lij[1],e.lij[2]);return this._elevationDataRequester.request(a,"binary",i).then((e=>this._lercDecoder.decode(e,{noDataValue:ge},i.signal))).then((e=>{r({values:e.pixelData,width:e.width,height:e.height,noDataValue:e.noDataValue,minValue:e.minValue,maxValue:e.maxValue})}),s)}_requestMapTileData(e,t,i){if(t instanceof Q)return Promise.reject();++this._asyncWorkItems;const r=(r,s)=>{--this._asyncWorkItems,Pe(s),g(i)||(this._dataMissing(e,ae.MAP,t,r),this.requestUpdate())},s=e=>t=>r(t,e),a=r=>this._frameTask.schedule((()=>{--this._asyncWorkItems,this.requestUpdate(),g(i)?Pe(r):this._mapTileDataArrived(e,t,r)}),i.signal,s(r)).catch(s(r)),n=(e,t=null)=>this._frameTask.schedule((()=>r(e,t)));if(Le(t)){const r=t.schemaHelper.getLevelRowColumn(e.lij);return t.fetchTile(r[0],r[1],r[2],i).then(a,n)}if(Ee(t))return t.fetchTile(e.lij[0],e.lij[1],e.lij[2],i).then(a,n);if(De(t)&&xe(t.layer))return t.layer.fetchTile(e.lij[0],e.lij[1],e.lij[2],i).then((e=>{if(g(i))return Ge.warnOnce("A call to fetchTile resolved even though the request was aborted. fetchTile should not resolve if options.signal.aborted is true."),void n(y());a(e)}),n);let l=t.getTileUrl(e.lij[0],e.lij[1],e.lij[2]);N(t.layer)&&t.layer.refreshTimestamp&&(l+=`${l.includes("?")?"&":"?"}_ts=${t.layer.refreshTimestamp}`);const o=t.hasMixedImageFormats?"image+type":"image";return this._mapDataRequester.request(l,o,i).then(a,n)}_mapTileDataArrived(e,t,i){const r=this._layerIndexByUid[ae.MAP].get(t.uid);null!=r?e.dataArrived(r,ae.MAP,i):(Pe(i),Ge.warn("TerrainSurface: received data from unknown layer"))}_dataMissing(e,t,i,r){const s=this._layerIndexByUid[t].get(i.uid);null!=s?e.dataMissing(s,t,r):Ge.warn("TerrainSurface: received data from unknown layer")}updateTileOverlayParams(e){this.rootTiles&&this.overlayManager&&(this._allTiles.forAll((e=>{e.renderData&&this.overlayManager.setTileParameters(e)})),this._renderer.setNeedsRender(e))}get performanceInfo(){const e=this._performanceInfo;return e.numNodes=this._allTiles.length,e.numLeaves=e.numVisible=e.numRendered=e.numLoadedPerLevel.length=e.numRenderedPerLevel.length=0,this._allTiles.forAll((t=>{t.isLeaf&&e.numLeaves++;const i=t.level;t.renderData&&(e.numLoadedPerLevel[i]=(e.numLoadedPerLevel[i]||0)+1),t.visible&&(e.numVisible++,t.rendered&&(e.numRenderedPerLevel[i]=(e.numRenderedPerLevel[i]||0)+1,e.numRendered++))})),e}getUsedMemory(){return this.tilingScheme?(this._usedMemory===Ke&&(this._usedMemory=0,this._allTiles.forAll((e=>this._usedMemory+=e.usedMemory))),this._usedMemory):0}getUsedMemoryForLayerView(e){let t=0;const i=this._layerClassFromLayerView(e),r=this._layerIndexByUid[i].get(e.uid);return this._allTiles.forAll((e=>t+=e.getUsedMemoryForLayer(i,r))),t}getTile(e){if(u(e)||u(this.rootTiles))return null;const t=e.split("/").map((e=>+e));if(0===t[0])return this.rootTiles.find((e=>e.lij[1]===t[1]&&e.lij[2]===t[2]));const i=2**t[0],r=Math.floor(t[1]/i),s=Math.floor(t[2]/i);let a;if(this.rootTiles.some((e=>e.lij[1]===r&&e.lij[2]===s&&(a=e,!0))),a){let e=1<<t[0]-1;for(;a.lij[0]<t[0];){let i=t[1]&e?2:0;if((t[2]&e)>0&&i++,!a.children[i])return null;a=a.children[i],e>>=1}return Te(a.lij[0]===t[0]&&a.lij[1]===t[1]&&a.lij[2]===t[2],"not the right tile?"),a}return null}get test(){const e=this;return{renderer:e._renderer,lercDecoder:e._lercDecoder,forceReload:()=>{p(e.rootTiles)&&(e._mergeTile(e.rootTiles[0]),e._viewChangeUpdate())},getTiles:()=>e._allTiles.toArray(),getRenderedTiles(){tt.clear(),e._allTiles.forAll((e=>{e.visible&&e.rendered&&tt.push(e)}));const t=tt.toArray();return Ve(e.renderOrder,t),t},lockTilingScheme(t,i){e._extentHelper.defaultTiledLayersExtent=i,e.tilingSchemeLogic.test.lockTilingScheme(t)}}}};e([S()],Qe.prototype,"_renderer",void 0),e([S()],Qe.prototype,"_hasPendingUpdates",void 0),e([S()],Qe.prototype,"_asyncWorkItems",void 0),e([S()],Qe.prototype,"_allTilesDirty",void 0),e([S()],Qe.prototype,"_allTilesSorted",void 0),e([S()],Qe.prototype,"_viewChanged",void 0),e([S({readOnly:!0})],Qe.prototype,"_watchUpdatingTracking",void 0),e([S()],Qe.prototype,"_frameTask",void 0),e([S({readOnly:!0})],Qe.prototype,"snapLevel",null),e([S({readOnly:!0})],Qe.prototype,"lodSnapping",null),e([S({constructOnly:!0})],Qe.prototype,"view",void 0),e([S()],Qe.prototype,"_userClippingExtent",null),e([S()],Qe.prototype,"_rootTilesExtent",void 0),e([S({readOnly:!0})],Qe.prototype,"extent",null),e([S({readOnly:!0})],Qe.prototype,"groundExtent",null),e([S({readOnly:!0})],Qe.prototype,"_tilingSchemeExtent",null),e([S({readOnly:!0})],Qe.prototype,"updating",null),e([S(J)],Qe.prototype,"updatingProgress",void 0),e([S({readOnly:!0})],Qe.prototype,"updatingProgressValue",null),e([S()],Qe.prototype,"_maxNumUpdating",void 0),e([S({aliasOf:"view.map.ground.opacity"})],Qe.prototype,"baseOpacity",void 0),e([S({readOnly:!0})],Qe.prototype,"overlayManager",void 0),e([S({readOnly:!0})],Qe.prototype,"viewingMode",null),e([S()],Qe.prototype,"maxTextureScale",void 0),e([S({readOnly:!0})],Qe.prototype,"ready",null),e([S({value:he.FRONT_TO_BACK})],Qe.prototype,"renderOrder",null),e([S({readOnly:!0})],Qe.prototype,"rootTiles",void 0),e([S({readOnly:!0})],Qe.prototype,"spatialReference",null),e([S()],Qe.prototype,"backgroundImage",void 0),e([S({type:t,aliasOf:"view.map.ground.surfaceColor"})],Qe.prototype,"backgroundColor",void 0),e([S()],Qe.prototype,"_background",null),e([S({value:!1})],Qe.prototype,"slicePlaneEnabled",null),e([S({readOnly:!0})],Qe.prototype,"tilingScheme",void 0),e([S({readOnly:!0,aliasOf:"tilingSchemeLogic.tilingSchemeLocked"})],Qe.prototype,"tilingSchemeLocked",void 0),e([S({readOnly:!0,aliasOf:"tilingSchemeLogic.tilingSchemeDone"})],Qe.prototype,"tilingSchemeDone",void 0),e([S({readOnly:!0})],Qe.prototype,"tilingSchemeLogic",void 0),e([S({value:!0})],Qe.prototype,"velvetOverground",null),e([w("_renderer.wireframe")],Qe.prototype,"wireframe",void 0),e([S({value:!1})],Qe.prototype,"suspended",null),e([S({readOnly:!0,aliasOf:"view.qualitySettings.tiledSurface.textureFadeDuration"})],Qe.prototype,"textureFadeDuration",void 0),e([S()],Qe.prototype,"_layerViewsDirty",void 0),e([w("_renderer.renderPatchBorders")],Qe.prototype,"renderPatchBorders",void 0),e([w("_renderer.renderingDisabled")],Qe.prototype,"renderingDisabled",void 0),Qe=e([L("esri.views.3d.terrain.TerrainSurface")],Qe);const Xe=Qe;function ze(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}function Ye(e){return!e.isLeaf&&(e.children[0].shouldLoad||e.children[1].shouldLoad||e.children[2].shouldLoad||e.children[3].shouldLoad||Ye(e.children[0])||Ye(e.children[1])||Ye(e.children[2])||Ye(e.children[3]))}function $e(e){return e.isLeaf&&e.parent&&e.parent.shouldLoad}const Ke=-1,Je=C(),Ze=M(),et=[0,0,0],tt=new _,it={spatialReference:null,tile:null,extent:null,context:"ground"},rt={spatialReference:null,extent:null,scale:0};export{Xe as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import{clamp as e}from"../../../core/mathUtils.js";import{isSome as t,abortMaybe as i,isNone as s}from"../../../core/maybe.js";import n from"../../../core/ObjectPool.js";import{c as r,s as a}from"../../../chunks/vec2.js";import{a as o}from"../../../chunks/vec2f64.js";import{f as h,p as l,d,a as u,b as p,l as c}from"../../../chunks/vec3.js";import{c as g,u as f}from"../../../chunks/vec3f64.js";import{getReferenceEllipsoid as m}from"../../../geometry/projectionEllipsoid.js";import{create as _,equals as y}from"../../../geometry/support/aaBoundingRect.js";import{c as A}from"../../../chunks/sphere.js";import{VectorTile as v}from"../../2d/engine/vectorTiles/VectorTile.js";import{ImageWithType as M}from"../support/StreamDataLoader.js";import{ElevationBounds as T}from"./ElevationBounds.js";import{ElevationTileAgent as I}from"./ElevationTileAgent.js";import{LODSnapping as L,TextureUpdate as E}from"./interfaces.js";import{LayerClass as D,LayerClasses as U}from"./LayerClass.js";import{MapTileAgent as j}from"./MapTileAgent.js";import{RasterTile as B}from"./RasterTile.js";import{MAX_PATCH_TESSELATION as O,getElevationDesiredResolutionLevel as C}from"./TerrainConst.js";import{weakAssert as N,getLayerWithExtentRange as S}from"./terrainUtils.js";import{TILE_AGENT_DONE as x}from"./TileAgent.js";import{TilePerLayerInfo as P}from"./TilePerLayerInfo.js";import R from"./TileTexture.js";import{TileUpdate as b}from"./TileUpdate.js";import{fallsWithinLayer as V}from"./tileUtils.js";import{getGpuMemoryUsage as q}from"../../webgl/Util.js";const w=g(),G=g(),F=g(),W=.1;class k{constructor(){this.fovX=0,this.fovY=0,this.relativeWidthLimit=0,this.relativeHeightLimit=0,this.maxLod=0,this.angledSplitBias=0,this.aboveGround=!0}}class X{constructor(){this.lij=[0,0,0],this._children=[null,null,null,null],this._pendingUpdates=0,this._dirty=!0,this._previouslyRendered=!1,this.extent=_(),this._elevationBounds=o(),this.layerInfo=[[],[]],this.extentInRadians=_(),this.centerAtSeaLevel=g(),this._center=[g(),A(),g()],this.up=f(),this._isWithinClippingArea=!0,this._intersectsClippingArea=!0,this._maxTesselation=0,this._usedMemory=J,this._mapTileMemory=0,this._mapDataRefCount=0,this._screenDepth=0,this.renderOrder=0,this._edgeLen=0,this._edgeLen2=0,this._curvatureHeight=0}static prune(){Y.prune(0),$.prune(0),P.prune()}get usedMemory(){return this._usedMemory===J&&this._updateMemoryUsed(),this._usedMemory+(this.isCached?0:this.mapTileMemory)}get cachedMemory(){return this.isCached?this.mapTileMemory:0}get mapTileMemory(){this._usedMemory===J&&this._updateMemoryUsed();let e=this._mapTileMemory;for(const{data:t}of this.layerInfo[D.MAP])t instanceof v&&(e+=t.memoryUsage);return e}get isCached(){return!this.shouldLoad&&this._mapDataRefCount<=0}get maxTesselation(){return this._maxTesselation}get isWithinClippingArea(){return this._isWithinClippingArea}get intersectsClippingArea(){return this._intersectsClippingArea}get clippingArea(){return this._clippingArea}get parent(){return this._parent}get children(){return this._children}get surface(){return this._surface}get elevationBounds(){return this._elevationBounds}get level(){return this.lij[0]}get key(){return`${this.lij[0]}/${this.lij[1]}/${this.lij[2]}`}get edgeLen(){return this._edgeLen}get radius(){return this._center[K.MIDDLE][3]}get screenDepth(){return this._screenDepth}get visible(){return this._dirty&&this.updateVisibilityNow(),this._visible}updateVisibilityNow(){this._dirty=!1;const e=this._intersectsClippingArea&&this._isVisible(this.surface.frustum);return e!==this._visible&&(this._visible=e,this._surface.emit("tiles-visibility-changed"),this._surface.renderer.setNeedsRender(),this.updateAgentSuspension()),this._visible}get loadable(){return this.visible||this._surface.view.state.fixedContentCamera}get rendered(){const e=!!this.renderData;return e!==this._previouslyRendered&&(this._surface.emit("tiles-visibility-changed"),this._previouslyRendered=e,this._surface.renderer.setNeedsRender()),e}get shouldLoad(){if(!this.loadable)return!1;if(this._surface.lodSnapping===L.ON){const e=this.level-this._surface.snapLevel;if(0===e)return!0;if(1===e)return!1}return this.isLeaf}init(e,t,i){this.lij[0]=e[0],this.lij[1]=e[1],this.lij[2]=e[2],this.ellipsoid=m(i.tilingScheme.spatialReference),i.tilingScheme.getExtent(e[0],e[1],e[2],this.extent),i.tilingScheme.convertExtentToRadians(this.extent,this.extentInRadians),this._isWithinClippingArea=!0,this._intersectsClippingArea=!0,this._clippingArea=null,this._mapDataRefCount=0,i.upsampleMapCache.pop(this.key),this._edgeLen=0,this._edgeLen2=0,this._center[K.MIDDLE][3]=0,this.vlevel=e?e[0]:0,t&&t.elevationBounds?r(this._elevationBounds,t.elevationBounds):a(this._elevationBounds,0,0),this._pendingUpdates=0,this.renderData=null,this._screenDepth=0,this._visible=!1,this._previouslyRendered=!1,this._parent=t,this.unsetChildren(),this._surface=i,this.updateVisibility();for(const s of U){const e=i.numLayers(s),t=this.layerInfo[s];for(const i of t)i.release();t.length=e;for(let i=0;i<e;i++)t[i]=P.acquire(this._surface.upsampleInfoPool),s===D.ELEVATION&&this.findElevationBoundsForLayer(i,-1)}this.computeElevationBounds(),this._maxTesselation=Math.min(i.tilingScheme.pixelSize,O)}release(){N(!this.renderData,"tile.renderData was not unloaded"),this._surface.upsampleMapCache.pop(this.key);for(const e of U){for(const t of this.layerInfo[e])t.release();this.layerInfo[e].length=0}this._parent=null,this._surface=null,this._usedMemory=J}refMapData(){++this._mapDataRefCount,this.isCached||this._surface.upsampleMapCache.pop(this.key)}unrefMapData(){if(--this._mapDataRefCount,this.isCached){const e=this.cachedMemory;e>0&&(this._surface.upsampleMapCache.put(this.key,this,e),this.setMemoryDirty())}}setMemoryDirty(){this._usedMemory=J}get cpuImageMemorySize(){const e=4,t=this._surface.tilingScheme.pixelSize;return t*t*e}_updateMemoryUsed(){this._usedMemory=0,this._mapTileMemory=0;const e=this.cpuImageMemorySize;for(const{data:t}of this.layerInfo[D.MAP])t instanceof R?this._mapTileMemory+=q(t.texture):t instanceof HTMLImageElement||t instanceof M?this._mapTileMemory+=e:t instanceof B&&(this._mapTileMemory+=t.memoryUsage);for(const t of this.layerInfo[D.ELEVATION])this._usedMemory+=t.data?e:0;this.renderData&&(this._usedMemory+=this.renderData.estimatedGeometryMemoryUsage,this._mapTileMemory+=q(this.renderData.textureDescriptor)),this.isCached&&this._surface.upsampleMapCache.updateSize(this.key,this,this.cachedMemory)}getUsedMemoryForLayer(e,t){const i=this.layerInfo[e][t];if(!i||!i.data)return 0;if(e!==D.MAP||this.isCached){if(e===D.ELEVATION)return this.cpuImageMemorySize}else{const e=i.data;if(e instanceof R)return q(e.texture);if(e instanceof HTMLImageElement||e instanceof M)return this.cpuImageMemorySize;if(e instanceof v||e instanceof B)return e.memoryUsage}return 0}updateScreenDepth(e){const t=this._center[K.MIDDLE],i=e,s=t[0],n=t[1],r=t[2],a=i[2]*s+i[6]*n+i[10]*r+i[14];this._screenDepth=a<0?0:a/(i[3]*s+i[7]*n+i[11]*r+i[15])}shouldSplit(e,i,s){if(t(e.frustum)&&(!this._intersectsClippingArea||!this._isVisible(e.frustum)))return b.NONE;const n=this.level;h(w,this._center[K.MIDDLE],i);let r=l(w),a=K.MIDDLE;h(G,this._center[K.TOP],i);const o=l(G);o<r&&(r=o,a=K.TOP),h(G,this._center[K.BOTTOM],i);const g=l(G);if(g<r&&(r=g,a=K.BOTTOM),this._edgeLen2>r&&n<e.maxLod)return b.SPLIT;const f=Math.sqrt(r),m=e.fovX*f*2,_=this._edgeLen/m,y=()=>{const t=n+Math.ceil(-Math.log2(e.relativeWidthLimit/_));return t!==this.vlevel?(this.vlevel=t,b.VSPLITMERGE):b.NONE_HIT_MAXLOD};if(s===L.ON){if(1===this._surface.snapLevel-n)return n>=e.maxLod?y():b.SPLIT}const A=d(this.up,w),v=this._elevationBounds[1]-this._elevationBounds[0],M=v/this.edgeLen;if(e.aboveGround&&A>0&&M<.001){if(A/f-Math.sin(this._curvatureHeight/(this.edgeLen*Math.SQRT1_2)*Math.PI)-M>0)return b.NONE}if(_<e.relativeWidthLimit)return this.vlevel!==this.level?(this.vlevel=this.level,b.VSPLITMERGE):b.NONE;if(n>=e.maxLod)return y();if(n>6){h(G,this._center[a],i),u(F,this.up,A),h(F,F,G);const t=l(F);if(t>this.radius*this.radius){u(F,F,this.radius/Math.sqrt(t)),p(F,F,this._center[a]),h(F,i,F);const s=Math.min(1,(Math.abs(d(F,this.up))+.5*v+this._curvatureHeight)/c(F)),n=W/e.angledSplitBias,r=e.fovY*f*2;if(s*(this._edgeLen/r)<n*e.relativeHeightLimit)return b.NONE}}return b.SPLIT}setChildren(e,t,i,s){N(!!(e&&t&&i&&s),"Null child passed"),this._children[0]=e,this._children[1]=t,this._children[2]=i,this._children[3]=s}unsetChildren(){this._children[0]=null,this._children[1]=null,this._children[2]=null,this._children[3]=null}load(e){this.refMapData();for(const t of U)this._createOrUpdateAgents(0,t);e.loadTile(this)}unload(e){e.unloadTile(this);for(const t of U){const e=this.layerInfo[t];for(const t of e)t.loadingAgent&&t.loadingAgent!==x&&(z(t.loadingAgent),t.loadingAgent=null),t.pendingUpdates=0}this.resetPendingUpdate(b.GEOMETRY),this.resetPendingUpdate(b.TEXTURE_NOFADING),this.resetPendingUpdate(b.TEXTURE_FADING),this.unrefMapData()}unloadMapData(){const e=this.layerInfo[D.MAP];for(const t of e)t.loadingAgent&&t.loadingAgent!==x&&(z(t.loadingAgent),t.loadingAgent=null),t.pendingUpdates=0;this.renderData&&this.renderData.releaseTexture(),this.setMemoryDirty()}updateClippingStatus(e){if(y(e,this._clippingArea))return!1;const i=this._intersectsClippingArea,s=this._isWithinClippingArea;t(e)?(this._intersectsClippingArea=this.intersectsExtent(e),this._isWithinClippingArea=this._isWithinExtent(e)):(this._intersectsClippingArea=!0,this._isWithinClippingArea=!0),this._clippingArea=e,this.updateVisibility();const n=s&&this._isWithinClippingArea,r=!(s||i||this._isWithinClippingArea||this._intersectsClippingArea);return!this.renderData||n||r||this.setPendingUpdate(b.GEOMETRY),!0}updateVisibility(){this._dirty=!0,this._surface.setTileTreeDirty()}getLayerInfo(e,t){return this.layerInfo[t][e]}hasLayerData(e,t){const i=this.layerInfo[t][e];return!(!i||!i.data||i.dataInvalidated)}get updating(){if(this.hasPendingUpdates)return!0;for(const e of U){const t=this.layerInfo[e];for(const e of t)if(e.loadingAgent&&e.loadingAgent!==x&&e.loadingAgent.updating)return!0}return!1}_isSuspended(e){return!!this.hasPendingUpdate(b.SPLIT)||e!==D.ELEVATION&&!this.loadable}get hasPendingUpdates(){return 0!==this._pendingUpdates}hasPendingUpdate(e){return(this._pendingUpdates&e)===e}setPendingUpdate(e){this._pendingUpdates|=e,e===b.SPLIT||e===b.MERGE?this._surface.setTileTreeDirty():this._surface.requestUpdate()}resetPendingUpdate(e){return!!this.hasPendingUpdate(e)&&(this._pendingUpdates&=~e,!0)}requestLayerData(e,t,s){const n=this.layerInfo[t][e];if(n.waitingAgents.has(s))return console.warn("agent already requested this piece of map data (tile %s, agent tile %s, layer: %d/%d)",this.lij.toString(),s.tile.lij.toString(),t,e),!0;if(n.waitingAgents.push(s),n.data&&!n.dataInvalidated)return console.warn("agent requested existing data (tile %s, agent tile %s, layer: %d/%d)",this.lij.toString(),s.tile.lij.toString(),t,e),s.dataArrived(this),!0;if(n.requestPromise)return!0;i(n.requestAbort),n.requestAbort=new AbortController;const r=this._surface.requestTileData(this,e,t,n.requestAbort);if(!r)return n.requestAbort=null,!1;const a=()=>{n.requestPromise===r&&(n.requestPromise=null,n.requestAbort=null)};return n.requestPromise=r,r.then(a,a),!0}get isLeaf(){return null==this._children[0]}hasLij(e){return this.lij[0]===e[0]&&this.lij[1]===e[1]&&this.lij[2]===e[2]}findByLij(e){if(this.hasLij(e))return this;if(this.isLeaf)return null;const t=this._children[0].findByLij(e)||this._children[1].findByLij(e)||this._children[2].findByLij(e)||this._children[3].findByLij(e);return t||null}distanceToSquared(e){return l(h(F,this._center[K.MIDDLE],e))}containsPoint(e){const t=this.extent;return e[0]>=t[0]&&e[1]>=t[1]&&e[0]<=t[2]&&e[1]<=t[3]}unrequestLayerData(e,t,i){const s=this.layerInfo[t][e],n=s.waitingAgents,r=null!=n.removeUnordered(i);N(r,"agent has not requested this piece of map data"),n.length<1&&(s.abortRequest(),this._updateMemoryUsed())}dataArrived(e,t,i){const s=this.layerInfo[t][e];s.data=i,s.dataInvalidated=!1,s.waitingAgents.forAll((e=>e.dataArrived(this))),s.waitingAgents.clear(),this._updateMemoryUsed()}dataMissing(e,t,i){i.notInTilemap||console.error(`Tile ${this.lij.toString()} layer ${t}/${e} error ${i}`);const s=this.layerInfo[t][e];s.dataMissing=!0,s.waitingAgents.forAll((e=>e.dataMissing())),s.waitingAgents.clear(),this._updateMemoryUsed()}updateRenderData(e,t){switch(e){case D.MAP:return this._updateTexture(t);case D.ELEVATION:return this._updateGeometry()}}_updateTexture(e){this.renderData&&(this.resetPendingUpdate(e===E.FADING?b.TEXTURE_NOFADING:b.TEXTURE_FADING),this.setPendingUpdate(e===E.FADING?b.TEXTURE_FADING:b.TEXTURE_NOFADING))}_updateGeometry(){this.setPendingUpdate(b.GEOMETRY);for(const e of this.layerInfo[D.ELEVATION])e.pendingUpdates|=b.GEOMETRY}invalidateLayerData(e,t){this.layerInfo[t][e].invalidateSourceData(),this.restartAgents(t)}computeElevationBounds(){a(this._elevationBounds,Number.MAX_VALUE,-Number.MAX_VALUE);const e=this.layerInfo[D.ELEVATION];let i=!0;for(const s of e)t(s.elevationBounds)&&(this._elevationBounds[0]=Math.min(this._elevationBounds[0],s.elevationBounds.min),this._elevationBounds[1]=Math.max(this._elevationBounds[1],s.elevationBounds.max),s.elevationBounds.hasNoDataValues||(i=!1));i&&(this._elevationBounds[0]=Math.min(this._elevationBounds[0],0),this._elevationBounds[1]=Math.max(this._elevationBounds[1],0)),this.updateRadiusAndCenter(),this._surface.setTileTreeDirty()}_updateCenter(){const e=.5*(this._elevationBounds[0]+this._elevationBounds[1]);u(F,this.up,e),p(this._center[K.MIDDLE],this.centerAtSeaLevel,F),u(F,this.up,this._elevationBounds[0]),p(this._center[K.TOP],this.centerAtSeaLevel,F),u(F,this.up,this._elevationBounds[1]),p(this._center[K.BOTTOM],this.centerAtSeaLevel,F)}findElevationBoundsForLayer(e,i){const n=this.layerInfo[D.ELEVATION][e];if(t(n.elevationBounds)&&n.elevationBounds.level>=i)return;const r=this._surface.layerViewByIndex(e,D.ELEVATION),a=S(r);if(!V(this,a,!1))return;const o=Q;let h=!1;if(n.data){const e=n.data;o.min=e.bounds[0],o.max=e.bounds[1],o.hasNoDataValues=e.hasNoDataValues,o.level=this.lij[0],h=!0}else{let t,i,s=0;for(let n=this._parent;n&&(!i||s<C(this.level))&&(s=this.vlevel-n.level,t=i||t,i=n.layerInfo[D.ELEVATION][e].data,!(!i&&t&&s>=C(this.level)));n=n.parent);i=i||t,i&&(i.computeMinMaxValue(this.lij[0],this.lij[1],this.lij[2],o),o.min!==1/0&&(o.level=i.level,h=!0))}h&&(s(n.elevationBounds)&&(n.elevationBounds=new T),n.elevationBounds.copyFrom(o))}modifyLayers(e,t,i){const s=this.layerInfo[i];for(const a of s)a.loadingAgent&&a.loadingAgent!==x&&(z(a.loadingAgent),a.loadingAgent=null),a.waitingAgents.clear();for(let a=0;a<s.length;++a)void 0===e[a]&&s[a].release();const n=new Array(...s),r=t.length;s.length=r;for(let a=0;a<r;a++){const e=t[a];s[a]=e>-1?n[e]:P.acquire(this._surface.upsampleInfoPool)}this._updateMemoryUsed()}restartAgents(e){this.renderData&&(this._createOrUpdateAgents(0,e),this.updateRenderData(e,E.FADING))}updateAgents(e){if(this.renderData){const t=this.layerInfo[e];for(const e of t)e.loadingAgent===x&&(e.loadingAgent=null);this._createOrUpdateAgents(0,e)}}updateAgentSuspension(){for(const e of U){const t=this._isSuspended(e);for(const i of this.layerInfo[e])i.loadingAgent&&i.loadingAgent!==x&&(i.loadingAgent.setSuspension(t),i.loadingAgent===x&&this.updateRenderData(e,E.FADING))}}removeLayerAgent(e,t){const i=this.layerInfo[t][e];i.loadingAgent&&i.loadingAgent!==x&&i.loadingAgent.dispose(),i.loadingAgent=null}agentDone(e,t){const i=this.layerInfo[t][e];i.loadingAgent=x,i.data||i.upsampleInfo||this._createOrUpdateAgents(e+1,t)}_createOrUpdateAgents(e,t){const i=this._isSuspended(t),s=this.layerInfo[t];for(let n=e;n<s.length;++n){const e=s[n];let r=!1;const a=this._surface.layerViewByIndex(n,t),o=S(a);if(e.loadingAgent?V(this,o,!1)?(e.loadingAgent!==x&&e.loadingAgent.setSuspension(i),e.loadingAgent!==x&&(r=e.loadingAgent.update())):e.dispose():V(this,o,!1)&&(e.loadingAgent=H(this,n,t,i),r=e.loadingAgent.startLoading(),r?e.loadingAgent===x&&this.setPendingUpdate(b.GEOMETRY):(z(e.loadingAgent),e.loadingAgent=x)),e.loadingAgent===x&&this.updateRenderData(t,E.FADING),r&&a.isOpaque)return}}_isWithinExtent(e){const t=this.extent;return t[0]>=e[0]&&e[2]>=t[2]&&t[1]>=e[1]&&e[3]>=t[3]}intersectsExtent(e){const t=this.extent;return t[2]>=e[0]&&e[2]>=t[0]&&t[3]>=e[1]&&e[3]>=t[1]}getElevationBasedVerticesPerRow(t){const i=this.vlevel-this.level,s=Math.max(this.level-t,C(this.level)-i);return e(1+(this.maxTesselation>>s),2,this.maxTesselation+1)}get test(){return{cachedMemory:this.cachedMemory}}}function H(e,t,i,s){const n=i===D.ELEVATION?$.acquire():Y.acquire();return n.init(e,t,i,s),n}function z(e){e.dispose(),e instanceof I?$.release(e):e instanceof j&&Y.release(e)}const Y=new n(j),$=new n(I),Q=new T,J=-1;var K;!function(e){e[e.TOP=0]="TOP",e[e.MIDDLE=1]="MIDDLE",e[e.BOTTOM=2]="BOTTOM"}(K||(K={}));export{K as CenterPosition,k as SplitLimits,X as Tile};
5
+ import{clamp as e}from"../../../core/mathUtils.js";import{isSome as t,abortMaybe as i,isNone as s}from"../../../core/maybe.js";import n from"../../../core/ObjectPool.js";import{c as r,s as a}from"../../../chunks/vec2.js";import{a as o}from"../../../chunks/vec2f64.js";import{f as h,p as l,d,a as u,b as c,l as p}from"../../../chunks/vec3.js";import{c as g,u as f}from"../../../chunks/vec3f64.js";import{getReferenceEllipsoid as m}from"../../../geometry/projectionEllipsoid.js";import{create as _,equals as y}from"../../../geometry/support/aaBoundingRect.js";import{c as A}from"../../../chunks/sphere.js";import{VectorTile as v}from"../../2d/engine/vectorTiles/VectorTile.js";import{ImageWithType as M}from"../support/StreamDataLoader.js";import{ElevationBounds as T}from"./ElevationBounds.js";import{ElevationTileAgent as I}from"./ElevationTileAgent.js";import{LODSnapping as L,TextureUpdate as E}from"./interfaces.js";import{LayerClass as D,LayerClasses as U}from"./LayerClass.js";import{MapTileAgent as j}from"./MapTileAgent.js";import{RasterTile as B}from"./RasterTile.js";import{MAX_PATCH_TESSELATION as O,getElevationDesiredResolutionLevel as C}from"./TerrainConst.js";import{weakAssert as N,getLayerWithExtentRange as S}from"./terrainUtils.js";import{TILE_AGENT_DONE as x}from"./TileAgent.js";import{TilePerLayerInfo as P}from"./TilePerLayerInfo.js";import R from"./TileTexture.js";import{TileUpdate as b}from"./TileUpdate.js";import{fallsWithinLayer as V}from"./tileUtils.js";import{getGpuMemoryUsage as q}from"../../webgl/Util.js";const G=g(),w=g(),F=g(),W=.1;class k{constructor(){this.fovX=0,this.fovY=0,this.relativeWidthLimit=0,this.relativeHeightLimit=0,this.maxLod=0,this.angledSplitBias=0,this.aboveGround=!0}}class X{constructor(){this.lij=[0,0,0],this._children=[null,null,null,null],this._pendingUpdates=0,this._dirty=!0,this._previouslyRendered=!1,this.extent=_(),this._elevationBounds=o(),this.layerInfo=[[],[]],this.extentInRadians=_(),this.centerAtSeaLevel=g(),this._center=[g(),A(),g()],this.up=f(),this._isWithinClippingArea=!0,this._intersectsClippingArea=!0,this._maxTesselation=0,this._usedMemory=J,this._mapTileMemory=0,this._mapDataRefCount=0,this._screenDepth=0,this.renderOrder=0,this._edgeLen=0,this._edgeLen2=0,this._curvatureHeight=0}static prune(){Y.prune(0),$.prune(0),P.prune()}get usedMemory(){return this._usedMemory===J&&this._updateMemoryUsed(),this._usedMemory+(this.isCached?0:this.mapTileMemory)}get cachedMemory(){return this.isCached?this.mapTileMemory:0}get mapTileMemory(){this._usedMemory===J&&this._updateMemoryUsed();let e=this._mapTileMemory;for(const{data:t}of this.layerInfo[D.MAP])t instanceof v&&(e+=t.memoryUsage);return e}get isCached(){return!this.shouldLoad&&this._mapDataRefCount<=0}get maxTesselation(){return this._maxTesselation}get isWithinClippingArea(){return this._isWithinClippingArea}get intersectsClippingArea(){return this._intersectsClippingArea}get clippingArea(){return this._clippingArea}get parent(){return this._parent}get children(){return this._children}get surface(){return this._surface}get elevationBounds(){return this._elevationBounds}get level(){return this.lij[0]}get key(){return`${this.lij[0]}/${this.lij[1]}/${this.lij[2]}`}get edgeLen(){return this._edgeLen}get radius(){return this._center[K.MIDDLE][3]}get screenDepth(){return this._screenDepth}get visible(){return this._dirty&&this.computeVisibility(),this._visible}computeVisibility(){this._dirty=!1;const e=this._intersectsClippingArea&&this._isVisible(this.surface.frustum);return e!==this._visible&&(this._visible=e,this._surface.emit("tiles-visibility-changed"),this._surface.renderer.setNeedsRender(),this.updateAgentSuspension()),this._visible}get loadable(){return this.visible||this._surface.view.state.fixedContentCamera}get rendered(){const e=!!this.renderData;return e!==this._previouslyRendered&&(this._surface.emit("tiles-visibility-changed"),this._previouslyRendered=e,this._surface.renderer.setNeedsRender()),e}get shouldLoad(){if(!this.loadable)return!1;if(this._surface.lodSnapping===L.ON){const e=this.level-this._surface.snapLevel;if(0===e)return!0;if(1===e)return!1}return this.isLeaf}init(e,t,i){this.lij[0]=e[0],this.lij[1]=e[1],this.lij[2]=e[2],this.ellipsoid=m(i.tilingScheme.spatialReference),i.tilingScheme.getExtent(e[0],e[1],e[2],this.extent),i.tilingScheme.convertExtentToRadians(this.extent,this.extentInRadians),this._isWithinClippingArea=!0,this._intersectsClippingArea=!0,this._clippingArea=null,this._mapDataRefCount=0,i.upsampleMapCache.pop(this.key),this._edgeLen=0,this._edgeLen2=0,this._center[K.MIDDLE][3]=0,this.vlevel=e?e[0]:0,t&&t.elevationBounds?r(this._elevationBounds,t.elevationBounds):a(this._elevationBounds,0,0),this._pendingUpdates=0,this.renderData=null,this._screenDepth=0,this._visible=!1,this._previouslyRendered=!1,this._parent=t,this.unsetChildren(),this._surface=i,this.updateVisibility();for(const s of U){const e=i.numLayers(s),t=this.layerInfo[s];for(const i of t)i.release();t.length=e;for(let i=0;i<e;i++)t[i]=P.acquire(this._surface.upsampleInfoPool),s===D.ELEVATION&&this.findElevationBoundsForLayer(i,-1)}this.computeElevationBounds(),this._maxTesselation=Math.min(i.tilingScheme.pixelSize,O)}release(){N(!this.renderData,"tile.renderData was not unloaded"),this._surface.upsampleMapCache.pop(this.key);for(const e of U){for(const t of this.layerInfo[e])t.release();this.layerInfo[e].length=0}this._parent=null,this._surface=null,this._usedMemory=J}refMapData(){++this._mapDataRefCount,this.isCached||this._surface.upsampleMapCache.pop(this.key)}unrefMapData(){if(--this._mapDataRefCount,this.isCached){const e=this.cachedMemory;e>0&&(this._surface.upsampleMapCache.put(this.key,this,e),this.setMemoryDirty())}}setMemoryDirty(){this._usedMemory=J}get cpuImageMemorySize(){const e=4,t=this._surface.tilingScheme.pixelSize;return t*t*e}_updateMemoryUsed(){this._usedMemory=0,this._mapTileMemory=0;const e=this.cpuImageMemorySize;for(const{data:t}of this.layerInfo[D.MAP])t instanceof R?this._mapTileMemory+=q(t.texture):t instanceof HTMLImageElement||t instanceof M?this._mapTileMemory+=e:t instanceof B&&(this._mapTileMemory+=t.memoryUsage);for(const t of this.layerInfo[D.ELEVATION])this._usedMemory+=t.data?e:0;this.renderData&&(this._usedMemory+=this.renderData.estimatedGeometryMemoryUsage,this._mapTileMemory+=q(this.renderData.textureDescriptor)),this.isCached&&this._surface.upsampleMapCache.updateSize(this.key,this,this.cachedMemory)}getUsedMemoryForLayer(e,t){const i=this.layerInfo[e][t];if(!i||!i.data)return 0;if(e!==D.MAP||this.isCached){if(e===D.ELEVATION)return this.cpuImageMemorySize}else{const e=i.data;if(e instanceof R)return q(e.texture);if(e instanceof HTMLImageElement||e instanceof M)return this.cpuImageMemorySize;if(e instanceof v||e instanceof B)return e.memoryUsage}return 0}updateScreenDepth(e){const t=this._center[K.MIDDLE],i=e,s=t[0],n=t[1],r=t[2],a=i[2]*s+i[6]*n+i[10]*r+i[14];this._screenDepth=a<0?0:a/(i[3]*s+i[7]*n+i[11]*r+i[15])}shouldSplit(e,i,s){if(t(e.frustum)&&(!this._intersectsClippingArea||!this._isVisible(e.frustum)))return b.NONE;const n=this.level;h(G,this._center[K.MIDDLE],i);let r=l(G),a=K.MIDDLE;h(w,this._center[K.TOP],i);const o=l(w);o<r&&(r=o,a=K.TOP),h(w,this._center[K.BOTTOM],i);const g=l(w);if(g<r&&(r=g,a=K.BOTTOM),this._edgeLen2>r&&n<e.maxLod)return b.SPLIT;const f=Math.sqrt(r),m=e.fovX*f*2,_=this._edgeLen/m,y=()=>{const t=n+Math.ceil(-Math.log2(e.relativeWidthLimit/_));return t!==this.vlevel?(this.vlevel=t,b.VSPLITMERGE):b.NONE_HIT_MAXLOD};if(s===L.ON){if(1===this._surface.snapLevel-n)return n>=e.maxLod?y():b.SPLIT}const A=d(this.up,G),v=this._elevationBounds[1]-this._elevationBounds[0],M=v/this.edgeLen;if(e.aboveGround&&A>0&&M<.001){if(A/f-Math.sin(this._curvatureHeight/(this.edgeLen*Math.SQRT1_2)*Math.PI)-M>0)return b.NONE}if(_<e.relativeWidthLimit)return this.vlevel!==this.level?(this.vlevel=this.level,b.VSPLITMERGE):b.NONE;if(n>=e.maxLod)return y();if(n>6){h(w,this._center[a],i),u(F,this.up,A),h(F,F,w);const t=l(F);if(t>this.radius*this.radius){u(F,F,this.radius/Math.sqrt(t)),c(F,F,this._center[a]),h(F,i,F);const s=Math.min(1,(Math.abs(d(F,this.up))+.5*v+this._curvatureHeight)/p(F)),n=W/e.angledSplitBias,r=e.fovY*f*2;if(s*(this._edgeLen/r)<n*e.relativeHeightLimit)return b.NONE}}return b.SPLIT}setChildren(e,t,i,s){N(!!(e&&t&&i&&s),"Null child passed"),this._children[0]=e,this._children[1]=t,this._children[2]=i,this._children[3]=s}unsetChildren(){this._children[0]=null,this._children[1]=null,this._children[2]=null,this._children[3]=null}load(e){this.refMapData();for(const t of U)this._createOrUpdateAgents(0,t);e.loadTile(this)}unload(e){e.unloadTile(this);for(const t of U){const e=this.layerInfo[t];for(const t of e)t.loadingAgent&&t.loadingAgent!==x&&(z(t.loadingAgent),t.loadingAgent=null),t.pendingUpdates=0}this.resetPendingUpdate(b.GEOMETRY),this.resetPendingUpdate(b.TEXTURE_NOFADING),this.resetPendingUpdate(b.TEXTURE_FADING),this.unrefMapData()}unloadMapData(){const e=this.layerInfo[D.MAP];for(const t of e)t.loadingAgent&&t.loadingAgent!==x&&(z(t.loadingAgent),t.loadingAgent=null),t.pendingUpdates=0;this.renderData&&this.renderData.releaseTexture(),this.setMemoryDirty()}updateClippingStatus(e){if(y(e,this._clippingArea))return!1;const i=this._intersectsClippingArea,s=this._isWithinClippingArea;t(e)?(this._intersectsClippingArea=this.intersectsExtent(e),this._isWithinClippingArea=this._isWithinExtent(e)):(this._intersectsClippingArea=!0,this._isWithinClippingArea=!0),this._clippingArea=e,this.updateVisibility();const n=s&&this._isWithinClippingArea,r=!(s||i||this._isWithinClippingArea||this._intersectsClippingArea);return!this.renderData||n||r||this.setPendingUpdate(b.GEOMETRY),!0}updateVisibility(){this._dirty=!0,this._surface.setTileTreeDirty()}getLayerInfo(e,t){return this.layerInfo[t][e]}hasLayerData(e,t){const i=this.layerInfo[t][e];return!(!i||!i.data||i.dataInvalidated)}get updating(){if(this.hasPendingUpdates)return!0;for(const e of U){const t=this.layerInfo[e];for(const e of t)if(e.loadingAgent&&e.loadingAgent!==x&&e.loadingAgent.updating)return!0}return!1}_isSuspended(e){return!!this.hasPendingUpdate(b.SPLIT)||e!==D.ELEVATION&&!this.loadable}get hasPendingUpdates(){return 0!==this._pendingUpdates}hasPendingUpdate(e){return(this._pendingUpdates&e)===e}setPendingUpdate(e){this._pendingUpdates|=e,e===b.SPLIT||e===b.MERGE?this._surface.setTileTreeDirty():this._surface.requestUpdate()}resetPendingUpdate(e){return!!this.hasPendingUpdate(e)&&(this._pendingUpdates&=~e,!0)}requestLayerData(e,t,s){const n=this.layerInfo[t][e];if(n.waitingAgents.has(s))return console.warn("agent already requested this piece of map data (tile %s, agent tile %s, layer: %d/%d)",this.lij.toString(),s.tile.lij.toString(),t,e),!0;if(n.waitingAgents.push(s),n.data&&!n.dataInvalidated)return console.warn("agent requested existing data (tile %s, agent tile %s, layer: %d/%d)",this.lij.toString(),s.tile.lij.toString(),t,e),s.dataArrived(this),!0;if(n.requestPromise)return!0;i(n.requestAbort),n.requestAbort=new AbortController;const r=this._surface.requestTileData(this,e,t,n.requestAbort);if(!r)return n.requestAbort=null,!1;const a=()=>{n.requestPromise===r&&(n.requestPromise=null,n.requestAbort=null)};return n.requestPromise=r,r.then(a,a),!0}get isLeaf(){return null==this._children[0]}hasLij(e){return this.lij[0]===e[0]&&this.lij[1]===e[1]&&this.lij[2]===e[2]}findByLij(e){if(this.hasLij(e))return this;if(this.isLeaf)return null;const t=this._children[0].findByLij(e)||this._children[1].findByLij(e)||this._children[2].findByLij(e)||this._children[3].findByLij(e);return t||null}distanceToSquared(e){return l(h(F,this._center[K.MIDDLE],e))}containsPoint(e){const t=this.extent;return e[0]>=t[0]&&e[1]>=t[1]&&e[0]<=t[2]&&e[1]<=t[3]}unrequestLayerData(e,t,i){const s=this.layerInfo[t][e],n=s.waitingAgents,r=null!=n.removeUnordered(i);N(r,"agent has not requested this piece of map data"),n.length<1&&(s.abortRequest(),this._updateMemoryUsed())}dataArrived(e,t,i){const s=this.layerInfo[t][e];s.data=i,s.dataInvalidated=!1,s.waitingAgents.forAll((e=>e.dataArrived(this))),s.waitingAgents.clear(),this._updateMemoryUsed()}dataMissing(e,t,i){i.notInTilemap||console.error(`Tile ${this.lij.toString()} layer ${t}/${e} error ${i}`);const s=this.layerInfo[t][e];s.dataMissing=!0,s.waitingAgents.forAll((e=>e.dataMissing())),s.waitingAgents.clear(),this._updateMemoryUsed()}updateRenderData(e,t){switch(e){case D.MAP:return this._updateTexture(t);case D.ELEVATION:return this._updateGeometry()}}_updateTexture(e){this.renderData&&(this.resetPendingUpdate(e===E.FADING?b.TEXTURE_NOFADING:b.TEXTURE_FADING),this.setPendingUpdate(e===E.FADING?b.TEXTURE_FADING:b.TEXTURE_NOFADING))}_updateGeometry(){this.setPendingUpdate(b.GEOMETRY);for(const e of this.layerInfo[D.ELEVATION])e.pendingUpdates|=b.GEOMETRY}invalidateLayerData(e,t){this.layerInfo[t][e].invalidateSourceData(),this.restartAgents(t)}computeElevationBounds(){a(this._elevationBounds,Number.MAX_VALUE,-Number.MAX_VALUE);const e=this.layerInfo[D.ELEVATION];let i=!0;for(const s of e)t(s.elevationBounds)&&(this._elevationBounds[0]=Math.min(this._elevationBounds[0],s.elevationBounds.min),this._elevationBounds[1]=Math.max(this._elevationBounds[1],s.elevationBounds.max),s.elevationBounds.hasNoDataValues||(i=!1));i&&(this._elevationBounds[0]=Math.min(this._elevationBounds[0],0),this._elevationBounds[1]=Math.max(this._elevationBounds[1],0)),this.updateRadiusAndCenter(),this._surface.setTileTreeDirty()}_updateCenter(){const e=.5*(this._elevationBounds[0]+this._elevationBounds[1]);u(F,this.up,e),c(this._center[K.MIDDLE],this.centerAtSeaLevel,F),u(F,this.up,this._elevationBounds[0]),c(this._center[K.TOP],this.centerAtSeaLevel,F),u(F,this.up,this._elevationBounds[1]),c(this._center[K.BOTTOM],this.centerAtSeaLevel,F)}findElevationBoundsForLayer(e,i){const n=this.layerInfo[D.ELEVATION][e];if(t(n.elevationBounds)&&n.elevationBounds.level>=i)return;const r=this._surface.layerViewByIndex(e,D.ELEVATION),a=S(r);if(!V(this,a,!1))return;const o=Q;let h=!1;if(n.data){const e=n.data;o.min=e.bounds[0],o.max=e.bounds[1],o.hasNoDataValues=e.hasNoDataValues,o.level=this.lij[0],h=!0}else{let t,i,s=0;for(let n=this._parent;n&&(!i||s<C(this.level))&&(s=this.vlevel-n.level,t=i||t,i=n.layerInfo[D.ELEVATION][e].data,!(!i&&t&&s>=C(this.level)));n=n.parent);i=i||t,i&&(i.computeMinMaxValue(this.lij[0],this.lij[1],this.lij[2],o),o.min!==1/0&&(o.level=i.level,h=!0))}h&&(s(n.elevationBounds)&&(n.elevationBounds=new T),n.elevationBounds.copyFrom(o))}modifyLayers(e,t,i){const s=this.layerInfo[i];for(const a of s)a.loadingAgent&&a.loadingAgent!==x&&(z(a.loadingAgent),a.loadingAgent=null),a.waitingAgents.clear();for(let a=0;a<s.length;++a)void 0===e[a]&&s[a].release();const n=new Array(...s),r=t.length;s.length=r;for(let a=0;a<r;a++){const e=t[a];s[a]=e>-1?n[e]:P.acquire(this._surface.upsampleInfoPool)}this._updateMemoryUsed()}restartAgents(e){this.renderData&&(this._createOrUpdateAgents(0,e),this.updateRenderData(e,E.FADING))}updateAgents(e){if(this.renderData){const t=this.layerInfo[e];for(const e of t)e.loadingAgent===x&&(e.loadingAgent=null);this._createOrUpdateAgents(0,e)}}updateAgentSuspension(){for(const e of U){const t=this._isSuspended(e);for(const i of this.layerInfo[e])i.loadingAgent&&i.loadingAgent!==x&&(i.loadingAgent.setSuspension(t),i.loadingAgent===x&&this.updateRenderData(e,E.FADING))}}removeLayerAgent(e,t){const i=this.layerInfo[t][e];i.loadingAgent&&i.loadingAgent!==x&&i.loadingAgent.dispose(),i.loadingAgent=null}agentDone(e,t){const i=this.layerInfo[t][e];i.loadingAgent=x,i.data||i.upsampleInfo||this._createOrUpdateAgents(e+1,t)}_createOrUpdateAgents(e,t){const i=this._isSuspended(t),s=this.layerInfo[t];for(let n=e;n<s.length;++n){const e=s[n];let r=!1;const a=this._surface.layerViewByIndex(n,t),o=S(a);if(e.loadingAgent?V(this,o,!1)?(e.loadingAgent!==x&&e.loadingAgent.setSuspension(i),e.loadingAgent!==x&&(r=e.loadingAgent.update())):e.dispose():V(this,o,!1)&&(e.loadingAgent=H(this,n,t,i),r=e.loadingAgent.startLoading(),r?e.loadingAgent===x&&this.setPendingUpdate(b.GEOMETRY):(z(e.loadingAgent),e.loadingAgent=x)),e.loadingAgent===x&&this.updateRenderData(t,E.FADING),r&&a.isOpaque)return}}_isWithinExtent(e){const t=this.extent;return t[0]>=e[0]&&e[2]>=t[2]&&t[1]>=e[1]&&e[3]>=t[3]}intersectsExtent(e){const t=this.extent;return t[2]>=e[0]&&e[2]>=t[0]&&t[3]>=e[1]&&e[3]>=t[1]}getElevationBasedVerticesPerRow(t){const i=this.vlevel-this.level,s=Math.max(this.level-t,C(this.level)-i);return e(1+(this.maxTesselation>>s),2,this.maxTesselation+1)}get test(){return{cachedMemory:this.cachedMemory}}}function H(e,t,i,s){const n=i===D.ELEVATION?$.acquire():Y.acquire();return n.init(e,t,i,s),n}function z(e){e.dispose(),e instanceof I?$.release(e):e instanceof j&&Y.release(e)}const Y=new n(j),$=new n(I),Q=new T,J=-1;var K;!function(e){e[e.TOP=0]="TOP",e[e.MIDDLE=1]="MIDDLE",e[e.BOTTOM=2]="BOTTOM"}(K||(K={}));export{K as CenterPosition,k as SplitLimits,X as Tile};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import{unwrapOr as t,isSome as e}from"../../../core/maybe.js";import{ViewingMode as n}from"../../ViewingMode.js";import{ImageWithType as l}from"../support/StreamDataLoader.js";import{t as i}from"../../../chunks/terrainUtilsPlanar.js";import{t as o}from"../../../chunks/terrainUtilsSpherical.js";const r={[n.Global]:o,[n.Local]:i};function u(t,e){t||console.warn("Terrain: "+e)}const a=1.2,c=80/180*Math.PI,f=110/180*Math.PI;function s(n,l,i){const o=r[n.viewingMode];let u;if(o.isInsideExtent(n,l))u=t(n.getElevation(l[0],l[1],l[1],n.spatialReference),0);else{if(!o.isInsideExtent(n,l,a))return 0;const t=n.getTileWithElevation(l[0],l[1],l[1],n.spatialReference);u=.5*((e(t)?t.elevationBounds[0]:n.elevationBounds.min)+(e(t)?t.elevationBounds[1]:n.elevationBounds.max));const i=o.tiltToExtentEdge(n,l,u);if(i>c&&i<f)return 0}const s=l[2]-u;return Math.abs(s)<i?0:s<0?-1:1}function d(t){return v(t)?{fullExtent:t.fullExtent,minScale:t.layer.minScale,maxScale:t.layer.maxScale,tilemapCache:null}:t.layer}function p(t){return"vector-tile"===(null==t?void 0:t.type)}function m(t){return"imagery-tile"===(null==t?void 0:t.type)||"wcs"===(null==t?void 0:t.type)}function v(t){return"imagery-tile-3d"===(null==t?void 0:t.type)}function y(t){return"tile-3d"===(null==t?void 0:t.type)}function I(t){return"vector-tile-3d"===(null==t?void 0:t.type)}function x(t){return"wmts-3d"===(null==t?void 0:t.type)}function E(t){return"elevation-3d"===(null==t?void 0:t.type)}function h(t){return t&&(y(t)||v(t)||E(t)||I(t)||x(t))}function L(t){var n;const l=null==t||null==(n=t.sourceLayerInfo)?void 0:n.data;return e(l)&&"type"in l&&"raster-tile"===l.type}function T(t){var n;const l=null==t||null==(n=t.sourceLayerInfo)?void 0:n.data;return e(l)&&"type"in l&&"vector-tile"===l.type}function g(t){var n;const l=null==t||null==(n=t.sourceLayerInfo)?void 0:n.data;return e(l)&&"type"in l&&"tile-texture"===l.type}function S(t){var e;const n=null==t||null==(e=t.sourceLayerInfo)?void 0:e.data;return n instanceof HTMLImageElement||n instanceof l||n instanceof HTMLCanvasElement||n instanceof ImageData}function M(t){return e(t)&&"release"in t&&t.release(),null}function w(t){return t.fetchTile&&!1!==t.hasOverriddenFetchTile}function b(t,e,n,l){return r[l].checkIfTileInfoSupportedForViewSR(t,n,e)}function j(t,l,i){let o=null,r=null;if("wmts"===t.type){const e=t.activeLayer;if(e){const t=e.tileMatrixSet;if(t)o=t.tileInfo,r=t.fullExtent;else{const t=e.tileMatrixSets;if(t){const e=t.find((t=>null==b(t.tileInfo,t.fullExtent,l,i)));if(e)return{tileInfo:e.tileInfo,fullExtent:e.fullExtent}}}}}else r=m(t)?t.getCompatibleFullExtent(l):t.fullExtent,o=p(t)&&!B.force512VTL?t.compatibleTileInfo256:m(t)?t.getCompatibleTileInfo(l,r,i===n.Local):t.tileInfo;return e(o)&&e(r)&&null==b(o,r,l,i)?{tileInfo:o,fullExtent:r}:null}const B={force512VTL:!1};export{b as checkIfTileInfoSupportedForView,s as computeSkirtScale,d as getLayerWithExtentRange,j as getTiledLayerInfo,E as isElevationLayerView,v as isImageryTileLayerView,L as isImageryTileRenderInfo,m as isProjectableRasterLayer,S as isRasterTileRenderInfo,h as isSurfaceLayerView,g as isTextureTileRenderInfo,y as isTileLayerView,p as isVectorTileLayer,I as isVectorTileLayerView,T as isVectorTileRenderInfo,x as isWMTSLayerView,M as releaseTileData,B as test,w as useFetchTileForLayer,u as weakAssert};
5
+ import{unwrapOr as t,isSome as e}from"../../../core/maybe.js";import{ViewingMode as n}from"../../ViewingMode.js";import{ImageWithType as l}from"../support/StreamDataLoader.js";import{t as i}from"../../../chunks/terrainUtilsPlanar.js";import{t as o}from"../../../chunks/terrainUtilsSpherical.js";const r={[n.Global]:o,[n.Local]:i};function u(t,e){t||console.warn("Terrain: "+e)}const a=1.2,c=80/180*Math.PI,f=110/180*Math.PI;function s(n,l,i){const o=r[n.viewingMode];let u;if(o.isInsideExtent(n,l))u=t(n.getElevation(l[0],l[1],l[1],n.spatialReference),0);else{if(!o.isInsideExtent(n,l,a))return 0;const t=n.getTileWithElevation(l[0],l[1],l[1],n.spatialReference);u=.5*((e(t)?t.elevationBounds[0]:n.elevationBounds.min)+(e(t)?t.elevationBounds[1]:n.elevationBounds.max));const i=o.tiltToExtentEdge(n,l,u);if(i>c&&i<f)return 0}const s=l[2]-u;return Math.abs(s)<i?0:s<0?-1:1}function d(t){return v(t)?{fullExtent:t.fullExtent,minScale:t.layer.minScale,maxScale:t.layer.maxScale,tilemapCache:null}:t.layer}function p(t){return"vector-tile"===(null==t?void 0:t.type)}function m(t){return"imagery-tile"===(null==t?void 0:t.type)||"wcs"===(null==t?void 0:t.type)}function v(t){return"imagery-tile-3d"===(null==t?void 0:t.type)}function y(t){return"tile-3d"===(null==t?void 0:t.type)}function I(t){return"vector-tile-3d"===(null==t?void 0:t.type)}function x(t){return"wmts-3d"===(null==t?void 0:t.type)}function E(t){return"elevation-3d"===(null==t?void 0:t.type)}function g(t){return t&&(y(t)||v(t)||E(t)||I(t)||x(t))}function h(t){var n;const l=null==t||null==(n=t.sourceLayerInfo)?void 0:n.data;return e(l)&&"type"in l&&"raster-tile"===l.type}function L(t){var n;const l=null==t||null==(n=t.sourceLayerInfo)?void 0:n.data;return e(l)&&"type"in l&&"vector-tile"===l.type}function T(t){var n;const l=null==t||null==(n=t.sourceLayerInfo)?void 0:n.data;return e(l)&&"type"in l&&"tile-texture"===l.type}function S(t){var e;const n=null==t||null==(e=t.sourceLayerInfo)?void 0:e.data;return n instanceof HTMLImageElement||n instanceof l||n instanceof HTMLCanvasElement||n instanceof ImageData}function M(t){return e(t)&&"release"in t&&t.release(),null}function w(t){return t.fetchTile&&!1!==t.hasOverriddenFetchTile}function b(t,e,n,l){return r[l].checkIfTileInfoSupportedForViewSR(t,n,e)}function C(t,l,i){let o=null,r=null;if("wmts"===t.type){const e=t.activeLayer;if(e){const t=e.tileMatrixSet;if(t)o=t.tileInfo,r=t.fullExtent;else{const t=e.tileMatrixSets;if(t){const e=t.find((t=>null==b(t.tileInfo,t.fullExtent,l,i)));if(e)return{tileInfo:e.tileInfo,fullExtent:e.fullExtent}}}}}else r=m(t)?t.getCompatibleFullExtent(l):t.fullExtent,o=p(t)&&!j.force512VTL?t.tileInfo.getOrCreateCompatible(256):m(t)?t.getCompatibleTileInfo(l,r,i===n.Local):t.tileInfo;return e(o)&&e(r)&&null==b(o,r,l,i)?{tileInfo:o,fullExtent:r}:null}const j={force512VTL:!1};export{b as checkIfTileInfoSupportedForView,s as computeSkirtScale,d as getLayerWithExtentRange,C as getTiledLayerInfo,E as isElevationLayerView,v as isImageryTileLayerView,h as isImageryTileRenderInfo,m as isProjectableRasterLayer,S as isRasterTileRenderInfo,g as isSurfaceLayerView,T as isTextureTileRenderInfo,y as isTileLayerView,p as isVectorTileLayer,I as isVectorTileLayerView,L as isVectorTileRenderInfo,x as isWMTSLayerView,M as releaseTileData,j as test,w as useFetchTileForLayer,u as weakAssert};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import{isSome as t,isNone as e}from"../../../core/maybe.js";import n from"../../../core/PooledArray.js";class r{constructor(){this._queue=new n,this._last=null,this.remove=()=>{}}get done(){return 0===this._queue.length&&(!this._last||this._last.isLeaf)}resetOne(t){this._queue.clear(),this._queue.push(t),this._last=null}reset(e=null){this._queue.clear(),t(e)&&this._queue.pushArray(e),this._last=null}skipSubtree(){this._last=null}next(){return this._last&&!this._last.isLeaf&&this._queue.pushArray(this._last.children),this._last=this._queue.pop(),this._last}}class s{constructor(){this.q=new n}get done(){return 0===this.q.length}reset(t){if(this.q.clear(),!e(t)){this.q.pushArray(t);for(let t=0;t<this.q.length;++t){const e=this.q.data[t];e.isLeaf||this.q.pushArray(e.children)}}}next(){return this.q.pop()}}function i(t,e){if(Array.isArray(t))for(let n=0;n<t.length;n++)l(t[n],e);else l(t,e)}function l(t,e){if(e(t),!t.isLeaf)for(const n of t.children)l(n,e)}function u(t,n,r){if(e(n)||e(n.fullExtent))return!1;const s=n.fullExtent,i=t.extent;if(r){if(i[0]<s.xmin||i[1]<s.ymin||i[2]>s.xmax||i[3]>s.ymax)return!1}else if(s.xmin>i[2]||s.ymin>i[3]||s.xmax<i[0]||s.ymax<i[1])return!1;const l=t.surface.tilingScheme.levels[t.level].scale;return!(n.minScale>0&&l>1.00000001*n.minScale)&&!(n.maxScale>0&&l<.99999999*n.maxScale)}function o(t,e){e.sort(((e,n)=>a(e,n,t)))}function a(t,e,n){const r=t.screenDepth,s=e.screenDepth;return r<s?-n:r>s?n:0}function h(t,e){const n=new Map;t.forAll((t=>n.set(t,t.distanceToSquared(e)))),t.sort(((t,e)=>n.get(t)-n.get(e)))}function c(t,e,n){let r=1,s=0,i=0;for(;t!==e;)if(r*=.5,s*=.5,i*=.5,1&t.lij[2]&&(s+=.5),0==(1&t.lij[1])&&(i+=.5),null==(t=t.parent))throw new Error("tile was not a descendant of upsampleTile");n.init(e,s,i,r)}function f(t){for(let e=0;e<t.length;e++){const n=t[e],r=n.parent;if(r)for(let t=0;t<4;t++){const e=r.children[t];if(e&&e!==n&&e.loadable)return!0}}return!1}function m(t,e){if(!t||!e||t[0]===e[0])return!1;const n=t[0]<e[0],r=n?t:e,s=n?e:t,i=1<<s[0]-r[0];return Math.floor(s[1]/i)===r[1]&&Math.floor(s[2]/i)===r[2]}export{s as IteratorPostorder,r as IteratorPreorder,a as compareTiles,c as computeUpsampleInfo,u as fallsWithinLayer,f as hasLoadableSiblings,o as sortTiles,h as sortTilesByPOI,m as tilesAreRelated,i as traverseTilesPreorder};
5
+ import{isSome as t,isNone as e}from"../../../core/maybe.js";import n from"../../../core/PooledArray.js";class r{constructor(){this._queue=new n,this._last=null,this.remove=()=>{}}get done(){return 0===this._queue.length&&(!this._last||this._last.isLeaf)}resetOne(t){this._queue.clear(),this._queue.push(t),this._last=null}reset(e=null){this._queue.clear(),t(e)&&this._queue.pushArray(e),this._last=null}skipSubtree(){this._last=null}next(){return this._last&&!this._last.isLeaf&&this._queue.pushArray(this._last.children),this._last=this._queue.pop(),this._last}}class s{constructor(){this.q=new n}get done(){return 0===this.q.length}reset(t){if(this.q.clear(),!e(t)){this.q.pushArray(t);for(let t=0;t<this.q.length;++t){const e=this.q.data[t];e.isLeaf||this.q.pushArray(e.children)}}}next(){return this.q.pop()}}function i(t,e){if(Array.isArray(t))for(let n=0;n<t.length;n++)l(t[n],e);else l(t,e)}function l(t,e){if(e(t),!t.isLeaf)for(const n of t.children)l(n,e)}function u(t,n,r){if(e(n)||e(n.fullExtent))return!1;const s=n.fullExtent,i=t.extent;if(r){if(i[0]<s.xmin||i[1]<s.ymin||i[2]>s.xmax||i[3]>s.ymax)return!1}else if(s.xmin>i[2]||s.ymin>i[3]||s.xmax<i[0]||s.ymax<i[1])return!1;const l=t.surface.tilingScheme.levels[t.level].scale;return!(n.minScale>0&&l>1.00000001*n.minScale)&&!(n.maxScale>0&&l<.99999999*n.maxScale)}function o(t,e){e.sort(((e,n)=>a(e,n,t)))}function a(t,e,n){const r=t.screenDepth,s=e.screenDepth;return r<s?-n:r>s?n:0}function h(t,e){const n=new Map;t.forAll((t=>n.set(t.lij,t.distanceToSquared(e)))),t.sort(((t,e)=>n.get(t.lij)-n.get(e.lij)))}function c(t,e,n){let r=1,s=0,i=0;for(;t!==e;)if(r*=.5,s*=.5,i*=.5,1&t.lij[2]&&(s+=.5),0==(1&t.lij[1])&&(i+=.5),null==(t=t.parent))throw new Error("tile was not a descendant of upsampleTile");n.init(e,s,i,r)}function f(t){for(let e=0;e<t.length;e++){const n=t[e],r=n.parent;if(r)for(let t=0;t<4;t++){const e=r.children[t];if(e&&e!==n&&e.loadable)return!0}}return!1}function m(t,e){if(!t||!e||t[0]===e[0])return!1;const n=t[0]<e[0],r=n?t:e,s=n?e:t,i=1<<s[0]-r[0];return Math.floor(s[1]/i)===r[1]&&Math.floor(s[2]/i)===r[2]}export{s as IteratorPostorder,r as IteratorPreorder,a as compareTiles,c as computeUpsampleInfo,u as fallsWithinLayer,f as hasLoadableSiblings,o as sortTiles,h as sortTilesByPOI,m as tilesAreRelated,i as traverseTilesPreorder};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../../core/Logger.js";import{isSome as t,isNone as o,applySome as r,unwrap as n}from"../../../../../core/maybe.js";import i from"../../../../../core/PooledArray.js";import{e as s,t as a,g as m}from"../../../../../chunks/mat3.js";import{c,a as l}from"../../../../../chunks/mat3f32.js";import{h as p,v as h,t as f,g as u}from"../../../../../chunks/vec3.js";import{c as b}from"../../../../../chunks/vec3f64.js";import{c as g}from"../../../../../chunks/vec4.js";import{c as d}from"../../../../../chunks/vec4f32.js";import{ColorMixModeEnum as y,encodeSymbolColor as C}from"../../../layers/support/symbolColorUtils.js";import{clone as j,radius as w}from"../../../support/orientedBoundingBox.js";import{glLayout as M}from"../../../support/buffer/glUtil.js";import{newLayout as x}from"../../../support/buffer/InterleavedLayout.js";import _ from"./ComponentData.js";import{State as S,ComponentObject as v}from"./ComponentObject.js";import{isVaryingComponentParameters as D}from"./interface.js";import A from"./IntersectionGeometry.js";import{Renderable as P}from"./Renderable.js";import{RenderGeometry as O}from"./RenderGeometry.js";import{RenderSubmitSystem as T}from"./RenderSubmitSystem.js";import{createVertexBufferLayout as k}from"./SourceGeometry.js";import{ComponentParametersVarying as I,ComponentParametersUniform as R,ComponentParameterSummary as U,ComponentMaterial as B}from"./Material/ComponentMaterial.js";import{ComponentDrawParameters as G}from"./Material/ComponentTechnique.js";import{TwoVectorPosition as V}from"../../core/util/TwoVectorPosition.js";import{VertexAttribute as E}from"../../lib/basicInterfaces.js";import{getVisibility as N,updateVisibilityWithCount as L}from"../../lib/ComponentUtils.js";import{assert as H}from"../../lib/Util.js";import{BufferManager as q}from"../../lib/TextureBackedBuffer/BufferManager.js";import{BufferObject as F}from"../../../../webgl/BufferObject.js";import{Usage as z,PrimitiveType as W}from"../../../../webgl/enums.js";import{VertexArrayObject as X}from"../../../../webgl/VertexArrayObject.js";const J=e.getLogger("esri.views.3d.webgl-engine.collections.Component.ComponentObjectCollection");class K{constructor(e){this._renderManager=e,this._objects=[new i,new i],this._renderSubmit=new T(this),this._renderManager.register(this._renderSubmit),this._componentBufferManager=new q(e.rctx)}dispose(){H(0===this._objects[S.Hidden].length&&0===this._objects[S.Visible].length,"ObjectCollection should be empty upon disposal"),this._componentBufferManager.destroy()}createObject(e){const t=new v;return t.toMapSpace=e.toMapSpace.slice(),t.transform=e.transform,t.obb=j(e.obb),t.components=new _(this._componentBufferManager,e.geometry.componentOffsets),t.renderable=this._createRenderable(e,t.components),t.intersectionGeometry=new A(e.geometry.positionData,t.components),this._objects[t.visible].push(t),t}destroyObject(e){const t=e;this._objects[t.visible].removeUnordered(t),t.dispose(),this._notifyDirty()}setObjectVisibility(e,t){const o=e;t!==o.visible&&(this._objects[o.visible].removeUnordered(o),this._objects[t].push(o),o.visible=t,this._notifyDirty())}preSubmit(e){const t=e.camera.eye;this.visibleObjects.forAll((e=>{const o=p(t,e.obb.center);e.renderable.meta.cameraDepthSquared=o}))}getMaterial(e){return e.renderable.material}updateMaterial(e,t){const o=e.renderable.material;t(o),o.dirty&&this._notifyDirty()}setAllComponentVisibilities(e,t){const o=e;o.components.visibility.reset(t),o.components.visibilityDirty(),this._notifyDirty()}forEachVisibleComponent(e,t){return e.components.visibility.forEachComponent(t)}getComponentCount(e){const t=e,o=t.components.visibility.componentCount();return{visible:o,invisible:t.components.count-o}}setComponentData(e,t){const o=e,r=o.renderable.material;if(D(t)){const e=o.components,n=e.materialDataBuffer,i=e.materialDataIndices,s={castShadows:!0,pickable:!0,externalColor:d(),externalColorMixMode:y.Multiply},a=n.textureBuffer,m=new Uint8Array(4),c=new Uint32Array(m.buffer);let l=0,p=0,h=0,f=!1,u=0;for(let o=0;o<e.count;o++)t(o,s),l+=+(s.externalColor[3]<1),p+=+(s.externalColorMixMode===y.Replace&&1===s.externalColor[3]),h+=+s.castShadows,C(s.externalColor,s.externalColorMixMode,m),m[2]=254&m[2]|+s.castShadows,a.setData(i[o],0,m[0],m[1],m[2],m[3]),f=f||o>0&&u!==c[0],u=c[0],s.pickable!==N(e.pickability,o)&&(e.pickability=L(e.pickability,e.count,o,s.pickable));f?(r.componentParameters=new I,r.componentParameters.castShadows=Y(h,e.count),r.componentParameters.transparent=Y(l,e.count),r.componentParameters.opaqueOverride=Y(p,e.count),r.componentParameters.texture=a,a.updateTexture()):(r.componentParameters=new R,r.componentParameters.castShadows=s.castShadows?U.All:U.None,r.componentParameters.externalColor=s.externalColor,r.componentParameters.externalColorMixMode=s.externalColorMixMode)}else r.componentParameters=new R,r.componentParameters.castShadows=t.castShadows?U.All:U.None,r.componentParameters.externalColor=t.externalColor,r.componentParameters.externalColorMixMode=t.externalColorMixMode;this._notifyDirty()}getComponentAabb(e,t,o){return e.intersectionGeometry.getComponentAabb(t,o)}getComponentObb(e){return e.obb}getObjectTransform(e){return e.transform}getComponentPositions(e,t,o){return e.intersectionGeometry.getComponentPositions(t,o)}intersect(e,o,r,n,i,m){const c=e;t(i)&&(i.localOrigin=c.transform.position);const l=s(Z,c.transform.rotationScale);h($,o,c.transform.position),h(ee,r,c.transform.position),f($,$,l),f(ee,ee,l);const p=a(Z,l);return c.intersectionGeometry.intersect($,ee,n,p,i,m)}addEdges(e,t,o,r){const n=e,{indices:i,positions:s}=n.intersectionGeometry,a=n.components.offsets;return t.addComponentObject(e,n.transform,{center:n.obb.center,radius:w(n.obb)},s,i,a,o,r)}addComponentHighlight(e,t){const r=e.components;o(r.highlightCounts)&&(r.highlightCounts=new Uint32Array(r.count+1));0===r.highlightCounts[t]++&&(r.highlightsDirty(),this._notifyDirty()),r.highlightCounts[r.count]++}removeComponentHighlight(e,t){const r=e.components;if(o(r.highlightCounts))return void J.warn("Removing non-existing highlight.");const n=r.highlightCounts[t],i=r.highlightCounts[r.count];if(0!==n){if(n>1)return r.highlightCounts[t]=n-1,void(r.highlightCounts[r.count]=i-1);r.highlightCounts[t]=0,r.highlightsDirty(),this._notifyDirty(),1===i?r.highlightCounts=null:r.highlightCounts[r.count]=i-1}else J.warn("Removing non-existing highlight.")}clearHighlights(e){const o=e.components;t(o.highlightCounts)&&(o.highlightCounts=null,o.highlightsDirty(),this._notifyDirty())}getObjectGPUMemoryUsage(e){return e.renderable.meta.gpuMemoryEstimate}get visibleObjects(){return this._objects[S.Visible]}_createRenderable(e,o){const i=this._renderManager.rctx,c=e.geometry,p=c.vertices.layoutParameters,h=F.createVertex(i,z.STATIC_DRAW,c.vertices.data),f=r(c.indices,(e=>F.createIndex(i,z.STATIC_DRAW,e))),b=M(k(p)),d=new Uint16Array(c.vertices.count);for(let r=0;r<o.count;r++){const e=o.offsets[r],n=o.offsets[r+1],i=o.materialDataIndices[r];if(t(c.indices))for(let t=e;t<n;t++){d[c.indices[t]]=i}else for(let t=e;t<n;t++)d[t]=i}const y=F.createVertex(i,z.STATIC_DRAW,d.buffer),C=new V(e.transform.position),j=l(e.transform.rotationScale);s(j,j),a(j,j);const w=new G;u(w.worldFromModel_TL,C.low),u(w.worldFromModel_TH,C.high),m(w.worldFromModel_RS,e.transform.rotationScale),m(w.transformNormal_GlobalFromModel,j),g(w.toMapSpace,e.toMapSpace);const x=new B,_=new X(i,x.attributeLocations,{data:b,componentIndices:Q},{data:h,componentIndices:y},n(f)),S=new O(_,W.TRIANGLES,p,t(f)),v={cameraDepthSquared:.5,gpuMemoryEstimate:h.byteSize+y.byteSize+(t(f)?f.byteSize:0)};return new P(x,w,S,v)}_notifyDirty(){this._renderManager.notifyDirty()}}const Q=M(x().u16(E.COMPONENTINDEX));function Y(e,t){return e===t?U.All:0===e?U.None:U.Some}const Z=c(),$=b(),ee=b();export{K as ComponentObjectCollection};
5
+ import e from"../../../../../core/Logger.js";import{isSome as t,isNone as o,applySome as r,unwrap as n}from"../../../../../core/maybe.js";import i from"../../../../../core/PooledArray.js";import{e as s,t as a,g as m}from"../../../../../chunks/mat3.js";import{c,a as l}from"../../../../../chunks/mat3f32.js";import{h as p,v as h,t as f,g as u}from"../../../../../chunks/vec3.js";import{c as b}from"../../../../../chunks/vec3f64.js";import{c as g}from"../../../../../chunks/vec4.js";import{c as d}from"../../../../../chunks/vec4f32.js";import{ColorMixModeEnum as y,encodeSymbolColor as C}from"../../../layers/support/symbolColorUtils.js";import{clone as j,radius as M}from"../../../support/orientedBoundingBox.js";import{glLayout as w}from"../../../support/buffer/glUtil.js";import{newLayout as x}from"../../../support/buffer/InterleavedLayout.js";import S from"./ComponentData.js";import{State as v,ComponentObject as _}from"./ComponentObject.js";import{isVaryingComponentParameters as D}from"./interface.js";import A from"./IntersectionGeometry.js";import{Renderable as P}from"./Renderable.js";import{RenderGeometry as O}from"./RenderGeometry.js";import{RenderSubmitSystem as T}from"./RenderSubmitSystem.js";import{createVertexBufferLayout as k}from"./SourceGeometry.js";import{ComponentParametersVarying as R,ComponentParametersUniform as I,ComponentParameterSummary as U,ComponentMaterial as B}from"./Material/ComponentMaterial.js";import{ComponentDrawParameters as G}from"./Material/ComponentTechnique.js";import{TwoVectorPosition as V}from"../../core/util/TwoVectorPosition.js";import{getVisibility as E,updateVisibilityWithCount as N}from"../../lib/ComponentUtils.js";import{assert as L}from"../../lib/Util.js";import{VertexAttribute as W}from"../../lib/VertexAttribute.js";import{BufferManager as H}from"../../lib/TextureBackedBuffer/BufferManager.js";import{BufferObject as q}from"../../../../webgl/BufferObject.js";import{Usage as F,PrimitiveType as z}from"../../../../webgl/enums.js";import{VertexArrayObject as X}from"../../../../webgl/VertexArrayObject.js";const J=e.getLogger("esri.views.3d.webgl-engine.collections.Component.ComponentObjectCollection");class K{constructor(e){this._renderManager=e,this._objects=[new i,new i],this._renderSubmit=new T(this),this._renderManager.register(this._renderSubmit),this._componentBufferManager=new H(e.rctx)}dispose(){L(0===this._objects[v.Hidden].length&&0===this._objects[v.Visible].length,"ObjectCollection should be empty upon disposal"),this._componentBufferManager.destroy()}createObject(e){const t=new _;return t.toMapSpace=e.toMapSpace.slice(),t.transform=e.transform,t.obb=j(e.obb),t.components=new S(this._componentBufferManager,e.geometry.componentOffsets),t.renderable=this._createRenderable(e,t.components),t.intersectionGeometry=new A(e.geometry.positionData,t.components),this._objects[t.visible].push(t),t}destroyObject(e){const t=e;this._objects[t.visible].removeUnordered(t),t.dispose(),this._notifyDirty()}setObjectVisibility(e,t){const o=e;t!==o.visible&&(this._objects[o.visible].removeUnordered(o),this._objects[t].push(o),o.visible=t,this._notifyDirty())}preSubmit(e){const t=e.camera.eye;this.visibleObjects.forAll((e=>{const o=p(t,e.obb.center);e.renderable.meta.cameraDepthSquared=o}))}getMaterial(e){return e.renderable.material}updateMaterial(e,t){const o=e.renderable.material;t(o),o.dirty&&this._notifyDirty()}setAllComponentVisibilities(e,t){const o=e;o.components.visibility.reset(t),o.components.visibilityDirty(),this._notifyDirty()}forEachVisibleComponent(e,t){return e.components.visibility.forEachComponent(t)}getComponentCount(e){const t=e,o=t.components.visibility.componentCount();return{visible:o,invisible:t.components.count-o}}setComponentData(e,t){const o=e,r=o.renderable.material;if(D(t)){const e=o.components,n=e.materialDataBuffer,i=e.materialDataIndices,s={castShadows:!0,pickable:!0,externalColor:d(),externalColorMixMode:y.Multiply},a=n.textureBuffer,m=new Uint8Array(4),c=new Uint32Array(m.buffer);let l=0,p=0,h=0,f=!1,u=0;for(let o=0;o<e.count;o++)t(o,s),l+=+(s.externalColor[3]<1),p+=+(s.externalColorMixMode===y.Replace&&1===s.externalColor[3]),h+=+s.castShadows,C(s.externalColor,s.externalColorMixMode,m),m[2]=254&m[2]|+s.castShadows,a.setData(i[o],0,m[0],m[1],m[2],m[3]),f=f||o>0&&u!==c[0],u=c[0],s.pickable!==E(e.pickability,o)&&(e.pickability=N(e.pickability,e.count,o,s.pickable));f?(r.componentParameters=new R,r.componentParameters.castShadows=Y(h,e.count),r.componentParameters.transparent=Y(l,e.count),r.componentParameters.opaqueOverride=Y(p,e.count),r.componentParameters.texture=a,a.updateTexture()):(r.componentParameters=new I,r.componentParameters.castShadows=s.castShadows?U.All:U.None,r.componentParameters.externalColor=s.externalColor,r.componentParameters.externalColorMixMode=s.externalColorMixMode)}else r.componentParameters=new I,r.componentParameters.castShadows=t.castShadows?U.All:U.None,r.componentParameters.externalColor=t.externalColor,r.componentParameters.externalColorMixMode=t.externalColorMixMode;this._notifyDirty()}getComponentAabb(e,t,o){return e.intersectionGeometry.getComponentAabb(t,o)}getComponentObb(e){return e.obb}getObjectTransform(e){return e.transform}getComponentPositions(e,t,o){return e.intersectionGeometry.getComponentPositions(t,o)}intersect(e,o,r,n,i,m){const c=e;t(i)&&(i.localOrigin=c.transform.position);const l=s(Z,c.transform.rotationScale);h($,o,c.transform.position),h(ee,r,c.transform.position),f($,$,l),f(ee,ee,l);const p=a(Z,l);return c.intersectionGeometry.intersect($,ee,n,p,i,m)}addEdges(e,t,o,r){const n=e,{indices:i,positions:s}=n.intersectionGeometry,a=n.components.offsets;return t.addComponentObject(e,n.transform,{center:n.obb.center,radius:M(n.obb)},s,i,a,o,r)}addComponentHighlight(e,t){const r=e.components;o(r.highlightCounts)&&(r.highlightCounts=new Uint32Array(r.count+1));0===r.highlightCounts[t]++&&(r.highlightsDirty(),this._notifyDirty()),r.highlightCounts[r.count]++}removeComponentHighlight(e,t){const r=e.components;if(o(r.highlightCounts))return void J.warn("Removing non-existing highlight.");const n=r.highlightCounts[t],i=r.highlightCounts[r.count];if(0!==n){if(n>1)return r.highlightCounts[t]=n-1,void(r.highlightCounts[r.count]=i-1);r.highlightCounts[t]=0,r.highlightsDirty(),this._notifyDirty(),1===i?r.highlightCounts=null:r.highlightCounts[r.count]=i-1}else J.warn("Removing non-existing highlight.")}clearHighlights(e){const o=e.components;t(o.highlightCounts)&&(o.highlightCounts=null,o.highlightsDirty(),this._notifyDirty())}getObjectGPUMemoryUsage(e){return e.renderable.meta.gpuMemoryEstimate}get visibleObjects(){return this._objects[v.Visible]}_createRenderable(e,o){const i=this._renderManager.rctx,c=e.geometry,p=c.vertices.layoutParameters,h=q.createVertex(i,F.STATIC_DRAW,c.vertices.data),f=r(c.indices,(e=>q.createIndex(i,F.STATIC_DRAW,e))),b=w(k(p)),d=new Uint16Array(c.vertices.count);for(let r=0;r<o.count;r++){const e=o.offsets[r],n=o.offsets[r+1],i=o.materialDataIndices[r];if(t(c.indices))for(let t=e;t<n;t++){d[c.indices[t]]=i}else for(let t=e;t<n;t++)d[t]=i}const y=q.createVertex(i,F.STATIC_DRAW,d.buffer),C=new V(e.transform.position),j=l(e.transform.rotationScale);s(j,j),a(j,j);const M=new G;u(M.transformWorldFromModelTL,C.low),u(M.transformWorldFromModelTH,C.high),m(M.transformWorldFromModelRS,e.transform.rotationScale),m(M.transformNormalGlobalFromModel,j),g(M.toMapSpace,e.toMapSpace);const x=new B,S=new X(i,x.attributeLocations,{data:b,componentIndices:Q},{data:h,componentIndices:y},n(f)),v=new O(S,z.TRIANGLES,p,t(f)),_={cameraDepthSquared:.5,gpuMemoryEstimate:h.byteSize+y.byteSize+(t(f)?f.byteSize:0)};return new P(x,M,v,_)}_notifyDirty(){this._renderManager.notifyDirty()}}const Q=w(x().u16(W.COMPONENTINDEX));function Y(e,t){return e===t?U.All:0===e?U.None:U.Some}const Z=c(),$=b(),ee=b();export{K as ComponentObjectCollection};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../../../chunks/tslib.es6.js";import{releaseMaybe as t,isSome as r}from"../../../../../../core/maybe.js";import{C as s}from"../../../../../../chunks/vec3.js";import{f as o}from"../../../../../../chunks/vec3f32.js";import{g as a,c as i,v as n}from"../../../../../../chunks/vec4.js";import{f as l}from"../../../../../../chunks/vec4f32.js";import{f as p}from"../../../../../../chunks/vec4f64.js";import{ColorMixModeEnum as h}from"../../../../layers/support/symbolColorUtils.js";import{ComponentTechniqueConfiguration as u,IntegratedMeshMode as d,ComponentTechnique as c}from"./ComponentTechnique.js";import{ComponentDataType as m}from"./shader/ComponentData.glsl.js";import{a as y}from"../../../../../../chunks/ComponentShader.glsl.js";import{VertexDiscardMode as v}from"./shader/VertexDiscardByOpacity.glsl.js";import{parameter as b,parameterBlock as T,MaterialBase as g,MaterialParameterBlock as f}from"../../../core/material/MaterialBase.js";import{RenderPassIdentifier as x,MaterialSubPass as M}from"../../../core/renderPasses/AllRenderPasses.js";import{ShaderOutput as O}from"../../../core/shaderLibrary/ShaderOutputOptions.js";import{Normals as P}from"../../../core/shaderLibrary/shading/Normals.glsl.js";import{defaultMaskAlphaCutoff as C}from"../../../core/shaderLibrary/util/AlphaDiscard.glsl.js";import{EllipsoidMode as D}from"../../../core/shaderLibrary/util/EllipsoidMode.js";import{AlphaDiscardMode as q,TransparencyPassType as E,CullFaceOptions as w}from"../../../lib/basicInterfaces.js";class S extends g{constructor(){super(...arguments),this.baseColor=l(1,1,1,1),this.usePBR=!1,this.hasParametersFromSource=!1,this.mrrFactors=o(1,1,.5),this.emissiveFactor=o(0,0,0),this.baseColorTexture=null,this.metallicRoughnessTexture=null,this.emissionTexture=null,this.occlusionTexture=null,this.normalTexture=null,this.overlayTexOffset=p(-1,-1,-1,-1),this.overlayTexScale=p(0,0,0,0),this.overlayColor=null,this.overlayHighlight=null,this.overlayNormal=null,this.objectOpacity=1,this.commonMaterialParameters=new R,this.componentParameters=new I,this.alphaCutoff=C,this.alphaDiscardMode=q.Opaque,this.isIntegratedMesh=!1,this.polygonOffsetEnabled=!1,this.ellipsoidMode=D.Earth,this.sceneHasOcludees=!1,this._techniqueConfig=new u}dispose(){this._technique=t(this._technique),this.baseColorTexture=null,this.metallicRoughnessTexture=null,this.emissionTexture=null,this.occlusionTexture=null,this.normalTexture=null}prepareTechnique(e,t,s){const o=this._techniqueConfig;if(o.hasVertexColors=s.colors,o.hasNormals=s.normals,o.vertexTextureCoordinates=s.textureCoordinates,o.usePBR=this.usePBR,o.hasMetalnessAndRoughnessTexture=r(this.metallicRoughnessTexture),o.hasEmissionTexture=r(this.emissionTexture),o.hasOcclusionTexture=r(this.occlusionTexture),o.hasNormalTexture=r(this.normalTexture),o.transparencyPassType=t.identifier===x.Material&&null!=t.transparencyPassType?t.transparencyPassType:E.NONE,o.multipassTerrainEnabled=t.identifier===x.Material&&null!=t.multipassTerrainParams&&t.multipassTerrainParams.multipassTerrainEnabled,o.cullAboveGround=t.identifier===x.Material&&null!=t.multipassTerrainParams&&t.multipassTerrainParams.cullAboveGround,o.ellipsoidMode=this.ellipsoidMode,this.dirty){o.componentData=this.componentParameters.type,o.cullFace=this.commonMaterialParameters.cullFace,o.doubleSidedMode=this.commonMaterialParameters.doubleSided?P.DoubleSidedMode.View:P.DoubleSidedMode.None,o.baseColorTexture=r(this.baseColorTexture),o.isSchematic=this.hasParametersFromSource&&!r(this.baseColorTexture);const e=this._computeWhichMaterialPass();o.blendingEnabled=e===A.Transparent||e===A.OpaqueAndTransparent,o.alphaDiscardMode=this.alphaDiscardMode,o.integratedMeshMode=this.isIntegratedMesh?this.overlayColor?this.overlayNormal?d.ColorOverlayWithWater:d.ColorOverlay:d.NoOverlay:d.None,o.polygonOffsetEnabled=this.polygonOffsetEnabled,this._setClean()}return o.slicePlaneEnabled=t.slicePlaneEnabled&&this.commonMaterialParameters.slicePlaneEnabled,t.identifier===x.ShadowMap?(o.output=O.Shadow,o.vertexDiscardMode=v.None):t.identifier===x.Highlight?(o.output=O.Highlight,o.vertexDiscardMode=v.None):(this._computeWhichMaterialPass()===A.OpaqueAndTransparent?o.vertexDiscardMode=t.transparent?v.Opaque:v.Transparent:o.vertexDiscardMode=v.None,o.output=k(t.subPass),t.subPass===M.Alpha&&(o.sceneHasOcludees=t.sceneHasOcludees),t.subPass===M.Color?(o.receiveAmbientOcclusion=t.ambientOcclusionEnabled,o.sceneHasOcludees=t.sceneHasOcludees,o.receiveShadows=t.shadowsEnabled,o.ssrEnabled=t.ssrParams.ssrEnabled):(o.receiveAmbientOcclusion=!1,o.receiveShadows=!1)),this._technique=e.releaseAndAcquire(c,o,this._technique),this._technique}submit(e,t){if(0===this.objectOpacity)return;const s=t.renderable.geometry,o=t.components,a=t.renderable.drawParameters,i=t.renderable.meta.cameraDepthSquared,n=o.geometryRanges,l=o.highlightRanges,p=o.defaultShadowMapRanges;switch(this._computeWhichMaterialPass()){case A.Opaque:e.materialOpaque.submitDraw(this,s,n,a,i);break;case A.Transparent:e.materialTransparent.submitDraw(this,s,n,a,i);break;case A.OpaqueAndTransparent:e.materialOpaque.submitDraw(this,s,n,a,i),e.materialTransparent.submitDraw(this,s,n,a,i);break;case A.IntegratedMesh:e.materialIntegratedMesh.submitDraw(this,s,n,a,i),this.overlayHighlight&&e.highlightIntegratedMesh.submitDraw(this,s,n,a,i)}const h=this.componentParameters.castShadows!==j.None;h&&e.shadowMap.submitDraw(this,s,n,a,i),r(l)&&(e.highlight.submitDraw(this,s,l,a,i),h&&e.highlightShadowMap.submitDraw(this,s,l,a,i)),h&&r(p)&&e.defaultShadowMap.submitDraw(this,s,p,a,i)}get attributeLocations(){return y}_computeWhichMaterialPass(){return this.isIntegratedMesh?A.IntegratedMesh:this.objectOpacity<1?A.Transparent:this.componentParameters.opaqueOverride===j.All?A.Opaque:this.baseColor[3]<1||this.alphaDiscardMode===q.Blend||this.alphaDiscardMode===q.MaskBlend?A.Transparent:this.componentParameters.transparent===j.None?A.Opaque:this.componentParameters.transparent===j.All?A.Transparent:A.OpaqueAndTransparent}}var N,A,j;e([b({vectorOps:n})],S.prototype,"baseColor",void 0),e([b()],S.prototype,"usePBR",void 0),e([b()],S.prototype,"hasParametersFromSource",void 0),e([b({vectorOps:s})],S.prototype,"mrrFactors",void 0),e([b({vectorOps:s})],S.prototype,"emissiveFactor",void 0),e([b({dispose:!0})],S.prototype,"baseColorTexture",void 0),e([b({dispose:!0})],S.prototype,"metallicRoughnessTexture",void 0),e([b({dispose:!0})],S.prototype,"emissionTexture",void 0),e([b({dispose:!0})],S.prototype,"occlusionTexture",void 0),e([b({dispose:!0})],S.prototype,"normalTexture",void 0),e([b({vectorOps:{equals:a,copy:i}})],S.prototype,"overlayTexOffset",void 0),e([b({vectorOps:{equals:a,copy:i}})],S.prototype,"overlayTexScale",void 0),e([b()],S.prototype,"overlayColor",void 0),e([b()],S.prototype,"overlayHighlight",void 0),e([b()],S.prototype,"overlayNormal",void 0),e([b()],S.prototype,"objectOpacity",void 0),e([T()],S.prototype,"commonMaterialParameters",void 0),e([T()],S.prototype,"componentParameters",void 0),e([b()],S.prototype,"alphaCutoff",void 0),e([b()],S.prototype,"alphaDiscardMode",void 0),e([b()],S.prototype,"isIntegratedMesh",void 0),e([b()],S.prototype,"polygonOffsetEnabled",void 0),e([b()],S.prototype,"ellipsoidMode",void 0),e([b()],S.prototype,"sceneHasOcludees",void 0),function(e){e[e.VERTEX=0]="VERTEX",e[e.GROUND=1]="GROUND",e[e.SCREEN_DERIVATIVE=2]="SCREEN_DERIVATIVE"}(N||(N={})),function(e){e[e.Opaque=0]="Opaque",e[e.Transparent=1]="Transparent",e[e.OpaqueAndTransparent=2]="OpaqueAndTransparent",e[e.IntegratedMesh=3]="IntegratedMesh"}(A||(A={}));class R extends f{constructor(){super(...arguments),this.doubleSided=!1,this.cullFace=w.Back,this.slicePlaneEnabled=!0}}e([b()],R.prototype,"doubleSided",void 0),e([b()],R.prototype,"cullFace",void 0),e([b()],R.prototype,"slicePlaneEnabled",void 0);class I extends f{constructor(){super(...arguments),this.externalColor=l(1,1,1,1),this.externalColorMixMode=h.Multiply,this.castShadows=j.All}get transparent(){return this.externalColor[3]<1?j.All:j.None}get opaqueOverride(){return this.externalColorMixMode===h.Replace&&1===this.externalColor[3]?j.All:j.None}get visible(){return this.externalColor[3]>0?j.All:j.None}get type(){return m.Uniform}}e([b({vectorOps:n})],I.prototype,"externalColor",void 0),e([b()],I.prototype,"externalColorMixMode",void 0),e([b()],I.prototype,"castShadows",void 0),function(e){e[e.All=0]="All",e[e.Some=1]="Some",e[e.None=2]="None"}(j||(j={}));class _ extends f{constructor(){super(...arguments),this.texture=null,this.transparent=j.None,this.opaqueOverride=j.None,this.castShadows=j.None}get type(){return m.Varying}}function k(e){switch(e){case M.Color:return O.Color;case M.Alpha:return O.Alpha;case M.Depth:return O.Depth;case M.Normal:return O.Normal}}e([b()],_.prototype,"texture",void 0),e([b()],_.prototype,"transparent",void 0),e([b()],_.prototype,"opaqueOverride",void 0),e([b()],_.prototype,"castShadows",void 0);export{R as CommonMaterialParameters,S as ComponentMaterial,j as ComponentParameterSummary,I as ComponentParametersUniform,_ as ComponentParametersVarying,N as ShadingNormalSource};
5
+ import{_ as e}from"../../../../../../chunks/tslib.es6.js";import{releaseMaybe as t,isSome as r}from"../../../../../../core/maybe.js";import{C as s}from"../../../../../../chunks/vec3.js";import{f as a}from"../../../../../../chunks/vec3f32.js";import{g as o,c as i,v as n}from"../../../../../../chunks/vec4.js";import{f as l}from"../../../../../../chunks/vec4f32.js";import{f as p}from"../../../../../../chunks/vec4f64.js";import{ColorMixModeEnum as h}from"../../../../layers/support/symbolColorUtils.js";import{ComponentTechniqueConfiguration as u,IntegratedMeshMode as c,ComponentTechnique as d}from"./ComponentTechnique.js";import{ComponentDataType as m}from"./shader/ComponentData.glsl.js";import{a as y}from"../../../../../../chunks/ComponentShader.glsl.js";import{VertexDiscardMode as v}from"./shader/VertexDiscardByOpacity.glsl.js";import{parameter as b,parameterBlock as T,MaterialBase as g,MaterialParameterBlock as f}from"../../../core/material/MaterialBase.js";import{RenderPassIdentifier as x,MaterialSubPass as M}from"../../../core/renderPasses/AllRenderPasses.js";import{ShaderOutput as O}from"../../../core/shaderLibrary/ShaderOutputOptions.js";import{NormalsDoubleSidedMode as P}from"../../../core/shaderLibrary/shading/Normals.glsl.js";import{defaultMaskAlphaCutoff as C}from"../../../core/shaderLibrary/util/AlphaDiscard.glsl.js";import{EllipsoidMode as q}from"../../../core/shaderLibrary/util/EllipsoidMode.js";import{AlphaDiscardMode as E,TransparencyPassType as w,CullFaceOptions as D}from"../../../lib/basicInterfaces.js";class N extends g{constructor(){super(...arguments),this.baseColor=l(1,1,1,1),this.usePBR=!1,this.hasParametersFromSource=!1,this.mrrFactors=a(1,1,.5),this.emissiveFactor=a(0,0,0),this.baseColorTexture=null,this.metallicRoughnessTexture=null,this.emissionTexture=null,this.occlusionTexture=null,this.normalTexture=null,this.overlayTexOffset=p(-1,-1,-1,-1),this.overlayTexScale=p(0,0,0,0),this.overlayColor=null,this.overlayHighlight=null,this.overlayNormal=null,this.objectOpacity=1,this.commonMaterialParameters=new R,this.componentParameters=new I,this.alphaCutoff=C,this.alphaDiscardMode=E.Opaque,this.isIntegratedMesh=!1,this.polygonOffsetEnabled=!1,this.ellipsoidMode=q.Earth,this.sceneHasOcludees=!1,this._techniqueConfig=new u}dispose(){this._technique=t(this._technique),this.baseColorTexture=null,this.metallicRoughnessTexture=null,this.emissionTexture=null,this.occlusionTexture=null,this.normalTexture=null}prepareTechnique(e,t,s){const a=this._techniqueConfig;if(a.hasVertexColors=s.colors,a.hasNormals=s.normals,a.vertexTextureCoordinates=s.textureCoordinates,a.usePBR=this.usePBR,a.hasMetalnessAndRoughnessTexture=r(this.metallicRoughnessTexture),a.hasEmissionTexture=r(this.emissionTexture),a.hasOcclusionTexture=r(this.occlusionTexture),a.hasNormalTexture=r(this.normalTexture),a.transparencyPassType=t.identifier===x.Material&&null!=t.transparencyPassType?t.transparencyPassType:w.NONE,a.multipassTerrainEnabled=t.identifier===x.Material&&null!=t.multipassTerrainParams&&t.multipassTerrainParams.multipassTerrainEnabled,a.cullAboveGround=t.identifier===x.Material&&null!=t.multipassTerrainParams&&t.multipassTerrainParams.cullAboveGround,a.ellipsoidMode=this.ellipsoidMode,this.dirty){a.componentData=this.componentParameters.type,a.cullFace=this.commonMaterialParameters.cullFace,a.doubleSidedMode=this.commonMaterialParameters.doubleSided?P.View:P.None,a.baseColorTexture=r(this.baseColorTexture),a.isSchematic=this.hasParametersFromSource&&!r(this.baseColorTexture);const e=this._computeWhichMaterialPass();a.blendingEnabled=e===A.Transparent||e===A.OpaqueAndTransparent,a.alphaDiscardMode=this.alphaDiscardMode,a.integratedMeshMode=this.isIntegratedMesh?this.overlayColor?this.overlayNormal?c.ColorOverlayWithWater:c.ColorOverlay:c.NoOverlay:c.None,a.polygonOffsetEnabled=this.polygonOffsetEnabled,this._setClean()}return a.slicePlaneEnabled=t.slicePlaneEnabled&&this.commonMaterialParameters.slicePlaneEnabled,t.identifier===x.ShadowMap?(a.output=O.Shadow,a.vertexDiscardMode=v.None):t.identifier===x.Highlight?(a.output=O.Highlight,a.vertexDiscardMode=v.None):(this._computeWhichMaterialPass()===A.OpaqueAndTransparent?a.vertexDiscardMode=t.transparent?v.Opaque:v.Transparent:a.vertexDiscardMode=v.None,a.output=k(t.subPass),t.subPass===M.Alpha&&(a.sceneHasOcludees=t.sceneHasOcludees),t.subPass===M.Color?(a.receiveAmbientOcclusion=t.ambientOcclusionEnabled,a.sceneHasOcludees=t.sceneHasOcludees,a.receiveShadows=t.shadowsEnabled,a.ssrEnabled=t.ssrParams.ssrEnabled):(a.receiveAmbientOcclusion=!1,a.receiveShadows=!1)),this._technique=e.releaseAndAcquire(d,a,this._technique),this._technique}submit(e,t){if(0===this.objectOpacity)return;const s=t.renderable.geometry,a=t.components,o=t.renderable.drawParameters,i=t.renderable.meta.cameraDepthSquared,n=a.geometryRanges,l=a.highlightRanges,p=a.defaultShadowMapRanges;switch(this._computeWhichMaterialPass()){case A.Opaque:e.materialOpaque.submitDraw(this,s,n,o,i);break;case A.Transparent:e.materialTransparent.submitDraw(this,s,n,o,i);break;case A.OpaqueAndTransparent:e.materialOpaque.submitDraw(this,s,n,o,i),e.materialTransparent.submitDraw(this,s,n,o,i);break;case A.IntegratedMesh:e.materialIntegratedMesh.submitDraw(this,s,n,o,i),this.overlayHighlight&&e.highlightIntegratedMesh.submitDraw(this,s,n,o,i)}const h=this.componentParameters.castShadows!==j.None;h&&e.shadowMap.submitDraw(this,s,n,o,i),r(l)&&(e.highlight.submitDraw(this,s,l,o,i),h&&e.highlightShadowMap.submitDraw(this,s,l,o,i)),h&&r(p)&&e.defaultShadowMap.submitDraw(this,s,p,o,i)}get attributeLocations(){return y}_computeWhichMaterialPass(){return this.isIntegratedMesh?A.IntegratedMesh:this.objectOpacity<1?A.Transparent:this.componentParameters.opaqueOverride===j.All?A.Opaque:this.baseColor[3]<1||this.alphaDiscardMode===E.Blend||this.alphaDiscardMode===E.MaskBlend?A.Transparent:this.componentParameters.transparent===j.None?A.Opaque:this.componentParameters.transparent===j.All?A.Transparent:A.OpaqueAndTransparent}}var S,A,j;e([b({vectorOps:n})],N.prototype,"baseColor",void 0),e([b()],N.prototype,"usePBR",void 0),e([b()],N.prototype,"hasParametersFromSource",void 0),e([b({vectorOps:s})],N.prototype,"mrrFactors",void 0),e([b({vectorOps:s})],N.prototype,"emissiveFactor",void 0),e([b({dispose:!0})],N.prototype,"baseColorTexture",void 0),e([b({dispose:!0})],N.prototype,"metallicRoughnessTexture",void 0),e([b({dispose:!0})],N.prototype,"emissionTexture",void 0),e([b({dispose:!0})],N.prototype,"occlusionTexture",void 0),e([b({dispose:!0})],N.prototype,"normalTexture",void 0),e([b({vectorOps:{equals:o,copy:i}})],N.prototype,"overlayTexOffset",void 0),e([b({vectorOps:{equals:o,copy:i}})],N.prototype,"overlayTexScale",void 0),e([b()],N.prototype,"overlayColor",void 0),e([b()],N.prototype,"overlayHighlight",void 0),e([b()],N.prototype,"overlayNormal",void 0),e([b()],N.prototype,"objectOpacity",void 0),e([T()],N.prototype,"commonMaterialParameters",void 0),e([T()],N.prototype,"componentParameters",void 0),e([b()],N.prototype,"alphaCutoff",void 0),e([b()],N.prototype,"alphaDiscardMode",void 0),e([b()],N.prototype,"isIntegratedMesh",void 0),e([b()],N.prototype,"polygonOffsetEnabled",void 0),e([b()],N.prototype,"ellipsoidMode",void 0),e([b()],N.prototype,"sceneHasOcludees",void 0),function(e){e[e.VERTEX=0]="VERTEX",e[e.GROUND=1]="GROUND",e[e.SCREEN_DERIVATIVE=2]="SCREEN_DERIVATIVE"}(S||(S={})),function(e){e[e.Opaque=0]="Opaque",e[e.Transparent=1]="Transparent",e[e.OpaqueAndTransparent=2]="OpaqueAndTransparent",e[e.IntegratedMesh=3]="IntegratedMesh"}(A||(A={}));class R extends f{constructor(){super(...arguments),this.doubleSided=!1,this.cullFace=D.Back,this.slicePlaneEnabled=!0}}e([b()],R.prototype,"doubleSided",void 0),e([b()],R.prototype,"cullFace",void 0),e([b()],R.prototype,"slicePlaneEnabled",void 0);class I extends f{constructor(){super(...arguments),this.externalColor=l(1,1,1,1),this.externalColorMixMode=h.Multiply,this.castShadows=j.All}get transparent(){return this.externalColor[3]<1?j.All:j.None}get opaqueOverride(){return this.externalColorMixMode===h.Replace&&1===this.externalColor[3]?j.All:j.None}get visible(){return this.externalColor[3]>0?j.All:j.None}get type(){return m.Uniform}}e([b({vectorOps:n})],I.prototype,"externalColor",void 0),e([b()],I.prototype,"externalColorMixMode",void 0),e([b()],I.prototype,"castShadows",void 0),function(e){e[e.All=0]="All",e[e.Some=1]="Some",e[e.None=2]="None"}(j||(j={}));class _ extends f{constructor(){super(...arguments),this.texture=null,this.transparent=j.None,this.opaqueOverride=j.None,this.castShadows=j.None}get type(){return m.Varying}}function k(e){switch(e){case M.Color:return O.Color;case M.Alpha:return O.Alpha;case M.Depth:return O.Depth;case M.Normal:return O.Normal}}e([b()],_.prototype,"texture",void 0),e([b()],_.prototype,"transparent",void 0),e([b()],_.prototype,"opaqueOverride",void 0),e([b()],_.prototype,"castShadows",void 0);export{R as CommonMaterialParameters,N as ComponentMaterial,j as ComponentParameterSummary,I as ComponentParametersUniform,_ as ComponentParametersVarying,S as ShadingNormalSource};