@arcgis/core 5.0.0-next.34 → 5.0.0-next.36

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 (232) hide show
  1. package/applications/Components/SketchTooltipControls.js +1 -1
  2. package/assets/esri/core/workers/RemoteClient.js +1 -1
  3. package/assets/esri/core/workers/chunks/06462b267ff8d5984882.js +1 -0
  4. package/assets/esri/core/workers/chunks/{b48bb38e5d60fc7a9097.js → 08ef90e3fcfd4eda4301.js} +1 -1
  5. package/assets/esri/core/workers/chunks/0a58b57e1777a8b0ea23.js +1 -0
  6. package/assets/esri/core/workers/chunks/{7115c52e22b7becff8de.js → 103153951ba312dc5e9e.js} +1 -1
  7. package/assets/esri/core/workers/chunks/15c1a48e8cd2a8882d85.js +1 -0
  8. package/assets/esri/core/workers/chunks/{f55328aabf84770c8e6a.js → 1817cf11e85afca947d3.js} +1 -1
  9. package/assets/esri/core/workers/chunks/{1dd867fa7c58c06b79ea.js → 1bacdd17e199e22b5cd1.js} +1 -1
  10. package/assets/esri/core/workers/chunks/20e4243ea563d05a5256.js +1 -0
  11. package/assets/esri/core/workers/chunks/234ffd08c2be03a0b9fe.js +1 -0
  12. package/assets/esri/core/workers/chunks/24a3c6f0154787968724.js +1 -0
  13. package/assets/esri/core/workers/chunks/{fafbacf2467e6883b6c9.js → 28db329528def851efd7.js} +1 -1
  14. package/assets/esri/core/workers/chunks/{2367bd1cb34799a3f08a.js → 30184e39129d9c66ea54.js} +1 -1
  15. package/assets/esri/core/workers/chunks/32d32d3c3b38a215d20d.js +1 -0
  16. package/assets/esri/core/workers/chunks/36130910ba141f34531b.js +1 -0
  17. package/assets/esri/core/workers/chunks/3f03165487c1c2340fff.js +1 -0
  18. package/assets/esri/core/workers/chunks/48d1a443b324753921de.js +1 -0
  19. package/assets/esri/core/workers/chunks/48e2737182c75005fb8f.js +1 -0
  20. package/assets/esri/core/workers/chunks/4f4d51181ae7db9fbe6d.js +1 -0
  21. package/assets/esri/core/workers/chunks/{05e55118dc0023d500fc.js → 5000a37fba27464d10ca.js} +1 -1
  22. package/assets/esri/core/workers/chunks/{fa01d1813fa78034526e.js → 51355866a0dcf41cfded.js} +1 -1
  23. package/assets/esri/core/workers/chunks/{486e69261aa2caf9ec3c.js → 52c8687b473c9953c2f2.js} +1 -1
  24. package/assets/esri/core/workers/chunks/{fee942ef802a162e0248.js → 5dc0d853c21ccb6054c7.js} +1 -1
  25. package/assets/esri/core/workers/chunks/640085b5ade5c7f16228.js +1 -0
  26. package/assets/esri/core/workers/chunks/727804cf901094b1d620.js +1 -0
  27. package/assets/esri/core/workers/chunks/{0446562aee0639c61485.js → 7420fa18ba12014b22ea.js} +1 -1
  28. package/assets/esri/core/workers/chunks/768d9b6eaba7bfa18dde.js +1 -0
  29. package/assets/esri/core/workers/chunks/{c9c2e00fed979c21e2f0.js → 8a946cbc816f373c136b.js} +1 -1
  30. package/assets/esri/core/workers/chunks/8c271e9272e4eaf1325a.js +1 -0
  31. package/assets/esri/core/workers/chunks/{2a0fe1aede5c68374ccf.js → 8ec238b5b59ef18a1713.js} +1 -1
  32. package/assets/esri/core/workers/chunks/{f1dfb1323d50247e80f9.js → 9110287f272141f60c35.js} +1 -1
  33. package/assets/esri/core/workers/chunks/951a3442d4342539f2ea.js +1 -0
  34. package/assets/esri/core/workers/chunks/9664d9e679abc41f6c42.js +1 -0
  35. package/assets/esri/core/workers/chunks/{2921f05a40fda12f9f81.js → a00bba1c7cbf8cd7892c.js} +1 -1
  36. package/assets/esri/core/workers/chunks/a716b8fdeda4e16f03ab.js +1 -0
  37. package/assets/esri/core/workers/chunks/aead7c9830fa310e5b53.js +1 -0
  38. package/assets/esri/core/workers/chunks/{483dc4ee5d73cdfe6229.js → b075d3714fab0591d67c.js} +1 -1
  39. package/assets/esri/core/workers/chunks/{82cc758bddd9f8397b9f.js → b451dc416eebd0931ef8.js} +4 -4
  40. package/assets/esri/core/workers/chunks/b59be95949445ff5afab.js +1 -0
  41. package/assets/esri/core/workers/chunks/b6dec5dfdeca54bae88d.js +1 -0
  42. package/assets/esri/core/workers/chunks/{4356274cfa477eb6d749.js → bfb9cbe59d36d18f9157.js} +1 -1
  43. package/assets/esri/core/workers/chunks/{6afd59412bfc134bdf75.js → c052fb8c952cda0b5d13.js} +1 -1
  44. package/assets/esri/core/workers/chunks/{f2ebd6471e1259a6eac0.js → c9e7cc5d853908ab5b2f.js} +1 -1
  45. package/assets/esri/core/workers/chunks/{97650ee3d0eecb69ccbb.js → d8623f5f13a084e439c2.js} +5 -5
  46. package/assets/esri/core/workers/chunks/dd105d6e0fcedee32644.js +1 -0
  47. package/assets/esri/core/workers/chunks/e1148067ceae7d9eaaf8.js +1 -0
  48. package/assets/esri/core/workers/chunks/{b536fdb655ad293d9024.js → eb6218634a492667506a.js} +1 -1
  49. package/assets/esri/core/workers/chunks/{7804be2f5b3d86188a24.js → edc3d98f33d7bf959154.js} +1 -1
  50. package/assets/esri/core/workers/chunks/eefad79be500667af96e.js +1 -0
  51. package/assets/esri/core/workers/chunks/{63933cbcb5c12df09715.js → f1ac1c8b1331ec79e898.js} +1 -1
  52. package/assets/esri/core/workers/chunks/{2b7f9a57a2cfbc108673.js → f1b99529e2055873b65a.js} +1 -1
  53. package/assets/esri/core/workers/chunks/f693a4d97b2762d0e6ff.js +1 -0
  54. package/assets/esri/core/workers/chunks/f8caceeaa14d99c35526.js +1 -0
  55. package/assets/esri/core/workers/chunks/febce0d80f019dc2a427.js +1 -0
  56. package/assets/esri/libs/lyr3d/lyr3DMain.wasm +0 -0
  57. package/assets/esri/rest/knowledgeGraph/wasmInterface/arcgis-knowledge-client-core-simd.wasm +0 -0
  58. package/assets/esri/rest/knowledgeGraph/wasmInterface/arcgis-knowledge-client-core.wasm +0 -0
  59. package/assets/esri/themes/base/widgets/_Attribution.scss +1 -0
  60. package/assets/esri/themes/dark/main.css +1 -1
  61. package/assets/esri/themes/light/main.css +1 -1
  62. package/assets/esri/themes/light/view.css +1 -1
  63. package/chunks/Magnifier.glsl.js +1 -1
  64. package/chunks/arcgis-knowledge-client-core-simd.js +1 -1
  65. package/chunks/arcgis-knowledge-client-core.js +1 -1
  66. package/chunks/cameraUtilsSpherical.js +1 -1
  67. package/chunks/vec42.js +1 -1
  68. package/config.js +1 -1
  69. package/core/libs/gl-matrix-2/math/quat.js +1 -1
  70. package/core/libs/gl-matrix-2/math/vec4.js +1 -1
  71. package/core/workers/registry.js +1 -1
  72. package/geometry/geometryEngineJSON.js +1 -1
  73. package/geometry/support/aaBoundingRect.js +1 -1
  74. package/geometry/support/buffer/BufferView.js +1 -1
  75. package/geometry/support/buffer/internals/Vec4.js +1 -1
  76. package/geometry/support/coordsUtils.js +1 -1
  77. package/geometry/support/curves/curveUtils.js +1 -1
  78. package/geometry/support/curves/interpolateCurve.js +5 -0
  79. package/geometry/support/meshUtils/Metadata.js +1 -1
  80. package/geometry/support/vector.js +1 -1
  81. package/interfaces.d.ts +134 -420
  82. package/kernel.js +1 -1
  83. package/layers/GaussianSplatLayer.js +1 -1
  84. package/layers/IntegratedMesh3DTilesLayer.js +1 -1
  85. package/layers/IntegratedMeshLayer.js +1 -1
  86. package/layers/SceneLayer.js +1 -1
  87. package/layers/graphics/data/QueryEngine.js +1 -1
  88. package/layers/graphics/data/QueryEngineResult.js +1 -1
  89. package/layers/graphics/sources/support/uploadAssets.js +1 -1
  90. package/package.json +1 -1
  91. package/rest/knowledgeGraph/DataModel.js +1 -1
  92. package/rest/knowledgeGraph/GraphDataModelSingletonOperationResult.d.ts +4 -0
  93. package/rest/knowledgeGraph/GraphDataModelSingletonOperationResult.js +5 -0
  94. package/rest/knowledgeGraph/GraphProperty.js +1 -1
  95. package/rest/knowledgeGraph/wasmInterface/WasmDataModelWrapperInterfaces.js +1 -1
  96. package/rest/knowledgeGraph/wasmInterface/updateToWasmEncodedFactories.js +1 -1
  97. package/rest/knowledgeGraph/wasmInterface/wasmToDataModelChangeResponseFactories.js +1 -1
  98. package/rest/knowledgeGraph/wasmInterface/wasmToDataModelFactories.js +1 -1
  99. package/rest/knowledgeGraphService.d.ts +3 -0
  100. package/rest/knowledgeGraphService.js +1 -1
  101. package/smartMapping/statistics/support/statsWorker.js +1 -1
  102. package/support/revision.js +1 -1
  103. package/views/2d/interactive/SegmentLabels2D.js +5 -0
  104. package/views/3d/GroundView3D.js +1 -1
  105. package/views/3d/analysis/ElevationProfile/ElevationProfileLineSceneComputation.js +1 -1
  106. package/views/3d/analysis/LineOfSight/LineOfSightRayIntersector.js +1 -1
  107. package/views/3d/environment/ChapmanAtmosphere.js +1 -1
  108. package/views/3d/environment/Fog.js +1 -1
  109. package/views/3d/interactive/SegmentLabels3D.js +1 -1
  110. package/views/3d/interactive/visualElements/ExtendedLineVisualElement.js +1 -1
  111. package/views/3d/interactive/visualElements/MeasurementAreaVisualElement.js +1 -1
  112. package/views/3d/interactive/visualElements/MeasurementArrowVisualElement.js +1 -1
  113. package/views/3d/interactive/visualElements/OutlineVisualElement.js +1 -1
  114. package/views/3d/interactive/visualElements/ParallelLineVisualElement.js +1 -1
  115. package/views/3d/interactive/visualElements/PointVisualElement.js +1 -1
  116. package/views/3d/interactive/visualElements/RightAngleQuadVisualElement.js +1 -1
  117. package/views/3d/interactive/visualElements/SlicePlaneVisualElement.js +1 -1
  118. package/views/3d/interactive/visualElements/VerticesVisualElement.js +1 -1
  119. package/views/3d/layers/DrapedSubView3D.js +1 -1
  120. package/views/3d/layers/I3SMeshView3D.js +1 -1
  121. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  122. package/views/3d/layers/IntegratedMeshLayerView3D.js +1 -1
  123. package/views/3d/layers/graphics/Deconflictor.js +1 -1
  124. package/views/3d/layers/graphics/Graphics3DFrustumVisibility.js +1 -1
  125. package/views/3d/layers/graphics/Graphics3DLineSymbolLayer.js +1 -1
  126. package/views/3d/layers/graphics/Graphics3DSymbolLayer.js +1 -1
  127. package/views/3d/layers/graphics/Graphics3DWaterSymbolLayer.js +1 -1
  128. package/views/3d/layers/graphics/graphicUtils.js +1 -1
  129. package/views/3d/layers/i3s/PointCloudRenderer.js +1 -1
  130. package/views/3d/layers/support/FastSymbolUpdates.js +1 -1
  131. package/views/3d/layers/support/Tiles3DIntersectionHandler.js +1 -1
  132. package/views/3d/state/ConstraintsManager.js +1 -1
  133. package/views/3d/state/ViewStateManager.js +1 -1
  134. package/views/3d/support/flow/FlowSubViewTiles3D.js +1 -1
  135. package/views/3d/support/gaussianSplatting/GaussianSplatFadeTexture.js +1 -1
  136. package/views/3d/support/gaussianSplatting/GaussianSplatOrderTexture.js +1 -1
  137. package/views/3d/support/gaussianSplatting/GaussianSplatTextureAtlas.js +1 -1
  138. package/views/3d/support/pointsOfInterest/CenterOnSurface.js +1 -1
  139. package/views/3d/support/pointsOfInterest/PointsOfInterest.js +1 -1
  140. package/views/3d/support/pointsOfInterest/StableSurfaceCenter.js +1 -1
  141. package/views/3d/terrain/Overlay.js +1 -1
  142. package/views/3d/terrain/OverlayManager.js +1 -1
  143. package/views/3d/terrain/PatchRenderData.js +1 -1
  144. package/views/3d/terrain/ScaleRangeQueries.js +1 -1
  145. package/views/3d/terrain/TerrainSurface.js +1 -1
  146. package/views/3d/terrain/TextureFader.js +1 -1
  147. package/views/3d/terrain/TextureReference.js +1 -1
  148. package/views/3d/terrain/Tile.js +1 -1
  149. package/views/3d/webgl/RenderCamera.js +1 -1
  150. package/views/3d/webgl-engine/collections/Component/ComponentObject.js +1 -1
  151. package/views/3d/webgl-engine/collections/Component/Material/ComponentData.glsl.js +18 -12
  152. package/views/3d/webgl-engine/core/shaderLibrary/TextureBackedBuffer.glsl.js +8 -8
  153. package/views/3d/webgl-engine/core/shaderLibrary/TextureBackedBufferFields.glsl.js +7 -12
  154. package/views/3d/webgl-engine/core/shaderLibrary/attributes/VerticalOffset.glsl.js +1 -1
  155. package/views/3d/webgl-engine/core/shaderLibrary/shading/EvaluateAmbientLighting.glsl.js +1 -1
  156. package/views/3d/webgl-engine/core/shaderLibrary/shading/WaterDistortion.glsl.js +1 -1
  157. package/views/3d/webgl-engine/core/shaderLibrary/util/CameraSpace.glsl.js +2 -2
  158. package/views/3d/webgl-engine/core/shaderModules/Texture2DUintDrawUniform.js +5 -0
  159. package/views/3d/webgl-engine/effects/haze/Haze.js +1 -1
  160. package/views/3d/webgl-engine/lib/GaussianSplatRenderNode.js +1 -1
  161. package/views/3d/webgl-engine/lib/MainFramebuffer.js +1 -1
  162. package/views/3d/webgl-engine/lib/PathGeometryData.js +1 -1
  163. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  164. package/views/3d/webgl-engine/lib/ShadowCastRenderer.js +1 -1
  165. package/views/3d/webgl-engine/lib/ShadowMap.js +1 -1
  166. package/views/3d/webgl-engine/lib/TextTextureAtlas.js +1 -1
  167. package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBackedBuffer.js +1 -1
  168. package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBackedBufferFields.js +1 -1
  169. package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBackedBufferLayout.js +1 -1
  170. package/views/3d/webgl-engine/lib/edgeRendering/EdgeRenderer.js +1 -1
  171. package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
  172. package/views/3d/webgl-engine/lib/edgeRendering/bufferLayouts.js +1 -1
  173. package/views/3d/webgl-engine/materials/DefaultLayouts.js +1 -1
  174. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  175. package/views/3d/webgl-engine/materials/renderers/MergedBuffer.js +1 -1
  176. package/views/3d/webgl-engine/shaders/AnimatedLine.glsl.js +1 -1
  177. package/views/3d/webgl-engine/shaders/ensureColor4.js +1 -1
  178. package/views/3d/webgl-engine/shaders/sources/edgeRenderer/EdgeUtil.glsl.js +18 -18
  179. package/views/Attribution.js +1 -1
  180. package/views/SceneView.js +1 -1
  181. package/views/draw/support/Reshape.js +1 -1
  182. package/views/interactive/SegmentLabels.js +1 -1
  183. package/views/interactive/coordinateHelper.js +1 -1
  184. package/views/interactive/editGeometry/EditGeometry.js +1 -1
  185. package/views/interactive/editGeometry/EditGeometryOperations.js +1 -1
  186. package/views/interactive/editGeometry/operations/SetAllVertexPositions.js +1 -1
  187. package/views/interactive/sketch/constraints.js +1 -1
  188. package/views/interactive/sketch/normalizedPoint.js +1 -1
  189. package/views/support/GroundElevationSampler.js +1 -1
  190. package/widgets/Editor/UpdateFeatureWorkflow.js +1 -1
  191. package/widgets/Editor/Upload.js +1 -1
  192. package/widgets/Editor/components/Settings.js +1 -1
  193. package/widgets/Editor/support/SketchController.js +1 -1
  194. package/widgets/Sketch/SketchViewModel.js +1 -1
  195. package/widgets/Sketch.js +1 -1
  196. package/widgets/support/SelectionList.js +1 -1
  197. package/widgets/support/SketchTooltipControls.js +1 -1
  198. package/assets/esri/core/workers/chunks/089221bac1f019692f48.js +0 -1
  199. package/assets/esri/core/workers/chunks/08957e462d06c4dc8ab5.js +0 -1
  200. package/assets/esri/core/workers/chunks/1bfe0b2bf38d4dee7fd6.js +0 -1
  201. package/assets/esri/core/workers/chunks/22d66d1c8dfccdbbcf30.js +0 -1
  202. package/assets/esri/core/workers/chunks/27bd88e1101873d4ce12.js +0 -1
  203. package/assets/esri/core/workers/chunks/484cd728dd17b8dc1f72.js +0 -1
  204. package/assets/esri/core/workers/chunks/53d95ba86d010231fc4e.js +0 -1
  205. package/assets/esri/core/workers/chunks/61cb30e2e8edd18ebbf0.js +0 -1
  206. package/assets/esri/core/workers/chunks/6c8f5a56e94fdbe6a4a5.js +0 -1
  207. package/assets/esri/core/workers/chunks/745fc2b89fd7d816f2e0.js +0 -1
  208. package/assets/esri/core/workers/chunks/79c7391f00a55e7bcf6b.js +0 -1
  209. package/assets/esri/core/workers/chunks/7f8b85de079614b9c336.js +0 -1
  210. package/assets/esri/core/workers/chunks/a4b7ba8aec109beb5b4d.js +0 -1
  211. package/assets/esri/core/workers/chunks/a5f2da24497349239648.js +0 -1
  212. package/assets/esri/core/workers/chunks/a7b1b42bdb9cb9ecac45.js +0 -1
  213. package/assets/esri/core/workers/chunks/acaaefd4997316d319b8.js +0 -1
  214. package/assets/esri/core/workers/chunks/c6cc3db057da49755d15.js +0 -1
  215. package/assets/esri/core/workers/chunks/cc7c37f9ed3f831fd25c.js +0 -1
  216. package/assets/esri/core/workers/chunks/d14bd320f72d8e8a0ad8.js +0 -1
  217. package/assets/esri/core/workers/chunks/d6d03f22c91f528b97e5.js +0 -1
  218. package/assets/esri/core/workers/chunks/d86e59da76eea888ba86.js +0 -1
  219. package/assets/esri/core/workers/chunks/de99c4fd1582a8e610cf.js +0 -1
  220. package/assets/esri/core/workers/chunks/ded3ef385d5a3a2ec8ca.js +0 -1
  221. package/assets/esri/core/workers/chunks/e3a994587f9b2e88db85.js +0 -1
  222. package/assets/esri/core/workers/chunks/ea5bf896acfcc3106bf5.js +0 -1
  223. package/assets/esri/core/workers/chunks/eab0938d4ad7d7cc7309.js +0 -1
  224. package/assets/esri/core/workers/chunks/ed1dabed10ff9f4e0369.js +0 -1
  225. package/assets/esri/core/workers/chunks/effbc4d240752e8ba0ab.js +0 -1
  226. package/assets/esri/core/workers/chunks/f403d8e414766fab2936.js +0 -1
  227. package/assets/esri/core/workers/chunks/f8a5b26e0231244972d8.js +0 -1
  228. package/chunks/geometryEngineJSON.js +0 -5
  229. package/geometry/geometryEngineAsync.d.ts +0 -39
  230. package/geometry/geometryEngineAsync.js +0 -5
  231. package/geometry/geometryEngineWorker.js +0 -5
  232. package/views/3d/webgl-engine/collections/Component/Material/ComponentDataConstants.js +0 -5
@@ -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 has from"../../../core/has.js";import t from"../../../core/Logger.js";import{destroyMaybe as i,removeMaybe as r}from"../../../core/maybe.js";import{throwIfAborted as s}from"../../../core/promiseUtils.js";import{initial as o,watch as n}from"../../../core/reactiveUtils.js";import{schedule as a}from"../../../core/scheduling.js";import{property as l,subclass as c}from"../../../core/accessorSupport/decorators.js";import{fromMat4 as d,invert as h}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{create as m,IDENTITY as u}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as p}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{fromValues as f}from"../../../core/libs/gl-matrix-2/factories/quatf64.js";import{i as g,b,t as y}from"../../../chunks/vec32.js";import{freeze as _,create as w}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as v}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{SphericalECEFSpatialReferenceLike as j,getReferenceEllipsoid as M}from"../../../geometry/ellipsoidUtils.js";import{computeTranslationToOriginAndRotation as x}from"../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{localLinearScaleFactors as O}from"../../../geometry/projection/localLinearScaleFactors.js";import{projectVectorToVector as C}from"../../../geometry/projection/projectVectorToVector.js";import{create as T}from"../../../geometry/support/aaBoundingRect.js";import{BufferViewVec2f as U,BufferViewVec4f as H,BufferViewVec4u8 as P,BufferViewVec4u16 as R,BufferViewVec3f as E,BufferViewVec3u8 as S,BufferViewVec3u16 as V,BufferViewInt16 as A,BufferViewUint32 as I,BufferViewUint16 as k}from"../../../geometry/support/buffer/BufferView.js";import F from"../../../layers/support/SceneModification.js";import{getElevationOffsetInMeters as D}from"../../../support/elevationInfoUtils.js";import{toWasmModification as L}from"./I3SMeshWorkerHandle.js";import{LayerView3D as B}from"./LayerView3D.js";import{Lyr3DViewPerformanceInfo as G}from"./Lyr3DViewPerformanceInfo.js";import{addLayerViewToWasm as N,removeLayerViewFromWasm as z,getLyr3DWasm as W}from"./Lyr3DWasm.js";import{LayerElevationProvider as $}from"./i3s/LayerElevationProvider.js";import{primTypeConversion as q,alphaModeConversion as J,faceCullingConversion as K,wrapModeConversion as Q,lyr3DTypeToByteSize as X}from"./support/lyr3dTypeConversions.js";import{Tiles3DIntersectionHandler as Y}from"./support/Tiles3DIntersectionHandler.js";import{ElevationRange as Z}from"../support/ElevationRange.js";import{toBoundingRect as ee}from"../support/extentUtils.js";import{Obb as te,compute as ie}from"../support/orientedBoundingBox.js";import{ObjectParameters as re}from"../webgl-engine/collections/Component/ObjectParameters.js";import{GeometryParameters as se,createVertexBufferLayout as oe,SourceGeometry as ne}from"../webgl-engine/collections/Component/SourceGeometry.js";import{Transform as ae}from"../webgl-engine/collections/Component/Transform.js";import{RenderTexture as le}from"../webgl-engine/core/material/RenderTexture.js";import{getEllipsoidMode as ce}from"../webgl-engine/core/shaderLibrary/util/EllipsoidMode.js";import{Attribute as de}from"../webgl-engine/lib/Attribute.js";import{ManagedTexture as he}from"../webgl-engine/lib/ManagedTexture.js";import{compressAndTransformNormals as me}from"../webgl-engine/lib/Normals.js";import{writeAttribute as ue,writeBufferVec2 as pe}from"../webgl-engine/materials/internal/bufferWriterUtils.js";import fe from"../../layers/LayerView.js";import{spatialReferenceIncompatibleError as ge,isInEffectiveScaleRange as be}from"../../support/layerViewUtils.js";import{TextureCompressionTracker as ye}from"../../support/TextureCompressionTracker.js";import{alphaCutoff as _e}from"../../../webscene/support/AlphaCutoff.js";class we{constructor(e,t,i,r,s,o,n,a,l){this.handle=e,this.componentObjects=t,this.textures=i,this.cpuMemoryUsage=r,this.vboMemoryUsage=s,this.textureMemoryUsage=o,this.obb=n,this.stableNodeId=a,this.elevationRange=l,this.isVisible=!1,this.usedMemory=this.textureMemoryUsage+this.vboMemoryUsage+this.cpuMemoryUsage;const c=w();n?.getCenter(c),this._obbCenter=c,this._obbRadius=n?.radius??0,this._obbRadiusSquared=this._obbRadius**2}boundingVolumeIntersectsRay(e,t){if(!this.obb)return!0;const i=this._obbCenter,r=i[0]-e[0],s=i[1]-e[1],o=i[2]-e[2],n=r*t[0]+s*t[1]+o*t[2];return r*r+s*s+o*o-n*n<=this._obbRadiusSquared&&this.obb.intersectRay(e,t)}boundingVolumeIntersectsSphere(e){if(!this.obb)return!0;const t=e.center,i=this._obbCenter,r=i[0]-t[0],s=i[1]-t[1],o=i[2]-t[2];return r*r+s*s+o*o<=(this._obbRadius+e.radius)**2}expandElevationRange(e){e.expandElevationRange(this.elevationRange)}}function ve(e){return Math.round(e/1048.576)/1e3}let je=class extends(B(fe)){get hasModifications(){return this._modifications&&this._modifications.length>0}constructor(e){super(e),this.type="integrated-mesh-3dtiles",this._compressionTracker=new ye,this._modificationsUpdatingHandle=null,this._modifications=new Array,this._visibleGeometryChangedSchedulerHandle=null,this._wasmLayerId=-1,this.ignoresMemoryFactor=!1,this._usedMemory=0,this._cacheMemory=0,this.drapeTargetType=1,this._applySSAO=!has("disable-feature:im-ssao"),this._shadeNormals=!!has("enable-feature:im-shading"),this._lyrHandleToObjects=new Map,this._visibleObjects=new Set,this._suspendedHandle=null,this._dbgFlags=new Set,this._memCache=e.view.resourceController.memoryController.newCache(`IM3DTiles-${this.uid}`,e=>this._deletePerObjectData(e))}tryRecycleWith(e,t){return e.url!==this.layer.url||"integrated-mesh-3dtiles"!==e.type?null:e.load(t).then(()=>{s(t),this.layer=e,this._modificationsUpdatingHandle&&this._modificationsUpdatingHandle.remove(),this._modificationsUpdatingHandle=this._updatingHandles.add(()=>this.layer.modifications,()=>this._loadModifications(),o)})}initialize(){this._dbgFlags.add(3),this._dbg(2,"Tiles3DLayerView3D initialize() called");const{view:e}=this;if(this._modificationsUpdatingHandle=this._updatingHandles.add(()=>this.layer.modifications,()=>this._loadModifications(),o),!this._canProjectWithoutEngine())throw ge("layer",this.layer.spatialReference.wkid,e.renderSpatialReference?.wkid);const t=N(this).then(t=>{this._wasmLayerId=t,this._intersectionHandler=new Y(this),e.sceneIntersectionHelper.addIntersectionHandler(this._intersectionHandler),this._updatingHandles.add(()=>this.slicePlaneEnabled,e=>this._slicePlaneEnabledChange(e)),this._updatingHandles.add(()=>this._modifications,()=>this._modificationsChanged(),o),this._updatingHandles.add(()=>this.fullOpacity,()=>this._opacityChange()),this._updatingHandles.add(()=>e.clippingArea,()=>this._clippingAreaChanged(),o),this._elevationProvider=new $({view:e,layerElevationSource:this,intersectionHandler:this._intersectionHandler}),e.elevationProvider.register(1,this._elevationProvider),e.overlayManager.registerDrapeTarget(this),this.addHandles([n(()=>this.layer.elevationInfo,e=>this._elevationInfoChanged(e))]),this._suspendedHandle=n(()=>this.suspended,e=>this._wasm?.setEnabled(this,!e),o)});this.addResolvingPromise(t)}get _replacesTerrain(){return this.layer.replacesTerrain&&!!this.view.map.basemap?.groundLayers.includes(this.layer)}get fullOpacity(){return 1}get opacity(){return 1}_opacityChange(){const{fullOpacity:e}=this;this.forEachComponentObject(t=>this._collection.updateMaterial(t,t=>t.objectOpacity=e))}intersect(e,t,i,r){this._intersectionHandler.intersect(e,t,i,r,null,!1)}get ready(){return!0}destroy(){this._dbg(2,"Tiles3DLayerView3D destroy() called"),z(this),this._suspendedHandle&&(this._suspendedHandle.remove(),this._suspendedHandle=null),this._intersectionHandler&&(this.view.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler),this._intersectionHandler=null),this._elevationProvider&&(this._elevationProvider.notifyObjectsChangedFunctional(e=>this.forEachComponentObject(t=>e(t.obb))),this.view.elevationProvider.unregister(this._elevationProvider),this._elevationProvider=null),this.view.overlayManager.unregisterDrapeTarget(this),this._lyrHandleToObjects.forEach(e=>this.freeObject(e)),this._lyrHandleToObjects.clear(),this._visibleObjects.clear(),this._usedMemory=this._cacheMemory=0,this._memCache.destroy(),this._updatingHandles=i(this._updatingHandles),this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle=r(this._visibleGeometryChangedSchedulerHandle)}_modificationsChanged(){const e=this.layer.spatialReference,t=L(this._layerClippingArea,this._modifications,e);this._wasm?.setMeshModifications(this,t,e.wkid)}_clippingAreaChanged(){const e=this.layer.spatialReference,t=T();this._layerClippingArea=ee(this.view.clippingArea,t,e)?t:null,this._modificationsChanged()}_visibleGeometryChanged(){this._visibleGeometryChangedSchedulerHandle??=a(()=>{this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle=null})}_slicePlaneEnabledChange(e){this._intersectionHandler&&(this._intersectionHandler.slicePlaneEnabled=e&&!this._replacesTerrain),this.forEachComponentObject(t=>this._collection.updateMaterial(t,t=>t.commonMaterialParameters.hasSlicePlane=e))}_elevationInfoChanged(e){this._wasm?.setLayerOffset(this,D(e))}get _wasm(){return W(this.view)}get wasmLayerId(){return this._wasmLayerId}get usedMemory(){return this._usedMemory}get unloadedMemory(){return 0}get cachedMemory(){return this._cacheMemory}get visibleAtCurrentScale(){return this.layer.replacesTerrain||be(this.layer.effectiveScaleRange,this.view.scale)}get performanceInfo(){let e=0,t=0,i=0,r=0,s=0,o=0;return this._lyrHandleToObjects.forEach(n=>{n.isVisible?(e+=n.textureMemoryUsage,t+=n.vboMemoryUsage,s++):(i+=n.textureMemoryUsage,r+=n.vboMemoryUsage,o++)}),new G(this.usedMemory,s,o,ve(t),ve(e),ve(r),ve(i))}_canProjectWithoutEngine(){if(2===this.view.state.viewingMode){const e=this.view.renderSpatialReference?.isWebMercator?3857:this.view.renderSpatialReference?.wkid??-1;if(3857!==e&&32662!==e)return!1}return!0}get _stage(){return this.view.stage}get _collection(){return this._stage.renderView.componentObjectCollection}get elevationProvider(){return this._elevationProvider}get elevationOffset(){return D(this.layer.elevationInfo)}get elevationRange(){const e=this.fullExtent;return e?.zmin&&e?.zmax?new Z(e.zmin,e.zmax):null}getElevationRange(e){return this._intersectionHandler.getElevationRange(e)}get fullExtent(){return this.layer.fullExtent}forEachComponentObject(e){this._forEachObject(this._lyrHandleToObjects.values(),e)}forEachVisibleTile(e){for(const t of this._visibleObjects)e(t)}forEachVisibleComponentObject(e){this._forEachObject(this._visibleObjects,e)}_forEachObject(e,t){for(const i of e)for(const e of i.componentObjects)t(e)}isUpdating(){const e=this._wasm;return this._wasmLayerId>=0&&null!=e&&(e.isUpdating(this._wasmLayerId)||this._compressionTracker.compressing)}updatingFlagChanged(){this.notifyChange("updating")}async createRenderable(e){if(this.destroyed){const e=`IntegratedMesh3DTilesLayerView3D[${this.layer?.title}]: createRenderable called on destroyed instance`;throw new Error(e)}let t=0;const{meshData:i}=e;if(null==i.data)throw new Error("meshData.data undefined");if(i.desc=JSON.parse(i.desc),null==i.desc)throw new Error("meshData.desc undefined");const r=_(...i.desc.origin),s=this.view.basemapTerrain.spatialReference;let o,n;if("global"===this.view.viewingMode){const e=p();x(j,r,e,s),o=d(m(),e),n=h(m(),o)}else o=u,n=u;const a=w(),l=Ce(i.desc.obb);let c=0,f=0;const T={textureMemoryUsage:0},H=new Array,P=new Map,R=i.desc.prims.length,E=new Array,S=new Z;try{const e="global"===this.view.viewingMode,t=e?M(this.view.spatialReference).radius:0;for(let d=0;d<R;d++){const h=i.desc.prims[d];this._dbg(2,JSON.stringify(h));if(null==q[h.ptype]||null==i.data){this._dbg(2,"[Unsupported Feature] Unsupported primitive mode ("+h.ptype+"). Skipping primitive.");continue}const m=i.desc?.materials&&null!=h.materialId?i.desc.materials[h.materialId]:null,p=null!=m?m.lightingModel:"Unlit",{positionView:_,positionAttr:j,normalsView:M,normalsAttr:x,colorAttr:R,texCoord0Attr:E,indicesView:V}=this.getBufferViews(h,i.data.buffer,o);if(null==j||null==_||null==V)continue;const A=new se(null!=R,E?1:0,null!=M,this._shadeNormals||this._replacesTerrain,this._applySSAO),I=j.data.length/j.size,k=(e,t)=>!e||e.data.length/e.size===I||(this._dbg(3,`${t} !== numPos. Skipping primitive.`),!1);if(!k(E,"numTexcoord")||!k(R,"numColors")||!k(x,"normals"))continue;const F=oe(A);for(let i=0;i<_.count;i++){_.getVec(i,a),g(a,a,r);const s=e?b(a)-t:a[2];S.expandElevationRangeValues(s,s)}const D=l?.clone()??Oe(j,r);if(o!==u)for(let e=0;e<_.count;e++)_.getVec(e,a),y(a,a,o),_.setVec(e,a);const L=F.createBuffer(j.data.length);if(ue("position",j,null,null,L,0),null!=E){const e=L.getField("uv0",U);pe(E,e,0)}null!=R&&ue("color",R,null,null,L,0),null!=x&&ue("normalCompressed",x,null,null,L,0);const B=new Uint32Array([0,V.typedBuffer.length]),G=new ne({data:L.buffer,count:L.byteLength/F.stride,layoutParameters:A},{positions:_.typedBuffer,indices:V.typedBuffer},V.typedBuffer,B);c+=_.count+V.count;const N=this.view.renderSpatialReference,z=w(),W=[1,1,1];O(r,N,W,s)||this._dbg(3,"Unsupported coordinate system for IM overlay"),C(r,N,z,s);let $=()=>{},Q=Promise.resolve(Ue);if(m){const e=e=>this._getTexture(e,i,P,T),t=e(m.baseColorTex),r="Pbr"===p,s=r?e(m.metalTex):null,o=r?e(m.emissiveTex):null,n=r?e(m.occlusionTex):null,a=r?e(m.normalTex):null,l=[t,s,o,n,a].map(e=>e?.loadPromise??null);Q=Promise.all(l),$=e=>{e.baseColor=m.baseColorFactor,e.usePBR="Pbr"===p,e.hasParametersFromSource=!1,e.baseColorTexture=t,e.usePBR&&(e.mrrFactors=[m.metallicFactor,m.roughnessFactor,0],e.emissiveBaseColor=m.emissiveFactor??[0,0,0],e.metallicRoughnessTexture=s,e.emissionTexture=o,e.occlusionTexture=n,e.normalTexture=a),e.alphaDiscardMode=J[m.alphaMode],e.objectOpacity=this.fullOpacity,T.textureMemoryUsage+=e.baseColorTexture?.texture?.usedMemory??0,e.usePBR&&(T.textureMemoryUsage+=(e.metallicRoughnessTexture?.texture?.usedMemory??0)+(e.emissionTexture?.texture?.usedMemory??0)+(e.occlusionTexture?.texture?.usedMemory??0)+(e.normalTexture?.texture?.usedMemory??0)),e.commonMaterialParameters.doubleSided=m.isDoubleSided,e.commonMaterialParameters.cullFace=K[m.faceCulling??"NotSet"],e.commonMaterialParameters.isGround=this.layer.replacesTerrain,e.commonMaterialParameters.hasSlicePlane=this.slicePlaneEnabled,e.componentParameters.castShadows=0,e.textureAlphaCutoff=m.alphaCutoff??_e,e.alphaDiscardMode=J[m.alphaMode],e.isIntegratedMesh=!0,e.sphereDepthInterpolate=this.layer.hasGoogleUrl,e.polygonOffsetEnabled=!1,e.hasOccludees=!1,e.ellipsoidMode=ce(this.view.spatialReference)}}const X=Q.then(()=>()=>{if(this.destroyed){const e="Trying to add object to destroyed layer view";throw this._dbg(3,`${e} !== numPos. Skipping primitive.`),new Error(e)}const e=this._collection.createObject(new re(v(z[0],z[1],W[0],W[1]),new ae(r,n),D,G,!1));return this._collection.updateMaterial(e,$),f+=this._collection.getObjectGPUMemoryUsage(e),e});H.push(X)}if(E.push(...await Promise.all(H)),this.destroyed){throw new Error("IntegratedMesh3DTilesLayerView3D: createRenderable object destroyed during call")}}catch(k){throw P.forEach(e=>this._stage.removeTexture(e)),k}const V=E.map(e=>e()),A=new Array;P.forEach(e=>A.push(e));const I=new we(e.handle,V,A,c,f,T.textureMemoryUsage,l,e.stableNodeId,S);return this._lyrHandleToObjects.set(e.handle,I),this._memCache.put(Te(I.handle),I),t=I.usedMemory,this._cacheMemory+=t,{memUsageBytes:I.usedMemory}}freeRenderable(e){const t=this._lyrHandleToObjects.get(e);t&&(t.isVisible?(this._visibleObjects.delete(t),this._usedMemory-=t.usedMemory):this._cacheMemory-=t.usedMemory,this.freeObject(t),this._lyrHandleToObjects.delete(e))}freeObject(e){const t=Te(e.handle);this._memCache.pop(t),e.textures.forEach(e=>this._stage.removeTexture(e)),e.componentObjects.forEach(e=>this._collection.destroyObject(e))}setRenderableVisibility(e,t,i){for(let r=0;r<i;++r){const i=t[r];if(!i)continue;const s=e[r],o=this._lyrHandleToObjects.get(s);if(o){if(o.isVisible)continue;this._visibleGeometryChanged(),o.isVisible=!0,this._visibleObjects.add(o),this._usedMemory+=o.usedMemory,this._cacheMemory-=o.usedMemory,o.componentObjects.forEach(e=>{this._collection.setObjectVisibility(e,i),this._elevationProvider.notifyObjectChanged(this._collection.getComponentObb(e))}),this._memCache.pop(Te(s))}}for(let r=0;r<i;++r){const i=e[r],s=t[r];if(s)continue;const o=this._lyrHandleToObjects.get(i);if(o){if(!o.isVisible)continue;this._visibleGeometryChanged(),o.isVisible=!1,this._visibleObjects.delete(o),this._usedMemory-=o.usedMemory,this._cacheMemory+=o.usedMemory,o.componentObjects.forEach(e=>{this._collection.setObjectVisibility(e,s),this._elevationProvider.notifyObjectChanged(this._collection.getComponentObb(e))}),this._memCache.put(Te(i),o)}}}setLodPixelThreshold(e){this._wasm?.setLodPixelThreshold(this,e)}_getTexture(e,t,i,r){const s=e&&t.desc?.images?.[e.imageId];if(!s||!t.data?.buffer)return null;const o=i.get(s)??this._createTexture(e,t,i,r);return o?new le(this._stage.renderView.textures,o.id):null}_createTexture(e,t,i,r){const s=e&&t.desc?.images?.[e.imageId];if(!s||!t.data?.buffer)return null;const o=this._stage,{renderView:n}=o,a=n.renderingContext.parameters.maxMaxAnisotropy,l=!!s.mipCount||a>1,c=Q[e.wrapMode??"None"];let d=s.alpha?6408:6407;const h=new Uint8Array(t.data.buffer,s.data.byteOffset,s.data.byteCount);let m=null,u=null,p=null;switch(s.format){case"Raw":"R8"===s.pixelFormat?(m=h,d=6403,u=""):"Rgb8"===s.pixelFormat?(m=h,d=6407,u=""):"Rgba8"===s.pixelFormat&&(m=h,d=6408,u="");break;case"Dxt1":m=h,d=6407,u="image/vnd-ms.dds";break;case"Dxt5":m=h,d=6408,u="image/vnd-ms.dds";break;case"Basis":m=h,d=6407,u="image/ktx2";break;case"Png":u="image/png",p=document.createElement("img");break;case"Jpeg":u="image/jpeg",p=document.createElement("img");break;case"Etc2":u="image/ktx",p=document.createElement("img");break;case"Astc":this._dbg(3,"Astc texture not supported");break;case"Pvrtc":this._dbg(3,"Pvrtc texture not supported")}if(p&&u){const e=new Blob([h],{type:u});p.src=URL.createObjectURL(e),m=p}if(m&&null!=u){const e=has("enable-feature:esri-compress-IM-textures")?{compressionTracker:this._compressionTracker,compressionCallback:e=>{e&&e>0&&(r.textureMemoryUsage-=e)}}:void 0,t=new he(m,{mipmap:l,maxAnisotropy:a,encoding:u,wrap:c,pixelFormat:d,compressionOptions:e,noUnpackFlip:!0,width:s.mip0Width,height:s.mip0Height});return this._stage.addTexture(t),i.set(s,t),t}return null}getBufferViews(e,t,i){let r,s,o,n,a,l,c,d=null;for(let m=0;m<e.atrbs.length;m++){const c=e.atrbs[m],{view:u}=c,p=void 0,f=u.byteOffset+u.byteCount,g=u.byteCount/X[u.type],b=new(He(g))(g);for(let e=0;e<g;++e)b[e]=e;try{switch(c.sem){case"Position":3!==u.ncomp||"F32"!==u.type?this._dbg(3,"[Unsupported Feature] Unsupported view for Position ("+u+")"):(r=new E(t,u.byteOffset,p,f),s=new de(r.typedBuffer,b,3));break;case"Normal":if(3!==u.ncomp||"F32"!==u.type)this._dbg(3,"[Unsupported Feature] Unsupported view for Normal ("+u+")");else{const e=new E(t,u.byteOffset,p,f),r=me(e.typedBuffer,i);a=new A(r.buffer),l=new de(a.typedBuffer,b,2)}break;case"TexCoord":2!==u.ncomp||"F32"!==u.type?this._dbg(3,"[Unsupported Feature] Unsupported view for Texcoord ("+u+")"):void 0===n&&(n=new de(new U(t,u.byteOffset,p,f).typedBuffer,b,2));break;case"Color":4===u.ncomp?("F32"===u.type&&(d=new H(t,u.byteOffset,p,f)),"U8"===u.type&&(d=new P(t,u.byteOffset,p,f)),"U16"===u.type&&(d=new R(t,u.byteOffset,p,f))):3===u.ncomp&&("F32"===u.type&&(d=new E(t,u.byteOffset,p,f)),"U8"===u.type&&(d=new S(t,u.byteOffset,p,f)),"U16"===u.type&&(d=new V(t,u.byteOffset,p,f))),null==d?this._dbg(2,"[Unsupported Feature] Unsupported view for Color ("+u+")"):o=new de(d.typedBuffer,b,u.ncomp);break;case"FeatureIndex":break;default:this._dbg(2,"[Unsupported Feature] Unsupported semantic ("+c.sem+"). Skipping vertex attribute.")}}catch(h){this._dbg(2,"Error Creating buffer ("+h+"). Skipping vertex attribute.")}}if(e.index){const i=e.index.view,r=void 0,s=i.byteOffset+i.byteCount;switch(e.index.view.type){case"U16":c=new k(t,i.byteOffset,r,s);break;case"U32":c=new I(t,i.byteOffset,r,s);break;default:this._dbg(3,"[Unsupported Feature] index type not supported ("+i.type+").")}}if(null==c&&null!=r){const e=r.count;c=c=e<65535?new k(new Uint16Array(e).buffer):new I(new Uint32Array(e).buffer);for(let t=0;t<e;t++)c.set(t,t)}return{positionView:r,positionAttr:s,colorAttr:o,texCoord0Attr:n,indicesView:c,normalsView:a,normalsAttr:l}}_loadModifications(){if(this.removeHandles("modifications"),null==this.layer.modifications)return void(this._modifications=[]);const e=this.layer.modifications;this.addHandles(this._updatingHandles.addOnCollectionChange(()=>e,()=>this._modifications=e.toArray(),o),"modifications")}_deletePerObjectData(e){this._wasm?.onRenderableEvicted(this,e.handle,e.usedMemory),this.freeRenderable(e.handle)}_dbg(e,i){this._dbgFlags.has(e)&&(3===e?t.getLogger(this).error(i):t.getLogger(this).warn(i))}};e([l()],je.prototype,"fullOpacity",null),e([l({type:[F]})],je.prototype,"_modifications",void 0),e([l()],je.prototype,"_visibleGeometryChangedSchedulerHandle",void 0),e([l()],je.prototype,"layer",void 0),e([l({readOnly:!0})],je.prototype,"visibleAtCurrentScale",null),e([l({readOnly:!0})],je.prototype,"_collection",null),e([l()],je.prototype,"elevationOffset",null),je=e([c("esri.views.3d.layers.IntegratedMesh3DTilesLayerView3D")],je);const Me=je,xe=w();function Oe(e,t){const i=ie(e);return g(xe,i.center,t),i.center=xe,i}function Ce(e){return e?new te(e.center,e.halfSize,f(...e.quaternion)):null}function Te(e){return`${e}`}const Ue=new Array;function He(e){return e<256?Uint8Array:e<65536?Uint16Array:Uint32Array}export{Me as default};
5
+ import{__decorate as e}from"tslib";import has from"../../../core/has.js";import t from"../../../core/Logger.js";import{destroyMaybe as i,removeMaybe as s}from"../../../core/maybe.js";import{throwIfAborted as r}from"../../../core/promiseUtils.js";import{initial as o,watch as n}from"../../../core/reactiveUtils.js";import{schedule as a}from"../../../core/scheduling.js";import{property as l,subclass as c}from"../../../core/accessorSupport/decorators.js";import{fromMat4 as d,invert as h}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{create as m,IDENTITY as u}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as p}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{fromValues as f}from"../../../core/libs/gl-matrix-2/factories/quatf64.js";import{i as g,b,t as y}from"../../../chunks/vec32.js";import{freeze as _,create as v}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as w}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{SphericalECEFSpatialReferenceLike as j,getReferenceEllipsoid as x}from"../../../geometry/ellipsoidUtils.js";import{computeTranslationToOriginAndRotation as M}from"../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{localLinearScaleFactors as C}from"../../../geometry/projection/localLinearScaleFactors.js";import{projectVectorToVector as O}from"../../../geometry/projection/projectVectorToVector.js";import{create as T}from"../../../geometry/support/aaBoundingRect.js";import{BufferViewVec2f as E,BufferViewVec4f as R,BufferViewVec4u8 as U,BufferViewVec4u16 as H,BufferViewVec3f as P,BufferViewVec3u8 as V,BufferViewVec3u16 as S,BufferViewInt16 as A,BufferViewUint32 as I,BufferViewUint16 as k}from"../../../geometry/support/buffer/BufferView.js";import F from"../../../layers/support/SceneModification.js";import{getElevationOffsetInMeters as D}from"../../../support/elevationInfoUtils.js";import{toWasmModification as L}from"./I3SMeshWorkerHandle.js";import{LayerView3D as B}from"./LayerView3D.js";import{Lyr3DViewPerformanceInfo as G}from"./Lyr3DViewPerformanceInfo.js";import{addLayerViewToWasm as N,removeLayerViewFromWasm as z,getLyr3DWasm as W}from"./Lyr3DWasm.js";import{LayerElevationProvider as $}from"./i3s/LayerElevationProvider.js";import{primTypeConversion as q,alphaModeConversion as J,faceCullingConversion as K,wrapModeConversion as Q,lyr3DTypeToByteSize as X}from"./support/lyr3dTypeConversions.js";import{Tiles3DIntersectionHandler as Y}from"./support/Tiles3DIntersectionHandler.js";import{ElevationRange as Z}from"../support/ElevationRange.js";import{toBoundingRect as ee}from"../support/extentUtils.js";import{Obb as te,compute as ie}from"../support/orientedBoundingBox.js";import{ObjectParameters as se}from"../webgl-engine/collections/Component/ObjectParameters.js";import{GeometryParameters as re,createVertexBufferLayout as oe,SourceGeometry as ne}from"../webgl-engine/collections/Component/SourceGeometry.js";import{Transform as ae}from"../webgl-engine/collections/Component/Transform.js";import{RenderTexture as le}from"../webgl-engine/core/material/RenderTexture.js";import{getEllipsoidMode as ce}from"../webgl-engine/core/shaderLibrary/util/EllipsoidMode.js";import{Attribute as de}from"../webgl-engine/lib/Attribute.js";import{ManagedTexture as he}from"../webgl-engine/lib/ManagedTexture.js";import{compressAndTransformNormals as me}from"../webgl-engine/lib/Normals.js";import{writeAttribute as ue,writeBufferVec2 as pe}from"../webgl-engine/materials/internal/bufferWriterUtils.js";import fe from"../../layers/LayerView.js";import{spatialReferenceIncompatibleError as ge,isInEffectiveScaleRange as be,validateScaleRange as ye}from"../../support/layerViewUtils.js";import{TextureCompressionTracker as _e}from"../../support/TextureCompressionTracker.js";import{alphaCutoff as ve}from"../../../webscene/support/AlphaCutoff.js";class we{constructor(e,t,i,s,r,o,n,a,l){this.handle=e,this.componentObjects=t,this.textures=i,this.cpuMemoryUsage=s,this.vboMemoryUsage=r,this.textureMemoryUsage=o,this.obb=n,this.stableNodeId=a,this.elevationRange=l,this.isVisible=!1,this.usedMemory=this.textureMemoryUsage+this.vboMemoryUsage+this.cpuMemoryUsage;const c=v();n?.getCenter(c),this._obbCenter=c,this._obbRadius=n?.radius??0,this._obbRadiusSquared=this._obbRadius**2}boundingVolumeIntersectsRay(e,t){if(!this.obb)return!0;const i=this._obbCenter,s=i[0]-e[0],r=i[1]-e[1],o=i[2]-e[2],n=s*t[0]+r*t[1]+o*t[2];return s*s+r*r+o*o-n*n<=this._obbRadiusSquared&&this.obb.intersectRay(e,t)}boundingVolumeIntersectsSphere(e){if(!this.obb)return!0;const t=e.center,i=this._obbCenter,s=i[0]-t[0],r=i[1]-t[1],o=i[2]-t[2];return s*s+r*r+o*o<=(this._obbRadius+e.radius)**2}}function je(e){return Math.round(e/1048.576)/1e3}let xe=class extends(B(fe)){get hasModifications(){return this._modifications&&this._modifications.length>0}constructor(e){super(e),this.type="integrated-mesh-3dtiles",this._compressionTracker=new _e,this._modificationsUpdatingHandle=null,this._modifications=new Array,this._visibleGeometryChangedSchedulerHandle=null,this._wasmLayerId=-1,this.ignoresMemoryFactor=!1,this._usedMemory=0,this._cacheMemory=0,this.drapeTargetType=1,this._applySSAO=!has("disable-feature:im-ssao"),this._shadeNormals=!!has("enable-feature:im-shading"),this._lyrHandleToObjects=new Map,this._visibleObjects=new Set,this._suspendedHandle=null,this._dbgFlags=new Set,this._memCache=e.view.resourceController.memoryController.newCache(`IM3DTiles-${this.uid}`,e=>this._deletePerObjectData(e))}tryRecycleWith(e,t){return e.url!==this.layer.url||"integrated-mesh-3dtiles"!==e.type?null:e.load(t).then(()=>{r(t),this.layer=e,this._modificationsUpdatingHandle&&this._modificationsUpdatingHandle.remove(),this._modificationsUpdatingHandle=this._updatingHandles.add(()=>this.layer.modifications,()=>this._loadModifications(),o)})}initialize(){this._dbgFlags.add(3),this._dbg(2,"Tiles3DLayerView3D initialize() called");const{view:e}=this;if(this._modificationsUpdatingHandle=this._updatingHandles.add(()=>this.layer.modifications,()=>this._loadModifications(),o),!this._canProjectWithoutEngine())throw ge("layer",this.layer.spatialReference.wkid,e.renderSpatialReference?.wkid);const t=N(this).then(t=>{this._wasmLayerId=t,this._intersectionHandler=new Y(this),e.sceneIntersectionHelper.addIntersectionHandler(this._intersectionHandler),this._updatingHandles.add(()=>this.slicePlaneEnabled,e=>this._slicePlaneEnabledChange(e)),this._updatingHandles.add(()=>this._modifications,()=>this._modificationsChanged(),o),this._updatingHandles.add(()=>this.fullOpacity,()=>this._opacityChange()),this._updatingHandles.add(()=>e.clippingArea,()=>this._clippingAreaChanged(),o),this._elevationProvider=new $({view:e,layerElevationSource:this,intersectionHandler:this._intersectionHandler}),e.elevationProvider.register(1,this._elevationProvider),e.overlayManager.registerDrapeTarget(this),this.addHandles([n(()=>this.layer.elevationInfo,e=>this._elevationInfoChanged(e))]),this._suspendedHandle=n(()=>this.suspended,e=>this._wasm?.setEnabled(this,!e),o)});this.addResolvingPromise(t)}get _replacesTerrain(){return this.layer.replacesTerrain&&!!this.view.map.basemap?.groundLayers.includes(this.layer)}get fullOpacity(){return 1}get opacity(){return 1}_opacityChange(){const{fullOpacity:e}=this;this.forEachComponentObject(t=>this._collection.updateMaterial(t,t=>t.objectOpacity=e))}intersect(e,t,i,s){this._intersectionHandler.intersect(e,t,i,s,null,!1)}get ready(){return!0}destroy(){this._dbg(2,"Tiles3DLayerView3D destroy() called"),z(this),this._suspendedHandle&&(this._suspendedHandle.remove(),this._suspendedHandle=null),this._intersectionHandler&&(this.view.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler),this._intersectionHandler=null),this._elevationProvider&&(this._elevationProvider.notifyObjectsChangedFunctional(e=>this.forEachComponentObject(t=>e(t.obb))),this.view.elevationProvider.unregister(this._elevationProvider),this._elevationProvider=null),this.view.overlayManager.unregisterDrapeTarget(this),this._lyrHandleToObjects.forEach(e=>this.freeObject(e)),this._lyrHandleToObjects.clear(),this._visibleObjects.clear(),this._usedMemory=this._cacheMemory=0,this._memCache.destroy(),this._updatingHandles=i(this._updatingHandles),this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle=s(this._visibleGeometryChangedSchedulerHandle)}_modificationsChanged(){const e=this.layer.spatialReference,t=L(this._layerClippingArea,this._modifications,e);this._wasm?.setMeshModifications(this,t,e.wkid)}_clippingAreaChanged(){const e=this.layer.spatialReference,t=T();this._layerClippingArea=ee(this.view.clippingArea,t,e)?t:null,this._modificationsChanged()}_visibleGeometryChanged(){this._visibleGeometryChangedSchedulerHandle??=a(()=>{this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle=null})}_slicePlaneEnabledChange(e){this._intersectionHandler&&(this._intersectionHandler.slicePlaneEnabled=e&&!this._replacesTerrain),this.forEachComponentObject(t=>this._collection.updateMaterial(t,t=>t.commonMaterialParameters.hasSlicePlane=e))}_elevationInfoChanged(e){this._wasm?.setLayerOffset(this,D(e))}get _wasm(){return W(this.view)}get wasmLayerId(){return this._wasmLayerId}get usedMemory(){return this._usedMemory}get unloadedMemory(){return 0}get cachedMemory(){return this._cacheMemory}get visibleAtCurrentScale(){return this.layer.isUsedAsGroundLayer||be(this.layer.effectiveScaleRange,this.view.scale)}canResume(){const e=this.layer&&"effectiveScaleRange"in this.layer?this.layer.effectiveScaleRange:null;return this.visible&&this.layer?.loaded&&this.parent&&!this.parent.suspended&&this.view?.ready&&(this.layer.isUsedAsGroundLayer||ye(e)&&this.visibleAtCurrentScale)&&this.visibleAtCurrentTimeExtent||!1}get performanceInfo(){let e=0,t=0,i=0,s=0,r=0,o=0;return this._lyrHandleToObjects.forEach(n=>{n.isVisible?(e+=n.textureMemoryUsage,t+=n.vboMemoryUsage,r++):(i+=n.textureMemoryUsage,s+=n.vboMemoryUsage,o++)}),new G(this.usedMemory,r,o,je(t),je(e),je(s),je(i))}_canProjectWithoutEngine(){if(2===this.view.state.viewingMode){const e=this.view.renderSpatialReference?.isWebMercator?3857:this.view.renderSpatialReference?.wkid??-1;if(3857!==e&&32662!==e)return!1}return!0}get _stage(){return this.view.stage}get _collection(){return this._stage.renderView.componentObjectCollection}get elevationProvider(){return this._elevationProvider}get elevationOffset(){return D(this.layer.elevationInfo)}get elevationRange(){const e=this.fullExtent;return e?.zmin&&e?.zmax?new Z(e.zmin,e.zmax):null}getElevationRange(e){return this._intersectionHandler.getElevationRange(e)}get visibleElevationRange(){const e=new Z;return 0===this._visibleObjects.size?e.setElevationRangeValues(0,0):(e.setElevationRangeValues(1/0,-1/0),this.forEachVisibleTile(t=>e.expandElevationRange(t.elevationRange))),e}_setVisibleElevationRangeDirty(){this.notifyChange("visibleElevationRange")}get fullExtent(){return this.layer.fullExtent}forEachComponentObject(e){this._forEachObject(this._lyrHandleToObjects.values(),e)}forEachVisibleTile(e){for(const t of this._visibleObjects)e(t)}forEachVisibleComponentObject(e){this._forEachObject(this._visibleObjects,e)}_forEachObject(e,t){for(const i of e)for(const e of i.componentObjects)t(e)}isUpdating(){const e=this._wasm;return this._wasmLayerId>=0&&null!=e&&(e.isUpdating(this._wasmLayerId)||this._compressionTracker.compressing)}updatingFlagChanged(){this.notifyChange("updating")}async createRenderable(e){if(this.destroyed){const e=`IntegratedMesh3DTilesLayerView3D[${this.layer?.title}]: createRenderable called on destroyed instance`;throw new Error(e)}let t=0;const{meshData:i}=e;if(null==i.data)throw new Error("meshData.data undefined");if(i.desc=JSON.parse(i.desc),null==i.desc)throw new Error("meshData.desc undefined");const s=_(...i.desc.origin),r=this.view.basemapTerrain.spatialReference;let o,n;if("global"===this.view.viewingMode){const e=p();M(j,s,e,r),o=d(m(),e),n=h(m(),o)}else o=u,n=u;const a=v(),l=Te(i.desc.obb);let c=0,f=0;const T={textureMemoryUsage:0},R=new Array,U=new Map,H=i.desc.prims.length,P=new Array,V=new Z;try{const e="global"===this.view.viewingMode,t=e?x(this.view.spatialReference).radius:0;for(let d=0;d<H;d++){const h=i.desc.prims[d];this._dbg(2,JSON.stringify(h));if(null==q[h.ptype]||null==i.data){this._dbg(2,"[Unsupported Feature] Unsupported primitive mode ("+h.ptype+"). Skipping primitive.");continue}const m=i.desc?.materials&&null!=h.materialId?i.desc.materials[h.materialId]:null,p=null!=m?m.lightingModel:"Unlit",{positionView:_,positionAttr:j,normalsView:x,normalsAttr:M,colorAttr:H,texCoord0Attr:P,indicesView:S}=this.getBufferViews(h,i.data.buffer,o);if(null==j||null==_||null==S)continue;const A=new re(null!=H,P?1:0,null!=x,this._shadeNormals||this._replacesTerrain,this._applySSAO),I=j.data.length/j.size,k=(e,t)=>!e||e.data.length/e.size===I||(this._dbg(3,`${t} !== numPos. Skipping primitive.`),!1);if(!k(P,"numTexcoord")||!k(H,"numColors")||!k(M,"normals"))continue;const F=oe(A);for(let i=0;i<_.count;i++){_.getVec(i,a),g(a,a,s);const r=e?b(a)-t:a[2];V.expandElevationRangeValues(r,r)}const D=l?.clone()??Oe(j,s);if(o!==u)for(let e=0;e<_.count;e++)_.getVec(e,a),y(a,a,o),_.setVec(e,a);const L=F.createBuffer(j.data.length);if(ue("position",j,null,null,L,0),null!=P){const e=L.getField("uv0",E);pe(P,e,0)}null!=H&&ue("color",H,null,null,L,0),null!=M&&ue("normalCompressed",M,null,null,L,0);const B=new Uint32Array([0,S.typedBuffer.length]),G=new ne({data:L.buffer,count:L.byteLength/F.stride,layoutParameters:A},{positions:_.typedBuffer,indices:S.typedBuffer},S.typedBuffer,B);c+=_.count+S.count;const N=this.view.renderSpatialReference,z=v(),W=[1,1,1];C(s,N,W,r)||this._dbg(3,"Unsupported coordinate system for IM overlay"),O(s,N,z,r);let $=()=>{},Q=Promise.resolve(Re);if(m){const e=e=>this._getTexture(e,i,U,T),t=e(m.baseColorTex),s="Pbr"===p,r=s?e(m.metalTex):null,o=s?e(m.emissiveTex):null,n=s?e(m.occlusionTex):null,a=s?e(m.normalTex):null,l=[t,r,o,n,a].map(e=>e?.loadPromise??null);Q=Promise.all(l),$=e=>{e.baseColor=m.baseColorFactor,e.usePBR="Pbr"===p,e.hasParametersFromSource=!1,e.baseColorTexture=t,e.usePBR&&(e.mrrFactors=[m.metallicFactor,m.roughnessFactor,0],e.emissiveBaseColor=m.emissiveFactor??[0,0,0],e.metallicRoughnessTexture=r,e.emissionTexture=o,e.occlusionTexture=n,e.normalTexture=a),e.alphaDiscardMode=J[m.alphaMode],e.objectOpacity=this.fullOpacity,T.textureMemoryUsage+=e.baseColorTexture?.texture?.usedMemory??0,e.usePBR&&(T.textureMemoryUsage+=(e.metallicRoughnessTexture?.texture?.usedMemory??0)+(e.emissionTexture?.texture?.usedMemory??0)+(e.occlusionTexture?.texture?.usedMemory??0)+(e.normalTexture?.texture?.usedMemory??0)),e.commonMaterialParameters.doubleSided=m.isDoubleSided,e.commonMaterialParameters.cullFace=K[m.faceCulling??"NotSet"],e.commonMaterialParameters.isGround=this.layer.replacesTerrain,e.commonMaterialParameters.hasSlicePlane=this.slicePlaneEnabled,e.componentParameters.castShadows=0,e.textureAlphaCutoff=m.alphaCutoff??ve,e.alphaDiscardMode=J[m.alphaMode],e.isIntegratedMesh=!0,e.sphereDepthInterpolate=this.layer.hasGoogleUrl,e.polygonOffsetEnabled=!1,e.hasOccludees=!1,e.ellipsoidMode=ce(this.view.spatialReference)}}const X=Q.then(()=>()=>{if(this.destroyed){const e="Trying to add object to destroyed layer view";throw this._dbg(3,`${e} !== numPos. Skipping primitive.`),new Error(e)}const e=this._collection.createObject(new se(w(z[0],z[1],W[0],W[1]),new ae(s,n),D,G,!1));return this._collection.updateMaterial(e,$),f+=this._collection.getObjectGPUMemoryUsage(e),e});R.push(X)}if(P.push(...await Promise.all(R)),this.destroyed){throw new Error("IntegratedMesh3DTilesLayerView3D: createRenderable object destroyed during call")}}catch(k){throw U.forEach(e=>this._stage.removeTexture(e)),k}const S=P.map(e=>e()),A=new Array;U.forEach(e=>A.push(e));const I=new we(e.handle,S,A,c,f,T.textureMemoryUsage,l,e.stableNodeId,V);return this._lyrHandleToObjects.set(e.handle,I),this._memCache.put(Ee(I.handle),I),t=I.usedMemory,this._cacheMemory+=t,{memUsageBytes:I.usedMemory}}freeRenderable(e){const t=this._lyrHandleToObjects.get(e);t&&(t.isVisible?(this._visibleObjects.delete(t),this._usedMemory-=t.usedMemory):this._cacheMemory-=t.usedMemory,this.freeObject(t),this._lyrHandleToObjects.delete(e))}freeObject(e){const t=Ee(e.handle);this._memCache.pop(t),e.textures.forEach(e=>this._stage.removeTexture(e)),e.componentObjects.forEach(e=>this._collection.destroyObject(e))}setRenderableVisibility(e,t,i){for(let s=0;s<i;++s){const i=t[s];if(!i)continue;const r=e[s],o=this._lyrHandleToObjects.get(r);if(o){if(o.isVisible)continue;this._visibleGeometryChanged(),o.isVisible=!0,this._visibleObjects.add(o),this._usedMemory+=o.usedMemory,this._cacheMemory-=o.usedMemory;const{minElevation:e,maxElevation:t}=o.elevationRange;(e<this.visibleElevationRange.minElevation||t>this.visibleElevationRange.maxElevation)&&this._setVisibleElevationRangeDirty(),o.componentObjects.forEach(e=>{this._collection.setObjectVisibility(e,i),this._elevationProvider.notifyObjectChanged(this._collection.getComponentObb(e))}),this._memCache.pop(Ee(r))}}for(let s=0;s<i;++s){const i=e[s],r=t[s];if(r)continue;const o=this._lyrHandleToObjects.get(i);if(o){if(!o.isVisible)continue;this._visibleGeometryChanged(),o.isVisible=!1,this._visibleObjects.delete(o),this._usedMemory-=o.usedMemory,this._cacheMemory+=o.usedMemory;const{minElevation:e,maxElevation:t}=o.elevationRange;e!==this.visibleElevationRange.minElevation&&t!==this.visibleElevationRange.maxElevation||this._setVisibleElevationRangeDirty(),o.componentObjects.forEach(e=>{this._collection.setObjectVisibility(e,r),this._elevationProvider.notifyObjectChanged(this._collection.getComponentObb(e))}),this._memCache.put(Ee(i),o)}}}setLodPixelThreshold(e){this._wasm?.setLodPixelThreshold(this,e)}_getTexture(e,t,i,s){const r=e&&t.desc?.images?.[e.imageId];if(!r||!t.data?.buffer)return null;const o=i.get(r)??this._createTexture(e,t,i,s);return o?new le(this._stage.renderView.textures,o.id):null}_createTexture(e,t,i,s){const r=e&&t.desc?.images?.[e.imageId];if(!r||!t.data?.buffer)return null;const o=this._stage,{renderView:n}=o,a=n.renderingContext.parameters.maxMaxAnisotropy,l=!!r.mipCount||a>1,c=Q[e.wrapMode??"None"];let d=r.alpha?6408:6407;const h=new Uint8Array(t.data.buffer,r.data.byteOffset,r.data.byteCount);let m=null,u=null,p=null;switch(r.format){case"Raw":"R8"===r.pixelFormat?(m=h,d=6403,u=""):"Rgb8"===r.pixelFormat?(m=h,d=6407,u=""):"Rgba8"===r.pixelFormat&&(m=h,d=6408,u="");break;case"Dxt1":m=h,d=6407,u="image/vnd-ms.dds";break;case"Dxt5":m=h,d=6408,u="image/vnd-ms.dds";break;case"Basis":m=h,d=6407,u="image/ktx2";break;case"Png":u="image/png",p=document.createElement("img");break;case"Jpeg":u="image/jpeg",p=document.createElement("img");break;case"Etc2":u="image/ktx",p=document.createElement("img");break;case"Astc":this._dbg(3,"Astc texture not supported");break;case"Pvrtc":this._dbg(3,"Pvrtc texture not supported")}if(p&&u){const e=new Blob([h],{type:u});p.src=URL.createObjectURL(e),m=p}if(m&&null!=u){const e=has("enable-feature:esri-compress-IM-textures")?{compressionTracker:this._compressionTracker,compressionCallback:e=>{e&&e>0&&(s.textureMemoryUsage-=e)}}:void 0,t=new he(m,{mipmap:l,maxAnisotropy:a,encoding:u,wrap:c,pixelFormat:d,compressionOptions:e,noUnpackFlip:!0,width:r.mip0Width,height:r.mip0Height});return this._stage.addTexture(t),i.set(r,t),t}return null}getBufferViews(e,t,i){let s,r,o,n,a,l,c,d=null;for(let m=0;m<e.atrbs.length;m++){const c=e.atrbs[m],{view:u}=c,p=void 0,f=u.byteOffset+u.byteCount,g=u.byteCount/X[u.type],b=new(Ue(g))(g);for(let e=0;e<g;++e)b[e]=e;try{switch(c.sem){case"Position":3!==u.ncomp||"F32"!==u.type?this._dbg(3,"[Unsupported Feature] Unsupported view for Position ("+u+")"):(s=new P(t,u.byteOffset,p,f),r=new de(s.typedBuffer,b,3));break;case"Normal":if(3!==u.ncomp||"F32"!==u.type)this._dbg(3,"[Unsupported Feature] Unsupported view for Normal ("+u+")");else{const e=new P(t,u.byteOffset,p,f),s=me(e.typedBuffer,i);a=new A(s.buffer),l=new de(a.typedBuffer,b,2)}break;case"TexCoord":2!==u.ncomp||"F32"!==u.type?this._dbg(3,"[Unsupported Feature] Unsupported view for Texcoord ("+u+")"):void 0===n&&(n=new de(new E(t,u.byteOffset,p,f).typedBuffer,b,2));break;case"Color":4===u.ncomp?("F32"===u.type&&(d=new R(t,u.byteOffset,p,f)),"U8"===u.type&&(d=new U(t,u.byteOffset,p,f)),"U16"===u.type&&(d=new H(t,u.byteOffset,p,f))):3===u.ncomp&&("F32"===u.type&&(d=new P(t,u.byteOffset,p,f)),"U8"===u.type&&(d=new V(t,u.byteOffset,p,f)),"U16"===u.type&&(d=new S(t,u.byteOffset,p,f))),null==d?this._dbg(2,"[Unsupported Feature] Unsupported view for Color ("+u+")"):o=new de(d.typedBuffer,b,u.ncomp);break;case"FeatureIndex":break;default:this._dbg(2,"[Unsupported Feature] Unsupported semantic ("+c.sem+"). Skipping vertex attribute.")}}catch(h){this._dbg(2,"Error Creating buffer ("+h+"). Skipping vertex attribute.")}}if(e.index){const i=e.index.view,s=void 0,r=i.byteOffset+i.byteCount;switch(e.index.view.type){case"U16":c=new k(t,i.byteOffset,s,r);break;case"U32":c=new I(t,i.byteOffset,s,r);break;default:this._dbg(3,"[Unsupported Feature] index type not supported ("+i.type+").")}}if(null==c&&null!=s){const e=s.count;c=c=e<65535?new k(new Uint16Array(e).buffer):new I(new Uint32Array(e).buffer);for(let t=0;t<e;t++)c.set(t,t)}return{positionView:s,positionAttr:r,colorAttr:o,texCoord0Attr:n,indicesView:c,normalsView:a,normalsAttr:l}}_loadModifications(){if(this.removeHandles("modifications"),null==this.layer.modifications)return void(this._modifications=[]);const e=this.layer.modifications;this.addHandles(this._updatingHandles.addOnCollectionChange(()=>e,()=>this._modifications=e.toArray(),o),"modifications")}_deletePerObjectData(e){this._wasm?.onRenderableEvicted(this,e.handle,e.usedMemory),this.freeRenderable(e.handle)}_dbg(e,i){this._dbgFlags.has(e)&&(3===e?t.getLogger(this).error(i):t.getLogger(this).warn(i))}};e([l()],xe.prototype,"fullOpacity",null),e([l({type:[F]})],xe.prototype,"_modifications",void 0),e([l()],xe.prototype,"_visibleGeometryChangedSchedulerHandle",void 0),e([l()],xe.prototype,"layer",void 0),e([l({readOnly:!0})],xe.prototype,"visibleAtCurrentScale",null),e([l({readOnly:!0})],xe.prototype,"_collection",null),e([l()],xe.prototype,"elevationOffset",null),e([l({readOnly:!0})],xe.prototype,"visibleElevationRange",null),xe=e([c("esri.views.3d.layers.IntegratedMesh3DTilesLayerView3D")],xe);const Me=xe,Ce=v();function Oe(e,t){const i=ie(e);return g(Ce,i.center,t),i.center=Ce,i}function Te(e){return e?new te(e.center,e.halfSize,f(...e.quaternion)):null}function Ee(e){return`${e}`}const Re=new Array;function Ue(e){return e<256?Uint8Array:e<65536?Uint16Array:Uint32Array}export{Me 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 has from"../../../core/has.js";import{initial as t}from"../../../core/reactiveUtils.js";import{property as r,subclass as i}from"../../../core/accessorSupport/decorators.js";import{I3SMeshView3D as s}from"./I3SMeshView3D.js";import{LayerView3D as o}from"./LayerView3D.js";import{updatingProgress as a}from"../support/updatingProperties.js";import l from"../../layers/LayerView.js";import{isInEffectiveScaleRange as n}from"../../support/layerViewUtils.js";const p=.2;let d=class extends(s(o(l))){constructor(){super(...arguments),this.type="integrated-mesh-3d",this._elevationContext=1,this._supportsLabeling=!1,this._applySSAO=!has("disable-feature:im-ssao"),this._shadeNormals=!!has("enable-feature:im-shading"),this.drapeTargetType=1}get i3slayer(){return this.layer}get updatingProgressValue(){return this._controller?.updatingProgress??0}get lodFactor(){return this.view?.qualitySettings?.sceneService?.meshLoDFactor??1}get progressiveLoadFactor(){return this.lodFactor>=1?p:1}get visibleAtCurrentScale(){return this.i3slayer.replacesTerrain||n(this.i3slayer.effectiveScaleRange,this.view.scale)}get fullOpacity(){return 1}get layerPopupEnabledAndHasTemplate(){return!1}initialize(){this._updatingHandles.add(()=>this.layer.modifications,()=>this._loadModifications(),t),this.view.overlayManager.registerDrapeTarget(this)}destroy(){this.view.overlayManager.unregisterDrapeTarget(this)}get ready(){return this.layer.loaded}_createLayerGraphic(){}canResume(){return super.canResume()&&(!this._controller||this._controller.rootNodeVisible)}_loadModifications(){if(this.removeHandles("modifications"),null==this.layer.modifications)return void(this._modifications=[]);const e=this.layer.modifications;this.addHandles(this._updatingHandles.addOnCollectionChange(()=>e,()=>this._modifications=e.toArray(),t),"modifications")}};e([r()],d.prototype,"layer",void 0),e([r()],d.prototype,"i3slayer",null),e([r(a)],d.prototype,"updatingProgress",void 0),e([r()],d.prototype,"updatingProgressValue",null),e([r()],d.prototype,"lodFactor",null),e([r({readOnly:!0})],d.prototype,"progressiveLoadFactor",null),e([r({readOnly:!0})],d.prototype,"visibleAtCurrentScale",null),e([r()],d.prototype,"fullOpacity",null),d=e([i("esri.views.3d.layers.IntegratedMeshLayerView3D")],d);const c=d;export{c as default};
5
+ import{__decorate as e}from"tslib";import has from"../../../core/has.js";import{initial as t}from"../../../core/reactiveUtils.js";import{property as r,subclass as i}from"../../../core/accessorSupport/decorators.js";import{I3SMeshView3D as o}from"./I3SMeshView3D.js";import{LayerView3D as s}from"./LayerView3D.js";import{ElevationRange as a}from"../support/ElevationRange.js";import{updatingProgress as l}from"../support/updatingProperties.js";import n from"../../layers/LayerView.js";import{isInEffectiveScaleRange as p}from"../../support/layerViewUtils.js";const d=.2;let u=class extends(o(s(n))){constructor(){super(...arguments),this.type="integrated-mesh-3d",this.visibleElevationRange=new a(1/0,-1/0),this._elevationContext=1,this._supportsLabeling=!1,this._applySSAO=!has("disable-feature:im-ssao"),this._shadeNormals=!!has("enable-feature:im-shading"),this.drapeTargetType=1}get i3slayer(){return this.layer}get updatingProgressValue(){return this._controller?.updatingProgress??0}get lodFactor(){return this.view?.qualitySettings?.sceneService?.meshLoDFactor??1}get progressiveLoadFactor(){return this.lodFactor>=1?d:1}get visibleAtCurrentScale(){return p(this.i3slayer.effectiveScaleRange,this.view.scale)}get fullOpacity(){return 1}get layerPopupEnabledAndHasTemplate(){return!1}initialize(){this._updatingHandles.add(()=>this.layer.modifications,()=>this._loadModifications(),t),this.view.overlayManager.registerDrapeTarget(this)}destroy(){this.view.overlayManager.unregisterDrapeTarget(this)}get ready(){return this.layer.loaded}_createLayerGraphic(){}canResume(){return super.canResume()&&(!this._controller||this._controller.rootNodeVisible)}_loadModifications(){if(this.removeHandles("modifications"),null==this.layer.modifications)return void(this._modifications=[]);const e=this.layer.modifications;this.addHandles(this._updatingHandles.addOnCollectionChange(()=>e,()=>this._modifications=e.toArray(),t),"modifications")}};e([r()],u.prototype,"layer",void 0),e([r()],u.prototype,"i3slayer",null),e([r(l)],u.prototype,"updatingProgress",void 0),e([r()],u.prototype,"updatingProgressValue",null),e([r()],u.prototype,"lodFactor",null),e([r({readOnly:!0})],u.prototype,"progressiveLoadFactor",null),e([r({readOnly:!0})],u.prototype,"visibleAtCurrentScale",null),e([r({readOnly:!0})],u.prototype,"visibleElevationRange",void 0),e([r()],u.prototype,"fullOpacity",null),u=e([i("esri.views.3d.layers.IntegratedMeshLayerView3D")],u);const c=u;export{c 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 i}from"tslib";import t from"../../../../core/Accessor.js";import{lerp as e}from"../../../../core/mathUtils.js";import{destroyMaybe as s}from"../../../../core/maybe.js";import{property as r,subclass as o}from"../../../../core/accessorSupport/decorators.js";import{transpose as c}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{p as l,j as h,h as u,d}from"../../../../chunks/vec32.js";import{ZEROS as p,create as _}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{s as y,t as f,c as g}from"../../../../chunks/vec42.js";import{create as m}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{UpdatingHandles as v}from"../../../../core/support/UpdatingHandles.js";import{getReferenceEllipsoid as b}from"../../../../geometry/ellipsoidUtils.js";import{create as O,empty as w,copy as D,offset as G,width as I,height as j,expand as k}from"../../../../geometry/support/aaBoundingRect.js";import{e as Q,a as P,d as C}from"../../../../chunks/boundedPlane.js";import{create as S}from"../../../../geometry/support/ray.js";import{Sphere as T,sphereCSO as V}from"../../../../geometry/support/sphere.js";import{DeconflictAABR as x}from"./DeconflictAABR.js";import{prepare as R,drawPoly as A}from"./deconflictorDebug.js";import U from"../../webgl/RenderCamera.js";import{GPUPointOcclusionQuery as H}from"../../webgl-engine/lib/GPUPointOcclusionQuery.js";import{SeparateScreenSizePerspectiveEvaluators as M}from"../../webgl-engine/lib/screenSizePerspectiveUtils.js";import{HUDMaterial as N}from"../../webgl-engine/materials/HUDMaterial.js";import{Yield as E}from"../../../support/Yield.js";const z=_(),F=_(),B=m(),W=m(),L=_(),q=n(),Y=new T,J=S(),K=_(),X=O();class Z{constructor(i){this.id=i,this.aabr=O(),this.altitude=0,this.distance=0,this.distanceToOccluder=0,this.culled=!1,this.visible=!1,this.priority=0}}function $(i,t){const e=0!==i.distanceToOccluder&&i.distance>i.distanceToOccluder,s=0!==t.distanceToOccluder&&t.distance>t.distanceToOccluder;return e!==s?+e-+s:i.priority!==t.priority?t.priority-i.priority:i.distance!==t.distance?i.distance-t.distance:i.visible!==t.visible?+t.visible-+i.visible:i.id-t.id}class ii{constructor(i,t){this.graphics3DGraphic=i,this.slicePlaneEnabled=t,this._info=null,this._labelInfo=null}ensureInfo(i){let t=this.getInfo(i);return t||(t=new Z(this.graphics3DGraphic.graphic.uid),this._setInfo(i,t)),t}getInfo(i){return 16===i?this._labelInfo:this._info}removeInfo(i){this._setInfo(i,null)}_setInfo(i,t){16===i?this._labelInfo=t:this._info=t}}class ti{constructor(){this.camera=new U,this.slicePlane=P(),this.slicePlaneEnabled=!1}copyFrom(i){this.camera.equals(i.camera)||this.camera.copyFrom(i.camera),C(i.slicePlane,this.slicePlane),this.slicePlaneEnabled=i.slicePlaneEnabled}}let ei=class extends t{get dirty(){return this._dirty}get state(){return this._state}constructor(i){super(i),this._dirty=!1,this._viewState=new ti,this._state=0,this._checkOcclusion=new Map,this._active=new Map,this._checkOcclusionIterator=null,this._activeIterator=null,this._occlusionQueryUids=new Array,this._updatingHandles=new v,this._deconflictor=new x((i,t)=>{i.visible=t,this._setGraphicVisibility(this._active.get(i.id),t)},(i,t)=>i.id!==t.id,$),this._baseOccludedVisibility=10,this._altitudeFactor=2,this._minAltitudeDifference=100}initialize(){this._updatingHandles.add(()=>(this.view?.map?.ground?.opacity??0)>0,()=>this.setDirty()),this._updatingHandles.add(()=>this.view.ready,()=>{this._occlusionQuery=null,this.setDirty()})}destroy(){this._occlusionQuery=null,this._updatingHandles.destroy(),this._deconflictor.destroy(),this._checkOcclusion.clear(),this._active.clear()}setDirty(){!this._dirty&&(this._active.size>0||this._checkOcclusion.size>0)&&(this._dirty=!0,this.notifyChange("_readyToRun"))}setPriority(i,t){const e=this._active.get(i.graphic.uid)?.getInfo(this.visibilityGroup);e&&(e.priority=t)}get _readyToRun(){return 0!==this._state||this._dirty}get updating(){return this._readyToRun||this._updatingHandles.updating}get updatingProgress(){if(!this.updating)return 1;const i=this._state/5;return this._dirty?.5*i:i}get readyToRun(){return this.view.ready&&null!=this.view.state&&this._readyToRun}get usedMemory(){return this._occlusionQuery?.usedMemory??0+4*(this._occlusionQueryUids?.length??0)}runTask(i){switch(this._state){case 0:this._startUpdate(),i.madeProgress();case 1:if(this._state=1,!this._processCheckOcclusion(i))return;case 2:if(this._state=2,this._occlusionQuery&&!this._occlusionQuery.done)return E;this._readOcclusionQueryResult(),i.madeProgress();case 3:if(this._state=3,!this._collectActiveGraphics(i))return;case 4:if(this._state=4,this._deconflictor.run(i),!this._deconflictor.done)return;default:this._state=0,this.notifyChange("_readyToRun")}}setGraphicsActive(i,t){t?i.forEach(i=>this.addToActiveGraphics(i)):i.forEach(i=>this.removeFromActiveGraphics(i))}layerSupportsDeconfliction(i){if(null==i||"object3d"!==i.type)return!1;const t=i.stageObject;if(1!==(t?.geometries.length??0))return!1;const e=t?.geometries[0],s=e?.material;return s instanceof N}_startUpdate(){R(this.view),this._dirty=!1,this._viewState.copyFrom(this.viewState);const{fullWidth:i,fullHeight:t}=this._viewState.camera;this._deconflictor.reset(i,t),this._resetIterators(),this._occlusionQueryUids.length=0,this._checkOcclusion.size||(this._occlusionQuery=s(this._occlusionQuery))}addToActiveGraphics(i){i.ensureInfo(this.visibilityGroup),this._active.set(i.graphics3DGraphic.graphic.uid,i),this.setDirty()}removeFromActiveGraphics(i){si(i,this.visibilityGroup),i.removeInfo(this.visibilityGroup),this._active.delete(i.graphics3DGraphic.graphic.uid),this.setDirty()}addToCheckOcclusion(i){this._checkOcclusion.set(i.graphics3DGraphic.graphic.uid,i),this.setDirty()}removeFromCheckOcclusion(i){this._checkOcclusion.delete(i.graphics3DGraphic.graphic.uid)}_processCheckOcclusion(i){if(0===this._checkOcclusion.size)return!0;const t=this._ensureCheckOcclusionIterator(),e=this._viewState.camera,r=c(q,e.viewInverseTransposeMatrix),o=this.view.map.ground.opacity>0,n="global"===this.view.viewingMode&&o&&e.relativeElevation>0?Y:null;let a=0;null!=n&&(l(n.center,p,e.viewMatrix),n.radius=b(this.view.spatialReference).radius,a=V.distanceToSilhouette(n,p));const h=O();for(;;){if(i.done)return!1;i.madeProgress();const s=t.next();if(!0===s.done)break;const o=s.value,c=o.graphics3DGraphic;if(c.destroyed)continue;if(!c.isVisible(1,8))continue;const u=ni(c,this.visibilityGroup);let d=null,p=!0;for(const i of u){if(!this.layerSupportsDeconfliction(i))continue;d=ai,this._projectHudLayer(i,e,d),w(h);const t=i.stageObject.geometries[0].material;if(this._expandBoundingRect(h,e,i,t,d),d.isOutsideScreen){p=!1;break}if(this._isCulledBySlice(o,d.positionView)){p=!1;break}if(null!=n&&ci(d,n,a)){p=!1;break}l(F,d.positionView,r),d.altitude=this.view.renderCoordsHelper.getAltitude(F);const s=o.ensureInfo(this.visibilityGroup);if(s.altitude=d.altitude,s.distance=d.distance,s.distanceToOccluder=d.distanceToOccluder,s.culled=!1,D(s.aabr,h),t.parameters.occlusionTest)break;this._ensureOcclusionQuery().addPosition(F)===this._occlusionQueryUids.length&&this._occlusionQueryUids.push(c.graphic.uid);break}if(this._active.has(c.graphic.uid)&&(!p||!d)){const i=o.ensureInfo(this.visibilityGroup);i.visible=!d,i.culled=!0}}return this._checkOcclusionIterator=null,this._occlusionQueryUids.length||(this._occlusionQuery=s(this._occlusionQuery)),this._occlusionQuery?.start(),!0}_readOcclusionQueryResult(){if(!this._occlusionQuery||!this._occlusionQueryUids.length)return;const i=this._viewState.camera,t=this.view.renderCoordsHelper.getAltitude(i.eye);for(let e=0;e<this._occlusionQueryUids.length;e++){const i=this._occlusionQueryUids[e],s=this._checkOcclusion.get(i);if(!s)continue;const r=this._occlusionQuery.getOcclusion(e)??-1,o=s.getInfo(this.visibilityGroup);o&&(o.distanceToOccluder=r>0?o.distance-r:0);const c=r<=0||this._occludedVisibility(o?.distanceToOccluder??0,o?.distance??r,o?.altitude??0,t);this._active.has(i)?o&&(o.culled=!c,o.visible=c):this._setGraphicVisibility(s,c)}this._occlusionQueryUids.length=0}_collectActiveGraphics(i){const t=this._ensureActiveGraphicsIterator(),e=16===this.visibilityGroup;for(;!i.done;){i.madeProgress();const s=t.next();if(!0===s.done)return this._activeIterator=null,!0;const r=s.value,o=r.getInfo(this.visibilityGroup);if(!o)continue;!(!e||r.graphics3DGraphic.isVisible())||o.culled?(A(o.aabr,!1,!0),this._setGraphicVisibility(r,o.visible)):this._deconflictor.add(o)}return!1}_occludedVisibility(i,t,e,s){const r=Math.max(this._minAltitudeDifference,Math.abs(e-s))-this._minAltitudeDifference;return 0===i||t-i<=this._baseOccludedVisibility+this._altitudeFactor*r}_resetIterators(){this._checkOcclusionIterator=null,this._activeIterator=null}_ensureCheckOcclusionIterator(){return this._checkOcclusionIterator??=this._checkOcclusion.values(),this._checkOcclusionIterator}_ensureActiveGraphicsIterator(){return this._activeIterator??=this._active.values(),this._activeIterator}_ensureOcclusionQuery(){return this._occlusionQuery??=new H({view:this.view}),this._occlusionQueryUids.length||this._occlusionQuery.init(this._checkOcclusion.size,this._viewState.camera.eye),this._occlusionQuery}_projectHudLayer(i,t,e){const s=i.stageObject,r=s.geometries[0],o=r.material;l(z,s.boundingVolumeWorldSpace.bounds.center,t.viewMatrix);const c=r.attributes,n=c.get("normal").data,a=c.get("centerOffsetAndDistance").data;o.applyShaderOffsetsView(z,n,s.transformation,a,t,e.screenSizePerspectiveEvaluators,z),y(B,z[0],z[1],z[2],1),f(W,B,t.projectionMatrix),h(e.positionNDC,W,1/W[3]),o.applyShaderOffsetsNDC(e.positionNDC,a,t,e.positionNDC,L),e.distanceWithoutPolygonOffset=t.depthNDCToWorld(L[2]),e.distance=L[2]===e.positionNDC[2]?e.distanceWithoutPolygonOffset:t.depthNDCToWorld(e.positionNDC[2]),y(W,e.positionNDC[0],e.positionNDC[1],e.positionNDC[2],1),f(B,W,t.inverseProjectionMatrix),g(B,B,1/B[3]),u(e.positionView,z[0],z[1],z[2])}_isCulledBySlice(i,t){return i.slicePlaneEnabled&&this._viewState.slicePlaneEnabled&&Q(this._viewState.slicePlane,t)}_expandBoundingRect(i,t,s,r,{positionNDC:o,screenSizePerspectiveEvaluators:c}){const n=s.getScreenSize(ri);c.evaluator.applyVec2(n,n),n[0]*=t.pixelRatio,n[1]*=t.pixelRatio;const a=G(r.calculateRelativeScreenBounds(n,c.alignmentEvaluator.apply(t.pixelRatio),X),e(0,t.fullWidth,.5+.5*o[0]),e(0,t.fullHeight,.5+.5*o[1])),l=this.marginFactor;if(0!==l){const i=l*Math.min(I(a),j(a));a[0]-=i,a[1]-=i,a[2]+=i,a[3]+=i}k(i,a,i)}_setGraphicVisibility(i,t){const e=i?.graphics3DGraphic;e&&!e.destroyed&&(e.setVisibilityFlag(this.visibilityGroup,8,t),16===this.visibilityGroup&&this.view.labeler.setLabelGraphicVisibility(e,t))}};function si(i,t){const e=i.graphics3DGraphic;e.destroyed||e.setVisibilityFlag(t,8,!0)}i([r({constructOnly:!0})],ei.prototype,"view",void 0),i([r({type:Boolean,readOnly:!0})],ei.prototype,"_readyToRun",null),i([r({type:Boolean,readOnly:!0})],ei.prototype,"updating",null),i([r({readOnly:!0})],ei.prototype,"_updatingHandles",void 0),ei=i([o("esri.views.3d.layers.graphics.Deconflictor")],ei);const ri=a();class oi{constructor(){this.positionView=_(),this.positionNDC=_(),this.altitude=0,this.distance=0,this.distanceToOccluder=0,this.distanceWithoutPolygonOffset=0,this.screenSizePerspectiveEvaluators=new M}get isOutsideScreen(){const i=this.positionNDC;return i[0]<-1||i[1]<-1||i[2]<-1||i[0]>=1||i[1]>=1||i[2]>=1}}function ci(i,t,e){return d(J.direction,i.positionView),u(J.origin,0,0,0),!!t.intersectRay(J,K)&&i.distanceWithoutPolygonOffset>e}function ni(i,t){return 16===t?i.labelLayers:i.layers}const ai=new oi;export{ei as Deconflictor,ii as DeconflictorGraphic,ti as DeconflictorViewState};
5
+ import{__decorate as i}from"tslib";import t from"../../../../core/Accessor.js";import{lerp as e}from"../../../../core/mathUtils.js";import{destroyMaybe as s}from"../../../../core/maybe.js";import{property as r,subclass as o}from"../../../../core/accessorSupport/decorators.js";import{transpose as c}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{p as l,j as h,h as u,d}from"../../../../chunks/vec32.js";import{ZEROS as p,create as _}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{c as y,t as f,s as g}from"../../../../chunks/vec42.js";import{create as m}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{UpdatingHandles as v}from"../../../../core/support/UpdatingHandles.js";import{getReferenceEllipsoid as b}from"../../../../geometry/ellipsoidUtils.js";import{create as O,empty as w,copy as D,offset as G,width as I,height as j,expand as k}from"../../../../geometry/support/aaBoundingRect.js";import{e as Q,a as P,d as C}from"../../../../chunks/boundedPlane.js";import{create as S}from"../../../../geometry/support/ray.js";import{Sphere as T,sphereCSO as V}from"../../../../geometry/support/sphere.js";import{DeconflictAABR as x}from"./DeconflictAABR.js";import{prepare as R,drawPoly as A}from"./deconflictorDebug.js";import U from"../../webgl/RenderCamera.js";import{GPUPointOcclusionQuery as H}from"../../webgl-engine/lib/GPUPointOcclusionQuery.js";import{SeparateScreenSizePerspectiveEvaluators as M}from"../../webgl-engine/lib/screenSizePerspectiveUtils.js";import{HUDMaterial as N}from"../../webgl-engine/materials/HUDMaterial.js";import{Yield as E}from"../../../support/Yield.js";const z=_(),F=_(),B=m(),W=m(),L=_(),q=n(),Y=new T,J=S(),K=_(),X=O();class Z{constructor(i){this.id=i,this.aabr=O(),this.altitude=0,this.distance=0,this.distanceToOccluder=0,this.culled=!1,this.visible=!1,this.priority=0}}function $(i,t){const e=0!==i.distanceToOccluder&&i.distance>i.distanceToOccluder,s=0!==t.distanceToOccluder&&t.distance>t.distanceToOccluder;return e!==s?+e-+s:i.priority!==t.priority?t.priority-i.priority:i.distance!==t.distance?i.distance-t.distance:i.visible!==t.visible?+t.visible-+i.visible:i.id-t.id}class ii{constructor(i,t){this.graphics3DGraphic=i,this.slicePlaneEnabled=t,this._info=null,this._labelInfo=null}ensureInfo(i){let t=this.getInfo(i);return t||(t=new Z(this.graphics3DGraphic.graphic.uid),this._setInfo(i,t)),t}getInfo(i){return 16===i?this._labelInfo:this._info}removeInfo(i){this._setInfo(i,null)}_setInfo(i,t){16===i?this._labelInfo=t:this._info=t}}class ti{constructor(){this.camera=new U,this.slicePlane=P(),this.slicePlaneEnabled=!1}copyFrom(i){this.camera.equals(i.camera)||this.camera.copyFrom(i.camera),C(i.slicePlane,this.slicePlane),this.slicePlaneEnabled=i.slicePlaneEnabled}}let ei=class extends t{get dirty(){return this._dirty}get state(){return this._state}constructor(i){super(i),this._dirty=!1,this._viewState=new ti,this._state=0,this._checkOcclusion=new Map,this._active=new Map,this._checkOcclusionIterator=null,this._activeIterator=null,this._occlusionQueryUids=new Array,this._updatingHandles=new v,this._deconflictor=new x((i,t)=>{i.visible=t,this._setGraphicVisibility(this._active.get(i.id),t)},(i,t)=>i.id!==t.id,$),this._baseOccludedVisibility=10,this._altitudeFactor=2,this._minAltitudeDifference=100}initialize(){this._updatingHandles.add(()=>(this.view?.map?.ground?.opacity??0)>0,()=>this.setDirty()),this._updatingHandles.add(()=>this.view.ready,()=>{this._occlusionQuery=null,this.setDirty()})}destroy(){this._occlusionQuery=null,this._updatingHandles.destroy(),this._deconflictor.destroy(),this._checkOcclusion.clear(),this._active.clear()}setDirty(){!this._dirty&&(this._active.size>0||this._checkOcclusion.size>0)&&(this._dirty=!0,this.notifyChange("_readyToRun"))}setPriority(i,t){const e=this._active.get(i.graphic.uid)?.getInfo(this.visibilityGroup);e&&(e.priority=t)}get _readyToRun(){return 0!==this._state||this._dirty}get updating(){return this._readyToRun||this._updatingHandles.updating}get updatingProgress(){if(!this.updating)return 1;const i=this._state/5;return this._dirty?.5*i:i}get readyToRun(){return this.view.ready&&null!=this.view.state&&this._readyToRun}get usedMemory(){return this._occlusionQuery?.usedMemory??0+4*(this._occlusionQueryUids?.length??0)}runTask(i){switch(this._state){case 0:this._startUpdate(),i.madeProgress();case 1:if(this._state=1,!this._processCheckOcclusion(i))return;case 2:if(this._state=2,this._occlusionQuery&&!this._occlusionQuery.done)return E;this._readOcclusionQueryResult(),i.madeProgress();case 3:if(this._state=3,!this._collectActiveGraphics(i))return;case 4:if(this._state=4,this._deconflictor.run(i),!this._deconflictor.done)return;default:this._state=0,this.notifyChange("_readyToRun")}}setGraphicsActive(i,t){t?i.forEach(i=>this.addToActiveGraphics(i)):i.forEach(i=>this.removeFromActiveGraphics(i))}layerSupportsDeconfliction(i){if(null==i||"object3d"!==i.type)return!1;const t=i.stageObject;if(1!==(t?.geometries.length??0))return!1;const e=t?.geometries[0],s=e?.material;return s instanceof N}_startUpdate(){R(this.view),this._dirty=!1,this._viewState.copyFrom(this.viewState);const{fullWidth:i,fullHeight:t}=this._viewState.camera;this._deconflictor.reset(i,t),this._resetIterators(),this._occlusionQueryUids.length=0,this._checkOcclusion.size||(this._occlusionQuery=s(this._occlusionQuery))}addToActiveGraphics(i){i.ensureInfo(this.visibilityGroup),this._active.set(i.graphics3DGraphic.graphic.uid,i),this.setDirty()}removeFromActiveGraphics(i){si(i,this.visibilityGroup),i.removeInfo(this.visibilityGroup),this._active.delete(i.graphics3DGraphic.graphic.uid),this.setDirty()}addToCheckOcclusion(i){this._checkOcclusion.set(i.graphics3DGraphic.graphic.uid,i),this.setDirty()}removeFromCheckOcclusion(i){this._checkOcclusion.delete(i.graphics3DGraphic.graphic.uid)}_processCheckOcclusion(i){if(0===this._checkOcclusion.size)return!0;const t=this._ensureCheckOcclusionIterator(),e=this._viewState.camera,r=c(q,e.viewInverseTransposeMatrix),o=this.view.map.ground.opacity>0,n="global"===this.view.viewingMode&&o&&e.relativeElevation>0?Y:null;let a=0;null!=n&&(l(n.center,p,e.viewMatrix),n.radius=b(this.view.spatialReference).radius,a=V.distanceToSilhouette(n,p));const h=O();for(;;){if(i.done)return!1;i.madeProgress();const s=t.next();if(!0===s.done)break;const o=s.value,c=o.graphics3DGraphic;if(c.destroyed)continue;if(!c.isVisible(1,8))continue;const u=ni(c,this.visibilityGroup);let d=null,p=!0;for(const i of u){if(!this.layerSupportsDeconfliction(i))continue;d=ai,this._projectHudLayer(i,e,d),w(h);const t=i.stageObject.geometries[0].material;if(this._expandBoundingRect(h,e,i,t,d),d.isOutsideScreen){p=!1;break}if(this._isCulledBySlice(o,d.positionView)){p=!1;break}if(null!=n&&ci(d,n,a)){p=!1;break}l(F,d.positionView,r),d.altitude=this.view.renderCoordsHelper.getAltitude(F);const s=o.ensureInfo(this.visibilityGroup);if(s.altitude=d.altitude,s.distance=d.distance,s.distanceToOccluder=d.distanceToOccluder,s.culled=!1,D(s.aabr,h),t.parameters.occlusionTest)break;this._ensureOcclusionQuery().addPosition(F)===this._occlusionQueryUids.length&&this._occlusionQueryUids.push(c.graphic.uid);break}if(this._active.has(c.graphic.uid)&&(!p||!d)){const i=o.ensureInfo(this.visibilityGroup);i.visible=!d,i.culled=!0}}return this._checkOcclusionIterator=null,this._occlusionQueryUids.length||(this._occlusionQuery=s(this._occlusionQuery)),this._occlusionQuery?.start(),!0}_readOcclusionQueryResult(){if(!this._occlusionQuery||!this._occlusionQueryUids.length)return;const i=this._viewState.camera,t=this.view.renderCoordsHelper.getAltitude(i.eye);for(let e=0;e<this._occlusionQueryUids.length;e++){const i=this._occlusionQueryUids[e],s=this._checkOcclusion.get(i);if(!s)continue;const r=this._occlusionQuery.getOcclusion(e)??-1,o=s.getInfo(this.visibilityGroup);o&&(o.distanceToOccluder=r>0?o.distance-r:0);const c=r<=0||this._occludedVisibility(o?.distanceToOccluder??0,o?.distance??r,o?.altitude??0,t);this._active.has(i)?o&&(o.culled=!c,o.visible=c):this._setGraphicVisibility(s,c)}this._occlusionQueryUids.length=0}_collectActiveGraphics(i){const t=this._ensureActiveGraphicsIterator(),e=16===this.visibilityGroup;for(;!i.done;){i.madeProgress();const s=t.next();if(!0===s.done)return this._activeIterator=null,!0;const r=s.value,o=r.getInfo(this.visibilityGroup);if(!o)continue;!(!e||r.graphics3DGraphic.isVisible())||o.culled?(A(o.aabr,!1,!0),this._setGraphicVisibility(r,o.visible)):this._deconflictor.add(o)}return!1}_occludedVisibility(i,t,e,s){const r=Math.max(this._minAltitudeDifference,Math.abs(e-s))-this._minAltitudeDifference;return 0===i||t-i<=this._baseOccludedVisibility+this._altitudeFactor*r}_resetIterators(){this._checkOcclusionIterator=null,this._activeIterator=null}_ensureCheckOcclusionIterator(){return this._checkOcclusionIterator??=this._checkOcclusion.values(),this._checkOcclusionIterator}_ensureActiveGraphicsIterator(){return this._activeIterator??=this._active.values(),this._activeIterator}_ensureOcclusionQuery(){return this._occlusionQuery??=new H({view:this.view}),this._occlusionQueryUids.length||this._occlusionQuery.init(this._checkOcclusion.size,this._viewState.camera.eye),this._occlusionQuery}_projectHudLayer(i,t,e){const s=i.stageObject,r=s.geometries[0],o=r.material;l(z,s.boundingVolumeWorldSpace.bounds.center,t.viewMatrix);const c=r.attributes,n=c.get("normal").data,a=c.get("centerOffsetAndDistance").data;o.applyShaderOffsetsView(z,n,s.transformation,a,t,e.screenSizePerspectiveEvaluators,z),y(B,z[0],z[1],z[2],1),f(W,B,t.projectionMatrix),h(e.positionNDC,W,1/W[3]),o.applyShaderOffsetsNDC(e.positionNDC,a,t,e.positionNDC,L),e.distanceWithoutPolygonOffset=t.depthNDCToWorld(L[2]),e.distance=L[2]===e.positionNDC[2]?e.distanceWithoutPolygonOffset:t.depthNDCToWorld(e.positionNDC[2]),y(W,e.positionNDC[0],e.positionNDC[1],e.positionNDC[2],1),f(B,W,t.inverseProjectionMatrix),g(B,B,1/B[3]),u(e.positionView,z[0],z[1],z[2])}_isCulledBySlice(i,t){return i.slicePlaneEnabled&&this._viewState.slicePlaneEnabled&&Q(this._viewState.slicePlane,t)}_expandBoundingRect(i,t,s,r,{positionNDC:o,screenSizePerspectiveEvaluators:c}){const n=s.getScreenSize(ri);c.evaluator.applyVec2(n,n),n[0]*=t.pixelRatio,n[1]*=t.pixelRatio;const a=G(r.calculateRelativeScreenBounds(n,c.alignmentEvaluator.apply(t.pixelRatio),X),e(0,t.fullWidth,.5+.5*o[0]),e(0,t.fullHeight,.5+.5*o[1])),l=this.marginFactor;if(0!==l){const i=l*Math.min(I(a),j(a));a[0]-=i,a[1]-=i,a[2]+=i,a[3]+=i}k(i,a,i)}_setGraphicVisibility(i,t){const e=i?.graphics3DGraphic;e&&!e.destroyed&&(e.setVisibilityFlag(this.visibilityGroup,8,t),16===this.visibilityGroup&&this.view.labeler.setLabelGraphicVisibility(e,t))}};function si(i,t){const e=i.graphics3DGraphic;e.destroyed||e.setVisibilityFlag(t,8,!0)}i([r({constructOnly:!0})],ei.prototype,"view",void 0),i([r({type:Boolean,readOnly:!0})],ei.prototype,"_readyToRun",null),i([r({type:Boolean,readOnly:!0})],ei.prototype,"updating",null),i([r({readOnly:!0})],ei.prototype,"_updatingHandles",void 0),ei=i([o("esri.views.3d.layers.graphics.Deconflictor")],ei);const ri=a();class oi{constructor(){this.positionView=_(),this.positionNDC=_(),this.altitude=0,this.distance=0,this.distanceToOccluder=0,this.distanceWithoutPolygonOffset=0,this.screenSizePerspectiveEvaluators=new M}get isOutsideScreen(){const i=this.positionNDC;return i[0]<-1||i[1]<-1||i[2]<-1||i[0]>=1||i[1]>=1||i[2]>=1}}function ci(i,t,e){return d(J.direction,i.positionView),u(J.origin,0,0,0),!!t.intersectRay(J,K)&&i.distanceWithoutPolygonOffset>e}function ni(i,t){return 16===t?i.labelLayers:i.layers}const ai=new oi;export{ei as Deconflictor,ii as DeconflictorGraphic,ti as DeconflictorViewState};
@@ -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 t from"../../../../core/Accessor.js";import{watch as i,sync as s,initial as r}from"../../../../core/reactiveUtils.js";import{property as n,subclass as o}from"../../../../core/accessorSupport/decorators.js";import{getReferenceEllipsoid as a}from"../../../../geometry/ellipsoidUtils.js";import{FrustumExtentIntersection as l}from"../../support/FrustumExtentIntersection.js";import{TaskPriority as h}from"../../../support/Scheduler.js";import{Yield as p}from"../../../support/Yield.js";const c=1.2;let u=class extends t{constructor(e){super(e),this.suspended=!1,this._extent=null,this._extentIntersectionDirty=!0,this._isVisibleBelowSurfaceInternal=!1,this.graphicsCoreOwner=null,this.updating=!0}initialize(){const{graphicsCoreOwner:e}=this;this._extentIntersection=new l({renderCoordsHelper:e.view.renderCoordsHelper});const t=e.view,n=t.basemapTerrain,o=t.resourceController.scheduler;this.addHandles([t.on("resize",()=>this._viewChange()),i(()=>t.state.camera,()=>this._viewChange(),s),o.registerTask(h.FRUSTUM_VISIBILITY,this),i(()=>n.visibleElevationRange,()=>this._elevationRangeChange())]),"local"===t.viewingMode?this._isVisibleBelowSurface=!0:this.addHandles([i(()=>[n.baseOpacity,n.wireframe,t.map?.ground?.navigationConstraint?.type],()=>this._updateIsVisibleBelowSurface(),r)])}destroy(){this._set("graphicsCoreOwner",null),this._extent=null,this._extentIntersection=null}_setDirty(){this.updating||this._set("updating",!0)}setExtent(e){this._extent=e,this._extentIntersectionDirty=!0,this._setDirty()}_viewChange(){this._setDirty()}_elevationRangeChange(){this._setDirty(),this._extentIntersectionDirty=!0}set _isVisibleBelowSurface(e){this._isVisibleBelowSurfaceInternal=e,this._setDirty(),this._extentIntersectionDirty=!0}_updateIsVisibleBelowSurface(){const e=this.graphicsCoreOwner.view,t=e.basemapTerrain,i="local"===e.viewingMode,s="none"===e.map.ground?.navigationConstraint?.type;this._isVisibleBelowSurface=i||!t.opaque||s}_updateExtentIntersection(){if(!this._extentIntersectionDirty)return;this._extentIntersectionDirty=!1;const e=this.graphicsCoreOwner.view;let t;if(this._isVisibleBelowSurfaceInternal)t=-.3*a(e.spatialReference).radius;else{const{minElevation:i,maxElevation:s}=e.basemapTerrain.visibleElevationRange;t=i-Math.max(1,(s-i)*(c-1))}this._extentIntersection.update(this._extent,e.spatialReference,t)}get readyToRun(){return this.updating}runTask(e){if(this._set("updating",!1),!this._extent)return this._set("suspended",!1),p;this._updateExtentIntersection();const t=this.graphicsCoreOwner.view.frustum,i=a(this.graphicsCoreOwner.view.spatialReference).radius;this._set("suspended",!this._extentIntersection.isVisibleInFrustum(t,i)),e.madeProgress()}};e([n({readOnly:!0})],u.prototype,"suspended",void 0),e([n({constructOnly:!0})],u.prototype,"graphicsCoreOwner",void 0),e([n({readOnly:!0})],u.prototype,"updating",void 0),u=e([o("esri.views.3d.layers.graphics.Graphics3DFrustumVisibility")],u);export{u as Graphics3DFrustumVisibility};
5
+ import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{watch as i,sync as s,initial as r}from"../../../../core/reactiveUtils.js";import{property as n,subclass as o}from"../../../../core/accessorSupport/decorators.js";import{getReferenceEllipsoid as a}from"../../../../geometry/ellipsoidUtils.js";import{FrustumExtentIntersection as l}from"../../support/FrustumExtentIntersection.js";import{TaskPriority as h}from"../../../support/Scheduler.js";import{Yield as p}from"../../../support/Yield.js";const c=1.2;let u=class extends t{constructor(e){super(e),this.suspended=!1,this._extent=null,this._extentIntersectionDirty=!0,this._isVisibleBelowSurfaceInternal=!1,this.graphicsCoreOwner=null,this.updating=!0}initialize(){const{graphicsCoreOwner:e}=this;this._extentIntersection=new l({renderCoordsHelper:e.view.renderCoordsHelper});const{view:t}=e,{groundView:n}=t,{scheduler:o}=t.resourceController;this.addHandles([t.on("resize",()=>this._viewChange()),i(()=>t.state.camera,()=>this._viewChange(),s),o.registerTask(h.FRUSTUM_VISIBILITY,this),i(()=>n.visibleElevationRange,()=>this._elevationRangeChange())]),"local"===t.viewingMode?this._isVisibleBelowSurface=!0:this.addHandles([i(()=>[n.baseOpacity,n.wireframe,t.map?.ground?.navigationConstraint?.type],()=>this._updateIsVisibleBelowSurface(),r)])}destroy(){this._set("graphicsCoreOwner",null),this._extent=null,this._extentIntersection=null}_setDirty(){this.updating||this._set("updating",!0)}setExtent(e){this._extent=e,this._extentIntersectionDirty=!0,this._setDirty()}_viewChange(){this._setDirty()}_elevationRangeChange(){this._setDirty(),this._extentIntersectionDirty=!0}set _isVisibleBelowSurface(e){this._isVisibleBelowSurfaceInternal=e,this._setDirty(),this._extentIntersectionDirty=!0}_updateIsVisibleBelowSurface(){const e=this.graphicsCoreOwner.view,t=e.basemapTerrain,i="local"===e.viewingMode,s="none"===e.map.ground?.navigationConstraint?.type;this._isVisibleBelowSurface=i||!t.opaque||s}_updateExtentIntersection(){if(!this._extentIntersectionDirty)return;this._extentIntersectionDirty=!1;const e=this.graphicsCoreOwner.view;let t;if(this._isVisibleBelowSurfaceInternal)t=-.3*a(e.spatialReference).radius;else{const{minElevation:i,maxElevation:s}=e.basemapTerrain.visibleElevationRange;t=i-Math.max(1,(s-i)*(c-1))}this._extentIntersection.update(this._extent,e.spatialReference,t)}get readyToRun(){return this.updating}runTask(e){if(this._set("updating",!1),!this._extent)return this._set("suspended",!1),p;this._updateExtentIntersection();const t=this.graphicsCoreOwner.view.frustum,i=a(this.graphicsCoreOwner.view.spatialReference).radius;this._set("suspended",!this._extentIntersection.isVisibleInFrustum(t,i)),e.madeProgress()}};e([n({readOnly:!0})],u.prototype,"suspended",void 0),e([n({constructOnly:!0})],u.prototype,"graphicsCoreOwner",void 0),e([n({readOnly:!0})],u.prototype,"updating",void 0),u=e([o("esri.views.3d.layers.graphics.Graphics3DFrustumVisibility")],u);export{u as Graphics3DFrustumVisibility};
@@ -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 t from"../../../../core/Error.js";import{px2pt as r,pt2px as i}from"../../../../core/screenUtils.js";import{fromValues as a}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{d as s}from"../../../../chunks/vec42.js";import{ZEROS as o,ones as l,clone as n}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import c from"../../../../geometry/Extent.js";import h from"../../../../geometry/Polygon.js";import{create as p,fromBuffer as m,intersectsClippingArea as y,empty as _,expandWithAABB as d,expandWithBuffer as u}from"../../../../geometry/support/aaBoundingBox.js";import{getDriverAxisSizeValueAny as g}from"../../../../renderers/support/renderingInfoUtils.js";import{sharedGeometryElevationAligner as f}from"./ElevationAligners.js";import{elevationModeChangeUpdateType as b,needsElevationUpdates2D as v}from"./elevationAlignmentUtils.js";import{Graphics3DDrapedGraphicLayer as C}from"./Graphics3DDrapedGraphicLayer.js";import{Graphics3DObject3DGraphicLayer as P}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as M,nanFallbackColor as k}from"./Graphics3DSymbolLayer.js";import{parseCapType as w,parseLineMarkerStyle as L}from"./lineUtils.js";import{initFastSymbolUpdatesState as S,updateFastSymbolUpdatesState as x,getAttributeValue as z,ConvertOptions as U}from"../support/FastSymbolUpdates.js";import{debugFlags as j}from"../../support/debugFlags.js";import{createGeometry as V}from"../../support/engineContent/line.js";import{geometryToRenderInfo as O,geometryToRenderInfoDraped as A}from"../../support/renderInfoUtils/line.js";import{Object3D as E}from"../../webgl-engine/lib/Object3D.js";import{RenderGeometry as G}from"../../webgl-engine/lib/RenderGeometry.js";import{LineMarkerMaterial as D}from"../../webgl-engine/materials/LineMarkerMaterial.js";import{getStipplePatternForLinePattern as F}from"../../webgl-engine/materials/lineStippleUtils.js";import{RibbonLineMaterial as R}from"../../webgl-engine/materials/RibbonLineMaterial.js";const I=["polyline","polygon","extent"];class W extends M{static{this.elevationModeChangeTypes={definedChanged:2,staysOnTheGround:0,onTheGroundChanged:2}}constructor(e,t,r,i){super(e,t,r,i,T(t))}async doLoad(){this._fastUpdates=S(this._context.renderer,this._fastVisualVariableConvertOptions());const e=!0;if(this._fastMarkerUpdates=S(this._context.renderer,this._fastVisualVariableConvertOptions(e)),!this._drivenProperties.size){if((null!=this.symbolLayer.size?this.symbolLayer.size:r(1))<0)throw new t("graphics3dlinesymbollayer:invalid-size","Symbol sizes may not be negative values")}}_getMaterialParameters(e,t){const r=this._screenSizePerspective,i={...this._getMaterialColorParameters(t),width:this._computeMaterialWidth(this.symbolLayer?.size),hasPolygonOffset:!0,join:this.symbolLayer.join||"miter",cap:w(this.symbolLayer.cap||"butt"),hasSlicePlane:this._context.slicePlaneEnabled,isClosed:e,stipplePattern:F(this.symbolLayer.pattern),emissiveStrength:this._emissiveStrength??0,screenSizePerspective:r};return 4===t&&this._fastMarkerUpdates?.visualVariables?{...i,...this._fastMarkerUpdates.materialParameters}:this._fastUpdates?.visualVariables?{...i,...this._fastUpdates.materialParameters}:i}_getMaterialColorParameters(e){const t=4===e,r=this._getCombinedOpacityAndColor(t&&this._markerColor||this._materialColor);return this._patternHidesLine&&!t&&(r[3]=0),{color:r}}get _materialColor(){return this.symbolLayer.material?.color}get _emissiveStrength(){return this.symbolLayer.material?.emissive?.strength}get _markerColor(){return this.symbolLayer.marker?.color}get _lineMaterial(){return null==this._materials[0]&&(this._materials[0]=new R(this._getMaterialParameters(!1,0),this.view.state.isGlobal)),this._materials[0]}get _ringMaterial(){return null==this._materials[1]&&(this._materials[1]=new R(this._getMaterialParameters(!0,1),this.view.state.isGlobal)),this._materials[1]}get _wireframeLineMaterial(){return null==this._materials[2]&&(this._materials[2]=new R({...this._getMaterialParameters(!1,2),wireframe:!0},this.view.state.isGlobal)),this._materials[2]}get _wireframeRingMaterial(){return null==this._materials[3]&&(this._materials[3]=new R({...this._getMaterialParameters(!0,3),wireframe:!0},this.view.state.isGlobal)),this._materials[3]}get _markerMaterial(){return null==this._materials[4]&&null!=this.symbolLayer.marker&&(this._materials[4]=new D({...this._getMaterialParameters(!1,4),placement:this.symbolLayer.marker.placement,markerPrimitive:L(this.symbolLayer.marker.style)},this.view.state.isGlobal)),this._materials[4]}_getDrivenSize(e){if(this._drivenProperties.size){const t=e.size;return null!=t?i(g(t)):this._getFallbackSize()}return 1}_getDrivenColor({color:e,opacity:t}){const r=l();return this._drivenProperties.color&&(s(r,e??this._getFallbackOpacityAndColor(o)),null==t)||this._drivenProperties.opacity&&(e||this._materialColor)&&(r[3]=t??this._getFallbackOpacity()),r}_getDrivenMarkerColor({color:e,opacity:t}){const r=l();return this._drivenProperties.color&&(s(r,e??this._getFallbackMarkerOpacityAndColor(o)),null==t)||this._drivenProperties.opacity&&(e||this._markerColor||this._materialColor)&&(r[3]=t??this._getFallbackMarkerOpacity()),r}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,I,this.symbolLayer.type))return null;const r=this.createElevationContextForGraphic(t);return this.ensureDrapedStatus("on-the-ground"===r.mode),this.draped?this._createAsOverlay(e):this._createAs3DShape(e,r,t.uid)}applyRendererDiff(e,t){for(const r in e.diff){if("visualVariables"!==r)return 0;{const e=this._fastUpdates;if(!x(e,t,this._fastVisualVariableConvertOptions()))return 0;for(const t of this._materials)t instanceof R&&t.setParameters(e.materialParameters);const r=this._fastMarkerUpdates,i=!0;if(!x(r,t,this._fastVisualVariableConvertOptions(i)))return 0;for(const t of this._materials)t instanceof D&&t.setParameters(r.materialParameters)}}return 2}prepareSymbolLayerPatch(e){if("partial"!==e.diff.type)return;const t=e.diff.diff,r={};"complete"===t.size?.type&&(r.width=this._computeMaterialWidth(t.size.newValue),delete t.size),"complete"===t.cap?.type&&(r.cap=w(t.cap.newValue??"butt"),delete t.cap);const i=this._prepareMarkerPatch(e,t);this._prepareMaterialPatch(e,t,i),e.symbolLayerStatePatches.push(()=>{for(const e of this._materials)e?.setParameters(r)})}layerOpacityChanged(){for(let e=0;e<5;e++)this._materials[e]?.setParameters(this._getMaterialColorParameters(e))}get _screenSizePerspective(){return!this.draped&&this._context.screenSizePerspectiveEnabled?this.view.screenSizePerspective.parameters:null}layerScreenSizePerspectiveChanged(){const e=this._screenSizePerspective;for(const t of this._materials)t?.setParameters({screenSizePerspective:e})}layerElevationInfoChanged(e,t,r){const i=this._elevationContext.mode,a=b(W.elevationModeChangeTypes,r,i);if(1!==a)return a;const s=v(i);return this.updateGraphics3DGraphicElevationInfo(e,t,()=>s)}slicePlaneEnabledChanged(){const e={hasSlicePlane:this._context.slicePlaneEnabled};for(const t of this._materials)t?.setParameters(e);return!0}physicalBasedRenderingChanged(){return!0}_createAs3DShape(e,t,r){const i=H(e.graphic.geometry),a="polygon"===i.type?i.rings:i.paths,s=new Array,o=p(),l=O(i,this._context.elevationProvider,this._context.renderCoordsHelper,t),n="polygon"===i.type?"rings":"paths";this._logGeometryCreationWarnings(l,a,n,"LineSymbol3DLayer");for(let p=0;p<l.lines.length;p++){const t=l.lines[p],a=t.position,n=t.mapPositions;if(null!=this._context.clippingExtent&&(m(n,o),!y(o,this._context.clippingExtent)))continue;const c=this._createGeometry("polygon"===i.type?this._ringMaterial:this._lineMaterial,e,a,n,i.type,1,r);if(s.push(c),j.LINE_WIREFRAMES&&s.push(c.instantiate({material:"polygon"===i.type?this._wireframeRingMaterial:this._wireframeLineMaterial})),null!=this._markerMaterial){const t=c.instantiate({material:this._markerMaterial});t.attributes.has("color")&&t.setAttributeData("color",this._getDrivenMarkerColor(e.renderingInfo)),s.push(t)}}if(0===s.length)return null;const c=this._context.layerViewUid,h=new E({geometries:s,castShadow:!1,layerViewUid:c,graphicUid:r}),_=new P(this,h,null,f,t);return _.alignedSampledElevation=l.sampledElevation,_.needsElevationUpdates=v(t.mode),_}_createGeometry(e,t,r,i,a,s,o){const l=0===s?{spatialReference:this._context.overlaySR,renderCoordsHelper:this._context.renderCoordsHelper}:null,n="polygon"===a,c=this._fastUpdates?.visualVariables.color,h=this._fastUpdates?.visualVariables.size,p=this._fastUpdates?.visualVariables.opacity,m=this._context.layerViewUid,y=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:o,layerViewUid:m}),_={position:r,size:h?null:this._getDrivenSize(t.renderingInfo),color:c?null:this._getDrivenColor(t.renderingInfo),sizeFeature:h?z(h.field,t.graphic):null,colorFeature:c?z(c.field,t.graphic):null,opacityFeature:p?z(p.field,t.graphic):null};return V(e,{overlayInfo:l,removeDuplicateStartEnd:n,mapPositions:i,attributeData:_},y)}_createAsOverlay(e){const t=e.graphic,r=H(t.geometry),i="polygon"===r.type?r.rings:r.paths,a="polygon"===r.type?this._ringMaterial:this._lineMaterial;a.renderPriority=this._renderPriority;const s=j.LINE_WIREFRAMES?"polygon"===r.type?this._wireframeRingMaterial:this._wireframeLineMaterial:null,o=this._markerMaterial;null!=s&&(s.renderPriority=this._renderPriority-.001),null!=o&&(o.renderPriority=this._renderPriority-.002);const l=new Array,n=p(),c=_(),h=A(r,this._context.overlaySR),g="polygon"===r.type?"rings":"paths";this._logGeometryCreationWarnings(h,i,g,"LineSymbol3DLayer");for(const p of h.lines){if(m(p.position,n),!y(n,this._context.clippingExtent))continue;d(c,n);const i=this._createGeometry(a,e,p.position,void 0,r.type,0,t.uid),h=e=>{const r=this._context.layerViewUid,i=new G(e,{layerViewUid:r,graphicUid:t.uid});l.push(i)};if(null!=o){const t=i.instantiate({material:o});t.attributes.has("color")&&t.setAttributeData("color",this._getDrivenMarkerColor(e.renderingInfo)),h(t);const r=this.symbolLayer.marker.placement;"begin"!==r&&"begin-end"!==r||u(n,p.position,0,1),"end"!==r&&"begin-end"!==r||u(n,p.position,p.position.length-3,1)}h(i),j.LINE_WIREFRAMES&&h(i.instantiate({material:s}))}return new C(this,l,c,this._context.drapeSourceRenderer)}get _patternHidesLine(){const e=this.symbolLayer.pattern;return null!=e&&"style"===e.type&&"none"===e.style}_computeMaterialWidth(e){return e=e??r(1),this._drivenProperties.size?this._fastUpdates?.visualVariables.size?i(1):1:i(e)}_prepareMaterialPatch(e,t,r){const i=t.material;if(null==i)return void(r.changed&&r.useMaterialColor&&B(this._getCombinedOpacityAndColor(this._materialColor),this._materials[4],e));if("collection"===i.type)return;const a="complete"===i.type?i.newValue?.color:"complete"===i.diff.color?.type?i.diff.color.newValue:null,s=this._getCombinedOpacityAndColor(a);r.useMaterialColor&&B(n(s),this._materials[4],e),this._patternHidesLine&&(s[3]=0),B(s,this._materials[0],e),delete t.material}_prepareMarkerPatch(e,t){const r=t.marker,i=this._markerMaterial;if(null==r||"partial"!==r.type||null==r.diff||null!=r.diff.placement||null!=r.diff.style&&"complete"!==r.diff.style.type||null!=r.diff.color&&"complete"!==r.diff.color.type||null==i)return{changed:!1,useMaterialColor:null==this._markerColor};const a=r.diff.color,s=null!=a,o=s?a.newValue:null,l=null==o&&null==this._markerColor;o&&B(this._getCombinedOpacityAndColor(o),i,e);const n=r.diff.style?.newValue;return n&&e.symbolLayerStatePatches.push(()=>i.setParameters({markerPrimitive:L(n)})),delete t.marker,{changed:s,useMaterialColor:l}}_fastVisualVariableConvertOptions(e=!1){const t=this._getFallbackSize();return new U({supports:{size:!0,color:!0,rotation:!1,opacity:!0},fallbackColor:e?this._getFallbackMarkerOpacityAndColor(k):this._getFallbackOpacityAndColor(k),fallbackSize:a(t,t,t)})}_getFallbackOpacityAndColor(t){return e.toUnitRGBA(this._materialColor)??t}_getFallbackOpacity(){return this._materialColor?.a??0}_getFallbackMarkerOpacityAndColor(t){const r=this.symbolLayer?.marker?.color;return e.toUnitRGBA(r)??this._getFallbackOpacityAndColor(t)}_getFallbackMarkerOpacity(){return this.symbolLayer?.marker?.color?.a??this._getFallbackOpacity()}_getFallbackSize(){const e=this.symbolLayer?.size;return null!=e?i(e):1}}function H(e){switch(e.type){case"extent":if(e instanceof c)return h.fromExtent(e);break;case"polygon":case"polyline":return e}return null}function B(e,t,r){null!=t&&r.symbolLayerStatePatches.push(()=>t.setParameters({color:e}))}function T(e){const t=e.material?.color,r=e.marker?.color??t;return 1===(t?.a??0)&&1===(r?.a??0)}export{W as Graphics3DLineSymbolLayer};
5
+ import e from"../../../../Color.js";import t from"../../../../core/Error.js";import{px2pt as r,pt2px as i}from"../../../../core/screenUtils.js";import{fromValues as a}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{f as s}from"../../../../chunks/vec42.js";import{ZEROS as o,ones as l,clone as n}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import c from"../../../../geometry/Extent.js";import h from"../../../../geometry/Polygon.js";import{create as p,fromBuffer as m,intersectsClippingArea as y,empty as _,expandWithAABB as u,expandWithBuffer as d}from"../../../../geometry/support/aaBoundingBox.js";import{getDriverAxisSizeValueAny as f}from"../../../../renderers/support/renderingInfoUtils.js";import{sharedGeometryElevationAligner as g}from"./ElevationAligners.js";import{elevationModeChangeUpdateType as b,needsElevationUpdates2D as v}from"./elevationAlignmentUtils.js";import{Graphics3DDrapedGraphicLayer as C}from"./Graphics3DDrapedGraphicLayer.js";import{Graphics3DObject3DGraphicLayer as P}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as M,nanFallbackColor as k}from"./Graphics3DSymbolLayer.js";import{parseCapType as w,parseLineMarkerStyle as L}from"./lineUtils.js";import{initFastSymbolUpdatesState as S,updateFastSymbolUpdatesState as x,getAttributeValue as z,ConvertOptions as U}from"../support/FastSymbolUpdates.js";import{debugFlags as j}from"../../support/debugFlags.js";import{createGeometry as V}from"../../support/engineContent/line.js";import{geometryToRenderInfo as O,geometryToRenderInfoDraped as A}from"../../support/renderInfoUtils/line.js";import{Object3D as E}from"../../webgl-engine/lib/Object3D.js";import{RenderGeometry as G}from"../../webgl-engine/lib/RenderGeometry.js";import{LineMarkerMaterial as D}from"../../webgl-engine/materials/LineMarkerMaterial.js";import{getStipplePatternForLinePattern as F}from"../../webgl-engine/materials/lineStippleUtils.js";import{RibbonLineMaterial as R}from"../../webgl-engine/materials/RibbonLineMaterial.js";const I=["polyline","polygon","extent"];class W extends M{static{this.elevationModeChangeTypes={definedChanged:2,staysOnTheGround:0,onTheGroundChanged:2}}constructor(e,t,r,i){super(e,t,r,i,T(t))}async doLoad(){this._fastUpdates=S(this._context.renderer,this._fastVisualVariableConvertOptions());const e=!0;if(this._fastMarkerUpdates=S(this._context.renderer,this._fastVisualVariableConvertOptions(e)),!this._drivenProperties.size){if((null!=this.symbolLayer.size?this.symbolLayer.size:r(1))<0)throw new t("graphics3dlinesymbollayer:invalid-size","Symbol sizes may not be negative values")}}_getMaterialParameters(e,t){const r=this._screenSizePerspective,i={...this._getMaterialColorParameters(t),width:this._computeMaterialWidth(this.symbolLayer?.size),hasPolygonOffset:!0,join:this.symbolLayer.join||"miter",cap:w(this.symbolLayer.cap||"butt"),hasSlicePlane:this._context.slicePlaneEnabled,isClosed:e,stipplePattern:F(this.symbolLayer.pattern),emissiveStrength:this._emissiveStrength??0,screenSizePerspective:r};return 4===t&&this._fastMarkerUpdates?.visualVariables?{...i,...this._fastMarkerUpdates.materialParameters}:this._fastUpdates?.visualVariables?{...i,...this._fastUpdates.materialParameters}:i}_getMaterialColorParameters(e){const t=4===e,r=this._getCombinedOpacityAndColor(t&&this._markerColor||this._materialColor);return this._patternHidesLine&&!t&&(r[3]=0),{color:r}}get _materialColor(){return this.symbolLayer.material?.color}get _emissiveStrength(){return this.symbolLayer.material?.emissive?.strength}get _markerColor(){return this.symbolLayer.marker?.color}get _lineMaterial(){return null==this._materials[0]&&(this._materials[0]=new R(this._getMaterialParameters(!1,0),this.view.state.isGlobal)),this._materials[0]}get _ringMaterial(){return null==this._materials[1]&&(this._materials[1]=new R(this._getMaterialParameters(!0,1),this.view.state.isGlobal)),this._materials[1]}get _wireframeLineMaterial(){return null==this._materials[2]&&(this._materials[2]=new R({...this._getMaterialParameters(!1,2),wireframe:!0},this.view.state.isGlobal)),this._materials[2]}get _wireframeRingMaterial(){return null==this._materials[3]&&(this._materials[3]=new R({...this._getMaterialParameters(!0,3),wireframe:!0},this.view.state.isGlobal)),this._materials[3]}get _markerMaterial(){return null==this._materials[4]&&null!=this.symbolLayer.marker&&(this._materials[4]=new D({...this._getMaterialParameters(!1,4),placement:this.symbolLayer.marker.placement,markerPrimitive:L(this.symbolLayer.marker.style)},this.view.state.isGlobal)),this._materials[4]}_getDrivenSize(e){if(this._drivenProperties.size){const t=e.size;return null!=t?i(f(t)):this._getFallbackSize()}return 1}_getDrivenColor({color:e,opacity:t}){const r=l();return this._drivenProperties.color&&(s(r,e??this._getFallbackOpacityAndColor(o)),null==t)||this._drivenProperties.opacity&&(e||this._materialColor)&&(r[3]=t??this._getFallbackOpacity()),r}_getDrivenMarkerColor({color:e,opacity:t}){const r=l();return this._drivenProperties.color&&(s(r,e??this._getFallbackMarkerOpacityAndColor(o)),null==t)||this._drivenProperties.opacity&&(e||this._markerColor||this._materialColor)&&(r[3]=t??this._getFallbackMarkerOpacity()),r}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,I,this.symbolLayer.type))return null;const r=this.createElevationContextForGraphic(t);return this.ensureDrapedStatus("on-the-ground"===r.mode),this.draped?this._createAsOverlay(e):this._createAs3DShape(e,r,t.uid)}applyRendererDiff(e,t){for(const r in e.diff){if("visualVariables"!==r)return 0;{const e=this._fastUpdates;if(!x(e,t,this._fastVisualVariableConvertOptions()))return 0;for(const t of this._materials)t instanceof R&&t.setParameters(e.materialParameters);const r=this._fastMarkerUpdates,i=!0;if(!x(r,t,this._fastVisualVariableConvertOptions(i)))return 0;for(const t of this._materials)t instanceof D&&t.setParameters(r.materialParameters)}}return 2}prepareSymbolLayerPatch(e){if("partial"!==e.diff.type)return;const t=e.diff.diff,r={};"complete"===t.size?.type&&(r.width=this._computeMaterialWidth(t.size.newValue),delete t.size),"complete"===t.cap?.type&&(r.cap=w(t.cap.newValue??"butt"),delete t.cap);const i=this._prepareMarkerPatch(e,t);this._prepareMaterialPatch(e,t,i),e.symbolLayerStatePatches.push(()=>{for(const e of this._materials)e?.setParameters(r)})}layerOpacityChanged(){for(let e=0;e<5;e++)this._materials[e]?.setParameters(this._getMaterialColorParameters(e))}get _screenSizePerspective(){return!this.draped&&this._context.screenSizePerspectiveEnabled?this.view.screenSizePerspective.parameters:null}layerScreenSizePerspectiveChanged(){const e=this._screenSizePerspective;for(const t of this._materials)t?.setParameters({screenSizePerspective:e})}layerElevationInfoChanged(e,t,r){const i=this._elevationContext.mode,a=b(W.elevationModeChangeTypes,r,i);if(1!==a)return a;const s=v(i);return this.updateGraphics3DGraphicElevationInfo(e,t,()=>s)}slicePlaneEnabledChanged(){const e={hasSlicePlane:this._context.slicePlaneEnabled};for(const t of this._materials)t?.setParameters(e);return!0}physicalBasedRenderingChanged(){return!0}_createAs3DShape(e,t,r){const i=H(e.graphic.geometry),a="polygon"===i.type?i.rings:i.paths,s=new Array,o=p(),l=O(i,this._context.elevationProvider,this._context.renderCoordsHelper,t),n="polygon"===i.type?"rings":"paths";this._logGeometryCreationWarnings(l,a,n,"LineSymbol3DLayer");for(let p=0;p<l.lines.length;p++){const t=l.lines[p],a=t.position,n=t.mapPositions;if(null!=this._context.clippingExtent&&(m(n,o),!y(o,this._context.clippingExtent)))continue;const c=this._createGeometry("polygon"===i.type?this._ringMaterial:this._lineMaterial,e,a,n,i.type,1,r);if(s.push(c),j.LINE_WIREFRAMES&&s.push(c.instantiate({material:"polygon"===i.type?this._wireframeRingMaterial:this._wireframeLineMaterial})),null!=this._markerMaterial){const t=c.instantiate({material:this._markerMaterial});t.attributes.has("color")&&t.setAttributeData("color",this._getDrivenMarkerColor(e.renderingInfo)),s.push(t)}}if(0===s.length)return null;const c=this._context.layerViewUid,h=new E({geometries:s,castShadow:!1,layerViewUid:c,graphicUid:r}),_=new P(this,h,null,g,t);return _.alignedSampledElevation=l.sampledElevation,_.needsElevationUpdates=v(t.mode),_}_createGeometry(e,t,r,i,a,s,o){const l=0===s?{spatialReference:this._context.overlaySR,renderCoordsHelper:this._context.renderCoordsHelper}:null,n="polygon"===a,c=this._fastUpdates?.visualVariables.color,h=this._fastUpdates?.visualVariables.size,p=this._fastUpdates?.visualVariables.opacity,m=this._context.layerViewUid,y=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:o,layerViewUid:m}),_={position:r,size:h?null:this._getDrivenSize(t.renderingInfo),color:c?null:this._getDrivenColor(t.renderingInfo),sizeFeature:h?z(h.field,t.graphic):null,colorFeature:c?z(c.field,t.graphic):null,opacityFeature:p?z(p.field,t.graphic):null};return V(e,{overlayInfo:l,removeDuplicateStartEnd:n,mapPositions:i,attributeData:_},y)}_createAsOverlay(e){const t=e.graphic,r=H(t.geometry),i="polygon"===r.type?r.rings:r.paths,a="polygon"===r.type?this._ringMaterial:this._lineMaterial;a.renderPriority=this._renderPriority;const s=j.LINE_WIREFRAMES?"polygon"===r.type?this._wireframeRingMaterial:this._wireframeLineMaterial:null,o=this._markerMaterial;null!=s&&(s.renderPriority=this._renderPriority-.001),null!=o&&(o.renderPriority=this._renderPriority-.002);const l=new Array,n=p(),c=_(),h=A(r,this._context.overlaySR),f="polygon"===r.type?"rings":"paths";this._logGeometryCreationWarnings(h,i,f,"LineSymbol3DLayer");for(const p of h.lines){if(m(p.position,n),!y(n,this._context.clippingExtent))continue;u(c,n);const i=this._createGeometry(a,e,p.position,void 0,r.type,0,t.uid),h=e=>{const r=this._context.layerViewUid,i=new G(e,{layerViewUid:r,graphicUid:t.uid});l.push(i)};if(null!=o){const t=i.instantiate({material:o});t.attributes.has("color")&&t.setAttributeData("color",this._getDrivenMarkerColor(e.renderingInfo)),h(t);const r=this.symbolLayer.marker.placement;"begin"!==r&&"begin-end"!==r||d(n,p.position,0,1),"end"!==r&&"begin-end"!==r||d(n,p.position,p.position.length-3,1)}h(i),j.LINE_WIREFRAMES&&h(i.instantiate({material:s}))}return new C(this,l,c,this._context.drapeSourceRenderer)}get _patternHidesLine(){const e=this.symbolLayer.pattern;return null!=e&&"style"===e.type&&"none"===e.style}_computeMaterialWidth(e){return e=e??r(1),this._drivenProperties.size?this._fastUpdates?.visualVariables.size?i(1):1:i(e)}_prepareMaterialPatch(e,t,r){const i=t.material;if(null==i)return void(r.changed&&r.useMaterialColor&&B(this._getCombinedOpacityAndColor(this._materialColor),this._materials[4],e));if("collection"===i.type)return;const a="complete"===i.type?i.newValue?.color:"complete"===i.diff.color?.type?i.diff.color.newValue:null,s=this._getCombinedOpacityAndColor(a);r.useMaterialColor&&B(n(s),this._materials[4],e),this._patternHidesLine&&(s[3]=0),B(s,this._materials[0],e),delete t.material}_prepareMarkerPatch(e,t){const r=t.marker,i=this._markerMaterial;if(null==r||"partial"!==r.type||null==r.diff||null!=r.diff.placement||null!=r.diff.style&&"complete"!==r.diff.style.type||null!=r.diff.color&&"complete"!==r.diff.color.type||null==i)return{changed:!1,useMaterialColor:null==this._markerColor};const a=r.diff.color,s=null!=a,o=s?a.newValue:null,l=null==o&&null==this._markerColor;o&&B(this._getCombinedOpacityAndColor(o),i,e);const n=r.diff.style?.newValue;return n&&e.symbolLayerStatePatches.push(()=>i.setParameters({markerPrimitive:L(n)})),delete t.marker,{changed:s,useMaterialColor:l}}_fastVisualVariableConvertOptions(e=!1){const t=this._getFallbackSize();return new U({supports:{size:!0,color:!0,rotation:!1,opacity:!0},fallbackColor:e?this._getFallbackMarkerOpacityAndColor(k):this._getFallbackOpacityAndColor(k),fallbackSize:a(t,t,t)})}_getFallbackOpacityAndColor(t){return e.toUnitRGBA(this._materialColor)??t}_getFallbackOpacity(){return this._materialColor?.a??0}_getFallbackMarkerOpacityAndColor(t){const r=this.symbolLayer?.marker?.color;return e.toUnitRGBA(r)??this._getFallbackOpacityAndColor(t)}_getFallbackMarkerOpacity(){return this.symbolLayer?.marker?.color?.a??this._getFallbackOpacity()}_getFallbackSize(){const e=this.symbolLayer?.size;return null!=e?i(e):1}}function H(e){switch(e.type){case"extent":if(e instanceof c)return h.fromExtent(e);break;case"polygon":case"polyline":return e}return null}function B(e,t,r){null!=t&&r.symbolLayerStatePatches.push(()=>t.setParameters({color:e}))}function T(e){const t=e.material?.color,r=e.marker?.color??t;return 1===(t?.a??0)&&1===(r?.a??0)}export{W as Graphics3DLineSymbolLayer};
@@ -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"../../../../core/has.js";import t from"../../../../core/Logger.js";import{ONES as r}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{d as i,c as o}from"../../../../chunks/vec42.js";import{fromValues as s,ONES as n,ZEROS as a,fromArray as l}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{closeRings as p}from"../../../../geometry/support/coordsUtils.js";import{defaultSymbolLayerComplexity as c}from"./defaultSymbolComplexity.js";import{ElevationContext as d}from"./ElevationContext.js";import{zeroContext as h}from"./featureExpressionInfoUtils.js";import{mixinColorAndOpacity as u}from"./graphicUtils.js";import{Loadable as y}from"./Loadable.js";import{getAttributeValue as f}from"../support/FastSymbolUpdates.js";import{encodeNaNUInt8 as v}from"../support/symbolColorUtils.js";const g=()=>t.getLogger("esri.views.3d.layers.graphics.Graphics3DSymbolLayer");class m extends y{constructor(e,t,r,i,o=!0){super(r.schedule),this.symbol=e,this.symbolLayer=t,this._context=r,this._drivenOpacityFallbackAlwaysOpaque=o,this.ignoreDrivers=!1,this._drivenProperties={color:!1,opacity:!1,opacityAlwaysOpaque:!0,size:!1,rotation:!1},this._materials=[],this.logger=g(),this._elevationOptions={supportsOffsetAdjustment:!1,supportsOnTheGround:!0},this.skipHighSymbolLodsChanged=!0,this._renderPriority=i.renderPriority,this._renderPriorityStep=i.renderPriorityStep,this._elevationContext=new d,this.updateComplexity(),this.ignoreDrivers=i.ignoreDrivers,this.ignoreDrivers||(this._drivenProperties=_(this._context.renderer,o)),this._updateElevationContext()}destroy(){this.complexity=null,this._materials.length=0,super.destroy()}get view(){return this._context.stage.view}getCachedSize(){return null}get extentPadding(){return 0}get materials(){return this._materials}get estimatedMemory(){const{complexity:e}=this;if(null==e)return 0;return(this.draped?e.memory.draped:e.memory).bytesPerFeature}get usedMemory(){return this.estimatedMemory}_drivenPropertiesChanged(e){if(this.ignoreDrivers)return!1;const t=this._drivenProperties,r=_(e,this._drivenOpacityFallbackAlwaysOpaque);return r.color!==t.color||r.opacity!==t.opacity||r.opacityAlwaysOpaque!==t.opacityAlwaysOpaque||r.size!==t.size||r.rotation!==t.rotation}get needsDrivenTransparentPass(){return this._hasDrivenColorOrOpacity&&!this._drivenProperties.opacityAlwaysOpaque}get _hasDrivenColorOrOpacity(){return this._drivenProperties.color||this._drivenProperties.opacity}_logGeometryCreationWarnings(e,t,r,i){const o=e.projectionSuccess,s="polygons"in e?e.polygons:null,n=`${i} geometry failed to be created`;o?!this._logGeometryValidationWarnings(t,r,i)&&0===s?.length&&"rings"===r&&t.length>0&&t[0].length>2&&g().warnOncePerTick(`${n} (filled rings should use clockwise winding - try reversing the order of vertices)`):g().warnOncePerTick(`${n} (failed to project geometry to view spatial reference)`)}get needsUpdateFocus(){return!1}_logGeometryValidationWarnings(e,t,r){const i=`${r} geometry failed to be created`;return!e.length||1===e.length&&!e[0].length?(g().warnOncePerTick(`${i} (no ${t} were defined)`),!0):(!Array.isArray(e)||!Array.isArray(e[0]))&&(g().warnOncePerTick(`${i} (${t} should be defined as a 2D array)`),!0)}_validateGeometry(e,t=null,r=null){if(null!=t&&!t.includes(e.type))return this.logger.warn("unsupported geometry type for "+r+` symbol: ${e.type}`),!1;switch(e.type){case"point":{const t=e;if(!isFinite(t.x)||!isFinite(t.y))return g().warn("point coordinate is not a valid number, graphic skipped"),!1;break}case"polygon":p(e)}return!0}_defaultElevationInfoNoZ(){return x}_defaultElevationInfoZ(){return C}_updateElevationContext(){null!=this._elevationInfoOverride?(this._elevationContext.setFromElevationInfo(this._elevationInfoOverride),this._elevationContext.setFeatureExpressionInfoContext(null)):this._context.layer.elevationInfo?(this._elevationContext.setFromElevationInfo(this._context.layer.elevationInfo),this._elevationContext.setFeatureExpressionInfoContext(this._context.featureExpressionInfoContext)):this._elevationContext.reset()}getDefaultElevationInfo(e){return e.hasZ?this._defaultElevationInfoZ():this._defaultElevationInfoNoZ()}getGeometryElevationMode(e,t=this.getDefaultElevationInfo(e)){return this._elevationContext.mode||t.mode}setElevationInfoOverride(e){this._elevationInfoOverride=e,this._updateElevationContext()}createElevationContextForGraphic(e){const t=new d;return this.updateElevationContextForGraphic(t,e),t}updateElevationContextForGraphic(e,t){const r=t.geometry,i=this.getDefaultElevationInfo(r);e.unit=null!=this._elevationContext.unit?this._elevationContext.unit:i.unit,e.mode=this.getGeometryElevationMode(r,i),e.offsetMeters=this._elevationContext.meterUnitOffset??i.offset??0;const o=!this._elevationOptions.supportsOnTheGround&&"on-the-ground"===e.mode;o&&(e.mode="relative-to-ground",e.offsetMeters=0);const s=o?h:this._elevationContext.featureExpressionInfoContext;s?e.updateFeatureExpressionInfoContextForGraphic(s,t,this._context.layer):e.setFeatureExpressionInfoContext(null)}prepareSymbolLayerPatch(e){}onRemoveGraphic(e){}_getLayerOpacity(){if(this._context.graphicsCoreOwner&&"fullOpacity"in this._context.graphicsCoreOwner)return this._context.graphicsCoreOwner.fullOpacity??0;const e=this._context.layer.opacity;return e??1}_getCombinedOpacity(e,t=b){const r=this.draped?1:this._getLayerOpacity();return this._drivenProperties.color?r:e?r*(this._drivenProperties.opacity?1:e.a):t.hasIntrinsicColor?r:0}_getCombinedOpacityAndColor(t,i=b){const o=this._getCombinedOpacity(t,i);if(this._drivenProperties.color)return u(null,o);const s=null!=t?e.toUnitRGB(t):r;return u(s,o)}_getDrivenUInt8Color({color:t,opacity:r},i,o){const{color:s,opacity:l}=this._drivenProperties,p=e.toUnitRGBA(i)??(o?n:a),c=s?t??p:null,d=t||i||o,h=s?null:p[3];return u(c,l&&d?r??h:null,255)}_getDrivenUInt8ColorWithNaNSupport({color:t,opacity:r},n,a){const p=n?l(e.toUnitRGBA(n)):s(NaN,NaN,NaN,a?NaN:0);return this._drivenProperties.color&&null!=t&&i(p,t),this._drivenProperties.opacity&&null!=r&&(p[3]=r),o(p,p,255),v(p,p)}isFastUpdatesEnabled(){return null!=this._fastUpdates}updateComplexity(){this.complexity=this.computeComplexity()}computeComplexity(){return c(this.symbol,this.symbolLayer)}globalPropertyChanged(e,t,r){switch(e){case"opacity":return this.layerOpacityChanged(t,r),!0;case"screenSizePerspectiveEnabled":return this.layerScreenSizePerspectiveChanged(t,r),!0;case"elevationInfo":{const e=this._elevationContext.mode;this._updateElevationContext();return 2!==this.layerElevationInfoChanged(t,r,e)}case"slicePlaneEnabled":return this.slicePlaneEnabledChanged(t,r);case"physicalBasedRenderingEnabled":return this.physicalBasedRenderingChanged();case"pixelRatio":return this.pixelRatioChanged;case"skipHighSymbolLods":return this.skipHighSymbolLodsChanged;default:return!1}}get pixelRatioChanged(){return!0}updateGraphics3DGraphicElevationInfo(e,t,r){let i=1;return e?.forEach(e=>{const o=t(e);if(null!=o){const t=e.graphic;this.updateElevationContextForGraphic(o.elevationContext,t),o.needsElevationUpdates=r(o.elevationContext.mode)}else i=2}),i}applyRendererDiff(e,t){return 0}getFastUpdateAttrValues(e){if(!this._fastUpdates)return null;const t=this._fastUpdates.visualVariables,r=t.size?f(t.size.field,e):0,i=t.color?f(t.color.field,e):0,o=t.opacity?f(t.opacity.field,e):0;return s(r,i,o,0)}get draped(){return this._draped}ensureDrapedStatus(e){return null==this._draped?(this._draped=e,!0):(e!==this.draped&&g().warnOnce("A symbol can only produce either draped or non-draped visualizations. Use two separate symbol instances for draped and non-draped graphics if necessary."),!1)}test(){const e=()=>({size:this._fastUpdates?.visualVariables.size?.field??null,color:this._fastUpdates?.visualVariables.color?.field??null,opacity:this._fastUpdates?.visualVariables.opacity?.field??null,rotation:this._fastUpdates?.visualVariables.rotation?.field??null});return{drivenProperties:this._drivenProperties,getVisVarFields:e}}}function _(e,t){const r={color:!1,opacity:!1,opacityAlwaysOpaque:t,size:!1,rotation:!1};return e&&"visualVariables"in e&&e.visualVariables&&e.visualVariables.forEach(e=>{switch(e.type){case"color":if(r.color=!0,e.stops)for(let t=0;t<e.stops.length;t++){const i=e.stops[t].color;i&&i.a<1&&(r.opacityAlwaysOpaque=!1)}break;case"opacity":r.opacity=!0,r.opacityAlwaysOpaque=!1;break;case"size":r.size=!0;break;case"rotation":r.rotation=!0}}),r}const x={mode:"on-the-ground",offset:0,unit:"meters"},C={mode:"absolute-height",offset:0,unit:"meters"},b={hasIntrinsicColor:!1},O=s(NaN,NaN,NaN,NaN);export{m as Graphics3DSymbolLayer,_ as getDrivenProperties,O as nanFallbackColor};
5
+ import e from"../../../../Color.js";import"../../../../core/has.js";import t from"../../../../core/Logger.js";import{ONES as r}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{f as i,s as o}from"../../../../chunks/vec42.js";import{fromValues as s,ONES as n,ZEROS as a,fromArray as l}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{closeRings as p}from"../../../../geometry/support/coordsUtils.js";import{defaultSymbolLayerComplexity as c}from"./defaultSymbolComplexity.js";import{ElevationContext as d}from"./ElevationContext.js";import{zeroContext as h}from"./featureExpressionInfoUtils.js";import{mixinColorAndOpacity as u}from"./graphicUtils.js";import{Loadable as y}from"./Loadable.js";import{getAttributeValue as f}from"../support/FastSymbolUpdates.js";import{encodeNaNUInt8 as v}from"../support/symbolColorUtils.js";const g=()=>t.getLogger("esri.views.3d.layers.graphics.Graphics3DSymbolLayer");class m extends y{constructor(e,t,r,i,o=!0){super(r.schedule),this.symbol=e,this.symbolLayer=t,this._context=r,this._drivenOpacityFallbackAlwaysOpaque=o,this.ignoreDrivers=!1,this._drivenProperties={color:!1,opacity:!1,opacityAlwaysOpaque:!0,size:!1,rotation:!1},this._materials=[],this.logger=g(),this._elevationOptions={supportsOffsetAdjustment:!1,supportsOnTheGround:!0},this.skipHighSymbolLodsChanged=!0,this._renderPriority=i.renderPriority,this._renderPriorityStep=i.renderPriorityStep,this._elevationContext=new d,this.updateComplexity(),this.ignoreDrivers=i.ignoreDrivers,this.ignoreDrivers||(this._drivenProperties=_(this._context.renderer,o)),this._updateElevationContext()}destroy(){this.complexity=null,this._materials.length=0,super.destroy()}get view(){return this._context.stage.view}getCachedSize(){return null}get extentPadding(){return 0}get materials(){return this._materials}get estimatedMemory(){const{complexity:e}=this;if(null==e)return 0;return(this.draped?e.memory.draped:e.memory).bytesPerFeature}get usedMemory(){return this.estimatedMemory}_drivenPropertiesChanged(e){if(this.ignoreDrivers)return!1;const t=this._drivenProperties,r=_(e,this._drivenOpacityFallbackAlwaysOpaque);return r.color!==t.color||r.opacity!==t.opacity||r.opacityAlwaysOpaque!==t.opacityAlwaysOpaque||r.size!==t.size||r.rotation!==t.rotation}get needsDrivenTransparentPass(){return this._hasDrivenColorOrOpacity&&!this._drivenProperties.opacityAlwaysOpaque}get _hasDrivenColorOrOpacity(){return this._drivenProperties.color||this._drivenProperties.opacity}_logGeometryCreationWarnings(e,t,r,i){const o=e.projectionSuccess,s="polygons"in e?e.polygons:null,n=`${i} geometry failed to be created`;o?!this._logGeometryValidationWarnings(t,r,i)&&0===s?.length&&"rings"===r&&t.length>0&&t[0].length>2&&g().warnOncePerTick(`${n} (filled rings should use clockwise winding - try reversing the order of vertices)`):g().warnOncePerTick(`${n} (failed to project geometry to view spatial reference)`)}get needsUpdateFocus(){return!1}_logGeometryValidationWarnings(e,t,r){const i=`${r} geometry failed to be created`;return!e.length||1===e.length&&!e[0].length?(g().warnOncePerTick(`${i} (no ${t} were defined)`),!0):(!Array.isArray(e)||!Array.isArray(e[0]))&&(g().warnOncePerTick(`${i} (${t} should be defined as a 2D array)`),!0)}_validateGeometry(e,t=null,r=null){if(null!=t&&!t.includes(e.type))return this.logger.warn("unsupported geometry type for "+r+` symbol: ${e.type}`),!1;switch(e.type){case"point":{const t=e;if(!isFinite(t.x)||!isFinite(t.y))return g().warn("point coordinate is not a valid number, graphic skipped"),!1;break}case"polygon":p(e)}return!0}_defaultElevationInfoNoZ(){return x}_defaultElevationInfoZ(){return C}_updateElevationContext(){null!=this._elevationInfoOverride?(this._elevationContext.setFromElevationInfo(this._elevationInfoOverride),this._elevationContext.setFeatureExpressionInfoContext(null)):this._context.layer.elevationInfo?(this._elevationContext.setFromElevationInfo(this._context.layer.elevationInfo),this._elevationContext.setFeatureExpressionInfoContext(this._context.featureExpressionInfoContext)):this._elevationContext.reset()}getDefaultElevationInfo(e){return e.hasZ?this._defaultElevationInfoZ():this._defaultElevationInfoNoZ()}getGeometryElevationMode(e,t=this.getDefaultElevationInfo(e)){return this._elevationContext.mode||t.mode}setElevationInfoOverride(e){this._elevationInfoOverride=e,this._updateElevationContext()}createElevationContextForGraphic(e){const t=new d;return this.updateElevationContextForGraphic(t,e),t}updateElevationContextForGraphic(e,t){const r=t.geometry,i=this.getDefaultElevationInfo(r);e.unit=null!=this._elevationContext.unit?this._elevationContext.unit:i.unit,e.mode=this.getGeometryElevationMode(r,i),e.offsetMeters=this._elevationContext.meterUnitOffset??i.offset??0;const o=!this._elevationOptions.supportsOnTheGround&&"on-the-ground"===e.mode;o&&(e.mode="relative-to-ground",e.offsetMeters=0);const s=o?h:this._elevationContext.featureExpressionInfoContext;s?e.updateFeatureExpressionInfoContextForGraphic(s,t,this._context.layer):e.setFeatureExpressionInfoContext(null)}prepareSymbolLayerPatch(e){}onRemoveGraphic(e){}_getLayerOpacity(){if(this._context.graphicsCoreOwner&&"fullOpacity"in this._context.graphicsCoreOwner)return this._context.graphicsCoreOwner.fullOpacity??0;const e=this._context.layer.opacity;return e??1}_getCombinedOpacity(e,t=b){const r=this.draped?1:this._getLayerOpacity();return this._drivenProperties.color?r:e?r*(this._drivenProperties.opacity?1:e.a):t.hasIntrinsicColor?r:0}_getCombinedOpacityAndColor(t,i=b){const o=this._getCombinedOpacity(t,i);if(this._drivenProperties.color)return u(null,o);const s=null!=t?e.toUnitRGB(t):r;return u(s,o)}_getDrivenUInt8Color({color:t,opacity:r},i,o){const{color:s,opacity:l}=this._drivenProperties,p=e.toUnitRGBA(i)??(o?n:a),c=s?t??p:null,d=t||i||o,h=s?null:p[3];return u(c,l&&d?r??h:null,255)}_getDrivenUInt8ColorWithNaNSupport({color:t,opacity:r},n,a){const p=n?l(e.toUnitRGBA(n)):s(NaN,NaN,NaN,a?NaN:0);return this._drivenProperties.color&&null!=t&&i(p,t),this._drivenProperties.opacity&&null!=r&&(p[3]=r),o(p,p,255),v(p,p)}isFastUpdatesEnabled(){return null!=this._fastUpdates}updateComplexity(){this.complexity=this.computeComplexity()}computeComplexity(){return c(this.symbol,this.symbolLayer)}globalPropertyChanged(e,t,r){switch(e){case"opacity":return this.layerOpacityChanged(t,r),!0;case"screenSizePerspectiveEnabled":return this.layerScreenSizePerspectiveChanged(t,r),!0;case"elevationInfo":{const e=this._elevationContext.mode;this._updateElevationContext();return 2!==this.layerElevationInfoChanged(t,r,e)}case"slicePlaneEnabled":return this.slicePlaneEnabledChanged(t,r);case"physicalBasedRenderingEnabled":return this.physicalBasedRenderingChanged();case"pixelRatio":return this.pixelRatioChanged;case"skipHighSymbolLods":return this.skipHighSymbolLodsChanged;default:return!1}}get pixelRatioChanged(){return!0}updateGraphics3DGraphicElevationInfo(e,t,r){let i=1;return e?.forEach(e=>{const o=t(e);if(null!=o){const t=e.graphic;this.updateElevationContextForGraphic(o.elevationContext,t),o.needsElevationUpdates=r(o.elevationContext.mode)}else i=2}),i}applyRendererDiff(e,t){return 0}getFastUpdateAttrValues(e){if(!this._fastUpdates)return null;const t=this._fastUpdates.visualVariables,r=t.size?f(t.size.field,e):0,i=t.color?f(t.color.field,e):0,o=t.opacity?f(t.opacity.field,e):0;return s(r,i,o,0)}get draped(){return this._draped}ensureDrapedStatus(e){return null==this._draped?(this._draped=e,!0):(e!==this.draped&&g().warnOnce("A symbol can only produce either draped or non-draped visualizations. Use two separate symbol instances for draped and non-draped graphics if necessary."),!1)}test(){const e=()=>({size:this._fastUpdates?.visualVariables.size?.field??null,color:this._fastUpdates?.visualVariables.color?.field??null,opacity:this._fastUpdates?.visualVariables.opacity?.field??null,rotation:this._fastUpdates?.visualVariables.rotation?.field??null});return{drivenProperties:this._drivenProperties,getVisVarFields:e}}}function _(e,t){const r={color:!1,opacity:!1,opacityAlwaysOpaque:t,size:!1,rotation:!1};return e&&"visualVariables"in e&&e.visualVariables&&e.visualVariables.forEach(e=>{switch(e.type){case"color":if(r.color=!0,e.stops)for(let t=0;t<e.stops.length;t++){const i=e.stops[t].color;i&&i.a<1&&(r.opacityAlwaysOpaque=!1)}break;case"opacity":r.opacity=!0,r.opacityAlwaysOpaque=!1;break;case"size":r.size=!0;break;case"rotation":r.rotation=!0}}),r}const x={mode:"on-the-ground",offset:0,unit:"meters"},C={mode:"absolute-height",offset:0,unit:"meters"},b={hasIntrinsicColor:!1},O=s(NaN,NaN,NaN,NaN);export{m as Graphics3DSymbolLayer,_ as getDrivenProperties,O as nanFallbackColor};
@@ -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{getMetersPerUnitForSR as t}from"../../../../core/units.js";import{e as r}from"../../../../chunks/earcut.js";import{set as i}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as o,create as n}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{c as s}from"../../../../chunks/vec42.js";import{toRadian as a}from"../../../../core/libs/gl-matrix-2/math/common.js";import{fromBuffer as l,create as c,intersectsClippingArea as h,empty as p,expandWithAABB as m}from"../../../../geometry/support/aaBoundingBox.js";import{empty as u,create as d,expandPointInPlace as g}from"../../../../geometry/support/aaBoundingRect.js";import{newFloatArray as y,floatSubArray as f}from"../../../../geometry/support/FloatArray.js";import{perVertexElevationAligner as v}from"./ElevationAligners.js";import{elevationModeChangeUpdateType as x,needsElevationUpdates2D as _}from"./elevationAlignmentUtils.js";import{Graphics3DDrapedGraphicLayer as w}from"./Graphics3DDrapedGraphicLayer.js";import{Graphics3DObject3DGraphicLayer as b}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as D}from"./Graphics3DSymbolLayer.js";import{geometryAsPolygon as S,createWaterGeometry as C,PolygonCreationDataBase as j}from"./polygonUtils.js";import{polygonToRenderInfo as G,polygonToRenderInfoDraped as P}from"../../support/renderInfoUtils/polygon.js";import{Object3D as L}from"../../webgl-engine/lib/Object3D.js";import{RenderGeometry as O}from"../../webgl-engine/lib/RenderGeometry.js";import{Parameters as A,WaterMaterial as E}from"../../webgl-engine/materials/WaterMaterial.js";import{wavePresets as T}from"../../webgl-engine/materials/internal/waterMaterialUtils.js";const U=["polyline","polygon","extent"];class B extends D{static{this.unitSizeOfTexture=100}static{this.elevationModeChangeTypes={definedChanged:2,staysOnTheGround:0,onTheGroundChanged:2}}constructor(e,t,r,i){super(e,t,r,i)}async doLoad(){}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,U,this.symbolLayer.type))return null;const r=this.createElevationContextForGraphic(t);return this.ensureDrapedStatus("on-the-ground"===r.mode),this.ensureMaterial(),this.draped?this._createAsOverlay(t):this._createAs3DShape(t,r,t.uid)}ensureMaterial(){if(this._materials[0])return;const t=new A,r=e.toUnitRGBA(this.symbolLayer.color);r[3]*=this._getLayerOpacity(),t.color=r,t.transparent=r[3]<1||this.needsDrivenTransparentPass,t.waveDirection=null!=this.symbolLayer.waveDirection?M(this.symbolLayer.waveDirection):o(0,0);const i=this.symbolLayer.waveStrength+"-"+this.symbolLayer.waterbodySize,n=T[i];t.waveStrength=n.waveStrength,t.waveTextureRepeat=n.textureRepeat,t.waveVelocity=n.waveVelocity,t.flowStrength=n.perturbationStrength,t.hasSlicePlane=this._context.slicePlaneEnabled,t.draped=this.draped,this._materials[0]=new E(t,this._context)}layerOpacityChanged(){if(null==this._materials[0])return;const e=this._materials[0].parameters.color,t=this.symbolLayer.color.a*this._getLayerOpacity(),r=t<1||this.needsDrivenTransparentPass;this._materials[0].setParameters({color:[e[0],e[1],e[2],t],transparent:r})}layerScreenSizePerspectiveChanged(){}layerElevationInfoChanged(e,t,r){const i=this._elevationContext.mode,o=x(B.elevationModeChangeTypes,r,i);if(1!==o)return o;const n=_(i);return this.updateGraphics3DGraphicElevationInfo(e,t,()=>n)}slicePlaneEnabledChanged(){return this._materials[0]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),!0}physicalBasedRenderingChanged(){return!0}get needsDrivenTransparentPass(){return!1}_createAs3DShape(e,t,r){const i=S(e.geometry);if(null==i)return null;const o=G(i,this._context.elevationProvider,this._context.renderCoordsHelper,t),n=o.position.length/3,s=y(2*n);R(s,o.mapPositions,n,this._context.elevationProvider.spatialReference);const a=new k(o,s,this._context.layerViewUid,e.uid);if(a.olidColor=this._context.stage.renderView?.getObjectAndLayerIdColor(a),this._create3DShapeGeometries(a),this._logGeometryCreationWarnings(a.renderData,i.rings,"rings","WaterSymbol3DLayer"),0===a.outGeometries.length)return null;const l=new L({geometries:a.outGeometries,castShadow:!1,layerViewUid:this._context.layerViewUid,graphicUid:r}),c=new b(this,l,null,v,t);return c.alignedSampledElevation=a.renderData.sampledElevation,c.needsElevationUpdates=_(t.mode),c}_create3DShapeGeometries(e){const t=e.renderData.polygons,i=e.uvCoords;for(const{count:o,index:n,position:s,mapPositions:a,holeIndices:c}of t){if(null!=this._context.clippingExtent&&(l(a,W),!h(W,this._context.clippingExtent)))continue;const t=r(a,c,3);if(0===t.length)continue;const p=f(i,2*n,2*o),m=C({material:this._materials[0],indices:t,mapPositions:a,attributeData:{position:s,uv0:p}},e.olidColor);e.outGeometries.push(m)}}_createAsOverlay(e){const t=S(e.geometry);if(null==t)return null;this._materials[0].renderPriority=this._renderPriority;const r=P(t,this._context.overlaySR),i=r.position.length/3,o=y(2*i);R(o,r.position,i,this._context.overlaySR);const n=new F(r,o,this._context.layerViewUid,e.uid);return n.olidColor=this._context.stage.renderView?.getObjectAndLayerIdColor(n),n.outBoundingBox=p(),this._createAsOverlayWater(n),this._logGeometryCreationWarnings(n.renderData,t.rings,"rings","WaterSymbol3DLayer"),0===n.outGeometries.length?null:new w(this,n.outGeometries,n.outBoundingBox,this._context.drapeSourceRenderer)}_createAsOverlayWater(e){const t=e.uvCoords,i=e.renderData.polygons;for(const{position:o,holeIndices:n,index:s,count:a}of i){if(l(o,W),!h(W,this._context.clippingExtent))continue;m(e.outBoundingBox,W);const i=r(o,n,3);if(0===i.length)continue;const c=f(t,2*s,2*a),p=C({material:this._materials[0],indices:i,attributeData:{position:o,uv0:c}},e.olidColor);e.outGeometries.push(new O(p,e))}}test(){return{...super.test(),create3DShape:e=>this._createAs3DShape(e.graphic,e.elevationContext,e.graphicUid),ensureMaterial:()=>this.ensureMaterial()}}}function M(e){const t=n(),r=a(e);return t[0]=Math.sin(r),t[1]=Math.cos(r),t}function R(e,r,o,n){const a=t(n);u(z);for(let t=0;t<o;t++)i(I,r[3*t],r[3*t+1]),g(z,I);s(z,z,a);const l=z[0]%B.unitSizeOfTexture,c=z[1]%B.unitSizeOfTexture;V[0]=z[0]-l,V[1]=z[1]-c;for(let t=0;t<o;t++)e[2*t]=(r[3*t]*a-V[0])/B.unitSizeOfTexture,e[2*t+1]=(r[3*t+1]*a-V[1])/B.unitSizeOfTexture}const V=n(),z=d(),I=n(),W=c();class k extends j{constructor(e,t,r,i){super(e,r,i),this.uvCoords=t}}class F extends j{constructor(e,t,r,i){super(e,r,i),this.uvCoords=t}}export{B as Graphics3DWaterSymbolLayer,M as headingVectorFromAngle};
5
+ import e from"../../../../Color.js";import{getMetersPerUnitForSR as t}from"../../../../core/units.js";import{e as r}from"../../../../chunks/earcut.js";import{set as i}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as o,create as n}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{s}from"../../../../chunks/vec42.js";import{toRadian as a}from"../../../../core/libs/gl-matrix-2/math/common.js";import{fromBuffer as l,create as c,intersectsClippingArea as h,empty as p,expandWithAABB as m}from"../../../../geometry/support/aaBoundingBox.js";import{empty as u,create as d,expandPointInPlace as g}from"../../../../geometry/support/aaBoundingRect.js";import{newFloatArray as y,floatSubArray as f}from"../../../../geometry/support/FloatArray.js";import{perVertexElevationAligner as v}from"./ElevationAligners.js";import{elevationModeChangeUpdateType as x,needsElevationUpdates2D as _}from"./elevationAlignmentUtils.js";import{Graphics3DDrapedGraphicLayer as w}from"./Graphics3DDrapedGraphicLayer.js";import{Graphics3DObject3DGraphicLayer as b}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as D}from"./Graphics3DSymbolLayer.js";import{geometryAsPolygon as S,createWaterGeometry as C,PolygonCreationDataBase as j}from"./polygonUtils.js";import{polygonToRenderInfo as G,polygonToRenderInfoDraped as P}from"../../support/renderInfoUtils/polygon.js";import{Object3D as L}from"../../webgl-engine/lib/Object3D.js";import{RenderGeometry as O}from"../../webgl-engine/lib/RenderGeometry.js";import{Parameters as A,WaterMaterial as E}from"../../webgl-engine/materials/WaterMaterial.js";import{wavePresets as T}from"../../webgl-engine/materials/internal/waterMaterialUtils.js";const U=["polyline","polygon","extent"];class B extends D{static{this.unitSizeOfTexture=100}static{this.elevationModeChangeTypes={definedChanged:2,staysOnTheGround:0,onTheGroundChanged:2}}constructor(e,t,r,i){super(e,t,r,i)}async doLoad(){}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,U,this.symbolLayer.type))return null;const r=this.createElevationContextForGraphic(t);return this.ensureDrapedStatus("on-the-ground"===r.mode),this.ensureMaterial(),this.draped?this._createAsOverlay(t):this._createAs3DShape(t,r,t.uid)}ensureMaterial(){if(this._materials[0])return;const t=new A,r=e.toUnitRGBA(this.symbolLayer.color);r[3]*=this._getLayerOpacity(),t.color=r,t.transparent=r[3]<1||this.needsDrivenTransparentPass,t.waveDirection=null!=this.symbolLayer.waveDirection?M(this.symbolLayer.waveDirection):o(0,0);const i=this.symbolLayer.waveStrength+"-"+this.symbolLayer.waterbodySize,n=T[i];t.waveStrength=n.waveStrength,t.waveTextureRepeat=n.textureRepeat,t.waveVelocity=n.waveVelocity,t.flowStrength=n.perturbationStrength,t.hasSlicePlane=this._context.slicePlaneEnabled,t.draped=this.draped,this._materials[0]=new E(t,this._context)}layerOpacityChanged(){if(null==this._materials[0])return;const e=this._materials[0].parameters.color,t=this.symbolLayer.color.a*this._getLayerOpacity(),r=t<1||this.needsDrivenTransparentPass;this._materials[0].setParameters({color:[e[0],e[1],e[2],t],transparent:r})}layerScreenSizePerspectiveChanged(){}layerElevationInfoChanged(e,t,r){const i=this._elevationContext.mode,o=x(B.elevationModeChangeTypes,r,i);if(1!==o)return o;const n=_(i);return this.updateGraphics3DGraphicElevationInfo(e,t,()=>n)}slicePlaneEnabledChanged(){return this._materials[0]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),!0}physicalBasedRenderingChanged(){return!0}get needsDrivenTransparentPass(){return!1}_createAs3DShape(e,t,r){const i=S(e.geometry);if(null==i)return null;const o=G(i,this._context.elevationProvider,this._context.renderCoordsHelper,t),n=o.position.length/3,s=y(2*n);R(s,o.mapPositions,n,this._context.elevationProvider.spatialReference);const a=new k(o,s,this._context.layerViewUid,e.uid);if(a.olidColor=this._context.stage.renderView?.getObjectAndLayerIdColor(a),this._create3DShapeGeometries(a),this._logGeometryCreationWarnings(a.renderData,i.rings,"rings","WaterSymbol3DLayer"),0===a.outGeometries.length)return null;const l=new L({geometries:a.outGeometries,castShadow:!1,layerViewUid:this._context.layerViewUid,graphicUid:r}),c=new b(this,l,null,v,t);return c.alignedSampledElevation=a.renderData.sampledElevation,c.needsElevationUpdates=_(t.mode),c}_create3DShapeGeometries(e){const t=e.renderData.polygons,i=e.uvCoords;for(const{count:o,index:n,position:s,mapPositions:a,holeIndices:c}of t){if(null!=this._context.clippingExtent&&(l(a,W),!h(W,this._context.clippingExtent)))continue;const t=r(a,c,3);if(0===t.length)continue;const p=f(i,2*n,2*o),m=C({material:this._materials[0],indices:t,mapPositions:a,attributeData:{position:s,uv0:p}},e.olidColor);e.outGeometries.push(m)}}_createAsOverlay(e){const t=S(e.geometry);if(null==t)return null;this._materials[0].renderPriority=this._renderPriority;const r=P(t,this._context.overlaySR),i=r.position.length/3,o=y(2*i);R(o,r.position,i,this._context.overlaySR);const n=new F(r,o,this._context.layerViewUid,e.uid);return n.olidColor=this._context.stage.renderView?.getObjectAndLayerIdColor(n),n.outBoundingBox=p(),this._createAsOverlayWater(n),this._logGeometryCreationWarnings(n.renderData,t.rings,"rings","WaterSymbol3DLayer"),0===n.outGeometries.length?null:new w(this,n.outGeometries,n.outBoundingBox,this._context.drapeSourceRenderer)}_createAsOverlayWater(e){const t=e.uvCoords,i=e.renderData.polygons;for(const{position:o,holeIndices:n,index:s,count:a}of i){if(l(o,W),!h(W,this._context.clippingExtent))continue;m(e.outBoundingBox,W);const i=r(o,n,3);if(0===i.length)continue;const c=f(t,2*s,2*a),p=C({material:this._materials[0],indices:i,attributeData:{position:o,uv0:c}},e.olidColor);e.outGeometries.push(new O(p,e))}}test(){return{...super.test(),create3DShape:e=>this._createAs3DShape(e.graphic,e.elevationContext,e.graphicUid),ensureMaterial:()=>this.ensureMaterial()}}}function M(e){const t=n(),r=a(e);return t[0]=Math.sin(r),t[1]=Math.cos(r),t}function R(e,r,o,n){const a=t(n);u(z);for(let t=0;t<o;t++)i(I,r[3*t],r[3*t+1]),g(z,I);s(z,z,a);const l=z[0]%B.unitSizeOfTexture,c=z[1]%B.unitSizeOfTexture;V[0]=z[0]-l,V[1]=z[1]-c;for(let t=0;t<o;t++)e[2*t]=(r[3*t]*a-V[0])/B.unitSizeOfTexture,e[2*t+1]=(r[3*t+1]*a-V[1])/B.unitSizeOfTexture}const V=n(),z=d(),I=n(),W=c();class k extends j{constructor(e,t,r,i){super(e,r,i),this.uvCoords=t}}class F extends j{constructor(e,t,r,i){super(e,r,i),this.uvCoords=t}}export{B as Graphics3DWaterSymbolLayer,M as headingVectorFromAngle};
@@ -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{getMetersPerUnitForSR as t}from"../../../../core/units.js";import{rotateZ as e,rotateX as r,rotateY as n}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{ONES as o,fromArray as s}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{c as l,s as u}from"../../../../chunks/vec42.js";import{clone as a,ONES as c}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{projectPoint as m}from"../../../../geometry/projectionUtils.js";import{width as p,depth as f,height as h}from"../../../../geometry/support/aaBoundingBox.js";import{create as y}from"../../../../geometry/support/aaBoundingRect.js";import{ringsCentroid as x}from"../../../../geometry/support/centroid.js";import{getPointOnPath as g,getPathLength as d}from"../../../../geometry/support/coordsUtils.js";import{vertexSpaceOriginToPoint as j}from"../../../../geometry/support/meshVertexSpaceUtils.js";import{makeDehydratedPoint as v}from"../../../../layers/graphics/dehydratedPoint.js";import{isHydratedGeometry as z,clonePoint as b}from"../../../../layers/graphics/hydratedFeatures.js";function w(t,e){if("point"===t.type)return F(t,e,!1);if(z(t))switch(t.type){case"extent":return F(t.center,e,!1);case"polygon":return F(P(t),e,!1);case"polyline":return F(M(t),e,!0);case"mesh":return F(j(t.vertexSpace,t.spatialReference)??t.extent.center,e,!1);case"multipoint":return}else switch(t.type){case"extent":return F(R(t),e,!0);case"polygon":return F(P(t),e,!0);case"polyline":return F(M(t),e,!0);case"multipoint":return}}function M(t){const e=t.paths[0];if(!e||0===e.length)return null;const r=g(e,d(e)/2);return v(r[0],r[1],r[2],t.spatialReference)}function R(t){return v(.5*(t.xmax+t.xmin),.5*(t.ymax+t.ymin),null!=t.zmin&&null!=t.zmax&&isFinite(t.zmin)&&isFinite(t.zmax)?.5*(t.zmax+t.zmin):void 0,t.spatialReference)}function P(t){const e=t.rings[0];if(!e||0===e.length)return null;const r=x(t.rings,!!t.hasZ);return v(r[0],r[1],r[2],t.spatialReference)}function F(t,e,r){const n=r?t:b(t);return e&&t?m(t,n,e)?n:null:n}function S(t){if(!t)return 0;switch(t.type){case"point":return t.z;case"extent":return t.zmax;case"polygon":return t.hasZ?t.rings.reduce((t,e)=>e.reduce((t,e)=>Math.max(t,e[2]),t),-1/0):void 0;case"polyline":return t.hasZ?t.paths.reduce((t,e)=>e.reduce((t,e)=>Math.max(t,e[2]),t),-1/0):void 0;case"mesh":return t.extent.zmax;case"multipoint":return}}function A(t,e,r,n=0){if(t){e||(e=y());const i=t;let o=.5*i.width*(r-1),s=.5*i.height*(r-1);return i.width<1e-7*i.height?o+=s/20:i.height<1e-7*i.width&&(s+=o/20),u(e,i.xmin-o-n,i.ymin-s-n,i.xmax+o+n,i.ymax+s+n),e}return null}function B(t,e,r=null){const n=a(c);return null!=t&&(n[0]=t[0],n[1]=t[1],n[2]=t[2],t.length>3&&(n[3]=t[3])),null!=e&&(n[3]=e),r&&l(n,n,r),n}function D(t,e,r,n,i,o){for(let s=0;s<3;++s)o[s]=null!=t?.[s]?t[s]:null!=r?.[s]?r[s]:i[s];return o[3]=null!=e?e:null!=n?n:i[3],o}function I(t=o,e,r,n=1){const i=new Array(3);if(null==e||null==r)i[0]=1,i[1]=1,i[2]=1;else{let n,o=0;for(let s=2;s>=0;s--){const l=t[s],u=null!=l,a=0===s&&!n&&!u,c=r[s];let m;"symbol-value"===l||a?m=0!==c?e[s]/c:1:u&&"proportional"!==l&&isFinite(l)&&(m=0!==c?l/c:1),null!=m&&(i[s]=m,n=m,o=Math.max(o,Math.abs(m)))}for(let t=2;t>=0;t--)null==i[t]?i[t]=n:0===i[t]&&(i[t]=.001*o)}for(let o=2;o>=0;o--)i[o]/=n;return s(i)}function U(t){return null!=t.isPrimitive}function Z(t){return k(U(t)?[t.width,t.depth,t.height]:t)?null:"Symbol sizes may not be negative values"}function k(t){const e=t=>null==t||t>=0;return Array.isArray(t)?t.every(e):e(t)}function E(t,o,s,l=i()){return t&&e(l,l,-t/180*Math.PI),o&&r(l,l,o/180*Math.PI),s&&n(l,l,s/180*Math.PI),l}function G(e,r,n){if(null!=n.minDemResolution)return n.minDemResolution;const i=t(r),o=p(e)*i,s=f(e)*i,l=h(e)*(r.isGeographic?1:i);return 0===o&&0===s&&0===l?n.minDemResolutionForPoints:.01*Math.max(o,s,l)}export{w as computeCentroid,S as computeMaxZ,E as computeObjectRotation,I as computeObjectScale,G as demResolutionForBoundingBox,A as enlargeExtent,k as isValidSize,B as mixinColorAndOpacity,D as overrideColor,Z as validateSymbolLayerSize};
5
+ import{getMetersPerUnitForSR as t}from"../../../../core/units.js";import{rotateZ as e,rotateX as r,rotateY as n}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{ONES as o,fromArray as s}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{s as l,c as u}from"../../../../chunks/vec42.js";import{clone as a,ONES as c}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{projectPoint as m}from"../../../../geometry/projectionUtils.js";import{width as p,depth as f,height as h}from"../../../../geometry/support/aaBoundingBox.js";import{create as y}from"../../../../geometry/support/aaBoundingRect.js";import{ringsCentroid as x}from"../../../../geometry/support/centroid.js";import{getPointOnPath as g,getPathLength as d}from"../../../../geometry/support/coordsUtils.js";import{vertexSpaceOriginToPoint as j}from"../../../../geometry/support/meshVertexSpaceUtils.js";import{makeDehydratedPoint as v}from"../../../../layers/graphics/dehydratedPoint.js";import{isHydratedGeometry as z,clonePoint as b}from"../../../../layers/graphics/hydratedFeatures.js";function w(t,e){if("point"===t.type)return F(t,e,!1);if(z(t))switch(t.type){case"extent":return F(t.center,e,!1);case"polygon":return F(P(t),e,!1);case"polyline":return F(M(t),e,!0);case"mesh":return F(j(t.vertexSpace,t.spatialReference)??t.extent.center,e,!1);case"multipoint":return}else switch(t.type){case"extent":return F(R(t),e,!0);case"polygon":return F(P(t),e,!0);case"polyline":return F(M(t),e,!0);case"multipoint":return}}function M(t){const e=t.paths[0];if(!e||0===e.length)return null;const r=g(e,d(e)/2);return v(r[0],r[1],r[2],t.spatialReference)}function R(t){return v(.5*(t.xmax+t.xmin),.5*(t.ymax+t.ymin),null!=t.zmin&&null!=t.zmax&&isFinite(t.zmin)&&isFinite(t.zmax)?.5*(t.zmax+t.zmin):void 0,t.spatialReference)}function P(t){const e=t.rings[0];if(!e||0===e.length)return null;const r=x(t.rings,!!t.hasZ);return v(r[0],r[1],r[2],t.spatialReference)}function F(t,e,r){const n=r?t:b(t);return e&&t?m(t,n,e)?n:null:n}function S(t){if(!t)return 0;switch(t.type){case"point":return t.z;case"extent":return t.zmax;case"polygon":return t.hasZ?t.rings.reduce((t,e)=>e.reduce((t,e)=>Math.max(t,e[2]),t),-1/0):void 0;case"polyline":return t.hasZ?t.paths.reduce((t,e)=>e.reduce((t,e)=>Math.max(t,e[2]),t),-1/0):void 0;case"mesh":return t.extent.zmax;case"multipoint":return}}function A(t,e,r,n=0){if(t){e||(e=y());const i=t;let o=.5*i.width*(r-1),s=.5*i.height*(r-1);return i.width<1e-7*i.height?o+=s/20:i.height<1e-7*i.width&&(s+=o/20),u(e,i.xmin-o-n,i.ymin-s-n,i.xmax+o+n,i.ymax+s+n),e}return null}function B(t,e,r=null){const n=a(c);return null!=t&&(n[0]=t[0],n[1]=t[1],n[2]=t[2],t.length>3&&(n[3]=t[3])),null!=e&&(n[3]=e),r&&l(n,n,r),n}function D(t,e,r,n,i,o){for(let s=0;s<3;++s)o[s]=null!=t?.[s]?t[s]:null!=r?.[s]?r[s]:i[s];return o[3]=null!=e?e:null!=n?n:i[3],o}function I(t=o,e,r,n=1){const i=new Array(3);if(null==e||null==r)i[0]=1,i[1]=1,i[2]=1;else{let n,o=0;for(let s=2;s>=0;s--){const l=t[s],u=null!=l,a=0===s&&!n&&!u,c=r[s];let m;"symbol-value"===l||a?m=0!==c?e[s]/c:1:u&&"proportional"!==l&&isFinite(l)&&(m=0!==c?l/c:1),null!=m&&(i[s]=m,n=m,o=Math.max(o,Math.abs(m)))}for(let t=2;t>=0;t--)null==i[t]?i[t]=n:0===i[t]&&(i[t]=.001*o)}for(let o=2;o>=0;o--)i[o]/=n;return s(i)}function U(t){return null!=t.isPrimitive}function Z(t){return k(U(t)?[t.width,t.depth,t.height]:t)?null:"Symbol sizes may not be negative values"}function k(t){const e=t=>null==t||t>=0;return Array.isArray(t)?t.every(e):e(t)}function E(t,o,s,l=i()){return t&&e(l,l,-t/180*Math.PI),o&&r(l,l,o/180*Math.PI),s&&n(l,l,s/180*Math.PI),l}function G(e,r,n){if(null!=n.minDemResolution)return n.minDemResolution;const i=t(r),o=p(e)*i,s=f(e)*i,l=h(e)*(r.isGeographic?1:i);return 0===o&&0===s&&0===l?n.minDemResolutionForPoints:.01*Math.max(o,s,l)}export{w as computeCentroid,S as computeMaxZ,E as computeObjectRotation,I as computeObjectScale,G as demResolutionForBoundingBox,A as enlargeExtent,k as isValidSize,B as mixinColorAndOpacity,D as overrideColor,Z as validateSymbolLayerSize};
@@ -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,F as c}from"../../../../chunks/vec32.js";import{create as d}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{s 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"../../../../core/has.js";import{clamp as t}from"../../../../core/mathUtils.js";import{fromMat4 as o}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as e}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{identity as i,copy as s,set as r,multiply as n,scale as l,translate as a,rotateZ as u,rotateX as c,rotateY as f}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as p}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{h as m,d}from"../../../../chunks/vec32.js";import{ones as z,zeros as v,create as h}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{d as y}from"../../../../chunks/vec42.js";import{ones as S}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{meterIn as b}from"../../../../renderers/support/lengthUtils.js";import{isString as x,isStringOrNull as g,isNumber as C}from"../../../../support/guards.js";import{debugFlags as k}from"../../support/debugFlags.js";import{olidEnabled as V}from"../../webgl-engine/effects/geometry/olidUtils.js";import{NoParameters as w}from"../../../webgl/NoParameters.js";class j{constructor(t){this.field=t}}class M extends j{constructor(t){super(t),this.minSize=[0,0,0],this.maxSize=[0,0,0],this.offset=[0,0,0],this.factor=[0,0,0],this.type=[0,0,0],this.fallback=[0,0,0]}}class I extends j{constructor(t){super(t),this.colors=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],this.values=[0,0,0,0,0,0,0,0],this.fallback=[0,0,0,0]}}class N extends j{constructor(t,o=0){super(t),this.fallback=o,this.values=[0,0,0,0,0,0,0,0],this.opacityValues=[0,0,0,0,0,0,0,0]}}class P extends j{constructor(t){super(t),this.offset=[0,0,0],this.factor=[1,1,1],this.type=[0,0,0]}}class T{}function U(t){return null!=t}function D(t,o){t&&t.push(o)}function F(t,o,e,i=p()){const s=t||0,r=o||0,n=e||0;return 0!==s&&u(i,i,-s/180*Math.PI),0!==r&&c(i,i,r/180*Math.PI),0!==n&&f(i,i,n/180*Math.PI),i}function A(t,o,e,i,s){const r=t.minSize,n=t.maxSize;if(t.useSymbolValue){const t=i.symbolSize[e];return o.minSize[e]=t,o.maxSize[e]=t,o.offset[e]=o.minSize[e],o.factor[e]=0,o.type[e]=1,!0}if(U(t.field))return U(t.stops)?2===t.stops.length&&C(t.stops[0].size)&&C(t.stops[1].size)?(R(t.stops[0].size,t.stops[1].size,t.stops[0].value,t.stops[1].value,o,e),o.type[e]=1,!0):(D(s,"Could not convert size info: stops only supported with 2 elements"),!1):C(r)&&C(n)&&U(t.minDataValue)&&U(t.maxDataValue)?(R(r,n,t.minDataValue,t.maxDataValue,o,e),o.type[e]=1,!0):"unknown"===t.valueUnit?(D(s,"Could not convert size info: proportional size not supported"),!1):null!=b[t.valueUnit]?(o.minSize[e]=-1/0,o.maxSize[e]=1/0,o.offset[e]=0,o.factor[e]=1/b[t.valueUnit],o.type[e]=1,!0):(D(s,"Could not convert size info: scale-dependent size not supported"),!1);if(!U(t.field)){if(t.stops?.[0]&&C(t.stops[0].size))return o.minSize[e]=t.stops[0].size,o.maxSize[e]=t.stops[0].size,o.offset[e]=o.minSize[e],o.factor[e]=0,o.type[e]=1,!0;if(C(r))return o.minSize[e]=r,o.maxSize[e]=r,o.offset[e]=r,o.factor[e]=0,o.type[e]=1,!0}return D(s,"Could not convert size info: unsupported variant of sizeInfo"),!1}function R(t,o,e,i,s,r){const n=Math.abs(i-e)>0?(o-t)/(i-e):0;s.minSize[r]=n>0?t:o,s.maxSize[r]=n>0?o:t,s.offset[r]=t-e*n,s.factor[r]=n}function E(t,o,e,i){if(t.normalizationField||t.valueRepresentation)return D(i,"Could not convert size info: unsupported property"),null;if(!g(t.field))return D(i,"Could not convert size info: field is not a string"),null;if(o.size){if(t.field)if(o.size.field){if(t.field!==o.size.field)return D(i,"Could not convert size info: multiple fields in use"),null}else o.size.field=t.field}else o.size=new M(t.field),d(o.size.fallback,e.fallbackSize);let s;switch(t.axis){case"width":return s=A(t,o.size,0,e,i),s?o:null;case"height":return s=A(t,o.size,2,e,i),s?o:null;case"depth":return s=A(t,o.size,1,e,i),s?o:null;case"width-and-depth":return s=A(t,o.size,0,e,i),s&&A(t,o.size,1,e,i),s?o:null;case null:case void 0:case"all":return s=A(t,o.size,0,e,i),s=s&&A(t,o.size,1,e,i),s=s&&A(t,o.size,2,e,i),s?o:null;default:return D(i,`Could not convert size info: unknown axis "${t.axis}""`),null}}function O(t,o,e){for(let s=0;s<3;++s){let e=o.unitInMeters;1===t.type[s]&&(e*=o.modelSize[s],t.type[s]=2),t.minSize[s]=t.minSize[s]/e,t.maxSize[s]=t.maxSize[s]/e,t.offset[s]=t.offset[s]/e,t.factor[s]=t.factor[s]/e}let i;if(0!==t.type[0])i=0;else if(0!==t.type[1])i=1;else{if(0===t.type[2])return D(e,"No size axis contains a valid size or scale"),!1;i=2}for(let s=0;s<3;++s)0===t.type[s]&&(t.minSize[s]=t.minSize[i],t.maxSize[s]=t.maxSize[i],t.offset[s]=t.offset[i],t.factor[s]=t.factor[i],t.type[s]=t.type[i]);return!0}function _(t,o,e){t[4*o]=e.r/255,t[4*o+1]=e.g/255,t[4*o+2]=e.b/255,t[4*o+3]=e.a}function q(t,o,e,i){if(t.normalizationField)return D(i,"Could not convert color info: unsupported property"),null;if(x(t.field)){if(!t.stops)return D(i,"Could not convert color info: missing stops or colors"),null;{if(t.stops.length>8)return D(i,"Could not convert color info: too many color stops"),null;o.color=new I(t.field);const s=t.stops;for(let t=0;t<8;++t){const e=s[Math.min(t,s.length-1)];o.color.values[t]=e.value,_(o.color.colors,t,e.color)}y(o.color.fallback,e.fallbackColor)}}else{if(!(t.stops&&t.stops.length>=0))return D(i,"Could not convert color info: no field and no colors/stops"),null;{const i=t.stops&&t.stops.length>=0&&t.stops[0].color;o.color=new I(null);for(let t=0;t<8;t++)o.color.values[t]=1/0,_(o.color.colors,t,i);y(o.color.fallback,e.fallbackColor)}}return o}function $(t,o,e,i){if(t.normalizationField)return D(i,"Could not convert opacity info: unsupported property"),null;if(x(t.field)){if(!t.stops)return D(i,"Could not convert opacity info: missing stops or opacities"),null;{if(t.stops.length>8)return D(i,"Could not convert opacity info: too many opacity stops"),null;o.opacity=new N(t.field,e.fallbackColor[3]);const s=t.stops;for(let t=0;t<8;++t){const e=s[Math.min(t,s.length-1)];o.opacity.values[t]=e.value,o.opacity.opacityValues[t]=e.opacity}}}else{if(!(t.stops&&t.stops.length>=0))return D(i,"Could not convert opacity info: no field and no opacities/stops"),null;{const i=t.stops&&t.stops.length>=0?t.stops[0].opacity:0;o.opacity={field:null,values:[0,0,0,0,0,0,0,0],opacityValues:[0,0,0,0,0,0,0,0],fallback:e.fallbackColor[3]};for(let t=0;t<8;t++)o.opacity.values[t]=1/0,o.opacity.opacityValues[t]=i}}return o}function B(t,o,e){const i=2===e&&"arithmetic"===t.rotationType;o.offset[e]=i?90:0,o.factor[e]=i?-1:1,o.type[e]=1}function L(t,o,e){if(!x(t.field))return D(e,"Could not convert rotation info: field is not a string"),null;if(o.rotation){if(t.field)if(o.rotation.field){if(t.field!==o.rotation.field)return D(e,"Could not convert rotation info: multiple fields in use"),null}else o.rotation.field=t.field}else o.rotation={field:t.field,offset:[0,0,0],factor:[1,1,1],type:[0,0,0]};switch(t.axis){case"tilt":return B(t,o.rotation,0),o;case"roll":return B(t,o.rotation,1),o;case null:case void 0:case"heading":return B(t,o.rotation,2),o;default:return D(e,`Could not convert rotation info: unknown axis "${t.axis}""`),null}}class G{constructor({supports:t,modelSize:o,symbolSize:e,unitInMeters:i,anchor:s,scale:r,rotation:n,fallbackColor:l,fallbackSize:a}){this.supports=t,this.modelSize=o??z(),this.symbolSize=e??z(),this.unitInMeters=i??1,this.anchor=s??v(),this.scale=r??z(),this.rotation=n??v(),this.fallbackColor=l??S(),this.fallbackSize=a??z()}}function H(t,o,e){if(!t)return null;const i=t.reduce((t,i)=>{if(!t)return t;if(i.valueExpression)return D(e,"Could not convert visual variables: arcade expressions not supported"),null;switch(i.type){case"size":return o.supports.size?E(i,t,o,e):t;case"color":return o.supports.color?q(i,t,o,e):t;case"opacity":return o.supports.opacity?$(i,t,o,e):null;case"rotation":return o.supports.rotation?L(i,t,e):t;default:return null}},new T);return!(t.length>0&&i)||i.size||i.color||i.opacity||i.rotation?i?.size&&!O(i.size,o,e)?null:i:null}class J{constructor(t,o,e){this.visualVariables=t,this.materialParameters=o,this.requiresShaderTransformation=e}}function K(t,o){if(!t)return null;if(V())return null;if(k.TESTS_DISABLE_FAST_UPDATES)return null;const e=H(t.visualVariables,o);return e?new J(e,Y(e,o),!!e.size):null}function Q(t,o,e){if(!o||!t)return!1;const i=t.visualVariables,s=H(o.visualVariables,e);return!!s&&(!!(W(i.size,s.size,"size")&&W(i.color,s.color,"color")&&W(i.rotation,s.rotation,"rotation")&&W(i.opacity,s.opacity,"opacity"))&&(t.visualVariables=s,t.materialParameters=Y(s,e),t.requiresShaderTransformation=!!s.size,!0))}function W(t,o,e){if(!!t!=!!o)return!1;if(t&&t.field!==o?.field)return!1;if(t&&"rotation"===e){const e=t,i=o;for(let t=0;t<3;t++)if(e.type[t]!==i.type[t]||e.offset[t]!==i.offset[t]||e.factor[t]!==i.factor[t])return!1}return!0}class X extends w{constructor(t){super(),this.vvSize=t?.size??null,this.vvColor=t?.color??null,this.vvOpacity=t?.opacity??null}get hasVVSize(){return!!this.vvSize}get hasVVColor(){return!!this.vvColor}get hasVVOpacity(){return!!this.vvOpacity}}function Y(t,s){const r=new X(t);return r.vvSize&&(r.vvSymbolAnchor=s.anchor,i(st),F(s.rotation[2],s.rotation[0],s.rotation[1],st),r.vvSymbolRotationMatrix=r.vvSymbolRotationMatrix||e(),o(r.vvSymbolRotationMatrix,st)),r}function Z(t,o,e){if(!t.vvSize)return e;s(et,e);const i=t.vvSymbolRotationMatrix;return r(st,i[0],i[1],i[2],0,i[3],i[4],i[5],0,i[6],i[7],i[8],0,0,0,0,1),n(et,et,st),tt(it,t,o),l(et,et,it),a(et,et,t.vvSymbolAnchor),et}function tt(o,e,i){if(!e.vvSize)return m(o,1,1,1),o;if(Number.isNaN(i[0]))return d(o,e.vvSize.fallback);for(let s=0;s<3;++s){const r=e.vvSize.offset[s]+i[0]*e.vvSize.factor[s];o[s]=t(r,e.vvSize.minSize[s],e.vvSize.maxSize[s])}return o}function ot(t,o){const e=null==t?0:o.attributes[t];return"number"==typeof e&&isFinite(e)?e:NaN}const et=p(),it=h(),st=p();export{G as ConvertOptions,I as FastColorInfo,N as FastOpacityInfo,P as FastRotationInfo,M as FastSizeInfo,J as FastSymbolUpdatesState,T as FastVisualVariables,X as VisualVariablesParameters,H as convertVisualVariables,Z as evaluateModelTransform,tt as evaluateModelTransformScale,ot as getAttributeValue,Y as getMaterialParameters,K as initFastSymbolUpdatesState,Q as updateFastSymbolUpdatesState};
5
+ import"../../../../core/has.js";import{clamp as t}from"../../../../core/mathUtils.js";import{fromMat4 as o}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as e}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{identity as i,copy as s,set as r,multiply as n,scale as l,translate as a,rotateZ as u,rotateX as c,rotateY as f}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as p}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{h as m,d}from"../../../../chunks/vec32.js";import{ones as z,zeros as v,create as h}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{f as y}from"../../../../chunks/vec42.js";import{ones as S}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{meterIn as b}from"../../../../renderers/support/lengthUtils.js";import{isString as x,isStringOrNull as g,isNumber as C}from"../../../../support/guards.js";import{debugFlags as k}from"../../support/debugFlags.js";import{olidEnabled as V}from"../../webgl-engine/effects/geometry/olidUtils.js";import{NoParameters as w}from"../../../webgl/NoParameters.js";class j{constructor(t){this.field=t}}class M extends j{constructor(t){super(t),this.minSize=[0,0,0],this.maxSize=[0,0,0],this.offset=[0,0,0],this.factor=[0,0,0],this.type=[0,0,0],this.fallback=[0,0,0]}}class I extends j{constructor(t){super(t),this.colors=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],this.values=[0,0,0,0,0,0,0,0],this.fallback=[0,0,0,0]}}class N extends j{constructor(t,o=0){super(t),this.fallback=o,this.values=[0,0,0,0,0,0,0,0],this.opacityValues=[0,0,0,0,0,0,0,0]}}class P extends j{constructor(t){super(t),this.offset=[0,0,0],this.factor=[1,1,1],this.type=[0,0,0]}}class T{}function U(t){return null!=t}function D(t,o){t&&t.push(o)}function F(t,o,e,i=p()){const s=t||0,r=o||0,n=e||0;return 0!==s&&u(i,i,-s/180*Math.PI),0!==r&&c(i,i,r/180*Math.PI),0!==n&&f(i,i,n/180*Math.PI),i}function A(t,o,e,i,s){const r=t.minSize,n=t.maxSize;if(t.useSymbolValue){const t=i.symbolSize[e];return o.minSize[e]=t,o.maxSize[e]=t,o.offset[e]=o.minSize[e],o.factor[e]=0,o.type[e]=1,!0}if(U(t.field))return U(t.stops)?2===t.stops.length&&C(t.stops[0].size)&&C(t.stops[1].size)?(R(t.stops[0].size,t.stops[1].size,t.stops[0].value,t.stops[1].value,o,e),o.type[e]=1,!0):(D(s,"Could not convert size info: stops only supported with 2 elements"),!1):C(r)&&C(n)&&U(t.minDataValue)&&U(t.maxDataValue)?(R(r,n,t.minDataValue,t.maxDataValue,o,e),o.type[e]=1,!0):"unknown"===t.valueUnit?(D(s,"Could not convert size info: proportional size not supported"),!1):null!=b[t.valueUnit]?(o.minSize[e]=-1/0,o.maxSize[e]=1/0,o.offset[e]=0,o.factor[e]=1/b[t.valueUnit],o.type[e]=1,!0):(D(s,"Could not convert size info: scale-dependent size not supported"),!1);if(!U(t.field)){if(t.stops?.[0]&&C(t.stops[0].size))return o.minSize[e]=t.stops[0].size,o.maxSize[e]=t.stops[0].size,o.offset[e]=o.minSize[e],o.factor[e]=0,o.type[e]=1,!0;if(C(r))return o.minSize[e]=r,o.maxSize[e]=r,o.offset[e]=r,o.factor[e]=0,o.type[e]=1,!0}return D(s,"Could not convert size info: unsupported variant of sizeInfo"),!1}function R(t,o,e,i,s,r){const n=Math.abs(i-e)>0?(o-t)/(i-e):0;s.minSize[r]=n>0?t:o,s.maxSize[r]=n>0?o:t,s.offset[r]=t-e*n,s.factor[r]=n}function E(t,o,e,i){if(t.normalizationField||t.valueRepresentation)return D(i,"Could not convert size info: unsupported property"),null;if(!g(t.field))return D(i,"Could not convert size info: field is not a string"),null;if(o.size){if(t.field)if(o.size.field){if(t.field!==o.size.field)return D(i,"Could not convert size info: multiple fields in use"),null}else o.size.field=t.field}else o.size=new M(t.field),d(o.size.fallback,e.fallbackSize);let s;switch(t.axis){case"width":return s=A(t,o.size,0,e,i),s?o:null;case"height":return s=A(t,o.size,2,e,i),s?o:null;case"depth":return s=A(t,o.size,1,e,i),s?o:null;case"width-and-depth":return s=A(t,o.size,0,e,i),s&&A(t,o.size,1,e,i),s?o:null;case null:case void 0:case"all":return s=A(t,o.size,0,e,i),s=s&&A(t,o.size,1,e,i),s=s&&A(t,o.size,2,e,i),s?o:null;default:return D(i,`Could not convert size info: unknown axis "${t.axis}""`),null}}function O(t,o,e){for(let s=0;s<3;++s){let e=o.unitInMeters;1===t.type[s]&&(e*=o.modelSize[s],t.type[s]=2),t.minSize[s]=t.minSize[s]/e,t.maxSize[s]=t.maxSize[s]/e,t.offset[s]=t.offset[s]/e,t.factor[s]=t.factor[s]/e}let i;if(0!==t.type[0])i=0;else if(0!==t.type[1])i=1;else{if(0===t.type[2])return D(e,"No size axis contains a valid size or scale"),!1;i=2}for(let s=0;s<3;++s)0===t.type[s]&&(t.minSize[s]=t.minSize[i],t.maxSize[s]=t.maxSize[i],t.offset[s]=t.offset[i],t.factor[s]=t.factor[i],t.type[s]=t.type[i]);return!0}function _(t,o,e){t[4*o]=e.r/255,t[4*o+1]=e.g/255,t[4*o+2]=e.b/255,t[4*o+3]=e.a}function q(t,o,e,i){if(t.normalizationField)return D(i,"Could not convert color info: unsupported property"),null;if(x(t.field)){if(!t.stops)return D(i,"Could not convert color info: missing stops or colors"),null;{if(t.stops.length>8)return D(i,"Could not convert color info: too many color stops"),null;o.color=new I(t.field);const s=t.stops;for(let t=0;t<8;++t){const e=s[Math.min(t,s.length-1)];o.color.values[t]=e.value,_(o.color.colors,t,e.color)}y(o.color.fallback,e.fallbackColor)}}else{if(!(t.stops&&t.stops.length>=0))return D(i,"Could not convert color info: no field and no colors/stops"),null;{const i=t.stops&&t.stops.length>=0&&t.stops[0].color;o.color=new I(null);for(let t=0;t<8;t++)o.color.values[t]=1/0,_(o.color.colors,t,i);y(o.color.fallback,e.fallbackColor)}}return o}function $(t,o,e,i){if(t.normalizationField)return D(i,"Could not convert opacity info: unsupported property"),null;if(x(t.field)){if(!t.stops)return D(i,"Could not convert opacity info: missing stops or opacities"),null;{if(t.stops.length>8)return D(i,"Could not convert opacity info: too many opacity stops"),null;o.opacity=new N(t.field,e.fallbackColor[3]);const s=t.stops;for(let t=0;t<8;++t){const e=s[Math.min(t,s.length-1)];o.opacity.values[t]=e.value,o.opacity.opacityValues[t]=e.opacity}}}else{if(!(t.stops&&t.stops.length>=0))return D(i,"Could not convert opacity info: no field and no opacities/stops"),null;{const i=t.stops&&t.stops.length>=0?t.stops[0].opacity:0;o.opacity={field:null,values:[0,0,0,0,0,0,0,0],opacityValues:[0,0,0,0,0,0,0,0],fallback:e.fallbackColor[3]};for(let t=0;t<8;t++)o.opacity.values[t]=1/0,o.opacity.opacityValues[t]=i}}return o}function B(t,o,e){const i=2===e&&"arithmetic"===t.rotationType;o.offset[e]=i?90:0,o.factor[e]=i?-1:1,o.type[e]=1}function L(t,o,e){if(!x(t.field))return D(e,"Could not convert rotation info: field is not a string"),null;if(o.rotation){if(t.field)if(o.rotation.field){if(t.field!==o.rotation.field)return D(e,"Could not convert rotation info: multiple fields in use"),null}else o.rotation.field=t.field}else o.rotation={field:t.field,offset:[0,0,0],factor:[1,1,1],type:[0,0,0]};switch(t.axis){case"tilt":return B(t,o.rotation,0),o;case"roll":return B(t,o.rotation,1),o;case null:case void 0:case"heading":return B(t,o.rotation,2),o;default:return D(e,`Could not convert rotation info: unknown axis "${t.axis}""`),null}}class G{constructor({supports:t,modelSize:o,symbolSize:e,unitInMeters:i,anchor:s,scale:r,rotation:n,fallbackColor:l,fallbackSize:a}){this.supports=t,this.modelSize=o??z(),this.symbolSize=e??z(),this.unitInMeters=i??1,this.anchor=s??v(),this.scale=r??z(),this.rotation=n??v(),this.fallbackColor=l??S(),this.fallbackSize=a??z()}}function H(t,o,e){if(!t)return null;const i=t.reduce((t,i)=>{if(!t)return t;if(i.valueExpression)return D(e,"Could not convert visual variables: arcade expressions not supported"),null;switch(i.type){case"size":return o.supports.size?E(i,t,o,e):t;case"color":return o.supports.color?q(i,t,o,e):t;case"opacity":return o.supports.opacity?$(i,t,o,e):null;case"rotation":return o.supports.rotation?L(i,t,e):t;default:return null}},new T);return!(t.length>0&&i)||i.size||i.color||i.opacity||i.rotation?i?.size&&!O(i.size,o,e)?null:i:null}class J{constructor(t,o,e){this.visualVariables=t,this.materialParameters=o,this.requiresShaderTransformation=e}}function K(t,o){if(!t)return null;if(V())return null;if(k.TESTS_DISABLE_FAST_UPDATES)return null;const e=H(t.visualVariables,o);return e?new J(e,Y(e,o),!!e.size):null}function Q(t,o,e){if(!o||!t)return!1;const i=t.visualVariables,s=H(o.visualVariables,e);return!!s&&(!!(W(i.size,s.size,"size")&&W(i.color,s.color,"color")&&W(i.rotation,s.rotation,"rotation")&&W(i.opacity,s.opacity,"opacity"))&&(t.visualVariables=s,t.materialParameters=Y(s,e),t.requiresShaderTransformation=!!s.size,!0))}function W(t,o,e){if(!!t!=!!o)return!1;if(t&&t.field!==o?.field)return!1;if(t&&"rotation"===e){const e=t,i=o;for(let t=0;t<3;t++)if(e.type[t]!==i.type[t]||e.offset[t]!==i.offset[t]||e.factor[t]!==i.factor[t])return!1}return!0}class X extends w{constructor(t){super(),this.vvSize=t?.size??null,this.vvColor=t?.color??null,this.vvOpacity=t?.opacity??null}get hasVVSize(){return!!this.vvSize}get hasVVColor(){return!!this.vvColor}get hasVVOpacity(){return!!this.vvOpacity}}function Y(t,s){const r=new X(t);return r.vvSize&&(r.vvSymbolAnchor=s.anchor,i(st),F(s.rotation[2],s.rotation[0],s.rotation[1],st),r.vvSymbolRotationMatrix=r.vvSymbolRotationMatrix||e(),o(r.vvSymbolRotationMatrix,st)),r}function Z(t,o,e){if(!t.vvSize)return e;s(et,e);const i=t.vvSymbolRotationMatrix;return r(st,i[0],i[1],i[2],0,i[3],i[4],i[5],0,i[6],i[7],i[8],0,0,0,0,1),n(et,et,st),tt(it,t,o),l(et,et,it),a(et,et,t.vvSymbolAnchor),et}function tt(o,e,i){if(!e.vvSize)return m(o,1,1,1),o;if(Number.isNaN(i[0]))return d(o,e.vvSize.fallback);for(let s=0;s<3;++s){const r=e.vvSize.offset[s]+i[0]*e.vvSize.factor[s];o[s]=t(r,e.vvSize.minSize[s],e.vvSize.maxSize[s])}return o}function ot(t,o){const e=null==t?0:o.attributes[t];return"number"==typeof e&&isFinite(e)?e:NaN}const et=p(),it=h(),st=p();export{G as ConvertOptions,I as FastColorInfo,N as FastOpacityInfo,P as FastRotationInfo,M as FastSizeInfo,J as FastSymbolUpdatesState,T as FastVisualVariables,X as VisualVariablesParameters,H as convertVisualVariables,Z as evaluateModelTransform,tt as evaluateModelTransformScale,ot as getAttributeValue,Y as getMaterialParameters,K as initFastSymbolUpdatesState,Q as updateFastSymbolUpdatesState};
@@ -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{a as e,n as i}from"../../../../chunks/vec32.js";import{create as t}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{Tiles3DTarget as n}from"../i3s/Intersector.js";import{ElevationRange as s}from"../../support/ElevationRange.js";import{IntersectorResult as r}from"../../webgl-engine/lib/IntersectorResult.js";import{MeshIntersectionOptions as o,computeInvDir as l,intersectAabbInvDir as a}from"../../webgl-engine/lib/RayIntersections.js";class c{constructor(e){this.layerView=e,this.type=8,this.slicePlaneEnabled=!1,this.isGround=!0,this.layerViewUid=e.uid}intersect(s,c,d,m,p,f){if(s.options.filteredLayerViewUids.includes(this.layerView.uid))return;const{results:h,tolerance:w}=s,g=2===s.options.store,{componentObjectCollection:b}=this.layerView.view.stage.renderView,y=new o(w,f,s.options.normalRequired),V=l(d,m,u),j=e(t(),m,d),R=i(t(),j),v=(e,i,t)=>{if(i>=0){if(null!=c&&!c(d,m,i))return;const e=e=>{const s=new n(this.layerView.layer.uid);e.set(this.type,s,i,t)};if(this.isGround&&(null==h.ground.distance||i<h.ground.distance)&&e(h.ground),s.options.isFiltered)return;if((null==h.min.distance||i<h.min.distance)&&e(h.min),(null==h.max.distance||i>h.max.distance)&&e(h.max),g){const i=new r(s.ray);e(i),s.results.all.push(i)}}};this.layerView.forEachVisibleTile(e=>{if(!e.boundingVolumeIntersectsRay(d,R))return;const{componentObjects:i}=e;for(const t of i)a(t.aabbInWorldCoordinates,d,V,0)&&b.intersect(t,d,m,null,y,v)})}getElevationRange(e){let i=null;return this.layerView.forEachVisibleTile(t=>{t.boundingVolumeIntersectsSphere(e)&&(i||(i=new s),t.expandElevationRange(i))}),i||(i=new s(0,0)),i}}const u=t();export{c as Tiles3DIntersectionHandler};
5
+ import{a as e,n as i}from"../../../../chunks/vec32.js";import{create as t}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{Tiles3DTarget as n}from"../i3s/Intersector.js";import{ElevationRange as s}from"../../support/ElevationRange.js";import{IntersectorResult as r}from"../../webgl-engine/lib/IntersectorResult.js";import{MeshIntersectionOptions as o,computeInvDir as l,intersectAabbInvDir as a}from"../../webgl-engine/lib/RayIntersections.js";class c{constructor(e){this.layerView=e,this.type=8,this.slicePlaneEnabled=!1,this.isGround=!0,this.layerViewUid=e.uid}intersect(s,c,d,m,p,f){if(s.options.filteredLayerViewUids.includes(this.layerView.uid))return;const{results:h,tolerance:w}=s,g=2===s.options.store,{componentObjectCollection:b}=this.layerView.view.stage.renderView,y=new o(w,f,s.options.normalRequired),V=l(d,m,u),j=e(t(),m,d),R=i(t(),j),v=(e,i,t)=>{if(i>=0){if(null!=c&&!c(d,m,i))return;const e=e=>{const s=new n(this.layerView.layer.uid);e.set(this.type,s,i,t)};if(this.isGround&&(null==h.ground.distance||i<h.ground.distance)&&e(h.ground),s.options.isFiltered)return;if((null==h.min.distance||i<h.min.distance)&&e(h.min),(null==h.max.distance||i>h.max.distance)&&e(h.max),g){const i=new r(s.ray);e(i),s.results.all.push(i)}}};this.layerView.forEachVisibleTile(e=>{if(!e.boundingVolumeIntersectsRay(d,R))return;const{componentObjects:i}=e;for(const t of i)a(t.aabbInWorldCoordinates,d,V,0)&&b.intersect(t,d,m,null,y,v)})}getElevationRange(e){let i=null;return this.layerView.forEachVisibleTile(t=>{t.boundingVolumeIntersectsSphere(e)&&(i||(i=new s),i.expandElevationRange(t.elevationRange))}),i||(i=new s(0,0)),i}}const u=t();export{c as Tiles3DIntersectionHandler};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as t}from"tslib";import i from"../../../core/Accessor.js";import{deg2rad as e,rad2deg as a}from"../../../core/mathUtils.js";import{watch as s,sync as n,initial as r}from"../../../core/reactiveUtils.js";import{property as o,subclass as l}from"../../../core/accessorSupport/decorators.js";import{applyAll as c}from"../camera/constraintUtils.js";import{surfaceElevationBelowRenderLocation as u}from"../camera/intersectionUtils.js";import{ConstraintOptions as h}from"../camera/constraintUtils/ConstraintOptions.js";import{createNearFarHeuristic as d}from"./NearFarHeuristic.js";import{SurfaceCollisionConstraint as p}from"./SurfaceCollisionConstraint.js";let m=class extends i{constructor(t){super(t),this.nearFarHeuristic=d(t.view.state.viewingMode,t.view.basemapTerrain,t.view.renderCoordsHelper.spatialReference)}initialize(){const t=()=>this._updateNearFar();this.addHandles([s(()=>[this.view.constraints.clipDistance.near,this.view.constraints.clipDistance.far],()=>this._clipDistanceNearFarChanged()),this.view.state.events.on("before-camera-change",({camera:t,sceneDepthRange:i})=>this._updateCameraNearFar(t,i)),s(()=>this.view.constraints.clipDistance.mode,t),s(()=>this.view.stage.renderer.sceneDepthRange.value,t,n),s(()=>this.view.renderDataExtent,t,n),s(()=>this.view.basemapTerrain.visibleElevationRange,t,n),s(()=>[this.view.constraints.altitude.min,this.view.constraints.altitude.max],()=>this._updateAltitude(),n),s(()=>this.view.constraints.tilt.max,()=>this._updateTiltMax(),n),s(()=>this.view.constraints.tilt.mode,()=>this._updateTilt(),n),s(()=>this.view.state?.camera,()=>this._updateTiltAutoMax(),n),s(()=>[this.view.map?.ground?.navigationConstraint?.type,this.view.state.constraints.collision.enabled],()=>this._updateCollision(),n)]),this.view.state.isLocal&&this.addHandles(s(()=>this.view.renderDataExtent,t=>this._updateLocalSurfaceDistance(t),r)),this._updateNearFar(),2!==this.view.state.viewingMode&&this._updateAltitude(),this._updateTilt(),this._updateCollision(),this._set("surfaceCollisionConstraint",new p({view:this.view}))}destroy(){this.surfaceCollisionConstraint&&(this.surfaceCollisionConstraint.destroy(),this._set("surfaceCollisionConstraint",null))}_clipDistanceNearFarChanged(){const t=this.view.constraints.clipDistance;"auto"!==t.mode&&this.view.state.updateCamera(i=>v(i,t))}_updateNearFar(){this.view.state.updateCamera(t=>this._updateCameraNearFar(t))}_updateCameraNearFar(t,i){const e=this.view.constraints.clipDistance;"manual"===e.mode?v(t,e):this._updateCameraNearFarAuto(t,e,i)}_updateCameraNearFarAuto(t,i,e=this.view.stage.renderer.sceneDepthRange.value){const a=u(this.view,t.eye),s=this.nearFarHeuristic.compute(t,this.view.renderDataExtent,e,a);t.near=s.near,t.far=s.far,i&&i.autoUpdate(t.near,t.far)}_updateCollision(){const t=this.view.map?.ground?.navigationConstraint?.type,i=!t||"stay-above"===t,e=this.view.state.constraints.collision;if(i!==e.enabled){e.enabled=i,i&&this._reapplyConstraints(8);"auto"===this.view.constraints.tilt.mode&&this._updateTiltAuto()}}_updateAltitude(){const t=this.view.constraints.altitude;1===this.view.state.viewingMode?this.view.state.constraints.altitude={min:t.min,max:t.max}:this.view.state.constraints.altitude=null,this._reapplyConstraints()}_updateTiltMax(){const t=this.view.constraints.tilt;"auto"!==t.mode&&(this._updateTiltManual(t),this._reapplyConstraints())}_updateTilt(){const t=this.view.constraints.tilt;"manual"===t.mode?this._updateTiltManual(t):this._updateTiltAuto(),this._reapplyConstraints()}_updateTiltManual(t){const i=this.view.state.constraints;i.tilt=i.createConstantMaxTilt(e(t.max))}_updateTiltAuto(){const t=this.view.state.constraints;t.tilt=t.createDefaultTilt(),this._updateTiltAutoMax()}_updateTiltAutoMax(){const t=this.view.constraints.tilt;if("auto"!==t.mode)return;const i=this.view.state.constraints;if(i.tilt){const e=i.tilt(this.view.state.camera.distance).max;t.autoUpdate(a(e))}}_updateLocalSurfaceDistance(t){if(null==t)return;let i=Math.max(t.width,t.height);if(i<=0)return;null!=t.zmax&&null!=t.zmin&&(i=Math.max(i,t.zmax-t.zmin));const e=this.view.state,a=3*i/Math.atan(e.camera.fov/2);a!==e.constraints.distance&&(e.constraints.distance=a)}_reapplyConstraints(t=15){this.view.state.updateCamera(i=>c(this.view,i,new h(t,0,null)))}};function v(t,i){i&&(t.near=i.near,t.far=i.far)}t([o({constructOnly:!0})],m.prototype,"view",void 0),t([o({readOnly:!0})],m.prototype,"surfaceCollisionConstraint",void 0),m=t([l("esri.views.3d.state.ConstraintsManager")],m);export{m as ConstraintsManager};
5
+ import{__decorate as t}from"tslib";import i from"../../../core/Accessor.js";import{deg2rad as e,rad2deg as a}from"../../../core/mathUtils.js";import{watch as s,sync as n,initial as r}from"../../../core/reactiveUtils.js";import{property as o,subclass as l}from"../../../core/accessorSupport/decorators.js";import{applyAll as c}from"../camera/constraintUtils.js";import{surfaceElevationBelowRenderLocation as u}from"../camera/intersectionUtils.js";import{ConstraintOptions as d}from"../camera/constraintUtils/ConstraintOptions.js";import{createNearFarHeuristic as h}from"./NearFarHeuristic.js";import{SurfaceCollisionConstraint as p}from"./SurfaceCollisionConstraint.js";let m=class extends i{constructor(t){super(t),this.nearFarHeuristic=h(t.view.state.viewingMode,t.view.groundView,t.view.renderCoordsHelper.spatialReference)}initialize(){const t=()=>this._updateNearFar();this.addHandles([s(()=>[this.view.constraints.clipDistance.near,this.view.constraints.clipDistance.far],()=>this._clipDistanceNearFarChanged()),this.view.state.events.on("before-camera-change",({camera:t,sceneDepthRange:i})=>this._updateCameraNearFar(t,i)),s(()=>this.view.constraints.clipDistance.mode,t),s(()=>this.view.stage.renderer.sceneDepthRange.value,t,n),s(()=>this.view.renderDataExtent,t,n),s(()=>this.view.groundView.visibleElevationRange,t,n),s(()=>[this.view.constraints.altitude.min,this.view.constraints.altitude.max],()=>this._updateAltitude(),n),s(()=>this.view.constraints.tilt.max,()=>this._updateTiltMax(),n),s(()=>this.view.constraints.tilt.mode,()=>this._updateTilt(),n),s(()=>this.view.state?.camera,()=>this._updateTiltAutoMax(),n),s(()=>[this.view.map?.ground?.navigationConstraint?.type,this.view.state.constraints.collision.enabled],()=>this._updateCollision(),n)]),this.view.state.isLocal&&this.addHandles(s(()=>this.view.renderDataExtent,t=>this._updateLocalSurfaceDistance(t),r)),this._updateNearFar(),2!==this.view.state.viewingMode&&this._updateAltitude(),this._updateTilt(),this._updateCollision(),this._set("surfaceCollisionConstraint",new p({view:this.view}))}destroy(){this.surfaceCollisionConstraint&&(this.surfaceCollisionConstraint.destroy(),this._set("surfaceCollisionConstraint",null))}_clipDistanceNearFarChanged(){const t=this.view.constraints.clipDistance;"auto"!==t.mode&&this.view.state.updateCamera(i=>v(i,t))}_updateNearFar(){this.view.state.updateCamera(t=>this._updateCameraNearFar(t))}_updateCameraNearFar(t,i){const e=this.view.constraints.clipDistance;"manual"===e.mode?v(t,e):this._updateCameraNearFarAuto(t,e,i)}_updateCameraNearFarAuto(t,i,e=this.view.stage.renderer.sceneDepthRange.value){const a=u(this.view,t.eye),s=this.nearFarHeuristic.compute(t,this.view.renderDataExtent,e,a);t.near=s.near,t.far=s.far,i&&i.autoUpdate(t.near,t.far)}_updateCollision(){const t=this.view.map?.ground?.navigationConstraint?.type,i=!t||"stay-above"===t,e=this.view.state.constraints.collision;if(i!==e.enabled){e.enabled=i,i&&this._reapplyConstraints(8);"auto"===this.view.constraints.tilt.mode&&this._updateTiltAuto()}}_updateAltitude(){const t=this.view.constraints.altitude;1===this.view.state.viewingMode?this.view.state.constraints.altitude={min:t.min,max:t.max}:this.view.state.constraints.altitude=null,this._reapplyConstraints()}_updateTiltMax(){const t=this.view.constraints.tilt;"auto"!==t.mode&&(this._updateTiltManual(t),this._reapplyConstraints())}_updateTilt(){const t=this.view.constraints.tilt;"manual"===t.mode?this._updateTiltManual(t):this._updateTiltAuto(),this._reapplyConstraints()}_updateTiltManual(t){const i=this.view.state.constraints;i.tilt=i.createConstantMaxTilt(e(t.max))}_updateTiltAuto(){const t=this.view.state.constraints;t.tilt=t.createDefaultTilt(),this._updateTiltAutoMax()}_updateTiltAutoMax(){const t=this.view.constraints.tilt;if("auto"!==t.mode)return;const i=this.view.state.constraints;if(i.tilt){const e=i.tilt(this.view.state.camera.distance).max;t.autoUpdate(a(e))}}_updateLocalSurfaceDistance(t){if(null==t)return;let i=Math.max(t.width,t.height);if(i<=0)return;null!=t.zmax&&null!=t.zmin&&(i=Math.max(i,t.zmax-t.zmin));const e=this.view.state,a=3*i/Math.atan(e.camera.fov/2);a!==e.constraints.distance&&(e.constraints.distance=a)}_reapplyConstraints(t=15){this.view.state.updateCamera(i=>c(this.view,i,new d(t,0,null)))}};function v(t,i){i&&(t.near=i.near,t.far=i.far)}t([o({constructOnly:!0})],m.prototype,"view",void 0),t([o({readOnly:!0})],m.prototype,"surfaceCollisionConstraint",void 0),m=t([l("esri.views.3d.state.ConstraintsManager")],m);export{m as ConstraintsManager};