@arcgis/core 5.2.0-next.43 → 5.2.0-next.45

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 (207) hide show
  1. package/assets/esri/core/workers/RemoteClient.js +1 -1
  2. package/assets/esri/core/workers/chunks/0115681a3de6df0aebdf.js +1 -0
  3. package/assets/esri/core/workers/chunks/025caafc70ac26f0a4ed.js +1 -0
  4. package/assets/esri/core/workers/chunks/{9de18cea5780319302cb.js → 04a167c110fb7811169d.js} +1 -1
  5. package/assets/esri/core/workers/chunks/{72fe7fb03c156f26a589.js → 08e18fb12533fc76e49c.js} +1 -1
  6. package/assets/esri/core/workers/chunks/{60e8524d324fd14444d7.js → 0a0732ba8271d7dc985c.js} +1 -1
  7. package/assets/esri/core/workers/chunks/0e64e20fedfe01a1985f.js +1 -0
  8. package/assets/esri/core/workers/chunks/{e6b5c015205d38abe037.js → 127b111ee53e4b9184f8.js} +1 -1
  9. package/assets/esri/core/workers/chunks/15351354afcbf840a23d.js +29 -0
  10. package/assets/esri/core/workers/chunks/{2d7cfc68a38dabd8898a.js → 176c5eaaa23a479c88e0.js} +1 -1
  11. package/assets/esri/core/workers/chunks/1d1f5578c7d8619f7a46.js +1 -0
  12. package/assets/esri/core/workers/chunks/268637fd6c50264acfc3.js +1 -0
  13. package/assets/esri/core/workers/chunks/296fa9fb80e521c30cb1.js +1 -0
  14. package/assets/esri/core/workers/chunks/{d7775ed1402946e414ef.js → 2974cddb0b0f67df7d2d.js} +1 -1
  15. package/assets/esri/core/workers/chunks/2c0d92c0e3511775401a.js +29 -0
  16. package/assets/esri/core/workers/chunks/{ce2320e7b9c4ca96ff27.js → 3252da57b800356116af.js} +1 -1
  17. package/assets/esri/core/workers/chunks/{fd47ee8598e37fea03fe.js → 384b619854ef8a3f6e94.js} +1 -1
  18. package/assets/esri/core/workers/chunks/3af923abeb6e65c4468f.js +1 -0
  19. package/assets/esri/core/workers/chunks/{20fefb9278501781de14.js → 3f4f1595c8a77d072b04.js} +1 -1
  20. package/assets/esri/core/workers/chunks/4f09f208ece2ec1db727.js +1 -0
  21. package/assets/esri/core/workers/chunks/{f1f3fe9d2d96578f4f6b.js → 52efa4ded11c1e71f04f.js} +1 -1
  22. package/assets/esri/core/workers/chunks/{57a1e2b716b74f0124f7.js → 549295a5db9bf1536491.js} +1 -1
  23. package/assets/esri/core/workers/chunks/{284e88805184334396fe.js → 57374213084bef59b776.js} +1 -1
  24. package/assets/esri/core/workers/chunks/{2a8d791aef3123e6a3c4.js → 57970d43cdcc5cf57a30.js} +1 -1
  25. package/assets/esri/core/workers/chunks/5f9c4dad6952c4c58ebf.js +1 -0
  26. package/assets/esri/core/workers/chunks/706230b70a36d2e038f7.js +1 -0
  27. package/assets/esri/core/workers/chunks/{4063ea53cba3dd897e53.js → 728ea88e7d4733230e1f.js} +71 -72
  28. package/assets/esri/core/workers/chunks/{e2f45990d8459d14cb90.js → 76713b700e053f8bad29.js} +1 -1
  29. package/assets/esri/core/workers/chunks/{d082de5dd83bd73d209b.js → 8026cc0065f6520c4161.js} +1 -1
  30. package/assets/esri/core/workers/chunks/93e705c1147cc8ceca02.js +1 -0
  31. package/assets/esri/core/workers/chunks/a8033e606b2db1ee332d.js +1 -0
  32. package/assets/esri/core/workers/chunks/{7684f0c771d312e05bb4.js → ad5c2b0de6713d0a93a4.js} +58 -58
  33. package/assets/esri/core/workers/chunks/{9b1199104a6822ab7340.js → ae9f9e975d7a9d442fa5.js} +1 -1
  34. package/assets/esri/core/workers/chunks/{6f408397e2c8a2ea9805.js → aea247138617e12b699b.js} +1 -1
  35. package/assets/esri/core/workers/chunks/{26e7884d8639df4d994b.js → b03dcf3d55266745f3d1.js} +1 -1
  36. package/assets/esri/core/workers/chunks/b3cd17daf5a297b96705.js +29 -0
  37. package/assets/esri/core/workers/chunks/{c0637d1c9337a6ba46b0.js → b3cefc1895bfd62fc440.js} +1 -1
  38. package/assets/esri/core/workers/chunks/{89682d9d4f606f82056b.js → bac4d4a9f3a9b7f6864d.js} +2 -2
  39. package/assets/esri/core/workers/chunks/{2f29f08cddd5add9388e.js → c01a121ebe571a848452.js} +1 -1
  40. package/assets/esri/core/workers/chunks/c3cd38ca8690286d40d7.js +1 -0
  41. package/assets/esri/core/workers/chunks/{c1845682cc9a5aac8703.js → c4b13124a9cfc78c42a6.js} +6 -6
  42. package/assets/esri/core/workers/chunks/c5e36544b2d1792e4c5f.js +1 -0
  43. package/assets/esri/core/workers/chunks/c6042825f61cd70d54d8.js +1 -0
  44. package/assets/esri/core/workers/chunks/{0646524250bb9fe82935.js → d8b67ca02cdc1e8191e3.js} +1 -1
  45. package/assets/esri/core/workers/chunks/db416ba3132034e20642.js +1 -0
  46. package/assets/esri/core/workers/chunks/{96d5fed0235558c0e348.js → e9c48630757bea465b7e.js} +1 -1
  47. package/assets/esri/core/workers/chunks/{e9511627418c6864148a.js → ed988360264574cd8f6b.js} +1 -1
  48. package/assets/esri/core/workers/chunks/f9b2727b41943d83d4ca.js +1 -0
  49. package/assets/esri/core/workers/chunks/{d45e30f15142b5861111.js → fc880b275f5eaf42171e.js} +1 -1
  50. package/assets/esri/libs/basisu/basis_encoder.wasm +0 -0
  51. package/assets/esri/libs/dxtEncoder/dxt_encoder.wasm +0 -0
  52. package/chunks/CutFillComposition.glsl.js +2 -2
  53. package/chunks/CutFillReduction.glsl.js +1 -1
  54. package/chunks/EmissionComposite.glsl.js +2 -0
  55. package/chunks/FocusAreaColor.glsl.js +1 -1
  56. package/chunks/Fog.glsl.js +20 -20
  57. package/chunks/GlobalIllumination.glsl.js +25 -25
  58. package/chunks/GlobalIlluminationBlur.glsl.js +1 -1
  59. package/chunks/GlowBlur.glsl.js +16 -18
  60. package/chunks/GlowComposite.glsl.js +35 -0
  61. package/chunks/Laserline.glsl.js +13 -13
  62. package/chunks/LaserlinePath.glsl.js +11 -10
  63. package/chunks/OITAddEmission.glsl.js +1 -1
  64. package/chunks/Precipitation.glsl.js +6 -6
  65. package/chunks/ShadowCastVisualize.glsl.js +2 -2
  66. package/chunks/ShadowHighlight.glsl.js +3 -3
  67. package/chunks/Viewshed.glsl.js +3 -3
  68. package/chunks/basis_encoder.js +1 -1
  69. package/chunks/dxt_encoder.js +1 -1
  70. package/config.js +1 -1
  71. package/core/screenUtils.js +1 -1
  72. package/core/types.d.ts +7 -0
  73. package/geometry/support/aaBoundingBox.js +1 -1
  74. package/geometry/support/frustum.js +1 -1
  75. package/kernel.js +1 -1
  76. package/layers/VoxelWasmPerSceneView.js +1 -1
  77. package/package.json +2 -2
  78. package/support/revision.js +1 -1
  79. package/views/2d/engine/webgl/Painter.js +1 -1
  80. package/views/2d/webglDeps.js +1 -1
  81. package/views/3d/environment/CloudyWeather.js +1 -1
  82. package/views/3d/environment/FoggyWeather.js +1 -1
  83. package/views/3d/environment/RainyWeather.js +1 -1
  84. package/views/3d/environment/SnowyWeather.js +1 -1
  85. package/views/3d/environment/SunnyWeather.js +1 -1
  86. package/views/3d/input/SceneInputManager.js +1 -1
  87. package/views/3d/layers/I3SMeshView3D.js +1 -1
  88. package/views/3d/layers/i3s/I3SGeometryUtil.js +1 -1
  89. package/views/3d/layers/i3s/I3SIndex.js +1 -1
  90. package/views/3d/layers/i3s/I3SIntersectionHandler.js +1 -1
  91. package/views/3d/layers/i3s/I3SMeshViewFilter.js +1 -1
  92. package/views/3d/layers/i3s/I3SUtil.js +1 -1
  93. package/views/3d/layers/i3s/PointCloudRenderer.js +1 -1
  94. package/views/3d/layers/support/Tiles3DMeshIntersectionHandler.js +1 -1
  95. package/views/3d/support/debugFlags.js +1 -1
  96. package/views/3d/support/gaussianSplatting/GaussianSplatIntersectionHandler.js +1 -1
  97. package/views/3d/support/hitTest.js +1 -1
  98. package/views/3d/support/intersectionHitUtils.js +2 -0
  99. package/views/3d/terrain/TerrainRenderer.js +1 -1
  100. package/views/3d/webgl-engine/Stage.js +1 -1
  101. package/views/3d/webgl-engine/collections/Component/ComponentObject.js +1 -1
  102. package/views/3d/webgl-engine/collections/Component/ComponentObjectCollection.js +1 -1
  103. package/views/3d/webgl-engine/collections/Component/ComponentObjectElevationAgnosticBVH.js +1 -1
  104. package/views/3d/webgl-engine/collections/Component/ComponentObjectElevationAgnosticComponentGeometryBVH.js +1 -1
  105. package/views/3d/webgl-engine/collections/Component/ComponentObjectFixedBVH.js +1 -1
  106. package/views/3d/webgl-engine/collections/Component/ElevationAgnosticBVH.js +1 -1
  107. package/views/3d/webgl-engine/collections/Component/IntersectionGeometry.js +1 -1
  108. package/views/3d/webgl-engine/collections/Component/Material/ComponentData.glsl.js +12 -12
  109. package/views/3d/webgl-engine/collections/Component/Transform.js +1 -1
  110. package/views/3d/webgl-engine/collections/Component/UniformComponentParameters.js +1 -1
  111. package/views/3d/webgl-engine/core/FBOCache.js +1 -1
  112. package/views/3d/webgl-engine/core/shaderLibrary/ScreenSpacePass.glsl.js +2 -2
  113. package/views/3d/webgl-engine/core/shaderLibrary/output/getEmissions.glsl.js +8 -0
  114. package/views/3d/webgl-engine/core/shaderLibrary/util/blendEmission.glsl.js +2 -0
  115. package/views/3d/webgl-engine/effects/atmosphere/ChapmanAtmosphere.js +1 -1
  116. package/views/3d/webgl-engine/effects/debug/RenderNodeVisualizerNode.js +1 -1
  117. package/views/3d/webgl-engine/effects/focusArea/FocusAreaVisualization.js +1 -1
  118. package/views/3d/webgl-engine/effects/fog/Fog.glsl.js +1 -1
  119. package/views/3d/webgl-engine/effects/fog/Fog.js +1 -1
  120. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIllumination.glsl.js +1 -1
  121. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIllumination.js +1 -1
  122. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIlluminationBlur.glsl.js +1 -1
  123. package/views/3d/webgl-engine/effects/glow/Glow.js +1 -1
  124. package/views/3d/webgl-engine/effects/glow/GlowBlur.glsl.js +1 -1
  125. package/views/3d/webgl-engine/effects/glow/GlowComposite.glsl.js +2 -0
  126. package/views/3d/webgl-engine/effects/glow/GlowCompositeTechnique.js +2 -0
  127. package/views/3d/webgl-engine/effects/haze/Haze.js +1 -1
  128. package/views/3d/webgl-engine/effects/highlight/ShadowHighlight.glsl.js +1 -1
  129. package/views/3d/webgl-engine/effects/highlight/ShadowHighlight.js +1 -1
  130. package/views/3d/webgl-engine/effects/laserlines/LaserLineRenderer.js +1 -1
  131. package/views/3d/webgl-engine/effects/laserlines/Laserline.glsl.js +1 -1
  132. package/views/3d/webgl-engine/effects/laserlines/LaserlinePath.glsl.js +1 -1
  133. package/views/3d/webgl-engine/effects/laserlines/LaserlinePathTechniqueConfiguration.js +1 -1
  134. package/views/3d/webgl-engine/effects/precipitation/Precipitation.js +1 -1
  135. package/views/3d/webgl-engine/effects/precipitation/PrecipitationTechniqueConfiguration.js +1 -1
  136. package/views/3d/webgl-engine/effects/transparency/OITAddEmission.glsl.js +1 -1
  137. package/views/3d/webgl-engine/effects/transparency/OITBlend.js +1 -1
  138. package/views/3d/webgl-engine/effects/transparency/OITBlendFragmentTechniqueConfiguration.js +1 -1
  139. package/views/3d/webgl-engine/effects/transparency/oitBlendFragment.glsl.js +1 -1
  140. package/views/3d/webgl-engine/lib/CutFillComputation.js +1 -1
  141. package/views/3d/webgl-engine/lib/CutFillVisualization.js +1 -1
  142. package/views/3d/webgl-engine/lib/EmissionComposite.glsl.js +2 -0
  143. package/views/3d/webgl-engine/lib/EmissionComposite.js +2 -0
  144. package/views/3d/webgl-engine/lib/EmissionCompositeTechnique.js +2 -0
  145. package/views/3d/webgl-engine/lib/HUDIntersectorResult.js +1 -1
  146. package/views/3d/webgl-engine/lib/Intersector.js +1 -1
  147. package/views/3d/webgl-engine/lib/IntersectorResult.js +1 -1
  148. package/views/3d/webgl-engine/lib/MainFramebuffer.js +1 -1
  149. package/views/3d/webgl-engine/lib/PolygonIntersectionResults.js +1 -1
  150. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  151. package/views/3d/webgl-engine/lib/ShadowCastRenderer.js +1 -1
  152. package/views/3d/webgl-engine/lib/SortedRenderGeometryRenderer.js +1 -1
  153. package/views/3d/webgl-engine/lib/TriangleIntersectionData.js +1 -1
  154. package/views/3d/webgl-engine/lib/Viewshed.js +1 -1
  155. package/views/3d/webgl-engine/lib/intersectorUtilsConversions.js +1 -1
  156. package/views/3d/webgl-engine/lib/lodRendering/LodResources.js +1 -1
  157. package/views/3d/webgl-engine/lib/screenPolygonOverlapUtils.js +1 -1
  158. package/views/3d/webgl-engine/lib/screenPolygonTriangleIntersections.js +1 -1
  159. package/views/3d/webgl-engine/parts/RenderView.js +1 -1
  160. package/views/3d/webgl-engine/shaders/CutFillComposition.glsl.js +1 -1
  161. package/views/3d/webgl-engine/shaders/EmissiveTechniqueConfiguration.js +2 -0
  162. package/views/3d/webgl-engine/shaders/GaussianSplatCompositionTechniqueConfiguration.js +1 -1
  163. package/views/3d/webgl-engine/shaders/OutputColorHighlightOLID.glsl.js +2 -2
  164. package/views/3d/webgl-engine/shaders/ViewshedTechnique.js +1 -1
  165. package/views/3d/webgl-engine/shaders/{oitResolution.glsl.js → floatBlendScale.glsl.js} +1 -1
  166. package/views/SceneView.d.ts +4 -3
  167. package/views/SceneView.js +1 -1
  168. package/views/input/BrowserEventSource.js +1 -1
  169. package/views/input/InputManager.js +1 -1
  170. package/views/support/TextureCompressionWorker.js +1 -1
  171. package/views/support/TextureCompressionWorkerHandle.js +1 -1
  172. package/views/support/imageReprojection.js +1 -1
  173. package/views/webgl/Texture.js +1 -1
  174. package/widgets/Sketch/SketchViewModel.js +1 -1
  175. package/assets/esri/core/workers/chunks/0d6afba80d2f8dcb5cf7.js +0 -1
  176. package/assets/esri/core/workers/chunks/1276df03201c1b855fee.js +0 -1
  177. package/assets/esri/core/workers/chunks/23570397304969f724b3.js +0 -1
  178. package/assets/esri/core/workers/chunks/34fcb776e4de1d870bbd.js +0 -30
  179. package/assets/esri/core/workers/chunks/474ea8c97d101e41b3f5.js +0 -1
  180. package/assets/esri/core/workers/chunks/7cb0681cc6a5e956cb15.js +0 -1
  181. package/assets/esri/core/workers/chunks/8b73694d5a97638a3a61.js +0 -1
  182. package/assets/esri/core/workers/chunks/8dee03779b569f233daf.js +0 -1
  183. package/assets/esri/core/workers/chunks/9ebc98746b1f085b82b7.js +0 -1
  184. package/assets/esri/core/workers/chunks/9ee3741eef73f3edb18b.js +0 -1
  185. package/assets/esri/core/workers/chunks/af97e19516dbbcfb5286.js +0 -1
  186. package/assets/esri/core/workers/chunks/b4047333265a2665aef9.js +0 -1
  187. package/assets/esri/core/workers/chunks/ca419858910af5505d3d.js +0 -1
  188. package/assets/esri/core/workers/chunks/cce83896093279c70449.js +0 -1
  189. package/assets/esri/core/workers/chunks/d5561dff043789494845.js +0 -1
  190. package/assets/esri/core/workers/chunks/dedf678490572c500a19.js +0 -30
  191. package/assets/esri/core/workers/chunks/e2c9393bec747f7876bb.js +0 -1
  192. package/assets/esri/core/workers/chunks/e94f2d6037fba042dc6e.js +0 -1
  193. package/assets/esri/core/workers/chunks/ec1a2e68957fae48e60b.js +0 -30
  194. package/assets/esri/core/workers/chunks/f5d7f69047e1b1116202.js +0 -1
  195. package/chunks/GlowComposition.glsl.js +0 -39
  196. package/views/2d/engine/webgl/MaterialManager.js +0 -2
  197. package/views/2d/engine/webgl/shaders/MaterialPrograms.js +0 -2
  198. package/views/2d/engine/webgl/shaders/sources/resolver.js +0 -2
  199. package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +0 -2
  200. package/views/3d/webgl-engine/core/shaderLibrary/output/Emissions.glsl.js +0 -9
  201. package/views/3d/webgl-engine/effects/fog/FogTechniqueConfiguration.js +0 -2
  202. package/views/3d/webgl-engine/effects/glow/GlowBlurTechniqueConfiguration.js +0 -2
  203. package/views/3d/webgl-engine/effects/glow/GlowComposition.glsl.js +0 -2
  204. package/views/3d/webgl-engine/effects/glow/GlowCompositionTechnique.js +0 -2
  205. package/views/3d/webgl-engine/effects/glow/GlowCompositionTechniqueConfiguration.js +0 -2
  206. package/views/webgl/ShaderCompiler.js +0 -2
  207. /package/assets/esri/core/workers/chunks/{89682d9d4f606f82056b.js.LICENSE.txt → bac4d4a9f3a9b7f6864d.js.LICENSE.txt} +0 -0
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{update as t}from"../../../../core/arrayUtils.js";import{createTask as s}from"../../../../core/asyncUtils.js";import has from"../../../../core/has.js";import{removeMaybe as i,abortMaybe as r,destroyMaybe as a,releaseMaybe as n,releaseReferencedMaybe as h}from"../../../../core/maybe.js";import{throwIfAborted as o}from"../../../../core/promiseUtils.js";import{watch as d,syncAndInitial as l,initial as u,sync as m}from"../../../../core/reactiveUtils.js";import{signal as _}from"../../../../core/signal.js";import{property as p,subclass as c}from"../../../../core/accessorSupport/decorators.js";import{equals as f,invert as b,multiply as g,copy as P}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as w,create as E}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as I}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{fromValues as A,ZEROS as C}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{pruneIndexArrays as T}from"../../../../geometry/support/Indices.js";import{RenderNodeOutput as O,InternalRenderCategory as R,AllRenderNodeOutputs as S,AllInternalRenderNodeOutputs as D}from"../../webgl.js";import{minNearDistanceInMeters as N}from"../../state/NearFarHeuristic.js";import{debugFlags as F}from"../../support/debugFlags.js";import{computeShadowsEnabled as G}from"../../support/sunUtils.js";import{FBOCache as H}from"../core/FBOCache.js";import{RenderPassManager as x}from"../core/renderPasses/RenderPassManager.js";import{isColor as y}from"../core/shaderLibrary/ShaderOutput.js";import{distanceFadeEnd as v}from"../core/shaderLibrary/shading/ScreenSpaceConstants.js";import{RenderNodes as M}from"../effects/RenderNodes.js";import{RenderPluginManager as L}from"../effects/RenderPluginManager.js";import{WeatherFader as q}from"../effects/WeatherFader.js";import{innerAtmosphereFadeStart as j}from"../effects/atmosphere/atmosphereUtils.js";import{Blit as U}from"../effects/blit/Blit.js";import{maxHighlightsPerChannel as B,renderHighlightBuffer as V}from"../effects/highlight/Highlight.js";import{OITBlend as k}from"../effects/transparency/OITBlend.js";import{AnimationTimer as W}from"./AnimationTimer.js";import{AnimationTimeStep as Q}from"./AnimationTimeStep.js";import{BoundingInfo as z}from"./BoundingInfo.js";import{Compositor as Y}from"./Compositor.js";import{DepthRange as J}from"./DepthRange.js";import{depthRangeFromScene as X}from"./depthRangeUtils.js";import{MainFramebuffer as $}from"./MainFramebuffer.js";import{NavigationDepthCache as K}from"./NavigationDepthCache.js";import{blendingColorAlphaClear as Z}from"./OrderIndependentTransparency.js";import{RenderContext as ee,defaultRenderOccludedMask as te}from"./RenderContext.js";import{RendererBase as se}from"./RendererBase.js";import{setupFeatureDefaults as ie}from"./RenderFeature.js";import{RenderPluginInput as re}from"./RenderPluginInput.js";import{ShadowAccumulator as ae}from"./ShadowAccumulator.js";import{ShadowMap as ne}from"./ShadowMap.js";import he from"./SliceHelper.js";import{MergedRenderer as oe}from"../materials/renderers/MergedRenderer.js";import{RenderSceneResult as de}from"../parts/renderUtils.js";import{RendererPerformanceInfo as le,PerformanceCategory as ue}from"../statistics/RendererPerformanceInfo.js";import{ColorAttachment1 as me,PixelType as _e,ColorAttachment2 as pe,ColorAttachment0 as ce,DrawBufferNone as fe}from"../../../webgl/enums.js";const be=has("disable-feature:async-navigation-3d-depth-readback");let ge=class extends se{constructor(e,t,s,i,r){super({stage:e}),this._techniques=s,this._rctx=i,this._requestRender=r,this._pluginsHas={occludedHudElements:!1,hudElements:!1,water:!1},this.renderPassManager=new x,this._isRendering=!1,this._inGlobeView=!1,this._backgroundColor=A(0,0,0,1),this._sliceHelper=new he,this.sceneDepthRange=_(J.Infinite),this._state=_(2),this._hasGlobalIlluminationFlag=!!has("enable-feature:global-illumination"),this._hasAnimations=!1,this._animationTimestep=new Q,this._loadEdgeViewTask=null,this._edgeViewCallbacks=[],this._reprojectionMatrixVersion=_(0),this._renderHiddenTransparentEdges=()=>{},this._pluginInput=new re,this._hasTransparentGeometry=!1,this._releaseNodeInputs=e=>{for(const t of Ne)e.some(({name:e})=>e===t)&&this._pluginInput.release(t)},this._testsNeedsDepth=!1,this._fboCache=new H(i),this._compositor=new Y(i,s),this._renderStateFeatures=_(ie(e.view.qualityProfile));const a=new ne(this._fboCache,e.viewingMode);this._renderContext=new ee(this._rctx,a,s),this._framebuffer=new $(this._fboCache,this._bindParameters),this._performanceInfo=new le(this._rctx),this._blit=new U(s),this.navigationDepthCache=new K(this._rctx,this._fboCache,s,()=>this._requestRender(0)),this._shadowAccumulator=new ae(this.fboCache,s,e,(t,s,i)=>{const r=e.view.qualitySettings.maximumPixelRatio;t.shadowMap.start(t.camera,s,i,!0,r),this._renderShadowCascades(5,t.shadowMap),t.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(t.camera,t.contentCamera)},r),this._nodes=new M(this._renderContext),this._plugins=new L({renderContext:this._renderContext,techniques:s,materials:t,requestRender:r,controller:e}),this._plugins.add(this.renderPassManager),this.weatherFader=new q({view:e.view,context:this._renderContext}),this.addHandles([d(()=>e.view.state.camera,()=>r(),l),d(()=>F.EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES,e=>{this._renderHiddenTransparentEdges=e?()=>this._renderEdges(0):()=>{},r()},u),d(()=>e.view.environment.background?.color,e=>{const t=e?e.toUnitRGBA():C;I(this._backgroundColor,t[0]*t[3],t[1]*t[3],t[2]*t[3],t[3]),r()},l),d(()=>e.view.state.camera.relativeElevation,e=>this._inGlobeView=(e??1/0)>=v,l),d(()=>this._bindParameters.clouds.fadeFactor,()=>{this._bindParameters.fadeLighting(),this._requestRender(2)},m),d(()=>this._bindParameters.clouds.data?.state,()=>r(),m),d(()=>e.view.state.highlights,e=>{this._bindParameters.highlights=e,r()},u),d(()=>"sun"===e.view.environment.lighting?.type,e=>{this._bindParameters.enableFillLights=e,this._requestRender()},l)])}destroy(){this._gpuTimerHandle=i(this._gpuTimerHandle),this._nodes.destroy(),this._framebuffer.dispose(),this._shadowAccumulator.destroy(),this._shadowAccumulator=null,this._loadEdgeViewTask=r(this._loadEdgeViewTask),this._edgeView=a(this._edgeView),this.renderPassManager.dispose(),this.weatherFader=a(this.weatherFader),this._releaseFBOs(),this._disposeOffscreenBuffers(),this.navigationDepthCache.destroy(),this._fboCache.destroy(),this._fboCache=null,this._renderContext.destroy(),this._plugins.destroy(),this._pluginInput=null,this._oitBlendOrNil=null,this._nodes=null,this._framebuffer=null,this._performanceInfo=null,z.prune(),oe.prune(),T()}get renderContext(){return this._renderContext}get _bindParameters(){return this._renderContext.bind}get _oitBlend(){return this._oitBlendOrNil??=new k(this._techniques),this._oitBlendOrNil}get performanceInfo(){return this._performanceInfo}updateRenderFeatures(e){this._renderStateFeatures.value=ie(e),this._requestRender()}isFeatureEnabled(e,t=this._state.value){return this._renderStateFeatures.value.get(t,e)??!1}setFeatureEnabled(e,t,s){this._renderStateFeatures.mutate(i=>i.set(t,e,s)),this._requestRender()}setTime(e){this._renderContext.time=e}get hasReflections(){return this._bindParameters.screenSpaceReflections.enabled=this._pluginsHas.water&&this.isFeatureEnabled(4),this._bindParameters.screenSpaceReflections.enabled}get _hasHighlights(){return this._plugins.produces(10,2,4,18,12,13,14)}hasHighlight(e){return this._plugins.hasHighlight(e)}get _hasHUDHighlights(){return this._plugins.produces(10,12,13,14)}get hasAmbientIllumination(){return this.isFeatureEnabled(3)&&!this._inGlobeView}get hasGlobalIllumination(){return this._hasGlobalIlluminationFlag&&this.hasAmbientIllumination}get hasGlobalIlluminationHighQuality(){return this.hasGlobalIllumination&&this.isFeatureEnabled(10)}get _keepGlobalIlluminationShadingAlive(){return this._hasGlobalIlluminationFlag&&!this._inGlobeView}get hasSMAA(){return this.isFeatureEnabled(0)}get _emissions(){return this._plugins.emissions}get hasFloatBlend(){return this._rctx.driverTest.floatBufferBlend.result&&this.isFeatureEnabled(9)}get highResolutionAtmosphere(){return this.isFeatureEnabled(2)}get fboCache(){return this._fboCache}_releaseFBOs(){this._bindParameters.hudOcclusion=n(this._bindParameters.hudOcclusion),this._bindParameters.depth=null}_disposeOffscreenBuffers(){this._framebuffer.dispose(),this._bindParameters.globalIllumination=n(this._bindParameters.globalIllumination),this._bindParameters.reprojection.lastFrameDepth=n(this._bindParameters.reprojection.lastFrameDepth),this._bindParameters.reprojection.lastFrameEmission=n(this._bindParameters.reprojection.lastFrameEmission),this._disposeBindBuffers()}_disposeBindBuffers(){this._bindParameters.shadowMap.disposeOutputs()}get updating(){return this._loadEdgeViewTask&&!this._loadEdgeViewTask.finished||this._edgeView?.updating||this._plugins.updating||this.weatherFader?.readyToRun||!this.isCameraFinal}loadEdgeView(){return this._loadEdgeViewTask||(this._loadEdgeViewTask=s(async e=>{const{EdgeView:t}=await import("./edgeRendering/EdgeView.js");o(e);const s=this._edgeView=new t({rctx:this._rctx,renderSR:this.stage.view.renderSpatialReference,viewingMode:this.stage.view.stage.viewingMode,techniques:this._techniques,setNeedsRender:()=>this._requestRender(),schedule:ye(this.stage.view.resourceController)});return this.addHandles(d(()=>s.updating,()=>this._requestRender(),m)),this._requestRender(),this._edgeViewCallbacks.forEach(e=>e(s)),this._edgeViewCallbacks.length=0,s})),this._loadEdgeViewTask.promise}withEdgeView(e){this.loadEdgeView(),null==this._edgeView?this._edgeViewCallbacks.push(e):e(this._edgeView)}get edgeView(){return this._edgeView}get isCameraFinal(){return this._reprojectionMatrixVersion.value>=0&&f(this._bindParameters.reprojection.matrix,w)}set _reprojectionMatrix(e){t(this._bindParameters.reprojection.matrix,e)&&this._reprojectionMatrixVersion.value++}modifyShadowsEnabled(){const e=this.stage.view.environmentManager.referencePositionGeographic,t=null==e||G(e[2],this.stage.viewingMode),s=this.stage.view.environment.lighting.directShadowsEnabled&&t;this._bindParameters.shadowMap.enabled!==s&&(this._bindParameters.shadowMap.enabled=s,this._requestRender(1))}get shadowsEnabled(){return!!this._bindParameters.shadowMap.enabled}setParameters(e){e.shadowCast&&this._shadowAccumulator.setParameters(e.shadowCast)}set slice(e){this._sliceHelper.update(e)&&this._requestRender()}get plugins(){return this._plugins}commit(e,t){return this._isRendering&&console.warn("Renderer.modify called while rendering"),!!super.commit(e,t,this._plugins.context)&&(this.updateHasFlags(),!0)}addRenderer(e){this._plugins.add(e)}removeRenderer(e){this._plugins.remove(e)}get occludedRequiresStencil(){return this._occludedRequiresOccludeeStencil||this.occludedRequiresIntegratedMeshStencil}get _occludedRequiresOccludeeStencil(){return this._bindParameters.hasOccludees&&!!(8&this.plugins.renderOccludedFlags)}get occludedRequiresIntegratedMeshStencil(){return this._plugins.produces(0,0)&&this._plugins.produces(0,9)}updateHasFlags(){const has=this._pluginsHas;has.occludedHudElements=this._plugins.produces(0,13),has.hudElements=has.occludedHudElements||this._plugins.produces(0,...Te),has.water=this._plugins.produces(4,19),this._bindParameters.hasOccludees=this._plugins.hasOccludees,this._requestRender()}updateAnimation(e,t){this._animationTimer??=new W(e.camera,t),this._animationTimer.advance(e.camera,t,this._animationTimeDilation);const s=this._hasAnimations;return this._hasAnimations=this._plugins.updateAnimation(this._animationTimer),this._hasAnimations=this._nodes.updateAnimation(this._animationTimer)||this._hasAnimations,this._hasAnimations!==s&&(this._gpuTimerHandle=s?i(this._gpuTimerHandle):this.performanceInfo.enableGPUPerformanceInfo()),this._hasAnimations}get animationTimestep(){return this._animationTimestep.value}get _animationTimeDilation(){return this._animationTimestep.timeDilation}resetAnimation(){this._animationTimestep.clear()}tick(){this.fboCache.clean()}render(e,t,s=!1){try{return this._isRendering=!0,this._render(e,t,s)}catch(i){console.error(`Exception during rendering: ${i}:\n${i.stack}`)}finally{this._isRendering=!1}return new de(this._pluginInput.get(O.FINAL),null)}_render(e,t,s){const i=0===t;this.performanceInfo.startFrame(),this.fboCache.frameStart(),this.fboCache.interactive=i,this._disposeBindBuffers();const{camera:r,contentCamera:a,mode:o,alignPixelEnabled:d}=e;this._state.value=o,this._bindParameters.output=0,this._bindParameters.emissions=this._emissions,this._bindParameters.alignPixelEnabled=d,this._bindParameters.decorations=!s,this._bindParameters.mainDepth=null,this._bindParameters.useFloatBlend.value=this.hasFloatBlend;const l=!s||!this._sliceHelper.isDecoration;this._bindParameters.slicePlane=l?this._sliceHelper.plane:null,this._bindParameters.viewshedEnabled=this._nodes.produces(R.VIEWSHED),this._bindParameters.cutFillComputationEnabled=this._nodes.produces(R.CUTFILL_COMPUTATION),this._bindParameters.cutFillVisualizationEnabled=this._nodes.produces(R.CUTFILL_COLOR),this._renderOverlay(),r.setGLViewport(this._rctx);const u=this._framebuffer,m=u.initialize(r.fullWidth,r.fullHeight,this._backgroundColor),_=this._needsLastFrameColor;_?(m?.retain(_-1),m?.setName("last frame color"),this._bindParameters.reprojection.lastFrameColor=m):m?.release(),this._ensureBindParameters(r,a),this._plugins.sortTestsTransparentOrderedSlots(Re),this._plugins.prepareRender(),this._bindParameters.hasShadowHighlights=this._needsShadowHighlight&&!s,this._shadowAccumulator.fullyRecompute=!i,this._shadowAccumulator.updateCamera(r),this._hasTransparentGeometry=this._plugins.produces(0,...we),this._precompilePrepasses(),this.performanceInfo.advance(ue.PREPARE);const p=this._computeShadowDepthRange(r);this._pluginInput.set("normals",this._renderNormals()),this._renderAmbientIlluminationAndDepth(),this._renderShadowMap(r,a,this._bindParameters.lighting.mainLight.direction,p),this._renderShadowAccumulation(p),u.bind(),this._bindParameters.mainDepth=u.depth.attachment,this._precompileShaders(i),this._bindParameters.output=0,this._renderOpaque(),this._renderPreTransparent(),this._renderTransparent(),this.hasReflections&&(this._bindParameters.depth=h(this._bindParameters.depth),this._bindParameters.reprojection.lastFrameColor=h(this._bindParameters.reprojection.lastFrameColor)),this._bindParameters.shadowMap.disposeOutput(5),u.update(e=>this._renderNodes(R.CUTFILL_COMPUTATION,e)),this._pluginInput.set(R.FOCUSAREA,this._renderFocusAreaGeometry()),u.update(e=>this._renderNodes(R.TRANSPARENT_ENVIRONMENT,e)),u.update(e=>this._renderNodes(R.VIEWSHED,e)),u.update(e=>this._renderNodes(R.LASERLINES,e)),this._nodes.requireGeometryDepth&&(this._bindParameters.depth=h(this._bindParameters.depth)),u.update(e=>this._renderNodes(R.FOCUSAREA_COLOR,e)),u.update(e=>this._renderNodes(R.CUTFILL_COLOR,e)),this._pluginInput.release(R.FOCUSAREA),this._pluginInput.release(R.GROUND_DEPTH),u.update(e=>this._renderNodes(R.OCCLUDED,e)),this._pluginInput.set("highlights",this._renderHighlightPrepass());const c=2===t?this._renderObjectAndLayerIdColor():null;u.update(e=>this._renderNodes(O.COMPOSITE,e)),this._bindParameters.shadowMap.disposeOutputs(),this._bindParameters.shadowHighlight=n(this._bindParameters.shadowHighlight),u.update(e=>this._renderNodes(R.ANTIALIASING,e));const f=this._hasTransparentGeometry?2:1,b=this._bindParameters.emissions;let g;return this._bindParameters.emissions=0,this._hasHUDHighlights&&u.update(e=>this._renderHUD(f,e)),u.update(e=>this._renderNodes(R.HIGHLIGHT_COLOR,e)),this._hasHUDHighlights||u.update(e=>this._renderHUD(f,e)),this._bindParameters.emissions=b,u.update(e=>this._renderNodes(R.MAGNIFIER,e)),u.update(e=>this._renderNodes(O.FINAL,e)),i&&(this._blit.toFramebuffer(u.color,this._bindParameters),be||2!==o&&0!==o||this.navigationDepthCache.update(this._bindParameters,u.depth.attachment,this._renderContext.time)),this.hasGlobalIllumination&&(this._bindParameters.reprojection.lastFrameDepth=this._bindParameters.depth,0!==this._emissions&&(this._bindParameters.reprojection.lastFrameEmission=u.color.obtainAttachment(me))),this._testsNeedsDepth&&(this._bindParameters.depth=h(this._bindParameters.depth)),this._releaseFBOs(),u.releaseDepth(),this._bindParameters.reprojection.lastFrameCamera.copyFrom(this._bindParameters.camera),this.fboCache.frameEnd(),i||(g=u.color,g.retain(),this._releaseFBOs(),this._disposeOffscreenBuffers()),this.performanceInfo.finishFrame(),new de(g,c)}_precompileShaders(e){++this._plugins.context.techniques.precompiling;const t=this._bindParameters;t.output=0;const s=t.emissions;if(this._precompileOpaqueGeometry(),this._nodes.precompile(t.hasOpaqueEmission,R.OPAQUE_ENVIRONMENT,R.GAUSSIAN_SPLAT,R.OPAQUE_OCCLUSION_QUERY,R.VOXEL),this._precompileOpaqueGeometry(),t.output=3,this._plugins.precompile(...Ee),t.output=0,this._plugins.precompile(...Ee),this._hasTransparentGeometry){const e=this._pluginsHas.occludedHudElements;this._oitBlend.precompile(t,e,0),this._pluginsHas.hudElements&&this._oitBlend.precompile(t,!1,1),this._precompileTransparentGeometry(),t.hasTransparentEmission&&(t.emissions=3)}this._nodes.precompile(t.hasOpaqueEmission,R.FOCUSAREA),this._compositor.precompile(this._usesPremultipliedAlphaBlit,!!this._needsEdges,t),this._hasTransparentGeometry||this._plugins.precompile(15),this._nodes.precompile(t.hasOpaqueEmission,R.TRANSPARENT_ENVIRONMENT,R.VIEWSHED,R.CUTFILL_COMPUTATION,R.CUTFILL_COLOR,R.LASERLINES,R.FOCUSAREA_COLOR,R.OCCLUDED,R.ANTIALIASING),t.highlightMixTexture=t.highlights.length>1?this._rctx.emptyTexture:null,this._precompileHUD(0),t.emissions=0,this._precompileHUD(0),this._precompileHUD(1),t.emissions=s,this._hasHighlights&&(t.highlights.forEach((e,s)=>{t.highlightLevel=s,this._precompileAllGeometry(10),this._hasHUDHighlights&&this._plugins.precompile(13,12)}),t.highlightLevel=null,this._nodes.precompile(t.hasOpaqueEmission,R.HIGHLIGHT_COLOR)),t.highlightMixTexture=null,this._nodes.precompile(t.hasOpaqueEmission,O.COMPOSITE,R.MAGNIFIER),this._shadowAccumulator.precompile(),this._plugins.precompile(8),t.hasOpaqueEmission&&(t.transparentWithoutDepthEmissionDimmingPass=!0,this._plugins.precompile(8),t.transparentWithoutDepthEmissionDimmingPass=!1),e&&this._blit.precompile(),--this._plugins.context.techniques.precompiling}_renderFocusAreaGeometry(){const e=this._nodes.produce(R.FOCUSAREA,this._pluginInput);return e&&this.performanceInfo.advance(ue.FOCUS_AREA_MASK),e}_renderObjectAndLayerIdColor(){if(!this._nodes.produces(R.OBJECT_AND_LAYER_ID_COLOR))return null;const e=this._bindParameters.output;++this._techniques.precompiling;const{width:t,height:s}=this._framebuffer.size;let i=this.fboCache.acquire(t,s,R.OBJECT_AND_LAYER_ID_COLOR).acquireDepth(14);return i=this._renderNodes(R.OBJECT_AND_LAYER_ID_COLOR,i),--this._techniques.precompiling,this._bindParameters.output=e,i}finish(e){this._hasAnimations||this._animationTimestep.clear();const t=this.performanceInfo.gpuSamplingEnabled,s=0===e;if(s||t){const e=s?this.performanceInfo.elapsedTime:0;let i=0;t?i=this.performanceInfo.totalGPUTimeSampler.last:this._rctx.gl.finish();const r=Math.max(e,i);this._animationTimestep.frame(r,s)}}readAccumulatedShadow(e){return this._shadowAccumulator.readAccumulatedShadow(e[0],e[1])}readMainDepth(e,t){const{mainDepth:s,camera:i}=this._bindParameters;if(!s)return;const r=this.fboCache.acquire(this._framebuffer.size.width,this._framebuffer.size.height,"linear depth");this._rctx.bindFramebuffer(r.fbo),i.setGLViewport(this._rctx),this._rctx.setScissorRect(e[0],e[1],e[2],e[3]),this._rctx.setScissorTestEnabled(!0),this._rctx.clearFramebuffer(C),this._compositor.blitDepthToLinearDepth(this._bindParameters,s),this._rctx.setScissorTestEnabled(!1),this._rctx.setScissorRect(0,0,this._rctx.gl.canvas.width,this._rctx.gl.canvas.width),r.fbo?.readPixels(e[0],e[1],e[2],e[3],6408,_e.UNSIGNED_BYTE,t),r.release()}get _needsEdges(){return this._edgeView?.shouldRender()?this._edgeView:null}_renderEdges(e){const t=this._needsEdges;if(!t)return;const{width:s,height:i}=this._framebuffer.size,r=this.fboCache.acquire(s,i,"edges");r.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(r.fbo),this._rctx.clearFramebuffer(C),t.render(this._bindParameters,e),r.detachDepth(),this._framebuffer.bind(),this._compositor.composite(this._bindParameters,r.getTexture()),r.release(),this.performanceInfo.advance(1===e?ue.OPAQUE_EDGES:ue.TRANSPARENT_EDGES)}_renderOverlay(){this._bindParameters.overlay=this.overlay?.render(this._renderContext.time),this._bindParameters.overlay&&this.performanceInfo.advance(ue.OVERLAY)}_renderShadowMap(e,t,s,i){if(!this.shadowsEnabled)return;const r=this._bindParameters.shadowMap;if(r.start(e,s,i,this.isFeatureEnabled(5),this.stage.view.qualitySettings.maximumPixelRatio),this._needsShadowHighlight){this._renderShadowCascades(6,r),e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,t);const s=this._bindParameters.output;this._bindParameters.output=0,this._bindParameters.shadowHighlight=this._nodes.produce(R.SHADOW_HIGHLIGHT,this._pluginInput),this._bindParameters.output=s,r.disposeOutput(6),r.clear(),this._renderShadowCascades(7,r)}else this._renderShadowCascades(5);e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,this._bindParameters.contentCamera),this._needsShadowHighlight&&(this._bindParameters.depth=h(this._bindParameters.depth)),this.performanceInfo.advance(R.SHADOWMAP)}_precompileShadowCascades(e){0!==this._bindParameters.shadowMap.cascades.length&&this._precompileAllGeometry(e)}_renderShadowCascades(e,t=this._bindParameters.shadowMap){const s=this._bindParameters.output,i=t===this._bindParameters.shadowMap&&6!==e;t.bindFramebuffer();for(const r of t.cascades)r.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(r.camera,r.camera),this.renderAllGeometry(e),i&&this._renderShadowNodes();t.finish(e),this._bindParameters.output=s}_renderShadowNodes(){const e=this._bindParameters.shadowMap.renderTarget;e&&(this._renderNodes(R.SHADOWMAP,e),this._pluginInput.set(R.SHADOWMAP,null))}get _needsLastFrameColor(){return+this.hasReflections+ +this.hasGlobalIllumination}get _needsDepth(){return+this._nodes.requireGeometryDepth+ +this.hasReflections+ +this.hasGlobalIllumination+ +this._shadowAccumulator.requiresDepth+ +this._testsNeedsDepth+ +this._needsShadowHighlight}get _usesPremultipliedAlphaBlit(){return this._pluginsHas.hudElements}_renderAmbientIlluminationAndDepth(){this._bindParameters.depth=n(this._bindParameters.depth);const e=this._pluginInput.get("normals");if(e){this._pluginInput.set(R.AMBIENT_ILLUMINATION,this._hasGlobalIlluminationFlag?this._renderGlobalIllumination():this._renderSSAO());const t=this._needsDepth;t?(this._rctx.bindFramebuffer(e.fbo),this._rctx.clear(1024),this._renderGeometryWithoutNormals(3),this._bindParameters.depth=e.obtainDepthTexture(),this._bindParameters.depth?.retain(t-1),this.performanceInfo.advance(ue.DEPTH)):e.detachDepth(),this.hasAmbientIllumination&&this._pluginInput.release("normals")}else this._hasGlobalIlluminationFlag&&(this._releaseGlobalIlluminationBuffers(),this._bindParameters.globalIlluminationEnabled=this._keepGlobalIlluminationShadingAlive),this._renderAllGeometryDepth()}_renderAllGeometryDepth(){const e=this._needsDepth;if(0===e)return;const{width:t,height:s}=this._framebuffer.size,i=this.fboCache.acquire(t,s,"geometry depth",14);this._rctx.bindFramebuffer(i.fbo),this._rctx.clear(1280),this.renderAllGeometry(3),this._bindParameters.depth=i.obtainDepthTexture(),this._bindParameters.depth?.retain(e-1),i.release(),this.performanceInfo.advance(ue.DEPTH)}get _needsShadowDepthRange(){return this._bindParameters.shadowMap.enabled||this._shadowAccumulator.active}_computeShadowDepthRange(e){if(!this._needsShadowDepthRange)return J.Zero;const t=X(e,this._plugins.plugins,this.stage.layers,0);return t.union(this._plugins.queryDepthRange(e)),this._bindParameters.shadowMap.enabled&&t.union(this._nodes.queryDepthRange(R.SHADOWMAP,e)),t.near=Math.max(e.near,t.near),t.far=Math.min(e.far,t.far),t}updateSceneDepthRange(e){if(!this.stage.view.state.isGlobal)return void(this.sceneDepthRange.value=J.Infinite);if((this.stage.view.renderCoordsHelper?.getAltitude(e.eye)??0)<j)return void(this.sceneDepthRange.value=J.Infinite);const t=e.clone();t.near=N,t.far=1e10;const s=X(t,this._plugins.plugins,this.stage.layers,1);s.union(this._plugins.queryDepthRange(t)),this.sceneDepthRange.value.equals(s)||(this.sceneDepthRange.value=s)}get _normalsRequired(){return this._nodes.require("normals",...S,R.VIEWSHED,R.LASERLINES)+(this.hasAmbientIllumination?1:0)}_precompilePrepasses(){this._normalsRequired?(this._precompilePlugins(4,Ie),this._needsDepth&&this._precompilePlugins(3,Ae)):this._needsDepth&&this._precompileAllGeometry(3),this.shadowsEnabled&&(this._needsShadowHighlight?(this._nodes.precompile(this._bindParameters.hasEmission,R.SHADOW_HIGHLIGHT),this._precompileShadowCascades(6),this._precompileShadowCascades(7)):this._precompileShadowCascades(5),this._nodes.precompile(!1,R.SHADOWMAP)),this._shadowAccumulator.active&&(this._shadowAccumulator.precompilePrepass(),this._precompileAllGeometry(5)),this.hasAmbientIllumination&&this._normalsRequired&&this._nodes.precompile(this._bindParameters.hasEmission,R.AMBIENT_ILLUMINATION)}_renderNormals(){const e=this._normalsRequired;if(0===e)return;const{width:t,height:s}=this._framebuffer.size,i=this.fboCache.acquire(t,s,"normals",5);i.acquireDepth(14),this._rctx.bindFramebuffer(i.fbo),this._rctx.clearFramebuffer(C,!0,!0),this._bindParameters.output=4,this._plugins.render(...Ie);const r=this._nodes.optional("normals",...S,R.VIEWSHED);return i.retain(e+r-1),this.performanceInfo.advance(ue.NORMALS),i}_renderSSAO(){this._bindParameters.globalIlluminationEnabled=!1;const e=this._pluginInput.get("normals");return this.hasAmbientIllumination&&e?(this._bindParameters.ssao=this._nodes.produce(R.AMBIENT_ILLUMINATION,this._pluginInput),this._bindParameters.ssao&&this.performanceInfo.advance(ue.AMBIENT_ILLUMINATION),this._bindParameters.ssao):null}_renderGlobalIllumination(){if(!this.hasGlobalIllumination)return this._releaseGlobalIlluminationBuffers(),this._bindParameters.globalIlluminationEnabled=this._keepGlobalIlluminationShadingAlive,null;const e=this._nodes.produce(R.AMBIENT_ILLUMINATION,this._pluginInput);return this._releaseGlobalIlluminationBuffers(),this._bindParameters.globalIllumination=e,this._bindParameters.globalIlluminationEnabled=!0,this.performanceInfo.advance(this.hasGlobalIlluminationHighQuality?ue.AMBIENT_ILLUMINATION_HIGH_QUALITY:ue.AMBIENT_ILLUMINATION),e}_releaseGlobalIlluminationBuffers(){const e=this._bindParameters;e.reprojection.lastFrameColor=h(e.reprojection.lastFrameColor),e.reprojection.lastFrameDepth=h(e.reprojection.lastFrameDepth),e.reprojection.lastFrameEmission=h(e.reprojection.lastFrameEmission),e.globalIllumination=h(e.globalIllumination),e.globalIlluminationEnabled=!1}_precompileAllGeometry(e){const t=this._bindParameters.output;this._bindParameters.output=e,this._precompileOpaqueGeometry(),this._precompileTransparentGeometry(),this._plugins.precompile(...Ee),this._bindParameters.output=t}renderAllGeometry(e){this._bindParameters.output=e,this._renderOpaqueAndTransparentGeometry(e),this._renderTransparentGround()}precompileSlots(e,...t){for(const s of t)this._bindParameters.slot=s,e.precompile(this._renderContext)}precompileOccludedSlots(e,t){for(const s of t)this._renderContext.renderOccludedMask=s,this.precompileSlots(e,...Ce);this._renderContext.renderOccludedMask=te}renderSlots(e,...t){for(const s of t)this._bindParameters.slot=s,e.forAll(e=>{const t=e.acquireTechniques(this._renderContext);t&&e.render(this._renderContext,t)})}renderOccludedSlots(e,t){this._renderContext.renderOccludedMask=t,this.plugins.renderOccludedFlags>1&&this._plugins.render(9),this.renderSlots(e,...Ce),this._renderContext.renderOccludedMask=te}renderHUD(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(...Se[e])}_renderHUDElements(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(16),this.renderHUD(e),this._bindParameters.hudRenderStyle=e,this._plugins.render(14)}precompileViewshedShadowMap(){this._precompileAllGeometry(8)}precompileCutFillOrthographicReferenceDepth(){this._precompilePlugins(9,De)}_precompilePlugins(e,t){const s=this._bindParameters.output;this._bindParameters.output=e,this._plugins.precompile(...t),this._bindParameters.output=s}renderViewshedShadowMap(e){const{camera:t,contentCamera:s}=this._bindParameters,i=this._bindParameters.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this.renderAllGeometry(8),this._ensureBindParametersCamera(t,s),this._bindParameters.camera.setGLViewport(this._rctx),this._bindParameters.output=i}renderCutFillOrthographicReferenceDepth(e){const{camera:t,contentCamera:s}=this._bindParameters,i=this._bindParameters.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this._bindParameters.output=9,this._plugins.render(...De),this._ensureBindParametersCamera(t,s),t.setGLViewport(this._rctx),this._bindParameters.output=i}get _needsGroundDepth(){return this._bindParameters.cutFillVisualizationEnabled}_blitGroundDepth(){if(!this._needsGroundDepth)return null;const{width:e,height:t}=this._framebuffer.size,s=this.fboCache.acquire(e,t,R.GROUND_DEPTH,14);return this._rctx.blitFramebuffer(this._framebuffer.color.fbo,s.fbo,256),this._framebuffer.bind(),s}_renderOpaqueAndTransparentGeometry(e){this._bindParameters.output=e,this._renderOpaqueGeometry(),this._renderTransparentGeometry()}_renderGeometryWithoutNormals(e){this._bindParameters.output=e,this._plugins.render(...Ae)}_precompileOpaqueGeometry(){this._needsOpaquePass&&(this._plugins.precompile(...Pe),this._nodes.precompile(this._bindParameters.hasEmission,"opaque-color"))}_renderOpaqueGeometry(){this._plugins.render(...Pe)}_renderTransparentGeometry(){this._plugins.render(...we),this._hasTransparentGeometry&&this._plugins.render(15)}_renderTransparentGround(){this._plugins.render(...Ee)}_precompileHUD(e){if(!this._pluginsHas.hudElements)return;const t=this._bindParameters.output,s=this._bindParameters.hudRenderStyle,i=this._bindParameters.emissions;this._bindParameters.emissions=0,this._bindParameters.hudRenderStyle=e,this._bindParameters.output=1,this._plugins.precompile(...Te),this._bindParameters.output=2,this._plugins.precompile(...Te),this._bindParameters.output=0,this._oitBlend.precompile(this._bindParameters,!1,1),this._hasHighlights&&(this._bindParameters.output=10,this._plugins.precompile(...Te)),this._bindParameters.emissions=i,this._bindParameters.output=t,this._bindParameters.hudRenderStyle=s}_renderHUD(e,t){if(!this._pluginsHas.hudElements)return t;const s=this._renderOIT(1,e);this._rctx.bindFramebuffer(t.fbo);const i=!!t.getTexture(me);return this._compositor.compositePreMultipliedAlpha(this._bindParameters,s.getTexture(),i),s.release(),this.performanceInfo.advance(0===e?ue.HUD_OCCLUDED:ue.HUD),t}get _needsShadowHighlight(){return this.shadowsEnabled&&this._plugins.produces(6,2)}_renderHighlightPrepass(){if(!this._hasHighlights)return;const{fboCache:e,_rctx:t,_bindParameters:s}=this,{width:i,height:r}=this._framebuffer.size,{highlights:a}=s,n=a.length>B?3:1,h=e.acquire(i,r,"highlights",n);h.acquireDepth(14);const o=this._plugins.produces(10,0);return o&&this._framebuffer.color.fbo&&h.fbo&&t.blitFramebuffer(this._framebuffer.color.fbo,h.fbo,1024),t.bindFramebuffer(h.fbo),t.gl.clearBufferuiv(6144,0,[0,0,0,0]),o||t.clear(1024),this._bindParameters.output=10,t.bindFramebuffer(h.fbo),V(t,e,i,r,s,()=>this._renderHighlightGeometries()),h.detachDepth(),this.performanceInfo.advance(ue.HIGHLIGHTS),h.retain(this._nodes.require("highlights",...D)+this._nodes.optional("highlights",...D)-1),h}_renderHighlightGeometries(){this._plugins.render(...Oe),this._rctx.clear(256),this._renderHUDElements(2)}_renderShadowAccumulation(e){this._shadowAccumulator.updateDepthRange(e);const t=this._shadowAccumulator.requiresDepth;this._bindParameters.output=0,this._shadowAccumulator.renderAccumulation(this._bindParameters)&&this.performanceInfo.advance(ue.ACCUMULATED_SHADOWS),this._shadowAccumulator.updateMask(),t&&(this._bindParameters.depth=h(this._bindParameters.depth))}_precompileTransparentGeometry(){y(this._bindParameters.output)?(this._bindParameters.output=1,this._plugins.precompile(...we),this._hasTransparentGeometry&&this._plugins.precompile(15),this._bindParameters.output=2,this._plugins.precompile(...we),this._hasTransparentGeometry&&this._plugins.precompile(15),this._bindParameters.output=0):this._plugins.precompile(...we)}_renderOIT(e,t=2){const s=1===e,{width:i,height:r}=this._framebuffer.size,a=s?()=>this._renderHUDElements(t):()=>this._renderTransparentGeometry(),h=this._bindParameters,o=h.useFloatBlend.value?8:5,d=h.output;h.output=1;const l=s?"oit hud":"oit",u=this.fboCache.acquire(i,r,l,o).acquireColor(me,this.hasFloatBlend?7:0,"oit alpha"),m=h.hasEmission&&(0===e||1!==t);m&&u.acquireColor(pe,o,"oit emissive"),s||u.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(u.fbo),this._rctx.clearFramebuffer(Z),m&&this._rctx.clearBuffer(2,Z),a(),u.detachDepth(),h.output=2;const _=this.fboCache.acquire(i,r,s?"oit front hud":"oit front");m&&_.acquireColor(me,o,"oit front emissive"),s?_.acquireDepth(this._hudDepthFormat):_.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(_.fbo),this._rctx.clearFramebuffer(C,s),a(),_.detachDepth();const p=this._pluginsHas.occludedHudElements&&!s,c=p&&0!==h.emissions?pe:me;let f;return h.hudOcclusion=n(this._bindParameters.hudOcclusion),h.output=0,s?(f=this.fboCache.acquire(i,r,"oit composite hud"),this._rctx.bindFramebuffer(f.fbo),this._rctx.setClearColor(0,0,0,1e-13),this._rctx.clear(16384)):(0!==h.emissions&&this._framebuffer.ensureEmissionAttachment(),p&&(this._framebuffer.color.acquireColor(c,0,"hud occlusion"),this._rctx.clearBuffer(c-ce,C)),this._framebuffer.bind()),this._oitBlend.blend(this._rctx,u,_,h,p,e,this._fboCache.debugCallback),f?.detachDepth(),s||(m&&(this._bindParameters.emissions=3),p&&(h.hudOcclusion=this._framebuffer.color.obtainAttachment(c))),_.release(),u.release(),h.output=d,f}get _hudDepthFormat(){return this.isFeatureEnabled(7)?14:13}get _needsOpaquePass(){return this.plugins.produces(0,...Pe)||this.plugins.produces(5,...Pe)||this.plugins.produces(3,3)}_renderOpaque(){const e=this._needsOpaquePass;e&&(this._plugins.render(0,1),this._pluginInput.set(R.GROUND_DEPTH,this._blitGroundDepth()),this._plugins.render(2,3));const t=this._framebuffer;t.update(t=>this._renderNodes(O.OPAQUE,t,e)),this.fboCache.debugCallback?.(O.OPAQUE,t.color.fbo),t.update(e=>this._renderNodes(R.OPAQUE_ENVIRONMENT,e)),this.fboCache.debugCallback?.(R.OPAQUE_ENVIRONMENT,t.color.fbo),this._renderEdges(1)}_renderPreTransparent(){this._framebuffer.update(e=>this._renderNodes(R.GAUSSIAN_SPLAT,e)),this.fboCache.debugCallback?.(R.GAUSSIAN_SPLAT,this._framebuffer.color.fbo),this._framebuffer.update(e=>this._renderNodes(R.OPAQUE_OCCLUSION_QUERY,e)),this.fboCache.debugCallback?.(R.OPAQUE_OCCLUSION_QUERY,this._framebuffer.color.fbo),this._framebuffer.update(e=>this._renderNodes(R.VOXEL,e)),this.fboCache.debugCallback?.(R.VOXEL,this._framebuffer.color.fbo)}_renderTransparent(){const e=this._framebuffer;if(this._renderHiddenTransparentEdges(),this._hasTransparentGeometry&&this._renderOIT(0),e.update(e=>this._renderNodes(O.TRANSPARENT,e,this._hasTransparentGeometry)),this.fboCache.debugCallback?.(O.TRANSPARENT,e.color.fbo),this._hasTransparentGeometry||this._plugins.render(15),this._renderEdges(0),this._bindParameters.ssao=n(this._bindParameters.ssao),e.update(e=>this._renderNodes(R.TRANSPARENT_NO_DEPTH,e)),this.fboCache.debugCallback?.(R.TRANSPARENT_NO_DEPTH,e.color.fbo),this._framebuffer.bind(),this._plugins.render(8),this._bindParameters.hasEmission){const e=this._rctx.setDrawBuffers([fe,me]);this._bindParameters.transparentWithoutDepthEmissionDimmingPass=!0,this._plugins.render(8),this._bindParameters.transparentWithoutDepthEmissionDimmingPass=!1,this._rctx.setDrawBuffers(e)}this.performanceInfo.advance(ue.TRANSPARENT_MATERIAL_WITHOUT_DEPTH)}_renderNodes(e,t,s=!1){if(t.setName(e),this._pluginInput.set(e,t),!this._nodes.produces(e))return s&&this.performanceInfo.advance(e),t;const i=this._nodes.render(t,this._pluginInput,this._releaseNodeInputs);return this.performanceInfo.advance(e),this._fboCache.debugCallback?.(e,i.fbo),i}_ensureBindParameters(e,t){this._ensureBindParametersCamera(e,t),this._ensureBindParametersWeatherFader(),this._ensureBindParametersScreenSpaceReflections(),this._ensureBindParametersReprojection()}_ensureBindParametersCamera(e,t){this._bindParameters.camera=e,this._bindParameters.contentCamera=t}_ensureBindParametersWeatherFader(){1===this.stage.viewingMode&&(this._bindParameters.clouds.data&&(this._bindParameters.clouds.fade(this._bindParameters.camera,this.renderContext.time,this.stage.view.qualitySettings.fadeDuration,this.stage.view.state.stationary),this.weatherFader?.cleanupCubemap()),this._bindParameters.snowCover=this.weatherFader?.snowCover??0)}_ensureBindParametersScreenSpaceReflections(){const{time:e}=this.renderContext,{screenSpaceReflections:t}=this._bindParameters;if(this.hasReflections){null==this._ssrEnableTime&&(this._ssrEnableTime=e);const s=this.stage.view.qualitySettings.fadeDuration;t.fadeFactor=s>0?Math.min(s,e-this._ssrEnableTime)/s:1,t.fadeFactor<1&&this._requestRender()}else this._ssrEnableTime=null}_ensureBindParametersReprojection(){if(!(this.hasReflections||this.hasGlobalIllumination))return void(this._reprojectionMatrix=w);const{reprojection:e,camera:t}=this._bindParameters,{lastFrameCamera:s}=e,i=!s.equals(t);if(i?(b(Ge,t.viewMatrix),b(Fe,t.projectionMatrix),g(He,Ge,Fe),g(He,s.viewMatrix,He),g(He,s.projectionMatrix,He),this._reprojectionMatrix=He):this._reprojectionMatrix=w,this.hasGlobalIllumination){const{viewMatrix:t}=e;i?(g(xe,s.viewMatrix,Ge),P(t,xe)):P(t,w)}}addRenderNode(e){this._nodes.add(e),this._requestRender()}removeRenderNode(e){this._nodes.remove(e),this._requestRender()}updateLighting(e,t,s,i){this._bindParameters.updateLighting(e,t,s,i),this._requestRender(1)}get usedMemory(){return{fbos:this.fboCache.usedMemory,plugins:this._plugins.usedMemory,edges:this.edgeView?.usedMemory??0,clouds:this.weatherFader?.usedMemory??0}}get test(){}};e([p()],ge.prototype,"_inGlobeView",void 0),e([p({readOnly:!0})],ge.prototype,"highResolutionAtmosphere",null),e([p()],ge.prototype,"_edgeView",void 0),e([p()],ge.prototype,"updating",null),ge=e([c("esri.views.3d.webgl-engine.lib.Renderer")],ge);const Pe=[0,1,2,3],we=[7,6,4,5],Ee=[7,6],Ie=[0,1,2,4,...Ee],Ae=[3,5],Ce=[2,4,8],Te=[16,12,14,13],Oe=[4,5,2,3,0,1,...Ee],Re=[4,8,5,11],Se={0:[13],1:[12],2:[13,12],3:[13,12]},De=[0,1,...Ee],Ne=["normals","highlights"],Fe=E(),Ge=E(),He=E(),xe=E();function ye(e){return t=>e.immediate.schedule(t)}export{ge as Renderer};
2
+ import{__decorate as e}from"tslib";import{update as t}from"../../../../core/arrayUtils.js";import{createTask as s}from"../../../../core/asyncUtils.js";import has from"../../../../core/has.js";import{removeMaybe as i,abortMaybe as r,destroyMaybe as a,releaseMaybe as n,releaseReferencedMaybe as h}from"../../../../core/maybe.js";import{throwIfAborted as o}from"../../../../core/promiseUtils.js";import{watch as d,syncAndInitial as l,initial as m,sync as u}from"../../../../core/reactiveUtils.js";import{signal as _}from"../../../../core/signal.js";import{property as p,subclass as c}from"../../../../core/accessorSupport/decorators.js";import{equals as b,invert as f,multiply as g,copy as P}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as w,create as E}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as I}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{fromValues as A,ZEROS as C}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{pruneIndexArrays as T}from"../../../../geometry/support/Indices.js";import{RenderNodeOutput as R,InternalRenderCategory as O,AllRenderNodeOutputs as S,AllInternalRenderNodeOutputs as D}from"../../webgl.js";import{minNearDistanceInMeters as N}from"../../state/NearFarHeuristic.js";import{debugFlags as F}from"../../support/debugFlags.js";import{computeShadowsEnabled as G}from"../../support/sunUtils.js";import{FBOCache as H}from"../core/FBOCache.js";import{RenderPassManager as x}from"../core/renderPasses/RenderPassManager.js";import{isColor as y}from"../core/shaderLibrary/ShaderOutput.js";import{distanceFadeEnd as v}from"../core/shaderLibrary/shading/ScreenSpaceConstants.js";import{RenderNodes as M}from"../effects/RenderNodes.js";import{RenderPluginManager as L}from"../effects/RenderPluginManager.js";import{WeatherFader as q}from"../effects/WeatherFader.js";import{innerAtmosphereFadeStart as j}from"../effects/atmosphere/atmosphereUtils.js";import{Blit as U}from"../effects/blit/Blit.js";import{maxHighlightsPerChannel as B,renderHighlightBuffer as V}from"../effects/highlight/Highlight.js";import{OITBlend as k}from"../effects/transparency/OITBlend.js";import{AnimationTimer as W}from"./AnimationTimer.js";import{AnimationTimeStep as Q}from"./AnimationTimeStep.js";import{BoundingInfo as z}from"./BoundingInfo.js";import{Compositor as Y}from"./Compositor.js";import{DepthRange as J}from"./DepthRange.js";import{depthRangeFromScene as X}from"./depthRangeUtils.js";import{MainFramebuffer as $}from"./MainFramebuffer.js";import{NavigationDepthCache as K}from"./NavigationDepthCache.js";import{blendingColorAlphaClear as Z}from"./OrderIndependentTransparency.js";import{RenderContext as ee,defaultRenderOccludedMask as te}from"./RenderContext.js";import{RendererBase as se}from"./RendererBase.js";import{setupFeatureDefaults as ie}from"./RenderFeature.js";import{RenderPluginInput as re}from"./RenderPluginInput.js";import{ShadowAccumulator as ae}from"./ShadowAccumulator.js";import{ShadowMap as ne}from"./ShadowMap.js";import he from"./SliceHelper.js";import{MergedRenderer as oe}from"../materials/renderers/MergedRenderer.js";import{RenderSceneResult as de}from"../parts/renderUtils.js";import{RendererPerformanceInfo as le,PerformanceCategory as me}from"../statistics/RendererPerformanceInfo.js";import{ColorAttachment1 as ue,PixelType as _e,ColorAttachment2 as pe,ColorAttachment0 as ce,DrawBufferNone as be}from"../../../webgl/enums.js";const fe=has("disable-feature:async-navigation-3d-depth-readback");let ge=class extends se{constructor(e,t,s,i,r){super({stage:e}),this._techniques=s,this._rctx=i,this._requestRender=r,this._pluginsHas={occludedHudElements:!1,hudElements:!1,water:!1},this.renderPassManager=new x,this._isRendering=!1,this._inGlobeView=!1,this._backgroundColor=A(0,0,0,1),this._sliceHelper=new he,this.sceneDepthRange=_(J.Infinite),this._state=_(2),this._hasGlobalIlluminationFlag=!!has("enable-feature:global-illumination"),this._hasAnimations=!1,this._animationTimestep=new Q,this._loadEdgeViewTask=null,this._edgeViewCallbacks=[],this._reprojectionMatrixVersion=_(0),this._renderHiddenTransparentEdges=()=>{},this._pluginInput=new re,this._hasTransparentGeometry=!1,this._releaseNodeInputs=e=>{for(const t of Ne)e.some(({name:e})=>e===t)&&this._pluginInput.release(t)},this._testsNeedsDepth=!1,this._fboCache=new H(i),this._compositor=new Y(i,s),this._renderStateFeatures=_(ie(e.view.qualityProfile));const a=new ne(this._fboCache,e.viewingMode);this._renderContext=new ee(this._rctx,a,s),this._framebuffer=new $(this._fboCache,this._bindParameters),this._performanceInfo=new le(this._rctx),this._blit=new U(s),this.navigationDepthCache=new K(this._rctx,this._fboCache,s,()=>this._requestRender(0)),this._shadowAccumulator=new ae(this.fboCache,s,e,(t,s,i)=>{const r=e.view.qualitySettings.maximumPixelRatio;t.shadowMap.start(t.camera,s,i,!0,r),this._renderShadowCascades(5,t.shadowMap),t.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(t.camera,t.contentCamera)},r),this._nodes=new M(this._renderContext),this._plugins=new L({renderContext:this._renderContext,techniques:s,materials:t,requestRender:r,controller:e}),this._plugins.add(this.renderPassManager),this.weatherFader=new q({view:e.view,context:this._renderContext}),this.addHandles([d(()=>e.view.state.camera,()=>r(),l),d(()=>F.EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES,e=>{this._renderHiddenTransparentEdges=e?()=>this._renderEdges(0):()=>{},r()},m),d(()=>e.view.environment.background?.color,e=>{const t=e?e.toUnitRGBA():C;I(this._backgroundColor,t[0]*t[3],t[1]*t[3],t[2]*t[3],t[3]),r()},l),d(()=>e.view.state.camera.relativeElevation,e=>this._inGlobeView=(e??1/0)>=v,l),d(()=>this._bindParameters.clouds.fadeFactor,()=>{this._bindParameters.fadeLighting(),this._requestRender(2)},u),d(()=>this._bindParameters.clouds.data?.state,()=>r(),u),d(()=>e.view.state.highlights,e=>{this._bindParameters.highlights=e,r()},m),d(()=>"sun"===e.view.environment.lighting?.type,e=>{this._bindParameters.enableFillLights=e,this._requestRender()},l)])}destroy(){this._gpuTimerHandle=i(this._gpuTimerHandle),this._nodes.destroy(),this._framebuffer.dispose(),this._shadowAccumulator.destroy(),this._shadowAccumulator=null,this._loadEdgeViewTask=r(this._loadEdgeViewTask),this._edgeView=a(this._edgeView),this.renderPassManager.dispose(),this.weatherFader=a(this.weatherFader),this._releaseFBOs(),this._disposeOffscreenBuffers(),this.navigationDepthCache.destroy(),this._fboCache.destroy(),this._fboCache=null,this._renderContext.destroy(),this._plugins.destroy(),this._pluginInput=null,this._oitBlendOrNil=null,this._nodes=null,this._framebuffer=null,this._performanceInfo=null,z.prune(),oe.prune(),T()}get renderContext(){return this._renderContext}get _bindParameters(){return this._renderContext.bind}get _oitBlend(){return this._oitBlendOrNil??=new k(this._techniques),this._oitBlendOrNil}get performanceInfo(){return this._performanceInfo}updateRenderFeatures(e){this._renderStateFeatures.value=ie(e),this._requestRender()}isFeatureEnabled(e,t=this._state.value){return this._renderStateFeatures.value.get(t,e)??!1}setFeatureEnabled(e,t,s){this._renderStateFeatures.mutate(i=>i.set(t,e,s)),this._requestRender()}setTime(e){this._renderContext.time=e}get hasReflections(){return this._bindParameters.screenSpaceReflections.enabled=this._pluginsHas.water&&this.isFeatureEnabled(4),this._bindParameters.screenSpaceReflections.enabled}get _hasHighlights(){return this._plugins.produces(10,2,4,18,12,13,14)}hasHighlight(e){return this._plugins.hasHighlight(e)}get _hasHUDHighlights(){return this._plugins.produces(10,12,13,14)}get hasAmbientIllumination(){return this.isFeatureEnabled(3)&&!this._inGlobeView}get hasGlobalIllumination(){return this._hasGlobalIlluminationFlag&&this.hasAmbientIllumination}get hasGlobalIlluminationHighQuality(){return this.hasGlobalIllumination&&this.isFeatureEnabled(10)}get _keepGlobalIlluminationShadingAlive(){return this._hasGlobalIlluminationFlag&&!this._inGlobeView}get hasSMAA(){return this.isFeatureEnabled(0)}get _emissions(){const e=this._plugins.emissions;return this._hasTransparentGeometry?e:1===e||3===e?1:0}get hasFloatBlend(){return this._rctx.driverTest.floatBufferBlend.result&&this.isFeatureEnabled(9)}get highResolutionAtmosphere(){return this.isFeatureEnabled(2)}get fboCache(){return this._fboCache}_releaseFBOs(){this._bindParameters.hudOcclusion=n(this._bindParameters.hudOcclusion),this._bindParameters.depth=null}_disposeOffscreenBuffers(){this._framebuffer.dispose(),this._bindParameters.globalIllumination=n(this._bindParameters.globalIllumination),this._bindParameters.reprojection.lastFrameDepth=n(this._bindParameters.reprojection.lastFrameDepth),this._bindParameters.reprojection.lastFrameEmission=n(this._bindParameters.reprojection.lastFrameEmission),this._disposeBindBuffers()}_disposeBindBuffers(){this._bindParameters.shadowMap.disposeOutputs()}get updating(){return this._loadEdgeViewTask&&!this._loadEdgeViewTask.finished||this._edgeView?.updating||this._plugins.updating||this.weatherFader?.readyToRun||!this.isCameraFinal}loadEdgeView(){return this._loadEdgeViewTask||(this._loadEdgeViewTask=s(async e=>{const{EdgeView:t}=await import("./edgeRendering/EdgeView.js");o(e);const s=this._edgeView=new t({rctx:this._rctx,renderSR:this.stage.view.renderSpatialReference,viewingMode:this.stage.view.stage.viewingMode,techniques:this._techniques,setNeedsRender:()=>this._requestRender(),schedule:ye(this.stage.view.resourceController)});return this.addHandles(d(()=>s.updating,()=>this._requestRender(),u)),this._requestRender(),this._edgeViewCallbacks.forEach(e=>e(s)),this._edgeViewCallbacks.length=0,s})),this._loadEdgeViewTask.promise}withEdgeView(e){this.loadEdgeView(),null==this._edgeView?this._edgeViewCallbacks.push(e):e(this._edgeView)}get edgeView(){return this._edgeView}get isCameraFinal(){return this._reprojectionMatrixVersion.value>=0&&b(this._bindParameters.reprojection.matrix,w)}set _reprojectionMatrix(e){t(this._bindParameters.reprojection.matrix,e)&&this._reprojectionMatrixVersion.value++}modifyShadowsEnabled(){const e=this.stage.view.environmentManager.referencePositionGeographic,t=null==e||G(e[2],this.stage.viewingMode),s=this.stage.view.environment.lighting.directShadowsEnabled&&t;this._bindParameters.shadowMap.enabled!==s&&(this._bindParameters.shadowMap.enabled=s,this._requestRender(1))}get shadowsEnabled(){return!!this._bindParameters.shadowMap.enabled}setParameters(e){e.shadowCast&&this._shadowAccumulator.setParameters(e.shadowCast)}set slice(e){this._sliceHelper.update(e)&&this._requestRender()}get plugins(){return this._plugins}commit(e,t){return this._isRendering&&console.warn("Renderer.modify called while rendering"),!!super.commit(e,t,this._plugins.context)&&(this.updateHasFlags(),!0)}addRenderer(e){this._plugins.add(e)}removeRenderer(e){this._plugins.remove(e)}get occludedRequiresStencil(){return this._occludedRequiresOccludeeStencil||this.occludedRequiresIntegratedMeshStencil}get _occludedRequiresOccludeeStencil(){return this._bindParameters.hasOccludees&&!!(8&this.plugins.renderOccludedFlags)}get occludedRequiresIntegratedMeshStencil(){return this._plugins.produces(0,0)&&this._plugins.produces(0,9)}updateHasFlags(){const has=this._pluginsHas;has.occludedHudElements=this._plugins.produces(0,13),has.hudElements=has.occludedHudElements||this._plugins.produces(0,...Te),has.water=this._plugins.produces(4,19),this._bindParameters.hasOccludees=this._plugins.hasOccludees,this._requestRender()}updateAnimation(e,t){this._animationTimer??=new W(e.camera,t),this._animationTimer.advance(e.camera,t,this._animationTimeDilation);const s=this._hasAnimations;return this._hasAnimations=this._plugins.updateAnimation(this._animationTimer),this._hasAnimations=this._nodes.updateAnimation(this._animationTimer)||this._hasAnimations,this._hasAnimations!==s&&(this._gpuTimerHandle=s?i(this._gpuTimerHandle):this.performanceInfo.enableGPUPerformanceInfo()),this._hasAnimations}get animationTimestep(){return this._animationTimestep.value}get _animationTimeDilation(){return this._animationTimestep.timeDilation}resetAnimation(){this._animationTimestep.clear()}tick(){this.fboCache.clean()}render(e,t,s=!1){try{return this._isRendering=!0,this._render(e,t,s)}catch(i){console.error(`Exception during rendering: ${i}:\n${i.stack}`)}finally{this._isRendering=!1}return new de(this._pluginInput.get(R.FINAL),null)}_render(e,t,s){const i=0===t;this.performanceInfo.startFrame(),this.fboCache.frameStart(),this.fboCache.interactive=i,this._disposeBindBuffers();const{camera:r,contentCamera:a,mode:o,alignPixelEnabled:d}=e;this._state.value=o,this._bindParameters.output=0,this._bindParameters.emissions=this._emissions,this._bindParameters.alignPixelEnabled=d,this._bindParameters.decorations=!s,this._bindParameters.mainDepth=null,this._bindParameters.useFloatBlend.value=this.hasFloatBlend;const l=!s||!this._sliceHelper.isDecoration;this._bindParameters.slicePlane=l?this._sliceHelper.plane:null,this._bindParameters.viewshedEnabled=this._nodes.produces(O.VIEWSHED),this._bindParameters.cutFillComputationEnabled=this._nodes.produces(O.CUTFILL_COMPUTATION),this._bindParameters.cutFillVisualizationEnabled=this._nodes.produces(O.CUTFILL_COLOR),this._ensureBindParameters(r,a),this._plugins.sortTestsTransparentOrderedSlots(Oe),this._plugins.prepareRender(),this._hasTransparentGeometry=this._plugins.produces(1,...we),this._renderOverlay(),r.setGLViewport(this._rctx);const m=this._framebuffer,u=m.initialize(r.fullWidth,r.fullHeight,this._backgroundColor),_=this._needsLastFrameColor;_?(u?.retain(_-1),u?.setName("last frame color"),this._bindParameters.reprojection.lastFrameColor?.release(),this._bindParameters.reprojection.lastFrameColor=u):u?.release(),this._bindParameters.hasShadowHighlights=this._needsShadowHighlight&&!s,this._shadowAccumulator.fullyRecompute=!i,this._shadowAccumulator.updateCamera(r),this._precompilePrepasses(),this.performanceInfo.advance(me.PREPARE);const p=this._computeShadowDepthRange(r);this._pluginInput.set("normals",this._renderNormals()),this._renderAmbientIlluminationAndDepth(),this._renderShadowMap(r,a,this._bindParameters.lighting.mainLight.direction,p),this._renderShadowAccumulation(p),m.bind(),this._bindParameters.mainDepth=m.depth.attachment,this._precompileShaders(i),this._bindParameters.output=0,this._renderOpaque(),this._renderPreTransparent(),this._renderTransparent(),this.hasReflections&&(this._bindParameters.depth=h(this._bindParameters.depth),this._bindParameters.reprojection.lastFrameColor=h(this._bindParameters.reprojection.lastFrameColor)),this._bindParameters.shadowMap.disposeOutput(5),m.update(e=>this._renderNodes(O.CUTFILL_COMPUTATION,e)),this._pluginInput.set(O.FOCUSAREA,this._renderFocusAreaGeometry()),m.update(e=>this._renderNodes(O.TRANSPARENT_ENVIRONMENT,e)),m.update(e=>this._renderNodes(O.VIEWSHED,e)),m.update(e=>this._renderNodes(O.LASERLINES,e)),this._nodes.requireGeometryDepth&&(this._bindParameters.depth=h(this._bindParameters.depth)),m.update(e=>this._renderNodes(O.FOCUSAREA_COLOR,e)),m.update(e=>this._renderNodes(O.CUTFILL_COLOR,e)),this._pluginInput.release(O.FOCUSAREA),this._pluginInput.release(O.GROUND_DEPTH),m.update(e=>this._renderNodes(O.OCCLUDED,e)),this._pluginInput.set("highlights",this._renderHighlightPrepass());const c=2===t?this._renderObjectAndLayerIdColor():null;m.update(e=>this._renderNodes(R.COMPOSITE,e)),this._bindParameters.shadowMap.disposeOutputs(),this._bindParameters.shadowHighlight=n(this._bindParameters.shadowHighlight),m.update(e=>this._renderNodes(O.ANTIALIASING,e));const b=this._hasTransparentGeometry?2:1,f=this._bindParameters.emissions;let g;return this._bindParameters.emissions=0,this._hasHUDHighlights&&m.update(e=>this._renderHUD(b,e)),m.update(e=>this._renderNodes(O.HIGHLIGHT_COLOR,e)),this._hasHUDHighlights||m.update(e=>this._renderHUD(b,e)),this._bindParameters.emissions=f,m.update(e=>this._renderNodes(O.MAGNIFIER,e)),m.update(e=>this._renderNodes(R.FINAL,e)),i&&(this._blit.toFramebuffer(m.color,this._bindParameters),fe||2!==o&&0!==o||this.navigationDepthCache.update(this._bindParameters,m.depth.attachment,this._renderContext.time)),this._bindParameters.reprojection.lastFrameDepth?.release(),this._bindParameters.reprojection.lastFrameEmission?.release(),this.hasGlobalIllumination&&(this._bindParameters.reprojection.lastFrameDepth?.release(),this._bindParameters.reprojection.lastFrameDepth=this._bindParameters.depth,0!==this._emissions&&(this._bindParameters.reprojection.lastFrameEmission?.release(),this._bindParameters.reprojection.lastFrameEmission=m.color.obtainAttachment(ue))),this._testsNeedsDepth&&(this._bindParameters.depth=h(this._bindParameters.depth)),this._releaseFBOs(),m.releaseDepth(),this._bindParameters.reprojection.lastFrameCamera.copyFrom(this._bindParameters.camera),this.fboCache.frameEnd(),i||(g=m.color,g.retain(),this._releaseFBOs(),this._disposeOffscreenBuffers()),this.performanceInfo.finishFrame(),new de(g,c)}_precompileShaders(e){++this._plugins.context.techniques.precompiling;const t=this._bindParameters;t.output=0;const s=t.emissions;if(this._precompileOpaqueGeometry(),this._nodes.precompile(t.hasOpaqueEmission,O.OPAQUE_ENVIRONMENT,O.GAUSSIAN_SPLAT,O.OPAQUE_OCCLUSION_QUERY,O.VOXEL),this._precompileOpaqueGeometry(),t.output=3,this._plugins.precompile(...Ee),t.output=0,this._plugins.precompile(...Ee),this._hasTransparentGeometry){const e=this._pluginsHas.occludedHudElements;this._oitBlend.precompile(t,e,0),this._pluginsHas.hudElements&&this._oitBlend.precompile(t,!1,1),this._precompileTransparentGeometry(),t.hasTransparentEmission&&(t.emissions=3)}this._nodes.precompile(t.hasOpaqueEmission,O.FOCUSAREA),this._compositor.precompile(this._usesPremultipliedAlphaBlit,!!this._needsEdges,t),this._hasTransparentGeometry||this._plugins.precompile(15),this._nodes.precompile(t.hasOpaqueEmission,O.TRANSPARENT_ENVIRONMENT,O.VIEWSHED,O.CUTFILL_COMPUTATION,O.CUTFILL_COLOR,O.LASERLINES,O.FOCUSAREA_COLOR,O.OCCLUDED,O.ANTIALIASING),t.highlightMixTexture=t.highlights.length>1?this._rctx.emptyTexture:null,this._precompileHUD(0),t.emissions=0,this._precompileHUD(0),this._precompileHUD(1),t.emissions=s,this._hasHighlights&&(t.highlights.forEach((e,s)=>{t.highlightLevel=s,this._precompileAllGeometry(10),this._hasHUDHighlights&&this._plugins.precompile(13,12)}),t.highlightLevel=null,this._nodes.precompile(t.hasEmissions,O.HIGHLIGHT_COLOR)),t.highlightMixTexture=null,this._nodes.precompile(t.hasEmissions,R.COMPOSITE,O.MAGNIFIER),this._shadowAccumulator.precompile(),this._plugins.precompile(8),t.hasOpaqueEmission&&(t.transparentWithoutDepthEmissionDimmingPass=!0,this._plugins.precompile(8),t.transparentWithoutDepthEmissionDimmingPass=!1),e&&this._blit.precompile(),--this._plugins.context.techniques.precompiling}_renderFocusAreaGeometry(){const e=this._nodes.produce(O.FOCUSAREA,this._pluginInput);return e&&this.performanceInfo.advance(me.FOCUS_AREA_MASK),e}_renderObjectAndLayerIdColor(){if(!this._nodes.produces(O.OBJECT_AND_LAYER_ID_COLOR))return null;const e=this._bindParameters.output;++this._techniques.precompiling;const{width:t,height:s}=this._framebuffer.size;let i=this.fboCache.acquire(t,s,O.OBJECT_AND_LAYER_ID_COLOR).acquireDepth(14);return i=this._renderNodes(O.OBJECT_AND_LAYER_ID_COLOR,i),--this._techniques.precompiling,this._bindParameters.output=e,i}finish(e){this._hasAnimations||this._animationTimestep.clear();const t=this.performanceInfo.gpuSamplingEnabled,s=0===e;if(s||t){const e=s?this.performanceInfo.elapsedTime:0;let i=0;t?i=this.performanceInfo.totalGPUTimeSampler.last:this._rctx.gl.finish();const r=Math.max(e,i);this._animationTimestep.frame(r,s)}}readAccumulatedShadow(e){return this._shadowAccumulator.readAccumulatedShadow(e[0],e[1])}readMainDepth(e,t){const{mainDepth:s,camera:i}=this._bindParameters;if(!s)return;const r=this.fboCache.acquire(this._framebuffer.size.width,this._framebuffer.size.height,"linear depth");this._rctx.bindFramebuffer(r.fbo),i.setGLViewport(this._rctx),this._rctx.setScissorRect(e[0],e[1],e[2],e[3]),this._rctx.setScissorTestEnabled(!0),this._rctx.clearFramebuffer(C),this._compositor.blitDepthToLinearDepth(this._bindParameters,s),this._rctx.setScissorTestEnabled(!1),this._rctx.setScissorRect(0,0,this._rctx.gl.canvas.width,this._rctx.gl.canvas.width),r.fbo?.readPixels(e[0],e[1],e[2],e[3],6408,_e.UNSIGNED_BYTE,t),r.release()}get _needsEdges(){return this._edgeView?.shouldRender()?this._edgeView:null}_renderEdges(e){const t=this._needsEdges;if(!t)return;const{width:s,height:i}=this._framebuffer.size,r=this.fboCache.acquire(s,i,"edges");r.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(r.fbo),this._rctx.clearFramebuffer(C),t.render(this._bindParameters,e),r.detachDepth(),this._framebuffer.bind(),this._compositor.composite(this._bindParameters,r.getTexture()),r.release(),this.performanceInfo.advance(1===e?me.OPAQUE_EDGES:me.TRANSPARENT_EDGES)}_renderOverlay(){this._bindParameters.overlay=this.overlay?.render(this._renderContext.time),this._bindParameters.overlay&&this.performanceInfo.advance(me.OVERLAY)}_renderShadowMap(e,t,s,i){if(!this.shadowsEnabled)return;const r=this._bindParameters.shadowMap;if(r.start(e,s,i,this.isFeatureEnabled(5),this.stage.view.qualitySettings.maximumPixelRatio),this._needsShadowHighlight){this._renderShadowCascades(6,r),e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,t);const s=this._bindParameters.output;this._bindParameters.output=0,this._bindParameters.shadowHighlight=this._nodes.produce(O.SHADOW_HIGHLIGHT,this._pluginInput),this._bindParameters.output=s,r.disposeOutput(6),r.clear(),this._renderShadowCascades(7,r)}else this._renderShadowCascades(5);e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,this._bindParameters.contentCamera),this._needsShadowHighlight&&(this._bindParameters.depth=h(this._bindParameters.depth)),this.performanceInfo.advance(O.SHADOWMAP)}_precompileShadowCascades(e){0!==this._bindParameters.shadowMap.cascades.length&&this._precompileAllGeometry(e)}_renderShadowCascades(e,t=this._bindParameters.shadowMap){const s=this._bindParameters.output,i=t===this._bindParameters.shadowMap&&6!==e;t.bindFramebuffer();for(const r of t.cascades)r.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(r.camera,r.camera),this.renderAllGeometry(e),i&&this._renderShadowNodes();t.finish(e),this._bindParameters.output=s}_renderShadowNodes(){const e=this._bindParameters.shadowMap.renderTarget;e&&(this._renderNodes(O.SHADOWMAP,e),this._pluginInput.set(O.SHADOWMAP,null))}get _needsLastFrameColor(){return+this.hasReflections+ +this.hasGlobalIllumination}get _needsDepth(){return+this._nodes.requireGeometryDepth+ +this.hasReflections+ +this.hasGlobalIllumination+ +this._shadowAccumulator.requiresDepth+ +this._testsNeedsDepth+ +this._needsShadowHighlight}get _usesPremultipliedAlphaBlit(){return this._pluginsHas.hudElements}_renderAmbientIlluminationAndDepth(){this._bindParameters.depth=n(this._bindParameters.depth);const e=this._pluginInput.get("normals");if(e){this._pluginInput.set(O.AMBIENT_ILLUMINATION,this._hasGlobalIlluminationFlag?this._renderGlobalIllumination():this._renderSSAO());const t=this._needsDepth;t?(this._rctx.bindFramebuffer(e.fbo),this._rctx.clear(1024),this._renderGeometryWithoutNormals(3),this._bindParameters.depth=e.obtainDepthTexture(),this._bindParameters.depth?.retain(t-1),this.performanceInfo.advance(me.DEPTH)):e.detachDepth(),this.hasAmbientIllumination&&this._pluginInput.release("normals")}else this._hasGlobalIlluminationFlag&&(this._releaseGlobalIlluminationBuffers(),this._bindParameters.globalIlluminationEnabled=this._keepGlobalIlluminationShadingAlive),this._renderAllGeometryDepth()}_renderAllGeometryDepth(){const e=this._needsDepth;if(0===e)return;const{width:t,height:s}=this._framebuffer.size,i=this.fboCache.acquire(t,s,"geometry depth",14);this._rctx.bindFramebuffer(i.fbo),this._rctx.clear(1280),this.renderAllGeometry(3),this._bindParameters.depth=i.obtainDepthTexture(),this._bindParameters.depth?.retain(e-1),i.release(),this.performanceInfo.advance(me.DEPTH)}get _needsShadowDepthRange(){return this._bindParameters.shadowMap.enabled||this._shadowAccumulator.active}_computeShadowDepthRange(e){if(!this._needsShadowDepthRange)return J.Zero;const t=X(e,this._plugins.plugins,this.stage.layers,0);return t.union(this._plugins.queryDepthRange(e)),this._bindParameters.shadowMap.enabled&&t.union(this._nodes.queryDepthRange(O.SHADOWMAP,e)),t.near=Math.max(e.near,t.near),t.far=Math.min(e.far,t.far),t}updateSceneDepthRange(e){if(!this.stage.view.state.isGlobal)return void(this.sceneDepthRange.value=J.Infinite);if((this.stage.view.renderCoordsHelper?.getAltitude(e.eye)??0)<j)return void(this.sceneDepthRange.value=J.Infinite);const t=e.clone();t.near=N,t.far=1e10;const s=X(t,this._plugins.plugins,this.stage.layers,1);s.union(this._plugins.queryDepthRange(t)),this.sceneDepthRange.value.equals(s)||(this.sceneDepthRange.value=s)}get _normalsRequired(){return this._nodes.require("normals",...S,O.VIEWSHED,O.LASERLINES)+(this.hasAmbientIllumination?1:0)}_precompilePrepasses(){this._normalsRequired?(this._precompilePlugins(4,Ie),this._needsDepth&&this._precompilePlugins(3,Ae)):this._needsDepth&&this._precompileAllGeometry(3),this.shadowsEnabled&&(this._needsShadowHighlight?(this._nodes.precompile(this._bindParameters.hasEmission,O.SHADOW_HIGHLIGHT),this._precompileShadowCascades(6),this._precompileShadowCascades(7)):this._precompileShadowCascades(5),this._nodes.precompile(!1,O.SHADOWMAP)),this._shadowAccumulator.active&&(this._shadowAccumulator.precompilePrepass(),this._precompileAllGeometry(5)),this.hasAmbientIllumination&&this._normalsRequired&&this._nodes.precompile(this._bindParameters.hasEmission,O.AMBIENT_ILLUMINATION)}_renderNormals(){const e=this._normalsRequired;if(0===e)return;const{width:t,height:s}=this._framebuffer.size,i=this.fboCache.acquire(t,s,"normals");i.acquireDepth(14),this._rctx.bindFramebuffer(i.fbo),this._rctx.clearFramebuffer(C,!0,!0),this._bindParameters.output=4,this._plugins.render(...Ie);const r=this._nodes.optional("normals",...S,O.VIEWSHED);return i.retain(e+r-1),this.performanceInfo.advance(me.NORMALS),i}_renderSSAO(){this._bindParameters.globalIlluminationEnabled=!1;const e=this._pluginInput.get("normals");return this.hasAmbientIllumination&&e?(this._bindParameters.ssao=this._nodes.produce(O.AMBIENT_ILLUMINATION,this._pluginInput),this._bindParameters.ssao&&this.performanceInfo.advance(me.AMBIENT_ILLUMINATION),this._bindParameters.ssao):null}_renderGlobalIllumination(){const e=this._bindParameters;if(!this.hasGlobalIllumination)return this._releaseGlobalIlluminationBuffers(),e.globalIlluminationEnabled=this._keepGlobalIlluminationShadingAlive,null;const t=this._nodes.produce(O.AMBIENT_ILLUMINATION,this._pluginInput);return this._releaseGlobalIlluminationBuffers(),this._bindParameters.globalIllumination=t,this._bindParameters.globalIlluminationEnabled=!0,this.performanceInfo.advance(this.hasGlobalIlluminationHighQuality?me.AMBIENT_ILLUMINATION_HIGH_QUALITY:me.AMBIENT_ILLUMINATION),e.globalIllumination}_releaseGlobalIlluminationBuffers(){const e=this._bindParameters;e.reprojection.lastFrameColor=h(e.reprojection.lastFrameColor),e.reprojection.lastFrameDepth=n(e.reprojection.lastFrameDepth),e.reprojection.lastFrameEmission=n(e.reprojection.lastFrameEmission),e.globalIllumination=h(e.globalIllumination),e.globalIlluminationEnabled=!1}_precompileAllGeometry(e){const t=this._bindParameters.output;this._bindParameters.output=e,this._precompileOpaqueGeometry(),this._precompileTransparentGeometry(),this._plugins.precompile(...Ee),this._bindParameters.output=t}renderAllGeometry(e){this._bindParameters.output=e,this._renderOpaqueAndTransparentGeometry(e),this._renderTransparentGround()}precompileSlots(e,...t){for(const s of t)this._bindParameters.slot=s,e.precompile(this._renderContext)}precompileOccludedSlots(e,t){for(const s of t)this._renderContext.renderOccludedMask=s,this.precompileSlots(e,...Ce);this._renderContext.renderOccludedMask=te}renderSlots(e,...t){for(const s of t)this._bindParameters.slot=s,e.forAll(e=>{const t=e.acquireTechniques(this._renderContext);t&&e.render(this._renderContext,t)})}renderOccludedSlots(e,t){this._renderContext.renderOccludedMask=t,this.plugins.renderOccludedFlags>1&&this._plugins.render(9),this.renderSlots(e,...Ce),this._renderContext.renderOccludedMask=te}renderHUD(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(...Se[e])}_renderHUDElements(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(16),this.renderHUD(e),this._bindParameters.hudRenderStyle=e,this._plugins.render(14)}precompileViewshedShadowMap(){this._precompileAllGeometry(8)}precompileCutFillOrthographicReferenceDepth(){this._precompilePlugins(9,De)}_precompilePlugins(e,t){const s=this._bindParameters.output;this._bindParameters.output=e,this._plugins.precompile(...t),this._bindParameters.output=s}renderViewshedShadowMap(e){const{camera:t,contentCamera:s}=this._bindParameters,i=this._bindParameters.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this.renderAllGeometry(8),this._ensureBindParametersCamera(t,s),this._bindParameters.camera.setGLViewport(this._rctx),this._bindParameters.output=i}renderCutFillOrthographicReferenceDepth(e){const{camera:t,contentCamera:s}=this._bindParameters,i=this._bindParameters.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this._bindParameters.output=9,this._plugins.render(...De),this._ensureBindParametersCamera(t,s),t.setGLViewport(this._rctx),this._bindParameters.output=i}get _needsGroundDepth(){return this._bindParameters.cutFillVisualizationEnabled}_blitGroundDepth(){if(!this._needsGroundDepth)return null;const{width:e,height:t}=this._framebuffer.size,s=this.fboCache.acquire(e,t,O.GROUND_DEPTH,14);return this._rctx.blitFramebuffer(this._framebuffer.color.fbo,s.fbo,256),this._framebuffer.bind(),s}_renderOpaqueAndTransparentGeometry(e){this._bindParameters.output=e,this._renderOpaqueGeometry(),this._renderTransparentGeometry()}_renderGeometryWithoutNormals(e){this._bindParameters.output=e,this._plugins.render(...Ae)}_precompileOpaqueGeometry(){this._needsOpaquePass&&(this._plugins.precompile(...Pe),this._nodes.precompile(this._bindParameters.hasEmission,"opaque-color"))}_renderOpaqueGeometry(){this._plugins.render(...Pe)}_renderTransparentGeometry(){this._plugins.render(...we),this._hasTransparentGeometry&&this._plugins.render(15)}_renderTransparentGround(){this._plugins.render(...Ee)}_precompileHUD(e){if(!this._pluginsHas.hudElements)return;const t=this._bindParameters.output,s=this._bindParameters.hudRenderStyle,i=this._bindParameters.emissions;this._bindParameters.emissions=0,this._bindParameters.hudRenderStyle=e,this._bindParameters.output=1,this._plugins.precompile(...Te),this._bindParameters.output=2,this._plugins.precompile(...Te),this._bindParameters.output=0,this._oitBlend.precompile(this._bindParameters,!1,1),this._hasHighlights&&(this._bindParameters.output=10,this._plugins.precompile(...Te)),this._bindParameters.emissions=i,this._bindParameters.output=t,this._bindParameters.hudRenderStyle=s}_renderHUD(e,t){if(!this._pluginsHas.hudElements)return t;const s=this._renderOIT(1,e);this._rctx.bindFramebuffer(t.fbo);const i=!!t.getTexture(ue);return this._compositor.compositePreMultipliedAlpha(this._bindParameters,s.getTexture(),i),s.release(),this.performanceInfo.advance(0===e?me.HUD_OCCLUDED:me.HUD),t}get _needsShadowHighlight(){return this.shadowsEnabled&&this._plugins.produces(6,2)}_renderHighlightPrepass(){if(!this._hasHighlights)return;const{fboCache:e,_rctx:t,_bindParameters:s}=this,{width:i,height:r}=this._framebuffer.size,{highlights:a}=s,n=a.length>B?3:1,h=e.acquire(i,r,"highlights",n);h.acquireDepth(14);const o=this._plugins.produces(10,0);return o&&this._framebuffer.color.fbo&&h.fbo&&t.blitFramebuffer(this._framebuffer.color.fbo,h.fbo,1024),t.bindFramebuffer(h.fbo),t.gl.clearBufferuiv(6144,0,[0,0,0,0]),o||t.clear(1024),this._bindParameters.output=10,t.bindFramebuffer(h.fbo),V(t,e,i,r,s,()=>this._renderHighlightGeometries()),h.detachDepth(),this.performanceInfo.advance(me.HIGHLIGHTS),h.retain(this._nodes.require("highlights",...D)+this._nodes.optional("highlights",...D)-1),h}_renderHighlightGeometries(){this._plugins.render(...Re),this._rctx.clear(256),this._renderHUDElements(2)}_renderShadowAccumulation(e){this._shadowAccumulator.updateDepthRange(e);const t=this._shadowAccumulator.requiresDepth;this._bindParameters.output=0,this._shadowAccumulator.renderAccumulation(this._bindParameters)&&this.performanceInfo.advance(me.ACCUMULATED_SHADOWS),this._shadowAccumulator.updateMask(),t&&(this._bindParameters.depth=h(this._bindParameters.depth))}_precompileTransparentGeometry(){y(this._bindParameters.output)?(this._bindParameters.output=1,this._plugins.precompile(...we),this._hasTransparentGeometry&&this._plugins.precompile(15),this._bindParameters.output=2,this._plugins.precompile(...we),this._hasTransparentGeometry&&this._plugins.precompile(15),this._bindParameters.output=0):this._plugins.precompile(...we)}_renderOIT(e,t=2){const s=1===e,{width:i,height:r}=this._framebuffer.size,a=s?()=>this._renderHUDElements(t):()=>this._renderTransparentGeometry(),h=this._bindParameters,o=h.useFloatBlend.value?8:5,d=h.output;h.output=1;const l=s?"oit hud":"oit",m=this.fboCache.acquire(i,r,l,o).acquireColor(ue,this.hasFloatBlend?7:0,"oit alpha"),u=h.hasEmission&&(0===e||1!==t);u&&m.acquireColor(pe,o,"oit emissive"),s||m.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(m.fbo),this._rctx.clearFramebuffer(Z),u&&this._rctx.clearBuffer(2,Z),a(),m.detachDepth(),h.output=2;const _=this.fboCache.acquire(i,r,s?"oit front hud":"oit front");u&&_.acquireColor(ue,o,"oit front emissive"),s?_.acquireDepth(this._hudDepthFormat):_.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(_.fbo),this._rctx.clearFramebuffer(C,s),a(),_.detachDepth();const p=this._pluginsHas.occludedHudElements&&!s,c=p&&0!==h.emissions?pe:ue;let b;return h.hudOcclusion=n(this._bindParameters.hudOcclusion),h.output=0,s?(b=this.fboCache.acquire(i,r,"oit composite hud"),this._rctx.bindFramebuffer(b.fbo),this._rctx.setClearColor(0,0,0,1e-13),this._rctx.clear(16384)):(0!==h.emissions&&this._framebuffer.ensureEmissionAttachment(),p&&(this._framebuffer.color.acquireColor(c,0,"hud occlusion"),this._rctx.clearBuffer(c-ce,C)),this._framebuffer.bind()),this._oitBlend.blend(this._rctx,m,_,h,p,e,this._fboCache.debugCallback),b?.detachDepth(),s||(u&&(this._bindParameters.emissions=3),p&&(h.hudOcclusion=this._framebuffer.color.obtainAttachment(c))),_.release(),m.release(),h.output=d,b}get _hudDepthFormat(){return this.isFeatureEnabled(7)?14:13}get _needsOpaquePass(){return this.plugins.produces(0,...Pe)||this.plugins.produces(5,...Pe)||this.plugins.produces(3,3)}_renderOpaque(){const e=this._needsOpaquePass;e&&(this._plugins.render(0,1),this._pluginInput.set(O.GROUND_DEPTH,this._blitGroundDepth()),this._plugins.render(2,3));const t=this._framebuffer;t.update(t=>this._renderNodes(R.OPAQUE,t,e)),this.fboCache.debugCallback?.(R.OPAQUE,t.color.fbo),t.update(e=>this._renderNodes(O.OPAQUE_ENVIRONMENT,e)),this.fboCache.debugCallback?.(O.OPAQUE_ENVIRONMENT,t.color.fbo),this._renderEdges(1)}_renderPreTransparent(){this._framebuffer.update(e=>this._renderNodes(O.GAUSSIAN_SPLAT,e)),this.fboCache.debugCallback?.(O.GAUSSIAN_SPLAT,this._framebuffer.color.fbo),this._framebuffer.update(e=>this._renderNodes(O.OPAQUE_OCCLUSION_QUERY,e)),this.fboCache.debugCallback?.(O.OPAQUE_OCCLUSION_QUERY,this._framebuffer.color.fbo),this._framebuffer.update(e=>this._renderNodes(O.VOXEL,e)),this.fboCache.debugCallback?.(O.VOXEL,this._framebuffer.color.fbo)}_renderTransparent(){const e=this._framebuffer;if(this._renderHiddenTransparentEdges(),this._hasTransparentGeometry&&this._renderOIT(0),e.update(e=>this._renderNodes(R.TRANSPARENT,e,this._hasTransparentGeometry)),this.fboCache.debugCallback?.(R.TRANSPARENT,e.color.fbo),this._hasTransparentGeometry||this._plugins.render(15),this._renderEdges(0),this._bindParameters.ssao=n(this._bindParameters.ssao),e.update(e=>this._renderNodes(O.TRANSPARENT_NO_DEPTH,e)),this.fboCache.debugCallback?.(O.TRANSPARENT_NO_DEPTH,e.color.fbo),this._framebuffer.bind(),this._plugins.render(8),this._bindParameters.hasEmission){const e=this._rctx.setDrawBuffers([be,ue]);this._bindParameters.transparentWithoutDepthEmissionDimmingPass=!0,this._plugins.render(8),this._bindParameters.transparentWithoutDepthEmissionDimmingPass=!1,this._rctx.setDrawBuffers(e)}this.performanceInfo.advance(me.TRANSPARENT_MATERIAL_WITHOUT_DEPTH)}_renderNodes(e,t,s=!1){if(t.setName(e),this._pluginInput.set(e,t),!this._nodes.produces(e))return s&&this.performanceInfo.advance(e),t;const i=this._nodes.render(t,this._pluginInput,this._releaseNodeInputs);return this.performanceInfo.advance(e),this._fboCache.debugCallback?.(e,i.fbo),i}_ensureBindParameters(e,t){this._ensureBindParametersCamera(e,t),this._ensureBindParametersWeatherFader(),this._ensureBindParametersScreenSpaceReflections(),this._ensureBindParametersReprojection()}_ensureBindParametersCamera(e,t){this._bindParameters.camera=e,this._bindParameters.contentCamera=t}_ensureBindParametersWeatherFader(){1===this.stage.viewingMode&&(this._bindParameters.clouds.data&&(this._bindParameters.clouds.fade(this._bindParameters.camera,this.renderContext.time,this.stage.view.qualitySettings.fadeDuration,this.stage.view.state.stationary),this.weatherFader?.cleanupCubemap()),this._bindParameters.snowCover=this.weatherFader?.snowCover??0)}_ensureBindParametersScreenSpaceReflections(){const{time:e}=this.renderContext,{screenSpaceReflections:t}=this._bindParameters;if(this.hasReflections){null==this._ssrEnableTime&&(this._ssrEnableTime=e);const s=this.stage.view.qualitySettings.fadeDuration;t.fadeFactor=s>0?Math.min(s,e-this._ssrEnableTime)/s:1,t.fadeFactor<1&&this._requestRender()}else this._ssrEnableTime=null}_ensureBindParametersReprojection(){if(!(this.hasReflections||this.hasGlobalIllumination))return void(this._reprojectionMatrix=w);const{reprojection:e,camera:t}=this._bindParameters,{lastFrameCamera:s}=e,i=!s.equals(t);if(i?(f(Ge,t.viewMatrix),f(Fe,t.projectionMatrix),g(He,Ge,Fe),g(He,s.viewMatrix,He),g(He,s.projectionMatrix,He),this._reprojectionMatrix=He):this._reprojectionMatrix=w,this.hasGlobalIllumination){const{viewMatrix:t}=e;i?(g(xe,s.viewMatrix,Ge),P(t,xe)):P(t,w)}}addRenderNode(e){this._nodes.add(e),this._requestRender()}removeRenderNode(e){this._nodes.remove(e),this._requestRender()}updateLighting(e,t,s,i){this._bindParameters.updateLighting(e,t,s,i),this._requestRender(1)}get usedMemory(){return{fbos:this.fboCache.usedMemory,plugins:this._plugins.usedMemory,edges:this.edgeView?.usedMemory??0,clouds:this.weatherFader?.usedMemory??0}}get test(){}};e([p()],ge.prototype,"_inGlobeView",void 0),e([p({readOnly:!0})],ge.prototype,"highResolutionAtmosphere",null),e([p()],ge.prototype,"_edgeView",void 0),e([p()],ge.prototype,"updating",null),ge=e([c("esri.views.3d.webgl-engine.lib.Renderer")],ge);const Pe=[0,1,2,3],we=[7,6,4,5],Ee=[7,6],Ie=[0,1,2,4,...Ee],Ae=[3,5],Ce=[2,4,8],Te=[16,12,14,13],Re=[4,5,2,3,0,1,...Ee],Oe=[4,8,5,11],Se={0:[13],1:[12],2:[13,12],3:[13,12]},De=[0,1,...Ee],Ne=["normals","highlights"],Fe=E(),Ge=E(),He=E(),xe=E();function ye(e){return t=>e.immediate.schedule(t)}export{ge as Renderer};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{equals as s}from"../../../../core/arrayUtils.js";import{smoothstep as t}from"../../../../core/mathUtils.js";import{watch as i,syncAndInitial as a}from"../../../../core/reactiveUtils.js";import{property as r,subclass as o}from"../../../../core/accessorSupport/decorators.js";import{exactEquals as n,copy as d,equals as l}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{InternalRenderCategory as h}from"../../webgl.js";import m from"../../webgl/RenderNode.js";import{vvColorNumber as u}from"../materials/VisualVariablePassParameters.js";import{S as p}from"../../../../chunks/ShadowCastVisualize.glsl.js";import{ShadowCastVisualizeTechnique as c}from"../shaders/ShadowCastVisualizeTechnique.js";import{ShadowCastVisualizeTechniqueConfiguration as b}from"../shaders/ShadowCastVisualizeTechniqueConfiguration.js";import{ColorAttachment0 as _}from"../../../webgl/enums.js";let f=class extends m{constructor(e){super(e),this.produces=h.TRANSPARENT_NO_DEPTH,this.consumes={required:[h.TRANSPARENT_NO_DEPTH]},this.enabled=!1,this.data=null,this._passParameters=new p,this._configuration=new b,this._stencilMask=null,this._disableElevation={min:4e4,max:5e4,threshold:1/512},this._passParameters.data=e.data}initialize(){this.addHandles([i(()=>this.enabled,e=>{this.produces=e?h.TRANSPARENT_NO_DEPTH:"disabled",this.requestRender(1)},a)])}precompile(){this._showVisualization&&this.techniques.precompile(c,this._configuration)}render(){const e=this.input;if(!this._showVisualization||!this.data)return e;const[s,t]=this.data.computedSamples;this._passParameters.sampleScale=[s?1/s:0,t?1/t:0];const i=this.techniques.get(c,this._configuration),a=null!=this._stencilMask,r=this.renderingContext,o=this.bindParameters,n=r.boundFramebuffer;let d=null;return a&&(d=this.fboCache.acquire(o.camera.width,o.camera.height,"shadow cast masked draw"),d.attachDepth(this._stencilMask),r.bindFramebuffer(d.fbo),r.blitFramebuffer(n,d.fbo,16384)),r.bindTechnique(i,o,this._passParameters),r.setDrawBuffers([_]),r.screen.draw(),null!=d&&(r.bindFramebuffer(n),r.blitFramebuffer(d.fbo,n,16384),d.detachDepth(),d.release()),e}setStencilMask(e){this._stencilMask=e}setOptions(e){void 0!==e.enabled&&(this.enabled=e.enabled),void 0!==e.thresholdColor&&(n(this._passParameters.thresholdColor,e.thresholdColor)||(d(this._passParameters.thresholdColor,e.thresholdColor),this._requestRenderIfEnabled())),void 0!==e.gradientColorRamp&&this._modifyGradientColorRamp(e.gradientColorRamp),void 0!==e.bandedGradientColorRamp&&this._modifyGradientColorRamp(e.bandedGradientColorRamp,!0),void 0!==e.threshold&&this._passParameters.threshold!==e.threshold&&(this._passParameters.threshold=e.threshold,this._requestRenderIfEnabled()),void 0!==e.rendersSunlight&&this._configuration.rendersSunlight!==e.rendersSunlight&&(this._configuration.rendersSunlight=e.rendersSunlight,this._requestRenderIfEnabled()),void 0!==e.visualization&&this._configuration.visualization!==e.visualization&&(this._configuration.visualization=e.visualization,this._requestRenderIfEnabled()),void 0!==e.bandSize&&this._passParameters.bandSize!==e.bandSize&&(this._passParameters.bandSize=e.bandSize,this._requestRenderIfEnabled()),void 0!==e.analysisVolume&&(this._configuration.useMask=null!==e.analysisVolume)}get isAboveElevationThreshold(){return this._passParameters.opacityFromElevation>this._disableElevation.threshold}setOpacityFromElevation(e){this._passParameters.opacityFromElevation=1-t(this._disableElevation.min,this._disableElevation.max,e)}get _showVisualization(){return this.enabled&&null!=this.data&&(this.data.computedSamples[0]>0||this.data.computedSamples[1]>0)&&this.isAboveElevationThreshold}_modifyGradientColorRamp(e,s=!1){e.length>u&&(e=e.slice(0,u)),v(s?this._passParameters.bandedGradientColorRamp:this._passParameters.gradientColorRamp,e)||(s?this._passParameters.bandedGradientColorRamp=e:this._passParameters.gradientColorRamp=e,this._requestRenderIfEnabled())}_requestRenderIfEnabled(){this.enabled&&this.requestRender(1)}};function v(e,t){return s(e,t,([e,s],[t,i])=>e===t&&l(s,i))}e([r()],f.prototype,"produces",void 0),e([r()],f.prototype,"consumes",void 0),e([r()],f.prototype,"enabled",void 0),e([r({constructOnly:!0})],f.prototype,"data",void 0),f=e([o("esri.views.3d.webgl-engine.lib.ShadowCastRenderer")],f);export{f as ShadowCastRenderer};
2
+ import{__decorate as e}from"tslib";import{equals as s}from"../../../../core/arrayUtils.js";import{smoothstep as t}from"../../../../core/mathUtils.js";import{watch as i,syncAndInitial as a}from"../../../../core/reactiveUtils.js";import{property as r,subclass as o}from"../../../../core/accessorSupport/decorators.js";import{exactEquals as n,copy as d,equals as l}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{InternalRenderCategory as h}from"../../webgl.js";import m from"../../webgl/RenderNode.js";import{vvColorNumber as u}from"../materials/VisualVariablePassParameters.js";import{S as p}from"../../../../chunks/ShadowCastVisualize.glsl.js";import{ShadowCastVisualizeTechnique as c}from"../shaders/ShadowCastVisualizeTechnique.js";import{ShadowCastVisualizeTechniqueConfiguration as b}from"../shaders/ShadowCastVisualizeTechniqueConfiguration.js";import{ColorAttachment0 as f}from"../../../webgl/enums.js";let _=class extends m{constructor(e){super(e),this.produces=h.TRANSPARENT_NO_DEPTH,this.consumes={required:[h.TRANSPARENT_NO_DEPTH]},this.enabled=!1,this._configuration=new b,this._stencilMask=null,this._disableElevation={min:4e4,max:5e4,threshold:1/512},this._passParameters=new p(e.data)}initialize(){this.addHandles([i(()=>this.enabled,e=>{this.produces=e?h.TRANSPARENT_NO_DEPTH:"disabled",this.requestRender(1)},a)])}precompile(){this._showVisualization&&this.techniques.precompile(c,this._configuration)}render(){const e=this.input;if(!this._showVisualization)return e;const[s,t]=this.data.computedSamples;this._passParameters.sampleScale=[s?1/s:0,t?1/t:0];const i=this.techniques.get(c,this._configuration),a=null!=this._stencilMask,r=this.renderingContext,o=this.bindParameters,n=r.boundFramebuffer;let d=null;return a&&(d=this.fboCache.acquire(o.camera.width,o.camera.height,"shadow cast masked draw"),d.attachDepth(this._stencilMask),r.bindFramebuffer(d.fbo),r.blitFramebuffer(n,d.fbo,16384)),r.bindTechnique(i,o,this._passParameters),r.setDrawBuffers([f]),r.screen.draw(),null!=d&&(r.bindFramebuffer(n),r.blitFramebuffer(d.fbo,n,16384),d.detachDepth(),d.release()),e}setStencilMask(e){this._stencilMask=e}setOptions(e){void 0!==e.enabled&&(this.enabled=e.enabled),void 0!==e.thresholdColor&&(n(this._passParameters.thresholdColor,e.thresholdColor)||(d(this._passParameters.thresholdColor,e.thresholdColor),this._requestRenderIfEnabled())),void 0!==e.gradientColorRamp&&this._modifyGradientColorRamp(e.gradientColorRamp),void 0!==e.bandedGradientColorRamp&&this._modifyGradientColorRamp(e.bandedGradientColorRamp,!0),void 0!==e.threshold&&this._passParameters.threshold!==e.threshold&&(this._passParameters.threshold=e.threshold,this._requestRenderIfEnabled()),void 0!==e.rendersSunlight&&this._configuration.rendersSunlight!==e.rendersSunlight&&(this._configuration.rendersSunlight=e.rendersSunlight,this._requestRenderIfEnabled()),void 0!==e.visualization&&this._configuration.visualization!==e.visualization&&(this._configuration.visualization=e.visualization,this._requestRenderIfEnabled()),void 0!==e.bandSize&&this._passParameters.bandSize!==e.bandSize&&(this._passParameters.bandSize=e.bandSize,this._requestRenderIfEnabled()),void 0!==e.analysisVolume&&(this._configuration.useMask=null!==e.analysisVolume)}get isAboveElevationThreshold(){return this._passParameters.opacityFromElevation>this._disableElevation.threshold}setOpacityFromElevation(e){this._passParameters.opacityFromElevation=1-t(this._disableElevation.min,this._disableElevation.max,e)}get _showVisualization(){return this.enabled&&(this.data.computedSamples[0]>0||this.data.computedSamples[1]>0)&&this.isAboveElevationThreshold}_modifyGradientColorRamp(e,s=!1){e.length>u&&(e=e.slice(0,u)),v(s?this._passParameters.bandedGradientColorRamp:this._passParameters.gradientColorRamp,e)||(s?this._passParameters.bandedGradientColorRamp=e:this._passParameters.gradientColorRamp=e,this._requestRenderIfEnabled())}_requestRenderIfEnabled(){this.enabled&&this.requestRender(1)}};function v(e,t){return s(e,t,([e,s],[t,i])=>e===t&&l(s,i))}e([r()],_.prototype,"produces",void 0),e([r()],_.prototype,"consumes",void 0),e([r()],_.prototype,"enabled",void 0),e([r({constructOnly:!0})],_.prototype,"data",void 0),_=e([o("esri.views.3d.webgl-engine.lib.ShadowCastRenderer")],_);export{_ as ShadowCastRenderer};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{addMany as r,filterInPlace as t}from"../../../../core/arrayUtils.js";import"../../../../core/has.js";import{someMap as s,everyMap as i}from"../../../../core/MapUtils.js";import n from"../../../../core/PooledArray.js";import{property as o,subclass as a}from"../../../../core/accessorSupport/decorators.js";import{set as d}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as h}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{OverlayTarget as c}from"../../terrain/Intersector.js";import{ChangeSet as l,RenderGeometryUpdate as m}from"./ChangeSet.js";import{IntersectorResult as g}from"./IntersectorResult.js";import{RendererBase as p}from"./RendererBase.js";import{noBudget as u}from"../../../support/Scheduler.js";let y=class extends p{constructor(e){super(e),this._pending=new _,this._changes=new l,this._sortedRenderers=new n,this._geometries=new Map,this._hasHighlights=!1,this._hasWater=!1}destroy(){this.destroyed||(this._changes.prune(),this._sortedRenderers.prune(),this._geometries.clear(),this._pending.clear())}get updating(){return!this._pending.empty||this._changes.updates.length>0}get rctx(){return this.rendererContext.rctx}get _localOriginFactory(){return this.rendererContext.localOriginFactory}get hasHighlights(){return this._hasHighlights}hasHighlight(e){return s(this.renderers,r=>r.hasHighlight(e))}get hasWater(){return this._hasWater}get hasOccluders(){return this.renderers&&s(this.renderers,e=>e.hasOnlyOccluders)}get hasOnlyOccluders(){return i(this.renderers,e=>e.hasOnlyOccluders)}get isEmpty(){return!this.updating&&0===this.renderers.size&&0===this._geometries.size}get sortedRenderers(){return this._sortedRenderers}commitChanges(){return!!this.updating&&(this._processAddsRemoves(),this.commit(this._changes,u,this.rendererContext.pluginContext)&&(this._updateSortedMaterialRenderers(),this._hasHighlights=s(this.renderers,e=>{const r=e.produces.get(18);return!!r&&r(10)}),this._hasWater=s(this.renderers,e=>{const r=e.produces.get(19);return!!r&&r(4)})),this.notifyChange("updating"),!0)}addRenderer(){this._sortedRenderers.clear()}removeRenderer(){this._sortedRenderers.clear()}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);switch(s&&this.notifyChange("updating"),r){case 0:this._notifyGraphicVisibilityChanged(e);break;case 1:this._notifyGraphicGeometryChanged(e)}}removeGeometries(e,r){if(this.destroyed)return;const t=this._pending.empty,s=this._pending.adds;for(const i of e)s.has(i)?(this._pending.removed.add(i),s.delete(i)):this._pending.removed.has(i)||this._pending.removes.add(i),this._geometries.delete(i.id);t&&!this._pending.empty&&this.notifyChange("updating"),1===r&&this._notifyGraphicGeometryChanged(e)}modifyGeometries(e,r){const t=0===this._changes.updates.length;for(const s of e){const e=new m;this._changes.updates.push(e),e.renderGeometry=this._ensureValidRenderGeometry(s),e.updateType=r}switch(t&&this._changes.updates.length>0&&this.notifyChange("updating"),r){case 4:case 2:return this._notifyGraphicGeometryChanged(e);case 1:return this._notifyGraphicVisibilityChanged(e)}}updateAnimation(e){let r=!1;return this._sortedRenderers.forAll(t=>r=!!t.updateAnimation&&t.updateAnimation(e)||r),r}precompile(e){return this._sortedRenderers.reduce((r,t)=>t.precompile(e)||r,!1)}render(e){this._sortedRenderers.forAll(r=>{const t=r.acquireTechniques(e);t&&r.render(e,t)})}intersectRay(e,r,t,s,i){for(const n of this._geometries.values()){if(!s(n))continue;this._intersectRenderGeometry(n,t,r,0,e,i);const o=this.rendererContext.longitudeCyclical;if(o){const s=n.boundingSphere.center,a=this._effectiveGeometryRadius(n);s[0]-a<o.min&&this._intersectRenderGeometry(n,t,r,o.range,e,i),s[0]+a>o.max&&this._intersectRenderGeometry(n,t,r,-o.range,e,i)}i++}return i}*intersectScreenPolygon(e,r,t,s){for(const i of this._geometries.values()){if(!t(i))continue;this._intersectScreenPolygonRenderGeometry(i,r,0,e,s);const n=this.rendererContext.longitudeCyclical;if(n){const t=i.boundingSphere.center,o=this._effectiveGeometryRadius(i);t[0]-o<n.min&&this._intersectScreenPolygonRenderGeometry(i,r,n.range,e,s),t[0]+o>n.max&&this._intersectScreenPolygonRenderGeometry(i,r,-n.range,e,s)}s++,yield}return s}_effectiveGeometryRadius(e){const r=e.boundingSphere.radius;return r||e.screenToWorldRatio*C}_updateSortedMaterialRenderers(){if(!(this._sortedRenderers.length>0)){for(const e of this.renderers.values())this._sortedRenderers.push(e);this._sortedRenderers.sort((e,r)=>r.material?.renderPriority===e.material?.renderPriority?e.drapedPriority-r.drapedPriority:(r.material?.renderPriority||0)-(e.material?.renderPriority||0))}}_processAddsRemoves(){this._changes.adds.length=0,this._changes.removes.length=0,r(this._changes.adds,Array.from(this._pending.adds)),r(this._changes.removes,Array.from(this._pending.removes)),t(this._changes.updates,({renderGeometry:e})=>!this._pending.has(e)),this._pending.clear()}_intersectRenderGeometry(e,r,t,s,i,n){if(!e.visible||!e.material.visible||!e.material.intersectRayDraped)return;let o=0;s+=e.transformation[12],o=e.transformation[13],G[0]=t[0]-s,G[1]=t[1]-o,e.screenToWorldRatio=this.rendererContext.screenToWorldRatio,e.material.intersectRayDraped(e,i,G,(t,s,o)=>{f(r,o,n,e.material.renderPriority,i,e.layerViewUid,e.graphicUid)},r)}_intersectScreenPolygonRenderGeometry(e,r,t,s,i){if(!e.visible||!e.material.visible||!e.material.intersectScreenPolygonDraped)return;d(v,t+e.transformation[12],e.transformation[13]),e.screenToWorldRatio=this.rendererContext.screenToWorldRatio;const n=e.material.intersectScreenPolygonDraped(e,v,s,r);n&&R(r.distance,n.primitiveIndex,i,e.material.renderPriority,s,e.layerViewUid,e.graphicUid)}_notifyGraphicGeometryChanged(e){if(null==this.drapeSource.notifyGraphicGeometryChanged)return;let r;for(const{graphicUid:t}of e)null!=t&&t!==r&&(this.drapeSource.notifyGraphicGeometryChanged(t),r=t)}_notifyGraphicVisibilityChanged(e){if(null==this.drapeSource.notifyGraphicVisibilityChanged)return;let r;for(const{graphicUid:t}of e)null!=t&&t!==r&&(this.drapeSource.notifyGraphicVisibilityChanged(t),r=t)}_validateRenderGeometries(e){for(const r of e)this._ensureValidRenderGeometry(r);return e}_ensureValidRenderGeometry(e){return null==e.localOrigin&&(e.localOrigin=this._localOriginFactory.getOrigin(e.boundingSphere.center)),e}get test(){}};e([o({constructOnly:!0})],y.prototype,"drapeSource",void 0),e([o({constructOnly:!0})],y.prototype,"rendererContext",void 0),e([o()],y.prototype,"updating",null),e([o()],y.prototype,"rctx",null),e([o()],y.prototype,"_localOriginFactory",null),e([o({readOnly:!0})],y.prototype,"isEmpty",null),e([o()],y.prototype,"_geometries",void 0),y=e([a("esri.views.3d.webgl-engine.lib.SortedRenderGeometryRenderer")],y);class _{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 f(e,r,t,s,i,n,o){const a=new c(n,o,r),d=r=>{r.set(5,a,e.distance,e.normal,e.transformation,t,s)};if((null==i.results.min.drapedLayerOrder||t>=i.results.min.drapedLayerOrder)&&(null==i.results.min.distance||i.results.ground.distance<=i.results.min.distance)&&d(i.results.min),0!==i.options.store&&(null==i.results.max.drapedLayerOrder||t<i.results.max.drapedLayerOrder)&&(null==i.results.max.distance||i.results.ground.distance>i.results.max.distance)&&d(i.results.max),2===i.options.store){const e=new g(i.ray);d(e),i.results.all.push(e)}}function R(e,r,t,s,i,n,o){i.polygonResults.add(5,new c(n,o,r),e,t,s)}const G=h(),v=h(),C=128;export{y as SortedRenderGeometryRenderer};
2
+ import{__decorate as e}from"tslib";import{addMany as r,filterInPlace as t}from"../../../../core/arrayUtils.js";import"../../../../core/has.js";import{someMap as s,everyMap as i}from"../../../../core/MapUtils.js";import n from"../../../../core/PooledArray.js";import{property as o,subclass as a}from"../../../../core/accessorSupport/decorators.js";import{set as d}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as h}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{OverlayTarget as c}from"../../terrain/Intersector.js";import{ChangeSet as l,RenderGeometryUpdate as m}from"./ChangeSet.js";import{IntersectorResultRay as g}from"./IntersectorResult.js";import{RendererBase as p}from"./RendererBase.js";import{noBudget as u}from"../../../support/Scheduler.js";let y=class extends p{constructor(e){super(e),this._pending=new _,this._changes=new l,this._sortedRenderers=new n,this._geometries=new Map,this._hasHighlights=!1,this._hasWater=!1}destroy(){this.destroyed||(this._changes.prune(),this._sortedRenderers.prune(),this._geometries.clear(),this._pending.clear())}get updating(){return!this._pending.empty||this._changes.updates.length>0}get rctx(){return this.rendererContext.rctx}get _localOriginFactory(){return this.rendererContext.localOriginFactory}get hasHighlights(){return this._hasHighlights}hasHighlight(e){return s(this.renderers,r=>r.hasHighlight(e))}get hasWater(){return this._hasWater}get hasOccluders(){return this.renderers&&s(this.renderers,e=>e.hasOnlyOccluders)}get hasOnlyOccluders(){return i(this.renderers,e=>e.hasOnlyOccluders)}get isEmpty(){return!this.updating&&0===this.renderers.size&&0===this._geometries.size}get sortedRenderers(){return this._sortedRenderers}commitChanges(){return!!this.updating&&(this._processAddsRemoves(),this.commit(this._changes,u,this.rendererContext.pluginContext)&&(this._updateSortedMaterialRenderers(),this._hasHighlights=s(this.renderers,e=>{const r=e.produces.get(18);return!!r&&r(10)}),this._hasWater=s(this.renderers,e=>{const r=e.produces.get(19);return!!r&&r(4)})),this.notifyChange("updating"),!0)}addRenderer(){this._sortedRenderers.clear()}removeRenderer(){this._sortedRenderers.clear()}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);switch(s&&this.notifyChange("updating"),r){case 0:this._notifyGraphicVisibilityChanged(e);break;case 1:this._notifyGraphicGeometryChanged(e)}}removeGeometries(e,r){if(this.destroyed)return;const t=this._pending.empty,s=this._pending.adds;for(const i of e)s.has(i)?(this._pending.removed.add(i),s.delete(i)):this._pending.removed.has(i)||this._pending.removes.add(i),this._geometries.delete(i.id);t&&!this._pending.empty&&this.notifyChange("updating"),1===r&&this._notifyGraphicGeometryChanged(e)}modifyGeometries(e,r){const t=0===this._changes.updates.length;for(const s of e){const e=new m;this._changes.updates.push(e),e.renderGeometry=this._ensureValidRenderGeometry(s),e.updateType=r}switch(t&&this._changes.updates.length>0&&this.notifyChange("updating"),r){case 4:case 2:return this._notifyGraphicGeometryChanged(e);case 1:return this._notifyGraphicVisibilityChanged(e)}}updateAnimation(e){let r=!1;return this._sortedRenderers.forAll(t=>r=!!t.updateAnimation&&t.updateAnimation(e)||r),r}precompile(e){return this._sortedRenderers.reduce((r,t)=>t.precompile(e)||r,!1)}render(e){this._sortedRenderers.forAll(r=>{const t=r.acquireTechniques(e);t&&r.render(e,t)})}intersectRay(e,r,t,s,i){for(const n of this._geometries.values()){if(!s(n))continue;this._intersectRenderGeometry(n,t,r,0,e,i);const o=this.rendererContext.longitudeCyclical;if(o){const s=n.boundingSphere.center,a=this._effectiveGeometryRadius(n);s[0]-a<o.min&&this._intersectRenderGeometry(n,t,r,o.range,e,i),s[0]+a>o.max&&this._intersectRenderGeometry(n,t,r,-o.range,e,i)}i++}return i}*intersectScreenPolygon(e,r,t,s){for(const i of this._geometries.values()){if(!t(i))continue;this._intersectScreenPolygonRenderGeometry(i,r,0,e,s);const n=this.rendererContext.longitudeCyclical;if(n){const t=i.boundingSphere.center,o=this._effectiveGeometryRadius(i);t[0]-o<n.min&&this._intersectScreenPolygonRenderGeometry(i,r,n.range,e,s),t[0]+o>n.max&&this._intersectScreenPolygonRenderGeometry(i,r,-n.range,e,s)}s++,yield}return s}_effectiveGeometryRadius(e){const r=e.boundingSphere.radius;return r||e.screenToWorldRatio*C}_updateSortedMaterialRenderers(){if(!(this._sortedRenderers.length>0)){for(const e of this.renderers.values())this._sortedRenderers.push(e);this._sortedRenderers.sort((e,r)=>r.material?.renderPriority===e.material?.renderPriority?e.drapedPriority-r.drapedPriority:(r.material?.renderPriority||0)-(e.material?.renderPriority||0))}}_processAddsRemoves(){this._changes.adds.length=0,this._changes.removes.length=0,r(this._changes.adds,Array.from(this._pending.adds)),r(this._changes.removes,Array.from(this._pending.removes)),t(this._changes.updates,({renderGeometry:e})=>!this._pending.has(e)),this._pending.clear()}_intersectRenderGeometry(e,r,t,s,i,n){if(!e.visible||!e.material.visible||!e.material.intersectRayDraped)return;let o=0;s+=e.transformation[12],o=e.transformation[13],G[0]=t[0]-s,G[1]=t[1]-o,e.screenToWorldRatio=this.rendererContext.screenToWorldRatio,e.material.intersectRayDraped(e,i,G,(t,s,o)=>{f(r,o,n,e.material.renderPriority,i,e.layerViewUid,e.graphicUid)},r)}_intersectScreenPolygonRenderGeometry(e,r,t,s,i){if(!e.visible||!e.material.visible||!e.material.intersectScreenPolygonDraped)return;d(v,t+e.transformation[12],e.transformation[13]),e.screenToWorldRatio=this.rendererContext.screenToWorldRatio;const n=e.material.intersectScreenPolygonDraped(e,v,s,r);n&&R(r.distance,n.primitiveIndex,i,e.material.renderPriority,s,e.layerViewUid,e.graphicUid)}_notifyGraphicGeometryChanged(e){if(null==this.drapeSource.notifyGraphicGeometryChanged)return;let r;for(const{graphicUid:t}of e)null!=t&&t!==r&&(this.drapeSource.notifyGraphicGeometryChanged(t),r=t)}_notifyGraphicVisibilityChanged(e){if(null==this.drapeSource.notifyGraphicVisibilityChanged)return;let r;for(const{graphicUid:t}of e)null!=t&&t!==r&&(this.drapeSource.notifyGraphicVisibilityChanged(t),r=t)}_validateRenderGeometries(e){for(const r of e)this._ensureValidRenderGeometry(r);return e}_ensureValidRenderGeometry(e){return null==e.localOrigin&&(e.localOrigin=this._localOriginFactory.getOrigin(e.boundingSphere.center)),e}get test(){}};e([o({constructOnly:!0})],y.prototype,"drapeSource",void 0),e([o({constructOnly:!0})],y.prototype,"rendererContext",void 0),e([o()],y.prototype,"updating",null),e([o()],y.prototype,"rctx",null),e([o()],y.prototype,"_localOriginFactory",null),e([o({readOnly:!0})],y.prototype,"isEmpty",null),e([o()],y.prototype,"_geometries",void 0),y=e([a("esri.views.3d.webgl-engine.lib.SortedRenderGeometryRenderer")],y);class _{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 f(e,r,t,s,i,n,o){const a=new c(n,o,r),d=r=>{r.set(5,a,e.distance,e.normal,e.transformation,t,s)};if((null==i.results.min.drapedLayerOrder||t>=i.results.min.drapedLayerOrder)&&(null==i.results.min.distance||i.results.ground.distance<=i.results.min.distance)&&d(i.results.min),0!==i.options.store&&(null==i.results.max.drapedLayerOrder||t<i.results.max.drapedLayerOrder)&&(null==i.results.max.distance||i.results.ground.distance>i.results.max.distance)&&d(i.results.max),2===i.options.store){const e=new g(i.ray);d(e),i.results.all.push(e)}}function R(e,r,t,s,i,n,o){i.polygonResults.add(5,new c(n,o,r),e,t,s)}const G=h(),v=h(),C=128;export{y as SortedRenderGeometryRenderer};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{clamp as t}from"../../../../core/mathUtils.js";import{estimateNumberArrayMemory as e}from"../../../../core/memoryEstimations.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{nan as i,fromValues as r}from"../../../../geometry/support/aaBoundingBox.js";import{newContinuousIndexArray as s}from"../../../../geometry/support/Indices.js";import{MeshIntersectionOptions as a,intersectRayTriangles as o}from"./RayIntersections.js";const c=40,h=.8,d=10,m=1e-6;class l{constructor(e,i,r){this.globalTriangleVertexIndices=e,this.numTriangles=i,this.positions=r,this._rayDirection=n(),this._callback=I,this._intersectionOptions=M,this.bspNodeTree=new Array,this.triangleIndexMap=s(i);const a=x(e,i,r.data,r.stride),o=t(Math.log2(i/c),2,d),m=(t,e,n)=>{const i=u(this.triangleIndexMap,a,t,e),r=e-t;if(r<=c){const n=new g(i,void 0,0,t,e);return this.bspNodeTree.push(n),n}const{axis:s,midValue:d}=p(i),l=f(this.triangleIndexMap,a,t,e,s,d),x=(t,e)=>{if(n>o)return;const i=e-t;return i<c||i>=h*r?void 0:m(t,e,n+1)},y=new g(i,s,d,l.next,l.mid);return this.bspNodeTree.push(y),y.leftNode=x(t,l.next),y.rightNode=x(l.mid,e),y};m(0,i,0)}intersectRayTriangleRange(t,e){if(t>=e)return;const{data:n,stride:i}=this.positions;o(this._rayFrom,this._rayDirection,t,e,this.globalTriangleVertexIndices,n,i,this._intersectionOptions.normalRequired,this._callback,this.triangleIndexMap),l.numFacesTested+=e-t}intersectRay(t,e,n,i){l.numFacesTested=0;const r=t,s=e,a=s[0]-r[0],o=s[1]-r[1],c=s[2]-r[2];if(a*a+o*o+c*c<m)return;this._rayFrom=r;const h=this._rayDirection;h[0]=a,h[1]=o,h[2]=c;const d=this.triangleIndexMap.length;this._callback=i,this._intersectionOptions=n,this.intersectRayBSP(this.bspNodeTree[0],0,d),this._callback=I,this._intersectionOptions=M}intersectRayBSP(t,e,n){const i=this._rayFrom,r=this._rayDirection,s=[{node:t,rangeStart:e,rangeEnd:n}];for(;s.length>0;){const{node:t,rangeStart:e,rangeEnd:n}=s.pop();if(!y(t.aabb,i,r))continue;const a=t.axis,o=t.d;if(i[a]<o||r[a]<0){const n=e,i=t.midStartIndex;if(n<i){const e=t.leftNode;void 0!==e?s.push({node:e,rangeStart:n,rangeEnd:i}):this.intersectRayTriangleRange(n,i)}}if(this.intersectRayTriangleRange(t.midStartIndex,t.rightStartIndex),i[a]>o||r[a]>0){const e=t.rightStartIndex,i=n;if(e<i){const n=t.rightNode;void 0!==n?s.push({node:n,rangeStart:e,rangeEnd:i}):this.intersectRayTriangleRange(e,i)}}}}static{this.numFacesTested=0}get estimatedMemoryUsage(){return e(this.triangleIndexMap)}}class g{constructor(t,e,n,i,r){this.aabb=t,this.axis=e,this.d=n,this.midStartIndex=i,this.rightStartIndex=r}}function f(t,e,n,i,r,s){const a=r+3;let o=n,c=n,h=i;for(;c<h;){const n=t[c],i=6*n;e[i+a]<=s?(t[c]=t[o],t[o]=n,++o,++c):e[i+r]>=s?(--h,t[c]=t[h],t[h]=n):++c}return{next:o,mid:h}}function u(t,e,n,s){if(s<=n)return i;let a=6*t[n],o=e[a++],c=e[a++],h=e[a++],d=e[a++],m=e[a++],l=e[a];for(let i=n+1;i<s;++i)a=6*t[i],o=Math.min(o,e[a++]),c=Math.min(c,e[a++]),h=Math.min(h,e[a++]),d=Math.max(d,e[a++]),m=Math.max(m,e[a++]),l=Math.max(l,e[a]);return r(o,c,h,d,m,l)}function p(t){const e=t[3]-t[0],n=t[4]-t[1],i=t[5]-t[2],r=e>n?e>i?0:n>i?1:2:n>i?1:i>e?2:0;return{axis:r,midValue:(t[r]+t[r+3])/2}}function x(t,e,n,i){const r=new Float64Array(6*e);for(let s=0;s<e;++s){const e=3*s,a=t[e]*i,o=t[e+1]*i,c=t[e+2]*i;for(let t=0;t<3;++t){const e=n[a+t],i=n[o+t],h=n[c+t];r[6*s+t]=Math.min(e,i,h),r[6*s+3+t]=Math.max(e,i,h)}}return r}function y(t,e,n){const i=e,r=n;let s=0,a=1/0;for(let o=0;o<3;++o){{const e=t[o];if(i[o]<e){if(r[o]<=m)return!1;const t=(e-i[o])/r[o];s=Math.max(s,t)}else if(r[o]<=-m){const t=(e-i[o])/r[o];a=Math.min(a,t)}if(s>a)return!1}{const e=t[o+3];if(i[o]>e){if(r[o]>=-m)return!1;const t=(e-i[o])/r[o];s=Math.max(s,t)}else if(r[o]>=m){const t=(e-i[o])/r[o];a=Math.min(a,t)}if(s>a)return!1}}return!0}const M=new a,I=()=>{};export{l as TriangleIntersectionData};
2
+ import{clamp as t}from"../../../../core/mathUtils.js";import{estimateNumberArrayMemory as e}from"../../../../core/memoryEstimations.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as s,copy as r,nan as i,fromValues as o}from"../../../../geometry/support/aaBoundingBox.js";import{intersectsTransformedAabb as a}from"../../../../geometry/support/frustum.js";import{newContinuousIndexArray as c}from"../../../../geometry/support/Indices.js";import{MeshIntersectionOptions as l,intersectRayTriangles as h}from"./RayIntersections.js";import{forEachTriangleRangeScreenPolygonHit as g}from"./screenPolygonTriangleIntersections.js";const m=40,d=.8,u=10,y=1e-6;class _{constructor(e,s,r){this.globalTriangleVertexIndices=e,this.numTriangles=s,this.positions=r,this._rayDirection=n(),this._callback=T,this._intersectionOptions=S,this._screenPolygonCallback=M,this._screenPolygonDisplacement=null,this._screenPolygonIntersector=null,this._screenPolygonQuery=null,this._screenPolygonTransformation=null,this.bspNodeTree=new Array,this.triangleIndexMap=c(s);const i=I(e,s,r.data,r.stride),o=t(Math.log2(s/m),2,u),a=(t,e,n)=>{const s=P(this.triangleIndexMap,i,t,e),r=e-t;if(r<=m){const n=new p(s,void 0,0,t,e);return this.bspNodeTree.push(n),n}const{axis:c,midValue:l}=x(s),h=f(this.triangleIndexMap,i,t,e,c,l),g=(t,e)=>{if(n>o)return;const s=e-t;return s<m||s>=d*r?void 0:a(t,e,n+1)},u=new p(s,c,l,h.next,h.mid);return this.bspNodeTree.push(u),u.leftNode=g(t,h.next),u.rightNode=g(h.mid,e),u};a(0,s,0)}intersectRayTriangleRange(t,e){if(t>=e)return;const{data:n,stride:s}=this.positions;h(this._rayFrom,this._rayDirection,t,e,this.globalTriangleVertexIndices,n,s,this._intersectionOptions.normalRequired,this._callback,this.triangleIndexMap),_.numFacesTested+=e-t}forEachScreenPolygonHit(t,e,n,s,r){null!=t.camera&&0!==this.bspNodeTree.length&&(this._screenPolygonIntersector=t,this._screenPolygonTransformation=e,this._screenPolygonQuery=n,this._screenPolygonDisplacement=s,this._screenPolygonCallback=r,this._intersectScreenPolygonBSP(this.bspNodeTree[0],0,this.triangleIndexMap.length),this._screenPolygonCallback=M,this._screenPolygonDisplacement=null,this._screenPolygonQuery=null,this._screenPolygonTransformation=null,this._screenPolygonIntersector=null)}intersectRay(t,e,n,s){_.numFacesTested=0;const r=t,i=e,o=i[0]-r[0],a=i[1]-r[1],c=i[2]-r[2];if(o*o+a*a+c*c<y)return;this._rayFrom=r;const l=this._rayDirection;l[0]=o,l[1]=a,l[2]=c;const h=this.triangleIndexMap.length;this._callback=s,this._intersectionOptions=n,this.intersectRayBSP(this.bspNodeTree[0],0,h),this._callback=T,this._intersectionOptions=S}intersectRayBSP(t,e,n){const s=this._rayFrom,r=this._rayDirection;this._traverseBSP(t,e,n,t=>b(t.aabb,s,r),t=>{const e=t.axis;return s[e]<t.d||r[e]<0},t=>{const e=t.axis;return s[e]>t.d||r[e]>0},(t,e)=>this.intersectRayTriangleRange(t,e))}_intersectScreenPolygonTriangleRange(t,e){if(t>=e)return;const n=this._screenPolygonIntersector,s=this._screenPolygonQuery;if(null!=n&&null!=s)for(const r of g(n,this._screenPolygonTransformation,s,t,e,this.globalTriangleVertexIndices,this.positions.data,this.positions.stride,this._screenPolygonDisplacement,this.triangleIndexMap))this._screenPolygonCallback(r.distance,r.primitiveIndex,r.point)}_intersectScreenPolygonBSP(t,e,n){const s=this._screenPolygonIntersector,r=this._screenPolygonQuery;null!=s?.camera&&null!=r&&this._traverseBSP(t,e,n,t=>this._nodeIntersectsScreenPolygonBroadPhase(t.aabb),()=>!0,()=>!0,(t,e)=>this._intersectScreenPolygonTriangleRange(t,e))}_traverseBSP(t,e,n,s,r,i,o){const a=[{node:t,rangeStart:e,rangeEnd:n}];for(;a.length>0;){const{node:t,rangeStart:e,rangeEnd:n}=a.pop();s(t)&&(r(t)&&this._traverseBSPRange(a,t.leftNode,e,t.midStartIndex,o),o(t.midStartIndex,t.rightStartIndex),i(t)&&this._traverseBSPRange(a,t.rightNode,t.rightStartIndex,n,o))}}_traverseBSPRange(t,e,n,s,r){n>=s||(void 0!==e?t.push({node:e,rangeStart:n,rangeEnd:s}):r(n,s))}_nodeIntersectsScreenPolygonBroadPhase(t){const e=this._screenPolygonQuery;if(null==e)return!1;const n=this._screenPolygonDisplacement,s=n?n.applyToAabb(r(B,t)):t;return a(e.broadPhaseFrustum,s,this._screenPolygonTransformation)}static{this.numFacesTested=0}get estimatedMemoryUsage(){return e(this.triangleIndexMap)}}class p{constructor(t,e,n,s,r){this.aabb=t,this.axis=e,this.d=n,this.midStartIndex=s,this.rightStartIndex=r}}function f(t,e,n,s,r,i){const o=r+3;let a=n,c=n,l=s;for(;c<l;){const n=t[c],s=6*n;e[s+o]<=i?(t[c]=t[a],t[a]=n,++a,++c):e[s+r]>=i?(--l,t[c]=t[l],t[l]=n):++c}return{next:a,mid:l}}function P(t,e,n,s){if(s<=n)return i;let r=6*t[n],a=e[r++],c=e[r++],l=e[r++],h=e[r++],g=e[r++],m=e[r];for(let i=n+1;i<s;++i)r=6*t[i],a=Math.min(a,e[r++]),c=Math.min(c,e[r++]),l=Math.min(l,e[r++]),h=Math.max(h,e[r++]),g=Math.max(g,e[r++]),m=Math.max(m,e[r]);return o(a,c,l,h,g,m)}function x(t){const e=t[3]-t[0],n=t[4]-t[1],s=t[5]-t[2],r=e>n?e>s?0:n>s?1:2:n>s?1:s>e?2:0;return{axis:r,midValue:(t[r]+t[r+3])/2}}function I(t,e,n,s){const r=new Float64Array(6*e);for(let i=0;i<e;++i){const e=3*i,o=t[e]*s,a=t[e+1]*s,c=t[e+2]*s;for(let t=0;t<3;++t){const e=n[o+t],s=n[a+t],l=n[c+t];r[6*i+t]=Math.min(e,s,l),r[6*i+3+t]=Math.max(e,s,l)}}return r}function b(t,e,n){const s=e,r=n;let i=0,o=1/0;for(let a=0;a<3;++a){{const e=t[a];if(s[a]<e){if(r[a]<=y)return!1;const t=(e-s[a])/r[a];i=Math.max(i,t)}else if(r[a]<=-y){const t=(e-s[a])/r[a];o=Math.min(o,t)}if(i>o)return!1}{const e=t[a+3];if(s[a]>e){if(r[a]>=-y)return!1;const t=(e-s[a])/r[a];i=Math.max(i,t)}else if(r[a]>=y){const t=(e-s[a])/r[a];o=Math.min(o,t)}if(i>o)return!1}}return!0}const S=new l,T=()=>{},M=()=>{},B=s();export{_ as TriangleIntersectionData};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import s from"../../../../core/Collection.js";import{deg2rad as t}from"../../../../core/mathUtils.js";import{disposeMaybe as r}from"../../../../core/maybe.js";import{watch as i,initial as a,when as o,sync as n}from"../../../../core/reactiveUtils.js";import{property as h,subclass as d}from"../../../../core/accessorSupport/decorators.js";import{translate as c,fromTranslation as l,scale as p,mul as w}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as m}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as f}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{sub as u,distance as v}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{fromValues as g}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{Sphere as _}from"../../../../geometry/support/sphere.js";import{InternalRenderCategory as V}from"../../webgl.js";import b from"../../webgl/RenderNode.js";import{ViewshedShadowMap as M}from"./ViewshedShadowMap.js";import{V as y,a as S}from"../../../../chunks/Viewshed.glsl.js";import{ViewshedTechnique as j}from"../shaders/ViewshedTechnique.js";import{ColorAttachment0 as P}from"../../../webgl/enums.js";let x=class extends b{get hasViewsheds(){return this._viewsheds.length>0}get shadowMap(){return this._shadowMap}get _contentPixelRatio(){return this.view.state.contentPixelRatio}get _viewshedsInView(){return this._viewsheds.items.filter(e=>R(this.view,e))}constructor(e){super(e),this.isDecoration=!1,this._passParameters=new y,this._drawParameters=new S,this._viewsheds=new s,this.consumes={required:[V.VIEWSHED,"normals"]},this.produces=V.VIEWSHED}initialize(){this._shadowMap=new M(this.fboCache),this.addHandles([i(()=>this.view.resolutionScale,e=>{const s=this._shadowMap;s&&(s.settings.textureSizeQuality=e)},a),o(()=>!this.hasViewsheds,()=>this._shadowMap?.releaseFBO()),i(()=>this._viewshedsInView.map(e=>[e.elevationAlignedObserverRenderSpace,e.heading,e.tilt,e.farDistance,e.horizontalFieldOfView,e.verticalFieldOfView]),()=>this.requestRender(1),n)])}destroy(){this._shadowMap=r(this._shadowMap)}precompile(){if(this.hasViewsheds)for(const e of this._viewshedsInView)if(this._shadowMap?.isActive(e))return void this.view.stage.renderer.precompileViewshedShadowMap()}render(e){const s=this.bindParameters,t=this.input;if(!this.hasViewsheds||this.isDecoration&&!s.decorations)return t;const r=this.techniques.getCompiled(j);if(!r)return this.requestRender(1),t;const i=this.renderingContext,a=this.view.stage.renderer.isFeatureEnabled(6);this._passParameters.normals=e.find(({name:e})=>"normals"===e)?.getTexture();const o=t.obtainDepthTexture();for(const n of this._viewshedsInView)this._drawParameters.shadowMap=this._renderShadowMap(s,n,a),this._drawParameters.shadowMap&&(this._setupViewshedParameters(n,s.camera),i.bindFramebuffer(t.fbo),i.bindTechnique(r,s,this._passParameters,this._drawParameters),i.setDrawBuffers([P]),i.screen.draw());return this.shadowMap?.releaseFBO(),t.attachDepth(o),o?.release(),t}updateViewsheds(e){const s=this._viewsheds,{removes:t,adds:r}=e;if(t&&(Array.isArray(t)?s.removeMany(t):s.remove(t)),r)if(Array.isArray(r)){const e=r.filter(e=>!s.includes(e));s.addMany(e)}else s.includes(r)||s.add(r)}_renderShadowMap(e,s,t){const r=this._shadowMap;if(!r)return null;const i=this.view.basemapTerrain.hasStencilEnabledExtents,a=r.start(e.camera,s,t,this._contentPixelRatio,i);return a&&r.faces.forEach(e=>this.view.stage.renderer.renderViewshedShadowMap(e)),r.finish(),a&&r.ready?r:null}_setupViewshedParameters(e,s){const r=this._drawParameters,i=e.effectiveObserverRenderSpace;r.localOrigin=i,u(r.observerOffset,e.elevationAlignedObserverRenderSpace,e.effectiveObserverRenderSpace),f(r.fovs,t(e.horizontalFieldOfView),t(e.verticalFieldOfView)),f(r.headingAndTilt,t(e.heading),t(e.tiltParallelToSurface)),r.upVector=e.tiltedUpVector,A(r.targetVector,e.elevationAlignedTargetRenderSpace,i);const a=this._drawParameters.shadowMap;if(!a)return;const o=new Array,n=new Array;for(let t=0;t<a.numActiveFaces;t++)c(F,a.viewshedViewMatrices[t],i),o.push(...F),O(a.viewshedProjectionMatrices[t],F,I),n.push(...I);r.viewMatrices=o,r.projectionMatrices=n,r.volumeOffset=this.selectedViewshed()===e.viewshed?D(e,this.view,s.eye):0}get test(){return{viewsheds:this._viewsheds,shadowMap:this._shadowMap,viewshedsInView:this._viewshedsInView}}};function A(e,s,t){return u(e,s,t)}function O(e,s,t){const r=g(.5,.5,.5);return l(t,r),p(t,t,r),w(t,t,e),w(t,t,s),t}function R(e,s){const t=new _(s.elevationAlignedObserverRenderSpace,s.farDistanceRenderSpace);return!!e.ready&&e.frustum.intersectsSphere(t)}function D(e,s,t){if(null==e)return 0;const{elevationAlignedObserverRenderSpace:r,elevationAlignedTargetRenderSpace:i}=e,a=v(t,r)>v(t,i)?e.observer:e.target;return s.pixelSizeAt(a)}e([h({constructOnly:!0})],x.prototype,"selectedViewshed",void 0),e([h()],x.prototype,"isDecoration",void 0),e([h()],x.prototype,"hasViewsheds",null),e([h()],x.prototype,"_contentPixelRatio",null),e([h()],x.prototype,"_viewshedsInView",null),e([h()],x.prototype,"consumes",void 0),e([h()],x.prototype,"produces",void 0),x=e([d("esri.views.3d.webgl-engine.lib.Viewshed")],x);const F=m(),I=m();export{x as Viewshed,D as computeOffsetScale};
2
+ import{__decorate as e}from"tslib";import s from"../../../../core/Collection.js";import{deg2rad as t}from"../../../../core/mathUtils.js";import{disposeMaybe as i}from"../../../../core/maybe.js";import{watch as r,initial as a,when as o,sync as n}from"../../../../core/reactiveUtils.js";import{property as h,subclass as d}from"../../../../core/accessorSupport/decorators.js";import{translate as c,fromTranslation as l,scale as p,mul as w}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as m}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as f}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{sub as u,distance as v}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{fromValues as g}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{Sphere as _}from"../../../../geometry/support/sphere.js";import{InternalRenderCategory as V}from"../../webgl.js";import b from"../../webgl/RenderNode.js";import{ViewshedShadowMap as M}from"./ViewshedShadowMap.js";import{EmissiveTechniqueConfiguration as y}from"../shaders/EmissiveTechniqueConfiguration.js";import{V as S,a as P}from"../../../../chunks/Viewshed.glsl.js";import{ViewshedTechnique as j}from"../shaders/ViewshedTechnique.js";let x=class extends b{get hasViewsheds(){return this._viewsheds.length>0}get shadowMap(){return this._shadowMap}get _contentPixelRatio(){return this.view.state.contentPixelRatio}get _viewshedsInView(){return this._viewsheds.items.filter(e=>R(this.view,e))}constructor(e){super(e),this.isDecoration=!1,this._passParameters=new S,this._drawParameters=new P,this._viewsheds=new s,this.consumes={required:[V.VIEWSHED,"normals"]},this.produces=V.VIEWSHED,this._configuration=new y}initialize(){this._shadowMap=new M(this.fboCache),this.addHandles([r(()=>this.view.resolutionScale,e=>{const s=this._shadowMap;s&&(s.settings.textureSizeQuality=e)},a),o(()=>!this.hasViewsheds,()=>this._shadowMap?.releaseFBO()),r(()=>this._viewshedsInView.map(e=>[e.elevationAlignedObserverRenderSpace,e.heading,e.tilt,e.farDistance,e.horizontalFieldOfView,e.verticalFieldOfView]),()=>this.requestRender(1),n)])}destroy(){this._shadowMap=i(this._shadowMap)}precompile(){if(this.hasViewsheds&&(!this.isDecoration||this.bindParameters.decorations)){for(const e of this._viewshedsInView)if(this._shadowMap?.isActive(e)){this.view.stage.renderer.precompileViewshedShadowMap();break}this._configuration.hasEmissive=0!==this.bindParameters.emissions,this.techniques.get(j,this._configuration)}}render(e){const s=this.bindParameters,t=this.input;if(!this.hasViewsheds||this.isDecoration&&!s.decorations)return t;const i=this.techniques.get(j,this._configuration),r=this.renderingContext,a=this.view.stage.renderer.isFeatureEnabled(6);this._passParameters.normals=e.find(({name:e})=>"normals"===e)?.getTexture();const o=t.obtainDepthTexture();for(const n of this._viewshedsInView)this._drawParameters.shadowMap=this._renderShadowMap(s,n,a),this._drawParameters.shadowMap&&(this._setupViewshedParameters(n,s.camera),r.bindFramebuffer(t.fbo),r.bindTechnique(i,s,this._passParameters,this._drawParameters),r.screen.draw());return this.shadowMap?.releaseFBO(),t.attachDepth(o),o?.release(),t}updateViewsheds(e){const s=this._viewsheds,{removes:t,adds:i}=e;if(t&&(Array.isArray(t)?s.removeMany(t):s.remove(t)),i)if(Array.isArray(i)){const e=i.filter(e=>!s.includes(e));s.addMany(e)}else s.includes(i)||s.add(i)}_renderShadowMap(e,s,t){const i=this._shadowMap;if(!i)return null;const r=this.view.basemapTerrain.hasStencilEnabledExtents,a=i.start(e.camera,s,t,this._contentPixelRatio,r);return a&&i.faces.forEach(e=>this.view.stage.renderer.renderViewshedShadowMap(e)),i.finish(),a&&i.ready?i:null}_setupViewshedParameters(e,s){const i=this._drawParameters,r=e.effectiveObserverRenderSpace;i.localOrigin=r,u(i.observerOffset,e.elevationAlignedObserverRenderSpace,e.effectiveObserverRenderSpace),f(i.fovs,t(e.horizontalFieldOfView),t(e.verticalFieldOfView)),f(i.headingAndTilt,t(e.heading),t(e.tiltParallelToSurface)),i.upVector=e.tiltedUpVector,A(i.targetVector,e.elevationAlignedTargetRenderSpace,r);const a=this._drawParameters.shadowMap;if(!a)return;const o=new Array,n=new Array;for(let t=0;t<a.numActiveFaces;t++)c(E,a.viewshedViewMatrices[t],r),o.push(...E),O(a.viewshedProjectionMatrices[t],E,T),n.push(...T);i.viewMatrices=o,i.projectionMatrices=n,i.volumeOffset=this.selectedViewshed()===e.viewshed?D(e,this.view,s.eye):0}get test(){return{viewsheds:this._viewsheds,shadowMap:this._shadowMap,viewshedsInView:this._viewshedsInView}}};function A(e,s,t){return u(e,s,t)}function O(e,s,t){const i=g(.5,.5,.5);return l(t,i),p(t,t,i),w(t,t,e),w(t,t,s),t}function R(e,s){const t=new _(s.elevationAlignedObserverRenderSpace,s.farDistanceRenderSpace);return!!e.ready&&e.frustum.intersectsSphere(t)}function D(e,s,t){if(null==e)return 0;const{elevationAlignedObserverRenderSpace:i,elevationAlignedTargetRenderSpace:r}=e,a=v(t,i)>v(t,r)?e.observer:e.target;return s.pixelSizeAt(a)}e([h({constructOnly:!0})],x.prototype,"selectedViewshed",void 0),e([h()],x.prototype,"isDecoration",void 0),e([h()],x.prototype,"hasViewsheds",null),e([h()],x.prototype,"_contentPixelRatio",null),e([h()],x.prototype,"_viewshedsInView",null),e([h()],x.prototype,"consumes",void 0),e([h()],x.prototype,"produces",void 0),x=e([d("esri.views.3d.webgl-engine.lib.Viewshed")],x);const E=m(),T=m();export{x as Viewshed,D as computeOffsetScale};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{getScale as r}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as t}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{diameter as e}from"../../../../geometry/support/aaBoundingBox.js";import{isGaussianSplatLayer as n}from"../../../../layers/support/layerUtils.js";import{isGaussianSplatIntersectorResult as i,isPclIntersectorResult as l,isVoxelIntersectorResult as a,isI3sIntersectorResult as u}from"../../layers/i3s/Intersector.js";import{isOverlayIntersectorResult as o,isTerrainIntersectorResult as c}from"../../terrain/Intersector.js";import{isHUDIntersectorResult as s}from"./HUDIntersectorResult.js";import{isObjectIntersectorResult as g}from"./ObjectIntersectorResult.js";import{isLodIntersectorResult as p}from"./lodRendering/Intersector.js";function f(r,t){return g(r)||s(r)?b(r.target?.object,t):c(r)?t.map?.ground:r.target&&"layerViewUid"in r.target?b(r.target,t):null}function d(r,t){const e=m(r,t);return"graphic"===e?.type?e.graphic:null}function m(r,t,e={}){if(null==r)return null;if(g(r)||s(r))return y(r.target?.object,t,e);if(i(r))return w(U(r.target,t));if(l(r)){const t=r.target.createGraphic();return{type:"graphic",graphic:t,layer:t.layer}}if(a(r)){const t=r.target.createVoxelGraphic();return{type:"graphic",graphic:t,layer:t.layer}}return o(r)||p(r)?y(r.target,t,e):u(r)?h(r.target,t,e):null}function y(r,t,e){if(null==r?.graphicUid)return null;const n=b(r,t);if(null==n)return null;if(n===t.graphics)return null==t.graphicsView||"number"!=typeof r.graphicUid?null:t.graphicsView.getHit(r.graphicUid,e);const i=t.allLayerViews.find(r=>r.layer===n);return!i||i.suspended||null==r.graphicUid?null:"getHit"in i?i.getHit(r.graphicUid,e):null}function h(r,t,e){const n=b(r,t);if(null==n)return null;const i=t.allLayerViews.find(r=>r.layer===n);if(!i||i.suspended||!("getGraphicFromIntersectorTarget"in i))return null;const l=e.defer;return j(i.getGraphicFromIntersectorTarget(r,{defer:l?r=>l(async()=>j(await r())):void 0}))}function V(r,t){const e=b(r,t);if(null==e)return null;const n=t.allLayerViews.find(r=>r.layer===e);return n&&!n.suspended&&"getAABBFromIntersectorTarget"in n?n.getAABBFromIntersectorTarget(r):null}function j(r){return null!=r?{type:"graphic",graphic:r,layer:r.layer}:null}function w(r){return n(r)?{type:"layer",layer:r}:null}function U(r,t){const e=b(r,t);return null!=e&&"type"in e?e:null}function b(r,t){return null==r?.layerViewUid?null:null!=t.graphicsView&&r.layerViewUid===t.graphicsView.uid?t.graphics:t.allLayerViews.find(t=>t.uid===r.layerViewUid)?.layer}function I(t,n){if(g(t)||s(t))return t.target.object.boundingVolumeWorldSpace.bounds.radius;if(p(t)){r(x,t.transformation);const e=Math.max(x[0],x[1],x[2]);return t.target.baseBoundingSphere.radius*e}if(u(t)){const r=V(t.target,n);return r?.5*e(r):null}return null}function B(r){return!g(r)&&!s(r)&&(p(r)?r.target.numLodLevels>1:!!u(r))}const x=t();export{I as getIntersectedFeatureBSRadius,B as hasLod,d as toGraphic,m as toHit,f as toOwner};
2
+ import{getScale as r}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as t}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{diameter as e}from"../../../../geometry/support/aaBoundingBox.js";import{isGaussianSplatLayer as n}from"../../../../layers/support/layerUtils.js";import{isGaussianSplatIntersectorResult as i,isPclIntersectorResult as l,isVoxelIntersectorResult as u,isI3sIntersectorResult as a}from"../../layers/i3s/Intersector.js";import{isOverlayIntersectorResult as o,isTerrainIntersectorResult as c}from"../../terrain/Intersector.js";import{isHUDIntersectorResult as s}from"./HUDIntersectorResult.js";import{isObjectIntersectorResult as g}from"./ObjectIntersectorResult.js";import{isLodIntersectorResult as p}from"./lodRendering/Intersector.js";function f(r,t){return g(r)||s(r)?I(r.target?.object,t):c(r)?t.map?.ground:y(r.target)?I(r.target,t):null}function d(r,t){const e=m(r,t);return"graphic"===e?.type?e.graphic:null}function m(r,t,e={}){if(null==r)return null;if(g(r)||s(r))return h(r.target?.object,t,e);if(i(r))return U(b(r.target,t));if(l(r)){const t=r.target.createGraphic();return{type:"graphic",graphic:t,layer:t.layer}}if(u(r)){const t=r.target.createVoxelGraphic();return{type:"graphic",graphic:t,layer:t.layer}}return o(r)||p(r)?h(r.target,t,e):a(r)?V(r.target,t,e):null}function y(r){return null!=r&&"layerViewUid"in r}function h(r,t,e){if(null==r?.graphicUid)return null;const n=I(r,t);if(null==n)return null;if(n===t.graphics)return null==t.graphicsView||"number"!=typeof r.graphicUid?null:t.graphicsView.getHit(r.graphicUid,e);const i=t.allLayerViews.find(r=>r.layer===n);return!i||i.suspended||null==r.graphicUid?null:"getHit"in i?i.getHit(r.graphicUid,e):null}function V(r,t,e){const n=I(r,t);if(null==n)return null;const i=t.allLayerViews.find(r=>r.layer===n);if(!i||i.suspended||!("getGraphicFromIntersectorTarget"in i))return null;const l=e.defer;return w(i.getGraphicFromIntersectorTarget(r,{defer:l?r=>l(async()=>w(await r())):void 0}))}function j(r,t){const e=I(r,t);if(null==e)return null;const n=t.allLayerViews.find(r=>r.layer===e);return n&&!n.suspended&&"getAABBFromIntersectorTarget"in n?n.getAABBFromIntersectorTarget(r):null}function w(r){return null!=r?{type:"graphic",graphic:r,layer:r.layer}:null}function U(r){return n(r)?{type:"layer",layer:r}:null}function b(r,t){const e=I(r,t);return null!=e&&"type"in e?e:null}function I(r,t){return null==r?.layerViewUid?null:null!=t.graphicsView&&r.layerViewUid===t.graphicsView.uid?t.graphics:t.allLayerViews.find(t=>t.uid===r.layerViewUid)?.layer}function B(t,n){if(g(t)||s(t))return t.target.object.boundingVolumeWorldSpace.bounds.radius;if(p(t)){r(L,t.transformation);const e=Math.max(L[0],L[1],L[2]);return t.target.baseBoundingSphere.radius*e}if(a(t)){const r=j(t.target,n);return r?.5*e(r):null}return null}function x(r){return!g(r)&&!s(r)&&(p(r)?r.target.numLodLevels>1:!!a(r))}const L=t();export{B as getIntersectedFeatureBSRadius,x as hasLod,d as toGraphic,m as toHit,f as toOwner};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{unique as e}from"../../../../../core/arrayUtils.js";import{estimateNumberArrayMemory as t,baseTypedArrayMemory as r}from"../../../../../core/memoryEstimations.js";import{IntersectorResult as s}from"../IntersectorResult.js";import{LodTarget as n}from"./Intersector.js";class i{constructor(e,t,r,s){this.material=e,this.buffer=t,this.numVertices=r,this.boundingInfo=s,this.bufferWriter=e.createBufferWriter()}get layout(){return this.bufferWriter.layout}get numTriangles(){return this.numVertices/3}computeUsedMemory(){return this.buffer.byteLength+r}get renderGeometry(){return this}}class o{constructor(e){this.engineGeometry=e;const t=this.material,r=this.engineGeometry,s=r.attributes,n=r.boundingInfo,o=t.createBufferWriter(),a=o.layout,m=o.elementCount(s),u=a.createBuffer(m);o.write(null,null,s,null,{buffer:u,offset:0}),this.renderGeometry=new i(t,u.buffer,m,n)}get material(){return this.engineGeometry.material}get numVertices(){return this.engineGeometry.indexCount}get numTriangles(){return this.numVertices/3}get boundingInfo(){return this.engineGeometry.boundingInfo}computeUsedMemory(){return Array.from(this.engineGeometry.attributes.values()).reduce((e,r)=>e+t(r.data,r.indices),0)}intersect(e,t,r,s,n,i,o,m){const u=this.engineGeometry;this.material.intersectRay(u,e.transform.transform,e,r,s,(r,s,u)=>a(r,s,u,e,t,i,o,n,m))}intersectScreenPolygon(e,t,r,s,i,o){const a=this.engineGeometry,m=this.material.intersectScreenPolygon?.(a,e.transform.transform,e,t);m?.valid&&e.polygonResults.add(3,new n(s.layerViewUid,s.graphicUid(r),m.primitiveIndex,i,o),m.distance)}}function a(e,t,r,i,o,a,m,u,c){if(e<0)return;if(o&&!o(i.rayBegin,i.rayEnd,e))return;const l=new n(a.layerViewUid,a.graphicUid(u),r,m,c);if((null==i.results.min.distance||e<i.results.min.distance)&&i.results.min.set(3,l,e,t,i.transform.transform),(null==i.results.max.distance||e>i.results.max.distance)&&i.results.max.set(3,l,e,t,i.transform.transform),2===i.options.store){const r=new s(i.results.min.ray);r.set(3,l,e,t,i.transform.transform),i.results.all.push(r)}}class m{constructor(e,t=null){this.geometry=e,this.textures=t}get material(){return this.geometry.material}get numTriangles(){return this.geometry.numTriangles}}class u{constructor(t,r,s){this.components=t,this.minScreenSpaceRadius=r,this.pivotOffset=s;const n=e(this.components.map(e=>e.geometry));this.numVertices=n.reduce((e,t)=>e+t.numVertices,0)}}class c{constructor(e){this.levels=e,this.levels.sort((e,t)=>e.minScreenSpaceRadius===t.minScreenSpaceRadius?e.numVertices-t.numVertices:e.minScreenSpaceRadius-t.minScreenSpaceRadius)}get materialParameters(){return this.levels[0].components[0].geometry.material.parameters}getMaterials(){const t=[];return this.levels.forEach(e=>e.components.forEach(e=>t.push(e.geometry.material))),e(t)}getTextures(){const t=new Array;return this.levels.forEach(e=>e.components.forEach(e=>{null!=e.textures&&t.push(...e.textures)})),e(t)}getGeometries(){const t=new Array;return this.levels.forEach(e=>e.components.forEach(e=>{t.push(e.geometry)})),e(t)}getEngineGeometries(){return this.getGeometries().map(e=>e.engineGeometry).filter(e=>null!=e)}computeUsedMemory(){const e=this.getGeometries(),t=this.getTextures(),r=e.reduce((e,t)=>e+t.computeUsedMemory(),0);return t.reduce((e,t)=>e+t.usedMemory,0)+r}}export{o as LodComponentEngineGeometry,i as LodComponentRenderGeometry,m as LodComponentResources,u as LodLevelResources,c as LodResources};
2
+ import{unique as e}from"../../../../../core/arrayUtils.js";import{estimateNumberArrayMemory as t,baseTypedArrayMemory as r}from"../../../../../core/memoryEstimations.js";import{IntersectorResultRay as s}from"../IntersectorResult.js";import{LodTarget as n}from"./Intersector.js";class i{constructor(e,t,r,s){this.material=e,this.buffer=t,this.numVertices=r,this.boundingInfo=s,this.bufferWriter=e.createBufferWriter()}get layout(){return this.bufferWriter.layout}get numTriangles(){return this.numVertices/3}computeUsedMemory(){return this.buffer.byteLength+r}get renderGeometry(){return this}}class o{constructor(e){this.engineGeometry=e;const t=this.material,r=this.engineGeometry,s=r.attributes,n=r.boundingInfo,o=t.createBufferWriter(),a=o.layout,m=o.elementCount(s),u=a.createBuffer(m);o.write(null,null,s,null,{buffer:u,offset:0}),this.renderGeometry=new i(t,u.buffer,m,n)}get material(){return this.engineGeometry.material}get numVertices(){return this.engineGeometry.indexCount}get numTriangles(){return this.numVertices/3}get boundingInfo(){return this.engineGeometry.boundingInfo}computeUsedMemory(){return Array.from(this.engineGeometry.attributes.values()).reduce((e,r)=>e+t(r.data,r.indices),0)}intersect(e,t,r,s,n,i,o,m){const u=this.engineGeometry;this.material.intersectRay(u,e.transform.transform,e,r,s,(r,s,u)=>a(r,s,u,e,t,i,o,n,m))}intersectScreenPolygon(e,t,r,s,i,o){const a=this.engineGeometry,m=this.material.intersectScreenPolygon?.(a,e.transform.transform,e,t);m?.valid&&e.polygonResults.add(3,new n(s.layerViewUid,s.graphicUid(r),m.primitiveIndex,i,o),m.distance)}}function a(e,t,r,i,o,a,m,u,c){if(e<0)return;if(o&&!o(i.rayBegin,i.rayEnd,e))return;const l=new n(a.layerViewUid,a.graphicUid(u),r,m,c);if((null==i.results.min.distance||e<i.results.min.distance)&&i.results.min.set(3,l,e,t,i.transform.transform),(null==i.results.max.distance||e>i.results.max.distance)&&i.results.max.set(3,l,e,t,i.transform.transform),2===i.options.store){const r=new s(i.results.min.ray);r.set(3,l,e,t,i.transform.transform),i.results.all.push(r)}}class m{constructor(e,t=null){this.geometry=e,this.textures=t}get material(){return this.geometry.material}get numTriangles(){return this.geometry.numTriangles}}class u{constructor(t,r,s){this.components=t,this.minScreenSpaceRadius=r,this.pivotOffset=s;const n=e(this.components.map(e=>e.geometry));this.numVertices=n.reduce((e,t)=>e+t.numVertices,0)}}class c{constructor(e){this.levels=e,this.levels.sort((e,t)=>e.minScreenSpaceRadius===t.minScreenSpaceRadius?e.numVertices-t.numVertices:e.minScreenSpaceRadius-t.minScreenSpaceRadius)}get materialParameters(){return this.levels[0].components[0].geometry.material.parameters}getMaterials(){const t=[];return this.levels.forEach(e=>e.components.forEach(e=>t.push(e.geometry.material))),e(t)}getTextures(){const t=new Array;return this.levels.forEach(e=>e.components.forEach(e=>{null!=e.textures&&t.push(...e.textures)})),e(t)}getGeometries(){const t=new Array;return this.levels.forEach(e=>e.components.forEach(e=>{t.push(e.geometry)})),e(t)}getEngineGeometries(){return this.getGeometries().map(e=>e.engineGeometry).filter(e=>null!=e)}computeUsedMemory(){const e=this.getGeometries(),t=this.getTextures(),r=e.reduce((e,t)=>e+t.computeUsedMemory(),0);return t.reduce((e,t)=>e+t.usedMemory,0)+r}}export{o as LodComponentEngineGeometry,i as LodComponentRenderGeometry,m as LodComponentResources,u as LodLevelResources,c as LodResources};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{createScreenPointArray as t,createRenderScreenPointArray3 as n}from"../../../../core/screenUtils.js";import{transformMat4 as r,copy as e,distance as o,set as i}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{clone as s,create as u}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{empty as c,expandPointInPlace as f,clone as a,intersects as p,containsPoint as l,create as h,fromValues as m}from"../../../../geometry/support/aaBoundingRect.js";import{fromPoints as d,create as g,distance2 as M}from"../../../../geometry/support/lineSegment.js";import{signedDistance as b,intersectLineSegment as j}from"../../../../geometry/support/plane.js";import{containsPoint2dFromValues as x}from"../../../../geometry/support/triangle.js";class I{constructor(t,n,r){this.bounds=t,this.nearestDistance=n,this.nearestPoint=r}}function N(t,n){return t.isRectangle?l(t.bounds,n):V(n,t.points)}function T(t,n,r){const e=n[0]-r,o=n[1]-r,i=n[0]+r,s=n[1]+r;if(!p(t.bounds,m(e,o,i,s,z)))return!1;if(N(t,n))return!0;const u=r*r;for(const c of t.points){const t=c[0]-n[0],r=c[1]-n[1];if(t*t+r*r<=u)return!0}for(let c=0;c<t.points.length;c++){if(D(n,t.points[c],t.points[(c+1)%t.points.length])<=u)return!0}return!1}function S(t,n){if(!p(t.bounds,n))return!1;if(t.isRectangle)return!0;for(const r of t.points)if(l(n,r))return!0;for(let r=0;r<4;r++)if(V(q(A,n,r),t.points))return!0;for(let r=0;r<t.points.length;r++){const e=t.points[r],o=r===t.points.length-1?t.points[0]:t.points[r+1];for(let t=0;t<4;t++){if(Y(e,o,q(A,n,t),q(G,n,(t+1)%4)))return!0}}return!1}function R(t,n,r,e){const o=Math.min(n[0],r[0],e[0]),i=Math.min(n[1],r[1],e[1]),s=Math.max(n[0],r[0],e[0]),u=Math.max(n[1],r[1],e[1]);if(!S(t,m(o,i,s,u,z)))return!1;if(N(t,n)||N(t,r)||N(t,e))return!0;for(const c of t.points)if(x(n,r,e,c,rt))return!0;for(let c=0;c<t.points.length;c++){const o=t.points[c],i=t.points[(c+1)%t.points.length];if(Y(n,r,o,i)||Y(r,e,o,i)||Y(e,n,o,i))return!0}return!1}function y(t,n,r,e){const o=Math.min(n[0],r[0])-e,i=Math.min(n[1],r[1])-e,s=Math.max(n[0],r[0])+e,u=Math.max(n[1],r[1])+e;if(!p(t.bounds,m(o,i,s,u,z)))return!1;if(N(t,n)||N(t,r))return!0;const c=e*e;for(const f of t.points)if(D(f,n,r)<=c)return!0;for(let f=0;f<t.points.length;f++){const e=t.points[f],o=t.points[(f+1)%t.points.length];if(Y(n,r,e,o)||B(n,r,e,o)<=c)return!0}return!1}function _(t,n,r){return v(t,n.bbMin,n.bbMax,r)}function v(t,n,o,i){const u=c(z);nt.reset(t.eye);let p=0;for(let s=0;s<2;s++)for(let c=0;c<2;c++)for(let a=0;a<2;a++)K[0]=0===s?n[0]:o[0],K[1]=0===c?n[1]:o[1],K[2]=0===a?n[2]:o[2],i&&r(K,K,i),e(Z[p++],K),P(t,K)||(t.projectToScreen(K,A),f(u,A),nt.addNearestCandidate(K));return C(t,u,Z,nt),nt.valid?new I(a(u),nt.distance,s(nt.point)):null}function C(t,n,r,e){for(let o=0;o<r.length;o++)for(const i of $){const s=o|i;if(s===o)continue;O(t,r[o],r[s],L)&&(t.projectToScreen(L,A),f(n,A),e.addNearestCandidate(L))}}function F(t,n,r,o,i){e(L,n),e(Q,r);const s=t.projectToRenderScreen(L,H),u=t.projectToRenderScreen(Q,J);if(null==s||null==u)return!1;const c=P(t,L),f=P(t,Q);if(c&&f)return!1;if(c!==f){const n=c?L:Q,r=c?s:u;if(!E(t,n,c?Q:L))return!1;if(!t.projectToRenderScreen(n,r))return!1}return o[0]=s[0],o[1]=s[1],o[2]=0,i[0]=u[0],i[1]=u[1],i[2]=0,!0}function P(t,n){return w(t,n)>0}function w(t,n){return b(t.frustum[4],n)}function E(t,n,r){return O(t,n,r,n)}function O(t,n,r,e){return j(t.frustum[4],d(n,r,X),e)}function V(t,n){let r=!1;for(let e=0,o=n.length-1;e<n.length;o=e++){const i=n[e],s=n[o];if(!(i[1]>t[1]!=s[1]>t[1]))continue;const u=(s[0]-i[0])*(t[1]-i[1])/(s[1]-i[1])+i[0];t[0]<u&&(r=!r)}return r}function Y(t,n,r,e){const o=U(t,n,r),i=U(t,n,e),s=U(r,e,t),u=U(r,e,n);return o!==i&&s!==u||(0===o&&k(t,n,r)||0===i&&k(t,n,e)||0===s&&k(r,e,t)||0===u&&k(r,e,n))}function B(t,n,r,e){return Y(t,n,r,e)?0:Math.min(D(t,r,e),D(n,r,e),D(r,t,n),D(e,t,n))}function D(t,n,r){return M(d(i(L,n[0],n[1],0),i(Q,r[0],r[1],0),X),i(W,t[0],t[1],0))}function U(t,n,r){const e=(n[1]-t[1])*(r[0]-n[0])-(n[0]-t[0])*(r[1]-n[1]);return Math.abs(e)<=rt?0:Math.sign(e)}function k(t,n,r){return r[0]>=Math.min(t[0],n[0])-rt&&r[0]<=Math.max(t[0],n[0])+rt&&r[1]>=Math.min(t[1],n[1])-rt&&r[1]<=Math.max(t[1],n[1])+rt}function q(t,n,r){return t[0]=0===r||3===r?n[0]:n[2],t[1]=r<2?n[1]:n[3],t}const z=h(),A=t(),G=t(),H=n(),J=n(),K=u(),L=u(),Q=u(),W=u(),X=g(),Z=[u(),u(),u(),u(),u(),u(),u(),u()],$=[1,2,4];class tt{constructor(){this._origin=u(),this.point=u(),this.distance=Number.POSITIVE_INFINITY}get valid(){return Number.isFinite(this.distance)}addNearestCandidate(t){const n=o(this._origin,t);n<this.distance&&(this.distance=n,e(this.point,t))}reset(t){this.distance=Number.POSITIVE_INFINITY,e(this._origin,t)}}const nt=new tt,rt=1e-9;export{I as ProjectedScreenBounds,P as isBehindNearPlane,v as projectAabbToScreenBounds,_ as projectBoundingInfoToScreenBounds,F as projectWorldLineSegmentToRenderScreen,N as screenPolygonContainsPoint,S as screenPolygonIntersectsBounds,y as screenPolygonIntersectsBufferedSegment,T as screenPolygonIntersectsCircle,R as screenPolygonIntersectsTriangle};
2
+ import{createRenderScreenPointArray3 as t,createScreenPointArray as n}from"../../../../core/screenUtils.js";import{copy as r,set as o}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as e}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{intersects as i,fromValues as s,create as u,containsPoint as f}from"../../../../geometry/support/aaBoundingRect.js";import{distance2 as c,fromPoints as p,create as m}from"../../../../geometry/support/lineSegment.js";import{signedDistance as a,intersectLineSegment as l}from"../../../../geometry/support/plane.js";import{containsPoint2dFromValues as h}from"../../../../geometry/support/triangle.js";function g(t,n){return t.isRectangle?f(t.bounds,n):v(n,t.points)}function M(t,n,r){const o=n[0]-r,e=n[1]-r,u=n[0]+r,f=n[1]+r;if(!i(t.bounds,s(o,e,u,f,A)))return!1;if(g(t,n))return!0;const c=r*r;for(const i of t.points){const t=i[0]-n[0],r=i[1]-n[1];if(t*t+r*r<=c)return!0}for(let i=0;i<t.points.length;i++){if(k(n,t.points[i],t.points[(i+1)%t.points.length])<=c)return!0}return!1}function j(t,n){if(!i(t.bounds,n))return!1;if(t.isRectangle)return!0;for(const r of t.points)if(f(n,r))return!0;for(let r=0;r<4;r++)if(v(z(C,n,r),t.points))return!0;for(let r=0;r<t.points.length;r++){const o=t.points[r],e=r===t.points.length-1?t.points[0]:t.points[r+1];for(let t=0;t<4;t++){if(B(o,e,z(C,n,t),z(D,n,(t+1)%4)))return!0}}return!1}function x(t,n,r,o){const e=Math.min(n[0],r[0],o[0]),i=Math.min(n[1],r[1],o[1]),u=Math.max(n[0],r[0],o[0]),f=Math.max(n[1],r[1],o[1]);if(!j(t,s(e,i,u,f,A)))return!1;if(g(t,n)||g(t,r)||g(t,o))return!0;for(const s of t.points)if(h(n,r,o,s,K))return!0;for(let s=0;s<t.points.length;s++){const e=t.points[s],i=t.points[(s+1)%t.points.length];if(B(n,r,e,i)||B(r,o,e,i)||B(o,n,e,i))return!0}return!1}function d(t,n,r,o){const e=Math.min(n[0],r[0])-o,u=Math.min(n[1],r[1])-o,f=Math.max(n[0],r[0])+o,c=Math.max(n[1],r[1])+o;if(!i(t.bounds,s(e,u,f,c,A)))return!1;if(g(t,n)||g(t,r))return!0;const p=o*o;for(const i of t.points)if(k(i,n,r)<=p)return!0;for(let i=0;i<t.points.length;i++){const o=t.points[i],e=t.points[(i+1)%t.points.length];if(B(n,r,o,e)||U(n,r,o,e)<=p)return!0}return!1}function b(t,n,o,e,i){r(G,n),r(H,o);const s=t.projectToRenderScreen(G,E),u=t.projectToRenderScreen(H,F);if(null==s||null==u)return!1;const f=R(t,G),c=R(t,H);if(f&&c)return!1;if(f!==c){const n=f?G:H,r=f?s:u;if(!S(t,n,f?H:G))return!1;if(!t.projectToRenderScreen(n,r))return!1}return e[0]=s[0],e[1]=s[1],e[2]=0,i[0]=u[0],i[1]=u[1],i[2]=0,!0}function R(t,n){return y(t,n)>0}function y(t,n){return a(t.frustum[4],n)}function S(t,n,r){return T(t,n,r,n)}function T(t,n,r,o){return l(t.frustum[4],p(n,r,J),o)}function v(t,n){let r=!1;for(let o=0,e=n.length-1;o<n.length;e=o++){const i=n[o],s=n[e];if(!(i[1]>t[1]!=s[1]>t[1]))continue;const u=(s[0]-i[0])*(t[1]-i[1])/(s[1]-i[1])+i[0];t[0]<u&&(r=!r)}return r}function B(t,n,r,o){const e=q(t,n,r),i=q(t,n,o),s=q(r,o,t),u=q(r,o,n);return e!==i&&s!==u||(0===e&&w(t,n,r)||0===i&&w(t,n,o)||0===s&&w(r,o,t)||0===u&&w(r,o,n))}function U(t,n,r,o){return B(t,n,r,o)?0:Math.min(k(t,r,o),k(n,r,o),k(r,t,n),k(o,t,n))}function k(t,n,r){return c(p(o(G,n[0],n[1],0),o(H,r[0],r[1],0),J),o(I,t[0],t[1],0))}function q(t,n,r){const o=(n[1]-t[1])*(r[0]-n[0])-(n[0]-t[0])*(r[1]-n[1]);return Math.abs(o)<=K?0:Math.sign(o)}function w(t,n,r){return r[0]>=Math.min(t[0],n[0])-K&&r[0]<=Math.max(t[0],n[0])+K&&r[1]>=Math.min(t[1],n[1])-K&&r[1]<=Math.max(t[1],n[1])+K}function z(t,n,r){return t[0]=0===r||3===r?n[0]:n[2],t[1]=r<2?n[1]:n[3],t}const A=u(),C=n(),D=n(),E=t(),F=t(),G=e(),H=e(),I=e(),J=m(),K=1e-9;export{R as isBehindNearPlane,b as projectWorldLineSegmentToRenderScreen,g as screenPolygonContainsPoint,j as screenPolygonIntersectsBounds,d as screenPolygonIntersectsBufferedSegment,M as screenPolygonIntersectsCircle,x as screenPolygonIntersectsTriangle};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{createScreenPointArray as t}from"../../../../core/screenUtils.js";import{copy as e,distance as n,squaredDistance as o,set as r,transformMat4 as i}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{setMin as l,setMax as u,getMax as c,getMin as a,create as f}from"../../../../geometry/support/aaBoundingBox.js";import{clipPolygon as m}from"../../../../geometry/support/plane.js";import{normalFromValues as p,closestPointFromValues as d}from"../../../../geometry/support/triangle.js";import{boundingInfoSubdivisionThreshold as I}from"./intersectionConstants.js";import{projectAabbToScreenBounds as h,projectBoundingInfoToScreenBounds as g,screenPolygonIntersectsBounds as b,screenPolygonIntersectsTriangle as v}from"./screenPolygonOverlapUtils.js";class y{constructor(t){this.primitiveIndex=t}}class N{constructor(t){this.type=t,this.distance=Number.POSITIVE_INFINITY,this.primitiveIndex=0,this.hasNormal=!1,this.point=s(),this.normal=s()}reset(){this.distance=Number.POSITIVE_INFINITY,this.hasNormal=!1}update(t,n,o,r){this.distance=t,this.primitiveIndex=n,e(this.point,o),this.hasNormal=null!=r,null!=r&&e(this.normal,r)}updateIfCloserFromValues(t,e,n,o){t<this.distance&&this.update(t,e,n,o)}updateIfCloser(t){const{distance:e,primitiveIndex:n,point:o,normal:r}=t;this.updateIfCloserFromValues(e,n,o,t.hasNormal?r:null)}get valid(){return Number.isFinite(this.distance)}}function x(t,e,n,o,r){if(!t.visible||0!==t.type)return null;const i=new N(4);let s;if(t.boundingInfo)s=F(t.boundingInfo,e,n,o,r);else{const i=t.positionAttribute,l=t.primitivePositionIndices;s=C(e,n,o,0,l.length/3,l,i.data,i.stride,r,null,0)}for(const l of s)i.updateIfCloser(l);return i.valid?i:null}function T(t,e,n,o,r,i,s,l,u){const c=new N(4);for(const a of C(t,e,n,o,r,i,s,l,u,null,0))c.updateIfCloser(a);return c.valid?c:null}function j(t,e,n,o,r){const i=new N(4);for(const s of P(t,e,n,o,r))i.updateIfCloser(s);return i.valid?i:null}function*C(t,e,n,o,r,i,s,l,u,c=null,a=0){const f=(t,n,o,r)=>{const f=(c?.[r]??r)+a,m=null==c?f:r,p=3*f;return V(t,i,s,l,p+0,u,m,e),V(n,i,s,l,p+1,u,m,e),V(o,i,s,l,p+2,u,m,e),f};return yield*P(t,n,o,r,f)}function*P(t,e,o,r,i){if(null==t.camera)return;const{camera:s,screenPolygonPrimitiveProcessor:l}=t;for(let u=o;u<r;++u){const t=i(E[0],E[1],E[2],u),o=M;let r;k.reset();for(const{list:i,count:u}of l.processTriangle(q,E)){const l=m(s.frustum[4],i,u,Y,!1);if(!(l<3)){for(let t=0;t<l;t++)s.projectToScreen(Y[t],_[t]);w(e,_,l)&&(A(s.eye,Y,l,B),null==r&&(r=p(M,E[0],E[1],E[2])),k.updateIfCloserFromValues(n(s.eye,B),t,B,r?o:null))}}k.valid&&(yield k)}}function*F(t,e,n,o,r){const i=e.camera,s=null!=r?(l(O,t.bbMin),u(O,t.bbMax),r.applyToAabb(O),h(i,a(O,E[0]),c(O,E[1]),n)):g(i,t,n);if(null==s||!b(o,s.bounds))return;const{primitiveIndices:f,position:m}=t,p=f?f.length:m.indices.length/3;if(p>I){const i=t.getChildren();if(void 0!==i){for(const t of i)yield*F(t,e,n,o,r);return}}yield*C(e,n,o,0,p,m.indices,m.data,m.stride,r,f,0)}function V(t,e,n,o,s,l,u,c){const a=o*e[s],f=n[a+0],m=n[a+1],p=n[a+2];null!=l?l.applyToVertex(t,f,m,p,u):r(t,f,m,p),c&&i(t,t,c)}function w(t,e,n){for(let o=1;o<n-1;o++)if(v(t,e[0],e[o],e[o+1]))return!0;return!1}function A(t,n,r,i){let s=Number.POSITIVE_INFINITY;for(let l=1;l<r-1;l++){d(U,t,n[0],n[l],n[l+1]);const r=o(t,U);r<s&&(s=r,e(i,U))}}const O=f(),S=12,E=[s(),s(),s()],Y=Array.from({length:S},()=>s()),_=Array.from({length:S},()=>t()),B=s(),M=s(),U=s(),k=new N(4),q={list:[],count:0};export{y as DrapedHit,N as Hit,C as forEachTriangleRangeScreenPolygonHit,P as forEachTriangleReaderRangeScreenPolygonHit,x as intersectTriangleGeometryScreenPolygon,T as intersectTriangleRangeScreenPolygon,j as intersectTriangleReaderRangeScreenPolygon};
2
+ import{createScreenPointArray as t}from"../../../../core/screenUtils.js";import{copy as e,distance as r,squaredDistance as o,set as i,transformMat4 as n}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{setMin as l,setMax as u,create as a}from"../../../../geometry/support/aaBoundingBox.js";import{intersectsTransformedAabb as c,intersectsTransformedAabbFromMinMax as m}from"../../../../geometry/support/frustum.js";import{clipPolygon as f}from"../../../../geometry/support/plane.js";import{normalFromValues as p,closestPointFromValues as d}from"../../../../geometry/support/triangle.js";import{boundingInfoSubdivisionThreshold as h}from"./intersectionConstants.js";import{screenPolygonIntersectsTriangle as I}from"./screenPolygonOverlapUtils.js";class b{constructor(t){this.primitiveIndex=t}}class g{constructor(t){this.type=t,this.distance=Number.POSITIVE_INFINITY,this.primitiveIndex=0,this.hasNormal=!1,this.point=s(),this.normal=s()}reset(){this.distance=Number.POSITIVE_INFINITY,this.hasNormal=!1}update(t,r,o,i){this.distance=t,this.primitiveIndex=r,e(this.point,o),this.hasNormal=null!=i,null!=i&&e(this.normal,i)}updateIfCloserFromValues(t,e,r,o){t<this.distance&&this.update(t,e,r,o)}updateIfCloser(t){const{distance:e,primitiveIndex:r,point:o,normal:i}=t;this.updateIfCloserFromValues(e,r,o,t.hasNormal?i:null)}get valid(){return Number.isFinite(this.distance)}}function y(t,e,r,o,i){if(!t.visible||0!==t.type)return null;const n=new g(4);let s;if(t.boundingInfo)s=j(t.boundingInfo,e,r,o,i);else{const n=t.positionAttribute,l=t.primitivePositionIndices;s=N(e,r,o,0,l.length/3,l,n.data,n.stride,i,null,0)}for(const l of s)n.updateIfCloser(l);return n.valid?n:null}function v(t,e,r,o,i){const n=new g(4);for(const s of x(t,e,r,o,i))n.updateIfCloser(s);return n.valid?n:null}function*N(t,e,r,o,i,n,s,l,u,a=null,c=0){const m=(t,r,o,i)=>{const m=(a?.[i]??i)+c,f=null==a?m:i,p=3*m;return P(t,n,s,l,p+0,u,f,e),P(r,n,s,l,p+1,u,f,e),P(o,n,s,l,p+2,u,f,e),m};return yield*x(t,r,o,i,m)}function*x(t,e,o,i,n){if(null==t.camera)return;const{camera:s,screenPolygonPrimitiveProcessor:l}=t;for(let u=o;u<i;++u){const t=n(A[0],A[1],A[2],u),o=w;let i;Y.reset();for(const{list:n,count:u}of l.processTriangle(_,A)){const l=f(s.frustum[4],n,u,M,!1);if(!(l<3)){for(let t=0;t<l;t++)s.projectToScreen(M[t],O[t]);T(e,O,l)&&(F(s.eye,M,l,S),null==i&&(i=p(w,A[0],A[1],A[2])),Y.updateIfCloserFromValues(r(s.eye,S),t,S,i?o:null))}}Y.valid&&(yield Y)}}function*j(t,e,r,o,i){let n;if(null!=i?(l(C,t.bbMin),u(C,t.bbMax),i.applyToAabb(C),n=c(o.broadPhaseFrustum,C,r)):n=m(o.broadPhaseFrustum,t.bbMin,t.bbMax,r),!n)return;const{primitiveIndices:s,position:a}=t,f=s?s.length:a.indices.length/3;if(f>h){const n=t.getChildren();if(void 0!==n){for(const t of n)yield*j(t,e,r,o,i);return}}yield*N(e,r,o,0,f,a.indices,a.data,a.stride,i,s,0)}function P(t,e,r,o,s,l,u,a){const c=o*e[s],m=r[c+0],f=r[c+1],p=r[c+2];null!=l?l.applyToVertex(t,m,f,p,u):i(t,m,f,p),a&&n(t,t,a)}function T(t,e,r){for(let o=1;o<r-1;o++)if(I(t,e[0],e[o],e[o+1]))return!0;return!1}function F(t,r,i,n){let s=Number.POSITIVE_INFINITY;for(let l=1;l<i-1;l++){d(E,t,r[0],r[l],r[l+1]);const i=o(t,E);i<s&&(s=i,e(n,E))}}const C=a(),V=12,A=[s(),s(),s()],M=Array.from({length:V},()=>s()),O=Array.from({length:V},()=>t()),S=s(),w=s(),E=s(),Y=new g(4),_={list:[],count:0};export{b as DrapedHit,g as Hit,N as forEachTriangleRangeScreenPolygonHit,x as forEachTriangleReaderRangeScreenPolygonHit,y as intersectTriangleGeometryScreenPolygon,v as intersectTriangleReaderRangeScreenPolygon};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{toConst as r}from"../../../../core/compilerUtils.js";import{unpackFloatRGBA as i}from"../../../../core/floatRGBA.js";import has from"../../../../core/has.js";import s from"../../../../core/Logger.js";import{removeMaybe as n,destroyMaybe as o}from"../../../../core/maybe.js";import{when as a,initial as h,watch as l,syncAndInitial as d}from"../../../../core/reactiveUtils.js";import{addFrameTask as c}from"../../../../core/scheduling.js";import{signal as p}from"../../../../core/signal.js";import{Milliseconds as m}from"../../../../core/time.js";import{property as u,subclass as f}from"../../../../core/accessorSupport/decorators.js";import{isMoon as g,isMars as w}from"../../../../geometry/ellipsoidUtils.js";import{ComponentObjectCollection as _}from"../collections/Component/ComponentObjectCollection.js";import{ShaderTechniqueConstructionContext as v}from"../core/shaderTechnique/ShaderTechniqueConstructionContext.js";import{ShaderTechniqueRepository as x}from"../core/shaderTechnique/ShaderTechniqueRepository.js";import{ChapmanAtmosphere as y}from"../effects/atmosphere/ChapmanAtmosphere.js";import{LocalAtmosphere as j}from"../effects/atmosphere/LocalAtmosphere.js";import{MarsAtmosphere as b}from"../effects/atmosphere/MarsAtmosphere.js";import{CloudsComposition as R}from"../effects/clouds/CloudsComposition.js";import{Fog as A}from"../effects/fog/Fog.js";import{ObjectAndLayerID as C}from"../effects/geometry/ObjectAndLayerID.js";import{olidEnabled as S}from"../effects/geometry/olidUtils.js";import{RenderOccluded as T}from"../effects/geometry/RenderOccluded.js";import{GlobalIllumination as M}from"../effects/globalIllumination/GlobalIllumination.js";import{Glow as O}from"../effects/glow/Glow.js";import{Haze as U}from"../effects/haze/Haze.js";import{Highlight as q}from"../effects/highlight/Highlight.js";import{ShadowHighlight as D}from"../effects/highlight/ShadowHighlight.js";import{ShadowHighlightBuffer as L}from"../effects/highlight/ShadowHighlightBuffer.js";import{Magnifier as F}from"../effects/magnifier/Magnifier.js";import{SMAA as k}from"../effects/smaa/SMAA.js";import{SSAO as W}from"../effects/ssao/SSAO.js";import{Stars as B}from"../effects/stars/Stars.js";import{GLMaterialRepository as E}from"../lib/GLMaterialRepository.js";import{ObjectAndLayerIdRenderHelper as H}from"../lib/ObjectAndLayerIdRenderHelper.js";import{Renderer as I}from"../lib/Renderer.js";import{RenderingContext as G}from"../lib/RenderingContext.js";import{RenderingContextOptions as P}from"../lib/RenderingContextOptions.js";import{TextureRepository as z}from"../lib/TextureRepository.js";import{createMarkerTextureRepository as N}from"../materials/markerTextureRepository.js";import{createStippleTextureRepository as V}from"../materials/stippleTextureRepository.js";import{WaterTextureRepository as X}from"../materials/internal/WaterTextureRepository.js";import{getContextCache as Q}from"./contextCache.js";import{removeLoadedShaderModules as J}from"./renderUtils.js";import{ScreenshotManager as K,ScreenshotContext as Y}from"./ScreenshotManager.js";import{contextCache as Z}from"./testUtils.js";import{noBudget as $}from"../../../support/Scheduler.js";import{checkWebGLError as ee}from"../../../webgl/checkWebGLError.js";const te=has("disable-feature:async-navigation-3d-depth-readback");let re=class extends t{constructor(e,t){super(e),this.olidRenderHelper=S()?new H:null,this.waterTextures=new X,this._needsUpdate=!0,this._needsRender=!0,this._idleSuspend=!0,this._needsWaterReflectionUpdate=!1,this._lastAnimationUpdate=0,this.glow=null,this._fog=p(null),this.globalIllumination=null,this.test=null,this._initializeContext(t);const{memoryController:r}=t.view.resourceController;this.stippleTextures=V(this._rctx,r),this.markerTextures=N(this._rctx,r),this.techniques=new x(new v(this._rctx,this.stippleTextures,this.waterTextures,this.markerTextures)),this.textures=new z(t),this.addHandles(this.textures.events.on("changed",e=>this.requestRender(e)));const i=new E(this.textures,this.techniques,()=>this.requestRender(),()=>this.requestRender());this.renderer=new I(t,i,this.techniques,this._rctx,e=>this.requestRender(e)),this.addHandles([a(()=>t.view.ready,()=>this._createRenderNodes(),h),l(()=>this.waterTextures.updating,()=>this.requestRender(),h),l(()=>t.view.qualityProfile,e=>this.renderer?.updateRenderFeatures(e),d)]);const s={renderScene:(e,t,r,i)=>(this.renderer.setTime(t),this.renderer.render(e,r,i)),requestRenderScene:e=>this.requestRender(e),prepareOverlay:()=>t.options.screenshot.prepareOverlay(),renderOverlay:(e,r,i)=>t.options.screenshot.renderOverlay(e,r,i)};this._screenshotManager=new K(this._rctx,s,e=>t.view.overlayManager.updateOverlays($,e.camera,0)),this._registerFrameTask(t)}destroy(){const e=this.stage?.container;e?.contains(this._canvas)&&e.removeChild(this._canvas),this._frameTask=n(this._frameTask),this.techniques.destroy(),this._componentObjectCollection=o(this._componentObjectCollection),this._screenshotManager.destroy(),this.renderer.destroy(),this.textures.destroy(),this.waterTextures.destroy(),this.markerTextures.destroy(),this.stippleTextures.destroy(),this._canvas=null,this._rctx=o(this._rctx),this.test?.destroy()}_createRenderNodes(){const{view:e,viewingMode:t}=this.stage;new B({view:e}),g(e.spatialReference)||(this.glow=new O({view:e}),2===t?new j({view:e}):w(e.spatialReference)?new b({view:e}):(new y({view:e}),new R({view:e}),new U({view:e}),this._fog.value=new A({view:e}))),has("enable-feature:global-illumination")?this.globalIllumination=new M({view:e}):new W({view:e}),new k({view:e,isEnabled:()=>this.renderer.hasSMAA}),new F({view:e}),new q({view:e}),new L({view:e}),new D({view:e,viewingMode:t}),new T({view:e}),S()&&new C({view:e})}requestRender(e=1){switch(e){case 2:this.view.state.fading=!0;case 1:this._needsUpdate=!0,this.globalIllumination?.resetAccumulatedFrames();case 0:this._needsRender=!0}}get updating(){return this._needsUpdate||this._needsWaterReflectionUpdate||this.renderer.updating||this.textures.updating||this.waterTextures.updating}setIdleSuspend(e){this._idleSuspend!==e&&(this._idleSuspend=e,this.requestRender())}get renderingContext(){return this._rctx}get capabilities(){return this._rctx.capabilities}get canvas(){return this._canvas}takeScreenshot(e){return this._screenshotManager.takeScreenshot(r(e))}getAlpha(){return!!this._rctx.contextAttributes.alpha}getMinimalDepthForArea(e,t,r,i,s,n=s){let o=te?this._readMainDepthSynchronously(t,r,i,s,n):this.renderer.navigationDepthCache.getMinimalDepthForArea(t,r,i,s,n)??Number.MAX_VALUE;if(e){const s=e.pickDepth(t*i.pixelRatio,r*i.pixelRatio,i);null!=s&&o>s&&s!==i.nearFar[0]&&s!==i.nearFar[1]&&(o=s)}return o===Number.MAX_VALUE?void 0:o}_readMainDepthSynchronously(e,t,r,i,s){const n=r.constrainWindowSize(e,t,i*r.pixelRatio,s*r.pixelRatio),o=this._ensureLinearDepthArrayBuffer(n);this.renderer.readMainDepth(n,o);let a=Number.MAX_VALUE;for(let h=0;h<n[2]*n[3];h++){const e=this._linearDepthFromTexture(4*h,o,r.nearFar);a>e&&e!==r.nearFar[0]&&e!==r.nearFar[1]&&(a=e)}return a}_linearDepthFromTexture(e,t,r){return i(t,e)*(r[1]-r[0])+r[0]}_ensureLinearDepthArrayBuffer(e){const t=4*e[2]*e[3];return(null==this._tmpDepthBuffer||this._tmpDepthBuffer.byteLength<t)&&(this._tmpDepthBuffer=new Uint8Array(t)),this._tmpDepthBuffer}async reloadShaders(){J(),await this.techniques.reloadAll(),this.renderer.overlay?.reloadShaders(),this.requestRender()}_registerFrameTask(e){const t=e.view.state;let r=!1,i=0,s=!1;const n={preRender:({time:s})=>{r=this.updating,i=this._needsUpdate?1:0,this._needsRender&&this.renderer.updateSceneDepthRange(t.camera),e.commitSyncLayers(),s=this.test?.time??s;const n=m(s-this._lastAnimationUpdate);this.view.state.animationsEnabled&&(n>this.renderer.animationTimestep||r||this._needsRender)&&(this.renderer.updateAnimation(t,s)&&this.requestRender(0),this._lastAnimationUpdate=s)},render:({time:e})=>{if(e=this.test?.time??e,this.renderer.setTime(e),(this._needsRender||!this._idleSuspend||!this.renderer.isCameraFinal||this._needsWaterReflectionUpdate)&&t.camera.fullWidth>0&&t.camera.fullHeight>0){const e=this._needsUpdate&&this._idleSuspend&&this.renderer.isCameraFinal;this._needsRender=!1,this._needsUpdate=!1,this._needsWaterReflectionUpdate=!1,this.renderer.render(t,0),s=!0,e&&this.renderer.hasReflections&&(this.requestRender(0),this._needsWaterReflectionUpdate=!0)}},update:({time:e})=>{this.view.state.animationsEnabled&&this.textures.update();const r=new Y(t,this.renderer.fboCache);e=this.test?.time??e,this._screenshotManager.update(r,e)},finish:()=>{s&&(this.renderer.finish(2===t.mode?i:1),s=!1)}};this._frameTask=c(n)}_initializeContext(e){const{options:t}=e,r=t.canvas??document.createElement("canvas");r.setAttribute("style","width: 100%; height:100%; display:block;"),this._canvas=r;const i={alpha:t.alpha||!1,premultipliedAlpha:!0,antialias:!1,depth:!0,stencil:t.stencil??!0,powerPreference:"high-performance",preserveDrawingBuffer:t.preserveDrawingBuffer??!1},n=r.getContext("webgl2",i);if(null==n)return void s.getLogger(this).error("A WebGL2 context could not be created.");ee(n,!0),this._rctx=ie(n,e),this._loadShaderOnlyExtensions(),!t.alpha&&this._rctx.contextAttributes.alpha&&s.getLogger(this).error("WebGL context has alpha channel even though no alpha channel was requested");const{container:o}=e;!this._rctx.contextAttributes.alpha&&has("safari")>=11&&(o.style.backgroundColor="black"),o.contains(r)||o.appendChild(r)}_loadShaderOnlyExtensions(){this._rctx.capabilities.enable("textureFloatLinear")}get _viewingMode(){return this.stage.viewingMode}get stage(){return this.view.stage}getObjectAndLayerIdColor(e){return this.olidRenderHelper?.getObjectAndLayerIdColor(e)}get componentObjectCollection(){return this._componentObjectCollection??=new _(this.renderer.renderPassManager,this._viewingMode,this.view.spatialReference.isWebMercator),this._componentObjectCollection}updateQualitySettings(e){null!=this.test?.time&&null!=e.fadeDuration&&(this.test.savedFadeDuration=e.fadeDuration,e.fadeDuration=m(0)),this._rctx.updateOptions({maxPreferredTexturePixels:this.view.qualitySettings.maxTexturePixels})}get fog(){return r(this._fog.value)}};function ie(e,t){const r=new P(t);if(Z.enabled){let t=se.get(e);return 1===t?.refCount?(t.configure(r),t.ref(),t):(t=new G(e,r),se.set(e,t),t.ref(),t)}return new G(e,r)}e([u({type:Boolean,readOnly:!0})],re.prototype,"updating",null),e([u({constructOnly:!0})],re.prototype,"view",void 0),e([u({readOnly:!0})],re.prototype,"componentObjectCollection",null),e([u()],re.prototype,"_componentObjectCollection",void 0),e([u()],re.prototype,"_needsUpdate",void 0),e([u()],re.prototype,"_needsWaterReflectionUpdate",void 0),re=e([f("esri.views.3d.webgl-engine.parts.RenderView")],re);const se=Q();export{re as RenderView};
2
+ import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{toConst as r}from"../../../../core/compilerUtils.js";import{unpackFloatRGBA as i}from"../../../../core/floatRGBA.js";import has from"../../../../core/has.js";import s from"../../../../core/Logger.js";import{removeMaybe as n,destroyMaybe as o}from"../../../../core/maybe.js";import{when as a,initial as h,watch as l,syncAndInitial as d}from"../../../../core/reactiveUtils.js";import{addFrameTask as p}from"../../../../core/scheduling.js";import{signal as c}from"../../../../core/signal.js";import{Milliseconds as m}from"../../../../core/time.js";import{property as u,subclass as f}from"../../../../core/accessorSupport/decorators.js";import{isMoon as g,isMars as w}from"../../../../geometry/ellipsoidUtils.js";import{debugFlags as _}from"../../support/debugFlags.js";import{ComponentObjectCollection as v}from"../collections/Component/ComponentObjectCollection.js";import{ShaderTechniqueConstructionContext as x}from"../core/shaderTechnique/ShaderTechniqueConstructionContext.js";import{ShaderTechniqueRepository as y}from"../core/shaderTechnique/ShaderTechniqueRepository.js";import{ChapmanAtmosphere as j}from"../effects/atmosphere/ChapmanAtmosphere.js";import{LocalAtmosphere as b}from"../effects/atmosphere/LocalAtmosphere.js";import{MarsAtmosphere as R}from"../effects/atmosphere/MarsAtmosphere.js";import{CloudsComposition as A}from"../effects/clouds/CloudsComposition.js";import{Fog as C}from"../effects/fog/Fog.js";import{ObjectAndLayerID as S}from"../effects/geometry/ObjectAndLayerID.js";import{olidEnabled as T}from"../effects/geometry/olidUtils.js";import{RenderOccluded as U}from"../effects/geometry/RenderOccluded.js";import{GlobalIllumination as M}from"../effects/globalIllumination/GlobalIllumination.js";import{Glow as O}from"../effects/glow/Glow.js";import{Haze as q}from"../effects/haze/Haze.js";import{Highlight as D}from"../effects/highlight/Highlight.js";import{ShadowHighlight as L}from"../effects/highlight/ShadowHighlight.js";import{ShadowHighlightBuffer as F}from"../effects/highlight/ShadowHighlightBuffer.js";import{Magnifier as k}from"../effects/magnifier/Magnifier.js";import{SMAA as W}from"../effects/smaa/SMAA.js";import{SSAO as B}from"../effects/ssao/SSAO.js";import{Stars as E}from"../effects/stars/Stars.js";import{EmissionComposite as I}from"../lib/EmissionComposite.js";import{GLMaterialRepository as H}from"../lib/GLMaterialRepository.js";import{ObjectAndLayerIdRenderHelper as G}from"../lib/ObjectAndLayerIdRenderHelper.js";import{Renderer as P}from"../lib/Renderer.js";import{RenderingContext as N}from"../lib/RenderingContext.js";import{RenderingContextOptions as z}from"../lib/RenderingContextOptions.js";import{TextureRepository as V}from"../lib/TextureRepository.js";import{createMarkerTextureRepository as X}from"../materials/markerTextureRepository.js";import{createStippleTextureRepository as Q}from"../materials/stippleTextureRepository.js";import{WaterTextureRepository as J}from"../materials/internal/WaterTextureRepository.js";import{getContextCache as K}from"./contextCache.js";import{removeLoadedShaderModules as Y}from"./renderUtils.js";import{ScreenshotManager as Z,ScreenshotContext as $}from"./ScreenshotManager.js";import{contextCache as ee}from"./testUtils.js";import{noBudget as te}from"../../../support/Scheduler.js";import{checkWebGLError as re}from"../../../webgl/checkWebGLError.js";const ie=has("disable-feature:async-navigation-3d-depth-readback");let se=class extends t{constructor(e,t){super(e),this.olidRenderHelper=T()?new G:null,this.waterTextures=new J,this._needsUpdate=!0,this._needsRender=!0,this._idleSuspend=!0,this._needsWaterReflectionUpdate=!1,this._lastAnimationUpdate=0,this.glow=null,this._fog=c(null),this.globalIllumination=null,this.test=null,this._initializeContext(t);const{memoryController:r}=t.view.resourceController;this.stippleTextures=Q(this._rctx,r),this.markerTextures=X(this._rctx,r),this.techniques=new y(new x(this._rctx,this.stippleTextures,this.waterTextures,this.markerTextures)),this.textures=new V(t),this.addHandles(this.textures.events.on("changed",e=>this.requestRender(e)));const i=new H(this.textures,this.techniques,()=>this.requestRender(),()=>this.requestRender());this.renderer=new P(t,i,this.techniques,this._rctx,e=>this.requestRender(e)),this.addHandles([a(()=>t.view.ready,()=>this._createRenderNodes(),h),l(()=>this.waterTextures.updating,()=>this.requestRender(),h),l(()=>t.view.qualityProfile,e=>this.renderer?.updateRenderFeatures(e),d)]);const s={renderScene:(e,t,r,i)=>(this.renderer.setTime(t),this.renderer.render(e,r,i)),requestRenderScene:e=>this.requestRender(e),prepareOverlay:()=>t.options.screenshot.prepareOverlay(),renderOverlay:(e,r,i)=>t.options.screenshot.renderOverlay(e,r,i)};this._screenshotManager=new Z(this._rctx,s,e=>t.view.overlayManager.updateOverlays(te,e.camera,0)),this._registerFrameTask(t)}destroy(){const e=this.stage?.container;e?.contains(this._canvas)&&e.removeChild(this._canvas),this._frameTask=n(this._frameTask),this.techniques.destroy(),this._componentObjectCollection=o(this._componentObjectCollection),this._screenshotManager.destroy(),this.renderer.destroy(),this.textures.destroy(),this.waterTextures.destroy(),this.markerTextures.destroy(),this.stippleTextures.destroy(),this._canvas=null,this._rctx=o(this._rctx),this.test?.destroy()}_createRenderNodes(){const{view:e,viewingMode:t}=this.stage;new E({view:e}),g(e.spatialReference)||(this.glow=new O({view:e}),2===t?new b({view:e}):w(e.spatialReference)?new R({view:e}):(new j({view:e}),new A({view:e}),new q({view:e}),this._fog.value=new C({view:e}))),has("enable-feature:global-illumination")?this.globalIllumination=new M({view:e}):new B({view:e}),new W({view:e,isEnabled:()=>this.renderer.hasSMAA}),new k({view:e}),new D({view:e}),new F({view:e}),new L({view:e,viewingMode:t}),new I({view:e}),new U({view:e}),T()&&new S({view:e})}requestRender(e=1){switch(e){case 2:this.view.state.fading=!0;case 1:this._needsUpdate=!0,this.globalIllumination?.resetAccumulatedFrames();case 0:this._needsRender=!0}}get updating(){const e=this._needsUpdate||this._needsWaterReflectionUpdate||this.renderer.updating||this.textures.updating||this.waterTextures.updating;return e&&_.UPDATING&&console.log(" RenderView:",this._needsUpdate,this._needsWaterReflectionUpdate,this.renderer.updating,this.textures.updating,this.waterTextures.updating),e}setIdleSuspend(e){this._idleSuspend!==e&&(this._idleSuspend=e,this.requestRender())}get renderingContext(){return this._rctx}get capabilities(){return this._rctx.capabilities}get canvas(){return this._canvas}takeScreenshot(e){return this._screenshotManager.takeScreenshot(r(e))}getAlpha(){return!!this._rctx.contextAttributes.alpha}getMinimalDepthForArea(e,t,r,i,s,n=s){let o=ie?this._readMainDepthSynchronously(t,r,i,s,n):this.renderer.navigationDepthCache.getMinimalDepthForArea(t,r,i,s,n)??Number.MAX_VALUE;if(e){const s=e.pickDepth(t*i.pixelRatio,r*i.pixelRatio,i);null!=s&&o>s&&s!==i.nearFar[0]&&s!==i.nearFar[1]&&(o=s)}return o===Number.MAX_VALUE?void 0:o}_readMainDepthSynchronously(e,t,r,i,s){const n=r.constrainWindowSize(e,t,i*r.pixelRatio,s*r.pixelRatio),o=this._ensureLinearDepthArrayBuffer(n);this.renderer.readMainDepth(n,o);let a=Number.MAX_VALUE;for(let h=0;h<n[2]*n[3];h++){const e=this._linearDepthFromTexture(4*h,o,r.nearFar);a>e&&e!==r.nearFar[0]&&e!==r.nearFar[1]&&(a=e)}return a}_linearDepthFromTexture(e,t,r){return i(t,e)*(r[1]-r[0])+r[0]}_ensureLinearDepthArrayBuffer(e){const t=4*e[2]*e[3];return(null==this._tmpDepthBuffer||this._tmpDepthBuffer.byteLength<t)&&(this._tmpDepthBuffer=new Uint8Array(t)),this._tmpDepthBuffer}async reloadShaders(){Y(),await this.techniques.reloadAll(),this.renderer.overlay?.reloadShaders(),this.requestRender()}_registerFrameTask(e){const t=e.view.state;let r=!1,i=0,s=!1;const n={preRender:({time:s})=>{r=this.updating,i=this._needsUpdate?1:0,this._needsRender&&this.renderer.updateSceneDepthRange(t.camera),e.commitSyncLayers(),s=this.test?.time??s;const n=m(s-this._lastAnimationUpdate);this.view.state.animationsEnabled&&(n>this.renderer.animationTimestep||r||this._needsRender)&&(this.renderer.updateAnimation(t,s)&&this.requestRender(0),this._lastAnimationUpdate=s)},render:({time:e})=>{if(e=this.test?.time??e,this.renderer.setTime(e),(this._needsRender||!this._idleSuspend||!this.renderer.isCameraFinal||this._needsWaterReflectionUpdate)&&t.camera.fullWidth>0&&t.camera.fullHeight>0){const e=this._needsUpdate&&this._idleSuspend&&this.renderer.isCameraFinal;this._needsRender=!1,this._needsUpdate=!1,this._needsWaterReflectionUpdate=!1,this.renderer.render(t,0),s=!0,e&&this.renderer.hasReflections&&(this.requestRender(0),this._needsWaterReflectionUpdate=!0)}},update:({time:e})=>{this.view.state.animationsEnabled&&this.textures.update();const r=new $(t,this.renderer.fboCache);e=this.test?.time??e,this._screenshotManager.update(r,e)},finish:()=>{s&&(this.renderer.finish(2===t.mode?i:1),s=!1)}};this._frameTask=p(n)}_initializeContext(e){const{options:t}=e,r=t.canvas??document.createElement("canvas");r.setAttribute("style","width: 100%; height:100%; display:block;"),this._canvas=r;const i={alpha:t.alpha||!1,premultipliedAlpha:!0,antialias:!1,depth:!0,stencil:t.stencil??!0,powerPreference:"high-performance",preserveDrawingBuffer:t.preserveDrawingBuffer??!1},n=r.getContext("webgl2",i);if(null==n)return void s.getLogger(this).error("A WebGL2 context could not be created.");re(n,!0),this._rctx=ne(n,e),this._loadShaderOnlyExtensions(),!t.alpha&&this._rctx.contextAttributes.alpha&&s.getLogger(this).error("WebGL context has alpha channel even though no alpha channel was requested");const{container:o}=e;!this._rctx.contextAttributes.alpha&&has("safari")>=11&&(o.style.backgroundColor="black"),o.contains(r)||o.appendChild(r)}_loadShaderOnlyExtensions(){this._rctx.capabilities.enable("textureFloatLinear")}get _viewingMode(){return this.stage.viewingMode}get stage(){return this.view.stage}getObjectAndLayerIdColor(e){return this.olidRenderHelper?.getObjectAndLayerIdColor(e)}get componentObjectCollection(){return this._componentObjectCollection??=new v(this.renderer.renderPassManager,this._viewingMode,this.view.spatialReference.isWebMercator),this._componentObjectCollection}updateQualitySettings(e){null!=this.test?.time&&null!=e.fadeDuration&&(this.test.savedFadeDuration=e.fadeDuration,e.fadeDuration=m(0)),this._rctx.updateOptions({maxPreferredTexturePixels:this.view.qualitySettings.maxTexturePixels})}get fog(){return r(this._fog.value)}};function ne(e,t){const r=new z(t);if(ee.enabled){let t=oe.get(e);return 1===t?.refCount?(t.configure(r),t.ref(),t):(t=new N(e,r),oe.set(e,t),t.ref(),t)}return new N(e,r)}e([u({type:Boolean,readOnly:!0})],se.prototype,"updating",null),e([u({constructOnly:!0})],se.prototype,"view",void 0),e([u({readOnly:!0})],se.prototype,"componentObjectCollection",null),e([u()],se.prototype,"_componentObjectCollection",void 0),e([u()],se.prototype,"_needsUpdate",void 0),e([u()],se.prototype,"_needsWaterReflectionUpdate",void 0),se=e([f("esri.views.3d.webgl-engine.parts.RenderView")],se);const oe=K();export{se as RenderView};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import"../core/shaderLibrary/ScreenSpacePass.glsl.js";import"../core/shaderLibrary/util/ColorConversion.glsl.js";import"../core/shaderModules/Float4PassUniform.js";import"../core/shaderModules/FloatPassUniform.js";import"../core/shaderModules/glsl.js";import"../core/shaderModules/Texture2DPassUniform.js";import"../../../webgl/NoParameters.js";import"../../../webgl/ShaderBuilder.js";export{C as CutFillCompositionPassParameters,b as build}from"../../../../chunks/CutFillComposition.glsl.js";
2
+ import"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import"../core/shaderLibrary/ScreenSpacePass.glsl.js";import"../core/shaderLibrary/util/blendEmission.glsl.js";import"../core/shaderLibrary/util/ColorConversion.glsl.js";import"../core/shaderModules/Float4PassUniform.js";import"../core/shaderModules/FloatPassUniform.js";import"../core/shaderModules/glsl.js";import"../core/shaderModules/Texture2DPassUniform.js";import"../../../webgl/NoParameters.js";import"../../../webgl/ShaderBuilder.js";export{C as CutFillCompositionPassParameters,b as build}from"../../../../chunks/CutFillComposition.glsl.js";
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import{__decorate as s}from"tslib";import{ShaderTechniqueConfiguration as e,parameter as i}from"../core/shaderTechnique/ShaderTechniqueConfiguration.js";class o extends e{constructor(){super(...arguments),this.hasEmissive=!1}}s([i()],o.prototype,"hasEmissive",void 0);export{o as EmissiveTechniqueConfiguration};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as o}from"tslib";import{parameter as s}from"../core/shaderTechnique/ShaderTechniqueConfiguration.js";import{OITResolutionConfiguration as i}from"./oitResolution.glsl.js";class r extends i{constructor(){super(...arguments),this.hasEmission=!1}}o([s()],r.prototype,"hasEmission",void 0);export{r as GaussianSplatCompositionTechniqueConfiguration};
2
+ import{__decorate as o}from"tslib";import{parameter as s}from"../core/shaderTechnique/ShaderTechniqueConfiguration.js";import{FloatBlendScaleConfiguration as r}from"./floatBlendScale.glsl.js";class e extends r{constructor(){super(...arguments),this.hasEmission=!1}}o([s()],e.prototype,"hasEmission",void 0);export{e as GaussianSplatCompositionTechniqueConfiguration};
@@ -1,8 +1,8 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{isColor as o,isOITColorAlpha as i,isOITFrontFace as l}from"../core/shaderLibrary/ShaderOutput.js";import{Emissions as r}from"../core/shaderLibrary/output/Emissions.glsl.js";import{OutputHighlight as s}from"../core/shaderLibrary/output/OutputHighlight.glsl.js";import{ColorConversion as a}from"../core/shaderLibrary/util/ColorConversion.glsl.js";import{emissionFilter as e}from"../core/shaderLibrary/util/emissionFilter.glsl.js";import{If as n,glsl as t}from"../core/shaderModules/glsl.js";import{alphaCutoff as f}from"./alphaCutoff.glsl.js";import{ditherNoise as m}from"./ditherNoise.glsl.js";import{oitResolution as u}from"./oitResolution.glsl.js";function d(d,g){d.include(s,g),d.include(r,g);const{fragment:p,outputs:c}=d;p.include(a);const{output:C,hasEmission:h,oitPremultipliedAlpha:b,snowCover:E,emissionDimmingPass:v,renderOccluded:y}=g,j=11===C,O=i(C),$=l(C),A=o(C)&&!O,L=0!==C||y;let S=0;(A||O)&&c.add("fragColor","vec4",S++),O&&c.add("fragAlpha","float",S++),h&&c.add("fragEmission","vec4",S++),p.include(a),p.include(f),p.include(u,g),p.include(m,g),v&&p.include(e),p.code.add(t`
2
+ import{isColor as o,isOITColorAlpha as i,isOITFrontFace as l}from"../core/shaderLibrary/ShaderOutput.js";import{getEmissions as r}from"../core/shaderLibrary/output/getEmissions.glsl.js";import{OutputHighlight as s}from"../core/shaderLibrary/output/OutputHighlight.glsl.js";import{ColorConversion as a}from"../core/shaderLibrary/util/ColorConversion.glsl.js";import{emissionFilter as e}from"../core/shaderLibrary/util/emissionFilter.glsl.js";import{If as n,glsl as t}from"../core/shaderModules/glsl.js";import{alphaCutoff as f}from"./alphaCutoff.glsl.js";import{ditherNoise as m}from"./ditherNoise.glsl.js";import{floatBlendScale as u}from"./floatBlendScale.glsl.js";function d(d,g){d.include(s,g),d.include(r,g);const{fragment:p,outputs:c}=d;p.include(a);const{output:C,hasEmission:h,oitPremultipliedAlpha:b,snowCover:E,emissionDimmingPass:v,renderOccluded:y}=g,j=11===C,O=i(C),$=l(C),A=o(C)&&!O,S=0!==C||y;let L=0;(A||O)&&c.add("fragColor","vec4",L++),O&&c.add("fragAlpha","float",L++),h&&c.add("fragEmission","vec4",L++),p.include(a),p.include(f),p.include(u,g),p.include(m,g),v&&p.include(e),p.code.add(t`
3
3
  void outputColorHighlightOLID(vec4 finalColor, vec3 emissiveSymbolColor ${n(E,", float snow")}) {
4
4
  ${n(j,"finalColor.a = 1.0;")}
5
- ${n(L,"if (finalColor.a < alphaCutoff) discard;")}
5
+ ${n(S,"if (finalColor.a < alphaCutoff) discard;")}
6
6
 
7
7
  ${n(O,`float noise = ditherNoise(finalColor);\n fragColor = ${n(b,"finalColor","premultiplyAlpha(finalColor)")};\n fragColor.rgb = fragColor.rgb * floatBlendOutputScale + noise;\n fragAlpha = finalColor.a * floatBlendOutputScale + noise;\n `)}
8
8
  ${n($&&b,"finalColor.rgb /= finalColor.a;")}
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{subclass as r}from"../../../../core/accessorSupport/decorators.js";import{ReloadableShader as s}from"../core/shaderTechnique/ReloadableShader.js";import{ShaderTechnique as i}from"../core/shaderTechnique/ShaderTechnique.js";import{b as o}from"../../../../chunks/Viewshed.glsl.js";import{makePipelineState as t,unpremultipliedAlphaToPremultipliedAlpha as n,defaultColorWrite as c}from"../../../webgl/renderState.js";let d=class extends i{constructor(){super(...arguments),this.shader=new s(o,()=>import("./Viewshed.glsl.js"))}initializePipeline(){return t({colorWrite:c,blending:n})}};d=e([r("esri.views.3d.webgl-engine.shaders.ViewshedTechnique")],d);export{d as ViewshedTechnique};
2
+ import{__decorate as e}from"tslib";import{subclass as r}from"../../../../core/accessorSupport/decorators.js";import{ReloadableShader as s}from"../core/shaderTechnique/ReloadableShader.js";import{ShaderTechnique as i}from"../core/shaderTechnique/ShaderTechnique.js";import{b as o}from"../../../../chunks/Viewshed.glsl.js";import{makePipelineState as t,premultipliedAlpha as n,defaultColorWrite as c}from"../../../webgl/renderState.js";let d=class extends i{constructor(){super(...arguments),this.shader=new s(o,()=>import("./Viewshed.glsl.js"))}initializePipeline(){return t({colorWrite:c,blending:n})}};d=e([r("esri.views.3d.webgl-engine.shaders.ViewshedTechnique")],d);export{d as ViewshedTechnique};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as t}from"tslib";import{parameter as o,ShaderTechniqueConfiguration as a}from"../core/shaderTechnique/ShaderTechniqueConfiguration.js";class n extends a{constructor(){super(...arguments),this.useFloatBlend=!0}}t([o()],n.prototype,"useFloatBlend",void 0);const e=16,l=e;function s(t,o){o.useFloatBlend?(t.constants.add("floatBlendOutputScale","float",1),t.constants.add("floatBlendInputScale","float",1)):(t.constants.add("floatBlendOutputScale","float",1/e),t.constants.add("floatBlendInputScale","float",e)),t.constants.add("maxEmissiveStrength","float",l)}export{n as OITResolutionConfiguration,e as floatBlendReductionFactor,s as oitResolution};
2
+ import{__decorate as t}from"tslib";import{parameter as o,ShaderTechniqueConfiguration as a}from"../core/shaderTechnique/ShaderTechniqueConfiguration.js";class n extends a{constructor(){super(...arguments),this.useFloatBlend=!0}}t([o()],n.prototype,"useFloatBlend",void 0);const e=16,l=e;function s(t,o){o.useFloatBlend?(t.constants.add("floatBlendOutputScale","float",1),t.constants.add("floatBlendInputScale","float",1)):(t.constants.add("floatBlendOutputScale","float",1/e),t.constants.add("floatBlendInputScale","float",e)),t.constants.add("maxEmissiveStrength","float",l)}export{n as FloatBlendScaleConfiguration,e as floatBlendReductionFactor,s as floatBlendScale};