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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (303) hide show
  1. package/assets/esri/core/workers/RemoteClient.js +1 -1
  2. package/assets/esri/core/workers/chunks/063045ac5553e91c0c4c.js +1 -0
  3. package/assets/esri/core/workers/chunks/{20ad34f9d45c64392022.js → 08c1ea29678da27136f3.js} +1 -1
  4. package/assets/esri/core/workers/chunks/{5dc2f2e28c30386efadf.js → 10094eb2b94e98dd4a8a.js} +1 -1
  5. package/assets/esri/core/workers/chunks/169be08394c5e7703628.js +1 -0
  6. package/assets/esri/core/workers/chunks/1a6f3531ef3d671e0289.js +1 -0
  7. package/assets/esri/core/workers/chunks/{b809d499ff050976d9ed.js → 1c58064ea80e6a4a4a3b.js} +1 -1
  8. package/assets/esri/core/workers/chunks/1c816aff8613d1e4bf38.js +1 -0
  9. package/assets/esri/core/workers/chunks/{ee67c8a7c1f8b482cd99.js → 1ced78750c61600b2d4e.js} +1 -1
  10. package/assets/esri/core/workers/chunks/{98175b454e807b1a3c5f.js → 1e152a34e368bd810a0f.js} +1 -1
  11. package/assets/esri/core/workers/chunks/1e17ad6cdffa5016a3db.js +1 -0
  12. package/assets/esri/core/workers/chunks/1e2d42e9984ed3437ba2.js +1 -0
  13. package/assets/esri/core/workers/chunks/2008b22f76071a2dde4e.js +1 -0
  14. package/assets/esri/core/workers/chunks/2107c93d1fe87f3b8dfa.js +1 -0
  15. package/assets/esri/core/workers/chunks/2209550b6510e25da375.js +1 -0
  16. package/assets/esri/core/workers/chunks/229e1ed4282005aa0b83.js +1 -0
  17. package/assets/esri/core/workers/chunks/22b8eaa6afab0e5ffc47.js +1 -0
  18. package/assets/esri/core/workers/chunks/{1c0fb4795a52204882a8.js → 2550d2ba935cfdf30236.js} +1 -1
  19. package/assets/esri/core/workers/chunks/{49e6219dd08cb6c27023.js → 273ac1066095d63d6a6f.js} +1 -1
  20. package/assets/esri/core/workers/chunks/2e2867bc66c94aba7dc7.js +1 -0
  21. package/assets/esri/core/workers/chunks/{cda5c95fd49b8901f7d4.js → 3298e96d3f2e49e338d2.js} +1 -1
  22. package/assets/esri/core/workers/chunks/34613b288cf174983f8b.js +1 -0
  23. package/assets/esri/core/workers/chunks/{e5baa30944061418cb13.js → 35f086a2ae0585348ae6.js} +1 -1
  24. package/assets/esri/core/workers/chunks/{f441fc74451330384fb0.js → 37ea150dec5e491f691e.js} +1 -1
  25. package/assets/esri/core/workers/chunks/3c94db7ecdcd38eeb1b1.js +1 -0
  26. package/assets/esri/core/workers/chunks/3f7749f06ae54a4437d9.js +1 -0
  27. package/assets/esri/core/workers/chunks/40a722933af28823953b.js +1 -0
  28. package/assets/esri/core/workers/chunks/{7aa730e5ac7b268e3c98.js → 424daef7b5dec1b99aba.js} +1 -1
  29. package/assets/esri/core/workers/chunks/456684b1c1417ed0e611.js +1 -0
  30. package/assets/esri/core/workers/chunks/{d14e75b160aa432233c6.js → 461093ce28ceadd7853d.js} +1 -1
  31. package/assets/esri/core/workers/chunks/4a48b8ec5f3f2fd139b5.js +1 -0
  32. package/assets/esri/core/workers/chunks/4b084f985bc4100e7aec.js +1 -0
  33. package/assets/esri/core/workers/chunks/4b1de1fcd13677b615a8.js +1 -0
  34. package/assets/esri/core/workers/chunks/{31186e83fe009aa0fd36.js → 4d933de84afb2e3b7d18.js} +1 -1
  35. package/assets/esri/core/workers/chunks/{83aa39fbb1fad3b9d143.js → 4ff771942531fb2755c4.js} +1 -1
  36. package/assets/esri/core/workers/chunks/{e0017c6739d2532793e6.js → 513a4ef960e27500f986.js} +1 -1
  37. package/assets/esri/core/workers/chunks/56b693baa376bb990925.js +1 -0
  38. package/assets/esri/core/workers/chunks/{1d4ea8db272655c0608c.js → 57fd5e1260269002d18a.js} +1 -1
  39. package/assets/esri/core/workers/chunks/5fe40bb0e9ab333f6854.js +1 -0
  40. package/assets/esri/core/workers/chunks/{b56c07c0b43cb1999070.js → 60362c5651ef41fa7e5f.js} +1 -1
  41. package/assets/esri/core/workers/chunks/{e8a9971c8354569cb81d.js → 609919428305d8c8c243.js} +1 -1
  42. package/assets/esri/core/workers/chunks/{ab88577987cf2fe1cb32.js → 61373d2fa7e7638d3395.js} +1 -1
  43. package/assets/esri/core/workers/chunks/6202922b1c2637e9aaa5.js +1 -0
  44. package/assets/esri/core/workers/chunks/633368ae6fbb46373328.js +1 -0
  45. package/assets/esri/core/workers/chunks/6d702cb26cef46a76963.js +1 -0
  46. package/assets/esri/core/workers/chunks/{35272810c2ed04eb403d.js → 6f3943bebe2d5f4994f7.js} +1 -1
  47. package/assets/esri/core/workers/chunks/708aba69a1870ea41a61.js +1 -0
  48. package/assets/esri/core/workers/chunks/{7ba13b52fce1060fbb2a.js → 7147fc7502b385b302b2.js} +1 -1
  49. package/assets/esri/core/workers/chunks/{9ba8a2e1c0fb4e1efc7c.js → 7364fb5e99933533890d.js} +1 -1
  50. package/assets/esri/core/workers/chunks/74b1028e95f7cfff387b.js +1 -0
  51. package/assets/esri/core/workers/chunks/78fccea3445fb2f9120a.js +1 -0
  52. package/assets/esri/core/workers/chunks/7ba31425caa404f86424.js +1 -0
  53. package/assets/esri/core/workers/chunks/{040f3d8e1099c4843390.js → 81a60dfa600b690098f9.js} +1 -1
  54. package/assets/esri/core/workers/chunks/833fd2bc42c5cb459084.js +1 -0
  55. package/assets/esri/core/workers/chunks/{75643711d9585ee26a15.js → 83c8e5a92d8d6193cb32.js} +1 -1
  56. package/assets/esri/core/workers/chunks/{e537e1d37f3fcb14fce2.js → 870022661376442411e4.js} +1 -1
  57. package/assets/esri/core/workers/chunks/898ab7db220e81e921c6.js +1 -0
  58. package/assets/esri/core/workers/chunks/{31b074ae2162a3508d2a.js → 8b578ffc3a83089aa782.js} +1 -1
  59. package/assets/esri/core/workers/chunks/{48c8ef4170e803a564d6.js → 8b75861196d1ce5cba63.js} +1 -1
  60. package/assets/esri/core/workers/chunks/8be61e13530fd0dc2fd1.js +1 -0
  61. package/assets/esri/core/workers/chunks/90b8ccee883738917a6d.js +1 -0
  62. package/assets/esri/core/workers/chunks/90bc9c299ae0e8b8b5e5.js +1 -0
  63. package/assets/esri/core/workers/chunks/91d9ade78854f40a962d.js +1 -0
  64. package/assets/esri/core/workers/chunks/{74881340e040bfd0580f.js → 934bc1028b287f8df4aa.js} +1 -1
  65. package/assets/esri/core/workers/chunks/96055de47831e59a28bf.js +1 -0
  66. package/assets/esri/core/workers/chunks/963ba863e0f87abfca25.js +1 -0
  67. package/assets/esri/core/workers/chunks/9aa8d60483ad905fe13b.js +1 -0
  68. package/assets/esri/core/workers/chunks/9fed9946241bb2a5cfa4.js +1 -0
  69. package/assets/esri/core/workers/chunks/a2662e98857f0abf8e82.js +1 -0
  70. package/assets/esri/core/workers/chunks/a5a9b0a35849b9f2e86d.js +1 -0
  71. package/assets/esri/core/workers/chunks/a60006c9ccf6817fc0d2.js +1 -0
  72. package/assets/esri/core/workers/chunks/a627b7eb94b7fca33210.js +1 -0
  73. package/assets/esri/core/workers/chunks/a651dc3b8f1fc1ab34cc.js +1 -0
  74. package/assets/esri/core/workers/chunks/aab93e885b6c7c6aa76e.js +316 -0
  75. package/assets/esri/core/workers/chunks/adfe28c1c1619cdd3ca1.js +1019 -0
  76. package/assets/esri/core/workers/chunks/b88dc7d8ae105747e6a4.js +1 -0
  77. package/assets/esri/core/workers/chunks/b90c786dd474ea1a409c.js +1 -0
  78. package/assets/esri/core/workers/chunks/b92e9e5df8154a128982.js +1 -0
  79. package/assets/esri/core/workers/chunks/{9a855a10798348a21bab.js → bff814d34b38ec80c44d.js} +1 -1
  80. package/assets/esri/core/workers/chunks/c36d699a75b6e8fb93eb.js +1 -0
  81. package/assets/esri/core/workers/chunks/c50fdf723f2d4316862e.js +1 -0
  82. package/assets/esri/core/workers/chunks/{9461cc37ab3397265270.js → c5e8ff4721b15ac3c6eb.js} +1 -1
  83. package/assets/esri/core/workers/chunks/{4cda42b94e9cb58dd372.js → ca61077e0a598654f33f.js} +1 -1
  84. package/assets/esri/core/workers/chunks/{61a9ffd4cf07d8bb7a9b.js → ca81be5bdb88ef557bf3.js} +1 -1
  85. package/assets/esri/core/workers/chunks/{ca1c65eb7f5900c60170.js → cd8fec3500e6503ae020.js} +1 -1
  86. package/assets/esri/core/workers/chunks/ce90e8489143228262e7.js +1 -0
  87. package/assets/esri/core/workers/chunks/d0320ca67abca4f8b0d2.js +1 -0
  88. package/assets/esri/core/workers/chunks/{4b6a44c6265c8959abd8.js → d3db7244fac7398cc700.js} +1 -1
  89. package/assets/esri/core/workers/chunks/{19820cddba13a3585c0b.js → d561624ddb9388732b25.js} +1 -1
  90. package/assets/esri/core/workers/chunks/d65ca3b8fccae8c3c3fa.js +1 -0
  91. package/assets/esri/core/workers/chunks/{630eba99f48ea79a9560.js → d705410c369bd03b1875.js} +1 -1
  92. package/assets/esri/core/workers/chunks/{9c7682b300b877f60095.js → d76513a6260d9ec4ea25.js} +1 -1
  93. package/assets/esri/core/workers/chunks/{7c08c0824ad354177787.js → d7878fba02814adaf19f.js} +1 -1
  94. package/assets/esri/core/workers/chunks/d82e17522ed946c2d809.js +1 -0
  95. package/assets/esri/core/workers/chunks/d8dc130ea559be1f68c6.js +1 -0
  96. package/assets/esri/core/workers/chunks/{768ae52b4e5c3e571ef5.js → dc29cb16704e2e4d0a46.js} +1 -1
  97. package/assets/esri/core/workers/chunks/e8c2e2fbe9cef4c8a8c6.js +1 -0
  98. package/assets/esri/core/workers/chunks/{3f33708eb39c7169a226.js → f2ba50eb29f93df885d6.js} +1 -1
  99. package/assets/esri/core/workers/chunks/{6e5d41f51572e3e7cf92.js → f7163048146ddaedfc36.js} +1 -1
  100. package/assets/esri/core/workers/chunks/fdaa10a588db394e2f65.js +1 -0
  101. package/chunks/GaussianSplat.glsl.js +2 -2
  102. package/chunks/Laserlines.glsl.js +1 -1
  103. package/chunks/boundedPlane.js +1 -1
  104. package/chunks/cameraUtilsSpherical.js +1 -1
  105. package/chunks/vec32.js +1 -1
  106. package/config.js +1 -1
  107. package/core/libs/gl-matrix-2/math/quat.js +1 -1
  108. package/core/libs/gl-matrix-2/math/vec3.js +1 -1
  109. package/core/urlUtils.d.ts +1 -0
  110. package/core/workers/workerFactory.js +1 -1
  111. package/geometry/FlatGeometry.js +1 -1
  112. package/geometry/operators/support/apiConverter.js +1 -1
  113. package/geometry/operators/support/jsonConverter.js +1 -1
  114. package/geometry/support/curves/circleUtils.js +1 -1
  115. package/geometry/support/lineSegment.js +1 -1
  116. package/geometry/support/meshUtils/loadGLTFMesh.js +1 -1
  117. package/geometry/support/meshUtils/merge.js +1 -1
  118. package/geometry/support/sphere.js +1 -1
  119. package/interfaces.d.ts +148 -21
  120. package/kernel.js +1 -1
  121. package/layers/VoxelWasmPerSceneView.js +1 -1
  122. package/layers/orientedImagery/transformations/worldToImage.js +1 -1
  123. package/layers/support/tiles3DUtils.js +1 -1
  124. package/layers/voxel/VoxelVolume.js +1 -1
  125. package/package.json +2 -2
  126. package/rest/print.js +1 -1
  127. package/rest/support/LegendLayer.js +1 -1
  128. package/support/revision.js +1 -1
  129. package/symbols/cim/effects/EffectSuppress.js +1 -1
  130. package/views/2d/interactive/SegmentLabels2D.js +1 -1
  131. package/views/3d/analysis/AreaMeasurement/support/MeasurementData.js +1 -1
  132. package/views/3d/analysis/Dimension/lengthDimensionConstraintUtils.js +1 -1
  133. package/views/3d/analysis/Dimension/lengthDimensionUtils.js +1 -1
  134. package/views/3d/analysis/LineOfSight/LineOfSightController.js +1 -1
  135. package/views/3d/analysis/LineOfSight/LineOfSightIntersectionResult.js +1 -1
  136. package/views/3d/analysis/ShadowCastAnalysisView3D.js +1 -1
  137. package/views/3d/analysis/Slice/sliceToolUtils.js +1 -1
  138. package/views/3d/analysis/Viewshed/ViewshedScaleOrientManipulation.js +1 -1
  139. package/views/3d/analysis/Viewshed/ViewshedSubTool.js +1 -1
  140. package/views/3d/analysis/Viewshed/ViewshedSubVisualization.js +1 -1
  141. package/views/3d/analysis/Viewshed/ViewshedTool.js +1 -1
  142. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillController.js +1 -1
  143. package/views/3d/animation/pointToPoint/Camera.js +1 -1
  144. package/views/3d/camera/constraintUtils/distance.js +1 -1
  145. package/views/3d/camera/constraintUtils/tilt.js +1 -1
  146. package/views/3d/environment/ChapmanAtmosphere.js +1 -1
  147. package/views/3d/environment/CloudsParameters.js +1 -1
  148. package/views/3d/environment/EnvironmentManager.js +1 -1
  149. package/views/3d/environment/MarsAtmosphere.js +1 -1
  150. package/views/3d/glTF/internal/Resource.js +1 -1
  151. package/views/3d/glTF/loader.js +1 -1
  152. package/views/3d/interactive/SegmentLabels3D.js +1 -1
  153. package/views/3d/interactive/editingTools/manipulations/MoveZManipulation.js +1 -1
  154. package/views/3d/interactive/editingTools/media/MediaElementManipulator3D.js +1 -1
  155. package/views/3d/interactive/editingTools/reshape/edgeOffsetUtils.js +1 -1
  156. package/views/3d/interactive/visualElements/MeasurementArrowVisualElement.js +1 -1
  157. package/views/3d/interactive/visualElements/RightAngleQuadVisualElement.js +1 -1
  158. package/views/3d/layers/I3SMeshView3D.js +1 -1
  159. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  160. package/views/3d/layers/graphics/Graphics3DFrustumVisibility.js +1 -1
  161. package/views/3d/layers/graphics/Graphics3DObjectSymbolLayer.js +1 -1
  162. package/views/3d/layers/graphics/ObjectResourceCache.js +1 -1
  163. package/views/3d/layers/graphics/objectResourceUtils.js +1 -1
  164. package/views/3d/layers/graphics/pipeline/rendering/DirectRenderer.js +1 -1
  165. package/views/3d/layers/graphics/pipeline/rendering/RenderCommandContext.js +1 -1
  166. package/views/3d/layers/graphics/pipeline/symbolization/IconSymbolLayerRenderer.js +1 -1
  167. package/views/3d/layers/i3s/I3SMaterialUtil.js +1 -1
  168. package/views/3d/layers/i3s/I3SViewportQueries.js +1 -1
  169. package/views/3d/layers/i3s/PointCloudRenderer.js +1 -1
  170. package/views/3d/layers/support/FeatureTileMeasurements3D.js +1 -1
  171. package/views/3d/layers/support/FeatureTileVisibility3D.js +1 -1
  172. package/views/3d/state/Frustum.js +1 -1
  173. package/views/3d/state/controllers/FovController.js +1 -1
  174. package/views/3d/state/controllers/GamepadKeyboardController.js +1 -1
  175. package/views/3d/state/controllers/momentum/ZoomPlanarMomentumController.js +1 -1
  176. package/views/3d/support/FrustumExtentIntersection.js +1 -1
  177. package/views/3d/support/cameraUtils.js +1 -1
  178. package/views/3d/support/intersectionUtils.js +1 -1
  179. package/views/3d/support/orientedBoundingBox.js +1 -1
  180. package/views/3d/support/pointsOfInterest/CameraOnSurface.js +1 -1
  181. package/views/3d/support/pointsOfInterest/CenterOnSurface.js +1 -1
  182. package/views/3d/support/pointsOfInterest/Focus.js +1 -1
  183. package/views/3d/support/viewpointUtils.js +1 -1
  184. package/views/3d/terrain/OverlayManager.js +1 -1
  185. package/views/3d/terrain/PatchRenderData.js +1 -1
  186. package/views/3d/terrain/SphericalPatch.js +1 -1
  187. package/views/3d/terrain/Tile.js +1 -1
  188. package/views/3d/webgl/RenderCamera.js +1 -1
  189. package/views/3d/webgl-engine/core/FBOCache.js +1 -1
  190. package/views/3d/webgl-engine/effects/haze/Haze.js +1 -1
  191. package/views/3d/webgl-engine/lib/GaussianSplatRenderNode.js +1 -1
  192. package/views/3d/webgl-engine/lib/Object3D.js +1 -1
  193. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  194. package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
  195. package/views/3d/webgl-engine/lib/Viewshed.js +1 -1
  196. package/views/3d/webgl-engine/lib/edgeRendering/edgePreprocessing.js +1 -1
  197. package/views/3d/webgl-engine/lib/geometryDataUtils.js +1 -1
  198. package/views/3d/webgl-engine/lib/triangleIntersectionUtils.js +1 -1
  199. package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
  200. package/views/3d/webgl-engine/materials/HeatmapDensityMaterial.js +1 -1
  201. package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
  202. package/views/3d/webgl-engine/materials/MeasurementArrowMaterial.js +1 -1
  203. package/views/3d/webgl-engine/materials/NativeLineMaterial.js +1 -1
  204. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  205. package/views/3d/webgl-engine/materials/pbrUtils.js +1 -1
  206. package/views/3d/webgl-engine/materials/renderers/MergedBuffer.js +1 -1
  207. package/views/3d/webgl-engine/materials/renderers/PerBufferData.js +1 -1
  208. package/views/3d/webgl-engine/materials/renderers/PerOriginData.js +1 -1
  209. package/views/3d/webgl-engine/materials/renderers/VaoWriter.js +1 -1
  210. package/views/3d/webgl-engine/shaders/GaussianSplatColorTechnique.js +5 -0
  211. package/views/3d/webgl-engine/shaders/GaussianSplatDepthTechnique.js +5 -0
  212. package/views/3d/webgl-engine/shaders/GaussianSplatTechniqueConfiguration.js +1 -1
  213. package/views/3d/webgl-engine/shaders/SphereDepthInterpolate.glsl.js +1 -1
  214. package/views/draw/support/Reshape.js +1 -1
  215. package/views/interactive/GraphicManipulator.js +1 -1
  216. package/views/interactive/coordinateHelper.js +1 -1
  217. package/views/interactive/editGeometry/operations/OffsetEdgeVertex.js +1 -1
  218. package/views/interactive/sketch/constraints.js +1 -1
  219. package/views/interactive/snapping/featureSources/sceneLayerSource/SceneLayerSnappingSourceWorker.js +1 -1
  220. package/views/interactive/snapping/featureSources/sceneLayerSource/sceneLayerSnappingUtils.js +1 -1
  221. package/views/interactive/snapping/hints/LineSnappingHint.js +1 -1
  222. package/views/interactive/tooltip/tooltipCommonUtils.js +1 -1
  223. package/views/navigation/PanSphericalMomentumEstimator.js +1 -1
  224. package/views/support/euclideanAreaMeasurementUtils.js +1 -1
  225. package/views/support/euclideanLengthMeasurementUtils.js +1 -1
  226. package/views/support/geometry3dUtils.js +1 -1
  227. package/widgets/BatchAttributeForm/BatchAttributeFormViewModel.js +1 -1
  228. package/widgets/BatchAttributeForm/css.js +1 -1
  229. package/widgets/BatchAttributeForm/inputs/SingleFeatureInput.d.ts +4 -0
  230. package/widgets/BatchAttributeForm/inputs/SingleFeatureInput.js +5 -0
  231. package/widgets/BatchAttributeForm/inputs/TextElementInput.d.ts +4 -0
  232. package/widgets/BatchAttributeForm/inputs/TextElementInput.js +5 -0
  233. package/widgets/BatchAttributeForm/inputs/support/createBatchFormInputs.js +1 -1
  234. package/widgets/BatchAttributeForm/inputs/support/inputUtils.js +1 -1
  235. package/widgets/BatchAttributeForm/templates/GroupElementTemplate.js +1 -1
  236. package/widgets/BatchAttributeForm/templates/TextElementTemplate.js +5 -0
  237. package/widgets/BatchAttributeForm/templates/support/createBatchFormTemplate.js +1 -1
  238. package/widgets/BatchAttributeForm/templates/support/hashElementTemplate.js +1 -1
  239. package/widgets/BatchAttributeForm/templates/support/templateUtils.js +1 -1
  240. package/widgets/BatchAttributeForm.js +1 -1
  241. package/widgets/FeatureForm/TextElementInput.d.ts +2 -2
  242. package/widgets/FeatureTable/AttachmentsColumn.js +1 -1
  243. package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
  244. package/widgets/FeatureTable/Grid/Column.js +1 -1
  245. package/widgets/FeatureTable/Grid/EditorColumn.js +1 -1
  246. package/widgets/FeatureTable/Grid/Grid.js +1 -1
  247. package/widgets/FeatureTable/Grid/GridViewModel.js +1 -1
  248. package/widgets/FeatureTable/support/FeatureStore.js +1 -1
  249. package/widgets/PanoramicViewer/PanoramicVideoViewerViewModel.js +1 -1
  250. package/widgets/PanoramicViewer/PanoramicViewerViewModel.js +1 -1
  251. package/widgets/PanoramicViewer/PanoramicZoomManager.js +1 -1
  252. package/widgets/PanoramicViewer/support/PanoramicMedia.js +5 -0
  253. package/widgets/PanoramicViewer/support/PanoramicMediaCollection.js +5 -0
  254. package/widgets/PanoramicViewer/support/PanoramicMediaError.js +5 -0
  255. package/widgets/PanoramicViewer/utils.js +1 -1
  256. package/widgets/PanoramicViewer.js +1 -1
  257. package/widgets/Print/CustomTemplate.js +1 -1
  258. package/widgets/Print/PrintViewModel.js +1 -1
  259. package/widgets/Print/TemplateOptions.js +1 -1
  260. package/widgets/Print.js +1 -1
  261. package/assets/esri/core/workers/chunks/04a0685ee53ef74883aa.js +0 -1
  262. package/assets/esri/core/workers/chunks/1e0e7cef7ef947894bbe.js +0 -1019
  263. package/assets/esri/core/workers/chunks/20988e116f3723228f36.js +0 -1
  264. package/assets/esri/core/workers/chunks/2613e482450b57f2d4f5.js +0 -1
  265. package/assets/esri/core/workers/chunks/274f2b5e6dbc58505142.js +0 -1
  266. package/assets/esri/core/workers/chunks/27dfbe3d903b95d4c67a.js +0 -1
  267. package/assets/esri/core/workers/chunks/28a5a7c6b3d6902146f6.js +0 -1
  268. package/assets/esri/core/workers/chunks/2c4218306747f5d15575.js +0 -1
  269. package/assets/esri/core/workers/chunks/2db7a7607657f1d669f7.js +0 -1
  270. package/assets/esri/core/workers/chunks/3767617c0dfc7d801441.js +0 -1
  271. package/assets/esri/core/workers/chunks/44b6b7418cbf7f778bef.js +0 -1
  272. package/assets/esri/core/workers/chunks/4675ed3ca3e0104d00bf.js +0 -1
  273. package/assets/esri/core/workers/chunks/4df7cc3477bc46fc39af.js +0 -1
  274. package/assets/esri/core/workers/chunks/538ddb267aa328814865.js +0 -1
  275. package/assets/esri/core/workers/chunks/555a0ea44ba77819d493.js +0 -1
  276. package/assets/esri/core/workers/chunks/55818fe7a7aa1e5c8bbd.js +0 -1
  277. package/assets/esri/core/workers/chunks/5f781ef46ce7c4048c2f.js +0 -1
  278. package/assets/esri/core/workers/chunks/60f2de8dd8876bfd715a.js +0 -1
  279. package/assets/esri/core/workers/chunks/679088064420a906aa7f.js +0 -1
  280. package/assets/esri/core/workers/chunks/706423d801fa9cbf2e90.js +0 -1
  281. package/assets/esri/core/workers/chunks/71dd80231ea656a6380c.js +0 -1
  282. package/assets/esri/core/workers/chunks/725819839434c59102f3.js +0 -1
  283. package/assets/esri/core/workers/chunks/72cebf18da5ec5eeb666.js +0 -1
  284. package/assets/esri/core/workers/chunks/768d9b6eaba7bfa18dde.js +0 -1
  285. package/assets/esri/core/workers/chunks/77b45957cfe42523c1c8.js +0 -1
  286. package/assets/esri/core/workers/chunks/852de585a72d902344a6.js +0 -1
  287. package/assets/esri/core/workers/chunks/871dd5e1f016a04b8d98.js +0 -1
  288. package/assets/esri/core/workers/chunks/892c417f5130b003889d.js +0 -1
  289. package/assets/esri/core/workers/chunks/907083c427d7fb4354e9.js +0 -1
  290. package/assets/esri/core/workers/chunks/93c5f097bb7b380bb175.js +0 -1
  291. package/assets/esri/core/workers/chunks/9f0172b83f25ef5f8d40.js +0 -1
  292. package/assets/esri/core/workers/chunks/ae793d814cf32db9fbde.js +0 -1
  293. package/assets/esri/core/workers/chunks/b21cf62652ca772108c8.js +0 -1
  294. package/assets/esri/core/workers/chunks/c5c02ace54fe4ab9214b.js +0 -1
  295. package/assets/esri/core/workers/chunks/c82a974c8448407885e6.js +0 -1
  296. package/assets/esri/core/workers/chunks/d08ee45c501102deea20.js +0 -1
  297. package/assets/esri/core/workers/chunks/d239a4ef60e348cfb05a.js +0 -1
  298. package/assets/esri/core/workers/chunks/da2ba40bc017bff0fe49.js +0 -1
  299. package/assets/esri/core/workers/chunks/dc3a4ad62bc041a4f899.js +0 -1
  300. package/assets/esri/core/workers/chunks/e093e745708f722bc1b9.js +0 -1
  301. package/assets/esri/core/workers/chunks/e501d68a1464805c4b4e.js +0 -1
  302. package/assets/esri/core/workers/chunks/ea3cba01c60d9bc72719.js +0 -316
  303. package/assets/esri/core/workers/chunks/f3c232fc56a29d51196a.js +0 -1
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../Color.js";import{throwIfAborted as t}from"../../../../core/promiseUtils.js";import{pt2px as s}from"../../../../core/screenUtils.js";import{identity as r,scale as i,translate as a,copy as o}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{b as l,q as c,d as h,A as d,i as m,h as u}from"../../../../chunks/vec32.js";import{fromArray as p,ONES as f,create as y,ZEROS as _,fromValues as g}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ZEROS as b,ONES as v,create as P}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{computeTranslationToOriginAndRotation as x}from"../../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{projectPointToVector as R}from"../../../../geometry/projection/projectPointToVector.js";import{create as S,size as C,containsPoint as L,center as w}from"../../../../geometry/support/aaBoundingBox.js";import{getEmissiveMode as O}from"../../../../symbols/support/materialUtils.js";import{defaultPrimitive as U}from"../../../../symbols/support/ObjectSymbol3DLayerResource.js";import{objectSymbolLayerPrimitiveBoundingBox as j,objectSymbolLayerSizeWithResourceSize as E}from"../../../../symbols/support/symbolLayerUtils3D.js";import{estimateNumVerticesForLods as T,defaultSymbolLayerMemoryComplexity as G}from"./defaultSymbolComplexity.js";import{perLodInstanceElevationAligner as B}from"./ElevationAligners.js";import{needsElevationUpdates3D as z,SampleElevationInfo as D,evaluateElevationInfoAtPoint as V}from"./elevationAlignmentUtils.js";import{Graphics3DLodInstanceGraphicLayer as F}from"./Graphics3DLodInstanceGraphicLayer.js";import{Graphics3DSymbolLayer as A,nanFallbackColor as I}from"./Graphics3DSymbolLayer.js";import{validateSymbolLayerSize as k,computeObjectScale as H,computeObjectRotation as M}from"./graphicUtils.js";import{makeLodResources as W}from"./lodResourceUtils.js";import{fetch as N}from"./objectResourceUtils.js";import{placePointOnGeometry as q,extendPointGraphicElevationContext as $}from"./pointUtils.js";import{isValidPrimitive as Z,primitiveLodResources as J}from"./primitiveObjectSymbolUtils.js";import{SymbolComplexity as K}from"./SymbolComplexity.js";import{getResourceUrlFromSymbolStyle as Q}from"./webStyleUtils.js";import{initFastSymbolUpdatesState as X,updateFastSymbolUpdatesState as Y,ConvertOptions as ee,evaluateModelTransformScale as te,evaluateModelTransform as se}from"../support/FastSymbolUpdates.js";import{VerticalOffsetParameters as re}from"../../webgl-engine/core/shaderLibrary/attributes/VerticalOffset.glsl.js";import{LodRenderer as ie}from"../../webgl-engine/lib/lodRendering/LodRenderer.js";import{DefaultMaterial as ae}from"../../webgl-engine/materials/DefaultMaterial.js";import{schematicMRRFactors as oe}from"../../webgl-engine/materials/pbrUtils.js";class ne{constructor(e,t,s,r,i,a,o,n,l,c,h=null){this.lodResources=e,this.lodRenderer=t,this.stageResources=s,this.resourceSize=r,this.isEsriSymbolResource=i,this.isWosr=a,this.resourceBoundingBox=o,this.symbolSize=n,this.extentPadding=l,this.physicalBasedRenderingEnabled=c,this.pivotOffset=h}}class le extends A{getCachedSize(){const[e,t,s]=null!=this._resources?this._resources.symbolSize:[1,1,1];return{width:e,depth:t,height:s}}constructor(e,t,s,r){super(e,t,s,r,de(t)),this._resources=null,this._instanceIndexToGraphicUid=new Map,this._hasLoadedPBRTextures=!1,this._disposeResourceHandles=new Array,this.skipHighSymbolLodsChanged=!1,this.ensureDrapedStatus(!1),this._hasLoadedPBRTextures=s.physicalBasedRenderingEnabled}async doLoad(e){if(!this._drivenProperties.size){const e=k(this.symbolLayer);if(e)throw new Error(e)}if(this._isPrimitive){const t=this.symbolLayer.resource,s=t&&Z(t?.primitive)?t.primitive:U;this._resources=await this._createResourcesForPrimitive(s,e)}else{const t=await Q(this.symbol.styleOrigin),s=t?.href??this.symbolLayer.resource?.href;this._resources=await this._createResourcesForUrl(s,e)}this.layerOpacityChanged(),this.slicePlaneEnabledChanged(),this.physicalBasedRenderingChanged(),this.updateComplexity()}get extentPadding(){return null!=this._resources?this._resources.extentPadding:0}get _isPrimitive(){return null!=this._primitive}get lodRenderer(){return this._resources?.lodRenderer}get materials(){return this._resources?.stageResources.materials??[]}async _createResourcesForPrimitive(t,s){const r=this.symbolLayer,i=S(j(t)),a=p(C(i)),o=p(E(a,r)),n=l(o),c=!1,h=!1,d=r?.material,m={usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0,mrrFactors:oe,ambient:f,diffuse:f,opacity:1,hasSlicePlane:this._context.slicePlaneEnabled,castShadows:r.castShadows,emissiveStrengthFromSymbol:d?.emissive?.strength??0,emissiveSource:1,offsetTransparentBackfaces:!1,drivenOpacity:this.needsDrivenTransparentPass},u=!!m.usePBR,y=this.symbol;"point-3d"===y.type&&y.verticalOffset&&(m.verticalOffset=new re(y.verticalOffset),m.castShadows=!1),this._context.screenSizePerspectiveEnabled&&(m.screenSizePerspective=this.view.screenSizePerspective.parameters),this._hasDrivenColorOrOpacity?m.externalColor=I:m.externalColor=e.toUnitRGBA(this._materialColor)??b,this._fastUpdates=X(this._context.renderer,this._fastVisualVariableConvertOptions(i,o,a,null)),m.instanced=!0,this._fastUpdates?(Object.assign(m,this._fastUpdates.materialParameters),m.instancedFeatureAttribute=!0):this._hasDrivenColorOrOpacity&&(m.instancedColor=!0);const _=new ae(m,this._context);_.setParameters({cullFace:me(_.transparent)});const g=J(t,_);if(!g)throw new Error(`Unknown object symbol primitive: ${t}`);const v=await this._createStageResources(g,u,s),P=await this._createLodRenderer(g,s);return new ne(g,P,v,a,c,h,i,o,n,u)}async _createResourcesForUrl(e,t){const r={instanced:!0,hasSlicePlane:this._context.slicePlaneEnabled,castShadows:this.symbolLayer.castShadows},i={spherical:this._context.spherical,materialParameters:r,cache:this._context.sharedResources.objectResourceCache,compressionOptions:{compressionTracker:this._context.compressionTracker,compressionCallback:()=>this.updateComplexity()}};this._fastUpdates=X(this._context.renderer,this._fastVisualVariableConvertOptions(null,null,null,null)),this._fastUpdates?(Object.assign(i.materialParameters,this._fastUpdates.materialParameters),i.materialParameters.instancedFeatureAttribute=!0):this._hasDrivenColorOrOpacity&&(i.materialParameters.instancedColor=!0);const a=this.symbol;if("point-3d"===a.type&&a.verticalOffset){const{screenLength:e,minWorldLength:t,maxWorldLength:r}=a.verticalOffset;i.materialParameters.verticalOffset={screenLength:s(e),minWorldLength:t||0,maxWorldLength:null!=r?r:1/0},i.materialParameters.castShadows=!1}const o=this._context.physicalBasedRenderingEnabled;i.signal=t,i.usePBR=o,i.skipHighLods=this._context.skipHighSymbolLods;const n=this.symbolLayer.material;i.materialParameters.emissiveStrengthFromSymbol=n?.emissive?.strength??1,i.materialParameters.emissiveSource=O(n?.emissive?.source??"emissive");const c=await N(e,i),h=c.isEsriSymbolResource,d=c.isWosr,m=W(c.lods),u=this._context,f=this._getExternalColorParameters(n),y=this.needsDrivenTransparentPass,_=m.getMaterials();_.forEach(e=>{e.setParameters({...f,drivenOpacity:y}),u.screenSizePerspectiveEnabled&&e.setParameters({screenSizePerspective:this.view.screenSizePerspective.parameters})});const g=c.referenceBoundingBox,b=p(C(g)),v=p(m.levels[0].pivotOffset),P=p(E(b,this.symbolLayer)),x=l(P),R=this._fastUpdates;Y(R,this._context.renderer,this._fastVisualVariableConvertOptions(g,P,b,v))&&_.forEach(e=>e.setParameters(R.materialParameters));const S=await this._createStageResources(m,o,t),L=await this._createLodRenderer(m,t);return new ne(m,L,S,b,h,d,g,P,x,o,v)}_addDisposeResource(e){this._disposeResourceHandles.push(e)}async _createStageResources(e,s,r){const i=this._context.stage,a=e.getMaterials();s!==this._context.physicalBasedRenderingEnabled&&this.physicalBasedRenderingChanged();const o=e.getTextures();i.addTextures(o),this._addDisposeResource(()=>{o.forEach(e=>e.unload()),i.removeTextures(o)}),await Promise.all(o.map(e=>this._context.stage.schedule(()=>e.load(i.renderView.renderingContext),r))),t(r);const n=e.getEngineGeometries();return{materials:a,textures:o,geometries:n}}async _createLodRenderer(e,t){const s=this._context.stage,r={layerViewUid:this._context.layerViewUid,graphicUid:e=>this._instanceIndexToGraphicUid.get(e),notifyGraphicGeometryChanged:e=>this._context.notifyGraphicGeometryChanged(this._instanceIndexToGraphicUid.get(e)),notifyGraphicVisibilityChanged:e=>this._context.notifyGraphicVisibilityChanged(this._instanceIndexToGraphicUid.get(e))},i=this._fastUpdates,a=new ie({symbol:e,metadata:r,shaderTransformation:i?{applyTransform:(e,t,s)=>{e.getFeatureAttribute(t,ye),o(s,se(i.materialParameters,ye,s))},scaleFactor:(e,t,s)=>{t.getFeatureAttribute(s,ye),te(e,i.materialParameters,ye)}}:null},this._context.scheduler);return a.slicePlaneEnabled=this._context.slicePlaneEnabled,this._addDisposeResource(()=>{s.removeRenderPlugin(a),a.destroy()}),await s.addRenderPlugin(a,t),a}_getExternalColorParameters(t){const s={};if(s.externalColor=I,!this._drivenProperties.color&&null!=t?.color){const r=e.toUnitRGBA(t.color);this._drivenProperties.opacity&&(r[3]=NaN),s.externalColor=r}return s}destroy(){super.destroy(),this._cleanupResources()}_cleanupResources(){this._disposeResourceHandles.forEach(e=>e()),this._disposeResourceHandles.length=0,this._resources=null}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry))return null;const s=q(t.geometry);if(null==s)return this.logger.warn(`unsupported geometry type for object symbol: ${t.geometry.type}`),null;const r=this.createElevationContextForGraphic(t),i=e.renderingInfo;return this._createAs3DShape(t,s,i,r,t.uid)}notifyDestroyGraphicLayer(e){this._instanceIndexToGraphicUid.delete(e.instanceIndex)}graphicLayerToGraphicId(){return 0}layerOpacityChanged(){if(null==this._resources)return;const e=this._getLayerOpacity(),t=this._resources.stageResources.materials;for(let s=0;s<t.length;s++){const r=t[s];r.setParameters({layerOpacity:e}),this._isPrimitive&&r.setParameters({cullFace:me(r.transparent)})}}layerScreenSizePerspectiveChanged(){if(null==this._resources)return;const e=this._context.screenSizePerspectiveEnabled?this.view.screenSizePerspective.parameters:null;for(const t of this._resources.stageResources.materials)t.setParameters({screenSizePerspective:e})}layerElevationInfoChanged(e,t){return this.updateGraphics3DGraphicElevationInfo(e,t,z)}slicePlaneEnabledChanged(){if(null==this._resources)return!0;this._resources.lodRenderer.slicePlaneEnabled=this._context.slicePlaneEnabled;for(const e of this._resources.stageResources.materials)e.setParameters({hasSlicePlane:this._context.slicePlaneEnabled});return!0}physicalBasedRenderingChanged(){if(null==this._resources)return!0;const{stageResources:e,isWosr:t}=this._resources;for(const s of e.materials)this._isPrimitive?s.setParameters({usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0}):t||s.setParameters({usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!1});return!1!==this._hasLoadedPBRTextures||!0!==this._context.physicalBasedRenderingEnabled||(this._hasLoadedPBRTextures=!0,!1)}applyRendererDiff(e,t){if(null==this._resources)return 0;const{stageResources:{materials:s},lodRenderer:r,resourceBoundingBox:i,symbolSize:a,resourceSize:o,pivotOffset:n}=this._resources;for(const l in e.diff){if("visualVariables"!==l)return 0;if(!Y(this._fastUpdates,t,this._fastVisualVariableConvertOptions(i,a,o,n)))return 0;for(const e of s)e.setParameters(this._fastUpdates.materialParameters);r.notifyShaderTransformationChanged()}return 2}computeComplexity(){if(null==this._resources)return super.computeComplexity();const e=this._resources.lodResources,t=T(e.levels),s=e.computeUsedMemory(),r={...G(this.symbol,this.symbolLayer),resourceBytes:s};return new K({verticesPerFeature:t,memory:r})}_hasLodRenderer(){return null!=this._resources}_createAs3DShape(e,t,s,r,i){if(!this._hasLodRenderer()||null==this._resources)return null;const a=this.getFastUpdateAttrValues(e),o=this._context.clippingExtent;if(R(t,ue,this._context.elevationProvider.spatialReference),null!=o&&!L(o,ue))return null;const n=he(r),l=this._computeGlobalTransform(t,r,fe,_e),c=this._computeLocalTransform(this._resources,this.symbolLayer,s,pe),h=this._resources.lodRenderer.instanceData,d=h.addInstance();this._instanceIndexToGraphicUid.set(d,i),h.setLocalTransform(d,c,!1),h.setGlobalTransform(d,l),a&&h.setFeatureAttribute(d,a),null==this._fastUpdates&&this._hasDrivenColorOrOpacity&&h.setColor(d,this._getDrivenUInt8ColorWithNaNSupport(s,this._materialColor,!this._isPrimitive));const m=this._context.stage.renderView.olidRenderHelper;if(m){const e=m.getObjectAndLayerIdColor({graphicUid:i,layerViewUid:this._context.layerViewUid});h.setObjectAndLayerIdColor(d,e)}const u=new F(this,d,B,r,this._context.stage.view.state.highlightOrderMap);return n&&(u.alignedSampledElevation=_e.sampledElevation),u.needsElevationUpdates=z(r.mode),$(u,t,this._context.elevationProvider),u}_computeGlobalTransform(e,t,s,r){return V(e,this._context.elevationProvider,t,this._context.renderCoordsHelper,r),ue[0]=e.x,ue[1]=e.y,ue[2]=r.z,x(e.spatialReference,ue,s,this._context.renderCoordsHelper.spatialReference),s}_computeLocalTransform(e,t,s,i){return r(i),this._applyObjectRotation(s,!1,i),this._applyObjectRotation(t,!0,i),this._applyObjectScale(e,s,i),this._applyAnchor(e,t,i),i}_applyObjectScale(e,t,s){if(this._fastUpdates?.requiresShaderTransformation)return;const r=this._drivenProperties.size&&t.size?t.size:e.symbolSize,a=H(r,e.symbolSize,e.resourceSize,this._context.renderCoordsHelper.unitInMeters);1===a[0]&&1===a[1]&&1===a[2]||i(s,s,a)}prepareSymbolLayerPatch(e){if("partial"!==e.diff.type)return;const t=e.diff.diff;this._preparePatchTransform(e,t),this._preparePatchColor(e,t)}updateGeometry(e,t){if(null==this._resources)return!0;const s=e.geometry;if(!s)return!1;const r=q(s);if(null==r)return!1;const i=this.getGeometryElevationMode(s),{elevationContext:a}=t;return a.mode===i&&(a.updateFeatureExpressionFeature(e,this._context.layer),this._computeGlobalTransform(r,a,fe,_e),he(a)&&(t.alignedSampledElevation=_e.sampledElevation),this._resources.lodRenderer.instanceData.setGlobalTransform(t.instanceIndex,fe,!0),$(t,r,this._context.elevationProvider),!0)}_preparePatchTransform(e,t){if(!(t.heading||t.tilt||t.roll||t.width||t.height||t.depth||t.anchor||t.anchorPosition))return;if(null==this._resources)return;const s=(e,t,s)=>(null!=e&&"complete"===e.type?e.newValue:t)??s,r=s(t.heading,this.symbolLayer.heading,0),i=s(t.tilt,this.symbolLayer.tilt,0),a=s(t.roll,this.symbolLayer.roll,0),o=s(t.width,this.symbolLayer.width,void 0),n=s(t.height,this.symbolLayer.height,void 0),l=s(t.depth,this.symbolLayer.depth,void 0),c=s(t.anchor,this.symbolLayer.anchor,void 0),h=s(t.anchorPosition,this.symbolLayer.anchorPosition,void 0);delete t.heading,delete t.tilt,delete t.roll,delete t.width,delete t.height,delete t.depth,delete t.anchor,delete t.anchorPosition;const d={heading:r,tilt:i,roll:a,anchor:c,anchorPosition:h},m=this._resources;1===this.loadStatus&&e.symbolLayerStatePatches.push(()=>{m.symbolSize=p(E(m.resourceSize,{width:o,height:n,depth:l,isPrimitive:this._isPrimitive}))}),e.graphics3DGraphicPatches.push(({instanceIndex:e},t)=>{const s=this._computeLocalTransform(m,d,t,pe);m.lodRenderer.instanceData.setLocalTransform(e,s,!0)})}_preparePatchColor(t,s){if(!s.material||"partial"!==s.material.type)return;const r=s.material.diff;if(!r.color||"complete"!==r.color.type||null==r.color.newValue||null==r.color.oldValue)return;const i=r.color.newValue,a=null!=i?e.toUnitRGBA(i):v;delete r.color;const o=this._resources;if(null==o)return;const n=this._isPrimitive;t.graphics3DGraphicPatches.push(({instanceIndex:e})=>{if(this._hasDrivenColorOrOpacity)o.lodRenderer.instanceData.setColor(e,a);else{const e={externalColor:a};for(const t of o.stageResources.materials)t.setParameters(e),n&&t.setParameters({cullFace:me(t.transparent)})}})}_applyObjectRotation(e,t,s){if(!this._fastUpdates?.requiresShaderTransformation||!t)return M(e.heading,e.tilt,e.roll,s)}_applyAnchor(e,t,s){if(this._fastUpdates?.requiresShaderTransformation)return;const r=ce(e.resourceBoundingBox,e.pivotOffset,t);r&&a(s,s,r)}_fastVisualVariableConvertOptions(e,t,s,r){const i=null!=e?p(C(e)):f,a=null!=e?ce(e,r,this.symbolLayer):_,o=this._context.renderCoordsHelper.unitInMeters,n=H(null!=t?t:void 0,t,s,o),l=g(this.symbolLayer.tilt||0,this.symbolLayer.roll||0,this.symbolLayer.heading||0);return new ee({supports:{size:!0,color:!0,rotation:!0,opacity:!1},modelSize:i,symbolSize:t??f,unitInMeters:o,anchor:a,scale:n,rotation:l,fallbackColor:this._getFallbackOpacityAndColor(),fallbackSize:n})}get _primitive(){const{resource:e}=this.symbolLayer;return null!=e?.href?null:e?.primitive??U}_getFallbackOpacityAndColor(){return e.toUnitRGBA(this._materialColor)??(this._isPrimitive?b:I)}get _materialColor(){return this.symbolLayer.material?.color}}function ce(e,t,s){const r=y();switch(s.anchor){case"center":h(r,w(e)),c(r,r);break;case"top":{const t=w(e);u(r,-t[0],-t[1],-e[5]);break}case"bottom":{const t=w(e);u(r,-t[0],-t[1],-e[2]);break}case"relative":{const t=w(e),i=C(e),a=s.anchorPosition,o=a?g(a.x,a.y,a.z):_;d(r,i,o),m(r,r,t),c(r,r);break}default:null!=t?c(r,t):h(r,_)}return r}function he(e){return"absolute-height"!==e.mode}function de(e){return 1===(e.material?.color?.a??0)&&null==e.resource?.href}function me(e){return e?0:2}const ue=y(),pe=n(),fe=n(),ye=P(),_e=new D;export{le as Graphics3DObjectSymbolLayer};
5
+ import e from"../../../../Color.js";import{throwIfAborted as t}from"../../../../core/promiseUtils.js";import{pt2px as s}from"../../../../core/screenUtils.js";import{identity as r,scale as i,translate as a,copy as o}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{b as l,q as c,d as h,B as d,i as m,h as u}from"../../../../chunks/vec32.js";import{fromArray as p,ONES as f,create as y,ZEROS as _,fromValues as g}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ZEROS as b,ONES as v,create as P}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{computeTranslationToOriginAndRotation as x}from"../../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{projectPointToVector as R}from"../../../../geometry/projection/projectPointToVector.js";import{create as S,size as C,containsPoint as L,center as w}from"../../../../geometry/support/aaBoundingBox.js";import{getEmissiveMode as O}from"../../../../symbols/support/materialUtils.js";import{defaultPrimitive as U}from"../../../../symbols/support/ObjectSymbol3DLayerResource.js";import{objectSymbolLayerPrimitiveBoundingBox as j,objectSymbolLayerSizeWithResourceSize as E}from"../../../../symbols/support/symbolLayerUtils3D.js";import{estimateNumVerticesForLods as T,defaultSymbolLayerMemoryComplexity as B}from"./defaultSymbolComplexity.js";import{perLodInstanceElevationAligner as G}from"./ElevationAligners.js";import{needsElevationUpdates3D as z,SampleElevationInfo as D,evaluateElevationInfoAtPoint as V}from"./elevationAlignmentUtils.js";import{Graphics3DLodInstanceGraphicLayer as F}from"./Graphics3DLodInstanceGraphicLayer.js";import{Graphics3DSymbolLayer as A,nanFallbackColor as I}from"./Graphics3DSymbolLayer.js";import{validateSymbolLayerSize as k,computeObjectScale as H,computeObjectRotation as M}from"./graphicUtils.js";import{makeLodResources as W}from"./lodResourceUtils.js";import{fetch as N}from"./objectResourceUtils.js";import{placePointOnGeometry as q,extendPointGraphicElevationContext as $}from"./pointUtils.js";import{isValidPrimitive as Z,primitiveLodResources as J}from"./primitiveObjectSymbolUtils.js";import{SymbolComplexity as K}from"./SymbolComplexity.js";import{getResourceUrlFromSymbolStyle as Q}from"./webStyleUtils.js";import{initFastSymbolUpdatesState as X,updateFastSymbolUpdatesState as Y,ConvertOptions as ee,evaluateModelTransformScale as te,evaluateModelTransform as se}from"../support/FastSymbolUpdates.js";import{VerticalOffsetParameters as re}from"../../webgl-engine/core/shaderLibrary/attributes/VerticalOffset.glsl.js";import{LodRenderer as ie}from"../../webgl-engine/lib/lodRendering/LodRenderer.js";import{DefaultMaterial as ae}from"../../webgl-engine/materials/DefaultMaterial.js";import{schematicMRRFactors as oe}from"../../webgl-engine/materials/pbrUtils.js";class ne{constructor(e,t,s,r,i,a,o,n,l,c,h=null){this.lodResources=e,this.lodRenderer=t,this.stageResources=s,this.resourceSize=r,this.isEsriSymbolResource=i,this.isWosr=a,this.resourceBoundingBox=o,this.symbolSize=n,this.extentPadding=l,this.physicalBasedRenderingEnabled=c,this.pivotOffset=h}}class le extends A{getCachedSize(){const[e,t,s]=null!=this._resources?this._resources.symbolSize:[1,1,1];return{width:e,depth:t,height:s}}constructor(e,t,s,r){super(e,t,s,r,de(t)),this._resources=null,this._instanceIndexToGraphicUid=new Map,this._hasLoadedPBRTextures=!1,this._disposeResourceHandles=new Array,this.skipHighSymbolLodsChanged=!1,this.ensureDrapedStatus(!1),this._hasLoadedPBRTextures=s.physicalBasedRenderingEnabled}async doLoad(e){if(!this._drivenProperties.size){const e=k(this.symbolLayer);if(e)throw new Error(e)}if(this._isPrimitive){const t=this.symbolLayer.resource,s=t&&Z(t?.primitive)?t.primitive:U;this._resources=await this._createResourcesForPrimitive(s,e)}else{const t=await Q(this.symbol.styleOrigin),s=t?.href??this.symbolLayer.resource?.href;this._resources=await this._createResourcesForUrl(s,e)}this.layerOpacityChanged(),this.slicePlaneEnabledChanged(),this.physicalBasedRenderingChanged(),this.updateComplexity()}get extentPadding(){return null!=this._resources?this._resources.extentPadding:0}get _isPrimitive(){return null!=this._primitive}get lodRenderer(){return this._resources?.lodRenderer}get materials(){return this._resources?.stageResources.materials??[]}async _createResourcesForPrimitive(t,s){const r=this.symbolLayer,i=S(j(t)),a=p(C(i)),o=p(E(a,r)),n=l(o),c=!1,h=!1,d=r?.material,m={usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0,mrrFactors:oe,ambient:f,diffuse:f,opacity:1,hasSlicePlane:this._context.slicePlaneEnabled,castShadows:r.castShadows,emissiveStrengthFromSymbol:d?.emissive?.strength??0,emissiveSource:1,offsetTransparentBackfaces:!1,drivenOpacity:this.needsDrivenTransparentPass},u=!!m.usePBR,y=this.symbol;"point-3d"===y.type&&y.verticalOffset&&(m.verticalOffset=new re(y.verticalOffset),m.castShadows=!1),this._context.screenSizePerspectiveEnabled&&(m.screenSizePerspective=this.view.screenSizePerspective.parameters),this._hasDrivenColorOrOpacity?m.externalColor=I:m.externalColor=e.toUnitRGBA(this._materialColor)??b,this._fastUpdates=X(this._context.renderer,this._fastVisualVariableConvertOptions(i,o,a,null)),m.instanced=!0,this._fastUpdates?(Object.assign(m,this._fastUpdates.materialParameters),m.instancedFeatureAttribute=!0):this._hasDrivenColorOrOpacity&&(m.instancedColor=!0);const _=new ae(m,this._context);_.setParameters({cullFace:me(_.transparent)});const g=J(t,_);if(!g)throw new Error(`Unknown object symbol primitive: ${t}`);const v=await this._createStageResources(g,u,s),P=await this._createLodRenderer(g,s);return new ne(g,P,v,a,c,h,i,o,n,u)}async _createResourcesForUrl(e,t){const r={instanced:!0,hasSlicePlane:this._context.slicePlaneEnabled,castShadows:this.symbolLayer.castShadows},i={spherical:this._context.spherical,materialParameters:r,cache:this._context.sharedResources.objectResourceCache,compressionOptions:{compressionTracker:this._context.compressionTracker,compressionCallback:()=>this.updateComplexity()}};this._fastUpdates=X(this._context.renderer,this._fastVisualVariableConvertOptions(null,null,null,null)),this._fastUpdates?(Object.assign(i.materialParameters,this._fastUpdates.materialParameters),i.materialParameters.instancedFeatureAttribute=!0):this._hasDrivenColorOrOpacity&&(i.materialParameters.instancedColor=!0);const a=this.symbol;if("point-3d"===a.type&&a.verticalOffset){const{screenLength:e,minWorldLength:t,maxWorldLength:r}=a.verticalOffset;i.materialParameters.verticalOffset={screenLength:s(e),minWorldLength:t||0,maxWorldLength:null!=r?r:1/0},i.materialParameters.castShadows=!1}const o=this._context.physicalBasedRenderingEnabled;i.signal=t,i.usePBR=o,i.useEmissive=this.view.stage.renderView.renderingContext.driverTest.floatBufferBlend.result,i.skipHighLods=this._context.skipHighSymbolLods;const n=this.symbolLayer.material;i.materialParameters.emissiveStrengthFromSymbol=n?.emissive?.strength??1,i.materialParameters.emissiveSource=O(n?.emissive?.source??"emissive");const c=await N(e,i),h=c.isEsriSymbolResource,d=c.isWosr,m=W(c.lods),u=this._context,f=this._getExternalColorParameters(n),y=this.needsDrivenTransparentPass,_=m.getMaterials();_.forEach(e=>{e.setParameters({...f,drivenOpacity:y}),u.screenSizePerspectiveEnabled&&e.setParameters({screenSizePerspective:this.view.screenSizePerspective.parameters})});const g=c.referenceBoundingBox,b=p(C(g)),v=p(m.levels[0].pivotOffset),P=p(E(b,this.symbolLayer)),x=l(P),R=this._fastUpdates;Y(R,this._context.renderer,this._fastVisualVariableConvertOptions(g,P,b,v))&&_.forEach(e=>e.setParameters(R.materialParameters));const S=await this._createStageResources(m,o,t),L=await this._createLodRenderer(m,t);return new ne(m,L,S,b,h,d,g,P,x,o,v)}_addDisposeResource(e){this._disposeResourceHandles.push(e)}async _createStageResources(e,s,r){const i=this._context.stage,a=e.getMaterials();s!==this._context.physicalBasedRenderingEnabled&&this.physicalBasedRenderingChanged();const o=e.getTextures();i.addTextures(o),this._addDisposeResource(()=>{o.forEach(e=>e.unload()),i.removeTextures(o)}),await Promise.all(o.map(e=>this._context.stage.schedule(()=>e.load(i.renderView.renderingContext),r))),t(r);const n=e.getEngineGeometries();return{materials:a,textures:o,geometries:n}}async _createLodRenderer(e,t){const s=this._context.stage,r={layerViewUid:this._context.layerViewUid,graphicUid:e=>this._instanceIndexToGraphicUid.get(e),notifyGraphicGeometryChanged:e=>this._context.notifyGraphicGeometryChanged(this._instanceIndexToGraphicUid.get(e)),notifyGraphicVisibilityChanged:e=>this._context.notifyGraphicVisibilityChanged(this._instanceIndexToGraphicUid.get(e))},i=this._fastUpdates,a=new ie({symbol:e,metadata:r,shaderTransformation:i?{applyTransform:(e,t,s)=>{e.getFeatureAttribute(t,ye),o(s,se(i.materialParameters,ye,s))},scaleFactor:(e,t,s)=>{t.getFeatureAttribute(s,ye),te(e,i.materialParameters,ye)}}:null},this._context.scheduler);return a.slicePlaneEnabled=this._context.slicePlaneEnabled,this._addDisposeResource(()=>{s.removeRenderPlugin(a),a.destroy()}),await s.addRenderPlugin(a,t),a}_getExternalColorParameters(t){const s={};if(s.externalColor=I,!this._drivenProperties.color&&null!=t?.color){const r=e.toUnitRGBA(t.color);this._drivenProperties.opacity&&(r[3]=NaN),s.externalColor=r}return s}destroy(){super.destroy(),this._cleanupResources()}_cleanupResources(){this._disposeResourceHandles.forEach(e=>e()),this._disposeResourceHandles.length=0,this._resources=null}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry))return null;const s=q(t.geometry);if(null==s)return this.logger.warn(`unsupported geometry type for object symbol: ${t.geometry.type}`),null;const r=this.createElevationContextForGraphic(t),i=e.renderingInfo;return this._createAs3DShape(t,s,i,r,t.uid)}notifyDestroyGraphicLayer(e){this._instanceIndexToGraphicUid.delete(e.instanceIndex)}graphicLayerToGraphicId(){return 0}layerOpacityChanged(){if(null==this._resources)return;const e=this._getLayerOpacity(),t=this._resources.stageResources.materials;for(let s=0;s<t.length;s++){const r=t[s];r.setParameters({layerOpacity:e}),this._isPrimitive&&r.setParameters({cullFace:me(r.transparent)})}}layerScreenSizePerspectiveChanged(){if(null==this._resources)return;const e=this._context.screenSizePerspectiveEnabled?this.view.screenSizePerspective.parameters:null;for(const t of this._resources.stageResources.materials)t.setParameters({screenSizePerspective:e})}layerElevationInfoChanged(e,t){return this.updateGraphics3DGraphicElevationInfo(e,t,z)}slicePlaneEnabledChanged(){if(null==this._resources)return!0;this._resources.lodRenderer.slicePlaneEnabled=this._context.slicePlaneEnabled;for(const e of this._resources.stageResources.materials)e.setParameters({hasSlicePlane:this._context.slicePlaneEnabled});return!0}physicalBasedRenderingChanged(){if(null==this._resources)return!0;const{stageResources:e,isWosr:t}=this._resources;for(const s of e.materials)this._isPrimitive?s.setParameters({usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0}):t||s.setParameters({usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!1});return!1!==this._hasLoadedPBRTextures||!0!==this._context.physicalBasedRenderingEnabled||(this._hasLoadedPBRTextures=!0,!1)}applyRendererDiff(e,t){if(null==this._resources)return 0;const{stageResources:{materials:s},lodRenderer:r,resourceBoundingBox:i,symbolSize:a,resourceSize:o,pivotOffset:n}=this._resources;for(const l in e.diff){if("visualVariables"!==l)return 0;if(!Y(this._fastUpdates,t,this._fastVisualVariableConvertOptions(i,a,o,n)))return 0;for(const e of s)e.setParameters(this._fastUpdates.materialParameters);r.notifyShaderTransformationChanged()}return 2}computeComplexity(){if(null==this._resources)return super.computeComplexity();const e=this._resources.lodResources,t=T(e.levels),s=e.computeUsedMemory(),r={...B(this.symbol,this.symbolLayer),resourceBytes:s};return new K({verticesPerFeature:t,memory:r})}_hasLodRenderer(){return null!=this._resources}_createAs3DShape(e,t,s,r,i){if(!this._hasLodRenderer()||null==this._resources)return null;const a=this.getFastUpdateAttrValues(e),o=this._context.clippingExtent;if(R(t,ue,this._context.elevationProvider.spatialReference),null!=o&&!L(o,ue))return null;const n=he(r),l=this._computeGlobalTransform(t,r,fe,_e),c=this._computeLocalTransform(this._resources,this.symbolLayer,s,pe),h=this._resources.lodRenderer.instanceData,d=h.addInstance();this._instanceIndexToGraphicUid.set(d,i),h.setLocalTransform(d,c,!1),h.setGlobalTransform(d,l),a&&h.setFeatureAttribute(d,a),null==this._fastUpdates&&this._hasDrivenColorOrOpacity&&h.setColor(d,this._getDrivenUInt8ColorWithNaNSupport(s,this._materialColor,!this._isPrimitive));const m=this._context.stage.renderView.olidRenderHelper;if(m){const e=m.getObjectAndLayerIdColor({graphicUid:i,layerViewUid:this._context.layerViewUid});h.setObjectAndLayerIdColor(d,e)}const u=new F(this,d,G,r,this._context.stage.view.state.highlightOrderMap);return n&&(u.alignedSampledElevation=_e.sampledElevation),u.needsElevationUpdates=z(r.mode),$(u,t,this._context.elevationProvider),u}_computeGlobalTransform(e,t,s,r){return V(e,this._context.elevationProvider,t,this._context.renderCoordsHelper,r),ue[0]=e.x,ue[1]=e.y,ue[2]=r.z,x(e.spatialReference,ue,s,this._context.renderCoordsHelper.spatialReference),s}_computeLocalTransform(e,t,s,i){return r(i),this._applyObjectRotation(s,!1,i),this._applyObjectRotation(t,!0,i),this._applyObjectScale(e,s,i),this._applyAnchor(e,t,i),i}_applyObjectScale(e,t,s){if(this._fastUpdates?.requiresShaderTransformation)return;const r=this._drivenProperties.size&&t.size?t.size:e.symbolSize,a=H(r,e.symbolSize,e.resourceSize,this._context.renderCoordsHelper.unitInMeters);1===a[0]&&1===a[1]&&1===a[2]||i(s,s,a)}prepareSymbolLayerPatch(e){if("partial"!==e.diff.type)return;const t=e.diff.diff;this._preparePatchTransform(e,t),this._preparePatchColor(e,t)}updateGeometry(e,t){if(null==this._resources)return!0;const s=e.geometry;if(!s)return!1;const r=q(s);if(null==r)return!1;const i=this.getGeometryElevationMode(s),{elevationContext:a}=t;return a.mode===i&&(a.updateFeatureExpressionFeature(e,this._context.layer),this._computeGlobalTransform(r,a,fe,_e),he(a)&&(t.alignedSampledElevation=_e.sampledElevation),this._resources.lodRenderer.instanceData.setGlobalTransform(t.instanceIndex,fe,!0),$(t,r,this._context.elevationProvider),!0)}_preparePatchTransform(e,t){if(!(t.heading||t.tilt||t.roll||t.width||t.height||t.depth||t.anchor||t.anchorPosition))return;if(null==this._resources)return;const s=(e,t,s)=>(null!=e&&"complete"===e.type?e.newValue:t)??s,r=s(t.heading,this.symbolLayer.heading,0),i=s(t.tilt,this.symbolLayer.tilt,0),a=s(t.roll,this.symbolLayer.roll,0),o=s(t.width,this.symbolLayer.width,void 0),n=s(t.height,this.symbolLayer.height,void 0),l=s(t.depth,this.symbolLayer.depth,void 0),c=s(t.anchor,this.symbolLayer.anchor,void 0),h=s(t.anchorPosition,this.symbolLayer.anchorPosition,void 0);delete t.heading,delete t.tilt,delete t.roll,delete t.width,delete t.height,delete t.depth,delete t.anchor,delete t.anchorPosition;const d={heading:r,tilt:i,roll:a,anchor:c,anchorPosition:h},m=this._resources;1===this.loadStatus&&e.symbolLayerStatePatches.push(()=>{m.symbolSize=p(E(m.resourceSize,{width:o,height:n,depth:l,isPrimitive:this._isPrimitive}))}),e.graphics3DGraphicPatches.push(({instanceIndex:e},t)=>{const s=this._computeLocalTransform(m,d,t,pe);m.lodRenderer.instanceData.setLocalTransform(e,s,!0)})}_preparePatchColor(t,s){if(!s.material||"partial"!==s.material.type)return;const r=s.material.diff;if(!r.color||"complete"!==r.color.type||null==r.color.newValue||null==r.color.oldValue)return;const i=r.color.newValue,a=null!=i?e.toUnitRGBA(i):v;delete r.color;const o=this._resources;if(null==o)return;const n=this._isPrimitive;t.graphics3DGraphicPatches.push(({instanceIndex:e})=>{if(this._hasDrivenColorOrOpacity)o.lodRenderer.instanceData.setColor(e,a);else{const e={externalColor:a};for(const t of o.stageResources.materials)t.setParameters(e),n&&t.setParameters({cullFace:me(t.transparent)})}})}_applyObjectRotation(e,t,s){if(!this._fastUpdates?.requiresShaderTransformation||!t)return M(e.heading,e.tilt,e.roll,s)}_applyAnchor(e,t,s){if(this._fastUpdates?.requiresShaderTransformation)return;const r=ce(e.resourceBoundingBox,e.pivotOffset,t);r&&a(s,s,r)}_fastVisualVariableConvertOptions(e,t,s,r){const i=null!=e?p(C(e)):f,a=null!=e?ce(e,r,this.symbolLayer):_,o=this._context.renderCoordsHelper.unitInMeters,n=H(null!=t?t:void 0,t,s,o),l=g(this.symbolLayer.tilt||0,this.symbolLayer.roll||0,this.symbolLayer.heading||0);return new ee({supports:{size:!0,color:!0,rotation:!0,opacity:!1},modelSize:i,symbolSize:t??f,unitInMeters:o,anchor:a,scale:n,rotation:l,fallbackColor:this._getFallbackOpacityAndColor(),fallbackSize:n})}get _primitive(){const{resource:e}=this.symbolLayer;return null!=e?.href?null:e?.primitive??U}_getFallbackOpacityAndColor(){return e.toUnitRGBA(this._materialColor)??(this._isPrimitive?b:I)}get _materialColor(){return this.symbolLayer.material?.color}}function ce(e,t,s){const r=y();switch(s.anchor){case"center":h(r,w(e)),c(r,r);break;case"top":{const t=w(e);u(r,-t[0],-t[1],-e[5]);break}case"bottom":{const t=w(e);u(r,-t[0],-t[1],-e[2]);break}case"relative":{const t=w(e),i=C(e),a=s.anchorPosition,o=a?g(a.x,a.y,a.z):_;d(r,i,o),m(r,r,t),c(r,r);break}default:null!=t?c(r,t):h(r,_)}return r}function he(e){return"absolute-height"!==e.mode}function de(e){return 1===(e.material?.color?.a??0)&&null==e.resource?.href}function me(e){return e?0:2}const ue=y(),pe=n(),fe=n(),ye=P(),_e=new D;export{le as Graphics3DObjectSymbolLayer};
@@ -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{removeMaybe as t}from"../../../../core/maybe.js";import{throwIfAborted as o,onAbort as r}from"../../../../core/promiseUtils.js";import{DefaultLoadingContext as e}from"../../glTF/DefaultLoadingContext.js";import{load as s}from"./wosrLoader.js";class a{constructor(t){this._gltfLoading=new Map,this._wosrLoading=new Map,this._gltfCache=t("gltf-resources",()=>{}),this._wosrCache=t("wosr-resources",()=>{})}destroy(){this._gltfLoading.forEach(t=>t.abortController.abort()),this._wosrLoading.forEach(t=>t.abortController.abort()),this._gltfCache.destroy(),this._wosrCache.destroy()}loadGLTF(t,o,r){const s=r?`gltfPBR:${t}`:`gltf:${t}`,a=this._gltfCache.get(s);return a?Promise.resolve(a):l(this._gltfLoading,this._gltfCache,s,async o=>{const{loadGLTF:s}=await import("../../glTF/loader.js");return s(new e,t,o,r)},o)}loadWOSR(t,o){const r=`wosr:${t}:${o.disableTextures}`,e=this._wosrCache.get(r);return e?Promise.resolve(e):l(this._wosrLoading,this._wosrCache,r,o=>s(t,o),o)}}async function l(e,s,a,l,i){o(i);const c=r(i,()=>n(e,a));let f=e.get(a);if(f)f.refCount++;else{const t=new AbortController;f={refCount:1,abortController:t,promise:l({...i,signal:t.signal})},e.set(a,f)}try{const t=await f.promise;return s.put(a,t),e.delete(a),o(i),t}finally{t(c)}}function n(t,o){const r=t.get(o);if(null!=r){if(--r.refCount>0)return}t.delete(o),null!=r&&r.abortController.abort()}export{a as ObjectResourceCache};
5
+ import{removeMaybe as o}from"../../../../core/maybe.js";import{throwIfAborted as t,onAbort as r}from"../../../../core/promiseUtils.js";import{DefaultLoadingContext as e}from"../../glTF/DefaultLoadingContext.js";import{load as s}from"./wosrLoader.js";class a{constructor(o){this._gltfLoading=new Map,this._wosrLoading=new Map,this._gltfCache=o("gltf-resources",()=>{}),this._wosrCache=o("wosr-resources",()=>{})}destroy(){this._gltfLoading.forEach(o=>o.abortController.abort()),this._wosrLoading.forEach(o=>o.abortController.abort()),this._gltfCache.destroy(),this._wosrCache.destroy()}loadGLTF(o,t,r,s){const a=`gltf:${o},pbr:${r},em:${s}`,i=this._gltfCache.get(a);return i?Promise.resolve(i):n(this._gltfLoading,this._gltfCache,a,async t=>{const{loadGLTF:a}=await import("../../glTF/loader.js");return a(new e,o,t,r,s)},t)}loadWOSR(o,t){const r=`wosr:${o}:${t.disableTextures}`,e=this._wosrCache.get(r);return e?Promise.resolve(e):n(this._wosrLoading,this._wosrCache,r,t=>s(o,t),t)}}async function n(e,s,a,n,l){t(l);const c=r(l,()=>i(e,a));let f=e.get(a);if(f)f.refCount++;else{const o=new AbortController;f={refCount:1,abortController:o,promise:n({...l,signal:o.signal})},e.set(a,f)}try{const o=await f.promise;return s.put(a,o),e.delete(a),t(l),o}finally{o(c)}}function i(o,t){const r=o.get(t);if(null!=r){if(--r.refCount>0)return}o.delete(t),null!=r&&r.abortController.abort()}export{a as ObjectResourceCache};
@@ -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{__decorate as e}from"tslib";import{nullUid as t}from"../../../../../../core/uid.js";import{property as r,subclass as i}from"../../../../../../core/accessorSupport/decorators.js";import{glLayout as n}from"../../../../support/buffer/glUtil.js";import{SyncRenderPlugin as s}from"../../../../webgl-engine/effects/RenderPlugin.js";import{GLMaterials as o}from"../../../../webgl-engine/lib/GLMaterials.js";import{BoundingVolume as a}from"../../../../webgl-engine/lib/Object3D.js";import{VertexArrayObject as l}from"../../../../webgl-engine/lib/VertexArrayObject.js";import{DrawParameters as u}from"../../../../webgl-engine/materials/DrawParameters.js";import{HUDMaterial as c}from"../../../../webgl-engine/materials/HUDMaterial.js";import{bindVertexBufferLayout as m}from"../../../../../webgl/Util.js";import{VertexBuffer as d}from"../../../../../webgl/VertexBuffer.js";let f=class extends s{constructor(e){super(e),this._glMaterials=null,this._produces=new Map,this._renderGeometries=new Map,this._renderContext=null,this._drawParameters=new u,this._bufferWriter=null,this._baseInstance=null,this.slicePlaneEnabled=!1,this.isGround=!1,this.type=e.material instanceof c?1:4,this.layerViewUid=e.layerViewUid}get produces(){return this._produces}get numFeatures(){let e=0;return this._renderGeometries.forEach(t=>e+=t.numElements),e}get usedMemory(){let e=0;return this._renderGeometries.forEach(t=>{e+=t.vao.usedMemory}),e}intersect(e,r,i,n){const{material:s,_bufferWriter:o,layerViewUid:l,_renderGeometries:u}=this;null!=o.intersect&&u.forEach(({buffer:r,localOrigin:u,items:c})=>o.intersect(r.data,s.parameters,u,e,i,n,(r,i,n,o)=>{if(!c.visibilities[n])return;const u=c.objectIds[n];e.handleObjectIntersection({object:{id:t,graphicUid:u,layerViewUid:l,boundingVolumeWorldSpace:new a,geometries:[{material:s}]},geometryId:0,primitiveIndex:n},r,i,null,o)}))}initialize(){this._bufferWriter=this.material.createBufferWriter(),this.material.produces.forEach((e,t)=>{this._produces.set(t,t=>8!==t&&4!==t&&e(t))})}destroy(){this._glMaterials.dispose();const e=this._renderGeometries.keys();for(const t of e)this.removeRenderGeometryBuffer(t);this._baseInstance?.vbo.dispose(),this._baseInstance=null}acquireTechniques(e){const t=this.material;if(!t.shouldRender(e))return null;const{output:r,bind:i}=e,n=t.produces.get(i.slot);if(!n?.(r))return null;if(8===r||4===r)return null;const s=this._glMaterials.load(e.rctx,i.slot,r);return s?.beginSlot(i)}render(e,t){const r=this._renderGeometries;if(0===r.size)return;const{bind:i}=e,n=e.rctx;n.runAppleAmdDriverHelper(),n.bindTechnique(t,i,this.material.parameters);const s=t.program,{_baseInstance:o}=this,a=null==o?e=>{n.drawArrays(t.primitiveType,e.start,e.count)}:(e,r)=>{m(n,r.locations,r.buffer("instances"),e.start),n.drawArraysInstanced(t.primitiveType,0,o.buffer.elementCount,e.count)};for(const[l,u]of r){const{vao:e,localOrigin:r,drawCalls:o}=u;this._drawParameters.origin=r,s.bindDraw(i,this.material.parameters,this._drawParameters),t.ensureAttributeLocations(e),n.bindVAO(e),n.setPipelineState(t.getPipeline(i,!1));for(const t of o)a(t,e)}}initializeRenderContext(e){this._glMaterials=new o(this.material,e.materials),this._renderContext=e.renderContext}uninitializeRenderContext(){}addRenderGeometryBuffer(e,t,r,i){this.removeRenderGeometryBuffer(e);const{data:s,elementCount:o}=t,{_baseInstance:a,_bufferWriter:u,_renderContext:{rctx:c}}=this,m=null==a?u.layout:u.instanceLayout;if(!m)throw new Error("Cannot create instance buffer for non-instanced material");const f=new d(c,n(m,null==a?0:1),s);let h;h=new l(c,null==a?new Map([["geometry",f]]):new Map([["geometry",a.vbo],["instances",f]]));const b={localOrigin:i,numElements:o,buffer:t,items:r,vao:h,drawCalls:this._produceDrawCalls(r)};this._renderGeometries.set(e,b)}updateRenderGeometryBuffer(e,t,r,i){const{data:n,elementCount:s}=t,o=this._renderGeometries.get(e);if(null==o)return;const a=o.vao.buffer(null==this._baseInstance?"geometry":"instances");a?.setSize(n.byteLength),a?.setSubData(new Uint8Array(n),0,0,n.byteLength),o.localOrigin=i,o.numElements=s,o.buffer=t,o.items=r,o.drawCalls=this._produceDrawCalls(r)}removeRenderGeometryBuffer(e){const t=this._renderGeometries.get(e);null!=t&&(this._baseInstance?(t.vao.buffer("instances")?.dispose(),t.vao.disposeVAOOnly()):t.vao.dispose(),this._renderGeometries.delete(e))}updateVisibility(e,t){const r=this._renderGeometries.get(e);if(null==r)return;const{items:i}=r;if(i.visibilities.length!==t.length)throw new Error("Unexpected mismatch between old and new visibility flag buffer length.");i.visibilities=t,r.drawCalls=this._produceDrawCalls(i)}setBaseInstance(e){if(this._baseInstance?.vbo.dispose(),null==e)return void(this._baseInstance=null);const{data:t}=e,r=new d(this._renderContext.rctx,n(this._bufferWriter.layout),t);this._baseInstance={buffer:e,vbo:r}}hasHighlight(){return!1}_produceDrawCalls(e){const{visibilities:t,ranges:r}=e,i=[];if(h(r)){if(0===r.numItems)return[];const e=r.numVertices;let n=null;for(let s=0;s<r.numItems;++s){t[s]?null==n?(n={start:s*e,count:e},i.push(n)):n.count+=e:n=null}}else{const e=r.counts,n=e.length;if(0===n)return[];let s=null,o=0;for(let r=0;r<n;++r){const n=t[r],a=e[r];n?null==s?(s={start:o,count:a},i.push(s)):s.count+=a:s=null,o+=a}}return i}};function h(e){return"numItems"in e}e([r({constructOnly:!0})],f.prototype,"material",void 0),f=e([i("esri.views.3d.layers.graphics.pipeline.rendering.DirectRenderer")],f);export{f as DirectRenderer};
5
+ import{__decorate as e}from"tslib";import{nullUid as t}from"../../../../../../core/uid.js";import{property as r,subclass as i}from"../../../../../../core/accessorSupport/decorators.js";import{glLayout as s}from"../../../../support/buffer/glUtil.js";import{SyncRenderPlugin as n}from"../../../../webgl-engine/effects/RenderPlugin.js";import{GLMaterials as o}from"../../../../webgl-engine/lib/GLMaterials.js";import{BoundingVolume as a}from"../../../../webgl-engine/lib/Object3D.js";import{VertexArrayObject as l}from"../../../../webgl-engine/lib/VertexArrayObject.js";import{DrawParameters as u}from"../../../../webgl-engine/materials/DrawParameters.js";import{HUDMaterial as c}from"../../../../webgl-engine/materials/HUDMaterial.js";import{bindVertexBufferLayout as m}from"../../../../../webgl/Util.js";import{VertexBuffer as d}from"../../../../../webgl/VertexBuffer.js";let f=class extends n{constructor(e){super(e),this._glMaterials=null,this._produces=new Map,this._renderGeometries=new Map,this._renderContext=null,this._drawParameters=new u,this._bufferWriter=null,this._baseInstance=null,this.slicePlaneEnabled=!1,this.isGround=!1,this.type=e.material instanceof c?1:4,this.layerViewUid=e.layerViewUid}get produces(){return this._produces}get numFeatures(){let e=0;return this._renderGeometries.forEach(t=>e+=t.numElements),e}get usedMemory(){let e=0;return this._renderGeometries.forEach(t=>{e+=t.vao.usedMemory}),e}intersect(e,r,i,s){const{material:n,_bufferWriter:o,layerViewUid:l,_renderGeometries:u}=this;null!=o.intersect&&u.forEach(({buffer:r,localOrigin:u,items:c})=>o.intersect(r.data,n.parameters,u,e,i,s,(r,i,s,o)=>{if(!c.visibilities[s])return;const u=c.objectIds[s];e.handleObjectIntersection({object:{id:t,graphicUid:u,layerViewUid:l,boundingVolumeWorldSpace:new a,geometries:[{material:n}]},geometryId:0,primitiveIndex:s},r,i,null,o)}))}initialize(){this._bufferWriter=this.material.createBufferWriter(),this.material.produces.forEach((e,t)=>{this._produces.set(t,t=>8!==t&&4!==t&&e(t))})}destroy(){this._glMaterials.dispose();const e=this._renderGeometries.keys();for(const t of e)this.removeRenderGeometryBuffer(t);this._baseInstance?.vbo.dispose(),this._baseInstance=null}acquireTechniques(e){const t=this.material;if(!t.shouldRender(e))return null;const{output:r,bind:i}=e,s=t.produces.get(i.slot);if(!s?.(r))return null;if(8===r||4===r)return null;const n=this._glMaterials.load(e.rctx,i.slot,r);return n?.beginSlot(i)}render(e,t){const r=this._renderGeometries;if(0===r.size)return;const{bind:i}=e,s=e.rctx;s.runAppleAmdDriverHelper(),s.bindTechnique(t,i,this.material.parameters);const n=t.program,{_baseInstance:o}=this,a=null==o?e=>{s.drawArrays(t.primitiveType,e.start,e.count)}:(e,r)=>{m(s,r.locations,r.buffer("instances"),e.start),s.drawArraysInstanced(t.primitiveType,0,o.buffer.elementCount,e.count)};for(const[l,u]of r){const{vao:e,localOrigin:r,drawCalls:o}=u;this._drawParameters.origin=r,n.bindDraw(i,this.material.parameters,this._drawParameters),t.ensureAttributeLocations(e),s.bindVAO(e),s.setPipelineState(t.getPipeline(i,!1));for(const t of o)a(t,e)}}initializeRenderContext(e){this._glMaterials=new o(this.material,e.materials),this._renderContext=e.renderContext}uninitializeRenderContext(){}addRenderGeometryBuffer(e,t,r,i){this.removeRenderGeometryBuffer(e);const{data:n,elementCount:o}=t,{_baseInstance:a,_bufferWriter:u,_renderContext:{rctx:c}}=this,m=u.layout,f=new d(c,s(m,null==a?0:1),n);let h;h=new l(c,null==a?new Map([["geometry",f]]):new Map([["geometry",a.vbo],["instances",f]]));const b={localOrigin:i,numElements:o,buffer:t,items:r,vao:h,drawCalls:this._produceDrawCalls(r)};this._renderGeometries.set(e,b)}updateRenderGeometryBuffer(e,t,r,i){const{data:s,elementCount:n}=t,o=this._renderGeometries.get(e);if(null==o)return;const a=o.vao.buffer(null==this._baseInstance?"geometry":"instances");a?.setSize(s.byteLength),a?.setSubData(new Uint8Array(s),0,0,s.byteLength),o.localOrigin=i,o.numElements=n,o.buffer=t,o.items=r,o.drawCalls=this._produceDrawCalls(r)}removeRenderGeometryBuffer(e){const t=this._renderGeometries.get(e);null!=t&&(this._baseInstance?(t.vao.buffer("instances")?.dispose(),t.vao.disposeVAOOnly()):t.vao.dispose(),this._renderGeometries.delete(e))}updateVisibility(e,t){const r=this._renderGeometries.get(e);if(null==r)return;const{items:i}=r;if(i.visibilities.length!==t.length)throw new Error("Unexpected mismatch between old and new visibility flag buffer length.");i.visibilities=t,r.drawCalls=this._produceDrawCalls(i)}setBaseInstance(e){this._baseInstance?.vbo.dispose();const t=this._bufferWriter.baseInstanceLayout;if(null==e||null==t)return void(this._baseInstance=null);const{data:r}=e,i=new d(this._renderContext.rctx,s(t),r);this._baseInstance={buffer:e,vbo:i}}hasHighlight(){return!1}_produceDrawCalls(e){const{visibilities:t,ranges:r}=e,i=[];if(h(r)){if(0===r.numItems)return[];const e=r.numVertices;let s=null;for(let n=0;n<r.numItems;++n){t[n]?null==s?(s={start:n*e,count:e},i.push(s)):s.count+=e:s=null}}else{const e=r.counts,s=e.length;if(0===s)return[];let n=null,o=0;for(let r=0;r<s;++r){const s=t[r],a=e[r];s?null==n?(n={start:o,count:a},i.push(n)):n.count+=a:n=null,o+=a}}return i}};function h(e){return"numItems"in e}e([r({constructOnly:!0})],f.prototype,"material",void 0),f=e([i("esri.views.3d.layers.graphics.pipeline.rendering.DirectRenderer")],f);export{f as DirectRenderer};
@@ -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{copy as e,invert as r,transpose as t}from"../../../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as n}from"../../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{getContinuousIndexArray as a}from"../../../../../../geometry/support/Indices.js";import{PipelineCommand as i}from"../PipelineCommand.js";import{generateId as s}from"../utils.js";import{BoundingInfo as o}from"../../../../webgl-engine/lib/BoundingInfo.js";import{DefaultMaterial as d}from"../../../../webgl-engine/materials/DefaultMaterial.js";import{HUDMaterial as m}from"../../../../webgl-engine/materials/HUDMaterial.js";class f{constructor(e,r){this._mainThreadDelegate=r,this._bufferWriters=new Map,this.globalViewingMode=1===e}createRenderCommandBuffer(e=[],r=[]){return{commands:e,transferList:r}}mergeRenderCommandBuffers(e){const r=this.createRenderCommandBuffer();for(const t of e)null!=t&&(r.commands.push(...t.commands),r.transferList.push(...t.transferList));return r}async createTexture(e){const{data:r,parameters:t}=e();return await this._mainThreadDelegate.createTexture(r,t)}async releaseTexture(e){const r=this._destroyTexture(e);return new i(this,r,[])}_destroyTexture(e){return{commands:[{id:"destroy-texture",textureId:e}],transferList:[]}}async createMaterial(e){const{type:r,parameters:t}=e,n=s("material");let a,i;switch(r){case"default":a=new d(e.parameters,{spherical:this.globalViewingMode}),i={type:r,materialId:n,parameters:e.parameters};break;case"hud":a=new m(t,this.globalViewingMode),i={type:r,materialId:n,parameters:e.parameters}}return this._bufferWriters.set(n,a.createBufferWriter()),await this._mainThreadDelegate.createMaterial(i),n}destroyMaterial(e){return{commands:[{id:"destroy-material",materialId:e}],transferList:[]}}updateMaterial(e){return{commands:[{...e,id:"update-material"}],transferList:[]}}async createDirectRenderer(e){return await this._mainThreadDelegate.createDirectRenderer(e),e}async destroyDirectRenderer(e){await this._mainThreadDelegate.destroyDirectRenderer(e)}addDirectRendererGeometry(e,r,t,n){const{materialId:a}=r;if(null==this._bufferWriters.get(a))throw new Error(`no bufferwriter found for material ${a}`);const{renderGeometryBuffer:i,renderGeometryBufferItems:s}=this.createRenderGeometryBuffer(r,t,n);return this.addDirectRendererGeometryBuffer(a,e,i,s,t)}updateDirectRendererGeometry(e,r,t,n){const{materialId:a}=r;if(null==this._bufferWriters.get(a))throw new Error(`no bufferwriter found for material ${a}`);const{renderGeometryBuffer:i,renderGeometryBufferItems:s}=this.createRenderGeometryBuffer(r,t,n);return this.updateDirectRendererGeometryBuffer(a,e,i,s,t)}addDirectRendererGeometryBuffer(e,r,t,n,a){const{objectIds:i,visibilities:s}=n;return{commands:[{id:"add-direct-renderer-geometry-buffer",rendererId:e,groupId:r,renderGeometryBuffer:t,renderGeometryBufferItems:n,localOrigin:a}],transferList:[t.data,i.buffer,s.buffer]}}updateDirectRendererGeometryBuffer(e,r,t,n,a){const{objectIds:i,visibilities:s}=n;return{commands:[{id:"update-direct-renderer-geometry-buffer",rendererId:e,groupId:r,renderGeometryBuffer:t,renderGeometryBufferItems:n,localOrigin:a}],transferList:[t.data,i.buffer,s.buffer]}}removeDirectRendererGeometryBuffer(e,r){return{commands:[{id:"remove-direct-renderer-geometry-buffer",rendererId:e,groupId:r}],transferList:[]}}async createLodRenderer(e){const r=s("lod-renderer"),t=new Set,n={levels:e.levels.map(e=>({components:e.components.map(e=>{const r=e.attributes.get("position");if(!r||0===r.indices.length)throw new Error("positions attribute expected");const n=3,i=a(r.indices.length/n),s=new o(i,n,r);if(null==this._bufferWriters.get(e.materialId))throw new Error("writer not found");const{renderGeometryBuffer:d}=this.createRenderGeometryBuffer(e,null);t.add(d.data);return{materialId:e.materialId,renderGeometryBuffer:d,boundingInfo:{bbMax:s.bbMax,bbMin:s.bbMin}}}),minScreenSpaceRadius:e.minScreenSpaceRadius}))};return await this._mainThreadDelegate.createLodRenderer(r,n,Array.from(t)),r}destroyLodRenderer(e){return{commands:[{id:"destroy-lod-renderer",rendererId:e}],transferList:[]}}addLodInstances(e,r,t){return{commands:[{id:"add-lod-instances",rendererId:e,groupId:r,data:t}],transferList:[t.featureIds.buffer,t.globalTransforms.buffer,t.localTransforms.buffer,t.visibility.buffer]}}removeLodInstances(e,r){return{commands:[{id:"remove-lod-instances",rendererId:e,groupId:r}],transferList:[]}}updateLodInstancesData(e,r,t){return{commands:[{id:"update-lod-instance-data",rendererId:e,groupId:r,globalTransforms:t}],transferList:[t.buffer]}}updateVisibility(e,r,t){return{commands:[{id:"update-visibility",rendererId:e,groupId:r,visibility:t}],transferList:[t.buffer]}}async dispatchRenderCommands(e){0!==e.commands.length&&await this._mainThreadDelegate.executeRenderCommands(e)}createRenderGeometryBuffer(n,a,i){const{materialId:s,visibilities:o,objectIds:d}=n,m=this._bufferWriters.get(s);if(null==m)throw new Error("no registered bufferWriter for material found");let f=null;if(n.transformation&&a)e(u,n.transformation),u[12]-=a[0],u[13]-=a[1],u[14]-=a[2],f=u;else{if(a)throw new Error("not implemented");n.transformation&&(f=n.transformation)}let b=null;f&&(r(l,u),t(l,l),b=l);const y=n.attributes,h=m.elementCount(y),p=i?m.instanceLayout:m.layout;if(!p)throw new Error("Missing layout");const g=p.stride/4;h>Math.floor(c/g)&&console.warn("geometry with very large number of elements encountered");const I=p.createBuffer(h),w=0,B=m.write(f,b,y,n.olidColor,I,w);if(null==B)throw new Error("Bufferwriter.write does not provide item information.");if(o.length!==B.numItems||d.length!==B.numItems)throw new Error("Unexpected mismatch between number of RenderGeometryBufferItems and provided objectIds/visibility flags.");return{renderGeometryBuffer:{data:I.buffer,elementCount:h},renderGeometryBufferItems:{objectIds:d,visibilities:o,ranges:{numVertices:B.numVerticesPerItem,numItems:B.numItems}}}}async setBaseInstance(e,r){await this._mainThreadDelegate.setBaseInstance(e,r)}}const u=n(),l=n(),c=16777216/4;export{f as RenderCommandContext};
5
+ import{copy as e,invert as r,transpose as t}from"../../../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as n}from"../../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{getContinuousIndexArray as a}from"../../../../../../geometry/support/Indices.js";import{PipelineCommand as i}from"../PipelineCommand.js";import{generateId as s}from"../utils.js";import{BoundingInfo as o}from"../../../../webgl-engine/lib/BoundingInfo.js";import{DefaultMaterial as d}from"../../../../webgl-engine/materials/DefaultMaterial.js";import{HUDMaterial as m}from"../../../../webgl-engine/materials/HUDMaterial.js";class f{constructor(e,r){this._mainThreadDelegate=r,this._bufferWriters=new Map,this.globalViewingMode=1===e}createRenderCommandBuffer(e=[],r=[]){return{commands:e,transferList:r}}mergeRenderCommandBuffers(e){const r=this.createRenderCommandBuffer();for(const t of e)null!=t&&(r.commands.push(...t.commands),r.transferList.push(...t.transferList));return r}async createTexture(e){const{data:r,parameters:t}=e();return await this._mainThreadDelegate.createTexture(r,t)}async releaseTexture(e){const r=this._destroyTexture(e);return new i(this,r,[])}_destroyTexture(e){return{commands:[{id:"destroy-texture",textureId:e}],transferList:[]}}async createMaterial(e){const{type:r,parameters:t}=e,n=s("material");let a,i;switch(r){case"default":a=new d(e.parameters,{spherical:this.globalViewingMode}),i={type:r,materialId:n,parameters:e.parameters};break;case"hud":a=new m(t,this.globalViewingMode),i={type:r,materialId:n,parameters:e.parameters}}return this._bufferWriters.set(n,a.createBufferWriter()),await this._mainThreadDelegate.createMaterial(i),n}destroyMaterial(e){return{commands:[{id:"destroy-material",materialId:e}],transferList:[]}}updateMaterial(e){return{commands:[{...e,id:"update-material"}],transferList:[]}}async createDirectRenderer(e){return await this._mainThreadDelegate.createDirectRenderer(e),e}async destroyDirectRenderer(e){await this._mainThreadDelegate.destroyDirectRenderer(e)}addDirectRendererGeometry(e,r,t){const{materialId:n}=r;if(null==this._bufferWriters.get(n))throw new Error(`no bufferwriter found for material ${n}`);const{renderGeometryBuffer:a,renderGeometryBufferItems:i}=this.createRenderGeometryBuffer(r,t);return this.addDirectRendererGeometryBuffer(n,e,a,i,t)}updateDirectRendererGeometry(e,r,t){const{materialId:n}=r;if(null==this._bufferWriters.get(n))throw new Error(`no bufferwriter found for material ${n}`);const{renderGeometryBuffer:a,renderGeometryBufferItems:i}=this.createRenderGeometryBuffer(r,t);return this.updateDirectRendererGeometryBuffer(n,e,a,i,t)}addDirectRendererGeometryBuffer(e,r,t,n,a){const{objectIds:i,visibilities:s}=n;return{commands:[{id:"add-direct-renderer-geometry-buffer",rendererId:e,groupId:r,renderGeometryBuffer:t,renderGeometryBufferItems:n,localOrigin:a}],transferList:[t.data,i.buffer,s.buffer]}}updateDirectRendererGeometryBuffer(e,r,t,n,a){const{objectIds:i,visibilities:s}=n;return{commands:[{id:"update-direct-renderer-geometry-buffer",rendererId:e,groupId:r,renderGeometryBuffer:t,renderGeometryBufferItems:n,localOrigin:a}],transferList:[t.data,i.buffer,s.buffer]}}removeDirectRendererGeometryBuffer(e,r){return{commands:[{id:"remove-direct-renderer-geometry-buffer",rendererId:e,groupId:r}],transferList:[]}}async createLodRenderer(e){const r=s("lod-renderer"),t=new Set,n={levels:e.levels.map(e=>({components:e.components.map(e=>{const r=e.attributes.get("position");if(!r||0===r.indices.length)throw new Error("positions attribute expected");const n=3,i=a(r.indices.length/n),s=new o(i,n,r);if(null==this._bufferWriters.get(e.materialId))throw new Error("writer not found");const{renderGeometryBuffer:d}=this.createRenderGeometryBuffer(e,null);t.add(d.data);return{materialId:e.materialId,renderGeometryBuffer:d,boundingInfo:{bbMax:s.bbMax,bbMin:s.bbMin}}}),minScreenSpaceRadius:e.minScreenSpaceRadius}))};return await this._mainThreadDelegate.createLodRenderer(r,n,Array.from(t)),r}destroyLodRenderer(e){return{commands:[{id:"destroy-lod-renderer",rendererId:e}],transferList:[]}}addLodInstances(e,r,t){return{commands:[{id:"add-lod-instances",rendererId:e,groupId:r,data:t}],transferList:[t.featureIds.buffer,t.globalTransforms.buffer,t.localTransforms.buffer,t.visibility.buffer]}}removeLodInstances(e,r){return{commands:[{id:"remove-lod-instances",rendererId:e,groupId:r}],transferList:[]}}updateLodInstancesData(e,r,t){return{commands:[{id:"update-lod-instance-data",rendererId:e,groupId:r,globalTransforms:t}],transferList:[t.buffer]}}updateVisibility(e,r,t){return{commands:[{id:"update-visibility",rendererId:e,groupId:r,visibility:t}],transferList:[t.buffer]}}async dispatchRenderCommands(e){0!==e.commands.length&&await this._mainThreadDelegate.executeRenderCommands(e)}createRenderGeometryBuffer(n,a){const{materialId:i,visibilities:s,objectIds:o}=n,d=this._bufferWriters.get(i);if(null==d)throw new Error("no registered bufferWriter for material found");let m=null;if(n.transformation&&a)e(u,n.transformation),u[12]-=a[0],u[13]-=a[1],u[14]-=a[2],m=u;else{if(a)throw new Error("not implemented");n.transformation&&(m=n.transformation)}let f=null;m&&(r(l,u),t(l,l),f=l);const b=n.attributes,p=d.elementCount(b),y=d.layout,h=y.stride/4;p>Math.floor(c/h)&&console.warn("geometry with very large number of elements encountered");const g=y.createBuffer(p),I=0,w=d.write(m,f,b,n.olidColor,g,I);if(null==w)throw new Error("Bufferwriter.write does not provide item information.");if(s.length!==w.numItems||o.length!==w.numItems)throw new Error("Unexpected mismatch between number of RenderGeometryBufferItems and provided objectIds/visibility flags.");return{renderGeometryBuffer:{data:g.buffer,elementCount:p},renderGeometryBufferItems:{objectIds:o,visibilities:s,ranges:{numVertices:w.numVerticesPerItem,numItems:w.numItems}}}}async setBaseInstance(e,r){await this._mainThreadDelegate.setBaseInstance(e,r)}}const u=n(),l=n(),c=16777216/4;export{f as RenderCommandContext};
@@ -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"../../../../../../Color.js";import{create as t}from"../../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{ONES as r}from"../../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ZEROS as i}from"../../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{defaultPrimitive as n}from"../../../../../../symbols/support/IconSymbol3DLayerResource.js";import{mixinColorAndOpacity as o}from"../../graphicUtils.js";import{namedAnchorToHUDMaterialAnchorPos as a}from"../../placementUtils.js";import{PipelineCommand as l}from"../PipelineCommand.js";import{computeTileCenterRenderCoordinates as s,readObjectIds as m,readMapCoordinates as c,projectToRenderCoordinates as d}from"../featureData/processingUtils.js";import{inputAttributesToAttributesMap as u}from"./symbolizationUtils.js";import{createTextureInfo as y,requiresHalfTexelOffset as p,defaultBoundingBox as _}from"../../../../support/engineContent/sdfPrimitives.js";import{Attribute as C}from"../../../../webgl-engine/lib/Attribute.js";class h{constructor(e,t){this._context=null,this._symbolLayer=null,this._draped=!1,this._loaded=!1,this._loadingPromise=null,this._iconTextureID=null,this._materialId=null,this._context=t,this._symbolLayer=e}get loaded(){return this._loaded}load(){return null==this._loadingPromise&&(this._loadingPromise=this._load()),this._loadingPromise}_destroy(){this._iconTextureID=null}async _load(){const e=this._context.renderCommandContext,t=await e.createTexture(()=>y("circle"));this._iconTextureID=t;const r={anchorPosition:a.center,occlusionTest:!0,hasSlicePlane:!1,color:this._getFillColor(),outlineColor:this._getOutlineColor(),outlineSize:1,distanceFieldBoundingBox:_,textureId:t,textureIsSignedDistanceField:!0,sampleSignedDistanceFieldTexelCenter:p("circle")},i=new Uint8Array(8),n=0,o=255;i[0]=n,i[1]=n,i[2]=n,i[3]=o,i[4]=o,i[5]=n,i[6]=o,i[7]=o,this._materialId=await e.createMaterial({type:"hud",parameters:r}),await e.createDirectRenderer(this._materialId),await e.setBaseInstance(this._materialId,{data:i.buffer,elementCount:4}),this._loaded=!0}async createAddCommand(e){const{_materialId:t,_context:r}=this,{renderCommandContext:i}=r;if(null==t)throw new Error("expected material not to be null");const n=await this._createGeometry(e);if(null==n)return r.createPipelineCommand();const o=s(e,r),a=!0;return r.createPipelineCommand(i.addDirectRendererGeometry(e.id,n,o,a))}async _createGeometry(e){const{_materialId:r,_context:i}=this,{mainThreadDelegate:n}=i,{featureCount:o}=e;if(0===o||null==r)return null;const a=m(e),l=c(e),s=await n.applyElevationAlignmentTo(l),y=d(s,i),p=new Float64Array([0,0,1]),_=new Float64Array([255,255,255,255]),h=new Float64Array([24,24]),f=new Float64Array([0,0,0,1]),g=new Float64Array([0]),x=new Uint32Array(o);for(let t=0;t<o;++t)x[t]=t;const w=new Uint32Array(o);for(let t=0;t<o;++t)w[t]=0;const b=[["position",new C(y,x,3,!0)],["normal",new C(p,w,3,!0)],["color",new C(_,w,4,!0)],["rotation",new C(g,w,1,!0)],["size",new C(h,w,2,!0)],["centerOffsetAndDistance",new C(f,w,4,!0)]],I=new Uint8Array(o);e.getVisibilityArray(I);return{attributes:u(b),olidColor:void 0,transformation:t(),materialId:r,objectIds:a,visibilities:I}}async createRemoveCommand(e){const{_materialId:t,_context:r}=this,i=r.renderCommandContext;return null==t?r.createPipelineCommand():r.createPipelineCommand(i.removeDirectRendererGeometryBuffer(t,e))}async createUpdateVisibilityCommand(e){const{_materialId:t,_context:r}=this,i=r.renderCommandContext;if(null==t)return r.createPipelineCommand();const n=new Uint8Array(e.featureCount);return e.getVisibilityArray(n),r.createPipelineCommand(i.updateVisibility(t,e.id,n))}async createUpdateLayerViewOpacityCommand(e){const{_context:t,_materialId:r}=this,i=t.renderCommandContext;return null==r?t.createPipelineCommand():t.createPipelineCommand(i.updateMaterial({type:"hud",materialId:r,parameters:{color:this._getFillColor(),outlineColor:this._getOutlineColor()}}))}async createUpdateElevationCommand(e){const{_materialId:t,_context:r}=this,{renderCommandContext:i}=r,{featureCount:n,id:o}=e;if(null==t||0===n)return r.createPipelineCommand();const a=await this._createGeometry(e);if(null==a)return r.createPipelineCommand();const l=s(e,r),m=!0;return r.createPipelineCommand(i.updateDirectRendererGeometry(o,a,l,m))}async createDestroyCommand(){const{_iconTextureID:e,_context:t}=this,r=t.renderCommandContext;let i;return i=null!=e?await r.releaseTexture(e):l.create(r),i.appendPipelineStateCommand(()=>this._destroy()),i}_getOutlineColor(){const t=this._getLayerOpacity(),r=this._symbolLayer,i=r?.outline?.color;if(null!=i){const r=e.toUnitRGB(i),n=i.a*t;return[r[0],r[1],r[2],n]}return[0,0,0,0]}_getFillColor(){if(f(this._getPrimitive()))return w;const e=null==this._getPrimitive(),t=this._symbolLayer?.material?.color;return this._getCombinedOpacityAndColor(t,{hasIntrinsicColor:e})}_getLayerOpacity(){return this._context.layerViewInfo.fullOpacity}_getCombinedOpacity(e,t=x){const r=this._draped?1:this._getLayerOpacity();return e?r*e.a:t.hasIntrinsicColor?r:0}_getCombinedOpacityAndColor(t,i=x){const n=this._getCombinedOpacity(t,i),a=null!=t?e.toUnitRGB(t):r;return o(a,n)}_getPrimitive(){return g(this._symbolLayer)}}function f(e){return null!=e&&("cross"===e||"x"===e)}function g(e){return e.resource?.href?null:e.resource?.primitive??n}const x={hasIntrinsicColor:!1},w=i;export{h as IconSymbolLayerRenderer,x as defaultMaterialOptions,g as getPrimitive,f as isOutlineOnly,w as transparentUnit};
5
+ import e from"../../../../../../Color.js";import{create as t}from"../../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{ONES as r}from"../../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ZEROS as i}from"../../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{defaultPrimitive as n}from"../../../../../../symbols/support/IconSymbol3DLayerResource.js";import{mixinColorAndOpacity as o}from"../../graphicUtils.js";import{namedAnchorToHUDMaterialAnchorPos as a}from"../../placementUtils.js";import{PipelineCommand as l}from"../PipelineCommand.js";import{computeTileCenterRenderCoordinates as s,readObjectIds as m,readMapCoordinates as c,projectToRenderCoordinates as d}from"../featureData/processingUtils.js";import{inputAttributesToAttributesMap as u}from"./symbolizationUtils.js";import{createTextureInfo as y,requiresHalfTexelOffset as p,defaultBoundingBox as _}from"../../../../support/engineContent/sdfPrimitives.js";import{Attribute as C}from"../../../../webgl-engine/lib/Attribute.js";class h{constructor(e,t){this._context=null,this._symbolLayer=null,this._draped=!1,this._loaded=!1,this._loadingPromise=null,this._iconTextureID=null,this._materialId=null,this._context=t,this._symbolLayer=e}get loaded(){return this._loaded}load(){return null==this._loadingPromise&&(this._loadingPromise=this._load()),this._loadingPromise}_destroy(){this._iconTextureID=null}async _load(){const e=this._context.renderCommandContext,t=await e.createTexture(()=>y("circle"));this._iconTextureID=t;const r={anchorPosition:a.center,occlusionTest:!0,hasSlicePlane:!1,color:this._getFillColor(),outlineColor:this._getOutlineColor(),outlineSize:1,distanceFieldBoundingBox:_,textureId:t,textureIsSignedDistanceField:!0,sampleSignedDistanceFieldTexelCenter:p("circle")},i=new Uint8Array(8),n=0,o=255;i[0]=n,i[1]=n,i[2]=n,i[3]=o,i[4]=o,i[5]=n,i[6]=o,i[7]=o,this._materialId=await e.createMaterial({type:"hud",parameters:r}),await e.createDirectRenderer(this._materialId),await e.setBaseInstance(this._materialId,{data:i.buffer,elementCount:4}),this._loaded=!0}async createAddCommand(e){const{_materialId:t,_context:r}=this,{renderCommandContext:i}=r;if(null==t)throw new Error("expected material not to be null");const n=await this._createGeometry(e);if(null==n)return r.createPipelineCommand();const o=s(e,r);return r.createPipelineCommand(i.addDirectRendererGeometry(e.id,n,o))}async _createGeometry(e){const{_materialId:r,_context:i}=this,{mainThreadDelegate:n}=i,{featureCount:o}=e;if(0===o||null==r)return null;const a=m(e),l=c(e),s=await n.applyElevationAlignmentTo(l),y=d(s,i),p=new Float64Array([0,0,1]),_=new Float64Array([255,255,255,255]),h=new Float64Array([24,24]),f=new Float64Array([0,0,0,1]),g=new Float64Array([0]),x=new Uint32Array(o);for(let t=0;t<o;++t)x[t]=t;const w=new Uint32Array(o);for(let t=0;t<o;++t)w[t]=0;const b=[["position",new C(y,x,3,!0)],["normal",new C(p,w,3,!0)],["color",new C(_,w,4,!0)],["rotation",new C(g,w,1,!0)],["size",new C(h,w,2,!0)],["centerOffsetAndDistance",new C(f,w,4,!0)]],I=new Uint8Array(o);e.getVisibilityArray(I);return{attributes:u(b),olidColor:void 0,transformation:t(),materialId:r,objectIds:a,visibilities:I}}async createRemoveCommand(e){const{_materialId:t,_context:r}=this,i=r.renderCommandContext;return null==t?r.createPipelineCommand():r.createPipelineCommand(i.removeDirectRendererGeometryBuffer(t,e))}async createUpdateVisibilityCommand(e){const{_materialId:t,_context:r}=this,i=r.renderCommandContext;if(null==t)return r.createPipelineCommand();const n=new Uint8Array(e.featureCount);return e.getVisibilityArray(n),r.createPipelineCommand(i.updateVisibility(t,e.id,n))}async createUpdateLayerViewOpacityCommand(e){const{_context:t,_materialId:r}=this,i=t.renderCommandContext;return null==r?t.createPipelineCommand():t.createPipelineCommand(i.updateMaterial({type:"hud",materialId:r,parameters:{color:this._getFillColor(),outlineColor:this._getOutlineColor()}}))}async createUpdateElevationCommand(e){const{_materialId:t,_context:r}=this,{renderCommandContext:i}=r,{featureCount:n,id:o}=e;if(null==t||0===n)return r.createPipelineCommand();const a=await this._createGeometry(e);if(null==a)return r.createPipelineCommand();const l=s(e,r);return r.createPipelineCommand(i.updateDirectRendererGeometry(o,a,l))}async createDestroyCommand(){const{_iconTextureID:e,_context:t}=this,r=t.renderCommandContext;let i;return i=null!=e?await r.releaseTexture(e):l.create(r),i.appendPipelineStateCommand(()=>this._destroy()),i}_getOutlineColor(){const t=this._getLayerOpacity(),r=this._symbolLayer,i=r?.outline?.color;if(null!=i){const r=e.toUnitRGB(i),n=i.a*t;return[r[0],r[1],r[2],n]}return[0,0,0,0]}_getFillColor(){if(f(this._getPrimitive()))return w;const e=null==this._getPrimitive(),t=this._symbolLayer?.material?.color;return this._getCombinedOpacityAndColor(t,{hasIntrinsicColor:e})}_getLayerOpacity(){return this._context.layerViewInfo.fullOpacity}_getCombinedOpacity(e,t=x){const r=this._draped?1:this._getLayerOpacity();return e?r*e.a:t.hasIntrinsicColor?r:0}_getCombinedOpacityAndColor(t,i=x){const n=this._getCombinedOpacity(t,i),a=null!=t?e.toUnitRGB(t):r;return o(a,n)}_getPrimitive(){return g(this._symbolLayer)}}function f(e){return null!=e&&("cross"===e||"x"===e)}function g(e){return e.resource?.href?null:e.resource?.primitive??n}const x={hasIntrinsicColor:!1},w=i;export{h as IconSymbolLayerRenderer,x as defaultMaterialOptions,g as getPrimitive,f as isOutlineOnly,w as transparentUnit};
@@ -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};