@arcgis/core 4.29.0-next.20231219 → 4.29.0-next.20231221

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 (242) hide show
  1. package/analysis/Analysis.js +1 -1
  2. package/applications/WebEditor/sketchUtils.js +1 -1
  3. package/assets/components/assets/icon/hexagon16.json +1 -0
  4. package/assets/components/assets/icon/hexagon24.json +1 -0
  5. package/assets/components/assets/icon/hexagon32.json +1 -0
  6. package/assets/components/assets/icon/octagon16.json +1 -0
  7. package/assets/components/assets/icon/octagon24.json +1 -0
  8. package/assets/components/assets/icon/octagon32.json +1 -0
  9. package/assets/esri/core/libs/libtess/libtess.wasm +0 -0
  10. package/assets/esri/core/workers/RemoteClient.js +1 -1
  11. package/assets/esri/core/workers/chunks/00b340b4495bfabd4ca2.js +1 -0
  12. package/assets/esri/core/workers/chunks/{4301736368af52b94ee2.js → 02d6e2f0b1003534a077.js} +1 -1
  13. package/assets/esri/core/workers/chunks/050132142f4887c62724.js.LICENSE.txt +1 -1
  14. package/assets/esri/core/workers/chunks/0e315452f11b112523f0.js +1 -0
  15. package/assets/esri/core/workers/chunks/0f5a197f0a4b3a354bcd.js +1 -0
  16. package/assets/esri/core/workers/chunks/1187ba315883ff27e2d9.js +1 -0
  17. package/assets/esri/core/workers/chunks/1254a544d369d99ccf59.js +1 -0
  18. package/assets/esri/core/workers/chunks/138d138a5d33b2f5d8a4.js +1 -0
  19. package/assets/esri/core/workers/chunks/1a73dcbb49d17f16ed5a.js +1 -0
  20. package/assets/esri/core/workers/chunks/1c2b17d22f97d56f6212.js +1 -0
  21. package/assets/esri/core/workers/chunks/{0be38fd63e870341c660.js → 220fcc25578b2ef316da.js} +1 -1
  22. package/assets/esri/core/workers/chunks/251ceefdea4b345698a4.js +1 -0
  23. package/assets/esri/core/workers/chunks/28aafc7ea522663909b8.js +1 -0
  24. package/assets/esri/core/workers/chunks/30749bcd1a7b98a38386.js +1 -0
  25. package/assets/esri/core/workers/chunks/320a75ff760295d9af91.js +1 -0
  26. package/assets/esri/core/workers/chunks/{c9f8354d51f701cd69e5.js → 321dcff84c31c739ed93.js} +1 -1
  27. package/assets/esri/core/workers/chunks/36eb1e0471eb61a6bc38.js +1 -0
  28. package/assets/esri/core/workers/chunks/{57176c0968e07357126d.js → 3a429bb09b89e84021ab.js} +1 -1
  29. package/assets/esri/core/workers/chunks/444adb8a310024ec969c.js +1 -0
  30. package/assets/esri/core/workers/chunks/48aebd650b6eccde01f8.js.LICENSE.txt +1 -1
  31. package/assets/esri/core/workers/chunks/4f7459402b5910288ab1.js +1 -0
  32. package/assets/esri/core/workers/chunks/4fcd94fbf7c68996ad31.js +1 -0
  33. package/assets/esri/core/workers/chunks/573ad8aa1c2cfad61eb8.js +1 -0
  34. package/assets/esri/core/workers/chunks/5e12871a267742de6d22.js +1 -0
  35. package/assets/esri/core/workers/chunks/5f3104051f5267c58dda.js +2 -0
  36. package/assets/esri/core/workers/chunks/{76d0c4d6192449f22e51.js.LICENSE.txt → 5f3104051f5267c58dda.js.LICENSE.txt} +1 -1
  37. package/assets/esri/core/workers/chunks/{f350378a0d93dda39425.js → 7205c1680afee0cc0aac.js} +1 -1
  38. package/assets/esri/core/workers/chunks/77b3dff9fdcfe1222749.js +1 -0
  39. package/assets/esri/core/workers/chunks/77c29cfa3d245ff0afa0.js +1 -0
  40. package/assets/esri/core/workers/chunks/82dac92c1c611dea077f.js +1 -0
  41. package/assets/esri/core/workers/chunks/831283ac6653d7af90b6.js +1 -0
  42. package/assets/esri/core/workers/chunks/8485562b452686c6c3f2.js +1 -0
  43. package/assets/esri/core/workers/chunks/85a39b0f928f817a4b1b.js +1 -0
  44. package/assets/esri/core/workers/chunks/882fec2317740f6c118f.js +1 -0
  45. package/assets/esri/core/workers/chunks/8e1ac19a6188da157c0b.js +1 -0
  46. package/assets/esri/core/workers/chunks/8e2723dbc09400202aea.js +1 -0
  47. package/assets/esri/core/workers/chunks/{d3860693a40394723c99.js → 9249371cb2437e68a304.js} +1 -1
  48. package/assets/esri/core/workers/chunks/9528dfed701ad37ea551.js.LICENSE.txt +1 -1
  49. package/assets/esri/core/workers/chunks/{419f4aaecc4231fdd171.js → 9dc0331885cb8150d9ca.js} +1 -1
  50. package/assets/esri/core/workers/chunks/9ebf8288046aa0fa51f1.js.LICENSE.txt +1 -1
  51. package/assets/esri/core/workers/chunks/a0b8164928a331ffc1b4.js +2 -0
  52. package/assets/esri/core/workers/chunks/{5c71a14417cdd11a1e8d.js.LICENSE.txt → a0b8164928a331ffc1b4.js.LICENSE.txt} +1 -1
  53. package/assets/esri/core/workers/chunks/a6e3783cc10fb505473e.js +1 -0
  54. package/assets/esri/core/workers/chunks/a6fec91863abaa670301.js +2 -0
  55. package/assets/esri/core/workers/chunks/{359297c87764ae8db386.js.LICENSE.txt → a6fec91863abaa670301.js.LICENSE.txt} +1 -1
  56. package/assets/esri/core/workers/chunks/a98cdf10ff7b2923abd5.js +1 -0
  57. package/assets/esri/core/workers/chunks/aa43b12a71957da2e678.js +1 -0
  58. package/assets/esri/core/workers/chunks/ac85f9d88f5583407d66.js +1 -0
  59. package/assets/esri/core/workers/chunks/{418988591e8068adefe2.js → b7c2244c27790ccaca92.js} +1 -1
  60. package/assets/esri/core/workers/chunks/da70e2c191e7d1d2df64.js +1 -0
  61. package/assets/esri/core/workers/chunks/dbded06d7a944dd97b01.js +1 -0
  62. package/assets/esri/core/workers/chunks/dcf857dc23b152fe74ff.js +1 -0
  63. package/assets/esri/core/workers/chunks/dcfc48bf5c27774fa05c.js +1 -0
  64. package/assets/esri/core/workers/chunks/dd368833c042127360ad.js +1 -0
  65. package/assets/esri/core/workers/chunks/e4049e498b3eaa9c8596.js +1 -0
  66. package/assets/esri/core/workers/chunks/e730a930d8a551552db5.js +1 -0
  67. package/assets/esri/core/workers/chunks/eb55835b8d3829f75e1e.js +1 -0
  68. package/assets/esri/core/workers/chunks/ef6fc6c92eae4f51e689.js +2 -0
  69. package/assets/esri/core/workers/chunks/{931063b2654ff763d15e.js.LICENSE.txt → ef6fc6c92eae4f51e689.js.LICENSE.txt} +1 -1
  70. package/assets/esri/core/workers/chunks/f4124bf5b674811332bd.js.LICENSE.txt +1 -1
  71. package/assets/esri/core/workers/chunks/fd03cd19d0d4db699dca.js +1 -0
  72. package/assets/esri/libs/vxl/vxlLayer.wasm +0 -0
  73. package/assets/esri/themes/base/widgets/_Directions.scss +4 -0
  74. package/assets/esri/themes/base/widgets/_Grid.scss +8 -2
  75. package/assets/esri/themes/dark/main.css +1 -1
  76. package/assets/esri/themes/light/main.css +1 -1
  77. package/assets/esri/themes/light/view.css +1 -1
  78. package/chunks/libtess-asm.js +1 -1
  79. package/chunks/libtess.js +1 -1
  80. package/chunks/vec32.js +1 -1
  81. package/chunks/vxlLayer.js +1 -1
  82. package/core/PooledArray.js +1 -1
  83. package/core/libs/gl-matrix-2/math/vec3.js +1 -1
  84. package/core/scheduling.js +1 -1
  85. package/core/sql.js +1 -1
  86. package/geometry/ellipsoidUtils.js +1 -1
  87. package/geometry/libtess.js +1 -1
  88. package/geometry/support/meshUtils/loadExternal.js +1 -1
  89. package/geometry/support/meshUtils/loadGLTFMesh.js +1 -1
  90. package/interfaces.d.ts +391 -49
  91. package/layers/BuildingSceneLayer.js +1 -1
  92. package/layers/GeoJSONLayer.js +1 -1
  93. package/layers/IntegratedMesh3DTilesLayer.js +1 -1
  94. package/layers/IntegratedMeshLayer.js +1 -1
  95. package/layers/MapImageLayer.js +1 -1
  96. package/layers/OGCFeatureLayer.js +1 -1
  97. package/layers/PointCloudLayer.js +1 -1
  98. package/layers/SceneLayer.js +1 -1
  99. package/layers/VoxelLayer.js +1 -1
  100. package/layers/VoxelWasmPerSceneView.js +1 -1
  101. package/layers/buildingSublayers/BuildingComponentSublayer.js +1 -1
  102. package/layers/graphics/controllers/FeatureTileController3D.js +1 -1
  103. package/layers/graphics/sources/WFSSource.js +1 -1
  104. package/layers/graphics/sources/support/uploads.js +1 -1
  105. package/layers/mixins/SceneService.js +1 -1
  106. package/layers/ogc/wfsUtils.js +1 -1
  107. package/layers/support/I3SIndexInfo.js +1 -1
  108. package/layers/support/Sublayer.js +1 -1
  109. package/layers/support/associatedFeatureServiceUtils.js +1 -1
  110. package/layers/support/rasterDatasets/WCSRaster.js +1 -1
  111. package/layers/support/rasterFunctions/BandArithmeticFunction.js +1 -1
  112. package/layers/support/rasterFunctions/bandIndexUtils.js +1 -1
  113. package/package.json +2 -2
  114. package/portal/schemas/buildingSceneLayerItem.js +1 -1
  115. package/portal/schemas/definitions.js +1 -1
  116. package/portal/schemas/integratedMeshLayerItem.js +1 -1
  117. package/portal/schemas/pointCloudLayerItem.js +1 -1
  118. package/portal/schemas/sceneLayerItem.js +1 -1
  119. package/support/revision.js +1 -1
  120. package/views/2d/engine/webgl/shaderGraph/techniques/markers/MarkerShader.js +1 -1
  121. package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
  122. package/views/2d/layers/FeatureLayerView2D.js +1 -1
  123. package/views/2d/layers/SubtypeGroupLayerView2D.js +1 -1
  124. package/views/2d/layers/features/layerAdapters/FeatureLayerAdapter.js +5 -0
  125. package/views/2d/layers/features/layerAdapters/InMemoryLayerAdapter.js +5 -0
  126. package/views/2d/layers/features/layerAdapters/KnowledgeGraphSublayerAdapter.js +5 -0
  127. package/views/2d/layers/features/layerAdapters/OGCFeatureLayerAdapter.js +5 -0
  128. package/views/2d/layers/features/layerAdapters/OrientedImageryLayerAdapter.js +5 -0
  129. package/views/2d/layers/features/layerAdapters/StreamLayerAdapter.js +5 -0
  130. package/views/2d/layers/features/layerAdapters/SubtypeGroupLayerAdapter.js +5 -0
  131. package/views/2d/layers/features/layerAdapters/featureReductionUtils.js +5 -0
  132. package/views/2d/layers/features/layerAdapters/floorFilterUtils.js +5 -0
  133. package/views/2d/layers/features/support/NormalizedField.js +1 -1
  134. package/views/2d/layers/support/DebugOverlay.js +1 -1
  135. package/views/3d/analysis/AnalysisView3D.js +1 -1
  136. package/views/3d/analysis/Dimension/lengthDimensionUtils.js +1 -1
  137. package/views/3d/layers/I3SMeshView3D.js +1 -1
  138. package/views/3d/layers/ImageryTileLayerView3D.js +1 -1
  139. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  140. package/views/3d/layers/IntegratedMesh3DTilesViewPerformanceInfo.js +5 -0
  141. package/views/3d/layers/PointCloudLayerView3D.js +1 -1
  142. package/views/3d/layers/TiledLayerView3D.js +1 -1
  143. package/views/3d/layers/VoxelLayerView3D.js +1 -1
  144. package/views/3d/layers/i3s/I3SIntersectionHandler.js +1 -1
  145. package/views/3d/layers/i3s/I3SUtil.js +1 -1
  146. package/views/3d/layers/i3s/I3SViewportQueries.js +1 -1
  147. package/views/3d/layers/i3s/LayerElevationProvider.js +1 -1
  148. package/views/3d/layers/i3s/PagedNodeIndex.js +1 -1
  149. package/views/3d/layers/support/DefinitionExpressionSceneLayerView.js +1 -1
  150. package/views/3d/layers/support/TemporalSceneLayerView.js +1 -1
  151. package/views/3d/layers/support/Tiles3DIntersectionHandler.js +1 -1
  152. package/views/3d/state/helpers/SceneIntersectionHelper.js +1 -1
  153. package/views/3d/support/RenderCoordsHelper.js +1 -1
  154. package/views/3d/support/orientedBoundingBox.js +1 -1
  155. package/views/3d/terrain/OverlayFramebufferObject.js +1 -1
  156. package/views/3d/terrain/OverlayManager.js +1 -1
  157. package/views/3d/terrain/OverlayRenderer.js +1 -1
  158. package/views/3d/terrain/PatchRenderData.js +1 -1
  159. package/views/3d/terrain/SphericalPatch.js +1 -1
  160. package/views/3d/terrain/TerrainSurface.js +1 -1
  161. package/views/3d/webgl-engine/collections/Component/ComponentObjectCollection.js +1 -1
  162. package/views/3d/webgl-engine/collections/Component/IntersectionGeometry.js +1 -1
  163. package/views/3d/webgl-engine/core/FBOCache.js +1 -1
  164. package/views/3d/webgl-engine/effects/RenderNodeCollection.js +1 -1
  165. package/views/3d/webgl-engine/effects/ScreenSpaceGeometry.js +1 -1
  166. package/views/3d/webgl-engine/effects/debug/RenderNodeVisualizerNode.js +1 -1
  167. package/views/3d/webgl-engine/effects/highlight/Highlight.js +1 -1
  168. package/views/3d/webgl-engine/effects/smaa/SMAA.js +1 -1
  169. package/views/3d/webgl-engine/effects/ssao/SSAO.js +1 -1
  170. package/views/3d/webgl-engine/lib/Camera.js +1 -1
  171. package/views/3d/webgl-engine/lib/OffscreenRendering.js +1 -1
  172. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  173. package/views/3d/webgl-engine/lib/ShadowMap.js +1 -1
  174. package/views/3d/webgl-engine/lib/glUtil3D.js +1 -1
  175. package/views/3d/webgl-engine/lib/rendererUtils.js +1 -1
  176. package/views/3d/webgl-engine/parts/RenderView.js +1 -1
  177. package/views/3d/webgl-engine/parts/ScreenshotManager.js +1 -1
  178. package/views/draw/DrawGraphicTool.js +1 -1
  179. package/views/interactive/AnalysisToolBase.js +1 -1
  180. package/views/interactive/tooltip/Tooltip.js +1 -1
  181. package/views/interactive/tooltip/content/TooltipContent.js +1 -1
  182. package/views/layers/DimensionLayerView.js +1 -1
  183. package/views/webgl/Program.js +1 -1
  184. package/widgets/BasemapLayerList/BasemapLayerListVisibleElements.js +1 -1
  185. package/widgets/BasemapLayerList.js +1 -1
  186. package/widgets/DirectionalPad/DirectionalPadViewModel.d.ts +4 -0
  187. package/widgets/DirectionalPad.d.ts +4 -0
  188. package/widgets/Directions/css.js +1 -1
  189. package/widgets/Directions.js +1 -1
  190. package/widgets/ElevationProfile/ElevationProfileLineView.js +1 -1
  191. package/widgets/FeatureTable/FieldColumn.js +1 -1
  192. package/widgets/FeatureTable/Grid/Column.js +1 -1
  193. package/widgets/FeatureTable/Grid/Grid.js +1 -1
  194. package/widgets/Features/FeaturesViewModel.js +1 -1
  195. package/widgets/LayerList/support/layerListUtils.js +1 -1
  196. package/widgets/LayerList.js +1 -1
  197. package/widgets/TableList.js +1 -1
  198. package/widgets/support/AnchorElementViewModel.js +1 -1
  199. package/assets/esri/core/workers/chunks/040e0122efe1cb716431.js +0 -1
  200. package/assets/esri/core/workers/chunks/04c89069761f7d6bf69d.js +0 -1
  201. package/assets/esri/core/workers/chunks/0c05900239e372f49f7e.js +0 -1
  202. package/assets/esri/core/workers/chunks/104e943cfffd093572a8.js +0 -1
  203. package/assets/esri/core/workers/chunks/1f5a4da5773ba48addfa.js +0 -1
  204. package/assets/esri/core/workers/chunks/24087961564e5b8cc20c.js +0 -1
  205. package/assets/esri/core/workers/chunks/26d8f6e0b9d67c75a781.js +0 -1
  206. package/assets/esri/core/workers/chunks/3441ae1ee2b11cf2c3f6.js +0 -1
  207. package/assets/esri/core/workers/chunks/359297c87764ae8db386.js +0 -2
  208. package/assets/esri/core/workers/chunks/37f71dac3208e74a76fc.js +0 -1
  209. package/assets/esri/core/workers/chunks/3913cf13681761afa596.js +0 -1
  210. package/assets/esri/core/workers/chunks/4a4dfe393c4c5e9435f9.js +0 -1
  211. package/assets/esri/core/workers/chunks/530306592924eb06d30c.js +0 -1
  212. package/assets/esri/core/workers/chunks/5558e8acc1bee29a0e9b.js +0 -1
  213. package/assets/esri/core/workers/chunks/587c81abcbe118ea89ae.js +0 -1
  214. package/assets/esri/core/workers/chunks/5c71a14417cdd11a1e8d.js +0 -2
  215. package/assets/esri/core/workers/chunks/5db76bdc4916d11cbcfe.js +0 -1
  216. package/assets/esri/core/workers/chunks/642e652bf21a7fa463c9.js +0 -1
  217. package/assets/esri/core/workers/chunks/649c3cbf6b3ec94cbdf1.js +0 -1
  218. package/assets/esri/core/workers/chunks/67e4bec7950f09ffe4a7.js +0 -1
  219. package/assets/esri/core/workers/chunks/68b2743411ef5e09862b.js +0 -1
  220. package/assets/esri/core/workers/chunks/76d0c4d6192449f22e51.js +0 -2
  221. package/assets/esri/core/workers/chunks/78123fa25903d376bd49.js +0 -1
  222. package/assets/esri/core/workers/chunks/7918a1c53ce9e7c95030.js +0 -1
  223. package/assets/esri/core/workers/chunks/80498a2a85e1aeadd569.js +0 -1
  224. package/assets/esri/core/workers/chunks/8407cf549c0c59a206f1.js +0 -1
  225. package/assets/esri/core/workers/chunks/89299923c92540455513.js +0 -1
  226. package/assets/esri/core/workers/chunks/8932cdbb7cfab9258d5a.js +0 -1
  227. package/assets/esri/core/workers/chunks/931063b2654ff763d15e.js +0 -2
  228. package/assets/esri/core/workers/chunks/969a22814dc765ac1061.js +0 -1
  229. package/assets/esri/core/workers/chunks/aa4d3276917421abaa12.js +0 -1
  230. package/assets/esri/core/workers/chunks/be924cb8ab2d40abea6c.js +0 -1
  231. package/assets/esri/core/workers/chunks/c6d1a6db8cfa0a7e3bd2.js +0 -1
  232. package/assets/esri/core/workers/chunks/c87e3d55ecdbbb584dfc.js +0 -1
  233. package/assets/esri/core/workers/chunks/cf9bf7d57341d00a92a6.js +0 -1
  234. package/assets/esri/core/workers/chunks/d72121b17640e302d6a9.js +0 -1
  235. package/assets/esri/core/workers/chunks/de01e106ca3daf6c2f49.js +0 -1
  236. package/assets/esri/core/workers/chunks/e3154ef5dbd851224452.js +0 -1
  237. package/assets/esri/core/workers/chunks/f0c62bb406bb93b1408a.js +0 -1
  238. package/assets/esri/core/workers/chunks/f4c4e0fe6be09fa49784.js +0 -1
  239. package/assets/esri/core/workers/chunks/f64a4349f895f92b6338.js +0 -1
  240. package/assets/esri/core/workers/chunks/f7a31ac1251c9c0ba713.js +0 -1
  241. package/assets/esri/core/workers/chunks/f842b3b50059aa70f1af.js +0 -1
  242. package/assets/esri/core/workers/chunks/fab270f3a45914f8df9e.js +0 -1
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import{disposeMaybe as t}from"../../../../core/maybe.js";import{createScreenSizeTriangleVAO as r}from"../lib/glUtil3D.js";import{PrimitiveType as s}from"../../../webgl/enums.js";class e{constructor(t){this._rctx=t,this._vao=r(t)}destroy(){this._vao=t(this._vao)}draw(){null!=this._vao&&(this._rctx.bindVAO(this._vao),this._rctx.drawArrays(s.TRIANGLES,0,3))}get test(){return{cachedWebGLObjects:o(this._vao?.glName)+o(this._vao?.indexBuffer?.glName)+o(this._vao?.vertexBuffers.geometry)}}}function o(t){return null!=t?1:0}export{e as ScreenSpaceGeometry};
5
+ import{disposeMaybe as e}from"../../../../core/maybe.js";import{Default3D as t}from"../lib/DefaultVertexAttributeLocations.js";import{Pos2 as r}from"../lib/DefaultVertexBufferLayouts.js";import{VertexArrayObject as o}from"../lib/VertexArrayObject.js";import{BufferObject as i}from"../../../webgl/BufferObject.js";import{PrimitiveType as s,Usage as a}from"../../../webgl/enums.js";class c{constructor(e){this._rctx=e,this._vao=this.createScreenSizeTriangleVAO(e)}destroy(){this._vao=e(this._vao)}draw(){null!=this._vao&&(this._rctx.bindVAO(this._vao),this._rctx.drawArrays(s.TRIANGLES,0,3))}get test(){return{cachedWebGLObjects:m(this._vao?.glName)+m(this._vao?.indexBuffer?.glName)+m(this._vao?.vertexBuffers.geometry)}}createScreenSizeTriangleVAO(e,s=r,c=t){const m=new Float32Array([-1,-1,3,-1,-1,3]);return new o(e,c,{geometry:s},{geometry:i.createVertex(e,a.STATIC_DRAW,m)})}}function m(e){return null!=e?1:0}export{c as ScreenSpaceGeometry};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../../chunks/tslib.es6.js";import"../../../../../core/Logger.js";import"../../../../../core/has.js";import"../../../../../core/RandomLCG.js";import"../../../../../core/Error.js";import{subclass as r}from"../../../../../core/accessorSupport/decorators/subclass.js";import o from"../../../effects/RenderNode.js";import{ColorFormat as n}from"../../core/FBOCache.js";import{getProjectionInfo as t,getZScale as i}from"../../core/shaderLibrary/util/CameraSpace.glsl.js";import{Default3D as s}from"../../lib/DefaultVertexAttributeLocations.js";import{ClearBufferBit as a,ColorAttachment as c,BlendFactor as l,SizedPixelFormat as u,PixelFormat as f,DataType as p}from"../../../../webgl/enums.js";var d;!function(e){e[e.ON=0]="ON",e[e.OFF=1]="OFF"}(d||(d={}));let h=class extends o{constructor(){super(...arguments),this.consumes={required:["composite-color"]},this.produces=["composite-color"],this._focusedFBO=null,this._program=new Array}destroy(){this._program.forEach((e=>e.dispose())),this._program.length=0}render(e,r){const o=e.find((({name:e})=>"composite-color"===e))?.getTexture(),t=this.renderCamera,i=this.renderingContext,s=t.fullWidth,c=t.fullHeight,l=this.fboCache.acquire(n.RGBA,s,c,"fbo visualizer");i.bindFramebuffer(l?.fbo),i.setClearColor(0,0,0,0),i.clearSafe(a.COLOR_BUFFER_BIT);const u=this._ensureShader(i,!1);return i.useProgram(u),this.bindTexture(this._focusedFBO?this._focusedFBO.colorTexture:o,0),u.setUniform1i("colorTex",0),u.setUniform1i("inputType",0),i.screen.draw(),l}getReplacingFBO(e,r,o,s,f){r===d.ON&&(s=e.width,f=e.height);const p=this.renderingContext,h=e.depthStencilTexture,m=this._ensureShader(p,null!=h),v=this.fboCache.acquire(n.RGBA,s,f,"fbo visualizer");p.useProgram(m),h?(v.acquireColor(n.RGBA,c.COLOR_ATTACHMENT1),p.bindFramebuffer(v.fbo),p.capabilities.drawBuffers?.drawBuffers([c.COLOR_ATTACHMENT0,c.COLOR_ATTACHMENT1]),p.bindTexture(h,1),m.setUniform1i("depthTex",1)):p.bindFramebuffer(v.fbo);const T=p.getViewport();p.setViewport(0,0,s,f),p.setClearColor(0,0,0,0),p.clearSafe(a.COLOR_BUFFER_BIT),p.setBlendingEnabled(!0),p.setBlendFunction(l.ONE,l.ONE_MINUS_SRC_ALPHA),p.bindTexture(e.colorTexture,0),m.setUniform1i("colorTex",0);const F=e.colorTexture?.descriptor.internalFormat,g=o.includes("depth")||o.includes("shadow")?3:F===u.R16F||F===u.R32F||F===u.R8?1:F===u.RG8?2:F===u.RGBA16F?4:0;if(m.setUniform1i("inputType",g),o.includes("depth")){const e=this.renderCamera;m.setUniform2fv("nearFar",e.nearFar);const r=t(e);m.setUniform4fv("projInfo",r);const o=i(e);m.setUniform2fv("zScale",o)}return p.screen.draw(),p.capabilities.drawBuffers?.drawBuffers([c.COLOR_ATTACHMENT0]),p.bindFramebuffer(null),p.setViewport(T.x,T.y,T.width,T.height),r===d.ON&&(this._focusedFBO=v),v}clearFocusedFBO(){this._focusedFBO=null}getPreviewContent(e,r,o,t){if(!o)return null;const i=this.renderingContext,s=this.fboCache.acquire(n.RGBA,e,r,"fbo visualizer");i.bindFramebuffer(s?.fbo),i.setClearColor(0,0,0,0),i.clearSafe(a.COLOR_BUFFER_BIT),i.setBlendingEnabled(!0),i.setBlendFunction(l.ONE,l.ONE_MINUS_SRC_ALPHA),i.setViewport(0,0,e,r);const c=this._ensureShader(i,!1);i.useProgram(c),i.bindTexture(o.getColorTexture(t),0),c.setUniform1i("colorTex",0),c.setUniform1i("inputType",0),i.screen.draw();const u=new ImageData(new Uint8ClampedArray(e*r*4),e,r);return i.gl.readPixels(0,0,e,r,f.RGBA,p.UNSIGNED_BYTE,new Uint8Array(u.data.buffer)),i.bindFramebuffer(null),s?.release(),u}_ensureShader(e,r){const o=r?1:0;if(this._program[o])return this._program[o];const n="#version 300 es\n in vec2 position;\n out vec2 uv;\n\n void main() {\n gl_Position = vec4(position, 0.0, 1.0);\n uv = position * 0.5 + vec2(0.5);\n }",t=`#version 300 es\n precision highp float;\n\n in vec2 uv;\n uniform sampler2D colorTex;\n layout(location = 0) out vec4 fragColor;\n ${r?"\n layout(location = 1) out vec4 fragDepth;\n uniform sampler2D depthTex;\n ":""}\n uniform int inputType;\n uniform vec2 nearFar;\n uniform vec4 projInfo;\n uniform vec2 zScale;\n\n // Factors to convert rgba back to float\n const vec4 RGBA_2_FLOAT_FACTORS = vec4(\n 255.0 / (256.0),\n 255.0 / (256.0 * 256.0),\n 255.0 / (256.0 * 256.0 * 256.0),\n 255.0 / (256.0 * 256.0 * 256.0 * 256.0)\n );\n\n\n float rgba2float(vec4 rgba) {\n // Convert components from 0->1 back to 0->255 and then add the components together with their corresponding\n // fixed point factors, i.e. (256^1, 256^2, 256^3, 256^4)\n return dot(rgba, RGBA_2_FLOAT_FACTORS);\n }\n\n float linearDepthFromFloat(float depth) {\n depth = pow(depth, 0.2);\n return -(depth * (nearFar[1] - nearFar[0]) + nearFar[0]);\n }\n\n float linearDepthFromRGBA(vec4 depth) {\n return linearDepthFromFloat(rgba2float(depth));\n }\n\n float linearDepthFromTexture(sampler2D depthTex, vec2 uv) {\n ivec2 iuv = ivec2(uv * vec2(textureSize(depthTex, 0)));\n return linearDepthFromRGBA(texelFetch(depthTex, iuv, 0));\n }\n\n void main() {\n vec4 color;\n if(inputType == 1) {\n color = vec4(vec3(texture(colorTex, uv).r), 1.0);\n } else if(inputType == 2) {\n color = vec4(texture(colorTex, uv).rg, 0.0, 1.0);\n } else if(inputType == 3) {\n float depth = 1.0 - (-linearDepthFromTexture(colorTex, uv) / (nearFar[1] - nearFar[0]));\n color = vec4(vec3(depth), depth >= 0.999 ? 0.0 : 1.0);\n } else if(inputType == 4) {\n color = texture(colorTex, uv);\n color = vec4(color.rgb / color.a, color.a);\n } else {\n color = texture(colorTex, uv);\n }\n\n\n if(color.a < 0.000001)\n discard;\n else {\n fragColor = color;\n ${r?"\n float depth = 1.0 - pow(texture(depthTex, uv).r, 10.0);\n fragDepth = vec4(vec3(depth), depth < 0.000001 ? 0.0 : 1.0);\n ":""}\n }\n }`;return this._program[o]=e.programCache.acquire(n,t,s),this._program[o]}};h=e([r("esri.views.3d.webgl-engine.effects.debug.RenderNodeVisualizerNode")],h);export{d as FocusState,h as RenderNodeVisualizerNode};
5
+ import{_ as e}from"../../../../../chunks/tslib.es6.js";import"../../../../../core/Logger.js";import"../../../../../core/has.js";import"../../../../../core/RandomLCG.js";import"../../../../../core/Error.js";import{subclass as r}from"../../../../../core/accessorSupport/decorators/subclass.js";import o from"../../../effects/RenderNode.js";import{ColorFormat as t}from"../../core/FBOCache.js";import{getProjectionInfo as n,getZScale as i}from"../../core/shaderLibrary/util/CameraSpace.glsl.js";import{Default3D as s}from"../../lib/DefaultVertexAttributeLocations.js";import{ClearBufferBit as a,ColorAttachment as c,BlendFactor as l,SizedPixelFormat as u,PixelFormat as p,DataType as f}from"../../../../webgl/enums.js";var d;!function(e){e[e.ON=0]="ON",e[e.OFF=1]="OFF"}(d||(d={}));let h=class extends o{constructor(){super(...arguments),this.consumes={required:["composite-color"]},this.produces=["composite-color"],this._focusedFBO=null,this._program=new Array}destroy(){this._program.forEach((e=>e.dispose())),this._program.length=0}render(e,r){const o=e.find((({name:e})=>"composite-color"===e))?.getTexture(),t=this.renderCamera,n=this.renderingContext,i=t.fullWidth,s=t.fullHeight,c=this.fboCache.acquire(i,s,"fbo visualizer");n.setClearColor(0,0,0,0),n.clearSafe(a.COLOR_BUFFER_BIT);const l=this._ensureShader(n,!1);return n.useProgram(l),this.bindTexture(this._focusedFBO?this._focusedFBO.colorTexture:o,0),l.setUniform1i("colorTex",0),l.setUniform1i("inputType",0),n.screen.draw(),c}getReplacingFBO(e,r,o,s,p){r===d.ON&&(s=e.width,p=e.height);const f=this.renderingContext,h=e.depthStencilTexture,m=this._ensureShader(f,null!=h),v=this.fboCache.acquire(s,p,"fbo visualizer");f.useProgram(m),h&&(v.acquireColor(t.RGBA,c.COLOR_ATTACHMENT1),f.bindFramebuffer(v.fbo),f.capabilities.drawBuffers?.drawBuffers([c.COLOR_ATTACHMENT0,c.COLOR_ATTACHMENT1]),f.bindTexture(h,1),m.setUniform1i("depthTex",1));const T=f.getViewport();f.setViewport(0,0,s,p),f.setClearColor(0,0,0,0),f.clearSafe(a.COLOR_BUFFER_BIT),f.setBlendingEnabled(!0),f.setBlendFunction(l.ONE,l.ONE_MINUS_SRC_ALPHA),f.bindTexture(e.colorTexture,0),m.setUniform1i("colorTex",0);const g=e.colorTexture?.descriptor.internalFormat,F=o.includes("depth")||o.includes("shadow")?3:g===u.R16F||g===u.R32F||g===u.R8?1:g===u.RG8?2:g===u.RGBA16F?4:0;if(m.setUniform1i("inputType",F),o.includes("depth")){const e=this.renderCamera;m.setUniform2fv("nearFar",e.nearFar);const r=n(e);m.setUniform4fv("projInfo",r);const o=i(e);m.setUniform2fv("zScale",o)}return f.screen.draw(),f.capabilities.drawBuffers?.drawBuffers([c.COLOR_ATTACHMENT0]),f.bindFramebuffer(null),f.setViewport(T.x,T.y,T.width,T.height),r===d.ON&&(this._focusedFBO=v),v}clearFocusedFBO(){this._focusedFBO=null}getPreviewContent(e,r,o,t){if(!o)return null;const n=this.renderingContext,i=this.fboCache.acquire(e,r,"fbo visualizer");n.setClearColor(0,0,0,0),n.clearSafe(a.COLOR_BUFFER_BIT),n.setBlendingEnabled(!0),n.setBlendFunction(l.ONE,l.ONE_MINUS_SRC_ALPHA),n.setViewport(0,0,e,r);const s=this._ensureShader(n,!1);n.useProgram(s),n.bindTexture(o.getColorTexture(t),0),s.setUniform1i("colorTex",0),s.setUniform1i("inputType",0),n.screen.draw();const c=new ImageData(new Uint8ClampedArray(e*r*4),e,r);return n.gl.readPixels(0,0,e,r,p.RGBA,f.UNSIGNED_BYTE,new Uint8Array(c.data.buffer)),n.bindFramebuffer(null),i?.release(),c}_ensureShader(e,r){const o=r?1:0;if(this._program[o])return this._program[o];const t="#version 300 es\n in vec2 position;\n out vec2 uv;\n\n void main() {\n gl_Position = vec4(position, 0.0, 1.0);\n uv = position * 0.5 + vec2(0.5);\n }",n=`#version 300 es\n precision highp float;\n\n in vec2 uv;\n uniform sampler2D colorTex;\n layout(location = 0) out vec4 fragColor;\n ${r?"\n layout(location = 1) out vec4 fragDepth;\n uniform sampler2D depthTex;\n ":""}\n uniform int inputType;\n uniform vec2 nearFar;\n uniform vec4 projInfo;\n uniform vec2 zScale;\n\n // Factors to convert rgba back to float\n const vec4 RGBA_2_FLOAT_FACTORS = vec4(\n 255.0 / (256.0),\n 255.0 / (256.0 * 256.0),\n 255.0 / (256.0 * 256.0 * 256.0),\n 255.0 / (256.0 * 256.0 * 256.0 * 256.0)\n );\n\n\n float rgba2float(vec4 rgba) {\n // Convert components from 0->1 back to 0->255 and then add the components together with their corresponding\n // fixed point factors, i.e. (256^1, 256^2, 256^3, 256^4)\n return dot(rgba, RGBA_2_FLOAT_FACTORS);\n }\n\n float linearDepthFromFloat(float depth) {\n depth = pow(depth, 0.2);\n return -(depth * (nearFar[1] - nearFar[0]) + nearFar[0]);\n }\n\n float linearDepthFromRGBA(vec4 depth) {\n return linearDepthFromFloat(rgba2float(depth));\n }\n\n float linearDepthFromTexture(sampler2D depthTex, vec2 uv) {\n ivec2 iuv = ivec2(uv * vec2(textureSize(depthTex, 0)));\n return linearDepthFromRGBA(texelFetch(depthTex, iuv, 0));\n }\n\n void main() {\n vec4 color;\n if(inputType == 1) {\n color = vec4(vec3(texture(colorTex, uv).r), 1.0);\n } else if(inputType == 2) {\n color = vec4(texture(colorTex, uv).rg, 0.0, 1.0);\n } else if(inputType == 3) {\n float depth = 1.0 - (-linearDepthFromTexture(colorTex, uv) / (nearFar[1] - nearFar[0]));\n color = vec4(vec3(depth), depth >= 0.999 ? 0.0 : 1.0);\n } else if(inputType == 4) {\n color = texture(colorTex, uv);\n color = vec4(color.rgb / color.a, color.a);\n } else {\n color = texture(colorTex, uv);\n }\n\n\n if(color.a < 0.000001)\n discard;\n else {\n fragColor = color;\n ${r?"\n float depth = 1.0 - pow(texture(depthTex, uv).r, 10.0);\n fragDepth = vec4(vec3(depth), depth < 0.000001 ? 0.0 : 1.0);\n ":""}\n }\n }`;return this._program[o]=e.programCache.acquire(t,n,s),this._program[o]}};h=e([r("esri.views.3d.webgl-engine.effects.debug.RenderNodeVisualizerNode")],h);export{d as FocusState,h as RenderNodeVisualizerNode};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../../chunks/tslib.es6.js";import{unitRGBAFromColor as t}from"../../../../../core/colorUtils.js";import has from"../../../../../core/has.js";import{releaseMaybe as r,disposeMaybe as i}from"../../../../../core/maybe.js";import{watch as s,syncAndInitial as o}from"../../../../../core/reactiveUtils.js";import{property as a}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as h}from"../../../../../core/accessorSupport/decorators/subclass.js";import{set as l}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{ColorFormat as c}from"../../core/FBOCache.js";import{SyncRenderPlugin as n,ConsumesHighlight as u}from"../RenderPlugin.js";import{HighlightApplyTechnique as p}from"./HighlightApplyTechnique.js";import{HighlightBlurTechnique as m}from"./HighlightBlurTechnique.js";import{defaultColor as _,defaultHaloOpacity as g,defaultFillOpacity as d}from"./HighlightDefaults.js";import{HighlightDownsampleTechnique as b}from"./HighlightDownsampleTechnique.js";import{HighlightPassParameters as f}from"./HighlightPassParameters.js";import{Default3D as w}from"../../lib/DefaultVertexAttributeLocations.js";import{Pos2Tex as T}from"../../lib/DefaultVertexBufferLayouts.js";import{RenderSlot as v}from"../../lib/RenderSlot.js";import{VertexArrayObject as q}from"../../lib/VertexArrayObject.js";import{H as x}from"../../../../../chunks/HighlightBlur.glsl.js";import{H as P,g as y}from"../../../../../chunks/HighlightDownsample.glsl.js";import{BufferObject as C}from"../../../../webgl/BufferObject.js";import{ClearBufferBit as j,Usage as R}from"../../../../webgl/enums.js";import{vertexCount as O}from"../../../../webgl/Util.js";let D=class extends n{constructor(e){super(e),this._context=null,this._passParameters=new f,this._downsampleDrawParameters=new P,this._blurDrawParameters=new x,this._blurColorFormat=has("mac")?c.RGBA:c.RGBA4,this._grid={coverage:null,vao:null,verticalCellCount:0,horizontalCellCount:0,viewportWidth:0,viewportHeight:0},this.produces=new Map([[v.HIGHLIGHT,()=>!0]])}consumes(){return u}initializeRenderContext(e){this._context=e,null==this._blurTechnique&&(this._blurTechnique=this._context.techniqueRepository.acquire(m)),null==this._downsampleTechnique&&(this._downsampleTechnique=this._context.techniqueRepository.acquire(b)),null==this._applyTechnique&&(this._applyTechnique=this._context.techniqueRepository.acquire(p)),this.addHandles([s((()=>this.view.highlightOptions.color),(e=>{this._passParameters.color=t(e??_),this.view.highlightOptions.haloColor||(this._passParameters.haloColor=this._passParameters.color),this._context.requestRender()}),o),s((()=>this.view.highlightOptions.haloColor),(e=>{this._passParameters.haloColor=null!=e?t(e):this._passParameters.color,this._context.requestRender()}),o),s((()=>this.view.highlightOptions.haloOpacity),(e=>{this._passParameters.haloOpacity=e??g,this._passParameters.haloOpacityOccluded=.25*this._passParameters.haloOpacity,this._context.requestRender()}),o),s((()=>this.view.highlightOptions.fillOpacity),(e=>{this._passParameters.fillOpacity=e??d,this._passParameters.fillOpacityOccluded=.25*this._passParameters.fillOpacity,this._context.requestRender()}),o)])}uninitializeRenderContext(){this._context=null}dispose(){this._blurTechnique=r(this._blurTechnique),this._downsampleTechnique=r(this._downsampleTechnique),this._applyTechnique=r(this._applyTechnique),this._grid.coverage=r(this._grid.coverage),this._grid.vao=i(this._grid.vao)}renderNode(e,t,r,i){const s=r?.highlight?.colorTexture;if(!this._context||!s)return;if(!(this._blurTechnique.compiled&&this._downsampleTechnique.compiled&&this._applyTechnique.compiled))return void this._context.requestRender();const o=e.bindParameters.camera,a=o.fullWidth,h=o.fullHeight,c=o.pixelRatio,n=Math.ceil(a/c),u=Math.ceil(h/c),p=this._context.fbos,m=p.rctx;this._gridUpdateResources(s),this._gridComputeCoverage(s,e.bindParameters),this._passParameters.highlightTexture=s,this._passParameters.coverageTexture=this._grid.coverage?.colorTexture;const{width:_,height:g}=s.descriptor;l(this._passParameters.coverageRounding,_/(Math.ceil(_/y)*y),g/(Math.ceil(g/y)*y));const d=this._grid.vao;m.bindVAO(d);const b=p.acquire(this._blurColorFormat,n,u,"highlight blur");m.bindFramebuffer(b.fbo),m.setClearColor(0,0,0,0),m.clearSafe(j.COLOR_BUFFER_BIT),m.setViewport(0,0,n,u),this._blurDrawParameters.blurInputTexture=s,l(this._blurDrawParameters.blurSize,1/n,0);const f=m.bindTechnique(this._blurTechnique,e.bindParameters,this._passParameters,this._blurDrawParameters);m.drawArrays(this._blurTechnique.primitiveType,0,O(d,"geometry"));const w=p.acquire(this._blurColorFormat,n,u,"highlight blur");m.bindFramebuffer(w.fbo),m.setClearColor(0,0,0,0),m.clearSafe(j.COLOR_BUFFER_BIT),this._blurDrawParameters.blurInputTexture=b.colorTexture,l(this._blurDrawParameters.blurSize,0,1/u),f.bindDraw(this._blurDrawParameters,e.bindParameters,this._passParameters),m.drawArrays(this._blurTechnique.primitiveType,0,O(d,"geometry")),m.bindFramebuffer(i?.fbo),m.setViewport4fv(o.fullViewport),this._passParameters.blurTexture=w.colorTexture,m.bindTechnique(this._applyTechnique,e.bindParameters,this._passParameters),m.drawArrays(this._applyTechnique.primitiveType,0,O(d,"geometry")),b.release(),w.release()}_gridUpdateResources(e){if(!this._context)return;const t=this._context.fbos.rctx,r=this._grid,i=Math.ceil(e.descriptor.height/y),s=Math.ceil(e.descriptor.width/y);if(r.vao&&r.verticalCellCount===i&&r.horizontalCellCount===s)return;r.verticalCellCount=i,r.horizontalCellCount=s;const o=i+1,a=s+1,h=1/i,l=1/s,c=new Float32Array(6*4*o*a);let n=0;for(let u=0;u<o;u++)for(let e=0;e<a;e++)c[n++]=(e-.5)*l*2-1,c[n++]=(u-.5)*h*2-1,c[n++]=e*l,c[n++]=u*h,c[n++]=(e+.5)*l*2-1,c[n++]=(u-.5)*h*2-1,c[n++]=e*l,c[n++]=u*h,c[n++]=(e-.5)*l*2-1,c[n++]=(u+.5)*h*2-1,c[n++]=e*l,c[n++]=u*h,c[n++]=(e-.5)*l*2-1,c[n++]=(u+.5)*h*2-1,c[n++]=e*l,c[n++]=u*h,c[n++]=(e+.5)*l*2-1,c[n++]=(u-.5)*h*2-1,c[n++]=e*l,c[n++]=u*h,c[n++]=(e+.5)*l*2-1,c[n++]=(u+.5)*h*2-1,c[n++]=e*l,c[n++]=u*h;r.vao?.dispose(),r.vao=new q(t,w,{geometry:T},{geometry:C.createVertex(t,R.STATIC_DRAW,c)})}_gridComputeCoverage(e,t){if(!this._context)return;const r=this._context.fbos.rctx,i=this._grid,s=e.descriptor,o=Math.ceil(s.width/y),a=Math.ceil(s.height/y);i.coverage?.release(),i.coverage=this._context.fbos.acquire(c.RG,o,a,"highlight coverage"),this._downsampleDrawParameters.input=e,r.bindFramebuffer(i.coverage.fbo),r.bindTechnique(this._downsampleTechnique,t,this._passParameters,this._downsampleDrawParameters),r.setViewport(0,0,o,a),r.screen.draw()}get test(){return{coverage:this._grid.coverage}}};e([a()],D.prototype,"_context",void 0),e([a()],D.prototype,"view",void 0),D=e([h("esri.views.3d.webgl-engine.effects.highlight.Highlight")],D);export{D as Highlight};
5
+ import{_ as e}from"../../../../../chunks/tslib.es6.js";import{unitRGBAFromColor as t}from"../../../../../core/colorUtils.js";import has from"../../../../../core/has.js";import{releaseMaybe as r,disposeMaybe as i}from"../../../../../core/maybe.js";import{watch as s,syncAndInitial as o}from"../../../../../core/reactiveUtils.js";import{property as a}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as h}from"../../../../../core/accessorSupport/decorators/subclass.js";import{set as l}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{ColorFormat as c}from"../../core/FBOCache.js";import{SyncRenderPlugin as n,ConsumesHighlight as p}from"../RenderPlugin.js";import{HighlightApplyTechnique as u}from"./HighlightApplyTechnique.js";import{HighlightBlurTechnique as m}from"./HighlightBlurTechnique.js";import{defaultColor as _,defaultHaloOpacity as g,defaultFillOpacity as d}from"./HighlightDefaults.js";import{HighlightDownsampleTechnique as b}from"./HighlightDownsampleTechnique.js";import{HighlightPassParameters as f}from"./HighlightPassParameters.js";import{Default3D as w}from"../../lib/DefaultVertexAttributeLocations.js";import{Pos2Tex as T}from"../../lib/DefaultVertexBufferLayouts.js";import{RenderSlot as q}from"../../lib/RenderSlot.js";import{VertexArrayObject as v}from"../../lib/VertexArrayObject.js";import{H as x}from"../../../../../chunks/HighlightBlur.glsl.js";import{H as P,g as y}from"../../../../../chunks/HighlightDownsample.glsl.js";import{BufferObject as C}from"../../../../webgl/BufferObject.js";import{ClearBufferBit as j,Usage as R}from"../../../../webgl/enums.js";import{vertexCount as O}from"../../../../webgl/Util.js";let D=class extends n{constructor(e){super(e),this._context=null,this._passParameters=new f,this._downsampleDrawParameters=new P,this._blurDrawParameters=new x,this._blurColorFormat=has("mac")?c.RGBA:c.RGBA4,this._grid={coverage:null,vao:null,verticalCellCount:0,horizontalCellCount:0,viewportWidth:0,viewportHeight:0},this.produces=new Map([[q.HIGHLIGHT,()=>!0]])}consumes(){return p}initializeRenderContext(e){this._context=e,null==this._blurTechnique&&(this._blurTechnique=this._context.techniqueRepository.acquire(m)),null==this._downsampleTechnique&&(this._downsampleTechnique=this._context.techniqueRepository.acquire(b)),null==this._applyTechnique&&(this._applyTechnique=this._context.techniqueRepository.acquire(u)),this.addHandles([s((()=>this.view.highlightOptions.color),(e=>{this._passParameters.color=t(e??_),this.view.highlightOptions.haloColor||(this._passParameters.haloColor=this._passParameters.color),this._context.requestRender()}),o),s((()=>this.view.highlightOptions.haloColor),(e=>{this._passParameters.haloColor=null!=e?t(e):this._passParameters.color,this._context.requestRender()}),o),s((()=>this.view.highlightOptions.haloOpacity),(e=>{this._passParameters.haloOpacity=e??g,this._passParameters.haloOpacityOccluded=.25*this._passParameters.haloOpacity,this._context.requestRender()}),o),s((()=>this.view.highlightOptions.fillOpacity),(e=>{this._passParameters.fillOpacity=e??d,this._passParameters.fillOpacityOccluded=.25*this._passParameters.fillOpacity,this._context.requestRender()}),o)])}uninitializeRenderContext(){this._context=null}dispose(){this._blurTechnique=r(this._blurTechnique),this._downsampleTechnique=r(this._downsampleTechnique),this._applyTechnique=r(this._applyTechnique),this._grid.coverage=r(this._grid.coverage),this._grid.vao=i(this._grid.vao)}renderNode(e,t,r,i){const s=r?.highlight?.colorTexture;if(!this._context||!s)return;if(!(this._blurTechnique.compiled&&this._downsampleTechnique.compiled&&this._applyTechnique.compiled))return void this._context.requestRender();const o=e.bindParameters.camera,a=o.fullWidth,h=o.fullHeight,c=o.pixelRatio,n=Math.ceil(a/c),p=Math.ceil(h/c),u=this._context.fbos,m=u.rctx;this._gridUpdateResources(s),this._gridComputeCoverage(s,e.bindParameters),this._passParameters.highlightTexture=s,this._passParameters.coverageTexture=this._grid.coverage?.colorTexture;const{width:_,height:g}=s.descriptor;l(this._passParameters.coverageRounding,_/(Math.ceil(_/y)*y),g/(Math.ceil(g/y)*y));const d=this._grid.vao;m.bindVAO(d);const b=u.acquire(n,p,"highlight blur",this._blurColorFormat);m.setClearColor(0,0,0,0),m.clearSafe(j.COLOR_BUFFER_BIT),m.setViewport(0,0,n,p),this._blurDrawParameters.blurInputTexture=s,l(this._blurDrawParameters.blurSize,1/n,0);const f=m.bindTechnique(this._blurTechnique,e.bindParameters,this._passParameters,this._blurDrawParameters);m.drawArrays(this._blurTechnique.primitiveType,0,O(d,"geometry"));const w=u.acquire(n,p,"highlight blur",this._blurColorFormat);m.setClearColor(0,0,0,0),m.clearSafe(j.COLOR_BUFFER_BIT),this._blurDrawParameters.blurInputTexture=b.colorTexture,l(this._blurDrawParameters.blurSize,0,1/p),f.bindDraw(this._blurDrawParameters,e.bindParameters,this._passParameters),m.drawArrays(this._blurTechnique.primitiveType,0,O(d,"geometry")),m.bindFramebuffer(i?.fbo),m.setViewport4fv(o.fullViewport),this._passParameters.blurTexture=w.colorTexture,m.bindTechnique(this._applyTechnique,e.bindParameters,this._passParameters),m.drawArrays(this._applyTechnique.primitiveType,0,O(d,"geometry")),b.release(),w.release()}_gridUpdateResources(e){if(!this._context)return;const t=this._context.fbos.rctx,r=this._grid,i=Math.ceil(e.descriptor.height/y),s=Math.ceil(e.descriptor.width/y);if(r.vao&&r.verticalCellCount===i&&r.horizontalCellCount===s)return;r.verticalCellCount=i,r.horizontalCellCount=s;const o=i+1,a=s+1,h=1/i,l=1/s,c=new Float32Array(6*4*o*a);let n=0;for(let p=0;p<o;p++)for(let e=0;e<a;e++)c[n++]=(e-.5)*l*2-1,c[n++]=(p-.5)*h*2-1,c[n++]=e*l,c[n++]=p*h,c[n++]=(e+.5)*l*2-1,c[n++]=(p-.5)*h*2-1,c[n++]=e*l,c[n++]=p*h,c[n++]=(e-.5)*l*2-1,c[n++]=(p+.5)*h*2-1,c[n++]=e*l,c[n++]=p*h,c[n++]=(e-.5)*l*2-1,c[n++]=(p+.5)*h*2-1,c[n++]=e*l,c[n++]=p*h,c[n++]=(e+.5)*l*2-1,c[n++]=(p-.5)*h*2-1,c[n++]=e*l,c[n++]=p*h,c[n++]=(e+.5)*l*2-1,c[n++]=(p+.5)*h*2-1,c[n++]=e*l,c[n++]=p*h;r.vao?.dispose(),r.vao=new v(t,w,{geometry:T},{geometry:C.createVertex(t,R.STATIC_DRAW,c)})}_gridComputeCoverage(e,t){if(!this._context)return;const r=this._context.fbos.rctx,i=this._grid,s=e.descriptor,o=Math.ceil(s.width/y),a=Math.ceil(s.height/y);this._downsampleDrawParameters.input=e,i.coverage?.release(),i.coverage=this._context.fbos.acquire(o,a,"highlight coverage",c.RG),r.bindTechnique(this._downsampleTechnique,t,this._passParameters,this._downsampleDrawParameters),r.setViewport(0,0,o,a),r.screen.draw()}get test(){return{coverage:this._grid.coverage}}};e([a()],D.prototype,"_context",void 0),e([a()],D.prototype,"view",void 0),D=e([h("esri.views.3d.webgl-engine.effects.highlight.Highlight")],D);export{D as Highlight};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../../chunks/tslib.es6.js";import{disposeMaybe as t,abortMaybe as r}from"../../../../../core/maybe.js";import{throwIfAborted as s,createAbortError as i}from"../../../../../core/promiseUtils.js";import{watch as o,syncAndInitial as a}from"../../../../../core/reactiveUtils.js";import{property as n}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as l}from"../../../../../core/accessorSupport/decorators/subclass.js";import{requestImage as h}from"../../../../../support/requestImageUtils.js";import{ColorFormat as u}from"../../core/FBOCache.js";import{SyncRenderPlugin as c,ConsumesCompositeColor as d}from"../RenderPlugin.js";import{SMAABlendWeightsTechnique as m}from"./SMAABlendWeightsTechnique.js";import{SMAABlurTechnique as _}from"./SMAABlurTechnique.js";import{SMAAEdgeDetectTechnique as p}from"./SMAAEdgeDetectTechnique.js";import{SMAAPassParameters as b}from"./SMAAPassParameters.js";import{RenderFeature as x}from"../../lib/RenderFeature.js";import{RenderSlot as T}from"../../lib/RenderSlot.js";import{PixelFormat as f,TextureSamplingMode as g,ClearBufferBit as q,TextureWrapMode as C}from"../../../../webgl/enums.js";import{Texture as w}from"../../../../webgl/Texture.js";import{TextureDescriptor as j}from"../../../../webgl/TextureDescriptor.js";let A=class extends c{constructor(e){super(e),this._context=null,this._areaTexture=null,this._searchTexture=null,this._isEnabled=!1,this._smaaParameters=new b,this.produces=new Map([[T.ANTIALIASING,()=>this._isEnabled&&null!=this._context]])}consumes(){return d}get updating(){return null!=this._abortController}initializeRenderContext(e){this._context=e,this.addHandles([o((()=>this.view.qualitySettings.antialiasingEnabled),(()=>this.renderFeatureChanged()),a)])}renderFeatureChanged(){this.view.qualitySettings.antialiasingEnabled||this._context?.isFeatureEnabled(x.Antialiasing)?this.enable():this.disable()}uninitializeRenderContext(){this.disable(),this._context=null}async enable(){if(this._isEnabled||!this._context||this._abortController)return;if(this._edgeTechnique??=this._context.techniqueRepository.acquire(p),this._blendTechnique??=this._context.techniqueRepository.acquire(m),this._blurTechnique??=this._context.techniqueRepository.acquire(_),this._areaTexture&&this._searchTexture)return void(this._isEnabled=!0);this._abortController=new AbortController;const e=this._abortController.signal;try{const t=await import("./SMAAData.js");await this._loadTextures(this._context,t,e),this._context?.requestRender()}catch{}this._abortController=null}async _loadTextures(e,t,r){if(s(r),!e)throw i();const[o,a]=await Promise.allSettled([h(t.areaTexture,{signal:r}),h(t.searchTexure,{signal:r})]);s(r),"fulfilled"===o.status&&"fulfilled"===a.status&&(this._areaTexture=R(e.fbos.rctx,g.LINEAR,f.RGB,o.value),this._searchTexture=R(e.fbos.rctx,g.NEAREST,f.LUMINANCE,a.value),this._isEnabled=!0)}_disposeTextures(){this._areaTexture=t(this._areaTexture),this._searchTexture=t(this._searchTexture)}disable(){this._abortController=r(this._abortController),this._isEnabled=!1}destroy(){this.disable(),this._disposeTextures()}renderNode(e,t,r,s){const i=r?.composite?.colorTexture;if(!(this._isEnabled&&this._context&&r&&i))return s;if(!(this._edgeTechnique?.compiled&&this._blendTechnique?.compiled&&this._blurTechnique?.compiled))return this._context.requestRender(),s;const o=i.descriptor.width,a=i.descriptor.height,n=this._context.fbos,l=e.rctx;l.setViewport(0,0,o,a);const h=n.acquire(u.RG,o,a,"smaa edges");l.bindFramebuffer(h.fbo),l.setClearColor(0,0,0,1),l.clear(q.COLOR_BUFFER_BIT),this._smaaParameters.color=i,l.bindTechnique(this._edgeTechnique,null,this._smaaParameters),l.screen.draw();const c=n.acquire(u.RGBA,o,a,"smaa blend");return l.bindFramebuffer(c.fbo),l.setClearColor(0,0,1,1),l.clear(q.COLOR_BUFFER_BIT),this._smaaParameters.inputTexture=h.colorTexture,this._smaaParameters.areaTexture=this._areaTexture,this._smaaParameters.searchTexture=this._searchTexture,l.bindTechnique(this._blendTechnique,null,this._smaaParameters),l.screen.draw(),l.bindFramebuffer(s?.fbo),h.release(),l.setClearColor(0,1,0,1),l.clear(q.COLOR_BUFFER_BIT),this._smaaParameters.inputTexture=c.colorTexture,l.bindTechnique(this._blurTechnique,null,this._smaaParameters),l.screen.draw(),c.release(),s}};function R(e,t,r,s){const i=new j;return i.pixelFormat=r,i.wrapMode=C.CLAMP_TO_EDGE,i.width=s.width,i.height=s.height,i.samplingMode=t,new w(e,i,s)}e([n()],A.prototype,"view",void 0),e([n()],A.prototype,"_context",void 0),e([n()],A.prototype,"_abortController",void 0),e([n({readOnly:!0})],A.prototype,"updating",null),A=e([l("esri.views.3d.webgl-engine.effects.smaa.SMAA")],A);export{A as SMAA};
5
+ import{_ as e}from"../../../../../chunks/tslib.es6.js";import{disposeMaybe as t,abortMaybe as r}from"../../../../../core/maybe.js";import{throwIfAborted as s,createAbortError as i}from"../../../../../core/promiseUtils.js";import{watch as o,syncAndInitial as a}from"../../../../../core/reactiveUtils.js";import{property as n}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as l}from"../../../../../core/accessorSupport/decorators/subclass.js";import{requestImage as h}from"../../../../../support/requestImageUtils.js";import{ColorFormat as u}from"../../core/FBOCache.js";import{SyncRenderPlugin as c,ConsumesCompositeColor as d}from"../RenderPlugin.js";import{SMAABlendWeightsTechnique as m}from"./SMAABlendWeightsTechnique.js";import{SMAABlurTechnique as _}from"./SMAABlurTechnique.js";import{SMAAEdgeDetectTechnique as p}from"./SMAAEdgeDetectTechnique.js";import{SMAAPassParameters as x}from"./SMAAPassParameters.js";import{RenderFeature as b}from"../../lib/RenderFeature.js";import{RenderSlot as T}from"../../lib/RenderSlot.js";import{PixelFormat as f,TextureSamplingMode as g,ClearBufferBit as q,TextureWrapMode as C}from"../../../../webgl/enums.js";import{Texture as w}from"../../../../webgl/Texture.js";import{TextureDescriptor as j}from"../../../../webgl/TextureDescriptor.js";let A=class extends c{constructor(e){super(e),this._context=null,this._areaTexture=null,this._searchTexture=null,this._isEnabled=!1,this._smaaParameters=new x,this.produces=new Map([[T.ANTIALIASING,()=>this._isEnabled&&null!=this._context]])}consumes(){return d}get updating(){return null!=this._abortController}initializeRenderContext(e){this._context=e,this.addHandles([o((()=>this.view.qualitySettings.antialiasingEnabled),(()=>this.renderFeatureChanged()),a)])}renderFeatureChanged(){this.view.qualitySettings.antialiasingEnabled||this._context?.isFeatureEnabled(b.Antialiasing)?this.enable():this.disable()}uninitializeRenderContext(){this.disable(),this._context=null}async enable(){if(this._isEnabled||!this._context||this._abortController)return;if(this._edgeTechnique??=this._context.techniqueRepository.acquire(p),this._blendTechnique??=this._context.techniqueRepository.acquire(m),this._blurTechnique??=this._context.techniqueRepository.acquire(_),this._areaTexture&&this._searchTexture)return void(this._isEnabled=!0);this._abortController=new AbortController;const e=this._abortController.signal;try{const t=await import("./SMAAData.js");await this._loadTextures(this._context,t,e),this._context?.requestRender()}catch{}this._abortController=null}async _loadTextures(e,t,r){if(s(r),!e)throw i();const[o,a]=await Promise.allSettled([h(t.areaTexture,{signal:r}),h(t.searchTexure,{signal:r})]);s(r),"fulfilled"===o.status&&"fulfilled"===a.status&&(this._areaTexture=R(e.fbos.rctx,g.LINEAR,f.RGB,o.value),this._searchTexture=R(e.fbos.rctx,g.NEAREST,f.LUMINANCE,a.value),this._isEnabled=!0)}_disposeTextures(){this._areaTexture=t(this._areaTexture),this._searchTexture=t(this._searchTexture)}disable(){this._abortController=r(this._abortController),this._isEnabled=!1}destroy(){this.disable(),this._disposeTextures()}renderNode(e,t,r,s){const i=r?.composite?.colorTexture;if(!(this._isEnabled&&this._context&&r&&i))return s;if(!(this._edgeTechnique?.compiled&&this._blendTechnique?.compiled&&this._blurTechnique?.compiled))return this._context.requestRender(),s;const o=i.descriptor.width,a=i.descriptor.height,n=this._context.fbos,l=e.rctx;l.setViewport(0,0,o,a);const h=n.acquire(o,a,"smaa edges",u.RG);l.setClearColor(0,0,0,1),l.clear(q.COLOR_BUFFER_BIT),this._smaaParameters.color=i,l.bindTechnique(this._edgeTechnique,null,this._smaaParameters),l.screen.draw();const c=n.acquire(o,a,"smaa blend");return l.setClearColor(0,0,1,1),l.clear(q.COLOR_BUFFER_BIT),this._smaaParameters.inputTexture=h.colorTexture,this._smaaParameters.areaTexture=this._areaTexture,this._smaaParameters.searchTexture=this._searchTexture,l.bindTechnique(this._blendTechnique,null,this._smaaParameters),l.screen.draw(),l.bindFramebuffer(s?.fbo),h.release(),l.setClearColor(0,1,0,1),l.clear(q.COLOR_BUFFER_BIT),this._smaaParameters.inputTexture=c.colorTexture,l.bindTechnique(this._blurTechnique,null,this._smaaParameters),l.screen.draw(),c.release(),s}};function R(e,t,r,s){const i=new j;return i.pixelFormat=r,i.wrapMode=C.CLAMP_TO_EDGE,i.width=s.width,i.height=s.height,i.samplingMode=t,new w(e,i,s)}e([n()],A.prototype,"view",void 0),e([n()],A.prototype,"_context",void 0),e([n()],A.prototype,"_abortController",void 0),e([n({readOnly:!0})],A.prototype,"updating",null),A=e([l("esri.views.3d.webgl-engine.effects.smaa.SMAA")],A);export{A as SMAA};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../../chunks/tslib.es6.js";import{disposeMaybe as t}from"../../../../../core/maybe.js";import{watch as r,syncAndInitial as s}from"../../../../../core/reactiveUtils.js";import{Milliseconds as i}from"../../../../../core/time.js";import{property as o}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as a}from"../../../../../core/accessorSupport/decorators/subclass.js";import{set as n}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{ColorFormat as c}from"../../core/FBOCache.js";import{SyncRenderPlugin as l,ConsumesDepthNormal as m,ConsumesNone as u}from"../RenderPlugin.js";import{SSAOBlurTechnique as h}from"./SSAOBlurTechnique.js";import{noiseData as p}from"./SSAONoiseData.js";import{SSAOPassParameters as _,BlurDrawParameters as d}from"./SSAOParameters.js";import{SSAOTechnique as b}from"./SSAOTechnique.js";import{RenderFeature as f}from"../../lib/RenderFeature.js";import{RenderSlot as x}from"../../lib/RenderSlot.js";import{g as T}from"../../../../../chunks/SSAO.glsl.js";import{TextureWrapMode as w,PixelFormat as S,ClearBufferBit as P}from"../../../../webgl/enums.js";import{Texture as q}from"../../../../webgl/Texture.js";import{TextureDescriptor as j}from"../../../../webgl/TextureDescriptor.js";const R=2;let g=class extends l{constructor(e){super(e),this._context=null,this._passParameters=new _,this._drawParameters=new d,this.produces=new Map([[x.SSAO,()=>this._produces()]])}_produces(){return null!=this._enableTime&&null!=this._context}consumes(){return this._produces()?m:u}initializeRenderContext(e){this._context=e,this.addHandles([r((()=>this.view.qualitySettings.ambientOcclusion||this._context?.isFeatureEnabled(f.SSAO)),(e=>e?this._enable():this._disable()),s)])}uninitializeRenderContext(){this._disable(),this._context=null}_disable(){this._passParameters.noiseTexture=t(this._passParameters.noiseTexture),this._enableTime=null}destroy(){this._disable()}_enable(){if(null!=this._enableTime||!this._context)return;const e=Uint8Array.from(atob(p),(e=>e.charCodeAt(0))),t=new j;t.wrapMode=w.CLAMP_TO_EDGE,t.pixelFormat=S.RGB,t.wrapMode=w.REPEAT,t.hasMipmap=!0,t.width=32,t.height=32,this._passParameters.noiseTexture=new q(this._context.renderContext.rctx,t,e),null==this._ssaoTechnique&&(this._ssaoTechnique=this._context.techniqueRepository.acquire(b)),null==this._blurTechnique&&(this._blurTechnique=this._context.techniqueRepository.acquire(h)),this._enableTime=i(0),this._context?.requestRender()}renderNode(e,t,r){const s=e.bindParameters,i=s.linearDepth?.colorTexture,o=r?.normals?.colorTexture;if(null==this._enableTime||null==this._context||null==i||!o)return;if(!this._ssaoTechnique.compiled||!this._blurTechnique.compiled)return this._enableTime=e.time,void this._context.requestRender();0===this._enableTime&&(this._enableTime=e.time);const a=e.rctx,l=s.camera,m=this.view.qualitySettings.fadeDuration,u=m>0?Math.min(m,e.time-this._enableTime)/m:1;this._passParameters.normalTexture=o,this._passParameters.depthTexture=i,this._passParameters.projScale=1/l.computeScreenPixelSizeAtDist(1),this._passParameters.intensity=4*O/T(l)**6*u;const h=l.fullViewport[2],p=l.fullViewport[3],_=Math.round(h/R),d=Math.round(p/R),b=this._context.fbos,f=b.acquire(c.RG,h,p,"ssao input");a.bindFramebuffer(f.fbo),a.setViewport(0,0,h,p),a.bindTechnique(this._ssaoTechnique,s,this._passParameters,this._drawParameters),a.screen.draw(),a.setViewport(0,0,_,d);const x=b.acquire(c.RED,_,d,"ssao blur");a.bindFramebuffer(x.fbo),this._drawParameters.colorTexture=f.colorTexture,n(this._drawParameters.blurSize,0,R/p);const w=a.bindTechnique(this._blurTechnique,s,this._passParameters,this._drawParameters);a.setViewport(0,0,_,d),a.screen.draw(),f.release();const S=b.acquire(c.RED,_,d,"ssao");return a.bindFramebuffer(S.fbo),a.setViewport(0,0,h,p),a.setClearColor(1,1,1,0),a.clear(P.COLOR_BUFFER_BIT),a.setViewport(0,0,_,d),this._drawParameters.colorTexture=x.colorTexture,n(this._drawParameters.blurSize,R/h,0),w.bindDraw(this._drawParameters,s,this._passParameters),a.screen.draw(),a.setViewport4fv(l.fullViewport),x.release(),u<1&&this._context.requestRender(),S}};e([o({constructOnly:!0})],g.prototype,"view",void 0),e([o()],g.prototype,"_context",void 0),g=e([a("esri.views.3d.webgl-engine.effects.ssao.SSAO")],g);const O=.5;export{g as SSAO,R as blurSizePixels};
5
+ import{_ as e}from"../../../../../chunks/tslib.es6.js";import{disposeMaybe as t}from"../../../../../core/maybe.js";import{watch as r,syncAndInitial as s}from"../../../../../core/reactiveUtils.js";import{Milliseconds as i}from"../../../../../core/time.js";import{property as o}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as a}from"../../../../../core/accessorSupport/decorators/subclass.js";import{set as n}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{ColorFormat as c}from"../../core/FBOCache.js";import{SyncRenderPlugin as l,ConsumesDepthNormal as m,ConsumesNone as u}from"../RenderPlugin.js";import{SSAOBlurTechnique as h}from"./SSAOBlurTechnique.js";import{noiseData as p}from"./SSAONoiseData.js";import{SSAOPassParameters as _,BlurDrawParameters as d}from"./SSAOParameters.js";import{SSAOTechnique as b}from"./SSAOTechnique.js";import{RenderFeature as x}from"../../lib/RenderFeature.js";import{RenderSlot as T}from"../../lib/RenderSlot.js";import{g as w}from"../../../../../chunks/SSAO.glsl.js";import{TextureWrapMode as f,PixelFormat as S,ClearBufferBit as P}from"../../../../webgl/enums.js";import{Texture as q}from"../../../../webgl/Texture.js";import{TextureDescriptor as j}from"../../../../webgl/TextureDescriptor.js";const R=2;let g=class extends l{constructor(e){super(e),this._context=null,this._passParameters=new _,this._drawParameters=new d,this.produces=new Map([[T.SSAO,()=>this._produces()]])}_produces(){return null!=this._enableTime&&null!=this._context}consumes(){return this._produces()?m:u}initializeRenderContext(e){this._context=e,this.addHandles([r((()=>this.view.qualitySettings.ambientOcclusion||this._context?.isFeatureEnabled(x.SSAO)),(e=>e?this._enable():this._disable()),s)])}uninitializeRenderContext(){this._disable(),this._context=null}_disable(){this._passParameters.noiseTexture=t(this._passParameters.noiseTexture),this._enableTime=null}destroy(){this._disable()}_enable(){if(null!=this._enableTime||!this._context)return;const e=Uint8Array.from(atob(p),(e=>e.charCodeAt(0))),t=new j;t.wrapMode=f.CLAMP_TO_EDGE,t.pixelFormat=S.RGB,t.wrapMode=f.REPEAT,t.hasMipmap=!0,t.width=32,t.height=32,this._passParameters.noiseTexture=new q(this._context.renderContext.rctx,t,e),null==this._ssaoTechnique&&(this._ssaoTechnique=this._context.techniqueRepository.acquire(b)),null==this._blurTechnique&&(this._blurTechnique=this._context.techniqueRepository.acquire(h)),this._enableTime=i(0),this._context?.requestRender()}renderNode(e,t,r){const s=e.bindParameters,i=s.linearDepth?.colorTexture,o=r?.normals?.colorTexture;if(null==this._enableTime||null==this._context||null==i||!o)return;if(!this._ssaoTechnique.compiled||!this._blurTechnique.compiled)return this._enableTime=e.time,void this._context.requestRender();0===this._enableTime&&(this._enableTime=e.time);const a=e.rctx,l=s.camera,m=this.view.qualitySettings.fadeDuration,u=m>0?Math.min(m,e.time-this._enableTime)/m:1;this._passParameters.normalTexture=o,this._passParameters.depthTexture=i,this._passParameters.projScale=1/l.computeScreenPixelSizeAtDist(1),this._passParameters.intensity=4*O/w(l)**6*u;const h=l.fullViewport[2],p=l.fullViewport[3],_=Math.round(h/R),d=Math.round(p/R),b=this._context.fbos,x=b.acquire(h,p,"ssao input",c.RG);a.setViewport(0,0,h,p),a.bindTechnique(this._ssaoTechnique,s,this._passParameters,this._drawParameters),a.screen.draw(),a.setViewport(0,0,_,d);const T=b.acquire(_,d,"ssao blur",c.RED);this._drawParameters.colorTexture=x.colorTexture,n(this._drawParameters.blurSize,0,R/p);const f=a.bindTechnique(this._blurTechnique,s,this._passParameters,this._drawParameters);a.setViewport(0,0,_,d),a.screen.draw(),x.release();const S=b.acquire(_,d,"ssao",c.RED);return a.setViewport(0,0,h,p),a.setClearColor(1,1,1,0),a.clear(P.COLOR_BUFFER_BIT),a.setViewport(0,0,_,d),this._drawParameters.colorTexture=T.colorTexture,n(this._drawParameters.blurSize,R/h,0),f.bindDraw(this._drawParameters,s,this._passParameters),a.screen.draw(),a.setViewport4fv(l.fullViewport),T.release(),u<1&&this._context.requestRender(),S}};e([o({constructOnly:!0})],g.prototype,"view",void 0),e([o()],g.prototype,"_context",void 0),g=e([a("esri.views.3d.webgl-engine.effects.ssao.SSAO")],g);const O=.5;export{g as SSAO,R as blurSizePixels};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../../../chunks/tslib.es6.js";import i from"../../../../core/Accessor.js";import e from"../../../../core/Logger.js";import{lerp as r}from"../../../../core/mathUtils.js";import{createScreenPointArray as s,createRenderScreenPointArray3 as o}from"../../../../core/screenUtils.js";import{property as n}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/RandomLCG.js";import{subclass as h}from"../../../../core/accessorSupport/decorators/subclass.js";import{copy as a,multiply as p,frustum as u,equals as _,invert as l,transpose as c,lookAt as v}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as w}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{copy as d,exactEquals as y}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as g}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{f as m,s as f,k as x,c as M,h as T,x as D,j,F as R,w as P,i as F,l as O,b as V,n as C,B as b}from"../../../../chunks/vec32.js";import{create as S}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{b as I,e as E,a as L,c as H,d as B,t as G}from"../../../../chunks/vec42.js";import{fromValues as A,create as k}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{create as U,copy as z,fromMatrix as W}from"../../../../geometry/support/frustum.js";import{create as X}from"../../../../geometry/support/ray.js";import{projectPointSignedLength as Y}from"../../../../geometry/support/vector.js";import{ViewingMode as q}from"../../../ViewingMode.js";import{fovd2fovx as N,fovx2fovd as J,fovd2fovy as K,fovy2fovd as Q}from"./fov.js";var Z;let $=Z=class extends i{constructor(t){super(t),this._ray=X(),this._viewport=A(0,0,1,1),this._padding=A(0,0,0,0),this._fov=55/180*Math.PI,this._nearFar=g(1,1e3),this._viewDirty=!0,this._viewMatrix=w(),this._viewProjectionDirty=!0,this._viewProjectionMatrix=w(),this._viewInverseTransposeMatrixDirty=!0,this._viewInverseTransposeMatrix=w(),this._frustumDirty=!0,this._frustum=U(),this._fullViewport=k(),this._pixelRatio=1,this.row=0,this.column=0,this._rows=1,this._columns=1,this._center=S(),this._up=S(),this.relativeElevation=0}get pixelRatio(){return this._pixelRatio}set pixelRatio(t){this._pixelRatio=t>0?t:1}get rows(){return this._rows}set rows(t){this._rows=Math.max(1,t)}get columns(){return this._columns}set columns(t){this._columns=Math.max(1,t)}get eye(){return this._ray.origin}set eye(t){this._compareAndSetView(t,this._ray.origin)}get center(){return this._center}set center(t){this._compareAndSetView(t,this._center,"_center")}get ray(){return m(this._ray.direction,this.center,this.eye),this._ray}get up(){return this._up}set up(t){this._compareAndSetView(t,this._up,"_up")}get viewMatrix(){return this._ensureViewClean(),this._viewMatrix}set viewMatrix(t){a(this._viewMatrix,t),this.notifyChange("_viewMatrix"),this._viewDirty=!1,this._viewInverseTransposeMatrixDirty=!0,this._viewProjectionDirty=!0,this._frustumDirty=!0}get viewForward(){return this._ensureViewClean(),f(S(),-this._viewMatrix[2],-this._viewMatrix[6],-this._viewMatrix[10])}get viewUp(){return this._ensureViewClean(),f(S(),this._viewMatrix[1],this._viewMatrix[5],this._viewMatrix[9])}get viewRight(){return this._ensureViewClean(),f(S(),this._viewMatrix[0],this._viewMatrix[4],this._viewMatrix[8])}get nearFar(){return this._nearFar}get near(){return this._nearFar[0]}set near(t){this._nearFar[0]!==t&&(this._nearFar[0]=t,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_nearFar"))}get far(){return this._nearFar[1]}set far(t){this._nearFar[1]!==t&&(this._nearFar[1]=t,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_nearFar"))}get viewport(){return this._viewport}set viewport(t){this.x=t[0],this.y=t[1],this.width=t[2],this.height=t[3]}get screenViewport(){if(1===this.pixelRatio)return this._viewport;const t=I(k(),this._viewport,1/this.pixelRatio),i=this._get("screenViewport");return i&&E(t,i)?i:t}get screenPadding(){if(1===this.pixelRatio)return this._padding;const t=I(k(),this._padding,1/this.pixelRatio),i=this._get("screenPadding");return i&&E(t,i)?i:t}get x(){return this._viewport[0]}set x(t){t+=this._padding[ot.LEFT],this._viewport[0]!==t&&(this._viewport[0]=t,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_viewport"))}get y(){return this._viewport[1]}set y(t){t+=this._padding[ot.BOTTOM],this._viewport[1]!==t&&(this._viewport[1]=t,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_viewport"))}get width(){return this._viewport[2]}set width(t){this._viewport[2]!==t&&(this._viewport[2]=t,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_viewport"))}get height(){return this._viewport[3]}set height(t){this._viewport[3]!==t&&(this._viewport[3]=t,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_viewport"))}get fullWidth(){return this._viewport[2]+this._padding[ot.RIGHT]+this._padding[ot.LEFT]}set fullWidth(t){this.width=t-(this._padding[ot.RIGHT]+this._padding[ot.LEFT])}get fullHeight(){return this._viewport[3]+this._padding[ot.TOP]+this._padding[ot.BOTTOM]}set fullHeight(t){this.height=t-(this._padding[ot.TOP]+this._padding[ot.BOTTOM])}get fullViewport(){return this._fullViewport[0]=this._viewport[0]-this._padding[ot.LEFT],this._fullViewport[1]=this._viewport[1]-this._padding[ot.BOTTOM],this._fullViewport[2]=this.fullWidth,this._fullViewport[3]=this.fullHeight,this._fullViewport}get _aspect(){return this.width/this.height}get padding(){return this._padding}set padding(t){L(this._padding,t)||(this._viewport[0]+=t[ot.LEFT]-this._padding[ot.LEFT],this._viewport[1]+=t[ot.BOTTOM]-this._padding[ot.BOTTOM],this._viewport[2]-=t[ot.RIGHT]+t[ot.LEFT]-(this._padding[ot.RIGHT]+this._padding[ot.LEFT]),this._viewport[3]-=t[ot.TOP]+t[ot.BOTTOM]-(this._padding[ot.TOP]+this._padding[ot.BOTTOM]),H(this._padding,t),this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_padding"),this.notifyChange("_viewport"))}get viewProjectionMatrix(){return this._viewProjectionDirty&&(p(this._viewProjectionMatrix,this.projectionMatrix,this.viewMatrix),this._viewProjectionDirty=!1),this._viewProjectionMatrix}get projectionMatrix(){const t=this.width,i=this.height,e=this.near*Math.tan(this.fovY/2)*2,r=e*this._aspect,s=e/this.rows,o=r/this.columns,n=-r/2+this.column*o,h=n+o,a=-e/2+this.row*s,p=a+s,l=u(w(),n*(1+2*this._padding[ot.LEFT]/t),h*(1+2*this._padding[ot.RIGHT]/t),a*(1+2*this._padding[ot.BOTTOM]/i),p*(1+2*this._padding[ot.TOP]/i),this.near,this.far),c=this._get("projectionMatrix");return c&&_(c,l)?c:l}get inverseProjectionMatrix(){return l(w(),this.projectionMatrix)||this._get("inverseProjectionMatrix")||w()}get fov(){return this._fov}set fov(t){this._fov=t,this._viewProjectionDirty=!0,this._frustumDirty=!0}get fovX(){return N(this._fov,this.width,this.height)}set fovX(t){this._fov=J(t,this.width,this.height),this._viewProjectionDirty=!0,this._frustumDirty=!0}get fovY(){return K(this._fov,this.width,this.height)}set fovY(t){this._fov=Q(t,this.width,this.height),this._viewProjectionDirty=!0,this._frustumDirty=!0}get distance(){return x(this.center,this.eye)}get frustum(){return this._recomputeFrustum(),this._frustum}get viewInverseTransposeMatrix(){return(this._viewInverseTransposeMatrixDirty||this._viewDirty)&&(l(this._viewInverseTransposeMatrix,this.viewMatrix),c(this._viewInverseTransposeMatrix,this._viewInverseTransposeMatrix),this._viewInverseTransposeMatrixDirty=!1),this._viewInverseTransposeMatrix}depthNDCToWorld(t){const i=2*t-1;return 2*this.near*this.far/(this.far+this.near-i*(this.far-this.near))}get perRenderPixelRatio(){return Math.tan(this.fovX/2)/(this.width/2)}get perScreenPixelRatio(){return this.perRenderPixelRatio*this.pixelRatio}get aboveGround(){return null!=this.relativeElevation&&this.relativeElevation>=0}copyFrom(t){M(this._ray.origin,t.eye),this.center=t.center,this.up=t.up,H(this._viewport,t.viewport),this.notifyChange("_viewport"),H(this._padding,t.padding),this.notifyChange("_padding"),d(this._nearFar,t.nearFar),this.notifyChange("_nearFar"),this._fov=t.fov,this.row=t.row,this.column=t.column,this.rows=t.rows,this.columns=t.columns,this.relativeElevation=t.relativeElevation;const i=t;return this._viewDirty=i._viewDirty,this._viewDirty||(a(this._viewMatrix,t.viewMatrix),this.notifyChange("_viewMatrix")),this._viewProjectionDirty=!0,this._frustumDirty=i._frustumDirty,this._frustumDirty||(z(this._frustum,t.frustum),this._frustumDirty=!1),i._viewInverseTransposeMatrixDirty?this._viewInverseTransposeMatrixDirty=!0:(a(this._viewInverseTransposeMatrix,t.viewInverseTransposeMatrix),this._viewInverseTransposeMatrixDirty=!1),H(this._fullViewport,t.fullViewport),this.pixelRatio=t.pixelRatio,this}copyViewFrom(t){this.eye=t.eye,this.center=t.center,this.up=t.up}clone(){return(new Z).copyFrom(this)}equals(t){return T(this.eye,t.eye)&&T(this.center,t.center)&&T(this.up,t.up)&&L(this._viewport,t.viewport)&&L(this._padding,t.padding)&&y(this.nearFar,t.nearFar)&&this._fov===t.fov&&this.pixelRatio===t.pixelRatio&&this.relativeElevation===t.relativeElevation&&this.row===t.row&&this.column===t.column&&this.rows===t.rows&&this.columns===t.columns}almostEquals(t){const i=Math.max(1,1/this.pixelRatio,1/t.pixelRatio);if(Math.abs(t.fov-this._fov)>=.001||B(t.screenPadding,this.screenPadding)>=i||B(this.screenViewport,t.screenViewport)>=i||this.row!==t.row||this.column!==t.column||this.rows!==t.rows||this.columns!==t.columns)return!1;D(et,t.eye,t.center),D(rt,this.eye,this.center);const e=j(et,rt),r=R(et),s=R(rt),o=5e-4;return e*e>=(1-1e-10)*r*s&&P(t.eye,this.eye)<Math.max(r,s)*o*o}computeRenderPixelSizeAt(t){return this.computeRenderPixelSizeAtDist(this._viewDirectionDistance(t))}computeRenderPixelSizeAtDist(t){return t*this.perRenderPixelRatio}computeScreenPixelSizeAt(t){return this.computeScreenPixelSizeAtDist(this._viewDirectionDistance(t))}_viewDirectionDistance(t){return Math.abs(Y(this.viewForward,m(et,t,this.eye)))}computeScreenPixelSizeAtDist(t){return t*this.perScreenPixelRatio}computeDistanceFromRadius(t,i){return t/Math.tan(Math.min(this.fovX,this.fovY)/(2*(i||1)))}getScreenCenter(t=s()){return t[0]=(this.padding[ot.LEFT]+this.width/2)/this.pixelRatio,t[1]=(this.padding[ot.TOP]+this.height/2)/this.pixelRatio,t}getRenderCenter(t,i=.5,e=.5){return t[0]=this.padding[ot.LEFT]+this.width*i,t[1]=this.padding[ot.BOTTOM]+this.height*e,t[2]=.5,t}setGLViewport(t){const i=this.viewport,e=this.padding;t.setViewport(i[0]-e[3],i[1]-e[2],i[2]+e[1]+e[3],i[3]+e[0]+e[2])}applyProjection(t,i){t!==tt&&M(tt,t),tt[3]=1,G(tt,tt,this.projectionMatrix);const e=Math.abs(tt[3]);F(tt,tt,1/e);const s=this.fullViewport;i[0]=r(0,s[0]+s[2],.5+.5*tt[0]),i[1]=r(0,s[1]+s[3],.5+.5*tt[1]),i[2]=.5*(tt[2]+1),i[3]=e}unapplyProjection(t,i){const e=this.fullViewport;tt[0]=(t[0]/(e[0]+e[2])*2-1)*t[3],tt[1]=(t[1]/(e[1]+e[3])*2-1)*t[3],tt[2]=(2*t[2]-1)*t[3],tt[3]=t[3],null!=this.inverseProjectionMatrix&&(G(tt,tt,this.inverseProjectionMatrix),i[0]=tt[0],i[1]=tt[1],i[2]=tt[2])}projectToScreen(t,i){return this.projectToRenderScreen(t,st),this.renderToScreen(st,i),i}projectToRenderScreen(t,i){if(tt[0]=t[0],tt[1]=t[1],tt[2]=t[2],tt[3]=1,G(tt,tt,this.viewProjectionMatrix),0===tt[3])return null;const e=tt;F(e,e,1/Math.abs(tt[3]));const s=this.fullViewport,o=r(0,s[0]+s[2],.5+.5*e[0]),n=r(0,s[1]+s[3],.5+.5*e[1]);return"x"in i?(i.x=o,i.y=n):(i[0]=o,i[1]=n,i.length>2&&(i[2]=.5*(e[2]+1))),i}unprojectFromScreen(t,i){return this.unprojectFromRenderScreen(this.screenToRender(t,st),i)}unprojectFromRenderScreen(t,i){if(p(it,this.projectionMatrix,this.viewMatrix),!l(it,it))return null;const e=this.fullViewport;return tt[0]=2*(t[0]-e[0])/e[2]-1,tt[1]=2*(t[1]-e[1])/e[3]-1,tt[2]=2*t[2]-1,tt[3]=1,G(tt,tt,it),0===tt[3]?null:(i[0]=tt[0]/tt[3],i[1]=tt[1]/tt[3],i[2]=tt[2]/tt[3],i)}constrainWindowSize(t,i,e,r){const s=t*this.pixelRatio,o=i*this.pixelRatio,n=Math.max(s-e/2,0),h=Math.max(this.fullHeight-o-r/2,0),a=-Math.min(s-e/2,0),p=-Math.min(this.fullHeight-o-r/2,0),u=e-a- -Math.min(this.fullWidth-s-e/2,0),_=r-p- -Math.min(o-r/2,0);return[Math.round(n),Math.round(h),Math.round(u),Math.round(_)]}computeUp(t){t===q.Global?this._computeUpGlobal():this._computeUpLocal()}screenToRender(t,i){const e=t[0]*this.pixelRatio,r=this.fullHeight-t[1]*this.pixelRatio;return i[0]=e,i[1]=r,i}renderToScreen(t,i){const e=t[0]/this.pixelRatio,r=(this.fullHeight-t[1])/this.pixelRatio;i[0]=e,i[1]=r}_computeUpGlobal(){m(et,this.center,this.eye);const t=O(this.center);t<1?(f(this._up,0,0,1),this._markViewDirty(),this.notifyChange("_up")):Math.abs(j(et,this.center))>.9999*O(et)*t||(V(this._up,et,this.center),V(this._up,this._up,et),C(this._up,this._up),this.notifyChange("_up"),this._markViewDirty())}_computeUpLocal(){b(et,this.eye,this.center),Math.abs(et[2])<=.9999&&(F(et,et,et[2]),f(this._up,-et[0],-et[1],1-et[2]),C(this._up,this._up),this.notifyChange("_up"),this._markViewDirty())}_compareAndSetView(t,i,r=""){"number"==typeof t[0]&&isFinite(t[0])&&"number"==typeof t[1]&&isFinite(t[1])&&"number"==typeof t[2]&&isFinite(t[2])?T(t,i)||(M(i,t),this._markViewDirty(),r.length&&this.notifyChange(r)):e.getLogger("esri.views.3d.webgl-engine.lib.Camera").warn("Camera vector contains invalid number, ignoring value")}_markViewDirty(){this._viewDirty=!0,this._frustumDirty=!0,this._viewProjectionDirty=!0}_recomputeFrustum(){this._frustumDirty&&(W(this.viewMatrix,this.projectionMatrix,this._frustum),this._frustumDirty=!1)}_ensureViewClean(){this._viewDirty&&(v(this._viewMatrix,this.eye,this.center,this.up),this.notifyChange("_viewMatrix"),this._viewDirty=!1,this._viewInverseTransposeMatrixDirty=!0)}};t([n()],$.prototype,"_viewport",void 0),t([n()],$.prototype,"_padding",void 0),t([n()],$.prototype,"_fov",void 0),t([n()],$.prototype,"_nearFar",void 0),t([n()],$.prototype,"_viewDirty",void 0),t([n()],$.prototype,"_viewMatrix",void 0),t([n()],$.prototype,"_pixelRatio",void 0),t([n()],$.prototype,"pixelRatio",null),t([n()],$.prototype,"row",void 0),t([n()],$.prototype,"column",void 0),t([n()],$.prototype,"_rows",void 0),t([n()],$.prototype,"rows",null),t([n()],$.prototype,"_columns",void 0),t([n()],$.prototype,"columns",null),t([n()],$.prototype,"eye",null),t([n()],$.prototype,"center",null),t([n()],$.prototype,"_center",void 0),t([n()],$.prototype,"up",null),t([n()],$.prototype,"_up",void 0),t([n({readOnly:!0})],$.prototype,"viewForward",null),t([n({readOnly:!0})],$.prototype,"viewUp",null),t([n({readOnly:!0})],$.prototype,"viewRight",null),t([n({readOnly:!0})],$.prototype,"nearFar",null),t([n()],$.prototype,"near",null),t([n()],$.prototype,"far",null),t([n()],$.prototype,"viewport",null),t([n({readOnly:!0})],$.prototype,"screenViewport",null),t([n({readOnly:!0})],$.prototype,"screenPadding",null),t([n()],$.prototype,"x",null),t([n()],$.prototype,"y",null),t([n()],$.prototype,"width",null),t([n()],$.prototype,"height",null),t([n()],$.prototype,"fullWidth",null),t([n()],$.prototype,"fullHeight",null),t([n({readOnly:!0})],$.prototype,"_aspect",null),t([n()],$.prototype,"padding",null),t([n({readOnly:!0})],$.prototype,"projectionMatrix",null),t([n({readOnly:!0})],$.prototype,"inverseProjectionMatrix",null),t([n()],$.prototype,"fov",null),t([n()],$.prototype,"fovX",null),t([n()],$.prototype,"fovY",null),$=Z=t([h("esri.views.3d.webgl-engine.lib.Camera")],$);const tt=k(),it=w(),et=S(),rt=S(),st=o();var ot;!function(t){t[t.TOP=0]="TOP",t[t.RIGHT=1]="RIGHT",t[t.BOTTOM=2]="BOTTOM",t[t.LEFT=3]="LEFT"}(ot||(ot={}));export{$ as Camera,ot as PaddingSide};
5
+ import{_ as t}from"../../../../chunks/tslib.es6.js";import i from"../../../../core/Accessor.js";import e from"../../../../core/Logger.js";import{lerp as r}from"../../../../core/mathUtils.js";import{createScreenPointArray as s,createRenderScreenPointArray3 as o}from"../../../../core/screenUtils.js";import{property as n}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/RandomLCG.js";import{subclass as h}from"../../../../core/accessorSupport/decorators/subclass.js";import{copy as a,multiply as p,frustum as u,equals as _,invert as l,transpose as c,lookAt as v}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as w}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{copy as d,exactEquals as y}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as g}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{f as m,s as f,k as x,c as M,h as T,x as D,j,F as R,v as P,i as F,l as O,b as V,n as C,B as b}from"../../../../chunks/vec32.js";import{create as S}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{b as I,e as E,a as L,c as H,d as B,t as G}from"../../../../chunks/vec42.js";import{fromValues as A,create as k}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{create as U,copy as z,fromMatrix as W}from"../../../../geometry/support/frustum.js";import{create as X}from"../../../../geometry/support/ray.js";import{projectPointSignedLength as Y}from"../../../../geometry/support/vector.js";import{ViewingMode as q}from"../../../ViewingMode.js";import{fovd2fovx as N,fovx2fovd as J,fovd2fovy as K,fovy2fovd as Q}from"./fov.js";var Z;let $=Z=class extends i{constructor(t){super(t),this._ray=X(),this._viewport=A(0,0,1,1),this._padding=A(0,0,0,0),this._fov=55/180*Math.PI,this._nearFar=g(1,1e3),this._viewDirty=!0,this._viewMatrix=w(),this._viewProjectionDirty=!0,this._viewProjectionMatrix=w(),this._viewInverseTransposeMatrixDirty=!0,this._viewInverseTransposeMatrix=w(),this._frustumDirty=!0,this._frustum=U(),this._fullViewport=k(),this._pixelRatio=1,this.row=0,this.column=0,this._rows=1,this._columns=1,this._center=S(),this._up=S(),this.relativeElevation=0}get pixelRatio(){return this._pixelRatio}set pixelRatio(t){this._pixelRatio=t>0?t:1}get rows(){return this._rows}set rows(t){this._rows=Math.max(1,t)}get columns(){return this._columns}set columns(t){this._columns=Math.max(1,t)}get eye(){return this._ray.origin}set eye(t){this._compareAndSetView(t,this._ray.origin)}get center(){return this._center}set center(t){this._compareAndSetView(t,this._center,"_center")}get ray(){return m(this._ray.direction,this.center,this.eye),this._ray}get up(){return this._up}set up(t){this._compareAndSetView(t,this._up,"_up")}get viewMatrix(){return this._ensureViewClean(),this._viewMatrix}set viewMatrix(t){a(this._viewMatrix,t),this.notifyChange("_viewMatrix"),this._viewDirty=!1,this._viewInverseTransposeMatrixDirty=!0,this._viewProjectionDirty=!0,this._frustumDirty=!0}get viewForward(){return this._ensureViewClean(),f(S(),-this._viewMatrix[2],-this._viewMatrix[6],-this._viewMatrix[10])}get viewUp(){return this._ensureViewClean(),f(S(),this._viewMatrix[1],this._viewMatrix[5],this._viewMatrix[9])}get viewRight(){return this._ensureViewClean(),f(S(),this._viewMatrix[0],this._viewMatrix[4],this._viewMatrix[8])}get nearFar(){return this._nearFar}get near(){return this._nearFar[0]}set near(t){this._nearFar[0]!==t&&(this._nearFar[0]=t,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_nearFar"))}get far(){return this._nearFar[1]}set far(t){this._nearFar[1]!==t&&(this._nearFar[1]=t,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_nearFar"))}get viewport(){return this._viewport}set viewport(t){this.x=t[0],this.y=t[1],this.width=t[2],this.height=t[3]}get screenViewport(){if(1===this.pixelRatio)return this._viewport;const t=I(k(),this._viewport,1/this.pixelRatio),i=this._get("screenViewport");return i&&E(t,i)?i:t}get screenPadding(){if(1===this.pixelRatio)return this._padding;const t=I(k(),this._padding,1/this.pixelRatio),i=this._get("screenPadding");return i&&E(t,i)?i:t}get x(){return this._viewport[0]}set x(t){t+=this._padding[ot.LEFT],this._viewport[0]!==t&&(this._viewport[0]=t,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_viewport"))}get y(){return this._viewport[1]}set y(t){t+=this._padding[ot.BOTTOM],this._viewport[1]!==t&&(this._viewport[1]=t,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_viewport"))}get width(){return this._viewport[2]}set width(t){this._viewport[2]!==t&&(this._viewport[2]=t,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_viewport"))}get height(){return this._viewport[3]}set height(t){this._viewport[3]!==t&&(this._viewport[3]=t,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_viewport"))}get fullWidth(){return this._viewport[2]+this._padding[ot.RIGHT]+this._padding[ot.LEFT]}set fullWidth(t){this.width=t-(this._padding[ot.RIGHT]+this._padding[ot.LEFT])}get fullHeight(){return this._viewport[3]+this._padding[ot.TOP]+this._padding[ot.BOTTOM]}set fullHeight(t){this.height=t-(this._padding[ot.TOP]+this._padding[ot.BOTTOM])}get fullViewport(){return this._fullViewport[0]=this._viewport[0]-this._padding[ot.LEFT],this._fullViewport[1]=this._viewport[1]-this._padding[ot.BOTTOM],this._fullViewport[2]=this.fullWidth,this._fullViewport[3]=this.fullHeight,this._fullViewport}get _aspect(){return this.width/this.height}get padding(){return this._padding}set padding(t){L(this._padding,t)||(this._viewport[0]+=t[ot.LEFT]-this._padding[ot.LEFT],this._viewport[1]+=t[ot.BOTTOM]-this._padding[ot.BOTTOM],this._viewport[2]-=t[ot.RIGHT]+t[ot.LEFT]-(this._padding[ot.RIGHT]+this._padding[ot.LEFT]),this._viewport[3]-=t[ot.TOP]+t[ot.BOTTOM]-(this._padding[ot.TOP]+this._padding[ot.BOTTOM]),H(this._padding,t),this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_padding"),this.notifyChange("_viewport"))}get viewProjectionMatrix(){return this._viewProjectionDirty&&(p(this._viewProjectionMatrix,this.projectionMatrix,this.viewMatrix),this._viewProjectionDirty=!1),this._viewProjectionMatrix}get projectionMatrix(){const t=this.width,i=this.height,e=this.near*Math.tan(this.fovY/2)*2,r=e*this._aspect,s=e/this.rows,o=r/this.columns,n=-r/2+this.column*o,h=n+o,a=-e/2+this.row*s,p=a+s,l=u(w(),n*(1+2*this._padding[ot.LEFT]/t),h*(1+2*this._padding[ot.RIGHT]/t),a*(1+2*this._padding[ot.BOTTOM]/i),p*(1+2*this._padding[ot.TOP]/i),this.near,this.far),c=this._get("projectionMatrix");return c&&_(c,l)?c:l}get inverseProjectionMatrix(){return l(w(),this.projectionMatrix)||this._get("inverseProjectionMatrix")||w()}get fov(){return this._fov}set fov(t){this._fov=t,this._viewProjectionDirty=!0,this._frustumDirty=!0}get fovX(){return N(this._fov,this.width,this.height)}set fovX(t){this._fov=J(t,this.width,this.height),this._viewProjectionDirty=!0,this._frustumDirty=!0}get fovY(){return K(this._fov,this.width,this.height)}set fovY(t){this._fov=Q(t,this.width,this.height),this._viewProjectionDirty=!0,this._frustumDirty=!0}get distance(){return x(this.center,this.eye)}get frustum(){return this._recomputeFrustum(),this._frustum}get viewInverseTransposeMatrix(){return(this._viewInverseTransposeMatrixDirty||this._viewDirty)&&(l(this._viewInverseTransposeMatrix,this.viewMatrix),c(this._viewInverseTransposeMatrix,this._viewInverseTransposeMatrix),this._viewInverseTransposeMatrixDirty=!1),this._viewInverseTransposeMatrix}depthNDCToWorld(t){const i=2*t-1;return 2*this.near*this.far/(this.far+this.near-i*(this.far-this.near))}get perRenderPixelRatio(){return Math.tan(this.fovX/2)/(this.width/2)}get perScreenPixelRatio(){return this.perRenderPixelRatio*this.pixelRatio}get aboveGround(){return null!=this.relativeElevation&&this.relativeElevation>=0}copyFrom(t){M(this._ray.origin,t.eye),this.center=t.center,this.up=t.up,H(this._viewport,t.viewport),this.notifyChange("_viewport"),H(this._padding,t.padding),this.notifyChange("_padding"),d(this._nearFar,t.nearFar),this.notifyChange("_nearFar"),this._fov=t.fov,this.row=t.row,this.column=t.column,this.rows=t.rows,this.columns=t.columns,this.relativeElevation=t.relativeElevation;const i=t;return this._viewDirty=i._viewDirty,this._viewDirty||(a(this._viewMatrix,t.viewMatrix),this.notifyChange("_viewMatrix")),this._viewProjectionDirty=!0,this._frustumDirty=i._frustumDirty,this._frustumDirty||(z(this._frustum,t.frustum),this._frustumDirty=!1),i._viewInverseTransposeMatrixDirty?this._viewInverseTransposeMatrixDirty=!0:(a(this._viewInverseTransposeMatrix,t.viewInverseTransposeMatrix),this._viewInverseTransposeMatrixDirty=!1),H(this._fullViewport,t.fullViewport),this.pixelRatio=t.pixelRatio,this}copyViewFrom(t){this.eye=t.eye,this.center=t.center,this.up=t.up}clone(){return(new Z).copyFrom(this)}equals(t){return T(this.eye,t.eye)&&T(this.center,t.center)&&T(this.up,t.up)&&L(this._viewport,t.viewport)&&L(this._padding,t.padding)&&y(this.nearFar,t.nearFar)&&this._fov===t.fov&&this.pixelRatio===t.pixelRatio&&this.relativeElevation===t.relativeElevation&&this.row===t.row&&this.column===t.column&&this.rows===t.rows&&this.columns===t.columns}almostEquals(t){const i=Math.max(1,1/this.pixelRatio,1/t.pixelRatio);if(Math.abs(t.fov-this._fov)>=.001||B(t.screenPadding,this.screenPadding)>=i||B(this.screenViewport,t.screenViewport)>=i||this.row!==t.row||this.column!==t.column||this.rows!==t.rows||this.columns!==t.columns)return!1;D(et,t.eye,t.center),D(rt,this.eye,this.center);const e=j(et,rt),r=R(et),s=R(rt),o=5e-4;return e*e>=(1-1e-10)*r*s&&P(t.eye,this.eye)<Math.max(r,s)*o*o}computeRenderPixelSizeAt(t){return this.computeRenderPixelSizeAtDist(this._viewDirectionDistance(t))}computeRenderPixelSizeAtDist(t){return t*this.perRenderPixelRatio}computeScreenPixelSizeAt(t){return this.computeScreenPixelSizeAtDist(this._viewDirectionDistance(t))}_viewDirectionDistance(t){return Math.abs(Y(this.viewForward,m(et,t,this.eye)))}computeScreenPixelSizeAtDist(t){return t*this.perScreenPixelRatio}computeDistanceFromRadius(t,i){return t/Math.tan(Math.min(this.fovX,this.fovY)/(2*(i||1)))}getScreenCenter(t=s()){return t[0]=(this.padding[ot.LEFT]+this.width/2)/this.pixelRatio,t[1]=(this.padding[ot.TOP]+this.height/2)/this.pixelRatio,t}getRenderCenter(t,i=.5,e=.5){return t[0]=this.padding[ot.LEFT]+this.width*i,t[1]=this.padding[ot.BOTTOM]+this.height*e,t[2]=.5,t}setGLViewport(t){const i=this.viewport,e=this.padding;t.setViewport(i[0]-e[3],i[1]-e[2],i[2]+e[1]+e[3],i[3]+e[0]+e[2])}applyProjection(t,i){t!==tt&&M(tt,t),tt[3]=1,G(tt,tt,this.projectionMatrix);const e=Math.abs(tt[3]);F(tt,tt,1/e);const s=this.fullViewport;i[0]=r(0,s[0]+s[2],.5+.5*tt[0]),i[1]=r(0,s[1]+s[3],.5+.5*tt[1]),i[2]=.5*(tt[2]+1),i[3]=e}unapplyProjection(t,i){const e=this.fullViewport;tt[0]=(t[0]/(e[0]+e[2])*2-1)*t[3],tt[1]=(t[1]/(e[1]+e[3])*2-1)*t[3],tt[2]=(2*t[2]-1)*t[3],tt[3]=t[3],null!=this.inverseProjectionMatrix&&(G(tt,tt,this.inverseProjectionMatrix),i[0]=tt[0],i[1]=tt[1],i[2]=tt[2])}projectToScreen(t,i){return this.projectToRenderScreen(t,st),this.renderToScreen(st,i),i}projectToRenderScreen(t,i){if(tt[0]=t[0],tt[1]=t[1],tt[2]=t[2],tt[3]=1,G(tt,tt,this.viewProjectionMatrix),0===tt[3])return null;const e=tt;F(e,e,1/Math.abs(tt[3]));const s=this.fullViewport,o=r(0,s[0]+s[2],.5+.5*e[0]),n=r(0,s[1]+s[3],.5+.5*e[1]);return"x"in i?(i.x=o,i.y=n):(i[0]=o,i[1]=n,i.length>2&&(i[2]=.5*(e[2]+1))),i}unprojectFromScreen(t,i){return this.unprojectFromRenderScreen(this.screenToRender(t,st),i)}unprojectFromRenderScreen(t,i){if(p(it,this.projectionMatrix,this.viewMatrix),!l(it,it))return null;const e=this.fullViewport;return tt[0]=2*(t[0]-e[0])/e[2]-1,tt[1]=2*(t[1]-e[1])/e[3]-1,tt[2]=2*t[2]-1,tt[3]=1,G(tt,tt,it),0===tt[3]?null:(i[0]=tt[0]/tt[3],i[1]=tt[1]/tt[3],i[2]=tt[2]/tt[3],i)}constrainWindowSize(t,i,e,r){const s=t*this.pixelRatio,o=i*this.pixelRatio,n=Math.max(s-e/2,0),h=Math.max(this.fullHeight-o-r/2,0),a=-Math.min(s-e/2,0),p=-Math.min(this.fullHeight-o-r/2,0),u=e-a- -Math.min(this.fullWidth-s-e/2,0),_=r-p- -Math.min(o-r/2,0);return[Math.round(n),Math.round(h),Math.round(u),Math.round(_)]}computeUp(t){t===q.Global?this._computeUpGlobal():this._computeUpLocal()}screenToRender(t,i){const e=t[0]*this.pixelRatio,r=this.fullHeight-t[1]*this.pixelRatio;return i[0]=e,i[1]=r,i}renderToScreen(t,i){const e=t[0]/this.pixelRatio,r=(this.fullHeight-t[1])/this.pixelRatio;i[0]=e,i[1]=r}_computeUpGlobal(){m(et,this.center,this.eye);const t=O(this.center);t<1?(f(this._up,0,0,1),this._markViewDirty(),this.notifyChange("_up")):Math.abs(j(et,this.center))>.9999*O(et)*t||(V(this._up,et,this.center),V(this._up,this._up,et),C(this._up,this._up),this.notifyChange("_up"),this._markViewDirty())}_computeUpLocal(){b(et,this.eye,this.center),Math.abs(et[2])<=.9999&&(F(et,et,et[2]),f(this._up,-et[0],-et[1],1-et[2]),C(this._up,this._up),this.notifyChange("_up"),this._markViewDirty())}_compareAndSetView(t,i,r=""){"number"==typeof t[0]&&isFinite(t[0])&&"number"==typeof t[1]&&isFinite(t[1])&&"number"==typeof t[2]&&isFinite(t[2])?T(t,i)||(M(i,t),this._markViewDirty(),r.length&&this.notifyChange(r)):e.getLogger("esri.views.3d.webgl-engine.lib.Camera").warn("Camera vector contains invalid number, ignoring value")}_markViewDirty(){this._viewDirty=!0,this._frustumDirty=!0,this._viewProjectionDirty=!0}_recomputeFrustum(){this._frustumDirty&&(W(this.viewMatrix,this.projectionMatrix,this._frustum),this._frustumDirty=!1)}_ensureViewClean(){this._viewDirty&&(v(this._viewMatrix,this.eye,this.center,this.up),this.notifyChange("_viewMatrix"),this._viewDirty=!1,this._viewInverseTransposeMatrixDirty=!0)}};t([n()],$.prototype,"_viewport",void 0),t([n()],$.prototype,"_padding",void 0),t([n()],$.prototype,"_fov",void 0),t([n()],$.prototype,"_nearFar",void 0),t([n()],$.prototype,"_viewDirty",void 0),t([n()],$.prototype,"_viewMatrix",void 0),t([n()],$.prototype,"_pixelRatio",void 0),t([n()],$.prototype,"pixelRatio",null),t([n()],$.prototype,"row",void 0),t([n()],$.prototype,"column",void 0),t([n()],$.prototype,"_rows",void 0),t([n()],$.prototype,"rows",null),t([n()],$.prototype,"_columns",void 0),t([n()],$.prototype,"columns",null),t([n()],$.prototype,"eye",null),t([n()],$.prototype,"center",null),t([n()],$.prototype,"_center",void 0),t([n()],$.prototype,"up",null),t([n()],$.prototype,"_up",void 0),t([n({readOnly:!0})],$.prototype,"viewForward",null),t([n({readOnly:!0})],$.prototype,"viewUp",null),t([n({readOnly:!0})],$.prototype,"viewRight",null),t([n({readOnly:!0})],$.prototype,"nearFar",null),t([n()],$.prototype,"near",null),t([n()],$.prototype,"far",null),t([n()],$.prototype,"viewport",null),t([n({readOnly:!0})],$.prototype,"screenViewport",null),t([n({readOnly:!0})],$.prototype,"screenPadding",null),t([n()],$.prototype,"x",null),t([n()],$.prototype,"y",null),t([n()],$.prototype,"width",null),t([n()],$.prototype,"height",null),t([n()],$.prototype,"fullWidth",null),t([n()],$.prototype,"fullHeight",null),t([n({readOnly:!0})],$.prototype,"_aspect",null),t([n()],$.prototype,"padding",null),t([n({readOnly:!0})],$.prototype,"projectionMatrix",null),t([n({readOnly:!0})],$.prototype,"inverseProjectionMatrix",null),t([n()],$.prototype,"fov",null),t([n()],$.prototype,"fovX",null),t([n()],$.prototype,"fovY",null),$=Z=t([h("esri.views.3d.webgl-engine.lib.Camera")],$);const tt=k(),it=w(),et=S(),rt=S(),st=o();var ot;!function(t){t[t.TOP=0]="TOP",t[t.RIGHT=1]="RIGHT",t[t.BOTTOM=2]="BOTTOM",t[t.LEFT=3]="LEFT"}(ot||(ot={}));export{$ as Camera,ot as PaddingSide};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import"../../../../core/has.js";import{releaseMaybe as t}from"../../../../core/maybe.js";import{c as e}from"../../../../chunks/vec42.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{ColorFormat as r,DepthFormat as h}from"../core/FBOCache.js";import{TransparencyPassType as o}from"./TransparencyPassType.js";import{ClearBufferBit as s}from"../../../webgl/enums.js";import{ensureAttachmentMaxSize as c}from"../../../webgl/FramebufferObject.js";class a{constructor(t,e){this._fbos=t,this.compositingHelper=e,this._width=4,this._height=4,this._clearColor=i()}dispose(){this._color=t(this._color),this.releaseBuffers()}get framebuffer(){return this.color.detachDepth(),this.color.attachDepth(this.depth),this.color.fbo}get colorTexture(){return this.color.colorTexture}get depthTexture(){return this.depth.attachment}initializeFrame(t,i,r){this._fbos.interactive=!r;const h=this._fbos.rctx;this._width=t.fullWidth,this._height=t.fullHeight,c(this,h.parameters.maxTextureSize);const o=this._color;return this._color=null,this.releaseBuffers(),e(this._clearColor,i),o}releaseBuffers(){this._color?.detachDepth(),this._depth=t(this._depth)}renderHUDVisibility(t,e,i){return t?.fbo.width===this._width&&t?.fbo.height===this._height||(t?.release(),t=this._fbos.acquire(r.RGBA4,this._width,this._height,"hud visibility")),t.attachDepth(i||this.depth),this._fbos.rctx.bindFramebuffer(t.fbo),this.renderToFBO(e,l),t.detachDepth(),t}compositeToHUDVisibility(t,e){this._fbos.rctx.bindFramebuffer(t.hudVisibility?.fbo),this.compositingHelper.compositeHUD(t,e)}renderOITPass(t,e,i){let s,c;const{_width:a,_height:l}=this;switch(e){case o.Color:s=this._fbos.acquire(r.RGBA16F,a,l,i?"oit hud color":"oit color"),c=[0,0,0,0];break;case o.Alpha:s=this._fbos.acquire(r.R16F,a,l,i?"oit hud alpha":"oit alpha"),c=[1,1,1,1];break;case o.FrontFace:s=this._fbos.acquire(r.RGBA,a,l,i?"oit hud front":"oit front"),c=[0,0,0,0]}return i?(s.acquireDepth(h.DEPTH16_BUFFER),this._fbos.rctx.bindFramebuffer(s.fbo),this.renderToFBO(t,c,!0,!0),s.releaseDepth()):(s.attachDepth(this.depth),this._fbos.rctx.bindFramebuffer(s.fbo),this.renderToFBO(t,c),s.detachDepth()),s}compositeToFramebuffer(t,e,i,r){this.bindFbo(),this.compositingHelper.composite(t,e,i,r)}compositeTransparentOntoOpaque(t,e,i,r,h){h?(this._fbos.rctx.bindFramebuffer(h.fbo),this._fbos.rctx.setClearColor(0,0,0,1e-13),this._fbos.rctx.clearSafe(s.COLOR_BUFFER_BIT)):this.bindFbo(),this.compositingHelper.compositeOIT(t,e.colorTexture,i.colorTexture,r.colorTexture)}renderDepthDetached(t){this._bindTarget(this.color),t(),this._bindTarget(this.color,this.depth)}renderToCachedFBO(e,i,o,s,c=r.RGBA,a=h.DEPTH16_BUFFER,l=this._width,_=this._height,f=null){return e?.fbo.width===l&&e?.fbo.height===_||(e=t(e)),e=e??this._fbos.acquire(c,l,_,i),null!=a&&e.acquireDepth(a),f?.forEach((t=>{e.acquireColor(t.format,t.attachment)})),this._fbos.rctx.bindFramebuffer(e.fbo),this.renderToFBO(o,s,!0,!0),e}renderToFBO(t,e,i=!1,r=!1){const h=this._fbos.rctx;let o=0;if(e){const t=1e-13,i=Math.max(t,e[3]);h.setClearColor(e[0],e[1],e[2],i),o|=s.COLOR_BUFFER_BIT}i&&(o|=s.DEPTH_BUFFER_BIT),!1===r?r=0:(!0===r&&(r=255),o|=s.STENCIL_BUFFER_BIT),o&&h.clearSafe(o,r),t(),h.gl.flush()}renderToTargets(t,e,i,r,h=!1,o=!1){this._bindTarget(e,i),this.renderToFBO(t,r,h,o),e.detachDepth()}bindFbo(){const t=null==this._color;if(this._bindTarget(this.color,this.depth),t){const t=this._fbos.rctx;t.setClearStencil(0),t.setClearColor(this._clearColor[0],this._clearColor[1],this._clearColor[2],this._clearColor[3]),t.clearSafe(s.COLOR_BUFFER_BIT|s.DEPTH_BUFFER_BIT|s.STENCIL_BUFFER_BIT)}}_bindTarget(t,e){t.detachDepth(),t.attachDepth(e),this._fbos.rctx.bindFramebuffer(t.fbo)}get width(){return this._width}get height(){return this._height}get color(){return this._color||(this._color=this._fbos.acquire(r.RGBA,this._width,this._height,"composite-color")),this._color}get depth(){return this._depth||(this._depth=this._fbos.acquireDepth(h.DEPTH_STENCIL_TEXTURE,this._width,this._height,"depth")),this._depth}}const l=[0,1,0,1];export{a as OffscreenRendering};
5
+ import"../../../../core/has.js";import{releaseMaybe as t}from"../../../../core/maybe.js";import{c as e}from"../../../../chunks/vec42.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{ColorFormat as i,DepthFormat as o}from"../core/FBOCache.js";import{RendererTarget as h}from"./rendererUtils.js";import{TransparencyPassType as s}from"./TransparencyPassType.js";import{ClearBufferBit as c}from"../../../webgl/enums.js";import{ensureAttachmentMaxSize as a}from"../../../webgl/FramebufferObject.js";class l{constructor(t,e){this._fbos=t,this.compositingHelper=e,this._width=4,this._height=4,this._clearColor=r()}dispose(){this._color=t(this._color),this.releaseBuffers()}get framebuffer(){return this.color.detachDepth(),this.color.attachDepth(this.depth),this.color.fbo}get colorTexture(){return this.color.colorTexture}get depthTexture(){return this.depth.attachment}initializeFrame(t,r,i){this._fbos.interactive=i===h.Default;const o=this._fbos.rctx;this._width=t.fullWidth,this._height=t.fullHeight,a(this,o.parameters.maxTextureSize);const s=this._color;return this._color=null,this.releaseBuffers(),e(this._clearColor,r),s}releaseBuffers(){this._color?.detachDepth(),this._depth=t(this._depth)}renderHUDVisibility(t,e,r){return t?.fbo.width===this._width&&t?.fbo.height===this._height||(t?.release(),t=this._fbos.acquire(this._width,this._height,"hud visibility",i.RGBA4)),t.attachDepth(r||this.depth),this._fbos.rctx.bindFramebuffer(t.fbo),this.renderToFBO(e,f),t.detachDepth(),t}compositeToHUDVisibility(t,e){this._fbos.rctx.bindFramebuffer(t.hudVisibility?.fbo),this.compositingHelper.compositeHUD(t,e)}renderOITPass(t,e,r){let h,c;const{_width:a,_height:l}=this;switch(e){case s.Color:h=this._fbos.acquire(a,l,r?"oit hud color":"oit color",i.RGBA16F),c=[0,0,0,0];break;case s.Alpha:h=this._fbos.acquire(a,l,r?"oit hud alpha":"oit alpha",i.R16F),c=[1,1,1,1];break;case s.FrontFace:h=this._fbos.acquire(a,l,r?"oit hud front":"oit front"),c=[0,0,0,0]}return r?(h.acquireDepth(o.DEPTH16_BUFFER),this._fbos.rctx.bindFramebuffer(h.fbo),this.renderToFBO(t,c,!0,!0),h.releaseDepth()):(h.attachDepth(this.depth),this._fbos.rctx.bindFramebuffer(h.fbo),this.renderToFBO(t,c),h.detachDepth()),h}compositeToFramebuffer(t,e,r,i){this.bindFbo(),this.compositingHelper.composite(t,e,r,i)}compositeTransparentOntoOpaque(t,e,r,i,o){o?(this._fbos.rctx.bindFramebuffer(o.fbo),this._fbos.rctx.setClearColor(0,0,0,1e-13),this._fbos.rctx.clearSafe(c.COLOR_BUFFER_BIT)):this.bindFbo(),this.compositingHelper.compositeOIT(t,e.colorTexture,r.colorTexture,i.colorTexture)}renderDepthDetached(t){this._bindTarget(this.color),t(),this._bindTarget(this.color,this.depth)}renderToCachedFBO(e,r,h,s,c=i.RGBA,a=o.DEPTH16_BUFFER,l=this._width,f=this._height,_=null){return e?.fbo.width===l&&e?.fbo.height===f||(e=t(e)),e=e??this._fbos.acquire(l,f,r,c),null!=a&&e.acquireDepth(a),_?.forEach((t=>{e.acquireColor(t.format,t.attachment)})),this._fbos.rctx.bindFramebuffer(e.fbo),this.renderToFBO(h,s,!0,!0),e}renderToFBO(t,e,r=!1,i=!1){const o=this._fbos.rctx;let h=0;if(e){const t=1e-13,r=Math.max(t,e[3]);o.setClearColor(e[0],e[1],e[2],r),h|=c.COLOR_BUFFER_BIT}r&&(h|=c.DEPTH_BUFFER_BIT),!1===i?i=0:(!0===i&&(i=255),h|=c.STENCIL_BUFFER_BIT),h&&o.clearSafe(h,i),t(),o.gl.flush()}renderToTargets(t,e,r,i,o=!1,h=!1){this._bindTarget(e,r),this.renderToFBO(t,i,o,h),e.detachDepth()}bindFbo(){const t=null==this._color;if(this._bindTarget(this.color,this.depth),t){const t=this._fbos.rctx;t.setClearStencil(0),t.setClearColor(this._clearColor[0],this._clearColor[1],this._clearColor[2],this._clearColor[3]),t.clearSafe(c.COLOR_BUFFER_BIT|c.DEPTH_BUFFER_BIT|c.STENCIL_BUFFER_BIT)}}_bindTarget(t,e){t.detachDepth(),t.attachDepth(e),this._fbos.rctx.bindFramebuffer(t.fbo)}get width(){return this._width}get height(){return this._height}get color(){return this._color||(this._color=this._fbos.acquire(this._width,this._height,"composite-color")),this._color}get depth(){return this._depth||(this._depth=this._fbos.acquireDepth(o.DEPTH_STENCIL_TEXTURE,this._width,this._height,"depth")),this._depth}}const f=[0,1,0,1];export{l as OffscreenRendering};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../chunks/tslib.es6.js";import r from"../../../../core/Accessor.js";import{update as t}from"../../../../core/arrayUtils.js";import{unitRGBAFromColor as s}from"../../../../core/colorUtils.js";import has from"../../../../core/has.js";import{removeMaybe as i,destroyMaybe as a,releaseMaybe as n}from"../../../../core/maybe.js";import h from"../../../../core/PooledArray.js";import{watch as o,syncAndInitial as d,initial as l,sync as _}from"../../../../core/reactiveUtils.js";import{property as p}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import{subclass as u}from"../../../../core/accessorSupport/decorators/subclass.js";import{equals as c,invert as m,multiply as g}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as f,create as T}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{s as A}from"../../../../chunks/vec42.js";import{fromValues as E,ZEROS as b}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{a as R}from"../../../../chunks/boundedPlane.js";import{debugFlags as P}from"../../support/debugFlags.js";import{TransparencyMode as S}from"../../terrain/TerrainRenderer.js";import{DepthFormat as D,FBOCache as O,ColorFormat as y}from"../core/FBOCache.js";import{RenderPassManager as C}from"../core/renderPasses/RenderPassManager.js";import{ShaderOutput as I}from"../core/shaderLibrary/ShaderOutput.js";import{HUDRenderStyle as w}from"../core/shaderLibrary/hud/HUDRenderStyle.js";import{RenderNodeCollection as N}from"../effects/RenderNodeCollection.js";import{isPrepareRenderPlugin as L}from"../effects/RenderPlugin.js";import{RenderPluginInput as H}from"../effects/RenderPluginInput.js";import{RenderPluginManager as M}from"../effects/RenderPluginManager.js";import{Blit as F}from"../effects/blit/Blit.js";import{Highlight as x}from"../effects/highlight/Highlight.js";import{ShadowHighlight as v}from"../effects/highlight/ShadowHighlight.js";import{SMAA as U}from"../effects/smaa/SMAA.js";import{SSAO as G}from"../effects/ssao/SSAO.js";import{AnimationTimeStep as B}from"./AnimationTimeStep.js";import{Decorations as q,RenderRequestType as j,StencilBits as V}from"./basicInterfaces.js";import{BoundingInfo as Q}from"./BoundingInfo.js";import{zero as W,union as k}from"./depthRange.js";import{depthRangeFromScene as X}from"./depthRangeUtils.js";import{RenderOccludedFlag as Y}from"./Material.js";import{OffscreenRendering as z}from"./OffscreenRendering.js";import{RenderContext as J,defaultRenderOccludedMask as K}from"./RenderContext.js";import{splitRenderGeometryChangeSetByMaterial as Z}from"./rendererUtils.js";import{setupFeatureDefaults as $,RenderFeature as ee}from"./RenderFeature.js";import{RenderSlot as re}from"./RenderSlot.js";import{ShadowAccumulator as te}from"./ShadowAccumulator.js";import{ShadowMap as se,SnapshotSlot as ie}from"./ShadowMap.js";import ae from"./SliceHelper.js";import{TransparencyPassType as ne}from"./TransparencyPassType.js";import{EdgeView as he}from"./edgeRendering/EdgeView.js";import{Transparency as oe}from"./edgeRendering/interfaces.js";import{MergedRenderer as de}from"../materials/renderers/MergedRenderer.js";import{AlphaMode as le}from"../shaders/CompositingTechniqueConfiguration.js";import{RendererPerformanceInfo as _e,PerformanceCategory as pe}from"../statistics/RendererPerformanceInfo.js";import{RenderState as ue}from"../../../support/RenderState.js";import{PixelFormat as ce,PixelType as me,ClearBufferBit as ge}from"../../../webgl/enums.js";let fe=class extends r{get _bindParameters(){return this._renderContext.bindParameters}updateRenderFeatures(e=null,r=!has("disable-feature:high-quality-idle")){this._renderStateFeatures=$(r,e),this.notifyChange("_renderStateFeatures"),this._plugins.renderFeatureChanged(),this._requestRender()}isFeatureEnabled(e,r=this._state){return this._renderStateFeatures.get(r,e)??!1}setFeatureEnabled(e,r,t){this._renderStateFeatures.set(r,e,t),this.notifyChange("_renderStateFeatures"),this._requestRender()}get _highQualityTransparency(){return this._highQualityTransparencyEnabled||this.isFeatureEnabled(ee.HighQualityTransparency)}get hasReflections(){return(this._pluginsHas.water||this._hasOverlayWater)&&(this._ssrEnabled||this.isFeatureEnabled(ee.WaterReflection))}get hasDecorations(){return this._plugins.hasDecorations}get hasHighlights(){return this._plugins.produces(re.OPAQUE_MATERIAL,I.Highlight)||this._plugins.produces(re.DRAPED_MATERIAL,I.Highlight)}get _magnifierEnabled(){return this._bindParameters.decorations===q.ON&&this._magnifierHelper.enabled}get fullResolutionAtmosphere(){return this._stage.view.qualitySettings.highResolutionAtmosphere||this.isFeatureEnabled(ee.HighResolutionAtmosphere)}constructor(e,r,t,i,a,n,h,_){super({}),this._stage=e,this._techniqueRepository=i,this._rctx=a,this._compositingHelper=n,this._magnifierHelper=h,this._requestRender=_,this._needsTransparentPass=!1,this._pluginsHas={hudElements:!1,water:!1},this._hasOverlayWater=!1,this.renderOverlay=e=>{},this._isRendering=!1,this._backgroundColor=E(0,0,0,1),this._sliceHelper=new ae,this._renderNodes=new N,this._state=ue.IDLE,this._highQualityTransparencyEnabled=!0,this._terrainTransparency=S.Opaque,this._ssrEnabled=!1,this._hasAnimations=!1,this._animationTimestep=new B,this._renderHiddenTransparentEdges=()=>{},this._pluginInput=new H,this._releaseGeometryLinearDepth=e=>e?.release(),this._geometryLinearDepthFormat=D.DEPTH16_BUFFER,this.fboCache=new O(a),this._renderStateFeatures=$(!has("disable-feature:high-quality-idle"),e.view.qualityProfile),this._offscreen=new z(this.fboCache,this._compositingHelper),this.performanceInfo=new _e(this._rctx),this._shadowMap=new se(this.fboCache,e.viewingMode),this._highlight=new x({view:e.view}),this._shadowHighlight=new v({view:e.view,viewingMode:e.viewingMode}),this._shadowAccumulator=new te(this.fboCache,i,e,(e=>{const r=this.shadowsEnabled;this._shadowMap.enabled=!0,this._prepare(e.camera,e.contentCamera),this._plugins.prepareRender(),this._shadowMap.enabled=r}),((e,r,t)=>{const s=this._stage.view.qualitySettings.maximumPixelRatio;e.shadowMap.start(e.camera,r,t,!0,s),this._renderShadowCascades(I.Shadow,e.shadowMap),e.shadowMap.finish(),e.camera.setGLViewport(this._rctx),this._prepare(e.camera,e.contentCamera)}),_),this._ssao=new G({view:this._stage.view}),this._renderContext=new J(this._rctx,this._offscreen,this._shadowMap,this._sliceHelper),this._plugins=new M({renderContext:this._renderContext,techniqueRepository:i,textureRepository:t,materialRepository:r,requestRender:_,controller:e,fbos:this.fboCache,isFeatureEnabled:e=>this.isFeatureEnabled(e)}),this.renderPassManager=new C,this._plugins.add(this.renderPassManager),this._smaa=new U({view:this._stage.view}),this._plugins.add(this._smaa),this._blit=new F({opacity:1,alphaMode:le.None}),this._plugins.add(this._blit),this._plugins.add(this._ssao),this._plugins.add(this._highlight),this._plugins.add(this._shadowHighlight),this.addHandles([o((()=>this._stage.view.state.camera),(()=>_()),d),o((()=>P.EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES),(e=>{this._renderHiddenTransparentEdges=e?()=>this._renderEdges(oe.TRANSPARENT):()=>{},_()}),l),o((()=>this._stage.view.environment.background?.color),(e=>{const r=e?s(e):b;A(this._backgroundColor,r[0]*r[3],r[1]*r[3],r[2]*r[3],r[3]),_()}),d)])}normalizeCtorArgs(){return{}}destroy(){this._gpuTimerHandle=i(this._gpuTimerHandle),this._offscreen.dispose(),this._shadowMap.dispose(),this._highlight.dispose(),this._shadowAccumulator.dispose(),this._edgeView=a(this._edgeView),this.renderPassManager.dispose(),this._releaseFBOs(),this._disposeOffscreenBuffers(),this.fboCache.destroy(),this._plugins.destroy(),Q.prune()}_releaseFBOs(){this._bindParameters.ssr.lastFrameColor=n(this._bindParameters.ssr.lastFrameColor),this._bindParameters.multipassTerrain.linearDepth=n(this._bindParameters.multipassTerrain.linearDepth),this._bindParameters.multipassGeometry.linearDepth=n(this._bindParameters.multipassGeometry.linearDepth)}_disposeOffscreenBuffers(){this._offscreen.dispose(),this._disposeBindBuffers()}_disposeBindBuffers(){this._shadowMap.disposeOffscreenBuffers(),this._bindParameters.linearDepth=n(this._bindParameters.linearDepth),this._bindParameters.hudVisibility=n(this._bindParameters.hudVisibility)}get updating(){return this._smaa.updating||null!=this._edgeView&&this._edgeView.updating||this._shadowAccumulator.running||this._plugins.updating||!this.isCameraFinal}ensureEdgeView(){if(null==this._edgeView){const e=this._stage.view.resourceController;this._edgeView=new he({rctx:this._rctx,renderSR:this._stage.view.renderSpatialReference,viewingMode:this._stage.viewingMode,techniqueRepository:this._techniqueRepository,setNeedsRender:()=>this._requestRender(),schedule:De(e)}),this.addHandles(o((()=>this._edgeView?.updating),(()=>this._requestRender()),_)),this._requestRender()}return this._edgeView}get edgeView(){return this._edgeView}get isCameraFinal(){return c(this._bindParameters.ssr.reprojectionMatrix,f)}set _reprojectionMatrix(e){t(this._bindParameters.ssr.reprojectionMatrix,e)&&this.notifyChange("isCameraFinal")}get shadowsEnabled(){return!!this._shadowMap?.enabled}setParameters(e){const{_shadowMap:r,_bindParameters:t}=this;if(void 0!==e.qualitySettings?.reflections&&this._ssrEnabled!==e.qualitySettings.reflections&&(this._ssrEnabled=e.qualitySettings.reflections,this._requestRender()),void 0!==e.shadowMap&&this._shadowMap.enabled!==e.shadowMap&&(this._shadowMap.enabled=e.shadowMap,this._requestRender()),void 0!==e.shadowMapMaxCascades&&r.maxCascades!==e.shadowMapMaxCascades&&(r.maxCascades=e.shadowMapMaxCascades,this._requestRender()),null!=e.environment){null!=e.environment.weather&&(this._bindParameters.weather=e.environment.weather,this._bindParameters.weatherVisible=!!e.weatherVisible);const r="virtual"!==e.environment.lighting.type;t.enableFillLights!==r&&(t.enableFillLights=r,this._requestRender())}void 0!==e.highQualityTransparency&&this._highQualityTransparencyEnabled!==e.highQualityTransparency&&(this._highQualityTransparencyEnabled=e.highQualityTransparency,this._requestRender()),void 0!==e.hasOverlayWater&&this._hasOverlayWater!==e.hasOverlayWater&&(this._hasOverlayWater=e.hasOverlayWater,this._requestRender()),void 0!==e.slicePlane&&this._sliceHelper.plane!==e.slicePlane&&(this._sliceHelper.plane=e.slicePlane,this._requestRender()),void 0!==e.terrainTransparency&&this._terrainTransparency!==e.terrainTransparency&&(this._terrainTransparency=e.terrainTransparency,this._requestRender()),void 0!==e.shadowCastOptions&&this._shadowAccumulator.setOptions(e.shadowCastOptions)}get hasSlicePlane(){return!!this._sliceHelper.plane}get plugins(){return this._plugins}get _hasOITSupport(){return this._rctx.driverTest.floatBufferBlend.result}get _oitEnabled(){return this._highQualityTransparency&&this._hasOITSupport}modify(e,r){this._isRendering&&console.warn("Renderer.modify called while rendering");const{adds:t,removes:s,updates:i}=e;if(0===t.length&&0===s.length&&0===i.length)return;const a=Z(e);let n=!1;a.forEach(((t,s)=>{if(r.done)return;let i=this._plugins.getMaterialRenderer(s);if(null==i&&t.adds.length>0){const e=new de({material:s});e.initializeRenderContext(this._plugins._context),i=e,this._plugins.add(i)}i&&(i.modify(t),0===i.numGeometries&&(n=!0)),t.removes.forEach((r=>e.removes.removeUnordered(r))),t.adds.forEach((r=>e.adds.removeUnordered(r))),t.updates.forEach((r=>e.updates.removeUnordered(r))),r.madeProgress()})),n&&this._plugins.removeEmptyMaterialRenderers(),this._updateHasFlags(),this._requestRender()}_updateHasFlags(){const has=this._pluginsHas;has.hudElements=this._plugins.produces(re.LINE_CALLOUTS_HUD_DEPTH)||this._plugins.produces(re.HUD_MATERIAL)||this._plugins.produces(re.LABEL_MATERIAL),has.water=this._plugins.produces(re.DRAPED_WATER,I.Normal),this._bindParameters.hasOccludees=this._plugins.hasOccludees}updateAnimation(e){const r=this._hasAnimations;return this._hasAnimations=this._plugins.updateAnimation(e)||this._hasAnimations,this._hasAnimations!==r&&(this._gpuTimerHandle=r?i(this._gpuTimerHandle):this.performanceInfo.enableGPUPerformanceInfo()),this._hasAnimations}get animationTimestep(){return this._animationTimestep.value}get animationTimeDilation(){return this._animationTimestep.timeDilation}resetAnimation(){this._animationTimestep.clear()}tick(){this.fboCache.clean()}render(e,r,t,s,i){const a=null!=e;this._isRendering=!0,this.performanceInfo.startFrame(),this.fboCache.frameStart(),this._disposeBindBuffers();const h=this._offscreen,{camera:o,contentCamera:d,mode:l,alignPixelEnabled:_}=t;this._state=l,this._bindParameters.overlay=this.renderOverlay(i),this.performanceInfo.advance(pe.OVERLAY),this._renderContext.time=i,this._bindParameters.transparencyPassType=ne.NONE,this._bindParameters.alignPixelEnabled=_,this._bindParameters.decorations=s,this._bindParameters.mainColor=this._bindParameters.mainDepth=null;const p=R(this._sliceHelper.plane);s===q.OFF&&(this._sliceHelper.plane=null),o.setGLViewport(this._rctx);const u=h.initializeFrame(o,this._backgroundColor,a);this.hasReflections?this._bindParameters.ssr.lastFrameColor=u:u?.release(),this._prepare(o,d),this._plugins.prepareRender(),this.performanceInfo.advance(pe.PREPARE);const c=this._computeDepthRange(o);this._renderShadowMap(o,this._bindParameters.lighting.mainLight.direction,c),this.performanceInfo.advance(pe.SHADOW_MAP),this._ensureBindParameters(o,d);const m=this._plugins.produces(re.OPAQUE_TERRAIN)&&(this._terrainTransparency===S.Semitransparent||this._terrainTransparency===S.TransparentWithDraped),g=this._highQualityTransparency&&m;this._prepareShaders(g,this._needsTransparentPass),this._renderLinearDepthForSSAO(),this.performanceInfo.advance(pe.LINEAR_DEPTH_SSAO);let f=this._renderNormals();this.performanceInfo.advance(pe.NORMALS);let T=f?.detachDepth();this._renderSSAO(f),f&&!this._renderNodes.consumes("normals")&&(f.release(),f=null),this.performanceInfo.advance(pe.SSAO),this._renderLinearDepth(T),T=n(T),this.performanceInfo.advance(pe.LINEAR_DEPTH),this._renderShadowAccumulation(c,o,d),this.performanceInfo.advance(pe.ACCUMULATED_SHADOWS),this._ensureBindParametersSSR(i),this._renderContext.output=I.Color,h.bindFbo(),this._bindParameters.mainColor=h.colorTexture,this._bindParameters.mainDepth=h.depthTexture,this._renderOpaqueGeometry(),this._plugins.render(re.ENVIRONMENT_OPAQUE),this.performanceInfo.advance(pe.OPAQUE),this.fboCache.debugCallback&&this.fboCache.debugCallback("opaque color",this._offscreen.color.fbo),this._renderTerrainLinearDepth(g),this._setMultipassTerrain(g),this._renderEdges(oe.OPAQUE),this.performanceInfo.advance(pe.OPAQUE_EDGES),h.bindFbo(),this._plugins.render(re.VOXEL),this.performanceInfo.advance(pe.VOXEL),this._renderHiddenTransparentEdges(),this._needsTransparentPass&&(this._oitEnabled?this._renderOITPass(Te.Geometry):this._renderTransparentMaterial()),this.performanceInfo.advance(pe.TRANSPARENT);const A=this._renderGeometryLinearDepth(g);this._renderHUDVisibility(A),g||this._plugins.render(re.LINE_CALLOUTS),this.performanceInfo.advance(pe.HUD_VISIBILITY),this._renderObjectAndLayerIdColor(r),this.performanceInfo.advance(pe.OBJECT_AND_LAYER_ID_COLOR),this._renderEdges(oe.TRANSPARENT,A),this._releaseGeometryLinearDepth(A),this.performanceInfo.advance(pe.TRANSPARENT_EDGES);const E=m?this._renderTransparentTerrain():null;E&&this._bindParameters.hudVisibility&&(g?this._renderLineCallouts(w.Occluded):h.compositeToHUDVisibility(this._bindParameters,E.colorTexture),this._renderHUD(w.Occluded,h.color),this.performanceInfo.advance(pe.HUD_OCCLUDED)),this.performanceInfo.advance(pe.TRANSPARENT_TERRAIN),this._setTerrainCulling(!1),E&&(h.compositeToFramebuffer(this._bindParameters,E.colorTexture,le.PremultipliedAlpha,1),E.release(),g&&(this._renderEdges(oe.OPAQUE),this.performanceInfo.advance(pe.OPAQUE_EDGES),this._needsTransparentPass&&(this._oitEnabled?this._renderOITPass(Te.Geometry):this._renderTransparentMaterial()),this.performanceInfo.advance(pe.TRANSPARENT),this._renderEdges(oe.TRANSPARENT),this.performanceInfo.advance(pe.TRANSPARENT_EDGES))),this._bindParameters.ssao=n(this._bindParameters.ssao),g&&this._renderLineCallouts(w.NotOccluded),this._setMultipassEnabled(!1),this._shadowAccumulator.render(this._bindParameters),h.bindFbo(),this._plugins.render(re.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL),this._plugins.render(re.ENVIRONMENT_TRANSPARENT),this.performanceInfo.advance(pe.ENVIRONMENT),this._renderLaserlines(),this.performanceInfo.advance(pe.LASER_LINES),this._renderOccluded(),this.performanceInfo.advance(pe.OCCLUDED);const b=this._magnifierEnabled&&null==e?this.fboCache.acquire(y.RGBA,this._offscreen.width,this._offscreen.height,"magnifier"):null,P=this._renderHighlightPrepass(),D=this._renderComposite(b??e,this._offscreen.color,f,P)??e;f?.release(),this.performanceInfo.advance(pe.ANTIALIASING),this._renderHUD(w.NotOccluded,D),this.performanceInfo.advance(pe.HUD),this._renderHighlights(D,P,this._bindParameters),P?.release(),this.performanceInfo.advance(pe.HIGHLIGHTS),this._magnifierEnabled&&this._magnifierHelper.render(this._rctx,this._bindParameters),D!==e&&(this._rctx.bindFramebuffer(e?.fbo),this._compositingHelper.composite(this._bindParameters,b?.colorTexture,le.None)),b!==e&&b?.release(),this.onPostRender&&this.onPostRender(),this._releaseFBOs(),this._offscreen.releaseBuffers(),this._renderContext.lastFrameCamera.copyFrom(this._bindParameters.camera),this._sliceHelper.plane=p,this._isRendering=!1,this.fboCache.frameEnd(),this.performanceInfo.finishFrame(),a&&(this._releaseFBOs(),this._disposeOffscreenBuffers())}_prepareShaders(e,r){this._renderContext.output=I.Color,this._prepareOpaqueGeometry(),this._setMultipassTerrain(e),this._plugins.prepare(re.TRANSPARENT_TERRAIN),this._setMultipassTerrain(!1),e||this._plugins.prepare(re.LINE_CALLOUTS),r&&this._prepareTransparencySlots(),this._plugins.prepare(re.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL),this._plugins.prepare(re.ENVIRONMENT_TRANSPARENT),this._plugins.prepare(re.LASERLINES),this._rctx.gl.flush()}_renderObjectAndLayerIdColor(e){if(null==e||!has("enable-feature:objectAndLayerId-rendering"))return;const r=this._renderContext.output;this._rctx.bindFramebuffer(e.fbo),this._offscreen.renderToFBO((()=>this._renderAllGeometry(I.ObjectAndLayerIdColor)),[0,0,0,0],!0,!0),this._rctx.bindFramebuffer(e.fbo),this._offscreen.renderToFBO((()=>{this._bindParameters.hudRenderStyle=w.NotOccluded,this._plugins.render(re.HUD_MATERIAL)}),void 0,!0,!0),this._renderContext.output=r}finish(e){this._hasAnimations||this._animationTimestep.clear();const r=this.performanceInfo.gpuSamplingEnabled,t=e===j.BACKGROUND;if(t||r){const e=t?this.performanceInfo.elapsedTime:0,s=r?this.performanceInfo.totalGPUTimeSampler.last:this._rctx.gl.getError(),i=Math.max(e,s);this._animationTimestep.frame(i,t)}}readDepthPixels(e,r,t){const s=this._bindParameters.linearDepth?.fbo;if(s?.colorTexture)return void s.readPixels(r[0],r[1],r[2],r[3],ce.RGBA,me.UNSIGNED_BYTE,t);const i=this.fboCache.acquire(y.RGBA,this._offscreen.width,this._offscreen.height,"depth").acquireDepth(D.DEPTH16_BUFFER);this._rctx.bindFramebuffer(i.fbo),this._ensureBindParameters(e,e),this._bindParameters.camera.setGLViewport(this._rctx),this._rctx.setClearColor(0,0,0,0);const a=ge.COLOR_BUFFER_BIT|ge.DEPTH_BUFFER_BIT|ge.STENCIL_BUFFER_BIT;this._rctx.clearSafe(a),this._renderAllGeometry(I.Depth),i.fbo.readPixels(r[0],r[1],r[2],r[3],ce.RGBA,me.UNSIGNED_BYTE,t),i.release()}readHUDVisibility(e,r,t,s,i){this._bindParameters.hudVisibility?.fbo.readPixels(e,r,t,s,ce.RGBA,me.UNSIGNED_BYTE,i)}readAccumulatedShadow(e){return this._shadowAccumulator.readAccumulatedShadow(e[0],e[1])}_setMultipassTerrain(e){this._setMultipassEnabled(e),this._setTerrainCulling(e)}_setMultipassEnabled(e){this._bindParameters.multipassEnabled=e}_setTerrainCulling(e){this._bindParameters.multipassTerrain.cullAboveGround=e}_renderEdges(e,r){const t=this._edgeView;if(t?.shouldRender()){const{width:s,height:i,depth:a}=this._offscreen,n=this.fboCache.acquire(y.RGBA,s,i,"edges"),h=()=>t.render(this._bindParameters,e);this._offscreen.renderToTargets(h,n,r??a,Ee),this._offscreen.compositeToFramebuffer(this._bindParameters,n.colorTexture,le.Alpha,1),n.release()}}_renderShadowMap(e,r,t){const s=this._shadowMap;s.enabled&&(s.start(e,r,t,this.isFeatureEnabled(ee.HighResolutionShadows),this._stage.view.qualitySettings.maximumPixelRatio),this._shadowHighlight.updateParameters(e,r),this._needsShadowHighlight?(this._renderShadowCascades(I.ShadowHighlight,this._shadowMap),s.moveSnapshot(ie.Highlight),this._renderShadowCascades(I.ShadowExcludeHighlight,this._shadowMap),s.copySnapshot(ie.ExcludeHighlight),this._renderShadowCascades(I.ShadowHighlight,this._shadowMap)):this._renderShadowCascades(I.Shadow),s.finish(),e.setGLViewport(this._rctx))}_renderShadowCascades(e,r=this._shadowMap){for(const t of r.cascades)t.camera.setGLViewport(this._rctx),this._prepare(t.camera,t.camera),this._renderAllGeometry(e)}get _needsLinearDepth(){return this._plugins.consumes(I.Depth)||this._renderNodes.consumes("linear-depth")||this.hasReflections||this._needsShadowHighlight||this._needsShadowCast}_renderLinearDepthForSSAO(){this._plugins.produces(re.SSAO)&&(this._bindParameters.linearDepth=this._offscreen.renderToCachedFBO(this._bindParameters.linearDepth,"linear-depth",(()=>this._renderGeometryForSSAO(I.Depth)),[0,0,0,0],y.RGBA,D.DEPTH_STENCIL_TEXTURE),this._bindParameters.linearDepth.releaseDepth())}_renderLinearDepth(e){if(this._needsLinearDepth){if(this._plugins.produces(re.SSAO)&&e&&this._bindParameters.linearDepth)return this._bindParameters.linearDepth.attachDepth(e),this._rctx.bindFramebuffer(this._bindParameters.linearDepth.fbo),this._offscreen.renderToFBO((()=>this._renderGeometryExcludedFromSSAO(I.Depth))),void this._bindParameters.linearDepth.detachDepth();this._bindParameters.linearDepth=this._offscreen.renderToCachedFBO(this._bindParameters.linearDepth,"linear-depth",(()=>this._renderAllGeometry(I.Depth)),[0,0,0,0],y.RGBA,D.DEPTH_STENCIL_TEXTURE),this._bindParameters.linearDepth.releaseDepth()}else this._bindParameters.linearDepth=n(this._bindParameters.linearDepth)}_renderTerrainLinearDepth(e){if(e){const e=this._renderContext.output;this._renderContext.output=I.Depth,this._bindParameters.multipassTerrain.linearDepth=this._offscreen.renderToCachedFBO(this._bindParameters.multipassTerrain.linearDepth,"terrain depth",(()=>this._renderTransparentTerrain()),[-1e10,-1e10,-1e10,1]),this._bindParameters.multipassTerrain.linearDepth.releaseDepth(),this._renderContext.output=e}else this._bindParameters.multipassTerrain.linearDepth=n(this._bindParameters.multipassTerrain.linearDepth)}_renderGeometryLinearDepth(e){if(!e)return void(this._bindParameters.multipassGeometry.linearDepth=n(this._bindParameters.multipassGeometry.linearDepth));const r=this._renderContext.output;return this._bindParameters.multipassGeometry.linearDepth=this._offscreen.renderToCachedFBO(this._bindParameters.multipassGeometry.linearDepth,"geometry depth",(()=>this._renderOpaqueGeometryAndTransparentMaterial(I.Depth)),[1,1,1,1],y.RGBA,this._geometryLinearDepthFormat),this._renderContext.output=r,this._bindParameters.multipassGeometry.linearDepth.detachDepth()}get _needsDepthRange(){return this._shadowMap.enabled||this._needsShadowCast}_computeDepthRange(e){if(!this._needsDepthRange)return W;const r=X(e,this._plugins.plugins,this._stage.layers);return k(r,this._plugins.queryDepthRange(e)),r.near=Math.max(e.near,r.near),r.far=Math.min(e.far,r.far),r}_renderNormals(){if(!this._renderNodes.consumes("normals")&&!this._plugins.produces(re.SSAO))return;return this._offscreen.renderToCachedFBO(null,"normals",(()=>this._renderGeometryForSSAO(I.Normal)),[0,0,0,0],y.RGBA,D.DEPTH_STENCIL_TEXTURE)}_renderSSAO(e){this._plugins.produces(re.SSAO)&&(this._pluginInput.normals=e,this._bindParameters.ssao=this._plugins.render(re.SSAO,this._pluginInput))}_renderAllGeometry(e){this._renderContext.output=e,this._plugins.prepare(re.TRANSPARENT_TERRAIN),this._renderOpaqueGeometryAndTransparentMaterial(e),this._renderTransparentTerrain()}_renderOpaqueGeometryAndTransparentMaterial(e){this._renderContext.output=e,this._plugins.prepare(re.TRANSPARENT_MATERIAL),this._plugins.prepare(re.TRANSPARENT_NO_SSAO_DEPTH),this._renderOpaqueGeometry(),this._renderTransparentMaterial()}_renderGeometryForSSAO(e){this._renderContext.output=e,this._plugins.render(re.INTEGRATED_MESH),this._plugins.render(re.OPAQUE_TERRAIN),this._plugins.render(re.OPAQUE_MATERIAL),this._plugins.render(re.TRANSPARENT_MATERIAL),this._renderTransparentTerrain()}_renderGeometryExcludedFromSSAO(e){this._renderContext.output=e,this._plugins.render(re.OPAQUE_NO_SSAO_DEPTH),this._plugins.render(re.TRANSPARENT_NO_SSAO_DEPTH)}_prepareOpaqueGeometry(){this._plugins.prepare(re.INTEGRATED_MESH),this._plugins.prepare(re.OPAQUE_TERRAIN),this._plugins.prepare(re.OPAQUE_MATERIAL),this._plugins.prepare(re.OPAQUE_NO_SSAO_DEPTH),this._plugins.prepare(re.ENVIRONMENT_OPAQUE)}_renderOpaqueGeometry(){this._plugins.render(re.INTEGRATED_MESH),this._plugins.render(re.OPAQUE_TERRAIN),this._plugins.render(re.OPAQUE_MATERIAL),this._plugins.render(re.OPAQUE_NO_SSAO_DEPTH)}_renderTransparentMaterial(){this._plugins.render(re.TRANSPARENT_MATERIAL),this._plugins.render(re.TRANSPARENT_NO_SSAO_DEPTH)}_renderTransparentTerrain(){if(!this._plugins.produces(re.TRANSPARENT_TERRAIN))return;const e=()=>this._plugins.render(re.TRANSPARENT_TERRAIN,null);if(this._renderContext.output!==I.Color)return void e();const{width:r,height:t,depth:s}=this._offscreen,i=this.fboCache.acquire(y.RGBA,r,t,"transparent terrain");return this._offscreen.renderToTargets(e,i,s,[0,0,0,0]),i}_renderHUDVisibility(e){this._plugins.produces(re.OCCLUSION_PIXELS)?(this._bindParameters.hudVisibility=this._offscreen.renderHUDVisibility(this._bindParameters.hudVisibility,(()=>this._plugins.render(re.OCCLUSION_PIXELS)),e),this._offscreen.bindFbo()):this._bindParameters.hudVisibility=n(this._bindParameters.hudVisibility)}_renderLineCallouts(e){if(this._bindParameters.hudRenderStyle=e,e===w.Occluded){const e=()=>{this._plugins.render(re.LINE_CALLOUTS)},{width:r,height:t,color:s}=this._offscreen,i=this.fboCache.acquireDepth(D.DEPTH16_BUFFER,r,t,"line callouts");this._offscreen.renderToTargets(e,s,i,void 0,!0,!0),i.release()}else this._plugins.render(re.LINE_CALLOUTS)}_renderLaserlines(){if(this._plugins.render(re.LASERLINES),this._plugins.produces(re.LASERLINES_CONTRAST_CONTROL)){const e=this._offscreen,{width:r,height:t,depth:s}=e,i=this.fboCache.acquire(y.RGBA,r,t,"laser lines"),a=()=>this._plugins.render(re.LASERLINES_CONTRAST_CONTROL);e.renderToTargets(a,i,s,Ee),e.compositeToFramebuffer(this._bindParameters,i.colorTexture,le.PremultipliedAlpha,1),i.release()}}_renderHUD(e,r){if(this._pluginsHas.hudElements)if(this._oitEnabled){const t=this._renderOITPass(Te.HUD,e);this._rctx.bindFramebuffer(r?.fbo),this._compositingHelper.composite(this._bindParameters,t.colorTexture,le.PremultipliedAlpha),t.release()}else if(e===w.Occluded){const r=()=>this._renderHUDElements(e),{width:t,height:s,color:i}=this._offscreen,a=this.fboCache.acquireDepth(D.DEPTH16_BUFFER,t,s,"hud");this._offscreen.renderToTargets(r,i,a,void 0,!0,!0),a.release()}else this._rctx.bindFramebuffer(null),r?.acquireDepth(D.DEPTH16_BUFFER),this._rctx.bindFramebuffer(r?.fbo),this._renderHUDElements(e),r?.releaseDepth()}_renderHUDElements(e){this._bindParameters.hudRenderStyle=e,this._plugins.prepare(re.LINE_CALLOUTS_HUD_DEPTH),this._plugins.prepare(re.HUD_MATERIAL),this._plugins.prepare(re.LABEL_MATERIAL),this._plugins.render(re.LINE_CALLOUTS_HUD_DEPTH),this._plugins.render(re.HUD_MATERIAL),this._plugins.render(re.LABEL_MATERIAL)}get _needsShadowHighlight(){return this._shadowMap.enabled&&this._plugins.produces(re.SHADOW_HIGHLIGHT)&&this._plugins.produces(re.OPAQUE_MATERIAL,I.ShadowHighlight)}_renderHighlightPrepass(){if(!this.hasHighlights&&!this._renderNodes.consumes("highlight"))return;const e=()=>{this._renderAllGeometry(I.Highlight),this._rctx.clearSafe(ge.DEPTH_BUFFER_BIT),this._renderHUDElements(w.Both)},r=this._offscreen.renderToCachedFBO(null,"highlight",e,[0,0,0,0],y.RGBA4,D.DEPTH_STENCIL_TEXTURE);return r.releaseDepth(),r}_renderHighlights(e,r,t){this.hasHighlights&&t.decorations!==q.OFF&&(this._needsShadowHighlight&&(this._pluginInput.highlight=r,this._plugins.render(re.SHADOW_HIGHLIGHT,this._pluginInput,e)),this._plugins.produces(re.HIGHLIGHT)&&(this._pluginInput.composite=null,this._pluginInput.normals=null,this._pluginInput.highlight=r,this._plugins.render(re.HIGHLIGHT,this._pluginInput,e)))}get _needsShadowCast(){return this._shadowAccumulator.isAccumulating}_renderShadowAccumulation(e,r,t){this._needsShadowCast&&this._bindParameters.linearDepth?.colorTexture&&this._shadowAccumulator.renderAccumulation(this._bindParameters.linearDepth,e,r,t)}_prepareTransparencySlots(){this._renderContext.output=I.Alpha,this._bindParameters.transparencyPassType=ne.Alpha,this._plugins.prepare(re.TRANSPARENT_MATERIAL),this._renderContext.output=I.Color,this._bindParameters.transparencyPassType=ne.Color,this._plugins.prepare(re.TRANSPARENT_MATERIAL),this._bindParameters.transparencyPassType=ne.FrontFace,this._plugins.prepare(re.TRANSPARENT_MATERIAL),this._bindParameters.transparencyPassType=ne.NONE}_renderOITPass(e,r=w.Both){const t=e===Te.HUD,s=t?this.fboCache.acquire(y.RGBA,this._offscreen.width,this._offscreen.height,"oit hud composite"):null,i=t?()=>this._renderHUDElements(r):()=>this._renderTransparentMaterial(),a=this._renderContext.output;this._renderContext.output=I.Alpha,this._bindParameters.transparencyPassType=ne.Alpha;const n=this._offscreen.renderOITPass(i,ne.Alpha,t);this._renderContext.output=I.Color,this._bindParameters.transparencyPassType=ne.Color;const h=this._offscreen.renderOITPass(i,ne.Color,t);this._bindParameters.transparencyPassType=ne.FrontFace;const o=this._offscreen.renderOITPass(i,ne.FrontFace,t);return this._offscreen.compositeTransparentOntoOpaque(this._bindParameters,h,n,o,s),s?.releaseDepth(),o.release(),h.release(),n.release(),this._bindParameters.transparencyPassType=ne.NONE,this._renderContext.output=a,s}_renderOccluded(){let e=0;be.clear(),this._plugins.plugins.forAll((r=>{if(!r.materialReference)return;r.queryRenderOccludedState(Y.OccludeAndTransparentStencil)&&(e|=Y.OccludeAndTransparentStencil,be.push(r))}));const r=this._offscreen,t=(t,s,i,a,n)=>{if(0==(e&s))return;const{width:h,height:o,depth:d}=r,l=this.fboCache.acquire(y.RGBA,h,o,"tmp color");r.renderToTargets(i,l,d,[0,0,0,0],a,n),r.compositeToFramebuffer(this._bindParameters,l.colorTexture,le.PremultipliedAlpha,t),l.release()},s=(e,r)=>{this._bindParameters.slot=e,r.forAll((e=>{if(L(e)){const r=e.prepareTechnique(this._renderContext);r&&e.renderNode(this._renderContext,r)}}))};0!==be.length&&(s(re.OCCLUDER_MATERIAL,be),t(.5,Y.OccludeAndTransparentStencil,(()=>s(re.TRANSPARENT_OCCLUDER_MATERIAL,be)),!1,!1)),be.clear(),this._plugins.plugins.forAll((r=>{if(!r.materialReference)return;const t=r.queryRenderOccludedState(Y.OccludeAndTransparent),s=r.queryRenderOccludedState(Y.Transparent),i=r.queryRenderOccludedState(Y.Opaque);(t||s||i)&&(e|=t?Y.OccludeAndTransparent:s?Y.Transparent:Y.Opaque,be.push(r))}));const i=this._plugins.renderOccludedFlags;if(e|=i,!e)return;const a=e=>{this._renderContext.renderOccludedMask=e,i>Y.Occlude&&this._plugins.render(re.OCCLUDED_TERRAIN),s(re.OPAQUE_MATERIAL,be),s(re.TRANSPARENT_MATERIAL,be),s(re.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL,be),this._renderContext.renderOccludedMask=K};this._renderContext.output=I.Color,t(.5,Y.OccludeAndTransparent,(()=>a(Y.OccludeAndTransparent)),!0,V.OutlineVisualElementMask),t(.5,Y.Transparent,(()=>a(Y.Transparent)),!0,V.OutlineVisualElementMask),t(1,Y.Opaque,(()=>a(Y.Opaque)),!0,V.OutlineVisualElementMask),be.clear()}_renderComposite(e,r,t,s){this._pluginInput.composite=r;let i=null;const a=this._renderNodes.produces("composite-color");a&&(this._pluginInput.linearDepth=this._bindParameters.linearDepth,this._pluginInput.normals=t,this._pluginInput.highlight=s,i=this._renderNodes.render(this._pluginInput,"composite-color"),this._pluginInput.composite=i);const n=this._plugins.produces(re.ANTIALIASING),h=this._plugins.render(n?re.ANTIALIASING:re.BLIT,this._pluginInput,e);return a&&i?.release(),h}_prepare(e,r){this._needsTransparentPass=this._plugins.produces(re.TRANSPARENT_MATERIAL,I.Color),this._bindParameters.camera=e,this._bindParameters.contentCamera=r}_ensureBindParameters(e,r){this._bindParameters.camera=e,this._bindParameters.contentCamera=r}_ensureBindParametersSSR(e){if(this._bindParameters.ssr.lastFrameColor){null==this._ssrEnableTime&&(this._ssrEnableTime=e),this._renderContext.lastFrameCamera.equals(this._bindParameters.camera)?this._reprojectionMatrix=f:(m(Pe,this._bindParameters.camera.viewMatrix),m(Re,this._bindParameters.camera.projectionMatrix),g(Se,Pe,Re),g(Se,this._renderContext.lastFrameCamera.viewMatrix,Se),g(Se,this._renderContext.lastFrameCamera.projectionMatrix,Se),this._reprojectionMatrix=Se);const r=this._stage.view.qualitySettings.fadeDuration;this._bindParameters.ssr.fadeFactor=r>0?Math.min(r,e-this._ssrEnableTime)/r:1,this._bindParameters.ssr.fadeFactor<1&&this._requestRender()}else this._reprojectionMatrix=f,this._ssrEnableTime=null}addRenderNode(e){this._renderNodes.add(e),this._requestRender()}removeRenderNode(e){this._renderNodes.remove(e),this._requestRender()}get usedMemory(){return{fbos:this.fboCache.usedMemory,plugins:this._plugins.usedMemory,edges:this.edgeView?.usedMemory??0}}get test(){const e=this;return{offscreen:this._offscreen,shadowMap:this._shadowMap,highlight:this._highlight,lighting:this._bindParameters.lighting,renderPlugins:this._plugins,shadowAccumulator:this._shadowAccumulator,weatherIsFading:this._bindParameters.cloudsFade.isFading,resetRenderStateFeatures:()=>{e._renderStateFeatures=$(),this._plugins.renderFeatureChanged(),this._requestRender()},releaseGeometryLinearDepth(r){e._releaseGeometryLinearDepth=r??(e=>e?.release()),e._geometryLinearDepthFormat=r?D.DEPTH_STENCIL_TEXTURE:D.DEPTH16_BUFFER},getFramebufferTexture:r=>{switch(r){case Ae.Color:return e._offscreen.colorTexture;case Ae.LinearDepth:return e._bindParameters.linearDepth?.colorTexture;case Ae.ShadowMap:return e._shadowMap.depthTexture;case Ae.HudVisibility:return e._bindParameters.hudVisibility?.colorTexture}}}}};var Te,Ae;e([p()],fe.prototype,"_plugins",void 0),e([p()],fe.prototype,"_shadowAccumulator",void 0),e([p()],fe.prototype,"_state",void 0),e([p()],fe.prototype,"_renderStateFeatures",void 0),e([p({readOnly:!0})],fe.prototype,"fullResolutionAtmosphere",null),e([p()],fe.prototype,"_smaa",void 0),e([p()],fe.prototype,"_blit",void 0),e([p({autoDestroy:!0})],fe.prototype,"_edgeView",void 0),e([p()],fe.prototype,"updating",null),e([p()],fe.prototype,"isCameraFinal",null),fe=e([u("esri.views.3d.webgl-engine.lib.Renderer")],fe),function(e){e[e.Geometry=0]="Geometry",e[e.HUD=1]="HUD"}(Te||(Te={})),function(e){e[e.Color=0]="Color",e[e.LinearDepth=1]="LinearDepth",e[e.ShadowMap=2]="ShadowMap",e[e.HudVisibility=3]="HudVisibility"}(Ae||(Ae={}));const Ee=[0,0,0,0],be=new h,Re=T(),Pe=T(),Se=T();function De(e){return r=>e.immediate.schedule(r)}export{Ae as FramebufferId,fe as Renderer};
5
+ import{_ as e}from"../../../../chunks/tslib.es6.js";import r from"../../../../core/Accessor.js";import{update as t}from"../../../../core/arrayUtils.js";import{unitRGBAFromColor as s}from"../../../../core/colorUtils.js";import has from"../../../../core/has.js";import{removeMaybe as i,destroyMaybe as a,releaseMaybe as n}from"../../../../core/maybe.js";import h from"../../../../core/PooledArray.js";import{watch as o,syncAndInitial as d,initial as l,sync as _}from"../../../../core/reactiveUtils.js";import{property as p}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import{subclass as u}from"../../../../core/accessorSupport/decorators/subclass.js";import{equals as c,invert as m,multiply as f}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as g,create as T}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{s as E}from"../../../../chunks/vec42.js";import{fromValues as A,ZEROS as b}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{a as R}from"../../../../chunks/boundedPlane.js";import{debugFlags as P}from"../../support/debugFlags.js";import{TransparencyMode as S}from"../../terrain/TerrainRenderer.js";import{DepthFormat as D,FBOCache as O,ColorFormat as y}from"../core/FBOCache.js";import{RenderPassManager as C}from"../core/renderPasses/RenderPassManager.js";import{ShaderOutput as I}from"../core/shaderLibrary/ShaderOutput.js";import{HUDRenderStyle as w}from"../core/shaderLibrary/hud/HUDRenderStyle.js";import{RenderNodeCollection as N}from"../effects/RenderNodeCollection.js";import{isPrepareRenderPlugin as L}from"../effects/RenderPlugin.js";import{RenderPluginInput as H}from"../effects/RenderPluginInput.js";import{RenderPluginManager as M}from"../effects/RenderPluginManager.js";import{Blit as F}from"../effects/blit/Blit.js";import{Highlight as x}from"../effects/highlight/Highlight.js";import{ShadowHighlight as v}from"../effects/highlight/ShadowHighlight.js";import{SMAA as U}from"../effects/smaa/SMAA.js";import{SSAO as G}from"../effects/ssao/SSAO.js";import{AnimationTimeStep as q}from"./AnimationTimeStep.js";import{Decorations as B,RenderRequestType as j,StencilBits as V}from"./basicInterfaces.js";import{BoundingInfo as Q}from"./BoundingInfo.js";import{zero as W,union as k}from"./depthRange.js";import{depthRangeFromScene as X}from"./depthRangeUtils.js";import{RenderOccludedFlag as Y}from"./Material.js";import{OffscreenRendering as z}from"./OffscreenRendering.js";import{RenderContext as J,defaultRenderOccludedMask as K}from"./RenderContext.js";import{splitRenderGeometryChangeSetByMaterial as Z,RendererTarget as $}from"./rendererUtils.js";import{setupFeatureDefaults as ee,RenderFeature as re}from"./RenderFeature.js";import{RenderSlot as te}from"./RenderSlot.js";import{ShadowAccumulator as se}from"./ShadowAccumulator.js";import{ShadowMap as ie,SnapshotSlot as ae}from"./ShadowMap.js";import ne from"./SliceHelper.js";import{TransparencyPassType as he}from"./TransparencyPassType.js";import{EdgeView as oe}from"./edgeRendering/EdgeView.js";import{Transparency as de}from"./edgeRendering/interfaces.js";import{MergedRenderer as le}from"../materials/renderers/MergedRenderer.js";import{AlphaMode as _e}from"../shaders/CompositingTechniqueConfiguration.js";import{RendererPerformanceInfo as pe,PerformanceCategory as ue}from"../statistics/RendererPerformanceInfo.js";import{RenderState as ce}from"../../../support/RenderState.js";import{PixelFormat as me,PixelType as fe,ClearBufferBit as ge}from"../../../webgl/enums.js";let Te=class extends r{get _bindParameters(){return this._renderContext.bindParameters}updateRenderFeatures(e=null,r=!has("disable-feature:high-quality-idle")){this._renderStateFeatures=ee(r,e),this.notifyChange("_renderStateFeatures"),this._plugins.renderFeatureChanged(),this._requestRender()}isFeatureEnabled(e,r=this._state){return this._renderStateFeatures.get(r,e)??!1}setFeatureEnabled(e,r,t){this._renderStateFeatures.set(r,e,t),this.notifyChange("_renderStateFeatures"),this._requestRender()}get _highQualityTransparency(){return this._highQualityTransparencyEnabled||this.isFeatureEnabled(re.HighQualityTransparency)}get hasReflections(){return(this._pluginsHas.water||this._hasOverlayWater)&&(this._ssrEnabled||this.isFeatureEnabled(re.WaterReflection))}get hasDecorations(){return this._plugins.hasDecorations}get hasHighlights(){return this._plugins.produces(te.OPAQUE_MATERIAL,I.Highlight)||this._plugins.produces(te.DRAPED_MATERIAL,I.Highlight)}get _magnifierEnabled(){return this._bindParameters.decorations===B.ON&&this._magnifierHelper.enabled}get fullResolutionAtmosphere(){return this._stage.view.qualitySettings.highResolutionAtmosphere||this.isFeatureEnabled(re.HighResolutionAtmosphere)}constructor(e,r,t,i,a,n,h,_){super({}),this._stage=e,this._techniqueRepository=i,this._rctx=a,this._compositingHelper=n,this._magnifierHelper=h,this._requestRender=_,this._needsTransparentPass=!1,this._pluginsHas={hudElements:!1,water:!1},this._hasOverlayWater=!1,this.renderOverlay=e=>{},this._isRendering=!1,this._backgroundColor=A(0,0,0,1),this._sliceHelper=new ne,this._renderNodes=new N,this._state=ce.IDLE,this._highQualityTransparencyEnabled=!0,this._terrainTransparency=S.Opaque,this._ssrEnabled=!1,this._hasAnimations=!1,this._animationTimestep=new q,this._renderHiddenTransparentEdges=()=>{},this._pluginInput=new H,this._releaseGeometryLinearDepth=e=>e?.release(),this._geometryLinearDepthFormat=D.DEPTH16_BUFFER,this.fboCache=new O(a),this._renderStateFeatures=ee(!has("disable-feature:high-quality-idle"),e.view.qualityProfile),this._offscreen=new z(this.fboCache,this._compositingHelper),this.performanceInfo=new pe(this._rctx),this._shadowMap=new ie(this.fboCache,e.viewingMode),this._highlight=new x({view:e.view}),this._shadowHighlight=new v({view:e.view,viewingMode:e.viewingMode}),this._shadowAccumulator=new se(this.fboCache,i,e,(e=>{const r=this.shadowsEnabled;this._shadowMap.enabled=!0,this._prepare(e.camera,e.contentCamera),this._plugins.prepareRender(),this._shadowMap.enabled=r}),((e,r,t)=>{const s=this._stage.view.qualitySettings.maximumPixelRatio;e.shadowMap.start(e.camera,r,t,!0,s),this._renderShadowCascades(I.Shadow,e.shadowMap),e.shadowMap.finish(),e.camera.setGLViewport(this._rctx),this._prepare(e.camera,e.contentCamera)}),_),this._ssao=new G({view:this._stage.view}),this._renderContext=new J(this._rctx,this._offscreen,this._shadowMap,this._sliceHelper),this._plugins=new M({renderContext:this._renderContext,techniqueRepository:i,textureRepository:t,materialRepository:r,requestRender:_,controller:e,fbos:this.fboCache,isFeatureEnabled:e=>this.isFeatureEnabled(e)}),this.renderPassManager=new C,this._plugins.add(this.renderPassManager),this._smaa=new U({view:this._stage.view}),this._plugins.add(this._smaa),this._blit=new F({opacity:1,alphaMode:_e.None}),this._plugins.add(this._blit),this._plugins.add(this._ssao),this._plugins.add(this._highlight),this._plugins.add(this._shadowHighlight),this.addHandles([o((()=>this._stage.view.state.camera),(()=>_()),d),o((()=>P.EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES),(e=>{this._renderHiddenTransparentEdges=e?()=>this._renderEdges(de.TRANSPARENT):()=>{},_()}),l),o((()=>this._stage.view.environment.background?.color),(e=>{const r=e?s(e):b;E(this._backgroundColor,r[0]*r[3],r[1]*r[3],r[2]*r[3],r[3]),_()}),d)])}normalizeCtorArgs(){return{}}destroy(){this._gpuTimerHandle=i(this._gpuTimerHandle),this._offscreen.dispose(),this._shadowMap.dispose(),this._highlight.dispose(),this._shadowAccumulator.dispose(),this._edgeView=a(this._edgeView),this.renderPassManager.dispose(),this._releaseFBOs(),this._disposeOffscreenBuffers(),this.fboCache.destroy(),this._plugins.destroy(),Q.prune()}_releaseFBOs(){this._bindParameters.ssr.lastFrameColor=n(this._bindParameters.ssr.lastFrameColor),this._bindParameters.multipassTerrain.linearDepth=n(this._bindParameters.multipassTerrain.linearDepth),this._bindParameters.multipassGeometry.linearDepth=n(this._bindParameters.multipassGeometry.linearDepth)}_disposeOffscreenBuffers(){this._offscreen.dispose(),this._disposeBindBuffers()}_disposeBindBuffers(){this._shadowMap.disposeOffscreenBuffers(),this._bindParameters.linearDepth=n(this._bindParameters.linearDepth),this._bindParameters.hudVisibility=n(this._bindParameters.hudVisibility)}get updating(){return this._smaa.updating||null!=this._edgeView&&this._edgeView.updating||this._shadowAccumulator.running||this._plugins.updating||!this.isCameraFinal}ensureEdgeView(){if(null==this._edgeView){const e=this._stage.view.resourceController;this._edgeView=new oe({rctx:this._rctx,renderSR:this._stage.view.renderSpatialReference,viewingMode:this._stage.viewingMode,techniqueRepository:this._techniqueRepository,setNeedsRender:()=>this._requestRender(),schedule:Oe(e)}),this.addHandles(o((()=>this._edgeView?.updating),(()=>this._requestRender()),_)),this._requestRender()}return this._edgeView}get edgeView(){return this._edgeView}get isCameraFinal(){return c(this._bindParameters.ssr.reprojectionMatrix,g)}set _reprojectionMatrix(e){t(this._bindParameters.ssr.reprojectionMatrix,e)&&this.notifyChange("isCameraFinal")}get shadowsEnabled(){return!!this._shadowMap?.enabled}setParameters(e){const{_shadowMap:r,_bindParameters:t}=this;if(void 0!==e.qualitySettings?.reflections&&this._ssrEnabled!==e.qualitySettings.reflections&&(this._ssrEnabled=e.qualitySettings.reflections,this._requestRender()),void 0!==e.shadowMap&&this._shadowMap.enabled!==e.shadowMap&&(this._shadowMap.enabled=e.shadowMap,this._requestRender()),void 0!==e.shadowMapMaxCascades&&r.maxCascades!==e.shadowMapMaxCascades&&(r.maxCascades=e.shadowMapMaxCascades,this._requestRender()),null!=e.environment){null!=e.environment.weather&&(this._bindParameters.weather=e.environment.weather,this._bindParameters.weatherVisible=!!e.weatherVisible);const r="virtual"!==e.environment.lighting.type;t.enableFillLights!==r&&(t.enableFillLights=r,this._requestRender())}void 0!==e.highQualityTransparency&&this._highQualityTransparencyEnabled!==e.highQualityTransparency&&(this._highQualityTransparencyEnabled=e.highQualityTransparency,this._requestRender()),void 0!==e.hasOverlayWater&&this._hasOverlayWater!==e.hasOverlayWater&&(this._hasOverlayWater=e.hasOverlayWater,this._requestRender()),void 0!==e.slicePlane&&this._sliceHelper.plane!==e.slicePlane&&(this._sliceHelper.plane=e.slicePlane,this._requestRender()),void 0!==e.terrainTransparency&&this._terrainTransparency!==e.terrainTransparency&&(this._terrainTransparency=e.terrainTransparency,this._requestRender()),void 0!==e.shadowCastOptions&&this._shadowAccumulator.setOptions(e.shadowCastOptions)}get hasSlicePlane(){return!!this._sliceHelper.plane}get plugins(){return this._plugins}get _hasOITSupport(){return this._rctx.driverTest.floatBufferBlend.result}get _oitEnabled(){return this._highQualityTransparency&&this._hasOITSupport}modify(e,r){this._isRendering&&console.warn("Renderer.modify called while rendering");const{adds:t,removes:s,updates:i}=e;if(0===t.length&&0===s.length&&0===i.length)return;const a=Z(e);let n=!1;a.forEach(((t,s)=>{if(r.done)return;let i=this._plugins.getMaterialRenderer(s);if(null==i&&t.adds.length>0){const e=new le({material:s});e.initializeRenderContext(this._plugins._context),i=e,this._plugins.add(i)}i&&(i.modify(t),0===i.numGeometries&&(n=!0)),t.removes.forEach((r=>e.removes.removeUnordered(r))),t.adds.forEach((r=>e.adds.removeUnordered(r))),t.updates.forEach((r=>e.updates.removeUnordered(r))),r.madeProgress()})),n&&this._plugins.removeEmptyMaterialRenderers(),this._updateHasFlags(),this._requestRender()}_updateHasFlags(){const has=this._pluginsHas;has.hudElements=this._plugins.produces(te.LINE_CALLOUTS_HUD_DEPTH)||this._plugins.produces(te.HUD_MATERIAL)||this._plugins.produces(te.LABEL_MATERIAL),has.water=this._plugins.produces(te.DRAPED_WATER,I.Normal),this._bindParameters.hasOccludees=this._plugins.hasOccludees}updateAnimation(e){const r=this._hasAnimations;return this._hasAnimations=this._plugins.updateAnimation(e)||this._hasAnimations,this._hasAnimations!==r&&(this._gpuTimerHandle=r?i(this._gpuTimerHandle):this.performanceInfo.enableGPUPerformanceInfo()),this._hasAnimations}get animationTimestep(){return this._animationTimestep.value}get animationTimeDilation(){return this._animationTimestep.timeDilation}resetAnimation(){this._animationTimestep.clear()}tick(){this.fboCache.clean()}render(e,r,t=$.Default,s=B.ON){this._isRendering=!0,this.performanceInfo.startFrame(),this.fboCache.frameStart(),this._disposeBindBuffers();const i=this._offscreen,{camera:a,contentCamera:h,mode:o,alignPixelEnabled:d}=e;this._state=o,this._bindParameters.overlay=this.renderOverlay(r),this.performanceInfo.advance(ue.OVERLAY),this._renderContext.time=r,this._bindParameters.transparencyPassType=he.NONE,this._bindParameters.alignPixelEnabled=d,this._bindParameters.decorations=s,this._bindParameters.mainColor=this._bindParameters.mainDepth=null;const l=R(this._sliceHelper.plane);s===B.OFF&&(this._sliceHelper.plane=null),a.setGLViewport(this._rctx);const _=i.initializeFrame(a,this._backgroundColor,t);this.hasReflections?this._bindParameters.ssr.lastFrameColor=_:_?.release(),this._prepare(a,h),this._plugins.prepareRender(),this.performanceInfo.advance(ue.PREPARE);const p=this._computeDepthRange(a);this._renderShadowMap(a,this._bindParameters.lighting.mainLight.direction,p),this.performanceInfo.advance(ue.SHADOW_MAP),this._ensureBindParameters(a,h);const u=this._plugins.produces(te.OPAQUE_TERRAIN)&&(this._terrainTransparency===S.Semitransparent||this._terrainTransparency===S.TransparentWithDraped),c=this._highQualityTransparency&&u;this._prepareShaders(c,this._needsTransparentPass),this._renderLinearDepthForSSAO(),this.performanceInfo.advance(ue.LINEAR_DEPTH_SSAO);let m=this._renderNormals();this.performanceInfo.advance(ue.NORMALS);let f=m?.detachDepth();this._renderSSAO(m),m&&!this._renderNodes.consumes("normals")&&(m.release(),m=null),this.performanceInfo.advance(ue.SSAO),this._renderLinearDepth(f),f=n(f),this.performanceInfo.advance(ue.LINEAR_DEPTH),this._renderShadowAccumulation(p,a,h),this.performanceInfo.advance(ue.ACCUMULATED_SHADOWS),this._ensureBindParametersSSR(r),this._renderContext.output=I.Color,i.bindFbo(),this._bindParameters.mainColor=i.colorTexture,this._bindParameters.mainDepth=i.depthTexture,this._renderOpaqueGeometry(),this._plugins.render(te.ENVIRONMENT_OPAQUE),this.performanceInfo.advance(ue.OPAQUE),this.fboCache.debugCallback&&this.fboCache.debugCallback("opaque color",this._offscreen.color.fbo),this._renderTerrainLinearDepth(c),this._setMultipassTerrain(c),this._renderEdges(de.OPAQUE),this.performanceInfo.advance(ue.OPAQUE_EDGES),i.bindFbo(),this._plugins.render(te.VOXEL),this.performanceInfo.advance(ue.VOXEL),this._renderHiddenTransparentEdges(),this._needsTransparentPass&&(this._oitEnabled?this._renderOITPass(Ee.Geometry):this._renderTransparentMaterial()),this.performanceInfo.advance(ue.TRANSPARENT);const g=this._renderGeometryLinearDepth(c);this._renderHUDVisibility(g),c||this._plugins.render(te.LINE_CALLOUTS),this.performanceInfo.advance(ue.HUD_VISIBILITY);const T=t===$.ObjectAndLayerID?this._renderObjectAndLayerIdColor():null;this.performanceInfo.advance(ue.OBJECT_AND_LAYER_ID_COLOR),this._renderEdges(de.TRANSPARENT,g),this._releaseGeometryLinearDepth(g),this.performanceInfo.advance(ue.TRANSPARENT_EDGES);const E=u?this._renderTransparentTerrain():null;E&&this._bindParameters.hudVisibility&&(c?this._renderLineCallouts(w.Occluded):i.compositeToHUDVisibility(this._bindParameters,E.colorTexture),this._renderHUD(w.Occluded,i.color),this.performanceInfo.advance(ue.HUD_OCCLUDED)),this.performanceInfo.advance(ue.TRANSPARENT_TERRAIN),this._setTerrainCulling(!1),E&&(i.compositeToFramebuffer(this._bindParameters,E.colorTexture,_e.PremultipliedAlpha,1),E.release(),c&&(this._renderEdges(de.OPAQUE),this.performanceInfo.advance(ue.OPAQUE_EDGES),this._needsTransparentPass&&(this._oitEnabled?this._renderOITPass(Ee.Geometry):this._renderTransparentMaterial()),this.performanceInfo.advance(ue.TRANSPARENT),this._renderEdges(de.TRANSPARENT),this.performanceInfo.advance(ue.TRANSPARENT_EDGES))),this._bindParameters.ssao=n(this._bindParameters.ssao),c&&this._renderLineCallouts(w.NotOccluded),this._setMultipassEnabled(!1),this._shadowAccumulator.render(this._bindParameters),i.bindFbo(),this._plugins.render(te.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL),this._plugins.render(te.ENVIRONMENT_TRANSPARENT),this.performanceInfo.advance(ue.ENVIRONMENT),this._renderLaserlines(),this.performanceInfo.advance(ue.LASER_LINES),this._renderOccluded(),this.performanceInfo.advance(ue.OCCLUDED);const A=this._renderHighlightPrepass(),b=this._magnifierEnabled&&t===$.Default?this.fboCache.acquire(this._offscreen.width,this._offscreen.height,"magnifier"):null,P=t!==$.Default?this.fboCache.acquire(this._offscreen.width,this._offscreen.height,"screenshot"):null,D=this._renderComposite(b??P,this._offscreen.color,m,A)??P;return m?.release(),this.performanceInfo.advance(ue.ANTIALIASING),this._renderHUD(w.NotOccluded,D),this.performanceInfo.advance(ue.HUD),this._renderHighlights(D,A,this._bindParameters),A?.release(),this.performanceInfo.advance(ue.HIGHLIGHTS),this._magnifierEnabled&&this._magnifierHelper.render(this._rctx,this._bindParameters),D!==P&&(this._rctx.bindFramebuffer(P?.fbo),this._compositingHelper.composite(this._bindParameters,b?.colorTexture,_e.None)),t===$.Default&&b?.release(),this.onPostRender&&this.onPostRender(),this._releaseFBOs(),this._offscreen.releaseBuffers(),this._renderContext.lastFrameCamera.copyFrom(this._bindParameters.camera),this._sliceHelper.plane=l,this._isRendering=!1,this.fboCache.frameEnd(),this.performanceInfo.finishFrame(),t!==$.Default&&(this._releaseFBOs(),this._disposeOffscreenBuffers()),{screen:P,oid:T}}_prepareShaders(e,r){this._renderContext.output=I.Color,this._prepareOpaqueGeometry(),this._setMultipassTerrain(e),this._plugins.prepare(te.TRANSPARENT_TERRAIN),this._setMultipassTerrain(!1),e||this._plugins.prepare(te.LINE_CALLOUTS),r&&this._prepareTransparencySlots(),this._plugins.prepare(te.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL),this._plugins.prepare(te.ENVIRONMENT_TRANSPARENT),this._plugins.prepare(te.LASERLINES),this._rctx.gl.flush()}_renderObjectAndLayerIdColor(){if(!has("enable-feature:objectAndLayerId-rendering"))return;const e=this._renderContext.output,r=this.fboCache.acquire(this._offscreen.width,this._offscreen.height,"oid");return r.acquireDepth(D.DEPTH_STENCIL_TEXTURE),this._rctx.bindFramebuffer(r.fbo),this._offscreen.renderToFBO((()=>this._renderAllGeometry(I.ObjectAndLayerIdColor)),[0,0,0,0],!0,!0),this._rctx.bindFramebuffer(r.fbo),this._offscreen.renderToFBO((()=>{this._bindParameters.hudRenderStyle=w.NotOccluded,this._plugins.render(te.HUD_MATERIAL)}),void 0,!0,!0),this._renderContext.output=e,r}finish(e){this._hasAnimations||this._animationTimestep.clear();const r=this.performanceInfo.gpuSamplingEnabled,t=e===j.BACKGROUND;if(t||r){const e=t?this.performanceInfo.elapsedTime:0,s=r?this.performanceInfo.totalGPUTimeSampler.last:this._rctx.gl.getError(),i=Math.max(e,s);this._animationTimestep.frame(i,t)}}readDepthPixels(e,r,t){const s=this._bindParameters.linearDepth?.fbo;if(s?.colorTexture)return void s.readPixels(r[0],r[1],r[2],r[3],me.RGBA,fe.UNSIGNED_BYTE,t);const i=this.fboCache.acquire(this._offscreen.width,this._offscreen.height,"depth").acquireDepth(D.DEPTH16_BUFFER);this._rctx.bindFramebuffer(i.fbo),this._ensureBindParameters(e,e),this._bindParameters.camera.setGLViewport(this._rctx),this._rctx.setClearColor(0,0,0,0);const a=ge.COLOR_BUFFER_BIT|ge.DEPTH_BUFFER_BIT|ge.STENCIL_BUFFER_BIT;this._rctx.clearSafe(a),this._renderAllGeometry(I.Depth),i.fbo.readPixels(r[0],r[1],r[2],r[3],me.RGBA,fe.UNSIGNED_BYTE,t),i.release()}readHUDVisibility(e,r,t,s,i){this._bindParameters.hudVisibility?.fbo.readPixels(e,r,t,s,me.RGBA,fe.UNSIGNED_BYTE,i)}readAccumulatedShadow(e){return this._shadowAccumulator.readAccumulatedShadow(e[0],e[1])}_setMultipassTerrain(e){this._setMultipassEnabled(e),this._setTerrainCulling(e)}_setMultipassEnabled(e){this._bindParameters.multipassEnabled=e}_setTerrainCulling(e){this._bindParameters.multipassTerrain.cullAboveGround=e}_renderEdges(e,r){const t=this._edgeView;if(t?.shouldRender()){const{width:s,height:i,depth:a}=this._offscreen,n=this.fboCache.acquire(s,i,"edges"),h=()=>t.render(this._bindParameters,e);this._offscreen.renderToTargets(h,n,r??a,be),this._offscreen.compositeToFramebuffer(this._bindParameters,n.colorTexture,_e.Alpha,1),n.release()}}_renderShadowMap(e,r,t){const s=this._shadowMap;s.enabled&&(s.start(e,r,t,this.isFeatureEnabled(re.HighResolutionShadows),this._stage.view.qualitySettings.maximumPixelRatio),this._shadowHighlight.updateParameters(e,r),this._needsShadowHighlight?(this._renderShadowCascades(I.ShadowHighlight,this._shadowMap),s.moveSnapshot(ae.Highlight),this._renderShadowCascades(I.ShadowExcludeHighlight,this._shadowMap),s.copySnapshot(ae.ExcludeHighlight),this._renderShadowCascades(I.ShadowHighlight,this._shadowMap)):this._renderShadowCascades(I.Shadow),s.finish(),e.setGLViewport(this._rctx))}_renderShadowCascades(e,r=this._shadowMap){for(const t of r.cascades)t.camera.setGLViewport(this._rctx),this._prepare(t.camera,t.camera),this._renderAllGeometry(e)}get _needsLinearDepth(){return this._plugins.consumes(I.Depth)||this._renderNodes.consumes("linear-depth")||this.hasReflections||this._needsShadowHighlight||this._needsShadowCast}_renderLinearDepthForSSAO(){this._plugins.produces(te.SSAO)&&(this._bindParameters.linearDepth=this._offscreen.renderToCachedFBO(this._bindParameters.linearDepth,"linear-depth",(()=>this._renderGeometryForSSAO(I.Depth)),[0,0,0,0],y.RGBA,D.DEPTH_STENCIL_TEXTURE),this._bindParameters.linearDepth.releaseDepth())}_renderLinearDepth(e){if(this._needsLinearDepth){if(this._plugins.produces(te.SSAO)&&e&&this._bindParameters.linearDepth)return this._bindParameters.linearDepth.attachDepth(e),this._rctx.bindFramebuffer(this._bindParameters.linearDepth.fbo),this._offscreen.renderToFBO((()=>this._renderGeometryExcludedFromSSAO(I.Depth))),void this._bindParameters.linearDepth.detachDepth();this._bindParameters.linearDepth=this._offscreen.renderToCachedFBO(this._bindParameters.linearDepth,"linear-depth",(()=>this._renderAllGeometry(I.Depth)),[0,0,0,0],y.RGBA,D.DEPTH_STENCIL_TEXTURE),this._bindParameters.linearDepth.releaseDepth()}else this._bindParameters.linearDepth=n(this._bindParameters.linearDepth)}_renderTerrainLinearDepth(e){if(e){const e=this._renderContext.output;this._renderContext.output=I.Depth,this._bindParameters.multipassTerrain.linearDepth=this._offscreen.renderToCachedFBO(this._bindParameters.multipassTerrain.linearDepth,"terrain depth",(()=>this._renderTransparentTerrain()),[-1e10,-1e10,-1e10,1]),this._bindParameters.multipassTerrain.linearDepth.releaseDepth(),this._renderContext.output=e}else this._bindParameters.multipassTerrain.linearDepth=n(this._bindParameters.multipassTerrain.linearDepth)}_renderGeometryLinearDepth(e){if(!e)return void(this._bindParameters.multipassGeometry.linearDepth=n(this._bindParameters.multipassGeometry.linearDepth));const r=this._renderContext.output;return this._bindParameters.multipassGeometry.linearDepth=this._offscreen.renderToCachedFBO(this._bindParameters.multipassGeometry.linearDepth,"geometry depth",(()=>this._renderOpaqueGeometryAndTransparentMaterial(I.Depth)),[1,1,1,1],y.RGBA,this._geometryLinearDepthFormat),this._renderContext.output=r,this._bindParameters.multipassGeometry.linearDepth.detachDepth()}get _needsDepthRange(){return this._shadowMap.enabled||this._needsShadowCast}_computeDepthRange(e){if(!this._needsDepthRange)return W;const r=X(e,this._plugins.plugins,this._stage.layers);return k(r,this._plugins.queryDepthRange(e)),r.near=Math.max(e.near,r.near),r.far=Math.min(e.far,r.far),r}_renderNormals(){if(!this._renderNodes.consumes("normals")&&!this._plugins.produces(te.SSAO))return;return this._offscreen.renderToCachedFBO(null,"normals",(()=>this._renderGeometryForSSAO(I.Normal)),[0,0,0,0],y.RGBA,D.DEPTH_STENCIL_TEXTURE)}_renderSSAO(e){this._plugins.produces(te.SSAO)&&(this._pluginInput.normals=e,this._bindParameters.ssao=this._plugins.render(te.SSAO,this._pluginInput))}_renderAllGeometry(e){this._renderContext.output=e,this._plugins.prepare(te.TRANSPARENT_TERRAIN),this._renderOpaqueGeometryAndTransparentMaterial(e),this._renderTransparentTerrain()}_renderOpaqueGeometryAndTransparentMaterial(e){this._renderContext.output=e,this._plugins.prepare(te.TRANSPARENT_MATERIAL),this._plugins.prepare(te.TRANSPARENT_NO_SSAO_DEPTH),this._renderOpaqueGeometry(),this._renderTransparentMaterial()}_renderGeometryForSSAO(e){this._renderContext.output=e,this._plugins.render(te.INTEGRATED_MESH),this._plugins.render(te.OPAQUE_TERRAIN),this._plugins.render(te.OPAQUE_MATERIAL),this._plugins.render(te.TRANSPARENT_MATERIAL),this._renderTransparentTerrain()}_renderGeometryExcludedFromSSAO(e){this._renderContext.output=e,this._plugins.render(te.OPAQUE_NO_SSAO_DEPTH),this._plugins.render(te.TRANSPARENT_NO_SSAO_DEPTH)}_prepareOpaqueGeometry(){this._plugins.prepare(te.INTEGRATED_MESH),this._plugins.prepare(te.OPAQUE_TERRAIN),this._plugins.prepare(te.OPAQUE_MATERIAL),this._plugins.prepare(te.OPAQUE_NO_SSAO_DEPTH),this._plugins.prepare(te.ENVIRONMENT_OPAQUE)}_renderOpaqueGeometry(){this._plugins.render(te.INTEGRATED_MESH),this._plugins.render(te.OPAQUE_TERRAIN),this._plugins.render(te.OPAQUE_MATERIAL),this._plugins.render(te.OPAQUE_NO_SSAO_DEPTH)}_renderTransparentMaterial(){this._plugins.render(te.TRANSPARENT_MATERIAL),this._plugins.render(te.TRANSPARENT_NO_SSAO_DEPTH)}_renderTransparentTerrain(){if(!this._plugins.produces(te.TRANSPARENT_TERRAIN))return;const e=()=>this._plugins.render(te.TRANSPARENT_TERRAIN,null);if(this._renderContext.output!==I.Color)return void e();const{width:r,height:t,depth:s}=this._offscreen,i=this.fboCache.acquire(r,t,"transparent terrain");return this._offscreen.renderToTargets(e,i,s,[0,0,0,0]),i}_renderHUDVisibility(e){this._plugins.produces(te.OCCLUSION_PIXELS)?(this._bindParameters.hudVisibility=this._offscreen.renderHUDVisibility(this._bindParameters.hudVisibility,(()=>this._plugins.render(te.OCCLUSION_PIXELS)),e),this._offscreen.bindFbo()):this._bindParameters.hudVisibility=n(this._bindParameters.hudVisibility)}_renderLineCallouts(e){if(this._bindParameters.hudRenderStyle=e,e===w.Occluded){const e=()=>{this._plugins.render(te.LINE_CALLOUTS)},{width:r,height:t,color:s}=this._offscreen,i=this.fboCache.acquireDepth(D.DEPTH16_BUFFER,r,t,"line callouts");this._offscreen.renderToTargets(e,s,i,void 0,!0,!0),i.release()}else this._plugins.render(te.LINE_CALLOUTS)}_renderLaserlines(){if(this._plugins.render(te.LASERLINES),this._plugins.produces(te.LASERLINES_CONTRAST_CONTROL)){const e=this._offscreen,{width:r,height:t,depth:s}=e,i=this.fboCache.acquire(r,t,"laser lines"),a=()=>this._plugins.render(te.LASERLINES_CONTRAST_CONTROL);e.renderToTargets(a,i,s,be),e.compositeToFramebuffer(this._bindParameters,i.colorTexture,_e.PremultipliedAlpha,1),i.release()}}_renderHUD(e,r){if(this._pluginsHas.hudElements)if(this._oitEnabled){const t=this._renderOITPass(Ee.HUD,e);this._rctx.bindFramebuffer(r?.fbo),this._compositingHelper.composite(this._bindParameters,t.colorTexture,_e.PremultipliedAlpha),t.release()}else if(e===w.Occluded){const r=()=>this._renderHUDElements(e),{width:t,height:s,color:i}=this._offscreen,a=this.fboCache.acquireDepth(D.DEPTH16_BUFFER,t,s,"hud");this._offscreen.renderToTargets(r,i,a,void 0,!0,!0),a.release()}else this._rctx.bindFramebuffer(null),r?.acquireDepth(D.DEPTH16_BUFFER),this._rctx.bindFramebuffer(r?.fbo),this._renderHUDElements(e),r?.releaseDepth()}_renderHUDElements(e){this._bindParameters.hudRenderStyle=e,this._plugins.prepare(te.LINE_CALLOUTS_HUD_DEPTH),this._plugins.prepare(te.HUD_MATERIAL),this._plugins.prepare(te.LABEL_MATERIAL),this._plugins.render(te.LINE_CALLOUTS_HUD_DEPTH),this._plugins.render(te.HUD_MATERIAL),this._plugins.render(te.LABEL_MATERIAL)}get _needsShadowHighlight(){return this._shadowMap.enabled&&this._plugins.produces(te.SHADOW_HIGHLIGHT)&&this._plugins.produces(te.OPAQUE_MATERIAL,I.ShadowHighlight)}_renderHighlightPrepass(){if(!this.hasHighlights&&!this._renderNodes.consumes("highlight"))return;const e=()=>{this._renderAllGeometry(I.Highlight),this._rctx.clearSafe(ge.DEPTH_BUFFER_BIT),this._renderHUDElements(w.Both)},r=this._offscreen.renderToCachedFBO(null,"highlight",e,[0,0,0,0],y.RGBA4,D.DEPTH_STENCIL_TEXTURE);return r.releaseDepth(),r}_renderHighlights(e,r,t){this.hasHighlights&&t.decorations!==B.OFF&&(this._needsShadowHighlight&&(this._pluginInput.highlight=r,this._plugins.render(te.SHADOW_HIGHLIGHT,this._pluginInput,e)),this._plugins.produces(te.HIGHLIGHT)&&(this._pluginInput.composite=null,this._pluginInput.normals=null,this._pluginInput.highlight=r,this._plugins.render(te.HIGHLIGHT,this._pluginInput,e)))}get _needsShadowCast(){return this._shadowAccumulator.isAccumulating}_renderShadowAccumulation(e,r,t){this._needsShadowCast&&this._bindParameters.linearDepth?.colorTexture&&this._shadowAccumulator.renderAccumulation(this._bindParameters.linearDepth,e,r,t)}_prepareTransparencySlots(){this._renderContext.output=I.Alpha,this._bindParameters.transparencyPassType=he.Alpha,this._plugins.prepare(te.TRANSPARENT_MATERIAL),this._renderContext.output=I.Color,this._bindParameters.transparencyPassType=he.Color,this._plugins.prepare(te.TRANSPARENT_MATERIAL),this._bindParameters.transparencyPassType=he.FrontFace,this._plugins.prepare(te.TRANSPARENT_MATERIAL),this._bindParameters.transparencyPassType=he.NONE}_renderOITPass(e,r=w.Both){const t=e===Ee.HUD,s=t?this.fboCache.acquire(this._offscreen.width,this._offscreen.height,"oit hud composite"):null,i=t?()=>this._renderHUDElements(r):()=>this._renderTransparentMaterial(),a=this._renderContext.output;this._renderContext.output=I.Alpha,this._bindParameters.transparencyPassType=he.Alpha;const n=this._offscreen.renderOITPass(i,he.Alpha,t);this._renderContext.output=I.Color,this._bindParameters.transparencyPassType=he.Color;const h=this._offscreen.renderOITPass(i,he.Color,t);this._bindParameters.transparencyPassType=he.FrontFace;const o=this._offscreen.renderOITPass(i,he.FrontFace,t);return this._offscreen.compositeTransparentOntoOpaque(this._bindParameters,h,n,o,s),s?.releaseDepth(),o.release(),h.release(),n.release(),this._bindParameters.transparencyPassType=he.NONE,this._renderContext.output=a,s}_renderOccluded(){let e=0;Re.clear(),this._plugins.plugins.forAll((r=>{if(!r.materialReference)return;r.queryRenderOccludedState(Y.OccludeAndTransparentStencil)&&(e|=Y.OccludeAndTransparentStencil,Re.push(r))}));const r=this._offscreen,t=(t,s,i,a,n)=>{if(0==(e&s))return;const{width:h,height:o,depth:d}=r,l=this.fboCache.acquire(h,o,"tmp color");r.renderToTargets(i,l,d,[0,0,0,0],a,n),r.compositeToFramebuffer(this._bindParameters,l.colorTexture,_e.PremultipliedAlpha,t),l.release()},s=(e,r)=>{this._bindParameters.slot=e,r.forAll((e=>{if(L(e)){const r=e.prepareTechnique(this._renderContext);r&&e.renderNode(this._renderContext,r)}}))};0!==Re.length&&(s(te.OCCLUDER_MATERIAL,Re),t(.5,Y.OccludeAndTransparentStencil,(()=>s(te.TRANSPARENT_OCCLUDER_MATERIAL,Re)),!1,!1)),Re.clear(),this._plugins.plugins.forAll((r=>{if(!r.materialReference)return;const t=r.queryRenderOccludedState(Y.OccludeAndTransparent),s=r.queryRenderOccludedState(Y.Transparent),i=r.queryRenderOccludedState(Y.Opaque);(t||s||i)&&(e|=t?Y.OccludeAndTransparent:s?Y.Transparent:Y.Opaque,Re.push(r))}));const i=this._plugins.renderOccludedFlags;if(e|=i,!e)return;const a=e=>{this._renderContext.renderOccludedMask=e,i>Y.Occlude&&this._plugins.render(te.OCCLUDED_TERRAIN),s(te.OPAQUE_MATERIAL,Re),s(te.TRANSPARENT_MATERIAL,Re),s(te.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL,Re),this._renderContext.renderOccludedMask=K};this._renderContext.output=I.Color,t(.5,Y.OccludeAndTransparent,(()=>a(Y.OccludeAndTransparent)),!0,V.OutlineVisualElementMask),t(.5,Y.Transparent,(()=>a(Y.Transparent)),!0,V.OutlineVisualElementMask),t(1,Y.Opaque,(()=>a(Y.Opaque)),!0,V.OutlineVisualElementMask),Re.clear()}_renderComposite(e,r,t,s){this._pluginInput.composite=r;let i=null;const a=this._renderNodes.produces("composite-color");a&&(this._pluginInput.linearDepth=this._bindParameters.linearDepth,this._pluginInput.normals=t,this._pluginInput.highlight=s,i=this._renderNodes.render(this._pluginInput,"composite-color"),this._pluginInput.composite=i);const n=this._plugins.produces(te.ANTIALIASING),h=this._plugins.render(n?te.ANTIALIASING:te.BLIT,this._pluginInput,e);return a&&i?.release(),h}_prepare(e,r){this._needsTransparentPass=this._plugins.produces(te.TRANSPARENT_MATERIAL,I.Color),this._bindParameters.camera=e,this._bindParameters.contentCamera=r}_ensureBindParameters(e,r){this._bindParameters.camera=e,this._bindParameters.contentCamera=r}_ensureBindParametersSSR(e){if(this._bindParameters.ssr.lastFrameColor){null==this._ssrEnableTime&&(this._ssrEnableTime=e),this._renderContext.lastFrameCamera.equals(this._bindParameters.camera)?this._reprojectionMatrix=g:(m(Se,this._bindParameters.camera.viewMatrix),m(Pe,this._bindParameters.camera.projectionMatrix),f(De,Se,Pe),f(De,this._renderContext.lastFrameCamera.viewMatrix,De),f(De,this._renderContext.lastFrameCamera.projectionMatrix,De),this._reprojectionMatrix=De);const r=this._stage.view.qualitySettings.fadeDuration;this._bindParameters.ssr.fadeFactor=r>0?Math.min(r,e-this._ssrEnableTime)/r:1,this._bindParameters.ssr.fadeFactor<1&&this._requestRender()}else this._reprojectionMatrix=g,this._ssrEnableTime=null}addRenderNode(e){this._renderNodes.add(e),this._requestRender()}removeRenderNode(e){this._renderNodes.remove(e),this._requestRender()}get usedMemory(){return{fbos:this.fboCache.usedMemory,plugins:this._plugins.usedMemory,edges:this.edgeView?.usedMemory??0}}get test(){const e=this;return{offscreen:this._offscreen,shadowMap:this._shadowMap,highlight:this._highlight,lighting:this._bindParameters.lighting,renderPlugins:this._plugins,shadowAccumulator:this._shadowAccumulator,weatherIsFading:this._bindParameters.cloudsFade.isFading,resetRenderStateFeatures:()=>{e._renderStateFeatures=ee(),this._plugins.renderFeatureChanged(),this._requestRender()},releaseGeometryLinearDepth(r){e._releaseGeometryLinearDepth=r??(e=>e?.release()),e._geometryLinearDepthFormat=r?D.DEPTH_STENCIL_TEXTURE:D.DEPTH16_BUFFER},getFramebufferTexture:r=>{switch(r){case Ae.Color:return e._offscreen.colorTexture;case Ae.LinearDepth:return e._bindParameters.linearDepth?.colorTexture;case Ae.ShadowMap:return e._shadowMap.depthTexture;case Ae.HudVisibility:return e._bindParameters.hudVisibility?.colorTexture}}}}};var Ee,Ae;e([p()],Te.prototype,"_plugins",void 0),e([p()],Te.prototype,"_shadowAccumulator",void 0),e([p()],Te.prototype,"_state",void 0),e([p()],Te.prototype,"_renderStateFeatures",void 0),e([p({readOnly:!0})],Te.prototype,"fullResolutionAtmosphere",null),e([p()],Te.prototype,"_smaa",void 0),e([p()],Te.prototype,"_blit",void 0),e([p({autoDestroy:!0})],Te.prototype,"_edgeView",void 0),e([p()],Te.prototype,"updating",null),e([p()],Te.prototype,"isCameraFinal",null),Te=e([u("esri.views.3d.webgl-engine.lib.Renderer")],Te),function(e){e[e.Geometry=0]="Geometry",e[e.HUD=1]="HUD"}(Ee||(Ee={})),function(e){e[e.Color=0]="Color",e[e.LinearDepth=1]="LinearDepth",e[e.ShadowMap=2]="ShadowMap",e[e.HudVisibility=3]="HudVisibility"}(Ae||(Ae={}));const be=[0,0,0,0],Re=new h,Pe=T(),Se=T(),De=T();function Oe(e){return r=>e.immediate.schedule(r)}export{Ae as FramebufferId,Te as Renderer};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import has from"../../../../core/has.js";import{clamp as t,lerp as s,acosClamped as e}from"../../../../core/mathUtils.js";import{releaseMaybe as i}from"../../../../core/maybe.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{translate as r,multiply as h,invert as o,lookAt as c}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as n,create as l}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as d,add as _,scale as u,lerp as m,squaredDistance as f,subtract as g,dot as p,negate as x,normalize as b,copy as w}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as M}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{h as C,c as T,C as j,e as y,s as H}from"../../../../chunks/vec32.js";import{create as D}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{s as v,t as S}from"../../../../chunks/vec42.js";import{create as F}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{ViewingMode as R}from"../../../ViewingMode.js";import{ColorFormat as E,DepthFormat as O}from"../core/FBOCache.js";import{CascadeCamera as U}from"./CascadeCamera.js";import{applyTextureResizeModulo as B,applyTextureResizeFloorModulo as L}from"./textureUtils.js";import{assert as N,logWithBase as Q,verify as V,rayRay2D as I}from"./Util.js";import{TextureType as A,ClearBufferBit as W}from"../../../webgl/enums.js";import{Texture as z}from"../../../webgl/Texture.js";var P;!function(t){t[t.Highlight=0]="Highlight",t[t.ExcludeHighlight=1]="ExcludeHighlight"}(P||(P={}));class q{constructor(){this.camera=new U,this.lightMat=l()}}class G{constructor(){this.maxNumCascadesHighQuality=4,this.maxNumCascadesLowQuality=4,this.textureSizeModHighQuality=1.3,this.textureSizeModLowQuality=.9,this.splitSchemeLambda=0}}class X{constructor(t,s){this._fbos=t,this._viewingMode=s,this._enabled=!1,this._snapshots=new Array,this._textureHeight=0,this._numCascades=1,this.settings=new G,this._projectionView=l(),this._projectionViewInverse=l(),this._modelViewLight=l(),this._cascadeDistances=[0,0,0,0,0],this._usedCascadeDistances=F(),this._cascades=[new q,new q,new q,new q],this._lastOrigin=null,this._maxTextureWidth=Math.min(has("esri-mobile")?4096:16384,t.rctx.parameters.maxTextureSize)}dispose(){this.enabled=!1,this.disposeOffscreenBuffers()}get depthTexture(){return this._handle?.colorTexture}get _textureWidth(){return this._textureHeight*this._numCascades}get numCascades(){return this._numCascades}get cascadeDistances(){return v(this._usedCascadeDistances,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)}disposeOffscreenBuffers(){this._handle=i(this._handle),this._discardSnapshots()}set maxCascades(s){this.settings.maxNumCascadesHighQuality=t(Math.floor(s),1,4)}get maxCascades(){return this.settings.maxNumCascadesHighQuality}set enabled(t){this._enabled=t,t||this.disposeOffscreenBuffers()}get enabled(){return this._enabled}get ready(){return this._enabled&&null!=this.depthTexture}get cascades(){for(let t=0;t<this._numCascades;++t)it[t]=this._cascades[t];return it.length=this._numCascades,it}start(t,s,e,i,a){N(this.enabled);const{near:r,far:h}=this._clampNearFar(e);this._computeCascadeDistances(r,h,i),this._textureHeight=this._computeTextureHeight(t,a,i),this._setupMatrices(t,s);const{viewMatrix:o,projectionMatrix:c}=t;for(let n=0;n<this._numCascades;++n)this._constructCascade(n,c,o,s);this._lastOrigin=null,this.clear()}finish(){N(this.enabled),this._handle?.releaseDepth()}getShadowMapMatrices(t){if(!this._lastOrigin||!C(t,this._lastOrigin)){this._lastOrigin=this._lastOrigin||D(),T(this._lastOrigin,t);for(let s=0;s<this._numCascades;++s){r(at,this._cascades[s].lightMat,t);for(let t=0;t<16;++t)rt[16*s+t]=at[t]}}return rt}moveSnapshot(t){N(this.enabled),this._handle?.releaseDepth(),this._snapshots[t]?.release(),this._snapshots[t]=this._handle,this._handle=null,this.clear()}copySnapshot(t){const s=this._handle?.colorTexture?.descriptor;if(!this.enabled||!s)return;this._snapshots[t]?.release();const{width:e,height:i}=s,a=t===P.Highlight?"shadow highlight snapshot":"shadow no highlight snapshot";this._snapshots[t]=this._fbos.acquire(E.RGBA4,e,i,a);const r=this._fbos.rctx;this._bindFbo();const h=r.bindTexture(this._snapshots[t]?.colorTexture,z.TEXTURE_UNIT_FOR_UPDATES);r.gl.copyTexSubImage2D(A.TEXTURE_2D,0,0,0,0,0,e,i),r.bindTexture(h,z.TEXTURE_UNIT_FOR_UPDATES)}getSnapshot(t){return this.enabled?this._snapshots[t]?.colorTexture:null}clear(){const t=this._fbos.rctx;this._ensureFbo(),this._bindFbo(),t.setClearColor(1,1,1,1),t.clearSafe(W.COLOR_BUFFER_BIT|W.DEPTH_BUFFER_BIT)}_computeTextureHeight(t,s,e){const i=Math.min(window.devicePixelRatio,s)/t.pixelRatio,a=e?this.settings.textureSizeModHighQuality:this.settings.textureSizeModLowQuality,r=B(Math.floor(Math.max(t.fullWidth,t.fullHeight)*i*a)),h=Math.min(this._maxTextureWidth,this._numCascades*r);return L(h/this._numCascades)}_ensureFbo(){this._handle?.fbo.width===this._textureWidth&&this._handle?.fbo.height===this._textureHeight||(this._handle?.release(),this._handle=this._fbos.acquire(E.RGBA4,this._textureWidth,this._textureHeight,"shadow map")),this._handle.acquireDepth(O.DEPTH16_BUFFER)}_discardSnapshot(t){this._snapshots[t]=i(this._snapshots[t])}_discardSnapshots(){for(let t=0;t<this._snapshots.length;++t)this._discardSnapshot(t);this._snapshots.length=0}_bindFbo(){const t=this._fbos.rctx;t.unbindTexture(this.depthTexture),t.bindFramebuffer(this._handle?.fbo)}_constructCascade(t,s,e,i){const a=this._cascades[t],o=-this._cascadeDistances[t],c=-this._cascadeDistances[t+1],n=(s[10]*o+s[14])/Math.abs(s[11]*o+s[15]),l=(s[10]*c+s[14])/Math.abs(s[11]*c+s[15]);N(n<l);for(let r=0;r<8;++r){v(J,r%4==0||r%4==3?-1:1,r%4==0||r%4==1?-1:1,r<4?n:l,1);const t=K[r];S(t,J,this._projectionViewInverse),t[0]/=t[3],t[1]/=t[3],t[2]/=t[3]}j(et,K[0]),a.camera.viewMatrix=r(k,this._modelViewLight,et);for(let r=0;r<8;++r)y(K[r],K[r],a.camera.viewMatrix);let d=K[0][2],_=K[0][2];for(let r=1;r<8;++r)d=Math.min(d,K[r][2]),_=Math.max(_,K[r][2]);d-=200,_+=200,a.camera.near=-_,a.camera.far=-d,Tt(e,i,d,_,a.camera),h(a.lightMat,a.camera.projectionMatrix,a.camera.viewMatrix);const u=this._textureHeight;a.camera.viewport=[t*u,0,u,u]}_setupMatrices(t,s){h(this._projectionView,t.projectionMatrix,t.viewMatrix),o(this._projectionViewInverse,this._projectionView);const e=this._viewingMode===R.Global?t.eye:H(et,0,0,1);c(this._modelViewLight,[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,e,i){const a=i?this.settings.maxNumCascadesHighQuality:this.settings.maxNumCascadesLowQuality;this._numCascades=Math.min(1+Math.floor(Q(e/t,4)),a);const r=(e-t)/this._numCascades,h=(e/t)**(1/this._numCascades);let o=t,c=t;for(let n=0;n<this._numCascades+1;++n)this._cascadeDistances[n]=s(o,c,this.settings.splitSchemeLambda),o*=h,c+=r}get test(){return{cascades:this._cascades,textureHeight:this._textureHeight}}}const k=l(),J=F(),K=[];for(let jt=0;jt<8;++jt)K.push(F());const Y=M(),Z=M(),$=M(),tt=M(),st=M(),et=D(),it=[],at=l(),rt=n.concat(n,n,n,n),ht=M(),ot=M(),ct=[M(),M(),M(),M()],nt=M(),lt=M(),dt=M(),_t=M(),ut=M(),mt=M(),ft=M();function gt(t,s,e,i,a,r,h,o){d(ht,0,0);for(let d=0;d<4;++d)_(ht,ht,t[d]);u(ht,ht,.25),d(ot,0,0);for(let d=4;d<8;++d)_(ot,ot,t[d]);u(ot,ot,.25),m(ct[0],t[4],t[5],.5),m(ct[1],t[5],t[6],.5),m(ct[2],t[6],t[7],.5),m(ct[3],t[7],t[4],.5);let c=0,n=f(ct[0],ht);for(let d=1;d<4;++d){const t=f(ct[d],ht);t<n&&(n=t,c=d)}g(nt,ct[c],t[c+4]);const l=nt[0];let M,C;nt[0]=-nt[1],nt[1]=l,g(lt,ot,ht),p(lt,nt)<0&&x(nt,nt),m(nt,nt,lt,e),b(nt,nt),M=C=p(g(dt,t[0],ht),nt);for(let d=1;d<8;++d){const s=p(g(dt,t[d],ht),nt);s<M?M=s:s>C&&(C=s)}w(i,ht),u(dt,nt,M-s),_(i,i,dt);let T=-1,j=1,y=0,H=0;for(let d=0;d<8;++d){g(_t,t[d],i),b(_t,_t);const s=nt[0]*_t[1]-nt[1]*_t[0];s>0?s>T&&(T=s,y=d):s<j&&(j=s,H=d)}V(T>0,"leftArea"),V(j<0,"rightArea"),u(ut,nt,M),_(ut,ut,ht),u(mt,nt,C),_(mt,mt,ht),ft[0]=-nt[1],ft[1]=nt[0];const D=I(i,t[H],mt,_(dt,mt,ft),1,a),v=I(i,t[y],mt,dt,1,r),S=I(i,t[y],ut,_(dt,ut,ft),1,h),F=I(i,t[H],ut,dt,1,o);V(D,"rayRay"),V(v,"rayRay"),V(S,"rayRay"),V(F,"rayRay")}function pt(t,s){return 3*s+t}const xt=M();function bt(t,s){return d(xt,t[s],t[s+3]),xt}const wt=M(),Mt=a();function Ct(t,s,e,i,a){g(wt,e,i),u(wt,wt,.5),Mt[0]=wt[0],Mt[1]=wt[1],Mt[2]=0,Mt[3]=wt[1],Mt[4]=-wt[0],Mt[5]=0,Mt[6]=wt[0]*wt[0]+wt[1]*wt[1],Mt[7]=wt[0]*wt[1]-wt[1]*wt[0],Mt[8]=1,Mt[pt(0,2)]=-p(bt(Mt,0),t),Mt[pt(1,2)]=-p(bt(Mt,1),t);let r=p(bt(Mt,0),e)+Mt[pt(0,2)],h=p(bt(Mt,1),e)+Mt[pt(1,2)],o=p(bt(Mt,0),i)+Mt[pt(0,2)],c=p(bt(Mt,1),i)+Mt[pt(1,2)];r=-(r+o)/(h+c),Mt[pt(0,0)]+=Mt[pt(1,0)]*r,Mt[pt(0,1)]+=Mt[pt(1,1)]*r,Mt[pt(0,2)]+=Mt[pt(1,2)]*r,r=1/(p(bt(Mt,0),e)+Mt[pt(0,2)]),h=1/(p(bt(Mt,1),e)+Mt[pt(1,2)]),Mt[pt(0,0)]*=r,Mt[pt(0,1)]*=r,Mt[pt(0,2)]*=r,Mt[pt(1,0)]*=h,Mt[pt(1,1)]*=h,Mt[pt(1,2)]*=h,Mt[pt(2,0)]=Mt[pt(1,0)],Mt[pt(2,1)]=Mt[pt(1,1)],Mt[pt(2,2)]=Mt[pt(1,2)],Mt[pt(1,2)]+=1,r=p(bt(Mt,1),s)+Mt[pt(1,2)],h=p(bt(Mt,2),s)+Mt[pt(2,2)],o=p(bt(Mt,1),e)+Mt[pt(1,2)],c=p(bt(Mt,2),e)+Mt[pt(2,2)],r=-.5*(r/h+o/c),Mt[pt(1,0)]+=Mt[pt(2,0)]*r,Mt[pt(1,1)]+=Mt[pt(2,1)]*r,Mt[pt(1,2)]+=Mt[pt(2,2)]*r,r=p(bt(Mt,1),s)+Mt[pt(1,2)],h=p(bt(Mt,2),s)+Mt[pt(2,2)],o=-h/r,Mt[pt(1,0)]*=o,Mt[pt(1,1)]*=o,Mt[pt(1,2)]*=o,a[0]=Mt[0],a[1]=Mt[1],a[2]=0,a[3]=Mt[2],a[4]=Mt[3],a[5]=Mt[4],a[6]=0,a[7]=Mt[5],a[8]=0,a[9]=0,a[10]=1,a[11]=0,a[12]=Mt[6],a[13]=Mt[7],a[14]=0,a[15]=Mt[8]}function Tt(t,s,i,a,r){const h=1/K[0][3],o=1/K[4][3];N(h<o);let c=h+Math.sqrt(h*o);const n=Math.sin(e(t[2]*s[0]+t[6]*s[1]+t[10]*s[2]));c/=n,gt(K,c,n,Y,Z,$,tt,st),Ct(Y,Z,tt,st,r.projectionMatrix),r.projectionMatrix[10]=2/(i-a),r.projectionMatrix[14]=-(i+a)/(i-a)}export{X as ShadowMap,P as SnapshotSlot};
5
+ import has from"../../../../core/has.js";import{clamp as t,lerp as s,acosClamped as e}from"../../../../core/mathUtils.js";import{releaseMaybe as i}from"../../../../core/maybe.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{translate as r,multiply as h,invert as o,lookAt as c}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as n,create as l}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as d,add as _,scale as u,lerp as m,squaredDistance as f,subtract as g,dot as p,negate as x,normalize as b,copy as w}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as M}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{h as C,c as T,C as j,e as y,s as H}from"../../../../chunks/vec32.js";import{create as D}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{s as v,t as S}from"../../../../chunks/vec42.js";import{create as F}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{ViewingMode as R}from"../../../ViewingMode.js";import{ColorFormat as E,DepthFormat as O}from"../core/FBOCache.js";import{CascadeCamera as U}from"./CascadeCamera.js";import{applyTextureResizeModulo as B,applyTextureResizeFloorModulo as L}from"./textureUtils.js";import{assert as N,logWithBase as Q,verify as V,rayRay2D as I}from"./Util.js";import{TextureType as A,ClearBufferBit as W}from"../../../webgl/enums.js";import{Texture as z}from"../../../webgl/Texture.js";var P;!function(t){t[t.Highlight=0]="Highlight",t[t.ExcludeHighlight=1]="ExcludeHighlight"}(P||(P={}));class q{constructor(){this.camera=new U,this.lightMat=l()}}class G{constructor(){this.maxNumCascadesHighQuality=4,this.maxNumCascadesLowQuality=4,this.textureSizeModHighQuality=1.3,this.textureSizeModLowQuality=.9,this.splitSchemeLambda=0}}class X{constructor(t,s){this._fbos=t,this._viewingMode=s,this._enabled=!1,this._snapshots=new Array,this._textureHeight=0,this._numCascades=1,this.settings=new G,this._projectionView=l(),this._projectionViewInverse=l(),this._modelViewLight=l(),this._cascadeDistances=[0,0,0,0,0],this._usedCascadeDistances=F(),this._cascades=[new q,new q,new q,new q],this._lastOrigin=null,this._maxTextureWidth=Math.min(has("esri-mobile")?4096:16384,t.rctx.parameters.maxTextureSize)}dispose(){this.enabled=!1,this.disposeOffscreenBuffers()}get depthTexture(){return this._handle?.colorTexture}get _textureWidth(){return this._textureHeight*this._numCascades}get numCascades(){return this._numCascades}get cascadeDistances(){return v(this._usedCascadeDistances,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)}disposeOffscreenBuffers(){this._handle=i(this._handle),this._discardSnapshots()}set maxCascades(s){this.settings.maxNumCascadesHighQuality=t(Math.floor(s),1,4)}get maxCascades(){return this.settings.maxNumCascadesHighQuality}set enabled(t){this._enabled=t,t||this.disposeOffscreenBuffers()}get enabled(){return this._enabled}get ready(){return this._enabled&&null!=this.depthTexture}get cascades(){for(let t=0;t<this._numCascades;++t)it[t]=this._cascades[t];return it.length=this._numCascades,it}start(t,s,e,i,a){N(this.enabled);const{near:r,far:h}=this._clampNearFar(e);this._computeCascadeDistances(r,h,i),this._textureHeight=this._computeTextureHeight(t,a,i),this._setupMatrices(t,s);const{viewMatrix:o,projectionMatrix:c}=t;for(let n=0;n<this._numCascades;++n)this._constructCascade(n,c,o,s);this._lastOrigin=null,this.clear()}finish(){N(this.enabled),this._handle?.releaseDepth()}getShadowMapMatrices(t){if(!this._lastOrigin||!C(t,this._lastOrigin)){this._lastOrigin=this._lastOrigin||D(),T(this._lastOrigin,t);for(let s=0;s<this._numCascades;++s){r(at,this._cascades[s].lightMat,t);for(let t=0;t<16;++t)rt[16*s+t]=at[t]}}return rt}moveSnapshot(t){N(this.enabled),this._handle?.releaseDepth(),this._snapshots[t]?.release(),this._snapshots[t]=this._handle,this._handle=null,this.clear()}copySnapshot(t){const s=this._handle?.colorTexture?.descriptor;if(!this.enabled||!s)return;this._snapshots[t]?.release();const{width:e,height:i}=s,a=t===P.Highlight?"shadow highlight snapshot":"shadow no highlight snapshot";this._snapshots[t]=this._fbos.acquire(e,i,a,E.RGBA4);const r=this._fbos.rctx;this._bindFbo();const h=r.bindTexture(this._snapshots[t]?.colorTexture,z.TEXTURE_UNIT_FOR_UPDATES);r.gl.copyTexSubImage2D(A.TEXTURE_2D,0,0,0,0,0,e,i),r.bindTexture(h,z.TEXTURE_UNIT_FOR_UPDATES)}getSnapshot(t){return this.enabled?this._snapshots[t]?.colorTexture:null}clear(){const t=this._fbos.rctx;this._ensureFbo(),this._bindFbo(),t.setClearColor(1,1,1,1),t.clearSafe(W.COLOR_BUFFER_BIT|W.DEPTH_BUFFER_BIT)}_computeTextureHeight(t,s,e){const i=Math.min(window.devicePixelRatio,s)/t.pixelRatio,a=e?this.settings.textureSizeModHighQuality:this.settings.textureSizeModLowQuality,r=B(Math.floor(Math.max(t.fullWidth,t.fullHeight)*i*a)),h=Math.min(this._maxTextureWidth,this._numCascades*r);return L(h/this._numCascades)}_ensureFbo(){this._handle?.fbo.width===this._textureWidth&&this._handle?.fbo.height===this._textureHeight||(this._handle?.release(),this._handle=this._fbos.acquire(this._textureWidth,this._textureHeight,"shadow map",E.RGBA4)),this._handle.acquireDepth(O.DEPTH16_BUFFER)}_discardSnapshot(t){this._snapshots[t]=i(this._snapshots[t])}_discardSnapshots(){for(let t=0;t<this._snapshots.length;++t)this._discardSnapshot(t);this._snapshots.length=0}_bindFbo(){const t=this._fbos.rctx;t.unbindTexture(this.depthTexture),t.bindFramebuffer(this._handle?.fbo)}_constructCascade(t,s,e,i){const a=this._cascades[t],o=-this._cascadeDistances[t],c=-this._cascadeDistances[t+1],n=(s[10]*o+s[14])/Math.abs(s[11]*o+s[15]),l=(s[10]*c+s[14])/Math.abs(s[11]*c+s[15]);N(n<l);for(let r=0;r<8;++r){v(J,r%4==0||r%4==3?-1:1,r%4==0||r%4==1?-1:1,r<4?n:l,1);const t=K[r];S(t,J,this._projectionViewInverse),t[0]/=t[3],t[1]/=t[3],t[2]/=t[3]}j(et,K[0]),a.camera.viewMatrix=r(k,this._modelViewLight,et);for(let r=0;r<8;++r)y(K[r],K[r],a.camera.viewMatrix);let d=K[0][2],_=K[0][2];for(let r=1;r<8;++r)d=Math.min(d,K[r][2]),_=Math.max(_,K[r][2]);d-=200,_+=200,a.camera.near=-_,a.camera.far=-d,Tt(e,i,d,_,a.camera),h(a.lightMat,a.camera.projectionMatrix,a.camera.viewMatrix);const u=this._textureHeight;a.camera.viewport=[t*u,0,u,u]}_setupMatrices(t,s){h(this._projectionView,t.projectionMatrix,t.viewMatrix),o(this._projectionViewInverse,this._projectionView);const e=this._viewingMode===R.Global?t.eye:H(et,0,0,1);c(this._modelViewLight,[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,e,i){const a=i?this.settings.maxNumCascadesHighQuality:this.settings.maxNumCascadesLowQuality;this._numCascades=Math.min(1+Math.floor(Q(e/t,4)),a);const r=(e-t)/this._numCascades,h=(e/t)**(1/this._numCascades);let o=t,c=t;for(let n=0;n<this._numCascades+1;++n)this._cascadeDistances[n]=s(o,c,this.settings.splitSchemeLambda),o*=h,c+=r}get test(){return{cascades:this._cascades,textureHeight:this._textureHeight}}}const k=l(),J=F(),K=[];for(let jt=0;jt<8;++jt)K.push(F());const Y=M(),Z=M(),$=M(),tt=M(),st=M(),et=D(),it=[],at=l(),rt=n.concat(n,n,n,n),ht=M(),ot=M(),ct=[M(),M(),M(),M()],nt=M(),lt=M(),dt=M(),_t=M(),ut=M(),mt=M(),ft=M();function gt(t,s,e,i,a,r,h,o){d(ht,0,0);for(let d=0;d<4;++d)_(ht,ht,t[d]);u(ht,ht,.25),d(ot,0,0);for(let d=4;d<8;++d)_(ot,ot,t[d]);u(ot,ot,.25),m(ct[0],t[4],t[5],.5),m(ct[1],t[5],t[6],.5),m(ct[2],t[6],t[7],.5),m(ct[3],t[7],t[4],.5);let c=0,n=f(ct[0],ht);for(let d=1;d<4;++d){const t=f(ct[d],ht);t<n&&(n=t,c=d)}g(nt,ct[c],t[c+4]);const l=nt[0];let M,C;nt[0]=-nt[1],nt[1]=l,g(lt,ot,ht),p(lt,nt)<0&&x(nt,nt),m(nt,nt,lt,e),b(nt,nt),M=C=p(g(dt,t[0],ht),nt);for(let d=1;d<8;++d){const s=p(g(dt,t[d],ht),nt);s<M?M=s:s>C&&(C=s)}w(i,ht),u(dt,nt,M-s),_(i,i,dt);let T=-1,j=1,y=0,H=0;for(let d=0;d<8;++d){g(_t,t[d],i),b(_t,_t);const s=nt[0]*_t[1]-nt[1]*_t[0];s>0?s>T&&(T=s,y=d):s<j&&(j=s,H=d)}V(T>0,"leftArea"),V(j<0,"rightArea"),u(ut,nt,M),_(ut,ut,ht),u(mt,nt,C),_(mt,mt,ht),ft[0]=-nt[1],ft[1]=nt[0];const D=I(i,t[H],mt,_(dt,mt,ft),1,a),v=I(i,t[y],mt,dt,1,r),S=I(i,t[y],ut,_(dt,ut,ft),1,h),F=I(i,t[H],ut,dt,1,o);V(D,"rayRay"),V(v,"rayRay"),V(S,"rayRay"),V(F,"rayRay")}function pt(t,s){return 3*s+t}const xt=M();function bt(t,s){return d(xt,t[s],t[s+3]),xt}const wt=M(),Mt=a();function Ct(t,s,e,i,a){g(wt,e,i),u(wt,wt,.5),Mt[0]=wt[0],Mt[1]=wt[1],Mt[2]=0,Mt[3]=wt[1],Mt[4]=-wt[0],Mt[5]=0,Mt[6]=wt[0]*wt[0]+wt[1]*wt[1],Mt[7]=wt[0]*wt[1]-wt[1]*wt[0],Mt[8]=1,Mt[pt(0,2)]=-p(bt(Mt,0),t),Mt[pt(1,2)]=-p(bt(Mt,1),t);let r=p(bt(Mt,0),e)+Mt[pt(0,2)],h=p(bt(Mt,1),e)+Mt[pt(1,2)],o=p(bt(Mt,0),i)+Mt[pt(0,2)],c=p(bt(Mt,1),i)+Mt[pt(1,2)];r=-(r+o)/(h+c),Mt[pt(0,0)]+=Mt[pt(1,0)]*r,Mt[pt(0,1)]+=Mt[pt(1,1)]*r,Mt[pt(0,2)]+=Mt[pt(1,2)]*r,r=1/(p(bt(Mt,0),e)+Mt[pt(0,2)]),h=1/(p(bt(Mt,1),e)+Mt[pt(1,2)]),Mt[pt(0,0)]*=r,Mt[pt(0,1)]*=r,Mt[pt(0,2)]*=r,Mt[pt(1,0)]*=h,Mt[pt(1,1)]*=h,Mt[pt(1,2)]*=h,Mt[pt(2,0)]=Mt[pt(1,0)],Mt[pt(2,1)]=Mt[pt(1,1)],Mt[pt(2,2)]=Mt[pt(1,2)],Mt[pt(1,2)]+=1,r=p(bt(Mt,1),s)+Mt[pt(1,2)],h=p(bt(Mt,2),s)+Mt[pt(2,2)],o=p(bt(Mt,1),e)+Mt[pt(1,2)],c=p(bt(Mt,2),e)+Mt[pt(2,2)],r=-.5*(r/h+o/c),Mt[pt(1,0)]+=Mt[pt(2,0)]*r,Mt[pt(1,1)]+=Mt[pt(2,1)]*r,Mt[pt(1,2)]+=Mt[pt(2,2)]*r,r=p(bt(Mt,1),s)+Mt[pt(1,2)],h=p(bt(Mt,2),s)+Mt[pt(2,2)],o=-h/r,Mt[pt(1,0)]*=o,Mt[pt(1,1)]*=o,Mt[pt(1,2)]*=o,a[0]=Mt[0],a[1]=Mt[1],a[2]=0,a[3]=Mt[2],a[4]=Mt[3],a[5]=Mt[4],a[6]=0,a[7]=Mt[5],a[8]=0,a[9]=0,a[10]=1,a[11]=0,a[12]=Mt[6],a[13]=Mt[7],a[14]=0,a[15]=Mt[8]}function Tt(t,s,i,a,r){const h=1/K[0][3],o=1/K[4][3];N(h<o);let c=h+Math.sqrt(h*o);const n=Math.sin(e(t[2]*s[0]+t[6]*s[1]+t[10]*s[2]));c/=n,gt(K,c,n,Y,Z,$,tt,st),Ct(Y,Z,tt,st,r.projectionMatrix),r.projectionMatrix[10]=2/(i-a),r.projectionMatrix[14]=-(i+a)/(i-a)}export{X as ShadowMap,P as SnapshotSlot};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import{Default3D as e}from"./DefaultVertexAttributeLocations.js";import{Pos2 as r,Pos2Tex as t}from"./DefaultVertexBufferLayouts.js";import{VertexArrayObject as o}from"./VertexArrayObject.js";import{BufferObject as n}from"../../../webgl/BufferObject.js";import{Usage as m,TextureSamplingMode as s}from"../../../webgl/enums.js";import{Texture as u}from"../../../webgl/Texture.js";import{TextureDescriptor as f}from"../../../webgl/TextureDescriptor.js";function i(s,u=r,f=e,i=-1,a=1){let l=null;if(u===t)l=new Float32Array([i,i,0,0,a,i,1,0,i,a,0,1,a,a,1,1]);else l=new Float32Array([i,i,a,i,i,a,a,a]);return new o(s,f,{geometry:u},{geometry:n.createVertex(s,m.STATIC_DRAW,l)})}function a(t,s=r,u=e){const f=new Float32Array([-1,-1,3,-1,-1,3]);return new o(t,u,{geometry:s},{geometry:n.createVertex(t,m.STATIC_DRAW,f)})}const l=4;function c(e){const r=new f(l);return r.samplingMode=s.NEAREST,new u(e,r)}function w(e){const r=new f(1);return r.samplingMode=s.NEAREST,new u(e,r,new Uint8Array([255,255,255,255]))}export{w as createEmptyDepthTexture,c as createEmptyTexture,i as createQuadVAO,a as createScreenSizeTriangleVAO};
5
+ import{Default3D as e}from"./DefaultVertexAttributeLocations.js";import{Pos2 as r,Pos2Tex as t}from"./DefaultVertexBufferLayouts.js";import{VertexArrayObject as o}from"./VertexArrayObject.js";import{BufferObject as n}from"../../../webgl/BufferObject.js";import{Usage as m,TextureSamplingMode as s}from"../../../webgl/enums.js";import{Texture as f}from"../../../webgl/Texture.js";import{TextureDescriptor as i}from"../../../webgl/TextureDescriptor.js";function u(s,f=r,i=e,u=-1,a=1){let l=null;if(f===t)l=new Float32Array([u,u,0,0,a,u,1,0,u,a,0,1,a,a,1,1]);else l=new Float32Array([u,u,a,u,u,a,a,a]);return new o(s,i,{geometry:f},{geometry:n.createVertex(s,m.STATIC_DRAW,l)})}const a=4;function l(e){const r=new i(a);return r.samplingMode=s.NEAREST,new f(e,r)}function w(e){const r=new i(1);return r.samplingMode=s.NEAREST,new f(e,r,new Uint8Array([255,255,255,255]))}export{w as createEmptyDepthTexture,l as createEmptyTexture,u as createQuadVAO};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import{MaterialChangeSet as e}from"./ChangeSet.js";function r(r){const n=new Map,o=r=>{let t=n.get(r);return t||(t=new e,n.set(r,t)),t};return r.removes.forAll((e=>{t(e)&&o(e.material).removes.push(e)})),r.adds.forAll((e=>{t(e)&&o(e.material).adds.push(e)})),r.updates.forAll((e=>{t(e.renderGeometry)&&o(e.renderGeometry.material).updates.push(e)})),n}function t(e){return e.geometry.indexCount>=1}export{r as splitRenderGeometryChangeSetByMaterial};
5
+ import{MaterialChangeSet as e}from"./ChangeSet.js";var r;function t(r){const t=new Map,o=r=>{let n=t.get(r);return n||(n=new e,t.set(r,n)),n};return r.removes.forAll((e=>{n(e)&&o(e.material).removes.push(e)})),r.adds.forAll((e=>{n(e)&&o(e.material).adds.push(e)})),r.updates.forAll((e=>{n(e.renderGeometry)&&o(e.renderGeometry.material).updates.push(e)})),t}function n(e){return e.geometry.indexCount>=1}!function(e){e[e.Default=0]="Default",e[e.Screenshot=1]="Screenshot",e[e.ObjectAndLayerID=2]="ObjectAndLayerID"}(r||(r={}));export{r as RendererTarget,t as splitRenderGeometryChangeSetByMaterial};