@arcgis/core 4.31.0-next.20240821 → 4.31.0-next.20240823

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 (376) hide show
  1. package/assets/esri/core/workers/RemoteClient.js +1 -1
  2. package/assets/esri/core/workers/chunks/{24e38b7d1e9984a1472e.js → 033032715c3b04e0fc7d.js} +1 -1
  3. package/assets/esri/core/workers/chunks/{cfc93bbd35cc4bfde7c0.js → 045336db17aae6eef68f.js} +1 -1
  4. package/assets/esri/core/workers/chunks/04de7b2937d5ca7c23e2.js +1 -0
  5. package/assets/esri/core/workers/chunks/12a4b3706162872c2b41.js +769 -0
  6. package/assets/esri/core/workers/chunks/142b1336533fa2ac470b.js +47 -0
  7. package/assets/esri/core/workers/chunks/185e596f86767c22f951.js +1 -0
  8. package/assets/esri/core/workers/chunks/{cd8d595d577b74817623.js → 1a4b3820136fb615b730.js} +1 -1
  9. package/assets/esri/core/workers/chunks/29b157b41dfa16da886b.js +1 -0
  10. package/assets/esri/core/workers/chunks/300b57846114fedd12be.js +1 -0
  11. package/assets/esri/core/workers/chunks/{3f75b7ed24b440b4508a.js → 3d5f37c2f355260e6dc6.js} +1 -1
  12. package/assets/esri/core/workers/chunks/{a9eba26d62b62592cee1.js → 42861d54a336146753d8.js} +1 -1
  13. package/assets/esri/core/workers/chunks/4c8deac4bf72a5e2597a.js +1 -0
  14. package/assets/esri/core/workers/chunks/52107d450c55450f5c04.js +274 -0
  15. package/assets/esri/core/workers/chunks/6d54222301b6d819c904.js +1 -0
  16. package/assets/esri/core/workers/chunks/{eb0f180ed20af220a82e.js → 6ddece9cd94b60efe3d7.js} +1 -1
  17. package/assets/esri/core/workers/chunks/{566844774388a031fd74.js → 7125cff7fd288ff7bd5f.js} +1 -1
  18. package/assets/esri/core/workers/chunks/74de734a20b4cd2d7efb.js +1 -0
  19. package/assets/esri/core/workers/chunks/7712a23dc68220edaa64.js +1 -0
  20. package/assets/esri/core/workers/chunks/{ea561b2460e634a643fc.js → 7f35380809e7de99c302.js} +1 -1
  21. package/assets/esri/core/workers/chunks/7f3d49b667e9b46449e7.js +1 -0
  22. package/assets/esri/core/workers/chunks/8a2faf12938e811a9fc9.js +1 -0
  23. package/assets/esri/core/workers/chunks/{796c64b9caa1303e26ed.js → 8af503fa88c1668872eb.js} +1 -1
  24. package/assets/esri/core/workers/chunks/{e2a6f77c05d0818e3f74.js → 8e42ce8305cefba5debc.js} +1 -1
  25. package/assets/esri/core/workers/chunks/93169e55e472fec4bc50.js +1 -0
  26. package/assets/esri/core/workers/chunks/985c1f42aab564008c0d.js +1 -0
  27. package/assets/esri/core/workers/chunks/9a32d9d720cb81abfba2.js +1 -0
  28. package/assets/esri/core/workers/chunks/b171d57b4d0142f687d0.js +1 -0
  29. package/assets/esri/core/workers/chunks/d5e376893cd47605a438.js +1 -0
  30. package/assets/esri/core/workers/chunks/df9daac7ea581e9e5ca4.js +1 -0
  31. package/assets/esri/core/workers/chunks/f11ae249cc8e995bbccc.js +1 -0
  32. package/assets/esri/core/workers/chunks/{65d8011cf756b066cade.js → f218316de8b4635653b2.js} +1 -1
  33. package/assets/esri/libs/linkchartlayout/lclayout.wasm +0 -0
  34. package/assets/esri/libs/vxl/vxlLayer.wasm +0 -0
  35. package/assets/esri/themes/base/_core.scss +2 -0
  36. package/assets/esri/themes/base/widgets/_Grid.scss +0 -8
  37. package/assets/esri/themes/base/widgets/_GridControls.scss +86 -0
  38. package/assets/esri/themes/base/widgets/_Print.scss +13 -15
  39. package/assets/esri/themes/dark/main.css +1 -1
  40. package/assets/esri/themes/light/main.css +1 -1
  41. package/assets/esri/themes/light/view.css +1 -1
  42. package/assets/esri/widgets/Print/t9n/Print.json +1 -1
  43. package/assets/esri/widgets/Print/t9n/Print_ar.json +1 -1
  44. package/assets/esri/widgets/Print/t9n/Print_bg.json +1 -1
  45. package/assets/esri/widgets/Print/t9n/Print_bs.json +1 -1
  46. package/assets/esri/widgets/Print/t9n/Print_ca.json +1 -1
  47. package/assets/esri/widgets/Print/t9n/Print_cs.json +1 -1
  48. package/assets/esri/widgets/Print/t9n/Print_da.json +1 -1
  49. package/assets/esri/widgets/Print/t9n/Print_de.json +1 -1
  50. package/assets/esri/widgets/Print/t9n/Print_el.json +1 -1
  51. package/assets/esri/widgets/Print/t9n/Print_en.json +1 -1
  52. package/assets/esri/widgets/Print/t9n/Print_es.json +1 -1
  53. package/assets/esri/widgets/Print/t9n/Print_et.json +1 -1
  54. package/assets/esri/widgets/Print/t9n/Print_fi.json +1 -1
  55. package/assets/esri/widgets/Print/t9n/Print_fr.json +1 -1
  56. package/assets/esri/widgets/Print/t9n/Print_he.json +1 -1
  57. package/assets/esri/widgets/Print/t9n/Print_hr.json +1 -1
  58. package/assets/esri/widgets/Print/t9n/Print_hu.json +1 -1
  59. package/assets/esri/widgets/Print/t9n/Print_id.json +1 -1
  60. package/assets/esri/widgets/Print/t9n/Print_it.json +1 -1
  61. package/assets/esri/widgets/Print/t9n/Print_ja.json +1 -1
  62. package/assets/esri/widgets/Print/t9n/Print_ko.json +1 -1
  63. package/assets/esri/widgets/Print/t9n/Print_lt.json +1 -1
  64. package/assets/esri/widgets/Print/t9n/Print_lv.json +1 -1
  65. package/assets/esri/widgets/Print/t9n/Print_nb.json +1 -1
  66. package/assets/esri/widgets/Print/t9n/Print_nl.json +1 -1
  67. package/assets/esri/widgets/Print/t9n/Print_pl.json +1 -1
  68. package/assets/esri/widgets/Print/t9n/Print_pt-BR.json +1 -1
  69. package/assets/esri/widgets/Print/t9n/Print_pt-PT.json +1 -1
  70. package/assets/esri/widgets/Print/t9n/Print_ro.json +1 -1
  71. package/assets/esri/widgets/Print/t9n/Print_ru.json +1 -1
  72. package/assets/esri/widgets/Print/t9n/Print_sk.json +1 -1
  73. package/assets/esri/widgets/Print/t9n/Print_sl.json +1 -1
  74. package/assets/esri/widgets/Print/t9n/Print_sr.json +1 -1
  75. package/assets/esri/widgets/Print/t9n/Print_sv.json +1 -1
  76. package/assets/esri/widgets/Print/t9n/Print_th.json +1 -1
  77. package/assets/esri/widgets/Print/t9n/Print_tr.json +1 -1
  78. package/assets/esri/widgets/Print/t9n/Print_uk.json +1 -1
  79. package/assets/esri/widgets/Print/t9n/Print_vi.json +1 -1
  80. package/assets/esri/widgets/Print/t9n/Print_zh-CN.json +1 -1
  81. package/assets/esri/widgets/Print/t9n/Print_zh-HK.json +1 -1
  82. package/assets/esri/widgets/Print/t9n/Print_zh-TW.json +1 -1
  83. package/assets/esri/widgets/support/GridControls/t9n/GridControls.json +1 -0
  84. package/assets/esri/widgets/support/GridControls/t9n/GridControls_en.json +1 -0
  85. package/chunks/CloudsComposition.glsl.js +3 -3
  86. package/chunks/ComponentShader.glsl.js +53 -61
  87. package/chunks/DefaultMaterial.glsl.js +1 -1
  88. package/chunks/FocusAreaColor.glsl.js +12 -0
  89. package/chunks/FocusAreaMask.glsl.js +5 -0
  90. package/chunks/Laserlines.glsl.js +1 -1
  91. package/chunks/Path.glsl.js +22 -17
  92. package/chunks/PointRenderer.glsl.js +3 -3
  93. package/chunks/Precipitation.glsl.js +1 -1
  94. package/chunks/Terrain.glsl.js +1 -1
  95. package/chunks/WaterSurface.glsl.js +18 -18
  96. package/chunks/boundedPlane.js +1 -1
  97. package/chunks/cameraUtilsPlanar.js +1 -1
  98. package/chunks/cameraUtilsSpherical.js +1 -1
  99. package/chunks/sphere.js +1 -1
  100. package/chunks/terrainUtilsPlanar.js +1 -1
  101. package/chunks/vec32.js +1 -1
  102. package/chunks/vxlLayer.js +1 -1
  103. package/core/libs/gl-matrix-2/math/quat.js +1 -1
  104. package/core/libs/gl-matrix-2/math/vec3.js +1 -1
  105. package/core/mathUtils.js +1 -1
  106. package/core/perspectiveUtils.js +1 -1
  107. package/exports/csv.js +1 -1
  108. package/geometry/operators/support/converterAPI.js +1 -1
  109. package/geometry/projection/localLinearScaleFactors.js +1 -1
  110. package/geometry/support/buffer/internals/Vec3.js +1 -1
  111. package/geometry/support/clipRay.js +1 -1
  112. package/geometry/support/coordinateSystem.js +1 -1
  113. package/geometry/support/frustum.js +1 -1
  114. package/geometry/support/heightModelInfoUtils.js +1 -1
  115. package/geometry/support/lineSegment.js +1 -1
  116. package/geometry/support/meshUtils/exporters/gltf/geometry.js +1 -1
  117. package/geometry/support/meshUtils/rotate.js +1 -1
  118. package/geometry/support/meshUtils/scale.js +1 -1
  119. package/geometry/support/plane.js +1 -1
  120. package/geometry/support/polygonUtils.js +1 -1
  121. package/geometry/support/ray.js +1 -1
  122. package/geometry/support/sphere.js +1 -1
  123. package/geometry/support/sphereUtils.js +5 -0
  124. package/geometry/support/triangle.js +1 -1
  125. package/geometry/support/vector.js +1 -1
  126. package/interfaces.d.ts +68 -9
  127. package/layers/FocusAreaLayer.js +5 -0
  128. package/layers/VoxelLayer.js +1 -1
  129. package/layers/VoxelWasmPerSceneView.js +1 -1
  130. package/layers/mixins/operationalLayerModuleMap.js +1 -1
  131. package/layers/orientedImagery/transformations/imageToGroundUtils.js +1 -1
  132. package/layers/video/VideoCameraSensorModel.js +1 -1
  133. package/package.json +1 -1
  134. package/support/revision.js +1 -1
  135. package/symbols/cim/CIMSymbolDrawHelper.js +1 -1
  136. package/symbols/support/Symbol3DFillMaterial.js +1 -1
  137. package/symbols/support/Symbol3DMaterial.js +1 -1
  138. package/views/2d/engine/webgl/AFeatureTile.js +1 -1
  139. package/views/2d/engine/webgl/WorldExtentClipRenderer.js +1 -1
  140. package/views/2d/grid/GridView2D.js +1 -1
  141. package/views/2d/grid/constants.js +5 -0
  142. package/views/2d/interactive/editingTools/TransformTool.js +1 -1
  143. package/views/2d/interactive/editingTools/manipulations/ScaleManipulation.js +1 -1
  144. package/views/2d/layerViewModuleImportUtils.js +1 -1
  145. package/views/2d/support/highlightGroupUtils.js +1 -1
  146. package/views/3d/analysis/AreaMeasurement/support/MeasurementData.js +1 -1
  147. package/views/3d/analysis/Dimension/lengthDimensionConstraintUtils.js +1 -1
  148. package/views/3d/analysis/Dimension/lengthDimensionManipulatorUtils.js +1 -1
  149. package/views/3d/analysis/Dimension/lengthDimensionUtils.js +1 -1
  150. package/views/3d/analysis/LineOfSight/LineOfSightRayIntersector.js +1 -1
  151. package/views/3d/analysis/Slice/ShiftManipulator.js +1 -1
  152. package/views/3d/analysis/Slice/SliceTool.js +1 -1
  153. package/views/3d/analysis/Slice/SliceVisualization.js +1 -1
  154. package/views/3d/analysis/Slice/sliceToolUtils.js +1 -1
  155. package/views/3d/analysis/Viewshed/FieldOfViewManipulation.js +1 -1
  156. package/views/3d/analysis/Viewshed/ScaleOrientManipulation.js +1 -1
  157. package/views/3d/analysis/Viewshed/ViewshedSubTool.js +1 -1
  158. package/views/3d/analysis/Viewshed/ViewshedTool.js +1 -1
  159. package/views/3d/analysis/Viewshed/ViewshedVisualization.js +1 -1
  160. package/views/3d/analysis/Viewshed/viewshedToolUtils.js +1 -1
  161. package/views/3d/analysis/support/measurementUtils.js +1 -1
  162. package/views/3d/animation/pointToPoint/Animation.js +1 -1
  163. package/views/3d/animation/pointToPoint/Camera.js +1 -1
  164. package/views/3d/camera/constraintUtils/common.js +1 -1
  165. package/views/3d/camera/constraintUtils/surfaceCollision.js +1 -1
  166. package/views/3d/camera/constraintUtils/tilt.js +1 -1
  167. package/views/3d/camera/intersectionUtils.js +1 -1
  168. package/views/3d/environment/ChapmanAtmosphere.js +1 -1
  169. package/views/3d/environment/CloudsComposition.glsl.js +1 -1
  170. package/views/3d/environment/CloudsParameters.js +1 -1
  171. package/views/3d/environment/EnvironmentRenderer.js +1 -1
  172. package/views/3d/environment/Fog.js +1 -1
  173. package/views/3d/environment/MarsAtmosphere.js +1 -1
  174. package/views/3d/interactive/Manipulator3D.js +1 -1
  175. package/views/3d/interactive/editingTools/dragEventPipeline3D.js +1 -1
  176. package/views/3d/interactive/editingTools/draw/DrawGraphicTool3D.js +1 -1
  177. package/views/3d/interactive/editingTools/lineObjectVisualElementUtils.js +1 -1
  178. package/views/3d/interactive/editingTools/manipulations/MoveXYAxisManipulation.js +1 -1
  179. package/views/3d/interactive/editingTools/manipulations/MoveXYDiscManipulation.js +1 -1
  180. package/views/3d/interactive/editingTools/manipulations/MoveZManipulation.js +1 -1
  181. package/views/3d/interactive/editingTools/originGeometryVisualElementUtils.js +1 -1
  182. package/views/3d/interactive/editingTools/reshape/ReshapeOperation.js +1 -1
  183. package/views/3d/interactive/editingTools/transform/ScaleRotateTransform.js +1 -1
  184. package/views/3d/interactive/editingTools/transform/extentTransform/ExtentScale.js +1 -1
  185. package/views/3d/interactive/editingTools/transform/extentTransform/extentUtils.js +1 -1
  186. package/views/3d/interactive/visualElements/LineVisualElement.js +1 -1
  187. package/views/3d/interactive/visualElements/OutlineVisualElement.js +1 -1
  188. package/views/3d/interactive/visualElements/PointVisualElement.js +1 -1
  189. package/views/3d/interactive/visualElements/VerticesVisualElement.js +1 -1
  190. package/views/3d/layerViewModuleImportUtils.js +1 -1
  191. package/views/3d/layers/FocusAreaLayerView3D.js +5 -0
  192. package/views/3d/layers/I3SMeshView3D.js +1 -1
  193. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  194. package/views/3d/layers/IntegratedMeshLayerView3D.js +1 -1
  195. package/views/3d/layers/PointCloudLayerView3D.js +1 -1
  196. package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
  197. package/views/3d/layers/VoxelGraphic.js +5 -0
  198. package/views/3d/layers/VoxelLayerView3D.js +1 -1
  199. package/views/3d/layers/graphics/Deconflictor.js +1 -1
  200. package/views/3d/layers/graphics/ElevationAligners.js +1 -1
  201. package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
  202. package/views/3d/layers/graphics/Graphics3DDrapedGraphicLayer.js +1 -1
  203. package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
  204. package/views/3d/layers/graphics/Graphics3DLodInstanceGraphicLayer.js +1 -1
  205. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  206. package/views/3d/layers/graphics/Graphics3DObjectSymbolLayer.js +1 -1
  207. package/views/3d/layers/graphics/Graphics3DPathSymbolLayer.js +1 -1
  208. package/views/3d/layers/graphics/elevationAlignmentUtils.js +1 -1
  209. package/views/3d/layers/graphics/labelPlacement.js +1 -1
  210. package/views/3d/layers/graphics/objectResourceUtils.js +1 -1
  211. package/views/3d/layers/i3s/I3SMeshViewFilter.js +1 -1
  212. package/views/3d/layers/i3s/I3SUtil.js +1 -1
  213. package/views/3d/layers/i3s/I3SViewportQueries.js +1 -1
  214. package/views/3d/layers/i3s/LayerElevationProvider.js +1 -1
  215. package/views/3d/layers/i3s/LoDUtil.js +1 -1
  216. package/views/3d/layers/i3s/PointRenderer.js +1 -1
  217. package/views/3d/layers/support/FastSymbolUpdates.js +1 -1
  218. package/views/3d/layers/support/FeatureTileMeasurements3D.js +1 -1
  219. package/views/3d/layers/support/FeatureTileVisibility3D.js +1 -1
  220. package/views/3d/layers/support/uvUtils.js +1 -1
  221. package/views/3d/state/NearFarHeuristic.js +1 -1
  222. package/views/3d/state/ViewStateManager.js +1 -1
  223. package/views/3d/state/controllers/GamepadKeyboardController.js +1 -1
  224. package/views/3d/state/controllers/PinchAndPanControllerGlobal.js +1 -1
  225. package/views/3d/state/controllers/PinchAndPanControllerLocal.js +1 -1
  226. package/views/3d/state/controllers/RotateController.js +1 -1
  227. package/views/3d/state/controllers/ZoomControllerGlobal.js +1 -1
  228. package/views/3d/state/controllers/ZoomControllerLocal.js +1 -1
  229. package/views/3d/state/controllers/ZoomStepControllerGlobal.js +1 -1
  230. package/views/3d/state/controllers/ZoomStepControllerLocal.js +1 -1
  231. package/views/3d/state/helpers/SceneIntersectionHelper.js +1 -1
  232. package/views/3d/state/utils/navigationUtils.js +1 -1
  233. package/views/3d/state/utils/viewUtils.js +1 -1
  234. package/views/3d/support/FrustumExtentIntersection.js +1 -1
  235. package/views/3d/support/cameraUtilsInternal.js +1 -1
  236. package/views/3d/support/geometryUtils/ray.js +1 -1
  237. package/views/3d/support/intersectionUtils.js +1 -1
  238. package/views/3d/support/mathUtils.js +1 -1
  239. package/views/3d/support/orientedBoundingBox.js +1 -1
  240. package/views/3d/support/pointsOfInterest/Focus.js +1 -1
  241. package/views/3d/support/sunUtils.js +1 -1
  242. package/views/3d/support/viewpointUtils.js +1 -1
  243. package/views/3d/terrain/OverlayRenderer.js +1 -1
  244. package/views/3d/terrain/PatchRenderData.js +1 -1
  245. package/views/3d/terrain/SphericalPatch.js +1 -1
  246. package/views/3d/terrain/TerrainRenderer.js +1 -1
  247. package/views/3d/terrain/TerrainSurface.js +1 -1
  248. package/views/3d/terrain/Tile.js +1 -1
  249. package/views/3d/terrain/isTerrainSurfaceLayer.js +1 -1
  250. package/views/3d/webgl/RenderCamera.js +1 -1
  251. package/views/3d/webgl-engine/collections/Component/ComponentObjectCollection.js +1 -1
  252. package/views/3d/webgl-engine/collections/Component/DepthRange.js +1 -1
  253. package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
  254. package/views/3d/webgl-engine/collections/Component/Material/ComponentTechnique.js +1 -1
  255. package/views/3d/webgl-engine/collections/Component/Material/ComponentTechniqueConfiguration.js +1 -1
  256. package/views/3d/webgl-engine/collections/Component/Material/shader/ComponentShader.glsl.js +1 -1
  257. package/views/3d/webgl-engine/core/renderPasses/RenderPassManager.js +1 -1
  258. package/views/3d/webgl-engine/core/shaderLibrary/ShaderOutput.js +1 -1
  259. package/views/3d/webgl-engine/core/shaderLibrary/Slice.glsl.js +1 -1
  260. package/views/3d/webgl-engine/core/shaderLibrary/attributes/InstancedDoublePrecision.glsl.js +1 -1
  261. package/views/3d/webgl-engine/core/shaderLibrary/attributes/NormalAttribute.glsl.js +1 -1
  262. package/views/3d/webgl-engine/core/shaderLibrary/attributes/VertexNormal.glsl.js +2 -6
  263. package/views/3d/webgl-engine/core/shaderLibrary/output/Emissions.glsl.js +2 -2
  264. package/views/3d/webgl-engine/core/shaderLibrary/shading/ComputeFragmentNormals.glsl.js +13 -0
  265. package/views/3d/webgl-engine/core/shaderLibrary/shading/EvaluateAmbientLighting.glsl.js +1 -1
  266. package/views/3d/webgl-engine/core/shaderLibrary/shading/EvaluateSceneLighting.glsl.js +11 -13
  267. package/views/3d/webgl-engine/core/shaderLibrary/shading/MainLighting.glsl.js +4 -4
  268. package/views/3d/webgl-engine/core/shaderLibrary/shading/PhysicallyBasedRendering.glsl.js +1 -4
  269. package/views/3d/webgl-engine/core/shaderLibrary/shading/ReadBaseColorTexture.glsl.js +3 -3
  270. package/views/3d/webgl-engine/core/shaderLibrary/shading/ReadShadowMap.glsl.js +1 -1
  271. package/views/3d/webgl-engine/core/shaderLibrary/shading/Water.glsl.js +2 -2
  272. package/views/3d/webgl-engine/core/shaderLibrary/util/ScreenSizePerspective.glsl.js +1 -1
  273. package/views/3d/webgl-engine/core/shaderLibrary/util/View.glsl.js +1 -1
  274. package/views/3d/webgl-engine/effects/focusArea/FocusAreaColorRenderNodeTechnique.js +5 -0
  275. package/views/3d/webgl-engine/effects/focusArea/FocusAreaMaskRenderNodeTechnique.js +5 -0
  276. package/views/3d/webgl-engine/effects/focusArea/FocusAreaParameters.js +5 -0
  277. package/views/3d/webgl-engine/effects/focusArea/FocusAreaRenderNode.js +5 -0
  278. package/views/3d/webgl-engine/effects/highlight/ShadowHighlight.js +1 -1
  279. package/views/3d/webgl-engine/effects/laserlines/LaserlinePathData.js +1 -1
  280. package/views/3d/webgl-engine/lib/BoundingInfo.js +1 -1
  281. package/views/3d/webgl-engine/lib/GeometryUtil.js +1 -1
  282. package/views/3d/webgl-engine/lib/Intersector.js +1 -1
  283. package/views/3d/webgl-engine/lib/Object3D.js +1 -1
  284. package/views/3d/webgl-engine/lib/Octree.js +1 -1
  285. package/views/3d/webgl-engine/lib/OrderIndependentTransparency.js +1 -1
  286. package/views/3d/webgl-engine/lib/Path.js +1 -1
  287. package/views/3d/webgl-engine/lib/PathGeometryData.js +1 -1
  288. package/views/3d/webgl-engine/lib/PathVertex.js +1 -1
  289. package/views/3d/webgl-engine/lib/RayIntersections.js +1 -1
  290. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  291. package/views/3d/webgl-engine/lib/ShadowMap.js +1 -1
  292. package/views/3d/webgl-engine/lib/edgeRendering/EdgeRenderer.js +1 -1
  293. package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
  294. package/views/3d/webgl-engine/lib/edgeRendering/edgePreprocessing.js +1 -1
  295. package/views/3d/webgl-engine/lib/geometryDataUtils.js +1 -1
  296. package/views/3d/webgl-engine/lib/lodRendering/InstanceData.js +1 -1
  297. package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
  298. package/views/3d/webgl-engine/lib/pathGeometryUtils.js +1 -1
  299. package/views/3d/webgl-engine/lib/triangleIntersectionUtils.js +1 -1
  300. package/views/3d/webgl-engine/lib/verticalOffsetUtils.js +1 -1
  301. package/views/3d/webgl-engine/lighting/SphericalHarmonics.js +1 -1
  302. package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
  303. package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
  304. package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
  305. package/views/3d/webgl-engine/materials/MeasurementArrowMaterial.js +1 -1
  306. package/views/3d/webgl-engine/materials/NativeLineMaterial.js +1 -1
  307. package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
  308. package/views/3d/webgl-engine/materials/PathTechnique.js +1 -1
  309. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  310. package/views/3d/webgl-engine/materials/ShadedColorMaterial.js +1 -1
  311. package/views/3d/webgl-engine/shaders/DefaultMaterialTechnique.js +1 -1
  312. package/views/3d/webgl-engine/shaders/FocusAreaColor.glsl.js +5 -0
  313. package/views/3d/webgl-engine/shaders/FocusAreaMask.glsl.js +5 -0
  314. package/views/3d/webgl-engine/shaders/OutputColorHighlightOID.glsl.js +8 -8
  315. package/views/3d/webgl-engine/shaders/Path.glsl.js +1 -1
  316. package/views/draw/support/helpMessageUtils3d.js +1 -1
  317. package/views/draw/support/surfaceCoordinateSystems.js +1 -1
  318. package/views/input/gamepad/GamepadSource.js +1 -1
  319. package/views/interactive/coordinateHelper.js +1 -1
  320. package/views/interactive/editGeometry/operations/OffsetEdgeVertex.js +1 -1
  321. package/views/interactive/sketch/constraints.js +1 -1
  322. package/views/interactive/snapping/FeatureSnappingEngine.js +1 -1
  323. package/views/interactive/snapping/GridSnappingEngine.js +5 -0
  324. package/views/interactive/snapping/RightAngleSnapper.js +1 -1
  325. package/views/interactive/snapping/SnappingOptions.js +1 -1
  326. package/views/interactive/snapping/featureSources/featureServiceSource/tileUtils.js +1 -1
  327. package/views/interactive/snapping/snappingUtils.js +1 -1
  328. package/views/navigation/PanPlanarMomentumEstimator.js +1 -1
  329. package/views/support/angularMeasurementUtils.js +1 -1
  330. package/views/support/euclideanAreaMeasurementUtils.js +1 -1
  331. package/views/support/euclideanLengthMeasurementUtils.js +1 -1
  332. package/views/support/geometry3dUtils.js +1 -1
  333. package/webscene/Slide.js +1 -1
  334. package/widgets/CoordinateConversion/support/formatUtils.js +1 -1
  335. package/widgets/ElevationProfile/ElevationProfileLineView.js +1 -1
  336. package/widgets/Feature/FeatureMedia.js +1 -1
  337. package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
  338. package/widgets/FeatureTable/Grid/Column.js +1 -1
  339. package/widgets/FeatureTable.js +1 -1
  340. package/widgets/GridControls/GridControlsViewModel.d.ts +4 -0
  341. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  342. package/widgets/PanoramicViewer/PanoramicViewerViewModel.js +1 -1
  343. package/widgets/Print/CustomTemplate.js +1 -1
  344. package/widgets/Print/PrintViewModel.js +1 -1
  345. package/widgets/Print/TemplateOptions.js +1 -1
  346. package/widgets/Print/utils.js +5 -0
  347. package/widgets/Print.js +1 -1
  348. package/widgets/ShadowCast/ShadowCastViewModel.js +1 -1
  349. package/widgets/support/GridControls/GridControlsViewModel.d.ts +4 -0
  350. package/widgets/support/GridControls/GridControlsViewModel.js +5 -0
  351. package/widgets/support/GridControls/VisibleElements.js +5 -0
  352. package/widgets/support/GridControls/gridUtils.js +5 -0
  353. package/widgets/support/GridControls.d.ts +4 -0
  354. package/widgets/support/GridControls.js +5 -0
  355. package/widgets/support/exportUtils.js +1 -1
  356. package/assets/esri/core/workers/chunks/14dc47896456e3c66b24.js +0 -1
  357. package/assets/esri/core/workers/chunks/2e88af8ab1e2713e7655.js +0 -1
  358. package/assets/esri/core/workers/chunks/3b204e75b613bcfbc8b9.js +0 -1
  359. package/assets/esri/core/workers/chunks/3e57f493d5a9d7aa7a48.js +0 -1
  360. package/assets/esri/core/workers/chunks/4e5ae81c612543130d9a.js +0 -1
  361. package/assets/esri/core/workers/chunks/4e746f8fca1d932dd684.js +0 -1
  362. package/assets/esri/core/workers/chunks/544eec13338b2d71680f.js +0 -1
  363. package/assets/esri/core/workers/chunks/5e7e12863cbed07451d0.js +0 -1
  364. package/assets/esri/core/workers/chunks/6c129767cda74aa672e0.js +0 -1
  365. package/assets/esri/core/workers/chunks/6f7c2d02fbd29870f6ee.js +0 -1
  366. package/assets/esri/core/workers/chunks/7802e70422f4151b95bc.js +0 -1
  367. package/assets/esri/core/workers/chunks/920557db2bd107a3c579.js +0 -1
  368. package/assets/esri/core/workers/chunks/9443b9ec03f25c723c2c.js +0 -47
  369. package/assets/esri/core/workers/chunks/991295637f51e8207efe.js +0 -1
  370. package/assets/esri/core/workers/chunks/ace8b6351ed35b03499b.js +0 -1
  371. package/assets/esri/core/workers/chunks/b1e4896acfae0bf9a9a8.js +0 -1
  372. package/assets/esri/core/workers/chunks/ca12b1c470e67ca7b30e.js +0 -1
  373. package/assets/esri/core/workers/chunks/cd9f48dcee2a1fc261ed.js +0 -774
  374. package/assets/esri/core/workers/chunks/d3626c01d2569d84e01e.js +0 -1
  375. package/assets/esri/core/workers/chunks/e5474bcde5b8fa037b56.js +0 -278
  376. package/views/3d/webgl-engine/core/shaderLibrary/shading/ComputeShadingNormal.glsl.js +0 -31
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.31/esri/copyright.txt for details.
4
4
  */
5
- import{s as e,f as t}from"../../../../../chunks/vec32.js";import{create as r}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{newDoubleArray as s}from"../../../../../geometry/support/DoubleArray.js";import{glLayout as i}from"../../../support/buffer/glUtil.js";import{newLayout as o}from"../../../support/buffer/InterleavedLayout.js";import{attributeLocations as u}from"./LaserlinePathTechnique.js";import{VertexArrayObject as f}from"../../lib/VertexArrayObject.js";import{VertexAttribute as n}from"../../lib/VertexAttribute.js";import{BufferObject as a}from"../../../../webgl/BufferObject.js";import{PrimitiveType as l,Usage as c}from"../../../../webgl/enums.js";class h{constructor(e){this._renderCoordsHelper=e,this._buffers=null,this._origin=r(),this._dirty=!1,this._count=0,this._vao=null}set vertices(e){const t=s(3*e.length);let r=0;for(const s of e)t[r++]=s[0],t[r++]=s[1],t[r++]=s[2];this.buffers=[t]}set buffers(t){if(this._buffers=t,this._buffers.length>0){const t=this._buffers[0],r=3*Math.floor(t.length/3/2);e(this._origin,t[r],t[r+1],t[r+2])}else e(this._origin,0,0,0);this._dirty=!0}get origin(){return this._origin}draw(e){const t=this._ensureVAO(e);null!=t&&(e.bindVAO(t),e.drawArrays(l.TRIANGLES,0,this._count))}dispose(){null!=this._vao&&this._vao.dispose()}_ensureVAO(e){return null==this._buffers?null:(null==this._vao&&(this._vao=this._createVAO(e,this._buffers)),this._ensureVertexData(this._vao,this._buffers),this._vao)}_createVAO(e,t){const r=this._createDataBuffer(t);return this._dirty=!1,new f(e,u,new Map([["data",i(V)]]),new Map([["data",a.createVertex(e,c.STATIC_DRAW,r)]]))}_ensureVertexData(e,t){if(!this._dirty)return;const r=this._createDataBuffer(t);e.vertexBuffers.get("data")?.setData(r),this._dirty=!1}_createDataBuffer(r){const s=r.reduce(((e,t)=>e+_(t)),0);this._count=s;const i=V.createBuffer(s),o=this._origin;let u=0,f=0;for(const n of r){for(let r=0;r<n.length;r+=3){const s=e(p,n[r],n[r+1],n[r+2]);0===r?f=this._renderCoordsHelper.getAltitude(s):this._renderCoordsHelper.setAltitude(s,f);const a=this._renderCoordsHelper.worldUpAtPosition(s,d),l=u+2*r,c=t(p,s,o);if(r<n.length-3){i.up.setVec(l,a),i.up.setVec(l+3,a),i.up.setVec(l+5,a);for(let e=0;e<6;e++)i.start.setVec(l+e,c);i.extrude.setValues(l,0,-1),i.extrude.setValues(l+1,1,-1),i.extrude.setValues(l+2,1,1),i.extrude.setValues(l+3,0,-1),i.extrude.setValues(l+4,1,1),i.extrude.setValues(l+5,0,1)}if(r>0){i.up.setVec(l-2,a),i.up.setVec(l-4,a),i.up.setVec(l-5,a);for(let e=-6;e<0;e++)i.end.setVec(l+e,c)}}u+=_(n)}return i.buffer}}function _(e){return 3*(2*(e.length/3-1))}const d=r(),p=r(),V=o().vec3f(n.START).vec3f(n.END).vec3f(n.UP).vec2f(n.EXTRUDE);export{h as LaserlinePathData};
5
+ import{a as e,f as t}from"../../../../../chunks/vec32.js";import{create as r}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{newDoubleArray as s}from"../../../../../geometry/support/DoubleArray.js";import{glLayout as i}from"../../../support/buffer/glUtil.js";import{newLayout as o}from"../../../support/buffer/InterleavedLayout.js";import{attributeLocations as u}from"./LaserlinePathTechnique.js";import{VertexArrayObject as f}from"../../lib/VertexArrayObject.js";import{VertexAttribute as n}from"../../lib/VertexAttribute.js";import{BufferObject as a}from"../../../../webgl/BufferObject.js";import{PrimitiveType as l,Usage as c}from"../../../../webgl/enums.js";class h{constructor(e){this._renderCoordsHelper=e,this._buffers=null,this._origin=r(),this._dirty=!1,this._count=0,this._vao=null}set vertices(e){const t=s(3*e.length);let r=0;for(const s of e)t[r++]=s[0],t[r++]=s[1],t[r++]=s[2];this.buffers=[t]}set buffers(t){if(this._buffers=t,this._buffers.length>0){const t=this._buffers[0],r=3*Math.floor(t.length/3/2);e(this._origin,t[r],t[r+1],t[r+2])}else e(this._origin,0,0,0);this._dirty=!0}get origin(){return this._origin}draw(e){const t=this._ensureVAO(e);null!=t&&(e.bindVAO(t),e.drawArrays(l.TRIANGLES,0,this._count))}dispose(){null!=this._vao&&this._vao.dispose()}_ensureVAO(e){return null==this._buffers?null:(null==this._vao&&(this._vao=this._createVAO(e,this._buffers)),this._ensureVertexData(this._vao,this._buffers),this._vao)}_createVAO(e,t){const r=this._createDataBuffer(t);return this._dirty=!1,new f(e,u,new Map([["data",i(V)]]),new Map([["data",a.createVertex(e,c.STATIC_DRAW,r)]]))}_ensureVertexData(e,t){if(!this._dirty)return;const r=this._createDataBuffer(t);e.vertexBuffers.get("data")?.setData(r),this._dirty=!1}_createDataBuffer(r){const s=r.reduce(((e,t)=>e+_(t)),0);this._count=s;const i=V.createBuffer(s),o=this._origin;let u=0,f=0;for(const n of r){for(let r=0;r<n.length;r+=3){const s=e(p,n[r],n[r+1],n[r+2]);0===r?f=this._renderCoordsHelper.getAltitude(s):this._renderCoordsHelper.setAltitude(s,f);const a=this._renderCoordsHelper.worldUpAtPosition(s,d),l=u+2*r,c=t(p,s,o);if(r<n.length-3){i.up.setVec(l,a),i.up.setVec(l+3,a),i.up.setVec(l+5,a);for(let e=0;e<6;e++)i.start.setVec(l+e,c);i.extrude.setValues(l,0,-1),i.extrude.setValues(l+1,1,-1),i.extrude.setValues(l+2,1,1),i.extrude.setValues(l+3,0,-1),i.extrude.setValues(l+4,1,1),i.extrude.setValues(l+5,0,1)}if(r>0){i.up.setVec(l-2,a),i.up.setVec(l-4,a),i.up.setVec(l-5,a);for(let e=-6;e<0;e++)i.end.setVec(l+e,c)}}u+=_(n)}return i.buffer}}function _(e){return 3*(2*(e.length/3-1))}const d=r(),p=r(),V=o().vec3f(n.START).vec3f(n.END).vec3f(n.UP).vec2f(n.EXTRUDE);export{h as LaserlinePathData};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.31/esri/copyright.txt for details.
4
4
  */
5
- import i from"../../../../core/PooledArray.js";import{o as t,a as e}from"../../../../chunks/vec32.js";import{fromValues as s,clone as r,create as n}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{assert as h}from"./Util.js";class o{constructor(i,e,o){this.primitiveIndices=i,this._numIndexPerPrimitive=e,this.position=o,this._children=void 0,h(i.length>=1),h(3===o.size||4===o.size);const{data:c,size:l,indices:m}=o;h(m.length%this._numIndexPerPrimitive==0),h(m.length>=i.length*this._numIndexPerPrimitive);const d=i.length;let u=l*m[this._numIndexPerPrimitive*i[0]];a.clear(),a.push(u);const f=s(c[u],c[u+1],c[u+2]),x=r(f);for(let t=0;t<d;++t){const e=this._numIndexPerPrimitive*i[t];for(let i=0;i<this._numIndexPerPrimitive;++i){u=l*m[e+i],a.push(u);let t=c[u];f[0]=Math.min(t,f[0]),x[0]=Math.max(t,x[0]),t=c[u+1],f[1]=Math.min(t,f[1]),x[1]=Math.max(t,x[1]),t=c[u+2],f[2]=Math.min(t,f[2]),x[2]=Math.max(t,x[2])}}this.bbMin=f,this.bbMax=x;const P=t(n(),this.bbMin,this.bbMax,.5);this.radius=.5*Math.max(Math.max(x[0]-f[0],x[1]-f[1]),x[2]-f[2]);let v=this.radius*this.radius;for(let t=0;t<a.length;++t){u=a.at(t);const i=c[u]-P[0],e=c[u+1]-P[1],s=c[u+2]-P[2],r=i*i+e*e+s*s;if(r<=v)continue;const n=Math.sqrt(r),h=.5*(n-this.radius);this.radius=this.radius+h,v=this.radius*this.radius;const o=h/n;P[0]+=i*o,P[1]+=e*o,P[2]+=s*o}this.center=P,a.clear()}getChildren(){if(this._children||e(this.bbMin,this.bbMax)<=1)return this._children;const i=t(n(),this.bbMin,this.bbMax,.5),s=this.primitiveIndices.length,r=new Uint8Array(s),h=new Array(8);for(let t=0;t<8;++t)h[t]=0;const{data:a,size:c,indices:l}=this.position;for(let t=0;t<s;++t){let e=0;const s=this._numIndexPerPrimitive*this.primitiveIndices[t];let n=c*l[s],o=a[n],m=a[n+1],d=a[n+2];for(let i=1;i<this._numIndexPerPrimitive;++i){n=c*l[s+i];const t=a[n],e=a[n+1],r=a[n+2];t<o&&(o=t),e<m&&(m=e),r<d&&(d=r)}o<i[0]&&(e|=1),m<i[1]&&(e|=2),d<i[2]&&(e|=4),r[t]=e,++h[e]}let m=0;for(let t=0;t<8;++t)h[t]>0&&++m;if(m<2)return;const d=new Array(8);for(let t=0;t<8;++t)d[t]=h[t]>0?new Uint32Array(h[t]):void 0;for(let t=0;t<8;++t)h[t]=0;for(let t=0;t<s;++t){const i=r[t];d[i][h[i]++]=this.primitiveIndices[t]}this._children=new Array;for(let t=0;t<8;++t)void 0!==d[t]&&this._children.push(new o(d[t],this._numIndexPerPrimitive,this.position));return this._children}static prune(){a.prune()}}const a=new i({deallocator:null});export{o as BoundingInfo};
5
+ import i from"../../../../core/PooledArray.js";import{o as t,s as e}from"../../../../chunks/vec32.js";import{fromValues as s,clone as r,create as n}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{assert as h}from"./Util.js";class o{constructor(i,e,o){this.primitiveIndices=i,this._numIndexPerPrimitive=e,this.position=o,this._children=void 0,h(i.length>=1),h(3===o.size||4===o.size);const{data:c,size:l,indices:m}=o;h(m.length%this._numIndexPerPrimitive==0),h(m.length>=i.length*this._numIndexPerPrimitive);const d=i.length;let u=l*m[this._numIndexPerPrimitive*i[0]];a.clear(),a.push(u);const f=s(c[u],c[u+1],c[u+2]),x=r(f);for(let t=0;t<d;++t){const e=this._numIndexPerPrimitive*i[t];for(let i=0;i<this._numIndexPerPrimitive;++i){u=l*m[e+i],a.push(u);let t=c[u];f[0]=Math.min(t,f[0]),x[0]=Math.max(t,x[0]),t=c[u+1],f[1]=Math.min(t,f[1]),x[1]=Math.max(t,x[1]),t=c[u+2],f[2]=Math.min(t,f[2]),x[2]=Math.max(t,x[2])}}this.bbMin=f,this.bbMax=x;const P=t(n(),this.bbMin,this.bbMax,.5);this.radius=.5*Math.max(Math.max(x[0]-f[0],x[1]-f[1]),x[2]-f[2]);let v=this.radius*this.radius;for(let t=0;t<a.length;++t){u=a.at(t);const i=c[u]-P[0],e=c[u+1]-P[1],s=c[u+2]-P[2],r=i*i+e*e+s*s;if(r<=v)continue;const n=Math.sqrt(r),h=.5*(n-this.radius);this.radius=this.radius+h,v=this.radius*this.radius;const o=h/n;P[0]+=i*o,P[1]+=e*o,P[2]+=s*o}this.center=P,a.clear()}getChildren(){if(this._children||e(this.bbMin,this.bbMax)<=1)return this._children;const i=t(n(),this.bbMin,this.bbMax,.5),s=this.primitiveIndices.length,r=new Uint8Array(s),h=new Array(8);for(let t=0;t<8;++t)h[t]=0;const{data:a,size:c,indices:l}=this.position;for(let t=0;t<s;++t){let e=0;const s=this._numIndexPerPrimitive*this.primitiveIndices[t];let n=c*l[s],o=a[n],m=a[n+1],d=a[n+2];for(let i=1;i<this._numIndexPerPrimitive;++i){n=c*l[s+i];const t=a[n],e=a[n+1],r=a[n+2];t<o&&(o=t),e<m&&(m=e),r<d&&(d=r)}o<i[0]&&(e|=1),m<i[1]&&(e|=2),d<i[2]&&(e|=4),r[t]=e,++h[e]}let m=0;for(let t=0;t<8;++t)h[t]>0&&++m;if(m<2)return;const d=new Array(8);for(let t=0;t<8;++t)d[t]=h[t]>0?new Uint32Array(h[t]):void 0;for(let t=0;t<8;++t)h[t]=0;for(let t=0;t<s;++t){const i=r[t];d[i][h[i]++]=this.primitiveIndices[t]}this._children=new Array;for(let t=0;t<8;++t)void 0!==d[t]&&this._children.push(new o(d[t],this._numIndexPerPrimitive,this.position));return this._children}static prune(){a.prune()}}const a=new i({deallocator:null});export{o as BoundingInfo};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.31/esri/copyright.txt for details.
4
4
  */
5
- import{f as t,b as n,n as e,j as s,g as o,m as r,s as l,c as h,h as u}from"../../../../chunks/vec32.js";import{fromValues as c,create as a,clone as f}from"../../../../core/libs/gl-matrix-2/factories/vec3f32.js";import{clone as p,create as i,fromValues as w}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{newDoubleArray as g}from"../../../../geometry/support/DoubleArray.js";import{newFloatArray as O,floatArrayFrom as m}from"../../../../geometry/support/FloatArray.js";import{getZeroIndexArray as M,getContinuousIndexArray as A}from"../../../../geometry/support/Indices.js";import{create as I,fromPositionAndNormal as y,intersectRay as N}from"../../../../geometry/support/plane.js";import{wrap as P}from"../../../../geometry/support/ray.js";import{Attribute as T}from"./Attribute.js";import{Vec3Compact as S}from"./BufferVectorMath.js";import{ContentObjectType as R}from"./ContentObjectType.js";import{Geometry as b}from"./Geometry.js";import{assert as L}from"./Util.js";import{VertexAttribute as j}from"./VertexAttribute.js";const d=S,E=[[-.5,-.5,.5],[.5,-.5,.5],[.5,.5,.5],[-.5,.5,.5],[-.5,-.5,-.5],[.5,-.5,-.5],[.5,.5,-.5],[-.5,.5,-.5]],U=[0,0,1,-1,0,0,1,0,0,0,-1,0,0,1,0,0,0,-1],V=[0,0,1,0,1,1,0,1],x=[0,1,2,2,3,0,4,0,3,3,7,4,1,5,6,6,2,1,1,0,4,4,5,1,3,2,6,6,7,3,5,4,7,7,6,5],F=new Array(36);for(let yt=0;yt<6;yt++)for(let t=0;t<6;t++)F[6*yt+t]=yt;const v=new Array(36);for(let yt=0;yt<6;yt++)v[6*yt]=0,v[6*yt+1]=1,v[6*yt+2]=2,v[6*yt+3]=2,v[6*yt+4]=3,v[6*yt+5]=0;function C(t,n){Array.isArray(n)||(n=[n,n,n]);const e=new Array(24);for(let s=0;s<8;s++)e[3*s]=E[s][0]*n[0],e[3*s+1]=E[s][1]*n[1],e[3*s+2]=E[s][2]*n[2];return new b(t,[[j.POSITION,new T(e,x,3,!0)],[j.NORMAL,new T(U,F,3)],[j.UV0,new T(V,v,2)]])}const G=[[-.5,0,-.5],[.5,0,-.5],[.5,0,.5],[-.5,0,.5],[0,-.5,0],[0,.5,0]],D=[0,1,-1,1,1,0,0,1,1,-1,1,0,0,-1,-1,1,-1,0,0,-1,1,-1,-1,0],q=[5,1,0,5,2,1,5,3,2,5,0,3,4,0,1,4,1,2,4,2,3,4,3,0],B=[0,0,0,1,1,1,2,2,2,3,3,3,4,4,4,5,5,5,6,6,6,7,7,7];function k(t,n){Array.isArray(n)||(n=[n,n,n]);const e=new Array(18);for(let s=0;s<6;s++)e[3*s]=G[s][0]*n[0],e[3*s+1]=G[s][1]*n[1],e[3*s+2]=G[s][2]*n[2];return new b(t,[[j.POSITION,new T(e,q,3,!0)],[j.NORMAL,new T(D,B,3)]])}const z=c(-.5,0,-.5),Z=c(.5,0,-.5),H=c(0,0,.5),J=c(0,.5,0),K=a(),Q=a(),W=a(),X=a(),Y=a();t(K,z,J),t(Q,z,Z),n(W,K,Q),e(W,W),t(K,Z,J),t(Q,Z,H),n(X,K,Q),e(X,X),t(K,H,J),t(Q,H,z),n(Y,K,Q),e(Y,Y);const $=[z,Z,H,J],_=[0,-1,0,W[0],W[1],W[2],X[0],X[1],X[2],Y[0],Y[1],Y[2]],tt=[0,1,2,3,1,0,3,2,1,3,0,2],nt=[0,0,0,1,1,1,2,2,2,3,3,3];function et(t,n){Array.isArray(n)||(n=[n,n,n]);const e=new Array(12);for(let s=0;s<4;s++)e[3*s]=$[s][0]*n[0],e[3*s+1]=$[s][1]*n[1],e[3*s+2]=$[s][2]*n[2];return new b(t,[[j.POSITION,new T(e,tt,3,!0)],[j.NORMAL,new T(_,nt,3)]])}function st(t,n,e,s,o={uv:!0}){const r=-Math.PI,l=2*Math.PI,h=-Math.PI/2,u=Math.PI,c=Math.max(3,Math.floor(e)),a=Math.max(2,Math.floor(s)),f=(c+1)*(a+1),p=O(3*f),i=O(3*f),w=O(2*f),g=[];let m=0;for(let O=0;O<=a;O++){const t=[],e=O/a,s=h+e*u,o=Math.cos(s);for(let h=0;h<=c;h++){const u=h/c,a=r+u*l,f=Math.cos(a)*o,g=Math.sin(s),O=-Math.sin(a)*o;p[3*m]=f*n,p[3*m+1]=g*n,p[3*m+2]=O*n,i[3*m]=f,i[3*m+1]=g,i[3*m+2]=O,w[2*m]=u,w[2*m+1]=e,t.push(m),++m}g.push(t)}const A=new Array;for(let O=0;O<a;O++)for(let t=0;t<c;t++){const n=g[O][t],e=g[O][t+1],s=g[O+1][t+1],o=g[O+1][t];0===O?(A.push(n),A.push(s),A.push(o)):O===a-1?(A.push(n),A.push(e),A.push(s)):(A.push(n),A.push(e),A.push(s),A.push(s),A.push(o),A.push(n))}const I=[[j.POSITION,new T(p,A,3,!0)],[j.NORMAL,new T(i,A,3,!0)]];return o.uv&&I.push([j.UV0,new T(w,A,2,!0)]),o.offset&&(I[0][0]=j.OFFSET,I.push([j.POSITION,new T(Float64Array.from(o.offset),M(A.length),3,!0)])),new b(t,I)}function ot(t,n,e,s){const o=rt(n,e,s);return new b(t,o)}function rt(t,n,e){const s=t;let o,r;if(e)o=[0,-1,0,1,0,0,0,0,1,-1,0,0,0,0,-1,0,1,0],r=[0,1,2,0,2,3,0,3,4,0,4,1,1,5,2,2,5,3,3,5,4,4,5,1];else{const t=s*(1+Math.sqrt(5))/2;o=[-s,t,0,s,t,0,-s,-t,0,s,-t,0,0,-s,t,0,s,t,0,-s,-t,0,s,-t,t,0,-s,t,0,s,-t,0,-s,-t,0,s],r=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1]}for(let c=0;c<o.length;c+=3)d.scale(o,c,t/d.length(o,c));let l={};function h(n,e){n>e&&([n,e]=[e,n]);const s=n.toString()+"."+e.toString();if(l[s])return l[s];let r=o.length;return o.length+=3,d.add(o,3*n,o,3*e,o,r),d.scale(o,r,t/d.length(o,r)),r/=3,l[s]=r,r}for(let c=0;c<n;c++){const t=r.length,n=new Array(4*t);for(let e=0;e<t;e+=3){const t=r[e],s=r[e+1],o=r[e+2],l=h(t,s),u=h(s,o),c=h(o,t),a=4*e;n[a]=t,n[a+1]=l,n[a+2]=c,n[a+3]=s,n[a+4]=u,n[a+5]=l,n[a+6]=o,n[a+7]=c,n[a+8]=u,n[a+9]=l,n[a+10]=u,n[a+11]=c}r=n,l={}}const u=m(o);for(let c=0;c<u.length;c+=3)d.normalize(u,c);return[[j.POSITION,new T(m(o),r,3,!0)],[j.NORMAL,new T(u,r,3,!0)]]}function lt(t,n,e,s,o,r,l,h,u,c=null){const a=e?p(e):i(),f=n?p(n):w(0,0,1),g=s?[255*s[0],255*s[1],255*s[2],s.length>3?255*s[3]:255]:[255,255,255,255],O=null!=r&&2===r.length?r:[1,1],m=null!=o?[o]:[0],A=M(1),I=[[j.POSITION,new T(a,A,3,!0)],[j.NORMAL,new T(f,A,3,!0)],[j.COLOR,new T(g,A,4,!0)],[j.SIZE,new T(O,A,2)],[j.ROTATION,new T(m,A,1,!0)]];if(h&&I.push([j.UV0,new T(h,A,h.length)]),null!=l&&(l=[l[0],l[1],l[2],l[3]],I.push([j.CENTEROFFSETANDDISTANCE,new T(l,A,4)])),u){const t=[u[0],u[1],u[2],u[3]];I.push([j.FEATUREATTRIBUTE,new T(t,A,4)])}return new b(t,I,null,R.Point,c)}const ht=[[-1,-1,0],[1,-1,0],[1,1,0],[-1,1,0]];function ut(t,n=ht){const e=new Array(12);for(let c=0;c<4;c++)for(let t=0;t<3;t++)e[3*c+t]=n[c][t];const s=[0,1,2,2,3,0],o=[0,0,1],r=[0,0,0,0,0,0],l=[0,0,1,0,1,1,0,1],h=[255,255,255,255],u=[[j.POSITION,new T(e,s,3,!0)],[j.NORMAL,new T(o,r,3,!0)],[j.UV0,new T(l,s,2,!0)],[j.COLOR,new T(h,r,4,!0)]];return new b(t,u)}function ct(t,n,e,s,o,r=!0,l=!0){let h=0;const u=e,a=n;let f=c(0,h,0),p=c(0,h+a,0),i=c(0,-1,0),w=c(0,1,0);o&&(h=a,p=c(0,0,0),f=c(0,h,0),i=c(0,1,0),w=c(0,-1,0));const g=[p,f],m=[i,w],M=s+2,A=Math.sqrt(a*a+u*u);if(o)for(let O=s-1;O>=0;O--){const t=O*(2*Math.PI/s),n=c(Math.cos(t)*u,h,Math.sin(t)*u);g.push(n);const e=c(a*Math.cos(t)/A,-u/A,a*Math.sin(t)/A);m.push(e)}else for(let O=0;O<s;O++){const t=O*(2*Math.PI/s),n=c(Math.cos(t)*u,h,Math.sin(t)*u);g.push(n);const e=c(a*Math.cos(t)/A,u/A,a*Math.sin(t)/A);m.push(e)}const I=new Array,y=new Array;if(r){for(let t=3;t<g.length;t++)I.push(1),I.push(t-1),I.push(t),y.push(0),y.push(0),y.push(0);I.push(g.length-1),I.push(2),I.push(1),y.push(0),y.push(0),y.push(0)}if(l){for(let t=3;t<g.length;t++)I.push(t),I.push(t-1),I.push(0),y.push(t),y.push(t-1),y.push(1);I.push(0),I.push(2),I.push(g.length-1),y.push(1),y.push(2),y.push(m.length-1)}const N=O(3*M);for(let c=0;c<M;c++)N[3*c]=g[c][0],N[3*c+1]=g[c][1],N[3*c+2]=g[c][2];const P=O(3*M);for(let c=0;c<M;c++)P[3*c]=m[c][0],P[3*c+1]=m[c][1],P[3*c+2]=m[c][2];const S=[[j.POSITION,new T(N,I,3,!0)],[j.NORMAL,new T(P,y,3,!0)]];return new b(t,S)}function at(t,h,u,p,i,w,g){const m=i?f(i):c(1,0,0),M=w?f(w):c(0,0,0);g??=!0;const A=a();e(A,m);const I=a();s(I,A,Math.abs(h));const y=a();s(y,I,-.5),o(y,y,M);const N=c(0,1,0);Math.abs(1-r(A,N))<.2&&l(N,0,0,1);const P=a();n(P,A,N),e(P,P),n(N,P,A);const S=2*p+(g?2:0),R=p+(g?2:0),L=O(3*S),d=O(3*R),E=O(2*S),U=new Array(3*p*(g?4:2)),V=new Array(3*p*(g?4:2));g&&(L[3*(S-2)]=y[0],L[3*(S-2)+1]=y[1],L[3*(S-2)+2]=y[2],E[2*(S-2)]=0,E[2*(S-2)+1]=0,L[3*(S-1)]=L[3*(S-2)]+I[0],L[3*(S-1)+1]=L[3*(S-2)+1]+I[1],L[3*(S-1)+2]=L[3*(S-2)+2]+I[2],E[2*(S-1)]=1,E[2*(S-1)+1]=1,d[3*(R-2)]=-A[0],d[3*(R-2)+1]=-A[1],d[3*(R-2)+2]=-A[2],d[3*(R-1)]=A[0],d[3*(R-1)+1]=A[1],d[3*(R-1)+2]=A[2]);const x=(t,n,e)=>{U[t]=n,V[t]=e};let F=0;const v=a(),C=a();for(let n=0;n<p;n++){const t=n*(2*Math.PI/p);s(v,N,Math.sin(t)),s(C,P,Math.cos(t)),o(v,v,C),d[3*n]=v[0],d[3*n+1]=v[1],d[3*n+2]=v[2],s(v,v,u),o(v,v,y),L[3*n]=v[0],L[3*n+1]=v[1],L[3*n+2]=v[2],E[2*n]=n/p,E[2*n+1]=0,L[3*(n+p)]=L[3*n]+I[0],L[3*(n+p)+1]=L[3*n+1]+I[1],L[3*(n+p)+2]=L[3*n+2]+I[2],E[2*(n+p)]=n/p,E[2*n+1]=1;const e=(n+1)%p;x(F++,n,n),x(F++,n+p,n),x(F++,e,e),x(F++,e,e),x(F++,n+p,n),x(F++,e+p,e)}if(g){for(let t=0;t<p;t++){const n=(t+1)%p;x(F++,S-2,R-2),x(F++,t,R-2),x(F++,n,R-2)}for(let t=0;t<p;t++){const n=(t+1)%p;x(F++,t+p,R-1),x(F++,S-1,R-1),x(F++,n+p,R-1)}}const G=[[j.POSITION,new T(L,U,3,!0)],[j.NORMAL,new T(d,V,3,!0)],[j.UV0,new T(E,U,2,!0)]];return new b(t,G)}function ft(t,n,e,s,o,r){s=s||10,o=null==o||o,L(n.length>1);const l=[[0,0,0]],h=[],u=[];for(let c=0;c<s;c++){h.push([0,-c-1,-(c+1)%s-1]);const t=c/s*2*Math.PI;u.push([Math.cos(t)*e,Math.sin(t)*e])}return pt(t,u,n,l,h,o,r)}function pt(r,u,a,f,p,w,g=c(0,0,0)){const m=u.length,M=O(a.length*m*3+(6*f.length||0)),A=O(a.length*m*3+(f?6:0)),S=new Array,R=new Array;let L=0,d=0;const E=i(),U=i(),V=i(),x=i(),F=i(),v=i(),C=i(),G=i(),D=i(),q=i(),B=i(),k=i(),z=i(),Z=I();l(D,0,1,0),t(U,a[1],a[0]),e(U,U),w?(o(G,a[0],g),e(V,G)):l(V,0,0,1),Mt(U,V,D,D,F,V,At),h(x,V),h(k,F);for(let t=0;t<f.length;t++)s(v,F,f[t][0]),s(G,V,f[t][2]),o(v,v,G),o(v,v,a[0]),M[L++]=v[0],M[L++]=v[1],M[L++]=v[2];A[d++]=-U[0],A[d++]=-U[1],A[d++]=-U[2];for(let t=0;t<p.length;t++)S.push(p[t][0]>0?p[t][0]:-p[t][0]-1+f.length),S.push(p[t][1]>0?p[t][1]:-p[t][1]-1+f.length),S.push(p[t][2]>0?p[t][2]:-p[t][2]-1+f.length),R.push(0),R.push(0),R.push(0);let H=f.length;const J=f.length-1;for(let l=0;l<a.length;l++){let r=!1;if(l>0){h(E,U),l<a.length-1?(t(U,a[l+1],a[l]),e(U,U)):r=!0,o(q,E,U),e(q,q),o(B,a[l-1],x),y(a[l],q,Z);N(Z,P(B,E),G)?(t(G,G,a[l]),e(V,G),n(F,q,V),e(F,F)):Mt(q,x,k,D,F,V,At),h(x,V),h(k,F)}w&&(o(G,a[l],g),e(z,G));for(let t=0;t<m;t++)if(s(v,F,u[t][0]),s(G,V,u[t][1]),o(v,v,G),e(C,v),A[d++]=C[0],A[d++]=C[1],A[d++]=C[2],o(v,v,a[l]),M[L++]=v[0],M[L++]=v[1],M[L++]=v[2],!r){const n=(t+1)%m;S.push(H+t),S.push(H+m+t),S.push(H+n),S.push(H+n),S.push(H+m+t),S.push(H+m+n);for(let t=0;t<6;t++){const n=S.length-6;R.push(S[n+t]-J)}}H+=m}const K=a[a.length-1];for(let t=0;t<f.length;t++)s(v,F,f[t][0]),s(G,V,f[t][1]),o(v,v,G),o(v,v,K),M[L++]=v[0],M[L++]=v[1],M[L++]=v[2];const Q=d/3;A[d++]=U[0],A[d++]=U[1],A[d++]=U[2];const W=H-m;for(let t=0;t<p.length;t++)S.push(p[t][0]>=0?H+p[t][0]:-p[t][0]-1+W),S.push(p[t][2]>=0?H+p[t][2]:-p[t][2]-1+W),S.push(p[t][1]>=0?H+p[t][1]:-p[t][1]-1+W),R.push(Q),R.push(Q),R.push(Q);const X=[[j.POSITION,new T(M,S,3,!0)],[j.NORMAL,new T(A,R,3,!0)]];return new b(r,X)}function it(t,n,e,s){L(n.length>1,"createPolylineGeometry(): polyline needs at least 2 points"),L(3===n[0].length,"createPolylineGeometry(): malformed vertex"),L(null==e||e.length===n.length,"createPolylineGeometry: need same number of points and normals"),L(null==e||3===e[0].length,"createPolylineGeometry(): malformed normal");const o=g(3*n.length),r=new Array(2*(n.length-1));let l=0,h=0;for(let c=0;c<n.length;c++){for(let t=0;t<3;t++)o[l++]=n[c][t];c>0&&(r[h++]=c-1,r[h++]=c)}const u=[[j.POSITION,new T(o,r,3,!0)]];if(e){const t=O(3*e.length);let s=0;for(let o=0;o<n.length;o++)for(let n=0;n<3;n++)t[s++]=e[o][n];u.push([j.NORMAL,new T(t,r,3,!0)])}return s&&u.push([j.COLOR,new T(s,A(s.length/4),4)]),new b(t,u,null,R.Line)}function wt(t,n,e,s,o,r=0){const l=new Array(18),h=[[-e,r,o/2],[s,r,o/2],[0,n+r,o/2],[-e,r,-o/2],[s,r,-o/2],[0,n+r,-o/2]],u=[0,1,2,3,0,2,2,5,3,1,4,5,5,2,1,1,0,3,3,4,1,4,3,5];for(let c=0;c<6;c++)l[3*c]=h[c][0],l[3*c+1]=h[c][1],l[3*c+2]=h[c][2];return new b(t,[[j.POSITION,new T(l,u,3,!0)]])}function gt(t,n){const e=t.getMutableAttribute(j.POSITION).data;for(let s=0;s<e.length;s+=3){const t=e[s],o=e[s+1],r=e[s+2];l(It,t,o,r),u(It,It,n),e[s]=It[0],e[s+1]=It[1],e[s+2]=It[2]}}function Ot(t,n=t){const e=t.attributes,s=e.get(j.POSITION).data,o=e.get(j.NORMAL).data;if(o){const t=n.getMutableAttribute(j.NORMAL).data;for(let n=0;n<o.length;n+=3){const e=o[n+1];t[n+1]=-o[n+2],t[n+2]=e}}if(s){const t=n.getMutableAttribute(j.POSITION).data;for(let n=0;n<s.length;n+=3){const e=s[n+1];t[n+1]=-s[n+2],t[n+2]=e}}}function mt(t,s,o,l,h){return!(Math.abs(r(s,t))>h)&&(n(o,t,s),e(o,o),n(l,o,t),e(l,l),!0)}function Mt(t,n,e,s,o,r,l){return mt(t,n,o,r,l)||mt(t,e,o,r,l)||mt(t,s,o,r,l)}const At=.99619469809,It=i();export{Ot as cgToGIS,C as createBoxGeometry,ct as createConeGeometry,at as createCylinderGeometry,k as createDiamondGeometry,wt as createExtrudedTriangle,pt as createPathExtrusionGeometry,lt as createPointGeometry,rt as createPolySphereData,ot as createPolySphereGeometry,it as createPolylineGeometry,st as createSphereGeometry,ut as createSquareGeometry,et as createTetrahedronGeometry,ft as createTubeGeometry,Mt as makeOrthoBasisDirUpFallback,gt as transformInPlace};
5
+ import{f as t,b as n,n as e,j as o,g as s,l as r,a as l,c as h,h as u}from"../../../../chunks/vec32.js";import{fromValues as c,create as a,clone as f}from"../../../../core/libs/gl-matrix-2/factories/vec3f32.js";import{clone as p,create as i,fromValues as w}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{newDoubleArray as g}from"../../../../geometry/support/DoubleArray.js";import{newFloatArray as O,floatArrayFrom as m}from"../../../../geometry/support/FloatArray.js";import{getZeroIndexArray as M,getContinuousIndexArray as A}from"../../../../geometry/support/Indices.js";import{create as I,fromPositionAndNormal as y,intersectRay as N}from"../../../../geometry/support/plane.js";import{wrap as P}from"../../../../geometry/support/ray.js";import{Attribute as T}from"./Attribute.js";import{Vec3Compact as S}from"./BufferVectorMath.js";import{ContentObjectType as R}from"./ContentObjectType.js";import{Geometry as b}from"./Geometry.js";import{assert as L}from"./Util.js";import{VertexAttribute as j}from"./VertexAttribute.js";const d=S,E=[[-.5,-.5,.5],[.5,-.5,.5],[.5,.5,.5],[-.5,.5,.5],[-.5,-.5,-.5],[.5,-.5,-.5],[.5,.5,-.5],[-.5,.5,-.5]],U=[0,0,1,-1,0,0,1,0,0,0,-1,0,0,1,0,0,0,-1],V=[0,0,1,0,1,1,0,1],x=[0,1,2,2,3,0,4,0,3,3,7,4,1,5,6,6,2,1,1,0,4,4,5,1,3,2,6,6,7,3,5,4,7,7,6,5],F=new Array(36);for(let yt=0;yt<6;yt++)for(let t=0;t<6;t++)F[6*yt+t]=yt;const v=new Array(36);for(let yt=0;yt<6;yt++)v[6*yt]=0,v[6*yt+1]=1,v[6*yt+2]=2,v[6*yt+3]=2,v[6*yt+4]=3,v[6*yt+5]=0;function C(t,n){Array.isArray(n)||(n=[n,n,n]);const e=new Array(24);for(let o=0;o<8;o++)e[3*o]=E[o][0]*n[0],e[3*o+1]=E[o][1]*n[1],e[3*o+2]=E[o][2]*n[2];return new b(t,[[j.POSITION,new T(e,x,3,!0)],[j.NORMAL,new T(U,F,3)],[j.UV0,new T(V,v,2)]])}const G=[[-.5,0,-.5],[.5,0,-.5],[.5,0,.5],[-.5,0,.5],[0,-.5,0],[0,.5,0]],D=[0,1,-1,1,1,0,0,1,1,-1,1,0,0,-1,-1,1,-1,0,0,-1,1,-1,-1,0],q=[5,1,0,5,2,1,5,3,2,5,0,3,4,0,1,4,1,2,4,2,3,4,3,0],B=[0,0,0,1,1,1,2,2,2,3,3,3,4,4,4,5,5,5,6,6,6,7,7,7];function k(t,n){Array.isArray(n)||(n=[n,n,n]);const e=new Array(18);for(let o=0;o<6;o++)e[3*o]=G[o][0]*n[0],e[3*o+1]=G[o][1]*n[1],e[3*o+2]=G[o][2]*n[2];return new b(t,[[j.POSITION,new T(e,q,3,!0)],[j.NORMAL,new T(D,B,3)]])}const z=c(-.5,0,-.5),Z=c(.5,0,-.5),H=c(0,0,.5),J=c(0,.5,0),K=a(),Q=a(),W=a(),X=a(),Y=a();t(K,z,J),t(Q,z,Z),n(W,K,Q),e(W,W),t(K,Z,J),t(Q,Z,H),n(X,K,Q),e(X,X),t(K,H,J),t(Q,H,z),n(Y,K,Q),e(Y,Y);const $=[z,Z,H,J],_=[0,-1,0,W[0],W[1],W[2],X[0],X[1],X[2],Y[0],Y[1],Y[2]],tt=[0,1,2,3,1,0,3,2,1,3,0,2],nt=[0,0,0,1,1,1,2,2,2,3,3,3];function et(t,n){Array.isArray(n)||(n=[n,n,n]);const e=new Array(12);for(let o=0;o<4;o++)e[3*o]=$[o][0]*n[0],e[3*o+1]=$[o][1]*n[1],e[3*o+2]=$[o][2]*n[2];return new b(t,[[j.POSITION,new T(e,tt,3,!0)],[j.NORMAL,new T(_,nt,3)]])}function ot(t,n,e,o,s={uv:!0}){const r=-Math.PI,l=2*Math.PI,h=-Math.PI/2,u=Math.PI,c=Math.max(3,Math.floor(e)),a=Math.max(2,Math.floor(o)),f=(c+1)*(a+1),p=O(3*f),i=O(3*f),w=O(2*f),g=[];let m=0;for(let O=0;O<=a;O++){const t=[],e=O/a,o=h+e*u,s=Math.cos(o);for(let h=0;h<=c;h++){const u=h/c,a=r+u*l,f=Math.cos(a)*s,g=Math.sin(o),O=-Math.sin(a)*s;p[3*m]=f*n,p[3*m+1]=g*n,p[3*m+2]=O*n,i[3*m]=f,i[3*m+1]=g,i[3*m+2]=O,w[2*m]=u,w[2*m+1]=e,t.push(m),++m}g.push(t)}const A=new Array;for(let O=0;O<a;O++)for(let t=0;t<c;t++){const n=g[O][t],e=g[O][t+1],o=g[O+1][t+1],s=g[O+1][t];0===O?(A.push(n),A.push(o),A.push(s)):O===a-1?(A.push(n),A.push(e),A.push(o)):(A.push(n),A.push(e),A.push(o),A.push(o),A.push(s),A.push(n))}const I=[[j.POSITION,new T(p,A,3,!0)],[j.NORMAL,new T(i,A,3,!0)]];return s.uv&&I.push([j.UV0,new T(w,A,2,!0)]),s.offset&&(I[0][0]=j.OFFSET,I.push([j.POSITION,new T(Float64Array.from(s.offset),M(A.length),3,!0)])),new b(t,I)}function st(t,n,e,o){const s=rt(n,e,o);return new b(t,s)}function rt(t,n,e){const o=t;let s,r;if(e)s=[0,-1,0,1,0,0,0,0,1,-1,0,0,0,0,-1,0,1,0],r=[0,1,2,0,2,3,0,3,4,0,4,1,1,5,2,2,5,3,3,5,4,4,5,1];else{const t=o*(1+Math.sqrt(5))/2;s=[-o,t,0,o,t,0,-o,-t,0,o,-t,0,0,-o,t,0,o,t,0,-o,-t,0,o,-t,t,0,-o,t,0,o,-t,0,-o,-t,0,o],r=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1]}for(let c=0;c<s.length;c+=3)d.scale(s,c,t/d.length(s,c));let l={};function h(n,e){n>e&&([n,e]=[e,n]);const o=n.toString()+"."+e.toString();if(l[o])return l[o];let r=s.length;return s.length+=3,d.add(s,3*n,s,3*e,s,r),d.scale(s,r,t/d.length(s,r)),r/=3,l[o]=r,r}for(let c=0;c<n;c++){const t=r.length,n=new Array(4*t);for(let e=0;e<t;e+=3){const t=r[e],o=r[e+1],s=r[e+2],l=h(t,o),u=h(o,s),c=h(s,t),a=4*e;n[a]=t,n[a+1]=l,n[a+2]=c,n[a+3]=o,n[a+4]=u,n[a+5]=l,n[a+6]=s,n[a+7]=c,n[a+8]=u,n[a+9]=l,n[a+10]=u,n[a+11]=c}r=n,l={}}const u=m(s);for(let c=0;c<u.length;c+=3)d.normalize(u,c);return[[j.POSITION,new T(m(s),r,3,!0)],[j.NORMAL,new T(u,r,3,!0)]]}function lt(t,n,e,o,s,r,l,h,u,c=null){const a=e?p(e):i(),f=n?p(n):w(0,0,1),g=o?[255*o[0],255*o[1],255*o[2],o.length>3?255*o[3]:255]:[255,255,255,255],O=null!=r&&2===r.length?r:[1,1],m=null!=s?[s]:[0],A=M(1),I=[[j.POSITION,new T(a,A,3,!0)],[j.NORMAL,new T(f,A,3,!0)],[j.COLOR,new T(g,A,4,!0)],[j.SIZE,new T(O,A,2)],[j.ROTATION,new T(m,A,1,!0)]];if(h&&I.push([j.UV0,new T(h,A,h.length)]),null!=l&&(l=[l[0],l[1],l[2],l[3]],I.push([j.CENTEROFFSETANDDISTANCE,new T(l,A,4)])),u){const t=[u[0],u[1],u[2],u[3]];I.push([j.FEATUREATTRIBUTE,new T(t,A,4)])}return new b(t,I,null,R.Point,c)}const ht=[[-1,-1,0],[1,-1,0],[1,1,0],[-1,1,0]];function ut(t,n=ht){const e=new Array(12);for(let c=0;c<4;c++)for(let t=0;t<3;t++)e[3*c+t]=n[c][t];const o=[0,1,2,2,3,0],s=[0,0,1],r=[0,0,0,0,0,0],l=[0,0,1,0,1,1,0,1],h=[255,255,255,255],u=[[j.POSITION,new T(e,o,3,!0)],[j.NORMAL,new T(s,r,3,!0)],[j.UV0,new T(l,o,2,!0)],[j.COLOR,new T(h,r,4,!0)]];return new b(t,u)}function ct(t,n,e,o,s,r=!0,l=!0){let h=0;const u=e,a=n;let f=c(0,h,0),p=c(0,h+a,0),i=c(0,-1,0),w=c(0,1,0);s&&(h=a,p=c(0,0,0),f=c(0,h,0),i=c(0,1,0),w=c(0,-1,0));const g=[p,f],m=[i,w],M=o+2,A=Math.sqrt(a*a+u*u);if(s)for(let O=o-1;O>=0;O--){const t=O*(2*Math.PI/o),n=c(Math.cos(t)*u,h,Math.sin(t)*u);g.push(n);const e=c(a*Math.cos(t)/A,-u/A,a*Math.sin(t)/A);m.push(e)}else for(let O=0;O<o;O++){const t=O*(2*Math.PI/o),n=c(Math.cos(t)*u,h,Math.sin(t)*u);g.push(n);const e=c(a*Math.cos(t)/A,u/A,a*Math.sin(t)/A);m.push(e)}const I=new Array,y=new Array;if(r){for(let t=3;t<g.length;t++)I.push(1),I.push(t-1),I.push(t),y.push(0),y.push(0),y.push(0);I.push(g.length-1),I.push(2),I.push(1),y.push(0),y.push(0),y.push(0)}if(l){for(let t=3;t<g.length;t++)I.push(t),I.push(t-1),I.push(0),y.push(t),y.push(t-1),y.push(1);I.push(0),I.push(2),I.push(g.length-1),y.push(1),y.push(2),y.push(m.length-1)}const N=O(3*M);for(let c=0;c<M;c++)N[3*c]=g[c][0],N[3*c+1]=g[c][1],N[3*c+2]=g[c][2];const P=O(3*M);for(let c=0;c<M;c++)P[3*c]=m[c][0],P[3*c+1]=m[c][1],P[3*c+2]=m[c][2];const S=[[j.POSITION,new T(N,I,3,!0)],[j.NORMAL,new T(P,y,3,!0)]];return new b(t,S)}function at(t,h,u,p,i,w,g){const m=i?f(i):c(1,0,0),M=w?f(w):c(0,0,0);g??=!0;const A=a();e(A,m);const I=a();o(I,A,Math.abs(h));const y=a();o(y,I,-.5),s(y,y,M);const N=c(0,1,0);Math.abs(1-r(A,N))<.2&&l(N,0,0,1);const P=a();n(P,A,N),e(P,P),n(N,P,A);const S=2*p+(g?2:0),R=p+(g?2:0),L=O(3*S),d=O(3*R),E=O(2*S),U=new Array(3*p*(g?4:2)),V=new Array(3*p*(g?4:2));g&&(L[3*(S-2)]=y[0],L[3*(S-2)+1]=y[1],L[3*(S-2)+2]=y[2],E[2*(S-2)]=0,E[2*(S-2)+1]=0,L[3*(S-1)]=L[3*(S-2)]+I[0],L[3*(S-1)+1]=L[3*(S-2)+1]+I[1],L[3*(S-1)+2]=L[3*(S-2)+2]+I[2],E[2*(S-1)]=1,E[2*(S-1)+1]=1,d[3*(R-2)]=-A[0],d[3*(R-2)+1]=-A[1],d[3*(R-2)+2]=-A[2],d[3*(R-1)]=A[0],d[3*(R-1)+1]=A[1],d[3*(R-1)+2]=A[2]);const x=(t,n,e)=>{U[t]=n,V[t]=e};let F=0;const v=a(),C=a();for(let n=0;n<p;n++){const t=n*(2*Math.PI/p);o(v,N,Math.sin(t)),o(C,P,Math.cos(t)),s(v,v,C),d[3*n]=v[0],d[3*n+1]=v[1],d[3*n+2]=v[2],o(v,v,u),s(v,v,y),L[3*n]=v[0],L[3*n+1]=v[1],L[3*n+2]=v[2],E[2*n]=n/p,E[2*n+1]=0,L[3*(n+p)]=L[3*n]+I[0],L[3*(n+p)+1]=L[3*n+1]+I[1],L[3*(n+p)+2]=L[3*n+2]+I[2],E[2*(n+p)]=n/p,E[2*n+1]=1;const e=(n+1)%p;x(F++,n,n),x(F++,n+p,n),x(F++,e,e),x(F++,e,e),x(F++,n+p,n),x(F++,e+p,e)}if(g){for(let t=0;t<p;t++){const n=(t+1)%p;x(F++,S-2,R-2),x(F++,t,R-2),x(F++,n,R-2)}for(let t=0;t<p;t++){const n=(t+1)%p;x(F++,t+p,R-1),x(F++,S-1,R-1),x(F++,n+p,R-1)}}const G=[[j.POSITION,new T(L,U,3,!0)],[j.NORMAL,new T(d,V,3,!0)],[j.UV0,new T(E,U,2,!0)]];return new b(t,G)}function ft(t,n,e,o,s,r){o=o||10,s=null==s||s,L(n.length>1);const l=[[0,0,0]],h=[],u=[];for(let c=0;c<o;c++){h.push([0,-c-1,-(c+1)%o-1]);const t=c/o*2*Math.PI;u.push([Math.cos(t)*e,Math.sin(t)*e])}return pt(t,u,n,l,h,s,r)}function pt(r,u,a,f,p,w,g=c(0,0,0)){const m=u.length,M=O(a.length*m*3+(6*f.length||0)),A=O(a.length*m*3+(f?6:0)),S=new Array,R=new Array;let L=0,d=0;const E=i(),U=i(),V=i(),x=i(),F=i(),v=i(),C=i(),G=i(),D=i(),q=i(),B=i(),k=i(),z=i(),Z=I();l(D,0,1,0),t(U,a[1],a[0]),e(U,U),w?(s(G,a[0],g),e(V,G)):l(V,0,0,1),Mt(U,V,D,D,F,V,At),h(x,V),h(k,F);for(let t=0;t<f.length;t++)o(v,F,f[t][0]),o(G,V,f[t][2]),s(v,v,G),s(v,v,a[0]),M[L++]=v[0],M[L++]=v[1],M[L++]=v[2];A[d++]=-U[0],A[d++]=-U[1],A[d++]=-U[2];for(let t=0;t<p.length;t++)S.push(p[t][0]>0?p[t][0]:-p[t][0]-1+f.length),S.push(p[t][1]>0?p[t][1]:-p[t][1]-1+f.length),S.push(p[t][2]>0?p[t][2]:-p[t][2]-1+f.length),R.push(0),R.push(0),R.push(0);let H=f.length;const J=f.length-1;for(let l=0;l<a.length;l++){let r=!1;if(l>0){h(E,U),l<a.length-1?(t(U,a[l+1],a[l]),e(U,U)):r=!0,s(q,E,U),e(q,q),s(B,a[l-1],x),y(a[l],q,Z);N(Z,P(B,E),G)?(t(G,G,a[l]),e(V,G),n(F,q,V),e(F,F)):Mt(q,x,k,D,F,V,At),h(x,V),h(k,F)}w&&(s(G,a[l],g),e(z,G));for(let t=0;t<m;t++)if(o(v,F,u[t][0]),o(G,V,u[t][1]),s(v,v,G),e(C,v),A[d++]=C[0],A[d++]=C[1],A[d++]=C[2],s(v,v,a[l]),M[L++]=v[0],M[L++]=v[1],M[L++]=v[2],!r){const n=(t+1)%m;S.push(H+t),S.push(H+m+t),S.push(H+n),S.push(H+n),S.push(H+m+t),S.push(H+m+n);for(let t=0;t<6;t++){const n=S.length-6;R.push(S[n+t]-J)}}H+=m}const K=a[a.length-1];for(let t=0;t<f.length;t++)o(v,F,f[t][0]),o(G,V,f[t][1]),s(v,v,G),s(v,v,K),M[L++]=v[0],M[L++]=v[1],M[L++]=v[2];const Q=d/3;A[d++]=U[0],A[d++]=U[1],A[d++]=U[2];const W=H-m;for(let t=0;t<p.length;t++)S.push(p[t][0]>=0?H+p[t][0]:-p[t][0]-1+W),S.push(p[t][2]>=0?H+p[t][2]:-p[t][2]-1+W),S.push(p[t][1]>=0?H+p[t][1]:-p[t][1]-1+W),R.push(Q),R.push(Q),R.push(Q);const X=[[j.POSITION,new T(M,S,3,!0)],[j.NORMAL,new T(A,R,3,!0)]];return new b(r,X)}function it(t,n,e,o){L(n.length>1,"createPolylineGeometry(): polyline needs at least 2 points"),L(3===n[0].length,"createPolylineGeometry(): malformed vertex"),L(null==e||e.length===n.length,"createPolylineGeometry: need same number of points and normals"),L(null==e||3===e[0].length,"createPolylineGeometry(): malformed normal");const s=g(3*n.length),r=new Array(2*(n.length-1));let l=0,h=0;for(let c=0;c<n.length;c++){for(let t=0;t<3;t++)s[l++]=n[c][t];c>0&&(r[h++]=c-1,r[h++]=c)}const u=[[j.POSITION,new T(s,r,3,!0)]];if(e){const t=O(3*e.length);let o=0;for(let s=0;s<n.length;s++)for(let n=0;n<3;n++)t[o++]=e[s][n];u.push([j.NORMAL,new T(t,r,3,!0)])}return o&&u.push([j.COLOR,new T(o,A(o.length/4),4)]),new b(t,u,null,R.Line)}function wt(t,n,e,o,s,r=0){const l=new Array(18),h=[[-e,r,s/2],[o,r,s/2],[0,n+r,s/2],[-e,r,-s/2],[o,r,-s/2],[0,n+r,-s/2]],u=[0,1,2,3,0,2,2,5,3,1,4,5,5,2,1,1,0,3,3,4,1,4,3,5];for(let c=0;c<6;c++)l[3*c]=h[c][0],l[3*c+1]=h[c][1],l[3*c+2]=h[c][2];return new b(t,[[j.POSITION,new T(l,u,3,!0)]])}function gt(t,n){const e=t.getMutableAttribute(j.POSITION).data;for(let o=0;o<e.length;o+=3){const t=e[o],s=e[o+1],r=e[o+2];l(It,t,s,r),u(It,It,n),e[o]=It[0],e[o+1]=It[1],e[o+2]=It[2]}}function Ot(t,n=t){const e=t.attributes,o=e.get(j.POSITION).data,s=e.get(j.NORMAL).data;if(s){const t=n.getMutableAttribute(j.NORMAL).data;for(let n=0;n<s.length;n+=3){const e=s[n+1];t[n+1]=-s[n+2],t[n+2]=e}}if(o){const t=n.getMutableAttribute(j.POSITION).data;for(let n=0;n<o.length;n+=3){const e=o[n+1];t[n+1]=-o[n+2],t[n+2]=e}}}function mt(t,o,s,l,h){return!(Math.abs(r(o,t))>h)&&(n(s,t,o),e(s,s),n(l,s,t),e(l,l),!0)}function Mt(t,n,e,o,s,r,l){return mt(t,n,s,r,l)||mt(t,e,s,r,l)||mt(t,o,s,r,l)}const At=.99619469809,It=i();export{Ot as cgToGIS,C as createBoxGeometry,ct as createConeGeometry,at as createCylinderGeometry,k as createDiamondGeometry,wt as createExtrudedTriangle,pt as createPathExtrusionGeometry,lt as createPointGeometry,rt as createPolySphereData,st as createPolySphereGeometry,it as createPolylineGeometry,ot as createSphereGeometry,ut as createSquareGeometry,et as createTetrahedronGeometry,ft as createTubeGeometry,Mt as makeOrthoBasisDirUpFallback,gt as transformInPlace};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.31/esri/copyright.txt for details.
4
4
  */
5
- import{copy as t}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as r,IDENTITY as i}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{g as s,h as e,j as a,l as n,c as o,n as h}from"../../../../chunks/vec32.js";import{create as l,UNIT_Z as d}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{t as c}from"../../../../chunks/vec42.js";import{create as f}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{create as m,fromPoints as y,copy as u}from"../../../../geometry/support/ray.js";import{ViewingMode as p}from"../../../ViewingMode.js";import{IntersectorOptions as g,StoreResults as _,IntersectorType as O}from"./IntersectorInterfaces.js";import{HudTarget as L}from"./IntersectorTarget.js";import{isValidIntersectorResult as v}from"./intersectorUtils.js";import{IntersectorTransform as j,getVerticalOffsetObject3D as w}from"./verticalOffsetUtils.js";const E=1e-5;class b{constructor(t){this.options=new g,this._results=new A,this.transform=new j,this.tolerance=E,this.verticalOffset=null,this._ray=m(),this._rayEnd=l(),this._rayBeginTransformed=l(),this._rayEndTransformed=l(),this.viewingMode=t??p.Global}get results(){return this._results}get ray(){return this._ray}get rayBegin(){return this._ray.origin}get rayEnd(){return this._rayEnd}reset(t,r,i){this.resetWithRay(y(t,r,this._ray),i)}resetWithRay(t,r){this.camera=r,t!==this._ray&&u(t,this._ray),0!==this.options.verticalOffset?this.viewingMode===p.Local?this._ray.origin[2]-=this.options.verticalOffset:this.verticalOffset=this.options.verticalOffset:this.verticalOffset=null,s(this._rayEnd,this._ray.origin,this._ray.direction),this._results.init(this._ray)}intersect(t=null,r,i,s,e){this.point=r,this.filterPredicate=s,this.tolerance=i??E;const a=w(this.verticalOffset);if(t&&t.length>0){const r=e?t=>{e(t)&&this.intersectObject(t)}:t=>{this.intersectObject(t)};for(const i of t){const t=i.getSpatialQueryAccelerator?.();null!=t?(null!=a?t.forEachAlongRayWithVerticalOffset(this._ray.origin,this._ray.direction,r,a):t.forEachAlongRay(this._ray.origin,this._ray.direction,r),this.options.selectionMode&&this.options.hud&&t.forEachDegenerateObject(r)):i.objects.forAll((t=>r(t)))}}this.sortResults()}intersectObject(t){const r=t.geometries;if(!r)return;const s=t.effectiveTransformation,a=w(this.verticalOffset);for(const n of r){if(!n.visible)continue;const{material:r,id:o}=n;if(!r.visible)continue;this.transform.setAndInvalidateLazyTransforms(s,n.transformation),e(this._rayBeginTransformed,this.rayBegin,this.transform.inverse),e(this._rayEndTransformed,this.rayEnd,this.transform.inverse);const h=this.transform.transform;null!=a&&(a.objectTransform=this.transform),r.intersect(n,this.transform.transform,this,this._rayBeginTransformed,this._rayEndTransformed,((r,s,e,a,n,l)=>{if(r>=0){if(null!=this.filterPredicate&&!this.filterPredicate(this._ray.origin,this._rayEnd,r))return;const d=a?this._results.hud:this._results,c=a?a=>{const h=new L(t,o,e,l);a.set(O.HUD,h,r,s,i,n)}:i=>i.set(O.OBJECT,{object:t,geometryId:o,triangleNr:e},r,s,h,n);if((null==d.min.drapedLayerOrder||n>=d.min.drapedLayerOrder)&&(null==d.min.dist||r<d.min.dist)&&c(d.min),this.options.store!==_.MIN&&(null==d.max.drapedLayerOrder||n<d.max.drapedLayerOrder)&&(null==d.max.dist||r>d.max.dist)&&c(d.max),this.options.store===_.ALL)if(a){const t=new I(this._ray);c(t),this._results.hud.all.push(t)}else{const t=new B(this._ray);c(t),this._results.all.push(t)}}}))}}sortResults(t=this._results.all){t.sort(((t,r)=>t.dist!==r.dist?(t.dist??0)-(r.dist??0):t.drapedLayerOrder!==r.drapedLayerOrder?x(t.drapedLayerOrder,r.drapedLayerOrder):x(t.drapedLayerGraphicOrder,r.drapedLayerGraphicOrder)))}}function x(t,r){return(r??-Number.MAX_VALUE)-(t??-Number.MAX_VALUE)}function T(t){return new b(t)}class A{constructor(){this.min=new B(m()),this.max=new B(m()),this.hud={min:new I(m()),max:new I(m()),all:new Array},this.ground=new B(m()),this.all=[]}init(t){this.min.init(t),this.max.init(t),this.ground.init(t),this.all.length=0,this.hud.min.init(t),this.hud.max.init(t),this.hud.all.length=0}}class B{get ray(){return this._ray}get distanceInRenderSpace(){return null!=this.dist?(a(M,this.ray.direction,this.dist),n(M)):null}getIntersectionPoint(t){return!!v(this)&&(a(M,this.ray.direction,this.dist),s(t,this.ray.origin,M),!0)}getTransformedNormal(t){return o(R,this.normal),R[3]=0,c(R,R,this.transformation),o(t,R),h(t,t)}constructor(t){this.intersector=O.OBJECT,this.normal=l(),this.transformation=r(),this._ray=m(),this.init(t)}init(t){this.dist=null,this.target=null,this.drapedLayerOrder=null,this.drapedLayerGraphicOrder=null,this.intersector=O.OBJECT,u(t,this._ray)}set(r,s,e,a,n,h,l){this.intersector=r,this.dist=e,o(this.normal,a??d),t(this.transformation,n??i),this.target=s,this.drapedLayerOrder=h,this.drapedLayerGraphicOrder=l}copy(r){u(r.ray,this._ray),this.intersector=r.intersector,this.dist=r.dist,this.target=r.target,this.drapedLayerOrder=r.drapedLayerOrder,this.drapedLayerGraphicOrder=r.drapedLayerGraphicOrder,o(this.normal,r.normal),t(this.transformation,r.transformation)}}class I extends B{constructor(){super(...arguments),this.intersector=O.HUD}}function G(t){return new B(t)}const M=l(),R=f();export{E as defaultTolerance,T as newIntersector,G as newIntersectorResult};
5
+ import{copy as t}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as r,IDENTITY as i}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{g as s,h as e,j as a,m as n,c as o,n as h}from"../../../../chunks/vec32.js";import{create as d,UNIT_Z as l}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{t as c}from"../../../../chunks/vec42.js";import{create as f}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{create as m,fromPoints as y,copy as u}from"../../../../geometry/support/ray.js";import{ViewingMode as p}from"../../../ViewingMode.js";import{IntersectorOptions as g,StoreResults as _,IntersectorType as O}from"./IntersectorInterfaces.js";import{HudTarget as L}from"./IntersectorTarget.js";import{isValidIntersectorResult as v}from"./intersectorUtils.js";import{IntersectorTransform as j,getVerticalOffsetObject3D as w}from"./verticalOffsetUtils.js";const E=1e-5;class b{constructor(t){this.options=new g,this._results=new A,this.transform=new j,this.tolerance=E,this.verticalOffset=null,this._ray=m(),this._rayEnd=d(),this._rayBeginTransformed=d(),this._rayEndTransformed=d(),this.viewingMode=t??p.Global}get results(){return this._results}get ray(){return this._ray}get rayBegin(){return this._ray.origin}get rayEnd(){return this._rayEnd}reset(t,r,i){this.resetWithRay(y(t,r,this._ray),i)}resetWithRay(t,r){this.camera=r,t!==this._ray&&u(t,this._ray),0!==this.options.verticalOffset?this.viewingMode===p.Local?this._ray.origin[2]-=this.options.verticalOffset:this.verticalOffset=this.options.verticalOffset:this.verticalOffset=null,s(this._rayEnd,this._ray.origin,this._ray.direction),this._results.init(this._ray)}intersect(t=null,r,i,s,e){this.point=r,this.filterPredicate=s,this.tolerance=i??E;const a=w(this.verticalOffset);if(t&&t.length>0){const r=e?t=>{e(t)&&this.intersectObject(t)}:t=>{this.intersectObject(t)};for(const i of t){const t=i.getSpatialQueryAccelerator?.();null!=t?(null!=a?t.forEachAlongRayWithVerticalOffset(this._ray.origin,this._ray.direction,r,a):t.forEachAlongRay(this._ray.origin,this._ray.direction,r),this.options.selectionMode&&this.options.hud&&t.forEachDegenerateObject(r)):i.objects.forAll((t=>r(t)))}}this.sortResults()}intersectObject(t){const r=t.geometries;if(!r)return;const s=t.effectiveTransformation,a=w(this.verticalOffset);for(const n of r){if(!n.visible)continue;const{material:r,id:o}=n;if(!r.visible)continue;this.transform.setAndInvalidateLazyTransforms(s,n.transformation),e(this._rayBeginTransformed,this.rayBegin,this.transform.inverse),e(this._rayEndTransformed,this.rayEnd,this.transform.inverse);const h=this.transform.transform;null!=a&&(a.objectTransform=this.transform),r.intersect(n,this.transform.transform,this,this._rayBeginTransformed,this._rayEndTransformed,((r,s,e,a,n,d)=>{if(r>=0){if(null!=this.filterPredicate&&!this.filterPredicate(this._ray.origin,this._rayEnd,r))return;const l=a?this._results.hud:this._results,c=a?a=>{const h=new L(t,o,e,d);a.set(O.HUD,h,r,s,i,n)}:i=>i.set(O.OBJECT,{object:t,geometryId:o,triangleNr:e},r,s,h,n);if((null==l.min.drapedLayerOrder||n>=l.min.drapedLayerOrder)&&(null==l.min.dist||r<l.min.dist)&&c(l.min),this.options.store!==_.MIN&&(null==l.max.drapedLayerOrder||n<l.max.drapedLayerOrder)&&(null==l.max.dist||r>l.max.dist)&&c(l.max),this.options.store===_.ALL)if(a){const t=new I(this._ray);c(t),this._results.hud.all.push(t)}else{const t=new B(this._ray);c(t),this._results.all.push(t)}}}))}}sortResults(t=this._results.all){t.sort(((t,r)=>t.dist!==r.dist?(t.dist??0)-(r.dist??0):t.drapedLayerOrder!==r.drapedLayerOrder?x(t.drapedLayerOrder,r.drapedLayerOrder):x(t.drapedLayerGraphicOrder,r.drapedLayerGraphicOrder)))}}function x(t,r){return(r??-Number.MAX_VALUE)-(t??-Number.MAX_VALUE)}function T(t){return new b(t)}class A{constructor(){this.min=new B(m()),this.max=new B(m()),this.hud={min:new I(m()),max:new I(m()),all:new Array},this.ground=new B(m()),this.all=[]}init(t){this.min.init(t),this.max.init(t),this.ground.init(t),this.all.length=0,this.hud.min.init(t),this.hud.max.init(t),this.hud.all.length=0}}class B{get ray(){return this._ray}get distanceInRenderSpace(){return null!=this.dist?(a(M,this.ray.direction,this.dist),n(M)):null}getIntersectionPoint(t){return!!v(this)&&(a(M,this.ray.direction,this.dist),s(t,this.ray.origin,M),!0)}getTransformedNormal(t){return o(R,this.normal),R[3]=0,c(R,R,this.transformation),o(t,R),h(t,t)}constructor(t){this.intersector=O.OBJECT,this.normal=d(),this.transformation=r(),this._ray=m(),this.init(t)}init(t){this.dist=null,this.target=null,this.drapedLayerOrder=null,this.drapedLayerGraphicOrder=null,this.intersector=O.OBJECT,u(t,this._ray)}set(r,s,e,a,n,h,d){this.intersector=r,this.dist=e,o(this.normal,a??l),t(this.transformation,n??i),this.target=s,this.drapedLayerOrder=h,this.drapedLayerGraphicOrder=d}copy(r){u(r.ray,this._ray),this.intersector=r.intersector,this.dist=r.dist,this.target=r.target,this.drapedLayerOrder=r.drapedLayerOrder,this.drapedLayerGraphicOrder=r.drapedLayerGraphicOrder,o(this.normal,r.normal),t(this.transformation,r.transformation)}}class I extends B{constructor(){super(...arguments),this.intersector=O.HUD}}function G(t){return new B(t)}const M=d(),R=f();export{E as defaultTolerance,T as newIntersector,G as newIntersectorResult};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.31/esri/copyright.txt for details.
4
4
  */
5
- import"../../../../core/has.js";import{copy as t,multiply as e,hasIdentityRotation as i}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as s,create as r}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{o,h as a,p as n,s as h,g as m,e as c,c as l}from"../../../../chunks/vec32.js";import{fromValues as d,create as u}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{g,c as f}from"../../../../chunks/sphere.js";import{maxScale as b}from"../../support/mathUtils.js";import{Object3DState as _}from"./basicInterfaces.js";import{ContentObject as p}from"./ContentObject.js";import{ContentObjectType as v}from"./ContentObjectType.js";import{Object3DStateID as j}from"./Object3DStateID.js";import{assert as y}from"./Util.js";import{affectsGeometry as S}from"./VertexAttribute.js";import{addObject3DStateID as x,removeObject3DStateID as V}from"../materials/renderers/utils.js";class O extends p{get geometries(){return this._geometries}get transformation(){return this._transformation??s}set transformation(e){this._transformation=t(this._transformation??r(),e),this._invalidateBoundingVolume(),this._emit("transformationChanged",this)}get shaderTransformation(){return this._shaderTransformation}set shaderTransformation(e){this._shaderTransformation=e?t(this._shaderTransformation??r(),e):null,this._invalidateBoundingVolume(),this._emit("shaderTransformationChanged",this)}get effectiveTransformation(){return this.shaderTransformation??this.transformation}constructor(t={}){super(),this.type=v.Object,this._shaderTransformation=null,this._parentLayer=null,this._visible=!0,this.castShadow=t.castShadow??!0,this.usesVerticalDistanceToGround=t.usesVerticalDistanceToGround??!1,this.graphicUid=t.graphicUid,this.layerUid=t.layerUid,t.isElevationSource&&(this.lastValidElevationBB=new A),this._geometries=t.geometries?Array.from(t.geometries):new Array}dispose(){this._geometries.length=0}get parentLayer(){return this._parentLayer}set parentLayer(t){y(null==this._parentLayer||null==t,"Object3D can only be added to a single Layer"),this._parentLayer=t}addGeometry(t){t.visible=this._visible,this._geometries.push(t),this._emit("geometryAdded",{object:this,geometry:t}),this._invalidateBoundingVolume()}removeGeometry(t){const e=this._geometries.splice(t,1)[0];e&&(this._emit("geometryRemoved",{object:this,geometry:e}),this._invalidateBoundingVolume())}removeAllGeometries(){for(;this._geometries.length>0;)this.removeGeometry(0)}geometryVertexAttributeUpdated(t,e,i=!1){this._emit("attributesChanged",{object:this,geometry:t,attribute:e,sync:i}),S(e)&&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 j(_.MaskOccludee);for(const e of this._geometries)e.occludees=x(e.occludees,t);return this._emit("occlusionChanged",this),t}removeOcclude(t){for(const e of this._geometries)e.occludees=V(e.occludees,t);this._emit("occlusionChanged",this)}highlight(){const t=new j(_.Highlight);for(const e of this._geometries)e.highlights=x(e.highlights,t);return this._emit("highlightChanged",this),t}removeHighlight(t){for(const e of this._geometries)e.highlights=V(e.highlights,t);this._emit("highlightChanged",this)}getCombinedStaticTransformation(t,i){return e(i,this.transformation,t.transformation)}getCombinedShaderTransformation(t,i=r()){return e(i,this.effectiveTransformation,t.transformation)}get boundingVolumeWorldSpace(){return this._bvWorldSpace||(this._bvWorldSpace=this._bvWorldSpace||new M,this._validateBoundingVolume(this._bvWorldSpace,W.WorldSpace)),this._bvWorldSpace}get boundingVolumeObjectSpace(){return this._bvObjectSpace||(this._bvObjectSpace=this._bvObjectSpace||new M,this._validateBoundingVolume(this._bvObjectSpace,W.ObjectSpace)),this._bvObjectSpace}_validateBoundingVolume(t,e){const i=e===W.ObjectSpace;for(const s of this._geometries){const e=s.boundingInfo;e&&L(e,t,i?s.transformation:this.getCombinedShaderTransformation(s))}o(g(t.bounds),t.min,t.max,.5);for(const s of this._geometries){const e=s.boundingInfo;if(null==e)continue;const r=i?s.transformation:this.getCombinedShaderTransformation(s),o=b(r);a(U,e.center,r);const h=n(U,g(t.bounds)),m=e.radius*o;t.bounds[3]=Math.max(t.bounds[3],h+m)}}_invalidateBoundingVolume(){const t=this._bvWorldSpace?.bounds;this._bvObjectSpace=this._bvWorldSpace=void 0,this._parentLayer&&t&&this._parentLayer.notifyObjectBBChanged(this,t)}_emit(t,e){this._parentLayer&&this._parentLayer.events.emit(t,e)}get test(){}}class A{constructor(){this.min=d(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),this.max=d(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE)}isEmpty(){return this.max[0]<this.min[0]&&this.max[1]<this.min[1]&&this.max[2]<this.min[2]}}class M extends A{constructor(){super(...arguments),this.bounds=f()}}function L(t,e,s){const r=t.bbMin,o=t.bbMax;if(i(s)){const t=h(T,s[12],s[13],s[14]);m(C,r,t),m(B,o,t);for(let i=0;i<3;++i)e.min[i]=Math.min(e.min[i],C[i]),e.max[i]=Math.max(e.max[i],B[i])}else if(a(C,r,s),c(r,o))for(let i=0;i<3;++i)e.min[i]=Math.min(e.min[i],C[i]),e.max[i]=Math.max(e.max[i],C[i]);else{a(B,o,s);for(let t=0;t<3;++t)e.min[t]=Math.min(e.min[t],C[t],B[t]),e.max[t]=Math.max(e.max[t],C[t],B[t]);for(let t=0;t<3;++t){l(C,r),l(B,o),C[t]=o[t],B[t]=r[t],a(C,C,s),a(B,B,s);for(let t=0;t<3;++t)e.min[t]=Math.min(e.min[t],C[t],B[t]),e.max[t]=Math.max(e.max[t],C[t],B[t])}}}const T=u(),C=u(),B=u(),U=u();var W;!function(t){t[t.WorldSpace=0]="WorldSpace",t[t.ObjectSpace=1]="ObjectSpace"}(W||(W={}));export{O as Object3D};
5
+ import"../../../../core/has.js";import{copy as t,multiply as e,hasIdentityRotation as i}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as s,create as r}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{o,h as a,p as n,a as h,g as m,e as c,c as l}from"../../../../chunks/vec32.js";import{fromValues as d,create as u}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{g,c as f}from"../../../../chunks/sphere.js";import{maxScale as b}from"../../support/mathUtils.js";import{Object3DState as _}from"./basicInterfaces.js";import{ContentObject as p}from"./ContentObject.js";import{ContentObjectType as v}from"./ContentObjectType.js";import{Object3DStateID as j}from"./Object3DStateID.js";import{assert as y}from"./Util.js";import{affectsGeometry as S}from"./VertexAttribute.js";import{addObject3DStateID as x,removeObject3DStateID as V}from"../materials/renderers/utils.js";class O extends p{get geometries(){return this._geometries}get transformation(){return this._transformation??s}set transformation(e){this._transformation=t(this._transformation??r(),e),this._invalidateBoundingVolume(),this._emit("transformationChanged",this)}get shaderTransformation(){return this._shaderTransformation}set shaderTransformation(e){this._shaderTransformation=e?t(this._shaderTransformation??r(),e):null,this._invalidateBoundingVolume(),this._emit("shaderTransformationChanged",this)}get effectiveTransformation(){return this.shaderTransformation??this.transformation}constructor(t={}){super(),this.type=v.Object,this._shaderTransformation=null,this._parentLayer=null,this._visible=!0,this.castShadow=t.castShadow??!0,this.usesVerticalDistanceToGround=t.usesVerticalDistanceToGround??!1,this.graphicUid=t.graphicUid,this.layerUid=t.layerUid,t.isElevationSource&&(this.lastValidElevationBB=new A),this._geometries=t.geometries?Array.from(t.geometries):new Array}dispose(){this._geometries.length=0}get parentLayer(){return this._parentLayer}set parentLayer(t){y(null==this._parentLayer||null==t,"Object3D can only be added to a single Layer"),this._parentLayer=t}addGeometry(t){t.visible=this._visible,this._geometries.push(t),this._emit("geometryAdded",{object:this,geometry:t}),this._invalidateBoundingVolume()}removeGeometry(t){const e=this._geometries.splice(t,1)[0];e&&(this._emit("geometryRemoved",{object:this,geometry:e}),this._invalidateBoundingVolume())}removeAllGeometries(){for(;this._geometries.length>0;)this.removeGeometry(0)}geometryVertexAttributeUpdated(t,e,i=!1){this._emit("attributesChanged",{object:this,geometry:t,attribute:e,sync:i}),S(e)&&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 j(_.MaskOccludee);for(const e of this._geometries)e.occludees=x(e.occludees,t);return this._emit("occlusionChanged",this),t}removeOcclude(t){for(const e of this._geometries)e.occludees=V(e.occludees,t);this._emit("occlusionChanged",this)}highlight(){const t=new j(_.Highlight);for(const e of this._geometries)e.highlights=x(e.highlights,t);return this._emit("highlightChanged",this),t}removeHighlight(t){for(const e of this._geometries)e.highlights=V(e.highlights,t);this._emit("highlightChanged",this)}getCombinedStaticTransformation(t,i){return e(i,this.transformation,t.transformation)}getCombinedShaderTransformation(t,i=r()){return e(i,this.effectiveTransformation,t.transformation)}get boundingVolumeWorldSpace(){return this._bvWorldSpace||(this._bvWorldSpace=this._bvWorldSpace||new M,this._validateBoundingVolume(this._bvWorldSpace,W.WorldSpace)),this._bvWorldSpace}get boundingVolumeObjectSpace(){return this._bvObjectSpace||(this._bvObjectSpace=this._bvObjectSpace||new M,this._validateBoundingVolume(this._bvObjectSpace,W.ObjectSpace)),this._bvObjectSpace}_validateBoundingVolume(t,e){const i=e===W.ObjectSpace;for(const s of this._geometries){const e=s.boundingInfo;e&&L(e,t,i?s.transformation:this.getCombinedShaderTransformation(s))}o(g(t.bounds),t.min,t.max,.5);for(const s of this._geometries){const e=s.boundingInfo;if(null==e)continue;const r=i?s.transformation:this.getCombinedShaderTransformation(s),o=b(r);a(U,e.center,r);const h=n(U,g(t.bounds)),m=e.radius*o;t.bounds[3]=Math.max(t.bounds[3],h+m)}}_invalidateBoundingVolume(){const t=this._bvWorldSpace?.bounds;this._bvObjectSpace=this._bvWorldSpace=void 0,this._parentLayer&&t&&this._parentLayer.notifyObjectBBChanged(this,t)}_emit(t,e){this._parentLayer&&this._parentLayer.events.emit(t,e)}get test(){}}class A{constructor(){this.min=d(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),this.max=d(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE)}isEmpty(){return this.max[0]<this.min[0]&&this.max[1]<this.min[1]&&this.max[2]<this.min[2]}}class M extends A{constructor(){super(...arguments),this.bounds=f()}}function L(t,e,s){const r=t.bbMin,o=t.bbMax;if(i(s)){const t=h(T,s[12],s[13],s[14]);m(C,r,t),m(B,o,t);for(let i=0;i<3;++i)e.min[i]=Math.min(e.min[i],C[i]),e.max[i]=Math.max(e.max[i],B[i])}else if(a(C,r,s),c(r,o))for(let i=0;i<3;++i)e.min[i]=Math.min(e.min[i],C[i]),e.max[i]=Math.max(e.max[i],C[i]);else{a(B,o,s);for(let t=0;t<3;++t)e.min[t]=Math.min(e.min[t],C[t],B[t]),e.max[t]=Math.max(e.max[t],C[t],B[t]);for(let t=0;t<3;++t){l(C,r),l(B,o),C[t]=o[t],B[t]=r[t],a(C,C,s),a(B,B,s);for(let t=0;t<3;++t)e.min[t]=Math.min(e.min[t],C[t],B[t]),e.max[t]=Math.max(e.max[t],C[t],B[t])}}}const T=u(),C=u(),B=u(),U=u();var W;!function(t){t[t.WorldSpace=0]="WorldSpace",t[t.ObjectSpace=1]="ObjectSpace"}(W||(W={}));export{O 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/4.31/esri/copyright.txt for details.
4
4
  */
5
- import t from"../../../../core/ObjectPool.js";import e from"../../../../core/PooledArray.js";import{c as n,o,j as i,g as r,a as s}from"../../../../chunks/vec32.js";import{create as h,fromValues as a}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{intersectsSphere as l}from"../../../../geometry/support/frustum.js";import{wrap as d}from"../../../../geometry/support/ray.js";import{d as u,h as c,k as f,g as m,c as _}from"../../../../chunks/sphere.js";import{rayBoxTest as p}from"./Util.js";class b{get bounds(){return this._root.bounds}get halfSize(){return this._root.halfSize}get root(){return this._root.node}get maximumObjectsPerNode(){return this._maximumObjectsPerNode}get maximumDepth(){return this._maximumDepth}get objectCount(){return this._objectCount}constructor(t,e){this.objectToBoundingSphere=t,this._maximumObjectsPerNode=10,this._maximumDepth=20,this._degenerateObjects=new Set,this._root=new g,this._objectCount=0,e&&(void 0!==e.maximumObjectsPerNode&&(this._maximumObjectsPerNode=e.maximumObjectsPerNode),void 0!==e.maximumDepth&&(this._maximumDepth=e.maximumDepth))}destroy(){this._degenerateObjects.clear(),g.clearPool(),k[0]=null,K.prune(),Q.prune()}add(t,e=t.length){this._objectCount+=e,this._grow(t,e);const n=g.acquire();for(let o=0;o<e;o++){const e=t[o];this._isDegenerate(e)?this._degenerateObjects.add(e):(n.init(this._root),this._add(e,n))}g.release(n)}remove(t,e=null){this._objectCount-=t.length;const n=g.acquire();for(const o of t){const t=e??u(this.objectToBoundingSphere(o),J);C(t[3])?(n.init(this._root),O(o,t,n)):this._degenerateObjects.delete(o)}g.release(n),this._shrink()}update(t,e){if(!C(e[3])&&this._isDegenerate(t))return;const n=q(t);this.remove(n,e),this.add(n)}forEachAlongRay(t,e,n){const o=d(t,e);S(this._root,(t=>{if(!T(o,t))return!1;const e=t.node;return e.terminals.forAll((t=>{this._intersectsObject(o,t)&&n(t)})),null!==e.residents&&e.residents.forAll((t=>{this._intersectsObject(o,t)&&n(t)})),!0}))}forEachAlongRayWithVerticalOffset(t,e,n,o){const i=d(t,e);S(this._root,(t=>{if(!z(i,t,o))return!1;const e=t.node;return e.terminals.forAll((t=>{this._intersectsObjectWithOffset(i,t,o)&&n(t)})),null!==e.residents&&e.residents.forAll((t=>{this._intersectsObjectWithOffset(i,t,o)&&n(t)})),!0}))}forEach(t){S(this._root,(e=>{const n=e.node;return n.terminals.forAll(t),null!==n.residents&&n.residents.forAll(t),!0})),this._degenerateObjects.forEach(t)}forEachDegenerateObject(t){this._degenerateObjects.forEach(t)}findClosest(t,e,n,o=()=>!0,s=1/0){let h=1/0,a=1/0,d=null;const u=F(t,e),c=i=>{if(--s,!o(i))return;const r=this.objectToBoundingSphere(i);if(!l(n,r))return;const u=v(t,e,m(r)),c=u-r[3],f=u+r[3];c<h&&(h=c,a=f,d=i)};return j(this._root,(o=>{if(s<=0||!l(n,o.bounds))return!1;i(I,u,o.halfSize),r(I,I,m(o.bounds));if(v(t,e,I)>a)return!1;const h=o.node;return h.terminals.forAll((t=>c(t))),null!==h.residents&&h.residents.forAll((t=>c(t))),!0}),t,e),d}forEachInDepthRange(t,e,n,o,s,h,a){let d=-1/0,u=1/0;const c={setRange:t=>{n===b.DepthOrder.FRONT_TO_BACK?(d=Math.max(d,t.near),u=Math.min(u,t.far)):(d=Math.max(d,-t.far),u=Math.min(u,-t.near))}};c.setRange(o);const f=v(e,n,t),_=F(e,n),p=F(e,-n),g=t=>{if(!a(t))return;const o=this.objectToBoundingSphere(t),i=m(o),r=v(e,n,i)-f,_=r-o[3],p=r+o[3];_>u||p<d||!l(h,o)||s(t,c)};j(this._root,(t=>{if(!l(h,t.bounds))return!1;i(I,_,t.halfSize),r(I,I,m(t.bounds));if(v(e,n,I)-f>u)return!1;i(I,p,t.halfSize),r(I,I,m(t.bounds));if(v(e,n,I)-f<d)return!1;const o=t.node;return o.terminals.forAll((t=>g(t))),null!==o.residents&&o.residents.forAll((t=>g(t))),!0}),e,n)}forEachNode(t){S(this._root,(e=>t(e.node,e.bounds,e.halfSize,e.depth)))}forEachNeighbor(t,e){const n=c(e),o=m(e),i=e=>{const i=this.objectToBoundingSphere(e),r=c(i),h=n+r;return!(s(m(i),o)-h*h<=0)||t(e)};let r=!0;const h=t=>{r&&(r=i(t))};S(this._root,(t=>{const e=c(t.bounds),i=n+e;if(s(m(t.bounds),o)-i*i>0)return!1;const a=t.node;return a.terminals.forAll(h),r&&null!==a.residents&&a.residents.forAll(h),r})),r&&this.forEachDegenerateObject(h)}_intersectsObject(t,e){const n=this.objectToBoundingSphere(e);return!(n[3]>0)||f(n,t)}_intersectsObjectWithOffset(t,e,n){const o=this.objectToBoundingSphere(e);return!(o[3]>0)||f(n.applyToBoundingSphere(o),t)}_add(t,e){e.advanceTo(this.objectToBoundingSphere(t))?e.node.terminals.push(t):(e.node.residents.push(t),e.node.residents.length>this._maximumObjectsPerNode&&e.depth<this._maximumDepth&&this._split(e))}_split(t){const e=t.node.residents;t.node.residents=null;for(let n=0;n<e.length;n++){const o=g.acquire().init(t);this._add(e.at(n),o),g.release(o)}}_grow(t,e){if(0!==e&&(D(t,e,(t=>this.objectToBoundingSphere(t)),W),C(W[3])&&!this._fitsInsideTree(W)))if(N(this._root.node))u(W,this._root.bounds),this._root.halfSize=1.25*this._root.bounds[3],this._root.updateBoundsRadiusFromHalfSize();else{const t=this._rootBoundsForRootAsSubNode(W);this._placingRootViolatesMaxDepth(t)?this._rebuildTree(W,t):this._growRootAsSubNode(t),g.release(t)}}_rebuildTree(t,e){n(m(V),m(e.bounds)),V[3]=e.halfSize,D([t,V],2,(t=>t),G);const o=g.acquire().init(this._root);this._root.initFrom(null,G,G[3]),this._root.increaseHalfSize(1.25),S(o,(t=>(this.add(t.node.terminals.data,t.node.terminals.length),null!==t.node.residents&&this.add(t.node.residents.data,t.node.residents.length),!0))),g.release(o)}_placingRootViolatesMaxDepth(t){const e=Math.log(t.halfSize/this._root.halfSize)*Math.LOG2E;let n=0;return S(this._root,(t=>(n=Math.max(n,t.depth),n+e<=this._maximumDepth))),n+e>this._maximumDepth}_rootBoundsForRootAsSubNode(t){const e=t[3],n=t;let o=-1/0;const i=this._root.bounds,r=this._root.halfSize;for(let h=0;h<3;h++){const t=i[h]-r-(n[h]-e),s=n[h]+e-(i[h]+r),a=Math.max(0,Math.ceil(t/(2*r))),l=Math.max(0,Math.ceil(s/(2*r)))+1,d=2**Math.ceil(Math.log(a+l)*Math.LOG2E);o=Math.max(o,d),U[h].min=a,U[h].max=l}for(let h=0;h<3;h++){let t=U[h].min,e=U[h].max;const n=(o-(t+e))/2;t+=Math.ceil(n),e+=Math.floor(n);const s=i[h]-r-t*r*2;y[h]=s+(e+t)*r}const s=o*r;return y[3]=s*w,g.acquire().initFrom(null,y,s,0)}_growRootAsSubNode(t){const e=this._root.node;n(m(W),m(this._root.bounds)),W[3]=this._root.halfSize,this._root.init(t),t.advanceTo(W,null,!0),t.node.children=e.children,t.node.residents=e.residents,t.node.terminals=e.terminals}_shrink(){for(;;){const t=this._findShrinkIndex();if(-1===t)break;this._root.advance(t),this._root.depth=0}}_findShrinkIndex(){if(0!==this._root.node.terminals.length||this._root.isLeaf())return-1;let t=null;const e=this._root.node.children;let n=0,o=0;for(;o<e.length&&null==t;)n=o++,t=e[n];for(;o<e.length;)if(e[o++])return-1;return n}_isDegenerate(t){return!C(this.objectToBoundingSphere(t)[3])}_fitsInsideTree(t){const e=this._root.bounds,n=this._root.halfSize;return t[3]<=n&&t[0]>=e[0]-n&&t[0]<=e[0]+n&&t[1]>=e[1]-n&&t[1]<=e[1]+n&&t[2]>=e[2]-n&&t[2]<=e[2]+n}toJSON(){const{maximumDepth:t,maximumObjectsPerNode:e,_objectCount:n}=this,o=this._nodeToJSON(this._root.node);return{maximumDepth:t,maximumObjectsPerNode:e,objectCount:n,root:{bounds:this._root.bounds,halfSize:this._root.halfSize,depth:this._root.depth,node:o}}}_nodeToJSON(t){const e=t.children.map((t=>t?this._nodeToJSON(t):null)),n=t.residents?.map((t=>this.objectToBoundingSphere(t))),o=t.terminals?.map((t=>this.objectToBoundingSphere(t)));return{children:e,residents:n,terminals:o}}static fromJSON(t){const e=new b((t=>t),{maximumDepth:t.maximumDepth,maximumObjectsPerNode:t.maximumObjectsPerNode});return e._objectCount=t.objectCount,e._root.initFrom(t.root.node,t.root.bounds,t.root.halfSize,t.root.depth),e}}class g{constructor(){this.bounds=_(),this.halfSize=0,this.initFrom(null,null,0,0)}init(t){return this.initFrom(t.node,t.bounds,t.halfSize,t.depth)}initFrom(t,e,n,o=this.depth){return this.node=null!=t?t:g.createEmptyNode(),e&&u(e,this.bounds),this.halfSize=n,this.depth=o,this}increaseHalfSize(t){this.halfSize*=t,this.updateBoundsRadiusFromHalfSize()}updateBoundsRadiusFromHalfSize(){this.bounds[3]=this.halfSize*w}advance(t){let e=this.node.children[t];e||(e=g.createEmptyNode(),this.node.children[t]=e),this.node=e,this.halfSize/=2,this.depth++;const n=E[t];return this.bounds[0]+=n[0]*this.halfSize,this.bounds[1]+=n[1]*this.halfSize,this.bounds[2]+=n[2]*this.halfSize,this.updateBoundsRadiusFromHalfSize(),this}advanceTo(t,e,n=!1){for(;;){if(this.isTerminalFor(t))return e&&e(this,-1),!0;if(this.isLeaf()){if(!n)return e&&e(this,-1),!1;this.node.residents=null}const o=this._childIndex(t);e&&e(this,o),this.advance(o)}}isLeaf(){return null!=this.node.residents}isTerminalFor(t){return t[3]>this.halfSize/2}_childIndex(t){const e=this.bounds;return(e[0]<t[0]?1:0)+(e[1]<t[1]?2:0)+(e[2]<t[2]?4:0)}static createEmptyNode(){return{children:[null,null,null,null,null,null,null,null],terminals:new e({shrink:!0}),residents:new e({shrink:!0})}}static acquire(){return g._pool.acquire()}static release(t){g._pool.release(t)}static clearPool(){g._pool.prune()}}function S(t,e){let n=g.acquire().init(t);const o=[n];for(;0!==o.length;){if(n=o.pop(),e(n)&&!n.isLeaf())for(let t=0;t<n.node.children.length;t++){n.node.children[t]&&o.push(g.acquire().init(n).advance(t))}g.release(n)}}function j(t,e,n,o=b.DepthOrder.FRONT_TO_BACK){let i=g.acquire().init(t);const r=[i];for(R(n,o,X);0!==r.length;){if(i=r.pop(),e(i)&&!i.isLeaf())for(let t=7;t>=0;--t){const e=X[t];i.node.children[e]&&r.push(g.acquire().init(i).advance(e))}g.release(i)}}function O(t,e,n){K.clear();const o=n.advanceTo(e,((t,e)=>{K.push(t.node),K.push(e)}))?n.node.terminals:n.node.residents;if(o.removeUnordered(t),0===o.length)for(let i=K.length-2;i>=0;i-=2){if(!x(K.data[i],K.data[i+1]))break}}function x(t,n){return n>=0&&(t.children[n]=null),!!N(t)&&(null===t.residents&&(t.residents=new e({shrink:!0})),!0)}function T(t,e){return B(m(e.bounds),2*-e.halfSize,L),B(m(e.bounds),2*e.halfSize,H),p(t.origin,t.direction,L,H)}function z(t,e,n){return B(m(e.bounds),2*-e.halfSize,L),B(m(e.bounds),2*e.halfSize,H),n.applyToMinMax(L,H),p(t.origin,t.direction,L,H)}function N(t){if(0!==t.terminals.length)return!1;if(null!==t.residents)return 0===t.residents.length;for(let e=0;e<t.children.length;e++)if(t.children[e])return!1;return!0}function M(t,e){t[0]=Math.min(t[0],e[0]-e[3]),t[1]=Math.min(t[1],e[1]-e[3]),t[2]=Math.min(t[2],e[2]-e[3])}function A(t,e){t[0]=Math.max(t[0],e[0]+e[3]),t[1]=Math.max(t[1],e[1]+e[3]),t[2]=Math.max(t[2],e[2]+e[3])}function B(t,e,n){n[0]=t[0]+e,n[1]=t[1]+e,n[2]=t[2]+e}function D(t,e,n,i){if(1===e){const e=n(t[0]);u(e,i)}else{L[0]=1/0,L[1]=1/0,L[2]=1/0,H[0]=-1/0,H[1]=-1/0,H[2]=-1/0;for(let o=0;o<e;o++){const e=n(t[o]);C(e[3])&&(M(L,e),A(H,e))}o(m(i),L,H,.5),i[3]=Math.max(H[0]-L[0],H[1]-L[1],H[2]-L[2])/2}}function R(t,e,n){if(!Q.length)for(let o=0;o<8;++o)Q.push({index:0,distance:0});for(let o=0;o<8;++o){const n=E[o];Q.data[o].index=o,Q.data[o].distance=v(t,e,n)}Q.sort(((t,e)=>t.distance-e.distance));for(let o=0;o<8;++o)n[o]=Q.data[o].index}function F(t,e){let n,o=1/0;for(let i=0;i<8;++i){const r=v(t,e,P[i]);r<o&&(o=r,n=P[i])}return n}function v(t,e,n){return e*(t[0]*n[0]+t[1]*n[1]+t[2]*n[2])}function C(t){return!isNaN(t)&&t!==-1/0&&t!==1/0&&t>0}g._pool=new t(g),function(t){var e;(e=t.DepthOrder||(t.DepthOrder={}))[e.FRONT_TO_BACK=1]="FRONT_TO_BACK",e[e.BACK_TO_FRONT=-1]="BACK_TO_FRONT"}(b||(b={}));const E=[a(-1,-1,-1),a(1,-1,-1),a(-1,1,-1),a(1,1,-1),a(-1,-1,1),a(1,-1,1),a(-1,1,1),a(1,1,1)],P=[a(-1,-1,-1),a(-1,-1,1),a(-1,1,-1),a(-1,1,1),a(1,-1,-1),a(1,-1,1),a(1,1,-1),a(1,1,1)],w=Math.sqrt(3),k=[null];function q(t){return k[0]=t,k}const y=_(),I=h(),L=h(),H=h(),K=new e,J=_(),W=_(),V=_(),G=_(),U=[{min:0,max:0},{min:0,max:0},{min:0,max:0}],Q=new e,X=[0,0,0,0,0,0,0,0],Y=b;export{Y as default};
5
+ import t from"../../../../core/ObjectPool.js";import e from"../../../../core/PooledArray.js";import{c as n,o,j as i,g as r,s}from"../../../../chunks/vec32.js";import{create as h,fromValues as a}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{intersectsSphere as l}from"../../../../geometry/support/frustum.js";import{wrap as d}from"../../../../geometry/support/ray.js";import{d as u,h as c,k as f,g as m,c as _}from"../../../../chunks/sphere.js";import{rayBoxTest as p}from"./Util.js";class b{get bounds(){return this._root.bounds}get halfSize(){return this._root.halfSize}get root(){return this._root.node}get maximumObjectsPerNode(){return this._maximumObjectsPerNode}get maximumDepth(){return this._maximumDepth}get objectCount(){return this._objectCount}constructor(t,e){this.objectToBoundingSphere=t,this._maximumObjectsPerNode=10,this._maximumDepth=20,this._degenerateObjects=new Set,this._root=new g,this._objectCount=0,e&&(void 0!==e.maximumObjectsPerNode&&(this._maximumObjectsPerNode=e.maximumObjectsPerNode),void 0!==e.maximumDepth&&(this._maximumDepth=e.maximumDepth))}destroy(){this._degenerateObjects.clear(),g.clearPool(),k[0]=null,K.prune(),Q.prune()}add(t,e=t.length){this._objectCount+=e,this._grow(t,e);const n=g.acquire();for(let o=0;o<e;o++){const e=t[o];this._isDegenerate(e)?this._degenerateObjects.add(e):(n.init(this._root),this._add(e,n))}g.release(n)}remove(t,e=null){this._objectCount-=t.length;const n=g.acquire();for(const o of t){const t=e??u(this.objectToBoundingSphere(o),J);C(t[3])?(n.init(this._root),O(o,t,n)):this._degenerateObjects.delete(o)}g.release(n),this._shrink()}update(t,e){if(!C(e[3])&&this._isDegenerate(t))return;const n=q(t);this.remove(n,e),this.add(n)}forEachAlongRay(t,e,n){const o=d(t,e);S(this._root,(t=>{if(!T(o,t))return!1;const e=t.node;return e.terminals.forAll((t=>{this._intersectsObject(o,t)&&n(t)})),null!==e.residents&&e.residents.forAll((t=>{this._intersectsObject(o,t)&&n(t)})),!0}))}forEachAlongRayWithVerticalOffset(t,e,n,o){const i=d(t,e);S(this._root,(t=>{if(!z(i,t,o))return!1;const e=t.node;return e.terminals.forAll((t=>{this._intersectsObjectWithOffset(i,t,o)&&n(t)})),null!==e.residents&&e.residents.forAll((t=>{this._intersectsObjectWithOffset(i,t,o)&&n(t)})),!0}))}forEach(t){S(this._root,(e=>{const n=e.node;return n.terminals.forAll(t),null!==n.residents&&n.residents.forAll(t),!0})),this._degenerateObjects.forEach(t)}forEachDegenerateObject(t){this._degenerateObjects.forEach(t)}findClosest(t,e,n,o=()=>!0,s=1/0){let h=1/0,a=1/0,d=null;const u=F(t,e),c=i=>{if(--s,!o(i))return;const r=this.objectToBoundingSphere(i);if(!l(n,r))return;const u=v(t,e,m(r)),c=u-r[3],f=u+r[3];c<h&&(h=c,a=f,d=i)};return j(this._root,(o=>{if(s<=0||!l(n,o.bounds))return!1;i(I,u,o.halfSize),r(I,I,m(o.bounds));if(v(t,e,I)>a)return!1;const h=o.node;return h.terminals.forAll((t=>c(t))),null!==h.residents&&h.residents.forAll((t=>c(t))),!0}),t,e),d}forEachInDepthRange(t,e,n,o,s,h,a){let d=-1/0,u=1/0;const c={setRange:t=>{n===b.DepthOrder.FRONT_TO_BACK?(d=Math.max(d,t.near),u=Math.min(u,t.far)):(d=Math.max(d,-t.far),u=Math.min(u,-t.near))}};c.setRange(o);const f=v(e,n,t),_=F(e,n),p=F(e,-n),g=t=>{if(!a(t))return;const o=this.objectToBoundingSphere(t),i=m(o),r=v(e,n,i)-f,_=r-o[3],p=r+o[3];_>u||p<d||!l(h,o)||s(t,c)};j(this._root,(t=>{if(!l(h,t.bounds))return!1;i(I,_,t.halfSize),r(I,I,m(t.bounds));if(v(e,n,I)-f>u)return!1;i(I,p,t.halfSize),r(I,I,m(t.bounds));if(v(e,n,I)-f<d)return!1;const o=t.node;return o.terminals.forAll((t=>g(t))),null!==o.residents&&o.residents.forAll((t=>g(t))),!0}),e,n)}forEachNode(t){S(this._root,(e=>t(e.node,e.bounds,e.halfSize,e.depth)))}forEachNeighbor(t,e){const n=c(e),o=m(e),i=e=>{const i=this.objectToBoundingSphere(e),r=c(i),h=n+r;return!(s(m(i),o)-h*h<=0)||t(e)};let r=!0;const h=t=>{r&&(r=i(t))};S(this._root,(t=>{const e=c(t.bounds),i=n+e;if(s(m(t.bounds),o)-i*i>0)return!1;const a=t.node;return a.terminals.forAll(h),r&&null!==a.residents&&a.residents.forAll(h),r})),r&&this.forEachDegenerateObject(h)}_intersectsObject(t,e){const n=this.objectToBoundingSphere(e);return!(n[3]>0)||f(n,t)}_intersectsObjectWithOffset(t,e,n){const o=this.objectToBoundingSphere(e);return!(o[3]>0)||f(n.applyToBoundingSphere(o),t)}_add(t,e){e.advanceTo(this.objectToBoundingSphere(t))?e.node.terminals.push(t):(e.node.residents.push(t),e.node.residents.length>this._maximumObjectsPerNode&&e.depth<this._maximumDepth&&this._split(e))}_split(t){const e=t.node.residents;t.node.residents=null;for(let n=0;n<e.length;n++){const o=g.acquire().init(t);this._add(e.at(n),o),g.release(o)}}_grow(t,e){if(0!==e&&(D(t,e,(t=>this.objectToBoundingSphere(t)),W),C(W[3])&&!this._fitsInsideTree(W)))if(N(this._root.node))u(W,this._root.bounds),this._root.halfSize=1.25*this._root.bounds[3],this._root.updateBoundsRadiusFromHalfSize();else{const t=this._rootBoundsForRootAsSubNode(W);this._placingRootViolatesMaxDepth(t)?this._rebuildTree(W,t):this._growRootAsSubNode(t),g.release(t)}}_rebuildTree(t,e){n(m(V),m(e.bounds)),V[3]=e.halfSize,D([t,V],2,(t=>t),G);const o=g.acquire().init(this._root);this._root.initFrom(null,G,G[3]),this._root.increaseHalfSize(1.25),S(o,(t=>(this.add(t.node.terminals.data,t.node.terminals.length),null!==t.node.residents&&this.add(t.node.residents.data,t.node.residents.length),!0))),g.release(o)}_placingRootViolatesMaxDepth(t){const e=Math.log(t.halfSize/this._root.halfSize)*Math.LOG2E;let n=0;return S(this._root,(t=>(n=Math.max(n,t.depth),n+e<=this._maximumDepth))),n+e>this._maximumDepth}_rootBoundsForRootAsSubNode(t){const e=t[3],n=t;let o=-1/0;const i=this._root.bounds,r=this._root.halfSize;for(let h=0;h<3;h++){const t=i[h]-r-(n[h]-e),s=n[h]+e-(i[h]+r),a=Math.max(0,Math.ceil(t/(2*r))),l=Math.max(0,Math.ceil(s/(2*r)))+1,d=2**Math.ceil(Math.log(a+l)*Math.LOG2E);o=Math.max(o,d),U[h].min=a,U[h].max=l}for(let h=0;h<3;h++){let t=U[h].min,e=U[h].max;const n=(o-(t+e))/2;t+=Math.ceil(n),e+=Math.floor(n);const s=i[h]-r-t*r*2;y[h]=s+(e+t)*r}const s=o*r;return y[3]=s*w,g.acquire().initFrom(null,y,s,0)}_growRootAsSubNode(t){const e=this._root.node;n(m(W),m(this._root.bounds)),W[3]=this._root.halfSize,this._root.init(t),t.advanceTo(W,null,!0),t.node.children=e.children,t.node.residents=e.residents,t.node.terminals=e.terminals}_shrink(){for(;;){const t=this._findShrinkIndex();if(-1===t)break;this._root.advance(t),this._root.depth=0}}_findShrinkIndex(){if(0!==this._root.node.terminals.length||this._root.isLeaf())return-1;let t=null;const e=this._root.node.children;let n=0,o=0;for(;o<e.length&&null==t;)n=o++,t=e[n];for(;o<e.length;)if(e[o++])return-1;return n}_isDegenerate(t){return!C(this.objectToBoundingSphere(t)[3])}_fitsInsideTree(t){const e=this._root.bounds,n=this._root.halfSize;return t[3]<=n&&t[0]>=e[0]-n&&t[0]<=e[0]+n&&t[1]>=e[1]-n&&t[1]<=e[1]+n&&t[2]>=e[2]-n&&t[2]<=e[2]+n}toJSON(){const{maximumDepth:t,maximumObjectsPerNode:e,_objectCount:n}=this,o=this._nodeToJSON(this._root.node);return{maximumDepth:t,maximumObjectsPerNode:e,objectCount:n,root:{bounds:this._root.bounds,halfSize:this._root.halfSize,depth:this._root.depth,node:o}}}_nodeToJSON(t){const e=t.children.map((t=>t?this._nodeToJSON(t):null)),n=t.residents?.map((t=>this.objectToBoundingSphere(t))),o=t.terminals?.map((t=>this.objectToBoundingSphere(t)));return{children:e,residents:n,terminals:o}}static fromJSON(t){const e=new b((t=>t),{maximumDepth:t.maximumDepth,maximumObjectsPerNode:t.maximumObjectsPerNode});return e._objectCount=t.objectCount,e._root.initFrom(t.root.node,t.root.bounds,t.root.halfSize,t.root.depth),e}}class g{constructor(){this.bounds=_(),this.halfSize=0,this.initFrom(null,null,0,0)}init(t){return this.initFrom(t.node,t.bounds,t.halfSize,t.depth)}initFrom(t,e,n,o=this.depth){return this.node=null!=t?t:g.createEmptyNode(),e&&u(e,this.bounds),this.halfSize=n,this.depth=o,this}increaseHalfSize(t){this.halfSize*=t,this.updateBoundsRadiusFromHalfSize()}updateBoundsRadiusFromHalfSize(){this.bounds[3]=this.halfSize*w}advance(t){let e=this.node.children[t];e||(e=g.createEmptyNode(),this.node.children[t]=e),this.node=e,this.halfSize/=2,this.depth++;const n=E[t];return this.bounds[0]+=n[0]*this.halfSize,this.bounds[1]+=n[1]*this.halfSize,this.bounds[2]+=n[2]*this.halfSize,this.updateBoundsRadiusFromHalfSize(),this}advanceTo(t,e,n=!1){for(;;){if(this.isTerminalFor(t))return e&&e(this,-1),!0;if(this.isLeaf()){if(!n)return e&&e(this,-1),!1;this.node.residents=null}const o=this._childIndex(t);e&&e(this,o),this.advance(o)}}isLeaf(){return null!=this.node.residents}isTerminalFor(t){return t[3]>this.halfSize/2}_childIndex(t){const e=this.bounds;return(e[0]<t[0]?1:0)+(e[1]<t[1]?2:0)+(e[2]<t[2]?4:0)}static createEmptyNode(){return{children:[null,null,null,null,null,null,null,null],terminals:new e({shrink:!0}),residents:new e({shrink:!0})}}static acquire(){return g._pool.acquire()}static release(t){g._pool.release(t)}static clearPool(){g._pool.prune()}}function S(t,e){let n=g.acquire().init(t);const o=[n];for(;0!==o.length;){if(n=o.pop(),e(n)&&!n.isLeaf())for(let t=0;t<n.node.children.length;t++){n.node.children[t]&&o.push(g.acquire().init(n).advance(t))}g.release(n)}}function j(t,e,n,o=b.DepthOrder.FRONT_TO_BACK){let i=g.acquire().init(t);const r=[i];for(R(n,o,X);0!==r.length;){if(i=r.pop(),e(i)&&!i.isLeaf())for(let t=7;t>=0;--t){const e=X[t];i.node.children[e]&&r.push(g.acquire().init(i).advance(e))}g.release(i)}}function O(t,e,n){K.clear();const o=n.advanceTo(e,((t,e)=>{K.push(t.node),K.push(e)}))?n.node.terminals:n.node.residents;if(o.removeUnordered(t),0===o.length)for(let i=K.length-2;i>=0;i-=2){if(!x(K.data[i],K.data[i+1]))break}}function x(t,n){return n>=0&&(t.children[n]=null),!!N(t)&&(null===t.residents&&(t.residents=new e({shrink:!0})),!0)}function T(t,e){return B(m(e.bounds),2*-e.halfSize,L),B(m(e.bounds),2*e.halfSize,H),p(t.origin,t.direction,L,H)}function z(t,e,n){return B(m(e.bounds),2*-e.halfSize,L),B(m(e.bounds),2*e.halfSize,H),n.applyToMinMax(L,H),p(t.origin,t.direction,L,H)}function N(t){if(0!==t.terminals.length)return!1;if(null!==t.residents)return 0===t.residents.length;for(let e=0;e<t.children.length;e++)if(t.children[e])return!1;return!0}function M(t,e){t[0]=Math.min(t[0],e[0]-e[3]),t[1]=Math.min(t[1],e[1]-e[3]),t[2]=Math.min(t[2],e[2]-e[3])}function A(t,e){t[0]=Math.max(t[0],e[0]+e[3]),t[1]=Math.max(t[1],e[1]+e[3]),t[2]=Math.max(t[2],e[2]+e[3])}function B(t,e,n){n[0]=t[0]+e,n[1]=t[1]+e,n[2]=t[2]+e}function D(t,e,n,i){if(1===e){const e=n(t[0]);u(e,i)}else{L[0]=1/0,L[1]=1/0,L[2]=1/0,H[0]=-1/0,H[1]=-1/0,H[2]=-1/0;for(let o=0;o<e;o++){const e=n(t[o]);C(e[3])&&(M(L,e),A(H,e))}o(m(i),L,H,.5),i[3]=Math.max(H[0]-L[0],H[1]-L[1],H[2]-L[2])/2}}function R(t,e,n){if(!Q.length)for(let o=0;o<8;++o)Q.push({index:0,distance:0});for(let o=0;o<8;++o){const n=E[o];Q.data[o].index=o,Q.data[o].distance=v(t,e,n)}Q.sort(((t,e)=>t.distance-e.distance));for(let o=0;o<8;++o)n[o]=Q.data[o].index}function F(t,e){let n,o=1/0;for(let i=0;i<8;++i){const r=v(t,e,P[i]);r<o&&(o=r,n=P[i])}return n}function v(t,e,n){return e*(t[0]*n[0]+t[1]*n[1]+t[2]*n[2])}function C(t){return!isNaN(t)&&t!==-1/0&&t!==1/0&&t>0}g._pool=new t(g),function(t){var e;(e=t.DepthOrder||(t.DepthOrder={}))[e.FRONT_TO_BACK=1]="FRONT_TO_BACK",e[e.BACK_TO_FRONT=-1]="BACK_TO_FRONT"}(b||(b={}));const E=[a(-1,-1,-1),a(1,-1,-1),a(-1,1,-1),a(1,1,-1),a(-1,-1,1),a(1,-1,1),a(-1,1,1),a(1,1,1)],P=[a(-1,-1,-1),a(-1,-1,1),a(-1,1,-1),a(-1,1,1),a(1,-1,-1),a(1,-1,1),a(1,1,-1),a(1,1,1)],w=Math.sqrt(3),k=[null];function q(t){return k[0]=t,k}const y=_(),I=h(),L=h(),H=h(),K=new e,J=_(),W=_(),V=_(),G=_(),U=[{min:0,max:0},{min:0,max:0},{min:0,max:0}],Q=new e,X=[0,0,0,0,0,0,0,0],Y=b;export{Y as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.31/esri/copyright.txt for details.
4
4
  */
5
- import{ShaderOutput as r}from"../core/shaderLibrary/ShaderOutput.js";import{TransparencyPassType as n}from"./TransparencyPassType.js";import{BlendFactor as t,CompareFunction as e,ColorAttachment as o}from"../../../webgl/enums.js";import{separateBlendingParams as u,defaultDepthWriteParams as A}from"../../../webgl/renderState.js";const O=u(t.SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA),T=u(t.ONE,t.ZERO,t.ONE,t.ONE_MINUS_SRC_ALPHA);function s(r){return r===n.FrontFace?null:T}function C(r){switch(r){case n.NONE:return O;case n.ColorAlpha:return T;case n.FrontFace:case n.COUNT:return null}}function c(r){return r===n.FrontFace?A:null}const N=5e5,E={factor:-1,units:-2};function a(r){return r?E:null}function f(r,t=e.LESS){return r===n.NONE||r===n.FrontFace?t:e.LEQUAL}function l(t,e){const u=e===r.ColorEmission;return t===n.ColorAlpha?u?{buffers:[o.COLOR_ATTACHMENT0,o.COLOR_ATTACHMENT1,o.COLOR_ATTACHMENT2]}:{buffers:[o.COLOR_ATTACHMENT0,o.COLOR_ATTACHMENT1]}:u?{buffers:[o.COLOR_ATTACHMENT0,o.COLOR_ATTACHMENT1]}:null}export{E as OITPolygonOffset,N as OITPolygonOffsetLimit,C as blending,T as blendingColorAlpha,O as blendingDefault,l as getDrawBuffers,a as getOITPolygonOffset,s as oitBlending,f as oitDepthTest,c as oitDepthWrite};
5
+ import{isColorEmission as r}from"../core/shaderLibrary/ShaderOutput.js";import{TransparencyPassType as n}from"./TransparencyPassType.js";import{BlendFactor as t,CompareFunction as e,ColorAttachment as o}from"../../../webgl/enums.js";import{separateBlendingParams as u,defaultDepthWriteParams as A}from"../../../webgl/renderState.js";const O=u(t.SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA),T=u(t.ONE,t.ZERO,t.ONE,t.ONE_MINUS_SRC_ALPHA);function c(r){return r===n.FrontFace?null:T}function s(r){switch(r){case n.NONE:return O;case n.ColorAlpha:return T;case n.FrontFace:case n.COUNT:return null}}function C(r){return r===n.FrontFace?A:null}const N=5e5,a={factor:-1,units:-2};function E(r){return r?a:null}function f(r,t=e.LESS){return r===n.NONE||r===n.FrontFace?t:e.LEQUAL}function _(t,e){const u=r(e);return t===n.ColorAlpha?u?{buffers:[o.COLOR_ATTACHMENT0,o.COLOR_ATTACHMENT1,o.COLOR_ATTACHMENT2]}:{buffers:[o.COLOR_ATTACHMENT0,o.COLOR_ATTACHMENT1]}:u?{buffers:[o.COLOR_ATTACHMENT0,o.COLOR_ATTACHMENT1]}:null}export{a as OITPolygonOffset,N as OITPolygonOffsetLimit,s as blending,T as blendingColorAlpha,O as blendingDefault,_ as getDrawBuffers,E as getOITPolygonOffset,c as oitBlending,f as oitDepthTest,C as oitDepthWrite};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.31/esri/copyright.txt for details.
4
4
  */
5
- import{estimateSize as t}from"../../../../core/typedArrayUtil.js";import{l as i,n as s,c as o}from"../../../../chunks/vec32.js";import{fromValues as e}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{newFloatArray as h}from"../../../../geometry/support/FloatArray.js";class r{constructor(t,i,s,o){this.vertices=t,this.positionsES=i,this.offset=o;const r=t.length,n=Math.floor(r/2),g=this.offset+3*n,v=s[g],f=s[g+1],c=s[g+2];this.origin=e(v,f,c),this.positions=h(3*r);const l=this.offset+3*r;for(let e=this.offset;e<l;e+=3)this.positions[e]=s[e]-v,this.positions[e+1]=s[e+1]-f,this.positions[e+2]=s[e+2]-c;this.updatePathVertexInformation()}get usedMemory(){return t(this.positions)}updatePathVertexInformation(){const t=this.vertices.length,e=this.vertices[0];let h=this.offset;const r=this.positions;e.vRight[0]=r[h+3]-r[h],e.vRight[1]=r[h+4]-r[h+1],e.vRight[2]=r[h+5]-r[h+2],h+=3;let n=i(e.vRight);e.vMinSiblingLength=n,s(e.vRight,e.vRight);let g=e;for(let v=1;v<t;++v){const e=this.vertices[v];if(e.vLeft=g.vRight,v<t-1){e.vRight[0]=r[h+3]-r[h],e.vRight[1]=r[h+4]-r[h+1],e.vRight[2]=r[h+5]-r[h+2];const t=i(e.vRight);e.vMinSiblingLength=Math.min(n,t),n=t,s(e.vRight,e.vRight)}else o(e.vRight,e.vLeft),e.vMinSiblingLength=n;g=e,h+=3}}}export{r as Path};
5
+ import{estimateSize as t}from"../../../../core/typedArrayUtil.js";import{m as i,n as s,c as o}from"../../../../chunks/vec32.js";import{fromValues as e}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{newFloatArray as h}from"../../../../geometry/support/FloatArray.js";class r{constructor(t,i,s,o){this.vertices=t,this.positionsES=i,this.offset=o;const r=t.length,n=Math.floor(r/2),g=this.offset+3*n,v=s[g],f=s[g+1],c=s[g+2];this.origin=e(v,f,c),this.positions=h(3*r);const a=this.offset+3*r;for(let e=this.offset;e<a;e+=3)this.positions[e]=s[e]-v,this.positions[e+1]=s[e+1]-f,this.positions[e+2]=s[e+2]-c;this.updatePathVertexInformation()}get usedMemory(){return t(this.positions)}updatePathVertexInformation(){const t=this.vertices.length,e=this.vertices[0];let h=this.offset;const r=this.positions;e.vRight[0]=r[h+3]-r[h],e.vRight[1]=r[h+4]-r[h+1],e.vRight[2]=r[h+5]-r[h+2],h+=3;let n=i(e.vRight);e.vMinSiblingLength=n,s(e.vRight,e.vRight);let g=e;for(let v=1;v<t;++v){const e=this.vertices[v];if(e.vLeft=g.vRight,v<t-1){e.vRight[0]=r[h+3]-r[h],e.vRight[1]=r[h+4]-r[h+1],e.vRight[2]=r[h+5]-r[h+2];const t=i(e.vRight);e.vMinSiblingLength=Math.min(n,t),n=t,s(e.vRight,e.vRight)}else o(e.vRight,e.vLeft),e.vMinSiblingLength=n;g=e,h+=3}}}export{r as Path};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.31/esri/copyright.txt for details.
4
4
  */
5
- import{set as t,length as e,normalize as r,dot as i,scale as s,add as o}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{s as n,b as h}from"../../../../chunks/vec32.js";import{create as l}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as c}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{newFloatArray as u}from"../../../../geometry/support/FloatArray.js";import{getZeroIndexArray as b}from"../../../../geometry/support/Indices.js";import{Attribute as v,Vertices as m}from"./Attribute.js";import{compressNormal as p}from"./Normals.js";import{intersectTriangles as x}from"./RayIntersections.js";import{VertexAttribute as A}from"./VertexAttribute.js";class d{constructor(t){this.builder=t}onPathChanged(t){this.builder.onPathChanged()}}class f extends d{constructor(t){super(t),this.vertexAttributeColor=c(255,255,255,255),this.size=new Array,this.vertexAttributePosition=u(3*this.builder.numVerticesTotal),this.vertexAttributeNormal=new Int16Array(2*this.builder.numVerticesTotal)}bakeVertexColors(t){this.vertexAttributeColor[0]=255*t[0],this.vertexAttributeColor[1]=255*t[1],this.vertexAttributeColor[2]=255*t[2],this.vertexAttributeColor[3]=255*(t.length>3?t[3]:1)}bake(a){this.size=a;const{numVerticesTotal:l,pathVertexData:c,path:u,positions:b,profileRightAxes:v,profileUpAxes:m,profileVertexAndNormals:x}=this.builder;for(let A=0;A<l;++A){let l=c[A];const d=0===l||l===u.vertices.length-1;l*=3;const f=V;let g=0,D=0;const N=4*A,j=n(R,v[N],v[N+1],v[N+2]),E=n(w,m[N],m[N+1],m[N+2]),y=t(P,x[N]*a[0],x[N+1]*a[1]);if(d)h(f,E,j),g=v[N+3]*a[0],D=m[N+3];else{const a=I,h=C;t(a,v[N+3],m[N+3]);const l=e(a);r(a,a);const c=i(y,a);if(Math.abs(c)>l){t(h,-a[1],a[0]);const e=i(y,h);s(a,a,l*Math.sign(c)),s(h,h,e),o(y,a,h)}n(f,0,0,0)}const T=n(O,j[0]*y[0]+E[0]*y[1],j[1]*y[0]+E[1]*y[1],j[2]*y[0]+E[2]*y[1]),L=3*A;this.vertexAttributePosition[L]=b[l]+T[0]+f[0]*g,this.vertexAttributePosition[L+1]=b[l+1]+T[1]+f[1]*g,this.vertexAttributePosition[L+2]=b[l+2]+T[2]+f[2]*g;const M=t(P,x[N+2],x[N+3]);p(this.vertexAttributeNormal,A,j[0]*M[0]+E[0]*M[1]+f[0]*D,j[1]*M[0]+E[1]*M[1]+f[1]*D,j[2]*M[0]+E[2]*M[1]+f[2]*D)}}createGeometryData(){const t=this.builder.vertexIndices.length,{normalIndices:e,vertexIndices:r}=this.builder;return[[A.POSITION,new v(this.vertexAttributePosition,r,3,!0)],[A.NORMALCOMPRESSED,new v(this.vertexAttributeNormal,e,2,!0)],[A.COLOR,new v(this.vertexAttributeColor,b(t),4)]]}onPathChanged(t){super.onPathChanged(t),this.bake(this.size)}intersect(t,e,r,i){const s=this.builder.vertexIndices,o=new m(this.vertexAttributePosition,3),a=s.length/3;x(t,e,0,a,s,o,void 0,r,((t,e,r)=>i(t,r,e,!1)))}}class g extends d{constructor(t,e,r,i){super(t),this.sizeAttributeValue=e,this.colorAttributeValue=r,this.opacityAttributeValue=i,this.vvData=null,this.baked=new f(t),this.vvData=u(4*this.builder.path.vertices.length);for(let s=0;s<this.builder.path.vertices.length;++s){this.vvData[4*s]=e,this.vvData[4*s+1]=r,this.vvData[4*s+2]=i;const t=0===s||s===this.builder.path.vertices.length-1;this.vvData[4*s+3]=t?1:0}}createGeometryData(){const{positions:t,profileRightAxes:e,profileUpAxes:r,profileVertexAndNormals:i,pathVertexIndices:s,vertexIndices:o}=this.builder;return[[A.POSITION,new v(t,s,3,!0)],[A.PROFILERIGHT,new v(e,o,4,!0)],[A.PROFILEUP,new v(r,o,4,!0)],[A.PROFILEVERTEXANDNORMAL,new v(i,o,4,!0)],[A.FEATUREVALUE,new v(this.vvData,s,4,!0)]]}onPathChanged(t){super.onPathChanged(t);const e=t.getMutableAttribute(A.POSITION);e&&(e.data=this.builder.positions)}}const P=a(),I=a(),C=a(),O=l(),V=l(),R=l(),w=l();export{g as FastUpdatePathGeometry,d as PathGeometryData,f as StaticPathGeometry};
5
+ import{set as t,length as e,normalize as r,dot as i,scale as s,add as o}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{a as n,b as h}from"../../../../chunks/vec32.js";import{create as l}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as c}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{newFloatArray as u}from"../../../../geometry/support/FloatArray.js";import{getZeroIndexArray as b}from"../../../../geometry/support/Indices.js";import{Attribute as v,Vertices as m}from"./Attribute.js";import{compressNormal as p}from"./Normals.js";import{intersectTriangles as x}from"./RayIntersections.js";import{VertexAttribute as A}from"./VertexAttribute.js";class d{constructor(t){this.builder=t}onPathChanged(t){this.builder.onPathChanged()}}class f extends d{constructor(t){super(t),this.vertexAttributeColor=c(255,255,255,255),this.size=new Array,this.vertexAttributePosition=u(3*this.builder.numVerticesTotal),this.vertexAttributeNormal=new Int16Array(2*this.builder.numVerticesTotal)}bakeVertexColors(t){this.vertexAttributeColor[0]=255*t[0],this.vertexAttributeColor[1]=255*t[1],this.vertexAttributeColor[2]=255*t[2],this.vertexAttributeColor[3]=255*(t.length>3?t[3]:1)}bake(a){this.size=a;const{numVerticesTotal:l,pathVertexData:c,path:u,positions:b,profileRightAxes:v,profileUpAxes:m,profileVertexAndNormals:x}=this.builder;for(let A=0;A<l;++A){let l=c[A];const d=0===l||l===u.vertices.length-1;l*=3;const f=V;let g=0,D=0;const N=4*A,j=n(R,v[N],v[N+1],v[N+2]),E=n(w,m[N],m[N+1],m[N+2]),y=t(P,x[N]*a[0],x[N+1]*a[1]);if(d)h(f,E,j),g=v[N+3]*a[0],D=m[N+3];else{const a=I,h=C;t(a,v[N+3],m[N+3]);const l=e(a);r(a,a);const c=i(y,a);if(Math.abs(c)>l){t(h,-a[1],a[0]);const e=i(y,h);s(a,a,l*Math.sign(c)),s(h,h,e),o(y,a,h)}n(f,0,0,0)}const T=n(O,j[0]*y[0]+E[0]*y[1],j[1]*y[0]+E[1]*y[1],j[2]*y[0]+E[2]*y[1]),L=3*A;this.vertexAttributePosition[L]=b[l]+T[0]+f[0]*g,this.vertexAttributePosition[L+1]=b[l+1]+T[1]+f[1]*g,this.vertexAttributePosition[L+2]=b[l+2]+T[2]+f[2]*g;const M=t(P,x[N+2],x[N+3]);p(this.vertexAttributeNormal,A,j[0]*M[0]+E[0]*M[1]+f[0]*D,j[1]*M[0]+E[1]*M[1]+f[1]*D,j[2]*M[0]+E[2]*M[1]+f[2]*D)}}createGeometryData(){const t=this.builder.vertexIndices.length,{normalIndices:e,vertexIndices:r}=this.builder;return[[A.POSITION,new v(this.vertexAttributePosition,r,3,!0)],[A.NORMALCOMPRESSED,new v(this.vertexAttributeNormal,e,2,!0)],[A.COLOR,new v(this.vertexAttributeColor,b(t),4)]]}onPathChanged(t){super.onPathChanged(t),this.bake(this.size)}intersect(t,e,r,i){const s=this.builder.vertexIndices,o=new m(this.vertexAttributePosition,3),a=s.length/3;x(t,e,0,a,s,o,void 0,r,((t,e,r)=>i(t,r,e,!1)))}}class g extends d{constructor(t,e,r,i){super(t),this.sizeAttributeValue=e,this.colorAttributeValue=r,this.opacityAttributeValue=i,this.vvData=null,this.baked=new f(t),this.vvData=u(4*this.builder.path.vertices.length);for(let s=0;s<this.builder.path.vertices.length;++s){this.vvData[4*s]=e,this.vvData[4*s+1]=r,this.vvData[4*s+2]=i;const t=0===s||s===this.builder.path.vertices.length-1;this.vvData[4*s+3]=t?1:0}}createGeometryData(){const{positions:t,profileRightAxes:e,profileUpAxes:r,profileVertexAndNormals:i,pathVertexIndices:s,vertexIndices:o}=this.builder;return[[A.POSITION,new v(t,s,3,!0)],[A.PROFILERIGHT,new v(e,o,4,!0)],[A.PROFILEUP,new v(r,o,4,!0)],[A.PROFILEVERTEXANDNORMAL,new v(i,o,4,!0)],[A.FEATUREVALUE,new v(this.vvData,s,4,!0)]]}onPathChanged(t){super.onPathChanged(t);const e=t.getMutableAttribute(A.POSITION);e&&(e.data=this.builder.positions)}}const P=a(),I=a(),C=a(),O=l(),V=l(),R=l(),w=l();export{g as FastUpdatePathGeometry,d as PathGeometryData,f as StaticPathGeometry};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.31/esri/copyright.txt for details.
4
4
  */
5
- import{acosClamped as t,reciprocalClamped as i}from"../../../../core/mathUtils.js";import{set as r}from"../../../../core/libs/gl-matrix-2/math/mat2.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/mat2f64.js";import{set as e,transformMat2 as a}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{UNIT_X as h,create as o}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{c as n,g as m,n as g,j as f,m as c,f as u,b as l,k as p}from"../../../../chunks/vec32.js";import{create as v}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{Frame2D as M}from"./PathExtruder.js";import{UpVectorAlignment as b}from"./PathGeometry.js";class R{constructor(){this.vLeft=v(),this.vRight=v(),this.vMinSiblingLength=0,this.frame=new M}setFrameFromUpVector(t){n(this.frame.up,t),m(k,this.vLeft,this.vRight),g(k,k),f(I,this.frame.up,c(k,this.frame.up)),u(D,k,I),g(D,D),l(this.frame.right,D,this.frame.up)}get foldingAngle(){return Math.PI-this.rotationAngle}}class x extends R{get rotationFrameUp(){return this.frame.up}get rotationRight(){return h}get rotationAngle(){f(w,this.frame.up,c(this.frame.up,this.vLeft)),u(w,this.vLeft,w),p(w,w),g(w,w),f(y,this.frame.up,c(this.frame.up,this.vRight)),u(y,this.vRight,y),g(y,y),l(U,this.rotationFrameUp,this.vLeft);return Math.sign(c(U,this.vRight))*(Math.PI-t(c(w,y)))}get maxStretchDistance(){return Math.abs(this.vMinSiblingLength/Math.cos(.5*this.foldingAngle))}applyMiterStretch(t,r){const s=this.rotationAngle;if(Math.abs(s)<=0)return r;const a=i(Math.cos(.5*s));return e(t,(a-1+1)*r[0],r[1])}}class j extends R{get rotationFrameUp(){const t=Math.sign(c(this.frame.right,this.vRight));return l(d,this.vRight,this.vLeft),f(d,d,t),g(d,d)}get rotationRight(){const t=this.rotationFrameUp,i=c(t,this.frame.up),r=c(t,this.frame.right);return f(F,this.frame.up,-r),f(P,this.frame.right,i),m(F,F,P),g(F,F),L(S,this.frame,F),S}get rotationAngle(){const i=Math.sign(c(this.frame.right,this.vRight));return p(U,this.vLeft),-i*(Math.PI-t(c(U,this.vRight)))}get maxStretchDistance(){return Math.abs(this.vMinSiblingLength*i(Math.cos(.5*this.foldingAngle)))}applyMiterStretch(t,s){const e=this.rotationAngle;if(0===Math.abs(e))return s;const h=i(Math.cos(.5*e)),o=this.rotationRight,n=r(E,1+(h-1)*o[0]*o[0],(h-1)*o[0]*o[1],(h-1)*o[0]*o[1],1+(h-1)*o[1]*o[1]);return a(t,s,n)}}function L(t,i,r){e(t,c(r,i.right),c(r,i.up))}function A(t){switch(t){case b.World:return new x;case b.Path:return new j}}const d=v(),S=o(),F=v(),P=v(),U=v(),w=v(),y=v(),I=v(),k=v(),D=v(),E=s();export{R as PathVertex,A as newPathVertex};
5
+ import{acosClamped as t,reciprocalClamped as i}from"../../../../core/mathUtils.js";import{set as r}from"../../../../core/libs/gl-matrix-2/math/mat2.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/mat2f64.js";import{set as e,transformMat2 as a}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{UNIT_X as h,create as o}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{c as n,g as m,n as g,j as f,l as c,f as l,b as u,k as p}from"../../../../chunks/vec32.js";import{create as v}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{Frame2D as M}from"./PathExtruder.js";import{UpVectorAlignment as b}from"./PathGeometry.js";class R{constructor(){this.vLeft=v(),this.vRight=v(),this.vMinSiblingLength=0,this.frame=new M}setFrameFromUpVector(t){n(this.frame.up,t),m(k,this.vLeft,this.vRight),g(k,k),f(I,this.frame.up,c(k,this.frame.up)),l(D,k,I),g(D,D),u(this.frame.right,D,this.frame.up)}get foldingAngle(){return Math.PI-this.rotationAngle}}class x extends R{get rotationFrameUp(){return this.frame.up}get rotationRight(){return h}get rotationAngle(){f(w,this.frame.up,c(this.frame.up,this.vLeft)),l(w,this.vLeft,w),p(w,w),g(w,w),f(y,this.frame.up,c(this.frame.up,this.vRight)),l(y,this.vRight,y),g(y,y),u(U,this.rotationFrameUp,this.vLeft);return Math.sign(c(U,this.vRight))*(Math.PI-t(c(w,y)))}get maxStretchDistance(){return Math.abs(this.vMinSiblingLength/Math.cos(.5*this.foldingAngle))}applyMiterStretch(t,r){const s=this.rotationAngle;if(Math.abs(s)<=0)return r;const a=i(Math.cos(.5*s));return e(t,(a-1+1)*r[0],r[1])}}class j extends R{get rotationFrameUp(){const t=Math.sign(c(this.frame.right,this.vRight));return u(d,this.vRight,this.vLeft),f(d,d,t),g(d,d)}get rotationRight(){const t=this.rotationFrameUp,i=c(t,this.frame.up),r=c(t,this.frame.right);return f(F,this.frame.up,-r),f(P,this.frame.right,i),m(F,F,P),g(F,F),L(S,this.frame,F),S}get rotationAngle(){const i=Math.sign(c(this.frame.right,this.vRight));return p(U,this.vLeft),-i*(Math.PI-t(c(U,this.vRight)))}get maxStretchDistance(){return Math.abs(this.vMinSiblingLength*i(Math.cos(.5*this.foldingAngle)))}applyMiterStretch(t,s){const e=this.rotationAngle;if(0===Math.abs(e))return s;const h=i(Math.cos(.5*e)),o=this.rotationRight,n=r(E,1+(h-1)*o[0]*o[0],(h-1)*o[0]*o[1],(h-1)*o[0]*o[1],1+(h-1)*o[1]*o[1]);return a(t,s,n)}}function L(t,i,r){e(t,c(r,i.right),c(r,i.up))}function A(t){switch(t){case b.World:return new x;case b.Path:return new j}}const d=v(),S=o(),F=v(),P=v(),U=v(),w=v(),y=v(),I=v(),k=v(),D=v(),E=s();export{R as PathVertex,A as newPathVertex};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.31/esri/copyright.txt for details.
4
4
  */
5
- import{z as t,s as n,c as o,b as i,n as e}from"../../../../chunks/vec32.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as c,setMin as r,setMax as a}from"../../../../geometry/support/aaBoundingBox.js";import{ContentObjectType as f}from"./ContentObjectType.js";import{assert as u}from"./Util.js";import{VertexAttribute as l}from"./VertexAttribute.js";class m{constructor(t=!1,n=!0){this.isVerticalRay=t,this.normalRequired=n}}const h=c();function p(n,o,i,e,s,c){if(!n.visible)return;const r=t(P,e,i),a=(t,n,o)=>{c(t,o,n,!1)},h=new m(!1,o.options.normalRequired);if(n.boundingInfo){u(n.type===f.Mesh);const t=o.tolerance;b(n.boundingInfo,i,r,t,s,h,a)}else{const t=n.attributes.get(l.POSITION),o=t.indices;V(i,r,0,o.length/3,o,t.data,t.stride,s,h,a)}}const M=s();function b(t,n,o,i,e,s,c){if(null==t)return;const f=C(o,M);if(r(h,t.bbMin),a(h,t.bbMax),null!=e&&e.applyToAabb(h),k(h,n,f,i)){const{primitiveIndices:r,position:a}=t,f=r?r.length:a.indices.length/3;if(f>z){const r=t.getChildren();if(void 0!==r){for(const t of r)b(t,n,o,i,e,s,c);return}}T(n,o,0,f,a.indices,a.data,a.stride,r,e,s,c)}}const d=s();function x(n,o,i,e,s,c,r,a,f){const{data:u,stride:l}=c;V(n,t(P,o,n),i,e,s,u,l,r,a,f)}function g(t,n,o,i,e,s,c,r,a,f=null,u=0){const l=t[0],m=t[1],h=t[2],p=n[0],M=n[1],b=n[2];for(let x=o;x<i;++x){const t=u+(f?f[x]:x),n=3*t,o=c*e[n],i=s[o],g=s[o+1],y=s[o+2],T=c*e[n+1],V=s[T],j=s[T+1],q=s[T+2],v=c*e[n+2],R=V-i,O=j-g,A=q-y,B=s[v]-i,C=s[v+1]-g,k=s[v+2]-y,w=M*k-C*b,z=b*B-k*p,P=p*C-B*M,S=R*w+O*z+A*P;if(Math.abs(S)<=N)continue;const U=l-i,D=m-g,E=h-y,F=U*w+D*z+E*P;if(S>0){if(F<0||F>S)continue}else if(F>0||F<S)continue;const G=D*A-O*E,H=E*R-A*U,J=U*O-R*D,K=p*G+M*H+b*J;if(S>0){if(K<0||F+K>S)continue}else if(K>0||F+K<S)continue;const L=(B*G+C*H+k*J)/S;if(L>=0){a(L,t,r?I(R,O,A,B,C,k,d):null)}}}function y(t,n,o,i,e,s,c,r,a,f,u,l=null,m=0){const h=t[0],p=t[1],M=t[2],b=n[0],x=n[1],g=n[2];for(let y=o;y<i;++y){const t=m+(l?l[y]:y),n=3*t,o=c*e[n],i=s[o],T=s[o+1],V=s[o+2],j=c*e[n+1],q=s[j],v=s[j+1],R=s[j+2],O=c*e[n+2],A=s[O],B=s[O+1],C=s[O+2],k=V-a,w=r/Math.sqrt(i*i+T*T+k*k),z=i+i*w,P=T+T*w,S=V+k*w,U=R-a,D=r/Math.sqrt(q*q+v*v+U*U),E=q+q*D,F=v+v*D,G=R+U*D,H=C-a,J=r/Math.sqrt(A*A+B*B+H*H),K=E-z,L=F-P,Q=G-S,W=A+A*J-z,X=B+B*J-P,Y=C+H*J-S,Z=x*Y-X*g,$=g*W-Y*b,_=b*X-W*x,tt=K*Z+L*$+Q*_;if(Math.abs(tt)<=N)continue;const nt=h-z,ot=p-P,it=M-S,et=nt*Z+ot*$+it*_;if(tt>0){if(et<0||et>tt)continue}else if(et>0||et<tt)continue;const st=ot*Q-L*it,ct=it*K-Q*nt,rt=nt*L-K*ot,at=b*st+x*ct+g*rt;if(tt>0){if(at<0||et+at>tt)continue}else if(at>0||et+at<tt)continue;const ft=(W*st+X*ct+Y*rt)/tt;if(ft>=0){u(ft,t,f?I(K,L,Q,W,X,Y,d):null)}}}function T(t,n,o,i,e,s,c,r,a,f,u){const l=t[0],m=t[1],h=t[2],p=n[0],M=n[1],b=n[2],{normalRequired:x}=f;for(let g=o;g<i;++g){const t=r[g],n=3*t,o=c*e[n];let i=s[o],f=s[o+1],y=s[o+2];const T=c*e[n+1];let V=s[T],j=s[T+1],q=s[T+2];const v=c*e[n+2];let R=s[v],O=s[v+1],A=s[v+2];null!=a&&([i,f,y]=a.applyToVertex(i,f,y,g),[V,j,q]=a.applyToVertex(V,j,q,g),[R,O,A]=a.applyToVertex(R,O,A,g));const B=V-i,C=j-f,k=q-y,w=R-i,z=O-f,P=A-y,S=M*P-z*b,U=b*w-P*p,D=p*z-w*M,E=B*S+C*U+k*D;if(Math.abs(E)<=N)continue;const F=l-i,G=m-f,H=h-y,J=F*S+G*U+H*D;if(E>0){if(J<0||J>E)continue}else if(J>0||J<E)continue;const K=G*k-C*H,L=H*B-k*F,Q=F*C-B*G,W=p*K+M*L+b*Q;if(E>0){if(W<0||J+W>E)continue}else if(W>0||J+W<E)continue;const X=(w*K+z*L+P*Q)/E;if(X>=0){u(X,t,x?I(B,C,k,w,z,P,d):null)}}}function V(i,e,s,c,r,a,f,u,l,m){const h=e,p=S,M=Math.abs(h[0]),b=Math.abs(h[1]),d=Math.abs(h[2]),x=M>=b?M>=d?0:2:b>=d?1:2,g=x,y=h[g]<0?2:1,T=(x+y)%3,V=(x+(3-y))%3,I=h[T]/h[g],O=h[V]/h[g],A=1/h[g],B=j,C=q,k=v,{normalRequired:w}=l;for(let j=s;j<c;++j){const e=3*j,s=f*r[e];n(p[0],a[s+0],a[s+1],a[s+2]);const c=f*r[e+1];n(p[1],a[c+0],a[c+1],a[c+2]);const l=f*r[e+2];n(p[2],a[l+0],a[l+1],a[l+2]),u&&(o(p[0],u.applyToVertex(p[0][0],p[0][1],p[0][2],j)),o(p[1],u.applyToVertex(p[1][0],p[1][1],p[1][2],j)),o(p[2],u.applyToVertex(p[2][0],p[2][1],p[2][2],j))),t(B,p[0],i),t(C,p[1],i),t(k,p[2],i);const h=B[T]-I*B[g],M=B[V]-O*B[g],b=C[T]-I*C[g],d=C[V]-O*C[g],x=k[T]-I*k[g],y=k[V]-O*k[g],q=x*d-y*b,v=h*y-M*x,z=b*M-d*h;if((q<0||v<0||z<0)&&(q>0||v>0||z>0))continue;const N=q+v+z;if(0===N)continue;const P=q*(A*B[g])+v*(A*C[g])+z*(A*k[g]);if(P*Math.sign(N)<0)continue;const S=P/N;if(S>=0){m(S,j,w?R(p):null)}}}const j=s(),q=s(),v=s();function I(t,o,s,c,r,a,f){return n(O,t,o,s),n(A,c,r,a),i(f,O,A),e(f,f),f}function R(n){return t(O,n[1],n[0]),t(A,n[2],n[0]),i(d,O,A),e(d,d),d}const O=s(),A=s();function B(t,o,i){return n(i,1/(o[0]-t[0]),1/(o[1]-t[1]),1/(o[2]-t[2]))}function C(t,o){return n(o,1/t[0],1/t[1],1/t[2])}function k(t,n,o,i){return w(t,n,o,i,1/0)}function w(t,n,o,i,e){const s=(t[0]-i-n[0])*o[0],c=(t[3]+i-n[0])*o[0];let r=Math.min(s,c),a=Math.max(s,c);const f=(t[1]-i-n[1])*o[1],u=(t[4]+i-n[1])*o[1];if(a=Math.min(a,Math.max(f,u)),a<0)return!1;if(r=Math.max(r,Math.min(f,u)),r>a)return!1;const l=(t[2]-i-n[2])*o[2],m=(t[5]+i-n[2])*o[2];return a=Math.min(a,Math.max(l,m)),!(a<0)&&(r=Math.max(r,Math.min(l,m)),!(r>a)&&r<e)}const z=1e3,N=1e-7,P=s(),S=[s(),s(),s()];export{m as MeshIntersectionOptions,B as computeInvDir,C as computeInvDirFromDirection,I as computeNormalFromBarycentric,k as intersectAabbInvDir,w as intersectAabbInvDirBefore,g as intersectRayTriangles,V as intersectRayTrianglesWithDisplacementWatertight,y as intersectRayTrianglesWithVerticalOffsetENUGlobal,p as intersectTriangleGeometry,x as intersectTriangles,N as triangleRayParallelTolerance};
5
+ import{z as t,a as n,c as o,b as i,n as e}from"../../../../chunks/vec32.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as c,setMin as r,setMax as a}from"../../../../geometry/support/aaBoundingBox.js";import{ContentObjectType as f}from"./ContentObjectType.js";import{assert as u}from"./Util.js";import{VertexAttribute as l}from"./VertexAttribute.js";class m{constructor(t=!1,n=!0){this.isVerticalRay=t,this.normalRequired=n}}const h=c();function p(n,o,i,e,s,c){if(!n.visible)return;const r=t(P,e,i),a=(t,n,o)=>{c(t,o,n,!1)},h=new m(!1,o.options.normalRequired);if(n.boundingInfo){u(n.type===f.Mesh);const t=o.tolerance;b(n.boundingInfo,i,r,t,s,h,a)}else{const t=n.attributes.get(l.POSITION),o=t.indices;V(i,r,0,o.length/3,o,t.data,t.stride,s,h,a)}}const M=s();function b(t,n,o,i,e,s,c){if(null==t)return;const f=C(o,M);if(r(h,t.bbMin),a(h,t.bbMax),null!=e&&e.applyToAabb(h),k(h,n,f,i)){const{primitiveIndices:r,position:a}=t,f=r?r.length:a.indices.length/3;if(f>z){const r=t.getChildren();if(void 0!==r){for(const t of r)b(t,n,o,i,e,s,c);return}}T(n,o,0,f,a.indices,a.data,a.stride,r,e,s,c)}}const d=s();function x(n,o,i,e,s,c,r,a,f){const{data:u,stride:l}=c;V(n,t(P,o,n),i,e,s,u,l,r,a,f)}function g(t,n,o,i,e,s,c,r,a,f=null,u=0){const l=t[0],m=t[1],h=t[2],p=n[0],M=n[1],b=n[2];for(let x=o;x<i;++x){const t=u+(f?f[x]:x),n=3*t,o=c*e[n],i=s[o],g=s[o+1],y=s[o+2],T=c*e[n+1],V=s[T],j=s[T+1],q=s[T+2],v=c*e[n+2],R=V-i,O=j-g,A=q-y,B=s[v]-i,C=s[v+1]-g,k=s[v+2]-y,w=M*k-C*b,z=b*B-k*p,P=p*C-B*M,S=R*w+O*z+A*P;if(Math.abs(S)<=N)continue;const U=l-i,D=m-g,E=h-y,F=U*w+D*z+E*P;if(S>0){if(F<0||F>S)continue}else if(F>0||F<S)continue;const G=D*A-O*E,H=E*R-A*U,J=U*O-R*D,K=p*G+M*H+b*J;if(S>0){if(K<0||F+K>S)continue}else if(K>0||F+K<S)continue;const L=(B*G+C*H+k*J)/S;if(L>=0){a(L,t,r?I(R,O,A,B,C,k,d):null)}}}function y(t,n,o,i,e,s,c,r,a,f,u,l=null,m=0){const h=t[0],p=t[1],M=t[2],b=n[0],x=n[1],g=n[2];for(let y=o;y<i;++y){const t=m+(l?l[y]:y),n=3*t,o=c*e[n],i=s[o],T=s[o+1],V=s[o+2],j=c*e[n+1],q=s[j],v=s[j+1],R=s[j+2],O=c*e[n+2],A=s[O],B=s[O+1],C=s[O+2],k=V-a,w=r/Math.sqrt(i*i+T*T+k*k),z=i+i*w,P=T+T*w,S=V+k*w,U=R-a,D=r/Math.sqrt(q*q+v*v+U*U),E=q+q*D,F=v+v*D,G=R+U*D,H=C-a,J=r/Math.sqrt(A*A+B*B+H*H),K=E-z,L=F-P,Q=G-S,W=A+A*J-z,X=B+B*J-P,Y=C+H*J-S,Z=x*Y-X*g,$=g*W-Y*b,_=b*X-W*x,tt=K*Z+L*$+Q*_;if(Math.abs(tt)<=N)continue;const nt=h-z,ot=p-P,it=M-S,et=nt*Z+ot*$+it*_;if(tt>0){if(et<0||et>tt)continue}else if(et>0||et<tt)continue;const st=ot*Q-L*it,ct=it*K-Q*nt,rt=nt*L-K*ot,at=b*st+x*ct+g*rt;if(tt>0){if(at<0||et+at>tt)continue}else if(at>0||et+at<tt)continue;const ft=(W*st+X*ct+Y*rt)/tt;if(ft>=0){u(ft,t,f?I(K,L,Q,W,X,Y,d):null)}}}function T(t,n,o,i,e,s,c,r,a,f,u){const l=t[0],m=t[1],h=t[2],p=n[0],M=n[1],b=n[2],{normalRequired:x}=f;for(let g=o;g<i;++g){const t=r[g],n=3*t,o=c*e[n];let i=s[o],f=s[o+1],y=s[o+2];const T=c*e[n+1];let V=s[T],j=s[T+1],q=s[T+2];const v=c*e[n+2];let R=s[v],O=s[v+1],A=s[v+2];null!=a&&([i,f,y]=a.applyToVertex(i,f,y,g),[V,j,q]=a.applyToVertex(V,j,q,g),[R,O,A]=a.applyToVertex(R,O,A,g));const B=V-i,C=j-f,k=q-y,w=R-i,z=O-f,P=A-y,S=M*P-z*b,U=b*w-P*p,D=p*z-w*M,E=B*S+C*U+k*D;if(Math.abs(E)<=N)continue;const F=l-i,G=m-f,H=h-y,J=F*S+G*U+H*D;if(E>0){if(J<0||J>E)continue}else if(J>0||J<E)continue;const K=G*k-C*H,L=H*B-k*F,Q=F*C-B*G,W=p*K+M*L+b*Q;if(E>0){if(W<0||J+W>E)continue}else if(W>0||J+W<E)continue;const X=(w*K+z*L+P*Q)/E;if(X>=0){u(X,t,x?I(B,C,k,w,z,P,d):null)}}}function V(i,e,s,c,r,a,f,u,l,m){const h=e,p=S,M=Math.abs(h[0]),b=Math.abs(h[1]),d=Math.abs(h[2]),x=M>=b?M>=d?0:2:b>=d?1:2,g=x,y=h[g]<0?2:1,T=(x+y)%3,V=(x+(3-y))%3,I=h[T]/h[g],O=h[V]/h[g],A=1/h[g],B=j,C=q,k=v,{normalRequired:w}=l;for(let j=s;j<c;++j){const e=3*j,s=f*r[e];n(p[0],a[s+0],a[s+1],a[s+2]);const c=f*r[e+1];n(p[1],a[c+0],a[c+1],a[c+2]);const l=f*r[e+2];n(p[2],a[l+0],a[l+1],a[l+2]),u&&(o(p[0],u.applyToVertex(p[0][0],p[0][1],p[0][2],j)),o(p[1],u.applyToVertex(p[1][0],p[1][1],p[1][2],j)),o(p[2],u.applyToVertex(p[2][0],p[2][1],p[2][2],j))),t(B,p[0],i),t(C,p[1],i),t(k,p[2],i);const h=B[T]-I*B[g],M=B[V]-O*B[g],b=C[T]-I*C[g],d=C[V]-O*C[g],x=k[T]-I*k[g],y=k[V]-O*k[g],q=x*d-y*b,v=h*y-M*x,z=b*M-d*h;if((q<0||v<0||z<0)&&(q>0||v>0||z>0))continue;const N=q+v+z;if(0===N)continue;const P=q*(A*B[g])+v*(A*C[g])+z*(A*k[g]);if(P*Math.sign(N)<0)continue;const S=P/N;if(S>=0){m(S,j,w?R(p):null)}}}const j=s(),q=s(),v=s();function I(t,o,s,c,r,a,f){return n(O,t,o,s),n(A,c,r,a),i(f,O,A),e(f,f),f}function R(n){return t(O,n[1],n[0]),t(A,n[2],n[0]),i(d,O,A),e(d,d),d}const O=s(),A=s();function B(t,o,i){return n(i,1/(o[0]-t[0]),1/(o[1]-t[1]),1/(o[2]-t[2]))}function C(t,o){return n(o,1/t[0],1/t[1],1/t[2])}function k(t,n,o,i){return w(t,n,o,i,1/0)}function w(t,n,o,i,e){const s=(t[0]-i-n[0])*o[0],c=(t[3]+i-n[0])*o[0];let r=Math.min(s,c),a=Math.max(s,c);const f=(t[1]-i-n[1])*o[1],u=(t[4]+i-n[1])*o[1];if(a=Math.min(a,Math.max(f,u)),a<0)return!1;if(r=Math.max(r,Math.min(f,u)),r>a)return!1;const l=(t[2]-i-n[2])*o[2],m=(t[5]+i-n[2])*o[2];return a=Math.min(a,Math.max(l,m)),!(a<0)&&(r=Math.max(r,Math.min(l,m)),!(r>a)&&r<e)}const z=1e3,N=1e-7,P=s(),S=[s(),s(),s()];export{m as MeshIntersectionOptions,B as computeInvDir,C as computeInvDirFromDirection,I as computeNormalFromBarycentric,k as intersectAabbInvDir,w as intersectAabbInvDirBefore,g as intersectRayTriangles,V as intersectRayTrianglesWithDisplacementWatertight,y as intersectRayTrianglesWithVerticalOffsetENUGlobal,p as intersectTriangleGeometry,x as intersectTriangles,N as triangleRayParallelTolerance};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.31/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../chunks/tslib.es6.js";import{update as t}from"../../../../core/arrayUtils.js";import{createTask as r}from"../../../../core/asyncUtils.js";import{unitRGBAFromColor as s}from"../../../../core/colorUtils.js";import has from"../../../../core/has.js";import{clamp as i}from"../../../../core/mathUtils.js";import{removeMaybe as a,abortMaybe as n,destroyMaybe as h,releaseMaybe as o}from"../../../../core/maybe.js";import d from"../../../../core/PooledArray.js";import{throwIfAborted as l}from"../../../../core/promiseUtils.js";import{watch as _,syncAndInitial as u,initial as p,sync as c}from"../../../../core/reactiveUtils.js";import{signal as m}from"../../../../core/signal.js";import{property as f}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import"../../../../core/accessorSupport/interfaces.js";import"../../../../core/accessorSupport/tracking/Flags.js";import"../../../../core/Warning.js";import"../../../../core/Error.js";import{equals as g,invert as b,multiply as T}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as E,create as A}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{s as P}from"../../../../chunks/vec42.js";import{fromValues as R,ZEROS as S}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{a as C}from"../../../../chunks/boundedPlane.js";import{InternalRenderCategory as w,RenderCategory as O}from"../../webgl.js";import{debugFlags as I}from"../../support/debugFlags.js";import{TransparencyMode as y}from"../../terrain/TransparencyMode.js";import{DepthFormat as D,ColorFormat as N}from"../../webgl/formats.js";import{FBOCache as x,defaultWebGLFBO as M}from"../core/FBOCache.js";import{RenderPassManager as H}from"../core/renderPasses/RenderPassManager.js";import{ShaderOutput as v}from"../core/shaderLibrary/ShaderOutput.js";import{HUDRenderStyle as L}from"../core/shaderLibrary/hud/HUDRenderStyle.js";import{distanceFadeEnd as F}from"../core/shaderLibrary/shading/ScreenSpaceConstants.js";import{RenderNodes as q}from"../effects/RenderNodes.js";import{isPrepareRenderPlugin as U}from"../effects/RenderPlugin.js";import{RenderPluginManager as j}from"../effects/RenderPluginManager.js";import{Blit as G}from"../effects/blit/Blit.js";import{AnimationTimeStep as V}from"./AnimationTimeStep.js";import{Decorations as B,RenderRequestType as Q,StencilBits as k}from"./basicInterfaces.js";import{BoundingInfo as z}from"./BoundingInfo.js";import{zero as W,union as X}from"./depthRange.js";import{depthRangeFromScene as Y}from"./depthRangeUtils.js";import{MainFramebuffer as J}from"./MainFramebuffer.js";import{RenderOccludedFlag as K}from"./Material.js";import{RenderContext as $,defaultRenderOccludedMask as Z}from"./RenderContext.js";import{splitRenderGeometryChangeSetByMaterial as ee,RendererTarget as te}from"./rendererUtils.js";import{setupFeatureDefaults as re,RenderFeature as se}from"./RenderFeature.js";import{RenderPluginInput as ie}from"./RenderPluginInput.js";import{RenderSlot as ae}from"./RenderSlot.js";import{ShadowAccumulator as ne}from"./ShadowAccumulator.js";import{ShadowMap as he,SnapshotSlot as oe}from"./ShadowMap.js";import de from"./SliceHelper.js";import{TransparencyPassType as le}from"./TransparencyPassType.js";import{Transparency as _e}from"./edgeRendering/interfaces.js";import{MergedRenderer as ue}from"../materials/renderers/MergedRenderer.js";import{AlphaMode as pe}from"../shaders/CompositingTechniqueConfiguration.js";import{OITCompositingTechnique as ce}from"../shaders/OITCompositingTechnique.js";import{RendererPerformanceInfo as me,PerformanceCategory as fe}from"../statistics/RendererPerformanceInfo.js";import{defaultHighlightName as ge}from"../../../support/HighlightDefaults.js";import{RenderState as be}from"../../../support/RenderState.js";import{DepthStencilAttachment as Te,PixelFormat as Ee,PixelType as Ae,FramebufferBit as Pe,TextureType as Re,ColorAttachment as Se}from"../../../webgl/enums.js";class Ce{constructor(e,t,r,i,a,n){this._stage=e,this._techniques=r,this._rctx=i,this._compositingHelper=a,this._requestRender=n,this._pluginsHas={hudElements:!1,water:!1},this._hasOverlayWater=!1,this.renderOverlay=e=>{},this._renderers=new Map,this._isRendering=!1,this._inGlobeView=!1,this._backgroundColor=R(0,0,0,1),this._sliceHelper=new de,this._blit=null,this._state=m(be.IDLE),this._highQualityTransparencyEnabled=!0,this._terrainTransparency=y.Opaque,this._ssrEnabled=!1,this._hasAnimations=!1,this._animationTimestep=new V,this._loadEdgeViewTask=null,this._edgeViewCallbacks=[],this._reprojectionMatrixVersion=m(0),this._renderHiddenTransparentEdges=()=>{},this._pluginInput=new ie,this._releaseNormals=e=>{e.some((({name:e})=>"normals"===e))&&this._pluginInput.release("normals")},this._debugNeedsDepth=!1,this.fboCache=new x(i),this._renderStateFeatures=m(re(!has("disable-feature:high-quality-idle"),e.view.qualityProfile)),this._framebuffer=new J(this.fboCache),this.performanceInfo=new me(this._rctx),this._shadowMap=new he(this.fboCache,e.viewingMode),this._shadowAccumulator=new ne(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}),((e,t,r)=>{const s=this._stage.view.qualitySettings.maximumPixelRatio;e.shadowMap.start(e.camera,t,r,!0,s),this._renderShadowCascades(v.Shadow,e.shadowMap),e.shadowMap.finish(),e.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(e.camera,e.contentCamera)}),n),this._renderContext=new $(this._rctx,this._shadowMap,this._sliceHelper),this._nodes=new q(this._renderContext),this._plugins=new j({renderContext:this._renderContext,techniques:r,materials:t,requestRender:n,controller:e,fbos:this.fboCache,isFeatureEnabled:e=>this.isFeatureEnabled(e)}),this.renderPassManager=new H,this._plugins.add(this.renderPassManager),this._handles=[_((()=>this._stage.view.state.camera),(()=>n()),u),_((()=>I.EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES),(e=>{this._renderHiddenTransparentEdges=e?()=>this._renderEdges(_e.TRANSPARENT):()=>{},n()}),p),_((()=>this._stage.view.environment.background?.color),(e=>{const t=e?s(e):S;P(this._backgroundColor,t[0]*t[3],t[1]*t[3],t[2]*t[3],t[3]),n()}),u),_((()=>this._stage.view.state.camera.relativeElevation),(e=>{this._inGlobeView=(e??1/0)>=F}),u)]}destroy(){this._handles.forEach((e=>e.remove())),this._gpuTimerHandle=a(this._gpuTimerHandle),this._nodes.destroy(),this._framebuffer.dispose(),this._shadowMap.dispose(),this._shadowAccumulator.dispose(),this._loadEdgeViewTask=n(this._loadEdgeViewTask),this._edgeView=h(this._edgeView),this.renderPassManager.dispose(),this._releaseFBOs(),this._disposeOffscreenBuffers(),this.fboCache.destroy(),this._plugins.destroy(),this._renderers.clear(),this._blit=h(this._blit),z.prune()}get _bindParameters(){return this._renderContext.bindParameters}get _framebufferSize(){return this._framebuffer.size}updateRenderFeatures(e=null,t=!has("disable-feature:high-quality-idle")){this._renderStateFeatures.value=re(t,e),this._plugins.renderFeatureChanged(),this._requestRender()}isFeatureEnabled(e,t=this._state.value){return this._renderStateFeatures.value.get(t,e)??!1}setFeatureEnabled(e,t,r){this._renderStateFeatures.mutate((s=>s.set(t,e,r))),this._requestRender()}get _highQualityTransparency(){return this._highQualityTransparencyEnabled||this.isFeatureEnabled(se.HighQualityTransparency)}get hasReflections(){return(this._pluginsHas.water||this._hasOverlayWater)&&(this._ssrEnabled||this.isFeatureEnabled(se.WaterReflection))}get hasDecorations(){return this._plugins.hasDecorations||this._nodes.produces("magnifier-color")}get hasHighlights(){return this._plugins.produces(v.Highlight,ae.OPAQUE_MATERIAL,ae.TRANSPARENT_MATERIAL,ae.DRAPED_MATERIAL)}get hasSSAO(){return(this._stage.view.qualitySettings.ambientOcclusion||this.isFeatureEnabled(se.SSAO))&&!this._inGlobeView}get hasSMAA(){return this._stage.view.qualitySettings.antialiasingEnabled||this.isFeatureEnabled(se.Antialiasing)}get fullResolutionAtmosphere(){return this._stage.view.qualitySettings.highResolutionAtmosphere||this.isFeatureEnabled(se.HighResolutionAtmosphere)}_releaseFBOs(){this._bindParameters.ssr.lastFrameColor=o(this._bindParameters.ssr.lastFrameColor),this._bindParameters.multipassTerrain.depth=o(this._bindParameters.multipassTerrain.depth),this._bindParameters.multipassGeometry.depth=o(this._bindParameters.multipassGeometry.depth),this._pluginInput.release("highlight mix")}_disposeOffscreenBuffers(){this._framebuffer.dispose(),this._disposeBindBuffers()}_disposeBindBuffers(){this._shadowMap.disposeOffscreenBuffers(),this._bindParameters.depth=o(this._bindParameters.depth),this._bindParameters.hudVisibility=o(this._bindParameters.hudVisibility)}get updating(){return null!=this._edgeView&&this._edgeView.updating||this._shadowAccumulator.running||this._plugins.updating||!this.isCameraFinal}loadEdgeView(){return this._loadEdgeViewTask||(this._loadEdgeViewTask=r((async e=>{const{EdgeView:t}=await import("./edgeRendering/EdgeView.js");l(e);const r=this._edgeView=new t({rctx:this._rctx,renderSR:this._stage.view.renderSpatialReference,viewingMode:this._stage.viewingMode,techniques:this._techniques,setNeedsRender:()=>this._requestRender(),schedule:He(this._stage.view.resourceController)});return this._handles.push(_((()=>r.updating),(()=>this._requestRender()),c)),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&&g(this._bindParameters.ssr.reprojectionMatrix,E)}set _reprojectionMatrix(e){t(this._bindParameters.ssr.reprojectionMatrix,e)&&this._reprojectionMatrixVersion.value++}get shadowsEnabled(){return!!this._shadowMap?.enabled}setParameters(e){const{_shadowMap:t,_bindParameters:r}=this;if(void 0!==e.qualitySettings?.reflections&&this._ssrEnabled!==e.qualitySettings.reflections&&(this._ssrEnabled=e.qualitySettings.reflections,this._requestRender()),void 0!==e.shadowMap&&this._shadowMap.enabled!==e.shadowMap&&(this._shadowMap.enabled=e.shadowMap,this._requestRender()),void 0!==e.shadowMapMaxCascades&&t.maxCascades!==e.shadowMapMaxCascades&&(t.maxCascades=e.shadowMapMaxCascades,this._requestRender()),null!=e.environment){null!=e.environment.weather&&(this._bindParameters.weather=e.environment.weather,this._bindParameters.weatherVisible=!!e.weatherVisible);const t="virtual"!==e.environment.lighting.type;r.enableFillLights!==t&&(r.enableFillLights=t,this._requestRender())}void 0!==e.highQualityTransparency&&this._highQualityTransparencyEnabled!==e.highQualityTransparency&&(this._highQualityTransparencyEnabled=e.highQualityTransparency,this._requestRender()),void 0!==e.hasOverlayWater&&this._hasOverlayWater!==e.hasOverlayWater&&(this._hasOverlayWater=e.hasOverlayWater,this._requestRender()),void 0!==e.slicePlane&&this._sliceHelper.plane!==e.slicePlane&&(this._sliceHelper.plane=e.slicePlane,this._requestRender()),void 0!==e.terrainTransparency&&this._terrainTransparency!==e.terrainTransparency&&(this._terrainTransparency=e.terrainTransparency,this._requestRender()),void 0!==e.shadowCast&&this._shadowAccumulator.setOptions(e.shadowCast)}get hasSlicePlane(){return!!this._sliceHelper.plane}get plugins(){return this._plugins}getMaterialRenderer(e){return this._renderers.get(e)}get _hasOITSupport(){return this._rctx.driverTest.floatBufferBlend.result}get _oitEnabled(){return this._highQualityTransparency&&this._hasOITSupport}modify(e,t){this._isRendering&&console.warn("Renderer.modify called while rendering");const{adds:r,removes:s,updates:i}=e;if(0===r.length&&0===s.length&&0===i.length)return;ee(e).forEach(((r,s)=>{if(t.done)return;let i=this._renderers.get(s);null==i&&r.adds.length>0&&(i=new ue({material:s}),i.initializeRenderContext(this._plugins._context),this._plugins.add(i),this._renderers.set(s,i)),i&&(i.modify(r),0===i.numGeometries&&(this._renderers.delete(i.material),this._plugins.remove(i),i.destroy())),r.removes.forEach((t=>e.removes.removeUnordered(t))),r.adds.forEach((t=>e.adds.removeUnordered(t))),r.updates.forEach((t=>e.updates.removeUnordered(t))),t.madeProgress()})),this.updateHasFlags(),this._requestRender()}updateHasFlags(){const has=this._pluginsHas;has.hudElements=this._plugins.produces(v.Color,ae.LINE_CALLOUTS_HUD_DEPTH,ae.HUD_MATERIAL,ae.LABEL_MATERIAL),has.water=this._plugins.produces(v.Normal,ae.DRAPED_WATER),this._bindParameters.hasOccludees=this._plugins.hasOccludees}updateAnimation(e){const t=this._hasAnimations;return this._hasAnimations=this._plugins.updateAnimation(e),this._hasAnimations=this._nodes.updateAnimation()||this._hasAnimations,this._hasAnimations!==t&&(this._gpuTimerHandle=t?a(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=te.Default,s=B.ON){try{return this._isRendering=!0,this._render(e,t,r,s)}catch(i){console.error(`Exception during rendering: ${i}`)}finally{this._isRendering=!1}return{screen:this._pluginInput.get("final-color"),oid:null}}_render(e,t,r=te.Default,s=B.ON){this.performanceInfo.startFrame(),this.fboCache.frameStart(),this.fboCache.interactive=r===te.Default,this._disposeBindBuffers();const i=this._framebuffer,{camera:a,contentCamera:n,mode:h,alignPixelEnabled:d}=e;this._state.value=h,this._bindParameters.overlay=this.renderOverlay(t),this._bindParameters.overlay&&this.performanceInfo.advance(fe.OVERLAY),this._renderContext.time=t,this._bindParameters.transparencyPassType=le.NONE,this._bindParameters.alignPixelEnabled=d,this._bindParameters.decorations=s,this._bindParameters.mainDepth=null,this._bindParameters.viewshedEnabled=this._nodes.produces(w.VIEWSHED);const l=this._nodes.produces("magnifier-color"),_=this._nodes.produces("final-color"),u=C(this._sliceHelper.plane);s===B.OFF&&(this._sliceHelper.plane=null),a.setGLViewport(this._rctx);const p=this._nodes.require("composite-color:emissions","composite-color:emissions")>0&&this._plugins.hasEmissions,c=p?v.ColorEmission:v.Color,m=i.initialize(a.fullWidth,a.fullHeight,this._backgroundColor,p);this.hasReflections?this._bindParameters.ssr.lastFrameColor=m:m?.release(),this._ensureBindParametersCamera(a,n),this._plugins.prepareRender(),this._bindParameters.shadowHighlightsVisible=this._needsShadowHighlight&&s===B.ON;const f=this._plugins.produces(v.Color,ae.OPAQUE_TERRAIN)&&(this._terrainTransparency===y.Transparent||this._terrainTransparency===y.InvisibleWithDraped),g=this._highQualityTransparency&&f,b=this._plugins.produces(v.Color,...ye);this._prepareShaders(g,b,c),this.performanceInfo.advance(fe.PREPARE);const T=this._computeDepthRange(a);this._renderShadowMap(a,this._bindParameters.lighting.mainLight.direction,T),this._ensureBindParametersCamera(a,n);let E=this._renderNormals();this._pluginInput.set("normals",E);const A=this._needsDepth;if(E){let e=null;A&&(e=E.getAttachment(Te),e?.retain()),this._pluginInput.set("ssao",this._renderSSAO()),this._renderNoSSAOGeometryDepth(A,e),E=null}else this._renderAllGeometryDepth(A);this._renderShadowAccumulation(T,a,n),this._ensureBindParametersSSR(t),this._renderContext.output=c,i.bind(),this._bindParameters.mainDepth=i.depth.attachment;const P=this.plugins.produces(v.Color,...Ie);P&&this._renderOpaqueGeometry(),i.update((e=>this._renderNodes(O.OPAQUE,e,P))),this.fboCache.debugCallback?.("opaque-color",i.color.fbo),this._renderPlugins(ae.OPAQUE_ENVIRONMENT,fe.OPAQUE_ENVIRONMENT),this._renderMultipassTerrainDepth(g),this._setMultipassTerrain(g),this._renderEdges(_e.OPAQUE),i.bind(),this._renderPlugins(ae.VOXEL,fe.VOXEL),this._renderHiddenTransparentEdges(),b&&(this._oitEnabled?this._renderOITPass(we.Geometry,c):this._renderTransparentMaterial()),i.update((e=>this._renderNodes(O.TRANSPARENT,e,b))),this.fboCache.debugCallback?.("transparent-color",i.color.fbo),this._renderMultipassGeometryDepth(g),this._renderHUDVisibility(),g||this._plugins.render(this._pluginInput,ae.LINE_CALLOUTS);const R=r===te.ObjectAndLayerID?this._renderObjectAndLayerIdColor():null;this._renderEdges(_e.TRANSPARENT);const S=f?this._renderTransparentTerrain():null;S&&(this.performanceInfo.advance(fe.TRANSPARENT_TERRAIN),this._bindParameters.hudVisibility&&(g?this._renderLineCallouts(L.Occluded):(this._rctx.bindFramebuffer(this._bindParameters.hudVisibility?.fbo),this._compositingHelper.compositeHUD(this._bindParameters,S.getTexture())),this._renderHUD(L.Occluded,i.color,c))),this._setTerrainCulling(!1),S&&(i.bind(),this._compositingHelper.composite(this._bindParameters,S.getTexture(),pe.PremultipliedAlpha),S.release(),g&&(this._renderEdges(_e.OPAQUE),b&&(this._oitEnabled?this._renderOITPass(we.Geometry,c):this._renderTransparentMaterial(),this.performanceInfo.advance(fe.TRANSPARENT)),this._renderEdges(_e.TRANSPARENT))),this._bindParameters.ssao=o(this._bindParameters.ssao),g&&this._renderLineCallouts(L.NotOccluded),this._setMultipassEnabled(!1),this._renderTransparentEnvironment(),i.update((e=>this._renderNodes(w.VIEWSHED,e))),i.update((e=>this._renderNodes(w.LASERLINES,e))),this._renderOccluded(c),this._pluginInput.set("highlights",this._renderHighlightPrepass()),i.update((e=>this._renderNodes(p?O.COMPOSITE_EMISSIONS:O.COMPOSITE,e)));const I=!(r!==te.Default||_||l&&s===B.ON&&r===te.Default),D=this._pluginInput.get(p?"composite-color:emissions":"composite-color");p&&(D.setName("composite-color"),this._pluginInput.set("composite-color",D));const N=I?M:this.fboCache.acquire(D.fbo.width,D.fbo.height,"aa-color"),x=this._nodes.produces("aa-color")?this._renderNodes(w.ANTIALIASING,N):this._blitFBO(D,N,!1);this._pluginInput.set(w.ANTIALIASING,x),this._renderHUD(L.NotOccluded,x,c);const H=this._renderNodes(w.HIGHLIGHTS,x),F=this._renderNodes(w.MAGNIFIER,H);return l&&s===B.ON&&r===te.Default&&!_&&this._blitFBO(F),_?(F.attachDepth(i.depth),this._blitFBO(this._renderNodes(O.FINAL,F)),F.detachDepth()):this._pluginInput.set(O.FINAL,F),this._pluginInput.release("highlights"),this.onPostRender&&this.onPostRender(),this._releaseFBOs(),i.releaseDepth(),this._renderContext.lastFrameCamera.copyFrom(this._bindParameters.camera),this._sliceHelper.plane=u,this.fboCache.frameEnd(),this.performanceInfo.finishFrame(),r!==te.Default&&(this._releaseFBOs(),this._disposeOffscreenBuffers()),{screen:this._pluginInput.get("final-color"),oid:R}}_prepareShaders(e,t,r){this._renderContext.output=r,this._prepareOpaqueGeometry(),this._setMultipassTerrain(e),this._plugins.prepare(ae.TRANSPARENT_TERRAIN),this._setMultipassTerrain(!1),e||this._plugins.prepare(ae.LINE_CALLOUTS),t&&this._prepareTransparencySlots(r),this._plugins.prepare(ae.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL,ae.TRANSPARENT_ENVIRONMENT),this._rctx.gl.flush()}_renderObjectAndLayerIdColor(){if(!has("enable-feature:objectAndLayerId-rendering"))return;const e=this._renderContext.output,t=this._framebufferSize,r=this.fboCache.acquire(t.width,t.height,"oid");return r.acquireDepth(D.DEPTH_STENCIL_TEXTURE),this._rctx.bindFramebuffer(r.fbo),this._rctx.clearFramebuffer([0,0,0,0],!0,!0),this._renderAllGeometry(v.ObjectAndLayerIdColor),this._rctx.bindFramebuffer(r.fbo),this._rctx.clearFramebuffer(void 0,!0,!0),this._bindParameters.hudRenderStyle=L.NotOccluded,this._plugins.render(this._pluginInput,ae.HUD_MATERIAL),this._renderContext.output=e,this.performanceInfo.advance(fe.OBJECT_AND_LAYER_ID_COLOR),r}finish(e){this._hasAnimations||this._animationTimestep.clear();const t=this.performanceInfo.gpuSamplingEnabled,r=e===Q.BACKGROUND;if(r||t){const e=r?this.performanceInfo.elapsedTime:0;let s=0;t?s=this.performanceInfo.totalGPUTimeSampler.last:this._rctx.gl.finish();const i=Math.max(e,s);this._animationTimestep.frame(i,r)}}readDepthPixels(e,t){const{mainDepth:r,camera:s}=this._bindParameters;if(!r)return;const i=this.fboCache.acquire(this._framebufferSize.width,this._framebufferSize.height,"linear-depth");this._rctx.bindFramebuffer(i.fbo),s.setGLViewport(this._rctx),this._rctx.setScissorRect(e[0],e[1],e[2],e[3]),this._rctx.setScissorTestEnabled(!0),this._rctx.clearFramebuffer([0,0,0,0]),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),i.fbo?.readPixels(e[0],e[1],e[2],e[3],Ee.RGBA,Ae.UNSIGNED_BYTE,t),i.release()}readHUDVisibility(e,t,r,s,i){this._bindParameters.hudVisibility?.fbo?.readPixels(e,t,r,s,Ee.RGBA,Ae.UNSIGNED_BYTE,i)}readAccumulatedShadow(e){return this._shadowAccumulator.readAccumulatedShadow(e[0],e[1])}_setMultipassTerrain(e){this._setMultipassEnabled(e),this._setTerrainCulling(e)}_setMultipassEnabled(e){this._bindParameters.multipassEnabled=e}_setTerrainCulling(e){this._bindParameters.multipassTerrain.cullAboveGround=e}_renderEdges(e){const t=this._edgeView;if(!t?.shouldRender())return;const r=this._framebufferSize,s=this.fboCache.acquire(r.width,r.height,"edges"),i=()=>t.render(this._bindParameters,e),a=this._bindParameters.multipassGeometry.depth;this.renderToTargets(i,s,a??this._framebuffer.depth,Oe),this._framebuffer.bind(),this._compositingHelper.composite(this._bindParameters,s.getTexture(),pe.Alpha),s.release(),this.performanceInfo.advance(e===_e.OPAQUE?fe.OPAQUE_EDGES:fe.TRANSPARENT_EDGES)}_renderShadowMap(e,t,r){const s=this._shadowMap;s.enabled&&(s.start(e,t,r,this.isFeatureEnabled(se.HighResolutionShadows),this._stage.view.qualitySettings.maximumPixelRatio),this._needsShadowHighlight?(this._renderShadowCascades(v.ShadowHighlight,this._shadowMap),s.moveSnapshot(oe.Highlight),this._renderShadowCascades(v.ShadowExcludeHighlight,this._shadowMap),s.copySnapshot(oe.ExcludeHighlight),this._renderShadowCascades(v.ShadowHighlight,this._shadowMap)):this._renderShadowCascades(v.Shadow),s.finish(),e.setGLViewport(this._rctx),this.performanceInfo.advance(fe.SHADOW_MAP))}_renderShadowCascades(e,t=this._shadowMap){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(v.Depth)||this._nodes.requireGeometryDepth()||this.hasReflections||this._needsShadowHighlight||this._needsShadowCast||this._debugNeedsDepth}_renderNoSSAOGeometryDepth(e,t){if(!e||!t)return void(this._bindParameters.depth=o(this._bindParameters.depth));const r=this._framebufferSize,s=this.fboCache.acquire(r.width,r.height,"depth");s.attachDepth(t),t.release(),this._rctx.bindFramebuffer(s.fbo),this._rctx.clearFramebuffer(void 0,!1,!0),this._renderGeometryExcludedFromSSAO(v.Depth),o(this._bindParameters.depth),this._bindParameters.depth=s.obtainDepthTexture(),s.release(),this.performanceInfo.advance(fe.DEPTH)}_renderAllGeometryDepth(e){if(!e)return void(this._bindParameters.depth=o(this._bindParameters.depth));const t=this._framebufferSize,r=this.fboCache.acquire(t.width,t.height,"depth").acquireDepth(D.DEPTH_STENCIL_TEXTURE);this._rctx.bindFramebuffer(r.fbo),this._rctx.clearFramebuffer(void 0,!0,!0),this._renderAllGeometry(v.Depth),o(this._bindParameters.depth),this._bindParameters.depth=r.obtainDepthTexture(),r.release(),this.performanceInfo.advance(fe.DEPTH)}_renderMultipassTerrainDepth(e){if(!e)return void(this._bindParameters.multipassTerrain.depth=o(this._bindParameters.multipassTerrain.depth));const t=this._renderContext.output;this._renderContext.output=v.Depth;const r=this._framebufferSize,s=this.fboCache.acquire(r.width,r.height,"terrain depth").acquireDepth(D.DEPTH_STENCIL_TEXTURE);this._rctx.bindFramebuffer(s.fbo),this._rctx.clearFramebuffer(void 0,!0,!0),this._renderTransparentTerrain(),o(this._bindParameters.multipassTerrain.depth),this._bindParameters.multipassTerrain.depth=s.obtainDepthTexture(),this._renderContext.output=t,s.release()}_renderMultipassGeometryDepth(e){if(!e)return void(this._bindParameters.multipassGeometry.depth=o(this._bindParameters.multipassGeometry.depth));const t=this._renderContext.output,r=this._framebufferSize,s=this.fboCache.acquire(r.width,r.height,"geometry depth").acquireDepth(D.DEPTH_STENCIL_TEXTURE);this._rctx.bindFramebuffer(s.fbo),this._rctx.clearFramebuffer(void 0,!0,!0),this._renderOpaqueGeometryAndTransparentMaterial(v.Depth),this._renderContext.output=t,o(this._bindParameters.multipassGeometry.depth),this._bindParameters.multipassGeometry.depth=s.obtainDepthTexture(),s.release()}get _needsDepthRange(){return this._shadowMap.enabled||this._needsShadowCast}_computeDepthRange(e){if(!this._needsDepthRange)return W;const t=Y(e,this._plugins.plugins,this._stage.layers);return X(t,this._plugins.queryDepthRange(e)),t.near=Math.max(e.near,t.near),t.far=Math.min(e.far,t.far),t}_renderNormals(){const e=this._nodes.require("normals","final-color","composite-color","opaque-color","transparent-color","laserline-color"),t=(this.hasSSAO?1:0)+e;if(0===t)return;const r=this._framebufferSize,s=this.fboCache.acquire(r.width,r.height,"normals",N.RGBA);s.acquireDepth(D.DEPTH_STENCIL_TEXTURE),this._rctx.bindFramebuffer(s.fbo),this._rctx.clearFramebuffer([0,0,0,0],!0,!0),this._renderGeometryForSSAO(v.Normal);const i=this._nodes.optional("normals","final-color","composite-color","opaque-color","transparent-color","viewshed-color");return s.retain(t+i-1),this.performanceInfo.advance(fe.NORMALS),s}_renderSSAO(){const e=this._pluginInput.get("normals");if(!this.hasSSAO||!e)return void e?.detachDepth();M.setName("ssao");const t=this._nodes.render(M,this._pluginInput);return this._bindParameters.ssao=t,e.detachDepth(),this._pluginInput.release("normals"),this.performanceInfo.advance(fe.SSAO),t}_renderAllGeometry(e){this._renderContext.output=e,this._plugins.prepare(ae.TRANSPARENT_TERRAIN),this._renderOpaqueGeometryAndTransparentMaterial(e),this._renderTransparentTerrain()}renderAllGeometryForShadowMap(e,t){const{camera:r,contentCamera:s}=this._bindParameters;t.setGLViewport(this._rctx),this._ensureBindParametersCamera(t,t),this._renderAllGeometry(e),this._ensureBindParametersCamera(r,s),this._bindParameters.camera.setGLViewport(this._rctx)}_renderOpaqueGeometryAndTransparentMaterial(e){this._renderContext.output=e,this._plugins.prepare(ae.TRANSPARENT_MATERIAL,ae.TRANSPARENT_NO_SSAO_DEPTH),this._renderOpaqueGeometry(),this._renderTransparentMaterial()}_renderGeometryForSSAO(e){this._renderContext.output=e,this._plugins.render(this._pluginInput,ae.INTEGRATED_MESH,ae.OPAQUE_TERRAIN,ae.OPAQUE_MATERIAL,ae.TRANSPARENT_MATERIAL),this._renderTransparentTerrain()}_renderGeometryExcludedFromSSAO(e){this._renderContext.output=e,this._plugins.render(this._pluginInput,ae.OPAQUE_NO_SSAO_DEPTH,ae.TRANSPARENT_NO_SSAO_DEPTH)}_prepareOpaqueGeometry(){this._plugins.prepare(...Ie,ae.OPAQUE_ENVIRONMENT)}_renderOpaqueGeometry(){this._plugins.render(this._pluginInput,...Ie)}_renderTransparentMaterial(){this._plugins.render(this._pluginInput,...ye)}_renderTransparentTerrain(){const e=this._renderContext.output;if(!this._plugins.produces(e,ae.TRANSPARENT_TERRAIN))return;const t=()=>this._plugins.render(this._pluginInput,ae.TRANSPARENT_TERRAIN);if(e!==v.Color&&e!==v.ColorEmission)return void t();const r=this._framebufferSize,s=this.fboCache.acquire(r.width,r.height,"transparent terrain");return this.renderToTargets(t,s,this._framebuffer.depth,[0,0,0,0]),s}_renderHUDVisibility(){if(this._plugins.produces(this._renderContext.output,ae.OCCLUSION_PIXELS)){const e=()=>{const e=this._framebufferSize;let t=this._bindParameters.hudVisibility;const r=this._bindParameters.multipassGeometry.depth;return t?.fbo?.width===e.width&&t?.fbo?.height===e.height||(t?.release(),t=this.fboCache.acquire(e.width,e.height,"hud visibility",N.RGBA4)),t.attachDepth(r||this._framebuffer.depth),this._rctx.bindFramebuffer(t.fbo),this._rctx.clearFramebuffer([0,1,0,1]),this._plugins.render(this._pluginInput,ae.OCCLUSION_PIXELS),t.detachDepth(),t};this._bindParameters.hudVisibility=e(),this._framebuffer.bind(),this.performanceInfo.advance(fe.HUD_VISIBILITY)}else this._bindParameters.hudVisibility=o(this._bindParameters.hudVisibility)}_renderLineCallouts(e){if(this._bindParameters.hudRenderStyle=e,e===L.Occluded){const e=()=>this._plugins.render(this._pluginInput,ae.LINE_CALLOUTS),t=this._framebufferSize,r=this.fboCache.acquireDepth(D.DEPTH16_BUFFER,t.width,t.height,"line callouts");this.renderToTargets(e,this._framebuffer.color,r,void 0,!0,!0),r.release()}else this._plugins.render(this._pluginInput,ae.LINE_CALLOUTS)}_renderHUD(e,t,r){if(this._pluginsHas.hudElements){if(this._oitEnabled){const s=this._renderOITPass(we.HUD,r,e);this._rctx.bindFramebuffer(t.fbo),this._compositingHelper.composite(this._bindParameters,s.getTexture(),pe.PremultipliedAlpha),s.release()}else if(e===L.Occluded){this._renderContext.output=v.Color;const t=()=>this._renderHUDElements(e),r=this._framebufferSize,s=this.fboCache.acquireDepth(D.DEPTH16_BUFFER,r.width,r.height,"hud");this.renderToTargets(t,this._framebuffer.color,s,void 0,!0,!0),s.release()}else this._renderContext.output=v.Color,t.acquireDepth(D.DEPTH16_BUFFER),this._rctx.bindFramebuffer(t.fbo),this._renderHUDElements(e),t.detachDepth();this.performanceInfo.advance(e===L.Occluded?fe.HUD_OCCLUDED:fe.HUD)}}_renderHUDElements(e){this._bindParameters.hudRenderStyle=e,this._plugins.prepare(ae.LINE_CALLOUTS_HUD_DEPTH,ae.HUD_MATERIAL,ae.LABEL_MATERIAL),this._plugins.render(this._pluginInput,ae.LINE_CALLOUTS_HUD_DEPTH,ae.HUD_MATERIAL,ae.LABEL_MATERIAL)}get _needsShadowHighlight(){return this._shadowMap.enabled&&this._plugins.produces(v.ShadowHighlight,ae.OPAQUE_MATERIAL)}_renderHighlightPrepass(){if(!this.hasHighlights)return;const{fboCache:e,_rctx:t,_bindParameters:r}=this,s=this._framebufferSize;let a=this._pluginInput.get("highlight mix");null==a&&(a=e.acquire(s.width,s.height,"highlight mix",N.RGBA),this._pluginInput.set("highlight mix",a),r.highlightTexture=a.getTexture()),t.bindFramebuffer(a.fbo);const n=[0,0,0,0];t.clearFramebuffer(n);const h=a.getTexture(),o=e.acquire(s.width,s.height,"highlights",N.RGBA);o.acquireDepth(D.DEPTH16_BUFFER),t.bindFramebuffer(o.fbo),t.clearFramebuffer(n,!0);const{highlights:d}=this._stage.view,l=i(d.length,1,16),{highlightGroupMap:_}=r;_.clear(),_.set(ge,0);for(let i=1;i<l;++i){const e=d.at(i-1)?.name;e&&_.set(e,i)}for(let i=0;i<l;++i)r.highlightLevel=i,r.highlightGroup=0===i?ge:d.at(i-1).name,t.bindFramebuffer(o.fbo),t.clearFramebuffer(void 0,!0),this._renderAllGeometry(v.Highlight),0===i&&(t.clear(Pe.DEPTH),this._renderHUDElements(L.Both)),t.clear(Pe.DEPTH),t.bindTexture(h,0),t.gl.copyTexImage2D(Re.TEXTURE_2D,0,Ee.RGBA,0,0,s.width,s.height,0);return o}get _needsShadowCast(){return this._shadowAccumulator.isAccumulating}_renderShadowAccumulation(e,t,r){this._needsShadowCast&&this._bindParameters.depth&&this._shadowAccumulator.renderAccumulation(this._bindParameters.depth,e,t,r)&&this.performanceInfo.advance(fe.ACCUMULATED_SHADOWS)}_prepareTransparencySlots(e){this._renderContext.output=e,this._bindParameters.transparencyPassType=le.ColorAlpha,this._plugins.prepare(...ye),this._bindParameters.transparencyPassType=le.FrontFace,this._plugins.prepare(...ye),this._bindParameters.transparencyPassType=le.NONE,this._techniques.acquire(ce).release()}_renderOITPass(e,t,r=L.Both){const s=e===we.HUD,i=this._framebufferSize,a=s?this.fboCache.acquire(i.width,i.height,"oit hud composite"):null,n=s?()=>this._renderHUDElements(r):()=>this._renderTransparentMaterial(),h=this._renderContext.output;return this._renderContext.output=t,this._renderOIT(this._bindParameters,n,a),this._renderContext.output=h,a}_renderOIT(e,t,r){const s=this._framebufferSize;e.transparencyPassType=le.ColorAlpha;const i=r?"oit hud color alpha":"oit color alpha",a=this.fboCache.acquire(s.width,s.height,i,N.RGBA16F);a.acquireColor(Se.COLOR_ATTACHMENT1,N.R16F),r||a.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(a.fbo),this._rctx.clearFramebuffer([0,0,0,1]),t(),a.detachDepth(),e.transparencyPassType=le.FrontFace;const n=this.fboCache.acquire(s.width,s.height,r?"oit hud front":"oit front");r?n.acquireDepth(D.DEPTH16_BUFFER):n.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(n.fbo),this._rctx.clearFramebuffer([0,0,0,0],!!r),t(),n.detachDepth(),e.transparencyPassType=le.NONE,r?(this._rctx.bindFramebuffer(r.fbo),this._rctx.setClearColor(0,0,0,1e-13),this._rctx.clear(Pe.COLOR)):this._framebuffer.bind(),this._compositingHelper.compositeOIT(e,a.getTexture(),a.getTexture(Se.COLOR_ATTACHMENT1),n.getTexture()),r?.detachDepth(),n.release(),a.release()}_renderOccluded(e){let t=0;De.clear(),this._plugins.plugins.forAll((e=>{if(!e.material)return;e.queryRenderOccludedState(K.OccludeAndTransparentStencil)&&(t|=K.OccludeAndTransparentStencil,De.push(e))}));const r=this._framebuffer,s=(e,s,i,a,n)=>{if(!(t&s))return;const h=this._framebufferSize,o=this.fboCache.acquire(h.width,h.height,"tmp color");let d;d=a?this.fboCache.acquireDepth(D.DEPTH_STENCIL_TEXTURE,h.width,h.height,"tmp depth"):r.depth,this.renderToTargets(i,o,d,[0,0,0,0],a,n),r.bind(),this._compositingHelper.composite(this._bindParameters,o.getTexture(),pe.PremultipliedAlpha,e),a&&d.release(),o.release()},i=(e,t)=>{this._bindParameters.slot=e,t.forAll((e=>{if(U(e)){const t=e.prepareTechnique(this._renderContext);t&&e.renderNode(this._renderContext,t)}}))};0!==De.length&&(i(ae.OCCLUDER_MATERIAL,De),s(.5,K.OccludeAndTransparentStencil,(()=>i(ae.TRANSPARENT_OCCLUDER_MATERIAL,De)),!1,!1));const a=De.length>0;De.clear(),this._plugins.plugins.forAll((e=>{if(!e.material)return;const r=e.queryRenderOccludedState(K.OccludeAndTransparent),s=e.queryRenderOccludedState(K.Transparent),i=e.queryRenderOccludedState(K.Opaque);(r||s||i)&&(t|=r?K.OccludeAndTransparent:s?K.Transparent:K.Opaque,De.push(e))}));const n=this._plugins.renderOccludedFlags;if(t|=n,!t)return;const h=e=>{this._renderContext.renderOccludedMask=e,n>K.Occlude&&this._plugins.render(this._pluginInput,ae.OCCLUDED_TERRAIN),i(ae.OPAQUE_MATERIAL,De),i(ae.TRANSPARENT_MATERIAL,De),i(ae.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL,De),this._renderContext.renderOccludedMask=Z};this._renderContext.output=e,s(.5,K.OccludeAndTransparent,(()=>h(K.OccludeAndTransparent)),!0,k.OutlineVisualElementMask),s(.5,K.Transparent,(()=>h(K.Transparent)),!0,k.OutlineVisualElementMask),s(1,K.Opaque,(()=>h(K.Opaque)),!0,k.OutlineVisualElementMask),(a||De.length>0)&&this.performanceInfo.advance(fe.OCCLUDED),De.clear()}_renderTransparentEnvironment(){this._shadowAccumulator.render(this._bindParameters),this._framebuffer.bind(),this._plugins.render(this._pluginInput,ae.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL,ae.TRANSPARENT_ENVIRONMENT),this.performanceInfo.advance(fe.TRANSPARENT_ENVIRONMENT)}_renderPlugins(e,t){this._plugins.produces(this._renderContext.output,e)&&(this._plugins.render(this._pluginInput,e),this.performanceInfo.advance(t))}_renderNodes(e,t,r=!1){if(t.setName(e),this._pluginInput.set(e,t),!this._nodes.produces(e))return r&&this.performanceInfo.advance(e),t;const s=this._nodes.render(t,this._pluginInput,this._releaseNormals);return this.performanceInfo.advance(e),s}_blitFBO(e,t=M,r=!0){return this._blit??=new G(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=E:(b(xe,this._bindParameters.camera.viewMatrix),b(Ne,this._bindParameters.camera.projectionMatrix),T(Me,xe,Ne),T(Me,this._renderContext.lastFrameCamera.viewMatrix,Me),T(Me,this._renderContext.lastFrameCamera.projectionMatrix,Me),this._reprojectionMatrix=Me);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=E,this._ssrEnableTime=null}addRenderNode(e){this._nodes.add(e),this._requestRender()}removeRenderNode(e){this._nodes.remove(e),this._requestRender()}get usedMemory(){return{fbos:this.fboCache.usedMemory,plugins:this._plugins.usedMemory,edges:this.edgeView?.usedMemory??0}}renderToTargets(e,t,r,s,i=!1,a=!1){t.attachDepth(r),this._rctx.bindFramebuffer(t.fbo),this._rctx.clearFramebuffer(s,i,a),e(),t.detachDepth()}get test(){}}var we;e([f({readOnly:!0})],Ce.prototype,"fullResolutionAtmosphere",null),e([f()],Ce.prototype,"_edgeView",void 0),e([f()],Ce.prototype,"updating",null),function(e){e[e.Geometry=0]="Geometry",e[e.HUD=1]="HUD"}(we||(we={}));const Oe=[0,0,0,0],Ie=[ae.INTEGRATED_MESH,ae.OPAQUE_TERRAIN,ae.OPAQUE_MATERIAL,ae.OPAQUE_NO_SSAO_DEPTH],ye=[ae.TRANSPARENT_MATERIAL,ae.TRANSPARENT_NO_SSAO_DEPTH],De=new d,Ne=A(),xe=A(),Me=A();function He(e){return t=>e.immediate.schedule(t)}export{Ce as Renderer};
5
+ import{_ as e}from"../../../../chunks/tslib.es6.js";import{update as t}from"../../../../core/arrayUtils.js";import{createTask as r}from"../../../../core/asyncUtils.js";import{unitRGBAFromColor as s}from"../../../../core/colorUtils.js";import has from"../../../../core/has.js";import{clamp as i}from"../../../../core/mathUtils.js";import{removeMaybe as a,abortMaybe as n,destroyMaybe as h,releaseMaybe as o}from"../../../../core/maybe.js";import d from"../../../../core/PooledArray.js";import{throwIfAborted as l}from"../../../../core/promiseUtils.js";import{watch as _,syncAndInitial as u,initial as p,sync as c}from"../../../../core/reactiveUtils.js";import{signal as m}from"../../../../core/signal.js";import{property as f}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import"../../../../core/accessorSupport/interfaces.js";import"../../../../core/accessorSupport/tracking/Flags.js";import"../../../../core/Warning.js";import"../../../../core/Error.js";import{equals as g,invert as b,multiply as T}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as E,create as A}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{s as P}from"../../../../chunks/vec42.js";import{fromValues as R,ZEROS as S}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{a as C}from"../../../../chunks/boundedPlane.js";import{InternalRenderCategory as w,RenderCategory as O}from"../../webgl.js";import{debugFlags as I}from"../../support/debugFlags.js";import{TransparencyMode as y}from"../../terrain/TransparencyMode.js";import{DepthFormat as D,ColorFormat as N}from"../../webgl/formats.js";import{FBOCache as x,defaultWebGLFBO as M}from"../core/FBOCache.js";import{RenderPassManager as H}from"../core/renderPasses/RenderPassManager.js";import{ShaderOutput as v,isColorOrColorEmission as L}from"../core/shaderLibrary/ShaderOutput.js";import{HUDRenderStyle as F}from"../core/shaderLibrary/hud/HUDRenderStyle.js";import{distanceFadeEnd as q}from"../core/shaderLibrary/shading/ScreenSpaceConstants.js";import{RenderNodes as U}from"../effects/RenderNodes.js";import{isPrepareRenderPlugin as j}from"../effects/RenderPlugin.js";import{RenderPluginManager as G}from"../effects/RenderPluginManager.js";import{Blit as V}from"../effects/blit/Blit.js";import{AnimationTimeStep as B}from"./AnimationTimeStep.js";import{Decorations as Q,RenderRequestType as k,StencilBits as z}from"./basicInterfaces.js";import{BoundingInfo as W}from"./BoundingInfo.js";import{zero as X,union as Y}from"./depthRange.js";import{depthRangeFromScene as J}from"./depthRangeUtils.js";import{MainFramebuffer as K}from"./MainFramebuffer.js";import{RenderOccludedFlag as $}from"./Material.js";import{RenderContext as Z,defaultRenderOccludedMask as ee}from"./RenderContext.js";import{splitRenderGeometryChangeSetByMaterial as te,RendererTarget as re}from"./rendererUtils.js";import{setupFeatureDefaults as se,RenderFeature as ie}from"./RenderFeature.js";import{RenderPluginInput as ae}from"./RenderPluginInput.js";import{RenderSlot as ne}from"./RenderSlot.js";import{ShadowAccumulator as he}from"./ShadowAccumulator.js";import{ShadowMap as oe,SnapshotSlot as de}from"./ShadowMap.js";import le from"./SliceHelper.js";import{TransparencyPassType as _e}from"./TransparencyPassType.js";import{Transparency as ue}from"./edgeRendering/interfaces.js";import{MergedRenderer as pe}from"../materials/renderers/MergedRenderer.js";import{AlphaMode as ce}from"../shaders/CompositingTechniqueConfiguration.js";import{OITCompositingTechnique as me}from"../shaders/OITCompositingTechnique.js";import{RendererPerformanceInfo as fe,PerformanceCategory as ge}from"../statistics/RendererPerformanceInfo.js";import{defaultHighlightName as be}from"../../../support/HighlightDefaults.js";import{RenderState as Te}from"../../../support/RenderState.js";import{DepthStencilAttachment as Ee,PixelFormat as Ae,PixelType as Pe,FramebufferBit as Re,TextureType as Se,ColorAttachment as Ce}from"../../../webgl/enums.js";class we{constructor(e,t,r,i,a,n){this._stage=e,this._techniques=r,this._rctx=i,this._compositingHelper=a,this._requestRender=n,this._pluginsHas={hudElements:!1,water:!1},this._hasOverlayWater=!1,this.renderOverlay=e=>{},this._renderers=new Map,this._isRendering=!1,this._inGlobeView=!1,this._backgroundColor=R(0,0,0,1),this._sliceHelper=new le,this._blit=null,this._state=m(Te.IDLE),this._highQualityTransparencyEnabled=!0,this._terrainTransparency=y.Opaque,this._ssrEnabled=!1,this._hasAnimations=!1,this._animationTimestep=new B,this._loadEdgeViewTask=null,this._edgeViewCallbacks=[],this._reprojectionMatrixVersion=m(0),this._renderHiddenTransparentEdges=()=>{},this._pluginInput=new ae,this._releaseNormals=e=>{e.some((({name:e})=>"normals"===e))&&this._pluginInput.release("normals")},this._debugNeedsDepth=!1,this.fboCache=new x(i),this._renderStateFeatures=m(se(!has("disable-feature:high-quality-idle"),e.view.qualityProfile)),this._framebuffer=new K(this.fboCache),this.performanceInfo=new fe(this._rctx),this._shadowMap=new oe(this.fboCache,e.viewingMode),this._shadowAccumulator=new he(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}),((e,t,r)=>{const s=this._stage.view.qualitySettings.maximumPixelRatio;e.shadowMap.start(e.camera,t,r,!0,s),this._renderShadowCascades(v.Shadow,e.shadowMap),e.shadowMap.finish(),e.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(e.camera,e.contentCamera)}),n),this._renderContext=new Z(this._rctx,this._shadowMap,this._sliceHelper),this._nodes=new U(this._renderContext),this._plugins=new G({renderContext:this._renderContext,techniques:r,materials:t,requestRender:n,controller:e,fbos:this.fboCache,isFeatureEnabled:e=>this.isFeatureEnabled(e)}),this.renderPassManager=new H,this._plugins.add(this.renderPassManager),this._handles=[_((()=>this._stage.view.state.camera),(()=>n()),u),_((()=>I.EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES),(e=>{this._renderHiddenTransparentEdges=e?()=>this._renderEdges(ue.TRANSPARENT):()=>{},n()}),p),_((()=>this._stage.view.environment.background?.color),(e=>{const t=e?s(e):S;P(this._backgroundColor,t[0]*t[3],t[1]*t[3],t[2]*t[3],t[3]),n()}),u),_((()=>this._stage.view.state.camera.relativeElevation),(e=>{this._inGlobeView=(e??1/0)>=q}),u)]}destroy(){this._handles.forEach((e=>e.remove())),this._gpuTimerHandle=a(this._gpuTimerHandle),this._nodes.destroy(),this._framebuffer.dispose(),this._shadowMap.dispose(),this._shadowAccumulator.dispose(),this._loadEdgeViewTask=n(this._loadEdgeViewTask),this._edgeView=h(this._edgeView),this.renderPassManager.dispose(),this._releaseFBOs(),this._disposeOffscreenBuffers(),this.fboCache.destroy(),this._plugins.destroy(),this._renderers.clear(),this._blit=h(this._blit),W.prune()}get _bindParameters(){return this._renderContext.bindParameters}get _framebufferSize(){return this._framebuffer.size}updateRenderFeatures(e=null,t=!has("disable-feature:high-quality-idle")){this._renderStateFeatures.value=se(t,e),this._plugins.renderFeatureChanged(),this._requestRender()}isFeatureEnabled(e,t=this._state.value){return this._renderStateFeatures.value.get(t,e)??!1}setFeatureEnabled(e,t,r){this._renderStateFeatures.mutate((s=>s.set(t,e,r))),this._requestRender()}get _highQualityTransparency(){return this._highQualityTransparencyEnabled||this.isFeatureEnabled(ie.HighQualityTransparency)}get hasReflections(){return(this._pluginsHas.water||this._hasOverlayWater)&&(this._ssrEnabled||this.isFeatureEnabled(ie.WaterReflection))}get hasDecorations(){return this._plugins.hasDecorations||this._nodes.produces("magnifier-color")}get hasHighlights(){return this._plugins.produces(v.Highlight,ne.OPAQUE_MATERIAL,ne.TRANSPARENT_MATERIAL,ne.DRAPED_MATERIAL)}get hasSSAO(){return(this._stage.view.qualitySettings.ambientOcclusion||this.isFeatureEnabled(ie.SSAO))&&!this._inGlobeView}get hasSMAA(){return this._stage.view.qualitySettings.antialiasingEnabled||this.isFeatureEnabled(ie.Antialiasing)}get fullResolutionAtmosphere(){return this._stage.view.qualitySettings.highResolutionAtmosphere||this.isFeatureEnabled(ie.HighResolutionAtmosphere)}_releaseFBOs(){this._bindParameters.ssr.lastFrameColor=o(this._bindParameters.ssr.lastFrameColor),this._bindParameters.multipassTerrain.depth=o(this._bindParameters.multipassTerrain.depth),this._bindParameters.multipassGeometry.depth=o(this._bindParameters.multipassGeometry.depth),this._pluginInput.release("highlight mix")}_disposeOffscreenBuffers(){this._framebuffer.dispose(),this._disposeBindBuffers()}_disposeBindBuffers(){this._shadowMap.disposeOffscreenBuffers(),this._bindParameters.depth=o(this._bindParameters.depth),this._bindParameters.hudVisibility=o(this._bindParameters.hudVisibility)}get updating(){return null!=this._edgeView&&this._edgeView.updating||this._shadowAccumulator.running||this._plugins.updating||!this.isCameraFinal}loadEdgeView(){return this._loadEdgeViewTask||(this._loadEdgeViewTask=r((async e=>{const{EdgeView:t}=await import("./edgeRendering/EdgeView.js");l(e);const r=this._edgeView=new t({rctx:this._rctx,renderSR:this._stage.view.renderSpatialReference,viewingMode:this._stage.viewingMode,techniques:this._techniques,setNeedsRender:()=>this._requestRender(),schedule:ve(this._stage.view.resourceController)});return this._handles.push(_((()=>r.updating),(()=>this._requestRender()),c)),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&&g(this._bindParameters.ssr.reprojectionMatrix,E)}set _reprojectionMatrix(e){t(this._bindParameters.ssr.reprojectionMatrix,e)&&this._reprojectionMatrixVersion.value++}get shadowsEnabled(){return!!this._shadowMap?.enabled}setParameters(e){const{_shadowMap:t,_bindParameters:r}=this;if(void 0!==e.qualitySettings?.reflections&&this._ssrEnabled!==e.qualitySettings.reflections&&(this._ssrEnabled=e.qualitySettings.reflections,this._requestRender()),void 0!==e.shadowMap&&this._shadowMap.enabled!==e.shadowMap&&(this._shadowMap.enabled=e.shadowMap,this._requestRender()),void 0!==e.shadowMapMaxCascades&&t.maxCascades!==e.shadowMapMaxCascades&&(t.maxCascades=e.shadowMapMaxCascades,this._requestRender()),null!=e.environment){null!=e.environment.weather&&(this._bindParameters.weather=e.environment.weather,this._bindParameters.weatherVisible=!!e.weatherVisible);const t="virtual"!==e.environment.lighting.type;r.enableFillLights!==t&&(r.enableFillLights=t,this._requestRender())}void 0!==e.highQualityTransparency&&this._highQualityTransparencyEnabled!==e.highQualityTransparency&&(this._highQualityTransparencyEnabled=e.highQualityTransparency,this._requestRender()),void 0!==e.hasOverlayWater&&this._hasOverlayWater!==e.hasOverlayWater&&(this._hasOverlayWater=e.hasOverlayWater,this._requestRender()),void 0!==e.slicePlane&&this._sliceHelper.plane!==e.slicePlane&&(this._sliceHelper.plane=e.slicePlane,this._requestRender()),void 0!==e.terrainTransparency&&this._terrainTransparency!==e.terrainTransparency&&(this._terrainTransparency=e.terrainTransparency,this._requestRender()),void 0!==e.shadowCast&&this._shadowAccumulator.setOptions(e.shadowCast)}get hasSlicePlane(){return!!this._sliceHelper.plane}get plugins(){return this._plugins}getMaterialRenderer(e){return this._renderers.get(e)}get _hasOITSupport(){return this._rctx.driverTest.floatBufferBlend.result}get _oitEnabled(){return this._highQualityTransparency&&this._hasOITSupport}modify(e,t){this._isRendering&&console.warn("Renderer.modify called while rendering");const{adds:r,removes:s,updates:i}=e;if(0===r.length&&0===s.length&&0===i.length)return;te(e).forEach(((r,s)=>{if(t.done)return;let i=this._renderers.get(s);null==i&&r.adds.length>0&&(i=new pe({material:s}),i.initializeRenderContext(this._plugins._context),this._plugins.add(i),this._renderers.set(s,i)),i&&(i.modify(r),0===i.numGeometries&&(this._renderers.delete(i.material),this._plugins.remove(i),i.destroy())),r.removes.forEach((t=>e.removes.removeUnordered(t))),r.adds.forEach((t=>e.adds.removeUnordered(t))),r.updates.forEach((t=>e.updates.removeUnordered(t))),t.madeProgress()})),this.updateHasFlags(),this._requestRender()}updateHasFlags(){const has=this._pluginsHas;has.hudElements=this._plugins.produces(v.Color,ne.LINE_CALLOUTS_HUD_DEPTH,ne.HUD_MATERIAL,ne.LABEL_MATERIAL),has.water=this._plugins.produces(v.Normal,ne.DRAPED_WATER),this._bindParameters.hasOccludees=this._plugins.hasOccludees}updateAnimation(e){const t=this._hasAnimations;return this._hasAnimations=this._plugins.updateAnimation(e),this._hasAnimations=this._nodes.updateAnimation()||this._hasAnimations,this._hasAnimations!==t&&(this._gpuTimerHandle=t?a(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=re.Default,s=Q.ON){try{return this._isRendering=!0,this._render(e,t,r,s)}catch(i){console.error(`Exception during rendering: ${i}`)}finally{this._isRendering=!1}return{screen:this._pluginInput.get("final-color"),oid:null}}_render(e,t,r=re.Default,s=Q.ON){this.performanceInfo.startFrame(),this.fboCache.frameStart(),this.fboCache.interactive=r===re.Default,this._disposeBindBuffers();const i=this._framebuffer,{camera:a,contentCamera:n,mode:h,alignPixelEnabled:d}=e;this._state.value=h,this._bindParameters.overlay=this.renderOverlay(t),this._bindParameters.overlay&&this.performanceInfo.advance(ge.OVERLAY),this._renderContext.time=t,this._bindParameters.transparencyPassType=_e.NONE,this._bindParameters.alignPixelEnabled=d,this._bindParameters.decorations=s,this._bindParameters.mainDepth=null,this._bindParameters.viewshedEnabled=this._nodes.produces(w.VIEWSHED);const l=this._nodes.produces("magnifier-color"),_=this._nodes.produces("final-color"),u=C(this._sliceHelper.plane);s===Q.OFF&&(this._sliceHelper.plane=null),a.setGLViewport(this._rctx);const p=this._nodes.require("composite-color:emissions","composite-color:emissions")>0&&this._plugins.hasEmissions,c=p?v.ColorEmission:v.Color,m=i.initialize(a.fullWidth,a.fullHeight,this._backgroundColor,p);this.hasReflections?this._bindParameters.ssr.lastFrameColor=m:m?.release(),this._ensureBindParametersCamera(a,n),this._plugins.prepareRender(),this._bindParameters.shadowHighlightsVisible=this._needsShadowHighlight&&s===Q.ON;const f=this._plugins.produces(v.Color,ne.OPAQUE_TERRAIN)&&(this._terrainTransparency===y.Transparent||this._terrainTransparency===y.InvisibleWithDraped),g=this._highQualityTransparency&&f,b=this._plugins.produces(v.Color,...De);this._prepareShaders(g,b,c),this.performanceInfo.advance(ge.PREPARE);const T=this._computeDepthRange(a);this._renderShadowMap(a,this._bindParameters.lighting.mainLight.direction,T),this._ensureBindParametersCamera(a,n);let E=this._renderNormals();this._pluginInput.set("normals",E);const A=this._needsDepth;if(E){let e=null;A&&(e=E.getAttachment(Ee),e?.retain()),this._pluginInput.set("ssao",this._renderSSAO()),this._renderNoSSAOGeometryDepth(A,e),E=null}else this._renderAllGeometryDepth(A);this._renderShadowAccumulation(T,a,n),this._ensureBindParametersSSR(t),this._renderContext.output=c,i.bind(),this._bindParameters.mainDepth=i.depth.attachment;const P=this.plugins.produces(v.Color,...ye);P&&this._renderOpaqueGeometry(),i.update((e=>this._renderNodes(O.OPAQUE,e,P))),this.fboCache.debugCallback?.("opaque-color",i.color.fbo),this._renderPlugins(ne.OPAQUE_ENVIRONMENT,ge.OPAQUE_ENVIRONMENT),this._renderMultipassTerrainDepth(g),this._setMultipassTerrain(g),this._renderEdges(ue.OPAQUE),i.bind(),this._renderPlugins(ne.VOXEL,ge.VOXEL),this._renderHiddenTransparentEdges(),b&&(this._oitEnabled?this._renderOITPass(Oe.Geometry,c):this._renderTransparentMaterial()),i.update((e=>this._renderNodes(O.TRANSPARENT,e,b))),this.fboCache.debugCallback?.("transparent-color",i.color.fbo),this._renderMultipassGeometryDepth(g),this._renderHUDVisibility(),g||this._plugins.render(this._pluginInput,ne.LINE_CALLOUTS);const R=r===re.ObjectAndLayerID?this._renderObjectAndLayerIdColor():null;this._renderEdges(ue.TRANSPARENT);const S=f?this._renderTransparentTerrain():null;S&&(this.performanceInfo.advance(ge.TRANSPARENT_TERRAIN),this._bindParameters.hudVisibility&&(g?this._renderLineCallouts(F.Occluded):(this._rctx.bindFramebuffer(this._bindParameters.hudVisibility?.fbo),this._compositingHelper.compositeHUD(this._bindParameters,S.getTexture())),this._renderHUD(F.Occluded,i.color,c))),this._setTerrainCulling(!1),S&&(i.bind(),this._compositingHelper.composite(this._bindParameters,S.getTexture(),ce.PremultipliedAlpha),S.release(),g&&(this._renderEdges(ue.OPAQUE),b&&(this._oitEnabled?this._renderOITPass(Oe.Geometry,c):this._renderTransparentMaterial(),this.performanceInfo.advance(ge.TRANSPARENT)),this._renderEdges(ue.TRANSPARENT))),this._bindParameters.ssao=o(this._bindParameters.ssao),g&&this._renderLineCallouts(F.NotOccluded),this._setMultipassEnabled(!1),this._renderTransparentEnvironment(),i.update((e=>this._renderNodes(w.VIEWSHED,e))),i.update((e=>this._renderNodes(w.LASERLINES,e))),this._renderOccluded(c),this._pluginInput.set("highlights",this._renderHighlightPrepass()),i.update((e=>this._renderNodes(p?O.COMPOSITE_EMISSIONS:O.COMPOSITE,e)));const I=!(r!==re.Default||_||l&&s===Q.ON&&r===re.Default),D=this._pluginInput.get(p?"composite-color:emissions":"composite-color");p&&(D.setName("composite-color"),this._pluginInput.set("composite-color",D));const N=I?M:this.fboCache.acquire(D.fbo.width,D.fbo.height,"aa-color"),x=this._nodes.produces("aa-color")?this._renderNodes(w.ANTIALIASING,N):this._blitFBO(D,N,!1);this._pluginInput.set(w.ANTIALIASING,x),this._renderHUD(F.NotOccluded,x,c);const H=this._renderNodes(w.HIGHLIGHTS,x),L=this._renderNodes(w.MAGNIFIER,H);return l&&s===Q.ON&&r===re.Default&&!_&&this._blitFBO(L),_?(L.attachDepth(i.depth),this._blitFBO(this._renderNodes(O.FINAL,L)),L.detachDepth()):this._pluginInput.set(O.FINAL,L),this._pluginInput.release("highlights"),this.onPostRender&&this.onPostRender(),this._releaseFBOs(),i.releaseDepth(),this._renderContext.lastFrameCamera.copyFrom(this._bindParameters.camera),this._sliceHelper.plane=u,this.fboCache.frameEnd(),this.performanceInfo.finishFrame(),r!==re.Default&&(this._releaseFBOs(),this._disposeOffscreenBuffers()),{screen:this._pluginInput.get("final-color"),oid:R}}_prepareShaders(e,t,r){this._renderContext.output=r,this._prepareOpaqueGeometry(),this._setMultipassTerrain(e),this._plugins.prepare(ne.TRANSPARENT_TERRAIN),this._setMultipassTerrain(!1),e||this._plugins.prepare(ne.LINE_CALLOUTS),t&&this._prepareTransparencySlots(r),this._plugins.prepare(ne.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL,ne.TRANSPARENT_ENVIRONMENT),this._rctx.gl.flush()}_renderObjectAndLayerIdColor(){if(!has("enable-feature:objectAndLayerId-rendering"))return;const e=this._renderContext.output,t=this._framebufferSize,r=this.fboCache.acquire(t.width,t.height,"oid");return r.acquireDepth(D.DEPTH_STENCIL_TEXTURE),this._rctx.bindFramebuffer(r.fbo),this._rctx.clearFramebuffer([0,0,0,0],!0,!0),this._renderAllGeometry(v.ObjectAndLayerIdColor),this._rctx.bindFramebuffer(r.fbo),this._rctx.clearFramebuffer(void 0,!0,!0),this._bindParameters.hudRenderStyle=F.NotOccluded,this._plugins.render(this._pluginInput,ne.HUD_MATERIAL),this._renderContext.output=e,this.performanceInfo.advance(ge.OBJECT_AND_LAYER_ID_COLOR),r}finish(e){this._hasAnimations||this._animationTimestep.clear();const t=this.performanceInfo.gpuSamplingEnabled,r=e===k.BACKGROUND;if(r||t){const e=r?this.performanceInfo.elapsedTime:0;let s=0;t?s=this.performanceInfo.totalGPUTimeSampler.last:this._rctx.gl.finish();const i=Math.max(e,s);this._animationTimestep.frame(i,r)}}readDepthPixels(e,t){const{mainDepth:r,camera:s}=this._bindParameters;if(!r)return;const i=this.fboCache.acquire(this._framebufferSize.width,this._framebufferSize.height,"linear-depth");this._rctx.bindFramebuffer(i.fbo),s.setGLViewport(this._rctx),this._rctx.setScissorRect(e[0],e[1],e[2],e[3]),this._rctx.setScissorTestEnabled(!0),this._rctx.clearFramebuffer([0,0,0,0]),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),i.fbo?.readPixels(e[0],e[1],e[2],e[3],Ae.RGBA,Pe.UNSIGNED_BYTE,t),i.release()}readHUDVisibility(e,t,r,s,i){this._bindParameters.hudVisibility?.fbo?.readPixels(e,t,r,s,Ae.RGBA,Pe.UNSIGNED_BYTE,i)}readAccumulatedShadow(e){return this._shadowAccumulator.readAccumulatedShadow(e[0],e[1])}_setMultipassTerrain(e){this._setMultipassEnabled(e),this._setTerrainCulling(e)}_setMultipassEnabled(e){this._bindParameters.multipassEnabled=e}_setTerrainCulling(e){this._bindParameters.multipassTerrain.cullAboveGround=e}_renderEdges(e){const t=this._edgeView;if(!t?.shouldRender())return;const r=this._framebufferSize,s=this.fboCache.acquire(r.width,r.height,"edges"),i=()=>t.render(this._bindParameters,e),a=this._bindParameters.multipassGeometry.depth;this.renderToTargets(i,s,a??this._framebuffer.depth,Ie),this._framebuffer.bind(),this._compositingHelper.composite(this._bindParameters,s.getTexture(),ce.Alpha),s.release(),this.performanceInfo.advance(e===ue.OPAQUE?ge.OPAQUE_EDGES:ge.TRANSPARENT_EDGES)}_renderShadowMap(e,t,r){const s=this._shadowMap;s.enabled&&(s.start(e,t,r,this.isFeatureEnabled(ie.HighResolutionShadows),this._stage.view.qualitySettings.maximumPixelRatio),this._needsShadowHighlight?(this._renderShadowCascades(v.ShadowHighlight,this._shadowMap),s.moveSnapshot(de.Highlight),this._renderShadowCascades(v.ShadowExcludeHighlight,this._shadowMap),s.copySnapshot(de.ExcludeHighlight),this._renderShadowCascades(v.ShadowHighlight,this._shadowMap)):this._renderShadowCascades(v.Shadow),s.finish(),e.setGLViewport(this._rctx),this.performanceInfo.advance(ge.SHADOW_MAP))}_renderShadowCascades(e,t=this._shadowMap){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(v.Depth)||this._nodes.requireGeometryDepth()||this.hasReflections||this._needsShadowHighlight||this._needsShadowCast||this._debugNeedsDepth}_renderNoSSAOGeometryDepth(e,t){if(!e||!t)return void(this._bindParameters.depth=o(this._bindParameters.depth));const r=this._framebufferSize,s=this.fboCache.acquire(r.width,r.height,"depth");s.attachDepth(t),t.release(),this._rctx.bindFramebuffer(s.fbo),this._rctx.clearFramebuffer(void 0,!1,!0),this._renderGeometryExcludedFromSSAO(v.Depth),o(this._bindParameters.depth),this._bindParameters.depth=s.obtainDepthTexture(),s.release(),this.performanceInfo.advance(ge.DEPTH)}_renderAllGeometryDepth(e){if(!e)return void(this._bindParameters.depth=o(this._bindParameters.depth));const t=this._framebufferSize,r=this.fboCache.acquire(t.width,t.height,"depth").acquireDepth(D.DEPTH_STENCIL_TEXTURE);this._rctx.bindFramebuffer(r.fbo),this._rctx.clearFramebuffer(void 0,!0,!0),this._renderAllGeometry(v.Depth),o(this._bindParameters.depth),this._bindParameters.depth=r.obtainDepthTexture(),r.release(),this.performanceInfo.advance(ge.DEPTH)}_renderMultipassTerrainDepth(e){if(!e)return void(this._bindParameters.multipassTerrain.depth=o(this._bindParameters.multipassTerrain.depth));const t=this._renderContext.output;this._renderContext.output=v.Depth;const r=this._framebufferSize,s=this.fboCache.acquire(r.width,r.height,"terrain depth").acquireDepth(D.DEPTH_STENCIL_TEXTURE);this._rctx.bindFramebuffer(s.fbo),this._rctx.clearFramebuffer(void 0,!0,!0),this._renderTransparentTerrain(),o(this._bindParameters.multipassTerrain.depth),this._bindParameters.multipassTerrain.depth=s.obtainDepthTexture(),this._renderContext.output=t,s.release()}_renderMultipassGeometryDepth(e){if(!e)return void(this._bindParameters.multipassGeometry.depth=o(this._bindParameters.multipassGeometry.depth));const t=this._renderContext.output,r=this._framebufferSize,s=this.fboCache.acquire(r.width,r.height,"geometry depth").acquireDepth(D.DEPTH_STENCIL_TEXTURE);this._rctx.bindFramebuffer(s.fbo),this._rctx.clearFramebuffer(void 0,!0,!0),this._renderOpaqueGeometryAndTransparentMaterial(v.Depth),this._renderContext.output=t,o(this._bindParameters.multipassGeometry.depth),this._bindParameters.multipassGeometry.depth=s.obtainDepthTexture(),s.release()}get _needsDepthRange(){return this._shadowMap.enabled||this._needsShadowCast}_computeDepthRange(e){if(!this._needsDepthRange)return X;const t=J(e,this._plugins.plugins,this._stage.layers);return Y(t,this._plugins.queryDepthRange(e)),t.near=Math.max(e.near,t.near),t.far=Math.min(e.far,t.far),t}_renderNormals(){const e=this._nodes.require("normals","final-color","composite-color","opaque-color","transparent-color","laserline-color"),t=(this.hasSSAO?1:0)+e;if(0===t)return;const r=this._framebufferSize,s=this.fboCache.acquire(r.width,r.height,"normals",N.RGBA);s.acquireDepth(D.DEPTH_STENCIL_TEXTURE),this._rctx.bindFramebuffer(s.fbo),this._rctx.clearFramebuffer([0,0,0,0],!0,!0),this._renderGeometryForSSAO(v.Normal);const i=this._nodes.optional("normals","final-color","composite-color","opaque-color","transparent-color","viewshed-color");return s.retain(t+i-1),this.performanceInfo.advance(ge.NORMALS),s}_renderSSAO(){const e=this._pluginInput.get("normals");if(!this.hasSSAO||!e)return void e?.detachDepth();M.setName("ssao");const t=this._nodes.render(M,this._pluginInput);return this._bindParameters.ssao=t,e.detachDepth(),this._pluginInput.release("normals"),this.performanceInfo.advance(ge.SSAO),t}_renderAllGeometry(e){this._renderContext.output=e,this._plugins.prepare(ne.TRANSPARENT_TERRAIN),this._renderOpaqueGeometryAndTransparentMaterial(e),this._renderTransparentTerrain()}renderAllGeometryForShadowMap(e,t){const{camera:r,contentCamera:s}=this._bindParameters;t.setGLViewport(this._rctx),this._ensureBindParametersCamera(t,t),this._renderAllGeometry(e),this._ensureBindParametersCamera(r,s),this._bindParameters.camera.setGLViewport(this._rctx)}_renderOpaqueGeometryAndTransparentMaterial(e){this._renderContext.output=e,this._plugins.prepare(ne.TRANSPARENT_MATERIAL,ne.TRANSPARENT_NO_SSAO_DEPTH),this._renderOpaqueGeometry(),this._renderTransparentMaterial()}_renderGeometryForSSAO(e){this._renderContext.output=e,this._plugins.render(this._pluginInput,ne.INTEGRATED_MESH,ne.OPAQUE_TERRAIN,ne.OPAQUE_MATERIAL,ne.TRANSPARENT_MATERIAL),this._renderTransparentTerrain()}_renderGeometryExcludedFromSSAO(e){this._renderContext.output=e,this._plugins.render(this._pluginInput,ne.OPAQUE_NO_SSAO_DEPTH,ne.TRANSPARENT_NO_SSAO_DEPTH)}_prepareOpaqueGeometry(){this._plugins.prepare(...ye,ne.OPAQUE_ENVIRONMENT)}_renderOpaqueGeometry(){this._plugins.render(this._pluginInput,...ye)}_renderTransparentMaterial(){this._plugins.render(this._pluginInput,...De)}_renderTransparentTerrain(){const e=this._renderContext.output;if(!this._plugins.produces(e,ne.TRANSPARENT_TERRAIN))return;const t=()=>this._plugins.render(this._pluginInput,ne.TRANSPARENT_TERRAIN);if(!L(e))return void t();const r=this._framebufferSize,s=this.fboCache.acquire(r.width,r.height,"transparent terrain");return this.renderToTargets(t,s,this._framebuffer.depth,[0,0,0,0]),s}_renderHUDVisibility(){if(this._plugins.produces(this._renderContext.output,ne.OCCLUSION_PIXELS)){const e=()=>{const e=this._framebufferSize;let t=this._bindParameters.hudVisibility;const r=this._bindParameters.multipassGeometry.depth;return t?.fbo?.width===e.width&&t?.fbo?.height===e.height||(t?.release(),t=this.fboCache.acquire(e.width,e.height,"hud visibility",N.RGBA4)),t.attachDepth(r||this._framebuffer.depth),this._rctx.bindFramebuffer(t.fbo),this._rctx.clearFramebuffer([0,1,0,1]),this._plugins.render(this._pluginInput,ne.OCCLUSION_PIXELS),t.detachDepth(),t};this._bindParameters.hudVisibility=e(),this._framebuffer.bind(),this.performanceInfo.advance(ge.HUD_VISIBILITY)}else this._bindParameters.hudVisibility=o(this._bindParameters.hudVisibility)}_renderLineCallouts(e){if(this._bindParameters.hudRenderStyle=e,e===F.Occluded){const e=()=>this._plugins.render(this._pluginInput,ne.LINE_CALLOUTS),t=this._framebufferSize,r=this.fboCache.acquireDepth(D.DEPTH16_BUFFER,t.width,t.height,"line callouts");this.renderToTargets(e,this._framebuffer.color,r,void 0,!0,!0),r.release()}else this._plugins.render(this._pluginInput,ne.LINE_CALLOUTS)}_renderHUD(e,t,r){if(this._pluginsHas.hudElements){if(this._oitEnabled){const s=this._renderOITPass(Oe.HUD,r,e);this._rctx.bindFramebuffer(t.fbo),this._compositingHelper.composite(this._bindParameters,s.getTexture(),ce.PremultipliedAlpha),s.release()}else if(e===F.Occluded){this._renderContext.output=v.Color;const t=()=>this._renderHUDElements(e),r=this._framebufferSize,s=this.fboCache.acquireDepth(D.DEPTH16_BUFFER,r.width,r.height,"hud");this.renderToTargets(t,this._framebuffer.color,s,void 0,!0,!0),s.release()}else this._renderContext.output=v.Color,t.acquireDepth(D.DEPTH16_BUFFER),this._rctx.bindFramebuffer(t.fbo),this._renderHUDElements(e),t.detachDepth();this.performanceInfo.advance(e===F.Occluded?ge.HUD_OCCLUDED:ge.HUD)}}_renderHUDElements(e){this._bindParameters.hudRenderStyle=e,this._plugins.prepare(ne.LINE_CALLOUTS_HUD_DEPTH,ne.HUD_MATERIAL,ne.LABEL_MATERIAL),this._plugins.render(this._pluginInput,ne.LINE_CALLOUTS_HUD_DEPTH,ne.HUD_MATERIAL,ne.LABEL_MATERIAL)}get _needsShadowHighlight(){return this._shadowMap.enabled&&this._plugins.produces(v.ShadowHighlight,ne.OPAQUE_MATERIAL)}_renderHighlightPrepass(){if(!this.hasHighlights)return;const{fboCache:e,_rctx:t,_bindParameters:r}=this,s=this._framebufferSize;let a=this._pluginInput.get("highlight mix");null==a&&(a=e.acquire(s.width,s.height,"highlight mix",N.RGBA),this._pluginInput.set("highlight mix",a),r.highlightTexture=a.getTexture()),t.bindFramebuffer(a.fbo);const n=[0,0,0,0];t.clearFramebuffer(n);const h=a.getTexture(),o=e.acquire(s.width,s.height,"highlights",N.RGBA);o.acquireDepth(D.DEPTH16_BUFFER),t.bindFramebuffer(o.fbo),t.clearFramebuffer(n,!0);const{highlights:d}=this._stage.view,l=i(d.length,1,16),{highlightGroupMap:_}=r;_.clear(),_.set(be,0);for(let i=1;i<l;++i){const e=d.at(i-1)?.name;e&&_.set(e,i)}for(let i=0;i<l;++i)r.highlightLevel=i,r.highlightGroup=0===i?be:d.at(i-1).name,t.bindFramebuffer(o.fbo),t.clearFramebuffer(void 0,!0),this._renderAllGeometry(v.Highlight),0===i&&(t.clear(Re.DEPTH),this._renderHUDElements(F.Both)),t.clear(Re.DEPTH),t.bindTexture(h,0),t.gl.copyTexImage2D(Se.TEXTURE_2D,0,Ae.RGBA,0,0,s.width,s.height,0);return o}get _needsShadowCast(){return this._shadowAccumulator.isAccumulating}_renderShadowAccumulation(e,t,r){this._needsShadowCast&&this._bindParameters.depth&&this._shadowAccumulator.renderAccumulation(this._bindParameters.depth,e,t,r)&&this.performanceInfo.advance(ge.ACCUMULATED_SHADOWS)}_prepareTransparencySlots(e){this._renderContext.output=e,this._bindParameters.transparencyPassType=_e.ColorAlpha,this._plugins.prepare(...De),this._bindParameters.transparencyPassType=_e.FrontFace,this._plugins.prepare(...De),this._bindParameters.transparencyPassType=_e.NONE,this._techniques.acquire(me).release()}_renderOITPass(e,t,r=F.Both){const s=e===Oe.HUD,i=this._framebufferSize,a=s?this.fboCache.acquire(i.width,i.height,"oit hud composite"):null,n=s?()=>this._renderHUDElements(r):()=>this._renderTransparentMaterial(),h=this._renderContext.output;return this._renderContext.output=t,this._renderOIT(this._bindParameters,n,a),this._renderContext.output=h,a}_renderOIT(e,t,r){const s=this._framebufferSize;e.transparencyPassType=_e.ColorAlpha;const i=r?"oit hud color alpha":"oit color alpha",a=this.fboCache.acquire(s.width,s.height,i,N.RGBA16F);a.acquireColor(Ce.COLOR_ATTACHMENT1,N.R16F),r||a.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(a.fbo),this._rctx.clearFramebuffer([0,0,0,1]),t(),a.detachDepth(),e.transparencyPassType=_e.FrontFace;const n=this.fboCache.acquire(s.width,s.height,r?"oit hud front":"oit front");r?n.acquireDepth(D.DEPTH16_BUFFER):n.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(n.fbo),this._rctx.clearFramebuffer([0,0,0,0],!!r),t(),n.detachDepth(),e.transparencyPassType=_e.NONE,r?(this._rctx.bindFramebuffer(r.fbo),this._rctx.setClearColor(0,0,0,1e-13),this._rctx.clear(Re.COLOR)):this._framebuffer.bind(),this._compositingHelper.compositeOIT(e,a.getTexture(),a.getTexture(Ce.COLOR_ATTACHMENT1),n.getTexture()),r?.detachDepth(),n.release(),a.release()}_renderOccluded(e){let t=0;Ne.clear(),this._plugins.plugins.forAll((e=>{if(!e.material)return;e.queryRenderOccludedState($.OccludeAndTransparentStencil)&&(t|=$.OccludeAndTransparentStencil,Ne.push(e))}));const r=this._framebuffer,s=(e,s,i,a,n)=>{if(!(t&s))return;const h=this._framebufferSize,o=this.fboCache.acquire(h.width,h.height,"tmp color");let d;d=a?this.fboCache.acquireDepth(D.DEPTH_STENCIL_TEXTURE,h.width,h.height,"tmp depth"):r.depth,this.renderToTargets(i,o,d,[0,0,0,0],a,n),r.bind(),this._compositingHelper.composite(this._bindParameters,o.getTexture(),ce.PremultipliedAlpha,e),a&&d.release(),o.release()},i=(e,t)=>{this._bindParameters.slot=e,t.forAll((e=>{if(j(e)){const t=e.prepareTechnique(this._renderContext);t&&e.renderNode(this._renderContext,t)}}))};0!==Ne.length&&(i(ne.OCCLUDER_MATERIAL,Ne),s(.5,$.OccludeAndTransparentStencil,(()=>i(ne.TRANSPARENT_OCCLUDER_MATERIAL,Ne)),!1,!1));const a=Ne.length>0;Ne.clear(),this._plugins.plugins.forAll((e=>{if(!e.material)return;const r=e.queryRenderOccludedState($.OccludeAndTransparent),s=e.queryRenderOccludedState($.Transparent),i=e.queryRenderOccludedState($.Opaque);(r||s||i)&&(t|=r?$.OccludeAndTransparent:s?$.Transparent:$.Opaque,Ne.push(e))}));const n=this._plugins.renderOccludedFlags;if(t|=n,!t)return;const h=e=>{this._renderContext.renderOccludedMask=e,n>$.Occlude&&this._plugins.render(this._pluginInput,ne.OCCLUDED_TERRAIN),i(ne.OPAQUE_MATERIAL,Ne),i(ne.TRANSPARENT_MATERIAL,Ne),i(ne.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL,Ne),this._renderContext.renderOccludedMask=ee};this._renderContext.output=e,s(.5,$.OccludeAndTransparent,(()=>h($.OccludeAndTransparent)),!0,z.OutlineVisualElementMask),s(.5,$.Transparent,(()=>h($.Transparent)),!0,z.OutlineVisualElementMask),s(1,$.Opaque,(()=>h($.Opaque)),!0,z.OutlineVisualElementMask),(a||Ne.length>0)&&this.performanceInfo.advance(ge.OCCLUDED),Ne.clear()}_renderTransparentEnvironment(){this._shadowAccumulator.render(this._bindParameters),this._framebuffer.bind(),this._plugins.render(this._pluginInput,ne.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL,ne.TRANSPARENT_ENVIRONMENT),this.performanceInfo.advance(ge.TRANSPARENT_ENVIRONMENT)}_renderPlugins(e,t){this._plugins.produces(this._renderContext.output,e)&&(this._plugins.render(this._pluginInput,e),this.performanceInfo.advance(t))}_renderNodes(e,t,r=!1){if(t.setName(e),this._pluginInput.set(e,t),!this._nodes.produces(e))return r&&this.performanceInfo.advance(e),t;const s=this._nodes.render(t,this._pluginInput,this._releaseNormals);return this.performanceInfo.advance(e),s}_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=E:(b(Me,this._bindParameters.camera.viewMatrix),b(xe,this._bindParameters.camera.projectionMatrix),T(He,Me,xe),T(He,this._renderContext.lastFrameCamera.viewMatrix,He),T(He,this._renderContext.lastFrameCamera.projectionMatrix,He),this._reprojectionMatrix=He);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=E,this._ssrEnableTime=null}addRenderNode(e){this._nodes.add(e),this._requestRender()}removeRenderNode(e){this._nodes.remove(e),this._requestRender()}get usedMemory(){return{fbos:this.fboCache.usedMemory,plugins:this._plugins.usedMemory,edges:this.edgeView?.usedMemory??0}}renderToTargets(e,t,r,s,i=!1,a=!1){t.attachDepth(r),this._rctx.bindFramebuffer(t.fbo),this._rctx.clearFramebuffer(s,i,a),e(),t.detachDepth()}get test(){}}var Oe;e([f({readOnly:!0})],we.prototype,"fullResolutionAtmosphere",null),e([f()],we.prototype,"_edgeView",void 0),e([f()],we.prototype,"updating",null),function(e){e[e.Geometry=0]="Geometry",e[e.HUD=1]="HUD"}(Oe||(Oe={}));const Ie=[0,0,0,0],ye=[ne.INTEGRATED_MESH,ne.OPAQUE_TERRAIN,ne.OPAQUE_MATERIAL,ne.OPAQUE_NO_SSAO_DEPTH],De=[ne.TRANSPARENT_MATERIAL,ne.TRANSPARENT_NO_SSAO_DEPTH],Ne=new d,xe=A(),Me=A(),He=A();function ve(e){return t=>e.immediate.schedule(t)}export{we as Renderer};