@arcgis/core 4.33.0-next.20250508 → 4.33.0-next.20250510

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 (431) hide show
  1. package/applications/SceneViewer/sceneViewerUtils.d.ts +2 -0
  2. package/applications/SceneViewer/sceneViewerUtils.js +1 -1
  3. package/arcade/featureset/support/RecentlyUsedCache.js +1 -1
  4. package/arcade/functions/aiServices.js +1 -1
  5. package/arcade.js +1 -1
  6. package/assets/components/assets/input-time-picker/t9n/messages.ar.json +1 -1
  7. package/assets/components/assets/input-time-picker/t9n/messages.bg.json +1 -1
  8. package/assets/components/assets/input-time-picker/t9n/messages.bs.json +1 -1
  9. package/assets/components/assets/input-time-picker/t9n/messages.ca.json +1 -1
  10. package/assets/components/assets/input-time-picker/t9n/messages.cs.json +1 -1
  11. package/assets/components/assets/input-time-picker/t9n/messages.da.json +1 -1
  12. package/assets/components/assets/input-time-picker/t9n/messages.de.json +1 -1
  13. package/assets/components/assets/input-time-picker/t9n/messages.el.json +1 -1
  14. package/assets/components/assets/input-time-picker/t9n/messages.en.json +1 -1
  15. package/assets/components/assets/input-time-picker/t9n/messages.es.json +1 -1
  16. package/assets/components/assets/input-time-picker/t9n/messages.et.json +1 -1
  17. package/assets/components/assets/input-time-picker/t9n/messages.fi.json +1 -1
  18. package/assets/components/assets/input-time-picker/t9n/messages.fr.json +1 -1
  19. package/assets/components/assets/input-time-picker/t9n/messages.he.json +1 -1
  20. package/assets/components/assets/input-time-picker/t9n/messages.hr.json +1 -1
  21. package/assets/components/assets/input-time-picker/t9n/messages.hu.json +1 -1
  22. package/assets/components/assets/input-time-picker/t9n/messages.id.json +1 -1
  23. package/assets/components/assets/input-time-picker/t9n/messages.it.json +1 -1
  24. package/assets/components/assets/input-time-picker/t9n/messages.ja.json +1 -1
  25. package/assets/components/assets/input-time-picker/t9n/messages.json +1 -1
  26. package/assets/components/assets/input-time-picker/t9n/messages.ko.json +1 -1
  27. package/assets/components/assets/input-time-picker/t9n/messages.lt.json +1 -1
  28. package/assets/components/assets/input-time-picker/t9n/messages.lv.json +1 -1
  29. package/assets/components/assets/input-time-picker/t9n/messages.nl.json +1 -1
  30. package/assets/components/assets/input-time-picker/t9n/messages.no.json +1 -1
  31. package/assets/components/assets/input-time-picker/t9n/messages.pl.json +1 -1
  32. package/assets/components/assets/input-time-picker/t9n/messages.pt-BR.json +1 -1
  33. package/assets/components/assets/input-time-picker/t9n/messages.pt-PT.json +1 -1
  34. package/assets/components/assets/input-time-picker/t9n/messages.ro.json +1 -1
  35. package/assets/components/assets/input-time-picker/t9n/messages.ru.json +1 -1
  36. package/assets/components/assets/input-time-picker/t9n/messages.sk.json +1 -1
  37. package/assets/components/assets/input-time-picker/t9n/messages.sl.json +1 -1
  38. package/assets/components/assets/input-time-picker/t9n/messages.sr.json +1 -1
  39. package/assets/components/assets/input-time-picker/t9n/messages.sv.json +1 -1
  40. package/assets/components/assets/input-time-picker/t9n/messages.th.json +1 -1
  41. package/assets/components/assets/input-time-picker/t9n/messages.tr.json +1 -1
  42. package/assets/components/assets/input-time-picker/t9n/messages.uk.json +1 -1
  43. package/assets/components/assets/input-time-picker/t9n/messages.vi.json +1 -1
  44. package/assets/components/assets/input-time-picker/t9n/messages.zh-CN.json +1 -1
  45. package/assets/components/assets/input-time-picker/t9n/messages.zh-HK.json +1 -1
  46. package/assets/components/assets/input-time-picker/t9n/messages.zh-TW.json +1 -1
  47. package/assets/esri/core/workers/RemoteClient.js +1 -1
  48. package/assets/esri/core/workers/chunks/06eb4832b6c86744e52e.js +1 -0
  49. package/assets/esri/core/workers/chunks/0766ecb677d667e5fb83.js +2 -0
  50. package/assets/esri/core/workers/chunks/{543eb46b55cacd6e1dbc.js.LICENSE.txt → 0766ecb677d667e5fb83.js.LICENSE.txt} +1 -1
  51. package/assets/esri/core/workers/chunks/{c607d618b64d3accecc4.js → 0aca29f7156b2b412f2e.js} +1 -1
  52. package/assets/esri/core/workers/chunks/170c346cf5a18adb25b0.js +1 -0
  53. package/assets/esri/core/workers/chunks/1c6542315390037053a6.js +1 -0
  54. package/assets/esri/core/workers/chunks/218a66d53f7cf4f285aa.js +2 -0
  55. package/assets/esri/core/workers/chunks/{d8dc922f7466300b668f.js.LICENSE.txt → 218a66d53f7cf4f285aa.js.LICENSE.txt} +2 -2
  56. package/assets/esri/core/workers/chunks/{037af6379f3e9278633b.js → 243dc74ec62891ba1ef7.js} +1 -1
  57. package/assets/esri/core/workers/chunks/253bcc3cc7bc4c2dc6ea.js +1 -0
  58. package/assets/esri/core/workers/chunks/{d874d24568b1acedebc4.js → 297d2c0a9d3f1e978318.js} +1 -1
  59. package/assets/esri/core/workers/chunks/{f74b5659b6496a5c4c0c.js → 2e0af748eba93f3ea6cb.js} +1 -1
  60. package/assets/esri/core/workers/chunks/3596540ef49e5330ceb2.js +2 -0
  61. package/assets/esri/core/workers/chunks/{7b4523ab392966624d97.js.LICENSE.txt → 3596540ef49e5330ceb2.js.LICENSE.txt} +1 -7
  62. package/assets/esri/core/workers/chunks/{a22c88b0a525e602dce0.js → 3d0e09ef78dc2fd6957a.js} +1 -1
  63. package/assets/esri/core/workers/chunks/4bd5cbf6e0be2fc7e84d.js +1 -0
  64. package/assets/esri/core/workers/chunks/4feb774f123da26e9f2a.js +1 -0
  65. package/assets/esri/core/workers/chunks/{ee1d104e2bcc5d808fa4.js → 5228fc7fcdf57f44781e.js} +1 -1
  66. package/assets/esri/core/workers/chunks/54f4a1131f99468db076.js +1 -0
  67. package/assets/esri/core/workers/chunks/{49c968e91c3c48aaa110.js → 5583d18032ed8bc17c74.js} +1 -1
  68. package/assets/esri/core/workers/chunks/5e7f35bf1aab93cb1c52.js +1 -0
  69. package/assets/esri/core/workers/chunks/{69f7fe6c58e4931597f6.js → 631205dc4d73d49ec9ed.js} +1 -1
  70. package/assets/esri/core/workers/chunks/6e12900a9f4c3c9941ec.js +1 -0
  71. package/assets/esri/core/workers/chunks/7e8f78b96d43c224c7b6.js +1 -0
  72. package/assets/esri/core/workers/chunks/{e46c05ef7272c7f1f70c.js → 83d6a1b3db7d364d156b.js} +1 -1
  73. package/assets/esri/core/workers/chunks/8a87c181b85d0b86b9bb.js.LICENSE.txt +1 -1
  74. package/assets/esri/core/workers/chunks/90ae15ce22a49bd84876.js +2 -0
  75. package/assets/esri/core/workers/chunks/{ac9c6779771ec855da79.js.LICENSE.txt → 90ae15ce22a49bd84876.js.LICENSE.txt} +3 -3
  76. package/assets/esri/core/workers/chunks/92cbe9af8a6c061bfb57.js +346 -0
  77. package/assets/esri/core/workers/chunks/{9aedd7874da7c63865d6.js → 93cc26e5636040fdc0b8.js} +1 -1
  78. package/assets/esri/core/workers/chunks/{77c7b7c4426c2b1a5b42.js → 9fc35ec8185beba96715.js} +1 -1
  79. package/assets/esri/core/workers/chunks/a1d697e2be1e892a666a.js +1 -0
  80. package/assets/esri/core/workers/chunks/{4f627eb62caee760215a.js → a1f27c4f4b5ef3e359f7.js} +1 -1
  81. package/assets/esri/core/workers/chunks/a31658f544ac6e1801d6.js +1 -0
  82. package/assets/esri/core/workers/chunks/{3a205f87f100832ef9f5.js → a5e746e10239a3bfe237.js} +1 -1
  83. package/assets/esri/core/workers/chunks/a6bcae413e62cd879b46.js +1 -0
  84. package/assets/esri/core/workers/chunks/{59d4c41172e921922cac.js → a8b42d8c0b76c234c09f.js} +100 -62
  85. package/assets/esri/core/workers/chunks/b4f38fe9cc948a39ad87.js +2 -0
  86. package/assets/esri/core/workers/chunks/{ce9de24cb96b56d20562.js.LICENSE.txt → b4f38fe9cc948a39ad87.js.LICENSE.txt} +1 -1
  87. package/assets/esri/core/workers/chunks/{752ef63d910852b7be44.js → c16e0da7a19310c71e8b.js} +1 -1
  88. package/assets/esri/core/workers/chunks/d22f91bc16a7641bcbef.js +1 -0
  89. package/assets/esri/core/workers/chunks/d551f70560a2b1ef5696.js +1 -0
  90. package/assets/esri/core/workers/chunks/d7b640f7a181bd26c7c7.js +1 -0
  91. package/assets/esri/core/workers/chunks/{2bdbf678d4f013543dbb.js → d971571a957de70d5a8d.js} +1 -1
  92. package/assets/esri/core/workers/chunks/dc3a6beb3028009b3c23.js +1 -0
  93. package/assets/esri/core/workers/chunks/e0dc8794343c2a949ffb.js +2 -0
  94. package/assets/esri/core/workers/chunks/{670a66617249f2d15a62.js.LICENSE.txt → e0dc8794343c2a949ffb.js.LICENSE.txt} +1 -1
  95. package/assets/esri/core/workers/chunks/e3c1aea34ece8336dae1.js +1 -0
  96. package/assets/esri/core/workers/chunks/e483d2f169e51a361742.js +1 -0
  97. package/assets/esri/core/workers/chunks/{a50cb1fc8c4c585c0e11.js → ec8e8048b3df2c92008d.js} +1 -1
  98. package/assets/esri/core/workers/chunks/f6a1fec33b0d81acce61.js +1 -0
  99. package/assets/esri/core/workers/chunks/f7ab3511f6627f467796.js +1 -0
  100. package/assets/esri/core/workers/chunks/{1eef9cf19634c038b59b.js → f98689562017583f73ee.js} +1 -1
  101. package/assets/esri/core/workers/chunks/fb2e28e6a87956267d1c.js +66 -0
  102. package/assets/esri/core/workers/chunks/fbcd94f60f92257a7303.js +2 -0
  103. package/assets/esri/core/workers/chunks/{c2594024d72133d3ed7b.js.LICENSE.txt → fbcd94f60f92257a7303.js.LICENSE.txt} +1 -1
  104. package/assets/esri/core/workers/chunks/fda48126f67e80034404.js +1 -0
  105. package/assets/esri/themes/base/widgets/_FeatureTable.scss +1 -0
  106. package/assets/esri/themes/dark/main.css +1 -1
  107. package/assets/esri/themes/light/main.css +1 -1
  108. package/assets/esri/themes/light/view.css +1 -1
  109. package/assets/esri/widgets/ShadowCast/t9n/ShadowCast_ar.json +1 -1
  110. package/assets/esri/widgets/ShadowCast/t9n/ShadowCast_bg.json +1 -1
  111. package/assets/esri/widgets/ShadowCast/t9n/ShadowCast_bs.json +1 -1
  112. package/assets/esri/widgets/ShadowCast/t9n/ShadowCast_ca.json +1 -1
  113. package/assets/esri/widgets/ShadowCast/t9n/ShadowCast_cs.json +1 -1
  114. package/assets/esri/widgets/ShadowCast/t9n/ShadowCast_da.json +1 -1
  115. package/assets/esri/widgets/ShadowCast/t9n/ShadowCast_de.json +1 -1
  116. package/assets/esri/widgets/ShadowCast/t9n/ShadowCast_el.json +1 -1
  117. package/assets/esri/widgets/ShadowCast/t9n/ShadowCast_es.json +1 -1
  118. package/assets/esri/widgets/ShadowCast/t9n/ShadowCast_et.json +1 -1
  119. package/assets/esri/widgets/ShadowCast/t9n/ShadowCast_fi.json +1 -1
  120. package/assets/esri/widgets/ShadowCast/t9n/ShadowCast_fr.json +1 -1
  121. package/assets/esri/widgets/ShadowCast/t9n/ShadowCast_he.json +1 -1
  122. package/assets/esri/widgets/ShadowCast/t9n/ShadowCast_hr.json +1 -1
  123. package/assets/esri/widgets/ShadowCast/t9n/ShadowCast_hu.json +1 -1
  124. package/assets/esri/widgets/ShadowCast/t9n/ShadowCast_id.json +1 -1
  125. package/assets/esri/widgets/ShadowCast/t9n/ShadowCast_it.json +1 -1
  126. package/assets/esri/widgets/ShadowCast/t9n/ShadowCast_ja.json +1 -1
  127. package/assets/esri/widgets/ShadowCast/t9n/ShadowCast_ko.json +1 -1
  128. package/assets/esri/widgets/ShadowCast/t9n/ShadowCast_lt.json +1 -1
  129. package/assets/esri/widgets/ShadowCast/t9n/ShadowCast_lv.json +1 -1
  130. package/assets/esri/widgets/ShadowCast/t9n/ShadowCast_nl.json +1 -1
  131. package/assets/esri/widgets/ShadowCast/t9n/ShadowCast_no.json +1 -1
  132. package/assets/esri/widgets/ShadowCast/t9n/ShadowCast_pl.json +1 -1
  133. package/assets/esri/widgets/ShadowCast/t9n/ShadowCast_pt-BR.json +1 -1
  134. package/assets/esri/widgets/ShadowCast/t9n/ShadowCast_pt-PT.json +1 -1
  135. package/assets/esri/widgets/ShadowCast/t9n/ShadowCast_ro.json +1 -1
  136. package/assets/esri/widgets/ShadowCast/t9n/ShadowCast_ru.json +1 -1
  137. package/assets/esri/widgets/ShadowCast/t9n/ShadowCast_sk.json +1 -1
  138. package/assets/esri/widgets/ShadowCast/t9n/ShadowCast_sl.json +1 -1
  139. package/assets/esri/widgets/ShadowCast/t9n/ShadowCast_sr.json +1 -1
  140. package/assets/esri/widgets/ShadowCast/t9n/ShadowCast_sv.json +1 -1
  141. package/assets/esri/widgets/ShadowCast/t9n/ShadowCast_th.json +1 -1
  142. package/assets/esri/widgets/ShadowCast/t9n/ShadowCast_tr.json +1 -1
  143. package/assets/esri/widgets/ShadowCast/t9n/ShadowCast_uk.json +1 -1
  144. package/assets/esri/widgets/ShadowCast/t9n/ShadowCast_vi.json +1 -1
  145. package/assets/esri/widgets/ShadowCast/t9n/ShadowCast_zh-CN.json +1 -1
  146. package/assets/esri/widgets/ShadowCast/t9n/ShadowCast_zh-HK.json +1 -1
  147. package/assets/esri/widgets/ShadowCast/t9n/ShadowCast_zh-TW.json +1 -1
  148. package/chunks/HUDMaterial.glsl.js +1 -1
  149. package/chunks/Laserlines.glsl.js +2 -2
  150. package/chunks/aiServices.js +1 -1
  151. package/chunks/boundedPlane.js +1 -1
  152. package/chunks/cameraUtilsSpherical.js +1 -1
  153. package/chunks/vec32.js +1 -1
  154. package/core/has.js +1 -1
  155. package/core/libs/gl-matrix-2/math/mat4.js +1 -1
  156. package/core/libs/gl-matrix-2/math/vec3.js +1 -1
  157. package/core/mapCollectionUtils.js +1 -1
  158. package/core/perspectiveUtils.js +1 -1
  159. package/core/sql/StandardizedFunctions.js +1 -1
  160. package/core/sql/WhereGrammar.js +1 -1
  161. package/geometry/support/axisAngleDegrees.js +1 -1
  162. package/geometry/support/curves/bezierCurveUtils.js +1 -1
  163. package/geometry/support/curves/circleUtils.js +1 -1
  164. package/geometry/support/curves/curveExtent.js +5 -0
  165. package/geometry/support/curves/curveLength.js +5 -0
  166. package/geometry/support/curves/densifyCurvedGeometry.js +1 -1
  167. package/geometry/support/curves/ellipticArc4Utils.js +1 -1
  168. package/geometry/support/curves/ellipticArc7Utils.js +1 -1
  169. package/geometry/support/curves/mathUtils.js +1 -1
  170. package/geometry/support/curves/splitCurveAtPoint.js +1 -1
  171. package/geometry/support/frustum.js +1 -1
  172. package/geometry/support/meshUtils/External.js +1 -1
  173. package/geometry/support/meshUtils/exporters/gltf/gltf.js +1 -1
  174. package/geometry/support/meshUtils/loadExternal.js +1 -1
  175. package/geometry/support/meshUtils/primitives.js +1 -1
  176. package/geometry/support/meshUtils/projection.js +1 -1
  177. package/geometry/support/meshUtils/rotate.js +1 -1
  178. package/geometry/support/meshUtils/scale.js +1 -1
  179. package/geometry/support/meshUtils/vertexSpaceConversion.js +1 -1
  180. package/geometry/support/meshVertexSpaceUtils.js +1 -1
  181. package/geometry/support/plane.js +1 -1
  182. package/interfaces.d.ts +401 -17
  183. package/layers/IntegratedMesh3DTilesLayer.js +1 -1
  184. package/layers/LinkChartLayer.js +1 -1
  185. package/layers/SceneLayer.js +1 -1
  186. package/layers/VideoLayer.js +1 -1
  187. package/layers/VoxelWasmPerSceneView.js +1 -1
  188. package/layers/graphics/sources/FeatureLayerSource.js +1 -1
  189. package/layers/graphics/sources/MemorySource.js +1 -1
  190. package/layers/graphics/sources/support/uploadAssets.js +1 -1
  191. package/layers/video/VideoCameraSensorModel.js +1 -1
  192. package/layers/video/VideoController.js +1 -1
  193. package/layers/voxel/VoxelVolume.js +1 -1
  194. package/layers/voxel/voxelPlaneUtils.js +1 -1
  195. package/package.json +1 -1
  196. package/rest/knowledgeGraph/wasmInterface/wasmToUpdateResponseFactories.js +1 -1
  197. package/rest/support/meshFeatureSet.js +1 -1
  198. package/smartMapping/renderers/size.js +1 -1
  199. package/smartMapping/renderers/support/spikeUtils.js +1 -1
  200. package/support/revision.js +1 -1
  201. package/symbols/cim/cimAnalyzer.js +1 -1
  202. package/views/2d/engine/webgl/AFeatureTile.js +1 -1
  203. package/views/2d/engine/webgl/shaderGraph/techniques/fill/ComplexOutlineFillMeshWriter.js +1 -1
  204. package/views/2d/engine/webgl/shaderGraph/techniques/fill/OutlineFillMeshWriter.js +1 -1
  205. package/views/2d/engine/webgl/shaderGraph/techniques/fill/PatternOutlineFillMeshWriter.js +1 -1
  206. package/views/2d/engine/webgl/shaderGraph/techniques/mesh/MeshWriter.js +1 -1
  207. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/OutlineFillShader.js +1 -1
  208. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/constants.js +1 -1
  209. package/views/2d/layers/features/layerAdapters/FeatureLayerAdapter.js +1 -1
  210. package/views/2d/layers/features/layerAdapters/OrientedImageryLayerAdapter.js +1 -1
  211. package/views/2d/layers/features/layerAdapters/SubtypeGroupLayerAdapter.js +1 -1
  212. package/views/2d/layers/features/layerAdapters/featureServiceUtils.js +1 -1
  213. package/views/2d/layers/features/schema/processor/symbols/ComplexSymbolSchema.js +1 -1
  214. package/views/2d/layers/features/schema/processor/symbols/SymbolSchema.js +1 -1
  215. package/views/2d/layers/features/sources/FeatureSource.js +1 -1
  216. package/views/3d/analysis/AreaMeasurement/support/MeasurementData.js +1 -1
  217. package/views/3d/analysis/Dimension/DimensionTool.js +1 -1
  218. package/views/3d/analysis/Dimension/lengthDimensionConstraintUtils.js +1 -1
  219. package/views/3d/analysis/Dimension/lengthDimensionManipulatorUtils.js +1 -1
  220. package/views/3d/analysis/Dimension/lengthDimensionUtils.js +1 -1
  221. package/views/3d/analysis/DimensionAnalysisView3D.js +1 -1
  222. package/views/3d/analysis/LineOfSight/LineOfSightRayIntersector.js +1 -1
  223. package/views/3d/analysis/LineOfSight/LineOfSightTool.js +1 -1
  224. package/views/3d/analysis/Viewshed/ViewshedComputedData.js +1 -1
  225. package/views/3d/analysis/Viewshed/ViewshedTool.js +1 -1
  226. package/views/3d/analysis/Viewshed/ViewshedVisualization.js +1 -1
  227. package/views/3d/analysis/Viewshed/viewshedToolUtils.js +1 -1
  228. package/views/3d/analysis/ViewshedAnalysisView3D.js +1 -1
  229. package/views/3d/animation/pointToPoint/Camera.js +1 -1
  230. package/views/3d/camera/constraintUtils/distance.js +1 -1
  231. package/views/3d/camera/intersectionUtils.js +1 -1
  232. package/views/3d/interactive/Manipulator3D.js +1 -1
  233. package/views/3d/interactive/editingTools/dragEventPipeline3D.js +1 -1
  234. package/views/3d/interactive/editingTools/reshape/edgeOffsetUtils.js +1 -1
  235. package/views/3d/interactive/visualElements/DrapedVisualElementResources.js +1 -1
  236. package/views/3d/interactive/visualElements/ExtendedLineVisualElement.js +1 -1
  237. package/views/3d/interactive/visualElements/ParallelLineVisualElement.js +1 -1
  238. package/views/3d/interactive/visualElements/RightAngleQuadVisualElement.js +1 -1
  239. package/views/3d/layers/DynamicLayerView3D.js +1 -1
  240. package/views/3d/layers/I3SMeshView3D.js +1 -1
  241. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  242. package/views/3d/layers/PointCloudWorker.js +1 -1
  243. package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
  244. package/views/3d/layers/SceneLayerView3D.js +1 -1
  245. package/views/3d/layers/graphics/Deconflictor.js +1 -1
  246. package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
  247. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  248. package/views/3d/layers/graphics/Graphics3DObjectSymbolLayer.js +1 -1
  249. package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.js +1 -1
  250. package/views/3d/layers/graphics/Graphics3DTextSymbolLayer.js +1 -1
  251. package/views/3d/layers/graphics/GraphicsDeconflictor.js +1 -1
  252. package/views/3d/layers/graphics/LabelDeconflictor.js +1 -1
  253. package/views/3d/layers/graphics/Labeler.js +1 -1
  254. package/views/3d/layers/graphics/objectResourceUtils.js +1 -1
  255. package/views/3d/layers/graphics/pipeline/Feature3DPipelineWorker.js +1 -1
  256. package/views/3d/layers/graphics/pipeline/rendering/DirectRenderer.js +1 -1
  257. package/views/3d/layers/i3s/I3SClientNodeLoader.js +1 -1
  258. package/views/3d/layers/i3s/I3SGeometryUtil.js +1 -1
  259. package/views/3d/layers/i3s/I3SIntersectionHandler.js +1 -1
  260. package/views/3d/layers/i3s/I3SMeshViewFilter.js +1 -1
  261. package/views/3d/layers/i3s/I3SQueryEngine.js +1 -1
  262. package/views/3d/layers/i3s/I3SQueryFeatureAdapter.js +1 -1
  263. package/views/3d/layers/i3s/I3SQueryResultGeometry.js +5 -0
  264. package/views/3d/layers/i3s/I3SViewportQueries.js +1 -1
  265. package/views/3d/layers/i3s/Intersector.js +1 -1
  266. package/views/3d/layers/i3s/LayerElevationProvider.js +1 -1
  267. package/views/3d/layers/i3s/PointCloudRenderer.js +1 -1
  268. package/views/3d/layers/support/FastSymbolUpdates.js +1 -1
  269. package/views/3d/layers/support/StageLayerElevationProvider.js +1 -1
  270. package/views/3d/layers/support/Tiles3DIntersectionHandler.js +1 -1
  271. package/views/3d/state/Frustum.js +1 -1
  272. package/views/3d/state/controllers/GamepadKeyboardController.js +1 -1
  273. package/views/3d/state/controllers/PinchAndPanControllerGlobal.js +1 -1
  274. package/views/3d/state/controllers/PinchAndPanControllerLocal.js +1 -1
  275. package/views/3d/state/controllers/PointToPointAnimationController.js +1 -1
  276. package/views/3d/state/controllers/ZoomControllerLocal.js +1 -1
  277. package/views/3d/state/controllers/ZoomStepControllerGlobal.js +1 -1
  278. package/views/3d/state/controllers/ZoomStepControllerLocal.js +1 -1
  279. package/views/3d/state/controllers/momentum/ZoomPlanarMomentumController.js +1 -1
  280. package/views/3d/state/helpers/SceneIntersectionHelper.js +1 -1
  281. package/views/3d/support/FrustumExtentIntersection.js +1 -1
  282. package/views/3d/support/hitTest.js +1 -1
  283. package/views/3d/support/orientedBoundingBox.js +1 -1
  284. package/views/3d/support/pointsOfInterest/CameraOnSurface.js +1 -1
  285. package/views/3d/support/pointsOfInterest/CenterOnSurface.js +1 -1
  286. package/views/3d/support/pointsOfInterest/PointsOfInterest.js +1 -1
  287. package/views/3d/support/viewpointUtils.js +1 -1
  288. package/views/3d/terrain/Intersector.js +1 -1
  289. package/views/3d/terrain/OverlayManager.js +1 -1
  290. package/views/3d/terrain/TerrainRenderer.js +1 -1
  291. package/views/3d/terrain/TerrainSurface.js +1 -1
  292. package/views/3d/webgl/ManagedDepthTexture.js +1 -1
  293. package/views/3d/webgl/ManagedFBOResource.js +1 -1
  294. package/views/3d/webgl/RenderCamera.js +1 -1
  295. package/views/3d/webgl-engine/collections/Component/DepthRange.js +1 -1
  296. package/views/3d/webgl-engine/collections/Component/ElevationAgnosticBVH.js +1 -1
  297. package/views/3d/webgl-engine/collections/Component/IntersectionGeometry.js +1 -1
  298. package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
  299. package/views/3d/webgl-engine/core/FBOCache.js +1 -1
  300. package/views/3d/webgl-engine/core/FBOCacheFormats.js +1 -1
  301. package/views/3d/webgl-engine/effects/bloom/BloomRenderNode.js +1 -1
  302. package/views/3d/webgl-engine/effects/focusArea/FocusAreaColorNode.js +1 -1
  303. package/views/3d/webgl-engine/effects/focusArea/FocusAreaMaskNode.js +1 -1
  304. package/views/3d/webgl-engine/effects/geometry/RenderOccludedRenderNode.js +1 -1
  305. package/views/3d/webgl-engine/effects/laserlines/LaserLineRenderer.js +1 -1
  306. package/views/3d/webgl-engine/effects/laserlines/LaserlinePathTechniqueConfiguration.js +1 -1
  307. package/views/3d/webgl-engine/lib/DefaultVertexAttributeLocations.js +1 -1
  308. package/views/3d/webgl-engine/lib/GPUPointOcclusionQuery.js +1 -1
  309. package/views/3d/webgl-engine/lib/HUDIntersectorResult.js +5 -0
  310. package/views/3d/webgl-engine/lib/Intersector.js +1 -1
  311. package/views/3d/webgl-engine/lib/IntersectorInterfaces.js +1 -1
  312. package/views/3d/webgl-engine/lib/IntersectorResult.js +5 -0
  313. package/views/3d/webgl-engine/lib/IntersectorTarget.js +1 -1
  314. package/views/3d/webgl-engine/lib/IntersectorType.js +5 -0
  315. package/views/3d/webgl-engine/lib/MainFramebuffer.js +1 -1
  316. package/views/3d/webgl-engine/lib/Material.js +1 -1
  317. package/views/3d/webgl-engine/lib/Normals.js +1 -1
  318. package/views/3d/webgl-engine/lib/Object3D.js +1 -1
  319. package/views/3d/webgl-engine/lib/ObjectIntersectorResult.js +5 -0
  320. package/views/3d/webgl-engine/lib/ObjectTarget.js +5 -0
  321. package/views/3d/webgl-engine/lib/PathGeometryData.js +1 -1
  322. package/views/3d/webgl-engine/lib/PathVertex.js +1 -1
  323. package/views/3d/webgl-engine/lib/RayIntersections.js +1 -1
  324. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  325. package/views/3d/webgl-engine/lib/ShadowMap.js +1 -1
  326. package/views/3d/webgl-engine/lib/SortedRenderGeometryRenderer.js +1 -1
  327. package/views/3d/webgl-engine/lib/ViewshedShadowMap.js +1 -1
  328. package/views/3d/webgl-engine/lib/edgeRendering/edgePreprocessing.js +1 -1
  329. package/views/3d/webgl-engine/lib/intersectorUtils.js +1 -1
  330. package/views/3d/webgl-engine/lib/intersectorUtilsConversions.js +1 -1
  331. package/views/3d/webgl-engine/lib/lodRendering/Intersector.js +1 -1
  332. package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
  333. package/views/3d/webgl-engine/lib/lodRendering/LodResources.js +1 -1
  334. package/views/3d/webgl-engine/lighting/SphericalHarmonics.js +1 -1
  335. package/views/3d/webgl-engine/materials/DefaultBufferWriter.js +1 -1
  336. package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
  337. package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
  338. package/views/3d/webgl-engine/materials/HeatmapDensityMaterial.js +1 -1
  339. package/views/3d/webgl-engine/materials/LineCalloutMaterial.js +1 -1
  340. package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
  341. package/views/3d/webgl-engine/materials/MeasurementArrowMaterial.js +1 -1
  342. package/views/3d/webgl-engine/materials/NativeLineMaterial.js +1 -1
  343. package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
  344. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  345. package/views/3d/webgl-engine/materials/ShadedColorMaterial.js +1 -1
  346. package/views/3d/webgl-engine/materials/TriangleMaterial.js +1 -1
  347. package/views/3d/webgl-engine/materials/pbrUtils.js +1 -1
  348. package/views/3d/webgl-engine/shaders/CompositingTechniqueConfiguration.js +1 -1
  349. package/views/FocusArea.js +1 -1
  350. package/views/FocusAreaOutline.js +5 -0
  351. package/views/FocusAreaOutlineItem.js +5 -0
  352. package/views/FocusAreas.js +1 -1
  353. package/views/FocusAreasUtils.js +5 -0
  354. package/views/FocusAreasView.js +5 -0
  355. package/views/SceneView.js +1 -1
  356. package/views/analysis/DimensionAnalysisView.js +1 -1
  357. package/views/draw/support/surfaceCoordinateSystems.js +1 -1
  358. package/views/interactive/ToolIntersector.js +1 -1
  359. package/views/interactive/editGeometry/operations/OffsetEdgeVertex.js +1 -1
  360. package/views/interactive/keybindings.js +1 -1
  361. package/views/interactive/sketch/constraints.js +1 -1
  362. package/views/interactive/snapping/candidates/ParallelLineSnappingCandidate.js +1 -1
  363. package/views/interactive/snapping/hints/IntersectionSnappingHint.js +1 -1
  364. package/views/interactive/snapping/hints/LineSnappingHint.js +1 -1
  365. package/views/interactive/snapping/hints/ParallelSnappingHint.js +1 -1
  366. package/views/interactive/snapping/hints/PointSnappingHint.js +1 -1
  367. package/views/interactive/snapping/hints/RightAngleSnappingHint.js +1 -1
  368. package/views/interactive/tooltip/tooltipCommonUtils.js +1 -1
  369. package/views/layers/DimensionLayerView.js +1 -1
  370. package/views/support/angularMeasurementUtils.js +1 -1
  371. package/views/support/geometry3dUtils.js +1 -1
  372. package/webdoc/IPSInfo.js +1 -1
  373. package/webdoc/ips/AppleIPSProperties.d.ts +4 -0
  374. package/webdoc/ips/AppleIPSProperties.js +5 -0
  375. package/webdoc/ips/Configuration.d.ts +4 -0
  376. package/webdoc/ips/Configuration.js +5 -0
  377. package/webdoc/ips/GNSSProperties.d.ts +4 -0
  378. package/webdoc/ips/GNSSProperties.js +5 -0
  379. package/webdoc/ips/PathSnappingProperties.d.ts +4 -0
  380. package/webdoc/ips/PathSnappingProperties.js +5 -0
  381. package/webdoc/ips/SmoothingProperties.d.ts +4 -0
  382. package/webdoc/ips/SmoothingProperties.js +5 -0
  383. package/widgets/BasemapLayerList.js +1 -1
  384. package/widgets/BatchAttributeForm.js +1 -1
  385. package/widgets/ElevationProfile/ElevationProfileLineView.js +1 -1
  386. package/widgets/FeatureForm/FeatureFormUtilityNetworkAssociations/UtilityNetworkAssociationSettings.js +1 -1
  387. package/widgets/FeatureForm.js +1 -1
  388. package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
  389. package/widgets/FeatureTable.js +1 -1
  390. package/widgets/Legend/support/sizeRampUtils.js +1 -1
  391. package/widgets/UtilityNetworkTrace/UtilityNetworkTraceFeature.js +1 -1
  392. package/widgets/UtilityNetworkTrace.js +1 -1
  393. package/widgets/UtilityNetworkValidateTopology.js +1 -1
  394. package/widgets/VideoPlayer/components/MetadataSection.js +1 -1
  395. package/widgets/VideoPlayer/components/SettingsButton.js +1 -1
  396. package/widgets/support/FilterBuilder.js +1 -1
  397. package/widgets/support/Selector2D/SelectionOperation.js +1 -1
  398. package/widgets/support/SketchTooltipControls.js +1 -1
  399. package/widgets/support/SnappingControls.js +1 -1
  400. package/assets/esri/core/workers/chunks/094300acbd24085cb063.js +0 -1
  401. package/assets/esri/core/workers/chunks/0c338364cb55afdbd580.js +0 -1
  402. package/assets/esri/core/workers/chunks/2da01fe20200b6d74851.js +0 -1
  403. package/assets/esri/core/workers/chunks/35c996f6fbff165b03f4.js +0 -1
  404. package/assets/esri/core/workers/chunks/3a517393619af3639b83.js +0 -1
  405. package/assets/esri/core/workers/chunks/45d64b72b7e93e9c64d7.js +0 -1
  406. package/assets/esri/core/workers/chunks/46104db7f77952bb6c12.js +0 -1
  407. package/assets/esri/core/workers/chunks/47bbfc10c2a3b9e4bdd6.js +0 -1
  408. package/assets/esri/core/workers/chunks/49f0e53b3c9ba8451442.js +0 -1
  409. package/assets/esri/core/workers/chunks/543eb46b55cacd6e1dbc.js +0 -2
  410. package/assets/esri/core/workers/chunks/5e0118a030cf741f78c6.js +0 -319
  411. package/assets/esri/core/workers/chunks/670a66617249f2d15a62.js +0 -2
  412. package/assets/esri/core/workers/chunks/6b5274d46a155d65dff1.js +0 -39
  413. package/assets/esri/core/workers/chunks/74187c771ee7083d1db7.js +0 -1
  414. package/assets/esri/core/workers/chunks/7b4523ab392966624d97.js +0 -2
  415. package/assets/esri/core/workers/chunks/7c2ec96749972e0b8a13.js +0 -1
  416. package/assets/esri/core/workers/chunks/7ffc1db10b00754398e8.js +0 -1
  417. package/assets/esri/core/workers/chunks/81546c6141d564ed59c9.js +0 -1
  418. package/assets/esri/core/workers/chunks/852dd5af8e704613310a.js +0 -1
  419. package/assets/esri/core/workers/chunks/ac9c6779771ec855da79.js +0 -2
  420. package/assets/esri/core/workers/chunks/bbff052a991a2dc36960.js +0 -1
  421. package/assets/esri/core/workers/chunks/bcab8b9ce2f9d2ebaae7.js +0 -1
  422. package/assets/esri/core/workers/chunks/bf190d672dcbaedc1a41.js +0 -1
  423. package/assets/esri/core/workers/chunks/c255c9279815359fdce5.js +0 -1
  424. package/assets/esri/core/workers/chunks/c2594024d72133d3ed7b.js +0 -2
  425. package/assets/esri/core/workers/chunks/ce9de24cb96b56d20562.js +0 -2
  426. package/assets/esri/core/workers/chunks/d8dc922f7466300b668f.js +0 -2
  427. package/assets/esri/core/workers/chunks/d9948763423784b68c09.js +0 -1
  428. package/assets/esri/core/workers/chunks/dbf6011dd7933f02d41d.js +0 -66
  429. package/assets/esri/core/workers/chunks/e4e9dd635bdef18d0bd5.js +0 -1
  430. package/assets/esri/core/workers/chunks/e69f2e3c2d5e71fbb42f.js +0 -1
  431. package/assets/esri/core/workers/chunks/f61632c06c05b72e7017.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.33/esri/copyright.txt for details.
4
4
  */
5
- import{a as t,i as n,c as o,h as i,n as e}from"../../../../chunks/vec32.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{setMin as c,create as r,setMax as f}from"../../../../geometry/support/aaBoundingBox.js";import{GeometryType as a}from"./IntersectableGeometry.js";import{assert as u}from"./Util.js";import{VertexAttribute as l}from"./VertexAttribute.js";class h{constructor(t=!1,n=!0){this.isVerticalRay=t,this.normalRequired=n}}const m=r();function p(n,o,i,e,s,c){if(!n.visible)return;const r=t(S,e,i),f=(t,n,o)=>{c(t,o,n,!1)},m=new h(!1,o.options.normalRequired);if(n.boundingInfo){u(n.type===a.Mesh);const t=o.tolerance;b(n.boundingInfo,i,r,t,s,m,f)}else{const t=n.attributes.get(l.POSITION),o=t.indices;q(i,r,0,o.length/3,o,t.data,t.stride,s,m,f)}}const M=s();function b(t,n,o,i,e,s,r){if(null==t)return;const a=w(o,M);if(c(m,t.bbMin),f(m,t.bbMax),null!=e&&e.applyToAabb(m),C(m,n,a,i)){const{primitiveIndices:c,position:f}=t,a=c?c.length:f.indices.length/3;if(a>N){const c=t.getChildren();if(void 0!==c){for(const t of c)b(t,n,o,i,e,s,r);return}}V(n,o,0,a,f.indices,f.data,f.stride,c,e,s,r)}}const d=s();function x(n,o,i,e,s,c,r,f,a){const{data:u,stride:l}=c;q(n,t(S,o,n),i,e,s,u,l,r,f,a)}function g(t,n,o,i,e,s,c,r,f,a=null,u=0){const l=t[0],h=t[1],m=t[2],p=n[0],M=n[1],b=n[2];for(let x=o;x<i;++x){const t=u+(a?a[x]:x),n=3*t,o=c*e[n],i=s[o],g=s[o+1],y=s[o+2],T=c*e[n+1],V=s[T],q=s[T+1],j=s[T+2],I=c*e[n+2],v=V-i,A=q-g,B=j-y,O=s[I]-i,k=s[I+1]-g,w=s[I+2]-y,C=M*w-k*b,G=b*O-w*p,N=p*k-O*M,S=v*C+A*G+B*N;if(Math.abs(S)<=P)continue;const U=l-i,z=h-g,D=m-y,E=U*C+z*G+D*N;if(S>0){if(E<0||E>S)continue}else if(E>0||E<S)continue;const F=z*B-A*D,H=D*v-B*U,J=U*A-v*z,K=p*F+M*H+b*J;if(S>0){if(K<0||E+K>S)continue}else if(K>0||E+K<S)continue;const L=(O*F+k*H+w*J)/S;if(L>=0){f(L,t,r?R(v,A,B,O,k,w,d):null)}}}function y(t,n,o,i,e,s,c,r){const f=t[0],a=t[1],u=t[2],l=n[0],h=n[1],m=n[2];for(let p=o;p<i;++p){const t=3*p,n=t+1,o=t+2,i=s*t,M=e[i],b=e[i+1],x=e[i+2],g=s*n,y=s*o,T=e[g]-M,V=e[g+1]-b,q=e[g+2]-x,j=e[y]-M,I=e[y+1]-b,v=e[y+2]-x,A=h*v-I*m,B=m*j-v*l,O=l*I-j*h,k=T*A+V*B+q*O;if(Math.abs(k)<=P)continue;const w=f-M,C=a-b,G=u-x,N=w*A+C*B+G*O;if(k>0){if(N<0||N>k)continue}else if(N>0||N<k)continue;const S=C*q-V*G,U=G*T-q*w,z=w*V-T*C,D=l*S+h*U+m*z;if(k>0){if(D<0||N+D>k)continue}else if(D>0||N+D<k)continue;const E=(j*S+I*U+v*z)/k;if(E>=0){r(E,p,c?R(T,V,q,j,I,v,d):null)}}}function T(t,n,o,i,e,s,c,r,f,a,u,l=null,h=0){const m=t[0],p=t[1],M=t[2],b=n[0],x=n[1],g=n[2];for(let y=o;y<i;++y){const t=h+(l?l[y]:y),n=3*t,o=c*e[n],i=s[o],T=s[o+1],V=s[o+2],q=c*e[n+1],j=s[q],I=s[q+1],v=s[q+2],A=c*e[n+2],B=s[A],O=s[A+1],k=s[A+2],w=V-f,C=r/Math.sqrt(i*i+T*T+w*w),G=i+i*C,N=T+T*C,S=V+w*C,U=v-f,z=r/Math.sqrt(j*j+I*I+U*U),D=j+j*z,E=I+I*z,F=v+U*z,H=k-f,J=r/Math.sqrt(B*B+O*O+H*H),K=D-G,L=E-N,Q=F-S,W=B+B*J-G,X=O+O*J-N,Y=k+H*J-S,Z=x*Y-X*g,$=g*W-Y*b,_=b*X-W*x,tt=K*Z+L*$+Q*_;if(Math.abs(tt)<=P)continue;const nt=m-G,ot=p-N,it=M-S,et=nt*Z+ot*$+it*_;if(tt>0){if(et<0||et>tt)continue}else if(et>0||et<tt)continue;const st=ot*Q-L*it,ct=it*K-Q*nt,rt=nt*L-K*ot,ft=b*st+x*ct+g*rt;if(tt>0){if(ft<0||et+ft>tt)continue}else if(ft>0||et+ft<tt)continue;const at=(W*st+X*ct+Y*rt)/tt;if(at>=0){u(at,t,a?R(K,L,Q,W,X,Y,d):null)}}}function V(t,n,o,i,e,s,c,r,f,a,u){const l=t[0],h=t[1],m=t[2],p=n[0],M=n[1],b=n[2],{normalRequired:x}=a;for(let g=o;g<i;++g){const t=r[g],n=3*t,o=c*e[n];let i=s[o],a=s[o+1],y=s[o+2];const T=c*e[n+1];let V=s[T],q=s[T+1],j=s[T+2];const I=c*e[n+2];let v=s[I],A=s[I+1],B=s[I+2];null!=f&&([i,a,y]=f.applyToVertex(i,a,y,g),[V,q,j]=f.applyToVertex(V,q,j,g),[v,A,B]=f.applyToVertex(v,A,B,g));const O=V-i,k=q-a,w=j-y,C=v-i,G=A-a,N=B-y,S=M*N-G*b,U=b*C-N*p,z=p*G-C*M,D=O*S+k*U+w*z;if(Math.abs(D)<=P)continue;const E=l-i,F=h-a,H=m-y,J=E*S+F*U+H*z;if(D>0){if(J<0||J>D)continue}else if(J>0||J<D)continue;const K=F*w-k*H,L=H*O-w*E,Q=E*k-O*F,W=p*K+M*L+b*Q;if(D>0){if(W<0||J+W>D)continue}else if(W>0||J+W<D)continue;const X=(C*K+G*L+N*Q)/D;if(X>=0){u(X,t,x?R(O,k,w,C,G,N,d):null)}}}function q(i,e,s,c,r,f,a,u,l,h){const m=e,p=U,M=Math.abs(m[0]),b=Math.abs(m[1]),d=Math.abs(m[2]),x=M>=b?M>=d?0:2:b>=d?1:2,g=x,y=m[g]<0?2:1,T=(x+y)%3,V=(x+(3-y))%3,q=m[T]/m[g],R=m[V]/m[g],B=1/m[g],O=j,k=I,w=v,{normalRequired:C}=l;for(let j=s;j<c;++j){const e=3*j,s=a*r[e];n(p[0],f[s+0],f[s+1],f[s+2]);const c=a*r[e+1];n(p[1],f[c+0],f[c+1],f[c+2]);const l=a*r[e+2];n(p[2],f[l+0],f[l+1],f[l+2]),u&&(o(p[0],u.applyToVertex(p[0][0],p[0][1],p[0][2],j)),o(p[1],u.applyToVertex(p[1][0],p[1][1],p[1][2],j)),o(p[2],u.applyToVertex(p[2][0],p[2][1],p[2][2],j))),t(O,p[0],i),t(k,p[1],i),t(w,p[2],i);const m=O[T]-q*O[g],M=O[V]-R*O[g],b=k[T]-q*k[g],d=k[V]-R*k[g],x=w[T]-q*w[g],y=w[V]-R*w[g],I=x*d-y*b,v=m*y-M*x,G=b*M-d*m;if((I<0||v<0||G<0)&&(I>0||v>0||G>0))continue;const N=I+v+G;if(0===N)continue;const P=I*(B*O[g])+v*(B*k[g])+G*(B*w[g]);if(P*Math.sign(N)<0)continue;const S=P/N;if(S>=0){h(S,j,C?A(p):null)}}}const j=s(),I=s(),v=s();function R(t,o,s,c,r,f,a){return n(B,t,o,s),n(O,c,r,f),i(a,B,O),e(a,a),a}function A(n){return t(B,n[1],n[0]),t(O,n[2],n[0]),i(d,B,O),e(d,d),d}const B=s(),O=s();function k(t,o,i){return n(i,1/(o[0]-t[0]),1/(o[1]-t[1]),1/(o[2]-t[2]))}function w(t,o){return n(o,1/t[0],1/t[1],1/t[2])}function C(t,n,o,i){return G(t,n,o,i,1/0)}function G(t,n,o,i,e){const s=(t[0]-i-n[0])*o[0],c=(t[3]+i-n[0])*o[0];let r=Math.min(s,c),f=Math.max(s,c);const a=(t[1]-i-n[1])*o[1],u=(t[4]+i-n[1])*o[1];if(f=Math.min(f,Math.max(a,u)),f<0)return!1;if(r=Math.max(r,Math.min(a,u)),r>f)return!1;const l=(t[2]-i-n[2])*o[2],h=(t[5]+i-n[2])*o[2];return f=Math.min(f,Math.max(l,h)),!(f<0)&&(r=Math.max(r,Math.min(l,h)),!(r>f)&&r<e)}const N=1e3,P=1e-7,S=s(),U=[s(),s(),s()];export{h as MeshIntersectionOptions,k as computeInvDir,w as computeInvDirFromDirection,R as computeNormalFromBarycentric,C as intersectAabbInvDir,G as intersectAabbInvDirBefore,g as intersectRayTriangles,q as intersectRayTrianglesWithDisplacementWatertight,T as intersectRayTrianglesWithVerticalOffsetENUGlobal,y as intersectRenderGeometryTriangles,p as intersectTriangleGeometry,x as intersectTriangles,P as triangleRayParallelTolerance};
5
+ import{a as t,i as n,c as o,h as i,n as e}from"../../../../chunks/vec32.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{setMin as c,create as r,setMax as f}from"../../../../geometry/support/aaBoundingBox.js";import{GeometryType as a}from"./IntersectableGeometry.js";import{assert as u}from"./Util.js";import{VertexAttribute as l}from"./VertexAttribute.js";class h{constructor(t=!1,n=!0){this.isVerticalRay=t,this.normalRequired=n}}const m=r();function p(n,o,i,e,s,c){if(!n.visible)return;const r=t(S,e,i),f=(t,n,o)=>{c(t,o,n)},m=new h(!1,o.options.normalRequired);if(n.boundingInfo){u(n.type===a.Mesh);const t=o.tolerance;b(n.boundingInfo,i,r,t,s,m,f)}else{const t=n.attributes.get(l.POSITION),o=t.indices;q(i,r,0,o.length/3,o,t.data,t.stride,s,m,f)}}const M=s();function b(t,n,o,i,e,s,r){if(null==t)return;const a=w(o,M);if(c(m,t.bbMin),f(m,t.bbMax),null!=e&&e.applyToAabb(m),C(m,n,a,i)){const{primitiveIndices:c,position:f}=t,a=c?c.length:f.indices.length/3;if(a>N){const c=t.getChildren();if(void 0!==c){for(const t of c)b(t,n,o,i,e,s,r);return}}V(n,o,0,a,f.indices,f.data,f.stride,c,e,s,r)}}const d=s();function x(n,o,i,e,s,c,r,f,a){const{data:u,stride:l}=c;q(n,t(S,o,n),i,e,s,u,l,r,f,a)}function g(t,n,o,i,e,s,c,r,f,a=null,u=0){const l=t[0],h=t[1],m=t[2],p=n[0],M=n[1],b=n[2];for(let x=o;x<i;++x){const t=u+(a?a[x]:x),n=3*t,o=c*e[n],i=s[o],g=s[o+1],y=s[o+2],T=c*e[n+1],V=s[T],q=s[T+1],j=s[T+2],I=c*e[n+2],v=V-i,A=q-g,B=j-y,O=s[I]-i,k=s[I+1]-g,w=s[I+2]-y,C=M*w-k*b,G=b*O-w*p,N=p*k-O*M,S=v*C+A*G+B*N;if(Math.abs(S)<=P)continue;const U=l-i,z=h-g,D=m-y,E=U*C+z*G+D*N;if(S>0){if(E<0||E>S)continue}else if(E>0||E<S)continue;const F=z*B-A*D,H=D*v-B*U,J=U*A-v*z,K=p*F+M*H+b*J;if(S>0){if(K<0||E+K>S)continue}else if(K>0||E+K<S)continue;const L=(O*F+k*H+w*J)/S;if(L>=0){f(L,t,r?R(v,A,B,O,k,w,d):null)}}}function y(t,n,o,i,e,s,c,r){const f=t[0],a=t[1],u=t[2],l=n[0],h=n[1],m=n[2];for(let p=o;p<i;++p){const t=3*p,n=t+1,o=t+2,i=s*t,M=e[i],b=e[i+1],x=e[i+2],g=s*n,y=s*o,T=e[g]-M,V=e[g+1]-b,q=e[g+2]-x,j=e[y]-M,I=e[y+1]-b,v=e[y+2]-x,A=h*v-I*m,B=m*j-v*l,O=l*I-j*h,k=T*A+V*B+q*O;if(Math.abs(k)<=P)continue;const w=f-M,C=a-b,G=u-x,N=w*A+C*B+G*O;if(k>0){if(N<0||N>k)continue}else if(N>0||N<k)continue;const S=C*q-V*G,U=G*T-q*w,z=w*V-T*C,D=l*S+h*U+m*z;if(k>0){if(D<0||N+D>k)continue}else if(D>0||N+D<k)continue;const E=(j*S+I*U+v*z)/k;if(E>=0){r(E,p,c?R(T,V,q,j,I,v,d):null)}}}function T(t,n,o,i,e,s,c,r,f,a,u,l=null,h=0){const m=t[0],p=t[1],M=t[2],b=n[0],x=n[1],g=n[2];for(let y=o;y<i;++y){const t=h+(l?l[y]:y),n=3*t,o=c*e[n],i=s[o],T=s[o+1],V=s[o+2],q=c*e[n+1],j=s[q],I=s[q+1],v=s[q+2],A=c*e[n+2],B=s[A],O=s[A+1],k=s[A+2],w=V-f,C=r/Math.sqrt(i*i+T*T+w*w),G=i+i*C,N=T+T*C,S=V+w*C,U=v-f,z=r/Math.sqrt(j*j+I*I+U*U),D=j+j*z,E=I+I*z,F=v+U*z,H=k-f,J=r/Math.sqrt(B*B+O*O+H*H),K=D-G,L=E-N,Q=F-S,W=B+B*J-G,X=O+O*J-N,Y=k+H*J-S,Z=x*Y-X*g,$=g*W-Y*b,_=b*X-W*x,tt=K*Z+L*$+Q*_;if(Math.abs(tt)<=P)continue;const nt=m-G,ot=p-N,it=M-S,et=nt*Z+ot*$+it*_;if(tt>0){if(et<0||et>tt)continue}else if(et>0||et<tt)continue;const st=ot*Q-L*it,ct=it*K-Q*nt,rt=nt*L-K*ot,ft=b*st+x*ct+g*rt;if(tt>0){if(ft<0||et+ft>tt)continue}else if(ft>0||et+ft<tt)continue;const at=(W*st+X*ct+Y*rt)/tt;if(at>=0){u(at,t,a?R(K,L,Q,W,X,Y,d):null)}}}function V(t,n,o,i,e,s,c,r,f,a,u){const l=t[0],h=t[1],m=t[2],p=n[0],M=n[1],b=n[2],{normalRequired:x}=a;for(let g=o;g<i;++g){const t=r[g],n=3*t,o=c*e[n];let i=s[o],a=s[o+1],y=s[o+2];const T=c*e[n+1];let V=s[T],q=s[T+1],j=s[T+2];const I=c*e[n+2];let v=s[I],A=s[I+1],B=s[I+2];null!=f&&([i,a,y]=f.applyToVertex(i,a,y,g),[V,q,j]=f.applyToVertex(V,q,j,g),[v,A,B]=f.applyToVertex(v,A,B,g));const O=V-i,k=q-a,w=j-y,C=v-i,G=A-a,N=B-y,S=M*N-G*b,U=b*C-N*p,z=p*G-C*M,D=O*S+k*U+w*z;if(Math.abs(D)<=P)continue;const E=l-i,F=h-a,H=m-y,J=E*S+F*U+H*z;if(D>0){if(J<0||J>D)continue}else if(J>0||J<D)continue;const K=F*w-k*H,L=H*O-w*E,Q=E*k-O*F,W=p*K+M*L+b*Q;if(D>0){if(W<0||J+W>D)continue}else if(W>0||J+W<D)continue;const X=(C*K+G*L+N*Q)/D;if(X>=0){u(X,t,x?R(O,k,w,C,G,N,d):null)}}}function q(i,e,s,c,r,f,a,u,l,h){const m=e,p=U,M=Math.abs(m[0]),b=Math.abs(m[1]),d=Math.abs(m[2]),x=M>=b?M>=d?0:2:b>=d?1:2,g=x,y=m[g]<0?2:1,T=(x+y)%3,V=(x+(3-y))%3,q=m[T]/m[g],R=m[V]/m[g],B=1/m[g],O=j,k=I,w=v,{normalRequired:C}=l;for(let j=s;j<c;++j){const e=3*j,s=a*r[e];n(p[0],f[s+0],f[s+1],f[s+2]);const c=a*r[e+1];n(p[1],f[c+0],f[c+1],f[c+2]);const l=a*r[e+2];n(p[2],f[l+0],f[l+1],f[l+2]),u&&(o(p[0],u.applyToVertex(p[0][0],p[0][1],p[0][2],j)),o(p[1],u.applyToVertex(p[1][0],p[1][1],p[1][2],j)),o(p[2],u.applyToVertex(p[2][0],p[2][1],p[2][2],j))),t(O,p[0],i),t(k,p[1],i),t(w,p[2],i);const m=O[T]-q*O[g],M=O[V]-R*O[g],b=k[T]-q*k[g],d=k[V]-R*k[g],x=w[T]-q*w[g],y=w[V]-R*w[g],I=x*d-y*b,v=m*y-M*x,G=b*M-d*m;if((I<0||v<0||G<0)&&(I>0||v>0||G>0))continue;const N=I+v+G;if(0===N)continue;const P=I*(B*O[g])+v*(B*k[g])+G*(B*w[g]);if(P*Math.sign(N)<0)continue;const S=P/N;if(S>=0){h(S,j,C?A(p):null)}}}const j=s(),I=s(),v=s();function R(t,o,s,c,r,f,a){return n(B,t,o,s),n(O,c,r,f),i(a,B,O),e(a,a),a}function A(n){return t(B,n[1],n[0]),t(O,n[2],n[0]),i(d,B,O),e(d,d),d}const B=s(),O=s();function k(t,o,i){return n(i,1/(o[0]-t[0]),1/(o[1]-t[1]),1/(o[2]-t[2]))}function w(t,o){return n(o,1/t[0],1/t[1],1/t[2])}function C(t,n,o,i){return G(t,n,o,i,1/0)}function G(t,n,o,i,e){const s=(t[0]-i-n[0])*o[0],c=(t[3]+i-n[0])*o[0];let r=Math.min(s,c),f=Math.max(s,c);const a=(t[1]-i-n[1])*o[1],u=(t[4]+i-n[1])*o[1];if(f=Math.min(f,Math.max(a,u)),f<0)return!1;if(r=Math.max(r,Math.min(a,u)),r>f)return!1;const l=(t[2]-i-n[2])*o[2],h=(t[5]+i-n[2])*o[2];return f=Math.min(f,Math.max(l,h)),!(f<0)&&(r=Math.max(r,Math.min(l,h)),!(r>f)&&r<e)}const N=1e3,P=1e-7,S=s(),U=[s(),s(),s()];export{h as MeshIntersectionOptions,k as computeInvDir,w as computeInvDirFromDirection,R as computeNormalFromBarycentric,C as intersectAabbInvDir,G as intersectAabbInvDirBefore,g as intersectRayTriangles,q as intersectRayTrianglesWithDisplacementWatertight,T as intersectRayTrianglesWithVerticalOffsetENUGlobal,y as intersectRenderGeometryTriangles,p as intersectTriangleGeometry,x as intersectTriangles,P as triangleRayParallelTolerance};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../chunks/tslib.es6.js";import{update as t}from"../../../../core/arrayUtils.js";import{createTask as r}from"../../../../core/asyncUtils.js";import{unitRGBAFromColor as i}from"../../../../core/colorUtils.js";import has from"../../../../core/has.js";import{clamp as s,lerp as a}from"../../../../core/mathUtils.js";import{removeMaybe as n,abortMaybe as h,destroyMaybe as o,releaseMaybe as d}from"../../../../core/maybe.js";import{throwIfAborted as _}from"../../../../core/promiseUtils.js";import{watch as l,syncAndInitial as p,initial as u,sync as m}from"../../../../core/reactiveUtils.js";import{signal as c}from"../../../../core/signal.js";import{Milliseconds as g}from"../../../../core/time.js";import{property as f}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import{subclass as b}from"../../../../core/accessorSupport/decorators/subclass.js";import{equals as T,invert as A,multiply as E}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as P,create as R}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{s as S}from"../../../../chunks/vec42.js";import{ZEROS as I}from"../../../../core/libs/gl-matrix-2/factories/vec4f32.js";import{fromValues as C,ZEROS as w}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{pruneIndexArrays as O}from"../../../../geometry/support/Indices.js";import{RenderCategory as D,InternalRenderCategory as N}from"../../webgl.js";import{innerAtmosphereFadeStart as y}from"../../environment/atmosphereUtils.js";import{minNearDistanceInMeters as x}from"../../state/NearFarHeuristic.js";import{debugFlags as H}from"../../support/debugFlags.js";import{FBOCache as L,defaultWebGLFBO as M}from"../core/FBOCache.js";import{DepthTextureFormat as v,ColorFormat as F,DepthRenderbufferFormat as U}from"../core/FBOCacheFormats.js";import{RenderPassManager as G}from"../core/renderPasses/RenderPassManager.js";import{ShaderOutput as q,isColorOrColorEmission as V}from"../core/shaderLibrary/ShaderOutput.js";import{HUDRenderStyle as j}from"../core/shaderLibrary/hud/HUDRenderStyle.js";import{distanceFadeEnd as B}from"../core/shaderLibrary/shading/ScreenSpaceConstants.js";import{RenderNodes as Q}from"../effects/RenderNodes.js";import{RenderPluginManager as W}from"../effects/RenderPluginManager.js";import{Blit as k}from"../effects/blit/Blit.js";import{maxHighlightsPerChannel as z,renderHighlightBuffer as Y}from"../effects/highlight/Highlight.js";import{OITBlend as X}from"../effects/transparency/OITBlend.js";import{AnimationTimer as K}from"./AnimationTimer.js";import{AnimationTimeStep as J}from"./AnimationTimeStep.js";import{RenderRequestType as Z}from"./basicInterfaces.js";import{BoundingInfo as $}from"./BoundingInfo.js";import{DepthRange as ee}from"./DepthRange.js";import{depthRangeFromScene as te,DepthRangeMode as re}from"./depthRangeUtils.js";import{hudFragmentOpacityParameters as ie}from"./hudFragmentOpacityParameters.js";import{MainFramebuffer as se}from"./MainFramebuffer.js";import{RenderOccludedFlag as ae}from"./Material.js";import{OITPass as ne}from"./OITPass.js";import{RenderContext as he,defaultRenderOccludedMask as oe}from"./RenderContext.js";import{RendererBase as de}from"./RendererBase.js";import{RendererTarget as _e}from"./rendererUtils.js";import{setupFeatureDefaults as le,RenderFeature as pe}from"./RenderFeature.js";import{RenderPluginInput as ue}from"./RenderPluginInput.js";import{RenderSlot as me}from"./RenderSlot.js";import{ShadowAccumulator as ce}from"./ShadowAccumulator.js";import{ShadowMap as ge,SnapshotSlot as fe}from"./ShadowMap.js";import be from"./SliceHelper.js";import{Transparency as Te}from"./edgeRendering/interfaces.js";import{MergedRenderer as Ae}from"../materials/renderers/MergedRenderer.js";import{RenderSceneResult as Ee}from"../parts/renderUtils.js";import{RendererPerformanceInfo as Pe,PerformanceCategory as Re}from"../statistics/RendererPerformanceInfo.js";import{RenderState as Se}from"../../../support/RenderState.js";import{PixelFormat as Ie,PixelType as Ce,FramebufferBit as we,ColorAttachment1 as Oe,ColorAttachment2 as De}from"../../../webgl/enums.js";let Ne=class extends de{constructor(e,t,r,s,a,n){super({stage:e}),this._techniques=r,this._rctx=s,this._compositingHelper=a,this._requestRender=n,this._pluginsHas={hudElements:!1,water:!1},this.renderPassManager=new G,this._isRendering=!1,this._inGlobeView=!1,this._backgroundColor=C(0,0,0,1),this._sliceHelper=new be,this._blit=null,this._oitblend=null,this.sceneDepthRange=c(ee.infinite),this._state=c(Se.IDLE),this._highQualityTransparencyEnabled=!0,this._ssrEnabled=!1,this._hasAnimations=!1,this._animationTimestep=new J,this._loadEdgeViewTask=null,this._edgeViewCallbacks=[],this._reprojectionMatrixVersion=c(0),this._lastFrameTime=g(0),this._renderHiddenTransparentEdges=()=>{},this._pluginInput=new ue,this._releaseNormals=e=>{e.some((({name:e})=>"normals"===e))&&this._pluginInput.release("normals")},this._debugNeedsDepth=!1,this.fboCache=new L(s),this._renderStateFeatures=c(le(!has("disable-feature:high-quality-idle"),e.view.qualityProfile)),this._framebuffer=new se(this.fboCache),this.performanceInfo=new Pe(this._rctx),this._shadowMap=new ge(this.fboCache,e.viewingMode),this._shadowAccumulator=new ce(this.fboCache,r,e,(e=>{const t=this.shadowsEnabled;this._shadowMap.enabled=!0,this._ensureBindParametersCamera(e.camera,e.contentCamera),this._plugins.prepareRender(),this._shadowMap.enabled=t}),((t,r,i)=>{const s=e.view.qualitySettings.maximumPixelRatio;t.shadowMap.start(t.camera,r,i,!0,s),this._renderShadowCascades(q.Shadow,t.shadowMap),t.shadowMap.finish(),t.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(t.camera,t.contentCamera)}),n),this._renderContext=new he(this._rctx,this._shadowMap,r),this._nodes=new Q(this._renderContext),this._plugins=new W({renderContext:this._renderContext,techniques:r,materials:t,requestRender:n,controller:e,fbos:this.fboCache,isFeatureEnabled:e=>this.isFeatureEnabled(e)}),this._plugins.add(this.renderPassManager),this.addHandles([l((()=>e.view.state.camera),(()=>n()),p),l((()=>H.EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES),(e=>{this._renderHiddenTransparentEdges=e?()=>this._renderEdges(Te.TRANSPARENT):()=>{},n()}),u),l((()=>e.view.environment.background?.color),(e=>{const t=e?i(e):w;S(this._backgroundColor,t[0]*t[3],t[1]*t[3],t[2]*t[3],t[3]),n()}),p),l((()=>e.view.state.camera.relativeElevation),(e=>this._inGlobeView=(e??1/0)>=B),p),l((()=>this._bindParameters.clouds.fadeFactor),(()=>this._bindParameters.fadeLighting()),m),l((()=>this._bindParameters.clouds.data?.state),(()=>n()),m),l((()=>e.view.state.highlights),(e=>{this._bindParameters.highlights=e,n()}),u)])}destroy(){this._gpuTimerHandle=n(this._gpuTimerHandle),this._nodes.destroy(),this._framebuffer.dispose(),this._shadowMap.dispose(),this._shadowAccumulator.dispose(),this._loadEdgeViewTask=h(this._loadEdgeViewTask),this._edgeView=o(this._edgeView),this.renderPassManager.dispose(),this._releaseFBOs(),this._disposeOffscreenBuffers(),this.fboCache.destroy(),this._plugins.destroy(),this._blit=null,this._oitblend=null,$.prune(),Ae.prune(),O()}get renderContext(){return this._renderContext}get _bindParameters(){return this._renderContext.bind}get _framebufferSize(){return this._framebuffer.size}updateRenderFeatures(e=null,t=!has("disable-feature:high-quality-idle")){this._renderStateFeatures.value=le(t,e),this._requestRender()}isFeatureEnabled(e,t=this._state.value){return this._renderStateFeatures.value.get(t,e)??!1}setFeatureEnabled(e,t,r){this._renderStateFeatures.mutate((i=>i.set(t,e,r))),this._requestRender()}get _highQualityTransparency(){return this._highQualityTransparencyEnabled||this.isFeatureEnabled(pe.HighQualityTransparency)}get hasReflections(){return this._pluginsHas.water&&(this._ssrEnabled||this.isFeatureEnabled(pe.WaterReflection))}get _hasHighlights(){return this._plugins.produces(q.Highlight,me.OPAQUE_MATERIAL,me.TRANSPARENT_MATERIAL,me.DRAPED_MATERIAL,me.HUD_MATERIAL,me.LABEL_MATERIAL)}hasHighlight(e){return this._plugins.hasHighlight(e)}get _hasHUDHighlights(){return this._plugins.produces(q.Highlight,me.HUD_MATERIAL,me.LABEL_MATERIAL)}get hasSSAO(){return(this.stage.view.qualitySettings.ambientOcclusion||this.isFeatureEnabled(pe.SSAO))&&!this._inGlobeView}get hasSMAA(){return this.stage.view.qualitySettings.antialiasingEnabled||this.isFeatureEnabled(pe.Antialiasing)}get fullResolutionAtmosphere(){return this.stage.view.qualitySettings.highResolutionAtmosphere||this.isFeatureEnabled(pe.HighResolutionAtmosphere)}_releaseFBOs(){this._bindParameters.ssr.lastFrameColor=d(this._bindParameters.ssr.lastFrameColor),this._bindParameters.terrainDepth=d(this._bindParameters.terrainDepth),this._bindParameters.geometryDepth=d(this._bindParameters.geometryDepth)}_disposeOffscreenBuffers(){this._framebuffer.dispose(),this._disposeBindBuffers()}_disposeBindBuffers(){this._shadowMap.disposeOffscreenBuffers(),this._bindParameters.depth=d(this._bindParameters.depth),this._bindParameters.hudVisibility=d(this._bindParameters.hudVisibility)}get updating(){return this._loadEdgeViewTask&&!this._loadEdgeViewTask.finished||this._edgeView?.updating||this._shadowAccumulator.running||this._plugins.updating||!this.isCameraFinal}loadEdgeView(){return this._loadEdgeViewTask||(this._loadEdgeViewTask=r((async e=>{const{EdgeView:t}=await import("./edgeRendering/EdgeView.js");_(e);const r=this._edgeView=new t({rctx:this._rctx,renderSR:this.stage.view.renderSpatialReference,viewingMode:this.stage.view.stage.viewingMode,techniques:this._techniques,setNeedsRender:()=>this._requestRender(),schedule:je(this.stage.view.resourceController)});return this.addHandles(l((()=>r.updating),(()=>this._requestRender()),m)),this._requestRender(),this._edgeViewCallbacks.forEach((e=>e(r))),this._edgeViewCallbacks.length=0,r}))),this._loadEdgeViewTask.promise}withEdgeView(e){this.loadEdgeView(),null==this._edgeView?this._edgeViewCallbacks.push(e):e(this._edgeView)}get edgeView(){return this._edgeView}get isCameraFinal(){return this._reprojectionMatrixVersion.value>=0&&T(this._bindParameters.ssr.reprojectionMatrix,P)}set _reprojectionMatrix(e){t(this._bindParameters.ssr.reprojectionMatrix,e)&&this._reprojectionMatrixVersion.value++}get shadowsEnabled(){return!!this._shadowMap?.enabled}setParameters(e){const{_shadowMap:t,_bindParameters:r}=this;if(void 0!==e.qualitySettings?.reflections&&this._ssrEnabled!==e.qualitySettings.reflections&&(this._ssrEnabled=e.qualitySettings.reflections,this._requestRender()),void 0!==e.shadowMap&&this._shadowMap.enabled!==e.shadowMap&&(this._shadowMap.enabled=e.shadowMap,this._requestRender()),void 0!==e.shadowMapMaxCascades&&t.maxCascades!==e.shadowMapMaxCascades&&(t.maxCascades=e.shadowMapMaxCascades,this._requestRender()),null!=e.environment){if(null!=e.environment.weather){const t=e.environment.weather;this._bindParameters.weather=t,this._bindParameters.snowCover=!!e.weatherVisible&&null!=t&&"snowy"===t.type&&"enabled"===t.snowCover}const t="virtual"!==e.environment.lighting.type;r.enableFillLights!==t&&(r.enableFillLights=t,this._requestRender())}void 0!==e.highQualityTransparency&&this._highQualityTransparencyEnabled!==e.highQualityTransparency&&(this._highQualityTransparencyEnabled=e.highQualityTransparency,this._requestRender()),void 0!==e.shadowCast&&this._shadowAccumulator.setOptions(e.shadowCast)}set slice(e){this._sliceHelper.update(e)&&this._requestRender()}get plugins(){return this._plugins}get _hasOITSupport(){return this._rctx.driverTest.floatBufferBlend.result}get _oitEnabled(){return this._highQualityTransparency&&this._hasOITSupport}commit(e,t){return this._isRendering&&console.warn("Renderer.modify called while rendering"),!!super.commit(e,t,this._plugins.context)&&(this.updateHasFlags(),!0)}rendererAdded(e){this._plugins.add(e)}rendererRemoved(e){this._plugins.remove(e)}updateHasFlags(){const has=this._pluginsHas;has.hudElements=this._plugins.produces(q.Color,...Fe),has.water=this._plugins.produces(q.Normal,me.DRAPED_WATER),this._bindParameters.hasOccludees=this._plugins.hasOccludees,this._requestRender()}updateAnimation(e,t){this._animationTimer??=new K(e.camera,t),this._animationTimer.advance(e.camera,t,this._animationTimeDilation);const r=this._hasAnimations;return this._hasAnimations=this._plugins.updateAnimation(this._animationTimer),this._hasAnimations=this._nodes.updateAnimation(this._animationTimer)||this._hasAnimations,this._hasAnimations!==r&&(this._gpuTimerHandle=r?n(this._gpuTimerHandle):this.performanceInfo.enableGPUPerformanceInfo()),this._hasAnimations}get animationTimestep(){return this._animationTimestep.value}get _animationTimeDilation(){return this._animationTimestep.timeDilation}resetAnimation(){this._animationTimestep.clear()}tick(){this.fboCache.clean()}render(e,t,r=_e.Default,i=!1){try{return this._isRendering=!0,this._render(e,t,r,i)}catch(s){console.error(`Exception during rendering: ${s}`)}finally{this._isRendering=!1}return new Ee(this._pluginInput.get(D.FINAL),null)}_updateHUDOccludedFragmentOpacity(e,t){const{idleOpacity:r,navigatingOpacity:i,maxDelta:n,tiltFadeStart:h,tiltFadeEnd:o,altitudeStart:d,altitudeEnd:_}=ie,l=this.stage.view,p=l.stateManager.camera,u=l.qualitySettings.fadeDuration,m=e===Se.IDLE?r:i,c=s((p.tilt-h)/(o-h),0,1),g=s(((p.position.z??0)-d)/(_-d),0,1),f=a(a(1,m,c),1,g),b=this._bindParameters.hudOccludedFragmentOpacity;if(u<=0||b===f||0===this._lastFrameTime||this._lastFrameTime>t)return this._bindParameters.hudOccludedFragmentOpacity=f,void(this._lastFrameTime=t);const T=t-this._lastFrameTime;this._lastFrameTime=t;const A=Math.max(1-r,Math.abs(r-i)),E=Math.min(A*T/u,n);E>=Math.abs(f-b)?this._bindParameters.hudOccludedFragmentOpacity=f:(this._bindParameters.hudOccludedFragmentOpacity=b+Math.sign(f-b)*E,this._requestRender())}_render(e,t,r=_e.Default,i){this.performanceInfo.startFrame(),this.fboCache.frameStart(),this.fboCache.interactive=r===_e.Default,this._disposeBindBuffers();const{camera:s,contentCamera:a,mode:n,alignPixelEnabled:h}=e;this._state.value=n;const o=this._nodes.produces("magnifier-color"),d=this._nodes.produces(D.FINAL),_=this._nodes.require("emissive",N.TRANSPARENT_ENVIRONMENT,D.COMPOSITE,D.FINAL)>0&&this._plugins.hasEmissions,l=_?q.ColorEmission:q.Color;this._renderContext.time=t,this._renderContext.output=l,this._bindParameters.oitPass=ne.NONE,this._bindParameters.alignPixelEnabled=h,this._bindParameters.decorations=!i,this._bindParameters.mainDepth=null;const p=!i||!this._sliceHelper.isDecoration;this._bindParameters.slicePlane=p?this._sliceHelper.plane:null,this._bindParameters.viewshedEnabled=this._nodes.produces(N.VIEWSHED),this._renderOverlay(t),s.setGLViewport(this._rctx);const u=this._framebuffer,m=u.initialize(s.fullWidth,s.fullHeight,this._backgroundColor,_);this.hasReflections?(m?.setName("last frame color"),this._bindParameters.ssr.lastFrameColor=m):m?.release(),this._ensureBindParametersCamera(s,a),this._updateHUDOccludedFragmentOpacity(n,t),this._plugins.prepareRender(),this._bindParameters.shadowHighlightsVisible=this._needsShadowHighlight&&!i;const c=this._highQualityTransparency&&this._hasTransparentTerrain,g=this._plugins.produces(q.Color,...Me);this._precompilePrepasses(),this.performanceInfo.advance(Re.PREPARE);const f=this._computeShadowDepthRange(s);this._renderShadowMap(s,this._bindParameters.lighting.mainLight.direction,f),this._ensureBindParametersCamera(s,a),this._pluginInput.set("normals",this._renderNormals()),this._renderRemainingGeometryDepth(),this._renderShadowAccumulation(f,s,a),this._ensureBindParametersSSR(t),this._precompileShaders(c,g,l),this._renderContext.output=l,u.bind(),this._bindParameters.mainDepth=u.depth.attachment,this._renderOpaque(c),this._renderTransparent(g,c,l),this._pluginInput.set(N.FOCUSAREA,this._renderFocusAreaGeometry()),u.update((e=>this._renderNodes(N.TRANSPARENT_ENVIRONMENT,e))),u.update((e=>this._renderNodes(N.VIEWSHED,e))),u.update((e=>this._renderNodes(N.LASERLINES,e))),u.update((e=>this._renderNodes(N.FOCUSAREA_COLOR,e))),this._pluginInput.release(N.FOCUSAREA),u.update((e=>this._renderNodes(N.OCCLUDED,e))),this._pluginInput.set("highlights",this._renderHighlightPrepass());const b=r===_e.ObjectAndLayerID?this._renderObjectAndLayerIdColor():null;u.update((e=>this._renderNodes(D.COMPOSITE,e)));const T=!(r!==_e.Default||d||o&&!i),A=this._pluginInput.get(D.COMPOSITE),E=T?M:this.fboCache.acquire(A.fbo.width,A.fbo.height,N.ANTIALIASING),P=this._nodes.produces(N.ANTIALIASING)?this._renderNodes(N.ANTIALIASING,E):this._blitFBO(A,E,!1);let R;this._pluginInput.set(N.ANTIALIASING,P),this._hasHUDHighlights?(this._renderHUD(j.NotOccluded,P,l),R=this._renderNodes(N.HIGHLIGHTS,P)):(R=this._renderNodes(N.HIGHLIGHTS,P),this._renderHUD(j.NotOccluded,R,l));const S=this._renderNodes(N.MAGNIFIER,R);return o&&!i&&r===_e.Default&&!d&&this._blitFBO(S),d?(S.attachDepth(u.depth),this._blitFBO(this._renderNodes(D.FINAL,S)),S.detachDepth()):this._pluginInput.set(D.FINAL,S),this._pluginInput.release("highlights"),this.onPostRender&&this.onPostRender(),this._releaseFBOs(),u.releaseDepth(),this._renderContext.lastFrameCamera.copyFrom(this._bindParameters.camera),this.fboCache.frameEnd(),this.performanceInfo.finishFrame(),r!==_e.Default&&(this._releaseFBOs(),this._disposeOffscreenBuffers()),new Ee(this._pluginInput.get(D.FINAL),b)}_precompileShaders(e,t,r){++this._plugins.context.techniques.precompiling,this._renderContext.output=r,this._precompileOpaqueGeometry(),this._nodes.precompile(N.OPAQUE_ENVIRONMENT),this._bindParameters.terrainDepthTest=e,this._bindParameters.cullAboveTerrain=e,this._renderContext.output=q.Depth,this._plugins.precompile(me.TRANSPARENT_TERRAIN),e&&(this._precompileOpaqueGeometry(),this._precompileTransparentGeometry()),this._renderContext.output=r,this._plugins.precompile(me.TRANSPARENT_TERRAIN),t&&(this._precompileTransparentGeometry(),this._hasTransparentTerrain&&(this._bindParameters.cullAboveTerrain=!1,this._precompileTransparentGeometry(),this._bindParameters.cullAboveTerrain=e)),this._nodes.precompile(N.FOCUSAREA),this._needsHUDVisibility&&this._plugins.precompile(me.OCCLUSION_PIXELS),this._plugins.precompile(me.LINE_CALLOUTS),this._precompileHUD(j.Occluded),this._bindParameters.terrainDepthTest=!1,this._bindParameters.cullAboveTerrain=!1,this._nodes.precompile(N.VIEWSHED,N.LASERLINES,N.FOCUSAREA_COLOR,N.OCCLUDED,N.ANTIALIASING,N.HIGHLIGHTS);const i=this._bindParameters;i.highlightMixTexture=i.highlights.length>1?this._rctx.emptyTexture:null,this._precompileHUD(j.NotOccluded),this._hasHighlights&&(i.highlights.forEach(((e,t)=>{i.highlightLevel=t,this._precompileAllGeometry(q.Highlight)})),i.highlightLevel=null),i.highlightMixTexture=null,this._nodes.precompile(D.COMPOSITE,N.MAGNIFIER),this._shadowAccumulator.precompile(),this._plugins.precompile(me.TRANSPARENT_MATERIAL_WITHOUT_DEPTH),--this._plugins.context.techniques.precompiling}_renderFocusAreaGeometry(){const e=this._nodes.produce(N.FOCUSAREA,this._pluginInput);return e&&this.performanceInfo.advance(Re.FOCUS_AREA_MASK),e}_renderObjectAndLayerIdColor(){if(!this._nodes.produces("olid"))return null;const e=this._renderContext.output;++this._techniques.precompiling;const t=this._framebufferSize;let r=this.fboCache.acquire(t.width,t.height,"olid");return r.acquireDepth(v.DEPTH24_STENCIL8),r=this._nodes.render(r,this._pluginInput),--this._techniques.precompiling,this.performanceInfo.advance(Re.OBJECT_AND_LAYER_ID_COLOR),this._renderContext.output=e,r}finish(e){this._hasAnimations||this._animationTimestep.clear();const t=this.performanceInfo.gpuSamplingEnabled,r=e===Z.BACKGROUND;if(r||t){const e=r?this.performanceInfo.elapsedTime:0;let i=0;t?i=this.performanceInfo.totalGPUTimeSampler.last:this._rctx.gl.finish();const s=Math.max(e,i);this._animationTimestep.frame(s,r)}}readMainDepth(e,t){const{mainDepth:r,camera:i}=this._bindParameters;if(!r)return;const s=this.fboCache.acquire(this._framebufferSize.width,this._framebufferSize.height,"linear-depth");this._rctx.bindFramebuffer(s.fbo),i.setGLViewport(this._rctx),this._rctx.setScissorRect(e[0],e[1],e[2],e[3]),this._rctx.setScissorTestEnabled(!0),this._rctx.clearFramebuffer(w),this._compositingHelper.blitDepthToLinearDepth(this._bindParameters,r),this._rctx.setScissorTestEnabled(!1),this._rctx.setScissorRect(0,0,this._rctx.gl.canvas.width,this._rctx.gl.canvas.width),s.fbo?.readPixels(e[0],e[1],e[2],e[3],Ie.RGBA,Ce.UNSIGNED_BYTE,t),s.release()}readHUDVisibility(e,t,r,i,s){this._bindParameters.hudVisibility?.fbo?.readPixels(e,t,r,i,Ie.RGBA,Ce.UNSIGNED_BYTE,s)}readAccumulatedShadow(e){return this._shadowAccumulator.readAccumulatedShadow(e[0],e[1])}_renderEdges(e){const t=this._edgeView;if(!t?.shouldRender())return;const r=this._framebufferSize,i=this.fboCache.acquire(r.width,r.height,"edges"),s=()=>t.render(this._bindParameters,e),a=this._bindParameters.geometryDepth;this.renderToTargets(s,i,a??this._framebuffer.depth,w),this._framebuffer.bind(),this._compositingHelper.composite(this._bindParameters,i.getTexture()),i.release(),this.performanceInfo.advance(e===Te.OPAQUE?Re.OPAQUE_EDGES:Re.TRANSPARENT_EDGES)}_renderOverlay(e){this._bindParameters.overlay=this.overlay?.render(e),this._bindParameters.overlay&&this.performanceInfo.advance(Re.OVERLAY)}_renderShadowMap(e,t,r){if(!this.shadowsEnabled)return;const i=this._shadowMap;i.start(e,t,r,this.isFeatureEnabled(pe.HighResolutionShadows),this.stage.view.qualitySettings.maximumPixelRatio),this._needsShadowHighlight?(this._renderShadowCascades(q.ShadowHighlight,this._shadowMap),i.moveSnapshot(fe.Highlight),this._renderShadowCascades(q.ShadowExcludeHighlight,this._shadowMap),i.copySnapshot(fe.ExcludeHighlight),this._renderShadowCascades(q.ShadowHighlight,this._shadowMap)):this._renderShadowCascades(q.Shadow),i.finish(),e.setGLViewport(this._rctx),this.performanceInfo.advance(Re.SHADOW_MAP)}_precompileShadowCascades(e){for(const t of this._shadowMap.cascades)t.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(t.camera,t.camera),this._precompileAllGeometry(e)}_renderShadowCascades(e,t=this._shadowMap){t.bindFbo();for(const r of t.cascades)r.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(r.camera,r.camera),this.renderAllGeometry(e)}get _needsDepth(){return this._plugins.consumes(q.Depth)||this._nodes.requireGeometryDepth()||this.hasReflections||this._needsShadowHighlight||this._needsShadowAccumulation||this._debugNeedsDepth}_renderRemainingGeometryDepth(){const e=this._pluginInput.get("normals");e?(this._pluginInput.set(N.SSAO,this._renderSSAO()),this._needsDepth?(this._rctx.bindFramebuffer(e.fbo),this._rctx.clear(we.STENCIL),this._renderGeometryWithoutNormals(q.Depth),d(this._bindParameters.depth),this._bindParameters.depth=e.obtainDepthTexture(),this.performanceInfo.advance(Re.DEPTH)):(e.detachDepth(),this._bindParameters.depth=d(this._bindParameters.depth)),this.hasSSAO&&this._pluginInput.release("normals")):this._renderAllGeometryDepth()}_renderAllGeometryDepth(){if(!this._needsDepth)return void(this._bindParameters.depth=d(this._bindParameters.depth));const e=this._framebufferSize,t=this.fboCache.acquire(e.width,e.height,"depth",v.DEPTH24_STENCIL8);this._rctx.bindFramebuffer(t.fbo),this._rctx.clear(we.DEPTH|we.STENCIL),this.renderAllGeometry(q.Depth),d(this._bindParameters.depth),this._bindParameters.depth=t.obtainDepthTexture(),t.release(),this.performanceInfo.advance(Re.DEPTH)}_renderTerrainDepth(e){if(this._bindParameters.terrainDepthTest=e,this._bindParameters.cullAboveTerrain=e,!e)return void(this._bindParameters.terrainDepth=d(this._bindParameters.terrainDepth));const t=this._renderContext.output;this._renderContext.output=q.Depth;const r=this._framebufferSize,i=this.fboCache.acquire(r.width,r.height,"terrain depth",v.DEPTH24_STENCIL8);this._rctx.bindFramebuffer(i.fbo),this._rctx.clear(we.DEPTH|we.STENCIL),this._renderTransparentTerrain(),d(this._bindParameters.terrainDepth),this._bindParameters.terrainDepth=i.obtainDepthTexture(),this._renderContext.output=t,i.release()}_renderGeometryDepth(e){if(!e)return void(this._bindParameters.geometryDepth=d(this._bindParameters.geometryDepth));const t=this._renderContext.output,{width:r,height:i}=this._framebufferSize,s=this.fboCache.acquire(r,i,"geometry depth",v.DEPTH24_STENCIL8);this._rctx.bindFramebuffer(s.fbo),this._rctx.clear(we.DEPTH|we.STENCIL),this._renderOpaqueAndTransparentGeometry(q.Depth),this._renderContext.output=t,d(this._bindParameters.geometryDepth),this._bindParameters.geometryDepth=s.obtainDepthTexture(),s.release()}get _needsShadowDepthRange(){return this._shadowMap.enabled||this._needsShadowAccumulation}_computeShadowDepthRange(e){if(!this._needsShadowDepthRange)return ee.zero;const t=te(e,this._plugins.plugins,this.stage.layers,re.SHADOW_CASTERS);return t.union(this._plugins.queryDepthRange(e)),t.near=Math.max(e.near,t.near),t.far=Math.min(e.far,t.far),t}updateSceneDepthRange(e){if(!this.stage.view.state.isGlobal)return void(this.sceneDepthRange.value=ee.infinite);if((this.stage.view.renderCoordsHelper?.getAltitude(e.eye)??0)<y)return void(this.sceneDepthRange.value=ee.infinite);const t=e.clone();t.near=x,t.far=1e10;const r=te(t,this._plugins.plugins,this.stage.layers,re.FULL_SCENE);r.union(this._plugins.queryDepthRange(t)),this.sceneDepthRange.value.far===r.far&&this.sceneDepthRange.value.near===r.near||(this.sceneDepthRange.value=r)}get _normalsRequired(){const e=this._nodes.require("normals",D.FINAL,D.COMPOSITE,D.OPAQUE,D.TRANSPARENT,N.VIEWSHED,N.LASERLINES);return(this.hasSSAO?1:0)+e}_precompilePrepasses(){this._normalsRequired&&this._precompileAllGeometry(q.Normal),this._needsDepth&&this._precompileAllGeometry(q.Depth),this.shadowsEnabled&&(this._needsShadowHighlight?(this._precompileShadowCascades(q.ShadowHighlight),this._precompileShadowCascades(q.ShadowExcludeHighlight),this._precompileShadowCascades(q.ShadowHighlight)):this._precompileShadowCascades(q.Shadow)),this._needsShadowAccumulation&&this._precompileAllGeometry(q.Shadow)}_renderNormals(){const e=this._normalsRequired;if(0===e)return;const t=this._framebufferSize,r=this.fboCache.acquire(t.width,t.height,"normals",F.RGBA8UNORM);r.acquireDepth(v.DEPTH24_STENCIL8),this._rctx.bindFramebuffer(r.fbo),this._rctx.clearFramebuffer(w,!0,!0),this._renderGeometryWithNormals(q.Normal);const i=this._nodes.optional("normals",D.FINAL,D.COMPOSITE,D.OPAQUE,D.TRANSPARENT,N.VIEWSHED);return r.retain(e+i-1),this.performanceInfo.advance(Re.NORMALS),r}_renderSSAO(){const e=this._pluginInput.get("normals");if(!this.hasSSAO||!e)return;const t=this._nodes.produce(N.SSAO,this._pluginInput);return this._bindParameters.ssao=t,t&&this.performanceInfo.advance(Re.SSAO),t}_precompileAllGeometry(e){const t=this._renderContext.output;this._renderContext.output=e,this._precompileOpaqueGeometry(),this._precompileTransparentGeometry(),this._plugins.precompile(me.TRANSPARENT_TERRAIN),this._renderContext.output=t}renderAllGeometry(e){this._renderContext.output=e,this._renderOpaqueAndTransparentGeometry(e),this._renderTransparentTerrain()}precompileSlots(e,...t){for(const r of t)this._bindParameters.slot=r,e.precompile(this._renderContext)}precompileOccludedSlots(e,t){for(const r of t)this._renderContext.renderOccludedMask=r,this.precompileSlots(e,...ve);this._renderContext.renderOccludedMask=oe}renderSlots(e,...t){for(const r of t)this._bindParameters.slot=r,e.forAll((e=>{const t=e.acquireTechniques(this._renderContext);t&&e.render(this._renderContext,t,this._pluginInput)}))}renderOccludedSlots(e,t){this._renderContext.renderOccludedMask=t,this.plugins.renderOccludedFlags>ae.Occlude&&this._plugins.render(this._pluginInput,me.OCCLUDED_TERRAIN),this.renderSlots(e,...ve),this._renderContext.renderOccludedMask=oe}renderHUD(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(this._pluginInput,me.HUD_MATERIAL)}precompileViewshedShadowMap(){this._precompileAllGeometry(q.ViewshedShadow)}renderViewshedShadowMap(e){const{camera:t,contentCamera:r}=this._bindParameters,i=this._renderContext.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this.renderAllGeometry(q.ViewshedShadow),this._ensureBindParametersCamera(t,r),this._bindParameters.camera.setGLViewport(this._rctx),this._renderContext.output=i}_renderOpaqueAndTransparentGeometry(e){this._renderContext.output=e,this._renderOpaqueGeometry(),this._renderTransparentGeometry()}_renderGeometryWithNormals(e){this._renderContext.output=e,this._plugins.render(this._pluginInput,...xe),this._renderTransparentTerrain()}_renderGeometryWithoutNormals(e){this._renderContext.output=e,this._plugins.render(this._pluginInput,...He)}_precompileOpaqueGeometry(){this._plugins.precompile(...Le)}_renderOpaqueGeometry(){this._plugins.render(this._pluginInput,...Le)}_renderTransparentGeometry(){this._plugins.render(this._pluginInput,...Me)}get _hasTransparentTerrain(){return this._plugins.produces(q.Color,me.TRANSPARENT_TERRAIN)}_renderTransparentTerrain(){const e=()=>this._plugins.render(this._pluginInput,me.TRANSPARENT_TERRAIN);if(!V(this._renderContext.output))return void e();const t=this._framebufferSize,r=this.fboCache.acquire(t.width,t.height,"transparent terrain");return this.renderToTargets(e,r,this._framebuffer.depth,w),r}get _needsHUDVisibility(){return this._plugins.produces(this._renderContext.output,me.OCCLUSION_PIXELS)}_renderHUDVisibility(){if(!this._needsHUDVisibility)return void(this._bindParameters.hudVisibility=d(this._bindParameters.hudVisibility));const{width:e,height:t}=this._framebufferSize;let r=this._bindParameters.hudVisibility;r?.fbo?.width===e&&r?.fbo?.height===t||(r?.release(),r=this.fboCache.acquire(e,t,"hud visibility",F.RGBA4UNORM),this._bindParameters.hudVisibility=r);const i=this._bindParameters.geometryDepth;r.attachDepth(i||this._framebuffer.depth),this._rctx.bindFramebuffer(r.fbo),this._rctx.clearFramebuffer([0,1,0,1]),this._plugins.render(this._pluginInput,me.OCCLUSION_PIXELS),r.detachDepth(),this._framebuffer.bind(),this.performanceInfo.advance(Re.HUD_VISIBILITY)}_renderLineCallouts(e){if(this._bindParameters.hudRenderStyle=e,e===j.Occluded){const e=()=>this._plugins.render(this._pluginInput,me.LINE_CALLOUTS),t=this._framebufferSize,r=this.fboCache.acquireDepth(U.DEPTH16,t.width,t.height,"line callouts");this.renderToTargets(e,this._framebuffer.color,r,void 0,!0,!0),r.release()}else this._plugins.render(this._pluginInput,me.LINE_CALLOUTS)}_precompileHUD(e){if(this._precompileHUDOutput(e),this._hasHighlights){const t=this._renderContext.output;this._renderContext.output=q.Highlight,this._precompileHUDOutput(e),this._renderContext.output=t}}_precompileHUDOutput(e){const t=this._bindParameters.hudRenderStyle;this._bindParameters.hudRenderStyle=e,this._oitEnabled&&V(this._renderContext.output)?(this._bindParameters.oitPass=ne.ColorAlpha,this._plugins.precompile(...Fe),this._bindParameters.oitPass=ne.FrontFace,this._plugins.precompile(...Fe),this._bindParameters.oitPass=ne.NONE):this._plugins.precompile(...Fe),this._bindParameters.hudRenderStyle=t}_renderHUD(e,t,r){if(this._pluginsHas.hudElements){if(this._oitEnabled){const i=this._renderOIT(ye.HUD,r,e);this._rctx.bindFramebuffer(t.fbo),this._compositingHelper.compositePreMultipliedAlpha(this._bindParameters,i.getTexture()),i.release()}else if(this._renderContext.output=r,e===j.Occluded){const t=()=>this._renderHUDElements(e),r=this._framebufferSize,i=this.fboCache.acquireDepth(U.DEPTH16,r.width,r.height,"hud");this.renderToTargets(t,this._framebuffer.color,i,void 0,!0,!0),i.release()}else t.acquireDepth(U.DEPTH16),this._rctx.bindFramebuffer(t.fbo),this._renderHUDElements(e),t.detachDepth();this.performanceInfo.advance(e===j.Occluded?Re.HUD_OCCLUDED:Re.HUD)}}_renderHUDElements(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(this._pluginInput,...Fe)}get _needsShadowHighlight(){return this.shadowsEnabled&&this._plugins.produces(q.ShadowHighlight,me.OPAQUE_MATERIAL)}_renderHighlightPrepass(){if(!this._hasHighlights)return;const{fboCache:e,_rctx:t,_bindParameters:r}=this,i=this._framebufferSize,{highlights:s}=r,a=e.acquire(i.width,i.height,"highlights",s.length>z?F.RG8UINT:F.R8UINT);a.acquireDepth(v.DEPTH24_STENCIL8),t.bindFramebuffer(a.fbo);const{gl:n}=t;return n.clearBufferuiv(n.COLOR,0,[0,0,0,0]),this._renderContext.output=q.Highlight,t.bindFramebuffer(a.fbo),Y(t,e,i,r,(()=>this._renderHighlightGeometries())),this.performanceInfo.advance(Re.HIGHLIGHTS),a}_renderHighlightGeometries(){this._plugins.render(this._pluginInput,...Ue),this._rctx.clear(we.DEPTH),this._renderHUDElements(j.Both)}get _needsShadowAccumulation(){return this._shadowAccumulator.accumulating}_renderShadowAccumulation(e,t,r){this._needsShadowAccumulation&&this._bindParameters.depth&&this._shadowAccumulator.renderAccumulation(this._bindParameters.depth,e,t,r)&&this.performanceInfo.advance(Re.ACCUMULATED_SHADOWS)}_precompileTransparentGeometry(){this._oitEnabled&&V(this._renderContext.output)?(this._bindParameters.oitPass=ne.ColorAlpha,this._plugins.precompile(...Me),this._bindParameters.oitPass=ne.FrontFace,this._plugins.precompile(...Me),this._bindParameters.oitPass=ne.NONE):this._plugins.precompile(...Me)}_renderOIT(e,t,r=j.Both){const i=e===ye.HUD,s=this._framebufferSize,a=i?this.fboCache.acquire(s.width,s.height,"oit hud composite"):null,n=i?()=>this._renderHUDElements(r):()=>this._renderTransparentGeometry(),h=this._bindParameters,o=this._renderContext.output;this._renderContext.output=t,h.oitPass=ne.ColorAlpha;const d=a?"oit hud color+alpha":"oit color+alpha",_=this.fboCache.acquire(s.width,s.height,d,F.RGBA16FLOAT),l=t===q.ColorEmission;l&&_.acquireColor(Oe,F.RGBA16FLOAT,"emissive"),_.acquireColor(l?De:Oe,F.R16FLOAT),a||_.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(_.fbo),this._rctx.clearFramebuffer([0,0,0,1]),l&&this._rctx.clearBuffer(1,I),n(),_.detachDepth(),h.oitPass=ne.FrontFace;const p=this.fboCache.acquire(s.width,s.height,a?"oit hud front":"oit front");return l&&p.acquireColor(Oe,F.RGBA16FLOAT,"emissive"),a?p.acquireDepth(U.DEPTH16):p.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(p.fbo),this._rctx.clearFramebuffer(w,!!a),n(),p.detachDepth(),h.oitPass=ne.NONE,a?(this._rctx.bindFramebuffer(a.fbo),this._rctx.setClearColor(0,0,0,1e-13),this._rctx.clear(we.COLOR)):this._framebuffer.bind(),this._oitblend??=new X(this._techniques),this._oitblend.blend(this._rctx,_,p,h,l),a?.detachDepth(),p.release(),_.release(),this._renderContext.output=o,a}_renderOpaque(e){const t=this.plugins.produces(q.Color,...Le);t&&this._renderOpaqueGeometry();const r=this._framebuffer;r.update((e=>this._renderNodes(D.OPAQUE,e,t))),this.fboCache.debugCallback?.(D.OPAQUE,r.color.fbo),r.update((e=>this._renderNodes(N.OPAQUE_ENVIRONMENT,e))),this.fboCache.debugCallback?.(N.OPAQUE_ENVIRONMENT,r.color.fbo),this._renderTerrainDepth(e),this._renderEdges(Te.OPAQUE)}_renderTransparent(e,t,r){const i=this._framebuffer;i.bind(),this._renderPlugins(me.VOXEL,Re.VOXEL),this._renderHiddenTransparentEdges(),e&&(this._oitEnabled?this._renderOIT(ye.Geometry,r):this._renderTransparentGeometry()),i.update((t=>this._renderNodes(D.TRANSPARENT,t,e))),this.fboCache.debugCallback?.(D.TRANSPARENT,i.color.fbo),this._renderGeometryDepth(t),this._renderHUDVisibility(),t||this._plugins.render(this._pluginInput,me.LINE_CALLOUTS),this._renderEdges(Te.TRANSPARENT);const s=this._hasTransparentTerrain?this._renderTransparentTerrain():null;s&&(this.performanceInfo.advance(Re.TRANSPARENT_TERRAIN),this._bindParameters.hudVisibility&&(t?this._renderLineCallouts(j.Occluded):(this._rctx.bindFramebuffer(this._bindParameters.hudVisibility?.fbo),this._compositingHelper.compositeHUD(this._bindParameters,s.getTexture())),this._renderHUD(j.Occluded,i.color,r))),this._bindParameters.cullAboveTerrain=!1,s&&(i.bind(),this._compositingHelper.compositePreMultipliedAlpha(this._bindParameters,s.getTexture()),s.release(),t&&(this._renderEdges(Te.OPAQUE),e&&(this._oitEnabled?this._renderOIT(ye.Geometry,r):this._renderTransparentGeometry(),this.performanceInfo.advance(Re.TRANSPARENT)),this._renderEdges(Te.TRANSPARENT))),this._bindParameters.ssao=d(this._bindParameters.ssao),t&&this._renderLineCallouts(j.NotOccluded),this._bindParameters.terrainDepthTest=!1,this._renderTransparentEnvironment()}_renderTransparentEnvironment(){this._shadowAccumulator.render(this._bindParameters),this.performanceInfo.advance(Re.APPLY_ACCUMULATED_SHADOWS),this._framebuffer.bind(),this._plugins.render(this._pluginInput,me.TRANSPARENT_MATERIAL_WITHOUT_DEPTH),this.performanceInfo.advance(Re.TRANSPARENT_MATERIAL_WITHOUT_DEPTH)}_renderPlugins(e,t){this._plugins.produces(this._renderContext.output,e)&&(this._plugins.render(this._pluginInput,e),this.performanceInfo.advance(t))}_renderNodes(e,t,r=!1){if(t.setName(e),this._pluginInput.set(e,t),!this._nodes.produces(e))return r&&this.performanceInfo.advance(e),t;const i=this._nodes.render(t,this._pluginInput,this._releaseNormals);return this.performanceInfo.advance(e),i}_blitFBO(e,t=M,r=!0){return this._blit??=new k(this._techniques),this._blit.blit(this._rctx,e,t,this._bindParameters),this._pluginInput.set(e.name,t),r&&e.release(),t}_ensureBindParametersCamera(e,t){this._bindParameters.camera=e,this._bindParameters.contentCamera=t}_ensureBindParametersSSR(e){if(this._bindParameters.ssr.lastFrameColor){null==this._ssrEnableTime&&(this._ssrEnableTime=e),this._renderContext.lastFrameCamera.equals(this._bindParameters.camera)?this._reprojectionMatrix=P:(A(qe,this._bindParameters.camera.viewMatrix),A(Ge,this._bindParameters.camera.projectionMatrix),E(Ve,qe,Ge),E(Ve,this._renderContext.lastFrameCamera.viewMatrix,Ve),E(Ve,this._renderContext.lastFrameCamera.projectionMatrix,Ve),this._reprojectionMatrix=Ve);const t=this.stage.view.qualitySettings.fadeDuration;this._bindParameters.ssr.fadeFactor=t>0?Math.min(t,e-this._ssrEnableTime)/t:1,this._bindParameters.ssr.fadeFactor<1&&this._requestRender()}else this._reprojectionMatrix=P,this._ssrEnableTime=null}addRenderNode(e){this._nodes.add(e),this._requestRender()}removeRenderNode(e){this._nodes.remove(e),this._requestRender()}updateLighting(e,t,r,i){this._bindParameters.updateLighting(e,t,r,i),this._requestRender(Z.UPDATE)}get usedMemory(){return{fbos:this.fboCache.usedMemory,plugins:this._plugins.usedMemory,edges:this.edgeView?.usedMemory??0}}renderToTargets(e,t,r,i,s=!1,a=!1){t.attachDepth(r),this._rctx.bindFramebuffer(t.fbo),this._rctx.clearFramebuffer(i,s,a),e(),t.detachDepth()}get test(){}};var ye;e([f({readOnly:!0})],Ne.prototype,"fullResolutionAtmosphere",null),e([f()],Ne.prototype,"_edgeView",void 0),e([f()],Ne.prototype,"updating",null),Ne=e([b("esri.views.3d.webgl-engine.lib.Renderer")],Ne),function(e){e[e.Geometry=0]="Geometry",e[e.HUD=1]="HUD"}(ye||(ye={}));const xe=[me.INTEGRATED_MESH,me.OPAQUE_TERRAIN,me.OPAQUE_MATERIAL,me.TRANSPARENT_MATERIAL],He=[me.OPAQUE_MATERIAL_WITHOUT_NORMALS,me.TRANSPARENT_MATERIAL_WITHOUT_NORMALS],Le=[me.INTEGRATED_MESH,me.OPAQUE_TERRAIN,me.OPAQUE_MATERIAL,me.OPAQUE_MATERIAL_WITHOUT_NORMALS],Me=[me.TRANSPARENT_MATERIAL,me.TRANSPARENT_MATERIAL_WITHOUT_NORMALS],ve=[me.OPAQUE_MATERIAL,me.TRANSPARENT_MATERIAL,me.TRANSPARENT_MATERIAL_WITHOUT_DEPTH],Fe=[me.LINE_CALLOUTS_HUD_DEPTH,me.HUD_MATERIAL,me.LABEL_MATERIAL],Ue=[me.TRANSPARENT_MATERIAL,me.TRANSPARENT_MATERIAL_WITHOUT_NORMALS,me.OPAQUE_MATERIAL,me.OPAQUE_MATERIAL_WITHOUT_NORMALS,me.TRANSPARENT_TERRAIN,me.INTEGRATED_MESH,me.OPAQUE_TERRAIN],Ge=R(),qe=R(),Ve=R();function je(e){return t=>e.immediate.schedule(t)}export{Ne as Renderer};
5
+ import{_ as e}from"../../../../chunks/tslib.es6.js";import{update as t}from"../../../../core/arrayUtils.js";import{createTask as r}from"../../../../core/asyncUtils.js";import{unitRGBAFromColor as i}from"../../../../core/colorUtils.js";import has from"../../../../core/has.js";import{clamp as s,lerp as a}from"../../../../core/mathUtils.js";import{removeMaybe as n,abortMaybe as h,destroyMaybe as o,releaseMaybe as d}from"../../../../core/maybe.js";import{throwIfAborted as _}from"../../../../core/promiseUtils.js";import{watch as l,syncAndInitial as p,initial as u,sync as m}from"../../../../core/reactiveUtils.js";import{signal as c}from"../../../../core/signal.js";import{Milliseconds as g}from"../../../../core/time.js";import{property as f}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import{subclass as b}from"../../../../core/accessorSupport/decorators/subclass.js";import{equals as T,invert as A,multiply as E}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as P,create as R}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{s as S}from"../../../../chunks/vec42.js";import{ZEROS as I}from"../../../../core/libs/gl-matrix-2/factories/vec4f32.js";import{fromValues as C,ZEROS as w}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{pruneIndexArrays as O}from"../../../../geometry/support/Indices.js";import{RenderCategory as D,InternalRenderCategory as N}from"../../webgl.js";import{innerAtmosphereFadeStart as y}from"../../environment/atmosphereUtils.js";import{minNearDistanceInMeters as x}from"../../state/NearFarHeuristic.js";import{debugFlags as H}from"../../support/debugFlags.js";import{FBOCache as L,defaultWebGLFBO as M}from"../core/FBOCache.js";import{DepthFormat as v,ColorFormat as F}from"../core/FBOCacheFormats.js";import{RenderPassManager as U}from"../core/renderPasses/RenderPassManager.js";import{ShaderOutput as G,isColorOrColorEmission as q}from"../core/shaderLibrary/ShaderOutput.js";import{HUDRenderStyle as V}from"../core/shaderLibrary/hud/HUDRenderStyle.js";import{distanceFadeEnd as j}from"../core/shaderLibrary/shading/ScreenSpaceConstants.js";import{RenderNodes as B}from"../effects/RenderNodes.js";import{RenderPluginManager as Q}from"../effects/RenderPluginManager.js";import{Blit as W}from"../effects/blit/Blit.js";import{maxHighlightsPerChannel as k,renderHighlightBuffer as z}from"../effects/highlight/Highlight.js";import{OITBlend as Y}from"../effects/transparency/OITBlend.js";import{AnimationTimer as X}from"./AnimationTimer.js";import{AnimationTimeStep as K}from"./AnimationTimeStep.js";import{RenderRequestType as J}from"./basicInterfaces.js";import{BoundingInfo as Z}from"./BoundingInfo.js";import{DepthRange as $}from"./DepthRange.js";import{depthRangeFromScene as ee,DepthRangeMode as te}from"./depthRangeUtils.js";import{hudFragmentOpacityParameters as re}from"./hudFragmentOpacityParameters.js";import{MainFramebuffer as ie}from"./MainFramebuffer.js";import{RenderOccludedFlag as se}from"./Material.js";import{OITPass as ae}from"./OITPass.js";import{RenderContext as ne,defaultRenderOccludedMask as he}from"./RenderContext.js";import{RendererBase as oe}from"./RendererBase.js";import{RendererTarget as de}from"./rendererUtils.js";import{setupFeatureDefaults as _e,RenderFeature as le}from"./RenderFeature.js";import{RenderPluginInput as pe}from"./RenderPluginInput.js";import{RenderSlot as ue}from"./RenderSlot.js";import{ShadowAccumulator as me}from"./ShadowAccumulator.js";import{ShadowMap as ce,SnapshotSlot as ge}from"./ShadowMap.js";import fe from"./SliceHelper.js";import{Transparency as be}from"./edgeRendering/interfaces.js";import{MergedRenderer as Te}from"../materials/renderers/MergedRenderer.js";import{RenderSceneResult as Ae}from"../parts/renderUtils.js";import{RendererPerformanceInfo as Ee,PerformanceCategory as Pe}from"../statistics/RendererPerformanceInfo.js";import{RenderState as Re}from"../../../support/RenderState.js";import{PixelFormat as Se,PixelType as Ie,FramebufferBit as Ce,ColorAttachment1 as we,ColorAttachment2 as Oe}from"../../../webgl/enums.js";let De=class extends oe{constructor(e,t,r,s,a,n){super({stage:e}),this._techniques=r,this._rctx=s,this._compositingHelper=a,this._requestRender=n,this._pluginsHas={hudElements:!1,water:!1},this.renderPassManager=new U,this._isRendering=!1,this._inGlobeView=!1,this._backgroundColor=C(0,0,0,1),this._sliceHelper=new fe,this._blit=null,this._oitblend=null,this.sceneDepthRange=c($.infinite),this._state=c(Re.IDLE),this._highQualityTransparencyEnabled=!0,this._ssrEnabled=!1,this._hasAnimations=!1,this._animationTimestep=new K,this._loadEdgeViewTask=null,this._edgeViewCallbacks=[],this._reprojectionMatrixVersion=c(0),this._lastFrameTime=g(0),this._renderHiddenTransparentEdges=()=>{},this._pluginInput=new pe,this._releaseNormals=e=>{e.some((({name:e})=>"normals"===e))&&this._pluginInput.release("normals")},this._debugNeedsDepth=!1,this.fboCache=new L(s),this._renderStateFeatures=c(_e(!has("disable-feature:high-quality-idle"),e.view.qualityProfile)),this._framebuffer=new ie(this.fboCache),this.performanceInfo=new Ee(this._rctx),this._shadowMap=new ce(this.fboCache,e.viewingMode),this._shadowAccumulator=new me(this.fboCache,r,e,(e=>{const t=this.shadowsEnabled;this._shadowMap.enabled=!0,this._ensureBindParametersCamera(e.camera,e.contentCamera),this._plugins.prepareRender(),this._shadowMap.enabled=t}),((t,r,i)=>{const s=e.view.qualitySettings.maximumPixelRatio;t.shadowMap.start(t.camera,r,i,!0,s),this._renderShadowCascades(G.Shadow,t.shadowMap),t.shadowMap.finish(),t.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(t.camera,t.contentCamera)}),n),this._renderContext=new ne(this._rctx,this._shadowMap,r),this._nodes=new B(this._renderContext),this._plugins=new Q({renderContext:this._renderContext,techniques:r,materials:t,requestRender:n,controller:e,fbos:this.fboCache,isFeatureEnabled:e=>this.isFeatureEnabled(e)}),this._plugins.add(this.renderPassManager),this.addHandles([l((()=>e.view.state.camera),(()=>n()),p),l((()=>H.EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES),(e=>{this._renderHiddenTransparentEdges=e?()=>this._renderEdges(be.TRANSPARENT):()=>{},n()}),u),l((()=>e.view.environment.background?.color),(e=>{const t=e?i(e):w;S(this._backgroundColor,t[0]*t[3],t[1]*t[3],t[2]*t[3],t[3]),n()}),p),l((()=>e.view.state.camera.relativeElevation),(e=>this._inGlobeView=(e??1/0)>=j),p),l((()=>this._bindParameters.clouds.fadeFactor),(()=>this._bindParameters.fadeLighting()),m),l((()=>this._bindParameters.clouds.data?.state),(()=>n()),m),l((()=>e.view.state.highlights),(e=>{this._bindParameters.highlights=e,n()}),u)])}destroy(){this._gpuTimerHandle=n(this._gpuTimerHandle),this._nodes.destroy(),this._framebuffer.dispose(),this._shadowMap.dispose(),this._shadowAccumulator.dispose(),this._loadEdgeViewTask=h(this._loadEdgeViewTask),this._edgeView=o(this._edgeView),this.renderPassManager.dispose(),this._releaseFBOs(),this._disposeOffscreenBuffers(),this.fboCache.destroy(),this._plugins.destroy(),this._blit=null,this._oitblend=null,Z.prune(),Te.prune(),O()}get renderContext(){return this._renderContext}get _bindParameters(){return this._renderContext.bind}get _framebufferSize(){return this._framebuffer.size}updateRenderFeatures(e=null,t=!has("disable-feature:high-quality-idle")){this._renderStateFeatures.value=_e(t,e),this._requestRender()}isFeatureEnabled(e,t=this._state.value){return this._renderStateFeatures.value.get(t,e)??!1}setFeatureEnabled(e,t,r){this._renderStateFeatures.mutate((i=>i.set(t,e,r))),this._requestRender()}get _highQualityTransparency(){return this._highQualityTransparencyEnabled||this.isFeatureEnabled(le.HighQualityTransparency)}get hasReflections(){return this._pluginsHas.water&&(this._ssrEnabled||this.isFeatureEnabled(le.WaterReflection))}get _hasHighlights(){return this._plugins.produces(G.Highlight,ue.OPAQUE_MATERIAL,ue.TRANSPARENT_MATERIAL,ue.DRAPED_MATERIAL,ue.HUD_MATERIAL,ue.LABEL_MATERIAL)}hasHighlight(e){return this._plugins.hasHighlight(e)}get _hasHUDHighlights(){return this._plugins.produces(G.Highlight,ue.HUD_MATERIAL,ue.LABEL_MATERIAL)}get hasSSAO(){return(this.stage.view.qualitySettings.ambientOcclusion||this.isFeatureEnabled(le.SSAO))&&!this._inGlobeView}get hasSMAA(){return this.stage.view.qualitySettings.antialiasingEnabled||this.isFeatureEnabled(le.Antialiasing)}get fullResolutionAtmosphere(){return this.stage.view.qualitySettings.highResolutionAtmosphere||this.isFeatureEnabled(le.HighResolutionAtmosphere)}_releaseFBOs(){this._bindParameters.ssr.lastFrameColor=d(this._bindParameters.ssr.lastFrameColor),this._bindParameters.terrainDepth=d(this._bindParameters.terrainDepth),this._bindParameters.geometryDepth=d(this._bindParameters.geometryDepth)}_disposeOffscreenBuffers(){this._framebuffer.dispose(),this._disposeBindBuffers()}_disposeBindBuffers(){this._shadowMap.disposeOffscreenBuffers(),this._bindParameters.depth=d(this._bindParameters.depth),this._bindParameters.hudVisibility=d(this._bindParameters.hudVisibility)}get updating(){return this._loadEdgeViewTask&&!this._loadEdgeViewTask.finished||this._edgeView?.updating||this._shadowAccumulator.running||this._plugins.updating||!this.isCameraFinal}loadEdgeView(){return this._loadEdgeViewTask||(this._loadEdgeViewTask=r((async e=>{const{EdgeView:t}=await import("./edgeRendering/EdgeView.js");_(e);const r=this._edgeView=new t({rctx:this._rctx,renderSR:this.stage.view.renderSpatialReference,viewingMode:this.stage.view.stage.viewingMode,techniques:this._techniques,setNeedsRender:()=>this._requestRender(),schedule:Ve(this.stage.view.resourceController)});return this.addHandles(l((()=>r.updating),(()=>this._requestRender()),m)),this._requestRender(),this._edgeViewCallbacks.forEach((e=>e(r))),this._edgeViewCallbacks.length=0,r}))),this._loadEdgeViewTask.promise}withEdgeView(e){this.loadEdgeView(),null==this._edgeView?this._edgeViewCallbacks.push(e):e(this._edgeView)}get edgeView(){return this._edgeView}get isCameraFinal(){return this._reprojectionMatrixVersion.value>=0&&T(this._bindParameters.ssr.reprojectionMatrix,P)}set _reprojectionMatrix(e){t(this._bindParameters.ssr.reprojectionMatrix,e)&&this._reprojectionMatrixVersion.value++}get shadowsEnabled(){return!!this._shadowMap?.enabled}setParameters(e){const{_shadowMap:t,_bindParameters:r}=this;if(void 0!==e.qualitySettings?.reflections&&this._ssrEnabled!==e.qualitySettings.reflections&&(this._ssrEnabled=e.qualitySettings.reflections,this._requestRender()),void 0!==e.shadowMap&&this._shadowMap.enabled!==e.shadowMap&&(this._shadowMap.enabled=e.shadowMap,this._requestRender()),void 0!==e.shadowMapMaxCascades&&t.maxCascades!==e.shadowMapMaxCascades&&(t.maxCascades=e.shadowMapMaxCascades,this._requestRender()),null!=e.environment){if(null!=e.environment.weather){const t=e.environment.weather;this._bindParameters.weather=t,this._bindParameters.snowCover=!!e.weatherVisible&&null!=t&&"snowy"===t.type&&"enabled"===t.snowCover}const t="virtual"!==e.environment.lighting.type;r.enableFillLights!==t&&(r.enableFillLights=t,this._requestRender())}void 0!==e.highQualityTransparency&&this._highQualityTransparencyEnabled!==e.highQualityTransparency&&(this._highQualityTransparencyEnabled=e.highQualityTransparency,this._requestRender()),void 0!==e.shadowCast&&this._shadowAccumulator.setOptions(e.shadowCast)}set slice(e){this._sliceHelper.update(e)&&this._requestRender()}get plugins(){return this._plugins}get _hasOITSupport(){return this._rctx.driverTest.floatBufferBlend.result}get _oitEnabled(){return this._highQualityTransparency&&this._hasOITSupport}commit(e,t){return this._isRendering&&console.warn("Renderer.modify called while rendering"),!!super.commit(e,t,this._plugins.context)&&(this.updateHasFlags(),!0)}rendererAdded(e){this._plugins.add(e)}rendererRemoved(e){this._plugins.remove(e)}updateHasFlags(){const has=this._pluginsHas;has.hudElements=this._plugins.produces(G.Color,...ve),has.water=this._plugins.produces(G.Normal,ue.DRAPED_WATER),this._bindParameters.hasOccludees=this._plugins.hasOccludees,this._requestRender()}updateAnimation(e,t){this._animationTimer??=new X(e.camera,t),this._animationTimer.advance(e.camera,t,this._animationTimeDilation);const r=this._hasAnimations;return this._hasAnimations=this._plugins.updateAnimation(this._animationTimer),this._hasAnimations=this._nodes.updateAnimation(this._animationTimer)||this._hasAnimations,this._hasAnimations!==r&&(this._gpuTimerHandle=r?n(this._gpuTimerHandle):this.performanceInfo.enableGPUPerformanceInfo()),this._hasAnimations}get animationTimestep(){return this._animationTimestep.value}get _animationTimeDilation(){return this._animationTimestep.timeDilation}resetAnimation(){this._animationTimestep.clear()}tick(){this.fboCache.clean()}render(e,t,r=de.Default,i=!1){try{return this._isRendering=!0,this._render(e,t,r,i)}catch(s){console.error(`Exception during rendering: ${s}`)}finally{this._isRendering=!1}return new Ae(this._pluginInput.get(D.FINAL),null)}_updateHUDOccludedFragmentOpacity(e,t){const{idleOpacity:r,navigatingOpacity:i,maxDelta:n,tiltFadeStart:h,tiltFadeEnd:o,altitudeStart:d,altitudeEnd:_}=re,l=this.stage.view,p=l.stateManager.camera,u=l.qualitySettings.fadeDuration,m=e===Re.IDLE?r:i,c=s((p.tilt-h)/(o-h),0,1),g=s(((p.position.z??0)-d)/(_-d),0,1),f=a(a(1,m,c),1,g),b=this._bindParameters.hudOccludedFragmentOpacity;if(u<=0||b===f||0===this._lastFrameTime||this._lastFrameTime>t)return this._bindParameters.hudOccludedFragmentOpacity=f,void(this._lastFrameTime=t);const T=t-this._lastFrameTime;this._lastFrameTime=t;const A=Math.max(1-r,Math.abs(r-i)),E=Math.min(A*T/u,n);E>=Math.abs(f-b)?this._bindParameters.hudOccludedFragmentOpacity=f:(this._bindParameters.hudOccludedFragmentOpacity=b+Math.sign(f-b)*E,this._requestRender())}_render(e,t,r=de.Default,i){this.performanceInfo.startFrame(),this.fboCache.frameStart(),this.fboCache.interactive=r===de.Default,this._disposeBindBuffers();const{camera:s,contentCamera:a,mode:n,alignPixelEnabled:h}=e;this._state.value=n;const o=this._nodes.produces("magnifier-color"),d=this._nodes.produces(D.FINAL),_=this._nodes.require("emissive",N.TRANSPARENT_ENVIRONMENT,D.COMPOSITE,D.FINAL)>0&&this._plugins.hasEmissions,l=_?G.ColorEmission:G.Color;this._renderContext.time=t,this._renderContext.output=l,this._bindParameters.oitPass=ae.NONE,this._bindParameters.alignPixelEnabled=h,this._bindParameters.decorations=!i,this._bindParameters.mainDepth=null;const p=!i||!this._sliceHelper.isDecoration;this._bindParameters.slicePlane=p?this._sliceHelper.plane:null,this._bindParameters.viewshedEnabled=this._nodes.produces(N.VIEWSHED),this._renderOverlay(t),s.setGLViewport(this._rctx);const u=this._framebuffer,m=u.initialize(s.fullWidth,s.fullHeight,this._backgroundColor,_);this.hasReflections?(m?.setName("last frame color"),this._bindParameters.ssr.lastFrameColor=m):m?.release(),this._ensureBindParametersCamera(s,a),this._updateHUDOccludedFragmentOpacity(n,t),this._plugins.prepareRender(),this._bindParameters.shadowHighlightsVisible=this._needsShadowHighlight&&!i;const c=this._highQualityTransparency&&this._hasTransparentTerrain,g=this._plugins.produces(G.Color,...Le);this._precompilePrepasses(),this.performanceInfo.advance(Pe.PREPARE);const f=this._computeShadowDepthRange(s);this._renderShadowMap(s,this._bindParameters.lighting.mainLight.direction,f),this._ensureBindParametersCamera(s,a),this._pluginInput.set("normals",this._renderNormals()),this._renderRemainingGeometryDepth(),this._renderShadowAccumulation(f,s,a),this._ensureBindParametersSSR(t),this._precompileShaders(c,g,l),this._renderContext.output=l,u.bind(),this._bindParameters.mainDepth=u.depth.attachment,this._renderOpaque(c),this._renderTransparent(g,c,l),this._pluginInput.set(N.FOCUSAREA,this._renderFocusAreaGeometry()),u.update((e=>this._renderNodes(N.TRANSPARENT_ENVIRONMENT,e))),u.update((e=>this._renderNodes(N.VIEWSHED,e))),u.update((e=>this._renderNodes(N.LASERLINES,e))),u.update((e=>this._renderNodes(N.FOCUSAREA_COLOR,e))),this._pluginInput.release(N.FOCUSAREA),u.update((e=>this._renderNodes(N.OCCLUDED,e))),this._pluginInput.set("highlights",this._renderHighlightPrepass());const b=r===de.ObjectAndLayerID?this._renderObjectAndLayerIdColor():null;u.update((e=>this._renderNodes(D.COMPOSITE,e)));const T=!(r!==de.Default||d||o&&!i),A=this._pluginInput.get(D.COMPOSITE),E=T?M:this.fboCache.acquire(A.fbo.width,A.fbo.height,N.ANTIALIASING),P=this._nodes.produces(N.ANTIALIASING)?this._renderNodes(N.ANTIALIASING,E):this._blitFBO(A,E,!1);let R;this._pluginInput.set(N.ANTIALIASING,P),this._hasHUDHighlights?(this._renderHUD(V.NotOccluded,P,l),R=this._renderNodes(N.HIGHLIGHTS,P)):(R=this._renderNodes(N.HIGHLIGHTS,P),this._renderHUD(V.NotOccluded,R,l));const S=this._renderNodes(N.MAGNIFIER,R);return o&&!i&&r===de.Default&&!d&&this._blitFBO(S),d?(S.attachDepth(u.depth),this._blitFBO(this._renderNodes(D.FINAL,S)),S.detachDepth()):this._pluginInput.set(D.FINAL,S),this._pluginInput.release("highlights"),this.onPostRender&&this.onPostRender(),this._releaseFBOs(),u.releaseDepth(),this._renderContext.lastFrameCamera.copyFrom(this._bindParameters.camera),this.fboCache.frameEnd(),this.performanceInfo.finishFrame(),r!==de.Default&&(this._releaseFBOs(),this._disposeOffscreenBuffers()),new Ae(this._pluginInput.get(D.FINAL),b)}_precompileShaders(e,t,r){++this._plugins.context.techniques.precompiling,this._renderContext.output=r,this._precompileOpaqueGeometry(),this._nodes.precompile(N.OPAQUE_ENVIRONMENT),this._bindParameters.terrainDepthTest=e,this._bindParameters.cullAboveTerrain=e,this._renderContext.output=G.Depth,this._plugins.precompile(ue.TRANSPARENT_TERRAIN),e&&(this._precompileOpaqueGeometry(),this._precompileTransparentGeometry()),this._renderContext.output=r,this._plugins.precompile(ue.TRANSPARENT_TERRAIN),t&&(this._precompileTransparentGeometry(),this._hasTransparentTerrain&&(this._bindParameters.cullAboveTerrain=!1,this._precompileTransparentGeometry(),this._bindParameters.cullAboveTerrain=e)),this._nodes.precompile(N.FOCUSAREA),this._needsHUDVisibility&&this._plugins.precompile(ue.OCCLUSION_PIXELS),this._plugins.precompile(ue.LINE_CALLOUTS),this._precompileHUD(V.Occluded),this._bindParameters.terrainDepthTest=!1,this._bindParameters.cullAboveTerrain=!1,this._nodes.precompile(N.VIEWSHED,N.LASERLINES,N.FOCUSAREA_COLOR,N.OCCLUDED,N.ANTIALIASING,N.HIGHLIGHTS);const i=this._bindParameters;i.highlightMixTexture=i.highlights.length>1?this._rctx.emptyTexture:null,this._precompileHUD(V.NotOccluded),this._hasHighlights&&(i.highlights.forEach(((e,t)=>{i.highlightLevel=t,this._precompileAllGeometry(G.Highlight)})),i.highlightLevel=null),i.highlightMixTexture=null,this._nodes.precompile(D.COMPOSITE,N.MAGNIFIER),this._shadowAccumulator.precompile(),this._plugins.precompile(ue.TRANSPARENT_MATERIAL_WITHOUT_DEPTH),--this._plugins.context.techniques.precompiling}_renderFocusAreaGeometry(){const e=this._nodes.produce(N.FOCUSAREA,this._pluginInput);return e&&this.performanceInfo.advance(Pe.FOCUS_AREA_MASK),e}_renderObjectAndLayerIdColor(){if(!this._nodes.produces("olid"))return null;const e=this._renderContext.output;++this._techniques.precompiling;const t=this._framebufferSize;let r=this.fboCache.acquire(t.width,t.height,"olid");return r.acquireDepth(v.DEPTH24_STENCIL8),r=this._nodes.render(r,this._pluginInput),--this._techniques.precompiling,this.performanceInfo.advance(Pe.OBJECT_AND_LAYER_ID_COLOR),this._renderContext.output=e,r}finish(e){this._hasAnimations||this._animationTimestep.clear();const t=this.performanceInfo.gpuSamplingEnabled,r=e===J.BACKGROUND;if(r||t){const e=r?this.performanceInfo.elapsedTime:0;let i=0;t?i=this.performanceInfo.totalGPUTimeSampler.last:this._rctx.gl.finish();const s=Math.max(e,i);this._animationTimestep.frame(s,r)}}readMainDepth(e,t){const{mainDepth:r,camera:i}=this._bindParameters;if(!r)return;const s=this.fboCache.acquire(this._framebufferSize.width,this._framebufferSize.height,"linear-depth");this._rctx.bindFramebuffer(s.fbo),i.setGLViewport(this._rctx),this._rctx.setScissorRect(e[0],e[1],e[2],e[3]),this._rctx.setScissorTestEnabled(!0),this._rctx.clearFramebuffer(w),this._compositingHelper.blitDepthToLinearDepth(this._bindParameters,r),this._rctx.setScissorTestEnabled(!1),this._rctx.setScissorRect(0,0,this._rctx.gl.canvas.width,this._rctx.gl.canvas.width),s.fbo?.readPixels(e[0],e[1],e[2],e[3],Se.RGBA,Ie.UNSIGNED_BYTE,t),s.release()}readHUDVisibility(e,t,r,i,s){this._bindParameters.hudVisibility?.fbo?.readPixels(e,t,r,i,Se.RGBA,Ie.UNSIGNED_BYTE,s)}readAccumulatedShadow(e){return this._shadowAccumulator.readAccumulatedShadow(e[0],e[1])}_renderEdges(e){const t=this._edgeView;if(!t?.shouldRender())return;const r=this._framebufferSize,i=this.fboCache.acquire(r.width,r.height,"edges"),s=()=>t.render(this._bindParameters,e),a=this._bindParameters.geometryDepth;this.renderToTargets(s,i,a??this._framebuffer.depth,w),this._framebuffer.bind(),this._compositingHelper.composite(this._bindParameters,i.getTexture()),i.release(),this.performanceInfo.advance(e===be.OPAQUE?Pe.OPAQUE_EDGES:Pe.TRANSPARENT_EDGES)}_renderOverlay(e){this._bindParameters.overlay=this.overlay?.render(e),this._bindParameters.overlay&&this.performanceInfo.advance(Pe.OVERLAY)}_renderShadowMap(e,t,r){if(!this.shadowsEnabled)return;const i=this._shadowMap;i.start(e,t,r,this.isFeatureEnabled(le.HighResolutionShadows),this.stage.view.qualitySettings.maximumPixelRatio),this._needsShadowHighlight?(this._renderShadowCascades(G.ShadowHighlight,this._shadowMap),i.moveSnapshot(ge.Highlight),this._renderShadowCascades(G.ShadowExcludeHighlight,this._shadowMap),i.copySnapshot(ge.ExcludeHighlight),this._renderShadowCascades(G.ShadowHighlight,this._shadowMap)):this._renderShadowCascades(G.Shadow),i.finish(),e.setGLViewport(this._rctx),this.performanceInfo.advance(Pe.SHADOW_MAP)}_precompileShadowCascades(e){for(const t of this._shadowMap.cascades)t.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(t.camera,t.camera),this._precompileAllGeometry(e)}_renderShadowCascades(e,t=this._shadowMap){t.bindFbo();for(const r of t.cascades)r.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(r.camera,r.camera),this.renderAllGeometry(e)}get _needsDepth(){return this._plugins.consumes(G.Depth)||this._nodes.requireGeometryDepth()||this.hasReflections||this._needsShadowHighlight||this._needsShadowAccumulation||this._debugNeedsDepth}_renderRemainingGeometryDepth(){const e=this._pluginInput.get("normals");e?(this._pluginInput.set(N.SSAO,this._renderSSAO()),this._needsDepth?(this._rctx.bindFramebuffer(e.fbo),this._rctx.clear(Ce.STENCIL),this._renderGeometryWithoutNormals(G.Depth),d(this._bindParameters.depth),this._bindParameters.depth=e.obtainDepthTexture(),this.performanceInfo.advance(Pe.DEPTH)):(e.detachDepth(),this._bindParameters.depth=d(this._bindParameters.depth)),this.hasSSAO&&this._pluginInput.release("normals")):this._renderAllGeometryDepth()}_renderAllGeometryDepth(){if(!this._needsDepth)return void(this._bindParameters.depth=d(this._bindParameters.depth));const e=this._framebufferSize,t=this.fboCache.acquire(e.width,e.height,"depth",v.DEPTH24_STENCIL8);this._rctx.bindFramebuffer(t.fbo),this._rctx.clear(Ce.DEPTH|Ce.STENCIL),this.renderAllGeometry(G.Depth),d(this._bindParameters.depth),this._bindParameters.depth=t.obtainDepthTexture(),t.release(),this.performanceInfo.advance(Pe.DEPTH)}_renderTerrainDepth(e){if(this._bindParameters.terrainDepthTest=e,this._bindParameters.cullAboveTerrain=e,!e)return void(this._bindParameters.terrainDepth=d(this._bindParameters.terrainDepth));const t=this._renderContext.output;this._renderContext.output=G.Depth;const r=this._framebufferSize,i=this.fboCache.acquire(r.width,r.height,"terrain depth",v.DEPTH24_STENCIL8);this._rctx.bindFramebuffer(i.fbo),this._rctx.clear(Ce.DEPTH|Ce.STENCIL),this._renderTransparentTerrain(),d(this._bindParameters.terrainDepth),this._bindParameters.terrainDepth=i.obtainDepthTexture(),this._renderContext.output=t,i.release()}_renderGeometryDepth(e){if(!e)return void(this._bindParameters.geometryDepth=d(this._bindParameters.geometryDepth));const t=this._renderContext.output,{width:r,height:i}=this._framebufferSize,s=this.fboCache.acquire(r,i,"geometry depth",v.DEPTH24_STENCIL8);this._rctx.bindFramebuffer(s.fbo),this._rctx.clear(Ce.DEPTH|Ce.STENCIL),this._renderOpaqueAndTransparentGeometry(G.Depth),this._renderContext.output=t,d(this._bindParameters.geometryDepth),this._bindParameters.geometryDepth=s.obtainDepthTexture(),s.release()}get _needsShadowDepthRange(){return this._shadowMap.enabled||this._needsShadowAccumulation}_computeShadowDepthRange(e){if(!this._needsShadowDepthRange)return $.zero;const t=ee(e,this._plugins.plugins,this.stage.layers,te.SHADOW_CASTERS);return t.union(this._plugins.queryDepthRange(e)),t.near=Math.max(e.near,t.near),t.far=Math.min(e.far,t.far),t}updateSceneDepthRange(e){if(!this.stage.view.state.isGlobal)return void(this.sceneDepthRange.value=$.infinite);if((this.stage.view.renderCoordsHelper?.getAltitude(e.eye)??0)<y)return void(this.sceneDepthRange.value=$.infinite);const t=e.clone();t.near=x,t.far=1e10;const r=ee(t,this._plugins.plugins,this.stage.layers,te.FULL_SCENE);r.union(this._plugins.queryDepthRange(t)),this.sceneDepthRange.value.far===r.far&&this.sceneDepthRange.value.near===r.near||(this.sceneDepthRange.value=r)}get _normalsRequired(){const e=this._nodes.require("normals",D.FINAL,D.COMPOSITE,D.OPAQUE,D.TRANSPARENT,N.VIEWSHED,N.LASERLINES);return(this.hasSSAO?1:0)+e}_precompilePrepasses(){this._normalsRequired&&this._precompileAllGeometry(G.Normal),this._needsDepth&&this._precompileAllGeometry(G.Depth),this.shadowsEnabled&&(this._needsShadowHighlight?(this._precompileShadowCascades(G.ShadowHighlight),this._precompileShadowCascades(G.ShadowExcludeHighlight),this._precompileShadowCascades(G.ShadowHighlight)):this._precompileShadowCascades(G.Shadow)),this._needsShadowAccumulation&&this._precompileAllGeometry(G.Shadow)}_renderNormals(){const e=this._normalsRequired;if(0===e)return;const t=this._framebufferSize,r=this.fboCache.acquire(t.width,t.height,"normals",F.RGBA8UNORM);r.acquireDepth(v.DEPTH24_STENCIL8),this._rctx.bindFramebuffer(r.fbo),this._rctx.clearFramebuffer(w,!0,!0),this._renderGeometryWithNormals(G.Normal);const i=this._nodes.optional("normals",D.FINAL,D.COMPOSITE,D.OPAQUE,D.TRANSPARENT,N.VIEWSHED);return r.retain(e+i-1),this.performanceInfo.advance(Pe.NORMALS),r}_renderSSAO(){const e=this._pluginInput.get("normals");if(!this.hasSSAO||!e)return;const t=this._nodes.produce(N.SSAO,this._pluginInput);return this._bindParameters.ssao=t,t&&this.performanceInfo.advance(Pe.SSAO),t}_precompileAllGeometry(e){const t=this._renderContext.output;this._renderContext.output=e,this._precompileOpaqueGeometry(),this._precompileTransparentGeometry(),this._plugins.precompile(ue.TRANSPARENT_TERRAIN),this._renderContext.output=t}renderAllGeometry(e){this._renderContext.output=e,this._renderOpaqueAndTransparentGeometry(e),this._renderTransparentTerrain()}precompileSlots(e,...t){for(const r of t)this._bindParameters.slot=r,e.precompile(this._renderContext)}precompileOccludedSlots(e,t){for(const r of t)this._renderContext.renderOccludedMask=r,this.precompileSlots(e,...Me);this._renderContext.renderOccludedMask=he}renderSlots(e,...t){for(const r of t)this._bindParameters.slot=r,e.forAll((e=>{const t=e.acquireTechniques(this._renderContext);t&&e.render(this._renderContext,t,this._pluginInput)}))}renderOccludedSlots(e,t){this._renderContext.renderOccludedMask=t,this.plugins.renderOccludedFlags>se.Occlude&&this._plugins.render(this._pluginInput,ue.OCCLUDED_TERRAIN),this.renderSlots(e,...Me),this._renderContext.renderOccludedMask=he}renderHUD(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(this._pluginInput,ue.HUD_MATERIAL)}precompileViewshedShadowMap(){this._precompileAllGeometry(G.ViewshedShadow)}renderViewshedShadowMap(e){const{camera:t,contentCamera:r}=this._bindParameters,i=this._renderContext.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this.renderAllGeometry(G.ViewshedShadow),this._ensureBindParametersCamera(t,r),this._bindParameters.camera.setGLViewport(this._rctx),this._renderContext.output=i}_renderOpaqueAndTransparentGeometry(e){this._renderContext.output=e,this._renderOpaqueGeometry(),this._renderTransparentGeometry()}_renderGeometryWithNormals(e){this._renderContext.output=e,this._plugins.render(this._pluginInput,...ye),this._renderTransparentTerrain()}_renderGeometryWithoutNormals(e){this._renderContext.output=e,this._plugins.render(this._pluginInput,...xe)}_precompileOpaqueGeometry(){this._plugins.precompile(...He)}_renderOpaqueGeometry(){this._plugins.render(this._pluginInput,...He)}_renderTransparentGeometry(){this._plugins.render(this._pluginInput,...Le)}get _hasTransparentTerrain(){return this._plugins.produces(G.Color,ue.TRANSPARENT_TERRAIN)}_renderTransparentTerrain(){const e=()=>this._plugins.render(this._pluginInput,ue.TRANSPARENT_TERRAIN);if(!q(this._renderContext.output))return void e();const t=this._framebufferSize,r=this.fboCache.acquire(t.width,t.height,"transparent terrain");return this.renderToTargets(e,r,this._framebuffer.depth,w),r}get _needsHUDVisibility(){return this._plugins.produces(this._renderContext.output,ue.OCCLUSION_PIXELS)}_renderHUDVisibility(){if(!this._needsHUDVisibility)return void(this._bindParameters.hudVisibility=d(this._bindParameters.hudVisibility));const{width:e,height:t}=this._framebufferSize;let r=this._bindParameters.hudVisibility;r?.fbo?.width===e&&r?.fbo?.height===t||(r?.release(),r=this.fboCache.acquire(e,t,"hud visibility",F.RGBA4UNORM),this._bindParameters.hudVisibility=r);const i=this._bindParameters.geometryDepth;r.attachDepth(i||this._framebuffer.depth),this._rctx.bindFramebuffer(r.fbo),this._rctx.clearFramebuffer([0,1,0,1]),this._plugins.render(this._pluginInput,ue.OCCLUSION_PIXELS),r.detachDepth(),this._framebuffer.bind(),this.performanceInfo.advance(Pe.HUD_VISIBILITY)}_renderLineCallouts(e){if(this._bindParameters.hudRenderStyle=e,e===V.Occluded){const e=()=>this._plugins.render(this._pluginInput,ue.LINE_CALLOUTS),t=this._framebufferSize,r=this.fboCache.acquireDepth(v.DEPTH16,t.width,t.height,"line callouts");this.renderToTargets(e,this._framebuffer.color,r,void 0,!0,!0),r.release()}else this._plugins.render(this._pluginInput,ue.LINE_CALLOUTS)}_precompileHUD(e){if(this._precompileHUDOutput(e),this._hasHighlights){const t=this._renderContext.output;this._renderContext.output=G.Highlight,this._precompileHUDOutput(e),this._renderContext.output=t}}_precompileHUDOutput(e){const t=this._bindParameters.hudRenderStyle;this._bindParameters.hudRenderStyle=e,this._oitEnabled&&q(this._renderContext.output)?(this._bindParameters.oitPass=ae.ColorAlpha,this._plugins.precompile(...ve),this._bindParameters.oitPass=ae.FrontFace,this._plugins.precompile(...ve),this._bindParameters.oitPass=ae.NONE):this._plugins.precompile(...ve),this._bindParameters.hudRenderStyle=t}_renderHUD(e,t,r){if(this._pluginsHas.hudElements){if(this._oitEnabled){const i=this._renderOIT(Ne.HUD,r,e);this._rctx.bindFramebuffer(t.fbo),this._compositingHelper.compositePreMultipliedAlpha(this._bindParameters,i.getTexture()),i.release()}else if(this._renderContext.output=r,e===V.Occluded){const t=()=>this._renderHUDElements(e),r=this._framebufferSize,i=this.fboCache.acquireDepth(v.DEPTH16,r.width,r.height,"hud");this.renderToTargets(t,this._framebuffer.color,i,void 0,!0,!0),i.release()}else t.acquireDepth(v.DEPTH16),this._rctx.bindFramebuffer(t.fbo),this._renderHUDElements(e),t.detachDepth();this.performanceInfo.advance(e===V.Occluded?Pe.HUD_OCCLUDED:Pe.HUD)}}_renderHUDElements(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(this._pluginInput,...ve)}get _needsShadowHighlight(){return this.shadowsEnabled&&this._plugins.produces(G.ShadowHighlight,ue.OPAQUE_MATERIAL)}_renderHighlightPrepass(){if(!this._hasHighlights)return;const{fboCache:e,_rctx:t,_bindParameters:r}=this,i=this._framebufferSize,{highlights:s}=r,a=e.acquire(i.width,i.height,"highlights",s.length>k?F.RG8UINT:F.R8UINT);a.acquireDepth(v.DEPTH24_STENCIL8),t.bindFramebuffer(a.fbo);const{gl:n}=t;return n.clearBufferuiv(n.COLOR,0,[0,0,0,0]),this._renderContext.output=G.Highlight,t.bindFramebuffer(a.fbo),z(t,e,i,r,(()=>this._renderHighlightGeometries())),this.performanceInfo.advance(Pe.HIGHLIGHTS),a}_renderHighlightGeometries(){this._plugins.render(this._pluginInput,...Fe),this._rctx.clear(Ce.DEPTH),this._renderHUDElements(V.Both)}get _needsShadowAccumulation(){return this._shadowAccumulator.accumulating}_renderShadowAccumulation(e,t,r){this._needsShadowAccumulation&&this._bindParameters.depth&&this._shadowAccumulator.renderAccumulation(this._bindParameters.depth,e,t,r)&&this.performanceInfo.advance(Pe.ACCUMULATED_SHADOWS)}_precompileTransparentGeometry(){this._oitEnabled&&q(this._renderContext.output)?(this._bindParameters.oitPass=ae.ColorAlpha,this._plugins.precompile(...Le),this._bindParameters.oitPass=ae.FrontFace,this._plugins.precompile(...Le),this._bindParameters.oitPass=ae.NONE):this._plugins.precompile(...Le)}_renderOIT(e,t,r=V.Both){const i=e===Ne.HUD,s=this._framebufferSize,a=i?this.fboCache.acquire(s.width,s.height,"oit hud composite"):null,n=i?()=>this._renderHUDElements(r):()=>this._renderTransparentGeometry(),h=this._bindParameters,o=this._renderContext.output;this._renderContext.output=t,h.oitPass=ae.ColorAlpha;const d=a?"oit hud color+alpha":"oit color+alpha",_=this.fboCache.acquire(s.width,s.height,d,F.RGBA16FLOAT),l=t===G.ColorEmission;l&&_.acquireColor(we,F.RGBA16FLOAT,"emissive"),_.acquireColor(l?Oe:we,F.R16FLOAT),a||_.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(_.fbo),this._rctx.clearFramebuffer([0,0,0,1]),l&&this._rctx.clearBuffer(1,I),n(),_.detachDepth(),h.oitPass=ae.FrontFace;const p=this.fboCache.acquire(s.width,s.height,a?"oit hud front":"oit front");return l&&p.acquireColor(we,F.RGBA16FLOAT,"emissive"),a?p.acquireDepth(v.DEPTH16):p.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(p.fbo),this._rctx.clearFramebuffer(w,!!a),n(),p.detachDepth(),h.oitPass=ae.NONE,a?(this._rctx.bindFramebuffer(a.fbo),this._rctx.setClearColor(0,0,0,1e-13),this._rctx.clear(Ce.COLOR)):this._framebuffer.bind(),this._oitblend??=new Y(this._techniques),this._oitblend.blend(this._rctx,_,p,h,l),a?.detachDepth(),p.release(),_.release(),this._renderContext.output=o,a}_renderOpaque(e){const t=this.plugins.produces(G.Color,...He);t&&this._renderOpaqueGeometry();const r=this._framebuffer;r.update((e=>this._renderNodes(D.OPAQUE,e,t))),this.fboCache.debugCallback?.(D.OPAQUE,r.color.fbo),r.update((e=>this._renderNodes(N.OPAQUE_ENVIRONMENT,e))),this.fboCache.debugCallback?.(N.OPAQUE_ENVIRONMENT,r.color.fbo),this._renderTerrainDepth(e),this._renderEdges(be.OPAQUE)}_renderTransparent(e,t,r){const i=this._framebuffer;i.bind(),this._renderPlugins(ue.VOXEL,Pe.VOXEL),this._renderHiddenTransparentEdges(),e&&(this._oitEnabled?this._renderOIT(Ne.Geometry,r):this._renderTransparentGeometry()),i.update((t=>this._renderNodes(D.TRANSPARENT,t,e))),this.fboCache.debugCallback?.(D.TRANSPARENT,i.color.fbo),this._renderGeometryDepth(t),this._renderHUDVisibility(),t||this._plugins.render(this._pluginInput,ue.LINE_CALLOUTS),this._renderEdges(be.TRANSPARENT);const s=this._hasTransparentTerrain?this._renderTransparentTerrain():null;s&&(this.performanceInfo.advance(Pe.TRANSPARENT_TERRAIN),this._bindParameters.hudVisibility&&(t?this._renderLineCallouts(V.Occluded):(this._rctx.bindFramebuffer(this._bindParameters.hudVisibility?.fbo),this._compositingHelper.compositeHUD(this._bindParameters,s.getTexture())),this._renderHUD(V.Occluded,i.color,r))),this._bindParameters.cullAboveTerrain=!1,s&&(i.bind(),this._compositingHelper.compositePreMultipliedAlpha(this._bindParameters,s.getTexture()),s.release(),t&&(this._renderEdges(be.OPAQUE),e&&(this._oitEnabled?this._renderOIT(Ne.Geometry,r):this._renderTransparentGeometry(),this.performanceInfo.advance(Pe.TRANSPARENT)),this._renderEdges(be.TRANSPARENT))),this._bindParameters.ssao=d(this._bindParameters.ssao),t&&this._renderLineCallouts(V.NotOccluded),this._bindParameters.terrainDepthTest=!1,this._renderTransparentEnvironment()}_renderTransparentEnvironment(){this._shadowAccumulator.render(this._bindParameters),this.performanceInfo.advance(Pe.APPLY_ACCUMULATED_SHADOWS),this._framebuffer.bind(),this._plugins.render(this._pluginInput,ue.TRANSPARENT_MATERIAL_WITHOUT_DEPTH),this.performanceInfo.advance(Pe.TRANSPARENT_MATERIAL_WITHOUT_DEPTH)}_renderPlugins(e,t){this._plugins.produces(this._renderContext.output,e)&&(this._plugins.render(this._pluginInput,e),this.performanceInfo.advance(t))}_renderNodes(e,t,r=!1){if(t.setName(e),this._pluginInput.set(e,t),!this._nodes.produces(e))return r&&this.performanceInfo.advance(e),t;const i=this._nodes.render(t,this._pluginInput,this._releaseNormals);return this.performanceInfo.advance(e),i}_blitFBO(e,t=M,r=!0){return this._blit??=new W(this._techniques),this._blit.blit(this._rctx,e,t,this._bindParameters),this._pluginInput.set(e.name,t),r&&e.release(),t}_ensureBindParametersCamera(e,t){this._bindParameters.camera=e,this._bindParameters.contentCamera=t}_ensureBindParametersSSR(e){if(this._bindParameters.ssr.lastFrameColor){null==this._ssrEnableTime&&(this._ssrEnableTime=e),this._renderContext.lastFrameCamera.equals(this._bindParameters.camera)?this._reprojectionMatrix=P:(A(Ge,this._bindParameters.camera.viewMatrix),A(Ue,this._bindParameters.camera.projectionMatrix),E(qe,Ge,Ue),E(qe,this._renderContext.lastFrameCamera.viewMatrix,qe),E(qe,this._renderContext.lastFrameCamera.projectionMatrix,qe),this._reprojectionMatrix=qe);const t=this.stage.view.qualitySettings.fadeDuration;this._bindParameters.ssr.fadeFactor=t>0?Math.min(t,e-this._ssrEnableTime)/t:1,this._bindParameters.ssr.fadeFactor<1&&this._requestRender()}else this._reprojectionMatrix=P,this._ssrEnableTime=null}addRenderNode(e){this._nodes.add(e),this._requestRender()}removeRenderNode(e){this._nodes.remove(e),this._requestRender()}updateLighting(e,t,r,i){this._bindParameters.updateLighting(e,t,r,i),this._requestRender(J.UPDATE)}get usedMemory(){return{fbos:this.fboCache.usedMemory,plugins:this._plugins.usedMemory,edges:this.edgeView?.usedMemory??0}}renderToTargets(e,t,r,i,s=!1,a=!1){t.attachDepth(r),this._rctx.bindFramebuffer(t.fbo),this._rctx.clearFramebuffer(i,s,a),e(),t.detachDepth()}get test(){}};var Ne;e([f({readOnly:!0})],De.prototype,"fullResolutionAtmosphere",null),e([f()],De.prototype,"_edgeView",void 0),e([f()],De.prototype,"updating",null),De=e([b("esri.views.3d.webgl-engine.lib.Renderer")],De),function(e){e[e.Geometry=0]="Geometry",e[e.HUD=1]="HUD"}(Ne||(Ne={}));const ye=[ue.INTEGRATED_MESH,ue.OPAQUE_TERRAIN,ue.OPAQUE_MATERIAL,ue.TRANSPARENT_MATERIAL],xe=[ue.OPAQUE_MATERIAL_WITHOUT_NORMALS,ue.TRANSPARENT_MATERIAL_WITHOUT_NORMALS],He=[ue.INTEGRATED_MESH,ue.OPAQUE_TERRAIN,ue.OPAQUE_MATERIAL,ue.OPAQUE_MATERIAL_WITHOUT_NORMALS],Le=[ue.TRANSPARENT_MATERIAL,ue.TRANSPARENT_MATERIAL_WITHOUT_NORMALS],Me=[ue.OPAQUE_MATERIAL,ue.TRANSPARENT_MATERIAL,ue.TRANSPARENT_MATERIAL_WITHOUT_DEPTH],ve=[ue.LINE_CALLOUTS_HUD_DEPTH,ue.HUD_MATERIAL,ue.LABEL_MATERIAL],Fe=[ue.TRANSPARENT_MATERIAL,ue.TRANSPARENT_MATERIAL_WITHOUT_NORMALS,ue.OPAQUE_MATERIAL,ue.OPAQUE_MATERIAL_WITHOUT_NORMALS,ue.TRANSPARENT_TERRAIN,ue.INTEGRATED_MESH,ue.OPAQUE_TERRAIN],Ue=R(),Ge=R(),qe=R();function Ve(e){return t=>e.immediate.schedule(t)}export{De as Renderer};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import has from"../../../../core/has.js";import{clamp as t,lerp as s,acosClamped as e}from"../../../../core/mathUtils.js";import{releaseMaybe as i}from"../../../../core/maybe.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{translate as r,multiply as h,invert as o,lookAt as n}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as c,create as l}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as d,add as m,scale as u,lerp as _,squaredDistance as f,subtract as g,dot as p,negate as x,normalize as b,copy as w}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as M}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{p as C,c as j,v as y,t as H,i as v}from"../../../../chunks/vec32.js";import{create as D}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{s as S,t as O}from"../../../../chunks/vec42.js";import{create as T}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{ViewingMode as F}from"../../../ViewingMode.js";import{DepthTextureFormat as Q}from"../core/FBOCacheFormats.js";import{CascadeCamera as V}from"./CascadeCamera.js";import{applyTextureResizeModulo as L}from"./textureUtils.js";import{assert as B,logWithBase as N,verify as E,rayRay2D as R}from"./Util.js";import{DepthStencilAttachment as W,FramebufferBit as q,TextureSamplingMode as z}from"../../../webgl/enums.js";var A;!function(t){t[t.Highlight=0]="Highlight",t[t.ExcludeHighlight=1]="ExcludeHighlight"}(A||(A={}));class P{constructor(){this.camera=new V,this.lightMat=l()}}class I{constructor(){this.maxNumCascadesHighQuality=4,this.maxNumCascadesLowQuality=4,this.textureSizeModHighQuality=1.3,this.textureSizeModLowQuality=.9,this.splitSchemeLambda=0}}class U{constructor(t,s){this._fbos=t,this._viewingMode=s,this._snapshots=new Array,this._textureHeight=0,this._numCascades=1,this.settings=new I,this._projectionView=l(),this._projectionViewInverse=l(),this._modelViewLight=l(),this._cascadeDistances=[0,0,0,0,0],this._usedCascadeDistances=T(),this._cascades=[new P,new P,new P,new P],this._lastOrigin=null,this._enabled=!1,this._maxTextureWidth=Math.min(has("esri-mobile")?4096:16384,t.rctx.parameters.maxTextureSize)}dispose(){this.enabled=!1,this.disposeOffscreenBuffers()}get depthTexture(){return this._handle?.getTexture(W)}get _textureWidth(){return this._textureHeight*this._numCascades}get numCascades(){return this._numCascades}get cascadeDistances(){return S(this._usedCascadeDistances,this._cascadeDistances[0],this._numCascades>1?this._cascadeDistances[1]:1/0,this._numCascades>2?this._cascadeDistances[2]:1/0,this._numCascades>3?this._cascadeDistances[3]:1/0)}disposeOffscreenBuffers(){this._handle=i(this._handle),this._discardSnapshots()}set maxCascades(s){this.settings.maxNumCascadesHighQuality=t(Math.floor(s),1,4)}get maxCascades(){return this.settings.maxNumCascadesHighQuality}set enabled(t){this._enabled=t,t||this.disposeOffscreenBuffers()}get enabled(){return this._enabled}get ready(){return this._enabled&&null!=this.depthTexture}get cascades(){for(let t=0;t<this._numCascades;++t)st[t]=this._cascades[t];return st.length=this._numCascades,st}start(t,s,e,i,a){B(this.enabled);const{near:r,far:h}=Ct(e);this._computeCascadeDistances(r,h,i),this._textureHeight=this._computeTextureHeight(t,a,i),this._setupMatrices(t,s);const{viewMatrix:o,projectionMatrix:n}=t;for(let c=0;c<this._numCascades;++c)this._constructCascade(c,n,o,s);this._lastOrigin=null,this.clear()}finish(){B(this.enabled)}getShadowMapMatrices(t){if(!this._lastOrigin||!C(t,this._lastOrigin)){this._lastOrigin=this._lastOrigin||D(),j(this._lastOrigin,t);for(let s=0;s<this._numCascades;++s){r(et,this._cascades[s].lightMat,t);for(let t=0;t<16;++t)it[16*s+t]=et[t]}}return it}moveSnapshot(t){B(this.enabled),this._snapshots[t]?.release(),this._snapshots[t]=this._handle,this._handle=null,this.clear()}copySnapshot(t){if(!this.enabled)return;const s=this._handle?.getTexture(W)?.descriptor;if(!s)return;this._snapshots[t]?.release();const e=t===A.Highlight?"shadow highlight snapshot":"shadow no highlight snapshot",i=this._acquireFBO(e);this._snapshots[t]=i;const a=this._handle?.fbo;if(!a||!i?.fbo)return void console.error("No FBO");const{width:r,height:h}=s,{rctx:o}=this._fbos;o.blitFramebuffer(a,i.fbo,0,0,r,h,0,0,r,h,q.DEPTH,z.NEAREST)}getSnapshot(t){return this.enabled?this._snapshots[t]?.getTexture(W):null}clear(){this._ensureFbo(),this.bindFbo(),this._fbos.rctx.clear(q.DEPTH)}_computeTextureHeight({pixelRatio:t,fullWidth:s,fullHeight:e},i,a){const r=Math.min(window.devicePixelRatio,i)/t,h=a?this.settings.textureSizeModHighQuality:this.settings.textureSizeModLowQuality;return L(Math.max(s,e)*r*h,this._maxTextureWidth/this._numCascades)}_ensureFbo(){this._handle?.fbo?.width===this._textureWidth&&this._handle?.fbo.height===this._textureHeight||(this._handle?.release(),this._handle=this._acquireFBO("shadow map"))}_acquireFBO(t){return this._fbos.acquire(this._textureWidth,this._textureHeight,t,Q.DEPTH16)}_discardSnapshot(t){this._snapshots[t]=i(this._snapshots[t])}_discardSnapshots(){for(let t=0;t<this._snapshots.length;++t)this._discardSnapshot(t);this._snapshots.length=0}bindFbo(){this._fbos.rctx.bindFramebuffer(this._handle?.fbo)}_constructCascade(t,s,e,i){const a=this._cascades[t],o=-this._cascadeDistances[t],n=-this._cascadeDistances[t+1],c=(s[10]*o+s[14])/Math.abs(s[11]*o+s[15]),l=(s[10]*n+s[14])/Math.abs(s[11]*n+s[15]);B(c<l);for(let r=0;r<8;++r){S(G,r%4==0||r%4==3?-1:1,r%4==0||r%4==1?-1:1,r<4?c:l,1);const t=J[r];O(t,G,this._projectionViewInverse),t[0]/=t[3],t[1]/=t[3],t[2]/=t[3]}y(tt,J[0]),a.camera.viewMatrix=r(k,this._modelViewLight,tt);for(let r=0;r<8;++r)H(J[r],J[r],a.camera.viewMatrix);let d=J[0][2],m=J[0][2];for(let r=1;r<8;++r)d=Math.min(d,J[r][2]),m=Math.max(m,J[r][2]);d-=200,m+=200,a.camera.near=-m,a.camera.far=-d,Mt(e,i,d,m,a.camera),h(a.lightMat,a.camera.projectionMatrix,a.camera.viewMatrix);const u=this._textureHeight;a.camera.viewport=[t*u,0,u,u]}_setupMatrices(t,s){h(this._projectionView,t.projectionMatrix,t.viewMatrix),o(this._projectionViewInverse,this._projectionView);const e=this._viewingMode===F.Global?t.eye:v(tt,0,0,1);n(this._modelViewLight,[0,0,0],[-s[0],-s[1],-s[2]],e)}_computeCascadeDistances(t,e,i){const a=i?this.settings.maxNumCascadesHighQuality:this.settings.maxNumCascadesLowQuality;this._numCascades=Math.min(1+Math.floor(N(e/t,4)),a);const r=(e-t)/this._numCascades,h=(e/t)**(1/this._numCascades);let o=t,n=t;for(let c=0;c<this._numCascades+1;++c)this._cascadeDistances[c]=s(o,n,this.settings.splitSchemeLambda),o*=h,n+=r}get test(){}}const k=l(),G=T(),J=[];for(let jt=0;jt<8;++jt)J.push(T());const K=M(),X=M(),Y=M(),Z=M(),$=M(),tt=D(),st=[],et=l(),it=c.concat(c,c,c,c),at=M(),rt=M(),ht=[M(),M(),M(),M()],ot=M(),nt=M(),ct=M(),lt=M(),dt=M(),mt=M(),ut=M();function _t(t,s,e,i,a,r,h,o){d(at,0,0);for(let d=0;d<4;++d)m(at,at,t[d]);u(at,at,.25),d(rt,0,0);for(let d=4;d<8;++d)m(rt,rt,t[d]);u(rt,rt,.25),_(ht[0],t[4],t[5],.5),_(ht[1],t[5],t[6],.5),_(ht[2],t[6],t[7],.5),_(ht[3],t[7],t[4],.5);let n=0,c=f(ht[0],at);for(let d=1;d<4;++d){const t=f(ht[d],at);t<c&&(c=t,n=d)}g(ot,ht[n],t[n+4]);const l=ot[0];let M,C;ot[0]=-ot[1],ot[1]=l,g(nt,rt,at),p(nt,ot)<0&&x(ot,ot),_(ot,ot,nt,e),b(ot,ot),M=C=p(g(ct,t[0],at),ot);for(let d=1;d<8;++d){const s=p(g(ct,t[d],at),ot);s<M?M=s:s>C&&(C=s)}w(i,at),u(ct,ot,M-s),m(i,i,ct);let j=-1,y=1,H=0,v=0;for(let d=0;d<8;++d){g(lt,t[d],i),b(lt,lt);const s=ot[0]*lt[1]-ot[1]*lt[0];s>0?s>j&&(j=s,H=d):s<y&&(y=s,v=d)}E(j>0,"leftArea"),E(y<0,"rightArea"),u(dt,ot,M),m(dt,dt,at),u(mt,ot,C),m(mt,mt,at),ut[0]=-ot[1],ut[1]=ot[0];const D=R(i,t[v],mt,m(ct,mt,ut),1,a),S=R(i,t[H],mt,ct,1,r),O=R(i,t[H],dt,m(ct,dt,ut),1,h),T=R(i,t[v],dt,ct,1,o);E(D,"rayRay"),E(S,"rayRay"),E(O,"rayRay"),E(T,"rayRay")}function ft(t,s){return 3*s+t}const gt=M();function pt(t,s){return d(gt,t[s],t[s+3]),gt}const xt=M(),bt=a();function wt(t,s,e,i,a){g(xt,e,i),u(xt,xt,.5),bt[0]=xt[0],bt[1]=xt[1],bt[2]=0,bt[3]=xt[1],bt[4]=-xt[0],bt[5]=0,bt[6]=xt[0]*xt[0]+xt[1]*xt[1],bt[7]=xt[0]*xt[1]-xt[1]*xt[0],bt[8]=1,bt[ft(0,2)]=-p(pt(bt,0),t),bt[ft(1,2)]=-p(pt(bt,1),t);let r=p(pt(bt,0),e)+bt[ft(0,2)],h=p(pt(bt,1),e)+bt[ft(1,2)],o=p(pt(bt,0),i)+bt[ft(0,2)],n=p(pt(bt,1),i)+bt[ft(1,2)];r=-(r+o)/(h+n),bt[ft(0,0)]+=bt[ft(1,0)]*r,bt[ft(0,1)]+=bt[ft(1,1)]*r,bt[ft(0,2)]+=bt[ft(1,2)]*r,r=1/(p(pt(bt,0),e)+bt[ft(0,2)]),h=1/(p(pt(bt,1),e)+bt[ft(1,2)]),bt[ft(0,0)]*=r,bt[ft(0,1)]*=r,bt[ft(0,2)]*=r,bt[ft(1,0)]*=h,bt[ft(1,1)]*=h,bt[ft(1,2)]*=h,bt[ft(2,0)]=bt[ft(1,0)],bt[ft(2,1)]=bt[ft(1,1)],bt[ft(2,2)]=bt[ft(1,2)],bt[ft(1,2)]+=1,r=p(pt(bt,1),s)+bt[ft(1,2)],h=p(pt(bt,2),s)+bt[ft(2,2)],o=p(pt(bt,1),e)+bt[ft(1,2)],n=p(pt(bt,2),e)+bt[ft(2,2)],r=-.5*(r/h+o/n),bt[ft(1,0)]+=bt[ft(2,0)]*r,bt[ft(1,1)]+=bt[ft(2,1)]*r,bt[ft(1,2)]+=bt[ft(2,2)]*r,r=p(pt(bt,1),s)+bt[ft(1,2)],h=p(pt(bt,2),s)+bt[ft(2,2)],o=-h/r,bt[ft(1,0)]*=o,bt[ft(1,1)]*=o,bt[ft(1,2)]*=o,a[0]=bt[0],a[1]=bt[1],a[2]=0,a[3]=bt[2],a[4]=bt[3],a[5]=bt[4],a[6]=0,a[7]=bt[5],a[8]=0,a[9]=0,a[10]=1,a[11]=0,a[12]=bt[6],a[13]=bt[7],a[14]=0,a[15]=bt[8]}function Mt(t,s,i,a,r){const h=1/J[0][3],o=1/J[4][3];B(h<o);let n=h+Math.sqrt(h*o);const c=Math.sin(e(t[2]*s[0]+t[6]*s[1]+t[10]*s[2]));n/=c,_t(J,n,c,K,X,Y,Z,$),wt(K,X,Z,$,r.projectionMatrix),r.projectionMatrix[10]=2/(i-a),r.projectionMatrix[14]=-(i+a)/(i-a)}function Ct(t){let{near:s,far:e}=t;return s<2&&(s=2),e<2&&(e=2),s>=e&&(s=2,e=4),{near:s,far:e}}export{U as ShadowMap,A as SnapshotSlot};
5
+ import has from"../../../../core/has.js";import{clamp as t,lerp as s,acosClamped as e}from"../../../../core/mathUtils.js";import{releaseMaybe as i}from"../../../../core/maybe.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{translate as r,multiply as h,invert as o,lookAt as n}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as c,create as l}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as d,add as u,scale as m,lerp as _,squaredDistance as f,subtract as g,dot as p,negate as x,normalize as b,copy as w}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as M}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{q as C,c as j,u as y,t as H,i as v}from"../../../../chunks/vec32.js";import{create as D}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{s as S,t as O}from"../../../../chunks/vec42.js";import{create as T}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{ViewingMode as F}from"../../../ViewingMode.js";import{DepthFormat as Q}from"../core/FBOCacheFormats.js";import{CascadeCamera as V}from"./CascadeCamera.js";import{applyTextureResizeModulo as L}from"./textureUtils.js";import{assert as B,logWithBase as N,verify as E,rayRay2D as R}from"./Util.js";import{DepthStencilAttachment as q,FramebufferBit as W,TextureSamplingMode as z}from"../../../webgl/enums.js";var A;!function(t){t[t.Highlight=0]="Highlight",t[t.ExcludeHighlight=1]="ExcludeHighlight"}(A||(A={}));class P{constructor(){this.camera=new V,this.lightMat=l()}}class I{constructor(){this.maxNumCascadesHighQuality=4,this.maxNumCascadesLowQuality=4,this.textureSizeModHighQuality=1.3,this.textureSizeModLowQuality=.9,this.splitSchemeLambda=0}}class U{constructor(t,s){this._fbos=t,this._viewingMode=s,this._snapshots=new Array,this._textureHeight=0,this._numCascades=1,this.settings=new I,this._projectionView=l(),this._projectionViewInverse=l(),this._modelViewLight=l(),this._cascadeDistances=[0,0,0,0,0],this._usedCascadeDistances=T(),this._cascades=[new P,new P,new P,new P],this._lastOrigin=null,this._enabled=!1,this._maxTextureWidth=Math.min(has("esri-mobile")?4096:16384,t.rctx.parameters.maxTextureSize)}dispose(){this.enabled=!1,this.disposeOffscreenBuffers()}get depthTexture(){return this._handle?.getTexture(q)}get _textureWidth(){return this._textureHeight*this._numCascades}get numCascades(){return this._numCascades}get cascadeDistances(){return S(this._usedCascadeDistances,this._cascadeDistances[0],this._numCascades>1?this._cascadeDistances[1]:1/0,this._numCascades>2?this._cascadeDistances[2]:1/0,this._numCascades>3?this._cascadeDistances[3]:1/0)}disposeOffscreenBuffers(){this._handle=i(this._handle),this._discardSnapshots()}set maxCascades(s){this.settings.maxNumCascadesHighQuality=t(Math.floor(s),1,4)}get maxCascades(){return this.settings.maxNumCascadesHighQuality}set enabled(t){this._enabled=t,t||this.disposeOffscreenBuffers()}get enabled(){return this._enabled}get ready(){return this._enabled&&null!=this.depthTexture}get cascades(){for(let t=0;t<this._numCascades;++t)st[t]=this._cascades[t];return st.length=this._numCascades,st}start(t,s,e,i,a){B(this.enabled);const{near:r,far:h}=Ct(e);this._computeCascadeDistances(r,h,i),this._textureHeight=this._computeTextureHeight(t,a,i),this._setupMatrices(t,s);const{viewMatrix:o,projectionMatrix:n}=t;for(let c=0;c<this._numCascades;++c)this._constructCascade(c,n,o,s);this._lastOrigin=null,this.clear()}finish(){B(this.enabled)}getShadowMapMatrices(t){if(!this._lastOrigin||!C(t,this._lastOrigin)){this._lastOrigin=this._lastOrigin||D(),j(this._lastOrigin,t);for(let s=0;s<this._numCascades;++s){r(et,this._cascades[s].lightMat,t);for(let t=0;t<16;++t)it[16*s+t]=et[t]}}return it}moveSnapshot(t){B(this.enabled),this._snapshots[t]?.release(),this._snapshots[t]=this._handle,this._handle=null,this.clear()}copySnapshot(t){if(!this.enabled)return;const s=this._handle?.getTexture(q)?.descriptor;if(!s)return;this._snapshots[t]?.release();const e=t===A.Highlight?"shadow highlight snapshot":"shadow no highlight snapshot",i=this._acquireFBO(e);this._snapshots[t]=i;const a=this._handle?.fbo;if(!a||!i?.fbo)return void console.error("No FBO");const{width:r,height:h}=s,{rctx:o}=this._fbos;o.blitFramebuffer(a,i.fbo,0,0,r,h,0,0,r,h,W.DEPTH,z.NEAREST)}getSnapshot(t){return this.enabled?this._snapshots[t]?.getTexture(q):null}clear(){this._ensureFbo(),this.bindFbo(),this._fbos.rctx.clear(W.DEPTH)}_computeTextureHeight({pixelRatio:t,fullWidth:s,fullHeight:e},i,a){const r=Math.min(window.devicePixelRatio,i)/t,h=a?this.settings.textureSizeModHighQuality:this.settings.textureSizeModLowQuality;return L(Math.max(s,e)*r*h,this._maxTextureWidth/this._numCascades)}_ensureFbo(){this._handle?.fbo?.width===this._textureWidth&&this._handle?.fbo.height===this._textureHeight||(this._handle?.release(),this._handle=this._acquireFBO("shadow map"))}_acquireFBO(t){return this._fbos.acquire(this._textureWidth,this._textureHeight,t,Q.DEPTH16)}_discardSnapshot(t){this._snapshots[t]=i(this._snapshots[t])}_discardSnapshots(){for(let t=0;t<this._snapshots.length;++t)this._discardSnapshot(t);this._snapshots.length=0}bindFbo(){this._fbos.rctx.bindFramebuffer(this._handle?.fbo)}_constructCascade(t,s,e,i){const a=this._cascades[t],o=-this._cascadeDistances[t],n=-this._cascadeDistances[t+1],c=(s[10]*o+s[14])/Math.abs(s[11]*o+s[15]),l=(s[10]*n+s[14])/Math.abs(s[11]*n+s[15]);B(c<l);for(let r=0;r<8;++r){S(G,r%4==0||r%4==3?-1:1,r%4==0||r%4==1?-1:1,r<4?c:l,1);const t=J[r];O(t,G,this._projectionViewInverse),t[0]/=t[3],t[1]/=t[3],t[2]/=t[3]}y(tt,J[0]),a.camera.viewMatrix=r(k,this._modelViewLight,tt);for(let r=0;r<8;++r)H(J[r],J[r],a.camera.viewMatrix);let d=J[0][2],u=J[0][2];for(let r=1;r<8;++r)d=Math.min(d,J[r][2]),u=Math.max(u,J[r][2]);d-=200,u+=200,a.camera.near=-u,a.camera.far=-d,Mt(e,i,d,u,a.camera),h(a.lightMat,a.camera.projectionMatrix,a.camera.viewMatrix);const m=this._textureHeight;a.camera.viewport=[t*m,0,m,m]}_setupMatrices(t,s){h(this._projectionView,t.projectionMatrix,t.viewMatrix),o(this._projectionViewInverse,this._projectionView);const e=this._viewingMode===F.Global?t.eye:v(tt,0,0,1);n(this._modelViewLight,[0,0,0],[-s[0],-s[1],-s[2]],e)}_computeCascadeDistances(t,e,i){const a=i?this.settings.maxNumCascadesHighQuality:this.settings.maxNumCascadesLowQuality;this._numCascades=Math.min(1+Math.floor(N(e/t,4)),a);const r=(e-t)/this._numCascades,h=(e/t)**(1/this._numCascades);let o=t,n=t;for(let c=0;c<this._numCascades+1;++c)this._cascadeDistances[c]=s(o,n,this.settings.splitSchemeLambda),o*=h,n+=r}get test(){}}const k=l(),G=T(),J=[];for(let jt=0;jt<8;++jt)J.push(T());const K=M(),X=M(),Y=M(),Z=M(),$=M(),tt=D(),st=[],et=l(),it=c.concat(c,c,c,c),at=M(),rt=M(),ht=[M(),M(),M(),M()],ot=M(),nt=M(),ct=M(),lt=M(),dt=M(),ut=M(),mt=M();function _t(t,s,e,i,a,r,h,o){d(at,0,0);for(let d=0;d<4;++d)u(at,at,t[d]);m(at,at,.25),d(rt,0,0);for(let d=4;d<8;++d)u(rt,rt,t[d]);m(rt,rt,.25),_(ht[0],t[4],t[5],.5),_(ht[1],t[5],t[6],.5),_(ht[2],t[6],t[7],.5),_(ht[3],t[7],t[4],.5);let n=0,c=f(ht[0],at);for(let d=1;d<4;++d){const t=f(ht[d],at);t<c&&(c=t,n=d)}g(ot,ht[n],t[n+4]);const l=ot[0];let M,C;ot[0]=-ot[1],ot[1]=l,g(nt,rt,at),p(nt,ot)<0&&x(ot,ot),_(ot,ot,nt,e),b(ot,ot),M=C=p(g(ct,t[0],at),ot);for(let d=1;d<8;++d){const s=p(g(ct,t[d],at),ot);s<M?M=s:s>C&&(C=s)}w(i,at),m(ct,ot,M-s),u(i,i,ct);let j=-1,y=1,H=0,v=0;for(let d=0;d<8;++d){g(lt,t[d],i),b(lt,lt);const s=ot[0]*lt[1]-ot[1]*lt[0];s>0?s>j&&(j=s,H=d):s<y&&(y=s,v=d)}E(j>0,"leftArea"),E(y<0,"rightArea"),m(dt,ot,M),u(dt,dt,at),m(ut,ot,C),u(ut,ut,at),mt[0]=-ot[1],mt[1]=ot[0];const D=R(i,t[v],ut,u(ct,ut,mt),1,a),S=R(i,t[H],ut,ct,1,r),O=R(i,t[H],dt,u(ct,dt,mt),1,h),T=R(i,t[v],dt,ct,1,o);E(D,"rayRay"),E(S,"rayRay"),E(O,"rayRay"),E(T,"rayRay")}function ft(t,s){return 3*s+t}const gt=M();function pt(t,s){return d(gt,t[s],t[s+3]),gt}const xt=M(),bt=a();function wt(t,s,e,i,a){g(xt,e,i),m(xt,xt,.5),bt[0]=xt[0],bt[1]=xt[1],bt[2]=0,bt[3]=xt[1],bt[4]=-xt[0],bt[5]=0,bt[6]=xt[0]*xt[0]+xt[1]*xt[1],bt[7]=xt[0]*xt[1]-xt[1]*xt[0],bt[8]=1,bt[ft(0,2)]=-p(pt(bt,0),t),bt[ft(1,2)]=-p(pt(bt,1),t);let r=p(pt(bt,0),e)+bt[ft(0,2)],h=p(pt(bt,1),e)+bt[ft(1,2)],o=p(pt(bt,0),i)+bt[ft(0,2)],n=p(pt(bt,1),i)+bt[ft(1,2)];r=-(r+o)/(h+n),bt[ft(0,0)]+=bt[ft(1,0)]*r,bt[ft(0,1)]+=bt[ft(1,1)]*r,bt[ft(0,2)]+=bt[ft(1,2)]*r,r=1/(p(pt(bt,0),e)+bt[ft(0,2)]),h=1/(p(pt(bt,1),e)+bt[ft(1,2)]),bt[ft(0,0)]*=r,bt[ft(0,1)]*=r,bt[ft(0,2)]*=r,bt[ft(1,0)]*=h,bt[ft(1,1)]*=h,bt[ft(1,2)]*=h,bt[ft(2,0)]=bt[ft(1,0)],bt[ft(2,1)]=bt[ft(1,1)],bt[ft(2,2)]=bt[ft(1,2)],bt[ft(1,2)]+=1,r=p(pt(bt,1),s)+bt[ft(1,2)],h=p(pt(bt,2),s)+bt[ft(2,2)],o=p(pt(bt,1),e)+bt[ft(1,2)],n=p(pt(bt,2),e)+bt[ft(2,2)],r=-.5*(r/h+o/n),bt[ft(1,0)]+=bt[ft(2,0)]*r,bt[ft(1,1)]+=bt[ft(2,1)]*r,bt[ft(1,2)]+=bt[ft(2,2)]*r,r=p(pt(bt,1),s)+bt[ft(1,2)],h=p(pt(bt,2),s)+bt[ft(2,2)],o=-h/r,bt[ft(1,0)]*=o,bt[ft(1,1)]*=o,bt[ft(1,2)]*=o,a[0]=bt[0],a[1]=bt[1],a[2]=0,a[3]=bt[2],a[4]=bt[3],a[5]=bt[4],a[6]=0,a[7]=bt[5],a[8]=0,a[9]=0,a[10]=1,a[11]=0,a[12]=bt[6],a[13]=bt[7],a[14]=0,a[15]=bt[8]}function Mt(t,s,i,a,r){const h=1/J[0][3],o=1/J[4][3];B(h<o);let n=h+Math.sqrt(h*o);const c=Math.sin(e(t[2]*s[0]+t[6]*s[1]+t[10]*s[2]));n/=c,_t(J,n,c,K,X,Y,Z,$),wt(K,X,Z,$,r.projectionMatrix),r.projectionMatrix[10]=2/(i-a),r.projectionMatrix[14]=-(i+a)/(i-a)}function Ct(t){let{near:s,far:e}=t;return s<2&&(s=2),e<2&&(e=2),s>=e&&(s=2,e=4),{near:s,far:e}}export{U as ShadowMap,A as SnapshotSlot};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../chunks/tslib.es6.js";import"../../../../core/has.js";import{someMap as r}from"../../../../core/MapUtils.js";import t from"../../../../core/PooledArray.js";import{property as s}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as i}from"../../../../core/accessorSupport/decorators/subclass.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{a as o}from"../../../../chunks/sphere.js";import{OverlayTarget as d}from"../../terrain/Intersector.js";import{ShaderOutput as a}from"../core/shaderLibrary/ShaderOutput.js";import{ChangeSet as h}from"./ChangeSet.js";import{newIntersectorResult as c}from"./Intersector.js";import{StoreResults as l,IntersectorType as p}from"./IntersectorInterfaces.js";import{RenderOccludedFlag as m}from"./Material.js";import{DirtyOperation as u,DirtyState as g}from"./ModelDirtyTypes.js";import{RendererBase as y}from"./RendererBase.js";import{RenderSlot as _}from"./RenderSlot.js";import{noBudget as f}from"../../../support/Scheduler.js";let R=class extends y{constructor(e){super(e),this._pending=new G,this._changes=new h,this._sortedRenderers=new t,this._geometries=new Map,this._hasHighlights=!1,this._hasWater=!1}destroy(){this._changes.prune(),this._sortedRenderers.clear(),this._geometries.clear(),this._pending.clear()}get updating(){return!this._pending.empty||this._changes.updates.length>0}get rctx(){return this.rendererContext.rctx}get _localOriginFactory(){return this.rendererContext.localOriginFactory}get hasHighlights(){return this._hasHighlights}hasHighlight(e){return r(this.renderers,(r=>r.hasHighlight(e)))}get hasWater(){return this._hasWater}get rendersOccludedDraped(){for(const e of this.renderers.values())if(0!==e.numGeometries&&!e.queryRenderOccludedState(m.Occlude))return!0;return!1}get isEmpty(){return!this.updating&&0===this.renderers.size&&0===this._geometries.size}get sortedRenderers(){return this._sortedRenderers}commitChanges(){return!!this.updating&&(this._processAddsRemoves(),this.commit(this._changes,f,this.rendererContext.pluginContext)&&(this._updateSortedMaterialRenderers(),this._hasHighlights=r(this.renderers,(e=>{const r=e.produces.get(_.DRAPED_MATERIAL);return!!r&&r(a.Highlight)})),this._hasWater=r(this.renderers,(e=>{const r=e.produces.get(_.DRAPED_WATER);return!!r&&r(a.Normal)}))),this.notifyChange("updating"),!0)}rendererAdded(){this._sortedRenderers.clear()}rendererRemoved(){this._sortedRenderers.clear()}addGeometries(e,r){if(0===e.length)return;const t=this._validateRenderGeometries(e);for(const i of t)this._geometries.set(i.id,i);const s=this._pending.empty;for(const i of t)this._pending.adds.add(i);s&&this.notifyChange("updating"),r===u.UPDATE&&this._notifyGraphicGeometryChanged(e)}removeGeometries(e,r){const t=this._pending.empty,s=this._pending.adds;for(const i of e)s.has(i)?(this._pending.removed.add(i),s.delete(i)):this._pending.removed.has(i)||this._pending.removes.add(i),this._geometries.delete(i.id);t&&!this._pending.empty&&this.notifyChange("updating"),r===u.UPDATE&&this._notifyGraphicGeometryChanged(e)}modifyGeometries(e,r){const t=0===this._changes.updates.length;for(const s of e){const e=this._changes.updates.pushNew();e.renderGeometry=this._validateRenderGeometry(s),e.updateType=r}switch(t&&this._changes.updates.length>0&&this.notifyChange("updating"),r){case g.TRANSFORMATION:case g.GEOMETRY:return this._notifyGraphicGeometryChanged(e);case g.VISIBILITY:return this._notifyGraphicVisibilityChanged(e)}}updateAnimation(e){let r=!1;return this._sortedRenderers.forAll((t=>r=!!t.updateAnimation&&t.updateAnimation(e)||r)),r}precompile(e){return this._sortedRenderers.reduce(((r,t)=>t.precompile(e)||r),!1)}render(e){this._sortedRenderers.forAll((r=>{const t=r.acquireTechniques(e);t&&r.render(e,t)}))}intersect(e,r,t,s,i){for(const n of this._geometries.values()){if(!s(n))continue;this._intersectRenderGeometry(n,t,r,0,e,i);const o=this.rendererContext.longitudeCyclical;o&&(n.boundingSphere[0]-n.boundingSphere[3]<o.min&&this._intersectRenderGeometry(n,t,r,o.range,e,i),n.boundingSphere[0]+n.boundingSphere[3]>o.max&&this._intersectRenderGeometry(n,t,r,-o.range,e,i)),i++}return i}_updateSortedMaterialRenderers(){if(!(this._sortedRenderers.length>0)){for(const e of this.renderers.values())this._sortedRenderers.push(e);this._sortedRenderers.sort(((e,r)=>r.material?.renderPriority===e.material?.renderPriority?e.drapedPriority-r.drapedPriority:(r.material?.renderPriority||0)-(e.material?.renderPriority||0)))}}_processAddsRemoves(){this._changes.adds.clear(),this._changes.removes.clear(),this._changes.adds.pushArray(Array.from(this._pending.adds)),this._changes.removes.pushArray(Array.from(this._pending.removes)),this._changes.updates.filterInPlace((({renderGeometry:e})=>!this._pending.has(e))),this._pending.clear()}_intersectRenderGeometry(e,r,t,s,i,n){if(!e.visible||!e.material.visible)return;let o=0;s+=e.transformation[12],o=e.transformation[13],C[0]=t[0]-s,C[1]=t[1]-o,e.screenToWorldRatio=this.rendererContext.screenToWorldRatio,e.material.intersectDraped(e,null,i,C,((t,s,o)=>{v(r,o,n,e.material.renderPriority,i,e.layerViewUid,e.graphicUid)}),r)}_notifyGraphicGeometryChanged(e){if(null==this.drapeSource.notifyGraphicGeometryChanged)return;let r;for(const{graphicUid:t}of e)null!=t&&t!==r&&(this.drapeSource.notifyGraphicGeometryChanged(t),r=t)}_notifyGraphicVisibilityChanged(e){if(null==this.drapeSource.notifyGraphicVisibilityChanged)return;let r;for(const{graphicUid:t}of e)null!=t&&t!==r&&(this.drapeSource.notifyGraphicVisibilityChanged(t),r=t)}_validateRenderGeometries(e){for(const r of e)this._validateRenderGeometry(r);return e}_validateRenderGeometry(e){return null==e.localOrigin&&(e.localOrigin=this._localOriginFactory.getOrigin(o(e.boundingSphere))),e}get test(){}};e([s({constructOnly:!0})],R.prototype,"drapeSource",void 0),e([s({constructOnly:!0})],R.prototype,"rendererContext",void 0),e([s()],R.prototype,"updating",null),e([s()],R.prototype,"rctx",null),e([s()],R.prototype,"_localOriginFactory",null),e([s({readOnly:!0})],R.prototype,"isEmpty",null),e([s()],R.prototype,"_geometries",void 0),R=e([i("esri.views.3d.webgl-engine.lib.SortedRenderGeometryRenderer")],R);class G{constructor(){this.adds=new Set,this.removes=new Set,this.removed=new Set}get empty(){return 0===this.adds.size&&0===this.removes.size&&0===this.removed.size}has(e){return this.adds.has(e)||this.removes.has(e)||this.removed.has(e)}clear(){this.adds.clear(),this.removes.clear(),this.removed.clear()}}function v(e,r,t,s,i,n,o){const a=new d(n,o,r),h=r=>{r.set(p.OVERLAY,a,e.dist,e.normal,e.transformation,t,s)};if((null==i.results.min.drapedLayerOrder||t>=i.results.min.drapedLayerOrder)&&(null==i.results.min.dist||i.results.ground.dist<=i.results.min.dist)&&h(i.results.min),i.options.store!==l.MIN&&(null==i.results.max.drapedLayerOrder||t<i.results.max.drapedLayerOrder)&&(null==i.results.max.dist||i.results.ground.dist>i.results.max.dist)&&h(i.results.max),i.options.store===l.ALL){const e=c(i.ray);h(e),i.results.all.push(e)}}const C=n();export{R as SortedRenderGeometryRenderer};
5
+ import{_ as e}from"../../../../chunks/tslib.es6.js";import"../../../../core/has.js";import{someMap as r}from"../../../../core/MapUtils.js";import t from"../../../../core/PooledArray.js";import{property as s}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as i}from"../../../../core/accessorSupport/decorators/subclass.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{a as o}from"../../../../chunks/sphere.js";import{OverlayTarget as a}from"../../terrain/Intersector.js";import{ShaderOutput as d}from"../core/shaderLibrary/ShaderOutput.js";import{ChangeSet as h}from"./ChangeSet.js";import{StoreResults as c}from"./IntersectorInterfaces.js";import{IntersectorResult as l}from"./IntersectorResult.js";import{IntersectorType as p}from"./IntersectorType.js";import{RenderOccludedFlag as m}from"./Material.js";import{DirtyOperation as u,DirtyState as g}from"./ModelDirtyTypes.js";import{RendererBase as y}from"./RendererBase.js";import{RenderSlot as _}from"./RenderSlot.js";import{noBudget as f}from"../../../support/Scheduler.js";let R=class extends y{constructor(e){super(e),this._pending=new G,this._changes=new h,this._sortedRenderers=new t,this._geometries=new Map,this._hasHighlights=!1,this._hasWater=!1}destroy(){this._changes.prune(),this._sortedRenderers.clear(),this._geometries.clear(),this._pending.clear()}get updating(){return!this._pending.empty||this._changes.updates.length>0}get rctx(){return this.rendererContext.rctx}get _localOriginFactory(){return this.rendererContext.localOriginFactory}get hasHighlights(){return this._hasHighlights}hasHighlight(e){return r(this.renderers,(r=>r.hasHighlight(e)))}get hasWater(){return this._hasWater}get rendersOccludedDraped(){for(const e of this.renderers.values())if(0!==e.numGeometries&&!e.queryRenderOccludedState(m.Occlude))return!0;return!1}get isEmpty(){return!this.updating&&0===this.renderers.size&&0===this._geometries.size}get sortedRenderers(){return this._sortedRenderers}commitChanges(){return!!this.updating&&(this._processAddsRemoves(),this.commit(this._changes,f,this.rendererContext.pluginContext)&&(this._updateSortedMaterialRenderers(),this._hasHighlights=r(this.renderers,(e=>{const r=e.produces.get(_.DRAPED_MATERIAL);return!!r&&r(d.Highlight)})),this._hasWater=r(this.renderers,(e=>{const r=e.produces.get(_.DRAPED_WATER);return!!r&&r(d.Normal)}))),this.notifyChange("updating"),!0)}rendererAdded(){this._sortedRenderers.clear()}rendererRemoved(){this._sortedRenderers.clear()}addGeometries(e,r){if(0===e.length)return;const t=this._validateRenderGeometries(e);for(const i of t)this._geometries.set(i.id,i);const s=this._pending.empty;for(const i of t)this._pending.adds.add(i);s&&this.notifyChange("updating"),r===u.UPDATE&&this._notifyGraphicGeometryChanged(e)}removeGeometries(e,r){const t=this._pending.empty,s=this._pending.adds;for(const i of e)s.has(i)?(this._pending.removed.add(i),s.delete(i)):this._pending.removed.has(i)||this._pending.removes.add(i),this._geometries.delete(i.id);t&&!this._pending.empty&&this.notifyChange("updating"),r===u.UPDATE&&this._notifyGraphicGeometryChanged(e)}modifyGeometries(e,r){const t=0===this._changes.updates.length;for(const s of e){const e=this._changes.updates.pushNew();e.renderGeometry=this._ensureValidRenderGeometry(s),e.updateType=r}switch(t&&this._changes.updates.length>0&&this.notifyChange("updating"),r){case g.TRANSFORMATION:case g.GEOMETRY:return this._notifyGraphicGeometryChanged(e);case g.VISIBILITY:return this._notifyGraphicVisibilityChanged(e)}}updateAnimation(e){let r=!1;return this._sortedRenderers.forAll((t=>r=!!t.updateAnimation&&t.updateAnimation(e)||r)),r}precompile(e){return this._sortedRenderers.reduce(((r,t)=>t.precompile(e)||r),!1)}render(e){this._sortedRenderers.forAll((r=>{const t=r.acquireTechniques(e);t&&r.render(e,t)}))}intersect(e,r,t,s,i){for(const n of this._geometries.values()){if(!s(n))continue;this._intersectRenderGeometry(n,t,r,0,e,i);const o=this.rendererContext.longitudeCyclical;o&&(n.boundingSphere[0]-n.boundingSphere[3]<o.min&&this._intersectRenderGeometry(n,t,r,o.range,e,i),n.boundingSphere[0]+n.boundingSphere[3]>o.max&&this._intersectRenderGeometry(n,t,r,-o.range,e,i)),i++}return i}_updateSortedMaterialRenderers(){if(!(this._sortedRenderers.length>0)){for(const e of this.renderers.values())this._sortedRenderers.push(e);this._sortedRenderers.sort(((e,r)=>r.material?.renderPriority===e.material?.renderPriority?e.drapedPriority-r.drapedPriority:(r.material?.renderPriority||0)-(e.material?.renderPriority||0)))}}_processAddsRemoves(){this._changes.adds.clear(),this._changes.removes.clear(),this._changes.adds.pushArray(Array.from(this._pending.adds)),this._changes.removes.pushArray(Array.from(this._pending.removes)),this._changes.updates.filterInPlace((({renderGeometry:e})=>!this._pending.has(e))),this._pending.clear()}_intersectRenderGeometry(e,r,t,s,i,n){if(!e.visible||!e.material.visible||!e.material.intersectDraped)return;let o=0;s+=e.transformation[12],o=e.transformation[13],C[0]=t[0]-s,C[1]=t[1]-o,e.screenToWorldRatio=this.rendererContext.screenToWorldRatio,e.material.intersectDraped(e,i,C,((t,s,o)=>{v(r,o,n,e.material.renderPriority,i,e.layerViewUid,e.graphicUid)}),r)}_notifyGraphicGeometryChanged(e){if(null==this.drapeSource.notifyGraphicGeometryChanged)return;let r;for(const{graphicUid:t}of e)null!=t&&t!==r&&(this.drapeSource.notifyGraphicGeometryChanged(t),r=t)}_notifyGraphicVisibilityChanged(e){if(null==this.drapeSource.notifyGraphicVisibilityChanged)return;let r;for(const{graphicUid:t}of e)null!=t&&t!==r&&(this.drapeSource.notifyGraphicVisibilityChanged(t),r=t)}_validateRenderGeometries(e){for(const r of e)this._ensureValidRenderGeometry(r);return e}_ensureValidRenderGeometry(e){return null==e.localOrigin&&(e.localOrigin=this._localOriginFactory.getOrigin(o(e.boundingSphere))),e}get test(){}};e([s({constructOnly:!0})],R.prototype,"drapeSource",void 0),e([s({constructOnly:!0})],R.prototype,"rendererContext",void 0),e([s()],R.prototype,"updating",null),e([s()],R.prototype,"rctx",null),e([s()],R.prototype,"_localOriginFactory",null),e([s({readOnly:!0})],R.prototype,"isEmpty",null),e([s()],R.prototype,"_geometries",void 0),R=e([i("esri.views.3d.webgl-engine.lib.SortedRenderGeometryRenderer")],R);class G{constructor(){this.adds=new Set,this.removes=new Set,this.removed=new Set}get empty(){return 0===this.adds.size&&0===this.removes.size&&0===this.removed.size}has(e){return this.adds.has(e)||this.removes.has(e)||this.removed.has(e)}clear(){this.adds.clear(),this.removes.clear(),this.removed.clear()}}function v(e,r,t,s,i,n,o){const d=new a(n,o,r),h=r=>{r.set(p.OVERLAY,d,e.distance,e.normal,e.transformation,t,s)};if((null==i.results.min.drapedLayerOrder||t>=i.results.min.drapedLayerOrder)&&(null==i.results.min.distance||i.results.ground.distance<=i.results.min.distance)&&h(i.results.min),i.options.store!==c.MIN&&(null==i.results.max.drapedLayerOrder||t<i.results.max.drapedLayerOrder)&&(null==i.results.max.distance||i.results.ground.distance>i.results.max.distance)&&h(i.results.max),i.options.store===c.ALL){const e=new l(i.ray);h(e),i.results.all.push(e)}}const C=n();export{R as SortedRenderGeometryRenderer};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import has from"../../../../core/has.js";import{clamp as t}from"../../../../core/mathUtils.js";import{releaseMaybe as e}from"../../../../core/maybe.js";import{fromRotation as i}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{a as r,f as a,v as o,t as h}from"../../../../chunks/vec32.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{DepthTextureFormat as n}from"../core/FBOCacheFormats.js";import{applyTextureResizeModulo as l}from"./textureUtils.js";import{ViewshedFaceCamera as u}from"./ViewshedFaceCamera.js";import{DepthStencilAttachment as m,SizedDepthFormat as f,FramebufferBit as d}from"../../../webgl/enums.js";import{isSizedDepthStencilFormat as p}from"../../../webgl/textureUtils.js";class g{constructor(){this.textureSizeQuality=1,this.textureSizeModHighQuality=1.3,this.textureSizeModLowQuality=.9,this.textureSizeMultiple=128,this.toleranceSides=5,this.toleranceBottomTop=10}textureSizeModifier(t){const e=t?this.textureSizeModHighQuality:this.textureSizeModLowQuality;return this.textureSizeQuality*e}textureResizeModulo(t){return Math.ceil(t/this.textureSizeMultiple)*this.textureSizeMultiple}}const _=["front","left","right","back","top","bottom"];function x(t){return!["top","bottom"].includes(t)}class b{constructor(t){this._fbos=t,this._faces={},this._width=0,this._height=0,this.settings=new g,this._maxTextureSize=Math.min(has("esri-mobile")?4096:16384,t.rctx.parameters.maxTextureSize)}get depthTexture(){return this._handle?.getTexture(m)}get ready(){return null!=this.depthTexture&&0!==this._width&&0!==this._height}get nearFar(){const t=this.faces;return 0===t.length?null:t[0].nearFar}get numActiveFaces(){const t=this._faces;let e=0;return Object.keys(t).forEach((i=>{t[i]&&(e+=1)})),e}get faces(){const t=this._faces,e=[];for(const i of _){const s=t[i];s&&e.push(s)}return e}get atlasRegions(){return this.faces.map((t=>[t.x/this._width,(t.x+t.width)/this._width,t.y/this._height,(t.y+t.height)/this._height]))}get viewshedProjectionMatrices(){return this.faces.map((t=>t.projectionMatrix))}get viewshedViewMatrices(){return this.faces.map((t=>t.viewMatrix))}_setupFaceCamera(e,n,l,m){const{effectiveObserverRenderSpace:f,tiltedUpVector:d,targetRenderSpace:p,farDistanceRenderSpace:g,horizontalFieldOfView:_,verticalFieldOfView:b}=n,w=c();r(w,p,f);const M=c(),S=c(),F=(t,e)=>{const r=c(),o=s();return i(o,t,e),h(r,w,o),a(r,f,r),r};let z,T=d;const O=Math.min(90,_),v=Math.min(90,Math.max(0,(_-90)/2));let j=-45,B=45,y=-45,k=45;if(x(e)){const e=e=>t(e,-45,45);y=e(-b/2)-this.settings.toleranceBottomTop,k=e(+b/2)+this.settings.toleranceBottomTop}switch(e){case"front":z=p,j=-O/2,B=O/2;break;case"left":z=F(Math.PI/2,d),j=45-v;break;case"right":z=F(-Math.PI/2,d),B=-45+v;break;case"top":z=a(M,f,d),T=o(S,w);break;case"bottom":z=r(M,f,d),T=w;break;case"back":z=F(Math.PI,d)}const P=new u({center:z,eye:f,up:T,far:g});P.sectionAnglesDeg=[j-this.settings.toleranceSides,B+this.settings.toleranceSides,y,k],P.fovY=Math.PI/2;const C=P.setViewport(l,m);return this._faces[e]=P,C}isActive(t){return this._computeActiveFaces(t).size>0}_computeActiveFaces(t){const e=new Set,{horizontalFieldOfView:i,verticalFieldOfView:s}=t,r=-s/2,a=s/2;return 0===i||0===s||(r<=45&&a>=-45&&e.add("front"),i>90&&(e.add("left"),e.add("right")),i>270&&e.add("back"),a>45-this.settings.toleranceBottomTop&&e.add("top"),r<-45+this.settings.toleranceBottomTop&&e.add("bottom")),e}_computeBaseTextureSize({pixelRatio:t,fullWidth:e,fullHeight:i},s,r,a){const o=s/t,h=this.settings.textureSizeModifier(r);return l(Math.max(e,i)*o*h,this._maxTextureSize/a)}_ensureFBO(t){const e=this._width,i=this._height,s=this._handle?.fbo;s&&s.width===e&&s.height===i&&t===p(s.depthStencilTexture?.descriptor?.internalFormat??f.DEPTH_COMPONENT16)||(this._handle?.release(),this._handle=this._allocateFBO(t))}_allocateFBO(t){const{_width:e,_height:i}=this,s=t?n.DEPTH24_STENCIL8:n.DEPTH16;return this._fbos.acquire(e,i,"viewshed shadow map",s)}clearFBO(t){const e=this._fbos.rctx;this._ensureFBO(t),e.bindFramebuffer(this._handle?.fbo),e.setClearColor(1,1,1,1),e.clear(d.COLOR|d.DEPTH)}dispose(){this._debugFBO||(this._handle=e(this._handle))}start(t,e,i,s,r=!1){this._faces={};const a=this._computeActiveFaces(e),o=a.size;if(0===o)return!1;const h=this._computeBaseTextureSize(t,s,i,o);let c=0,n=0,l=0;return _.filter((t=>a.has(t))).forEach((t=>{const i=w(t,o);i>n&&(l=Math.max(l,c),c=0),n=i;const s=i*h;c+=this._setupFaceCamera(t,e,[c,s],h)})),l=Math.max(l,c),this._width=this.settings.textureResizeModulo(l),this._height=M(o)*h,this.clearFBO(r),!0}finish(){}get test(){}}function w(t,e){if(e<4)return 0;const i="front"===t||"left"===t;return 4===e?i?0:1:i||"right"===t?0:1}function M(t){return t<4?1:2}export{b as ViewshedShadowMap};
5
+ import has from"../../../../core/has.js";import{clamp as t}from"../../../../core/mathUtils.js";import{releaseMaybe as e}from"../../../../core/maybe.js";import{fromRotation as i}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{a as r,f as a,u as o,t as h}from"../../../../chunks/vec32.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{DepthFormat as n}from"../core/FBOCacheFormats.js";import{applyTextureResizeModulo as l}from"./textureUtils.js";import{ViewshedFaceCamera as u}from"./ViewshedFaceCamera.js";import{DepthStencilAttachment as m,SizedDepthFormat as f,FramebufferBit as d}from"../../../webgl/enums.js";import{isSizedDepthStencilFormat as p}from"../../../webgl/textureUtils.js";class g{constructor(){this.textureSizeQuality=1,this.textureSizeModHighQuality=1.3,this.textureSizeModLowQuality=.9,this.textureSizeMultiple=128,this.toleranceSides=5,this.toleranceBottomTop=10}textureSizeModifier(t){const e=t?this.textureSizeModHighQuality:this.textureSizeModLowQuality;return this.textureSizeQuality*e}textureResizeModulo(t){return Math.ceil(t/this.textureSizeMultiple)*this.textureSizeMultiple}}const _=["front","left","right","back","top","bottom"];function x(t){return!["top","bottom"].includes(t)}class b{constructor(t){this._fbos=t,this._faces={},this._width=0,this._height=0,this.settings=new g,this._maxTextureSize=Math.min(has("esri-mobile")?4096:16384,t.rctx.parameters.maxTextureSize)}get depthTexture(){return this._handle?.getTexture(m)}get ready(){return null!=this.depthTexture&&0!==this._width&&0!==this._height}get nearFar(){const t=this.faces;return 0===t.length?null:t[0].nearFar}get numActiveFaces(){const t=this._faces;let e=0;return Object.keys(t).forEach((i=>{t[i]&&(e+=1)})),e}get faces(){const t=this._faces,e=[];for(const i of _){const s=t[i];s&&e.push(s)}return e}get atlasRegions(){return this.faces.map((t=>[t.x/this._width,(t.x+t.width)/this._width,t.y/this._height,(t.y+t.height)/this._height]))}get viewshedProjectionMatrices(){return this.faces.map((t=>t.projectionMatrix))}get viewshedViewMatrices(){return this.faces.map((t=>t.viewMatrix))}_setupFaceCamera(e,n,l,m){const{effectiveObserverRenderSpace:f,tiltedUpVector:d,targetRenderSpace:p,farDistanceRenderSpace:g,horizontalFieldOfView:_,verticalFieldOfView:b}=n,w=c();r(w,p,f);const M=c(),S=c(),F=(t,e)=>{const r=c(),o=s();return i(o,t,e),h(r,w,o),a(r,f,r),r};let z,T=d;const O=Math.min(90,_),v=Math.min(90,Math.max(0,(_-90)/2));let j=-45,B=45,y=-45,k=45;if(x(e)){const e=e=>t(e,-45,45);y=e(-b/2)-this.settings.toleranceBottomTop,k=e(+b/2)+this.settings.toleranceBottomTop}switch(e){case"front":z=p,j=-O/2,B=O/2;break;case"left":z=F(Math.PI/2,d),j=45-v;break;case"right":z=F(-Math.PI/2,d),B=-45+v;break;case"top":z=a(M,f,d),T=o(S,w);break;case"bottom":z=r(M,f,d),T=w;break;case"back":z=F(Math.PI,d)}const P=new u({center:z,eye:f,up:T,far:g});P.sectionAnglesDeg=[j-this.settings.toleranceSides,B+this.settings.toleranceSides,y,k],P.fovY=Math.PI/2;const C=P.setViewport(l,m);return this._faces[e]=P,C}isActive(t){return this._computeActiveFaces(t).size>0}_computeActiveFaces(t){const e=new Set,{horizontalFieldOfView:i,verticalFieldOfView:s}=t,r=-s/2,a=s/2;return 0===i||0===s||(r<=45&&a>=-45&&e.add("front"),i>90&&(e.add("left"),e.add("right")),i>270&&e.add("back"),a>45-this.settings.toleranceBottomTop&&e.add("top"),r<-45+this.settings.toleranceBottomTop&&e.add("bottom")),e}_computeBaseTextureSize({pixelRatio:t,fullWidth:e,fullHeight:i},s,r,a){const o=s/t,h=this.settings.textureSizeModifier(r);return l(Math.max(e,i)*o*h,this._maxTextureSize/a)}_ensureFBO(t){const e=this._width,i=this._height,s=this._handle?.fbo;s&&s.width===e&&s.height===i&&t===p(s.depthStencilTexture?.descriptor?.internalFormat??f.DEPTH_COMPONENT16)||(this._handle?.release(),this._handle=this._allocateFBO(t))}_allocateFBO(t){const{_width:e,_height:i}=this,s=t?n.DEPTH24_STENCIL8:n.DEPTH16;return this._fbos.acquire(e,i,"viewshed shadow map",s)}clearFBO(t){const e=this._fbos.rctx;this._ensureFBO(t),e.bindFramebuffer(this._handle?.fbo),e.setClearColor(1,1,1,1),e.clear(d.COLOR|d.DEPTH)}dispose(){this._debugFBO||(this._handle=e(this._handle))}start(t,e,i,s,r=!1){this._faces={};const a=this._computeActiveFaces(e),o=a.size;if(0===o)return!1;const h=this._computeBaseTextureSize(t,s,i,o);let c=0,n=0,l=0;return _.filter((t=>a.has(t))).forEach((t=>{const i=w(t,o);i>n&&(l=Math.max(l,c),c=0),n=i;const s=i*h;c+=this._setupFaceCamera(t,e,[c,s],h)})),l=Math.max(l,c),this._width=this.settings.textureResizeModulo(l),this._height=M(o)*h,this.clearFBO(r),!0}finish(){}get test(){}}function w(t,e){if(e<4)return 0;const i="front"===t||"left"===t;return 4===e?i?0:1:i||"right"===t?0:1}function M(t){return t<4?1:2}export{b as ViewshedShadowMap};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{acosClamped as e,deg2rad as t}from"../../../../../core/mathUtils.js";import o from"../../../../../core/PooledArray.js";import{j as n,i as s,c as a,e as r,d as c,h as l,n as i,o as h}from"../../../../../chunks/vec32.js";import{create as g}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{Edge as u}from"./Edge.js";const d=-1;function p(e,t,o){const c=e.vertices.position,l=e.vertices.componentIndex,i=y.position0,h=y.position1,g=y.faceNormal0,u=y.faceNormal1,{edges:p,normals:v}=w(e),V=p.length/4,j=t.allocate(V);let I=0;const N=V,b=o?.allocate(N);let D=0,E=0,k=0;x.length=0;for(let s=0;s<V;++s){const e=4*s;c.getVec(p.data[e],i),c.getVec(p.data[e+1],h);const t=x.pushNew();t.index=4*s,t.length=n(i,h)}x.sort(((e,t)=>t.length-e.length));const P=new Array,U=new Array;x.forAll((({length:e,index:n})=>{const w=p.data[n],x=p.data[n+1],V=p.data[n+2],N=p.data[n+3],q=N===d;if(c.getVec(w,i),c.getVec(x,h),q){const e=3*V;s(g,v.data[e],v.data[e+1],v.data[e+2]),a(u,g),y.componentIndex=l.get(w),y.cosAngle=r(g,u)}else{let e=3*V;if(s(g,v.data[e],v.data[e+1],v.data[e+2]),e=3*N,s(u,v.data[e],v.data[e+1],v.data[e+2]),y.componentIndex=l.get(w),y.cosAngle=r(g,u),m(y,M))return;y.cosAngle<-.9999&&a(u,g)}E+=e,k++,q||f(y,L)?(t.write(j,I++,y),P.push(e)):A(y,F)&&(b&&o&&o.write(b,D++,y),U.push(e))}));const q=new Float32Array(P.reverse()),z=new Float32Array(U.reverse()),B=b&&o?{instancesData:b.slice(0,D),lodInfo:{lengths:z}}:void 0;return{regular:{instancesData:j.slice(0,I),lodInfo:{lengths:q}},silhouette:B,averageEdgeLength:E/k}}function f(e,t){return e.cosAngle<t}function m(e,t){return e.cosAngle>t}function A(t,o){const n=e(t.cosAngle);h(N,t.position1,t.position0);return n*(r(l(I,t.faceNormal0,t.faceNormal1),N)>0?-1:1)>o}function w(e){const t=e.faces.length/3,o=e.faces,n=e.neighbors,s=e.vertices.position;V.length=j.length=0;for(let a=0;a<t;a++){const e=3*a,t=n[e],r=n[e+1],h=n[e+2],g=o[e],u=o[e+1],p=o[e+2];s.getVec(g,b),s.getVec(u,D),s.getVec(p,E),c(D,D,b),c(E,E,b),l(b,D,E),i(b,b),j.pushArray(b),(t===d||g<u)&&(V.push(g),V.push(u),V.push(a),V.push(t)),(r===d||u<p)&&(V.push(u),V.push(p),V.push(a),V.push(r)),(h===d||p<g)&&(V.push(p),V.push(g),V.push(a),V.push(h))}return{edges:V,normals:j}}class v{constructor(){this.index=0,this.length=0}}const x=new o({allocator:e=>e||new v,deallocator:null}),V=new o({deallocator:null}),j=new o({deallocator:null}),y=new u,I=g(),N=g(),b=g(),D=g(),E=g(),F=t(4),M=Math.cos(F),k=t(35),L=Math.cos(k);export{p as extractEdges};
5
+ import{acosClamped as e,deg2rad as t}from"../../../../../core/mathUtils.js";import o from"../../../../../core/PooledArray.js";import{j as n,i as s,c as a,e as r,d as c,h as l,n as i,E as h}from"../../../../../chunks/vec32.js";import{create as g}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{Edge as u}from"./Edge.js";const d=-1;function p(e,t,o){const c=e.vertices.position,l=e.vertices.componentIndex,i=y.position0,h=y.position1,g=y.faceNormal0,u=y.faceNormal1,{edges:p,normals:v}=w(e),V=p.length/4,j=t.allocate(V);let I=0;const N=V,E=o?.allocate(N);let b=0,D=0,k=0;x.length=0;for(let s=0;s<V;++s){const e=4*s;c.getVec(p.data[e],i),c.getVec(p.data[e+1],h);const t=x.pushNew();t.index=4*s,t.length=n(i,h)}x.sort(((e,t)=>t.length-e.length));const P=new Array,U=new Array;x.forAll((({length:e,index:n})=>{const w=p.data[n],x=p.data[n+1],V=p.data[n+2],N=p.data[n+3],q=N===d;if(c.getVec(w,i),c.getVec(x,h),q){const e=3*V;s(g,v.data[e],v.data[e+1],v.data[e+2]),a(u,g),y.componentIndex=l.get(w),y.cosAngle=r(g,u)}else{let e=3*V;if(s(g,v.data[e],v.data[e+1],v.data[e+2]),e=3*N,s(u,v.data[e],v.data[e+1],v.data[e+2]),y.componentIndex=l.get(w),y.cosAngle=r(g,u),m(y,M))return;y.cosAngle<-.9999&&a(u,g)}D+=e,k++,q||f(y,L)?(t.write(j,I++,y),P.push(e)):A(y,F)&&(E&&o&&o.write(E,b++,y),U.push(e))}));const q=new Float32Array(P.reverse()),z=new Float32Array(U.reverse()),B=E&&o?{instancesData:E.slice(0,b),lodInfo:{lengths:z}}:void 0;return{regular:{instancesData:j.slice(0,I),lodInfo:{lengths:q}},silhouette:B,averageEdgeLength:D/k}}function f(e,t){return e.cosAngle<t}function m(e,t){return e.cosAngle>t}function A(t,o){const n=e(t.cosAngle);h(N,t.position1,t.position0);return n*(r(l(I,t.faceNormal0,t.faceNormal1),N)>0?-1:1)>o}function w(e){const t=e.faces.length/3,o=e.faces,n=e.neighbors,s=e.vertices.position;V.length=j.length=0;for(let a=0;a<t;a++){const e=3*a,t=n[e],r=n[e+1],h=n[e+2],g=o[e],u=o[e+1],p=o[e+2];s.getVec(g,E),s.getVec(u,b),s.getVec(p,D),c(b,b,E),c(D,D,E),l(E,b,D),i(E,E),j.pushArray(E),(t===d||g<u)&&(V.push(g),V.push(u),V.push(a),V.push(t)),(r===d||u<p)&&(V.push(u),V.push(p),V.push(a),V.push(r)),(h===d||p<g)&&(V.push(p),V.push(g),V.push(a),V.push(h))}return{edges:V,normals:j}}class v{constructor(){this.index=0,this.length=0}}const x=new o({allocator:e=>e||new v,deallocator:null}),V=new o({deallocator:null}),j=new o({deallocator:null}),y=new u,I=g(),N=g(),E=g(),b=g(),D=g(),F=t(4),M=Math.cos(F),k=t(35),L=Math.cos(k);export{p as extractEdges};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{m as t}from"../../../../chunks/vec32.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{e}from"../../../../chunks/boundedPlane.js";import{IntersectorType as n}from"./IntersectorInterfaces.js";function o(t){return null!=t?.dist}function c(r){return(n,o,c)=>(t(u,n,o,c),!e(r,u))}function s(t){return o(t)&&t.intersector===n.OBJECT&&!!t.target}function i(t){return o(t)&&t.intersector===n.HUD&&!!t.target&&"center"in t.target&&null!=t.target.center}const u=r();export{i as isHudIntersectorResult,s as isObjectIntersectorResult,o as isValidIntersectorResult,c as sliceFilterPredicate};
5
+ import{m as o}from"../../../../chunks/vec32.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{e as s}from"../../../../chunks/boundedPlane.js";function e(r){return(e,c,m)=>!s(r,o(t,e,c,m))}const t=r();export{e as sliceFilterPredicate};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{getScaling as r}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as e}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{diameter as t}from"../../../../geometry/support/aaBoundingBox.js";import{g as n}from"../../../../chunks/sphere.js";import{isPclIntersectorResult as i,isVoxelIntersectorResult as a,isTiles3DIntersectorResult as l,isI3sIntersectorResult as u}from"../../layers/i3s/Intersector.js";import{isOverlayIntersectorResult as c,isTerrainIntersectorResult as o}from"../../terrain/Intersector.js";import{isObjectIntersectorResult as s,isHudIntersectorResult as g}from"./intersectorUtils.js";import{isLodIntersectorResult as p}from"./lodRendering/Intersector.js";function f(r,e){return s(r)||g(r)?b(r.target?.object,e):o(r)?e.map?.ground:i(r)||u(r)||c(r)||a(r)?b(r.target,e):null}function h(r,e){const t=y(r,e);return null!=t&&"graphic"===t.type?t.graphic:null}function y(r,e){if(null==r)return null;if(s(r)||g(r))return m(r.target?.object,e);if(i(r)){const e=r.target.createGraphic();return{type:"graphic",graphic:e,layer:e.layer}}if(a(r)){const e=r.target.createVoxelGraphic();return{type:"graphic",graphic:e,layer:e.layer}}if(l(r)){const e=r.target.createTiles3DGraphic();return{type:"graphic",graphic:e,layer:e.layer}}return c(r)||p(r)?m(r.target,e):u(r)?w(r.target,e):null}async function d(r,e){if(null==r)return null;if(s(r)||g(r))return V(r.target?.object,e);if(i(r)){const e=r.target.createGraphic();return{type:"graphic",graphic:e,layer:e.layer}}if(a(r)){const e=r.target.createVoxelGraphic();return{type:"graphic",graphic:e,layer:e.layer}}if(l(r)){const e=r.target.createTiles3DGraphic();return{type:"graphic",graphic:e,layer:e.layer}}return c(r)||p(r)?V(r.target,e):u(r)?w(r.target,e):null}function m(r,e){if(null==r?.graphicUid)return null;const t=b(r,e);if(null==t)return null;if(t===e.graphics)return null==e.graphicsView||"number"!=typeof r.graphicUid?null:e.graphicsView.getHit(r.graphicUid);const n=e.allLayerViews.find((r=>r.layer===t));return!n||n.suspended||null==r.graphicUid?null:"getHit"in n?n.getHit(r.graphicUid):null}async function V(r,e){if(null==r?.graphicUid)return null;const t=b(r,e);if(null==t)return null;if(t===e.graphics)return null==e.graphicsView||"number"!=typeof r.graphicUid?null:await e.graphicsView.getHitAsync(r.graphicUid);const n=e.allLayerViews.find((r=>r.layer===t));return!n||n.suspended||null==r.graphicUid?null:"getHitAsync"in n?await n.getHitAsync(r.graphicUid):null}function w(r,e){const t=b(r,e);if(null==t)return null;const n=e.allLayerViews.find((r=>r.layer===t));return n&&!n.suspended&&"getGraphicFromIntersectorTarget"in n?j(n.getGraphicFromIntersectorTarget(r)):null}function U(r,e){const t=b(r,e);if(null==t)return null;const n=e.allLayerViews.find((r=>r.layer===t));return n&&!n.suspended&&"getAABBFromIntersectorTarget"in n?n.getAABBFromIntersectorTarget(r):null}function j(r){return null!=r?{type:"graphic",graphic:r,layer:r.layer}:null}function b(r,e){return null==r?.layerViewUid?null:null!=e.graphicsView&&r.layerViewUid===e.graphicsView.uid?e.graphics:e.allLayerViews.find((e=>e.uid===r.layerViewUid))?.layer}function G(e,i){if(s(e)||g(e))return n(e.target.object.boundingVolumeWorldSpace.bounds);if(p(e)){r(A,e.transformation);const t=Math.max(A[0],A[1],A[2]);return e.target.baseBoundingSphere.radius*t}if(u(e)){const r=U(e.target,i);return r?.5*t(r):null}return null}function x(r){return!s(r)&&!g(r)&&(p(r)?r.target.numLodLevels>1:!!u(r))}const A=e();export{G as getIntersectedFeatureBSRadius,x as hasLod,h as toGraphic,y as toHit,d as toHitAsync,f as toOwner};
5
+ import{getScale as r}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as e}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{diameter as t}from"../../../../geometry/support/aaBoundingBox.js";import{g as n}from"../../../../chunks/sphere.js";import{isPclIntersectorResult as i,isVoxelIntersectorResult as a,isTiles3DIntersectorResult as l,isI3sIntersectorResult as c}from"../../layers/i3s/Intersector.js";import{isOverlayIntersectorResult as u,isTerrainIntersectorResult as o}from"../../terrain/Intersector.js";import{isHUDIntersectorResult as s}from"./HUDIntersectorResult.js";import{isObjectIntersectorResult as g}from"./ObjectIntersectorResult.js";import{isLodIntersectorResult as p}from"./lodRendering/Intersector.js";function f(r,e){return g(r)||s(r)?b(r.target?.object,e):o(r)?e.map?.ground:i(r)||c(r)||u(r)||a(r)?b(r.target,e):null}function h(r,e){const t=y(r,e);return"graphic"===t?.type?t.graphic:null}function y(r,e){if(null==r)return null;if(g(r)||s(r))return m(r.target?.object,e);if(i(r)){const e=r.target.createGraphic();return{type:"graphic",graphic:e,layer:e.layer}}if(a(r)){const e=r.target.createVoxelGraphic();return{type:"graphic",graphic:e,layer:e.layer}}if(l(r)){const e=r.target.createTiles3DGraphic();return{type:"graphic",graphic:e,layer:e.layer}}return u(r)||p(r)?m(r.target,e):c(r)?w(r.target,e):null}async function d(r,e){if(null==r)return null;if(g(r)||s(r))return V(r.target?.object,e);if(i(r)){const e=r.target.createGraphic();return{type:"graphic",graphic:e,layer:e.layer}}if(a(r)){const e=r.target.createVoxelGraphic();return{type:"graphic",graphic:e,layer:e.layer}}if(l(r)){const e=r.target.createTiles3DGraphic();return{type:"graphic",graphic:e,layer:e.layer}}return u(r)||p(r)?V(r.target,e):c(r)?w(r.target,e):null}function m(r,e){if(null==r?.graphicUid)return null;const t=b(r,e);if(null==t)return null;if(t===e.graphics)return null==e.graphicsView||"number"!=typeof r.graphicUid?null:e.graphicsView.getHit(r.graphicUid);const n=e.allLayerViews.find((r=>r.layer===t));return!n||n.suspended||null==r.graphicUid?null:"getHit"in n?n.getHit(r.graphicUid):null}async function V(r,e){if(null==r?.graphicUid)return null;const t=b(r,e);if(null==t)return null;if(t===e.graphics)return null==e.graphicsView||"number"!=typeof r.graphicUid?null:await e.graphicsView.getHitAsync(r.graphicUid);const n=e.allLayerViews.find((r=>r.layer===t));return!n||n.suspended||null==r.graphicUid?null:"getHitAsync"in n?await n.getHitAsync(r.graphicUid):null}function w(r,e){const t=b(r,e);if(null==t)return null;const n=e.allLayerViews.find((r=>r.layer===t));return n&&!n.suspended&&"getGraphicFromIntersectorTarget"in n?U(n.getGraphicFromIntersectorTarget(r)):null}function j(r,e){const t=b(r,e);if(null==t)return null;const n=e.allLayerViews.find((r=>r.layer===t));return n&&!n.suspended&&"getAABBFromIntersectorTarget"in n?n.getAABBFromIntersectorTarget(r):null}function U(r){return null!=r?{type:"graphic",graphic:r,layer:r.layer}:null}function b(r,e){return null==r?.layerViewUid?null:null!=e.graphicsView&&r.layerViewUid===e.graphicsView.uid?e.graphics:e.allLayerViews.find((e=>e.uid===r.layerViewUid))?.layer}function I(e,i){if(g(e)||s(e))return n(e.target.object.boundingVolumeWorldSpace.bounds);if(p(e)){r(x,e.transformation);const t=Math.max(x[0],x[1],x[2]);return e.target.baseBoundingSphere.radius*t}if(c(e)){const r=j(e.target,i);return r?.5*t(r):null}return null}function G(r){return!g(r)&&!s(r)&&(p(r)?r.target.numLodLevels>1:!!c(r))}const x=e();export{I as getIntersectedFeatureBSRadius,G as hasLod,h as toGraphic,y as toHit,d as toHitAsync,f as toOwner};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{IntersectorType as r}from"../IntersectorInterfaces.js";import{Graphic3DTarget as t}from"../IntersectorTarget.js";import{isValidIntersectorResult as e}from"../intersectorUtils.js";class s extends t{constructor(r,t,e,s,i){super(r,t),this.layerViewUid=r,this.graphicUid=t,this.triangleNr=e,this.baseBoundingSphere=s,this.numLodLevels=i}}function i(t){return e(t)&&t.intersector===r.LOD&&!!t.target}export{s as LodTarget,i as isLodIntersectorResult};
5
+ import{isValidIntersectorResult as r}from"../IntersectorResult.js";import{Graphic3DTarget as t}from"../IntersectorTarget.js";import{IntersectorType as e}from"../IntersectorType.js";class s extends t{constructor(r,t,e,s,i){super(r,t),this.layerViewUid=r,this.graphicUid=t,this.triangleNr=e,this.baseBoundingSphere=s,this.numLodLevels=i}}function i(t){return r(t)&&t.intersector===e.LOD&&!!t.target}export{s as LodTarget,i as isLodIntersectorResult};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../../chunks/tslib.es6.js";import{isSome as t}from"../../../../../core/arrayUtils.js";import r from"../../../../../core/Error.js";import{someMap as n,getOrCreateMapValue as s}from"../../../../../core/MapUtils.js";import{destroyMaybe as a}from"../../../../../core/maybe.js";import{isAborted as i,throwIfAborted as o}from"../../../../../core/promiseUtils.js";import{property as l}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import{subclass as c}from"../../../../../core/accessorSupport/decorators/subclass.js";import{create as h}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{d,e as u,t as m}from"../../../../../chunks/vec32.js";import{create as p}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as f,fromValues as _}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{debugFlags as g}from"../../../support/debugFlags.js";import{glLayout as I}from"../../../support/buffer/glUtil.js";import{newLayout as y}from"../../../support/buffer/InterleavedLayout.js";import v from"../../../webgl/RenderCamera.js";import{ShaderOutput as C}from"../../core/shaderLibrary/ShaderOutput.js";import{AsyncRenderPlugin as E}from"../../effects/RenderPlugin.js";import{Default3D as R}from"../DefaultVertexAttributeLocations.js";import{DepthRange as D}from"../DepthRange.js";import{IntersectorType as A}from"../IntersectorInterfaces.js";import b from"../Octree.js";import{RenderSlot as T}from"../RenderSlot.js";import{assert as L}from"../Util.js";import{VertexAttribute as S}from"../VertexAttribute.js";import{InstanceData as O,StateFlags as j}from"./InstanceData.js";import{InstanceOctree as x}from"./InstanceOctree.js";import{LevelSelector as M}from"./LevelSelector.js";import{LodLevel as N}from"./LodLevel.js";import{RenderInstanceData as w}from"./RenderInstanceData.js";import{colorMixModes as H}from"../../materials/internal/MaterialUtil.js";import{encodeDoubleVec3 as U}from"../../materials/renderers/utils.js";import{DefaultMaterialDrawParameters as F}from"../../shaders/DefaultMaterialTechnique.js";import{defaultHighlightName as V}from"../../../../support/HighlightDefaults.js";import{TaskPriority as B,noBudget as q}from"../../../../support/Scheduler.js";import{bindVertexBufferLayout as G,unbindVertexBufferLayout as P}from"../../../../webgl/Util.js";const z=e=>{const t=e.baseBoundingSphere.radius,r=e.levels.map((e=>e.minScreenSpaceRadius));return new M(t,r)};let k=class extends E{constructor(e,t){super(e),this.type=A.LOD,this.isGround=!1,this._levels=[],this._defaultRenderInstanceData=new Array,this._highlightRenderInstanceDataMap=new Map,this._instanceIndex=0,this._cycleStartIndex=0,this._slicePlane=!1,this._camera=new v,this._updateCyclesWithStaticCamera=-1,this._needFullCycle=!1,this.produces=new Map([[T.OPAQUE_MATERIAL,e=>this._produces(e)],[T.TRANSPARENT_MATERIAL,e=>!!this._hasTransparentLevels()&&this._produces(e)]]),this._instanceData=new O({shaderTransformation:e.shaderTransformation},e.optionalFields),this.addHandles(t.registerTask(B.LOD_RENDERER,this))}initialize(){this._instanceBufferLayout=Y(this.optionalFields),this._glInstanceBufferLayout=I(this._instanceBufferLayout,1),this.addHandles([this._instanceData.events.on("instances-changed",(()=>this._requestUpdateCycle())),this._instanceData.events.on("instance-transform-changed",(({index:e})=>{this._requestUpdateCycle(),this.metadata.notifyGraphicGeometryChanged(e)})),this._instanceData.events.on("instance-visibility-changed",(({index:e})=>{this._requestUpdateCycle(!0),this.metadata.notifyGraphicVisibilityChanged(e)})),this._instanceData.events.on("instance-highlight-changed",(()=>this._requestUpdateCycle(!0)))])}get _allRenderInstanceData(){return[this._defaultRenderInstanceData,...this._highlightRenderInstanceDataMap.values()]}get _allRenderInstanceDataExceptHighlightShadow(){const e=[this._defaultRenderInstanceData];for(const t of this._highlightRenderInstanceDataMap)t[0]!==V&&e.push(t[1]);return e}hasHighlight(e){return this._highlightRenderInstanceDataMap.has(e)}get _enableLevelSelection(){return this.symbol.levels.length>1}get levels(){return this._levels}get baseBoundingBox(){return this._levels[this._levels.length-1].boundingBox}get baseBoundingSphere(){return this._levels[this._levels.length-1].boundingSphere}get baseMaterial(){return this._levels[this._levels.length-1].components[0].material}get slicePlaneEnabled(){return this._slicePlane}set slicePlaneEnabled(e){this._slicePlane=e}get layerViewUid(){return this.metadata.layerViewUid}get instanceData(){return this._instanceData}get hasEmissions(){return this._levels.some((e=>e.components.some((e=>e.material.hasEmissions))))}get usedMemory(){return this._allRenderInstanceData.reduce(((e,t)=>t.reduce(((e,t)=>e+t.usedMemory),e)),this._levels.reduce(((e,t)=>e+t.components.reduce(((e,t)=>e+t.usedMemory),0)),0))}get renderStats(){const e=this._instanceData.size,t=[];return this._levels.forEach(((e,r)=>{const n=this._allRenderInstanceData[0][r].size+this._allRenderInstanceData[1][r].size,s=e.triangleCount;t.push({renderedInstances:n,renderedTriangles:n*s,trianglesPerInstance:s})})),{totalInstances:e,renderedInstances:t.reduce(((e,t)=>e+t.renderedInstances),0),renderedTriangles:t.reduce(((e,t)=>e+t.renderedTriangles),0),levels:t}}_createRenderInstanceDataArray(e=[]){const{rctx:t}=this._context.renderContext;return this.symbol.levels.map((r=>{e.push(new w(t,this._instanceBufferLayout))})),e}async initializeRenderContext(e,r){this._context=e,this._createRenderInstanceDataArray(this._defaultRenderInstanceData);const n=await Promise.allSettled(this.symbol.levels.map((t=>N.create(e,t,r)))),s=n.map((e=>"fulfilled"===e.status?e.value:null)).filter(t);if(i(r)||s.length!==n.length){s.forEach((e=>e.destroy())),o(r);for(const e of n)if("rejected"===e.status)throw e.reason}this._levels=s,this._levelSelector=z(this)}uninitializeRenderContext(){this._invalidateOctree(),this._levels.forEach((e=>e.destroy())),this._defaultRenderInstanceData.forEach((e=>e.destroy())),this._highlightRenderInstanceDataMap.forEach((e=>e.forEach((e=>e.destroy()))))}_hasTransparentLevels(){return this._levels.some((e=>e.components.some((e=>{const t=e.material.produces.get(T.TRANSPARENT_MATERIAL);return t?.(C.Color)}))))}hasHighlights(){return n(this._highlightRenderInstanceDataMap,(e=>e.some((e=>e.size>0))))}_produces(e){return(e!==C.Highlight||this.hasHighlights())&&(e!==C.ShadowHighlight||this.hasHighlight(V))}prepareRender(e){if(!g.LOD_INSTANCE_RENDERER_DISABLE_UPDATES){if(this._enableLevelSelection){const t=e.bind.contentCamera.equals(this._camera);this._camera.copyFrom(e.bind.contentCamera),t||this._requestUpdateCycle()}this._needFullCycle&&(this.runTask(q),this._needFullCycle=!1)}}acquireTechniques(e){if(!this.baseMaterial.visible||!this.baseMaterial.isVisibleForOutput(e.output))return null;const t=this._getInstanceDatas(e);if(!t)return null;const r=new Array,n=this.levels;return t.forEach((t=>n.forEach((({components:n},s)=>n.forEach((n=>r.push(this._beginComponent(e,t[s],n)))))))),r}render(e,t){const r=this._getInstanceDatas(e);if(!r||null==t)return;let n=0;e.rctx.bindVAO();const s=this.levels;r.forEach((r=>s.forEach((({components:s},a)=>s.forEach((s=>this._renderComponent(e,t[n++],r[a],s,a)))))))}_getInstanceDatas(e){const{output:t,bind:r}=e,n=t===C.Highlight,s=t===C.ShadowHighlight,a=!n&&!s,i=t!==C.ShadowExcludeHighlight;if(a)return i?this._allRenderInstanceData:this._allRenderInstanceDataExceptHighlightShadow;const{_highlightRenderInstanceDataMap:o}=this;if(i){if(n){const e=r.highlight?.name;if(!e)return null;const t=o.get(e);return t?[t]:null}const e=o.get(V);return s?e?[e]:null:Array.from(o.values())}return null}intersect(e,t,r,n){if(!this.baseMaterial.visible||null==this._octree)return;const s=p();d(s,n,r);const a=s=>{this._instanceData.getCombinedModelTransform(s,Z),e.transform.set(Z),m($,r,e.transform.inverse),m(X,n,e.transform.inverse);const a=this._instanceData.getState(s),i=this._instanceData.getLodLevel(s),o=this._levels.length;L(!!(a&j.ACTIVE),"invalid instance state"),L(i>=0&&i<o,"invaid lod level"),this._levels[i].intersect(e,t,$,X,s,this.metadata,o)};this.baseMaterial.parameters.verticalOffset?this._octree.forEach(a):this._octree.forEachAlongRay(r,s,a)}notifyShaderTransformationChanged(){this._invalidateOctree(),this._requestUpdateCycle()}get _octree(){if(null==this._octreeCached){const e=this._instanceData,t=e.view?.state;if(!t)return null;this._octreeCached=new x(e,this.baseBoundingSphere);for(let r=0;r<e.capacity;++r)t.get(r)&j.ACTIVE&&this._octreeCached.addInstance(r)}return this._octreeCached}_invalidateOctree(){this._octreeCached=a(this._octreeCached)}queryDepthRange(e){if(null==this._octree)return new D;const t=e.viewForward,r=this._octree.findClosest(t,b.DepthOrder.FRONT_TO_BACK,e.frustum),n=this._octree.findClosest(t,b.DepthOrder.BACK_TO_FRONT,e.frustum);if(null==r||null==n)return new D;const s=e.eye,a=this._instanceData.view;a.boundingSphere.getVec(r,Q),d(Q,Q,s);const i=u(Q,t)-Q[3];a.boundingSphere.getVec(n,Q),d(Q,Q,s);const o=u(Q,t)+Q[3];return new D(i,o)}_requestUpdateCycle(e=!1){this._updateCyclesWithStaticCamera=-1,this._cycleStartIndex=this._instanceIndex,e&&(this._needFullCycle=!0,this._context.requestRender())}_startUpdateCycle(){this._updateCyclesWithStaticCamera++,this._allRenderInstanceData.forEach((e=>e.forEach((e=>e.startUpdateCycle()))))}get running(){return this._instanceData.size>0&&this._updateCyclesWithStaticCamera<1}runTask(e){const{_enableLevelSelection:t,_camera:n,_levelSelector:a}=this;this._allRenderInstanceData.forEach((e=>e.forEach((e=>e.beginUpdate()))));const i=this._instanceData,o=i.view;let l=i.size;const c=i.capacity;let h=this._instanceIndex;const d=Math.ceil(c/500),{_highlightRenderInstanceDataMap:u}=this;for(let m=0;m<l&&!e.done;++m){h===this._cycleStartIndex&&this._startUpdateCycle();const m=o.state.get(h);let p=0;if(!(m&j.ALLOCATED)){h=h+1===c?0:h+1,l++;continue}const f=o.lodLevel.get(h);if(m&j.DEFAULT_ACTIVE&&this._defaultRenderInstanceData[f].freeTail(),m&j.HIGHLIGHT_ACTIVE){const e=i.geHighlightOptionsPrev(h);if(e){const t=u.get(e);if(!t)throw new r("internal:lod-renderer","Internal error in lodRenderer");t[f].freeTail(),t.every((e=>e.isEmpty))&&(t.forEach((e=>e.destroy())),u.delete(e))}}if(m&j.REMOVE)i.freeInstance(h);else if(m&j.VISIBLE){let e=0;if(t&&(o.modelOrigin.getVec(h,J),e=a.selectLevel(J,i.getCombinedMedianScaleFactor(h),n)),p=m&~(j.ACTIVE|j.TRANSFORM_CHANGED),e>=0)if(m&j.HIGHLIGHT){const t=i.getHighlightName(h);if(t){const n=()=>{const e=this._createRenderInstanceDataArray();return e.forEach((e=>e.beginUpdate())),e},a=s(u,t,n);if(e>=a.length)throw new r("internal:lod-renderer",`LodRenderer internal error - missing lodLevel ${e}`);W(a[e],o,h)}p|=j.HIGHLIGHT_ACTIVE}else W(this._defaultRenderInstanceData[e],o,h),p|=j.DEFAULT_ACTIVE;o.state.set(h,p),o.lodLevel.set(h,e)}else p=m&~(j.ACTIVE|j.TRANSFORM_CHANGED),o.state.set(h,p);if(null!=this._octreeCached){const e=!!(m&j.ACTIVE),t=!!(p&j.ACTIVE);!e&&t?this._octreeCached.addInstance(h):e&&!t?this._octreeCached.removeInstance(h):e&&t&&m&j.TRANSFORM_CHANGED&&(this._octreeCached.removeInstance(h),this._octreeCached.addInstance(h))}h=h+1===c?0:h+1,h%d==0&&e.madeProgress()}this._instanceIndex=h,this._allRenderInstanceData.forEach((e=>e.forEach((e=>e.endUpdate())))),this._context.requestRender()}_beginComponent(e,t,r){if(0===t.size)return null;const n=r.glMaterials.load(e.rctx,e.bind.slot,e.output);return n?.beginSlot(e.bind)}_renderComponent(e,t,r,n,s){if(!t)return;const{bind:a,rctx:i}=e;i.runAppleAmdDriverHelper();const o=i.bindTechnique(t,a,n.material.parameters,te);i.bindVAO(n.vao),t.ensureAttributeLocations(n.vao),g.LOD_INSTANCE_RENDERER_COLORIZE_BY_LEVEL&&e.output===C.Color&&(o.setUniform4fv("externalColor",ee[Math.min(s,ee.length-1)]),o.setUniform1i("colorMixMode",H.replace));const l=r.capacity,c=r.headIndex,h=r.tailIndex,d=r.firstIndex,u=this._glInstanceBufferLayout,m=(e,s)=>{G(i,R,r.buffer,u,e),i.drawArraysInstanced(t.primitiveType,0,n.vertexCount,s-e),P(i,R,r.buffer,u)};n.material.transparent&&null!=d?c>h?(L(d>=h&&d<=c,"invalid firstIndex"),m(d,c),m(h,d)):c<h&&(d<=c?(L(d>=0&&d<=c,"invalid firstIndex"),m(d,c),m(h,l),m(0,d)):(L(d>=h&&d<=l,"invalid firstIndex"),m(d,l),m(0,c),m(h,d))):c>h?m(h,c):c<h&&(m(0,c),m(h,l)),i.bindVAO(null)}};function W(e,t,r){const n=e.allocateHead();K(t,r,e.view,n)}function K(e,t,r,n){U(e.modelOrigin,t,r.modelOriginHi,r.modelOriginLo,n),r.model.copyFrom(n,e.model,t),r.modelNormal.copyFrom(n,e.modelNormal,t),e.color&&r.color&&r.color.copyFrom(n,e.color,t),e.objectAndLayerIdColor&&r.objectAndLayerIdColor&&r.objectAndLayerIdColor.copyFrom(n,e.objectAndLayerIdColor,t),e.featureAttribute&&r.featureAttribute&&r.featureAttribute.copyFrom(n,e.featureAttribute,t)}function Y(e){let t=y().vec3f(S.INSTANCEMODELORIGINHI).vec3f(S.INSTANCEMODELORIGINLO).mat3f(S.INSTANCEMODEL).mat3f(S.INSTANCEMODELNORMAL);return null!=e&&e.includes("featureAttribute")&&(t=t.vec4f(S.INSTANCEFEATUREATTRIBUTE)),null!=e&&e.includes("color")&&(t=t.vec4u8(S.INSTANCECOLOR)),null!=e&&e.includes("objectAndLayerIdColor")&&(t=t.vec4u8(S.INSTANCEOBJECTANDLAYERIDCOLOR)),t}e([l({constructOnly:!0})],k.prototype,"symbol",void 0),e([l({constructOnly:!0})],k.prototype,"optionalFields",void 0),e([l({constructOnly:!0})],k.prototype,"metadata",void 0),e([l({constructOnly:!0})],k.prototype,"shaderTransformation",void 0),e([l()],k.prototype,"_instanceData",void 0),e([l()],k.prototype,"_cycleStartIndex",void 0),e([l({readOnly:!0})],k.prototype,"_enableLevelSelection",null),e([l()],k.prototype,"_updateCyclesWithStaticCamera",void 0),e([l({readOnly:!0})],k.prototype,"running",null),k=e([c("esri.views.3d.webgl-engine.lib.lodRendering.LodRenderer")],k);const J=p(),Q=f(),Z=h(),$=p(),X=p(),ee=[_(1,0,1,1),_(0,0,1,1),_(0,1,0,1),_(1,1,0,1),_(1,0,0,1)],te=new F;export{k as LodRenderer};
5
+ import{_ as e}from"../../../../../chunks/tslib.es6.js";import{isSome as t}from"../../../../../core/arrayUtils.js";import r from"../../../../../core/Error.js";import{someMap as n,getOrCreateMapValue as s}from"../../../../../core/MapUtils.js";import{destroyMaybe as a}from"../../../../../core/maybe.js";import{isAborted as i,throwIfAborted as o}from"../../../../../core/promiseUtils.js";import{property as l}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import{subclass as c}from"../../../../../core/accessorSupport/decorators/subclass.js";import{create as h}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{d,e as u,t as m}from"../../../../../chunks/vec32.js";import{create as p}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as f,fromValues as _}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{debugFlags as g}from"../../../support/debugFlags.js";import{glLayout as I}from"../../../support/buffer/glUtil.js";import{newLayout as y}from"../../../support/buffer/InterleavedLayout.js";import v from"../../../webgl/RenderCamera.js";import{ShaderOutput as C}from"../../core/shaderLibrary/ShaderOutput.js";import{AsyncRenderPlugin as E}from"../../effects/RenderPlugin.js";import{Default3D as R}from"../DefaultVertexAttributeLocations.js";import{DepthRange as D}from"../DepthRange.js";import{IntersectorType as A}from"../IntersectorType.js";import b from"../Octree.js";import{RenderSlot as T}from"../RenderSlot.js";import{assert as L}from"../Util.js";import{VertexAttribute as S}from"../VertexAttribute.js";import{InstanceData as O,StateFlags as j}from"./InstanceData.js";import{InstanceOctree as x}from"./InstanceOctree.js";import{LevelSelector as M}from"./LevelSelector.js";import{LodLevel as N}from"./LodLevel.js";import{RenderInstanceData as w}from"./RenderInstanceData.js";import{colorMixModes as H}from"../../materials/internal/MaterialUtil.js";import{encodeDoubleVec3 as U}from"../../materials/renderers/utils.js";import{DefaultMaterialDrawParameters as F}from"../../shaders/DefaultMaterialTechnique.js";import{defaultHighlightName as V}from"../../../../support/HighlightDefaults.js";import{TaskPriority as B,noBudget as q}from"../../../../support/Scheduler.js";import{bindVertexBufferLayout as G,unbindVertexBufferLayout as P}from"../../../../webgl/Util.js";const z=e=>{const t=e.baseBoundingSphere.radius,r=e.levels.map((e=>e.minScreenSpaceRadius));return new M(t,r)};let k=class extends E{constructor(e,t){super(e),this.type=A.LOD,this.isGround=!1,this._levels=[],this._defaultRenderInstanceData=new Array,this._highlightRenderInstanceDataMap=new Map,this._instanceIndex=0,this._cycleStartIndex=0,this._slicePlane=!1,this._camera=new v,this._updateCyclesWithStaticCamera=-1,this._needFullCycle=!1,this.produces=new Map([[T.OPAQUE_MATERIAL,e=>this._produces(e)],[T.TRANSPARENT_MATERIAL,e=>!!this._hasTransparentLevels()&&this._produces(e)]]),this._instanceData=new O({shaderTransformation:e.shaderTransformation},e.optionalFields),this.addHandles(t.registerTask(B.LOD_RENDERER,this))}initialize(){this._instanceBufferLayout=Y(this.optionalFields),this._glInstanceBufferLayout=I(this._instanceBufferLayout,1),this.addHandles([this._instanceData.events.on("instances-changed",(()=>this._requestUpdateCycle())),this._instanceData.events.on("instance-transform-changed",(({index:e})=>{this._requestUpdateCycle(),this.metadata.notifyGraphicGeometryChanged(e)})),this._instanceData.events.on("instance-visibility-changed",(({index:e})=>{this._requestUpdateCycle(!0),this.metadata.notifyGraphicVisibilityChanged(e)})),this._instanceData.events.on("instance-highlight-changed",(()=>this._requestUpdateCycle(!0)))])}get _allRenderInstanceData(){return[this._defaultRenderInstanceData,...this._highlightRenderInstanceDataMap.values()]}get _allRenderInstanceDataExceptHighlightShadow(){const e=[this._defaultRenderInstanceData];for(const t of this._highlightRenderInstanceDataMap)t[0]!==V&&e.push(t[1]);return e}hasHighlight(e){return this._highlightRenderInstanceDataMap.has(e)}get _enableLevelSelection(){return this.symbol.levels.length>1}get levels(){return this._levels}get baseBoundingBox(){return this._levels[this._levels.length-1].boundingBox}get baseBoundingSphere(){return this._levels[this._levels.length-1].boundingSphere}get baseMaterial(){return this._levels[this._levels.length-1].components[0].material}get slicePlaneEnabled(){return this._slicePlane}set slicePlaneEnabled(e){this._slicePlane=e}get layerViewUid(){return this.metadata.layerViewUid}get instanceData(){return this._instanceData}get hasEmissions(){return this._levels.some((e=>e.components.some((e=>e.material.hasEmissions))))}get usedMemory(){return this._allRenderInstanceData.reduce(((e,t)=>t.reduce(((e,t)=>e+t.usedMemory),e)),this._levels.reduce(((e,t)=>e+t.components.reduce(((e,t)=>e+t.usedMemory),0)),0))}get renderStats(){const e=this._instanceData.size,t=[];return this._levels.forEach(((e,r)=>{const n=this._allRenderInstanceData[0][r].size+this._allRenderInstanceData[1][r].size,s=e.triangleCount;t.push({renderedInstances:n,renderedTriangles:n*s,trianglesPerInstance:s})})),{totalInstances:e,renderedInstances:t.reduce(((e,t)=>e+t.renderedInstances),0),renderedTriangles:t.reduce(((e,t)=>e+t.renderedTriangles),0),levels:t}}_createRenderInstanceDataArray(e=[]){const{rctx:t}=this._context.renderContext;return this.symbol.levels.map((r=>{e.push(new w(t,this._instanceBufferLayout))})),e}async initializeRenderContext(e,r){this._context=e,this._createRenderInstanceDataArray(this._defaultRenderInstanceData);const n=await Promise.allSettled(this.symbol.levels.map((t=>N.create(e,t,r)))),s=n.map((e=>"fulfilled"===e.status?e.value:null)).filter(t);if(i(r)||s.length!==n.length){s.forEach((e=>e.destroy())),o(r);for(const e of n)if("rejected"===e.status)throw e.reason}this._levels=s,this._levelSelector=z(this)}uninitializeRenderContext(){this._invalidateOctree(),this._levels.forEach((e=>e.destroy())),this._defaultRenderInstanceData.forEach((e=>e.destroy())),this._highlightRenderInstanceDataMap.forEach((e=>e.forEach((e=>e.destroy()))))}_hasTransparentLevels(){return this._levels.some((e=>e.components.some((e=>{const t=e.material.produces.get(T.TRANSPARENT_MATERIAL);return t?.(C.Color)}))))}hasHighlights(){return n(this._highlightRenderInstanceDataMap,(e=>e.some((e=>e.size>0))))}_produces(e){return(e!==C.Highlight||this.hasHighlights())&&(e!==C.ShadowHighlight||this.hasHighlight(V))}prepareRender(e){if(!g.LOD_INSTANCE_RENDERER_DISABLE_UPDATES){if(this._enableLevelSelection){const t=e.bind.contentCamera.equals(this._camera);this._camera.copyFrom(e.bind.contentCamera),t||this._requestUpdateCycle()}this._needFullCycle&&(this.runTask(q),this._needFullCycle=!1)}}acquireTechniques(e){if(!this.baseMaterial.visible||!this.baseMaterial.isVisibleForOutput(e.output))return null;const t=this._getInstanceDatas(e);if(!t)return null;const r=new Array,n=this.levels;return t.forEach((t=>n.forEach((({components:n},s)=>n.forEach((n=>r.push(this._beginComponent(e,t[s],n)))))))),r}render(e,t){const r=this._getInstanceDatas(e);if(!r||null==t)return;let n=0;e.rctx.bindVAO();const s=this.levels;r.forEach((r=>s.forEach((({components:s},a)=>s.forEach((s=>this._renderComponent(e,t[n++],r[a],s,a)))))))}_getInstanceDatas(e){const{output:t,bind:r}=e,n=t===C.Highlight,s=t===C.ShadowHighlight,a=!n&&!s,i=t!==C.ShadowExcludeHighlight;if(a)return i?this._allRenderInstanceData:this._allRenderInstanceDataExceptHighlightShadow;const{_highlightRenderInstanceDataMap:o}=this;if(i){if(n){const e=r.highlight?.name;if(!e)return null;const t=o.get(e);return t?[t]:null}const e=o.get(V);return s?e?[e]:null:Array.from(o.values())}return null}intersect(e,t,r,n){if(!this.baseMaterial.visible||null==this._octree)return;const s=p();d(s,n,r);const a=s=>{this._instanceData.getCombinedModelTransform(s,Z),e.transform.set(Z),m($,r,e.transform.inverse),m(X,n,e.transform.inverse);const a=this._instanceData.getState(s),i=this._instanceData.getLodLevel(s),o=this._levels.length;L(!!(a&j.ACTIVE),"invalid instance state"),L(i>=0&&i<o,"invaid lod level"),this._levels[i].intersect(e,t,$,X,s,this.metadata,o)};this.baseMaterial.parameters.verticalOffset?this._octree.forEach(a):this._octree.forEachAlongRay(r,s,a)}notifyShaderTransformationChanged(){this._invalidateOctree(),this._requestUpdateCycle()}get _octree(){if(null==this._octreeCached){const e=this._instanceData,t=e.view?.state;if(!t)return null;this._octreeCached=new x(e,this.baseBoundingSphere);for(let r=0;r<e.capacity;++r)t.get(r)&j.ACTIVE&&this._octreeCached.addInstance(r)}return this._octreeCached}_invalidateOctree(){this._octreeCached=a(this._octreeCached)}queryDepthRange(e){if(null==this._octree)return new D;const t=e.viewForward,r=this._octree.findClosest(t,b.DepthOrder.FRONT_TO_BACK,e.frustum),n=this._octree.findClosest(t,b.DepthOrder.BACK_TO_FRONT,e.frustum);if(null==r||null==n)return new D;const s=e.eye,a=this._instanceData.view;a.boundingSphere.getVec(r,Q),d(Q,Q,s);const i=u(Q,t)-Q[3];a.boundingSphere.getVec(n,Q),d(Q,Q,s);const o=u(Q,t)+Q[3];return new D(i,o)}_requestUpdateCycle(e=!1){this._updateCyclesWithStaticCamera=-1,this._cycleStartIndex=this._instanceIndex,e&&(this._needFullCycle=!0,this._context.requestRender())}_startUpdateCycle(){this._updateCyclesWithStaticCamera++,this._allRenderInstanceData.forEach((e=>e.forEach((e=>e.startUpdateCycle()))))}get running(){return this._instanceData.size>0&&this._updateCyclesWithStaticCamera<1}runTask(e){const{_enableLevelSelection:t,_camera:n,_levelSelector:a}=this;this._allRenderInstanceData.forEach((e=>e.forEach((e=>e.beginUpdate()))));const i=this._instanceData,o=i.view;let l=i.size;const c=i.capacity;let h=this._instanceIndex;const d=Math.ceil(c/500),{_highlightRenderInstanceDataMap:u}=this;for(let m=0;m<l&&!e.done;++m){h===this._cycleStartIndex&&this._startUpdateCycle();const m=o.state.get(h);let p=0;if(!(m&j.ALLOCATED)){h=h+1===c?0:h+1,l++;continue}const f=o.lodLevel.get(h);if(m&j.DEFAULT_ACTIVE&&this._defaultRenderInstanceData[f].freeTail(),m&j.HIGHLIGHT_ACTIVE){const e=i.geHighlightOptionsPrev(h);if(e){const t=u.get(e);if(!t)throw new r("internal:lod-renderer","Internal error in lodRenderer");t[f].freeTail(),t.every((e=>e.isEmpty))&&(t.forEach((e=>e.destroy())),u.delete(e))}}if(m&j.REMOVE)i.freeInstance(h);else if(m&j.VISIBLE){let e=0;if(t&&(o.modelOrigin.getVec(h,J),e=a.selectLevel(J,i.getCombinedMedianScaleFactor(h),n)),p=m&~(j.ACTIVE|j.TRANSFORM_CHANGED),e>=0)if(m&j.HIGHLIGHT){const t=i.getHighlightName(h);if(t){const n=()=>{const e=this._createRenderInstanceDataArray();return e.forEach((e=>e.beginUpdate())),e},a=s(u,t,n);if(e>=a.length)throw new r("internal:lod-renderer",`LodRenderer internal error - missing lodLevel ${e}`);W(a[e],o,h)}p|=j.HIGHLIGHT_ACTIVE}else W(this._defaultRenderInstanceData[e],o,h),p|=j.DEFAULT_ACTIVE;o.state.set(h,p),o.lodLevel.set(h,e)}else p=m&~(j.ACTIVE|j.TRANSFORM_CHANGED),o.state.set(h,p);if(null!=this._octreeCached){const e=!!(m&j.ACTIVE),t=!!(p&j.ACTIVE);!e&&t?this._octreeCached.addInstance(h):e&&!t?this._octreeCached.removeInstance(h):e&&t&&m&j.TRANSFORM_CHANGED&&(this._octreeCached.removeInstance(h),this._octreeCached.addInstance(h))}h=h+1===c?0:h+1,h%d==0&&e.madeProgress()}this._instanceIndex=h,this._allRenderInstanceData.forEach((e=>e.forEach((e=>e.endUpdate())))),this._context.requestRender()}_beginComponent(e,t,r){if(0===t.size)return null;const n=r.glMaterials.load(e.rctx,e.bind.slot,e.output);return n?.beginSlot(e.bind)}_renderComponent(e,t,r,n,s){if(!t)return;const{bind:a,rctx:i}=e;i.runAppleAmdDriverHelper();const o=i.bindTechnique(t,a,n.material.parameters,te);i.bindVAO(n.vao),t.ensureAttributeLocations(n.vao),g.LOD_INSTANCE_RENDERER_COLORIZE_BY_LEVEL&&e.output===C.Color&&(o.setUniform4fv("externalColor",ee[Math.min(s,ee.length-1)]),o.setUniform1i("colorMixMode",H.replace));const l=r.capacity,c=r.headIndex,h=r.tailIndex,d=r.firstIndex,u=this._glInstanceBufferLayout,m=(e,s)=>{G(i,R,r.buffer,u,e),i.drawArraysInstanced(t.primitiveType,0,n.vertexCount,s-e),P(i,R,r.buffer,u)};n.material.transparent&&null!=d?c>h?(L(d>=h&&d<=c,"invalid firstIndex"),m(d,c),m(h,d)):c<h&&(d<=c?(L(d>=0&&d<=c,"invalid firstIndex"),m(d,c),m(h,l),m(0,d)):(L(d>=h&&d<=l,"invalid firstIndex"),m(d,l),m(0,c),m(h,d))):c>h?m(h,c):c<h&&(m(0,c),m(h,l)),i.bindVAO(null)}};function W(e,t,r){const n=e.allocateHead();K(t,r,e.view,n)}function K(e,t,r,n){U(e.modelOrigin,t,r.modelOriginHi,r.modelOriginLo,n),r.model.copyFrom(n,e.model,t),r.modelNormal.copyFrom(n,e.modelNormal,t),e.color&&r.color&&r.color.copyFrom(n,e.color,t),e.objectAndLayerIdColor&&r.objectAndLayerIdColor&&r.objectAndLayerIdColor.copyFrom(n,e.objectAndLayerIdColor,t),e.featureAttribute&&r.featureAttribute&&r.featureAttribute.copyFrom(n,e.featureAttribute,t)}function Y(e){let t=y().vec3f(S.INSTANCEMODELORIGINHI).vec3f(S.INSTANCEMODELORIGINLO).mat3f(S.INSTANCEMODEL).mat3f(S.INSTANCEMODELNORMAL);return null!=e&&e.includes("featureAttribute")&&(t=t.vec4f(S.INSTANCEFEATUREATTRIBUTE)),null!=e&&e.includes("color")&&(t=t.vec4u8(S.INSTANCECOLOR)),null!=e&&e.includes("objectAndLayerIdColor")&&(t=t.vec4u8(S.INSTANCEOBJECTANDLAYERIDCOLOR)),t}e([l({constructOnly:!0})],k.prototype,"symbol",void 0),e([l({constructOnly:!0})],k.prototype,"optionalFields",void 0),e([l({constructOnly:!0})],k.prototype,"metadata",void 0),e([l({constructOnly:!0})],k.prototype,"shaderTransformation",void 0),e([l()],k.prototype,"_instanceData",void 0),e([l()],k.prototype,"_cycleStartIndex",void 0),e([l({readOnly:!0})],k.prototype,"_enableLevelSelection",null),e([l()],k.prototype,"_updateCyclesWithStaticCamera",void 0),e([l({readOnly:!0})],k.prototype,"running",null),k=e([c("esri.views.3d.webgl-engine.lib.lodRendering.LodRenderer")],k);const J=p(),Q=f(),Z=h(),$=p(),X=p(),ee=[_(1,0,1,1),_(0,0,1,1),_(0,1,0,1),_(1,1,0,1),_(1,0,0,1)],te=new F;export{k as LodRenderer};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{unique as e}from"../../../../../core/arrayUtils.js";import{estimateNumberArrayMemory as t,baseTypedArrayMemory as r}from"../../../../../core/memoryEstimations.js";import{newIntersectorResult as s}from"../Intersector.js";import{IntersectorType as n,StoreResults as i}from"../IntersectorInterfaces.js";import{VertexAttribute as o}from"../VertexAttribute.js";import{LodTarget as u}from"./Intersector.js";class m{constructor(e,t,r,s){this.material=e,this.bufferWriter=e.createBufferWriter(),this.vertexBufferLayout=this.bufferWriter.vertexBufferLayout,this.buffer=t,this.elementCount=r,this.boundingInfo=s}get numTriangles(){return this.elementCount/3}get numVertices(){return this.elementCount}computeUsedMemory(){return this.buffer.byteLength+r}getRenderGeometry(){return this}intersect(e,t,r,s,n,i,o,u){const m=this.bufferWriter,a=this.buffer;m.intersect(a,this.material.parameters,null,e,r,s,((r,s,m,a,l)=>c(r,s,m,l,e,t,i,o,n,u)))}}class a{constructor(e){this.engineGeometry=e}get material(){return this.engineGeometry.material}get numVertices(){return this.engineGeometry.attributes.get(o.POSITION).indices.length}get numTriangles(){return this.engineGeometry.indexCount/3}get boundingInfo(){return this.engineGeometry.boundingInfo}computeUsedMemory(){return Array.from(this.engineGeometry.attributes.values()).reduce(((e,r)=>e+t(r.data,r.indices)),0)}getRenderGeometry(){const e=this.material,t=this.engineGeometry,r=t.attributes,s=t.boundingInfo,n=e.createBufferWriter(),i=n.vertexBufferLayout,o=n.elementCount(r),u=i.createBuffer(o);return n.write(null,null,r,null,u,0),new m(e,u.buffer,o,s)}intersect(e,t,r,s,n,i,o,u){const m=this.engineGeometry;this.material.intersect(m,e.transform.transform,e,r,s,((r,s,m,a,l)=>c(r,s,m,l,e,t,i,o,n,u)))}}function c(e,t,r,o,m,a,c,l,f,h){if(e<0)return;if(a&&!a(m.rayBegin,m.rayEnd,e))return;const g=new u(c.layerViewUid,c.graphicUid(f),r,l,h);if((null==m.results.min.drapedLayerOrder||o>=m.results.min.drapedLayerOrder)&&(null==m.results.min.dist||e<m.results.min.dist)&&m.results.min.set(n.LOD,g,e,t,m.transform.transform,o),m.options.store!==i.MIN&&(null==m.results.max.drapedLayerOrder||o>=m.results.max.drapedLayerOrder)&&(null==m.results.max.dist||e>m.results.max.dist)&&m.results.max.set(n.LOD,g,e,t,m.transform.transform,o),m.options.store===i.ALL){const r=s(m.results.min.ray);r.set(n.LOD,g,e,t,m.transform.transform,o),m.results.all.push(r)}}class l{constructor(e,t=null){this.geometry=e,this.textures=t}get material(){return this.geometry.material}get numTriangles(){return this.geometry.numTriangles}}class f{constructor(t,r,s){this.components=t,this.minScreenSpaceRadius=r,this.pivotOffset=s;const n=e(this.components.map((e=>e.geometry)));this.numVertices=n.reduce(((e,t)=>e+t.numVertices),0)}}class h{constructor(e){this.levels=e,this.levels.sort(((e,t)=>e.minScreenSpaceRadius===t.minScreenSpaceRadius?e.numVertices-t.numVertices:e.minScreenSpaceRadius-t.minScreenSpaceRadius))}getMaterials(){const t=[];return this.levels.forEach((e=>e.components.forEach((e=>t.push(e.geometry.material))))),e(t)}getTextures(){const t=new Array;return this.levels.forEach((e=>e.components.forEach((e=>{null!=e.textures&&t.push(...e.textures)})))),e(t)}getGeometries(){const t=new Array;return this.levels.forEach((e=>e.components.forEach((e=>{t.push(e.geometry)})))),e(t)}getEngineGeometries(){return this.getGeometries().map((e=>e.engineGeometry)).filter((e=>null!=e))}computeUsedMemory(){const e=this.getGeometries(),t=this.getTextures(),r=e.reduce(((e,t)=>e+t.computeUsedMemory()),0);return t.reduce(((e,t)=>e+t.usedMemory),0)+r}}export{a as LodComponentEngineGeometry,m as LodComponentRenderGeometry,l as LodComponentResources,f as LodLevelResources,h as LodResources};
5
+ import{unique as e}from"../../../../../core/arrayUtils.js";import{estimateNumberArrayMemory as t,baseTypedArrayMemory as r}from"../../../../../core/memoryEstimations.js";import{StoreResults as s}from"../IntersectorInterfaces.js";import{IntersectorResult as n}from"../IntersectorResult.js";import{IntersectorType as i}from"../IntersectorType.js";import{VertexAttribute as o}from"../VertexAttribute.js";import{LodTarget as u}from"./Intersector.js";class m{constructor(e,t,r,s){this.material=e,this.bufferWriter=e.createBufferWriter(),this.vertexBufferLayout=this.bufferWriter.vertexBufferLayout,this.buffer=t,this.elementCount=r,this.boundingInfo=s}get numTriangles(){return this.elementCount/3}get numVertices(){return this.elementCount}computeUsedMemory(){return this.buffer.byteLength+r}getRenderGeometry(){return this}intersect(e,t,r,s,n,i,o,u){const m=this.bufferWriter,a=this.buffer;m.intersect(a,this.material.parameters,null,e,r,s,((r,s,m)=>c(r,s,m,e,t,i,o,n,u)))}}class a{constructor(e){this.engineGeometry=e}get material(){return this.engineGeometry.material}get numVertices(){return this.engineGeometry.attributes.get(o.POSITION).indices.length}get numTriangles(){return this.engineGeometry.indexCount/3}get boundingInfo(){return this.engineGeometry.boundingInfo}computeUsedMemory(){return Array.from(this.engineGeometry.attributes.values()).reduce(((e,r)=>e+t(r.data,r.indices)),0)}getRenderGeometry(){const e=this.material,t=this.engineGeometry,r=t.attributes,s=t.boundingInfo,n=e.createBufferWriter(),i=n.vertexBufferLayout,o=n.elementCount(r),u=i.createBuffer(o);return n.write(null,null,r,null,u,0),new m(e,u.buffer,o,s)}intersect(e,t,r,s,n,i,o,u){const m=this.engineGeometry;this.material.intersect(m,e.transform.transform,e,r,s,((r,s,m)=>c(r,s,m,e,t,i,o,n,u)))}}function c(e,t,r,o,m,a,c,l,f){if(e<0)return;if(m&&!m(o.rayBegin,o.rayEnd,e))return;const h=new u(a.layerViewUid,a.graphicUid(l),r,c,f);if((null==o.results.min.distance||e<o.results.min.distance)&&o.results.min.set(i.LOD,h,e,t,o.transform.transform),(null==o.results.max.distance||e>o.results.max.distance)&&o.results.max.set(i.LOD,h,e,t,o.transform.transform),o.options.store===s.ALL){const r=new n(o.results.min.ray);r.set(i.LOD,h,e,t,o.transform.transform),o.results.all.push(r)}}class l{constructor(e,t=null){this.geometry=e,this.textures=t}get material(){return this.geometry.material}get numTriangles(){return this.geometry.numTriangles}}class f{constructor(t,r,s){this.components=t,this.minScreenSpaceRadius=r,this.pivotOffset=s;const n=e(this.components.map((e=>e.geometry)));this.numVertices=n.reduce(((e,t)=>e+t.numVertices),0)}}class h{constructor(e){this.levels=e,this.levels.sort(((e,t)=>e.minScreenSpaceRadius===t.minScreenSpaceRadius?e.numVertices-t.numVertices:e.minScreenSpaceRadius-t.minScreenSpaceRadius))}getMaterials(){const t=[];return this.levels.forEach((e=>e.components.forEach((e=>t.push(e.geometry.material))))),e(t)}getTextures(){const t=new Array;return this.levels.forEach((e=>e.components.forEach((e=>{null!=e.textures&&t.push(...e.textures)})))),e(t)}getGeometries(){const t=new Array;return this.levels.forEach((e=>e.components.forEach((e=>{t.push(e.geometry)})))),e(t)}getEngineGeometries(){return this.getGeometries().map((e=>e.engineGeometry)).filter((e=>null!=e))}computeUsedMemory(){const e=this.getGeometries(),t=this.getTextures(),r=e.reduce(((e,t)=>e+t.computeUsedMemory()),0);return t.reduce(((e,t)=>e+t.usedMemory),0)+r}}export{a as LodComponentEngineGeometry,m as LodComponentRenderGeometry,l as LodComponentResources,f as LodLevelResources,h as LodResources};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{clamp as t}from"../../../../core/mathUtils.js";import{i as n,c as o,v as r}from"../../../../chunks/vec32.js";import{create as e}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{add as i,elementwiseProduct as s,scalarProduct as c}from"../lib/LongVectorMath.js";import{MainLight as f,FillLight as h,AmbientLight as a,SphericalHarmonicsAmbientLight as g}from"./Lightsources.js";function u(t){return(t+1)*(t+1)}function l(n){return t(Math.floor(Math.sqrt(n)-1),0,2)}function m(t,n,o){const r=t[0],e=t[1],i=t[2],s=o||[];return s.length=u(n),n>=0&&(s[0]=.28209479177),n>=1&&(s[1]=.4886025119*r,s[2]=.4886025119*i,s[3]=.4886025119*e),n>=2&&(s[4]=1.09254843059*r*e,s[5]=1.09254843059*e*i,s[6]=.31539156525*(3*i*i-1),s[7]=1.09254843059*r*i,s[8]=.54627421529*(r*r-e*e)),s}function p(t,n){const o=u(t),r=n||{r:[],g:[],b:[]};r.r.length=r.g.length=r.b.length=o;for(let e=0;e<o;e++)r.r[e]=r.g[e]=r.b[e]=0;return r}function b(t,n){const o=l(n.r.length);for(const e of t)r(P,e.direction),m(P,o,v),s(v,w),c(v,e.intensity[0],I),i(n.r,I),c(v,e.intensity[1],I),i(n.g,I),c(v,e.intensity[2],I),i(n.b,I);return n}function y(t,n){m(P,0,v);for(const o of t)n.r[0]+=v[0]*w[0]*o.intensity[0]*4*Math.PI,n.g[0]+=v[0]*w[0]*o.intensity[1]*4*Math.PI,n.b[0]+=v[0]*w[0]*o.intensity[2]*4*Math.PI;return n}function M(t,r,e,s){p(r,s),n(e.intensity,0,0,0);let c=!1;const u=S,l=d,m=j;u.length=0,l.length=0,m.length=0;for(const n of t)n instanceof f&&!c?(o(e.direction,n.direction),o(e.intensity,n.intensity),e.specularStrength=n.specularStrength,e.environmentStrength=n.environmentStrength,e.castShadows=n.castShadows,c=!0):n instanceof f||n instanceof h?u.push(n):n instanceof a?l.push(n):n instanceof g&&m.push(n);b(u,s),y(l,s);for(const n of m)i(s.r,n.r),i(s.g,n.g),i(s.b,n.b)}const S=[],d=[],j=[],v=[0],I=[0],P=e(),w=[3.141593,2.094395,2.094395,2.094395,.785398,.785398,.785398,.785398,.785398];export{M as combineLights,m as computeCoefficients,p as initSHCoefficients,u as numberOfCoefficients,l as orderFromNumberOfCoefficients,y as projectAmbientLights,b as projectFillLights};
5
+ import{clamp as t}from"../../../../core/mathUtils.js";import{i as n,c as o,u as r}from"../../../../chunks/vec32.js";import{create as e}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{add as i,elementwiseProduct as s,scalarProduct as c}from"../lib/LongVectorMath.js";import{MainLight as f,FillLight as h,AmbientLight as a,SphericalHarmonicsAmbientLight as g}from"./Lightsources.js";function u(t){return(t+1)*(t+1)}function l(n){return t(Math.floor(Math.sqrt(n)-1),0,2)}function m(t,n,o){const r=t[0],e=t[1],i=t[2],s=o||[];return s.length=u(n),n>=0&&(s[0]=.28209479177),n>=1&&(s[1]=.4886025119*r,s[2]=.4886025119*i,s[3]=.4886025119*e),n>=2&&(s[4]=1.09254843059*r*e,s[5]=1.09254843059*e*i,s[6]=.31539156525*(3*i*i-1),s[7]=1.09254843059*r*i,s[8]=.54627421529*(r*r-e*e)),s}function p(t,n){const o=u(t),r=n||{r:[],g:[],b:[]};r.r.length=r.g.length=r.b.length=o;for(let e=0;e<o;e++)r.r[e]=r.g[e]=r.b[e]=0;return r}function b(t,n){const o=l(n.r.length);for(const e of t)r(P,e.direction),m(P,o,v),s(v,w),c(v,e.intensity[0],I),i(n.r,I),c(v,e.intensity[1],I),i(n.g,I),c(v,e.intensity[2],I),i(n.b,I);return n}function y(t,n){m(P,0,v);for(const o of t)n.r[0]+=v[0]*w[0]*o.intensity[0]*4*Math.PI,n.g[0]+=v[0]*w[0]*o.intensity[1]*4*Math.PI,n.b[0]+=v[0]*w[0]*o.intensity[2]*4*Math.PI;return n}function M(t,r,e,s){p(r,s),n(e.intensity,0,0,0);let c=!1;const u=S,l=d,m=j;u.length=0,l.length=0,m.length=0;for(const n of t)n instanceof f&&!c?(o(e.direction,n.direction),o(e.intensity,n.intensity),e.specularStrength=n.specularStrength,e.environmentStrength=n.environmentStrength,e.castShadows=n.castShadows,c=!0):n instanceof f||n instanceof h?u.push(n):n instanceof a?l.push(n):n instanceof g&&m.push(n);b(u,s),y(l,s);for(const n of m)i(s.r,n.r),i(s.g,n.g),i(s.b,n.b)}const S=[],d=[],j=[],v=[0],I=[0],P=e(),w=[3.141593,2.094395,2.094395,2.094395,.785398,.785398,.785398,.785398,.785398];export{M as combineLights,m as computeCoefficients,p as initSHCoefficients,u as numberOfCoefficients,l as orderFromNumberOfCoefficients,y as projectAmbientLights,b as projectFillLights};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{a as e}from"../../../../chunks/vec32.js";import{create as t}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{BufferViewVec3f as r}from"../../../../geometry/support/buffer/BufferView.js";import{intersectRenderGeometryTriangles as o}from"../lib/RayIntersections.js";import{VertexAttribute as i}from"../lib/VertexAttribute.js";import{writeDefaultAttributes as s}from"./internal/bufferWriterUtils.js";class f{constructor(e){this.vertexBufferLayout=e}elementCount(e){return e.get(i.POSITION).indices.length}write(e,t,r,o,i,f){return s(r,o,this.vertexBufferLayout,e,t,i,f)}intersect(t,s,f,n,c,m,l){const a=this.vertexBufferLayout.createView(t).getField(i.POSITION,r);if(null==a)return;const p=e(u,m,c),y=0,b=a.count/3,d=n.options.normalRequired,j=(e,t,r)=>{l(e,r,t,!1)};o(c,p,y,b,a.typedBuffer,a.typedBufferStride,d,j)}}const u=t();export{f as DefaultBufferWriter};
5
+ import{a as e}from"../../../../chunks/vec32.js";import{create as t}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{BufferViewVec3f as r}from"../../../../geometry/support/buffer/BufferView.js";import{intersectRenderGeometryTriangles as o}from"../lib/RayIntersections.js";import{VertexAttribute as i}from"../lib/VertexAttribute.js";import{writeDefaultAttributes as s}from"./internal/bufferWriterUtils.js";class f{constructor(e){this.vertexBufferLayout=e}elementCount(e){return e.get(i.POSITION).indices.length}write(e,t,r,o,i,f){return s(r,o,this.vertexBufferLayout,e,t,i,f)}intersect(t,s,f,n,c,m,l){const a=this.vertexBufferLayout.createView(t).getField(i.POSITION,r);if(null==a)return;const p=e(u,m,c),y=0,b=a.count/3,d=n.options.normalRequired,j=(e,t,r)=>{l(e,r,t)};o(c,p,y,b,a.typedBuffer,a.typedBufferStride,d,j)}}const u=t();export{f as DefaultBufferWriter};