@arcgis/core 6.0.0-next.26 → 6.0.0-next.27

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 (238) hide show
  1. package/assets/esri/core/workers/RemoteClient.js +1 -1
  2. package/assets/esri/core/workers/chunks/{6f1d6453184e0a1530ad.js → 00580a68835aac653038.js} +22 -22
  3. package/assets/esri/core/workers/chunks/0363d29fc665d169ebc4.js +1 -0
  4. package/assets/esri/core/workers/chunks/037c67ef5c4398d5954d.js +1 -0
  5. package/assets/esri/core/workers/chunks/07b726a46864501b90a0.js +1 -0
  6. package/assets/esri/core/workers/chunks/0864da8f8f147016cf1c.js +1 -0
  7. package/assets/esri/core/workers/chunks/0bd04bcd4b2710838d48.js +1 -0
  8. package/assets/esri/core/workers/chunks/{768389f7f8dba6080df7.js → 0cc7fba402a93e6d2455.js} +2 -2
  9. package/assets/esri/core/workers/chunks/0cfdeb53fb7d5532cf01.js +1 -0
  10. package/assets/esri/core/workers/chunks/112ed86f812e4400a7e0.js +1 -0
  11. package/assets/esri/core/workers/chunks/177f353ce72133e2eeed.js +1 -0
  12. package/assets/esri/core/workers/chunks/1dc6f093028530a492e6.js +1 -0
  13. package/assets/esri/core/workers/chunks/2294254af2c6afb560ee.js +1 -0
  14. package/assets/esri/core/workers/chunks/23a4806b4cdf7cc32e4d.js +1 -0
  15. package/assets/esri/core/workers/chunks/2447d2e2a4a3ab8fcf94.js +1 -0
  16. package/assets/esri/core/workers/chunks/271ae7deccb94112c2df.js +1 -0
  17. package/assets/esri/core/workers/chunks/2df37a9a95ceebb87a5f.js +1 -0
  18. package/assets/esri/core/workers/chunks/2e00c155e447e4930442.js +1 -0
  19. package/assets/esri/core/workers/chunks/2e9a1673b1d51aa082b6.js +1 -0
  20. package/assets/esri/core/workers/chunks/344f5334ad95c7974349.js +1 -0
  21. package/assets/esri/core/workers/chunks/348f1def9cd2ddf92e87.js +1 -0
  22. package/assets/esri/core/workers/chunks/{8e4206068c6953bb7df2.js → 3a47fc97c400fca2c736.js} +1 -1
  23. package/assets/esri/core/workers/chunks/47c97640ec525676918b.js +1 -0
  24. package/assets/esri/core/workers/chunks/50763ea061d5fb3f2e49.js +1 -0
  25. package/assets/esri/core/workers/chunks/518ab22f80c3300bcfff.js +1 -0
  26. package/assets/esri/core/workers/chunks/58609bf94f72bc4f1952.js +1 -0
  27. package/assets/esri/core/workers/chunks/586a929bc037e23857af.js +1 -0
  28. package/assets/esri/core/workers/chunks/58d10e0b35968680fd9f.js +1 -0
  29. package/assets/esri/core/workers/chunks/59bc55880e6fd8ce20c0.js +1 -0
  30. package/assets/esri/core/workers/chunks/62a0abcf45a2bd14ecbe.js +1 -0
  31. package/assets/esri/core/workers/chunks/63c4412c16d8a44a5668.js +1 -0
  32. package/assets/esri/core/workers/chunks/6b4c3411f63a9ad9354c.js +1 -0
  33. package/assets/esri/core/workers/chunks/{f528ac5c648ca6a98582.js → 711cfb84659cb4437679.js} +1 -1
  34. package/assets/esri/core/workers/chunks/77463141652bf1ca6fb2.js +1 -0
  35. package/assets/esri/core/workers/chunks/7d3f7940815fa5dc244e.js +1 -0
  36. package/assets/esri/core/workers/chunks/914a0b5d9fef683cdf9c.js +1 -0
  37. package/assets/esri/core/workers/chunks/96f87c8efd4b11b37686.js +1 -0
  38. package/assets/esri/core/workers/chunks/97ec46605f16333144b7.js +1 -0
  39. package/assets/esri/core/workers/chunks/{7b482afb9fd1229f5707.js → 9934e8e19f94e9169eea.js} +1 -1
  40. package/assets/esri/core/workers/chunks/99f51d5d9da6e9bfc430.js +1 -0
  41. package/assets/esri/core/workers/chunks/9aebe876b1a2fb075f9c.js +1 -0
  42. package/assets/esri/core/workers/chunks/9c3db7a7c05fa0e81f0a.js +1 -0
  43. package/assets/esri/core/workers/chunks/a2cc53ad1a514167e4b8.js +1 -0
  44. package/assets/esri/core/workers/chunks/a33ba23aee3f8f40200f.js +1 -0
  45. package/assets/esri/core/workers/chunks/{45ba4aa87a4732198596.js → b13d8f4e4e80ef00b1bd.js} +1 -1
  46. package/assets/esri/core/workers/chunks/b3801d58c024224917df.js +1 -0
  47. package/assets/esri/core/workers/chunks/b3aa29589dcfb5b93106.js +1 -0
  48. package/assets/esri/core/workers/chunks/b3dbcf43f136ba2dadc5.js +1 -0
  49. package/assets/esri/core/workers/chunks/b9596d862da1ec342cd3.js +1 -0
  50. package/assets/esri/core/workers/chunks/bc1fcc9c897461e68e29.js +1 -0
  51. package/assets/esri/core/workers/chunks/{8b4e9fd88c0c313416d4.js → be04f40f8b403befd0ef.js} +1 -1
  52. package/assets/esri/core/workers/chunks/c29091fe157564cffcf7.js +1 -0
  53. package/assets/esri/core/workers/chunks/{150e7a7bd5df25693da7.js → c90388932a7825d9d933.js} +1 -1
  54. package/assets/esri/core/workers/chunks/ca21786e519c914fc9e1.js +1 -0
  55. package/assets/esri/core/workers/chunks/cdb5c26fed7d9a97db49.js +1 -0
  56. package/assets/esri/core/workers/chunks/cdf0c7706d3e1221f49b.js +1 -0
  57. package/assets/esri/core/workers/chunks/d63e181f0e48bde73395.js +1 -0
  58. package/assets/esri/core/workers/chunks/d77888c84a8b49478807.js +1 -0
  59. package/assets/esri/core/workers/chunks/d7f2f1708d2a2668676c.js +1 -0
  60. package/assets/esri/core/workers/chunks/ec1c4d66142b6efb0e8b.js +1 -0
  61. package/assets/esri/core/workers/chunks/ef2c3febcceedc44b3ac.js +1 -0
  62. package/assets/esri/core/workers/chunks/f08a2a262a3b55149396.js +1 -0
  63. package/assets/esri/core/workers/chunks/f2d56f5c15d5977e1d19.js +1 -0
  64. package/assets/esri/core/workers/chunks/ffe2077a9df7c838ea27.js +1 -0
  65. package/assets/esri/layers/raster/formats/lerc-wasm.wasm +0 -0
  66. package/chunks/GlobalIllumination.glsl.js +15 -30
  67. package/chunks/RibbonLine.glsl.js +2 -2
  68. package/config.js +1 -1
  69. package/core/ReentrantObjectPool.js +1 -1
  70. package/core/memoryEstimations.js +1 -1
  71. package/core/workers/workers.js +2 -2
  72. package/core/workers.d.ts +1 -1
  73. package/form/elements/inputs.d.ts +126 -25
  74. package/form/elements/inputs.js +1 -1
  75. package/form/elements.d.ts +1 -0
  76. package/geometry/support/Indices.js +1 -1
  77. package/graphic/MapNotesGraphicOrigin.d.ts +1 -0
  78. package/kernel.js +1 -1
  79. package/layers/GeospatialPDFLayer.js +1 -1
  80. package/layers/MapNotesLayer.d.ts +3 -2
  81. package/layers/VectorTileLayer.d.ts +10 -1
  82. package/layers/buildingSublayers/BuildingGroupSublayer.d.ts +2 -1
  83. package/layers/geospatialPDF/CIM2DLayerview.js +2 -0
  84. package/layers/geospatialPDF/GeospatialPDFFrame.js +1 -1
  85. package/layers/graphics/sources/support/ParquetSourceWorker.js +1 -1
  86. package/layers/mixins/SublayersOwner.js +1 -1
  87. package/layers/orientedImagery/transformations/imageToWorld.js +1 -1
  88. package/layers/orientedImagery/transformations/rectifyMapPoint.js +1 -1
  89. package/layers/support/Sublayer.d.ts +2 -2
  90. package/layers/support/Sublayer.js +1 -1
  91. package/layers/support/SubtypeSublayer.js +1 -1
  92. package/layers/support/layerUtils.js +1 -1
  93. package/package.json +3 -3
  94. package/rest/support/AttributeBinsQuery.d.ts +3 -2
  95. package/rest/support/ImageGPSInfoParameters.d.ts +2 -1
  96. package/rest/support/OutDistance.d.ts +2 -1
  97. package/rest/support/Query.d.ts +3 -2
  98. package/rest/support/TopFeaturesQuery.d.ts +2 -1
  99. package/rest/support/types.d.ts +10 -1
  100. package/smartMapping/raster/renderers/flow.d.ts +2 -1
  101. package/smartMapping/renderers/color.d.ts +11 -8
  102. package/smartMapping/renderers/location.d.ts +7 -4
  103. package/smartMapping/renderers/predominance.d.ts +7 -4
  104. package/smartMapping/renderers/relationship.d.ts +7 -4
  105. package/smartMapping/renderers/size.d.ts +6 -4
  106. package/smartMapping/renderers/type.d.ts +7 -4
  107. package/smartMapping/renderers/types.d.ts +15 -0
  108. package/smartMapping/renderers/univariateColorSize.d.ts +4 -2
  109. package/smartMapping/symbology/flow.d.ts +2 -1
  110. package/smartMapping/symbology/types.d.ts +2 -1
  111. package/symbols/cim/CIMCursor.js +1 -1
  112. package/tables/elements.d.ts +1 -0
  113. package/views/2d/engine/vectorTiles/TileHandler3D.js +1 -1
  114. package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimatedMarkerMeshWriter.js +1 -1
  115. package/views/2d/engine/webgl/shaderGraph/techniques/mesh/MeshWriterVertexPack.js +1 -1
  116. package/views/2d/engine/webgl/textureUtils.js +1 -1
  117. package/views/2d/layers/GeospatialPDFLayerView2D.js +1 -1
  118. package/views/2d/layers/MediaLayerView2D.js +1 -1
  119. package/views/2d/layers/TileLayerView2D.js +1 -1
  120. package/views/3d/layers/GeospatialPDFLayerView3D.js +1 -1
  121. package/views/3d/layers/ImageryTileLayerView3D.js +1 -1
  122. package/views/3d/layers/graphics/Graphics3DBufferGraphicLayer.js +1 -1
  123. package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
  124. package/views/3d/layers/graphics/Graphics3DDrapedGraphicLayerBase.js +1 -1
  125. package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
  126. package/views/3d/layers/graphics/Graphics3DFeatureStore.js +1 -1
  127. package/views/3d/layers/graphics/Graphics3DGraphic.js +1 -1
  128. package/views/3d/layers/graphics/Graphics3DGraphicCreationContext.js +1 -1
  129. package/views/3d/layers/graphics/Graphics3DLodInstanceGraphicLayer.js +1 -1
  130. package/views/3d/layers/graphics/Graphics3DMeshObject3DGraphicLayer.js +1 -1
  131. package/views/3d/layers/graphics/Graphics3DObject3DGraphicLayer.js +1 -1
  132. package/views/3d/layers/graphics/Graphics3DStageObjectGraphicLayer.js +1 -1
  133. package/views/3d/layers/graphics/Graphics3DSymbol.js +1 -1
  134. package/views/3d/layers/graphics/Labeler.js +1 -1
  135. package/views/3d/layers/graphics/defaultSymbolComplexity.js +1 -1
  136. package/views/3d/layers/support/StageLayerElevationProvider.js +1 -1
  137. package/views/3d/layers/support/featureReference.js +1 -1
  138. package/views/3d/terrain/PatchRenderData.js +1 -1
  139. package/views/3d/terrain/TerrainData.js +1 -1
  140. package/views/3d/terrain/TerrainRenderer.js +1 -1
  141. package/views/3d/terrain/TerrainSurface.js +1 -1
  142. package/views/3d/terrain/TextureFader.js +1 -1
  143. package/views/3d/terrain/TextureReference.js +1 -1
  144. package/views/3d/terrain/TileCompositor.js +1 -1
  145. package/views/3d/terrain/TileRenderInfo.js +1 -1
  146. package/views/3d/terrain/TileRenderer.js +1 -1
  147. package/views/3d/terrain/terrainUtils.js +1 -1
  148. package/views/3d/webgl-engine/core/shaderLibrary/shading/EvaluateSceneLighting.glsl.js +25 -25
  149. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIllumination.glsl.js +1 -1
  150. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIllumination.js +1 -1
  151. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIlluminationTechniqueConfiguration.js +1 -1
  152. package/views/3d/webgl-engine/lib/BindParameters.js +1 -1
  153. package/views/3d/webgl-engine/lib/BoundingInfo.js +1 -1
  154. package/views/3d/webgl-engine/lib/BufferGeometry.js +1 -1
  155. package/views/3d/webgl-engine/lib/BufferObject3D.js +1 -1
  156. package/views/3d/webgl-engine/lib/DirtyEvents.js +1 -1
  157. package/views/3d/webgl-engine/lib/Geometry.js +1 -1
  158. package/views/3d/webgl-engine/lib/ManagedTexture.js +1 -1
  159. package/views/3d/webgl-engine/lib/ModelDirtySet.js +1 -1
  160. package/views/3d/webgl-engine/lib/Object3D.js +1 -1
  161. package/views/3d/webgl-engine/lib/PathGeometry.js +1 -1
  162. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  163. package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBuffer.js +1 -1
  164. package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
  165. package/views/3d/webgl-engine/lib/geometryMemoryUtils.js +2 -0
  166. package/views/VideoView.js +1 -1
  167. package/views/selection/SelectionOperation.js +1 -1
  168. package/views/selection/types.d.ts +43 -3
  169. package/views/support/layerViewUtils.js +1 -1
  170. package/views/support/selectionUtils.js +1 -1
  171. package/widgets/OrientedImageryViewer/adapters/view/SceneViewAdapter.js +1 -1
  172. package/widgets/OrientedImageryViewer/services/SuperimposeService.js +1 -1
  173. package/widgets/OrientedImageryViewer.js +2 -2
  174. package/widgets/Print.js +1 -1
  175. package/widgets/support/SelectionList/GroupLayerItem.d.ts +6 -0
  176. package/widgets/support/SelectionList/GroupLayerItem.js +1 -1
  177. package/widgets/support/SelectionList/ItemBase.js +1 -1
  178. package/widgets/support/SelectionToolbar/SelectionToolbarViewModel.d.ts +6 -1
  179. package/widgets/support/SelectionToolbar/SelectionToolbarViewModel.js +1 -1
  180. package/widgets/support/SelectionToolbar.d.ts +8 -1
  181. package/widgets/support/SelectionToolbar.js +1 -1
  182. package/widgets/support/Selector2D/selectorUtils.js +1 -1
  183. package/assets/esri/core/workers/chunks/0320cbd825f9a4222042.js +0 -1
  184. package/assets/esri/core/workers/chunks/067de1910190da228291.js +0 -1
  185. package/assets/esri/core/workers/chunks/09bd5df07eab80ae7b15.js +0 -1
  186. package/assets/esri/core/workers/chunks/164e74d586297946a717.js +0 -1
  187. package/assets/esri/core/workers/chunks/1c0c5cb13c2590aae906.js +0 -1
  188. package/assets/esri/core/workers/chunks/1c77de1e79860f8d2228.js +0 -1
  189. package/assets/esri/core/workers/chunks/24dac4970526a4e0ae63.js +0 -1
  190. package/assets/esri/core/workers/chunks/2acf2952cef69e382a35.js +0 -1
  191. package/assets/esri/core/workers/chunks/30dcf2cfb31cb70de7df.js +0 -1
  192. package/assets/esri/core/workers/chunks/371e2ddb88cc6b9a41e8.js +0 -1
  193. package/assets/esri/core/workers/chunks/42f6194633c2d879c8da.js +0 -1
  194. package/assets/esri/core/workers/chunks/44f90e75c1dc3d726a95.js +0 -1
  195. package/assets/esri/core/workers/chunks/4abd3753cd9b80e4d937.js +0 -1
  196. package/assets/esri/core/workers/chunks/4bb9a5f4ca944d3fc206.js +0 -1
  197. package/assets/esri/core/workers/chunks/4c389472b8cdb0c55154.js +0 -1
  198. package/assets/esri/core/workers/chunks/4d93bed14945e3d34d5c.js +0 -1
  199. package/assets/esri/core/workers/chunks/4e3f651ac76fcd53df2b.js +0 -1
  200. package/assets/esri/core/workers/chunks/505227797bcf2a1d908d.js +0 -1
  201. package/assets/esri/core/workers/chunks/58da3f8cf0f7f6a7e4fa.js +0 -1
  202. package/assets/esri/core/workers/chunks/5a19a9c3e01d3d415188.js +0 -1
  203. package/assets/esri/core/workers/chunks/5a830bc35adbedd33783.js +0 -1
  204. package/assets/esri/core/workers/chunks/6db0f8fe1402643fbe1a.js +0 -1
  205. package/assets/esri/core/workers/chunks/7124ad8dc5ad40dc66f3.js +0 -1
  206. package/assets/esri/core/workers/chunks/7446d0dfebf93e86c098.js +0 -1
  207. package/assets/esri/core/workers/chunks/7c631e2947243e2c9bde.js +0 -1
  208. package/assets/esri/core/workers/chunks/7f0f9dddc44b1f1600f0.js +0 -1
  209. package/assets/esri/core/workers/chunks/7fb7493f483cd9878bfa.js +0 -1
  210. package/assets/esri/core/workers/chunks/8e310e9cb9d84ac3ca2f.js +0 -1
  211. package/assets/esri/core/workers/chunks/950d4578dc450467404c.js +0 -1
  212. package/assets/esri/core/workers/chunks/99a0a434ea2162166754.js +0 -1
  213. package/assets/esri/core/workers/chunks/9afc87474cef1fc4fe4a.js +0 -1
  214. package/assets/esri/core/workers/chunks/9cbde13e536676767900.js +0 -1
  215. package/assets/esri/core/workers/chunks/9cd3fcb5fca6f9dbbcd8.js +0 -1
  216. package/assets/esri/core/workers/chunks/a025ee38d402504193df.js +0 -1
  217. package/assets/esri/core/workers/chunks/a4b822ee45810c4c292a.js +0 -1
  218. package/assets/esri/core/workers/chunks/a51576d84edca88e41dd.js +0 -1
  219. package/assets/esri/core/workers/chunks/ac24b4370dc7194a3107.js +0 -1
  220. package/assets/esri/core/workers/chunks/ace41659a5ca0e5abfc3.js +0 -1
  221. package/assets/esri/core/workers/chunks/b01804aa6c47a220a603.js +0 -1
  222. package/assets/esri/core/workers/chunks/b3273f847405799e3362.js +0 -1
  223. package/assets/esri/core/workers/chunks/ba3d5abff65aefcb8dee.js +0 -1
  224. package/assets/esri/core/workers/chunks/bca6b469940b7b954123.js +0 -1
  225. package/assets/esri/core/workers/chunks/c0d7ae314ebfad1e3791.js +0 -1
  226. package/assets/esri/core/workers/chunks/c337fc0e6dc69c233e6d.js +0 -1
  227. package/assets/esri/core/workers/chunks/cd9aa950cb74b09008fe.js +0 -1
  228. package/assets/esri/core/workers/chunks/e0d9dc97985561320bd4.js +0 -1
  229. package/assets/esri/core/workers/chunks/e2775b4b753306dc8477.js +0 -1
  230. package/assets/esri/core/workers/chunks/eaddffcc7004101fc230.js +0 -1
  231. package/assets/esri/core/workers/chunks/ebbf425af348e6ede814.js +0 -1
  232. package/assets/esri/core/workers/chunks/efc53007cd2e4991d7d4.js +0 -1
  233. package/assets/esri/core/workers/chunks/f46e92c67986c8c09bdd.js +0 -1
  234. package/assets/esri/core/workers/chunks/f8bc474434fd365ab174.js +0 -1
  235. package/assets/esri/core/workers/chunks/f8d2225f333524ce1d88.js +0 -1
  236. package/assets/esri/core/workers/chunks/f95a1f878c9c1146180e.js +0 -1
  237. package/assets/esri/core/workers/chunks/fb37f0848196c28b7fd7.js +0 -1
  238. /package/assets/esri/core/workers/chunks/{768389f7f8dba6080df7.js.LICENSE.txt → 0cc7fba402a93e6d2455.js.LICENSE.txt} +0 -0
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{releaseMaybe as e}from"../../../../core/maybe.js";import{signal as t}from"../../../../core/signal.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import r from"../../webgl/RenderCamera.js";import{isColor as i}from"../core/shaderLibrary/ShaderOutput.js";import{CloudsParameters as a}from"../effects/clouds/CloudsParameters.js";import{ReprojectionUniforms as o}from"./ReprojectionUniforms.js";import{ScreenSpaceReflectionsUniforms as s}from"./ScreenSpaceReflectionsUniforms.js";import{SceneLighting as c}from"../lighting/SceneLighting.js";class l{constructor(e,t){this.width=e,this.height=t}}class u{constructor(e){this.shadowMap=e,this.output=0,this.slot=2,this.slicePlane=null,this.planarDistanceToGroundRatio=1,this.metersPerRenderUnit=1,this.hasOccludees=!1,this._emissions=t(0),this.transparentWithoutDepthEmissionDimmingPass=!1,this.useFloatBlend=t(!0),this.globalIlluminationDirectFactor=.55,this.globalIlluminationAmbientFactor=.85,this.enableFillLights=!0,this.alignPixelEnabled=!1,this.decorations=!0,this.frameRendererTarget=0,this.overlayStretch=1,this.viewshedEnabled=!1,this.laserlinesEnabled=!1,this.shadowAnalysisEnabled=!1,this.cutFillComputationEnabled=!1,this.cutFillVisualizationEnabled=!1,this._camera=t(new r),this._inverseViewport=n(),this._oldLighting=new c,this._newLighting=new c,this._fadedLighting=new c,this._lighting=this._newLighting,this.screenSpaceReflections=new s,this.reprojection=new o,this.highlights=[],this.highlightMixOrigin=n(),this.highlightMixTexture=null,this.globalIlluminationEnabled=!1,this.hudRenderStyle=0,this.snowCover=0,this.clouds=new a,this.hasShadowHighlights=!1}destroy(){this._camera=this.contentCamera=null,this.mainDepth=this.overlay=this.ssao=this.shadowHighlight=null,this.depth=e(this.depth),this.shadowMap?.dispose()}get emissions(){return this._emissions.value}set emissions(e){this._emissions.value=e}get hasEmission(){switch(this.output){case 0:return this.hasOpaqueEmission;case 1:case 2:return this.hasTransparentEmission;default:return!1}}get hasOpaqueEmission(){return this.emissions===1||this.emissions===3}get hasTransparentEmission(){return this.emissions===2||this.emissions===3}get hasEmissions(){return this.emissions!==0}get camera(){return this._camera.value}set camera(e){this._camera.value=e,this._inverseViewport[0]=1/e.fullViewport[2],this._inverseViewport[1]=1/e.fullViewport[3]}get enableOITOffset(){return this.camera.relativeElevation<5e5}get inverseViewport(){return this._inverseViewport}get lighting(){return this._lighting}fadeLighting(){switch(this.clouds.fadeFactor){case 0:this._lighting=this._oldLighting;break;default:this._fadedLighting.lerpLighting(this._oldLighting,this._newLighting,this.clouds.fadeFactor),this._lighting=this._fadedLighting;break;case 1:this._lighting=this._newLighting,this._oldLighting.copyFrom(this._newLighting)}}updateLighting(e,t,n,r){this._oldLighting.copyFrom(this.lighting),this._newLighting.noonFactor=t,this._newLighting.globalFactor=n,this._newLighting.set(e),this._oldLighting.updateLegacy(),r===1&&this.clouds.requestFade(),this.fadeLighting()}get hasScreenSpaceReflections(){return this.frameRendererTarget!==3&&i(this.output)&&this.screenSpaceReflections.enabled&&this.reprojection.lastFrameColor!=null}get highlight(){return this.highlightLevel==null?null:this.highlights[this.highlightLevel]}get depth(){return this._depth}set depth(e){e&&(e.name=`geometry depth`),this._depth=e}get occluder(){return this.slot===10||this.slot===11?this.slot:null}}export{u as BindParameters,l as ViewportSize};
2
+ import{releaseMaybe as e}from"../../../../core/maybe.js";import{signal as t}from"../../../../core/signal.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import r from"../../webgl/RenderCamera.js";import{isColor as i}from"../core/shaderLibrary/ShaderOutput.js";import{CloudsParameters as a}from"../effects/clouds/CloudsParameters.js";import{ReprojectionUniforms as o}from"./ReprojectionUniforms.js";import{ScreenSpaceReflectionsUniforms as s}from"./ScreenSpaceReflectionsUniforms.js";import{SceneLighting as c}from"../lighting/SceneLighting.js";class l{constructor(e,t){this.width=e,this.height=t}}class u{constructor(e){this.shadowMap=e,this.output=0,this.slot=2,this.slicePlane=null,this.planarDistanceToGroundRatio=1,this.metersPerRenderUnit=1,this.hasOccludees=!1,this._emissions=t(0),this.transparentWithoutDepthEmissionDimmingPass=!1,this.useFloatBlend=t(!0),this.enableFillLights=!0,this.alignPixelEnabled=!1,this.decorations=!0,this.frameRendererTarget=0,this.overlayStretch=1,this.viewshedEnabled=!1,this.laserlinesEnabled=!1,this.shadowAnalysisEnabled=!1,this.cutFillComputationEnabled=!1,this.cutFillVisualizationEnabled=!1,this._camera=t(new r),this._inverseViewport=n(),this._oldLighting=new c,this._newLighting=new c,this._fadedLighting=new c,this._lighting=this._newLighting,this.screenSpaceReflections=new s,this.reprojection=new o,this.highlights=[],this.highlightMixOrigin=n(),this.highlightMixTexture=null,this.globalIlluminationEnabled=!1,this.hudRenderStyle=0,this.snowCover=0,this.clouds=new a,this.hasShadowHighlights=!1}destroy(){this._camera=this.contentCamera=null,this.mainDepth=this.overlay=this.ssao=this.shadowHighlight=null,this.depth=e(this.depth),this.shadowMap?.dispose()}get emissions(){return this._emissions.value}set emissions(e){this._emissions.value=e}get hasEmission(){switch(this.output){case 0:return this.hasOpaqueEmission;case 1:case 2:return this.hasTransparentEmission;default:return!1}}get hasOpaqueEmission(){return this.emissions===1||this.emissions===3}get hasTransparentEmission(){return this.emissions===2||this.emissions===3}get hasEmissions(){return this.emissions!==0}get camera(){return this._camera.value}set camera(e){this._camera.value=e,this._inverseViewport[0]=1/e.fullViewport[2],this._inverseViewport[1]=1/e.fullViewport[3]}get enableOITOffset(){return this.camera.relativeElevation<5e5}get inverseViewport(){return this._inverseViewport}get lighting(){return this._lighting}fadeLighting(){switch(this.clouds.fadeFactor){case 0:this._lighting=this._oldLighting;break;default:this._fadedLighting.lerpLighting(this._oldLighting,this._newLighting,this.clouds.fadeFactor),this._lighting=this._fadedLighting;break;case 1:this._lighting=this._newLighting,this._oldLighting.copyFrom(this._newLighting)}}updateLighting(e,t,n,r){this._oldLighting.copyFrom(this.lighting),this._newLighting.noonFactor=t,this._newLighting.globalFactor=n,this._newLighting.set(e),this._oldLighting.updateLegacy(),r===1&&this.clouds.requestFade(),this.fadeLighting()}get hasScreenSpaceReflections(){return this.frameRendererTarget!==3&&i(this.output)&&this.screenSpaceReflections.enabled&&this.reprojection.lastFrameColor!=null}get highlight(){return this.highlightLevel==null?null:this.highlights[this.highlightLevel]}get depth(){return this._depth}set depth(e){e&&(e.name=`geometry depth`),this._depth=e}get occluder(){return this.slot===10||this.slot===11?this.slot:null}}export{u as BindParameters,l as ViewportSize};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import e from"../../../../core/PooledArray.js";import{subtract as t,sqrLen as n,scaleAndAdd as r,min as i}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{empty as o,expandWithVec3 as s,center as c,width as l,depth as u,height as d,squareDiameter as f}from"../../../../geometry/support/aaBoundingBox.js";import{Sphere as p}from"../../../../geometry/support/sphere.js";import{assert as m}from"./Util.js";class h{constructor(e,i,a){this.primitiveIndices=e,this._numIndexPerPrimitive=i,this._readPosition=a,this._children=void 0,m(e.length>=1);let f=e.length;y.clear();let h=o();for(let t=0;t<f;++t){let n=i*e[t];for(let e=0;e<i;++e){let t=n+e;y.push(t),s(h,a(g,t))}}this.box=h;let _=new p,v=c(h,_.center),b=.5*Math.max(l(h),u(h),d(h)),x=b*b;for(let e=0;e<y.length;++e){let i=a(g,y.at(e)),o=t(i,i,v),s=n(o);if(s<=x)continue;let c=Math.sqrt(s),l=(c-b)*.5;b+=l,x=b*b;let u=l/c;r(v,v,o,u)}_.radius=b,this.sphere=_,y.clear()}get children(){if(this._children)return this._children;let e=this.box;if(f(e)<=1)return;let{_readPosition:t,_numIndexPerPrimitive:n,primitiveIndices:r}=this,a=c(e,g),o=r.length,s=new Uint8Array(o),l=[0,0,0,0,0,0,0,0];for(let e=0;e<o;++e){let o=n*r[e],c=t(_,o);for(let e=1;e<n;++e)i(c,c,t(v,o+e));let u=+(c[0]<a[0])|(c[1]<a[1]?2:0)|(c[2]<a[2]?4:0);s[e]=u,++l[u]}let u=0;for(let e=0;e<8;++e)l[e]>0&&++u;if(u<2)return;let d=[void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0];for(let e=0;e<8;++e)l[e]>0&&(d[e]=new Uint32Array(l[e]));l.fill(0);for(let e=0;e<o;++e){let t=s[e];d[t][l[t]++]=r[e]}let p=[];for(let e=0;e<8;++e){let r=d[e];r!==void 0&&p.push(new h(r,n,t))}return this._children=p,this._children}static prune(){y.prune()}}const g=a(),_=a(),v=a(),y=new e({deallocator:null});export{h as BoundingInfo};
2
+ import{baseObjectMemory as e,estimateFixedArrayMemory as t,baseTypedArrayMemory as n,integerArrayElementBytes as r}from"../../../../core/memoryEstimations.js";import i from"../../../../core/PooledArray.js";import{isTypedArray as a}from"../../../../core/typedArrayUtil.js";import{subtract as o,sqrLen as s,scaleAndAdd as c,min as l}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as u}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{empty as d,expandWithVec3 as f,center as p,width as m,depth as h,height as g,squareDiameter as _}from"../../../../geometry/support/aaBoundingBox.js";import{isSharedIndexArray as v}from"../../../../geometry/support/Indices.js";import{Sphere as y}from"../../../../geometry/support/sphere.js";import{assert as b}from"./Util.js";class x{constructor(e,t,n,r){this.primitiveIndices=e,this._numIndexPerPrimitive=t,this._readPosition=n,this._notifyMemoryChange=r,this._children=void 0,b(e.length>=1);let i=e.length;T.clear();let a=d();for(let r=0;r<i;++r){let i=t*e[r];for(let e=0;e<t;++e){let t=i+e;T.push(t),f(a,n(S,t))}}this.box=a;let l=new y,u=p(a,l.center),_=.5*Math.max(m(a),h(a),g(a)),v=_*_;for(let e=0;e<T.length;++e){let t=n(S,T.at(e)),r=o(t,t,u),i=s(r);if(i<=v)continue;let a=Math.sqrt(i),l=(a-_)*.5;_+=l,v=_*_;let d=l/a;c(u,u,r,d)}l.radius=_,this.sphere=l,T.clear()}get usedMemory(){let n=e+56+t(this.box,8)+e+16+t(this.sphere.center,8)+E(this.primitiveIndices),r=this._children;if(r){n+=t(r,8);for(let e of r)n+=e.usedMemory}return n}get children(){if(this._children)return this._children;let e=this.box;if(_(e)<=1)return;let{_readPosition:n,_numIndexPerPrimitive:r,primitiveIndices:i}=this,a=p(e,S),o=i.length,s=new Uint8Array(o),c=[0,0,0,0,0,0,0,0];for(let e=0;e<o;++e){let t=r*i[e],o=n(C,t);for(let e=1;e<r;++e)l(o,o,n(w,t+e));let u=+(o[0]<a[0])|(o[1]<a[1]?2:0)|(o[2]<a[2]?4:0);s[e]=u,++c[u]}let u=0;for(let e=0;e<8;++e)c[e]>0&&++u;if(u<2)return;let d=[void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0];for(let e=0;e<8;++e)c[e]>0&&(d[e]=new Uint32Array(c[e]));c.fill(0);for(let e=0;e<o;++e){let t=s[e];d[t][c[t]++]=i[e]}let f=[];for(let e=0;e<8;++e){let t=d[e];t!==void 0&&f.push(new x(t,r,n,this._notifyMemoryChange))}return this._children=f,this._notifyMemoryChange?.(t(f,8)+f.reduce((e,t)=>e+t.usedMemory,0)),f}static prune(){T.prune()}}const S=u(),C=u(),w=u(),T=new i({deallocator:null});function E(e){return a(e)?n+(v(e)?0:e.byteLength):v(e)?0:t(e,r)}export{x as BoundingInfo};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{add as e}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{getContinuousIndexArray as t}from"../../../../geometry/support/Indices.js";import{NullSphere as n,Sphere as r}from"../../../../geometry/support/sphere.js";import{affectsGeometry as i}from"./affectsGeometry.js";import{BoundingInfo as a}from"./BoundingInfo.js";import{BufferGeometryBaseInstance as o}from"./BufferGeometryBaseInstance.js";import{Object3DHighlightStateID as s}from"./Object3DStateID.js";import{assert as c}from"./Util.js";class l extends o{constructor(e,t,n,r=null,i=null){super(t),this.material=e,this.localOrigin=n,this.mapPositions=r,this.baseGeometry=i,this.layerViewUid=null,this.graphicUid=null,this.castShadow=!1,this._readPrimitivePosition=null,this._boundingInfo=null,this._boundingSphere=null,this._highlights=null,this._highlightOptionsCounts=null,this.occludees=void 0,this.visible=!0;let a=e?.useIndexing??!1,o=t.index!=null,s=i!=null;c(!s||!a&&i.buffers.index==null&&!o,`Instancing for index materials is not supported`),c(!s||t.vertex.count===1,`Instanced BufferGeometry requires exactly one instance`),c(a===o,`Material index requirement and BufferGeometry.buffers.index must match`)}instantiate(e){return new l(e,this._buffers,this.localOrigin,this.mapPositions,this.baseGeometry)}get indexCount(){return this.baseGeometry?.buffers.indexCount??this._buffers.indexCount??0}get faceCount(){return this.indexCount/3}get readPrimitivePosition(){return this._readPrimitivePosition??=this.material.createPrimitivePositionReader(this.buffers,this.baseGeometry?.buffers),this._readPrimitivePosition}get boundingInfo(){return this._boundingInfo??=this._calculateBoundingInfo(),this._boundingInfo}get boundingSphere(){let t=this.boundingInfo?.sphere;if(t==null)return n;if(this._boundingSphere==null){let n=new r;n.copyFrom(t),e(n.center,n.center,this.localOrigin.vec3),this._boundingSphere=n}return this._boundingSphere}_calculateBoundingInfo(){let e=this.indexCount;if(e===0)return null;let n=this.material.primitiveVertexCount;c(e%n===0,`Indexing error: `+e+` not divisible by `+n);let r=t(e/n);return new a(r,n,this.readPrimitivePosition)}invalidateBoundingInfo(){this._boundingInfo=null,this._boundingSphere=null}getMutableVertexField(e,t){let n=this._buffers.vertex.getField(e,t);return n!=null&&i(e)&&this._invalidatePositionCaches(),n}getMutableStorageField(e,t){let n=this._buffers.storage?.getField(e,t);return n!=null&&i(e)&&this._invalidatePositionCaches(),n}_invalidatePositionCaches(){this._readPrimitivePosition=null,this.invalidateBoundingInfo()}computeAttachmentOrigin(t){return this.material.computeAttachmentOrigin(t,this.readPrimitivePosition,this.indexCount)?(e(t,t,this.localOrigin.vec3),!0):!1}get highlights(){return this._highlights||u}get hasHighlights(){return(this._highlightOptionsCounts?.size??0)>0}forEachHighlightOption(e){this._highlightOptionsCounts?.forEach((t,n)=>e(n))}allocateIdAndHighlight(e){let t=new s(e);return this.addHighlight(t)}addHighlight(e){this._ensureHighlights().add(e);let{highlightName:t}=e,n=(this._highlightOptionsCounts?.get(t)??0)+1;return this._ensureHighlightOptionsCounts().set(t,n),e}_ensureHighlights(){let e=this._highlights;return e||(e=new Set,this._highlights=e),e}_ensureHighlightOptionsCounts(){let e=this._highlightOptionsCounts;return e||(e=new Map,this._highlightOptionsCounts=e),e}removeHighlight(e){if(this._highlights?.delete(e)){let{highlightName:t}=e,n=this._highlightOptionsCounts?.get(t)??0;n<=1?this._highlightOptionsCounts?.delete(t):this._ensureHighlightOptionsCounts().set(t,n-1)}}}const u=new Set;export{l as BufferGeometry};
2
+ import{integerArrayElementBytes as e}from"../../../../core/memoryEstimations.js";import{add as t}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{getContinuousIndexArray as n}from"../../../../geometry/support/Indices.js";import{NullSphere as r,Sphere as i}from"../../../../geometry/support/sphere.js";import{affectsGeometry as a}from"./affectsGeometry.js";import{BoundingInfo as o}from"./BoundingInfo.js";import{BufferGeometryBaseInstance as s}from"./BufferGeometryBaseInstance.js";import{Object3DHighlightStateID as c}from"./Object3DStateID.js";import{assert as l}from"./Util.js";class u extends s{constructor(e,t,n,r=null,i=null){super(t),this.material=e,this.localOrigin=n,this.mapPositions=r,this.baseGeometry=i,this.layerViewUid=null,this.graphicUid=null,this.castShadow=!1,this._readPrimitivePosition=null,this._boundingInfo=null,this._boundingSphere=null,this._highlights=null,this._highlightOptionsCounts=null,this.occludees=void 0,this.visible=!0;let a=e?.useIndexing??!1,o=t.index!=null,s=i!=null;l(!s||!a&&i.buffers.index==null&&!o,`Instancing for index materials is not supported`),l(!s||t.vertex.count===1,`Instanced BufferGeometry requires exactly one instance`),l(a===o,`Material index requirement and BufferGeometry.buffers.index must match`)}instantiate(e){return new u(e,this._buffers,this.localOrigin,this.mapPositions,this.baseGeometry)}get usedMemoryExcludingBuffers(){return this._boundingInfo?.usedMemory??0}computeBufferMemory(t){return t.arrayMemory(this._buffers.index,e,!0)+t.arrayMemory(this._buffers.storage?.texelElementBuffer)+t.arrayMemory(this.mapPositions)+t.bufferMemory(this._buffers.vertex.buffer)}get indexCount(){return this.baseGeometry?.buffers.indexCount??this._buffers.indexCount??0}get faceCount(){return this.indexCount/3}get readPrimitivePosition(){return this._readPrimitivePosition??=this.material.createPrimitivePositionReader(this.buffers,this.baseGeometry?.buffers),this._readPrimitivePosition}get boundingInfo(){return this._boundingInfo||(this._boundingInfo=this._calculateBoundingInfo(),this._boundingInfo&&this.notifyMemoryChange?.(this._boundingInfo.usedMemory)),this._boundingInfo}get boundingSphere(){let e=this.boundingInfo?.sphere;if(e==null)return r;if(this._boundingSphere==null){let n=new i;n.copyFrom(e),t(n.center,n.center,this.localOrigin.vec3),this._boundingSphere=n}return this._boundingSphere}_calculateBoundingInfo(){let e=this.indexCount;if(e===0)return null;let t=this.material.primitiveVertexCount;l(e%t===0,`Indexing error: `+e+` not divisible by `+t);let r=n(e/t);return new o(r,t,this.readPrimitivePosition,e=>this.notifyMemoryChange?.(e))}invalidateBoundingInfo(){let e=this._boundingInfo?.usedMemory??0;this._boundingInfo=null,this._boundingSphere=null,e&&this.notifyMemoryChange?.(-e)}getMutableVertexField(e,t){let n=this._buffers.vertex.getField(e,t);return n!=null&&a(e)&&this._invalidatePositionCaches(),n}getMutableStorageField(e,t){let n=this._buffers.storage?.getField(e,t);return n!=null&&a(e)&&this._invalidatePositionCaches(),n}_invalidatePositionCaches(){this._readPrimitivePosition=null,this.invalidateBoundingInfo()}computeAttachmentOrigin(e){return this.material.computeAttachmentOrigin(e,this.readPrimitivePosition,this.indexCount)?(t(e,e,this.localOrigin.vec3),!0):!1}get highlights(){return this._highlights||d}get hasHighlights(){return(this._highlightOptionsCounts?.size??0)>0}forEachHighlightOption(e){this._highlightOptionsCounts?.forEach((t,n)=>e(n))}allocateIdAndHighlight(e){let t=new c(e);return this.addHighlight(t)}addHighlight(e){this._ensureHighlights().add(e);let{highlightName:t}=e,n=(this._highlightOptionsCounts?.get(t)??0)+1;return this._ensureHighlightOptionsCounts().set(t,n),e}_ensureHighlights(){let e=this._highlights;return e||(e=new Set,this._highlights=e),e}_ensureHighlightOptionsCounts(){let e=this._highlightOptionsCounts;return e||(e=new Map,this._highlightOptionsCounts=e),e}removeHighlight(e){if(this._highlights?.delete(e)){let{highlightName:t}=e,n=this._highlightOptionsCounts?.get(t)??0;n<=1?this._highlightOptionsCounts?.delete(t):this._ensureHighlightOptionsCounts().set(t,n-1)}}}const d=new Set;export{u as BufferGeometry};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{generateUID as e}from"../../../../core/uid.js";import{identity as t}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as n,IDENTITY as r}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{distance as i}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{empty as a,copy as o,offset as s,expandWithAABB as c,center as l,create as u}from"../../../../geometry/support/aaBoundingBox.js";import{affectsGeometry as d}from"./affectsGeometry.js";import{BoundingVolume as f}from"./BoundingVolume.js";import{Object3DOccludeeStateID as p,Object3DHighlightStateID as m}from"./Object3DStateID.js";import{assert as h}from"./Util.js";import{addObject3DStateID as g,removeObject3DStateID as _}from"../materials/renderers/utils.js";class v{constructor(t){this.id=e(),this.type=1,this.lastValidElevationBB=void 0,this._layer=null,this._visible=!0,this._highlightIds=new Set,this._boundingVolume=null,this._geometries=Array.from(t.geometries),this.castShadow=t.castShadow??!1,this.graphicUid=t.graphicUid,this.layerViewUid=t.layerViewUid;for(let e of this._geometries)this._applyObjectProperties(e);t.isElevationSource&&(this.lastValidElevationBB=a())}dispose(){this._geometries.length=0}get geometries(){return this._geometries}addGeometry(e){this._applyObjectProperties(e),this._geometries.push(e);for(let t of this._highlightIds)e.highlights.has(t)||e.addHighlight(t);this._emit(`geometryAdded`,{object:this,geometry:e}),this._highlightIds.size&&this._emit(`highlightChanged`,this),this._invalidateBoundingVolume()}removeGeometry(e){let t=this._geometries.splice(e,1)[0];if(t){for(let e of this._highlightIds)t.removeHighlight(e);this._emit(`geometryRemoved`,{object:this,geometry:t}),this._highlightIds.size&&this._emit(`highlightChanged`,this),this._invalidateBoundingVolume()}}removeAllGeometries(){for(;this._geometries.length>0;)this.removeGeometry(0)}_applyObjectProperties(e){e.castShadow=this.castShadow,e.graphicUid=this.graphicUid,e.layerViewUid=this.layerViewUid,e.visible=this._visible}get layer(){return this._layer}set layer(e){h(this._layer==null||e==null,`BufferObject3D can only be added to a single Layer`),this._layer=e}get visible(){return this._visible}set visible(e){if(this._visible!==e){this._visible=e;for(let e of this._geometries)e.visible=this._visible;this._emit(`visibilityChanged`,this)}}_emit(e,t){this.layer?.events.emit(e,t)}maskOccludee(){let e=new p;for(let t of this._geometries)t.occludees=g(t.occludees,e);return this._emit(`occlusionChanged`,this),e}removeOcclude(e){for(let t of this._geometries)t.occludees=_(t.occludees,e);this._emit(`occlusionChanged`,this)}highlight(e){let t=new m(e);for(let e of this._geometries)e.addHighlight(t);return this._highlightIds.add(t),this._emit(`highlightChanged`,this),t}removeHighlight(e){if(this._highlightIds.delete(e)){for(let t of this._geometries)t.removeHighlight(e);this._emit(`highlightChanged`,this)}}removeStateID(e){e.channel===0?this.removeHighlight(e):this.removeOcclude(e)}getCombinedStaticTransformation(e,n){return t(n)}getCombinedShaderTransformation(e,r=n()){return t(r)}get boundingVolumeWorldSpace(){return this._boundingVolume||(this._boundingVolume=new f,this._validateBoundingVolume(this._boundingVolume)),this._boundingVolume}get boundingVolumeObjectSpace(){return this.boundingVolumeWorldSpace}_validateBoundingVolume(e){for(let t of this._geometries){let{boundingInfo:n,localOrigin:r}=t;if(n==null)continue;let[i,a,l]=r.vec3;o(y,n.box),s(y,i,a,l),c(e.box,y)}l(e.box,e.sphere.center);for(let t of this._geometries){let{boundingInfo:n,boundingSphere:r}=t;if(n==null)continue;let a=i(r.center,e.sphere.center);e.sphere.radius=Math.max(e.sphere.radius,a+n.sphere.radius)}}get transformation(){return r}get shaderTransformation(){return null}get effectiveTransformation(){return r}geometryVertexAttributeUpdated(e,t,n=!1){d(t)&&this._invalidateBoundingVolume(),this._emit(`attributesChanged`,{object:this,geometry:e,attribute:t,sync:n})}_invalidateBoundingVolume(){let e=this._boundingVolume?.sphere;this._boundingVolume=void 0,this.layer&&e&&this.layer.notifyObjectBBChanged(this,e)}}const y=u();export{v as BufferObject3D};
2
+ import{generateUID as e}from"../../../../core/uid.js";import{identity as t}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as n,IDENTITY as r}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{distance as i}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{empty as a,copy as o,offset as s,expandWithAABB as c,center as l,create as u}from"../../../../geometry/support/aaBoundingBox.js";import{affectsGeometry as d}from"./affectsGeometry.js";import{BoundingVolume as f}from"./BoundingVolume.js";import{Object3DOccludeeStateID as p,Object3DHighlightStateID as m}from"./Object3DStateID.js";import{assert as h}from"./Util.js";import{addObject3DStateID as g,removeObject3DStateID as _}from"../materials/renderers/utils.js";class v{constructor(t){this.id=e(),this.type=1,this.lastValidElevationBB=void 0,this._layer=null,this._visible=!0,this._highlightIds=new Set,this._boundingVolume=null,this._geometries=Array.from(t.geometries),this.castShadow=t.castShadow??!1,this.graphicUid=t.graphicUid,this.layerViewUid=t.layerViewUid;for(let e of this._geometries)this._applyObjectProperties(e);t.isElevationSource&&(this.lastValidElevationBB=a())}dispose(){this._geometries.length=0}get geometries(){return this._geometries}addGeometry(e){this._applyObjectProperties(e),this._geometries.push(e);for(let t of this._highlightIds)e.highlights.has(t)||e.addHighlight(t);this._emit(`geometriesChanged`,{object:this,removed:[],added:[e]}),this._highlightIds.size&&this._emit(`highlightChanged`,this),this._invalidateBoundingVolume()}removeGeometry(e){let t=this._geometries.splice(e,1)[0];if(t){for(let e of this._highlightIds)t.removeHighlight(e);this._emit(`geometriesChanged`,{object:this,removed:[t],added:[]}),this._highlightIds.size&&this._emit(`highlightChanged`,this),this._invalidateBoundingVolume()}}removeAllGeometries(){for(;this._geometries.length>0;)this.removeGeometry(0)}_applyObjectProperties(e){e.castShadow=this.castShadow,e.graphicUid=this.graphicUid,e.layerViewUid=this.layerViewUid,e.visible=this._visible}get layer(){return this._layer}set layer(e){h(this._layer==null||e==null,`BufferObject3D can only be added to a single Layer`),this._layer=e}get visible(){return this._visible}set visible(e){if(this._visible!==e){this._visible=e;for(let e of this._geometries)e.visible=this._visible;this._emit(`visibilityChanged`,this)}}_emit(e,t){this.layer?.events.emit(e,t)}maskOccludee(){let e=new p;for(let t of this._geometries)t.occludees=g(t.occludees,e);return this._emit(`occlusionChanged`,this),e}removeOcclude(e){for(let t of this._geometries)t.occludees=_(t.occludees,e);this._emit(`occlusionChanged`,this)}highlight(e){let t=new m(e);for(let e of this._geometries)e.addHighlight(t);return this._highlightIds.add(t),this._emit(`highlightChanged`,this),t}removeHighlight(e){if(this._highlightIds.delete(e)){for(let t of this._geometries)t.removeHighlight(e);this._emit(`highlightChanged`,this)}}removeStateID(e){e.channel===0?this.removeHighlight(e):this.removeOcclude(e)}getCombinedStaticTransformation(e,n){return t(n)}getCombinedShaderTransformation(e,r=n()){return t(r)}get boundingVolumeWorldSpace(){return this._boundingVolume||(this._boundingVolume=new f,this._validateBoundingVolume(this._boundingVolume)),this._boundingVolume}get boundingVolumeObjectSpace(){return this.boundingVolumeWorldSpace}_validateBoundingVolume(e){for(let t of this._geometries){let{boundingInfo:n,localOrigin:r}=t;if(n==null)continue;let[i,a,l]=r.vec3;o(y,n.box),s(y,i,a,l),c(e.box,y)}l(e.box,e.sphere.center);for(let t of this._geometries){let{boundingInfo:n,boundingSphere:r}=t;if(n==null)continue;let a=i(r.center,e.sphere.center);e.sphere.radius=Math.max(e.sphere.radius,a+n.sphere.radius)}}get transformation(){return r}get shaderTransformation(){return null}get effectiveTransformation(){return r}geometryVertexAttributeUpdated(e,t,n=!1){d(t)&&this._invalidateBoundingVolume(),this._emit(`attributesChanged`,{object:this,geometry:e,attribute:t,sync:n})}_invalidateBoundingVolume(){let e=this._boundingVolume?.sphere;this._boundingVolume=void 0,this.layer&&e&&this.layer.notifyObjectBBChanged(this,e)}}const y=u();export{v as BufferObject3D};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- const e=[`layerObjectAdded`,`layerObjectRemoved`,`layerObjectsAdded`,`layerObjectsRemoved`,`transformationChanged`,`shaderTransformationChanged`,`visibilityChanged`,`occlusionChanged`,`highlightChanged`,`geometryAdded`,`geometryRemoved`,`attributesChanged`];export{e as DirtyEventNames};
2
+ const e=[`layerObjectAdded`,`layerObjectRemoved`,`layerObjectsAdded`,`layerObjectsRemoved`,`transformationChanged`,`shaderTransformationChanged`,`visibilityChanged`,`occlusionChanged`,`highlightChanged`,`geometriesChanged`,`attributesChanged`];export{e as DirtyEventNames};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{IDENTITY as e,clone as t}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{transformMat4 as n}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{getContinuousIndexArray as r}from"../../../../geometry/support/Indices.js";import{cloneAttributeData as i}from"./AttributeArray.js";import{BoundingInfo as a}from"./BoundingInfo.js";import{GeometryBaseInstance as o}from"./GeometryBaseInstance.js";import{Object3DHighlightStateID as s}from"./Object3DStateID.js";import{createPositionAttributeReader as c}from"./PositionReader.js";import{assert as l}from"./Util.js";import{webglDebugEnabled as u}from"../../../webgl/checkWebGLError.js";class d extends o{constructor(e,t,n=null,r=-1,i,a){super(t),this.material=e,this.mapPositions=n,this.edgeIndicesLength=r,this.baseGeometry=i,this.drawIndices=a,this._readPrimitivePosition=null,this._vertexPositionIndicesCache=void 0,this._transformation=void 0,this.localOrigin=void 0,this._highlights=null,this._highlightOptionsCounts=null,this.occludees=void 0,this.visible=!0,this._boundingInfo=null,l((e?.useIndexing??!1)===(a!=null),`Material index requirement and Geometry must match`),this.edgeIndicesLength<0&&(this.edgeIndicesLength=this.indexCount)}get readPrimitivePosition(){return this._readPrimitivePosition??=c(this.positionAttribute,this.drawIndices),this._readPrimitivePosition}_invalidateReadPrimitivePosition(){this._readPrimitivePosition=null}instantiate(e={}){let t=new d(e.material||this.material,[],this.mapPositions,this.edgeIndicesLength,this.baseGeometry,this.drawIndices);return this._attributes.forEach((e,n)=>{e.exclusive=!1,t._attributes.set(n,e)}),t._boundingInfo=this._boundingInfo,t.transformation=e.transformation||this.transformation,t}getMutableAttribute(e){let t=this._attributes.get(e);return t&&!t.exclusive&&(t={...t,exclusive:!0,data:i(t.data)},this._attributes.set(e,t),e===`position`&&this._invalidateReadPrimitivePosition()),t}setAttributeData(e,t){let n=this._attributes.get(e);n?(this._attributes.set(e,{...n,exclusive:!0,data:t}),e===`position`&&this._invalidateReadPrimitivePosition()):u()&&console.warn(`Setting undefined attribute ${e} data`)}get primitivePositionIndices(){return this._vertexPositionIndicesCache===void 0&&(this._vertexPositionIndicesCache=this._computePrimitivePositionIndices()),this._vertexPositionIndicesCache}_computePrimitivePositionIndices(){let{drawIndices:e}=this,t=this.positionAttribute;if(e!=null&&t!=null){let n=[];for(let r of e)n.push(t.indices[r]);return n}return t?.indices??null}get positionAttribute(){return this.attributes.get(`position`)??this.baseGeometry?.attributes.get(`position`)}get indexCount(){return(this.drawIndices??this.positionAttribute?.indices)?.length??0}get faceCount(){return this.indexCount/3}get boundingInfo(){return this._boundingInfo??=this._calculateBoundingInfo(),this._boundingInfo}computeAttachmentOrigin(e){return this.material.computeAttachmentOrigin(e,this.readPrimitivePosition,this.indexCount)?(this._transformation!=null&&n(e,e,this._transformation),!0):!1}invalidateBoundingInfo(){this._boundingInfo=null,this._vertexPositionIndicesCache=void 0}_calculateBoundingInfo(){let e=this.positionAttribute,t=this.indexCount;if(!e||t===0)return null;let n=this.material.primitiveVertexCount;l(t%n===0,`Indexing error: `+t+` not divisible by `+n);let i=r(t/n);return new a(i,n,this.readPrimitivePosition)}get transformation(){return this._transformation??e}set transformation(n){this._transformation=n&&n!==e?t(n):null}get highlights(){return this._highlights||f}get hasHighlights(){return(this._highlightOptionsCounts?.size??0)>0}forEachHighlightOption(e){this._highlightOptionsCounts?.forEach((t,n)=>e(n))}allocateIdAndHighlight(e){let t=new s(e);return this.addHighlight(t)}addHighlight(e){this._ensureHighlights().add(e);let{highlightName:t}=e,n=(this._highlightOptionsCounts?.get(t)??0)+1;return this._ensureHighlightOptionsCounts().set(t,n),e}_ensureHighlights(){let e=this._highlights;return e||(e=new Set,this._highlights=e),e}_ensureHighlightOptionsCounts(){let e=this._highlightOptionsCounts;return e||(e=new Map,this._highlightOptionsCounts=e),e}removeHighlight(e){if(this._highlights?.delete(e)){let{highlightName:t}=e,n=this._highlightOptionsCounts?.get(t)??0;n<=1?this._highlightOptionsCounts?.delete(t):this._ensureHighlightOptionsCounts().set(t,n-1)}}}const f=new Set;export{d as Geometry};
2
+ import{estimateArrayMemory as e,integerArrayElementBytes as t}from"../../../../core/memoryEstimations.js";import{IDENTITY as n,clone as r}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{transformMat4 as i}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{getContinuousIndexArray as a}from"../../../../geometry/support/Indices.js";import{cloneAttributeData as o}from"./AttributeArray.js";import{BoundingInfo as s}from"./BoundingInfo.js";import{GeometryBaseInstance as c}from"./GeometryBaseInstance.js";import{Object3DHighlightStateID as l}from"./Object3DStateID.js";import{createPositionAttributeReader as u}from"./PositionReader.js";import{assert as d}from"./Util.js";import{webglDebugEnabled as f}from"../../../webgl/checkWebGLError.js";class p extends c{get usedMemoryExcludingBuffers(){return this._usedMemory+this._primitivePositionIndicesMemory+(this._boundingInfo?.usedMemory??0)}get _primitivePositionIndicesMemory(){let n=this._vertexPositionIndicesCache;return n&&n!==this.positionAttribute?.indices?e(n,t):0}computeBufferMemory(e){let n=e.arrayMemory(this.mapPositions)+e.arrayMemory(this.drawIndices,t,!0);for(let r of this.attributes.values())n+=e.arrayMemory(r.data)+e.arrayMemory(r.indices,t,!0);return n}constructor(e,t,n=null,r=-1,i,a){super(t),this.material=e,this.mapPositions=n,this.edgeIndicesLength=r,this.baseGeometry=i,this.drawIndices=a,this._usedMemory=0,this._readPrimitivePosition=null,this._vertexPositionIndicesCache=void 0,this._transformation=void 0,this.localOrigin=void 0,this._highlights=null,this._highlightOptionsCounts=null,this.occludees=void 0,this.visible=!0,this._boundingInfo=null,d((e?.useIndexing??!1)===(a!=null),`Material index requirement and Geometry must match`),this.edgeIndicesLength<0&&(this.edgeIndicesLength=this.indexCount)}get readPrimitivePosition(){return this._readPrimitivePosition??=u(this.positionAttribute,this.drawIndices),this._readPrimitivePosition}_invalidateReadPrimitivePosition(){this._readPrimitivePosition=null}instantiate(e={}){let t=new p(e.material||this.material,[],this.mapPositions,this.edgeIndicesLength,this.baseGeometry,this.drawIndices);return this._attributes.forEach((e,n)=>{e.exclusive=!1,t._attributes.set(n,e)}),t._boundingInfo=this._boundingInfo,t.transformation=e.transformation||this.transformation,t}getMutableAttribute(e){let t=this._attributes.get(e);return t&&!t.exclusive&&(t={...t,exclusive:!0,data:o(t.data)},this._attributes.set(e,t),e===`position`&&this._invalidateReadPrimitivePosition()),t}setAttributeData(e,t){let n=this._attributes.get(e);n?(this._attributes.set(e,{...n,exclusive:!0,data:t}),e===`position`&&this._invalidateReadPrimitivePosition()):f()&&console.warn(`Setting undefined attribute ${e} data`)}get primitivePositionIndices(){if(this._vertexPositionIndicesCache!==void 0)return this._vertexPositionIndicesCache;this._vertexPositionIndicesCache=this._computePrimitivePositionIndices();let e=this._primitivePositionIndicesMemory;return e&&this.notifyMemoryChange?.(e),this._vertexPositionIndicesCache}_computePrimitivePositionIndices(){let{drawIndices:e}=this,t=this.positionAttribute;if(e!=null&&t!=null){let n=Array(e.length).fill(0);for(let r=0;r<e.length;r++)n[r]=t.indices[e[r]];return n}return t?.indices??null}get positionAttribute(){return this.attributes.get(`position`)??this.baseGeometry?.attributes.get(`position`)}get indexCount(){return(this.drawIndices??this.positionAttribute?.indices)?.length??0}get faceCount(){return this.indexCount/3}get boundingInfo(){return this._boundingInfo||(this._boundingInfo=this._calculateBoundingInfo(),this._boundingInfo&&this.notifyMemoryChange?.(this._boundingInfo.usedMemory)),this._boundingInfo}computeAttachmentOrigin(e){return this.material.computeAttachmentOrigin(e,this.readPrimitivePosition,this.indexCount)?(this._transformation!=null&&i(e,e,this._transformation),!0):!1}invalidateBoundingInfo(){let e=this._primitivePositionIndicesMemory+(this._boundingInfo?.usedMemory??0);this._boundingInfo=null,this._vertexPositionIndicesCache=void 0,e&&this.notifyMemoryChange?.(-e)}_calculateBoundingInfo(){let e=this.positionAttribute,t=this.indexCount;if(!e||t===0)return null;let n=this.material.primitiveVertexCount;d(t%n===0,`Indexing error: `+t+` not divisible by `+n);let r=a(t/n);return new s(r,n,this.readPrimitivePosition,e=>this.notifyMemoryChange?.(e))}get transformation(){return this._transformation??n}set transformation(e){this._transformation=e&&e!==n?r(e):null}get highlights(){return this._highlights||m}get hasHighlights(){return(this._highlightOptionsCounts?.size??0)>0}forEachHighlightOption(e){this._highlightOptionsCounts?.forEach((t,n)=>e(n))}allocateIdAndHighlight(e){let t=new l(e);return this.addHighlight(t)}addHighlight(e){this._ensureHighlights().add(e);let{highlightName:t}=e,n=(this._highlightOptionsCounts?.get(t)??0)+1;return this._ensureHighlightOptionsCounts().set(t,n),e}_ensureHighlights(){let e=this._highlights;return e||(e=new Set,this._highlights=e),e}_ensureHighlightOptionsCounts(){let e=this._highlightOptionsCounts;return e||(e=new Map,this._highlightOptionsCounts=e),e}removeHighlight(e){if(this._highlights?.delete(e)){let{highlightName:t}=e,n=this._highlightOptionsCounts?.get(t)??0;n<=1?this._highlightOptionsCounts?.delete(t):this._ensureHighlightOptionsCounts().set(t,n-1)}}}const m=new Set;export{p as Geometry};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import e from"../../../../core/Error.js";import{EventEmitter as t}from"../../../../core/Evented.js";import{disposeMaybe as n,removeMaybe as r}from"../../../../core/maybe.js";import{throwIfAborted as i,onAbort as a,createAbortError as o}from"../../../../core/promiseUtils.js";import{isUint8Array as s,isArrayBuffer as c,isTypedArray as l}from"../../../../core/typedArrayUtil.js";import{generateUID as u}from"../../../../core/uid.js";import{isBlobProtocol as d,isDataProtocol as f}from"../../../../core/urlUtils.js";import{whenVideoPlayable as p}from"../../../../layers/support/videoUtils.js";import{requestImage as m}from"../../../../request/image.js";import{loadImage as h}from"../../../../request/loadImage.js";import{createTextureKTX1 as g,createTextureKTX2 as _,createTextureBasis as v,estimateMemoryKTX2 as y,estimateMemoryBasis as b}from"./BasisUtil.js";import{createDDSTexture as x}from"./DDSUtil.js";import{ensureImageMaxSize as S}from"./textureUtils.js";import{assert as C}from"./Util.js";import w from"../../../webgl/Texture.js";import{TextureDescriptor as T}from"../../../webgl/TextureDescriptor.js";import{isCompressedFormat as E,isSizedPixelFormat as D,isSizedDepthFormat as O,isSizedDepthStencilFormat as k}from"../../../webgl/textureUtils.js";import{getFormatComponents as A}from"../../../webgl/Util.js";class j{constructor(e,n){this._data=e,this.id=u(),this.events=new t,this._parameters={...P,...n},this._startPreload(e)}dispose(){this.unload(),this._data=this.update=void 0}_startPreload(e){e instanceof HTMLVideoElement?(this.update=t=>this._update(e,t),this._startPreloadVideoElement(e)):e instanceof HTMLImageElement&&this._startPreloadImageElement(e)}_startPreloadVideoElement(e){if(!d(e.src)&&(e.preload!==`auto`||!e.crossOrigin)&&(e.preload=`auto`,e.crossOrigin=`anonymous`,e.src=e.src,e.paused&&e.autoplay)){let t=[];p(e,e=>t.push(e)).then(()=>{e.play()}).finally(()=>t.forEach(e=>e.remove()))}}_startPreloadImageElement(e){f(e.src)||d(e.src)||e.crossOrigin||(e.crossOrigin=`anonymous`,e.src=e.src)}_createDescriptor(e){let t=new T;return t.wrapMode=this._parameters.wrap??10497,t.flipped=!this._parameters.noUnpackFlip,t.samplingMode=this._parameters.mipmap?9987:9729,t.hasMipmap=!!this._parameters.mipmap,t.preMultiplyAlpha=!!this._parameters.preMultiplyAlpha,t.maxAnisotropy=this._parameters.maxAnisotropy??(this._parameters.mipmap?e.parameters.maxMaxAnisotropy:1),t.dataType=this._parameters.dataType??t.dataType,t.pixelFormat=this._parameters.pixelFormat??t.pixelFormat,t.internalFormat=this._parameters.internalFormat??t.internalFormat,t.isImmutable=this._parameters.immutable===!0&&F(this._parameters.internalFormat),t}get texture(){return this._texture??this._emptyTexture}get loaded(){return this._texture!=null}get usedMemory(){return this._texture?.usedMemory||M(this._data,this._parameters)}load(e){if(this._loadingPromise)return this._loadingPromise;if(this._texture)return this._texture;let t=this._data;return t==null?(this._texture=new w(e,this._createDescriptor(e),null),this._texture):(this._emptyTexture=e.emptyTexture,this._parameters.reloadable||(this._data=void 0),typeof t==`string`?this._loadFromURL(e,t):t instanceof Image?this._loadFromImageElement(e,t):t instanceof HTMLVideoElement?this._loadFromVideoElement(e,t):t instanceof ImageData||t instanceof HTMLCanvasElement?this._loadFromImage(e,t):s(t)&&this._parameters.encoding===`image/vnd-ms.dds`?this._loadFromDDSData(e,t):c(t)&&this._parameters.encoding===`image/vnd-ms.dds`?this._loadFromDDSData(e,new Uint8Array(t)):s(t)&&this._parameters.encoding===`image/ktx`?this._loadFromKTX1(e,t):c(t)&&this._parameters.encoding===`image/ktx`?this._loadFromKTX1(e,new Uint8Array(t)):(c(t)||s(t))&&this._parameters.encoding===`image/ktx2`?this._loadFromKTX2(e,t):(c(t)||s(t))&&this._parameters.encoding===`image/x.basis`?this._loadFromBasis(e,t):c(t)?this._loadFromPixelData(e,new Uint8Array(t)):l(t)?this._loadFromPixelData(e,t):null)}_update(e,t){return this._texture==null||e.readyState<HTMLMediaElement.HAVE_CURRENT_DATA||t===e.currentTime?t:(this._texture.setData(e),this._texture.descriptor.hasMipmap&&this._texture.generateMipmap(),this._parameters.updateCallback&&this._parameters.updateCallback(),e.currentTime)}_loadFromDDSData(e,t){return this._texture=x(e,this._createDescriptor(e),t),this._emptyTexture=null,this._texture}_loadFromKTX1(e,t){return this._texture=g(e,this._createDescriptor(e),t),this._emptyTexture=null,this._texture}_loadFromKTX2(e,t){return this._loadAsync(()=>_(e,this._createDescriptor(e),t).then(e=>(this._texture=e,e)))}_loadFromBasis(e,t){return this._loadAsync(()=>v(e,this._createDescriptor(e),t).then(e=>(this._texture=e,e)))}_loadFromPixelData(e,t){C(this._parameters.width>0&&this._parameters.height>0);let n=this._createDescriptor(e);return(n.pixelFormat===6407||n.pixelFormat===6408)&&(n.compress=this._parameters.compressionOptions),n.width=this._parameters.width??0,n.height=this._parameters.height??0,this._texture=new w(e,n,t),this._texture}_loadFromURL(e,t){return this._loadAsync(async n=>{let r=await m(t,{signal:n});return i(n),this._loadFromImage(e,r)})}_loadFromImageElement(e,t){return t.complete?this._loadFromImage(e,t):this._loadAsync(async n=>{let r=await h(t,t.src,!1,n);return i(n),this._loadFromImage(e,r)})}_loadFromVideoElement(e,t){return t.readyState>=HTMLMediaElement.HAVE_CURRENT_DATA?this._loadFromImage(e,t):this._loadFromVideoElementAsync(e,t)}_loadFromVideoElementAsync(t,n){return this._loadAsync(i=>new Promise((s,c)=>{let l=()=>{n.removeEventListener(`loadeddata`,u),n.removeEventListener(`error`,d),r(f)},u=()=>{n.readyState>=HTMLMediaElement.HAVE_CURRENT_DATA&&(l(),s(this._loadFromImage(t,n)))},d=t=>{l(),c(t||new e(`texture:load-error`,`Failed to load video`))};n.addEventListener(`loadeddata`,u),n.addEventListener(`error`,d);let f=a(i,()=>d(o()))}))}_loadFromImage(e,t){let n=t;n instanceof HTMLVideoElement||(n=S(n,e.parameters));let r=N(n);this._parameters.width=r.width,this._parameters.height=r.height;let i=this._createDescriptor(e);return i.width=r.width,i.height=r.height,i.compress=this._parameters.compressionOptions,this._texture=new w(e,i,n),this._emptyTexture=null,this.events.emit(`loaded`),this._texture}_loadAsync(e){let t=new AbortController;this._loadingController=t;let n=e(t.signal);this._loadingPromise=n;let r=()=>{this._loadingController===t&&(this._loadingController=null),this._loadingPromise===n&&(this._loadingPromise=null),this._emptyTexture=null};return n.then(r,r),n}unload(){if(this._texture=n(this._texture),this._emptyTexture=null,this._loadingController!=null){let e=this._loadingController;this._loadingController=null,this._loadingPromise=null,e.abort()}this.events.emit(`unloaded`)}get parameters(){return this._parameters}}function M(e,t){if(e==null)return 0;if(c(e)||s(e))return t.encoding===`image/ktx2`?y(e,!!t.mipmap):t.encoding===`image/x.basis`?b(e,!!t.mipmap):e.byteLength;let{width:n,height:r}=e instanceof Image||e instanceof ImageData||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement?N(e):t,i=t.pixelFormat??6408,a=A(i);return(t.mipmap?4/3:1)*n*r*a||0}function N(e){return e instanceof HTMLVideoElement?{width:e.videoWidth,height:e.videoHeight}:e}const P={wrap:{s:10497,t:10497},mipmap:!0,noUnpackFlip:!1,preMultiplyAlpha:!1};function F(e){return e!=null&&(E(e)||D(e)||O(e)||k(e))}export{j as ManagedTexture};
2
+ import e from"../../../../core/Error.js";import{EventEmitter as t}from"../../../../core/Evented.js";import has from"../../../../core/has.js";import{disposeMaybe as n,removeMaybe as r}from"../../../../core/maybe.js";import{throwIfAborted as i,onAbort as a,createAbortError as o}from"../../../../core/promiseUtils.js";import{isUint8Array as s,isArrayBuffer as c,isTypedArray as l}from"../../../../core/typedArrayUtil.js";import{generateUID as u}from"../../../../core/uid.js";import{isBlobProtocol as d,isDataProtocol as f}from"../../../../core/urlUtils.js";import{whenVideoPlayable as p}from"../../../../layers/support/videoUtils.js";import{requestImage as m}from"../../../../request/image.js";import{loadImage as h}from"../../../../request/loadImage.js";import{createTextureKTX1 as g,createTextureKTX2 as _,createTextureBasis as v,estimateMemoryKTX2 as y,estimateMemoryBasis as b}from"./BasisUtil.js";import{createDDSTexture as x}from"./DDSUtil.js";import{ensureImageMaxSize as S}from"./textureUtils.js";import{assert as C}from"./Util.js";import w from"../../../webgl/Texture.js";import{TextureDescriptor as T}from"../../../webgl/TextureDescriptor.js";import{isCompressedFormat as E,isSizedPixelFormat as D,isSizedDepthFormat as O,isSizedDepthStencilFormat as k}from"../../../webgl/textureUtils.js";import{getFormatComponents as A}from"../../../webgl/Util.js";const j=!!has(`esri-tests-disable-gpu-memory-measurements`);class M{constructor(e,n){this._data=e,this.id=u(),this.events=new t,this._parameters={...F,...n},this._startPreload(e)}dispose(){this.unload(),this._data=this.update=void 0}_startPreload(e){e instanceof HTMLVideoElement?(this.update=t=>this._update(e,t),this._startPreloadVideoElement(e)):e instanceof HTMLImageElement&&this._startPreloadImageElement(e)}_startPreloadVideoElement(e){if(!d(e.src)&&(e.preload!==`auto`||!e.crossOrigin)&&(e.preload=`auto`,e.crossOrigin=`anonymous`,e.src=e.src,e.paused&&e.autoplay)){let t=[];p(e,e=>t.push(e)).then(()=>{e.play()}).finally(()=>t.forEach(e=>e.remove()))}}_startPreloadImageElement(e){f(e.src)||d(e.src)||e.crossOrigin||(e.crossOrigin=`anonymous`,e.src=e.src)}_createDescriptor(e){let t=new T;return t.wrapMode=this._parameters.wrap??10497,t.flipped=!this._parameters.noUnpackFlip,t.samplingMode=this._parameters.mipmap?9987:9729,t.hasMipmap=!!this._parameters.mipmap,t.preMultiplyAlpha=!!this._parameters.preMultiplyAlpha,t.maxAnisotropy=this._parameters.maxAnisotropy??(this._parameters.mipmap?e.parameters.maxMaxAnisotropy:1),t.dataType=this._parameters.dataType??t.dataType,t.pixelFormat=this._parameters.pixelFormat??t.pixelFormat,t.internalFormat=this._parameters.internalFormat??t.internalFormat,t.isImmutable=this._parameters.immutable===!0&&I(this._parameters.internalFormat),t}get texture(){return this._texture??this._emptyTexture}get loaded(){return this._texture!=null}get usedMemory(){return j?0:this._texture?.usedMemory??N(this._data,this._parameters)}load(e){if(this._loadingPromise)return this._loadingPromise;if(this._texture)return this._texture;let t=this._data;return t==null?(this._texture=new w(e,this._createDescriptor(e),null),this._texture):(this._emptyTexture=e.emptyTexture,this._parameters.reloadable||(this._data=void 0),typeof t==`string`?this._loadFromURL(e,t):t instanceof Image?this._loadFromImageElement(e,t):t instanceof HTMLVideoElement?this._loadFromVideoElement(e,t):t instanceof ImageData||t instanceof HTMLCanvasElement?this._loadFromImage(e,t):s(t)&&this._parameters.encoding===`image/vnd-ms.dds`?this._loadFromDDSData(e,t):c(t)&&this._parameters.encoding===`image/vnd-ms.dds`?this._loadFromDDSData(e,new Uint8Array(t)):s(t)&&this._parameters.encoding===`image/ktx`?this._loadFromKTX1(e,t):c(t)&&this._parameters.encoding===`image/ktx`?this._loadFromKTX1(e,new Uint8Array(t)):(c(t)||s(t))&&this._parameters.encoding===`image/ktx2`?this._loadFromKTX2(e,t):(c(t)||s(t))&&this._parameters.encoding===`image/x.basis`?this._loadFromBasis(e,t):c(t)?this._loadFromPixelData(e,new Uint8Array(t)):l(t)?this._loadFromPixelData(e,t):null)}_update(e,t){return this._texture==null||e.readyState<HTMLMediaElement.HAVE_CURRENT_DATA||t===e.currentTime?t:(this._texture.setData(e),this._texture.descriptor.hasMipmap&&this._texture.generateMipmap(),this._parameters.updateCallback&&this._parameters.updateCallback(),e.currentTime)}_loadFromDDSData(e,t){return this._texture=x(e,this._createDescriptor(e),t),this._emptyTexture=null,this._texture}_loadFromKTX1(e,t){return this._texture=g(e,this._createDescriptor(e),t),this._emptyTexture=null,this._texture}_loadFromKTX2(e,t){return this._loadAsync(()=>_(e,this._createDescriptor(e),t).then(e=>(this._texture=e,e)))}_loadFromBasis(e,t){return this._loadAsync(()=>v(e,this._createDescriptor(e),t).then(e=>(this._texture=e,e)))}_loadFromPixelData(e,t){C(this._parameters.width>0&&this._parameters.height>0);let n=this._createDescriptor(e);return(n.pixelFormat===6407||n.pixelFormat===6408)&&(n.compress=this._parameters.compressionOptions),n.width=this._parameters.width??0,n.height=this._parameters.height??0,this._texture=new w(e,n,t),this._texture}_loadFromURL(e,t){return this._loadAsync(async n=>{let r=await m(t,{signal:n});return i(n),this._loadFromImage(e,r)})}_loadFromImageElement(e,t){return t.complete?this._loadFromImage(e,t):this._loadAsync(async n=>{let r=await h(t,t.src,!1,n);return i(n),this._loadFromImage(e,r)})}_loadFromVideoElement(e,t){return t.readyState>=HTMLMediaElement.HAVE_CURRENT_DATA?this._loadFromImage(e,t):this._loadFromVideoElementAsync(e,t)}_loadFromVideoElementAsync(t,n){return this._loadAsync(i=>new Promise((s,c)=>{let l=()=>{n.removeEventListener(`loadeddata`,u),n.removeEventListener(`error`,d),r(f)},u=()=>{n.readyState>=HTMLMediaElement.HAVE_CURRENT_DATA&&(l(),s(this._loadFromImage(t,n)))},d=t=>{l(),c(t||new e(`texture:load-error`,`Failed to load video`))};n.addEventListener(`loadeddata`,u),n.addEventListener(`error`,d);let f=a(i,()=>d(o()))}))}_loadFromImage(e,t){let n=t;n instanceof HTMLVideoElement||(n=S(n,e.parameters));let r=P(n);this._parameters.width=r.width,this._parameters.height=r.height;let i=this._createDescriptor(e);return i.width=r.width,i.height=r.height,i.compress=this._parameters.compressionOptions,this._texture=new w(e,i,n),this._emptyTexture=null,this.events.emit(`loaded`),this._texture}_loadAsync(e){let t=new AbortController;this._loadingController=t;let n=e(t.signal);this._loadingPromise=n;let r=()=>{this._loadingController===t&&(this._loadingController=null),this._loadingPromise===n&&(this._loadingPromise=null),this._emptyTexture=null};return n.then(r,r),n}unload(){if(this._texture=n(this._texture),this._emptyTexture=null,this._loadingController!=null){let e=this._loadingController;this._loadingController=null,this._loadingPromise=null,e.abort()}this.events.emit(`unloaded`)}get parameters(){return this._parameters}}function N(e,t){if(e==null)return 0;if(c(e)||s(e))return t.encoding===`image/ktx2`?y(e,!!t.mipmap):t.encoding===`image/x.basis`?b(e,!!t.mipmap):e.byteLength;let{width:n,height:r}=e instanceof Image||e instanceof ImageData||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement?P(e):t,i=t.pixelFormat??6408,a=A(i);return(t.mipmap?4/3:1)*n*r*a||0}function P(e){return e instanceof HTMLVideoElement?{width:e.videoWidth,height:e.videoHeight}:e}const F={wrap:{s:10497,t:10497},mipmap:!0,noUnpackFlip:!1,preMultiplyAlpha:!1};function I(e){return e!=null&&(E(e)||D(e)||O(e)||k(e))}export{M as ManagedTexture};
@@ -1,3 +1,3 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import"../../../../core/has.js";import{NestedMap as n}from"../../../../core/NestedMap.js";import{nullUid as r}from"../../../../core/uid.js";import{property as i,subclass as a}from"../../../../core/accessorSupport/decorators.js";import{assert as o}from"./Util.js";class s{constructor(e,t,n,r){this.operation=e,this.geometry=t,this.states=n,this.sync=r}}let c=class extends t{constructor(e){super(e),this._residentGeomRecords=new n,this._dirtyGeomRecords=new n,this._dirtyRecordCount=0}get dirty(){return this._dirtyRecordCount>0}commitLayer(e,t){let n=this._dirtyGeomRecords.getInner(e),r=this.model.getLayer(e);if(!n||!r)return;let i=0;n.forEach((n,a)=>{let s=this._ensureGeomRecord(e,a);this._dirtyGeomRecords.delete(e,a),i+=n.size,n.forEach(({geometry:e,operation:n,states:i},c)=>{let l=!1;if(n===1){let n=s.get(c);if(n){if(i&4){let t=r.getObject(a);o(t?.type!==1&&n.type!==1&&e.type!==1,`ModelDirtySet.commitLayer: invalid update on BufferObject3D`),this.model.updateRenderGeometryTransformation(t,e,n)&&(l=!0)}l||t.updates.push({renderGeometry:n,updateType:i})}else o(!1,`ModelDirtySet.commitLayer: invalid update`)}if(n===2||l){let e=s.get(c);e?(t.removes.push(e),s.delete(c)):n===2&&o(!1,`ModelDirtySet.commitLayer: invalid remove`)}if(n===0||l){let n=r.getObject(a);if(n!=null){let r=this.model.getRenderGeometry(n,e);t.adds.push(r),s.set(c,r)}}}),s.size===0&&this._residentGeomRecords.delete(e,a)}),this._dirtyRecordCount-=i}commitSyncUpdates(e,t){let n=this._dirtyGeomRecords.getInner(e),r=this.model.getLayer(e);n&&r&&n.forEach((n,i)=>{let a=this._ensureGeomRecord(e,i);n.forEach(({geometry:e,operation:n,states:s,sync:c},l)=>{let u=!1;if(n===1&&c){let n=a.get(l);if(n){if(s&4){let t=r.getObject(i);o(t?.type!==1&&n.type!==1&&e.type!==1,`ModelDirtySet.commitLayer: invalid update on BufferObject3D`),this.model.updateRenderGeometryTransformation(t,e,n)&&(u=!0)}u||t.updates.push({renderGeometry:n,updateType:s})}else o(!1,`ModelDirtySet.commitSyncUpdates: invalid update`)}})})}_objectStateChanged(e,t){for(let n of t.geometries)this._updateOrCreateDirtyRecord(t,n,1,e)}visibilityChanged(e){this._objectStateChanged(1,e)}highlightChanged(e){this._objectStateChanged(8,e)}occlusionChanged(e){this._objectStateChanged(16,e)}attributesChanged({object:e,geometry:t,sync:n}){this._updateOrCreateDirtyRecord(e,t,1,2,n)}layerAdded(e){e.objects.forEach(e=>this.layerObjectAdded(e))}layerRemoved(e){e.objects.forEach(e=>this.layerObjectRemoved(e))}layerObjectAdded(e){for(let t of e.geometries)this._geometryAdded(e,t)}layerObjectRemoved(e){for(let t of e.geometries)this._geometryRemoved(e,t)}layerObjectsAdded(e){for(let t of e)this.layerObjectAdded(t)}layerObjectsRemoved(e){for(let t of e)this.layerObjectRemoved(t)}transformationChanged(e){let t=this._getLayerId(e),n=e.id,r=this._ensureGeomRecord(t,n);for(let{geometry:t}of r.values().filter(e=>e.type!==1))this._updateOrCreateDirtyRecord(e,t,1,4)}shaderTransformationChanged(e){let t=this._getLayerId(e),n=e.id,r=this._ensureGeomRecord(t,n);for(let t of r.values().filter(e=>e.type!==1))t.objectShaderTransformationChanged(e.shaderTransformation)}geometryAdded(e){this._geometryAdded(e.object,e.geometry)}_geometryAdded(e,t){this._updateOrCreateDirtyRecord(e,t,0)}geometryRemoved(e){this._geometryRemoved(e.object,e.geometry)}_geometryRemoved(e,t){this._updateOrCreateDirtyRecord(e,t,2)}_updateOrCreateDirtyRecord(e,t,n,r=0,i=!1){let a=this._getLayerId(e),c=e.id,l=t.id,u=this._ensureDirtyRecord(a,c),d=u.get(l);if(d){let e=d.operation;e===2&&n===0&&d.states!==0?d.operation=1:e===2&&n===0||e===0&&n===2?(u.delete(l),this._dirtyRecordCount--):e===1&&(n===2||n===1)?(d.operation=n,d.states|=r):(o((e===2||e===0)&&n===1,`ModelDirtySet.objectGeometryAdded: inconsistent state`),d.states|=r),d.sync=d.sync||i}else u.set(l,new s(n,t,r,i)),this._dirtyRecordCount++}_ensureGeomRecord(e,t){let n=this._residentGeomRecords.get(e,t);return n||(n=new Map,this._residentGeomRecords.set(e,t,n)),n}assertLayerClean(e){o(this._dirtyGeomRecords.getInner(e)==null,`Dirty geometry records for removed layer`)}_ensureDirtyRecord(e,t){let n=this.model.getLayer(e);o(n!=null,`Updating geometry record for an unregistered layer`);let r=this._dirtyGeomRecords.get(e,t);return r||(r=new Map,this._dirtyGeomRecords.set(e,t,r)),r}_getLayerId(e){return e.layer?.id??r}formatDebugInfo(){let e=[`ADD`,`UPD`,void 0,`REM`],t=``;return this._dirtyGeomRecords.forAll((n,r,i)=>{t.length>0&&(t+=`
2
+ import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import"../../../../core/has.js";import{NestedMap as n}from"../../../../core/NestedMap.js";import{nullUid as r}from"../../../../core/uid.js";import{property as i,subclass as a}from"../../../../core/accessorSupport/decorators.js";import{assert as o}from"./Util.js";class s{constructor(e,t,n,r){this.operation=e,this.geometry=t,this.states=n,this.sync=r}}let c=class extends t{constructor(e){super(e),this._residentGeomRecords=new n,this._dirtyGeomRecords=new n,this._dirtyRecordCount=0}get dirty(){return this._dirtyRecordCount>0}commitLayer(e,t){let n=this._dirtyGeomRecords.getInner(e),r=this.model.getLayer(e);if(!n||!r)return;let i=0;n.forEach((n,a)=>{let s=this._ensureGeomRecord(e,a);this._dirtyGeomRecords.delete(e,a),i+=n.size,n.forEach(({geometry:e,operation:n,states:i},c)=>{let l=!1;if(n===1){let n=s.get(c);if(n){if(i&4){let t=r.getObject(a);o(t?.type!==1&&n.type!==1&&e.type!==1,`ModelDirtySet.commitLayer: invalid update on BufferObject3D`),this.model.updateRenderGeometryTransformation(t,e,n)&&(l=!0)}l||t.updates.push({renderGeometry:n,updateType:i})}else o(!1,`ModelDirtySet.commitLayer: invalid update`)}if(n===2||l){let e=s.get(c);e?(t.removes.push(e),s.delete(c)):n===2&&o(!1,`ModelDirtySet.commitLayer: invalid remove`)}if(n===0||l){let n=r.getObject(a);if(n!=null){let r=this.model.getRenderGeometry(n,e);t.adds.push(r),s.set(c,r)}}}),s.size===0&&this._residentGeomRecords.delete(e,a)}),this._dirtyRecordCount-=i}commitSyncUpdates(e,t){let n=this._dirtyGeomRecords.getInner(e),r=this.model.getLayer(e);n&&r&&n.forEach((n,i)=>{let a=this._ensureGeomRecord(e,i);n.forEach(({geometry:e,operation:n,states:s,sync:c},l)=>{let u=!1;if(n===1&&c){let n=a.get(l);if(n){if(s&4){let t=r.getObject(i);o(t?.type!==1&&n.type!==1&&e.type!==1,`ModelDirtySet.commitLayer: invalid update on BufferObject3D`),this.model.updateRenderGeometryTransformation(t,e,n)&&(u=!0)}u||t.updates.push({renderGeometry:n,updateType:s})}else o(!1,`ModelDirtySet.commitSyncUpdates: invalid update`)}})})}_objectStateChanged(e,t){for(let n of t.geometries)this._updateOrCreateDirtyRecord(t,n,1,e)}visibilityChanged(e){this._objectStateChanged(1,e)}highlightChanged(e){this._objectStateChanged(8,e)}occlusionChanged(e){this._objectStateChanged(16,e)}attributesChanged({object:e,geometry:t,sync:n}){this._updateOrCreateDirtyRecord(e,t,1,2,n)}layerAdded(e){e.objects.forEach(e=>this.layerObjectAdded(e))}layerRemoved(e){e.objects.forEach(e=>this.layerObjectRemoved(e))}layerObjectAdded(e){for(let t of e.geometries)this._geometryAdded(e,t)}layerObjectRemoved(e){for(let t of e.geometries)this._geometryRemoved(e,t)}layerObjectsAdded(e){for(let t of e)this.layerObjectAdded(t)}layerObjectsRemoved(e){for(let t of e)this.layerObjectRemoved(t)}transformationChanged(e){let t=this._getLayerId(e),n=e.id,r=this._ensureGeomRecord(t,n);for(let{geometry:t}of r.values().filter(e=>e.type!==1))this._updateOrCreateDirtyRecord(e,t,1,4)}shaderTransformationChanged(e){let t=this._getLayerId(e),n=e.id,r=this._ensureGeomRecord(t,n);for(let t of r.values().filter(e=>e.type!==1))t.objectShaderTransformationChanged(e.shaderTransformation)}_geometryAdded(e,t){this._updateOrCreateDirtyRecord(e,t,0)}_geometryRemoved(e,t){this._updateOrCreateDirtyRecord(e,t,2)}geometriesChanged({object:e,removed:t,added:n}){for(let n of t)this._geometryRemoved(e,n);for(let t of n)this._geometryAdded(e,t)}_updateOrCreateDirtyRecord(e,t,n,r=0,i=!1){let a=this._getLayerId(e),c=e.id,l=t.id,u=this._ensureDirtyRecord(a,c),d=u.get(l);if(d){let e=d.operation;e===2&&n===0&&d.states!==0?d.operation=1:e===2&&n===0||e===0&&n===2?(u.delete(l),this._dirtyRecordCount--):e===1&&(n===2||n===1)?(d.operation=n,d.states|=r):(o((e===2||e===0)&&n===1,`ModelDirtySet.objectGeometryAdded: inconsistent state`),d.states|=r),d.sync=d.sync||i}else u.set(l,new s(n,t,r,i)),this._dirtyRecordCount++}_ensureGeomRecord(e,t){let n=this._residentGeomRecords.get(e,t);return n||(n=new Map,this._residentGeomRecords.set(e,t,n)),n}assertLayerClean(e){o(this._dirtyGeomRecords.getInner(e)==null,`Dirty geometry records for removed layer`)}_ensureDirtyRecord(e,t){let n=this.model.getLayer(e);o(n!=null,`Updating geometry record for an unregistered layer`);let r=this._dirtyGeomRecords.get(e,t);return r||(r=new Map,this._dirtyGeomRecords.set(e,t,r)),r}_getLayerId(e){return e.layer?.id??r}formatDebugInfo(){let e=[`ADD`,`UPD`,void 0,`REM`],t=``;return this._dirtyGeomRecords.forAll((n,r,i)=>{t.length>0&&(t+=`
3
3
  `),t+=r+`.`+i;let a=[];n.forEach(e=>{let t=e.operation;a[t]||(a[t]=[]),a[t].push(e.geometry.id)});for(let n=0;n<a.length;n++)if(a[n]){t+=` `+e[n-1]+`: `;for(let e=0;e<a[n].length;e++)t+=a[n][e]+`, `}}),t}get test(){}};e([i({constructOnly:!0})],c.prototype,`model`,void 0),e([i()],c.prototype,`_dirtyRecordCount`,void 0),c=e([a(`esri.views.3d.webgl-engine.lib.ModelDirtySet`)],c);const l=c;export{l as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import"../../../../core/has.js";import{generateUID as e}from"../../../../core/uid.js";import{multiply as t,copy as n}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as r,IDENTITY as i}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{transformMat4 as a,distance as o}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{empty as c,center as l}from"../../../../geometry/support/aaBoundingBox.js";import{maxScale as u}from"../../support/mathUtils.js";import{affectsGeometry as d}from"./affectsGeometry.js";import{BoundingVolume as f,expandWithTransformedBox as p}from"./BoundingVolume.js";import{Object3DOccludeeStateID as m,Object3DHighlightStateID as h}from"./Object3DStateID.js";import{assert as g}from"./Util.js";import{addObject3DStateID as _,removeObject3DStateID as v}from"../materials/renderers/utils.js";class y{constructor(t={}){this.id=e(),this.type=0,this._highlightIds=new Set,this._shaderTransformation=null,this._visible=!0,this.castShadow=t.castShadow??!0,this.usesVerticalDistanceToGround=t.usesVerticalDistanceToGround??!1,this.graphicUid=t.graphicUid,this.layerViewUid=t.layerViewUid,t.isElevationSource&&(this.lastValidElevationBB=c()),this._geometries=t.geometries?Array.from(t.geometries):[]}dispose(){this._geometries.length=0}get layer(){return this._layer}set layer(e){g(this._layer==null||e==null,`Object3D can only be added to a single Layer`),this._layer=e}addGeometry(e){e.visible=this._visible,this._geometries.push(e);for(let t of this._highlightIds)e.addHighlight(t);this._emit(`geometryAdded`,{object:this,geometry:e}),this._highlightIds.size&&this._emit(`highlightChanged`,this),this._invalidateBoundingVolume()}removeGeometry(e){let t=this._geometries.splice(e,1)[0];if(t){for(let e of this._highlightIds)t.removeHighlight(e);this._emit(`geometryRemoved`,{object:this,geometry:t}),this._highlightIds.size&&this._emit(`highlightChanged`,this),this._invalidateBoundingVolume()}}removeAllGeometries(){for(;this._geometries.length>0;)this.removeGeometry(0)}geometryVertexAttributeUpdated(e,t,n=!1){this._emit(`attributesChanged`,{object:this,geometry:e,attribute:t,sync:n}),d(t)&&this._invalidateBoundingVolume()}get visible(){return this._visible}set visible(e){if(this._visible!==e){this._visible=e;for(let e of this._geometries)e.visible=this._visible;this._emit(`visibilityChanged`,this)}}maskOccludee(){let e=new m;for(let t of this._geometries)t.occludees=_(t.occludees,e);return this._emit(`occlusionChanged`,this),e}removeOcclude(e){for(let t of this._geometries)t.occludees=v(t.occludees,e);this._emit(`occlusionChanged`,this)}highlight(e){let t=new h(e);for(let e of this._geometries)e.addHighlight(t);return this._emit(`highlightChanged`,this),this._highlightIds.add(t),t}removeHighlight(e){this._highlightIds.delete(e);for(let t of this._geometries)t.removeHighlight(e);this._emit(`highlightChanged`,this)}removeStateID(e){e.channel===0?this.removeHighlight(e):this.removeOcclude(e)}getCombinedStaticTransformation(e,n){return t(n,this.transformation,e.transformation)}getCombinedShaderTransformation(e,n=r()){return t(n,this.effectiveTransformation,e.transformation)}get boundingVolumeWorldSpace(){return this._bvWorldSpace||(this._bvWorldSpace=new f,this._validateBoundingVolume(this._bvWorldSpace,0)),this._bvWorldSpace}get boundingVolumeObjectSpace(){return this._bvObjectSpace||(this._bvObjectSpace=new f,this._validateBoundingVolume(this._bvObjectSpace,1)),this._bvObjectSpace}_validateBoundingVolume(e,t){let n=t===1;for(let t of this._geometries){let r=t.boundingInfo;r&&p(e.box,r.box,n?t.transformation:this.getCombinedShaderTransformation(t))}l(e.box,e.sphere.center);for(let t of this._geometries){let r=t.boundingInfo;if(r==null)continue;let i=n?t.transformation:this.getCombinedShaderTransformation(t),s=u(i);a(b,r.sphere.center,i);let c=o(b,e.sphere.center),l=r.sphere.radius*s;e.sphere.radius=Math.max(e.sphere.radius,c+l)}}_invalidateBoundingVolume(){let e=this._bvWorldSpace?.sphere;this._bvObjectSpace=this._bvWorldSpace=void 0,this.layer&&e&&this.layer.notifyObjectBBChanged(this,e)}_emit(e,t){this.layer?.events.emit(e,t)}get geometries(){return this._geometries}get transformation(){return this._transformation??i}set transformation(e){this._transformation=n(this._transformation??r(),e),this._invalidateBoundingVolume(),this._emit(`transformationChanged`,this)}get shaderTransformation(){return this._shaderTransformation}set shaderTransformation(e){this._shaderTransformation=e?n(this._shaderTransformation??r(),e):null,this._invalidateBoundingVolume(),this._emit(`shaderTransformationChanged`,this)}get effectiveTransformation(){return this.shaderTransformation??this.transformation}get test(){}}const b=s();export{y as Object3D};
2
+ import"../../../../core/has.js";import{generateUID as e}from"../../../../core/uid.js";import{multiply as t,copy as n}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as r,IDENTITY as i}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{transformMat4 as a,distance as o}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{empty as c,center as l}from"../../../../geometry/support/aaBoundingBox.js";import{maxScale as u}from"../../support/mathUtils.js";import{affectsGeometry as d}from"./affectsGeometry.js";import{BoundingVolume as f,expandWithTransformedBox as p}from"./BoundingVolume.js";import{Object3DOccludeeStateID as m,Object3DHighlightStateID as h}from"./Object3DStateID.js";import{assert as g}from"./Util.js";import{addObject3DStateID as _,removeObject3DStateID as v}from"../materials/renderers/utils.js";class y{constructor(t={}){this.id=e(),this.type=0,this._highlightIds=new Set,this._shaderTransformation=null,this._visible=!0,this.castShadow=t.castShadow??!0,this.usesVerticalDistanceToGround=t.usesVerticalDistanceToGround??!1,this.graphicUid=t.graphicUid,this.layerViewUid=t.layerViewUid,t.isElevationSource&&(this.lastValidElevationBB=c()),this._geometries=t.geometries?Array.from(t.geometries):[]}dispose(){this._geometries.length=0}get layer(){return this._layer}set layer(e){g(this._layer==null||e==null,`Object3D can only be added to a single Layer`),this._layer=e}addGeometry(e){e.visible=this._visible,this._geometries.push(e);for(let t of this._highlightIds)e.addHighlight(t);this._emit(`geometriesChanged`,{object:this,removed:[],added:[e]}),this._highlightIds.size&&this._emit(`highlightChanged`,this),this._invalidateBoundingVolume()}removeGeometry(e){let t=this._geometries.splice(e,1)[0];if(t){for(let e of this._highlightIds)t.removeHighlight(e);this._emit(`geometriesChanged`,{object:this,removed:[t],added:[]}),this._highlightIds.size&&this._emit(`highlightChanged`,this),this._invalidateBoundingVolume()}}removeAllGeometries(){for(;this._geometries.length>0;)this.removeGeometry(0)}replaceGeometries(e){let t=this._geometries,n=Array.from(e);for(let e of t)for(let t of this._highlightIds)e.removeHighlight(t);for(let e of n){e.visible=this._visible;for(let t of this._highlightIds)e.addHighlight(t)}this._geometries=n,this._invalidateBoundingVolume(),this._emit(`geometriesChanged`,{object:this,removed:t,added:n}),this._highlightIds.size&&this._emit(`highlightChanged`,this)}geometryVertexAttributeUpdated(e,t,n=!1){this._emit(`attributesChanged`,{object:this,geometry:e,attribute:t,sync:n}),d(t)&&this._invalidateBoundingVolume()}get visible(){return this._visible}set visible(e){if(this._visible!==e){this._visible=e;for(let e of this._geometries)e.visible=this._visible;this._emit(`visibilityChanged`,this)}}maskOccludee(){let e=new m;for(let t of this._geometries)t.occludees=_(t.occludees,e);return this._emit(`occlusionChanged`,this),e}removeOcclude(e){for(let t of this._geometries)t.occludees=v(t.occludees,e);this._emit(`occlusionChanged`,this)}highlight(e){let t=new h(e);for(let e of this._geometries)e.addHighlight(t);return this._emit(`highlightChanged`,this),this._highlightIds.add(t),t}removeHighlight(e){this._highlightIds.delete(e);for(let t of this._geometries)t.removeHighlight(e);this._emit(`highlightChanged`,this)}removeStateID(e){e.channel===0?this.removeHighlight(e):this.removeOcclude(e)}getCombinedStaticTransformation(e,n){return t(n,this.transformation,e.transformation)}getCombinedShaderTransformation(e,n=r()){return t(n,this.effectiveTransformation,e.transformation)}get boundingVolumeWorldSpace(){return this._bvWorldSpace||(this._bvWorldSpace=new f,this._validateBoundingVolume(this._bvWorldSpace,0)),this._bvWorldSpace}get boundingVolumeObjectSpace(){return this._bvObjectSpace||(this._bvObjectSpace=new f,this._validateBoundingVolume(this._bvObjectSpace,1)),this._bvObjectSpace}_validateBoundingVolume(e,t){let n=t===1;for(let t of this._geometries){let r=t.boundingInfo;r&&p(e.box,r.box,n?t.transformation:this.getCombinedShaderTransformation(t))}l(e.box,e.sphere.center);for(let t of this._geometries){let r=t.boundingInfo;if(r==null)continue;let i=n?t.transformation:this.getCombinedShaderTransformation(t),s=u(i);a(b,r.sphere.center,i);let c=o(b,e.sphere.center),l=r.sphere.radius*s;e.sphere.radius=Math.max(e.sphere.radius,c+l)}}_invalidateBoundingVolume(){let e=this._bvWorldSpace?.sphere;this._bvObjectSpace=this._bvWorldSpace=void 0,this.layer&&e&&this.layer.notifyObjectBBChanged(this,e)}_emit(e,t){this.layer?.events.emit(e,t)}get geometries(){return this._geometries}get transformation(){return this._transformation??i}set transformation(e){this._transformation=n(this._transformation??r(),e),this._invalidateBoundingVolume(),this._emit(`transformationChanged`,this)}get shaderTransformation(){return this._shaderTransformation}set shaderTransformation(e){this._shaderTransformation=e?n(this._shaderTransformation??r(),e):null,this._invalidateBoundingVolume(),this._emit(`shaderTransformationChanged`,this)}get effectiveTransformation(){return this.shaderTransformation??this.transformation}get test(){}}const b=s();export{y as Object3D};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{clamp as e}from"../../../../core/mathUtils.js";import{set as t,copy as n,exactEquals as r}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as i,clone as a}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{newFloatArray as o}from"../../../../geometry/support/FloatArray.js";import{getContinuousIndexArray as s,getZeroIndexArray as c}from"../../../../geometry/support/Indices.js";import{addOlidAttribute as l}from"../../layers/graphics/olidUtils.js";import{Attribute as u}from"./Attribute.js";import{Geometry as d}from"./Geometry.js";import{getPathVertexFrameIndex as f}from"./PathVertexInfo.js";import{createPositionReader as p}from"./PositionReader.js";class m extends d{constructor(e,t,n,r){let{vertexIndices:a,framePositionIndices:o,numExtrusionFrames:d}=t,f=s(d),p=c(d),m=[[`position`,new u(t.positions,o,3,!0)],[`profileRight`,new u(t.profileRightAxes,f,2,!0)],[`profileUp`,new u(t.profileUpAxes,f,2,!0)],[`profileRotation`,new u(t.profileRotations,f,1,!0)],[`pathMaxStretchDistance`,new u(t.pathMaxStretchDistances,f,1,!0)],[`pathVertexInfo`,new u(t.pathVertexInfos,a,1,!0)]];t.profileRotationFrameUpAxes&&m.push([`pathRotationUp`,new u(t.profileRotationFrameUpAxes,f,2,!0)]),n.sizeAttributeValue!=null&&m.push([`sizeFeatureAttribute`,new u([n.sizeAttributeValue],p,1,!0)]),n.size!=null&&m.push([`size`,new u([...n.size],p,2,!0)]),n.colorAttributeValue!=null&&m.push([`colorFeatureAttribute`,new u([n.colorAttributeValue],p,1,!0)]),n.color!=null&&m.push([`color`,new u([...n.color],p,4,!0)]),n.opacityAttributeValue!=null&&m.push([`opacityFeatureAttribute`,new u([n.opacityAttributeValue],p,1,!0)]),n.opacity!=null&&m.push([`opacity`,new u([n.opacity],p,1,!0)]),r!=null&&l(m,r,p),super(e,m,null,0),this.builder=t,this.visualVariablesState=n,this._lastSize=i()}get indexCount(){return this.attributes.get(`pathVertexInfo`)?.indices.length??0}get readPrimitivePosition(){if(this._invalidateOnSizeChange(),this._readPrimitivePosition==null){let{builder:e,size:t}=this,{vertexIndices:n,numVerticesTotal:r,evaluator:i}=e,a=o(r*3);for(let e=0;e<r;++e)i.evaluateVertexPosition(a,t,e,e);this._readPrimitivePosition=p(a,n,3)}return this._readPrimitivePosition}onPathChanged(){this.builder.onPathChanged(),this.invalidateBoundingInfo(),t(this._lastSize,-1,-1),this._invalidateReadPrimitivePosition()}get size(){let{parameters:t}=this.material,r=a(t.size);if(t.vvSize){let{offset:n,factor:i,minSize:a,maxSize:o,fallback:s}=t.vvSize,c=this.visualVariablesState.sizeAttributeValue??NaN;Number.isNaN(c)?(r[0]*=s[0],r[1]*=s[2]):(r[0]*=e(n[0]+c*i[0],a[0],o[0]),r[1]*=e(n[2]+c*i[2],a[2],o[2]))}else t.hasPathSize&&this.visualVariablesState.size&&n(r,this.visualVariablesState.size);return r}_computePrimitivePositionIndices(){let e=this.attributes.get(`pathVertexInfo`),t=this.attributes.get(`position`);if(e&&t){let n=t.indices,r=e.indices,i=e.data;return r.map(t=>n[f(i[e.stride*t])])}return t?.indices??null}get boundingInfo(){return this._invalidateOnSizeChange(),super.boundingInfo}_invalidateOnSizeChange(){let{size:e}=this;r(e,this._lastSize)||(n(this._lastSize,e),this.invalidateBoundingInfo(),this._invalidateReadPrimitivePosition())}}function h(e){return e instanceof m}export{m as PathGeometry,h as isPathGeometry};
2
+ import{clamp as e}from"../../../../core/mathUtils.js";import{baseObjectMemory as t,estimateFixedArrayMemory as n,integerArrayElementBytes as r,estimateArrayMemory as i}from"../../../../core/memoryEstimations.js";import{set as a,copy as o,exactEquals as s}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as c,clone as l}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{newFloatArray as u}from"../../../../geometry/support/FloatArray.js";import{getContinuousIndexArray as d,getZeroIndexArray as f}from"../../../../geometry/support/Indices.js";import{addOlidAttribute as p}from"../../layers/graphics/olidUtils.js";import{Attribute as m}from"./Attribute.js";import{Geometry as h}from"./Geometry.js";import{getPathVertexFrameIndex as g}from"./PathVertexInfo.js";import{createPositionReader as _}from"./PositionReader.js";class v extends h{constructor(e,r,i,a){let{vertexIndices:o,framePositionIndices:s,numExtrusionFrames:l}=r,u=d(l),h=f(l),g=[[`position`,new m(r.positions,s,3,!0)],[`profileRight`,new m(r.profileRightAxes,u,2,!0)],[`profileUp`,new m(r.profileUpAxes,u,2,!0)],[`profileRotation`,new m(r.profileRotations,u,1,!0)],[`pathMaxStretchDistance`,new m(r.pathMaxStretchDistances,u,1,!0)],[`pathVertexInfo`,new m(r.pathVertexInfos,o,1,!0)]];r.profileRotationFrameUpAxes&&g.push([`pathRotationUp`,new m(r.profileRotationFrameUpAxes,u,2,!0)]),i.sizeAttributeValue!=null&&g.push([`sizeFeatureAttribute`,new m([i.sizeAttributeValue],h,1,!0)]),i.size!=null&&g.push([`size`,new m([...i.size],h,2,!0)]),i.colorAttributeValue!=null&&g.push([`colorFeatureAttribute`,new m([i.colorAttributeValue],h,1,!0)]),i.color!=null&&g.push([`color`,new m([...i.color],h,4,!0)]),i.opacityAttributeValue!=null&&g.push([`opacityFeatureAttribute`,new m([i.opacityAttributeValue],h,1,!0)]),i.opacity!=null&&g.push([`opacity`,new m([i.opacity],h,1,!0)]),a!=null&&p(g,a,h),super(e,g,null,0),this.builder=r,this.visualVariablesState=i,this._positionCacheMemory=0,this._lastSize=c(),this._usedMemory=t+n(r.path.vertices,8)+r.path.vertices.length*(2*t)}computeBufferMemory(e){let t=super.computeBufferMemory(e),{builder:n}=this;t+=e.arrayMemory(n.framePositionIndices,r,!0),t+=e.arrayMemory(n.vertexIndices,r,!0);let{path:i}=n;t+=e.arrayMemory(i.positions)+e.arrayMemory(i.positionsES)+e.arrayMemory(i.origin);for(let n of i.vertices)t+=e.arrayMemory(n.vLeft)+e.arrayMemory(n.vRight),t+=e.arrayMemory(n.frame.up)+e.arrayMemory(n.frame.right);return t}get indexCount(){return this.attributes.get(`pathVertexInfo`)?.indices.length??0}get readPrimitivePosition(){if(this._invalidateOnSizeChange(),this._readPrimitivePosition==null){let{builder:e,size:t}=this,{vertexIndices:n,numVerticesTotal:r,evaluator:a}=e,o=u(r*3);for(let e=0;e<r;++e)a.evaluateVertexPosition(o,t,e,e);this._readPrimitivePosition=_(o,n,3),this._positionCacheMemory=i(o,8),this._usedMemory+=this._positionCacheMemory,this.notifyMemoryChange?.(this._positionCacheMemory)}return this._readPrimitivePosition}_invalidateReadPrimitivePosition(){super._invalidateReadPrimitivePosition();let e=this._positionCacheMemory;this._positionCacheMemory=0,this._usedMemory-=e,e&&this.notifyMemoryChange?.(-e)}onPathChanged(){this.builder.onPathChanged(),this.invalidateBoundingInfo(),a(this._lastSize,-1,-1),this._invalidateReadPrimitivePosition()}get size(){let{parameters:t}=this.material,n=l(t.size);if(t.vvSize){let{offset:r,factor:i,minSize:a,maxSize:o,fallback:s}=t.vvSize,c=this.visualVariablesState.sizeAttributeValue??NaN;Number.isNaN(c)?(n[0]*=s[0],n[1]*=s[2]):(n[0]*=e(r[0]+c*i[0],a[0],o[0]),n[1]*=e(r[2]+c*i[2],a[2],o[2]))}else t.hasPathSize&&this.visualVariablesState.size&&o(n,this.visualVariablesState.size);return n}_computePrimitivePositionIndices(){let e=this.attributes.get(`pathVertexInfo`),t=this.attributes.get(`position`);if(e&&t){let n=t.indices,r=e.indices,i=e.data;return r.map(t=>n[g(i[e.stride*t])])}return t?.indices??null}get boundingInfo(){return this._invalidateOnSizeChange(),super.boundingInfo}_invalidateOnSizeChange(){let{size:e}=this;s(e,this._lastSize)||(o(this._lastSize,e),this.invalidateBoundingInfo(),this._invalidateReadPrimitivePosition())}}function y(e){return e instanceof v}export{v as PathGeometry,y as isPathGeometry};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{update as t}from"../../../../core/arrayUtils.js";import{createTask as n}from"../../../../core/asyncUtils.js";import has from"../../../../core/has.js";import{removeMaybe as r,abortMaybe as i,destroyMaybe as a,releaseMaybe as o,releaseReferencedMaybe as s}from"../../../../core/maybe.js";import{throwIfAborted as c}from"../../../../core/promiseUtils.js";import{watch as l,syncAndInitial as u,initial as d,sync as f}from"../../../../core/reactiveUtils.js";import{signal as p}from"../../../../core/signal.js";import{property as m,subclass as h}from"../../../../core/accessorSupport/decorators.js";import{equals as g,invert as _,multiply as v,copy as y}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as b,create as x}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as ee}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{fromValues as te,ZEROS as S}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{pruneIndexArrays as ne}from"../../../../geometry/support/Indices.js";import{InternalRenderCategory as C,RenderNodeOutput as w,AllRenderNodeOutputs as T,AllInternalRenderNodeOutputs as E}from"../../webgl.js";import{minNearDistanceInMeters as re}from"../../state/NearFarHeuristic.js";import{debugFlags as ie}from"../../support/debugFlags.js";import{FBOCache as ae}from"../core/FBOCache.js";import{RenderPassManager as oe}from"../core/renderPasses/RenderPassManager.js";import{isColor as se}from"../core/shaderLibrary/ShaderOutput.js";import{RenderNodes as ce}from"../effects/RenderNodes.js";import{RenderPluginManager as le}from"../effects/RenderPluginManager.js";import{WeatherFader as ue}from"../effects/WeatherFader.js";import{innerAtmosphereFadeStart as de}from"../effects/atmosphere/atmosphereUtils.js";import{Blit as fe}from"../effects/blit/Blit.js";import{maxHighlightsPerChannel as pe,renderHighlightBuffer as me}from"../effects/highlight/Highlight.js";import{OITBlend as D}from"../effects/transparency/OITBlend.js";import{AnimationTimer as he}from"./AnimationTimer.js";import{AnimationTimeStep as ge}from"./AnimationTimeStep.js";import{BoundingInfo as _e}from"./BoundingInfo.js";import{Compositor as ve}from"./Compositor.js";import{DepthRange as O}from"./DepthRange.js";import{depthRangeFromScene as k}from"./depthRangeUtils.js";import{MainFramebuffer as ye}from"./MainFramebuffer.js";import{NavigationDepthCache as be}from"./NavigationDepthCache.js";import{blendingColorAlphaClear as A}from"./OrderIndependentTransparency.js";import{RenderContext as j,defaultRenderOccludedMask as M}from"./RenderContext.js";import{RendererBase as N}from"./RendererBase.js";import{setupFeatureDefaults as P}from"./RenderFeature.js";import{RenderPluginInput as xe}from"./RenderPluginInput.js";import{ShadowMap as Se}from"./ShadowMap.js";import Ce from"./SliceHelper.js";import{MergedRenderer as we}from"../materials/renderers/MergedRenderer.js";import{RenderSceneResult as F}from"../parts/renderUtils.js";import{RendererPerformanceInfo as I,PerformanceCategory as L}from"../statistics/RendererPerformanceInfo.js";import{PixelType as Te,ColorAttachment0 as R,ColorAttachment1 as z,ColorAttachment2 as B,DrawBufferNone as Ee}from"../../../webgl/enums.js";const De=has(`disable-feature:async-navigation-3d-depth-readback`);let V=class extends N{constructor(e,t,n,r,i){super({stage:e}),this._techniques=n,this._rctx=r,this._requestRender=i,this._pluginsHas={occludedHudElements:!1,hudElements:!1,water:!1},this.renderPassManager=new oe,this._isRendering=!1,this._backgroundColor=te(0,0,0,1),this._sliceHelper=new Ce,this._shadowAccumulator=null,this._shadowCastOptions=null,this.sceneDepthRange=p(O.Infinite),this._state=p(2),this._hasAnimations=!1,this._animationTimestep=new ge,this._loadEdgeViewTask=null,this._edgeViewCallbacks=[],this._reprojectionMatrixVersion=p(0),this._renderHiddenTransparentEdges=()=>{},this._pluginInput=new xe,this._hasTransparentGeometry=!1,this._releaseNodeInputs=e=>{for(let t of je)e.some(({name:e})=>e===t)&&this._pluginInput.release(t)},this._testsNeedsDepth=!1,this._fboCache=new ae(r),this._compositor=new ve(r,n),this._renderStateFeatures=p(P(e.view.qualityProfile));let a=new Se(this._fboCache,e.viewingMode);this._renderContext=new j(this._rctx,a,n),this._framebuffer=new ye(this._fboCache,this._bindParameters),this._performanceInfo=new I(this._rctx),this._blit=new fe(n),this.navigationDepthCache=new be(this._rctx,this._fboCache,n,()=>this._requestRender(0)),this._nodes=new ce(this._renderContext),this._plugins=new le({renderContext:this._renderContext,techniques:n,materials:t,requestRender:i,controller:e}),this._plugins.add(this.renderPassManager),this.weatherFader=new ue({view:e.view,context:this._renderContext}),this.addHandles([l(()=>e.view.state.camera,()=>i(),u),l(()=>ie.EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES,e=>{this._renderHiddenTransparentEdges=e?()=>this._renderEdges(0):()=>{},i()},d),l(()=>e.view.environment.background?.color,e=>{let t=e?e.toUnitRGBA():S;ee(this._backgroundColor,t[0]*t[3],t[1]*t[3],t[2]*t[3],t[3]),i()},u),l(()=>e.view.environmentView.shadowsAvailable,e=>{this._bindParameters.shadowMap.enabled=e,this._requestRender(1)},u),l(()=>this._bindParameters.clouds.fadeFactor,()=>{this._bindParameters.fadeLighting(),this._requestRender(2)},f),l(()=>this._bindParameters.clouds.data?.state,()=>i(),f),l(()=>e.view.state.highlights,e=>{this._bindParameters.highlights=e,i()},d),l(()=>e.view.environment.lighting?.type===`sun`,e=>{this._bindParameters.enableFillLights=e,this._requestRender()},u)])}destroy(){this._gpuTimerHandle=r(this._gpuTimerHandle),this._nodes.destroy(),this._framebuffer.dispose(),this._shadowAccumulator=null,this._shadowCastOptions=null,this._loadEdgeViewTask=i(this._loadEdgeViewTask),this._edgeView=a(this._edgeView),this.renderPassManager.dispose(),this.weatherFader=a(this.weatherFader),this._releaseFBOs(),this._disposeOffscreenBuffers(),this.navigationDepthCache.destroy(),this._fboCache.destroy(),this._fboCache=null,this._renderContext.destroy(),this._plugins.destroy(),this._pluginInput=null,this._oitBlendOrNil=null,this._nodes=null,this._framebuffer=null,this._performanceInfo=null,_e.prune(),we.prune(),ne()}get renderContext(){return this._renderContext}get _bindParameters(){return this._renderContext.bind}get _oitBlend(){return this._oitBlendOrNil??=new D(this._techniques),this._oitBlendOrNil}get performanceInfo(){return this._performanceInfo}updateRenderFeatures(e){this._renderStateFeatures.value=P(e),this.updateGlobalIllumination(this.stage.view.environment.lighting.globalIllumination),this._requestRender()}updateGlobalIllumination(e){let t=P(this.stage.view.qualityProfile);for(let n of[0,1,2])this.setFeatureEnabled(11,n,e),this.setFeatureEnabled(10,n,e&&n===2),this.setFeatureEnabled(3,n,!e&&(t.get(n,3)??!1))}isFeatureEnabled(e,t=this._state.value){return this._renderStateFeatures.value.get(t,e)??!1}setFeatureEnabled(e,t,n){this.isFeatureEnabled(e,t)!==n&&(this._renderStateFeatures.mutate(r=>r.set(t,e,n)),this._requestRender())}setTime(e){this._renderContext.time=e}get hasReflections(){return this._bindParameters.screenSpaceReflections.enabled=this._pluginsHas.water&&this.isFeatureEnabled(4),this._bindParameters.screenSpaceReflections.enabled}get _hasHighlights(){return this._plugins.produces(10,2,4,18,12,13,14)}hasHighlight(e){return this._plugins.hasHighlight(e)}get _hasHUDHighlights(){return this._plugins.produces(10,12,13,14)}get hasAmbientIllumination(){return this._nodes.produces(C.AMBIENT_ILLUMINATION)}get hasGlobalIllumination(){return this.stage.renderView?.globalIllumination?.enabled??!1}get hasGlobalIlluminationHighQuality(){let e=this.stage.renderView?.globalIllumination;return this.hasGlobalIllumination&&e?.hasHighQuality===!0}get hasSMAA(){return this.isFeatureEnabled(0)}get _emissions(){let e=this._plugins.emissions;return this._hasTransparentGeometry?e:+(e===1||e===3)}get hasFloatBlend(){return this._rctx.driverTest.floatBufferBlend.result&&this.isFeatureEnabled(9)}get highResolutionAtmosphere(){return this.isFeatureEnabled(2)}get fboCache(){return this._fboCache}setShadowAccumulator(e){this._shadowAccumulator=e,this._shadowCastOptions&&e.setParameters(this._shadowCastOptions)}_releaseFBOs(){this._bindParameters.hudOcclusion=o(this._bindParameters.hudOcclusion),this._bindParameters.depth=null}_disposeOffscreenBuffers(){this._framebuffer.dispose();let e=this._bindParameters;e.globalIllumination=o(e.globalIllumination),e.reprojection.lastFrameDepth=o(e.reprojection.lastFrameDepth),e.reprojection.lastFrameEmission=o(e.reprojection.lastFrameEmission),this._disposeBindBuffers()}_disposeBindBuffers(){this._bindParameters.shadowMap.disposeOutputs()}get updating(){return this._loadEdgeViewTask&&!this._loadEdgeViewTask.finished||this._edgeView?.updating||this._plugins.updating||this.weatherFader?.readyToRun||!this.isCameraFinal}loadEdgeView(){return this._loadEdgeViewTask||=n(async e=>{let{EdgeView:t}=await import(`./edgeRendering/EdgeView.js`);c(e);let n=this._edgeView=new t({rctx:this._rctx,renderSR:this.stage.view.renderSpatialReference,viewingMode:this.stage.view.stage.viewingMode,techniques:this._techniques,setNeedsRender:()=>this._requestRender(),schedule:Me(this.stage.view.resourceController)});return this.addHandles(l(()=>n.updating,()=>this._requestRender(),f)),this._requestRender(),this._edgeViewCallbacks.forEach(e=>e(n)),this._edgeViewCallbacks.length=0,n}),this._loadEdgeViewTask.promise}withEdgeView(e){this.loadEdgeView().catch(()=>{}),this._edgeView==null?this._edgeViewCallbacks.push(e):e(this._edgeView)}get edgeView(){return this._edgeView}get isCameraFinal(){return this._reprojectionMatrixVersion.value>=0&&g(this._bindParameters.reprojection.matrix,b)}set _reprojectionMatrix(e){t(this._bindParameters.reprojection.matrix,e)&&this._reprojectionMatrixVersion.value++}get shadowsEnabled(){return!!this._bindParameters.shadowMap.enabled}setParameters(e){e.shadowCast&&(this._shadowCastOptions={...this._shadowCastOptions,...e.shadowCast},this._shadowAccumulator?.setParameters(e.shadowCast))}set slice(e){this._sliceHelper.update(e)&&this._requestRender()}get plugins(){return this._plugins}commit(e,t){return this._isRendering&&console.warn(`Renderer.modify called while rendering`),super.commit(e,t,this._plugins.context)?(this.updateHasFlags(),!0):!1}addRenderer(e){this._plugins.add(e)}removeRenderer(e){this._plugins.remove(e)}get occludedRequiresStencil(){return this._occludedRequiresOccludeeStencil||this.occludedRequiresIntegratedMeshStencil}get _occludedRequiresOccludeeStencil(){return this._bindParameters.hasOccludees&&!!(this.plugins.renderOccludedFlags&8)}get occludedRequiresIntegratedMeshStencil(){return this._plugins.produces(0,0)&&this._plugins.produces(0,9)}updateHasFlags(){let has=this._pluginsHas;has.occludedHudElements=this._plugins.produces(0,13),has.hudElements=has.occludedHudElements||this._plugins.produces(0,...J),has.water=this._plugins.produces(4,19),this._bindParameters.hasOccludees=this._plugins.hasOccludees,this._requestRender()}updateAnimation(e,t){this._animationTimer??=new he(e.camera,t),this._animationTimer.advance(e.camera,t,this._animationTimeDilation);let n=this._hasAnimations;return this._hasAnimations=this._plugins.updateAnimation(this._animationTimer),this._hasAnimations=this._nodes.updateAnimation(this._animationTimer)||this._hasAnimations,this._hasAnimations!==n&&(this._gpuTimerHandle=n?r(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,t,n=!1){try{this._isRendering=!0,this._needsOffscreenPrepass(e.camera,t)&&this._render(e,3,n).color?.release();let r=this._render(e,t,n);return t!==0&&this._disposeOffscreenBuffers(),r}catch(e){console.error(`Exception during rendering: ${e}:\n${e.stack}`)}finally{this._isRendering=!1}return new F(this._pluginInput.get(w.FINAL),null)}_needsOffscreenPrepass(e,t){return(t===1||t===2)&&(this.hasGlobalIllumination||this.hasReflections)&&(!this._framebuffer.hasColor||!this._bindParameters.reprojection.lastFrameCamera.equals(e))}_render(e,t,n){let r=t===0;this.performanceInfo.startFrame(),this.fboCache.frameStart(),this.fboCache.interactive=r,this._disposeBindBuffers();let{camera:i,contentCamera:a,mode:c,alignPixelEnabled:l}=e;this._state.value=c,this._bindParameters.frameRendererTarget=t,this._bindParameters.output=0,this._bindParameters.emissions=this._emissions,this._bindParameters.alignPixelEnabled=l,this._bindParameters.metersPerRenderUnit=this.stage.view.renderCoordsHelper.unitInMeters,this._bindParameters.decorations=!n,this._bindParameters.mainDepth=null,this._bindParameters.useFloatBlend.value=this.hasFloatBlend;let u=!n||!this._sliceHelper.isDecoration;this._bindParameters.slicePlane=u?this._sliceHelper.plane:null,this._bindParameters.viewshedEnabled=this._nodes.produces(C.VIEWSHED),this._bindParameters.laserlinesEnabled=this._nodes.produces(C.LASERLINES),this._bindParameters.shadowAnalysisEnabled=!!this._shadowAccumulator?.active,this._bindParameters.cutFillComputationEnabled=this._nodes.produces(C.CUTFILL_COMPUTATION),this._bindParameters.cutFillVisualizationEnabled=this._nodes.produces(C.CUTFILL),this._ensureBindParameters(i,a),this._plugins.sortTestsTransparentOrderedSlots(ke),this._plugins.prepareRender(),this._hasTransparentGeometry=this._plugins.produces(1,...U),this._renderOverlay(),i.setGLViewport(this._rctx);let d=this._framebuffer,f=d.initialize(i.fullWidth,i.fullHeight,this._backgroundColor),p=this._needsLastFrameColor;p?(f?.retain(p-1),f?.setName(`last frame color`),this._bindParameters.reprojection.lastFrameColor?.release(),this._bindParameters.reprojection.lastFrameColor=f):f?.release(),this._bindParameters.hasShadowHighlights=this._needsShadowHighlight&&!n,this._precompilePrepasses(),this.performanceInfo.advance(L.PREPARE);let m=this._computeShadowDepthRange(i);this._pluginInput.set(`normals`,this._renderNormals()),this._renderAmbientIlluminationAndDepth(),this._renderShadowMap(i,a,this._bindParameters.lighting.mainLight.direction,m),this._renderShadowAccumulation(m),d.bind(),this._bindParameters.mainDepth=d.depth.attachment,this._precompileShaders(r),this._bindParameters.output=0,this._renderOpaque(),this._renderPreTransparent(),this._renderTransparent(),this._3dGeometryRendered(),d.update(e=>this._renderNodes(C.CUTFILL_COMPUTATION,e)),this._pluginInput.set(C.FOCUSAREA_MASK,this._renderFocusAreaMask()),d.update(e=>this._renderNodes(C.TRANSPARENT_ENVIRONMENT,e)),d.update(e=>this._renderNodes(C.VIEWSHED,e)),d.update(e=>this._renderNodes(C.LASERLINES,e)),this._nodes.requireGeometryDepth&&(this._bindParameters.depth=s(this._bindParameters.depth)),d.update(e=>this._renderNodes(C.FOCUSAREA,e)),this._pluginInput.release(C.FOCUSAREA_MASK),d.update(e=>this._renderNodes(C.CUTFILL,e)),this._pluginInput.release(C.GROUND_DEPTH),d.update(e=>this._renderNodes(C.OCCLUDED,e)),this._pluginInput.set(`highlights`,this._renderHighlightPrepass());let h=t===2?this._renderObjectAndLayerIdColor():null;d.update(e=>this._renderNodes(w.COMPOSITE,e)),this._bindParameters.shadowMap.disposeOutputs(),this._bindParameters.shadowHighlight=o(this._bindParameters.shadowHighlight),d.update(e=>this._renderNodes(C.ANTIALIASING,e));let g=this._hasTransparentGeometry?2:1,_=this._bindParameters.emissions;this._bindParameters.emissions=0,this._hasHUDHighlights&&d.update(e=>this._renderHUD(g,e)),d.update(e=>this._renderNodes(C.HIGHLIGHT,e)),this._hasHUDHighlights||d.update(e=>this._renderHUD(g,e)),this._bindParameters.emissions=_,d.update(e=>this._renderNodes(C.MAGNIFIER,e)),d.update(e=>this._renderNodes(w.FINAL,e)),r&&(this._blit.toFramebuffer(d.color,this._bindParameters),De||c!==2&&c!==0||this.navigationDepthCache.update(this._bindParameters,d.depth.attachment,this._renderContext.time)),this._bindParameters.reprojection.lastFrameDepth?.release(),this.hasGlobalIllumination&&(this._bindParameters.reprojection.lastFrameDepth=this._bindParameters.depth),this._testsNeedsDepth&&(this._bindParameters.depth=s(this._bindParameters.depth)),this._releaseFBOs(),d.releaseDepth(),this._bindParameters.reprojection.lastFrameCamera.copyFrom(this._bindParameters.camera),this.fboCache.frameEnd();let v;return r||(v=d.color,v.retain()),this.performanceInfo.finishFrame(),new F(v,h)}_precompileShaders(e){++this._plugins.context.techniques.precompiling;let t=this._bindParameters;t.output=0;let n=t.emissions;if(this._precompileOpaqueGeometry(),this._nodes.precompile(C.OPAQUE_ENVIRONMENT,C.GAUSSIAN_SPLAT,C.OPAQUE_OCCLUSION_QUERY,C.VOXEL),this._precompileOpaqueGeometry(),t.output=3,this._plugins.precompile(...W),t.output=0,this._plugins.precompile(...W),this._hasTransparentGeometry){let e=this._pluginsHas.occludedHudElements;this._oitBlend.precompile(t,e,0),this._pluginsHas.hudElements&&this._oitBlend.precompile(t,!1,1),this._precompileTransparentGeometry(),t.hasTransparentEmission&&(t.emissions=3)}this._nodes.precompile(C.FOCUSAREA_MASK),this._compositor.precompile(this._usesPremultipliedAlphaBlit,!!this._needsEdges,t),this._hasTransparentGeometry||this._plugins.precompile(15),this._nodes.precompile(C.TRANSPARENT_ENVIRONMENT,C.VIEWSHED,C.CUTFILL_COMPUTATION,C.CUTFILL,C.LASERLINES,C.FOCUSAREA,C.OCCLUDED,C.ANTIALIASING),t.highlightMixTexture=t.highlights.length>1?this._rctx.emptyTexture:null,this._precompileHUD(0),t.emissions=0,this._precompileHUD(0),this._precompileHUD(1),t.emissions=n,this._hasHighlights&&(t.highlights.forEach((e,n)=>{t.highlightLevel=n,this._precompileAllGeometry(10),this._hasHUDHighlights&&this._plugins.precompile(13,12)}),t.highlightLevel=null,this._nodes.precompile(C.HIGHLIGHT)),t.highlightMixTexture=null,this._nodes.precompile(w.COMPOSITE,C.MAGNIFIER),this._nodes.precompile(C.TRANSPARENT_NO_DEPTH),this._plugins.precompile(8),t.hasOpaqueEmission&&(t.transparentWithoutDepthEmissionDimmingPass=!0,this._plugins.precompile(8),t.transparentWithoutDepthEmissionDimmingPass=!1),e&&this._blit.precompile(),--this._plugins.context.techniques.precompiling}_renderFocusAreaMask(){let e=this._nodes.produce(C.FOCUSAREA_MASK,this._pluginInput);return e&&this.performanceInfo.advance(L.FOCUS_AREA_MASK),e}_renderObjectAndLayerIdColor(){if(!this._nodes.produces(C.OBJECT_AND_LAYER_ID_COLOR))return null;let e=this._bindParameters.output;++this._techniques.precompiling;let{width:t,height:n}=this._framebuffer.size,r=this.fboCache.acquire(t,n,C.OBJECT_AND_LAYER_ID_COLOR).acquireDepth(14);return r=this._renderNodes(C.OBJECT_AND_LAYER_ID_COLOR,r),--this._techniques.precompiling,this._bindParameters.output=e,r}finish(e){this._hasAnimations||this._animationTimestep.clear();let t=this.performanceInfo.gpuSamplingEnabled,n=e===0,r=n?this.performanceInfo.elapsedTime:0;if(n||t){let e=0;t?e=this.performanceInfo.totalGPUTimeSampler.last:(this._rctx.gl.finish(),e=this.performanceInfo.elapsedTime);let i=Math.max(r,e);this._animationTimestep.frame(i,n)}}readAccumulatedShadow(e){return this._shadowAccumulator?.readAccumulatedShadow(e[0],e[1])??0}readMainDepth(e,t){let{mainDepth:n,camera:r}=this._bindParameters;if(!n)return;let i=this.fboCache.acquire(this._framebuffer.size.width,this._framebuffer.size.height,`linear depth`);this._rctx.bindFramebuffer(i.fbo),r.setGLViewport(this._rctx),this._rctx.setScissorRect(e[0],e[1],e[2],e[3]),this._rctx.setScissorTestEnabled(!0),this._rctx.clearFramebuffer(S),this._compositor.blitDepthToLinearDepth(this._bindParameters,n),this._rctx.setScissorTestEnabled(!1),this._rctx.setScissorRect(0,0,this._rctx.gl.canvas.width,this._rctx.gl.canvas.width),i.fbo?.readPixels(e[0],e[1],e[2],e[3],6408,Te.UNSIGNED_BYTE,t),i.release()}get _needsEdges(){return this._edgeView?.shouldRender()?this._edgeView:null}_renderEdges(e){let t=this._needsEdges;if(!t)return;let{width:n,height:r}=this._framebuffer.size,i=this.fboCache.acquire(n,r,`edges`);i.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(i.fbo),this._rctx.clearFramebuffer(S),t.render(this._bindParameters,e),i.detachDepth(),this._framebuffer.bind(),this._compositor.composite(this._bindParameters,i.getTexture()),i.release(),this.performanceInfo.advance(e===1?L.OPAQUE_EDGES:L.TRANSPARENT_EDGES)}_renderOverlay(){this._bindParameters.overlay=this.overlay?.render(this._renderContext.time),this._bindParameters.overlay&&this.performanceInfo.advance(L.OVERLAY)}_renderShadowMap(e,t,n,r){if(!this.shadowsEnabled)return;let i=this._bindParameters.shadowMap;if(i.start(e,n,r,this.isFeatureEnabled(5),this.stage.view.qualitySettings.maximumPixelRatio),this._needsShadowHighlight){this._renderShadowCascades(6,i),e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,t);let n=this._bindParameters.output;this._bindParameters.output=0,this._bindParameters.shadowHighlight=this._nodes.produce(C.SHADOW_HIGHLIGHT,this._pluginInput),this._bindParameters.output=n,i.disposeOutput(6),i.clear(),this._renderShadowCascades(7,i)}else this._renderShadowCascades(5);e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,this._bindParameters.contentCamera),this._needsShadowHighlight&&(this._bindParameters.depth=s(this._bindParameters.depth)),this.performanceInfo.advance(C.SHADOWMAP)}_precompileShadowCascades(e){this._bindParameters.shadowMap.cascades.length!==0&&this._precompileAllGeometry(e)}_renderShadowCascades(e,t=this._bindParameters.shadowMap){let n=this._bindParameters.output,r=e!==6;t.bindFramebuffer();for(let n of t.cascades)n.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(n.camera,n.camera),this.renderAllGeometry(e),r&&this._renderShadowNodes(t.renderTarget);t.finish(e),this._bindParameters.output=n}_renderShadowNodes(e){this._renderInternalNodeCategory(C.SHADOWMAP,e)}get _needsLastFrameColor(){return+this.hasReflections+ +this.hasGlobalIllumination}get _needsDepth(){return+this._nodes.requireGeometryDepth+ +this.hasReflections+ +this.hasGlobalIllumination+ +this._testsNeedsDepth+ +this._needsShadowHighlight}get _usesPremultipliedAlphaBlit(){return this._pluginsHas.hudElements}_renderAmbientIlluminationAndDepth(){let e=this._bindParameters;e.depth=o(this._bindParameters.depth);let t=this._pluginInput.get(`normals`);if(t){let n=this._nodes.produce(C.AMBIENT_ILLUMINATION,this._pluginInput);this._pluginInput.set(C.AMBIENT_ILLUMINATION,n),this._releaseGlobalIlluminationBuffers(),e.ssao=this.hasGlobalIllumination?null:n,e.globalIllumination=this.hasGlobalIllumination?n:null,e.globalIlluminationEnabled=e.globalIllumination!=null,n&&this.performanceInfo.advance(this.hasGlobalIlluminationHighQuality?L.AMBIENT_ILLUMINATION_HIGH_QUALITY:L.AMBIENT_ILLUMINATION);let r=this._needsDepth;if(r){let n=t.obtainAttachment(R);this._rctx.bindFramebuffer(t.fbo),this._rctx.clear(1024),this._renderGeometryWithoutNormals(3),e.depth=t.obtainDepthTexture(),e.depth?.retain(r-1),t.attachColor(n,R),n?.release(),this.performanceInfo.advance(L.DEPTH)}else t.detachDepth();this.hasAmbientIllumination&&this._pluginInput.release(`normals`)}else this._releaseGlobalIlluminationBuffers(),e.ssao=null,this._pluginInput.set(C.AMBIENT_ILLUMINATION,null),this._renderAllGeometryDepth()}_renderAllGeometryDepth(){let e=this._needsDepth;if(e===0)return;let{width:t,height:n}=this._framebuffer.size,r=this.fboCache.acquire(t,n,`geometry depth`,14);this._rctx.bindFramebuffer(r.fbo),this._rctx.clear(1280),this.renderAllGeometry(3),this._renderGaussianSplatPrepassDepth(r),this._bindParameters.depth=r.obtainDepthTexture(),this._bindParameters.depth?.retain(e-1),r.release(),this.performanceInfo.advance(L.DEPTH)}_renderGaussianSplatPrepassDepth(e){let t=this._shadowAccumulator;if(!t?.active||!t.requireGeometryDepth)return;let n=this._bindParameters.output;this._bindParameters.output=3,this._renderInternalNodeCategory(C.GAUSSIAN_SPLAT_DEPTH,e),this._bindParameters.output=n}_renderGaussianSplatDepthAndNormals(e){let t=this._bindParameters.output;this._bindParameters.output=4,this._renderInternalNodeCategory(C.GAUSSIAN_SPLAT_DEPTH,e),this._bindParameters.output=t}get _needsShadowDepthRange(){return this._bindParameters.shadowMap.enabled||!!this._shadowAccumulator?.active}_computeShadowDepthRange(e){if(!this._needsShadowDepthRange)return O.Zero;let t=k(e,this._plugins.plugins,this.stage.layers,0);return t.union(this._plugins.queryDepthRange(e)),t.union(this._nodes.queryDepthRange(C.SHADOWMAP,e)),t.near=Math.max(e.near,t.near),t.far=Math.min(e.far,t.far),t}updateSceneDepthRange(e){if(!this.stage.view.state.isGlobal||(this.stage.view.renderCoordsHelper?.getAltitude(e.eye)??0)<de){this.sceneDepthRange.value=O.Infinite;return}let t=e.clone();t.near=re,t.far=1e10;let n=k(t,this._plugins.plugins,this.stage.layers,1);n.union(this._plugins.queryDepthRange(t)),this.sceneDepthRange.value.equals(n)||(this.sceneDepthRange.value=n)}get _normalsRequired(){return this._nodes.require(`normals`,...T,C.VIEWSHED,C.LASERLINES)+ +!!this.hasAmbientIllumination}_precompilePrepasses(){let e=!!this._normalsRequired;if(e?(this._precompilePlugins(4,G),this._needsDepth&&this._precompilePlugins(3,K)):this._needsDepth&&this._precompileAllGeometry(3),this.shadowsEnabled&&(this._needsShadowHighlight?(this._nodes.precompile(C.SHADOW_HIGHLIGHT),this._precompileShadowCascades(6),this._precompileShadowCascades(7)):this._precompileShadowCascades(5)),this._shadowAccumulator?.active&&(this._nodes.precompile(C.SHADOW_ACCUMULATION),this._precompileAllGeometry(5)),this._shadowAccumulator?.active||e){let t=this._bindParameters.output;this._bindParameters.output=e?4:3,this._nodes.precompile(C.GAUSSIAN_SPLAT_DEPTH),this._bindParameters.output=t}(this.shadowsEnabled||this._shadowAccumulator?.active)&&this._nodes.precompile(C.SHADOWMAP),this.hasAmbientIllumination&&e&&this._nodes.precompile(C.AMBIENT_ILLUMINATION)}_renderNormals(){let e=this._normalsRequired;if(e===0)return;let{width:t,height:n}=this._framebuffer.size,r=this.fboCache.acquire(t,n,`normals`);r.acquireDepth(14),this._rctx.bindFramebuffer(r.fbo),this._rctx.clearFramebuffer(S,!0,!0),this._bindParameters.output=4,this._plugins.render(...G),this._renderGaussianSplatDepthAndNormals(r);let i=this._nodes.optional(`normals`,...T,C.VIEWSHED);return r.retain(e+i-1),this.performanceInfo.advance(L.NORMALS),r}_releaseGlobalIlluminationBuffers(){let e=this._bindParameters;this.hasGlobalIllumination&&(e.reprojection.lastFrameColor=s(e.reprojection.lastFrameColor)),e.reprojection.lastFrameDepth=o(e.reprojection.lastFrameDepth),e.reprojection.lastFrameEmission=o(e.reprojection.lastFrameEmission),e.globalIllumination=s(e.globalIllumination),e.globalIlluminationEnabled=!1}_precompileAllGeometry(e){let t=this._bindParameters.output;this._bindParameters.output=e,this._precompileOpaqueGeometry(),this._precompileTransparentGeometry(),this._plugins.precompile(...W),this._bindParameters.output=t}renderAllGeometry(e){this._bindParameters.output=e,this._renderOpaqueAndTransparentGeometry(e),this._renderTransparentGround()}precompileSlots(e,...t){for(let n of t)this._bindParameters.slot=n,e.precompile(this._renderContext)}precompileOccludedSlots(e,t){for(let n of t)this._renderContext.renderOccludedMask=n,this.precompileSlots(e,...q);this._renderContext.renderOccludedMask=M}renderSlots(e,...t){for(let n of t)this._bindParameters.slot=n,e.forAll(e=>{let t=e.acquireTechniques(this._renderContext);t&&e.render(this._renderContext,t)})}renderOccludedSlots(e,t){this._renderContext.renderOccludedMask=t,this.plugins.renderOccludedFlags>1&&this._plugins.render(9),this.renderSlots(e,...q),this._renderContext.renderOccludedMask=M}renderHUD(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(...Ae[e])}_renderHUDElements(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(16),this.renderHUD(e),this._bindParameters.hudRenderStyle=e,this._plugins.render(14)}precompileViewshedShadowMap(){let e=this._bindParameters.output;this._bindParameters.output=8,this._precompileAllGeometry(8),this._nodes.precompile(C.SHADOWMAP),this._bindParameters.output=e}precompileCutFillDepth(){this._precompilePlugins(9,Y)}_precompilePlugins(e,t){let n=this._bindParameters.output;this._bindParameters.output=e,this._plugins.precompile(...t),this._bindParameters.output=n}renderViewshedShadowMap(e,t){let{camera:n,contentCamera:r}=this._bindParameters,i=this._bindParameters.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this.renderAllGeometry(8),this._renderShadowNodes(t),this._ensureBindParametersCamera(n,r),this._bindParameters.camera.setGLViewport(this._rctx),this._bindParameters.output=i}renderCutFillDepth(e){let{camera:t,contentCamera:n}=this._bindParameters,r=this._bindParameters.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this._bindParameters.output=9,this._plugins.render(...Y),this._ensureBindParametersCamera(t,n),t.setGLViewport(this._rctx),this._bindParameters.output=r}get _needsGroundDepth(){return this._bindParameters.cutFillVisualizationEnabled}_blitGroundDepth(){if(!this._needsGroundDepth)return null;let{width:e,height:t}=this._framebuffer.size,n=this.fboCache.acquire(e,t,C.GROUND_DEPTH,14);return this._rctx.blitFramebuffer(this._framebuffer.color.fbo,n.fbo,256),this._framebuffer.bind(),n}_renderOpaqueAndTransparentGeometry(e){this._bindParameters.output=e,this._renderOpaqueGeometry(),this._renderTransparentGeometry()}_renderGeometryWithoutNormals(e){this._bindParameters.output=e,this._plugins.render(...K)}_precompileOpaqueGeometry(){this._needsOpaquePass&&(this._plugins.precompile(...H),this._nodes.precompile(`opaque-color`))}_renderOpaqueGeometry(){this._plugins.render(...H)}_renderTransparentGeometry(){this._plugins.render(...U),this._hasTransparentGeometry&&this._plugins.render(15)}_renderTransparentGround(){this._plugins.render(...W)}_precompileHUD(e){if(!this._pluginsHas.hudElements)return;let t=this._bindParameters.output,n=this._bindParameters.hudRenderStyle,r=this._bindParameters.emissions;this._bindParameters.emissions=0,this._bindParameters.hudRenderStyle=e,this._bindParameters.output=1,this._plugins.precompile(...J),this._bindParameters.output=2,this._plugins.precompile(...J),this._bindParameters.output=0,this._oitBlend.precompile(this._bindParameters,!1,1),this._hasHighlights&&(this._bindParameters.output=10,this._plugins.precompile(...J)),this._bindParameters.emissions=r,this._bindParameters.output=t,this._bindParameters.hudRenderStyle=n}_renderHUD(e,t){if(!this._pluginsHas.hudElements)return t;let n=this._renderOIT(1,e);this._rctx.bindFramebuffer(t.fbo);let r=!!t.getTexture(z);return this._compositor.compositePreMultipliedAlpha(this._bindParameters,n.getTexture(),r),n.release(),this.performanceInfo.advance(e===0?L.HUD_OCCLUDED:L.HUD),t}get _needsShadowHighlight(){return this.shadowsEnabled&&this._plugins.produces(6,2)}_renderHighlightPrepass(){if(!this._hasHighlights)return;let{fboCache:e,_rctx:t,_bindParameters:n}=this,{width:r,height:i}=this._framebuffer.size,{highlights:a}=n,o=a.length>pe?3:1,s=e.acquire(r,i,`highlights`,o);s.acquireDepth(14);let c=this._plugins.produces(10,0);return c&&this._framebuffer.color.fbo&&s.fbo&&t.blitFramebuffer(this._framebuffer.color.fbo,s.fbo,1024),t.bindFramebuffer(s.fbo),t.gl.clearBufferuiv(6144,0,[0,0,0,0]),c||t.clear(1024),this._bindParameters.output=10,t.bindFramebuffer(s.fbo),me(t,e,r,i,n,()=>this._renderHighlightGeometries()),s.detachDepth(),this.performanceInfo.advance(L.HIGHLIGHTS),s.retain(this._nodes.require(`highlights`,...E)+this._nodes.optional(`highlights`,...E)-1),s}_renderHighlightGeometries(){this._plugins.render(...Oe),this._rctx.clear(256),this._renderHUDElements(2)}_renderShadowAccumulation(e){let t=this._shadowAccumulator;if(!t)return;t.updateDepthRange(e);let n=t.requireGeometryDepth;this._bindParameters.output=0;let r=this._nodes.produce(C.SHADOW_ACCUMULATION,this._pluginInput);t.didAccumulate&&this.performanceInfo.advance(L.ACCUMULATED_SHADOWS),this._pluginInput.set(C.SHADOW_ACCUMULATION,null),r?.release(),n&&(this._bindParameters.depth=s(this._bindParameters.depth))}renderShadowAccumulationShadowMap(e,t,n,r,i){let a=this.stage.view.qualitySettings.maximumPixelRatio;n.start(e,r,i,!0,a),this._renderShadowCascades(5,n),e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,t)}_precompileTransparentGeometry(){se(this._bindParameters.output)?(this._bindParameters.output=1,this._plugins.precompile(...U),this._hasTransparentGeometry&&this._plugins.precompile(15),this._bindParameters.output=2,this._plugins.precompile(...U),this._hasTransparentGeometry&&this._plugins.precompile(15),this._bindParameters.output=0):this._plugins.precompile(...U)}_renderOIT(e,t=2){let n=e===1,{width:r,height:i}=this._framebuffer.size,a=n?()=>this._renderHUDElements(t):()=>this._renderTransparentGeometry(),s=this._bindParameters,c=s.useFloatBlend.value?8:5,l=s.output;s.output=1;let u=n?`oit hud`:`oit`,d=this.fboCache.acquire(r,i,u,c).acquireColor(z,this.hasFloatBlend?7:0,`oit alpha`),f=s.hasEmission&&(e===0||t!==1);f&&d.acquireColor(B,c,`oit emissive`),n||d.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(d.fbo),this._rctx.clearFramebuffer(A),f&&this._rctx.clearBuffer(2,A),a(),d.detachDepth(),s.output=2;let p=this.fboCache.acquire(r,i,n?`oit front hud`:`oit front`);f&&p.acquireColor(z,c,`oit front emissive`),n?p.acquireDepth(this._hudDepthFormat):p.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(p.fbo),this._rctx.clearFramebuffer(S,n),a(),p.detachDepth();let m=this._pluginsHas.occludedHudElements&&!n,h=m&&s.emissions!==0?B:z;s.hudOcclusion=o(this._bindParameters.hudOcclusion),s.output=0;let g;return n?(g=this.fboCache.acquire(r,i,`oit composite hud`),this._rctx.bindFramebuffer(g.fbo),this._rctx.setClearColor(0,0,0,1e-13),this._rctx.clear(16384)):(s.emissions!==0&&this._framebuffer.ensureEmissionAttachment(),m&&(this._framebuffer.color.acquireColor(h,0,`hud occlusion`),this._rctx.clearBuffer(h-R,S)),this._framebuffer.bind()),this._oitBlend.blend(this._rctx,d,p,s,m,e,this._fboCache.debugCallback),g?.detachDepth(),n||(f&&(this._bindParameters.emissions=3),m&&(s.hudOcclusion=this._framebuffer.color.obtainAttachment(h))),p.release(),d.release(),s.output=l,g}get _hudDepthFormat(){return this.isFeatureEnabled(7)?14:13}get _needsOpaquePass(){return this.plugins.produces(0,...H)||this.plugins.produces(5,...H)||this.plugins.produces(3,3)}_renderOpaque(){let e=this._needsOpaquePass;e&&(this._plugins.render(0,1),this._pluginInput.set(C.GROUND_DEPTH,this._blitGroundDepth()),this._plugins.render(2,3));let t=this._framebuffer;t.update(t=>this._renderNodes(w.OPAQUE,t,e)),this.fboCache.debugCallback?.(w.OPAQUE,t.color.fbo),t.update(e=>this._renderNodes(C.OPAQUE_ENVIRONMENT,e)),this.fboCache.debugCallback?.(C.OPAQUE_ENVIRONMENT,t.color.fbo),this._renderEdges(1)}_renderPreTransparent(){this._framebuffer.update(e=>this._renderNodes(C.GAUSSIAN_SPLAT,e)),this.fboCache.debugCallback?.(C.GAUSSIAN_SPLAT,this._framebuffer.color.fbo),this._framebuffer.update(e=>this._renderNodes(C.OPAQUE_OCCLUSION_QUERY,e)),this.fboCache.debugCallback?.(C.OPAQUE_OCCLUSION_QUERY,this._framebuffer.color.fbo),this._framebuffer.update(e=>this._renderNodes(C.VOXEL,e)),this.fboCache.debugCallback?.(C.VOXEL,this._framebuffer.color.fbo)}_renderTransparent(){let e=this._framebuffer;if(this._renderHiddenTransparentEdges(),this._hasTransparentGeometry&&this._renderOIT(0),e.update(e=>this._renderNodes(w.TRANSPARENT,e,this._hasTransparentGeometry)),this.fboCache.debugCallback?.(w.TRANSPARENT,e.color.fbo),this._hasTransparentGeometry||this._plugins.render(15),this._renderEdges(0),this._bindParameters.ssao=o(this._bindParameters.ssao),e.update(e=>this._renderNodes(C.TRANSPARENT_NO_DEPTH,e)),this.fboCache.debugCallback?.(C.TRANSPARENT_NO_DEPTH,e.color.fbo),this._framebuffer.bind(),this._plugins.render(8),this._bindParameters.hasEmission){let e=this._rctx.setDrawBuffers([Ee,z]);this._bindParameters.transparentWithoutDepthEmissionDimmingPass=!0,this._plugins.render(8),this._bindParameters.transparentWithoutDepthEmissionDimmingPass=!1,this._rctx.setDrawBuffers(e)}this.performanceInfo.advance(L.TRANSPARENT_MATERIAL_WITHOUT_DEPTH)}_renderNodes(e,t,n=!1){if(t.setName(e),this._pluginInput.set(e,t),!this._nodes.produces(e))return n&&this.performanceInfo.advance(e),t;let r=this._nodes.render(t,this._pluginInput,this._releaseNodeInputs);return this.performanceInfo.advance(e),this._fboCache.debugCallback?.(e,r.fbo),r}_renderInternalNodeCategory(e,t){if(!t)return;let n=t.name;try{this._renderNodes(e,t)}finally{this._pluginInput.set(e,null),t.setName(n)}}_3dGeometryRendered(){let e=this._bindParameters;this.hasReflections&&(e.depth=s(e.depth),e.reprojection.lastFrameColor=s(e.reprojection.lastFrameColor)),e.shadowMap.disposeOutput(5);let t=this._framebuffer.color.getAttachment(z)?.attachment;if(this.hasGlobalIllumination&&t){let{width:n,height:r}=this._framebuffer.size,i=e.useFloatBlend.value?8:5;e.reprojection.lastFrameEmission=this.fboCache.acquire(n,r,`emissive`,i),this._blit.blitTexture(t,e,e.reprojection.lastFrameEmission.fbo)}}_ensureBindParameters(e,t){this._ensureBindParametersCamera(e,t),this._ensureBindParametersWeatherFader(),this._ensureBindParametersScreenSpaceReflections(),this._ensureBindParametersReprojection()}_ensureBindParametersCamera(e,t){this._bindParameters.camera=e,this._bindParameters.contentCamera=t}_ensureBindParametersWeatherFader(){this.stage.viewingMode===1&&(this._bindParameters.clouds.data&&(this._bindParameters.clouds.fade(this._bindParameters.camera,this.renderContext.time,this.stage.view.qualitySettings.fadeDuration,this.stage.view.state.stationary),this.weatherFader?.cleanupCubemap()),this._bindParameters.snowCover=this.weatherFader?.snowCover??0)}_ensureBindParametersScreenSpaceReflections(){let{time:e}=this.renderContext,{screenSpaceReflections:t}=this._bindParameters;if(this.hasReflections){this._ssrEnableTime??=e;let n=this.stage.view.qualitySettings.fadeDuration;t.fadeFactor=n>0?Math.min(n,e-this._ssrEnableTime)/n:1,t.fadeFactor<1&&this._requestRender()}else this._ssrEnableTime=null}_ensureBindParametersReprojection(){if(!(this.hasReflections||this.hasGlobalIllumination)){this._reprojectionMatrix=b;return}let{reprojection:e,camera:t}=this._bindParameters,{lastFrameCamera:n}=e,r=!n.equals(t);if(r?(_(Z,t.viewMatrix),_(X,t.projectionMatrix),v(Q,Z,X),v(Q,n.viewMatrix,Q),v(Q,n.projectionMatrix,Q),this._reprojectionMatrix=Q):this._reprojectionMatrix=b,this.hasGlobalIllumination){let{viewMatrix:t}=e;r?(v($,n.viewMatrix,Z),y(t,$)):y(t,b)}}addRenderNode(e){this._nodes.add(e),this._requestRender()}removeRenderNode(e){this._nodes.remove(e),this._requestRender()}updateLighting(e,t,n,r){this._bindParameters.updateLighting(e,t,n,r),this._requestRender(1)}get usedMemory(){return{fbos:this.fboCache.usedMemory,plugins:this._plugins.usedMemory,edges:this.edgeView?.usedMemory??0,clouds:this.weatherFader?.usedMemory??0}}get test(){}};e([m({readOnly:!0})],V.prototype,`highResolutionAtmosphere`,null),e([m()],V.prototype,`_edgeView`,void 0),e([m()],V.prototype,`updating`,null),V=e([h(`esri.views.3d.webgl-engine.lib.Renderer`)],V);const H=[0,1,2,3],U=[7,6,4,5],W=[7,6],G=[0,1,2,4,...W],K=[3,5],q=[2,4,8],J=[16,12,14,13],Oe=[4,5,2,3,0,1,...W],ke=[4,8,5,11],Ae={0:[13],1:[12],2:[13,12],3:[13,12]},Y=[0,1,...W],je=[`normals`,`highlights`],X=x(),Z=x(),Q=x(),$=x();function Me(e){return t=>e.immediate.schedule(t)}export{V as Renderer};
2
+ import{__decorate as e}from"tslib";import{update as t}from"../../../../core/arrayUtils.js";import{createTask as n}from"../../../../core/asyncUtils.js";import has from"../../../../core/has.js";import{removeMaybe as r,abortMaybe as i,destroyMaybe as a,releaseMaybe as o,releaseReferencedMaybe as s}from"../../../../core/maybe.js";import{throwIfAborted as c}from"../../../../core/promiseUtils.js";import{watch as l,syncAndInitial as u,initial as d,sync as f}from"../../../../core/reactiveUtils.js";import{signal as p}from"../../../../core/signal.js";import{property as m,subclass as h}from"../../../../core/accessorSupport/decorators.js";import{equals as g,invert as _,multiply as v,copy as y}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as b,create as x}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as ee}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{fromValues as te,ZEROS as S}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{pruneIndexArrays as ne}from"../../../../geometry/support/Indices.js";import{InternalRenderCategory as C,RenderNodeOutput as w,AllRenderNodeOutputs as T,AllInternalRenderNodeOutputs as E}from"../../webgl.js";import{minNearDistanceInMeters as re}from"../../state/NearFarHeuristic.js";import{debugFlags as ie}from"../../support/debugFlags.js";import{FBOCache as ae}from"../core/FBOCache.js";import{RenderPassManager as oe}from"../core/renderPasses/RenderPassManager.js";import{isColor as se}from"../core/shaderLibrary/ShaderOutput.js";import{RenderNodes as ce}from"../effects/RenderNodes.js";import{RenderPluginManager as le}from"../effects/RenderPluginManager.js";import{WeatherFader as ue}from"../effects/WeatherFader.js";import{innerAtmosphereFadeStart as de}from"../effects/atmosphere/atmosphereUtils.js";import{Blit as fe}from"../effects/blit/Blit.js";import{maxHighlightsPerChannel as pe,renderHighlightBuffer as me}from"../effects/highlight/Highlight.js";import{OITBlend as D}from"../effects/transparency/OITBlend.js";import{AnimationTimer as he}from"./AnimationTimer.js";import{AnimationTimeStep as ge}from"./AnimationTimeStep.js";import{BoundingInfo as _e}from"./BoundingInfo.js";import{Compositor as ve}from"./Compositor.js";import{DepthRange as O}from"./DepthRange.js";import{depthRangeFromScene as k}from"./depthRangeUtils.js";import{MainFramebuffer as ye}from"./MainFramebuffer.js";import{NavigationDepthCache as be}from"./NavigationDepthCache.js";import{blendingColorAlphaClear as A}from"./OrderIndependentTransparency.js";import{RenderContext as j,defaultRenderOccludedMask as M}from"./RenderContext.js";import{RendererBase as N}from"./RendererBase.js";import{setupFeatureDefaults as P}from"./RenderFeature.js";import{RenderPluginInput as xe}from"./RenderPluginInput.js";import{ShadowMap as Se}from"./ShadowMap.js";import Ce from"./SliceHelper.js";import{MergedRenderer as we}from"../materials/renderers/MergedRenderer.js";import{RenderSceneResult as F}from"../parts/renderUtils.js";import{RendererPerformanceInfo as I,PerformanceCategory as L}from"../statistics/RendererPerformanceInfo.js";import{PixelType as Te,ColorAttachment0 as R,ColorAttachment1 as z,ColorAttachment2 as B,DrawBufferNone as Ee}from"../../../webgl/enums.js";const De=has(`disable-feature:async-navigation-3d-depth-readback`);let V=class extends N{constructor(e,t,n,r,i){super({stage:e}),this._techniques=n,this._rctx=r,this._requestRender=i,this._pluginsHas={occludedHudElements:!1,hudElements:!1,water:!1},this.renderPassManager=new oe,this._isRendering=!1,this._backgroundColor=te(0,0,0,1),this._sliceHelper=new Ce,this._shadowAccumulator=null,this._shadowCastOptions=null,this.sceneDepthRange=p(O.Infinite),this._state=p(2),this._hasAnimations=!1,this._animationTimestep=new ge,this._loadEdgeViewTask=null,this._edgeViewCallbacks=[],this._reprojectionMatrixVersion=p(0),this._renderHiddenTransparentEdges=()=>{},this._pluginInput=new xe,this._hasTransparentGeometry=!1,this._releaseNodeInputs=e=>{for(let t of je)e.some(({name:e})=>e===t)&&this._pluginInput.release(t)},this._testsNeedsDepth=!1,this._fboCache=new ae(r),this._compositor=new ve(r,n),this._renderStateFeatures=p(P(e.view.qualityProfile));let a=new Se(this._fboCache,e.viewingMode);this._renderContext=new j(this._rctx,a,n),this._framebuffer=new ye(this._fboCache,this._bindParameters),this._performanceInfo=new I(this._rctx),this._blit=new fe(n),this.navigationDepthCache=new be(this._rctx,this._fboCache,n,()=>this._requestRender(0)),this._nodes=new ce(this._renderContext),this._plugins=new le({renderContext:this._renderContext,techniques:n,materials:t,requestRender:i,controller:e}),this._plugins.add(this.renderPassManager),this.weatherFader=new ue({view:e.view,context:this._renderContext}),this.addHandles([l(()=>e.view.state.camera,()=>i(),u),l(()=>ie.EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES,e=>{this._renderHiddenTransparentEdges=e?()=>this._renderEdges(0):()=>{},i()},d),l(()=>e.view.environment.background?.color,e=>{let t=e?e.toUnitRGBA():S;ee(this._backgroundColor,t[0]*t[3],t[1]*t[3],t[2]*t[3],t[3]),i()},u),l(()=>e.view.environmentView.shadowsAvailable,e=>{this._bindParameters.shadowMap.enabled=e,this._requestRender(1)},u),l(()=>this._bindParameters.clouds.fadeFactor,()=>{this._bindParameters.fadeLighting(),this._requestRender(2)},f),l(()=>this._bindParameters.clouds.data?.state,()=>i(),f),l(()=>e.view.state.highlights,e=>{this._bindParameters.highlights=e,i()},d),l(()=>e.view.environment.lighting?.type===`sun`,e=>{this._bindParameters.enableFillLights=e,this._requestRender()},u)])}destroy(){this._gpuTimerHandle=r(this._gpuTimerHandle),this._nodes.destroy(),this._framebuffer.dispose(),this._shadowAccumulator=null,this._shadowCastOptions=null,this._loadEdgeViewTask=i(this._loadEdgeViewTask),this._edgeView=a(this._edgeView),this.renderPassManager.dispose(),this.weatherFader=a(this.weatherFader),this._releaseFBOs(),this._disposeOffscreenBuffers(),this.navigationDepthCache.destroy(),this._fboCache.destroy(),this._fboCache=null,this._renderContext.destroy(),this._plugins.destroy(),this._pluginInput=null,this._oitBlendOrNil=null,this._nodes=null,this._framebuffer=null,this._performanceInfo=null,_e.prune(),we.prune(),ne()}get renderContext(){return this._renderContext}get _bindParameters(){return this._renderContext.bind}get _oitBlend(){return this._oitBlendOrNil??=new D(this._techniques),this._oitBlendOrNil}get performanceInfo(){return this._performanceInfo}updateRenderFeatures(e){this._renderStateFeatures.value=P(e),this.updateGlobalIllumination(this.stage.view.environment.lighting.globalIllumination),this._requestRender()}updateGlobalIllumination(e){let t=P(this.stage.view.qualityProfile);for(let n of[0,1,2])this.setFeatureEnabled(11,n,e),this.setFeatureEnabled(10,n,e&&n===2),this.setFeatureEnabled(3,n,!e&&(t.get(n,3)??!1))}isFeatureEnabled(e,t=this._state.value){return this._renderStateFeatures.value.get(t,e)??!1}setFeatureEnabled(e,t,n){this.isFeatureEnabled(e,t)!==n&&(this._renderStateFeatures.mutate(r=>r.set(t,e,n)),this._requestRender())}setTime(e){this._renderContext.time=e}get hasReflections(){return this._bindParameters.screenSpaceReflections.enabled=this._pluginsHas.water&&this.isFeatureEnabled(4),this._bindParameters.screenSpaceReflections.enabled}get _hasHighlights(){return this._plugins.produces(10,2,4,18,12,13,14)}hasHighlight(e){return this._plugins.hasHighlight(e)}get _hasHUDHighlights(){return this._plugins.produces(10,12,13,14)}get hasAmbientIllumination(){return this._nodes.produces(C.AMBIENT_ILLUMINATION)}get hasGlobalIllumination(){return this.stage.renderView?.globalIllumination?.enabled??!1}get hasGlobalIlluminationHighQuality(){let e=this.stage.renderView?.globalIllumination;return this.hasGlobalIllumination&&e?.hasHighQuality===!0}get hasSMAA(){return this.isFeatureEnabled(0)}get _emissions(){let e=this._plugins.emissions;return this._hasTransparentGeometry?e:+(e===1||e===3)}get hasFloatBlend(){return this._rctx.driverTest.floatBufferBlend.result&&this.isFeatureEnabled(9)}get highResolutionAtmosphere(){return this.isFeatureEnabled(2)}get fboCache(){return this._fboCache}setShadowAccumulator(e){this._shadowAccumulator=e,this._shadowCastOptions&&e.setParameters(this._shadowCastOptions)}_releaseFBOs(){this._bindParameters.hudOcclusion=o(this._bindParameters.hudOcclusion),this._bindParameters.depth=null}_disposeOffscreenBuffers(){this._framebuffer.dispose();let e=this._bindParameters;e.globalIllumination=o(e.globalIllumination),e.reprojection.lastFrameDepth=o(e.reprojection.lastFrameDepth),e.reprojection.lastFrameEmission=o(e.reprojection.lastFrameEmission),this._disposeBindBuffers()}_disposeBindBuffers(){this._bindParameters.shadowMap.disposeOutputs()}get updating(){return this._loadEdgeViewTask&&!this._loadEdgeViewTask.finished||this._edgeView?.updating||this._plugins.updating||this.weatherFader?.readyToRun||!this.isCameraFinal}loadEdgeView(){return this._loadEdgeViewTask||=n(async e=>{let{EdgeView:t}=await import(`./edgeRendering/EdgeView.js`);c(e);let n=this._edgeView=new t({rctx:this._rctx,renderSR:this.stage.view.renderSpatialReference,viewingMode:this.stage.view.stage.viewingMode,techniques:this._techniques,setNeedsRender:()=>this._requestRender(),schedule:Me(this.stage.view.resourceController)});return this.addHandles(l(()=>n.updating,()=>this._requestRender(),f)),this._requestRender(),this._edgeViewCallbacks.forEach(e=>e(n)),this._edgeViewCallbacks.length=0,n}),this._loadEdgeViewTask.promise}withEdgeView(e){this.loadEdgeView().catch(()=>{}),this._edgeView==null?this._edgeViewCallbacks.push(e):e(this._edgeView)}get edgeView(){return this._edgeView}get isCameraFinal(){return this._reprojectionMatrixVersion.value>=0&&g(this._bindParameters.reprojection.matrix,b)}set _reprojectionMatrix(e){t(this._bindParameters.reprojection.matrix,e)&&this._reprojectionMatrixVersion.value++}get shadowsEnabled(){return!!this._bindParameters.shadowMap.enabled}setParameters(e){e.shadowCast&&(this._shadowCastOptions={...this._shadowCastOptions,...e.shadowCast},this._shadowAccumulator?.setParameters(e.shadowCast))}set slice(e){this._sliceHelper.update(e)&&this._requestRender()}get plugins(){return this._plugins}commit(e,t){return this._isRendering&&console.warn(`Renderer.modify called while rendering`),super.commit(e,t,this._plugins.context)?(this.updateHasFlags(),!0):!1}addRenderer(e){this._plugins.add(e)}removeRenderer(e){this._plugins.remove(e)}get occludedRequiresStencil(){return this._occludedRequiresOccludeeStencil||this.occludedRequiresIntegratedMeshStencil}get _occludedRequiresOccludeeStencil(){return this._bindParameters.hasOccludees&&!!(this.plugins.renderOccludedFlags&8)}get occludedRequiresIntegratedMeshStencil(){return this._plugins.produces(0,0)&&this._plugins.produces(0,9)}updateHasFlags(){let has=this._pluginsHas;has.occludedHudElements=this._plugins.produces(0,13),has.hudElements=has.occludedHudElements||this._plugins.produces(0,...J),has.water=this._plugins.produces(4,19),this._bindParameters.hasOccludees=this._plugins.hasOccludees,this._requestRender()}updateAnimation(e,t){this._animationTimer??=new he(e.camera,t),this._animationTimer.advance(e.camera,t,this._animationTimeDilation);let n=this._hasAnimations;return this._hasAnimations=this._plugins.updateAnimation(this._animationTimer),this._hasAnimations=this._nodes.updateAnimation(this._animationTimer)||this._hasAnimations,this._hasAnimations!==n&&(this._gpuTimerHandle=n?r(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,t,n=!1){try{this._isRendering=!0,this._needsOffscreenPrepass(e.camera,t)&&this._render(e,3,n).color?.release();let r=this._render(e,t,n);return t!==0&&this._disposeOffscreenBuffers(),r}catch(e){console.error(`Exception during rendering: ${e}:\n${e.stack}`)}finally{this._isRendering=!1}return new F(this._pluginInput.get(w.FINAL),null)}_needsOffscreenPrepass(e,t){return(t===1||t===2)&&(this.hasGlobalIllumination||this.hasReflections)&&(!this._framebuffer.hasColor||!this._bindParameters.reprojection.lastFrameCamera.equals(e))}_render(e,t,n){let r=t===0;this.performanceInfo.startFrame(),this.fboCache.frameStart(),this.fboCache.interactive=r,this._disposeBindBuffers();let{camera:i,contentCamera:a,mode:c,alignPixelEnabled:l}=e;this._state.value=c,this._bindParameters.frameRendererTarget=t,this._bindParameters.output=0,this._bindParameters.emissions=this._emissions,this._bindParameters.alignPixelEnabled=l,this._bindParameters.metersPerRenderUnit=this.stage.view.renderCoordsHelper.unitInMeters,this._bindParameters.decorations=!n,this._bindParameters.mainDepth=null,this._bindParameters.useFloatBlend.value=this.hasFloatBlend;let u=!n||!this._sliceHelper.isDecoration;this._bindParameters.slicePlane=u?this._sliceHelper.plane:null,this._bindParameters.viewshedEnabled=this._nodes.produces(C.VIEWSHED),this._bindParameters.laserlinesEnabled=this._nodes.produces(C.LASERLINES),this._bindParameters.shadowAnalysisEnabled=!!this._shadowAccumulator?.active,this._bindParameters.cutFillComputationEnabled=this._nodes.produces(C.CUTFILL_COMPUTATION),this._bindParameters.cutFillVisualizationEnabled=this._nodes.produces(C.CUTFILL),this._ensureBindParameters(i,a),this._plugins.sortTestsTransparentOrderedSlots(ke),this._plugins.prepareRender(),this._hasTransparentGeometry=this._plugins.produces(1,...U),this._renderOverlay(),i.setGLViewport(this._rctx);let d=this._framebuffer,f=d.initialize(i.fullWidth,i.fullHeight,this._backgroundColor);this.hasReflections?(f?.setName(`last frame color`),this._bindParameters.reprojection.lastFrameColor?.release(),this._bindParameters.reprojection.lastFrameColor=f):f?.release(),this._bindParameters.hasShadowHighlights=this._needsShadowHighlight&&!n,this._precompilePrepasses(),this.performanceInfo.advance(L.PREPARE);let p=this._computeShadowDepthRange(i);this._pluginInput.set(`normals`,this._renderNormals()),this._renderAmbientIlluminationAndDepth(),this._renderShadowMap(i,a,this._bindParameters.lighting.mainLight.direction,p),this._renderShadowAccumulation(p),d.bind(),this._bindParameters.mainDepth=d.depth.attachment,this._precompileShaders(r),this._bindParameters.output=0,this._renderOpaque(),this._renderPreTransparent(),this._renderTransparent(),this._3dGeometryRendered(),d.update(e=>this._renderNodes(C.CUTFILL_COMPUTATION,e)),this._pluginInput.set(C.FOCUSAREA_MASK,this._renderFocusAreaMask()),d.update(e=>this._renderNodes(C.TRANSPARENT_ENVIRONMENT,e)),d.update(e=>this._renderNodes(C.VIEWSHED,e)),d.update(e=>this._renderNodes(C.LASERLINES,e)),this._nodes.requireGeometryDepth&&(this._bindParameters.depth=s(this._bindParameters.depth)),d.update(e=>this._renderNodes(C.FOCUSAREA,e)),this._pluginInput.release(C.FOCUSAREA_MASK),d.update(e=>this._renderNodes(C.CUTFILL,e)),this._pluginInput.release(C.GROUND_DEPTH),d.update(e=>this._renderNodes(C.OCCLUDED,e)),this._pluginInput.set(`highlights`,this._renderHighlightPrepass());let m=t===2?this._renderObjectAndLayerIdColor():null;d.update(e=>this._renderNodes(w.COMPOSITE,e)),this._bindParameters.shadowMap.disposeOutputs(),this._bindParameters.shadowHighlight=o(this._bindParameters.shadowHighlight),d.update(e=>this._renderNodes(C.ANTIALIASING,e));let h=this._hasTransparentGeometry?2:1,g=this._bindParameters.emissions;this._bindParameters.emissions=0,this._hasHUDHighlights&&d.update(e=>this._renderHUD(h,e)),d.update(e=>this._renderNodes(C.HIGHLIGHT,e)),this._hasHUDHighlights||d.update(e=>this._renderHUD(h,e)),this._bindParameters.emissions=g,d.update(e=>this._renderNodes(C.MAGNIFIER,e)),d.update(e=>this._renderNodes(w.FINAL,e)),r&&(this._blit.toFramebuffer(d.color,this._bindParameters),De||c!==2&&c!==0||this.navigationDepthCache.update(this._bindParameters,d.depth.attachment,this._renderContext.time)),this._bindParameters.reprojection.lastFrameDepth?.release(),this.hasGlobalIllumination&&(this._bindParameters.reprojection.lastFrameDepth=this._bindParameters.depth),this._testsNeedsDepth&&(this._bindParameters.depth=s(this._bindParameters.depth)),this._releaseFBOs(),d.releaseDepth(),this._bindParameters.reprojection.lastFrameCamera.copyFrom(this._bindParameters.camera),this.fboCache.frameEnd();let _;return r||(_=d.color,_.retain()),this.performanceInfo.finishFrame(),new F(_,m)}_precompileShaders(e){++this._plugins.context.techniques.precompiling;let t=this._bindParameters;t.output=0;let n=t.emissions;if(this._precompileOpaqueGeometry(),this._nodes.precompile(C.OPAQUE_ENVIRONMENT,C.GAUSSIAN_SPLAT,C.OPAQUE_OCCLUSION_QUERY,C.VOXEL),this._precompileOpaqueGeometry(),t.output=3,this._plugins.precompile(...W),t.output=0,this._plugins.precompile(...W),this._hasTransparentGeometry){let e=this._pluginsHas.occludedHudElements;this._oitBlend.precompile(t,e,0),this._pluginsHas.hudElements&&this._oitBlend.precompile(t,!1,1),this._precompileTransparentGeometry(),t.hasTransparentEmission&&(t.emissions=3)}this._nodes.precompile(C.FOCUSAREA_MASK),this._compositor.precompile(this._usesPremultipliedAlphaBlit,!!this._needsEdges,t),this._hasTransparentGeometry||this._plugins.precompile(15),this._nodes.precompile(C.TRANSPARENT_ENVIRONMENT,C.VIEWSHED,C.CUTFILL_COMPUTATION,C.CUTFILL,C.LASERLINES,C.FOCUSAREA,C.OCCLUDED,C.ANTIALIASING),t.highlightMixTexture=t.highlights.length>1?this._rctx.emptyTexture:null,this._precompileHUD(0),t.emissions=0,this._precompileHUD(0),this._precompileHUD(1),t.emissions=n,this._hasHighlights&&(t.highlights.forEach((e,n)=>{t.highlightLevel=n,this._precompileAllGeometry(10),this._hasHUDHighlights&&this._plugins.precompile(13,12)}),t.highlightLevel=null,this._nodes.precompile(C.HIGHLIGHT)),t.highlightMixTexture=null,this._nodes.precompile(w.COMPOSITE,C.MAGNIFIER),this._nodes.precompile(C.TRANSPARENT_NO_DEPTH),this._plugins.precompile(8),t.hasOpaqueEmission&&(t.transparentWithoutDepthEmissionDimmingPass=!0,this._plugins.precompile(8),t.transparentWithoutDepthEmissionDimmingPass=!1),e&&this._blit.precompile(),--this._plugins.context.techniques.precompiling}_renderFocusAreaMask(){let e=this._nodes.produce(C.FOCUSAREA_MASK,this._pluginInput);return e&&this.performanceInfo.advance(L.FOCUS_AREA_MASK),e}_renderObjectAndLayerIdColor(){if(!this._nodes.produces(C.OBJECT_AND_LAYER_ID_COLOR))return null;let e=this._bindParameters.output;++this._techniques.precompiling;let{width:t,height:n}=this._framebuffer.size,r=this.fboCache.acquire(t,n,C.OBJECT_AND_LAYER_ID_COLOR).acquireDepth(14);return r=this._renderNodes(C.OBJECT_AND_LAYER_ID_COLOR,r),--this._techniques.precompiling,this._bindParameters.output=e,r}finish(e){this._hasAnimations||this._animationTimestep.clear();let t=this.performanceInfo.gpuSamplingEnabled,n=e===0,r=n?this.performanceInfo.elapsedTime:0;if(n||t){let e=0;t?e=this.performanceInfo.totalGPUTimeSampler.last:(this._rctx.gl.finish(),e=this.performanceInfo.elapsedTime);let i=Math.max(r,e);this._animationTimestep.frame(i,n)}}readAccumulatedShadow(e){return this._shadowAccumulator?.readAccumulatedShadow(e[0],e[1])??0}readMainDepth(e,t){let{mainDepth:n,camera:r}=this._bindParameters;if(!n)return;let i=this.fboCache.acquire(this._framebuffer.size.width,this._framebuffer.size.height,`linear depth`);this._rctx.bindFramebuffer(i.fbo),r.setGLViewport(this._rctx),this._rctx.setScissorRect(e[0],e[1],e[2],e[3]),this._rctx.setScissorTestEnabled(!0),this._rctx.clearFramebuffer(S),this._compositor.blitDepthToLinearDepth(this._bindParameters,n),this._rctx.setScissorTestEnabled(!1),this._rctx.setScissorRect(0,0,this._rctx.gl.canvas.width,this._rctx.gl.canvas.width),i.fbo?.readPixels(e[0],e[1],e[2],e[3],6408,Te.UNSIGNED_BYTE,t),i.release()}get _needsEdges(){return this._edgeView?.shouldRender()?this._edgeView:null}_renderEdges(e){let t=this._needsEdges;if(!t)return;let{width:n,height:r}=this._framebuffer.size,i=this.fboCache.acquire(n,r,`edges`);i.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(i.fbo),this._rctx.clearFramebuffer(S),t.render(this._bindParameters,e),i.detachDepth(),this._framebuffer.bind(),this._compositor.composite(this._bindParameters,i.getTexture()),i.release(),this.performanceInfo.advance(e===1?L.OPAQUE_EDGES:L.TRANSPARENT_EDGES)}_renderOverlay(){this._bindParameters.overlay=this.overlay?.render(this._renderContext.time),this._bindParameters.overlay&&this.performanceInfo.advance(L.OVERLAY)}_renderShadowMap(e,t,n,r){if(!this.shadowsEnabled)return;let i=this._bindParameters.shadowMap;if(i.start(e,n,r,this.isFeatureEnabled(5),this.stage.view.qualitySettings.maximumPixelRatio),this._needsShadowHighlight){this._renderShadowCascades(6,i),e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,t);let n=this._bindParameters.output;this._bindParameters.output=0,this._bindParameters.shadowHighlight=this._nodes.produce(C.SHADOW_HIGHLIGHT,this._pluginInput),this._bindParameters.output=n,i.disposeOutput(6),i.clear(),this._renderShadowCascades(7,i)}else this._renderShadowCascades(5);e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,this._bindParameters.contentCamera),this._needsShadowHighlight&&(this._bindParameters.depth=s(this._bindParameters.depth)),this.performanceInfo.advance(C.SHADOWMAP)}_precompileShadowCascades(e){this._bindParameters.shadowMap.cascades.length!==0&&this._precompileAllGeometry(e)}_renderShadowCascades(e,t=this._bindParameters.shadowMap){let n=this._bindParameters.output,r=e!==6;t.bindFramebuffer();for(let n of t.cascades)n.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(n.camera,n.camera),this.renderAllGeometry(e),r&&this._renderShadowNodes(t.renderTarget);t.finish(e),this._bindParameters.output=n}_renderShadowNodes(e){this._renderInternalNodeCategory(C.SHADOWMAP,e)}get _needsDepth(){return+this._nodes.requireGeometryDepth+ +this.hasReflections+ +this.hasGlobalIllumination+ +this._testsNeedsDepth+ +this._needsShadowHighlight}get _usesPremultipliedAlphaBlit(){return this._pluginsHas.hudElements}_renderAmbientIlluminationAndDepth(){let e=this._bindParameters;e.depth=o(this._bindParameters.depth);let t=this._pluginInput.get(`normals`);if(t){let n=this._nodes.produce(C.AMBIENT_ILLUMINATION,this._pluginInput);this._pluginInput.set(C.AMBIENT_ILLUMINATION,n),this._releaseGlobalIlluminationBuffers(),e.ssao=this.hasGlobalIllumination?null:n,e.globalIllumination=this.hasGlobalIllumination?n:null,e.globalIlluminationEnabled=e.globalIllumination!=null,n&&this.performanceInfo.advance(this.hasGlobalIlluminationHighQuality?L.AMBIENT_ILLUMINATION_HIGH_QUALITY:L.AMBIENT_ILLUMINATION);let r=this._needsDepth;if(r){let n=t.obtainAttachment(R);this._rctx.bindFramebuffer(t.fbo),this._rctx.clear(1024),this._renderGeometryWithoutNormals(3),e.depth=t.obtainDepthTexture(),e.depth?.retain(r-1),t.attachColor(n,R),n?.release(),this.performanceInfo.advance(L.DEPTH)}else t.detachDepth();this.hasAmbientIllumination&&this._pluginInput.release(`normals`)}else this._releaseGlobalIlluminationBuffers(),e.ssao=null,this._pluginInput.set(C.AMBIENT_ILLUMINATION,null),this._renderAllGeometryDepth()}_renderAllGeometryDepth(){let e=this._needsDepth;if(e===0)return;let{width:t,height:n}=this._framebuffer.size,r=this.fboCache.acquire(t,n,`geometry depth`,14);this._rctx.bindFramebuffer(r.fbo),this._rctx.clear(1280),this.renderAllGeometry(3),this._renderGaussianSplatPrepassDepth(r),this._bindParameters.depth=r.obtainDepthTexture(),this._bindParameters.depth?.retain(e-1),r.release(),this.performanceInfo.advance(L.DEPTH)}_renderGaussianSplatPrepassDepth(e){let t=this._shadowAccumulator;if(!t?.active||!t.requireGeometryDepth)return;let n=this._bindParameters.output;this._bindParameters.output=3,this._renderInternalNodeCategory(C.GAUSSIAN_SPLAT_DEPTH,e),this._bindParameters.output=n}_renderGaussianSplatDepthAndNormals(e){let t=this._bindParameters.output;this._bindParameters.output=4,this._renderInternalNodeCategory(C.GAUSSIAN_SPLAT_DEPTH,e),this._bindParameters.output=t}get _needsShadowDepthRange(){return this._bindParameters.shadowMap.enabled||!!this._shadowAccumulator?.active}_computeShadowDepthRange(e){if(!this._needsShadowDepthRange)return O.Zero;let t=k(e,this._plugins.plugins,this.stage.layers,0);return t.union(this._plugins.queryDepthRange(e)),t.union(this._nodes.queryDepthRange(C.SHADOWMAP,e)),t.near=Math.max(e.near,t.near),t.far=Math.min(e.far,t.far),t}updateSceneDepthRange(e){if(!this.stage.view.state.isGlobal||(this.stage.view.renderCoordsHelper?.getAltitude(e.eye)??0)<de){this.sceneDepthRange.value=O.Infinite;return}let t=e.clone();t.near=re,t.far=1e10;let n=k(t,this._plugins.plugins,this.stage.layers,1);n.union(this._plugins.queryDepthRange(t)),this.sceneDepthRange.value.equals(n)||(this.sceneDepthRange.value=n)}get _normalsRequired(){return this._nodes.require(`normals`,...T,C.VIEWSHED,C.LASERLINES)+ +!!this.hasAmbientIllumination}_precompilePrepasses(){let e=!!this._normalsRequired;if(e?(this._precompilePlugins(4,G),this._needsDepth&&this._precompilePlugins(3,K)):this._needsDepth&&this._precompileAllGeometry(3),this.shadowsEnabled&&(this._needsShadowHighlight?(this._nodes.precompile(C.SHADOW_HIGHLIGHT),this._precompileShadowCascades(6),this._precompileShadowCascades(7)):this._precompileShadowCascades(5)),this._shadowAccumulator?.active&&(this._nodes.precompile(C.SHADOW_ACCUMULATION),this._precompileAllGeometry(5)),this._shadowAccumulator?.active||e){let t=this._bindParameters.output;this._bindParameters.output=e?4:3,this._nodes.precompile(C.GAUSSIAN_SPLAT_DEPTH),this._bindParameters.output=t}(this.shadowsEnabled||this._shadowAccumulator?.active)&&this._nodes.precompile(C.SHADOWMAP),this.hasAmbientIllumination&&e&&this._nodes.precompile(C.AMBIENT_ILLUMINATION)}_renderNormals(){let e=this._normalsRequired;if(e===0)return;let{width:t,height:n}=this._framebuffer.size,r=this.fboCache.acquire(t,n,`normals`);r.acquireDepth(14),this._rctx.bindFramebuffer(r.fbo),this._rctx.clearFramebuffer(S,!0,!0),this._bindParameters.output=4,this._plugins.render(...G),this._renderGaussianSplatDepthAndNormals(r);let i=this._nodes.optional(`normals`,...T,C.VIEWSHED);return r.retain(e+i-1),this.performanceInfo.advance(L.NORMALS),r}_releaseGlobalIlluminationBuffers(){let e=this._bindParameters;e.reprojection.lastFrameDepth=o(e.reprojection.lastFrameDepth),e.reprojection.lastFrameEmission=o(e.reprojection.lastFrameEmission),e.globalIllumination=s(e.globalIllumination),e.globalIlluminationEnabled=!1}_precompileAllGeometry(e){let t=this._bindParameters.output;this._bindParameters.output=e,this._precompileOpaqueGeometry(),this._precompileTransparentGeometry(),this._plugins.precompile(...W),this._bindParameters.output=t}renderAllGeometry(e){this._bindParameters.output=e,this._renderOpaqueAndTransparentGeometry(e),this._renderTransparentGround()}precompileSlots(e,...t){for(let n of t)this._bindParameters.slot=n,e.precompile(this._renderContext)}precompileOccludedSlots(e,t){for(let n of t)this._renderContext.renderOccludedMask=n,this.precompileSlots(e,...q);this._renderContext.renderOccludedMask=M}renderSlots(e,...t){for(let n of t)this._bindParameters.slot=n,e.forAll(e=>{let t=e.acquireTechniques(this._renderContext);t&&e.render(this._renderContext,t)})}renderOccludedSlots(e,t){this._renderContext.renderOccludedMask=t,this.plugins.renderOccludedFlags>1&&this._plugins.render(9),this.renderSlots(e,...q),this._renderContext.renderOccludedMask=M}renderHUD(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(...Ae[e])}_renderHUDElements(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(16),this.renderHUD(e),this._bindParameters.hudRenderStyle=e,this._plugins.render(14)}precompileViewshedShadowMap(){let e=this._bindParameters.output;this._bindParameters.output=8,this._precompileAllGeometry(8),this._nodes.precompile(C.SHADOWMAP),this._bindParameters.output=e}precompileCutFillDepth(){this._precompilePlugins(9,Y)}_precompilePlugins(e,t){let n=this._bindParameters.output;this._bindParameters.output=e,this._plugins.precompile(...t),this._bindParameters.output=n}renderViewshedShadowMap(e,t){let{camera:n,contentCamera:r}=this._bindParameters,i=this._bindParameters.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this.renderAllGeometry(8),this._renderShadowNodes(t),this._ensureBindParametersCamera(n,r),this._bindParameters.camera.setGLViewport(this._rctx),this._bindParameters.output=i}renderCutFillDepth(e){let{camera:t,contentCamera:n}=this._bindParameters,r=this._bindParameters.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this._bindParameters.output=9,this._plugins.render(...Y),this._ensureBindParametersCamera(t,n),t.setGLViewport(this._rctx),this._bindParameters.output=r}get _needsGroundDepth(){return this._bindParameters.cutFillVisualizationEnabled}_blitGroundDepth(){if(!this._needsGroundDepth)return null;let{width:e,height:t}=this._framebuffer.size,n=this.fboCache.acquire(e,t,C.GROUND_DEPTH,14);return this._rctx.blitFramebuffer(this._framebuffer.color.fbo,n.fbo,256),this._framebuffer.bind(),n}_renderOpaqueAndTransparentGeometry(e){this._bindParameters.output=e,this._renderOpaqueGeometry(),this._renderTransparentGeometry()}_renderGeometryWithoutNormals(e){this._bindParameters.output=e,this._plugins.render(...K)}_precompileOpaqueGeometry(){this._needsOpaquePass&&(this._plugins.precompile(...H),this._nodes.precompile(`opaque-color`))}_renderOpaqueGeometry(){this._plugins.render(...H)}_renderTransparentGeometry(){this._plugins.render(...U),this._hasTransparentGeometry&&this._plugins.render(15)}_renderTransparentGround(){this._plugins.render(...W)}_precompileHUD(e){if(!this._pluginsHas.hudElements)return;let t=this._bindParameters.output,n=this._bindParameters.hudRenderStyle,r=this._bindParameters.emissions;this._bindParameters.emissions=0,this._bindParameters.hudRenderStyle=e,this._bindParameters.output=1,this._plugins.precompile(...J),this._bindParameters.output=2,this._plugins.precompile(...J),this._bindParameters.output=0,this._oitBlend.precompile(this._bindParameters,!1,1),this._hasHighlights&&(this._bindParameters.output=10,this._plugins.precompile(...J)),this._bindParameters.emissions=r,this._bindParameters.output=t,this._bindParameters.hudRenderStyle=n}_renderHUD(e,t){if(!this._pluginsHas.hudElements)return t;let n=this._renderOIT(1,e);this._rctx.bindFramebuffer(t.fbo);let r=!!t.getTexture(z);return this._compositor.compositePreMultipliedAlpha(this._bindParameters,n.getTexture(),r),n.release(),this.performanceInfo.advance(e===0?L.HUD_OCCLUDED:L.HUD),t}get _needsShadowHighlight(){return this.shadowsEnabled&&this._plugins.produces(6,2)}_renderHighlightPrepass(){if(!this._hasHighlights)return;let{fboCache:e,_rctx:t,_bindParameters:n}=this,{width:r,height:i}=this._framebuffer.size,{highlights:a}=n,o=a.length>pe?3:1,s=e.acquire(r,i,`highlights`,o);s.acquireDepth(14);let c=this._plugins.produces(10,0);return c&&this._framebuffer.color.fbo&&s.fbo&&t.blitFramebuffer(this._framebuffer.color.fbo,s.fbo,1024),t.bindFramebuffer(s.fbo),t.gl.clearBufferuiv(6144,0,[0,0,0,0]),c||t.clear(1024),this._bindParameters.output=10,t.bindFramebuffer(s.fbo),me(t,e,r,i,n,()=>this._renderHighlightGeometries()),s.detachDepth(),this.performanceInfo.advance(L.HIGHLIGHTS),s.retain(this._nodes.require(`highlights`,...E)+this._nodes.optional(`highlights`,...E)-1),s}_renderHighlightGeometries(){this._plugins.render(...Oe),this._rctx.clear(256),this._renderHUDElements(2)}_renderShadowAccumulation(e){let t=this._shadowAccumulator;if(!t)return;t.updateDepthRange(e);let n=t.requireGeometryDepth;this._bindParameters.output=0;let r=this._nodes.produce(C.SHADOW_ACCUMULATION,this._pluginInput);t.didAccumulate&&this.performanceInfo.advance(L.ACCUMULATED_SHADOWS),this._pluginInput.set(C.SHADOW_ACCUMULATION,null),r?.release(),n&&(this._bindParameters.depth=s(this._bindParameters.depth))}renderShadowAccumulationShadowMap(e,t,n,r,i){let a=this.stage.view.qualitySettings.maximumPixelRatio;n.start(e,r,i,!0,a),this._renderShadowCascades(5,n),e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,t)}_precompileTransparentGeometry(){se(this._bindParameters.output)?(this._bindParameters.output=1,this._plugins.precompile(...U),this._hasTransparentGeometry&&this._plugins.precompile(15),this._bindParameters.output=2,this._plugins.precompile(...U),this._hasTransparentGeometry&&this._plugins.precompile(15),this._bindParameters.output=0):this._plugins.precompile(...U)}_renderOIT(e,t=2){let n=e===1,{width:r,height:i}=this._framebuffer.size,a=n?()=>this._renderHUDElements(t):()=>this._renderTransparentGeometry(),s=this._bindParameters,c=s.useFloatBlend.value?8:5,l=s.output;s.output=1;let u=n?`oit hud`:`oit`,d=this.fboCache.acquire(r,i,u,c).acquireColor(z,this.hasFloatBlend?7:0,`oit alpha`),f=s.hasEmission&&(e===0||t!==1);f&&d.acquireColor(B,c,`oit emissive`),n||d.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(d.fbo),this._rctx.clearFramebuffer(A),f&&this._rctx.clearBuffer(2,A),a(),d.detachDepth(),s.output=2;let p=this.fboCache.acquire(r,i,n?`oit front hud`:`oit front`);f&&p.acquireColor(z,c,`oit front emissive`),n?p.acquireDepth(this._hudDepthFormat):p.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(p.fbo),this._rctx.clearFramebuffer(S,n),a(),p.detachDepth();let m=this._pluginsHas.occludedHudElements&&!n,h=m&&s.emissions!==0?B:z;s.hudOcclusion=o(this._bindParameters.hudOcclusion),s.output=0;let g;return n?(g=this.fboCache.acquire(r,i,`oit composite hud`),this._rctx.bindFramebuffer(g.fbo),this._rctx.setClearColor(0,0,0,1e-13),this._rctx.clear(16384)):(s.emissions!==0&&this._framebuffer.ensureEmissionAttachment(),m&&(this._framebuffer.color.acquireColor(h,0,`hud occlusion`),this._rctx.clearBuffer(h-R,S)),this._framebuffer.bind()),this._oitBlend.blend(this._rctx,d,p,s,m,e,this._fboCache.debugCallback),g?.detachDepth(),n||(f&&(this._bindParameters.emissions=3),m&&(s.hudOcclusion=this._framebuffer.color.obtainAttachment(h))),p.release(),d.release(),s.output=l,g}get _hudDepthFormat(){return this.isFeatureEnabled(7)?14:13}get _needsOpaquePass(){return this.plugins.produces(0,...H)||this.plugins.produces(5,...H)||this.plugins.produces(3,3)}_renderOpaque(){let e=this._needsOpaquePass;e&&(this._plugins.render(0,1),this._pluginInput.set(C.GROUND_DEPTH,this._blitGroundDepth()),this._plugins.render(2,3));let t=this._framebuffer;t.update(t=>this._renderNodes(w.OPAQUE,t,e)),this.fboCache.debugCallback?.(w.OPAQUE,t.color.fbo),t.update(e=>this._renderNodes(C.OPAQUE_ENVIRONMENT,e)),this.fboCache.debugCallback?.(C.OPAQUE_ENVIRONMENT,t.color.fbo),this._renderEdges(1)}_renderPreTransparent(){this._framebuffer.update(e=>this._renderNodes(C.GAUSSIAN_SPLAT,e)),this.fboCache.debugCallback?.(C.GAUSSIAN_SPLAT,this._framebuffer.color.fbo),this._framebuffer.update(e=>this._renderNodes(C.OPAQUE_OCCLUSION_QUERY,e)),this.fboCache.debugCallback?.(C.OPAQUE_OCCLUSION_QUERY,this._framebuffer.color.fbo),this._framebuffer.update(e=>this._renderNodes(C.VOXEL,e)),this.fboCache.debugCallback?.(C.VOXEL,this._framebuffer.color.fbo)}_renderTransparent(){let e=this._framebuffer;if(this._renderHiddenTransparentEdges(),this._hasTransparentGeometry&&this._renderOIT(0),e.update(e=>this._renderNodes(w.TRANSPARENT,e,this._hasTransparentGeometry)),this.fboCache.debugCallback?.(w.TRANSPARENT,e.color.fbo),this._hasTransparentGeometry||this._plugins.render(15),this._renderEdges(0),this._bindParameters.ssao=o(this._bindParameters.ssao),e.update(e=>this._renderNodes(C.TRANSPARENT_NO_DEPTH,e)),this.fboCache.debugCallback?.(C.TRANSPARENT_NO_DEPTH,e.color.fbo),this._framebuffer.bind(),this._plugins.render(8),this._bindParameters.hasEmission){let e=this._rctx.setDrawBuffers([Ee,z]);this._bindParameters.transparentWithoutDepthEmissionDimmingPass=!0,this._plugins.render(8),this._bindParameters.transparentWithoutDepthEmissionDimmingPass=!1,this._rctx.setDrawBuffers(e)}this.performanceInfo.advance(L.TRANSPARENT_MATERIAL_WITHOUT_DEPTH)}_renderNodes(e,t,n=!1){if(t.setName(e),this._pluginInput.set(e,t),!this._nodes.produces(e))return n&&this.performanceInfo.advance(e),t;let r=this._nodes.render(t,this._pluginInput,this._releaseNodeInputs);return this.performanceInfo.advance(e),this._fboCache.debugCallback?.(e,r.fbo),r}_renderInternalNodeCategory(e,t){if(!t)return;let n=t.name;try{this._renderNodes(e,t)}finally{this._pluginInput.set(e,null),t.setName(n)}}_3dGeometryRendered(){let e=this._bindParameters;this.hasReflections&&(e.depth=s(e.depth),e.reprojection.lastFrameColor=s(e.reprojection.lastFrameColor)),e.shadowMap.disposeOutput(5);let t=this._framebuffer.color.getAttachment(z)?.attachment;if(this.hasGlobalIllumination&&t){let{width:n,height:r}=this._framebuffer.size,i=e.useFloatBlend.value?8:5;e.reprojection.lastFrameEmission=this.fboCache.acquire(n,r,`emissive`,i),this._blit.blitTexture(t,e,e.reprojection.lastFrameEmission.fbo)}}_ensureBindParameters(e,t){this._ensureBindParametersCamera(e,t),this._ensureBindParametersWeatherFader(),this._ensureBindParametersScreenSpaceReflections(),this._ensureBindParametersReprojection()}_ensureBindParametersCamera(e,t){this._bindParameters.camera=e,this._bindParameters.contentCamera=t}_ensureBindParametersWeatherFader(){this.stage.viewingMode===1&&(this._bindParameters.clouds.data&&(this._bindParameters.clouds.fade(this._bindParameters.camera,this.renderContext.time,this.stage.view.qualitySettings.fadeDuration,this.stage.view.state.stationary),this.weatherFader?.cleanupCubemap()),this._bindParameters.snowCover=this.weatherFader?.snowCover??0)}_ensureBindParametersScreenSpaceReflections(){let{time:e}=this.renderContext,{screenSpaceReflections:t}=this._bindParameters;if(this.hasReflections){this._ssrEnableTime??=e;let n=this.stage.view.qualitySettings.fadeDuration;t.fadeFactor=n>0?Math.min(n,e-this._ssrEnableTime)/n:1,t.fadeFactor<1&&this._requestRender()}else this._ssrEnableTime=null}_ensureBindParametersReprojection(){if(!(this.hasReflections||this.hasGlobalIllumination)){this._reprojectionMatrix=b;return}let{reprojection:e,camera:t}=this._bindParameters,{lastFrameCamera:n}=e,r=!n.equals(t);if(r?(_(Z,t.viewMatrix),_(X,t.projectionMatrix),v(Q,Z,X),v(Q,n.viewMatrix,Q),v(Q,n.projectionMatrix,Q),this._reprojectionMatrix=Q):this._reprojectionMatrix=b,this.hasGlobalIllumination){let{viewMatrix:t}=e;r?(v($,n.viewMatrix,Z),y(t,$)):y(t,b)}}addRenderNode(e){this._nodes.add(e),this._requestRender()}removeRenderNode(e){this._nodes.remove(e),this._requestRender()}updateLighting(e,t,n,r){this._bindParameters.updateLighting(e,t,n,r),this._requestRender(1)}get usedMemory(){return{fbos:this.fboCache.usedMemory,plugins:this._plugins.usedMemory,edges:this.edgeView?.usedMemory??0,clouds:this.weatherFader?.usedMemory??0}}get test(){}};e([m({readOnly:!0})],V.prototype,`highResolutionAtmosphere`,null),e([m()],V.prototype,`_edgeView`,void 0),e([m()],V.prototype,`updating`,null),V=e([h(`esri.views.3d.webgl-engine.lib.Renderer`)],V);const H=[0,1,2,3],U=[7,6,4,5],W=[7,6],G=[0,1,2,4,...W],K=[3,5],q=[2,4,8],J=[16,12,14,13],Oe=[4,5,2,3,0,1,...W],ke=[4,8,5,11],Ae={0:[13],1:[12],2:[13,12],3:[13,12]},Y=[0,1,...W],je=[`normals`,`highlights`],X=x(),Z=x(),Q=x(),$=x();function Me(e){return t=>e.immediate.schedule(t)}export{V as Renderer};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{maxUint32 as e}from"../../../../../core/typedArrayUtil.js";import{getMaxItemCount as t,getItemsRectangle as n}from"./TextureBackedBufferUtils.js";import r from"../../../../webgl/Texture.js";import{TextureDescriptor as i}from"../../../../webgl/TextureDescriptor.js";class a{constructor(a,o,s){this.layout=o;let c=typeof s!=`number`,l=c?Math.floor(s.byteLength/o.byteStride):s;if(l>t(a,o,e))throw Error(`Cannot allocate TextureBuffer for ${l}. Exceeding hardware texture limits`);let{itemCount:u,itemWidth:d,itemHeight:f}=n(l),{texelStride:p,byteStride:m}=this.layout,h=d*p,g=f;this.itemCount=u,this.byteLength=u*m;let _=o.texelFormatInfo,v=new i(h,g);v.samplingMode=9728,v.wrapMode=33071,v.internalFormat=_.internalFormat,v.pixelFormat=_.pixelFormat,v.dataType=_.dataType,v.isImmutable=!0,v.hasMipmap=!1,this.texture=new r(a,v),c&&this.setSubData(s)}get sizeBytes(){return this.byteLength}get usedMemory(){return this.byteLength}setSubData(e,t=0,n=0,r=Math.floor((e.byteLength-n)/this.layout.byteStride)){if(r===0)return;let{layout:i,texture:a}=this,{texelStride:o,texelByteStride:s}=i,{width:c}=a.descriptor;if(t+r>this.itemCount)throw Error(`Upload range is outside of texture`);let l=t*o,u=r*o;if(u<=0)return;let d=n,f=l,p=u,m=f%c;if(m!==0){let t=new i.texelElementArrayConstructor(e,d),n=m,r=Math.floor(f/c),o=Math.min(p,c-m);a.updateData(0,n,r,o,1,t),f+=o,d+=o*s,p-=o}let h=Math.floor(p/c);if(h>0){let t=new i.texelElementArrayConstructor(e,d),n=Math.floor(f/c);a.updateData(0,0,n,c,h,t);let r=h*c;f+=r,d+=r*s,p-=r}if(p>0){let t=new i.texelElementArrayConstructor(e,d),n=f%c,r=Math.floor(f/c);a.updateData(0,n,r,p,1,t)}}dispose(){this.texture.dispose()}}export{a as TextureBuffer};
2
+ import{maxUint32 as e}from"../../../../../core/typedArrayUtil.js";import{getMaxItemCount as t,getItemsRectangle as n}from"./TextureBackedBufferUtils.js";import r from"../../../../webgl/Texture.js";import{TextureDescriptor as i}from"../../../../webgl/TextureDescriptor.js";class a{constructor(a,o,s){this.layout=o;let c=typeof s!=`number`,l=c?Math.floor(s.byteLength/o.byteStride):s;if(l>t(a,o,e))throw Error(`Cannot allocate TextureBuffer for ${l}. Exceeding hardware texture limits`);let{itemCount:u,itemWidth:d,itemHeight:f}=n(l),{texelStride:p,byteStride:m}=this.layout,h=d*p,g=f;this.itemCount=u,this.byteLength=u*m;let _=o.texelFormatInfo,v=new i(h,g);v.samplingMode=9728,v.wrapMode=33071,v.internalFormat=_.internalFormat,v.pixelFormat=_.pixelFormat,v.dataType=_.dataType,v.isImmutable=!0,v.hasMipmap=!1,this.texture=new r(a,v),c&&this.setSubData(s)}get sizeBytes(){return this.byteLength}get usedMemory(){return this.texture.usedMemory}setSubData(e,t=0,n=0,r=Math.floor((e.byteLength-n)/this.layout.byteStride)){if(r===0)return;let{layout:i,texture:a}=this,{texelStride:o,texelByteStride:s}=i,{width:c}=a.descriptor;if(t+r>this.itemCount)throw Error(`Upload range is outside of texture`);let l=t*o,u=r*o;if(u<=0)return;let d=n,f=l,p=u,m=f%c;if(m!==0){let t=new i.texelElementArrayConstructor(e,d),n=m,r=Math.floor(f/c),o=Math.min(p,c-m);a.updateData(0,n,r,o,1,t),f+=o,d+=o*s,p-=o}let h=Math.floor(p/c);if(h>0){let t=new i.texelElementArrayConstructor(e,d),n=Math.floor(f/c);a.updateData(0,0,n,c,h,t);let r=h*c;f+=r,d+=r*s,p-=r}if(p>0){let t=new i.texelElementArrayConstructor(e,d),n=f%c,r=Math.floor(f/c);a.updateData(0,n,r,p,1,t)}}dispose(){this.texture.dispose()}}export{a as TextureBuffer};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../../../core/Accessor.js";import{binaryIndexOf as n}from"../../../../../core/arrayUtils.js";import"../../../../../core/has.js";import r from"../../../../../core/Logger.js";import{clamp as i}from"../../../../../core/mathUtils.js";import{disposeMaybe as a,destroyMaybe as o}from"../../../../../core/maybe.js";import{isAbortError as s,onAbortOrThrow as c}from"../../../../../core/promiseUtils.js";import{property as l,subclass as u}from"../../../../../core/accessorSupport/decorators.js";import{fromMat4 as d,transpose as f,invert as p}from"../../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as m}from"../../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as h}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as g,copy as _,sub as ee,dot as v}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as y,clone as b}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{exactEquals as x}from"../../../../../core/libs/gl-matrix-2/math/mat4.js";import{UpdatingHandles as S}from"../../../../../core/support/UpdatingHandles.js";import{c as C}from"../../../../../chunks/vec32.js";import{TwoVectorPosition as w}from"../../core/util/TwoVectorPosition.js";import{Attribute as T}from"../Attribute.js";import{GridLocalOriginFactory as E}from"../GridLocalOriginFactory.js";import{applyToModelMatrix as D}from"../localOriginHelper.js";import{LocalOriginManager as O}from"../LocalOriginManager.js";import{Object3D as k}from"../Object3D.js";import{VertexArrayObject as te}from"../VertexArrayObject.js";import{VertexLayout as ne,glVertexLayout as re,edgeViewTextureLayout as ie,EdgeInputBufferLayout as A,RegularEdgeInstancesGLLayout as ae,SilhouetteEdgeInstancesGLLayout as oe}from"./bufferLayouts.js";import{EdgeRenderer as j,lineWidthFractionFactor as M,extensionLengthOffset as N}from"./EdgeRenderer.js";import{EdgePassParameters as P}from"./EdgeShaderParameters.js";import{EdgeWorkerHandle as F}from"./EdgeWorkerHandle.js";import{LegacyTransform as I,isLegacyTransform as L}from"./LegacyTransform.js";import{generateStrokesTexture as R}from"./strokes.js";import{determineRendererType as z,determineEdgeTransparency as B,determineObjectTransparency as V,fillComponentBufferIndices as H}from"./util.js";import{BufferManager as U}from"../TextureBackedBuffer/BufferManager.js";import{VertexBuffer as W}from"../../../../webgl/VertexBuffer.js";let G=class extends t{constructor(e){super(e),this._updatingHandles=new S,this._objectEntries=new Map,this._pendingDeletions=new Map,this._renderers=new Map,this._gpuMemoryUsage=0,this._workerAbort=new AbortController,this._tmpModelPosition=y(),this._localOrigins=new O(new E(e.renderSR));let t=ne.createBuffer(4);for(let e=0;e<4;e++)t.sideness.set(e,0,e===0||e===3?0:1),t.sideness.set(e,1,e===0||e===1?0:1);this._vertexBuffer=new W(e.rctx,re,t.buffer)}initialize(){this._workerHandle=new F(this.schedule),this._componentColorManager=new U(this.rctx,ie)}destroy(){this.destroyed||(this._objectEntries.forEach(e=>this._discardObjectEntry(e)),this._objectEntries.clear(),this._pendingDeletions.forEach(e=>this._discardObjectEntry(e)),this._pendingDeletions.clear(),this._strokesTexture=a(this._strokesTexture),this._componentColorManager=o(this._componentColorManager),this._workerAbort.abort(),this._workerHandle.destroy(),this._vertexBuffer.dispose(),this._renderers.clear(),this._updatingHandles.destroy(),this._set(`schedule`,he))}get updating(){return this._updatingHandles.updating}get usedMemory(){return this._gpuMemoryUsage}shouldRender(){return this._renderers.size>0}async addComponentObject(e,t,n,r,i,a,o){if(this.hasObject(e))return this._getObjectMemoryUsage(e);let s,c=new q(null,new Promise(e=>s=e),e.obb.getCenter(ge),e.obb.radius);this._objectEntries.set(e,c);let l=await this._updatingHandles.addPromise(this._addComponentGeometry(e.transform,c,t,n,r,i,a,o));return this.setNeedsRender(),s(),l}async addOrUpdateObject3D(e,t,n,i){if(this.destroyed){r.getLogger(this).warn(`Attempt to add an object to a destroyed instance`);return}let a=new AbortController,o,{center:c,radius:l}=e.boundingVolumeWorldSpace.sphere,u=new q(a,new Promise(e=>o=e),c,l),d=this._objectEntries.get(e);d&&(this._pendingDeletions.has(e)?this._discardObjectEntry(d):this._pendingDeletions.set(e,d)),this._objectEntries.set(e,u);try{let r=[];if(e.geometries.length>1&&se(e))r.push(this._addObjectMergedGeometries(e,u,t,n,i));else for(let a of e.geometries)a.material.supportsEdges&&r.push(this._addGeometry(e,u,a,t,n,i));await this._updatingHandles.addPromise(Promise.all(r)),this._removePendingDeletion(e)}catch(t){s(t)?this._discardObjectEntry(u):this._removePendingDeletion(e)}finally{this.setNeedsRender(),o()}}removeObject(e){let t=this._objectEntries.get(e);this._objectEntries.delete(e),this._discardObjectEntry(t),this._removePendingDeletion(e)}_removePendingDeletion(e){let t=this._pendingDeletions.get(e);this._pendingDeletions.delete(e),this._discardObjectEntry(t)}async _getObjectEntry(e){let t=this._objectEntries.get(e);if(!t)throw Error(`no object`);return await t.loaded,t.loaded==null?null:t}fastUpdateObject3DEdgesTransform(e){if(this.destroyed)return!1;let t=this._objectEntries.get(e);if(!t)return!1;let{geometries:n}=e,{renderables:r}=t;if(n.length===0||r.length===0)return!0;if(r.length>1)return!1;let[i]=r,a=i.transform;if(!(a instanceof I))return!1;let[o]=n;if(o.localOrigin!==a.origin.origin)return!1;let s=h(),c=this._computeModelTransformWithLocalOrigin(e,o,s);return i.transform=new I(s,c),this.setNeedsRender(),!0}_discardObjectEntry(e){e&&(e.abort?.abort(),e.renderables.length&&(e.renderables.forEach(e=>this._removeRenderable(e)),this.setNeedsRender()),e.loaded=null)}hasObject(e){return this._objectEntries.has(e)}async updateAllComponentOpacities(e,t){let n=await this._updatingHandles.addPromise(this._getObjectEntry(e));if(n==null)return;let r=Array.isArray(t)?e=>t[e]:()=>t;n.renderables.forEach(e=>{let{meta:t,buffer:n}=e.components,i=t.length,a=n.textureBuffer.getScalarField(`opacity`);for(let e=0;e<i;e++){let n=r(e),i=t[e],o=i.index;i.material.opacity=n,a.set(o,n)}this._updateTransparency(e)}),this.setNeedsRender()}async _getObjectMemoryUsage(e){let t=await this._getObjectEntry(e);return t?t.renderables.reduce((e,t)=>e+t.statistics.gpuMemoryUsage,0):0}async updateAllComponentMaterials(e,t,n,r){let i=e instanceof k,a=z(t),o=j.getKey(a,n,i),s=await this._updatingHandles.addPromise(this._getObjectEntry(e));s!=null&&(s.renderables.forEach(e=>{if(o!==e.rendererKey){let t=this._renderers.get(e.rendererKey),r=this._acquireRenderer(a,n,i);t.removeRenderable(e),--t.refCount,e.rendererKey=o,r.addRenderable(e)}if(Array.isArray(t))for(let n=0;n<t.length;n++)e.components.meta[n].material=t[n];else e.components.meta[0].material=t;r&&Y(e.components),this._updateTransparency(e)}),this.setNeedsRender())}async updateAllVerticalOffsets(e,t){let n=await this._updatingHandles.addPromise(this._getObjectEntry(e));n!=null&&this._updateAllVerticalOffsets(n,t)}_updateAllVerticalOffsets(e,t){e.renderables.forEach(e=>{let n=e.components.meta;for(let r=0;r<n.length;r++)e.components.meta[r].verticalOffset=t?.[r]??0;Y(e.components)}),this.setNeedsRender()}async updateObjectVisibility(e,t){let n=await this._updatingHandles.addPromise(this._getObjectEntry(e));n&&(n.renderables.forEach(e=>e.visible=t),this.setNeedsRender())}render(e,t){if(this._componentColorManager==null)return;this._localOrigins.updateViewMatrices(e.camera.viewMatrix);let n=e.camera.viewInverseTransposeMatrix,r=y(),i=new w,a=0,o=0;if(this._renderers.forEach(n=>{n.refCount===0?this._renderers.delete(n.key):(++this.techniques.precompiling,n.forEachRenderable(t=>{t.visible&&(a+=t.statistics.averageEdgeLength,o++,t.regular&&n.acquireTechnique(e,!1),t.silhouette&&n.acquireTechnique(e,!0))},t),--this.techniques.precompiling)}),this._componentColorManager.garbageCollect(),this._componentColorManager.updateTextures(),o===0)return;let s=40*a/o,c=new P(s,t);g(r,n[3],n[7],n[11]),i.set(r),_(c.transformWorldFromViewTH,i.high),_(c.transformWorldFromViewTL,i.low),d(c.transformViewFromCameraRelativeRS,e.camera.viewMatrix),f($,c.transformViewFromCameraRelativeRS),p(c.transformNormalViewFromGlobal,$),this._updateObjectCameraDistances(e),this._renderers.forEach(t=>{de(t,e,c),fe(t,e,c)})}_updateTransparency(e){let t=B(e.components.meta),n=V(e.components.meta);(t!==e.edgeTransparency||n!==e.objectTransparency)&&(e.edgeTransparency=t,e.objectTransparency=n,this._renderers.get(e.rendererKey).setRenderablesDirty())}_computeModelTransformWithLocalOrigin(e,t,n){e.getCombinedShaderTransformation(t,n);let r=t.localOrigin==null?this._localOrigins.acquire(g(this._tmpModelPosition,n[12],n[13],n[14])):this._localOrigins.register(t.localOrigin);return t.localOrigin=r.origin,D(r.origin.vec3,n),r}_createComponentBuffers(e){if(this._componentColorManager==null)return null;let t=[],n=this._componentColorManager.getBuffer(e.length),r=n.acquireIndices(e.length);for(let n=0;n<e.length;n++){let i=e[n],a=r[n];t.push({index:a,verticalOffset:0,material:i})}let i=new ce(n,t);return Y(i),i}_extractEdges(e,t,n,r,i,a,o=a.length){return o<128&&(i=!0),this._workerHandle.process({data:n,indices:a,indicesLength:o,writerSettings:t,skipDeduplicate:r},e,i)}_createRenderable(e,t,n,r,i){let a=t=>new le(new te(this.rctx,new Map([[`vertices`,this._vertexBuffer],[`instances`,t===0?new W(this.rctx,ae,e.regular.instancesData.buffer):new W(this.rctx,oe,e.silhouette.instancesData.buffer)]])),t===0?e.regular.lodInfo:e.silhouette.lodInfo),o=e.regular.lodInfo.lengths.length>0?a(0):null,s=e.silhouette.lodInfo.lengths.length>0?a(1):null,c=(o?.vao.usedMemory??0)+(s?.vao.usedMemory??0);return new J(o,s,{gpuMemoryUsage:c,externalMemoryUsage:i,averageEdgeLength:e.averageEdgeLength},n,B(t.meta),V(t.meta),t,r)}async _addGeometry(e,t,n,r,i,a){if(n.edgeIndicesLength<=0)return;let o=n.positionAttribute,s=n.primitivePositionIndices,c=s===o.indices?o:new T(o.data,s,o.size,!1,o.stride),l=h(),u=this._computeModelTransformWithLocalOrigin(e,n,l),d=new Q(c,l,u);return this._addPositionData(t,d,n.edgeIndicesLength,r,i,a)}async _addPositionData(e,t,n,r,i,a=!1){if(e.loaded==null)return;let o=this._createComponentBuffers([r]);if(o==null)return;let s=this._acquireRenderer(r.type,i,!0),{modelTransform:c,origin:l}=t,u=t.position.indices,d=t.position,f=d.data.length/d.size,p=A.createBuffer(f);for(let e=0;e<f;e++)p.position.set(e,0,d.data[e*d.size]),p.position.set(e,1,d.data[e*d.size+1]),p.position.set(e,2,d.data[e*d.size+2]);H(o.meta,[0,p.componentIndex.count],p.componentIndex);let m=await this._updatingHandles.addPromise(this._extractEdges(e.abort?.signal||this._workerAbort.signal,s.writerSettings,p,!1,a,u,n));if(e.loaded==null)return;let h=this._createRenderable(m,o,new I(c,l),s.key,!1);e.renderables.push(h),s.addRenderable(h),this._gpuMemoryUsage+=h.statistics.gpuMemoryUsage}async _addComponentGeometry(e,t,n,r,i,a,o,s){if(t.loaded==null)return 0;let c=this._createComponentBuffers(a);if(c==null)return 0;let l=z(a),u=this._acquireRenderer(l,o||!1,!1),d=A.createBuffer(n.length/3);C(d.position.typedBuffer,n,d.position.typedBufferStride,3),H(c.meta,i,d.componentIndex,r);let f=u.writerSettings,p=await this._updatingHandles.addPromise(this._extractEdges(this._workerAbort.signal,f,d,!0,!1,r));if(t.loaded==null)return 0;let m=this._createRenderable(p,c,e,u.key,!0);return t.renderables.push(m),u.addRenderable(m),this._updateAllVerticalOffsets(t,s),m.statistics.gpuMemoryUsage}async _addObjectMergedGeometries(e,t,n,r,i){let a=new Map,o=0,s=0,c=null,l=e.geometries.filter(e=>{if(e.edgeIndicesLength<=0||!e.material.supportsEdges)return!1;!c&&e.localOrigin&&(c=e);let t=e.positionAttribute;return s+=t.data.length/t.size,o+=e.edgeIndicesLength,!0});if(l.length===0)return;let u=o?new(s>=65536?Uint32Array:Uint16Array)(o):null,d=[],f=0;l.forEach(e=>{let t=e.positionAttribute,n=e.primitivePositionIndices,r=a.get(t.data);if(r==null){r=d.length/3;for(let e=0;e<t.data.length;e+=t.size)d.push(t.data[e]),d.push(t.data[e+1]),d.push(t.data[e+2]);a.set(t.data,r)}for(let t=0;t<e.edgeIndicesLength;t++)u[f++]=r+n[t]});let p=c||e.geometries[0],m=h(),g=this._computeModelTransformWithLocalOrigin(e,p,m);for(let t=0;t<e.geometries.length;t++)e.geometries[t].localOrigin=g.origin;let _=new Q(new T(d,u,3),m,g);await this._updatingHandles.addPromise(this._addPositionData(t,_,u.length,n,r,i))}_acquireRenderer(e,t,n){let r=j.getKey(e,t,n),i=this._renderers.get(r);return this._strokesTexture??=R(this.rctx),i||(i=new j(this.rctx,this.techniques,{type:e,hasSlicePlane:t,strokesTexture:this._strokesTexture,legacy:n,spherical:this.viewingMode===1}),this._renderers.set(r,i)),++i.refCount,i}_removeRenderable(e){K(e.regular),K(e.silhouette);let t=this._renderers.get(e.rendererKey);if(t){t.removeRenderable(e),--t.refCount,L(e.transform)&&this._localOrigins.release(e.transform.origin),this._gpuMemoryUsage-=e.statistics.externalMemoryUsage?0:e.statistics.gpuMemoryUsage;for(let t of e.components.meta)e.components.buffer.releaseIndex(t.index)}}_updateObjectCameraDistances(e){let t=e.camera.eye,n=e.camera.viewForward,r=y(),i=e=>{ee(r,e.center,t);let i=v(r,n),a=e.radius,o=i<-a?1/0:i<a?0:i-a;e.renderables.forEach(e=>e.distanceToCamera=o)};this._objectEntries.forEach(i),this._pendingDeletions.forEach(i)}get test(){}};e([l({constructOnly:!0})],G.prototype,`rctx`,void 0),e([l({constructOnly:!0})],G.prototype,`renderSR`,void 0),e([l({constructOnly:!0})],G.prototype,`viewingMode`,void 0),e([l({constructOnly:!0})],G.prototype,`techniques`,void 0),e([l({constructOnly:!0})],G.prototype,`setNeedsRender`,void 0),e([l({constructOnly:!0})],G.prototype,`schedule`,void 0),e([l({readOnly:!0})],G.prototype,`_updatingHandles`,void 0),e([l({readOnly:!0})],G.prototype,`updating`,null),G=e([u(`esri.views.3d.webgl-engine.lib.edgeRendering.EdgeView`)],G);function K(e){e?.vao&&(e.vao.buffer(`instances`)?.dispose(),e.vao.disposeVAOOnly(),e.vao=null)}function se(e){let t=null,n=null;for(let r of e.geometries)if(r.material.supportsEdges){if(!t)t=r.transformation;else if(!x(t,r.transformation))return!1;if(!n&&r.localOrigin!=null)n=r;else if(n?.localOrigin!=null&&r.localOrigin!=null&&n.localOrigin.id!==r.localOrigin.id)return!1}return!0}class q{constructor(e,t,n,r){this.abort=e,this.radius=r,this.renderables=[];let i=e?c(e.signal,()=>e.abort()):null;this.loaded=t,this.loaded.then(()=>{this.loaded!=null&&(this.loaded=!0),this.abort=null,i?.remove()}),this.center=b(n)}}class ce{constructor(e,t){this.buffer=e,this.meta=t}}class le{constructor(e,t){this.vao=e,this.lod=t}}class J{constructor(e,t,n,r,i,a,o,s){this.regular=e,this.silhouette=t,this.statistics=n,this.transform=r,this.edgeTransparency=i,this.objectTransparency=a,this.components=o,this.rendererKey=s,this.distanceToCamera=0,this.visible=!0}}class ue extends J{}function Y(e){let{meta:t,buffer:n}=e,r=n.textureBuffer,a=r.getVec4Field(`color`),o=r.getScalarField(`lineWidth`),s=r.getScalarField(`extensionLength`),c=r.getScalarField(`materialType`),l=r.getScalarField(`opacity`),u=r.getScalarField(`elevationOffset`);for(let e=0;e<t.length;e++){let n=t[e].material,r=t[e].index,d=i(Math.round(n.size*M),0,255),f=i(n.extensionLength,-N,255-N)+N;a.setArray(r,n.color),o.set(r,d),s.set(r,f),c.set(r,n.type),l.set(r,n.opacity),u.set(r,t[e].verticalOffset)}}function de(e,t,n){let r,i,a=n.transparency;n.strokesTexture=e.strokesTexture;let o=t.camera.screenPixelSizePerDistance;e.forEachRenderable(a=>{if(!X(a)||!a.visible)return;r??=e.acquireTechnique(t,!1),i??=e.rctx.bindTechnique(r,t,n);let s=Z(a.regular.lod.lengths,a.distanceToCamera,o);e.renderRegularEdges(i,a,n,t,s)},a)}function fe(e,t,n){let r,i,a=n.transparency;n.strokesTexture=e.strokesTexture;let o=t.camera.screenPixelSizePerDistance;e.forEachRenderable(a=>{if(!me(a)||!a.visible)return;r??=e.acquireTechnique(t,!0),i??=e.rctx.bindTechnique(r,t,n);let s=Z(a.silhouette.lod.lengths,a.distanceToCamera,o);e.renderSilhouetteEdges(i,a,n,t,s)},a)}function X(e){return e.regular!=null}class pe extends J{}function me(e){return e.silhouette!=null}function Z(e,t,r){let i=t*r,a=n(e,i,!0);return a===-1?i<e[0]?e.length:0:e.length-a}class Q{constructor(e,t,n){this.position=e,this.modelTransform=t,this.origin=n}}const he=()=>Promise.reject(),$=m(),ge=y();export{G as EdgeView,ue as RegularRenderable,J as Renderable,pe as SilhouetteRenderable};
2
+ import{__decorate as e}from"tslib";import t from"../../../../../core/Accessor.js";import{binaryIndexOf as n}from"../../../../../core/arrayUtils.js";import"../../../../../core/has.js";import r from"../../../../../core/Logger.js";import{clamp as i}from"../../../../../core/mathUtils.js";import{disposeMaybe as a,destroyMaybe as o}from"../../../../../core/maybe.js";import{estimateNumberArrayMemory as s}from"../../../../../core/memoryEstimations.js";import{isAbortError as c,onAbortOrThrow as l}from"../../../../../core/promiseUtils.js";import{property as u,subclass as d}from"../../../../../core/accessorSupport/decorators.js";import{fromMat4 as f,transpose as p,invert as m}from"../../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as h}from"../../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as g}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as _,copy as v,sub as ee,dot as y}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as b,clone as x}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{exactEquals as S}from"../../../../../core/libs/gl-matrix-2/math/mat4.js";import{UpdatingHandles as te}from"../../../../../core/support/UpdatingHandles.js";import{c as ne}from"../../../../../chunks/vec32.js";import{TwoVectorPosition as re}from"../../core/util/TwoVectorPosition.js";import{Attribute as C}from"../Attribute.js";import{GridLocalOriginFactory as w}from"../GridLocalOriginFactory.js";import{applyToModelMatrix as ie}from"../localOriginHelper.js";import{LocalOriginManager as T}from"../LocalOriginManager.js";import{Object3D as E}from"../Object3D.js";import{VertexArrayObject as D}from"../VertexArrayObject.js";import{VertexLayout as O,glVertexLayout as k,edgeViewTextureLayout as A,EdgeInputBufferLayout as j,RegularEdgeInstancesGLLayout as ae,SilhouetteEdgeInstancesGLLayout as oe}from"./bufferLayouts.js";import{EdgeRenderer as M,lineWidthFractionFactor as N,extensionLengthOffset as P}from"./EdgeRenderer.js";import{EdgePassParameters as F}from"./EdgeShaderParameters.js";import{EdgeWorkerHandle as I}from"./EdgeWorkerHandle.js";import{LegacyTransform as L,isLegacyTransform as R}from"./LegacyTransform.js";import{generateStrokesTexture as z}from"./strokes.js";import{determineRendererType as B,determineEdgeTransparency as V,determineObjectTransparency as H,fillComponentBufferIndices as U}from"./util.js";import{BufferManager as W}from"../TextureBackedBuffer/BufferManager.js";import{VertexBuffer as G}from"../../../../webgl/VertexBuffer.js";let K=class extends t{constructor(e){super(e),this._updatingHandles=new te,this._objectEntries=new Map,this._pendingDeletions=new Map,this._renderers=new Map,this._gpuMemoryUsage=0,this._cpuMemoryUsage=0,this._workerAbort=new AbortController,this._tmpModelPosition=b(),this._localOrigins=new T(new w(e.renderSR));let t=O.createBuffer(4);for(let e=0;e<4;e++)t.sideness.set(e,0,e===0||e===3?0:1),t.sideness.set(e,1,e===0||e===1?0:1);this._vertexBuffer=new G(e.rctx,k,t.buffer)}initialize(){this._workerHandle=new I(this.schedule),this._componentColorManager=new W(this.rctx,A)}destroy(){this.destroyed||(this._objectEntries.forEach(e=>this._discardObjectEntry(e)),this._objectEntries.clear(),this._pendingDeletions.forEach(e=>this._discardObjectEntry(e)),this._pendingDeletions.clear(),this._strokesTexture=a(this._strokesTexture),this._componentColorManager=o(this._componentColorManager),this._workerAbort.abort(),this._workerHandle.destroy(),this._vertexBuffer.dispose(),this._renderers.clear(),this._updatingHandles.destroy(),this._set(`schedule`,ge))}get updating(){return this._updatingHandles.updating}get usedMemory(){return this._gpuMemoryUsage+this._cpuMemoryUsage}shouldRender(){return this._renderers.size>0}async addComponentObject(e,t,n,r,i,a,o){if(this.hasObject(e))return this._getObjectMemoryUsage(e);let s,c=new J(null,new Promise(e=>s=e),e.obb.getCenter(_e),e.obb.radius);this._objectEntries.set(e,c);let l=await this._updatingHandles.addPromise(this._addComponentGeometry(e.transform,c,t,n,r,i,a,o));return this.setNeedsRender(),s(),l}async addOrUpdateObject3D(e,t,n,i){if(this.destroyed){r.getLogger(this).warn(`Attempt to add an object to a destroyed instance`);return}let a=new AbortController,o,{center:s,radius:l}=e.boundingVolumeWorldSpace.sphere,u=new J(a,new Promise(e=>o=e),s,l),d=this._objectEntries.get(e);d&&(this._pendingDeletions.has(e)?this._discardObjectEntry(d):this._pendingDeletions.set(e,d)),this._objectEntries.set(e,u);try{let r=[];if(e.geometries.length>1&&se(e))r.push(this._addObjectMergedGeometries(e,u,t,n,i));else for(let a of e.geometries)a.material.supportsEdges&&r.push(this._addGeometry(e,u,a,t,n,i));await this._updatingHandles.addPromise(Promise.all(r)),this._removePendingDeletion(e)}catch(t){c(t)?this._discardObjectEntry(u):this._removePendingDeletion(e)}finally{this.setNeedsRender(),o()}}removeObject(e){let t=this._objectEntries.get(e);this._objectEntries.delete(e),this._discardObjectEntry(t),this._removePendingDeletion(e)}_removePendingDeletion(e){let t=this._pendingDeletions.get(e);this._pendingDeletions.delete(e),this._discardObjectEntry(t)}async _getObjectEntry(e){let t=this._objectEntries.get(e);if(!t)throw Error(`no object`);return await t.loaded,t.loaded==null?null:t}fastUpdateObject3DEdgesTransform(e){if(this.destroyed)return!1;let t=this._objectEntries.get(e);if(!t)return!1;let{geometries:n}=e,{renderables:r}=t;if(n.length===0||r.length===0)return!0;if(r.length>1)return!1;let[i]=r,a=i.transform;if(!(a instanceof L))return!1;let[o]=n;if(o.localOrigin!==a.origin.origin)return!1;let s=g(),c=this._computeModelTransformWithLocalOrigin(e,o,s);return i.transform=new L(s,c),this.setNeedsRender(),!0}_discardObjectEntry(e){e&&(e.abort?.abort(),e.renderables.length&&(e.renderables.forEach(e=>this._removeRenderable(e)),this.setNeedsRender()),e.loaded=null)}hasObject(e){return this._objectEntries.has(e)}async updateAllComponentOpacities(e,t){let n=await this._updatingHandles.addPromise(this._getObjectEntry(e));if(n==null)return;let r=Array.isArray(t)?e=>t[e]:()=>t;n.renderables.forEach(e=>{let{meta:t,buffer:n}=e.components,i=t.length,a=n.textureBuffer.getScalarField(`opacity`);for(let e=0;e<i;e++){let n=r(e),i=t[e],o=i.index;i.material.opacity=n,a.set(o,n)}this._updateTransparency(e)}),this.setNeedsRender()}async _getObjectMemoryUsage(e){let t=await this._getObjectEntry(e);return t?t.renderables.reduce((e,t)=>e+t.statistics.gpuMemoryUsage,0):0}async updateAllComponentMaterials(e,t,n,r){let i=e instanceof E,a=B(t),o=M.getKey(a,n,i),s=await this._updatingHandles.addPromise(this._getObjectEntry(e));s!=null&&(s.renderables.forEach(e=>{if(o!==e.rendererKey){let t=this._renderers.get(e.rendererKey),r=this._acquireRenderer(a,n,i);t.removeRenderable(e),--t.refCount,e.rendererKey=o,r.addRenderable(e)}if(Array.isArray(t))for(let n=0;n<t.length;n++)e.components.meta[n].material=t[n];else e.components.meta[0].material=t;r&&X(e.components),this._updateTransparency(e)}),this.setNeedsRender())}async updateAllVerticalOffsets(e,t){let n=await this._updatingHandles.addPromise(this._getObjectEntry(e));n!=null&&this._updateAllVerticalOffsets(n,t)}_updateAllVerticalOffsets(e,t){e.renderables.forEach(e=>{let n=e.components.meta;for(let r=0;r<n.length;r++)e.components.meta[r].verticalOffset=t?.[r]??0;X(e.components)}),this.setNeedsRender()}async updateObjectVisibility(e,t){let n=await this._updatingHandles.addPromise(this._getObjectEntry(e));n&&(n.renderables.forEach(e=>e.visible=t),this.setNeedsRender())}render(e,t){if(this._componentColorManager==null)return;this._localOrigins.updateViewMatrices(e.camera.viewMatrix);let n=e.camera.viewInverseTransposeMatrix,r=b(),i=new re,a=0,o=0;if(this._renderers.forEach(n=>{n.refCount===0?this._renderers.delete(n.key):(++this.techniques.precompiling,n.forEachRenderable(t=>{t.visible&&(a+=t.statistics.averageEdgeLength,o++,t.regular&&n.acquireTechnique(e,!1),t.silhouette&&n.acquireTechnique(e,!0))},t),--this.techniques.precompiling)}),this._componentColorManager.garbageCollect(),this._componentColorManager.updateTextures(),o===0)return;let s=40*a/o,c=new F(s,t);_(r,n[3],n[7],n[11]),i.set(r),v(c.transformWorldFromViewTH,i.high),v(c.transformWorldFromViewTL,i.low),f(c.transformViewFromCameraRelativeRS,e.camera.viewMatrix),p($,c.transformViewFromCameraRelativeRS),m(c.transformNormalViewFromGlobal,$),this._updateObjectCameraDistances(e),this._renderers.forEach(t=>{de(t,e,c),fe(t,e,c)})}_updateTransparency(e){let t=V(e.components.meta),n=H(e.components.meta);(t!==e.edgeTransparency||n!==e.objectTransparency)&&(e.edgeTransparency=t,e.objectTransparency=n,this._renderers.get(e.rendererKey).setRenderablesDirty())}_computeModelTransformWithLocalOrigin(e,t,n){e.getCombinedShaderTransformation(t,n);let r=t.localOrigin==null?this._localOrigins.acquire(_(this._tmpModelPosition,n[12],n[13],n[14])):this._localOrigins.register(t.localOrigin);return t.localOrigin=r.origin,ie(r.origin.vec3,n),r}_createComponentBuffers(e){if(this._componentColorManager==null)return null;let t=[],n=this._componentColorManager.getBuffer(e.length),r=n.acquireIndices(e.length);for(let n=0;n<e.length;n++){let i=e[n],a=r[n];t.push({index:a,verticalOffset:0,material:i})}let i=new ce(n,t);return X(i),i}_extractEdges(e,t,n,r,i,a,o=a.length){return o<128&&(i=!0),this._workerHandle.process({data:n,indices:a,indicesLength:o,writerSettings:t,skipDeduplicate:r},e,i)}_createRenderable(e,t,n,r,i){let a=t=>new le(new D(this.rctx,new Map([[`vertices`,this._vertexBuffer],[`instances`,t===0?new G(this.rctx,ae,e.regular.instancesData.buffer):new G(this.rctx,oe,e.silhouette.instancesData.buffer)]])),t===0?e.regular.lodInfo:e.silhouette.lodInfo),o=e.regular.lodInfo.lengths.length>0?a(0):null,c=e.silhouette.lodInfo.lengths.length>0?a(1):null,l=(o?.vao.usedMemory??0)+(c?.vao.usedMemory??0),u=s(o?.lod.lengths,c?.lod.lengths);return this._cpuMemoryUsage+=u,new Y(o,c,{gpuMemoryUsage:l,cpuMemoryUsage:u,externalMemoryUsage:i,averageEdgeLength:e.averageEdgeLength},n,V(t.meta),H(t.meta),t,r)}async _addGeometry(e,t,n,r,i,a){if(n.edgeIndicesLength<=0)return;let o=n.positionAttribute,s=n.primitivePositionIndices,c=s===o.indices?o:new C(o.data,s,o.size,!1,o.stride),l=g(),u=this._computeModelTransformWithLocalOrigin(e,n,l),d=new Q(c,l,u);return this._addPositionData(t,d,n.edgeIndicesLength,r,i,a)}async _addPositionData(e,t,n,r,i,a=!1){if(e.loaded==null)return;let o=this._createComponentBuffers([r]);if(o==null)return;let s=this._acquireRenderer(r.type,i,!0),{modelTransform:c,origin:l}=t,u=t.position.indices,d=t.position,f=d.data.length/d.size,p=j.createBuffer(f);for(let e=0;e<f;e++)p.position.set(e,0,d.data[e*d.size]),p.position.set(e,1,d.data[e*d.size+1]),p.position.set(e,2,d.data[e*d.size+2]);U(o.meta,[0,p.componentIndex.count],p.componentIndex);let m=await this._updatingHandles.addPromise(this._extractEdges(e.abort?.signal||this._workerAbort.signal,s.writerSettings,p,!1,a,u,n));if(e.loaded==null)return;let h=this._createRenderable(m,o,new L(c,l),s.key,!1);e.renderables.push(h),s.addRenderable(h),this._gpuMemoryUsage+=h.statistics.gpuMemoryUsage}async _addComponentGeometry(e,t,n,r,i,a,o,s){if(t.loaded==null)return 0;let c=this._createComponentBuffers(a);if(c==null)return 0;let l=B(a),u=this._acquireRenderer(l,o||!1,!1),d=j.createBuffer(n.length/3);ne(d.position.typedBuffer,n,d.position.typedBufferStride,3),U(c.meta,i,d.componentIndex,r);let f=u.writerSettings,p=await this._updatingHandles.addPromise(this._extractEdges(this._workerAbort.signal,f,d,!0,!1,r));if(t.loaded==null)return 0;let m=this._createRenderable(p,c,e,u.key,!0);return t.renderables.push(m),u.addRenderable(m),this._updateAllVerticalOffsets(t,s),m.statistics.gpuMemoryUsage}async _addObjectMergedGeometries(e,t,n,r,i){let a=new Map,o=0,s=0,c=null,l=e.geometries.filter(e=>{if(e.edgeIndicesLength<=0||!e.material.supportsEdges)return!1;!c&&e.localOrigin&&(c=e);let t=e.positionAttribute;return s+=t.data.length/t.size,o+=e.edgeIndicesLength,!0});if(l.length===0)return;let u=o?new(s>=65536?Uint32Array:Uint16Array)(o):null,d=[],f=0;l.forEach(e=>{let t=e.positionAttribute,n=e.primitivePositionIndices,r=a.get(t.data);if(r==null){r=d.length/3;for(let e=0;e<t.data.length;e+=t.size)d.push(t.data[e]),d.push(t.data[e+1]),d.push(t.data[e+2]);a.set(t.data,r)}for(let t=0;t<e.edgeIndicesLength;t++)u[f++]=r+n[t]});let p=c||e.geometries[0],m=g(),h=this._computeModelTransformWithLocalOrigin(e,p,m);for(let t=0;t<e.geometries.length;t++)e.geometries[t].localOrigin=h.origin;let _=new Q(new C(d,u,3),m,h);await this._updatingHandles.addPromise(this._addPositionData(t,_,u.length,n,r,i))}_acquireRenderer(e,t,n){let r=M.getKey(e,t,n),i=this._renderers.get(r);return this._strokesTexture??=z(this.rctx),i||(i=new M(this.rctx,this.techniques,{type:e,hasSlicePlane:t,strokesTexture:this._strokesTexture,legacy:n,spherical:this.viewingMode===1}),this._renderers.set(r,i)),++i.refCount,i}_removeRenderable(e){this._cpuMemoryUsage-=e.statistics.cpuMemoryUsage,q(e.regular),q(e.silhouette);let t=this._renderers.get(e.rendererKey);if(t){t.removeRenderable(e),--t.refCount,R(e.transform)&&this._localOrigins.release(e.transform.origin),this._gpuMemoryUsage-=e.statistics.externalMemoryUsage?0:e.statistics.gpuMemoryUsage;for(let t of e.components.meta)e.components.buffer.releaseIndex(t.index)}}_updateObjectCameraDistances(e){let t=e.camera.eye,n=e.camera.viewForward,r=b(),i=e=>{ee(r,e.center,t);let i=y(r,n),a=e.radius,o=i<-a?1/0:i<a?0:i-a;e.renderables.forEach(e=>e.distanceToCamera=o)};this._objectEntries.forEach(i),this._pendingDeletions.forEach(i)}get test(){}};e([u({constructOnly:!0})],K.prototype,`rctx`,void 0),e([u({constructOnly:!0})],K.prototype,`renderSR`,void 0),e([u({constructOnly:!0})],K.prototype,`viewingMode`,void 0),e([u({constructOnly:!0})],K.prototype,`techniques`,void 0),e([u({constructOnly:!0})],K.prototype,`setNeedsRender`,void 0),e([u({constructOnly:!0})],K.prototype,`schedule`,void 0),e([u({readOnly:!0})],K.prototype,`_updatingHandles`,void 0),e([u({readOnly:!0})],K.prototype,`updating`,null),K=e([d(`esri.views.3d.webgl-engine.lib.edgeRendering.EdgeView`)],K);function q(e){e?.vao&&(e.vao.buffer(`instances`)?.dispose(),e.vao.disposeVAOOnly(),e.vao=null)}function se(e){let t=null,n=null;for(let r of e.geometries)if(r.material.supportsEdges){if(!t)t=r.transformation;else if(!S(t,r.transformation))return!1;if(!n&&r.localOrigin!=null)n=r;else if(n?.localOrigin!=null&&r.localOrigin!=null&&n.localOrigin.id!==r.localOrigin.id)return!1}return!0}class J{constructor(e,t,n,r){this.abort=e,this.radius=r,this.renderables=[];let i=e?l(e.signal,()=>e.abort()):null;this.loaded=t,this.loaded.then(()=>{this.loaded!=null&&(this.loaded=!0),this.abort=null,i?.remove()}),this.center=x(n)}}class ce{constructor(e,t){this.buffer=e,this.meta=t}}class le{constructor(e,t){this.vao=e,this.lod=t}}class Y{constructor(e,t,n,r,i,a,o,s){this.regular=e,this.silhouette=t,this.statistics=n,this.transform=r,this.edgeTransparency=i,this.objectTransparency=a,this.components=o,this.rendererKey=s,this.distanceToCamera=0,this.visible=!0}}class ue extends Y{}function X(e){let{meta:t,buffer:n}=e,r=n.textureBuffer,a=r.getVec4Field(`color`),o=r.getScalarField(`lineWidth`),s=r.getScalarField(`extensionLength`),c=r.getScalarField(`materialType`),l=r.getScalarField(`opacity`),u=r.getScalarField(`elevationOffset`);for(let e=0;e<t.length;e++){let n=t[e].material,r=t[e].index,d=i(Math.round(n.size*N),0,255),f=i(n.extensionLength,-P,255-P)+P;a.setArray(r,n.color),o.set(r,d),s.set(r,f),c.set(r,n.type),l.set(r,n.opacity),u.set(r,t[e].verticalOffset)}}function de(e,t,n){let r,i,a=n.transparency;n.strokesTexture=e.strokesTexture;let o=t.camera.screenPixelSizePerDistance;e.forEachRenderable(a=>{if(!pe(a)||!a.visible)return;r??=e.acquireTechnique(t,!1),i??=e.rctx.bindTechnique(r,t,n);let s=Z(a.regular.lod.lengths,a.distanceToCamera,o);e.renderRegularEdges(i,a,n,t,s)},a)}function fe(e,t,n){let r,i,a=n.transparency;n.strokesTexture=e.strokesTexture;let o=t.camera.screenPixelSizePerDistance;e.forEachRenderable(a=>{if(!he(a)||!a.visible)return;r??=e.acquireTechnique(t,!0),i??=e.rctx.bindTechnique(r,t,n);let s=Z(a.silhouette.lod.lengths,a.distanceToCamera,o);e.renderSilhouetteEdges(i,a,n,t,s)},a)}function pe(e){return e.regular!=null}class me extends Y{}function he(e){return e.silhouette!=null}function Z(e,t,r){let i=t*r,a=n(e,i,!0);return a===-1?i<e[0]?e.length:0:e.length-a}class Q{constructor(e,t,n){this.position=e,this.modelTransform=t,this.origin=n}}const ge=()=>Promise.reject(),$=h(),_e=b();export{K as EdgeView,ue as RegularRenderable,Y as Renderable,me as SilhouetteRenderable};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
+ import{baseTypedArrayMemory as e,estimateFixedArrayMemory as t}from"../../../../core/memoryEstimations.js";import{isTypedArray as n}from"../../../../core/typedArrayUtil.js";import{isSharedIndexArray as r}from"../../../../geometry/support/Indices.js";class i{constructor(){this._allocations=new Set}bufferMemory(e){return this._allocations.has(e)?0:(this._allocations.add(e),e.byteLength)}arrayMemory(i,a=8,o=!1){if(!i||this._allocations.has(i))return 0;this._allocations.add(i);let s=o&&r(i);return n(i)?e+(s?0:this.bufferMemory(i.buffer)):s?0:t(i,a)}}function a(e){let t=0,n=new i;for(let r of new Set(e))t+=r.computeBufferMemory(n);return t}export{i as GeometryMemoryContext,a as computeGeometryBufferMemory};