@arcgis/core 4.34.0-next.65 → 4.34.0-next.66

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 (211) hide show
  1. package/Graphic.js +1 -1
  2. package/applications/SceneViewer/sceneViewerUtils.js +1 -1
  3. package/assets/esri/core/workers/RemoteClient.js +1 -1
  4. package/assets/esri/core/workers/chunks/05016b0713ef760fc57d.js +1 -0
  5. package/assets/esri/core/workers/chunks/{eadac757f74470b89a36.js → 0952aeddddc16705b7a3.js} +1 -1
  6. package/assets/esri/core/workers/chunks/09dd8613bc03e7a3a4cb.js +1 -0
  7. package/assets/esri/core/workers/chunks/0c4f07eb3f3dd5cd2c6c.js +1 -0
  8. package/assets/esri/core/workers/chunks/117eb1422e9795d37ea3.js +1 -0
  9. package/assets/esri/core/workers/chunks/{79933271a76a1756584f.js → 12d30c2367652e2c688b.js} +1 -1
  10. package/assets/esri/core/workers/chunks/16fe21ca9b24eaee3069.js +1 -0
  11. package/assets/esri/core/workers/chunks/18c7b1e1fbf7eb6c3c33.js +1 -0
  12. package/assets/esri/core/workers/chunks/{e72aee3f857aa473822c.js → 1c7b5ca80e80c314f78d.js} +1 -1
  13. package/assets/esri/core/workers/chunks/{426232091caf8608e5f1.js → 26b791291689434dde09.js} +1 -1
  14. package/assets/esri/core/workers/chunks/2a938096a42613425c7b.js +1 -0
  15. package/assets/esri/core/workers/chunks/31e7358fe802abb3f8db.js +1 -0
  16. package/assets/esri/core/workers/chunks/3212a476184be25d17f8.js +1 -0
  17. package/assets/esri/core/workers/chunks/3bc50ee639a4d16c4f80.js +1 -0
  18. package/assets/esri/core/workers/chunks/4102ed32b8dbdc32cb3b.js +1 -0
  19. package/assets/esri/core/workers/chunks/{6ab435423acb0ed0b1c7.js → 44031bef6d500167ef0b.js} +1 -1
  20. package/assets/esri/core/workers/chunks/{a29fb90226bd08157bd1.js → 481aea82501d04667ba2.js} +1 -1
  21. package/assets/esri/core/workers/chunks/{7c3a1958990de095d3a1.js → 48316d91c06928f69f61.js} +1 -1
  22. package/assets/esri/core/workers/chunks/{897f9775f06ddbf6486f.js → 4be2bab8ff3bd14ffdfb.js} +1 -1
  23. package/assets/esri/core/workers/chunks/4f0f6653b8e92c633d14.js +1 -0
  24. package/assets/esri/core/workers/chunks/548818df658b607a364e.js +1 -0
  25. package/assets/esri/core/workers/chunks/5c053d197935c65792ce.js +1 -0
  26. package/assets/esri/core/workers/chunks/60920d4856a011ace7e2.js +1 -0
  27. package/assets/esri/core/workers/chunks/66cb5b294d7f251c2cc8.js +1 -0
  28. package/assets/esri/core/workers/chunks/66ffefd46fe6175c2af4.js +1 -0
  29. package/assets/esri/core/workers/chunks/6a5b5b80917a5375b9f6.js +1 -0
  30. package/assets/esri/core/workers/chunks/{d1e8220dcae1d01d3c35.js → 707311e24b2f458d9209.js} +1 -1
  31. package/assets/esri/core/workers/chunks/7a17e78c76076ed4476f.js +1 -0
  32. package/assets/esri/core/workers/chunks/7e95896ac41c7e2ca26a.js +1 -0
  33. package/assets/esri/core/workers/chunks/{5d12862042b6bf9f9d54.js → 82cb5defb0593e3017ff.js} +1 -1
  34. package/assets/esri/core/workers/chunks/8f60804c7ba445f25df8.js +1 -0
  35. package/assets/esri/core/workers/chunks/9a6d359ead62a8eadd3c.js +1 -0
  36. package/assets/esri/core/workers/chunks/{657b01a6df8dc46c5209.js → 9e3f8c06b4e090a35710.js} +1 -1
  37. package/assets/esri/core/workers/chunks/9eb1bfcb9b05f2a36748.js +1 -0
  38. package/assets/esri/core/workers/chunks/{0a36df6fdab95785d1ce.js → a2963ffc9a8c90822d2d.js} +1 -1
  39. package/assets/esri/core/workers/chunks/ad7aa7d09bfceb12609e.js +1 -0
  40. package/assets/esri/core/workers/chunks/{9f93513037a6e87433c4.js → adfb018f510e19a520fb.js} +1 -1
  41. package/assets/esri/core/workers/chunks/af1030e4c4437d4eb600.js +1 -0
  42. package/assets/esri/core/workers/chunks/{a1bd4eecca1e3272bffb.js → aff553c3d6544e20f188.js} +1 -1
  43. package/assets/esri/core/workers/chunks/b482132638f3b351724c.js +1 -0
  44. package/assets/esri/core/workers/chunks/{e1b25b1ce3bd4f0f2cda.js → bc5fa33afec5354601a1.js} +1 -1
  45. package/assets/esri/core/workers/chunks/{0b53bc76d38e85902748.js → c20aead85cdea91c4b74.js} +1 -1
  46. package/assets/esri/core/workers/chunks/{904c116c6b093e0e970c.js → d1b361b8adf1c719a10a.js} +1 -1
  47. package/assets/esri/core/workers/chunks/dcad3dcbd4ea2f5a6a04.js +1 -0
  48. package/assets/esri/core/workers/chunks/e0fe6bb51ecc9b2faf69.js +1 -0
  49. package/assets/esri/core/workers/chunks/e4e224983c3ee24fc51d.js +1 -0
  50. package/assets/esri/core/workers/chunks/ee391a41144855fc625d.js +1 -0
  51. package/assets/esri/core/workers/chunks/f054557e23978e174686.js +1 -0
  52. package/assets/esri/core/workers/chunks/f5101f5f93f776a6456f.js +1 -0
  53. package/chunks/GlowComposition.glsl.js +4 -4
  54. package/config.js +1 -1
  55. package/core/AsyncUpdate.js +1 -1
  56. package/core/mapCollectionUtils.js +1 -1
  57. package/editing/sharedTemplates/executor/builders/pointAtPolygonCentroid.js +1 -1
  58. package/geometry/Polygon.js +1 -1
  59. package/geometry/support/centroid.js +1 -1
  60. package/geometry/support/geometryUtils.js +1 -1
  61. package/graphic/AggregateGraphicOrigin.js +1 -1
  62. package/graphic/BuildingGraphicOrigin.js +1 -1
  63. package/graphic/CSVGraphicOrigin.js +1 -1
  64. package/graphic/CatalogGraphicOrigin.js +1 -1
  65. package/graphic/FeatureGraphicOrigin.js +1 -1
  66. package/graphic/GeoJSONGraphicOrigin.js +1 -1
  67. package/graphic/GeoRSSGraphicOrigin.js +1 -1
  68. package/graphic/ImageryGraphicOrigin.js +1 -1
  69. package/graphic/ImageryTileGraphicOrigin.js +1 -1
  70. package/graphic/KMLGraphicOrigin.js +1 -1
  71. package/graphic/KnowledgeGraphGraphicOrigin.js +1 -1
  72. package/graphic/LinkChartGraphicOrigin.js +1 -1
  73. package/graphic/MapImageGraphicOrigin.js +1 -1
  74. package/graphic/MapNotesGraphicOrigin.js +1 -1
  75. package/graphic/OGCFeatureGraphicOrigin.js +1 -1
  76. package/graphic/OrientedImageryGraphicOrigin.js +1 -1
  77. package/graphic/ParquetGraphicOrigin.js +1 -1
  78. package/graphic/PointCloudGraphicOrigin.js +1 -1
  79. package/graphic/SceneGraphicOrigin.js +1 -1
  80. package/graphic/StreamGraphicOrigin.js +1 -1
  81. package/graphic/SubtypeGroupGraphicOrigin.js +1 -1
  82. package/graphic/TileGraphicOrigin.js +1 -1
  83. package/graphic/TrackGraphicOrigin.js +1 -1
  84. package/graphic/VectorTileGraphicOrigin.js +1 -1
  85. package/graphic/VoxelGraphicOrigin.js +1 -1
  86. package/graphic/WCSGraphicOrigin.js +1 -1
  87. package/graphic/WFSGraphicOrigin.js +1 -1
  88. package/graphic/getIdFieldsProvider.js +5 -0
  89. package/graphic/getSliceableContainer.js +5 -0
  90. package/graphic/graphicOrigins.d.ts +0 -2
  91. package/graphic/graphicOrigins.js +1 -1
  92. package/interfaces.d.ts +115 -60
  93. package/kernel.js +1 -1
  94. package/layers/IntegratedMesh3DTilesLayer.js +1 -1
  95. package/layers/IntegratedMeshLayer.js +1 -1
  96. package/layers/LinkChartLayer.js +1 -1
  97. package/layers/graphics/controllers/I3SOnDemandController.js +1 -1
  98. package/layers/knowledgeGraph/KnowledgeGraphLayerDataManager.js +1 -1
  99. package/layers/orientedImagery/core/coverageUtils.js +1 -1
  100. package/layers/support/rasterDatasets/multidimensionalUtils.js +1 -1
  101. package/package.json +1 -1
  102. package/smartMapping/support/adapters/FeatureLayerBinningAdapter.js +1 -1
  103. package/support/revision.js +1 -1
  104. package/symbols/support/previewCIMSymbol.js +1 -1
  105. package/symbols/support/previewSymbol2D.js +1 -1
  106. package/symbols/support/renderUtils.js +1 -1
  107. package/symbols/support/svgUtils.js +1 -1
  108. package/symbols/support/symbolUtils.js +1 -1
  109. package/symbols/support/utils.js +1 -1
  110. package/views/2d/analysis/ElevationProfile/ElevationProfileInputVisualization2D.js +5 -0
  111. package/views/2d/analysis/ElevationProfile/ElevationProfileLineVisualization2D.js +5 -0
  112. package/views/2d/analysis/ElevationProfile/ElevationProfileVisualization2D.js +5 -0
  113. package/views/2d/analysis/ElevationProfileAnalysisView2D.js +1 -1
  114. package/views/3d/analysis/ElevationProfile/ElevationProfileInputVisualization3D.js +5 -0
  115. package/views/3d/analysis/ElevationProfile/ElevationProfileLineVisualization3D.js +5 -0
  116. package/views/3d/analysis/ElevationProfile/ElevationProfileVisualization3D.js +5 -0
  117. package/views/3d/analysis/ElevationProfileAnalysisView3D.js +1 -1
  118. package/views/3d/analysis/LineOfSight/LineOfSightIntersectionResult.js +1 -1
  119. package/views/3d/analysis/LineOfSight/LineOfSightRayIntersector.js +1 -1
  120. package/views/3d/analysis/LineOfSight/LineOfSightTool.js +1 -1
  121. package/views/3d/analysis/Slice/SliceTool.js +1 -1
  122. package/views/3d/environment/Fog.js +1 -1
  123. package/views/3d/layers/BuildingSceneLayerView3D.js +1 -1
  124. package/views/3d/layers/I3SMeshView3D.js +1 -1
  125. package/views/3d/layers/IntegratedMeshLayerView3D.js +1 -1
  126. package/views/3d/layers/SceneLayerView3D.js +1 -1
  127. package/views/3d/layers/graphics/graphicUtils.js +1 -1
  128. package/views/3d/layers/i3s/Intersector.js +1 -1
  129. package/views/3d/layers/support/SublayerPopupHighlightHelper3D.js +1 -1
  130. package/views/3d/layers/support/Tiles3DIntersectionHandler.js +1 -1
  131. package/views/3d/support/hitTest.js +1 -1
  132. package/views/3d/support/viewpointUtils.js +1 -1
  133. package/views/3d/terrain/Intersector.js +1 -1
  134. package/views/3d/webgl-engine/core/FBOCache.js +1 -1
  135. package/views/3d/webgl-engine/core/FBOCacheFormats.js +1 -1
  136. package/views/3d/webgl-engine/effects/debug/RenderNodeVisualizerNode.js +4 -4
  137. package/views/3d/webgl-engine/effects/glow/GlowPresets.glsl.js +1 -1
  138. package/views/3d/webgl-engine/effects/glow/GlowRenderNode.js +1 -1
  139. package/views/3d/webgl-engine/effects/highlight/Highlight.js +1 -1
  140. package/views/3d/webgl-engine/lib/GaussianSplatRenderNode.js +1 -1
  141. package/views/3d/webgl-engine/lib/MainFramebuffer.js +1 -1
  142. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  143. package/views/3d/webgl-engine/lib/intersectorUtilsConversions.js +1 -1
  144. package/views/View2D.js +1 -1
  145. package/views/analysis/ElevationProfile/ElevationProfileHoveredPointVisualization.js +5 -0
  146. package/views/analysis/ElevationProfile/ElevationProfileHoveredPointsVisualization.js +5 -0
  147. package/views/analysis/ElevationProfile/ElevationProfileTool.js +1 -1
  148. package/views/analysis/ElevationProfile/constants.js +1 -1
  149. package/views/analysis/ElevationProfile/elevationProfileInputVisualizationUtils.js +5 -0
  150. package/views/draw/support/createUtils.js +1 -1
  151. package/views/layers/support/MapServiceLayerViewHelper.js +1 -1
  152. package/widgets/AreaMeasurement2D/AreaMeasurement2DTool.js +1 -1
  153. package/widgets/Legend/styles/card/CardView.js +1 -1
  154. package/widgets/Legend/styles/card/ColorRamp.js +1 -1
  155. package/widgets/Legend/styles/card/LegendElement.js +1 -1
  156. package/widgets/Legend/styles/card/UnivariateAboveAndBelowRamp.js +1 -1
  157. package/widgets/Legend/styles/card/UnivariateColorSizeRamp.js +1 -1
  158. package/widgets/Legend/styles/classic/ClassicView.js +1 -1
  159. package/widgets/Legend/styles/classic/LegendElement.js +1 -1
  160. package/widgets/Legend/styles/classic/UnivariateAboveAndBelowRamp.js +1 -1
  161. package/widgets/Legend/styles/classic/UnivariateColorSizeRamp.js +1 -1
  162. package/widgets/Legend/styles/support/relationshipUtils.js +1 -1
  163. package/widgets/Legend/styles/support/univariateUtils.js +1 -1
  164. package/widgets/Legend/support/ActiveLayerInfo.js +1 -1
  165. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  166. package/widgets/OrientedImageryViewer/navigation/NavigationManager.js +1 -1
  167. package/widgets/OrientedImageryViewer/navigation/queries.js +1 -1
  168. package/widgets/UtilityNetworkTrace/support/GraphicHandler.js +1 -1
  169. package/assets/esri/core/workers/chunks/0264905da9fa56166538.js +0 -1
  170. package/assets/esri/core/workers/chunks/070b29cba896f46537f9.js +0 -1
  171. package/assets/esri/core/workers/chunks/0cdf6b51f2a63f348530.js +0 -1
  172. package/assets/esri/core/workers/chunks/0d82cc6905b105b3568a.js +0 -1
  173. package/assets/esri/core/workers/chunks/1143313f2f6f34deaad7.js +0 -1
  174. package/assets/esri/core/workers/chunks/14c6461ffd36319e1d74.js +0 -1
  175. package/assets/esri/core/workers/chunks/2394ac65d64e50399d76.js +0 -1
  176. package/assets/esri/core/workers/chunks/47febd4de836a33b51b1.js +0 -1
  177. package/assets/esri/core/workers/chunks/487afbf352d12c745430.js +0 -1
  178. package/assets/esri/core/workers/chunks/56b4dcd04c844eaacd60.js +0 -1
  179. package/assets/esri/core/workers/chunks/5d65987f2c1b5c56a799.js +0 -1
  180. package/assets/esri/core/workers/chunks/77e27f318b5863dd0f5c.js +0 -1
  181. package/assets/esri/core/workers/chunks/7b7f5028a488bb9c10f4.js +0 -1
  182. package/assets/esri/core/workers/chunks/808cfed7022e3846d5b2.js +0 -1
  183. package/assets/esri/core/workers/chunks/8bd5a0ff7dcf1067bf53.js +0 -1
  184. package/assets/esri/core/workers/chunks/99b20eef2893047fac10.js +0 -1
  185. package/assets/esri/core/workers/chunks/9f4e23bae621ff3ecea3.js +0 -1
  186. package/assets/esri/core/workers/chunks/a596d6ccb6103e594031.js +0 -1
  187. package/assets/esri/core/workers/chunks/a5e6359fadbd699b1c8e.js +0 -1
  188. package/assets/esri/core/workers/chunks/a7f3cdd9a249ef4572ce.js +0 -1
  189. package/assets/esri/core/workers/chunks/a80d769b0ed025f0df64.js +0 -1
  190. package/assets/esri/core/workers/chunks/af83dddddbfe25194527.js +0 -1
  191. package/assets/esri/core/workers/chunks/b057e6d593c1607cae61.js +0 -1
  192. package/assets/esri/core/workers/chunks/b1f1a26e7a2ef5b783ee.js +0 -1
  193. package/assets/esri/core/workers/chunks/b605dfdfed8ff8eda4f3.js +0 -1
  194. package/assets/esri/core/workers/chunks/c337c1a2dbc452780dd7.js +0 -1
  195. package/assets/esri/core/workers/chunks/c601bbdafdee5074b04f.js +0 -1
  196. package/assets/esri/core/workers/chunks/c8694a27e2cf28b010e8.js +0 -1
  197. package/assets/esri/core/workers/chunks/e6457ac25c0829ee039c.js +0 -1
  198. package/assets/esri/core/workers/chunks/f4167fc895d4009df1c7.js +0 -1
  199. package/assets/esri/core/workers/chunks/f76774781865cb1411b0.js +0 -1
  200. package/assets/esri/core/workers/chunks/fd04df45cdcc6ff52554.js +0 -1
  201. package/graphic/IntegratedMesh3DTilesGraphicOrigin.d.ts +0 -4
  202. package/graphic/IntegratedMesh3DTilesGraphicOrigin.js +0 -5
  203. package/graphic/IntegratedMeshGraphicOrigin.d.ts +0 -4
  204. package/graphic/IntegratedMeshGraphicOrigin.js +0 -5
  205. package/graphic/isIntegratedMesh3DTilesGraphicOrigin.js +0 -5
  206. package/graphic/isIntegratedMeshGraphicOrigin.js +0 -5
  207. package/views/3d/analysis/ElevationProfile/ElevationProfileHoveredPointVisualization.js +0 -5
  208. package/views/3d/analysis/ElevationProfile/ElevationProfileHoveredPointsVisualization.js +0 -5
  209. package/views/3d/analysis/ElevationProfile/ElevationProfileInputVisualization.js +0 -5
  210. package/views/3d/analysis/ElevationProfile/ElevationProfileLineVisualization.js +0 -5
  211. package/views/3d/analysis/ElevationProfile/ElevationProfileVisualization.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/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{getMetersPerUnitForSR as t}from"../../../../core/unitUtils.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(t.centroid,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 U(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 A(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 B(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 D(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 I(t){return null!=t.isPrimitive}function Z(t){return k(I(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,D as computeObjectScale,G as demResolutionForBoundingBox,U as enlargeExtent,k as isValidSize,A as mixinColorAndOpacity,B as overrideColor,Z as validateSymbolLayerSize};
5
+ import{getMetersPerUnitForSR as t}from"../../../../core/unitUtils.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 U(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 A(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 B(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 D(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 I(t){return null!=t.isPrimitive}function Z(t){return k(I(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,D as computeObjectScale,G as demResolutionForBoundingBox,U as enlargeExtent,k as isValidSize,A as mixinColorAndOpacity,B 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/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{isValidIntersectorResult as t}from"../../webgl-engine/lib/IntersectorResult.js";import{Graphic3DTarget as e,LayerTarget as r}from"../../webgl-engine/lib/IntersectorTarget.js";class s extends e{constructor(t,e,r,s){super(e,r),this.point=t,this.createGraphic=s}}function n(e){return t(e)&&5===e.intersector&&!!e.target}class i extends r{constructor(t,e,r,s,n){super(t),this.layerViewUid=t,this.sublayerId=e,this.nodeIndex=r,this.componentIndex=s,this.triangleNr=n}}class c extends e{constructor(t,e,r){super(e,null),this.point=t,this.createVoxelGraphic=r}}class o extends e{constructor(t,e){super(t,null),this.createTiles3DGraphic=e}}function u(e){return t(e)&&4===e.intersector&&!!e.target}function a(e){return t(e)&&7===e.intersector&&!!e.target}function l(e){return t(e)&&8===e.intersector&&!!e.target}export{i as I3sTarget,s as PclTarget,o as Tiles3DTarget,c as VoxelTarget,u as isI3sIntersectorResult,n as isPclIntersectorResult,l as isTiles3DIntersectorResult,a as isVoxelIntersectorResult};
5
+ import{isValidIntersectorResult as t}from"../../webgl-engine/lib/IntersectorResult.js";import{Graphic3DTarget as e,LayerTarget as r}from"../../webgl-engine/lib/IntersectorTarget.js";class s extends e{constructor(t,e,r,s){super(e,r),this.point=t,this.createGraphic=s}}function n(e){return t(e)&&5===e.intersector&&!!e.target}class i extends r{constructor(t,e,r,s,n){super(t),this.layerViewUid=t,this.sublayerId=e,this.nodeIndex=r,this.componentIndex=s,this.triangleNr=n}}class o extends e{constructor(t,e,r){super(e,null),this.point=t,this.createVoxelGraphic=r}}class c extends r{}function a(e){return t(e)&&4===e.intersector&&!!e.target}function l(e){return t(e)&&7===e.intersector&&!!e.target}export{i as I3sTarget,s as PclTarget,c as Tiles3DTarget,o as VoxelTarget,a as isI3sIntersectorResult,n as isPclIntersectorResult,l as isVoxelIntersectorResult};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import i from"../../../../core/Accessor.js";import{destroyHandle as r}from"../../../../core/handleUtils.js";import{when as t,watch as s,initial as p,syncAndInitial as o}from"../../../../core/reactiveUtils.js";import{property as h}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as a}from"../../../../core/accessorSupport/decorators/subclass.js";import{ImageHighlightHelper3D as l}from"./ImageHighlightHelper3D.js";import{MapServiceLayerViewHelper as g}from"../../../layers/support/MapServiceLayerViewHelper.js";import{createQueryGeometry as c}from"../../../support/drapedUtils.js";let d=class extends i{constructor(e){super(e)}initialize(){this._highlightHelper=new l({layer:this.layerView.layer,view:this.view,updatingHandles:this.updatingHandles}),this._mapServiceLayerViewHelper=new g({createFetchPopupFeaturesQueryGeometry:(e,i)=>c(e,i,this.view),layerView:this.layerView,updatingHandles:this.updatingHandles,highlightGraphics:this._highlightHelper.graphics,highlightGraphicUpdated:e=>this._highlightHelper.graphicsView?.graphicChanged(e)}),this.addHandles([r(this._mapServiceLayerViewHelper),t(()=>this.view?.stationary,()=>this._mapServiceLayerViewHelper.updateHighlightedFeatures(this.view.resolution),p),s(()=>this.layerView.suspended,e=>this._highlightHelper.suspended=e,o)])}fetchPopupFeaturesAtLocation(e,i){return this._highlightHelper.preload(),this._mapServiceLayerViewHelper.fetchPopupFeaturesAtLocation(e,i)}highlight(e,i){return this._highlightHelper.highlight(e,i)}};e([h()],d.prototype,"view",void 0),e([h()],d.prototype,"layerView",void 0),e([h()],d.prototype,"updatingHandles",void 0),d=e([a("esri.views.3d.layers.support.SublayerPopupHighlightHelper3D")],d);export{d as SublayerPopupHighlightHelper3D};
5
+ import{__decorate as e}from"tslib";import i from"../../../../core/Accessor.js";import{destroyHandle as r}from"../../../../core/handleUtils.js";import{ignoreAbortErrors as t}from"../../../../core/promiseUtils.js";import{when as s,watch as p,initial as o,syncAndInitial as h}from"../../../../core/reactiveUtils.js";import{property as a}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as l}from"../../../../core/accessorSupport/decorators/subclass.js";import{ImageHighlightHelper3D as c}from"./ImageHighlightHelper3D.js";import{MapServiceLayerViewHelper as g}from"../../../layers/support/MapServiceLayerViewHelper.js";import{createQueryGeometry as d}from"../../../support/drapedUtils.js";let m=class extends i{constructor(e){super(e)}initialize(){this._highlightHelper=new c({layer:this.layerView.layer,view:this.view,updatingHandles:this.updatingHandles}),this._mapServiceLayerViewHelper=new g({createFetchPopupFeaturesQueryGeometry:(e,i)=>d(e,i,this.view),layerView:this.layerView,updatingHandles:this.updatingHandles,highlightGraphics:this._highlightHelper.graphics,highlightGraphicUpdated:e=>this._highlightHelper.graphicsView?.graphicChanged(e)}),this.addHandles([r(this._mapServiceLayerViewHelper),s(()=>this._mapServiceLayerViewHelper.highlightFeaturesActive&&this.view?.stationary,()=>t(this._mapServiceLayerViewHelper.updateHighlightedFeatures(this.view.resolution)),o),p(()=>this.layerView.suspended,e=>this._highlightHelper.suspended=e,h)])}fetchPopupFeaturesAtLocation(e,i){return this._highlightHelper.preload(),this._mapServiceLayerViewHelper.fetchPopupFeaturesAtLocation(e,i)}highlight(e,i){return this._highlightHelper.highlight(e,i)}};e([a()],m.prototype,"view",void 0),e([a()],m.prototype,"layerView",void 0),e([a()],m.prototype,"updatingHandles",void 0),m=e([l("esri.views.3d.layers.support.SublayerPopupHighlightHelper3D")],m);export{m as SublayerPopupHighlightHelper3D};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../Graphic.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{Tiles3DTarget as r}from"../i3s/Intersector.js";import{IntersectorResult as t}from"../../webgl-engine/lib/IntersectorResult.js";import{MeshIntersectionOptions as s,computeInvDir as n,intersectAabbInvDir as o}from"../../webgl-engine/lib/RayIntersections.js";class l{constructor(e){this.type=8,this.slicePlaneEnabled=!1,this.isGround=!0,this.layerView=e,this.layerViewUid=e.uid,this._graphicOrigin=e.layer.graphicOrigin}intersect(e,l,a,c,u,d){if(e.options.filteredLayerViewUids.includes(this.layerView.uid))return;const h=e.results,m=2===e.options.store,p=this.layerView.view.stage.renderView.componentObjectCollection,y=new s(d,e.options.normalRequired),g=i();n(a,c,g),this.layerView.forEachVisibleComponentObject(i=>{i.intersectionGeometry&&o(i.aabbInWorldCoordinates,a,g,0)&&p.intersect(i,a,c,e.tolerance,null,y,(i,s,n,o)=>{if(s>=0){if(null!=l&&!l(a,c,s))return;const i=e=>{const i=new r(this.layerView.layer.uid,()=>this._createTiles3DGraphic(this.layerView.layer,{}));e.set(this.type,i,s,n)};if(this.isGround&&(null==h.ground.distance||s<h.ground.distance)&&i(h.ground),e.options.isFiltered)return;if((null==h.min.distance||s<h.min.distance)&&i(h.min),(null==h.max.distance||s>h.max.distance)&&i(h.max),m){const r=new t(e.ray);i(r),e.results.all.push(r)}}})})}_createTiles3DGraphic(i,r){return new e({layer:i,sourceLayer:i,origin:this._graphicOrigin,attributes:r})}}export{l as Tiles3DIntersectionHandler};
5
+ import{create as e}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{Tiles3DTarget as i}from"../i3s/Intersector.js";import{IntersectorResult as t}from"../../webgl-engine/lib/IntersectorResult.js";import{MeshIntersectionOptions as n,computeInvDir as s,intersectAabbInvDir as r}from"../../webgl-engine/lib/RayIntersections.js";class o{constructor(e){this.type=8,this.slicePlaneEnabled=!1,this.isGround=!0,this.layerView=e,this.layerViewUid=e.uid}intersect(o,l,a,c,d,u){if(o.options.filteredLayerViewUids.includes(this.layerView.uid))return;const m=o.results,p=2===o.options.store,w=this.layerView.view.stage.renderView.componentObjectCollection,f=new n(u,o.options.normalRequired),h=e();s(a,c,h),this.layerView.forEachVisibleComponentObject(e=>{e.intersectionGeometry&&r(e.aabbInWorldCoordinates,a,h,0)&&w.intersect(e,a,c,o.tolerance,null,f,(e,n,s,r)=>{if(n>=0){if(null!=l&&!l(a,c,n))return;const e=e=>{const t=new i(this.layerView.layer.uid);e.set(this.type,t,n,s)};if(this.isGround&&(null==m.ground.distance||n<m.ground.distance)&&e(m.ground),o.options.isFiltered)return;if((null==m.min.distance||n<m.min.distance)&&e(m.min),(null==m.max.distance||n>m.max.distance)&&e(m.max),p){const i=new t(o.ray);e(i),o.results.all.push(i)}}})})}}export{o 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/4.34/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../Graphic.js";import{isIterable as n}from"../../../core/iteratorUtils.js";import{screenPointObjectToArray as i,createScreenPointArray as t}from"../../../core/screenUtils.js";import{create as r}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import s from"../../../geometry/Point.js";import l from"../../../geometry/SpatialReference.js";import{projectVectorToVector as o}from"../../../geometry/projection/projectVectorToVector.js";import{fallbackObjectIDAttribute as c}from"../../../layers/LayerConstants.js";import{isIntegratedMeshLayer as a}from"../../../layers/support/layerUtils.js";import{debugFlags as u}from"./debugFlags.js";import{getElevationAtPoint as d}from"./ElevationProvider.js";import{Intersector as p}from"../webgl-engine/lib/Intersector.js";import{isValidIntersectorResult as f}from"../webgl-engine/lib/IntersectorResult.js";import{toHit as m,toOwner as g}from"../webgl-engine/lib/intersectorUtilsConversions.js";import{terrainId as y}from"../webgl-engine/lib/verticalOffsetUtils.js";async function h(e,n,i,r){const s=i?x(e,i):r,l=t(n.x,n.y);s.requiresGroundFeedback=!0,s.enableDraped=!0;const o=new p(e.state.viewingMode);o.options.selectionMode=!0,o.options.store=2,e.sceneIntersectionHelper.intersectIntersectorScreen(l,o,s);const c=await b(e,o.results.all,s.graphics),d=o.results.ground,m=g(d,e),y=null!=m&&"type"in m&&a(m.type)?m:null,h={screenPoint:n,results:c,ground:{mapPoint:j(e,d),distance:f(d)?d.distanceInRenderSpace:0,layer:y}};return u.SCENEVIEW_HITTEST_RETURN_INTERSECTOR&&(h.intersector=o),h}function w(e,n,t,r){const s=t?x(e,t):r,l=!(!s.graphics?.include&&!s.graphics?.exclude),o=!(!s.mediaElements?.include&&!s.mediaElements?.exclude),c=i(n);s.enableDraped=s.include&&!s.include.has(y)||s.exclude?.has(y);const a=e.sceneIntersectionHelper,u=new p(e.state.viewingMode);if(u.options.selectionMode=!0,u.options.store=l||o?2:0,u.options.excludeLabels=t?.excludeLabels??!1,a.intersectIntersectorScreen(c,u,s),l||o){for(const n of u.results.all){const i=m(n,e);if(null==i)return j(e,n);if(l&&("graphic"!==i.type||E(s.graphics,i.graphic)))return j(e,n);if(o&&("media"!==i.type||S(s.mediaElements,i.element)))return j(e,n)}return null}return j(e,u.results.min)}async function b(e,n,i){const t=new Array;let r,s=null;const l={defer(e){r=e()}};for(let o=0;o<n.length;o++){const c=n[o],u=g(c,e);if(null!=u&&(u===e.map.ground||"type"in u&&a(u.type)))break;const d=m(c,e,l)??await r;if(r=null,null==d)continue;if("graphic"===d.type){if(null==s&&o!==n.length-1&&(s=new Set),null!=s){const e=U(d.graphic);if(s.has(e))continue;s.add(e)}if(!E(i,d.graphic))continue}const p=j(e,c),f=c.distanceInRenderSpace;if("media"===d.type){const e=d.element.toSource(p);t.push({...d,mapPoint:p,distance:f,sourcePoint:e})}else t.push({...d,mapPoint:p,distance:f})}return t}function j(e,n,i){return n.getIntersectionPoint(F)?(i=V(e,F,i),2===n.intersector&&e.basemapTerrain&&(i.z=d(e.basemapTerrain,i)??0),i):null}function U(e){const n=e.sourceLayer,i=e.layer,t=n&&"objectIdField"in n?n:i&&"objectIdField"in i?i:n;if(t){const n=t.objectIdField??c,i=e.attributes?.[n];if(i)return`o-${t.id}-${i}`}return`u-${e.uid}`}function E(e,n){return S(e,U(n))}function S(e,n){return null==e||(null==e.include||e.include.has(n))&&(null==e.exclude||!e.exclude.has(n))}function V(e,n,i){let t=e.spatialReference||l.WGS84;return o(n,e.renderSpatialReference,F,t)?n=F:(t=l.WGS84,o(n,e.renderSpatialReference,F,t)&&(n=F)),i?(i.x=n[0],i.y=n[1],i.z=n[2],i.spatialReference=t):i=new s(n,t),i}function x(e,n){const i=I(e,n.include,0),t=I(e,n.exclude,1);return{include:i.layerViewUids,exclude:t.layerViewUids,graphics:{include:i.graphicUids,exclude:t.graphicUids},mediaElements:{include:i.mediaElements,exclude:t.mediaElements}}}function I(i,t,r,s=new R){if(!t)return s;if(t instanceof e)L(s,U(t)),0===r&&(null!=i.graphicsView&&t.layer===i?P(s,i.graphicsView.uid):t.layer&&T(s,i,t.layer.uid));else if("layer"in t&&"element"in t)M(s,t.element),0===r&&T(s,i,t.layer.uid);else if(n(t))for(const e of t)e===i.graphics&&null!=i.graphicsView?P(s,i.graphicsView.uid):e===i.map.ground?P(s,y):I(i,e,r,s);else"layer"in t&&v(s,i,t),"uid"in t&&T(s,i,t.uid);return s}class R{constructor(){this.layerViewUids=null,this.graphicUids=null,this.mediaElements=null}}function T(e,n,i){const t=n.allLayerViews.find(e=>e.layer.uid===i);t&&P(e,t.uid)}function P(e,n){e.layerViewUids??=new Map,e.layerViewUids.set(n,!0)}function v(e,n,i){const t=n.allLayerViews.find(e=>e.layer.uid===i.layer.uid);if(!t)return;e.layerViewUids??=new Map;const r=e.layerViewUids.get(t.uid);!0!==r&&(r?r.add(i.id):e.layerViewUids.set(t.uid,new Set([i.id])))}function L(e,n){e.graphicUids??=new Set,e.graphicUids.add(n)}function M(e,n){e.mediaElements??=new Set,e.mediaElements.add(n)}const F=r();export{V as computeMapPointFromVec3d,x as externalToInternalIntersectOptions,U as getGraphicFilterUid,h as hitTest,j as intersectResultToMapPoint,w as toMap};
5
+ import e from"../../../Graphic.js";import{isIterable as n}from"../../../core/iteratorUtils.js";import{screenPointObjectToArray as i,createScreenPointArray as t}from"../../../core/screenUtils.js";import{create as r}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import s from"../../../geometry/Point.js";import l from"../../../geometry/SpatialReference.js";import{projectVectorToVector as o}from"../../../geometry/projection/projectVectorToVector.js";import{fallbackObjectIDAttribute as c}from"../../../layers/LayerConstants.js";import{isIntegratedMeshLayer as a}from"../../../layers/support/layerUtils.js";import{debugFlags as u}from"./debugFlags.js";import{getElevationAtPoint as d}from"./ElevationProvider.js";import{Intersector as p}from"../webgl-engine/lib/Intersector.js";import{isValidIntersectorResult as m}from"../webgl-engine/lib/IntersectorResult.js";import{toHit as f,toOwner as g}from"../webgl-engine/lib/intersectorUtilsConversions.js";import{terrainId as y}from"../webgl-engine/lib/verticalOffsetUtils.js";async function h(e,n,i,r){const s=i?x(e,i):r,l=t(n.x,n.y);s.requiresGroundFeedback=!0,s.enableDraped=!0;const o=new p(e.state.viewingMode);o.options.selectionMode=!0,o.options.store=2,e.sceneIntersectionHelper.intersectIntersectorScreen(l,o,s);const c=await b(e,o.results.all,s.graphics),d=o.results.ground,f=g(d,e),y=null!=f&&"type"in f&&a(f.type)?f:null,h={screenPoint:n,results:c,ground:{mapPoint:U(e,d),distance:m(d)?d.distanceInRenderSpace:0,layer:y}};return u.SCENEVIEW_HITTEST_RETURN_INTERSECTOR&&(h.intersector=o),h}function w(e,n,t,r){const s=t?x(e,t):r,l=!(!s.graphics?.include&&!s.graphics?.exclude),o=!(!s.mediaElements?.include&&!s.mediaElements?.exclude),c=i(n);s.enableDraped=s.include&&!s.include.has(y)||s.exclude?.has(y);const a=e.sceneIntersectionHelper,u=new p(e.state.viewingMode);if(u.options.selectionMode=!0,u.options.store=l||o?2:0,u.options.excludeLabels=t?.excludeLabels??!1,a.intersectIntersectorScreen(c,u,s),l||o){for(const n of u.results.all){const i=f(n,e);if(null==i)return U(e,n);if(l&&("graphic"!==i.type||E(s.graphics,i.graphic)))return U(e,n);if(o&&("media"!==i.type||S(s.mediaElements,i.element)))return U(e,n)}return null}return U(e,u.results.min)}async function b(e,n,i){const t=new Array;let r,s=null;const l={defer(e){r=e()}};for(let o=0;o<n.length;o++){const c=n[o],u=g(c,e);if(null!=u&&(u===e.map.ground||"type"in u&&a(u.type)))break;const d=f(c,e,l)??await r;if(r=null,null==d)continue;if("graphic"===d.type){if(null==s&&o!==n.length-1&&(s=new Set),null!=s){const e=j(d.graphic);if(s.has(e))continue;s.add(e)}if(!E(i,d.graphic))continue}const p=U(e,c),m=c.distanceInRenderSpace;if("media"===d.type){const e=d.element.toSource(p);t.push({...d,mapPoint:p,distance:m,sourcePoint:e})}else t.push({...d,mapPoint:p,distance:m})}return t}function U(e,n,i){return n.getIntersectionPoint(C)?(i=V(e,C,i),2===n.intersector&&e.basemapTerrain&&(i.z=d(e.basemapTerrain,i)??0),i):null}function j(e){const n=e.getObjectId()??e.attributes?.[c];return e.origin&&null!=n?`o-${e.origin.id}-${n}`:`u-${e.uid}`}function E(e,n){return S(e,j(n))}function S(e,n){return null==e||(null==e.include||e.include.has(n))&&(null==e.exclude||!e.exclude.has(n))}function V(e,n,i){let t=e.spatialReference||l.WGS84;return o(n,e.renderSpatialReference,C,t)?n=C:(t=l.WGS84,o(n,e.renderSpatialReference,C,t)&&(n=C)),i?(i.x=n[0],i.y=n[1],i.z=n[2],i.spatialReference=t):i=new s(n,t),i}function x(e,n){const i=I(e,n.include,0),t=I(e,n.exclude,1);return{include:i.layerViewUids,exclude:t.layerViewUids,graphics:{include:i.graphicUids,exclude:t.graphicUids},mediaElements:{include:i.mediaElements,exclude:t.mediaElements}}}function I(i,t,r,s=new R){if(!t)return s;if(t instanceof e)M(s,j(t)),0===r&&(null!=i.graphicsView&&t.layer===i?P(s,i.graphicsView.uid):t.layer&&T(s,i,t.layer.uid));else if("layer"in t&&"element"in t)L(s,t.element),0===r&&T(s,i,t.layer.uid);else if(n(t))for(const e of t)e===i.graphics&&null!=i.graphicsView?P(s,i.graphicsView.uid):e===i.map.ground?P(s,y):I(i,e,r,s);else"layer"in t&&v(s,i,t),"uid"in t&&T(s,i,t.uid);return s}class R{constructor(){this.layerViewUids=null,this.graphicUids=null,this.mediaElements=null}}function T(e,n,i){const t=n.allLayerViews.find(e=>e.layer.uid===i);t&&P(e,t.uid)}function P(e,n){e.layerViewUids??=new Map,e.layerViewUids.set(n,!0)}function v(e,n,i){const t=n.allLayerViews.find(e=>e.layer.uid===i.layer.uid);if(!t)return;e.layerViewUids??=new Map;const r=e.layerViewUids.get(t.uid);!0!==r&&(r?r.add(i.id):e.layerViewUids.set(t.uid,new Set([i.id])))}function M(e,n){e.graphicUids??=new Set,e.graphicUids.add(n)}function L(e,n){e.mediaElements??=new Set,e.mediaElements.add(n)}const C=r();export{V as computeMapPointFromVec3d,x as externalToInternalIntersectOptions,h as hitTest,U as intersectResultToMapPoint,w as toMap};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import t from"../../../Camera.js";import e from"../../../Graphic.js";import n from"../../../Viewpoint.js";import{result as a}from"../../../core/asyncUtils.js";import"../../../core/has.js";import{cyclicalDegrees as r}from"../../../core/Cyclical.js";import o from"../../../core/Error.js";import{throwIfAborted as i}from"../../../core/promiseUtils.js";import{fromMat4 as s,transpose as c}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{create as l}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as m}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{g as u,f,j as p,c as g,d as y,i as h,o as d}from"../../../chunks/vec32.js";import{create as w}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import x from"../../../geometry/Extent.js";import j from"../../../geometry/Geometry.js";import v from"../../../geometry/Multipoint.js";import b from"../../../geometry/Point.js";import{projectWithZConversion as R,tryProjectWithZConversion as z}from"../../../geometry/projectionUtils.js";import G from"../../../geometry/SpatialReference.js";import{computeTranslationToOriginAndRotation as B}from"../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{projectPointToVectorAsync as M}from"../../../geometry/projection/projectPointToVector.js";import{projectVectorToPoint as S}from"../../../geometry/projection/projectVectorToPoint.js";import{projectVectorToVector as Z}from"../../../geometry/projection/projectVectorToVector.js";import{create as F,center as T,toRect as P,isPoint as A,empty as E,expandWithVec3 as V,expandWithAABB as U,width as k,height as O,depth as I}from"../../../geometry/support/aaBoundingBox.js";import{create as N,isPoint as C}from"../../../geometry/support/aaBoundingRect.js";import{intersectsPoint as W}from"../../../geometry/support/frustum.js";import{getResolutionInMetersForScale as Y}from"../../../geometry/support/scaleUtils.js";import{fromRenderCamera as q,toRenderCamera as D}from"../webgl.js";import{cameraOnContentAlongViewDirection as X}from"../camera/intersectionUtils.js";import{getViewSR as _,fromExtentAsync as H,scaleToDistance as J,fromCenterDistanceAsync as K,fromExtentSync as L,distanceToScale as Q,fromCenterDistanceSync as $,fromCenterScale as tt,zoomToScale as et}from"./cameraUtils.js";import{getElevationAtPoint as nt}from"./ElevationProvider.js";import{directionToHeadingTilt as at}from"./viewingModeUtils.js";const rt=.66;function ot(t){return 360-r.normalize(t)}function it(t){return r.normalize(360-t)}function st(t,e,n){const a=e.camera;if(null!=a)return lt(a,_(t));const{targetGeometry:r}=e;if(null==r)return null;const{camera:o,mode:i}=ut(t,e.rotation,n);if("point"===r.type)return ft(t,e,r,o,i);const s=r.extent;return null==s?null:L(t,s,o.heading,o.tilt,i)}async function ct(t,e,n,a){const r=e.camera;if(null!=r)return mt(r,_(t),a);const{targetGeometry:o}=e;if(null==o)throw new Error("Viewpoint has no targetGeometry!");const{camera:i,mode:s}=ut(t,e.rotation,n);if("point"===o.type)return pt(t,e,o,i,s,a);const c=o.extent;if(null==c)throw new Error("Target geometry has no extent!");return H(t,c,i.heading,i.tilt,s,a)}function lt(t,e){const n=t.position;let a;try{a=z(n,e)}catch(o){return null}if(!a)return null;const r=t.clone();return r.position=a.clone(),r}async function mt(t,e,n){const a=t.position,r=await R(a,e,{signal:n});i(n);const o=t.clone();return o.position=r.clone(),o}function ut(t,e,n){const a=q(t,t.state.camera);let r=1;return null!=e&&(a.heading=ot(e),r=0),null!=n&&(a.tilt=n),{camera:a,mode:r}}function ft(t,e,n,a,r){const o=t.spatialReference;let i;try{i=z(n.clone(),o)}catch(c){return null}if(!i)return null;const s=null!=e.scale?J(t,e.scale):t.state.camera.distance;return $(t,i,s,a,r)}async function pt(t,e,n,a,r,o){const s=t.spatialReference,c=await R(n.clone(),s,{signal:o});i(o);const l=null!=e.scale?J(t,e.scale):t.state.camera.distance;return K(t,c,l,a,r,o)}function gt(t,e,a=null){return null==a&&(a=new n),xt(t,null,e.clone(),a)}async function yt(e,a,r){const i=Pt(e,a);if(!i)throw new o("viewpointutils-create:no-target","Missing target for creating viewpoint");const s=new t({fov:e.camera.fov}),c=new n({camera:s});if(i.target instanceof n){return At(await Rt(e,i.target,i,r,c))}if(i.target instanceof t)return At(await zt(e,i.target,r,c));const l=null!=i.scale||null!=i.zoom;if(i.target instanceof x){const t=i.target.xmin===i.target.xmax||i.target.ymin===i.target.ymax;return At(l||t?await Bt(e,i,i.target.center,s,r,c):await Zt(e,i,i.target,s,r,c))}const m=new Vt,u=l?dt(e,i):void 0;if(await bt(e,i.target,u,m,r),isFinite(m.boundingBox[0])){let t;if(T(m.boundingBox,Ut),Dt.x=Ut[0],Dt.y=Ut[1],Dt.z=Ut[2],Dt.spatialReference=e.spatialReference,isFinite(Dt.z)&&m.hasZ?t=A(m.boundingBox):(Dt.z=void 0,t=C(P(m.boundingBox,Nt))),l||t)return At(await Bt(e,i,Dt,s,r,c));const n=Et(e,m.screenSpaceObjects);return At(await Tt(e,i,Dt,m.boundingBox,n,s,r,c))}return i.position?At(await Mt(e,i,s,c,r)):At(await St(e,i,s,r,c))}function ht(t,e){return null==e.scale&&null!=e.zoom?et(t,e.zoom):e.scale}function dt(t,e){const n=ht(t,e);return n?Y(n):void 0}function wt(t,e){let n=!1;return null!=e.heading?(t.heading=e.heading,n=!0):null!=e.rotation&&(t.heading=ot(e.rotation),n=!0),null!=e.tilt&&(t.tilt=e.tilt,n=!0),null!=e.fov&&(t.fov=e.fov),n}function xt(t,e,n,a){const r=t.spatialReference||G.WGS84;if(e??=D(t,n),null==e)return a;const o=new b({spatialReference:r});return S(e.center,t.renderSpatialReference,o)?(a.targetGeometry=o,a.scale=Q(t,e.distance),a.rotation=it(n.heading),a.camera=n,a):a}async function jt(t,e,n,a){const r=()=>new o("viewpointutils:invalid-geometry","The target is missing a valid geometry");if(!e)throw r();"mesh"===e.type&&(e=e.extent);const i=t.basemapTerrain.spatialReference;if(!e.hasZ&&t.basemapTerrain){let n;switch(e.type){case"point":n=e;break;case"multipoint":case"polyline":n=e.extent?.center;break;case"extent":n=e.center;break;case"polygon":n=e.centroid}null!=n&&i&&t.elevationProvider?(n=await R(n,i,{signal:a}),Ut[2]=nt(t.elevationProvider,n)??0):Ut[2]=0}const s=Xt[e.type],c=new Array;if(s(e,e.hasZ?t=>{c.push([t[0],t[1],t[2]])}:t=>{c.push([t[0],t[1]])},Ut),0===c.length)throw r();const l=e.spatialReference,m=t.spatialReference,u=await R(new v({spatialReference:l,hasZ:e.hasZ,hasM:!1,points:c}),m,{signal:a});if(e.hasZ&&(n.hasZ=!0),e.hasZ)for(const[o,f,p]of u.points)Ut[0]=o,Ut[1]=f,Ut[2]=p,V(n.boundingBox,Ut);else for(const[o,f]of u.points)Ut[0]=o,Ut[1]=f,V(n.boundingBox,Ut)}async function vt(t,e,n,r,o){const i=await a(t.whenViewForGraphic(e));if(!1===i.ok||null==i.value||!("whenGraphicBounds"in i.value))return void await jt(t,e.geometry,r,o);const s=i.value,c=await a(s.whenGraphicBounds(e,{minDemResolution:n}));if(!1===c.ok||!c.value)return void await jt(t,e.geometry,r,o);const{screenSpaceObjects:l,boundingBox:m}=c.value;U(r.boundingBox,m),l&&l.forEach(t=>{r.screenSpaceObjects.push(t)}),isFinite(m[2])&&(r.hasZ=!0)}async function bt(t,n,a,r,o){if(Array.isArray(n)&&2===n.length){const e=n[0],a=n[1];if("number"==typeof e&&"number"==typeof a)return Dt.x=e,Dt.y=a,Dt.z=void 0,Dt.spatialReference=t.spatialReference?.isGeographic?t.spatialReference:G.WGS84,void await jt(t,Dt,r,o)}n&&"map"in n&&"function"==typeof n.map?await Promise.allSettled(n.map(e=>bt(t,e,a,r,o))):n instanceof j?await jt(t,n,r,o):n instanceof e&&await vt(t,n,a,r,o)}async function Rt(t,e,n,a,r){if(e.camera)return zt(t,e.camera,a,r);r.scale=e.scale,r.rotation=e.rotation,r.targetGeometry=null!=e.targetGeometry?e.targetGeometry.clone():null,r.camera=null,null!=n.heading?r.rotation=it(n.heading):null!=n.rotation&&(r.rotation=n.rotation);const o=ht(t,n);return null!=o&&(r.scale=o),r.camera=await ct(t,r,n.tilt,a),r}async function zt(t,e,n,a){const r=t.spatialReference,o=await R(e.position,r,{signal:n}),i=e.clone();return i.position=o,xt(t,null,i,a)}async function Gt(t,e,n,a,r,o,i){const s=t.renderSpatialReference;return await M(e,Yt,s,0,{signal:i}),await M(n,Wt,s,0,{signal:i}),o.targetGeometry=new b(e),r.position=new b(n),y(Ct,Yt,Wt),at(t,Wt,Ct,a.up,r),o.scale=Q(t,p(Wt,Yt)),o.rotation=it(r.heading),o.camera=r,o}async function Bt(t,e,n,a,r,o){o.targetGeometry=n.clone();const i=X(t);if(e.position)return Gt(t,o.targetGeometry,e.position,i,a,o,r);if(e.zoomFactor){const n=i.distance/e.zoomFactor,a=u(Ut,i.viewForward,-n);i.eye=f(Ut,i.center,a),o.scale=Q(t,n)}q(t,i,a);const s=wt(a,e)?0:1;if(!e.zoomFactor){const n=ht(t,e);if(null==n){await M(o.targetGeometry,Ut,t.renderSpatialReference,0,{signal:r});const e=W(i.frustum,Ut)?p(i.eye,Ut):i.distance;o.camera=await K(t,o.targetGeometry,e,a,s),o.scale=Q(t,e)}else o.scale=n,o.camera=await tt(t,o.targetGeometry,o.scale,a,s,r)}return o}async function Mt(t,e,n,a,r){const o=X(t);g(Ct,o.viewForward),at(t,o.eye,Ct,o.up,qt);const i=t.spatialReference,{position:s}=e;if(s){const t=await R(s,i,{signal:r});n.position=t}else n.position=new b;return n.heading=null!=e.heading?e.heading:qt.heading,n.tilt=null!=e.tilt?e.tilt:qt.tilt,xt(t,null,n,a)}async function St(t,e,n,a,r){if(null!=e.heading||null!=e.rotation||null!=e.scale||null!=e.tilt||null!=e.zoom||null!=e.zoomFactor){const o=X(t),{spatialReference:i,renderSpatialReference:s}=t,c=new b({spatialReference:i});return S(o.center,s,c)?Bt(t,e,c,n,a,r):r}return r.scale=t.scale,r.camera=t.camera.clone(),wt(r.camera,e),r}async function Zt(t,e,n,a,r,o){o.targetGeometry=n.clone();const i=X(t);q(t,i,a);const s=wt(a,e)?0:1;return o.camera=await H(t,n,a.heading,a.tilt,s,r),o}function Ft(t,e,n,a,r){let o=0;null!=n.z?o=n.z:t.basemapTerrain&&t.elevationProvider&&(o=nt(t.elevationProvider,n)),h(Ut,n.x,n.y,o),B(t.spatialReference,Ut,kt,t.renderSpatialReference),s(Ot,kt),c(Ot,Ot),E(It);const i=[[0,1,2],[3,1,2],[0,4,2],[3,4,2],[0,1,5],[3,1,5],[0,4,5],[3,4,5]];for(let s=0;s<i.length;s++){const e=i[s];let n=a[e[2]];isFinite(n)||(n=o),h(Ut,a[e[0]],a[e[1]],n),Z(Ut,t.spatialReference,Ut,t.renderSpatialReference),V(It,d(Ut,Ut,Ot))}const l=k(It),m=O(It),u=I(It),f=1/Math.tan(e.fovX/2),p=1/Math.tan(e.fovY/2),g=.5*Math.sqrt(l*l+u*u)*Math.max(p,f)+.5*m,y=.5*m*p+.5*Math.max(l,u);return Math.max(g,y)/r}async function Tt(t,e,n,a,r,o,i,s){s.targetGeometry=n.clone();const c=X(t),l=Ft(t,c,n,a,r);q(t,c,o);const m=wt(o,e)?0:1;return s.camera=await K(t,s.targetGeometry,l,o,m,i),s.scale=Q(t,l),s}function Pt(t,e){if(!e||!t.spatialReference)return null;const n={target:void 0};return"declaredClass"in e||Array.isArray(e)?n.target=e:(Object.assign(n,e),!n.target&&"center"in e&&e.center&&(n.target=e.center)),n}function At(t){return null!=t?.camera&&(t.rotation=it(t.camera.heading)),t}function Et(t,e){const n=rt;if(!e.length)return n;let a=Number.NEGATIVE_INFINITY;for(let r=0;r<e.length;r++){const t=e[r].screenSpaceBoundingRect;a=Math.max(a,Math.abs(t[0]),Math.abs(t[1]),Math.abs(t[2]),Math.abs(t[3]))}return n-a/Math.min(t.width,t.height)*2}class Vt{constructor(){this.hasZ=!1,this.boundingBox=E(),this.screenSpaceObjects=new Array}}const Ut=w(),kt=m(),Ot=l(),It=F(),Nt=N(),Ct=w(),Wt=w(),Yt=w(),qt={heading:0,tilt:0},Dt=new b,Xt={point(t,e,n){n[0]=t.x,n[1]=t.y,null!=t.z&&(n[2]=t.z),e(n)},polygon(t,e,n){const a=t.hasZ;for(let r=0;r<t.rings.length;r++){const o=t.rings[r];for(let t=0;t<o.length;t++)n[0]=o[t][0],n[1]=o[t][1],a&&(n[2]=o[t][2]),e(n)}},polyline(t,e,n){const a=t.hasZ;for(let r=0;r<t.paths.length;r++){const o=t.paths[r];for(let t=0;t<o.length;t++)n[0]=o[t][0],n[1]=o[t][1],a&&(n[2]=o[t][2]),e(n)}},multipoint(t,e,n){const a=t.points,r=t.hasZ;for(let o=0;o<a.length;o++)n[0]=a[o][0],n[1]=a[o][1],r&&(n[2]=a[o][2]),e(n)},extent(t,e,n){null!=t.zmin&&null!=t.zmax?(e(h(n,t.xmin,t.ymin,t.zmin)),e(h(n,t.xmax,t.ymin,t.zmin)),e(h(n,t.xmin,t.ymax,t.zmin)),e(h(n,t.xmax,t.ymax,t.zmin)),e(h(n,t.xmin,t.ymin,t.zmax)),e(h(n,t.xmax,t.ymin,t.zmax)),e(h(n,t.xmin,t.ymax,t.zmax)),e(h(n,t.xmax,t.ymax,t.zmax))):(e(h(n,t.xmin,t.ymin,n[2])),e(h(n,t.xmax,t.ymin,n[2])),e(h(n,t.xmin,t.ymax,n[2])),e(h(n,t.xmax,t.ymax,n[2])))}};export{yt as create,gt as fromCamera,ct as toCameraAsync,st as toCameraSync};
5
+ import t from"../../../Camera.js";import e from"../../../Graphic.js";import n from"../../../Viewpoint.js";import{result as r}from"../../../core/asyncUtils.js";import"../../../core/has.js";import{cyclicalDegrees as a}from"../../../core/Cyclical.js";import o from"../../../core/Error.js";import{throwIfAborted as i}from"../../../core/promiseUtils.js";import{fromMat4 as s,transpose as c}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{create as l}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as m}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{g as u,f,j as p,c as g,d as y,i as h,o as d}from"../../../chunks/vec32.js";import{create as w}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import x from"../../../geometry/Extent.js";import j from"../../../geometry/Geometry.js";import v from"../../../geometry/Multipoint.js";import b from"../../../geometry/Point.js";import{projectWithZConversion as R,tryProjectWithZConversion as z}from"../../../geometry/projectionUtils.js";import G from"../../../geometry/SpatialReference.js";import{computeTranslationToOriginAndRotation as B}from"../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{projectPointToVectorAsync as M}from"../../../geometry/projection/projectPointToVector.js";import{projectVectorToPoint as S}from"../../../geometry/projection/projectVectorToPoint.js";import{projectVectorToVector as Z}from"../../../geometry/projection/projectVectorToVector.js";import{create as F,center as T,toRect as P,isPoint as A,empty as E,expandWithVec3 as V,expandWithAABB as k,width as O,height as U,depth as N}from"../../../geometry/support/aaBoundingBox.js";import{create as I,isPoint as C}from"../../../geometry/support/aaBoundingRect.js";import{polygonCentroidPoint as W}from"../../../geometry/support/centroid.js";import{intersectsPoint as Y}from"../../../geometry/support/frustum.js";import{getResolutionInMetersForScale as q}from"../../../geometry/support/scaleUtils.js";import{fromRenderCamera as D,toRenderCamera as J}from"../webgl.js";import{cameraOnContentAlongViewDirection as X}from"../camera/intersectionUtils.js";import{getViewSR as _,fromExtentAsync as H,scaleToDistance as K,fromCenterDistanceAsync as L,fromExtentSync as Q,distanceToScale as $,fromCenterDistanceSync as tt,fromCenterScale as et,zoomToScale as nt}from"./cameraUtils.js";import{getElevationAtPoint as rt}from"./ElevationProvider.js";import{directionToHeadingTilt as at}from"./viewingModeUtils.js";const ot=.66;function it(t){return 360-a.normalize(t)}function st(t){return a.normalize(360-t)}function ct(t,e,n){const r=e.camera;if(null!=r)return mt(r,_(t));const{targetGeometry:a}=e;if(null==a)return null;const{camera:o,mode:i}=ft(t,e.rotation,n);if("point"===a.type)return pt(t,e,a,o,i);const s=a.extent;return null==s?null:Q(t,s,o.heading,o.tilt,i)}async function lt(t,e,n,r){const a=e.camera;if(null!=a)return ut(a,_(t),r);const{targetGeometry:o}=e;if(null==o)throw new Error("Viewpoint has no targetGeometry!");const{camera:i,mode:s}=ft(t,e.rotation,n);if("point"===o.type)return gt(t,e,o,i,s,r);const c=o.extent;if(null==c)throw new Error("Target geometry has no extent!");return H(t,c,i.heading,i.tilt,s,r)}function mt(t,e){const n=t.position;let r;try{r=z(n,e)}catch(o){return null}if(!r)return null;const a=t.clone();return a.position=r.clone(),a}async function ut(t,e,n){const r=t.position,a=await R(r,e,{signal:n});i(n);const o=t.clone();return o.position=a.clone(),o}function ft(t,e,n){const r=D(t,t.state.camera);let a=1;return null!=e&&(r.heading=it(e),a=0),null!=n&&(r.tilt=n),{camera:r,mode:a}}function pt(t,e,n,r,a){const o=t.spatialReference;let i;try{i=z(n.clone(),o)}catch(c){return null}if(!i)return null;const s=null!=e.scale?K(t,e.scale):t.state.camera.distance;return tt(t,i,s,r,a)}async function gt(t,e,n,r,a,o){const s=t.spatialReference,c=await R(n.clone(),s,{signal:o});i(o);const l=null!=e.scale?K(t,e.scale):t.state.camera.distance;return L(t,c,l,r,a,o)}function yt(t,e,r=null){return null==r&&(r=new n),jt(t,null,e.clone(),r)}async function ht(e,r,a){const i=At(e,r);if(!i)throw new o("viewpointutils-create:no-target","Missing target for creating viewpoint");const s=new t({fov:e.camera.fov}),c=new n({camera:s});if(i.target instanceof n){return Et(await zt(e,i.target,i,a,c))}if(i.target instanceof t)return Et(await Gt(e,i.target,a,c));const l=null!=i.scale||null!=i.zoom;if(i.target instanceof x){const t=i.target.xmin===i.target.xmax||i.target.ymin===i.target.ymax;return Et(l||t?await Mt(e,i,i.target.center,s,a,c):await Ft(e,i,i.target,s,a,c))}const m=new kt,u=l?wt(e,i):void 0;if(await Rt(e,i.target,u,m,a),isFinite(m.boundingBox[0])){let t;if(T(m.boundingBox,Ot),Jt.x=Ot[0],Jt.y=Ot[1],Jt.z=Ot[2],Jt.spatialReference=e.spatialReference,isFinite(Jt.z)&&m.hasZ?t=A(m.boundingBox):(Jt.z=void 0,t=C(P(m.boundingBox,Ct))),l||t)return Et(await Mt(e,i,Jt,s,a,c));const n=Vt(e,m.screenSpaceObjects);return Et(await Pt(e,i,Jt,m.boundingBox,n,s,a,c))}return i.position?Et(await St(e,i,s,c,a)):Et(await Zt(e,i,s,a,c))}function dt(t,e){return null==e.scale&&null!=e.zoom?nt(t,e.zoom):e.scale}function wt(t,e){const n=dt(t,e);return n?q(n):void 0}function xt(t,e){let n=!1;return null!=e.heading?(t.heading=e.heading,n=!0):null!=e.rotation&&(t.heading=it(e.rotation),n=!0),null!=e.tilt&&(t.tilt=e.tilt,n=!0),null!=e.fov&&(t.fov=e.fov),n}function jt(t,e,n,r){const a=t.spatialReference||G.WGS84;if(e??=J(t,n),null==e)return r;const o=new b({spatialReference:a});return S(e.center,t.renderSpatialReference,o)?(r.targetGeometry=o,r.scale=$(t,e.distance),r.rotation=st(n.heading),r.camera=n,r):r}async function vt(t,e,n,r){const a=()=>new o("viewpointutils:invalid-geometry","The target is missing a valid geometry");if(!e)throw a();"mesh"===e.type&&(e=e.extent);const i=t.basemapTerrain.spatialReference;if(!e.hasZ&&t.basemapTerrain){let n;switch(e.type){case"point":n=e;break;case"multipoint":case"polyline":n=e.extent?.center;break;case"extent":n=e.center;break;case"polygon":{const t=W(e);n=t?b.fromJSON(t):null;break}}null!=n&&i&&t.elevationProvider?(n=await R(n,i,{signal:r}),Ot[2]=rt(t.elevationProvider,n)??0):Ot[2]=0}const s=Xt[e.type],c=new Array;if(s(e,e.hasZ?t=>{c.push([t[0],t[1],t[2]])}:t=>{c.push([t[0],t[1]])},Ot),0===c.length)throw a();const l=e.spatialReference,m=t.spatialReference,u=await R(new v({spatialReference:l,hasZ:e.hasZ,hasM:!1,points:c}),m,{signal:r});if(e.hasZ&&(n.hasZ=!0),e.hasZ)for(const[o,f,p]of u.points)Ot[0]=o,Ot[1]=f,Ot[2]=p,V(n.boundingBox,Ot);else for(const[o,f]of u.points)Ot[0]=o,Ot[1]=f,V(n.boundingBox,Ot)}async function bt(t,e,n,a,o){const i=await r(t.whenViewForGraphic(e));if(!1===i.ok||null==i.value||!("whenGraphicBounds"in i.value))return void await vt(t,e.geometry,a,o);const s=i.value,c=await r(s.whenGraphicBounds(e,{minDemResolution:n}));if(!1===c.ok||!c.value)return void await vt(t,e.geometry,a,o);const{screenSpaceObjects:l,boundingBox:m}=c.value;k(a.boundingBox,m),l&&l.forEach(t=>{a.screenSpaceObjects.push(t)}),isFinite(m[2])&&(a.hasZ=!0)}async function Rt(t,n,r,a,o){if(Array.isArray(n)&&2===n.length){const e=n[0],r=n[1];if("number"==typeof e&&"number"==typeof r)return Jt.x=e,Jt.y=r,Jt.z=void 0,Jt.spatialReference=t.spatialReference?.isGeographic?t.spatialReference:G.WGS84,void await vt(t,Jt,a,o)}n&&"map"in n&&"function"==typeof n.map?await Promise.allSettled(n.map(e=>Rt(t,e,r,a,o))):n instanceof j?await vt(t,n,a,o):n instanceof e&&await bt(t,n,r,a,o)}async function zt(t,e,n,r,a){if(e.camera)return Gt(t,e.camera,r,a);a.scale=e.scale,a.rotation=e.rotation,a.targetGeometry=null!=e.targetGeometry?e.targetGeometry.clone():null,a.camera=null,null!=n.heading?a.rotation=st(n.heading):null!=n.rotation&&(a.rotation=n.rotation);const o=dt(t,n);return null!=o&&(a.scale=o),a.camera=await lt(t,a,n.tilt,r),a}async function Gt(t,e,n,r){const a=t.spatialReference,o=await R(e.position,a,{signal:n}),i=e.clone();return i.position=o,jt(t,null,i,r)}async function Bt(t,e,n,r,a,o,i){const s=t.renderSpatialReference;return await M(e,qt,s,0,{signal:i}),await M(n,Yt,s,0,{signal:i}),o.targetGeometry=new b(e),a.position=new b(n),y(Wt,qt,Yt),at(t,Yt,Wt,r.up,a),o.scale=$(t,p(Yt,qt)),o.rotation=st(a.heading),o.camera=a,o}async function Mt(t,e,n,r,a,o){o.targetGeometry=n.clone();const i=X(t);if(e.position)return Bt(t,o.targetGeometry,e.position,i,r,o,a);if(e.zoomFactor){const n=i.distance/e.zoomFactor,r=u(Ot,i.viewForward,-n);i.eye=f(Ot,i.center,r),o.scale=$(t,n)}D(t,i,r);const s=xt(r,e)?0:1;if(!e.zoomFactor){const n=dt(t,e);if(null==n){await M(o.targetGeometry,Ot,t.renderSpatialReference,0,{signal:a});const e=Y(i.frustum,Ot)?p(i.eye,Ot):i.distance;o.camera=await L(t,o.targetGeometry,e,r,s),o.scale=$(t,e)}else o.scale=n,o.camera=await et(t,o.targetGeometry,o.scale,r,s,a)}return o}async function St(t,e,n,r,a){const o=X(t);g(Wt,o.viewForward),at(t,o.eye,Wt,o.up,Dt);const i=t.spatialReference,{position:s}=e;if(s){const t=await R(s,i,{signal:a});n.position=t}else n.position=new b;return n.heading=null!=e.heading?e.heading:Dt.heading,n.tilt=null!=e.tilt?e.tilt:Dt.tilt,jt(t,null,n,r)}async function Zt(t,e,n,r,a){if(null!=e.heading||null!=e.rotation||null!=e.scale||null!=e.tilt||null!=e.zoom||null!=e.zoomFactor){const o=X(t),{spatialReference:i,renderSpatialReference:s}=t,c=new b({spatialReference:i});return S(o.center,s,c)?Mt(t,e,c,n,r,a):a}return a.scale=t.scale,a.camera=t.camera.clone(),xt(a.camera,e),a}async function Ft(t,e,n,r,a,o){o.targetGeometry=n.clone();const i=X(t);D(t,i,r);const s=xt(r,e)?0:1;return o.camera=await H(t,n,r.heading,r.tilt,s,a),o}function Tt(t,e,n,r,a){let o=0;null!=n.z?o=n.z:t.basemapTerrain&&t.elevationProvider&&(o=rt(t.elevationProvider,n)),h(Ot,n.x,n.y,o),B(t.spatialReference,Ot,Ut,t.renderSpatialReference),s(Nt,Ut),c(Nt,Nt),E(It);const i=[[0,1,2],[3,1,2],[0,4,2],[3,4,2],[0,1,5],[3,1,5],[0,4,5],[3,4,5]];for(let s=0;s<i.length;s++){const e=i[s];let n=r[e[2]];isFinite(n)||(n=o),h(Ot,r[e[0]],r[e[1]],n),Z(Ot,t.spatialReference,Ot,t.renderSpatialReference),V(It,d(Ot,Ot,Nt))}const l=O(It),m=U(It),u=N(It),f=1/Math.tan(e.fovX/2),p=1/Math.tan(e.fovY/2),g=.5*Math.sqrt(l*l+u*u)*Math.max(p,f)+.5*m,y=.5*m*p+.5*Math.max(l,u);return Math.max(g,y)/a}async function Pt(t,e,n,r,a,o,i,s){s.targetGeometry=n.clone();const c=X(t),l=Tt(t,c,n,r,a);D(t,c,o);const m=xt(o,e)?0:1;return s.camera=await L(t,s.targetGeometry,l,o,m,i),s.scale=$(t,l),s}function At(t,e){if(!e||!t.spatialReference)return null;const n={target:void 0};return"declaredClass"in e||Array.isArray(e)?n.target=e:(Object.assign(n,e),!n.target&&"center"in e&&e.center&&(n.target=e.center)),n}function Et(t){return null!=t?.camera&&(t.rotation=st(t.camera.heading)),t}function Vt(t,e){const n=ot;if(!e.length)return n;let r=Number.NEGATIVE_INFINITY;for(let a=0;a<e.length;a++){const t=e[a].screenSpaceBoundingRect;r=Math.max(r,Math.abs(t[0]),Math.abs(t[1]),Math.abs(t[2]),Math.abs(t[3]))}return n-r/Math.min(t.width,t.height)*2}class kt{constructor(){this.hasZ=!1,this.boundingBox=E(),this.screenSpaceObjects=new Array}}const Ot=w(),Ut=m(),Nt=l(),It=F(),Ct=I(),Wt=w(),Yt=w(),qt=w(),Dt={heading:0,tilt:0},Jt=new b,Xt={point(t,e,n){n[0]=t.x,n[1]=t.y,null!=t.z&&(n[2]=t.z),e(n)},polygon(t,e,n){const r=t.hasZ;for(let a=0;a<t.rings.length;a++){const o=t.rings[a];for(let t=0;t<o.length;t++)n[0]=o[t][0],n[1]=o[t][1],r&&(n[2]=o[t][2]),e(n)}},polyline(t,e,n){const r=t.hasZ;for(let a=0;a<t.paths.length;a++){const o=t.paths[a];for(let t=0;t<o.length;t++)n[0]=o[t][0],n[1]=o[t][1],r&&(n[2]=o[t][2]),e(n)}},multipoint(t,e,n){const r=t.points,a=t.hasZ;for(let o=0;o<r.length;o++)n[0]=r[o][0],n[1]=r[o][1],a&&(n[2]=r[o][2]),e(n)},extent(t,e,n){null!=t.zmin&&null!=t.zmax?(e(h(n,t.xmin,t.ymin,t.zmin)),e(h(n,t.xmax,t.ymin,t.zmin)),e(h(n,t.xmin,t.ymax,t.zmin)),e(h(n,t.xmax,t.ymax,t.zmin)),e(h(n,t.xmin,t.ymin,t.zmax)),e(h(n,t.xmax,t.ymin,t.zmax)),e(h(n,t.xmin,t.ymax,t.zmax)),e(h(n,t.xmax,t.ymax,t.zmax))):(e(h(n,t.xmin,t.ymin,n[2])),e(h(n,t.xmax,t.ymin,n[2])),e(h(n,t.xmin,t.ymax,n[2])),e(h(n,t.xmax,t.ymax,n[2])))}};export{ht as create,yt as fromCamera,lt as toCameraAsync,ct as toCameraSync};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{isValidIntersectorResult as t}from"../webgl-engine/lib/IntersectorResult.js";import{Graphic3DTarget as e}from"../webgl-engine/lib/IntersectorTarget.js";function r(e){return t(e)&&2===e.intersector&&!!e.target}class n extends e{constructor(t,e,r){super(t,e),this.triangleNr=r}}function o(e){return t(e)&&3===e.intersector&&!!e.target}export{n as OverlayTarget,o as isOverlayIntersectorResult,r as isTerrainIntersectorResult};
5
+ import{isValidIntersectorResult as e}from"../webgl-engine/lib/IntersectorResult.js";import{Graphic3DTarget as t}from"../webgl-engine/lib/IntersectorTarget.js";function r(t){return e(t)&&2===t.intersector&&!!t.target}function n(t,r){if(!e(r)||!r.target||!("layerViewUid"in r.target))return!1;const n=r.target.layerViewUid,i=t.allLayerViews.find(e=>e.uid===n);switch(i?.layer.type){case"integrated-mesh":case"integrated-mesh-3dtiles":return!0}return!1}class i extends t{constructor(e,t,r){super(e,t),this.triangleNr=r}}function s(t){return e(t)&&3===t.intersector&&!!t.target}export{i as OverlayTarget,n as isIntegratedMeshIntersectorResult,s as isOverlayIntersectorResult,r as isTerrainIntersectorResult};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../core/Error.js";import{ManagedColorAttachment as t}from"../../webgl/ManagedColorAttachment.js";import{ManagedDepthTexture as r}from"../../webgl/ManagedDepthTexture.js";import a from"../../webgl/ManagedFBO.js";import{isDepthFormat as c,DepthTextureFormats as h,ColorFormats as i}from"./FBOCacheFormats.js";import{FBOPool as n}from"./FBOPool.js";import{DepthStencilAttachment as o,ColorAttachment0 as s}from"../../../webgl/enums.js";import{FramebufferObject as l}from"../../../webgl/FramebufferObject.js";import{Texture as u}from"../../../webgl/Texture.js";class m{constructor(e){this.rctx=e,this._interactive=!1,this._acquired=new Set,this._cache=new n(e.newCache,"FBOCache"),this._depthCache=new n(e.newCache,"DepthAttachmentCache"),this._colorCache=new n(e.newCache,"ColorAttachmentCache")}destroy(){this._cache.destroy(),this._depthCache.destroy(),this._colorCache.destroy()}clean(){this._cache.clean(),this._colorCache.clean(),this._depthCache.clean()}frameStart(){this._cache.frame(),this._colorCache.frame(),this._depthCache.frame(),this.debugCallback?.()}frameEnd(){const{debugCallback:e}=this;e&&this._acquired.forEach(t=>e(t.name,t.fbo))}get usedMemory(){return Array.from(this._acquired.values()).reduce((e,t)=>e+t.cachedMemory,this._cache.usedMemory+this._colorCache.usedMemory+this._depthCache.usedMemory)}set interactive(e){this._cache.interactive=this._colorCache.interactive=this._depthCache.interactive=e,this._interactive=e}get interactive(){return this._interactive}acquire(t,r,h,i=5){const n=_(i,t,r);let u=this._cache.pop(n);const{rctx:m}=this;if(u){u.retain(),u.setName(h);const t=u.getAttachment(o);t&&(t.name=f(h));const r=u.getAttachment(s);r&&(r.name=d(h,0));const{fbo:a}=u;if(!a)throw new e("renderer","attempt to use a none existing framebuffer");m.temporaryBindFramebufferObject(a,()=>{m.setDrawBuffers([s]),m.unbindTexture(a.colorTexture)})}else{const e=new l(m),p=(e,a,c)=>{a??=5;const h=this._acquireColor(a,t,r,c??d(u.name,e-s));return this.rctx.unbindTexture(h.attachment),u.attachColor(h,e),h.release(),u},_=e=>{e??=12;const a=this.acquireDepth(e,t,r,f(u.name));return u.attachDepth(a),a.release(),u},C=()=>{if(!u)return;this.debugCallback?.(u.name,u.fbo),this._acquired.delete(u);const e=c(i);e&&null!=u.getAttachment(o)||!e&&null!=u.getAttachment(s)?(e?(u.fbo?.invalidateAttachments([o]),u.detachAllColors()):(u.fbo?.invalidateAttachments([s]),u.detachAllButColor0()),this._cache.put(u)):u.dispose()};u=new a(n,h,e,p,_,C),c(i)?u.acquireDepth(i):u.acquireColor(s,i,h)}return this._trackHandle(u)}acquireDepth(e,t,a,c){const i=_(e,t,a);let n=this._depthCache.pop(i);if(n)n.retain(),n.attachment.setShadowFiltering(!1);else{const c=new u(this.rctx,{...h[e],width:t,height:a});n=new r(i,c,()=>this._depthCache.put(n))}return n.name=c,n}_acquireColor(e,r,a,c){const h=_(e,r,a);let n=this._colorCache.pop(h);if(n)n.retain();else{const c=new u(this.rctx,{...i[e],width:r,height:a});n=new t(h,c,()=>this._colorCache.put(n))}return n.name=c,n}_trackHandle(e){return this._acquired.add(e),e}}function d(e,t=0){return`${e}.color${t}`}function f(e){return`${e}.depth`}const p=new a("default","default",null,()=>p,()=>p,()=>{});function _(e,t,r){return`${t}x${r}:${e}`}p.release=()=>!1;export{m as FBOCache,p as defaultWebGLFBO};
5
+ import e from"../../../../core/Error.js";import{ManagedColorAttachment as t}from"../../webgl/ManagedColorAttachment.js";import{ManagedDepthTexture as a}from"../../webgl/ManagedDepthTexture.js";import r from"../../webgl/ManagedFBO.js";import{isDepthFormat as c,formatString as h,DepthTextureFormats as s,ColorFormats as i}from"./FBOCacheFormats.js";import{FBOPool as n}from"./FBOPool.js";import{DepthStencilAttachment as o,ColorAttachment0 as l}from"../../../webgl/enums.js";import{FramebufferObject as u}from"../../../webgl/FramebufferObject.js";import{Texture as m}from"../../../webgl/Texture.js";class d{constructor(e){this.rctx=e,this._interactive=!1,this._usage=new Map,this._acquired=new Set,this._cache=new n(e.newCache,"FBOCache"),this._depthCache=new n(e.newCache,"DepthAttachmentCache"),this._colorCache=new n(e.newCache,"ColorAttachmentCache")}destroy(){this._cache.destroy(),this._depthCache.destroy(),this._colorCache.destroy()}clean(){this._cache.clean(),this._colorCache.clean(),this._depthCache.clean()}frameStart(){this._cache.frame(),this._colorCache.frame(),this._depthCache.frame(),this.debugCallback?.(),this._usage.clear()}frameEnd(){const{debugCallback:e}=this;e&&this._acquired.forEach(t=>e(t.name,t.fbo,this._usage))}get usedMemory(){return Array.from(this._acquired.values()).reduce((e,t)=>e+t.cachedMemory,this._cache.usedMemory+this._colorCache.usedMemory+this._depthCache.usedMemory)}set interactive(e){this._cache.interactive=this._colorCache.interactive=this._depthCache.interactive=e,this._interactive=e}get interactive(){return this._interactive}acquire(t,a,s,i=5){const n=C(i,t,a);let m=this._cache.pop(n);const{rctx:d}=this;if(m){m.retain(),m.setName(s);const t=m.getAttachment(o);t&&(t.name=f(s));const a=m.getAttachment(l);a&&(a.name=_(s,0));const{fbo:r}=m;if(!r)throw new e("renderer","attempt to use a none existing framebuffer");d.temporaryBindFramebufferObject(r,()=>{d.setDrawBuffers([l]),d.unbindTexture(r.colorTexture)})}else{const e=new u(d),h=(e,r,c)=>{r??=5;const h=this._acquireColor(r,t,a,c??_(m.name,e-l));return this.rctx.unbindTexture(h.attachment),m.attachColor(h,e),h.release(),m},p=e=>{e??=12;const r=this.acquireDepth(e,t,a,f(m.name));return m.attachDepth(r),r.release(),m},C=()=>{if(!m)return;this.debugCallback?.(m.name,m.fbo),this._acquired.delete(m);const e=c(i);e&&null!=m.getAttachment(o)||!e&&null!=m.getAttachment(l)?(e?(m.fbo?.invalidateAttachments([o]),m.detachAllColors()):(m.fbo?.invalidateAttachments([l]),m.detachAllButColor0()),this._cache.put(m)):m.dispose()};m=new r(n,s,e,h,p,C),c(i)?m.acquireDepth(i):m.acquireColor(l,i,s)}return this._trackUsage(m,"fbo "+h(i),t,a),this._trackHandle(m)}acquireDepth(e,t,r,c){const i=C(e,t,r);let n=this._depthCache.pop(i);if(n)n.retain(),n.attachment.setShadowFiltering(!1);else{const c=new m(this.rctx,{...s[e],width:t,height:r});n=new a(i,c,()=>this._depthCache.put(n))}return n.name=c,this._trackUsage(n,"depth "+h(e),t,r),n}_acquireColor(e,a,r,c){const s=C(e,a,r);let n=this._colorCache.pop(s);if(n)n.retain();else{const c=new m(this.rctx,{...i[e],width:a,height:r});n=new t(s,c,()=>this._colorCache.put(n))}return n.name=c,this._trackUsage(n,"color "+h(e),a,r),n}_trackHandle(e){return this._acquired.add(e),e}_trackUsage(e,t,a,r){this.debugCallback&&(this._usage.has(e)?this._usage.get(e)[2].push(e.name):this._usage.set(e,[t,`${a}x${r}`,[e.name]]))}}function _(e,t=0){return`${e}.color${t}`}function f(e){return`${e}.depth`}const p=new r("default","default",null,()=>p,()=>p,()=>{});function C(e,t,a){return`${t}x${a}:${e}`}p.release=()=>!1;export{d as FBOCache,p as defaultWebGLFBO};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{SizedPixelFormat as e,PixelType as a,SizedDepthStencilFormat as t,SizedDepthFormat as n}from"../../../webgl/enums.js";import{TextureDescriptor as o}from"../../../webgl/TextureDescriptor.js";import{isSizedDepthFormat as r}from"../../../webgl/textureUtils.js";function p(e){return e>=11}const m=new o;m.pixelFormat=6403,m.internalFormat=e.R8,m.wrapMode=33071;const i=new o;i.pixelFormat=36244,i.internalFormat=e.R8UI,i.wrapMode=33071,i.samplingMode=9728;const l=new o;l.pixelFormat=33319,l.internalFormat=e.RG8,l.wrapMode=33071;const F=new o;F.pixelFormat=33320,F.internalFormat=e.RG8UI,F.wrapMode=33071,F.samplingMode=9728;const T=new o;T.internalFormat=e.RGBA4,T.dataType=a.UNSIGNED_SHORT_4_4_4_4,T.wrapMode=33071;const s=new o;s.wrapMode=33071;const _=new o;_.wrapMode=33071,_.samplingMode=9987,_.hasMipmap=!0,_.maxAnisotropy=8;const w=new o;w.pixelFormat=6403,w.dataType=a.HALF_FLOAT,w.internalFormat=e.R16F,w.samplingMode=9728;const N=new o;N.dataType=a.HALF_FLOAT,N.internalFormat=e.RGBA16F,N.wrapMode=33071;const d=new o;d.pixelFormat=6403,d.dataType=a.FLOAT,d.internalFormat=e.R32F,d.samplingMode=9728;const M=new o;M.pixelFormat=33319,M.dataType=a.FLOAT,M.internalFormat=e.RG32F,M.samplingMode=9728;const E={0:m,1:i,2:l,3:F,4:T,5:s,6:_,7:w,8:N,9:d,10:M,11:null},c={[n.DEPTH_COMPONENT16]:a.UNSIGNED_SHORT,[n.DEPTH_COMPONENT24]:a.UNSIGNED_INT,[n.DEPTH_COMPONENT32F]:a.FLOAT,[t.DEPTH24_STENCIL8]:a.UNSIGNED_INT_24_8,[t.DEPTH32F_STENCIL8]:a.FLOAT_32_UNSIGNED_INT_24_8_REV},O={12:I(t.DEPTH24_STENCIL8),11:I(n.DEPTH_COMPONENT16)};function I(e){const a=new o;return a.pixelFormat=r(e)?6402:34041,a.dataType=c[e],a.samplingMode=9728,a.wrapMode=33071,a.internalFormat=e,a.hasMipmap=!1,a.isImmutable=!0,a}export{E as ColorFormats,O as DepthTextureFormats,p as isDepthFormat};
5
+ import{SizedPixelFormat as e,PixelType as r,SizedDepthStencilFormat as n,SizedDepthFormat as t}from"../../../webgl/enums.js";import{TextureDescriptor as a}from"../../../webgl/TextureDescriptor.js";import{isSizedDepthFormat as o}from"../../../webgl/textureUtils.js";function s(e){switch(e){case 0:return"R8UNORM";case 1:return"R8UINT";case 2:return"RG8UNORM";case 3:return"RG8UINT";case 4:return"RGBA4UNORM";case 5:return"RGBA8UNORM";case 6:return"RGBA8UNORM_MIPMAP";case 7:return"R16FLOAT";case 8:return"RGBA16FLOAT";case 9:return"R32FLOAT";case 10:return"RG32FLOAT";case 11:return"COUNT"}}function T(e){switch(e){case 11:return"DEPTH16";case 12:return"DEPTH24_STENCIL8"}}function i(e){return p(e)?T(e):s(e)}function p(e){return e>=11}const m=new a;m.pixelFormat=6403,m.internalFormat=e.R8,m.wrapMode=33071;const F=new a;F.pixelFormat=36244,F.internalFormat=e.R8UI,F.wrapMode=33071,F.samplingMode=9728;const c=new a;c.pixelFormat=33319,c.internalFormat=e.RG8,c.wrapMode=33071;const N=new a;N.pixelFormat=33320,N.internalFormat=e.RG8UI,N.wrapMode=33071,N.samplingMode=9728;const l=new a;l.internalFormat=e.RGBA4,l.dataType=r.UNSIGNED_SHORT_4_4_4_4,l.wrapMode=33071;const M=new a;M.wrapMode=33071;const R=new a;R.wrapMode=33071,R.samplingMode=9987,R.hasMipmap=!0,R.maxAnisotropy=8;const u=new a;u.pixelFormat=6403,u.dataType=r.HALF_FLOAT,u.internalFormat=e.R16F,u.samplingMode=9728;const _=new a;_.dataType=r.HALF_FLOAT,_.internalFormat=e.RGBA16F,_.wrapMode=33071;const w=new a;w.pixelFormat=6403,w.dataType=r.FLOAT,w.internalFormat=e.R32F,w.samplingMode=9728;const O=new a;O.pixelFormat=33319,O.dataType=r.FLOAT,O.internalFormat=e.RG32F,O.samplingMode=9728;const E={0:m,1:F,2:c,3:N,4:l,5:M,6:R,7:u,8:_,9:w,10:O,11:null},d={[t.DEPTH_COMPONENT16]:r.UNSIGNED_SHORT,[t.DEPTH_COMPONENT24]:r.UNSIGNED_INT,[t.DEPTH_COMPONENT32F]:r.FLOAT,[n.DEPTH24_STENCIL8]:r.UNSIGNED_INT_24_8,[n.DEPTH32F_STENCIL8]:r.FLOAT_32_UNSIGNED_INT_24_8_REV},A={12:I(n.DEPTH24_STENCIL8),11:I(t.DEPTH_COMPONENT16)};function I(e){const r=new a;return r.pixelFormat=o(e)?6402:34041,r.dataType=d[e],r.samplingMode=9728,r.wrapMode=33071,r.internalFormat=e,r.hasMipmap=!1,r.isImmutable=!0,r}export{E as ColorFormats,A as DepthTextureFormats,i as formatString,p as isDepthFormat};
@@ -2,7 +2,7 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import{property as r}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as t}from"../../../../../core/accessorSupport/decorators/subclass.js";import{ZEROS as o}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{RenderCategory as n}from"../../../webgl.js";import i from"../../../webgl/RenderNode.js";import{glsl as c,If as s}from"../../core/shaderModules/glsl.js";import{Pos2Locations as a}from"../../lib/DefaultVertexBufferLayouts.js";import{checkWebGLError as l}from"../../../../webgl/checkWebGLError.js";import{ColorAttachment0 as u,DataType as p,SizedPixelFormat as h}from"../../../../webgl/enums.js";import{alphaCutoff as f}from"../../../../../webscene/support/AlphaCutoff.js";let d=class extends i{constructor(e){super(e),this.destroyedCB=null,this.produces=n.FINAL,this.consumes={required:[n.FINAL]},this.clearColor=o,this._focusedFBOType=0,this._program=new Map}destroy(){this._program.forEach(e=>e.dispose()),this._program.clear(),this.destroyedCB()}render(e){const r=e.find(({name:e})=>e===n.FINAL);if(!this._focusedFBO)return r;const t=this.renderingContext;t.bindFramebuffer(r.fbo),t.setClearColor(0,0,0,0),t.clear(16384);const o=this._focusedFBO.getTexture(),i=[v(o)],c=this._ensureProgram(t,!1,i);return t.useProgram(c),t.bindTexture(o,0),c.setUniform1i("colorTex0",0),c.setUniform1i("inputType",this._focusedFBOType),3===this._focusedFBOType&&c.setUniform2fv("nearFar",this.camera.nearFar),t.screen.draw(),r}getDownscaledFBO(e,r,t,o,n){0===r&&(o=e.width,n=e.height);const i=e.colorAttachments.length,s=[],a=new Array(i);for(let c=0;c<i;++c){const r=e.getColorTexture(u+c);if(r){const e=v(r);s.push(e);const{descriptor:t}=r;"float"!==e||t.hasMipmap||t.isImmutable||(r.generateMipmap(),a[c]=!0)}}const p=this.renderingContext,{depthStencilTexture:f}=e,d=this._ensureProgram(p,null!=f,s),m=this.fboCache.acquire(o,n,"fbo visualizer");p.useProgram(d),p.bindFramebuffer(m.fbo);const g=[];for(let l=0;l<i;++l){const r=u+l,t=`colorTex${c.int(l)}`;p.bindTexture(e.getColorTexture(r),l),d.setUniform1i(t,l),l>0&&m.acquireColor(r,5),g.push(r)}const x=f?.descriptor.linearFilterDepth??!1;if(f){const e=i;f.setShadowFiltering(!1),p.bindTexture(f,e),d.setUniform1i("depthTex",e);const r=u+e;r>u&&m.acquireColor(r,5,"depth to color"),g.push(r)}p.gl.drawBuffers(g),l(p.gl);const T=p.getViewport();p.setViewport(0,0,o,n),p.setClearColor(0,0,0,0),p.clear(16384),p.setBlendingEnabled(!0),p.setBlendFunction(1,771);const F="linear-depth"===t||t.includes("shadow"),b="overlay highlight"===t||"highlights"===t||"highlight mix"===t,R="highlight coverage"===t,B=e.colorTexture?.descriptor,C=B?.internalFormat,y=F?3:b?5:R?6:C===h.R16F||C===h.R32F||C===h.R8?1:C===h.RG8?2:C===h.RGBA16F?4:C===h.RG8UI?7:0;d.setUniform1i("inputType",y),d.setUniform2fv("nearFar",this.camera.nearFar),p.screen.draw(),l(p.gl),p.bindFramebuffer(null),p.setViewport(T.x,T.y,T.width,T.height),0===r&&(this._focusedFBO=m,this._focusedFBOType=y);for(let c=0;c<i;++c)if(a[c]){const r=e.getColorTexture(u+c);r?.clearMipmap()}return f&&f.setShadowFiltering(x),m}clearFocusedFBO(){this._focusedFBO=null}getPreviewContent(e,r,t,o){if(!t)return null;const n=this.renderingContext,i=this.fboCache.acquire(e,r,"fbo visualizer");n.bindFramebuffer(i?.fbo),n.setClearColor(this.clearColor[0],this.clearColor[1],this.clearColor[2],this.clearColor[3]),n.clear(16384),n.setBlendingEnabled(!0),n.setBlendFunction(1,771);const c=t.getColorTexture(o);n.setViewport(0,0,e,r);const s=this._ensureProgram(n,!1,[v(c)]);n.useProgram(s),n.bindTexture(c,0),s.setUniform1i("colorTex0",0),s.setUniform1i("inputType",0),n.screen.draw();const a=new ImageData(new Uint8ClampedArray(e*r*4),e,r);return n.gl.readPixels(0,0,e,r,6408,p.UNSIGNED_BYTE,new Uint8Array(a.data.buffer)),l(n.gl),n.bindFramebuffer(null),i?.release(),a}_ensureProgram(e,r,t){const o=g({hasDepthAttachment:r,colorAttachmentTypes:t}),n=this._program.get(o);if(n)return n;const i="#version 300 es\n in vec2 position;\n out vec2 uv;\n\n void main() {\n gl_Position = vec4(position, 0.0, 1.0);\n uv = position * 0.5 + vec2(0.5);\n }",l=e=>{let r="";for(let t=0;t<e.length;++t){const o=e[t];r+=`layout(location = ${c.int(t)}) out vec4 fragColor${c.int(t)};\n uniform ${m(o)} colorTex${c.int(t)};`}return r},u=e=>{let r="";for(let t=1;t<e.length;++t){const o=e[t],n=`texture(colorTex${c.int(t)}, uv)`,i="float"===o?n:`vec4( vec2(${n}), 0.0, 1.0)`;r+=`fragColor${c.int(t)} = ${i};`}return r},p=t.length,h=`#version 300 es\n precision highp float;\n precision highp usampler2D;\n\n in vec2 uv;\n ${l(t)}\n ${s(r,`layout(location = ${c.int(p)}) out vec4 fragDepth;\n uniform sampler2D depthTex;`)}\n\n uniform int inputType;\n uniform vec2 nearFar;\n\n // Factors to convert rgba back to float\n const vec4 RGBA_2_FLOAT_FACTORS = vec4(\n 255.0 / (256.0),\n 255.0 / (256.0 * 256.0),\n 255.0 / (256.0 * 256.0 * 256.0),\n 255.0 / (256.0 * 256.0 * 256.0 * 256.0)\n );\n\n\n float rgbaTofloat(vec4 rgba) {\n // Convert components from 0->1 back to 0->255 and then add the components together with their corresponding\n // fixed point factors, i.e. (256^1, 256^2, 256^3, 256^4)\n return dot(rgba, RGBA_2_FLOAT_FACTORS);\n }\n\n float linearDepthFromFloat(float depth) {\n depth = pow(depth, 0.2);\n return -(depth * (nearFar[1] - nearFar[0]) + nearFar[0]);\n }\n\n float linearDepthFromRGBA(vec4 depth) {\n return linearDepthFromFloat(rgbaTofloat(depth));\n }\n\n ${"float"===t[0]?"float linearDepthFromTexture(sampler2D depthTex, vec2 uv) {\n ivec2 iuv = ivec2(uv * vec2(textureSize(depthTex, 0)));\n return linearDepthFromRGBA(texelFetch(depthTex, iuv, 0));\n }":"float linearDepthFromTexture(usampler2D depthTex, vec2 uv) {\n ivec2 iuv = ivec2(uv * vec2(textureSize(depthTex, 0)));\n return linearDepthFromRGBA(vec4(texelFetch(depthTex, iuv, 0)) * 255.0);\n }"}\n\n void main() {\n ${s(t.length>0,c`
5
+ import{__decorate as e}from"tslib";import{property as r}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as t}from"../../../../../core/accessorSupport/decorators/subclass.js";import{ZEROS as o}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{RenderCategory as n}from"../../../webgl.js";import i from"../../../webgl/RenderNode.js";import{glsl as s,If as c}from"../../core/shaderModules/glsl.js";import{Pos2Locations as a}from"../../lib/DefaultVertexBufferLayouts.js";import{checkWebGLError as l}from"../../../../webgl/checkWebGLError.js";import{ColorAttachment0 as u,DataType as p,SizedPixelFormat as h}from"../../../../webgl/enums.js";import{alphaCutoff as f}from"../../../../../webscene/support/AlphaCutoff.js";let d=class extends i{constructor(e){super(e),this.destroyedCB=null,this.produces=n.FINAL,this.consumes={required:[n.FINAL]},this.clearColor=o,this._focusedFBOType=0,this._program=new Map}destroy(){this._program.forEach(e=>e.dispose()),this._program.clear(),this.destroyedCB()}render(e){const r=e.find(({name:e})=>e===n.FINAL);if(!this._focusedFBO)return r;const t=this.renderingContext;t.bindFramebuffer(r.fbo),t.setClearColor(0,0,0,0),t.clear(16384);const o=this._focusedFBO.getTexture(),i=[v(o)],s=this._ensureProgram(t,!1,i);return t.useProgram(s),t.bindTexture(o,0),s.setUniform1i("colorTex0",0),s.setUniform1i("inputType",this._focusedFBOType),3===this._focusedFBOType&&s.setUniform2fv("nearFar",this.camera.nearFar),t.screen.draw(),r}getDownscaledFBO(e,r,t,o,n){0===r&&(o=e.width,n=e.height);const i=e.colorAttachments.length,c=[],a=new Array(i);for(let s=0;s<i;++s){const r=e.getColorTexture(u+s);if(r){const e=v(r);c.push(e);const{descriptor:t}=r;"float"!==e||t.hasMipmap||t.isImmutable||(r.generateMipmap(),a[s]=!0)}}const p=this.renderingContext,{depthStencilTexture:f}=e,d=this._ensureProgram(p,null!=f,c),m=this.fboCache.acquire(o,n,"fbo visualizer");p.useProgram(d),p.bindFramebuffer(m.fbo);const g=[];for(let l=0;l<i;++l){const r=u+l,t=`colorTex${s.int(l)}`;p.bindTexture(e.getColorTexture(r),l),d.setUniform1i(t,l),l>0&&m.acquireColor(r,5),g.push(r)}const x=f?.descriptor.linearFilterDepth??!1;if(f){const e=i;f.setShadowFiltering(!1),p.bindTexture(f,e),d.setUniform1i("depthTex",e);const r=u+e;r>u&&m.acquireColor(r,5,"fbo visualizer"),g.push(r)}p.gl.drawBuffers(g),l(p.gl);const T=p.getViewport();p.setViewport(0,0,o,n),p.setClearColor(0,0,0,0),p.clear(16384),p.setBlendingEnabled(!0),p.setBlendFunction(1,771);const F="linear depth"===t||t.includes("shadow"),b="overlay highlight"===t||"highlights"===t||"highlight mix"===t,R="highlight coverage"===t,B=e.colorTexture?.descriptor,C=B?.internalFormat,y=F?3:b?5:R?6:C===h.R16F||C===h.R32F||C===h.R8?1:C===h.RG8?2:C===h.RGBA16F?4:C===h.RG8UI?7:0;d.setUniform1i("inputType",y),d.setUniform2fv("nearFar",this.camera.nearFar),p.screen.draw(),l(p.gl),p.bindFramebuffer(null),p.setViewport(T.x,T.y,T.width,T.height),0===r&&(this._focusedFBO=m,this._focusedFBOType=y);for(let s=0;s<i;++s)if(a[s]){const r=e.getColorTexture(u+s);r?.clearMipmap()}return f&&f.setShadowFiltering(x),m}clearFocusedFBO(){this._focusedFBO=null}getPreviewContent(e,r,t,o){if(!t)return null;const n=this.renderingContext,i=this.fboCache.acquire(e,r,"fbo visualizer");n.bindFramebuffer(i?.fbo),n.setClearColor(this.clearColor[0],this.clearColor[1],this.clearColor[2],this.clearColor[3]),n.clear(16384),n.setBlendingEnabled(!0),n.setBlendFunction(1,771);const s=t.getColorTexture(o);n.setViewport(0,0,e,r);const c=this._ensureProgram(n,!1,[v(s)]);n.useProgram(c),n.bindTexture(s,0),c.setUniform1i("colorTex0",0),c.setUniform1i("inputType",0),n.screen.draw();const a=new ImageData(new Uint8ClampedArray(e*r*4),e,r);return n.gl.readPixels(0,0,e,r,6408,p.UNSIGNED_BYTE,new Uint8Array(a.data.buffer)),l(n.gl),n.bindFramebuffer(null),i?.release(),a}_ensureProgram(e,r,t){const o=g({hasDepthAttachment:r,colorAttachmentTypes:t}),n=this._program.get(o);if(n)return n;const i="#version 300 es\n in vec2 position;\n out vec2 uv;\n\n void main() {\n gl_Position = vec4(position, 0.0, 1.0);\n uv = position * 0.5 + vec2(0.5);\n }",l=e=>{let r="";for(let t=0;t<e.length;++t){const o=e[t];r+=`layout(location = ${s.int(t)}) out vec4 fragColor${s.int(t)};\n uniform ${m(o)} colorTex${s.int(t)};`}return r},u=e=>{let r="";for(let t=1;t<e.length;++t){const o=e[t],n=`texture(colorTex${s.int(t)}, uv)`,i="float"===o?n:`vec4( vec2(${n}), 0.0, 1.0)`;r+=`fragColor${s.int(t)} = ${i};`}return r},p=t.length,h=`#version 300 es\n precision highp float;\n precision highp usampler2D;\n\n in vec2 uv;\n ${l(t)}\n ${c(r,`layout(location = ${s.int(p)}) out vec4 fragDepth;\n uniform sampler2D depthTex;`)}\n\n uniform int inputType;\n uniform vec2 nearFar;\n\n // Factors to convert rgba back to float\n const vec4 RGBA_2_FLOAT_FACTORS = vec4(\n 255.0 / (256.0),\n 255.0 / (256.0 * 256.0),\n 255.0 / (256.0 * 256.0 * 256.0),\n 255.0 / (256.0 * 256.0 * 256.0 * 256.0)\n );\n\n\n float rgbaTofloat(vec4 rgba) {\n // Convert components from 0->1 back to 0->255 and then add the components together with their corresponding\n // fixed point factors, i.e. (256^1, 256^2, 256^3, 256^4)\n return dot(rgba, RGBA_2_FLOAT_FACTORS);\n }\n\n float linearDepthFromFloat(float depth) {\n depth = pow(depth, 0.2);\n return -(depth * (nearFar[1] - nearFar[0]) + nearFar[0]);\n }\n\n float linearDepthFromRGBA(vec4 depth) {\n return linearDepthFromFloat(rgbaTofloat(depth));\n }\n\n ${"float"===t[0]?"float linearDepthFromTexture(sampler2D depthTex, vec2 uv) {\n ivec2 iuv = ivec2(uv * vec2(textureSize(depthTex, 0)));\n return linearDepthFromRGBA(texelFetch(depthTex, iuv, 0));\n }":"float linearDepthFromTexture(usampler2D depthTex, vec2 uv) {\n ivec2 iuv = ivec2(uv * vec2(textureSize(depthTex, 0)));\n return linearDepthFromRGBA(vec4(texelFetch(depthTex, iuv, 0)) * 255.0);\n }"}\n\n void main() {\n ${c(t.length>0,s`
6
6
  vec4 color;
7
7
  if (inputType == 1) {
8
8
  color = vec4(vec3(texture(colorTex0, uv).r), 1.0);
@@ -31,8 +31,8 @@ import{__decorate as e}from"tslib";import{property as r}from"../../../../../core
31
31
  }
32
32
 
33
33
 
34
- if(color.a < ${c.float(f)})
34
+ if(color.a < ${s.float(f)})
35
35
  discard;
36
36
  fragColor0 = color;
37
- ${s(t.length>1,u(t))}
38
- `)}\n\n ${s(r,"float depth = 1.0 - pow(texture(depthTex, uv).r, 10.0);\n fragDepth = vec4(vec3(depth), depth < 0.000001 ? 0.0 : 1.0);")}\n }`,d=e.programCache.acquire(i,h,a);return this._program.set(o,d),d}};function m(e){switch(e){case"float":return"sampler2D";case"uint":return"usampler2D";case"int":return"isampler2D"}}function v(e){if(!e)return"float";const{internalFormat:r}=e.descriptor;switch(r){case h.R8I:case h.R16I:case h.R32I:case h.RG8I:case h.RG16I:case h.RG32I:case h.RGB8I:case h.RGB16I:case h.RGB32I:case h.RGBA8I:case h.RGBA16I:case h.RGBA32I:return"int";case h.R8UI:case h.R16UI:case h.R32UI:case h.RG8UI:case h.RG16UI:case h.RG32UI:case h.RGB8UI:case h.RGB16UI:case h.RGB32UI:case h.RGBA8UI:case h.RGBA16UI:case h.RGBA32UI:return"uint";default:return"float"}}function g(e){const{hasDepthAttachment:r,colorAttachmentTypes:t}=e;return`${r?"Depth":""}${t.reduceRight((e,r)=>e+`|C${r}`,"")}`}e([r()],d.prototype,"destroyedCB",void 0),e([r()],d.prototype,"produces",void 0),e([r()],d.prototype,"consumes",void 0),e([r()],d.prototype,"clearColor",void 0),d=e([t("esri.views.3d.webgl-engine.effects.debug.RenderNodeVisualizerNode")],d);export{d as RenderNodeVisualizerNode};
37
+ ${c(t.length>1,u(t))}
38
+ `)}\n\n ${c(r,"float depth = 1.0 - pow(texture(depthTex, uv).r, 10.0);\n fragDepth = vec4(vec3(depth), depth < 0.000001 ? 0.0 : 1.0);")}\n }`,d=e.programCache.acquire(i,h,a);return this._program.set(o,d),d}};function m(e){switch(e){case"float":return"sampler2D";case"uint":return"usampler2D";case"int":return"isampler2D"}}function v(e){if(!e)return"float";const{internalFormat:r}=e.descriptor;switch(r){case h.R8I:case h.R16I:case h.R32I:case h.RG8I:case h.RG16I:case h.RG32I:case h.RGB8I:case h.RGB16I:case h.RGB32I:case h.RGBA8I:case h.RGBA16I:case h.RGBA32I:return"int";case h.R8UI:case h.R16UI:case h.R32UI:case h.RG8UI:case h.RG16UI:case h.RG32UI:case h.RGB8UI:case h.RGB16UI:case h.RGB32UI:case h.RGBA8UI:case h.RGBA16UI:case h.RGBA32UI:return"uint";default:return"float"}}function g(e){const{hasDepthAttachment:r,colorAttachmentTypes:t}=e;return`${r?"Depth":""}${t.reduceRight((e,r)=>e+`|C${r}`,"")}`}e([r()],d.prototype,"destroyedCB",void 0),e([r()],d.prototype,"produces",void 0),e([r()],d.prototype,"consumes",void 0),e([r()],d.prototype,"clearColor",void 0),d=e([t("esri.views.3d.webgl-engine.effects.debug.RenderNodeVisualizerNode")],d);export{d as RenderNodeVisualizerNode};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- const n=2.6,s={sunny:.0022,cloudy:.0022,rainy:.0022,snowy:.0022,foggy:.0022};class o{constructor(n,s){this.near=n,this.far=s,this.near=r(n),this.far=r(s)}}const t={sunny:new o([1,.15,.05,.01,0,0],[2.1,.8,.6,.4,.2,.1]),cloudy:new o([1,.15,.05,.01,0,0],[1,.8,.6,.4,.2,.1]),rainy:new o([1,.15,.05,.01,0,0],[1,.8,.6,.4,.2,.1]),snowy:new o([1,.15,.05,.01,0,0],[1,.8,.6,.4,.2,.1]),foggy:new o([1,.15,.05,.01,0,0],[1,.8,.6,.4,.2,.1])};function r(n,s=1){const o=n[0]+n[1]+n[2]+n[3]+n[4]+n[5];return o<s?n:[n[0]/o,n[1]/o,n[2]/o,n[3]/o,n[4]/o,n[5]/o]}export{s as blurRadiusPresets,n as defaultExposure,t as lodFactorsPresets,r as normalizePreset};
5
+ const n=2.6,s={sunny:.0022,rainy:.0022,cloudy:.0022,snowy:.0042,foggy:.0042};class t{constructor(n){this.presets=n,this.presets=c(n)}}const o={sunny:new t([2.1,.8,.6,.4,.2,.1]),foggy:new t([0,0,.06,.12,.25,.57])};function c(n,s=1){const t=n[0]+n[1]+n[2]+n[3]+n[4]+n[5];return t<=s?n:[n[0]/t,n[1]/t,n[2]/t,n[3]/t,n[4]/t,n[5]/t]}export{s as blurRadiusPresets,n as defaultExposure,o as lodFactorsPresets,c as normalizePreset};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import{lerp as t}from"../../../../../core/mathUtils.js";import{watch as r,syncAndInitial as i}from"../../../../../core/reactiveUtils.js";import{property as o}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as s}from"../../../../../core/accessorSupport/decorators/subclass.js";import{ZEROS as a}from"../../../../../core/libs/gl-matrix-2/factories/vec4f32.js";import{InternalRenderCategory as n}from"../../../webgl.js";import{TransparentEnvironment as l}from"../TransparentEnvironment.js";import{G as c}from"../../../../../chunks/GlowBlur.glsl.js";import{GlowBlurTechnique as h}from"./GlowBlurTechnique.js";import{GlowBlurTechniqueConfiguration as u}from"./GlowBlurTechniqueConfiguration.js";import{G as m}from"../../../../../chunks/GlowComposition.glsl.js";import{GlowCompositionTechnique as p}from"./GlowCompositionTechnique.js";import{GlowCompositionTechniqueConfiguration as g}from"./GlowCompositionTechniqueConfiguration.js";import{blurRadiusPresets as d,lodFactorsPresets as _,normalizePreset as f}from"./GlowPresets.glsl.js";import{ColorAttachment1 as b,DepthStencilAttachment as w}from"../../../../webgl/enums.js";let P=class extends l{constructor(e){super(e),this.consumes={required:[n.TRANSPARENT_ENVIRONMENT,"emissive"]},this.produces=n.TRANSPARENT_ENVIRONMENT,this._blurHorizontalConfiguration=new u,this._blurVerticalConfiguration=new u,this._compositionConfiguration=new g,this._compositionParameters=new m,this._blurParameters=new c,this._blurScale=3.06,this._glowEnabled=!1,this._glowResults=new Array;e.view.stage.renderView.techniques.precompile(p,this._compositionConfiguration)}initialize(){this.addHandles([r(()=>this._updateFogParameters(),()=>{},i),r(()=>this.view.qualitySettings.glow,e=>{this._glowEnabled=e,this.precompile(),this.requestRender(1)},i)])}_updateFogParameters(){const e=this.view.environment.weather;if("sunny"===e.type||"cloudy"===e.type)this._blurParameters.blurRadius=d[e.type];else{const r="foggy"===e.type?e.fogStrength:e.precipitation;this._blurParameters.blurRadius=t(d.cloudy,d[e.type],r)}this._compositionParameters.lodFactors=_[e.type].far,this._compositionParameters.lodFactorsFront=_[e.type].near,this.requestRender(1)}precompile(){this._glowEnabled&&(this.techniques.precompile(h,this._blurHorizontalConfiguration),this._blurVerticalConfiguration.glowStage=1,this.techniques.precompile(h,this._blurVerticalConfiguration)),this._compositionConfiguration.blurEnabled=this._glowEnabled,this.techniques.precompile(p,this._compositionConfiguration)}render(e){const t=e.find(({name:e})=>e===n.TRANSPARENT_ENVIRONMENT),r=t.getAttachment(b)?.attachment;if(!r)return t;const i=t.getAttachment(w);if(!this._glowEnabled){const e=this.techniques.get(p,this._compositionConfiguration);if(!e.compiled)return this.requestRender(1),t;const o=t.getTexture(),s=this.fboCache,{fullWidth:a,fullHeight:n}=this.bindParameters.camera,l=this.renderingContext,c=s.acquire(o.descriptor.width,o.descriptor.height,this.produces);return this._prepareFBO(c,a,n),this._compositionParameters.color=o,this._compositionParameters.emission=r,l.bindTechnique(e,this.bindParameters,this._compositionParameters),l.screen.draw(),c.attachDepth(i),c.attachColor(t.getAttachment(b),b),c}const o=this.techniques.get(h,this._blurHorizontalConfiguration),s=this.techniques.get(h,this._blurVerticalConfiguration),a=this.techniques.get(p,this._compositionConfiguration);if(!o.compiled||!s.compiled||!a.compiled)return this.requestRender(1),t;const l=t.getTexture(),c=this.fboCache,{fullWidth:u,fullHeight:m}=this.bindParameters.camera,g=this.renderingContext;let d=r,_=Math.ceil(u/2),f=Math.ceil(m/2);const P=5,T=this._blurParameters.blurRadius;for(let n=0;n<P;n++){const e=c.acquire(_,f,"glowHorizontal",8);this._blurParameters.color=d,this._prepareFBO(e,_,f),g.bindTechnique(o,this.bindParameters,this._blurParameters),g.screen.draw();const t=c.acquire(_,f,"glowVertical",8);this._blurParameters.color=e.getTexture(),this._prepareFBO(t,_,f),g.bindTechnique(s,this.bindParameters,this._blurParameters),g.screen.draw(),e.release(),this._glowResults[n]=t,_=Math.ceil(_/2),f=Math.ceil(f/2),d=this._glowResults[n].getTexture(),this._blurParameters.blurRadius*=this._blurScale}this._blurParameters.blurRadius=T,this._compositionParameters.color=l,this._compositionParameters.emission=r,this._compositionParameters.lodTexture0=this._glowResults[0].getTexture(),this._compositionParameters.lodTexture1=this._glowResults[1].getTexture(),this._compositionParameters.lodTexture2=this._glowResults[2].getTexture(),this._compositionParameters.lodTexture3=this._glowResults[3].getTexture(),this._compositionParameters.lodTexture4=this._glowResults[4].getTexture();const R=c.acquire(l.descriptor.width,l.descriptor.height,this.produces);return R.acquireColor(b,8,"emissive glow"),this._prepareFBO(R,u,m,!0),g.bindTechnique(a,this.bindParameters,this._compositionParameters),g.screen.draw(),this._glowResults.forEach(e=>e.release()),R.attachDepth(i),R}_prepareFBO(e,t,r,i=!1){const o=this.renderingContext;o.bindFramebuffer(e.fbo),o.setViewport(0,0,t,r),o.setClearColor(0,0,0,0),o.clear(16384),i&&o.clearBuffer(1,a)}get test(){return{compositionParameters:this._compositionParameters,blurParameters:this._blurParameters,setLodFactors:e=>{this._compositionParameters.lodFactors=f(e)},toggleTonemapping:e=>{this._compositionConfiguration.tonemappingEnabled=e,this.requestRender(1)}}}};e([o()],P.prototype,"consumes",void 0),e([o()],P.prototype,"produces",void 0),P=e([s("esri.views.3d.webgl-engine.effects.glow.GlowRenderNode")],P);export{P as GlowRenderNode};
5
+ import{__decorate as e}from"tslib";import{lerp as t}from"../../../../../core/mathUtils.js";import{watch as i,syncAndInitial as r}from"../../../../../core/reactiveUtils.js";import{property as o}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as s}from"../../../../../core/accessorSupport/decorators/subclass.js";import{ZEROS as a}from"../../../../../core/libs/gl-matrix-2/factories/vec4f32.js";import{InternalRenderCategory as n}from"../../../webgl.js";import{TransparentEnvironment as l}from"../TransparentEnvironment.js";import{G as c}from"../../../../../chunks/GlowBlur.glsl.js";import{GlowBlurTechnique as h}from"./GlowBlurTechnique.js";import{GlowBlurTechniqueConfiguration as u}from"./GlowBlurTechniqueConfiguration.js";import{G as m}from"../../../../../chunks/GlowComposition.glsl.js";import{GlowCompositionTechnique as p}from"./GlowCompositionTechnique.js";import{GlowCompositionTechniqueConfiguration as d}from"./GlowCompositionTechniqueConfiguration.js";import{blurRadiusPresets as g,lodFactorsPresets as _,normalizePreset as b}from"./GlowPresets.glsl.js";import{ColorAttachment1 as f,DepthStencilAttachment as w}from"../../../../webgl/enums.js";let P=class extends l{constructor(e){super(e),this.consumes={required:[n.TRANSPARENT_ENVIRONMENT,"emissive"]},this.produces=n.TRANSPARENT_ENVIRONMENT,this._blurHorizontalConfiguration=new u,this._blurVerticalConfiguration=new u,this._compositionConfiguration=new d,this._compositionParameters=new m,this._blurParameters=new c,this._blurScale=3.06,this._blurLodCombination=0,this._glowEnabled=!1,this._glowResults=new Array;e.view.stage.renderView.techniques.precompile(p,this._compositionConfiguration)}initialize(){this.addHandles([i(()=>this._updateFogParameters(),()=>{},r),i(()=>this.view.qualitySettings.glow,e=>{this._glowEnabled=e,this.precompile(),this.requestRender(1)},r)])}_updateFogParameters(){const e=this.view.environment.weather;if("sunny"===e.type||"cloudy"===e.type)this._blurParameters.blurRadius=g[e.type];else{const i="foggy"===e.type?e.fogStrength:e.precipitation;this._blurParameters.blurRadius=t(g.cloudy,g[e.type],i)}this._computeLodFactors(),this.requestRender(1)}_computeLodFactors(e=_.sunny.presets,i=_.foggy.presets){this._compositionParameters.lodFactors=_.sunny.presets,e.forEach((e,r)=>{this._compositionParameters.lodFactors[r]=t(e,i[r],this._blurLodCombination)})}precompile(){this._glowEnabled&&(this.techniques.precompile(h,this._blurHorizontalConfiguration),this._blurVerticalConfiguration.glowStage=1,this.techniques.precompile(h,this._blurVerticalConfiguration)),this._compositionConfiguration.blurEnabled=this._glowEnabled,this.techniques.precompile(p,this._compositionConfiguration)}render(e){const t=e.find(({name:e})=>e===n.TRANSPARENT_ENVIRONMENT),i=t.getAttachment(f)?.attachment;if(!i)return t;const r=t.getAttachment(w);if(!this._glowEnabled){const e=this.techniques.get(p,this._compositionConfiguration);if(!e.compiled)return this.requestRender(1),t;const o=t.getTexture(),s=this.fboCache,{fullWidth:a,fullHeight:n}=this.bindParameters.camera,l=this.renderingContext,c=s.acquire(o.descriptor.width,o.descriptor.height,this.produces);return this._prepareFBO(c,a,n),this._compositionParameters.color=o,this._compositionParameters.emission=i,l.bindTechnique(e,this.bindParameters,this._compositionParameters),l.screen.draw(),c.attachDepth(r),c.attachColor(t.getAttachment(f),f),c}const o=this.techniques.get(h,this._blurHorizontalConfiguration),s=this.techniques.get(h,this._blurVerticalConfiguration),a=this.techniques.get(p,this._compositionConfiguration);if(!o.compiled||!s.compiled||!a.compiled)return this.requestRender(1),t;const l=t.getTexture(),c=this.fboCache,{fullWidth:u,fullHeight:m}=this.bindParameters.camera,d=this.renderingContext;let g=i,_=Math.ceil(u/2),b=Math.ceil(m/2);const P=5,C=this._blurParameters.blurRadius;for(let n=0;n<P;n++){const e=c.acquire(_,b,"glow horizontal",8);this._blurParameters.color=g,this._prepareFBO(e,_,b),d.bindTechnique(o,this.bindParameters,this._blurParameters),d.screen.draw();const t=c.acquire(_,b,"glow vertical",8);this._blurParameters.color=e.getTexture(),this._prepareFBO(t,_,b),d.bindTechnique(s,this.bindParameters,this._blurParameters),d.screen.draw(),e.release(),this._glowResults[n]=t,_=Math.ceil(_/2),b=Math.ceil(b/2),g=this._glowResults[n].getTexture(),this._blurParameters.blurRadius*=this._blurScale}this._blurParameters.blurRadius=C,this._compositionParameters.color=l,this._compositionParameters.emission=i,this._compositionParameters.lodTexture0=this._glowResults[0].getTexture(),this._compositionParameters.lodTexture1=this._glowResults[1].getTexture(),this._compositionParameters.lodTexture2=this._glowResults[2].getTexture(),this._compositionParameters.lodTexture3=this._glowResults[3].getTexture(),this._compositionParameters.lodTexture4=this._glowResults[4].getTexture();const T=c.acquire(l.descriptor.width,l.descriptor.height,this.produces);return T.acquireColor(f,8,"emissive glow"),this._prepareFBO(T,u,m,!0),d.bindTechnique(a,this.bindParameters,this._compositionParameters),d.screen.draw(),this._glowResults.forEach(e=>e.release()),T.attachDepth(r),T}_prepareFBO(e,t,i,r=!1){const o=this.renderingContext;o.bindFramebuffer(e.fbo),o.setViewport(0,0,t,i),o.setClearColor(0,0,0,0),o.clear(16384),r&&o.clearBuffer(1,a)}get test(){return{compositionParameters:this._compositionParameters,blurParameters:this._blurParameters,setBlurLodCombination:e=>{this._blurLodCombination=e,this._computeLodFactors()},setLodFactors:e=>{this._computeLodFactors(b(e))},toggleTonemapping:e=>{this._compositionConfiguration.tonemappingEnabled=e,this.requestRender(1)}}}};e([o()],P.prototype,"consumes",void 0),e([o()],P.prototype,"produces",void 0),P=e([s("esri.views.3d.webgl-engine.effects.glow.GlowRenderNode")],P);export{P as GlowRenderNode};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import"../../../../../core/has.js";import{releaseMaybe as t,disposeMaybe as r}from"../../../../../core/maybe.js";import{watch as i,initial as s}from"../../../../../core/reactiveUtils.js";import{property as o}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as h}from"../../../../../core/accessorSupport/decorators/subclass.js";import{set as n}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{InternalRenderCategory as l}from"../../../webgl.js";import a from"../../../webgl/RenderNode.js";import{HighlightApplyTechnique as g}from"./HighlightApplyTechnique.js";import{HighlightBlurTechnique as c}from"./HighlightBlurTechnique.js";import{HighlightDownsampleTechnique as u}from"./HighlightDownsampleTechnique.js";import{HighlightPassParameters as p}from"./HighlightPassParameters.js";import{HighlightToSingleTechnique as m}from"./HighlightToSingleTechnique.js";import{NoVertex as d}from"../../lib/DefaultVertexBufferLayouts.js";import{VertexArrayObject as f}from"../../lib/VertexArrayObject.js";import{H as b}from"../../../../../chunks/HighlightBlur.glsl.js";import{H as w,g as x}from"../../../../../chunks/HighlightDownsample.glsl.js";import{BufferObject as T}from"../../../../webgl/BufferObject.js";import{PrimitiveType as C,DataType as _}from"../../../../webgl/enums.js";import{Texture as v}from"../../../../webgl/Texture.js";import{TextureDescriptor as j}from"../../../../webgl/TextureDescriptor.js";import{VertexBuffer as H}from"../../../../webgl/VertexBuffer.js";let q=class extends a{constructor(){super(...arguments),this.produces=l.HIGHLIGHTS,this.consumes={required:[l.HIGHLIGHTS,"highlights"]},this._downsampleDrawParameters=new w,this._passParameters=new p,this._highlightBlurDrawParameters=new b,this._grid=new P}initialize(){this.addHandles([i(()=>this._updateOptionsTexture(),()=>{},s)])}destroy(){this._grid.coverage=t(this._grid.coverage),this._grid.vao=r(this._grid.vao),this._passParameters.highlightOptionsTexture=t(this._passParameters.highlightOptionsTexture)}_updateOptionsTexture(){if(null==this._passParameters.highlightOptionsTexture){const e=new j(16,2);e.internalFormat=6408,e.samplingMode=9728,this._passParameters.highlightOptionsTexture=new v(this.renderingContext,e,null)}this._passParameters.highlightOptionsTexture.setData(O(this.view.state.highlights)),this.requestRender(1)}precompile(){this.techniques.precompile(u),this.techniques.precompile(m),this.techniques.precompile(c),this.techniques.precompile(g)}render(e){const t=e.find(({name:e})=>e===l.HIGHLIGHTS),{techniques:r,bindParameters:i}=this;if(!i.decorations)return t;if(!r.get(u).compiled)return this.requestRender(1),t;const s=e.find(({name:e})=>"highlights"===e).getTexture();return this._renderHighlightPostprocess(s,t),t}_prepareAndDownSample(e){this._gridUpdateResources(e);const t=this.techniques.get(u),r=this._gridComputeCoverage(t,e),{horizontalCellCount:i,verticalCellCount:s}=r,o=this._passParameters;return o.horizontalCellCount=i,o.verticalCellCount=s,o.coverageTexture=r.coverage?.getTexture(),r}_renderGrid(e){const t=e.verticalCellCount*e.horizontalCellCount;this.renderingContext.bindVAO(e.vao),this.renderingContext.drawElementsInstanced(C.TRIANGLES,6,_.UNSIGNED_BYTE,0,t)}_renderHighlightPostprocess(e,t){const{fboCache:r,techniques:i,bindParameters:s,_passParameters:o,renderingContext:h}=this,l=i.get(m),a=i.get(c),u=i.get(g);if(!u.compiled||!a.compiled||!l.compiled)return void this.requestRender(1);o.highlightTexture=e;const p=this._prepareAndDownSample(e),{width:d,height:f}=e.descriptor;o.highlightTexture=e;const{camera:b}=s,{fullWidth:w,fullHeight:x,pixelRatio:T,fullViewport:C}=b,_=Math.ceil(w/T),v=Math.ceil(x/T),{_highlightBlurDrawParameters:j}=this,H=this.view.stage.renderView.renderer,{highlights:q}=s;for(let g=0;g<q.length;++g){const{name:e}=q[g];if(!H.hasHighlight(e))continue;o.highlightLevel=g,h.setClearColor(0,0,0,0);const i=r.acquire(d,f,"single highlight",2);h.bindFramebuffer(i.fbo),h.setViewport(0,0,d,f),h.clear(16384),h.bindTechnique(l,s,o),this._renderGrid(p),j.blurInput=i.getTexture(),n(j.blurSize,1/_,0);const c=r.acquire(_,v,"single highlight blur h",2);h.unbindTexture(c.fbo?.colorTexture),h.bindFramebuffer(c.fbo),h.setViewport(0,0,_,v),h.clear(16384),h.bindTechnique(a,s,o,j),this._renderGrid(p),i.release(),n(j.blurSize,0,1/v),o.highlightBlurTexture=c.getTexture(),h.bindFramebuffer(t.fbo),h.setViewport4fv(C),h.bindTechnique(u,s,o,j),this._renderGrid(p),c.release()}o.coverageTexture=o.highlightTexture=null}_gridUpdateResources(e){const t=this._grid,{width:r,height:i}=e.descriptor;if(t.horizontalCellCount=Math.ceil(r/x),t.verticalCellCount=Math.ceil(i/x),t.vao)return;const s=this.renderingContext,o=T.createIndex(s,35044,S);t.vao=new f(s,new H(s,d),o)}_gridComputeCoverage(e,t){const r=this.renderingContext,i=this._grid,s=t.descriptor,o=Math.ceil(s.width/x),h=Math.ceil(s.height/x);this._downsampleDrawParameters.input=t;const{highlights:n}=this.bindParameters;i.coverage?.release();const l=this.fboCache.acquire(o,h,"highlight coverage",n.length>I?3:1);return i.coverage=l,r.bindFramebuffer(l.fbo),r.bindTechnique(e,this.bindParameters,this._passParameters,this._downsampleDrawParameters),r.setViewport(0,0,o,h),r.screen.draw(),i}get test(){}};e([o()],q.prototype,"produces",void 0),e([o()],q.prototype,"consumes",void 0),q=e([h("esri.views.3d.webgl-engine.effects.highlight.Highlight")],q);class P{constructor(){this.coverage=null,this.vao=null,this.verticalCellCount=0,this.horizontalCellCount=0,this.viewportWidth=0,this.viewportHeight=0}}function O(e){const t=new Uint8Array(128);let r=0;for(const i of e){const e=4*r,s=4*r+64;++r;const{color:o}=i,h=i.haloColor??o;t[e+0]=o.r,t[e+1]=o.g,t[e+2]=o.b,t[e+3]=i.fillOpacity*o.a*255,t[s+0]=h.r,t[s+1]=h.g,t[s+2]=h.b,t[s+3]=i.haloOpacity*h.a*255}return t}let y=0;function D(e){let t=0;for(const i of e){const{name:e}=i;t+=e.length;const{color:r,fillOpacity:s,haloColor:o,haloOpacity:h}=i;t+=r.r+r.g+r.b+r.a+s,t+=o?o.r+o.g+o.b+o.a+h:0}const r=e.at(0);if(r){const{shadowOpacity:e,shadowDifference:i,shadowColor:s}=r;t+=e+i+s.r+s.g+s.b+s.a}return y+++(t>=0?0:1)}const S=new Uint8Array([0,1,2,2,1,3]);function G(e,t,r,i,s,o=0){const{highlights:h}=i,l=h.length>1?t.acquire(r.width,r.height,"highlight mix",h.length>I?3:1):null,{gl:a}=e;if(l){const t=e.getBoundFramebufferObject();e.bindFramebuffer(l.fbo),a.clearBufferuiv(a.COLOR,0,[0,0,0,0]),e.bindFramebuffer(t)}const g=l?.getTexture();i.highlightMixTexture=g,n(i.highlightMixOrigin,o,0),h.forEach((t,h)=>{if(h>0){const t=v.TEXTURE_UNIT_FOR_UPDATES;e.bindTexture(g,t),e.setActiveTexture(t),a.copyTexSubImage2D(3553,0,0,0,o,0,r.width,r.height),e.bindTexture(null,t)}e.clear(256),i.highlightLevel=h,s()}),i.highlightLevel=null,i.highlightMixTexture=null,l?.release()}const I=4;export{q as Highlight,I as maxHighlightsPerChannel,G as renderHighlightBuffer,D as trackHighlightOptions};
5
+ import{__decorate as e}from"tslib";import"../../../../../core/has.js";import{releaseMaybe as t,disposeMaybe as r}from"../../../../../core/maybe.js";import{watch as i,initial as s}from"../../../../../core/reactiveUtils.js";import{property as o}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as h}from"../../../../../core/accessorSupport/decorators/subclass.js";import{set as n}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{InternalRenderCategory as l}from"../../../webgl.js";import a from"../../../webgl/RenderNode.js";import{HighlightApplyTechnique as g}from"./HighlightApplyTechnique.js";import{HighlightBlurTechnique as c}from"./HighlightBlurTechnique.js";import{HighlightDownsampleTechnique as u}from"./HighlightDownsampleTechnique.js";import{HighlightPassParameters as p}from"./HighlightPassParameters.js";import{HighlightToSingleTechnique as m}from"./HighlightToSingleTechnique.js";import{NoVertex as d}from"../../lib/DefaultVertexBufferLayouts.js";import{VertexArrayObject as f}from"../../lib/VertexArrayObject.js";import{H as b}from"../../../../../chunks/HighlightBlur.glsl.js";import{H as w,g as x}from"../../../../../chunks/HighlightDownsample.glsl.js";import{BufferObject as T}from"../../../../webgl/BufferObject.js";import{PrimitiveType as C,DataType as _}from"../../../../webgl/enums.js";import{Texture as v}from"../../../../webgl/Texture.js";import{TextureDescriptor as j}from"../../../../webgl/TextureDescriptor.js";import{VertexBuffer as H}from"../../../../webgl/VertexBuffer.js";let q=class extends a{constructor(){super(...arguments),this.produces=l.HIGHLIGHTS,this.consumes={required:[l.HIGHLIGHTS,"highlights"]},this._downsampleDrawParameters=new w,this._passParameters=new p,this._highlightBlurDrawParameters=new b,this._grid=new P}initialize(){this.addHandles([i(()=>this._updateOptionsTexture(),()=>{},s)])}destroy(){this._grid.coverage=t(this._grid.coverage),this._grid.vao=r(this._grid.vao),this._passParameters.highlightOptionsTexture=t(this._passParameters.highlightOptionsTexture)}_updateOptionsTexture(){if(null==this._passParameters.highlightOptionsTexture){const e=new j(16,2);e.internalFormat=6408,e.samplingMode=9728,this._passParameters.highlightOptionsTexture=new v(this.renderingContext,e,null)}this._passParameters.highlightOptionsTexture.setData(O(this.view.state.highlights)),this.requestRender(1)}precompile(){this.techniques.precompile(u),this.techniques.precompile(m),this.techniques.precompile(c),this.techniques.precompile(g)}render(e){const t=e.find(({name:e})=>e===l.HIGHLIGHTS),{techniques:r,bindParameters:i}=this;if(!i.decorations)return t;if(!r.get(u).compiled)return this.requestRender(1),t;const s=e.find(({name:e})=>"highlights"===e).getTexture();return this._renderHighlightPostprocess(s,t),t}_prepareAndDownSample(e){this._gridUpdateResources(e);const t=this.techniques.get(u),r=this._gridComputeCoverage(t,e),{horizontalCellCount:i,verticalCellCount:s}=r,o=this._passParameters;return o.horizontalCellCount=i,o.verticalCellCount=s,o.coverageTexture=r.coverage?.getTexture(),r}_renderGrid(e){const t=e.verticalCellCount*e.horizontalCellCount;this.renderingContext.bindVAO(e.vao),this.renderingContext.drawElementsInstanced(C.TRIANGLES,6,_.UNSIGNED_BYTE,0,t)}_renderHighlightPostprocess(e,t){const{fboCache:r,techniques:i,bindParameters:s,_passParameters:o,renderingContext:h}=this,l=i.get(m),a=i.get(c),u=i.get(g);if(!u.compiled||!a.compiled||!l.compiled)return void this.requestRender(1);o.highlightTexture=e;const p=this._prepareAndDownSample(e),{width:d,height:f}=e.descriptor;o.highlightTexture=e;const{camera:b}=s,{fullWidth:w,fullHeight:x,pixelRatio:T,fullViewport:C}=b,_=Math.ceil(w/T),v=Math.ceil(x/T),{_highlightBlurDrawParameters:j}=this,H=this.view.stage.renderView.renderer,{highlights:q}=s;for(let g=0;g<q.length;++g){const{name:e}=q[g];if(!H.hasHighlight(e))continue;o.highlightLevel=g,h.setClearColor(0,0,0,0);const i=r.acquire(d,f,"single highlight",2);h.bindFramebuffer(i.fbo),h.setViewport(0,0,d,f),h.clear(16384),h.bindTechnique(l,s,o),this._renderGrid(p),j.blurInput=i.getTexture(),n(j.blurSize,1/_,0);const c=r.acquire(_,v,"single highlight blur",2);h.unbindTexture(c.fbo?.colorTexture),h.bindFramebuffer(c.fbo),h.setViewport(0,0,_,v),h.clear(16384),h.bindTechnique(a,s,o,j),this._renderGrid(p),i.release(),n(j.blurSize,0,1/v),o.highlightBlurTexture=c.getTexture(),h.bindFramebuffer(t.fbo),h.setViewport4fv(C),h.bindTechnique(u,s,o,j),this._renderGrid(p),c.release()}o.coverageTexture=o.highlightTexture=null}_gridUpdateResources(e){const t=this._grid,{width:r,height:i}=e.descriptor;if(t.horizontalCellCount=Math.ceil(r/x),t.verticalCellCount=Math.ceil(i/x),t.vao)return;const s=this.renderingContext,o=T.createIndex(s,35044,S);t.vao=new f(s,new H(s,d),o)}_gridComputeCoverage(e,t){const r=this.renderingContext,i=this._grid,s=t.descriptor,o=Math.ceil(s.width/x),h=Math.ceil(s.height/x);this._downsampleDrawParameters.input=t;const{highlights:n}=this.bindParameters;i.coverage?.release();const l=this.fboCache.acquire(o,h,"highlight coverage",n.length>I?3:1);return i.coverage=l,r.bindFramebuffer(l.fbo),r.bindTechnique(e,this.bindParameters,this._passParameters,this._downsampleDrawParameters),r.setViewport(0,0,o,h),r.screen.draw(),i}get test(){}};e([o()],q.prototype,"produces",void 0),e([o()],q.prototype,"consumes",void 0),q=e([h("esri.views.3d.webgl-engine.effects.highlight.Highlight")],q);class P{constructor(){this.coverage=null,this.vao=null,this.verticalCellCount=0,this.horizontalCellCount=0,this.viewportWidth=0,this.viewportHeight=0}}function O(e){const t=new Uint8Array(128);let r=0;for(const i of e){const e=4*r,s=4*r+64;++r;const{color:o}=i,h=i.haloColor??o;t[e+0]=o.r,t[e+1]=o.g,t[e+2]=o.b,t[e+3]=i.fillOpacity*o.a*255,t[s+0]=h.r,t[s+1]=h.g,t[s+2]=h.b,t[s+3]=i.haloOpacity*h.a*255}return t}let y=0;function D(e){let t=0;for(const i of e){const{name:e}=i;t+=e.length;const{color:r,fillOpacity:s,haloColor:o,haloOpacity:h}=i;t+=r.r+r.g+r.b+r.a+s,t+=o?o.r+o.g+o.b+o.a+h:0}const r=e.at(0);if(r){const{shadowOpacity:e,shadowDifference:i,shadowColor:s}=r;t+=e+i+s.r+s.g+s.b+s.a}return y+++(t>=0?0:1)}const S=new Uint8Array([0,1,2,2,1,3]);function G(e,t,r,i,s,o=0){const{highlights:h}=i,l=h.length>1?t.acquire(r.width,r.height,"highlight mix",h.length>I?3:1):null,{gl:a}=e;if(l){const t=e.getBoundFramebufferObject();e.bindFramebuffer(l.fbo),a.clearBufferuiv(a.COLOR,0,[0,0,0,0]),e.bindFramebuffer(t)}const g=l?.getTexture();i.highlightMixTexture=g,n(i.highlightMixOrigin,o,0),h.forEach((t,h)=>{if(h>0){const t=v.TEXTURE_UNIT_FOR_UPDATES;e.bindTexture(g,t),e.setActiveTexture(t),a.copyTexSubImage2D(3553,0,0,0,o,0,r.width,r.height),e.bindTexture(null,t)}e.clear(256),i.highlightLevel=h,s()}),i.highlightLevel=null,i.highlightMixTexture=null,l?.release()}const I=4;export{q as Highlight,I as maxHighlightsPerChannel,G as renderHighlightBuffer,D as trackHighlightOptions};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as t}from"tslib";import{reallocGrowthFactor as e}from"../../../../core/arrayUtils.js";import{watch as s}from"../../../../core/reactiveUtils.js";import"../../../../core/Logger.js";import"../../../../core/has.js";import"../../../../core/Error.js";import{subclass as i}from"../../../../core/accessorSupport/decorators/subclass.js";import{set as a}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{g as o,J as n,c as h,d as l}from"../../../../chunks/vec32.js";import{create as p}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{elementsPerSplatPage as u,splatAtlasTextureSize as c}from"../../../../layers/support/GaussianSplatAtlasPageAllocator.js";import{evalTextureSize as m,maxAllowedVisibleGaussians as _}from"../../../../layers/support/gaussianSplatUtils.js";import{RenderCategory as d}from"../../webgl.js";import{makeScheduleFunction as f}from"../../layers/support/makeScheduleFunction.js";import{GaussianSplatSortWorkerHandle as g}from"../../support/GaussianSplatWorkerHandle.js";import b from"../../webgl/RenderNode.js";import{G as S}from"../../../../chunks/GaussianSplat.glsl.js";import{G as C}from"../../../../chunks/GaussianSplatComposition.glsl.js";import{GaussianSplatCompositionTechnique as T}from"../shaders/GaussianSplatCompositionTechnique.js";import{G as w}from"../../../../chunks/GaussianSplatDepthComposition.glsl.js";import{GaussianSplatDepthCompositionTechnique as P}from"../shaders/GaussianSplatDepthCompositionTechnique.js";import{GaussianSplatDepthTechnique as y}from"../shaders/GaussianSplatDepthTechnique.js";import{GaussianSplatTechnique as G}from"../shaders/GaussianSplatTechnique.js";import{GaussianSplatTechniqueConfiguration as q}from"../shaders/GaussianSplatTechniqueConfiguration.js";import{DepthStencilAttachment as x,PrimitiveType as v,PixelType as A,SizedPixelFormat as j}from"../../../webgl/enums.js";import{Texture as D}from"../../../webgl/Texture.js";import{TextureDescriptor as I}from"../../../webgl/TextureDescriptor.js";var k;let F=class extends b{static{k=this}static{this.tileSize=2.048}constructor(t){super(t),this.produces=d.OPAQUE,this._gaussianSplatParameters=new S,this._gaussianSplatCompositionParameters=new C,this._gaussianSplatDepthCompositionParameters=new w,this._splatDepthTechniqueConfiguration=new q(!0),this._totalVisibleGaussians=0,this._orderTexture=null,this._textureAtlas=null,this._visibleGaussianTiles=new Array,this._workerHandle=null,this._isSorting=!1,this._pendingSortTask=!1,this._bufferCapacity=0,this._previousCameraPosition=p(),this._previousCameraDirection=p(),this._tanFov=r(),this._tempVec=p(),this._cameraDelta=p(),this._coarseCameraPosition=p()}async initialize(){this._initializeTextures(),this.addHandles([s(()=>this.view.state.camera,()=>this._onCameraChange())]);const{resourceController:t}=this.view;this._workerHandle=new g(f(t))}precompile(){this.techniques.precompile(G),this.techniques.precompile(y,this._splatDepthTechniqueConfiguration),this.techniques.precompile(T),this.techniques.precompile(P)}render(t){const e=t.find(({name:t})=>t===d.OPAQUE),s=this.techniques.get(G),i=this.techniques.get(y,this._splatDepthTechniqueConfiguration),r=this.techniques.get(T),o=this.techniques.get(P);if(!(s.compiled&&i.compiled&&o.compiled&&r.compiled))return this.requestRender(1),e;const{fullWidth:n,fullHeight:h}=this.bindParameters.camera,l=this.fboCache,p=l.acquire(n,h,"gaussianColorOutput");p.attachDepth(e.getAttachment(x));const u=this.renderingContext;u.bindFramebuffer(p.fbo),u.setClearColor(0,0,0,0),u.clear(16384),this._gaussianSplatParameters.totalGaussians=this._totalVisibleGaussians,this._gaussianSplatParameters.splatOrder=this._orderTexture,this._gaussianSplatParameters.splatAtlas=this._textureAtlas;const c=Math.tan(.5*this.camera.fovY),m=c/h*n;a(this._tanFov,m,c);const _=h/(2*c);this._gaussianSplatParameters.focalLength=_,this._gaussianSplatParameters.tanFov=this._tanFov,this.prepareHighPrecisionCameraPosition(),this.renderingContext.bindTechnique(s,this.bindParameters,this._gaussianSplatParameters),this.renderingContext.drawArraysInstanced(v.TRIANGLE_STRIP,0,4,this._totalVisibleGaussians);const f=l.acquire(n,h,"splatDepth",8);f.attachDepth(e.getAttachment(x)),u.bindFramebuffer(f.fbo),u.setClearColor(0,0,0,0),u.clear(16384),this.renderingContext.bindTechnique(i,this.bindParameters,this._gaussianSplatParameters),this.renderingContext.drawArraysInstanced(v.TRIANGLE_STRIP,0,4,this._totalVisibleGaussians);const g=l.acquire(n,h,this.produces);return this._gaussianSplatDepthCompositionParameters.splatDepth=f.getTexture(),g.attachDepth(e.getAttachment(x)),u.bindFramebuffer(g.fbo),u.bindTechnique(o,this.bindParameters,this._gaussianSplatDepthCompositionParameters),u.screen.draw(),this._gaussianSplatCompositionParameters.color=e.getTexture(),this._gaussianSplatCompositionParameters.splatColor=p.getTexture(),u.bindFramebuffer(g.fbo),u.bindTechnique(r,this.bindParameters,this._gaussianSplatCompositionParameters),u.screen.draw(),p.release(),f.release(),g}updateGaussianVisibility(t){this._visibleGaussianTiles=t,this._requestSort()}destroy(){this._workerHandle?.destroyWorkerAndSelf(),super.destroy()}updateTextureAtlas(t,e,s){this._textureAtlas?.updateData(0,t,e,u,1,s)}_ensureBufferCapacity(t){if(this._bufferCapacity<t){const s=Math.ceil(t*e);this._atlasIndicesBuffer=new Uint32Array(s),this._sortedAtlasIndicesBuffer=new Uint32Array(s),this._bufferCapacity=s}}_initializeTextures(){const t=new I;t.height=c,t.width=c,t.pixelFormat=36249,t.dataType=A.UNSIGNED_INT,t.internalFormat=j.RGBA32UI,t.samplingMode=9728,t.wrapMode=33071,this._textureAtlas=new D(this.renderingContext,t);const e=m(_);this._orderBuffer=new Uint32Array(e[0]*e[1]);const s=new I;s.height=e[0],s.width=e[1],s.pixelFormat=36244,s.dataType=A.UNSIGNED_INT,s.internalFormat=j.R32UI,s.wrapMode=33071,s.samplingMode=9728,this._orderTexture=new D(this.renderingContext,s)}_onCameraChange(){const t=this.view.state.camera.eye,e=this.view.state.camera.ray.direction,s=.001;(Math.abs(t[0]-this._previousCameraPosition[0])>s||Math.abs(t[1]-this._previousCameraPosition[1])>s||Math.abs(t[2]-this._previousCameraPosition[2])>s||Math.abs(e[0]-this._previousCameraDirection[0])>s||Math.abs(e[1]-this._previousCameraDirection[1])>s||Math.abs(e[2]-this._previousCameraDirection[2])>s)&&this._requestSort()}prepareHighPrecisionCameraPosition(){o(this._tempVec,this.camera.eye,1/k.tileSize),n(this._tempVec,this._tempVec),h(this._coarseCameraPosition,this._tempVec),this._gaussianSplatParameters.cameraPos8k=this._coarseCameraPosition,o(this._tempVec,this._tempVec,k.tileSize),l(this._cameraDelta,this.camera.eye,this._tempVec),this._gaussianSplatParameters.cameraDelta=this._cameraDelta}_requestSort(){this._isSorting?this._pendingSortTask=!0:(this._isSorting=!0,this._pendingSortTask=!1,this._sortOnWorker().then(()=>{this._isSorting=!1,this._pendingSortTask&&this._requestSort()}).catch(()=>{this._isSorting=!1,this._pendingSortTask&&this._requestSort()}))}async _sortOnWorker(){let t=0;for(let _=0;_<this._visibleGaussianTiles.length;_++)t+=this._visibleGaussianTiles[_].gaussianAtlasIndices.length;if(0===t||t>_)return;this._ensureBufferCapacity(t);const e=this.camera.ray.direction,s=e[0],i=e[1],a=e[2],r=1/Math.sqrt(s*s+i*i+a*a),o=s*r,n=i*r,h=a*r,l=this._atlasIndicesBuffer.subarray(0,t),p=new Float64Array(t);let u=0;for(let _=0;_<this._visibleGaussianTiles.length;_++){const t=this._visibleGaussianTiles[_],e=t.gaussianAtlasIndices,s=t.positions;for(let i=0;i<e.length;i++){l[u]=e[i];const t=3*i,a=s[t],r=s[t+1],c=s[t+2];p[u]=a*o+r*n+c*h,u++}}const c=new Uint32Array(t);for(let _=0;_<t;_++)c[_]=_;const m={distances:p,sortOrderIndices:c};await(this._workerHandle?.sort(m).then(e=>{const s=this._sortedAtlasIndicesBuffer.subarray(0,t);for(let i=0;i<t;i++)s[i]=l[e.sortedOrderIndices[i]];this._orderBuffer.set(s),this._orderTexture?.setData(this._orderBuffer),this._totalVisibleGaussians=t,this.requestRender(1)}))}};F=k=t([i("esri.views.3d.webgl-engine.lib.GaussianSplatRenderNode")],F);export{F as GaussianSplatRenderNode};
5
+ import{__decorate as t}from"tslib";import{reallocGrowthFactor as e}from"../../../../core/arrayUtils.js";import{watch as s}from"../../../../core/reactiveUtils.js";import"../../../../core/Logger.js";import"../../../../core/has.js";import"../../../../core/Error.js";import{subclass as i}from"../../../../core/accessorSupport/decorators/subclass.js";import{set as a}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{g as o,J as n,c as h,d as l}from"../../../../chunks/vec32.js";import{create as p}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{elementsPerSplatPage as u,splatAtlasTextureSize as c}from"../../../../layers/support/GaussianSplatAtlasPageAllocator.js";import{evalTextureSize as m,maxAllowedVisibleGaussians as _}from"../../../../layers/support/gaussianSplatUtils.js";import{RenderCategory as d}from"../../webgl.js";import{makeScheduleFunction as f}from"../../layers/support/makeScheduleFunction.js";import{GaussianSplatSortWorkerHandle as g}from"../../support/GaussianSplatWorkerHandle.js";import b from"../../webgl/RenderNode.js";import{G as S}from"../../../../chunks/GaussianSplat.glsl.js";import{G as C}from"../../../../chunks/GaussianSplatComposition.glsl.js";import{GaussianSplatCompositionTechnique as T}from"../shaders/GaussianSplatCompositionTechnique.js";import{G as w}from"../../../../chunks/GaussianSplatDepthComposition.glsl.js";import{GaussianSplatDepthCompositionTechnique as P}from"../shaders/GaussianSplatDepthCompositionTechnique.js";import{GaussianSplatDepthTechnique as y}from"../shaders/GaussianSplatDepthTechnique.js";import{GaussianSplatTechnique as G}from"../shaders/GaussianSplatTechnique.js";import{GaussianSplatTechniqueConfiguration as q}from"../shaders/GaussianSplatTechniqueConfiguration.js";import{DepthStencilAttachment as x,PrimitiveType as v,PixelType as A,SizedPixelFormat as j}from"../../../webgl/enums.js";import{Texture as D}from"../../../webgl/Texture.js";import{TextureDescriptor as I}from"../../../webgl/TextureDescriptor.js";var k;let F=class extends b{static{k=this}static{this.tileSize=2.048}constructor(t){super(t),this.produces=d.OPAQUE,this._gaussianSplatParameters=new S,this._gaussianSplatCompositionParameters=new C,this._gaussianSplatDepthCompositionParameters=new w,this._splatDepthTechniqueConfiguration=new q(!0),this._totalVisibleGaussians=0,this._orderTexture=null,this._textureAtlas=null,this._visibleGaussianTiles=new Array,this._workerHandle=null,this._isSorting=!1,this._pendingSortTask=!1,this._bufferCapacity=0,this._previousCameraPosition=p(),this._previousCameraDirection=p(),this._tanFov=r(),this._tempVec=p(),this._cameraDelta=p(),this._coarseCameraPosition=p()}async initialize(){this._initializeTextures(),this.addHandles([s(()=>this.view.state.camera,()=>this._onCameraChange())]);const{resourceController:t}=this.view;this._workerHandle=new g(f(t))}precompile(){this.techniques.precompile(G),this.techniques.precompile(y,this._splatDepthTechniqueConfiguration),this.techniques.precompile(T),this.techniques.precompile(P)}render(t){const e=t.find(({name:t})=>t===d.OPAQUE),s=this.techniques.get(G),i=this.techniques.get(y,this._splatDepthTechniqueConfiguration),r=this.techniques.get(T),o=this.techniques.get(P);if(!(s.compiled&&i.compiled&&o.compiled&&r.compiled))return this.requestRender(1),e;const{fullWidth:n,fullHeight:h}=this.bindParameters.camera,l=this.fboCache,p=l.acquire(n,h,"gaussianColorOutput");p.attachDepth(e.getAttachment(x));const u=this.renderingContext;u.bindFramebuffer(p.fbo),u.setClearColor(0,0,0,0),u.clear(16384),this._gaussianSplatParameters.totalGaussians=this._totalVisibleGaussians,this._gaussianSplatParameters.splatOrder=this._orderTexture,this._gaussianSplatParameters.splatAtlas=this._textureAtlas;const c=Math.tan(.5*this.camera.fovY),m=c/h*n;a(this._tanFov,m,c);const _=h/(2*c);this._gaussianSplatParameters.focalLength=_,this._gaussianSplatParameters.tanFov=this._tanFov,this.prepareHighPrecisionCameraPosition(),this.renderingContext.bindTechnique(s,this.bindParameters,this._gaussianSplatParameters),this.renderingContext.drawArraysInstanced(v.TRIANGLE_STRIP,0,4,this._totalVisibleGaussians);const f=l.acquire(n,h,"splat depth",8);f.attachDepth(e.getAttachment(x)),u.bindFramebuffer(f.fbo),u.setClearColor(0,0,0,0),u.clear(16384),this.renderingContext.bindTechnique(i,this.bindParameters,this._gaussianSplatParameters),this.renderingContext.drawArraysInstanced(v.TRIANGLE_STRIP,0,4,this._totalVisibleGaussians);const g=l.acquire(n,h,this.produces);return this._gaussianSplatDepthCompositionParameters.splatDepth=f.getTexture(),g.attachDepth(e.getAttachment(x)),u.bindFramebuffer(g.fbo),u.bindTechnique(o,this.bindParameters,this._gaussianSplatDepthCompositionParameters),u.screen.draw(),this._gaussianSplatCompositionParameters.color=e.getTexture(),this._gaussianSplatCompositionParameters.splatColor=p.getTexture(),u.bindFramebuffer(g.fbo),u.bindTechnique(r,this.bindParameters,this._gaussianSplatCompositionParameters),u.screen.draw(),p.release(),f.release(),g}updateGaussianVisibility(t){this._visibleGaussianTiles=t,this._requestSort()}destroy(){this._workerHandle?.destroyWorkerAndSelf(),super.destroy()}updateTextureAtlas(t,e,s){this._textureAtlas?.updateData(0,t,e,u,1,s)}_ensureBufferCapacity(t){if(this._bufferCapacity<t){const s=Math.ceil(t*e);this._atlasIndicesBuffer=new Uint32Array(s),this._sortedAtlasIndicesBuffer=new Uint32Array(s),this._bufferCapacity=s}}_initializeTextures(){const t=new I;t.height=c,t.width=c,t.pixelFormat=36249,t.dataType=A.UNSIGNED_INT,t.internalFormat=j.RGBA32UI,t.samplingMode=9728,t.wrapMode=33071,this._textureAtlas=new D(this.renderingContext,t);const e=m(_);this._orderBuffer=new Uint32Array(e[0]*e[1]);const s=new I;s.height=e[0],s.width=e[1],s.pixelFormat=36244,s.dataType=A.UNSIGNED_INT,s.internalFormat=j.R32UI,s.wrapMode=33071,s.samplingMode=9728,this._orderTexture=new D(this.renderingContext,s)}_onCameraChange(){const t=this.view.state.camera.eye,e=this.view.state.camera.ray.direction,s=.001;(Math.abs(t[0]-this._previousCameraPosition[0])>s||Math.abs(t[1]-this._previousCameraPosition[1])>s||Math.abs(t[2]-this._previousCameraPosition[2])>s||Math.abs(e[0]-this._previousCameraDirection[0])>s||Math.abs(e[1]-this._previousCameraDirection[1])>s||Math.abs(e[2]-this._previousCameraDirection[2])>s)&&this._requestSort()}prepareHighPrecisionCameraPosition(){o(this._tempVec,this.camera.eye,1/k.tileSize),n(this._tempVec,this._tempVec),h(this._coarseCameraPosition,this._tempVec),this._gaussianSplatParameters.cameraPos8k=this._coarseCameraPosition,o(this._tempVec,this._tempVec,k.tileSize),l(this._cameraDelta,this.camera.eye,this._tempVec),this._gaussianSplatParameters.cameraDelta=this._cameraDelta}_requestSort(){this._isSorting?this._pendingSortTask=!0:(this._isSorting=!0,this._pendingSortTask=!1,this._sortOnWorker().then(()=>{this._isSorting=!1,this._pendingSortTask&&this._requestSort()}).catch(()=>{this._isSorting=!1,this._pendingSortTask&&this._requestSort()}))}async _sortOnWorker(){let t=0;for(let _=0;_<this._visibleGaussianTiles.length;_++)t+=this._visibleGaussianTiles[_].gaussianAtlasIndices.length;if(0===t||t>_)return;this._ensureBufferCapacity(t);const e=this.camera.ray.direction,s=e[0],i=e[1],a=e[2],r=1/Math.sqrt(s*s+i*i+a*a),o=s*r,n=i*r,h=a*r,l=this._atlasIndicesBuffer.subarray(0,t),p=new Float64Array(t);let u=0;for(let _=0;_<this._visibleGaussianTiles.length;_++){const t=this._visibleGaussianTiles[_],e=t.gaussianAtlasIndices,s=t.positions;for(let i=0;i<e.length;i++){l[u]=e[i];const t=3*i,a=s[t],r=s[t+1],c=s[t+2];p[u]=a*o+r*n+c*h,u++}}const c=new Uint32Array(t);for(let _=0;_<t;_++)c[_]=_;const m={distances:p,sortOrderIndices:c};await(this._workerHandle?.sort(m).then(e=>{const s=this._sortedAtlasIndicesBuffer.subarray(0,t);for(let i=0;i<t;i++)s[i]=l[e.sortedOrderIndices[i]];this._orderBuffer.set(s),this._orderTexture?.setData(this._orderBuffer),this._totalVisibleGaussians=t,this.requestRender(1)}))}};F=k=t([i("esri.views.3d.webgl-engine.lib.GaussianSplatRenderNode")],F);export{F as GaussianSplatRenderNode};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{releaseMaybe as e}from"../../../../core/maybe.js";import{d as t}from"../../../../chunks/vec42.js";import{ZEROS as i}from"../../../../core/libs/gl-matrix-2/factories/vec4f32.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{ViewportSize as r}from"./BindParameters.js";import{ColorAttachment1 as o}from"../../../webgl/enums.js";import{ensureAttachmentMaxSize as h}from"../../../webgl/FramebufferObject.js";class c{constructor(e){this._fbos=e,this._requiresEmission=!1,this._size=new r(0,0),this._clearColor=s()}dispose(){this._color=e(this._color),this.releaseDepth()}initialize(e,i,s,r){this._size.width=e,this._size.height=i,h(this._size,this._fbos.rctx.parameters.maxTextureSize);const o=this._color;return this._color=null,this.releaseDepth(),this._requiresEmission=r,t(this._clearColor,s),o}releaseDepth(){this._color?.detachDepth(),this._depth=e(this._depth)}update(e){const t=this._ensureColor();t.attachDepth(this.depth),this._color=e(t)}bind(){const{rctx:e}=this._fbos,t=null==this._color;this.color.attachDepth(this.depth),e.bindFramebuffer(this.color.fbo),t&&(e.setClearStencil(0),e.setClearColor(this._clearColor[0],this._clearColor[1],this._clearColor[2],this._clearColor[3]),e.clear(17664),this._requiresEmission&&e.clearBuffer(1,i))}_acquireColor(){return this._requiresEmission?this._fbos.acquire(this._size.width,this._size.height,"acquired-color").acquireColor(o,8,"emissive"):this._fbos.acquire(this._size.width,this._size.height,"acquired-color")}_acquireDepth(){return this._fbos.acquireDepth(12,this._size.width,this._size.height,"depth")}get size(){return this._size}get color(){return this._ensureColor()}get depth(){return this._depth??=this._acquireDepth(),this._depth}_ensureColor(){return this._color??=this._acquireColor(),this._color}}export{c as MainFramebuffer};
5
+ import{releaseMaybe as e}from"../../../../core/maybe.js";import{d as i}from"../../../../chunks/vec42.js";import{ZEROS as t}from"../../../../core/libs/gl-matrix-2/factories/vec4f32.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{ViewportSize as r}from"./BindParameters.js";import{ColorAttachment1 as o}from"../../../webgl/enums.js";import{ensureAttachmentMaxSize as h}from"../../../webgl/FramebufferObject.js";class l{constructor(e){this._fbos=e,this._requiresEmission=!1,this._size=new r(0,0),this._clearColor=s()}dispose(){this._color=e(this._color),this.releaseDepth()}initialize(e,t,s,r){this._size.width=e,this._size.height=t,h(this._size,this._fbos.rctx.parameters.maxTextureSize);const o=this._color;return this._color=null,this.releaseDepth(),this._requiresEmission=r,i(this._clearColor,s),o}releaseDepth(){this._color?.detachDepth(),this._depth=e(this._depth)}update(e){const i=this._ensureColor();i.attachDepth(this.depth),this._color=e(i)}bind(){const{rctx:e}=this._fbos,i=null==this._color;this.color.attachDepth(this.depth),e.bindFramebuffer(this.color.fbo),i&&(e.setClearStencil(0),e.setClearColor(this._clearColor[0],this._clearColor[1],this._clearColor[2],this._clearColor[3]),e.clear(17664),this._requiresEmission&&e.clearBuffer(1,t))}_acquireColor(){return this._requiresEmission?this._fbos.acquire(this._size.width,this._size.height,"main color").acquireColor(o,8,"emissive"):this._fbos.acquire(this._size.width,this._size.height,"main color")}_acquireDepth(){return this._fbos.acquireDepth(12,this._size.width,this._size.height,"main depth")}get size(){return this._size}get color(){return this._ensureColor()}get depth(){return this._depth??=this._acquireDepth(),this._depth}_ensureColor(){return this._color??=this._acquireColor(),this._color}}export{l as MainFramebuffer};