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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (273) hide show
  1. package/assets/esri/core/workers/RemoteClient.js +1 -1
  2. package/assets/esri/core/workers/chunks/063045ac5553e91c0c4c.js +1 -0
  3. package/assets/esri/core/workers/chunks/{20ad34f9d45c64392022.js → 08c1ea29678da27136f3.js} +1 -1
  4. package/assets/esri/core/workers/chunks/{5dc2f2e28c30386efadf.js → 10094eb2b94e98dd4a8a.js} +1 -1
  5. package/assets/esri/core/workers/chunks/169be08394c5e7703628.js +1 -0
  6. package/assets/esri/core/workers/chunks/1a6f3531ef3d671e0289.js +1 -0
  7. package/assets/esri/core/workers/chunks/{b809d499ff050976d9ed.js → 1c58064ea80e6a4a4a3b.js} +1 -1
  8. package/assets/esri/core/workers/chunks/1c816aff8613d1e4bf38.js +1 -0
  9. package/assets/esri/core/workers/chunks/{ee67c8a7c1f8b482cd99.js → 1ced78750c61600b2d4e.js} +1 -1
  10. package/assets/esri/core/workers/chunks/{98175b454e807b1a3c5f.js → 1e152a34e368bd810a0f.js} +1 -1
  11. package/assets/esri/core/workers/chunks/1e17ad6cdffa5016a3db.js +1 -0
  12. package/assets/esri/core/workers/chunks/1e2d42e9984ed3437ba2.js +1 -0
  13. package/assets/esri/core/workers/chunks/2008b22f76071a2dde4e.js +1 -0
  14. package/assets/esri/core/workers/chunks/2107c93d1fe87f3b8dfa.js +1 -0
  15. package/assets/esri/core/workers/chunks/2209550b6510e25da375.js +1 -0
  16. package/assets/esri/core/workers/chunks/229e1ed4282005aa0b83.js +1 -0
  17. package/assets/esri/core/workers/chunks/22b8eaa6afab0e5ffc47.js +1 -0
  18. package/assets/esri/core/workers/chunks/{1c0fb4795a52204882a8.js → 2550d2ba935cfdf30236.js} +1 -1
  19. package/assets/esri/core/workers/chunks/{49e6219dd08cb6c27023.js → 273ac1066095d63d6a6f.js} +1 -1
  20. package/assets/esri/core/workers/chunks/2e2867bc66c94aba7dc7.js +1 -0
  21. package/assets/esri/core/workers/chunks/{cda5c95fd49b8901f7d4.js → 3298e96d3f2e49e338d2.js} +1 -1
  22. package/assets/esri/core/workers/chunks/34613b288cf174983f8b.js +1 -0
  23. package/assets/esri/core/workers/chunks/{e5baa30944061418cb13.js → 35f086a2ae0585348ae6.js} +1 -1
  24. package/assets/esri/core/workers/chunks/{f441fc74451330384fb0.js → 37ea150dec5e491f691e.js} +1 -1
  25. package/assets/esri/core/workers/chunks/3c94db7ecdcd38eeb1b1.js +1 -0
  26. package/assets/esri/core/workers/chunks/3f7749f06ae54a4437d9.js +1 -0
  27. package/assets/esri/core/workers/chunks/40a722933af28823953b.js +1 -0
  28. package/assets/esri/core/workers/chunks/{7aa730e5ac7b268e3c98.js → 424daef7b5dec1b99aba.js} +1 -1
  29. package/assets/esri/core/workers/chunks/456684b1c1417ed0e611.js +1 -0
  30. package/assets/esri/core/workers/chunks/{d14e75b160aa432233c6.js → 461093ce28ceadd7853d.js} +1 -1
  31. package/assets/esri/core/workers/chunks/4a48b8ec5f3f2fd139b5.js +1 -0
  32. package/assets/esri/core/workers/chunks/4b084f985bc4100e7aec.js +1 -0
  33. package/assets/esri/core/workers/chunks/4b1de1fcd13677b615a8.js +1 -0
  34. package/assets/esri/core/workers/chunks/{31186e83fe009aa0fd36.js → 4d933de84afb2e3b7d18.js} +1 -1
  35. package/assets/esri/core/workers/chunks/{83aa39fbb1fad3b9d143.js → 4ff771942531fb2755c4.js} +1 -1
  36. package/assets/esri/core/workers/chunks/{e0017c6739d2532793e6.js → 513a4ef960e27500f986.js} +1 -1
  37. package/assets/esri/core/workers/chunks/56b693baa376bb990925.js +1 -0
  38. package/assets/esri/core/workers/chunks/{1d4ea8db272655c0608c.js → 57fd5e1260269002d18a.js} +1 -1
  39. package/assets/esri/core/workers/chunks/5fe40bb0e9ab333f6854.js +1 -0
  40. package/assets/esri/core/workers/chunks/{b56c07c0b43cb1999070.js → 60362c5651ef41fa7e5f.js} +1 -1
  41. package/assets/esri/core/workers/chunks/{e8a9971c8354569cb81d.js → 609919428305d8c8c243.js} +1 -1
  42. package/assets/esri/core/workers/chunks/{ab88577987cf2fe1cb32.js → 61373d2fa7e7638d3395.js} +1 -1
  43. package/assets/esri/core/workers/chunks/6202922b1c2637e9aaa5.js +1 -0
  44. package/assets/esri/core/workers/chunks/633368ae6fbb46373328.js +1 -0
  45. package/assets/esri/core/workers/chunks/6d702cb26cef46a76963.js +1 -0
  46. package/assets/esri/core/workers/chunks/{35272810c2ed04eb403d.js → 6f3943bebe2d5f4994f7.js} +1 -1
  47. package/assets/esri/core/workers/chunks/708aba69a1870ea41a61.js +1 -0
  48. package/assets/esri/core/workers/chunks/{7ba13b52fce1060fbb2a.js → 7147fc7502b385b302b2.js} +1 -1
  49. package/assets/esri/core/workers/chunks/{9ba8a2e1c0fb4e1efc7c.js → 7364fb5e99933533890d.js} +1 -1
  50. package/assets/esri/core/workers/chunks/74b1028e95f7cfff387b.js +1 -0
  51. package/assets/esri/core/workers/chunks/78fccea3445fb2f9120a.js +1 -0
  52. package/assets/esri/core/workers/chunks/7ba31425caa404f86424.js +1 -0
  53. package/assets/esri/core/workers/chunks/{040f3d8e1099c4843390.js → 81a60dfa600b690098f9.js} +1 -1
  54. package/assets/esri/core/workers/chunks/833fd2bc42c5cb459084.js +1 -0
  55. package/assets/esri/core/workers/chunks/{75643711d9585ee26a15.js → 83c8e5a92d8d6193cb32.js} +1 -1
  56. package/assets/esri/core/workers/chunks/{e537e1d37f3fcb14fce2.js → 870022661376442411e4.js} +1 -1
  57. package/assets/esri/core/workers/chunks/898ab7db220e81e921c6.js +1 -0
  58. package/assets/esri/core/workers/chunks/{31b074ae2162a3508d2a.js → 8b578ffc3a83089aa782.js} +1 -1
  59. package/assets/esri/core/workers/chunks/{48c8ef4170e803a564d6.js → 8b75861196d1ce5cba63.js} +1 -1
  60. package/assets/esri/core/workers/chunks/8be61e13530fd0dc2fd1.js +1 -0
  61. package/assets/esri/core/workers/chunks/90b8ccee883738917a6d.js +1 -0
  62. package/assets/esri/core/workers/chunks/90bc9c299ae0e8b8b5e5.js +1 -0
  63. package/assets/esri/core/workers/chunks/91d9ade78854f40a962d.js +1 -0
  64. package/assets/esri/core/workers/chunks/{74881340e040bfd0580f.js → 934bc1028b287f8df4aa.js} +1 -1
  65. package/assets/esri/core/workers/chunks/96055de47831e59a28bf.js +1 -0
  66. package/assets/esri/core/workers/chunks/963ba863e0f87abfca25.js +1 -0
  67. package/assets/esri/core/workers/chunks/9aa8d60483ad905fe13b.js +1 -0
  68. package/assets/esri/core/workers/chunks/9fed9946241bb2a5cfa4.js +1 -0
  69. package/assets/esri/core/workers/chunks/a2662e98857f0abf8e82.js +1 -0
  70. package/assets/esri/core/workers/chunks/a5a9b0a35849b9f2e86d.js +1 -0
  71. package/assets/esri/core/workers/chunks/a60006c9ccf6817fc0d2.js +1 -0
  72. package/assets/esri/core/workers/chunks/a627b7eb94b7fca33210.js +1 -0
  73. package/assets/esri/core/workers/chunks/a651dc3b8f1fc1ab34cc.js +1 -0
  74. package/assets/esri/core/workers/chunks/{bf5f9da0837ed09729c6.js → aab93e885b6c7c6aa76e.js} +1 -1
  75. package/assets/esri/core/workers/chunks/adfe28c1c1619cdd3ca1.js +1019 -0
  76. package/assets/esri/core/workers/chunks/b88dc7d8ae105747e6a4.js +1 -0
  77. package/assets/esri/core/workers/chunks/b90c786dd474ea1a409c.js +1 -0
  78. package/assets/esri/core/workers/chunks/b92e9e5df8154a128982.js +1 -0
  79. package/assets/esri/core/workers/chunks/{9a855a10798348a21bab.js → bff814d34b38ec80c44d.js} +1 -1
  80. package/assets/esri/core/workers/chunks/c36d699a75b6e8fb93eb.js +1 -0
  81. package/assets/esri/core/workers/chunks/c50fdf723f2d4316862e.js +1 -0
  82. package/assets/esri/core/workers/chunks/{9461cc37ab3397265270.js → c5e8ff4721b15ac3c6eb.js} +1 -1
  83. package/assets/esri/core/workers/chunks/{4cda42b94e9cb58dd372.js → ca61077e0a598654f33f.js} +1 -1
  84. package/assets/esri/core/workers/chunks/{61a9ffd4cf07d8bb7a9b.js → ca81be5bdb88ef557bf3.js} +1 -1
  85. package/assets/esri/core/workers/chunks/{ca1c65eb7f5900c60170.js → cd8fec3500e6503ae020.js} +1 -1
  86. package/assets/esri/core/workers/chunks/ce90e8489143228262e7.js +1 -0
  87. package/assets/esri/core/workers/chunks/d0320ca67abca4f8b0d2.js +1 -0
  88. package/assets/esri/core/workers/chunks/{4b6a44c6265c8959abd8.js → d3db7244fac7398cc700.js} +1 -1
  89. package/assets/esri/core/workers/chunks/{19820cddba13a3585c0b.js → d561624ddb9388732b25.js} +1 -1
  90. package/assets/esri/core/workers/chunks/d65ca3b8fccae8c3c3fa.js +1 -0
  91. package/assets/esri/core/workers/chunks/{630eba99f48ea79a9560.js → d705410c369bd03b1875.js} +1 -1
  92. package/assets/esri/core/workers/chunks/{9c7682b300b877f60095.js → d76513a6260d9ec4ea25.js} +1 -1
  93. package/assets/esri/core/workers/chunks/d82e17522ed946c2d809.js +1 -0
  94. package/assets/esri/core/workers/chunks/d8dc130ea559be1f68c6.js +1 -0
  95. package/assets/esri/core/workers/chunks/{768ae52b4e5c3e571ef5.js → dc29cb16704e2e4d0a46.js} +1 -1
  96. package/assets/esri/core/workers/chunks/e8c2e2fbe9cef4c8a8c6.js +1 -0
  97. package/assets/esri/core/workers/chunks/{3f33708eb39c7169a226.js → f2ba50eb29f93df885d6.js} +1 -1
  98. package/assets/esri/core/workers/chunks/{6e5d41f51572e3e7cf92.js → f7163048146ddaedfc36.js} +1 -1
  99. package/assets/esri/core/workers/chunks/fdaa10a588db394e2f65.js +1 -0
  100. package/chunks/Laserlines.glsl.js +1 -1
  101. package/chunks/boundedPlane.js +1 -1
  102. package/chunks/cameraUtilsSpherical.js +1 -1
  103. package/chunks/vec32.js +1 -1
  104. package/config.js +1 -1
  105. package/core/libs/gl-matrix-2/math/quat.js +1 -1
  106. package/core/libs/gl-matrix-2/math/vec3.js +1 -1
  107. package/geometry/FlatGeometry.js +1 -1
  108. package/geometry/operators/support/apiConverter.js +1 -1
  109. package/geometry/operators/support/jsonConverter.js +1 -1
  110. package/geometry/support/curves/circleUtils.js +1 -1
  111. package/geometry/support/lineSegment.js +1 -1
  112. package/geometry/support/meshUtils/loadGLTFMesh.js +1 -1
  113. package/geometry/support/meshUtils/merge.js +1 -1
  114. package/geometry/support/sphere.js +1 -1
  115. package/interfaces.d.ts +122 -14
  116. package/kernel.js +1 -1
  117. package/layers/VoxelWasmPerSceneView.js +1 -1
  118. package/layers/orientedImagery/transformations/worldToImage.js +1 -1
  119. package/layers/support/tiles3DUtils.js +1 -1
  120. package/layers/voxel/VoxelVolume.js +1 -1
  121. package/package.json +1 -1
  122. package/support/revision.js +1 -1
  123. package/symbols/cim/effects/EffectSuppress.js +1 -1
  124. package/views/2d/interactive/SegmentLabels2D.js +1 -1
  125. package/views/3d/analysis/AreaMeasurement/support/MeasurementData.js +1 -1
  126. package/views/3d/analysis/Dimension/lengthDimensionConstraintUtils.js +1 -1
  127. package/views/3d/analysis/Dimension/lengthDimensionUtils.js +1 -1
  128. package/views/3d/analysis/LineOfSight/LineOfSightController.js +1 -1
  129. package/views/3d/analysis/LineOfSight/LineOfSightIntersectionResult.js +1 -1
  130. package/views/3d/analysis/Slice/sliceToolUtils.js +1 -1
  131. package/views/3d/analysis/Viewshed/ViewshedScaleOrientManipulation.js +1 -1
  132. package/views/3d/analysis/Viewshed/ViewshedSubTool.js +1 -1
  133. package/views/3d/analysis/Viewshed/ViewshedSubVisualization.js +1 -1
  134. package/views/3d/analysis/Viewshed/ViewshedTool.js +1 -1
  135. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillController.js +1 -1
  136. package/views/3d/animation/pointToPoint/Camera.js +1 -1
  137. package/views/3d/camera/constraintUtils/distance.js +1 -1
  138. package/views/3d/camera/constraintUtils/tilt.js +1 -1
  139. package/views/3d/environment/ChapmanAtmosphere.js +1 -1
  140. package/views/3d/environment/CloudsParameters.js +1 -1
  141. package/views/3d/environment/EnvironmentManager.js +1 -1
  142. package/views/3d/environment/MarsAtmosphere.js +1 -1
  143. package/views/3d/glTF/internal/Resource.js +1 -1
  144. package/views/3d/glTF/loader.js +1 -1
  145. package/views/3d/interactive/SegmentLabels3D.js +1 -1
  146. package/views/3d/interactive/editingTools/manipulations/MoveZManipulation.js +1 -1
  147. package/views/3d/interactive/editingTools/media/MediaElementManipulator3D.js +1 -1
  148. package/views/3d/interactive/editingTools/reshape/edgeOffsetUtils.js +1 -1
  149. package/views/3d/interactive/visualElements/MeasurementArrowVisualElement.js +1 -1
  150. package/views/3d/interactive/visualElements/RightAngleQuadVisualElement.js +1 -1
  151. package/views/3d/layers/I3SMeshView3D.js +1 -1
  152. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  153. package/views/3d/layers/graphics/Graphics3DFrustumVisibility.js +1 -1
  154. package/views/3d/layers/graphics/Graphics3DObjectSymbolLayer.js +1 -1
  155. package/views/3d/layers/graphics/ObjectResourceCache.js +1 -1
  156. package/views/3d/layers/graphics/objectResourceUtils.js +1 -1
  157. package/views/3d/layers/i3s/I3SMaterialUtil.js +1 -1
  158. package/views/3d/layers/i3s/I3SViewportQueries.js +1 -1
  159. package/views/3d/layers/i3s/PointCloudRenderer.js +1 -1
  160. package/views/3d/layers/support/FeatureTileMeasurements3D.js +1 -1
  161. package/views/3d/layers/support/FeatureTileVisibility3D.js +1 -1
  162. package/views/3d/state/Frustum.js +1 -1
  163. package/views/3d/state/controllers/FovController.js +1 -1
  164. package/views/3d/state/controllers/GamepadKeyboardController.js +1 -1
  165. package/views/3d/state/controllers/momentum/ZoomPlanarMomentumController.js +1 -1
  166. package/views/3d/support/FrustumExtentIntersection.js +1 -1
  167. package/views/3d/support/cameraUtils.js +1 -1
  168. package/views/3d/support/intersectionUtils.js +1 -1
  169. package/views/3d/support/orientedBoundingBox.js +1 -1
  170. package/views/3d/support/pointsOfInterest/CameraOnSurface.js +1 -1
  171. package/views/3d/support/pointsOfInterest/CenterOnSurface.js +1 -1
  172. package/views/3d/support/pointsOfInterest/Focus.js +1 -1
  173. package/views/3d/support/viewpointUtils.js +1 -1
  174. package/views/3d/terrain/OverlayManager.js +1 -1
  175. package/views/3d/terrain/PatchRenderData.js +1 -1
  176. package/views/3d/terrain/SphericalPatch.js +1 -1
  177. package/views/3d/terrain/Tile.js +1 -1
  178. package/views/3d/webgl/RenderCamera.js +1 -1
  179. package/views/3d/webgl-engine/core/FBOCache.js +1 -1
  180. package/views/3d/webgl-engine/effects/haze/Haze.js +1 -1
  181. package/views/3d/webgl-engine/lib/GaussianSplatRenderNode.js +1 -1
  182. package/views/3d/webgl-engine/lib/Object3D.js +1 -1
  183. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  184. package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
  185. package/views/3d/webgl-engine/lib/Viewshed.js +1 -1
  186. package/views/3d/webgl-engine/lib/edgeRendering/edgePreprocessing.js +1 -1
  187. package/views/3d/webgl-engine/lib/geometryDataUtils.js +1 -1
  188. package/views/3d/webgl-engine/lib/triangleIntersectionUtils.js +1 -1
  189. package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
  190. package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
  191. package/views/3d/webgl-engine/materials/MeasurementArrowMaterial.js +1 -1
  192. package/views/3d/webgl-engine/materials/NativeLineMaterial.js +1 -1
  193. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  194. package/views/3d/webgl-engine/materials/pbrUtils.js +1 -1
  195. package/views/3d/webgl-engine/shaders/SphereDepthInterpolate.glsl.js +1 -1
  196. package/views/draw/support/Reshape.js +1 -1
  197. package/views/interactive/GraphicManipulator.js +1 -1
  198. package/views/interactive/coordinateHelper.js +1 -1
  199. package/views/interactive/editGeometry/operations/OffsetEdgeVertex.js +1 -1
  200. package/views/interactive/sketch/constraints.js +1 -1
  201. package/views/interactive/snapping/featureSources/sceneLayerSource/SceneLayerSnappingSourceWorker.js +1 -1
  202. package/views/interactive/snapping/featureSources/sceneLayerSource/sceneLayerSnappingUtils.js +1 -1
  203. package/views/interactive/snapping/hints/LineSnappingHint.js +1 -1
  204. package/views/interactive/tooltip/tooltipCommonUtils.js +1 -1
  205. package/views/navigation/PanSphericalMomentumEstimator.js +1 -1
  206. package/views/support/euclideanAreaMeasurementUtils.js +1 -1
  207. package/views/support/euclideanLengthMeasurementUtils.js +1 -1
  208. package/views/support/geometry3dUtils.js +1 -1
  209. package/widgets/BatchAttributeForm/BatchAttributeFormViewModel.js +1 -1
  210. package/widgets/BatchAttributeForm/css.js +1 -1
  211. package/widgets/BatchAttributeForm/inputs/SingleFeatureInput.d.ts +4 -0
  212. package/widgets/BatchAttributeForm/inputs/SingleFeatureInput.js +5 -0
  213. package/widgets/BatchAttributeForm/inputs/TextElementInput.d.ts +4 -0
  214. package/widgets/BatchAttributeForm/inputs/TextElementInput.js +5 -0
  215. package/widgets/BatchAttributeForm/inputs/support/createBatchFormInputs.js +1 -1
  216. package/widgets/BatchAttributeForm/inputs/support/inputUtils.js +1 -1
  217. package/widgets/BatchAttributeForm/templates/GroupElementTemplate.js +1 -1
  218. package/widgets/BatchAttributeForm/templates/TextElementTemplate.js +5 -0
  219. package/widgets/BatchAttributeForm/templates/support/createBatchFormTemplate.js +1 -1
  220. package/widgets/BatchAttributeForm/templates/support/hashElementTemplate.js +1 -1
  221. package/widgets/BatchAttributeForm/templates/support/templateUtils.js +1 -1
  222. package/widgets/BatchAttributeForm.js +1 -1
  223. package/widgets/FeatureForm/TextElementInput.d.ts +2 -2
  224. package/widgets/PanoramicViewer/PanoramicVideoViewerViewModel.js +1 -1
  225. package/widgets/PanoramicViewer/PanoramicViewerViewModel.js +1 -1
  226. package/widgets/PanoramicViewer/PanoramicZoomManager.js +1 -1
  227. package/widgets/PanoramicViewer/support/PanoramicMedia.js +5 -0
  228. package/widgets/PanoramicViewer/support/PanoramicMediaCollection.js +5 -0
  229. package/widgets/PanoramicViewer/support/PanoramicMediaError.js +5 -0
  230. package/widgets/PanoramicViewer/utils.js +1 -1
  231. package/widgets/PanoramicViewer.js +1 -1
  232. package/assets/esri/core/workers/chunks/04a0685ee53ef74883aa.js +0 -1
  233. package/assets/esri/core/workers/chunks/1e0e7cef7ef947894bbe.js +0 -1019
  234. package/assets/esri/core/workers/chunks/20988e116f3723228f36.js +0 -1
  235. package/assets/esri/core/workers/chunks/2613e482450b57f2d4f5.js +0 -1
  236. package/assets/esri/core/workers/chunks/274f2b5e6dbc58505142.js +0 -1
  237. package/assets/esri/core/workers/chunks/27dfbe3d903b95d4c67a.js +0 -1
  238. package/assets/esri/core/workers/chunks/28a5a7c6b3d6902146f6.js +0 -1
  239. package/assets/esri/core/workers/chunks/2c4218306747f5d15575.js +0 -1
  240. package/assets/esri/core/workers/chunks/2db7a7607657f1d669f7.js +0 -1
  241. package/assets/esri/core/workers/chunks/3767617c0dfc7d801441.js +0 -1
  242. package/assets/esri/core/workers/chunks/44b6b7418cbf7f778bef.js +0 -1
  243. package/assets/esri/core/workers/chunks/4675ed3ca3e0104d00bf.js +0 -1
  244. package/assets/esri/core/workers/chunks/4df7cc3477bc46fc39af.js +0 -1
  245. package/assets/esri/core/workers/chunks/538ddb267aa328814865.js +0 -1
  246. package/assets/esri/core/workers/chunks/555a0ea44ba77819d493.js +0 -1
  247. package/assets/esri/core/workers/chunks/55818fe7a7aa1e5c8bbd.js +0 -1
  248. package/assets/esri/core/workers/chunks/5f781ef46ce7c4048c2f.js +0 -1
  249. package/assets/esri/core/workers/chunks/60f2de8dd8876bfd715a.js +0 -1
  250. package/assets/esri/core/workers/chunks/679088064420a906aa7f.js +0 -1
  251. package/assets/esri/core/workers/chunks/706423d801fa9cbf2e90.js +0 -1
  252. package/assets/esri/core/workers/chunks/71dd80231ea656a6380c.js +0 -1
  253. package/assets/esri/core/workers/chunks/725819839434c59102f3.js +0 -1
  254. package/assets/esri/core/workers/chunks/72cebf18da5ec5eeb666.js +0 -1
  255. package/assets/esri/core/workers/chunks/768d9b6eaba7bfa18dde.js +0 -1
  256. package/assets/esri/core/workers/chunks/77b45957cfe42523c1c8.js +0 -1
  257. package/assets/esri/core/workers/chunks/852de585a72d902344a6.js +0 -1
  258. package/assets/esri/core/workers/chunks/871dd5e1f016a04b8d98.js +0 -1
  259. package/assets/esri/core/workers/chunks/892c417f5130b003889d.js +0 -1
  260. package/assets/esri/core/workers/chunks/907083c427d7fb4354e9.js +0 -1
  261. package/assets/esri/core/workers/chunks/93c5f097bb7b380bb175.js +0 -1
  262. package/assets/esri/core/workers/chunks/9f0172b83f25ef5f8d40.js +0 -1
  263. package/assets/esri/core/workers/chunks/ae793d814cf32db9fbde.js +0 -1
  264. package/assets/esri/core/workers/chunks/b21cf62652ca772108c8.js +0 -1
  265. package/assets/esri/core/workers/chunks/c5c02ace54fe4ab9214b.js +0 -1
  266. package/assets/esri/core/workers/chunks/c82a974c8448407885e6.js +0 -1
  267. package/assets/esri/core/workers/chunks/d08ee45c501102deea20.js +0 -1
  268. package/assets/esri/core/workers/chunks/d239a4ef60e348cfb05a.js +0 -1
  269. package/assets/esri/core/workers/chunks/da2ba40bc017bff0fe49.js +0 -1
  270. package/assets/esri/core/workers/chunks/dc3a4ad62bc041a4f899.js +0 -1
  271. package/assets/esri/core/workers/chunks/e093e745708f722bc1b9.js +0 -1
  272. package/assets/esri/core/workers/chunks/e501d68a1464805c4b4e.js +0 -1
  273. package/assets/esri/core/workers/chunks/f3c232fc56a29d51196a.js +0 -1
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{delinearize as e,colorGamma as r}from"../../../../colorUtils.js";import{adjustStaticAGOUrl as t}from"../../../../core/devEnvironmentUtils.js";import{hasScaling as o}from"../../../../core/mathUtils.js";import{normalFromMat4 as s,fromMat4 as i}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{invert as l}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{ONES as u}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{p as c,e as m,B as f,b as d,n as p,l as g}from"../../../../chunks/vec32.js";import{create as x}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{empty as T,expandWithVec3 as b}from"../../../../geometry/support/aaBoundingBox.js";import{newFloatArray as h}from"../../../../geometry/support/FloatArray.js";import{BufferViewVec3f as y,BufferViewVec4f as v,BufferViewVec4u8 as w,BufferViewVec4u16 as R,BufferViewVec3u8 as S,BufferViewVec3u16 as B}from"../../../../geometry/support/buffer/BufferView.js";import{t as j,b as M,n as F,f as A}from"../../../../chunks/vec3.js";import{t as E,b as C}from"../../../../chunks/vec4.js";import{a as I}from"../../../../chunks/vec2.js";import{DefaultLoadingContext as L}from"../../glTF/DefaultLoadingContext.js";import{convertPrimitiveToTriangles as P}from"../../glTF/internal/indexUtils.js";import{isEncodedMeshTexture as U}from"../../glTF/internal/resourceUtils.js";import{getTransformMatrix as O}from"../../glTF/internal/TextureTransformUtils.js";import{ProcessedObjectResource as k}from"./ProcessedObjectResource.js";import{load as V,processLoadResult as _}from"./wosrLoader.js";import{Attribute as H}from"../../webgl-engine/lib/Attribute.js";import{Geometry as D}from"../../webgl-engine/lib/Geometry.js";import{ManagedTexture as K}from"../../webgl-engine/lib/ManagedTexture.js";import{DefaultMaterial as G}from"../../webgl-engine/materials/DefaultMaterial.js";import{useSchematicPBR as W,schematicMRRFactors as N,esriSymbologyMRRFactors as Q,advancedMRRFactors as $}from"../../webgl-engine/materials/pbrUtils.js";async function z(e,r){const o=q(t(e));if("wosr"===o.fileType){const e=await(r.cache?r.cache.loadWOSR(o.url,r):V(o.url,r)),{engineResources:t,referenceBoundingBox:s}=_(e,r);return{lods:t,referenceBoundingBox:s,isEsriSymbolResource:!1,isWosr:!0}}let s;if(r.cache)s=await r.cache.loadGLTF(o.url,r,!!r.usePBR);else{const{loadGLTF:e}=await import("../../glTF/loader.js");s=await e(new L,o.url,r,r.usePBR)}const{engineResources:i,referenceBoundingBox:n}=J(s,r,o.specifiedLodIndex);return{lods:i,referenceBoundingBox:n,isEsriSymbolResource:s.meta.isEsriSymbolResource,isWosr:!1}}function q(e){const r=e.match(/(.*\.(gltf|glb))(\?lod=([0-9]+))?$/);if(r)return{fileType:"gltf",url:r[1],specifiedLodIndex:null!=r[4]?Number(r[4]):null};return e.match(/(.*\.(json|json\.gz))$/)?{fileType:"wosr",url:e,specifiedLodIndex:null}:{fileType:"unknown",url:e,specifiedLodIndex:null}}function J(e,r,t){const o=e.model,s=e.meta,i=o.meta?.ESRI_proxyEllipsoid,n=s.isEsriSymbolResource&&null!=i&&"EsriRealisticTreesStyle"===s.ESRI_webstyle;n&&!e.customMeta.esriTreeRendering&&(e.customMeta.esriTreeRendering=!0,re(e,i));const l=!!r.usePBR,a=s.isEsriSymbolResource?{usePBR:l,isSchematic:!1,treeRendering:n,mrrFactors:Q}:{usePBR:l,isSchematic:!1,treeRendering:!1,mrrFactors:$},u={...r.materialParameters,treeRendering:n},c=new Array,m=new Map,f=new Map,d=o.lods.length,p=T();return o.lods.forEach((e,s)=>{const i=!0===r.skipHighLods&&(d>1&&0===s||d>3&&1===s)||!1===r.skipHighLods&&null!=t&&s!==t;if(i&&0!==s)return;const l=new k(e.name,e.lodThreshold,[0,0,0]);e.parts.forEach(e=>{const t=i?new G({},r):X(o,e,l,a,u,m,f,r,n),{geometry:c,vertexCount:d}=Y(e,t??new G({},r)),g=c.boundingInfo;null!=g&&0===s&&(b(p,g.bbMin),b(p,g.bbMax)),null!=t&&(l.stageResources.geometries.push(c),l.numberOfVertices+=d)}),i||c.push(l)}),{engineResources:c,referenceBoundingBox:p}}function X(r,t,o,s,i,n,l,a,c){const m=r.materials.get(t.material);if(null==m)return null;const{normal:f,color:d,texCoord0:p,tangent:g}=t.attributes,x=t.material+(f?"_normal":"")+(d?"_color":"")+(p?"_texCoord0":"")+(g?"_tangent":""),T=null!=t.attributes.texCoord0,b=null!=t.attributes.normal,h=ee(m.alphaMode);if(!n.has(x)){if(T){const e=(e,t=!1,o=!1)=>{if(null!=e&&!l.has(e)){const s=r.textures.get(e);if(s){const r=s.data,i=t&&!U(r)?a.compressionOptions:void 0;l.set(e,new K(U(r)?r.data:r,{...s.parameters,preMultiplyAlpha:!U(r)&&o,encoding:U(r)?r.encoding:void 0,compressionOptions:i}))}}},t=1!==h&&!c;e(m.colorTexture,t,1!==h),e(m.normalTexture),e(m.occlusionTexture,!0),e(m.emissiveTexture),e(m.metallicRoughnessTexture,!0)}const o=e(m.color[0]),f=e(m.color[1]),d=e(m.color[2]),p=null!=m.colorTexture&&T?l.get(m.colorTexture):null,g=W(m),y=null!=m.normalTextureTransform?.scale?m.normalTextureTransform?.scale:u;n.set(x,new G({...s,customDepthTest:1,textureAlphaMode:h,textureAlphaCutoff:m.alphaCutoff,diffuse:[o,f,d],ambient:[o,f,d],opacity:"OPAQUE"===m.alphaMode?1:m.opacity,doubleSided:m.doubleSided,doubleSidedType:"winding-order",cullFace:m.doubleSided?0:2,hasVertexColors:!!t.attributes.color,hasVertexTangents:!!t.attributes.tangent,normalType:b?0:2,castShadows:!0,receiveShadows:m.receiveShadows,receiveAmbientOcclusion:m.receiveAmbientOcclusion,textureId:null!=p?p.id:void 0,colorMixMode:m.colorMixMode,normalTextureId:null!=m.normalTexture&&T?l.get(m.normalTexture).id:void 0,textureAlphaPremultiplied:null!=p&&!!p.parameters.preMultiplyAlpha,occlusionTextureId:null!=m.occlusionTexture&&T?l.get(m.occlusionTexture).id:void 0,emissiveTextureId:null!=m.emissiveTexture&&T?l.get(m.emissiveTexture).id:void 0,metallicRoughnessTextureId:null!=m.metallicRoughnessTexture&&T?l.get(m.metallicRoughnessTexture).id:void 0,emissiveBaseColor:[m.emissiveFactor[0],m.emissiveFactor[1],m.emissiveFactor[2]],emissiveStrengthKHR:null!=m.emissiveStrengthKHR?m.emissiveStrengthKHR:1,emissiveStrengthFromSymbol:null!=i.emissiveStrengthFromSymbol?i.emissiveStrengthFromSymbol:void 0,mrrFactors:g?N:[m.metallicFactor,m.roughnessFactor,s.mrrFactors[2]],isSchematic:g,colorTextureTransformMatrix:O(m.colorTextureTransform),normalTextureTransformMatrix:O(m.normalTextureTransform),scale:[y[0],y[1]],occlusionTextureTransformMatrix:O(m.occlusionTextureTransform),emissiveTextureTransformMatrix:O(m.emissiveTextureTransform),metallicRoughnessTextureTransformMatrix:O(m.metallicRoughnessTextureTransform),...i},a))}const y=n.get(x);if(o.stageResources.materials.push(y),T){const e=e=>{null!=e&&o.stageResources.textures.push(l.get(e))};e(m.colorTexture),e(m.normalTexture),e(m.occlusionTexture),e(m.emissiveTexture),e(m.metallicRoughnessTexture)}return y}function Y(e,r){const t=e.attributes.position.count,n=P(e.indices||t,e.primitiveType),l=h(3*t),{typedBuffer:a,typedBufferStride:u}=e.attributes.position;j(l,a,e.transform,3,u);const c=[["position",new H(l,n,3,!0)]];if(null!=e.attributes.normal){const r=h(3*t),{typedBuffer:i,typedBufferStride:l}=e.attributes.normal;s(Z,e.transform),M(r,i,Z,3,l),o(Z)&&F(r,r),c.push(["normal",new H(r,n,3,!0)])}if(null!=e.attributes.tangent){const r=h(4*t),{typedBuffer:s,typedBufferStride:l}=e.attributes.tangent;i(Z,e.transform),E(r,s,Z,4,l),o(Z)&&F(r,r,4),c.push(["tangent",new H(r,n,4,!0)])}if(null!=e.attributes.texCoord0){const r=h(2*t),{typedBuffer:o,typedBufferStride:s}=e.attributes.texCoord0;I(r,o,2,s),c.push(["uv0",new H(r,n,2,!0)])}const m=e.attributes.color;if(null!=m){const r=new Uint8Array(4*t);4===m.elementCount?m instanceof v?C(r,m,1,255):(m instanceof w||m instanceof R)&&C(r,m,1/255,255):(r.fill(255),m instanceof y?A(r,m.typedBuffer,1,255,4,m.typedBufferStride):(e.attributes.color instanceof S||e.attributes.color instanceof B)&&A(r,m.typedBuffer,1/255,255,4,e.attributes.color.typedBufferStride)),c.push(["color",new H(r,n,4,!0)])}return{geometry:new D(r,c),vertexCount:t}}const Z=n();function ee(e){switch(e){case"BLEND":return 0;case"MASK":return 2;case"OPAQUE":case null:case void 0:return 1}}function re(e,t){for(let o=0;o<e.model.lods.length;++o){const s=e.model.lods[o];for(const i of s.parts){const s=i.attributes.normal;if(null==s)return;const n=i.attributes.position,u=n.count,T=x(),b=x(),h=x(),w=new Float32Array(4*u),R=new Float32Array(3*u),S=l(a(),i.transform);let B=0,j=0;for(let l=0;l<u;l++){n.getVec(l,b),s.getVec(l,T),c(b,b,i.transform),m(h,b,t.center),f(h,h,t.radius);const a=h[2],u=d(h),x=Math.min(.45+.55*u*u,1)**r;f(h,h,t.radius),null!==S&&c(h,h,S),p(h,h),o+1!==e.model.lods.length&&e.model.lods.length>1&&g(h,h,T,a>-1?.2:Math.min(-4*a-3.8,1)),R[B]=h[0],R[B+1]=h[1],R[B+2]=h[2],B+=3,w[j]=x,w[j+1]=x,w[j+2]=x,w[j+3]=1,j+=4}i.attributes.normal=new y(R.buffer),i.attributes.color=new v(w.buffer)}}}export{z as fetch,q as parseUrl};
5
+ import{delinearize as e,colorGamma as r}from"../../../../colorUtils.js";import{adjustStaticAGOUrl as t}from"../../../../core/devEnvironmentUtils.js";import{hasScaling as o}from"../../../../core/mathUtils.js";import{normalFromMat4 as s,fromMat4 as i}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{invert as l}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{ONES as u}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{p as c,e as m,C as f,b as d,n as p,l as g}from"../../../../chunks/vec32.js";import{create as x}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{empty as T,expandWithVec3 as b}from"../../../../geometry/support/aaBoundingBox.js";import{newFloatArray as h}from"../../../../geometry/support/FloatArray.js";import{BufferViewVec3f as y,BufferViewVec4f as v,BufferViewVec4u8 as w,BufferViewVec4u16 as R,BufferViewVec3u8 as S,BufferViewVec3u16 as B}from"../../../../geometry/support/buffer/BufferView.js";import{t as j,b as M,n as F,f as E}from"../../../../chunks/vec3.js";import{t as A,b as C}from"../../../../chunks/vec4.js";import{a as I}from"../../../../chunks/vec2.js";import{DefaultLoadingContext as L}from"../../glTF/DefaultLoadingContext.js";import{convertPrimitiveToTriangles as P}from"../../glTF/internal/indexUtils.js";import{isEncodedMeshTexture as U}from"../../glTF/internal/resourceUtils.js";import{getTransformMatrix as O}from"../../glTF/internal/TextureTransformUtils.js";import{ProcessedObjectResource as k}from"./ProcessedObjectResource.js";import{load as V,processLoadResult as _}from"./wosrLoader.js";import{Attribute as H}from"../../webgl-engine/lib/Attribute.js";import{Geometry as D}from"../../webgl-engine/lib/Geometry.js";import{ManagedTexture as K}from"../../webgl-engine/lib/ManagedTexture.js";import{DefaultMaterial as G}from"../../webgl-engine/materials/DefaultMaterial.js";import{useSchematicPBR as W,schematicMRRFactors as N,esriSymbologyMRRFactors as Q,advancedMRRFactors as $}from"../../webgl-engine/materials/pbrUtils.js";async function z(e,r){const o=q(t(e));if("wosr"===o.fileType){const e=await(r.cache?r.cache.loadWOSR(o.url,r):V(o.url,r)),{engineResources:t,referenceBoundingBox:s}=_(e,r);return{lods:t,referenceBoundingBox:s,isEsriSymbolResource:!1,isWosr:!0}}let s;if(r.cache)s=await r.cache.loadGLTF(o.url,r,!!r.usePBR,!!r.useEmissive);else{const{loadGLTF:e}=await import("../../glTF/loader.js");s=await e(new L,o.url,r,r.usePBR,r.useEmissive)}const{engineResources:i,referenceBoundingBox:n}=J(s,r,o.specifiedLodIndex);return{lods:i,referenceBoundingBox:n,isEsriSymbolResource:s.meta.isEsriSymbolResource,isWosr:!1}}function q(e){const r=e.match(/(.*\.(gltf|glb))(\?lod=([0-9]+))?$/);if(r)return{fileType:"gltf",url:r[1],specifiedLodIndex:null!=r[4]?Number(r[4]):null};return e.match(/(.*\.(json|json\.gz))$/)?{fileType:"wosr",url:e,specifiedLodIndex:null}:{fileType:"unknown",url:e,specifiedLodIndex:null}}function J(e,r,t){const o=e.model,s=e.meta,i=o.meta?.ESRI_proxyEllipsoid,n=s.isEsriSymbolResource&&null!=i&&"EsriRealisticTreesStyle"===s.ESRI_webstyle;n&&!e.customMeta.esriTreeRendering&&(e.customMeta.esriTreeRendering=!0,re(e,i));const l=!!r.usePBR,a=s.isEsriSymbolResource?{usePBR:l,isSchematic:!1,treeRendering:n,mrrFactors:Q}:{usePBR:l,isSchematic:!1,treeRendering:!1,mrrFactors:$},u={...r.materialParameters,treeRendering:n},c=new Array,m=new Map,f=new Map,d=o.lods.length,p=T();return o.lods.forEach((e,s)=>{const i=!0===r.skipHighLods&&(d>1&&0===s||d>3&&1===s)||!1===r.skipHighLods&&null!=t&&s!==t;if(i&&0!==s)return;const l=new k(e.name,e.lodThreshold,[0,0,0]);e.parts.forEach(e=>{const t=i?new G({},r):X(o,e,l,a,u,m,f,r,n),{geometry:c,vertexCount:d}=Y(e,t??new G({},r)),g=c.boundingInfo;null!=g&&0===s&&(b(p,g.bbMin),b(p,g.bbMax)),null!=t&&(l.stageResources.geometries.push(c),l.numberOfVertices+=d)}),i||c.push(l)}),{engineResources:c,referenceBoundingBox:p}}function X(r,t,o,s,i,n,l,a,c){const m=r.materials.get(t.material);if(null==m)return null;const{normal:f,color:d,texCoord0:p,tangent:g}=t.attributes,x=t.material+(f?"_normal":"")+(d?"_color":"")+(p?"_texCoord0":"")+(g?"_tangent":""),T=null!=t.attributes.texCoord0,b=null!=t.attributes.normal,h=ee(m.alphaMode);if(!n.has(x)){if(T){const e=(e,t=!1,o=!1)=>{if(null!=e&&!l.has(e)){const s=r.textures.get(e);if(s){const r=s.data,i=t&&!U(r)?a.compressionOptions:void 0;l.set(e,new K(U(r)?r.data:r,{...s.parameters,preMultiplyAlpha:!U(r)&&o,encoding:U(r)?r.encoding:void 0,compressionOptions:i}))}}},t=1!==h&&!c;e(m.colorTexture,t,1!==h),e(m.normalTexture),e(m.occlusionTexture,!0),e(m.emissiveTexture),e(m.metallicRoughnessTexture,!0)}const o=e(m.color[0]),f=e(m.color[1]),d=e(m.color[2]),p=null!=m.colorTexture&&T?l.get(m.colorTexture):null,g=W(m),y=null!=m.normalTextureTransform?.scale?m.normalTextureTransform?.scale:u;n.set(x,new G({...s,customDepthTest:1,textureAlphaMode:h,textureAlphaCutoff:m.alphaCutoff,diffuse:[o,f,d],ambient:[o,f,d],opacity:"OPAQUE"===m.alphaMode?1:m.opacity,doubleSided:m.doubleSided,doubleSidedType:"winding-order",cullFace:m.doubleSided?0:2,hasVertexColors:!!t.attributes.color,hasVertexTangents:!!t.attributes.tangent,normalType:b?0:2,castShadows:!0,receiveShadows:m.receiveShadows,receiveAmbientOcclusion:m.receiveAmbientOcclusion,textureId:null!=p?p.id:void 0,colorMixMode:m.colorMixMode,normalTextureId:null!=m.normalTexture&&T?l.get(m.normalTexture).id:void 0,textureAlphaPremultiplied:null!=p&&!!p.parameters.preMultiplyAlpha,occlusionTextureId:null!=m.occlusionTexture&&T?l.get(m.occlusionTexture).id:void 0,emissiveTextureId:null!=m.emissiveTexture&&T?l.get(m.emissiveTexture).id:void 0,metallicRoughnessTextureId:null!=m.metallicRoughnessTexture&&T?l.get(m.metallicRoughnessTexture).id:void 0,emissiveBaseColor:[m.emissiveFactor[0],m.emissiveFactor[1],m.emissiveFactor[2]],emissiveStrengthKHR:null!=m.emissiveStrengthKHR?m.emissiveStrengthKHR:1,emissiveStrengthFromSymbol:null!=i.emissiveStrengthFromSymbol?i.emissiveStrengthFromSymbol:void 0,mrrFactors:g?N:[m.metallicFactor,m.roughnessFactor,s.mrrFactors[2]],isSchematic:g,colorTextureTransformMatrix:O(m.colorTextureTransform),normalTextureTransformMatrix:O(m.normalTextureTransform),scale:[y[0],y[1]],occlusionTextureTransformMatrix:O(m.occlusionTextureTransform),emissiveTextureTransformMatrix:O(m.emissiveTextureTransform),metallicRoughnessTextureTransformMatrix:O(m.metallicRoughnessTextureTransform),...i},a))}const y=n.get(x);if(o.stageResources.materials.push(y),T){const e=e=>{null!=e&&o.stageResources.textures.push(l.get(e))};e(m.colorTexture),e(m.normalTexture),e(m.occlusionTexture),e(m.emissiveTexture),e(m.metallicRoughnessTexture)}return y}function Y(e,r){const t=e.attributes.position.count,n=P(e.indices||t,e.primitiveType),l=h(3*t),{typedBuffer:a,typedBufferStride:u}=e.attributes.position;j(l,a,e.transform,3,u);const c=[["position",new H(l,n,3,!0)]];if(null!=e.attributes.normal){const r=h(3*t),{typedBuffer:i,typedBufferStride:l}=e.attributes.normal;s(Z,e.transform),M(r,i,Z,3,l),o(Z)&&F(r,r),c.push(["normal",new H(r,n,3,!0)])}if(null!=e.attributes.tangent){const r=h(4*t),{typedBuffer:s,typedBufferStride:l}=e.attributes.tangent;i(Z,e.transform),A(r,s,Z,4,l),o(Z)&&F(r,r,4),c.push(["tangent",new H(r,n,4,!0)])}if(null!=e.attributes.texCoord0){const r=h(2*t),{typedBuffer:o,typedBufferStride:s}=e.attributes.texCoord0;I(r,o,2,s),c.push(["uv0",new H(r,n,2,!0)])}const m=e.attributes.color;if(null!=m){const r=new Uint8Array(4*t);4===m.elementCount?m instanceof v?C(r,m,1,255):(m instanceof w||m instanceof R)&&C(r,m,1/255,255):(r.fill(255),m instanceof y?E(r,m.typedBuffer,1,255,4,m.typedBufferStride):(e.attributes.color instanceof S||e.attributes.color instanceof B)&&E(r,m.typedBuffer,1/255,255,4,e.attributes.color.typedBufferStride)),c.push(["color",new H(r,n,4,!0)])}return{geometry:new D(r,c),vertexCount:t}}const Z=n();function ee(e){switch(e){case"BLEND":return 0;case"MASK":return 2;case"OPAQUE":case null:case void 0:return 1}}function re(e,t){for(let o=0;o<e.model.lods.length;++o){const s=e.model.lods[o];for(const i of s.parts){const s=i.attributes.normal;if(null==s)return;const n=i.attributes.position,u=n.count,T=x(),b=x(),h=x(),w=new Float32Array(4*u),R=new Float32Array(3*u),S=l(a(),i.transform);let B=0,j=0;for(let l=0;l<u;l++){n.getVec(l,b),s.getVec(l,T),c(b,b,i.transform),m(h,b,t.center),f(h,h,t.radius);const a=h[2],u=d(h),x=Math.min(.45+.55*u*u,1)**r;f(h,h,t.radius),null!==S&&c(h,h,S),p(h,h),o+1!==e.model.lods.length&&e.model.lods.length>1&&g(h,h,T,a>-1?.2:Math.min(-4*a-3.8,1)),R[B]=h[0],R[B+1]=h[1],R[B+2]=h[2],B+=3,w[j]=x,w[j+1]=x,w[j+2]=x,w[j+3]=1,j+=4}i.attributes.normal=new y(R.buffer),i.attributes.color=new v(w.buffer)}}}export{z as fetch,q as parseUrl};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{validateColorAndOpacity as e,validateColor as r}from"../../../../core/colorUtils.js";import has from"../../../../core/has.js";import{clamp as o}from"../../../../core/mathUtils.js";import{uncompressedFormats as a,compressibleUsages as s}from"./enums.js";import{RenderTexture as t}from"../../webgl-engine/core/material/RenderTexture.js";import{getEllipsoidMode as l}from"../../webgl-engine/core/shaderLibrary/util/EllipsoidMode.js";import{ManagedTexture as n}from"../../webgl-engine/lib/ManagedTexture.js";import{useSchematicPBRI3S as i,useSchematicPBR as u,schematicMRRFactors as c,advancedMRRFactors as m}from"../../webgl-engine/materials/pbrUtils.js";import{alphaCutoff as d}from"../../../../webscene/support/AlphaCutoff.js";function g(r,o,a){const s=new Map,t=(e,r)=>{if(null==e)return-1;const o=s.get(e.id);if(o)return o.usage|=r,o.id;const a=s.size;return s.set(e.id,{id:a,usage:r}),a},l=o.pbrMetallicRoughness,n=l?.baseColorFactor?e(l.baseColorFactor):null,d=o.emissiveFactor,g=a?i({normalTexture:o.normalTexture,emissiveTexture:o.emissiveTexture,emissiveFactor:o.emissiveFactor,occlusionTexture:o.occlusionTexture,metallicRoughnessTexture:l?.metallicRoughnessTexture,metallicFactor:l?.metallicFactor,roughnessFactor:l?.roughnessFactor}):u({normalTexture:o.normalTexture,emissiveTexture:o.emissiveTexture,emissiveFactor:o.emissiveFactor,occlusionTexture:o.occlusionTexture,metallicRoughnessTexture:l?.metallicRoughnessTexture,metallicFactor:l?.metallicFactor,roughnessFactor:l?.roughnessFactor}),h=g?c[0]:l?.metallicFactor??m[0],f=g?c[1]:l?.roughnessFactor??m[1],F="mask"===o.alphaMode?33:1,T={baseColorFactor:n?[n[0],n[1],n[2],n[3]]:[1,1,1,1],baseColorTextureId:t(l?.baseColorTexture,F),metallicRoughnessTextureId:t(l?.metallicRoughnessTexture,2),metallicFactor:h,roughnessFactor:f},b={alphaMode:o.alphaMode,alphaCutoff:o.alphaCutoff,doubleSided:o.doubleSided,cullFace:"none"===o.cullFace?0:"back"===o.cullFace?2:"front"===o.cullFace?1:0,normalTextureId:t(o.normalTexture,4),emissiveTextureId:t(o.emissiveTexture,16),occlusionTextureId:t(o.occlusionTexture,8),emissiveFactor:d?[d[0],d[1],d[2]]:[0,0,0],metallicRoughness:T,wrapTextures:!1,hasParametersFromSource:g},C=[];return s.forEach(({usage:e},o)=>{const a=null!=r&&r[o]&&r[o].formats,s=a?p(a.map(({name:e,format:r})=>({name:e,encoding:x[r]}))):[];C.push({id:o,usage:e,encodings:s})}),{material:b,textures:C}}function p(e){return e.sort((e,r)=>e.encoding-r.encoding)}const x={ktx2:1,basis:2,dds:4,png:8,jpg:16,"ktx-etc2":32},h={"image/ktx2":2,"image/x.basis":2,"image/vnd-ms.dds":4,"image/png":8,"image/jpg":16,"image/jpeg":16,"image/ktx":32};function f(e){const a=e?.materialDefinitions?Object.keys(e.materialDefinitions)[0]:null,s=e?.textureDefinitions?Object.keys(e.textureDefinitions)[0]:null,t=a?e.materialDefinitions?.[a]:null,l=s?e.textureDefinitions?.[s]:null,n=F();if(null!=t){const e=t.params;e.diffuse&&(r(e.diffuse),n.metallicRoughness.baseColorFactor=[e.diffuse[0],e.diffuse[1],e.diffuse[2],1]),null!=e.doubleSided&&(n.doubleSided=e.doubleSided,n.cullFace=e.doubleSided?0:2),"none"!==e.cullFace&&"front"!==e.cullFace&&"back"!==e.cullFace||(n.cullFace="none"===e.cullFace?0:"back"===e.cullFace?2:1),e.transparency&&(n.metallicRoughness.baseColorFactor[3]=o(1-e.transparency,0,1)),(e.useVertexColorAlpha||n.metallicRoughness.baseColorFactor[3]<1)&&(n.alphaMode="blend")}const i=[];if(null!=l){const e=0;!l.wrap||"repeat"!==l.wrap[0]&&"repeat"!==l.wrap[1]||(n.wrapTextures=!0);let r=1;"rgba"===l.channels&&(n.alphaMode="blend",r|=32);const o=l.images.length-1,a=l.images[o],s=e=>e?.split("/").pop(),t=Array.isArray(l.encoding)?p(l.encoding.map((e,r)=>({name:s(a.href[r]),encoding:h[e]||0}))):[{name:s(a.href),encoding:h[l.encoding]||0}];i.push({id:e,usage:r,encodings:t}),n.metallicRoughness.baseColorTextureId=e}return{material:n,textures:i}}const F=()=>({alphaMode:"opaque",alphaCutoff:d,doubleSided:!0,cullFace:0,normalTextureId:-1,emissiveTextureId:-1,occlusionTextureId:-1,emissiveFactor:[0,0,0],metallicRoughness:{baseColorFactor:[.8,.8,.8,1],baseColorTextureId:-1,metallicRoughnessTextureId:-1,metallicFactor:0,roughnessFactor:.6},wrapTextures:!1,hasParametersFromSource:!0});function T(e,r,o,a,s,t){if(null==e?.data)return null;const l=e.data,i=a.renderingContext.parameters.maxMaxAnisotropy,u=i>1,c=o||!r.wrapTextures?b:C,m=k(e.encoding),d=1&e.usage?"opaque"===r.alphaMode?6407:6408:6407,g=P(e.encoding,e.usage)?{compressionTracker:s,compressionCallback:t}:void 0;return new n(l,{mipmap:u,maxAnisotropy:i,encoding:m,wrap:c,pixelFormat:d,compressionOptions:g,noUnpackFlip:!0})}const b={s:33071,t:33071},C={s:10497,t:10497};function M(r,o,a,s,n,i){const u=i.rendererTextureUsage,g=e=>v(s,a,e&u),p=e(o.metallicRoughness.baseColorFactor);r.baseColor=[p[0],p[1],p[2],p[3]],r.hasParametersFromSource=!!o.hasParametersFromSource,r.usePBR=i.usePBR,r.mrrFactors=[o.metallicRoughness.metallicFactor,o.metallicRoughness.roughnessFactor,o.hasParametersFromSource?c[2]:m[2]],r.emissiveBaseColor=o.emissiveFactor,r.isIntegratedMesh=i.isIntegratedMesh,r.textureAlphaCutoff="mask"===o.alphaMode?o.alphaCutoff:d,r.alphaDiscardMode="opaque"===o.alphaMode?1:"mask"===o.alphaMode?2:3;const x=[],h=g(33);null!=h&&(r.baseColorTexture=new t(n,h),x.push(r.baseColorTexture.loadPromise));const f=g(2);null!=f&&(r.metallicRoughnessTexture=new t(n,f),x.push(r.metallicRoughnessTexture.loadPromise));const F=g(16);null!=F&&(r.emissionTexture=new t(n,F),x.push(r.emissionTexture.loadPromise));const T=g(8);null!=T&&(r.occlusionTexture=new t(n,T),x.push(r.occlusionTexture.loadPromise));const b=g(4);return null!=b&&(r.normalTexture=new t(n,b),x.push(r.normalTexture.loadPromise)),r.commonMaterialParameters.hasSlicePlane=i.slicePlaneEnabled,r.commonMaterialParameters.doubleSided=o.doubleSided,r.commonMaterialParameters.cullFace=o.cullFace,r.ellipsoidMode=l(i.viewSpatialReference),Promise.all(x)}function R(e){const r=!!e.compressedTextureS3TC,o=!!e.compressedTextureETC,a=has("disable-feature:i3s-basis")?0:3;return 24|(r?4|a:0)|(o?a:0)}function w(e,r){if(null!=r)return e.find(e=>0!==(e.encoding&r))}function v(e,r,o){if(null==e||0===o)return null;for(let a=0;a<e.length;a++){const s=e[a];if(null!=s&&0!==(s.usage&o)){const e=r[a];return null!=e?e.id:null}}return null}function P(e,r){return!!has("enable-feature:esri-compress-IM-textures")&&(0!==(e&a)&&!(r&~s))}function k(e){switch(e){case 1:return"image/ktx2";case 2:return"image/x.basis";case 4:return"image/vnd-ms.dds";case 8:return"image/png";case 16:return"image/jpeg";case 32:return"image/ktx";default:return""}}export{M as configureMaterial,T as createTexture,F as defaultMaterial,g as getMaterialAndTextures,f as getMaterialAndTexturesFromShared,R as getSupportedEncodings,w as selectEncoding};
5
+ import{validateColorAndOpacity as e,validateColor as r}from"../../../../core/colorUtils.js";import has from"../../../../core/has.js";import{clamp as a}from"../../../../core/mathUtils.js";import{uncompressedFormats as o,compressibleUsages as s}from"./enums.js";import{RenderTexture as t}from"../../webgl-engine/core/material/RenderTexture.js";import{getEllipsoidMode as n}from"../../webgl-engine/core/shaderLibrary/util/EllipsoidMode.js";import{ManagedTexture as l}from"../../webgl-engine/lib/ManagedTexture.js";import{useSchematicPBR as i,schematicMRRFactors as u,advancedMRRFactors as c}from"../../webgl-engine/materials/pbrUtils.js";import{alphaCutoff as m}from"../../../../webscene/support/AlphaCutoff.js";function d(r,a,o){const s=new Map,t=(e,r)=>{if(null==e)return-1;const a=s.get(e.id);if(a)return a.usage|=r,a.id;const o=s.size;return s.set(e.id,{id:o,usage:r}),o},n=a.pbrMetallicRoughness,l=n?.baseColorFactor?e(n.baseColorFactor):null,m=a.emissiveFactor,d=o&&0===n?.metallicFactor||i({normalTexture:a.normalTexture,emissiveTexture:a.emissiveTexture,emissiveFactor:a.emissiveFactor,occlusionTexture:a.occlusionTexture,metallicRoughnessTexture:n?.metallicRoughnessTexture,metallicFactor:n?.metallicFactor,roughnessFactor:n?.roughnessFactor}),f=d?u[0]:n?.metallicFactor??c[0],h=d?u[1]:n?.roughnessFactor??c[1],x="mask"===a.alphaMode?33:1,b={baseColorFactor:l?[l[0],l[1],l[2],l[3]]:[1,1,1,1],baseColorTextureId:t(n?.baseColorTexture,x),metallicRoughnessTextureId:t(n?.metallicRoughnessTexture,2),metallicFactor:f,roughnessFactor:h},F={alphaMode:a.alphaMode,alphaCutoff:a.alphaCutoff,doubleSided:a.doubleSided,cullFace:"none"===a.cullFace?0:"back"===a.cullFace?2:"front"===a.cullFace?1:0,normalTextureId:t(a.normalTexture,4),emissiveTextureId:t(a.emissiveTexture,16),occlusionTextureId:t(a.occlusionTexture,8),emissiveFactor:m?[m[0],m[1],m[2]]:[0,0,0],metallicRoughness:b,wrapTextures:!1,hasParametersFromSource:d},T=[];return s.forEach(({usage:e},a)=>{const o=null!=r&&r[a]&&r[a].formats,s=o?p(o.map(({name:e,format:r})=>({name:e,encoding:g[r]}))):[];T.push({id:a,usage:e,encodings:s})}),{material:F,textures:T}}function p(e){return e.sort((e,r)=>e.encoding-r.encoding)}const g={ktx2:1,basis:2,dds:4,png:8,jpg:16,"ktx-etc2":32},f={"image/ktx2":2,"image/x.basis":2,"image/vnd-ms.dds":4,"image/png":8,"image/jpg":16,"image/jpeg":16,"image/ktx":32};function h(e){const o=e?.materialDefinitions?Object.keys(e.materialDefinitions)[0]:null,s=e?.textureDefinitions?Object.keys(e.textureDefinitions)[0]:null,t=o?e.materialDefinitions?.[o]:null,n=s?e.textureDefinitions?.[s]:null,l=x();if(null!=t){const e=t.params;e.diffuse&&(r(e.diffuse),l.metallicRoughness.baseColorFactor=[e.diffuse[0],e.diffuse[1],e.diffuse[2],1]),null!=e.doubleSided&&(l.doubleSided=e.doubleSided,l.cullFace=e.doubleSided?0:2),"none"!==e.cullFace&&"front"!==e.cullFace&&"back"!==e.cullFace||(l.cullFace="none"===e.cullFace?0:"back"===e.cullFace?2:1),e.transparency&&(l.metallicRoughness.baseColorFactor[3]=a(1-e.transparency,0,1)),(e.useVertexColorAlpha||l.metallicRoughness.baseColorFactor[3]<1)&&(l.alphaMode="blend")}const i=[];if(null!=n){const e=0;!n.wrap||"repeat"!==n.wrap[0]&&"repeat"!==n.wrap[1]||(l.wrapTextures=!0);let r=1;"rgba"===n.channels&&(l.alphaMode="blend",r|=32);const a=n.images.length-1,o=n.images[a],s=e=>e?.split("/").pop(),t=Array.isArray(n.encoding)?p(n.encoding.map((e,r)=>({name:s(o.href[r]),encoding:f[e]||0}))):[{name:s(o.href),encoding:f[n.encoding]||0}];i.push({id:e,usage:r,encodings:t}),l.metallicRoughness.baseColorTextureId=e}return{material:l,textures:i}}const x=()=>({alphaMode:"opaque",alphaCutoff:m,doubleSided:!0,cullFace:0,normalTextureId:-1,emissiveTextureId:-1,occlusionTextureId:-1,emissiveFactor:[0,0,0],metallicRoughness:{baseColorFactor:[.8,.8,.8,1],baseColorTextureId:-1,metallicRoughnessTextureId:-1,metallicFactor:0,roughnessFactor:.6},wrapTextures:!1,hasParametersFromSource:!0});function b(e,r,a,o,s,t){if(null==e?.data)return null;const n=e.data,i=o.renderingContext.parameters.maxMaxAnisotropy,u=i>1,c=a||!r.wrapTextures?F:T,m=k(e.encoding),d=1&e.usage?"opaque"===r.alphaMode?6407:6408:6407,p=P(e.encoding,e.usage)?{compressionTracker:s,compressionCallback:t}:void 0;return new l(n,{mipmap:u,maxAnisotropy:i,encoding:m,wrap:c,pixelFormat:d,compressionOptions:p,noUnpackFlip:!0})}const F={s:33071,t:33071},T={s:10497,t:10497};function C(r,a,o,s,l,i){const d=i.rendererTextureUsage,p=e=>R(s,o,e&d),g=e(a.metallicRoughness.baseColorFactor);r.baseColor=[g[0],g[1],g[2],g[3]],r.hasParametersFromSource=!!a.hasParametersFromSource,r.usePBR=i.usePBR,r.mrrFactors=[a.metallicRoughness.metallicFactor,a.metallicRoughness.roughnessFactor,a.hasParametersFromSource?u[2]:c[2]],r.emissiveBaseColor=a.emissiveFactor,r.isIntegratedMesh=i.isIntegratedMesh,r.textureAlphaCutoff="mask"===a.alphaMode?a.alphaCutoff:m,r.alphaDiscardMode="opaque"===a.alphaMode?1:"mask"===a.alphaMode?2:3;const f=[],h=p(33);null!=h&&(r.baseColorTexture=new t(l,h),f.push(r.baseColorTexture.loadPromise));const x=p(2);null!=x&&(r.metallicRoughnessTexture=new t(l,x),f.push(r.metallicRoughnessTexture.loadPromise));const b=p(16);null!=b&&(r.emissionTexture=new t(l,b),f.push(r.emissionTexture.loadPromise));const F=p(8);null!=F&&(r.occlusionTexture=new t(l,F),f.push(r.occlusionTexture.loadPromise));const T=p(4);return null!=T&&(r.normalTexture=new t(l,T),f.push(r.normalTexture.loadPromise)),r.commonMaterialParameters.hasSlicePlane=i.slicePlaneEnabled,r.commonMaterialParameters.doubleSided=a.doubleSided,r.commonMaterialParameters.cullFace=a.cullFace,r.ellipsoidMode=n(i.viewSpatialReference),Promise.all(f)}function M(e){const r=!!e.compressedTextureS3TC,a=!!e.compressedTextureETC,o=has("disable-feature:i3s-basis")?0:3;return 24|(r?4|o:0)|(a?o:0)}function w(e,r){if(null!=r)return e.find(e=>0!==(e.encoding&r))}function R(e,r,a){if(null==e||0===a)return null;for(let o=0;o<e.length;o++){const s=e[o];if(null!=s&&0!==(s.usage&a)){const e=r[o];return null!=e?e.id:null}}return null}function P(e,r){return!!has("enable-feature:esri-compress-IM-textures")&&(0!==(e&o)&&!(r&~s))}function k(e){switch(e){case 1:return"image/ktx2";case 2:return"image/x.basis";case 4:return"image/vnd-ms.dds";case 8:return"image/png";case 16:return"image/jpeg";case 32:return"image/ktx";default:return""}}export{C as configureMaterial,b as createTexture,x as defaultMaterial,d as getMaterialAndTextures,h as getMaterialAndTexturesFromShared,M as getSupportedEncodings,w as selectEncoding};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{n as e,a as t,g as i,c as s,F as n,e as r,d as o,H as a,v as c,j as u,G as h,s as l,C as d,b as m,E as _,i as p}from"../../../../chunks/vec32.js";import{create as f}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as v}from"../../../../geometry/ellipsoidUtils.js";import{getSphericalPCPF as g}from"../../../../geometry/spatialReferenceEllipsoidUtils.js";import{projectBoundingSphere as b}from"../../../../geometry/projection/projectBoundingSphere.js";import{getProjector as R}from"../../../../geometry/projection/projectors.js";import{create as S,fromMatrix as x,createPoints as M,intersectsSphere as C}from"../../../../geometry/support/frustum.js";import{getNormal as I,signedDistance as P}from"../../../../geometry/support/plane.js";import{isPlateCarree as D}from"../../../../geometry/support/spatialReferenceUtils.js";import{Sphere as E}from"../../../../geometry/support/sphere.js";import{makeDehydratedPoint as O}from"../../../../layers/graphics/dehydratedPoint.js";import{evaluateElevationAlignmentAtPoint as F}from"../graphics/elevationAlignmentUtils.js";import{ElevationContext as A}from"../graphics/ElevationContext.js";import{createContextWithoutExpressionSupport as V,extractExpressionInfo as B}from"../graphics/featureExpressionInfoUtils.js";import{isValidMbs as y,intersectBoundingRectWithMbs as j}from"./I3SUtil.js";import{Obb as L,computeOffsetObb as w}from"../../support/orientedBoundingBox.js";const q=1e5;class G{get _frustumMbsCenter(){return this._frustumMbs.center}get _frustumMbsRadius(){return this._frustumMbs.radius}get _frustumPlanes(){return this._frustum}constructor(e,t,i,s,n,r,o,a,c={}){this._indexSR=e,this._renderCoordsHelper=t,this._clippingArea=n,this._elevationProvider=r,this._viewingMode=o,this._options=c,this._frustum=S(),this._frustumMbs=new E,this._viewDirection=f(),this._useFrustumCulling=!1,this._poi=f(),this._cameraPOIDirection=f(),this._elevationContext=null,this.minDistance=1/0,this.maxDistance=0,this.maxLodLevel=2,this._tmpObb=new L,this._tmp1=f(),this._tmp2=f(),this._tmp3=f(),this._tmp0=f(),this._screenspaceErrorBias=c.screenspaceErrorBias||1,this._progressiveLoadFactor=c.progressiveLoadFactor||1,this.updateCamera(i,s);const u=this._renderCoordsHelper.spatialReference;this._renderSR=u,this._renderSRSphericalPCPF=g(u),this._isGlobalMode=u===this._renderSRSphericalPCPF,this.updateElevationInfo(a),this._tmpPoint=O(0,0,0,e),this._isECEFOBBInLocalMode=this._indexSR.isWGS84&&(u.isWebMercator||D(u)),this._indexSREllipsoidRadius=v(this._indexSR).radius,this._indexSRSphericalPCPF=g(e),this._projectorIndexSRToIndexSRSphericalPCPF=R(this._indexSR,this._indexSRSphericalPCPF)}updateElevationInfo(e){null!=e?(this._elevationContext=A.fromElevationInfo(e),this._elevationContext.setFeatureExpressionInfoContext(V(B(e,!1)))):this._elevationContext=null}updateCamera(n,r){if(this._useFrustumCulling=r,e(this._viewDirection,n.viewForward),r){x(n.viewMatrix,n.projectionMatrix,this._frustum,z);{const e=n.eye,r=N;t(r,z[4],e);const o=.5*i(r,r)/i(this._viewDirection,r),a=this._frustumMbs,c=a.center;s(c,e,this._viewDirection,o);const u=1+o;a.radius=u}}this._screenSizeFactor=1/(n.perScreenPixelRatio/2),this._camPos=n.eye,this._updateCameraPOIDirection(),this.minDistance=1/0,this.maxDistance=0}setPointOfInterest(e){this._poi=e,this._updateCameraPOIDirection()}updateScreenSpaceErrorBias(e){const t=this._screenspaceErrorBias;return this._screenspaceErrorBias=e,t}updateClippingArea(e){this._clippingArea=e}expandElevationRange(e,t,i){if(null==this._elevationContext)return;const s=e.serviceMbsInIndexSR;if(!s)return;const n="relative-to-scene"===this._elevationContext.mode?"scene":"ground",r=this._elevationProvider;if(r.getSphereElevationRange){const e=r.getSphereElevationRange(s,this._indexSR,n);if(e)return void i.expandElevationRange(e)}const[o,a,c]=s.center,u=r.getElevation(o,a,c,this._indexSR,n);u&&i.expandElevationRangeValues(u,u);const h=t?null:r.getRootElevationRange?.();h&&i.expandElevationRange(h)}getServiceMbsInRenderSR(e){const t=e.serviceMbsInRenderSR;if(y(t))return t;const{serviceMbsInIndexSR:i}=e;i&&t.copy(i);const{minElevation:s}=e;if(this._elevationContext&&Number.isFinite(s)){let i=0,n=0;const{maxElevation:r}=e;switch(this._elevationContext.mode){case"relative-to-ground":case"relative-to-scene":i=this._elevationContext.geometryZWithOffset(t.center[2],this._renderCoordsHelper)+s-t.center[2],n=r-s;break;case"on-the-ground":i=s-t.center[2],n=r-s}t.center[2]+=i+.5*n,t.radius+=.5*n}else this._elevationContext&&t.radius<q&&(this._tmpPoint.x=t.center[0],this._tmpPoint.y=t.center[1],this._tmpPoint.z=t.center[2],t.center[2]=F(this._tmpPoint,this._elevationProvider,this._elevationContext,this._renderCoordsHelper));return b(t,this._indexSR,t,this._renderSR),t}getAndUpdateVisibilityObbInRenderSR(e){{const t=e.visibilityObbInRenderSR;if(t)return t}const t=.01*this._indexSREllipsoidRadius,{serviceMbsInIndexSR:i,serviceObbInIndexSR:s}=e;if(null==s||!i||!s.isValid||this._isECEFOBBInLocalMode&&(s.halfSizeX>t||s.halfSizeY>t||s.halfSizeZ>t))return null;{let t=e.serviceObbInRenderSR;if(null==t)t=new L,e.serviceObbInRenderSR=t;else if(t.isValid)return t;const n=i.radius;let r=0,o=0;const a=s.centerZ,c=this._renderCoordsHelper,u=this._elevationContext;if(u&&e.elevationRangeValid){const{minElevation:t,maxElevation:i}=e;switch(u.mode){case"relative-to-ground":case"relative-to-scene":r=u.geometryZWithOffset(a,c)+t-a,o=i-t;break;case"on-the-ground":r=t-a,o=i-t}}else if(u&&n<q){const e=this._tmpPoint;e.x=s.centerX,e.y=s.centerY,e.z=a,r=F(e,this._elevationProvider,u,c)-a}const h=o>0,l=h?this._tmpObb:t;return s.transform(l,this._indexSR,this._renderSR,r,this._renderSRSphericalPCPF,this._indexSRSphericalPCPF,this._projectorIndexSRToIndexSRSphericalPCPF),h&&w(l,0,o,this._viewingMode,t),t}}getNodeObbInRenderSRIndependentOfElevationOffset(e){{const t=e.visibilityObbInRenderSR??e.serviceObbInRenderSR??null;if(t?.isValid)return t}const t=e.serviceObbInIndexSR;return t?(t.transform(Z,this._indexSR,this._renderSR,void 0,this._renderSRSphericalPCPF,this._indexSRSphericalPCPF,this._projectorIndexSRToIndexSRSphericalPCPF),Z):null}ensureElevationAgnosticBoundingVolume(e){return!e.elevationAgnosticBoundingVolume.valid&&e.level>0&&(1===this._viewingMode?this._updateElevationAgnosticBoundingVolumeGlobal(e):this._updateElevationAgnosticBoundingVolumeLocal(e)),e.elevationAgnosticBoundingVolume}_updateCameraPOIDirection(){n(this._poi,this._camPos)?this._cameraPOIDirection=this._viewDirection:(r(this._cameraPOIDirection,this._camPos,this._poi),e(this._cameraPOIDirection,this._cameraPOIDirection))}_updateElevationAgnosticBoundingVolumeGlobal(t){const s=this.getNodeObbInRenderSRIndependentOfElevationOffset(t),n=t.elevationAgnosticBoundingVolume;let r,c=-1;if(s){const t=X;s.getCenter(t),e(t,t),r=t,s.getCorners(Y);for(const s of Y){e(s,s);const r=i(s,t);if(r<=0)return void n.invalidate();const o=Math.sqrt(1-r*r);c=Math.max(c,o)}}else{const i=t.serviceMbsInRenderSR;if(!y(i))return void n.invalidate();{const t=o(X,i.center),s=i.radius,u=a(t);if(u<s)return void n.invalidate();c=s/u,e(t,t),r=t}}const u=.001;n.set(r,c+u)}_updateElevationAgnosticBoundingVolumeLocal(e){const t=e.elevationAgnosticBoundingVolume,i=this.getNodeObbInRenderSRIndependentOfElevationOffset(e);if(i){const e=i.getCenter(X);e[2]=0;let s=0;const n=J;i.getCorners(Y);for(const t of Y){t[2]=0;const e=c(n,t);s=Math.max(s,e)}t.set(e,Math.sqrt(s))}else{const i=e.serviceMbsInRenderSR;if(y(i)){const e=o(X,i.center);e[2]=0,t.set(e,i.radius)}}}isNodeVisible(e){const t=this.getServiceMbsInRenderSR(e);if(!this._isMBSinClippingArea(t))return!1;if(!this._useFrustumCulling)return!0;const i=this.getAndUpdateVisibilityObbInRenderSR(e);return i?i.doesIntersectFrustumConservativeApproximation(this._frustum):C(this._frustum,t)}isElevationAgnosticBoundingVolumeVisible(e){return!this._useFrustumCulling||(!e.valid||(1===this._viewingMode?this._isConeVisibleInFrustum(e):this._isCylinderVisibleInFrustum(e)))}_isConeVisibleInFrustum(n){if(!this._isConeVisibleInFrustumMbs(n))return!1;const r=n.radius;if(-1===r||r>.9)return!0;const o=this._frustumPlanes,a=this._frustumMbsCenter,c=n.getAxis(ee),h=i(c,a),l=this._frustumMbsRadius,d=h-l,m=h+l;if(d<=0)return!0;const _=u(k,c,d),p=u(H,c,m),f=r/Math.sqrt(1-r*r);for(const v of o){const n=I(v),r=e(W,n),o=i(r,c);if(Math.abs(1-o)<.01)continue;const a=K;u(a,c,o),t(a,a,r),e(a,a);const h=Q;s(h,_,a,d*f);if(P(v,h)<=0)continue;s(h,p,a,m*f);if(P(v,h)<=0)continue;return!1}return!0}_isConeVisibleInFrustumMbs(e){const t=e.radius;if(t>.9)return!0;const s=this._frustumMbsRadius,n=this._frustumMbsCenter,r=a(n);if(r<=s)return!0;const o=e.getAxis(ee),c=i(o,n);{const e=u(T,o,c);if(h(e,n)<s)return!0}const l=c/r;if(c<=0){return-l<s}const d=Math.sqrt(1-l*l);if(d<t)return!0;const m=s/r;return d*Math.sqrt(1-m*m)-m*l<t}isObbVisibleIndependentOfElevation(e,t){if(!this._useFrustumCulling)return!0;if(!e.valid)return!0;const s=this._frustumMbsRadius,n=this._frustumMbsCenter,r=this._frustumPlanes,o=Y;if(t.getCorners(o),1===this._viewingMode){const t=e.getAxis(ee),a=i(t,n),c=a-s,h=a+s;if(c<=0)return!0;for(const e of r){let s=!0;for(const n of o){const r=i(n,t),o=$;if(u(o,n,c/r),P(e,o)<=0){s=!1;break}const a=$;if(u(a,n,h/r),P(e,a)<=0){s=!1;break}}if(s)return!1}}else{const e=n[2]-s,t=n[2]+s;for(const i of r){let s=!0;const n=I(i),r=n[0],a=n[1],c=n[2],u=i[3];for(const i of o){const n=r*i[0]+a*i[1]+u;if(n+c*e<=0||n+c*t<=0){s=!1;break}}if(s)return!1}}return!0}_isCylinderVisibleInFrustum(e){const t=this._frustumMbsCenter,i=this._frustumMbsRadius,s=o(T,t);s[2]=0;const n=e.radius,r=e.getAxis(ee);return h(s,r)<=n+i}isGeometryVisible(e){if(!this._useFrustumCulling)return!0;const t=e.geometryObbInRenderSR;return t?.doesIntersectFrustumConservativeApproximation(this._frustum)??this.isNodeVisible(e)}_isMBSinClippingArea(e){return null==this._clippingArea||0!==j(this._clippingArea,e)}_screenSpaceDiameterMbs(e,t){const i=this.getServiceMbsInRenderSR(e),s=Math.sqrt(l(i.center,this._camPos)),n=s-i.radius;return this._updateMinMaxDistance(s),n<0?.5*Number.MAX_VALUE:t/n*this._screenSizeFactor}calcCameraDistance(e){return this.calcCameraDistanceToCenter(e)-this.getServiceMbsInRenderSR(e).radius}calcCameraDistanceToCenter(e){const t=this.getServiceMbsInRenderSR(e),i=d(t.center,this._camPos);return this._updateMinMaxDistance(i),i}calcAngleDependentLoD(e){const t=this.getServiceMbsInRenderSR(e),i=t.radius,s=(Math.abs(t.center[0]*(t.center[0]-this._camPos[0])+t.center[1]*(t.center[1]-this._camPos[1])+t.center[2]*(t.center[2]-this._camPos[2]))/m(t.center)+i)/d(t.center,this._camPos);return Math.min(1,s)}hasLOD(e){return 0!==e.lodMetric}_getDistanceGlobeMode(e,t){const s=m(t.center),n=m(e)-s;u(this._tmp0,e,i(e,t.center)/_(e));const o=l(t.center,this._tmp0),a=t.radius;if(o<=a*a)return Math.abs(n);{const o=u(this._tmp0,t.center,1/s),c=s,h=a*a/2/c,l=u(this._tmp1,o,c-h),_=e,f=r(this._tmp2,_,l),v=r(this._tmp2,f,u(this._tmp3,o,i(o,f))),g=p(this._tmp2,l,u(this._tmp2,v,a/m(v)));let b=d(_,g);if(n>=2e5){const e=r(this._tmp1,_,g);let t=i(e,o)/m(e);t<.08&&(t=1e-4),b/=t}return b}}_getDistance(e,t){return this._isGlobalMode?this._getDistanceGlobeMode(e,t):U(e,t)}_updateMinMaxDistance(e){e>0?(this.minDistance=Math.min(this.minDistance,e),this.maxDistance=Math.max(this.maxDistance,e)):(this.minDistance=0,this.maxDistance=Math.max(this.maxDistance,-e))}getLodLevel(e){if(0===e.lodMetric)return 0;if(0===e.childCount)return this.maxLodLevel;if(this._useFrustumCulling&&this._progressiveLoadFactor<1){const t=this._progressiveLoadFactor*this._screenspaceErrorBias,i=this._screenspaceErrorBias;return this.evaluateLODmetric(e,t)?this.evaluateLODmetric(e,i)?2:1:0}return this.evaluateLODmetric(e,this._screenspaceErrorBias)?this.maxLodLevel:0}evaluateLODmetric(e,t){switch(e.lodMetric){case 2:{const i=this.getServiceMbsInRenderSR(e),s=this._getDistance(this._camPos,i),n=2*s/this._screenSizeFactor,r=s+i.radius;return this._updateMinMaxDistance(r),e.maxError*t<=n}case 1:{let i=this._screenSpaceDiameterMbs(e,(e.serviceMbsInIndexSR?.radius??0)*t);return this._options.angleDependentLoD&&(i*=this.calcAngleDependentLoD(e)),i<e.maxError}case 3:return this._screenSpaceDiameterMbs(e,e.maxError)*t<10;case 4:return this.calcCameraDistance(e)>e.maxError*t}return!1}distToCameraPOIRay(e){if(null==e)return 0;const t=this.getServiceMbsInRenderSR(e),s=t.center,n=i(s,this._cameraPOIDirection),r=n*n,o=_(s)-r;return Math.sqrt(o)-t.radius}distCameraToPOI(){return d(this._camPos,this._poi)}}function U(e,t){const i=e[0]-t.center[0],s=e[1]-t.center[1],n=e[2]-t.center[2],r=i*i+s*s,o=t.radius;if(r<=o*o)return Math.abs(n);const a=Math.sqrt(r)-o;return Math.sqrt(n*n+a*a)}const z=M(),N=f(),T=f(),k=f(),H=f(),W=f(),Z=new L,X=f(),Y=[f(),f(),f(),f(),f(),f(),f(),f()],J=f(),K=f(),Q=f(),$=f(),ee=f();export{G as default};
5
+ import{n as e,a as t,g as i,c as s,G as n,e as r,d as o,u as a,w as c,j as u,H as h,s as l,D as d,b as m,F as _,i as p}from"../../../../chunks/vec32.js";import{create as f}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as v}from"../../../../geometry/ellipsoidUtils.js";import{getSphericalPCPF as g}from"../../../../geometry/spatialReferenceEllipsoidUtils.js";import{projectBoundingSphere as b}from"../../../../geometry/projection/projectBoundingSphere.js";import{getProjector as R}from"../../../../geometry/projection/projectors.js";import{create as S,fromMatrix as x,createPoints as M,intersectsSphere as C}from"../../../../geometry/support/frustum.js";import{getNormal as I,signedDistance as P}from"../../../../geometry/support/plane.js";import{isPlateCarree as D}from"../../../../geometry/support/spatialReferenceUtils.js";import{Sphere as E}from"../../../../geometry/support/sphere.js";import{makeDehydratedPoint as O}from"../../../../layers/graphics/dehydratedPoint.js";import{evaluateElevationAlignmentAtPoint as F}from"../graphics/elevationAlignmentUtils.js";import{ElevationContext as A}from"../graphics/ElevationContext.js";import{createContextWithoutExpressionSupport as V,extractExpressionInfo as B}from"../graphics/featureExpressionInfoUtils.js";import{isValidMbs as y,intersectBoundingRectWithMbs as j}from"./I3SUtil.js";import{Obb as L,computeOffsetObb as w}from"../../support/orientedBoundingBox.js";const q=1e5;class G{get _frustumMbsCenter(){return this._frustumMbs.center}get _frustumMbsRadius(){return this._frustumMbs.radius}get _frustumPlanes(){return this._frustum}constructor(e,t,i,s,n,r,o,a,c={}){this._indexSR=e,this._renderCoordsHelper=t,this._clippingArea=n,this._elevationProvider=r,this._viewingMode=o,this._options=c,this._frustum=S(),this._frustumMbs=new E,this._viewDirection=f(),this._useFrustumCulling=!1,this._poi=f(),this._cameraPOIDirection=f(),this._elevationContext=null,this.minDistance=1/0,this.maxDistance=0,this.maxLodLevel=2,this._tmpObb=new L,this._tmp1=f(),this._tmp2=f(),this._tmp3=f(),this._tmp0=f(),this._screenspaceErrorBias=c.screenspaceErrorBias||1,this._progressiveLoadFactor=c.progressiveLoadFactor||1,this.updateCamera(i,s);const u=this._renderCoordsHelper.spatialReference;this._renderSR=u,this._renderSRSphericalPCPF=g(u),this._isGlobalMode=u===this._renderSRSphericalPCPF,this.updateElevationInfo(a),this._tmpPoint=O(0,0,0,e),this._isECEFOBBInLocalMode=this._indexSR.isWGS84&&(u.isWebMercator||D(u)),this._indexSREllipsoidRadius=v(this._indexSR).radius,this._indexSRSphericalPCPF=g(e),this._projectorIndexSRToIndexSRSphericalPCPF=R(this._indexSR,this._indexSRSphericalPCPF)}updateElevationInfo(e){null!=e?(this._elevationContext=A.fromElevationInfo(e),this._elevationContext.setFeatureExpressionInfoContext(V(B(e,!1)))):this._elevationContext=null}updateCamera(n,r){if(this._useFrustumCulling=r,e(this._viewDirection,n.viewForward),r){x(n.viewMatrix,n.projectionMatrix,this._frustum,z);{const e=n.eye,r=N;t(r,z[4],e);const o=.5*i(r,r)/i(this._viewDirection,r),a=this._frustumMbs,c=a.center;s(c,e,this._viewDirection,o);const u=1+o;a.radius=u}}this._screenSizeFactor=1/(n.perScreenPixelRatio/2),this._camPos=n.eye,this._updateCameraPOIDirection(),this.minDistance=1/0,this.maxDistance=0}setPointOfInterest(e){this._poi=e,this._updateCameraPOIDirection()}updateScreenSpaceErrorBias(e){const t=this._screenspaceErrorBias;return this._screenspaceErrorBias=e,t}updateClippingArea(e){this._clippingArea=e}expandElevationRange(e,t,i){if(null==this._elevationContext)return;const s=e.serviceMbsInIndexSR;if(!s)return;const n="relative-to-scene"===this._elevationContext.mode?"scene":"ground",r=this._elevationProvider;if(r.getSphereElevationRange){const e=r.getSphereElevationRange(s,this._indexSR,n);if(e)return void i.expandElevationRange(e)}const[o,a,c]=s.center,u=r.getElevation(o,a,c,this._indexSR,n);u&&i.expandElevationRangeValues(u,u);const h=t?null:r.getRootElevationRange?.();h&&i.expandElevationRange(h)}getServiceMbsInRenderSR(e){const t=e.serviceMbsInRenderSR;if(y(t))return t;const{serviceMbsInIndexSR:i}=e;i&&t.copy(i);const{minElevation:s}=e;if(this._elevationContext&&Number.isFinite(s)){let i=0,n=0;const{maxElevation:r}=e;switch(this._elevationContext.mode){case"relative-to-ground":case"relative-to-scene":i=this._elevationContext.geometryZWithOffset(t.center[2],this._renderCoordsHelper)+s-t.center[2],n=r-s;break;case"on-the-ground":i=s-t.center[2],n=r-s}t.center[2]+=i+.5*n,t.radius+=.5*n}else this._elevationContext&&t.radius<q&&(this._tmpPoint.x=t.center[0],this._tmpPoint.y=t.center[1],this._tmpPoint.z=t.center[2],t.center[2]=F(this._tmpPoint,this._elevationProvider,this._elevationContext,this._renderCoordsHelper));return b(t,this._indexSR,t,this._renderSR),t}getAndUpdateVisibilityObbInRenderSR(e){{const t=e.visibilityObbInRenderSR;if(t)return t}const t=.01*this._indexSREllipsoidRadius,{serviceMbsInIndexSR:i,serviceObbInIndexSR:s}=e;if(null==s||!i||!s.isValid||this._isECEFOBBInLocalMode&&(s.halfSizeX>t||s.halfSizeY>t||s.halfSizeZ>t))return null;{let t=e.serviceObbInRenderSR;if(null==t)t=new L,e.serviceObbInRenderSR=t;else if(t.isValid)return t;const n=i.radius;let r=0,o=0;const a=s.centerZ,c=this._renderCoordsHelper,u=this._elevationContext;if(u&&e.elevationRangeValid){const{minElevation:t,maxElevation:i}=e;switch(u.mode){case"relative-to-ground":case"relative-to-scene":r=u.geometryZWithOffset(a,c)+t-a,o=i-t;break;case"on-the-ground":r=t-a,o=i-t}}else if(u&&n<q){const e=this._tmpPoint;e.x=s.centerX,e.y=s.centerY,e.z=a,r=F(e,this._elevationProvider,u,c)-a}const h=o>0,l=h?this._tmpObb:t;return s.transform(l,this._indexSR,this._renderSR,r,this._renderSRSphericalPCPF,this._indexSRSphericalPCPF,this._projectorIndexSRToIndexSRSphericalPCPF),h&&w(l,0,o,this._viewingMode,t),t}}getNodeObbInRenderSRIndependentOfElevationOffset(e){{const t=e.visibilityObbInRenderSR??e.serviceObbInRenderSR??null;if(t?.isValid)return t}const t=e.serviceObbInIndexSR;return t?(t.transform(Z,this._indexSR,this._renderSR,void 0,this._renderSRSphericalPCPF,this._indexSRSphericalPCPF,this._projectorIndexSRToIndexSRSphericalPCPF),Z):null}ensureElevationAgnosticBoundingVolume(e){return!e.elevationAgnosticBoundingVolume.valid&&e.level>0&&(1===this._viewingMode?this._updateElevationAgnosticBoundingVolumeGlobal(e):this._updateElevationAgnosticBoundingVolumeLocal(e)),e.elevationAgnosticBoundingVolume}_updateCameraPOIDirection(){n(this._poi,this._camPos)?this._cameraPOIDirection=this._viewDirection:(r(this._cameraPOIDirection,this._camPos,this._poi),e(this._cameraPOIDirection,this._cameraPOIDirection))}_updateElevationAgnosticBoundingVolumeGlobal(t){const s=this.getNodeObbInRenderSRIndependentOfElevationOffset(t),n=t.elevationAgnosticBoundingVolume;let r,c=-1;if(s){const t=X;s.getCenter(t),e(t,t),r=t,s.getCorners(Y);for(const s of Y){e(s,s);const r=i(s,t);if(r<=0)return void n.invalidate();const o=Math.sqrt(1-r*r);c=Math.max(c,o)}}else{const i=t.serviceMbsInRenderSR;if(!y(i))return void n.invalidate();{const t=o(X,i.center),s=i.radius,u=a(t);if(u<s)return void n.invalidate();c=s/u,e(t,t),r=t}}const u=.001;n.set(r,c+u)}_updateElevationAgnosticBoundingVolumeLocal(e){const t=e.elevationAgnosticBoundingVolume,i=this.getNodeObbInRenderSRIndependentOfElevationOffset(e);if(i){const e=i.getCenter(X);e[2]=0;let s=0;const n=J;i.getCorners(Y);for(const t of Y){t[2]=0;const e=c(n,t);s=Math.max(s,e)}t.set(e,Math.sqrt(s))}else{const i=e.serviceMbsInRenderSR;if(y(i)){const e=o(X,i.center);e[2]=0,t.set(e,i.radius)}}}isNodeVisible(e){const t=this.getServiceMbsInRenderSR(e);if(!this._isMBSinClippingArea(t))return!1;if(!this._useFrustumCulling)return!0;const i=this.getAndUpdateVisibilityObbInRenderSR(e);return i?i.doesIntersectFrustumConservativeApproximation(this._frustum):C(this._frustum,t)}isElevationAgnosticBoundingVolumeVisible(e){return!this._useFrustumCulling||(!e.valid||(1===this._viewingMode?this._isConeVisibleInFrustum(e):this._isCylinderVisibleInFrustum(e)))}_isConeVisibleInFrustum(n){if(!this._isConeVisibleInFrustumMbs(n))return!1;const r=n.radius;if(-1===r||r>.9)return!0;const o=this._frustumPlanes,a=this._frustumMbsCenter,c=n.getAxis(ee),h=i(c,a),l=this._frustumMbsRadius,d=h-l,m=h+l;if(d<=0)return!0;const _=u(k,c,d),p=u(H,c,m),f=r/Math.sqrt(1-r*r);for(const v of o){const n=I(v),r=e(W,n),o=i(r,c);if(Math.abs(1-o)<.01)continue;const a=K;u(a,c,o),t(a,a,r),e(a,a);const h=Q;s(h,_,a,d*f);if(P(v,h)<=0)continue;s(h,p,a,m*f);if(P(v,h)<=0)continue;return!1}return!0}_isConeVisibleInFrustumMbs(e){const t=e.radius;if(t>.9)return!0;const s=this._frustumMbsRadius,n=this._frustumMbsCenter,r=a(n);if(r<=s)return!0;const o=e.getAxis(ee),c=i(o,n);{const e=u(T,o,c);if(h(e,n)<s)return!0}const l=c/r;if(c<=0){return-l<s}const d=Math.sqrt(1-l*l);if(d<t)return!0;const m=s/r;return d*Math.sqrt(1-m*m)-m*l<t}isObbVisibleIndependentOfElevation(e,t){if(!this._useFrustumCulling)return!0;if(!e.valid)return!0;const s=this._frustumMbsRadius,n=this._frustumMbsCenter,r=this._frustumPlanes,o=Y;if(t.getCorners(o),1===this._viewingMode){const t=e.getAxis(ee),a=i(t,n),c=a-s,h=a+s;if(c<=0)return!0;for(const e of r){let s=!0;for(const n of o){const r=i(n,t),o=$;if(u(o,n,c/r),P(e,o)<=0){s=!1;break}const a=$;if(u(a,n,h/r),P(e,a)<=0){s=!1;break}}if(s)return!1}}else{const e=n[2]-s,t=n[2]+s;for(const i of r){let s=!0;const n=I(i),r=n[0],a=n[1],c=n[2],u=i[3];for(const i of o){const n=r*i[0]+a*i[1]+u;if(n+c*e<=0||n+c*t<=0){s=!1;break}}if(s)return!1}}return!0}_isCylinderVisibleInFrustum(e){const t=this._frustumMbsCenter,i=this._frustumMbsRadius,s=o(T,t);s[2]=0;const n=e.radius,r=e.getAxis(ee);return h(s,r)<=n+i}isGeometryVisible(e){if(!this._useFrustumCulling)return!0;const t=e.geometryObbInRenderSR;return t?.doesIntersectFrustumConservativeApproximation(this._frustum)??this.isNodeVisible(e)}_isMBSinClippingArea(e){return null==this._clippingArea||0!==j(this._clippingArea,e)}_screenSpaceDiameterMbs(e,t){const i=this.getServiceMbsInRenderSR(e),s=Math.sqrt(l(i.center,this._camPos)),n=s-i.radius;return this._updateMinMaxDistance(s),n<0?.5*Number.MAX_VALUE:t/n*this._screenSizeFactor}calcCameraDistance(e){return this.calcCameraDistanceToCenter(e)-this.getServiceMbsInRenderSR(e).radius}calcCameraDistanceToCenter(e){const t=this.getServiceMbsInRenderSR(e),i=d(t.center,this._camPos);return this._updateMinMaxDistance(i),i}calcAngleDependentLoD(e){const t=this.getServiceMbsInRenderSR(e),i=t.radius,s=(Math.abs(t.center[0]*(t.center[0]-this._camPos[0])+t.center[1]*(t.center[1]-this._camPos[1])+t.center[2]*(t.center[2]-this._camPos[2]))/m(t.center)+i)/d(t.center,this._camPos);return Math.min(1,s)}hasLOD(e){return 0!==e.lodMetric}_getDistanceGlobeMode(e,t){const s=m(t.center),n=m(e)-s;u(this._tmp0,e,i(e,t.center)/_(e));const o=l(t.center,this._tmp0),a=t.radius;if(o<=a*a)return Math.abs(n);{const o=u(this._tmp0,t.center,1/s),c=s,h=a*a/2/c,l=u(this._tmp1,o,c-h),_=e,f=r(this._tmp2,_,l),v=r(this._tmp2,f,u(this._tmp3,o,i(o,f))),g=p(this._tmp2,l,u(this._tmp2,v,a/m(v)));let b=d(_,g);if(n>=2e5){const e=r(this._tmp1,_,g);let t=i(e,o)/m(e);t<.08&&(t=1e-4),b/=t}return b}}_getDistance(e,t){return this._isGlobalMode?this._getDistanceGlobeMode(e,t):U(e,t)}_updateMinMaxDistance(e){e>0?(this.minDistance=Math.min(this.minDistance,e),this.maxDistance=Math.max(this.maxDistance,e)):(this.minDistance=0,this.maxDistance=Math.max(this.maxDistance,-e))}getLodLevel(e){if(0===e.lodMetric)return 0;if(0===e.childCount)return this.maxLodLevel;if(this._useFrustumCulling&&this._progressiveLoadFactor<1){const t=this._progressiveLoadFactor*this._screenspaceErrorBias,i=this._screenspaceErrorBias;return this.evaluateLODmetric(e,t)?this.evaluateLODmetric(e,i)?2:1:0}return this.evaluateLODmetric(e,this._screenspaceErrorBias)?this.maxLodLevel:0}evaluateLODmetric(e,t){switch(e.lodMetric){case 2:{const i=this.getServiceMbsInRenderSR(e),s=this._getDistance(this._camPos,i),n=2*s/this._screenSizeFactor,r=s+i.radius;return this._updateMinMaxDistance(r),e.maxError*t<=n}case 1:{let i=this._screenSpaceDiameterMbs(e,(e.serviceMbsInIndexSR?.radius??0)*t);return this._options.angleDependentLoD&&(i*=this.calcAngleDependentLoD(e)),i<e.maxError}case 3:return this._screenSpaceDiameterMbs(e,e.maxError)*t<10;case 4:return this.calcCameraDistance(e)>e.maxError*t}return!1}distToCameraPOIRay(e){if(null==e)return 0;const t=this.getServiceMbsInRenderSR(e),s=t.center,n=i(s,this._cameraPOIDirection),r=n*n,o=_(s)-r;return Math.sqrt(o)-t.radius}distCameraToPOI(){return d(this._camPos,this._poi)}}function U(e,t){const i=e[0]-t.center[0],s=e[1]-t.center[1],n=e[2]-t.center[2],r=i*i+s*s,o=t.radius;if(r<=o*o)return Math.abs(n);const a=Math.sqrt(r)-o;return Math.sqrt(n*n+a*a)}const z=M(),N=f(),T=f(),k=f(),H=f(),W=f(),Z=new L,X=f(),Y=[f(),f(),f(),f(),f(),f(),f(),f()],J=f(),K=f(),Q=f(),$=f(),ee=f();export{G as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import{disposeMaybe as t}from"../../../../core/maybe.js";import s from"../../../../core/PooledArray.js";import{property as i,subclass as r}from"../../../../core/accessorSupport/decorators.js";import{e as n,b as o,j as a,q as h,g as l,E as c}from"../../../../chunks/vec32.js";import{create as d}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{c as u}from"../../../../chunks/vec42.js";import{create as p,offset as m,contains as g,containsPoint as _,set as f,positiveInfinity as P,equals as x}from"../../../../geometry/support/aaBoundingBox.js";import{create as b}from"../../../../geometry/support/plane.js";import{fromPoints as S}from"../../../../geometry/support/ray.js";import{Sphere as w}from"../../../../geometry/support/sphere.js";import{PclTarget as z}from"./Intersector.js";import{PointCloudHighlights as y}from"./PointCloudHighlights.js";import{isDepth as R,isColor as j}from"../../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{SyncRenderPlugin as v}from"../../webgl-engine/effects/RenderPlugin.js";import{IntersectorResult as q}from"../../webgl-engine/lib/IntersectorResult.js";import{VertexArrayObject as F}from"../../webgl-engine/lib/VertexArrayObject.js";import{P as A,g as E}from"../../../../chunks/PointRenderer.glsl.js";import{PointRendererTechnique as B,positionsLayout as H,colorsLayout as M}from"../../webgl-engine/shaders/PointRendererTechnique.js";import{PointRendererTechniqueConfiguration as O}from"../../webgl-engine/shaders/PointRendererTechniqueConfiguration.js";import{PrimitiveType as I}from"../../../webgl/enums.js";import{VertexBuffer as N}from"../../../webgl/VertexBuffer.js";let V=class extends v{constructor(e){super(e),this.type=6,this.isGround=!1,this._passParameters=new A,this._highlights=new y({forEachNode:e=>this.forEachNode(e),addHighlight:(e,t,s)=>this._addHighlight(e,t,s),removeHighlight:(e,t)=>this._removeHighlight(e,t)}),this.produces=new Map([[2,e=>!(R(e)||8===e&&this._highlights.empty)],[3,e=>R(e)]]),this.point=d(),this.intersectionRayDir=d(),this.intersectionPlane=b(),this.nodeOriginOffset=d(),this.nodeBoundingBox=p(),this.layerViewUid="",this._slicePlaneEnabled=!1,this._configuration=new O,this._nodes=new s}destroy(){this._nodes.prune()}hasHighlight(e){return this._highlights.has(e)}initializeRenderContext(e){this._context=e,e.requestRender()}uninitializeRenderContext(){}intersect(e,t,s,i){const{point:r,intersectionRayDir:f,nodeOriginOffset:P,intersectionPlane:x,layerViewUid:b,nodeBoundingBox:y}=this,R=S(s,i),j=e.camera.perScreenPixelRatio/2,v=e.camera.near;n(f,i,s);const F=1/o(f);a(f,f,F);const A=d();h(A,f),u(x,f[0],f[1],f[2],-l(f,s));const E=new U,B=new U,H=new Array,M=p(this._passParameters.clipBox);m(M,-s[0],-s[1],-s[2],M),this._nodes.forAll(o=>{const{isLeaf:a,coordinates:h}=o,d=o.splatSize*this._passParameters.scaleFactor;let u=o.obb.minimumDistancePlane(x),p=o.obb.maximumDistancePlane(x);u-=C(d,u+v,this._passParameters,j,a),p-=C(d,p+v,this._passParameters,j,a);const S=p<0,z=null!=E.dist&&null!=B.dist&&E.dist<u*F&&B.dist>p*F;if(S||z)return;const q=T(d,p+v,this._passParameters,j,a);if(!new w(o.obb.center,o.obb.radius+q).intersectRay(R))return;if(!o.obb.intersectRay(s,f,q))return;const O=q*q;o.obb.toAaBoundingBox(y),m(y,-s[0],-s[1],-s[2],y);const I=!g(M,y);n(P,o.origin,s);const N=h.length/3;for(let n=0;n<N;n++){const u=3*n;if(r[0]=P[0]+h[u],r[1]=P[1]+h[u+1],r[2]=P[2]+h[u+2],I&&!_(M,r))continue;const p=l(r,f),m=p*p,g=c(r)-m;if(g>O)continue;let x=p+v;const S=C(d,x,this._passParameters,j,a);if(p-S<0)continue;x-=S;const w=T(d,x,this._passParameters,j,a);if(g>w*w)continue;const z=(p-S)*F,y=e=>(e.point=e.point?D(o,n,e.point):D(o,n),e.dist=z,e.normal=A,e.node=o,e.pointId=n,e.layerViewUid=b,e);if((null==E.dist||z<E.dist)&&(null==t||t(s,i,z))&&y(E),0!==e.options.store&&(null==B.dist||z>B.dist)&&(null==t||t(s,i,z))&&y(B),2===e.options.store&&(null==t||t(s,i,z))){const e=new U;H.push(y(e))}}});const O=e=>{const{layerViewUid:t,node:s,pointId:i}=e;return new z(e.point,t,i,()=>this.createGraphic(s,i,e.point))},I=(e,t)=>{const s=O(t);e.set(this.type,s,t.dist,t.normal)};if(W(E)){const t=e.results.min;(null==t.distance||E.dist<t.distance)&&I(t,E)}if(W(B)&&0!==e.options.store){const t=e.results.max;(null==t.distance||B.dist>t.distance)&&I(t,B)}if(2===e.options.store)for(const n of H){const t=new q(R);I(t,n),e.results.all.push(t)}}acquireTechniques(e){const t=8===e.output;return 0!==this._nodes.length&&(j(e.output)||R(e.output)&&3===e.bind.slot||t)?(this._nodes.forAll(t=>this._initNode(e,t)),this._configuration.drawScreenSize=this._passParameters.drawScreenSpace,this._configuration.useFixedSizes=this._passParameters.useFixedSizes,this._configuration.hasSlicePlane=this._slicePlaneEnabled,this._configuration.hasOccludees=e.bind.hasOccludees,this._configuration.clippingEnabled=this._clippingEnabled,this._configuration.hasHighlightMixTexture=t&&null!=e.bind.highlightMixTexture,this._configuration.output=e.output,this._context.techniques.get(B,this._configuration)):null}render(e,t){const{rctx:s,bind:i,output:r}=e,n=s.bindTechnique(t,i,this._passParameters),o=8===r,a=i.highlight?.name??null;o&&!a||this._nodes.forAll(t=>{0===t.coordinates.length||null==t.vao||o&&!t.highlightMap.has(a)||(n.assertCompatibleVertexAttributeLocations(t.vao),n.bindDraw(i,this._passParameters,t),s.bindVAO(t.vao),o?this._renderHighlightFragments(e,t):s.drawArrays(I.POINTS,0,t.coordinates.length/3))})}_renderHighlightFragments(e,t){const{highlightMap:s}=t,{rctx:i,bind:r}=e,{highlight:n}=r;if(!n)return;const o=n.name,a=s.get(o);if(!a||0===a.length)return;const{highlightOrderMap:h,highlightLevel:l}=r;if(null==l)return;for(const g of s.keys())if(g!==o){const e=h.get(g);if(void 0!==e&&e>l)return}let c=0,d=a[0].componentIndex,u=d+1;const p=()=>{for(;c<a.length&&a[c].id.highlightName!==o;)d=a[c].componentIndex,++c;u=d+1};p();const m=(e,t)=>{const s=t-e;s>0&&i.drawArrays(I.POINTS,e,s)};for(;c<a.length;){const e=a[c];if(e.id.highlightName!==o){m(d,u),++c,p();continue}const t=e.componentIndex;t!==u&&(m(d,u),d=t),u=t+1,++c}m(d,u)}set useFixedSizes(e){this._passParameters.useFixedSizes!==e&&(this._passParameters.useFixedSizes=e,this._requestRender())}get useFixedSizes(){return this._passParameters.useFixedSizes}set scaleFactor(e){this._passParameters.scaleFactor!==e&&(this._passParameters.scaleFactor=e,this._requestRender())}get scaleFactor(){return this._passParameters.scaleFactor}set minSizePx(e){this._passParameters.minSizePx!==e&&(this._passParameters.minSizePx=e,this._requestRender())}get minSizePx(){return this._passParameters.minSizePx}set useRealWorldSymbolSizes(e){this._passParameters.useRealWorldSymbolSizes!==e&&(this._passParameters.useRealWorldSymbolSizes=e,this._requestRender())}get useRealWorldSymbolSizes(){return this._passParameters.useRealWorldSymbolSizes}set size(e){this._passParameters.size!==e&&(this._passParameters.size=e,this._requestRender())}get size(){return this._passParameters.size}set sizePx(e){this._passParameters.sizePx!==e&&(this._passParameters.sizePx=e,this._requestRender())}get sizePx(){return this._passParameters.sizePx}set clippingBox(e){f(this._passParameters.clipBox,e||P)}get _clippingEnabled(){return!x(this._passParameters.clipBox,P,(e,t)=>e===t)}get slicePlaneEnabled(){return this._slicePlaneEnabled}set slicePlaneEnabled(e){this._slicePlaneEnabled!==e&&(this._slicePlaneEnabled=e,this._requestRender())}addNode(e){this._nodes.push(e),this._highlights.nodeAdded(e),this._requestRender()}removeNode(e){let s=null;return this._nodes.filterInPlace(i=>i.id!==e||(s=i,i.vao=t(i.vao),this._highlights.nodeRemoved(i),!1)),this._requestRender(),s}forEachNode(e){this._nodes.forEach(e)}removeAll(){this._nodes.forAll(e=>e.vao=t(e.vao)),this._highlights.removeAll(),this._nodes.clear(),this._requestRender()}highlight(e,t){return this._highlights.add(e,t)}_addHighlight(e,t,s){e.addHighlight(t,s),this._requestRender()}_removeHighlight(e,t){e.removeHighlight(t),this._requestRender()}_initNode(e,t){t.vao??=new F(e.rctx,new Map([["positions",new N(e.rctx,H,t.coordinates)],["colors",new N(e.rctx,M,t.rgb)]]))}_requestRender(){this._context&&this._context.requestRender()}};function T(e,t,s,i,r){if(s.drawScreenSpace)return s.fixedSize*t*i;const n=E(r)*t*i;return s.useFixedSizes?Math.min(s.fixedSize/2,n):s.screenMinSize>0?Math.min(Math.max(s.screenMinSize*t*i,e/2),n):Math.min(e/2,n)}function C(e,t,s,i,r){return s.drawScreenSpace?0:T(e,t,s,i,r)}function D(e,t,s=d()){return s[0]=e.origin[0]+e.coordinates[3*t],s[1]=e.origin[1]+e.coordinates[3*t+1],s[2]=e.origin[2]+e.coordinates[3*t+2],s}e([i({constructOnly:!0})],V.prototype,"createGraphic",void 0),V=e([r("esri.views.3d.layers.i3s.PointCloudRenderer")],V);class U{constructor(){this.node=null,this.pointId=null,this.point=null,this.dist=null,this.normal=null,this.layerViewUid=""}}function W(e){return null!=e.dist&&null!=e.point&&null!=e.pointId&&null!=e.node}export{V as PointCloudRenderer};
5
+ import{__decorate as e}from"tslib";import{disposeMaybe as t}from"../../../../core/maybe.js";import s from"../../../../core/PooledArray.js";import{property as i,subclass as r}from"../../../../core/accessorSupport/decorators.js";import{e as n,b as o,j as a,q as h,g as l,F as c}from"../../../../chunks/vec32.js";import{create as d}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{c as u}from"../../../../chunks/vec42.js";import{create as p,offset as m,contains as g,containsPoint as _,set as f,positiveInfinity as P,equals as x}from"../../../../geometry/support/aaBoundingBox.js";import{create as b}from"../../../../geometry/support/plane.js";import{fromPoints as S}from"../../../../geometry/support/ray.js";import{Sphere as w}from"../../../../geometry/support/sphere.js";import{PclTarget as z}from"./Intersector.js";import{PointCloudHighlights as y}from"./PointCloudHighlights.js";import{isDepth as R,isColor as j}from"../../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{SyncRenderPlugin as v}from"../../webgl-engine/effects/RenderPlugin.js";import{IntersectorResult as q}from"../../webgl-engine/lib/IntersectorResult.js";import{VertexArrayObject as F}from"../../webgl-engine/lib/VertexArrayObject.js";import{P as A,g as E}from"../../../../chunks/PointRenderer.glsl.js";import{PointRendererTechnique as B,positionsLayout as H,colorsLayout as M}from"../../webgl-engine/shaders/PointRendererTechnique.js";import{PointRendererTechniqueConfiguration as O}from"../../webgl-engine/shaders/PointRendererTechniqueConfiguration.js";import{PrimitiveType as I}from"../../../webgl/enums.js";import{VertexBuffer as N}from"../../../webgl/VertexBuffer.js";let V=class extends v{constructor(e){super(e),this.type=6,this.isGround=!1,this._passParameters=new A,this._highlights=new y({forEachNode:e=>this.forEachNode(e),addHighlight:(e,t,s)=>this._addHighlight(e,t,s),removeHighlight:(e,t)=>this._removeHighlight(e,t)}),this.produces=new Map([[2,e=>!(R(e)||8===e&&this._highlights.empty)],[3,e=>R(e)]]),this.point=d(),this.intersectionRayDir=d(),this.intersectionPlane=b(),this.nodeOriginOffset=d(),this.nodeBoundingBox=p(),this.layerViewUid="",this._slicePlaneEnabled=!1,this._configuration=new O,this._nodes=new s}destroy(){this._nodes.prune()}hasHighlight(e){return this._highlights.has(e)}initializeRenderContext(e){this._context=e,e.requestRender()}uninitializeRenderContext(){}intersect(e,t,s,i){const{point:r,intersectionRayDir:f,nodeOriginOffset:P,intersectionPlane:x,layerViewUid:b,nodeBoundingBox:y}=this,R=S(s,i),j=e.camera.perScreenPixelRatio/2,v=e.camera.near;n(f,i,s);const F=1/o(f);a(f,f,F);const A=d();h(A,f),u(x,f[0],f[1],f[2],-l(f,s));const E=new U,B=new U,H=new Array,M=p(this._passParameters.clipBox);m(M,-s[0],-s[1],-s[2],M),this._nodes.forAll(o=>{const{isLeaf:a,coordinates:h}=o,d=o.splatSize*this._passParameters.scaleFactor;let u=o.obb.minimumDistancePlane(x),p=o.obb.maximumDistancePlane(x);u-=C(d,u+v,this._passParameters,j,a),p-=C(d,p+v,this._passParameters,j,a);const S=p<0,z=null!=E.dist&&null!=B.dist&&E.dist<u*F&&B.dist>p*F;if(S||z)return;const q=T(d,p+v,this._passParameters,j,a);if(!new w(o.obb.center,o.obb.radius+q).intersectRay(R))return;if(!o.obb.intersectRay(s,f,q))return;const O=q*q;o.obb.toAaBoundingBox(y),m(y,-s[0],-s[1],-s[2],y);const I=!g(M,y);n(P,o.origin,s);const N=h.length/3;for(let n=0;n<N;n++){const u=3*n;if(r[0]=P[0]+h[u],r[1]=P[1]+h[u+1],r[2]=P[2]+h[u+2],I&&!_(M,r))continue;const p=l(r,f),m=p*p,g=c(r)-m;if(g>O)continue;let x=p+v;const S=C(d,x,this._passParameters,j,a);if(p-S<0)continue;x-=S;const w=T(d,x,this._passParameters,j,a);if(g>w*w)continue;const z=(p-S)*F,y=e=>(e.point=e.point?D(o,n,e.point):D(o,n),e.dist=z,e.normal=A,e.node=o,e.pointId=n,e.layerViewUid=b,e);if((null==E.dist||z<E.dist)&&(null==t||t(s,i,z))&&y(E),0!==e.options.store&&(null==B.dist||z>B.dist)&&(null==t||t(s,i,z))&&y(B),2===e.options.store&&(null==t||t(s,i,z))){const e=new U;H.push(y(e))}}});const O=e=>{const{layerViewUid:t,node:s,pointId:i}=e;return new z(e.point,t,i,()=>this.createGraphic(s,i,e.point))},I=(e,t)=>{const s=O(t);e.set(this.type,s,t.dist,t.normal)};if(W(E)){const t=e.results.min;(null==t.distance||E.dist<t.distance)&&I(t,E)}if(W(B)&&0!==e.options.store){const t=e.results.max;(null==t.distance||B.dist>t.distance)&&I(t,B)}if(2===e.options.store)for(const n of H){const t=new q(R);I(t,n),e.results.all.push(t)}}acquireTechniques(e){const t=8===e.output;return 0!==this._nodes.length&&(j(e.output)||R(e.output)&&3===e.bind.slot||t)?(this._nodes.forAll(t=>this._initNode(e,t)),this._configuration.drawScreenSize=this._passParameters.drawScreenSpace,this._configuration.useFixedSizes=this._passParameters.useFixedSizes,this._configuration.hasSlicePlane=this._slicePlaneEnabled,this._configuration.hasOccludees=e.bind.hasOccludees,this._configuration.clippingEnabled=this._clippingEnabled,this._configuration.hasHighlightMixTexture=t&&null!=e.bind.highlightMixTexture,this._configuration.output=e.output,this._context.techniques.get(B,this._configuration)):null}render(e,t){const{rctx:s,bind:i,output:r}=e,n=s.bindTechnique(t,i,this._passParameters),o=8===r,a=i.highlight?.name??null;o&&!a||this._nodes.forAll(t=>{0===t.coordinates.length||null==t.vao||o&&!t.highlightMap.has(a)||(n.assertCompatibleVertexAttributeLocations(t.vao),n.bindDraw(i,this._passParameters,t),s.bindVAO(t.vao),o?this._renderHighlightFragments(e,t):s.drawArrays(I.POINTS,0,t.coordinates.length/3))})}_renderHighlightFragments(e,t){const{highlightMap:s}=t,{rctx:i,bind:r}=e,{highlight:n}=r;if(!n)return;const o=n.name,a=s.get(o);if(!a||0===a.length)return;const{highlightOrderMap:h,highlightLevel:l}=r;if(null==l)return;for(const g of s.keys())if(g!==o){const e=h.get(g);if(void 0!==e&&e>l)return}let c=0,d=a[0].componentIndex,u=d+1;const p=()=>{for(;c<a.length&&a[c].id.highlightName!==o;)d=a[c].componentIndex,++c;u=d+1};p();const m=(e,t)=>{const s=t-e;s>0&&i.drawArrays(I.POINTS,e,s)};for(;c<a.length;){const e=a[c];if(e.id.highlightName!==o){m(d,u),++c,p();continue}const t=e.componentIndex;t!==u&&(m(d,u),d=t),u=t+1,++c}m(d,u)}set useFixedSizes(e){this._passParameters.useFixedSizes!==e&&(this._passParameters.useFixedSizes=e,this._requestRender())}get useFixedSizes(){return this._passParameters.useFixedSizes}set scaleFactor(e){this._passParameters.scaleFactor!==e&&(this._passParameters.scaleFactor=e,this._requestRender())}get scaleFactor(){return this._passParameters.scaleFactor}set minSizePx(e){this._passParameters.minSizePx!==e&&(this._passParameters.minSizePx=e,this._requestRender())}get minSizePx(){return this._passParameters.minSizePx}set useRealWorldSymbolSizes(e){this._passParameters.useRealWorldSymbolSizes!==e&&(this._passParameters.useRealWorldSymbolSizes=e,this._requestRender())}get useRealWorldSymbolSizes(){return this._passParameters.useRealWorldSymbolSizes}set size(e){this._passParameters.size!==e&&(this._passParameters.size=e,this._requestRender())}get size(){return this._passParameters.size}set sizePx(e){this._passParameters.sizePx!==e&&(this._passParameters.sizePx=e,this._requestRender())}get sizePx(){return this._passParameters.sizePx}set clippingBox(e){f(this._passParameters.clipBox,e||P)}get _clippingEnabled(){return!x(this._passParameters.clipBox,P,(e,t)=>e===t)}get slicePlaneEnabled(){return this._slicePlaneEnabled}set slicePlaneEnabled(e){this._slicePlaneEnabled!==e&&(this._slicePlaneEnabled=e,this._requestRender())}addNode(e){this._nodes.push(e),this._highlights.nodeAdded(e),this._requestRender()}removeNode(e){let s=null;return this._nodes.filterInPlace(i=>i.id!==e||(s=i,i.vao=t(i.vao),this._highlights.nodeRemoved(i),!1)),this._requestRender(),s}forEachNode(e){this._nodes.forEach(e)}removeAll(){this._nodes.forAll(e=>e.vao=t(e.vao)),this._highlights.removeAll(),this._nodes.clear(),this._requestRender()}highlight(e,t){return this._highlights.add(e,t)}_addHighlight(e,t,s){e.addHighlight(t,s),this._requestRender()}_removeHighlight(e,t){e.removeHighlight(t),this._requestRender()}_initNode(e,t){t.vao??=new F(e.rctx,new Map([["positions",new N(e.rctx,H,t.coordinates)],["colors",new N(e.rctx,M,t.rgb)]]))}_requestRender(){this._context&&this._context.requestRender()}};function T(e,t,s,i,r){if(s.drawScreenSpace)return s.fixedSize*t*i;const n=E(r)*t*i;return s.useFixedSizes?Math.min(s.fixedSize/2,n):s.screenMinSize>0?Math.min(Math.max(s.screenMinSize*t*i,e/2),n):Math.min(e/2,n)}function C(e,t,s,i,r){return s.drawScreenSpace?0:T(e,t,s,i,r)}function D(e,t,s=d()){return s[0]=e.origin[0]+e.coordinates[3*t],s[1]=e.origin[1]+e.coordinates[3*t+1],s[2]=e.origin[2]+e.coordinates[3*t+2],s}e([i({constructOnly:!0})],V.prototype,"createGraphic",void 0),V=e([r("esri.views.3d.layers.i3s.PointCloudRenderer")],V);class U{constructor(){this.node=null,this.pointId=null,this.point=null,this.dist=null,this.normal=null,this.layerViewUid=""}}function W(e){return null!=e.dist&&null!=e.point&&null!=e.pointId&&null!=e.node}export{V as PointCloudRenderer};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{H as e,h as t,n as s,g as i,j as o,d as r,G as a}from"../../../../chunks/vec32.js";import{create as n,freeze as l,ZEROS as c}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{distance as d}from"../../../../geometry/support/aaBoundingRect.js";import{intersectsPoint as h}from"../../../../geometry/support/frustum.js";import{fromValues as m}from"../../../../geometry/support/ray.js";import{FeatureTileVisibility3D as p,minTileLOD as u}from"./FeatureTileVisibility3D.js";import _ from"../../webgl/RenderCamera.js";class f{constructor(e,t,s){this._renderCoordsHelper=e,this._tilingScheme=t,this._camera=new _,this._surfaceElevation=0,this._focusOnMap=[0,0],this._visibility=new p(e,s)}set opaqueGround(e){this._visibility.opaqueGround=e}setup(e,t,s){this._camera.copyFrom(e),this._surfaceElevation=s,this._focusOnMap[0]=t.x,this._focusOnMap[1]=t.y,this._visibility.setup(this._camera)}done(){this._visibility.done()}update(e){const{measures:t,extent:s,level:i}=e;s&&(t.visible=this._visibility.compute(e),t.distance=d(s,this._focusOnMap),t.mergeable=!0,t.lodLevel=u,t.splitPriority=Math.max(0,u-i),t.visible&&(this._isGlobal?this._updateSplitAndLodGlobal(e):this._updateSplitAndLodLocal(e)))}_updateSplitAndLodGlobal(r){const a=r.level,n=this._renderCoordsHelper,{eye:l,fov:c}=this._camera,d=n.referenceEllipsoid.radius,h=e(l)-d;if(2*Math.atan(d/h)<c&&h>0)return void(r.measures.lodLevel=Math.max(a,u));const m=v,{extent:p}=r;if(!p)return;const{_surfaceElevation:_}=this;t(m[0],p[0],p[1],_),t(m[1],p[2],p[1],_),t(m[2],p[2],p[3],_),t(m[3],p[0],p[3],_);const f=t(M,.5*(p[0]+p[2]),.5*(p[1]+p[3]),_),y=this._tilingScheme.spatialReference;for(let e=0;e<4;++e)n.toRenderCoords(m[e],y,m[e]);n.toRenderCoords(f,y,f);const x=s(b.direction,f),L=i(l,x),S=o(g,x,L);this._updateSplitAndLod(r,m,f,S)}_updateSplitAndLodLocal(e){const s=v,{extent:i}=e;if(!i)return;const{_surfaceElevation:o}=this;t(s[0],i[0],i[1],o),t(s[1],i[2],i[1],o),t(s[2],i[2],i[3],o),t(s[3],i[0],i[3],o);const a=this._tilingScheme.spatialReference;for(let t=0;t<4;++t)this._renderCoordsHelper.toRenderCoords(s[t],a,s[t]);const n=t(M,.5*(s[0][0]+s[2][0]),.5*(s[0][1]+s[2][1]),.25*(s[0][2]+s[1][2]+s[2][2]+s[3][2])),l=t(y,n[0],n[1],0),{eye:c,far:d}=this._camera,h=t(g,l[0],l[1],c[2]);t(b.origin,l[0],l[1],c[2]-2*d),r(b.direction,x),this._updateSplitAndLod(e,s,n,h)}_updateSplitAndLod(e,t,s,o){const r=Math.max(a(t[0],t[2]),a(t[1],t[3]),a(t[0],s)+a(s,t[2]),a(t[1],s)+a(s,t[3])),{eye:n,near:l,fov:c,viewForward:d,width:m,height:p,pixelRatio:u,frustum:_}=this._camera,f=i(n,d),v=i(s,d)-f,M=a(s,n);let y=v,g=v,x=M,b=M;const C=(e,t)=>t<l?1:Math.sqrt(e*e-t*t)/t;let R=C(M,v);for(const h of t){const e=i(h,d)-f;y=Math.min(y,e),g=Math.max(g,e);const t=a(h,n);b=Math.max(b,t),x=Math.min(x,t);const s=C(t,e);R=Math.min(R,s)}if(g<l)return void(e.measures.lodLevel=0);const w=Math.cos(.5*c),A=a(n,o);R>w&&A>S*r&&(g=j*b,y=j*x);const G=.5*Math.sqrt(m*m+p*p)/u,E=2*Math.tan(.5*c),H=e=>Math.max(l,e)*L/G*E,q=e.level,O=r*2**q*Math.max(1,E),P=H(y),F=Math.ceil(Math.log2(Math.max(1,O/P)));if(e.measures.lodLevel=Math.max(F,e.measures.lodLevel),e.measures.splitPriority+=e.measures.lodLevel-q,q<F){const s=+h(_,t[0])+ +h(_,t[1])+ +h(_,t[2])+ +h(_,t[3]);e.measures.splitPriority+=s}const k=H(g)/P;k>2.5&&(e.measures.splitPriority+=k)}get _isGlobal(){return 1===this._renderCoordsHelper.viewingMode}}const v=[n(),n(),n(),n()],M=n(),y=n(),g=n(),x=l(0,0,1),b=m(c,x),L=312,S=.5,j=2;export{f as FeatureTileMeasurements3D};
5
+ import{u as e,h as t,n as s,g as i,j as o,d as r,H as a}from"../../../../chunks/vec32.js";import{create as n,freeze as l,ZEROS as c}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{distance as d}from"../../../../geometry/support/aaBoundingRect.js";import{intersectsPoint as h}from"../../../../geometry/support/frustum.js";import{fromValues as m}from"../../../../geometry/support/ray.js";import{FeatureTileVisibility3D as p,minTileLOD as u}from"./FeatureTileVisibility3D.js";import _ from"../../webgl/RenderCamera.js";class f{constructor(e,t,s){this._renderCoordsHelper=e,this._tilingScheme=t,this._camera=new _,this._surfaceElevation=0,this._focusOnMap=[0,0],this._visibility=new p(e,s)}set opaqueGround(e){this._visibility.opaqueGround=e}setup(e,t,s){this._camera.copyFrom(e),this._surfaceElevation=s,this._focusOnMap[0]=t.x,this._focusOnMap[1]=t.y,this._visibility.setup(this._camera)}done(){this._visibility.done()}update(e){const{measures:t,extent:s,level:i}=e;s&&(t.visible=this._visibility.compute(e),t.distance=d(s,this._focusOnMap),t.mergeable=!0,t.lodLevel=u,t.splitPriority=Math.max(0,u-i),t.visible&&(this._isGlobal?this._updateSplitAndLodGlobal(e):this._updateSplitAndLodLocal(e)))}_updateSplitAndLodGlobal(r){const a=r.level,n=this._renderCoordsHelper,{eye:l,fov:c}=this._camera,d=n.referenceEllipsoid.radius,h=e(l)-d;if(2*Math.atan(d/h)<c&&h>0)return void(r.measures.lodLevel=Math.max(a,u));const m=v,{extent:p}=r;if(!p)return;const{_surfaceElevation:_}=this;t(m[0],p[0],p[1],_),t(m[1],p[2],p[1],_),t(m[2],p[2],p[3],_),t(m[3],p[0],p[3],_);const f=t(M,.5*(p[0]+p[2]),.5*(p[1]+p[3]),_),y=this._tilingScheme.spatialReference;for(let e=0;e<4;++e)n.toRenderCoords(m[e],y,m[e]);n.toRenderCoords(f,y,f);const x=s(b.direction,f),L=i(l,x),S=o(g,x,L);this._updateSplitAndLod(r,m,f,S)}_updateSplitAndLodLocal(e){const s=v,{extent:i}=e;if(!i)return;const{_surfaceElevation:o}=this;t(s[0],i[0],i[1],o),t(s[1],i[2],i[1],o),t(s[2],i[2],i[3],o),t(s[3],i[0],i[3],o);const a=this._tilingScheme.spatialReference;for(let t=0;t<4;++t)this._renderCoordsHelper.toRenderCoords(s[t],a,s[t]);const n=t(M,.5*(s[0][0]+s[2][0]),.5*(s[0][1]+s[2][1]),.25*(s[0][2]+s[1][2]+s[2][2]+s[3][2])),l=t(y,n[0],n[1],0),{eye:c,far:d}=this._camera,h=t(g,l[0],l[1],c[2]);t(b.origin,l[0],l[1],c[2]-2*d),r(b.direction,x),this._updateSplitAndLod(e,s,n,h)}_updateSplitAndLod(e,t,s,o){const r=Math.max(a(t[0],t[2]),a(t[1],t[3]),a(t[0],s)+a(s,t[2]),a(t[1],s)+a(s,t[3])),{eye:n,near:l,fov:c,viewForward:d,width:m,height:p,pixelRatio:u,frustum:_}=this._camera,f=i(n,d),v=i(s,d)-f,M=a(s,n);let y=v,g=v,x=M,b=M;const C=(e,t)=>t<l?1:Math.sqrt(e*e-t*t)/t;let R=C(M,v);for(const h of t){const e=i(h,d)-f;y=Math.min(y,e),g=Math.max(g,e);const t=a(h,n);b=Math.max(b,t),x=Math.min(x,t);const s=C(t,e);R=Math.min(R,s)}if(g<l)return void(e.measures.lodLevel=0);const w=Math.cos(.5*c),A=a(n,o);R>w&&A>S*r&&(g=j*b,y=j*x);const G=.5*Math.sqrt(m*m+p*p)/u,E=2*Math.tan(.5*c),H=e=>Math.max(l,e)*L/G*E,q=e.level,O=r*2**q*Math.max(1,E),P=H(y),F=Math.ceil(Math.log2(Math.max(1,O/P)));if(e.measures.lodLevel=Math.max(F,e.measures.lodLevel),e.measures.splitPriority+=e.measures.lodLevel-q,q<F){const s=+h(_,t[0])+ +h(_,t[1])+ +h(_,t[2])+ +h(_,t[3]);e.measures.splitPriority+=s}const k=H(g)/P;k>2.5&&(e.measures.splitPriority+=k)}get _isGlobal(){return 1===this._renderCoordsHelper.viewingMode}}const v=[n(),n(),n(),n()],M=n(),y=n(),g=n(),x=l(0,0,1),b=m(c,x),L=312,S=.5,j=2;export{f as FeatureTileMeasurements3D};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{n as t,d as r,a as n,g as e,c as s,h as o,G as i,f as u,i as c,j as f,H as a}from"../../../../chunks/vec32.js";import{create as h,fromValues as l,freeze as m}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as p}from"../../../../geometry/ellipsoidUtils.js";import{getSphericalPCPF as d}from"../../../../geometry/spatialReferenceEllipsoidUtils.js";import{projectBuffer as _}from"../../../../geometry/projection/projectBuffer.js";import{projectVec3Array as g}from"../../../../geometry/projection/projectVec3Array.js";import{fromValues as b,signedDistance as M}from"../../../../geometry/support/plane.js";import{Frustum as S}from"../../state/Frustum.js";class F{constructor(t,r){this._renderCoordsHelper=t,this.opaqueGround=r,this._cache=new Map,this._cameraForward=h(),this._cameraEye=h(),this._cameraFovY=55*Math.PI/180,this._frustumBoundingSphereCenter=h(),this._frustumBoundingSphereRadius=0,this._frustum=new S(t),this._renderSR=t.spatialReference;const n=d(this._renderSR);this._renderSREllipsoidRadius=p(n).radius}setup(n){this._aboveGround=n.aboveGround,this._frustum.update(n),t(this._cameraForward,n.viewForward),r(this._cameraEye,n.eye),this._cameraFovY=n.fovY,this._updateFrustumBoundingSphere()}done(){this._cache.clear()}compute(t){if(this._cache.has(t.id))return this._cache.get(t.id);const r=this._isVisibleInFrustum(t);return this._cache.set(t.id,r),r}_isVisibleInFrustum(t){return 2===this._renderCoordsHelper.viewingMode?this._isTileVisibleInFrustumLocal(t):this._isTileVisibleInFrustumGlobal(t)}_updateFrustumBoundingSphere(){const r=this._frustum,o=r.origin,i=A;t(i,r.direction);const u=r.points,c=W;n(c,u[4],o);const f=.5*e(c,c)/e(i,c),a=this._frustumBoundingSphereCenter;s(a,o,i,f);const h=1+f;this._frustumBoundingSphereRadius=h}_isTileVisibleInFrustumLocal(t){const r=t.spatialReference,u=t.extent,c=this._renderSR;if(!u)return!0;if(C[0]=u[0],C[1]=u[1],C[2]=0,C[3]=u[2],C[4]=u[3],C[5]=0,!_(C,r,0,C,c,0))return!1;o(E[0],C[0],C[1],0),o(E[1],C[3],C[1],0),o(E[2],C[3],C[4],0),o(E[3],C[0],C[4],0),o(k,.5*(C[0]+C[3]),.5*(C[1]+C[4]),.5*(C[2]+C[5]));const f=Ft,a=.5*i(E[0],E[2]),h=this._frustum,l=this._frustumBoundingSphereRadius,m=this._frustumBoundingSphereCenter,p=D;n(p,m,k);const d=e(f,p),g=z;s(g,k,f,d);if(i(g,m)>a+l)return!1;const b=this._cameraForward,M=e(b,Ft),S=this._cameraFovY,F=this._cameraEye;if(Math.abs(M)<Math.abs(Math.cos(.5*S))){let t=!0;const r=o(Rt,b[0],b[1],0),n=e(F,r);for(let s=0;s<4;++s){const o=E[s];if(e(o,r)-n>0){t=!1;break}}if(t)return!1}{const t=E[0],r=E[2];if(t[0]<=F[0]&&F[0]<=r[0]&&t[1]<=F[1]&&F[1]<=r[1])return!0}const R=x,v=this.opaqueGround&&this._aboveGround,G=this.opaqueGround&&!this._aboveGround,j=Math.min(G?gt:1/0,d+l),B=Math.max(v?-gt:-1/0,d-l);for(let n=0;n<4;++n)s(R[n],E[n],f,j),s(R[n+4],E[n],f,B);if(y(h.planes,R,8))return!1;if(q(h.planes,R,8))return!0;for(let n=0;n<4;++n){const t=R[n],r=R[n+4];if(vt(h.planes,t,r))return!0;const e=R[(n+1)%4];if(vt(h.planes,t,e))return!0;const s=R[4+(n+1)%4];if(vt(h.planes,r,s))return!0}if(Bt[0][3]=+E[0][0],Bt[1][3]=-E[2][0],Bt[2][3]=+E[0][1],Bt[3][3]=-E[2][1],Bt[4][3]=+B,Bt[5][3]=-j,q(Bt,h.points))return!0;if(q(Bt,h.points))return!0;for(let n=0;n<4;++n){const t=F,r=h.points[n+4];if(Gt(Bt,t,r))return!0;const e=h.points[4+(n+1)%4];if(Gt(Bt,r,e))return!0}return!1}_isTileVisibleInFrustumGlobal(r){if(r.level<w)return!0;const l=r.spatialReference,m=r.extent;if(!m||!l)return!0;const p=this.opaqueGround&&this._aboveGround,d=this.opaqueGround&&!this._aboveGround,_=E,b=.5*(m[0]+m[2]);if(o(_[0],m[0],m[1],0),o(_[1],m[2],m[1],0),o(_[2],m[2],m[3],0),o(_[3],m[0],m[3],0),o(_[4],b,m[1],0),o(_[5],b,m[3],0),!g(_,l,0,_,this._renderSR,0,6))return!1;const S=_[0][2]>0,F=_[3][2]<0,j=S||F,B=this._renderSREllipsoidRadius;if(j){const t=T;R(t,yt,_[0]);const r=Y;if(R(r,yt,_[1]),S){const n=P,e=_[4],s=H;R(s,e,yt),R(n,s,e);const o=_[0];u(o,t,n),G(o,B);const i=_[1];u(i,r,n),G(i,B)}else if(F){const n=P,e=_[5],s=H;R(s,e,yt),R(n,e,s);const o=_[3];u(o,n,t),G(o,B);const i=_[2];u(i,n,r),G(i,B)}}const q=k,I=n(Q,_[3],_[0]);t(I,I);const x=c(X,_[0],_[3]);f(x,x,.5);const C=-e(x,I),A=c(Z,_[0],_[1]);f(A,A,.5);const W=c($,_[2],_[3]);f(W,W,.5);const z=n(tt,W,A);t(z,z);const D=-(C+e(I,A))/e(I,z);s(q,A,z,D),G(q,B);const ot=this._frustumBoundingSphereRadius,mt=this._frustumBoundingSphereCenter,pt=this._frustum,dt=pt.planes,Ft=L;t(Ft,q);const Rt=e(_[0],Ft)/a(_[0]),vt=pt.origin,Gt=pt.points;let jt=!1;if(p){{jt=!0;const r=t(bt,vt);for(let s=0;s<4;++s){const o=Gt[4+s],i=n(h(),o,vt);t(i,i);const c=u(h(),r,i);t(c,c);const f=u(h(),i,c);t(f,f);if(e(vt,f)>B){jt=!1;break}}}if(jt){if(e(vt,Ft)<B*Rt-gt)return!1}const r=t(bt,pt.origin);if(e(r,Ft)<0)return!1;{const r=t(Mt,pt.direction);if(e(r,Ft)>St)return!1}}const Bt=Math.sqrt(1-Rt*Rt);if(Bt>.9)return!0;let qt=!1;const wt=e(Ft,mt),It=a(mt);if(It<=ot&&!dt.some(t=>M(t,J)>0)){if(!p)return!0;qt=!0}const Vt=wt/It;if(!qt&&wt<=0){if(-wt>ot)return!1}const xt=ot/It;if(Math.sqrt(1-Vt*Vt)*Math.sqrt(1-xt*xt)-xt*Vt>Bt)return!1;if(!jt){if(_.some(t=>pt.intersectsPoint(t)))return!0;if(pt.intersectsPoint(q))return!0}const Ct=K;n(Ct,mt,J);const Et=e(Ct,Ft),kt=U;f(kt,Ft,Et);const Pt=i(kt,mt),Tt=l.isWGS84,Yt=r.lij,Ht=Tt&&Yt[2]===2**Yt[0]-1,Lt=Tt&&0===Yt[2],Ut=Lt?at:Ht?ct:it,At=Lt?ht:Ht?ft:ut;if(!qt){const t=_,r=lt,n=rt,e=nt,s=J;for(const o of Ut){const i=t[o];if(v(n,t[(o+1)%4],i),v(e,s,i),R(r,e,n),V(r,Gt,1))return!1}}let Wt=null;if(!p&&Et<1.01*ot){const t=2.5*ot;if(Pt>Rt*t+ot)return!1;const r=O,n=t/Rt;for(let e=0;e<4;++e)f(r[e],_[e],n/B);o(r[4],0,0,0),Wt=r}else{const t=(d?B+gt:Et+ot)/Rt,r=p?B-gt:(Et-ot)/Rt,n=N;for(let e=0;e<4;++e){const s=_[e];f(n[e],s,r/B),f(n[e+4],s,t/B)}Wt=n}if(y(dt,Wt,Wt.length))return!1;const zt=pt.lines,Dt=et,Jt=st;for(const e of zt){t(Jt,e.direction);for(const r of At){const e=Wt[r];if(t(Dt,e),_t(Jt,Dt,Wt,Gt))return!1;const s=(r+1)%4;if(p){const r=Wt[s];if(n(Dt,r,e),t(Dt,Dt),_t(Jt,Dt,Wt,Gt))return!1}if(d){const e=Wt[4+r],o=Wt[4+s];if(n(Dt,o,e),t(Dt,Dt),_t(Jt,Dt,Wt,Gt))return!1}}}return!0}}function R(r,n,e){return u(r,n,e),t(r,r),r}function v(r,e,s){return n(r,e,s),t(r,r),r}function G(t,r){return f(t,t,r/a(t)),t}const j=[0,1,2,3,5];function B(t,r,n){for(let e=0;e<n;++e)if(M(t,r[e])<=0)return!1;return!0}function y(t,r,n){for(const e of j)if(B(t[e],r,n))return!0;return!1}function q(t,r,n=r.length){for(let e=0;e<n;++e){const n=r[e];let s=!0;for(const r of t){if(M(r,n)>0){s=!1;break}}if(s)return!0}return!1}const w=2,I=4;function V(t,r,n){for(const s of r)if(e(s,t)<n)return!1;return!0}const x=[h(),h(),h(),h(),h(),h(),h(),h()],C=[0,0,0,0,0,0],E=[h(),h(),h(),h(),h(),h()],k=h(),P=h(),T=h(),Y=h(),H=h(),L=h(),U=h(),A=h(),W=h(),z=h(),D=h(),J=m(0,0,0),K=h(),N=[h(),h(),h(),h(),h(),h(),h(),h()],O=[h(),h(),h(),h(),h()],Q=h(),X=h(),Z=h(),$=h(),tt=h(),rt=h(),nt=h(),et=h(),st=h(),ot=h(),it=[0,1,2,3],ut=[0,1,2,3],ct=[0,1,3],ft=[0,1,3],at=[1,2,3],ht=[1,2,3],lt=h();function mt(t,r,n){let s=1/0,o=-1/0;for(const i of n){const t=e(r,i);s=Math.min(s,t),o=Math.max(o,t)}t[0]=s,t[1]=o}function pt(t,r,n,s){let o=1/0,i=-1/0;for(const u of s){const s=e(n,u);if(o=Math.min(o,s),i=Math.max(i,s),o<=r&&i>=t)return!1}return!0}const dt=[0,0];function _t(t,r,n,e){const s=n.length,o=e.length;if(0===s||0===o)return!0;const i=ot;R(i,t,r);const u=o<s,c=u?n:e,f=dt;return mt(f,i,u?e:n),pt(f[0],f[1],i,c)}const gt=430,bt=h(),Mt=h(),St=Math.cos(.25*Math.PI),Ft=l(0,0,1),Rt=h();function vt(t,r,n){const e={t0:0,t1:1};for(const s of j){if(!jt(t[s],r,n,e))return!1}return e.t0<e.t1}function Gt(t,r,n){const e={t0:0,t1:1};for(const s of t){if(!jt(s,r,n,e))return!1}return e.t0<e.t1}function jt(t,r,n,e){let{t0:s,t1:o}=e;const i=M(t,r),u=M(t,n);if(i>=0&&u>=0)return!1;if(i<0&&u>=0){const t=-i/(u-i);if(t<s)return!1;t<o&&(o=t)}else if(i>=0&&u<0){const t=i/(i-u);if(t>o)return!1;t>s&&(s=t)}return e.t0=s,e.t1=o,!0}const Bt=[b(-1,0,0,1),b(1,0,0,-1),b(0,-1,0,1),b(0,1,0,-1),b(0,0,-1,1),b(0,0,1,-1)],yt=m(0,0,1);export{F as FeatureTileVisibility3D,q as isAnyVertexInPolyhedron,y as isConvexHullOutsideOfFrustum,I as maxLODLevelDelta,w as minTileLOD};
5
+ import{n as t,d as r,h as n,H as e,a as s,g as o,c as i,f as u,i as c,j as f,u as a}from"../../../../chunks/vec32.js";import{create as h,fromValues as l,freeze as m}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as d}from"../../../../geometry/ellipsoidUtils.js";import{getSphericalPCPF as p}from"../../../../geometry/spatialReferenceEllipsoidUtils.js";import{projectBuffer as _}from"../../../../geometry/projection/projectBuffer.js";import{projectVec3Array as g}from"../../../../geometry/projection/projectVec3Array.js";import{fromValues as b,signedDistance as S}from"../../../../geometry/support/plane.js";import{Frustum as M}from"../../state/Frustum.js";class F{constructor(t,r){this._renderCoordsHelper=t,this.opaqueGround=r,this._cache=new Map,this._cameraForward=h(),this._cameraEye=h(),this._cameraFovY=55*Math.PI/180,this._frustumBoundingSphereCenter=h(),this._frustumBoundingSphereRadius=0,this._frustum=new M(t),this._renderSR=t.spatialReference;const n=p(this._renderSR);this._renderSREllipsoidRadius=d(n).radius}setup(n){this._aboveGround=n.aboveGround,this._frustum.update(n),t(this._cameraForward,n.viewForward),r(this._cameraEye,n.eye),this._cameraFovY=n.fovY,this._updateFrustumBoundingSphere()}done(){this._cache.clear()}compute(t){if(this._cache.has(t.id))return this._cache.get(t.id);const r=this._isVisibleInFrustum(t);return this._cache.set(t.id,r),r}_isVisibleInFrustum(t){return 2===this._renderCoordsHelper.viewingMode?this._isTileVisibleInFrustumLocal(t):this._isTileVisibleInFrustumGlobal(t)}_updateFrustumBoundingSphere(){const t=this._frustum.boundingSphere;r(this._frustumBoundingSphereCenter,t.center),this._frustumBoundingSphereRadius=t.radius+Bt}_isTileVisibleInFrustumLocal(t){const r=t.spatialReference,u=t.extent,c=this._renderSR;if(!u)return!0;if(C[0]=u[0],C[1]=u[1],C[2]=0,C[3]=u[2],C[4]=u[3],C[5]=0,!_(C,r,0,C,c,0))return!1;n(E[0],C[0],C[1],0),n(E[1],C[3],C[1],0),n(E[2],C[3],C[4],0),n(E[3],C[0],C[4],0),n(k,.5*(C[0]+C[3]),.5*(C[1]+C[4]),.5*(C[2]+C[5]));const f=St,a=.5*e(E[0],E[2]),h=this._frustum,l=this._frustumBoundingSphereRadius,m=this._frustumBoundingSphereCenter,d=W;s(d,m,k);const p=o(f,d),g=A;i(g,k,f,p);if(e(g,m)>a+l)return!1;const b=this._cameraForward,S=o(b,St),M=this._cameraFovY,F=this._cameraEye;if(Math.abs(S)<Math.abs(Math.cos(.5*M))){let t=!0;const r=n(Mt,b[0],b[1],0),e=o(F,r);for(let n=0;n<4;++n){const s=E[n];if(o(s,r)-e>0){t=!1;break}}if(t)return!1}{const t=E[0],r=E[2];if(t[0]<=F[0]&&F[0]<=r[0]&&t[1]<=F[1]&&F[1]<=r[1])return!0}const R=x,v=this.opaqueGround&&this._aboveGround,j=this.opaqueGround&&!this._aboveGround,G=Math.min(j?pt:1/0,p+l),B=Math.max(v?-pt:-1/0,p-l);for(let n=0;n<4;++n)i(R[n],E[n],f,G),i(R[n+4],E[n],f,B);if(y(h.planes,R,8))return!1;if(q(h.planes,R,8))return!0;for(let n=0;n<4;++n){const t=R[n],r=R[n+4];if(Ft(h.planes,t,r))return!0;const e=R[(n+1)%4];if(Ft(h.planes,t,e))return!0;const s=R[4+(n+1)%4];if(Ft(h.planes,r,s))return!0}if(jt[0][3]=+E[0][0],jt[1][3]=-E[2][0],jt[2][3]=+E[0][1],jt[3][3]=-E[2][1],jt[4][3]=+B,jt[5][3]=-G,q(jt,h.points))return!0;if(q(jt,h.points))return!0;for(let n=0;n<4;++n){const t=F,r=h.points[n+4];if(Rt(jt,t,r))return!0;const e=h.points[4+(n+1)%4];if(Rt(jt,r,e))return!0}return!1}_isTileVisibleInFrustumGlobal(r){if(r.level<w)return!0;const l=r.spatialReference,m=r.extent;if(!m||!l)return!0;const d=this.opaqueGround&&this._aboveGround,p=this.opaqueGround&&!this._aboveGround,_=E,b=.5*(m[0]+m[2]);if(n(_[0],m[0],m[1],0),n(_[1],m[2],m[1],0),n(_[2],m[2],m[3],0),n(_[3],m[0],m[3],0),n(_[4],b,m[1],0),n(_[5],b,m[3],0),!g(_,l,0,_,this._renderSR,0,6))return!1;const M=_[0][2]>0,F=_[3][2]<0,G=M||F,B=this._renderSREllipsoidRadius;if(G){const t=T;R(t,Gt,_[0]);const r=Y;if(R(r,Gt,_[1]),M){const n=P,e=_[4],s=H;R(s,e,Gt),R(n,s,e);const o=_[0];u(o,t,n),j(o,B);const i=_[1];u(i,r,n),j(i,B)}else if(F){const n=P,e=_[5],s=H;R(s,e,Gt),R(n,e,s);const o=_[3];u(o,n,t),j(o,B);const i=_[2];u(i,n,r),j(i,B)}}const q=k,I=s(N,_[3],_[0]);t(I,I);const x=c(O,_[0],_[3]);f(x,x,.5);const C=-o(x,I),A=c(Q,_[0],_[1]);f(A,A,.5);const W=c(X,_[2],_[3]);f(W,W,.5);const et=s(Z,W,A);t(et,et);const ht=-(C+o(I,A))/o(I,et);i(q,A,et,ht),j(q,B);const lt=this._frustumBoundingSphereRadius,mt=this._frustumBoundingSphereCenter,St=this._frustum,Mt=St.planes,Ft=L;t(Ft,q);const Rt=o(_[0],Ft)/a(_[0]),vt=St.origin,jt=St.points;let Bt=!1;if(d){{Bt=!0;const r=t(_t,vt);for(let n=0;n<4;++n){const e=jt[4+n],i=s(h(),e,vt);t(i,i);const c=u(h(),r,i);t(c,c);const f=u(h(),i,c);t(f,f);if(o(vt,f)>B){Bt=!1;break}}}if(Bt){if(o(vt,Ft)<B*Rt-pt)return!1}const r=t(_t,St.origin);if(o(r,Ft)<0)return!1;{const r=t(gt,St.direction);if(o(r,Ft)>bt)return!1}}const yt=Math.sqrt(1-Rt*Rt);if(yt>.9)return!0;let qt=!1;const wt=o(Ft,mt),It=a(mt);if(It<=lt&&!Mt.some(t=>S(t,z)>0)){if(!d)return!0;qt=!0}const Vt=wt/It;if(!qt&&wt<=0){if(-wt>lt)return!1}const xt=lt/It;if(Math.sqrt(1-Vt*Vt)*Math.sqrt(1-xt*xt)-xt*Vt>yt)return!1;if(!Bt){if(_.some(t=>St.intersectsPoint(t)))return!0;if(St.intersectsPoint(q))return!0}const Ct=D;s(Ct,mt,z);const Et=o(Ct,Ft),kt=U;f(kt,Ft,Et);const Pt=e(kt,mt),Tt=l.isWGS84,Yt=r.lij,Ht=Tt&&Yt[2]===2**Yt[0]-1,Lt=Tt&&0===Yt[2],Ut=Lt?ct:Ht?it:st,At=Lt?ft:Ht?ut:ot;if(!qt){const t=_,r=at,n=$,e=tt,s=z;for(const o of Ut){const i=t[o];if(v(n,t[(o+1)%4],i),v(e,s,i),R(r,e,n),V(r,jt,1))return!1}}let Wt=null;if(!d&&Et<1.01*lt){const t=2.5*lt;if(Pt>Rt*t+lt)return!1;const r=K,e=t/Rt;for(let n=0;n<4;++n)f(r[n],_[n],e/B);n(r[4],0,0,0),Wt=r}else{const t=(p?B+pt:Et+lt)/Rt,r=d?B-pt:(Et-lt)/Rt,n=J;for(let e=0;e<4;++e){const s=_[e];f(n[e],s,r/B),f(n[e+4],s,t/B)}Wt=n}if(y(Mt,Wt,Wt.length))return!1;const zt=St.lines,Dt=rt,Jt=nt;for(const n of zt){t(Jt,n.direction);for(const r of At){const n=Wt[r];if(t(Dt,n),dt(Jt,Dt,Wt,jt))return!1;const e=(r+1)%4;if(d){const r=Wt[e];if(s(Dt,r,n),t(Dt,Dt),dt(Jt,Dt,Wt,jt))return!1}if(p){const n=Wt[4+r],o=Wt[4+e];if(s(Dt,o,n),t(Dt,Dt),dt(Jt,Dt,Wt,jt))return!1}}}return!0}}function R(r,n,e){return u(r,n,e),t(r,r),r}function v(r,n,e){return s(r,n,e),t(r,r),r}function j(t,r){return f(t,t,r/a(t)),t}const G=[0,1,2,3,5];function B(t,r,n){for(let e=0;e<n;++e)if(S(t,r[e])<=0)return!1;return!0}function y(t,r,n){for(const e of G)if(B(t[e],r,n))return!0;return!1}function q(t,r,n=r.length){for(let e=0;e<n;++e){const n=r[e];let s=!0;for(const r of t){if(S(r,n)>0){s=!1;break}}if(s)return!0}return!1}const w=2,I=4;function V(t,r,n){for(const e of r)if(o(e,t)<n)return!1;return!0}const x=[h(),h(),h(),h(),h(),h(),h(),h()],C=[0,0,0,0,0,0],E=[h(),h(),h(),h(),h(),h()],k=h(),P=h(),T=h(),Y=h(),H=h(),L=h(),U=h(),A=h(),W=h(),z=m(0,0,0),D=h(),J=[h(),h(),h(),h(),h(),h(),h(),h()],K=[h(),h(),h(),h(),h()],N=h(),O=h(),Q=h(),X=h(),Z=h(),$=h(),tt=h(),rt=h(),nt=h(),et=h(),st=[0,1,2,3],ot=[0,1,2,3],it=[0,1,3],ut=[0,1,3],ct=[1,2,3],ft=[1,2,3],at=h();function ht(t,r,n){let e=1/0,s=-1/0;for(const i of n){const t=o(r,i);e=Math.min(e,t),s=Math.max(s,t)}t[0]=e,t[1]=s}function lt(t,r,n,e){let s=1/0,i=-1/0;for(const u of e){const e=o(n,u);if(s=Math.min(s,e),i=Math.max(i,e),s<=r&&i>=t)return!1}return!0}const mt=[0,0];function dt(t,r,n,e){const s=n.length,o=e.length;if(0===s||0===o)return!0;const i=et;R(i,t,r);const u=o<s,c=u?n:e,f=mt;return ht(f,i,u?e:n),lt(f[0],f[1],i,c)}const pt=430,_t=h(),gt=h(),bt=Math.cos(.25*Math.PI),St=l(0,0,1),Mt=h();function Ft(t,r,n){const e={t0:0,t1:1};for(const s of G){if(!vt(t[s],r,n,e))return!1}return e.t0<e.t1}function Rt(t,r,n){const e={t0:0,t1:1};for(const s of t){if(!vt(s,r,n,e))return!1}return e.t0<e.t1}function vt(t,r,n,e){let{t0:s,t1:o}=e;const i=S(t,r),u=S(t,n);if(i>=0&&u>=0)return!1;if(i<0&&u>=0){const t=-i/(u-i);if(t<s)return!1;t<o&&(o=t)}else if(i>=0&&u<0){const t=i/(i-u);if(t>o)return!1;t>s&&(s=t)}return e.t0=s,e.t1=o,!0}const jt=[b(-1,0,0,1),b(1,0,0,-1),b(0,-1,0,1),b(0,1,0,-1),b(0,0,-1,1),b(0,0,1,-1)],Gt=m(0,0,1),Bt=1;export{F as FeatureTileVisibility3D,q as isAnyVertexInPolyhedron,y as isConvexHullOutsideOfFrustum,I as maxLODLevelDelta,w as minTileLOD};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{d as t,D as i}from"../../../chunks/vec32.js";import{create as s}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as e,createPoints as r,fromMatrix as n,computePlanes as o,intersectsSphere as u,intersectsRay as h,intersectsLineSegment as a,intersectsPoint as l,planePointIndices as p}from"../../../geometry/support/frustum.js";class c{get planes(){return this.frustum}get points(){return this._points}get mutablePoints(){return this._points}get direction(){return this._direction}get origin(){return this._origin}constructor(t){this.renderCoordsHelper=t,this.frustum=e(),this._points=r(),this.lines=new Array(12),this._origin=s(),this._direction=s(),this._altitude=null;for(let i=0;i<12;i++)this.lines[i]={origin:null,direction:s(),endpoint:null}}update(i){n(i.viewMatrix,i.projectionMatrix,this.frustum,this._points),t(this._origin,i.eye),t(this._direction,i.viewForward),this._altitude=this.renderCoordsHelper.getAltitude(this._origin),this._updateLines()}updatePoints(i){for(let s=0;s<this._points.length;s++)t(this._points[s],i[s]);o(this.frustum,this._points),this._updateLines()}get altitude(){return this._altitude}intersectsSphere(t){return u(this.frustum,t)}intersectsRay(t){return h(this.frustum,t)}intersectsLineSegment(t,i){return a(this.frustum,t,i)}intersectsPoint(t){return l(this.frustum,t)}_updateLines(){const t=this._points;for(let i=0;i<4;i++){const s=i+4;d(this.lines[i],t[i],t[s]),d(this.lines[i+4],t[i],3===i?t[0]:t[i+1]),d(this.lines[i+8],t[s],3===i?t[4]:t[s+1])}}static{this.planePointIndices=p}static{this.nearFarLineIndices=[[0,4],[1,5],[2,6],[3,7]]}}function d(t,s,e){t.origin=s,t.endpoint=e,i(t.direction,s,e)}export{c as Frustum};
5
+ import{d as t,n as i,a as e,g as s,c as r,E as n}from"../../../chunks/vec32.js";import{create as o}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as h,createPoints as u,fromMatrix as p,computePlanes as d,intersectsSphere as a,intersectsRay as c,intersectsLineSegment as g,intersectsPoint as _,planePointIndices as l}from"../../../geometry/support/frustum.js";import{Sphere as m}from"../../../geometry/support/sphere.js";class f{get planes(){return this.frustum}get points(){return this._points}get mutablePoints(){return this._points}get direction(){return this._direction}get origin(){return this._origin}get boundingSphere(){return this._boundingSphereDirty&&this._updateBoundingSphere(),this._boundingSphere}constructor(t){this.renderCoordsHelper=t,this.frustum=h(),this._points=u(),this.lines=new Array(12),this._origin=o(),this._direction=o(),this._boundingSphere=new m,this._altitude=null,this._boundingSphereDirty=!0;for(let i=0;i<12;i++)this.lines[i]={origin:null,direction:o(),endpoint:null}}update(i){p(i.viewMatrix,i.projectionMatrix,this.frustum,this._points),t(this._origin,i.eye),t(this._direction,i.viewForward),this._altitude=this.renderCoordsHelper.getAltitude(this._origin),this._updateLines(),this._boundingSphereDirty=!0}updatePoints(i){for(let e=0;e<this._points.length;e++)t(this._points[e],i[e]);d(this.frustum,this._points),this._updateLines()}get altitude(){return this._altitude}intersectsSphere(t){return a(this.frustum,t)}intersectsRay(t){return c(this.frustum,t)}intersectsLineSegment(t,i){return g(this.frustum,t,i)}intersectsPoint(t){return _(this.frustum,t)}_updateLines(){const t=this._points;for(let i=0;i<4;i++){const e=i+4;S(this.lines[i],t[i],t[e]),S(this.lines[i+4],t[i],3===i?t[0]:t[i+1]),S(this.lines[i+8],t[e],3===i?t[4]:t[e+1])}}_updateBoundingSphere(){const{origin:t}=this,n=y;i(n,this.direction);const o=b;e(o,this.points[4],t);const h=.5*s(o,o)/s(n,o),u=this._boundingSphere,p=r(j,t,n,h);u.center=p,u.radius=h}static{this.planePointIndices=l}static{this.nearFarLineIndices=[[0,4],[1,5],[2,6],[3,7]]}}function S(t,i,e){t.origin=i,t.endpoint=e,n(t.direction,i,e)}const b=o(),y=o(),j=o();export{f as Frustum};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as t}from"tslib";import i from"../../../../Camera.js";import{deg2rad as e,rad2deg as r,clamp as s}from"../../../../core/mathUtils.js";import{destroyMaybe as o}from"../../../../core/maybe.js";import{property as a,subclass as n}from"../../../../core/accessorSupport/decorators.js";import{i as h,j as l,d as m,C as v}from"../../../../chunks/vec32.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{pixelDistanceToInteractionFactor as _,applyAll as u}from"../../camera/constraintUtils.js";import{ConstraintOptions as p}from"../../camera/constraintUtils/ConstraintOptions.js";import{InteractiveController as d}from"./InteractiveController.js";import{pivotSearchAreaSize as f}from"../utils/navigationUtils.js";import w from"../../../ui/Component.js";import{FovOverlay as y}from"../../../../widgets/FovOverlay.js";let g=class extends d{constructor(t){super(t),this.onStop=null,this._timeOutId=void 0,this._onReset=()=>{this._startSize=this._lastDrag=null,this._setFov(S),this.updateTimeout()},this._center=c(),this._viewForward=c(),this._constraints=new p(15,1)}begin(t){j(t)?this._showOverlay().fov=t.fov:(this._lastDrag=t[1],this._startSize=null,this._ensureStartSize(this.view.state.camera))}updateTimeout(){clearTimeout(this._timeOutId),this._timeOutId=setTimeout(this.onStop,1500)}update(t){if(null==this._lastDrag)return this._lastDrag=t[1],this._startSize=null,void this._ensureStartSize(this.view.state.camera);const i=-(this._lastDrag-t[1])/2;this._lastDrag=t[1],this.step(i)}step(t){if(!this.running)return void(this._startSize=this._lastDrag=null);const i=this.view.state,o=this.currentCamera.copyFrom(i.camera),a=r(o.fov)+t,n=e(s(a,C,F));n!==o.fov?this._setFov(n):this._showOverlay().fov=o.fov}finish(){this.running&&(this._startSize=this._lastDrag=null,this.finishController())}destroy(){this.hideOverlay()}onControllerEnd(t){super.onControllerEnd(t),this._startSize=this._lastDrag=null,this.hideOverlay()}_showOverlay(){return this._overlay||(this._overlay=new w({id:"esri.FovOverlay",node:new y({onReset:this._onReset})}),this.view.ui.add(this._overlay)),this._overlay.widget}hideOverlay(){this._overlay&&(this.view.ui.remove(this._overlay),this._overlay=o(this._overlay))}_setFov(t){const i=this.view.state,e=this.currentCamera.copyFrom(i.camera),r=this._ensureStartSize(e)/Math.tan(t/2),s=h(O,this._center,l(O,this._viewForward,-r));e.eye=s,e.fov=t,this._constraints.interactionStartCamera=i.camera,this._constraints.interactionFactor=_(this.currentCamera.height-i.camera.height),u(this.view,this.currentCamera,this._constraints),this.begin(e),this.commitCamera()}_ensureStartSize(t){if(null==this._startSize){m(this._viewForward,t.viewForward);const i=this.view.stage.renderView.getMinimalDepthForArea(null,t.fullWidth/t.pixelRatio*.5,t.fullHeight/t.pixelRatio*.5,t,f),e=v(t.eye,this.view.pointsOfInterest.centerOnContent.renderLocation),r=i??e;h(this._center,t.eye,l(O,this._viewForward,r)),this._startSize=r*Math.tan(t.fov/2)}return this._startSize}};t([a()],g.prototype,"onStop",void 0),g=t([n("esri.views.3d.state.controllers.FovController")],g);const S=e((new i).fov),C=10,F=150,O=c();function j(t){return!Array.isArray(t)}export{g as FovController};
5
+ import{__decorate as t}from"tslib";import i from"../../../../Camera.js";import{deg2rad as e,rad2deg as r,clamp as s}from"../../../../core/mathUtils.js";import{destroyMaybe as o}from"../../../../core/maybe.js";import{property as a,subclass as n}from"../../../../core/accessorSupport/decorators.js";import{i as h,j as l,d as m,D as v}from"../../../../chunks/vec32.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{pixelDistanceToInteractionFactor as _,applyAll as u}from"../../camera/constraintUtils.js";import{ConstraintOptions as p}from"../../camera/constraintUtils/ConstraintOptions.js";import{InteractiveController as d}from"./InteractiveController.js";import{pivotSearchAreaSize as f}from"../utils/navigationUtils.js";import w from"../../../ui/Component.js";import{FovOverlay as y}from"../../../../widgets/FovOverlay.js";let g=class extends d{constructor(t){super(t),this.onStop=null,this._timeOutId=void 0,this._onReset=()=>{this._startSize=this._lastDrag=null,this._setFov(S),this.updateTimeout()},this._center=c(),this._viewForward=c(),this._constraints=new p(15,1)}begin(t){j(t)?this._showOverlay().fov=t.fov:(this._lastDrag=t[1],this._startSize=null,this._ensureStartSize(this.view.state.camera))}updateTimeout(){clearTimeout(this._timeOutId),this._timeOutId=setTimeout(this.onStop,1500)}update(t){if(null==this._lastDrag)return this._lastDrag=t[1],this._startSize=null,void this._ensureStartSize(this.view.state.camera);const i=-(this._lastDrag-t[1])/2;this._lastDrag=t[1],this.step(i)}step(t){if(!this.running)return void(this._startSize=this._lastDrag=null);const i=this.view.state,o=this.currentCamera.copyFrom(i.camera),a=r(o.fov)+t,n=e(s(a,C,F));n!==o.fov?this._setFov(n):this._showOverlay().fov=o.fov}finish(){this.running&&(this._startSize=this._lastDrag=null,this.finishController())}destroy(){this.hideOverlay()}onControllerEnd(t){super.onControllerEnd(t),this._startSize=this._lastDrag=null,this.hideOverlay()}_showOverlay(){return this._overlay||(this._overlay=new w({id:"esri.FovOverlay",node:new y({onReset:this._onReset})}),this.view.ui.add(this._overlay)),this._overlay.widget}hideOverlay(){this._overlay&&(this.view.ui.remove(this._overlay),this._overlay=o(this._overlay))}_setFov(t){const i=this.view.state,e=this.currentCamera.copyFrom(i.camera),r=this._ensureStartSize(e)/Math.tan(t/2),s=h(O,this._center,l(O,this._viewForward,-r));e.eye=s,e.fov=t,this._constraints.interactionStartCamera=i.camera,this._constraints.interactionFactor=_(this.currentCamera.height-i.camera.height),u(this.view,this.currentCamera,this._constraints),this.begin(e),this.commitCamera()}_ensureStartSize(t){if(null==this._startSize){m(this._viewForward,t.viewForward);const i=this.view.stage.renderView.getMinimalDepthForArea(null,t.fullWidth/t.pixelRatio*.5,t.fullHeight/t.pixelRatio*.5,t,f),e=v(t.eye,this.view.pointsOfInterest.centerOnContent.renderLocation),r=i??e;h(this._center,t.eye,l(O,this._viewForward,r)),this._startSize=r*Math.tan(t.fov/2)}return this._startSize}};t([a()],g.prototype,"onStop",void 0),g=t([n("esri.views.3d.state.controllers.FovController")],g);const S=e((new i).fov),C=10,F=150,O=c();function j(t){return!Array.isArray(t)}export{g as FovController};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as t}from"tslib";import{neverReached as e}from"../../../../core/compilerUtils.js";import{clamp as i,acosClamped as a,deg2rad as r}from"../../../../core/mathUtils.js";import{property as o,subclass as n}from"../../../../core/accessorSupport/decorators.js";import{translate as s,rotate as c,identity as l}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as m}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{e as h,p,i as d,j as u,d as f,q as _,b as v,h as C,n as g,f as y,C as w,D as b,g as S}from"../../../../chunks/vec32.js";import{create as O}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as x}from"../../../../geometry/ellipsoidUtils.js";import{wrap as M}from"../../../../geometry/support/ray.js";import{Sphere as j}from"../../../../geometry/support/sphere.js";import{angle as z}from"../../../../geometry/support/vector.js";import{sv3d as T}from"../../../../geometry/support/vectorStacks.js";import{applyAll as A}from"../../camera/constraintUtils.js";import{ConstraintOptions as D}from"../../camera/constraintUtils/ConstraintOptions.js";import{TiltRange as R}from"../Constraints.js";import{InteractiveController as H}from"./InteractiveController.js";import{panMotionToRotationMatrix as E,onSurfaceTiltToEyeTiltGlobal as U,offSurfaceTiltToEyeTiltGlobal as k}from"../utils/navigationUtils.js";import{viewAngle as F}from"../utils/viewUtils.js";import{headingTiltToDirectionUp as G}from"../../support/cameraUtils.js";import{createDirectionUp as P}from"../../support/cameraUtilsInternal.js";import B from"../../webgl/RenderCamera.js";import{extractTransformation as I,isZeroTransformation as V,extractTransformationKeyboard as q}from"../../../navigation/gamepadAndKeyboardUtils.js";let L=class extends H{constructor(t){super(t),this._filteredSurfaceElevation=0,this._transformation={translation:[0,0,0],heading:0,tilt:0,zoom:0},this._keysButtonState=[0,0,0,0,0,0,0,0,0,0,0,0],this._tmpCamera=new B,this._headingStart=0,this._constraintOptions=new D(15,0,0,new B,null,1)}handleEventGamepad(t){const e=I(t,this.view.navigation.gamepad,this._transformation);("end"===t.action||V(e))&&this.finishController()}activateDirection(t){this._keysButtonState[t]=1,q(this._keysButtonState,this._transformation)}directionActive(t){return 1===this._keysButtonState[t]}countActiveDirections(){return this._keysButtonState.reduce((t,e)=>e>0?t+1:t,0)}deactivateDirection(t){this._keysButtonState[t]=0;const e=q(this._keysButtonState,this._transformation);V(e)&&this.finishController()}onControllerStart(t){this._filteredSurfaceElevation=this.view.pointsOfInterest.cameraOnSurface.location.z,this._headingStart=this.view.camera.heading,super.onControllerStart(t)}_updateFilteredSurfaceElevation(t){const e=this.view.pointsOfInterest.cameraOnSurface.location.z,i=1;this._filteredSurfaceElevation+=i*(e-this._filteredSurfaceElevation)*t}stepController(t,e){this._updateStartHeading(),this._updateFilteredSurfaceElevation(t),this.currentCamera.copyViewFrom(e),this._updateCameraCenter(),this._constraintOptions.interactionStartCamera?.copyFrom(this.currentCamera),this._calculateControlTransformation(t,this.currentCamera,Y),this._applyDisabledMovementTypes(Y),this._applyPan(Y.pan),this._applyRotate(Y.rotate),this._applyZoom(Y.zoom),this._applyAscend(Y.ascend),this._constraintOptions.interactionType=0,this._constraintOptions.selection=8,A(this.view,this.currentCamera,this._constraintOptions),super.stepController(t,e)}_updateStartHeading(){0!==this._transformation.heading&&(this._headingStart=this.view.camera.heading)}_applyRotate(t){if(!t.enabled)return;const e=this.currentCamera;h($,e.center,e.eye),p($,$,t.matrix),e.center=d($,$,e.eye),e.up=p($,e.up,t.matrix),this._constraintOptions.interactionType=3,this._constraintOptions.selection=7,A(this.view,e,this._constraintOptions)}_applyPan(t,e=this.currentCamera){if(!t.enabled)return;e.eye=p($,e.eye,t.matrix),e.center=p($,e.center,t.matrix);this.view.state.isGlobal&&(e.up=p($,e.up,t.matrix)),this._constraintOptions.interactionType=4,this._constraintOptions.selection=15,A(this.view,e,this._constraintOptions)}_applyZoom(t){if(!t)return;const e=this.currentCamera.viewForward;this.currentCamera.eye=d($,this.currentCamera.eye,u(T.get(),e,t)),f(tt,e),_(tt,tt),this._constraintOptions.interactionDirection=tt,this._constraintOptions.interactionType=1,this._constraintOptions.selection=7,A(this.view,this.currentCamera,this._constraintOptions),this._constraintOptions.interactionDirection=null}_applyAscend(t){if(!t)return;const e=this.view.renderCoordsHelper.worldUpAtPosition(this.currentCamera.eye,T.get());this._constraintOptions.interactionDirection=f(tt,e);if(this.view.state.isGlobal){const e=v(this.currentCamera.eye),i=(e+t)/e;this.currentCamera.eye=u($,this.currentCamera.eye,i),this.currentCamera.center=u($,this.currentCamera.center,i)}else{const i=u(T.get(),e,t);this.currentCamera.eye=d($,this.currentCamera.eye,i),this.currentCamera.center=d($,this.currentCamera.center,i)}this._updateCameraCenter(),this._constraintOptions.interactionType=5,this._constraintOptions.selection=8,A(this.view,this.currentCamera,this._constraintOptions)&&this._updateCameraCenter(),this._constraintOptions.selection=7,A(this.view,this.currentCamera,this._constraintOptions),this._constraintOptions.interactionDirection=null}_calculateControlTransformation(t,e,i){at(i);const a=this._computeVelocities(t);this.view.state.isLocal?this._calculateControlTransformationLocal(a,e,i):this._calculateControlTransformationGlobal(a,e,i)}_updateCameraCenter(){const t=this.view.pointsOfInterest.centerOnSurfaceFrequent.estimatedSurfaceAltitude,e=this.view.renderCoordsHelper,i=this.currentCamera.ray;this.currentCamera.center=e.intersectManifoldClosestSilhouette(i,t,$)}_calculateControlTransformationLocal(t,a,r){const{viewRight:o,viewForward:n}=a,l=this._transformation,m=this.view.navigation.gamepad,h=C(T.get(),n[0],n[1],0);g(h,h);const p=l.translation[0]*t.pan;if(0!==p){const t=u(T.get(),o,p);s(r.pan.matrix,r.pan.matrix,t),r.pan.enabled=!0}switch(m.mode){case"pan":{const e=-l.translation[1]*t.pan;if(0!==e){const t=u(T.get(),h,e);s(r.pan.matrix,r.pan.matrix,t),r.pan.enabled=!0}r.zoom=l.zoom*t.zoom;break}case"zoom":r.zoom=(-l.translation[1]+l.zoom)*t.zoom;break;default:e(m.mode)}const d=l.translation[2]*t.ascend;r.ascend=d;const f=-l.heading*t.rotate;0!==f&&(c(r.rotate.matrix,r.rotate.matrix,f,this.view.renderCoordsHelper.worldUpAtPosition(a.eye,T.get())),r.rotate.enabled=!0);const _=l.tilt*t.rotate,v=F(this.view.renderCoordsHelper,a.center,a.eye),y=i(v+_,R.min,R.max)-v;y&&(c(r.rotate.matrix,r.rotate.matrix,y,o),r.rotate.enabled=!0)}_calculateControlTransformationGlobal(t,e,i){const{eye:a,viewRight:r}=e,o=this._transformation,n=this.view.navigation.gamepad,s=y(T.get(),r,a);g(s,s),_(s,s),E(this.startCamera,e,o,t,this.view.camera.heading,this._headingStart,this.view.camera.tilt,i,n),this._tmpCamera.copyFrom(this.currentCamera),this._applyPan(Y.pan,this._tmpCamera);const l=this.view.pointsOfInterest.centerOnSurfaceFrequent.estimatedSurfaceAltitude,m=o.translation[2]*t.ascend;i.ascend=m;const h=-o.heading*t.rotate;0!==h&&(c(i.rotate.matrix,i.rotate.matrix,h,this._tmpCamera.eye),i.rotate.enabled=!0);const p=o.tilt*t.rotate,d=this._clampTiltDeltaGlobalToValidRange(p,e.ray,l);0!==d&&(c(i.rotate.matrix,i.rotate.matrix,d,this._tmpCamera.viewRight),i.rotate.enabled=!0),i.zoom+=o.zoom*t.zoom}_clampTiltDeltaGlobalToValidRange(t,e,a){const r=x(this.view.spatialReference),o=U(R.min,e.origin,a,r);let n=0,s=0;const c=T.get();if(this.view.renderCoordsHelper.intersectManifold(e,a,c)){const t=F(this.view.renderCoordsHelper,c,e.origin);n=U(t,e.origin,a,r),s=U(R.max,e.origin,a,r)}else{it.radius=a+r.radius,it.closestPointOnSilhouette(e,c);const t=Math.PI+z(e.direction,c);n=k(t,e.origin,a,r),s=k(R.max,e.origin,a,r)}return i(n+t,o,s)-n}_getPointAbsoluteSurfaceElevation(t,e,i){const{renderCoordsHelper:a}=this.view,r=a.getAltitude(t),o=e+Math.abs(r-e);return a.setAltitude(i,o,t),o}_clampedDistanceToSurface(t,e){const{renderCoordsHelper:i}=this.view,{camera:a}=this.view.state,{direction:r}=G(this.view,e,0,Z,et),o=i.intersectManifoldClosestSilhouette(M(e,r),t,T.get()),n=w(e,o),s=i.intersectManifoldClosestSilhouette(M(e,b(T.get(),e,a.center)),t,T.get()),c=w(e,s);return Math.min(n,c)}_computeHeadingRotateRadius(t){const{renderCoordsHelper:e,state:i}=this.view,{camera:r,isGlobal:o}=i,n=e.intersectManifoldClosestSilhouette(r.ray,this._filteredSurfaceElevation,T.get());if(o){const e=h(T.get(),t,n),i=v(e);u(e,e,1/i);const r=g(T.get(),t),o=a(S(r,e));return i*Math.sin(Math.min(X,o))}{const i=f(T.get(),t);return e.setAltitude(i,this._filteredSurfaceElevation),w(n,i)}}_minimumAscendVelocity(){return this.view.state.constraints.collision.enabled?0:N}_computeVelocities(t){const e=this._filteredSurfaceElevation,a=e+x(this.view.spatialReference).radius,{camera:r,isGlobal:o}=this.view.state,n=T.get(),s=this._getPointAbsoluteSurfaceElevation(r.eye,e,n),c=this._clampedDistanceToSurface(e,n),l=r.width/2,m=J*r.width,h=J*r.width,p=c*Math.tan(.5*r.fovX)/l,d=p/a,u=p/this._computeHeadingRotateRadius(n),f=s-e;return{pan:(o?d:p)*m*t,ascend:Math.max(this._minimumAscendVelocity()*t,2**(m*t/l)*f-f),zoom:2**(m*t/l)*c-c,rotate:i(u*h,Q,W)*t}}_applyDisabledMovementTypes(t){null==this.disableMovements||void 0!==this.disableMovements.mode&&this.view.state.viewingMode!==this.disableMovements.mode||(t.zoom=this.disableMovements.zoom?0:t.zoom,t.ascend=this.disableMovements.ascend?0:t.ascend,t.pan.enabled=!this.disableMovements.pan,this.disableMovements.pan&&l(t.pan.matrix),t.rotate.enabled=!this.disableMovements.rotate,this.disableMovements.rotate&&l(t.rotate.matrix))}static activatesFor(t,e){const i=I(e,t.navigation.gamepad,K);return!("end"===e.action||V(i))}};t([o({constructOnly:!0})],L.prototype,"gamepadDevice",void 0),t([o({constructOnly:!0})],L.prototype,"disableMovements",void 0),L=t([n("esri.views.3d.state.controllers.GamepadKeyboardController")],L);const K={translation:[0,0,0],heading:0,tilt:0,zoom:0},Z=80,X=r(Z),J=.75,N=5,Q=r(30),W=r(80),Y={zoom:0,ascend:0,pan:{enabled:!1,matrix:m()},rotate:{enabled:!1,matrix:m()}},$=O(),tt=O(),et=P(),it=new j;function at(t){t.zoom=0,t.ascend=0,t.pan.enabled=!1,l(t.pan.matrix),t.rotate.enabled=!1,l(t.rotate.matrix)}export{L as GamepadKeyboardController};
5
+ import{__decorate as t}from"tslib";import{neverReached as e}from"../../../../core/compilerUtils.js";import{clamp as i,acosClamped as a,deg2rad as r}from"../../../../core/mathUtils.js";import{property as o,subclass as n}from"../../../../core/accessorSupport/decorators.js";import{translate as s,rotate as c,identity as l}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as m}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{e as h,p,i as d,j as u,d as f,q as _,b as v,h as g,n as C,f as y,D as w,E as b,g as S}from"../../../../chunks/vec32.js";import{create as O}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as x}from"../../../../geometry/ellipsoidUtils.js";import{wrap as M}from"../../../../geometry/support/ray.js";import{Sphere as j}from"../../../../geometry/support/sphere.js";import{angle as z}from"../../../../geometry/support/vector.js";import{sv3d as T}from"../../../../geometry/support/vectorStacks.js";import{applyAll as A}from"../../camera/constraintUtils.js";import{ConstraintOptions as D}from"../../camera/constraintUtils/ConstraintOptions.js";import{TiltRange as R}from"../Constraints.js";import{InteractiveController as E}from"./InteractiveController.js";import{panMotionToRotationMatrix as H,onSurfaceTiltToEyeTiltGlobal as U,offSurfaceTiltToEyeTiltGlobal as k}from"../utils/navigationUtils.js";import{viewAngle as F}from"../utils/viewUtils.js";import{headingTiltToDirectionUp as G}from"../../support/cameraUtils.js";import{createDirectionUp as P}from"../../support/cameraUtilsInternal.js";import B from"../../webgl/RenderCamera.js";import{extractTransformation as I,isZeroTransformation as V,extractTransformationKeyboard as q}from"../../../navigation/gamepadAndKeyboardUtils.js";let L=class extends E{constructor(t){super(t),this._filteredSurfaceElevation=0,this._transformation={translation:[0,0,0],heading:0,tilt:0,zoom:0},this._keysButtonState=[0,0,0,0,0,0,0,0,0,0,0,0],this._tmpCamera=new B,this._headingStart=0,this._constraintOptions=new D(15,0,0,new B,null,1)}handleEventGamepad(t){const e=I(t,this.view.navigation.gamepad,this._transformation);("end"===t.action||V(e))&&this.finishController()}activateDirection(t){this._keysButtonState[t]=1,q(this._keysButtonState,this._transformation)}directionActive(t){return 1===this._keysButtonState[t]}countActiveDirections(){return this._keysButtonState.reduce((t,e)=>e>0?t+1:t,0)}deactivateDirection(t){this._keysButtonState[t]=0;const e=q(this._keysButtonState,this._transformation);V(e)&&this.finishController()}onControllerStart(t){this._filteredSurfaceElevation=this.view.pointsOfInterest.cameraOnSurface.location.z,this._headingStart=this.view.camera.heading,super.onControllerStart(t)}_updateFilteredSurfaceElevation(t){const e=this.view.pointsOfInterest.cameraOnSurface.location.z,i=1;this._filteredSurfaceElevation+=i*(e-this._filteredSurfaceElevation)*t}stepController(t,e){this._updateStartHeading(),this._updateFilteredSurfaceElevation(t),this.currentCamera.copyViewFrom(e),this._updateCameraCenter(),this._constraintOptions.interactionStartCamera?.copyFrom(this.currentCamera),this._calculateControlTransformation(t,this.currentCamera,Y),this._applyDisabledMovementTypes(Y),this._applyPan(Y.pan),this._applyRotate(Y.rotate),this._applyZoom(Y.zoom),this._applyAscend(Y.ascend),this._constraintOptions.interactionType=0,this._constraintOptions.selection=8,A(this.view,this.currentCamera,this._constraintOptions),super.stepController(t,e)}_updateStartHeading(){0!==this._transformation.heading&&(this._headingStart=this.view.camera.heading)}_applyRotate(t){if(!t.enabled)return;const e=this.currentCamera;h($,e.center,e.eye),p($,$,t.matrix),e.center=d($,$,e.eye),e.up=p($,e.up,t.matrix),this._constraintOptions.interactionType=3,this._constraintOptions.selection=7,A(this.view,e,this._constraintOptions)}_applyPan(t,e=this.currentCamera){if(!t.enabled)return;e.eye=p($,e.eye,t.matrix),e.center=p($,e.center,t.matrix);this.view.state.isGlobal&&(e.up=p($,e.up,t.matrix)),this._constraintOptions.interactionType=4,this._constraintOptions.selection=15,A(this.view,e,this._constraintOptions)}_applyZoom(t){if(!t)return;const e=this.currentCamera.viewForward;this.currentCamera.eye=d($,this.currentCamera.eye,u(T.get(),e,t)),f(tt,e),_(tt,tt),this._constraintOptions.interactionDirection=tt,this._constraintOptions.interactionType=1,this._constraintOptions.selection=7,A(this.view,this.currentCamera,this._constraintOptions),this._constraintOptions.interactionDirection=null}_applyAscend(t){if(!t)return;const e=this.view.renderCoordsHelper.worldUpAtPosition(this.currentCamera.eye,T.get());this._constraintOptions.interactionDirection=f(tt,e);if(this.view.state.isGlobal){const e=v(this.currentCamera.eye),i=(e+t)/e;this.currentCamera.eye=u($,this.currentCamera.eye,i),this.currentCamera.center=u($,this.currentCamera.center,i)}else{const i=u(T.get(),e,t);this.currentCamera.eye=d($,this.currentCamera.eye,i),this.currentCamera.center=d($,this.currentCamera.center,i)}this._updateCameraCenter(),this._constraintOptions.interactionType=5,this._constraintOptions.selection=8,A(this.view,this.currentCamera,this._constraintOptions)&&this._updateCameraCenter(),this._constraintOptions.selection=7,A(this.view,this.currentCamera,this._constraintOptions),this._constraintOptions.interactionDirection=null}_calculateControlTransformation(t,e,i){at(i);const a=this._computeVelocities(t);this.view.state.isLocal?this._calculateControlTransformationLocal(a,e,i):this._calculateControlTransformationGlobal(a,e,i)}_updateCameraCenter(){const t=this.view.pointsOfInterest.centerOnSurfaceFrequent.estimatedSurfaceAltitude,e=this.view.renderCoordsHelper,i=this.currentCamera.ray;this.currentCamera.center=e.intersectManifoldClosestSilhouette(i,t,$)}_calculateControlTransformationLocal(t,a,r){const{viewRight:o,viewForward:n}=a,l=this._transformation,m=this.view.navigation.gamepad,h=g(T.get(),n[0],n[1],0);C(h,h);const p=l.translation[0]*t.pan;if(0!==p){const t=u(T.get(),o,p);s(r.pan.matrix,r.pan.matrix,t),r.pan.enabled=!0}switch(m.mode){case"pan":{const e=-l.translation[1]*t.pan;if(0!==e){const t=u(T.get(),h,e);s(r.pan.matrix,r.pan.matrix,t),r.pan.enabled=!0}r.zoom=l.zoom*t.zoom;break}case"zoom":r.zoom=(-l.translation[1]+l.zoom)*t.zoom;break;default:e(m.mode)}const d=l.translation[2]*t.ascend;r.ascend=d;const f=-l.heading*t.rotate;0!==f&&(c(r.rotate.matrix,r.rotate.matrix,f,this.view.renderCoordsHelper.worldUpAtPosition(a.eye,T.get())),r.rotate.enabled=!0);const _=l.tilt*t.rotate,v=F(this.view.renderCoordsHelper,a.center,a.eye),y=i(v+_,R.min,R.max)-v;y&&(c(r.rotate.matrix,r.rotate.matrix,y,o),r.rotate.enabled=!0)}_calculateControlTransformationGlobal(t,e,i){const{eye:a,viewRight:r}=e,o=this._transformation,n=this.view.navigation.gamepad,s=y(T.get(),r,a);C(s,s),_(s,s),H(this.startCamera,e,o,t,this.view.camera.heading,this._headingStart,this.view.camera.tilt,i,n),this._tmpCamera.copyFrom(this.currentCamera),this._applyPan(Y.pan,this._tmpCamera);const l=this.view.pointsOfInterest.centerOnSurfaceFrequent.estimatedSurfaceAltitude,m=o.translation[2]*t.ascend;i.ascend=m;const h=-o.heading*t.rotate;0!==h&&(c(i.rotate.matrix,i.rotate.matrix,h,this._tmpCamera.eye),i.rotate.enabled=!0);const p=o.tilt*t.rotate,d=this._clampTiltDeltaGlobalToValidRange(p,e.ray,l);0!==d&&(c(i.rotate.matrix,i.rotate.matrix,d,this._tmpCamera.viewRight),i.rotate.enabled=!0),i.zoom+=o.zoom*t.zoom}_clampTiltDeltaGlobalToValidRange(t,e,a){const r=x(this.view.spatialReference),o=U(R.min,e.origin,a,r);let n=0,s=0;const c=T.get();if(this.view.renderCoordsHelper.intersectManifold(e,a,c)){const t=F(this.view.renderCoordsHelper,c,e.origin);n=U(t,e.origin,a,r),s=U(R.max,e.origin,a,r)}else{it.radius=a+r.radius,it.closestPointOnSilhouette(e,c);const t=Math.PI+z(e.direction,c);n=k(t,e.origin,a,r),s=k(R.max,e.origin,a,r)}return i(n+t,o,s)-n}_getPointAbsoluteSurfaceElevation(t,e,i){const{renderCoordsHelper:a}=this.view,r=a.getAltitude(t),o=e+Math.abs(r-e);return a.setAltitude(i,o,t),o}_clampedDistanceToSurface(t,e){const{renderCoordsHelper:i}=this.view,{camera:a}=this.view.state,{direction:r}=G(this.view,e,0,Z,et),o=i.intersectManifoldClosestSilhouette(M(e,r),t,T.get()),n=w(e,o),s=i.intersectManifoldClosestSilhouette(M(e,b(T.get(),e,a.center)),t,T.get()),c=w(e,s);return Math.min(n,c)}_computeHeadingRotateRadius(t){const{renderCoordsHelper:e,state:i}=this.view,{camera:r,isGlobal:o}=i,n=e.intersectManifoldClosestSilhouette(r.ray,this._filteredSurfaceElevation,T.get());if(o){const e=h(T.get(),t,n),i=v(e);u(e,e,1/i);const r=C(T.get(),t),o=a(S(r,e));return i*Math.sin(Math.min(X,o))}{const i=f(T.get(),t);return e.setAltitude(i,this._filteredSurfaceElevation),w(n,i)}}_minimumAscendVelocity(){return this.view.state.constraints.collision.enabled?0:N}_computeVelocities(t){const e=this._filteredSurfaceElevation,a=e+x(this.view.spatialReference).radius,{camera:r,isGlobal:o}=this.view.state,n=T.get(),s=this._getPointAbsoluteSurfaceElevation(r.eye,e,n),c=this._clampedDistanceToSurface(e,n),l=r.width/2,m=J*r.width,h=J*r.width,p=c*Math.tan(.5*r.fovX)/l,d=p/a,u=p/this._computeHeadingRotateRadius(n),f=s-e;return{pan:(o?d:p)*m*t,ascend:Math.max(this._minimumAscendVelocity()*t,2**(m*t/l)*f-f),zoom:2**(m*t/l)*c-c,rotate:i(u*h,Q,W)*t}}_applyDisabledMovementTypes(t){null==this.disableMovements||void 0!==this.disableMovements.mode&&this.view.state.viewingMode!==this.disableMovements.mode||(t.zoom=this.disableMovements.zoom?0:t.zoom,t.ascend=this.disableMovements.ascend?0:t.ascend,t.pan.enabled=!this.disableMovements.pan,this.disableMovements.pan&&l(t.pan.matrix),t.rotate.enabled=!this.disableMovements.rotate,this.disableMovements.rotate&&l(t.rotate.matrix))}static activatesFor(t,e){const i=I(e,t.navigation.gamepad,K);return!("end"===e.action||V(i))}};t([o({constructOnly:!0})],L.prototype,"gamepadDevice",void 0),t([o({constructOnly:!0})],L.prototype,"disableMovements",void 0),L=t([n("esri.views.3d.state.controllers.GamepadKeyboardController")],L);const K={translation:[0,0,0],heading:0,tilt:0,zoom:0},Z=80,X=r(Z),J=.75,N=5,Q=r(30),W=r(80),Y={zoom:0,ascend:0,pan:{enabled:!1,matrix:m()},rotate:{enabled:!1,matrix:m()}},$=O(),tt=O(),et=P(),it=new j;function at(t){t.zoom=0,t.ascend=0,t.pan.enabled=!1,l(t.pan.matrix),t.rotate.enabled=!1,l(t.rotate.matrix)}export{L as GamepadKeyboardController};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as t}from"tslib";import{property as o,subclass as e}from"../../../../../core/accessorSupport/decorators.js";import{d as r,D as s}from"../../../../../chunks/vec32.js";import{create as i,clone as n}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{MomentumController as m}from"./MomentumController.js";import{applyZoomToPoint as c}from"../../utils/navigationUtils.js";let a=class extends m{constructor(t){super(t),this.interactionType=1,this.constraintOptions.interactionDirection=i()}momentumStep(t,o){const{interactionDirection:e}=this.constraintOptions;if(!e)return;r(e,o.eye);const i=this.momentum.valueDelta(0,t);c(o,this.zoomCenter,i,this.view.state.constraints.minimumPoiDistance),s(e,o.eye,e)}set zoomCenter(t){this._set("zoomCenter",n(t))}};t([o({constructOnly:!0})],a.prototype,"momentum",void 0),t([o({constructOnly:!0})],a.prototype,"zoomCenter",null),a=t([e("esri.views.3d.state.controllers.momentum.ZoomPlanarMomentumController")],a);export{a as ZoomPlanarMomentumController};
5
+ import{__decorate as t}from"tslib";import{property as o,subclass as e}from"../../../../../core/accessorSupport/decorators.js";import{d as r,E as s}from"../../../../../chunks/vec32.js";import{create as i,clone as n}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{MomentumController as m}from"./MomentumController.js";import{applyZoomToPoint as c}from"../../utils/navigationUtils.js";let a=class extends m{constructor(t){super(t),this.interactionType=1,this.constraintOptions.interactionDirection=i()}momentumStep(t,o){const{interactionDirection:e}=this.constraintOptions;if(!e)return;r(e,o.eye);const i=this.momentum.valueDelta(0,t);c(o,this.zoomCenter,i,this.view.state.constraints.minimumPoiDistance),s(e,o.eye,e)}set zoomCenter(t){this._set("zoomCenter",n(t))}};t([o({constructOnly:!0})],a.prototype,"momentum",void 0),t([o({constructOnly:!0})],a.prototype,"zoomCenter",null),a=t([e("esri.views.3d.state.controllers.momentum.ZoomPlanarMomentumController")],a);export{a as ZoomPlanarMomentumController};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{neverReached as t}from"../../../core/compilerUtils.js";import{lerp as e}from"../../../core/mathUtils.js";import{invert as i}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{create as r}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{i as n,j as o,D as s,p as a,h as c,g as l}from"../../../chunks/vec32.js";import{create as p}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as h}from"../../../geometry/ellipsoidUtils.js";import{computeTranslationToOriginAndRotation as d}from"../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{projectBoundingRect as _}from"../../../geometry/projection/projectBoundingRect.js";import{projectVectorToVector as m}from"../../../geometry/projection/projectVectorToVector.js";import{empty as g,create as x,expandWithVec3 as f}from"../../../geometry/support/aaBoundingBox.js";import{center as u,create as y}from"../../../geometry/support/aaBoundingRect.js";import{fromPoints as j,create as R}from"../../../geometry/support/lineSegment.js";import{create as b,fromVectorsAndPoint as S,copy as B,negate as C,signedDistance as H}from"../../../geometry/support/plane.js";import{wrap as w}from"../../../geometry/support/ray.js";import{frustumLineSegment as M}from"./intersectionUtils.js";const A=.5*Math.PI,G=A/Math.PI*180;class E{constructor(t){this._extent=new Array(4),this._planes=new Array(6),this._maxSpan=0,this._center={origin:p(),direction:p()},this._renderCoordsHelper=t.renderCoordsHelper;for(let e=0;e<4;e++)this._extent[e]={origin:p(),direction:p(),cap:{next:null,direction:p()}},this._planes[e]=b();this._planes[4]=b(),this._planes[5]=b(),this._planesWithoutFar=this._planes.slice(0,5)}update(t,e,i,r=!0){const a=this._extent;this._toRenderBoundingExtent(t,e,i),n(this._center.origin,a[0].origin,a[2].origin),o(this._center.origin,this._center.origin,.5),this._renderCoordsHelper.worldUpAtPosition(this._center.origin,this._center.direction),r||o(this._center.direction,this._center.direction,-1);for(let n=0;n<4;n++){const t=a[n];this._renderCoordsHelper.worldUpAtPosition(t.origin,t.direction);const e=a[3===n?0:n+1];t.cap.next=e.origin,s(t.cap.direction,t.origin,e.origin),S(t.direction,t.cap.direction,t.origin,this._planes[n]),r||o(t.direction,t.direction,-1)}S(a[0].cap.direction,a[1].cap.direction,a[0].origin,this._planes[4]),r?C(this._planes[4],this._planes[5]):(B(this._planes[5],this._planes[4]),C(this._planes[4],this._planes[4])),this._maxSpan=Math.max(Math.abs(t[0]-t[2]),Math.abs(t[1]-t[3])),this._maxSpanSpatialReference=e,this._minGlobalAltitude=.9*h(this._maxSpanSpatialReference).radius}isVisibleInFrustum(t,e,i=!1){if(null==t)return!1;if(1===this._renderCoordsHelper.viewingMode){const i=this._maxSpanSpatialReference.isGeographic?G:A*e;if(this._maxSpan>i)return!0;if(null!=t.altitude&&t.altitude>=this._minGlobalAltitude)return this._isVisibleInFrustumGlobal(t)}if(0===this._maxSpan){const e=this._extent[0];return!(i||!t.intersectsRay(w(e.origin,e.direction)))}for(let n=0;n<this._extent.length;n++){const e=this._extent[n];if(!i&&t.intersectsRay(w(e.origin,e.direction)))return!0;if(t.intersectsLineSegment(j(e.origin,e.cap.next,k),e.cap.direction))return!0}const r=i?this._planes:this._planesWithoutFar;for(let n=0;n<t.lines.length;n++){const e=t.lines[n];if(M(r,e.origin,e.endpoint,e.direction))return!0}return!1}_toRenderBoundingExtentGlobal(t,r,n){const o=5;u(t,v),v[2]=n,d(r,v,F,this._renderCoordsHelper.spatialReference),i(I,F),g(V);for(const{x0:i,x1:s,y0:c,y1:l}of U)for(let p=0;p<o;p++){const h=p/(o-1);v[0]=e(t[i],t[s],h),v[1]=e(t[c],t[l],h),v[2]=n,m(v,r,v,this._renderCoordsHelper.spatialReference),a(v,v,I),f(V,v)}c(this._extent[0].origin,V[0],V[1],V[2]),c(this._extent[1].origin,V[3],V[1],V[2]),c(this._extent[2].origin,V[3],V[4],V[2]),c(this._extent[3].origin,V[0],V[4],V[2]);for(let e=0;e<4;++e)a(this._extent[e].origin,this._extent[e].origin,F)}_toRenderBoundingExtentLocal(t,e,i){_(t,e,P,this._renderCoordsHelper.spatialReference),c(this._extent[0].origin,P[0],P[1],i),c(this._extent[1].origin,P[2],P[1],i),c(this._extent[2].origin,P[2],P[3],i),c(this._extent[3].origin,P[0],P[3],i)}_toRenderBoundingExtent(e,i,r){switch(this._renderCoordsHelper.viewingMode){case 1:this._toRenderBoundingExtentGlobal(e,i,r);break;case 2:this._toRenderBoundingExtentLocal(e,i,r);break;default:t(this._renderCoordsHelper.viewingMode)}}_isVisibleInFrustumGlobal(t){if(H(t.planes[4],this._center.origin)<0&&l(this._center.direction,t.direction)<0)return!0;for(let e=0;e<4;e++){const i=this._extent[e];if(H(t.planes[4],i.origin)<0&&l(i.direction,t.direction)<0)return!0}return!1}}const U=[{x0:0,y0:1,x1:2,y1:1},{x0:0,y0:3,x1:2,y1:3},{x0:0,y0:1,x1:0,y1:3},{x0:2,y0:1,x1:2,y1:3}],v=p(),F=r(),I=r(),V=x(),P=y(),k=R();export{E as FrustumExtentIntersection};
5
+ import{neverReached as t}from"../../../core/compilerUtils.js";import{lerp as e}from"../../../core/mathUtils.js";import{invert as i}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{create as r}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{i as n,j as o,E as s,p as a,h as c,g as l}from"../../../chunks/vec32.js";import{create as p}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as h}from"../../../geometry/ellipsoidUtils.js";import{computeTranslationToOriginAndRotation as d}from"../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{projectBoundingRect as _}from"../../../geometry/projection/projectBoundingRect.js";import{projectVectorToVector as m}from"../../../geometry/projection/projectVectorToVector.js";import{empty as g,create as x,expandWithVec3 as f}from"../../../geometry/support/aaBoundingBox.js";import{center as u,create as y}from"../../../geometry/support/aaBoundingRect.js";import{fromPoints as j,create as R}from"../../../geometry/support/lineSegment.js";import{create as b,fromVectorsAndPoint as S,copy as B,negate as C,signedDistance as H}from"../../../geometry/support/plane.js";import{wrap as w}from"../../../geometry/support/ray.js";import{frustumLineSegment as M}from"./intersectionUtils.js";const A=.5*Math.PI,E=A/Math.PI*180;class G{constructor(t){this._extent=new Array(4),this._planes=new Array(6),this._maxSpan=0,this._center={origin:p(),direction:p()},this._renderCoordsHelper=t.renderCoordsHelper;for(let e=0;e<4;e++)this._extent[e]={origin:p(),direction:p(),cap:{next:null,direction:p()}},this._planes[e]=b();this._planes[4]=b(),this._planes[5]=b(),this._planesWithoutFar=this._planes.slice(0,5)}update(t,e,i,r=!0){const a=this._extent;this._toRenderBoundingExtent(t,e,i),n(this._center.origin,a[0].origin,a[2].origin),o(this._center.origin,this._center.origin,.5),this._renderCoordsHelper.worldUpAtPosition(this._center.origin,this._center.direction),r||o(this._center.direction,this._center.direction,-1);for(let n=0;n<4;n++){const t=a[n];this._renderCoordsHelper.worldUpAtPosition(t.origin,t.direction);const e=a[3===n?0:n+1];t.cap.next=e.origin,s(t.cap.direction,t.origin,e.origin),S(t.direction,t.cap.direction,t.origin,this._planes[n]),r||o(t.direction,t.direction,-1)}S(a[0].cap.direction,a[1].cap.direction,a[0].origin,this._planes[4]),r?C(this._planes[4],this._planes[5]):(B(this._planes[5],this._planes[4]),C(this._planes[4],this._planes[4])),this._maxSpan=Math.max(Math.abs(t[0]-t[2]),Math.abs(t[1]-t[3])),this._maxSpanSpatialReference=e,this._minGlobalAltitude=.9*h(this._maxSpanSpatialReference).radius}isVisibleInFrustum(t,e,i=!1){if(null==t)return!1;if(1===this._renderCoordsHelper.viewingMode){const i=this._maxSpanSpatialReference.isGeographic?E:A*e;if(this._maxSpan>i)return!0;if(null!=t.altitude&&t.altitude>=this._minGlobalAltitude)return this._isVisibleInFrustumGlobal(t)}if(0===this._maxSpan){const e=this._extent[0];return!(i||!t.intersectsRay(w(e.origin,e.direction)))}for(let n=0;n<this._extent.length;n++){const e=this._extent[n];if(!i&&t.intersectsRay(w(e.origin,e.direction)))return!0;if(t.intersectsLineSegment(j(e.origin,e.cap.next,k),e.cap.direction))return!0}const r=i?this._planes:this._planesWithoutFar;for(let n=0;n<t.lines.length;n++){const e=t.lines[n];if(M(r,e.origin,e.endpoint,e.direction))return!0}return!1}_toRenderBoundingExtentGlobal(t,r,n){const o=5;u(t,v),v[2]=n,d(r,v,F,this._renderCoordsHelper.spatialReference),i(I,F),g(V);for(const{x0:i,x1:s,y0:c,y1:l}of U)for(let p=0;p<o;p++){const h=p/(o-1);v[0]=e(t[i],t[s],h),v[1]=e(t[c],t[l],h),v[2]=n,m(v,r,v,this._renderCoordsHelper.spatialReference),a(v,v,I),f(V,v)}c(this._extent[0].origin,V[0],V[1],V[2]),c(this._extent[1].origin,V[3],V[1],V[2]),c(this._extent[2].origin,V[3],V[4],V[2]),c(this._extent[3].origin,V[0],V[4],V[2]);for(let e=0;e<4;++e)a(this._extent[e].origin,this._extent[e].origin,F)}_toRenderBoundingExtentLocal(t,e,i){_(t,e,P,this._renderCoordsHelper.spatialReference),c(this._extent[0].origin,P[0],P[1],i),c(this._extent[1].origin,P[2],P[1],i),c(this._extent[2].origin,P[2],P[3],i),c(this._extent[3].origin,P[0],P[3],i)}_toRenderBoundingExtent(e,i,r){switch(this._renderCoordsHelper.viewingMode){case 1:this._toRenderBoundingExtentGlobal(e,i,r);break;case 2:this._toRenderBoundingExtentLocal(e,i,r);break;default:t(this._renderCoordsHelper.viewingMode)}}_isVisibleInFrustumGlobal(t){if(H(t.planes[4],this._center.origin)<0&&l(this._center.direction,t.direction)<0)return!0;for(let e=0;e<4;e++){const i=this._extent[e];if(H(t.planes[4],i.origin)<0&&l(i.direction,t.direction)<0)return!0}return!1}}const U=[{x0:0,y0:1,x1:2,y1:1},{x0:0,y0:3,x1:2,y1:3},{x0:0,y0:1,x1:0,y1:3},{x0:2,y0:1,x1:2,y1:3}],v=p(),F=r(),I=r(),V=x(),P=y(),k=R();export{G as FrustumExtentIntersection};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../Camera.js";import t from"../../../core/Logger.js";import{deg2rad as n,rad2deg as r,asinClamped as i}from"../../../core/mathUtils.js";import{throwIfAborted as a}from"../../../core/promiseUtils.js";import{d as o,C as c,G as s,b as l}from"../../../chunks/vec32.js";import{create as u,clone as f}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as m}from"../../../geometry/ellipsoidUtils.js";import p from"../../../geometry/Point.js";import{projectWithZConversion as d,project as h}from"../../../geometry/projectionUtils.js";import g from"../../../geometry/SpatialReference.js";import{projectPointToVectorAsync as y,projectPointToVector as v}from"../../../geometry/projection/projectPointToVector.js";import{projectVectorToPointAsync as R,projectVectorToPoint as w}from"../../../geometry/projection/projectVectorToPoint.js";import{gcsCyclical as x,webMercatorCyclical as M}from"../../../geometry/support/normalizeUtils.js";import{toRenderCamera as j}from"../webgl.js";import{getGreatCircleSpanAt as T}from"./earthUtils.js";import{getElevationAtPoint as z}from"./ElevationProvider.js";import{viewModeDependentUtil as S,directionToHeadingTilt as C}from"./viewingModeUtils.js";import{isSpatialReferenceSupported as b}from"../../support/spatialReferenceSupport.js";const P=()=>t.getLogger("esri.views.3d.support.cameraUtils"),A=96*39.37,L=1,U=8,H=5,q=1,G=u();function I(e){return e.spatialReference??g.WGS84}function E(e,t,n,r,i){return S(e).headingTiltToDirectionUp(t,n,r,i)}function F(e,t){const{camera:n}=e.state,{unitInMeters:r}=e.renderCoordsHelper;t/=r;return n.width/2/n.pixelRatio/(A/t)/Math.tan(n.fovX/2)}function O(e,t){const{camera:n}=e.state,{unitInMeters:r}=e.renderCoordsHelper,i=t*Math.tan(n.fovX/2),a=n.width/2/n.pixelRatio;return A/(a/i)*r}function X(e,t,n,r){const i=r.levelAtScale(t),a=D(C(e,n.eye,n.viewForward,n.up).tilt),o=Math.max(i-a,0);return r.scaleAtLevel(o)}function k(e,t,n){const r=n.levelAtScale(e),i=D(t);return n.scaleAtLevel(r+i)}function D(e){return 2*((e>90?180-e:e)/90)**2}function V(e,t,n=0){const r=e.basemapTerrain?.tilingScheme;if(!r)return 0;const i=m(e.spatialReference).radius,a=2===e.state.viewingMode?t.eye[2]:l(t.eye)-i;return X(e,O(e,Math.abs(a-n)),t,r)}function W(e,t,n=0){const r=j(e,t);return r?V(e,r,n):0}const Y=1,N=100;function Z(e,t,a,o){if(0===t)return 0;const s=e.state.contentCamera,u=c(s.eye,a),f=e.basemapTerrain?.tilingScheme;if(!f)return P().error("#scaleToTargetDistance()","Cannot compute distance from scale without a tiling scheme"),u;let p=u;const d=C(e,s.eye,s.viewForward,s.up),h=d.tilt>90;if(e.state.isLocal){const r=(F(e,k(t,d.tilt,f))-Math.abs(s.eye[2]-o[2]))/Math.cos(n(d.tilt));return p=h?p-r:p+r,p}let g=1/0,y=0,v=te(e,d.heading,d.tilt,a,u,1);if(!v)return p;const R=l(o);for(;g>Y&&y<N;){const o=l(v.eye),u=h?180-v.tilt:v.tilt,w=n(u),x=Math.sin(w)*o,M=Math.cos(w)*o,j=F(e,k(t,v.tilt,f)),T=h?R-j:R+j,z=i(x/T),S=Math.cos(z)*T-M,C=c(v.eye,a);p=h?C-S:C+S,v=te(e,d.heading,d.tilt,a,p,1);const b=Me(e,v,r(s.fov));if(!v||!b)return p;const P=W(e,b,R-m(e.spatialReference).radius);g=Math.abs(t-P),++y}return p}async function B(e,t,n,r,i,a){return K(e,t,F(e,n),r,i,a)}function J(e,t,n,r,i,a){return Me(e,te(e,r.heading,r.tilt,t,n,i),r.fov,a)}async function K(e,t,n,r,i,o){const c=await ne(e,r.heading,r.tilt,t,n,i,o);return a(o),je(e,c,r.fov,o)}function Q(e,t){return!!(e.basemapTerrain&&e.renderCoordsHelper.fromRenderCoords(t,G,e.spatialReference)&&e.elevationProvider&&(z(e.elevationProvider,G)??0)>G[2]-q)}async function $(e,t,n){if(Q(e,t))return!0;const{elevationProvider:r,spatialReference:i,renderCoordsHelper:o}=e;if(null==r||!o.fromRenderCoords(t,G,i))return!1;const[c,s,l]=G,u=await r.queryElevation(c,s,l,i,"ground",n)??0;return a(n),u>l-q}async function _(e,t,n){const r=u();if(null==t)return o(r,e.state.camera.center);if(t instanceof p){const{renderSpatialReference:i,basemapTerrain:o,elevationProvider:c}=e,s=t.spatialReference;if(await y(t,r,i,{signal:n}),a(n),null==t.z&&null!=o&&null!=c){const i=await c.queryElevation(t.x,t.y,t.z??0,s,"ground",n);a(n),null!=i&&e.renderCoordsHelper.setAltitude(r,i)}return r}return o(r,t)}function ee(e,t){const n=u();if(null==t)return o(n,e.state.camera.center);if(t instanceof p){if(!v(t,n,e.renderSpatialReference))return null;const{basemapTerrain:r,elevationProvider:i}=e;if(null==t.z&&null!=r&&null!=i){const r=z(i,t);null!=r&&e.renderCoordsHelper.setAltitude(n,r)}return n}return o(n,t)}function te(e,t,n,r,i,a){return re(e,t,n,r instanceof p?r:null,ee(e,r),i,a)}async function ne(e,t,n,r,i,o,c){const s=r instanceof p?r:null,l=await _(e,r,c);return a(c),ie(e,t,n,s,l,i,o,c)}function re(e,t,n,r,i,a,o){if(null==i)return null;if(!r&&(r=new p({spatialReference:I(e)}),!w(i,e.renderSpatialReference,r)))return null;const c=ae(e,t,n,i,a,o);if(oe(e,n,o)&&Q(e,c.eye)){const{tilt:o,mode:c}=ce(e,n,i,a);return re(e,t,o,r,i,a,c)}return se(c,i)}async function ie(e,t,n,r,i,o,c,s){r||(r=new p({spatialReference:I(e)}),await R(i,e.renderSpatialReference,r,{signal:s})||(r=null)),a(s);const l=ae(e,t,n,i,o,c);if(oe(e,n,c)&&await $(e,l.eye,s)){a(s);const{tilt:c,mode:l}=ce(e,n,i,o);return ie(e,t,c,r,i,o,l,s)}return se(l,i)}function ae(e,t,n,r,i,a){const o=ge(e,t,n,r,i=Math.max(i,e.state.constraints.minimumPoiDistance),a);return(0,S(e).eyeForCenterWithHeadingTilt)(r,i,o.heading,o.tilt)}function oe(e,t,n){const r=e.map.ground.navigationConstraint;return 1===n&&e.state.isGlobal&&t>0&&(null==r||"stay-above"===r.type)}function ce(e,t,n,r){const i=we(e,n,r,Re(e,r,t,n));return{tilt:i,mode:t-i<1?0:1}}function se(e,t){return{...e,center:f(t)}}function le(e,t){const{state:n,spatialReference:r}=e,i=t.spatialReference;return n.isGlobal&&b(i,1)||n.isLocal&&r.equals(i)}function ue(e,t){let n,r,i;if(e.state.isGlobal){const e=new p(t.xmin,t.ymin,t.spatialReference),a=new p(t.xmax,t.ymax,t.spatialReference),o=t.spatialReference.isGeographic?x:M;n=new p({x:o.center(e.x,a.x),y:(a.y+e.y)/2,z:null!=t.zmax&&null!=t.zmin?(t.zmax+t.zmin)/2:void 0,spatialReference:t.spatialReference});const c=m(t.spatialReference),s=T(n,e,a);r=s.lon,i=s.lat,o.diff(e.x,a.x)>o.range/2&&(r+=c.halfCircumference),r=Math.min(r,c.halfCircumference),i=Math.min(i,c.halfCircumference)}else{const a=e.renderSpatialReference??t.spatialReference;a.equals(t.spatialReference)||(t=h(t,a)),r=t.xmax-t.xmin,i=t.ymax-t.ymin;const o=null!=t.zmax&&null!=t.zmin?(t.zmax+t.zmin)/2:void 0;n=new p({x:t.xmin+.5*r,y:t.ymin+.5*i,z:o,spatialReference:a})}const a=null!=t.zmax&&null!=t.zmin?t.zmax-t.zmin:0,o=e.state.camera,c=1/Math.tan(o.fovX/2),s=1/Math.tan(o.fovY/2),l=1/Math.tan(o.fov/2);return{center:n,distance:Math.max(.5*r*c,.5*i*s,.5*a*l)/L}}async function fe(e,t,n,r,i,o){const c=le(e,t)?t:await d(t,e.spatialReference,{signal:o});a(o);const{center:s,distance:l}=ue(e,c),u=await ne(e,n,r,s,l,i,o);return a(o),je(e,u,e.camera.fov,o)}function me(e,t,n,r,i,a){let o;try{o=le(e,t)?t:h(t,e.spatialReference)}catch(u){return null}const{center:c,distance:s}=ue(e,o),l=te(e,n,r,c,s,i);return null==l?null:Me(e,l,e.camera.fov,a)}function pe(e,t,n){const r=e.renderSpatialReference,i=new p({spatialReference:I(e)});if(!w(n,r,i))return null;const a=Math.tan(t.fovX/2),o=Math.tan(t.fovY/2),c=s(t.eye,n),l=2*c*a*L,u=2*c*o*L;return S(e).toExtent(e,i,l,u)}function de(e,t){return S(e).toArea(e,t)}function he(e,t,n){const r=e.pointsOfInterest.centerOnSurfaceFrequent.distance;if(Math.log(n/r)/Math.LN2>U)return!0;const i=t,a=e.pointsOfInterest.centerOnSurfaceFrequent.renderLocation;return c(i,a)/(Math.tan(.5*e.state.camera.fov)*r)>H}function ge(e,t,n,r,i,a){let o=0;return 1===a&&he(e,r,i)?(t=0,o=ve(e,i,n,r)):o=xe(e,r,i,n),o=e.state.constraints.clampTilt(i,o),{heading:t,tilt:n=we(e,r,i,o)}}const ye=.7;function ve(e,t,n,r){const i=xe(e,r,t,n);if(!e.state.constraints.tilt)return i;const a=e.state.constraints.tilt(t);a.max=Math.min(a.max,.5*Math.PI);const o=a.min*(1-ye)+a.max*ye;return Math.min(i,o)}function Re(e,t,n,r){let i=xe(e,r,t,n);if(!e.state.constraints.tilt)return i;const a=e.state.constraints.tilt(t);return i=Math.min(i,.5*Math.PI),a.min*(1-ye)+i*ye}function we(e,t,n,r){return S(e).lookAtTiltToEyeTilt(r,t,n)}function xe(e,t,n,r){return S(e).eyeTiltToLookAtTilt(r,t,n)}function Me(t,n,r,i){if(null==n)return null;const a=t.renderSpatialReference,o=new p({spatialReference:I(t)});return w(n.eye,a,o)?(i??=new e,i.position=o,i.heading=n.heading,i.tilt=n.tilt,i.fov=r,i):null}async function je(t,n,r,i){const o=t.renderSpatialReference,c=new p({spatialReference:I(t)});return await R(n.eye,o,c,{signal:i}),a(i),new e(c,n.heading,n.tilt,r)}function Te(e,t){const n=e.basemapTerrain?.tilingScheme;if(n)return n.levelAtScale(t);P().error("#scaleToZoom()","Cannot compute zoom from scale without a tiling scheme")}function ze(e,t){const n=e.basemapTerrain?.tilingScheme;if(n)return n.scaleAtLevel(t);P().error("#zoomToScale()","Cannot compute scale from zoom without a tiling scheme")}export{X as applyTiltAdjustToScale,O as distanceToScale,K as fromCenterDistanceAsync,J as fromCenterDistanceSync,B as fromCenterScale,fe as fromExtentAsync,me as fromExtentSync,ne as getObserverForPointAtDistanceAsync,te as getObserverForPointAtDistanceSync,I as getViewSR,E as headingTiltToDirectionUp,k as removeTiltAdjustFromScale,Y as scaleErrorThreshold,F as scaleToDistance,Te as scaleToZoom,de as toArea,pe as toExtent,Z as viewScaleToCameraDistance,ze as zoomToScale};
5
+ import e from"../../../Camera.js";import t from"../../../core/Logger.js";import{deg2rad as n,rad2deg as r,asinClamped as i}from"../../../core/mathUtils.js";import{throwIfAborted as a}from"../../../core/promiseUtils.js";import{d as o,D as c,H as s,b as l}from"../../../chunks/vec32.js";import{create as u,clone as f}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as m}from"../../../geometry/ellipsoidUtils.js";import p from"../../../geometry/Point.js";import{projectWithZConversion as d,project as h}from"../../../geometry/projectionUtils.js";import g from"../../../geometry/SpatialReference.js";import{projectPointToVectorAsync as y,projectPointToVector as v}from"../../../geometry/projection/projectPointToVector.js";import{projectVectorToPointAsync as R,projectVectorToPoint as w}from"../../../geometry/projection/projectVectorToPoint.js";import{gcsCyclical as x,webMercatorCyclical as M}from"../../../geometry/support/normalizeUtils.js";import{toRenderCamera as j}from"../webgl.js";import{getGreatCircleSpanAt as T}from"./earthUtils.js";import{getElevationAtPoint as z}from"./ElevationProvider.js";import{viewModeDependentUtil as S,directionToHeadingTilt as C}from"./viewingModeUtils.js";import{isSpatialReferenceSupported as b}from"../../support/spatialReferenceSupport.js";const P=()=>t.getLogger("esri.views.3d.support.cameraUtils"),A=96*39.37,L=1,U=8,H=5,q=1,I=u();function E(e){return e.spatialReference??g.WGS84}function F(e,t,n,r,i){return S(e).headingTiltToDirectionUp(t,n,r,i)}function G(e,t){const{camera:n}=e.state,{unitInMeters:r}=e.renderCoordsHelper;t/=r;return n.width/2/n.pixelRatio/(A/t)/Math.tan(n.fovX/2)}function D(e,t){const{camera:n}=e.state,{unitInMeters:r}=e.renderCoordsHelper,i=t*Math.tan(n.fovX/2),a=n.width/2/n.pixelRatio;return A/(a/i)*r}function O(e,t,n,r){const i=r.levelAtScale(t),a=k(C(e,n.eye,n.viewForward,n.up).tilt),o=Math.max(i-a,0);return r.scaleAtLevel(o)}function X(e,t,n){const r=n.levelAtScale(e),i=k(t);return n.scaleAtLevel(r+i)}function k(e){return 2*((e>90?180-e:e)/90)**2}function V(e,t,n=0){const r=e.basemapTerrain?.tilingScheme;if(!r)return 0;const i=m(e.spatialReference).radius,a=2===e.state.viewingMode?t.eye[2]:l(t.eye)-i;return O(e,D(e,Math.abs(a-n)),t,r)}function W(e,t,n=0){const r=j(e,t);return r?V(e,r,n):0}const Y=1,N=100;function Z(e,t,a,o){if(0===t)return 0;const s=e.state.contentCamera,u=c(s.eye,a),f=e.basemapTerrain?.tilingScheme;if(!f)return P().error("#scaleToTargetDistance()","Cannot compute distance from scale without a tiling scheme"),u;let p=u;const d=C(e,s.eye,s.viewForward,s.up),h=d.tilt>90;if(e.state.isLocal){const r=(G(e,X(t,d.tilt,f))-Math.abs(s.eye[2]-o[2]))/Math.cos(n(d.tilt));return p=h?p-r:p+r,p}let g=1/0,y=0,v=te(e,d.heading,d.tilt,a,u,1);if(!v)return p;const R=l(o);for(;g>Y&&y<N;){const o=l(v.eye),u=h?180-v.tilt:v.tilt,w=n(u),x=Math.sin(w)*o,M=Math.cos(w)*o,j=G(e,X(t,v.tilt,f)),T=h?R-j:R+j,z=i(x/T),S=Math.cos(z)*T-M,C=c(v.eye,a);p=h?C-S:C+S,v=te(e,d.heading,d.tilt,a,p,1);const b=Me(e,v,r(s.fov));if(!v||!b)return p;const P=W(e,b,R-m(e.spatialReference).radius);g=Math.abs(t-P),++y}return p}async function B(e,t,n,r,i,a){return K(e,t,G(e,n),r,i,a)}function J(e,t,n,r,i,a){return Me(e,te(e,r.heading,r.tilt,t,n,i),r.fov,a)}async function K(e,t,n,r,i,o){const c=await ne(e,r.heading,r.tilt,t,n,i,o);return a(o),je(e,c,r.fov,o)}function Q(e,t){return!!(e.basemapTerrain&&e.renderCoordsHelper.fromRenderCoords(t,I,e.spatialReference)&&e.elevationProvider&&(z(e.elevationProvider,I)??0)>I[2]-q)}async function $(e,t,n){if(Q(e,t))return!0;const{elevationProvider:r,spatialReference:i,renderCoordsHelper:o}=e;if(null==r||!o.fromRenderCoords(t,I,i))return!1;const[c,s,l]=I,u=await r.queryElevation(c,s,l,i,"ground",n)??0;return a(n),u>l-q}async function _(e,t,n){const r=u();if(null==t)return o(r,e.state.camera.center);if(t instanceof p){const{renderSpatialReference:i,basemapTerrain:o,elevationProvider:c}=e,s=t.spatialReference;if(await y(t,r,i,{signal:n}),a(n),null==t.z&&null!=o&&null!=c){const i=await c.queryElevation(t.x,t.y,t.z??0,s,"ground",n);a(n),null!=i&&e.renderCoordsHelper.setAltitude(r,i)}return r}return o(r,t)}function ee(e,t){const n=u();if(null==t)return o(n,e.state.camera.center);if(t instanceof p){if(!v(t,n,e.renderSpatialReference))return null;const{basemapTerrain:r,elevationProvider:i}=e;if(null==t.z&&null!=r&&null!=i){const r=z(i,t);null!=r&&e.renderCoordsHelper.setAltitude(n,r)}return n}return o(n,t)}function te(e,t,n,r,i,a){return re(e,t,n,r instanceof p?r:null,ee(e,r),i,a)}async function ne(e,t,n,r,i,o,c){const s=r instanceof p?r:null,l=await _(e,r,c);return a(c),ie(e,t,n,s,l,i,o,c)}function re(e,t,n,r,i,a,o){if(null==i)return null;if(!r&&(r=new p({spatialReference:E(e)}),!w(i,e.renderSpatialReference,r)))return null;const c=ae(e,t,n,i,a,o);if(oe(e,n,o)&&Q(e,c.eye)){const{tilt:o,mode:c}=ce(e,n,i,a);return re(e,t,o,r,i,a,c)}return se(c,i)}async function ie(e,t,n,r,i,o,c,s){r||(r=new p({spatialReference:E(e)}),await R(i,e.renderSpatialReference,r,{signal:s})||(r=null)),a(s);const l=ae(e,t,n,i,o,c);if(oe(e,n,c)&&await $(e,l.eye,s)){a(s);const{tilt:c,mode:l}=ce(e,n,i,o);return ie(e,t,c,r,i,o,l,s)}return se(l,i)}function ae(e,t,n,r,i,a){const o=ge(e,t,n,r,i=Math.max(i,e.state.constraints.minimumPoiDistance),a);return(0,S(e).eyeForCenterWithHeadingTilt)(r,i,o.heading,o.tilt)}function oe(e,t,n){const r=e.map.ground.navigationConstraint;return 1===n&&e.state.isGlobal&&t>0&&(null==r||"stay-above"===r.type)}function ce(e,t,n,r){const i=we(e,n,r,Re(e,r,t,n));return{tilt:i,mode:t-i<1?0:1}}function se(e,t){return{...e,center:f(t)}}function le(e,t){const{state:n,spatialReference:r}=e,i=t.spatialReference;return n.isGlobal&&b(i,1)||n.isLocal&&r.equals(i)}function ue(e,t){let n,r,i;if(e.state.isGlobal){const e=new p(t.xmin,t.ymin,t.spatialReference),a=new p(t.xmax,t.ymax,t.spatialReference),o=t.spatialReference.isGeographic?x:M;n=new p({x:o.center(e.x,a.x),y:(a.y+e.y)/2,z:null!=t.zmax&&null!=t.zmin?(t.zmax+t.zmin)/2:void 0,spatialReference:t.spatialReference});const c=m(t.spatialReference),s=T(n,e,a);r=s.lon,i=s.lat,o.diff(e.x,a.x)>o.range/2&&(r+=c.halfCircumference),r=Math.min(r,c.halfCircumference),i=Math.min(i,c.halfCircumference)}else{const a=e.renderSpatialReference??t.spatialReference;a.equals(t.spatialReference)||(t=h(t,a)),r=t.xmax-t.xmin,i=t.ymax-t.ymin;const o=null!=t.zmax&&null!=t.zmin?(t.zmax+t.zmin)/2:void 0;n=new p({x:t.xmin+.5*r,y:t.ymin+.5*i,z:o,spatialReference:a})}const a=null!=t.zmax&&null!=t.zmin?t.zmax-t.zmin:0,o=e.state.camera,c=1/Math.tan(o.fovX/2),s=1/Math.tan(o.fovY/2),l=1/Math.tan(o.fov/2);return{center:n,distance:Math.max(.5*r*c,.5*i*s,.5*a*l)/L}}async function fe(e,t,n,r,i,o){const c=le(e,t)?t:await d(t,e.spatialReference,{signal:o});a(o);const{center:s,distance:l}=ue(e,c),u=await ne(e,n,r,s,l,i,o);return a(o),je(e,u,e.camera.fov,o)}function me(e,t,n,r,i,a){let o;try{o=le(e,t)?t:h(t,e.spatialReference)}catch(u){return null}const{center:c,distance:s}=ue(e,o),l=te(e,n,r,c,s,i);return null==l?null:Me(e,l,e.camera.fov,a)}function pe(e,t,n){const r=e.renderSpatialReference,i=new p({spatialReference:E(e)});if(!w(n,r,i))return null;const a=Math.tan(t.fovX/2),o=Math.tan(t.fovY/2),c=s(t.eye,n),l=2*c*a*L,u=2*c*o*L;return S(e).toExtent(e,i,l,u)}function de(e,t){return S(e).toArea(e,t)}function he(e,t,n){const r=e.pointsOfInterest.centerOnSurfaceFrequent.distance;if(Math.log(n/r)/Math.LN2>U)return!0;const i=t,a=e.pointsOfInterest.centerOnSurfaceFrequent.renderLocation;return c(i,a)/(Math.tan(.5*e.state.camera.fov)*r)>H}function ge(e,t,n,r,i,a){let o=0;return 1===a&&he(e,r,i)?(t=0,o=ve(e,i,n,r)):o=xe(e,r,i,n),o=e.state.constraints.clampTilt(i,o),{heading:t,tilt:n=we(e,r,i,o)}}const ye=.7;function ve(e,t,n,r){const i=xe(e,r,t,n);if(!e.state.constraints.tilt)return i;const a=e.state.constraints.tilt(t);a.max=Math.min(a.max,.5*Math.PI);const o=a.min*(1-ye)+a.max*ye;return Math.min(i,o)}function Re(e,t,n,r){let i=xe(e,r,t,n);if(!e.state.constraints.tilt)return i;const a=e.state.constraints.tilt(t);return i=Math.min(i,.5*Math.PI),a.min*(1-ye)+i*ye}function we(e,t,n,r){return S(e).lookAtTiltToEyeTilt(r,t,n)}function xe(e,t,n,r){return S(e).eyeTiltToLookAtTilt(r,t,n)}function Me(t,n,r,i){if(null==n)return null;const a=t.renderSpatialReference,o=new p({spatialReference:E(t)});return w(n.eye,a,o)?(i??=new e,i.position=o,i.heading=n.heading,i.tilt=n.tilt,i.fov=r,i):null}async function je(t,n,r,i){const o=t.renderSpatialReference,c=new p({spatialReference:E(t)});return await R(n.eye,o,c,{signal:i}),a(i),new e(c,n.heading,n.tilt,r)}function Te(e,t){const n=e.basemapTerrain?.tilingScheme;if(n)return n.levelAtScale(t);P().error("#scaleToZoom()","Cannot compute zoom from scale without a tiling scheme")}function ze(e,t){const n=e.basemapTerrain?.tilingScheme;if(n)return n.scaleAtLevel(t);P().error("#zoomToScale()","Cannot compute scale from zoom without a tiling scheme")}export{O as applyTiltAdjustToScale,D as distanceToScale,K as fromCenterDistanceAsync,J as fromCenterDistanceSync,B as fromCenterScale,fe as fromExtentAsync,me as fromExtentSync,ne as getObserverForPointAtDistanceAsync,te as getObserverForPointAtDistanceSync,E as getViewSR,F as headingTiltToDirectionUp,X as removeTiltAdjustFromScale,Y as scaleErrorThreshold,G as scaleToDistance,Te as scaleToZoom,de as toArea,pe as toExtent,Z as viewScaleToCameraDistance,ze as zoomToScale};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{create as r}from"../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{C as n,d as t,e as i,j as e,g as c,i as o,n as u}from"../../../chunks/vec32.js";import{create as f}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getNormal as l,signedDistance as s}from"../../../geometry/support/plane.js";function p(r,n,t){return r[0]*n[0]+r[1]*n[1]+r[2]*n[2]+r[3]<t}function a(r,n,t){const i=n[0],e=n[1],c=n[2];return!(r[0][0]*i+r[0][1]*e+r[0][2]*c+r[0][3]>t)&&(!(r[1][0]*i+r[1][1]*e+r[1][2]*c+r[1][3]>t)&&(!(r[2][0]*i+r[2][1]*e+r[2][2]*c+r[2][3]>t)&&(!(r[3][0]*i+r[3][1]*e+r[3][2]*c+r[3][3]>t)&&(!(r[4][0]*i+r[4][1]*e+r[4][2]*c+r[4][3]>t)&&!(r[5][0]*i+r[5][1]*e+r[5][2]*c+r[5][3]>t)))))}function m(r,n,t,i){return h(r,n,null,v(i,n,t,!1))}function d(r,n){for(let t=0;t<6;t++){if(s(r[t],n)>0)return!1}return!0}function g(r,n,t,i){return h(r,n,t,v(i,n,t,!0))}function j(r,n,t,u){const f=c(t,i(r,u,n));return o(r,n,e(r,t,f))}const b={dir:f(),len:0,clip:r()};function v(r,c,o,f){const l=b;return r?(o&&f&&(l.len=n(c,o)),t(l.dir,r)):f?(l.len=n(c,o),i(l.dir,o,c),e(l.dir,l.dir,1/l.len)):(i(l.dir,o,c),u(l.dir,l.dir)),l}function x(r,n,t){const i=c(l(r),t.dir),e=-s(r,n);if(e<0&&i>=0)return!1;if(i>-1e-6&&i<1e-6)return e>0;if((e<0||i<0)&&!(e<0&&i<0))return!0;const o=e/i;return i>0?o<t.clip[1]&&(t.clip[1]=o):o>t.clip[0]&&(t.clip[0]=o),t.clip[0]<=t.clip[1]}function h(r,n,t,i){i.clip[0]=0,i.clip[1]=t?i.len:Number.MAX_VALUE;for(let e=0;e<r.length;e++)if(!x(r[e],n,i))return!1;return!0}export{j as closestPointOnRay,g as frustumLineSegment,d as frustumPoint,m as frustumRay,a as frustumSphere,p as planeSphere};
5
+ import{create as r}from"../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{D as n,d as t,e as i,j as e,g as c,i as o,n as u}from"../../../chunks/vec32.js";import{create as f}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getNormal as l,signedDistance as s}from"../../../geometry/support/plane.js";function p(r,n,t){return r[0]*n[0]+r[1]*n[1]+r[2]*n[2]+r[3]<t}function a(r,n,t){const i=n[0],e=n[1],c=n[2];return!(r[0][0]*i+r[0][1]*e+r[0][2]*c+r[0][3]>t)&&(!(r[1][0]*i+r[1][1]*e+r[1][2]*c+r[1][3]>t)&&(!(r[2][0]*i+r[2][1]*e+r[2][2]*c+r[2][3]>t)&&(!(r[3][0]*i+r[3][1]*e+r[3][2]*c+r[3][3]>t)&&(!(r[4][0]*i+r[4][1]*e+r[4][2]*c+r[4][3]>t)&&!(r[5][0]*i+r[5][1]*e+r[5][2]*c+r[5][3]>t)))))}function m(r,n,t,i){return h(r,n,null,v(i,n,t,!1))}function d(r,n){for(let t=0;t<6;t++){if(s(r[t],n)>0)return!1}return!0}function g(r,n,t,i){return h(r,n,t,v(i,n,t,!0))}function j(r,n,t,u){const f=c(t,i(r,u,n));return o(r,n,e(r,t,f))}const b={dir:f(),len:0,clip:r()};function v(r,c,o,f){const l=b;return r?(o&&f&&(l.len=n(c,o)),t(l.dir,r)):f?(l.len=n(c,o),i(l.dir,o,c),e(l.dir,l.dir,1/l.len)):(i(l.dir,o,c),u(l.dir,l.dir)),l}function x(r,n,t){const i=c(l(r),t.dir),e=-s(r,n);if(e<0&&i>=0)return!1;if(i>-1e-6&&i<1e-6)return e>0;if((e<0||i<0)&&!(e<0&&i<0))return!0;const o=e/i;return i>0?o<t.clip[1]&&(t.clip[1]=o):o>t.clip[0]&&(t.clip[0]=o),t.clip[0]<=t.clip[1]}function h(r,n,t,i){i.clip[0]=0,i.clip[1]=t?i.len:Number.MAX_VALUE;for(let e=0;e<r.length;e++)if(!x(r[e],n,i))return!1;return!0}export{j as closestPointOnRay,g as frustumLineSegment,d as frustumPoint,m as frustumRay,a as frustumSphere,p as planeSphere};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{fromQuat as t,scale as a}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{create as e}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as s}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as i,conjugate as r,multiply as n}from"../../../core/libs/gl-matrix-2/math/quat.js";import{IDENTITY as o,create as h}from"../../../core/libs/gl-matrix-2/factories/quatf64.js";import{h as c,r as d,u as _,v as m,w as u,t as f,i as l,j as g,a as p,x as M,y as b,b as j,c as S,z,A as y}from"../../../chunks/vec32.js";import{ZEROS as x,freeze as C,create as q,UNIT_Z as Q}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{t as v}from"../../../chunks/vec42.js";import{create as A}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{getReferenceEllipsoid as P}from"../../../geometry/ellipsoidUtils.js";import{getSphericalPCPF as w}from"../../../geometry/spatialReferenceEllipsoidUtils.js";import{computeTranslationToOriginAndRotation as R}from"../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{projectBuffer as D}from"../../../geometry/projection/projectBuffer.js";import{getProjector as H}from"../../../geometry/projection/projectors.js";import{getNormal as F}from"../../../geometry/support/plane.js";import{isPlateCarree as B}from"../../../geometry/support/spatialReferenceUtils.js";import{sv3d as W,sq4d as k}from"../../../geometry/support/vectorStacks.js";import{computeOBB as U}from"./dito.js";import{Vertices as Z}from"../webgl-engine/lib/Attribute.js";class G{constructor(t=x,a=lt,e=o){this._data=[t[0],t[1],t[2],a[0],a[1],a[2],e[0],e[1],e[2],e[3]]}clone(){return G.fromData(this._data)}invalidate(){this._data[3]=-1}get isValid(){return this._data[3]>=0}static fromData(t){const a=new G;return a._copyFromData(t),a}static fromJSON(t){return new G(t.center,t.halfSize,t.quaternion)}copy(t){this._copyFromData(t.data)}_copyFromData(t){for(let a=0;a<10;++a)this._data[a]=t[a]}get center(){return c(W.get(),this._data[0],this._data[1],this._data[2])}get centerX(){return this._data[0]}get centerY(){return this._data[1]}get centerZ(){return this._data[2]}getCenter(t){return t[0]=this._data[0],t[1]=this._data[1],t[2]=this._data[2],t}set center(t){this._data[0]=t[0],this._data[1]=t[1],this._data[2]=t[2]}setCenter(t,a,e){this._data[0]=t,this._data[1]=a,this._data[2]=e}get halfSize(){return c(W.get(),this._data[3],this._data[4],this._data[5])}get halfSizeX(){return this._data[3]}get halfSizeY(){return this._data[4]}get halfSizeZ(){return this._data[5]}getHalfSize(t){return t[0]=this._data[3],t[1]=this._data[4],t[2]=this._data[5],t}set halfSize(t){this._data[3]=t[0],this._data[4]=t[1],this._data[5]=t[2]}get quaternion(){return i(k.get(),this._data[6],this._data[7],this._data[8],this._data[9])}getQuaternion(t){return t[0]=this._data[6],t[1]=this._data[7],t[2]=this._data[8],t[3]=this._data[9],t}set quaternion(t){this._data[6]=t[0],this._data[7]=t[1],this._data[8]=t[2],this._data[9]=t[3]}get data(){return this._data}getCorners(t){const a=this._data,e=i(I,a[6],a[7],a[8],a[9]);for(let s=0;s<8;++s){const i=t[s];i[0]=(1&s?-1:1)*a[3],i[1]=(2&s?-1:1)*a[4],i[2]=(4&s?-1:1)*a[5],d(i,i,e),i[0]+=a[0],i[1]+=a[1],i[2]+=a[2]}}doesIntersectFrustumConservativeApproximation(t){return this.intersectPlane(t[0])<=0&&this.intersectPlane(t[1])<=0&&this.intersectPlane(t[2])<=0&&this.intersectPlane(t[3])<=0&&this.intersectPlane(t[4])<=0&&this.intersectPlane(t[5])<=0}get radius(){const t=this._data[3],a=this._data[4],e=this._data[5];return Math.sqrt(t*t+a*a+e*e)}intersectSphere(t){X[0]=this._data[0]-t.center[0],X[1]=this._data[1]-t.center[1],X[2]=this._data[2]-t.center[2];const a=this.getQuaternion(O);return r(I,a),d(X,X,I),_(X,X),Y[0]=Math.min(X[0],this._data[3]),Y[1]=Math.min(X[1],this._data[4]),Y[2]=Math.min(X[2],this._data[5]),m(Y,X)<t.radius*t.radius}intersectSphereWithMBS(t,a=this.radius){const e=this._data;X[0]=e[0]-t.center[0],X[1]=e[1]-t.center[1],X[2]=e[2]-t.center[2];const s=t.radius,i=s+a;return!(u(X)>i*i)&&(I[0]=-e[6],I[1]=-e[7],I[2]=-e[8],I[3]=e[9],d(X,X,I),_(X,X),Y[0]=Math.min(X[0],e[3]),Y[1]=Math.min(X[1],e[4]),Y[2]=Math.min(X[2],e[5]),m(Y,X)<s*s)}intersectPlane(t){const a=t[0]*this._data[0]+t[1]*this._data[1]+t[2]*this._data[2]+t[3],e=this.projectedRadius(F(t));return a>e?1:a<-e?-1:0}intersectRay(t,a,e=0){const s=this._data,i=I;i[0]=-s[6],i[1]=-s[7],i[2]=-s[8],i[3]=s[9],X[0]=t[0]-s[0],X[1]=t[1]-s[1],X[2]=t[2]-s[2];const r=d(X,X,I),n=d(Y,a,I);let o=-1/0,h=1/0;const c=this.getHalfSize(ht);for(let d=0;d<3;d++){const t=r[d],a=n[d],s=c[d]+e;if(Math.abs(a)>1e-6){const e=(s-t)/a,i=(-s-t)/a;o=Math.max(o,Math.min(e,i)),h=Math.min(h,Math.max(e,i))}else if(t>s||t<-s)return!1}return o<=h}projectedArea(e,s,i,n){const o=this.getQuaternion(O);r(I,o),X[0]=e[0]-this._data[0],X[1]=e[1]-this._data[1],X[2]=e[2]-this._data[2],d(X,X,I);const h=this.getHalfSize(ht),_=X[0]<-h[0]?-1:X[0]>h[0]?1:0,m=X[1]<-h[1]?-1:X[1]>h[1]?1:0,u=X[2]<-h[2]?-1:X[2]>h[2]?1:0,g=Math.abs(_)+Math.abs(m)+Math.abs(u);if(0===g)return 1/0;const p=1===g?4:6,M=6*(_+3*m+9*u+13);t(ct,o),a(ct,ct,h);const b=this.getCenter(nt);for(let t=0;t<p;t++){const a=V[M+t];c(X,((1&a)<<1)-1,(2&a)-1,((4&a)>>1)-1),f(X,X,ct),l(E,b,X),E[3]=1,v(E,E,s);const e=1/Math.max(1e-6,E[3]);N[2*t]=E[0]*e,N[2*t+1]=E[1]*e}const j=2*p-2;let S=N[0]*(N[3]-N[j+1])+N[j]*(N[1]-N[j-1]);for(let t=2;t<j;t+=2)S+=N[t]*(N[t+3]-N[t-1]);return Math.abs(S)*i*n*.125}projectedRadius(t){const a=this.getQuaternion(O);return r(I,a),d(X,t,I),Math.abs(X[0]*this._data[3])+Math.abs(X[1]*this._data[4])+Math.abs(X[2]*this._data[5])}minimumDistancePlane(t){return t[0]*this._data[0]+t[1]*this._data[1]+t[2]*this._data[2]+t[3]-this.projectedRadius(F(t))}maximumDistancePlane(t){return t[0]*this._data[0]+t[1]*this._data[1]+t[2]*this._data[2]+t[3]+this.projectedRadius(F(t))}toAaBoundingBox(a){const e=this.getQuaternion(O),s=t(ct,e),i=this._data[3]*Math.abs(s[0])+this._data[4]*Math.abs(s[3])+this._data[5]*Math.abs(s[6]),r=this._data[3]*Math.abs(s[1])+this._data[4]*Math.abs(s[4])+this._data[5]*Math.abs(s[7]),n=this._data[3]*Math.abs(s[2])+this._data[4]*Math.abs(s[5])+this._data[5]*Math.abs(s[8]);a[0]=this._data[0]-i,a[1]=this._data[1]-r,a[2]=this._data[2]-n,a[3]=this._data[0]+i,a[4]=this._data[1]+r,a[5]=this._data[2]+n}transform(t,a,e,s=0,i=w(e),r=w(a),n=H(a,r)){if(e===i)a.isGeographic?et(this,t,a,s,r):at(this,t,a,s,r,n);else if(a.isWGS84&&(e.isWebMercator||B(e)))L(a,this,e,t,s);else if(a.isWebMercator&&B(e))$(a,this,e,t,s);else{const i=this.getCenter(nt);i[2]+=s,D(i,a,0,i,e,0),t.center=i,this!==t&&(t.quaternion=this.getQuaternion(O),t.halfSize=this.getHalfSize(ht))}}}const I=h(),O=h(),T=h(),X=q(),Y=q(),E=A();function J(t,a=new G){return U(t,a),a}const N=[.1,.2,.3,.4,.5,.6,.7,.8,.9,1,1.1,1.2],V=(()=>{const t=new Int8Array(162);let a=0;const e=e=>{for(let s=0;s<e.length;s++)t[a+s]=e[s];a+=6};return e([6,2,3,1,5,4]),e([0,2,3,1,5,4]),e([0,2,3,7,5,4]),e([0,1,3,2,6,4]),e([0,1,3,2,0,0]),e([0,1,5,7,3,2]),e([0,1,3,7,6,4]),e([0,1,3,7,6,2]),e([0,1,5,7,6,2]),e([0,1,5,4,6,2]),e([0,1,5,4,0,0]),e([0,1,3,7,5,4]),e([0,2,6,4,0,0]),e([0,0,0,0,0,0]),e([1,3,7,5,0,0]),e([2,3,7,6,4,0]),e([2,3,7,6,0,0]),e([2,3,1,5,7,6]),e([0,1,5,7,6,2]),e([0,1,5,7,6,4]),e([0,1,3,7,6,4]),e([4,5,7,6,2,0]),e([4,5,7,6,0,0]),e([4,5,1,3,7,6]),e([0,2,3,7,5,4]),e([6,2,3,7,5,4]),e([6,2,3,1,5,4]),t})();function K(t,a,e,s,i){const n=t.getQuaternion(O);i.quaternion=n,r(I,n);const o=t.getCenter(nt),h=t.getHalfSize(ht);if(1===s){d(mt,o,I),_(ut,mt),b(ft,ut,h),p(ft,ut,ft);const s=j(ft);l(ft,ut,h);const r=j(ft);if(s<e)i.center=o,c(mt,e,e,e),i.halfSize=l(mt,h,mt);else{const n=r>0?1+a/r:1,o=s>0?1+e/s:1,c=(o+n)/2,_=(o-n)/2;g(ft,ut,_),i.halfSize=S(ft,ft,h,c),g(ft,ut,c),S(ft,ft,h,_),z(mt,mt),y(mt,ft,mt);const m=t.getQuaternion(T);i.center=d(mt,mt,m)}}else{i.center=S(mt,o,Q,(e+a)/2);const t=d(mt,Q,I);_(t,t),i.halfSize=S(ut,h,t,(e-a)/2)}return i}function L(t,a,e,s,i){a.getCenter(nt),nt[2]+=i;const r=w(e);D(nt,t,0,nt,r,0),tt(r,a,nt,e,s)}function $(t,a,e,s,i){a.getCenter(nt),nt[2]+=i,tt(t,a,nt,e,s)}function tt(a,e,s,i,r){const n=e.getQuaternion(O),o=t(ct,n),h=e.getHalfSize(ht);for(let t=0;t<8;++t){for(let a=0;a<3;++a)rt[a]=h[a]*(t&1<<a?-1:1);for(let a=0;a<3;++a){let e=s[a];for(let t=0;t<3;++t)e+=rt[t]*o[3*t+a];st[3*t+a]=e}}D(st,a,0,st,i,0,8),J(it,r)}function at(t,a,e,s,i=w(e),o=H(e,i)){t.getCorners(_t),t.getCenter(rt),rt[2]+=s,R(e,rt,dt,i),a.setCenter(dt[12],dt[13],dt[14]);const h=2*Math.sqrt(1+dt[0]+dt[5]+dt[10]);I[0]=(dt[6]-dt[9])/h,I[1]=(dt[8]-dt[2])/h,I[2]=(dt[1]-dt[4])/h,I[3]=.25*h;const m=t.getQuaternion(O);a.quaternion=n(I,I,m),r(I,I),c(ut,0,0,0);const u=a.getCenter(ot);for(const r of _t)r[2]+=s,o(r,0,r,0),p(mt,r,u),d(mt,mt,I),_(mt,mt),M(ut,ut,mt);a.halfSize=ut}function et(t,a,e,s,i=w(e)){const n=P(e),o=1+Math.max(0,s)/(n.radius+t.centerZ);t.getCenter(rt),rt[2]+=s,D(rt,e,0,rt,i,0),a.center=rt;const h=t.getQuaternion(O);a.quaternion=h,r(I,h),c(mt,0,0,1),d(mt,mt,I);const _=t.getHalfSize(ht);c(mt,_[0]*Math.abs(mt[0]),_[1]*Math.abs(mt[1]),_[2]*Math.abs(mt[2])),g(mt,mt,n.inverseFlattening),l(mt,_,mt),a.halfSize=g(mt,mt,o)}const st=new Array(24),it=new Z(st,3),rt=q(),nt=q(),ot=q(),ht=q(),ct=e(),dt=s(),_t=[[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0]],mt=q(),ut=q(),ft=q(),lt=C(-1,-1,-1);function gt(t){return Array.from(t)}export{G as Obb,J as compute,K as computeOffsetObb,gt as ensurePackedObbData};
5
+ import{fromQuat as t,scale as e}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{create as a}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as s}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as r,conjugate as i,multiply as n}from"../../../core/libs/gl-matrix-2/math/quat.js";import{IDENTITY as o,create as h}from"../../../core/libs/gl-matrix-2/factories/quatf64.js";import{h as c,r as d,g as f,f as u,u as l,j as m,v as _,w as g,x as p,t as M,i as b,a as j,y as S,z,b as x,c as y,A as C,B as A}from"../../../chunks/vec32.js";import{ZEROS as q,freeze as P,create as Q,UNIT_Z as v}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{t as R}from"../../../chunks/vec42.js";import{create as w}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{getReferenceEllipsoid as D}from"../../../geometry/ellipsoidUtils.js";import{getSphericalPCPF as H}from"../../../geometry/spatialReferenceEllipsoidUtils.js";import{computeTranslationToOriginAndRotation as k}from"../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{projectBuffer as F}from"../../../geometry/projection/projectBuffer.js";import{getProjector as B}from"../../../geometry/projection/projectors.js";import{getNormal as W}from"../../../geometry/support/plane.js";import{isPlateCarree as U}from"../../../geometry/support/spatialReferenceUtils.js";import{sv3d as Z,sq4d as G}from"../../../geometry/support/vectorStacks.js";import{computeOBB as I}from"./dito.js";import{Vertices as O}from"../webgl-engine/lib/Attribute.js";class T{constructor(t=q,e=bt,a=o){this._data=[t[0],t[1],t[2],e[0],e[1],e[2],a[0],a[1],a[2],a[3]]}clone(){return T.fromData(this._data)}invalidate(){this._data[3]=-1}get isValid(){return this._data[3]>=0}static fromData(t){const e=new T;return e._copyFromData(t),e}static fromJSON(t){return new T(t.center,t.halfSize,t.quaternion)}copy(t){this._copyFromData(t.data)}_copyFromData(t){for(let e=0;e<10;++e)this._data[e]=t[e]}get center(){return c(Z.get(),this._data[0],this._data[1],this._data[2])}get centerX(){return this._data[0]}get centerY(){return this._data[1]}get centerZ(){return this._data[2]}getCenter(t){return t[0]=this._data[0],t[1]=this._data[1],t[2]=this._data[2],t}set center(t){this._data[0]=t[0],this._data[1]=t[1],this._data[2]=t[2]}setCenter(t,e,a){this._data[0]=t,this._data[1]=e,this._data[2]=a}get halfSize(){return c(Z.get(),this._data[3],this._data[4],this._data[5])}get halfSizeX(){return this._data[3]}get halfSizeY(){return this._data[4]}get halfSizeZ(){return this._data[5]}getHalfSize(t){return t[0]=this._data[3],t[1]=this._data[4],t[2]=this._data[5],t}set halfSize(t){this._data[3]=t[0],this._data[4]=t[1],this._data[5]=t[2]}get quaternion(){return r(G.get(),this._data[6],this._data[7],this._data[8],this._data[9])}getQuaternion(t){return t[0]=this._data[6],t[1]=this._data[7],t[2]=this._data[8],t[3]=this._data[9],t}set quaternion(t){this._data[6]=t[0],this._data[7]=t[1],this._data[8]=t[2],this._data[9]=t[3]}get data(){return this._data}getCorners(t){const e=this._data,a=r(X,e[6],e[7],e[8],e[9]);for(let s=0;s<8;++s){const r=t[s];r[0]=(1&s?-1:1)*e[3],r[1]=(2&s?-1:1)*e[4],r[2]=(4&s?-1:1)*e[5],d(r,r,a),r[0]+=e[0],r[1]+=e[1],r[2]+=e[2]}return t}getAxes(t){const e=this._data,a=r(X,e[6],e[7],e[8],e[9]);return d(t[0],[1,0,0],a),d(t[1],[0,1,0],a),d(t[2],[0,0,1],a),t}intersectsFrustum(t){const e=this.center,a=t.planes;for(const d of a){const t=W(d),a=this.projectedRadius(t);if(f(t,e)+d[3]-a>0)return!1}const s=this.getAxes(_t),r=t.points,i=this.halfSize;for(let d=0;d<3;++d){const t=s[d],a=-f(t,e),n=i[d];let o=!0,h=!0;for(const e of r){const s=f(e,t)+a;o&&=s>n,h&&=s<-n}if(o||h)return!1}if(this.getCorners(mt).some(e=>t.intersectsPoint(e)))return!0;const n=zt;for(let d=0;d<3;++d){const t=s[d];n[d]=f(t,e)}const o=t=>{for(let e=0;e<3;++e){const a=s[e],r=i[e],o=f(a,t)-n[e];if(o>r||o<-r)return!1}return!0};if(t.points.some(t=>o(t)))return!0;const h=t.lines,c=St;for(let d=0;d<8;++d){const t=h[d].direction;for(const a of s){u(c,t,a);const s=l(c);if(!(s>0))continue;m(c,c,1/s);const i=this.projectedRadius(c),n=f(e,c),o=n-i,h=n+i;let d=!1,_=!1,g=!0;for(const t of r){const e=f(c,t);if(e>h){if(_){g=!1;break}d=!0}else{if(!(e<o)){g=!1;break}if(d){g=!1;break}_=!0}}if(g)return!1}}return!0}doesIntersectFrustumConservativeApproximation(t){return this.intersectPlane(t[0])<=0&&this.intersectPlane(t[1])<=0&&this.intersectPlane(t[2])<=0&&this.intersectPlane(t[3])<=0&&this.intersectPlane(t[4])<=0&&this.intersectPlane(t[5])<=0}get radius(){const t=this._data[3],e=this._data[4],a=this._data[5];return Math.sqrt(t*t+e*e+a*a)}intersectsPoint(t){const e=this.getAxes(_t),a=this.halfSize,{center:s}=this;for(let r=0;r<3;++r){const i=e[r],n=a[r],o=f(i,t)-f(i,s);if(o>n||o<-n)return!1}return!0}intersectSphere(t){const{center:e}=t,a=this._data;J[0]=a[0]-e[0],J[1]=a[1]-e[1],J[2]=a[2]-e[2];const s=this.getQuaternion(Y);return i(X,s),d(J,J,X),_(J,J),N[0]=Math.min(J[0],a[3]),N[1]=Math.min(J[1],a[4]),N[2]=Math.min(J[2],a[5]),g(N,J)<t.radius*t.radius}intersectSphereWithMBS(t,e=this.radius){const a=this._data,{center:s}=t;J[0]=a[0]-s[0],J[1]=a[1]-s[1],J[2]=a[2]-s[2];const r=t.radius,i=r+e;return!(p(J)>i*i)&&(X[0]=-a[6],X[1]=-a[7],X[2]=-a[8],X[3]=a[9],d(J,J,X),_(J,J),N[0]=Math.min(J[0],a[3]),N[1]=Math.min(J[1],a[4]),N[2]=Math.min(J[2],a[5]),g(N,J)<r*r)}intersectPlane(t){const e=t[0]*this._data[0]+t[1]*this._data[1]+t[2]*this._data[2]+t[3],a=this.projectedRadius(W(t));return e>a?1:e<-a?-1:0}intersectRay(t,e,a=0){const s=this._data,r=X;r[0]=-s[6],r[1]=-s[7],r[2]=-s[8],r[3]=s[9],J[0]=t[0]-s[0],J[1]=t[1]-s[1],J[2]=t[2]-s[2];const i=d(J,J,X),n=d(N,e,X);let o=-1/0,h=1/0;const c=this.getHalfSize(ft);for(let d=0;d<3;d++){const t=i[d],e=n[d],s=c[d]+a;if(Math.abs(e)>1e-6){const a=(s-t)/e,r=(-s-t)/e;o=Math.max(o,Math.min(a,r)),h=Math.min(h,Math.max(a,r))}else if(t>s||t<-s)return!1}return o<=h}projectedArea(a,s,r,n){const o=this.getQuaternion(Y);i(X,o),J[0]=a[0]-this._data[0],J[1]=a[1]-this._data[1],J[2]=a[2]-this._data[2],d(J,J,X);const h=this.getHalfSize(ft),f=J[0]<-h[0]?-1:J[0]>h[0]?1:0,u=J[1]<-h[1]?-1:J[1]>h[1]?1:0,l=J[2]<-h[2]?-1:J[2]>h[2]?1:0,m=Math.abs(f)+Math.abs(u)+Math.abs(l);if(0===m)return 1/0;const _=1===m?4:6,g=6*(f+3*u+9*l+13);t(ut,o),e(ut,ut,h);const p=this.getCenter(ct);for(let t=0;t<_;t++){const e=$[g+t];c(J,((1&e)<<1)-1,(2&e)-1,((4&e)>>1)-1),M(J,J,ut),b(V,p,J),V[3]=1,R(V,V,s);const a=1/Math.max(1e-6,V[3]);L[2*t]=V[0]*a,L[2*t+1]=V[1]*a}const j=2*_-2;let S=L[0]*(L[3]-L[j+1])+L[j]*(L[1]-L[j-1]);for(let t=2;t<j;t+=2)S+=L[t]*(L[t+3]-L[t-1]);return Math.abs(S)*r*n*.125}projectedRadius(t){const e=this.getQuaternion(Y);return i(X,e),d(J,t,X),Math.abs(J[0]*this._data[3])+Math.abs(J[1]*this._data[4])+Math.abs(J[2]*this._data[5])}minimumDistancePlane(t){return t[0]*this._data[0]+t[1]*this._data[1]+t[2]*this._data[2]+t[3]-this.projectedRadius(W(t))}maximumDistancePlane(t){return t[0]*this._data[0]+t[1]*this._data[1]+t[2]*this._data[2]+t[3]+this.projectedRadius(W(t))}toAaBoundingBox(e){const a=this.getQuaternion(Y),s=t(ut,a),r=this._data[3]*Math.abs(s[0])+this._data[4]*Math.abs(s[3])+this._data[5]*Math.abs(s[6]),i=this._data[3]*Math.abs(s[1])+this._data[4]*Math.abs(s[4])+this._data[5]*Math.abs(s[7]),n=this._data[3]*Math.abs(s[2])+this._data[4]*Math.abs(s[5])+this._data[5]*Math.abs(s[8]);e[0]=this._data[0]-r,e[1]=this._data[1]-i,e[2]=this._data[2]-n,e[3]=this._data[0]+r,e[4]=this._data[1]+i,e[5]=this._data[2]+n}transform(t,e,a,s=0,r=H(a),i=H(e),n=B(e,i)){if(a===r)e.isGeographic?it(this,t,e,s,i):rt(this,t,e,s,i,n);else if(e.isWGS84&&(a.isWebMercator||U(a)))et(e,this,a,t,s);else if(e.isWebMercator&&U(a))at(e,this,a,t,s);else{const r=this.getCenter(ct);r[2]+=s,F(r,e,0,r,a,0),t.center=r,this!==t&&(t.quaternion=this.getQuaternion(Y),t.halfSize=this.getHalfSize(ft))}}}const X=h(),Y=h(),E=h(),J=Q(),N=Q(),V=w();function K(t,e=new T){return I(t,e),e}const L=[.1,.2,.3,.4,.5,.6,.7,.8,.9,1,1.1,1.2],$=(()=>{const t=new Int8Array(162);let e=0;const a=a=>{for(let s=0;s<a.length;s++)t[e+s]=a[s];e+=6};return a([6,2,3,1,5,4]),a([0,2,3,1,5,4]),a([0,2,3,7,5,4]),a([0,1,3,2,6,4]),a([0,1,3,2,0,0]),a([0,1,5,7,3,2]),a([0,1,3,7,6,4]),a([0,1,3,7,6,2]),a([0,1,5,7,6,2]),a([0,1,5,4,6,2]),a([0,1,5,4,0,0]),a([0,1,3,7,5,4]),a([0,2,6,4,0,0]),a([0,0,0,0,0,0]),a([1,3,7,5,0,0]),a([2,3,7,6,4,0]),a([2,3,7,6,0,0]),a([2,3,1,5,7,6]),a([0,1,5,7,6,2]),a([0,1,5,7,6,4]),a([0,1,3,7,6,4]),a([4,5,7,6,2,0]),a([4,5,7,6,0,0]),a([4,5,1,3,7,6]),a([0,2,3,7,5,4]),a([6,2,3,7,5,4]),a([6,2,3,1,5,4]),t})();function tt(t,e,a,s,r){const n=t.getQuaternion(Y);r.quaternion=n,i(X,n);const o=t.getCenter(ct),h=t.getHalfSize(ft);if(1===s){d(gt,o,X),_(pt,gt),z(Mt,pt,h),j(Mt,pt,Mt);const s=x(Mt);b(Mt,pt,h);const i=x(Mt);if(s<a)r.center=o,c(gt,a,a,a),r.halfSize=b(gt,h,gt);else{const n=i>0?1+e/i:1,o=s>0?1+a/s:1,c=(o+n)/2,f=(o-n)/2;m(Mt,pt,f),r.halfSize=y(Mt,Mt,h,c),m(Mt,pt,c),y(Mt,Mt,h,f),C(gt,gt),A(gt,Mt,gt);const u=t.getQuaternion(E);r.center=d(gt,gt,u)}}else{r.center=y(gt,o,v,(a+e)/2);const t=d(gt,v,X);_(t,t),r.halfSize=y(pt,h,t,(a-e)/2)}return r}function et(t,e,a,s,r){e.getCenter(ct),ct[2]+=r;const i=H(a);F(ct,t,0,ct,i,0),st(i,e,ct,a,s)}function at(t,e,a,s,r){e.getCenter(ct),ct[2]+=r,st(t,e,ct,a,s)}function st(e,a,s,r,i){const n=a.getQuaternion(Y),o=t(ut,n),h=a.getHalfSize(ft);for(let t=0;t<8;++t){for(let e=0;e<3;++e)ht[e]=h[e]*(t&1<<e?-1:1);for(let e=0;e<3;++e){let a=s[e];for(let t=0;t<3;++t)a+=ht[t]*o[3*t+e];nt[3*t+e]=a}}F(nt,e,0,nt,r,0,8),K(ot,i)}function rt(t,e,a,s,r=H(a),o=B(a,r)){t.getCorners(mt),t.getCenter(ht),ht[2]+=s,k(a,ht,lt,r),e.setCenter(lt[12],lt[13],lt[14]);const h=2*Math.sqrt(1+lt[0]+lt[5]+lt[10]);X[0]=(lt[6]-lt[9])/h,X[1]=(lt[8]-lt[2])/h,X[2]=(lt[1]-lt[4])/h,X[3]=.25*h;const f=t.getQuaternion(Y);e.quaternion=n(X,X,f),i(X,X),c(pt,0,0,0);const u=e.getCenter(dt);for(const i of mt)i[2]+=s,o(i,0,i,0),j(gt,i,u),d(gt,gt,X),_(gt,gt),S(pt,pt,gt);e.halfSize=pt}function it(t,e,a,s,r=H(a)){const n=D(a),o=1+Math.max(0,s)/(n.radius+t.centerZ);t.getCenter(ht),ht[2]+=s,F(ht,a,0,ht,r,0),e.center=ht;const h=t.getQuaternion(Y);e.quaternion=h,i(X,h),c(gt,0,0,1),d(gt,gt,X);const f=t.getHalfSize(ft);c(gt,f[0]*Math.abs(gt[0]),f[1]*Math.abs(gt[1]),f[2]*Math.abs(gt[2])),m(gt,gt,n.inverseFlattening),b(gt,f,gt),e.halfSize=m(gt,gt,o)}const nt=new Array(24),ot=new O(nt,3),ht=Q(),ct=Q(),dt=Q(),ft=Q(),ut=a(),lt=s(),mt=[[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0]],_t=[Q(),Q(),Q()],gt=Q(),pt=Q(),Mt=Q(),bt=P(-1,-1,-1);function jt(t){return Array.from(t)}const St=Q(),zt=[0,0,0];export{T as Obb,K as compute,tt as computeOffsetObb,jt as ensurePackedObbData};