@arcgis/core 5.0.0-next.44 → 5.0.0-next.46

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 (303) hide show
  1. package/assets/esri/core/workers/RemoteClient.js +1 -1
  2. package/assets/esri/core/workers/chunks/063045ac5553e91c0c4c.js +1 -0
  3. package/assets/esri/core/workers/chunks/{20ad34f9d45c64392022.js → 08c1ea29678da27136f3.js} +1 -1
  4. package/assets/esri/core/workers/chunks/{5dc2f2e28c30386efadf.js → 10094eb2b94e98dd4a8a.js} +1 -1
  5. package/assets/esri/core/workers/chunks/169be08394c5e7703628.js +1 -0
  6. package/assets/esri/core/workers/chunks/1a6f3531ef3d671e0289.js +1 -0
  7. package/assets/esri/core/workers/chunks/{b809d499ff050976d9ed.js → 1c58064ea80e6a4a4a3b.js} +1 -1
  8. package/assets/esri/core/workers/chunks/1c816aff8613d1e4bf38.js +1 -0
  9. package/assets/esri/core/workers/chunks/{ee67c8a7c1f8b482cd99.js → 1ced78750c61600b2d4e.js} +1 -1
  10. package/assets/esri/core/workers/chunks/{98175b454e807b1a3c5f.js → 1e152a34e368bd810a0f.js} +1 -1
  11. package/assets/esri/core/workers/chunks/1e17ad6cdffa5016a3db.js +1 -0
  12. package/assets/esri/core/workers/chunks/1e2d42e9984ed3437ba2.js +1 -0
  13. package/assets/esri/core/workers/chunks/2008b22f76071a2dde4e.js +1 -0
  14. package/assets/esri/core/workers/chunks/2107c93d1fe87f3b8dfa.js +1 -0
  15. package/assets/esri/core/workers/chunks/2209550b6510e25da375.js +1 -0
  16. package/assets/esri/core/workers/chunks/229e1ed4282005aa0b83.js +1 -0
  17. package/assets/esri/core/workers/chunks/22b8eaa6afab0e5ffc47.js +1 -0
  18. package/assets/esri/core/workers/chunks/{1c0fb4795a52204882a8.js → 2550d2ba935cfdf30236.js} +1 -1
  19. package/assets/esri/core/workers/chunks/{49e6219dd08cb6c27023.js → 273ac1066095d63d6a6f.js} +1 -1
  20. package/assets/esri/core/workers/chunks/2e2867bc66c94aba7dc7.js +1 -0
  21. package/assets/esri/core/workers/chunks/{cda5c95fd49b8901f7d4.js → 3298e96d3f2e49e338d2.js} +1 -1
  22. package/assets/esri/core/workers/chunks/34613b288cf174983f8b.js +1 -0
  23. package/assets/esri/core/workers/chunks/{e5baa30944061418cb13.js → 35f086a2ae0585348ae6.js} +1 -1
  24. package/assets/esri/core/workers/chunks/{f441fc74451330384fb0.js → 37ea150dec5e491f691e.js} +1 -1
  25. package/assets/esri/core/workers/chunks/3c94db7ecdcd38eeb1b1.js +1 -0
  26. package/assets/esri/core/workers/chunks/3f7749f06ae54a4437d9.js +1 -0
  27. package/assets/esri/core/workers/chunks/40a722933af28823953b.js +1 -0
  28. package/assets/esri/core/workers/chunks/{7aa730e5ac7b268e3c98.js → 424daef7b5dec1b99aba.js} +1 -1
  29. package/assets/esri/core/workers/chunks/456684b1c1417ed0e611.js +1 -0
  30. package/assets/esri/core/workers/chunks/{d14e75b160aa432233c6.js → 461093ce28ceadd7853d.js} +1 -1
  31. package/assets/esri/core/workers/chunks/4a48b8ec5f3f2fd139b5.js +1 -0
  32. package/assets/esri/core/workers/chunks/4b084f985bc4100e7aec.js +1 -0
  33. package/assets/esri/core/workers/chunks/4b1de1fcd13677b615a8.js +1 -0
  34. package/assets/esri/core/workers/chunks/{31186e83fe009aa0fd36.js → 4d933de84afb2e3b7d18.js} +1 -1
  35. package/assets/esri/core/workers/chunks/{83aa39fbb1fad3b9d143.js → 4ff771942531fb2755c4.js} +1 -1
  36. package/assets/esri/core/workers/chunks/{e0017c6739d2532793e6.js → 513a4ef960e27500f986.js} +1 -1
  37. package/assets/esri/core/workers/chunks/56b693baa376bb990925.js +1 -0
  38. package/assets/esri/core/workers/chunks/{1d4ea8db272655c0608c.js → 57fd5e1260269002d18a.js} +1 -1
  39. package/assets/esri/core/workers/chunks/5fe40bb0e9ab333f6854.js +1 -0
  40. package/assets/esri/core/workers/chunks/{b56c07c0b43cb1999070.js → 60362c5651ef41fa7e5f.js} +1 -1
  41. package/assets/esri/core/workers/chunks/{e8a9971c8354569cb81d.js → 609919428305d8c8c243.js} +1 -1
  42. package/assets/esri/core/workers/chunks/{ab88577987cf2fe1cb32.js → 61373d2fa7e7638d3395.js} +1 -1
  43. package/assets/esri/core/workers/chunks/6202922b1c2637e9aaa5.js +1 -0
  44. package/assets/esri/core/workers/chunks/633368ae6fbb46373328.js +1 -0
  45. package/assets/esri/core/workers/chunks/6d702cb26cef46a76963.js +1 -0
  46. package/assets/esri/core/workers/chunks/{35272810c2ed04eb403d.js → 6f3943bebe2d5f4994f7.js} +1 -1
  47. package/assets/esri/core/workers/chunks/708aba69a1870ea41a61.js +1 -0
  48. package/assets/esri/core/workers/chunks/{7ba13b52fce1060fbb2a.js → 7147fc7502b385b302b2.js} +1 -1
  49. package/assets/esri/core/workers/chunks/{9ba8a2e1c0fb4e1efc7c.js → 7364fb5e99933533890d.js} +1 -1
  50. package/assets/esri/core/workers/chunks/74b1028e95f7cfff387b.js +1 -0
  51. package/assets/esri/core/workers/chunks/78fccea3445fb2f9120a.js +1 -0
  52. package/assets/esri/core/workers/chunks/7ba31425caa404f86424.js +1 -0
  53. package/assets/esri/core/workers/chunks/{040f3d8e1099c4843390.js → 81a60dfa600b690098f9.js} +1 -1
  54. package/assets/esri/core/workers/chunks/833fd2bc42c5cb459084.js +1 -0
  55. package/assets/esri/core/workers/chunks/{75643711d9585ee26a15.js → 83c8e5a92d8d6193cb32.js} +1 -1
  56. package/assets/esri/core/workers/chunks/{e537e1d37f3fcb14fce2.js → 870022661376442411e4.js} +1 -1
  57. package/assets/esri/core/workers/chunks/898ab7db220e81e921c6.js +1 -0
  58. package/assets/esri/core/workers/chunks/{31b074ae2162a3508d2a.js → 8b578ffc3a83089aa782.js} +1 -1
  59. package/assets/esri/core/workers/chunks/{48c8ef4170e803a564d6.js → 8b75861196d1ce5cba63.js} +1 -1
  60. package/assets/esri/core/workers/chunks/8be61e13530fd0dc2fd1.js +1 -0
  61. package/assets/esri/core/workers/chunks/90b8ccee883738917a6d.js +1 -0
  62. package/assets/esri/core/workers/chunks/90bc9c299ae0e8b8b5e5.js +1 -0
  63. package/assets/esri/core/workers/chunks/91d9ade78854f40a962d.js +1 -0
  64. package/assets/esri/core/workers/chunks/{74881340e040bfd0580f.js → 934bc1028b287f8df4aa.js} +1 -1
  65. package/assets/esri/core/workers/chunks/96055de47831e59a28bf.js +1 -0
  66. package/assets/esri/core/workers/chunks/963ba863e0f87abfca25.js +1 -0
  67. package/assets/esri/core/workers/chunks/9aa8d60483ad905fe13b.js +1 -0
  68. package/assets/esri/core/workers/chunks/9fed9946241bb2a5cfa4.js +1 -0
  69. package/assets/esri/core/workers/chunks/a2662e98857f0abf8e82.js +1 -0
  70. package/assets/esri/core/workers/chunks/a5a9b0a35849b9f2e86d.js +1 -0
  71. package/assets/esri/core/workers/chunks/a60006c9ccf6817fc0d2.js +1 -0
  72. package/assets/esri/core/workers/chunks/a627b7eb94b7fca33210.js +1 -0
  73. package/assets/esri/core/workers/chunks/a651dc3b8f1fc1ab34cc.js +1 -0
  74. package/assets/esri/core/workers/chunks/aab93e885b6c7c6aa76e.js +316 -0
  75. package/assets/esri/core/workers/chunks/adfe28c1c1619cdd3ca1.js +1019 -0
  76. package/assets/esri/core/workers/chunks/b88dc7d8ae105747e6a4.js +1 -0
  77. package/assets/esri/core/workers/chunks/b90c786dd474ea1a409c.js +1 -0
  78. package/assets/esri/core/workers/chunks/b92e9e5df8154a128982.js +1 -0
  79. package/assets/esri/core/workers/chunks/{9a855a10798348a21bab.js → bff814d34b38ec80c44d.js} +1 -1
  80. package/assets/esri/core/workers/chunks/c36d699a75b6e8fb93eb.js +1 -0
  81. package/assets/esri/core/workers/chunks/c50fdf723f2d4316862e.js +1 -0
  82. package/assets/esri/core/workers/chunks/{9461cc37ab3397265270.js → c5e8ff4721b15ac3c6eb.js} +1 -1
  83. package/assets/esri/core/workers/chunks/{4cda42b94e9cb58dd372.js → ca61077e0a598654f33f.js} +1 -1
  84. package/assets/esri/core/workers/chunks/{61a9ffd4cf07d8bb7a9b.js → ca81be5bdb88ef557bf3.js} +1 -1
  85. package/assets/esri/core/workers/chunks/{ca1c65eb7f5900c60170.js → cd8fec3500e6503ae020.js} +1 -1
  86. package/assets/esri/core/workers/chunks/ce90e8489143228262e7.js +1 -0
  87. package/assets/esri/core/workers/chunks/d0320ca67abca4f8b0d2.js +1 -0
  88. package/assets/esri/core/workers/chunks/{4b6a44c6265c8959abd8.js → d3db7244fac7398cc700.js} +1 -1
  89. package/assets/esri/core/workers/chunks/{19820cddba13a3585c0b.js → d561624ddb9388732b25.js} +1 -1
  90. package/assets/esri/core/workers/chunks/d65ca3b8fccae8c3c3fa.js +1 -0
  91. package/assets/esri/core/workers/chunks/{630eba99f48ea79a9560.js → d705410c369bd03b1875.js} +1 -1
  92. package/assets/esri/core/workers/chunks/{9c7682b300b877f60095.js → d76513a6260d9ec4ea25.js} +1 -1
  93. package/assets/esri/core/workers/chunks/{7c08c0824ad354177787.js → d7878fba02814adaf19f.js} +1 -1
  94. package/assets/esri/core/workers/chunks/d82e17522ed946c2d809.js +1 -0
  95. package/assets/esri/core/workers/chunks/d8dc130ea559be1f68c6.js +1 -0
  96. package/assets/esri/core/workers/chunks/{768ae52b4e5c3e571ef5.js → dc29cb16704e2e4d0a46.js} +1 -1
  97. package/assets/esri/core/workers/chunks/e8c2e2fbe9cef4c8a8c6.js +1 -0
  98. package/assets/esri/core/workers/chunks/{3f33708eb39c7169a226.js → f2ba50eb29f93df885d6.js} +1 -1
  99. package/assets/esri/core/workers/chunks/{6e5d41f51572e3e7cf92.js → f7163048146ddaedfc36.js} +1 -1
  100. package/assets/esri/core/workers/chunks/fdaa10a588db394e2f65.js +1 -0
  101. package/chunks/GaussianSplat.glsl.js +2 -2
  102. package/chunks/Laserlines.glsl.js +1 -1
  103. package/chunks/boundedPlane.js +1 -1
  104. package/chunks/cameraUtilsSpherical.js +1 -1
  105. package/chunks/vec32.js +1 -1
  106. package/config.js +1 -1
  107. package/core/libs/gl-matrix-2/math/quat.js +1 -1
  108. package/core/libs/gl-matrix-2/math/vec3.js +1 -1
  109. package/core/urlUtils.d.ts +1 -0
  110. package/core/workers/workerFactory.js +1 -1
  111. package/geometry/FlatGeometry.js +1 -1
  112. package/geometry/operators/support/apiConverter.js +1 -1
  113. package/geometry/operators/support/jsonConverter.js +1 -1
  114. package/geometry/support/curves/circleUtils.js +1 -1
  115. package/geometry/support/lineSegment.js +1 -1
  116. package/geometry/support/meshUtils/loadGLTFMesh.js +1 -1
  117. package/geometry/support/meshUtils/merge.js +1 -1
  118. package/geometry/support/sphere.js +1 -1
  119. package/interfaces.d.ts +148 -21
  120. package/kernel.js +1 -1
  121. package/layers/VoxelWasmPerSceneView.js +1 -1
  122. package/layers/orientedImagery/transformations/worldToImage.js +1 -1
  123. package/layers/support/tiles3DUtils.js +1 -1
  124. package/layers/voxel/VoxelVolume.js +1 -1
  125. package/package.json +2 -2
  126. package/rest/print.js +1 -1
  127. package/rest/support/LegendLayer.js +1 -1
  128. package/support/revision.js +1 -1
  129. package/symbols/cim/effects/EffectSuppress.js +1 -1
  130. package/views/2d/interactive/SegmentLabels2D.js +1 -1
  131. package/views/3d/analysis/AreaMeasurement/support/MeasurementData.js +1 -1
  132. package/views/3d/analysis/Dimension/lengthDimensionConstraintUtils.js +1 -1
  133. package/views/3d/analysis/Dimension/lengthDimensionUtils.js +1 -1
  134. package/views/3d/analysis/LineOfSight/LineOfSightController.js +1 -1
  135. package/views/3d/analysis/LineOfSight/LineOfSightIntersectionResult.js +1 -1
  136. package/views/3d/analysis/ShadowCastAnalysisView3D.js +1 -1
  137. package/views/3d/analysis/Slice/sliceToolUtils.js +1 -1
  138. package/views/3d/analysis/Viewshed/ViewshedScaleOrientManipulation.js +1 -1
  139. package/views/3d/analysis/Viewshed/ViewshedSubTool.js +1 -1
  140. package/views/3d/analysis/Viewshed/ViewshedSubVisualization.js +1 -1
  141. package/views/3d/analysis/Viewshed/ViewshedTool.js +1 -1
  142. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillController.js +1 -1
  143. package/views/3d/animation/pointToPoint/Camera.js +1 -1
  144. package/views/3d/camera/constraintUtils/distance.js +1 -1
  145. package/views/3d/camera/constraintUtils/tilt.js +1 -1
  146. package/views/3d/environment/ChapmanAtmosphere.js +1 -1
  147. package/views/3d/environment/CloudsParameters.js +1 -1
  148. package/views/3d/environment/EnvironmentManager.js +1 -1
  149. package/views/3d/environment/MarsAtmosphere.js +1 -1
  150. package/views/3d/glTF/internal/Resource.js +1 -1
  151. package/views/3d/glTF/loader.js +1 -1
  152. package/views/3d/interactive/SegmentLabels3D.js +1 -1
  153. package/views/3d/interactive/editingTools/manipulations/MoveZManipulation.js +1 -1
  154. package/views/3d/interactive/editingTools/media/MediaElementManipulator3D.js +1 -1
  155. package/views/3d/interactive/editingTools/reshape/edgeOffsetUtils.js +1 -1
  156. package/views/3d/interactive/visualElements/MeasurementArrowVisualElement.js +1 -1
  157. package/views/3d/interactive/visualElements/RightAngleQuadVisualElement.js +1 -1
  158. package/views/3d/layers/I3SMeshView3D.js +1 -1
  159. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  160. package/views/3d/layers/graphics/Graphics3DFrustumVisibility.js +1 -1
  161. package/views/3d/layers/graphics/Graphics3DObjectSymbolLayer.js +1 -1
  162. package/views/3d/layers/graphics/ObjectResourceCache.js +1 -1
  163. package/views/3d/layers/graphics/objectResourceUtils.js +1 -1
  164. package/views/3d/layers/graphics/pipeline/rendering/DirectRenderer.js +1 -1
  165. package/views/3d/layers/graphics/pipeline/rendering/RenderCommandContext.js +1 -1
  166. package/views/3d/layers/graphics/pipeline/symbolization/IconSymbolLayerRenderer.js +1 -1
  167. package/views/3d/layers/i3s/I3SMaterialUtil.js +1 -1
  168. package/views/3d/layers/i3s/I3SViewportQueries.js +1 -1
  169. package/views/3d/layers/i3s/PointCloudRenderer.js +1 -1
  170. package/views/3d/layers/support/FeatureTileMeasurements3D.js +1 -1
  171. package/views/3d/layers/support/FeatureTileVisibility3D.js +1 -1
  172. package/views/3d/state/Frustum.js +1 -1
  173. package/views/3d/state/controllers/FovController.js +1 -1
  174. package/views/3d/state/controllers/GamepadKeyboardController.js +1 -1
  175. package/views/3d/state/controllers/momentum/ZoomPlanarMomentumController.js +1 -1
  176. package/views/3d/support/FrustumExtentIntersection.js +1 -1
  177. package/views/3d/support/cameraUtils.js +1 -1
  178. package/views/3d/support/intersectionUtils.js +1 -1
  179. package/views/3d/support/orientedBoundingBox.js +1 -1
  180. package/views/3d/support/pointsOfInterest/CameraOnSurface.js +1 -1
  181. package/views/3d/support/pointsOfInterest/CenterOnSurface.js +1 -1
  182. package/views/3d/support/pointsOfInterest/Focus.js +1 -1
  183. package/views/3d/support/viewpointUtils.js +1 -1
  184. package/views/3d/terrain/OverlayManager.js +1 -1
  185. package/views/3d/terrain/PatchRenderData.js +1 -1
  186. package/views/3d/terrain/SphericalPatch.js +1 -1
  187. package/views/3d/terrain/Tile.js +1 -1
  188. package/views/3d/webgl/RenderCamera.js +1 -1
  189. package/views/3d/webgl-engine/core/FBOCache.js +1 -1
  190. package/views/3d/webgl-engine/effects/haze/Haze.js +1 -1
  191. package/views/3d/webgl-engine/lib/GaussianSplatRenderNode.js +1 -1
  192. package/views/3d/webgl-engine/lib/Object3D.js +1 -1
  193. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  194. package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
  195. package/views/3d/webgl-engine/lib/Viewshed.js +1 -1
  196. package/views/3d/webgl-engine/lib/edgeRendering/edgePreprocessing.js +1 -1
  197. package/views/3d/webgl-engine/lib/geometryDataUtils.js +1 -1
  198. package/views/3d/webgl-engine/lib/triangleIntersectionUtils.js +1 -1
  199. package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
  200. package/views/3d/webgl-engine/materials/HeatmapDensityMaterial.js +1 -1
  201. package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
  202. package/views/3d/webgl-engine/materials/MeasurementArrowMaterial.js +1 -1
  203. package/views/3d/webgl-engine/materials/NativeLineMaterial.js +1 -1
  204. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  205. package/views/3d/webgl-engine/materials/pbrUtils.js +1 -1
  206. package/views/3d/webgl-engine/materials/renderers/MergedBuffer.js +1 -1
  207. package/views/3d/webgl-engine/materials/renderers/PerBufferData.js +1 -1
  208. package/views/3d/webgl-engine/materials/renderers/PerOriginData.js +1 -1
  209. package/views/3d/webgl-engine/materials/renderers/VaoWriter.js +1 -1
  210. package/views/3d/webgl-engine/shaders/GaussianSplatColorTechnique.js +5 -0
  211. package/views/3d/webgl-engine/shaders/GaussianSplatDepthTechnique.js +5 -0
  212. package/views/3d/webgl-engine/shaders/GaussianSplatTechniqueConfiguration.js +1 -1
  213. package/views/3d/webgl-engine/shaders/SphereDepthInterpolate.glsl.js +1 -1
  214. package/views/draw/support/Reshape.js +1 -1
  215. package/views/interactive/GraphicManipulator.js +1 -1
  216. package/views/interactive/coordinateHelper.js +1 -1
  217. package/views/interactive/editGeometry/operations/OffsetEdgeVertex.js +1 -1
  218. package/views/interactive/sketch/constraints.js +1 -1
  219. package/views/interactive/snapping/featureSources/sceneLayerSource/SceneLayerSnappingSourceWorker.js +1 -1
  220. package/views/interactive/snapping/featureSources/sceneLayerSource/sceneLayerSnappingUtils.js +1 -1
  221. package/views/interactive/snapping/hints/LineSnappingHint.js +1 -1
  222. package/views/interactive/tooltip/tooltipCommonUtils.js +1 -1
  223. package/views/navigation/PanSphericalMomentumEstimator.js +1 -1
  224. package/views/support/euclideanAreaMeasurementUtils.js +1 -1
  225. package/views/support/euclideanLengthMeasurementUtils.js +1 -1
  226. package/views/support/geometry3dUtils.js +1 -1
  227. package/widgets/BatchAttributeForm/BatchAttributeFormViewModel.js +1 -1
  228. package/widgets/BatchAttributeForm/css.js +1 -1
  229. package/widgets/BatchAttributeForm/inputs/SingleFeatureInput.d.ts +4 -0
  230. package/widgets/BatchAttributeForm/inputs/SingleFeatureInput.js +5 -0
  231. package/widgets/BatchAttributeForm/inputs/TextElementInput.d.ts +4 -0
  232. package/widgets/BatchAttributeForm/inputs/TextElementInput.js +5 -0
  233. package/widgets/BatchAttributeForm/inputs/support/createBatchFormInputs.js +1 -1
  234. package/widgets/BatchAttributeForm/inputs/support/inputUtils.js +1 -1
  235. package/widgets/BatchAttributeForm/templates/GroupElementTemplate.js +1 -1
  236. package/widgets/BatchAttributeForm/templates/TextElementTemplate.js +5 -0
  237. package/widgets/BatchAttributeForm/templates/support/createBatchFormTemplate.js +1 -1
  238. package/widgets/BatchAttributeForm/templates/support/hashElementTemplate.js +1 -1
  239. package/widgets/BatchAttributeForm/templates/support/templateUtils.js +1 -1
  240. package/widgets/BatchAttributeForm.js +1 -1
  241. package/widgets/FeatureForm/TextElementInput.d.ts +2 -2
  242. package/widgets/FeatureTable/AttachmentsColumn.js +1 -1
  243. package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
  244. package/widgets/FeatureTable/Grid/Column.js +1 -1
  245. package/widgets/FeatureTable/Grid/EditorColumn.js +1 -1
  246. package/widgets/FeatureTable/Grid/Grid.js +1 -1
  247. package/widgets/FeatureTable/Grid/GridViewModel.js +1 -1
  248. package/widgets/FeatureTable/support/FeatureStore.js +1 -1
  249. package/widgets/PanoramicViewer/PanoramicVideoViewerViewModel.js +1 -1
  250. package/widgets/PanoramicViewer/PanoramicViewerViewModel.js +1 -1
  251. package/widgets/PanoramicViewer/PanoramicZoomManager.js +1 -1
  252. package/widgets/PanoramicViewer/support/PanoramicMedia.js +5 -0
  253. package/widgets/PanoramicViewer/support/PanoramicMediaCollection.js +5 -0
  254. package/widgets/PanoramicViewer/support/PanoramicMediaError.js +5 -0
  255. package/widgets/PanoramicViewer/utils.js +1 -1
  256. package/widgets/PanoramicViewer.js +1 -1
  257. package/widgets/Print/CustomTemplate.js +1 -1
  258. package/widgets/Print/PrintViewModel.js +1 -1
  259. package/widgets/Print/TemplateOptions.js +1 -1
  260. package/widgets/Print.js +1 -1
  261. package/assets/esri/core/workers/chunks/04a0685ee53ef74883aa.js +0 -1
  262. package/assets/esri/core/workers/chunks/1e0e7cef7ef947894bbe.js +0 -1019
  263. package/assets/esri/core/workers/chunks/20988e116f3723228f36.js +0 -1
  264. package/assets/esri/core/workers/chunks/2613e482450b57f2d4f5.js +0 -1
  265. package/assets/esri/core/workers/chunks/274f2b5e6dbc58505142.js +0 -1
  266. package/assets/esri/core/workers/chunks/27dfbe3d903b95d4c67a.js +0 -1
  267. package/assets/esri/core/workers/chunks/28a5a7c6b3d6902146f6.js +0 -1
  268. package/assets/esri/core/workers/chunks/2c4218306747f5d15575.js +0 -1
  269. package/assets/esri/core/workers/chunks/2db7a7607657f1d669f7.js +0 -1
  270. package/assets/esri/core/workers/chunks/3767617c0dfc7d801441.js +0 -1
  271. package/assets/esri/core/workers/chunks/44b6b7418cbf7f778bef.js +0 -1
  272. package/assets/esri/core/workers/chunks/4675ed3ca3e0104d00bf.js +0 -1
  273. package/assets/esri/core/workers/chunks/4df7cc3477bc46fc39af.js +0 -1
  274. package/assets/esri/core/workers/chunks/538ddb267aa328814865.js +0 -1
  275. package/assets/esri/core/workers/chunks/555a0ea44ba77819d493.js +0 -1
  276. package/assets/esri/core/workers/chunks/55818fe7a7aa1e5c8bbd.js +0 -1
  277. package/assets/esri/core/workers/chunks/5f781ef46ce7c4048c2f.js +0 -1
  278. package/assets/esri/core/workers/chunks/60f2de8dd8876bfd715a.js +0 -1
  279. package/assets/esri/core/workers/chunks/679088064420a906aa7f.js +0 -1
  280. package/assets/esri/core/workers/chunks/706423d801fa9cbf2e90.js +0 -1
  281. package/assets/esri/core/workers/chunks/71dd80231ea656a6380c.js +0 -1
  282. package/assets/esri/core/workers/chunks/725819839434c59102f3.js +0 -1
  283. package/assets/esri/core/workers/chunks/72cebf18da5ec5eeb666.js +0 -1
  284. package/assets/esri/core/workers/chunks/768d9b6eaba7bfa18dde.js +0 -1
  285. package/assets/esri/core/workers/chunks/77b45957cfe42523c1c8.js +0 -1
  286. package/assets/esri/core/workers/chunks/852de585a72d902344a6.js +0 -1
  287. package/assets/esri/core/workers/chunks/871dd5e1f016a04b8d98.js +0 -1
  288. package/assets/esri/core/workers/chunks/892c417f5130b003889d.js +0 -1
  289. package/assets/esri/core/workers/chunks/907083c427d7fb4354e9.js +0 -1
  290. package/assets/esri/core/workers/chunks/93c5f097bb7b380bb175.js +0 -1
  291. package/assets/esri/core/workers/chunks/9f0172b83f25ef5f8d40.js +0 -1
  292. package/assets/esri/core/workers/chunks/ae793d814cf32db9fbde.js +0 -1
  293. package/assets/esri/core/workers/chunks/b21cf62652ca772108c8.js +0 -1
  294. package/assets/esri/core/workers/chunks/c5c02ace54fe4ab9214b.js +0 -1
  295. package/assets/esri/core/workers/chunks/c82a974c8448407885e6.js +0 -1
  296. package/assets/esri/core/workers/chunks/d08ee45c501102deea20.js +0 -1
  297. package/assets/esri/core/workers/chunks/d239a4ef60e348cfb05a.js +0 -1
  298. package/assets/esri/core/workers/chunks/da2ba40bc017bff0fe49.js +0 -1
  299. package/assets/esri/core/workers/chunks/dc3a4ad62bc041a4f899.js +0 -1
  300. package/assets/esri/core/workers/chunks/e093e745708f722bc1b9.js +0 -1
  301. package/assets/esri/core/workers/chunks/e501d68a1464805c4b4e.js +0 -1
  302. package/assets/esri/core/workers/chunks/ea3cba01c60d9bc72719.js +0 -316
  303. package/assets/esri/core/workers/chunks/f3c232fc56a29d51196a.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/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{toConst as e}from"../../../core/compilerUtils.js";import{clamp as t}from"../../../core/mathUtils.js";import{abortMaybe as i}from"../../../core/maybe.js";import s from"../../../core/ObjectPool.js";import{e as n,E as r,g as a,j as l,i as o,b as h,d}from"../../../chunks/vec32.js";import{create as u,unitZ as c}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as g}from"../../../geometry/ellipsoidUtils.js";import{create as p,equals as f,rectangleContainsRectangleCyclicalAware as _,rectanglesIntersectCyclicalAware as m,width as y,height as v}from"../../../geometry/support/aaBoundingRect.js";import{Sphere as M}from"../../../geometry/support/sphere.js";import{isGroupLayer as A}from"../../../layers/support/layerUtils.js";import{ElevationBounds as x}from"./ElevationBounds.js";import{ElevationTileAgent as D,isElevationTileAgent as b}from"./ElevationTileAgent.js";import{LayerClasses as L}from"./LayerClass.js";import{MapDataCacheItem as I}from"./MapDataCacheItem.js";import{MapTileAgent as j,isMapTileAgent as T}from"./MapTileAgent.js";import{maxPatchTesselation as C}from"./TerrainConst.js";import{isVectorTile as B,isTileTexture as U,isRasterTile as S,isImageWithType as w}from"./TerrainData.js";import{weakAssert as E,isBlendableLayerView as P,oppositeCorner as O,internalAssert as R,enableTerrainInternalChecks as q,neighborEdgeIndices as V,oppositeEdge as N,neighborCornerIndices as G,almostEquals as k,enableWaterproofTests as z,isNorth as F,isSouth as W,isWest as H,isEast as J,isWestCorner as X,isNorthCorner as Y}from"./terrainUtils.js";import{tileAgentDone as $}from"./TileAgent.js";import{TilePerLayerInfo as Q}from"./TilePerLayerInfo.js";import{fallsWithinLayerView as K}from"./tileUtils.js";const Z=.1;class ee{constructor(){this._lij=[0,0,0],this._children=[null,null,null,null],this._pendingUpdates=0,this._dirty=!0,this._previouslyRendered=!1,this.extent=p(),this._elevationBoundsMin=NaN,this._elevationBoundsMax=0,this.layerInfo=[[],[]],this.extentInRadians=p(),this.centerAtSeaLevel=u(),this._center=[u(),new M,u()],this.up=c(),this._withinClippingArea=!0,this._intersectsClippingArea=!0,this._maxTesselation=0,this._usedMemory=0,this._rasterTileMemory=0,this._vectorTileMemory=0,this._mapDataRefCount=0,this.screenDepth=0,this.renderOrder=0,this._edgeLen=0,this._edgeLen2=0,this._curvatureHeight=0,this.onCompressionFinished=()=>{this.setPendingUpdate(16),this.setMemoryDirty()},this.extentMidX=0,this.extentMidY=0,this.distanceToPOI=-1,this._lastPOI=u(),this.maxLevelDeltaNeighborCount=0,this.unmergableChildCount=0}get lij(){return this._lij}get spatialReference(){return this._surface.spatialReference??this._surface.tilingScheme.spatialReference}get isDisposed(){return null==this._surface}get elevationLevelDelta(){return this._surface.getElevationLevelDelta(this.level)}static prune(){se.prune(0),ne.prune(0),Q.prune()}get _cached(){return!this.leaf&&this._mapDataRefCount<=0}get withinClippingArea(){return this._withinClippingArea}get intersectsClippingArea(){return this._intersectsClippingArea}get clippingArea(){return this._clippingArea}get parent(){return this._parent}get children(){return this._children}get surface(){return this._surface}get elevationBoundsMin(){return this._elevationBoundsMin}get elevationBoundsMax(){return this._elevationBoundsMax}get level(){return this._lij[0]}get key(){return`${this._lij[0]}/${this._lij[1]}/${this._lij[2]}`}get edgeLen(){return this._edgeLen}get radius(){return this._center[1].radius}get visible(){return this._dirty&&this.computeVisibility(),this._visible}get frustumVisibility(){return this._dirty&&this.computeVisibility(),this._frustumVisibility}computeVisibility(){this._dirty=!1;const e=this.parent,t=e?.frustumVisibility??1;this._frustumVisibility=0===t?0:2===t?2:this._calculateFrustumVisibility(this.surface.frustum);const i=2!==this._frustumVisibility&&this._intersectsClippingArea;i!==this._visible&&(this._visible=i,this._surface.emit("tiles-visibility-changed"),this._surface.renderer.setDirty(),this.updateAgentSuspension())}get _loadable(){return this.visible||this._surface.view.state.fixedContentCamera}get rendered(){const e=!!this.renderData;return e!==this._previouslyRendered&&(this._surface.emit("tiles-visibility-changed"),this._previouslyRendered=e,this._surface.renderer.setDirty()),e}init(e,t,i,s,n){this._lij[0]=e,this._lij[1]=t,this._lij[2]=i,this.ellipsoid=g(n.tilingScheme.spatialReference),n.tilingScheme.getExtent(e,t,i,this.extent),n.tilingScheme.convertExtentToRadians(this.extent,this.extentInRadians),this.extentMidX=.5*(this.extent[0]+this.extent[2]),this.extentMidY=.5*(this.extent[1]+this.extent[3]),this._withinClippingArea=!0,this._intersectsClippingArea=!0,this._clippingArea=null,this._mapDataRefCount=0,n.upsampleMapCache.pop(this.key),this._edgeLen=0,this._edgeLen2=0,this._center[1].radius=0,this.elevationLevel=e,s&&!Number.isNaN(s.elevationBoundsMin)?(this._elevationBoundsMin=s.elevationBoundsMin,this._elevationBoundsMax=s.elevationBoundsMax):(this._elevationBoundsMin=0,this._elevationBoundsMax=0),this._pendingUpdates=0,this.renderData=null,this.screenDepth=0,this._visible=!1,this._previouslyRendered=!1,this._parent=s,this.clearChildren(),this._surface=n,this.updateVisibility(),this.maxLevelDeltaNeighborCount=0,this.unmergableChildCount=0;for(const r of L){const e=n.numLayers(r),t=this.layerInfo[r];for(const i of t)i.release();t.length=e;for(let i=0;i<e;i++)t[i]=Q.acquire(this._surface.upsampleInfoPool),0===r&&this.findElevationBoundsForLayer(i,-1)}this.computeElevationBounds(),this._maxTesselation=Math.min(n.tilingScheme.pixelSize,C)}dispose(){E(!this.renderData,"tile.renderData was not unloaded"),this._surface?.upsampleMapCache.pop(this.key),this.layerInfo.forEach(e=>{e.forEach(e=>e.release()),e.length=0}),this._surface=this._parent=null,this.clearChildren(),this.setMemoryDirty()}refMapData(){++this._mapDataRefCount,this._cached||this._surface.upsampleMapCache.pop(this.key)}unrefMapData(){--this._mapDataRefCount,this._cached&&this.cachedMemory>0&&this._surface.upsampleMapCache.put(this.key,new I(e(this)))}setMemoryDirty(){this._usedMemory=0}get usedMemory(){return this._ensureUsedMemory()+(this._cached?0:this.mapDataMemory)}get cachedMemory(){return this._ensureUsedMemory(),null==this._surface?this.usedMemory:this._cached?this.mapDataMemory:0}get mapDataMemory(){return this._rasterTileMemory+this._vectorTileMemory}get _cpuImageMemorySize(){const e=4,t=this._surface.tilingScheme.pixelSize;return t*t*e}_ensureUsedMemory(){if(this._usedMemory>0)return this._vectorTileMemory=this.layerInfo[1].reduce((e,{data:t})=>e+(B(t)?t.usedMemoryPerReference:0),0),this._usedMemory;this._usedMemory=this._baseUsedMemory,this._rasterTileMemory=0,this._vectorTileMemory=0;for(const{data:e}of this.layerInfo[1])B(e)?this._vectorTileMemory+=e.usedMemoryPerReference:this._rasterTileMemory+=this.getTerrainDataMemory(e);for(const e of this.layerInfo[0])this._usedMemory+=e.data?this._cpuImageMemorySize:0;return this.renderData&&(this._usedMemory+=this.renderData.estimatedGeometryMemoryUsage,this._rasterTileMemory+=this.renderData.texture?.usedMemory??0),this._cached&&this._surface.upsampleMapCache.updateSize(this.key),this._usedMemory}getUsedMemoryForLayer(e,t){const i=this.layerInfo[e][t];return i?.data?1===e?this._cached?0:this.getTerrainDataMemory(i.data):0===e?this._cpuImageMemorySize:0:0}getTerrainDataMemory(e){return U(e)?e.texture.usedMemory:S(e)?e.memoryUsage:B(e)?e.usedMemoryPerReference:w(e)||e instanceof HTMLImageElement?this._cpuImageMemorySize:0}updateScreenDepth(e){const[t,i,s]=this._center[1].center,n=e,r=n[2]*t+n[6]*i+n[10]*s+n[14];this.screenDepth=r<0?0:r/(n[3]*t+n[7]*i+n[11]*s+n[15])}shouldSplit(e,t,i){if(!this.visible)return 0;if(e.frustum&&(!this._intersectsClippingArea||2===this._calculateFrustumVisibility(e.frustum)))return 0;const s=this.level;n(ue,this._center[1].center,t);let d=r(ue),u=ue,c=this._center[1].center;n(ce,this._center[0],t);const g=r(ce);g<d&&(d=g,u=ce,c=this._center[0]),n(ge,this._center[2],t);const p=r(ge);if(p<d&&(d=p,u=ge,c=this._center[2]),this._edgeLen2>d&&s<e.maxLod)return 1;const f=Math.sqrt(d),_=e.fovX*f*2,m=this._edgeLen/_,y=()=>{if(s<e.maxLod)return this.elevationLevel=s,0;const t=s+Math.ceil(-Math.log2(e.relativeWidthLimit/m));return t!==this.elevationLevel?(this.elevationLevel=t,2):0},v=null!=i?i-s:1/0;if(v<=.5)return y();const M=a(this.up,ue),A=this._elevationBoundsMax-this._elevationBoundsMin,x=A/this.edgeLen;if(e.aboveGround&&M>0&&x<.001){if(M/f-Math.sin(this._curvatureHeight/(this.edgeLen*Math.SQRT1_2)*Math.PI)-x>0)return 0}const D=null!=i?3-Math.min(v,2):1;if(m*D<e.relativeWidthLimit||s>=e.maxLod)return y();if(s<7)return 1;l(pe,this.up,M),n(pe,pe,u);const b=r(pe);if(b<=this.radius*this.radius)return 1;l(pe,pe,this.radius/Math.sqrt(b)),o(pe,pe,c),n(pe,t,pe);const L=Math.min(1,(Math.abs(a(pe,this.up))+.5*A+this._curvatureHeight)/h(pe)),I=Z/e.angledSplitBias,j=e.fovY*f*2;return L*(this._edgeLen/j*D)<I*e.relativeHeightLimit?0:1}createChildren(){const e=this._children,t=this.lij[0]+1,i=2*this.lij[1],s=2*this.lij[2];return e[0]=this.surface.createTile(t,i,s,this),e[1]=this.surface.createTile(t,i,s+1,this),e[2]=this.surface.createTile(t,i+1,s,this),e[3]=this.surface.createTile(t,i+1,s+1,this),e}clearChildren(){this._children[0]=this._children[1]=this._children[2]=this._children[3]=null}get loaded(){return this.renderData?.hasGeometry??!1}load(){this.refMapData();for(const e of L)this._createOrUpdateAgents(0,e);this.surface.renderer.loadTile(this)}unload(){this.renderData&&this.unrefMapData(),this.surface.renderer.unloadTile(this);for(const e of L){const t=this.layerInfo[e];for(const e of t)e.loadingAgent&&e.loadingAgent!==$&&(ie(e.loadingAgent),e.loadingAgent=null),e.pendingUpdates=0}this.resetPendingUpdate(8),this.resetPendingUpdate(16),this.resetPendingUpdate(32)}unloadMapData(){const e=this.layerInfo[1];for(const t of e)t.loadingAgent&&t.loadingAgent!==$&&(ie(t.loadingAgent),t.loadingAgent=null),t.pendingUpdates=0,t.invalidateSourceData();this.renderData?.releaseTexture(),this.setMemoryDirty()}updateClippingStatus(e){if(f(e,this._clippingArea))return!1;const t=this._intersectsClippingArea,i=this._withinClippingArea;null!=e?(this._intersectsClippingArea=this.intersectsExtent(e),this._withinClippingArea=this._isWithinExtent(e)):(this._intersectsClippingArea=!0,this._withinClippingArea=!0),this._clippingArea=e,this.updateVisibility();const s=i&&this._withinClippingArea,n=!(i||t||this._withinClippingArea||this._intersectsClippingArea);return!this.renderData||s||n||this.setPendingUpdate(8),!0}updateVisibility(){this._dirty=!0,this._surface.setTileTreeDirty(!1)}getLayerInfo(e,t){return this.layerInfo[t][e]}hasLayerData(e,t){const i=this.layerInfo[t][e];return!(!i?.data||i.dataInvalidated)}get updating(){if(this.hasPendingUpdates)return!0;for(const e of L){const t=this.layerInfo[e];for(const e of t)if(e.loadingAgent&&e.loadingAgent!==$&&e.loadingAgent.updating)return!0}return!1}_isSuspended(e){return!!this.hasPendingUpdate(1)||0!==e&&!this._loadable}get hasPendingUpdates(){return 0!==this._pendingUpdates}hasPendingUpdate(e){return(this._pendingUpdates&e)===e}setPendingUpdate(e){const t=this._pendingUpdates;return this._pendingUpdates|=e,1===e||4===e?this._surface.setTileTreeDirty(!0):this._surface.requestUpdate(),t!==this._pendingUpdates}resetPendingUpdate(e){return!!this.hasPendingUpdate(e)&&(this._pendingUpdates&=~e,!0)}requestLayerData(e,t,s){const n=this.layerInfo[t][e];if(n.waitingAgents.has(s))return console.warn("agent already requested this piece of map data (tile %s, agent tile %s, layer: %d/%d)",this._lij.toString(),s.tile.lij.toString(),t,e),!0;if(n.waitingAgents.push(s),n.data&&!n.dataInvalidated){console.warn("agent requested existing data (tile %s, agent tile %s, layer: %d/%d)",this._lij.toString(),s.tile.lij.toString(),t,e);const i=B(n.data);return s.dataArrived(this,i),!0}if(n.requestPromise)return!0;i(n.requestAbort),n.requestAbort=new AbortController;const r=this._surface.requestTileData(this,e,t,n.requestAbort);if(!r)return n.requestAbort=null,!1;const a=()=>{n.requestPromise===r&&(n.requestPromise=null,n.requestAbort=null)};return n.requestPromise=r,r.then(a,a),!0}get leaf(){return null==this._children[0]}hasLij(e){return this._lij[0]===e[0]&&this._lij[1]===e[1]&&this._lij[2]===e[2]}findByLij(e){if(this.hasLij(e))return this;const t=this._children;if(!t[0])return null;return t[0].findByLij(e)||t[1].findByLij(e)||t[2].findByLij(e)||t[3].findByLij(e)}distanceToSquared(e){return r(n(pe,this._center[1].center,e))}containsPoint(e){const t=this.extent;return e[0]>=t[0]&&e[1]>=t[1]&&e[0]<=t[2]&&e[1]<=t[3]}containsPointXY(e,t){const i=this.extent;return e>=i[0]&&t>=i[1]&&e<=i[2]&&t<=i[3]}unrequestLayerData(e,t,i){const s=this.layerInfo[t][e],n=s.waitingAgents,r=null!=n.removeUnordered(i);E(r,"agent has not requested this piece of map data"),n.length<1&&(s.abortRequest(),this.setMemoryDirty())}dataArrived(e,t,i){const s=B(i),n=this.layerInfo[t][e];n.data=i,n.dataInvalidated=!1,n.waitingAgents.forAll(e=>e.dataArrived(this,s)),n.waitingAgents.clear(),this.setMemoryDirty()}dataMissing(e,t){const i=this.layerInfo[t][e];i.dataMissing=!0,i.waitingAgents.forAll(e=>e.dataMissing()),i.waitingAgents.clear(),this.setMemoryDirty()}updateRenderData(e,t,i){switch(i&&this.forEachLoadedNeighbor(i=>i.updateRenderData(e,t)),e){case 1:return this._updateTexture(t);case 0:return this._updateGeometry()}}_updateTexture(e){this.renderData&&(this.resetPendingUpdate(0===e?16:32),this.setPendingUpdate(0===e?32:16))}_updateGeometry(){this.setPendingUpdate(8);for(const e of this.layerInfo[0])e.pendingUpdates|=8}invalidateLayerData(e,t){this.layerInfo[t][e].invalidateSourceData(),this.restartAgents(t)}computeElevationBounds(){const e=this._elevationBoundsMin,t=this._elevationBoundsMax;let i=1/0,s=-1/0;const n=this.layerInfo[0];let r=!0;for(const a of n)null!=a.elevationBounds&&(i=Math.min(i,a.elevationBounds.minElevation),s=Math.max(s,a.elevationBounds.maxElevation),a.elevationBounds.hasNoDataValues||(r=!1));r&&(i=Math.min(i,0),s=Math.max(s,0)),e===i&&t===s||(this._elevationBoundsMin=i,this._elevationBoundsMax=s,this.updateRadiusAndCenter(),this._surface.setTileTreeDirty(!1))}_updateCenter(){const e=this._elevationBoundsMin,t=this._elevationBoundsMax,i=.5*(e+t),s=this._center;l(pe,this.up,i),o(s[1].center,this.centerAtSeaLevel,pe),l(pe,this.up,e),o(s[0],this.centerAtSeaLevel,pe),l(pe,this.up,t),o(s[2],this.centerAtSeaLevel,pe)}findElevationBoundsForLayer(e,t){const i=this.layerInfo[0][e],s=this.elevationLevelDelta,n=Math.max(this.elevationLevel-s,0),r=i.elevationBounds;if(null!=r&&r.level>=t&&r.level<=n)return;const a=this._surface.layerViewByIndex(e,0);if(!K(this,a))return;const l=re;let o=!1;const h=i.data;if(h&&h.level<=n){const e=i.data;l.minElevation=e.samplerData.data.minValue,l.maxElevation=e.samplerData.data.maxValue,l.hasNoDataValues=e.samplerData.data.hasNoDataValues,l.level=this.level,o=!0}else{let t,i,r=0;for(let a=this._parent;a&&(!i||r<s)&&(r=this.elevationLevel-a.level,t=i||t,i=a.layerInfo[0][e].data,!(!i&&t&&a.level<=n));a=a.parent);i=i||t,i&&(i.computeMinMaxValue(this._lij[0],this._lij[1],this._lij[2],l),l.minElevation!==1/0&&(l.level=i.level,o=!0))}o&&(null==i.elevationBounds&&(i.elevationBounds=new x),i.elevationBounds.copyFrom(l))}modifyLayers(e,t,i){const s=this.layerInfo[i];for(const a of s)a.loadingAgent&&a.loadingAgent!==$&&(ie(a.loadingAgent),a.loadingAgent=null),a.waitingAgents.clear();for(let a=0;a<s.length;++a)void 0===e[a]&&s[a].release();const n=new Array(...s),r=t.length;s.length=r;for(let a=0;a<r;a++){const e=t[a];s[a]=e>-1?n[e]:Q.acquire(this._surface.upsampleInfoPool)}this.setMemoryDirty()}restartAgents(e){this.renderData&&(this._createOrUpdateAgents(0,e),this.updateRenderData(e,0))}updateAgents(e){if(this.renderData){const t=this.layerInfo[e];for(const e of t)e.loadingAgent===$&&(e.loadingAgent=null);this._createOrUpdateAgents(0,e)}}updateAgentSuspension(){for(const e of L){const t=this._isSuspended(e);for(const i of this.layerInfo[e])i.loadingAgent&&i.loadingAgent!==$&&(i.loadingAgent.setSuspension(t),i.loadingAgent===$&&this.updateRenderData(e,0))}}removeLayerAgent(e,t){const i=this.layerInfo[t][e];i.loadingAgent&&i.loadingAgent!==$&&i.loadingAgent.dispose(),i.loadingAgent=null}agentDone(e,t){const i=this.layerInfo[t][e];i.loadingAgent=$,i.data||null!=i.upsampleInfo||this._createOrUpdateAgents(e+1,t)}_hasBlendableAncestor(e){return"normal"!==e.blendMode||A(e.parent)&&this._hasBlendableAncestor(e.parent)}_hasBlendModes(e,t,i){for(let s=e;s<t;++s){const e=this._surface.layerViewByIndex(s,i);if(P(e)&&"normal"!==e?.layer?.blendMode||A(e?.layer?.parent)&&this._hasBlendableAncestor(e?.layer?.parent))return!0}return!1}_createOrUpdateAgents(e,t){const i=this.layerInfo[t];if(0===i.length)return;const s=this._isSuspended(t);for(let n=e;n<i.length;++n){const r=i[n],a=this._surface.layerViewByIndex(n,t);let l=!1;if(r.loadingAgent?K(this,a)?(r.loadingAgent!==$&&r.loadingAgent.setSuspension(s),r.loadingAgent!==$&&(l=r.loadingAgent.update())):r.dispose():K(this,a)&&(r.loadingAgent=te(this,n,t,s),l=r.loadingAgent.startLoading(),l?r.loadingAgent===$&&this.setPendingUpdate(8):(ie(r.loadingAgent),r.loadingAgent=$)),r.loadingAgent===$&&this.updateRenderData(t,0),!a.destroyed&&!this._hasBlendModes(e,i.length,t)&&l&&a.isOpaque)return}}_isWithinExtent(e){const t=this.extent;return t[0]>=e[0]&&e[2]>=t[2]&&t[1]>=e[1]&&e[3]>=t[3]}intersectsExtent(e){const t=this.extent;return t[2]>=e[0]&&e[2]>=t[0]&&t[3]>=e[1]&&e[3]>=t[1]}getElevationVerticesPerSide(e){const i=this.elevationLevel-this.level,s=Math.max(this.level-e,this.elevationLevelDelta-i),n=t(1+(this._maxTesselation>>s),2,this._maxTesselation+1),r=this.minimumVerticesPerSide;return Math.max(n,r)}_findLIJ(e,t){if(!e)return null;const{rootTiles:i}=this.surface;if(null!=i)for(const s of i)if(ae(s,e)){let i=s,n=e[0]-i.level-1;for(;n>=0&&!i.leaf&&!t(i);){const t=e[1]>>n&1,s=e[2]>>n&1;i=i.children[2*t+s],n--}return t(i)?i:null}return null}findNeighborTile(e,t){const i=this._lij,s=this._getNeighborLIJ(i,e);return s?le(i,s)?t(this)?this:null:this._findLIJ(s,t):null}findCorner(e,t){const i=1===e?1:7===e?0:5===e?2:3;let s=this;for(;s.children[0]&&(!t||!t(s));)s=s.children[i];return s}findNeighborCornerTileExact(e,t){return this.findNeighborTile(e,e=>t(e)||e.level===this.level)?.findCorner(O(e),t)||null}forAllSubtreeOnSide(e,t){const i=0===e?[0,1]:1===e?[1]:2===e?[1,3]:3===e?[3]:4===e?[2,3]:5===e?[2]:6===e?[0,2]:[0],s=e=>{const n=e.children;!t(e)&&n[0]&&i.forEach(e=>s(n[e]))};s(this)}getNeighborEdgeStartVertexIndex(e,t){if(!t)return 0;const i=this.level-t.level;if(R(!q||i>=0),0===i)return 0;const s=2**i,n=!(1&~e),r=n?0:1,a=t.lij[r+1]*s,l=this._lij[r+1],o=l-a,h=n?s-1-o:o;return q&&(R(a<=l&&l<a+s),R(0<=h&&h<s)),h}forEachLoadedNeighbor(e){const t=this.level,i=e=>e.level===t||e.loaded;V.forEach(t=>{const s=this.findNeighborTile(t,i);null!=s&&s!==this&&s.forAllSubtreeOnSide(N(t),i=>!!i.loaded&&(e(i,t),!0))}),G.forEach(t=>{const s=this.findNeighborTile(t,i)?.findCorner(O(t),e=>e.loaded);R(!s||oe(this,s,t)),s?.loaded&&e(s,t)})}_getNeighborLIJ(e,t){const i=F(t)?-1:W(t)?1:0,s=H(t)?-1:J(t)?1:0,n=[e[0],e[1]+i,e[2]+s];return n[1]<0?null:this.surface.isGlobal?this._wrapLIJ(n):n[2]<0?null:n}_wrapLIJ(e){return!e||e[1]<0||e[1]>=2**e[0]?null:this.surface.wrapEastWest(e)}isEdgeNeighbor(e,t){if(null==e)return!1;if(0===this.level&&0===e.level){if(this._eastEnd&&e._westEnd&&2===t)return!0;if(this._westEnd&&e._eastEnd&&6===t)return!0}const i=Math.max(1e-6*(this.extent[2]-this.extent[0]),1);switch(t){case 0:return k(this.extent[3],e.extent[1],i);case 4:return k(this.extent[1],e.extent[3],i);case 2:return k(this.extent[2],e.extent[0],i)||k(this.extent[2],-e.extent[0],i);case 6:return k(this.extent[0],e.extent[2],i)||k(this.extent[0],-e.extent[2],i)}}get _eastEnd(){return this._lij[2]===this.surface.lijEastEnd(this.level)-1}get _westEnd(){return 0===this._lij[2]}checkGeometryWaterproofness(){z&&(R(this.loaded),this.renderData?.checkGeometryWaterproofness())}shouldHaveNeighbor(e){const t=this.extent,{rootTilesExtent:i}=this._surface,s=.25*(t[2]-t[0]);if(F(e)&&t[3]+s>=i[3])return!1;if(W(e)&&t[1]-s<=i[1])return!1;const n=this.surface.isGlobal;return!(!n&&H(e)&&t[0]-s<=i[0])&&!(!n&&J(e)&&t[2]+s>=i[2])}updateDistanceToPOI(e){const t=this._lastPOI;if(this.distanceToPOI>=0&&t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2])return;d(this._lastPOI,e);const i=this._center[1].center,s=e[0]-i[0],n=e[1]-i[1],r=e[2]-i[2];this.distanceToPOI=s*s+n*n+r*r}updateOverlayParameters(e){const{renderData:t}=this;if(!t)return;const{overlays:i,longitudeCyclical:s}=e,n=t.overlay;if(0===i.length)this._clearTileOverlayData(0,n),this._clearTileOverlayData(1,n);else{const[e,t]=i,r=this.extent;_(e.extent,r,s)||m(r,e.extent,s)||m(r,t.extent,s)?(this._setOverlayData(i,s,r,0,n),this._setOverlayData(i,s,r,1,n)):(this._clearTileOverlayData(0,n),this._clearTileOverlayData(1,n))}}_setOverlayData(e,t,i,s,n){const r=e[s].extent,a=y(r),l=v(r);let o=i[0];if(t){o=t.minimalMonotonic(r[0],o);const e=t.minimalMonotonic(r[0],i[2]);o>e&&(o=e-(i[2]-i[0]))}if(0===a||0===l)return void n.setOffsetAndScale(s,0,0,1,1);const h=y(i)/a,d=v(i)/l,u=(o-r[0])/a,c=(i[1]-r[1])/l;n.setOffsetAndScale(s,u,c,h,d)}_clearTileOverlayData(e,t){t.setOffsetAndScale(e,-1,-1,-1,-1)}}function te(e,t,i,s){const n=0===i?ne.acquire():se.acquire();return n.init(e,t,i,s),n}function ie(e){e.dispose(),b(e)?ne.release(e):T(e)&&se.release(e)}const se=new s(()=>new j),ne=new s(()=>new D),re=new x;function ae(e,t){const i=e.lij,s=t[0]-i[0];return!(s<0)&&(t[1]>>s===i[1]&&t[2]>>s===i[2])}function le(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}function oe(e,t,i){return null!=e&&null!=t&&t!==e&&(e.level>=t.level?he(e,t,i):he(t,e,O(i)))}function he(e,t,i){R(e.level>=t.level);const s=X(i),n=Y(i),r=e.extent,a=t.extent,l=[s?r[0]:r[2],n?r[3]:r[1]],o=[s?a[2]:a[0],n?a[1]:a[3]],h=1e-5*(r[2]-r[0]),d=k(l[0],o[0],h)||e.surface.isGlobal&&k(l[0],-o[0],h),u=k(l[1],o[1],h);if(d&&u)return!0;if(e.level===t.level)return R(!1),!1;if(!d&&!u)return R(!1),!1;const c=d?de(a[1],a[3],r[1],r[3],h):de(a[0],a[2],r[0],r[2],h);return R(c),c}function de(e,t,i,s,n){return e-n<=i&&i<=s&&s<=t+n}const ue=u(),ce=u(),ge=u(),pe=u();export{ee as Tile,oe as isCornerNeighbor,le as lijEquals};
5
+ import{toConst as e}from"../../../core/compilerUtils.js";import{clamp as t}from"../../../core/mathUtils.js";import{abortMaybe as i}from"../../../core/maybe.js";import s from"../../../core/ObjectPool.js";import{e as n,F as r,g as a,j as l,i as o,b as h,d}from"../../../chunks/vec32.js";import{create as u,unitZ as c}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as g}from"../../../geometry/ellipsoidUtils.js";import{create as p,equals as f,rectangleContainsRectangleCyclicalAware as _,rectanglesIntersectCyclicalAware as m,width as y,height as v}from"../../../geometry/support/aaBoundingRect.js";import{Sphere as M}from"../../../geometry/support/sphere.js";import{isGroupLayer as A}from"../../../layers/support/layerUtils.js";import{ElevationBounds as x}from"./ElevationBounds.js";import{ElevationTileAgent as D,isElevationTileAgent as b}from"./ElevationTileAgent.js";import{LayerClasses as L}from"./LayerClass.js";import{MapDataCacheItem as I}from"./MapDataCacheItem.js";import{MapTileAgent as j,isMapTileAgent as T}from"./MapTileAgent.js";import{maxPatchTesselation as C}from"./TerrainConst.js";import{isVectorTile as B,isTileTexture as U,isRasterTile as S,isImageWithType as w}from"./TerrainData.js";import{weakAssert as E,isBlendableLayerView as P,oppositeCorner as O,internalAssert as R,enableTerrainInternalChecks as q,neighborEdgeIndices as V,oppositeEdge as N,neighborCornerIndices as G,almostEquals as k,enableWaterproofTests as F,isNorth as z,isSouth as W,isWest as H,isEast as J,isWestCorner as X,isNorthCorner as Y}from"./terrainUtils.js";import{tileAgentDone as $}from"./TileAgent.js";import{TilePerLayerInfo as Q}from"./TilePerLayerInfo.js";import{fallsWithinLayerView as K}from"./tileUtils.js";const Z=.1;class ee{constructor(){this._lij=[0,0,0],this._children=[null,null,null,null],this._pendingUpdates=0,this._dirty=!0,this._previouslyRendered=!1,this.extent=p(),this._elevationBoundsMin=NaN,this._elevationBoundsMax=0,this.layerInfo=[[],[]],this.extentInRadians=p(),this.centerAtSeaLevel=u(),this._center=[u(),new M,u()],this.up=c(),this._withinClippingArea=!0,this._intersectsClippingArea=!0,this._maxTesselation=0,this._usedMemory=0,this._rasterTileMemory=0,this._vectorTileMemory=0,this._mapDataRefCount=0,this.screenDepth=0,this.renderOrder=0,this._edgeLen=0,this._edgeLen2=0,this._curvatureHeight=0,this.onCompressionFinished=()=>{this.setPendingUpdate(16),this.setMemoryDirty()},this.extentMidX=0,this.extentMidY=0,this.distanceToPOI=-1,this._lastPOI=u(),this.maxLevelDeltaNeighborCount=0,this.unmergableChildCount=0}get lij(){return this._lij}get spatialReference(){return this._surface.spatialReference??this._surface.tilingScheme.spatialReference}get isDisposed(){return null==this._surface}get elevationLevelDelta(){return this._surface.getElevationLevelDelta(this.level)}static prune(){se.prune(0),ne.prune(0),Q.prune()}get _cached(){return!this.leaf&&this._mapDataRefCount<=0}get withinClippingArea(){return this._withinClippingArea}get intersectsClippingArea(){return this._intersectsClippingArea}get clippingArea(){return this._clippingArea}get parent(){return this._parent}get children(){return this._children}get surface(){return this._surface}get elevationBoundsMin(){return this._elevationBoundsMin}get elevationBoundsMax(){return this._elevationBoundsMax}get level(){return this._lij[0]}get key(){return`${this._lij[0]}/${this._lij[1]}/${this._lij[2]}`}get edgeLen(){return this._edgeLen}get radius(){return this._center[1].radius}get visible(){return this._dirty&&this.computeVisibility(),this._visible}get frustumVisibility(){return this._dirty&&this.computeVisibility(),this._frustumVisibility}computeVisibility(){this._dirty=!1;const e=this.parent,t=e?.frustumVisibility??1;this._frustumVisibility=0===t?0:2===t?2:this._calculateFrustumVisibility(this.surface.frustum);const i=2!==this._frustumVisibility&&this._intersectsClippingArea;i!==this._visible&&(this._visible=i,this._surface.emit("tiles-visibility-changed"),this._surface.renderer.setDirty(),this.updateAgentSuspension())}get _loadable(){return this.visible||this._surface.view.state.fixedContentCamera}get rendered(){const e=!!this.renderData;return e!==this._previouslyRendered&&(this._surface.emit("tiles-visibility-changed"),this._previouslyRendered=e,this._surface.renderer.setDirty()),e}init(e,t,i,s,n){this._lij[0]=e,this._lij[1]=t,this._lij[2]=i,this.ellipsoid=g(n.tilingScheme.spatialReference),n.tilingScheme.getExtent(e,t,i,this.extent),n.tilingScheme.convertExtentToRadians(this.extent,this.extentInRadians),this.extentMidX=.5*(this.extent[0]+this.extent[2]),this.extentMidY=.5*(this.extent[1]+this.extent[3]),this._withinClippingArea=!0,this._intersectsClippingArea=!0,this._clippingArea=null,this._mapDataRefCount=0,n.upsampleMapCache.pop(this.key),this._edgeLen=0,this._edgeLen2=0,this._center[1].radius=0,this.elevationLevel=e,s&&!Number.isNaN(s.elevationBoundsMin)?(this._elevationBoundsMin=s.elevationBoundsMin,this._elevationBoundsMax=s.elevationBoundsMax):(this._elevationBoundsMin=0,this._elevationBoundsMax=0),this._pendingUpdates=0,this.renderData=null,this.screenDepth=0,this._visible=!1,this._previouslyRendered=!1,this._parent=s,this.clearChildren(),this._surface=n,this.updateVisibility(),this.maxLevelDeltaNeighborCount=0,this.unmergableChildCount=0;for(const r of L){const e=n.numLayers(r),t=this.layerInfo[r];for(const i of t)i.release();t.length=e;for(let i=0;i<e;i++)t[i]=Q.acquire(this._surface.upsampleInfoPool),0===r&&this.findElevationBoundsForLayer(i,-1)}this.computeElevationBounds(),this._maxTesselation=Math.min(n.tilingScheme.pixelSize,C)}dispose(){E(!this.renderData,"tile.renderData was not unloaded"),this._surface?.upsampleMapCache.pop(this.key),this.layerInfo.forEach(e=>{e.forEach(e=>e.release()),e.length=0}),this._surface=this._parent=null,this.clearChildren(),this.setMemoryDirty()}refMapData(){++this._mapDataRefCount,this._cached||this._surface.upsampleMapCache.pop(this.key)}unrefMapData(){--this._mapDataRefCount,this._cached&&this.cachedMemory>0&&this._surface.upsampleMapCache.put(this.key,new I(e(this)))}setMemoryDirty(){this._usedMemory=0}get usedMemory(){return this._ensureUsedMemory()+(this._cached?0:this.mapDataMemory)}get cachedMemory(){return this._ensureUsedMemory(),null==this._surface?this.usedMemory:this._cached?this.mapDataMemory:0}get mapDataMemory(){return this._rasterTileMemory+this._vectorTileMemory}get _cpuImageMemorySize(){const e=4,t=this._surface.tilingScheme.pixelSize;return t*t*e}_ensureUsedMemory(){if(this._usedMemory>0)return this._vectorTileMemory=this.layerInfo[1].reduce((e,{data:t})=>e+(B(t)?t.usedMemoryPerReference:0),0),this._usedMemory;this._usedMemory=this._baseUsedMemory,this._rasterTileMemory=0,this._vectorTileMemory=0;for(const{data:e}of this.layerInfo[1])B(e)?this._vectorTileMemory+=e.usedMemoryPerReference:this._rasterTileMemory+=this.getTerrainDataMemory(e);for(const e of this.layerInfo[0])this._usedMemory+=e.data?this._cpuImageMemorySize:0;return this.renderData&&(this._usedMemory+=this.renderData.estimatedGeometryMemoryUsage,this._rasterTileMemory+=this.renderData.texture?.usedMemory??0),this._cached&&this._surface.upsampleMapCache.updateSize(this.key),this._usedMemory}getUsedMemoryForLayer(e,t){const i=this.layerInfo[e][t];return i?.data?1===e?this._cached?0:this.getTerrainDataMemory(i.data):0===e?this._cpuImageMemorySize:0:0}getTerrainDataMemory(e){return U(e)?e.texture.usedMemory:S(e)?e.memoryUsage:B(e)?e.usedMemoryPerReference:w(e)||e instanceof HTMLImageElement?this._cpuImageMemorySize:0}updateScreenDepth(e){const[t,i,s]=this._center[1].center,n=e,r=n[2]*t+n[6]*i+n[10]*s+n[14];this.screenDepth=r<0?0:r/(n[3]*t+n[7]*i+n[11]*s+n[15])}shouldSplit(e,t,i){if(!this.visible)return 0;if(e.frustum&&(!this._intersectsClippingArea||2===this._calculateFrustumVisibility(e.frustum)))return 0;const s=this.level;n(ue,this._center[1].center,t);let d=r(ue),u=ue,c=this._center[1].center;n(ce,this._center[0],t);const g=r(ce);g<d&&(d=g,u=ce,c=this._center[0]),n(ge,this._center[2],t);const p=r(ge);if(p<d&&(d=p,u=ge,c=this._center[2]),this._edgeLen2>d&&s<e.maxLod)return 1;const f=Math.sqrt(d),_=e.fovX*f*2,m=this._edgeLen/_,y=()=>{if(s<e.maxLod)return this.elevationLevel=s,0;const t=s+Math.ceil(-Math.log2(e.relativeWidthLimit/m));return t!==this.elevationLevel?(this.elevationLevel=t,2):0},v=null!=i?i-s:1/0;if(v<=.5)return y();const M=a(this.up,ue),A=this._elevationBoundsMax-this._elevationBoundsMin,x=A/this.edgeLen;if(e.aboveGround&&M>0&&x<.001){if(M/f-Math.sin(this._curvatureHeight/(this.edgeLen*Math.SQRT1_2)*Math.PI)-x>0)return 0}const D=null!=i?3-Math.min(v,2):1;if(m*D<e.relativeWidthLimit||s>=e.maxLod)return y();if(s<7)return 1;l(pe,this.up,M),n(pe,pe,u);const b=r(pe);if(b<=this.radius*this.radius)return 1;l(pe,pe,this.radius/Math.sqrt(b)),o(pe,pe,c),n(pe,t,pe);const L=Math.min(1,(Math.abs(a(pe,this.up))+.5*A+this._curvatureHeight)/h(pe)),I=Z/e.angledSplitBias,j=e.fovY*f*2;return L*(this._edgeLen/j*D)<I*e.relativeHeightLimit?0:1}createChildren(){const e=this._children,t=this.lij[0]+1,i=2*this.lij[1],s=2*this.lij[2];return e[0]=this.surface.createTile(t,i,s,this),e[1]=this.surface.createTile(t,i,s+1,this),e[2]=this.surface.createTile(t,i+1,s,this),e[3]=this.surface.createTile(t,i+1,s+1,this),e}clearChildren(){this._children[0]=this._children[1]=this._children[2]=this._children[3]=null}get loaded(){return this.renderData?.hasGeometry??!1}load(){this.refMapData();for(const e of L)this._createOrUpdateAgents(0,e);this.surface.renderer.loadTile(this)}unload(){this.renderData&&this.unrefMapData(),this.surface.renderer.unloadTile(this);for(const e of L){const t=this.layerInfo[e];for(const e of t)e.loadingAgent&&e.loadingAgent!==$&&(ie(e.loadingAgent),e.loadingAgent=null),e.pendingUpdates=0}this.resetPendingUpdate(8),this.resetPendingUpdate(16),this.resetPendingUpdate(32)}unloadMapData(){const e=this.layerInfo[1];for(const t of e)t.loadingAgent&&t.loadingAgent!==$&&(ie(t.loadingAgent),t.loadingAgent=null),t.pendingUpdates=0,t.invalidateSourceData();this.renderData?.releaseTexture(),this.setMemoryDirty()}updateClippingStatus(e){if(f(e,this._clippingArea))return!1;const t=this._intersectsClippingArea,i=this._withinClippingArea;null!=e?(this._intersectsClippingArea=this.intersectsExtent(e),this._withinClippingArea=this._isWithinExtent(e)):(this._intersectsClippingArea=!0,this._withinClippingArea=!0),this._clippingArea=e,this.updateVisibility();const s=i&&this._withinClippingArea,n=!(i||t||this._withinClippingArea||this._intersectsClippingArea);return!this.renderData||s||n||this.setPendingUpdate(8),!0}updateVisibility(){this._dirty=!0,this._surface.setTileTreeDirty(!1)}getLayerInfo(e,t){return this.layerInfo[t][e]}hasLayerData(e,t){const i=this.layerInfo[t][e];return!(!i?.data||i.dataInvalidated)}get updating(){if(this.hasPendingUpdates)return!0;for(const e of L){const t=this.layerInfo[e];for(const e of t)if(e.loadingAgent&&e.loadingAgent!==$&&e.loadingAgent.updating)return!0}return!1}_isSuspended(e){return!!this.hasPendingUpdate(1)||0!==e&&!this._loadable}get hasPendingUpdates(){return 0!==this._pendingUpdates}hasPendingUpdate(e){return(this._pendingUpdates&e)===e}setPendingUpdate(e){const t=this._pendingUpdates;return this._pendingUpdates|=e,1===e||4===e?this._surface.setTileTreeDirty(!0):this._surface.requestUpdate(),t!==this._pendingUpdates}resetPendingUpdate(e){return!!this.hasPendingUpdate(e)&&(this._pendingUpdates&=~e,!0)}requestLayerData(e,t,s){const n=this.layerInfo[t][e];if(n.waitingAgents.has(s))return console.warn("agent already requested this piece of map data (tile %s, agent tile %s, layer: %d/%d)",this._lij.toString(),s.tile.lij.toString(),t,e),!0;if(n.waitingAgents.push(s),n.data&&!n.dataInvalidated){console.warn("agent requested existing data (tile %s, agent tile %s, layer: %d/%d)",this._lij.toString(),s.tile.lij.toString(),t,e);const i=B(n.data);return s.dataArrived(this,i),!0}if(n.requestPromise)return!0;i(n.requestAbort),n.requestAbort=new AbortController;const r=this._surface.requestTileData(this,e,t,n.requestAbort);if(!r)return n.requestAbort=null,!1;const a=()=>{n.requestPromise===r&&(n.requestPromise=null,n.requestAbort=null)};return n.requestPromise=r,r.then(a,a),!0}get leaf(){return null==this._children[0]}hasLij(e){return this._lij[0]===e[0]&&this._lij[1]===e[1]&&this._lij[2]===e[2]}findByLij(e){if(this.hasLij(e))return this;const t=this._children;if(!t[0])return null;return t[0].findByLij(e)||t[1].findByLij(e)||t[2].findByLij(e)||t[3].findByLij(e)}distanceToSquared(e){return r(n(pe,this._center[1].center,e))}containsPoint(e){const t=this.extent;return e[0]>=t[0]&&e[1]>=t[1]&&e[0]<=t[2]&&e[1]<=t[3]}containsPointXY(e,t){const i=this.extent;return e>=i[0]&&t>=i[1]&&e<=i[2]&&t<=i[3]}unrequestLayerData(e,t,i){const s=this.layerInfo[t][e],n=s.waitingAgents,r=null!=n.removeUnordered(i);E(r,"agent has not requested this piece of map data"),n.length<1&&(s.abortRequest(),this.setMemoryDirty())}dataArrived(e,t,i){const s=B(i),n=this.layerInfo[t][e];n.data=i,n.dataInvalidated=!1,n.waitingAgents.forAll(e=>e.dataArrived(this,s)),n.waitingAgents.clear(),this.setMemoryDirty()}dataMissing(e,t){const i=this.layerInfo[t][e];i.dataMissing=!0,i.waitingAgents.forAll(e=>e.dataMissing()),i.waitingAgents.clear(),this.setMemoryDirty()}updateRenderData(e,t,i){switch(i&&this.forEachLoadedNeighbor(i=>i.updateRenderData(e,t)),e){case 1:return this._updateTexture(t);case 0:return this._updateGeometry()}}_updateTexture(e){this.renderData&&(this.resetPendingUpdate(0===e?16:32),this.setPendingUpdate(0===e?32:16))}_updateGeometry(){this.setPendingUpdate(8);for(const e of this.layerInfo[0])e.pendingUpdates|=8}invalidateLayerData(e,t){this.layerInfo[t][e].invalidateSourceData(),this.restartAgents(t)}computeElevationBounds(){const e=this._elevationBoundsMin,t=this._elevationBoundsMax;let i=1/0,s=-1/0;const n=this.layerInfo[0];let r=!0;for(const a of n)null!=a.elevationBounds&&(i=Math.min(i,a.elevationBounds.minElevation),s=Math.max(s,a.elevationBounds.maxElevation),a.elevationBounds.hasNoDataValues||(r=!1));r&&(i=Math.min(i,0),s=Math.max(s,0)),e===i&&t===s||(this._elevationBoundsMin=i,this._elevationBoundsMax=s,this.updateRadiusAndCenter(),this._surface.setTileTreeDirty(!1))}_updateCenter(){const e=this._elevationBoundsMin,t=this._elevationBoundsMax,i=.5*(e+t),s=this._center;l(pe,this.up,i),o(s[1].center,this.centerAtSeaLevel,pe),l(pe,this.up,e),o(s[0],this.centerAtSeaLevel,pe),l(pe,this.up,t),o(s[2],this.centerAtSeaLevel,pe)}findElevationBoundsForLayer(e,t){const i=this.layerInfo[0][e],s=this.elevationLevelDelta,n=Math.max(this.elevationLevel-s,0),r=i.elevationBounds;if(null!=r&&r.level>=t&&r.level<=n)return;const a=this._surface.layerViewByIndex(e,0);if(!K(this,a))return;const l=re;let o=!1;const h=i.data;if(h&&h.level<=n){const e=i.data;l.minElevation=e.samplerData.data.minValue,l.maxElevation=e.samplerData.data.maxValue,l.hasNoDataValues=e.samplerData.data.hasNoDataValues,l.level=this.level,o=!0}else{let t,i,r=0;for(let a=this._parent;a&&(!i||r<s)&&(r=this.elevationLevel-a.level,t=i||t,i=a.layerInfo[0][e].data,!(!i&&t&&a.level<=n));a=a.parent);i=i||t,i&&(i.computeMinMaxValue(this._lij[0],this._lij[1],this._lij[2],l),l.minElevation!==1/0&&(l.level=i.level,o=!0))}o&&(null==i.elevationBounds&&(i.elevationBounds=new x),i.elevationBounds.copyFrom(l))}modifyLayers(e,t,i){const s=this.layerInfo[i];for(const a of s)a.loadingAgent&&a.loadingAgent!==$&&(ie(a.loadingAgent),a.loadingAgent=null),a.waitingAgents.clear();for(let a=0;a<s.length;++a)void 0===e[a]&&s[a].release();const n=new Array(...s),r=t.length;s.length=r;for(let a=0;a<r;a++){const e=t[a];s[a]=e>-1?n[e]:Q.acquire(this._surface.upsampleInfoPool)}this.setMemoryDirty()}restartAgents(e){this.renderData&&(this._createOrUpdateAgents(0,e),this.updateRenderData(e,0))}updateAgents(e){if(this.renderData){const t=this.layerInfo[e];for(const e of t)e.loadingAgent===$&&(e.loadingAgent=null);this._createOrUpdateAgents(0,e)}}updateAgentSuspension(){for(const e of L){const t=this._isSuspended(e);for(const i of this.layerInfo[e])i.loadingAgent&&i.loadingAgent!==$&&(i.loadingAgent.setSuspension(t),i.loadingAgent===$&&this.updateRenderData(e,0))}}removeLayerAgent(e,t){const i=this.layerInfo[t][e];i.loadingAgent&&i.loadingAgent!==$&&i.loadingAgent.dispose(),i.loadingAgent=null}agentDone(e,t){const i=this.layerInfo[t][e];i.loadingAgent=$,i.data||null!=i.upsampleInfo||this._createOrUpdateAgents(e+1,t)}_hasBlendableAncestor(e){return"normal"!==e.blendMode||A(e.parent)&&this._hasBlendableAncestor(e.parent)}_hasBlendModes(e,t,i){for(let s=e;s<t;++s){const e=this._surface.layerViewByIndex(s,i);if(P(e)&&"normal"!==e?.layer?.blendMode||A(e?.layer?.parent)&&this._hasBlendableAncestor(e?.layer?.parent))return!0}return!1}_createOrUpdateAgents(e,t){const i=this.layerInfo[t];if(0===i.length)return;const s=this._isSuspended(t);for(let n=e;n<i.length;++n){const r=i[n],a=this._surface.layerViewByIndex(n,t);let l=!1;if(r.loadingAgent?K(this,a)?(r.loadingAgent!==$&&r.loadingAgent.setSuspension(s),r.loadingAgent!==$&&(l=r.loadingAgent.update())):r.dispose():K(this,a)&&(r.loadingAgent=te(this,n,t,s),l=r.loadingAgent.startLoading(),l?r.loadingAgent===$&&this.setPendingUpdate(8):(ie(r.loadingAgent),r.loadingAgent=$)),r.loadingAgent===$&&this.updateRenderData(t,0),!a.destroyed&&!this._hasBlendModes(e,i.length,t)&&l&&a.isOpaque)return}}_isWithinExtent(e){const t=this.extent;return t[0]>=e[0]&&e[2]>=t[2]&&t[1]>=e[1]&&e[3]>=t[3]}intersectsExtent(e){const t=this.extent;return t[2]>=e[0]&&e[2]>=t[0]&&t[3]>=e[1]&&e[3]>=t[1]}getElevationVerticesPerSide(e){const i=this.elevationLevel-this.level,s=Math.max(this.level-e,this.elevationLevelDelta-i),n=t(1+(this._maxTesselation>>s),2,this._maxTesselation+1),r=this.minimumVerticesPerSide;return Math.max(n,r)}_findLIJ(e,t){if(!e)return null;const{rootTiles:i}=this.surface;if(null!=i)for(const s of i)if(ae(s,e)){let i=s,n=e[0]-i.level-1;for(;n>=0&&!i.leaf&&!t(i);){const t=e[1]>>n&1,s=e[2]>>n&1;i=i.children[2*t+s],n--}return t(i)?i:null}return null}findNeighborTile(e,t){const i=this._lij,s=this._getNeighborLIJ(i,e);return s?le(i,s)?t(this)?this:null:this._findLIJ(s,t):null}findCorner(e,t){const i=1===e?1:7===e?0:5===e?2:3;let s=this;for(;s.children[0]&&(!t||!t(s));)s=s.children[i];return s}findNeighborCornerTileExact(e,t){return this.findNeighborTile(e,e=>t(e)||e.level===this.level)?.findCorner(O(e),t)||null}forAllSubtreeOnSide(e,t){const i=0===e?[0,1]:1===e?[1]:2===e?[1,3]:3===e?[3]:4===e?[2,3]:5===e?[2]:6===e?[0,2]:[0],s=e=>{const n=e.children;!t(e)&&n[0]&&i.forEach(e=>s(n[e]))};s(this)}getNeighborEdgeStartVertexIndex(e,t){if(!t)return 0;const i=this.level-t.level;if(R(!q||i>=0),0===i)return 0;const s=2**i,n=!(1&~e),r=n?0:1,a=t.lij[r+1]*s,l=this._lij[r+1],o=l-a,h=n?s-1-o:o;return q&&(R(a<=l&&l<a+s),R(0<=h&&h<s)),h}forEachLoadedNeighbor(e){const t=this.level,i=e=>e.level===t||e.loaded;V.forEach(t=>{const s=this.findNeighborTile(t,i);null!=s&&s!==this&&s.forAllSubtreeOnSide(N(t),i=>!!i.loaded&&(e(i,t),!0))}),G.forEach(t=>{const s=this.findNeighborTile(t,i)?.findCorner(O(t),e=>e.loaded);R(!s||oe(this,s,t)),s?.loaded&&e(s,t)})}_getNeighborLIJ(e,t){const i=z(t)?-1:W(t)?1:0,s=H(t)?-1:J(t)?1:0,n=[e[0],e[1]+i,e[2]+s];return n[1]<0?null:this.surface.isGlobal?this._wrapLIJ(n):n[2]<0?null:n}_wrapLIJ(e){return!e||e[1]<0||e[1]>=2**e[0]?null:this.surface.wrapEastWest(e)}isEdgeNeighbor(e,t){if(null==e)return!1;if(0===this.level&&0===e.level){if(this._eastEnd&&e._westEnd&&2===t)return!0;if(this._westEnd&&e._eastEnd&&6===t)return!0}const i=Math.max(1e-6*(this.extent[2]-this.extent[0]),1);switch(t){case 0:return k(this.extent[3],e.extent[1],i);case 4:return k(this.extent[1],e.extent[3],i);case 2:return k(this.extent[2],e.extent[0],i)||k(this.extent[2],-e.extent[0],i);case 6:return k(this.extent[0],e.extent[2],i)||k(this.extent[0],-e.extent[2],i)}}get _eastEnd(){return this._lij[2]===this.surface.lijEastEnd(this.level)-1}get _westEnd(){return 0===this._lij[2]}checkGeometryWaterproofness(){F&&(R(this.loaded),this.renderData?.checkGeometryWaterproofness())}shouldHaveNeighbor(e){const t=this.extent,{rootTilesExtent:i}=this._surface,s=.25*(t[2]-t[0]);if(z(e)&&t[3]+s>=i[3])return!1;if(W(e)&&t[1]-s<=i[1])return!1;const n=this.surface.isGlobal;return!(!n&&H(e)&&t[0]-s<=i[0])&&!(!n&&J(e)&&t[2]+s>=i[2])}updateDistanceToPOI(e){const t=this._lastPOI;if(this.distanceToPOI>=0&&t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2])return;d(this._lastPOI,e);const i=this._center[1].center,s=e[0]-i[0],n=e[1]-i[1],r=e[2]-i[2];this.distanceToPOI=s*s+n*n+r*r}updateOverlayParameters(e){const{renderData:t}=this;if(!t)return;const{overlays:i,longitudeCyclical:s}=e,n=t.overlay;if(0===i.length)this._clearTileOverlayData(0,n),this._clearTileOverlayData(1,n);else{const[e,t]=i,r=this.extent;_(e.extent,r,s)||m(r,e.extent,s)||m(r,t.extent,s)?(this._setOverlayData(i,s,r,0,n),this._setOverlayData(i,s,r,1,n)):(this._clearTileOverlayData(0,n),this._clearTileOverlayData(1,n))}}_setOverlayData(e,t,i,s,n){const r=e[s].extent,a=y(r),l=v(r);let o=i[0];if(t){o=t.minimalMonotonic(r[0],o);const e=t.minimalMonotonic(r[0],i[2]);o>e&&(o=e-(i[2]-i[0]))}if(0===a||0===l)return void n.setOffsetAndScale(s,0,0,1,1);const h=y(i)/a,d=v(i)/l,u=(o-r[0])/a,c=(i[1]-r[1])/l;n.setOffsetAndScale(s,u,c,h,d)}_clearTileOverlayData(e,t){t.setOffsetAndScale(e,-1,-1,-1,-1)}}function te(e,t,i,s){const n=0===i?ne.acquire():se.acquire();return n.init(e,t,i,s),n}function ie(e){e.dispose(),b(e)?ne.release(e):T(e)&&se.release(e)}const se=new s(()=>new j),ne=new s(()=>new D),re=new x;function ae(e,t){const i=e.lij,s=t[0]-i[0];return!(s<0)&&(t[1]>>s===i[1]&&t[2]>>s===i[2])}function le(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}function oe(e,t,i){return null!=e&&null!=t&&t!==e&&(e.level>=t.level?he(e,t,i):he(t,e,O(i)))}function he(e,t,i){R(e.level>=t.level);const s=X(i),n=Y(i),r=e.extent,a=t.extent,l=[s?r[0]:r[2],n?r[3]:r[1]],o=[s?a[2]:a[0],n?a[1]:a[3]],h=1e-5*(r[2]-r[0]),d=k(l[0],o[0],h)||e.surface.isGlobal&&k(l[0],-o[0],h),u=k(l[1],o[1],h);if(d&&u)return!0;if(e.level===t.level)return R(!1),!1;if(!d&&!u)return R(!1),!1;const c=d?de(a[1],a[3],r[1],r[3],h):de(a[0],a[2],r[0],r[2],h);return R(c),c}function de(e,t,i,s,n){return e-n<=i&&i<=s&&s<=t+n}const ue=u(),ce=u(),ge=u(),pe=u();export{ee as Tile,oe as isCornerNeighbor,le as lijEquals};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as t}from"tslib";import i from"../../../core/Accessor.js";import e from"../../../core/Logger.js";import{lerp as r}from"../../../core/mathUtils.js";import{createScreenPointArray as s,createRenderScreenPointArray3 as o}from"../../../core/screenUtils.js";import{property as n,subclass as h}from"../../../core/accessorSupport/decorators.js";import{copy as a,multiply as p,invert as u,transpose as l,frustum as _,equals as v,lookAt as c}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{create as w}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{copy as d,exactEquals as y}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as g}from"../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{e as m,h as f,C as x,d as M,m as D,a as j,g as R,w as P,v as V,j as F,b as C,f as b,n as S,D as T}from"../../../chunks/vec32.js";import{create as I,UNIT_Z as A}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{s as E,e as O,a as U,f as H,g as k,t as z}from"../../../chunks/vec42.js";import{fromValues as W,create as Y}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{create as L,copy as X,fromMatrix as q}from"../../../geometry/support/frustum.js";import{create as G}from"../../../geometry/support/ray.js";import{projectPointSignedLength as N}from"../../../geometry/support/vector.js";import{viewAngle as B}from"../state/utils/viewUtils.js";import{fovd2fovx as J,fovx2fovd as K,fovd2fovy as Q,fovy2fovd as Z}from"../webgl-engine/lib/fov.js";var $;let tt=$=class extends i{constructor(t){super(t),this._ray=G(),this._viewport=W(0,0,1,1),this._padding=W(0,0,0,0),this._fov=55/180*Math.PI,this._nearFar=g(1,1e3),this._viewDirty=!0,this._viewMatrix=w(),this._viewProjectionDirty=!0,this._viewProjectionMatrix=w(),this._viewInverseTransposeMatrixDirty=!0,this._viewInverseTransposeMatrix=w(),this._frustumDirty=!0,this._frustum=L(),this._fullViewport=Y(),this._pixelRatio=1,this.row=0,this.column=0,this._rows=1,this._columns=1,this._center=I(),this._up=I(),this.relativeElevation=0}get pixelRatio(){return this._pixelRatio}set pixelRatio(t){this._pixelRatio=t>0?t:1}get rows(){return this._rows}set rows(t){this._rows=Math.max(1,t)}get columns(){return this._columns}set columns(t){this._columns=Math.max(1,t)}get eye(){return this._ray.origin}set eye(t){this._compareAndSetView(t,this._ray.origin)}get center(){return this._center}set center(t){this._compareAndSetView(t,this._center,"_center")}get ray(){return m(this._ray.direction,this.center,this.eye),this._ray}get up(){return this._up}set up(t){this._compareAndSetView(t,this._up,"_up")}get viewMatrix(){return this._ensureViewClean(),this._viewMatrix}set viewMatrix(t){a(this._viewMatrix,t),this.notifyChange("_viewMatrix"),this._viewDirty=!1,this._viewInverseTransposeMatrixDirty=!0,this._viewProjectionDirty=!0,this._frustumDirty=!0}get viewForward(){return this._ensureViewClean(),f(I(),-this._viewMatrix[2],-this._viewMatrix[6],-this._viewMatrix[10])}get viewUp(){return this._ensureViewClean(),f(I(),this._viewMatrix[1],this._viewMatrix[5],this._viewMatrix[9])}get viewRight(){return this._ensureViewClean(),f(I(),this._viewMatrix[0],this._viewMatrix[4],this._viewMatrix[8])}get nearFar(){return this._nearFar}get near(){return this._nearFar[0]}set near(t){this._nearFar[0]!==t&&(this._nearFar[0]=t,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_nearFar"))}get far(){return this._nearFar[1]}set far(t){this._nearFar[1]!==t&&(this._nearFar[1]=t,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_nearFar"))}get viewport(){return this._viewport}set viewport(t){this.x=t[0],this.y=t[1],this.width=t[2],this.height=t[3]}get screenViewport(){if(1===this.pixelRatio)return this._viewport;const t=E(Y(),this._viewport,1/this.pixelRatio),i=this._get("screenViewport");return i&&O(t,i)?i:t}get screenPadding(){if(1===this.pixelRatio)return this._padding;const t=E(Y(),this._padding,1/this.pixelRatio),i=this._get("screenPadding");return i&&O(t,i)?i:t}get x(){return this._viewport[0]}set x(t){t+=this._padding[3],this._viewport[0]!==t&&(this._viewport[0]=t,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_viewport"))}get y(){return this._viewport[1]}set y(t){t+=this._padding[2],this._viewport[1]!==t&&(this._viewport[1]=t,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_viewport"))}get width(){return this._viewport[2]}set width(t){this._viewport[2]!==t&&(this._viewport[2]=t,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_viewport"))}get height(){return this._viewport[3]}set height(t){this._viewport[3]!==t&&(this._viewport[3]=t,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_viewport"))}get fullWidth(){return this._viewport[2]+this._padding[1]+this._padding[3]}set fullWidth(t){this.width=t-(this._padding[1]+this._padding[3])}get fullHeight(){return this._viewport[3]+this._padding[0]+this._padding[2]}set fullHeight(t){this.height=t-(this._padding[0]+this._padding[2])}get fullViewport(){return this._fullViewport[0]=this._viewport[0]-this._padding[3],this._fullViewport[1]=this._viewport[1]-this._padding[2],this._fullViewport[2]=this.fullWidth,this._fullViewport[3]=this.fullHeight,this._fullViewport}get _aspect(){return this.width/this.height}get padding(){return this._padding}set padding(t){U(this._padding,t)||(this._viewport[0]+=t[3]-this._padding[3],this._viewport[1]+=t[2]-this._padding[2],this._viewport[2]-=t[1]+t[3]-(this._padding[1]+this._padding[3]),this._viewport[3]-=t[0]+t[2]-(this._padding[0]+this._padding[2]),H(this._padding,t),this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_padding"),this.notifyChange("_viewport"))}get viewProjectionMatrix(){return this._viewProjectionDirty&&(p(this._viewProjectionMatrix,this.projectionMatrix,this.viewMatrix),this._viewProjectionDirty=!1),this._viewProjectionMatrix}get projectionMatrix(){return this._projectionMatrixInternal}get inverseProjectionMatrix(){return u(w(),this.projectionMatrix)||this._get("inverseProjectionMatrix")||w()}get fov(){return this._fov}set fov(t){this._fov=t,this._viewProjectionDirty=!0,this._frustumDirty=!0}get fovX(){return J(this._fov,this.width,this.height)}set fovX(t){this._fov=K(t,this.width,this.height),this._viewProjectionDirty=!0,this._frustumDirty=!0}get fovY(){return Q(this._fov,this.width,this.height)}set fovY(t){this._fov=Z(t,this.width,this.height),this._viewProjectionDirty=!0,this._frustumDirty=!0}get distance(){return x(this.center,this.eye)}get frustum(){return this._recomputeFrustum(),this._frustum}get viewInverseTransposeMatrix(){return(this._viewInverseTransposeMatrixDirty||this._viewDirty)&&(u(this._viewInverseTransposeMatrix,this.viewMatrix),l(this._viewInverseTransposeMatrix,this._viewInverseTransposeMatrix),this._viewInverseTransposeMatrixDirty=!1),this._viewInverseTransposeMatrix}depthNDCToWorld(t){const{near:i,far:e}=this;return 2*i*e/(e+i-t*(e-i))}get perRenderPixelRatio(){return Math.tan(this.fovX/2)/(this.width/2)}get perScreenPixelRatio(){return this.perRenderPixelRatio*this.pixelRatio}get aboveGround(){return null!=this.relativeElevation&&this.relativeElevation>=0}get _projectionMatrixInternal(){const t=this.width,i=this.height,e=this.near*Math.tan(this.fovY/2)*2,r=e*this._aspect,s=e/this.rows,o=r/this.columns,n=-r/2+this.column*o,h=n+o,a=-e/2+this.row*s,p=a+s,u=_(w(),n*(1+2*this._padding[3]/t),h*(1+2*this._padding[1]/t),a*(1+2*this._padding[2]/i),p*(1+2*this._padding[0]/i),this.near,this.far),l=this._get("projectionMatrix");return l&&v(l,u)?l:u}copyFrom(t){M(this._ray.origin,t.eye),this.center=t.center,this.up=t.up,H(this._viewport,t.viewport),this.notifyChange("_viewport"),H(this._padding,t.padding),this.notifyChange("_padding"),d(this._nearFar,t.nearFar),this.notifyChange("_nearFar"),this._fov=t.fov,this.row=t.row,this.column=t.column,this.rows=t.rows,this.columns=t.columns,this.relativeElevation=t.relativeElevation;const i=t;return this._viewDirty=i._viewDirty,this._viewDirty||(a(this._viewMatrix,t.viewMatrix),this.notifyChange("_viewMatrix")),this._viewProjectionDirty=!0,this._frustumDirty=i._frustumDirty,this._frustumDirty||(X(this._frustum,t.frustum),this._frustumDirty=!1),i._viewInverseTransposeMatrixDirty?this._viewInverseTransposeMatrixDirty=!0:(a(this._viewInverseTransposeMatrix,t.viewInverseTransposeMatrix),this._viewInverseTransposeMatrixDirty=!1),H(this._fullViewport,t.fullViewport),this.pixelRatio=t.pixelRatio,this}copyViewFrom(t){this.eye=t.eye,this.center=t.center,this.up=t.up,this.fov=t.fov}clone(){return(new $).copyFrom(this)}equals(t){return D(this.eye,t.eye)&&D(this.center,t.center)&&D(this.up,t.up)&&U(this._viewport,t.viewport)&&U(this._padding,t.padding)&&y(this.nearFar,t.nearFar)&&this._fov===t.fov&&this.pixelRatio===t.pixelRatio&&this.relativeElevation===t.relativeElevation&&this.row===t.row&&this.column===t.column&&this.rows===t.rows&&this.columns===t.columns}almostEquals(t){const i=Math.max(1,1/this.pixelRatio,1/t.pixelRatio);if(Math.abs(t.fov-this._fov)>=.001||k(t.screenPadding,this.screenPadding)>=i||k(this.screenViewport,t.screenViewport)>=i||this.row!==t.row||this.column!==t.column||this.rows!==t.rows||this.columns!==t.columns)return!1;j(st,t.eye,t.center),j(ot,this.eye,this.center);const e=R(st,ot),r=P(st),s=P(ot),o=5e-4;return e*e>=(1-1e-10)*r*s&&V(t.eye,this.eye)<Math.max(r,s)*o*o}computeRenderPixelSizeAt(t){return this.computeRenderPixelSizeAtDist(this._viewDirectionDistance(t))}computeRenderPixelSizeAtDist(t){return t*this.perRenderPixelRatio}computeScreenPixelSizeAt(t){return this.computeScreenPixelSizeAtDist(this._viewDirectionDistance(t))}_viewDirectionDistance(t){return Math.abs(N(this.viewForward,m(st,t,this.eye)))}computeScreenPixelSizeAtDist(t){return t*this.perScreenPixelRatio}computeDistanceFromRadius(t,i){return t/Math.tan(Math.min(this.fovX,this.fovY)/(2*(i||1)))}getScreenCenter(t=s()){return t[0]=(this.padding[3]+this.width/2)/this.pixelRatio,t[1]=(this.padding[0]+this.height/2)/this.pixelRatio,t}getRenderCenter(t,i=.5,e=.5){return t[0]=this.padding[3]+this.width*i,t[1]=this.padding[2]+this.height*e,t[2]=.5,t}setGLViewport(t){const i=this.viewport,e=this.padding;t.setViewport(i[0]-e[3],i[1]-e[2],i[2]+e[1]+e[3],i[3]+e[0]+e[2])}applyProjection(t,i){t!==et&&M(et,t),et[3]=1,z(et,et,this.projectionMatrix);const e=Math.abs(et[3]);F(et,et,1/e);const s=this.fullViewport;i[0]=r(0,s[0]+s[2],.5+.5*et[0]),i[1]=r(0,s[1]+s[3],.5+.5*et[1]),i[2]=.5*(et[2]+1),i[3]=e}unapplyProjection(t,i){const e=this.fullViewport;et[0]=(t[0]/(e[0]+e[2])*2-1)*t[3],et[1]=(t[1]/(e[1]+e[3])*2-1)*t[3],et[2]=(2*t[2]-1)*t[3],et[3]=t[3],null!=this.inverseProjectionMatrix&&(z(et,et,this.inverseProjectionMatrix),i[0]=et[0],i[1]=et[1],i[2]=et[2])}projectToScreen(t,i){return this.projectToRenderScreen(t,nt),this.renderToScreen(nt,i),i}projectToRenderScreen(t,i){if(et[0]=t[0],et[1]=t[1],et[2]=t[2],et[3]=1,z(et,et,this.viewProjectionMatrix),0===et[3])return null;const e=et;F(e,e,1/Math.abs(et[3]));const s=this.fullViewport,o=r(0,s[0]+s[2],.5+.5*e[0]),n=r(0,s[1]+s[3],.5+.5*e[1]);return"x"in i?(i.x=o,i.y=n):(i[0]=o,i[1]=n,i.length>2&&(i[2]=.5*(e[2]+1))),i}unprojectFromScreen(t,i){return this.unprojectFromRenderScreen(this.screenToRender(t,nt),i)}unprojectFromRenderScreen(t,i){if(p(rt,this.projectionMatrix,this.viewMatrix),!u(rt,rt))return null;const e=this.fullViewport;return et[0]=2*(t[0]-e[0])/e[2]-1,et[1]=2*(t[1]-e[1])/e[3]-1,et[2]=2*t[2]-1,et[3]=1,z(et,et,rt),0===et[3]?null:(i[0]=et[0]/et[3],i[1]=et[1]/et[3],i[2]=et[2]/et[3],i)}constrainWindowSize(t,i,e,r){const s=t*this.pixelRatio,o=i*this.pixelRatio,n=Math.max(s-e/2,0),h=Math.max(this.fullHeight-o-r/2,0),a=-Math.min(s-e/2,0),p=-Math.min(this.fullHeight-o-r/2,0),u=e-a- -Math.min(this.fullWidth-s-e/2,0),l=r-p- -Math.min(o-r/2,0);return[Math.round(n),Math.round(h),Math.round(u),Math.round(l)]}computeUp(t){1===t?this._computeUpGlobal():this._computeUpLocal()}screenToRender(t,i){const e=t[0]*this.pixelRatio,r=this.fullHeight-t[1]*this.pixelRatio;return i[0]=e,i[1]=r,i}renderToScreen(t,i){const e=t[0]/this.pixelRatio,r=(this.fullHeight-t[1])/this.pixelRatio;i[0]=e,i[1]=r}sphereFrustumCoverage(t,i){const{center:e,eye:r,distance:s,fovY:o}=this,n=Math.abs(Math.PI/2-B(i,e,r));return t.frustumCoverage(n,s,o)}_computeUpGlobal(){m(st,this.center,this.eye);const t=C(this.center);t<1?D(this._up,A)&&(M(this._up,A),this._markViewDirty(),this.notifyChange("_up")):Math.abs(R(st,this.center))>.9999*C(st)*t||(b(ot,st,this.center),b(ot,ot,st),S(ot,ot),D(this._up,ot)||(M(this._up,ot),this.notifyChange("_up"),this._markViewDirty()))}_computeUpLocal(){T(st,this.eye,this.center),Math.abs(st[2])<=.9999&&(F(st,st,st[2]),f(st,-st[0],-st[1],1-st[2]),S(st,st),D(this._up,st)||(M(this._up,st),this.notifyChange("_up"),this._markViewDirty()))}_compareAndSetView(t,i,r=""){"number"==typeof t[0]&&isFinite(t[0])&&"number"==typeof t[1]&&isFinite(t[1])&&"number"==typeof t[2]&&isFinite(t[2])?D(t,i)||(M(i,t),this._markViewDirty(),r.length&&this.notifyChange(r)):e.getLogger("esri.views.3d.webgl-engine.lib.RenderCamera").warn("RenderCamera vector contains invalid number, ignoring value")}_markViewDirty(){this._viewDirty=!0,this._frustumDirty=!0,this._viewProjectionDirty=!0}_recomputeFrustum(){this._frustumDirty&&(q(this.viewMatrix,this.projectionMatrix,this._frustum),this._frustumDirty=!1)}_ensureViewClean(){this._viewDirty&&(c(this._viewMatrix,this.eye,this.center,this.up),this.notifyChange("_viewMatrix"),this._viewDirty=!1,this._viewInverseTransposeMatrixDirty=!0)}};t([n()],tt.prototype,"_viewport",void 0),t([n()],tt.prototype,"_padding",void 0),t([n()],tt.prototype,"_fov",void 0),t([n()],tt.prototype,"_nearFar",void 0),t([n()],tt.prototype,"_viewDirty",void 0),t([n()],tt.prototype,"_viewMatrix",void 0),t([n()],tt.prototype,"_pixelRatio",void 0),t([n()],tt.prototype,"pixelRatio",null),t([n()],tt.prototype,"row",void 0),t([n()],tt.prototype,"column",void 0),t([n()],tt.prototype,"_rows",void 0),t([n()],tt.prototype,"rows",null),t([n()],tt.prototype,"_columns",void 0),t([n()],tt.prototype,"columns",null),t([n()],tt.prototype,"eye",null),t([n()],tt.prototype,"center",null),t([n()],tt.prototype,"_center",void 0),t([n()],tt.prototype,"up",null),t([n()],tt.prototype,"_up",void 0),t([n()],tt.prototype,"viewMatrix",null),t([n({readOnly:!0})],tt.prototype,"viewForward",null),t([n({readOnly:!0})],tt.prototype,"viewUp",null),t([n({readOnly:!0})],tt.prototype,"viewRight",null),t([n({readOnly:!0})],tt.prototype,"nearFar",null),t([n()],tt.prototype,"near",null),t([n()],tt.prototype,"far",null),t([n()],tt.prototype,"viewport",null),t([n({readOnly:!0})],tt.prototype,"screenViewport",null),t([n({readOnly:!0})],tt.prototype,"screenPadding",null),t([n()],tt.prototype,"x",null),t([n()],tt.prototype,"y",null),t([n()],tt.prototype,"width",null),t([n()],tt.prototype,"height",null),t([n()],tt.prototype,"fullWidth",null),t([n()],tt.prototype,"fullHeight",null),t([n({readOnly:!0})],tt.prototype,"_aspect",null),t([n()],tt.prototype,"padding",null),t([n({readOnly:!0})],tt.prototype,"projectionMatrix",null),t([n({readOnly:!0})],tt.prototype,"inverseProjectionMatrix",null),t([n()],tt.prototype,"fov",null),t([n()],tt.prototype,"fovX",null),t([n()],tt.prototype,"fovY",null),t([n()],tt.prototype,"viewInverseTransposeMatrix",null),t([n({readOnly:!0})],tt.prototype,"_projectionMatrixInternal",null),t([n()],tt.prototype,"relativeElevation",void 0),tt=$=t([h("esri.views.3d.webgl.RenderCamera")],tt);const it=tt,et=Y(),rt=w(),st=I(),ot=I(),nt=o();export{it as default};
5
+ import{__decorate as t}from"tslib";import i from"../../../core/Accessor.js";import e from"../../../core/Logger.js";import{lerp as r}from"../../../core/mathUtils.js";import{createScreenPointArray as s,createRenderScreenPointArray3 as o}from"../../../core/screenUtils.js";import{property as n,subclass as h}from"../../../core/accessorSupport/decorators.js";import{copy as a,multiply as p,invert as u,transpose as l,frustum as _,equals as v,lookAt as c}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{create as w}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{copy as d,exactEquals as y}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as g}from"../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{e as m,h as f,D as x,d as M,m as D,a as j,g as R,x as P,w as V,j as F,b as C,f as b,n as S,E as T}from"../../../chunks/vec32.js";import{create as I,UNIT_Z as A}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{s as E,e as O,a as U,f as H,g as k,t as z}from"../../../chunks/vec42.js";import{fromValues as W,create as Y}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{create as L,copy as X,fromMatrix as q}from"../../../geometry/support/frustum.js";import{create as G}from"../../../geometry/support/ray.js";import{projectPointSignedLength as N}from"../../../geometry/support/vector.js";import{viewAngle as B}from"../state/utils/viewUtils.js";import{fovd2fovx as J,fovx2fovd as K,fovd2fovy as Q,fovy2fovd as Z}from"../webgl-engine/lib/fov.js";var $;let tt=$=class extends i{constructor(t){super(t),this._ray=G(),this._viewport=W(0,0,1,1),this._padding=W(0,0,0,0),this._fov=55/180*Math.PI,this._nearFar=g(1,1e3),this._viewDirty=!0,this._viewMatrix=w(),this._viewProjectionDirty=!0,this._viewProjectionMatrix=w(),this._viewInverseTransposeMatrixDirty=!0,this._viewInverseTransposeMatrix=w(),this._frustumDirty=!0,this._frustum=L(),this._fullViewport=Y(),this._pixelRatio=1,this.row=0,this.column=0,this._rows=1,this._columns=1,this._center=I(),this._up=I(),this.relativeElevation=0}get pixelRatio(){return this._pixelRatio}set pixelRatio(t){this._pixelRatio=t>0?t:1}get rows(){return this._rows}set rows(t){this._rows=Math.max(1,t)}get columns(){return this._columns}set columns(t){this._columns=Math.max(1,t)}get eye(){return this._ray.origin}set eye(t){this._compareAndSetView(t,this._ray.origin)}get center(){return this._center}set center(t){this._compareAndSetView(t,this._center,"_center")}get ray(){return m(this._ray.direction,this.center,this.eye),this._ray}get up(){return this._up}set up(t){this._compareAndSetView(t,this._up,"_up")}get viewMatrix(){return this._ensureViewClean(),this._viewMatrix}set viewMatrix(t){a(this._viewMatrix,t),this.notifyChange("_viewMatrix"),this._viewDirty=!1,this._viewInverseTransposeMatrixDirty=!0,this._viewProjectionDirty=!0,this._frustumDirty=!0}get viewForward(){return this._ensureViewClean(),f(I(),-this._viewMatrix[2],-this._viewMatrix[6],-this._viewMatrix[10])}get viewUp(){return this._ensureViewClean(),f(I(),this._viewMatrix[1],this._viewMatrix[5],this._viewMatrix[9])}get viewRight(){return this._ensureViewClean(),f(I(),this._viewMatrix[0],this._viewMatrix[4],this._viewMatrix[8])}get nearFar(){return this._nearFar}get near(){return this._nearFar[0]}set near(t){this._nearFar[0]!==t&&(this._nearFar[0]=t,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_nearFar"))}get far(){return this._nearFar[1]}set far(t){this._nearFar[1]!==t&&(this._nearFar[1]=t,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_nearFar"))}get viewport(){return this._viewport}set viewport(t){this.x=t[0],this.y=t[1],this.width=t[2],this.height=t[3]}get screenViewport(){if(1===this.pixelRatio)return this._viewport;const t=E(Y(),this._viewport,1/this.pixelRatio),i=this._get("screenViewport");return i&&O(t,i)?i:t}get screenPadding(){if(1===this.pixelRatio)return this._padding;const t=E(Y(),this._padding,1/this.pixelRatio),i=this._get("screenPadding");return i&&O(t,i)?i:t}get x(){return this._viewport[0]}set x(t){t+=this._padding[3],this._viewport[0]!==t&&(this._viewport[0]=t,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_viewport"))}get y(){return this._viewport[1]}set y(t){t+=this._padding[2],this._viewport[1]!==t&&(this._viewport[1]=t,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_viewport"))}get width(){return this._viewport[2]}set width(t){this._viewport[2]!==t&&(this._viewport[2]=t,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_viewport"))}get height(){return this._viewport[3]}set height(t){this._viewport[3]!==t&&(this._viewport[3]=t,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_viewport"))}get fullWidth(){return this._viewport[2]+this._padding[1]+this._padding[3]}set fullWidth(t){this.width=t-(this._padding[1]+this._padding[3])}get fullHeight(){return this._viewport[3]+this._padding[0]+this._padding[2]}set fullHeight(t){this.height=t-(this._padding[0]+this._padding[2])}get fullViewport(){return this._fullViewport[0]=this._viewport[0]-this._padding[3],this._fullViewport[1]=this._viewport[1]-this._padding[2],this._fullViewport[2]=this.fullWidth,this._fullViewport[3]=this.fullHeight,this._fullViewport}get _aspect(){return this.width/this.height}get padding(){return this._padding}set padding(t){U(this._padding,t)||(this._viewport[0]+=t[3]-this._padding[3],this._viewport[1]+=t[2]-this._padding[2],this._viewport[2]-=t[1]+t[3]-(this._padding[1]+this._padding[3]),this._viewport[3]-=t[0]+t[2]-(this._padding[0]+this._padding[2]),H(this._padding,t),this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_padding"),this.notifyChange("_viewport"))}get viewProjectionMatrix(){return this._viewProjectionDirty&&(p(this._viewProjectionMatrix,this.projectionMatrix,this.viewMatrix),this._viewProjectionDirty=!1),this._viewProjectionMatrix}get projectionMatrix(){return this._projectionMatrixInternal}get inverseProjectionMatrix(){return u(w(),this.projectionMatrix)||this._get("inverseProjectionMatrix")||w()}get fov(){return this._fov}set fov(t){this._fov=t,this._viewProjectionDirty=!0,this._frustumDirty=!0}get fovX(){return J(this._fov,this.width,this.height)}set fovX(t){this._fov=K(t,this.width,this.height),this._viewProjectionDirty=!0,this._frustumDirty=!0}get fovY(){return Q(this._fov,this.width,this.height)}set fovY(t){this._fov=Z(t,this.width,this.height),this._viewProjectionDirty=!0,this._frustumDirty=!0}get distance(){return x(this.center,this.eye)}get frustum(){return this._recomputeFrustum(),this._frustum}get viewInverseTransposeMatrix(){return(this._viewInverseTransposeMatrixDirty||this._viewDirty)&&(u(this._viewInverseTransposeMatrix,this.viewMatrix),l(this._viewInverseTransposeMatrix,this._viewInverseTransposeMatrix),this._viewInverseTransposeMatrixDirty=!1),this._viewInverseTransposeMatrix}depthNDCToWorld(t){const{near:i,far:e}=this;return 2*i*e/(e+i-t*(e-i))}get perRenderPixelRatio(){return Math.tan(this.fovX/2)/(this.width/2)}get perScreenPixelRatio(){return this.perRenderPixelRatio*this.pixelRatio}get aboveGround(){return null!=this.relativeElevation&&this.relativeElevation>=0}get _projectionMatrixInternal(){const t=this.width,i=this.height,e=this.near*Math.tan(this.fovY/2)*2,r=e*this._aspect,s=e/this.rows,o=r/this.columns,n=-r/2+this.column*o,h=n+o,a=-e/2+this.row*s,p=a+s,u=_(w(),n*(1+2*this._padding[3]/t),h*(1+2*this._padding[1]/t),a*(1+2*this._padding[2]/i),p*(1+2*this._padding[0]/i),this.near,this.far),l=this._get("projectionMatrix");return l&&v(l,u)?l:u}copyFrom(t){M(this._ray.origin,t.eye),this.center=t.center,this.up=t.up,H(this._viewport,t.viewport),this.notifyChange("_viewport"),H(this._padding,t.padding),this.notifyChange("_padding"),d(this._nearFar,t.nearFar),this.notifyChange("_nearFar"),this._fov=t.fov,this.row=t.row,this.column=t.column,this.rows=t.rows,this.columns=t.columns,this.relativeElevation=t.relativeElevation;const i=t;return this._viewDirty=i._viewDirty,this._viewDirty||(a(this._viewMatrix,t.viewMatrix),this.notifyChange("_viewMatrix")),this._viewProjectionDirty=!0,this._frustumDirty=i._frustumDirty,this._frustumDirty||(X(this._frustum,t.frustum),this._frustumDirty=!1),i._viewInverseTransposeMatrixDirty?this._viewInverseTransposeMatrixDirty=!0:(a(this._viewInverseTransposeMatrix,t.viewInverseTransposeMatrix),this._viewInverseTransposeMatrixDirty=!1),H(this._fullViewport,t.fullViewport),this.pixelRatio=t.pixelRatio,this}copyViewFrom(t){this.eye=t.eye,this.center=t.center,this.up=t.up,this.fov=t.fov}clone(){return(new $).copyFrom(this)}equals(t){return D(this.eye,t.eye)&&D(this.center,t.center)&&D(this.up,t.up)&&U(this._viewport,t.viewport)&&U(this._padding,t.padding)&&y(this.nearFar,t.nearFar)&&this._fov===t.fov&&this.pixelRatio===t.pixelRatio&&this.relativeElevation===t.relativeElevation&&this.row===t.row&&this.column===t.column&&this.rows===t.rows&&this.columns===t.columns}almostEquals(t){const i=Math.max(1,1/this.pixelRatio,1/t.pixelRatio);if(Math.abs(t.fov-this._fov)>=.001||k(t.screenPadding,this.screenPadding)>=i||k(this.screenViewport,t.screenViewport)>=i||this.row!==t.row||this.column!==t.column||this.rows!==t.rows||this.columns!==t.columns)return!1;j(st,t.eye,t.center),j(ot,this.eye,this.center);const e=R(st,ot),r=P(st),s=P(ot),o=5e-4;return e*e>=(1-1e-10)*r*s&&V(t.eye,this.eye)<Math.max(r,s)*o*o}computeRenderPixelSizeAt(t){return this.computeRenderPixelSizeAtDist(this._viewDirectionDistance(t))}computeRenderPixelSizeAtDist(t){return t*this.perRenderPixelRatio}computeScreenPixelSizeAt(t){return this.computeScreenPixelSizeAtDist(this._viewDirectionDistance(t))}_viewDirectionDistance(t){return Math.abs(N(this.viewForward,m(st,t,this.eye)))}computeScreenPixelSizeAtDist(t){return t*this.perScreenPixelRatio}computeDistanceFromRadius(t,i){return t/Math.tan(Math.min(this.fovX,this.fovY)/(2*(i||1)))}getScreenCenter(t=s()){return t[0]=(this.padding[3]+this.width/2)/this.pixelRatio,t[1]=(this.padding[0]+this.height/2)/this.pixelRatio,t}getRenderCenter(t,i=.5,e=.5){return t[0]=this.padding[3]+this.width*i,t[1]=this.padding[2]+this.height*e,t[2]=.5,t}setGLViewport(t){const i=this.viewport,e=this.padding;t.setViewport(i[0]-e[3],i[1]-e[2],i[2]+e[1]+e[3],i[3]+e[0]+e[2])}applyProjection(t,i){t!==et&&M(et,t),et[3]=1,z(et,et,this.projectionMatrix);const e=Math.abs(et[3]);F(et,et,1/e);const s=this.fullViewport;i[0]=r(0,s[0]+s[2],.5+.5*et[0]),i[1]=r(0,s[1]+s[3],.5+.5*et[1]),i[2]=.5*(et[2]+1),i[3]=e}unapplyProjection(t,i){const e=this.fullViewport;et[0]=(t[0]/(e[0]+e[2])*2-1)*t[3],et[1]=(t[1]/(e[1]+e[3])*2-1)*t[3],et[2]=(2*t[2]-1)*t[3],et[3]=t[3],null!=this.inverseProjectionMatrix&&(z(et,et,this.inverseProjectionMatrix),i[0]=et[0],i[1]=et[1],i[2]=et[2])}projectToScreen(t,i){return this.projectToRenderScreen(t,nt),this.renderToScreen(nt,i),i}projectToRenderScreen(t,i){if(et[0]=t[0],et[1]=t[1],et[2]=t[2],et[3]=1,z(et,et,this.viewProjectionMatrix),0===et[3])return null;const e=et;F(e,e,1/Math.abs(et[3]));const s=this.fullViewport,o=r(0,s[0]+s[2],.5+.5*e[0]),n=r(0,s[1]+s[3],.5+.5*e[1]);return"x"in i?(i.x=o,i.y=n):(i[0]=o,i[1]=n,i.length>2&&(i[2]=.5*(e[2]+1))),i}unprojectFromScreen(t,i){return this.unprojectFromRenderScreen(this.screenToRender(t,nt),i)}unprojectFromRenderScreen(t,i){if(p(rt,this.projectionMatrix,this.viewMatrix),!u(rt,rt))return null;const e=this.fullViewport;return et[0]=2*(t[0]-e[0])/e[2]-1,et[1]=2*(t[1]-e[1])/e[3]-1,et[2]=2*t[2]-1,et[3]=1,z(et,et,rt),0===et[3]?null:(i[0]=et[0]/et[3],i[1]=et[1]/et[3],i[2]=et[2]/et[3],i)}constrainWindowSize(t,i,e,r){const s=t*this.pixelRatio,o=i*this.pixelRatio,n=Math.max(s-e/2,0),h=Math.max(this.fullHeight-o-r/2,0),a=-Math.min(s-e/2,0),p=-Math.min(this.fullHeight-o-r/2,0),u=e-a- -Math.min(this.fullWidth-s-e/2,0),l=r-p- -Math.min(o-r/2,0);return[Math.round(n),Math.round(h),Math.round(u),Math.round(l)]}computeUp(t){1===t?this._computeUpGlobal():this._computeUpLocal()}screenToRender(t,i){const e=t[0]*this.pixelRatio,r=this.fullHeight-t[1]*this.pixelRatio;return i[0]=e,i[1]=r,i}renderToScreen(t,i){const e=t[0]/this.pixelRatio,r=(this.fullHeight-t[1])/this.pixelRatio;i[0]=e,i[1]=r}sphereFrustumCoverage(t,i){const{center:e,eye:r,distance:s,fovY:o}=this,n=Math.abs(Math.PI/2-B(i,e,r));return t.frustumCoverage(n,s,o)}_computeUpGlobal(){m(st,this.center,this.eye);const t=C(this.center);t<1?D(this._up,A)&&(M(this._up,A),this._markViewDirty(),this.notifyChange("_up")):Math.abs(R(st,this.center))>.9999*C(st)*t||(b(ot,st,this.center),b(ot,ot,st),S(ot,ot),D(this._up,ot)||(M(this._up,ot),this.notifyChange("_up"),this._markViewDirty()))}_computeUpLocal(){T(st,this.eye,this.center),Math.abs(st[2])<=.9999&&(F(st,st,st[2]),f(st,-st[0],-st[1],1-st[2]),S(st,st),D(this._up,st)||(M(this._up,st),this.notifyChange("_up"),this._markViewDirty()))}_compareAndSetView(t,i,r=""){"number"==typeof t[0]&&isFinite(t[0])&&"number"==typeof t[1]&&isFinite(t[1])&&"number"==typeof t[2]&&isFinite(t[2])?D(t,i)||(M(i,t),this._markViewDirty(),r.length&&this.notifyChange(r)):e.getLogger("esri.views.3d.webgl-engine.lib.RenderCamera").warn("RenderCamera vector contains invalid number, ignoring value")}_markViewDirty(){this._viewDirty=!0,this._frustumDirty=!0,this._viewProjectionDirty=!0}_recomputeFrustum(){this._frustumDirty&&(q(this.viewMatrix,this.projectionMatrix,this._frustum),this._frustumDirty=!1)}_ensureViewClean(){this._viewDirty&&(c(this._viewMatrix,this.eye,this.center,this.up),this.notifyChange("_viewMatrix"),this._viewDirty=!1,this._viewInverseTransposeMatrixDirty=!0)}};t([n()],tt.prototype,"_viewport",void 0),t([n()],tt.prototype,"_padding",void 0),t([n()],tt.prototype,"_fov",void 0),t([n()],tt.prototype,"_nearFar",void 0),t([n()],tt.prototype,"_viewDirty",void 0),t([n()],tt.prototype,"_viewMatrix",void 0),t([n()],tt.prototype,"_pixelRatio",void 0),t([n()],tt.prototype,"pixelRatio",null),t([n()],tt.prototype,"row",void 0),t([n()],tt.prototype,"column",void 0),t([n()],tt.prototype,"_rows",void 0),t([n()],tt.prototype,"rows",null),t([n()],tt.prototype,"_columns",void 0),t([n()],tt.prototype,"columns",null),t([n()],tt.prototype,"eye",null),t([n()],tt.prototype,"center",null),t([n()],tt.prototype,"_center",void 0),t([n()],tt.prototype,"up",null),t([n()],tt.prototype,"_up",void 0),t([n()],tt.prototype,"viewMatrix",null),t([n({readOnly:!0})],tt.prototype,"viewForward",null),t([n({readOnly:!0})],tt.prototype,"viewUp",null),t([n({readOnly:!0})],tt.prototype,"viewRight",null),t([n({readOnly:!0})],tt.prototype,"nearFar",null),t([n()],tt.prototype,"near",null),t([n()],tt.prototype,"far",null),t([n()],tt.prototype,"viewport",null),t([n({readOnly:!0})],tt.prototype,"screenViewport",null),t([n({readOnly:!0})],tt.prototype,"screenPadding",null),t([n()],tt.prototype,"x",null),t([n()],tt.prototype,"y",null),t([n()],tt.prototype,"width",null),t([n()],tt.prototype,"height",null),t([n()],tt.prototype,"fullWidth",null),t([n()],tt.prototype,"fullHeight",null),t([n({readOnly:!0})],tt.prototype,"_aspect",null),t([n()],tt.prototype,"padding",null),t([n({readOnly:!0})],tt.prototype,"projectionMatrix",null),t([n({readOnly:!0})],tt.prototype,"inverseProjectionMatrix",null),t([n()],tt.prototype,"fov",null),t([n()],tt.prototype,"fovX",null),t([n()],tt.prototype,"fovY",null),t([n()],tt.prototype,"viewInverseTransposeMatrix",null),t([n({readOnly:!0})],tt.prototype,"_projectionMatrixInternal",null),t([n()],tt.prototype,"relativeElevation",void 0),tt=$=t([h("esri.views.3d.webgl.RenderCamera")],tt);const it=tt,et=Y(),rt=w(),st=I(),ot=I(),nt=o();export{it as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import"../../../../core/has.js";import e from"../../../../core/Logger.js";import{ManagedColorAttachment as t}from"../../webgl/ManagedColorAttachment.js";import{ManagedDepthTexture as a}from"../../webgl/ManagedDepthTexture.js";import r from"../../webgl/ManagedFBO.js";import{isDepthFormat as c,formatString as h,DepthTextureFormats as s,ColorFormats as i}from"./FBOCacheFormats.js";import{FBOPool as o}from"./FBOPool.js";import{DepthStencilAttachment as n,ColorAttachment0 as l}from"../../../webgl/enums.js";import{FramebufferObject as u}from"../../../webgl/FramebufferObject.js";import{Texture as m}from"../../../webgl/Texture.js";class d{constructor(e){this.rctx=e,this._interactive=!1,this._usage=new Map,this._acquired=new Set,this._cache=new o(e.newCache,"FBOCache"),this._depthCache=new o(e.newCache,"DepthAttachmentCache"),this._colorCache=new o(e.newCache,"ColorAttachmentCache")}destroy(){this._cache.destroy(),this._depthCache.destroy(),this._colorCache.destroy()}clean(){this._cache.clean(),this._colorCache.clean(),this._depthCache.clean()}frameStart(){this._cache.frame(),this._colorCache.frame(),this._depthCache.frame(),this.debugCallback?.(),this._usage.clear()}frameEnd(){const{debugCallback:e}=this;e&&this._acquired.forEach(t=>e(t.name,t.fbo,this._usage))}get usedMemory(){return Array.from(this._acquired.values()).reduce((e,t)=>e+t.usedMemory,this._cache.usedMemory+this._colorCache.usedMemory+this._depthCache.usedMemory)}set interactive(e){this._cache.interactive=this._colorCache.interactive=this._depthCache.interactive=e,this._interactive=e}get interactive(){return this._interactive}acquire(t,a,s,i=5){const o=f(i,t,a);let m=this._cache.pop(o);const{rctx:d}=this;if(m){m.retain(),m.setName(s);const t=m.getAttachment(n);t&&(t.name=g);const a=m.getAttachment(l);a&&(a.name=_(0));const r=m.fbo;r?d.temporaryBindFramebufferObject(r,()=>{d.setDrawBuffers([l]),d.unbindTexture(r.colorTexture)}):e.getLogger("esri.views.3d.webgl-engine.core.FBOCache").errorOnce("Encountered an invalid cached framebuffer")}else{const e=new u(d),h=(e,r,c)=>{r??=5;const h=this._acquireColor(r,t,a,c??_(e-l));return this.rctx.unbindTexture(h.attachment),m.attachColor(h,e),h.release(),m},p=e=>{e??=13;const r=this.acquireDepth(e,t,a,g);return m.attachDepth(r),r.release(),m},f=()=>{if(!m)return;this.debugCallback?.(m.name,m.fbo),this._acquired.delete(m);const e=c(i);e&&null!=m.getAttachment(n)||!e&&null!=m.getAttachment(l)?(e?(m.fbo?.invalidateAttachments([n]),m.detachAllColors()):(m.fbo?.invalidateAttachments([l]),m.detachAllButColor0()),this._cache.put(m)):m.dispose()};m=new r(o,s,e,h,p,f),c(i)?m.acquireDepth(i):m.acquireColor(l,i)}return this._trackUsage(m,"fbo "+h(i),t,a),this._trackHandle(m)}acquireDepth(e,t,r,c){const i=f(e,t,r);let o=this._depthCache.pop(i);if(o)o.retain(),o.attachment.setShadowFiltering(!1);else{const c=new m(this.rctx,{...s[e],width:t,height:r});o=new a(i,c,()=>this._depthCache.put(o))}return o.name=c,this._trackUsage(o,"depth "+h(e),t,r),o}_acquireColor(e,a,r,c){const s=f(e,a,r);let o=this._colorCache.pop(s);if(o)o.retain();else{const c=new m(this.rctx,{...i[e],width:a,height:r});o=new t(s,c,()=>this._colorCache.put(o))}return o.name=c,this._trackUsage(o,"color "+h(e),a,r),o}_trackHandle(e){return this._acquired.add(e),e}_trackUsage(e,t,a,r){this.debugCallback&&(this._usage.has(e)?this._usage.get(e)[2].push(e.name):this._usage.set(e,[t,`${a}x${r}`,[e.name]]))}get test(){return null}}function _(e=0){return`color${e}`}const g="depth",p=new r("default","default",null,()=>p,()=>p,()=>{});function f(e,t,a){return`${t}x${a}:${e}`}p.release=()=>!1;export{d as FBOCache,p as defaultWebGLFBO};
5
+ import"../../../../core/has.js";import e from"../../../../core/Logger.js";import{ManagedColorAttachment as t}from"../../webgl/ManagedColorAttachment.js";import{ManagedDepthTexture as a}from"../../webgl/ManagedDepthTexture.js";import r from"../../webgl/ManagedFBO.js";import{isDepthFormat as c,formatString as h,DepthTextureFormats as s,ColorFormats as i}from"./FBOCacheFormats.js";import{FBOPool as o}from"./FBOPool.js";import{DepthStencilAttachment as n,ColorAttachment0 as l}from"../../../webgl/enums.js";import{FramebufferObject as u}from"../../../webgl/FramebufferObject.js";import{Texture as m}from"../../../webgl/Texture.js";class d{constructor(e){this.rctx=e,this._interactive=!1,this._usage=new Map,this._acquired=new Set,this._cache=new o(e.newCache,"FBOCache"),this._depthCache=new o(e.newCache,"DepthAttachmentCache"),this._colorCache=new o(e.newCache,"ColorAttachmentCache")}destroy(){this._cache.destroy(),this._depthCache.destroy(),this._colorCache.destroy()}clean(){this._cache.clean(),this._colorCache.clean(),this._depthCache.clean()}frameStart(){this._cache.frame(),this._colorCache.frame(),this._depthCache.frame(),this.debugCallback?.(),this._usage.clear()}frameEnd(){const{debugCallback:e}=this;e&&this._acquired.forEach(t=>e(t.name,t.fbo,this._usage))}get usedMemory(){return Array.from(this._acquired.values()).reduce((e,t)=>e+t.usedMemory,this._cache.usedMemory+this._colorCache.usedMemory+this._depthCache.usedMemory)}set interactive(e){this._cache.interactive=this._colorCache.interactive=this._depthCache.interactive=e,this._interactive=e}get interactive(){return this._interactive}acquire(t,a,s,i=5){const o=f(i,t,a);let m=this._cache.pop(o);const{rctx:d}=this;if(m){m.retain(),m.setName(s);const t=m.getAttachment(n);t&&(t.name=g);const a=m.getAttachment(l);a&&(a.name=_(0));const r=m.fbo;r?d.temporaryBindFramebufferObject(r,()=>{d.setDrawBuffers([l]),d.unbindTexture(r.colorTexture)}):e.getLogger("esri.views.3d.webgl-engine.core.FBOCache").errorOnce("Encountered an invalid cached framebuffer")}else{const e=new u(d),h=(e,r,c)=>{r??=5;const h=this._acquireColor(r,t,a,c??_(e-l));return this.rctx.unbindTexture(h.attachment),m.attachColor(h,e),h.release(),m},p=e=>{e??=13;const r=this.acquireDepth(e,t,a,g);return m.attachDepth(r),r.release(),m},f=()=>{if(!m)return;this.debugCallback?.(m.name,m.fbo),this._acquired.delete(m);const e=c(i);e&&null!=m.getAttachment(n)||!e&&null!=m.getAttachment(l)?(e?(m.fbo?.invalidateAttachments([n]),m.detachAllColors()):(m.fbo?.invalidateAttachments([l]),m.detachAllButColor0()),this._cache.put(m)):m.dispose()};m=new r(o,s,e,h,p,f),c(i)?m.acquireDepth(i):m.acquireColor(l,i)}return this._trackUsage(m,"fbo "+h(i),t,a),this._trackHandle(m)}acquireDepth(e,t,r,c){const i=f(e,t,r);let o=this._depthCache.pop(i);if(o)o.retain(),o.attachment.setShadowFiltering(!1);else{const c=new m(this.rctx,{...s[e],width:t,height:r});o=new a(i,c,()=>this._depthCache.put(o))}return o.name=c,this._trackUsage(o,"depth "+h(e),t,r),o}_acquireColor(e,a,r,c){const s=f(e,a,r);let o=this._colorCache.pop(s);if(o)o.retain();else{const c=new m(this.rctx,{...i[e],width:a,height:r,isImmutable:!0});o=new t(s,c,()=>this._colorCache.put(o))}return o.name=c,this._trackUsage(o,"color "+h(e),a,r),o}_trackHandle(e){return this._acquired.add(e),e}_trackUsage(e,t,a,r){this.debugCallback&&(this._usage.has(e)?this._usage.get(e)[2].push(e.name):this._usage.set(e,[t,`${a}x${r}`,[e.name]]))}get test(){return null}}function _(e=0){return`color${e}`}const g="depth",p=new r("default","default",null,()=>p,()=>p,()=>{});function f(e,t,a){return`${t}x${a}:${e}`}p.release=()=>!1;export{d as FBOCache,p as defaultWebGLFBO};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import{lerp as t,clamp as s,smoothstep as i}from"../../../../../core/mathUtils.js";import{disposeMaybe as r}from"../../../../../core/maybe.js";import{watch as a,syncAndInitial as o}from"../../../../../core/reactiveUtils.js";import{subclass as n}from"../../../../../core/accessorSupport/decorators.js";import{set as h}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{b as m,E as p}from"../../../../../chunks/vec32.js";import{c}from"../../../../../chunks/vec42.js";import{earth as d}from"../../../../../geometry/support/Ellipsoid.js";import{InternalRenderCategory as u}from"../../../webgl.js";import{TransparentEnvironment as f}from"../TransparentEnvironment.js";import{H as _}from"../../../../../chunks/HazeCompositing.glsl.js";import{HazeCompositingTechnique as l}from"./HazeCompositingTechnique.js";import{HazePassParameters as g,HazeTechnique as b}from"./HazeTechnique.js";import{HazeTechniqueConfiguration as w}from"./HazeTechniqueConfiguration.js";import{createQuadVAO as P}from"../../lib/glUtil3D.js";import{applyTextureResizeModulo as v}from"../../lib/textureUtils.js";import{DepthStencilAttachment as j,PrimitiveType as A}from"../../../../webgl/enums.js";let T=class extends f{constructor(e){super(e),this._compositingPassParameters=new _,this._passParameters=new g,this._hazeConfiguration=new w,this.requireGeometryDepth=!0,this._oldAmount=1,this._newAmount=1,this._amount=this._newAmount;const t=e.view.stage.renderView.techniques;t.precompile(b,new w);const s=new w;s.reduced=!0,t.precompile(b,s),t.precompile(l)}initialize(){this.addHandles([a(()=>this.view.environment.atmosphereEnabled,e=>e?this._enable():this._disable(),o),a(()=>this.view.stage?.renderer.renderContext.bind.clouds.fadeFactor??1,e=>this._fade(e),o),a(()=>this.view.environment.weather.type,e=>this._newAmount="rainy"===e?0:1,o),a(()=>this.view.stage.renderer?.highResolutionAtmosphere,e=>this._hazeConfiguration.reduced=!e,o)])}_fade(e){e>=1?(this._amount=this._newAmount,this._oldAmount=this._newAmount):this._amount=e<=0?this._oldAmount:t(this._oldAmount,this._newAmount,e)}destroy(){this._vao=r(this._vao)}render(e){const s=e.find(({name:e})=>e===u.TRANSPARENT_ENVIRONMENT);if(!this.bindParameters.mainDepth)return s;const i=this.renderingContext,r=this.techniques.get(b,this._hazeConfiguration);if(!r.compiled)return s;const a=s.getAttachment(j);if(this._update(),!this._hazeConfiguration.reduced)return s.detachDepth(),i.bindFramebuffer(s.fbo),i.bindTechnique(r,this.bindParameters,this._passParameters),this._renderCommon(i),s.attachDepth(a),s;const o=this.techniques.get(l);if(!o.compiled)return s;const n=i.getViewport(),h=this.camera,p=m(h.eye)-d.radius;let c;const f=d.atmosphereHeight;if(p<f){const e=Math.min(1,Math.max(0,p/f));c=t(.4,.5,e)}else{const e=Math.min(1,Math.max(0,(p-f)/(15*f)));c=t(.5,1,e)}const _=this.renderingContext.parameters.maxTextureSize,g=v(Math.round(c*h.fullViewport[2]),_),w=v(Math.round(c*h.fullViewport[3]),_);i.setViewport(0,0,g,w);const P=this.fboCache.acquire(g,w,"haze",5);return i.bindFramebuffer(P.fbo),i.clearFramebuffer([0,0,0,1],!0,!0),i.bindTechnique(r,this.bindParameters,this._passParameters),this._renderCommon(i),i.setViewport(n.x,n.y,n.width,n.height),this._compositingPassParameters.color=P.getTexture(),s.detachDepth(),i.bindFramebuffer(s.fbo),i.bindTechnique(o,this.bindParameters,this._compositingPassParameters),i.screen.draw(),s.attachDepth(a),P.release(),s}_renderCommon(e){this._vao??=P(e,1),e.bindVAO(this._vao),e.drawArrays(A.TRIANGLE_STRIP,0,4)}_update(){const e=this.bindParameters.camera,r=p(e.eye),a=Math.sqrt(r),o=r-this._passParameters.radii[1]*this._passParameters.radii[1],n=s((a-this._passParameters.radii[0])/d.atmosphereHeight,0,1);c(this._passParameters.heightParameters,a,r,o,n);const m=this.view.basemapTerrain?.getLowerBoundRadius()??0;h(this._passParameters.radii,m,m+d.atmosphereHeight),this._passParameters.hazeStrength=t(t(.6,1,i(9500,10500,a-d.radius)),1,this._amount)}};T=e([n("esri.views.3d.webgl-engine.effects.haze.Haze")],T);export{T as Haze};
5
+ import{__decorate as e}from"tslib";import{lerp as t,clamp as s,smoothstep as i}from"../../../../../core/mathUtils.js";import{disposeMaybe as r}from"../../../../../core/maybe.js";import{watch as a,syncAndInitial as o}from"../../../../../core/reactiveUtils.js";import{subclass as n}from"../../../../../core/accessorSupport/decorators.js";import{set as h}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{b as m,F as p}from"../../../../../chunks/vec32.js";import{c}from"../../../../../chunks/vec42.js";import{earth as d}from"../../../../../geometry/support/Ellipsoid.js";import{InternalRenderCategory as u}from"../../../webgl.js";import{TransparentEnvironment as f}from"../TransparentEnvironment.js";import{H as _}from"../../../../../chunks/HazeCompositing.glsl.js";import{HazeCompositingTechnique as l}from"./HazeCompositingTechnique.js";import{HazePassParameters as g,HazeTechnique as b}from"./HazeTechnique.js";import{HazeTechniqueConfiguration as w}from"./HazeTechniqueConfiguration.js";import{createQuadVAO as P}from"../../lib/glUtil3D.js";import{applyTextureResizeModulo as v}from"../../lib/textureUtils.js";import{DepthStencilAttachment as j,PrimitiveType as A}from"../../../../webgl/enums.js";let T=class extends f{constructor(e){super(e),this._compositingPassParameters=new _,this._passParameters=new g,this._hazeConfiguration=new w,this.requireGeometryDepth=!0,this._oldAmount=1,this._newAmount=1,this._amount=this._newAmount;const t=e.view.stage.renderView.techniques;t.precompile(b,new w);const s=new w;s.reduced=!0,t.precompile(b,s),t.precompile(l)}initialize(){this.addHandles([a(()=>this.view.environment.atmosphereEnabled,e=>e?this._enable():this._disable(),o),a(()=>this.view.stage?.renderer.renderContext.bind.clouds.fadeFactor??1,e=>this._fade(e),o),a(()=>this.view.environment.weather.type,e=>this._newAmount="rainy"===e?0:1,o),a(()=>this.view.stage.renderer?.highResolutionAtmosphere,e=>this._hazeConfiguration.reduced=!e,o)])}_fade(e){e>=1?(this._amount=this._newAmount,this._oldAmount=this._newAmount):this._amount=e<=0?this._oldAmount:t(this._oldAmount,this._newAmount,e)}destroy(){this._vao=r(this._vao)}render(e){const s=e.find(({name:e})=>e===u.TRANSPARENT_ENVIRONMENT);if(!this.bindParameters.mainDepth)return s;const i=this.renderingContext,r=this.techniques.get(b,this._hazeConfiguration);if(!r.compiled)return s;const a=s.getAttachment(j);if(this._update(),!this._hazeConfiguration.reduced)return s.detachDepth(),i.bindFramebuffer(s.fbo),i.bindTechnique(r,this.bindParameters,this._passParameters),this._renderCommon(i),s.attachDepth(a),s;const o=this.techniques.get(l);if(!o.compiled)return s;const n=i.getViewport(),h=this.camera,p=m(h.eye)-d.radius;let c;const f=d.atmosphereHeight;if(p<f){const e=Math.min(1,Math.max(0,p/f));c=t(.4,.5,e)}else{const e=Math.min(1,Math.max(0,(p-f)/(15*f)));c=t(.5,1,e)}const _=this.renderingContext.parameters.maxTextureSize,g=v(Math.round(c*h.fullViewport[2]),_),w=v(Math.round(c*h.fullViewport[3]),_);i.setViewport(0,0,g,w);const P=this.fboCache.acquire(g,w,"haze",5);return i.bindFramebuffer(P.fbo),i.clearFramebuffer([0,0,0,1],!0,!0),i.bindTechnique(r,this.bindParameters,this._passParameters),this._renderCommon(i),i.setViewport(n.x,n.y,n.width,n.height),this._compositingPassParameters.color=P.getTexture(),s.detachDepth(),i.bindFramebuffer(s.fbo),i.bindTechnique(o,this.bindParameters,this._compositingPassParameters),i.screen.draw(),s.attachDepth(a),P.release(),s}_renderCommon(e){this._vao??=P(e,1),e.bindVAO(this._vao),e.drawArrays(A.TRIANGLE_STRIP,0,4)}_update(){const e=this.bindParameters.camera,r=p(e.eye),a=Math.sqrt(r),o=r-this._passParameters.radii[1]*this._passParameters.radii[1],n=s((a-this._passParameters.radii[0])/d.atmosphereHeight,0,1);c(this._passParameters.heightParameters,a,r,o,n);const m=this.view.basemapTerrain?.getLowerBoundRadius()??0;h(this._passParameters.radii,m,m+d.atmosphereHeight),this._passParameters.hazeStrength=t(t(.6,1,i(9500,10500,a-d.radius)),1,this._amount)}};T=e([n("esri.views.3d.webgl-engine.effects.haze.Haze")],T);export{T as Haze};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as t}from"tslib";import e from"../../../../core/Logger.js";import{watch as s}from"../../../../core/reactiveUtils.js";import{property as i,subclass as a}from"../../../../core/accessorSupport/decorators.js";import{set as r}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{e as n,b as o,j as l,q as h,g as p,E as u,d as c,J as m}from"../../../../chunks/vec32.js";import{create as d,clone as _}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{c as f}from"../../../../chunks/vec42.js";import{create as g}from"../../../../geometry/support/plane.js";import{fromPoints as P}from"../../../../geometry/support/ray.js";import{Sphere as b}from"../../../../geometry/support/sphere.js";import{RenderCategory as S}from"../../webgl.js";import{GaussianSplatTarget as C}from"../../layers/i3s/Intersector.js";import{GaussianSplatDataStore as v}from"../../support/gaussianSplatting/GaussianSplatDataStore.js";import w from"../../webgl/RenderNode.js";import{IntersectorResult as D}from"./IntersectorResult.js";import{G as x}from"../../../../chunks/GaussianSplat.glsl.js";import{G as y}from"../../../../chunks/GaussianSplatComposition.glsl.js";import{GaussianSplatCompositionTechnique as E}from"../shaders/GaussianSplatCompositionTechnique.js";import{G as A}from"../../../../chunks/GaussianSplatDepthComposition.glsl.js";import{GaussianSplatDepthCompositionTechnique as q}from"../shaders/GaussianSplatDepthCompositionTechnique.js";import{GaussianSplatTechnique as T}from"../shaders/GaussianSplatTechnique.js";import{GaussianSplatTechniqueConfiguration as j}from"../shaders/GaussianSplatTechniqueConfiguration.js";import{ColorAttachment1 as G,DepthStencilAttachment as N,PrimitiveType as F}from"../../../webgl/enums.js";var O;const H=()=>e.getLogger("esri/views/3d/webgl-engine/lib/GaussianSplatRenderNode");let U=class extends w{static{O=this}constructor(t){super(t),this.gaussianPosition=d(),this.intersectionRayDir=d(),this.intersectionPlane=g(),this._slicePlaneEnabled=!1,this._data=null,this.produces=S.OPAQUE,this.type=0,this.isGround=!1,this.layerViewUid="",this._passParameters=new x,this._compositionPassParameters=new y,this._depthCompositionPassParameters=new A,this._previousCameraPosition=d(),this._previousCameraDirection=d(),this.fadeHelper=null,this._configuration=new j(t.view.state.isGlobal)}async initialize(){this._data=new v(this),this.view.sceneIntersectionHelper.addIntersectionHandler(this),this.addHandles([s(()=>this.view.state.camera,()=>this._onCameraChange())])}precompile(){this._configuration.alphaCutoff=this.view.qualitySettings.gaussianSplat.minimumOpacity,this._configuration.terrainDepthTest=this.bindParameters.terrainDepthTest,this._configuration.fadingEnabled=this.fadeHelper.fadingEnabled,this.techniques.precompile(T,this._configuration),this.techniques.precompile(E),this.techniques.precompile(q)}render(t){const e=t.find(({name:t})=>t===S.OPAQUE),s=this.renderingContext.capabilities.drawBuffersIndexed;if(!s)return H().warnOnce("Gaussian Splatting is not supported on this device."),e;if(this._handleFading(),!this._data.visibleGaussians||!this._data.orderTexture.texture||!this._data.textureAtlas.texture)return e;const i=this.techniques.get(T,this._configuration),a=this.techniques.get(E),n=this.techniques.get(q);if(!i.compiled||!n.compiled||!a.compiled)return this.requestRender(1),e;const{fullWidth:o,fullHeight:l}=this.bindParameters.camera,h=this.fboCache,p=h.acquire(o,l,"gaussian color output");p.acquireColor(G,8,"gaussian depth output"),p.attachDepth(e.getAttachment(N));const u=this.renderingContext;this._passParameters.totalGaussians=this._data.visibleGaussians,this._passParameters.splatOrder=this._data.orderTexture.texture,this._passParameters.splatFading=this._data.fadingTexture.texture,this._passParameters.splatAtlas=this._data.textureAtlas.texture;const c=Math.tan(.5*this.camera.fovY),m=c/l*o;r(this._passParameters.tanFov,m,c),this._passParameters.focalLength=l/(2*c);const d=this.view.qualitySettings.gaussianSplat.minimumSplatPixelRadius;this._passParameters.minSplatRadius=d*Math.sqrt(o*l)/Math.sqrt(2073600),this._prepareHighPrecisionCameraPosition(),u.bindFramebuffer(p.fbo),u.setClearColor(0,0,0,0),u.clear(16384),this.renderingContext.bindTechnique(i,this.bindParameters,this._passParameters);const _=u.gl;s.enableiOES(_.BLEND,0),s.blendEquationSeparateiOES(0,_.FUNC_ADD,_.FUNC_ADD),s.blendFuncSeparateiOES(0,_.ONE_MINUS_DST_ALPHA,_.ONE,_.ONE_MINUS_DST_ALPHA,_.ONE),s.enableiOES(_.BLEND,1),s.blendEquationSeparateiOES(1,_.FUNC_ADD,_.FUNC_ADD),s.blendFuncSeparateiOES(1,_.ONE_MINUS_DST_ALPHA,_.DST_ALPHA,_.ONE_MINUS_DST_ALPHA,_.ONE),this.renderingContext.drawArraysInstanced(F.TRIANGLE_STRIP,0,4,this._data.visibleGaussians);const f=h.acquire(o,l,this.produces);return this._depthCompositionPassParameters.splatDepth=p.getTexture(G),f.attachDepth(e.getAttachment(N)),u.bindFramebuffer(f.fbo),u.bindTechnique(n,this.bindParameters,this._depthCompositionPassParameters),u.screen.draw(),this._compositionPassParameters.color=e.getTexture(),this._compositionPassParameters.splatColor=p.getTexture(),u.bindFramebuffer(f.fbo),u.bindTechnique(a,this.bindParameters,this._compositionPassParameters),u.screen.draw(),p.release(),f}intersect(t,e,s,i){const{gaussianPosition:a,intersectionRayDir:r,intersectionPlane:c,layerViewUid:m}=this,g=P(s,i);n(r,i,s);const S=1/o(r);l(r,r,S);const v=d();h(v,r),f(c,r[0],r[1],r[2],-p(r,s));const w=new I,x=new I,y=new Array;this._data.visibleGaussianTiles.forEach(n=>{const{maxScale:o}=n,l=n.obb.minimumDistancePlane(c),h=n.obb.maximumDistancePlane(c),d=h<0,f=null!=w.dist&&null!=x.dist&&w.dist<l*S&&x.dist>h*S;if(d||f)return;if(!new b(n.obb.center,n.obb.radius+o).intersectRay(g,null))return;if(!n.obb.intersectRay(s,r,o))return;const{positions:P,squaredScales:C,gaussianAtlasIndices:D}=n,E=D.length;for(let c=0;c<E;c++){const n=3*c;a[0]=P[n]-s[0],a[1]=P[n+1]-s[1],a[2]=P[n+2]-s[2];const o=C[c],l=p(a,r),h=l*l;if(u(a)-h>o)continue;const d=l*S,f=t=>(t.point=t.point?t.point.fill(a[0],a[1],a[2]):_(a),t.dist=d,t.normal=v,t.layerViewUid=m,t);if((null==w.dist||d<w.dist)&&(null==e||e(s,i,d))&&f(w),0!==t.options.store&&(null==x.dist||d>x.dist)&&(null==e||e(s,i,d))&&f(x),2===t.options.store&&(null==e||e(s,i,d))){const t=new I;y.push(f(t))}}});const E=(t,e)=>{const{layerViewUid:s}=e,i=new C(e.point,s);t.set(0,i,e.dist,e.normal)};if(R(w)){const e=t.results.min;(null==e.distance||w.dist<e.distance)&&E(e,w)}if(R(x)&&0!==t.options.store){const e=t.results.max;(null==e.distance||x.dist>e.distance)&&E(e,x)}if(2===t.options.store)for(const n of y){const e=new D(g);E(e,n),t.results.all.push(e)}}get slicePlaneEnabled(){return this._slicePlaneEnabled}set slicePlaneEnabled(t){this._slicePlaneEnabled!==t&&(this._slicePlaneEnabled=t,this.requestRender(1))}get data(){return this._data}destroy(){this._data.destroy(),super.destroy()}_onCameraChange(){const t=this.view.state.camera.eye,e=this.view.state.camera.ray.direction,s=.001;(Math.abs(t[0]-this._previousCameraPosition[0])>s||Math.abs(t[1]-this._previousCameraPosition[1])>s||Math.abs(t[2]-this._previousCameraPosition[2])>s||Math.abs(e[0]-this._previousCameraDirection[0])>s||Math.abs(e[1]-this._previousCameraDirection[1])>s||Math.abs(e[2]-this._previousCameraDirection[2])>s)&&(c(this._previousCameraPosition,t),c(this._previousCameraDirection,e),this._data.requestSort())}_prepareHighPrecisionCameraPosition(){l(this._passParameters.tileCameraPosition,this.camera.eye,1/O.tileSize),m(this._passParameters.tileCameraPosition,this._passParameters.tileCameraPosition),l(this._passParameters.cameraDelta,this._passParameters.tileCameraPosition,O.tileSize),n(this._passParameters.cameraDelta,this.camera.eye,this._passParameters.cameraDelta)}_handleFading(){if(0===this.fadeHelper.numFadingTiles)return void(this._previousFrameStart=null);this._previousFrameStart??=this.view.stage.renderer.renderContext.time;const t=this.view.stage?.renderer.renderContext.time-this._previousFrameStart;this.fadeHelper.updateAllTileFading(t),this._previousFrameStart=this.view.stage.renderer.renderContext.time,this._data.fadingTexture.updateTexture(this._data.textureAtlas.pageAllocator.pageCount)}static{this.tileSize=2.048}};function R(t){return null!=t.dist&&null!=t.point}t([i({constructOnly:!0})],U.prototype,"fadeHelper",void 0),U=O=t([a("esri.views.3d.webgl-engine.lib.GaussianSplatRenderNode")],U);class I{constructor(){this.point=null,this.dist=null,this.normal=null,this.layerViewUid=""}}export{U as GaussianSplatRenderNode};
5
+ import{__decorate as e}from"tslib";import{watch as t}from"../../../../core/reactiveUtils.js";import{property as s,subclass as i}from"../../../../core/accessorSupport/decorators.js";import{set as a}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{e as r,b as n,j as o,q as l,g as h,F as u,d as c,J as p}from"../../../../chunks/vec32.js";import{create as d,clone as m}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{c as _}from"../../../../chunks/vec42.js";import{create as f}from"../../../../geometry/support/plane.js";import{fromPoints as g}from"../../../../geometry/support/ray.js";import{Sphere as b}from"../../../../geometry/support/sphere.js";import{RenderCategory as P}from"../../webgl.js";import{GaussianSplatTarget as C}from"../../layers/i3s/Intersector.js";import{GaussianSplatDataStore as S}from"../../support/gaussianSplatting/GaussianSplatDataStore.js";import w from"../../webgl/RenderNode.js";import{IntersectorResult as x}from"./IntersectorResult.js";import{G as v}from"../../../../chunks/GaussianSplat.glsl.js";import{GaussianSplatColorTechnique as y}from"../shaders/GaussianSplatColorTechnique.js";import{G as D}from"../../../../chunks/GaussianSplatComposition.glsl.js";import{GaussianSplatCompositionTechnique as q}from"../shaders/GaussianSplatCompositionTechnique.js";import{G as T}from"../../../../chunks/GaussianSplatDepthComposition.glsl.js";import{GaussianSplatDepthCompositionTechnique as A}from"../shaders/GaussianSplatDepthCompositionTechnique.js";import{GaussianSplatDepthTechnique as E}from"../shaders/GaussianSplatDepthTechnique.js";import{GaussianSplatTechnique as G}from"../shaders/GaussianSplatTechnique.js";import{GaussianSplatTechniqueConfiguration as O}from"../shaders/GaussianSplatTechniqueConfiguration.js";import{DepthStencilAttachment as j,ColorAttachment1 as F,PrimitiveType as N}from"../../../webgl/enums.js";var I;let H=class extends w{static{I=this}constructor(e){super(e),this.gaussianPosition=d(),this.intersectionRayDir=d(),this.intersectionPlane=f(),this._slicePlaneEnabled=!1,this._data=null,this.produces=P.OPAQUE,this.type=0,this.isGround=!1,this.layerViewUid="",this._passParameters=new v,this._compositionPassParameters=new D,this._depthCompositionPassParameters=new T,this._previousCameraPosition=d(),this._previousCameraDirection=d(),this.fadeHelper=null,this._configuration=new O(e.view.state.isGlobal),this._colorOnlyConfiguration=new O(e.view.state.isGlobal,!0),this._depthOnlyConfiguration=new O(e.view.state.isGlobal,!1,!0)}async initialize(){this._data=new S(this),this.view.sceneIntersectionHelper.addIntersectionHandler(this),this.addHandles([t(()=>this.view.state.camera,()=>this._onCameraChange())])}precompile(){const e=this.view.qualitySettings.gaussianSplat.minimumOpacity,t=this.bindParameters.terrainDepthTest,s=this.fadeHelper.fadingEnabled,i=s=>{s.alphaCutoff=e,s.terrainDepthTest=t};this.renderingContext.capabilities.drawBuffersIndexed?(i(this._configuration),this._configuration.fadingEnabled=s,this.techniques.precompile(G,this._configuration)):(i(this._colorOnlyConfiguration),this._colorOnlyConfiguration.fadingEnabled=s,this.techniques.precompile(y,this._colorOnlyConfiguration),i(this._depthOnlyConfiguration),this.techniques.precompile(E,this._depthOnlyConfiguration)),this.techniques.precompile(q),this.techniques.precompile(A)}render(e){const t=e.find(({name:e})=>e===P.OPAQUE);if(this._handleFading(),!this._data.visibleGaussians||!this._data.orderTexture.texture||!this._data.textureAtlas.texture)return t;const s=!!this.renderingContext.capabilities.drawBuffersIndexed,i=s?this.techniques.get(G,this._configuration):null,a=s?null:this.techniques.get(y,this._colorOnlyConfiguration),r=s?null:this.techniques.get(E,this._depthOnlyConfiguration),n=this.techniques.get(q),o=this.techniques.get(A);if(!(i?.compiled||a?.compiled&&r?.compiled)||!o.compiled||!n.compiled)return this.requestRender(1),t;const{fullWidth:l,fullHeight:h}=this.bindParameters.camera;this._prepareParameters(h,l);const u=this.renderingContext,c=this.fboCache,p=c.acquire(l,h,"gaussian color output"),d=t.getAttachment(j);p.attachDepth(d);let m=null;s?this._singlePass(p,i):m=this._multiPass(p,d,a,r);const _=c.acquire(l,h,this.produces);return this._depthCompositionPassParameters.splatDepth=m?m.getTexture():p.getTexture(F),_.attachDepth(t.getAttachment(j)),u.bindFramebuffer(_.fbo),u.bindTechnique(o,this.bindParameters,this._depthCompositionPassParameters),u.screen.draw(),this._compositionPassParameters.color=t.getTexture(),this._compositionPassParameters.splatColor=p.getTexture(),u.bindFramebuffer(_.fbo),u.bindTechnique(n,this.bindParameters,this._compositionPassParameters),u.screen.draw(),p.release(),m?.release(),_}intersect(e,t,s,i){const{gaussianPosition:a,intersectionRayDir:c,intersectionPlane:p,layerViewUid:f}=this,P=g(s,i);r(c,i,s);const S=1/n(c);o(c,c,S);const w=d();l(w,c),_(p,c[0],c[1],c[2],-h(c,s));const v=new U,y=new U,D=new Array;this._data.visibleGaussianTiles.forEach(r=>{const{maxScale:n}=r,o=r.obb.minimumDistancePlane(p),l=r.obb.maximumDistancePlane(p),d=l<0,_=null!=v.dist&&null!=y.dist&&v.dist<o*S&&y.dist>l*S;if(d||_)return;if(!new b(r.obb.center,r.obb.radius+n).intersectRay(P,null))return;if(!r.obb.intersectRay(s,c,n))return;const{positions:g,squaredScales:C,gaussianAtlasIndices:x}=r,q=x.length;for(let p=0;p<q;p++){const r=3*p;a[0]=g[r]-s[0],a[1]=g[r+1]-s[1],a[2]=g[r+2]-s[2];const n=C[p],o=h(a,c),l=o*o;if(u(a)-l>n)continue;const d=o*S,_=e=>(e.point=e.point?e.point.fill(a[0],a[1],a[2]):m(a),e.dist=d,e.normal=w,e.layerViewUid=f,e);if((null==v.dist||d<v.dist)&&(null==t||t(s,i,d))&&_(v),0!==e.options.store&&(null==y.dist||d>y.dist)&&(null==t||t(s,i,d))&&_(y),2===e.options.store&&(null==t||t(s,i,d))){const e=new U;D.push(_(e))}}});const q=(e,t)=>{const{layerViewUid:s}=t,i=new C(t.point,s);e.set(0,i,t.dist,t.normal)};if(R(v)){const t=e.results.min;(null==t.distance||v.dist<t.distance)&&q(t,v)}if(R(y)&&0!==e.options.store){const t=e.results.max;(null==t.distance||y.dist>t.distance)&&q(t,y)}if(2===e.options.store)for(const r of D){const t=new x(P);q(t,r),e.results.all.push(t)}}get slicePlaneEnabled(){return this._slicePlaneEnabled}set slicePlaneEnabled(e){this._slicePlaneEnabled!==e&&(this._slicePlaneEnabled=e,this.requestRender(1))}get data(){return this._data}destroy(){this._data.destroy(),super.destroy()}_onCameraChange(){const e=this.view.state.camera.eye,t=this.view.state.camera.ray.direction,s=.001;(Math.abs(e[0]-this._previousCameraPosition[0])>s||Math.abs(e[1]-this._previousCameraPosition[1])>s||Math.abs(e[2]-this._previousCameraPosition[2])>s||Math.abs(t[0]-this._previousCameraDirection[0])>s||Math.abs(t[1]-this._previousCameraDirection[1])>s||Math.abs(t[2]-this._previousCameraDirection[2])>s)&&(c(this._previousCameraPosition,e),c(this._previousCameraDirection,t),this._data.requestSort())}_prepareParameters(e,t){this._passParameters.totalGaussians=this._data.visibleGaussians,this._passParameters.splatOrder=this._data.orderTexture.texture,this._passParameters.splatFading=this._data.fadingTexture.texture,this._passParameters.splatAtlas=this._data.textureAtlas.texture;const s=Math.tan(.5*this.camera.fovY),i=s/e*t;a(this._passParameters.tanFov,i,s),this._passParameters.focalLength=e/(2*s);const r=this.view.qualitySettings.gaussianSplat.minimumSplatPixelRadius;this._passParameters.minSplatRadius=r*Math.sqrt(t*e)/Math.sqrt(2073600),this._prepareHighPrecisionCameraPosition()}_singlePass(e,t){const s=this.renderingContext,i=this.renderingContext.gl,a=this.renderingContext.capabilities.drawBuffersIndexed;e.acquireColor(F,8,"gaussian depth output"),s.bindFramebuffer(e.fbo),s.setClearColor(0,0,0,0),s.clear(16384),this.renderingContext.bindTechnique(t,this.bindParameters,this._passParameters),a.enableiOES(i.BLEND,0),a.blendEquationSeparateiOES(0,i.FUNC_ADD,i.FUNC_ADD),a.blendFuncSeparateiOES(0,i.ONE_MINUS_DST_ALPHA,i.ONE,i.ONE_MINUS_DST_ALPHA,i.ONE),a.enableiOES(i.BLEND,1),a.blendEquationSeparateiOES(1,i.FUNC_ADD,i.FUNC_ADD),a.blendFuncSeparateiOES(1,i.ONE_MINUS_DST_ALPHA,i.DST_ALPHA,i.ONE_MINUS_DST_ALPHA,i.ONE),this.renderingContext.drawArraysInstanced(N.TRIANGLE_STRIP,0,4,this._data.visibleGaussians)}_multiPass(e,t,s,i){const{fullWidth:a,fullHeight:r}=this.bindParameters.camera,n=this.renderingContext;n.bindFramebuffer(e.fbo),n.setClearColor(0,0,0,0),n.clear(16384),this.renderingContext.bindTechnique(s,this.bindParameters,this._passParameters),this.renderingContext.drawArraysInstanced(N.TRIANGLE_STRIP,0,4,this._data.visibleGaussians);const o=this.fboCache.acquire(a,r,"gaussian depth output",8);return o.attachDepth(t),n.bindFramebuffer(o.fbo),n.setClearColor(0,0,0,0),n.clear(16384),this.renderingContext.bindTechnique(i,this.bindParameters,this._passParameters),this.renderingContext.drawArraysInstanced(N.TRIANGLE_STRIP,0,4,this._data.visibleGaussians),o}_prepareHighPrecisionCameraPosition(){o(this._passParameters.tileCameraPosition,this.camera.eye,1/I.tileSize),p(this._passParameters.tileCameraPosition,this._passParameters.tileCameraPosition),o(this._passParameters.cameraDelta,this._passParameters.tileCameraPosition,I.tileSize),r(this._passParameters.cameraDelta,this.camera.eye,this._passParameters.cameraDelta)}_handleFading(){if(0===this.fadeHelper.numFadingTiles)return void(this._previousFrameStart=null);this._previousFrameStart??=this.view.stage.renderer.renderContext.time;const e=this.view.stage?.renderer.renderContext.time-this._previousFrameStart;this.fadeHelper.updateAllTileFading(e),this._previousFrameStart=this.view.stage.renderer.renderContext.time,this._data.fadingTexture.updateTexture(this._data.textureAtlas.pageAllocator.pageCount)}static{this.tileSize=2.048}};function R(e){return null!=e.dist&&null!=e.point}e([s({constructOnly:!0})],H.prototype,"fadeHelper",void 0),H=I=e([i("esri.views.3d.webgl-engine.lib.GaussianSplatRenderNode")],H);class U{constructor(){this.point=null,this.dist=null,this.normal=null,this.layerViewUid=""}}export{H as GaussianSplatRenderNode};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import"../../../../core/has.js";import{generateUID as t}from"../../../../core/uid.js";import{multiply as i,copy as e,hasIdentityRotation as s}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as o,IDENTITY as r}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{l as a,p as h,C as n,h as m,i as d,m as l,d as c}from"../../../../chunks/vec32.js";import{create as g,fromValues as _}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{Sphere as u}from"../../../../geometry/support/sphere.js";import{maxScale as f}from"../../support/mathUtils.js";import{Object3DOccludeeStateID as b,Object3DHighlightStateID as v}from"./Object3DStateID.js";import{assert as p}from"./Util.js";import{affectsGeometry as y}from"./VertexAttribute.js";import{addObject3DStateID as j,removeObject3DStateID as V}from"../materials/renderers/utils.js";class S{constructor(i={}){this.id=t(),this._highlightIds=new Set,this._shaderTransformation=null,this._visible=!0,this.castShadow=i.castShadow??!0,this.usesVerticalDistanceToGround=i.usesVerticalDistanceToGround??!1,this.graphicUid=i.graphicUid,this.layerViewUid=i.layerViewUid,i.isElevationSource&&(this.lastValidElevationBB=new x),this._geometries=i.geometries?Array.from(i.geometries):[]}dispose(){this._geometries.length=0}get layer(){return this._layer}set layer(t){p(null==this._layer||null==t,"Object3D can only be added to a single Layer"),this._layer=t}addGeometry(t){t.visible=this._visible,this._geometries.push(t);for(const i of this._highlightIds)t.addHighlight(i);this._emit("geometryAdded",{object:this,geometry:t}),this._highlightIds.size&&this._emit("highlightChanged",this),this._invalidateBoundingVolume()}removeGeometry(t){const i=this._geometries.splice(t,1)[0];if(i){for(const t of this._highlightIds)i.removeHighlight(t);this._emit("geometryRemoved",{object:this,geometry:i}),this._highlightIds.size&&this._emit("highlightChanged",this),this._invalidateBoundingVolume()}}removeAllGeometries(){for(;this._geometries.length>0;)this.removeGeometry(0)}geometryVertexAttributeUpdated(t,i,e=!1){this._emit("attributesChanged",{object:this,geometry:t,attribute:i,sync:e}),y(i)&&this._invalidateBoundingVolume()}get visible(){return this._visible}set visible(t){if(this._visible!==t){this._visible=t;for(const t of this._geometries)t.visible=this._visible;this._emit("visibilityChanged",this)}}maskOccludee(){const t=new b;for(const i of this._geometries)i.occludees=j(i.occludees,t);return this._emit("occlusionChanged",this),t}removeOcclude(t){for(const i of this._geometries)i.occludees=V(i.occludees,t);this._emit("occlusionChanged",this)}highlight(t){const i=new v(t);for(const e of this._geometries)e.addHighlight(i);return this._emit("highlightChanged",this),this._highlightIds.add(i),i}removeHighlight(t){this._highlightIds.delete(t);for(const i of this._geometries)i.removeHighlight(t);this._emit("highlightChanged",this)}removeStateID(t){0===t.channel?this.removeHighlight(t):this.removeOcclude(t)}getCombinedStaticTransformation(t,e){return i(e,this.transformation,t.transformation)}getCombinedShaderTransformation(t,e=o()){return i(e,this.effectiveTransformation,t.transformation)}get boundingVolumeWorldSpace(){return this._bvWorldSpace||(this._bvWorldSpace=new W,this._validateBoundingVolume(this._bvWorldSpace,0)),this._bvWorldSpace}get boundingVolumeObjectSpace(){return this._bvObjectSpace||(this._bvObjectSpace=new W,this._validateBoundingVolume(this._bvObjectSpace,1)),this._bvObjectSpace}_validateBoundingVolume(t,i){const e=1===i;for(const s of this._geometries){const i=s.boundingInfo;i&&A(i,t,e?s.transformation:this.getCombinedShaderTransformation(s))}a(t.bounds.center,t.min,t.max,.5);for(const s of this._geometries){const i=s.boundingInfo;if(null==i)continue;const o=e?s.transformation:this.getCombinedShaderTransformation(s),r=f(o);h(B,i.center,o);const a=n(B,t.bounds.center),m=i.radius*r;t.bounds.radius=Math.max(t.bounds.radius,a+m)}}_invalidateBoundingVolume(){const t=this._bvWorldSpace?.bounds;this._bvObjectSpace=this._bvWorldSpace=void 0,this.layer&&t&&this.layer.notifyObjectBBChanged(this,t)}_emit(t,i){this.layer?.events.emit(t,i)}get geometries(){return this._geometries}get transformation(){return this._transformation??r}set transformation(t){this._transformation=e(this._transformation??o(),t),this._invalidateBoundingVolume(),this._emit("transformationChanged",this)}get shaderTransformation(){return this._shaderTransformation}set shaderTransformation(t){this._shaderTransformation=t?e(this._shaderTransformation??o(),t):null,this._invalidateBoundingVolume(),this._emit("shaderTransformationChanged",this)}get effectiveTransformation(){return this.shaderTransformation??this.transformation}get test(){}}class x{constructor(){this._data=[Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE]}get min(){return _(this._data[0],this._data[1],this._data[2])}get max(){return _(this._data[3],this._data[4],this._data[5])}minWith(t){const{_data:i}=this;i[0]=Math.min(i[0],t[0]),i[1]=Math.min(i[1],t[1]),i[2]=Math.min(i[2],t[2])}maxWith(t){const{_data:i}=this;i[3]=Math.max(i[3],t[0]),i[4]=Math.max(i[4],t[1]),i[5]=Math.max(i[5],t[2])}assignMinMax(t,i){for(let e=0;e<3;++e)this._data[0+e]=t[e],this._data[3+e]=i[e]}isEmpty(){return this._data[3]<this._data[0]&&this._data[4]<this._data[1]&&this._data[5]<this._data[2]}}class W extends x{constructor(){super(...arguments),this.bounds=new u}}function A(t,i,e){const o=t.bbMin,r=t.bbMax;if(s(e)){const t=m(M,e[12],e[13],e[14]);return d(C,o,t),d(T,r,t),i.minWith(C),void i.maxWith(T)}if(h(C,o,e),l(o,r))return i.minWith(C),void i.maxWith(C);h(T,r,e),i.minWith(C),i.minWith(T),i.maxWith(C),i.maxWith(T);for(let s=0;s<3;++s)c(C,o),c(T,r),C[s]=r[s],T[s]=o[s],h(C,C,e),h(T,T,e),i.minWith(C),i.minWith(T),i.maxWith(C),i.maxWith(T)}const M=g(),C=g(),T=g(),B=g();export{W as BoundingVolume,S as Object3D};
5
+ import"../../../../core/has.js";import{generateUID as t}from"../../../../core/uid.js";import{multiply as i,copy as e,hasIdentityRotation as s}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as o,IDENTITY as r}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{l as a,p as h,D as n,h as m,i as d,m as l,d as c}from"../../../../chunks/vec32.js";import{create as g,fromValues as _}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{Sphere as u}from"../../../../geometry/support/sphere.js";import{maxScale as f}from"../../support/mathUtils.js";import{Object3DOccludeeStateID as b,Object3DHighlightStateID as v}from"./Object3DStateID.js";import{assert as p}from"./Util.js";import{affectsGeometry as y}from"./VertexAttribute.js";import{addObject3DStateID as j,removeObject3DStateID as V}from"../materials/renderers/utils.js";class S{constructor(i={}){this.id=t(),this._highlightIds=new Set,this._shaderTransformation=null,this._visible=!0,this.castShadow=i.castShadow??!0,this.usesVerticalDistanceToGround=i.usesVerticalDistanceToGround??!1,this.graphicUid=i.graphicUid,this.layerViewUid=i.layerViewUid,i.isElevationSource&&(this.lastValidElevationBB=new x),this._geometries=i.geometries?Array.from(i.geometries):[]}dispose(){this._geometries.length=0}get layer(){return this._layer}set layer(t){p(null==this._layer||null==t,"Object3D can only be added to a single Layer"),this._layer=t}addGeometry(t){t.visible=this._visible,this._geometries.push(t);for(const i of this._highlightIds)t.addHighlight(i);this._emit("geometryAdded",{object:this,geometry:t}),this._highlightIds.size&&this._emit("highlightChanged",this),this._invalidateBoundingVolume()}removeGeometry(t){const i=this._geometries.splice(t,1)[0];if(i){for(const t of this._highlightIds)i.removeHighlight(t);this._emit("geometryRemoved",{object:this,geometry:i}),this._highlightIds.size&&this._emit("highlightChanged",this),this._invalidateBoundingVolume()}}removeAllGeometries(){for(;this._geometries.length>0;)this.removeGeometry(0)}geometryVertexAttributeUpdated(t,i,e=!1){this._emit("attributesChanged",{object:this,geometry:t,attribute:i,sync:e}),y(i)&&this._invalidateBoundingVolume()}get visible(){return this._visible}set visible(t){if(this._visible!==t){this._visible=t;for(const t of this._geometries)t.visible=this._visible;this._emit("visibilityChanged",this)}}maskOccludee(){const t=new b;for(const i of this._geometries)i.occludees=j(i.occludees,t);return this._emit("occlusionChanged",this),t}removeOcclude(t){for(const i of this._geometries)i.occludees=V(i.occludees,t);this._emit("occlusionChanged",this)}highlight(t){const i=new v(t);for(const e of this._geometries)e.addHighlight(i);return this._emit("highlightChanged",this),this._highlightIds.add(i),i}removeHighlight(t){this._highlightIds.delete(t);for(const i of this._geometries)i.removeHighlight(t);this._emit("highlightChanged",this)}removeStateID(t){0===t.channel?this.removeHighlight(t):this.removeOcclude(t)}getCombinedStaticTransformation(t,e){return i(e,this.transformation,t.transformation)}getCombinedShaderTransformation(t,e=o()){return i(e,this.effectiveTransformation,t.transformation)}get boundingVolumeWorldSpace(){return this._bvWorldSpace||(this._bvWorldSpace=new W,this._validateBoundingVolume(this._bvWorldSpace,0)),this._bvWorldSpace}get boundingVolumeObjectSpace(){return this._bvObjectSpace||(this._bvObjectSpace=new W,this._validateBoundingVolume(this._bvObjectSpace,1)),this._bvObjectSpace}_validateBoundingVolume(t,i){const e=1===i;for(const s of this._geometries){const i=s.boundingInfo;i&&A(i,t,e?s.transformation:this.getCombinedShaderTransformation(s))}a(t.bounds.center,t.min,t.max,.5);for(const s of this._geometries){const i=s.boundingInfo;if(null==i)continue;const o=e?s.transformation:this.getCombinedShaderTransformation(s),r=f(o);h(B,i.center,o);const a=n(B,t.bounds.center),m=i.radius*r;t.bounds.radius=Math.max(t.bounds.radius,a+m)}}_invalidateBoundingVolume(){const t=this._bvWorldSpace?.bounds;this._bvObjectSpace=this._bvWorldSpace=void 0,this.layer&&t&&this.layer.notifyObjectBBChanged(this,t)}_emit(t,i){this.layer?.events.emit(t,i)}get geometries(){return this._geometries}get transformation(){return this._transformation??r}set transformation(t){this._transformation=e(this._transformation??o(),t),this._invalidateBoundingVolume(),this._emit("transformationChanged",this)}get shaderTransformation(){return this._shaderTransformation}set shaderTransformation(t){this._shaderTransformation=t?e(this._shaderTransformation??o(),t):null,this._invalidateBoundingVolume(),this._emit("shaderTransformationChanged",this)}get effectiveTransformation(){return this.shaderTransformation??this.transformation}get test(){}}class x{constructor(){this._data=[Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE]}get min(){return _(this._data[0],this._data[1],this._data[2])}get max(){return _(this._data[3],this._data[4],this._data[5])}minWith(t){const{_data:i}=this;i[0]=Math.min(i[0],t[0]),i[1]=Math.min(i[1],t[1]),i[2]=Math.min(i[2],t[2])}maxWith(t){const{_data:i}=this;i[3]=Math.max(i[3],t[0]),i[4]=Math.max(i[4],t[1]),i[5]=Math.max(i[5],t[2])}assignMinMax(t,i){for(let e=0;e<3;++e)this._data[0+e]=t[e],this._data[3+e]=i[e]}isEmpty(){return this._data[3]<this._data[0]&&this._data[4]<this._data[1]&&this._data[5]<this._data[2]}}class W extends x{constructor(){super(...arguments),this.bounds=new u}}function A(t,i,e){const o=t.bbMin,r=t.bbMax;if(s(e)){const t=m(M,e[12],e[13],e[14]);return d(T,o,t),d(C,r,t),i.minWith(T),void i.maxWith(C)}if(h(T,o,e),l(o,r))return i.minWith(T),void i.maxWith(T);h(C,r,e),i.minWith(T),i.minWith(C),i.maxWith(T),i.maxWith(C);for(let s=0;s<3;++s)c(T,o),c(C,r),T[s]=r[s],C[s]=o[s],h(T,T,e),h(C,C,e),i.minWith(T),i.minWith(C),i.maxWith(T),i.maxWith(C)}const M=g(),T=g(),C=g(),B=g();export{W as BoundingVolume,S as Object3D};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import{update as t}from"../../../../core/arrayUtils.js";import{createTask as r}from"../../../../core/asyncUtils.js";import{unitRGBAFromColor as i}from"../../../../core/colorUtils.js";import"../../../../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 u,initial as p,sync as m}from"../../../../core/reactiveUtils.js";import{signal as c}from"../../../../core/signal.js";import{Milliseconds as f}from"../../../../core/time.js";import{property as g,subclass as b}from"../../../../core/accessorSupport/decorators.js";import{equals as P,invert as C,multiply as w}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as T,create as S}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{c as E}from"../../../../chunks/vec42.js";import{ZEROS as x}from"../../../../core/libs/gl-matrix-2/factories/vec4f32.js";import{fromValues as A,ZEROS as D}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{pruneIndexArrays as I}from"../../../../geometry/support/Indices.js";import{RenderCategory as R,InternalRenderCategory as y}from"../../webgl.js";import{innerAtmosphereFadeStart as O}from"../../environment/atmosphereUtils.js";import{minNearDistanceInMeters as F}from"../../state/NearFarHeuristic.js";import{debugFlags as v}from"../../support/debugFlags.js";import{FBOCache as H,defaultWebGLFBO as M}from"../core/FBOCache.js";import{RenderPassManager as N}from"../core/renderPasses/RenderPassManager.js";import{isColor as q}from"../core/shaderLibrary/ShaderOutput.js";import{distanceFadeEnd as G}from"../core/shaderLibrary/shading/ScreenSpaceConstants.js";import{RenderNodes as L}from"../effects/RenderNodes.js";import{RenderPluginManager as U}from"../effects/RenderPluginManager.js";import{Blit as V}from"../effects/blit/Blit.js";import{maxHighlightsPerChannel as j,renderHighlightBuffer as B}from"../effects/highlight/Highlight.js";import{OITBlend as k}from"../effects/transparency/OITBlend.js";import{AnimationTimer as z}from"./AnimationTimer.js";import{AnimationTimeStep as W}from"./AnimationTimeStep.js";import{BoundingInfo as Q}from"./BoundingInfo.js";import{DepthRange as Y}from"./DepthRange.js";import{depthRangeFromScene as Z}from"./depthRangeUtils.js";import{hudFragmentOpacityParameters as J}from"./hudFragmentOpacityParameters.js";import{MainFramebuffer as K}from"./MainFramebuffer.js";import{RenderContext as X,defaultRenderOccludedMask as $}from"./RenderContext.js";import{RendererBase as ee}from"./RendererBase.js";import{setupFeatureDefaults as te}from"./RenderFeature.js";import{RenderPluginInput as re}from"./RenderPluginInput.js";import{ShadowAccumulator as ie}from"./ShadowAccumulator.js";import{ShadowMap as se}from"./ShadowMap.js";import ae from"./SliceHelper.js";import{MergedRenderer as ne}from"../materials/renderers/MergedRenderer.js";import{RenderSceneResult as he}from"../parts/renderUtils.js";import{RendererPerformanceInfo as oe,PerformanceCategory as de}from"../statistics/RendererPerformanceInfo.js";import{PixelType as _e,ColorAttachment1 as le,ColorAttachment2 as ue}from"../../../webgl/enums.js";let pe=class extends ee{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 N,this._isRendering=!1,this._inGlobeView=!1,this._backgroundColor=A(0,0,0,1),this._sliceHelper=new ae,this._blit=null,this._oitblend=null,this.sceneDepthRange=c(Y.Infinite),this._state=c(2),this._hasAnimations=!1,this._animationTimestep=new W,this._loadEdgeViewTask=null,this._edgeViewCallbacks=[],this._reprojectionMatrixVersion=c(0),this._lastFrameTime=f(0),this._renderHiddenTransparentEdges=()=>{},this._pluginInput=new re,this._releaseNormals=e=>{e.some(({name:e})=>"normals"===e)&&this._pluginInput.release("normals")},this._debugNeedsDepth=!1,this._fboCache=new H(s),this._renderStateFeatures=c(te(e.view.qualityProfile)),this._framebuffer=new K(this.fboCache),this._performanceInfo=new oe(this._rctx),this._shadowMap=new se(this.fboCache,e.viewingMode),this._shadowAccumulator=new ie(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(3,t.shadowMap),t.shadowMap.finish(),t.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(t.camera,t.contentCamera)},n),this._renderContext=new X(this._rctx,this._shadowMap,r),this._nodes=new L(this._renderContext),this._plugins=new U({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(),u),l(()=>v.EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES,e=>{this._renderHiddenTransparentEdges=e?()=>this._renderEdges(0):()=>{},n()},p),l(()=>e.view.environment.background?.color,e=>{const t=e?i(e):D;E(this._backgroundColor,t[0]*t[3],t[1]*t[3],t[2]*t[3],t[3]),n()},u),l(()=>e.view.state.camera.relativeElevation,e=>this._inGlobeView=(e??1/0)>=G,u),l(()=>this._bindParameters.clouds.fadeFactor,()=>{this._bindParameters.fadeLighting(),this._requestRender(2)},m),l(()=>this._bindParameters.clouds.data?.state,()=>n(),m),l(()=>e.view.state.highlights,e=>{this._bindParameters.highlights=e,n()},p)])}destroy(){this._gpuTimerHandle=n(this._gpuTimerHandle),this._nodes.destroy(),this._framebuffer.dispose(),this._shadowMap.dispose(),this._shadowAccumulator.destroy(),this._shadowAccumulator=null,this._loadEdgeViewTask=h(this._loadEdgeViewTask),this._edgeView=o(this._edgeView),this.renderPassManager.dispose(),this._releaseFBOs(),this._disposeOffscreenBuffers(),this._fboCache.destroy(),this._fboCache=null,this._plugins.destroy(),this._plugins=null,this._pluginInput=null,this._blit=null,this._oitblend=null,this._compositingHelper=null,this._nodes=null,this._framebuffer=null,this._shadowMap=null,this._renderContext=null,this._performanceInfo=null,Q.prune(),ne.prune(),I()}get renderContext(){return this._renderContext}get _bindParameters(){return this._renderContext.bind}get _framebufferSize(){return this._framebuffer.size}get performanceInfo(){return this._performanceInfo}updateRenderFeatures(e){this._renderStateFeatures.value=te(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.isFeatureEnabled(1)}get hasReflections(){return this._pluginsHas.water&&this.isFeatureEnabled(5)}get _hasHighlights(){return this._plugins.produces(8,2,4,19,14,15)}hasHighlight(e){return this._plugins.hasHighlight(e)}get _hasHUDHighlights(){return this._plugins.produces(8,14,15)}get hasSSAO(){return this.isFeatureEnabled(4)&&!this._inGlobeView}get hasSMAA(){return this.isFeatureEnabled(0)}get hasEmitters(){return this._plugins.hasEmitters&&this.stage.view.qualitySettings.physicallyBasedRenderingEnabled}get highResolutionAtmosphere(){return this.isFeatureEnabled(3)}get fboCache(){return this._fboCache}_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.readyToRun||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:xe(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&&P(this._bindParameters.ssr.reprojectionMatrix,T)}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.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()),e.environment){void 0!==e.environment.weather&&(this._bindParameters.weather=e.environment.weather);const t="virtual"!==e.environment.lighting.type;r.enableFillLights!==t&&(r.enableFillLights=t,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)}get occludedRequiresStencil(){return this.occludedRequiresOccludeeStencil||this.occludedRequiresIntegratedMeshStencil}get occludedRequiresOccludeeStencil(){return this._bindParameters.hasOccludees&&!!(8&this.plugins.renderOccludedFlags)}get occludedRequiresIntegratedMeshStencil(){return this._plugins.produces(0,0)&&this._plugins.produces(0,10)}updateHasFlags(){const has=this._pluginsHas;has.hudElements=this._plugins.produces(0,...Ce),has.water=this._plugins.produces(2,20),this._bindParameters.hasOccludees=this._plugins.hasOccludees,this._requestRender()}updateAnimation(e,t){this._animationTimer??=new z(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,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 he(this._pluginInput.get(R.FINAL),null)}_render(e,t,r,i){const s=0===r;this.performanceInfo.startFrame(),this.fboCache.frameStart(),this.fboCache.interactive=s,this._disposeBindBuffers();const{camera:a,contentCamera:n,mode:h,alignPixelEnabled:o}=e;this._state.value=h;const d=this._nodes.produces("magnifier-color"),_=this._nodes.produces(R.FINAL);this._renderContext.time=t,this._renderContext.output=0,this._bindParameters.hasEmission=this.hasEmitters,this._bindParameters.oitPass=0,this._bindParameters.alignPixelEnabled=o,this._bindParameters.decorations=!i,this._bindParameters.mainDepth=null;const l=!i||!this._sliceHelper.isDecoration;this._bindParameters.slicePlane=l?this._sliceHelper.plane:null,this._bindParameters.viewshedEnabled=this._nodes.produces(y.VIEWSHED),this._bindParameters.cutFillEnabled=this._nodes.produces(y.CUTFILL_DEPTH),this._renderOverlay(),a.setGLViewport(this._rctx);const u=this._framebuffer,p=u.initialize(a.fullWidth,a.fullHeight,this._backgroundColor,this._bindParameters.hasEmission);this.hasReflections?(p?.setName("last frame color"),this._bindParameters.ssr.lastFrameColor=p):p?.release(),this._ensureBindParametersCamera(a,n),this._updateHUDOccludedFragmentOpacity(h,t),this._plugins.prepareRender(),this._bindParameters.shadowHighlightsVisible=this._needsShadowHighlight&&!i;const m=this._plugins.produces(0,...ce);this._precompilePrepasses(),this.performanceInfo.advance(de.PREPARE);const c=this._computeShadowDepthRange(a);this._renderShadowMap(a,this._bindParameters.lighting.mainLight.direction,c),this._pluginInput.set("normals",this._renderNormals()),this._renderRemainingGeometryDepth(),this._renderShadowAccumulation(c,a,n,!s),this._ensureBindParametersSSR(t),this._precompileShaders(m),this._renderContext.output=0,u.bind(),this._bindParameters.mainDepth=u.depth.attachment,this._renderOpaque(),this._renderTransparent(m),this._shadowMap.disposeMainBuffer(),this._pluginInput.set(y.FOCUSAREA,this._renderFocusAreaGeometry()),this._pluginInput.set(y.CUTFILL_DEPTH,this._renderCutFillDepth()),u.update(e=>this._renderNodes(y.TRANSPARENT_ENVIRONMENT,e)),u.update(e=>this._renderNodes(y.VIEWSHED,e)),u.update(e=>this._renderNodes(y.LASERLINES,e)),u.update(e=>this._renderNodes(y.FOCUSAREA_COLOR,e)),this._pluginInput.release(y.FOCUSAREA),this._pluginInput.release(y.CUTFILL_DEPTH),u.update(e=>this._renderNodes(y.OCCLUDED,e)),this._pluginInput.set("highlights",this._renderHighlightPrepass()),this._renderHighlightShadowMap(a,this._bindParameters.lighting.mainLight.direction,c);const f=2===r?this._renderObjectAndLayerIdColor():null;u.update(e=>this._renderNodes(R.COMPOSITE,e)),this._shadowMap.disposeOffscreenBuffers();const g=s&&!_&&!(d&&!i),b=this._pluginInput.get(R.COMPOSITE),P=g?M:this.fboCache.acquire(b.fbo.width,b.fbo.height,y.ANTIALIASING),C=this._nodes.produces(y.ANTIALIASING)?this._renderNodes(y.ANTIALIASING,P):this.blitFBO(b,P,!1);let w;this._pluginInput.set(y.ANTIALIASING,C),this._hasHUDHighlights?(this._renderHUD(1,C),w=this._renderNodes(y.HIGHLIGHTS,C)):(w=this._renderNodes(y.HIGHLIGHTS,C),this._renderHUD(1,w));const T=this._renderNodes(y.MAGNIFIER,w);return s&&d&&!i&&!_&&this.blitFBO(T),_?(T.attachDepth(u.depth),this.blitFBO(this._renderNodes(R.FINAL,T)),T.detachDepth()):this._pluginInput.set(R.FINAL,T),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(),s||(this._releaseFBOs(),this._disposeOffscreenBuffers()),new he(this._pluginInput.get(R.FINAL),f)}_precompileShaders(e){++this._plugins.context.techniques.precompiling,this._renderContext.output=0,this._precompileOpaqueGeometry(),this._nodes.precompile(y.OPAQUE_ENVIRONMENT),this._bindParameters.terrainDepthTest=this._bindParameters.cullAboveTerrain=this._needsTerrainDepth,this._renderContext.output=1,this._plugins.precompile(...fe),this._needsTerrainDepth&&(this._precompileOpaqueGeometry(),this._precompileTransparentGeometry()),this._renderContext.output=0,this._plugins.precompile(...fe),e&&(this._precompileTransparentGeometry(),this._hasPhotoshopTerrain&&(this._bindParameters.cullAboveTerrain=!1,this._precompileTransparentGeometry(),this._bindParameters.cullAboveTerrain=this._needsTerrainDepth)),this._nodes.precompile(y.FOCUSAREA),this._needsHUDVisibility&&this._plugins.precompile(13),this._plugins.precompile(16),this._precompileHUD(0),this._bindParameters.terrainDepthTest=!1,this._bindParameters.cullAboveTerrain=!1,this._nodes.precompile(y.VIEWSHED,y.CUTFILL_DEPTH,y.CUTFILL_COLOR,y.LASERLINES,y.FOCUSAREA_COLOR,y.OCCLUDED,y.ANTIALIASING,y.HIGHLIGHTS);const t=this._bindParameters;t.highlightMixTexture=t.highlights.length>1?this._rctx.emptyTexture:null,this._precompileHUD(1),this._hasHighlights&&(t.highlights.forEach((e,r)=>{t.highlightLevel=r,this._precompileAllGeometry(8)}),t.highlightLevel=null),t.highlightMixTexture=null,this._nodes.precompile(R.COMPOSITE,y.MAGNIFIER),this._shadowAccumulator.precompile(),this._plugins.precompile(9),--this._plugins.context.techniques.precompiling}_renderFocusAreaGeometry(){const e=this._nodes.produce(y.FOCUSAREA,this._pluginInput);return e&&this.performanceInfo.advance(de.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(13),r=this._nodes.render(r,this._pluginInput),--this._techniques.precompiling,this.performanceInfo.advance(de.OBJECT_AND_LAYER_ID_COLOR),this._renderContext.output=e,r}finish(e){this._hasAnimations||this._animationTimestep.clear();const t=this.performanceInfo.gpuSamplingEnabled,r=0===e;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(D),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],6408,_e.UNSIGNED_BYTE,t),s.release()}readHUDVisibility(e,t,r,i,s){this._bindParameters.hudVisibility?.fbo?.readPixels(e,t,r,i,6408,_e.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=this._bindParameters.geometryDepth,a=()=>t.render(this._bindParameters,e);this.renderToTargets(a,i,s??this._framebuffer.depth,D),this._framebuffer.bind(),this._compositingHelper.composite(this._bindParameters,i.getTexture()),i.release(),this.performanceInfo.advance(1===e?de.OPAQUE_EDGES:de.TRANSPARENT_EDGES)}_renderOverlay(){this._bindParameters.overlay=this.overlay?.render(),this._bindParameters.overlay&&this.performanceInfo.advance(de.OVERLAY)}_renderShadowMap(e,t,r){if(!this.shadowsEnabled)return;const i=this._shadowMap;i.start(e,t,r,this.isFeatureEnabled(6),this.stage.view.qualitySettings.maximumPixelRatio),this._needsShadowHighlight?(this._renderShadowCascades(5,this._shadowMap),i.copySnapshot(1),this._renderShadowCascades(4,this._shadowMap)):this._renderShadowCascades(3),i.finish(),e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,this._bindParameters.contentCamera),this.performanceInfo.advance(de.SHADOW_MAP)}_renderHighlightShadowMap(e,t,r){if(!this.shadowsEnabled||!this._needsShadowHighlight)return;const i=this._shadowMap;i.start(e,t,r,this.isFeatureEnabled(6),this.stage.view.qualitySettings.maximumPixelRatio),this._renderShadowCascades(4,this._shadowMap),i.moveSnapshot(0),i.finish(),e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,this._bindParameters.contentCamera),this.performanceInfo.advance(de.SHADOW_MAP)}_renderCutFillDepth(){return this._nodes.produce(y.CUTFILL_DEPTH,this._pluginInput)}_precompileShadowCascades(e){0!==this._shadowMap.cascades.length&&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(1)||this._nodes.requireGeometryDepth()||this.hasReflections||this._needsShadowHighlight||this._shadowAccumulator.active||this._debugNeedsDepth}_renderRemainingGeometryDepth(){const e=this._pluginInput.get("normals");e?(this._pluginInput.set(y.SSAO,this._renderSSAO()),this._needsDepth?(this._rctx.bindFramebuffer(e.fbo),this._rctx.clear(1024),this._renderGeometryWithoutNormals(1),d(this._bindParameters.depth),this._bindParameters.depth=e.obtainDepthTexture(),this.performanceInfo.advance(de.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,"geometry depth",13);this._rctx.bindFramebuffer(t.fbo),this._rctx.clear(1280),this.renderAllGeometry(1),d(this._bindParameters.depth),this._bindParameters.depth=t.obtainDepthTexture(),t.release(),this.performanceInfo.advance(de.DEPTH)}_renderTerrainDepth(){if(this._bindParameters.terrainDepth=d(this._bindParameters.terrainDepth),this._bindParameters.terrainDepthTest=this._bindParameters.cullAboveTerrain=this._needsTerrainDepth,!this._needsTerrainDepth)return;const e=this._renderContext.output;this._renderContext.output=1;const t=this._framebufferSize,r=this.fboCache.acquire(t.width,t.height,"terrain depth",13);this._rctx.bindFramebuffer(r.fbo),this._rctx.clear(1280),this._renderTransparentGround(),this._bindParameters.terrainDepth=r.obtainDepthTexture(),r.release(),this._renderContext.output=e}_renderGeometryDepth(){if(!this._needsTerrainDepth)return void(this._bindParameters.geometryDepth=d(this._bindParameters.geometryDepth));const e=this._renderContext.output,{width:t,height:r}=this._framebufferSize,i=this.fboCache.acquire(t,r,"geometry depth",13);this._rctx.bindFramebuffer(i.fbo),this._rctx.clear(1280),this._renderOpaqueAndTransparentGeometry(1),this._renderContext.output=e,d(this._bindParameters.geometryDepth),this._bindParameters.geometryDepth=i.obtainDepthTexture(),i.release()}get _needsShadowDepthRange(){return this._shadowMap.enabled||this._shadowAccumulator.active}_computeShadowDepthRange(e){if(!this._needsShadowDepthRange)return Y.Zero;const t=Z(e,this._plugins.plugins,this.stage.layers,0);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=Y.Infinite);if((this.stage.view.renderCoordsHelper?.getAltitude(e.eye)??0)<O)return void(this.sceneDepthRange.value=Y.Infinite);const t=e.clone();t.near=F,t.far=1e10;const r=Z(t,this._plugins.plugins,this.stage.layers,1);r.union(this._plugins.queryDepthRange(t)),this.sceneDepthRange.value.equals(r)||(this.sceneDepthRange.value=r)}get _normalsRequired(){const e=this._nodes.require("normals",R.FINAL,R.COMPOSITE,R.OPAQUE,R.TRANSPARENT,y.VIEWSHED,y.LASERLINES);return(this.hasSSAO?1:0)+e}_updateHUDOccludedFragmentOpacity(e,t){const{idleOpacity:r,navigatingOpacity:i,maxDelta:n,tiltFadeStart:h,tiltFadeEnd:o,altitudeStart:d,altitudeEnd:_}=J,l=this.stage.view,u=l.stateManager.camera,p=l.qualitySettings.fadeDuration,m=2===e?r:i,c=s((u.tilt-h)/(o-h),0,1),f=s(((u.position.z??0)-d)/(_-d),0,1),g=a(a(1,m,c),1,f),b=this._bindParameters.hudOccludedFragmentOpacity;if(p<=0||b===g||0===this._lastFrameTime||this._lastFrameTime>t)return this._bindParameters.hudOccludedFragmentOpacity=g,void(this._lastFrameTime=t);const P=t-this._lastFrameTime;this._lastFrameTime=t;const C=Math.max(1-r,Math.abs(r-i)),w=Math.min(C*P/p,n);w>=Math.abs(g-b)?this._bindParameters.hudOccludedFragmentOpacity=g:(this._bindParameters.hudOccludedFragmentOpacity=b+Math.sign(g-b)*w,this._requestRender())}_precompilePrepasses(){this._normalsRequired&&this._precompileAllGeometry(2),this._needsDepth&&this._precompileAllGeometry(1),this.shadowsEnabled&&(this._needsShadowHighlight?(this._precompileShadowCascades(4),this._precompileShadowCascades(5)):this._precompileShadowCascades(3)),this._shadowAccumulator.active&&this._precompileAllGeometry(3)}_renderNormals(){const e=this._normalsRequired;if(0===e)return;const t=this._framebufferSize,r=this.fboCache.acquire(t.width,t.height,"normals",5);r.acquireDepth(13),this._rctx.bindFramebuffer(r.fbo),this._rctx.clearFramebuffer(D,!0,!0),this._renderContext.output=2,this._plugins.render(...ge);const i=this._nodes.optional("normals",R.FINAL,R.COMPOSITE,R.OPAQUE,R.TRANSPARENT,y.VIEWSHED);return r.retain(e+i-1),this.performanceInfo.advance(de.NORMALS),r}_renderSSAO(){const e=this._pluginInput.get("normals");if(!this.hasSSAO||!e)return;const t=this._nodes.produce(y.SSAO,this._pluginInput);return this._bindParameters.ssao=t,t&&this.performanceInfo.advance(de.SSAO),t}_precompileAllGeometry(e){const t=this._renderContext.output;this._renderContext.output=e,this._precompileOpaqueGeometry(),this._precompileTransparentGeometry(),this._plugins.precompile(...fe),this._renderContext.output=t}renderAllGeometry(e){this._renderContext.output=e,this._renderOpaqueAndTransparentGeometry(e),this._renderTransparentGround()}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,...Pe);this._renderContext.renderOccludedMask=$}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)})}renderOccludedSlots(e,t){this._renderContext.renderOccludedMask=t,this.plugins.renderOccludedFlags>1&&this._plugins.render(10),this.renderSlots(e,...Pe),this._renderContext.renderOccludedMask=$}renderHUD(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(14)}precompileViewshedShadowMap(){this._precompileAllGeometry(6)}precompileCutFill(){const e=7,t=this._renderContext.output;this._renderContext.output=e,this._plugins.precompile(0,1,...fe),this._renderContext.output=t}renderViewshedShadowMap(e){const{camera:t,contentCamera:r}=this._bindParameters,i=this._renderContext.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this.renderAllGeometry(6),this._ensureBindParametersCamera(t,r),this._bindParameters.camera.setGLViewport(this._rctx),this._renderContext.output=i}renderCutFillReferenceDepth(e){const{camera:t,contentCamera:r}=this._bindParameters,i=this._renderContext.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this._renderContext.output=7,this._plugins.render(0,1,...fe),this._ensureBindParametersCamera(t,r),t.setGLViewport(this._rctx),this._renderContext.output=i}_renderOpaqueAndTransparentGeometry(e){this._renderContext.output=e,this._renderOpaqueGeometry(),this._renderTransparentGeometry()}_renderGeometryWithoutNormals(e){this._renderContext.output=e,this._plugins.render(...be)}_precompileOpaqueGeometry(){this._plugins.precompile(...me),this._nodes.precompile("opaque-color")}_renderOpaqueGeometry(){this._plugins.render(...me)}_renderTransparentGeometry(){this._plugins.render(...ce)}get _hasPhotoshopTerrain(){return this._plugins.produces(0,6)}get _needsTerrainDepth(){return this._highQualityTransparency&&this._hasPhotoshopTerrain}_renderPhotoshopTerrain(){if(!this._hasPhotoshopTerrain)return null;const e=this._framebufferSize,t=this.fboCache.acquire(e.width,e.height,"transparent terrain");return this.renderToTargets(()=>this._plugins.render(6),t,this._framebuffer.depth,D),this.performanceInfo.advance(de.TRANSPARENT_TERRAIN),t}_renderTransparentGround(){this._plugins.render(...fe)}get _needsHUDVisibility(){return this._plugins.produces(this._renderContext.output,13)}_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",4),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(13),r.detachDepth(),this._framebuffer.bind(),this.performanceInfo.advance(de.HUD_VISIBILITY)}_renderLineCallouts(e){if(this._bindParameters.hudRenderStyle=e,0===e){const e=()=>this._plugins.render(16),t=this._framebufferSize,r=this.fboCache.acquireDepth(12,t.width,t.height,"line callouts");this.renderToTargets(e,this._framebuffer.color,r,void 0,!0,!0),r.release()}else this._plugins.render(16)}_precompileHUD(e){if(this._precompileHUDOutput(e),this._hasHighlights){const t=this._renderContext.output;this._renderContext.output=8,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=1,this._plugins.precompile(...Ce),this._bindParameters.oitPass=2,this._plugins.precompile(...Ce),this._bindParameters.oitPass=0):this._plugins.precompile(...Ce),this._bindParameters.hudRenderStyle=t}_renderHUD(e,t){if(this._pluginsHas.hudElements){if(this._oitEnabled){const r=this._renderOIT(1,e);this._rctx.bindFramebuffer(t.fbo),this._compositingHelper.compositePreMultipliedAlpha(this._bindParameters,r.getTexture(),!1),r.release()}else if(this._renderContext.output=0,0===e){const t=()=>this._renderHUDElements(e),r=this._framebufferSize,i=this.fboCache.acquireDepth(12,r.width,r.height,"hud");this.renderToTargets(t,this._framebuffer.color,i,void 0,!0,!0),i.release()}else t.acquireDepth(12),this._rctx.bindFramebuffer(t.fbo),this._renderHUDElements(e),t.detachDepth();this.performanceInfo.advance(0===e?de.HUD_OCCLUDED:de.HUD)}}_renderHUDElements(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(...Ce)}get _needsShadowHighlight(){return this.shadowsEnabled&&this._plugins.produces(4,2)}_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>j?3:1);a.acquireDepth(13);const n=this._plugins.produces(8,0);return n&&this._framebuffer.color.fbo&&a.fbo&&t.blitFramebuffer(this._framebuffer.color.fbo,a.fbo,1024),t.bindFramebuffer(a.fbo),t.gl.clearBufferuiv(6144,0,[0,0,0,0]),n||t.clear(1024),this._renderContext.output=8,t.bindFramebuffer(a.fbo),B(t,e,i,r,()=>this._renderHighlightGeometries()),a.detachDepth(),this.performanceInfo.advance(de.HIGHLIGHTS),a}_renderHighlightGeometries(){this._plugins.render(...we),this._rctx.clear(256),this._renderHUDElements(2)}_renderShadowAccumulation(e,t,r,i){this._shadowAccumulator.updateDepthRange(e),this._shadowAccumulator.accumulating&&this._bindParameters.depth&&this._shadowAccumulator.renderAccumulation(this._bindParameters.depth,t,r,i)&&this.performanceInfo.advance(de.ACCUMULATED_SHADOWS)}_precompileTransparentGeometry(){this._oitEnabled&&q(this._renderContext.output)?(this._bindParameters.oitPass=1,this._plugins.precompile(...ce),this._bindParameters.oitPass=2,this._plugins.precompile(...ce),this._bindParameters.oitPass=0):this._plugins.precompile(...ce)}_renderOIT(e,t=2){const r=1===e,i=this._framebufferSize,s=r?()=>this._renderHUDElements(t):()=>this._renderTransparentGeometry(),a=this._bindParameters,n=this._renderContext.output;this._renderContext.output=0,a.oitPass=1;const h=r?"oit hud":"oit",o=this.fboCache.acquire(i.width,i.height,h,8),d=this._bindParameters.hasEmission;d&&o.acquireColor(le,8,"oit emissive"),o.acquireColor(d?ue:le,7,"oit alpha"),r||o.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(o.fbo),this._rctx.clearFramebuffer([0,0,0,1]),d&&this._rctx.clearBuffer(1,x),s(),o.detachDepth(),a.oitPass=2;const _=this.fboCache.acquire(i.width,i.height,r?"oit hud front":"oit front");let l;return d&&_.acquireColor(le,8,"oit emissive front"),r?_.acquireDepth(12):_.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(_.fbo),this._rctx.clearFramebuffer(D,r),s(),_.detachDepth(),a.oitPass=0,r?(l=this.fboCache.acquire(i.width,i.height,"oit hud composite"),this._rctx.bindFramebuffer(l.fbo),this._rctx.setClearColor(0,0,0,1e-13),this._rctx.clear(16384)):this._framebuffer.bind(),this._oitblend??=new k(this._techniques),this._oitblend.blend(this._rctx,o,_,a,d,!r),l?.detachDepth(),_.release(),o.release(),this._renderContext.output=n,l}_renderOpaque(){const e=this.plugins.produces(0,...me);if(e){this._plugins.render(0,1);const e=this._framebuffer;e.update(e=>this._renderNodes(y.CUTFILL_COLOR,e)),e.update(e=>this._renderNodes(y.OPAQUE_TERRAIN,e)),e.bind(),this._plugins.render(2,3)}const t=this._framebuffer;this._renderTerrainDepth(),t.update(t=>this._renderNodes(R.OPAQUE,t,e)),this.fboCache.debugCallback?.(R.OPAQUE,t.color.fbo),t.update(e=>this._renderNodes(y.OPAQUE_ENVIRONMENT,e)),this.fboCache.debugCallback?.(y.OPAQUE_ENVIRONMENT,t.color.fbo),this._renderEdges(1)}_renderTransparent(e){const t=this._framebuffer;t.bind(),this._renderPlugins(21,de.VOXEL),this._renderHiddenTransparentEdges(),e&&(this._oitEnabled?this._renderOIT(0):this._renderTransparentGeometry()),t.update(t=>this._renderNodes(R.TRANSPARENT,t,e)),this.fboCache.debugCallback?.(R.TRANSPARENT,t.color.fbo),this._renderGeometryDepth(),this._renderHUDVisibility(),this._needsTerrainDepth||this._plugins.render(16),this._renderEdges(0);const r=this._renderPhotoshopTerrain(),i=r?.getTexture();i&&this._bindParameters.hudVisibility&&(this._needsTerrainDepth?this._renderLineCallouts(0):(this._rctx.bindFramebuffer(this._bindParameters.hudVisibility?.fbo),this._compositingHelper.compositeHUD(this._bindParameters,i)),this._renderHUD(0,t.color)),this._bindParameters.cullAboveTerrain=!1,i&&(t.bind(),this._compositingHelper.compositePreMultipliedAlpha(this._bindParameters,i),r?.release(),this._needsTerrainDepth&&(this._renderEdges(1),e&&(this._oitEnabled?this._renderOIT(0):this._renderTransparentGeometry(),this.performanceInfo.advance(de.TRANSPARENT)),this._renderEdges(0))),this._bindParameters.ssao=d(this._bindParameters.ssao),this._needsTerrainDepth&&this._renderLineCallouts(1),this._bindParameters.terrainDepthTest=!1,this._renderTransparentEnvironment()}_renderTransparentEnvironment(){this._shadowAccumulator.render(this._bindParameters),this.performanceInfo.advance(de.APPLY_ACCUMULATED_SHADOWS),this._framebuffer.bind(),this._plugins.render(9),this.performanceInfo.advance(de.TRANSPARENT_MATERIAL_WITHOUT_DEPTH)}_renderPlugins(e,t){this._plugins.produces(this._renderContext.output,e)&&(this._plugins.render(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 V(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=T:(C(Se,this._bindParameters.camera.viewMatrix),C(Te,this._bindParameters.camera.projectionMatrix),w(Ee,Se,Te),w(Ee,this._renderContext.lastFrameCamera.viewMatrix,Ee),w(Ee,this._renderContext.lastFrameCamera.projectionMatrix,Ee),this._reprojectionMatrix=Ee);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=T,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(1)}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(){}};e([g({readOnly:!0})],pe.prototype,"highResolutionAtmosphere",null),e([g()],pe.prototype,"_edgeView",void 0),e([g()],pe.prototype,"updating",null),pe=e([b("esri.views.3d.webgl-engine.lib.Renderer")],pe);const me=[0,1,2,3],ce=[7,8,4,5],fe=[6,7,8],ge=[0,1,2,4,...fe],be=[3,5],Pe=[2,4,9],Ce=[17,14,15],we=[4,5,2,3,0,1,...fe],Te=S(),Se=S(),Ee=S();function xe(e){return t=>e.immediate.schedule(t)}export{pe as Renderer};
5
+ import{__decorate as e}from"tslib";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"../../../../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 u,initial as p,sync as m}from"../../../../core/reactiveUtils.js";import{signal as c}from"../../../../core/signal.js";import{Milliseconds as f}from"../../../../core/time.js";import{property as g,subclass as b}from"../../../../core/accessorSupport/decorators.js";import{equals as P,invert as C,multiply as w}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as T,create as S}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{c as E}from"../../../../chunks/vec42.js";import{ZEROS as x}from"../../../../core/libs/gl-matrix-2/factories/vec4f32.js";import{fromValues as A,ZEROS as D}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{pruneIndexArrays as I}from"../../../../geometry/support/Indices.js";import{RenderCategory as R,InternalRenderCategory as y}from"../../webgl.js";import{innerAtmosphereFadeStart as O}from"../../environment/atmosphereUtils.js";import{minNearDistanceInMeters as F}from"../../state/NearFarHeuristic.js";import{debugFlags as v}from"../../support/debugFlags.js";import{FBOCache as H,defaultWebGLFBO as M}from"../core/FBOCache.js";import{RenderPassManager as N}from"../core/renderPasses/RenderPassManager.js";import{isColor as q}from"../core/shaderLibrary/ShaderOutput.js";import{distanceFadeEnd as G}from"../core/shaderLibrary/shading/ScreenSpaceConstants.js";import{RenderNodes as L}from"../effects/RenderNodes.js";import{RenderPluginManager as U}from"../effects/RenderPluginManager.js";import{Blit as V}from"../effects/blit/Blit.js";import{maxHighlightsPerChannel as j,renderHighlightBuffer as B}from"../effects/highlight/Highlight.js";import{OITBlend as k}from"../effects/transparency/OITBlend.js";import{AnimationTimer as z}from"./AnimationTimer.js";import{AnimationTimeStep as W}from"./AnimationTimeStep.js";import{BoundingInfo as Q}from"./BoundingInfo.js";import{DepthRange as Y}from"./DepthRange.js";import{depthRangeFromScene as Z}from"./depthRangeUtils.js";import{hudFragmentOpacityParameters as J}from"./hudFragmentOpacityParameters.js";import{MainFramebuffer as K}from"./MainFramebuffer.js";import{RenderContext as X,defaultRenderOccludedMask as $}from"./RenderContext.js";import{RendererBase as ee}from"./RendererBase.js";import{setupFeatureDefaults as te}from"./RenderFeature.js";import{RenderPluginInput as re}from"./RenderPluginInput.js";import{ShadowAccumulator as ie}from"./ShadowAccumulator.js";import{ShadowMap as se}from"./ShadowMap.js";import ae from"./SliceHelper.js";import{MergedRenderer as ne}from"../materials/renderers/MergedRenderer.js";import{RenderSceneResult as he}from"../parts/renderUtils.js";import{RendererPerformanceInfo as oe,PerformanceCategory as de}from"../statistics/RendererPerformanceInfo.js";import{PixelType as _e,ColorAttachment1 as le,ColorAttachment2 as ue}from"../../../webgl/enums.js";let pe=class extends ee{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 N,this._isRendering=!1,this._inGlobeView=!1,this._backgroundColor=A(0,0,0,1),this._sliceHelper=new ae,this._blit=null,this._oitblend=null,this.sceneDepthRange=c(Y.Infinite),this._state=c(2),this._hasAnimations=!1,this._animationTimestep=new W,this._loadEdgeViewTask=null,this._edgeViewCallbacks=[],this._reprojectionMatrixVersion=c(0),this._lastFrameTime=f(0),this._renderHiddenTransparentEdges=()=>{},this._pluginInput=new re,this._releaseNormals=e=>{e.some(({name:e})=>"normals"===e)&&this._pluginInput.release("normals")},this._debugNeedsDepth=!1,this._fboCache=new H(s),this._renderStateFeatures=c(te(e.view.qualityProfile)),this._framebuffer=new K(this.fboCache),this._performanceInfo=new oe(this._rctx),this._shadowMap=new se(this.fboCache,e.viewingMode),this._shadowAccumulator=new ie(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(3,t.shadowMap),t.shadowMap.finish(),t.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(t.camera,t.contentCamera)},n),this._renderContext=new X(this._rctx,this._shadowMap,r),this._nodes=new L(this._renderContext),this._plugins=new U({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(),u),l(()=>v.EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES,e=>{this._renderHiddenTransparentEdges=e?()=>this._renderEdges(0):()=>{},n()},p),l(()=>e.view.environment.background?.color,e=>{const t=e?i(e):D;E(this._backgroundColor,t[0]*t[3],t[1]*t[3],t[2]*t[3],t[3]),n()},u),l(()=>e.view.state.camera.relativeElevation,e=>this._inGlobeView=(e??1/0)>=G,u),l(()=>this._bindParameters.clouds.fadeFactor,()=>{this._bindParameters.fadeLighting(),this._requestRender(2)},m),l(()=>this._bindParameters.clouds.data?.state,()=>n(),m),l(()=>e.view.state.highlights,e=>{this._bindParameters.highlights=e,n()},p)])}destroy(){this._gpuTimerHandle=n(this._gpuTimerHandle),this._nodes.destroy(),this._framebuffer.dispose(),this._shadowMap.dispose(),this._shadowAccumulator.destroy(),this._shadowAccumulator=null,this._loadEdgeViewTask=h(this._loadEdgeViewTask),this._edgeView=o(this._edgeView),this.renderPassManager.dispose(),this._releaseFBOs(),this._disposeOffscreenBuffers(),this._fboCache.destroy(),this._fboCache=null,this._plugins.destroy(),this._plugins=null,this._pluginInput=null,this._blit=null,this._oitblend=null,this._compositingHelper=null,this._nodes=null,this._framebuffer=null,this._shadowMap=null,this._renderContext=null,this._performanceInfo=null,Q.prune(),ne.prune(),I()}get renderContext(){return this._renderContext}get _bindParameters(){return this._renderContext.bind}get _framebufferSize(){return this._framebuffer.size}get performanceInfo(){return this._performanceInfo}updateRenderFeatures(e){this._renderStateFeatures.value=te(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.isFeatureEnabled(1)}get hasReflections(){return this._pluginsHas.water&&this.isFeatureEnabled(5)}get _hasHighlights(){return this._plugins.produces(8,2,4,19,14,15)}hasHighlight(e){return this._plugins.hasHighlight(e)}get _hasHUDHighlights(){return this._plugins.produces(8,14,15)}get hasSSAO(){return this.isFeatureEnabled(4)&&!this._inGlobeView}get hasSMAA(){return this.isFeatureEnabled(0)}get hasEmitters(){return this._plugins.hasEmitters&&this._hasFloatBufferBlendSupport}get highResolutionAtmosphere(){return this.isFeatureEnabled(3)}get fboCache(){return this._fboCache}_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.readyToRun||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:xe(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&&P(this._bindParameters.ssr.reprojectionMatrix,T)}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.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()),e.environment){void 0!==e.environment.weather&&(this._bindParameters.weather=e.environment.weather);const t="virtual"!==e.environment.lighting.type;r.enableFillLights!==t&&(r.enableFillLights=t,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 _hasFloatBufferBlendSupport(){return this._rctx.driverTest.floatBufferBlend.result}get _oitEnabled(){return this._highQualityTransparency&&this._hasFloatBufferBlendSupport}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)}get occludedRequiresStencil(){return this.occludedRequiresOccludeeStencil||this.occludedRequiresIntegratedMeshStencil}get occludedRequiresOccludeeStencil(){return this._bindParameters.hasOccludees&&!!(8&this.plugins.renderOccludedFlags)}get occludedRequiresIntegratedMeshStencil(){return this._plugins.produces(0,0)&&this._plugins.produces(0,10)}updateHasFlags(){const has=this._pluginsHas;has.hudElements=this._plugins.produces(0,...Ce),has.water=this._plugins.produces(2,20),this._bindParameters.hasOccludees=this._plugins.hasOccludees,this._requestRender()}updateAnimation(e,t){this._animationTimer??=new z(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,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 he(this._pluginInput.get(R.FINAL),null)}_render(e,t,r,i){const s=0===r;this.performanceInfo.startFrame(),this.fboCache.frameStart(),this.fboCache.interactive=s,this._disposeBindBuffers();const{camera:a,contentCamera:n,mode:h,alignPixelEnabled:o}=e;this._state.value=h;const d=this._nodes.produces("magnifier-color"),_=this._nodes.produces(R.FINAL);this._renderContext.time=t,this._renderContext.output=0,this._bindParameters.hasEmission=this.hasEmitters,this._bindParameters.oitPass=0,this._bindParameters.alignPixelEnabled=o,this._bindParameters.decorations=!i,this._bindParameters.mainDepth=null;const l=!i||!this._sliceHelper.isDecoration;this._bindParameters.slicePlane=l?this._sliceHelper.plane:null,this._bindParameters.viewshedEnabled=this._nodes.produces(y.VIEWSHED),this._bindParameters.cutFillEnabled=this._nodes.produces(y.CUTFILL_DEPTH),this._renderOverlay(),a.setGLViewport(this._rctx);const u=this._framebuffer,p=u.initialize(a.fullWidth,a.fullHeight,this._backgroundColor,this._bindParameters.hasEmission);this.hasReflections?(p?.setName("last frame color"),this._bindParameters.ssr.lastFrameColor=p):p?.release(),this._ensureBindParametersCamera(a,n),this._updateHUDOccludedFragmentOpacity(h,t),this._plugins.prepareRender(),this._bindParameters.shadowHighlightsVisible=this._needsShadowHighlight&&!i;const m=this._plugins.produces(0,...ce);this._precompilePrepasses(),this.performanceInfo.advance(de.PREPARE);const c=this._computeShadowDepthRange(a);this._renderShadowMap(a,this._bindParameters.lighting.mainLight.direction,c),this._pluginInput.set("normals",this._renderNormals()),this._renderRemainingGeometryDepth(),this._renderShadowAccumulation(c,a,n,!s),this._ensureBindParametersSSR(t),this._precompileShaders(m),this._renderContext.output=0,u.bind(),this._bindParameters.mainDepth=u.depth.attachment,this._renderOpaque(),this._renderTransparent(m),this._shadowMap.disposeMainBuffer(),this._pluginInput.set(y.FOCUSAREA,this._renderFocusAreaGeometry()),this._pluginInput.set(y.CUTFILL_DEPTH,this._renderCutFillDepth()),u.update(e=>this._renderNodes(y.TRANSPARENT_ENVIRONMENT,e)),u.update(e=>this._renderNodes(y.VIEWSHED,e)),u.update(e=>this._renderNodes(y.LASERLINES,e)),u.update(e=>this._renderNodes(y.FOCUSAREA_COLOR,e)),this._pluginInput.release(y.FOCUSAREA),this._pluginInput.release(y.CUTFILL_DEPTH),u.update(e=>this._renderNodes(y.OCCLUDED,e)),this._pluginInput.set("highlights",this._renderHighlightPrepass()),this._renderHighlightShadowMap(a,this._bindParameters.lighting.mainLight.direction,c);const f=2===r?this._renderObjectAndLayerIdColor():null;u.update(e=>this._renderNodes(R.COMPOSITE,e)),this._shadowMap.disposeOffscreenBuffers();const g=s&&!_&&!(d&&!i),b=this._pluginInput.get(R.COMPOSITE),P=g?M:this.fboCache.acquire(b.fbo.width,b.fbo.height,y.ANTIALIASING),C=this._nodes.produces(y.ANTIALIASING)?this._renderNodes(y.ANTIALIASING,P):this.blitFBO(b,P,!1);let w;this._pluginInput.set(y.ANTIALIASING,C),this._hasHUDHighlights?(this._renderHUD(1,C),w=this._renderNodes(y.HIGHLIGHTS,C)):(w=this._renderNodes(y.HIGHLIGHTS,C),this._renderHUD(1,w));const T=this._renderNodes(y.MAGNIFIER,w);return s&&d&&!i&&!_&&this.blitFBO(T),_?(T.attachDepth(u.depth),this.blitFBO(this._renderNodes(R.FINAL,T)),T.detachDepth()):this._pluginInput.set(R.FINAL,T),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(),s||(this._releaseFBOs(),this._disposeOffscreenBuffers()),new he(this._pluginInput.get(R.FINAL),f)}_precompileShaders(e){++this._plugins.context.techniques.precompiling,this._renderContext.output=0,this._precompileOpaqueGeometry(),this._nodes.precompile(y.OPAQUE_ENVIRONMENT),this._bindParameters.terrainDepthTest=this._bindParameters.cullAboveTerrain=this._needsTerrainDepth,this._renderContext.output=1,this._plugins.precompile(...fe),this._needsTerrainDepth&&(this._precompileOpaqueGeometry(),this._precompileTransparentGeometry()),this._renderContext.output=0,this._plugins.precompile(...fe),e&&(this._precompileTransparentGeometry(),this._hasPhotoshopTerrain&&(this._bindParameters.cullAboveTerrain=!1,this._precompileTransparentGeometry(),this._bindParameters.cullAboveTerrain=this._needsTerrainDepth)),this._nodes.precompile(y.FOCUSAREA),this._needsHUDVisibility&&this._plugins.precompile(13),this._plugins.precompile(16),this._precompileHUD(0),this._bindParameters.terrainDepthTest=!1,this._bindParameters.cullAboveTerrain=!1,this._nodes.precompile(y.VIEWSHED,y.CUTFILL_DEPTH,y.CUTFILL_COLOR,y.LASERLINES,y.FOCUSAREA_COLOR,y.OCCLUDED,y.ANTIALIASING,y.HIGHLIGHTS);const t=this._bindParameters;t.highlightMixTexture=t.highlights.length>1?this._rctx.emptyTexture:null,this._precompileHUD(1),this._hasHighlights&&(t.highlights.forEach((e,r)=>{t.highlightLevel=r,this._precompileAllGeometry(8)}),t.highlightLevel=null),t.highlightMixTexture=null,this._nodes.precompile(R.COMPOSITE,y.MAGNIFIER),this._shadowAccumulator.precompile(),this._plugins.precompile(9),--this._plugins.context.techniques.precompiling}_renderFocusAreaGeometry(){const e=this._nodes.produce(y.FOCUSAREA,this._pluginInput);return e&&this.performanceInfo.advance(de.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(13),r=this._nodes.render(r,this._pluginInput),--this._techniques.precompiling,this.performanceInfo.advance(de.OBJECT_AND_LAYER_ID_COLOR),this._renderContext.output=e,r}finish(e){this._hasAnimations||this._animationTimestep.clear();const t=this.performanceInfo.gpuSamplingEnabled,r=0===e;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(D),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],6408,_e.UNSIGNED_BYTE,t),s.release()}readHUDVisibility(e,t,r,i,s){this._bindParameters.hudVisibility?.fbo?.readPixels(e,t,r,i,6408,_e.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=this._bindParameters.geometryDepth,a=()=>t.render(this._bindParameters,e);this.renderToTargets(a,i,s??this._framebuffer.depth,D),this._framebuffer.bind(),this._compositingHelper.composite(this._bindParameters,i.getTexture()),i.release(),this.performanceInfo.advance(1===e?de.OPAQUE_EDGES:de.TRANSPARENT_EDGES)}_renderOverlay(){this._bindParameters.overlay=this.overlay?.render(),this._bindParameters.overlay&&this.performanceInfo.advance(de.OVERLAY)}_renderShadowMap(e,t,r){if(!this.shadowsEnabled)return;const i=this._shadowMap;i.start(e,t,r,this.isFeatureEnabled(6),this.stage.view.qualitySettings.maximumPixelRatio),this._needsShadowHighlight?(this._renderShadowCascades(5,this._shadowMap),i.copySnapshot(1),this._renderShadowCascades(4,this._shadowMap)):this._renderShadowCascades(3),i.finish(),e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,this._bindParameters.contentCamera),this.performanceInfo.advance(de.SHADOW_MAP)}_renderHighlightShadowMap(e,t,r){if(!this.shadowsEnabled||!this._needsShadowHighlight)return;const i=this._shadowMap;i.start(e,t,r,this.isFeatureEnabled(6),this.stage.view.qualitySettings.maximumPixelRatio),this._renderShadowCascades(4,this._shadowMap),i.moveSnapshot(0),i.finish(),e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,this._bindParameters.contentCamera),this.performanceInfo.advance(de.SHADOW_MAP)}_renderCutFillDepth(){return this._nodes.produce(y.CUTFILL_DEPTH,this._pluginInput)}_precompileShadowCascades(e){0!==this._shadowMap.cascades.length&&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(1)||this._nodes.requireGeometryDepth()||this.hasReflections||this._needsShadowHighlight||this._shadowAccumulator.active||this._debugNeedsDepth}_renderRemainingGeometryDepth(){const e=this._pluginInput.get("normals");e?(this._pluginInput.set(y.SSAO,this._renderSSAO()),this._needsDepth?(this._rctx.bindFramebuffer(e.fbo),this._rctx.clear(1024),this._renderGeometryWithoutNormals(1),d(this._bindParameters.depth),this._bindParameters.depth=e.obtainDepthTexture(),this.performanceInfo.advance(de.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,"geometry depth",13);this._rctx.bindFramebuffer(t.fbo),this._rctx.clear(1280),this.renderAllGeometry(1),d(this._bindParameters.depth),this._bindParameters.depth=t.obtainDepthTexture(),t.release(),this.performanceInfo.advance(de.DEPTH)}_renderTerrainDepth(){if(this._bindParameters.terrainDepth=d(this._bindParameters.terrainDepth),this._bindParameters.terrainDepthTest=this._bindParameters.cullAboveTerrain=this._needsTerrainDepth,!this._needsTerrainDepth)return;const e=this._renderContext.output;this._renderContext.output=1;const t=this._framebufferSize,r=this.fboCache.acquire(t.width,t.height,"terrain depth",13);this._rctx.bindFramebuffer(r.fbo),this._rctx.clear(1280),this._renderTransparentGround(),this._bindParameters.terrainDepth=r.obtainDepthTexture(),r.release(),this._renderContext.output=e}_renderGeometryDepth(){if(!this._needsTerrainDepth)return void(this._bindParameters.geometryDepth=d(this._bindParameters.geometryDepth));const e=this._renderContext.output,{width:t,height:r}=this._framebufferSize,i=this.fboCache.acquire(t,r,"geometry depth",13);this._rctx.bindFramebuffer(i.fbo),this._rctx.clear(1280),this._renderOpaqueAndTransparentGeometry(1),this._renderContext.output=e,d(this._bindParameters.geometryDepth),this._bindParameters.geometryDepth=i.obtainDepthTexture(),i.release()}get _needsShadowDepthRange(){return this._shadowMap.enabled||this._shadowAccumulator.active}_computeShadowDepthRange(e){if(!this._needsShadowDepthRange)return Y.Zero;const t=Z(e,this._plugins.plugins,this.stage.layers,0);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=Y.Infinite);if((this.stage.view.renderCoordsHelper?.getAltitude(e.eye)??0)<O)return void(this.sceneDepthRange.value=Y.Infinite);const t=e.clone();t.near=F,t.far=1e10;const r=Z(t,this._plugins.plugins,this.stage.layers,1);r.union(this._plugins.queryDepthRange(t)),this.sceneDepthRange.value.equals(r)||(this.sceneDepthRange.value=r)}get _normalsRequired(){const e=this._nodes.require("normals",R.FINAL,R.COMPOSITE,R.OPAQUE,R.TRANSPARENT,y.VIEWSHED,y.LASERLINES);return(this.hasSSAO?1:0)+e}_updateHUDOccludedFragmentOpacity(e,t){const{idleOpacity:r,navigatingOpacity:i,maxDelta:n,tiltFadeStart:h,tiltFadeEnd:o,altitudeStart:d,altitudeEnd:_}=J,l=this.stage.view,u=l.stateManager.camera,p=l.qualitySettings.fadeDuration,m=2===e?r:i,c=s((u.tilt-h)/(o-h),0,1),f=s(((u.position.z??0)-d)/(_-d),0,1),g=a(a(1,m,c),1,f),b=this._bindParameters.hudOccludedFragmentOpacity;if(p<=0||b===g||0===this._lastFrameTime||this._lastFrameTime>t)return this._bindParameters.hudOccludedFragmentOpacity=g,void(this._lastFrameTime=t);const P=t-this._lastFrameTime;this._lastFrameTime=t;const C=Math.max(1-r,Math.abs(r-i)),w=Math.min(C*P/p,n);w>=Math.abs(g-b)?this._bindParameters.hudOccludedFragmentOpacity=g:(this._bindParameters.hudOccludedFragmentOpacity=b+Math.sign(g-b)*w,this._requestRender())}_precompilePrepasses(){this._normalsRequired&&this._precompileAllGeometry(2),this._needsDepth&&this._precompileAllGeometry(1),this.shadowsEnabled&&(this._needsShadowHighlight?(this._precompileShadowCascades(4),this._precompileShadowCascades(5)):this._precompileShadowCascades(3)),this._shadowAccumulator.active&&this._precompileAllGeometry(3)}_renderNormals(){const e=this._normalsRequired;if(0===e)return;const t=this._framebufferSize,r=this.fboCache.acquire(t.width,t.height,"normals",5);r.acquireDepth(13),this._rctx.bindFramebuffer(r.fbo),this._rctx.clearFramebuffer(D,!0,!0),this._renderContext.output=2,this._plugins.render(...ge);const i=this._nodes.optional("normals",R.FINAL,R.COMPOSITE,R.OPAQUE,R.TRANSPARENT,y.VIEWSHED);return r.retain(e+i-1),this.performanceInfo.advance(de.NORMALS),r}_renderSSAO(){const e=this._pluginInput.get("normals");if(!this.hasSSAO||!e)return;const t=this._nodes.produce(y.SSAO,this._pluginInput);return this._bindParameters.ssao=t,t&&this.performanceInfo.advance(de.SSAO),t}_precompileAllGeometry(e){const t=this._renderContext.output;this._renderContext.output=e,this._precompileOpaqueGeometry(),this._precompileTransparentGeometry(),this._plugins.precompile(...fe),this._renderContext.output=t}renderAllGeometry(e){this._renderContext.output=e,this._renderOpaqueAndTransparentGeometry(e),this._renderTransparentGround()}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,...Pe);this._renderContext.renderOccludedMask=$}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)})}renderOccludedSlots(e,t){this._renderContext.renderOccludedMask=t,this.plugins.renderOccludedFlags>1&&this._plugins.render(10),this.renderSlots(e,...Pe),this._renderContext.renderOccludedMask=$}renderHUD(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(14)}precompileViewshedShadowMap(){this._precompileAllGeometry(6)}precompileCutFill(){const e=7,t=this._renderContext.output;this._renderContext.output=e,this._plugins.precompile(0,1,...fe),this._renderContext.output=t}renderViewshedShadowMap(e){const{camera:t,contentCamera:r}=this._bindParameters,i=this._renderContext.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this.renderAllGeometry(6),this._ensureBindParametersCamera(t,r),this._bindParameters.camera.setGLViewport(this._rctx),this._renderContext.output=i}renderCutFillReferenceDepth(e){const{camera:t,contentCamera:r}=this._bindParameters,i=this._renderContext.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this._renderContext.output=7,this._plugins.render(0,1,...fe),this._ensureBindParametersCamera(t,r),t.setGLViewport(this._rctx),this._renderContext.output=i}_renderOpaqueAndTransparentGeometry(e){this._renderContext.output=e,this._renderOpaqueGeometry(),this._renderTransparentGeometry()}_renderGeometryWithoutNormals(e){this._renderContext.output=e,this._plugins.render(...be)}_precompileOpaqueGeometry(){this._plugins.precompile(...me),this._nodes.precompile("opaque-color")}_renderOpaqueGeometry(){this._plugins.render(...me)}_renderTransparentGeometry(){this._plugins.render(...ce)}get _hasPhotoshopTerrain(){return this._plugins.produces(0,6)}get _needsTerrainDepth(){return this._highQualityTransparency&&this._hasPhotoshopTerrain}_renderPhotoshopTerrain(){if(!this._hasPhotoshopTerrain)return null;const e=this._framebufferSize,t=this.fboCache.acquire(e.width,e.height,"transparent terrain");return this.renderToTargets(()=>this._plugins.render(6),t,this._framebuffer.depth,D),this.performanceInfo.advance(de.TRANSPARENT_TERRAIN),t}_renderTransparentGround(){this._plugins.render(...fe)}get _needsHUDVisibility(){return this._plugins.produces(this._renderContext.output,13)}_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",4),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(13),r.detachDepth(),this._framebuffer.bind(),this.performanceInfo.advance(de.HUD_VISIBILITY)}_renderLineCallouts(e){if(this._bindParameters.hudRenderStyle=e,0===e){const e=()=>this._plugins.render(16),t=this._framebufferSize,r=this.fboCache.acquireDepth(12,t.width,t.height,"line callouts");this.renderToTargets(e,this._framebuffer.color,r,void 0,!0,!0),r.release()}else this._plugins.render(16)}_precompileHUD(e){if(this._precompileHUDOutput(e),this._hasHighlights){const t=this._renderContext.output;this._renderContext.output=8,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=1,this._plugins.precompile(...Ce),this._bindParameters.oitPass=2,this._plugins.precompile(...Ce),this._bindParameters.oitPass=0):this._plugins.precompile(...Ce),this._bindParameters.hudRenderStyle=t}_renderHUD(e,t){if(this._pluginsHas.hudElements){if(this._oitEnabled){const r=this._renderOIT(1,e);this._rctx.bindFramebuffer(t.fbo),this._compositingHelper.compositePreMultipliedAlpha(this._bindParameters,r.getTexture(),!1),r.release()}else if(this._renderContext.output=0,0===e){const t=()=>this._renderHUDElements(e),r=this._framebufferSize,i=this.fboCache.acquireDepth(12,r.width,r.height,"hud");this.renderToTargets(t,this._framebuffer.color,i,void 0,!0,!0),i.release()}else t.acquireDepth(12),this._rctx.bindFramebuffer(t.fbo),this._renderHUDElements(e),t.detachDepth();this.performanceInfo.advance(0===e?de.HUD_OCCLUDED:de.HUD)}}_renderHUDElements(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(...Ce)}get _needsShadowHighlight(){return this.shadowsEnabled&&this._plugins.produces(4,2)}_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>j?3:1);a.acquireDepth(13);const n=this._plugins.produces(8,0);return n&&this._framebuffer.color.fbo&&a.fbo&&t.blitFramebuffer(this._framebuffer.color.fbo,a.fbo,1024),t.bindFramebuffer(a.fbo),t.gl.clearBufferuiv(6144,0,[0,0,0,0]),n||t.clear(1024),this._renderContext.output=8,t.bindFramebuffer(a.fbo),B(t,e,i,r,()=>this._renderHighlightGeometries()),a.detachDepth(),this.performanceInfo.advance(de.HIGHLIGHTS),a}_renderHighlightGeometries(){this._plugins.render(...we),this._rctx.clear(256),this._renderHUDElements(2)}_renderShadowAccumulation(e,t,r,i){this._shadowAccumulator.updateDepthRange(e),this._shadowAccumulator.accumulating&&this._bindParameters.depth&&this._shadowAccumulator.renderAccumulation(this._bindParameters.depth,t,r,i)&&this.performanceInfo.advance(de.ACCUMULATED_SHADOWS)}_precompileTransparentGeometry(){this._oitEnabled&&q(this._renderContext.output)?(this._bindParameters.oitPass=1,this._plugins.precompile(...ce),this._bindParameters.oitPass=2,this._plugins.precompile(...ce),this._bindParameters.oitPass=0):this._plugins.precompile(...ce)}_renderOIT(e,t=2){const r=1===e,i=this._framebufferSize,s=r?()=>this._renderHUDElements(t):()=>this._renderTransparentGeometry(),a=this._bindParameters,n=this._renderContext.output;this._renderContext.output=0,a.oitPass=1;const h=r?"oit hud":"oit",o=this.fboCache.acquire(i.width,i.height,h,8),d=this._bindParameters.hasEmission;d&&o.acquireColor(le,8,"oit emissive"),o.acquireColor(d?ue:le,7,"oit alpha"),r||o.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(o.fbo),this._rctx.clearFramebuffer([0,0,0,1]),d&&this._rctx.clearBuffer(1,x),s(),o.detachDepth(),a.oitPass=2;const _=this.fboCache.acquire(i.width,i.height,r?"oit hud front":"oit front");let l;return d&&_.acquireColor(le,8,"oit emissive front"),r?_.acquireDepth(12):_.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(_.fbo),this._rctx.clearFramebuffer(D,r),s(),_.detachDepth(),a.oitPass=0,r?(l=this.fboCache.acquire(i.width,i.height,"oit hud composite"),this._rctx.bindFramebuffer(l.fbo),this._rctx.setClearColor(0,0,0,1e-13),this._rctx.clear(16384)):this._framebuffer.bind(),this._oitblend??=new k(this._techniques),this._oitblend.blend(this._rctx,o,_,a,d,!r),l?.detachDepth(),_.release(),o.release(),this._renderContext.output=n,l}_renderOpaque(){const e=this.plugins.produces(0,...me);if(e){this._plugins.render(0,1);const e=this._framebuffer;e.update(e=>this._renderNodes(y.CUTFILL_COLOR,e)),e.update(e=>this._renderNodes(y.OPAQUE_TERRAIN,e)),e.bind(),this._plugins.render(2,3)}const t=this._framebuffer;this._renderTerrainDepth(),t.update(t=>this._renderNodes(R.OPAQUE,t,e)),this.fboCache.debugCallback?.(R.OPAQUE,t.color.fbo),t.update(e=>this._renderNodes(y.OPAQUE_ENVIRONMENT,e)),this.fboCache.debugCallback?.(y.OPAQUE_ENVIRONMENT,t.color.fbo),this._renderEdges(1)}_renderTransparent(e){const t=this._framebuffer;t.bind(),this._renderPlugins(21,de.VOXEL),this._renderHiddenTransparentEdges(),e&&(this._oitEnabled?this._renderOIT(0):this._renderTransparentGeometry()),t.update(t=>this._renderNodes(R.TRANSPARENT,t,e)),this.fboCache.debugCallback?.(R.TRANSPARENT,t.color.fbo),this._renderGeometryDepth(),this._renderHUDVisibility(),this._needsTerrainDepth||this._plugins.render(16),this._renderEdges(0);const r=this._renderPhotoshopTerrain(),i=r?.getTexture();i&&this._bindParameters.hudVisibility&&(this._needsTerrainDepth?this._renderLineCallouts(0):(this._rctx.bindFramebuffer(this._bindParameters.hudVisibility?.fbo),this._compositingHelper.compositeHUD(this._bindParameters,i)),this._renderHUD(0,t.color)),this._bindParameters.cullAboveTerrain=!1,i&&(t.bind(),this._compositingHelper.compositePreMultipliedAlpha(this._bindParameters,i),r?.release(),this._needsTerrainDepth&&(this._renderEdges(1),e&&(this._oitEnabled?this._renderOIT(0):this._renderTransparentGeometry(),this.performanceInfo.advance(de.TRANSPARENT)),this._renderEdges(0))),this._bindParameters.ssao=d(this._bindParameters.ssao),this._needsTerrainDepth&&this._renderLineCallouts(1),this._bindParameters.terrainDepthTest=!1,this._renderTransparentEnvironment()}_renderTransparentEnvironment(){this._shadowAccumulator.render(this._bindParameters),this.performanceInfo.advance(de.APPLY_ACCUMULATED_SHADOWS),this._framebuffer.bind(),this._plugins.render(9),this.performanceInfo.advance(de.TRANSPARENT_MATERIAL_WITHOUT_DEPTH)}_renderPlugins(e,t){this._plugins.produces(this._renderContext.output,e)&&(this._plugins.render(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 V(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=T:(C(Se,this._bindParameters.camera.viewMatrix),C(Te,this._bindParameters.camera.projectionMatrix),w(Ee,Se,Te),w(Ee,this._renderContext.lastFrameCamera.viewMatrix,Ee),w(Ee,this._renderContext.lastFrameCamera.projectionMatrix,Ee),this._reprojectionMatrix=Ee);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=T,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(1)}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(){}};e([g({readOnly:!0})],pe.prototype,"highResolutionAtmosphere",null),e([g()],pe.prototype,"_edgeView",void 0),e([g()],pe.prototype,"updating",null),pe=e([b("esri.views.3d.webgl-engine.lib.Renderer")],pe);const me=[0,1,2,3],ce=[7,8,4,5],fe=[6,7,8],ge=[0,1,2,4,...fe],be=[3,5],Pe=[2,4,9],Ce=[17,14,15],we=[4,5,2,3,0,1,...fe],Te=S(),Se=S(),Ee=S();function xe(e){return t=>e.immediate.schedule(t)}export{pe as Renderer};