@arcgis/core 5.1.0-next.54 → 5.1.0-next.55

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 (190) hide show
  1. package/analysis/VolumeMeasurement/volumeMeasurementConfiguration.js +1 -1
  2. package/applications/Components/navigationDuration.d.ts +15 -0
  3. package/applications/Components/navigationDuration.js +2 -0
  4. package/assets/esri/core/workers/RemoteClient.js +1 -1
  5. package/assets/esri/core/workers/chunks/05bc675c029ed311427f.js +1 -0
  6. package/assets/esri/core/workers/chunks/{123e15c9e068a053d54e.js → 05d25a98c54679233902.js} +1 -1
  7. package/assets/esri/core/workers/chunks/{16a46688df5fad5cf8d5.js → 0b4a2361b9f9a6c0b8a7.js} +1 -1
  8. package/assets/esri/core/workers/chunks/{1fdd736c4932655ff1d9.js → 0e88e61d89f89994c4bf.js} +1 -1
  9. package/assets/esri/core/workers/chunks/0f2ab57e4eb722b3b0c0.js +1 -0
  10. package/assets/esri/core/workers/chunks/{ce59ec4f0cfbdf780bcb.js → 1f91280032aa42b1585b.js} +1 -1
  11. package/assets/esri/core/workers/chunks/254898b41cabe313b6ce.js +1 -0
  12. package/assets/esri/core/workers/chunks/26cafd20c8d03c274389.js +1 -0
  13. package/assets/esri/core/workers/chunks/{a69f1879735a031f62e9.js → 2a2d5f9ea42cb2eee9c6.js} +1 -1
  14. package/assets/esri/core/workers/chunks/{c03190faca955bffc8c1.js → 2bc6edeb3156d241677b.js} +1 -1
  15. package/assets/esri/core/workers/chunks/{d587b7842091affdaac3.js → 3158a3487d3e8a61b680.js} +1 -1
  16. package/assets/esri/core/workers/chunks/{07e791530677f7e70f32.js → 3a2ecb883fdb5c598544.js} +2 -2
  17. package/assets/esri/core/workers/chunks/{d7456829e404874a9e2f.js → 3e0752a81a7247c567ab.js} +1 -1
  18. package/assets/esri/core/workers/chunks/{fcda652fb5262696d59c.js → 3ef740d25dc17bef11b2.js} +1 -1
  19. package/assets/esri/core/workers/chunks/{2304f7b8173cf86dd805.js → 457bbf27e9bc18132464.js} +1 -1
  20. package/assets/esri/core/workers/chunks/45eddf3918973fa8d751.js +1 -0
  21. package/assets/esri/core/workers/chunks/4a6186001323b47c23a4.js +1 -0
  22. package/assets/esri/core/workers/chunks/{0b79630ad435a7734104.js → 4b3622fc355fd2fd8678.js} +1 -1
  23. package/assets/esri/core/workers/chunks/{193775b3b7de8f5dc578.js → 4fb718174c6e07d752e0.js} +1 -1
  24. package/assets/esri/core/workers/chunks/{cd14b6157862f33ab116.js → 5143f74f1fe7533a6069.js} +1 -1
  25. package/assets/esri/core/workers/chunks/{36425d29aaa5852cb41d.js → 522bc1d79dbe957301e4.js} +1 -1
  26. package/assets/esri/core/workers/chunks/{f80f04657762666b9165.js → 52dbfd7519555028a8af.js} +1 -1
  27. package/assets/esri/core/workers/chunks/{f4472e3486fdc33abb9a.js → 56bce3a6701f8549606b.js} +1 -1
  28. package/assets/esri/core/workers/chunks/572fcd33ae3648ed4f9c.js +1 -0
  29. package/assets/esri/core/workers/chunks/{d6f1ed8d8f76a32bc81d.js → 576a1784e93c5406e657.js} +1 -1
  30. package/assets/esri/core/workers/chunks/{ddc7956d80498518551e.js → 5a1d975b3e9e6b7eff67.js} +1 -1
  31. package/assets/esri/core/workers/chunks/5a83ea967ecde01d5622.js +1 -0
  32. package/assets/esri/core/workers/chunks/{4c38af9ae023fde2b5cd.js → 5aff2d6ae0d2a2d92ecc.js} +1 -1
  33. package/assets/esri/core/workers/chunks/5eb9fdb076488de9cd83.js +1 -0
  34. package/assets/esri/core/workers/chunks/{b59f03c64e4965d87291.js → 66fc3c4d6c54eee231b9.js} +1 -1
  35. package/assets/esri/core/workers/chunks/{de359f89e03da18999fc.js → 691d0a60354b6458b9de.js} +1 -1
  36. package/assets/esri/core/workers/chunks/{d44217de4c73475f9c66.js → 73a045061e69a22b6869.js} +1 -1
  37. package/assets/esri/core/workers/chunks/76064c2c801da55cd844.js +1 -0
  38. package/assets/esri/core/workers/chunks/770880ad43f252962017.js +1 -0
  39. package/assets/esri/core/workers/chunks/{52c90975cf22add7ee2b.js → 78cb6b9ab32abdd1d530.js} +1 -1
  40. package/assets/esri/core/workers/chunks/{11fed97adc9bca0f95e9.js → 7b6e3cc086d13da770fa.js} +1 -1
  41. package/assets/esri/core/workers/chunks/{d69cdee402ba4fc3735f.js → 7ed2aa1092c0a2c839c0.js} +1 -1
  42. package/assets/esri/core/workers/chunks/{097c037705ab485372ee.js → 83113a9e284701d053b5.js} +1 -1
  43. package/assets/esri/core/workers/chunks/8418ad9ad7b6481ebe82.js +1 -0
  44. package/assets/esri/core/workers/chunks/{173d94e162b210dee0a2.js → 85c72d9fa533552a6e8a.js} +1 -1
  45. package/assets/esri/core/workers/chunks/{5d202f60891fcae7174d.js → 861a7d0e665add901e11.js} +1 -1
  46. package/assets/esri/core/workers/chunks/{16ed8c0af8bb8b400163.js → 87077f4cbca13e030411.js} +1 -1
  47. package/assets/esri/core/workers/chunks/{199f70c0373f6008a545.js → 8df0c154bb0d79a905c0.js} +1 -1
  48. package/assets/esri/core/workers/chunks/{0f4759efc0982fb0ea03.js → 9066f095f16448c0a04e.js} +1 -1
  49. package/assets/esri/core/workers/chunks/91718795fc4ca6516ac7.js +1 -0
  50. package/assets/esri/core/workers/chunks/{796d27d1bbb2eed53cbd.js → 9321f5ec514805307219.js} +1 -1
  51. package/assets/esri/core/workers/chunks/{57dc80942e51dedd8335.js → 93d1118f7a909d123b40.js} +1 -1
  52. package/assets/esri/core/workers/chunks/{e6220c1fa887e21ffbbd.js → 9a235c92f21df2c17aa8.js} +1 -1
  53. package/assets/esri/core/workers/chunks/{6666ef3fd6ce877a4509.js → 9d11e7972bc298cb94ce.js} +1 -1
  54. package/assets/esri/core/workers/chunks/a11f05ddd8314b648f76.js +1 -0
  55. package/assets/esri/core/workers/chunks/{d4961d307651431328a8.js → a256edc8337e462f80f0.js} +1 -1
  56. package/assets/esri/core/workers/chunks/{2714ec856c2b3223425b.js → a41fabf8b2cf15b7d0c9.js} +1 -1
  57. package/assets/esri/core/workers/chunks/{e2d1d9929ed7744785a1.js → a7a553e245ba011d259f.js} +1 -1
  58. package/assets/esri/core/workers/chunks/{7ef1c1f765b6d423e474.js → a9eb90b901e64e67b7a3.js} +1 -1
  59. package/assets/esri/core/workers/chunks/{21decfc1e477fb769204.js → aa7aaeae31ddb259e55e.js} +1 -1
  60. package/assets/esri/core/workers/chunks/{a7b315a660f0f4e1d197.js → ad1946c084219bb678a0.js} +1 -1
  61. package/assets/esri/core/workers/chunks/b056b4c79bcd542dd1d2.js +1 -0
  62. package/assets/esri/core/workers/chunks/{bae1d6dd2376dff271e8.js → b1a0a7cdaf50f98adb3e.js} +1 -1
  63. package/assets/esri/core/workers/chunks/{c1ad062ccc1817cbee4c.js → b20f4c82d0b44fdb4670.js} +1 -1
  64. package/assets/esri/core/workers/chunks/{1a1e57267306c07e5bdb.js → b3f0600729227b458a75.js} +1 -1
  65. package/assets/esri/core/workers/chunks/{16f5cd740321a3539bf1.js → bacc343a79828e456de7.js} +1 -1
  66. package/assets/esri/core/workers/chunks/{e23fc5853e2f4016936b.js → c250799c131aa4ed2c35.js} +1 -1
  67. package/assets/esri/core/workers/chunks/{a495e60996a36ce19a32.js → c4da2ca1dee0c44051d0.js} +1 -1
  68. package/assets/esri/core/workers/chunks/{be60a6e210186ff09ae2.js → c6149e0ac1c103e03baf.js} +1 -1
  69. package/assets/esri/core/workers/chunks/c69fefe9d51ac7c2b0a6.js +1 -0
  70. package/assets/esri/core/workers/chunks/{bbb9659f79511c2c4690.js → c91d39e8e14be3d8bdf5.js} +1 -1
  71. package/assets/esri/core/workers/chunks/{c93454e37ae0f124bcb0.js → c9c5e6996f36ec4b1558.js} +1 -1
  72. package/assets/esri/core/workers/chunks/{4c8c69d081ed37bf5bc5.js → cd391415b8b8320e12e4.js} +1 -1
  73. package/assets/esri/core/workers/chunks/d3b3e8c6d7096bc59489.js +1 -0
  74. package/assets/esri/core/workers/chunks/{bad82ce3f84f7efb7ab7.js → da2a10e72a315c3c1f82.js} +1 -1
  75. package/assets/esri/core/workers/chunks/de79645e559a2d1ffa67.js +1 -0
  76. package/assets/esri/core/workers/chunks/{8569ae372fc64641b6b1.js → e2e3c39876bbe019c57a.js} +1 -1
  77. package/assets/esri/core/workers/chunks/{d31e68e73527c88b8276.js → e7e565e7c0ce1464c6b0.js} +1 -1
  78. package/assets/esri/core/workers/chunks/{f3f26f6116ab9126c2e7.js → e8a23ae30d586e3a973c.js} +1 -1
  79. package/assets/esri/core/workers/chunks/{d1aa1d51662f4a01e793.js → ea068f75397c3b3337ec.js} +3 -3
  80. package/assets/esri/core/workers/chunks/{c09bc36347e8eb9fff00.js → f09446b9ff937a84d6d3.js} +1 -1
  81. package/assets/esri/core/workers/chunks/{354b309c8225336bc1e5.js → f6d047358d14328f3622.js} +1 -1
  82. package/assets/esri/core/workers/chunks/{b43889ed9737c27e89f1.js → fb9a889ec9fd23739a14.js} +1 -1
  83. package/assets/esri/core/workers/chunks/{b2a67fe89f6505498bc3.js → fe1b67ab7748a3aef231.js} +1 -1
  84. package/assets/esri/themes/base/_Ui.scss +3 -3
  85. package/assets/esri/themes/base/_mixins.scss +2 -2
  86. package/assets/esri/themes/base/widgets/_Attachments.scss +3 -3
  87. package/assets/esri/themes/base/widgets/_BasemapGallery.scss +8 -8
  88. package/assets/esri/themes/base/widgets/_BasemapToggle.scss +1 -1
  89. package/assets/esri/themes/base/widgets/_BuildingExplorer.scss +1 -1
  90. package/assets/esri/themes/base/widgets/_BuildingLevelPicker.scss +4 -4
  91. package/assets/esri/themes/base/widgets/_BuildingPhasePicker.scss +1 -1
  92. package/assets/esri/themes/base/widgets/_CoordinateConversion.scss +2 -2
  93. package/assets/esri/themes/base/widgets/_DatePicker.scss +4 -4
  94. package/assets/esri/themes/base/widgets/_Daylight.scss +1 -1
  95. package/assets/esri/themes/base/widgets/_Editor.scss +2 -2
  96. package/assets/esri/themes/base/widgets/_ElevationProfile.scss +2 -2
  97. package/assets/esri/themes/base/widgets/_FeatureMedia.scss +1 -1
  98. package/assets/esri/themes/base/widgets/_FeatureTable.scss +1 -1
  99. package/assets/esri/themes/base/widgets/_FloorFilter.scss +2 -2
  100. package/assets/esri/themes/base/widgets/_Grid.scss +1 -1
  101. package/assets/esri/themes/base/widgets/_GridControls.scss +1 -1
  102. package/assets/esri/themes/base/widgets/_ItemList.scss +1 -1
  103. package/assets/esri/themes/base/widgets/_Legend.scss +1 -1
  104. package/assets/esri/themes/base/widgets/_LineOfSight.scss +1 -1
  105. package/assets/esri/themes/base/widgets/_OrientedImageryViewer.scss +1 -1
  106. package/assets/esri/themes/base/widgets/_OrientedImageryViewerNavigationUI.scss +3 -3
  107. package/assets/esri/themes/base/widgets/_Popup.scss +1 -1
  108. package/assets/esri/themes/base/widgets/_Print.scss +3 -3
  109. package/assets/esri/themes/base/widgets/_Sketch.scss +1 -1
  110. package/assets/esri/themes/base/widgets/_Slice.scss +1 -1
  111. package/assets/esri/themes/base/widgets/_Slider.scss +3 -3
  112. package/assets/esri/themes/base/widgets/_SnappingControls.scss +2 -2
  113. package/assets/esri/themes/base/widgets/_Spinner.scss +2 -2
  114. package/assets/esri/themes/base/widgets/_Swipe.scss +2 -2
  115. package/assets/esri/themes/base/widgets/_Tooltip.scss +2 -2
  116. package/assets/esri/themes/base/widgets/_UtilityNetworkTrace.scss +1 -1
  117. package/assets/esri/themes/base/widgets/_VideoPlayer.scss +2 -2
  118. package/assets/esri/themes/base/widgets/_Widget.scss +8 -8
  119. package/assets/esri/themes/dark/main.css +1 -1
  120. package/assets/esri/themes/light/main.css +1 -1
  121. package/assets/esri/themes/light/view.css +1 -1
  122. package/chunks/CutFillComposition.glsl.js +10 -4
  123. package/chunks/RibbonLine.glsl.js +75 -63
  124. package/chunks/Water.glsl.js +24 -16
  125. package/config.js +1 -1
  126. package/geometry/operators/offsetOperator.d.ts +1 -1
  127. package/geometry/operators/proximityOperator.d.ts +1 -1
  128. package/geometry/support/curves/bezierCurveUtils.js +1 -1
  129. package/geometry/support/curves/circularArcUtils.js +1 -1
  130. package/geometry/support/curves/ellipticArc4Utils.js +1 -1
  131. package/geometry/support/curves/ellipticArc7Utils.js +1 -1
  132. package/geometry/support/zscale.js +1 -1
  133. package/interfaces.d.ts +7 -0
  134. package/kernel.js +1 -1
  135. package/layers/LinkChartLayer.js +1 -1
  136. package/layers/OrientedImageryLayer.d.ts +0 -152
  137. package/layers/OrientedImageryLayer.js +1 -1
  138. package/layers/support/layerUtils.js +1 -1
  139. package/package.json +1 -1
  140. package/portal/schemas/definitions.js +1 -1
  141. package/support/revision.js +1 -1
  142. package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
  143. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillVisualization.js +1 -1
  144. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementShiftTool.js +1 -1
  145. package/views/3d/interactive/manipulators/ShiftManipulator.js +1 -1
  146. package/views/3d/layers/GaussianSplatLayerView3D.js +1 -1
  147. package/views/3d/layers/graphics/Graphics3DLineSymbolLayer.js +1 -1
  148. package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.js +1 -1
  149. package/views/3d/layers/graphics/lineUtils.js +1 -1
  150. package/views/3d/support/gaussianSplatting/GaussianSplatDataStore.js +1 -1
  151. package/views/3d/support/gaussianSplatting/GaussianSplatFadeHelper.js +1 -1
  152. package/views/3d/support/gaussianSplatting/GaussianTile.js +1 -1
  153. package/views/3d/terrain/TerrainRenderer.js +1 -1
  154. package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
  155. package/views/3d/webgl-engine/core/shaderLibrary/ShaderOutput.js +1 -1
  156. package/views/3d/webgl-engine/core/shaderTechnique/ShaderTechniqueRepository.js +1 -1
  157. package/views/3d/webgl-engine/lib/BindParameters.js +1 -1
  158. package/views/3d/webgl-engine/lib/CutFillComputationRenderNode.js +1 -1
  159. package/views/3d/webgl-engine/lib/CutFillVisualizationRenderNode.js +1 -1
  160. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  161. package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
  162. package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
  163. package/views/3d/webgl-engine/materials/PolygonOffset.js +1 -1
  164. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  165. package/views/3d/webgl-engine/materials/Water.glsl.js +1 -1
  166. package/views/3d/webgl-engine/materials/WaterMaterial.js +1 -1
  167. package/views/3d/webgl-engine/shaders/RibbonLineTechnique.js +1 -1
  168. package/views/3d/webgl-engine/shaders/RibbonLineTechniqueConfiguration.js +1 -1
  169. package/views/3d/webgl.js +1 -1
  170. package/views/draw/plugins/TangentArcSegmentPlugin.js +2 -0
  171. package/views/webgl/checkWebGLError.js +1 -1
  172. package/widgets/Sketch/support/PluginManager.js +1 -1
  173. package/assets/esri/core/workers/chunks/0ab19ad980fda1cf402a.js +0 -1
  174. package/assets/esri/core/workers/chunks/1cce2f8837ad765acf44.js +0 -1
  175. package/assets/esri/core/workers/chunks/20f9f3470cad47d01803.js +0 -1
  176. package/assets/esri/core/workers/chunks/23a9070e9362b8439770.js +0 -1
  177. package/assets/esri/core/workers/chunks/28ac3a75130fe2b57ac7.js +0 -1
  178. package/assets/esri/core/workers/chunks/36a0e48113ab59a4f21d.js +0 -1
  179. package/assets/esri/core/workers/chunks/440a650ed0867a16f559.js +0 -1
  180. package/assets/esri/core/workers/chunks/440f76c397a813b0dcf9.js +0 -1
  181. package/assets/esri/core/workers/chunks/5344919fc6e8050450f1.js +0 -1
  182. package/assets/esri/core/workers/chunks/5e9bd5ed6ecee5b15127.js +0 -1
  183. package/assets/esri/core/workers/chunks/64845b1f53eca9db1229.js +0 -1
  184. package/assets/esri/core/workers/chunks/7278cc37e85f0242f19b.js +0 -1
  185. package/assets/esri/core/workers/chunks/7d56b2ac5030dd8b748e.js +0 -1
  186. package/assets/esri/core/workers/chunks/96e799ca97989a6ed448.js +0 -1
  187. package/assets/esri/core/workers/chunks/9db2ff1d4cbb5d1b623e.js +0 -1
  188. package/assets/esri/core/workers/chunks/ab414a60808ea05a63e6.js +0 -1
  189. package/assets/esri/core/workers/chunks/ec65c9c72507ef9a9cf9.js +0 -1
  190. package/assets/esri/core/workers/chunks/f1767b8ba82fdd9bd947.js +0 -1
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{update as t}from"../../../../core/arrayUtils.js";import{createTask as r}from"../../../../core/asyncUtils.js";import"../../../../core/has.js";import{removeMaybe as s,abortMaybe as i,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 _,initial as l,sync as u}from"../../../../core/reactiveUtils.js";import{signal as m}from"../../../../core/signal.js";import{property as p,subclass as c}from"../../../../core/accessorSupport/decorators.js";import{equals as f,invert as g,multiply as b}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as P,create as T}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as w}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{fromValues as E,ZEROS as A}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{pruneIndexArrays as C}from"../../../../geometry/support/Indices.js";import{RenderNodeOutput as R,InternalRenderCategory as D,AllRenderNodeOutputs as S,AllInternalRenderNodeOutputs as I}from"../../webgl.js";import{minNearDistanceInMeters as O}from"../../state/NearFarHeuristic.js";import{debugFlags as x}from"../../support/debugFlags.js";import"../../webgl/ManagedDepthAttachment.js";import{FBOCache as y}from"../core/FBOCache.js";import{RenderPassManager as F}from"../core/renderPasses/RenderPassManager.js";import{isColor as N}from"../core/shaderLibrary/ShaderOutput.js";import{distanceFadeEnd as v}from"../core/shaderLibrary/shading/ScreenSpaceConstants.js";import{hasOit8Bit as H,hasEmissive8Bit as M}from"../effects/fboFormatUtils.js";import{RenderNodes as q}from"../effects/RenderNodes.js";import{RenderPluginManager as G}from"../effects/RenderPluginManager.js";import{WeatherFader as L}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 z}from"./AnimationTimeStep.js";import{BoundingInfo as Q}from"./BoundingInfo.js";import{Compositor as Y}from"./Compositor.js";import{DepthRange as $}from"./DepthRange.js";import{depthRangeFromScene as J}from"./depthRangeUtils.js";import{MainFramebuffer as K}from"./MainFramebuffer.js";import{RenderContext as Z,defaultRenderOccludedMask as X}from"./RenderContext.js";import{RendererBase as ee}from"./RendererBase.js";import{setupFeatureDefaults as te}from"./RenderFeature.js";import{RenderPluginInput as re}from"./RenderPluginInput.js";import{ShadowAccumulator as se}from"./ShadowAccumulator.js";import{ShadowMap as ie}from"./ShadowMap.js";import ae from"./SliceHelper.js";import{MergedRenderer as ne}from"../materials/renderers/MergedRenderer.js";import{RenderSceneResult as he}from"../parts/renderUtils.js";import{RendererPerformanceInfo as oe,PerformanceCategory as de}from"../statistics/RendererPerformanceInfo.js";import{PixelType as _e,ColorAttachment1 as le,ColorAttachment2 as ue,ColorAttachment0 as me}from"../../../webgl/enums.js";let pe=class extends ee{constructor(e,t,r,s,i){super({stage:e}),this._techniques=r,this._rctx=s,this._requestRender=i,this._pluginsHas={occludedHudElements:!1,hudElements:!1,water:!1},this.renderPassManager=new F,this._isRendering=!1,this._inGlobeView=!1,this._backgroundColor=E(0,0,0,1),this._sliceHelper=new ae,this.sceneDepthRange=m($.Infinite),this._state=m(2),this._hasOit8Bit=H(),this._hasEmissive8Bit=M(),this._hasAnimations=!1,this._animationTimestep=new z,this._loadEdgeViewTask=null,this._edgeViewCallbacks=[],this._reprojectionMatrixVersion=m(0),this._renderHiddenTransparentEdges=()=>{},this._pluginInput=new re,this._hasTransparentGeometry=!1,this._oitCallouts=!1,this._releaseNodeInputs=e=>{for(const t of De)e.some(({name:e})=>e===t)&&this._pluginInput.release(t)},this._testsNeedsDepth=!1,this._fboCache=new y(s),this._compositor=new Y(s,r),this._renderStateFeatures=m(te(e.view.qualityProfile));const a=new ie(this._fboCache,e.viewingMode);this._renderContext=new Z(this._rctx,a,r),this._framebuffer=new K(this._fboCache,this._bindParameters),this._performanceInfo=new oe(this._rctx),this._blit=new U(r),this._shadowAccumulator=new se(this.fboCache,r,e,e=>{const t=this.shadowsEnabled;a.enabled=!0,this._ensureBindParametersCamera(e.camera,e.contentCamera),this._plugins.prepareRender(),a.enabled=t},(t,r,s)=>{const i=e.view.qualitySettings.maximumPixelRatio;t.shadowMap.start(t.camera,r,s,!0,i),this._renderShadowCascades(5,t.shadowMap),t.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(t.camera,t.contentCamera)},i),this._nodes=new q(this._renderContext),this._plugins=new G({renderContext:this._renderContext,techniques:r,materials:t,requestRender:i,controller:e}),this._plugins.add(this.renderPassManager),this.weatherFader=new L({view:e.view,context:this._renderContext}),this.addHandles([d(()=>e.view.state.camera,()=>i(),_),d(()=>x.EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES,e=>{this._renderHiddenTransparentEdges=e?()=>this._renderEdges(0):()=>{},i()},l),d(()=>e.view.environment.background?.color,e=>{const t=e?e.toUnitRGBA():A;w(this._backgroundColor,t[0]*t[3],t[1]*t[3],t[2]*t[3],t[3]),i()},_),d(()=>e.view.state.camera.relativeElevation,e=>this._inGlobeView=(e??1/0)>=v,_),d(()=>this._bindParameters.clouds.fadeFactor,()=>{this._bindParameters.fadeLighting(),this._requestRender(2)},u),d(()=>this._bindParameters.clouds.data?.state,()=>i(),u),d(()=>e.view.state.highlights,e=>{this._bindParameters.highlights=e,i()},l),d(()=>"sun"===e.view.environment.lighting?.type,e=>{this._bindParameters.enableFillLights=e,this._requestRender()},_)])}destroy(){this._gpuTimerHandle=s(this._gpuTimerHandle),this._nodes.destroy(),this._framebuffer.dispose(),this._shadowAccumulator.destroy(),this._shadowAccumulator=null,this._loadEdgeViewTask=i(this._loadEdgeViewTask),this._edgeView=a(this._edgeView),this.renderPassManager.dispose(),this.weatherFader=a(this.weatherFader),this._releaseFBOs(),this._disposeOffscreenBuffers(),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,Q.prune(),ne.prune(),C()}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=te(e),this._requestRender()}isFeatureEnabled(e,t=this._state.value){return this._renderStateFeatures.value.get(t,e)??!1}setFeatureEnabled(e,t,r){this._renderStateFeatures.mutate(s=>s.set(t,e,r)),this._requestRender()}get _highQualityTransparency(){return this.isFeatureEnabled(1)}get hasReflections(){return this._pluginsHas.water&&this.isFeatureEnabled(5)}get _hasHighlights(){return this._plugins.produces(10,2,4,19,13,14,15)}hasHighlight(e){return this._plugins.hasHighlight(e)}get _hasHUDHighlights(){return this._plugins.produces(10,13,14,15)}get hasSSAO(){return this.isFeatureEnabled(4)&&!this._inGlobeView}get hasSMAA(){return this.isFeatureEnabled(0)}get _hasEmission(){return this._plugins.hasEmitters&&(this._hasEmissive8Bit||this.hasFloatBlend)}get hasFloatBlend(){return this._rctx.driverTest.floatBufferBlend.result&&this.isFeatureEnabled(10)}get oitEnabled(){return this.hasFloatBlend||this._hasOit8Bit}get highResolutionAtmosphere(){return this.isFeatureEnabled(3)}get fboCache(){return this._fboCache}_releaseFBOs(){this._bindParameters.terrainDepth=n(this._bindParameters.terrainDepth),this._bindParameters.geometryDepth=n(this._bindParameters.geometryDepth),this._bindParameters.hudOcclusion=n(this._bindParameters.hudOcclusion),this._bindParameters.depth=null}_disposeOffscreenBuffers(){this._framebuffer.dispose(),this._disposeBindBuffers()}_disposeBindBuffers(){this._bindParameters.shadowMap.disposeOutputs()}get updating(){return this._loadEdgeViewTask&&!this._loadEdgeViewTask.finished||this._edgeView?.updating||this._shadowAccumulator.readyToRun||this._plugins.updating||this.weatherFader?.readyToRun||!this.isCameraFinal}loadEdgeView(){return this._loadEdgeViewTask||(this._loadEdgeViewTask=r(async e=>{const{EdgeView:t}=await import("./edgeRendering/EdgeView.js");o(e);const r=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:xe(this.stage.view.resourceController)});return this.addHandles(d(()=>r.updating,()=>this._requestRender(),u)),this._requestRender(),this._edgeViewCallbacks.forEach(e=>e(r)),this._edgeViewCallbacks.length=0,r})),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,P)}set _reprojectionMatrix(e){t(this._bindParameters.reprojection.matrix,e)&&this._reprojectionMatrixVersion.value++}get shadowsEnabled(){return!!this._bindParameters.shadowMap.enabled}setParameters(e){void 0!==e.shadowMap&&this._bindParameters.shadowMap.enabled!==e.shadowMap&&(this._bindParameters.shadowMap.enabled=e.shadowMap,this._requestRender()),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)}rendererAdded(e){this._plugins.add(e)}rendererRemoved(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,10)}updateHasFlags(){const has=this._pluginsHas;has.occludedHudElements=this._plugins.produces(0,14),has.hudElements=has.occludedHudElements||this._plugins.produces(0,...we),has.water=this._plugins.produces(4,20),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 r=this._hasAnimations;return this._hasAnimations=this._plugins.updateAnimation(this._animationTimer),this._hasAnimations=this._nodes.updateAnimation(this._animationTimer)||this._hasAnimations,this._hasAnimations!==r&&(this._gpuTimerHandle=r?s(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,r,s=!1){try{return this._isRendering=!0,this._render(e,t,r,s)}catch(i){console.error(`Exception during rendering: ${i}:\n${i.stack}`)}finally{this._isRendering=!1}return new he(this._pluginInput.get(R.FINAL),null)}_render(e,t,r,s){const i=0===r;this.performanceInfo.startFrame(),this.fboCache.frameStart(),this.fboCache.interactive=i,this._disposeBindBuffers();const{camera:a,contentCamera:o,mode:d,alignPixelEnabled:_}=e;this._state.value=d,this._renderContext.time=t,this._bindParameters.output=0,this._bindParameters.hasEmission=this._hasEmission,this._bindParameters.alignPixelEnabled=_,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(D.VIEWSHED),this._bindParameters.cutFillEnabled=this._nodes.produces(D.CUTFILL_COMPUTATION),this._renderOverlay(),a.setGLViewport(this._rctx);const u=this._framebuffer,m=u.initialize(a.fullWidth,a.fullHeight,this._backgroundColor);this.hasReflections?(m?.setName("last frame color"),this._bindParameters.reprojection.lastFrameColor=m):m?.release(),this._ensureBindParametersCamera(a,o),this._ensureBindParametersWeatherFader(this._renderContext.time),this._plugins.sortTestsTransparentOrderedSlots(Ae),this._plugins.prepareRender(),this._bindParameters.hasShadowHighlights=this._needsShadowHighlight&&!s,this._hasTransparentGeometry=this._plugins.produces(0,...fe),this._precompilePrepasses(),this.performanceInfo.advance(de.PREPARE);const p=this._computeShadowDepthRange(a);this._renderShadowMap(a,this._bindParameters.lighting.mainLight.direction,p),this._pluginInput.set("normals",this._renderNormals()),this._renderAmbientIlluminationAndDepth(),this._renderShadowAccumulation(p,!i),this._oitCallouts=this._hasTransparentGeometry&&this.oitEnabled,this._ensureBindParametersSSR(t),u.bind(),this._bindParameters.mainDepth=u.depth.attachment,this._precompileShaders(),this._bindParameters.output=0,this._renderOpaque(),this._renderTransparent(),this._bindParameters.reprojection.lastFrameColor=n(this._bindParameters.reprojection.lastFrameColor),this.hasReflections&&(this._bindParameters.depth=h(this._bindParameters.depth)),this._bindParameters.shadowMap.disposeOutput(5),this._renderCutFillComputation(),this._pluginInput.set(D.FOCUSAREA,this._renderFocusAreaGeometry()),u.update(e=>this._renderNodes(D.TRANSPARENT_ENVIRONMENT,e)),u.update(e=>this._renderNodes(D.VIEWSHED,e)),u.update(e=>this._renderNodes(D.LASERLINES,e)),this._nodes.requireGeometryDepth&&(this._bindParameters.depth=h(this._bindParameters.depth)),u.update(e=>this._renderNodes(D.FOCUSAREA_COLOR,e)),this._pluginInput.release(D.FOCUSAREA),u.update(e=>this._renderNodes(D.OCCLUDED,e)),this._pluginInput.set("highlights",this._renderHighlightPrepass());const c=2===r?this._renderObjectAndLayerIdColor():null;u.update(e=>this._renderNodes(R.COMPOSITE,e)),this._bindParameters.shadowMap.disposeOutputs(),u.update(e=>this._renderNodes(D.ANTIALIASING,e));const f=this._hasPhotoshopTerrain||!this._hasTransparentGeometry?1:2;let g;return this._bindParameters.hasEmission=!1,this._hasHUDHighlights&&u.update(e=>this._renderHUD(f,e)),u.update(e=>this._renderNodes(D.HIGHLIGHT_COLOR,e)),this._hasHUDHighlights||u.update(e=>this._renderHUD(f,e)),this._bindParameters.hasEmission=this._hasEmission,u.update(e=>this._renderNodes(D.MAGNIFIER,e)),u.update(e=>this._renderNodes(R.FINAL,e)),i&&this._blit.toFramebuffer(this._rctx,u.color,this._bindParameters),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 he(g,c)}_precompileShaders(){++this._plugins.context.techniques.precompiling,this._bindParameters.output=0;const e=this._bindParameters.hasEmission;this._precompileOpaqueGeometry(),this._nodes.precompile(e,D.OPAQUE_ENVIRONMENT,D.PRE_TRANSPARENT);const t=this._bindParameters;if(t.terrainDepthTest=t.cullAboveTerrain=this._needsTerrainDepth,this._bindParameters.output=3,this._plugins.precompile(...ge),this._needsDepth&&(this._precompileOpaqueGeometry(),this._precompileTransparentGeometry()),this._bindParameters.output=0,this._plugins.precompile(...ge),this._hasTransparentGeometry){const e=this._pluginsHas.occludedHudElements;this._oitBlend.precompile(this._bindParameters,e,0),this._pluginsHas.hudElements&&this._oitBlend.precompile(this._bindParameters,!1,1)}this._hasTransparentGeometry&&(this._precompileTransparentGeometry(),this._hasPhotoshopTerrain&&(t.cullAboveTerrain=!1,this._precompileTransparentGeometry(),t.cullAboveTerrain=this._needsTerrainDepth)),this._nodes.precompile(e,D.FOCUSAREA);const r=this._hasPhotoshopTerrain&&!this._needsTerrainDepth;this._compositor.precompile(this._usesPremultipliedAlphaBlit,!!this._needsEdges,r,e),this._oitCallouts||this._plugins.precompile(16),t.terrainDepthTest=t.cullAboveTerrain=!1,this._nodes.precompile(e,D.TRANSPARENT_ENVIRONMENT,D.VIEWSHED,D.CUTFILL_COMPUTATION,D.LASERLINES,D.FOCUSAREA_COLOR,D.OCCLUDED,D.ANTIALIASING),t.highlightMixTexture=t.highlights.length>1?this._rctx.emptyTexture:null,this._precompileHUD(0),t.hasEmission=!1,this._precompileHUD(0),this._precompileHUD(1),t.hasEmission=this._hasEmission,this._hasHighlights&&(t.highlights.forEach((e,r)=>{t.highlightLevel=r,this._precompileAllGeometry(10),this._hasHUDHighlights&&this._plugins.precompile(14,13)}),t.highlightLevel=null,this._nodes.precompile(e,D.HIGHLIGHT_COLOR)),t.highlightMixTexture=null,this._nodes.precompile(e,R.COMPOSITE,D.MAGNIFIER),this._shadowAccumulator.precompile(),this._plugins.precompile(9),--this._plugins.context.techniques.precompiling}_renderFocusAreaGeometry(){const e=this._nodes.produce(D.FOCUSAREA,this._pluginInput);return e&&this.performanceInfo.advance(de.FOCUS_AREA_MASK),e}_renderObjectAndLayerIdColor(){if(!this._nodes.produces("olid"))return null;const e=this._bindParameters.output;++this._techniques.precompiling;const{width:t,height:r}=this._framebuffer.size;let s=this.fboCache.acquire(t,r,"olid");return s.acquireDepth(13),s=this._nodes.render(s,this._pluginInput),--this._techniques.precompiling,this.performanceInfo.advance(de.OBJECT_AND_LAYER_ID_COLOR),this._bindParameters.output=e,s}finish(e){this._hasAnimations||this._animationTimestep.clear();const t=this.performanceInfo.gpuSamplingEnabled,r=0===e;if(r||t){const e=r?this.performanceInfo.elapsedTime:0;let s=0;t?s=this.performanceInfo.totalGPUTimeSampler.last:this._rctx.gl.finish();const i=Math.max(e,s);this._animationTimestep.frame(i,r)}}readMainDepth(e,t){const{mainDepth:r,camera:s}=this._bindParameters;if(!r)return;const i=this.fboCache.acquire(this._framebuffer.size.width,this._framebuffer.size.height,"linear depth");this._rctx.bindFramebuffer(i.fbo),s.setGLViewport(this._rctx),this._rctx.setScissorRect(e[0],e[1],e[2],e[3]),this._rctx.setScissorTestEnabled(!0),this._rctx.clearFramebuffer(A),this._compositor.blitDepthToLinearDepth(this._bindParameters,r),this._rctx.setScissorTestEnabled(!1),this._rctx.setScissorRect(0,0,this._rctx.gl.canvas.width,this._rctx.gl.canvas.width),i.fbo?.readPixels(e[0],e[1],e[2],e[3],6408,_e.UNSIGNED_BYTE,t),i.release()}readAccumulatedShadow(e){return this._shadowAccumulator.readAccumulatedShadow(e[0],e[1])}get _needsEdges(){return this._edgeView?.shouldRender()?this._edgeView:null}_renderEdges(e){const t=this._needsEdges;if(!t)return;const{width:r,height:s}=this._framebuffer.size,i=this.fboCache.acquire(r,s,"edges"),a=this._bindParameters.geometryDepth,n=()=>t.render(this._bindParameters,e);this._renderToTargets(n,i,a??this._framebuffer.depth,A),this._framebuffer.bind(),this._compositor.composite(this._bindParameters,i.getTexture()),i.release(),this.performanceInfo.advance(1===e?de.OPAQUE_EDGES:de.TRANSPARENT_EDGES)}_renderOverlay(){this._bindParameters.overlay=this.overlay?.render(this._renderContext.time),this._bindParameters.overlay&&this.performanceInfo.advance(de.OVERLAY)}_renderShadowMap(e,t,r){if(!this.shadowsEnabled)return;const s=this._bindParameters.shadowMap;s.start(e,t,r,this.isFeatureEnabled(6),this.stage.view.qualitySettings.maximumPixelRatio),this._needsShadowHighlight?(this._renderShadowCascades(7,s),s.clear(),this._renderShadowCascades(6,s)):this._renderShadowCascades(5),e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,this._bindParameters.contentCamera),this.performanceInfo.advance(de.SHADOW_MAP)}_renderCutFillComputation(){this._nodes.produce(D.CUTFILL_COMPUTATION,this._pluginInput)?.release()}_precompileShadowCascades(e){0!==this._bindParameters.shadowMap.cascades.length&&this._precompileAllGeometry(e)}_renderShadowCascades(e,t=this._bindParameters.shadowMap){const r=this._bindParameters.output;t.bindFramebuffer();for(const s of t.cascades)s.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(s.camera,s.camera),this.renderAllGeometry(e);t.finish(e),this._bindParameters.output=r}get _needsDepth(){return+this._nodes.requireGeometryDepth+ +this.hasReflections+ +this._shadowAccumulator.accumulating+ +this._testsNeedsDepth}get _usesPremultipliedAlphaBlit(){return this._pluginsHas.hudElements&&this.oitEnabled||this._hasPhotoshopTerrain}_renderAmbientIlluminationAndDepth(){this._bindParameters.depth=n(this._bindParameters.depth);const e=this._pluginInput.get("normals");if(e){this._pluginInput.set(D.AMBIENT_ILLUMINATION,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(de.DEPTH)):e.detachDepth(),this.hasSSAO&&this._pluginInput.release("normals")}else this._renderAllGeometryDepth()}_renderAllGeometryDepth(){const e=this._needsDepth;if(0===e)return;const{width:t,height:r}=this._framebuffer.size,s=this.fboCache.acquire(t,r,"geometry",13);this._rctx.bindFramebuffer(s.fbo),this._rctx.clear(1280),this.renderAllGeometry(3),this._bindParameters.depth=s.obtainDepthTexture(),this._bindParameters.depth?.retain(e-1),s.release(),this.performanceInfo.advance(de.DEPTH)}_renderTerrainDepth(){if(this._bindParameters.terrainDepth=n(this._bindParameters.terrainDepth),this._bindParameters.terrainDepthTest=this._bindParameters.cullAboveTerrain=this._needsTerrainDepth,!this._needsTerrainDepth)return;const e=this._bindParameters.output;this._bindParameters.output=3;const{width:t,height:r}=this._framebuffer.size,s=this.fboCache.acquire(t,r,"terrain",13);this._rctx.bindFramebuffer(s.fbo),this._rctx.clear(1280),this._renderTransparentGround(),this._bindParameters.terrainDepth=s.obtainDepthTexture(),s.release(),this._bindParameters.output=e}_renderGeometryDepth(){if(this._bindParameters.geometryDepth=n(this._bindParameters.geometryDepth),!this._needsTerrainDepth)return;const e=this._bindParameters.output,{width:t,height:r}=this._framebuffer.size,s=this.fboCache.acquire(t,r,"geometry",13);this._rctx.bindFramebuffer(s.fbo),this._rctx.clear(1280),this._renderOpaqueAndTransparentGeometry(3),this._bindParameters.output=e,this._bindParameters.geometryDepth=s.obtainDepthTexture(),s.release()}get _needsShadowDepthRange(){return this._bindParameters.shadowMap.enabled||this._shadowAccumulator.active}_computeShadowDepthRange(e){if(!this._needsShadowDepthRange)return $.Zero;const t=J(e,this._plugins.plugins,this.stage.layers,0);return t.union(this._plugins.queryDepthRange(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=$.Infinite);if((this.stage.view.renderCoordsHelper?.getAltitude(e.eye)??0)<j)return void(this.sceneDepthRange.value=$.Infinite);const t=e.clone();t.near=O,t.far=1e10;const r=J(t,this._plugins.plugins,this.stage.layers,1);r.union(this._plugins.queryDepthRange(t)),this.sceneDepthRange.value.equals(r)||(this.sceneDepthRange.value=r)}get _normalsRequired(){const e=this._nodes.require("normals",...S,D.VIEWSHED,D.LASERLINES);return(this.hasSSAO?1:0)+e}_precompilePrepasses(){this._normalsRequired&&this._precompileAllGeometry(4),this._needsDepth&&this._precompileAllGeometry(3),this.shadowsEnabled&&(this._needsShadowHighlight?(this._precompileShadowCascades(6),this._precompileShadowCascades(7)):this._precompileShadowCascades(5)),this._shadowAccumulator.active&&this._precompileAllGeometry(5),this.hasSSAO&&this._normalsRequired&&this._nodes.precompile(this._bindParameters.hasEmission,D.AMBIENT_ILLUMINATION)}_renderNormals(){const e=this._normalsRequired;if(0===e)return;const{width:t,height:r}=this._framebuffer.size,s=this.fboCache.acquire(t,r,"normals",5);s.acquireDepth(13),this._rctx.bindFramebuffer(s.fbo),this._rctx.clearFramebuffer(A,!0,!0),this._bindParameters.output=4,this._plugins.render(...be);const i=this._nodes.optional("normals",...S,D.VIEWSHED);return s.retain(e+i-1),this.performanceInfo.advance(de.NORMALS),s}_renderSSAO(){const e=this._pluginInput.get("normals");if(this.hasSSAO&&e)return this._bindParameters.ssao=this._nodes.produce(D.AMBIENT_ILLUMINATION,this._pluginInput),this._bindParameters.ssao&&this.performanceInfo.advance(de.AMBIENT_ILLUMINATION),this._bindParameters.ssao}_precompileAllGeometry(e){const t=this._bindParameters.output;this._bindParameters.output=e,this._precompileOpaqueGeometry(),this._precompileTransparentGeometry(),this._plugins.precompile(...ge),this._bindParameters.output=t}renderAllGeometry(e){this._bindParameters.output=e,this._renderOpaqueAndTransparentGeometry(e),this._renderTransparentGround()}precompileSlots(e,...t){for(const r of t)this._bindParameters.slot=r,e.precompile(this._renderContext)}precompileOccludedSlots(e,t){for(const r of t)this._renderContext.renderOccludedMask=r,this.precompileSlots(e,...Te);this._renderContext.renderOccludedMask=X}renderSlots(e,...t){for(const r of t)this._bindParameters.slot=r,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(10),this.renderSlots(e,...Te),this._renderContext.renderOccludedMask=X}renderHUD(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(...Ce[e])}_renderHUDElements(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(17),this.renderHUD(e),this._bindParameters.hudRenderStyle=e,this._plugins.render(15)}precompileViewshedShadowMap(){this._precompileAllGeometry(8)}precompileCutFillReferenceDepth(){const e=this._bindParameters.output;this._bindParameters.output=9,this._plugins.precompile(...Re),this._bindParameters.output=e}renderViewshedShadowMap(e){const{camera:t,contentCamera:r}=this._bindParameters,s=this._bindParameters.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this.renderAllGeometry(8),this._ensureBindParametersCamera(t,r),this._bindParameters.camera.setGLViewport(this._rctx),this._bindParameters.output=s}renderCutFillReferenceDepth(e){const{camera:t,contentCamera:r}=this._bindParameters,s=this._bindParameters.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this._bindParameters.output=9,this._plugins.render(...Re),this._ensureBindParametersCamera(t,r),t.setGLViewport(this._rctx),this._bindParameters.output=s}_renderOpaqueAndTransparentGeometry(e){this._bindParameters.output=e,this._renderOpaqueGeometry(),this._renderTransparentGeometry()}_renderGeometryWithoutNormals(e){this._bindParameters.output=e,this._plugins.render(...Pe)}_precompileOpaqueGeometry(){this._needsOpaquePass&&(this._plugins.precompile(...ce),this._nodes.precompile(this._bindParameters.hasEmission,D.CUTFILL_COLOR,"opaque-color"))}_renderOpaqueGeometry(){this._plugins.render(...ce)}_renderTransparentGeometry(){this._plugins.render(...fe),this._oitCallouts&&this._plugins.render(16)}get _hasPhotoshopTerrain(){return this._plugins.produces(0,6)}get _needsTerrainDepth(){return this._highQualityTransparency&&this._hasPhotoshopTerrain}_renderPhotoshopTerrain(){if(!this._hasPhotoshopTerrain)return null;const{width:e,height:t}=this._framebuffer.size,r=this.fboCache.acquire(e,t,"transparent terrain"),s=()=>this._plugins.render(6);return this._renderToTargets(s,r,this._framebuffer.depth,A),this.performanceInfo.advance(de.TRANSPARENT_TERRAIN),r}_renderTransparentGround(){this._plugins.render(...ge)}_renderLineCallouts(e){if(this._bindParameters.hudRenderStyle=e,0===e){const e=()=>this._plugins.render(16),{width:t,height:r}=this._framebuffer.size,s=this.fboCache.acquireDepth(this._hudDepthFormat,t,r,"line callouts");this._renderToTargets(e,this._framebuffer.color,s,void 0,!0,!0),s.release()}else this._plugins.render(16)}_precompileHUD(e){if(!this._pluginsHas.hudElements)return;const t=this._bindParameters.output,r=this._bindParameters.hudRenderStyle;this._bindParameters.hudRenderStyle=e,this.oitEnabled?(this._bindParameters.output=1,this._plugins.precompile(...we),this._bindParameters.output=2,this._plugins.precompile(...we),this._bindParameters.output=0,this._oitBlend.precompile(this._bindParameters,!1,1)):(this._bindParameters.output=0,this._plugins.precompile(...we)),this._hasHighlights&&(this._bindParameters.output=10,this._plugins.precompile(...we)),this._bindParameters.output=t,this._bindParameters.hudRenderStyle=r}_renderHUD(e,t){if(!this._pluginsHas.hudElements)return t;if(this.oitEnabled){const r=this._renderOIT(1,e);this._rctx.bindFramebuffer(t.fbo);const s=!!t.getTexture(le);this._compositor.compositePreMultipliedAlpha(this._bindParameters,r.getTexture(),s),r.release()}else if(this._bindParameters.output=0,0===e){const t=()=>this._renderHUDElements(e),{width:r,height:s}=this._framebuffer.size,i=this.fboCache.acquireDepth(this._hudDepthFormat,r,s,"hud");this._renderToTargets(t,this._framebuffer.color,i,void 0,!0,!0),i.release()}else t.acquireDepth(this._hudDepthFormat),this._rctx.bindFramebuffer(t.fbo),this._rctx.clear(256),this._renderHUDElements(e),t.detachDepth();return this.performanceInfo.advance(0===e?de.HUD_OCCLUDED:de.HUD),t}get _needsShadowHighlight(){return this.shadowsEnabled&&this._plugins.produces(6,2)}_renderHighlightPrepass(){if(!this._hasHighlights)return;const{fboCache:e,_rctx:t,_bindParameters:r}=this,{width:s,height:i}=this._framebuffer.size,{highlights:a}=r,n=a.length>B?3:1,h=e.acquire(s,i,"highlights",n);h.acquireDepth(13);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,s,i,r,()=>this._renderHighlightGeometries()),h.detachDepth(),this.performanceInfo.advance(de.HIGHLIGHTS),h.retain(this._nodes.require("highlights",...I)+this._nodes.optional("highlights",...I)-1),h}_renderHighlightGeometries(){this._plugins.render(...Ee),this._rctx.clear(256),this._renderHUDElements(2)}_renderShadowAccumulation(e,t){this._shadowAccumulator.updateDepthRange(e),this._bindParameters.output=0,this._shadowAccumulator.accumulating&&this._bindParameters.depth&&(this._shadowAccumulator.renderAccumulation(this._bindParameters,t)&&this.performanceInfo.advance(de.ACCUMULATED_SHADOWS),this._bindParameters.depth=h(this._bindParameters.depth))}_precompileTransparentGeometry(){this.oitEnabled&&N(this._bindParameters.output)?(this._bindParameters.output=1,this._plugins.precompile(...fe),this._oitCallouts&&this._plugins.precompile(16),this._bindParameters.output=2,this._plugins.precompile(...fe),this._oitCallouts&&this._plugins.precompile(16),this._bindParameters.output=0):this._plugins.precompile(...fe)}_renderOIT(e,t=2){const r=1===e,{width:s,height:i}=this._framebuffer.size,a=r?()=>this._renderHUDElements(t):()=>this._renderTransparentGeometry(),h=this._bindParameters,o=h.useFloatBlend.value?8:5,d=h.output;h.output=1;const _=r?"oit hud":"oit",l=this.fboCache.acquire(s,i,_,o),u=h.hasEmission&&(0===e||1!==t);u&&l.acquireColor(le,o,"oit emissive");const m=u?ue:le;l.acquireColor(m,this.hasFloatBlend?7:0,"oit alpha"),r||l.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(l.fbo),this._rctx.clearFramebuffer([0,0,0,1]),u&&this._rctx.clearBuffer(1,A),a(),l.detachDepth(),h.output=2;const p=this.fboCache.acquire(s,i,r?"oit hud front":"oit front");u&&p.acquireColor(le,o,"oit emissive front"),r?p.acquireDepth(this._hudDepthFormat):p.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(p.fbo),this._rctx.clearFramebuffer(A,r),a(),p.detachDepth();const c=this._pluginsHas.occludedHudElements&&!r;let f;return h.hudOcclusion=n(this._bindParameters.hudOcclusion),h.output=0,r?(f=this.fboCache.acquire(s,i,"oit hud composite"),this._rctx.bindFramebuffer(f.fbo),this._rctx.setClearColor(0,0,0,1e-13),this._rctx.clear(16384)):(c&&(this._framebuffer.color.acquireColor(m,0,"hud occlusion"),this._rctx.clearBuffer(m-me,A)),this._framebuffer.bind()),this._oitBlend.blend(this._rctx,l,p,h,u,c,e),f?.detachDepth(),r||(this._rctx.bindFramebuffer(p.fbo),this._framebuffer.bind(),c&&(h.hudOcclusion=this._framebuffer.color.obtainAttachment(m))),p.release(),l.release(),h.output=d,f}get _hudDepthFormat(){return this.isFeatureEnabled(8)?13:12}get _needsOpaquePass(){return this.plugins.produces(0,...ce)||this.plugins.produces(5,...ce)||this.plugins.produces(3,3)}_renderOpaque(){const e=this._needsOpaquePass;e&&(this._plugins.render(0,1),this._framebuffer.update(e=>this._renderNodes(D.CUTFILL_COLOR,e)),this._plugins.render(2,3));const t=this._framebuffer;this._renderTerrainDepth(),t.update(t=>this._renderNodes(R.OPAQUE,t,e)),this.fboCache.debugCallback?.(R.OPAQUE,t.color.fbo),t.update(e=>this._renderNodes(D.OPAQUE_ENVIRONMENT,e)),this.fboCache.debugCallback?.(D.OPAQUE_ENVIRONMENT,t.color.fbo),this._renderEdges(1)}_renderTransparent(){const e=this._framebuffer;e.bind(),e.update(e=>this._renderNodes(D.PRE_TRANSPARENT,e)),this.fboCache.debugCallback?.(D.PRE_TRANSPARENT,e.color.fbo),this._renderHiddenTransparentEdges(),this._hasTransparentGeometry&&(this.oitEnabled?this._renderOIT(0):this._renderTransparentGeometry()),e.update(e=>this._renderNodes(R.TRANSPARENT,e,this._hasTransparentGeometry)),this.fboCache.debugCallback?.(R.TRANSPARENT,e.color.fbo),this._renderGeometryDepth(),this._needsTerrainDepth||this._oitCallouts||this._plugins.render(16),this._renderEdges(0);const t=this._renderPhotoshopTerrain(),r=t?.getTexture();r&&this._renderHUD(0,e.color),this._bindParameters.cullAboveTerrain=!1,r&&(e.bind(),this._compositor.compositePreMultipliedAlpha(this._bindParameters,r),t?.release(),this._needsTerrainDepth&&(this._renderEdges(1),this._hasTransparentGeometry&&(this.oitEnabled?this._renderOIT(0):this._renderTransparentGeometry(),this.performanceInfo.advance(de.TRANSPARENT)),this._renderEdges(0))),this._bindParameters.ssao=n(this._bindParameters.ssao),this._needsTerrainDepth&&this._renderLineCallouts(1),this._bindParameters.terrainDepthTest=!1,this._renderTransparentEnvironment()}_renderTransparentEnvironment(){this._shadowAccumulator.render(this._bindParameters),this.performanceInfo.advance(de.APPLY_ACCUMULATED_SHADOWS),this._framebuffer.bind(),this._plugins.render(9),this.performanceInfo.advance(de.TRANSPARENT_MATERIAL_WITHOUT_DEPTH)}_renderNodes(e,t,r=!1){const s=t.name;if(t.setName(e),this._pluginInput.set(e,t),!this._nodes.produces(e))return r&&this.performanceInfo.advance(e),t;this._fboCache.debugCallback?.(s,t.fbo);const i=this._nodes.render(t,this._pluginInput,this._releaseNodeInputs);return this.performanceInfo.advance(e),i}_ensureBindParametersCamera(e,t){this._bindParameters.camera=e,this._bindParameters.contentCamera=t}_ensureBindParametersWeatherFader(e){1===this.stage.viewingMode&&(this._bindParameters.clouds.data&&(this._bindParameters.clouds.fade(this._bindParameters.camera,e,this.stage.view.qualitySettings.fadeDuration),this.weatherFader?.cleanupCubemap()),this._bindParameters.snowCover=this.weatherFader?.snowCover??0)}_ensureBindParametersSSR(e){const{screenSpaceReflections:t,reprojection:r,camera:s}=this._bindParameters;if(t.enabled=this.hasReflections,t.enabled){null==this._ssrEnableTime&&(this._ssrEnableTime=e),r.lastFrameCamera.equals(s)?this._reprojectionMatrix=P:(g(Ie,s.viewMatrix),g(Se,s.projectionMatrix),b(Oe,Ie,Se),b(Oe,r.lastFrameCamera.viewMatrix,Oe),b(Oe,r.lastFrameCamera.projectionMatrix,Oe),this._reprojectionMatrix=Oe);const i=this.stage.view.qualitySettings.fadeDuration;t.fadeFactor=i>0?Math.min(i,e-this._ssrEnableTime)/i:1,t.fadeFactor<1&&this._requestRender()}else this._reprojectionMatrix=P,this._ssrEnableTime=null}addRenderNode(e){this._nodes.add(e),this._requestRender()}removeRenderNode(e){this._nodes.remove(e),this._requestRender()}updateLighting(e,t,r,s){this._bindParameters.updateLighting(e,t,r,s),this._requestRender(1)}get usedMemory(){return{fbos:this.fboCache.usedMemory,plugins:this._plugins.usedMemory,edges:this.edgeView?.usedMemory??0,clouds:this.weatherFader?.usedMemory??0}}_renderToTargets(e,t,r,s,i=!1,a=!1){t.attachDepth(r),this._rctx.bindFramebuffer(t.fbo),this._rctx.clearFramebuffer(s,i,a),e(),t.detachDepth()}get test(){}};e([p({readOnly:!0})],pe.prototype,"highResolutionAtmosphere",null),e([p()],pe.prototype,"_edgeView",void 0),e([p()],pe.prototype,"updating",null),pe=e([c("esri.views.3d.webgl-engine.lib.Renderer")],pe);const ce=[0,1,2,3],fe=[8,7,4,5],ge=[6,8,7],be=[0,1,2,4,...ge],Pe=[3,5],Te=[2,4,9],we=[17,13,15,14],Ee=[4,5,2,3,0,1,...ge],Ae=[4,9,5,12],Ce={0:[14],1:[13],2:[14,13],3:[14,13]},Re=[0,1,...ge],De=["normals","highlights"],Se=T(),Ie=T(),Oe=T();function xe(e){return t=>e.immediate.schedule(t)}export{pe as Renderer};
2
+ import{__decorate as e}from"tslib";import{update as t}from"../../../../core/arrayUtils.js";import{createTask as r}from"../../../../core/asyncUtils.js";import"../../../../core/has.js";import{removeMaybe as s,abortMaybe as i,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 _,sync as u}from"../../../../core/reactiveUtils.js";import{signal as p}from"../../../../core/signal.js";import{property as m,subclass as c}from"../../../../core/accessorSupport/decorators.js";import{equals as f,invert as g,multiply as b}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as P,create as T}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as E}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{fromValues as w,ZEROS as C}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{pruneIndexArrays as A}from"../../../../geometry/support/Indices.js";import{RenderNodeOutput as D,InternalRenderCategory as R,AllRenderNodeOutputs as S,AllInternalRenderNodeOutputs as I}from"../../webgl.js";import{minNearDistanceInMeters as O}from"../../state/NearFarHeuristic.js";import{debugFlags as x}from"../../support/debugFlags.js";import"../../webgl/ManagedDepthAttachment.js";import{FBOCache as F}from"../core/FBOCache.js";import{RenderPassManager as y}from"../core/renderPasses/RenderPassManager.js";import{isColor as N}from"../core/shaderLibrary/ShaderOutput.js";import{distanceFadeEnd as v}from"../core/shaderLibrary/shading/ScreenSpaceConstants.js";import{hasOit8Bit as H,hasEmissive8Bit as M}from"../effects/fboFormatUtils.js";import{RenderNodes as G}from"../effects/RenderNodes.js";import{RenderPluginManager as q}from"../effects/RenderPluginManager.js";import{WeatherFader as L}from"../effects/WeatherFader.js";import{innerAtmosphereFadeStart as U}from"../effects/atmosphere/atmosphereUtils.js";import{Blit as j}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 z}from"./AnimationTimer.js";import{AnimationTimeStep as W}from"./AnimationTimeStep.js";import{BoundingInfo as Q}from"./BoundingInfo.js";import{Compositor as Y}from"./Compositor.js";import{DepthRange as $}from"./DepthRange.js";import{depthRangeFromScene as J}from"./depthRangeUtils.js";import{MainFramebuffer as K}from"./MainFramebuffer.js";import{RenderContext as Z,defaultRenderOccludedMask as X}from"./RenderContext.js";import{RendererBase as ee}from"./RendererBase.js";import{setupFeatureDefaults as te}from"./RenderFeature.js";import{RenderPluginInput as re}from"./RenderPluginInput.js";import{ShadowAccumulator as se}from"./ShadowAccumulator.js";import{ShadowMap as ie}from"./ShadowMap.js";import ae from"./SliceHelper.js";import{MergedRenderer as ne}from"../materials/renderers/MergedRenderer.js";import{RenderSceneResult as he}from"../parts/renderUtils.js";import{RendererPerformanceInfo as oe,PerformanceCategory as de}from"../statistics/RendererPerformanceInfo.js";import{PixelType as le,ColorAttachment1 as _e,ColorAttachment2 as ue,ColorAttachment0 as pe}from"../../../webgl/enums.js";let me=class extends ee{constructor(e,t,r,s,i){super({stage:e}),this._techniques=r,this._rctx=s,this._requestRender=i,this._pluginsHas={occludedHudElements:!1,hudElements:!1,water:!1},this.renderPassManager=new y,this._isRendering=!1,this._inGlobeView=!1,this._backgroundColor=w(0,0,0,1),this._sliceHelper=new ae,this.sceneDepthRange=p($.Infinite),this._state=p(2),this._hasOit8Bit=H(),this._hasEmissive8Bit=M(),this._hasAnimations=!1,this._animationTimestep=new W,this._loadEdgeViewTask=null,this._edgeViewCallbacks=[],this._reprojectionMatrixVersion=p(0),this._renderHiddenTransparentEdges=()=>{},this._pluginInput=new re,this._hasTransparentGeometry=!1,this._oitCallouts=!1,this._releaseNodeInputs=e=>{for(const t of Re)e.some(({name:e})=>e===t)&&this._pluginInput.release(t)},this._testsNeedsDepth=!1,this._fboCache=new F(s),this._compositor=new Y(s,r),this._renderStateFeatures=p(te(e.view.qualityProfile));const a=new ie(this._fboCache,e.viewingMode);this._renderContext=new Z(this._rctx,a,r),this._framebuffer=new K(this._fboCache,this._bindParameters),this._performanceInfo=new oe(this._rctx),this._blit=new j(r),this._shadowAccumulator=new se(this.fboCache,r,e,e=>{const t=this.shadowsEnabled;a.enabled=!0,this._ensureBindParametersCamera(e.camera,e.contentCamera),this._plugins.prepareRender(),a.enabled=t},(t,r,s)=>{const i=e.view.qualitySettings.maximumPixelRatio;t.shadowMap.start(t.camera,r,s,!0,i),this._renderShadowCascades(5,t.shadowMap),t.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(t.camera,t.contentCamera)},i),this._nodes=new G(this._renderContext),this._plugins=new q({renderContext:this._renderContext,techniques:r,materials:t,requestRender:i,controller:e}),this._plugins.add(this.renderPassManager),this.weatherFader=new L({view:e.view,context:this._renderContext}),this.addHandles([d(()=>e.view.state.camera,()=>i(),l),d(()=>x.EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES,e=>{this._renderHiddenTransparentEdges=e?()=>this._renderEdges(0):()=>{},i()},_),d(()=>e.view.environment.background?.color,e=>{const t=e?e.toUnitRGBA():C;E(this._backgroundColor,t[0]*t[3],t[1]*t[3],t[2]*t[3],t[3]),i()},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,()=>i(),u),d(()=>e.view.state.highlights,e=>{this._bindParameters.highlights=e,i()},_),d(()=>"sun"===e.view.environment.lighting?.type,e=>{this._bindParameters.enableFillLights=e,this._requestRender()},l)])}destroy(){this._gpuTimerHandle=s(this._gpuTimerHandle),this._nodes.destroy(),this._framebuffer.dispose(),this._shadowAccumulator.destroy(),this._shadowAccumulator=null,this._loadEdgeViewTask=i(this._loadEdgeViewTask),this._edgeView=a(this._edgeView),this.renderPassManager.dispose(),this.weatherFader=a(this.weatherFader),this._releaseFBOs(),this._disposeOffscreenBuffers(),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,Q.prune(),ne.prune(),A()}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=te(e),this._requestRender()}isFeatureEnabled(e,t=this._state.value){return this._renderStateFeatures.value.get(t,e)??!1}setFeatureEnabled(e,t,r){this._renderStateFeatures.mutate(s=>s.set(t,e,r)),this._requestRender()}get _highQualityTransparency(){return this.isFeatureEnabled(1)}get hasReflections(){return this._bindParameters.screenSpaceReflections.enabled=this._pluginsHas.water&&this.isFeatureEnabled(5),this._bindParameters.screenSpaceReflections.enabled}get _hasHighlights(){return this._plugins.produces(10,2,4,19,13,14,15)}hasHighlight(e){return this._plugins.hasHighlight(e)}get _hasHUDHighlights(){return this._plugins.produces(10,13,14,15)}get hasSSAO(){return this.isFeatureEnabled(4)&&!this._inGlobeView}get hasSMAA(){return this.isFeatureEnabled(0)}get _hasEmission(){return this._plugins.hasEmitters&&(this._hasEmissive8Bit||this.hasFloatBlend)}get hasFloatBlend(){return this._rctx.driverTest.floatBufferBlend.result&&this.isFeatureEnabled(10)}get oitEnabled(){return this.hasFloatBlend||this._hasOit8Bit}get highResolutionAtmosphere(){return this.isFeatureEnabled(3)}get fboCache(){return this._fboCache}_releaseFBOs(){this._bindParameters.terrainDepth=n(this._bindParameters.terrainDepth),this._bindParameters.geometryDepth=n(this._bindParameters.geometryDepth),this._bindParameters.hudOcclusion=n(this._bindParameters.hudOcclusion),this._bindParameters.depth=null}_disposeOffscreenBuffers(){this._framebuffer.dispose(),this._disposeBindBuffers()}_disposeBindBuffers(){this._bindParameters.shadowMap.disposeOutputs()}get updating(){return this._loadEdgeViewTask&&!this._loadEdgeViewTask.finished||this._edgeView?.updating||this._shadowAccumulator.readyToRun||this._plugins.updating||this.weatherFader?.readyToRun||!this.isCameraFinal}loadEdgeView(){return this._loadEdgeViewTask||(this._loadEdgeViewTask=r(async e=>{const{EdgeView:t}=await import("./edgeRendering/EdgeView.js");o(e);const r=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:xe(this.stage.view.resourceController)});return this.addHandles(d(()=>r.updating,()=>this._requestRender(),u)),this._requestRender(),this._edgeViewCallbacks.forEach(e=>e(r)),this._edgeViewCallbacks.length=0,r})),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,P)}set _reprojectionMatrix(e){t(this._bindParameters.reprojection.matrix,e)&&this._reprojectionMatrixVersion.value++}get shadowsEnabled(){return!!this._bindParameters.shadowMap.enabled}setParameters(e){void 0!==e.shadowMap&&this._bindParameters.shadowMap.enabled!==e.shadowMap&&(this._bindParameters.shadowMap.enabled=e.shadowMap,this._requestRender()),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)}rendererAdded(e){this._plugins.add(e)}rendererRemoved(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,10)}updateHasFlags(){const has=this._pluginsHas;has.occludedHudElements=this._plugins.produces(0,14),has.hudElements=has.occludedHudElements||this._plugins.produces(0,...Ee),has.water=this._plugins.produces(4,20),this._bindParameters.hasOccludees=this._plugins.hasOccludees,this._requestRender()}updateAnimation(e,t){this._animationTimer??=new z(e.camera,t),this._animationTimer.advance(e.camera,t,this._animationTimeDilation);const r=this._hasAnimations;return this._hasAnimations=this._plugins.updateAnimation(this._animationTimer),this._hasAnimations=this._nodes.updateAnimation(this._animationTimer)||this._hasAnimations,this._hasAnimations!==r&&(this._gpuTimerHandle=r?s(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,r,s=!1){try{return this._isRendering=!0,this._render(e,t,r,s)}catch(i){console.error(`Exception during rendering: ${i}:\n${i.stack}`)}finally{this._isRendering=!1}return new he(this._pluginInput.get(D.FINAL),null)}_render(e,t,r,s){const i=0===r;this.performanceInfo.startFrame(),this.fboCache.frameStart(),this.fboCache.interactive=i,this._disposeBindBuffers();const{camera:a,contentCamera:o,mode:d,alignPixelEnabled:l}=e;this._state.value=d,this._renderContext.time=t,this._bindParameters.output=0,this._bindParameters.hasEmission=this._hasEmission,this._bindParameters.alignPixelEnabled=l,this._bindParameters.decorations=!s,this._bindParameters.mainDepth=null,this._bindParameters.useFloatBlend.value=this.hasFloatBlend;const _=!s||!this._sliceHelper.isDecoration;this._bindParameters.slicePlane=_?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(),a.setGLViewport(this._rctx);const u=this._framebuffer,p=u.initialize(a.fullWidth,a.fullHeight,this._backgroundColor);this.hasReflections?(p?.setName("last frame color"),this._bindParameters.reprojection.lastFrameColor=p):p?.release(),this._ensureBindParametersCamera(a,o),this._ensureBindParametersWeatherFader(this._renderContext.time),this._plugins.sortTestsTransparentOrderedSlots(Ce),this._plugins.prepareRender(),this._bindParameters.hasShadowHighlights=this._needsShadowHighlight&&!s,this._hasTransparentGeometry=this._plugins.produces(0,...fe),this._precompilePrepasses(),this.performanceInfo.advance(de.PREPARE);const m=this._computeShadowDepthRange(a);this._renderShadowMap(a,this._bindParameters.lighting.mainLight.direction,m),this._pluginInput.set("normals",this._renderNormals()),this._renderAmbientIlluminationAndDepth(),this._renderShadowAccumulation(m,!i),this._oitCallouts=this._hasTransparentGeometry&&this.oitEnabled,this._ensureBindParametersSSR(t),u.bind(),this._bindParameters.mainDepth=u.depth.attachment,this._precompileShaders(),this._bindParameters.output=0,this._renderOpaque(),this._renderTransparent(),this._bindParameters.reprojection.lastFrameColor=n(this._bindParameters.reprojection.lastFrameColor),this.hasReflections&&(this._bindParameters.depth=h(this._bindParameters.depth)),this._bindParameters.shadowMap.disposeOutput(5),this._renderCutFillComputation(),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===r?this._renderObjectAndLayerIdColor():null;u.update(e=>this._renderNodes(D.COMPOSITE,e)),this._bindParameters.shadowMap.disposeOutputs(),u.update(e=>this._renderNodes(R.ANTIALIASING,e));const f=this._hasPhotoshopTerrain||!this._hasTransparentGeometry?1:2;let g;return this._bindParameters.hasEmission=!1,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.hasEmission=this._hasEmission,u.update(e=>this._renderNodes(R.MAGNIFIER,e)),u.update(e=>this._renderNodes(D.FINAL,e)),i&&this._blit.toFramebuffer(this._rctx,u.color,this._bindParameters),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 he(g,c)}_precompileShaders(){++this._plugins.context.techniques.precompiling,this._bindParameters.output=0;const e=this._bindParameters.hasEmission;this._precompileOpaqueGeometry(),this._nodes.precompile(e,R.OPAQUE_ENVIRONMENT,R.PRE_TRANSPARENT);const t=this._bindParameters;if(t.terrainDepthTest=t.cullAboveTerrain=this._needsTerrainDepth,this._bindParameters.output=3,this._plugins.precompile(...ge),this._bindParameters.output=0,this._plugins.precompile(...ge),this._hasTransparentGeometry){const e=this._pluginsHas.occludedHudElements;this._oitBlend.precompile(this._bindParameters,e,0),this._pluginsHas.hudElements&&this._oitBlend.precompile(this._bindParameters,!1,1)}this._hasTransparentGeometry&&(this._precompileTransparentGeometry(),this._hasPhotoshopTerrain&&(t.cullAboveTerrain=!1,this._precompileTransparentGeometry(),t.cullAboveTerrain=this._needsTerrainDepth)),this._nodes.precompile(e,R.FOCUSAREA);const r=this._hasPhotoshopTerrain&&!this._needsTerrainDepth;this._compositor.precompile(this._usesPremultipliedAlphaBlit,!!this._needsEdges,r,e),this._oitCallouts||this._plugins.precompile(16),t.terrainDepthTest=t.cullAboveTerrain=!1,this._nodes.precompile(e,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.hasEmission=!1,this._precompileHUD(0),this._precompileHUD(1),t.hasEmission=this._hasEmission,this._hasHighlights&&(t.highlights.forEach((e,r)=>{t.highlightLevel=r,this._precompileAllGeometry(10),this._hasHUDHighlights&&this._plugins.precompile(14,13)}),t.highlightLevel=null,this._nodes.precompile(e,R.HIGHLIGHT_COLOR)),t.highlightMixTexture=null,this._nodes.precompile(e,D.COMPOSITE,R.MAGNIFIER),this._shadowAccumulator.precompile(),this._plugins.precompile(9),--this._plugins.context.techniques.precompiling}_renderFocusAreaGeometry(){const e=this._nodes.produce(R.FOCUSAREA,this._pluginInput);return e&&this.performanceInfo.advance(de.FOCUS_AREA_MASK),e}_renderObjectAndLayerIdColor(){if(!this._nodes.produces("olid"))return null;const e=this._bindParameters.output;++this._techniques.precompiling;const{width:t,height:r}=this._framebuffer.size;let s=this.fboCache.acquire(t,r,"olid");return s.acquireDepth(13),s=this._nodes.render(s,this._pluginInput),--this._techniques.precompiling,this.performanceInfo.advance(de.OBJECT_AND_LAYER_ID_COLOR),this._bindParameters.output=e,s}finish(e){this._hasAnimations||this._animationTimestep.clear();const t=this.performanceInfo.gpuSamplingEnabled,r=0===e;if(r||t){const e=r?this.performanceInfo.elapsedTime:0;let s=0;t?s=this.performanceInfo.totalGPUTimeSampler.last:this._rctx.gl.finish();const i=Math.max(e,s);this._animationTimestep.frame(i,r)}}readMainDepth(e,t){const{mainDepth:r,camera:s}=this._bindParameters;if(!r)return;const i=this.fboCache.acquire(this._framebuffer.size.width,this._framebuffer.size.height,"linear depth");this._rctx.bindFramebuffer(i.fbo),s.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,r),this._rctx.setScissorTestEnabled(!1),this._rctx.setScissorRect(0,0,this._rctx.gl.canvas.width,this._rctx.gl.canvas.width),i.fbo?.readPixels(e[0],e[1],e[2],e[3],6408,le.UNSIGNED_BYTE,t),i.release()}readAccumulatedShadow(e){return this._shadowAccumulator.readAccumulatedShadow(e[0],e[1])}get _needsEdges(){return this._edgeView?.shouldRender()?this._edgeView:null}_renderEdges(e){const t=this._needsEdges;if(!t)return;const{width:r,height:s}=this._framebuffer.size,i=this.fboCache.acquire(r,s,"edges"),a=this._bindParameters.geometryDepth,n=()=>t.render(this._bindParameters,e);this._renderToTargets(n,i,a??this._framebuffer.depth,C),this._framebuffer.bind(),this._compositor.composite(this._bindParameters,i.getTexture()),i.release(),this.performanceInfo.advance(1===e?de.OPAQUE_EDGES:de.TRANSPARENT_EDGES)}_renderOverlay(){this._bindParameters.overlay=this.overlay?.render(this._renderContext.time),this._bindParameters.overlay&&this.performanceInfo.advance(de.OVERLAY)}_renderShadowMap(e,t,r){if(!this.shadowsEnabled)return;const s=this._bindParameters.shadowMap;s.start(e,t,r,this.isFeatureEnabled(6),this.stage.view.qualitySettings.maximumPixelRatio),this._needsShadowHighlight?(this._renderShadowCascades(7,s),s.clear(),this._renderShadowCascades(6,s)):this._renderShadowCascades(5),e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,this._bindParameters.contentCamera),this.performanceInfo.advance(de.SHADOW_MAP)}_renderCutFillComputation(){this._nodes.produce(R.CUTFILL_COMPUTATION,this._pluginInput)?.release()}_precompileShadowCascades(e){0!==this._bindParameters.shadowMap.cascades.length&&this._precompileAllGeometry(e)}_renderShadowCascades(e,t=this._bindParameters.shadowMap){const r=this._bindParameters.output;t.bindFramebuffer();for(const s of t.cascades)s.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(s.camera,s.camera),this.renderAllGeometry(e);t.finish(e),this._bindParameters.output=r}get _needsDepth(){return+this._nodes.requireGeometryDepth+ +this.hasReflections+ +this._shadowAccumulator.accumulating+ +this._testsNeedsDepth}get _usesPremultipliedAlphaBlit(){return this._pluginsHas.hudElements&&this.oitEnabled||this._hasPhotoshopTerrain}_renderAmbientIlluminationAndDepth(){this._bindParameters.depth=n(this._bindParameters.depth);const e=this._pluginInput.get("normals");if(e){this._pluginInput.set(R.AMBIENT_ILLUMINATION,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(de.DEPTH)):e.detachDepth(),this.hasSSAO&&this._pluginInput.release("normals")}else this._renderAllGeometryDepth()}_renderAllGeometryDepth(){const e=this._needsDepth;if(0===e)return;const{width:t,height:r}=this._framebuffer.size,s=this.fboCache.acquire(t,r,"geometry",13);this._rctx.bindFramebuffer(s.fbo),this._rctx.clear(1280),this.renderAllGeometry(3),this._bindParameters.depth=s.obtainDepthTexture(),this._bindParameters.depth?.retain(e-1),s.release(),this.performanceInfo.advance(de.DEPTH)}_renderTerrainDepth(){if(this._bindParameters.terrainDepth=n(this._bindParameters.terrainDepth),this._bindParameters.terrainDepthTest=this._bindParameters.cullAboveTerrain=this._needsTerrainDepth,!this._needsTerrainDepth)return;const e=this._bindParameters.output;this._bindParameters.output=3;const{width:t,height:r}=this._framebuffer.size,s=this.fboCache.acquire(t,r,"terrain",13);this._rctx.bindFramebuffer(s.fbo),this._rctx.clear(1280),this._renderTransparentGround(),this._bindParameters.terrainDepth=s.obtainDepthTexture(),s.release(),this._bindParameters.output=e}_renderGeometryDepth(){if(this._bindParameters.geometryDepth=n(this._bindParameters.geometryDepth),!this._needsTerrainDepth)return;const e=this._bindParameters.output,{width:t,height:r}=this._framebuffer.size,s=this.fboCache.acquire(t,r,"geometry",13);this._rctx.bindFramebuffer(s.fbo),this._rctx.clear(1280),this._renderOpaqueAndTransparentGeometry(3),this._bindParameters.output=e,this._bindParameters.geometryDepth=s.obtainDepthTexture(),s.release()}get _needsShadowDepthRange(){return this._bindParameters.shadowMap.enabled||this._shadowAccumulator.active}_computeShadowDepthRange(e){if(!this._needsShadowDepthRange)return $.Zero;const t=J(e,this._plugins.plugins,this.stage.layers,0);return t.union(this._plugins.queryDepthRange(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=$.Infinite);if((this.stage.view.renderCoordsHelper?.getAltitude(e.eye)??0)<U)return void(this.sceneDepthRange.value=$.Infinite);const t=e.clone();t.near=O,t.far=1e10;const r=J(t,this._plugins.plugins,this.stage.layers,1);r.union(this._plugins.queryDepthRange(t)),this.sceneDepthRange.value.equals(r)||(this.sceneDepthRange.value=r)}get _normalsRequired(){const e=this._nodes.require("normals",...S,R.VIEWSHED,R.LASERLINES);return(this.hasSSAO?1:0)+e}_precompilePrepasses(){this._normalsRequired?(this._precompilePlugins(4,be),this._needsDepth&&this._precompilePlugins(3,Pe)):this._needsDepth&&this._precompileAllGeometry(3),this.shadowsEnabled&&(this._needsShadowHighlight?(this._precompileShadowCascades(6),this._precompileShadowCascades(7)):this._precompileShadowCascades(5)),this._shadowAccumulator.active&&this._precompileAllGeometry(5),this.hasSSAO&&this._normalsRequired&&this._nodes.precompile(this._bindParameters.hasEmission,R.AMBIENT_ILLUMINATION)}_renderNormals(){const e=this._normalsRequired;if(0===e)return;const{width:t,height:r}=this._framebuffer.size,s=this.fboCache.acquire(t,r,"normals",5);s.acquireDepth(13),this._rctx.bindFramebuffer(s.fbo),this._rctx.clearFramebuffer(C,!0,!0),this._bindParameters.output=4,this._plugins.render(...be);const i=this._nodes.optional("normals",...S,R.VIEWSHED);return s.retain(e+i-1),this.performanceInfo.advance(de.NORMALS),s}_renderSSAO(){const e=this._pluginInput.get("normals");if(this.hasSSAO&&e)return this._bindParameters.ssao=this._nodes.produce(R.AMBIENT_ILLUMINATION,this._pluginInput),this._bindParameters.ssao&&this.performanceInfo.advance(de.AMBIENT_ILLUMINATION),this._bindParameters.ssao}_precompileAllGeometry(e){const t=this._bindParameters.output;this._bindParameters.output=e,this._precompileOpaqueGeometry(),this._precompileTransparentGeometry(),this._plugins.precompile(...ge),this._bindParameters.output=t}renderAllGeometry(e){this._bindParameters.output=e,this._renderOpaqueAndTransparentGeometry(e),this._renderTransparentGround()}precompileSlots(e,...t){for(const r of t)this._bindParameters.slot=r,e.precompile(this._renderContext)}precompileOccludedSlots(e,t){for(const r of t)this._renderContext.renderOccludedMask=r,this.precompileSlots(e,...Te);this._renderContext.renderOccludedMask=X}renderSlots(e,...t){for(const r of t)this._bindParameters.slot=r,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(10),this.renderSlots(e,...Te),this._renderContext.renderOccludedMask=X}renderHUD(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(...Ae[e])}_renderHUDElements(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(17),this.renderHUD(e),this._bindParameters.hudRenderStyle=e,this._plugins.render(15)}precompileViewshedShadowMap(){this._precompileAllGeometry(8)}precompileCutFillOrthographicReferenceDepth(){this._precompilePlugins(9,De)}_precompilePlugins(e,t){const r=this._bindParameters.output;this._bindParameters.output=e,this._plugins.precompile(...t),this._bindParameters.output=r}renderViewshedShadowMap(e){const{camera:t,contentCamera:r}=this._bindParameters,s=this._bindParameters.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this.renderAllGeometry(8),this._ensureBindParametersCamera(t,r),this._bindParameters.camera.setGLViewport(this._rctx),this._bindParameters.output=s}renderCutFillOrthographicReferenceDepth(e){const{camera:t,contentCamera:r}=this._bindParameters,s=this._bindParameters.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this._bindParameters.output=9,this._plugins.render(...De),this._ensureBindParametersCamera(t,r),t.setGLViewport(this._rctx),this._bindParameters.output=s}get _needsGroundDepth(){return this._bindParameters.cutFillVisualizationEnabled}_blitGroundDepth(){if(!this._needsGroundDepth)return null;const{width:e,height:t}=this._framebuffer.size,r=this.fboCache.acquire(e,t,R.GROUND_DEPTH,13);return this._rctx.blitFramebuffer(this._framebuffer.color.fbo,r.fbo,256),this._framebuffer.bind(),r}_renderOpaqueAndTransparentGeometry(e){this._bindParameters.output=e,this._renderOpaqueGeometry(),this._renderTransparentGeometry()}_renderGeometryWithoutNormals(e){this._bindParameters.output=e,this._plugins.render(...Pe)}_precompileOpaqueGeometry(){this._needsOpaquePass&&(this._plugins.precompile(...ce),this._nodes.precompile(this._bindParameters.hasEmission,"opaque-color"))}_renderOpaqueGeometry(){this._plugins.render(...ce)}_renderTransparentGeometry(){this._plugins.render(...fe),this._oitCallouts&&this._plugins.render(16)}get _hasPhotoshopTerrain(){return this._plugins.produces(0,6)}get _needsTerrainDepth(){return this._highQualityTransparency&&this._hasPhotoshopTerrain}_renderPhotoshopTerrain(){if(!this._hasPhotoshopTerrain)return null;const{width:e,height:t}=this._framebuffer.size,r=this.fboCache.acquire(e,t,"transparent terrain"),s=()=>this._plugins.render(6);return this._renderToTargets(s,r,this._framebuffer.depth,C),this.performanceInfo.advance(de.TRANSPARENT_TERRAIN),r}_renderTransparentGround(){this._plugins.render(...ge)}_renderLineCallouts(e){if(this._bindParameters.hudRenderStyle=e,0===e){const e=()=>this._plugins.render(16),{width:t,height:r}=this._framebuffer.size,s=this.fboCache.acquireDepth(this._hudDepthFormat,t,r,"line callouts");this._renderToTargets(e,this._framebuffer.color,s,void 0,!0,!0),s.release()}else this._plugins.render(16)}_precompileHUD(e){if(!this._pluginsHas.hudElements)return;const t=this._bindParameters.output,r=this._bindParameters.hudRenderStyle;this._bindParameters.hudRenderStyle=e,this.oitEnabled?(this._bindParameters.output=1,this._plugins.precompile(...Ee),this._bindParameters.output=2,this._plugins.precompile(...Ee),this._bindParameters.output=0,this._oitBlend.precompile(this._bindParameters,!1,1)):(this._bindParameters.output=0,this._plugins.precompile(...Ee)),this._hasHighlights&&(this._bindParameters.output=10,this._plugins.precompile(...Ee)),this._bindParameters.output=t,this._bindParameters.hudRenderStyle=r}_renderHUD(e,t){if(!this._pluginsHas.hudElements)return t;if(this.oitEnabled){const r=this._renderOIT(1,e);this._rctx.bindFramebuffer(t.fbo);const s=!!t.getTexture(_e);this._compositor.compositePreMultipliedAlpha(this._bindParameters,r.getTexture(),s),r.release()}else if(this._bindParameters.output=0,0===e){const t=()=>this._renderHUDElements(e),{width:r,height:s}=this._framebuffer.size,i=this.fboCache.acquireDepth(this._hudDepthFormat,r,s,"hud");this._renderToTargets(t,this._framebuffer.color,i,void 0,!0,!0),i.release()}else t.acquireDepth(this._hudDepthFormat),this._rctx.bindFramebuffer(t.fbo),this._rctx.clear(256),this._renderHUDElements(e),t.detachDepth();return this.performanceInfo.advance(0===e?de.HUD_OCCLUDED:de.HUD),t}get _needsShadowHighlight(){return this.shadowsEnabled&&this._plugins.produces(6,2)}_renderHighlightPrepass(){if(!this._hasHighlights)return;const{fboCache:e,_rctx:t,_bindParameters:r}=this,{width:s,height:i}=this._framebuffer.size,{highlights:a}=r,n=a.length>B?3:1,h=e.acquire(s,i,"highlights",n);h.acquireDepth(13);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,s,i,r,()=>this._renderHighlightGeometries()),h.detachDepth(),this.performanceInfo.advance(de.HIGHLIGHTS),h.retain(this._nodes.require("highlights",...I)+this._nodes.optional("highlights",...I)-1),h}_renderHighlightGeometries(){this._plugins.render(...we),this._rctx.clear(256),this._renderHUDElements(2)}_renderShadowAccumulation(e,t){this._shadowAccumulator.updateDepthRange(e),this._bindParameters.output=0,this._shadowAccumulator.accumulating&&this._bindParameters.depth&&(this._shadowAccumulator.renderAccumulation(this._bindParameters,t)&&this.performanceInfo.advance(de.ACCUMULATED_SHADOWS),this._bindParameters.depth=h(this._bindParameters.depth))}_precompileTransparentGeometry(){this.oitEnabled&&N(this._bindParameters.output)?(this._bindParameters.output=1,this._plugins.precompile(...fe),this._oitCallouts&&this._plugins.precompile(16),this._bindParameters.output=2,this._plugins.precompile(...fe),this._oitCallouts&&this._plugins.precompile(16),this._bindParameters.output=0):this._plugins.precompile(...fe)}_renderOIT(e,t=2){const r=1===e,{width:s,height:i}=this._framebuffer.size,a=r?()=>this._renderHUDElements(t):()=>this._renderTransparentGeometry(),h=this._bindParameters,o=h.useFloatBlend.value?8:5,d=h.output;h.output=1;const l=r?"oit hud":"oit",_=this.fboCache.acquire(s,i,l,o),u=h.hasEmission&&(0===e||1!==t);u&&_.acquireColor(_e,o,"oit emissive");const p=u?ue:_e;_.acquireColor(p,this.hasFloatBlend?7:0,"oit alpha"),r||_.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(_.fbo),this._rctx.clearFramebuffer([0,0,0,1]),u&&this._rctx.clearBuffer(1,C),a(),_.detachDepth(),h.output=2;const m=this.fboCache.acquire(s,i,r?"oit hud front":"oit front");u&&m.acquireColor(_e,o,"oit emissive front"),r?m.acquireDepth(this._hudDepthFormat):m.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(m.fbo),this._rctx.clearFramebuffer(C,r),a(),m.detachDepth();const c=this._pluginsHas.occludedHudElements&&!r;let f;return h.hudOcclusion=n(this._bindParameters.hudOcclusion),h.output=0,r?(f=this.fboCache.acquire(s,i,"oit hud composite"),this._rctx.bindFramebuffer(f.fbo),this._rctx.setClearColor(0,0,0,1e-13),this._rctx.clear(16384)):(c&&(this._framebuffer.color.acquireColor(p,0,"hud occlusion"),this._rctx.clearBuffer(p-pe,C)),this._framebuffer.bind()),this._oitBlend.blend(this._rctx,_,m,h,u,c,e),f?.detachDepth(),r||(this._rctx.bindFramebuffer(m.fbo),this._framebuffer.bind(),c&&(h.hudOcclusion=this._framebuffer.color.obtainAttachment(p))),m.release(),_.release(),h.output=d,f}get _hudDepthFormat(){return this.isFeatureEnabled(8)?13:12}get _needsOpaquePass(){return this.plugins.produces(0,...ce)||this.plugins.produces(5,...ce)||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;this._renderTerrainDepth(),t.update(t=>this._renderNodes(D.OPAQUE,t,e)),this.fboCache.debugCallback?.(D.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)}_renderTransparent(){const e=this._framebuffer;e.bind(),e.update(e=>this._renderNodes(R.PRE_TRANSPARENT,e)),this.fboCache.debugCallback?.(R.PRE_TRANSPARENT,e.color.fbo),this._renderHiddenTransparentEdges(),this._hasTransparentGeometry&&(this.oitEnabled?this._renderOIT(0):this._renderTransparentGeometry()),e.update(e=>this._renderNodes(D.TRANSPARENT,e,this._hasTransparentGeometry)),this.fboCache.debugCallback?.(D.TRANSPARENT,e.color.fbo),this._renderGeometryDepth(),this._needsTerrainDepth||this._oitCallouts||this._plugins.render(16),this._renderEdges(0);const t=this._renderPhotoshopTerrain(),r=t?.getTexture();r&&this._renderHUD(0,e.color),this._bindParameters.cullAboveTerrain=!1,r&&(e.bind(),this._compositor.compositePreMultipliedAlpha(this._bindParameters,r),t?.release(),this._needsTerrainDepth&&(this._renderEdges(1),this._hasTransparentGeometry&&(this.oitEnabled?this._renderOIT(0):this._renderTransparentGeometry(),this.performanceInfo.advance(de.TRANSPARENT)),this._renderEdges(0))),this._bindParameters.ssao=n(this._bindParameters.ssao),this._needsTerrainDepth&&this._renderLineCallouts(1),this._bindParameters.terrainDepthTest=!1,this._renderTransparentEnvironment()}_renderTransparentEnvironment(){this._shadowAccumulator.render(this._bindParameters),this.performanceInfo.advance(de.APPLY_ACCUMULATED_SHADOWS),this._framebuffer.bind(),this._plugins.render(9),this.performanceInfo.advance(de.TRANSPARENT_MATERIAL_WITHOUT_DEPTH)}_renderNodes(e,t,r=!1){const s=t.name;if(t.setName(e),this._pluginInput.set(e,t),!this._nodes.produces(e))return r&&this.performanceInfo.advance(e),t;this._fboCache.debugCallback?.(s,t.fbo);const i=this._nodes.render(t,this._pluginInput,this._releaseNodeInputs);return this.performanceInfo.advance(e),i}_ensureBindParametersCamera(e,t){this._bindParameters.camera=e,this._bindParameters.contentCamera=t}_ensureBindParametersWeatherFader(e){1===this.stage.viewingMode&&(this._bindParameters.clouds.data&&(this._bindParameters.clouds.fade(this._bindParameters.camera,e,this.stage.view.qualitySettings.fadeDuration),this.weatherFader?.cleanupCubemap()),this._bindParameters.snowCover=this.weatherFader?.snowCover??0)}_ensureBindParametersSSR(e){const{screenSpaceReflections:t,reprojection:r,camera:s}=this._bindParameters;if(this.hasReflections){null==this._ssrEnableTime&&(this._ssrEnableTime=e),r.lastFrameCamera.equals(s)?this._reprojectionMatrix=P:(g(Ie,s.viewMatrix),g(Se,s.projectionMatrix),b(Oe,Ie,Se),b(Oe,r.lastFrameCamera.viewMatrix,Oe),b(Oe,r.lastFrameCamera.projectionMatrix,Oe),this._reprojectionMatrix=Oe);const i=this.stage.view.qualitySettings.fadeDuration;t.fadeFactor=i>0?Math.min(i,e-this._ssrEnableTime)/i:1,t.fadeFactor<1&&this._requestRender()}else this._reprojectionMatrix=P,this._ssrEnableTime=null}addRenderNode(e){this._nodes.add(e),this._requestRender()}removeRenderNode(e){this._nodes.remove(e),this._requestRender()}updateLighting(e,t,r,s){this._bindParameters.updateLighting(e,t,r,s),this._requestRender(1)}get usedMemory(){return{fbos:this.fboCache.usedMemory,plugins:this._plugins.usedMemory,edges:this.edgeView?.usedMemory??0,clouds:this.weatherFader?.usedMemory??0}}_renderToTargets(e,t,r,s,i=!1,a=!1){t.attachDepth(r),this._rctx.bindFramebuffer(t.fbo),this._rctx.clearFramebuffer(s,i,a),e(),t.detachDepth()}get test(){}};e([m({readOnly:!0})],me.prototype,"highResolutionAtmosphere",null),e([m()],me.prototype,"_edgeView",void 0),e([m()],me.prototype,"updating",null),me=e([c("esri.views.3d.webgl-engine.lib.Renderer")],me);const ce=[0,1,2,3],fe=[8,7,4,5],ge=[6,8,7],be=[0,1,2,4,...ge],Pe=[3,5],Te=[2,4,9],Ee=[17,13,15,14],we=[4,5,2,3,0,1,...ge],Ce=[4,9,5,12],Ae={0:[14],1:[13],2:[14,13],3:[14,13]},De=[0,1,...ge],Re=["normals","highlights"],Se=T(),Ie=T(),Oe=T();function xe(e){return t=>e.immediate.schedule(t)}export{me as Renderer};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{exactEquals as e,set as t,copy as r,normalize as s,subtract as i,length as a,scale as o,dot as n,transformMat3 as l}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{ZEROS as u,create as c,fromValues as h}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{is3DGeometryOutputMRT as m,isShadowLike as p,isColor as d}from"../core/shaderLibrary/ShaderOutput.js";import{GLTextureMaterial as f}from"../lib/GLTextureMaterial.js";import{Material as T}from"../lib/Material.js";import{intersectTriangleGeometry as x}from"../lib/RayIntersections.js";import{getVerticalOffsetObject3D as g}from"../lib/verticalOffsetUtils.js";import{DefaultBufferWriter as v}from"./DefaultBufferWriter.js";import{intersectWithPolygonOffset as S}from"./PolygonOffset.js";import{verticalOffsetAtDistance as b}from"./internal/MaterialUtil.js";import{getLayout as M,DefaultMaterialPassParameters as O,DefaultMaterialTechnique as C}from"../shaders/DefaultMaterialTechnique.js";import{DefaultMaterialTechniqueConfiguration as w}from"../shaders/DefaultMaterialTechniqueConfiguration.js";import{RealisticTreeTechnique as y}from"../shaders/RealisticTreeTechnique.js";import{alphaCutoff as R}from"../../../../webscene/support/AlphaCutoff.js";class D extends T{constructor(e,t){super(e,j),this.materialType="default",this.supportsEdges=!0,this.intersectDraped=void 0,this.produces=new Map([[2,e=>(m(e)||p(e))&&!this.transparent],[4,e=>(m(e)||p(e))&&this.transparent&&this.parameters.writeDepth],[9,e=>(m(e)||p(e))&&this.transparent&&!this.parameters.writeDepth]]),this._layout=M(this.parameters),this._configuration=new w(t.spherical)}isVisibleForOutput(e){return 5!==e&&7!==e&&6!==e||this.parameters.castShadows}get visible(){const{layerOpacity:e,colorMixMode:t,opacity:r,externalColor:s}=this.parameters;return e*("replace"===t?1:r)*("ignore"===t||isNaN(s[3])?1:s[3])>=R}get _hasEmissiveBase(){return!!this.parameters.emissiveTextureId||!e(this.parameters.emissiveBaseColor,u)}get hasEmissions(){return this.parameters.emissiveStrength>0&&(0===this.parameters.emissiveSource&&this._hasEmissiveBase||1===this.parameters.emissiveSource)}updateConfiguration(e){super.updateConfiguration(e);const{parameters:t,_configuration:r}=this;r.hasNormalTexture=t.hasNormalTexture,r.hasColorTexture=t.hasColorTexture,r.hasMetallicRoughnessTexture=t.hasMetallicRoughnessTexture,r.hasOcclusionTexture=t.hasOcclusionTexture;const{treeRendering:s,doubleSided:i,doubleSidedType:a}=t;r.hasVertexTangents=!s&&t.hasVertexTangents,r.instanced=t.instanced,r.instancedDoublePrecision=t.instancedDoublePrecision,r.hasVVColor=!!t.vvColor,r.hasVVSize=!!t.vvSize,r.hasVerticalOffset=null!=t.verticalOffset,r.hasScreenSizePerspective=null!=t.screenSizePerspective,r.hasSlicePlane=t.hasSlicePlane,r.alphaDiscardMode=t.textureAlphaMode,r.normalType=s?0:t.normalType,r.transparent=this.transparent,r.enableOITOffset=e.enableOITOffset,r.writeDepth=t.writeDepth,r.customDepthTest=t.customDepthTest??0,r.hasOccludees=e.hasOccludees,r.cullFace=t.hasSlicePlane?0:t.cullFace,r.cullAboveTerrain=e.cullAboveTerrain,r.hasModelTransformation=!s&&null!=t.modelTransformation,r.hasVertexColors=t.hasVertexColors,r.hasSymbolColors=t.hasSymbolColors,r.doubleSidedMode=s?2:i&&"normal"===a?1:i&&"winding-order"===a?2:0,r.instancedFeatureAttribute=t.instancedFeatureAttribute,r.instancedColor=t.instancedColor,d(e.output)?(r.terrainDepthTest=e.terrainDepthTest,r.receiveShadows=t.receiveShadows,r.receiveAmbientOcclusion=t.receiveAmbientOcclusion&&null!=e.ssao):(r.terrainDepthTest=!1,r.receiveShadows=r.receiveAmbientOcclusion=!1),r.textureAlphaPremultiplied=!!t.textureAlphaPremultiplied,r.pbrMode=t.usePBR?t.isSchematic?2:1:0,r.emissionSource=t.emissionSource,r.offsetBackfaces=!(!this.transparent||!t.offsetTransparentBackfaces),r.snowCover=e.snowCover>0,r.hasColorTextureTransform=!!t.colorTextureTransformMatrix,r.hasNormalTextureTransform=!!t.normalTextureTransformMatrix,r.hasEmissionTextureTransform=!!t.emissiveTextureTransformMatrix,r.hasOcclusionTextureTransform=!!t.occlusionTextureTransformMatrix,r.hasMetallicRoughnessTextureTransform=!!t.metallicRoughnessTextureTransformMatrix}intersect(e,u,c,h,m,p){if(null!=this.parameters.verticalOffset){const e=c.camera;t(z,u[12],u[13],u[14]);let p=null;switch(c.viewingMode){case 1:p=s(B,z);break;case 2:p=r(B,_)}const d=i(F,z,e.eye),f=a(d),T=o(d,d,1/f);let x=null;this.parameters.screenSizePerspective&&(x=n(p,T));const g=b(e,f,this.parameters.verticalOffset,x??0,this.parameters.screenSizePerspective,null);o(p,p,g),l(N,p,c.transform.inverseRotation),h=i(A,h,N),m=i(V,m,N)}p=S(p,this._configuration,h,m),x(e,c,h,m,g(c.verticalOffset),p)}createGLMaterial(e){return new P(e)}createBufferWriter(){return new v(this._layout)}get transparent(){return I(this.parameters)}}class P extends f{constructor(e){super({...e,...e.material.parameters})}beginSlot(e){this._material.setParameters({receiveShadows:e.shadowMap.enabled});const r=this._material.parameters;this.updateTexture(r.textureId);const s=e.camera.viewInverseTransposeMatrix;return t(r.origin,s[3],s[7],s[11]),this._material.setParameters(this.textureBindParameters),this.getTechnique(r.treeRendering?y:C,e)}}class j extends O{constructor(){super(...arguments),this.treeRendering=!1,this.useIndexing=!1,this.hasVertexTangents=!1}get hasNormalTexture(){return!this.treeRendering&&!!this.normalTextureId}get hasColorTexture(){return!!this.textureId}get hasMetallicRoughnessTexture(){return!this.treeRendering&&!!this.metallicRoughnessTextureId}get hasOcclusionTexture(){return!this.treeRendering&&!!this.occlusionTextureId}get emissiveStrength(){return this.emissiveStrengthFromSymbol*this.emissiveStrengthKHR}get emissionSource(){return this.treeRendering?0:null!=this.emissiveTextureId&&0===this.emissiveSource?3:0===this.emissiveSource?2:1}get hasTextures(){return this.hasColorTexture||this.hasNormalTexture||this.hasMetallicRoughnessTexture||3===this.emissionSource||this.hasOcclusionTexture}}function I(e){const{drivenOpacity:t,opacity:r,externalColor:s,layerOpacity:i,texture:a,textureId:o,textureAlphaMode:n,colorMixMode:l}=e,u=s[3];return t||r<1&&"replace"!==l||u<1&&"ignore"!==l||i<1||(null!=a||null!=o)&&1!==n&&2!==n&&"replace"!==l}const A=c(),V=c(),_=h(0,0,1),B=c(),N=c(),z=c(),F=c();export{P as DefaultGLMaterial,D as DefaultMaterial,j as DefaultMaterialParameters,I as isTransparent};
2
+ import{exactEquals as e,set as t,copy as r,normalize as s,subtract as i,length as a,scale as o,dot as n,transformMat3 as l}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{ZEROS as u,create as c,fromValues as h}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{is3DGeometryOrShadowLike as m,isColor as p}from"../core/shaderLibrary/ShaderOutput.js";import{GLTextureMaterial as d}from"../lib/GLTextureMaterial.js";import{Material as f}from"../lib/Material.js";import{intersectTriangleGeometry as T}from"../lib/RayIntersections.js";import{getVerticalOffsetObject3D as x}from"../lib/verticalOffsetUtils.js";import{DefaultBufferWriter as g}from"./DefaultBufferWriter.js";import{intersectWithPolygonOffset as v}from"./PolygonOffset.js";import{verticalOffsetAtDistance as S}from"./internal/MaterialUtil.js";import{getLayout as b,DefaultMaterialPassParameters as M,DefaultMaterialTechnique as O}from"../shaders/DefaultMaterialTechnique.js";import{DefaultMaterialTechniqueConfiguration as C}from"../shaders/DefaultMaterialTechniqueConfiguration.js";import{RealisticTreeTechnique as w}from"../shaders/RealisticTreeTechnique.js";import{alphaCutoff as y}from"../../../../webscene/support/AlphaCutoff.js";class R extends f{constructor(e,t){super(e,P),this.materialType="default",this.supportsEdges=!0,this.intersectDraped=void 0,this.produces=new Map([[2,e=>m(e)&&!this.transparent],[4,e=>m(e)&&this.transparent&&this.parameters.writeDepth],[9,e=>m(e)&&this.transparent&&!this.parameters.writeDepth]]),this._layout=b(this.parameters),this._configuration=new C(t.spherical)}isVisibleForOutput(e){return 5!==e&&7!==e&&6!==e||this.parameters.castShadows}get visible(){const{layerOpacity:e,colorMixMode:t,opacity:r,externalColor:s}=this.parameters;return e*("replace"===t?1:r)*("ignore"===t||isNaN(s[3])?1:s[3])>=y}get _hasEmissiveBase(){return!!this.parameters.emissiveTextureId||!e(this.parameters.emissiveBaseColor,u)}get hasEmissions(){return this.parameters.emissiveStrength>0&&(0===this.parameters.emissiveSource&&this._hasEmissiveBase||1===this.parameters.emissiveSource)}updateConfiguration(e){super.updateConfiguration(e);const{parameters:t,_configuration:r}=this;r.hasNormalTexture=t.hasNormalTexture,r.hasColorTexture=t.hasColorTexture,r.hasMetallicRoughnessTexture=t.hasMetallicRoughnessTexture,r.hasOcclusionTexture=t.hasOcclusionTexture;const{treeRendering:s,doubleSided:i,doubleSidedType:a}=t;r.hasVertexTangents=!s&&t.hasVertexTangents,r.instanced=t.instanced,r.instancedDoublePrecision=t.instancedDoublePrecision,r.hasVVColor=!!t.vvColor,r.hasVVSize=!!t.vvSize,r.hasVerticalOffset=null!=t.verticalOffset,r.hasScreenSizePerspective=null!=t.screenSizePerspective,r.hasSlicePlane=t.hasSlicePlane,r.alphaDiscardMode=t.textureAlphaMode,r.normalType=s?0:t.normalType,r.transparent=this.transparent,r.enableOITOffset=e.enableOITOffset,r.writeDepth=t.writeDepth,r.customDepthTest=t.customDepthTest??0,r.hasOccludees=e.hasOccludees,r.cullFace=t.hasSlicePlane?0:t.cullFace,r.cullAboveTerrain=e.cullAboveTerrain,r.hasModelTransformation=!s&&null!=t.modelTransformation,r.hasVertexColors=t.hasVertexColors,r.hasSymbolColors=t.hasSymbolColors,r.doubleSidedMode=s?2:i&&"normal"===a?1:i&&"winding-order"===a?2:0,r.instancedFeatureAttribute=t.instancedFeatureAttribute,r.instancedColor=t.instancedColor,p(e.output)?(r.terrainDepthTest=e.terrainDepthTest,r.receiveShadows=t.receiveShadows,r.receiveAmbientOcclusion=t.receiveAmbientOcclusion&&null!=e.ssao):(r.terrainDepthTest=!1,r.receiveShadows=r.receiveAmbientOcclusion=!1),r.textureAlphaPremultiplied=!!t.textureAlphaPremultiplied,r.pbrMode=t.usePBR?t.isSchematic?2:1:0,r.emissionSource=t.emissionSource,r.offsetBackfaces=!(!this.transparent||!t.offsetTransparentBackfaces),r.snowCover=e.snowCover>0,r.hasColorTextureTransform=!!t.colorTextureTransformMatrix,r.hasNormalTextureTransform=!!t.normalTextureTransformMatrix,r.hasEmissionTextureTransform=!!t.emissiveTextureTransformMatrix,r.hasOcclusionTextureTransform=!!t.occlusionTextureTransformMatrix,r.hasMetallicRoughnessTextureTransform=!!t.metallicRoughnessTextureTransformMatrix}intersect(e,u,c,h,m,p){if(null!=this.parameters.verticalOffset){const e=c.camera;t(N,u[12],u[13],u[14]);let p=null;switch(c.viewingMode){case 1:p=s(_,N);break;case 2:p=r(_,V)}const d=i(z,N,e.eye),f=a(d),T=o(d,d,1/f);let x=null;this.parameters.screenSizePerspective&&(x=n(p,T));const g=S(e,f,this.parameters.verticalOffset,x??0,this.parameters.screenSizePerspective,null);o(p,p,g),l(B,p,c.transform.inverseRotation),h=i(I,h,B),m=i(A,m,B)}p=v(p,this._configuration,h,m),T(e,c,h,m,x(c.verticalOffset),p)}createGLMaterial(e){return new D(e)}createBufferWriter(){return new g(this._layout)}get transparent(){return j(this.parameters)}}class D extends d{constructor(e){super({...e,...e.material.parameters})}beginSlot(e){this._material.setParameters({receiveShadows:e.shadowMap.enabled});const r=this._material.parameters;this.updateTexture(r.textureId);const s=e.camera.viewInverseTransposeMatrix;return t(r.origin,s[3],s[7],s[11]),this._material.setParameters(this.textureBindParameters),this.getTechnique(r.treeRendering?w:O,e)}}class P extends M{constructor(){super(...arguments),this.treeRendering=!1,this.useIndexing=!1,this.hasVertexTangents=!1}get hasNormalTexture(){return!this.treeRendering&&!!this.normalTextureId}get hasColorTexture(){return!!this.textureId}get hasMetallicRoughnessTexture(){return!this.treeRendering&&!!this.metallicRoughnessTextureId}get hasOcclusionTexture(){return!this.treeRendering&&!!this.occlusionTextureId}get emissiveStrength(){return this.emissiveStrengthFromSymbol*this.emissiveStrengthKHR}get emissionSource(){return this.treeRendering?0:null!=this.emissiveTextureId&&0===this.emissiveSource?3:0===this.emissiveSource?2:1}get hasTextures(){return this.hasColorTexture||this.hasNormalTexture||this.hasMetallicRoughnessTexture||3===this.emissionSource||this.hasOcclusionTexture}}function j(e){const{drivenOpacity:t,opacity:r,externalColor:s,layerOpacity:i,texture:a,textureId:o,textureAlphaMode:n,colorMixMode:l}=e,u=s[3];return t||r<1&&"replace"!==l||u<1&&"ignore"!==l||i<1||(null!=a||null!=o)&&1!==n&&2!==n&&"replace"!==l}const I=c(),A=c(),V=h(0,0,1),_=c(),B=c(),N=c(),z=c();export{D as DefaultGLMaterial,R as DefaultMaterial,P as DefaultMaterialParameters,j as isTransparent};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{clamp as t}from"../../../../core/mathUtils.js";import{clone as e}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{fromValues as i}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as r}from"../../../../geometry/support/aaBoundingBox.js";import{isShadowLike as s,is3DGeometryOutputMRT as a,isColor as o}from"../core/shaderLibrary/ShaderOutput.js";import n from"../lib/GLMaterial.js";import{isPathGeometry as h}from"../lib/PathGeometry.js";import{MeshIntersectionOptions as p,intersectAabbInvDir as c}from"../lib/RayIntersections.js";import{DefaultBufferWriter as u}from"./DefaultBufferWriter.js";import{getLayout as m,PathPassParameters as l,PathTechnique as d}from"./PathTechnique.js";import{PathTechniqueConfiguration as f}from"./PathTechniqueConfiguration.js";import{TriangleMaterial as b}from"./TriangleMaterial.js";import{alphaCutoff as g}from"../../../../webscene/support/AlphaCutoff.js";class _ extends b{constructor(t,e){super(t,w),this.supportsEdges=!0,this._pp0=i(0,0,1),this._pp1=i(0,0,0),this.produces=new Map([[2,t=>(this.parameters.castShadows&&s(t)||a(t))&&!this.transparent],[4,t=>(this.parameters.castShadows&&s(t)||a(t))&&this.transparent]]),this._configuration=new f(e.spherical)}get hasEmissions(){return this.parameters.emissiveStrength>0}updateConfiguration(t){super.updateConfiguration(t),this._configuration.hasVVSize=this.parameters.hasVVSize,this._configuration.hasVVColor=this.parameters.hasVVColor,this._configuration.hasVVOpacity=this.parameters.hasVVOpacity,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.transparent=this.transparent,this._configuration.hasOccludees=t.hasOccludees,o(t.output)?(this._configuration.doubleSidedMode=this.parameters.doubleSided&&"normal"===this.parameters.doubleSidedType?1:this.parameters.doubleSided&&"winding-order"===this.parameters.doubleSidedType?2:0,this._configuration.receiveShadows=t.shadowMap.enabled,this._configuration.receiveAmbientOcclusion=null!=t.ssao):this._configuration.receiveShadows=this._configuration.receiveAmbientOcclusion=!1,this._configuration.pbrMode=this.parameters.usePBR?2:0,this._configuration.emissionSource=this.parameters.usePBR?1:0,this._configuration.terrainDepthTest=t.terrainDepthTest,this._configuration.cullAboveTerrain=t.cullAboveTerrain,this._configuration.snowCover=t.snowCover>0}isVisibleForOutput(t){return 5!==t&&7!==t&&6!==t||this.parameters.castShadows}get visible(){return this.parameters.opacity>=g}intersect(t,e,i,r,s,a){this._intersect(t,i,r,s,a)}intersectDraped(t,e,i,r){return this._pp0[0]=this._pp1[0]=i[0],this._pp0[1]=this._pp1[1]=i[1],this._intersect(t,e,this._pp0,this._pp1,r)}_intersect(i,s,a,o,n){const u=i;if(!h(u))return;const m=u.path,l=e(this.parameters.size);if(this.parameters.vvSize){const{offset:e,factor:i,minSize:r,maxSize:s,fallback:a}=this.parameters.vvSize,o=m.sizeAttributeValue;Number.isNaN(o)?(l[0]*=a[0],l[1]*=a[2]):(l[0]*=t(e[0]+o*i[0],r[0],s[0]),l[1]*=t(e[2]+o*i[2],r[2],s[2]))}const d=new p(s.tolerance,!1,s.options.normalRequired),f=Math.max(l[0],l[1]),b=i.boundingInfo;if(null==b)return void v(m,l,a,o,d,n);const g=r(b.bbMin[0]-f,b.bbMin[1]-f,b.bbMin[2]-f,b.bbMax[0]+f,b.bbMax[1]+f,b.bbMax[2]+f),_=[o[0]-a[0],o[1]-a[1],o[2]-a[2]],S=Math.sqrt(_[0]*_[0]+_[1]*_[1]+_[2]*_[2]),w=[S/_[0],S/_[1],S/_[2]];c(g,a,w,s.tolerance)&&v(m,l,a,o,d,n)}createBufferWriter(){return new u(m(this.parameters))}createGLMaterial(t){return new S(t)}get transparent(){const{parameters:t}=this;return t.drivenOpacity||t.opacity<1}}class S extends n{beginSlot(t){return this.getTechnique(d,t)}}function v(t,e,i,r,s,a){t.baked.size&&t.baked.size[0]===e[0]&&t.baked.size[1]===e[1]||t.baked.bake(e),t.baked.intersect(i,r,s,a)}class w extends l{constructor(){super(...arguments),this.doubleSided=!1,this.doubleSidedType="normal",this.polygonOffset=0,this.castShadows=!0,this.hasSlicePlane=!1,this.drivenOpacity=!1,this.usePBR=!1}}export{w as Parameters,_ as PathMaterial};
2
+ import{clamp as t}from"../../../../core/mathUtils.js";import{clone as e}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{fromValues as i}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as r}from"../../../../geometry/support/aaBoundingBox.js";import{isShadowLike as s,is3DGeometry as a,isColor as o}from"../core/shaderLibrary/ShaderOutput.js";import n from"../lib/GLMaterial.js";import{isPathGeometry as h}from"../lib/PathGeometry.js";import{MeshIntersectionOptions as p,intersectAabbInvDir as c}from"../lib/RayIntersections.js";import{DefaultBufferWriter as u}from"./DefaultBufferWriter.js";import{getLayout as m,PathPassParameters as l,PathTechnique as d}from"./PathTechnique.js";import{PathTechniqueConfiguration as f}from"./PathTechniqueConfiguration.js";import{TriangleMaterial as b}from"./TriangleMaterial.js";import{alphaCutoff as g}from"../../../../webscene/support/AlphaCutoff.js";class _ extends b{constructor(t,e){super(t,w),this.supportsEdges=!0,this._pp0=i(0,0,1),this._pp1=i(0,0,0),this.produces=new Map([[2,t=>(this.parameters.castShadows&&s(t)||a(t))&&!this.transparent],[4,t=>(this.parameters.castShadows&&s(t)||a(t))&&this.transparent]]),this._configuration=new f(e.spherical)}get hasEmissions(){return this.parameters.emissiveStrength>0}updateConfiguration(t){super.updateConfiguration(t),this._configuration.hasVVSize=this.parameters.hasVVSize,this._configuration.hasVVColor=this.parameters.hasVVColor,this._configuration.hasVVOpacity=this.parameters.hasVVOpacity,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.transparent=this.transparent,this._configuration.hasOccludees=t.hasOccludees,o(t.output)?(this._configuration.doubleSidedMode=this.parameters.doubleSided&&"normal"===this.parameters.doubleSidedType?1:this.parameters.doubleSided&&"winding-order"===this.parameters.doubleSidedType?2:0,this._configuration.receiveShadows=t.shadowMap.enabled,this._configuration.receiveAmbientOcclusion=null!=t.ssao):this._configuration.receiveShadows=this._configuration.receiveAmbientOcclusion=!1,this._configuration.pbrMode=this.parameters.usePBR?2:0,this._configuration.emissionSource=this.parameters.usePBR?1:0,this._configuration.terrainDepthTest=t.terrainDepthTest,this._configuration.cullAboveTerrain=t.cullAboveTerrain,this._configuration.snowCover=t.snowCover>0}isVisibleForOutput(t){return 5!==t&&7!==t&&6!==t||this.parameters.castShadows}get visible(){return this.parameters.opacity>=g}intersect(t,e,i,r,s,a){this._intersect(t,i,r,s,a)}intersectDraped(t,e,i,r){return this._pp0[0]=this._pp1[0]=i[0],this._pp0[1]=this._pp1[1]=i[1],this._intersect(t,e,this._pp0,this._pp1,r)}_intersect(i,s,a,o,n){const u=i;if(!h(u))return;const m=u.path,l=e(this.parameters.size);if(this.parameters.vvSize){const{offset:e,factor:i,minSize:r,maxSize:s,fallback:a}=this.parameters.vvSize,o=m.sizeAttributeValue;Number.isNaN(o)?(l[0]*=a[0],l[1]*=a[2]):(l[0]*=t(e[0]+o*i[0],r[0],s[0]),l[1]*=t(e[2]+o*i[2],r[2],s[2]))}const d=new p(s.tolerance,!1,s.options.normalRequired),f=Math.max(l[0],l[1]),b=i.boundingInfo;if(null==b)return void v(m,l,a,o,d,n);const g=r(b.bbMin[0]-f,b.bbMin[1]-f,b.bbMin[2]-f,b.bbMax[0]+f,b.bbMax[1]+f,b.bbMax[2]+f),_=[o[0]-a[0],o[1]-a[1],o[2]-a[2]],S=Math.sqrt(_[0]*_[0]+_[1]*_[1]+_[2]*_[2]),w=[S/_[0],S/_[1],S/_[2]];c(g,a,w,s.tolerance)&&v(m,l,a,o,d,n)}createBufferWriter(){return new u(m(this.parameters))}createGLMaterial(t){return new S(t)}get transparent(){const{parameters:t}=this;return t.drivenOpacity||t.opacity<1}}class S extends n{beginSlot(t){return this.getTechnique(d,t)}}function v(t,e,i,r,s,a){t.baked.size&&t.baked.size[0]===e[0]&&t.baked.size[1]===e[1]||t.baked.bake(e),t.baked.intersect(i,r,s,a)}class w extends l{constructor(){super(...arguments),this.doubleSided=!1,this.doubleSidedType="normal",this.polygonOffset=0,this.castShadows=!0,this.hasSlicePlane=!1,this.drivenOpacity=!1,this.usePBR=!1}}export{w as Parameters,_ as PathMaterial};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{normalize as t,sub as r,dot as o}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{isOITColor as s}from"../core/shaderLibrary/ShaderOutput.js";const c={factor:1,units:1},f={factor:1,units:2},i={factor:0,units:-4},u={factor:-5,units:-5},a={factor:-1,units:-2},e=new Array;e[0]=null,e[1]=c,e[2]=u,e[3]=i,e[4]=f;const m=e.map(t=>p(a,t));function l({output:t,enableOITOffset:r,polygonOffset:o}){return s(t)&&r?m[o]:e[o]}function p(t,r){return r?{factor:t.factor+r.factor,units:t.units+r.units}:t}function b(n,s,c,f){const i=l(s);if(!i)return n;const u=g*i.units,a=t(h,r(h,f,c));return(t,r,s)=>{const c=(r?1-Math.abs(o(a,r)):0)*i.factor*O+u;return n(t+c,r,s)}}e[1]=c;const h=n(),O=5e-5,g=5e-6;export{i as hudPolygonOffset,b as intersectWithPolygonOffset,l as polygonOffset};
2
+ import{normalize as t,sub as r,dot as n}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as o}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{isOITColor as s}from"../core/shaderLibrary/ShaderOutput.js";const f={factor:1,units:1},c={factor:1,units:2},u={factor:0,units:-4},e={factor:-5,units:-5},i={factor:-1,units:-2},a=new Array;a[0]=null,a[1]=f,a[2]=e,a[3]=u,a[4]=c;const l=a.map(t=>p(i,t));function m({output:t,enableOITOffset:r,polygonOffset:n}){return s(t)&&r?l[n]:a[n]}function p(t,r){return r?{factor:t.factor+r.factor,units:t.units+r.units}:t}function O(o,s,f,c){const u=m(s);if(!u)return o;const e=x*u.units,i=t(b,r(b,c,f));return(t,r,s)=>{const f=(r?1-Math.abs(n(i,r)):0)*u.factor*g+e;return o(t+f,r,s)}}a[1]=f;const b=o(),g=5e-5,x=5e-6,y=1,d=1;function h(t){const r=m(t)??{factor:0,units:0};return{factor:r.factor-y*t.polygonOffsetIndex,units:r.units-d*t.polygonOffsetIndex}}export{h as getRibbonLineLayerPolygonOffset,u as hudPolygonOffset,O as intersectWithPolygonOffset,m as polygonOffset};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import t from"../../../../core/Logger.js";import{clamp as e}from"../../../../core/mathUtils.js";import{createRenderScreenPointArray3 as i}from"../../../../core/screenUtils.js";import{secondsFromMilliseconds as r,Seconds as s}from"../../../../core/time.js";import{copy as a}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{set as n,subtract as o,dot as l,scale as h,add as p,copy as m,length as c,distance as u,transformMat4 as f}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as d}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{set as g}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{ONES as b,create as _}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{makeFloat16Array as S}from"../../../../geometry/support/float16.js";import{distance2 as v,fromPoints as P,closestLineSegmentPoint as w,create as j}from"../../../../geometry/support/lineSegment.js";import{fromPoints as y,signedDistance as E,getNormal as T,create as z}from"../../../../geometry/support/plane.js";import{isHighlightOrOLID as A,isColor as C,isDepth as x,isColorHighlightOLIDOrDepth as L,is2DGeometryOutput as M}from"../core/shaderLibrary/ShaderOutput.js";import{olidEnabled as O}from"../effects/geometry/olidUtils.js";import V from"../lib/GLMaterial.js";import{Material as R}from"../lib/Material.js";import{isTranslationMatrix as F}from"../lib/Util.js";import{isImagePattern as N}from"./lineStippleUtils.js";import{VisualVariablePassParameters as k}from"./VisualVariablePassParameters.js";import{writeDeltaF16Vector as U}from"./internal/bufferWriterUtils.js";import{r as D}from"../../../../chunks/RibbonLine.glsl.js";import{getLayout as B,RibbonLineTechnique as W}from"../shaders/RibbonLineTechnique.js";import{RibbonLineTechniqueConfiguration as J}from"../shaders/RibbonLineTechniqueConfiguration.js";import{alphaCutoff as I}from"../../../../webscene/support/AlphaCutoff.js";class Y extends R{constructor(t,e){super(t,X),this.produces=new Map([[2,t=>A(t)||C(t)&&8===this.parameters.renderOccluded],[3,t=>x(t)],[11,t=>L(t)&&8===this.parameters.renderOccluded],[12,t=>L(t)&&8===this.parameters.renderOccluded],[4,t=>C(t)&&this.parameters.writeDepth&&8!==this.parameters.renderOccluded],[9,t=>C(t)&&!this.parameters.writeDepth&&8!==this.parameters.renderOccluded],[19,t=>M(t)]]),this._configuration=new J(e)}updateConfiguration(t){super.updateConfiguration(t);const e=19===t.slot,i=null!=this.parameters.stipplePattern&&null!=this.parameters.stippleTexture&&10!==t.output,r=i&&e&&this.parameters.isImagePattern();this._configuration.draped=e,this._configuration.polygonOffset=this.parameters.polygonOffset,this._configuration.stippleEnabled=i,this._configuration.stippleOffColorEnabled=i&&null!=this.parameters.stippleOffColor,this._configuration.stipplePreferContinuous=i&&this.parameters.stipplePreferContinuous,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.roundJoins="round"===this.parameters.join,this._configuration.capType=this.parameters.cap,this._configuration.applyMarkerOffset=null!=this.parameters.markerParameters&&Q(this.parameters.markerParameters),this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.hasVVSize=this.parameters.hasVVSize,this._configuration.hasVVColor=this.parameters.hasVVColor,this._configuration.hasVVOpacity=this.parameters.hasVVOpacity,this._configuration.innerColorEnabled=this.parameters.innerWidth>0&&null!=this.parameters.innerColor,this._configuration.falloffEnabled=this.parameters.falloff>0,this._configuration.hasOccludees=t.hasOccludees,this._configuration.occluder=8===this.parameters.renderOccluded,this._configuration.terrainDepthTest=t.terrainDepthTest&&C(t.output),this._configuration.cullAboveTerrain=t.cullAboveTerrain,this._configuration.wireframe=this.parameters.wireframe,this._configuration.animation=this.parameters.animation,this._configuration.emissionSource=this.hasEmissions?1:0,this._configuration.hasScreenSizePerspective=!!this.parameters.screenSizePerspective&&!r,this._configuration.worldSizedImagePattern=r}get visible(){return this.parameters.color[3]>=I||null!=this.parameters.stipplePattern&&(this.parameters.stippleOffColor?.[3]??0)>I}setParameters(t,e){t.animation=this.parameters.animation,super.setParameters(t,e)}intersectDraped({attributes:t,screenToWorldRatio:i},r,s,a,n){if(!r.options.selectionMode)return;const o=t.get("size");let l=this.parameters.width;if(this.parameters.vvSize){const i=t.get("sizeFeatureAttribute").data[0];Number.isNaN(i)?l*=this.parameters.vvSize.fallback[0]:l*=e(this.parameters.vvSize.offset[0]+i*this.parameters.vvSize.factor[0],this.parameters.vvSize.minSize[0],this.parameters.vvSize.maxSize[0])}else o&&(l*=o.data[0]);const h=s[0],p=s[1],m=(l/2+4)*i;let c=Number.MAX_VALUE,u=0;const f=t.get("position").data,d=K(this.parameters,t)?f.length-2:f.length-5;for(let g=0;g<d;g+=3){const t=f[g],i=f[g+1],r=(g+3)%f.length,s=h-t,a=p-i,n=f[r]-t,o=f[r+1]-i,l=e((n*s+o*a)/(n*n+o*o),0,1),m=n*l-s,d=o*l-a,b=m*m+d*d;b<c&&(c=b,u=g/3)}c<m*m&&a(n.distance,n.normal,u)}intersect(i,r,s,f,d,g){const{options:b,camera:_,rayBegin:S,rayEnd:j}=s;if(!b.selectionMode||!i.visible||!_)return;if(!F(r))return void t.getLogger("esri.views.3d.webgl-engine.materials.RibbonLineMaterial").error("intersection assumes a translation-only matrix");const z=i.attributes,A=z.get("position").data;let C=this.parameters.width;if(this.parameters.vvSize){const t=z.get("sizeFeatureAttribute").data[0];Number.isNaN(t)||(C*=e(this.parameters.vvSize.offset[0]+t*this.parameters.vvSize.factor[0],this.parameters.vvSize.minSize[0],this.parameters.vvSize.maxSize[0]))}else z.has("size")&&(C*=z.get("size").data[0]);const x=it;a(x,s.point);const L=C*_.pixelRatio/2+4*_.pixelRatio;n(ut[0],x[0]-L,x[1]+L,0),n(ut[1],x[0]+L,x[1]+L,0),n(ut[2],x[0]+L,x[1]-L,0),n(ut[3],x[0]-L,x[1]-L,0);for(let t=0;t<4;t++)if(!_.unprojectFromRenderScreen(ut[t],ft[t]))return;y(_.eye,ft[0],ft[1],dt),y(_.eye,ft[1],ft[2],gt),y(_.eye,ft[2],ft[3],bt),y(_.eye,ft[3],ft[0],_t);let M=Number.MAX_VALUE,O=0;const V=K(this.parameters,z)?A.length-2:A.length-5;for(let t=0;t<V;t+=3){Z[0]=A[t]+r[12],Z[1]=A[t+1]+r[13],Z[2]=A[t+2]+r[14];const e=(t+3)%A.length;if($[0]=A[e]+r[12],$[1]=A[e+1]+r[13],$[2]=A[e+2]+r[14],E(dt,Z)<0&&E(dt,$)<0||E(gt,Z)<0&&E(gt,$)<0||E(bt,Z)<0&&E(bt,$)<0||E(_t,Z)<0&&E(_t,$)<0)continue;const i=_.projectToRenderScreen(Z,rt),s=_.projectToRenderScreen($,st);if(null==i||null==s)continue;if(i[2]<0&&s[2]>0){o(tt,Z,$);const t=_.frustum,e=-E(t[4],Z)/l(tt,T(t[4]));if(h(tt,tt,e),p(Z,Z,tt),!_.projectToRenderScreen(Z,i))continue}else if(i[2]>0&&s[2]<0){o(tt,$,Z);const t=_.frustum,e=-E(t[4],$)/l(tt,T(t[4]));if(h(tt,tt,e),p($,$,tt),!_.projectToRenderScreen($,s))continue}else if(i[2]<0&&s[2]<0)continue;i[2]=0,s[2]=0;const a=v(P(i,s,ot),x);a<M&&(M=a,m(at,Z),m(nt,$),O=t/3)}if(M<L*L){let t=Number.MAX_VALUE;if(w(P(at,nt,ot),P(S,j,lt),et)){o(et,et,S);const e=c(et);h(et,et,1/e),t=e/u(S,j)}g(t,et,O)}}get hasEmissions(){return this.parameters.emissiveStrength>0}createBufferWriter(){return new G(B(this.parameters),this.parameters)}createGLMaterial(t){return new q(t)}validateParameters(t){"miter"!==t.join&&(t.miterLimit=0),null!=t.markerParameters&&(t.markerScale=t.markerParameters.width/t.width)}update(t){return!!this.parameters.hasAnimation&&(this.setParameters({timeElapsed:r(t.time)},!1),0!==t.dt)}}class q extends V{constructor(){super(...arguments),this._stipplePattern=null}dispose(){super.dispose(),this._stippleTextures?.release(this._stipplePattern),this._stipplePattern=null}beginSlot(t){const{stipplePattern:e}=this._material.parameters;return this._stipplePattern!==e&&(this._material.setParameters({stippleTexture:this._stippleTextures.swap(e,this._stipplePattern)}),this._stipplePattern=e),this.getTechnique(W,t)}}class X extends k{constructor(){super(...arguments),this._width=0,this.color=b,this.join="miter",this.cap=0,this.miterLimit=5,this.writeDepth=!0,this.polygonOffset=0,this.stippleTexture=null,this.stipplePreferContinuous=!0,this.markerParameters=null,this.markerScale=1,this.hasSlicePlane=!1,this.vvFastUpdate=!1,this.isClosed=!1,this.falloff=0,this.innerWidth=0,this.wireframe=!1,this.timeElapsed=s(0),this.animation=0,this.animationSpeed=1,this.trailLength=1,this.startTime=s(0),this.endTime=s(1/0),this.emissiveStrength=0}get width(){return this.isImagePattern()?this.stipplePattern.width:this._width}set width(t){this._width=t}get transparent(){return this.color[3]<1||this.hasAnimation||null!=this.stipplePattern&&(this.stippleOffColor?.[3]??0)<1}get hasAnimation(){return 0!==this.animation}isImagePattern(){return N(this.stipplePattern)&&null!=this.stippleTexture}}class G{constructor(t,e){this.layout=t,this._parameters=e;const i=e.stipplePattern?1:0;switch(this._parameters.join){case"miter":case"bevel":this.numJoinSubdivisions=i;break;case"round":this.numJoinSubdivisions=D+i}}_isClosed(t){return K(this._parameters,t)}allocate(t){return this.layout.createBuffer(t)}elementCount(t){const e=2,i=t.get("position").indices.length/2+1,r=this._isClosed(t);let s=r?2:2*e;return s+=((r?i:i-1)-(r?0:1))*(2*this.numJoinSubdivisions+4),s+=2,this._parameters.wireframe&&(s=2+4*(s-2)),s}write(t,e,i,r,s,a){const o=this.layout,l=i.get("position"),h=l.indices,p=l.data.length/3,c=i.get("distanceToStart")?.data;h&&h.length!==2*(p-1)&&console.warn("RibbonLineMaterial does not support indices");const d=o.fields.has("sizeFeatureAttribute");let b=1,_=null;if(d){const t=i.get("sizeFeatureAttribute");1===t.data.length?b=t.data[0]:_=t.data}else b=i.get("size")?.data[0]??1;let v=[1,1,1,1],P=0,w=null;const j=o.fields.has("colorFeatureAttribute");if(j){const t=i.get("colorFeatureAttribute");1===t.data.length?P=t.data[0]:w=t.data}else v=i.get("color")?.data??v;const y=i.get("timeStamps")?.data,E=y&&o.fields.has("timeStamps"),T=o.fields.has("opacityFeatureAttribute");let z=0,A=null;if(T){const t=i.get("opacityFeatureAttribute");1===t.data.length?z=t.data[0]:A=t.data}const C=new Float32Array(s.buffer),x=S(s.buffer),L=new Uint8Array(s.buffer),M=o.stride/4;let V=a*M;const R=V;let F=0;const N=c?(t,e,i)=>F=c[i]:(t,e,i)=>F+=u(t,e),k=C.BYTES_PER_ELEMENT/x.BYTES_PER_ELEMENT,D=4/k,B=O(),W=(t,e,i,s,a,n,o,l)=>{C[V++]=e[0],C[V++]=e[1],C[V++]=e[2],U(t,e,x,V*k),V+=D,U(i,e,x,V*k),V+=D,C[V++]=l;let h=V*k;if(x[h++]=a,x[h++]=n,V=Math.ceil(h/k),j)C[V]=w?.[o]??P;else{const t=Math.min(4*o,v.length-4),e=4*V;L[e]=255*v[t],L[e+1]=255*v[t+1],L[e+2]=255*v[t+2],L[e+3]=255*v[t+3]}if(V++,C[V++]=_?.[o]??b,T&&(C[V++]=A?.[o]??z),B){let t=4*V;r?(L[t++]=r[0],L[t++]=r[1],L[t++]=r[2],L[t++]=r[3]):(L[t++]=0,L[t++]=0,L[t++]=0,L[t++]=0),V=Math.ceil(.25*t)}E&&(h=V*k,x[h++]=s[0],x[h++]=s[1],x[h++]=s[2],x[h++]=s[3],V=Math.ceil(h/k))};V+=M,n(pt,l.data[0],l.data[1],l.data[2]),E&&g(ct,y[0],y[1],y[2],y[3]),t&&f(pt,pt,t);const J=this._isClosed(i);if(J){const e=l.data.length-3;n(ht,l.data[e],l.data[e+1],l.data[e+2]),t&&f(ht,ht,t)}else n(mt,l.data[3],l.data[4],l.data[5]),t&&f(mt,mt,t),W(pt,pt,mt,ct,1,-4,0,0),W(pt,pt,mt,ct,1,4,0,0),m(ht,pt),m(pt,mt),E&&g(ct,y[4],y[5],y[6],y[7]);const I=J?0:1,Y=J?p:p-1;for(let u=I;u<Y;u++){const e=(u+1)%p*3;n(mt,l.data[e],l.data[e+1],l.data[e+2]),t&&f(mt,mt,t),N(ht,pt,u),W(ht,pt,mt,ct,0,-1,u,F),W(ht,pt,mt,ct,0,1,u,F);const i=this.numJoinSubdivisions;for(let t=0;t<i;++t){const e=(t+1)/(i+1);W(ht,pt,mt,ct,e,-1,u,F),W(ht,pt,mt,ct,e,1,u,F)}if(W(ht,pt,mt,ct,1,-2,u,F),W(ht,pt,mt,ct,1,2,u,F),m(ht,pt),m(pt,mt),E){const t=(u+1)%p*4;g(ct,y[t],y[t+1],y[t+2],y[t+3])}}J?(n(mt,l.data[3],l.data[4],l.data[5]),t&&f(mt,mt,t),F=N(ht,pt,Y),W(ht,pt,mt,ct,0,-1,I,F),W(ht,pt,mt,ct,0,1,I,F)):(F=N(ht,pt,Y),W(ht,pt,pt,ct,0,-5,Y,F),W(ht,pt,pt,ct,0,5,Y,F)),H(C,R+M,C,R,M);return V=H(C,V-M,C,V,M),this._parameters.wireframe&&this._addWireframeVertices(s,R,V,M),null}_addWireframeVertices(t,e,i,r){const s=new Float32Array(t.buffer,i*Float32Array.BYTES_PER_ELEMENT),a=new Float32Array(t.buffer,e*Float32Array.BYTES_PER_ELEMENT,i-e);let n=0;const o=t=>n=H(a,t,s,n,r);for(let l=0;l<a.length-1;l+=2*r)o(l),o(l+2*r),o(l+1*r),o(l+2*r),o(l+1*r),o(l+3*r)}}function H(t,e,i,r,s){for(let a=0;a<s;a++)i[r++]=t[e++];return r}function K(t,e){if(!t.isClosed)return!1;return e.get("position").indices.length>2}function Q(t){return 1===t.anchor&&t.hideOnShortSegments&&"begin-end"===t.placement&&t.worldSpace}const Z=d(),$=d(),tt=d(),et=d(),it=d(),rt=i(),st=i(),at=d(),nt=d(),ot=j(),lt=j(),ht=d(),pt=d(),mt=d(),ct=_(),ut=[i(),i(),i(),i()],ft=[d(),d(),d(),d()],dt=z(),gt=z(),bt=z(),_t=z();export{X as Parameters,Y as RibbonLineMaterial};
2
+ import t from"../../../../core/Logger.js";import{clamp as e}from"../../../../core/mathUtils.js";import{createRenderScreenPointArray3 as i}from"../../../../core/screenUtils.js";import{secondsFromMilliseconds as r,Seconds as s}from"../../../../core/time.js";import{copy as a}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{set as n,subtract as o,dot as l,scale as h,add as p,copy as m,length as c,distance as u,transformMat4 as f}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as d}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{set as g}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{ONES as b,create as _}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{makeFloat16Array as S}from"../../../../geometry/support/float16.js";import{distance2 as v,fromPoints as P,closestLineSegmentPoint as w,create as y}from"../../../../geometry/support/lineSegment.js";import{fromPoints as j,signedDistance as E,getNormal as T,create as z}from"../../../../geometry/support/plane.js";import{isHighlightOrOLID as A,isColor as x,isDepth as O,isColorHighlightOLIDOrDepth as C,is2DGeometryOutput as L}from"../core/shaderLibrary/ShaderOutput.js";import{olidEnabled as M}from"../effects/geometry/olidUtils.js";import V from"../lib/GLMaterial.js";import{Material as R}from"../lib/Material.js";import{isTranslationMatrix as F}from"../lib/Util.js";import{isImagePattern as N}from"./lineStippleUtils.js";import{VisualVariablePassParameters as k}from"./VisualVariablePassParameters.js";import{writeDeltaF16Vector as U}from"./internal/bufferWriterUtils.js";import{r as D}from"../../../../chunks/RibbonLine.glsl.js";import{getLayout as B,RibbonLineTechnique as I}from"../shaders/RibbonLineTechnique.js";import{RibbonLineTechniqueConfiguration as W}from"../shaders/RibbonLineTechniqueConfiguration.js";import{alphaCutoff as J}from"../../../../webscene/support/AlphaCutoff.js";class Y extends R{constructor(t,e){super(t,X),this.produces=new Map([[2,t=>A(t)||x(t)&&8===this.parameters.renderOccluded],[3,t=>O(t)],[11,t=>C(t)&&8===this.parameters.renderOccluded],[12,t=>C(t)&&8===this.parameters.renderOccluded],[4,t=>x(t)&&this.parameters.writeDepth&&8!==this.parameters.renderOccluded],[9,t=>x(t)&&!this.parameters.writeDepth&&8!==this.parameters.renderOccluded],[19,t=>L(t)]]),this._configuration=new W(e)}updateConfiguration(t){super.updateConfiguration(t);const e=19===t.slot,i=null!=this.parameters.stipplePattern&&null!=this.parameters.stippleTexture&&10!==t.output,r=i&&e&&this.parameters.isImagePattern();this._configuration.draped=e,this._configuration.polygonOffset=this.parameters.polygonOffset,this._configuration.stippleEnabled=i,this._configuration.stippleOffColorEnabled=i&&null!=this.parameters.stippleOffColor,this._configuration.stipplePreferContinuous=i&&this.parameters.stipplePreferContinuous,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.roundJoins="round"===this.parameters.join,this._configuration.capType=this.parameters.cap,this._configuration.applyMarkerOffset=null!=this.parameters.markerParameters&&Q(this.parameters.markerParameters),this._configuration.polygonOffsetIndex=this.parameters.polygonOffsetIndex,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.hasVVSize=this.parameters.hasVVSize,this._configuration.hasVVColor=this.parameters.hasVVColor,this._configuration.hasVVOpacity=this.parameters.hasVVOpacity,this._configuration.innerColorEnabled=this.parameters.innerWidth>0&&null!=this.parameters.innerColor,this._configuration.falloffEnabled=this.parameters.falloff>0,this._configuration.hasOccludees=t.hasOccludees,this._configuration.occluder=8===this.parameters.renderOccluded,this._configuration.terrainDepthTest=t.terrainDepthTest&&x(t.output),this._configuration.cullAboveTerrain=t.cullAboveTerrain,this._configuration.wireframe=this.parameters.wireframe,this._configuration.animation=this.parameters.animation,this._configuration.emissionSource=this.hasEmissions?1:0,this._configuration.hasScreenSizePerspective=!!this.parameters.screenSizePerspective&&!r,this._configuration.worldSizedImagePattern=r}get visible(){return this.parameters.color[3]>=J||null!=this.parameters.stipplePattern&&(this.parameters.stippleOffColor?.[3]??0)>J}setParameters(t,e){t.animation=this.parameters.animation,super.setParameters(t,e)}intersectDraped({attributes:t,screenToWorldRatio:i},r,s,a,n){if(!r.options.selectionMode)return;const o=t.get("size");let l=this.parameters.width;if(this.parameters.vvSize){const i=t.get("sizeFeatureAttribute").data[0];Number.isNaN(i)?l*=this.parameters.vvSize.fallback[0]:l*=e(this.parameters.vvSize.offset[0]+i*this.parameters.vvSize.factor[0],this.parameters.vvSize.minSize[0],this.parameters.vvSize.maxSize[0])}else o&&(l*=o.data[0]);const h=s[0],p=s[1],m=(l/2+4)*i;let c=Number.MAX_VALUE,u=0;const f=t.get("position").data,d=K(this.parameters,t)?f.length-2:f.length-5;for(let g=0;g<d;g+=3){const t=f[g],i=f[g+1],r=(g+3)%f.length,s=h-t,a=p-i,n=f[r]-t,o=f[r+1]-i,l=e((n*s+o*a)/(n*n+o*o),0,1),m=n*l-s,d=o*l-a,b=m*m+d*d;b<c&&(c=b,u=g/3)}c<m*m&&a(n.distance,n.normal,u)}intersect(i,r,s,f,d,g){const{options:b,camera:_,rayBegin:S,rayEnd:y}=s;if(!b.selectionMode||!i.visible||!_)return;if(!F(r))return void t.getLogger("esri.views.3d.webgl-engine.materials.RibbonLineMaterial").error("intersection assumes a translation-only matrix");const z=i.attributes,A=z.get("position").data;let x=this.parameters.width;if(this.parameters.vvSize){const t=z.get("sizeFeatureAttribute").data[0];Number.isNaN(t)||(x*=e(this.parameters.vvSize.offset[0]+t*this.parameters.vvSize.factor[0],this.parameters.vvSize.minSize[0],this.parameters.vvSize.maxSize[0]))}else z.has("size")&&(x*=z.get("size").data[0]);const O=it;a(O,s.point);const C=x*_.pixelRatio/2+4*_.pixelRatio;n(ut[0],O[0]-C,O[1]+C,0),n(ut[1],O[0]+C,O[1]+C,0),n(ut[2],O[0]+C,O[1]-C,0),n(ut[3],O[0]-C,O[1]-C,0);for(let t=0;t<4;t++)if(!_.unprojectFromRenderScreen(ut[t],ft[t]))return;j(_.eye,ft[0],ft[1],dt),j(_.eye,ft[1],ft[2],gt),j(_.eye,ft[2],ft[3],bt),j(_.eye,ft[3],ft[0],_t);let L=Number.MAX_VALUE,M=0;const V=K(this.parameters,z)?A.length-2:A.length-5;for(let t=0;t<V;t+=3){Z[0]=A[t]+r[12],Z[1]=A[t+1]+r[13],Z[2]=A[t+2]+r[14];const e=(t+3)%A.length;if($[0]=A[e]+r[12],$[1]=A[e+1]+r[13],$[2]=A[e+2]+r[14],E(dt,Z)<0&&E(dt,$)<0||E(gt,Z)<0&&E(gt,$)<0||E(bt,Z)<0&&E(bt,$)<0||E(_t,Z)<0&&E(_t,$)<0)continue;const i=_.projectToRenderScreen(Z,rt),s=_.projectToRenderScreen($,st);if(null==i||null==s)continue;if(i[2]<0&&s[2]>0){o(tt,Z,$);const t=_.frustum,e=-E(t[4],Z)/l(tt,T(t[4]));if(h(tt,tt,e),p(Z,Z,tt),!_.projectToRenderScreen(Z,i))continue}else if(i[2]>0&&s[2]<0){o(tt,$,Z);const t=_.frustum,e=-E(t[4],$)/l(tt,T(t[4]));if(h(tt,tt,e),p($,$,tt),!_.projectToRenderScreen($,s))continue}else if(i[2]<0&&s[2]<0)continue;i[2]=0,s[2]=0;const a=v(P(i,s,ot),O);a<L&&(L=a,m(at,Z),m(nt,$),M=t/3)}if(L<C*C){let t=Number.MAX_VALUE;if(w(P(at,nt,ot),P(S,y,lt),et)){o(et,et,S);const e=c(et);h(et,et,1/e),t=e/u(S,y)}g(t,et,M)}}get hasEmissions(){return this.parameters.emissiveStrength>0}createBufferWriter(){return new G(B(this.parameters),this.parameters)}createGLMaterial(t){return new q(t)}validateParameters(t){"miter"!==t.join&&(t.miterLimit=0),null!=t.markerParameters&&(t.markerScale=t.markerParameters.width/t.width)}update(t){return!!this.parameters.hasAnimation&&(this.setParameters({timeElapsed:r(t.time)},!1),0!==t.dt)}}class q extends V{constructor(){super(...arguments),this._stipplePattern=null}dispose(){super.dispose(),this._stippleTextures?.release(this._stipplePattern),this._stipplePattern=null}beginSlot(t){const{stipplePattern:e}=this._material.parameters;return this._stipplePattern!==e&&(this._material.setParameters({stippleTexture:this._stippleTextures.swap(e,this._stipplePattern)}),this._stipplePattern=e),this.getTechnique(I,t)}}class X extends k{constructor(){super(...arguments),this._width=0,this.color=b,this.join="miter",this.cap=0,this.miterLimit=5,this.writeDepth=!0,this.polygonOffset=0,this.polygonOffsetIndex=0,this.stippleTexture=null,this.stipplePreferContinuous=!0,this.markerParameters=null,this.markerScale=1,this.hasSlicePlane=!1,this.vvFastUpdate=!1,this.isClosed=!1,this.falloff=0,this.innerWidth=0,this.wireframe=!1,this.timeElapsed=s(0),this.animation=0,this.animationSpeed=1,this.trailLength=1,this.startTime=s(0),this.endTime=s(1/0),this.emissiveStrength=0}get width(){return this.isImagePattern()?this.stipplePattern.width:this._width}set width(t){this._width=t}get transparent(){return this.color[3]<1||this.hasAnimation||null!=this.stipplePattern&&(this.stippleOffColor?.[3]??0)<1}get hasAnimation(){return 0!==this.animation}isImagePattern(){return N(this.stipplePattern)&&null!=this.stippleTexture}}class G{constructor(t,e){this.layout=t,this._parameters=e;const i=e.stipplePattern?1:0;switch(this._parameters.join){case"miter":case"bevel":this.numJoinSubdivisions=i;break;case"round":this.numJoinSubdivisions=D+i}}_isClosed(t){return K(this._parameters,t)}allocate(t){return this.layout.createBuffer(t)}elementCount(t){const e=2,i=t.get("position").indices.length/2+1,r=this._isClosed(t);let s=r?2:2*e;return s+=((r?i:i-1)-(r?0:1))*(2*this.numJoinSubdivisions+4),s+=2,this._parameters.wireframe&&(s=2+4*(s-2)),s}write(t,e,i,r,s,a){const o=this.layout,l=i.get("position"),h=l.indices,p=l.data.length/3,c=i.get("distanceToStart")?.data;h&&h.length!==2*(p-1)&&console.warn("RibbonLineMaterial does not support indices");const d=o.fields.has("sizeFeatureAttribute");let b=1,_=null;if(d){const t=i.get("sizeFeatureAttribute");1===t.data.length?b=t.data[0]:_=t.data}else b=i.get("size")?.data[0]??1;let v=[1,1,1,1],P=0,w=null;const y=o.fields.has("colorFeatureAttribute");if(y){const t=i.get("colorFeatureAttribute");1===t.data.length?P=t.data[0]:w=t.data}else v=i.get("color")?.data??v;const j=i.get("timeStamps")?.data,E=j&&o.fields.has("timeStamps"),T=o.fields.has("opacityFeatureAttribute");let z=0,A=null;if(T){const t=i.get("opacityFeatureAttribute");1===t.data.length?z=t.data[0]:A=t.data}const x=new Float32Array(s.buffer),O=S(s.buffer),C=new Uint8Array(s.buffer),L=o.stride/4;let V=a*L;const R=V;let F=0;const N=c?(t,e,i)=>F=c[i]:(t,e,i)=>F+=u(t,e),k=x.BYTES_PER_ELEMENT/O.BYTES_PER_ELEMENT,D=4/k,B=M(),I=(t,e,i,s,a,n,o,l)=>{x[V++]=e[0],x[V++]=e[1],x[V++]=e[2],U(t,e,O,V*k),V+=D,U(i,e,O,V*k),V+=D,x[V++]=l;let h=V*k;if(O[h++]=a,O[h++]=n,V=Math.ceil(h/k),y)x[V]=w?.[o]??P;else{const t=Math.min(4*o,v.length-4),e=4*V;C[e]=255*v[t],C[e+1]=255*v[t+1],C[e+2]=255*v[t+2],C[e+3]=255*v[t+3]}if(V++,x[V++]=_?.[o]??b,T&&(x[V++]=A?.[o]??z),B){let t=4*V;r?(C[t++]=r[0],C[t++]=r[1],C[t++]=r[2],C[t++]=r[3]):(C[t++]=0,C[t++]=0,C[t++]=0,C[t++]=0),V=Math.ceil(.25*t)}E&&(h=V*k,O[h++]=s[0],O[h++]=s[1],O[h++]=s[2],O[h++]=s[3],V=Math.ceil(h/k))};V+=L,n(pt,l.data[0],l.data[1],l.data[2]),E&&g(ct,j[0],j[1],j[2],j[3]),t&&f(pt,pt,t);const W=this._isClosed(i);if(W){const e=l.data.length-3;n(ht,l.data[e],l.data[e+1],l.data[e+2]),t&&f(ht,ht,t)}else n(mt,l.data[3],l.data[4],l.data[5]),t&&f(mt,mt,t),I(pt,pt,mt,ct,1,-4,0,0),I(pt,pt,mt,ct,1,4,0,0),m(ht,pt),m(pt,mt),E&&g(ct,j[4],j[5],j[6],j[7]);const J=W?0:1,Y=W?p:p-1;for(let u=J;u<Y;u++){const e=(u+1)%p*3;n(mt,l.data[e],l.data[e+1],l.data[e+2]),t&&f(mt,mt,t),N(ht,pt,u),I(ht,pt,mt,ct,0,-1,u,F),I(ht,pt,mt,ct,0,1,u,F);const i=this.numJoinSubdivisions;for(let t=0;t<i;++t){const e=(t+1)/(i+1);I(ht,pt,mt,ct,e,-1,u,F),I(ht,pt,mt,ct,e,1,u,F)}if(I(ht,pt,mt,ct,1,-2,u,F),I(ht,pt,mt,ct,1,2,u,F),m(ht,pt),m(pt,mt),E){const t=(u+1)%p*4;g(ct,j[t],j[t+1],j[t+2],j[t+3])}}W?(n(mt,l.data[3],l.data[4],l.data[5]),t&&f(mt,mt,t),F=N(ht,pt,Y),I(ht,pt,mt,ct,0,-1,J,F),I(ht,pt,mt,ct,0,1,J,F)):(F=N(ht,pt,Y),I(ht,pt,pt,ct,0,-5,Y,F),I(ht,pt,pt,ct,0,5,Y,F)),H(x,R+L,x,R,L);return V=H(x,V-L,x,V,L),this._parameters.wireframe&&this._addWireframeVertices(s,R,V,L),null}_addWireframeVertices(t,e,i,r){const s=new Float32Array(t.buffer,i*Float32Array.BYTES_PER_ELEMENT),a=new Float32Array(t.buffer,e*Float32Array.BYTES_PER_ELEMENT,i-e);let n=0;const o=t=>n=H(a,t,s,n,r);for(let l=0;l<a.length-1;l+=2*r)o(l),o(l+2*r),o(l+1*r),o(l+2*r),o(l+1*r),o(l+3*r)}}function H(t,e,i,r,s){for(let a=0;a<s;a++)i[r++]=t[e++];return r}function K(t,e){if(!t.isClosed)return!1;return e.get("position").indices.length>2}function Q(t){return 1===t.anchor&&t.hideOnShortSegments&&"begin-end"===t.placement&&t.worldSpace}const Z=d(),$=d(),tt=d(),et=d(),it=d(),rt=i(),st=i(),at=d(),nt=d(),ot=y(),lt=y(),ht=d(),pt=d(),mt=d(),ct=_(),ut=[i(),i(),i(),i()],ft=[d(),d(),d(),d()],dt=z(),gt=z(),bt=z(),_t=z();export{X as Parameters,Y as RibbonLineMaterial};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import"../core/shaderLibrary/ShaderOutput.js";import"../core/shaderLibrary/Slice.glsl.js";import"../core/shaderLibrary/Transform.glsl.js";import"../core/shaderLibrary/attributes/ObjectAndLayerIdColor.glsl.js";import"../core/shaderLibrary/output/OutputHighlight.glsl.js";import"../core/shaderLibrary/shading/EvaluateAmbientLighting.glsl.js";import"../core/shaderLibrary/shading/MainLighting.glsl.js";import"../core/shaderLibrary/shading/NormalUtils.glsl.js";import"../core/shaderLibrary/shading/ReadShadowMap.glsl.js";import"../core/shaderLibrary/shading/TerrainDepthTest.glsl.js";import"../core/shaderLibrary/shading/WaterColor.glsl.js";import"../core/shaderLibrary/shading/WaterDistortion.glsl.js";import"../core/shaderLibrary/util/ColorConversion.glsl.js";import"../core/shaderLibrary/util/View.glsl.js";import"../core/shaderModules/Float4PassUniform.js";import"../core/shaderModules/FloatPassUniform.js";import"../core/shaderModules/glsl.js";import"../shaders/OutputColorHighlightOLID.glsl.js";import"../../../webgl/ShaderBuilder.js";import"../../../../webscene/support/AlphaCutoff.js";export{b as build}from"../../../../chunks/Water.glsl.js";
2
+ import"../../../../core/Error.js";import"../core/shaderLibrary/ShaderOutput.js";import"../core/shaderLibrary/Slice.glsl.js";import"../core/shaderLibrary/Transform.glsl.js";import"../core/shaderLibrary/attributes/ObjectAndLayerIdColor.glsl.js";import"../core/shaderLibrary/output/OutputHighlight.glsl.js";import"../core/shaderLibrary/shading/EvaluateAmbientLighting.glsl.js";import"../core/shaderLibrary/shading/MainLighting.glsl.js";import"../core/shaderLibrary/shading/NormalUtils.glsl.js";import"../core/shaderLibrary/shading/ReadShadowMap.glsl.js";import"../core/shaderLibrary/shading/TerrainDepthTest.glsl.js";import"../core/shaderLibrary/shading/WaterColor.glsl.js";import"../core/shaderLibrary/shading/WaterDistortion.glsl.js";import"../core/shaderLibrary/util/ColorConversion.glsl.js";import"../core/shaderLibrary/util/View.glsl.js";import"../core/shaderModules/Float4PassUniform.js";import"../core/shaderModules/FloatPassUniform.js";import"../core/shaderModules/glsl.js";import"../shaders/OutputColorHighlightOLID.glsl.js";import"../../../webgl/ShaderBuilder.js";import"../../../../webscene/support/AlphaCutoff.js";export{b as build}from"../../../../chunks/Water.glsl.js";
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import"../../../../core/has.js";import{secondsFromMilliseconds as t}from"../../../../core/time.js";import{fromValues as e}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as i}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isColor as a,isHighlightOrOLID as s}from"../core/shaderLibrary/ShaderOutput.js";import{olidEnabled as o}from"../effects/geometry/olidUtils.js";import{DefaultBufferWriter as n}from"./DefaultBufferWriter.js";import{PositionUvf32OlidLayout as c,PositionUvf32Layout as l}from"./DefaultLayouts.js";import{TriangleMaterialParameters as h,TriangleMaterial as p}from"./TriangleMaterial.js";import{WaterGLMaterial as m}from"./WaterGLMaterial.js";import{WaterTechniqueConfiguration as u}from"./WaterTechniqueConfiguration.js";class f extends p{constructor(t,e){super(t,d),this.visible=!0,this.produces=new Map([[2,t=>a(t)&&!this.transparent||s(t)],[4,t=>a(t)&&this.transparent||s(t)],[19,t=>this.parameters.draped&&a(t)||4===t||s(t)],[20,t=>4===t]]),this._configuration=new u(e.spherical)}updateConfiguration(t){super.updateConfiguration(t),this._configuration.writeDepth=!0,this._configuration.receiveShadows=a(t.output)&&t.shadowMap.enabled,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.screenSpaceReflections=t.screenSpaceReflections.enabled&&null!=t.reprojection.lastFrameColor,this._configuration.cloudReflections=null!=t.clouds.data,this._configuration.draped=this.parameters.draped,this._configuration.terrainDepthTest=t.terrainDepthTest&&a(t.output),this._configuration.cullAboveTerrain=t.cullAboveTerrain}update(e){return this.setParameters({timeElapsed:t(e.time)*this.parameters.animationSpeed},!1),this._animationEnabled(e.camera)&&e.dt>0}_animationEnabled(t){const e=Math.min(t.relativeElevation,t.distance);return Math.sqrt(this.parameters.waveTextureRepeat/this.parameters.waveStrength)*e<g}get transparent(){return this.parameters.transparent}createGLMaterial(t){return new m(t)}createBufferWriter(){return new n(o()?c:l)}get test(){}}class d extends h{constructor(){super(...arguments),this.waveStrength=.06,this.waveTextureRepeat=32,this.waveDirection=e(1,0),this.waveVelocity=.05,this.flowStrength=.015,this.flowOffset=-.5,this.animationSpeed=.35,this.timeElapsed=0,this.color=i(0,0,0,0),this.transparent=!0,this.hasSlicePlane=!1,this.draped=!1,this.origin=r(),this.modelTransformation=null}}const g=35e3;export{d as Parameters,f as WaterMaterial};
2
+ import"../../../../core/has.js";import{secondsFromMilliseconds as t}from"../../../../core/time.js";import{fromValues as e}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as i}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{is3DGeometry as a,isColor as s}from"../core/shaderLibrary/ShaderOutput.js";import{olidEnabled as o}from"../effects/geometry/olidUtils.js";import{DefaultBufferWriter as n}from"./DefaultBufferWriter.js";import{PositionUvf32OlidLayout as c,PositionUvf32Layout as h}from"./DefaultLayouts.js";import{TriangleMaterialParameters as p,TriangleMaterial as l}from"./TriangleMaterial.js";import{WaterGLMaterial as m}from"./WaterGLMaterial.js";import{WaterTechniqueConfiguration as u}from"./WaterTechniqueConfiguration.js";class f extends l{constructor(t,e){super(t,d),this.visible=!0,this.produces=new Map([[2,t=>a(t)&&!this.transparent],[4,t=>a(t)&&this.transparent],[19,t=>this.parameters.draped&&a(t)],[20,t=>4===t]]),this._configuration=new u(e.spherical)}updateConfiguration(t){super.updateConfiguration(t),this._configuration.writeDepth=!0,this._configuration.receiveShadows=s(t.output)&&t.shadowMap.enabled,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.screenSpaceReflections=t.hasScreenSpaceReflections,this._configuration.cloudReflections=null!=t.clouds.data,this._configuration.draped=this.parameters.draped,this._configuration.terrainDepthTest=t.terrainDepthTest&&s(t.output),this._configuration.cullAboveTerrain=t.cullAboveTerrain}update(e){return this.setParameters({timeElapsed:t(e.time)*this.parameters.animationSpeed},!1),this._animationEnabled(e.camera)&&e.dt>0}_animationEnabled(t){const e=Math.min(t.relativeElevation,t.distance);return Math.sqrt(this.parameters.waveTextureRepeat/this.parameters.waveStrength)*e<g}get transparent(){return this.parameters.transparent}createGLMaterial(t){return new m(t)}createBufferWriter(){return new n(o()?c:h)}get test(){}}class d extends p{constructor(){super(...arguments),this.waveStrength=.06,this.waveTextureRepeat=32,this.waveDirection=e(1,0),this.waveVelocity=.05,this.flowStrength=.015,this.flowOffset=-.5,this.animationSpeed=.35,this.timeElapsed=0,this.color=i(0,0,0,0),this.transparent=!0,this.hasSlicePlane=!1,this.draped=!1,this.origin=r(),this.modelTransformation=null}}const g=35e3;export{d as Parameters,f as WaterMaterial};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{subclass as t}from"../../../../core/accessorSupport/decorators.js";import{glLayout as i}from"../../support/buffer/glUtil.js";import{newLayout as r}from"../../support/buffer/InterleavedLayout.js";import{ReloadableShader as l}from"../core/shaderTechnique/ReloadableShader.js";import{ShaderTechnique as s}from"../core/shaderTechnique/ShaderTechnique.js";import{olidEnabled as n}from"../effects/geometry/olidUtils.js";import{depthWrite as o,depthTest as c,blending as u}from"../lib/OrderIndependentTransparency.js";import{stencilToolMaskBaseParams as p,stencilBaseAllZerosParams as a,stencilWriteMaskOn as d,stencilToolTransparentOccluderParams as f,depthCompareAlways as m,stencilToolMaskOccluderParams as h,stencilWriteMaskOff as g,depthCompareLess as b}from"../lib/StencilUtils.js";import{polygonOffset as P}from"../materials/PolygonOffset.js";import{R as T}from"../../../../chunks/RibbonLine.glsl.js";import{PrimitiveType as W}from"../../../webgl/enums.js";import{makePipelineState as j,defaultColorWrite as v,unpremultipliedAlphaToPremultipliedAlpha as S}from"../../../webgl/renderState.js";let _=class extends s{constructor(e,t){super(e,t,i(y(t))),this.shader=new l(T,()=>import("./RibbonLine.glsl.js")),this.ignoreUnused=!0,this.primitiveType=t.wireframe?W.LINES:W.TRIANGLE_STRIP}_makePipelineState(e,t){const{output:i,hasOccludees:r}=e;return j({blending:u(i),depthTest:c(i),depthWrite:o(e),colorWrite:v,stencilWrite:r?d:null,stencilTest:r?t?p:a:null,polygonOffset:P(e)})}initializePipeline(e){if(e.occluder){const{hasOccludees:t}=e;this._occluderPipelineTransparent=j({blending:S,polygonOffset:P(e),depthTest:m,depthWrite:null,colorWrite:v,stencilWrite:null,stencilTest:t?f:null}),this._occluderPipelineOpaque=j({blending:S,polygonOffset:P(e),depthTest:t?m:b,depthWrite:null,colorWrite:v,stencilWrite:t?g:null,stencilTest:t?h:null}),this._occluderPipelineMaskWrite=j({blending:null,polygonOffset:P(e),depthTest:b,depthWrite:null,colorWrite:null,stencilWrite:t?d:null,stencilTest:t?p:null})}return this._occludeePipeline=this._makePipelineState(e,!0),this._makePipelineState(e,!1)}getPipeline(e,t){if(t)return this._occludeePipeline;switch(e.occluder){case 12:return this._occluderPipelineTransparent??super.getPipeline(e);case 11:return this._occluderPipelineOpaque??super.getPipeline(e);default:e.occluder;case void 0:case null:return this._occluderPipelineMaskWrite??super.getPipeline(e)}}};function y(e){const t=r().vec3f("position").vec4f16("previousDelta").vec4f16("nextDelta").f32("u0").vec2f16("lineParameters");return e.hasVVColor?t.f32("colorFeatureAttribute"):t.vec4u8("color",{glNormalized:!0}),e.hasVVSize?t.f32("sizeFeatureAttribute"):t.f32("size"),e.hasVVOpacity&&t.f32("opacityFeatureAttribute"),n()&&t.vec4u8("olidColor"),e.hasAnimation&&t.vec4f16("timeStamps"),t}_=e([t("esri.views.3d.webgl-engine.shaders.RibbonLineTechnique")],_);export{_ as RibbonLineTechnique,y as getLayout};
2
+ import{__decorate as e}from"tslib";import{subclass as t}from"../../../../core/accessorSupport/decorators.js";import{glLayout as i}from"../../support/buffer/glUtil.js";import{newLayout as r}from"../../support/buffer/InterleavedLayout.js";import{ReloadableShader as l}from"../core/shaderTechnique/ReloadableShader.js";import{ShaderTechnique as s}from"../core/shaderTechnique/ShaderTechnique.js";import{olidEnabled as n}from"../effects/geometry/olidUtils.js";import{depthWrite as o,depthTest as c,blending as u}from"../lib/OrderIndependentTransparency.js";import{stencilToolMaskBaseParams as p,stencilBaseAllZerosParams as a,stencilWriteMaskOn as d,stencilToolTransparentOccluderParams as f,depthCompareAlways as m,stencilToolMaskOccluderParams as h,stencilWriteMaskOff as g,depthCompareLess as b}from"../lib/StencilUtils.js";import{getRibbonLineLayerPolygonOffset as P}from"../materials/PolygonOffset.js";import{R as T}from"../../../../chunks/RibbonLine.glsl.js";import{PrimitiveType as W}from"../../../webgl/enums.js";import{makePipelineState as j,defaultColorWrite as v,unpremultipliedAlphaToPremultipliedAlpha as S}from"../../../webgl/renderState.js";let _=class extends s{constructor(e,t){super(e,t,i(y(t))),this.shader=new l(T,()=>import("./RibbonLine.glsl.js")),this.ignoreUnused=!0,this.primitiveType=t.wireframe?W.LINES:W.TRIANGLE_STRIP}_makePipelineState(e,t){const{output:i,hasOccludees:r}=e;return j({blending:u(i),depthTest:c(i),depthWrite:o(e),colorWrite:v,stencilWrite:r?d:null,stencilTest:r?t?p:a:null,polygonOffset:P(e)})}initializePipeline(e){if(e.occluder){const{hasOccludees:t}=e;this._occluderPipelineTransparent=j({blending:S,polygonOffset:P(e),depthTest:m,depthWrite:null,colorWrite:v,stencilWrite:null,stencilTest:t?f:null}),this._occluderPipelineOpaque=j({blending:S,polygonOffset:P(e),depthTest:t?m:b,depthWrite:null,colorWrite:v,stencilWrite:t?g:null,stencilTest:t?h:null}),this._occluderPipelineMaskWrite=j({blending:null,polygonOffset:P(e),depthTest:b,depthWrite:null,colorWrite:null,stencilWrite:t?d:null,stencilTest:t?p:null})}return this._occludeePipeline=this._makePipelineState(e,!0),this._makePipelineState(e,!1)}getPipeline(e,t){if(t)return this._occludeePipeline;switch(e.occluder){case 12:return this._occluderPipelineTransparent??super.getPipeline(e);case 11:return this._occluderPipelineOpaque??super.getPipeline(e);default:e.occluder;case void 0:case null:return this._occluderPipelineMaskWrite??super.getPipeline(e)}}};function y(e){const t=r().vec3f("position").vec4f16("previousDelta").vec4f16("nextDelta").f32("u0").vec2f16("lineParameters");return e.hasVVColor?t.f32("colorFeatureAttribute"):t.vec4u8("color",{glNormalized:!0}),e.hasVVSize?t.f32("sizeFeatureAttribute"):t.f32("size"),e.hasVVOpacity&&t.f32("opacityFeatureAttribute"),n()&&t.vec4u8("olidColor"),e.hasAnimation&&t.vec4f16("timeStamps"),t}_=e([t("esri.views.3d.webgl-engine.shaders.RibbonLineTechnique")],_);export{_ as RibbonLineTechnique,y as getLayout};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{parameter as t}from"../core/shaderTechnique/ShaderTechniqueConfiguration.js";import{TriangleTechniqueConfiguration as o}from"../materials/TriangleTechniqueConfiguration.js";class i extends o{constructor(e){super(),this.spherical=e,this.capType=0,this.emissionSource=0,this.animation=2,this.writeDepth=!1,this.draped=!1,this.stippleEnabled=!1,this.stippleOffColorEnabled=!1,this.stipplePreferContinuous=!0,this.roundJoins=!1,this.applyMarkerOffset=!1,this.hasVVSize=!1,this.hasVVColor=!1,this.hasVVOpacity=!1,this.falloffEnabled=!1,this.innerColorEnabled=!1,this.hasOccludees=!1,this.occluder=!1,this.terrainDepthTest=!1,this.cullAboveTerrain=!1,this.wireframe=!1,this.discardInvisibleFragments=!1,this.hasScreenSizePerspective=!1,this.worldSizedImagePattern=!1,this.textureCoordinateType=0,this.hasVVInstancing=!1,this.hasSliceTranslatedView=!0,this.overlayEnabled=!1,this.snowCover=!1}get hasAnimation(){return 0!==this.animation}}e([t({count:3})],i.prototype,"capType",void 0),e([t({count:8})],i.prototype,"emissionSource",void 0),e([t({count:4})],i.prototype,"animation",void 0),e([t()],i.prototype,"writeDepth",void 0),e([t()],i.prototype,"draped",void 0),e([t()],i.prototype,"stippleEnabled",void 0),e([t()],i.prototype,"stippleOffColorEnabled",void 0),e([t()],i.prototype,"stipplePreferContinuous",void 0),e([t()],i.prototype,"roundJoins",void 0),e([t()],i.prototype,"applyMarkerOffset",void 0),e([t()],i.prototype,"hasVVSize",void 0),e([t()],i.prototype,"hasVVColor",void 0),e([t()],i.prototype,"hasVVOpacity",void 0),e([t()],i.prototype,"falloffEnabled",void 0),e([t()],i.prototype,"innerColorEnabled",void 0),e([t()],i.prototype,"hasOccludees",void 0),e([t()],i.prototype,"occluder",void 0),e([t()],i.prototype,"terrainDepthTest",void 0),e([t()],i.prototype,"cullAboveTerrain",void 0),e([t()],i.prototype,"wireframe",void 0),e([t()],i.prototype,"discardInvisibleFragments",void 0),e([t()],i.prototype,"hasScreenSizePerspective",void 0),e([t()],i.prototype,"worldSizedImagePattern",void 0);export{i as RibbonLineTechniqueConfiguration};
2
+ import{__decorate as t}from"tslib";import{parameter as e}from"../core/shaderTechnique/ShaderTechniqueConfiguration.js";import{TriangleTechniqueConfiguration as o}from"../materials/TriangleTechniqueConfiguration.js";const i=16;class r extends o{constructor(t){super(),this.spherical=t,this.capType=0,this.emissionSource=0,this.animation=2,this.polygonOffsetIndex=0,this.writeDepth=!1,this.draped=!1,this.stippleEnabled=!1,this.stippleOffColorEnabled=!1,this.stipplePreferContinuous=!0,this.roundJoins=!1,this.applyMarkerOffset=!1,this.hasVVSize=!1,this.hasVVColor=!1,this.hasVVOpacity=!1,this.falloffEnabled=!1,this.innerColorEnabled=!1,this.hasOccludees=!1,this.occluder=!1,this.terrainDepthTest=!1,this.cullAboveTerrain=!1,this.wireframe=!1,this.discardInvisibleFragments=!1,this.hasScreenSizePerspective=!1,this.worldSizedImagePattern=!1,this.textureCoordinateType=0,this.hasVVInstancing=!1,this.hasSliceTranslatedView=!0,this.overlayEnabled=!1,this.snowCover=!1}get hasAnimation(){return 0!==this.animation}}t([e({count:3})],r.prototype,"capType",void 0),t([e({count:8})],r.prototype,"emissionSource",void 0),t([e({count:4})],r.prototype,"animation",void 0),t([e({count:i})],r.prototype,"polygonOffsetIndex",void 0),t([e()],r.prototype,"writeDepth",void 0),t([e()],r.prototype,"draped",void 0),t([e()],r.prototype,"stippleEnabled",void 0),t([e()],r.prototype,"stippleOffColorEnabled",void 0),t([e()],r.prototype,"stipplePreferContinuous",void 0),t([e()],r.prototype,"roundJoins",void 0),t([e()],r.prototype,"applyMarkerOffset",void 0),t([e()],r.prototype,"hasVVSize",void 0),t([e()],r.prototype,"hasVVColor",void 0),t([e()],r.prototype,"hasVVOpacity",void 0),t([e()],r.prototype,"falloffEnabled",void 0),t([e()],r.prototype,"innerColorEnabled",void 0),t([e()],r.prototype,"hasOccludees",void 0),t([e()],r.prototype,"occluder",void 0),t([e()],r.prototype,"terrainDepthTest",void 0),t([e()],r.prototype,"cullAboveTerrain",void 0),t([e()],r.prototype,"wireframe",void 0),t([e()],r.prototype,"discardInvisibleFragments",void 0),t([e()],r.prototype,"hasScreenSizePerspective",void 0),t([e()],r.prototype,"worldSizedImagePattern",void 0);export{i as POLYGON_OFFSET_INDEX_COUNT,r as RibbonLineTechniqueConfiguration};
package/views/3d/webgl.js CHANGED
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import o from"../../Camera.js";import{rad2deg as e,deg2rad as r}from"../../core/mathUtils.js";import{create as t}from"../../core/libs/gl-matrix-2/factories/mat4f64.js";import{scale as i,add as n}from"../../core/libs/gl-matrix-2/math/vec3.js";import{create as a}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";import c from"../../geometry/Point.js";import l from"../../geometry/SpatialReference.js";import{computeTranslationToOriginAndRotation as s}from"../../geometry/projection/computeTranslationToOriginAndRotation.js";import{projectBuffer as m}from"../../geometry/projection/projectBuffer.js";import{projectPointToVector as p}from"../../geometry/projection/projectPointToVector.js";import{projectVectorToVector as f}from"../../geometry/projection/projectVectorToVector.js";import{cameraOnContentAlongViewDirection as u}from"./camera/intersectionUtils.js";import{directionToHeadingTilt as R,viewModeDependentUtil as A}from"./support/viewingModeUtils.js";const d={OPAQUE:"opaque-color",TRANSPARENT:"transparent-color",COMPOSITE:"composite-color",FINAL:"final-color"},T=[d.FINAL,d.COMPOSITE,d.OPAQUE,d.TRANSPARENT],N={ANTIALIASING:"aa-color",CUTFILL_COLOR:"cutfill-color",CUTFILL_COMPUTATION:"cutfill-computation",FOCUSAREA_COLOR:"focusarea-color",FOCUSAREA:"focusarea",PRE_TRANSPARENT:"pre-transparent",HIGHLIGHT_COLOR:"highlight-color",LASERLINES:"laserlines",MAGNIFIER:"magnifier",OCCLUDED:"occluded",OPAQUE_ENVIRONMENT:"opaque-environment",AMBIENT_ILLUMINATION:"ambient-illumination",TRANSPARENT_ENVIRONMENT:"transparent-environment",VIEWSHED:"viewshed"},E=Array.from(Object.values(N)).concat(T);function O(o,e,r,t,i,n,a){return t=t||o.spatialReference,m(e,t,r,i,o.renderCoordsHelper.spatialReference,n,a)?i:null}function I(o,e,r,t,i,n,a){return n=n||o.spatialReference,m(e,o.renderCoordsHelper.spatialReference,r,t,n,i,a)?t:null}function j(o,e,r,i){return i||(i=t()),r=r||o.spatialReference,s(r,e,i,o.renderCoordsHelper.spatialReference)?i:null}function g(r,t,i){const n=r.renderSpatialReference,a=R(r,t.eye,t.viewForward,t.up,L);let s=r.spatialReference;return f(t.eye,n,C,s)||(s=l.WGS84,f(t.eye,n,C,s)),null==i?i=new o(new c(C,s),a.heading,a.tilt,e(t.fov)):(i.position.x=C[0],i.position.y=C[1],i.position.z=C[2],i.position.spatialReference=s,i.heading=a.heading,i.tilt=a.tilt,i.fov=e(t.fov)),i.layout.row=t.row,i.layout.rows=t.rows,i.layout.column=t.column,i.layout.columns=t.columns,i}function y(o,e){if(!e)return null;const t=o.renderSpatialReference,c=A(o).headingTiltToDirectionUp,l=a();if(!p(e.position,l,t))return null;const s=c(l,e.heading,e.tilt);i(s.direction,s.direction,o.state.camera.distance),n(s.direction,s.direction,l);const m=u(o,l,s.direction,s.up);return m.fov=r(e.fov),m.row=e.layout.row,m.rows=e.layout.rows,m.column=e.layout.column,m.columns=e.layout.columns,m}const C=a(),L={heading:0,tilt:0};export{E as AllInternalRenderNodeOutputs,T as AllRenderNodeOutputs,N as InternalRenderCategory,d as RenderNodeOutput,g as fromRenderCamera,I as fromRenderCoordinates,j as renderCoordinateTransformAt,y as toRenderCamera,O as toRenderCoordinates};
2
+ import o from"../../Camera.js";import{rad2deg as e,deg2rad as r}from"../../core/mathUtils.js";import{create as t}from"../../core/libs/gl-matrix-2/factories/mat4f64.js";import{scale as i,add as n}from"../../core/libs/gl-matrix-2/math/vec3.js";import{create as a}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";import c from"../../geometry/Point.js";import l from"../../geometry/SpatialReference.js";import{computeTranslationToOriginAndRotation as s}from"../../geometry/projection/computeTranslationToOriginAndRotation.js";import{projectBuffer as m}from"../../geometry/projection/projectBuffer.js";import{projectPointToVector as p}from"../../geometry/projection/projectPointToVector.js";import{projectVectorToVector as u}from"../../geometry/projection/projectVectorToVector.js";import{cameraOnContentAlongViewDirection as f}from"./camera/intersectionUtils.js";import{directionToHeadingTilt as R,viewModeDependentUtil as d}from"./support/viewingModeUtils.js";const A={OPAQUE:"opaque-color",TRANSPARENT:"transparent-color",COMPOSITE:"composite-color",FINAL:"final-color"},T=[A.FINAL,A.COMPOSITE,A.OPAQUE,A.TRANSPARENT],N={ANTIALIASING:"aa-color",CUTFILL_COLOR:"cutfill-color",CUTFILL_COMPUTATION:"cutfill-computation",FOCUSAREA_COLOR:"focusarea-color",FOCUSAREA:"focusarea",GROUND_DEPTH:"ground-depth",PRE_TRANSPARENT:"pre-transparent",HIGHLIGHT_COLOR:"highlight-color",LASERLINES:"laserlines",MAGNIFIER:"magnifier",OCCLUDED:"occluded",OPAQUE_ENVIRONMENT:"opaque-environment",AMBIENT_ILLUMINATION:"ambient-illumination",TRANSPARENT_ENVIRONMENT:"transparent-environment",VIEWSHED:"viewshed"},E=Array.from(Object.values(N)).concat(T);function O(o,e,r,t,i,n,a){return t=t||o.spatialReference,m(e,t,r,i,o.renderCoordsHelper.spatialReference,n,a)?i:null}function I(o,e,r,t,i,n,a){return n=n||o.spatialReference,m(e,o.renderCoordsHelper.spatialReference,r,t,n,i,a)?t:null}function g(o,e,r,i){return i||(i=t()),r=r||o.spatialReference,s(r,e,i,o.renderCoordsHelper.spatialReference)?i:null}function j(r,t,i){const n=r.renderSpatialReference,a=R(r,t.eye,t.viewForward,t.up,L);let s=r.spatialReference;return u(t.eye,n,C,s)||(s=l.WGS84,u(t.eye,n,C,s)),null==i?i=new o(new c(C,s),a.heading,a.tilt,e(t.fov)):(i.position.x=C[0],i.position.y=C[1],i.position.z=C[2],i.position.spatialReference=s,i.heading=a.heading,i.tilt=a.tilt,i.fov=e(t.fov)),i.layout.row=t.row,i.layout.rows=t.rows,i.layout.column=t.column,i.layout.columns=t.columns,i}function y(o,e){if(!e)return null;const t=o.renderSpatialReference,c=d(o).headingTiltToDirectionUp,l=a();if(!p(e.position,l,t))return null;const s=c(l,e.heading,e.tilt);i(s.direction,s.direction,o.state.camera.distance),n(s.direction,s.direction,l);const m=f(o,l,s.direction,s.up);return m.fov=r(e.fov),m.row=e.layout.row,m.rows=e.layout.rows,m.column=e.layout.column,m.columns=e.layout.columns,m}const C=a(),L={heading:0,tilt:0};export{E as AllInternalRenderNodeOutputs,T as AllRenderNodeOutputs,N as InternalRenderCategory,A as RenderNodeOutput,j as fromRenderCamera,I as fromRenderCoordinates,g as renderCoordinateTransformAt,y as toRenderCamera,O as toRenderCoordinates};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
+ import{__decorate as t}from"tslib";import{watch as e,syncAndInitial as n}from"../../../core/reactiveUtils.js";import{property as i,subclass as r}from"../../../core/accessorSupport/decorators.js";import{dot as o,cross as s}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{create as c}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{calculateBezierCurveTangent as a}from"../../../geometry/support/curves/bezierCurveUtils.js";import{interpolateCircle as p}from"../../../geometry/support/curves/circleUtils.js";import{calculateCircularArcTangent as l}from"../../../geometry/support/curves/circularArcUtils.js";import{isCoordinate as u,isCircularArc as f,isEllipticArc4 as h,isEllipticArc7 as d,isBezierCurve as m}from"../../../geometry/support/curves/curveUtils.js";import{deriveCircleFromEllipticArc4 as v,calculateEllipticArc4Tangent as _}from"../../../geometry/support/curves/ellipticArc4Utils.js";import{calculateEllipticArc7Tangent as L}from"../../../geometry/support/curves/ellipticArc7Utils.js";import{pointNear as g}from"../../../layers/graphics/dehydratedFeatureComparison.js";import{PluginBase as P}from"./PluginBase.js";const A=Symbol("left-vertex"),y=Symbol("left-left-vertex"),S=Symbol("right-vertex"),x=c();let w=class extends P{constructor(){super(...arguments),this.placementState="placing-end"}get _availableAnchorCount(){return this._curveLeftVertex&&this._curveLeftLeftVertex?2:this._curveLeftVertex||this._curveLeftLeftVertex?1:0}get _automaticRestart(){return!this.ownPlacedLeftAnchor&&!this.ownPlacedLeftLeftAnchor}start(t,i){super.start(t,i);if(this._session.preserveSharedRedoAfterOperation=!0,this.ownPlacedLeftAnchor=i?.ownPlacedLeftAnchor??null,this.ownPlacedLeftLeftAnchor=i?.ownPlacedLeftLeftAnchor??null,this._refreshAnchorInfo(),this._restoreOwnPlacedAnchorsIfNeeded(),this.placementState=this._resolveState(i?.placementState),this.curveEndPoint="placing-end"===this.placementState?i?.curveEndPoint??null:null,!this._primaryInteractiveHandle){const i="primary";this._primaryInteractiveHandle=t.createInteractiveHandle({defaultCaptureMode:"capture-always",role:i,snappingEnabled:!0}),this.addHandles([e(()=>this._primaryInteractiveHandle?.outputMapPosition??t.positionOfLastUserInput,t=>{t&&!this._isComplete&&this.updateGeometry(t)},n)],this._ownHandlesKey)}this._session.automaticRestart=this._automaticRestart;const r=this._primaryInteractiveHandle?.outputMapPosition??t.positionOfLastUserInput;r&&this.updateGeometry(r)}updateGeometry(t){if(!this._isComplete)switch(this.placementState){case"placing-left-left":return void this._session?.appendOrReplacePoint(y,t);case"placing-left":return void this._session?.appendOrReplacePoint(A,t);case"placing-end":return this.curveEndPoint=t,void this._updateStagedGeometry()}}async completeStep(){if(!this._primaryInteractiveHandle?.outputMapPosition||this._isComplete||!this._session)return;if(!this._isCurrentStepValid())return;const t=this._session.peekUndoStep(),e=this.suspend();if(e){t?t.placementState===e.placementState&&(t.curveEndPoint=e.curveEndPoint,t.ownPlacedLeftAnchor=e.ownPlacedLeftAnchor,t.ownPlacedLeftLeftAnchor=e.ownPlacedLeftLeftAnchor):this._session.pushUndoStep(e);try{switch(this._session.preserveSharedRedoAfterOperation=!1,this.placementState){case"placing-left-left":this._curveLeftLeftVertex=this._session.getInformationAboutPoint(-1,-1),this.ownPlacedLeftLeftAnchor=this._curveLeftLeftVertex,this._session.groupGeometryChanges(),this._applyState("placing-left");break;case"placing-left":this._curveLeftVertex=this._session.getInformationAboutPoint(-1,-1),this.ownPlacedLeftAnchor=this._curveLeftVertex,this._session.groupGeometryChanges(),this._applyState("placing-end");break;case"placing-end":this._updateStagedGeometry(),this._commitArcSegment()}}finally{this._session.preserveSharedRedoAfterOperation=!0}this._session.pushUndoStep(this.suspend())}}suspend(){const{curveEndPoint:t,ownPlacedLeftAnchor:e,ownPlacedLeftLeftAnchor:n,placementState:i}=this;return{curveEndPoint:t,ownPlacedLeftAnchor:e,ownPlacedLeftLeftAnchor:n,placementState:i}}_applyState(t){this.placementState=t,this._session.automaticRestart=this._automaticRestart}_resolveState(t){const e=this._availableAnchorCount;switch(t){case"placing-left-left":case"placing-end":default:return e>=2?"placing-end":1===e?"placing-left":"placing-left-left";case"placing-left":return e>=2?"placing-end":0===e?"placing-left-left":"placing-left"}}_restoreOwnPlacedAnchorsIfNeeded(){const t=this._session;if(!t)return;const e=this.ownPlacedLeftLeftAnchor?.point;e&&!this._hasAnchorPoint(e)&&(t.appendOrReplacePoint(y,e),t.groupGeometryChanges(),this._refreshAnchorInfo());const n=this.ownPlacedLeftAnchor?.point;n&&!this._hasAnchorPoint(n)&&(t.appendOrReplacePoint(A,n),t.groupGeometryChanges(),this._refreshAnchorInfo())}_hasAnchorPoint(t){const e=this._curveLeftVertex?.point,n=this._curveLeftLeftVertex?.point;return!!(e&&g(e,t)||n&&g(n,t))}_refreshAnchorInfo(){const t=this._session;if(!t)return this._curveLeftVertex=null,void(this._curveLeftLeftVertex=null);const e=t.lastPointAddedBySession?.pointIndex,n=null!=e&&e>=2?t.getInformationAboutPoint(e-1,-1):null,i=null!=e&&e>=2?t.getInformationAboutPoint(e-2,-1):null;if(n?.point&&i?.point)return this._curveLeftVertex=n,void(this._curveLeftLeftVertex=i);this._curveLeftVertex=t.getInformationAboutPoint(-1,-1),this._curveLeftLeftVertex=t.getInformationAboutPoint(-2,-1)}_isCurrentStepValid(){const t=this._session;if(!t)return!1;if("placing-left-left"===this.placementState){const e=t.getInformationAboutPoint(-1,-1)?.point,n=t.getInformationAboutPoint(-2,-1)?.point;return!!e&&!(n&&g(e,n))}if("placing-left"===this.placementState){const e=t.getInformationAboutPoint(-1,-1)?.point,n=t.getInformationAboutPoint(-2,-1)?.point;return!(!e||!n)&&!g(e,n)}if("placing-end"===this.placementState){if(!this.curveEndPoint||!this.curveDefinition)return!1;this._refreshAnchorInfo();const t=this._curveLeftVertex?.point;return!!t&&!g(this.curveEndPoint,t)}return!0}_updateStagedGeometry(){const{_session:t,_isComplete:e,curveEndPoint:n}=this;if(e||!t||!n)return;if(this._refreshAnchorInfo(),!this._curveLeftVertex||!this._curveLeftLeftVertex)return void(this.curveDefinition=null);const i=this._curveLeftVertex.point,r=b(this._curveLeftVertex,this._curveLeftLeftVertex);if(!r||!i)return void(this.curveDefinition=null);const c=r,a=[n.x,n.y],l=[a[0]-i.x,a[1]-i.y],u=I([i.x,i.y],a,c);if(!u)return void(this.curveDefinition=null);const f={a:[a,u,o(c,l)<0?0:1,s(x,c,l)[2]>0?0:1]},h=v([i.x,i.y],f),d=p(h,.5);this.curveDefinition={c:[a,d]},this._session?.appendOrReplaceCurve(S,this.curveDefinition)}_commitArcSegment(){this.curveEndPoint&&this.curveDefinition&&(this._isComplete=!0,this._context?.requestComplete())}};function I([t,e],[n,i],[r,o]){const s=n-t,c=i-e,a=s*s+c*c,p=-o,l=r,u=p*s+l*c;if(V(u*u,a))return null;const f=a/(2*u);return[t+f*p,e+f*l]}function V(t,e){return t<1e-8*e}function b(t,e){if(!t.point||!e.point)return null;const n=t.curveInfo,i=[e.point.x,e.point.y];if(!n||u(n)){return C([t.point.x,t.point.y],i)}return f(n)?l(i,n):h(n)?_(i,n):d(n)?L(i,n):m(n)?a(i,n):null}function C(t,e){return[t[0]-e[0],t[1]-e[1]]}t([i()],w.prototype,"_primaryInteractiveHandle",void 0),t([i()],w.prototype,"_curveLeftVertex",void 0),t([i()],w.prototype,"_curveLeftLeftVertex",void 0),t([i()],w.prototype,"_availableAnchorCount",null),t([i()],w.prototype,"_automaticRestart",null),t([i()],w.prototype,"curveDefinition",void 0),t([i()],w.prototype,"curveEndPoint",void 0),t([i()],w.prototype,"ownPlacedLeftLeftAnchor",void 0),t([i()],w.prototype,"ownPlacedLeftAnchor",void 0),t([i()],w.prototype,"placementState",void 0),w=t([r("esri.views.draw.plugins.TangentArcSegmentPlugin")],w);export{w as TangentArcSegmentPlugin,I as centerFromTwoPointsAndTangent};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import e from"../../core/Error.js";import has from"../../core/has.js";import r from"../../core/Logger.js";const n=()=>r.getLogger("esri.views.webgl.checkWebGLError");function t(e){switch(e.getError()){case e.NO_ERROR:return null;case e.INVALID_ENUM:return"Invalid Enum. An unacceptable value has been specified for an enumerated argument.";case e.INVALID_VALUE:return"Invalid Value. A numeric argument is out of range.";case e.INVALID_OPERATION:return"Invalid Operation. The specified command is not allowed for the current state.";case e.INVALID_FRAMEBUFFER_OPERATION:return"Invalid Framebuffer operation. The currently bound framebuffer is not framebuffer complete when trying to render to or to read from it.";case e.OUT_OF_MEMORY:return"Out of memory. Not enough memory is left to execute the command.";case e.CONTEXT_LOST_WEBGL:return"WebGL context has been lost";default:return"Unknown error"}}const o=!!has("enable-feature:webgl-debug");function a(){return o}function c(){return o}function u(r,o=a()){if(o){const o=t(r);if(o){const r=(new Error).stack;n().error(new e("webgl-error","WebGL error occurred",{message:o,stack:r}))}}}export{u as checkWebGLError,t as getErrorMessage,o as hasFeatureFlagWebGLDebug,a as webglDebugEnabled,c as webglValidateShadersEnabled};
2
+ import e from"../../core/Error.js";import has from"../../core/has.js";import r from"../../core/Logger.js";const n=()=>r.getLogger("esri.views.webgl.checkWebGLError");function o(e){switch(e.getError()){case e.NO_ERROR:return null;case e.INVALID_ENUM:return"Invalid Enum. An unacceptable value has been specified for an enumerated argument.";case e.INVALID_VALUE:return"Invalid Value. A numeric argument is out of range.";case e.INVALID_OPERATION:return"Invalid Operation. The specified command is not allowed for the current state.";case e.INVALID_FRAMEBUFFER_OPERATION:return"Invalid Framebuffer operation. The currently bound framebuffer is not framebuffer complete when trying to render to or to read from it.";case e.OUT_OF_MEMORY:return"Out of memory. Not enough memory is left to execute the command.";case e.CONTEXT_LOST_WEBGL:return"WebGL context has been lost";default:return"Unknown error"}}const t=!!has("enable-feature:webgl-debug");function a(){return t}function c(){return t}function u(r,t=a()){if(t){const t=o(r);if(t){const r=(new Error).stack;n().error(new e("webgl-error","WebGL error occurred",{message:t,stack:r}))}}}function s(e){if(!e)return;const r=o(e);if(r)throw new Error(`WebGL error: "${r}"`)}export{u as checkWebGLError,o as getErrorMessage,t as hasFeatureFlagWebGLDebug,s as throwOnWebGLError,a as webglDebugEnabled,c as webglValidateShadersEnabled};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import i from"../../../core/Accessor.js";import{isSome as t}from"../../../core/arrayUtils.js";import l from"../../../core/Error.js";import{handlesGroup as n}from"../../../core/handleUtils.js";import o from"../../../core/Logger.js";import{throwIfAborted as r}from"../../../core/promiseUtils.js";import{watch as s}from"../../../core/reactiveUtils.js";import{property as a}from"../../../core/accessorSupport/decorators/property.js";import{subclass as u}from"../../../core/accessorSupport/decorators/subclass.js";let g=class extends i{constructor(e){super(e),this._pluginLoadPromise=null,this._pluginConstructors=null}get _simplePointPlugin(){const e=Symbol.for("esri-builtin-plugin-leaf-point");return{uniqueId:e,localizationKey:"leaf-point-segment",kind:["vertex"],geometryType:"point",icon:"line-straight",legacyCreateTool:"point",create:()=>this._createPlugin(e),[Symbol.toStringTag]:"Point"}}get _hybridSegmentPlugin(){const e=Symbol.for("esri-builtin-plugin-freehand");return{...this._simplePointPlugin,create:()=>{const i=this._createPlugin(e);return i.completeOnDragEnd=!0,i.snappingBehavior="when-not-capturing",i},[Symbol.toStringTag]:"Hybrid Segment"}}get _pointLikeFreehandSegmentPlugin(){const e=Symbol.for("esri-builtin-plugin-freehand");return{...this._simplePointPlugin,create:()=>{const i=this._createPlugin(e);return i.completeOnDragEnd=!0,i.snappingBehavior="when-not-capturing",i},[Symbol.toStringTag]:"Freehand Segment"}}get _effectiveConfiguredDrawingMode(){return this.sketchViewModel?.defaultCreateOptions?.mode??"click"}get _effectivePointLikePlugin(){switch(this._effectiveConfiguredDrawingMode){case"hybrid":return this._hybridSegmentPlugin;case"freehand":return this._pointLikeFreehandSegmentPlugin;default:return this._simplePointPlugin}}get _simplePointPluginRoot(){return{...this._simplePointPlugin,icon:"pin",localizationKey:"root-point",create:()=>{const e=this._createPlugin(this._simplePointPlugin.uniqueId);return e.enableHelpMessages=!0,e}}}get _textPointPlugin(){const e=Symbol.for("esri-builtin-plugin-text-point");return{uniqueId:e,localizationKey:"root-text",kind:["vertex"],geometryType:"point",icon:"add-text",legacyCreateTool:"text",create:()=>this._createPlugin(e),[Symbol.toStringTag]:"Text"}}get _multipointPlugin(){const e={...this._simplePointPlugin,localizationKey:"leaf-point",icon:"point",hidden:!0},i=Symbol.for("esri-builtin-plugin-multipoint");return{uniqueId:i,localizationKey:"root-multipoint",kind:["part"],geometryType:"multipoint",icon:"pins",legacyCreateTool:"multipoint",excludedViews:["3d"],create:()=>this._createPlugin(i),availableDownstreamPlugins:[e],defaultDownstreamPlugin:e,[Symbol.toStringTag]:"Multipoint"}}get _freehandPlugin(){const e=Symbol.for("esri-builtin-plugin-freehand");return{uniqueId:e,localizationKey:"leaf-freehand",kind:["vertex","section","part"],geometryType:"polyline",icon:"freehand",legacyCreateTool:"freehandPolyline",create:()=>{const i=this._createPlugin(e);return i.completeOnDragEnd=!0,i.snappingBehavior="when-not-capturing",i},[Symbol.toStringTag]:"Freehand"}}get _bezierPlugin(){const e=Symbol.for("esri-builtin-plugin-bezier-segment");return{uniqueId:e,localizationKey:"leaf-bezier",kind:["vertex","section"],geometryType:"point",curveTypes:["cubic-bezier"],icon:"bezier-curve",excludedViews:["3d"],create:()=>this._createPlugin(e),[Symbol.toStringTag]:"Bezier"}}get _endpointArcPlugin(){const e=Symbol.for("esri-builtin-plugin-circular-arc-segment-end-first");return{uniqueId:e,localizationKey:"leaf-endpoint-arc",kind:["vertex","section"],geometryType:"point",curveTypes:["circular-arc"],icon:"end-point-arc-segment",excludedViews:["3d"],create:()=>{const i=this._createPlugin(e);return i.arcDrawingMode="end-first",i},availableDownstreamPlugins:[],[Symbol.toStringTag]:"Endpoint Arc"}}get _interiorArcPlugin(){const e=Symbol.for("esri-builtin-plugin-circular-arc-segment-interior-first");return{uniqueId:e,localizationKey:"leaf-circular-arc",kind:["vertex","section"],geometryType:"point",curveTypes:["circular-arc"],icon:"arc-segment",excludedViews:["3d"],create:()=>{const i=this._createPlugin(e);return i.arcDrawingMode="interior-first",i},availableDownstreamPlugins:[],[Symbol.toStringTag]:"Interior Arc"}}get _singlePartPolylinePlugin(){const e=this.sketch?.visibleElements.createTools,i=!this._isExcludedByAvailableCreateTools("freehandPolyline")&&!1!==e?.freehandPolyline,l=!this._isExcludedByAvailableCreateTools("polyline")&&!1!==e?.polyline,n="freehand"===this._effectiveConfiguredDrawingMode&&i?this._simplePointPlugin:this._effectivePointLikePlugin,o=Symbol.for("esri-builtin-plugin-simple-polyline");return{uniqueId:o,localizationKey:"root-polyline",kind:["section","part"],geometryType:"polyline",legacyCreateTool:"polyline",icon:l?"line":"freehand",create:()=>this._createPlugin(o),availableDownstreamPlugins:l?[n,i?this._freehandPlugin:null,this._bezierPlugin,this._interiorArcPlugin,this._endpointArcPlugin].filter(t):[i?this._freehandPlugin:null].filter(t),defaultDownstreamPlugin:l?n:this._freehandPlugin,[Symbol.toStringTag]:"Polyline"}}get _singlePartPolygonPlugin(){const e=this.sketch?.visibleElements.createTools,i=!this._isExcludedByAvailableCreateTools("freehandPolygon")&&!1!==e?.freehandPolygon,l=!this._isExcludedByAvailableCreateTools("polygon")&&!1!==e?.polygon,n="freehand"===this._effectiveConfiguredDrawingMode&&i?this._simplePointPlugin:this._effectivePointLikePlugin,o=Symbol.for("esri-builtin-plugin-simple-polygon");return{uniqueId:o,localizationKey:"root-polygon",kind:["section","part"],geometryType:"polygon",legacyCreateTool:"polygon",icon:l?"polygon":"freehand-area",create:()=>this._createPlugin(o),availableDownstreamPlugins:l?[n,i?this._freehandPlugin:null,this._bezierPlugin,this._interiorArcPlugin,this._endpointArcPlugin].filter(t):[i?this._freehandPlugin:null].filter(t),defaultDownstreamPlugin:l?n:this._freehandPlugin,[Symbol.toStringTag]:"Polygon"}}get _rectanglePlugin(){const e=Symbol.for("esri-builtin-plugin-simple-rectangle");return{uniqueId:e,localizationKey:"root-rectangle",kind:["part"],geometryType:"polygon",icon:"rectangle",legacyCreateTool:"rectangle",create:()=>this._createPlugin(e),[Symbol.toStringTag]:"Rectangle"}}get _circlePlugin(){const e=Symbol.for("esri-builtin-plugin-simple-ellipse");return{uniqueId:e,localizationKey:"root-circle",kind:["part"],geometryType:"polygon",icon:"circle",legacyCreateTool:"circle",create:()=>{const i=this._createPlugin(e);return i.shapeType="circle",i.defaultUniform=!0,i.defaultCentered=!0,i},[Symbol.toStringTag]:"Circle"}}set sketch(e){this._set("sketch",e)}set sketchViewModel(e){this._overrideIfSome("sketchViewModel",e)}get sketchViewModel(){return this.sketch?.viewModel}get effectiveRootPoint(){const e=this.sketch?.visibleElements.createTools;return!1!==e?.point&&!this._isExcludedByAvailableCreateTools("point")?this._simplePointPluginRoot:null}get effectiveRootText(){const e=this.sketch?.visibleElements.createTools;return!1!==e?.text&&!this._isExcludedByAvailableCreateTools("text")?this._textPointPlugin:null}get effectiveRootMultipoint(){const e=this.sketch?.visibleElements.createTools;return!1!==e?.multipoint&&!this._isExcludedByAvailableCreateTools("multipoint")&&"3d"!==this.sketchViewModel?.view?.type?this._multipointPlugin:null}get effectiveRootPolyline(){const e=this.sketch?.visibleElements.createTools,i=!this._isExcludedByAvailableCreateTools("polyline")&&!1!==e?.polyline,t=!this._isExcludedByAvailableCreateTools("freehandPolyline")&&!1!==e?.freehandPolyline;return i||t?this._singlePartPolylinePlugin:null}get effectiveRootPolygon(){const e=this.sketch?.visibleElements.createTools,i=!this._isExcludedByAvailableCreateTools("polygon")&&!1!==e?.polygon,t=!this._isExcludedByAvailableCreateTools("freehandPolygon")&&!1!==e?.freehandPolygon;return i||t?this._singlePartPolygonPlugin:null}get effectiveRootRectangle(){const e=this.sketch?.visibleElements.createTools;return!1!==e?.rectangle&&!this._isExcludedByAvailableCreateTools("rectangle")?this._rectanglePlugin:null}get effectiveRootCircle(){const e=this.sketch?.visibleElements.createTools;return!1!==e?.circle&&!this._isExcludedByAvailableCreateTools("circle")?this._circlePlugin:null}get availablePlugins(){const e=[this.effectiveRootPoint,this.effectiveRootText,this.effectiveRootMultipoint,this.effectiveRootPolyline,this.effectiveRootPolygon,this.effectiveRootRectangle,this.effectiveRootCircle].filter(t),i=this.sketch?.availableCreateTools;if(!i)return e;const l=e=>{if(!e.legacyCreateTool)return Number.MAX_SAFE_INTEGER;const t=i.indexOf(e.legacyCreateTool);return-1===t?Number.MAX_SAFE_INTEGER:t};return e.map((e,i)=>({plugin:e,index:i,order:l(e)})).sort((e,i)=>e.order-i.order||e.index-i.index).map(({plugin:e})=>e)}get loaded(){return null!=this._pluginConstructors}getPluginsEquivalentToCreateTool(e,i){switch(e){case"text":return[this._textPointPlugin];case"point":return[this._simplePointPluginRoot];case"rectangle":return[this._rectanglePlugin];case"circle":return[this._circlePlugin];case"freehandPolyline":return[this._singlePartPolylinePlugin,this._freehandPlugin];case"freehandPolygon":return[this._singlePartPolygonPlugin,this._freehandPlugin];case"polyline":if("freehand"===i){const e=this.sketch?.viewModel?.defaultCreateOptions?.mode;return"freehand"!==e?[this._singlePartPolylinePlugin,this._freehandPlugin]:[this._singlePartPolylinePlugin,this._effectivePointLikePlugin]}return"hybrid"===i?[this._singlePartPolylinePlugin,this._hybridSegmentPlugin]:[this._singlePartPolylinePlugin,this._simplePointPlugin];case"polygon":if("freehand"===i){const e=this.sketch?.viewModel?.defaultCreateOptions?.mode;return"freehand"!==e?[this._singlePartPolygonPlugin,this._freehandPlugin]:[this._singlePartPolygonPlugin,this._effectivePointLikePlugin]}return"hybrid"===i?[this._singlePartPolygonPlugin,this._hybridSegmentPlugin]:[this._singlePartPolygonPlugin,this._simplePointPlugin];case"multipoint":return[this._multipointPlugin];default:return null}}getDrawingModeEquivalentToPluginStack(e){const i=e.at(-1);if(i===this._freehandPlugin)return"freehand";return i===this._hybridSegmentPlugin||i===this._rectanglePlugin||i===this._circlePlugin?"hybrid":"click"}async makeRenderer(e={}){const i=this.sketchViewModel;if(!i?.view)return null;const{abortOptions:t,useTextSymbol:l,customSymbol:n}=e;return"2d"===i.view.type?await this._makeDrawToolRenderer2D({view:i.view,svm:i,useTextSymbol:l,customSymbol:n,abortOptions:t}):await this._makeDrawToolRenderer3D({view:i.view,svm:i,useTextSymbol:l,abortOptions:t})}async loadPlugins(){if(!this.loaded)return this._pluginLoadPromise||(this._pluginLoadPromise=(async()=>{const[{PointPlugin:e},{MultipointPlugin:i},{PolylinePlugin:t},{PolygonPlugin:l},{FreehandSegmentPlugin:n},{BezierSegmentPlugin:o},{CircularArcSegmentPlugin:r},{ShapePlugin:s}]=await Promise.all([import("../../../views/draw/plugins/PointPlugin.js"),import("../../../views/draw/plugins/MultipointPlugin.js"),import("../../../views/draw/plugins/PolylinePlugin.js"),import("../../../views/draw/plugins/PolygonPlugin.js"),import("../../../views/draw/plugins/FreehandSegmentPlugin.js"),import("../../../views/draw/plugins/BezierSegmentPlugin.js"),import("../../../views/draw/plugins/CircularArcSegmentPlugin.js"),import("../../../views/draw/plugins/ShapePlugin.js")]);this._pluginConstructors=new Map([[Symbol.for("esri-builtin-plugin-leaf-point"),e],[Symbol.for("esri-builtin-plugin-text-point"),e],[Symbol.for("esri-builtin-plugin-multipoint"),i],[Symbol.for("esri-builtin-plugin-freehand"),n],[Symbol.for("esri-builtin-plugin-bezier-segment"),o],[Symbol.for("esri-builtin-plugin-circular-arc-segment-end-first"),r],[Symbol.for("esri-builtin-plugin-circular-arc-segment-interior-first"),r],[Symbol.for("esri-builtin-plugin-simple-polyline"),t],[Symbol.for("esri-builtin-plugin-simple-polygon"),l],[Symbol.for("esri-builtin-plugin-simple-rectangle"),s],[Symbol.for("esri-builtin-plugin-simple-ellipse"),s]])})().catch(e=>{throw this._pluginLoadPromise=null,e})),this._pluginLoadPromise}_isExcludedByAvailableCreateTools(e){return!!this.sketch&&!this.sketch.availableCreateTools?.includes(e)}_createPlugin(e){const i=this._pluginConstructors?.get(e);if(!i)throw new l("Sketch:PluginManager","Plugin implementations are not loaded. Call loadPlugins() before creating plugins.");return new i}async _makeDrawToolRenderer2D(e){const{DrawToolRenderer2D:i}=await import("../../../views/2d/interactive/editingTools/draw/DrawToolRenderer2D.js"),{view:t,svm:l,useTextSymbol:n,abortOptions:o}=e;r(o);const s=n?l.textSymbol??l.pointSymbol:l.pointSymbol,a=new i({symbolOverrides:{polyline:{outputGeometry:{default:e.customSymbol??l.polylineSymbol},outline:{active:l.activeLineSymbol??void 0}},polygon:{outputGeometry:{default:e.customSymbol??l.activeFillSymbol??l.polygonSymbol}},point:{outputGeometry:{default:e.customSymbol??s},vertex:{default:l.vertexSymbol,active:l.activeVertexSymbol??void 0}}},view:t}),u=this._setupSymbolWatcher(a,l,!!n,!!e.customSymbol);return a.addHandles(u),a}async _makeDrawToolRenderer3D(e){const{view:i,svm:t,useTextSymbol:l,abortOptions:n}=e;return o.getLogger(this).warnOnce("Using DrawToolRenderer2D in 3D view. A 3D-specific implementation of DrawToolRenderer is not yet available."),this._makeDrawToolRenderer2D({view:i,svm:t,useTextSymbol:l,abortOptions:n})}_setupSymbolWatcher(e,i,t,l){const o=(i,t,l)=>(n,o)=>{n!==o&&e.overrideSymbol({symbol:n,geometryType:i,role:t,state:l})},r=[s(()=>i.activeLineSymbol,o("polyline","outline","active")),s(()=>i.vertexSymbol,o("point","vertex")),s(()=>i.activeVertexSymbol,o("point","vertex","active"))];return l||r.push(s(()=>i.polylineSymbol,o("polyline","outputGeometry")),s(()=>i.activeFillSymbol??i.polygonSymbol,o("polygon","outputGeometry")),s(()=>t?i.textSymbol??i.pointSymbol:i.pointSymbol,o("point","outputGeometry"))),n(r)}};e([a()],g.prototype,"_simplePointPlugin",null),e([a()],g.prototype,"_hybridSegmentPlugin",null),e([a()],g.prototype,"_pointLikeFreehandSegmentPlugin",null),e([a()],g.prototype,"_effectiveConfiguredDrawingMode",null),e([a()],g.prototype,"_effectivePointLikePlugin",null),e([a()],g.prototype,"_simplePointPluginRoot",null),e([a()],g.prototype,"_textPointPlugin",null),e([a()],g.prototype,"_multipointPlugin",null),e([a()],g.prototype,"_freehandPlugin",null),e([a()],g.prototype,"_bezierPlugin",null),e([a()],g.prototype,"_endpointArcPlugin",null),e([a()],g.prototype,"_interiorArcPlugin",null),e([a()],g.prototype,"_singlePartPolylinePlugin",null),e([a()],g.prototype,"_singlePartPolygonPlugin",null),e([a()],g.prototype,"_rectanglePlugin",null),e([a()],g.prototype,"_circlePlugin",null),e([a()],g.prototype,"sketch",null),e([a()],g.prototype,"sketchViewModel",null),e([a()],g.prototype,"effectiveRootPoint",null),e([a()],g.prototype,"effectiveRootText",null),e([a()],g.prototype,"effectiveRootMultipoint",null),e([a()],g.prototype,"effectiveRootPolyline",null),e([a()],g.prototype,"effectiveRootPolygon",null),e([a()],g.prototype,"effectiveRootRectangle",null),e([a()],g.prototype,"effectiveRootCircle",null),e([a()],g.prototype,"availablePlugins",null),e([a()],g.prototype,"loaded",null),g=e([u("esri.widgets.Sketch.support.PluginManager")],g);export{g as PluginManager};
2
+ import{__decorate as e}from"tslib";import i from"../../../core/Accessor.js";import{isSome as t}from"../../../core/arrayUtils.js";import n from"../../../core/Error.js";import{handlesGroup as l}from"../../../core/handleUtils.js";import o from"../../../core/Logger.js";import{throwIfAborted as r}from"../../../core/promiseUtils.js";import{watch as s}from"../../../core/reactiveUtils.js";import{property as a}from"../../../core/accessorSupport/decorators/property.js";import{subclass as u}from"../../../core/accessorSupport/decorators/subclass.js";let g=class extends i{constructor(e){super(e),this._pluginLoadPromise=null,this._pluginConstructors=null}get _simplePointPlugin(){const e=Symbol.for("esri-builtin-plugin-leaf-point");return{uniqueId:e,localizationKey:"leaf-point-segment",kind:["vertex"],geometryType:"point",icon:"line-straight",legacyCreateTool:"point",create:()=>this._createPlugin(e),[Symbol.toStringTag]:"Point"}}get _hybridSegmentPlugin(){const e=Symbol.for("esri-builtin-plugin-freehand");return{...this._simplePointPlugin,create:()=>{const i=this._createPlugin(e);return i.completeOnDragEnd=!0,i.snappingBehavior="when-not-capturing",i},[Symbol.toStringTag]:"Hybrid Segment"}}get _pointLikeFreehandSegmentPlugin(){const e=Symbol.for("esri-builtin-plugin-freehand");return{...this._simplePointPlugin,create:()=>{const i=this._createPlugin(e);return i.completeOnDragEnd=!0,i.snappingBehavior="when-not-capturing",i},[Symbol.toStringTag]:"Freehand Segment"}}get _effectiveConfiguredDrawingMode(){return this.sketchViewModel?.defaultCreateOptions?.mode??"click"}get _effectivePointLikePlugin(){switch(this._effectiveConfiguredDrawingMode){case"hybrid":return this._hybridSegmentPlugin;case"freehand":return this._pointLikeFreehandSegmentPlugin;default:return this._simplePointPlugin}}get _simplePointPluginRoot(){return{...this._simplePointPlugin,icon:"pin",localizationKey:"root-point",create:()=>{const e=this._createPlugin(this._simplePointPlugin.uniqueId);return e.enableHelpMessages=!0,e}}}get _textPointPlugin(){const e=Symbol.for("esri-builtin-plugin-text-point");return{uniqueId:e,localizationKey:"root-text",kind:["vertex"],geometryType:"point",icon:"add-text",legacyCreateTool:"text",create:()=>this._createPlugin(e),[Symbol.toStringTag]:"Text"}}get _multipointPlugin(){const e={...this._simplePointPlugin,localizationKey:"leaf-point",icon:"point",hidden:!0},i=Symbol.for("esri-builtin-plugin-multipoint");return{uniqueId:i,localizationKey:"root-multipoint",kind:["part"],geometryType:"multipoint",icon:"pins",legacyCreateTool:"multipoint",excludedViews:["3d"],create:()=>this._createPlugin(i),availableDownstreamPlugins:[e],defaultDownstreamPlugin:e,[Symbol.toStringTag]:"Multipoint"}}get _freehandPlugin(){const e=Symbol.for("esri-builtin-plugin-freehand");return{uniqueId:e,localizationKey:"leaf-freehand",kind:["vertex","section","part"],geometryType:"polyline",icon:"freehand",legacyCreateTool:"freehandPolyline",create:()=>{const i=this._createPlugin(e);return i.completeOnDragEnd=!0,i.snappingBehavior="when-not-capturing",i},[Symbol.toStringTag]:"Freehand"}}get _bezierPlugin(){const e=Symbol.for("esri-builtin-plugin-bezier-segment");return{uniqueId:e,localizationKey:"leaf-bezier",kind:["vertex","section"],geometryType:"point",curveTypes:["cubic-bezier"],icon:"bezier-curve",excludedViews:["3d"],create:()=>this._createPlugin(e),[Symbol.toStringTag]:"Bezier"}}get _tangentArcPlugin(){const e=Symbol.for("esri-builtin-plugin-tangent-arc-segment");return{uniqueId:e,localizationKey:"leaf-tangent-arc",kind:["vertex","section"],geometryType:"point",curveTypes:["circular-arc"],icon:"arc-segment",excludedViews:["3d"],create:()=>this._createPlugin(e),availableDownstreamPlugins:[],[Symbol.toStringTag]:"Tangent Arc"}}get _endpointArcPlugin(){const e=Symbol.for("esri-builtin-plugin-circular-arc-segment-end-first");return{uniqueId:e,localizationKey:"leaf-endpoint-arc",kind:["vertex","section"],geometryType:"point",curveTypes:["circular-arc"],icon:"end-point-arc-segment",excludedViews:["3d"],create:()=>{const i=this._createPlugin(e);return i.arcDrawingMode="end-first",i},availableDownstreamPlugins:[],[Symbol.toStringTag]:"Endpoint Arc"}}get _interiorArcPlugin(){const e=Symbol.for("esri-builtin-plugin-circular-arc-segment-interior-first");return{uniqueId:e,localizationKey:"leaf-circular-arc",kind:["vertex","section"],geometryType:"point",curveTypes:["circular-arc"],icon:"arc-segment",excludedViews:["3d"],create:()=>{const i=this._createPlugin(e);return i.arcDrawingMode="interior-first",i},availableDownstreamPlugins:[],[Symbol.toStringTag]:"Interior Arc"}}get _singlePartPolylinePlugin(){const e=this.sketch?.visibleElements.createTools,i=!this._isExcludedByAvailableCreateTools("freehandPolyline")&&!1!==e?.freehandPolyline,n=!this._isExcludedByAvailableCreateTools("polyline")&&!1!==e?.polyline,l="freehand"===this._effectiveConfiguredDrawingMode&&i?this._simplePointPlugin:this._effectivePointLikePlugin,o=Symbol.for("esri-builtin-plugin-simple-polyline");return{uniqueId:o,localizationKey:"root-polyline",kind:["section","part"],geometryType:"polyline",legacyCreateTool:"polyline",icon:n?"line":"freehand",create:()=>this._createPlugin(o),availableDownstreamPlugins:n?[l,i?this._freehandPlugin:null,this._bezierPlugin,this._tangentArcPlugin,this._interiorArcPlugin,this._endpointArcPlugin].filter(t):[i?this._freehandPlugin:null].filter(t),defaultDownstreamPlugin:n?l:this._freehandPlugin,[Symbol.toStringTag]:"Polyline"}}get _singlePartPolygonPlugin(){const e=this.sketch?.visibleElements.createTools,i=!this._isExcludedByAvailableCreateTools("freehandPolygon")&&!1!==e?.freehandPolygon,n=!this._isExcludedByAvailableCreateTools("polygon")&&!1!==e?.polygon,l="freehand"===this._effectiveConfiguredDrawingMode&&i?this._simplePointPlugin:this._effectivePointLikePlugin,o=Symbol.for("esri-builtin-plugin-simple-polygon");return{uniqueId:o,localizationKey:"root-polygon",kind:["section","part"],geometryType:"polygon",legacyCreateTool:"polygon",icon:n?"polygon":"freehand-area",create:()=>this._createPlugin(o),availableDownstreamPlugins:n?[l,i?this._freehandPlugin:null,this._bezierPlugin,this._tangentArcPlugin,this._interiorArcPlugin,this._endpointArcPlugin].filter(t):[i?this._freehandPlugin:null].filter(t),defaultDownstreamPlugin:n?l:this._freehandPlugin,[Symbol.toStringTag]:"Polygon"}}get _rectanglePlugin(){const e=Symbol.for("esri-builtin-plugin-simple-rectangle");return{uniqueId:e,localizationKey:"root-rectangle",kind:["part"],geometryType:"polygon",icon:"rectangle",legacyCreateTool:"rectangle",create:()=>this._createPlugin(e),[Symbol.toStringTag]:"Rectangle"}}get _circlePlugin(){const e=Symbol.for("esri-builtin-plugin-simple-ellipse");return{uniqueId:e,localizationKey:"root-circle",kind:["part"],geometryType:"polygon",icon:"circle",legacyCreateTool:"circle",create:()=>{const i=this._createPlugin(e);return i.shapeType="circle",i.defaultUniform=!0,i.defaultCentered=!0,i},[Symbol.toStringTag]:"Circle"}}set sketch(e){this._set("sketch",e)}set sketchViewModel(e){this._overrideIfSome("sketchViewModel",e)}get sketchViewModel(){return this.sketch?.viewModel}get effectiveRootPoint(){const e=this.sketch?.visibleElements.createTools;return!1!==e?.point&&!this._isExcludedByAvailableCreateTools("point")?this._simplePointPluginRoot:null}get effectiveRootText(){const e=this.sketch?.visibleElements.createTools;return!1!==e?.text&&!this._isExcludedByAvailableCreateTools("text")?this._textPointPlugin:null}get effectiveRootMultipoint(){const e=this.sketch?.visibleElements.createTools;return!1!==e?.multipoint&&!this._isExcludedByAvailableCreateTools("multipoint")&&"3d"!==this.sketchViewModel?.view?.type?this._multipointPlugin:null}get effectiveRootPolyline(){const e=this.sketch?.visibleElements.createTools,i=!this._isExcludedByAvailableCreateTools("polyline")&&!1!==e?.polyline,t=!this._isExcludedByAvailableCreateTools("freehandPolyline")&&!1!==e?.freehandPolyline;return i||t?this._singlePartPolylinePlugin:null}get effectiveRootPolygon(){const e=this.sketch?.visibleElements.createTools,i=!this._isExcludedByAvailableCreateTools("polygon")&&!1!==e?.polygon,t=!this._isExcludedByAvailableCreateTools("freehandPolygon")&&!1!==e?.freehandPolygon;return i||t?this._singlePartPolygonPlugin:null}get effectiveRootRectangle(){const e=this.sketch?.visibleElements.createTools;return!1!==e?.rectangle&&!this._isExcludedByAvailableCreateTools("rectangle")?this._rectanglePlugin:null}get effectiveRootCircle(){const e=this.sketch?.visibleElements.createTools;return!1!==e?.circle&&!this._isExcludedByAvailableCreateTools("circle")?this._circlePlugin:null}get availablePlugins(){const e=[this.effectiveRootPoint,this.effectiveRootText,this.effectiveRootMultipoint,this.effectiveRootPolyline,this.effectiveRootPolygon,this.effectiveRootRectangle,this.effectiveRootCircle].filter(t),i=this.sketch?.availableCreateTools;if(!i)return e;const n=e=>{if(!e.legacyCreateTool)return Number.MAX_SAFE_INTEGER;const t=i.indexOf(e.legacyCreateTool);return-1===t?Number.MAX_SAFE_INTEGER:t};return e.map((e,i)=>({plugin:e,index:i,order:n(e)})).sort((e,i)=>e.order-i.order||e.index-i.index).map(({plugin:e})=>e)}get loaded(){return null!=this._pluginConstructors}getPluginsEquivalentToCreateTool(e,i){switch(e){case"text":return[this._textPointPlugin];case"point":return[this._simplePointPluginRoot];case"rectangle":return[this._rectanglePlugin];case"circle":return[this._circlePlugin];case"freehandPolyline":return[this._singlePartPolylinePlugin,this._freehandPlugin];case"freehandPolygon":return[this._singlePartPolygonPlugin,this._freehandPlugin];case"polyline":if("freehand"===i){const e=this.sketch?.viewModel?.defaultCreateOptions?.mode;return"freehand"!==e?[this._singlePartPolylinePlugin,this._freehandPlugin]:[this._singlePartPolylinePlugin,this._effectivePointLikePlugin]}return"hybrid"===i?[this._singlePartPolylinePlugin,this._hybridSegmentPlugin]:[this._singlePartPolylinePlugin,this._simplePointPlugin];case"polygon":if("freehand"===i){const e=this.sketch?.viewModel?.defaultCreateOptions?.mode;return"freehand"!==e?[this._singlePartPolygonPlugin,this._freehandPlugin]:[this._singlePartPolygonPlugin,this._effectivePointLikePlugin]}return"hybrid"===i?[this._singlePartPolygonPlugin,this._hybridSegmentPlugin]:[this._singlePartPolygonPlugin,this._simplePointPlugin];case"multipoint":return[this._multipointPlugin];default:return null}}getDrawingModeEquivalentToPluginStack(e){const i=e.at(-1);if(i===this._freehandPlugin)return"freehand";return i===this._hybridSegmentPlugin||i===this._rectanglePlugin||i===this._circlePlugin?"hybrid":"click"}async makeRenderer(e={}){const i=this.sketchViewModel;if(!i?.view)return null;const{abortOptions:t,useTextSymbol:n,customSymbol:l}=e;return"2d"===i.view.type?await this._makeDrawToolRenderer2D({view:i.view,svm:i,useTextSymbol:n,customSymbol:l,abortOptions:t}):await this._makeDrawToolRenderer3D({view:i.view,svm:i,useTextSymbol:n,abortOptions:t})}async loadPlugins(){if(!this.loaded)return this._pluginLoadPromise||(this._pluginLoadPromise=(async()=>{const[{PointPlugin:e},{MultipointPlugin:i},{PolylinePlugin:t},{PolygonPlugin:n},{FreehandSegmentPlugin:l},{BezierSegmentPlugin:o},{TangentArcSegmentPlugin:r},{CircularArcSegmentPlugin:s},{ShapePlugin:a}]=await Promise.all([import("../../../views/draw/plugins/PointPlugin.js"),import("../../../views/draw/plugins/MultipointPlugin.js"),import("../../../views/draw/plugins/PolylinePlugin.js"),import("../../../views/draw/plugins/PolygonPlugin.js"),import("../../../views/draw/plugins/FreehandSegmentPlugin.js"),import("../../../views/draw/plugins/BezierSegmentPlugin.js"),import("../../../views/draw/plugins/TangentArcSegmentPlugin.js"),import("../../../views/draw/plugins/CircularArcSegmentPlugin.js"),import("../../../views/draw/plugins/ShapePlugin.js")]);this._pluginConstructors=new Map([[Symbol.for("esri-builtin-plugin-leaf-point"),e],[Symbol.for("esri-builtin-plugin-text-point"),e],[Symbol.for("esri-builtin-plugin-multipoint"),i],[Symbol.for("esri-builtin-plugin-freehand"),l],[Symbol.for("esri-builtin-plugin-bezier-segment"),o],[Symbol.for("esri-builtin-plugin-tangent-arc-segment"),r],[Symbol.for("esri-builtin-plugin-circular-arc-segment-end-first"),s],[Symbol.for("esri-builtin-plugin-circular-arc-segment-interior-first"),s],[Symbol.for("esri-builtin-plugin-simple-polyline"),t],[Symbol.for("esri-builtin-plugin-simple-polygon"),n],[Symbol.for("esri-builtin-plugin-simple-rectangle"),a],[Symbol.for("esri-builtin-plugin-simple-ellipse"),a]])})().catch(e=>{throw this._pluginLoadPromise=null,e})),this._pluginLoadPromise}_isExcludedByAvailableCreateTools(e){return!!this.sketch&&!this.sketch.availableCreateTools?.includes(e)}_createPlugin(e){const i=this._pluginConstructors?.get(e);if(!i)throw new n("Sketch:PluginManager","Plugin implementations are not loaded. Call loadPlugins() before creating plugins.");return new i}async _makeDrawToolRenderer2D(e){const{DrawToolRenderer2D:i}=await import("../../../views/2d/interactive/editingTools/draw/DrawToolRenderer2D.js"),{view:t,svm:n,useTextSymbol:l,abortOptions:o}=e;r(o);const s=l?n.textSymbol??n.pointSymbol:n.pointSymbol,a=new i({symbolOverrides:{polyline:{outputGeometry:{default:e.customSymbol??n.polylineSymbol},outline:{active:n.activeLineSymbol??void 0}},polygon:{outputGeometry:{default:e.customSymbol??n.activeFillSymbol??n.polygonSymbol}},point:{outputGeometry:{default:e.customSymbol??s},vertex:{default:n.vertexSymbol,active:n.activeVertexSymbol??void 0}}},view:t}),u=this._setupSymbolWatcher(a,n,!!l,!!e.customSymbol);return a.addHandles(u),a}async _makeDrawToolRenderer3D(e){const{view:i,svm:t,useTextSymbol:n,abortOptions:l}=e;return o.getLogger(this).warnOnce("Using DrawToolRenderer2D in 3D view. A 3D-specific implementation of DrawToolRenderer is not yet available."),this._makeDrawToolRenderer2D({view:i,svm:t,useTextSymbol:n,abortOptions:l})}_setupSymbolWatcher(e,i,t,n){const o=(i,t,n)=>(l,o)=>{l!==o&&e.overrideSymbol({symbol:l,geometryType:i,role:t,state:n})},r=[s(()=>i.activeLineSymbol,o("polyline","outline","active")),s(()=>i.vertexSymbol,o("point","vertex")),s(()=>i.activeVertexSymbol,o("point","vertex","active"))];return n||r.push(s(()=>i.polylineSymbol,o("polyline","outputGeometry")),s(()=>i.activeFillSymbol??i.polygonSymbol,o("polygon","outputGeometry")),s(()=>t?i.textSymbol??i.pointSymbol:i.pointSymbol,o("point","outputGeometry"))),l(r)}};e([a()],g.prototype,"_simplePointPlugin",null),e([a()],g.prototype,"_hybridSegmentPlugin",null),e([a()],g.prototype,"_pointLikeFreehandSegmentPlugin",null),e([a()],g.prototype,"_effectiveConfiguredDrawingMode",null),e([a()],g.prototype,"_effectivePointLikePlugin",null),e([a()],g.prototype,"_simplePointPluginRoot",null),e([a()],g.prototype,"_textPointPlugin",null),e([a()],g.prototype,"_multipointPlugin",null),e([a()],g.prototype,"_freehandPlugin",null),e([a()],g.prototype,"_bezierPlugin",null),e([a()],g.prototype,"_tangentArcPlugin",null),e([a()],g.prototype,"_endpointArcPlugin",null),e([a()],g.prototype,"_interiorArcPlugin",null),e([a()],g.prototype,"_singlePartPolylinePlugin",null),e([a()],g.prototype,"_singlePartPolygonPlugin",null),e([a()],g.prototype,"_rectanglePlugin",null),e([a()],g.prototype,"_circlePlugin",null),e([a()],g.prototype,"sketch",null),e([a()],g.prototype,"sketchViewModel",null),e([a()],g.prototype,"effectiveRootPoint",null),e([a()],g.prototype,"effectiveRootText",null),e([a()],g.prototype,"effectiveRootMultipoint",null),e([a()],g.prototype,"effectiveRootPolyline",null),e([a()],g.prototype,"effectiveRootPolygon",null),e([a()],g.prototype,"effectiveRootRectangle",null),e([a()],g.prototype,"effectiveRootCircle",null),e([a()],g.prototype,"availablePlugins",null),e([a()],g.prototype,"loaded",null),g=e([u("esri.widgets.Sketch.support.PluginManager")],g);export{g as PluginManager};