@arcgis/core 4.23.0-next.20220127 → 4.23.0-next.20220131

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 (404) hide show
  1. package/assets/esri/core/workers/RemoteClient.js +1 -1
  2. package/assets/esri/core/workers/chunks/0463ba46df855a92b9c0.js +1 -0
  3. package/assets/esri/core/workers/chunks/{8001b0e514bfffe9d7f8.js → 0c15d77d8e817cf45a9a.js} +1 -1
  4. package/assets/esri/core/workers/chunks/{e657ba0cab29f05d02da.js → 0cd0a6eef51fc5b9ea61.js} +1 -1
  5. package/assets/esri/core/workers/chunks/{e4896cf85fb2da8a9cc7.js → 17de7a324dfa7f57ad5d.js} +1 -1
  6. package/assets/esri/core/workers/chunks/{c36f84daa7736878418d.js → 197ec52641aed20029c6.js} +1 -1
  7. package/assets/esri/core/workers/chunks/{0317f37b6c8705b363fd.js → 1c733b7db092a2a88ef3.js} +1 -1
  8. package/assets/esri/core/workers/chunks/{9387db408f496e7dd003.js → 214910032945dd2d86b0.js} +1 -1
  9. package/assets/esri/core/workers/chunks/{d835b2a683fcd8aeeed8.js → 27474b007988855bea9d.js} +1 -1
  10. package/assets/esri/core/workers/chunks/{e93dfdede0532a89ffa5.js → 2b25fc7945a187c2bb9d.js} +1 -1
  11. package/assets/esri/core/workers/chunks/{5948923e07bd1662c24a.js → 37c03cfc19086ce631c6.js} +1 -1
  12. package/assets/esri/core/workers/chunks/44f0c3663b293afbd172.js +1 -0
  13. package/assets/esri/core/workers/chunks/483d5d8593d96d0f0b15.js +1 -0
  14. package/assets/esri/core/workers/chunks/49a1a633bb0d93764aae.js +1 -0
  15. package/assets/esri/core/workers/chunks/{5f1dcb6556820cd0aa31.js → 4be35af7d6babbfe9d84.js} +1 -1
  16. package/assets/esri/core/workers/chunks/{f9ff3eaf4eb324429fbd.js → 5457962a70bd3c557a75.js} +1 -1
  17. package/assets/esri/core/workers/chunks/56657f890e0f79f5d2ad.js +1 -0
  18. package/assets/esri/core/workers/chunks/57856b4a9b8784a69844.js +1 -0
  19. package/assets/esri/core/workers/chunks/{56274b37ff74ca0d68a6.js → 5d11b97b667921d67ae7.js} +1 -1
  20. package/assets/esri/core/workers/chunks/{ba5eb394f098968c22d2.js → 655b55ac0cd533d7e9d7.js} +1 -1
  21. package/assets/esri/core/workers/chunks/70d6bb3c7112cb702389.js +1 -0
  22. package/assets/esri/core/workers/chunks/810a763373d7f78ae398.js +1 -0
  23. package/assets/esri/core/workers/chunks/918bb7a7d901544a7367.js +1 -0
  24. package/assets/esri/core/workers/chunks/949b2269457302ffc64b.js +1 -0
  25. package/assets/esri/core/workers/chunks/{601e697dc7414bda128a.js → 952980635afc7ec81804.js} +1 -1
  26. package/assets/esri/core/workers/chunks/{e8741bf421f80213f1d3.js → 9876a1bae350795fab36.js} +1 -1
  27. package/assets/esri/core/workers/chunks/99619fcb772807c74f3b.js +1 -0
  28. package/assets/esri/core/workers/chunks/{3f343f792fd9f44d6f25.js → b3f5e91116112b0b612a.js} +1 -1
  29. package/assets/esri/core/workers/chunks/{9d77467aa71d345fc1b6.js → bcc01bbffaa3bb5f60a8.js} +1 -1
  30. package/assets/esri/core/workers/chunks/{4c76146014dc15143ba3.js → be588873c16770ceb9ef.js} +1 -1
  31. package/assets/esri/core/workers/chunks/d1fe53b597351dc58305.js +1 -0
  32. package/assets/esri/core/workers/chunks/d98dab12b71912fa397b.js +1 -0
  33. package/assets/esri/core/workers/chunks/{b62e3dccd9f662c0afeb.js → db3c729ce0c0b2690dc9.js} +1 -1
  34. package/assets/esri/core/workers/chunks/{199670a3a564ebe3bd79.js → e218bde41ffbcc5194f5.js} +1 -1
  35. package/assets/esri/core/workers/chunks/e21b211913aefde47e30.js +1 -0
  36. package/assets/esri/core/workers/chunks/{c9cbf8135e95f0f42cd9.js → e287f49184d076af17e2.js} +1 -1
  37. package/assets/esri/core/workers/chunks/{bde1d5b0a7717350986e.js → e4019b63a1fe74e2c842.js} +1 -1
  38. package/assets/esri/core/workers/chunks/{6e6a3c5866e8d8820457.js → eb82ff10cef2bde6e57f.js} +1 -1
  39. package/assets/esri/core/workers/chunks/ebc6f4764b82d4104c65.js +1 -0
  40. package/assets/esri/core/workers/chunks/{842db82733635dbf25cb.js → ee6e0db58dc64410e687.js} +1 -1
  41. package/assets/esri/core/workers/chunks/f0a9f161805fc7a30fc5.js +1 -0
  42. package/assets/esri/core/workers/chunks/f7150547d7e3259a0f29.js +981 -0
  43. package/assets/esri/core/workers/chunks/fc046a15466c25d081ff.js +1 -0
  44. package/assets/esri/images/portal/mediaservice16.png +0 -0
  45. package/assets/esri/libs/vxl/vxlLayer.wasm +0 -0
  46. package/assets/esri/widgets/Directions/t9n/Directions.json +1 -1
  47. package/assets/esri/widgets/Directions/t9n/Directions_ar.json +1 -1
  48. package/assets/esri/widgets/Directions/t9n/Directions_bg.json +1 -1
  49. package/assets/esri/widgets/Directions/t9n/Directions_bs.json +1 -1
  50. package/assets/esri/widgets/Directions/t9n/Directions_ca.json +1 -1
  51. package/assets/esri/widgets/Directions/t9n/Directions_cs.json +1 -1
  52. package/assets/esri/widgets/Directions/t9n/Directions_da.json +1 -1
  53. package/assets/esri/widgets/Directions/t9n/Directions_de.json +1 -1
  54. package/assets/esri/widgets/Directions/t9n/Directions_el.json +1 -1
  55. package/assets/esri/widgets/Directions/t9n/Directions_en.json +1 -1
  56. package/assets/esri/widgets/Directions/t9n/Directions_es.json +1 -1
  57. package/assets/esri/widgets/Directions/t9n/Directions_et.json +1 -1
  58. package/assets/esri/widgets/Directions/t9n/Directions_fi.json +1 -1
  59. package/assets/esri/widgets/Directions/t9n/Directions_fr.json +1 -1
  60. package/assets/esri/widgets/Directions/t9n/Directions_he.json +1 -1
  61. package/assets/esri/widgets/Directions/t9n/Directions_hr.json +1 -1
  62. package/assets/esri/widgets/Directions/t9n/Directions_hu.json +1 -1
  63. package/assets/esri/widgets/Directions/t9n/Directions_id.json +1 -1
  64. package/assets/esri/widgets/Directions/t9n/Directions_it.json +1 -1
  65. package/assets/esri/widgets/Directions/t9n/Directions_ja.json +1 -1
  66. package/assets/esri/widgets/Directions/t9n/Directions_ko.json +1 -1
  67. package/assets/esri/widgets/Directions/t9n/Directions_lt.json +1 -1
  68. package/assets/esri/widgets/Directions/t9n/Directions_lv.json +1 -1
  69. package/assets/esri/widgets/Directions/t9n/Directions_nb.json +1 -1
  70. package/assets/esri/widgets/Directions/t9n/Directions_nl.json +1 -1
  71. package/assets/esri/widgets/Directions/t9n/Directions_pl.json +1 -1
  72. package/assets/esri/widgets/Directions/t9n/Directions_pt-BR.json +1 -1
  73. package/assets/esri/widgets/Directions/t9n/Directions_pt-PT.json +1 -1
  74. package/assets/esri/widgets/Directions/t9n/Directions_ro.json +1 -1
  75. package/assets/esri/widgets/Directions/t9n/Directions_ru.json +1 -1
  76. package/assets/esri/widgets/Directions/t9n/Directions_sk.json +1 -1
  77. package/assets/esri/widgets/Directions/t9n/Directions_sl.json +1 -1
  78. package/assets/esri/widgets/Directions/t9n/Directions_sr.json +1 -1
  79. package/assets/esri/widgets/Directions/t9n/Directions_sv.json +1 -1
  80. package/assets/esri/widgets/Directions/t9n/Directions_th.json +1 -1
  81. package/assets/esri/widgets/Directions/t9n/Directions_tr.json +1 -1
  82. package/assets/esri/widgets/Directions/t9n/Directions_uk.json +1 -1
  83. package/assets/esri/widgets/Directions/t9n/Directions_vi.json +1 -1
  84. package/assets/esri/widgets/Directions/t9n/Directions_zh-CN.json +1 -1
  85. package/assets/esri/widgets/Directions/t9n/Directions_zh-HK.json +1 -1
  86. package/assets/esri/widgets/Directions/t9n/Directions_zh-TW.json +1 -1
  87. package/chunks/BlendLayers.glsl.js +2 -2
  88. package/chunks/ChapmanAtmosphere.glsl.js +17 -17
  89. package/chunks/CheckerBoard.glsl.js +3 -3
  90. package/chunks/Clouds.glsl.js +2 -2
  91. package/chunks/CloudsComposition.glsl.js +1 -1
  92. package/chunks/ColorMaterial.glsl.js +12 -12
  93. package/chunks/ComponentShader.glsl.js +3 -3
  94. package/chunks/Compositing.glsl.js +1 -1
  95. package/chunks/DefaultMaterial.glsl.js +33 -33
  96. package/chunks/EdgeShaderProgram.glsl.js +7 -7
  97. package/chunks/Fog.glsl.js +10 -12
  98. package/chunks/HUDMaterial.glsl.js +2 -2
  99. package/chunks/HighlightComposition.glsl.js +5 -5
  100. package/chunks/ImageMaterial.glsl.js +6 -6
  101. package/chunks/LaserlinePath.glsl.js +8 -8
  102. package/chunks/LineCallout.glsl.js +6 -6
  103. package/chunks/MeasurementArrow.glsl.js +1 -1
  104. package/chunks/NativeLine.glsl.js +1 -1
  105. package/chunks/Path.glsl.js +5 -5
  106. package/chunks/Pattern.glsl.js +9 -9
  107. package/chunks/PointRenderer.glsl.js +14 -14
  108. package/chunks/Precipitation.glsl.js +2 -2
  109. package/chunks/RealisticTree.glsl.js +21 -21
  110. package/chunks/RibbonLine.glsl.js +11 -11
  111. package/chunks/SMAA.glsl.js +40 -40
  112. package/chunks/ShadedColorMaterial.glsl.js +12 -12
  113. package/chunks/ShadowCast.glsl.js +6 -6
  114. package/chunks/ShadowHighlight.glsl.js +4 -4
  115. package/chunks/SimpleAtmosphere.glsl.js +3 -3
  116. package/chunks/SlicePlaneMaterial.glsl.js +3 -3
  117. package/chunks/Stars.glsl.js +3 -3
  118. package/chunks/Terrain.glsl.js +11 -11
  119. package/chunks/TextureOnly.glsl.js +2 -2
  120. package/chunks/WaterSurface.glsl.js +5 -5
  121. package/chunks/boundedPlane.js +1 -1
  122. package/core/accessorSupport/watch.js +1 -1
  123. package/core/loadAll.js +1 -1
  124. package/geometry/support/frustum.js +1 -1
  125. package/geometry/support/plane.js +1 -1
  126. package/interfaces.d.ts +653 -55
  127. package/layers/RouteLayer.d.ts +4 -0
  128. package/layers/RouteLayer.js +1 -1
  129. package/layers/VectorTileLayer.js +1 -1
  130. package/layers/graphics/controllers/I3SOnDemandController.js +1 -1
  131. package/layers/graphics/featureConversionUtils.js +1 -1
  132. package/layers/support/LayerContingentValuesCache.js +1 -1
  133. package/layers/support/TileInfo.js +1 -1
  134. package/package.json +1 -1
  135. package/portal/PortalItem.js +1 -1
  136. package/rest/support/DirectionLine.d.ts +4 -0
  137. package/rest/support/DirectionPoint.d.ts +4 -0
  138. package/rest/support/RouteInfo.d.ts +4 -0
  139. package/rest/support/RouteInfo.js +1 -1
  140. package/rest/support/RouteSolveResult.d.ts +4 -0
  141. package/smartMapping/statistics/support/predominanceUtils.d.ts +4 -0
  142. package/support/revision.js +1 -1
  143. package/symbols/FillSymbol3DLayer.js +1 -1
  144. package/symbols/IconSymbol3DLayer.js +1 -1
  145. package/symbols/ObjectSymbol3DLayer.js +1 -1
  146. package/symbols/Symbol3D.js +1 -1
  147. package/symbols/WebStyleSymbol.js +1 -1
  148. package/symbols/cim/CIMSymbolRasterizer.js +1 -1
  149. package/symbols/support/IconSymbol3DLayerResource.js +1 -1
  150. package/symbols/support/ObjectSymbol3DLayerResource.js +1 -1
  151. package/symbols/support/Symbol3DAnchorPosition2D.js +1 -1
  152. package/symbols/support/Symbol3DAnchorPosition3D.js +1 -1
  153. package/symbols/support/Symbol3DFillMaterial.js +1 -1
  154. package/symbols/support/Symbol3DIconOutline.js +1 -1
  155. package/symbols/support/Symbol3DOutline.js +1 -1
  156. package/symbols/support/Thumbnail.js +1 -1
  157. package/symbols/support/webStyleSymbolUtils.js +1 -1
  158. package/views/2d/engine/vectorTiles/SchemaHelper.js +1 -1
  159. package/views/2d/layers/RouteLayerView2D.js +1 -1
  160. package/views/3d/environment/ChapmanAtmosphere.glsl.js +1 -1
  161. package/views/3d/environment/ChapmanAtmosphere.js +1 -1
  162. package/views/3d/environment/CloudsComposition.glsl.js +1 -1
  163. package/views/3d/environment/CloudsComposition.js +1 -1
  164. package/views/3d/environment/CloudsGenerator.js +1 -1
  165. package/views/3d/environment/Fog.glsl.js +1 -1
  166. package/views/3d/environment/Fog.js +1 -1
  167. package/views/3d/environment/NoiseTextureAtlas.js +1 -1
  168. package/views/3d/environment/PanoramicAtmosphere.js +1 -1
  169. package/views/3d/environment/Precipitation.glsl.js +1 -1
  170. package/views/3d/environment/Precipitation.js +1 -1
  171. package/views/3d/environment/PrecipitationTechnique.js +1 -1
  172. package/views/3d/environment/SimpleAtmosphere.glsl.js +1 -1
  173. package/views/3d/environment/SimpleAtmosphere.js +1 -1
  174. package/views/3d/environment/Stars.glsl.js +1 -1
  175. package/views/3d/environment/Stars.js +1 -1
  176. package/views/3d/interactive/analysisTools/slice/sliceToolUtils.js +1 -1
  177. package/views/3d/interactive/visualElements/ExtendedLineVisualElement.js +1 -1
  178. package/views/3d/interactive/visualElements/MeasurementAreaVisualElement.js +1 -1
  179. package/views/3d/interactive/visualElements/OutlineVisualElement.js +1 -1
  180. package/views/3d/interactive/visualElements/ParallelLineVisualElement.js +1 -1
  181. package/views/3d/interactive/visualElements/PointVisualElement.js +1 -1
  182. package/views/3d/interactive/visualElements/RightAngleQuadVisualElement.js +1 -1
  183. package/views/3d/layers/FeatureLayerViewBase3D.js +1 -1
  184. package/views/3d/layers/FeatureLikeLayerView3D.js +1 -1
  185. package/views/3d/layers/I3SMeshView3D.js +1 -1
  186. package/views/3d/layers/VectorTileLayerView3D.js +1 -1
  187. package/views/3d/layers/graphics/Deconflictor.js +1 -1
  188. package/views/3d/layers/graphics/ElevationAligners.js +1 -1
  189. package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
  190. package/views/3d/layers/graphics/Graphics3DFeatureProcessor.js +1 -1
  191. package/views/3d/layers/graphics/Graphics3DLineCalloutSymbolLayer.js +1 -1
  192. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  193. package/views/3d/layers/graphics/Graphics3DObjectSymbolLayer.js +1 -1
  194. package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.js +1 -1
  195. package/views/3d/layers/graphics/graphicUtils.js +1 -1
  196. package/views/3d/layers/graphics/lineUtils.js +1 -1
  197. package/views/3d/layers/graphics/objectResourceUtils.js +1 -1
  198. package/views/3d/layers/graphics/polygonUtils.js +1 -1
  199. package/views/3d/layers/graphics/symbolComplexity.js +1 -1
  200. package/views/3d/layers/i3s/I3SBinaryReader.js +1 -1
  201. package/views/3d/layers/i3s/I3SCrossfadeHelper.js +1 -1
  202. package/views/3d/layers/i3s/I3SIndex.js +1 -1
  203. package/views/3d/layers/i3s/I3SMaterialUtil.js +1 -1
  204. package/views/3d/layers/i3s/I3SViewportQueries.js +1 -1
  205. package/views/3d/layers/i3s/PointRenderer.js +1 -1
  206. package/views/3d/layers/support/HeatmapFeatureProcessor.js +5 -0
  207. package/views/3d/layers/support/overlayImageUtils.js +1 -1
  208. package/views/3d/layers/support/patternUtils.js +1 -1
  209. package/views/3d/state/controllers/local/PinchAndPanController.js +1 -1
  210. package/views/3d/support/FrustumExtentIntersection.js +1 -1
  211. package/views/3d/support/LaserLineRenderer.js +1 -1
  212. package/views/3d/support/LaserlinePathData.js +1 -1
  213. package/views/3d/terrain/OverlayRenderer.js +1 -1
  214. package/views/3d/terrain/PatchGeometryFactory.js +1 -1
  215. package/views/3d/terrain/TerrainRenderer.js +1 -1
  216. package/views/3d/terrain/TerrainSurface.js +1 -1
  217. package/views/3d/terrain/Tile.js +1 -1
  218. package/views/3d/terrain/TileRenderer.js +1 -1
  219. package/views/3d/terrain/terrainUtils.js +1 -1
  220. package/views/3d/terrain/tileUtils.js +1 -1
  221. package/views/3d/webgl-engine/collections/Component/ComponentObjectCollection.js +1 -1
  222. package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
  223. package/views/3d/webgl-engine/collections/Component/Material/ComponentTechnique.js +1 -1
  224. package/views/3d/webgl-engine/collections/Component/Material/shader/ComponentData.glsl.js +10 -10
  225. package/views/3d/webgl-engine/collections/Component/Material/shader/ComponentShader.glsl.js +1 -1
  226. package/views/3d/webgl-engine/collections/Component/SourceGeometry.js +1 -1
  227. package/views/3d/webgl-engine/core/renderPasses/AllRenderPasses.js +1 -1
  228. package/views/3d/webgl-engine/core/renderPasses/RenderPass.js +1 -1
  229. package/views/3d/webgl-engine/core/renderPasses/RenderPassManager.js +1 -1
  230. package/views/3d/webgl-engine/core/shaderLibrary/ForwardLinearDepth.glsl.js +2 -2
  231. package/views/3d/webgl-engine/core/shaderLibrary/ScreenSizeScaling.glsl.js +2 -2
  232. package/views/3d/webgl-engine/core/shaderLibrary/ScreenSpacePass.js +2 -2
  233. package/views/3d/webgl-engine/core/shaderLibrary/attributes/InstancedDoublePrecision.glsl.js +2 -2
  234. package/views/3d/webgl-engine/core/shaderLibrary/attributes/NormalAttribute.glsl.js +4 -4
  235. package/views/3d/webgl-engine/core/shaderLibrary/attributes/PathVertexPosition.glsl.js +1 -1
  236. package/views/3d/webgl-engine/core/shaderLibrary/attributes/PositionAttribute.glsl.js +1 -1
  237. package/views/3d/webgl-engine/core/shaderLibrary/attributes/RibbonVertexPosition.glsl.js +1 -1
  238. package/views/3d/webgl-engine/core/shaderLibrary/attributes/SymbolColor.glsl.js +1 -1
  239. package/views/3d/webgl-engine/core/shaderLibrary/attributes/TextureCoordinateAttribute.glsl.js +3 -3
  240. package/views/3d/webgl-engine/core/shaderLibrary/attributes/VertexColor.glsl.js +1 -1
  241. package/views/3d/webgl-engine/core/shaderLibrary/attributes/VertexNormal.glsl.js +6 -6
  242. package/views/3d/webgl-engine/core/shaderLibrary/attributes/VertexPosition.glsl.js +12 -12
  243. package/views/3d/webgl-engine/core/shaderLibrary/attributes/VertexTextureCoordinates.glsl.js +4 -4
  244. package/views/3d/webgl-engine/core/shaderLibrary/attributes/VerticalOffset.glsl.js +1 -1
  245. package/views/3d/webgl-engine/core/shaderLibrary/default/DefaultMaterialAuxiliaryPasses.glsl.js +16 -16
  246. package/views/3d/webgl-engine/core/shaderLibrary/default/RealisticTree.glsl.js +1 -1
  247. package/views/3d/webgl-engine/core/shaderLibrary/hud/HUD.glsl.js +5 -5
  248. package/views/3d/webgl-engine/core/shaderLibrary/hud/HUDOcclusionPass.glsl.js +3 -3
  249. package/views/3d/webgl-engine/core/shaderLibrary/raster/BasicGrid.glsl.js +2 -2
  250. package/views/3d/webgl-engine/core/shaderLibrary/shading/ComputeMaterialColor.glsl.js +6 -6
  251. package/views/3d/webgl-engine/core/shaderLibrary/shading/ComputeNormalTexture.glsl.js +2 -2
  252. package/views/3d/webgl-engine/core/shaderLibrary/shading/ComputeShadingNormal.glsl.js +10 -11
  253. package/views/3d/webgl-engine/core/shaderLibrary/shading/LineStipple.glsl.js +2 -2
  254. package/views/3d/webgl-engine/core/shaderLibrary/shading/MultipassGeometryTest.glsl.js +2 -2
  255. package/views/3d/webgl-engine/core/shaderLibrary/shading/MultipassTerrainTest.glsl.js +2 -2
  256. package/views/3d/webgl-engine/core/shaderLibrary/shading/Normals.glsl.js +6 -6
  257. package/views/3d/webgl-engine/core/shaderLibrary/shading/ReadBaseColorTexture.glsl.js +4 -4
  258. package/views/3d/webgl-engine/core/shaderLibrary/shading/ReadShadowMap.glsl.js +6 -6
  259. package/views/3d/webgl-engine/core/shaderLibrary/shading/Reprojection.glsl.js +4 -4
  260. package/views/3d/webgl-engine/core/shaderLibrary/shading/ScreenSpaceReflections.glsl.js +5 -5
  261. package/views/3d/webgl-engine/core/shaderLibrary/shading/VisualVariables.glsl.js +1 -1
  262. package/views/3d/webgl-engine/core/shaderLibrary/shading/Water.glsl.js +10 -10
  263. package/views/3d/webgl-engine/core/shaderLibrary/terrain/Terrain.glsl.js +1 -1
  264. package/views/3d/webgl-engine/core/shaderLibrary/util/BlendLayers.glsl.js +1 -1
  265. package/views/3d/webgl-engine/core/shaderLibrary/util/CloudsParallaxShading.glsl.js +4 -4
  266. package/views/3d/webgl-engine/core/shaderLibrary/util/View.glsl.js +1 -1
  267. package/views/3d/webgl-engine/lib/Camera.js +1 -1
  268. package/views/3d/webgl-engine/lib/CompositingHelper.js +1 -1
  269. package/views/3d/webgl-engine/lib/DefaultVertexAttributeLocations.js +1 -1
  270. package/views/3d/webgl-engine/lib/DefaultVertexBufferLayouts.js +1 -1
  271. package/views/3d/webgl-engine/lib/Geometry.js +1 -1
  272. package/views/3d/webgl-engine/lib/GeometryUtil.js +1 -1
  273. package/views/3d/webgl-engine/lib/GridLocalOriginFactory.js +1 -1
  274. package/views/3d/webgl-engine/lib/HighlightHelper.js +1 -1
  275. package/views/3d/webgl-engine/lib/MagnifierHelper.js +1 -1
  276. package/views/3d/webgl-engine/lib/Material.js +1 -1
  277. package/views/3d/webgl-engine/lib/RenderGeometry.js +1 -1
  278. package/views/3d/webgl-engine/lib/RenderingContext.js +1 -1
  279. package/views/3d/webgl-engine/lib/SSAOHelper.js +1 -1
  280. package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
  281. package/views/3d/webgl-engine/lib/ShadowCastRenderer.js +1 -1
  282. package/views/3d/webgl-engine/lib/ShadowHighlightHelper.js +1 -1
  283. package/views/3d/webgl-engine/lib/ShadowMap.js +1 -1
  284. package/views/3d/webgl-engine/lib/SmaaRenderPass.js +1 -1
  285. package/views/3d/webgl-engine/lib/TextTextureAtlas.js +1 -1
  286. package/views/3d/webgl-engine/lib/Texture.js +1 -1
  287. package/views/3d/webgl-engine/lib/TextureUniformName.js +4 -0
  288. package/views/3d/webgl-engine/lib/UniformName.js +4 -0
  289. package/views/3d/webgl-engine/lib/VertexAttribute.js +5 -0
  290. package/views/3d/webgl-engine/lib/basicInterfaces.js +1 -1
  291. package/views/3d/webgl-engine/lib/depthRangeUtils.js +1 -1
  292. package/views/3d/webgl-engine/lib/edgeRendering/EdgeRenderer.js +1 -1
  293. package/views/3d/webgl-engine/lib/edgeRendering/EdgeShaderTechnique.js +1 -1
  294. package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
  295. package/views/3d/webgl-engine/lib/edgeRendering/bufferLayouts.js +1 -1
  296. package/views/3d/webgl-engine/lib/lodRendering/InstanceData.js +1 -1
  297. package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
  298. package/views/3d/webgl-engine/lib/lodRendering/RenderInstanceData.js +1 -1
  299. package/views/3d/webgl-engine/lib/pathGeometryUtils.js +1 -1
  300. package/views/3d/webgl-engine/materials/CheckerBoardMaterial.js +1 -1
  301. package/views/3d/webgl-engine/materials/ColorMaterial.js +1 -1
  302. package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
  303. package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
  304. package/views/3d/webgl-engine/materials/ImageMaterial.js +1 -1
  305. package/views/3d/webgl-engine/materials/LineCalloutMaterial.js +1 -1
  306. package/views/3d/webgl-engine/materials/MeasurementArrowMaterial.js +1 -1
  307. package/views/3d/webgl-engine/materials/NativeLineMaterial.js +1 -1
  308. package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
  309. package/views/3d/webgl-engine/materials/PathTechnique.js +1 -1
  310. package/views/3d/webgl-engine/materials/PatternMaterial.js +1 -1
  311. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  312. package/views/3d/webgl-engine/materials/ShadedColorMaterial.js +1 -1
  313. package/views/3d/webgl-engine/materials/SlicePlaneMaterial.js +1 -1
  314. package/views/3d/webgl-engine/materials/VisualVariableMaterialParameters.js +1 -1
  315. package/views/3d/webgl-engine/materials/WaterTechnique.js +1 -1
  316. package/views/3d/webgl-engine/materials/internal/DefaultBufferWriter.js +1 -1
  317. package/views/3d/webgl-engine/materials/internal/MaterialUtil.js +1 -1
  318. package/views/3d/webgl-engine/materials/internal/bufferWriterUtils.js +1 -1
  319. package/views/3d/webgl-engine/materials/internal/waterMaterialUtils.js +1 -1
  320. package/views/3d/webgl-engine/materials/renderers/MergedRenderer.js +1 -1
  321. package/views/3d/webgl-engine/shaders/CheckerBoard.glsl.js +1 -1
  322. package/views/3d/webgl-engine/shaders/CheckerBoardTechnique.js +1 -1
  323. package/views/3d/webgl-engine/shaders/ColorMaterial.glsl.js +1 -1
  324. package/views/3d/webgl-engine/shaders/ColorMaterialTechnique.js +1 -1
  325. package/views/3d/webgl-engine/shaders/DefaultMaterial.glsl.js +1 -1
  326. package/views/3d/webgl-engine/shaders/DefaultMaterialTechnique.js +1 -1
  327. package/views/3d/webgl-engine/shaders/HUDMaterial.glsl.js +1 -1
  328. package/views/3d/webgl-engine/shaders/HUDMaterialTechnique.js +1 -1
  329. package/views/3d/webgl-engine/shaders/HighlightComposition.glsl.js +1 -1
  330. package/views/3d/webgl-engine/shaders/HighlightTechnique.js +1 -1
  331. package/views/3d/webgl-engine/shaders/ImageMaterial.glsl.js +1 -1
  332. package/views/3d/webgl-engine/shaders/ImageMaterialTechnique.js +1 -1
  333. package/views/3d/webgl-engine/shaders/LaserlinePath.glsl.js +1 -1
  334. package/views/3d/webgl-engine/shaders/LaserlinePathTechnique.js +1 -1
  335. package/views/3d/webgl-engine/shaders/LineCallout.glsl.js +1 -1
  336. package/views/3d/webgl-engine/shaders/LineCalloutTechnique.js +1 -1
  337. package/views/3d/webgl-engine/shaders/Magnifier.glsl.js +1 -1
  338. package/views/3d/webgl-engine/shaders/MeasurementArrow.glsl.js +1 -1
  339. package/views/3d/webgl-engine/shaders/NativeLine.glsl.js +1 -1
  340. package/views/3d/webgl-engine/shaders/Pattern.glsl.js +1 -1
  341. package/views/3d/webgl-engine/shaders/PatternTechnique.js +1 -1
  342. package/views/3d/webgl-engine/shaders/PointRenderer.glsl.js +1 -1
  343. package/views/3d/webgl-engine/shaders/RealisticTreeTechnique.js +1 -1
  344. package/views/3d/webgl-engine/shaders/RibbonLine.glsl.js +1 -1
  345. package/views/3d/webgl-engine/shaders/RibbonLineTechnique.js +1 -1
  346. package/views/3d/webgl-engine/shaders/SMAA.glsl.js +1 -1
  347. package/views/3d/webgl-engine/shaders/ShadedColorMaterial.glsl.js +1 -1
  348. package/views/3d/webgl-engine/shaders/ShadedColorMaterialTechnique.js +1 -1
  349. package/views/3d/webgl-engine/shaders/ShadowCastTechnique.js +1 -1
  350. package/views/3d/webgl-engine/shaders/ShadowHighlightTechnique.js +1 -1
  351. package/views/3d/webgl-engine/shaders/SlicePlaneMaterial.glsl.js +1 -1
  352. package/views/3d/webgl-engine/shaders/WaterSurface.glsl.js +1 -1
  353. package/views/3d/webgl-engine/shaders/sources/edgeRenderer/AdjustProjectedPosition.glsl.js +10 -10
  354. package/views/3d/webgl-engine/shaders/sources/edgeRenderer/DiscardShortEdges.glsl.js +1 -1
  355. package/views/3d/webgl-engine/shaders/sources/edgeRenderer/EdgeShaderProgram.glsl.js +1 -1
  356. package/views/3d/webgl-engine/shaders/sources/edgeRenderer/EdgeUtil.glsl.js +21 -21
  357. package/views/3d/webgl-engine/shaders/sources/edgeRenderer/LineAmplitude.glsl.js +6 -6
  358. package/views/3d/webgl-engine/shaders/sources/edgeRenderer/LineOffset.glsl.js +13 -13
  359. package/views/3d/webgl-engine/shaders/sources/edgeRenderer/UnpackAttributes.glsl.js +6 -6
  360. package/views/SceneView.js +1 -1
  361. package/views/interactive/editGeometry/operations/OffsetEdgeVertex.js +1 -1
  362. package/views/support/WatchUpdatingTracking.js +1 -1
  363. package/views/webgl/BufferObject.js +1 -1
  364. package/views/webgl/InstanceCounter.js +1 -1
  365. package/views/webgl/Program.js +1 -1
  366. package/webdoc/support/{Thumbnail.js → SlideThumbnail.js} +1 -1
  367. package/webmap/Bookmark.js +1 -1
  368. package/webmap/Version.js +1 -1
  369. package/webscene/Slide.js +1 -1
  370. package/webscene/Version.js +1 -1
  371. package/webscene/support/SlideVisibleLayer.js +1 -1
  372. package/widgets/BasemapGallery/support/basemapCompatibilityUtils.js +1 -1
  373. package/widgets/Bookmarks/BookmarksViewModel.js +1 -1
  374. package/widgets/Bookmarks.js +1 -1
  375. package/widgets/Directions/DirectionsViewModel.js +1 -1
  376. package/widgets/Directions/support/directionsUtils.js +1 -1
  377. package/widgets/Directions/support/resources.js +1 -1
  378. package/widgets/Directions.js +1 -1
  379. package/widgets/FeatureTemplates/FeatureTemplatesViewModel.js +1 -1
  380. package/widgets/Search/support/locatorUtils.js +1 -1
  381. package/widgets/Search.js +1 -1
  382. package/widgets/TimeSlider.js +1 -1
  383. package/assets/esri/core/workers/chunks/12c0cabb6c59e65d8546.js +0 -1
  384. package/assets/esri/core/workers/chunks/322d917e8cb398816a93.js +0 -1
  385. package/assets/esri/core/workers/chunks/392b6382e06652dd4c80.js +0 -1
  386. package/assets/esri/core/workers/chunks/3aa73119b055e05bbbeb.js +0 -1
  387. package/assets/esri/core/workers/chunks/52ea678ba1da0e349919.js +0 -1
  388. package/assets/esri/core/workers/chunks/5ee497d5d7b0e580526a.js +0 -1
  389. package/assets/esri/core/workers/chunks/663ad15b86936eb06b69.js +0 -1
  390. package/assets/esri/core/workers/chunks/83b8fec1650e061aaa56.js +0 -1
  391. package/assets/esri/core/workers/chunks/9796d54ff12b6429164a.js +0 -1
  392. package/assets/esri/core/workers/chunks/c093dff4592832ac0973.js +0 -1
  393. package/assets/esri/core/workers/chunks/d07440469fe7d181c4fd.js +0 -1
  394. package/assets/esri/core/workers/chunks/dbf192b4ce7e608610f6.js +0 -1
  395. package/assets/esri/core/workers/chunks/de6cff7b6cbbf99b20d1.js +0 -981
  396. package/assets/esri/core/workers/chunks/dee9929d95e9fe26929c.js +0 -1
  397. package/assets/esri/core/workers/chunks/e12d91ef44d6f879a02a.js +0 -1
  398. package/assets/esri/core/workers/chunks/e59764ee8cf25d4f74e2.js +0 -1
  399. package/assets/esri/core/workers/chunks/fc7e31d87555beb63291.js +0 -1
  400. package/assets/esri/core/workers/chunks/fff6b0338f06dad0c45d.js +0 -1
  401. package/widgets/Directions/support/CostSummary.js +0 -5
  402. package/widgets/Directions/support/RouteSection.js +0 -5
  403. package/widgets/Directions/support/RouteSections.js +0 -5
  404. package/widgets/Directions/support/maneuverUtils.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.23/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../chunks/tslib.es6.js";import i from"../../../../core/Accessor.js";import{disposeMaybe as t}from"../../../../core/maybe.js";import{property as s}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as a}from"../../../../core/accessorSupport/decorators/subclass.js";import{g as o,c as r}from"../../../../chunks/vec4.js";import{f as n}from"../../../../chunks/vec4f64.js";import{createQuadVAO as h}from"./glUtil3D.js";import{S as l,a as u}from"../../../../chunks/ShadowCast.glsl.js";import{ShadowCastTechniqueConfiguration as _,ShadowCastTechnique as c}from"../shaders/ShadowCastTechnique.js";import{vertexCount as d}from"../../../webgl/Util.js";const m=n(.01,0,.25,1),p=4e4,v=5e4,b=1/512;let g=class extends i{constructor(e,i,t,s){super({}),this._techniqueRepository=e,this._rctx=i,this._shadowAccumulator=t,this._requestRender=s,this._visualizationParams={shadowCastMap:this._shadowCastTexture,sampleScale:0,color:m,threshold:.5,bandSize:.1,opacityFromElevation:1},this._techniqueConfig=new _,this._enabled=!1,this._vao=h(i),this._techniqueConfig.pass=l.Visualize,this._techniqueConfig.visualization=u.Gradient}normalizeCtorArgs(){return{}}dispose(){this._stop(),this._vao=t(this._vao),this._techniqueRepository.release(this._technique),this._technique=null,this._shadowAccumulator=null}get visualizeShadowCastTechnique(){return this._technique=this._techniqueRepository.releaseAndAcquire(c,this._techniqueConfig,this._technique),this._technique}render(){if(!this._isRenderingVisualization)return;this._sampleScale=1/this._computedSamples,this._rctx.bindVAO(this._vao);const e=this.visualizeShadowCastTechnique;this._rctx.useProgram(e.program),e.bindPipelineState(this._rctx),e.bindPass(this._visualizationParams),this._rctx.drawArrays(e.primitiveType,0,d(this._vao,"geometry"))}setOptions(e){void 0!==e.enabled&&this._setEnabled(e.enabled),void 0!==e.color&&this._setColor(e.color),void 0!==e.threshold&&(this._threshold=e.threshold),void 0!==e.visualization&&(this._visualization=e.visualization),void 0!==e.bandSize&&(this._bandSize=e.bandSize),void 0!==e.bandsEnabled&&(this._bandsEnabled=e.bandsEnabled)}get opacityFromElevation(){return this._visualizationParams.opacityFromElevation}set opacityFromElevation(e){this._visualizationParams.opacityFromElevation!==e&&(this._visualizationParams.opacityFromElevation=e,this.notifyChange("opacityFromElevation"))}get _isRenderingVisualization(){return this._enabled&&this._computedSamples>0&&this.opacityFromElevation>b}get _computedSamples(){return this._shadowAccumulator.computedSamples}get _shadowCastTexture(){return this._shadowAccumulator.shadowCastTexture}get _sampleScale(){return this._visualizationParams.sampleScale}set _sampleScale(e){this._visualizationParams.sampleScale=e}get _threshold(){return this._visualizationParams.threshold}set _threshold(e){this._threshold!==e&&(this._visualizationParams.threshold=e,this._requestRenderIfRunning())}get _visualization(){return this._techniqueConfig.visualization}set _visualization(e){e!==this._visualization&&(this._techniqueConfig.visualization=e,this._techniqueRepository.release(this._technique),this._technique=null,this._requestRenderIfRunning())}get _bandSize(){return this._visualizationParams.bandSize}set _bandSize(e){e!==this._bandSize&&(this._visualizationParams.bandSize=e,this._requestRenderIfRunning())}get _bandsEnabled(){return this._techniqueConfig.bandsEnabled}set _bandsEnabled(e){e!==this._bandsEnabled&&(this._techniqueConfig.bandsEnabled=e,this._techniqueRepository.release(this._technique),this._technique=null,this._requestRenderIfRunning())}_setColor(e){const i=this._visualizationParams.color;o(e,i)||(r(this._visualizationParams.color,e),this._requestRenderIfRunning())}_setEnabled(e){e!==this._enabled&&(e?this._start():this._stop())}_requestRenderIfRunning(){this._enabled&&this._requestRender()}_start(){this._enabled=!0,this._requestRender()}_stop(){this._enabled=!1,this._requestRender()}};e([s()],g.prototype,"opacityFromElevation",null),g=e([a("esri.views.3d.webgl-engine.lib.ShadowCastRenderer")],g);export{g as ShadowCastRenderer,v as shadowCastDisableElevationMax,p as shadowCastDisableElevationMin,b as shadowCastDisabledElevationThreshold};
5
+ import{_ as e}from"../../../../chunks/tslib.es6.js";import i from"../../../../core/Accessor.js";import{disposeMaybe as t}from"../../../../core/maybe.js";import{property as s}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as a}from"../../../../core/accessorSupport/decorators/subclass.js";import{g as o,c as r}from"../../../../chunks/vec4.js";import{f as n}from"../../../../chunks/vec4f64.js";import{createQuadVAO as h}from"./glUtil3D.js";import{S as l,a as u}from"../../../../chunks/ShadowCast.glsl.js";import{ShadowCastTechniqueConfiguration as _,ShadowCastTechnique as c}from"../shaders/ShadowCastTechnique.js";import{vertexCount as d}from"../../../webgl/Util.js";const m=n(.01,0,.25,1),p=4e4,v=5e4,b=1/512;let q=class extends i{constructor(e,i,t,s){super({}),this._techniqueRepository=e,this._rctx=i,this._shadowAccumulator=t,this._requestRender=s,this._visualizationParams={shadowCastMap:this._shadowCastTexture,sampleScale:0,color:m,threshold:.5,bandSize:.1,opacityFromElevation:1},this._techniqueConfig=new _,this._enabled=!1,this._vao=h(i),this._techniqueConfig.pass=l.Visualize,this._techniqueConfig.visualization=u.Gradient}normalizeCtorArgs(){return{}}dispose(){this._stop(),this._vao=t(this._vao),this._techniqueRepository.release(this._technique),this._technique=null,this._shadowAccumulator=null}get visualizeShadowCastTechnique(){return this._technique=this._techniqueRepository.releaseAndAcquire(c,this._techniqueConfig,this._technique),this._technique}render(){if(!this._isRenderingVisualization)return;this._sampleScale=1/this._computedSamples,this._rctx.bindVAO(this._vao);const e=this.visualizeShadowCastTechnique;this._rctx.useTechnique(e),e.bindPass(this._visualizationParams),this._rctx.drawArrays(e.primitiveType,0,d(this._vao,"geometry"))}setOptions(e){void 0!==e.enabled&&this._setEnabled(e.enabled),void 0!==e.color&&this._setColor(e.color),void 0!==e.threshold&&(this._threshold=e.threshold),void 0!==e.visualization&&(this._visualization=e.visualization),void 0!==e.bandSize&&(this._bandSize=e.bandSize),void 0!==e.bandsEnabled&&(this._bandsEnabled=e.bandsEnabled)}get opacityFromElevation(){return this._visualizationParams.opacityFromElevation}set opacityFromElevation(e){this._visualizationParams.opacityFromElevation!==e&&(this._visualizationParams.opacityFromElevation=e,this.notifyChange("opacityFromElevation"))}get _isRenderingVisualization(){return this._enabled&&this._computedSamples>0&&this.opacityFromElevation>b}get _computedSamples(){return this._shadowAccumulator.computedSamples}get _shadowCastTexture(){return this._shadowAccumulator.shadowCastTexture}get _sampleScale(){return this._visualizationParams.sampleScale}set _sampleScale(e){this._visualizationParams.sampleScale=e}get _threshold(){return this._visualizationParams.threshold}set _threshold(e){this._threshold!==e&&(this._visualizationParams.threshold=e,this._requestRenderIfRunning())}get _visualization(){return this._techniqueConfig.visualization}set _visualization(e){e!==this._visualization&&(this._techniqueConfig.visualization=e,this._techniqueRepository.release(this._technique),this._technique=null,this._requestRenderIfRunning())}get _bandSize(){return this._visualizationParams.bandSize}set _bandSize(e){e!==this._bandSize&&(this._visualizationParams.bandSize=e,this._requestRenderIfRunning())}get _bandsEnabled(){return this._techniqueConfig.bandsEnabled}set _bandsEnabled(e){e!==this._bandsEnabled&&(this._techniqueConfig.bandsEnabled=e,this._techniqueRepository.release(this._technique),this._technique=null,this._requestRenderIfRunning())}_setColor(e){const i=this._visualizationParams.color;o(e,i)||(r(this._visualizationParams.color,e),this._requestRenderIfRunning())}_setEnabled(e){e!==this._enabled&&(e?this._start():this._stop())}_requestRenderIfRunning(){this._enabled&&this._requestRender()}_start(){this._enabled=!0,this._requestRender()}_stop(){this._enabled=!1,this._requestRender()}};e([s()],q.prototype,"opacityFromElevation",null),q=e([a("esri.views.3d.webgl-engine.lib.ShadowCastRenderer")],q);export{q as ShadowCastRenderer,v as shadowCastDisableElevationMax,p as shadowCastDisableElevationMin,b as shadowCastDisabledElevationThreshold};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import{smoothstep as t,clamp as i}from"../../../../core/mathUtils.js";import{isNone as e,disposeMaybe as a}from"../../../../core/maybe.js";import{n as s,s as r,d as o}from"../../../../chunks/vec3.js";import{c as h}from"../../../../chunks/vec3f64.js";import{f as c}from"../../../../chunks/vec4f32.js";import{ViewingMode as n}from"../../../ViewingMode.js";import{createQuadVAO as m}from"./glUtil3D.js";import{ShadowHighlightTechnique as p}from"../shaders/ShadowHighlightTechnique.js";import{vertexCount as _}from"../../../webgl/Util.js";const d=.001953125,l=4e4,u=5e4;class g{constructor(t,i){this._rctx=t,this._viewingMode=i,this._maxOpacity=1,this._parameters={shadowColor:c(1,0,1,1),shadowOpacity:.2,occludedShadowOpacity:.1,opacityElevation:1,dayNightTerminator:1},this._vao=m(this._rctx)}get technique(){return e(this._technique)&&(this._technique=new p({rctx:this._rctx,viewingMode:this._viewingMode},null)),this._technique}render(t,i){if(this._updateParameters(t),!t.shadowMap.enabled||!t.linearDepthTexture||!this.isVisible)return;const e=this.technique;this._rctx.bindFramebuffer(i),this._rctx.useProgram(e.program),e.bindPipelineState(this._rctx),e.bindPass(this._parameters,t),this._rctx.bindVAO(this._vao),this._rctx.drawArrays(e.primitiveType,0,_(this._vao,"geometry"))}get gpuMemoryUsage(){var t,i;return null!=(t=null==(i=this._vao)?void 0:i.size)?t:0}setDefaultOptions(t){this._parameters={...this._parameters,...t},this._updateMaxOpacity()}_updateParameters(e){this._parameters.opacityElevation=1-t(l,u,e.camera.relativeElevation);const a=this._viewingMode===n.Global?s(v,e.camera.center):r(v,0,0,1),h=o(a,e.lighting.lightingMainDirection);this._parameters.dayNightTerminator=t(0,1,i(30*h,0,1))}dispose(){this._vao=a(this._vao),this._technique=a(this._technique)}get isVisible(){return this._maxOpacity*this._parameters.opacityElevation*this._parameters.dayNightTerminator>=d}_updateMaxOpacity(){const t=this._parameters,i=t.shadowColor,e=Math.max(t.shadowOpacity,t.occludedShadowOpacity);this._maxOpacity=e*i[3]}}const v=h();export{g as ShadowHighlightHelper};
5
+ import{smoothstep as t,clamp as i}from"../../../../core/mathUtils.js";import{isNone as e,disposeMaybe as s}from"../../../../core/maybe.js";import{n as a,s as r,d as o}from"../../../../chunks/vec3.js";import{c as h}from"../../../../chunks/vec3f64.js";import{f as c}from"../../../../chunks/vec4f32.js";import{ViewingMode as n}from"../../../ViewingMode.js";import{createQuadVAO as m}from"./glUtil3D.js";import{ShadowHighlightTechnique as p}from"../shaders/ShadowHighlightTechnique.js";import{vertexCount as _}from"../../../webgl/Util.js";const d=.001953125,l=4e4,u=5e4;class g{constructor(t,i){this._rctx=t,this._viewingMode=i,this._maxOpacity=1,this._parameters={shadowColor:c(1,0,1,1),shadowOpacity:.2,occludedShadowOpacity:.1,opacityElevation:1,dayNightTerminator:1},this._vao=m(this._rctx)}get technique(){return e(this._technique)&&(this._technique=new p({rctx:this._rctx,viewingMode:this._viewingMode},null)),this._technique}render(t,i){if(this._updateParameters(t),!t.shadowMap.enabled||!t.linearDepthTexture||!this.isVisible)return;const e=this.technique;this._rctx.bindFramebuffer(i),this._rctx.useTechnique(e),e.bindPass(this._parameters,t),this._rctx.bindVAO(this._vao),this._rctx.drawArrays(e.primitiveType,0,_(this._vao,"geometry"))}get gpuMemoryUsage(){var t,i;return null!=(t=null==(i=this._vao)?void 0:i.size)?t:0}setDefaultOptions(t){this._parameters={...this._parameters,...t},this._updateMaxOpacity()}_updateParameters(e){this._parameters.opacityElevation=1-t(l,u,e.camera.relativeElevation);const s=this._viewingMode===n.Global?a(v,e.camera.center):r(v,0,0,1),h=o(s,e.lighting.lightingMainDirection);this._parameters.dayNightTerminator=t(0,1,i(30*h,0,1))}dispose(){this._vao=s(this._vao),this._technique=s(this._technique)}get isVisible(){return this._maxOpacity*this._parameters.opacityElevation*this._parameters.dayNightTerminator>=d}_updateMaxOpacity(){const t=this._parameters,i=t.shadowColor,e=Math.max(t.shadowOpacity,t.occludedShadowOpacity);this._maxOpacity=e*i[3]}}const v=h();export{g as ShadowHighlightHelper};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import{clamp as t,acosClamped as s,lerp as e}from"../../../../core/mathUtils.js";import{isSome as a,disposeMaybe as i}from"../../../../core/maybe.js";import{c as r}from"../../../../chunks/mat3f64.js";import{j as h,m as o,q as n,a as c,n as u}from"../../../../chunks/mat4.js";import{c as m}from"../../../../chunks/mat4f64.js";import{s as d,m as p,g as l,o as f,a as x,f as _,k as T,n as S,i as g,c as b}from"../../../../chunks/vec2.js";import{a as M}from"../../../../chunks/vec2f64.js";import{g as w,o as C,m as E,s as D}from"../../../../chunks/vec3.js";import{c as j}from"../../../../chunks/vec3f64.js";import{s as U,t as v}from"../../../../chunks/vec4.js";import{c as z}from"../../../../chunks/vec4f64.js";import{ViewingMode as R}from"../../../ViewingMode.js";import F from"./Camera.js";import{assert as N,logWithBase as y,verify as A,rayRay2D as O}from"./Util.js";import{TextureType as P,ClearBufferBit as k,PixelFormat as L,PixelType as B,TextureWrapMode as G,TextureSamplingMode as I,TargetType as X,DepthStencilTargetType as H}from"../../../webgl/enums.js";import{FramebufferObject as q}from"../../../webgl/FramebufferObject.js";import{Texture as V}from"../../../webgl/Texture.js";import{getGpuMemoryUsage as Y}from"../../../webgl/Util.js";class W{constructor(){this.camera=new F,this.lightMat=m()}}class J{constructor(t,s,e=0){this.rctx=t,this.viewingMode=s,this._enabled=!1,this._snapshots=new Array,this.textureSize=0,this.maxTextureSize=0,this.numCascades=1,this.maxNumCascades=4,this.splitSchemeLambda=0,this.warp=!0,this.cascadeDistances=[0,0,0,0,0],this.cascades=[],this.maxTextureSize=this.rctx.parameters.maxTextureSize;for(let a=0;a<4;++a)this.cascades.push(new W);this.snapshotCount=e}dispose(){this._discardDepthTexture(),this._discardAllSnapshots()}set maxCascades(s){this.maxNumCascades=t(Math.floor(s),1,4)}get maxCascades(){return this.maxNumCascades}set enabled(t){this._enabled=t,t||(this._discardDepthTexture(),this._discardAllSnapshots())}get enabled(){return this._enabled}get snapshotCount(){return this._snapshots.length}set snapshotCount(t){const s=this._snapshots.length;if(t>s){const e=t-s;this._snapshots.length=t;for(let t=0;t<e;++t)this._snapshots[s+t]=null}else if(t<this.snapshotCount){const e=s-t;for(let s=0;s<e;++s)this._discardSnapshot(t+s);this._snapshots.length=t}}getSnapshot(t){return this.enabled?this._snapshots[t]:null}getCascades(){for(let t=0;t<this.numCascades;++t)ut[t]=this.cascades[t];return ut.length=this.numCascades,ut}start(t,s,e){N(this.enabled),this.textureSize=this._computeTextureSize(t.fullWidth,t.fullHeight),this._ensureDepthTexture();const{near:a,far:i}=this._clampNearFar(e);this._computeCascadeDistances(i,a),this._setupMatrices(t,s);const r=t.viewMatrix,h=t.projectionMatrix;for(let o=0;o<this.numCascades;++o)this._constructCascade(o,h,r,s);this.lastOrigin=null,this.clear()}finish(t){N(this.enabled),this.rctx.bindFramebuffer(t)}bind(t){this.enabled?(this._depthTextureUnit=t.bindTexture(this._depthTexture,"uShadowMapTex"),t.setUniform1f("uDepthHalfPixelSz",.5/this.textureSize),t.setUniform1i("uShadowMapNum",this.numCascades),t.setUniform4f("uShadowMapDistance",this.cascadeDistances[0],this.numCascades>1?this.cascadeDistances[1]:1/0,this.numCascades>2?this.cascadeDistances[2]:1/0,this.numCascades>3?this.cascadeDistances[3]:1/0)):t.setUniform1f("uDepthHalfPixelSz",-1)}bindView(t,s){if(!this.enabled)return;const e=this.lastOrigin;if(!(e&&e[0]===s[0]&&e[1]===s[1]&&e[2]===s[2])){this.lastOrigin=this.lastOrigin||j(),w(this.lastOrigin,s);for(let t=0;t<this.numCascades;++t){h(mt,this.cascades[t].lightMat,s);for(let s=0;s<16;++s)dt[16*t+s]=mt[s]}}t.setUniformMatrix4fv("uShadowMapMatrix",dt)}takeCascadeSnapshotTo(t,s){N(this.enabled),this._ensureSnapshot(s),this._bindFbo();const e=this.rctx,a=e.bindTexture(this._snapshots[s],V.TEXTURE_UNIT_FOR_UPDATES);e.gl.copyTexSubImage2D(P.TEXTURE_2D,0,t.camera.viewport[0],t.camera.viewport[1],t.camera.viewport[0],t.camera.viewport[1],t.camera.viewport[2],t.camera.viewport[3]),e.bindTexture(a,V.TEXTURE_UNIT_FOR_UPDATES)}clear(){const t=this.rctx;this._bindFbo(),t.setClearColor(1,1,1,1),t.clearSafe(k.COLOR_BUFFER_BIT|k.DEPTH_BUFFER_BIT)}_computeTextureSize(t,s){const e=.5*Math.log(t*t+s*s)*Math.LOG2E,a=.35,i=2**Math.round(e+a);return Math.min(this.maxTextureSize,2*i)}_ensureDepthTexture(){if(null!=this._depthTexture&&this._depthTexture.descriptor.width===this.textureSize)return;this._discardDepthTexture();const t={target:P.TEXTURE_2D,pixelFormat:L.RGBA,dataType:B.UNSIGNED_BYTE,wrapMode:G.CLAMP_TO_EDGE,samplingMode:I.NEAREST,flipped:!0,width:this.textureSize,height:this.textureSize};this._depthTexture=new V(this.rctx,t),this.fbo=new q(this.rctx,{colorTarget:X.TEXTURE,depthStencilTarget:H.DEPTH_RENDER_BUFFER,width:this.textureSize,height:this.textureSize},this._depthTexture)}_ensureSnapshot(t){const s=this._snapshots[t];if(a(s)&&s.descriptor.width===this.textureSize)return;this._discardSnapshot(t);const e={target:P.TEXTURE_2D,pixelFormat:L.RGBA,dataType:B.UNSIGNED_BYTE,wrapMode:G.CLAMP_TO_EDGE,samplingMode:I.NEAREST,flipped:!0,width:this.textureSize,height:this.textureSize};this._snapshots[t]=new V(this.rctx,e)}_discardDepthTexture(){this.fbo=i(this.fbo),this._depthTexture=i(this._depthTexture)}_discardSnapshot(t){this._snapshots[t]=i(this._snapshots[t])}_discardAllSnapshots(){for(let t=0;t<this.snapshotCount;++t)this._discardSnapshot(t)}_bindFbo(){const t=this.rctx;a(this._depthTextureUnit)&&(t.bindTexture(null,this._depthTextureUnit),this._depthTextureUnit=null),t.bindFramebuffer(this.fbo)}_constructCascade(t,s,e,a){const i=this.cascades[t],r=-this.cascadeDistances[t],n=-this.cascadeDistances[t+1],c=(s[10]*r+s[14])/Math.abs(s[11]*r+s[15]),u=(s[10]*n+s[14])/Math.abs(s[11]*n+s[15]);N(c<u);for(let h=0;h<8;++h){U($,h%4==0||h%4==3?-1:1,h%4==0||h%4==1?-1:1,h<4?c:u,1),v(tt[h],$,Z);for(let t=0;t<3;++t)tt[h][t]/=tt[h][3]}C(ct,tt[0]),h(K,nt,ct),i.camera.viewMatrix=K;for(let h=0;h<8;++h)E(tt[h],tt[h],i.camera.viewMatrix);w(st,tt[0]),w(et,tt[0]);for(let h=1;h<8;++h)for(let t=0;t<3;++t)st[t]=Math.min(st[t],tt[h][t]),et[t]=Math.max(et[t],tt[h][t]);st[2]-=200,et[2]+=200,i.camera.near=-et[2],i.camera.far=-st[2],this.warp?this._constructTrapezoidalProjection(e,a,i):this._constructOrthogonalProjection(i),o(i.lightMat,i.camera.projectionMatrix,i.camera.viewMatrix);const m=this.textureSize/2;i.camera.viewport[0]=t%2==0?0:m,i.camera.viewport[1]=0===Math.floor(t/2)?0:m,i.camera.viewport[2]=m,i.camera.viewport[3]=m}_constructOrthogonalProjection(t){n(t.camera.projectionMatrix,st[0],et[0],st[1],et[1],t.camera.near,t.camera.far)}_constructTrapezoidalProjection(t,e,a){const i=1/tt[0][3],r=1/tt[4][3];N(i<r);let h=i+Math.sqrt(i*r);const o=Math.sin(s(t[2]*e[0]+t[6]*e[1]+t[10]*e[2]));h/=o,wt(tt,h,o,at,it,rt,ht,ot),vt(at,it,ht,ot,a.camera.projectionMatrix),a.camera.projectionMatrix[10]=2/(st[2]-et[2]),a.camera.projectionMatrix[14]=-(st[2]+et[2])/(st[2]-et[2])}_setupMatrices(t,s){o(Q,t.projectionMatrix,t.viewMatrix),c(Z,Q);const e=this.viewingMode===R.Global?t.eye:D(ct,0,0,1);u(nt,[0,0,0],[-s[0],-s[1],-s[2]],e)}_clampNearFar(t){let{near:s,far:e}=t;return s<2&&(s=2),e<2&&(e=2),s>=e&&(s=2,e=4),{near:s,far:e}}_computeCascadeDistances(t,s){this.numCascades=Math.min(1+Math.floor(y(t/s,4)),this.maxNumCascades);const a=(t-s)/this.numCascades,i=(t/s)**(1/this.numCascades);let r=s,h=s;for(let o=0;o<this.numCascades+1;++o)this.cascadeDistances[o]=e(r,h,this.splitSchemeLambda),r*=i,h+=a}get gpuMemoryUsage(){var t,s;return this._snapshots.reduce(((t,s)=>t+Y(s)),null!=(t=null==(s=this.fbo)?void 0:s.gpuMemoryUsage)?t:0)}get test(){const t=this;return{maxNumCascades:this.maxNumCascades,cascades:this.cascades,textureSize:this.textureSize,depthTexture:this._depthTexture,set splitSchemeLambda(s){t.splitSchemeLambda=s},get splitSchemeLambda(){return t.splitSchemeLambda},set warp(s){t.warp=s},get warp(){return t.warp}}}}const K=m(),Q=m(),Z=m(),$=z(),tt=[];for(let zt=0;zt<8;++zt)tt.push(z());const st=j(),et=j(),at=M(),it=M(),rt=M(),ht=M(),ot=M(),nt=m(),ct=j(),ut=[],mt=m(),dt=new Float32Array(64),pt=M(),lt=M(),ft=[M(),M(),M(),M()],xt=M(),_t=M(),Tt=M(),St=M(),gt=M(),bt=M(),Mt=M();function wt(t,s,e,a,i,r,h,o){d(pt,0,0);for(let d=0;d<4;++d)p(pt,pt,t[d]);l(pt,pt,.25),d(lt,0,0);for(let d=4;d<8;++d)p(lt,lt,t[d]);l(lt,lt,.25),f(ft[0],t[4],t[5],.5),f(ft[1],t[5],t[6],.5),f(ft[2],t[6],t[7],.5),f(ft[3],t[7],t[4],.5);let n=0,c=x(ft[0],pt);for(let d=1;d<4;++d){const t=x(ft[d],pt);t<c&&(c=t,n=d)}_(xt,ft[n],t[n+4]);const u=xt[0];let m,M;xt[0]=-xt[1],xt[1]=u,_(_t,lt,pt),T(_t,xt)<0&&S(xt,xt),f(xt,xt,_t,e),g(xt,xt),m=M=T(_(Tt,t[0],pt),xt);for(let d=1;d<8;++d){const s=T(_(Tt,t[d],pt),xt);s<m?m=s:s>M&&(M=s)}b(a,pt),l(Tt,xt,m-s),p(a,a,Tt);let w=-1,C=1,E=0,D=0;for(let d=0;d<8;++d){_(St,t[d],a),g(St,St);const s=xt[0]*St[1]-xt[1]*St[0];s>0?s>w&&(w=s,E=d):s<C&&(C=s,D=d)}A(w>0,"leftArea"),A(C<0,"rightArea"),l(gt,xt,m),p(gt,gt,pt),l(bt,xt,M),p(bt,bt,pt),Mt[0]=-xt[1],Mt[1]=xt[0];const j=O(a,t[D],bt,p(Tt,bt,Mt),1,i),U=O(a,t[E],bt,Tt,1,r),v=O(a,t[E],gt,p(Tt,gt,Mt),1,h),z=O(a,t[D],gt,Tt,1,o);A(j,"rayRay"),A(U,"rayRay"),A(v,"rayRay"),A(z,"rayRay")}function Ct(t,s){return 3*s+t}const Et=M();function Dt(t,s){return d(Et,t[s],t[s+3]),Et}const jt=M(),Ut=r();function vt(t,s,e,a,i){_(jt,e,a),l(jt,jt,.5),Ut[0]=jt[0],Ut[1]=jt[1],Ut[2]=0,Ut[3]=jt[1],Ut[4]=-jt[0],Ut[5]=0,Ut[6]=jt[0]*jt[0]+jt[1]*jt[1],Ut[7]=jt[0]*jt[1]-jt[1]*jt[0],Ut[8]=1,Ut[Ct(0,2)]=-T(Dt(Ut,0),t),Ut[Ct(1,2)]=-T(Dt(Ut,1),t);let r=T(Dt(Ut,0),e)+Ut[Ct(0,2)],h=T(Dt(Ut,1),e)+Ut[Ct(1,2)],o=T(Dt(Ut,0),a)+Ut[Ct(0,2)],n=T(Dt(Ut,1),a)+Ut[Ct(1,2)];r=-(r+o)/(h+n),Ut[Ct(0,0)]+=Ut[Ct(1,0)]*r,Ut[Ct(0,1)]+=Ut[Ct(1,1)]*r,Ut[Ct(0,2)]+=Ut[Ct(1,2)]*r,r=1/(T(Dt(Ut,0),e)+Ut[Ct(0,2)]),h=1/(T(Dt(Ut,1),e)+Ut[Ct(1,2)]),Ut[Ct(0,0)]*=r,Ut[Ct(0,1)]*=r,Ut[Ct(0,2)]*=r,Ut[Ct(1,0)]*=h,Ut[Ct(1,1)]*=h,Ut[Ct(1,2)]*=h,Ut[Ct(2,0)]=Ut[Ct(1,0)],Ut[Ct(2,1)]=Ut[Ct(1,1)],Ut[Ct(2,2)]=Ut[Ct(1,2)],Ut[Ct(1,2)]+=1,r=T(Dt(Ut,1),s)+Ut[Ct(1,2)],h=T(Dt(Ut,2),s)+Ut[Ct(2,2)],o=T(Dt(Ut,1),e)+Ut[Ct(1,2)],n=T(Dt(Ut,2),e)+Ut[Ct(2,2)],r=-.5*(r/h+o/n),Ut[Ct(1,0)]+=Ut[Ct(2,0)]*r,Ut[Ct(1,1)]+=Ut[Ct(2,1)]*r,Ut[Ct(1,2)]+=Ut[Ct(2,2)]*r,r=T(Dt(Ut,1),s)+Ut[Ct(1,2)],h=T(Dt(Ut,2),s)+Ut[Ct(2,2)],o=-h/r,Ut[Ct(1,0)]*=o,Ut[Ct(1,1)]*=o,Ut[Ct(1,2)]*=o,i[0]=Ut[0],i[1]=Ut[1],i[2]=0,i[3]=Ut[2],i[4]=Ut[3],i[5]=Ut[4],i[6]=0,i[7]=Ut[5],i[8]=0,i[9]=0,i[10]=1,i[11]=0,i[12]=Ut[6],i[13]=Ut[7],i[14]=0,i[15]=Ut[8]}export{J as default};
5
+ import{clamp as t,acosClamped as s,lerp as e}from"../../../../core/mathUtils.js";import{isSome as a,disposeMaybe as i}from"../../../../core/maybe.js";import{c as r}from"../../../../chunks/mat3f64.js";import{j as h,m as o,q as c,a as n,n as m}from"../../../../chunks/mat4.js";import{c as d}from"../../../../chunks/mat4f64.js";import{s as u,m as p,g as l,o as f,a as x,f as _,k as T,n as g,i as b,c as S}from"../../../../chunks/vec2.js";import{a as M}from"../../../../chunks/vec2f64.js";import{g as w,o as C,m as E,s as j}from"../../../../chunks/vec3.js";import{c as D}from"../../../../chunks/vec3f64.js";import{s as U,t as v}from"../../../../chunks/vec4.js";import{c as z}from"../../../../chunks/vec4f64.js";import{ViewingMode as R}from"../../../ViewingMode.js";import F from"./Camera.js";import{assert as y,logWithBase as N,verify as A,rayRay2D as O}from"./Util.js";import{TextureType as P,ClearBufferBit as k,PixelFormat as L,PixelType as B,TextureWrapMode as G,TextureSamplingMode as I,TargetType as X,DepthStencilTargetType as H}from"../../../webgl/enums.js";import{FramebufferObject as q}from"../../../webgl/FramebufferObject.js";import{Texture as V}from"../../../webgl/Texture.js";import{getGpuMemoryUsage as Y}from"../../../webgl/Util.js";class W{constructor(){this.camera=new F,this.lightMat=d()}}class J{constructor(t,s,e=0){this.rctx=t,this.viewingMode=s,this._enabled=!1,this._snapshots=new Array,this.textureSize=0,this.maxTextureSize=0,this.numCascades=1,this.maxNumCascades=4,this.splitSchemeLambda=0,this.warp=!0,this.cascadeDistances=[0,0,0,0,0],this.cascades=[],this.maxTextureSize=this.rctx.parameters.maxTextureSize;for(let a=0;a<4;++a)this.cascades.push(new W);this.snapshotCount=e}dispose(){this._discardDepthTexture(),this._discardAllSnapshots()}set maxCascades(s){this.maxNumCascades=t(Math.floor(s),1,4)}get maxCascades(){return this.maxNumCascades}set enabled(t){this._enabled=t,t||(this._discardDepthTexture(),this._discardAllSnapshots())}get enabled(){return this._enabled}get snapshotCount(){return this._snapshots.length}set snapshotCount(t){const s=this._snapshots.length;if(t>s){const e=t-s;this._snapshots.length=t;for(let t=0;t<e;++t)this._snapshots[s+t]=null}else if(t<this.snapshotCount){const e=s-t;for(let s=0;s<e;++s)this._discardSnapshot(t+s);this._snapshots.length=t}}getSnapshot(t){return this.enabled?this._snapshots[t]:null}getCascades(){for(let t=0;t<this.numCascades;++t)mt[t]=this.cascades[t];return mt.length=this.numCascades,mt}start(t,s,e){y(this.enabled),this.textureSize=this._computeTextureSize(t.fullWidth,t.fullHeight),this._ensureDepthTexture();const{near:a,far:i}=this._clampNearFar(e);this._computeCascadeDistances(i,a),this._setupMatrices(t,s);const r=t.viewMatrix,h=t.projectionMatrix;for(let o=0;o<this.numCascades;++o)this._constructCascade(o,h,r,s);this.lastOrigin=null,this.clear()}finish(t){y(this.enabled),this.rctx.bindFramebuffer(t)}bind(t){this.enabled?(this._depthTextureUnit=t.bindTexture(this._depthTexture,"shadowMapTex"),t.setUniform1f("depthHalfPixelSz",.5/this.textureSize),t.setUniform1i("numCascades",this.numCascades),t.setUniform4f("cascadeDistances",this.cascadeDistances[0],this.numCascades>1?this.cascadeDistances[1]:1/0,this.numCascades>2?this.cascadeDistances[2]:1/0,this.numCascades>3?this.cascadeDistances[3]:1/0)):t.setUniform1f("depthHalfPixelSz",-1)}bindView(t,s){if(!this.enabled)return;const e=this.lastOrigin;if(!(e&&e[0]===s[0]&&e[1]===s[1]&&e[2]===s[2])){this.lastOrigin=this.lastOrigin||D(),w(this.lastOrigin,s);for(let t=0;t<this.numCascades;++t){h(dt,this.cascades[t].lightMat,s);for(let s=0;s<16;++s)ut[16*t+s]=dt[s]}}t.setUniformMatrix4fv("shadowMapMatrix",ut)}takeCascadeSnapshotTo(t,s){y(this.enabled),this._ensureSnapshot(s),this._bindFbo();const e=this.rctx,a=e.bindTexture(this._snapshots[s],V.TEXTURE_UNIT_FOR_UPDATES);e.gl.copyTexSubImage2D(P.TEXTURE_2D,0,t.camera.viewport[0],t.camera.viewport[1],t.camera.viewport[0],t.camera.viewport[1],t.camera.viewport[2],t.camera.viewport[3]),e.bindTexture(a,V.TEXTURE_UNIT_FOR_UPDATES)}clear(){const t=this.rctx;this._bindFbo(),t.setClearColor(1,1,1,1),t.clearSafe(k.COLOR_BUFFER_BIT|k.DEPTH_BUFFER_BIT)}_computeTextureSize(t,s){const e=.5*Math.log(t*t+s*s)*Math.LOG2E,a=.35,i=2**Math.round(e+a);return Math.min(this.maxTextureSize,2*i)}_ensureDepthTexture(){if(null!=this._depthTexture&&this._depthTexture.descriptor.width===this.textureSize)return;this._discardDepthTexture();const t={target:P.TEXTURE_2D,pixelFormat:L.RGBA,dataType:B.UNSIGNED_BYTE,wrapMode:G.CLAMP_TO_EDGE,samplingMode:I.NEAREST,flipped:!0,width:this.textureSize,height:this.textureSize};this._depthTexture=new V(this.rctx,t),this.fbo=new q(this.rctx,{colorTarget:X.TEXTURE,depthStencilTarget:H.DEPTH_RENDER_BUFFER,width:this.textureSize,height:this.textureSize},this._depthTexture)}_ensureSnapshot(t){const s=this._snapshots[t];if(a(s)&&s.descriptor.width===this.textureSize)return;this._discardSnapshot(t);const e={target:P.TEXTURE_2D,pixelFormat:L.RGBA,dataType:B.UNSIGNED_BYTE,wrapMode:G.CLAMP_TO_EDGE,samplingMode:I.NEAREST,flipped:!0,width:this.textureSize,height:this.textureSize};this._snapshots[t]=new V(this.rctx,e)}_discardDepthTexture(){this.fbo=i(this.fbo),this._depthTexture=i(this._depthTexture)}_discardSnapshot(t){this._snapshots[t]=i(this._snapshots[t])}_discardAllSnapshots(){for(let t=0;t<this.snapshotCount;++t)this._discardSnapshot(t)}_bindFbo(){const t=this.rctx;a(this._depthTextureUnit)&&(t.bindTexture(null,this._depthTextureUnit),this._depthTextureUnit=null),t.bindFramebuffer(this.fbo)}_constructCascade(t,s,e,a){const i=this.cascades[t],r=-this.cascadeDistances[t],c=-this.cascadeDistances[t+1],n=(s[10]*r+s[14])/Math.abs(s[11]*r+s[15]),m=(s[10]*c+s[14])/Math.abs(s[11]*c+s[15]);y(n<m);for(let h=0;h<8;++h){U($,h%4==0||h%4==3?-1:1,h%4==0||h%4==1?-1:1,h<4?n:m,1),v(tt[h],$,Z);for(let t=0;t<3;++t)tt[h][t]/=tt[h][3]}C(nt,tt[0]),h(K,ct,nt),i.camera.viewMatrix=K;for(let h=0;h<8;++h)E(tt[h],tt[h],i.camera.viewMatrix);w(st,tt[0]),w(et,tt[0]);for(let h=1;h<8;++h)for(let t=0;t<3;++t)st[t]=Math.min(st[t],tt[h][t]),et[t]=Math.max(et[t],tt[h][t]);st[2]-=200,et[2]+=200,i.camera.near=-et[2],i.camera.far=-st[2],this.warp?this._constructTrapezoidalProjection(e,a,i):this._constructOrthogonalProjection(i),o(i.lightMat,i.camera.projectionMatrix,i.camera.viewMatrix);const d=this.textureSize/2;i.camera.viewport[0]=t%2==0?0:d,i.camera.viewport[1]=0===Math.floor(t/2)?0:d,i.camera.viewport[2]=d,i.camera.viewport[3]=d}_constructOrthogonalProjection(t){c(t.camera.projectionMatrix,st[0],et[0],st[1],et[1],t.camera.near,t.camera.far)}_constructTrapezoidalProjection(t,e,a){const i=1/tt[0][3],r=1/tt[4][3];y(i<r);let h=i+Math.sqrt(i*r);const o=Math.sin(s(t[2]*e[0]+t[6]*e[1]+t[10]*e[2]));h/=o,wt(tt,h,o,at,it,rt,ht,ot),vt(at,it,ht,ot,a.camera.projectionMatrix),a.camera.projectionMatrix[10]=2/(st[2]-et[2]),a.camera.projectionMatrix[14]=-(st[2]+et[2])/(st[2]-et[2])}_setupMatrices(t,s){o(Q,t.projectionMatrix,t.viewMatrix),n(Z,Q);const e=this.viewingMode===R.Global?t.eye:j(nt,0,0,1);m(ct,[0,0,0],[-s[0],-s[1],-s[2]],e)}_clampNearFar(t){let{near:s,far:e}=t;return s<2&&(s=2),e<2&&(e=2),s>=e&&(s=2,e=4),{near:s,far:e}}_computeCascadeDistances(t,s){this.numCascades=Math.min(1+Math.floor(N(t/s,4)),this.maxNumCascades);const a=(t-s)/this.numCascades,i=(t/s)**(1/this.numCascades);let r=s,h=s;for(let o=0;o<this.numCascades+1;++o)this.cascadeDistances[o]=e(r,h,this.splitSchemeLambda),r*=i,h+=a}get gpuMemoryUsage(){var t,s;return this._snapshots.reduce(((t,s)=>t+Y(s)),null!=(t=null==(s=this.fbo)?void 0:s.gpuMemoryUsage)?t:0)}get test(){const t=this;return{maxNumCascades:this.maxNumCascades,cascades:this.cascades,textureSize:this.textureSize,depthTexture:this._depthTexture,set splitSchemeLambda(s){t.splitSchemeLambda=s},get splitSchemeLambda(){return t.splitSchemeLambda},set warp(s){t.warp=s},get warp(){return t.warp}}}}const K=d(),Q=d(),Z=d(),$=z(),tt=[];for(let zt=0;zt<8;++zt)tt.push(z());const st=D(),et=D(),at=M(),it=M(),rt=M(),ht=M(),ot=M(),ct=d(),nt=D(),mt=[],dt=d(),ut=new Float32Array(64),pt=M(),lt=M(),ft=[M(),M(),M(),M()],xt=M(),_t=M(),Tt=M(),gt=M(),bt=M(),St=M(),Mt=M();function wt(t,s,e,a,i,r,h,o){u(pt,0,0);for(let u=0;u<4;++u)p(pt,pt,t[u]);l(pt,pt,.25),u(lt,0,0);for(let u=4;u<8;++u)p(lt,lt,t[u]);l(lt,lt,.25),f(ft[0],t[4],t[5],.5),f(ft[1],t[5],t[6],.5),f(ft[2],t[6],t[7],.5),f(ft[3],t[7],t[4],.5);let c=0,n=x(ft[0],pt);for(let u=1;u<4;++u){const t=x(ft[u],pt);t<n&&(n=t,c=u)}_(xt,ft[c],t[c+4]);const m=xt[0];let d,M;xt[0]=-xt[1],xt[1]=m,_(_t,lt,pt),T(_t,xt)<0&&g(xt,xt),f(xt,xt,_t,e),b(xt,xt),d=M=T(_(Tt,t[0],pt),xt);for(let u=1;u<8;++u){const s=T(_(Tt,t[u],pt),xt);s<d?d=s:s>M&&(M=s)}S(a,pt),l(Tt,xt,d-s),p(a,a,Tt);let w=-1,C=1,E=0,j=0;for(let u=0;u<8;++u){_(gt,t[u],a),b(gt,gt);const s=xt[0]*gt[1]-xt[1]*gt[0];s>0?s>w&&(w=s,E=u):s<C&&(C=s,j=u)}A(w>0,"leftArea"),A(C<0,"rightArea"),l(bt,xt,d),p(bt,bt,pt),l(St,xt,M),p(St,St,pt),Mt[0]=-xt[1],Mt[1]=xt[0];const D=O(a,t[j],St,p(Tt,St,Mt),1,i),U=O(a,t[E],St,Tt,1,r),v=O(a,t[E],bt,p(Tt,bt,Mt),1,h),z=O(a,t[j],bt,Tt,1,o);A(D,"rayRay"),A(U,"rayRay"),A(v,"rayRay"),A(z,"rayRay")}function Ct(t,s){return 3*s+t}const Et=M();function jt(t,s){return u(Et,t[s],t[s+3]),Et}const Dt=M(),Ut=r();function vt(t,s,e,a,i){_(Dt,e,a),l(Dt,Dt,.5),Ut[0]=Dt[0],Ut[1]=Dt[1],Ut[2]=0,Ut[3]=Dt[1],Ut[4]=-Dt[0],Ut[5]=0,Ut[6]=Dt[0]*Dt[0]+Dt[1]*Dt[1],Ut[7]=Dt[0]*Dt[1]-Dt[1]*Dt[0],Ut[8]=1,Ut[Ct(0,2)]=-T(jt(Ut,0),t),Ut[Ct(1,2)]=-T(jt(Ut,1),t);let r=T(jt(Ut,0),e)+Ut[Ct(0,2)],h=T(jt(Ut,1),e)+Ut[Ct(1,2)],o=T(jt(Ut,0),a)+Ut[Ct(0,2)],c=T(jt(Ut,1),a)+Ut[Ct(1,2)];r=-(r+o)/(h+c),Ut[Ct(0,0)]+=Ut[Ct(1,0)]*r,Ut[Ct(0,1)]+=Ut[Ct(1,1)]*r,Ut[Ct(0,2)]+=Ut[Ct(1,2)]*r,r=1/(T(jt(Ut,0),e)+Ut[Ct(0,2)]),h=1/(T(jt(Ut,1),e)+Ut[Ct(1,2)]),Ut[Ct(0,0)]*=r,Ut[Ct(0,1)]*=r,Ut[Ct(0,2)]*=r,Ut[Ct(1,0)]*=h,Ut[Ct(1,1)]*=h,Ut[Ct(1,2)]*=h,Ut[Ct(2,0)]=Ut[Ct(1,0)],Ut[Ct(2,1)]=Ut[Ct(1,1)],Ut[Ct(2,2)]=Ut[Ct(1,2)],Ut[Ct(1,2)]+=1,r=T(jt(Ut,1),s)+Ut[Ct(1,2)],h=T(jt(Ut,2),s)+Ut[Ct(2,2)],o=T(jt(Ut,1),e)+Ut[Ct(1,2)],c=T(jt(Ut,2),e)+Ut[Ct(2,2)],r=-.5*(r/h+o/c),Ut[Ct(1,0)]+=Ut[Ct(2,0)]*r,Ut[Ct(1,1)]+=Ut[Ct(2,1)]*r,Ut[Ct(1,2)]+=Ut[Ct(2,2)]*r,r=T(jt(Ut,1),s)+Ut[Ct(1,2)],h=T(jt(Ut,2),s)+Ut[Ct(2,2)],o=-h/r,Ut[Ct(1,0)]*=o,Ut[Ct(1,1)]*=o,Ut[Ct(1,2)]*=o,i[0]=Ut[0],i[1]=Ut[1],i[2]=0,i[3]=Ut[2],i[4]=Ut[3],i[5]=Ut[4],i[6]=0,i[7]=Ut[5],i[8]=0,i[9]=0,i[10]=1,i[11]=0,i[12]=Ut[6],i[13]=Ut[7],i[14]=0,i[15]=Ut[8]}export{J as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{abortMaybe as r,isSome as s,disposeMaybe as i}from"../../../../core/maybe.js";import{throwIfAborted as o,isAborted as h}from"../../../../core/promiseUtils.js";import{property as a}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as l}from"../../../../core/accessorSupport/decorators/subclass.js";import{requestImage as n}from"../../../../support/requestImageUtils.js";import{createScreenSizeTriangleVAO as d}from"./glUtil3D.js";import{SMAATechniqueConfiguration as u,SMAATechnique as _}from"./SMAATechnique.js";import{S as g}from"../../../../chunks/SMAA.glsl.js";import{TextureSamplingMode as c,PixelFormat as p,TargetType as m,DepthStencilTargetType as b,TextureType as T,PixelType as E,TextureWrapMode as x,ClearBufferBit as f,PrimitiveType as w}from"../../../webgl/enums.js";import{FramebufferObject as R}from"../../../webgl/FramebufferObject.js";import{Texture as A}from"../../../webgl/Texture.js";let C=class extends t{constructor(e,t){super({}),this.rctx=e,this._techniqueRep=t,this._isEnabled=!1}normalizeCtorArgs(){return{}}dispose(){this._abortController=r(this._abortController),this.disable()}_loadResources(e){if(s(this._abortController))return!1;if(s(this._searchTexture))return!0;this._abortController=new AbortController;const t=this._abortController.signal;return import("./SmaaRenderPassData.js").then((e=>this._loadTextures(e,t))).then((()=>e())).finally((()=>this._abortController=null)),!1}_loadTextures(e,t){return o(t),Promise.all([this._loadTextureFromBase64(e.areaTexture,c.LINEAR,p.RGB),this._loadTextureFromBase64(e.searchTexure,c.NEAREST,p.LUMINANCE)]).then((([e,r])=>{h(t)?(e.dispose(),r.dispose(),o(t)):(this._areaTexture=e,this._searchTexture=r)}))}get updating(){return s(this._abortController)}enable(e){if(this._isEnabled)return!0;if(!this._edgeDetectTechnique||!this._blendWeights||!this._blur){const e=new u,t=(e,t)=>this._techniqueRep.releaseAndAcquire(_,e,t);e.output=g.EdgeDetector,this._edgeDetectTechnique=t(e,this._edgeDetectTechnique),e.output=g.BlendWeight,this._blendWeights=t(e,this._blendWeights),e.output=g.Blur,this._blur=t(e,this._blur)}return!!this._loadResources(e)&&(this._vao=d(this.rctx),this._edges=new R(this.rctx,{colorTarget:m.TEXTURE,depthStencilTarget:b.NONE},{target:T.TEXTURE_2D,pixelFormat:p.RGB,dataType:E.UNSIGNED_BYTE,samplingMode:c.LINEAR,wrapMode:x.CLAMP_TO_EDGE,width:4,height:4}),this._blend=new R(this.rctx,{colorTarget:m.TEXTURE,depthStencilTarget:b.NONE},{target:T.TEXTURE_2D,pixelFormat:p.RGBA,dataType:E.UNSIGNED_BYTE,samplingMode:c.LINEAR,wrapMode:x.CLAMP_TO_EDGE,width:4,height:4}),this._isEnabled=!0,!0)}disable(){this._isEnabled&&(this._vao=i(this._vao),this._areaTexture=i(this._areaTexture),this._searchTexture=i(this._searchTexture),this._blend=i(this._blend),this._edges=i(this._edges),this._isEnabled=!1)}render(e){if(!this._isEnabled)return;const t=this.rctx,r=t.getBoundFramebufferObject(),s={x:0,y:0,width:e.descriptor.width,height:e.descriptor.height};t.bindVAO(this._vao),this._edgeDetectTechnique.bindPipelineState(t),t.setViewport(s.x,s.y,s.width,s.height),this._edges.resize(s.width,s.height),t.bindFramebuffer(this._edges),t.setClearColor(0,0,0,1),t.clear(f.COLOR_BUFFER_BIT),t.useProgram(this._edgeDetectTechnique.program),this._edgeDetectTechnique.program.bindTexture(e,"tColor"),this._edgeDetectTechnique.program.setUniform4f("uResolution",1/s.width,1/s.height,s.width,s.height),t.drawArrays(w.TRIANGLES,0,3),this._blend.resize(s.width,s.height),t.bindFramebuffer(this._blend),t.setClearColor(0,0,1,1),t.clear(f.COLOR_BUFFER_BIT),t.useProgram(this._blendWeights.program),this._blendWeights.program.setUniform4f("uResolution",1/s.width,1/s.height,s.width,s.height),this._blendWeights.program.bindTexture(this._searchTexture,"tSearch"),this._blendWeights.program.bindTexture(this._areaTexture,"tArea"),this._blendWeights.program.bindTexture(this._edges.colorTexture,"tEdges"),t.drawArrays(w.TRIANGLES,0,3),t.bindFramebuffer(r),t.setClearColor(0,1,0,1),t.clear(f.COLOR_BUFFER_BIT),t.useProgram(this._blur.program),this._blur.program.setUniform4f("uResolution",1/s.width,1/s.height,s.width,s.height),this._blur.program.bindTexture(e,"tColor"),this._blur.program.bindTexture(this._blend.colorTexture,"tBlendWeights"),t.drawArrays(w.TRIANGLES,0,3)}_loadTextureFromBase64(e,t,r){const s=new A(this.rctx,{pixelFormat:r,dataType:E.UNSIGNED_BYTE,wrapMode:x.CLAMP_TO_EDGE,samplingMode:t},null);return n(e).then((e=>(s.resize(e.width,e.height),s.setData(e),s)))}};e([a()],C.prototype,"_abortController",void 0),e([a({readOnly:!0})],C.prototype,"updating",null),C=e([l("esri.views.3d.webgl-engine.lib.SmaaRenderPass")],C);export{C as SmaaRenderPass};
5
+ import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{abortMaybe as r,isSome as s,disposeMaybe as i}from"../../../../core/maybe.js";import{throwIfAborted as o,isAborted as h}from"../../../../core/promiseUtils.js";import{property as a}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as n}from"../../../../core/accessorSupport/decorators/subclass.js";import{requestImage as l}from"../../../../support/requestImageUtils.js";import{createScreenSizeTriangleVAO as u}from"./glUtil3D.js";import{SMAATechniqueConfiguration as d,SMAATechnique as c}from"./SMAATechnique.js";import{S as _}from"../../../../chunks/SMAA.glsl.js";import{TextureSamplingMode as T,PixelFormat as p,TargetType as b,DepthStencilTargetType as g,TextureType as m,PixelType as E,TextureWrapMode as x,ClearBufferBit as f,PrimitiveType as w}from"../../../webgl/enums.js";import{FramebufferObject as A}from"../../../webgl/FramebufferObject.js";import{Texture as R}from"../../../webgl/Texture.js";let C=class extends t{constructor(e,t){super({}),this.rctx=e,this._techniqueRep=t,this._isEnabled=!1}normalizeCtorArgs(){return{}}dispose(){this._abortController=r(this._abortController),this.disable()}_loadResources(e){if(s(this._abortController))return!1;if(s(this._searchTexture))return!0;this._abortController=new AbortController;const t=this._abortController.signal;return import("./SmaaRenderPassData.js").then((e=>this._loadTextures(e,t))).then((()=>e())).finally((()=>this._abortController=null)),!1}_loadTextures(e,t){return o(t),Promise.all([this._loadTextureFromBase64(e.areaTexture,T.LINEAR,p.RGB),this._loadTextureFromBase64(e.searchTexure,T.NEAREST,p.LUMINANCE)]).then((([e,r])=>{h(t)?(e.dispose(),r.dispose(),o(t)):(this._areaTexture=e,this._searchTexture=r)}))}get updating(){return s(this._abortController)}enable(e){if(this._isEnabled)return!0;if(!this._edgeDetectTechnique||!this._blendWeightsTechnique||!this._blurTechnique){const e=new d,t=(e,t)=>this._techniqueRep.releaseAndAcquire(c,e,t);e.output=_.EdgeDetector,this._edgeDetectTechnique=t(e,this._edgeDetectTechnique),e.output=_.BlendWeight,this._blendWeightsTechnique=t(e,this._blendWeightsTechnique),e.output=_.Blur,this._blurTechnique=t(e,this._blurTechnique)}return!!this._loadResources(e)&&(this._vao=u(this.rctx),this._edges=new A(this.rctx,{colorTarget:b.TEXTURE,depthStencilTarget:g.NONE},{target:m.TEXTURE_2D,pixelFormat:p.RGB,dataType:E.UNSIGNED_BYTE,samplingMode:T.LINEAR,wrapMode:x.CLAMP_TO_EDGE,width:4,height:4}),this._blend=new A(this.rctx,{colorTarget:b.TEXTURE,depthStencilTarget:g.NONE},{target:m.TEXTURE_2D,pixelFormat:p.RGBA,dataType:E.UNSIGNED_BYTE,samplingMode:T.LINEAR,wrapMode:x.CLAMP_TO_EDGE,width:4,height:4}),this._isEnabled=!0,!0)}disable(){this._isEnabled&&(this._vao=i(this._vao),this._areaTexture=i(this._areaTexture),this._searchTexture=i(this._searchTexture),this._blend=i(this._blend),this._edges=i(this._edges),this._isEnabled=!1)}render(e){if(!this._isEnabled)return;const t=this.rctx,r=t.getBoundFramebufferObject(),s={x:0,y:0,width:e.descriptor.width,height:e.descriptor.height};t.bindVAO(this._vao),t.setViewport(s.x,s.y,s.width,s.height),this._edges.resize(s.width,s.height),t.bindFramebuffer(this._edges),t.setClearColor(0,0,0,1),t.clear(f.COLOR_BUFFER_BIT);const i=t.useTechnique(this._edgeDetectTechnique);i.bindTexture(e,"tColor"),i.setUniform4f("resolution",1/s.width,1/s.height,s.width,s.height),t.drawArrays(w.TRIANGLES,0,3),this._blend.resize(s.width,s.height),t.bindFramebuffer(this._blend),t.setClearColor(0,0,1,1),t.clear(f.COLOR_BUFFER_BIT);const o=t.useTechnique(this._blendWeightsTechnique);o.setUniform4f("resolution",1/s.width,1/s.height,s.width,s.height),o.bindTexture(this._searchTexture,"tSearch"),o.bindTexture(this._areaTexture,"tArea"),o.bindTexture(this._edges.colorTexture,"tEdges"),t.drawArrays(w.TRIANGLES,0,3),t.bindFramebuffer(r),t.setClearColor(0,1,0,1),t.clear(f.COLOR_BUFFER_BIT);const h=t.useTechnique(this._blurTechnique);h.setUniform4f("resolution",1/s.width,1/s.height,s.width,s.height),h.bindTexture(e,"tColor"),h.bindTexture(this._blend.colorTexture,"tBlendWeights"),t.drawArrays(w.TRIANGLES,0,3)}_loadTextureFromBase64(e,t,r){const s=new R(this.rctx,{pixelFormat:r,dataType:E.UNSIGNED_BYTE,wrapMode:x.CLAMP_TO_EDGE,samplingMode:t},null);return l(e).then((e=>(s.resize(e.width,e.height),s.setData(e),s)))}};e([a()],C.prototype,"_abortController",void 0),e([a({readOnly:!0})],C.prototype,"updating",null),C=e([n("esri.views.3d.webgl-engine.lib.SmaaRenderPass")],C);export{C as SmaaRenderPass};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import s from"../../../../core/Evented.js";import{someMap as i}from"../../../../core/MapUtils.js";import{nextHighestPowerOfTwo as r}from"../../../../core/mathUtils.js";import{disposeMaybe as a,isSome as n,removeMaybe as h}from"../../../../core/maybe.js";import{generateUID as o}from"../../../../core/uid.js";import{property as l}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as d}from"../../../../core/accessorSupport/decorators/subclass.js";import{VertexAttribute as c}from"./basicInterfaces.js";import{ContentObjectType as m}from"./ContentObjectType.js";import{TaskPriority as p,noBudget as g}from"../../../support/Scheduler.js";import{TextureType as u,PixelFormat as x,PixelType as T,TextureWrapMode as _,TextureSamplingMode as A}from"../../../webgl/enums.js";import{Texture as f}from"../../../webgl/Texture.js";var y;const v=512,R=4096,z=.85,w=.95;let b=y=class extends t{constructor(e){super(e),this.type=m.Texture,this.id=o(),this.events=new s,this._glTexture=null,this.needsClear=!1,this.elementsToAddOrUpdate=new Map,this.elementsToRemove=new Map,this.elementsToRender=new Map,this.elements=new Map,this.stageObjects=new Map,this.updating=!1}initialize(){this.stage=this.view._stage,this.canvas=this._create2DCanvas(),this.ctx=this.canvas.getContext("2d"),this.stage.add(this);const e=this._computeAtlasResolution(this.view.width,this.view.height);this._createAtlasRegion(e),this._update2DCanvasSize(),this._resetAtlasCursor()}unload(){this._glTexture=a(this._glTexture),this.updating=!1,this.events.emit("unloaded")}get width(){return this.atlas.size.width}get height(){return this.atlas.size.height}get requiresFrameUpdates(){return!1}_createDescriptor(e){return{target:u.TEXTURE_2D,pixelFormat:x.RGBA,dataType:T.UNSIGNED_BYTE,wrapMode:_.CLAMP_TO_EDGE,flipped:!0,samplingMode:A.LINEAR_MIPMAP_LINEAR,hasMipmap:!0,preMultiplyAlpha:!0,maxAnisotropy:e.parameters.maxMaxAnisotropy}}get glTexture(){return this._glTexture}load(e){return n(this._glTexture)||(this._glTexture=new f(e,this._createDescriptor(e),this.canvas),this.frameWorker=this.view.resourceController.scheduler.registerTask(p.TEXT_TEXTURE_ATLAS,this),this.setDirty()),this._glTexture}dispose(){this.elements=null,this.elementsToAddOrUpdate=null,this.elementsToRemove=null,this.elementsToRender=null,this.frameWorker=h(this.frameWorker),this._glTexture&&(this.stage.remove(this),this._glTexture=a(this._glTexture)),this.canvas.width=0,this.canvas.height=0,this.canvas=null,this.ctx=null}_create2DCanvas(){const e=document.createElement("canvas");return e.setAttribute("id","canvas2d"),e.setAttribute("style","display:none"),e.setAttribute("width",v.toString()),e.setAttribute("height",v.toString()),e}_update2DCanvasSize(){this.canvas.setAttribute("width",this.atlas.size.width.toString()),this.canvas.setAttribute("height",this.atlas.size.height.toString())}_createAtlasRegion(e=v){this.atlas={size:{width:e,height:e},cursor:{x:0,y:0},lineHeight:0}}_computeAtlasResolution(e,t){let s=Math.max(e,t);return s+=256,s=r(s),s=Math.min(s,R),s}_resizeAtlas(e,t){t=t||e;const s=this.atlas;s.size.width=e,s.size.height=t,n(this._glTexture)&&this._glTexture.resize(e,t),this._update2DCanvasSize()}_resetAtlasCursor(){const e=this.atlas;e.cursor.x=O,e.cursor.y=O+j,e.lineHeight=0,this.needsClear=!0}_getAtlasUsage(){const e=this.atlas;return(e.cursor.x+e.cursor.y*e.size.width)/(e.size.width*e.size.height)}_getExpectedAtlasUsage(){const e=this.elementsToRemove.size,t=this.elementsToAddOrUpdate.size,s=this.elements.size;return this._getAtlasUsage()/s*(s+t-e)}_addAtlasElement(e,t,s,i){const r=this.atlas,{renderedWidth:a,renderedHeight:n,displayWidth:h,displayHeight:o}=e.textRenderer;e.placement.offset.x=r.cursor.x,e.placement.offset.y=r.cursor.y,e.placement.size.width=a,e.placement.size.height=n,e.placement.size.displayWidth=h,e.placement.size.displayHeight=o,e.placement.uvMinMax=[e.placement.offset.x/r.size.width,1-(e.placement.offset.y+n)/r.size.height,(e.placement.offset.x+a)/r.size.width,1-e.placement.offset.y/r.size.height],r.cursor.x+=s,r.lineHeight=Math.max(r.lineHeight,i),this.elements.set(t,e)}_removeAtlasElement(e){if(e&&this.elements.has(e.textId)){const t=e.placement.offset,s=e.placement.size;this.ctx.clearRect(t.x,t.y,s.width,s.height),this.elements.delete(e.textId)}}_ensureStageObjects(e){const t=this.stageObjects.get(e);if(t)return t;const s=new Set;return this.stageObjects.set(e,s),s}_addStageObject(e,t){this._ensureStageObjects(e).add(t)}_removeStageObject(e,t){const s=this.stageObjects.get(e);s&&s.delete(t)&&(t.geometries[0].vertexAttributes.get(c.SIZE).data=[0,0],t.geometryVertexAttrsUpdated(t.geometryRecords[0]))}_processAddition(e,t){const s=this.atlas,i=e.textId,r=e.textRenderer.renderedWidth,a=e.textRenderer.renderedHeight,n=r+O,h=a+O+j;if(s.cursor.x+n<s.size.width&&s.cursor.y+h<s.size.height)this._addAtlasElement(e,i,n,h),this.elementsToRender.set(i,e),this.elementsToAddOrUpdate.delete(i);else{if(!(s.cursor.y+h+s.lineHeight<s.size.height)){const e=this._getExpectedAtlasUsage(),i=e>z&&s.size.width<R;return i&&this._resizeAtlas(2*s.size.width,2*s.size.height),!t||!i&&e>w&&s.size.width===R?(this._processRemovals(),E.OK):(this._repack(),E.REPACK)}s.cursor.x=O,s.cursor.y+=s.lineHeight,s.lineHeight=0,this._addAtlasElement(e,i,n,h),this.elementsToRender.set(i,e),this.elementsToAddOrUpdate.delete(i)}return E.OK}_processRemovals(){this.elementsToRemove.forEach(((e,t)=>{const s=this.stageObjects.get(t);s&&0!==s.size||this._removeAtlasElement(e),s&&0===s.size&&this.stageObjects.delete(t)})),this.elementsToRemove.clear()}_repack(){this._processRemovals(),this.elements.forEach(((e,t)=>{e.rendered=!1,this.elementsToAddOrUpdate.set(t,e)})),this.elements.clear(),this._resetAtlasCursor(),this.elementsToRender.clear()}_processRenderingRequest(e){this.ctx.clearRect(e.placement.offset.x,e.placement.offset.y,e.placement.size.width,e.placement.size.height),e.textRenderer.render(this.ctx,e.placement.offset.x,e.placement.offset.y);const t=this.stageObjects.get(e.textId);t&&t.forEach((t=>{t.geometries[0].vertexAttributes.get(c.UV0).data=new Float32Array(e.placement.uvMinMax),t.geometries[0].vertexAttributes.get(c.SIZE).data=[e.placement.size.displayWidth,e.placement.size.displayHeight],t.geometryVertexAttrsUpdated(t.geometryRecords[0])})),e.rendered=!0}get running(){return this.updating}runTask(e,t=!0){if(!this._glTexture)return;let s=!1;if(i(this.elementsToAddOrUpdate,((e,i)=>{const r=this.elements.get(i);if(r&&r.rendered){const e=this.stageObjects.get(i);return e&&e.forEach((e=>{const t=e.geometries[0].vertexAttributes,s=this.elements.get(i);t.get(c.UV0).data=new Float32Array(s.placement.uvMinMax),t.get(c.SIZE).data=new Float32Array([s.placement.size.displayWidth,s.placement.size.displayHeight]),e.geometryVertexAttrsUpdated(e.geometryRecords[0])})),this.elementsToAddOrUpdate.delete(i),!1}return this._processAddition(this.elementsToAddOrUpdate.get(i),t)===E.REPACK&&(s=!0,!0)})),s)return void this.runTask(g,!1);let r=!1;this.elementsToRender.size>0&&this.needsClear&&(this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.needsClear=!1),i(this.elementsToRender,((t,s)=>(this._processRenderingRequest(t),this.elementsToRender.delete(s),r=!0,e.madeProgress(),e.done))),r&&n(this._glTexture)&&this._glTexture.setData(this.canvas),this.updating=this.elementsToRender.size>0,!this.updating&&y.test.orderedRepackingEnabled&&this.repackOrdered()}addTextTexture(e,t){const s=e.key;this.elementsToAddOrUpdate.has(s)||this.elementsToAddOrUpdate.set(s,{textId:s,placement:{offset:{x:0,y:0},size:{width:0,height:0,displayWidth:0,displayHeight:0},uvMinMax:[]},textRenderer:e,rendered:!1}),this._addStageObject(s,t),this.elementsToRemove.delete(s),this.setDirty()}removeTextTexture(e,t){const s=e.key;this.elementsToRemove.set(s,this.elements.get(s)),this._removeStageObject(s,t)}setDirty(){this._glTexture&&(this.updating=!0)}repackOrdered(){if(0===this.elements.size)return;const e=[];this.elements.forEach(((t,s)=>e.push({element:t,key:s})));let t=!0;for(let s=0;s<e.length-1;s++)if(e[s].key.localeCompare(e[s+1].key)>0){t=!1;break}if(!t||this.elementsToRemove.size){e.sort(((e,t)=>e.key.localeCompare(t.key))),this.elements.clear();for(const{element:t,key:s}of e)this.elements.set(s,t);this._repack(),this.setDirty()}}get test(){const{elements:e,stageObjects:t,elementsToRemove:s,atlas:i}=this,r=this;return{elements:e,stageObjects:t,elementsToRemove:s,atlas:i,_resizeAtlas:(e,t)=>r._resizeAtlas(e,t),run:(e,t)=>r.runTask(e,t)}}};b.test={orderedRepackingEnabled:!1},e([l({constructOnly:!0})],b.prototype,"view",void 0),e([l({type:Boolean})],b.prototype,"updating",void 0),b=y=e([d("esri.views.3d.webgl-engine.lib.TextTextureAtlas")],b);const O=2,j=2;var E;!function(e){e[e.OK=0]="OK",e[e.REPACK=1]="REPACK"}(E||(E={}));const U=b;export{b as TextTextureAtlas,U as default};
5
+ import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import s from"../../../../core/Evented.js";import{someMap as i}from"../../../../core/MapUtils.js";import{nextHighestPowerOfTwo as r}from"../../../../core/mathUtils.js";import{disposeMaybe as a,isSome as n,removeMaybe as h}from"../../../../core/maybe.js";import{generateUID as o}from"../../../../core/uid.js";import{property as l}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as d}from"../../../../core/accessorSupport/decorators/subclass.js";import{ContentObjectType as c}from"./ContentObjectType.js";import{VertexAttribute as m}from"./VertexAttribute.js";import{TaskPriority as p,noBudget as g}from"../../../support/Scheduler.js";import{TextureType as u,PixelFormat as x,PixelType as T,TextureWrapMode as _,TextureSamplingMode as A}from"../../../webgl/enums.js";import{Texture as f}from"../../../webgl/Texture.js";var y;const v=512,R=4096,z=.85,w=.95;let b=y=class extends t{constructor(e){super(e),this.type=c.Texture,this.id=o(),this.events=new s,this._glTexture=null,this.needsClear=!1,this.elementsToAddOrUpdate=new Map,this.elementsToRemove=new Map,this.elementsToRender=new Map,this.elements=new Map,this.stageObjects=new Map,this.updating=!1}initialize(){this.stage=this.view._stage,this.canvas=this._create2DCanvas(),this.ctx=this.canvas.getContext("2d"),this.stage.add(this);const e=this._computeAtlasResolution(this.view.width,this.view.height);this._createAtlasRegion(e),this._update2DCanvasSize(),this._resetAtlasCursor()}unload(){this._glTexture=a(this._glTexture),this.updating=!1,this.events.emit("unloaded")}get width(){return this.atlas.size.width}get height(){return this.atlas.size.height}get requiresFrameUpdates(){return!1}_createDescriptor(e){return{target:u.TEXTURE_2D,pixelFormat:x.RGBA,dataType:T.UNSIGNED_BYTE,wrapMode:_.CLAMP_TO_EDGE,flipped:!0,samplingMode:A.LINEAR_MIPMAP_LINEAR,hasMipmap:!0,preMultiplyAlpha:!0,maxAnisotropy:e.parameters.maxMaxAnisotropy}}get glTexture(){return this._glTexture}load(e){return n(this._glTexture)||(this._glTexture=new f(e,this._createDescriptor(e),this.canvas),this.frameWorker=this.view.resourceController.scheduler.registerTask(p.TEXT_TEXTURE_ATLAS,this),this.setDirty()),this._glTexture}dispose(){this.elements=null,this.elementsToAddOrUpdate=null,this.elementsToRemove=null,this.elementsToRender=null,this.frameWorker=h(this.frameWorker),this._glTexture&&(this.stage.remove(this),this._glTexture=a(this._glTexture)),this.canvas.width=0,this.canvas.height=0,this.canvas=null,this.ctx=null}_create2DCanvas(){const e=document.createElement("canvas");return e.setAttribute("id","canvas2d"),e.setAttribute("style","display:none"),e.setAttribute("width",v.toString()),e.setAttribute("height",v.toString()),e}_update2DCanvasSize(){this.canvas.setAttribute("width",this.atlas.size.width.toString()),this.canvas.setAttribute("height",this.atlas.size.height.toString())}_createAtlasRegion(e=v){this.atlas={size:{width:e,height:e},cursor:{x:0,y:0},lineHeight:0}}_computeAtlasResolution(e,t){let s=Math.max(e,t);return s+=256,s=r(s),s=Math.min(s,R),s}_resizeAtlas(e,t){t=t||e;const s=this.atlas;s.size.width=e,s.size.height=t,n(this._glTexture)&&this._glTexture.resize(e,t),this._update2DCanvasSize()}_resetAtlasCursor(){const e=this.atlas;e.cursor.x=O,e.cursor.y=O+j,e.lineHeight=0,this.needsClear=!0}_getAtlasUsage(){const e=this.atlas;return(e.cursor.x+e.cursor.y*e.size.width)/(e.size.width*e.size.height)}_getExpectedAtlasUsage(){const e=this.elementsToRemove.size,t=this.elementsToAddOrUpdate.size,s=this.elements.size;return this._getAtlasUsage()/s*(s+t-e)}_addAtlasElement(e,t,s,i){const r=this.atlas,{renderedWidth:a,renderedHeight:n,displayWidth:h,displayHeight:o}=e.textRenderer;e.placement.offset.x=r.cursor.x,e.placement.offset.y=r.cursor.y,e.placement.size.width=a,e.placement.size.height=n,e.placement.size.displayWidth=h,e.placement.size.displayHeight=o,e.placement.uvMinMax=[e.placement.offset.x/r.size.width,1-(e.placement.offset.y+n)/r.size.height,(e.placement.offset.x+a)/r.size.width,1-e.placement.offset.y/r.size.height],r.cursor.x+=s,r.lineHeight=Math.max(r.lineHeight,i),this.elements.set(t,e)}_removeAtlasElement(e){if(e&&this.elements.has(e.textId)){const t=e.placement.offset,s=e.placement.size;this.ctx.clearRect(t.x,t.y,s.width,s.height),this.elements.delete(e.textId)}}_ensureStageObjects(e){const t=this.stageObjects.get(e);if(t)return t;const s=new Set;return this.stageObjects.set(e,s),s}_addStageObject(e,t){this._ensureStageObjects(e).add(t)}_removeStageObject(e,t){const s=this.stageObjects.get(e);s&&s.delete(t)&&(t.geometries[0].vertexAttributes.get(m.SIZE).data=[0,0],t.geometryVertexAttrsUpdated(t.geometryRecords[0]))}_processAddition(e,t){const s=this.atlas,i=e.textId,r=e.textRenderer.renderedWidth,a=e.textRenderer.renderedHeight,n=r+O,h=a+O+j;if(s.cursor.x+n<s.size.width&&s.cursor.y+h<s.size.height)this._addAtlasElement(e,i,n,h),this.elementsToRender.set(i,e),this.elementsToAddOrUpdate.delete(i);else{if(!(s.cursor.y+h+s.lineHeight<s.size.height)){const e=this._getExpectedAtlasUsage(),i=e>z&&s.size.width<R;return i&&this._resizeAtlas(2*s.size.width,2*s.size.height),!t||!i&&e>w&&s.size.width===R?(this._processRemovals(),E.OK):(this._repack(),E.REPACK)}s.cursor.x=O,s.cursor.y+=s.lineHeight,s.lineHeight=0,this._addAtlasElement(e,i,n,h),this.elementsToRender.set(i,e),this.elementsToAddOrUpdate.delete(i)}return E.OK}_processRemovals(){this.elementsToRemove.forEach(((e,t)=>{const s=this.stageObjects.get(t);s&&0!==s.size||this._removeAtlasElement(e),s&&0===s.size&&this.stageObjects.delete(t)})),this.elementsToRemove.clear()}_repack(){this._processRemovals(),this.elements.forEach(((e,t)=>{e.rendered=!1,this.elementsToAddOrUpdate.set(t,e)})),this.elements.clear(),this._resetAtlasCursor(),this.elementsToRender.clear()}_processRenderingRequest(e){this.ctx.clearRect(e.placement.offset.x,e.placement.offset.y,e.placement.size.width,e.placement.size.height),e.textRenderer.render(this.ctx,e.placement.offset.x,e.placement.offset.y);const t=this.stageObjects.get(e.textId);t&&t.forEach((t=>{t.geometries[0].vertexAttributes.get(m.UV0).data=new Float32Array(e.placement.uvMinMax),t.geometries[0].vertexAttributes.get(m.SIZE).data=[e.placement.size.displayWidth,e.placement.size.displayHeight],t.geometryVertexAttrsUpdated(t.geometryRecords[0])})),e.rendered=!0}get running(){return this.updating}runTask(e,t=!0){if(!this._glTexture)return;let s=!1;if(i(this.elementsToAddOrUpdate,((e,i)=>{const r=this.elements.get(i);if(r&&r.rendered){const e=this.stageObjects.get(i);return e&&e.forEach((e=>{const t=e.geometries[0].vertexAttributes,s=this.elements.get(i);t.get(m.UV0).data=new Float32Array(s.placement.uvMinMax),t.get(m.SIZE).data=new Float32Array([s.placement.size.displayWidth,s.placement.size.displayHeight]),e.geometryVertexAttrsUpdated(e.geometryRecords[0])})),this.elementsToAddOrUpdate.delete(i),!1}return this._processAddition(this.elementsToAddOrUpdate.get(i),t)===E.REPACK&&(s=!0,!0)})),s)return void this.runTask(g,!1);let r=!1;this.elementsToRender.size>0&&this.needsClear&&(this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.needsClear=!1),i(this.elementsToRender,((t,s)=>(this._processRenderingRequest(t),this.elementsToRender.delete(s),r=!0,e.madeProgress(),e.done))),r&&n(this._glTexture)&&this._glTexture.setData(this.canvas),this.updating=this.elementsToRender.size>0,!this.updating&&y.test.orderedRepackingEnabled&&this.repackOrdered()}addTextTexture(e,t){const s=e.key;this.elementsToAddOrUpdate.has(s)||this.elementsToAddOrUpdate.set(s,{textId:s,placement:{offset:{x:0,y:0},size:{width:0,height:0,displayWidth:0,displayHeight:0},uvMinMax:[]},textRenderer:e,rendered:!1}),this._addStageObject(s,t),this.elementsToRemove.delete(s),this.setDirty()}removeTextTexture(e,t){const s=e.key;this.elementsToRemove.set(s,this.elements.get(s)),this._removeStageObject(s,t)}setDirty(){this._glTexture&&(this.updating=!0)}repackOrdered(){if(0===this.elements.size)return;const e=[];this.elements.forEach(((t,s)=>e.push({element:t,key:s})));let t=!0;for(let s=0;s<e.length-1;s++)if(e[s].key.localeCompare(e[s+1].key)>0){t=!1;break}if(!t||this.elementsToRemove.size){e.sort(((e,t)=>e.key.localeCompare(t.key))),this.elements.clear();for(const{element:t,key:s}of e)this.elements.set(s,t);this._repack(),this.setDirty()}}get test(){const{elements:e,stageObjects:t,elementsToRemove:s,atlas:i}=this,r=this;return{elements:e,stageObjects:t,elementsToRemove:s,atlas:i,_resizeAtlas:(e,t)=>r._resizeAtlas(e,t),run:(e,t)=>r.runTask(e,t)}}};b.test={orderedRepackingEnabled:!1},e([l({constructOnly:!0})],b.prototype,"view",void 0),e([l({type:Boolean})],b.prototype,"updating",void 0),b=y=e([d("esri.views.3d.webgl-engine.lib.TextTextureAtlas")],b);const O=2,j=2;var E;!function(e){e[e.OK=0]="OK",e[e.REPACK=1]="REPACK"}(E||(E={}));const U=b;export{b as TextTextureAtlas,U as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import{neverReached as t}from"../../../../core/compilerUtils.js";import e from"../../../../core/Error.js";import r from"../../../../core/Evented.js";import{isPowerOfTwo as i,nextHighestPowerOfTwo as s}from"../../../../core/mathUtils.js";import{isNone as a,isSome as o,removeMaybe as n}from"../../../../core/maybe.js";import{throwIfAborted as m,onAbort as h,createAbortError as l}from"../../../../core/promiseUtils.js";import{isArrayBuffer as p,isUint8Array as d}from"../../../../core/typedArrayUtil.js";import{isBlobProtocol as _,isDataProtocol as c}from"../../../../core/urlUtils.js";import{requestImage as u}from"../../../../support/requestImageUtils.js";import{loadImageAsync as T}from"../../../../support/requestUtils.js";import{PowerOfTwoResizeMode as g}from"./basicInterfaces.js";import{estimateMemoryKTX2 as f,estimateMemoryBasis as w,createTextureKTX2 as E,createTextureBasis as A}from"./BasisUtil.js";import{ContentObject as x}from"./ContentObject.js";import{ContentObjectType as D}from"./ContentObjectType.js";import{createDDSTexture as I}from"./DDSUtil.js";import{createQuadVAO as M}from"./glUtil3D.js";import{assert as F}from"./Util.js";import{TextureWrapMode as O,TextureType as N,PixelFormat as y,PixelType as R,TextureSamplingMode as U,TargetType as b,DepthStencilTargetType as C,PrimitiveType as P}from"../../../webgl/enums.js";import{FramebufferObject as S}from"../../../webgl/FramebufferObject.js";import{Texture as H}from"../../../webgl/Texture.js";import{vertexCount as V}from"../../../webgl/Util.js";import j from"../../../webgl/capabilities/isWebGL2Context.js";class L extends x{constructor(t,e){super(),this.data=t,this.type=D.Texture,this._glTexture=null,this._powerOfTwoStretchInfo=null,this._loadingPromise=null,this._loadingController=null,this.events=new r,this.params=e||{},this.params.mipmap=!1!==this.params.mipmap,this.params.noUnpackFlip=this.params.noUnpackFlip||!1,this.params.preMultiplyAlpha=this.params.preMultiplyAlpha||!1,this.params.wrap=this.params.wrap||{s:O.REPEAT,t:O.REPEAT},this.params.powerOfTwoResizeMode=this.params.powerOfTwoResizeMode||g.STRETCH,this.estimatedTexMemRequired=L._estimateTexMemRequired(this.data,this.params),this._startPreload()}_startPreload(){const t=this.data;a(t)||(t instanceof HTMLVideoElement?this._startPreloadVideoElement(t):t instanceof HTMLImageElement&&this._startPreloadImageElement(t))}_startPreloadVideoElement(t){_(t.src)||"auto"===t.preload&&t.crossOrigin||(t.preload="auto",t.crossOrigin="anonymous",t.src=t.src)}_startPreloadImageElement(t){c(t.src)||_(t.src)||t.crossOrigin||(t.crossOrigin="anonymous",t.src=t.src)}static _getDataDimensions(t){return t instanceof HTMLVideoElement?{width:t.videoWidth,height:t.videoHeight}:t}static _estimateTexMemRequired(t,e){if(a(t))return 0;if(p(t)||d(t))return e.encoding===L.KTX2_ENCODING?f(t,e.mipmap):e.encoding===L.BASIS_ENCODING?w(t,e.mipmap):t.byteLength;const{width:r,height:i}=t instanceof Image||t instanceof ImageData||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement?L._getDataDimensions(t):e;return(e.mipmap?4/3:1)*r*i*(e.components||4)||0}dispose(){this.data=void 0}get width(){return this.params.width}get height(){return this.params.height}_createDescriptor(t){var e;return{target:N.TEXTURE_2D,pixelFormat:y.RGBA,dataType:R.UNSIGNED_BYTE,wrapMode:this.params.wrap,flipped:!this.params.noUnpackFlip,samplingMode:this.params.mipmap?U.LINEAR_MIPMAP_LINEAR:U.LINEAR,hasMipmap:this.params.mipmap,preMultiplyAlpha:this.params.preMultiplyAlpha,maxAnisotropy:null!=(e=this.params.maxAnisotropy)?e:this.params.mipmap?t.parameters.maxMaxAnisotropy:1}}get glTexture(){return this._glTexture}load(t,e){if(o(this._glTexture))return this._glTexture;if(o(this._loadingPromise))return this._loadingPromise;const r=this.data;return a(r)?(this._glTexture=new H(t,this._createDescriptor(t),null),this._glTexture):"string"==typeof r?this._loadFromURL(t,e,r):r instanceof Image?this._loadFromImageElement(t,e,r):r instanceof HTMLVideoElement?this._loadFromVideoElement(t,e,r):r instanceof ImageData||r instanceof HTMLCanvasElement?this._loadFromImage(t,r,e):(p(r)||d(r))&&this.params.encoding===L.DDS_ENCODING?this._loadFromDDSData(t,r):(p(r)||d(r))&&this.params.encoding===L.KTX2_ENCODING?this._loadFromKTX2(t,r):(p(r)||d(r))&&this.params.encoding===L.BASIS_ENCODING?this._loadFromBasis(t,r):d(r)?this._loadFromPixelData(t,r):p(r)?this._loadFromPixelData(t,new Uint8Array(r)):null}get requiresFrameUpdates(){return this.data instanceof HTMLVideoElement}frameUpdate(t,e,r){if(!(this.data instanceof HTMLVideoElement)||a(this._glTexture))return r;if(this.data.readyState<G.HAVE_CURRENT_DATA||r===this.data.currentTime)return r;if(o(this._powerOfTwoStretchInfo)){const{framebuffer:r,vao:i,sourceTexture:s}=this._powerOfTwoStretchInfo;s.setData(this.data),this._drawStretchedTexture(t,e,r,i,s,this._glTexture)}else{const{width:t,height:e}=this.data,{width:r,height:i}=this._glTexture.descriptor;t!==r||e!==i?this._glTexture.updateData(0,0,0,Math.min(t,r),Math.min(e,i),this.data):this._glTexture.setData(this.data)}return this._glTexture.descriptor.hasMipmap&&this._glTexture.generateMipmap(),this.data.currentTime}_loadFromDDSData(t,e){return this._glTexture=I(t,this._createDescriptor(t),e),this._glTexture}_loadFromKTX2(t,e){return this._loadAsync((()=>E(t,this._createDescriptor(t),e).then((t=>(this._glTexture=t,t)))))}_loadFromBasis(t,e){return this._loadAsync((()=>A(t,this._createDescriptor(t),e).then((t=>(this._glTexture=t,t)))))}_loadFromPixelData(t,e){F(this.params.width>0&&this.params.height>0);const r=this._createDescriptor(t);return r.pixelFormat=1===this.params.components?y.LUMINANCE:3===this.params.components?y.RGB:y.RGBA,r.width=this.params.width,r.height=this.params.height,this._glTexture=new H(t,r,e),this._glTexture}_loadFromURL(t,e,r){return this._loadAsync((async i=>{const s=await u(r,{signal:i});return m(i),this._loadFromImage(t,s,e)}))}_loadFromImageElement(t,e,r){return r.complete?this._loadFromImage(t,r,e):this._loadAsync((async i=>{const s=await T(r,r.src,!1,i);return m(i),this._loadFromImage(t,s,e)}))}_loadFromVideoElement(t,e,r){return r.readyState>=G.HAVE_CURRENT_DATA?this._loadFromImage(t,r,e):this._loadFromVideoElementAsync(t,e,r)}_loadFromVideoElementAsync(t,r,i){return this._loadAsync((s=>new Promise(((a,o)=>{const m=()=>{i.removeEventListener("loadeddata",p),i.removeEventListener("error",d),n(_)},p=()=>{i.readyState>=G.HAVE_CURRENT_DATA&&(m(),a(this._loadFromImage(t,i,r)))},d=t=>{m(),o(t||new e("Failed to load video"))};i.addEventListener("loadeddata",p),i.addEventListener("error",d);const _=h(s,(()=>d(l())))}))))}_loadFromImage(t,e,r){const s=L._getDataDimensions(e);this.params.width=s.width,this.params.height=s.height;const a=this._createDescriptor(t);return a.pixelFormat=3===this.params.components?y.RGB:y.RGBA,!this._requiresPowerOfTwo(t,a)||i(s.width)&&i(s.height)?(a.width=s.width,a.height=s.height,this._glTexture=new H(t,a,e),this._glTexture):(this._glTexture=this._makePowerOfTwoTexture(t,e,s,a,r),this._glTexture)}_loadAsync(t){const e=new AbortController;this._loadingController=e;const r=t(e.signal);this._loadingPromise=r;const i=()=>{this._loadingController===e&&(this._loadingController=null),this._loadingPromise===r&&(this._loadingPromise=null)};return r.then(i,i),r}_requiresPowerOfTwo(t,e){const r=O.CLAMP_TO_EDGE,i="number"==typeof e.wrapMode?e.wrapMode===r:e.wrapMode.s===r&&e.wrapMode.t===r;return!j(t.gl)&&(e.hasMipmap||!i)}_makePowerOfTwoTexture(e,r,i,a,o){const{width:n,height:m}=i,h=s(n),l=s(m);let p;switch(a.width=h,a.height=l,this.params.powerOfTwoResizeMode){case g.PAD:a.textureCoordinateScaleFactor=[n/h,m/l],p=new H(e,a),p.updateData(0,0,0,n,m,r);break;case g.STRETCH:case null:case void 0:p=this._stretchToPowerOfTwo(e,r,a,o());break;default:t(this.params.powerOfTwoResizeMode)}return a.hasMipmap&&p.generateMipmap(),p}_stretchToPowerOfTwo(t,e,r,i){const s=new H(t,r),a=new S(t,{colorTarget:b.TEXTURE,depthStencilTarget:C.NONE},s),o=new H(t,{target:N.TEXTURE_2D,pixelFormat:r.pixelFormat,dataType:R.UNSIGNED_BYTE,wrapMode:O.CLAMP_TO_EDGE,samplingMode:U.LINEAR,flipped:!!r.flipped,maxAnisotropy:8,preMultiplyAlpha:r.preMultiplyAlpha},e),n=M(t),m=t.getBoundFramebufferObject();return this._drawStretchedTexture(t,i,a,n,o,s),this.requiresFrameUpdates?this._powerOfTwoStretchInfo={vao:n,sourceTexture:o,framebuffer:a}:(n.dispose(!0),o.dispose(),a.detachColorTexture(),a.dispose()),t.bindFramebuffer(m),s}_drawStretchedTexture(t,e,r,i,s,a){t.bindFramebuffer(r);const o=t.getViewport();t.setViewport(0,0,a.descriptor.width,a.descriptor.height);const n=e.program;t.useProgram(n),n.setUniform4f("color",1,1,1,1),n.bindTexture(s,"tex"),t.bindVAO(i),e.bindPipelineState(t),t.drawArrays(P.TRIANGLE_STRIP,0,V(i,"geometry")),t.bindFramebuffer(null),t.setViewport(o.x,o.y,o.width,o.height)}unload(){if(o(this._powerOfTwoStretchInfo)){const{framebuffer:t,vao:e,sourceTexture:r}=this._powerOfTwoStretchInfo;e.dispose(!0),r.dispose(),t.dispose(),this._glTexture=null,this._powerOfTwoStretchInfo=null}if(o(this._glTexture)&&(this._glTexture.dispose(),this._glTexture=null),o(this._loadingController)){const t=this._loadingController;this._loadingController=null,this._loadingPromise=null,t.abort()}this.events.emit("unloaded")}}var G;L.DDS_ENCODING="image/vnd-ms.dds",L.KTX2_ENCODING="image/ktx2",L.BASIS_ENCODING="image/x.basis",function(t){t[t.HAVE_NOTHING=0]="HAVE_NOTHING",t[t.HAVE_METADATA=1]="HAVE_METADATA",t[t.HAVE_CURRENT_DATA=2]="HAVE_CURRENT_DATA",t[t.HAVE_FUTURE_DATA=3]="HAVE_FUTURE_DATA",t[t.HAVE_ENOUGH_DATA=4]="HAVE_ENOUGH_DATA"}(G||(G={}));export{L as Texture};
5
+ import{neverReached as t}from"../../../../core/compilerUtils.js";import e from"../../../../core/Error.js";import r from"../../../../core/Evented.js";import{isPowerOfTwo as i,nextHighestPowerOfTwo as s}from"../../../../core/mathUtils.js";import{isNone as a,isSome as o,removeMaybe as n}from"../../../../core/maybe.js";import{throwIfAborted as m,onAbort as h,createAbortError as l}from"../../../../core/promiseUtils.js";import{isArrayBuffer as p,isUint8Array as d}from"../../../../core/typedArrayUtil.js";import{isBlobProtocol as _,isDataProtocol as c}from"../../../../core/urlUtils.js";import{requestImage as u}from"../../../../support/requestImageUtils.js";import{loadImageAsync as T}from"../../../../support/requestUtils.js";import{PowerOfTwoResizeMode as g}from"./basicInterfaces.js";import{estimateMemoryKTX2 as f,estimateMemoryBasis as w,createTextureKTX2 as E,createTextureBasis as A}from"./BasisUtil.js";import{ContentObject as x}from"./ContentObject.js";import{ContentObjectType as D}from"./ContentObjectType.js";import{createDDSTexture as I}from"./DDSUtil.js";import{createQuadVAO as M}from"./glUtil3D.js";import{assert as F}from"./Util.js";import{TextureWrapMode as O,TextureType as N,PixelFormat as y,PixelType as R,TextureSamplingMode as U,TargetType as C,DepthStencilTargetType as b,PrimitiveType as P}from"../../../webgl/enums.js";import{FramebufferObject as S}from"../../../webgl/FramebufferObject.js";import{Texture as H}from"../../../webgl/Texture.js";import{vertexCount as V}from"../../../webgl/Util.js";import j from"../../../webgl/capabilities/isWebGL2Context.js";class L extends x{constructor(t,e){super(),this.data=t,this.type=D.Texture,this._glTexture=null,this._powerOfTwoStretchInfo=null,this._loadingPromise=null,this._loadingController=null,this.events=new r,this.params=e||{},this.params.mipmap=!1!==this.params.mipmap,this.params.noUnpackFlip=this.params.noUnpackFlip||!1,this.params.preMultiplyAlpha=this.params.preMultiplyAlpha||!1,this.params.wrap=this.params.wrap||{s:O.REPEAT,t:O.REPEAT},this.params.powerOfTwoResizeMode=this.params.powerOfTwoResizeMode||g.STRETCH,this.estimatedTexMemRequired=L._estimateTexMemRequired(this.data,this.params),this._startPreload()}_startPreload(){const t=this.data;a(t)||(t instanceof HTMLVideoElement?this._startPreloadVideoElement(t):t instanceof HTMLImageElement&&this._startPreloadImageElement(t))}_startPreloadVideoElement(t){_(t.src)||"auto"===t.preload&&t.crossOrigin||(t.preload="auto",t.crossOrigin="anonymous",t.src=t.src)}_startPreloadImageElement(t){c(t.src)||_(t.src)||t.crossOrigin||(t.crossOrigin="anonymous",t.src=t.src)}static _getDataDimensions(t){return t instanceof HTMLVideoElement?{width:t.videoWidth,height:t.videoHeight}:t}static _estimateTexMemRequired(t,e){if(a(t))return 0;if(p(t)||d(t))return e.encoding===L.KTX2_ENCODING?f(t,e.mipmap):e.encoding===L.BASIS_ENCODING?w(t,e.mipmap):t.byteLength;const{width:r,height:i}=t instanceof Image||t instanceof ImageData||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement?L._getDataDimensions(t):e;return(e.mipmap?4/3:1)*r*i*(e.components||4)||0}dispose(){this.data=void 0}get width(){return this.params.width}get height(){return this.params.height}_createDescriptor(t){var e;return{target:N.TEXTURE_2D,pixelFormat:y.RGBA,dataType:R.UNSIGNED_BYTE,wrapMode:this.params.wrap,flipped:!this.params.noUnpackFlip,samplingMode:this.params.mipmap?U.LINEAR_MIPMAP_LINEAR:U.LINEAR,hasMipmap:this.params.mipmap,preMultiplyAlpha:this.params.preMultiplyAlpha,maxAnisotropy:null!=(e=this.params.maxAnisotropy)?e:this.params.mipmap?t.parameters.maxMaxAnisotropy:1}}get glTexture(){return this._glTexture}load(t,e){if(o(this._glTexture))return this._glTexture;if(o(this._loadingPromise))return this._loadingPromise;const r=this.data;return a(r)?(this._glTexture=new H(t,this._createDescriptor(t),null),this._glTexture):"string"==typeof r?this._loadFromURL(t,e,r):r instanceof Image?this._loadFromImageElement(t,e,r):r instanceof HTMLVideoElement?this._loadFromVideoElement(t,e,r):r instanceof ImageData||r instanceof HTMLCanvasElement?this._loadFromImage(t,r,e):(p(r)||d(r))&&this.params.encoding===L.DDS_ENCODING?this._loadFromDDSData(t,r):(p(r)||d(r))&&this.params.encoding===L.KTX2_ENCODING?this._loadFromKTX2(t,r):(p(r)||d(r))&&this.params.encoding===L.BASIS_ENCODING?this._loadFromBasis(t,r):d(r)?this._loadFromPixelData(t,r):p(r)?this._loadFromPixelData(t,new Uint8Array(r)):null}get requiresFrameUpdates(){return this.data instanceof HTMLVideoElement}frameUpdate(t,e,r){if(!(this.data instanceof HTMLVideoElement)||a(this._glTexture))return r;if(this.data.readyState<G.HAVE_CURRENT_DATA||r===this.data.currentTime)return r;if(o(this._powerOfTwoStretchInfo)){const{framebuffer:r,vao:i,sourceTexture:s}=this._powerOfTwoStretchInfo;s.setData(this.data),this._drawStretchedTexture(t,e,r,i,s,this._glTexture)}else{const{width:t,height:e}=this.data,{width:r,height:i}=this._glTexture.descriptor;t!==r||e!==i?this._glTexture.updateData(0,0,0,Math.min(t,r),Math.min(e,i),this.data):this._glTexture.setData(this.data)}return this._glTexture.descriptor.hasMipmap&&this._glTexture.generateMipmap(),this.data.currentTime}_loadFromDDSData(t,e){return this._glTexture=I(t,this._createDescriptor(t),e),this._glTexture}_loadFromKTX2(t,e){return this._loadAsync((()=>E(t,this._createDescriptor(t),e).then((t=>(this._glTexture=t,t)))))}_loadFromBasis(t,e){return this._loadAsync((()=>A(t,this._createDescriptor(t),e).then((t=>(this._glTexture=t,t)))))}_loadFromPixelData(t,e){F(this.params.width>0&&this.params.height>0);const r=this._createDescriptor(t);return r.pixelFormat=1===this.params.components?y.LUMINANCE:3===this.params.components?y.RGB:y.RGBA,r.width=this.params.width,r.height=this.params.height,this._glTexture=new H(t,r,e),this._glTexture}_loadFromURL(t,e,r){return this._loadAsync((async i=>{const s=await u(r,{signal:i});return m(i),this._loadFromImage(t,s,e)}))}_loadFromImageElement(t,e,r){return r.complete?this._loadFromImage(t,r,e):this._loadAsync((async i=>{const s=await T(r,r.src,!1,i);return m(i),this._loadFromImage(t,s,e)}))}_loadFromVideoElement(t,e,r){return r.readyState>=G.HAVE_CURRENT_DATA?this._loadFromImage(t,r,e):this._loadFromVideoElementAsync(t,e,r)}_loadFromVideoElementAsync(t,r,i){return this._loadAsync((s=>new Promise(((a,o)=>{const m=()=>{i.removeEventListener("loadeddata",p),i.removeEventListener("error",d),n(_)},p=()=>{i.readyState>=G.HAVE_CURRENT_DATA&&(m(),a(this._loadFromImage(t,i,r)))},d=t=>{m(),o(t||new e("Failed to load video"))};i.addEventListener("loadeddata",p),i.addEventListener("error",d);const _=h(s,(()=>d(l())))}))))}_loadFromImage(t,e,r){const s=L._getDataDimensions(e);this.params.width=s.width,this.params.height=s.height;const a=this._createDescriptor(t);return a.pixelFormat=3===this.params.components?y.RGB:y.RGBA,!this._requiresPowerOfTwo(t,a)||i(s.width)&&i(s.height)?(a.width=s.width,a.height=s.height,this._glTexture=new H(t,a,e),this._glTexture):(this._glTexture=this._makePowerOfTwoTexture(t,e,s,a,r),this._glTexture)}_loadAsync(t){const e=new AbortController;this._loadingController=e;const r=t(e.signal);this._loadingPromise=r;const i=()=>{this._loadingController===e&&(this._loadingController=null),this._loadingPromise===r&&(this._loadingPromise=null)};return r.then(i,i),r}_requiresPowerOfTwo(t,e){const r=O.CLAMP_TO_EDGE,i="number"==typeof e.wrapMode?e.wrapMode===r:e.wrapMode.s===r&&e.wrapMode.t===r;return!j(t.gl)&&(e.hasMipmap||!i)}_makePowerOfTwoTexture(e,r,i,a,o){const{width:n,height:m}=i,h=s(n),l=s(m);let p;switch(a.width=h,a.height=l,this.params.powerOfTwoResizeMode){case g.PAD:a.textureCoordinateScaleFactor=[n/h,m/l],p=new H(e,a),p.updateData(0,0,0,n,m,r);break;case g.STRETCH:case null:case void 0:p=this._stretchToPowerOfTwo(e,r,a,o());break;default:t(this.params.powerOfTwoResizeMode)}return a.hasMipmap&&p.generateMipmap(),p}_stretchToPowerOfTwo(t,e,r,i){const s=new H(t,r),a=new S(t,{colorTarget:C.TEXTURE,depthStencilTarget:b.NONE},s),o=new H(t,{target:N.TEXTURE_2D,pixelFormat:r.pixelFormat,dataType:R.UNSIGNED_BYTE,wrapMode:O.CLAMP_TO_EDGE,samplingMode:U.LINEAR,flipped:!!r.flipped,maxAnisotropy:8,preMultiplyAlpha:r.preMultiplyAlpha},e),n=M(t),m=t.getBoundFramebufferObject();return this._drawStretchedTexture(t,i,a,n,o,s),this.requiresFrameUpdates?this._powerOfTwoStretchInfo={vao:n,sourceTexture:o,framebuffer:a}:(n.dispose(!0),o.dispose(),a.detachColorTexture(),a.dispose()),t.bindFramebuffer(m),s}_drawStretchedTexture(t,e,r,i,s,a){t.bindFramebuffer(r);const o=t.getViewport();t.setViewport(0,0,a.descriptor.width,a.descriptor.height);const n=t.useTechnique(e);n.setUniform4f("uColor",1,1,1,1),n.bindTexture(s,"tex"),t.bindVAO(i),t.drawArrays(P.TRIANGLE_STRIP,0,V(i,"geometry")),t.bindFramebuffer(null),t.setViewport(o.x,o.y,o.width,o.height)}unload(){if(o(this._powerOfTwoStretchInfo)){const{framebuffer:t,vao:e,sourceTexture:r}=this._powerOfTwoStretchInfo;e.dispose(!0),r.dispose(),t.dispose(),this._glTexture=null,this._powerOfTwoStretchInfo=null}if(o(this._glTexture)&&(this._glTexture.dispose(),this._glTexture=null),o(this._loadingController)){const t=this._loadingController;this._loadingController=null,this._loadingPromise=null,t.abort()}this.events.emit("unloaded")}}var G;L.DDS_ENCODING="image/vnd-ms.dds",L.KTX2_ENCODING="image/ktx2",L.BASIS_ENCODING="image/x.basis",function(t){t[t.HAVE_NOTHING=0]="HAVE_NOTHING",t[t.HAVE_METADATA=1]="HAVE_METADATA",t[t.HAVE_CURRENT_DATA=2]="HAVE_CURRENT_DATA",t[t.HAVE_FUTURE_DATA=3]="HAVE_FUTURE_DATA",t[t.HAVE_ENOUGH_DATA=4]="HAVE_ENOUGH_DATA"}(G||(G={}));export{L as Texture};
@@ -0,0 +1,4 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
+ */
@@ -0,0 +1,4 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
+ */
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
+ */
5
+ var O;!function(O){O.POSITION="position",O.NORMAL="normal",O.UV0="uv0",O.AUXPOS1="auxpos1",O.AUXPOS2="auxpos2",O.MAPPOS="mapPos",O.COLOR="color",O.SYMBOLCOLOR="symbolColor",O.SIZE="size",O.TANGENT="tangent",O.OFFSET="offset",O.SUBDIVISIONFACTOR="subdivisionFactor",O.COLORFEATUREATTRIBUTE="colorFeatureAttribute",O.SIZEFEATUREATTRIBUTE="sizeFeatureAttribute",O.OPACITYFEATUREATTRIBUTE="opacityFeatureAttribute",O.DISTANCETOSTART="distanceToStart",O.UVMAPSPACE="uvMapSpace",O.BOUNDINGRECT="boundingRect",O.UVREGION="uvRegion",O.NORMALCOMPRESSED="normalCompressed",O.PROFILERIGHT="profileRight",O.PROFILEUP="profileUp",O.PROFILEVERTEXANDNORMAL="profileVertexAndNormal",O.FEATUREVALUE="featureValue",O.MODELORIGINHI="modelOriginHi",O.MODELORIGINLO="modelOriginLo",O.MODEL="model",O.MODELNORMAL="modelNormal",O.INSTANCECOLOR="instanceColor",O.INSTANCEFEATUREATTRIBUTE="instanceFeatureAttribute",O.LOCALTRANSFORM="localTransform",O.GLOBALTRANSFORM="globalTransform",O.BOUNDINGSPHERE="boundingSphere",O.MODELORIGIN="modelOrigin",O.MODELSCALEFACTORS="modelScaleFactors",O.FEATUREATTRIBUTE="featureAttribute",O.STATE="state",O.LODLEVEL="lodLevel",O.POSITION0="position0",O.POSITION1="position1",O.NORMALA="normalA",O.NORMALB="normalB",O.COMPONENTINDEX="componentIndex",O.VARIANTOFFSET="variantOffset",O.VARIANTSTROKE="variantStroke",O.VARIANTEXTENSION="variantExtension",O.U8PADDING="u8padding",O.U16PADDING="u16padding",O.SIDENESS="sideness",O.START="start",O.END="end",O.UP="up",O.EXTRUDE="extrude"}(O||(O={}));export{O as VertexAttribute};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- var O,e,n,t,o,A,E,N,T,i,a,r,R,l;!function(O){O.POSITION="position",O.NORMAL="normal",O.UV0="uv0",O.AUXPOS1="auxpos1",O.AUXPOS2="auxpos2",O.MAPPOS="mapPos",O.COLOR="color",O.SYMBOLCOLOR="symbolColor",O.SIZE="size",O.TANGENT="tangent",O.OFFSET="offset",O.SUBDIVISIONFACTOR="subdivisionFactor",O.COLORFEATUREATTRIBUTE="colorFeatureAttribute",O.SIZEFEATUREATTRIBUTE="sizeFeatureAttribute",O.OPACITYFEATUREATTRIBUTE="opacityFeatureAttribute",O.DISTANCETOSTART="distanceToStart",O.UVMAPSPACE="uvMapSpace",O.BOUNDINGRECT="boundingRect",O.UVREGION="uvRegion",O.NORMALCOMPRESSED="normalCompressed",O.PROFILERIGHT="profileRight",O.PROFILEUP="profileUp",O.PROFILEVERTEXANDNORMAL="profileVertexAndNormal",O.FEATUREVALUE="featureValue",O.MODELORIGINHI="modelOriginHi",O.MODELORIGINLO="modelOriginLo",O.MODEL="model",O.MODELNORMAL="modelNormal",O.INSTANCECOLOR="instanceColor",O.INSTANCEFEATUREATTRIBUTE="instanceFeatureAttribute",O.LOCALTRANSFORM="localTransform",O.GLOBALTRANSFORM="globalTransform",O.BOUNDINGSPHERE="boundingSphere",O.MODELORIGIN="modelOrigin",O.MODELSCALEFACTORS="modelScaleFactors",O.FEATUREATTRIBUTE="featureAttribute",O.STATE="state",O.LODLEVEL="lodLevel",O.POSITION0="position0",O.POSITION1="position1",O.NORMALA="normalA",O.NORMALB="normalB",O.COMPONENTINDEX="componentIndex",O.VARIANTOFFSET="variantOffset",O.VARIANTSTROKE="variantStroke",O.VARIANTEXTENSION="variantExtension",O.U8PADDING="u8padding",O.U16PADDING="u16padding",O.SIDENESS="sideness",O.START="start",O.END="end",O.UP="up",O.EXTRUDE="extrude"}(O||(O={})),function(O){O[O.None=0]="None",O[O.Front=1]="Front",O[O.Back=2]="Back",O[O.COUNT=3]="COUNT"}(e||(e={})),function(O){O[O.NONE=0]="NONE",O[O.SMAA=1]="SMAA"}(n||(n={})),function(O){O[O.Color=0]="Color",O[O.Alpha=1]="Alpha",O[O.FrontFace=2]="FrontFace",O[O.NONE=3]="NONE",O[O.COUNT=4]="COUNT"}(t||(t={})),function(O){O[O.BACKGROUND=0]="BACKGROUND",O[O.UPDATE=1]="UPDATE"}(o||(o={})),function(O){O[O.NOT_LOADED=0]="NOT_LOADED",O[O.LOADING=1]="LOADING",O[O.LOADED=2]="LOADED"}(A||(A={})),function(O){O[O.IntegratedMeshMaskExcluded=1]="IntegratedMeshMaskExcluded",O[O.OutlineVisualElementMask=2]="OutlineVisualElementMask"}(E||(E={})),function(O){O[O.ASYNC=0]="ASYNC",O[O.SYNC=1]="SYNC"}(N||(N={})),function(O){O[O.Highlight=0]="Highlight",O[O.MaskOccludee=1]="MaskOccludee",O[O.COUNT=2]="COUNT"}(T||(T={})),function(O){O[O.Triangle=0]="Triangle",O[O.Point=1]="Point",O[O.Line=2]="Line"}(i||(i={})),function(O){O[O.STRETCH=1]="STRETCH",O[O.PAD=2]="PAD"}(a||(a={})),function(O){O[O.CHANGED=0]="CHANGED",O[O.UNCHANGED=1]="UNCHANGED"}(r||(r={})),function(O){O[O.Blend=0]="Blend",O[O.Opaque=1]="Opaque",O[O.Mask=2]="Mask",O[O.MaskBlend=3]="MaskBlend",O[O.COUNT=4]="COUNT"}(R||(R={})),function(O){O[O.OFF=0]="OFF",O[O.ON=1]="ON"}(l||(l={}));export{R as AlphaDiscardMode,n as AntiAliasingMode,e as CullFaceOptions,l as Decorations,T as Object3DState,a as PowerOfTwoResizeMode,i as PrimitiveType,o as RenderRequestType,A as ResourceState,E as StencilBits,t as TransparencyPassType,N as UpdatePolicy,r as ValidationState,O as VertexAttribute};
5
+ var n,N,e,O,t,i,o,a,A,c,u,l,C;!function(n){n[n.None=0]="None",n[n.Front=1]="Front",n[n.Back=2]="Back",n[n.COUNT=3]="COUNT"}(n||(n={})),function(n){n[n.NONE=0]="NONE",n[n.SMAA=1]="SMAA"}(N||(N={})),function(n){n[n.Color=0]="Color",n[n.Alpha=1]="Alpha",n[n.FrontFace=2]="FrontFace",n[n.NONE=3]="NONE",n[n.COUNT=4]="COUNT"}(e||(e={})),function(n){n[n.BACKGROUND=0]="BACKGROUND",n[n.UPDATE=1]="UPDATE"}(O||(O={})),function(n){n[n.NOT_LOADED=0]="NOT_LOADED",n[n.LOADING=1]="LOADING",n[n.LOADED=2]="LOADED"}(t||(t={})),function(n){n[n.IntegratedMeshMaskExcluded=1]="IntegratedMeshMaskExcluded",n[n.OutlineVisualElementMask=2]="OutlineVisualElementMask"}(i||(i={})),function(n){n[n.ASYNC=0]="ASYNC",n[n.SYNC=1]="SYNC"}(o||(o={})),function(n){n[n.Highlight=0]="Highlight",n[n.MaskOccludee=1]="MaskOccludee",n[n.COUNT=2]="COUNT"}(a||(a={})),function(n){n[n.Triangle=0]="Triangle",n[n.Point=1]="Point",n[n.Line=2]="Line"}(A||(A={})),function(n){n[n.STRETCH=1]="STRETCH",n[n.PAD=2]="PAD"}(c||(c={})),function(n){n[n.CHANGED=0]="CHANGED",n[n.UNCHANGED=1]="UNCHANGED"}(u||(u={})),function(n){n[n.Blend=0]="Blend",n[n.Opaque=1]="Opaque",n[n.Mask=2]="Mask",n[n.MaskBlend=3]="MaskBlend",n[n.COUNT=4]="COUNT"}(l||(l={})),function(n){n[n.OFF=0]="OFF",n[n.ON=1]="ON"}(C||(C={}));export{l as AlphaDiscardMode,N as AntiAliasingMode,n as CullFaceOptions,C as Decorations,a as Object3DState,c as PowerOfTwoResizeMode,A as PrimitiveType,O as RenderRequestType,t as ResourceState,i as StencilBits,e as TransparencyPassType,o as UpdatePolicy,u as ValidationState};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import{unpackFloatRGBA as e}from"../../../../core/floatRGBA.js";import{isSome as t,isNone as r}from"../../../../core/maybe.js";import i from"../../../../core/PooledArray.js";import{m as n,c as s}from"../../../../chunks/mat4.js";import{c as a}from"../../../../chunks/mat4f64.js";import{m as o}from"../../../../chunks/vec3.js";import{l as h}from"../../../../chunks/vec4.js";import{c as f}from"../../../../chunks/vec4f64.js";import{intersectsSphere as c,create as l,copy as u}from"../../../../geometry/support/frustum.js";import{c as d}from"../../../../chunks/sphere.js";import{maxScale as g}from"../../support/mathUtils.js";import{empty as m,union as p,set as _}from"./depthRange.js";import{DepthOrder as b}from"./Octree.js";import{assert as w}from"./Util.js";const R=1e4,B=100,v=500,j=500,C=.1;function A(t,r,i){return e(r,t)*(i[1]-i[0])+i[0]}function M(e,t,r){if(t.size<R)return K.compute(e,t);const i=m();return r.forAll((t=>{t.isVisible&&p(i,T(e,t))})),i}function T(e,r){if(!r.isVisible)return;const i=m(),n=r.getSpatialQueryAccelerator();return t(n)?O(i,e,n):S(i,e,r.objects),i}function O(e,t,r){const i=t.eye,n=t.viewForward,s=t.frustum,a=e=>e.isVisible,o=r.objectCount;if(o<v)_(W,t.near,Math.min(e.near,t.far)),r.forEachInDepthRange(i,n,b.FRONT_TO_BACK,W,((r,i)=>{y(e,t,r),W.far=e.near,i.setRange(W)}),s,a),_(W,Math.max(e.far,t.near),t.far),r.forEachInDepthRange(i,n,b.BACK_TO_FRONT,W,((r,i)=>{y(e,t,r),W.near=e.far,i.setRange(W)}),s,a);else{const i=Math.max(Math.min(o,j),Math.ceil(o*C)),h=r.findClosest(n,b.FRONT_TO_BACK,s,a,i),f=r.findClosest(n,b.BACK_TO_FRONT,s,a,i);h&&f&&(I(e,t,h.boundingVolumeWorldSpace.bounds),I(e,t,f.boundingVolumeWorldSpace.bounds))}}function S(e,t,r){k.clear(),r.forAll((e=>{e.isVisible&&0!==e.geometryRecords.length&&k.add(e)})),k.empty||(k.sort(t),_(W,t.near,Math.min(e.near,t.far)),k.forEachInDepthRange(W,b.FRONT_TO_BACK,((r,i)=>{i<e.near&&y(e,t,r)})),_(W,Math.max(e.far,t.near),t.far),k.forEachInDepthRange(W,b.BACK_TO_FRONT,((t,r,i)=>{e.far=Math.max(e.far,i)})))}function y(e,t,r){if(!r.isVisible)return;if(!c(t.frustum,r.boundingVolumeWorldSpace.bounds))return;const i=r.transformation,s=E;r.geometryRecords.forEach((r=>{n(s,i,r.getShaderTransformation());const a=g(s);F(e,t,r.geometry.boundingInfo,s,a)}))}function F(e,t,i,n,s){if(r(i))return;const a=t.eye,h=t.viewForward;o(D,i.center,n);const f=h[0]*(D[0]-a[0])+h[1]*(D[1]-a[1])+h[2]*(D[2]-a[2]);if(D[3]=i.radius*s,!(f-D[3]>e.near&&f+D[3]<e.far)&&c(t.frustum,D))if(i.radius>B&&i.getChildren()){const r=i.getChildren();for(let i=0;i<8;++i)r[i]&&F(e,t,r[i],n,s)}else U.unionDepthRangeWithAABB(e,t.viewProjectionMatrix,n,i.bbMin,i.bbMax)}function I(e,t,r){const i=t.eye,n=t.viewForward,s=(r[0]-i[0])*n[0]+(r[1]-i[1])*n[1]+(r[2]-i[2])*n[2];e.near=Math.min(e.near,s-r[3]),e.far=Math.max(e.far,s+r[3])}class P{constructor(){this._items=new i({allocator:e=>e||{obj:null,distance:0,near:0,far:0},deallocator:e=>(e.obj=null,e.distance=0,e.near=0,e.far=0,e)})}get length(){return this._items.length}get empty(){return 0===this._items.length}clear(){this._items.clear()}add(e){this._items.pushNew().obj=e}sort(e){const t=e.eye,r=e.viewForward;this._items.forAll((e=>{const i=e.obj.boundingVolumeWorldSpace.bounds,n=(i[0]-t[0])*r[0]+(i[1]-t[1])*r[1]+(i[2]-t[2])*r[2];e.distance=n,e.near=n-i[3],e.far=n+i[3]})),this._items.sort(((e,t)=>e.distance-t.distance))}forEachInDepthRange(e,t,r){if(t===b.FRONT_TO_BACK)for(let i=0;i<this._items.length;++i){const t=this._items.data[i];t.far<e.near||t.near>e.far||r(t.obj,t.near,t.far)}else for(let i=this._items.length-1;i>=0;--i){const t=this._items.data[i];t.far<e.near||t.near>e.far||r(t.obj,t.near,t.far)}}}class x{constructor(){this.view=a(),this.viewProj=a(),this.frustum=l(),this.geometries=[],this.near=[],this.far=[],this.nearCandidates=[],this.farCandidates=[],this.range={near:0,far:0},this.looseRange={near:0,far:0}}compute(e,t){this._reset(),s(this.view,e.viewMatrix),n(this.viewProj,e.projectionMatrix,this.view),u(e.frustum,this.frustum);const r=this.view,i=r[2],a=r[6],o=r[10],h=r[14],f=this.range;let c=0;if(t.forEach((e=>{if(!e.instanceParameters.visible)return;if(!e.castShadow)return;let t;e.hasShaderTransformation?(e.computeBoundingSphere(e.getShaderTransformation(),D,1),t=D):t=e.boundingSphere;const r=i*t[0]+a*t[1]+o*t[2]+h,n=r-t[3],s=r+t[3];this.geometries[c]=e,this.near[c]=-s,this.far[c]=-n,++c})),0===this.geometries.length)return f;for(let n=0;n<this.geometries.length;++n)this.near[n]>f.far&&(f.far=this.near[n]),this.near[n]>2&&this.far[n]<f.near&&(f.near=this.far[n]);const l=this.looseRange;l.near=Math.max(.5*f.near,2),l.far=2*f.far;let d=0,g=0;for(let n=0;n<this.geometries.length;++n)this.near[n]<f.near&&(this.near[n]>=l.near?f.near=this.near[n]:this.nearCandidates[d++]=n),this.far[n]>f.far&&(this.far[n]<=l.far?f.far=this.far[n]:this.farCandidates[g++]=n);if(0===this.nearCandidates.length&&0===this.farCandidates.length)return f;this.nearCandidates.sort(((e,t)=>this.near[e]<this.near[t]?-1:this.near[e]>this.near[t]?1:0)),this.farCandidates.sort(((e,t)=>this.far[e]<this.far[t]?1:this.far[e]>this.far[t]?-1:0));for(let n=0;n<this.nearCandidates.length;++n){const e=this.nearCandidates[n];if(this.near[e]<f.near){const t=this.geometries[e],r=t.boundingInfo;this._includeNearBoundingInfoRec(r,t.getShaderTransformation())}}for(let n=0;n<this.farCandidates.length;++n){const e=this.farCandidates[n];if(this.far[e]>f.far){const t=this.geometries[e],r=t.boundingInfo;this._includeFarBoundingInfoRec(r,t.getShaderTransformation())}}return f}_reset(){this.geometries.length=0,this.near.length=0,this.far.length=0,this.nearCandidates.length=0,this.farCandidates.length=0,this.range.near=Number.MAX_VALUE,this.range.far=-Number.MAX_VALUE}_includeNearBoundingInfoRec(e,t){if(r(e))return;const i=e.getCenter();o(D,i,t);const n=g(t),s=D[0],a=D[1],h=D[2],f=e.getBSRadius()*n,c=this.frustum;if(c[0][0]*s+c[0][1]*a+c[0][2]*h+c[0][3]>f||c[1][0]*s+c[1][1]*a+c[1][2]*h+c[1][3]>f||c[2][0]*s+c[2][1]*a+c[2][2]*h+c[2][3]>f||c[3][0]*s+c[3][1]*a+c[3][2]*h+c[3][3]>f)return;const l=this.view[2]*s+this.view[6]*a+this.view[10]*h+this.view[14],u=l+f;if(!(-(l-f)<2||-u>=this.range.near))if(-u>this.looseRange.near)this.range.near=-u;else{if(f>B){const r=e.getChildren();if(void 0!==r){for(let e=0;e<8;++e)void 0!==r[e]&&this._includeNearBoundingInfoRec(r[e],t);return}}U.unionDepthRangeWithAABB(this.range,this.viewProj,t,e.getBBMin(),e.getBBMax())}}_includeFarBoundingInfoRec(e,t){if(r(e))return;let i=e.getBSRadius();const n=e.getCenter();o(D,n,t);const s=g(t),a=D[0],h=D[1],f=D[2];i*=s;const c=this.frustum;if(c[0][0]*a+c[0][1]*h+c[0][2]*f+c[0][3]>i||c[1][0]*a+c[1][1]*h+c[1][2]*f+c[1][3]>i||c[2][0]*a+c[2][1]*h+c[2][2]*f+c[2][3]>i||c[3][0]*a+c[3][1]*h+c[3][2]*f+c[3][3]>i)return;const l=this.view[2]*a+this.view[6]*h+this.view[10]*f+this.view[14]-i;if(!(-l<=this.range.far))if(-l<this.looseRange.far)this.range.far=-l;else{if(i>B){const r=e.getChildren();if(void 0!==r){for(let e=0;e<8;++e)void 0!==r[e]&&this._includeFarBoundingInfoRec(r[e],t);return}}U.unionDepthRangeWithAABB(this.range,this.viewProj,t,e.getBBMin(),e.getBBMax())}}}class N{constructor(){this.modelViewProj=a(),this.clipPosition=[f(),f(),f(),f(),f(),f(),f(),f()]}unionDepthRangeWithAABB(e,t,r,i,s){const a=this.modelViewProj;n(a,t,r);let o=!1;for(let n=0;n<8;++n){const e=this.clipPosition[n],t=0===n||3===n||4===n||7===n?i[0]:s[0],r=0===n||1===n||4===n||5===n?i[1]:s[1],o=n<4?i[2]:s[2];e[0]=a[0]*t+a[4]*r+a[8]*o+a[12],e[1]=a[1]*t+a[5]*r+a[9]*o+a[13],e[2]=a[2]*t+a[6]*r+a[10]*o+a[14],e[3]=a[3]*t+a[7]*r+a[11]*o+a[15]}for(let n=0;n<12;++n){const t=this.clipPosition[V[n][0]],r=this.clipPosition[V[n][1]],i=this.clipPosition[V[n][2]],s=this._clipTriangle(t,r,i);let a=!0;for(let e=0;e<s.length;++e){if(s[e][3]>=2){a=!1;break}}if(!a){o=!0;for(let t=0;t<s.length;++t){const r=s[t][3];r<e.near&&(e.near=r),r>e.far&&(e.far=r)}}}return o}_inside(e,t){return 0===t?e[0]>=-e[3]:1===t?e[1]>=-e[3]:2===t?e[0]<=e[3]:3===t?e[1]<=e[3]:void w(!1)}_intersect(e,t,r){let i=0;return 0===r?i=(-e[3]-e[0])/(t[0]-e[0]+t[3]-e[3]):1===r?i=(-e[3]-e[1])/(t[1]-e[1]+t[3]-e[3]):2===r?i=(e[3]-e[0])/(t[0]-e[0]-t[3]+e[3]):3===r&&(i=(e[3]-e[1])/(t[1]-e[1]-t[3]+e[3])),h(f(),e,t,i)}_clipTriangle(e,t,r){let i=[e,t,r];for(let n=0;n<4;++n){const e=i;i=[];for(let t=0;t<e.length;++t){const r=e[t],s=e[(t+1)%e.length];this._inside(s,n)?(this._inside(r,n)||i.push(this._intersect(r,s,n)),i.push(s)):this._inside(r,n)&&i.push(this._intersect(r,s,n))}}return i}}const V=[[0,1,3],[2,3,1],[1,5,2],[6,2,5],[5,4,6],[7,6,4],[4,0,7],[3,7,0],[3,2,7],[6,7,2],[4,5,0],[1,0,5]],D=d(),E=a(),W=m(),k=new P,K=new x,U=new N;export{x as DepthRangeFromRenderGeometries,T as depthRangeFromLayer,M as depthRangeFromScene,A as textureToDepth};
5
+ import{unpackFloatRGBA as e}from"../../../../core/floatRGBA.js";import{isSome as t,isNone as r}from"../../../../core/maybe.js";import i from"../../../../core/PooledArray.js";import{m as n,c as s}from"../../../../chunks/mat4.js";import{c as a}from"../../../../chunks/mat4f64.js";import{m as o}from"../../../../chunks/vec3.js";import{l as h}from"../../../../chunks/vec4.js";import{c as f}from"../../../../chunks/vec4f64.js";import{intersectsSphere as c,create as l,copy as u}from"../../../../geometry/support/frustum.js";import{c as d}from"../../../../chunks/sphere.js";import{maxScale as g}from"../../support/mathUtils.js";import{empty as m,union as p,set as _}from"./depthRange.js";import{DepthOrder as b}from"./Octree.js";import{assert as w}from"./Util.js";const R=1e4,B=100,v=500,j=500,C=.1;function A(t,r,i){return e(r,t)*(i[1]-i[0])+i[0]}function M(e,t,r){if(t.size<R)return K.compute(e,t);const i=m();return r.forAll((t=>{t.isVisible&&p(i,T(e,t))})),i}function T(e,r){if(!r.isVisible)return;const i=m(),n=r.getSpatialQueryAccelerator();return t(n)?O(i,e,n):S(i,e,r.objects),i}function O(e,t,r){const i=t.eye,n=t.viewForward,s=t.frustum,a=e=>e.isVisible,o=r.objectCount;if(o<v)_(W,t.near,Math.min(e.near,t.far)),r.forEachInDepthRange(i,n,b.FRONT_TO_BACK,W,((r,i)=>{y(e,t,r),W.far=e.near,i.setRange(W)}),s,a),_(W,Math.max(e.far,t.near),t.far),r.forEachInDepthRange(i,n,b.BACK_TO_FRONT,W,((r,i)=>{y(e,t,r),W.near=e.far,i.setRange(W)}),s,a);else{const i=Math.max(Math.min(o,j),Math.ceil(o*C)),h=r.findClosest(n,b.FRONT_TO_BACK,s,a,i),f=r.findClosest(n,b.BACK_TO_FRONT,s,a,i);h&&f&&(I(e,t,h.boundingVolumeWorldSpace.bounds),I(e,t,f.boundingVolumeWorldSpace.bounds))}}function S(e,t,r){k.clear(),r.forAll((e=>{e.isVisible&&0!==e.geometryRecords.length&&k.add(e)})),k.empty||(k.sort(t),_(W,t.near,Math.min(e.near,t.far)),k.forEachInDepthRange(W,b.FRONT_TO_BACK,((r,i)=>{i<e.near&&y(e,t,r)})),_(W,Math.max(e.far,t.near),t.far),k.forEachInDepthRange(W,b.BACK_TO_FRONT,((t,r,i)=>{e.far=Math.max(e.far,i)})))}function y(e,t,r){if(!r.isVisible)return;if(!c(t.frustum,r.boundingVolumeWorldSpace.bounds))return;const i=r.transformation,s=E;r.geometryRecords.forEach((r=>{n(s,i,r.getShaderTransformation());const a=g(s);F(e,t,r.geometry.boundingInfo,s,a)}))}function F(e,t,i,n,s){if(r(i))return;const a=t.eye,h=t.viewForward;o(D,i.center,n);const f=h[0]*(D[0]-a[0])+h[1]*(D[1]-a[1])+h[2]*(D[2]-a[2]);if(D[3]=i.radius*s,!(f-D[3]>e.near&&f+D[3]<e.far)&&c(t.frustum,D))if(i.radius>B&&i.getChildren()){const r=i.getChildren();for(let i=0;i<8;++i)r[i]&&F(e,t,r[i],n,s)}else U.unionDepthRangeWithAABB(e,t.viewProjectionMatrix,n,i.bbMin,i.bbMax)}function I(e,t,r){const i=t.eye,n=t.viewForward,s=(r[0]-i[0])*n[0]+(r[1]-i[1])*n[1]+(r[2]-i[2])*n[2];e.near=Math.min(e.near,s-r[3]),e.far=Math.max(e.far,s+r[3])}class P{constructor(){this._items=new i({allocator:e=>e||{obj:null,distance:0,near:0,far:0},deallocator:e=>(e.obj=null,e.distance=0,e.near=0,e.far=0,e)})}get length(){return this._items.length}get empty(){return 0===this._items.length}clear(){this._items.clear()}add(e){this._items.pushNew().obj=e}sort(e){const t=e.eye,r=e.viewForward;this._items.forAll((e=>{const i=e.obj.boundingVolumeWorldSpace.bounds,n=(i[0]-t[0])*r[0]+(i[1]-t[1])*r[1]+(i[2]-t[2])*r[2];e.distance=n,e.near=n-i[3],e.far=n+i[3]})),this._items.sort(((e,t)=>e.distance-t.distance))}forEachInDepthRange(e,t,r){if(t===b.FRONT_TO_BACK)for(let i=0;i<this._items.length;++i){const t=this._items.data[i];t.far<e.near||t.near>e.far||r(t.obj,t.near,t.far)}else for(let i=this._items.length-1;i>=0;--i){const t=this._items.data[i];t.far<e.near||t.near>e.far||r(t.obj,t.near,t.far)}}}class x{constructor(){this.view=a(),this.viewProj=a(),this.frustum=l(),this.geometries=[],this.near=[],this.far=[],this.nearCandidates=[],this.farCandidates=[],this.range={near:0,far:0},this.looseRange={near:0,far:0}}compute(e,t){this._reset(),s(this.view,e.viewMatrix),n(this.viewProj,e.projectionMatrix,this.view),u(this.frustum,e.frustum);const r=this.view,i=r[2],a=r[6],o=r[10],h=r[14],f=this.range;let c=0;if(t.forEach((e=>{if(!e.instanceParameters.visible)return;if(!e.castShadow)return;let t;e.hasShaderTransformation?(e.computeBoundingSphere(e.getShaderTransformation(),D,1),t=D):t=e.boundingSphere;const r=i*t[0]+a*t[1]+o*t[2]+h,n=r-t[3],s=r+t[3];this.geometries[c]=e,this.near[c]=-s,this.far[c]=-n,++c})),0===this.geometries.length)return f;for(let n=0;n<this.geometries.length;++n)this.near[n]>f.far&&(f.far=this.near[n]),this.near[n]>2&&this.far[n]<f.near&&(f.near=this.far[n]);const l=this.looseRange;l.near=Math.max(.5*f.near,2),l.far=2*f.far;let d=0,g=0;for(let n=0;n<this.geometries.length;++n)this.near[n]<f.near&&(this.near[n]>=l.near?f.near=this.near[n]:this.nearCandidates[d++]=n),this.far[n]>f.far&&(this.far[n]<=l.far?f.far=this.far[n]:this.farCandidates[g++]=n);if(0===this.nearCandidates.length&&0===this.farCandidates.length)return f;this.nearCandidates.sort(((e,t)=>this.near[e]<this.near[t]?-1:this.near[e]>this.near[t]?1:0)),this.farCandidates.sort(((e,t)=>this.far[e]<this.far[t]?1:this.far[e]>this.far[t]?-1:0));for(let n=0;n<this.nearCandidates.length;++n){const e=this.nearCandidates[n];if(this.near[e]<f.near){const t=this.geometries[e],r=t.boundingInfo;this._includeNearBoundingInfoRec(r,t.getShaderTransformation())}}for(let n=0;n<this.farCandidates.length;++n){const e=this.farCandidates[n];if(this.far[e]>f.far){const t=this.geometries[e],r=t.boundingInfo;this._includeFarBoundingInfoRec(r,t.getShaderTransformation())}}return f}_reset(){this.geometries.length=0,this.near.length=0,this.far.length=0,this.nearCandidates.length=0,this.farCandidates.length=0,this.range.near=Number.MAX_VALUE,this.range.far=-Number.MAX_VALUE}_includeNearBoundingInfoRec(e,t){if(r(e))return;const i=e.getCenter();o(D,i,t);const n=g(t),s=D[0],a=D[1],h=D[2],f=e.getBSRadius()*n,c=this.frustum;if(c[0][0]*s+c[0][1]*a+c[0][2]*h+c[0][3]>f||c[1][0]*s+c[1][1]*a+c[1][2]*h+c[1][3]>f||c[2][0]*s+c[2][1]*a+c[2][2]*h+c[2][3]>f||c[3][0]*s+c[3][1]*a+c[3][2]*h+c[3][3]>f)return;const l=this.view[2]*s+this.view[6]*a+this.view[10]*h+this.view[14],u=l+f;if(!(-(l-f)<2||-u>=this.range.near))if(-u>this.looseRange.near)this.range.near=-u;else{if(f>B){const r=e.getChildren();if(void 0!==r){for(let e=0;e<8;++e)void 0!==r[e]&&this._includeNearBoundingInfoRec(r[e],t);return}}U.unionDepthRangeWithAABB(this.range,this.viewProj,t,e.getBBMin(),e.getBBMax())}}_includeFarBoundingInfoRec(e,t){if(r(e))return;let i=e.getBSRadius();const n=e.getCenter();o(D,n,t);const s=g(t),a=D[0],h=D[1],f=D[2];i*=s;const c=this.frustum;if(c[0][0]*a+c[0][1]*h+c[0][2]*f+c[0][3]>i||c[1][0]*a+c[1][1]*h+c[1][2]*f+c[1][3]>i||c[2][0]*a+c[2][1]*h+c[2][2]*f+c[2][3]>i||c[3][0]*a+c[3][1]*h+c[3][2]*f+c[3][3]>i)return;const l=this.view[2]*a+this.view[6]*h+this.view[10]*f+this.view[14]-i;if(!(-l<=this.range.far))if(-l<this.looseRange.far)this.range.far=-l;else{if(i>B){const r=e.getChildren();if(void 0!==r){for(let e=0;e<8;++e)void 0!==r[e]&&this._includeFarBoundingInfoRec(r[e],t);return}}U.unionDepthRangeWithAABB(this.range,this.viewProj,t,e.getBBMin(),e.getBBMax())}}}class N{constructor(){this.modelViewProj=a(),this.clipPosition=[f(),f(),f(),f(),f(),f(),f(),f()]}unionDepthRangeWithAABB(e,t,r,i,s){const a=this.modelViewProj;n(a,t,r);let o=!1;for(let n=0;n<8;++n){const e=this.clipPosition[n],t=0===n||3===n||4===n||7===n?i[0]:s[0],r=0===n||1===n||4===n||5===n?i[1]:s[1],o=n<4?i[2]:s[2];e[0]=a[0]*t+a[4]*r+a[8]*o+a[12],e[1]=a[1]*t+a[5]*r+a[9]*o+a[13],e[2]=a[2]*t+a[6]*r+a[10]*o+a[14],e[3]=a[3]*t+a[7]*r+a[11]*o+a[15]}for(let n=0;n<12;++n){const t=this.clipPosition[V[n][0]],r=this.clipPosition[V[n][1]],i=this.clipPosition[V[n][2]],s=this._clipTriangle(t,r,i);let a=!0;for(let e=0;e<s.length;++e){if(s[e][3]>=2){a=!1;break}}if(!a){o=!0;for(let t=0;t<s.length;++t){const r=s[t][3];r<e.near&&(e.near=r),r>e.far&&(e.far=r)}}}return o}_inside(e,t){return 0===t?e[0]>=-e[3]:1===t?e[1]>=-e[3]:2===t?e[0]<=e[3]:3===t?e[1]<=e[3]:void w(!1)}_intersect(e,t,r){let i=0;return 0===r?i=(-e[3]-e[0])/(t[0]-e[0]+t[3]-e[3]):1===r?i=(-e[3]-e[1])/(t[1]-e[1]+t[3]-e[3]):2===r?i=(e[3]-e[0])/(t[0]-e[0]-t[3]+e[3]):3===r&&(i=(e[3]-e[1])/(t[1]-e[1]-t[3]+e[3])),h(f(),e,t,i)}_clipTriangle(e,t,r){let i=[e,t,r];for(let n=0;n<4;++n){const e=i;i=[];for(let t=0;t<e.length;++t){const r=e[t],s=e[(t+1)%e.length];this._inside(s,n)?(this._inside(r,n)||i.push(this._intersect(r,s,n)),i.push(s)):this._inside(r,n)&&i.push(this._intersect(r,s,n))}}return i}}const V=[[0,1,3],[2,3,1],[1,5,2],[6,2,5],[5,4,6],[7,6,4],[4,0,7],[3,7,0],[3,2,7],[6,7,2],[4,5,0],[1,0,5]],D=d(),E=a(),W=m(),k=new P,K=new x,U=new N;export{x as DepthRangeFromRenderGeometries,T as depthRangeFromLayer,M as depthRangeFromScene,A as textureToDepth};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import{releaseMaybe as e,isNone as s}from"../../../../../core/maybe.js";import t from"../../../../../core/PooledArray.js";import{t as r,e as i,g as o}from"../../../../../chunks/mat3.js";import{c as n}from"../../../../../chunks/mat3f32.js";import{g as a,s as l}from"../../../../../chunks/vec3.js";import{c as h}from"../../../../../chunks/vec3f64.js";import d from"../../../support/debugFlags.js";import{ComponentDrawParameters as c}from"../../collections/Component/Material/ComponentTechnique.js";import{bindSliceUniforms as m}from"../../core/shaderLibrary/Slice.glsl.js";import{VertexPosition as u}from"../../core/shaderLibrary/attributes/VertexPosition.glsl.js";import{bindMultipassTerrainTexture as f}from"../../core/shaderLibrary/shading/MultipassTerrainTest.glsl.js";import{doublePrecisionRequiresObfuscation as g}from"../../core/shaderLibrary/util/DoublePrecision.glsl.js";import{TwoVectorPosition as b}from"../../core/util/TwoVectorPosition.js";import{EdgeShaderTechnique as p}from"./EdgeShaderTechnique.js";import{Transparency as T}from"./interfaces.js";import{EdgeUtil as R}from"../../shaders/sources/edgeRenderer/EdgeUtil.glsl.js";import{PrimitiveType as A}from"../../../../webgl/enums.js";const P=8,E=128,S={type:"uber",slicePlaneEnabled:!1,sliceHighlightDisabled:!1,strokesTexture:null,legacy:!0};class N{constructor(){this._value=0}get value(){return this._value}increment(){this._value++}decrement(){this._value--}}const y={solid:R.Mode.SOLID,sketch:R.Mode.SKETCH,uber:R.Mode.MIXED};class v{constructor(e,s,r){this.rctx=e,this.shaderTechniqueRepository=s,this.config=new p.Configuration,this.technique=null,this.refCount=new N,this.renderables=new Set,this.sortedRenderables={[T.TRANSPARENT]:{[T.TRANSPARENT]:new t,[T.OPAQUE]:new t},[T.OPAQUE]:{[T.TRANSPARENT]:new t,[T.OPAQUE]:new t}},this.renderablesDirty=!1,this.settings={...S,...r},this.key=v.getKey(this.settings.type,this.settings.slicePlaneEnabled,this.settings.legacy);const i=this.settings.strokesTexture.variants;this.writerSettings={variants:i,reducedPrecision:d.TESTS_DISABLE_OPTIMIZATIONS},this.config.legacy=this.settings.legacy,this.config.mode=y[this.settings.type],this.config.silhouette=!1,this.config.antialiasing=!!this.rctx.capabilities.blendMinMax,this.config.slicePlaneEnabled=this.settings.slicePlaneEnabled,this.config.doublePrecisionRequiresObfuscation=g(e)}dispose(){this.technique=e(this.technique)}addRenderable(e){this.renderables.add(e),this.renderablesDirty=!0}removeRenderable(e){this.renderables.delete(e),this.renderablesDirty=!0}setRenderablesDirty(){this.renderablesDirty=!0}forEachRenderable(e,s){this.renderablesDirty&&this._sortRenderables(),this.sortedRenderables[s][T.TRANSPARENT].forAll(e),this.sortedRenderables[s][T.OPAQUE].forAll(e)}setMultipassParameters(e){this.config.multipassTerrainEnabled=!!e.multipassTerrainEnabled&&e.multipassTerrainEnabled,this.config.cullAboveGround=!!e.cullAboveGround&&e.cullAboveGround}bindRegularEdges(e,s){this.setMultipassParameters(e),this.config.silhouette=!1,this.technique=this.shaderTechniqueRepository.releaseAndAcquire(p,this.config,this.technique),this.rctx.useProgram(this.technique.program),this.technique.bindPass({bindParameters:e,edgeRenderParameters:s}),this.technique.bindPipelineState(this.rctx,e.slot)}bindSilhouetteEdges(e,s){this.setMultipassParameters(e),this.config.silhouette=!0,this.technique=this.shaderTechniqueRepository.releaseAndAcquire(p,this.config,this.technique),this.rctx.useProgram(this.technique.program),this.technique.bindPass({bindParameters:e,edgeRenderParameters:s}),this.technique.bindPipelineState(this.rctx,e.slot)}renderRegularEdges(e,s,t){this._render(e,e.regular.vao,s,t)}renderSilhouetteEdges(e,s,t){this._render(e,e.silhouette.vao,s,t)}_render(e,s,t,r){this._setUniforms(e,t),this.rctx.bindVAO(s),this.rctx.capabilities.instancing.drawArraysInstanced(A.TRIANGLE_FAN,0,4,r)}_setUniforms(e,s){const t=this.technique.program;if(e.components.buffer.textureBuffer.bind(t,M,U),s.multipassTerrainEnabled&&(t.setUniform2fv("cameraNearFar",s.camera.nearFar),t.setUniform2fv("inverseViewport",s.inverseViewport),f(t,s)),"origin"in e.transform)t.setUniformMatrix4fv("uView",s.localViewMatrixForEdges),t.setUniformMatrix4fv("uModel",e.transform.modelMatrix),m(t,this.settings,s.slicePlane,e.transform.origin.vec3);else{const n=new b(e.transform.position),h=r(x,i(x,e.transform.rotationScale)),d=new c;a(d.worldFromModel_TL,n.low),a(d.worldFromModel_TH,n.high),o(d.worldFromModel_RS,e.transform.rotationScale),o(d.transformNormal_GlobalFromModel,h),u.bindModelTransform(t,d),t.setUniformMatrix3fv("uTransformNormal_GlobalFromModel",d.transformNormal_GlobalFromModel);const f=s.camera.viewInverseTransposeMatrix,g=l(w,f[3],f[7],f[11]);m(t,this.settings,s.slicePlane,g)}"uber"!==this.settings.type&&"sketch"!==this.settings.type||this._setSketchUniforms(t),t.setUniform1f("uWorldLineRadiusPerDistance",Math.tan(s.camera.fovY/2)/(s.camera.fullViewport[3]/2))}_setSketchUniforms(e){const t=this.settings.strokesTexture,r=t.texture;s(r)||(e.bindTexture(r,"uStrokesTexture"),e.setUniform2f("uStrokesTextureScale",1/r.descriptor.width,1/r.descriptor.height),e.setUniform1f("uStrokesLog2Resolution",Math.log2(t.resolution)),e.setUniform1f("uStrokesNormalizationScale",t.normalizationScale),e.setUniform1f("uStrokesAmplitude",t.amplitude),e.setUniform1f("uStrokeVariants",t.variants))}_sortRenderables(){this.renderablesDirty=!1,this.sortedRenderables[T.TRANSPARENT][T.TRANSPARENT].clear(),this.sortedRenderables[T.TRANSPARENT][T.OPAQUE].clear(),this.sortedRenderables[T.OPAQUE][T.TRANSPARENT].clear(),this.sortedRenderables[T.OPAQUE][T.OPAQUE].clear(),this.renderables.forEach((e=>{e.objectTransparency!==T.INVISIBLE&&e.edgeTransparency!==T.INVISIBLE&&this.sortedRenderables[e.objectTransparency][e.edgeTransparency].push(e)}));const e=(e,s)=>"origin"in e.transform&&"origin"in s.transform?e.transform.origin.id<s.transform.origin.id?-1:e.transform.origin.id>s.transform.origin.id?1:0:0;this.sortedRenderables[T.TRANSPARENT][T.TRANSPARENT].sort(e),this.sortedRenderables[T.TRANSPARENT][T.OPAQUE].sort(e),this.sortedRenderables[T.OPAQUE][T.TRANSPARENT].sort(e),this.sortedRenderables[T.OPAQUE][T.OPAQUE].sort(e)}static getKey(e,s,t){return`edges-t:${e}:${s}:${t}`}}const M="uComponentDataTex",U="uComponentDataTexInvDim",x=n(),w=h();export{E as EXTENSION_LENGTH_OFFSET,v as EdgeRenderer,P as LINE_WIDTH_FRACTION_FACTOR,U as componentDataInvDimName,M as componentDataTexName};
5
+ import{releaseMaybe as e,isNone as s}from"../../../../../core/maybe.js";import t from"../../../../../core/PooledArray.js";import{t as r,e as i,g as n}from"../../../../../chunks/mat3.js";import{c as o}from"../../../../../chunks/mat3f32.js";import{g as a,s as l}from"../../../../../chunks/vec3.js";import{c as h}from"../../../../../chunks/vec3f64.js";import c from"../../../support/debugFlags.js";import{ComponentDrawParameters as d}from"../../collections/Component/Material/ComponentTechnique.js";import{bindSliceUniforms as m}from"../../core/shaderLibrary/Slice.glsl.js";import{bindModelTransform as u}from"../../core/shaderLibrary/attributes/VertexPosition.glsl.js";import{bindMultipassTerrainTexture as f}from"../../core/shaderLibrary/shading/MultipassTerrainTest.glsl.js";import{doublePrecisionRequiresObfuscation as g}from"../../core/shaderLibrary/util/DoublePrecision.glsl.js";import{TwoVectorPosition as b}from"../../core/util/TwoVectorPosition.js";import{EdgeShaderTechniqueConfiguration as T,EdgeShaderTechnique as p}from"./EdgeShaderTechnique.js";import{Transparency as R}from"./interfaces.js";import{EdgeUtilMode as A}from"../../shaders/sources/edgeRenderer/EdgeUtil.glsl.js";import{PrimitiveType as E}from"../../../../webgl/enums.js";const P=8,S=128,y={type:"uber",slicePlaneEnabled:!1,sliceHighlightDisabled:!1,strokesTexture:null,legacy:!0};class N{constructor(){this._value=0}get value(){return this._value}increment(){this._value++}decrement(){this._value--}}const v={solid:A.SOLID,sketch:A.SKETCH,uber:A.MIXED};class U{constructor(e,s,r){this.rctx=e,this.shaderTechniqueRepository=s,this.config=new T,this.technique=null,this.refCount=new N,this.renderables=new Set,this.sortedRenderables={[R.TRANSPARENT]:{[R.TRANSPARENT]:new t,[R.OPAQUE]:new t},[R.OPAQUE]:{[R.TRANSPARENT]:new t,[R.OPAQUE]:new t}},this.renderablesDirty=!1,this.settings={...y,...r},this.key=U.getKey(this.settings.type,this.settings.slicePlaneEnabled,this.settings.legacy);const i=this.settings.strokesTexture.variants;this.writerSettings={variants:i,reducedPrecision:c.TESTS_DISABLE_OPTIMIZATIONS},this.config.legacy=this.settings.legacy,this.config.mode=v[this.settings.type],this.config.silhouette=!1,this.config.antialiasing=!!this.rctx.capabilities.blendMinMax,this.config.slicePlaneEnabled=this.settings.slicePlaneEnabled,this.config.doublePrecisionRequiresObfuscation=g(e)}dispose(){this.technique=e(this.technique)}addRenderable(e){this.renderables.add(e),this.renderablesDirty=!0}removeRenderable(e){this.renderables.delete(e),this.renderablesDirty=!0}setRenderablesDirty(){this.renderablesDirty=!0}forEachRenderable(e,s){this.renderablesDirty&&this._sortRenderables(),this.sortedRenderables[s][R.TRANSPARENT].forAll(e),this.sortedRenderables[s][R.OPAQUE].forAll(e)}setMultipassParameters(e){this.config.multipassTerrainEnabled=!!e.multipassTerrainEnabled&&e.multipassTerrainEnabled,this.config.cullAboveGround=!!e.cullAboveGround&&e.cullAboveGround}bindRegularEdges(e,s){this.setMultipassParameters(e),this.config.silhouette=!1,this.technique=this.shaderTechniqueRepository.releaseAndAcquire(p,this.config,this.technique),this.rctx.useTechnique(this.technique,e.slot),this.technique.bindPass({bindParameters:e,edgeRenderParameters:s})}bindSilhouetteEdges(e,s){this.setMultipassParameters(e),this.config.silhouette=!0,this.technique=this.shaderTechniqueRepository.releaseAndAcquire(p,this.config,this.technique),this.rctx.useTechnique(this.technique,e.slot),this.technique.bindPass({bindParameters:e,edgeRenderParameters:s})}renderRegularEdges(e,s,t){this._render(e,e.regular.vao,s,t)}renderSilhouetteEdges(e,s,t){this._render(e,e.silhouette.vao,s,t)}_render(e,s,t,r){this._setUniforms(e,t),this.rctx.bindVAO(s),this.rctx.capabilities.instancing.drawArraysInstanced(E.TRIANGLE_FAN,0,4,r)}_setUniforms(e,s){const t=this.technique.program;if(e.components.buffer.textureBuffer.bind(t,x,q),s.multipassTerrainEnabled&&(t.setUniform2fv("nearFar",s.camera.nearFar),t.setUniform2fv("inverseViewport",s.inverseViewport),f(t,s)),"origin"in e.transform)t.setUniformMatrix4fv("view",s.localViewMatrixForEdges),t.setUniformMatrix4fv("model",e.transform.modelMatrix),m(t,this.settings,s.slicePlane,e.transform.origin.vec3);else{const o=new b(e.transform.position),h=r(M,i(M,e.transform.rotationScale)),c=new d;a(c.transformWorldFromModelTL,o.low),a(c.transformWorldFromModelTH,o.high),n(c.transformWorldFromModelRS,e.transform.rotationScale),n(c.transformNormalGlobalFromModel,h),u(t,c),t.setUniformMatrix3fv("transformNormalGlobalFromModel",c.transformNormalGlobalFromModel);const f=s.camera.viewInverseTransposeMatrix,g=l(w,f[3],f[7],f[11]);m(t,this.settings,s.slicePlane,g)}"uber"!==this.settings.type&&"sketch"!==this.settings.type||this._setSketchUniforms(t)}_setSketchUniforms(e){const t=this.settings.strokesTexture,r=t.texture;s(r)||(e.bindTexture(r,"strokesTexture"),e.setUniform2f("strokesTextureScale",1/r.descriptor.width,1/r.descriptor.height),e.setUniform1f("strokesLog2Resolution",Math.log2(t.resolution)),e.setUniform1f("strokesNormalizationScale",t.normalizationScale),e.setUniform1f("strokesAmplitude",t.amplitude),e.setUniform1f("strokeVariants",t.variants))}_sortRenderables(){this.renderablesDirty=!1,this.sortedRenderables[R.TRANSPARENT][R.TRANSPARENT].clear(),this.sortedRenderables[R.TRANSPARENT][R.OPAQUE].clear(),this.sortedRenderables[R.OPAQUE][R.TRANSPARENT].clear(),this.sortedRenderables[R.OPAQUE][R.OPAQUE].clear(),this.renderables.forEach((e=>{e.objectTransparency!==R.INVISIBLE&&e.edgeTransparency!==R.INVISIBLE&&this.sortedRenderables[e.objectTransparency][e.edgeTransparency].push(e)}));const e=(e,s)=>"origin"in e.transform&&"origin"in s.transform?e.transform.origin.id<s.transform.origin.id?-1:e.transform.origin.id>s.transform.origin.id?1:0:0;this.sortedRenderables[R.TRANSPARENT][R.TRANSPARENT].sort(e),this.sortedRenderables[R.TRANSPARENT][R.OPAQUE].sort(e),this.sortedRenderables[R.OPAQUE][R.TRANSPARENT].sort(e),this.sortedRenderables[R.OPAQUE][R.OPAQUE].sort(e)}static getKey(e,s,t){return`edges-t:${e}:${s}:${t}`}}const x="componentDataTex",q="componentDataTexInvDim",M=o(),w=h();export{S as EXTENSION_LENGTH_OFFSET,U as EdgeRenderer,P as LINE_WIDTH_FRACTION_FACTOR,q as componentDataInvDimName,x as componentDataTexName};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../../chunks/tslib.es6.js";import{VertexPosition as r}from"../../core/shaderLibrary/attributes/VertexPosition.glsl.js";import{ReloadableShaderModule as i}from"../../core/shaderTechnique/ReloadableShaderModule.js";import{ShaderTechnique as o}from"../../core/shaderTechnique/ShaderTechnique.js";import{parameter as t,ShaderTechniqueConfiguration as a}from"../../core/shaderTechnique/ShaderTechniqueConfiguration.js";import{Program as s}from"../Program.js";import{EdgeShaderAttributeLocations as l}from"./bufferLayouts.js";import{E as n}from"../../../../../chunks/EdgeShaderProgram.glsl.js";import{EdgeUtil as d}from"../../shaders/sources/edgeRenderer/EdgeUtil.glsl.js";import{BlendOperation as u,BlendFactor as c,CompareFunction as m}from"../../../../webgl/enums.js";import{makePipelineState as f,separateBlendingParams as p,defaultColorWriteParams as h,defaultDepthWriteParams as b}from"../../../../webgl/renderState.js";const g=-4e-4,P=.5;class E extends o{bindPass(e){const i=this.program,{edgeRenderParameters:o,bindParameters:t}=e;r.bindViewProjTransform(i,o.viewProjectionTransform),i.setUniformMatrix3fv("uTransformNormal_ViewFromGlobal",o.transformNormal_ViewFromGlobal),i.setUniformMatrix4fv("uProj",t.camera.projectionMatrix),i.setUniform2f("uDepthBias",P,g),i.setUniform2f("uPixelToNDC",2/t.camera.fullViewport[2],2/t.camera.fullViewport[3]),i.setUniform2f("uNDCToPixel",t.camera.fullViewport[2]/2,t.camera.fullViewport[3]/2),i.setUniform1f("uDistanceFalloffFactor",o.distanceFalloffFactor),i.setUniform2f("uViewportDimInv",1/t.camera.fullViewport[2],1/t.camera.fullViewport[3]),i.setUniform1f("uPixelRatio",t.camera.pixelRatio||1)}initializeProgram(e){const r=E.shader.get(),i=this.configuration,o=r.build({slicePlaneEnabled:i.slicePlaneEnabled,sliceHighlightDisabled:!1,sliceEnabledForVertexPrograms:!1,silhouette:i.silhouette,legacy:i.legacy,antialiasing:i.antialiasing,mode:i.mode,doublePrecisionRequiresObfuscation:i.doublePrecisionRequiresObfuscation,multipassTerrainEnabled:i.multipassTerrainEnabled,cullAboveGround:i.cullAboveGround});return new s(e.rctx,o,l)}initializePipeline(e){const r=e.rctx.capabilities.blendMinMax;return f(r?{blending:p(c.ONE,c.ONE,c.ZERO,c.ONE,u.ADD,r.MAX),depthTest:{func:m.LEQUAL},colorWrite:h}:{depthTest:{func:m.LEQUAL},depthWrite:b,colorWrite:h})}}E.shader=new i(n,(()=>import("../../shaders/sources/edgeRenderer/EdgeShaderProgram.glsl.js"))),function(r){class i extends a{constructor(){super(...arguments),this.slicePlaneEnabled=!1,this.silhouette=!1,this.legacy=!1,this.antialiasing=!1,this.mode=d.Mode.SOLID,this.doublePrecisionRequiresObfuscation=!1,this.multipassTerrainEnabled=!1,this.cullAboveGround=!1}}e([t()],i.prototype,"slicePlaneEnabled",void 0),e([t()],i.prototype,"silhouette",void 0),e([t()],i.prototype,"legacy",void 0),e([t()],i.prototype,"antialiasing",void 0),e([t({count:d.Mode.COUNT})],i.prototype,"mode",void 0),e([t()],i.prototype,"doublePrecisionRequiresObfuscation",void 0),e([t()],i.prototype,"multipassTerrainEnabled",void 0),e([t()],i.prototype,"cullAboveGround",void 0),r.Configuration=i}(E||(E={}));export{E as EdgeShaderTechnique};
5
+ import{_ as e}from"../../../../../chunks/tslib.es6.js";import{bindViewProjTransform as r}from"../../core/shaderLibrary/attributes/VertexPosition.glsl.js";import{ReloadableShaderModule as i}from"../../core/shaderTechnique/ReloadableShaderModule.js";import{ShaderTechnique as o}from"../../core/shaderTechnique/ShaderTechnique.js";import{parameter as t,ShaderTechniqueConfiguration as s}from"../../core/shaderTechnique/ShaderTechniqueConfiguration.js";import{Program as a}from"../Program.js";import{EdgeShaderAttributeLocations as l}from"./bufferLayouts.js";import{E as n}from"../../../../../chunks/EdgeShaderProgram.glsl.js";import{EdgeUtilMode as d}from"../../shaders/sources/edgeRenderer/EdgeUtil.glsl.js";import{BlendOperation as c,BlendFactor as m,CompareFunction as u}from"../../../../webgl/enums.js";import{makePipelineState as p,separateBlendingParams as f,defaultColorWriteParams as h,defaultDepthWriteParams as b}from"../../../../webgl/renderState.js";const g=-4e-4,P=.5;class E extends o{bindPass(e){const i=this.program,{edgeRenderParameters:o,bindParameters:t}=e;r(i,o.viewProjectionTransform),i.setUniformMatrix3fv("transformNormalViewFromGlobal",o.transformNormalViewFromGlobal),i.setUniformMatrix4fv("proj",t.camera.projectionMatrix),i.setUniform2f("depthBias",P,g),i.setUniform2f("pixelToNDC",2/t.camera.fullViewport[2],2/t.camera.fullViewport[3]),i.setUniform2f("ndcToPixel",t.camera.fullViewport[2]/2,t.camera.fullViewport[3]/2),i.setUniform1f("distanceFalloffFactor",o.distanceFalloffFactor),i.setUniform2f("inverseViewport",1/t.camera.fullViewport[2],1/t.camera.fullViewport[3]),i.setUniform1f("pixelRatio",t.camera.pixelRatio||1)}initializeProgram(e){const r=E.shader.get(),i=this.configuration,o=r.build({slicePlaneEnabled:i.slicePlaneEnabled,sliceHighlightDisabled:!1,sliceEnabledForVertexPrograms:!1,silhouette:i.silhouette,legacy:i.legacy,antialiasing:i.antialiasing,mode:i.mode,doublePrecisionRequiresObfuscation:i.doublePrecisionRequiresObfuscation,multipassTerrainEnabled:i.multipassTerrainEnabled,cullAboveGround:i.cullAboveGround});return new a(e.rctx,o,l)}initializePipeline(e){const r=e.rctx.capabilities.blendMinMax;return p(r?{blending:f(m.ONE,m.ONE,m.ZERO,m.ONE,c.ADD,r.MAX),depthTest:{func:u.LEQUAL},colorWrite:h}:{depthTest:{func:u.LEQUAL},depthWrite:b,colorWrite:h})}}E.shader=new i(n,(()=>import("../../shaders/sources/edgeRenderer/EdgeShaderProgram.glsl.js")));class v extends s{constructor(){super(...arguments),this.slicePlaneEnabled=!1,this.silhouette=!1,this.legacy=!1,this.antialiasing=!1,this.mode=d.SOLID,this.doublePrecisionRequiresObfuscation=!1,this.multipassTerrainEnabled=!1,this.cullAboveGround=!1}}e([t()],v.prototype,"slicePlaneEnabled",void 0),e([t()],v.prototype,"silhouette",void 0),e([t()],v.prototype,"legacy",void 0),e([t()],v.prototype,"antialiasing",void 0),e([t({count:d.COUNT})],v.prototype,"mode",void 0),e([t()],v.prototype,"doublePrecisionRequiresObfuscation",void 0),e([t()],v.prototype,"multipassTerrainEnabled",void 0),e([t()],v.prototype,"cullAboveGround",void 0);export{E as EdgeShaderTechnique,v as EdgeShaderTechniqueConfiguration};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../../chunks/tslib.es6.js";import t from"../../../../../core/Accessor.js";import{equals as r}from"../../../../../core/arrayUtils.js";import s from"../../../../../core/Logger.js";import{clamp as o}from"../../../../../core/mathUtils.js";import{disposeMaybe as i,destroyMaybe as n,isNone as a,isSome as c}from"../../../../../core/maybe.js";import{property as d}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/accessorSupport/ensureType.js";import{subclass as l}from"../../../../../core/accessorSupport/decorators/subclass.js";import{f as g,t as m,e as u}from"../../../../../chunks/mat3.js";import{c as h}from"../../../../../chunks/mat3f64.js";import{c as p}from"../../../../../chunks/mat4.js";import{c as f}from"../../../../../chunks/mat4f64.js";import{s as b,g as y,v as j,d as O}from"../../../../../chunks/vec3.js";import{c as v}from"../../../../../chunks/vec3f64.js";import{g as w,l as E}from"../../../../../chunks/sphere.js";import{c as R}from"../../../../../chunks/vec33.js";import{VertexPosition as x}from"../../core/shaderLibrary/attributes/VertexPosition.glsl.js";import{TwoVectorPosition as _}from"../../core/util/TwoVectorPosition.js";import{VertexAttribute as T}from"../basicInterfaces.js";import{GridLocalOriginFactory as M}from"../GridLocalOriginFactory.js";import{applyToModelMatrix as C}from"../localOriginHelper.js";import{LocalOriginManager as P}from"../LocalOriginManager.js";import{Object3D as D}from"../Object3D.js";import{VertexLayout as A,EdgeShaderAttributeLocations as S,glVertexLayout as k,EdgeInputBufferLayout as I}from"./bufferLayouts.js";import{RegularEdgeBufferWriter as B,SilhouetteEdgeBufferWriter as L}from"./edgeBufferWriters.js";import{EdgeType as U}from"./edgePreprocessing.js";import{EdgeRenderer as V,LINE_WIDTH_FRACTION_FACTOR as N,EXTENSION_LENGTH_OFFSET as H}from"./EdgeRenderer.js";import z from"./EdgeWorkerHandle.js";import{Transparency as F}from"./interfaces.js";import{generateStrokesTexture as K}from"./strokes.js";import{determineRendererType as W,determineEdgeTransparency as G,determineObjectTransparency as q,fillComponenBufferIndices as Q,computeEdgeCount as J}from"./util.js";import{BufferManager as X}from"../TextureBackedBuffer/BufferManager.js";import{WatchUpdatingTracking as Y}from"../../../../support/WatchUpdatingTracking.js";import{BufferObject as Z}from"../../../../webgl/BufferObject.js";import{Usage as $}from"../../../../webgl/enums.js";import{VertexArrayObject as ee}from"../../../../webgl/VertexArrayObject.js";const te=s.getLogger("esri.views.3d.webgl-engine.lib.edgeRendering.EdgeView");let re=class extends t{constructor(e){super(e),this.updatingHandles=new Y,this.perObjectData=new Map,this.perObjectDataEvictionCache=new Set,this.renderers=new Map,this.numberOfRenderedEdges={[F.TRANSPARENT]:0,[F.OPAQUE]:0},this.gpuMemoryUsage=0,this.workerAbort=new AbortController,this.tmpModelPosition=v(),this.localOrigins=new P(new M(e.renderSR))}initialize(){this.worker=new z(this.schedule),this.componentColorManager=new X(this.rctx,2);const e=A.createBuffer(4);for(let t=0;t<4;t++)e.sideness.set(t,0,0===t||3===t?0:1),e.sideness.set(t,1,0===t||1===t?0:1);this.verticesBufferObject=Z.createVertex(this.rctx,$.STATIC_DRAW,e.buffer)}destroy(){this.destroyed||(this.perObjectData.forEach((e=>this._discardObjectEntry(e))),this.perObjectData.clear(),this.strokesTexture=i(this.strokesTexture),this.componentColorManager=n(this.componentColorManager),this.workerAbort.abort(),this.worker.destroy(),this.verticesBufferObject=i(this.verticesBufferObject),this.renderers.clear(),this.updatingHandles.destroy())}get updating(){return this.updatingHandles.updating}get usedMemory(){return this.gpuMemoryUsage}get numberOfRenderedPrimitives(){return this.numberOfRenderedEdges[F.TRANSPARENT]+this.numberOfRenderedEdges[F.OPAQUE]}shouldRender(){return this.renderers.size>0}async addComponentObject(e,t,r,s,o,i,n,a){if(this.hasObject(e))return this.getObjectMemoryUsage(e);let c;const d=new ie(new Promise((e=>c=e)),r.center,r.radius);this.perObjectData.set(e,d);const l=await this.updatingHandles.addPromise(this._addComponentGeometry(t,d,s,o,i,n,a));return this.setNeedsRender(),c(),l}async addOrUpdateObject3D(e,t,r,s){if(this.destroyed)return void te.warn("Attempt to add an object to a destroyed instance");const o=this.perObjectData.get(e);let i;(null==o?void 0:o.renderables.length)>0&&this.perObjectDataEvictionCache.add(o);const n=e.boundingVolumeWorldSpace.bounds,a=new ie(new Promise((e=>i=e)),w(n),E(n));this.perObjectData.set(e,a);const c=new Array;if(r.mergeGeometries&&e.geometries.length>1&&oe(e))c.push(this._addObjectMergedGeometries(e,a,t,r,s));else for(let d=0;d<e.geometries.length;d++){const o=e.geometryRecords[d];if(!o.material.supportsEdges)continue;const i=e.geometries[d];c.push(this._addGeometry(e,a,i,o,t[0],r,s))}await this.updatingHandles.addPromise(Promise.all(c)),this.perObjectDataEvictionCache.delete(a),this._discardObjectEntry(o),this.setNeedsRender(),i()}_discardObjectEntry(e){e&&(e.renderables.length&&(e.renderables.forEach((e=>this._removeRenderable(e))),this.setNeedsRender()),e.loaded=null)}hasObject(e){return this.perObjectData.has(e)}async updateAllComponentOpacities(e,t){const r=t instanceof Array?e=>t[e]:()=>t;(await this.updatingHandles.addPromise(this._getObjectEntry(e))).renderables.forEach((e=>{const t=e.components.meta.length;for(let s=0;s<t;s++){const t=r(s),o=e.components.meta[s],i=o.index;o.material.opacity=t,e.components.buffer.textureBuffer.setDataElement(i,1,3,255*t)}this._updateTransparency(e)})),this.setNeedsRender()}async getObjectMemoryUsage(e){return(await this._getObjectEntry(e)).renderables.reduce(((e,t)=>e+t.statistics.gpuMemoryUsage),0)}async updateAllComponentMaterials(e,t,r,s){const o=e instanceof D,i=!!r.slicePlaneEnabled,n=W(t),a=V.getKey(n,i,o);(await this.updatingHandles.addPromise(this._getObjectEntry(e))).renderables.forEach((e=>{if(a!==e.rendererKey){const t=this.renderers.get(e.rendererKey),r=this._acquireRenderer(n,i,o);t.removeRenderable(e),t.refCount.decrement(),e.rendererKey=a,r.addRenderable(e)}for(let r=0;r<t.length;r++)e.components.meta[r].material=t[r];s&&this._updateComponentBuffer(e.components),this._updateTransparency(e)})),this.setNeedsRender()}async updateObjectVisibility(e,t){(await this.updatingHandles.addPromise(this._getObjectEntry(e))).renderables.forEach((e=>e.visible=t)),this.setNeedsRender()}removeObject(e){const t=this.perObjectData.get(e);t&&(this.perObjectData.delete(e),this._discardObjectEntry(t))}async _getObjectEntry(e){const t=this.perObjectData.get(e);if(!t)throw"no object";return await t.loaded,t}removeAll(){this.perObjectData.forEach(((e,t)=>this.removeObject(t)))}render(e,t){if(this.numberOfRenderedEdges[t]=0,a(this.componentColorManager))return;this.localOrigins.updateViewMatrices(e.camera.viewMatrix);const r=e.camera.viewInverseTransposeMatrix,s=v(),o=new _,i=new x.ViewProjectionTransform,n=h();b(s,r[3],r[7],r[11]),o.set(s),y(i.worldFromView_TH,o.high),y(i.worldFromView_TL,o.low),g(i.viewFromCameraRelative_RS,e.camera.viewMatrix),p(i.projFromView,e.camera.projectionMatrix);const c=h();m(c,i.viewFromCameraRelative_RS),u(n,c);let d=0,l=0;if(this.renderers.forEach((e=>{0===e.refCount.value?(this.renderers.delete(e.key),e.dispose()):e.forEachRenderable((e=>{e.visible&&(d+=e.statistics.averageEdgeLength,l++)}),t)})),this.componentColorManager.garbageCollect(),this.componentColorManager.updateTextures(),0===l)return;const f={distanceFalloffFactor:40*d/l,minimumEdgeLength:e.camera.perScreenPixelRatio,transparency:t,viewProjectionTransform:i,transformNormal_ViewFromGlobal:n};this._updateObjectCameraDistances(e),this.renderers.forEach((t=>{this._renderRegularEdges(t,e,f),this._renderSilhouetteEdges(t,e,f)}))}_updateTransparency(e){const t=G(e.components.meta),r=q(e.components.meta);t===e.edgeTransparency&&r===e.objectTransparency||(e.edgeTransparency=t,e.objectTransparency=r,this.renderers.get(e.rendererKey).setRenderablesDirty())}_computeModelTransformWithLocalOrigin(e,t,r){if(e.getCombinedStaticTransformation(t,r),c(t.origin))this.localOrigins.register(t.origin);else{const e=b(this.tmpModelPosition,r[12],r[13],r[14]);t.origin=this.localOrigins.acquire(e)}return C(t.origin.vec3,r),t.origin}_updateComponentBuffer(e){const{meta:t,buffer:r}=e;for(let s=0;s<t.length;s++){const e=t[s].material,i=t[s].index,n=o(Math.round(e.size*N),0,255),a=o(e.extensionLength,-H,255-H)+H,c="solid"===e.type?U.SOLID:U.SKETCH,d=255*e.opacity,l=e.color,g=255*l[0],m=255*l[1],u=255*l[2],h=255*l[3];r.textureBuffer.setData(i,0,g,m,u,h),r.textureBuffer.setData(i,1,n,a,c,d)}}_createComponentBuffers(e){if(a(this.componentColorManager))return null;const t=new Array,r=this.componentColorManager.getBuffer(e.length);for(let o=0;o<e.length;o++){const s=e[o],i=r.acquireIndex();t.push({index:i,material:s})}const s={meta:t,buffer:r};return this._updateComponentBuffer(s),s}_extractEdges(e,t,r,s,o,i=o.length){return this.worker.process({data:t,indices:o,indicesLength:i,writerSettings:e,skipDeduplicate:r},this.workerAbort.signal,s)}_createEdgeResources(e){const t={};if(a(this.verticesBufferObject))return t;if(e.regular.lodInfo.lengths.length>0){const r=new ee(this.rctx,S,{vertices:k,instances:B.glLayout},{vertices:this.verticesBufferObject,instances:Z.createVertex(this.rctx,$.STATIC_DRAW,e.regular.instancesData.buffer)});t.regular={vao:r,lod:e.regular.lodInfo}}if(e.silhouette.lodInfo.lengths.length>0){const r=new ee(this.rctx,S,{vertices:k,instances:L.glLayout},{vertices:this.verticesBufferObject,instances:Z.createVertex(this.rctx,$.STATIC_DRAW,e.silhouette.instancesData.buffer)});t.silhouette={vao:r,lod:e.silhouette.lodInfo}}return t}async _addGeometry(e,t,r,s,o,i,n){const a=r.vertexAttributes.get(T.POSITION),c=r.indices.get(T.POSITION),d=f(),l={position:a,indices:c,modelTransform:d,origin:this._computeModelTransformWithLocalOrigin(e,s,d)};return this._addPositionData(t,l,r.edgeIndicesLength,o,i,n)}async _addPositionData(e,t,r,s,o,i=!1){if(null==e.loaded)return;const n=this._createComponentBuffers([s]);if(a(n)||r<=0)return;const c=this._acquireRenderer(s.type,!!o.slicePlaneEnabled),{modelTransform:d,origin:l}=t,g=t.indices,m=t.position,u=m.data.length/m.size,h=I.createBuffer(u);for(let a=0;a<u;a++)h.position.set(a,0,m.data[a*m.size+0]),h.position.set(a,1,m.data[a*m.size+1]),h.position.set(a,2,m.data[a*m.size+2]);Q(n.meta,[0,h.componentIndex.count],h.componentIndex);const p=await this.updatingHandles.addPromise(this._extractEdges(c.writerSettings,h,!1,i,g,r));if(null==e.loaded)return;const{regular:f,silhouette:b}=this._createEdgeResources(p),y=(f?f.vao.size:0)+(b?b.vao.size:0),j={regular:f,silhouette:b,transform:{modelMatrix:d,origin:l},statistics:{gpuMemoryUsage:y,externalMemoryUsage:!1,averageEdgeLength:p.averageEdgeLength},components:n,visible:!0,edgeTransparency:G(n.meta),objectTransparency:q(n.meta),distanceToCamera:0,rendererKey:c.key};e.renderables.push(j),c.addRenderable(j),this.gpuMemoryUsage+=y}async _addComponentGeometry(e,t,r,s,o,i,n){if(null==t.loaded)return 0;const c=this._createComponentBuffers(i);if(a(c))return 0;const d=W(i),l=this._acquireRenderer(d,n.slicePlaneEnabled||!1,!1),g=I.createBuffer(r.count);R(g.position,r),Q(c.meta,o,g.componentIndex,s);const m=!0,u=l.writerSettings,h=await this.updatingHandles.addPromise(this._extractEdges(u,g,m,!1,s));if(null==t.loaded)return 0;const{regular:p,silhouette:f}=this._createEdgeResources(h),b=(p?p.vao.size:0)+(f?f.vao.size:0),y={regular:p,silhouette:f,transform:e,statistics:{gpuMemoryUsage:b,externalMemoryUsage:!0,averageEdgeLength:h.averageEdgeLength},components:c,visible:!0,edgeTransparency:G(c.meta),objectTransparency:q(c.meta),distanceToCamera:0,rendererKey:l.key};return t.renderables.push(y),l.addRenderable(y),b}async _addObjectMergedGeometries(e,t,r,s,o){const i=new Map;let n=0,a=null,c=0;for(let f=0;f<e.geometries.length;f++){const t=e.geometries[f],r=e.geometryRecords[f];if(!r.material.supportsEdges)continue;!a&&r.origin&&(a=r);const s=t.vertexAttributes.get(T.POSITION);c+=s.data.length/s.size,n+=t.edgeIndicesLength}const d=c>=65536?Uint32Array:Uint16Array,l=n?new d(n):null,g=[];let m=0;for(let f=0;f<e.geometries.length;f++){const t=e.geometries[f];if(!e.geometryRecords[f].material.supportsEdges)continue;const r=t.vertexAttributes.get(T.POSITION),s=t.indices.get(T.POSITION);let o=i.get(r.data);if(null==o){o=g.length/3;for(let e=0;e<r.data.length;e+=r.size)g.push(r.data[e+0]),g.push(r.data[e+1]),g.push(r.data[e+2]);i.set(r.data,o)}if(s)for(let e=0;e<t.edgeIndicesLength;e++)l[m++]=o+s[e]}const u=a||e.geometryRecords[0],h=f(),p=this._computeModelTransformWithLocalOrigin(e,u,h);for(let f=0;f<e.geometryRecords.length;f++)e.geometryRecords[f].origin=p;const b={position:{data:g,size:3},indices:l,modelTransform:h,origin:p};await this.updatingHandles.addPromise(this._addPositionData(t,b,l.length,r[0],s,o))}_acquireRenderer(e,t,r=!0){const s=V.getKey(e,t,r);let o=this.renderers.get(s);return a(this.strokesTexture)&&(this.strokesTexture=K(this.rctx)),o||(o=new V(this.rctx,this.techniqueRepository,{type:e,slicePlaneEnabled:t,strokesTexture:this.strokesTexture,legacy:r}),this.renderers.set(s,o)),o.refCount.increment(),o}_removeRenderable(e){se(e);const t=this.renderers.get(e.rendererKey);if(t){t.removeRenderable(e),t.refCount.decrement(),"origin"in e.transform&&this.localOrigins.release(e.transform.origin),this.gpuMemoryUsage-=e.statistics.externalMemoryUsage?0:e.statistics.gpuMemoryUsage;for(const t of e.components.meta)e.components.buffer.releaseIndex(t.index)}}_updateObjectCameraDistances(e){const t=e.camera.eye,r=e.camera.viewForward,s=v(),o=e=>{const{center:o,radius:i}=e;j(s,o,t);const n=O(s,r),a=n<-i?1/0:n<i?0:n-i;e.renderables.forEach((e=>e.distanceToCamera=a))};this.perObjectData.forEach(o),this.perObjectDataEvictionCache.forEach(o)}_renderRegularEdges(e,t,r){e.bindRegularEdges(t,r);const s=r.transparency;e.forEachRenderable((o=>{if(!o.visible||!o.regular)return;const i=J(o.regular.lod.lengths,o.distanceToCamera,r);"origin"in o.transform&&(t.localViewMatrixForEdges=this.localOrigins.getViewMatrix(o.transform.origin)),e.renderRegularEdges(o,t,i),this.numberOfRenderedEdges[s]+=i}),s)}_renderSilhouetteEdges(e,t,r){e.bindSilhouetteEdges(t,r);const s=r.transparency;e.forEachRenderable((o=>{if(!o.visible||!o.silhouette)return;const i=J(o.silhouette.lod.lengths,o.distanceToCamera,r);"origin"in o.transform&&(t.localViewMatrixForEdges=this.localOrigins.getViewMatrix(o.transform.origin)),e.renderSilhouetteEdges(o,t,i),this.numberOfRenderedEdges[s]+=i}),s)}};function se(e){e.regular&&(e.regular.vao.vertexBuffers.instances.dispose(),e.regular.vao.dispose(!1),e.regular.vao=null),e.silhouette&&(e.silhouette.vao.vertexBuffers.instances.dispose(),e.silhouette.vao.dispose(!1),e.silhouette.vao=null)}function oe(e){let t=null,s=null;for(let i=0;i<e.geometries.length;i++){var o;const n=e.geometryRecords[i];if(n.material.supportsEdges){if(t){if(!r(t,n.transformation))return!1}else t=n.transformation;if(!s&&c(n.origin))s=n;else if(c(null==(o=s)?void 0:o.origin)&&c(n.origin)&&s.origin.id!==n.origin.id)return!1}}return!0}e([d({constructOnly:!0})],re.prototype,"rctx",void 0),e([d({constructOnly:!0})],re.prototype,"renderSR",void 0),e([d({constructOnly:!0})],re.prototype,"techniqueRepository",void 0),e([d({constructOnly:!0})],re.prototype,"setNeedsRender",void 0),e([d({constructOnly:!0})],re.prototype,"schedule",void 0),e([d({readOnly:!0})],re.prototype,"updatingHandles",void 0),e([d({readOnly:!0})],re.prototype,"updating",null),re=e([l("esri.views.3d.webgl-engine.lib.edgeRendering.EdgeView")],re);class ie{constructor(e,t,r){this.center=t,this.radius=r,this.renderables=new Array,this.loaded=e,this.loaded.then((()=>{null!=this.loaded&&(this.loaded=!0)}))}}export{re as EdgeView};
5
+ import{_ as e}from"../../../../../chunks/tslib.es6.js";import t from"../../../../../core/Accessor.js";import{equals as r}from"../../../../../core/arrayUtils.js";import s from"../../../../../core/Logger.js";import{clamp as o}from"../../../../../core/mathUtils.js";import{disposeMaybe as n,destroyMaybe as i,isNone as a,isSome as c}from"../../../../../core/maybe.js";import{property as d}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/accessorSupport/ensureType.js";import{subclass as l}from"../../../../../core/accessorSupport/decorators/subclass.js";import{f as g,t as m,e as u}from"../../../../../chunks/mat3.js";import{c as h}from"../../../../../chunks/mat3f64.js";import{c as p}from"../../../../../chunks/mat4.js";import{c as f}from"../../../../../chunks/mat4f64.js";import{s as b,g as y,v as j,d as O}from"../../../../../chunks/vec3.js";import{c as v}from"../../../../../chunks/vec3f64.js";import{g as E,l as w}from"../../../../../chunks/sphere.js";import{c as R}from"../../../../../chunks/vec33.js";import{VertexPositionViewProjectionTransform as x}from"../../core/shaderLibrary/attributes/VertexPosition.glsl.js";import{TwoVectorPosition as T}from"../../core/util/TwoVectorPosition.js";import{GridLocalOriginFactory as _}from"../GridLocalOriginFactory.js";import{applyToModelMatrix as M}from"../localOriginHelper.js";import{LocalOriginManager as C}from"../LocalOriginManager.js";import{Object3D as P}from"../Object3D.js";import{VertexAttribute as D}from"../VertexAttribute.js";import{VertexLayout as A,EdgeShaderAttributeLocations as S,glVertexLayout as k,EdgeInputBufferLayout as I}from"./bufferLayouts.js";import{RegularEdgeBufferWriter as B,SilhouetteEdgeBufferWriter as L}from"./edgeBufferWriters.js";import{EdgeType as V}from"./edgePreprocessing.js";import{EdgeRenderer as U,LINE_WIDTH_FRACTION_FACTOR as N,EXTENSION_LENGTH_OFFSET as H}from"./EdgeRenderer.js";import z from"./EdgeWorkerHandle.js";import{Transparency as F}from"./interfaces.js";import{generateStrokesTexture as W}from"./strokes.js";import{determineRendererType as K,determineEdgeTransparency as G,determineObjectTransparency as q,fillComponenBufferIndices as Q,computeEdgeCount as J}from"./util.js";import{BufferManager as X}from"../TextureBackedBuffer/BufferManager.js";import{WatchUpdatingTracking as Y}from"../../../../support/WatchUpdatingTracking.js";import{BufferObject as Z}from"../../../../webgl/BufferObject.js";import{Usage as $}from"../../../../webgl/enums.js";import{VertexArrayObject as ee}from"../../../../webgl/VertexArrayObject.js";const te=s.getLogger("esri.views.3d.webgl-engine.lib.edgeRendering.EdgeView");let re=class extends t{constructor(e){super(e),this.updatingHandles=new Y,this.perObjectData=new Map,this.perObjectDataEvictionCache=new Set,this.renderers=new Map,this.numberOfRenderedEdges={[F.TRANSPARENT]:0,[F.OPAQUE]:0},this.gpuMemoryUsage=0,this.workerAbort=new AbortController,this.tmpModelPosition=v(),this.localOrigins=new C(new _(e.renderSR))}initialize(){this.worker=new z(this.schedule),this.componentColorManager=new X(this.rctx,2);const e=A.createBuffer(4);for(let t=0;t<4;t++)e.sideness.set(t,0,0===t||3===t?0:1),e.sideness.set(t,1,0===t||1===t?0:1);this.verticesBufferObject=Z.createVertex(this.rctx,$.STATIC_DRAW,e.buffer)}destroy(){this.destroyed||(this.perObjectData.forEach((e=>this._discardObjectEntry(e))),this.perObjectData.clear(),this.strokesTexture=n(this.strokesTexture),this.componentColorManager=i(this.componentColorManager),this.workerAbort.abort(),this.worker.destroy(),this.verticesBufferObject=n(this.verticesBufferObject),this.renderers.clear(),this.updatingHandles.destroy())}get updating(){return this.updatingHandles.updating}get usedMemory(){return this.gpuMemoryUsage}get numberOfRenderedPrimitives(){return this.numberOfRenderedEdges[F.TRANSPARENT]+this.numberOfRenderedEdges[F.OPAQUE]}shouldRender(){return this.renderers.size>0}async addComponentObject(e,t,r,s,o,n,i,a){if(this.hasObject(e))return this.getObjectMemoryUsage(e);let c;const d=new ne(new Promise((e=>c=e)),r.center,r.radius);this.perObjectData.set(e,d);const l=await this.updatingHandles.addPromise(this._addComponentGeometry(t,d,s,o,n,i,a));return this.setNeedsRender(),c(),l}async addOrUpdateObject3D(e,t,r,s){if(this.destroyed)return void te.warn("Attempt to add an object to a destroyed instance");const o=this.perObjectData.get(e);let n;(null==o?void 0:o.renderables.length)>0&&this.perObjectDataEvictionCache.add(o);const i=e.boundingVolumeWorldSpace.bounds,a=new ne(new Promise((e=>n=e)),E(i),w(i));this.perObjectData.set(e,a);const c=new Array;if(r.mergeGeometries&&e.geometries.length>1&&oe(e))c.push(this._addObjectMergedGeometries(e,a,t,r,s));else for(let d=0;d<e.geometries.length;d++){const o=e.geometryRecords[d];if(!o.material.supportsEdges)continue;const n=e.geometries[d];c.push(this._addGeometry(e,a,n,o,t[0],r,s))}await this.updatingHandles.addPromise(Promise.all(c)),this.perObjectDataEvictionCache.delete(a),this._discardObjectEntry(o),this.setNeedsRender(),n()}_discardObjectEntry(e){e&&(e.renderables.length&&(e.renderables.forEach((e=>this._removeRenderable(e))),this.setNeedsRender()),e.loaded=null)}hasObject(e){return this.perObjectData.has(e)}async updateAllComponentOpacities(e,t){const r=t instanceof Array?e=>t[e]:()=>t;(await this.updatingHandles.addPromise(this._getObjectEntry(e))).renderables.forEach((e=>{const t=e.components.meta.length;for(let s=0;s<t;s++){const t=r(s),o=e.components.meta[s],n=o.index;o.material.opacity=t,e.components.buffer.textureBuffer.setDataElement(n,1,3,255*t)}this._updateTransparency(e)})),this.setNeedsRender()}async getObjectMemoryUsage(e){return(await this._getObjectEntry(e)).renderables.reduce(((e,t)=>e+t.statistics.gpuMemoryUsage),0)}async updateAllComponentMaterials(e,t,r,s){const o=e instanceof P,n=!!r.slicePlaneEnabled,i=K(t),a=U.getKey(i,n,o);(await this.updatingHandles.addPromise(this._getObjectEntry(e))).renderables.forEach((e=>{if(a!==e.rendererKey){const t=this.renderers.get(e.rendererKey),r=this._acquireRenderer(i,n,o);t.removeRenderable(e),t.refCount.decrement(),e.rendererKey=a,r.addRenderable(e)}for(let r=0;r<t.length;r++)e.components.meta[r].material=t[r];s&&this._updateComponentBuffer(e.components),this._updateTransparency(e)})),this.setNeedsRender()}async updateObjectVisibility(e,t){(await this.updatingHandles.addPromise(this._getObjectEntry(e))).renderables.forEach((e=>e.visible=t)),this.setNeedsRender()}removeObject(e){const t=this.perObjectData.get(e);t&&(this.perObjectData.delete(e),this._discardObjectEntry(t))}async _getObjectEntry(e){const t=this.perObjectData.get(e);if(!t)throw"no object";return await t.loaded,t}removeAll(){this.perObjectData.forEach(((e,t)=>this.removeObject(t)))}render(e,t){if(this.numberOfRenderedEdges[t]=0,a(this.componentColorManager))return;this.localOrigins.updateViewMatrices(e.camera.viewMatrix);const r=e.camera.viewInverseTransposeMatrix,s=v(),o=new T,n=new x,i=h();b(s,r[3],r[7],r[11]),o.set(s),y(n.transformWorldFromViewTH,o.high),y(n.transformWorldFromViewTL,o.low),g(n.transformViewFromCameraRelativeRS,e.camera.viewMatrix),p(n.transformProjFromView,e.camera.projectionMatrix);const c=h();m(c,n.transformViewFromCameraRelativeRS),u(i,c);let d=0,l=0;if(this.renderers.forEach((e=>{0===e.refCount.value?(this.renderers.delete(e.key),e.dispose()):e.forEachRenderable((e=>{e.visible&&(d+=e.statistics.averageEdgeLength,l++)}),t)})),this.componentColorManager.garbageCollect(),this.componentColorManager.updateTextures(),0===l)return;const f={distanceFalloffFactor:40*d/l,minimumEdgeLength:e.camera.perScreenPixelRatio,transparency:t,viewProjectionTransform:n,transformNormalViewFromGlobal:i};this._updateObjectCameraDistances(e),this.renderers.forEach((t=>{this._renderRegularEdges(t,e,f),this._renderSilhouetteEdges(t,e,f)}))}_updateTransparency(e){const t=G(e.components.meta),r=q(e.components.meta);t===e.edgeTransparency&&r===e.objectTransparency||(e.edgeTransparency=t,e.objectTransparency=r,this.renderers.get(e.rendererKey).setRenderablesDirty())}_computeModelTransformWithLocalOrigin(e,t,r){if(e.getCombinedStaticTransformation(t,r),c(t.origin))this.localOrigins.register(t.origin);else{const e=b(this.tmpModelPosition,r[12],r[13],r[14]);t.origin=this.localOrigins.acquire(e)}return M(t.origin.vec3,r),t.origin}_updateComponentBuffer(e){const{meta:t,buffer:r}=e;for(let s=0;s<t.length;s++){const e=t[s].material,n=t[s].index,i=o(Math.round(e.size*N),0,255),a=o(e.extensionLength,-H,255-H)+H,c="solid"===e.type?V.SOLID:V.SKETCH,d=255*e.opacity,l=e.color,g=255*l[0],m=255*l[1],u=255*l[2],h=255*l[3];r.textureBuffer.setData(n,0,g,m,u,h),r.textureBuffer.setData(n,1,i,a,c,d)}}_createComponentBuffers(e){if(a(this.componentColorManager))return null;const t=new Array,r=this.componentColorManager.getBuffer(e.length);for(let o=0;o<e.length;o++){const s=e[o],n=r.acquireIndex();t.push({index:n,material:s})}const s={meta:t,buffer:r};return this._updateComponentBuffer(s),s}_extractEdges(e,t,r,s,o,n=o.length){return this.worker.process({data:t,indices:o,indicesLength:n,writerSettings:e,skipDeduplicate:r},this.workerAbort.signal,s)}_createEdgeResources(e){const t={};if(a(this.verticesBufferObject))return t;if(e.regular.lodInfo.lengths.length>0){const r=new ee(this.rctx,S,{vertices:k,instances:B.glLayout},{vertices:this.verticesBufferObject,instances:Z.createVertex(this.rctx,$.STATIC_DRAW,e.regular.instancesData.buffer)});t.regular={vao:r,lod:e.regular.lodInfo}}if(e.silhouette.lodInfo.lengths.length>0){const r=new ee(this.rctx,S,{vertices:k,instances:L.glLayout},{vertices:this.verticesBufferObject,instances:Z.createVertex(this.rctx,$.STATIC_DRAW,e.silhouette.instancesData.buffer)});t.silhouette={vao:r,lod:e.silhouette.lodInfo}}return t}async _addGeometry(e,t,r,s,o,n,i){const a=r.vertexAttributes.get(D.POSITION),c=r.indices.get(D.POSITION),d=f(),l={position:a,indices:c,modelTransform:d,origin:this._computeModelTransformWithLocalOrigin(e,s,d)};return this._addPositionData(t,l,r.edgeIndicesLength,o,n,i)}async _addPositionData(e,t,r,s,o,n=!1){if(null==e.loaded)return;const i=this._createComponentBuffers([s]);if(a(i)||r<=0)return;const c=this._acquireRenderer(s.type,!!o.slicePlaneEnabled),{modelTransform:d,origin:l}=t,g=t.indices,m=t.position,u=m.data.length/m.size,h=I.createBuffer(u);for(let a=0;a<u;a++)h.position.set(a,0,m.data[a*m.size+0]),h.position.set(a,1,m.data[a*m.size+1]),h.position.set(a,2,m.data[a*m.size+2]);Q(i.meta,[0,h.componentIndex.count],h.componentIndex);const p=await this.updatingHandles.addPromise(this._extractEdges(c.writerSettings,h,!1,n,g,r));if(null==e.loaded)return;const{regular:f,silhouette:b}=this._createEdgeResources(p),y=(f?f.vao.size:0)+(b?b.vao.size:0),j={regular:f,silhouette:b,transform:{modelMatrix:d,origin:l},statistics:{gpuMemoryUsage:y,externalMemoryUsage:!1,averageEdgeLength:p.averageEdgeLength},components:i,visible:!0,edgeTransparency:G(i.meta),objectTransparency:q(i.meta),distanceToCamera:0,rendererKey:c.key};e.renderables.push(j),c.addRenderable(j),this.gpuMemoryUsage+=y}async _addComponentGeometry(e,t,r,s,o,n,i){if(null==t.loaded)return 0;const c=this._createComponentBuffers(n);if(a(c))return 0;const d=K(n),l=this._acquireRenderer(d,i.slicePlaneEnabled||!1,!1),g=I.createBuffer(r.count);R(g.position,r),Q(c.meta,o,g.componentIndex,s);const m=!0,u=l.writerSettings,h=await this.updatingHandles.addPromise(this._extractEdges(u,g,m,!1,s));if(null==t.loaded)return 0;const{regular:p,silhouette:f}=this._createEdgeResources(h),b=(p?p.vao.size:0)+(f?f.vao.size:0),y={regular:p,silhouette:f,transform:e,statistics:{gpuMemoryUsage:b,externalMemoryUsage:!0,averageEdgeLength:h.averageEdgeLength},components:c,visible:!0,edgeTransparency:G(c.meta),objectTransparency:q(c.meta),distanceToCamera:0,rendererKey:l.key};return t.renderables.push(y),l.addRenderable(y),b}async _addObjectMergedGeometries(e,t,r,s,o){const n=new Map;let i=0,a=null,c=0;for(let f=0;f<e.geometries.length;f++){const t=e.geometries[f],r=e.geometryRecords[f];if(!r.material.supportsEdges)continue;!a&&r.origin&&(a=r);const s=t.vertexAttributes.get(D.POSITION);c+=s.data.length/s.size,i+=t.edgeIndicesLength}const d=c>=65536?Uint32Array:Uint16Array,l=i?new d(i):null,g=[];let m=0;for(let f=0;f<e.geometries.length;f++){const t=e.geometries[f];if(!e.geometryRecords[f].material.supportsEdges)continue;const r=t.vertexAttributes.get(D.POSITION),s=t.indices.get(D.POSITION);let o=n.get(r.data);if(null==o){o=g.length/3;for(let e=0;e<r.data.length;e+=r.size)g.push(r.data[e+0]),g.push(r.data[e+1]),g.push(r.data[e+2]);n.set(r.data,o)}if(s)for(let e=0;e<t.edgeIndicesLength;e++)l[m++]=o+s[e]}const u=a||e.geometryRecords[0],h=f(),p=this._computeModelTransformWithLocalOrigin(e,u,h);for(let f=0;f<e.geometryRecords.length;f++)e.geometryRecords[f].origin=p;const b={position:{data:g,size:3},indices:l,modelTransform:h,origin:p};await this.updatingHandles.addPromise(this._addPositionData(t,b,l.length,r[0],s,o))}_acquireRenderer(e,t,r=!0){const s=U.getKey(e,t,r);let o=this.renderers.get(s);return a(this.strokesTexture)&&(this.strokesTexture=W(this.rctx)),o||(o=new U(this.rctx,this.techniqueRepository,{type:e,slicePlaneEnabled:t,strokesTexture:this.strokesTexture,legacy:r}),this.renderers.set(s,o)),o.refCount.increment(),o}_removeRenderable(e){se(e);const t=this.renderers.get(e.rendererKey);if(t){t.removeRenderable(e),t.refCount.decrement(),"origin"in e.transform&&this.localOrigins.release(e.transform.origin),this.gpuMemoryUsage-=e.statistics.externalMemoryUsage?0:e.statistics.gpuMemoryUsage;for(const t of e.components.meta)e.components.buffer.releaseIndex(t.index)}}_updateObjectCameraDistances(e){const t=e.camera.eye,r=e.camera.viewForward,s=v(),o=e=>{const{center:o,radius:n}=e;j(s,o,t);const i=O(s,r),a=i<-n?1/0:i<n?0:i-n;e.renderables.forEach((e=>e.distanceToCamera=a))};this.perObjectData.forEach(o),this.perObjectDataEvictionCache.forEach(o)}_renderRegularEdges(e,t,r){e.bindRegularEdges(t,r);const s=r.transparency;e.forEachRenderable((o=>{if(!o.visible||!o.regular)return;const n=J(o.regular.lod.lengths,o.distanceToCamera,r);"origin"in o.transform&&(t.localViewMatrixForEdges=this.localOrigins.getViewMatrix(o.transform.origin)),e.renderRegularEdges(o,t,n),this.numberOfRenderedEdges[s]+=n}),s)}_renderSilhouetteEdges(e,t,r){e.bindSilhouetteEdges(t,r);const s=r.transparency;e.forEachRenderable((o=>{if(!o.visible||!o.silhouette)return;const n=J(o.silhouette.lod.lengths,o.distanceToCamera,r);"origin"in o.transform&&(t.localViewMatrixForEdges=this.localOrigins.getViewMatrix(o.transform.origin)),e.renderSilhouetteEdges(o,t,n),this.numberOfRenderedEdges[s]+=n}),s)}};function se(e){e.regular&&(e.regular.vao.vertexBuffers.instances.dispose(),e.regular.vao.dispose(!1),e.regular.vao=null),e.silhouette&&(e.silhouette.vao.vertexBuffers.instances.dispose(),e.silhouette.vao.dispose(!1),e.silhouette.vao=null)}function oe(e){let t=null,s=null;for(let n=0;n<e.geometries.length;n++){var o;const i=e.geometryRecords[n];if(i.material.supportsEdges){if(t){if(!r(t,i.transformation))return!1}else t=i.transformation;if(!s&&c(i.origin))s=i;else if(c(null==(o=s)?void 0:o.origin)&&c(i.origin)&&s.origin.id!==i.origin.id)return!1}}return!0}e([d({constructOnly:!0})],re.prototype,"rctx",void 0),e([d({constructOnly:!0})],re.prototype,"renderSR",void 0),e([d({constructOnly:!0})],re.prototype,"techniqueRepository",void 0),e([d({constructOnly:!0})],re.prototype,"setNeedsRender",void 0),e([d({constructOnly:!0})],re.prototype,"schedule",void 0),e([d({readOnly:!0})],re.prototype,"updatingHandles",void 0),e([d({readOnly:!0})],re.prototype,"updating",null),re=e([l("esri.views.3d.webgl-engine.lib.edgeRendering.EdgeView")],re);class ne{constructor(e,t,r){this.center=t,this.radius=r,this.renderables=new Array,this.loaded=e,this.loaded.then((()=>{null!=this.loaded&&(this.loaded=!0)}))}}export{re as EdgeView};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import{glLayout as N}from"../../../support/buffer/glUtil.js";import{newLayout as I}from"../../../support/buffer/InterleavedLayout.js";import{VertexAttribute as O}from"../basicInterfaces.js";const A=I().vec3f(O.POSITION).u16(O.COMPONENTINDEX).u16(O.U16PADDING),e=I().vec2u8(O.SIDENESS),T=N(e),E=I().vec3f(O.POSITION0).vec3f(O.POSITION1).u16(O.COMPONENTINDEX).u8(O.VARIANTOFFSET,{glNormalized:!0}).u8(O.VARIANTSTROKE).u8(O.VARIANTEXTENSION,{glNormalized:!0}).u8(O.U8PADDING,{glPadding:!0}).u16(O.U16PADDING,{glPadding:!0}),S=E.clone().vec3f(O.NORMAL),o=E.clone().vec3f(O.NORMALA).vec3f(O.NORMALB),r=new Map([[O.POSITION0,0],[O.POSITION1,1],[O.COMPONENTINDEX,2],[O.VARIANTOFFSET,3],[O.VARIANTSTROKE,4],[O.VARIANTEXTENSION,5],[O.NORMAL,6],[O.NORMALA,6],[O.NORMALB,7],[O.SIDENESS,8]]);export{E as CommonInstancesLayout,A as EdgeInputBufferLayout,r as EdgeShaderAttributeLocations,S as RegularEdgeInstancesLayout,o as SilhouetteEdgeInstancesLayout,e as VertexLayout,T as glVertexLayout};
5
+ import{glLayout as N}from"../../../support/buffer/glUtil.js";import{newLayout as O}from"../../../support/buffer/InterleavedLayout.js";import{VertexAttribute as I}from"../VertexAttribute.js";const A=O().vec3f(I.POSITION).u16(I.COMPONENTINDEX).u16(I.U16PADDING),e=O().vec2u8(I.SIDENESS),T=N(e),E=O().vec3f(I.POSITION0).vec3f(I.POSITION1).u16(I.COMPONENTINDEX).u8(I.VARIANTOFFSET,{glNormalized:!0}).u8(I.VARIANTSTROKE).u8(I.VARIANTEXTENSION,{glNormalized:!0}).u8(I.U8PADDING,{glPadding:!0}).u16(I.U16PADDING,{glPadding:!0}),S=E.clone().vec3f(I.NORMAL),r=E.clone().vec3f(I.NORMALA).vec3f(I.NORMALB),o=new Map([[I.POSITION0,0],[I.POSITION1,1],[I.COMPONENTINDEX,2],[I.VARIANTOFFSET,3],[I.VARIANTSTROKE,4],[I.VARIANTEXTENSION,5],[I.NORMAL,6],[I.NORMALA,6],[I.NORMALB,7],[I.SIDENESS,8]]);export{E as CommonInstancesLayout,A as EdgeInputBufferLayout,o as EdgeShaderAttributeLocations,S as RegularEdgeInstancesLayout,r as SilhouetteEdgeInstancesLayout,e as VertexLayout,T as glVertexLayout};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import t from"../../../../../core/Evented.js";import{f as e,e as s,t as i}from"../../../../../chunks/mat3.js";import{c as a}from"../../../../../chunks/mat3f64.js";import{m as r}from"../../../../../chunks/mat4.js";import{c as o}from"../../../../../chunks/mat4f64.js";import{s as n}from"../../../../../chunks/vec3.js";import{c as h}from"../../../../../chunks/vec3f64.js";import{BufferViewMat4f64 as l,BufferViewVec3f64 as c,BufferViewMat3f as f,BufferViewVec2f as m,BufferViewVec4f64 as g,BufferViewVec4f as _,BufferViewUint8 as d}from"../../../../../geometry/support/buffer/BufferView.js";import{scaleFromMatrix as T}from"../../../support/mathUtils.js";import{newLayout as u}from"../../../support/buffer/InterleavedLayout.js";import{VertexAttribute as L}from"../basicInterfaces.js";import{assert as A}from"../Util.js";var E;function F(t){let e=u().mat4f64(L.LOCALTRANSFORM).mat4f64(L.GLOBALTRANSFORM).vec4f64(L.BOUNDINGSPHERE).vec3f64(L.MODELORIGIN).mat3f(L.MODEL).mat3f(L.MODELNORMAL).vec2f(L.MODELSCALEFACTORS);return t.indexOf("color")>=0&&(e=e.vec4f(L.COLOR)),t.indexOf("featureAttribute")>=0&&(e=e.vec4f(L.FEATUREATTRIBUTE)),e=e.u8(L.STATE).u8(L.LODLEVEL).alignTo(8),e}!function(t){t[t.ALLOCATED=1]="ALLOCATED",t[t.DEFAULT_ACTIVE=2]="DEFAULT_ACTIVE",t[t.VISIBLE=4]="VISIBLE",t[t.HIGHLIGHT=8]="HIGHLIGHT",t[t.HIGHLIGHT_ACTIVE=16]="HIGHLIGHT_ACTIVE",t[t.REMOVE=32]="REMOVE",t[t.TRANSFORM_CHANGED=64]="TRANSFORM_CHANGED",t[t.ACTIVE=18]="ACTIVE"}(E||(E={}));class O{constructor(t){this.localTransform=t.getField(L.LOCALTRANSFORM,l),this.globalTransform=t.getField(L.GLOBALTRANSFORM,l),this.modelOrigin=t.getField(L.MODELORIGIN,c),this.model=t.getField(L.MODEL,f),this.modelNormal=t.getField(L.MODELNORMAL,f),this.modelScaleFactors=t.getField(L.MODELSCALEFACTORS,m),this.boundingSphere=t.getField(L.BOUNDINGSPHERE,g),this.color=t.getField(L.COLOR,_),this.featureAttribute=t.getField(L.FEATUREATTRIBUTE,_),this.state=t.getField(L.STATE,d),this.lodLevel=t.getField(L.LODLEVEL,d)}}class S extends t{constructor(t,e){super(),this._capacity=0,this._size=0,this._next=0,this._layout=F(t),this._shaderTransformation=e}get capacity(){return this._capacity}get size(){return this._size}get buffer(){return this._buffer.buffer}get view(){return this._view}addInstance(){this._size+1>this._capacity&&this._grow();const t=this._findSlot();return this._view.state.set(t,E.ALLOCATED),this._size++,this.emit("instance-added",{index:t}),t}removeInstance(t){const e=this._view.state;A(t>=0&&t<this._capacity&&e.get(t)&E.ALLOCATED,"invalid instance handle"),this._getStateFlag(t,E.ACTIVE)?this._setStateFlags(t,E.REMOVE):this.freeInstance(t),this.emit("instance-removed",{index:t})}freeInstance(t){const e=this._view.state;A(t>=0&&t<this._capacity&&e.get(t)&E.ALLOCATED,"invalid instance handle"),e.set(t,0),this._size--}setLocalTransform(t,e,s=!0){this._view.localTransform.setMat(t,e),s&&this.updateModelTransform(t)}getLocalTransform(t,e){this._view.localTransform.getMat(t,e)}setGlobalTransform(t,e,s=!0){this._view.globalTransform.setMat(t,e),s&&this.updateModelTransform(t)}getGlobalTransform(t,e){this._view.globalTransform.getMat(t,e)}updateModelTransform(t){const a=this._view,o=M,h=I;a.localTransform.getMat(t,b),a.globalTransform.getMat(t,w);const l=r(w,w,b);n(o,l[12],l[13],l[14]),a.modelOrigin.setVec(t,o),e(h,l),a.model.setMat(t,h);const c=T(M,l);c.sort(),a.modelScaleFactors.set(t,0,c[1]),a.modelScaleFactors.set(t,1,c[2]),s(h,h),i(h,h),a.modelNormal.setMat(t,h),this._setStateFlags(t,E.TRANSFORM_CHANGED),this.emit("instance-transform-changed",{index:t})}getModelTransform(t,e){const s=this._view;s.model.getMat(t,I),s.modelOrigin.getVec(t,M),e[0]=I[0],e[1]=I[1],e[2]=I[2],e[3]=0,e[4]=I[3],e[5]=I[4],e[6]=I[5],e[7]=0,e[8]=I[6],e[9]=I[7],e[10]=I[8],e[11]=0,e[12]=M[0],e[13]=M[1],e[14]=M[2],e[15]=1}applyShaderTransformation(t,e){this._shaderTransformation&&this._shaderTransformation.applyTransform(this,t,e)}getCombinedModelTransform(t,e){return this.getModelTransform(t,e),this._shaderTransformation&&this._shaderTransformation.applyTransform(this,t,e),e}getCombinedLocalTransform(t,e){return this._view.localTransform.getMat(t,e),this._shaderTransformation&&this._shaderTransformation.applyTransform(this,t,e),e}getCombinedMaxScaleFactor(t){let e=this._view.modelScaleFactors.get(t,1);if(this._shaderTransformation){const s=this._shaderTransformation.scaleFactor(M,this,t);e*=Math.max(s[0],s[1],s[2])}return e}getCombinedMedianScaleFactor(t){let e=this._view.modelScaleFactors.get(t,0);if(this._shaderTransformation){const s=this._shaderTransformation.scaleFactor(M,this,t);s.sort(),e*=s[1]}return e}getModel(t,e){this._view.model.getMat(t,e)}setFeatureAttribute(t,e){this._view.featureAttribute.setVec(t,e)}getFeatureAttribute(t,e){this._view.featureAttribute.getVec(t,e)}setColor(t,e){this._view.color.setVec(t,e)}getColor(t,e){this._view.color.getVec(t,e)}setVisible(t,e){e!==this.getVisible(t)&&(this._setStateFlag(t,E.VISIBLE,e),this.emit("instance-visibility-changed",{index:t}))}getVisible(t){return this._getStateFlag(t,E.VISIBLE)}setHighlight(t,e){e!==this.getHighlight(t)&&(this._setStateFlag(t,E.HIGHLIGHT,e),this.emit("instance-highlight-changed",{index:t}))}getHighlight(t){return this._getStateFlag(t,E.HIGHLIGHT)}getState(t){return this._view.state.get(t)}getLodLevel(t){return this._view.lodLevel.get(t)}countFlags(t){let e=0;for(let s=0;s<this._capacity;++s){this.getState(s)&t&&++e}return e}_setStateFlags(t,e){const s=this._view.state;e=s.get(t)|e,s.set(t,e)}_clearStateFlags(t,e){const s=this._view.state;e=s.get(t)&~e,s.set(t,e)}_setStateFlag(t,e,s){s?this._setStateFlags(t,e):this._clearStateFlags(t,e)}_getStateFlag(t,e){return!!(this._view.state.get(t)&e)}_grow(){const t=Math.max(v,Math.floor(this._capacity*p)),e=this._layout.createBuffer(t);if(this._buffer){const t=new Uint8Array(this._buffer.buffer);new Uint8Array(e.buffer).set(t)}this._capacity=t,this._buffer=e,this._view=new O(this._buffer)}_findSlot(){const t=this._view.state;let e=this._next;for(;t.get(e)&E.ALLOCATED;)e=(e+1)%this._capacity;return this._next=(e+1)%this._capacity,e}}const v=1024,p=2,M=h(),I=a(),b=o(),w=o();export{S as InstanceData,O as InstanceDataView,E as StateFlags};
5
+ import t from"../../../../../core/Evented.js";import{f as e,e as s,t as i}from"../../../../../chunks/mat3.js";import{c as a}from"../../../../../chunks/mat3f64.js";import{m as r}from"../../../../../chunks/mat4.js";import{c as o}from"../../../../../chunks/mat4f64.js";import{s as n}from"../../../../../chunks/vec3.js";import{c as h}from"../../../../../chunks/vec3f64.js";import{BufferViewMat4f64 as l,BufferViewVec3f64 as c,BufferViewMat3f as f,BufferViewVec2f as m,BufferViewVec4f64 as g,BufferViewVec4f as _,BufferViewUint8 as d}from"../../../../../geometry/support/buffer/BufferView.js";import{scaleFromMatrix as T}from"../../../support/mathUtils.js";import{newLayout as u}from"../../../support/buffer/InterleavedLayout.js";import{assert as L}from"../Util.js";import{VertexAttribute as A}from"../VertexAttribute.js";var E;function F(t){let e=u().mat4f64(A.LOCALTRANSFORM).mat4f64(A.GLOBALTRANSFORM).vec4f64(A.BOUNDINGSPHERE).vec3f64(A.MODELORIGIN).mat3f(A.MODEL).mat3f(A.MODELNORMAL).vec2f(A.MODELSCALEFACTORS);return t.indexOf("color")>=0&&(e=e.vec4f(A.COLOR)),t.indexOf("featureAttribute")>=0&&(e=e.vec4f(A.FEATUREATTRIBUTE)),e=e.u8(A.STATE).u8(A.LODLEVEL).alignTo(8),e}!function(t){t[t.ALLOCATED=1]="ALLOCATED",t[t.DEFAULT_ACTIVE=2]="DEFAULT_ACTIVE",t[t.VISIBLE=4]="VISIBLE",t[t.HIGHLIGHT=8]="HIGHLIGHT",t[t.HIGHLIGHT_ACTIVE=16]="HIGHLIGHT_ACTIVE",t[t.REMOVE=32]="REMOVE",t[t.TRANSFORM_CHANGED=64]="TRANSFORM_CHANGED",t[t.ACTIVE=18]="ACTIVE"}(E||(E={}));class O{constructor(t){this.localTransform=t.getField(A.LOCALTRANSFORM,l),this.globalTransform=t.getField(A.GLOBALTRANSFORM,l),this.modelOrigin=t.getField(A.MODELORIGIN,c),this.model=t.getField(A.MODEL,f),this.modelNormal=t.getField(A.MODELNORMAL,f),this.modelScaleFactors=t.getField(A.MODELSCALEFACTORS,m),this.boundingSphere=t.getField(A.BOUNDINGSPHERE,g),this.color=t.getField(A.COLOR,_),this.featureAttribute=t.getField(A.FEATUREATTRIBUTE,_),this.state=t.getField(A.STATE,d),this.lodLevel=t.getField(A.LODLEVEL,d)}}class S extends t{constructor(t,e){super(),this._capacity=0,this._size=0,this._next=0,this._layout=F(t),this._shaderTransformation=e}get capacity(){return this._capacity}get size(){return this._size}get buffer(){return this._buffer.buffer}get view(){return this._view}addInstance(){this._size+1>this._capacity&&this._grow();const t=this._findSlot();return this._view.state.set(t,E.ALLOCATED),this._size++,this.emit("instance-added",{index:t}),t}removeInstance(t){const e=this._view.state;L(t>=0&&t<this._capacity&&e.get(t)&E.ALLOCATED,"invalid instance handle"),this._getStateFlag(t,E.ACTIVE)?this._setStateFlags(t,E.REMOVE):this.freeInstance(t),this.emit("instance-removed",{index:t})}freeInstance(t){const e=this._view.state;L(t>=0&&t<this._capacity&&e.get(t)&E.ALLOCATED,"invalid instance handle"),e.set(t,0),this._size--}setLocalTransform(t,e,s=!0){this._view.localTransform.setMat(t,e),s&&this.updateModelTransform(t)}getLocalTransform(t,e){this._view.localTransform.getMat(t,e)}setGlobalTransform(t,e,s=!0){this._view.globalTransform.setMat(t,e),s&&this.updateModelTransform(t)}getGlobalTransform(t,e){this._view.globalTransform.getMat(t,e)}updateModelTransform(t){const a=this._view,o=M,h=I;a.localTransform.getMat(t,b),a.globalTransform.getMat(t,w);const l=r(w,w,b);n(o,l[12],l[13],l[14]),a.modelOrigin.setVec(t,o),e(h,l),a.model.setMat(t,h);const c=T(M,l);c.sort(),a.modelScaleFactors.set(t,0,c[1]),a.modelScaleFactors.set(t,1,c[2]),s(h,h),i(h,h),a.modelNormal.setMat(t,h),this._setStateFlags(t,E.TRANSFORM_CHANGED),this.emit("instance-transform-changed",{index:t})}getModelTransform(t,e){const s=this._view;s.model.getMat(t,I),s.modelOrigin.getVec(t,M),e[0]=I[0],e[1]=I[1],e[2]=I[2],e[3]=0,e[4]=I[3],e[5]=I[4],e[6]=I[5],e[7]=0,e[8]=I[6],e[9]=I[7],e[10]=I[8],e[11]=0,e[12]=M[0],e[13]=M[1],e[14]=M[2],e[15]=1}applyShaderTransformation(t,e){this._shaderTransformation&&this._shaderTransformation.applyTransform(this,t,e)}getCombinedModelTransform(t,e){return this.getModelTransform(t,e),this._shaderTransformation&&this._shaderTransformation.applyTransform(this,t,e),e}getCombinedLocalTransform(t,e){return this._view.localTransform.getMat(t,e),this._shaderTransformation&&this._shaderTransformation.applyTransform(this,t,e),e}getCombinedMaxScaleFactor(t){let e=this._view.modelScaleFactors.get(t,1);if(this._shaderTransformation){const s=this._shaderTransformation.scaleFactor(M,this,t);e*=Math.max(s[0],s[1],s[2])}return e}getCombinedMedianScaleFactor(t){let e=this._view.modelScaleFactors.get(t,0);if(this._shaderTransformation){const s=this._shaderTransformation.scaleFactor(M,this,t);s.sort(),e*=s[1]}return e}getModel(t,e){this._view.model.getMat(t,e)}setFeatureAttribute(t,e){this._view.featureAttribute.setVec(t,e)}getFeatureAttribute(t,e){this._view.featureAttribute.getVec(t,e)}setColor(t,e){this._view.color.setVec(t,e)}getColor(t,e){this._view.color.getVec(t,e)}setVisible(t,e){e!==this.getVisible(t)&&(this._setStateFlag(t,E.VISIBLE,e),this.emit("instance-visibility-changed",{index:t}))}getVisible(t){return this._getStateFlag(t,E.VISIBLE)}setHighlight(t,e){e!==this.getHighlight(t)&&(this._setStateFlag(t,E.HIGHLIGHT,e),this.emit("instance-highlight-changed",{index:t}))}getHighlight(t){return this._getStateFlag(t,E.HIGHLIGHT)}getState(t){return this._view.state.get(t)}getLodLevel(t){return this._view.lodLevel.get(t)}countFlags(t){let e=0;for(let s=0;s<this._capacity;++s){this.getState(s)&t&&++e}return e}_setStateFlags(t,e){const s=this._view.state;e=s.get(t)|e,s.set(t,e)}_clearStateFlags(t,e){const s=this._view.state;e=s.get(t)&~e,s.set(t,e)}_setStateFlag(t,e,s){s?this._setStateFlags(t,e):this._clearStateFlags(t,e)}_getStateFlag(t,e){return!!(this._view.state.get(t)&e)}_grow(){const t=Math.max(v,Math.floor(this._capacity*p)),e=this._layout.createBuffer(t);if(this._buffer){const t=new Uint8Array(this._buffer.buffer);new Uint8Array(e.buffer).set(t)}this._capacity=t,this._buffer=e,this._view=new O(this._buffer)}_findSlot(){const t=this._view.state;let e=this._next;for(;t.get(e)&E.ALLOCATED;)e=(e+1)%this._capacity;return this._next=(e+1)%this._capacity,e}}const v=1024,p=2,M=h(),I=a(),b=o(),w=o();export{S as InstanceData,O as InstanceDataView,E as StateFlags};