@arcgis/core 4.25.0-next.20220705 → 4.25.0-next.20220708

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 (336) hide show
  1. package/TimeExtent.js +1 -1
  2. package/arcade/arcadeCompiler.js +1 -1
  3. package/assets/esri/core/workers/RemoteClient.js +1 -1
  4. package/assets/esri/core/workers/chunks/0703495557b0df6878c5.js +1 -0
  5. package/assets/esri/core/workers/chunks/1570676351a313f1841b.js +1 -0
  6. package/assets/esri/core/workers/chunks/{695f90305478f5024fa7.js → 1ecbf642debc2207b762.js} +1 -1
  7. package/assets/esri/core/workers/chunks/{30dbdf2aa1bc8e61cad4.js → 268e7b46202fc1decf9f.js} +1 -1
  8. package/assets/esri/core/workers/chunks/{47d78b4f7117554acecf.js → 357a27203f5d8fa152de.js} +1 -1
  9. package/assets/esri/core/workers/chunks/35dfba25a9077ab5dbaf.js +982 -0
  10. package/assets/esri/core/workers/chunks/377354a81e402edf3077.js +1 -0
  11. package/assets/esri/core/workers/chunks/3a42d96ea3b59d33bfe8.js +1 -0
  12. package/assets/esri/core/workers/chunks/3a61e4ab83183f5526a7.js +1 -0
  13. package/assets/esri/core/workers/chunks/{3790f0362b6f27ee798b.js → 3ee5e8d00cd3bc47a9fa.js} +1 -1
  14. package/assets/esri/core/workers/chunks/425d1fabc713a598139c.js +1 -0
  15. package/assets/esri/core/workers/chunks/425e16862feccb467191.js +1 -0
  16. package/assets/esri/core/workers/chunks/{bbe51b49fe7093e47306.js → 48c8ac9a22190c2b890c.js} +1 -1
  17. package/assets/esri/core/workers/chunks/4a364bc073fdc7c1b563.js +1 -0
  18. package/assets/esri/core/workers/chunks/4ca6ada7a4ccde5b5a24.js +1 -0
  19. package/assets/esri/core/workers/chunks/{905130ff0118962c8140.js → 61b71b8e028eda10ccab.js} +1 -1
  20. package/assets/esri/core/workers/chunks/{b34cffd5c45d3a8134bc.js → 69f57ad2227e59b323e8.js} +1 -1
  21. package/assets/esri/core/workers/chunks/{290899b47a52f8b28a9c.js → 791220164501a791b2cd.js} +1 -1
  22. package/assets/esri/core/workers/chunks/792b4b0a43b4bbbc14ab.js +1 -0
  23. package/assets/esri/core/workers/chunks/7b32b8e8ebe48ae0dae2.js +1 -0
  24. package/assets/esri/core/workers/chunks/7f00125b02bb7211de43.js +1 -0
  25. package/assets/esri/core/workers/chunks/81074accfce5f109f909.js +1 -0
  26. package/assets/esri/core/workers/chunks/{594d7fdb80ad9cdedb85.js → 823e25dbc70e71257b6e.js} +1 -1
  27. package/assets/esri/core/workers/chunks/92e43e05265dfc8173a0.js +1 -0
  28. package/assets/esri/core/workers/chunks/{40fa9b28ca882a70813a.js → 92f7415c2e40e320addc.js} +1 -1
  29. package/assets/esri/core/workers/chunks/{9520b32d5d53ea9cd0d3.js → 9341e9e1fe0f6800aa44.js} +1 -1
  30. package/assets/esri/core/workers/chunks/95451d6405729a9f50c7.js +1 -0
  31. package/assets/esri/core/workers/chunks/{910a2ffb4328f8ee7a0d.js → 95cb9cd08941c28ebd85.js} +1 -1
  32. package/assets/esri/core/workers/chunks/{97f32af5893c86f6444c.js → 9b9a40b84640f00a1dcb.js} +1 -1
  33. package/assets/esri/core/workers/chunks/{77c6ba5ea85915d9078c.js → ac07c732aca6e67232f8.js} +1 -1
  34. package/assets/esri/core/workers/chunks/ae8e87da97411cff3783.js +1 -0
  35. package/assets/esri/core/workers/chunks/{65161a874595b0a34aa1.js → b312dd3027492007d75e.js} +1 -1
  36. package/assets/esri/core/workers/chunks/{83c9da68d6dbc77f60e5.js → beead2b06c994b4e61af.js} +1 -1
  37. package/assets/esri/core/workers/chunks/{5e20fd8b7c9497f2da1f.js → bfb08d3e2208c6178af9.js} +1 -1
  38. package/assets/esri/core/workers/chunks/{04e5486f0d8d4c6bd8a2.js → c3236a7058e64ea3b939.js} +1 -1
  39. package/assets/esri/core/workers/chunks/c4e9c71be6299c60c539.js +1 -0
  40. package/assets/esri/core/workers/chunks/c705f907ce60a646d9aa.js +1 -0
  41. package/assets/esri/core/workers/chunks/ce6abfafa0171b9c8d81.js +1 -0
  42. package/assets/esri/core/workers/chunks/{08a5c5a33a7c7c6852e5.js → d00b0f8236f1526099d4.js} +1 -1
  43. package/assets/esri/core/workers/chunks/d13951412a57e1af6208.js +1 -0
  44. package/assets/esri/core/workers/chunks/ecaf8f030026e41e1d1a.js +1 -0
  45. package/assets/esri/core/workers/chunks/f328a6cd4b7d8c653fc7.js +1 -0
  46. package/assets/esri/core/workers/chunks/f6a6178d4df029ff010d.js +1 -0
  47. package/assets/esri/core/workers/chunks/fde2301c6cd97a3cfb86.js +1 -0
  48. package/assets/esri/core/workers/chunks/fe84bcdfd9028b5e7ef6.js +1 -0
  49. package/assets/esri/themes/base/widgets/_BasemapLayerList.scss +4 -0
  50. package/assets/esri/themes/base/widgets/_LayerList.scss +4 -0
  51. package/assets/esri/themes/dark/main.css +1 -1
  52. package/assets/esri/themes/light/main.css +1 -1
  53. package/assets/esri/themes/light/view.css +1 -1
  54. package/chunks/CheckerBoard.glsl.js +2 -2
  55. package/chunks/ColorMaterial.glsl.js +9 -9
  56. package/chunks/ComponentShader.glsl.js +33 -33
  57. package/chunks/DefaultMaterial.glsl.js +35 -35
  58. package/chunks/HUDMaterial.glsl.js +11 -11
  59. package/chunks/ImageMaterial.glsl.js +5 -5
  60. package/chunks/LineMarker.glsl.js +17 -17
  61. package/chunks/NativeLine.glsl.js +3 -3
  62. package/chunks/Path.glsl.js +28 -28
  63. package/chunks/Pattern.glsl.js +9 -9
  64. package/chunks/PointRenderer.glsl.js +1 -1
  65. package/chunks/RealisticTree.glsl.js +4 -4
  66. package/chunks/RibbonLine.glsl.js +1 -1
  67. package/chunks/ShadedColorMaterial.glsl.js +1 -1
  68. package/chunks/SimpleAtmosphere.glsl.js +1 -1
  69. package/chunks/Terrain.glsl.js +92 -92
  70. package/chunks/WaterSurface.glsl.js +22 -22
  71. package/chunks/common.js +1 -1
  72. package/chunks/mat2.js +1 -1
  73. package/chunks/mat2d.js +1 -1
  74. package/chunks/mat3.js +1 -1
  75. package/chunks/mat4.js +1 -1
  76. package/chunks/quat.js +1 -1
  77. package/chunks/quat2.js +1 -1
  78. package/chunks/vec2.js +1 -1
  79. package/chunks/vec3.js +1 -1
  80. package/chunks/vec4.js +1 -1
  81. package/core/Message.js +1 -1
  82. package/core/accessorSupport/tracking.js +1 -1
  83. package/core/libs/gl-matrix-2/math/common.js +1 -1
  84. package/core/libs/gl-matrix-2/math/vec2.js +1 -1
  85. package/core/pbf.js +1 -1
  86. package/core/quantity.js +0 -1
  87. package/core/sql/WhereClause.js +1 -1
  88. package/core/urlUtils.js +1 -1
  89. package/geometry/support/scaleUtils.js +1 -1
  90. package/identity/IdentityForm.js +1 -1
  91. package/identity/IdentityModal.js +1 -1
  92. package/identity/OAuthCredential.js +1 -1
  93. package/interfaces.d.ts +3347 -190
  94. package/intl/date.js +1 -1
  95. package/intl/duration.js +1 -1
  96. package/intl/messages.js +1 -1
  97. package/intl/substitute.js +1 -1
  98. package/kernel.js +1 -1
  99. package/layers/ImageryTileLayer.js +1 -1
  100. package/layers/VoxelWasmPerSceneView.js +1 -1
  101. package/layers/mixins/ArcGISImageService.js +1 -1
  102. package/layers/mixins/ImageryTileMixin.js +1 -1
  103. package/layers/support/ControlPointsGeoreference.d.ts +4 -0
  104. package/layers/support/ControlPointsGeoreference.js +5 -0
  105. package/layers/support/CornersGeoreference.js +1 -1
  106. package/layers/support/ElevationSamplerData.js +5 -0
  107. package/layers/support/ElevationTile.js +1 -1
  108. package/layers/support/ExportImageServiceParameters.js +1 -1
  109. package/layers/support/MediaElementBase.js +1 -1
  110. package/layers/support/imageryRendererUtils.js +1 -1
  111. package/layers/support/rasterDatasets/TIFFRaster.js +1 -1
  112. package/package.json +1 -1
  113. package/renderers/support/RasterSymbolizer.js +1 -1
  114. package/request.js +1 -1
  115. package/rest/route/utils.js +1 -1
  116. package/rest/serviceArea.js +1 -1
  117. package/rest/support/ServiceAreaParameters.js +1 -1
  118. package/rest/support/ServiceAreaSolveResult.js +1 -1
  119. package/smartMapping/raster/renderers/classBreaks.js +1 -1
  120. package/smartMapping/raster/renderers/uniqueValue.js +1 -1
  121. package/support/apiKeyUtils.js +1 -1
  122. package/support/requestUtils.js +1 -1
  123. package/support/revision.js +1 -1
  124. package/views/2d/layers/MapNotesLayerView2D.js +1 -1
  125. package/views/2d/navigation/actions/Pinch.js +1 -1
  126. package/views/2d/tiling/TileCache.js +1 -1
  127. package/views/2d/viewpointUtils.js +1 -1
  128. package/views/3d/environment/ChapmanAtmosphereTechnique.js +1 -1
  129. package/views/3d/environment/CloudsCompositionTechnique.js +1 -1
  130. package/views/3d/environment/CloudsTechnique.js +1 -1
  131. package/views/3d/environment/EnvironmentRenderer.js +1 -1
  132. package/views/3d/environment/FogTechnique.js +1 -1
  133. package/views/3d/environment/NoiseTextureAtlasTechnique.js +1 -1
  134. package/views/3d/environment/Precipitation.js +1 -1
  135. package/views/3d/environment/PrecipitationTechnique.js +1 -1
  136. package/views/3d/environment/SimpleAtmosphereTechnique.js +1 -1
  137. package/views/3d/environment/SimpleAtmosphereTechniqueConfiguration.js +1 -1
  138. package/views/3d/environment/StarsTechnique.js +1 -1
  139. package/views/3d/externalRenderers/ExternalRendererStore.js +1 -1
  140. package/views/3d/interactive/Manipulator3D.js +1 -1
  141. package/views/3d/interactive/visualElements/LabelVisualElement.js +1 -1
  142. package/views/3d/interactive/visualElements/ParallelLineVisualElement.js +1 -1
  143. package/views/3d/layers/FeatureLayerViewBase3D.js +1 -1
  144. package/views/3d/layers/FeatureLikeLayerView3D.js +1 -1
  145. package/views/3d/layers/ImageryLayerView3D.js +1 -1
  146. package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
  147. package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
  148. package/views/3d/layers/graphics/Graphics3DFeatureProcessor.js +1 -1
  149. package/views/3d/layers/i3s/PointRenderer.js +1 -1
  150. package/views/3d/layers/support/FeatureVisibilityFilter.js +5 -0
  151. package/views/3d/layers/support/HeatmapFeatureProcessor.js +1 -1
  152. package/views/3d/state/ViewStateManager.js +1 -1
  153. package/views/3d/support/LaserlinePathData.js +1 -1
  154. package/views/3d/support/ResourceController.js +1 -1
  155. package/views/3d/terrain/BlendLayersTechnique.js +1 -1
  156. package/views/3d/terrain/ElevationData.js +1 -1
  157. package/views/3d/terrain/GeometryState.js +1 -1
  158. package/views/3d/terrain/OverlayRenderTarget.js +1 -1
  159. package/views/3d/terrain/OverlayRenderer.js +1 -1
  160. package/views/3d/terrain/PatchGeometryFactory.js +1 -1
  161. package/views/3d/terrain/PatchRenderData.js +1 -1
  162. package/views/3d/terrain/RasterColorizerTechnique.js +1 -1
  163. package/views/3d/terrain/TerrainConst.js +1 -1
  164. package/views/3d/terrain/TerrainRenderer.js +1 -1
  165. package/views/3d/terrain/TerrainSurface.js +1 -1
  166. package/views/3d/terrain/Tile.js +1 -1
  167. package/views/3d/terrain/tileUtils.js +1 -1
  168. package/views/3d/webgl-engine/collections/Component/ComponentObjectCollection.js +1 -1
  169. package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
  170. package/views/3d/webgl-engine/collections/Component/Material/ComponentTechnique.js +1 -1
  171. package/views/3d/webgl-engine/collections/Component/Material/ComponentTechniqueConfiguration.js +1 -1
  172. package/views/3d/webgl-engine/collections/Component/Material/shader/ComponentShader.glsl.js +1 -1
  173. package/views/3d/webgl-engine/core/renderPasses/RenderPass.js +1 -1
  174. package/views/3d/webgl-engine/core/renderPasses/RenderPassManager.js +1 -1
  175. package/views/3d/webgl-engine/core/shaderLibrary/ForwardLinearDepth.glsl.js +2 -2
  176. package/views/3d/webgl-engine/core/shaderLibrary/ShaderOutput.js +5 -0
  177. package/views/3d/webgl-engine/core/shaderLibrary/ShaderOutputConfiguration.js +5 -0
  178. package/views/3d/webgl-engine/core/shaderLibrary/Transform.glsl.js +4 -4
  179. package/views/3d/webgl-engine/core/shaderLibrary/attributes/InstancedDoublePrecision.glsl.js +11 -11
  180. package/views/3d/webgl-engine/core/shaderLibrary/attributes/TextureCoordinateAttribute.glsl.js +1 -1
  181. package/views/3d/webgl-engine/core/shaderLibrary/default/DefaultMaterialAuxiliaryPasses.glsl.js +55 -55
  182. package/views/3d/webgl-engine/core/shaderLibrary/output/OutputDepth.glsl.js +3 -3
  183. package/views/3d/webgl-engine/core/shaderLibrary/terrain/Terrain.glsl.js +1 -1
  184. package/views/3d/webgl-engine/core/shaderTechnique/ShaderTechnique.js +1 -1
  185. package/views/3d/webgl-engine/lib/BlendWeightsTechnique.js +1 -1
  186. package/views/3d/webgl-engine/lib/BlurTechnique.js +1 -1
  187. package/views/3d/webgl-engine/lib/Camera.js +1 -1
  188. package/views/3d/webgl-engine/lib/DrapedHeatmapRenderer.js +1 -1
  189. package/views/3d/webgl-engine/lib/EdgeDetectTechnique.js +1 -1
  190. package/views/3d/webgl-engine/lib/GLMaterialRepository.js +1 -1
  191. package/views/3d/webgl-engine/lib/GLMaterials.js +1 -1
  192. package/views/3d/webgl-engine/lib/Material.js +1 -1
  193. package/views/3d/webgl-engine/lib/OffscreenRendering.js +1 -1
  194. package/views/3d/webgl-engine/lib/OrderIndependentTransparency.js +1 -1
  195. package/views/3d/webgl-engine/lib/RenderContext.js +1 -1
  196. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  197. package/views/3d/webgl-engine/lib/RenderingContext.js +1 -1
  198. package/views/3d/webgl-engine/lib/SSAOTechnique.js +1 -1
  199. package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
  200. package/views/3d/webgl-engine/lib/ShadowMap.js +1 -1
  201. package/views/3d/webgl-engine/lib/SortedRenderGeometryRenderer.js +1 -1
  202. package/views/3d/webgl-engine/lib/TextureTechnique.js +1 -1
  203. package/views/3d/webgl-engine/lib/TransparencyPassType.js +5 -0
  204. package/views/3d/webgl-engine/lib/basicInterfaces.js +1 -1
  205. package/views/3d/webgl-engine/lib/edgeRendering/EdgeShaderTechnique.js +1 -1
  206. package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
  207. package/views/3d/webgl-engine/lib/pathGeometryUtils.js +1 -1
  208. package/views/3d/webgl-engine/materials/CheckerBoardMaterial.js +1 -1
  209. package/views/3d/webgl-engine/materials/ColorMaterial.js +1 -1
  210. package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
  211. package/views/3d/webgl-engine/materials/DefaultTechniqueConfiguration.js +1 -1
  212. package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
  213. package/views/3d/webgl-engine/materials/HeatmapDensityMaterial.js +1 -1
  214. package/views/3d/webgl-engine/materials/ImageMaterial.js +1 -1
  215. package/views/3d/webgl-engine/materials/LineCalloutMaterial.js +1 -1
  216. package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
  217. package/views/3d/webgl-engine/materials/MeasurementArrowMaterial.js +1 -1
  218. package/views/3d/webgl-engine/materials/NativeLineMaterial.js +1 -1
  219. package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
  220. package/views/3d/webgl-engine/materials/PathTechnique.js +1 -1
  221. package/views/3d/webgl-engine/materials/PatternMaterial.js +1 -1
  222. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  223. package/views/3d/webgl-engine/materials/ShadedColorMaterial.js +1 -1
  224. package/views/3d/webgl-engine/materials/SlicePlaneMaterial.js +1 -1
  225. package/views/3d/webgl-engine/materials/WaterGLMaterial.js +1 -1
  226. package/views/3d/webgl-engine/materials/WaterMaterial.js +1 -1
  227. package/views/3d/webgl-engine/materials/WaterTechnique.js +1 -1
  228. package/views/3d/webgl-engine/materials/renderers/MergedRenderer.js +1 -1
  229. package/views/3d/webgl-engine/shaders/CheckerBoard.glsl.js +1 -1
  230. package/views/3d/webgl-engine/shaders/CheckerBoardTechnique.js +1 -1
  231. package/views/3d/webgl-engine/shaders/CheckerBoardTechniqueConfiguration.js +1 -1
  232. package/views/3d/webgl-engine/shaders/ColorMaterial.glsl.js +1 -1
  233. package/views/3d/webgl-engine/shaders/ColorMaterialTechnique.js +1 -1
  234. package/views/3d/webgl-engine/shaders/ColorMaterialTechniqueConfiguration.js +1 -1
  235. package/views/3d/webgl-engine/shaders/CompositingTechnique.js +1 -1
  236. package/views/3d/webgl-engine/shaders/DefaultMaterial.glsl.js +1 -1
  237. package/views/3d/webgl-engine/shaders/DefaultMaterialTechnique.js +1 -1
  238. package/views/3d/webgl-engine/shaders/DefaultMaterialTechniqueConfiguration.js +1 -1
  239. package/views/3d/webgl-engine/shaders/HUDMaterial.glsl.js +1 -1
  240. package/views/3d/webgl-engine/shaders/HUDMaterialTechnique.js +1 -1
  241. package/views/3d/webgl-engine/shaders/HUDMaterialTechniqueConfiguration.js +1 -1
  242. package/views/3d/webgl-engine/shaders/HeatmapDensityTechnique.js +1 -1
  243. package/views/3d/webgl-engine/shaders/HeatmapTechnique.js +1 -1
  244. package/views/3d/webgl-engine/shaders/HighlightApplyTechnique.js +1 -1
  245. package/views/3d/webgl-engine/shaders/HighlightBlurTechnique.js +1 -1
  246. package/views/3d/webgl-engine/shaders/HighlightDownsampleTechnique.js +1 -1
  247. package/views/3d/webgl-engine/shaders/ImageMaterial.glsl.js +1 -1
  248. package/views/3d/webgl-engine/shaders/ImageMaterialTechnique.js +1 -1
  249. package/views/3d/webgl-engine/shaders/LaserlinePathTechnique.js +1 -1
  250. package/views/3d/webgl-engine/shaders/LaserlineTechnique.js +1 -1
  251. package/views/3d/webgl-engine/shaders/LineCalloutTechnique.js +1 -1
  252. package/views/3d/webgl-engine/shaders/LineMarker.glsl.js +1 -1
  253. package/views/3d/webgl-engine/shaders/LineMarkerTechnique.js +1 -1
  254. package/views/3d/webgl-engine/shaders/LineMarkerTechniqueConfiguration.js +1 -1
  255. package/views/3d/webgl-engine/shaders/MeasurementArrowTechnique.js +1 -1
  256. package/views/3d/webgl-engine/shaders/NativeLine.glsl.js +1 -1
  257. package/views/3d/webgl-engine/shaders/NativeLineTechnique.js +1 -1
  258. package/views/3d/webgl-engine/shaders/NativeLineTechniqueConfiguration.js +1 -1
  259. package/views/3d/webgl-engine/shaders/Path.glsl.js +1 -1
  260. package/views/3d/webgl-engine/shaders/Pattern.glsl.js +1 -1
  261. package/views/3d/webgl-engine/shaders/PatternTechnique.js +1 -1
  262. package/views/3d/webgl-engine/shaders/PointRenderer.glsl.js +1 -1
  263. package/views/3d/webgl-engine/shaders/PointRendererTechnique.js +1 -1
  264. package/views/3d/webgl-engine/shaders/PointRendererTechniqueConfiguration.js +1 -1
  265. package/views/3d/webgl-engine/shaders/RealisticTree.glsl.js +1 -1
  266. package/views/3d/webgl-engine/shaders/RibbonLine.glsl.js +1 -1
  267. package/views/3d/webgl-engine/shaders/RibbonLineTechnique.js +1 -1
  268. package/views/3d/webgl-engine/shaders/RibbonLineTechniqueConfiguration.js +1 -1
  269. package/views/3d/webgl-engine/shaders/ShadedColorMaterial.glsl.js +1 -1
  270. package/views/3d/webgl-engine/shaders/ShadedColorMaterialTechnique.js +1 -1
  271. package/views/3d/webgl-engine/shaders/ShadowCastAccumulateTechnique.js +1 -1
  272. package/views/3d/webgl-engine/shaders/ShadowCastVisualizeTechnique.js +1 -1
  273. package/views/3d/webgl-engine/shaders/ShadowHighlightTechnique.js +1 -1
  274. package/views/3d/webgl-engine/shaders/SlicePlaneMaterialTechnique.js +1 -1
  275. package/views/3d/webgl-engine/shaders/TerrainTechnique.js +1 -1
  276. package/views/3d/webgl-engine/shaders/TerrainTechniqueConfiguration.js +1 -1
  277. package/views/3d/webgl-engine/shaders/WaterSurface.glsl.js +1 -1
  278. package/views/SceneView.js +1 -1
  279. package/views/draw/support/Reshape.js +1 -1
  280. package/views/interactive/GraphicManipulator.js +1 -1
  281. package/views/interactive/SegmentLabels.js +1 -1
  282. package/views/interactive/coordinateHelper.js +1 -1
  283. package/views/interactive/editGeometry/support/editPlaneUtils.js +1 -1
  284. package/views/interactive/snapping/ParallelLineSnapper.js +1 -1
  285. package/views/interactive/snapping/RightAngleTriangleSnapper.js +1 -1
  286. package/views/interactive/snapping/SnappingConstraint.js +1 -1
  287. package/views/interactive/snapping/SnappingManager.js +1 -1
  288. package/views/interactive/snapping/candidates/ParallelLineSnappingCandidate.js +1 -1
  289. package/views/interactive/snapping/candidates/RightAngleTriangleSnappingCandidate.js +1 -1
  290. package/views/interactive/snapping/snappingUtils.js +1 -1
  291. package/views/interactive/support/viewUtils.js +1 -1
  292. package/views/layers/ImageryTileLayerView.js +1 -1
  293. package/views/support/geometry2dUtils.js +1 -1
  294. package/webscene/Slide.js +1 -1
  295. package/widgets/BasemapLayerList.js +1 -1
  296. package/widgets/ElevationProfile/support/geometryUtils.js +1 -1
  297. package/widgets/ElevationProfile.js +1 -1
  298. package/widgets/LayerList/ListItemPanel.js +1 -1
  299. package/widgets/LayerList.js +1 -1
  300. package/widgets/Widget.js +1 -1
  301. package/widgets/Zoom/ZoomConditions3D.js +1 -1
  302. package/widgets/Zoom/ZoomViewModel.js +1 -1
  303. package/widgets/Zoom.js +1 -1
  304. package/widgets/support/widgetUtils.js +1 -1
  305. package/assets/esri/core/workers/chunks/06a7f58260225f52f8e6.js +0 -1
  306. package/assets/esri/core/workers/chunks/0e00741d35cdbf48e72d.js +0 -1
  307. package/assets/esri/core/workers/chunks/1ebb29ceabc81509646c.js +0 -1
  308. package/assets/esri/core/workers/chunks/24f7a3df08c3a2d3795c.js +0 -1
  309. package/assets/esri/core/workers/chunks/39a754713a48d46618bd.js +0 -1
  310. package/assets/esri/core/workers/chunks/462163f31fa134b7b216.js +0 -1
  311. package/assets/esri/core/workers/chunks/4bfcb7350ca492767a45.js +0 -1
  312. package/assets/esri/core/workers/chunks/5470cb0c3f670957c22c.js +0 -1
  313. package/assets/esri/core/workers/chunks/6889d698a2c796ed1ce6.js +0 -1
  314. package/assets/esri/core/workers/chunks/869310ef4c98542bf9df.js +0 -1
  315. package/assets/esri/core/workers/chunks/8ebaad46e2fe8925e3b0.js +0 -1
  316. package/assets/esri/core/workers/chunks/98c519ac806cc55bc19b.js +0 -1
  317. package/assets/esri/core/workers/chunks/9d07969fbea13aa5b03c.js +0 -1
  318. package/assets/esri/core/workers/chunks/9e6ce879ec0da884b9b8.js +0 -1
  319. package/assets/esri/core/workers/chunks/abd1bd74ba571e39ab5a.js +0 -1
  320. package/assets/esri/core/workers/chunks/b26ea76e3f41b45756e0.js +0 -1
  321. package/assets/esri/core/workers/chunks/c2286d97539066c8549a.js +0 -1
  322. package/assets/esri/core/workers/chunks/c495a66978d67c7e17f3.js +0 -1
  323. package/assets/esri/core/workers/chunks/c7fa92daca3f6e91734e.js +0 -987
  324. package/assets/esri/core/workers/chunks/c9e890b4be9d01c13efe.js +0 -1
  325. package/assets/esri/core/workers/chunks/dda5ea7f8d35e257815c.js +0 -1
  326. package/assets/esri/core/workers/chunks/e153e89c8a15c2f036ef.js +0 -1
  327. package/assets/esri/core/workers/chunks/e201ffcca7321771ee20.js +0 -1
  328. package/assets/esri/core/workers/chunks/e5b5b93e707173a4c883.js +0 -1
  329. package/assets/esri/core/workers/chunks/f7d1f75b6aa3ef566d74.js +0 -1
  330. package/assets/esri/core/workers/chunks/fde9e9683335fa6c8236.js +0 -1
  331. package/core/queryUtils.js +0 -5
  332. package/views/3d/layers/graphics/Graphics3DFilterVisibility.js +0 -5
  333. package/views/3d/layers/support/HeatmapFilterVisibility.js +0 -5
  334. package/views/3d/webgl-engine/core/shaderLibrary/ShaderOutputOptions.js +0 -5
  335. package/views/3d/webgl-engine/core/shaderLibrary/util/HeaderComment.glsl.js +0 -10
  336. package/views/3d/webgl-engine/lib/RenderPass.js +0 -5
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.25/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../chunks/tslib.es6.js";import r from"../../../../core/Accessor.js";import{update as t}from"../../../../core/arrayUtils.js";import s from"../../../../core/Handles.js";import{someMap as i}from"../../../../core/MapUtils.js";import{destroyMaybe as n,disposeMaybe as a,isSome as h,isNone as d,applySome as o,unwrap as _}from"../../../../core/maybe.js";import{watch as l,syncAndInitial as c,initial as p,sync as m}from"../../../../core/reactiveUtils.js";import{Milliseconds as g}from"../../../../core/time.js";import{property as u}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as f}from"../../../../core/accessorSupport/decorators/subclass.js";import{j as T,a as R,m as A}from"../../../../chunks/mat4.js";import{I as P,c as E}from"../../../../chunks/mat4f64.js";import{a as b}from"../../../../chunks/boundedPlane.js";import{MAXIMUM_ANIMATION_LOAD as S,MINIMUM_IDLE_ANIMATION_MS as w}from"../../support/animationUtils.js";import H from"../../support/debugFlags.js";import{RenderPassManager as x}from"../core/renderPasses/RenderPassManager.js";import{HUDTransparentRenderStyle as C}from"../core/shaderLibrary/hud/HUDUniforms.js";import{TransparencyPassType as I,Decorations as M,RenderRequestType as O,StencilBits as D}from"./basicInterfaces.js";import{BoundingInfo as L}from"./BoundingInfo.js";import{ZERO as y,union as v}from"./depthRange.js";import{depthRangeFromScene as N}from"./depthRangeUtils.js";import{createEmptyDepthTexture as U}from"./glUtil3D.js";import{Highlight as j}from"./Highlight.js";import{RenderOccludedFlag as q}from"./Material.js";import{OffscreenRendering as V}from"./OffscreenRendering.js";import{RenderContext as F}from"./RenderContext.js";import{splitRenderGeometryChangeSetByMaterial as G}from"./rendererUtils.js";import{RenderPass as B}from"./RenderPass.js";import{RenderPluginManager as W}from"./RenderPluginManager.js";import{RenderSlot as k}from"./RenderSlot.js";import{ShadowAccumulator as Q}from"./ShadowAccumulator.js";import{ShadowHighlight as z}from"./ShadowHighlight.js";import{ShadowMap as X,SnapshotSlot as Y}from"./ShadowMap.js";import K from"./SliceHelper.js";import{SmaaRenderPass as J}from"./SmaaRenderPass.js";import{SSAOHelper as Z}from"./SSAOHelper.js";import{EdgeView as $}from"./edgeRendering/EdgeView.js";import{Transparency as ee}from"./edgeRendering/interfaces.js";import{MergedRenderer as re}from"../materials/renderers/MergedRenderer.js";import{AlphaMode as te}from"../shaders/CompositingTechniqueConfiguration.js";import{RendererPerformanceInfo as se,Statistics as ie}from"../statistics/RendererPerformanceInfo.js";import{ClearBufferBit as ne,PixelFormat as ae,PixelType as he}from"../../../webgl/enums.js";const de=.9;let oe=class extends r{constructor(e,r,t,i,n,a,h,d,o){super({}),this._materialRepository=e,this._shaderTechniqueRepository=t,this._rctx=i,this._compositingHelper=n,this._magnifierHelper=a,this._requestRender=h,this._stage=o,this._materialRenderers=new Map,this._needsTransparentPass=!1,this._hasHUDElements=!1,this._hasHighlights=!1,this._hasWater=!1,this._hasOverlayWater=!1,this._content=new Map,this._isRendering=!1,this._fallbackDepthStencilTexture=null,this.performanceInfo=new se,this._antialiasing=!0,this._oitEnabled=!1,this._multipassTerrain=!0,this._transparentTerrain=!1,this._hasAnimations=!1,this._animationTimestep=g(0),this._handles=new s,this._renderHiddenTransparentEdges=()=>{},this._oitUsed=!1,this._smaaPass=new J(this._rctx,t),this._oitEnabled=this._hasOITSupport,this._requestRender(),this._offscreenRendering=new V(this._rctx,this._compositingHelper),this._sliceHelper=new K,this._shadowMap=new X(this._rctx,o.viewingMode,2),this._ssaoHelper=new Z(t,this._rctx,(()=>this._requestRender())),this._highlight=new j(t,this._rctx),this._shadowHighlight=new z(this._rctx,o.viewingMode),this._shadowAccumulator=new Q(this._rctx,t,o,(e=>{const r=this.shadowsEnabled;this._shadowMap.enabled=!0,this._ensureCameraBindParameters(e.camera,e.contentCamera),this._renderPlugins.prepareRender(),this._shadowMap.enabled=r}),((e,r,t)=>{e.shadowMap.start(e.camera,r,t),this._renderShadowCascades(B.MATERIAL_DEPTH_SHADOWMAP_ALL,e.shadowMap),e.camera.setGLViewport(this._rctx),this._ensureCameraBindParameters(e.camera,e.contentCamera)}),(()=>this._requestRender())),this._renderContext=new F(this._rctx,this._offscreenRendering,this._shadowMap,this._ssaoHelper,this._sliceHelper),this._renderPlugins=new W({renderContext:this._renderContext,shaderTechniqueRepository:t,textureRep:r,materialRep:this._materialRepository,requestRender:this._requestRender,schedule:d}),this.renderPassManager=new x(this._rctx,this._shaderTechniqueRepository),this._renderPlugins.add(this.renderPassManager.slots(),this.renderPassManager),this._handles.add([l((()=>this._stage.state.camera),(()=>this._requestRender()),c),l((()=>H.EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES),(e=>{this._renderHiddenTransparentEdges=e?()=>this._renderEdges(ee.TRANSPARENT):()=>{},this._requestRender()}),p)])}get _bindParameters(){return this._renderContext.bindParameters}get hasWater(){return this._hasWater||this._hasOverlayWater}get hasWaterReflection(){return this.hasWater&&this._waterReflectionEnabled}normalizeCtorArgs(){return{}}dispose(){this._handles.destroy(),this._smaaPass.dispose(),this._materialRenderers.forEach((e=>e.dispose())),this._materialRenderers.clear(),this._edgeView=n(this._edgeView),this._offscreenRendering.dispose(),this._fallbackDepthStencilTexture=a(this._fallbackDepthStencilTexture),this._shadowMap.enabled=!1,this._shadowMap.dispose(),this._ssaoHelper.enabled=!1,this._ssaoHelper.dispose(),this._highlight.dispose(),this._shadowHighlight.dispose(),this._shadowAccumulator.dispose(),L.prune(),this._content.clear()}disposeOffscreenBuffers(){this._offscreenRendering.dispose(),this._shadowMap.dispose(),this._smaaPass.disable(),this._ssaoHelper.disposeOffscreenBuffers()}get updating(){return this._antialiasing&&this._smaaPass.updating||h(this._edgeView)&&this._edgeView.updating||this._shadowAccumulator.running||!this.isCameraFinal}ensureEdgeView(){return d(this._edgeView)&&(this._edgeView=new $({rctx:this._rctx,renderSR:this._stage.renderSR,viewingMode:this._stage.viewingMode,techniqueRepository:this._shaderTechniqueRepository,setNeedsRender:()=>this._requestRender(),schedule:e=>this._stage.resourceController.schedule(e)}),this._handles.add(l((()=>o(this._edgeView,(e=>e.updating))),(()=>this._requestRender()),m)),this._requestRender()),this._edgeView}get edgeView(){return this._edgeView}get isCameraFinal(){return T(this._bindParameters.ssr.reprojectionMatrix,P)}set _reprojectionMatrix(e){t(this._bindParameters.ssr.reprojectionMatrix,e)&&this.notifyChange("isCameraFinal")}get shadowsEnabled(){return!!this._shadowMap?.enabled}setRenderParameters(e){const{_shadowMap:r,_ssaoHelper:t,_bindParameters:s}=this;if(void 0!==e.screenSpaceReflectionsEnabled&&s.ssr.enabled!==e.screenSpaceReflectionsEnabled&&(s.ssr.enabled=e.screenSpaceReflectionsEnabled,this._requestRender()),void 0!==e.shadowMap&&r.enabled!==e.shadowMap&&(r.enabled=e.shadowMap,this._requestRender()),void 0!==e.shadowMapMaxCascades&&r.maxCascades!==e.shadowMapMaxCascades&&(r.maxCascades=e.shadowMapMaxCascades,this._requestRender()),h(e.environment)){h(e.environment.weather)&&(this._bindParameters.weather=e.environment.weather,this._bindParameters.weatherVisible=e.weatherVisible,this._renderContext.bindParameters.weather=e.environment.weather,this._renderContext.bindParameters.weatherVisible=e.weatherVisible),void 0!==e.environment.lighting.ambientOcclusionEnabled&&t.enabled!==e.environment.lighting.ambientOcclusionEnabled&&(t.enabled=e.environment.lighting.ambientOcclusionEnabled,this._requestRender()),void 0!==e.environment.lighting.waterReflectionEnabled&&this._waterReflectionEnabled!==e.environment.lighting.waterReflectionEnabled&&(this._waterReflectionEnabled=e.environment.lighting.waterReflectionEnabled,this._requestRender());const r="virtual"!==e.environment.lighting.type;s.enableFillLights!==r&&(s.enableFillLights=r,this._requestRender())}e.background&&this._offscreenRendering.background!==e.background&&(this._offscreenRendering.background=e.background,this._requestRender()),void 0!==e.antialiasingEnabled&&this._antialiasing!==e.antialiasingEnabled&&(this._antialiasing=e.antialiasingEnabled,this._requestRender()),void 0!==e.highQualityTransparency&&this._multipassTerrain!==e.highQualityTransparency&&(this._multipassTerrain=e.highQualityTransparency,this._oitEnabled=e.highQualityTransparency&&this._hasOITSupport,this._requestRender()),void 0!==e.defaultHighlightOptions&&(this._highlight.setDefaultOptions(e.defaultHighlightOptions),this._shadowHighlight.setDefaultOptions(e.defaultHighlightOptions),this._requestRender()),void 0!==e.overlays&&this._bindParameters.overlays!==e.overlays&&(this._bindParameters.overlays=e.overlays,this._requestRender()),void 0!==e.slicePlane&&this._sliceHelper.plane!==e.slicePlane&&(this._sliceHelper.plane=_(e.slicePlane),this._requestRender()),void 0!==e.transparentTerrain&&this._transparentTerrain!==e.transparentTerrain&&(this._transparentTerrain=e.transparentTerrain,this._requestRender()),void 0!==e.hasOverlayWater&&this._hasOverlayWater!==e.hasOverlayWater&&(this._hasOverlayWater=e.hasOverlayWater,this._requestRender()),void 0!==e.shadowCastOptions&&this._shadowAccumulator.setOptions(e.shadowCastOptions)}get hasSlicePlane(){return!!this._sliceHelper.plane}get renderPlugins(){return this._renderPlugins}get _hasOITSupport(){return this._rctx.driverTest.floatBufferBlendWorking}modify(e){this._isRendering&&console.warn("Renderer.modify called while rendering");const{adds:r,removes:t,updates:s}=e;if(0===r.length&&0===t.length&&0===s.length)return;t.forAll((({id:e})=>this._content.delete(e))),r.forAll((e=>this._content.set(e.id,e)));const n=G(e);let a=!1;n.forEach(((e,r)=>{let t=this._materialRenderers.get(r);if(!t){if(!(e.adds.length>0))return;t=new re(this._rctx,this._materialRepository,r),this._materialRenderers.set(r,t)}t.modify(e),t.isEmpty&&(a=!0)})),a&&this._materialRenderers.forEach(((e,r)=>{e.isEmpty&&(this._materialRenderers.delete(r),e.dispose())})),this._hasHighlights=i(this._materialRenderers,(e=>e.hasHighlights)),this._bindParameters.hasOccludees=i(this._materialRenderers,(e=>e.hasOccludees)),this._hasWater=i(this._materialRenderers,(e=>e.hasWater)),this._needsTransparentPass=i(this._materialRenderers,(e=>e.requiresSlot(k.TRANSPARENT_MATERIAL,B.MATERIAL))),this._hasHUDElements=i(this._materialRenderers,(e=>e.requiresSlot(k.LINE_CALLOUTS_HUD_DEPTH,B.MATERIAL)||e.requiresSlot(k.HUD_MATERIAL,B.MATERIAL)||e.requiresSlot(k.LABEL_MATERIAL,B.MATERIAL))),this._requestRender()}updateAnimation(e){return this._hasAnimations=!1,this._materialRenderers.forEach((r=>this._hasAnimations=r.updateAnimation(e)||this._hasAnimations)),this._hasAnimations=this._renderPlugins.updateAnimation(e)||this._hasAnimations,this._hasAnimations}get animationTimestep(){return this._animationTimestep}updateLightSources(e,r,t){this._bindParameters.lighting.groundLightingFactor=r,this._bindParameters.lighting.globalFactor=t,this._bindParameters.lighting.set(e)}render(e,r,t,s){this._isRendering=!0,this.performanceInfo.prerender(this._rctx),this._bindParameters.transparencyPassType=I.NONE;const i=this._offscreenRendering;i.needLastFrameColorTexture=this.hasWaterReflection,i.advanceCurrentRenderTarget();const n=b(this._sliceHelper.plane);s===M.OFF&&(this._sliceHelper.plane=null),this._rctx.bindFramebuffer(e),r.setGLViewport(this._rctx),this._ensureCameraBindParameters(r,t),this._renderPlugins.prepareRender(),this.performanceInfo.advance(ie.Prepare);const a=this._computeDepthRange(r);this._renderShadowMap(e,r,this._bindParameters.lighting.lightingMainDirection,a),this.performanceInfo.advance(ie.Shadowmap),i.initializeFrame(r),this._ensureBindParameters(r,t),this._renderLinearDepth(),this.performanceInfo.advance(ie.Lineardepth),this._accumulateShadows(a,r,t),this._renderNormal(),this.performanceInfo.advance(ie.Normals),this._ensureBindParametersSSR(),this._ssaoHelper.computeSSAO(this._bindParameters,i.linearDepthTexture,i.normalTexture),this.performanceInfo.advance(ie.SSAO),this._renderContext.pass=B.MATERIAL,i.bindFramebuffer(),this._renderOpaqueGeometry(),this.performanceInfo.advance(ie.Opaque);const o=this._multipassTerrain&&this._transparentTerrain;this._renderTerrainLinearDepth(o),this._setMultipassEnabled(o),this._setTerrainCulling(o),this._renderEdges(ee.OPAQUE),this.performanceInfo.advance(ie.OpaqueEdges),this._offscreenRendering.bindTarget(this._offscreenRendering.currentColorTarget,this._offscreenRendering.mainDepth),this._renderSlot(k.VOXEL),this._renderHiddenTransparentEdges();const _=this._needsTransparentPass||this._renderPlugins.needsTransparentPass;_&&(this._oitEnabled?this._renderOrderIndependentTransparency((()=>this._renderTransparentGeometry()),!1):this._renderTransparentGeometry()),this.performanceInfo.advance(ie.Transparent),this._renderGeometryLinearDepth(o);const l=this._renderHUDVisibility();o||this._renderInternalSlot(k.LINE_CALLOUTS),this.performanceInfo.advance(ie.Hudvisibility),this._renderEdges(ee.TRANSPARENT,o),this.performanceInfo.advance(ie.TransparentEdges),this._renderTransparentTerrain(),this._transparentTerrain&&l&&(o?this._renderLineCallouts(C.Occluded):i.compositeTransparentTerrainOntoHUDVisibility(this._bindParameters),this._renderHUD(C.Occluded,i.framebuffer),this.performanceInfo.advance(ie.HudOccluded)),this.performanceInfo.advance(ie.TransparentTerrain),this._setTerrainCulling(!1),this._transparentTerrain&&(i.compositeTransparentTerrainOntoMain(this._bindParameters),o&&(this._renderEdges(ee.OPAQUE),this.performanceInfo.advance(ie.OpaqueEdges),_&&(this._oitEnabled?this._renderOrderIndependentTransparency((()=>this._renderTransparentGeometry()),!1):this._renderTransparentGeometry()),this.performanceInfo.advance(ie.Transparent),this._renderEdges(ee.TRANSPARENT),this.performanceInfo.advance(ie.TransparentEdges))),o&&this._renderLineCallouts(C.NotOccluded),this._setMultipassEnabled(!1),this._shadowAccumulator.render(this._bindParameters),i.renderToTargets((()=>{this._renderInternalSlot(k.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL),this._renderSlot(k.POSTPROCESSING_ENVIRONMENT_TRANSPARENT),this._renderSlot(k.LASERLINES)}),i.currentColorTarget,i.mainDepth),this.performanceInfo.advance(ie.Atmosphere),this._renderPlugins.needsLaserlineWithContrastControl&&i.renderTmpAndCompositeToMain((()=>this._renderSlot(k.LASERLINES_CONTRAST_CONTROL)),this._bindParameters,te.PremultipliedAlpha),this.performanceInfo.advance(ie.Laserline),this._renderOccluded(),this.performanceInfo.advance(ie.Occluded);const c=s===M.ON&&this._magnifierHelper.enabled,p=c&&d(e)?this._offscreenRendering.getFramebuffer(this._offscreenRendering.tmpColor,this._offscreenRendering.tmpDepth):e;this._rctx.bindFramebuffer(p);const m=this._offscreenRendering.colorTexture;!this._renderAntiAliasing(m)&&h(m)&&this._compositingHelper.composite(this._bindParameters,m,te.None),this.performanceInfo.advance(ie.Antialiasing),this._renderHUD(C.NotOccluded,p),this.performanceInfo.advance(ie.HudNotoccluded),this._renderHighlights(p,this._bindParameters),this.performanceInfo.advance(ie.Highlights),c&&this._magnifierHelper.render(this._rctx,this._bindParameters),p!==e&&(this._rctx.bindFramebuffer(e),this._compositingHelper.composite(this._bindParameters,this._offscreenRendering.tmpColorTexture,te.None)),this._disposeOITBuffers(),this._renderContext.lastFrameCamera.copyFrom(this._bindParameters.camera),this._sliceHelper.plane=n,this._isRendering=!1,this.onPostRender&&this.onPostRender(),this.performanceInfo.postrender()}finish(e){if(this._hasAnimations||(this._animationTimestep=g(0)),e===O.BACKGROUND){this._rctx.gl.getError();const e=this.performanceInfo.elapsedTime/S;this._animationTimestep=g(Math.max(this._animationTimestep*de+e*(1-de),w))}}readDepthPixels(e,r,t){const s=this._offscreenRendering.bindTarget(this._offscreenRendering.linearDepth,this._offscreenRendering.tmpDepth);if(!this._needsLinearDepth){this._ensureBindParameters(e,e),this._bindParameters.camera.setGLViewport(this._rctx),this._rctx.setClearColor(0,0,0,0);const r=ne.COLOR_BUFFER_BIT|ne.DEPTH_BUFFER_BIT|ne.STENCIL_BUFFER_BIT;this._rctx.clearSafe(r),this._renderGeometryAndTransparentTerrainPass(B.MATERIAL_DEPTH)}s.readPixels(r[0],r[1],r[2],r[3],ae.RGBA,he.UNSIGNED_BYTE,t)}readHUDVisibility(e,r,t,s,i){this._offscreenRendering.bindTarget(this._offscreenRendering.hudVisibility).readPixels(e,r,t,s,ae.RGBA,he.UNSIGNED_BYTE,i)}readAccumulatedShadow(e,r){return this._shadowAccumulator.readAccumulatedShadow(e,r)}_setMultipassEnabled(e){this._bindParameters.multipassTerrain.enabled=this._bindParameters.multipassGeometry.enabled=e}_setTerrainCulling(e){this._bindParameters.multipassTerrain.cullAboveGround=e}_renderSlot(e){this._bindParameters.slot=e,this._renderPlugins.render()}_renderEdges(e,r=!1){const t=this._edgeView;h(t)&&t.shouldRender()&&this._offscreenRendering.renderTmpAndCompositeToMain((()=>t.render(this._bindParameters,e)),this._bindParameters,te.Alpha,r)}_renderShadowMap(e,r,t,s){const i=this._shadowMap;i.enabled&&(i.start(r,t,s),this._shadowHighlight.updateParameters(r,t),this._needsShadowHighlight?(this._renderShadowCascades(B.MATERIAL_DEPTH_SHADOWMAP_HIGHLIGHT,this._shadowMap,(e=>i.takeCascadeSnapshotTo(e,Y.Highlight))),i.clear(),this._renderShadowCascades(B.MATERIAL_DEPTH_SHADOWMAP_DEFAULT,this._shadowMap,(e=>{i.takeCascadeSnapshotTo(e,Y.Default),this._renderGeometryAndTransparentTerrainPass(B.MATERIAL_DEPTH_SHADOWMAP_HIGHLIGHT)}))):this._renderShadowCascades(B.MATERIAL_DEPTH_SHADOWMAP_ALL),i.finish(e),r.setGLViewport(this._rctx))}_renderShadowCascades(e,r=this._shadowMap,t=(e=>{})){for(const s of r.getCascades())s.camera.setGLViewport(this._rctx),this._ensureCameraBindParameters(s.camera,s.camera),this._renderGeometryAndTransparentTerrainPass(e),t(s)}get _needsLinearDepth(){return this._ssaoHelper.enabled||this._renderPlugins.needsLinearDepth||this._hasWater&&this._waterReflectionEnabled||this._needsShadowHighlight||this._needsShadowCast}_renderLinearDepth(){this._needsLinearDepth?this._offscreenRendering.renderToTargets((()=>this._renderGeometryAndTransparentTerrainPass(B.MATERIAL_DEPTH)),this._offscreenRendering.linearDepth,this._offscreenRendering.tmpDepth,[0,0,0,0],!0,!0):this._offscreenRendering.disposeTarget(this._offscreenRendering.linearDepth),this._bindParameters.linearDepthTexture=this._offscreenRendering.linearDepthTexture}_renderTerrainLinearDepth(e){if(e){const e=this._renderContext.pass;this._renderContext.pass=B.MATERIAL_DEPTH,this._offscreenRendering.renderToTargets((()=>this._renderTransparentTerrain()),this._offscreenRendering.terrainLinearDepth,this._offscreenRendering.tmpDepth,[-1e10,-1e10,-1e10,1],!0,!0),this._renderContext.pass=e}else this._offscreenRendering.disposeTarget(this._offscreenRendering.terrainLinearDepth);this._bindParameters.multipassTerrain.linearDepthTexture=this._offscreenRendering.terrainLinearDepthTexture}_renderGeometryLinearDepth(e){if(e){const e=this._renderContext.pass;this._offscreenRendering.renderToTargets((()=>this._renderGeometryPass(B.MATERIAL_DEPTH)),this._offscreenRendering.geometryLinearDepth,this._offscreenRendering.tmpDepth,[1,1,1,1],!0,!0),this._renderContext.pass=e}else this._offscreenRendering.disposeTarget(this._offscreenRendering.geometryLinearDepth);this._bindParameters.multipassGeometry.linearDepthTexture=this._offscreenRendering.geometryLinearDepthTexture}get _needsNormal(){return this._ssaoHelper.enabled}_renderNormal(){this._needsNormal?this._offscreenRendering.renderToTargets((()=>{this._renderGeometryAndTransparentTerrainPass(B.MATERIAL_NORMAL)}),this._offscreenRendering.normal,this._offscreenRendering.tmpDepth,[0,0,0,0],!0,!0):this._offscreenRendering.disposeTarget(this._offscreenRendering.normal)}get _needsDepthRange(){return this._shadowMap.enabled||this._needsShadowCast}_computeDepthRange(e){if(!this._needsDepthRange)return y;const r=N(e,this._content,this._stage.layers);return v(r,this.renderPlugins.queryDepthRange(e)),r.near=Math.max(e.near,r.near),r.far=Math.min(e.far,r.far),r}_renderGeometryAndTransparentTerrainPass(e){this._renderContext.pass=e,this._renderGeometryPass(e),this._renderTransparentTerrain()}_renderGeometryPass(e){this._renderContext.pass=e,this._renderOpaqueGeometry(),this._renderTransparentGeometry()}_renderOpaqueGeometry(){this._renderSlot(k.INTEGRATED_MESH),this._renderSlot(k.OPAQUE_TERRAIN),this._renderInternalSlot(k.OPAQUE_MATERIAL),this._renderSlot(k.OPAQUE_MATERIAL),this._renderSlot(k.POSTPROCESSING_ENVIRONMENT_OPAQUE)}_renderTransparentGeometry(){this._renderInternalSlot(k.TRANSPARENT_MATERIAL),this._renderSlot(k.TRANSPARENT_MATERIAL)}_renderTransparentTerrain(){this._renderSlot(k.TRANSPARENT_TERRAIN)}_renderHUDVisibility(){let e=!1;return this._renderContext.offscreenRenderingHelper&&this._renderContext.offscreenRenderingHelper.renderHUDVisibility((()=>{this._bindParameters.hudVisibilityTexture=this._renderContext.offscreenRenderingHelper.hudVisibilityTexture,e=this._renderInternalSlot(k.OCCLUSION_PIXELS)}),this._multipassTerrain&&this._transparentTerrain),e}_renderLineCallouts(e){this._bindParameters.renderTransparentlyOccludedHUD=e,e===C.Occluded?this._offscreenRendering.renderToTargets((()=>this._renderInternalSlot(k.LINE_CALLOUTS)),this._offscreenRendering.currentColorTarget,this._offscreenRendering.tmpDepth,void 0,!0,!0):this._renderInternalSlot(k.LINE_CALLOUTS)}_renderHUD(e,r){this._hasHUDElements&&(this._oitEnabled?(this._renderOrderIndependentTransparency((()=>this._renderHUDElements(e)),!0),this._rctx.bindFramebuffer(r),this._compositingHelper.composite(this._bindParameters,this._offscreenRendering.hudColorTexture,te.PremultipliedAlpha)):e===C.Occluded?this._offscreenRendering.renderToTargets((()=>this._renderHUDElements(C.Occluded)),this._offscreenRendering.currentColorTarget,this._offscreenRendering.tmpDepth,void 0,!0,!0):this._renderHUDElements(e))}_renderHUDElements(e){this._bindParameters.renderTransparentlyOccludedHUD=e,this._renderInternalSlot(k.LINE_CALLOUTS_HUD_DEPTH),this._renderInternalSlot(k.HUD_MATERIAL),this._renderInternalSlot(k.LABEL_MATERIAL)}get _needsHighlight(){return this._hasHighlights||this._renderPlugins.needsHighlight}get _needsShadowHighlight(){return this._shadowMap.enabled&&this._shadowHighlight.isVisible&&this._needsHighlight}_renderHighlights(e,r){if(!this._needsHighlight)return void this._offscreenRendering.disposeTarget(this._offscreenRendering.highlight);const t=this._highlight,s=this._offscreenRendering.renderToTargets((()=>{this._renderGeometryAndTransparentTerrainPass(B.MATERIAL_HIGHLIGHT),this._rctx.clearSafe(ne.DEPTH_BUFFER_BIT),this._renderHUDElements(C.Both)}),this._offscreenRendering.highlight,this._offscreenRendering.tmpDepth,[0,0,0,0],!0,!0);this._bindParameters.highlightColorTexture=s.colorTexture,this._needsShadowHighlight&&this._shadowHighlight.render(r,e),t.render(this._bindParameters,s,e)}get _needsShadowCast(){return this._shadowAccumulator.isAccumulating}_accumulateShadows(e,r,t){this._needsShadowCast&&this._shadowAccumulator.renderAccumulation(this._offscreenRendering.linearDepthTexture,e,r,t)}_renderOrderIndependentTransparency(e,r){const t=t=>{this._bindParameters.transparencyPassType=t,this._offscreenRendering.renderOITPass((()=>e()),t,r)},s=this._renderContext.pass;this._renderContext.pass=B.MATERIAL_ALPHA,t(I.Alpha),this._renderContext.pass=B.MATERIAL,t(I.Color),t(I.FrontFace),this._offscreenRendering.compositeTransparentOntoOpaque(this._bindParameters,r),this._bindParameters.transparencyPassType=I.NONE,this._renderContext.pass=s,this._oitUsed=!0}_disposeOITBuffers(){this._oitUsed||(this._offscreenRendering.disposeTarget(this._offscreenRendering.alphaFloatTarget),this._offscreenRendering.disposeTarget(this._offscreenRendering.colorFloatTarget),this._offscreenRendering.disposeTarget(this._offscreenRendering.frontFaceTarget)),this._oitUsed=!1}_renderOccluded(){let e=0;this._materialRenderers.forEach(((r,t)=>{t&&t.isVisible()&&t.renderOccluded===q.OccludeAndTransparentStencil&&(e|=t.renderOccluded,ce.push(t))}));const r=this._offscreenRendering,t=(t,s,i,n,a)=>{0!=(e&s)&&(r.renderToTargets(i,r.tmpColor,r.mainDepth,[0,0,0,0],n,a),r.compositeOccludedOntoMain(this._bindParameters,t))};0!==ce.length&&(this._renderInternalSlot(k.OCCLUDER_MATERIAL,ce),t(.5,q.OccludeAndTransparentStencil,(()=>this._renderInternalSlot(k.TRANSPARENT_OCCLUDER_MATERIAL,ce)),!1,!1),ce.length=0),this._materialRenderers.forEach(((r,t)=>{t&&t.isVisible()&&(t.renderOccluded===q.OccludeAndTransparent||t.renderOccluded===q.Transparent||t.renderOccluded===q.Opaque)&&(e|=t.renderOccluded,le.push(t))}));const s=this._renderPlugins.renderOccludedFlags;if(e|=s,!e)return;const i=e=>{this._renderContext.renderOccludedMask=e,s>q.Occlude&&this._renderSlot(k.OCCLUDED_TERRAIN),this._renderInternalSlot(k.OPAQUE_MATERIAL,le),this._renderInternalSlot(k.TRANSPARENT_MATERIAL,le),this._renderInternalSlot(k.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL,le),this._renderContext.resetRenderOccludedMask()};this._renderContext.pass=B.MATERIAL,t(.5,q.OccludeAndTransparent,(()=>i(q.OccludeAndTransparent)),!0,D.OutlineVisualElementMask),t(.5,q.Transparent,(()=>i(q.Transparent)),!0,D.OutlineVisualElementMask),t(1,q.Opaque,(()=>i(q.Opaque)),!0,D.OutlineVisualElementMask),le.length=0}_renderAntiAliasing(e){if(this._antialiasing){if(this._smaaPass.enable((()=>this._requestRender()))&&h(e))return this._smaaPass.render(e),!0}else this._smaaPass.disable();return!1}_ensureCameraBindParameters(e,r){this._bindParameters.camera=e,this._bindParameters.contentCamera=r}_ensureBindParameters(e,r){this._ensureCameraBindParameters(e,r);const t=this._renderContext.offscreenRenderingHelper;this._bindParameters.hudVisibilityTexture=t.hudVisibilityTexture,this._bindParameters.mainColorTexture=t.mainColorTexture,this._bindParameters.highlightDepthTexture=t.depthTexture??this._getFallbackDepthTexture()}_ensureBindParametersSSR(){this.hasWaterReflection?(this._renderContext.lastFrameCamera.equals(this._bindParameters.camera)?this._reprojectionMatrix=P:(R(me,this._bindParameters.camera.viewMatrix),R(pe,this._bindParameters.camera.projectionMatrix),A(ge,me,pe),A(ge,this._renderContext.lastFrameCamera.viewMatrix,ge),A(ge,this._renderContext.lastFrameCamera.projectionMatrix,ge),this._reprojectionMatrix=ge),this._bindParameters.ssr.lastFrameColorTexture=this._offscreenRendering.lastFrameColorTexture):this._bindParameters.ssr.lastFrameColorTexture=null,this._bindParameters.ssr.enabled=this.hasWaterReflection}_renderInternalSlot(e,r){let t=!1;return this._bindParameters.slot=e,h(r)?r.forEach((e=>{if(!e.shouldRender(this._renderContext))return;const r=this._materialRenderers.get(e);h(r)&&(t=r.render(this._renderContext.pass,this._bindParameters)||t)})):this._materialRenderers.forEach(((e,r)=>{r.shouldRender(this._renderContext)&&e.render(this._renderContext.pass,this._bindParameters)&&(t=!0)})),t}_getFallbackDepthTexture(){return this._fallbackDepthStencilTexture||(this._fallbackDepthStencilTexture=U(this._rctx)),this._fallbackDepthStencilTexture}get gpuMemoryUsage(){return{offscreen:this._offscreenRendering?.gpuMemoryUsage??0,highlights:(this._highlight?.gpuMemoryUsage??0)+(this._shadowHighlight?.gpuMemoryUsage??0),shadows:this._shadowMap?.gpuMemoryUsage??0,ssao:this._ssaoHelper?.gpuMemoryUsage??0}}get test(){const e=this;return{offscreen:this._offscreenRendering,shadowMap:this._shadowMap,ssao:this._ssaoHelper,highlight:this._highlight,lighting:this._bindParameters.lighting,materialRenderers:this._materialRenderers,shadowAccumulator:this._shadowAccumulator,getFramebufferTexture:r=>{switch(r){case _e.Color:return e._offscreenRendering.colorTexture;case _e.LinearDepth:return e._offscreenRendering.linearDepthTexture;case _e.Normals:return e._offscreenRendering.normalTexture;case _e.ShadowMap:return e._shadowMap.depthTexture;case _e.HudVisibility:return e._offscreenRendering.hudVisibilityTexture;case _e.Highlight:return e._offscreenRendering.highlightTexture}}}}};var _e;e([u()],oe.prototype,"_shadowAccumulator",void 0),e([u()],oe.prototype,"_smaaPass",void 0),e([u()],oe.prototype,"_antialiasing",void 0),e([u()],oe.prototype,"_edgeView",void 0),e([u()],oe.prototype,"updating",null),e([u()],oe.prototype,"isCameraFinal",null),oe=e([f("esri.views.3d.webgl-engine.lib.Renderer")],oe),function(e){e[e.Color=0]="Color",e[e.LinearDepth=1]="LinearDepth",e[e.Normals=2]="Normals",e[e.ShadowMap=3]="ShadowMap",e[e.HudVisibility=4]="HudVisibility",e[e.Highlight=5]="Highlight"}(_e||(_e={}));const le=[],ce=[],pe=E(),me=E(),ge=E();export{_e as FramebufferId,oe as Renderer};
5
+ import{_ as e}from"../../../../chunks/tslib.es6.js";import r from"../../../../core/Accessor.js";import{update as t}from"../../../../core/arrayUtils.js";import s from"../../../../core/Handles.js";import{someMap as i}from"../../../../core/MapUtils.js";import{destroyMaybe as n,disposeMaybe as a,isSome as h,isNone as o,applySome as d,unwrap as _}from"../../../../core/maybe.js";import{watch as l,syncAndInitial as c,initial as p,sync as m}from"../../../../core/reactiveUtils.js";import{Milliseconds as g}from"../../../../core/time.js";import{property as u}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as f}from"../../../../core/accessorSupport/decorators/subclass.js";import{j as T,a as R,m as b}from"../../../../chunks/mat4.js";import{I as P,c as E}from"../../../../chunks/mat4f64.js";import{a as w}from"../../../../chunks/boundedPlane.js";import{MAXIMUM_ANIMATION_LOAD as A,MINIMUM_IDLE_ANIMATION_MS as S}from"../../support/animationUtils.js";import C from"../../support/debugFlags.js";import{RenderPassManager as x}from"../core/renderPasses/RenderPassManager.js";import{ShaderOutput as O}from"../core/shaderLibrary/ShaderOutput.js";import{HUDTransparentRenderStyle as y}from"../core/shaderLibrary/hud/HUDUniforms.js";import{Decorations as D,RenderRequestType as H,StencilBits as I}from"./basicInterfaces.js";import{BoundingInfo as M}from"./BoundingInfo.js";import{ZERO as L,union as v}from"./depthRange.js";import{depthRangeFromScene as N}from"./depthRangeUtils.js";import{createEmptyDepthTexture as U}from"./glUtil3D.js";import{Highlight as j}from"./Highlight.js";import{RenderOccludedFlag as q}from"./Material.js";import{OffscreenRendering as V}from"./OffscreenRendering.js";import{RenderContext as F}from"./RenderContext.js";import{splitRenderGeometryChangeSetByMaterial as G}from"./rendererUtils.js";import{RenderPluginManager as B}from"./RenderPluginManager.js";import{RenderSlot as k}from"./RenderSlot.js";import{ShadowAccumulator as W}from"./ShadowAccumulator.js";import{ShadowHighlight as Q}from"./ShadowHighlight.js";import{ShadowMap as z,SnapshotSlot as X}from"./ShadowMap.js";import Y from"./SliceHelper.js";import{SmaaRenderPass as K}from"./SmaaRenderPass.js";import{SSAOHelper as J}from"./SSAOHelper.js";import{TransparencyPassType as Z}from"./TransparencyPassType.js";import{EdgeView as $}from"./edgeRendering/EdgeView.js";import{Transparency as ee}from"./edgeRendering/interfaces.js";import{MergedRenderer as re}from"../materials/renderers/MergedRenderer.js";import{AlphaMode as te}from"../shaders/CompositingTechniqueConfiguration.js";import{RendererPerformanceInfo as se,Statistics as ie}from"../statistics/RendererPerformanceInfo.js";import{ClearBufferBit as ne,PixelFormat as ae,PixelType as he}from"../../../webgl/enums.js";const oe=.9;let de=class extends r{constructor(e,r,t,i,n,a,h,o,d){super({}),this._materialRepository=e,this._shaderTechniqueRepository=t,this._rctx=i,this._compositingHelper=n,this._magnifierHelper=a,this._requestRender=h,this._stage=d,this._materialRenderers=new Map,this._needsTransparentPass=!1,this._hasHUDElements=!1,this._hasHighlights=!1,this._hasWater=!1,this._hasOverlayWater=!1,this._content=new Map,this._isRendering=!1,this._fallbackDepthStencilTexture=null,this.performanceInfo=new se,this._antialiasing=!0,this._oitEnabled=!1,this._multipassTerrain=!0,this._transparentTerrain=!1,this._hasAnimations=!1,this._animationTimestep=g(0),this._handles=new s,this._renderHiddenTransparentEdges=()=>{},this._oitUsed=!1,this._smaaPass=new K(this._rctx,t),this._oitEnabled=this._hasOITSupport,this._requestRender(),this._offscreenRendering=new V(this._rctx,this._compositingHelper),this._sliceHelper=new Y,this._shadowMap=new z(this._rctx,d.viewingMode,2),this._ssaoHelper=new J(t,this._rctx,(()=>this._requestRender())),this._highlight=new j(t,this._rctx),this._shadowHighlight=new Q(this._rctx,d.viewingMode),this._shadowAccumulator=new W(this._rctx,t,d,(e=>{const r=this.shadowsEnabled;this._shadowMap.enabled=!0,this._ensureCameraBindParameters(e.camera,e.contentCamera),this._renderPlugins.prepareRender(),this._shadowMap.enabled=r}),((e,r,t)=>{e.shadowMap.start(e.camera,r,t),this._renderShadowCascades(O.Shadow,e.shadowMap),e.camera.setGLViewport(this._rctx),this._ensureCameraBindParameters(e.camera,e.contentCamera)}),(()=>this._requestRender())),this._renderContext=new F(this._rctx,this._offscreenRendering,this._shadowMap,this._ssaoHelper,this._sliceHelper),this._renderPlugins=new B({renderContext:this._renderContext,shaderTechniqueRepository:t,textureRep:r,materialRep:this._materialRepository,requestRender:this._requestRender,schedule:o}),this.renderPassManager=new x(this._rctx,this._shaderTechniqueRepository),this._renderPlugins.add(this.renderPassManager.slots(),this.renderPassManager),this._handles.add([l((()=>this._stage.state.camera),(()=>this._requestRender()),c),l((()=>C.EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES),(e=>{this._renderHiddenTransparentEdges=e?()=>this._renderEdges(ee.TRANSPARENT):()=>{},this._requestRender()}),p)])}get _bindParameters(){return this._renderContext.bindParameters}get hasWater(){return this._hasWater||this._hasOverlayWater}get hasWaterReflection(){return this.hasWater&&this._waterReflectionEnabled}normalizeCtorArgs(){return{}}dispose(){this._handles.destroy(),this._smaaPass.dispose(),this._materialRenderers.forEach((e=>e.dispose())),this._materialRenderers.clear(),this._edgeView=n(this._edgeView),this._offscreenRendering.dispose(),this._fallbackDepthStencilTexture=a(this._fallbackDepthStencilTexture),this._shadowMap.enabled=!1,this._shadowMap.dispose(),this._ssaoHelper.enabled=!1,this._ssaoHelper.dispose(),this._highlight.dispose(),this._shadowHighlight.dispose(),this._shadowAccumulator.dispose(),M.prune(),this._content.clear()}disposeOffscreenBuffers(){this._offscreenRendering.dispose(),this._shadowMap.dispose(),this._smaaPass.disable(),this._ssaoHelper.disposeOffscreenBuffers()}get updating(){return this._antialiasing&&this._smaaPass.updating||h(this._edgeView)&&this._edgeView.updating||this._shadowAccumulator.running||!this.isCameraFinal}ensureEdgeView(){return o(this._edgeView)&&(this._edgeView=new $({rctx:this._rctx,renderSR:this._stage.renderSR,viewingMode:this._stage.viewingMode,techniqueRepository:this._shaderTechniqueRepository,setNeedsRender:()=>this._requestRender(),schedule:e=>this._stage.resourceController.schedule(e)}),this._handles.add(l((()=>d(this._edgeView,(e=>e.updating))),(()=>this._requestRender()),m)),this._requestRender()),this._edgeView}get edgeView(){return this._edgeView}get isCameraFinal(){return T(this._bindParameters.ssr.reprojectionMatrix,P)}set _reprojectionMatrix(e){t(this._bindParameters.ssr.reprojectionMatrix,e)&&this.notifyChange("isCameraFinal")}get shadowsEnabled(){return!!this._shadowMap?.enabled}setRenderParameters(e){const{_shadowMap:r,_ssaoHelper:t,_bindParameters:s}=this;if(void 0!==e.screenSpaceReflectionsEnabled&&s.ssr.enabled!==e.screenSpaceReflectionsEnabled&&(s.ssr.enabled=e.screenSpaceReflectionsEnabled,this._requestRender()),void 0!==e.shadowMap&&r.enabled!==e.shadowMap&&(r.enabled=e.shadowMap,this._requestRender()),void 0!==e.shadowMapMaxCascades&&r.maxCascades!==e.shadowMapMaxCascades&&(r.maxCascades=e.shadowMapMaxCascades,this._requestRender()),h(e.environment)){h(e.environment.weather)&&(this._bindParameters.weather=e.environment.weather,this._bindParameters.weatherVisible=e.weatherVisible,this._renderContext.bindParameters.weather=e.environment.weather,this._renderContext.bindParameters.weatherVisible=e.weatherVisible),void 0!==e.environment.lighting.ambientOcclusionEnabled&&t.enabled!==e.environment.lighting.ambientOcclusionEnabled&&(t.enabled=e.environment.lighting.ambientOcclusionEnabled,this._requestRender()),void 0!==e.environment.lighting.waterReflectionEnabled&&this._waterReflectionEnabled!==e.environment.lighting.waterReflectionEnabled&&(this._waterReflectionEnabled=e.environment.lighting.waterReflectionEnabled,this._requestRender());const r="virtual"!==e.environment.lighting.type;s.enableFillLights!==r&&(s.enableFillLights=r,this._requestRender())}e.background&&this._offscreenRendering.background!==e.background&&(this._offscreenRendering.background=e.background,this._requestRender()),void 0!==e.antialiasingEnabled&&this._antialiasing!==e.antialiasingEnabled&&(this._antialiasing=e.antialiasingEnabled,this._requestRender()),void 0!==e.highQualityTransparency&&this._multipassTerrain!==e.highQualityTransparency&&(this._multipassTerrain=e.highQualityTransparency,this._oitEnabled=e.highQualityTransparency&&this._hasOITSupport,this._requestRender()),void 0!==e.defaultHighlightOptions&&(this._highlight.setDefaultOptions(e.defaultHighlightOptions),this._shadowHighlight.setDefaultOptions(e.defaultHighlightOptions),this._requestRender()),void 0!==e.overlays&&this._bindParameters.overlays!==e.overlays&&(this._bindParameters.overlays=e.overlays,this._requestRender()),void 0!==e.slicePlane&&this._sliceHelper.plane!==e.slicePlane&&(this._sliceHelper.plane=_(e.slicePlane),this._requestRender()),void 0!==e.transparentTerrain&&this._transparentTerrain!==e.transparentTerrain&&(this._transparentTerrain=e.transparentTerrain,this._requestRender()),void 0!==e.hasOverlayWater&&this._hasOverlayWater!==e.hasOverlayWater&&(this._hasOverlayWater=e.hasOverlayWater,this._requestRender()),void 0!==e.shadowCastOptions&&this._shadowAccumulator.setOptions(e.shadowCastOptions)}get hasSlicePlane(){return!!this._sliceHelper.plane}get renderPlugins(){return this._renderPlugins}get _hasOITSupport(){return this._rctx.driverTest.floatBufferBlendWorking}modify(e){this._isRendering&&console.warn("Renderer.modify called while rendering");const{adds:r,removes:t,updates:s}=e;if(0===r.length&&0===t.length&&0===s.length)return;t.forAll((({id:e})=>this._content.delete(e))),r.forAll((e=>this._content.set(e.id,e)));const n=G(e);let a=!1;n.forEach(((e,r)=>{let t=this._materialRenderers.get(r);if(!t){if(!(e.adds.length>0))return;t=new re(this._rctx,this._materialRepository,r),this._materialRenderers.set(r,t)}t.modify(e),t.isEmpty&&(a=!0)})),a&&this._materialRenderers.forEach(((e,r)=>{e.isEmpty&&(this._materialRenderers.delete(r),e.dispose())})),this._hasHighlights=i(this._materialRenderers,(e=>e.hasHighlights)),this._bindParameters.hasOccludees=i(this._materialRenderers,(e=>e.hasOccludees)),this._hasWater=i(this._materialRenderers,(e=>e.hasWater)),this._needsTransparentPass=i(this._materialRenderers,(e=>e.requiresSlot(k.TRANSPARENT_MATERIAL,O.Color))),this._hasHUDElements=i(this._materialRenderers,(e=>e.requiresSlot(k.LINE_CALLOUTS_HUD_DEPTH,O.Color)||e.requiresSlot(k.HUD_MATERIAL,O.Color)||e.requiresSlot(k.LABEL_MATERIAL,O.Color))),this._requestRender()}updateAnimation(e){return this._hasAnimations=!1,this._materialRenderers.forEach((r=>this._hasAnimations=r.updateAnimation(e)||this._hasAnimations)),this._hasAnimations=this._renderPlugins.updateAnimation(e)||this._hasAnimations,this._hasAnimations}get animationTimestep(){return this._animationTimestep}updateLightSources(e,r,t){this._bindParameters.lighting.groundLightingFactor=r,this._bindParameters.lighting.globalFactor=t,this._bindParameters.lighting.set(e)}render(e,r,t,s){this._isRendering=!0,this.performanceInfo.prerender(this._rctx),this._bindParameters.transparencyPassType=Z.NONE;const i=this._offscreenRendering;i.needLastFrameColorTexture=this.hasWaterReflection,i.advanceCurrentRenderTarget();const n=w(this._sliceHelper.plane);s===D.OFF&&(this._sliceHelper.plane=null),this._rctx.bindFramebuffer(e),r.setGLViewport(this._rctx),this._ensureCameraBindParameters(r,t),this._renderPlugins.prepareRender(),this.performanceInfo.advance(ie.Prepare);const a=this._computeDepthRange(r);this._renderShadowMap(e,r,this._bindParameters.lighting.lightingMainDirection,a),this.performanceInfo.advance(ie.Shadowmap),i.initializeFrame(r),this._ensureBindParameters(r,t),this._renderLinearDepth(),this.performanceInfo.advance(ie.Lineardepth),this._accumulateShadows(a,r,t),this._renderNormal(),this.performanceInfo.advance(ie.Normals),this._ensureBindParametersSSR(),this._ssaoHelper.computeSSAO(this._bindParameters,i.linearDepthTexture,i.normalTexture),this.performanceInfo.advance(ie.SSAO),this._renderContext.output=O.Color,i.bindFramebuffer(),this._renderOpaqueGeometry(),this.performanceInfo.advance(ie.Opaque);const d=this._multipassTerrain&&this._transparentTerrain;this._renderTerrainLinearDepth(d),this._setMultipassEnabled(d),this._setTerrainCulling(d),this._renderEdges(ee.OPAQUE),this.performanceInfo.advance(ie.OpaqueEdges),this._offscreenRendering.bindTarget(this._offscreenRendering.currentColorTarget,this._offscreenRendering.mainDepth),this._renderSlot(k.VOXEL),this._renderHiddenTransparentEdges();const _=this._needsTransparentPass||this._renderPlugins.needsTransparentPass;_&&(this._oitEnabled?this._renderOrderIndependentTransparency((()=>this._renderTransparentGeometry()),!1):this._renderTransparentGeometry()),this.performanceInfo.advance(ie.Transparent),this._renderGeometryLinearDepth(d);const l=this._renderHUDVisibility();d||this._renderInternalSlot(k.LINE_CALLOUTS),this.performanceInfo.advance(ie.Hudvisibility),this._renderEdges(ee.TRANSPARENT,d),this.performanceInfo.advance(ie.TransparentEdges),this._renderTransparentTerrain(),this._transparentTerrain&&l&&(d?this._renderLineCallouts(y.Occluded):i.compositeTransparentTerrainOntoHUDVisibility(this._bindParameters),this._renderHUD(y.Occluded,i.framebuffer),this.performanceInfo.advance(ie.HudOccluded)),this.performanceInfo.advance(ie.TransparentTerrain),this._setTerrainCulling(!1),this._transparentTerrain&&(i.compositeTransparentTerrainOntoMain(this._bindParameters),d&&(this._renderEdges(ee.OPAQUE),this.performanceInfo.advance(ie.OpaqueEdges),_&&(this._oitEnabled?this._renderOrderIndependentTransparency((()=>this._renderTransparentGeometry()),!1):this._renderTransparentGeometry()),this.performanceInfo.advance(ie.Transparent),this._renderEdges(ee.TRANSPARENT),this.performanceInfo.advance(ie.TransparentEdges))),d&&this._renderLineCallouts(y.NotOccluded),this._setMultipassEnabled(!1),this._shadowAccumulator.render(this._bindParameters),i.renderToTargets((()=>{this._renderInternalSlot(k.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL),this._renderSlot(k.POSTPROCESSING_ENVIRONMENT_TRANSPARENT),this._renderSlot(k.LASERLINES)}),i.currentColorTarget,i.mainDepth),this.performanceInfo.advance(ie.Atmosphere),this._renderPlugins.needsLaserlineWithContrastControl&&i.renderTmpAndCompositeToMain((()=>this._renderSlot(k.LASERLINES_CONTRAST_CONTROL)),this._bindParameters,te.PremultipliedAlpha),this.performanceInfo.advance(ie.Laserline),this._renderOccluded(),this.performanceInfo.advance(ie.Occluded);const c=s===D.ON&&this._magnifierHelper.enabled,p=c&&o(e)?this._offscreenRendering.getFramebuffer(this._offscreenRendering.tmpColor,this._offscreenRendering.tmpDepth):e;this._rctx.bindFramebuffer(p);const m=this._offscreenRendering.colorTexture;!this._renderAntiAliasing(m)&&h(m)&&this._compositingHelper.composite(this._bindParameters,m,te.None),this.performanceInfo.advance(ie.Antialiasing),this._renderHUD(y.NotOccluded,p),this.performanceInfo.advance(ie.HudNotoccluded),this._renderHighlights(p,this._bindParameters),this.performanceInfo.advance(ie.Highlights),c&&this._magnifierHelper.render(this._rctx,this._bindParameters),p!==e&&(this._rctx.bindFramebuffer(e),this._compositingHelper.composite(this._bindParameters,this._offscreenRendering.tmpColorTexture,te.None)),this._disposeOITBuffers(),this._renderContext.lastFrameCamera.copyFrom(this._bindParameters.camera),this._sliceHelper.plane=n,this._isRendering=!1,this.onPostRender&&this.onPostRender(),this.performanceInfo.postrender()}finish(e){if(this._hasAnimations||(this._animationTimestep=g(0)),e===H.BACKGROUND){this._rctx.gl.getError();const e=this.performanceInfo.elapsedTime/A;this._animationTimestep=g(Math.max(this._animationTimestep*oe+e*(1-oe),S))}}readDepthPixels(e,r,t){const s=this._offscreenRendering.bindTarget(this._offscreenRendering.linearDepth,this._offscreenRendering.tmpDepth);if(!this._needsLinearDepth){this._ensureBindParameters(e,e),this._bindParameters.camera.setGLViewport(this._rctx),this._rctx.setClearColor(0,0,0,0);const r=ne.COLOR_BUFFER_BIT|ne.DEPTH_BUFFER_BIT|ne.STENCIL_BUFFER_BIT;this._rctx.clearSafe(r),this._renderGeometryAndTransparentTerrainPass(O.Depth)}s.readPixels(r[0],r[1],r[2],r[3],ae.RGBA,he.UNSIGNED_BYTE,t)}readHUDVisibility(e,r,t,s,i){this._offscreenRendering.bindTarget(this._offscreenRendering.hudVisibility).readPixels(e,r,t,s,ae.RGBA,he.UNSIGNED_BYTE,i)}readAccumulatedShadow(e,r){return this._shadowAccumulator.readAccumulatedShadow(e,r)}_setMultipassEnabled(e){this._bindParameters.multipassTerrain.enabled=this._bindParameters.multipassGeometry.enabled=e}_setTerrainCulling(e){this._bindParameters.multipassTerrain.cullAboveGround=e}_renderSlot(e){this._bindParameters.slot=e,this._renderPlugins.render()}_renderEdges(e,r=!1){const t=this._edgeView;h(t)&&t.shouldRender()&&this._offscreenRendering.renderTmpAndCompositeToMain((()=>t.render(this._bindParameters,e)),this._bindParameters,te.Alpha,r)}_renderShadowMap(e,r,t,s){const i=this._shadowMap;i.enabled&&(i.start(r,t,s),this._shadowHighlight.updateParameters(r,t),this._needsShadowHighlight?(this._renderShadowCascades(O.ShadowHighlight,this._shadowMap,(e=>i.takeCascadeSnapshotTo(e,X.Highlight))),i.clear(),this._renderShadowCascades(O.ShadowExludeHighlight,this._shadowMap,(e=>{i.takeCascadeSnapshotTo(e,X.Default),this._renderGeometryAndTransparentTerrainPass(O.ShadowHighlight)}))):this._renderShadowCascades(O.Shadow),i.finish(e),r.setGLViewport(this._rctx))}_renderShadowCascades(e,r=this._shadowMap,t=(e=>{})){for(const s of r.getCascades())s.camera.setGLViewport(this._rctx),this._ensureCameraBindParameters(s.camera,s.camera),this._renderGeometryAndTransparentTerrainPass(e),t(s)}get _needsLinearDepth(){return this._ssaoHelper.enabled||this._renderPlugins.needsLinearDepth||this._hasWater&&this._waterReflectionEnabled||this._needsShadowHighlight||this._needsShadowCast}_renderLinearDepth(){this._needsLinearDepth?this._offscreenRendering.renderToTargets((()=>this._renderGeometryAndTransparentTerrainPass(O.Depth)),this._offscreenRendering.linearDepth,this._offscreenRendering.tmpDepth,[0,0,0,0],!0,!0):this._offscreenRendering.disposeTarget(this._offscreenRendering.linearDepth),this._bindParameters.linearDepthTexture=this._offscreenRendering.linearDepthTexture}_renderTerrainLinearDepth(e){if(e){const e=this._renderContext.output;this._renderContext.output=O.Depth,this._offscreenRendering.renderToTargets((()=>this._renderTransparentTerrain()),this._offscreenRendering.terrainLinearDepth,this._offscreenRendering.tmpDepth,[-1e10,-1e10,-1e10,1],!0,!0),this._renderContext.output=e}else this._offscreenRendering.disposeTarget(this._offscreenRendering.terrainLinearDepth);this._bindParameters.multipassTerrain.linearDepthTexture=this._offscreenRendering.terrainLinearDepthTexture}_renderGeometryLinearDepth(e){if(e){const e=this._renderContext.output;this._offscreenRendering.renderToTargets((()=>this._renderGeometryPass(O.Depth)),this._offscreenRendering.geometryLinearDepth,this._offscreenRendering.tmpDepth,[1,1,1,1],!0,!0),this._renderContext.output=e}else this._offscreenRendering.disposeTarget(this._offscreenRendering.geometryLinearDepth);this._bindParameters.multipassGeometry.linearDepthTexture=this._offscreenRendering.geometryLinearDepthTexture}get _needsNormal(){return this._ssaoHelper.enabled}_renderNormal(){this._needsNormal?this._offscreenRendering.renderToTargets((()=>{this._renderGeometryAndTransparentTerrainPass(O.Normal)}),this._offscreenRendering.normal,this._offscreenRendering.tmpDepth,[0,0,0,0],!0,!0):this._offscreenRendering.disposeTarget(this._offscreenRendering.normal)}get _needsDepthRange(){return this._shadowMap.enabled||this._needsShadowCast}_computeDepthRange(e){if(!this._needsDepthRange)return L;const r=N(e,this._content,this._stage.layers);return v(r,this.renderPlugins.queryDepthRange(e)),r.near=Math.max(e.near,r.near),r.far=Math.min(e.far,r.far),r}_renderGeometryAndTransparentTerrainPass(e){this._renderContext.output=e,this._renderGeometryPass(e),this._renderTransparentTerrain()}_renderGeometryPass(e){this._renderContext.output=e,this._renderOpaqueGeometry(),this._renderTransparentGeometry()}_renderOpaqueGeometry(){this._renderSlot(k.INTEGRATED_MESH),this._renderSlot(k.OPAQUE_TERRAIN),this._renderInternalSlot(k.OPAQUE_MATERIAL),this._renderSlot(k.OPAQUE_MATERIAL),this._renderSlot(k.POSTPROCESSING_ENVIRONMENT_OPAQUE)}_renderTransparentGeometry(){this._renderInternalSlot(k.TRANSPARENT_MATERIAL),this._renderSlot(k.TRANSPARENT_MATERIAL)}_renderTransparentTerrain(){this._renderSlot(k.TRANSPARENT_TERRAIN)}_renderHUDVisibility(){let e=!1;return this._renderContext.offscreenRenderingHelper&&this._renderContext.offscreenRenderingHelper.renderHUDVisibility((()=>{this._bindParameters.hudVisibilityTexture=this._renderContext.offscreenRenderingHelper.hudVisibilityTexture,e=this._renderInternalSlot(k.OCCLUSION_PIXELS)}),this._multipassTerrain&&this._transparentTerrain),e}_renderLineCallouts(e){this._bindParameters.renderTransparentlyOccludedHUD=e,e===y.Occluded?this._offscreenRendering.renderToTargets((()=>this._renderInternalSlot(k.LINE_CALLOUTS)),this._offscreenRendering.currentColorTarget,this._offscreenRendering.tmpDepth,void 0,!0,!0):this._renderInternalSlot(k.LINE_CALLOUTS)}_renderHUD(e,r){this._hasHUDElements&&(this._oitEnabled?(this._renderOrderIndependentTransparency((()=>this._renderHUDElements(e)),!0),this._rctx.bindFramebuffer(r),this._compositingHelper.composite(this._bindParameters,this._offscreenRendering.hudColorTexture,te.PremultipliedAlpha)):e===y.Occluded?this._offscreenRendering.renderToTargets((()=>this._renderHUDElements(y.Occluded)),this._offscreenRendering.currentColorTarget,this._offscreenRendering.tmpDepth,void 0,!0,!0):this._renderHUDElements(e))}_renderHUDElements(e){this._bindParameters.renderTransparentlyOccludedHUD=e,this._renderInternalSlot(k.LINE_CALLOUTS_HUD_DEPTH),this._renderInternalSlot(k.HUD_MATERIAL),this._renderInternalSlot(k.LABEL_MATERIAL)}get _needsHighlight(){return this._hasHighlights||this._renderPlugins.needsHighlight}get _needsShadowHighlight(){return this._shadowMap.enabled&&this._shadowHighlight.isVisible&&this._needsHighlight}_renderHighlights(e,r){if(!this._needsHighlight)return void this._offscreenRendering.disposeTarget(this._offscreenRendering.highlight);const t=this._highlight,s=this._offscreenRendering.renderToTargets((()=>{this._renderGeometryAndTransparentTerrainPass(O.Highlight),this._rctx.clearSafe(ne.DEPTH_BUFFER_BIT),this._renderHUDElements(y.Both)}),this._offscreenRendering.highlight,this._offscreenRendering.tmpDepth,[0,0,0,0],!0,!0);this._bindParameters.highlightColorTexture=s.colorTexture,this._needsShadowHighlight&&this._shadowHighlight.render(r,e),t.render(this._bindParameters,s,e)}get _needsShadowCast(){return this._shadowAccumulator.isAccumulating}_accumulateShadows(e,r,t){this._needsShadowCast&&this._shadowAccumulator.renderAccumulation(this._offscreenRendering.linearDepthTexture,e,r,t)}_renderOrderIndependentTransparency(e,r){const t=t=>{this._bindParameters.transparencyPassType=t,this._offscreenRendering.renderOITPass((()=>e()),t,r)},s=this._renderContext.output;this._renderContext.output=O.Alpha,t(Z.Alpha),this._renderContext.output=O.Color,t(Z.Color),t(Z.FrontFace),this._offscreenRendering.compositeTransparentOntoOpaque(this._bindParameters,r),this._bindParameters.transparencyPassType=Z.NONE,this._renderContext.output=s,this._oitUsed=!0}_disposeOITBuffers(){this._oitUsed||(this._offscreenRendering.disposeTarget(this._offscreenRendering.alphaFloatTarget),this._offscreenRendering.disposeTarget(this._offscreenRendering.colorFloatTarget),this._offscreenRendering.disposeTarget(this._offscreenRendering.frontFaceTarget)),this._oitUsed=!1}_renderOccluded(){let e=0;this._materialRenderers.forEach(((r,t)=>{t&&t.isVisible()&&t.renderOccluded===q.OccludeAndTransparentStencil&&(e|=t.renderOccluded,ce.push(t))}));const r=this._offscreenRendering,t=(t,s,i,n,a)=>{0!=(e&s)&&(r.renderToTargets(i,r.tmpColor,r.mainDepth,[0,0,0,0],n,a),r.compositeOccludedOntoMain(this._bindParameters,t))};0!==ce.length&&(this._renderInternalSlot(k.OCCLUDER_MATERIAL,ce),t(.5,q.OccludeAndTransparentStencil,(()=>this._renderInternalSlot(k.TRANSPARENT_OCCLUDER_MATERIAL,ce)),!1,!1),ce.length=0),this._materialRenderers.forEach(((r,t)=>{t&&t.isVisible()&&(t.renderOccluded===q.OccludeAndTransparent||t.renderOccluded===q.Transparent||t.renderOccluded===q.Opaque)&&(e|=t.renderOccluded,le.push(t))}));const s=this._renderPlugins.renderOccludedFlags;if(e|=s,!e)return;const i=e=>{this._renderContext.renderOccludedMask=e,s>q.Occlude&&this._renderSlot(k.OCCLUDED_TERRAIN),this._renderInternalSlot(k.OPAQUE_MATERIAL,le),this._renderInternalSlot(k.TRANSPARENT_MATERIAL,le),this._renderInternalSlot(k.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL,le),this._renderContext.resetRenderOccludedMask()};this._renderContext.output=O.Color,t(.5,q.OccludeAndTransparent,(()=>i(q.OccludeAndTransparent)),!0,I.OutlineVisualElementMask),t(.5,q.Transparent,(()=>i(q.Transparent)),!0,I.OutlineVisualElementMask),t(1,q.Opaque,(()=>i(q.Opaque)),!0,I.OutlineVisualElementMask),le.length=0}_renderAntiAliasing(e){if(this._antialiasing){if(this._smaaPass.enable((()=>this._requestRender()))&&h(e))return this._smaaPass.render(e),!0}else this._smaaPass.disable();return!1}_ensureCameraBindParameters(e,r){this._bindParameters.camera=e,this._bindParameters.contentCamera=r}_ensureBindParameters(e,r){this._ensureCameraBindParameters(e,r);const t=this._renderContext.offscreenRenderingHelper;this._bindParameters.hudVisibilityTexture=t.hudVisibilityTexture,this._bindParameters.mainColorTexture=t.mainColorTexture,this._bindParameters.highlightDepthTexture=t.depthTexture??this._getFallbackDepthTexture()}_ensureBindParametersSSR(){this.hasWaterReflection?(this._renderContext.lastFrameCamera.equals(this._bindParameters.camera)?this._reprojectionMatrix=P:(R(me,this._bindParameters.camera.viewMatrix),R(pe,this._bindParameters.camera.projectionMatrix),b(ge,me,pe),b(ge,this._renderContext.lastFrameCamera.viewMatrix,ge),b(ge,this._renderContext.lastFrameCamera.projectionMatrix,ge),this._reprojectionMatrix=ge),this._bindParameters.ssr.lastFrameColorTexture=this._offscreenRendering.lastFrameColorTexture):this._bindParameters.ssr.lastFrameColorTexture=null,this._bindParameters.ssr.enabled=this.hasWaterReflection}_renderInternalSlot(e,r){let t=!1;return this._bindParameters.slot=e,h(r)?r.forEach((e=>{if(!e.shouldRender(this._renderContext))return;const r=this._materialRenderers.get(e);h(r)&&(t=r.render(this._renderContext.output,this._bindParameters)||t)})):this._materialRenderers.forEach(((e,r)=>{r.shouldRender(this._renderContext)&&e.render(this._renderContext.output,this._bindParameters)&&(t=!0)})),t}_getFallbackDepthTexture(){return this._fallbackDepthStencilTexture||(this._fallbackDepthStencilTexture=U(this._rctx)),this._fallbackDepthStencilTexture}get gpuMemoryUsage(){return{offscreen:this._offscreenRendering?.gpuMemoryUsage??0,highlights:(this._highlight?.gpuMemoryUsage??0)+(this._shadowHighlight?.gpuMemoryUsage??0),shadows:this._shadowMap?.gpuMemoryUsage??0,ssao:this._ssaoHelper?.gpuMemoryUsage??0}}get test(){const e=this;return{offscreen:this._offscreenRendering,shadowMap:this._shadowMap,ssao:this._ssaoHelper,highlight:this._highlight,lighting:this._bindParameters.lighting,materialRenderers:this._materialRenderers,shadowAccumulator:this._shadowAccumulator,getFramebufferTexture:r=>{switch(r){case _e.Color:return e._offscreenRendering.colorTexture;case _e.LinearDepth:return e._offscreenRendering.linearDepthTexture;case _e.Normals:return e._offscreenRendering.normalTexture;case _e.ShadowMap:return e._shadowMap.depthTexture;case _e.HudVisibility:return e._offscreenRendering.hudVisibilityTexture;case _e.Highlight:return e._offscreenRendering.highlightTexture}}}}};var _e;e([u()],de.prototype,"_shadowAccumulator",void 0),e([u()],de.prototype,"_smaaPass",void 0),e([u()],de.prototype,"_antialiasing",void 0),e([u()],de.prototype,"_edgeView",void 0),e([u()],de.prototype,"updating",null),e([u()],de.prototype,"isCameraFinal",null),de=e([f("esri.views.3d.webgl-engine.lib.Renderer")],de),function(e){e[e.Color=0]="Color",e[e.LinearDepth=1]="LinearDepth",e[e.Normals=2]="Normals",e[e.ShadowMap=3]="ShadowMap",e[e.HudVisibility=4]="HudVisibility",e[e.Highlight=5]="Highlight"}(_e||(_e={}));const le=[],ce=[],pe=E(),me=E(),ge=E();export{_e as FramebufferId,de as Renderer};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.25/esri/copyright.txt for details.
4
4
  */
5
- import{RenderingContext as e}from"../../../webgl/RenderingContext.js";class t extends e{constructor(e,t,r){super(e,t),this.newCache=r,this._refCount=1}dispose(){--this._refCount>0||super.dispose()}ref(){++this._refCount}bindTechnique(e,t,r,s){return this.useProgram(e.program),e.bindPipelineState(this,r?.slot,s),e.bindPass(t,r),e.program}get test(){return this.programCache.test}}export{t as RenderingContext};
5
+ import{RenderingContext as e}from"../../../webgl/RenderingContext.js";class t extends e{constructor(e,t,r){super(e,t),this.newCache=r,this._refCount=1}dispose(){--this._refCount>0||super.dispose()}ref(){++this._refCount}bindTechnique(e,t,r,s){return this.useProgram(e.program),e.bindPipelineState(this,r?.slot,s),e.program.bindPass(t,r),e.program}get test(){return this.programCache.test}}export{t as RenderingContext};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.25/esri/copyright.txt for details.
4
4
  */
5
- import{ReloadableShaderModule as e}from"../core/shaderTechnique/ReloadableShaderModule.js";import{ShaderTechnique as r}from"../core/shaderTechnique/ShaderTechnique.js";import{Default3D as i}from"./DefaultVertexAttributeLocations.js";import{Program as o}from"./Program.js";import{b as t}from"../../../../chunks/SSAO.glsl.js";import{makePipelineState as s,defaultColorWriteParams as a}from"../../../webgl/renderState.js";class n extends r{initializeProgram(e){const r=n.shader.get().build(this.configuration);return new o(e.rctx,r,i)}initializePipeline(){return s({colorWrite:a})}}n.shader=new e(t,(()=>import("../shaders/SSAO.glsl.js")));export{n as SSAOTechnique};
5
+ import{ReloadableShaderModule as e}from"../core/shaderTechnique/ReloadableShaderModule.js";import{ShaderTechnique as r}from"../core/shaderTechnique/ShaderTechnique.js";import{Default3D as i}from"./DefaultVertexAttributeLocations.js";import{Program as o}from"./Program.js";import{b as t}from"../../../../chunks/SSAO.glsl.js";import{makePipelineState as s,defaultColorWriteParams as a}from"../../../webgl/renderState.js";class n extends r{initializeProgram(e){return new o(e.rctx,n.shader.get().build(this.configuration),i)}initializePipeline(){return s({colorWrite:a})}}n.shader=new e(t,(()=>import("../shaders/SSAO.glsl.js")));export{n as SSAOTechnique};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.25/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{equals as i}from"../../../../core/arrayUtils.js";import r from"../../../../core/Handles.js";import{smoothstep as s}from"../../../../core/mathUtils.js";import{isNone as a,disposeMaybe as o,releaseMaybe as n}from"../../../../core/maybe.js";import{watch as h,syncAndInitial as c}from"../../../../core/reactiveUtils.js";import{property as _}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as l}from"../../../../core/accessorSupport/decorators/subclass.js";import{z as d,c as u}from"../../../../chunks/vec3.js";import{c as m}from"../../../../chunks/vec3f64.js";import{ShaderTechniqueConfiguration as p}from"../core/shaderTechnique/ShaderTechniqueConfiguration.js";import{BindParameters as g}from"./BindParameters.js";import{Camera as f}from"./Camera.js";import{ZERO as w}from"./depthRange.js";import{createQuadVAO as v}from"./glUtil3D.js";import{ShadowCastRenderer as b,shadowCastDisabledElevationThreshold as C,shadowCastDisableElevationMax as A,shadowCastDisableElevationMin as y}from"./ShadowCastRenderer.js";import{ShadowMap as R}from"./ShadowMap.js";import{S as T,s as S}from"../../../../chunks/ShadowCastAccumulate.glsl.js";import{ShadowCastAccumulateTechnique as D}from"../shaders/ShadowCastAccumulateTechnique.js";import{TaskPriority as j}from"../../../support/Scheduler.js";import{TargetType as F,DepthStencilTargetType as E,TextureType as P,PixelFormat as I,PixelType as q,TextureSamplingMode as x,TextureWrapMode as M,ClearBufferBit as U}from"../../../webgl/enums.js";import{FramebufferObject as O}from"../../../webgl/FramebufferObject.js";import{vertexCount as L}from"../../../webgl/Util.js";var B;let N=B=class extends t{constructor(e,t,i,s,o,n){super({}),this._rctx=e,this._stage=i,this._prepareForShadowMapPass=s,this._renderToShadowMap=o,this._requestRender=n,this._progress=0,this._sampleCount=0,this._passParameters=new T,this._enabledInternal=!1,this._cachedLightDirections=[],this._depthRange=w,this._previewingCached=!1,this._handles=new r,this._cameraForcedForScreenshot=!1,this._bindParameters=new g(new R(e,i.viewingMode),null,null),this._bindParameters.shadowMap.enabled=!0,this._bindParameters.camera=new f,this._vao=v(e);const _={colorTarget:F.TEXTURE,depthStencilTarget:E.NONE,width:0,height:0},l={target:P.TEXTURE_2D,pixelFormat:I.RGBA,dataType:q.UNSIGNED_BYTE,samplingMode:x.LINEAR,wrapMode:M.CLAMP_TO_EDGE,width:0,height:0};this._fbo=new O(e,_,l),this._accumulationRenderer=new b(t,e,this,n);const d=this._stage.resourceController.scheduler;this._handles.add(d.registerTask(j.SHADOW_ACCUMULATOR,this)),this._handles.add(h((()=>i.renderView),(e=>{this._handles.remove(B.renderViewHandleKey),a(e)||this._handles.add(e.events.on("force-camera-for-screenshot",(()=>this._cameraForcedForScreenshot=!0)),B.renderViewHandleKey)}),c))}normalizeCtorArgs(){return{}}get computedSamples(){return this._progress}get shadowCastTexture(){return this._fbo.colorTexture}get isAccumulating(){return this._isPreviewing||this._isRefining}get _accumulationTechnique(){if(a(this._accumulationTechniqueCached)){const e={rctx:this._rctx,viewingMode:this._stage.viewingMode};this._accumulationTechniqueCached=new D(e,new p)}return this._accumulationTechniqueCached}get _isRefining(){return this._isActive&&!this._isDoneAccumulating&&!this._previewingCached}get _isPreviewing(){return this._isActive&&this._previewingCached}get _isActive(){return this._enabledInternal&&this._sampleCount>0}get canAccumulate(){return null!==this._passParameters.linearDepthTexture&&this._depthRange!==w&&this._opacityFromElevation>C}get _isDoneAccumulating(){return this._progress>=this._sampleCount}get _lightDirectionsInternal(){return this._cachedLightDirections}set _lightDirectionsInternal(e){const t=this._cachedLightDirections;if(i(t,e,d))return;const r=e.length;t.length=r,this._sampleCount=Math.min(S,r);for(let i=0;i<r;++i){const r=e[i],s=t[i]||m();u(s,r),t[i]=s}this._invalidate()}get _opacityFromElevation(){return this._accumulationRenderer.opacityFromElevation}set _opacityFromElevation(e){this._accumulationRenderer.opacityFromElevation=e}get running(){return this._isRefining&&this.canAccumulate&&this._progress>0}runTask(e){for(this._prepareForShadowMapPass(this._bindParameters);!e.done&&!this._isDoneAccumulating;)this._accumulateShadow(),e.madeProgress();this._requestRender()}renderAccumulation(e,t,i,r){if(this._passParameters.linearDepthTexture=e,this._depthRange=t,this._updateCamera(i),this._bindParameters.contentCamera=r,this.notifyChange("canAccumulate"),!this.isAccumulating||!this.canAccumulate)return;(this._previewingCached||0===this._progress||this._cameraForcedForScreenshot)&&this._clear();const s=this._cameraForcedForScreenshot?this._sampleCount:Math.min(B.previewSamples,this._sampleCount-this._progress);for(let a=0;a<s;++a)this._accumulateShadow();this._cameraForcedForScreenshot=!1}render(e){this._accumulationRenderer.render(e)}dispose(){this._stop(),this._handles.destroy(),this._accumulationRenderer=o(this._accumulationRenderer),this._bindParameters.shadowMap.dispose(),this._fbo=o(this._fbo),this._vao=o(this._vao),this._accumulationTechniqueCached=n(this._accumulationTechniqueCached),this._cachedLightDirections.length=0,this._sampleCount=0}setOptions(e){void 0!==e.enabled&&(this._enabled=e.enabled),void 0!==e.previewing&&(this._previewing=e.previewing),void 0!==e.lightDirections&&(this._lightDirections=e.lightDirections),this._accumulationRenderer.setOptions(e)}set _previewing(e){this._previewingCached!==e&&(this._previewingCached=e,this._requestRenderIfEnabled())}set _lightDirections(e){this._lightDirectionsInternal=e}readAccumulatedShadow(e,t){if(!this._isActive||this._progress<1||e<0||e>this._fbo.width||t<0||t>this._fbo.height)return 0;const i=k;return this._fbo.readPixels(e,t,1,1,I.RGBA,q.UNSIGNED_BYTE,i),i[0]/this._progress}_start(){this._progress=0,this._enabledInternal=!0}_stop(){this._enabledInternal=!1}_invalidate(){this._progress=0,this._requestRenderIfEnabled()}_clear(){this._rctx.bindFramebuffer(this._fbo),this._rctx.setClearColor(0,0,0,0),this._rctx.clearSafe(U.COLOR_BUFFER_BIT),this._progress=0}_accumulateShadow(){const e=this._lightDirectionsInternal[this._progress];this._renderToShadowMap(this._bindParameters,e,this._depthRange),this._passParameters.origin=this._bindParameters.camera.center,this._rctx.bindFramebuffer(this._fbo);const t=this._accumulationTechnique;this._rctx.bindTechnique(t,this._passParameters,this._bindParameters),this._rctx.bindVAO(this._vao),this._rctx.drawArrays(t.primitiveType,0,L(this._vao,"geometry")),this._progress++}_updateCamera(e){e.equals(this._bindParameters.camera)||(this._bindParameters.camera.copyFrom(e),this._fbo.resize(e.fullWidth,e.fullHeight),this._opacityFromElevation=1-s(y,A,e.relativeElevation))}set _enabled(e){e!==this._enabledInternal&&(e?this._start():this._stop())}_requestRenderIfEnabled(){this._enabledInternal&&this._requestRender()}get test(){const e=this;return{lightDirections:this._lightDirectionsInternal,get isDone(){return e._isDoneAccumulating},get isActive(){return e._isActive}}}};N.previewSamples=6,N.renderViewHandleKey="renderView",e([_()],N.prototype,"_progress",void 0),e([_()],N.prototype,"_sampleCount",void 0),e([_()],N.prototype,"_enabledInternal",void 0),e([_()],N.prototype,"_depthRange",void 0),e([_()],N.prototype,"_previewingCached",void 0),e([_()],N.prototype,"_accumulationRenderer",void 0),e([_()],N.prototype,"_isRefining",null),e([_()],N.prototype,"_isActive",null),e([_()],N.prototype,"canAccumulate",null),e([_()],N.prototype,"_isDoneAccumulating",null),e([_()],N.prototype,"_opacityFromElevation",null),e([_()],N.prototype,"running",null),N=B=e([l("esri.views.3d.webgl-engine.lib.ShadowAccumulator")],N);const k=new Uint8Array(4);export{N as ShadowAccumulator};
5
+ import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{equals as i}from"../../../../core/arrayUtils.js";import r from"../../../../core/Handles.js";import{smoothstep as s}from"../../../../core/mathUtils.js";import{isNone as a,disposeMaybe as o,releaseMaybe as n}from"../../../../core/maybe.js";import{watch as h,syncAndInitial as c}from"../../../../core/reactiveUtils.js";import{property as _}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as l}from"../../../../core/accessorSupport/decorators/subclass.js";import{z as d,c as u}from"../../../../chunks/vec3.js";import{c as m}from"../../../../chunks/vec3f64.js";import{BindParameters as p}from"./BindParameters.js";import{Camera as g}from"./Camera.js";import{ZERO as f}from"./depthRange.js";import{createQuadVAO as v}from"./glUtil3D.js";import{ShadowCastRenderer as w,shadowCastDisabledElevationThreshold as b,shadowCastDisableElevationMax as C,shadowCastDisableElevationMin as A}from"./ShadowCastRenderer.js";import{ShadowMap as y}from"./ShadowMap.js";import{S as R,s as S}from"../../../../chunks/ShadowCastAccumulate.glsl.js";import{ShadowCastAccumulateTechnique as T}from"../shaders/ShadowCastAccumulateTechnique.js";import{TaskPriority as D}from"../../../support/Scheduler.js";import{TargetType as j,DepthStencilTargetType as F,TextureType as E,PixelFormat as P,PixelType as I,TextureSamplingMode as x,TextureWrapMode as q,ClearBufferBit as M}from"../../../webgl/enums.js";import{FramebufferObject as U}from"../../../webgl/FramebufferObject.js";import{vertexCount as O}from"../../../webgl/Util.js";var L;let B=L=class extends t{constructor(e,t,i,s,o,n){super({}),this._rctx=e,this._stage=i,this._prepareForShadowMapPass=s,this._renderToShadowMap=o,this._requestRender=n,this._progress=0,this._sampleCount=0,this._passParameters=new R,this._enabledInternal=!1,this._cachedLightDirections=[],this._depthRange=f,this._previewingCached=!1,this._handles=new r,this._cameraForcedForScreenshot=!1,this._bindParameters=new p(new y(e,i.viewingMode),null,null),this._bindParameters.shadowMap.enabled=!0,this._bindParameters.camera=new g,this._vao=v(e);const _={colorTarget:j.TEXTURE,depthStencilTarget:F.NONE,width:0,height:0},l={target:E.TEXTURE_2D,pixelFormat:P.RGBA,dataType:I.UNSIGNED_BYTE,samplingMode:x.LINEAR,wrapMode:q.CLAMP_TO_EDGE,width:0,height:0};this._fbo=new U(e,_,l),this._accumulationRenderer=new w(t,e,this,n);const d=this._stage.resourceController.scheduler;this._handles.add(d.registerTask(D.SHADOW_ACCUMULATOR,this)),this._handles.add(h((()=>i.renderView),(e=>{this._handles.remove(L.renderViewHandleKey),a(e)||this._handles.add(e.events.on("force-camera-for-screenshot",(()=>this._cameraForcedForScreenshot=!0)),L.renderViewHandleKey)}),c))}normalizeCtorArgs(){return{}}get computedSamples(){return this._progress}get shadowCastTexture(){return this._fbo.colorTexture}get isAccumulating(){return this._isPreviewing||this._isRefining}get _accumulationTechnique(){if(a(this._accumulationTechniqueCached)){const e={rctx:this._rctx,viewingMode:this._stage.viewingMode};this._accumulationTechniqueCached=new T(e)}return this._accumulationTechniqueCached}get _isRefining(){return this._isActive&&!this._isDoneAccumulating&&!this._previewingCached}get _isPreviewing(){return this._isActive&&this._previewingCached}get _isActive(){return this._enabledInternal&&this._sampleCount>0}get canAccumulate(){return null!==this._passParameters.linearDepthTexture&&this._depthRange!==f&&this._opacityFromElevation>b}get _isDoneAccumulating(){return this._progress>=this._sampleCount}get _lightDirectionsInternal(){return this._cachedLightDirections}set _lightDirectionsInternal(e){const t=this._cachedLightDirections;if(i(t,e,d))return;const r=e.length;t.length=r,this._sampleCount=Math.min(S,r);for(let i=0;i<r;++i){const r=e[i],s=t[i]||m();u(s,r),t[i]=s}this._invalidate()}get _opacityFromElevation(){return this._accumulationRenderer.opacityFromElevation}set _opacityFromElevation(e){this._accumulationRenderer.opacityFromElevation=e}get running(){return this._isRefining&&this.canAccumulate&&this._progress>0}runTask(e){for(this._prepareForShadowMapPass(this._bindParameters);!e.done&&!this._isDoneAccumulating;)this._accumulateShadow(),e.madeProgress();this._requestRender()}renderAccumulation(e,t,i,r){if(this._passParameters.linearDepthTexture=e,this._depthRange=t,this._updateCamera(i),this._bindParameters.contentCamera=r,this.notifyChange("canAccumulate"),!this.isAccumulating||!this.canAccumulate)return;(this._previewingCached||0===this._progress||this._cameraForcedForScreenshot)&&this._clear();const s=this._cameraForcedForScreenshot?this._sampleCount:Math.min(L.previewSamples,this._sampleCount-this._progress);for(let a=0;a<s;++a)this._accumulateShadow();this._cameraForcedForScreenshot=!1}render(e){this._accumulationRenderer.render(e)}dispose(){this._stop(),this._handles.destroy(),this._accumulationRenderer=o(this._accumulationRenderer),this._bindParameters.shadowMap.dispose(),this._fbo=o(this._fbo),this._vao=o(this._vao),this._accumulationTechniqueCached=n(this._accumulationTechniqueCached),this._cachedLightDirections.length=0,this._sampleCount=0}setOptions(e){void 0!==e.enabled&&(this._enabled=e.enabled),void 0!==e.previewing&&(this._previewing=e.previewing),void 0!==e.lightDirections&&(this._lightDirections=e.lightDirections),this._accumulationRenderer.setOptions(e)}set _previewing(e){this._previewingCached!==e&&(this._previewingCached=e,this._requestRenderIfEnabled())}set _lightDirections(e){this._lightDirectionsInternal=e}readAccumulatedShadow(e,t){if(!this._isActive||this._progress<1||e<0||e>this._fbo.width||t<0||t>this._fbo.height)return 0;const i=N;return this._fbo.readPixels(e,t,1,1,P.RGBA,I.UNSIGNED_BYTE,i),i[0]/this._progress}_start(){this._progress=0,this._enabledInternal=!0}_stop(){this._enabledInternal=!1}_invalidate(){this._progress=0,this._requestRenderIfEnabled()}_clear(){this._rctx.bindFramebuffer(this._fbo),this._rctx.setClearColor(0,0,0,0),this._rctx.clearSafe(M.COLOR_BUFFER_BIT),this._progress=0}_accumulateShadow(){const e=this._lightDirectionsInternal[this._progress];this._renderToShadowMap(this._bindParameters,e,this._depthRange),this._passParameters.origin=this._bindParameters.camera.center,this._rctx.bindFramebuffer(this._fbo);const t=this._accumulationTechnique;this._rctx.bindTechnique(t,this._passParameters,this._bindParameters),this._rctx.bindVAO(this._vao),this._rctx.drawArrays(t.primitiveType,0,O(this._vao,"geometry")),this._progress++}_updateCamera(e){e.equals(this._bindParameters.camera)||(this._bindParameters.camera.copyFrom(e),this._fbo.resize(e.fullWidth,e.fullHeight),this._opacityFromElevation=1-s(A,C,e.relativeElevation))}set _enabled(e){e!==this._enabledInternal&&(e?this._start():this._stop())}_requestRenderIfEnabled(){this._enabledInternal&&this._requestRender()}get test(){const e=this;return{lightDirections:this._lightDirectionsInternal,get isDone(){return e._isDoneAccumulating},get isActive(){return e._isActive}}}};B.previewSamples=6,B.renderViewHandleKey="renderView",e([_()],B.prototype,"_progress",void 0),e([_()],B.prototype,"_sampleCount",void 0),e([_()],B.prototype,"_enabledInternal",void 0),e([_()],B.prototype,"_depthRange",void 0),e([_()],B.prototype,"_previewingCached",void 0),e([_()],B.prototype,"_accumulationRenderer",void 0),e([_()],B.prototype,"_isRefining",null),e([_()],B.prototype,"_isActive",null),e([_()],B.prototype,"canAccumulate",null),e([_()],B.prototype,"_isDoneAccumulating",null),e([_()],B.prototype,"_opacityFromElevation",null),e([_()],B.prototype,"running",null),B=L=e([l("esri.views.3d.webgl-engine.lib.ShadowAccumulator")],B);const N=new Uint8Array(4);export{B as ShadowAccumulator};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.25/esri/copyright.txt for details.
4
4
  */
5
- import{clamp as t,acosClamped as e,lerp as s}from"../../../../core/mathUtils.js";import{isSome as a,disposeMaybe as i}from"../../../../core/maybe.js";import{c as r}from"../../../../chunks/mat3f64.js";import{h,m as c,x as o,a as n,u}from"../../../../chunks/mat4.js";import{c as m}from"../../../../chunks/mat4f64.js";import{s as d,i as _,b as p,m as l,j as f,a as x,h as T,n as g,f as S,c as b}from"../../../../chunks/vec2.js";import{a as w}from"../../../../chunks/vec2f64.js";import{k as M,c as C,o as D,m as E,s as j}from"../../../../chunks/vec3.js";import{c as v}from"../../../../chunks/vec3f64.js";import{s as z,t as R}from"../../../../chunks/vec4.js";import{c as U}from"../../../../chunks/vec4f64.js";import{ViewingMode as F}from"../../../ViewingMode.js";import{Camera as y}from"./Camera.js";import{assert as N,logWithBase as O,verify as A,rayRay2D as k}from"./Util.js";import{TextureType as L,ClearBufferBit as P,PixelFormat as B,PixelType as G,TextureWrapMode as I,TextureSamplingMode as X,TargetType as H,DepthStencilTargetType as Y}from"../../../webgl/enums.js";import{FramebufferObject as q}from"../../../webgl/FramebufferObject.js";import{Texture as V}from"../../../webgl/Texture.js";import{getGpuMemoryUsage as W}from"../../../webgl/Util.js";var J;!function(t){t[t.Highlight=0]="Highlight",t[t.Default=1]="Default"}(J||(J={}));class K{constructor(){this.camera=new y,this.lightMat=m()}}class Q{constructor(t,e,s=0){this._rctx=t,this._viewingMode=e,this._enabled=!1,this._snapshots=new Array,this._textureSize=0,this.maxTextureSize=0,this.numCascades=1,this.maxNumCascades=4,this.splitSchemeLambda=0,this.warp=!0,this._cascadeDistances=[0,0,0,0,0],this._usedCascadeDistances=U(),this._cascades=[new K,new K,new K,new K],this.maxTextureSize=this._rctx.parameters.maxTextureSize,this._snapshotCount=s}get depthTexture(){return this._depthTexture}get textureSize(){return this._textureSize}get cascadeDistances(){return z(this._usedCascadeDistances,this._cascadeDistances[0],this.numCascades>1?this._cascadeDistances[1]:1/0,this.numCascades>2?this._cascadeDistances[2]:1/0,this.numCascades>3?this._cascadeDistances[3]:1/0)}dispose(){this._discardDepthTexture(),this._discardAllSnapshots()}set maxCascades(e){this.maxNumCascades=t(Math.floor(e),1,4)}get maxCascades(){return this.maxNumCascades}set enabled(t){this._enabled=t,t||(this._discardDepthTexture(),this._discardAllSnapshots())}get enabled(){return this._enabled}get ready(){return this._enabled&&a(this._depthTexture)}get _snapshotCount(){return this._snapshots.length}set _snapshotCount(t){const e=this._snapshots.length;if(t>e){const s=t-e;this._snapshots.length=t;for(let t=0;t<s;++t)this._snapshots[e+t]=null}else if(t<this._snapshotCount){const s=e-t;for(let e=0;e<s;++e)this._discardSnapshot(t+e);this._snapshots.length=t}}getSnapshot(t){return this.enabled?this._snapshots[t]:null}getCascades(){for(let t=0;t<this.numCascades;++t)dt[t]=this._cascades[t];return dt.length=this.numCascades,dt}start(t,e,s){N(this.enabled),this._textureSize=this._computeTextureSize(t.fullWidth,t.fullHeight),this._ensureDepthTexture();const{near:a,far:i}=this._clampNearFar(s);this._computeCascadeDistances(i,a),this._setupMatrices(t,e);const r=t.viewMatrix,h=t.projectionMatrix;for(let c=0;c<this.numCascades;++c)this._constructCascade(c,h,r,e);this.lastOrigin=null,this.clear()}finish(t){N(this.enabled),this._rctx.bindFramebuffer(t)}getShadowMapMatrices(t){if(!this.lastOrigin||!M(t,this.lastOrigin)){this.lastOrigin=this.lastOrigin||v(),C(this.lastOrigin,t);for(let e=0;e<this.numCascades;++e){h(_t,this._cascades[e].lightMat,t);for(let t=0;t<16;++t)pt[16*e+t]=_t[t]}}return pt}takeCascadeSnapshotTo(t,e){N(this.enabled);const s=this._ensureSnapshot(e);this._bindFbo();const a=this._rctx,i=a.bindTexture(s,V.TEXTURE_UNIT_FOR_UPDATES);a.gl.copyTexSubImage2D(L.TEXTURE_2D,0,t.camera.viewport[0],t.camera.viewport[1],t.camera.viewport[0],t.camera.viewport[1],t.camera.viewport[2],t.camera.viewport[3]),a.bindTexture(i,V.TEXTURE_UNIT_FOR_UPDATES)}clear(){const t=this._rctx;this._bindFbo(),t.setClearColor(1,1,1,1),t.clearSafe(P.COLOR_BUFFER_BIT|P.DEPTH_BUFFER_BIT)}_computeTextureSize(t,e){const s=.5*Math.log(t*t+e*e)*Math.LOG2E,a=.35,i=2**Math.round(s+a);return Math.min(this.maxTextureSize,2*i)}_ensureDepthTexture(){if(a(this._depthTexture)&&this._depthTexture.descriptor.width===this._textureSize)return;this._discardDepthTexture();const t={target:L.TEXTURE_2D,pixelFormat:B.RGBA,dataType:G.UNSIGNED_BYTE,wrapMode:I.CLAMP_TO_EDGE,samplingMode:X.NEAREST,flipped:!0,width:this._textureSize,height:this._textureSize};this._depthTexture=new V(this._rctx,t),this._fbo=new q(this._rctx,{colorTarget:H.TEXTURE,depthStencilTarget:Y.DEPTH_RENDER_BUFFER,width:this._textureSize,height:this._textureSize},this._depthTexture)}_ensureSnapshot(t){let e=this._snapshots[t];if(a(e)&&e.descriptor.width===this._textureSize)return e;this._discardSnapshot(t);const s={target:L.TEXTURE_2D,pixelFormat:B.RGBA,dataType:G.UNSIGNED_BYTE,wrapMode:I.CLAMP_TO_EDGE,samplingMode:X.NEAREST,flipped:!0,width:this._textureSize,height:this._textureSize};return e=new V(this._rctx,s),this._snapshots[t]=e,e}_discardDepthTexture(){this._fbo=i(this._fbo),this._depthTexture=i(this._depthTexture)}_discardSnapshot(t){this._snapshots[t]=i(this._snapshots[t])}_discardAllSnapshots(){for(let t=0;t<this._snapshotCount;++t)this._discardSnapshot(t)}_bindFbo(){const t=this._rctx;t.unbindTexture(this._depthTexture),t.bindFramebuffer(this._fbo)}_constructCascade(t,e,s,a){const i=this._cascades[t],r=-this._cascadeDistances[t],o=-this._cascadeDistances[t+1],n=(e[10]*r+e[14])/Math.abs(e[11]*r+e[15]),u=(e[10]*o+e[14])/Math.abs(e[11]*o+e[15]);N(n<u);for(let h=0;h<8;++h){z(et,h%4==0||h%4==3?-1:1,h%4==0||h%4==1?-1:1,h<4?n:u,1),R(st[h],et,tt);for(let t=0;t<3;++t)st[h][t]/=st[h][3]}D(mt,st[0]),h(Z,ut,mt),i.camera.viewMatrix=Z;for(let h=0;h<8;++h)E(st[h],st[h],i.camera.viewMatrix);C(at,st[0]),C(it,st[0]);for(let h=1;h<8;++h)for(let t=0;t<3;++t)at[t]=Math.min(at[t],st[h][t]),it[t]=Math.max(it[t],st[h][t]);at[2]-=200,it[2]+=200,i.camera.near=-it[2],i.camera.far=-at[2],this.warp?this._constructTrapezoidalProjection(s,a,i):this._constructOrthogonalProjection(i),c(i.lightMat,i.camera.projectionMatrix,i.camera.viewMatrix);const m=this._textureSize/2;i.camera.viewport[0]=t%2==0?0:m,i.camera.viewport[1]=0===Math.floor(t/2)?0:m,i.camera.viewport[2]=m,i.camera.viewport[3]=m}_constructOrthogonalProjection(t){o(t.camera.projectionMatrix,at[0],it[0],at[1],it[1],t.camera.near,t.camera.far)}_constructTrapezoidalProjection(t,s,a){const i=1/st[0][3],r=1/st[4][3];N(i<r);let h=i+Math.sqrt(i*r);const c=Math.sin(e(t[2]*s[0]+t[6]*s[1]+t[10]*s[2]));h/=c,Dt(st,h,c,rt,ht,ct,ot,nt),Ut(rt,ht,ot,nt,a.camera.projectionMatrix),a.camera.projectionMatrix[10]=2/(at[2]-it[2]),a.camera.projectionMatrix[14]=-(at[2]+it[2])/(at[2]-it[2])}_setupMatrices(t,e){c($,t.projectionMatrix,t.viewMatrix),n(tt,$);const s=this._viewingMode===F.Global?t.eye:j(mt,0,0,1);u(ut,[0,0,0],[-e[0],-e[1],-e[2]],s)}_clampNearFar(t){let{near:e,far:s}=t;return e<2&&(e=2),s<2&&(s=2),e>=s&&(e=2,s=4),{near:e,far:s}}_computeCascadeDistances(t,e){this.numCascades=Math.min(1+Math.floor(O(t/e,4)),this.maxNumCascades);const a=(t-e)/this.numCascades,i=(t/e)**(1/this.numCascades);let r=e,h=e;for(let c=0;c<this.numCascades+1;++c)this._cascadeDistances[c]=s(r,h,this.splitSchemeLambda),r*=i,h+=a}get gpuMemoryUsage(){return this._snapshots.reduce(((t,e)=>t+W(e)),this._fbo?.gpuMemoryUsage??0)}get test(){const t=this;return{maxNumCascades:this.maxNumCascades,cascades:this._cascades,textureSize:this._textureSize,set splitSchemeLambda(e){t.splitSchemeLambda=e},get splitSchemeLambda(){return t.splitSchemeLambda},set warp(e){t.warp=e},get warp(){return t.warp}}}}const Z=m(),$=m(),tt=m(),et=U(),st=[];for(let Ft=0;Ft<8;++Ft)st.push(U());const at=v(),it=v(),rt=w(),ht=w(),ct=w(),ot=w(),nt=w(),ut=m(),mt=v(),dt=[],_t=m(),pt=new Float32Array(64),lt=w(),ft=w(),xt=[w(),w(),w(),w()],Tt=w(),gt=w(),St=w(),bt=w(),wt=w(),Mt=w(),Ct=w();function Dt(t,e,s,a,i,r,h,c){d(lt,0,0);for(let d=0;d<4;++d)_(lt,lt,t[d]);p(lt,lt,.25),d(ft,0,0);for(let d=4;d<8;++d)_(ft,ft,t[d]);p(ft,ft,.25),l(xt[0],t[4],t[5],.5),l(xt[1],t[5],t[6],.5),l(xt[2],t[6],t[7],.5),l(xt[3],t[7],t[4],.5);let o=0,n=f(xt[0],lt);for(let d=1;d<4;++d){const t=f(xt[d],lt);t<n&&(n=t,o=d)}x(Tt,xt[o],t[o+4]);const u=Tt[0];let m,w;Tt[0]=-Tt[1],Tt[1]=u,x(gt,ft,lt),T(gt,Tt)<0&&g(Tt,Tt),l(Tt,Tt,gt,s),S(Tt,Tt),m=w=T(x(St,t[0],lt),Tt);for(let d=1;d<8;++d){const e=T(x(St,t[d],lt),Tt);e<m?m=e:e>w&&(w=e)}b(a,lt),p(St,Tt,m-e),_(a,a,St);let M=-1,C=1,D=0,E=0;for(let d=0;d<8;++d){x(bt,t[d],a),S(bt,bt);const e=Tt[0]*bt[1]-Tt[1]*bt[0];e>0?e>M&&(M=e,D=d):e<C&&(C=e,E=d)}A(M>0,"leftArea"),A(C<0,"rightArea"),p(wt,Tt,m),_(wt,wt,lt),p(Mt,Tt,w),_(Mt,Mt,lt),Ct[0]=-Tt[1],Ct[1]=Tt[0];const j=k(a,t[E],Mt,_(St,Mt,Ct),1,i),v=k(a,t[D],Mt,St,1,r),z=k(a,t[D],wt,_(St,wt,Ct),1,h),R=k(a,t[E],wt,St,1,c);A(j,"rayRay"),A(v,"rayRay"),A(z,"rayRay"),A(R,"rayRay")}function Et(t,e){return 3*e+t}const jt=w();function vt(t,e){return d(jt,t[e],t[e+3]),jt}const zt=w(),Rt=r();function Ut(t,e,s,a,i){x(zt,s,a),p(zt,zt,.5),Rt[0]=zt[0],Rt[1]=zt[1],Rt[2]=0,Rt[3]=zt[1],Rt[4]=-zt[0],Rt[5]=0,Rt[6]=zt[0]*zt[0]+zt[1]*zt[1],Rt[7]=zt[0]*zt[1]-zt[1]*zt[0],Rt[8]=1,Rt[Et(0,2)]=-T(vt(Rt,0),t),Rt[Et(1,2)]=-T(vt(Rt,1),t);let r=T(vt(Rt,0),s)+Rt[Et(0,2)],h=T(vt(Rt,1),s)+Rt[Et(1,2)],c=T(vt(Rt,0),a)+Rt[Et(0,2)],o=T(vt(Rt,1),a)+Rt[Et(1,2)];r=-(r+c)/(h+o),Rt[Et(0,0)]+=Rt[Et(1,0)]*r,Rt[Et(0,1)]+=Rt[Et(1,1)]*r,Rt[Et(0,2)]+=Rt[Et(1,2)]*r,r=1/(T(vt(Rt,0),s)+Rt[Et(0,2)]),h=1/(T(vt(Rt,1),s)+Rt[Et(1,2)]),Rt[Et(0,0)]*=r,Rt[Et(0,1)]*=r,Rt[Et(0,2)]*=r,Rt[Et(1,0)]*=h,Rt[Et(1,1)]*=h,Rt[Et(1,2)]*=h,Rt[Et(2,0)]=Rt[Et(1,0)],Rt[Et(2,1)]=Rt[Et(1,1)],Rt[Et(2,2)]=Rt[Et(1,2)],Rt[Et(1,2)]+=1,r=T(vt(Rt,1),e)+Rt[Et(1,2)],h=T(vt(Rt,2),e)+Rt[Et(2,2)],c=T(vt(Rt,1),s)+Rt[Et(1,2)],o=T(vt(Rt,2),s)+Rt[Et(2,2)],r=-.5*(r/h+c/o),Rt[Et(1,0)]+=Rt[Et(2,0)]*r,Rt[Et(1,1)]+=Rt[Et(2,1)]*r,Rt[Et(1,2)]+=Rt[Et(2,2)]*r,r=T(vt(Rt,1),e)+Rt[Et(1,2)],h=T(vt(Rt,2),e)+Rt[Et(2,2)],c=-h/r,Rt[Et(1,0)]*=c,Rt[Et(1,1)]*=c,Rt[Et(1,2)]*=c,i[0]=Rt[0],i[1]=Rt[1],i[2]=0,i[3]=Rt[2],i[4]=Rt[3],i[5]=Rt[4],i[6]=0,i[7]=Rt[5],i[8]=0,i[9]=0,i[10]=1,i[11]=0,i[12]=Rt[6],i[13]=Rt[7],i[14]=0,i[15]=Rt[8]}export{Q as ShadowMap,J as SnapshotSlot};
5
+ import{clamp as t,acosClamped as e,lerp as s}from"../../../../core/mathUtils.js";import{isSome as a,disposeMaybe as i}from"../../../../core/maybe.js";import{c as r}from"../../../../chunks/mat3f64.js";import{h,m as c,x as o,a as n,u}from"../../../../chunks/mat4.js";import{c as m}from"../../../../chunks/mat4f64.js";import{s as d,j as _,b as p,l,k as f,a as x,h as T,n as g,f as S,c as b}from"../../../../chunks/vec2.js";import{a as w}from"../../../../chunks/vec2f64.js";import{k as M,c as C,o as D,m as E,s as j}from"../../../../chunks/vec3.js";import{c as v}from"../../../../chunks/vec3f64.js";import{s as z,t as R}from"../../../../chunks/vec4.js";import{c as U}from"../../../../chunks/vec4f64.js";import{ViewingMode as F}from"../../../ViewingMode.js";import{Camera as y}from"./Camera.js";import{assert as N,logWithBase as O,verify as A,rayRay2D as k}from"./Util.js";import{TextureType as L,ClearBufferBit as P,PixelFormat as B,PixelType as G,TextureWrapMode as I,TextureSamplingMode as X,TargetType as H,DepthStencilTargetType as Y}from"../../../webgl/enums.js";import{FramebufferObject as q}from"../../../webgl/FramebufferObject.js";import{Texture as V}from"../../../webgl/Texture.js";import{getGpuMemoryUsage as W}from"../../../webgl/Util.js";var J;!function(t){t[t.Highlight=0]="Highlight",t[t.Default=1]="Default"}(J||(J={}));class K{constructor(){this.camera=new y,this.lightMat=m()}}class Q{constructor(t,e,s=0){this._rctx=t,this._viewingMode=e,this._enabled=!1,this._snapshots=new Array,this._textureSize=0,this.maxTextureSize=0,this.numCascades=1,this.maxNumCascades=4,this.splitSchemeLambda=0,this.warp=!0,this._cascadeDistances=[0,0,0,0,0],this._usedCascadeDistances=U(),this._cascades=[new K,new K,new K,new K],this.maxTextureSize=this._rctx.parameters.maxTextureSize,this._snapshotCount=s}get depthTexture(){return this._depthTexture}get textureSize(){return this._textureSize}get cascadeDistances(){return z(this._usedCascadeDistances,this._cascadeDistances[0],this.numCascades>1?this._cascadeDistances[1]:1/0,this.numCascades>2?this._cascadeDistances[2]:1/0,this.numCascades>3?this._cascadeDistances[3]:1/0)}dispose(){this._discardDepthTexture(),this._discardAllSnapshots()}set maxCascades(e){this.maxNumCascades=t(Math.floor(e),1,4)}get maxCascades(){return this.maxNumCascades}set enabled(t){this._enabled=t,t||(this._discardDepthTexture(),this._discardAllSnapshots())}get enabled(){return this._enabled}get ready(){return this._enabled&&a(this._depthTexture)}get _snapshotCount(){return this._snapshots.length}set _snapshotCount(t){const e=this._snapshots.length;if(t>e){const s=t-e;this._snapshots.length=t;for(let t=0;t<s;++t)this._snapshots[e+t]=null}else if(t<this._snapshotCount){const s=e-t;for(let e=0;e<s;++e)this._discardSnapshot(t+e);this._snapshots.length=t}}getSnapshot(t){return this.enabled?this._snapshots[t]:null}getCascades(){for(let t=0;t<this.numCascades;++t)dt[t]=this._cascades[t];return dt.length=this.numCascades,dt}start(t,e,s){N(this.enabled),this._textureSize=this._computeTextureSize(t.fullWidth,t.fullHeight),this._ensureDepthTexture();const{near:a,far:i}=this._clampNearFar(s);this._computeCascadeDistances(i,a),this._setupMatrices(t,e);const r=t.viewMatrix,h=t.projectionMatrix;for(let c=0;c<this.numCascades;++c)this._constructCascade(c,h,r,e);this.lastOrigin=null,this.clear()}finish(t){N(this.enabled),this._rctx.bindFramebuffer(t)}getShadowMapMatrices(t){if(!this.lastOrigin||!M(t,this.lastOrigin)){this.lastOrigin=this.lastOrigin||v(),C(this.lastOrigin,t);for(let e=0;e<this.numCascades;++e){h(_t,this._cascades[e].lightMat,t);for(let t=0;t<16;++t)pt[16*e+t]=_t[t]}}return pt}takeCascadeSnapshotTo(t,e){N(this.enabled);const s=this._ensureSnapshot(e);this._bindFbo();const a=this._rctx,i=a.bindTexture(s,V.TEXTURE_UNIT_FOR_UPDATES);a.gl.copyTexSubImage2D(L.TEXTURE_2D,0,t.camera.viewport[0],t.camera.viewport[1],t.camera.viewport[0],t.camera.viewport[1],t.camera.viewport[2],t.camera.viewport[3]),a.bindTexture(i,V.TEXTURE_UNIT_FOR_UPDATES)}clear(){const t=this._rctx;this._bindFbo(),t.setClearColor(1,1,1,1),t.clearSafe(P.COLOR_BUFFER_BIT|P.DEPTH_BUFFER_BIT)}_computeTextureSize(t,e){const s=.5*Math.log(t*t+e*e)*Math.LOG2E,a=.35,i=2**Math.round(s+a);return Math.min(this.maxTextureSize,2*i)}_ensureDepthTexture(){if(a(this._depthTexture)&&this._depthTexture.descriptor.width===this._textureSize)return;this._discardDepthTexture();const t={target:L.TEXTURE_2D,pixelFormat:B.RGBA,dataType:G.UNSIGNED_BYTE,wrapMode:I.CLAMP_TO_EDGE,samplingMode:X.NEAREST,flipped:!0,width:this._textureSize,height:this._textureSize};this._depthTexture=new V(this._rctx,t),this._fbo=new q(this._rctx,{colorTarget:H.TEXTURE,depthStencilTarget:Y.DEPTH_RENDER_BUFFER,width:this._textureSize,height:this._textureSize},this._depthTexture)}_ensureSnapshot(t){let e=this._snapshots[t];if(a(e)&&e.descriptor.width===this._textureSize)return e;this._discardSnapshot(t);const s={target:L.TEXTURE_2D,pixelFormat:B.RGBA,dataType:G.UNSIGNED_BYTE,wrapMode:I.CLAMP_TO_EDGE,samplingMode:X.NEAREST,flipped:!0,width:this._textureSize,height:this._textureSize};return e=new V(this._rctx,s),this._snapshots[t]=e,e}_discardDepthTexture(){this._fbo=i(this._fbo),this._depthTexture=i(this._depthTexture)}_discardSnapshot(t){this._snapshots[t]=i(this._snapshots[t])}_discardAllSnapshots(){for(let t=0;t<this._snapshotCount;++t)this._discardSnapshot(t)}_bindFbo(){const t=this._rctx;t.unbindTexture(this._depthTexture),t.bindFramebuffer(this._fbo)}_constructCascade(t,e,s,a){const i=this._cascades[t],r=-this._cascadeDistances[t],o=-this._cascadeDistances[t+1],n=(e[10]*r+e[14])/Math.abs(e[11]*r+e[15]),u=(e[10]*o+e[14])/Math.abs(e[11]*o+e[15]);N(n<u);for(let h=0;h<8;++h){z(et,h%4==0||h%4==3?-1:1,h%4==0||h%4==1?-1:1,h<4?n:u,1),R(st[h],et,tt);for(let t=0;t<3;++t)st[h][t]/=st[h][3]}D(mt,st[0]),h(Z,ut,mt),i.camera.viewMatrix=Z;for(let h=0;h<8;++h)E(st[h],st[h],i.camera.viewMatrix);C(at,st[0]),C(it,st[0]);for(let h=1;h<8;++h)for(let t=0;t<3;++t)at[t]=Math.min(at[t],st[h][t]),it[t]=Math.max(it[t],st[h][t]);at[2]-=200,it[2]+=200,i.camera.near=-it[2],i.camera.far=-at[2],this.warp?this._constructTrapezoidalProjection(s,a,i):this._constructOrthogonalProjection(i),c(i.lightMat,i.camera.projectionMatrix,i.camera.viewMatrix);const m=this._textureSize/2;i.camera.viewport[0]=t%2==0?0:m,i.camera.viewport[1]=0===Math.floor(t/2)?0:m,i.camera.viewport[2]=m,i.camera.viewport[3]=m}_constructOrthogonalProjection(t){o(t.camera.projectionMatrix,at[0],it[0],at[1],it[1],t.camera.near,t.camera.far)}_constructTrapezoidalProjection(t,s,a){const i=1/st[0][3],r=1/st[4][3];N(i<r);let h=i+Math.sqrt(i*r);const c=Math.sin(e(t[2]*s[0]+t[6]*s[1]+t[10]*s[2]));h/=c,Dt(st,h,c,rt,ht,ct,ot,nt),Ut(rt,ht,ot,nt,a.camera.projectionMatrix),a.camera.projectionMatrix[10]=2/(at[2]-it[2]),a.camera.projectionMatrix[14]=-(at[2]+it[2])/(at[2]-it[2])}_setupMatrices(t,e){c($,t.projectionMatrix,t.viewMatrix),n(tt,$);const s=this._viewingMode===F.Global?t.eye:j(mt,0,0,1);u(ut,[0,0,0],[-e[0],-e[1],-e[2]],s)}_clampNearFar(t){let{near:e,far:s}=t;return e<2&&(e=2),s<2&&(s=2),e>=s&&(e=2,s=4),{near:e,far:s}}_computeCascadeDistances(t,e){this.numCascades=Math.min(1+Math.floor(O(t/e,4)),this.maxNumCascades);const a=(t-e)/this.numCascades,i=(t/e)**(1/this.numCascades);let r=e,h=e;for(let c=0;c<this.numCascades+1;++c)this._cascadeDistances[c]=s(r,h,this.splitSchemeLambda),r*=i,h+=a}get gpuMemoryUsage(){return this._snapshots.reduce(((t,e)=>t+W(e)),this._fbo?.gpuMemoryUsage??0)}get test(){const t=this;return{maxNumCascades:this.maxNumCascades,cascades:this._cascades,textureSize:this._textureSize,set splitSchemeLambda(e){t.splitSchemeLambda=e},get splitSchemeLambda(){return t.splitSchemeLambda},set warp(e){t.warp=e},get warp(){return t.warp}}}}const Z=m(),$=m(),tt=m(),et=U(),st=[];for(let Ft=0;Ft<8;++Ft)st.push(U());const at=v(),it=v(),rt=w(),ht=w(),ct=w(),ot=w(),nt=w(),ut=m(),mt=v(),dt=[],_t=m(),pt=new Float32Array(64),lt=w(),ft=w(),xt=[w(),w(),w(),w()],Tt=w(),gt=w(),St=w(),bt=w(),wt=w(),Mt=w(),Ct=w();function Dt(t,e,s,a,i,r,h,c){d(lt,0,0);for(let d=0;d<4;++d)_(lt,lt,t[d]);p(lt,lt,.25),d(ft,0,0);for(let d=4;d<8;++d)_(ft,ft,t[d]);p(ft,ft,.25),l(xt[0],t[4],t[5],.5),l(xt[1],t[5],t[6],.5),l(xt[2],t[6],t[7],.5),l(xt[3],t[7],t[4],.5);let o=0,n=f(xt[0],lt);for(let d=1;d<4;++d){const t=f(xt[d],lt);t<n&&(n=t,o=d)}x(Tt,xt[o],t[o+4]);const u=Tt[0];let m,w;Tt[0]=-Tt[1],Tt[1]=u,x(gt,ft,lt),T(gt,Tt)<0&&g(Tt,Tt),l(Tt,Tt,gt,s),S(Tt,Tt),m=w=T(x(St,t[0],lt),Tt);for(let d=1;d<8;++d){const e=T(x(St,t[d],lt),Tt);e<m?m=e:e>w&&(w=e)}b(a,lt),p(St,Tt,m-e),_(a,a,St);let M=-1,C=1,D=0,E=0;for(let d=0;d<8;++d){x(bt,t[d],a),S(bt,bt);const e=Tt[0]*bt[1]-Tt[1]*bt[0];e>0?e>M&&(M=e,D=d):e<C&&(C=e,E=d)}A(M>0,"leftArea"),A(C<0,"rightArea"),p(wt,Tt,m),_(wt,wt,lt),p(Mt,Tt,w),_(Mt,Mt,lt),Ct[0]=-Tt[1],Ct[1]=Tt[0];const j=k(a,t[E],Mt,_(St,Mt,Ct),1,i),v=k(a,t[D],Mt,St,1,r),z=k(a,t[D],wt,_(St,wt,Ct),1,h),R=k(a,t[E],wt,St,1,c);A(j,"rayRay"),A(v,"rayRay"),A(z,"rayRay"),A(R,"rayRay")}function Et(t,e){return 3*e+t}const jt=w();function vt(t,e){return d(jt,t[e],t[e+3]),jt}const zt=w(),Rt=r();function Ut(t,e,s,a,i){x(zt,s,a),p(zt,zt,.5),Rt[0]=zt[0],Rt[1]=zt[1],Rt[2]=0,Rt[3]=zt[1],Rt[4]=-zt[0],Rt[5]=0,Rt[6]=zt[0]*zt[0]+zt[1]*zt[1],Rt[7]=zt[0]*zt[1]-zt[1]*zt[0],Rt[8]=1,Rt[Et(0,2)]=-T(vt(Rt,0),t),Rt[Et(1,2)]=-T(vt(Rt,1),t);let r=T(vt(Rt,0),s)+Rt[Et(0,2)],h=T(vt(Rt,1),s)+Rt[Et(1,2)],c=T(vt(Rt,0),a)+Rt[Et(0,2)],o=T(vt(Rt,1),a)+Rt[Et(1,2)];r=-(r+c)/(h+o),Rt[Et(0,0)]+=Rt[Et(1,0)]*r,Rt[Et(0,1)]+=Rt[Et(1,1)]*r,Rt[Et(0,2)]+=Rt[Et(1,2)]*r,r=1/(T(vt(Rt,0),s)+Rt[Et(0,2)]),h=1/(T(vt(Rt,1),s)+Rt[Et(1,2)]),Rt[Et(0,0)]*=r,Rt[Et(0,1)]*=r,Rt[Et(0,2)]*=r,Rt[Et(1,0)]*=h,Rt[Et(1,1)]*=h,Rt[Et(1,2)]*=h,Rt[Et(2,0)]=Rt[Et(1,0)],Rt[Et(2,1)]=Rt[Et(1,1)],Rt[Et(2,2)]=Rt[Et(1,2)],Rt[Et(1,2)]+=1,r=T(vt(Rt,1),e)+Rt[Et(1,2)],h=T(vt(Rt,2),e)+Rt[Et(2,2)],c=T(vt(Rt,1),s)+Rt[Et(1,2)],o=T(vt(Rt,2),s)+Rt[Et(2,2)],r=-.5*(r/h+c/o),Rt[Et(1,0)]+=Rt[Et(2,0)]*r,Rt[Et(1,1)]+=Rt[Et(2,1)]*r,Rt[Et(1,2)]+=Rt[Et(2,2)]*r,r=T(vt(Rt,1),e)+Rt[Et(1,2)],h=T(vt(Rt,2),e)+Rt[Et(2,2)],c=-h/r,Rt[Et(1,0)]*=c,Rt[Et(1,1)]*=c,Rt[Et(1,2)]*=c,i[0]=Rt[0],i[1]=Rt[1],i[2]=0,i[3]=Rt[2],i[4]=Rt[3],i[5]=Rt[4],i[6]=0,i[7]=Rt[5],i[8]=0,i[9]=0,i[10]=1,i[11]=0,i[12]=Rt[6],i[13]=Rt[7],i[14]=0,i[15]=Rt[8]}export{Q as ShadowMap,J as SnapshotSlot};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.25/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../chunks/tslib.es6.js";import r from"../../../../core/Accessor.js";import{someMap as t}from"../../../../core/MapUtils.js";import{unwrap as s,isSome as i,isNone as a}from"../../../../core/maybe.js";import n from"../../../../core/PooledArray.js";import{property as o}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as d}from"../../../../core/accessorSupport/decorators/subclass.js";import{c as h}from"../../../../chunks/vec3f64.js";import{ChangeSet as l}from"./ChangeSet.js";import{newIntersectorResult as c}from"./Intersector.js";import{StoreResults as m,IntersectorType as p}from"./IntersectorInterfaces.js";import{ModelDirty as g}from"./ModelDirtyTypes.js";import{splitRenderGeometryChangeSetByMaterial as u}from"./rendererUtils.js";import{MergedRenderer as _}from"../materials/renderers/MergedRenderer.js";let y=class extends r{constructor(e){super(e),this._pending=new f,this._changes=new l,this._materialRenderers=new Map,this._sortedMaterialRenderers=new n,this._geometries=new Map,this._hasHighlights=!1,this._hasWater=!1}destroy(){this._changes.prune(),this._materialRenderers.forEach((e=>e.dispose())),this._materialRenderers.clear(),this._sortedMaterialRenderers.clear(),this._geometries.clear()}get updating(){return!this._pending.empty||this._changes.updates.length>0}get rctx(){return this.rendererContext.rctx}get _materialRepository(){return this.rendererContext.materialRepository}get _localOriginFactory(){return this.rendererContext.localOriginFactory}get hasHighlights(){return this._hasHighlights}get hasWater(){return this._hasWater}get rendersOccluded(){return t(this._materialRenderers,(e=>e.rendersOccluded))}get isEmpty(){return!this.updating&&0===this._materialRenderers.size&&0===this._geometries.size}commitChanges(){if(!this.updating)return!1;this._processAddsRemoves();const e=u(this._changes);let r=!1,s=!1,i=!1;return e.forEach(((e,t)=>{let a=this._materialRenderers.get(t);if(!a&&e.adds.length>0&&(a=new _(this.rctx,this._materialRepository,t),this._materialRenderers.set(t,a),r=!0,s=!0,i=!0),!a)return;const n=s||a.hasHighlights,o=i||a.hasWater;a.modify(e),s=s||n!==a.hasHighlights,i=i||o!==a.hasWater,a.isEmpty&&(this._materialRenderers.delete(t),a.dispose(),r=!0)})),this._changes.clear(),r&&this._updateSortedMaterialRenderers(),s&&(this._hasHighlights=t(this._materialRenderers,(e=>e.hasHighlights))),i&&(this._hasWater=t(this._materialRenderers,(e=>e.hasWater))),this.notifyChange("updating"),!0}addGeometries(e,r){if(0===e.length)return;const t=this._validateRenderGeometries(e);for(const i of t)this._geometries.set(i.id,i);const s=this._pending.empty;for(const i of t)this._pending.adds.add(i);s&&this.notifyChange("updating"),r===g.Geometry.UPDATE&&this._notifyGraphicGeometryChanged(e)}removeGeometries(e,r){const t=this._pending.empty,i=this._pending.adds;for(const a of e)i.has(a)?(this._pending.removed.add(a),i.delete(a)):this._pending.removed.has(a)||this._pending.removes.add(a),this._geometries.delete(s(a.id));t&&!this._pending.empty&&this.notifyChange("updating"),r===g.Geometry.UPDATE&&this._notifyGraphicGeometryChanged(e)}modifyGeometries(e,r){const t=0===this._changes.updates.length;for(const s of e){const e=this._changes.updates.pushNew();e.renderGeometry=this._validateRenderGeometry(s),e.updateType=r}switch(t&&this._changes.updates.length>0&&this.notifyChange("updating"),r){case g.State.TRANSFORMATION:case g.State.VERTEXATTRS:return this._notifyGraphicGeometryChanged(e);case g.State.VISIBILITIES:return this._notifyGraphicVisibilityChanged(e)}}updateAnimation(e){let r=!1;return this._sortedMaterialRenderers.forAll((({materialRenderer:t})=>r=t.updateAnimation(e)||r)),r}render(e,r){for(let t=0;t<this._sortedMaterialRenderers.length;t++){const s=this._sortedMaterialRenderers.data[t];s.material.shouldRender(e)&&s.materialRenderer.render(e.pass,r)}}intersect(e,r,t,s,i){return this._geometries.forEach((a=>{if(s&&!s(a))return;this._intersectRenderGeometry(a,t,r,0,e,i);const n=this.rendererContext.longitudeCyclical;n&&(a.boundingSphere[0]-a.boundingSphere[3]<n.min&&this._intersectRenderGeometry(a,t,r,n.range,e,i),a.boundingSphere[0]+a.boundingSphere[3]>n.max&&this._intersectRenderGeometry(a,t,r,-n.range,e,i)),i++})),i}_updateSortedMaterialRenderers(){this._sortedMaterialRenderers.clear();let e=0;this._materialRenderers.forEach(((r,t)=>{t.insertOrder=e++,this._sortedMaterialRenderers.push({material:t,materialRenderer:r})})),this._sortedMaterialRenderers.sort(((e,r)=>{const t=r.material.renderPriority-e.material.renderPriority;return 0!==t?t:e.material.insertOrder-r.material.insertOrder}))}_processAddsRemoves(){this._changes.adds.clear(),this._changes.removes.clear(),this._changes.adds.pushArray(Array.from(this._pending.adds)),this._changes.removes.pushArray(Array.from(this._pending.removes));for(let e=0;e<this._changes.updates.length;){const r=this._changes.updates.data[e];this._pending.has(r.renderGeometry)?this._changes.updates.removeUnorderedIndex(e):e++}this._pending.clear()}_intersectRenderGeometry(e,r,t,s,a,n){if(!e.instanceParameters.visible)return;let o=0;i(e.transformation)&&(s+=e.transformation[12],o=e.transformation[13]),G[0]=t[0]-s,G[1]=t[1]-o,G[2]=1,S[0]=t[0]-s,S[1]=t[1]-o,S[2]=0,e.screenToWorldRatio=this.rendererContext.screenToWorldRatio,e.material.intersect(e,null,e.getShaderTransformation(),a,G,S,((t,s,i)=>{R(r,i,e.material.renderPriority,n,a,e.layerUid,e.graphicUid)}),e.calculateShaderTransformation,r)}_notifyGraphicGeometryChanged(e){if(a(this.drapeSource.notifyGraphicGeometryChanged))return;let r;for(const t of e){const e=t.graphicUid;i(e)&&e!==r&&(this.drapeSource.notifyGraphicGeometryChanged(e),r=e)}}_notifyGraphicVisibilityChanged(e){if(a(this.drapeSource.notifyGraphicVisibilityChanged))return;let r;for(const t of e){const e=t.graphicUid;i(e)&&e!==r&&(this.drapeSource.notifyGraphicVisibilityChanged(e),r=e)}}_validateRenderGeometries(e){for(const r of e)this._validateRenderGeometry(r);return e}_validateRenderGeometry(e){return a(e.origin)&&(e.origin=this._localOriginFactory.getOrigin(e.boundingSphere)),e}get test(){return{sortedMaterialRenderers:this._sortedMaterialRenderers}}};e([o()],y.prototype,"drapeSource",void 0),e([o()],y.prototype,"updating",null),e([o()],y.prototype,"rctx",null),e([o()],y.prototype,"rendererContext",void 0),e([o()],y.prototype,"_materialRepository",null),e([o()],y.prototype,"_localOriginFactory",null),y=e([d("esri.views.3d.webgl-engine.lib.SortedRenderGeometryRenderer")],y);class f{constructor(){this.adds=new Set,this.removes=new Set,this.removed=new Set}get empty(){return 0===this.adds.size&&0===this.removes.size&&0===this.removed.size}has(e){return this.adds.has(e)||this.removes.has(e)||this.removed.has(e)}clear(){this.adds.clear(),this.removes.clear(),this.removed.clear()}}function R(e,r,t,s,i,a,n){const o={layerUid:a,graphicUid:n,triangleNr:r},d=r=>{r.set(p.OVERLAY,o,e.dist,e.normal,e.transformation,t,s)};if((null==i.results.min.drapedLayerOrder||t>=i.results.min.drapedLayerOrder)&&(null==i.results.min.dist||i.results.ground.dist<=i.results.min.dist)&&d(i.results.min),i.options.store!==m.MIN&&(null==i.results.max.drapedLayerOrder||t<i.results.max.drapedLayerOrder)&&(null==i.results.max.dist||i.results.ground.dist>i.results.max.dist)&&d(i.results.max),i.options.store===m.ALL){const e=c(i.ray);d(e),i.results.all.push(e)}}const G=h(),S=h();export{y as SortedRenderGeometryRenderer};
5
+ import{_ as e}from"../../../../chunks/tslib.es6.js";import r from"../../../../core/Accessor.js";import{someMap as t}from"../../../../core/MapUtils.js";import{unwrap as s,isSome as i,isNone as a}from"../../../../core/maybe.js";import n from"../../../../core/PooledArray.js";import{property as o}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as d}from"../../../../core/accessorSupport/decorators/subclass.js";import{c as h}from"../../../../chunks/vec3f64.js";import{ChangeSet as l}from"./ChangeSet.js";import{newIntersectorResult as c}from"./Intersector.js";import{StoreResults as m,IntersectorType as p}from"./IntersectorInterfaces.js";import{ModelDirty as g}from"./ModelDirtyTypes.js";import{splitRenderGeometryChangeSetByMaterial as u}from"./rendererUtils.js";import{MergedRenderer as _}from"../materials/renderers/MergedRenderer.js";let y=class extends r{constructor(e){super(e),this._pending=new f,this._changes=new l,this._materialRenderers=new Map,this._sortedMaterialRenderers=new n,this._geometries=new Map,this._hasHighlights=!1,this._hasWater=!1}destroy(){this._changes.prune(),this._materialRenderers.forEach((e=>e.dispose())),this._materialRenderers.clear(),this._sortedMaterialRenderers.clear(),this._geometries.clear()}get updating(){return!this._pending.empty||this._changes.updates.length>0}get rctx(){return this.rendererContext.rctx}get _materialRepository(){return this.rendererContext.materialRepository}get _localOriginFactory(){return this.rendererContext.localOriginFactory}get hasHighlights(){return this._hasHighlights}get hasWater(){return this._hasWater}get rendersOccluded(){return t(this._materialRenderers,(e=>e.rendersOccluded))}get isEmpty(){return!this.updating&&0===this._materialRenderers.size&&0===this._geometries.size}commitChanges(){if(!this.updating)return!1;this._processAddsRemoves();const e=u(this._changes);let r=!1,s=!1,i=!1;return e.forEach(((e,t)=>{let a=this._materialRenderers.get(t);if(!a&&e.adds.length>0&&(a=new _(this.rctx,this._materialRepository,t),this._materialRenderers.set(t,a),r=!0,s=!0,i=!0),!a)return;const n=s||a.hasHighlights,o=i||a.hasWater;a.modify(e),s=s||n!==a.hasHighlights,i=i||o!==a.hasWater,a.isEmpty&&(this._materialRenderers.delete(t),a.dispose(),r=!0)})),this._changes.clear(),r&&this._updateSortedMaterialRenderers(),s&&(this._hasHighlights=t(this._materialRenderers,(e=>e.hasHighlights))),i&&(this._hasWater=t(this._materialRenderers,(e=>e.hasWater))),this.notifyChange("updating"),!0}addGeometries(e,r){if(0===e.length)return;const t=this._validateRenderGeometries(e);for(const i of t)this._geometries.set(i.id,i);const s=this._pending.empty;for(const i of t)this._pending.adds.add(i);s&&this.notifyChange("updating"),r===g.Geometry.UPDATE&&this._notifyGraphicGeometryChanged(e)}removeGeometries(e,r){const t=this._pending.empty,i=this._pending.adds;for(const a of e)i.has(a)?(this._pending.removed.add(a),i.delete(a)):this._pending.removed.has(a)||this._pending.removes.add(a),this._geometries.delete(s(a.id));t&&!this._pending.empty&&this.notifyChange("updating"),r===g.Geometry.UPDATE&&this._notifyGraphicGeometryChanged(e)}modifyGeometries(e,r){const t=0===this._changes.updates.length;for(const s of e){const e=this._changes.updates.pushNew();e.renderGeometry=this._validateRenderGeometry(s),e.updateType=r}switch(t&&this._changes.updates.length>0&&this.notifyChange("updating"),r){case g.State.TRANSFORMATION:case g.State.VERTEXATTRS:return this._notifyGraphicGeometryChanged(e);case g.State.VISIBILITIES:return this._notifyGraphicVisibilityChanged(e)}}updateAnimation(e){let r=!1;return this._sortedMaterialRenderers.forAll((({materialRenderer:t})=>r=t.updateAnimation(e)||r)),r}render(e,r){for(let t=0;t<this._sortedMaterialRenderers.length;t++){const s=this._sortedMaterialRenderers.data[t];s.material.shouldRender(e)&&s.materialRenderer.render(e.output,r)}}intersect(e,r,t,s,i){return this._geometries.forEach((a=>{if(s&&!s(a))return;this._intersectRenderGeometry(a,t,r,0,e,i);const n=this.rendererContext.longitudeCyclical;n&&(a.boundingSphere[0]-a.boundingSphere[3]<n.min&&this._intersectRenderGeometry(a,t,r,n.range,e,i),a.boundingSphere[0]+a.boundingSphere[3]>n.max&&this._intersectRenderGeometry(a,t,r,-n.range,e,i)),i++})),i}_updateSortedMaterialRenderers(){this._sortedMaterialRenderers.clear();let e=0;this._materialRenderers.forEach(((r,t)=>{t.insertOrder=e++,this._sortedMaterialRenderers.push({material:t,materialRenderer:r})})),this._sortedMaterialRenderers.sort(((e,r)=>{const t=r.material.renderPriority-e.material.renderPriority;return 0!==t?t:e.material.insertOrder-r.material.insertOrder}))}_processAddsRemoves(){this._changes.adds.clear(),this._changes.removes.clear(),this._changes.adds.pushArray(Array.from(this._pending.adds)),this._changes.removes.pushArray(Array.from(this._pending.removes));for(let e=0;e<this._changes.updates.length;){const r=this._changes.updates.data[e];this._pending.has(r.renderGeometry)?this._changes.updates.removeUnorderedIndex(e):e++}this._pending.clear()}_intersectRenderGeometry(e,r,t,s,a,n){if(!e.instanceParameters.visible)return;let o=0;i(e.transformation)&&(s+=e.transformation[12],o=e.transformation[13]),G[0]=t[0]-s,G[1]=t[1]-o,G[2]=1,S[0]=t[0]-s,S[1]=t[1]-o,S[2]=0,e.screenToWorldRatio=this.rendererContext.screenToWorldRatio,e.material.intersect(e,null,e.getShaderTransformation(),a,G,S,((t,s,i)=>{R(r,i,e.material.renderPriority,n,a,e.layerUid,e.graphicUid)}),e.calculateShaderTransformation,r)}_notifyGraphicGeometryChanged(e){if(a(this.drapeSource.notifyGraphicGeometryChanged))return;let r;for(const t of e){const e=t.graphicUid;i(e)&&e!==r&&(this.drapeSource.notifyGraphicGeometryChanged(e),r=e)}}_notifyGraphicVisibilityChanged(e){if(a(this.drapeSource.notifyGraphicVisibilityChanged))return;let r;for(const t of e){const e=t.graphicUid;i(e)&&e!==r&&(this.drapeSource.notifyGraphicVisibilityChanged(e),r=e)}}_validateRenderGeometries(e){for(const r of e)this._validateRenderGeometry(r);return e}_validateRenderGeometry(e){return a(e.origin)&&(e.origin=this._localOriginFactory.getOrigin(e.boundingSphere)),e}get test(){return{sortedMaterialRenderers:this._sortedMaterialRenderers}}};e([o()],y.prototype,"drapeSource",void 0),e([o()],y.prototype,"updating",null),e([o()],y.prototype,"rctx",null),e([o()],y.prototype,"rendererContext",void 0),e([o()],y.prototype,"_materialRepository",null),e([o()],y.prototype,"_localOriginFactory",null),y=e([d("esri.views.3d.webgl-engine.lib.SortedRenderGeometryRenderer")],y);class f{constructor(){this.adds=new Set,this.removes=new Set,this.removed=new Set}get empty(){return 0===this.adds.size&&0===this.removes.size&&0===this.removed.size}has(e){return this.adds.has(e)||this.removes.has(e)||this.removed.has(e)}clear(){this.adds.clear(),this.removes.clear(),this.removed.clear()}}function R(e,r,t,s,i,a,n){const o={layerUid:a,graphicUid:n,triangleNr:r},d=r=>{r.set(p.OVERLAY,o,e.dist,e.normal,e.transformation,t,s)};if((null==i.results.min.drapedLayerOrder||t>=i.results.min.drapedLayerOrder)&&(null==i.results.min.dist||i.results.ground.dist<=i.results.min.dist)&&d(i.results.min),i.options.store!==m.MIN&&(null==i.results.max.drapedLayerOrder||t<i.results.max.drapedLayerOrder)&&(null==i.results.max.dist||i.results.ground.dist>i.results.max.dist)&&d(i.results.max),i.options.store===m.ALL){const e=c(i.ray);d(e),i.results.all.push(e)}}const G=h(),S=h();export{y as SortedRenderGeometryRenderer};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.25/esri/copyright.txt for details.
4
4
  */
5
- import{a as e}from"../../../../chunks/TextureOnly.glsl.js";import{ReloadableShaderModule as r}from"../core/shaderTechnique/ReloadableShaderModule.js";import{ShaderTechnique as i}from"../core/shaderTechnique/ShaderTechnique.js";import{Default3D as o}from"./DefaultVertexAttributeLocations.js";import{Program as t}from"./Program.js";import{BlendFactor as s}from"../../../webgl/enums.js";import{makePipelineState as a,separateBlendingParams as l,defaultColorWriteParams as n}from"../../../webgl/renderState.js";class m extends i{initializeProgram(e){const r=m.shader.get();return new t(e.rctx,r.build(),o)}initializePipeline(){return this.configuration.hasAlpha?a({blending:l(s.SRC_ALPHA,s.ONE,s.ONE_MINUS_SRC_ALPHA,s.ONE_MINUS_SRC_ALPHA),colorWrite:n}):a({colorWrite:n})}}m.shader=new r(e,(()=>import("../core/shaderLibrary/util/TextureOnly.glsl.js")));export{m as TextureTechnique};
5
+ import{a as e}from"../../../../chunks/TextureOnly.glsl.js";import{ReloadableShaderModule as r}from"../core/shaderTechnique/ReloadableShaderModule.js";import{ShaderTechnique as i}from"../core/shaderTechnique/ShaderTechnique.js";import{Default3D as o}from"./DefaultVertexAttributeLocations.js";import{Program as t}from"./Program.js";import{BlendFactor as s}from"../../../webgl/enums.js";import{makePipelineState as a,separateBlendingParams as l,defaultColorWriteParams as n}from"../../../webgl/renderState.js";class m extends i{initializeProgram(e){return new t(e.rctx,m.shader.get().build(),o)}initializePipeline(){return this.configuration.hasAlpha?a({blending:l(s.SRC_ALPHA,s.ONE,s.ONE_MINUS_SRC_ALPHA,s.ONE_MINUS_SRC_ALPHA),colorWrite:n}):a({colorWrite:n})}}m.shader=new r(e,(()=>import("../core/shaderLibrary/util/TextureOnly.glsl.js")));export{m as TextureTechnique};
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/4.25/esri/copyright.txt for details.
4
+ */
5
+ var o;!function(o){o[o.Color=0]="Color",o[o.Alpha=1]="Alpha",o[o.FrontFace=2]="FrontFace",o[o.NONE=3]="NONE",o[o.COUNT=4]="COUNT"}(o||(o={}));export{o as TransparencyPassType};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.25/esri/copyright.txt for details.
4
4
  */
5
- var n,e,N,O,t,a,i,o,u,l,C,c,A;!function(n){n[n.None=0]="None",n[n.Front=1]="Front",n[n.Back=2]="Back",n[n.COUNT=3]="COUNT"}(n||(n={})),function(n){n[n.Less=0]="Less",n[n.Lequal=1]="Lequal",n[n.COUNT=2]="COUNT"}(e||(e={})),function(n){n[n.Color=0]="Color",n[n.Alpha=1]="Alpha",n[n.FrontFace=2]="FrontFace",n[n.NONE=3]="NONE",n[n.COUNT=4]="COUNT"}(N||(N={})),function(n){n[n.BACKGROUND=0]="BACKGROUND",n[n.UPDATE=1]="UPDATE"}(O||(O={})),function(n){n[n.NOT_LOADED=0]="NOT_LOADED",n[n.LOADING=1]="LOADING",n[n.LOADED=2]="LOADED"}(t||(t={})),function(n){n[n.IntegratedMeshMaskExcluded=1]="IntegratedMeshMaskExcluded",n[n.OutlineVisualElementMask=2]="OutlineVisualElementMask"}(a||(a={})),function(n){n[n.ASYNC=0]="ASYNC",n[n.SYNC=1]="SYNC"}(i||(i={})),function(n){n[n.Highlight=0]="Highlight",n[n.MaskOccludee=1]="MaskOccludee",n[n.COUNT=2]="COUNT"}(o||(o={})),function(n){n[n.Triangle=0]="Triangle",n[n.Point=1]="Point",n[n.Line=2]="Line"}(u||(u={})),function(n){n[n.STRETCH=1]="STRETCH",n[n.PAD=2]="PAD"}(l||(l={})),function(n){n[n.CHANGED=0]="CHANGED",n[n.UNCHANGED=1]="UNCHANGED"}(C||(C={})),function(n){n[n.Blend=0]="Blend",n[n.Opaque=1]="Opaque",n[n.Mask=2]="Mask",n[n.MaskBlend=3]="MaskBlend",n[n.COUNT=4]="COUNT"}(c||(c={})),function(n){n[n.OFF=0]="OFF",n[n.ON=1]="ON"}(A||(A={}));export{c as AlphaDiscardMode,n as CullFaceOptions,A as Decorations,e as DepthTestFunction,o as Object3DState,l as PowerOfTwoResizeMode,u as PrimitiveType,O as RenderRequestType,t as ResourceState,a as StencilBits,N as TransparencyPassType,i as UpdatePolicy,C as ValidationState};
5
+ var n,e,N,O,t,i,u,a,c,l,C,D;!function(n){n[n.None=0]="None",n[n.Front=1]="Front",n[n.Back=2]="Back",n[n.COUNT=3]="COUNT"}(n||(n={})),function(n){n[n.Less=0]="Less",n[n.Lequal=1]="Lequal",n[n.COUNT=2]="COUNT"}(e||(e={})),function(n){n[n.BACKGROUND=0]="BACKGROUND",n[n.UPDATE=1]="UPDATE"}(N||(N={})),function(n){n[n.NOT_LOADED=0]="NOT_LOADED",n[n.LOADING=1]="LOADING",n[n.LOADED=2]="LOADED"}(O||(O={})),function(n){n[n.IntegratedMeshMaskExcluded=1]="IntegratedMeshMaskExcluded",n[n.OutlineVisualElementMask=2]="OutlineVisualElementMask"}(t||(t={})),function(n){n[n.ASYNC=0]="ASYNC",n[n.SYNC=1]="SYNC"}(i||(i={})),function(n){n[n.Highlight=0]="Highlight",n[n.MaskOccludee=1]="MaskOccludee",n[n.COUNT=2]="COUNT"}(u||(u={})),function(n){n[n.Triangle=0]="Triangle",n[n.Point=1]="Point",n[n.Line=2]="Line"}(a||(a={})),function(n){n[n.STRETCH=1]="STRETCH",n[n.PAD=2]="PAD"}(c||(c={})),function(n){n[n.CHANGED=0]="CHANGED",n[n.UNCHANGED=1]="UNCHANGED"}(l||(l={})),function(n){n[n.Blend=0]="Blend",n[n.Opaque=1]="Opaque",n[n.Mask=2]="Mask",n[n.MaskBlend=3]="MaskBlend",n[n.COUNT=4]="COUNT"}(C||(C={})),function(n){n[n.OFF=0]="OFF",n[n.ON=1]="ON"}(D||(D={}));export{C as AlphaDiscardMode,n as CullFaceOptions,D as Decorations,e as DepthTestFunction,u as Object3DState,c as PowerOfTwoResizeMode,a as PrimitiveType,N as RenderRequestType,O as ResourceState,t as StencilBits,i as UpdatePolicy,l as ValidationState};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.25/esri/copyright.txt for details.
4
4
  */
5
- import{ReloadableShaderModule as e}from"../../core/shaderTechnique/ReloadableShaderModule.js";import{ShaderTechnique as r}from"../../core/shaderTechnique/ShaderTechnique.js";import{Program as i}from"../Program.js";import{EdgeShaderAttributeLocations as o}from"./bufferLayouts.js";import{E as t}from"../../../../../chunks/EdgeShader.glsl.js";import{BlendOperation as s,BlendFactor as n,CompareFunction as d}from"../../../../webgl/enums.js";import{makePipelineState as a,separateBlendingParams as l,defaultColorWriteParams as m,defaultDepthWriteParams as h}from"../../../../webgl/renderState.js";class c extends r{initializeProgram(e){const r=c.shader.get().build(this.configuration);return new i(e.rctx,r,o)}initializePipeline(e){return e.blendMinMax?a({blending:l(n.ONE,n.ONE,n.ZERO,n.ONE,s.ADD,e.blendMinMax.MAX),depthTest:{func:d.LEQUAL},colorWrite:m}):a({depthTest:{func:d.LEQUAL},depthWrite:h,colorWrite:m})}}c.shader=new e(t,(()=>import("../../shaders/sources/edgeRenderer/EdgeShader.glsl.js")));export{c as EdgeShaderTechnique};
5
+ import{ReloadableShaderModule as e}from"../../core/shaderTechnique/ReloadableShaderModule.js";import{ShaderTechnique as r}from"../../core/shaderTechnique/ShaderTechnique.js";import{Program as i}from"../Program.js";import{EdgeShaderAttributeLocations as o}from"./bufferLayouts.js";import{E as t}from"../../../../../chunks/EdgeShader.glsl.js";import{BlendOperation as s,BlendFactor as n,CompareFunction as d}from"../../../../webgl/enums.js";import{makePipelineState as a,separateBlendingParams as l,defaultColorWriteParams as m,defaultDepthWriteParams as h}from"../../../../webgl/renderState.js";class u extends r{initializeProgram(e){return new i(e.rctx,u.shader.get().build(this.configuration),o)}initializePipeline(e){return e.blendMinMax?a({blending:l(n.ONE,n.ONE,n.ZERO,n.ONE,s.ADD,e.blendMinMax.MAX),depthTest:{func:d.LEQUAL},colorWrite:m}):a({depthTest:{func:d.LEQUAL},depthWrite:h,colorWrite:m})}}u.shader=new e(t,(()=>import("../../shaders/sources/edgeRenderer/EdgeShader.glsl.js")));export{u as EdgeShaderTechnique};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.25/esri/copyright.txt for details.
4
4
  */
5
- import{isNone as e}from"../../../../../core/maybe.js";import{isAborted as t,throwIfAborted as a}from"../../../../../core/promiseUtils.js";import{c as s}from"../../../../../chunks/mat4f64.js";import{b as n,e as i,m as r}from"../../../../../chunks/vec3.js";import{c as o}from"../../../../../chunks/vec3f64.js";import{c,f as l}from"../../../../../chunks/vec4f64.js";import h from"../../../support/debugFlags.js";import{glLayout as d}from"../../../support/buffer/glUtil.js";import{Camera as _}from"../Camera.js";import{Default3D as u}from"../DefaultVertexAttributeLocations.js";import{IntersectorType as m}from"../IntersectorInterfaces.js";import f from"../Octree.js";import{RenderPass as p}from"../RenderPass.js";import{RenderSlot as g}from"../RenderSlot.js";import{assert as I}from"../Util.js";import{InstanceData as C,StateFlags as D}from"./InstanceData.js";import{InstanceOctree as R}from"./InstanceOctree.js";import{LevelSelector as v}from"./LevelSelector.js";import{LodLevel as E}from"./LodLevel.js";import{RenderInstanceData as y}from"./RenderInstanceData.js";import{getInstanceBufferLayout as A}from"../../materials/DefaultMaterial.js";import{colorMixModes as b}from"../../materials/internal/MaterialUtil.js";import{encodeDoubleVec3 as T}from"../../materials/renderers/utils.js";import{DefaultMaterialDrawParameters as L}from"../../shaders/DefaultMaterialTechnique.js";import{bindVertexBufferLayout as S,unbindVertexBufferLayout as O}from"../../../../webgl/Util.js";let U=e=>{const t=e.baseBoundingSphere.radius,a=e.levels.map((e=>e.minScreenSpaceRadius));return new v(t,a)};function M(e){U=e}class x{constructor(e,t,a,s){this.type=m.LOD,this.isGround=!1,this._levels=[],this._defaultRenderInstanceData=[],this._highlightRenderInstanceData=[],this._instanceIndex=0,this._slicePlane=!1,this._enableLevelSelection=!0,this._lastCamera=new _,this._updateCyclesWithStaticCamera=-1,this._needFullCycle=!1,this.slots=[g.OPAQUE_MATERIAL,g.TRANSPARENT_MATERIAL],this.canRender=!0,this._symbol=e,this._optionalFields=t,this._metadata=a,this._instanceBufferLayout=A({instancedDoublePrecision:!0,instanced:t}),this._glInstanceBufferLayout=d(this._instanceBufferLayout,1),this._instanceData=new C(this._optionalFields,s),this._instanceData.on("instance-added",(()=>this._requestUpdateCycle())),this._instanceData.on("instance-removed",(()=>this._requestUpdateCycle())),this._instanceData.on("instance-transform-changed",(e=>{this._requestUpdateCycle(),this._metadata.notifyGraphicGeometryChanged(e.index)})),this._instanceData.on("instance-visibility-changed",(e=>{this._requestUpdateCycle(!0),this._metadata.notifyGraphicVisibilityChanged(e.index)})),this._instanceData.on("instance-highlight-changed",(()=>this._requestUpdateCycle(!0))),this._enableLevelSelection=this._symbol.levels.length>1}get levels(){return this._levels}get baseBoundingBox(){return this._levels[this._levels.length-1].boundingBox}get baseBoundingSphere(){return this._levels[this._levels.length-1].boundingSphere}get baseMaterial(){return this._levels[this._levels.length-1].components[0].material}get slicePlaneEnabled(){return this._slicePlane}set slicePlaneEnabled(e){this._slicePlane=e}get layerUid(){return this._metadata.layerUid}get instanceData(){return this._instanceData}get memoryUsage(){const e={cpu:0,gpu:0};return this._defaultRenderInstanceData.forEach((t=>{const a=t.memoryUsage;e.cpu+=a.cpu,e.gpu+=a.gpu})),this._highlightRenderInstanceData.forEach((t=>{const a=t.memoryUsage;e.cpu+=a.cpu,e.gpu+=a.gpu})),e}get renderStats(){const e=this._instanceData.size,t=[];return this._levels.forEach(((e,a)=>{const s=this._defaultRenderInstanceData[a],n=this._highlightRenderInstanceData[a],i=s.size+n.size,r=e.triangleCount;t.push({renderedInstances:i,renderedTriangles:i*r,trianglesPerInstance:r})})),{totalInstances:e,renderedInstances:t.reduce(((e,t)=>e+t.renderedInstances),0),renderedTriangles:t.reduce(((e,t)=>e+t.renderedTriangles),0),levels:t}}async initializeRenderContext(e,s){this._context=e;const n=e.renderContext.rctx,i=await Promise.allSettled(this._symbol.levels.map((t=>(this._defaultRenderInstanceData.push(new y(n,this._instanceBufferLayout)),this._highlightRenderInstanceData.push(new y(n,this._instanceBufferLayout)),E.create(e,t,s))))),r=i.map((e=>"fulfilled"===e.status?e.value:null)).filter((e=>e));if(t(s)||r.length!==i.length){r.forEach((e=>e.destroy())),a(s);for(const e of i)if("rejected"===e.status)throw e.reason}this._levels=r,this._levelSelector=U(this)}uninitializeRenderContext(){this._invalidateOctree(),this._levels.forEach((e=>e.destroy())),this._defaultRenderInstanceData.forEach((e=>e.destroy())),this._highlightRenderInstanceData.forEach((e=>e.destroy()))}get needsTransparentPass(){return this._levels.some((e=>e.components.some((e=>e.material.requiresSlot(g.TRANSPARENT_MATERIAL)))))}get needsHighlight(){return this._highlightRenderInstanceData.some((e=>e.size>0))}prepareRender(e){if(h.LOD_INSTANCE_RENDERER_DISABLE_UPDATES)return;if(this._enableLevelSelection){const t=e.bindParameters.contentCamera.equals(this._lastCamera);this._lastCamera.copyFrom(e.bindParameters.contentCamera),t||this._requestUpdateCycle()}const t=this._needFullCycle?this._instanceData.size:2e3;this._needFullCycle=!1,this._updateInstances(e.bindParameters.contentCamera,t),this._needsUpdates&&this._context.requestRender()}render(e){if(!this.baseMaterial.isVisible()||!this.baseMaterial.isVisibleInPass(e.pass))return;e.rctx.bindVAO();const t=e.pass!==p.MATERIAL_HIGHLIGHT&&e.pass!==p.MATERIAL_DEPTH_SHADOWMAP_HIGHLIGHT,a=e.pass!==p.MATERIAL_DEPTH_SHADOWMAP_DEFAULT;t&&this._renderComponents(e,this._defaultRenderInstanceData),a&&this._renderComponents(e,this._highlightRenderInstanceData)}intersect(e,t,a,s){if(!this.baseMaterial.isVisible())return;const i=o();n(i,s,a);const c=n=>{this._instanceData.getCombinedModelTransform(n,F),e.transform.set(F),r(w,a,e.transform.inverse),r(N,s,e.transform.inverse);const i=this._instanceData.getState(n),o=this._instanceData.getLodLevel(n),c=this._levels.length;I(i&D.ACTIVE,"invalid instance state"),I(o>=0&&o<c,"invaid lod level"),this._levels[o].intersect(e,t,w,N,n,this._metadata,c)};this.baseMaterial.parameters.verticalOffset?this._octree.forEach(c):this._octree.forEachAlongRay(a,i,c)}queryDepthRange(e){return this._queryDepthRangeOctree(e)}notifyShaderTransformationChanged(){this._invalidateOctree()}_requestUpdateCycle(e=!1){this._updateCyclesWithStaticCamera=-1,e&&(this._needFullCycle=!0),this._needsUpdates&&this._context.requestRender()}get _needsUpdates(){return this._instanceData.size>0&&this._updateCyclesWithStaticCamera<1}get _octree(){return this._octreeCached||(this._octreeCached=this._buildOctree()),this._octreeCached}_invalidateOctree(){this._octreeCached&&(this._octreeCached.destroy(),this._octreeCached=null)}_buildOctree(){const e=new R(this._instanceData,this.baseBoundingSphere),t=this._instanceData,a=t.view?t.view.state:null;for(let s=0;s<this._instanceData.capacity;++s){a.get(s)&D.ACTIVE&&e.addInstance(s)}return e}_queryDepthRangeOctree(e){const t=e.eye,a=e.viewForward,s=this._octree.findClosest(a,f.DepthOrder.FRONT_TO_BACK,e.frustum),r=this._octree.findClosest(a,f.DepthOrder.BACK_TO_FRONT,e.frustum);if(null!=s&&null!=r){this._instanceData.view.boundingSphere.getVec(s,P),n(P,P,t);const o=i(P,a)-P[3];this._instanceData.view.boundingSphere.getVec(r,P),n(P,P,t);const c=i(P,a)+P[3];return{near:Math.max(e.near,o),far:Math.min(e.far,c)}}return{near:1/0,far:-1/0}}_startUpdateCycle(){this._updateCyclesWithStaticCamera++,this._defaultRenderInstanceData.forEach((e=>{e.startUpdateCylce()})),this._highlightRenderInstanceData.forEach((e=>{e.startUpdateCylce()})),this._needsUpdates&&this._context.requestRender()}_updateInstances(e,t){const a=this._enableLevelSelection,s=this._levelSelector;s.updateCamera(e),this._defaultRenderInstanceData.forEach((e=>{e.beginUpdate()})),this._highlightRenderInstanceData.forEach((e=>{e.beginUpdate()}));const n=this._instanceData,i=this._instanceData.view,r=n.size,o=n.capacity;let c=this._instanceIndex;t=Math.min(r,t);for(let l=0;l<t;++l){0===c&&this._startUpdateCycle();const e=i.state.get(c);let r=0;if(!(e&D.ALLOCATED)){c=(c+1)%o,t++;continue}const l=i.lodLevel.get(c);if(e&D.DEFAULT_ACTIVE&&this._defaultRenderInstanceData[l].freeTail(),e&D.HIGHLIGHT_ACTIVE&&this._highlightRenderInstanceData[l].freeTail(),e&D.REMOVE)n.freeInstance(c);else if(e&D.VISIBLE){let t=0;a&&(i.modelOrigin.getVec(c,V),t=s.selectLevel(V,n.getCombinedMedianScaleFactor(c))),r=e&~(D.ACTIVE|D.TRANSFORM_CHANGED),t>=0&&(e&D.HIGHLIGHT?(j(this._highlightRenderInstanceData[t],i,c),r|=D.HIGHLIGHT_ACTIVE):(j(this._defaultRenderInstanceData[t],i,c),r|=D.DEFAULT_ACTIVE)),i.state.set(c,r),i.lodLevel.set(c,t)}else r=e&~(D.ACTIVE|D.TRANSFORM_CHANGED),i.state.set(c,r);if(this._octreeCached){const t=!!(e&D.ACTIVE),a=!!(r&D.ACTIVE);!t&&a?this._octreeCached.addInstance(c):t&&!a?this._octreeCached.removeInstance(c):t&&a&&e&D.TRANSFORM_CHANGED&&(this._octreeCached.removeInstance(c),this._octreeCached.addInstance(c))}c=(c+1)%o}this._instanceIndex=c,this._defaultRenderInstanceData.forEach((e=>{e.endUpdate()})),this._highlightRenderInstanceData.forEach((e=>{e.endUpdate()}))}_renderComponents(e,t){this.levels.forEach(((a,s)=>{a.components.forEach((a=>{this._renderComponent(e,t[s],a,s)}))}))}_renderComponent(t,a,s,n){const i=t.bindParameters;if(0===a.size||!s.material.requiresSlot(i.slot))return;const{rctx:r,pass:o}=t,c=s.glMaterials.load(r,o);if(e(c))return;const l=c.beginSlot(i),d=r.bindTechnique(l,s.material.parameters,i);r.bindVAO(s.vao),l.ensureAttributeLocations(s.vao),l.bindDraw(B,i,s.material.parameters),h.LOD_INSTANCE_RENDERER_COLORIZE_BY_LEVEL&&t.pass===p.MATERIAL&&(d.setUniform4fv("externalColor",q[Math.min(n,q.length-1)]),d.setUniform1i("colorMixMode",b.replace));const _=r.capabilities.instancing,m=a.capacity,f=a.headIndex,g=a.tailIndex,C=a.firstIndex,D=this._glInstanceBufferLayout,R=(e,t)=>{S(r,u,a.buffer,D,e),_.drawArraysInstanced(l.primitiveType,0,s.vertexCount,t-e),O(r,u,a.buffer,D)};s.material.parameters.transparent&&null!=C?f>g?(I(C>=g&&C<=f,"invalid firstIndex"),R(C,f),R(g,C)):f<g&&(C<=f?(I(C>=0&&C<=f,"invalid firstIndex"),R(C,f),R(g,m),R(0,C)):(I(C>=g&&C<=m,"invalid firstIndex"),R(C,m),R(0,f),R(g,C))):f>g?R(g,f):f<g&&(R(0,f),R(g,m)),r.bindVAO(null)}}function j(e,t,a){const s=e.allocateHead();H(t,a,e.view,s)}function H(e,t,a,s){T(e.modelOrigin,t,a.modelOriginHi,a.modelOriginLo,s),a.model.copyFrom(s,e.model,t),a.modelNormal.copyFrom(s,e.modelNormal,t),e.color&&a.color&&a.color.copyFrom(s,e.color,t),e.featureAttribute&&a.featureAttribute&&a.featureAttribute.copyFrom(s,e.featureAttribute,t)}const V=o(),P=c(),F=s(),w=o(),N=o(),q=[l(1,0,1,1),l(0,0,1,1),l(0,1,0,1),l(1,1,0,1),l(1,0,0,1)],B=new L;export{x as LodRenderer,M as setLevelSelectorFactory};
5
+ import{isNone as e}from"../../../../../core/maybe.js";import{isAborted as t,throwIfAborted as a}from"../../../../../core/promiseUtils.js";import{c as s}from"../../../../../chunks/mat4f64.js";import{b as n,e as i,m as r}from"../../../../../chunks/vec3.js";import{c as o}from"../../../../../chunks/vec3f64.js";import{c as l,f as c}from"../../../../../chunks/vec4f64.js";import h from"../../../support/debugFlags.js";import{glLayout as d}from"../../../support/buffer/glUtil.js";import{ShaderOutput as u}from"../../core/shaderLibrary/ShaderOutput.js";import{Camera as _}from"../Camera.js";import{Default3D as m}from"../DefaultVertexAttributeLocations.js";import{IntersectorType as f}from"../IntersectorInterfaces.js";import p from"../Octree.js";import{RenderSlot as g}from"../RenderSlot.js";import{assert as C}from"../Util.js";import{InstanceData as I,StateFlags as D}from"./InstanceData.js";import{InstanceOctree as v}from"./InstanceOctree.js";import{LevelSelector as y}from"./LevelSelector.js";import{LodLevel as R}from"./LodLevel.js";import{RenderInstanceData as b}from"./RenderInstanceData.js";import{getInstanceBufferLayout as E}from"../../materials/DefaultMaterial.js";import{colorMixModes as A}from"../../materials/internal/MaterialUtil.js";import{encodeDoubleVec3 as T}from"../../materials/renderers/utils.js";import{DefaultMaterialDrawParameters as L}from"../../shaders/DefaultMaterialTechnique.js";import{bindVertexBufferLayout as S,unbindVertexBufferLayout as O}from"../../../../webgl/Util.js";let U=e=>{const t=e.baseBoundingSphere.radius,a=e.levels.map((e=>e.minScreenSpaceRadius));return new y(t,a)};function x(e){U=e}class j{constructor(e,t,a,s){this.type=f.LOD,this.isGround=!1,this._levels=[],this._defaultRenderInstanceData=[],this._highlightRenderInstanceData=[],this._instanceIndex=0,this._slicePlane=!1,this._enableLevelSelection=!0,this._lastCamera=new _,this._updateCyclesWithStaticCamera=-1,this._needFullCycle=!1,this.slots=[g.OPAQUE_MATERIAL,g.TRANSPARENT_MATERIAL],this.canRender=!0,this._symbol=e,this._optionalFields=t,this._metadata=a,this._instanceBufferLayout=E({instancedDoublePrecision:!0,instanced:t}),this._glInstanceBufferLayout=d(this._instanceBufferLayout,1),this._instanceData=new I(this._optionalFields,s),this._instanceData.on("instance-added",(()=>this._requestUpdateCycle())),this._instanceData.on("instance-removed",(()=>this._requestUpdateCycle())),this._instanceData.on("instance-transform-changed",(e=>{this._requestUpdateCycle(),this._metadata.notifyGraphicGeometryChanged(e.index)})),this._instanceData.on("instance-visibility-changed",(e=>{this._requestUpdateCycle(!0),this._metadata.notifyGraphicVisibilityChanged(e.index)})),this._instanceData.on("instance-highlight-changed",(()=>this._requestUpdateCycle(!0))),this._enableLevelSelection=this._symbol.levels.length>1}get levels(){return this._levels}get baseBoundingBox(){return this._levels[this._levels.length-1].boundingBox}get baseBoundingSphere(){return this._levels[this._levels.length-1].boundingSphere}get baseMaterial(){return this._levels[this._levels.length-1].components[0].material}get slicePlaneEnabled(){return this._slicePlane}set slicePlaneEnabled(e){this._slicePlane=e}get layerUid(){return this._metadata.layerUid}get instanceData(){return this._instanceData}get memoryUsage(){const e={cpu:0,gpu:0};return this._defaultRenderInstanceData.forEach((t=>{const a=t.memoryUsage;e.cpu+=a.cpu,e.gpu+=a.gpu})),this._highlightRenderInstanceData.forEach((t=>{const a=t.memoryUsage;e.cpu+=a.cpu,e.gpu+=a.gpu})),e}get renderStats(){const e=this._instanceData.size,t=[];return this._levels.forEach(((e,a)=>{const s=this._defaultRenderInstanceData[a],n=this._highlightRenderInstanceData[a],i=s.size+n.size,r=e.triangleCount;t.push({renderedInstances:i,renderedTriangles:i*r,trianglesPerInstance:r})})),{totalInstances:e,renderedInstances:t.reduce(((e,t)=>e+t.renderedInstances),0),renderedTriangles:t.reduce(((e,t)=>e+t.renderedTriangles),0),levels:t}}async initializeRenderContext(e,s){this._context=e;const n=e.renderContext.rctx,i=await Promise.allSettled(this._symbol.levels.map((t=>(this._defaultRenderInstanceData.push(new b(n,this._instanceBufferLayout)),this._highlightRenderInstanceData.push(new b(n,this._instanceBufferLayout)),R.create(e,t,s))))),r=i.map((e=>"fulfilled"===e.status?e.value:null)).filter((e=>e));if(t(s)||r.length!==i.length){r.forEach((e=>e.destroy())),a(s);for(const e of i)if("rejected"===e.status)throw e.reason}this._levels=r,this._levelSelector=U(this)}uninitializeRenderContext(){this._invalidateOctree(),this._levels.forEach((e=>e.destroy())),this._defaultRenderInstanceData.forEach((e=>e.destroy())),this._highlightRenderInstanceData.forEach((e=>e.destroy()))}get needsTransparentPass(){return this._levels.some((e=>e.components.some((e=>e.material.requiresSlot(g.TRANSPARENT_MATERIAL,u.Color)))))}get needsHighlight(){return this._highlightRenderInstanceData.some((e=>e.size>0))}prepareRender(e){if(h.LOD_INSTANCE_RENDERER_DISABLE_UPDATES)return;if(this._enableLevelSelection){const t=e.bindParameters.contentCamera.equals(this._lastCamera);this._lastCamera.copyFrom(e.bindParameters.contentCamera),t||this._requestUpdateCycle()}const t=this._needFullCycle?this._instanceData.size:2e3;this._needFullCycle=!1,this._updateInstances(e.bindParameters.contentCamera,t),this._needsUpdates&&this._context.requestRender()}render(e){if(!this.baseMaterial.isVisible()||!this.baseMaterial.isVisibleForOutput(e.output))return;e.rctx.bindVAO();e.output!==u.Highlight&&e.output!==u.ShadowHighlight&&this._renderComponents(e,this._defaultRenderInstanceData);e.output!==u.ShadowExludeHighlight&&this._renderComponents(e,this._highlightRenderInstanceData)}intersect(e,t,a,s){if(!this.baseMaterial.isVisible())return;const i=o();n(i,s,a);const l=n=>{this._instanceData.getCombinedModelTransform(n,N),e.transform.set(N),r(H,a,e.transform.inverse),r(q,s,e.transform.inverse);const i=this._instanceData.getState(n),o=this._instanceData.getLodLevel(n),l=this._levels.length;C(i&D.ACTIVE,"invalid instance state"),C(o>=0&&o<l,"invaid lod level"),this._levels[o].intersect(e,t,H,q,n,this._metadata,l)};this.baseMaterial.parameters.verticalOffset?this._octree.forEach(l):this._octree.forEachAlongRay(a,i,l)}queryDepthRange(e){return this._queryDepthRangeOctree(e)}notifyShaderTransformationChanged(){this._invalidateOctree()}_requestUpdateCycle(e=!1){this._updateCyclesWithStaticCamera=-1,e&&(this._needFullCycle=!0),this._needsUpdates&&this._context.requestRender()}get _needsUpdates(){return this._instanceData.size>0&&this._updateCyclesWithStaticCamera<1}get _octree(){return this._octreeCached||(this._octreeCached=this._buildOctree()),this._octreeCached}_invalidateOctree(){this._octreeCached&&(this._octreeCached.destroy(),this._octreeCached=null)}_buildOctree(){const e=new v(this._instanceData,this.baseBoundingSphere),t=this._instanceData,a=t.view?t.view.state:null;for(let s=0;s<this._instanceData.capacity;++s){a.get(s)&D.ACTIVE&&e.addInstance(s)}return e}_queryDepthRangeOctree(e){const t=e.eye,a=e.viewForward,s=this._octree.findClosest(a,p.DepthOrder.FRONT_TO_BACK,e.frustum),r=this._octree.findClosest(a,p.DepthOrder.BACK_TO_FRONT,e.frustum);if(null!=s&&null!=r){this._instanceData.view.boundingSphere.getVec(s,F),n(F,F,t);const o=i(F,a)-F[3];this._instanceData.view.boundingSphere.getVec(r,F),n(F,F,t);const l=i(F,a)+F[3];return{near:Math.max(e.near,o),far:Math.min(e.far,l)}}return{near:1/0,far:-1/0}}_startUpdateCycle(){this._updateCyclesWithStaticCamera++,this._defaultRenderInstanceData.forEach((e=>{e.startUpdateCylce()})),this._highlightRenderInstanceData.forEach((e=>{e.startUpdateCylce()})),this._needsUpdates&&this._context.requestRender()}_updateInstances(e,t){const a=this._enableLevelSelection,s=this._levelSelector;s.updateCamera(e),this._defaultRenderInstanceData.forEach((e=>{e.beginUpdate()})),this._highlightRenderInstanceData.forEach((e=>{e.beginUpdate()}));const n=this._instanceData,i=this._instanceData.view,r=n.size,o=n.capacity;let l=this._instanceIndex;t=Math.min(r,t);for(let c=0;c<t;++c){0===l&&this._startUpdateCycle();const e=i.state.get(l);let r=0;if(!(e&D.ALLOCATED)){l=(l+1)%o,t++;continue}const c=i.lodLevel.get(l);if(e&D.DEFAULT_ACTIVE&&this._defaultRenderInstanceData[c].freeTail(),e&D.HIGHLIGHT_ACTIVE&&this._highlightRenderInstanceData[c].freeTail(),e&D.REMOVE)n.freeInstance(l);else if(e&D.VISIBLE){let t=0;a&&(i.modelOrigin.getVec(l,w),t=s.selectLevel(w,n.getCombinedMedianScaleFactor(l))),r=e&~(D.ACTIVE|D.TRANSFORM_CHANGED),t>=0&&(e&D.HIGHLIGHT?(M(this._highlightRenderInstanceData[t],i,l),r|=D.HIGHLIGHT_ACTIVE):(M(this._defaultRenderInstanceData[t],i,l),r|=D.DEFAULT_ACTIVE)),i.state.set(l,r),i.lodLevel.set(l,t)}else r=e&~(D.ACTIVE|D.TRANSFORM_CHANGED),i.state.set(l,r);if(this._octreeCached){const t=!!(e&D.ACTIVE),a=!!(r&D.ACTIVE);!t&&a?this._octreeCached.addInstance(l):t&&!a?this._octreeCached.removeInstance(l):t&&a&&e&D.TRANSFORM_CHANGED&&(this._octreeCached.removeInstance(l),this._octreeCached.addInstance(l))}l=(l+1)%o}this._instanceIndex=l,this._defaultRenderInstanceData.forEach((e=>{e.endUpdate()})),this._highlightRenderInstanceData.forEach((e=>{e.endUpdate()}))}_renderComponents(e,t){this.levels.forEach(((a,s)=>{a.components.forEach((a=>{this._renderComponent(e,t[s],a,s)}))}))}_renderComponent(t,a,s,n){if(0===a.size)return;const{bindParameters:i,rctx:r,output:o}=t,l=s.glMaterials.load(r,i.slot,o);if(e(l))return;const c=l.beginSlot(i),d=r.bindTechnique(c,s.material.parameters,i);r.bindVAO(s.vao),c.ensureAttributeLocations(s.vao),d.bindDraw(P,i,s.material.parameters),h.LOD_INSTANCE_RENDERER_COLORIZE_BY_LEVEL&&t.output===u.Color&&(d.setUniform4fv("externalColor",B[Math.min(n,B.length-1)]),d.setUniform1i("colorMixMode",A.replace));const _=r.capabilities.instancing,f=a.capacity,p=a.headIndex,g=a.tailIndex,I=a.firstIndex,D=this._glInstanceBufferLayout,v=(e,t)=>{S(r,m,a.buffer,D,e),_.drawArraysInstanced(c.primitiveType,0,s.vertexCount,t-e),O(r,m,a.buffer,D)};s.material.parameters.transparent&&null!=I?p>g?(C(I>=g&&I<=p,"invalid firstIndex"),v(I,p),v(g,I)):p<g&&(I<=p?(C(I>=0&&I<=p,"invalid firstIndex"),v(I,p),v(g,f),v(0,I)):(C(I>=g&&I<=f,"invalid firstIndex"),v(I,f),v(0,p),v(g,I))):p>g?v(g,p):p<g&&(v(0,p),v(g,f)),r.bindVAO(null)}}function M(e,t,a){const s=e.allocateHead();V(t,a,e.view,s)}function V(e,t,a,s){T(e.modelOrigin,t,a.modelOriginHi,a.modelOriginLo,s),a.model.copyFrom(s,e.model,t),a.modelNormal.copyFrom(s,e.modelNormal,t),e.color&&a.color&&a.color.copyFrom(s,e.color,t),e.featureAttribute&&a.featureAttribute&&a.featureAttribute.copyFrom(s,e.featureAttribute,t)}const w=o(),F=l(),N=s(),H=o(),q=o(),B=[c(1,0,1,1),c(0,0,1,1),c(0,1,0,1),c(1,1,0,1),c(1,0,0,1)],P=new L;export{j as LodRenderer,x as setLevelSelectorFactory};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.25/esri/copyright.txt for details.
4
4
  */
5
- import{acosClamped as t,reciprocalClamped as e}from"../../../../core/mathUtils.js";import{s as i}from"../../../../chunks/mat2.js";import{c as s}from"../../../../chunks/mat2f64.js";import{h as r,d as o}from"../../../../chunks/mat4.js";import{c as h}from"../../../../chunks/mat4f64.js";import{s as n,h as a,p as l,a as u,b as p,i as f,f as c,l as x}from"../../../../chunks/vec2.js";import{a as d,d as v,f as m}from"../../../../chunks/vec2f64.js";import{e as g,c as V,a as A,n as b,g as C,b as D,f as I,o as R,s as N,l as P,m as S}from"../../../../chunks/vec3.js";import{c as U}from"../../../../chunks/vec3f64.js";import{create as _,fromPositionAndNormal as y,intersectRay as T}from"../../../../geometry/support/plane.js";import{wrap as L}from"../../../../geometry/support/ray.js";import F from"./GeometryUtil.js";import{VertexAttribute as O}from"./VertexAttribute.js";import{intersectTriangles as M}from"../materials/internal/MaterialUtil.js";function k(){return{up:U(),right:U()}}function E(t,e,i){S(t.up,e.up,i),S(t.right,e.right,i)}function B(t,e,i){t[0]=i[0]*e.right[0]+i[1]*e.up[0],t[1]=i[0]*e.right[1]+i[1]*e.up[1],t[2]=i[0]*e.right[2]+i[1]*e.up[2]}function w(t,e,i){n(t,g(i,e.right),g(i,e.up))}class G{constructor(){this.pos=U(),this.posES=U(),this.posGS=U(),this.vRight=U(),this.vLeft=U(),this.frame=k(),this.rotationFrame=k(),this.rotationRight=d(),this.rotationAngle=0,this.miterStretch=s()}setFrameFromUpVector(t){V(this.frame.up,t),A(at,this.vLeft,this.vRight),b(at,at),C(nt,this.frame.up,g(at,this.frame.up)),D(pt,at,nt),b(pt,pt),I(this.frame.right,pt,this.frame.up)}computeRotationAxisAndAngleFromUpVector(){V(this.rotationFrame.up,this.frame.up),V(this.rotationFrame.right,this.frame.right),n(this.rotationRight,1,0),C(nt,this.frame.up,g(this.frame.up,this.vLeft)),D(nt,this.vLeft,nt),R(nt,nt),b(nt,nt),C(at,this.frame.up,g(this.frame.up,this.vRight)),D(at,this.vRight,at),b(at,at),I(lt,this.rotationFrame.up,this.vLeft);const s=Math.sign(g(lt,this.vRight));if(this.rotationAngle=s*(Math.PI-t(g(nt,at))),Math.abs(this.rotationAngle)>0){const t=e(Math.cos(.5*this.rotationAngle));i(this.miterStretch,t-1+1,0,0,1)}const r=Math.PI-this.rotationAngle;this.maxStretchDistance=Math.abs(Math.min(this.vLeftLength,this.vRightLength)/Math.cos(.5*r))}}class j{constructor(){this.vertices=[],this.vertexIndices=[],this.vertexNormals=[],this.poles=[],this.poleIndices=[],this.uvs=null,this.uvIndices=null}addVertex(t,e){return this.vertices.push(v(t)),this.vertexNormals.push(v(e)),this.vertices.length-1}addUV(t){return this.uvs||(this.uvs=[],this.uvIndices=[]),this.uvs.push(t),this.uvs.length-1}addPole(t,e=null){return this.poles.push({position:v(t),normal:e?v(e):null}),this.poles.length-1}addSegment(t,e=null,i=null){this.vertexIndices.push(t.v0),this.vertexIndices.push(t.v1),e&&(this.uvIndices.push(e.v0),this.uvIndices.push(e.v1)),i&&(this.poleIndices.push(i.v0),this.poleIndices.push(i.v1))}get numSegments(){return this.vertexIndices.length/2}hasUV(){return null!=this.uvs}translate(t,e){for(const i of this.vertices)i[0]+=t,i[1]+=e;for(const i of this.poles)i.position[0]+=t,i.position[1]+=e}static circle(t=20){const e=.5,i=new j,s={v0:0,v1:0};i.addPole(m(0,0));for(let h=0;h<t;++h){const s=2*h*Math.PI/t,r=Math.cos(s),o=Math.sin(s),n=m(r*e,o*e),a=m(r,o);i.addVertex(n,a),i.addUV(h/t)}i.addUV(1);for(let h=0;h<t-1;++h){const t={v0:h,v1:h+1},e=t;i.addSegment(t,e,s)}const r={v0:t-1,v1:0},o={v0:t-1,v1:t};return i.addSegment(r,o,s),i}static rect(){const t=1,e=1,i=new j,s=m(.5*-t,.5*-e),r=m(.5*t,.5*-e),o=m(.5*t,.5*e),h=m(.5*-t,.5*e),n=m(0,-1),a=m(1,0),l=m(0,1),u=m(-1,0);i.addUV(0),i.addUV(1),i.addPole(m(0,.5*e),l),i.addPole(m(0,.5*e)),i.addPole(m(0,.5*-e)),i.addPole(m(0,.5*-e),n);const p={v0:0,v1:1};return i.addVertex(s,n),i.addVertex(r,n),i.addSegment({v0:0,v1:1},p,{v0:3,v1:3}),i.addVertex(r,a),i.addVertex(o,a),i.addSegment({v0:2,v1:3},p,{v0:2,v1:1}),i.addVertex(o,l),i.addVertex(h,l),i.addSegment({v0:4,v1:5},p,{v0:0,v1:0}),i.addVertex(h,u),i.addVertex(s,u),i.addSegment({v0:6,v1:7},p,{v0:1,v1:2}),i}}class z{constructor(t){this.vertices=[],this.offset=U(),this.xform=h(),this.vertices=t;const e=Math.floor((t.length-1)/2);V(this.offset,this.vertices[e].pos);for(const i of this.vertices)D(i.pos,i.pos,this.offset);r(this.xform,this.xform,this.offset),this.updatePathVertexInformation()}updatePathVertexInformation(){const t=this.vertices.length;let e=this.vertices[0];e.index=0,N(e.vLeft,0,0,0),e.vLeftLength=0,D(e.vRight,this.vertices[1].pos,e.pos),e.vRightLength=P(e.vRight),b(e.vRight,e.vRight);let i=e;for(let s=1;s<t;++s)e=this.vertices[s],e.index=s,V(e.vLeft,i.vRight),e.vLeftLength=i.vRightLength,s<t-1?(D(e.vRight,this.vertices[s+1].pos,e.pos),e.vRightLength=P(e.vRight),b(e.vRight,e.vRight)):(V(e.vRight,e.vLeft),e.vRightLength=e.vLeftLength),i=e}}function J(t,e){let i=null;const s=t.vertices.length,r=.99619469809,o=U(),h=U(),n=U(),a=U(),l=U(),u=U(),p=_();let f=t.vertices[0];V(h,e),N(o,0,1,0),F.makeOrthoBasisDirUpFallback(f.vRight,h,o,o,n,h,r),V(f.frame.up,h),V(f.frame.right,n),i=f;for(let c=1;c<s;++c){f=t.vertices[c],A(l,f.vLeft,f.vRight);let e=P(l);e>0?(e=1/Math.sqrt(e),l[0]=l[0]*e,l[1]=l[1]*e,l[2]=l[2]*e):(l[0]=f.vRight[0],l[1]=f.vRight[1],l[2]=f.vRight[2]),A(u,i.pos,i.frame.up),y(f.pos,l,p);T(p,L(u,f.vLeft),a)?(D(a,a,f.pos),b(h,a),I(n,l,h),b(n,n)):F.makeOrthoBasisDirUpFallback(l,i.frame.up,i.frame.right,o,n,h,r),V(f.frame.up,h),V(f.frame.right,n),i=f}}class H{}class X{numProfilesPerJoin(){return 1}extrude(t,e,i){for(let s=0;s<e.vertices.length;++s)i(t.index,t.frame,e.vertices[s],e.vertexNormals[s],!1)}}class q{constructor(t=.8*Math.PI,e=1){this.cutoffAngle=t,this.numBendSubdivisions=e}numProfilesPerJoin(){return this.numBendSubdivisions+1}extrude(t,e,i){const s=ft;if(Math.abs(t.rotationAngle)>=this.cutoffAngle)for(let r=0;r<this.numBendSubdivisions+1;++r){o(ct,.5*-t.rotationAngle+r*t.rotationAngle/this.numBendSubdivisions,t.rotationFrame.up),E(s,t.frame,ct);for(let r=0;r<e.vertices.length;++r){a(e.vertices[r],t.rotationRight)*t.rotationAngle>=0?i(t.index,s,e.vertices[r],e.vertexNormals[r],!1):(l(rt,e.vertices[r],t.miterStretch),i(t.index,t.frame,rt,e.vertexNormals[r],!0))}}else for(let r=0;r<this.numBendSubdivisions+1;++r)for(let s=0;s<e.vertices.length;++s){const r=a(e.vertices[s],t.rotationRight)*t.rotationAngle>=0;l(rt,e.vertices[s],t.miterStretch),i(t.index,t.frame,rt,e.vertexNormals[s],!r)}}}const K={generateUV:!1};class Q{rebuildConnectingProfileGeometry(t,e,i){for(let s=0;s<e.vertices.length;++s)i(t.index,t.frame,e.vertices[s],e.vertexNormals[s],0,0)}}class W extends Q{constructor(){super()}getNumVertices(){return 0}getNumIndices(){return 0}rebuildCapGeometry(){}buildTopology(){}}class Y extends Q{constructor(t,e=0,i=!1){super(),this.profile=t,this.profilePlaneOffset=e,this.flip=i}getNumVertices(){return this.profile.vertices.length}getNumIndices(){return 3*this.profile.numSegments}rebuildConnectingProfileGeometry(t,e,i){for(let s=0;s<e.vertices.length;++s)i(t.index,t.frame,e.vertices[s],e.vertexNormals[s],this.profilePlaneOffset,0)}rebuildCapGeometry(t,e){const i=ot;n(i,0,0);const s=this.flip?1:-1;for(let r=0;r<this.profile.vertices.length;++r)e(t.index,t.frame,this.profile.vertices[r],i,this.profilePlaneOffset,s)}buildTopology(t,e){const i=this.vertexBufferStart+this.profile.vertexIndices[0];for(let s=1;s<this.profile.numSegments;++s){const t=this.profile.vertexIndices[2*s+0],r=this.profile.vertexIndices[2*s+1],o=this.vertexBufferStart+t,h=this.vertexBufferStart+r;this.flip?e(h,o,i):e(i,o,h)}}}class Z extends Q{constructor(t){super(),this.flip=!1,this.sign=0,this.breakNormals=!1,this.numSegments=3,this.profile=t.profile,this.flip=t.flip,this.sign=this.flip?1:-1,this.breakNormals=t.breakNormals,this.numSegments=t.subdivisions}getNumVertices(){let t=0;return t=this.profile.vertices.length*(this.numSegments-1),this.breakNormals&&(t+=this.profile.vertices.length),t+=this.profile.poles.length,t}getNumIndices(){let t=0;t+=2*this.profile.numSegments*(this.numSegments-1);for(let e=0;e<this.profile.numSegments;++e){const i=this.profile.vertexIndices[2*e+0],s=this.profile.vertexIndices[2*e+1];this.profile.poleIndices[i]===this.profile.poleIndices[s]?t+=1:t+=2}return 3*t}rebuildCapGeometry(t,e){const i=t.frame,s=.5*this.sign,r=rt,o=ot;n(o,0,0);for(let h=0;h<this.profile.poles.length;++h){const r=this.profile.poles[h];r.normal?e(t.index,i,r.position,r.normal,s,0):e(t.index,i,r.position,o,s,this.sign)}if(this.breakNormals)for(let h=0;h<this.profile.vertices.length;++h)e(t.index,i,this.profile.vertices[h],this.profile.vertexNormals[h],0,0);for(let h=0;h<this.numSegments-1;++h){const n=(1-(h+1)/this.numSegments)*Math.PI*.5,a=Math.sin(n),l=Math.cos(n);for(let h=0;h<this.profile.vertices.length;++h){const n=this.profile.poles[this.profile.poleIndices[h]];u(r,this.profile.vertices[h],n.position),p(r,r,a),n.normal?(f(r,r,n.position),e(t.index,i,r,n.normal,s*l,0)):(c(o,r),p(o,o,a),f(r,r,n.position),e(t.index,i,r,o,s*l,this.sign*l))}}}buildTopology(t,e){const i=this.breakNormals?this.vertexBufferStart+this.profile.poles.length:this.firstProfileVertexIndex,s=this.breakNormals?this.vertexBufferStart+this.profile.poles.length+this.profile.vertices.length:this.vertexBufferStart+this.profile.poles.length;for(let r=0;r<this.profile.numSegments;++r){const t=this.profile.vertexIndices[2*r+0],o=this.profile.vertexIndices[2*r+1],h=this.vertexBufferStart+this.profile.poleIndices[t],n=this.vertexBufferStart+this.profile.poleIndices[o];let a=i+t,l=i+o;for(let i=0;i<this.numSegments-1;++i){const r=s+i*this.profile.vertices.length+t,h=s+i*this.profile.vertices.length+o;this.flip?(e(r,l,a),e(l,r,h)):(e(a,l,r),e(h,r,l)),a=r,l=h}this.flip?(e(h,l,a),h!==n&&e(h,n,l)):(e(a,l,h),h!==n&&e(l,n,h))}}}class ${constructor(t,e,i,s,r,o=K){this.options=o,this._extrusionVertexCount=0,this._triangleCount=0,this.numExtrusionProfiles=0,this.numVerticesTotal=0,this.numNormalsTotal=0,this.numUVTotal=0,this.profile=e,this.path=t,this.extruder=i,this.startCap=s,this.endCap=r;const h=this.path.vertices.length-2;this.numExtrusionProfiles=i.numProfilesPerJoin()*h+2,this.numVerticesTotal=e.vertices.length*this.numExtrusionProfiles,this.numNormalsTotal=this.numVerticesTotal,this.startCap.vertexBufferStart=this.numVerticesTotal;const n=this.startCap.getNumVertices();this.numVerticesTotal+=n,this.numNormalsTotal+=n,this.endCap.vertexBufferStart=this.numVerticesTotal;const a=this.endCap.getNumVertices();this.numVerticesTotal+=a,this.numNormalsTotal+=a,this.pathVertexData=new Float32Array(1*this.numVerticesTotal),this.profileRightAxisData=new Float32Array(4*this.numVerticesTotal),this.profileUpAxisData=new Float32Array(4*this.numVerticesTotal),this.profileVertexAndNormalData=new Float32Array(4*this.numVerticesTotal),this.profile.hasUV()&&this.options.generateUV&&(this.numUVTotal=this.profile.uvs.length,this.uvData=new Float32Array(2*this.numUVTotal)),this.originData=new Float32Array(3*this.path.vertices.length),this._rebuildGeometry(),this.buildTopology()}emitVertex(t,e,i,s,r){if(this.profileRightAxisData[4*this._extrusionVertexCount+0]=e.right[0],this.profileRightAxisData[4*this._extrusionVertexCount+1]=e.right[1],this.profileRightAxisData[4*this._extrusionVertexCount+2]=e.right[2],this.profileUpAxisData[4*this._extrusionVertexCount+0]=e.up[0],this.profileUpAxisData[4*this._extrusionVertexCount+1]=e.up[1],this.profileUpAxisData[4*this._extrusionVertexCount+2]=e.up[2],this.profileVertexAndNormalData[4*this._extrusionVertexCount+0]=i[0],this.profileVertexAndNormalData[4*this._extrusionVertexCount+1]=i[1],this.profileVertexAndNormalData[4*this._extrusionVertexCount+2]=s[0],this.profileVertexAndNormalData[4*this._extrusionVertexCount+3]=s[1],this.pathVertexData[this._extrusionVertexCount]=t,r){const e=this.path.vertices[t];this.profileRightAxisData[4*this._extrusionVertexCount+3]=e.rotationRight[0]*e.maxStretchDistance,this.profileUpAxisData[4*this._extrusionVertexCount+3]=e.rotationRight[1]*e.maxStretchDistance}else this.profileRightAxisData[4*this._extrusionVertexCount+3]=0,this.profileUpAxisData[4*this._extrusionVertexCount+3]=0;++this._extrusionVertexCount}emitCapVertex(t,e,i,s,r,o){this.profileRightAxisData[4*this._extrusionVertexCount+0]=e.right[0],this.profileRightAxisData[4*this._extrusionVertexCount+1]=e.right[1],this.profileRightAxisData[4*this._extrusionVertexCount+2]=e.right[2],this.profileUpAxisData[4*this._extrusionVertexCount+0]=e.up[0],this.profileUpAxisData[4*this._extrusionVertexCount+1]=e.up[1],this.profileUpAxisData[4*this._extrusionVertexCount+2]=e.up[2],this.profileVertexAndNormalData[4*this._extrusionVertexCount+0]=i[0],this.profileVertexAndNormalData[4*this._extrusionVertexCount+1]=i[1],this.profileVertexAndNormalData[4*this._extrusionVertexCount+2]=s[0],this.profileVertexAndNormalData[4*this._extrusionVertexCount+3]=s[1],this.pathVertexData[this._extrusionVertexCount]=t,this.profileRightAxisData[4*this._extrusionVertexCount+3]=r,this.profileUpAxisData[4*this._extrusionVertexCount+3]=o,++this._extrusionVertexCount}emitTriangle(t,e,i){this.vertexIndices[3*this._triangleCount+0]=t,this.vertexIndices[3*this._triangleCount+1]=e,this.vertexIndices[3*this._triangleCount+2]=i,this.pathVertexIndices[3*this._triangleCount+0]=this.pathVertexData[t],this.pathVertexIndices[3*this._triangleCount+1]=this.pathVertexData[e],this.pathVertexIndices[3*this._triangleCount+2]=this.pathVertexData[i],this.normalIndices[3*this._triangleCount+0]=t,this.normalIndices[3*this._triangleCount+1]=e,this.normalIndices[3*this._triangleCount+2]=i,++this._triangleCount}_rebuildGeometry(){const t=(t,e,i,s,r)=>this.emitVertex(t,e,i,s,r),e=(t,e,i,s,r,o)=>this.emitCapVertex(t,e,i,s,r,o);this._extrusionVertexCount=0;for(const i of this.path.vertices)this.originData[3*i.index+0]=i.pos[0],this.originData[3*i.index+1]=i.pos[1],this.originData[3*i.index+2]=i.pos[2];this.startCap.rebuildConnectingProfileGeometry(this.path.vertices[0],this.profile,e);for(let i=1;i<this.path.vertices.length-1;++i)this.extruder.extrude(this.path.vertices[i],this.profile,t);if(this.endCap.rebuildConnectingProfileGeometry(this.path.vertices[this.path.vertices.length-1],this.profile,e),this.startCap.rebuildCapGeometry(this.path.vertices[0],e),this.endCap.rebuildCapGeometry(this.path.vertices[this.path.vertices.length-1],e),this.profile.hasUV()&&this.options.generateUV)for(let i=0;i<this.profile.uvs.length;++i)this.uvData[2*i+0]=this.profile.uvs[i],this.uvData[2*i+1]=0}buildTopology(){const t=(t,e,i)=>this.emitTriangle(t,e,i);this._triangleCount=0;const e=this.profile.vertices.length,i=this.profile.numSegments,s=this.numExtrusionProfiles-1;let r=3*(2*(i*s));this.startCap.indexBufferStart=r,this.startCap.firstProfileVertexIndex=0,r+=this.startCap.getNumIndices(),this.endCap.indexBufferStart=r,this.endCap.firstProfileVertexIndex=e*(this.numExtrusionProfiles-1),r+=this.endCap.getNumIndices(),this.vertexIndices=new Uint32Array(r),this.normalIndices=new Uint32Array(r),this.pathVertexIndices=new Uint32Array(r),this.profile.hasUV()&&this.options.generateUV&&(this.uvIndices=new Uint32Array(r));for(let o=0;o<i;++o){const i=this.profile.vertexIndices[2*o],r=this.profile.vertexIndices[2*o+1];for(let o=0;o<s;++o){const s=o*e+i,h=(o+1)*e+r,n=o*e+r;t(s,(o+1)*e+i,h),t(s,h,n)}}this.startCap.buildTopology(this.path.vertices[0],t),this.endCap.buildTopology(this.path.vertices[this.path.vertices.length-1],t)}onPathChanged(){this._rebuildGeometry()}}class tt{constructor(t){this.builder=t}get xform(){return this.builder.path.xform}onPathChanged(){this.builder.onPathChanged()}}class et extends tt{constructor(t){super(t),this.vertexAttributePosition=null,this.vertexAttributeNormal=null,this.vertexAttributeColor=null,this.vertexAttributePosition=new Float32Array(3*this.builder.numVerticesTotal),this.vertexAttributeNormal=new Float32Array(3*this.builder.numNormalsTotal),this.vertexAttributeColor=new Uint8Array(4),this.vertexAttributeColor[0]=255,this.vertexAttributeColor[1]=255,this.vertexAttributeColor[2]=255,this.vertexAttributeColor[3]=255}bakeVertexColors(t){this.vertexAttributeColor[0]=255*t[0],this.vertexAttributeColor[1]=255*t[1],this.vertexAttributeColor[2]=255*t[2],this.vertexAttributeColor[3]=255*(t.length>3?t[3]:1)}bake(t){this.size=t;for(let e=0;e<this.builder.numVerticesTotal;++e){let i=this.builder.pathVertexData[e];const s=0===i||i===this.builder.path.vertices.length-1;i*=3;const r=st;N(r,this.builder.originData[i++],this.builder.originData[i++],this.builder.originData[i]);const o=4*e,h=nt,l=rt,u=at,d=lt,v=ut;let m=0,g=0;if(N(d,this.builder.profileRightAxisData[o],this.builder.profileRightAxisData[o+1],this.builder.profileRightAxisData[o+2]),N(v,this.builder.profileUpAxisData[o],this.builder.profileUpAxisData[o+1],this.builder.profileUpAxisData[o+2]),n(l,this.builder.profileVertexAndNormalData[o]*t[0],this.builder.profileVertexAndNormalData[o+1]*t[1]),s)I(u,v,d),m=this.builder.profileRightAxisData[o+3]*t[0],g=this.builder.profileUpAxisData[o+3];else{const t=ot,e=ht;n(t,this.builder.profileRightAxisData[o+3],this.builder.profileUpAxisData[o+3]);const i=x(t);c(t,t);const s=a(l,t);if(Math.abs(s)>i){n(e,-t[1],t[0]);const r=a(l,e);p(t,t,i*Math.sign(s)),p(e,e,r),f(l,t,e)}N(u,0,0,0)}N(h,d[0]*l[0]+v[0]*l[1],d[1]*l[0]+v[1]*l[1],d[2]*l[0]+v[2]*l[1]),this.vertexAttributePosition[3*e+0]=r[0]+h[0]+u[0]*m,this.vertexAttributePosition[3*e+1]=r[1]+h[1]+u[1]*m,this.vertexAttributePosition[3*e+2]=r[2]+h[2]+u[2]*m;const V=rt;n(V,this.builder.profileVertexAndNormalData[o+2],this.builder.profileVertexAndNormalData[o+3]),this.vertexAttributeNormal[3*e+0]=d[0]*V[0]+v[0]*V[1]+u[0]*g,this.vertexAttributeNormal[3*e+1]=d[1]*V[0]+v[1]*V[1]+u[1]*g,this.vertexAttributeNormal[3*e+2]=d[2]*V[0]+v[2]*V[1]+u[2]*g}}createGeometryData(){const t=[[O.POSITION,this.builder.vertexIndices],[O.NORMAL,this.builder.normalIndices]],e=[[O.POSITION,{size:3,data:this.vertexAttributePosition,exclusive:!0}],[O.NORMAL,{size:3,data:this.vertexAttributeNormal,exclusive:!0}]];if(this.vertexAttributeColor){const i=this.builder.vertexIndices.length;t.push([O.COLOR,new Uint32Array(i)]),e.push([O.COLOR,{size:4,data:this.vertexAttributeColor}])}return{vertexAttributes:e,indices:t}}onPathChanged(){super.onPathChanged(),this.bake(this.size)}intersect(t,e,i){const s=this.builder.vertexIndices,r={size:3,data:this.vertexAttributePosition},o=s.length/3;M(t,e,0,o,s,r,void 0,void 0,i)}}class it extends tt{constructor(t,e,i,s){super(t),this.sizeAttributeValue=e,this.colorAttributeValue=i,this.opacityAttributeValue=s,this.vvData=null,this.baked=new et(t),this.vvData=new Float32Array(4*this.builder.path.vertices.length);for(let r=0;r<this.builder.path.vertices.length;++r){this.vvData[4*r+0]=e,this.vvData[4*r+1]=i,this.vvData[4*r+2]=s;const t=0===r||r===this.builder.path.vertices.length-1;this.vvData[4*r+3]=t?1:0}}createGeometryData(){return{vertexAttributes:[[O.POSITION,{size:3,data:this.builder.originData,exclusive:!0}],[O.PROFILERIGHT,{size:4,data:this.builder.profileRightAxisData,exclusive:!0}],[O.PROFILEUP,{size:4,data:this.builder.profileUpAxisData,exclusive:!0}],[O.PROFILEVERTEXANDNORMAL,{size:4,data:this.builder.profileVertexAndNormalData,exclusive:!0}],[O.FEATUREVALUE,{size:4,data:this.vvData,exclusive:!0}]],indices:[[O.POSITION,this.builder.pathVertexIndices],[O.PROFILERIGHT,this.builder.vertexIndices],[O.PROFILEUP,this.builder.vertexIndices],[O.PROFILEVERTEXANDNORMAL,this.builder.vertexIndices],[O.FEATUREVALUE,this.builder.pathVertexIndices]]}}}const st=U(),rt=d(),ot=d(),ht=d(),nt=U(),at=U(),lt=U(),ut=U(),pt=U(),ft=k(),ct=h();export{$ as Builder,Q as CapBuilder,H as Extruder,it as FastUpdatePathGeometry,q as MiterExtruder,W as NoCapBuilder,z as Path,tt as PathGeometryData,G as PathVertex,j as Profile,Z as RoundCapBuilder,X as SimpleExtruder,et as StaticPathGeometry,Y as TriangulationCapBuilder,J as computeMinimumRotationTangentFrame,k as makeFrame,B as profileSpaceToVertexSpace,w as vertexSpaceToProfileSpace};
5
+ import{acosClamped as t,reciprocalClamped as e}from"../../../../core/mathUtils.js";import{s as i}from"../../../../chunks/mat2.js";import{c as s}from"../../../../chunks/mat2f64.js";import{h as r,d as o}from"../../../../chunks/mat4.js";import{c as h}from"../../../../chunks/mat4f64.js";import{s as n,h as a,p as l,a as u,b as p,j as f,f as c,i as x}from"../../../../chunks/vec2.js";import{a as d,d as v,f as m}from"../../../../chunks/vec2f64.js";import{e as g,c as V,a as A,n as b,g as C,b as D,f as I,o as R,s as N,l as P,m as S}from"../../../../chunks/vec3.js";import{c as U}from"../../../../chunks/vec3f64.js";import{create as _,fromPositionAndNormal as y,intersectRay as T}from"../../../../geometry/support/plane.js";import{wrap as L}from"../../../../geometry/support/ray.js";import F from"./GeometryUtil.js";import{VertexAttribute as O}from"./VertexAttribute.js";import{intersectTriangles as M}from"../materials/internal/MaterialUtil.js";function k(){return{up:U(),right:U()}}function E(t,e,i){S(t.up,e.up,i),S(t.right,e.right,i)}function B(t,e,i){t[0]=i[0]*e.right[0]+i[1]*e.up[0],t[1]=i[0]*e.right[1]+i[1]*e.up[1],t[2]=i[0]*e.right[2]+i[1]*e.up[2]}function w(t,e,i){n(t,g(i,e.right),g(i,e.up))}class G{constructor(){this.pos=U(),this.posES=U(),this.posGS=U(),this.vRight=U(),this.vLeft=U(),this.frame=k(),this.rotationFrame=k(),this.rotationRight=d(),this.rotationAngle=0,this.miterStretch=s()}setFrameFromUpVector(t){V(this.frame.up,t),A(at,this.vLeft,this.vRight),b(at,at),C(nt,this.frame.up,g(at,this.frame.up)),D(pt,at,nt),b(pt,pt),I(this.frame.right,pt,this.frame.up)}computeRotationAxisAndAngleFromUpVector(){V(this.rotationFrame.up,this.frame.up),V(this.rotationFrame.right,this.frame.right),n(this.rotationRight,1,0),C(nt,this.frame.up,g(this.frame.up,this.vLeft)),D(nt,this.vLeft,nt),R(nt,nt),b(nt,nt),C(at,this.frame.up,g(this.frame.up,this.vRight)),D(at,this.vRight,at),b(at,at),I(lt,this.rotationFrame.up,this.vLeft);const s=Math.sign(g(lt,this.vRight));if(this.rotationAngle=s*(Math.PI-t(g(nt,at))),Math.abs(this.rotationAngle)>0){const t=e(Math.cos(.5*this.rotationAngle));i(this.miterStretch,t-1+1,0,0,1)}const r=Math.PI-this.rotationAngle;this.maxStretchDistance=Math.abs(Math.min(this.vLeftLength,this.vRightLength)/Math.cos(.5*r))}}class j{constructor(){this.vertices=[],this.vertexIndices=[],this.vertexNormals=[],this.poles=[],this.poleIndices=[],this.uvs=null,this.uvIndices=null}addVertex(t,e){return this.vertices.push(v(t)),this.vertexNormals.push(v(e)),this.vertices.length-1}addUV(t){return this.uvs||(this.uvs=[],this.uvIndices=[]),this.uvs.push(t),this.uvs.length-1}addPole(t,e=null){return this.poles.push({position:v(t),normal:e?v(e):null}),this.poles.length-1}addSegment(t,e=null,i=null){this.vertexIndices.push(t.v0),this.vertexIndices.push(t.v1),e&&(this.uvIndices.push(e.v0),this.uvIndices.push(e.v1)),i&&(this.poleIndices.push(i.v0),this.poleIndices.push(i.v1))}get numSegments(){return this.vertexIndices.length/2}hasUV(){return null!=this.uvs}translate(t,e){for(const i of this.vertices)i[0]+=t,i[1]+=e;for(const i of this.poles)i.position[0]+=t,i.position[1]+=e}static circle(t=20){const e=.5,i=new j,s={v0:0,v1:0};i.addPole(m(0,0));for(let h=0;h<t;++h){const s=2*h*Math.PI/t,r=Math.cos(s),o=Math.sin(s),n=m(r*e,o*e),a=m(r,o);i.addVertex(n,a),i.addUV(h/t)}i.addUV(1);for(let h=0;h<t-1;++h){const t={v0:h,v1:h+1},e=t;i.addSegment(t,e,s)}const r={v0:t-1,v1:0},o={v0:t-1,v1:t};return i.addSegment(r,o,s),i}static rect(){const t=1,e=1,i=new j,s=m(.5*-t,.5*-e),r=m(.5*t,.5*-e),o=m(.5*t,.5*e),h=m(.5*-t,.5*e),n=m(0,-1),a=m(1,0),l=m(0,1),u=m(-1,0);i.addUV(0),i.addUV(1),i.addPole(m(0,.5*e),l),i.addPole(m(0,.5*e)),i.addPole(m(0,.5*-e)),i.addPole(m(0,.5*-e),n);const p={v0:0,v1:1};return i.addVertex(s,n),i.addVertex(r,n),i.addSegment({v0:0,v1:1},p,{v0:3,v1:3}),i.addVertex(r,a),i.addVertex(o,a),i.addSegment({v0:2,v1:3},p,{v0:2,v1:1}),i.addVertex(o,l),i.addVertex(h,l),i.addSegment({v0:4,v1:5},p,{v0:0,v1:0}),i.addVertex(h,u),i.addVertex(s,u),i.addSegment({v0:6,v1:7},p,{v0:1,v1:2}),i}}class z{constructor(t){this.vertices=[],this.offset=U(),this.xform=h(),this.vertices=t;const e=Math.floor((t.length-1)/2);V(this.offset,this.vertices[e].pos);for(const i of this.vertices)D(i.pos,i.pos,this.offset);r(this.xform,this.xform,this.offset),this.updatePathVertexInformation()}updatePathVertexInformation(){const t=this.vertices.length;let e=this.vertices[0];e.index=0,N(e.vLeft,0,0,0),e.vLeftLength=0,D(e.vRight,this.vertices[1].pos,e.pos),e.vRightLength=P(e.vRight),b(e.vRight,e.vRight);let i=e;for(let s=1;s<t;++s)e=this.vertices[s],e.index=s,V(e.vLeft,i.vRight),e.vLeftLength=i.vRightLength,s<t-1?(D(e.vRight,this.vertices[s+1].pos,e.pos),e.vRightLength=P(e.vRight),b(e.vRight,e.vRight)):(V(e.vRight,e.vLeft),e.vRightLength=e.vLeftLength),i=e}}function J(t,e){let i=null;const s=t.vertices.length,r=.99619469809,o=U(),h=U(),n=U(),a=U(),l=U(),u=U(),p=_();let f=t.vertices[0];V(h,e),N(o,0,1,0),F.makeOrthoBasisDirUpFallback(f.vRight,h,o,o,n,h,r),V(f.frame.up,h),V(f.frame.right,n),i=f;for(let c=1;c<s;++c){f=t.vertices[c],A(l,f.vLeft,f.vRight);let e=P(l);e>0?(e=1/Math.sqrt(e),l[0]=l[0]*e,l[1]=l[1]*e,l[2]=l[2]*e):(l[0]=f.vRight[0],l[1]=f.vRight[1],l[2]=f.vRight[2]),A(u,i.pos,i.frame.up),y(f.pos,l,p);T(p,L(u,f.vLeft),a)?(D(a,a,f.pos),b(h,a),I(n,l,h),b(n,n)):F.makeOrthoBasisDirUpFallback(l,i.frame.up,i.frame.right,o,n,h,r),V(f.frame.up,h),V(f.frame.right,n),i=f}}class H{}class X{numProfilesPerJoin(){return 1}extrude(t,e,i){for(let s=0;s<e.vertices.length;++s)i(t.index,t.frame,e.vertices[s],e.vertexNormals[s],!1)}}class q{constructor(t=.8*Math.PI,e=1){this.cutoffAngle=t,this.numBendSubdivisions=e}numProfilesPerJoin(){return this.numBendSubdivisions+1}extrude(t,e,i){const s=ft;if(Math.abs(t.rotationAngle)>=this.cutoffAngle)for(let r=0;r<this.numBendSubdivisions+1;++r){o(ct,.5*-t.rotationAngle+r*t.rotationAngle/this.numBendSubdivisions,t.rotationFrame.up),E(s,t.frame,ct);for(let r=0;r<e.vertices.length;++r){a(e.vertices[r],t.rotationRight)*t.rotationAngle>=0?i(t.index,s,e.vertices[r],e.vertexNormals[r],!1):(l(rt,e.vertices[r],t.miterStretch),i(t.index,t.frame,rt,e.vertexNormals[r],!0))}}else for(let r=0;r<this.numBendSubdivisions+1;++r)for(let s=0;s<e.vertices.length;++s){const r=a(e.vertices[s],t.rotationRight)*t.rotationAngle>=0;l(rt,e.vertices[s],t.miterStretch),i(t.index,t.frame,rt,e.vertexNormals[s],!r)}}}const K={generateUV:!1};class Q{rebuildConnectingProfileGeometry(t,e,i){for(let s=0;s<e.vertices.length;++s)i(t.index,t.frame,e.vertices[s],e.vertexNormals[s],0,0)}}class W extends Q{constructor(){super()}getNumVertices(){return 0}getNumIndices(){return 0}rebuildCapGeometry(){}buildTopology(){}}class Y extends Q{constructor(t,e=0,i=!1){super(),this.profile=t,this.profilePlaneOffset=e,this.flip=i}getNumVertices(){return this.profile.vertices.length}getNumIndices(){return 3*this.profile.numSegments}rebuildConnectingProfileGeometry(t,e,i){for(let s=0;s<e.vertices.length;++s)i(t.index,t.frame,e.vertices[s],e.vertexNormals[s],this.profilePlaneOffset,0)}rebuildCapGeometry(t,e){const i=ot;n(i,0,0);const s=this.flip?1:-1;for(let r=0;r<this.profile.vertices.length;++r)e(t.index,t.frame,this.profile.vertices[r],i,this.profilePlaneOffset,s)}buildTopology(t,e){const i=this.vertexBufferStart+this.profile.vertexIndices[0];for(let s=1;s<this.profile.numSegments;++s){const t=this.profile.vertexIndices[2*s+0],r=this.profile.vertexIndices[2*s+1],o=this.vertexBufferStart+t,h=this.vertexBufferStart+r;this.flip?e(h,o,i):e(i,o,h)}}}class Z extends Q{constructor(t){super(),this.flip=!1,this.sign=0,this.breakNormals=!1,this.numSegments=3,this.profile=t.profile,this.flip=t.flip,this.sign=this.flip?1:-1,this.breakNormals=t.breakNormals,this.numSegments=t.subdivisions}getNumVertices(){let t=0;return t=this.profile.vertices.length*(this.numSegments-1),this.breakNormals&&(t+=this.profile.vertices.length),t+=this.profile.poles.length,t}getNumIndices(){let t=0;t+=2*this.profile.numSegments*(this.numSegments-1);for(let e=0;e<this.profile.numSegments;++e){const i=this.profile.vertexIndices[2*e+0],s=this.profile.vertexIndices[2*e+1];this.profile.poleIndices[i]===this.profile.poleIndices[s]?t+=1:t+=2}return 3*t}rebuildCapGeometry(t,e){const i=t.frame,s=.5*this.sign,r=rt,o=ot;n(o,0,0);for(let h=0;h<this.profile.poles.length;++h){const r=this.profile.poles[h];r.normal?e(t.index,i,r.position,r.normal,s,0):e(t.index,i,r.position,o,s,this.sign)}if(this.breakNormals)for(let h=0;h<this.profile.vertices.length;++h)e(t.index,i,this.profile.vertices[h],this.profile.vertexNormals[h],0,0);for(let h=0;h<this.numSegments-1;++h){const n=(1-(h+1)/this.numSegments)*Math.PI*.5,a=Math.sin(n),l=Math.cos(n);for(let h=0;h<this.profile.vertices.length;++h){const n=this.profile.poles[this.profile.poleIndices[h]];u(r,this.profile.vertices[h],n.position),p(r,r,a),n.normal?(f(r,r,n.position),e(t.index,i,r,n.normal,s*l,0)):(c(o,r),p(o,o,a),f(r,r,n.position),e(t.index,i,r,o,s*l,this.sign*l))}}}buildTopology(t,e){const i=this.breakNormals?this.vertexBufferStart+this.profile.poles.length:this.firstProfileVertexIndex,s=this.breakNormals?this.vertexBufferStart+this.profile.poles.length+this.profile.vertices.length:this.vertexBufferStart+this.profile.poles.length;for(let r=0;r<this.profile.numSegments;++r){const t=this.profile.vertexIndices[2*r+0],o=this.profile.vertexIndices[2*r+1],h=this.vertexBufferStart+this.profile.poleIndices[t],n=this.vertexBufferStart+this.profile.poleIndices[o];let a=i+t,l=i+o;for(let i=0;i<this.numSegments-1;++i){const r=s+i*this.profile.vertices.length+t,h=s+i*this.profile.vertices.length+o;this.flip?(e(r,l,a),e(l,r,h)):(e(a,l,r),e(h,r,l)),a=r,l=h}this.flip?(e(h,l,a),h!==n&&e(h,n,l)):(e(a,l,h),h!==n&&e(l,n,h))}}}class ${constructor(t,e,i,s,r,o=K){this.options=o,this._extrusionVertexCount=0,this._triangleCount=0,this.numExtrusionProfiles=0,this.numVerticesTotal=0,this.numNormalsTotal=0,this.numUVTotal=0,this.profile=e,this.path=t,this.extruder=i,this.startCap=s,this.endCap=r;const h=this.path.vertices.length-2;this.numExtrusionProfiles=i.numProfilesPerJoin()*h+2,this.numVerticesTotal=e.vertices.length*this.numExtrusionProfiles,this.numNormalsTotal=this.numVerticesTotal,this.startCap.vertexBufferStart=this.numVerticesTotal;const n=this.startCap.getNumVertices();this.numVerticesTotal+=n,this.numNormalsTotal+=n,this.endCap.vertexBufferStart=this.numVerticesTotal;const a=this.endCap.getNumVertices();this.numVerticesTotal+=a,this.numNormalsTotal+=a,this.pathVertexData=new Float32Array(1*this.numVerticesTotal),this.profileRightAxisData=new Float32Array(4*this.numVerticesTotal),this.profileUpAxisData=new Float32Array(4*this.numVerticesTotal),this.profileVertexAndNormalData=new Float32Array(4*this.numVerticesTotal),this.profile.hasUV()&&this.options.generateUV&&(this.numUVTotal=this.profile.uvs.length,this.uvData=new Float32Array(2*this.numUVTotal)),this.originData=new Float32Array(3*this.path.vertices.length),this._rebuildGeometry(),this.buildTopology()}emitVertex(t,e,i,s,r){if(this.profileRightAxisData[4*this._extrusionVertexCount+0]=e.right[0],this.profileRightAxisData[4*this._extrusionVertexCount+1]=e.right[1],this.profileRightAxisData[4*this._extrusionVertexCount+2]=e.right[2],this.profileUpAxisData[4*this._extrusionVertexCount+0]=e.up[0],this.profileUpAxisData[4*this._extrusionVertexCount+1]=e.up[1],this.profileUpAxisData[4*this._extrusionVertexCount+2]=e.up[2],this.profileVertexAndNormalData[4*this._extrusionVertexCount+0]=i[0],this.profileVertexAndNormalData[4*this._extrusionVertexCount+1]=i[1],this.profileVertexAndNormalData[4*this._extrusionVertexCount+2]=s[0],this.profileVertexAndNormalData[4*this._extrusionVertexCount+3]=s[1],this.pathVertexData[this._extrusionVertexCount]=t,r){const e=this.path.vertices[t];this.profileRightAxisData[4*this._extrusionVertexCount+3]=e.rotationRight[0]*e.maxStretchDistance,this.profileUpAxisData[4*this._extrusionVertexCount+3]=e.rotationRight[1]*e.maxStretchDistance}else this.profileRightAxisData[4*this._extrusionVertexCount+3]=0,this.profileUpAxisData[4*this._extrusionVertexCount+3]=0;++this._extrusionVertexCount}emitCapVertex(t,e,i,s,r,o){this.profileRightAxisData[4*this._extrusionVertexCount+0]=e.right[0],this.profileRightAxisData[4*this._extrusionVertexCount+1]=e.right[1],this.profileRightAxisData[4*this._extrusionVertexCount+2]=e.right[2],this.profileUpAxisData[4*this._extrusionVertexCount+0]=e.up[0],this.profileUpAxisData[4*this._extrusionVertexCount+1]=e.up[1],this.profileUpAxisData[4*this._extrusionVertexCount+2]=e.up[2],this.profileVertexAndNormalData[4*this._extrusionVertexCount+0]=i[0],this.profileVertexAndNormalData[4*this._extrusionVertexCount+1]=i[1],this.profileVertexAndNormalData[4*this._extrusionVertexCount+2]=s[0],this.profileVertexAndNormalData[4*this._extrusionVertexCount+3]=s[1],this.pathVertexData[this._extrusionVertexCount]=t,this.profileRightAxisData[4*this._extrusionVertexCount+3]=r,this.profileUpAxisData[4*this._extrusionVertexCount+3]=o,++this._extrusionVertexCount}emitTriangle(t,e,i){this.vertexIndices[3*this._triangleCount+0]=t,this.vertexIndices[3*this._triangleCount+1]=e,this.vertexIndices[3*this._triangleCount+2]=i,this.pathVertexIndices[3*this._triangleCount+0]=this.pathVertexData[t],this.pathVertexIndices[3*this._triangleCount+1]=this.pathVertexData[e],this.pathVertexIndices[3*this._triangleCount+2]=this.pathVertexData[i],this.normalIndices[3*this._triangleCount+0]=t,this.normalIndices[3*this._triangleCount+1]=e,this.normalIndices[3*this._triangleCount+2]=i,++this._triangleCount}_rebuildGeometry(){const t=(t,e,i,s,r)=>this.emitVertex(t,e,i,s,r),e=(t,e,i,s,r,o)=>this.emitCapVertex(t,e,i,s,r,o);this._extrusionVertexCount=0;for(const i of this.path.vertices)this.originData[3*i.index+0]=i.pos[0],this.originData[3*i.index+1]=i.pos[1],this.originData[3*i.index+2]=i.pos[2];this.startCap.rebuildConnectingProfileGeometry(this.path.vertices[0],this.profile,e);for(let i=1;i<this.path.vertices.length-1;++i)this.extruder.extrude(this.path.vertices[i],this.profile,t);if(this.endCap.rebuildConnectingProfileGeometry(this.path.vertices[this.path.vertices.length-1],this.profile,e),this.startCap.rebuildCapGeometry(this.path.vertices[0],e),this.endCap.rebuildCapGeometry(this.path.vertices[this.path.vertices.length-1],e),this.profile.hasUV()&&this.options.generateUV)for(let i=0;i<this.profile.uvs.length;++i)this.uvData[2*i+0]=this.profile.uvs[i],this.uvData[2*i+1]=0}buildTopology(){const t=(t,e,i)=>this.emitTriangle(t,e,i);this._triangleCount=0;const e=this.profile.vertices.length,i=this.profile.numSegments,s=this.numExtrusionProfiles-1;let r=3*(2*(i*s));this.startCap.indexBufferStart=r,this.startCap.firstProfileVertexIndex=0,r+=this.startCap.getNumIndices(),this.endCap.indexBufferStart=r,this.endCap.firstProfileVertexIndex=e*(this.numExtrusionProfiles-1),r+=this.endCap.getNumIndices(),this.vertexIndices=new Uint32Array(r),this.normalIndices=new Uint32Array(r),this.pathVertexIndices=new Uint32Array(r),this.profile.hasUV()&&this.options.generateUV&&(this.uvIndices=new Uint32Array(r));for(let o=0;o<i;++o){const i=this.profile.vertexIndices[2*o],r=this.profile.vertexIndices[2*o+1];for(let o=0;o<s;++o){const s=o*e+i,h=(o+1)*e+r,n=o*e+r;t(s,(o+1)*e+i,h),t(s,h,n)}}this.startCap.buildTopology(this.path.vertices[0],t),this.endCap.buildTopology(this.path.vertices[this.path.vertices.length-1],t)}onPathChanged(){this._rebuildGeometry()}}class tt{constructor(t){this.builder=t}get xform(){return this.builder.path.xform}onPathChanged(){this.builder.onPathChanged()}}class et extends tt{constructor(t){super(t),this.vertexAttributePosition=null,this.vertexAttributeNormal=null,this.vertexAttributeColor=null,this.vertexAttributePosition=new Float32Array(3*this.builder.numVerticesTotal),this.vertexAttributeNormal=new Float32Array(3*this.builder.numNormalsTotal),this.vertexAttributeColor=new Uint8Array(4),this.vertexAttributeColor[0]=255,this.vertexAttributeColor[1]=255,this.vertexAttributeColor[2]=255,this.vertexAttributeColor[3]=255}bakeVertexColors(t){this.vertexAttributeColor[0]=255*t[0],this.vertexAttributeColor[1]=255*t[1],this.vertexAttributeColor[2]=255*t[2],this.vertexAttributeColor[3]=255*(t.length>3?t[3]:1)}bake(t){this.size=t;for(let e=0;e<this.builder.numVerticesTotal;++e){let i=this.builder.pathVertexData[e];const s=0===i||i===this.builder.path.vertices.length-1;i*=3;const r=st;N(r,this.builder.originData[i++],this.builder.originData[i++],this.builder.originData[i]);const o=4*e,h=nt,l=rt,u=at,d=lt,v=ut;let m=0,g=0;if(N(d,this.builder.profileRightAxisData[o],this.builder.profileRightAxisData[o+1],this.builder.profileRightAxisData[o+2]),N(v,this.builder.profileUpAxisData[o],this.builder.profileUpAxisData[o+1],this.builder.profileUpAxisData[o+2]),n(l,this.builder.profileVertexAndNormalData[o]*t[0],this.builder.profileVertexAndNormalData[o+1]*t[1]),s)I(u,v,d),m=this.builder.profileRightAxisData[o+3]*t[0],g=this.builder.profileUpAxisData[o+3];else{const t=ot,e=ht;n(t,this.builder.profileRightAxisData[o+3],this.builder.profileUpAxisData[o+3]);const i=x(t);c(t,t);const s=a(l,t);if(Math.abs(s)>i){n(e,-t[1],t[0]);const r=a(l,e);p(t,t,i*Math.sign(s)),p(e,e,r),f(l,t,e)}N(u,0,0,0)}N(h,d[0]*l[0]+v[0]*l[1],d[1]*l[0]+v[1]*l[1],d[2]*l[0]+v[2]*l[1]),this.vertexAttributePosition[3*e+0]=r[0]+h[0]+u[0]*m,this.vertexAttributePosition[3*e+1]=r[1]+h[1]+u[1]*m,this.vertexAttributePosition[3*e+2]=r[2]+h[2]+u[2]*m;const V=rt;n(V,this.builder.profileVertexAndNormalData[o+2],this.builder.profileVertexAndNormalData[o+3]),this.vertexAttributeNormal[3*e+0]=d[0]*V[0]+v[0]*V[1]+u[0]*g,this.vertexAttributeNormal[3*e+1]=d[1]*V[0]+v[1]*V[1]+u[1]*g,this.vertexAttributeNormal[3*e+2]=d[2]*V[0]+v[2]*V[1]+u[2]*g}}createGeometryData(){const t=[[O.POSITION,this.builder.vertexIndices],[O.NORMAL,this.builder.normalIndices]],e=[[O.POSITION,{size:3,data:this.vertexAttributePosition,exclusive:!0}],[O.NORMAL,{size:3,data:this.vertexAttributeNormal,exclusive:!0}]];if(this.vertexAttributeColor){const i=this.builder.vertexIndices.length;t.push([O.COLOR,new Uint32Array(i)]),e.push([O.COLOR,{size:4,data:this.vertexAttributeColor}])}return{vertexAttributes:e,indices:t}}onPathChanged(){super.onPathChanged(),this.bake(this.size)}intersect(t,e,i){const s=this.builder.vertexIndices,r={size:3,data:this.vertexAttributePosition},o=s.length/3;M(t,e,0,o,s,r,void 0,void 0,i)}}class it extends tt{constructor(t,e,i,s){super(t),this.sizeAttributeValue=e,this.colorAttributeValue=i,this.opacityAttributeValue=s,this.vvData=null,this.baked=new et(t),this.vvData=new Float32Array(4*this.builder.path.vertices.length);for(let r=0;r<this.builder.path.vertices.length;++r){this.vvData[4*r+0]=e,this.vvData[4*r+1]=i,this.vvData[4*r+2]=s;const t=0===r||r===this.builder.path.vertices.length-1;this.vvData[4*r+3]=t?1:0}}createGeometryData(){return{vertexAttributes:[[O.POSITION,{size:3,data:this.builder.originData,exclusive:!0}],[O.PROFILERIGHT,{size:4,data:this.builder.profileRightAxisData,exclusive:!0}],[O.PROFILEUP,{size:4,data:this.builder.profileUpAxisData,exclusive:!0}],[O.PROFILEVERTEXANDNORMAL,{size:4,data:this.builder.profileVertexAndNormalData,exclusive:!0}],[O.FEATUREVALUE,{size:4,data:this.vvData,exclusive:!0}]],indices:[[O.POSITION,this.builder.pathVertexIndices],[O.PROFILERIGHT,this.builder.vertexIndices],[O.PROFILEUP,this.builder.vertexIndices],[O.PROFILEVERTEXANDNORMAL,this.builder.vertexIndices],[O.FEATUREVALUE,this.builder.pathVertexIndices]]}}}const st=U(),rt=d(),ot=d(),ht=d(),nt=U(),at=U(),lt=U(),ut=U(),pt=U(),ft=k(),ct=h();export{$ as Builder,Q as CapBuilder,H as Extruder,it as FastUpdatePathGeometry,q as MiterExtruder,W as NoCapBuilder,z as Path,tt as PathGeometryData,G as PathVertex,j as Profile,Z as RoundCapBuilder,X as SimpleExtruder,et as StaticPathGeometry,Y as TriangulationCapBuilder,J as computeMinimumRotationTangentFrame,k as makeFrame,B as profileSpaceToVertexSpace,w as vertexSpaceToProfileSpace};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.25/esri/copyright.txt for details.
4
4
  */
5
- import{f as r}from"../../../../chunks/vec2f64.js";import{f as t}from"../../../../chunks/vec4f64.js";import{ShaderOutput as e}from"../core/shaderLibrary/ShaderOutputOptions.js";import s from"../lib/GLMaterial.js";import{Material as i,MaterialParameters as o}from"../lib/Material.js";import{RenderSlot as n}from"../lib/RenderSlot.js";import{DefaultBufferWriter as a,PositionUVLayout as u}from"./internal/DefaultBufferWriter.js";import{intersectTriangleGeometry as p}from"./internal/MaterialUtil.js";import{CheckerBoardTechnique as h}from"../shaders/CheckerBoardTechnique.js";import{CheckerBoardTechniqueConfiguration as f}from"../shaders/CheckerBoardTechniqueConfiguration.js";class l extends i{constructor(r){super(r,new m),this._configuration=new f}dispose(){}getConfiguration(r,t){return this._configuration.transparent=this.parameters.transparent,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.polygonOffset=this.parameters.polygonOffset,this._configuration.transparencyPassType=t.transparencyPassType,this._configuration.hasMultipassTerrain=t.multipassTerrain.enabled,this._configuration.cullAboveGround=t.multipassTerrain.cullAboveGround,this._configuration}intersect(r,t,e,s,i,o,n){return p(r,t,s,i,o,void 0,n)}requiresSlot(r){let t=n.OPAQUE_MATERIAL;return this.parameters.transparent&&(t=this.parameters.writeDepth?n.TRANSPARENT_MATERIAL:n.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL),r===t||r===n.DRAPED_MATERIAL}createGLMaterial(r){return r.output===e.Color||r.output===e.Alpha?new c(r):null}createBufferWriter(){return new a(u)}}class c extends s{beginSlot(r){return this.ensureTechnique(h,r)}}class m extends o{constructor(){super(...arguments),this.size=r(1,1),this.color1=t(.75,.75,.75,1),this.color2=t(.5,.5,.5,1),this.transparent=!1,this.writeDepth=!0,this.polygonOffset=!1}}export{l as CheckerBoardMaterial,m as Parameters};
5
+ import{f as r}from"../../../../chunks/vec2f64.js";import{f as t}from"../../../../chunks/vec4f64.js";import{ShaderOutput as e}from"../core/shaderLibrary/ShaderOutput.js";import i from"../lib/GLMaterial.js";import{Material as s,MaterialParameters as n}from"../lib/Material.js";import{RenderSlot as o}from"../lib/RenderSlot.js";import{DefaultBufferWriter as a,PositionUVLayout as u}from"./internal/DefaultBufferWriter.js";import{intersectTriangleGeometry as p}from"./internal/MaterialUtil.js";import{CheckerBoardTechnique as h}from"../shaders/CheckerBoardTechnique.js";import{CheckerBoardTechniqueConfiguration as f}from"../shaders/CheckerBoardTechniqueConfiguration.js";class c extends s{constructor(r){super(r,new m),this._configuration=new f}dispose(){}getConfiguration(r,t){return this._configuration.transparent=this.parameters.transparent,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.polygonOffset=this.parameters.polygonOffset,this._configuration.transparencyPassType=t.transparencyPassType,this._configuration.hasMultipassTerrain=t.multipassTerrain.enabled,this._configuration.cullAboveGround=t.multipassTerrain.cullAboveGround,this._configuration}intersect(r,t,e,i,s,n,o){return p(r,t,i,s,n,void 0,o)}requiresSlot(r,t){if(t===e.Color||t===e.Alpha){return r===(this.parameters.transparent?this.parameters.writeDepth?o.TRANSPARENT_MATERIAL:o.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL:o.OPAQUE_MATERIAL)||r===o.DRAPED_MATERIAL}return!1}createGLMaterial(r){return new l(r)}createBufferWriter(){return new a(u)}}class l extends i{beginSlot(r){return this.ensureTechnique(h,r)}}class m extends n{constructor(){super(...arguments),this.size=r(1,1),this.color1=t(.75,.75,.75,1),this.color2=t(.5,.5,.5,1),this.transparent=!1,this.writeDepth=!0,this.polygonOffset=!1}}export{c as CheckerBoardMaterial,m as Parameters};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.25/esri/copyright.txt for details.
4
4
  */
5
- import{Z as t}from"../../../../chunks/vec4f64.js";import{ShaderOutput as e}from"../core/shaderLibrary/ShaderOutputOptions.js";import{CullFaceOptions as r}from"../lib/basicInterfaces.js";import s from"../lib/GLMaterial.js";import{outputFromPass as i}from"../lib/GLMaterials.js";import{Material as a,MaterialParameters as o}from"../lib/Material.js";import{OITPolygonOffsetLimit as n}from"../lib/OrderIndependentTransparency.js";import{RenderSlot as h}from"../lib/RenderSlot.js";import{DefaultBufferWriter as u,PositionColorLayout as l}from"./internal/DefaultBufferWriter.js";import{intersectTriangleGeometry as c}from"./internal/MaterialUtil.js";import{ColorMaterialTechnique as p}from"../shaders/ColorMaterialTechnique.js";import{ColorMaterialTechniqueConfiguration as f}from"../shaders/ColorMaterialTechniqueConfiguration.js";class m extends a{constructor(t){super(t,new d),this.supportsEdges=!0,this._configuration=new f}getConfiguration(t,e){return this._configuration.output=t,this._configuration.cullFace=this.parameters.cullFace,this._configuration.hasVertexColors=this.parameters.hasVertexColors,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.transparent=this.parameters.transparent,this._configuration.polygonOffset=this.parameters.polygonOffset,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.hasOccludees=this.parameters.hasOccludees,this._configuration.transparencyPassType=e.transparencyPassType,this._configuration.enableOffset=e.camera.relativeElevation<n,this._configuration.hasMultipassTerrain=e.multipassTerrain.enabled,this._configuration.cullAboveGround=e.multipassTerrain.cullAboveGround,this._configuration}intersect(t,e,r,s,i,a,o){c(t,e,s,i,a,void 0,o)}requiresSlot(t,r){if(t===h.DRAPED_MATERIAL)return!0;if(i(r)===e.Highlight)return t===h.OPAQUE_MATERIAL;return t===(this.parameters.transparent?this.parameters.writeDepth?h.TRANSPARENT_MATERIAL:h.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL:h.OPAQUE_MATERIAL)}createGLMaterial(t){return t.output===e.Color||t.output===e.Alpha||t.output===e.Highlight||t.output===e.Depth&&this.parameters.writeLinearDepth?new _(t):null}createBufferWriter(){return new u(l)}}class _ extends s{_updateOccludeeState(t){t.hasOccludees!==this._material.parameters.hasOccludees&&this._material.setParameters({hasOccludees:t.hasOccludees})}beginSlot(t){return this._output!==e.Color&&this._output!==e.Alpha||this._updateOccludeeState(t),this.ensureTechnique(p,t)}}class d extends o{constructor(){super(...arguments),this.color=t,this.transparent=!1,this.writeDepth=!0,this.writeLinearDepth=!1,this.hasVertexColors=!1,this.polygonOffset=!1,this.hasSlicePlane=!1,this.cullFace=r.None,this.hasOccludees=!1}}export{m as ColorMaterial,d as Parameters};
5
+ import{Z as e}from"../../../../chunks/vec4f64.js";import{ShaderOutput as t}from"../core/shaderLibrary/ShaderOutput.js";import{CullFaceOptions as r}from"../lib/basicInterfaces.js";import s from"../lib/GLMaterial.js";import{Material as i,MaterialParameters as a}from"../lib/Material.js";import{OITPolygonOffsetLimit as n}from"../lib/OrderIndependentTransparency.js";import{RenderSlot as o}from"../lib/RenderSlot.js";import{DefaultBufferWriter as h,PositionColorLayout as l}from"./internal/DefaultBufferWriter.js";import{intersectTriangleGeometry as u}from"./internal/MaterialUtil.js";import{ColorMaterialTechnique as c}from"../shaders/ColorMaterialTechnique.js";import{ColorMaterialTechniqueConfiguration as p}from"../shaders/ColorMaterialTechniqueConfiguration.js";class f extends i{constructor(e){super(e,new _),this.supportsEdges=!0,this._configuration=new p}getConfiguration(e,t){return this._configuration.output=e,this._configuration.cullFace=this.parameters.cullFace,this._configuration.hasVertexColors=this.parameters.hasVertexColors,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.transparent=this.parameters.transparent,this._configuration.polygonOffset=this.parameters.polygonOffset,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.hasOccludees=this.parameters.hasOccludees,this._configuration.transparencyPassType=t.transparencyPassType,this._configuration.enableOffset=t.camera.relativeElevation<n,this._configuration.hasMultipassTerrain=t.multipassTerrain.enabled,this._configuration.cullAboveGround=t.multipassTerrain.cullAboveGround,this._configuration}intersect(e,t,r,s,i,a,n){u(e,t,s,i,a,void 0,n)}requiresSlot(e,r){if(r===t.Color||r===t.Alpha||r===t.Highlight||r===t.Depth&&this.parameters.writeLinearDepth){if(e===o.DRAPED_MATERIAL)return!0;if(r===t.Highlight)return e===o.OPAQUE_MATERIAL;return e===(this.parameters.transparent?this.parameters.writeDepth?o.TRANSPARENT_MATERIAL:o.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL:o.OPAQUE_MATERIAL)}return!1}createGLMaterial(e){return new m(e)}createBufferWriter(){return new h(l)}}class m extends s{_updateOccludeeState(e){e.hasOccludees!==this._material.parameters.hasOccludees&&this._material.setParameters({hasOccludees:e.hasOccludees})}beginSlot(e){return this._output!==t.Color&&this._output!==t.Alpha||this._updateOccludeeState(e),this.ensureTechnique(c,e)}}class _ extends a{constructor(){super(...arguments),this.color=e,this.transparent=!1,this.writeDepth=!0,this.writeLinearDepth=!1,this.hasVertexColors=!1,this.polygonOffset=!1,this.hasSlicePlane=!1,this.cullFace=r.None,this.hasOccludees=!1}}export{f as ColorMaterial,_ as Parameters};