@arcgis/core 4.28.0-next.20230818 → 4.28.0-next.20230821

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 (200) hide show
  1. package/arcade/functions/centroid.js +1 -1
  2. package/assets/esri/core/workers/RemoteClient.js +1 -1
  3. package/assets/esri/core/workers/chunks/003744a45b07865f1be9.js +1 -0
  4. package/assets/esri/core/workers/chunks/034accc7cab6c88a3b31.js +1 -0
  5. package/assets/esri/core/workers/chunks/05ab09713d599687afa3.js +1 -0
  6. package/assets/esri/core/workers/chunks/{3724f23b6f5ac8ec2568.js → 12b8fe0374fa9ab4ca09.js} +1 -1
  7. package/assets/esri/core/workers/chunks/16d1a72014074e87ecb9.js +1 -0
  8. package/assets/esri/core/workers/chunks/{e4b6565c16430b28ad93.js → 19857e5420cdf23c5f2e.js} +1 -1
  9. package/assets/esri/core/workers/chunks/{1a804dea42c0fb5e5c07.js → 1bab408eaffd2c18976d.js} +1 -1
  10. package/assets/esri/core/workers/chunks/201365f53509e3f78e17.js +1 -0
  11. package/assets/esri/core/workers/chunks/{2031451b82ff70fb201a.js → 2f48f4a9a0a056ac5e1c.js} +1 -1
  12. package/assets/esri/core/workers/chunks/318b51fdee09c1fd750f.js +1 -0
  13. package/assets/esri/core/workers/chunks/{5b799dc155adeb728c74.js → 3361e3e8385f8de8820c.js} +1 -1
  14. package/assets/esri/core/workers/chunks/3ce1870c28ab6ac3648e.js +1 -0
  15. package/assets/esri/core/workers/chunks/41929e4531787389804b.js +1 -0
  16. package/assets/esri/core/workers/chunks/{55ac725127c5ea9fb942.js → 4e39252f40bc57be9d12.js} +1 -1
  17. package/assets/esri/core/workers/chunks/4e496b03ce24b1206f86.js +1 -0
  18. package/assets/esri/core/workers/chunks/{ee5f17c1790dc07f9d9e.js → 50455c84131b634ca6b4.js} +1 -1
  19. package/assets/esri/core/workers/chunks/54513578f735d274a20e.js +1 -0
  20. package/assets/esri/core/workers/chunks/{d46f8ef92e79d12384c9.js → 587437526ea77f764986.js} +1 -1
  21. package/assets/esri/core/workers/chunks/{ab720e2f0a35138564b2.js → 5ffabd1a90c5b08109aa.js} +1 -1
  22. package/assets/esri/core/workers/chunks/6108d72faf48a592c8ba.js +1 -0
  23. package/assets/esri/core/workers/chunks/6479439afae01f9bb5e6.js +1 -0
  24. package/assets/esri/core/workers/chunks/69306dfc89e877539223.js +1 -0
  25. package/assets/esri/core/workers/chunks/6db4a6f9d25691830829.js +1 -0
  26. package/assets/esri/core/workers/chunks/{61393fd3376ea599a447.js → 76e27cece1559ae815df.js} +1 -1
  27. package/assets/esri/core/workers/chunks/81526909c0fa11639038.js +1 -0
  28. package/assets/esri/core/workers/chunks/873111ddf4813cdd4903.js +1 -0
  29. package/assets/esri/core/workers/chunks/8d4f1170394a8be15da9.js +1 -0
  30. package/assets/esri/core/workers/chunks/8d8bdfda09c24e363f78.js +1 -0
  31. package/assets/esri/core/workers/chunks/9b54b5bdb6367c36f6e9.js +1 -0
  32. package/assets/esri/core/workers/chunks/b2752e038c5fa3c21e49.js +1 -0
  33. package/assets/esri/core/workers/chunks/{dd3b7cfc6f78552249a4.js → b78dc6cbe14e5817b4d9.js} +1 -1
  34. package/assets/esri/core/workers/chunks/{e31d0c7363cbceeb5ac9.js → c35b850fbfcb28133235.js} +1 -1
  35. package/assets/esri/core/workers/chunks/c83e1be4ee64320cf2fe.js +1 -0
  36. package/assets/esri/core/workers/chunks/c88869d2a647c22dc3e6.js +1 -0
  37. package/assets/esri/core/workers/chunks/cb0a5bc6deaa98026bb5.js +1 -0
  38. package/assets/esri/core/workers/chunks/{767467738aeabec14abd.js → d0c4367a197b193e95d4.js} +1 -1
  39. package/assets/esri/core/workers/chunks/{f113141e254505116b82.js → d1cc2c050423595e54e0.js} +1 -1
  40. package/assets/esri/core/workers/chunks/{7f34945036495ad7c3f8.js → d2a8bf2d090b94cb294b.js} +1 -1
  41. package/assets/esri/core/workers/chunks/{08af7f7f1950a59a8e47.js → d6c96a20e9640b433719.js} +4 -4
  42. package/assets/esri/core/workers/chunks/da5453e67d00ff546640.js +1 -0
  43. package/assets/esri/core/workers/chunks/daa79c14150c12d8bc3d.js +1 -0
  44. package/assets/esri/core/workers/chunks/ef03b78659c72de93076.js +1 -0
  45. package/assets/esri/core/workers/chunks/{c3cace5b25b5170228ba.js → f2fe89b6ac6bf6817e71.js} +1 -1
  46. package/assets/esri/core/workers/chunks/f3554627664a419e00fa.js +1 -0
  47. package/assets/esri/themes/base/_core.scss +2 -0
  48. package/assets/esri/themes/base/widgets/_DirectionalPad.scss +76 -0
  49. package/assets/esri/themes/base/widgets/_Editor.scss +65 -4
  50. package/assets/esri/themes/base/widgets/_UtilityNetworkAssociations.scss +97 -39
  51. package/assets/esri/themes/dark/main.css +1 -1
  52. package/assets/esri/themes/light/main.css +1 -1
  53. package/assets/esri/themes/light/view.css +1 -1
  54. package/assets/esri/widgets/DirectionalPad/t9n/DirectionalPad.json +1 -0
  55. package/assets/esri/widgets/DirectionalPad/t9n/DirectionalPad_en.json +1 -0
  56. package/assets/esri/widgets/Editor/t9n/Editor.json +1 -1
  57. package/assets/esri/widgets/Editor/t9n/Editor_en.json +1 -1
  58. package/assets/esri/widgets/UtilityNetworkAssociations/assets/img/line-caps/butt.png +0 -0
  59. package/assets/esri/widgets/UtilityNetworkAssociations/assets/img/line-caps/round.png +0 -0
  60. package/assets/esri/widgets/UtilityNetworkAssociations/assets/img/line-caps/square.png +0 -0
  61. package/assets/esri/widgets/UtilityNetworkAssociations/assets/img/line-patterns/dash-dot.png +0 -0
  62. package/assets/esri/widgets/UtilityNetworkAssociations/assets/img/line-patterns/dash.png +0 -0
  63. package/assets/esri/widgets/UtilityNetworkAssociations/assets/img/line-patterns/dot.png +0 -0
  64. package/assets/esri/widgets/UtilityNetworkAssociations/assets/img/line-patterns/long-dash-dot-dot.png +0 -0
  65. package/assets/esri/widgets/UtilityNetworkAssociations/assets/img/line-patterns/long-dash-dot.png +0 -0
  66. package/assets/esri/widgets/UtilityNetworkAssociations/assets/img/line-patterns/long-dash.png +0 -0
  67. package/assets/esri/widgets/UtilityNetworkAssociations/assets/img/line-patterns/short-dash-dot-dot.png +0 -0
  68. package/assets/esri/widgets/UtilityNetworkAssociations/assets/img/line-patterns/short-dash-dot.png +0 -0
  69. package/assets/esri/widgets/UtilityNetworkAssociations/assets/img/line-patterns/short-dash.png +0 -0
  70. package/assets/esri/widgets/UtilityNetworkAssociations/assets/img/line-patterns/short-dot.png +0 -0
  71. package/assets/esri/widgets/UtilityNetworkAssociations/assets/img/line-patterns/solid.png +0 -0
  72. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations.json +1 -1
  73. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_en.json +1 -1
  74. package/chunks/HighlightBlur.glsl.js +3 -3
  75. package/chunks/HighlightDownsample.glsl.js +24 -6
  76. package/chunks/SSAO.glsl.js +2 -2
  77. package/core/timeUtils.js +1 -1
  78. package/interfaces.d.ts +182 -2
  79. package/intl/date.js +1 -1
  80. package/layers/FeatureLayer.js +1 -1
  81. package/layers/ImageryLayer.js +1 -1
  82. package/layers/ImageryTileLayer.js +1 -1
  83. package/layers/StreamLayer.js +1 -1
  84. package/layers/SubtypeGroupLayer.js +1 -1
  85. package/layers/VoxelWasmPerSceneView.js +1 -1
  86. package/layers/graphics/sources/support/uploads.js +1 -1
  87. package/layers/mixins/ArcGISImageService.js +1 -1
  88. package/layers/mixins/ImageryTileMixin.js +1 -1
  89. package/layers/save/featureLayerUtils.js +1 -1
  90. package/layers/save/imageryUtils.js +1 -1
  91. package/layers/save/streamLayerUtils.js +1 -1
  92. package/libs/maquette-advanced-projector/utils.js +1 -1
  93. package/package.json +1 -1
  94. package/popup/support/FieldInfoFormat.js +1 -1
  95. package/portal/PortalItem.js +1 -1
  96. package/support/revision.js +1 -1
  97. package/views/2d/navigation/MapViewNavigation.js +1 -1
  98. package/views/3d/environment/EnvironmentRenderer.js +1 -1
  99. package/views/3d/externalRenderers/ExternalRendererStore.js +1 -1
  100. package/views/3d/layers/i3s/PointRenderer.js +1 -1
  101. package/views/3d/support/LaserLineRenderer.js +1 -1
  102. package/views/3d/terrain/OverlayRenderer.js +1 -1
  103. package/views/3d/terrain/TerrainRenderer.js +1 -1
  104. package/views/3d/terrain/TerrainSurface.js +1 -1
  105. package/views/3d/webgl-engine/core/renderPasses/RenderPassManager.js +1 -1
  106. package/views/3d/webgl-engine/effects/RenderPlugin.js +1 -1
  107. package/views/3d/webgl-engine/effects/RenderPluginManager.js +1 -1
  108. package/views/3d/webgl-engine/effects/highlight/Highlight.js +1 -1
  109. package/views/3d/webgl-engine/effects/highlight/ShadowHighlight.js +1 -1
  110. package/views/3d/webgl-engine/effects/smaa/SMAA.js +1 -1
  111. package/views/3d/webgl-engine/effects/ssao/SSAO.js +1 -1
  112. package/views/3d/webgl-engine/lib/GLMaterialRepository.js +1 -1
  113. package/views/3d/webgl-engine/lib/GLMaterials.js +1 -1
  114. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  115. package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
  116. package/views/3d/webgl-engine/materials/CheckerBoardMaterial.js +1 -1
  117. package/views/3d/webgl-engine/materials/ColorMaterial.js +1 -1
  118. package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
  119. package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
  120. package/views/3d/webgl-engine/materials/HeatmapDensityMaterial.js +1 -1
  121. package/views/3d/webgl-engine/materials/ImageMaterial.js +1 -1
  122. package/views/3d/webgl-engine/materials/LineCalloutMaterial.js +1 -1
  123. package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
  124. package/views/3d/webgl-engine/materials/MeasurementArrowMaterial.js +1 -1
  125. package/views/3d/webgl-engine/materials/NativeLineMaterial.js +1 -1
  126. package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
  127. package/views/3d/webgl-engine/materials/PatternMaterial.js +1 -1
  128. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  129. package/views/3d/webgl-engine/materials/ShadedColorMaterial.js +1 -1
  130. package/views/3d/webgl-engine/materials/SlicePlaneMaterial.js +1 -1
  131. package/views/3d/webgl-engine/materials/WaterMaterial.js +1 -1
  132. package/views/3d/webgl-engine/materials/renderers/MergedRenderer.js +1 -1
  133. package/views/3d/webgl-engine/shaders/HighlightDownsample.glsl.js +1 -1
  134. package/views/draw/DrawGraphicTool.js +1 -1
  135. package/views/draw/DrawOperation.js +1 -1
  136. package/views/interactive/sketch/constraints.js +1 -1
  137. package/views/interactive/sketch/normalizedPoint.js +1 -1
  138. package/views/interactive/snapping/SnappingManager.js +1 -1
  139. package/views/interactive/snapping/candidates/IntersectionSnappingCandidate.js +1 -1
  140. package/views/interactive/tooltip/TooltipEditableField.js +1 -1
  141. package/views/interactive/tooltip/TooltipEditableFieldAngle.js +1 -1
  142. package/views/interactive/tooltip/constraintUtils.js +5 -0
  143. package/views/support/angularMeasurementUtils.js +1 -1
  144. package/widgets/Compass/CompassViewModel.js +1 -1
  145. package/widgets/Compass/utils.js +5 -0
  146. package/widgets/DirectionalPad/DirectionalPadViewModel.d.ts +4 -0
  147. package/widgets/DirectionalPad/DirectionalPadViewModel.js +5 -0
  148. package/widgets/DirectionalPad/VisibleElements.js +5 -0
  149. package/widgets/DirectionalPad/constants.js +5 -0
  150. package/widgets/DirectionalPad/css.js +5 -0
  151. package/widgets/DirectionalPad/utils.js +5 -0
  152. package/widgets/DirectionalPad.d.ts +4 -0
  153. package/widgets/DirectionalPad.js +5 -0
  154. package/widgets/Editor/EditorViewModel.js +1 -1
  155. package/widgets/Editor/Upload.js +1 -1
  156. package/widgets/Editor/components/CreateFeaturesPanelContent.js +1 -1
  157. package/widgets/Editor/components/UploadDetails.js +1 -1
  158. package/widgets/Editor/modelUploadUtils.js +1 -1
  159. package/widgets/Editor.js +1 -1
  160. package/widgets/ElevationProfile/support/chartUtils.js +1 -1
  161. package/widgets/ElevationProfile.js +1 -1
  162. package/widgets/Feature/FeatureViewModel.js +1 -1
  163. package/widgets/Feature/support/featureUtils.js +1 -1
  164. package/widgets/FeatureForm/FeatureFormViewModel.js +1 -1
  165. package/widgets/FeatureForm/FieldInput.js +1 -1
  166. package/widgets/FeatureForm/FormExpressionsManager.js +1 -1
  167. package/widgets/FeatureForm/InputBase.js +1 -1
  168. package/widgets/FeatureForm.js +1 -1
  169. package/widgets/UtilityNetworkAssociations/UtilityNetworkAssociationsLineSymbolPicker.js +5 -0
  170. package/widgets/UtilityNetworkAssociations/UtilityNetworkAssociationsViewModel.js +1 -1
  171. package/widgets/UtilityNetworkAssociations/VisibleElements.js +5 -0
  172. package/widgets/UtilityNetworkAssociations/VisibleElementsSettingsPane.js +5 -0
  173. package/widgets/UtilityNetworkAssociations.js +1 -1
  174. package/assets/esri/core/workers/chunks/11abbbf97093b55e2417.js +0 -1
  175. package/assets/esri/core/workers/chunks/1b2a081f2c3b97ba7e00.js +0 -1
  176. package/assets/esri/core/workers/chunks/235f333177ed7ea21e01.js +0 -1
  177. package/assets/esri/core/workers/chunks/3725dd14c2da0f47198f.js +0 -1
  178. package/assets/esri/core/workers/chunks/39467e1da18924cfb9b6.js +0 -1
  179. package/assets/esri/core/workers/chunks/42595c4870c673ed451c.js +0 -1
  180. package/assets/esri/core/workers/chunks/481cdd2a4bc40c6fef66.js +0 -1
  181. package/assets/esri/core/workers/chunks/54893132e70c515ea7e3.js +0 -1
  182. package/assets/esri/core/workers/chunks/6509a4198972b323d9b6.js +0 -1
  183. package/assets/esri/core/workers/chunks/68598d2806d4aa3d8acc.js +0 -1
  184. package/assets/esri/core/workers/chunks/718d2e8ea61f3b7b70c5.js +0 -1
  185. package/assets/esri/core/workers/chunks/7bce4b5eec630ef57f1e.js +0 -1
  186. package/assets/esri/core/workers/chunks/81df7304f97d1fc3ba16.js +0 -1
  187. package/assets/esri/core/workers/chunks/8706dc9f852df9b2095d.js +0 -1
  188. package/assets/esri/core/workers/chunks/8ef26aac0fe7feb8c324.js +0 -1
  189. package/assets/esri/core/workers/chunks/91e61da22f258d9e86c5.js +0 -1
  190. package/assets/esri/core/workers/chunks/9f039bf79b34d8fd75ae.js +0 -1
  191. package/assets/esri/core/workers/chunks/a1f3352301472e4b8956.js +0 -1
  192. package/assets/esri/core/workers/chunks/a20fd9e7db37b3c3b041.js +0 -1
  193. package/assets/esri/core/workers/chunks/aa83dce42d64034a0a13.js +0 -1
  194. package/assets/esri/core/workers/chunks/c8c8471b59700914ee9d.js +0 -1
  195. package/assets/esri/core/workers/chunks/cdcf0a5e05283d37b3ac.js +0 -1
  196. package/assets/esri/core/workers/chunks/d4f9106bf2ea5d66d96a.js +0 -1
  197. package/assets/esri/core/workers/chunks/e6bfbc4347fa13db4df2.js +0 -1
  198. package/assets/esri/core/workers/chunks/f1d5487f2d828fb142ba.js +0 -1
  199. package/assets/esri/core/workers/chunks/f97f165d05439e668e05.js +0 -1
  200. package/assets/esri/core/workers/chunks/fe973d8155c22d73a4f9.js +0 -1
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../chunks/tslib.es6.js";import r from"../../../../core/Accessor.js";import{update as t}from"../../../../core/arrayUtils.js";import{unitRGBAFromColor as s}from"../../../../core/colorUtils.js";import has from"../../../../core/has.js";import{removeMaybe as i,disposeMaybe as a,destroyMaybe as n,releaseMaybe as h}from"../../../../core/maybe.js";import o from"../../../../core/PooledArray.js";import{watch as d,syncAndInitial as l,initial as _,sync as p}from"../../../../core/reactiveUtils.js";import{property as c}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as u}from"../../../../core/accessorSupport/decorators/subclass.js";import{j as m,a as f,m as T}from"../../../../chunks/mat4.js";import{I as g,c as R}from"../../../../chunks/mat4f64.js";import{s as A}from"../../../../chunks/vec4.js";import{f as P,Z as E}from"../../../../chunks/vec4f64.js";import{a as b}from"../../../../chunks/boundedPlane.js";import{debugFlags as S}from"../../support/debugFlags.js";import{TransparencyMode as I}from"../../terrain/TerrainRenderer.js";import{FBOCache as y,ColorFormat as C,DepthFormat as w}from"../core/FBOCache.js";import{RenderPassManager as O}from"../core/renderPasses/RenderPassManager.js";import{ShaderOutput as D}from"../core/shaderLibrary/ShaderOutput.js";import{HUDRenderStyle as N}from"../core/shaderLibrary/hud/HUDRenderStyle.js";import{RenderPluginManager as L}from"../effects/RenderPluginManager.js";import{Highlight as H}from"../effects/highlight/Highlight.js";import{ShadowHighlight as M}from"../effects/highlight/ShadowHighlight.js";import{SMAA as x}from"../effects/smaa/SMAA.js";import{SSAO as v}from"../effects/ssao/SSAO.js";import{AnimationTimeStep as F}from"./AnimationTimeStep.js";import{Decorations as U,RenderRequestType as G,StencilBits as B}from"./basicInterfaces.js";import{BoundingInfo as j}from"./BoundingInfo.js";import{ZERO as q,union as V}from"./depthRange.js";import{depthRangeFromScene as Q}from"./depthRangeUtils.js";import{RenderOccludedFlag as k}from"./Material.js";import{OffscreenRendering as W}from"./OffscreenRendering.js";import{RenderContext as Y}from"./RenderContext.js";import{splitRenderGeometryChangeSetByMaterial as X}from"./rendererUtils.js";import{setupFeatureDefaults as z,RenderFeature as J}from"./RenderFeature.js";import{RenderSlot as K}from"./RenderSlot.js";import{ShadowAccumulator as Z}from"./ShadowAccumulator.js";import{ShadowMap as $,SnapshotSlot as ee}from"./ShadowMap.js";import re from"./SliceHelper.js";import{TransparencyPassType as te}from"./TransparencyPassType.js";import{EdgeView as se}from"./edgeRendering/EdgeView.js";import{Transparency as ie}from"./edgeRendering/interfaces.js";import{MergedRenderer as ae}from"../materials/renderers/MergedRenderer.js";import{AlphaMode as ne}from"../shaders/CompositingTechniqueConfiguration.js";import{RendererPerformanceInfo as he,PerformanceCategory as oe}from"../statistics/RendererPerformanceInfo.js";import{RenderState as de}from"../../../support/RenderState.js";import{PixelFormat as le,PixelType as _e,ClearBufferBit as pe}from"../../../webgl/enums.js";import ce from"../../../../webscene/background/ColorBackground.js";let ue=class extends r{get _bindParameters(){return this._renderContext.bindParameters}updateRenderFeatures(e=null,r=!has("disable-feature:high-quality-idle")){this._renderStateFeatures=z(r,e),this.notifyChange("_renderStateFeatures"),this.renderPlugins.renderFeatureChanged(),this._requestRender()}isFeatureEnabled(e,r=this._state){return this._renderStateFeatures.get(r,e)??!1}setFeatureEnabled(e,r,t){this._renderStateFeatures.set(r,e,t),this.notifyChange("_renderStateFeatures"),this._requestRender()}get _highQualityTransparency(){return this._highQualityTransparencyEnabled||this.isFeatureEnabled(J.HighQualityTransparency)}get hasReflections(){return this.hasWater&&(this._ssrEnabled||this.isFeatureEnabled(J.WaterReflection))}get hasDecorations(){return this._materialRenderersHas.decorations||this._renderPlugins.hasDecorations}get hasHighlights(){return this._materialRenderersHas.highlights||this.renderPlugins.canRender(K.OPAQUE_MATERIAL,D.Highlight)||this.renderPlugins.canRender(K.DRAPED_MATERIAL,D.Highlight)}get hasShadowHighlights(){return this._materialRenderersHas.highlights||this.renderPlugins.canRender(K.OPAQUE_MATERIAL,D.ShadowHighlight)}get _magnifierEnabled(){return this._bindParameters.decorations===U.ON&&this._magnifierHelper.enabled}get fullResolutionAtmosphere(){return this._stage.view.qualitySettings.highResolutionAtmosphere||this.isFeatureEnabled(J.HighResolutionAtmosphere)}get hasWater(){return this._materialRenderersHas.water||this._hasOverlayWater}constructor(e,r,t,i,a,n,h,p){super({}),this._stage=e,this._techniqueRepository=i,this._rctx=a,this._compositingHelper=n,this._magnifierHelper=h,this._requestRender=p,this._materialRenderers=new o,this._needsTransparentPass=!1,this._materialRenderersHas={hudElements:!1,highlights:!1,water:!1,decorations:!1,occludees:!1},this._hasOverlayWater=!1,this._renderOverlay=e=>{},this._isRendering=!1,this._backgroundColor=P(0,0,0,1),this._fallbackDepthStencilTexture=null,this._sliceHelper=new re,this._state=de.IDLE,this._highQualityTransparencyEnabled=!0,this._terrainTransparency=I.Opaque,this._ssrEnabled=!1,this._hasAnimations=!1,this._animationTimestep=new F,this._renderHiddenTransparentEdges=()=>{},this._pluginInput={compositeTexture:null,normalTexture:null,highlightTexture:null},this.fboCache=new y(a),this._renderStateFeatures=z(!has("disable-feature:high-quality-idle"),e.view.qualityProfile),this._offscreen=new W(this.fboCache,this._compositingHelper),this.performanceInfo=new he(this._rctx),this._shadowMap=new $(this.fboCache,e.viewingMode),this._highlight=new H({view:e.view}),this._shadowHighlight=new M({view:e.view,viewingMode:e.viewingMode}),this._shadowAccumulator=new Z(this.fboCache,i,e,(e=>{const r=this.shadowsEnabled;this._shadowMap.enabled=!0,this._prepare(e.camera,e.contentCamera),this._renderPlugins.prepareRender(),this._shadowMap.enabled=r}),((e,r,t)=>{e.shadowMap.start(e.camera,r,t,!0,this._stage.view.qualitySettings.maximumPixelRatio),this._renderShadowCascades(D.Shadow,e.shadowMap),e.shadowMap.finish(),e.camera.setGLViewport(this._rctx),this._prepare(e.camera,e.contentCamera)}),p),this._ssao=new v({view:this._stage.view}),this._renderContext=new Y(this._rctx,this._offscreen,this._shadowMap,this._sliceHelper),this._renderPlugins=new L({renderContext:this._renderContext,techniqueRepository:i,textureRepository:t,materialRepository:r,requestRender:p,controller:e,fbos:this.fboCache,isFeatureEnabled:e=>this.isFeatureEnabled(e)}),this.renderPassManager=new O,this._renderPlugins.add(this.renderPassManager),this._smaa=new x({view:this._stage.view}),this._renderPlugins.add(this._smaa),this._renderPlugins.add(this._ssao),this._renderPlugins.add(this._highlight),this._renderPlugins.add(this._shadowHighlight),this.addHandles([d((()=>this._stage.view.state.camera),(()=>p()),l),d((()=>S.EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES),(e=>{this._renderHiddenTransparentEdges=e?()=>this._renderEdges(ie.TRANSPARENT):()=>{},p()}),_),d((()=>this._stage.view.environment.background),(e=>{const r=e instanceof ce?s(e.color):E;A(this._backgroundColor,r[0]*r[3],r[1]*r[3],r[2]*r[3],r[3])}),l)])}normalizeCtorArgs(){return{}}destroy(){this._smaa.destroy(),this._gpuTimerHandle=i(this._gpuTimerHandle),this._materialRenderers.forAll((e=>e.dispose())),this._materialRenderers.clear(),this._offscreen.dispose(),this._fallbackDepthStencilTexture=a(this._fallbackDepthStencilTexture),this._shadowMap.dispose(),this._ssao.destroy(),this._highlight.dispose(),this._shadowHighlight.destroy(),this._shadowAccumulator.dispose(),this._edgeView=n(this._edgeView),this.renderPassManager.dispose(),this._releaseFBOs(),this._disposeOffscreenBuffers(),this.fboCache.destroy(),j.prune()}_releaseFBOs(){this._bindParameters.ssr.lastFrameColor=h(this._bindParameters.ssr.lastFrameColor),this._bindParameters.multipassTerrain.linearDepth=h(this._bindParameters.multipassTerrain.linearDepth),this._bindParameters.multipassGeometry.linearDepth=h(this._bindParameters.multipassGeometry.linearDepth)}disposeOffscreenBuffers(){this._releaseFBOs(),this._disposeOffscreenBuffers()}_disposeOffscreenBuffers(){this._offscreen.dispose(),this._shadowMap.disposeOffscreenBuffers(),this._bindParameters.linearDepth=h(this._bindParameters.linearDepth),this._bindParameters.hudVisibility=h(this._bindParameters.hudVisibility)}get updating(){return this._smaa.updating||null!=this._edgeView&&this._edgeView.updating||this._shadowAccumulator.running||this._renderPlugins.updating||!this.isCameraFinal}ensureEdgeView(){if(null==this._edgeView){const e=this._stage.view.resourceController;this._edgeView=new se({rctx:this._rctx,renderSR:this._stage.view.renderSpatialReference,viewingMode:this._stage.viewingMode,techniqueRepository:this._techniqueRepository,setNeedsRender:()=>this._requestRender(),schedule:Ee(e)}),this.addHandles(d((()=>this._edgeView?.updating),(()=>this._requestRender()),p)),this._requestRender()}return this._edgeView}get edgeView(){return this._edgeView}get isCameraFinal(){return m(this._bindParameters.ssr.reprojectionMatrix,g)}set _reprojectionMatrix(e){t(this._bindParameters.ssr.reprojectionMatrix,e)&&this.notifyChange("isCameraFinal")}get shadowsEnabled(){return!!this._shadowMap?.enabled}setParameters(e){const{_shadowMap:r,_bindParameters:t}=this;if(void 0!==e.qualitySettings?.reflections&&this._ssrEnabled!==e.qualitySettings.reflections&&(this._ssrEnabled=e.qualitySettings.reflections,this._requestRender()),void 0!==e.shadowMap&&this._shadowMap.enabled!==e.shadowMap&&(this._shadowMap.enabled=e.shadowMap,this._requestRender()),void 0!==e.shadowMapMaxCascades&&r.maxCascades!==e.shadowMapMaxCascades&&(r.maxCascades=e.shadowMapMaxCascades,this._requestRender()),null!=e.environment){null!=e.environment.weather&&(this._bindParameters.weather=e.environment.weather,this._bindParameters.weatherVisible=!!e.weatherVisible);const r="virtual"!==e.environment.lighting.type;t.enableFillLights!==r&&(t.enableFillLights=r,this._requestRender())}void 0!==e.highQualityTransparency&&this._highQualityTransparencyEnabled!==e.highQualityTransparency&&(this._highQualityTransparencyEnabled=e.highQualityTransparency,this._requestRender()),void 0!==e.overlays&&this._bindParameters.overlays!==e.overlays&&(this._bindParameters.overlays=e.overlays,this._requestRender()),void 0!==e.hasOverlayWater&&this._hasOverlayWater!==e.hasOverlayWater&&(this._hasOverlayWater=e.hasOverlayWater,this._requestRender()),void 0!==e.renderOverlay&&this._renderOverlay!==e.renderOverlay&&(this._renderOverlay=e.renderOverlay,this._requestRender()),void 0!==e.slicePlane&&this._sliceHelper.plane!==e.slicePlane&&(this._sliceHelper.plane=e.slicePlane,this._requestRender()),void 0!==e.terrainTransparency&&this._terrainTransparency!==e.terrainTransparency&&(this._terrainTransparency=e.terrainTransparency,this._requestRender()),void 0!==e.shadowCastOptions&&this._shadowAccumulator.setOptions(e.shadowCastOptions)}get hasSlicePlane(){return!!this._sliceHelper.plane}get renderPlugins(){return this._renderPlugins}get _hasOITSupport(){return this._rctx.driverTest.floatBufferBlend.result}get _oitEnabled(){return this._highQualityTransparency&&this._hasOITSupport}modify(e,r){this._isRendering&&console.warn("Renderer.modify called while rendering");const{adds:t,removes:s,updates:i}=e;if(0===t.length&&0===s.length&&0===i.length)return;const a=X(e);let n=!1;a.forEach(((t,s)=>{if(r.done)return;let i=this._materialRenderers.find((e=>e.material===s));if(null==i&&t.adds.length>0){const e=new ae({material:s});e.initializeRenderContext(this.renderPlugins._context),i=e,this._materialRenderers.push(i)}i&&(i.modify(t),i.isEmpty&&(n=!0)),t.removes.forEach((r=>e.removes.removeUnordered(r))),t.adds.forEach((r=>e.adds.removeUnordered(r))),t.updates.forEach((r=>e.updates.removeUnordered(r))),r.madeProgress()})),n&&this._materialRenderers.filterInPlace((e=>!e.isEmpty||(e.dispose(),!1))),this._updateHasFlags(),this._requestRender()}_updateHasFlags(){const has=this._materialRenderersHas;has.decorations=!1,has.highlights=!1,has.hudElements=!1,has.water=!1,has.occludees=!1,this._materialRenderers.forAll((e=>{has.highlights||=e.hasHighlights,has.occludees||=e.hasOccludees,has.water||=e.hasWater,has.decorations||=e.isDecoration,has.hudElements||=e.canRender(K.LINE_CALLOUTS_HUD_DEPTH,D.Color)||e.canRender(K.HUD_MATERIAL,D.Color)||e.canRender(K.LABEL_MATERIAL,D.Color)})),this._bindParameters.hasOccludees=has.occludees}updateAnimation(e){const r=this._hasAnimations;return this._hasAnimations=!1,this._materialRenderers.forAll((r=>this._hasAnimations=r.updateAnimation(e)||this._hasAnimations)),this._hasAnimations=this._renderPlugins.updateAnimation(e)||this._hasAnimations,this._hasAnimations!==r&&(this._gpuTimerHandle=r?i(this._gpuTimerHandle):this.performanceInfo.enableGPUPerformanceInfo()),this._hasAnimations}get animationTimestep(){return this._animationTimestep.value}get animationTimeDilation(){return this._animationTimestep.timeDilation}resetAnimation(){this._animationTimestep.clear()}render(e,r,t,s,i){this._isRendering=!0,this.performanceInfo.startFrame(),this.fboCache.resetPeakMemoryUsage();const a=this._offscreen,{camera:n,contentCamera:o,mode:d,alignPixelEnabled:l}=t;this._state=d,this._renderOverlay(i),this.performanceInfo.advance(oe.OVERLAY),this._renderContext.time=i,this._bindParameters.transparencyPassType=te.NONE,this._bindParameters.alignPixelEnabled=l,this._bindParameters.decorations=s;const _=b(this._sliceHelper.plane);s===U.OFF&&(this._sliceHelper.plane=null),this._rctx.bindFramebuffer(e),n.setGLViewport(this._rctx);const p=a.initializeFrame(n,this._backgroundColor);this.hasReflections?this._bindParameters.ssr.lastFrameColor=p:p?.release(),this._prepare(n,o),this._renderPlugins.prepareRender(),this.performanceInfo.advance(oe.PREPARE);const c=this._computeDepthRange(n);this._renderShadowMap(e,n,this._bindParameters.lighting.mainLight.direction,c),this.performanceInfo.advance(oe.SHADOW_MAP),this._ensureBindParameters(n,o);const u=this._renderPlugins.canRender(K.OPAQUE_TERRAIN)&&(this._terrainTransparency===I.Semitransparent||this._terrainTransparency===I.TransparentWithDraped),m=this._highQualityTransparency&&u,f=this._needsTransparentPass||this._renderPlugins.canRender(K.TRANSPARENT_MATERIAL);this._prepareShaders(m,f),this._renderLinearDepth(),this.performanceInfo.advance(oe.LINEAR_DEPTH),this._accumulateShadows(c,n,o),this.performanceInfo.advance(oe.ACCUMULATED_SHADOWS),this._ensureBindParametersSSR(i),this._renderSSAO(),this.performanceInfo.advance(oe.SSAO),this._renderContext.output=D.Color,a.bindFbo(),this._renderOpaqueGeometry(),this.performanceInfo.advance(oe.OPAQUE),this._renderTerrainLinearDepth(m),this._setMultipassTerrain(m),this._renderEdges(ie.OPAQUE),this.performanceInfo.advance(oe.OPAQUE_EDGES),a.bindFbo(),this._renderSlot(K.VOXEL),this.performanceInfo.advance(oe.VOXEL),this._renderHiddenTransparentEdges(),f&&(this._oitEnabled?this._renderOITPass(me.Geometry):this._renderTransparentGeometry()),this.performanceInfo.advance(oe.TRANSPARENT);const T=this._renderGeometryLinearDepth(m);this._renderHUDVisibility(T),m||this._renderInternalSlot(K.LINE_CALLOUTS),this.performanceInfo.advance(oe.HUD_VISIBILITY),this._renderObjectAndLayerIdColor(r),this.performanceInfo.advance(oe.OBJECT_AND_LAYER_ID_COLOR),this._renderEdges(ie.TRANSPARENT,T),T?.release(),this.performanceInfo.advance(oe.TRANSPARENT_EDGES);const g=u?this._renderTransparentTerrain():null;g&&this._bindParameters.hudVisibility&&(m?this._renderLineCallouts(N.Occluded):a.compositeToHUDVisibility(this._bindParameters,g.colorTexture),this._renderHUD(N.Occluded,a.framebuffer),this.performanceInfo.advance(oe.HUD_OCCLUDED)),this.performanceInfo.advance(oe.TRANSPARENT_TERRAIN),this._setTerrainCulling(!1),g&&(a.compositeToFramebuffer(this._bindParameters,g.colorTexture,ne.PremultipliedAlpha,1),g.release(),m&&(this._renderEdges(ie.OPAQUE),this.performanceInfo.advance(oe.OPAQUE_EDGES),f&&(this._oitEnabled?this._renderOITPass(me.Geometry):this._renderTransparentGeometry()),this.performanceInfo.advance(oe.TRANSPARENT),this._renderEdges(ie.TRANSPARENT),this.performanceInfo.advance(oe.TRANSPARENT_EDGES))),this._bindParameters.ssao=h(this._bindParameters.ssao),m&&this._renderLineCallouts(N.NotOccluded),this._setMultipassEnabled(!1),this._shadowAccumulator.render(this._bindParameters),a.bindFbo(),this._renderInternalSlot(K.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL),this._renderSlot(K.POSTPROCESSING_ENVIRONMENT_TRANSPARENT),this.performanceInfo.advance(oe.ENVIRONMENT),this._renderLaserlines(),this.performanceInfo.advance(oe.LASER_LINES),this._renderOccluded(),this.performanceInfo.advance(oe.OCCLUDED);const R=this._renderAntialiasing(e),A=R?.fbo??e;this.performanceInfo.advance(oe.ANTIALIASING),this._renderHUD(N.NotOccluded,A),this.performanceInfo.advance(oe.HUD),this._renderHighlights(A,this._bindParameters),this.performanceInfo.advance(oe.HIGHLIGHTS),this._magnifierEnabled&&this._magnifierHelper.render(this._rctx,this._bindParameters),A!==e&&(this._rctx.bindFramebuffer(e),this._compositingHelper.composite(this._bindParameters,R?.colorTexture,ne.None)),R?.release(),this._releaseFBOs(),this._offscreen.releaseBuffers(),this._renderContext.lastFrameCamera.copyFrom(this._bindParameters.camera),this._sliceHelper.plane=_,this._isRendering=!1,this.onPostRender&&this.onPostRender(),this.performanceInfo.finishFrame()}_prepareShaders(e,r){this._renderContext.output=D.Color,this._prepareOpaqueGeometrySlots(),this._setMultipassTerrain(e),this._prepareSlots(K.TRANSPARENT_TERRAIN),this._setMultipassTerrain(!1),e||this._prepareInternalSlots(this._materialRenderers,K.LINE_CALLOUTS),r&&this._prepareTransparencySlots(),this._prepareInternalSlots(this._materialRenderers,K.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL),this._prepareSlots(K.POSTPROCESSING_ENVIRONMENT_TRANSPARENT,K.LASERLINES),this._rctx.gl.flush()}_renderObjectAndLayerIdColor(e){if(null==e||!has("enable-feature:objectAndLayerId-rendering"))return;const r=this._renderContext.output;this._rctx.bindFramebuffer(e),this._offscreen.renderToFBO((()=>this._renderGeometryAndTransparentTerrainPass(D.ObjectAndLayerIdColor)),[0,0,0,0],!0,!0),this._rctx.bindFramebuffer(e),this._offscreen.renderToFBO((()=>{this._bindParameters.hudRenderStyle=N.NotOccluded,this._renderInternalSlot(K.HUD_MATERIAL)}),void 0,!0,!0),this._renderContext.output=r}finish(e){this._hasAnimations||this._animationTimestep.clear();const r=this.performanceInfo.gpuSamplingEnabled,t=e===G.BACKGROUND;if(t||r){const e=t?this.performanceInfo.elapsedTime:0,s=r?this.performanceInfo.totalGPUTimeSampler.last:this._rctx.gl.getError(),i=Math.max(e,s);this._animationTimestep.frame(i,t)}}readDepthPixels(e,r,t){const s=this._bindParameters.linearDepth?.fbo;if(s?.colorTexture)return void s.readPixels(r[0],r[1],r[2],r[3],le.RGBA,_e.UNSIGNED_BYTE,t);const i=this.fboCache.acquire(C.RGBA,this._offscreen.width,this._offscreen.height).acquireDepth(w.DEPTH16_BUFFER);this._rctx.bindFramebuffer(i.fbo),this._ensureBindParameters(e,e),this._bindParameters.camera.setGLViewport(this._rctx),this._rctx.setClearColor(0,0,0,0);const a=pe.COLOR_BUFFER_BIT|pe.DEPTH_BUFFER_BIT|pe.STENCIL_BUFFER_BIT;this._rctx.clearSafe(a),this._renderGeometryAndTransparentTerrainPass(D.Depth),i.fbo.readPixels(r[0],r[1],r[2],r[3],le.RGBA,_e.UNSIGNED_BYTE,t),i.release()}readHUDVisibility(e,r,t,s,i){this._bindParameters.hudVisibility?.fbo.readPixels(e,r,t,s,le.RGBA,_e.UNSIGNED_BYTE,i)}readAccumulatedShadow(e){return this._shadowAccumulator.readAccumulatedShadow(e[0],e[1])}_setMultipassTerrain(e){this._setMultipassEnabled(e),this._setTerrainCulling(e)}_setMultipassEnabled(e){this._bindParameters.multipassEnabled=e}_setTerrainCulling(e){this._bindParameters.multipassTerrain.cullAboveGround=e}_prepareSlots(...e){this._renderPlugins.prepareSlots(e)}_renderSlot(e,r=null,t=null){return this._renderPlugins.render(this._renderPlugins.prepare(e),r,t)}_renderEdges(e,r){const t=this._edgeView;if(t?.shouldRender()){const{width:s,height:i,depth:a}=this._offscreen,n=this.fboCache.acquire(C.RGBA,s,i),h=()=>t.render(this._bindParameters,e);this._offscreen.renderToTargets(h,n,r??a,Te),this._offscreen.compositeToFramebuffer(this._bindParameters,n.colorTexture,ne.Alpha,1),n.release()}}_renderShadowMap(e,r,t,s){const i=this._shadowMap;i.enabled&&(i.start(r,t,s,this.isFeatureEnabled(J.HighResolutionShadows),this._stage.view.qualitySettings.maximumPixelRatio),this._shadowHighlight.updateParameters(r,t),this._needsShadowHighlight?(this._renderShadowCascades(D.ShadowHighlight,this._shadowMap),i.moveSnapshot(ee.Highlight),i.clear(),this._renderShadowCascades(D.ShadowExcludeHighlight,this._shadowMap),i.copySnapshot(ee.Default),this._renderShadowCascades(D.ShadowHighlight,this._shadowMap)):this._renderShadowCascades(D.Shadow),i.finish(),this._rctx.bindFramebuffer(e),r.setGLViewport(this._rctx))}_renderShadowCascades(e,r=this._shadowMap){for(const t of r.cascades)t.camera.setGLViewport(this._rctx),this._prepare(t.camera,t.camera),this._renderGeometryAndTransparentTerrainPass(e)}get _needsLinearDepth(){return this._renderPlugins.requires(D.Depth)||this.hasReflections||this._needsShadowHighlight||this._needsShadowCast}_renderLinearDepth(){this._needsLinearDepth?(this._bindParameters.linearDepth=this._offscreen.renderToCachedFBO(this._bindParameters.linearDepth,(()=>this._renderGeometryAndTransparentTerrainPass(D.Depth)),[0,0,0,0],C.RGBA,w.DEPTH24_BUFFER),this._bindParameters.linearDepth.releaseDepth(),this._offscreen.bindFbo()):this._bindParameters.linearDepth=h(this._bindParameters.linearDepth)}_renderTerrainLinearDepth(e){if(e){const e=this._renderContext.output;this._renderContext.output=D.Depth,this._bindParameters.multipassTerrain.linearDepth=this._offscreen.renderToCachedFBO(this._bindParameters.multipassTerrain.linearDepth,(()=>this._renderTransparentTerrain()),[-1e10,-1e10,-1e10,1]),this._bindParameters.multipassTerrain.linearDepth.releaseDepth(),this._renderContext.output=e}else this._bindParameters.multipassTerrain.linearDepth=h(this._bindParameters.multipassTerrain.linearDepth)}_renderGeometryLinearDepth(e){if(!e)return void(this._bindParameters.multipassGeometry.linearDepth=h(this._bindParameters.multipassGeometry.linearDepth));const r=this._renderContext.output;return this._bindParameters.multipassGeometry.linearDepth=this._offscreen.renderToCachedFBO(this._bindParameters.multipassGeometry.linearDepth,(()=>this._renderGeometryPass(D.Depth)),[1,1,1,1]),this._renderContext.output=r,this._bindParameters.multipassGeometry.linearDepth.detachDepth()}get _needsDepthRange(){return this._shadowMap.enabled||this._needsShadowCast}_computeDepthRange(e){if(!this._needsDepthRange)return q;const r=Q(e,this._materialRenderers,this._stage.layers);return V(r,this.renderPlugins.queryDepthRange(e)),r.near=Math.max(e.near,r.near),r.far=Math.min(e.far,r.far),r}_renderGeometryAndTransparentTerrainPass(e){this._renderContext.output=e,this._prepareSlots(K.TRANSPARENT_TERRAIN),this._renderGeometryPass(e),this._renderTransparentTerrain()}_renderGeometryPass(e){this._renderContext.output=e,this._prepareSlots(K.TRANSPARENT_MATERIAL),this._renderOpaqueGeometry(),this._renderTransparentGeometry()}_renderSSAO(){if(!this._ssao.canRender())return;const e=this._offscreen.renderToCachedFBO(null,(()=>this._renderGeometryAndTransparentTerrainPass(D.Normal)),[0,0,0,0],C.RGBA4,w.DEPTH24_BUFFER);e.releaseDepth(),this._offscreen.bindFbo(),this._pluginInput.normalTexture=e.colorTexture,this._bindParameters.ssao=this._renderSlot(K.SSAO,this._pluginInput),e.release()}_prepareOpaqueGeometrySlots(){this._prepareSlots(K.INTEGRATED_MESH,K.OPAQUE_TERRAIN,K.OPAQUE_MATERIAL,K.POSTPROCESSING_ENVIRONMENT_OPAQUE),this._prepareInternalSlots(this._materialRenderers,K.OPAQUE_MATERIAL)}_renderOpaqueGeometry(){this._renderSlot(K.INTEGRATED_MESH),this._renderSlot(K.OPAQUE_TERRAIN),this._renderInternalSlot(K.OPAQUE_MATERIAL),this._renderSlot(K.OPAQUE_MATERIAL),this._renderSlot(K.POSTPROCESSING_ENVIRONMENT_OPAQUE)}_renderTransparentGeometry(){this._renderInternalSlot(K.TRANSPARENT_MATERIAL),this._renderSlot(K.TRANSPARENT_MATERIAL)}_renderTransparentTerrain(){const e=this._renderPlugins.prepare(K.TRANSPARENT_TERRAIN);if(0===e.size)return;const r=()=>this._renderPlugins.render(e,null);if(this._renderContext.output!==D.Color)return void r();const{width:t,height:s,depth:i}=this._offscreen,a=this.fboCache.acquire(C.RGBA,t,s);return this._offscreen.renderToTargets(r,a,i,[0,0,0,0]),a}_renderHUDVisibility(e){this._prepareInternalSlots(this._materialRenderers,K.OCCLUSION_PIXELS)?(this._bindParameters.hudVisibility=this._offscreen.renderHUDVisibility(this._bindParameters.hudVisibility,(()=>this._renderInternalSlot(K.OCCLUSION_PIXELS)),e),this._offscreen.bindFbo()):this._bindParameters.hudVisibility=h(this._bindParameters.hudVisibility)}_renderLineCallouts(e){if(this._bindParameters.hudRenderStyle=e,e===N.Occluded){const e=()=>this._renderInternalSlot(K.LINE_CALLOUTS),{width:r,height:t,color:s}=this._offscreen,i=this.fboCache.acquireDepth(w.DEPTH16_BUFFER,r,t);this._offscreen.renderToTargets(e,s,i,void 0,!0,!0),i.release()}else this._renderInternalSlot(K.LINE_CALLOUTS)}_renderLaserlines(){if(this._renderSlot(K.LASERLINES),this._renderPlugins.canRender(K.LASERLINES_CONTRAST_CONTROL)){const e=this._offscreen,{width:r,height:t,depth:s}=e,i=this.fboCache.acquire(C.RGBA,r,t),a=()=>this._renderSlot(K.LASERLINES_CONTRAST_CONTROL);e.renderToTargets(a,i,s,Te),e.compositeToFramebuffer(this._bindParameters,i.colorTexture,ne.PremultipliedAlpha,1),i.release()}}_renderHUD(e,r){if(this._materialRenderersHas.hudElements)if(this._oitEnabled){const t=this._renderOITPass(me.HUD,e);this._rctx.bindFramebuffer(r),this._compositingHelper.composite(this._bindParameters,t.colorTexture,ne.PremultipliedAlpha),t.release()}else if(e===N.Occluded){const r=()=>this._renderHUDElements(e),{width:t,height:s,color:i}=this._offscreen,a=this.fboCache.acquireDepth(w.DEPTH16_BUFFER,t,s);this._offscreen.renderToTargets(r,i,a,void 0,!0,!0),a.release()}else this._renderHUDElements(e)}_renderHUDElements(e){this._bindParameters.hudRenderStyle=e,this._prepareInternalSlots(this._materialRenderers,K.LINE_CALLOUTS_HUD_DEPTH,K.HUD_MATERIAL,K.LABEL_MATERIAL),this._renderInternalSlot(K.LINE_CALLOUTS_HUD_DEPTH),this._renderInternalSlot(K.HUD_MATERIAL),this._renderInternalSlot(K.LABEL_MATERIAL)}get _needsShadowHighlight(){return this._shadowMap.enabled&&this._renderPlugins.canRender(K.SHADOW_HIGHLIGHT)&&this.hasShadowHighlights}_renderHighlights(e,r){if(!this.hasHighlights||r.decorations===U.OFF)return;const t=()=>{this._renderGeometryAndTransparentTerrainPass(D.Highlight),this._rctx.clearSafe(pe.DEPTH_BUFFER_BIT),this._renderHUDElements(N.Both)},s=this._offscreen.renderToCachedFBO(null,t,[0,0,0,0],C.RGBA4,w.DEPTH_STENCIL_TEXTURE);this._needsShadowHighlight&&(this._pluginInput.highlightTexture=s.fbo.colorTexture,this._renderSlot(K.SHADOW_HIGHLIGHT,this._pluginInput,e)),s.releaseDepth(),this.renderPlugins.canRender(K.HIGHLIGHT)&&(this._pluginInput.compositeTexture=null,this._pluginInput.normalTexture=null,this._pluginInput.highlightTexture=s.fbo.colorTexture,this._renderSlot(K.HIGHLIGHT,this._pluginInput,e)),s.release()}get _needsShadowCast(){return this._shadowAccumulator.isAccumulating}_accumulateShadows(e,r,t){this._needsShadowCast&&this._bindParameters.linearDepth?.colorTexture&&this._shadowAccumulator.renderAccumulation(this._bindParameters.linearDepth,e,r,t)}_prepareTransparencySlots(){this._renderContext.output=D.Alpha,this._bindParameters.transparencyPassType=te.Alpha,this._prepareInternalSlots(this._materialRenderers,K.TRANSPARENT_MATERIAL),this._prepareSlots(K.TRANSPARENT_MATERIAL),this._renderContext.output=D.Color,this._bindParameters.transparencyPassType=te.Color,this._prepareInternalSlots(this._materialRenderers,K.TRANSPARENT_MATERIAL),this._prepareSlots(K.TRANSPARENT_MATERIAL),this._bindParameters.transparencyPassType=te.FrontFace,this._prepareInternalSlots(this._materialRenderers,K.TRANSPARENT_MATERIAL),this._prepareSlots(K.TRANSPARENT_MATERIAL),this._bindParameters.transparencyPassType=te.NONE}_renderOITPass(e,r=N.Both){const t=e===me.HUD,s=t?this.fboCache.acquire(C.RGBA,this._offscreen.width,this._offscreen.height):null,i=t?()=>this._renderHUDElements(r):()=>this._renderTransparentGeometry(),a=this._renderContext.output;this._renderContext.output=D.Alpha,this._bindParameters.transparencyPassType=te.Alpha;const n=this._offscreen.renderOITPass(i,te.Alpha,t);this._renderContext.output=D.Color,this._bindParameters.transparencyPassType=te.Color;const h=this._offscreen.renderOITPass(i,te.Color,t);this._bindParameters.transparencyPassType=te.FrontFace;const o=this._offscreen.renderOITPass(i,te.FrontFace,t);return this._offscreen.compositeTransparentOntoOpaque(this._bindParameters,h,n,o,s),s?.releaseDepth(),o.release(),h.release(),n.release(),this._bindParameters.transparencyPassType=te.NONE,this._renderContext.output=a,s}_renderOccluded(){let e=0;ge.clear(),this._materialRenderers.forAll((r=>{r.material&&r.material.isVisible()&&r.material.renderOccluded===k.OccludeAndTransparentStencil&&(e|=r.material.renderOccluded,ge.push(r))}));const r=this._offscreen,t=(t,s,i,a,n)=>{if(0==(e&s))return;const{width:h,height:o,depth:d}=r,l=this.fboCache.acquire(C.RGBA,h,o);r.renderToTargets(i,l,d,[0,0,0,0],a,n),r.compositeToFramebuffer(this._bindParameters,l.colorTexture,ne.PremultipliedAlpha,t),l.release()};0!==ge.length&&(this._prepareInternalSlots(ge,K.OCCLUDER_MATERIAL,K.TRANSPARENT_OCCLUDER_MATERIAL),this._renderInternalSlot(K.OCCLUDER_MATERIAL,ge),t(.5,k.OccludeAndTransparentStencil,(()=>this._renderInternalSlot(K.TRANSPARENT_OCCLUDER_MATERIAL,ge)),!1,!1)),ge.clear(),this._materialRenderers.forAll((r=>{r.material&&r.material.isVisible()&&(r.material.renderOccluded===k.OccludeAndTransparent||r.material.renderOccluded===k.Transparent||r.material.renderOccluded===k.Opaque)&&(e|=r.material.renderOccluded,ge.push(r))}));const s=this._renderPlugins.renderOccludedFlags;if(e|=s,!e)return;const i=e=>{this._renderContext.renderOccludedMask=e,this._prepareInternalSlots(ge,K.OPAQUE_MATERIAL,K.TRANSPARENT_MATERIAL,K.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL),s>k.Occlude&&this._renderSlot(K.OCCLUDED_TERRAIN),this._renderInternalSlot(K.OPAQUE_MATERIAL,ge),this._renderInternalSlot(K.TRANSPARENT_MATERIAL,ge),this._renderInternalSlot(K.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL,ge),this._renderContext.resetRenderOccludedMask()};this._renderContext.output=D.Color,t(.5,k.OccludeAndTransparent,(()=>i(k.OccludeAndTransparent)),!0,B.OutlineVisualElementMask),t(.5,k.Transparent,(()=>i(k.Transparent)),!0,B.OutlineVisualElementMask),t(1,k.Opaque,(()=>i(k.Opaque)),!0,B.OutlineVisualElementMask),ge.clear()}_renderAntialiasing(e){const r=this._offscreen,t=this._magnifierEnabled&&null==e?this.fboCache.acquire(C.RGBA,r.width,r.height).acquireDepth(w.DEPTH16_BUFFER):null,s=t?.fbo??e;this._rctx.bindFramebuffer(s);const i=this._offscreen.colorTexture;return this.renderPlugins.canRender(K.ANTIALIASING)?(this._pluginInput.compositeTexture=r.colorTexture,this._pluginInput.normalTexture=null,this._pluginInput.highlightTexture=null,this._renderSlot(K.ANTIALIASING,this._pluginInput,s)):null!=i&&this._compositingHelper.composite(this._bindParameters,i,ne.None),t}_prepare(e,r){this._needsTransparentPass=this._materialRenderers.some((e=>e.canRender(K.TRANSPARENT_MATERIAL,D.Color))),this._bindParameters.camera=e,this._bindParameters.contentCamera=r}_ensureBindParameters(e,r){this._bindParameters.camera=e,this._bindParameters.contentCamera=r;const t=this._renderContext.offscreenRenderingHelper;this._bindParameters.mainColor=t.colorTexture,this._bindParameters.mainDepth=t.depthTexture}_ensureBindParametersSSR(e){if(this._bindParameters.ssr.lastFrameColor){null==this._ssrEnableTime&&(this._ssrEnableTime=e),this._renderContext.lastFrameCamera.equals(this._bindParameters.camera)?this._reprojectionMatrix=g:(f(Ae,this._bindParameters.camera.viewMatrix),f(Re,this._bindParameters.camera.projectionMatrix),T(Pe,Ae,Re),T(Pe,this._renderContext.lastFrameCamera.viewMatrix,Pe),T(Pe,this._renderContext.lastFrameCamera.projectionMatrix,Pe),this._reprojectionMatrix=Pe);const r=this._stage.view.qualitySettings.fadeDuration;this._bindParameters.ssr.fadeFactor=r>0?Math.min(r,e-this._ssrEnableTime)/r:1,this._bindParameters.ssr.fadeFactor<1&&this._requestRender()}else this._reprojectionMatrix=g,this._ssrEnableTime=null}_prepareInternalSlots(e,...r){let t=!1;for(const s of r)this._bindParameters.slot=s,e.forAll((e=>{e.material.shouldRender(this._renderContext)&&(t=null!=e.prepareTechnique(this._renderContext)||t)}));return t}_renderInternalSlot(e,r=this._materialRenderers){this._bindParameters.slot=e,r.forAll((e=>{if(e.material.shouldRender(this._renderContext)){const r=e.prepareTechnique(this._renderContext);r&&e.render(this._renderContext,r)}}))}get memoryInfo(){return{fbos:this.fboCache.peakMemoryUsage,vaos:this._materialRenderers.reduce(((e,r)=>e+r.usedMemory),0),plugins:this._renderPlugins.usedMemory}}get usedMemory(){return this.fboCache.peakMemoryUsage+(this.edgeView?.usedMemory??0)+this._materialRenderers.reduce(((e,r)=>e+r.usedMemory),0)+this._renderPlugins.usedMemory}get test(){const e=this;return{offscreen:this._offscreen,shadowMap:this._shadowMap,highlight:this._highlight,lighting:this._bindParameters.lighting,materialRenderers:this._materialRenderers,shadowAccumulator:this._shadowAccumulator,weatherIsFading:this._bindParameters.cloudsFade.isFading,resetRenderStateFeatures:()=>{e._renderStateFeatures=z(),this.renderPlugins.renderFeatureChanged(),this._requestRender()},getFramebufferTexture:r=>{switch(r){case fe.Color:return e._offscreen.colorTexture;case fe.LinearDepth:return e._bindParameters.linearDepth?.colorTexture;case fe.ShadowMap:return e._shadowMap.depthTexture;case fe.HudVisibility:return e._bindParameters.hudVisibility?.colorTexture}}}}};var me,fe;e([c()],ue.prototype,"_renderPlugins",void 0),e([c()],ue.prototype,"_shadowAccumulator",void 0),e([c()],ue.prototype,"_state",void 0),e([c()],ue.prototype,"_renderStateFeatures",void 0),e([c({readOnly:!0})],ue.prototype,"fullResolutionAtmosphere",null),e([c()],ue.prototype,"_smaa",void 0),e([c({autoDestroy:!0})],ue.prototype,"_edgeView",void 0),e([c()],ue.prototype,"updating",null),e([c()],ue.prototype,"isCameraFinal",null),ue=e([u("esri.views.3d.webgl-engine.lib.Renderer")],ue),function(e){e[e.Geometry=0]="Geometry",e[e.HUD=1]="HUD"}(me||(me={})),function(e){e[e.Color=0]="Color",e[e.LinearDepth=1]="LinearDepth",e[e.ShadowMap=2]="ShadowMap",e[e.HudVisibility=3]="HudVisibility"}(fe||(fe={}));const Te=[0,0,0,0],ge=new o,Re=R(),Ae=R(),Pe=R();function Ee(e){return r=>e.immediate.schedule(r)}export{fe as FramebufferId,ue as Renderer};
5
+ import{_ as e}from"../../../../chunks/tslib.es6.js";import r from"../../../../core/Accessor.js";import{update as t}from"../../../../core/arrayUtils.js";import{unitRGBAFromColor as s}from"../../../../core/colorUtils.js";import has from"../../../../core/has.js";import{removeMaybe as i,disposeMaybe as a,destroyMaybe as n,releaseMaybe as h}from"../../../../core/maybe.js";import o from"../../../../core/PooledArray.js";import{watch as d,syncAndInitial as l,initial as _,sync as p}from"../../../../core/reactiveUtils.js";import{property as c}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as u}from"../../../../core/accessorSupport/decorators/subclass.js";import{j as m,a as f,m as T}from"../../../../chunks/mat4.js";import{I as g,c as A}from"../../../../chunks/mat4f64.js";import{s as R}from"../../../../chunks/vec4.js";import{f as P,Z as E}from"../../../../chunks/vec4f64.js";import{a as b}from"../../../../chunks/boundedPlane.js";import{debugFlags as S}from"../../support/debugFlags.js";import{TransparencyMode as I}from"../../terrain/TerrainRenderer.js";import{FBOCache as y,ColorFormat as C,DepthFormat as w}from"../core/FBOCache.js";import{RenderPassManager as O}from"../core/renderPasses/RenderPassManager.js";import{ShaderOutput as D}from"../core/shaderLibrary/ShaderOutput.js";import{HUDRenderStyle as N}from"../core/shaderLibrary/hud/HUDRenderStyle.js";import{RenderPluginManager as L}from"../effects/RenderPluginManager.js";import{Highlight as H}from"../effects/highlight/Highlight.js";import{ShadowHighlight as M}from"../effects/highlight/ShadowHighlight.js";import{SMAA as x}from"../effects/smaa/SMAA.js";import{SSAO as v}from"../effects/ssao/SSAO.js";import{AnimationTimeStep as F}from"./AnimationTimeStep.js";import{Decorations as U,RenderRequestType as G,StencilBits as B}from"./basicInterfaces.js";import{BoundingInfo as j}from"./BoundingInfo.js";import{ZERO as q,union as V}from"./depthRange.js";import{depthRangeFromScene as Q}from"./depthRangeUtils.js";import{RenderOccludedFlag as k}from"./Material.js";import{OffscreenRendering as W}from"./OffscreenRendering.js";import{RenderContext as Y}from"./RenderContext.js";import{splitRenderGeometryChangeSetByMaterial as X}from"./rendererUtils.js";import{setupFeatureDefaults as z,RenderFeature as J}from"./RenderFeature.js";import{RenderSlot as K}from"./RenderSlot.js";import{ShadowAccumulator as Z}from"./ShadowAccumulator.js";import{ShadowMap as $,SnapshotSlot as ee}from"./ShadowMap.js";import re from"./SliceHelper.js";import{TransparencyPassType as te}from"./TransparencyPassType.js";import{EdgeView as se}from"./edgeRendering/EdgeView.js";import{Transparency as ie}from"./edgeRendering/interfaces.js";import{MergedRenderer as ae}from"../materials/renderers/MergedRenderer.js";import{AlphaMode as ne}from"../shaders/CompositingTechniqueConfiguration.js";import{RendererPerformanceInfo as he,PerformanceCategory as oe}from"../statistics/RendererPerformanceInfo.js";import{RenderState as de}from"../../../support/RenderState.js";import{PixelFormat as le,PixelType as _e,ClearBufferBit as pe}from"../../../webgl/enums.js";import ce from"../../../../webscene/background/ColorBackground.js";let ue=class extends r{get _bindParameters(){return this._renderContext.bindParameters}updateRenderFeatures(e=null,r=!has("disable-feature:high-quality-idle")){this._renderStateFeatures=z(r,e),this.notifyChange("_renderStateFeatures"),this.renderPlugins.renderFeatureChanged(),this._requestRender()}isFeatureEnabled(e,r=this._state){return this._renderStateFeatures.get(r,e)??!1}setFeatureEnabled(e,r,t){this._renderStateFeatures.set(r,e,t),this.notifyChange("_renderStateFeatures"),this._requestRender()}get _highQualityTransparency(){return this._highQualityTransparencyEnabled||this.isFeatureEnabled(J.HighQualityTransparency)}get hasReflections(){return this.hasWater&&(this._ssrEnabled||this.isFeatureEnabled(J.WaterReflection))}get hasDecorations(){return this._materialRenderersHas.decorations||this._renderPlugins.hasDecorations}get hasHighlights(){return this._materialRenderersHas.highlights||this.renderPlugins.produces(K.OPAQUE_MATERIAL,D.Highlight)||this.renderPlugins.produces(K.DRAPED_MATERIAL,D.Highlight)}get hasShadowHighlights(){return this._materialRenderersHas.highlights||this.renderPlugins.produces(K.OPAQUE_MATERIAL,D.ShadowHighlight)}get _magnifierEnabled(){return this._bindParameters.decorations===U.ON&&this._magnifierHelper.enabled}get fullResolutionAtmosphere(){return this._stage.view.qualitySettings.highResolutionAtmosphere||this.isFeatureEnabled(J.HighResolutionAtmosphere)}get hasWater(){return this._materialRenderersHas.water||this._hasOverlayWater}constructor(e,r,t,i,a,n,h,p){super({}),this._stage=e,this._techniqueRepository=i,this._rctx=a,this._compositingHelper=n,this._magnifierHelper=h,this._requestRender=p,this._materialRenderers=new o,this._needsTransparentPass=!1,this._materialRenderersHas={hudElements:!1,highlights:!1,water:!1,decorations:!1,occludees:!1},this._hasOverlayWater=!1,this._renderOverlay=e=>{},this._isRendering=!1,this._backgroundColor=P(0,0,0,1),this._fallbackDepthStencilTexture=null,this._sliceHelper=new re,this._state=de.IDLE,this._highQualityTransparencyEnabled=!0,this._terrainTransparency=I.Opaque,this._ssrEnabled=!1,this._hasAnimations=!1,this._animationTimestep=new F,this._renderHiddenTransparentEdges=()=>{},this._pluginInput={compositeTexture:null,normalTexture:null,highlightTexture:null},this.fboCache=new y(a),this._renderStateFeatures=z(!has("disable-feature:high-quality-idle"),e.view.qualityProfile),this._offscreen=new W(this.fboCache,this._compositingHelper),this.performanceInfo=new he(this._rctx),this._shadowMap=new $(this.fboCache,e.viewingMode),this._highlight=new H({view:e.view}),this._shadowHighlight=new M({view:e.view,viewingMode:e.viewingMode}),this._shadowAccumulator=new Z(this.fboCache,i,e,(e=>{const r=this.shadowsEnabled;this._shadowMap.enabled=!0,this._prepare(e.camera,e.contentCamera),this._renderPlugins.prepareRender(),this._shadowMap.enabled=r}),((e,r,t)=>{e.shadowMap.start(e.camera,r,t,!0,this._stage.view.qualitySettings.maximumPixelRatio),this._renderShadowCascades(D.Shadow,e.shadowMap),e.shadowMap.finish(),e.camera.setGLViewport(this._rctx),this._prepare(e.camera,e.contentCamera)}),p),this._ssao=new v({view:this._stage.view}),this._renderContext=new Y(this._rctx,this._offscreen,this._shadowMap,this._sliceHelper),this._renderPlugins=new L({renderContext:this._renderContext,techniqueRepository:i,textureRepository:t,materialRepository:r,requestRender:p,controller:e,fbos:this.fboCache,isFeatureEnabled:e=>this.isFeatureEnabled(e)}),this.renderPassManager=new O,this._renderPlugins.add(this.renderPassManager),this._smaa=new x({view:this._stage.view}),this._renderPlugins.add(this._smaa),this._renderPlugins.add(this._ssao),this._renderPlugins.add(this._highlight),this._renderPlugins.add(this._shadowHighlight),this.addHandles([d((()=>this._stage.view.state.camera),(()=>p()),l),d((()=>S.EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES),(e=>{this._renderHiddenTransparentEdges=e?()=>this._renderEdges(ie.TRANSPARENT):()=>{},p()}),_),d((()=>this._stage.view.environment.background),(e=>{const r=e instanceof ce?s(e.color):E;R(this._backgroundColor,r[0]*r[3],r[1]*r[3],r[2]*r[3],r[3])}),l)])}normalizeCtorArgs(){return{}}destroy(){this._smaa.destroy(),this._gpuTimerHandle=i(this._gpuTimerHandle),this._materialRenderers.forAll((e=>e.dispose())),this._materialRenderers.clear(),this._offscreen.dispose(),this._fallbackDepthStencilTexture=a(this._fallbackDepthStencilTexture),this._shadowMap.dispose(),this._ssao.destroy(),this._highlight.dispose(),this._shadowHighlight.destroy(),this._shadowAccumulator.dispose(),this._edgeView=n(this._edgeView),this.renderPassManager.dispose(),this._releaseFBOs(),this._disposeOffscreenBuffers(),this.fboCache.destroy(),j.prune()}_releaseFBOs(){this._bindParameters.ssr.lastFrameColor=h(this._bindParameters.ssr.lastFrameColor),this._bindParameters.multipassTerrain.linearDepth=h(this._bindParameters.multipassTerrain.linearDepth),this._bindParameters.multipassGeometry.linearDepth=h(this._bindParameters.multipassGeometry.linearDepth)}disposeOffscreenBuffers(){this._releaseFBOs(),this._disposeOffscreenBuffers()}_disposeOffscreenBuffers(){this._offscreen.dispose(),this._shadowMap.disposeOffscreenBuffers(),this._bindParameters.linearDepth=h(this._bindParameters.linearDepth),this._bindParameters.hudVisibility=h(this._bindParameters.hudVisibility)}get updating(){return this._smaa.updating||null!=this._edgeView&&this._edgeView.updating||this._shadowAccumulator.running||this._renderPlugins.updating||!this.isCameraFinal}ensureEdgeView(){if(null==this._edgeView){const e=this._stage.view.resourceController;this._edgeView=new se({rctx:this._rctx,renderSR:this._stage.view.renderSpatialReference,viewingMode:this._stage.viewingMode,techniqueRepository:this._techniqueRepository,setNeedsRender:()=>this._requestRender(),schedule:Ee(e)}),this.addHandles(d((()=>this._edgeView?.updating),(()=>this._requestRender()),p)),this._requestRender()}return this._edgeView}get edgeView(){return this._edgeView}get isCameraFinal(){return m(this._bindParameters.ssr.reprojectionMatrix,g)}set _reprojectionMatrix(e){t(this._bindParameters.ssr.reprojectionMatrix,e)&&this.notifyChange("isCameraFinal")}get shadowsEnabled(){return!!this._shadowMap?.enabled}setParameters(e){const{_shadowMap:r,_bindParameters:t}=this;if(void 0!==e.qualitySettings?.reflections&&this._ssrEnabled!==e.qualitySettings.reflections&&(this._ssrEnabled=e.qualitySettings.reflections,this._requestRender()),void 0!==e.shadowMap&&this._shadowMap.enabled!==e.shadowMap&&(this._shadowMap.enabled=e.shadowMap,this._requestRender()),void 0!==e.shadowMapMaxCascades&&r.maxCascades!==e.shadowMapMaxCascades&&(r.maxCascades=e.shadowMapMaxCascades,this._requestRender()),null!=e.environment){null!=e.environment.weather&&(this._bindParameters.weather=e.environment.weather,this._bindParameters.weatherVisible=!!e.weatherVisible);const r="virtual"!==e.environment.lighting.type;t.enableFillLights!==r&&(t.enableFillLights=r,this._requestRender())}void 0!==e.highQualityTransparency&&this._highQualityTransparencyEnabled!==e.highQualityTransparency&&(this._highQualityTransparencyEnabled=e.highQualityTransparency,this._requestRender()),void 0!==e.overlays&&this._bindParameters.overlays!==e.overlays&&(this._bindParameters.overlays=e.overlays,this._requestRender()),void 0!==e.hasOverlayWater&&this._hasOverlayWater!==e.hasOverlayWater&&(this._hasOverlayWater=e.hasOverlayWater,this._requestRender()),void 0!==e.renderOverlay&&this._renderOverlay!==e.renderOverlay&&(this._renderOverlay=e.renderOverlay,this._requestRender()),void 0!==e.slicePlane&&this._sliceHelper.plane!==e.slicePlane&&(this._sliceHelper.plane=e.slicePlane,this._requestRender()),void 0!==e.terrainTransparency&&this._terrainTransparency!==e.terrainTransparency&&(this._terrainTransparency=e.terrainTransparency,this._requestRender()),void 0!==e.shadowCastOptions&&this._shadowAccumulator.setOptions(e.shadowCastOptions)}get hasSlicePlane(){return!!this._sliceHelper.plane}get renderPlugins(){return this._renderPlugins}get _hasOITSupport(){return this._rctx.driverTest.floatBufferBlend.result}get _oitEnabled(){return this._highQualityTransparency&&this._hasOITSupport}modify(e,r){this._isRendering&&console.warn("Renderer.modify called while rendering");const{adds:t,removes:s,updates:i}=e;if(0===t.length&&0===s.length&&0===i.length)return;const a=X(e);let n=!1;a.forEach(((t,s)=>{if(r.done)return;let i=this._materialRenderers.find((e=>e.material===s));if(null==i&&t.adds.length>0){const e=new ae({material:s});e.initializeRenderContext(this.renderPlugins._context),i=e,this._materialRenderers.push(i)}i&&(i.modify(t),i.isEmpty&&(n=!0)),t.removes.forEach((r=>e.removes.removeUnordered(r))),t.adds.forEach((r=>e.adds.removeUnordered(r))),t.updates.forEach((r=>e.updates.removeUnordered(r))),r.madeProgress()})),n&&this._materialRenderers.filterInPlace((e=>!e.isEmpty||(e.dispose(),!1))),this._updateHasFlags(),this._requestRender()}_updateHasFlags(){const has=this._materialRenderersHas;has.decorations=!1,has.highlights=!1,has.hudElements=!1,has.water=!1,has.occludees=!1,this._materialRenderers.forAll((e=>{has.highlights||=e.hasHighlights,has.occludees||=e.hasOccludees,has.water||=e.hasWater,has.decorations||=e.isDecoration,has.hudElements||=e.produces(K.LINE_CALLOUTS_HUD_DEPTH,D.Color)||e.produces(K.HUD_MATERIAL,D.Color)||e.produces(K.LABEL_MATERIAL,D.Color)})),this._bindParameters.hasOccludees=has.occludees}updateAnimation(e){const r=this._hasAnimations;return this._hasAnimations=!1,this._materialRenderers.forAll((r=>this._hasAnimations=r.updateAnimation(e)||this._hasAnimations)),this._hasAnimations=this._renderPlugins.updateAnimation(e)||this._hasAnimations,this._hasAnimations!==r&&(this._gpuTimerHandle=r?i(this._gpuTimerHandle):this.performanceInfo.enableGPUPerformanceInfo()),this._hasAnimations}get animationTimestep(){return this._animationTimestep.value}get animationTimeDilation(){return this._animationTimestep.timeDilation}resetAnimation(){this._animationTimestep.clear()}render(e,r,t,s,i){this._isRendering=!0,this.performanceInfo.startFrame(),this.fboCache.resetPeakMemoryUsage();const a=this._offscreen,{camera:n,contentCamera:o,mode:d,alignPixelEnabled:l}=t;this._state=d,this._renderOverlay(i),this.performanceInfo.advance(oe.OVERLAY),this._renderContext.time=i,this._bindParameters.transparencyPassType=te.NONE,this._bindParameters.alignPixelEnabled=l,this._bindParameters.decorations=s;const _=b(this._sliceHelper.plane);s===U.OFF&&(this._sliceHelper.plane=null),this._rctx.bindFramebuffer(e),n.setGLViewport(this._rctx);const p=a.initializeFrame(n,this._backgroundColor);this.hasReflections?this._bindParameters.ssr.lastFrameColor=p:p?.release(),this._prepare(n,o),this._renderPlugins.prepareRender(),this.performanceInfo.advance(oe.PREPARE);const c=this._computeDepthRange(n);this._renderShadowMap(e,n,this._bindParameters.lighting.mainLight.direction,c),this.performanceInfo.advance(oe.SHADOW_MAP),this._ensureBindParameters(n,o);const u=this._renderPlugins.produces(K.OPAQUE_TERRAIN)&&(this._terrainTransparency===I.Semitransparent||this._terrainTransparency===I.TransparentWithDraped),m=this._highQualityTransparency&&u,f=this._needsTransparentPass||this._renderPlugins.produces(K.TRANSPARENT_MATERIAL);this._prepareShaders(m,f),this._renderLinearDepth(),this.performanceInfo.advance(oe.LINEAR_DEPTH),this._accumulateShadows(c,n,o),this.performanceInfo.advance(oe.ACCUMULATED_SHADOWS),this._ensureBindParametersSSR(i),this._renderSSAO(),this.performanceInfo.advance(oe.SSAO),this._renderContext.output=D.Color,a.bindFbo(),this._renderOpaqueGeometry(),this.performanceInfo.advance(oe.OPAQUE),this._renderTerrainLinearDepth(m),this._setMultipassTerrain(m),this._renderEdges(ie.OPAQUE),this.performanceInfo.advance(oe.OPAQUE_EDGES),a.bindFbo(),this._renderSlot(K.VOXEL),this.performanceInfo.advance(oe.VOXEL),this._renderHiddenTransparentEdges(),f&&(this._oitEnabled?this._renderOITPass(me.Geometry):this._renderTransparentGeometry()),this.performanceInfo.advance(oe.TRANSPARENT);const T=this._renderGeometryLinearDepth(m);this._renderHUDVisibility(T),m||this._renderInternalSlot(K.LINE_CALLOUTS),this.performanceInfo.advance(oe.HUD_VISIBILITY),this._renderObjectAndLayerIdColor(r),this.performanceInfo.advance(oe.OBJECT_AND_LAYER_ID_COLOR),this._renderEdges(ie.TRANSPARENT,T),T?.release(),this.performanceInfo.advance(oe.TRANSPARENT_EDGES);const g=u?this._renderTransparentTerrain():null;g&&this._bindParameters.hudVisibility&&(m?this._renderLineCallouts(N.Occluded):a.compositeToHUDVisibility(this._bindParameters,g.colorTexture),this._renderHUD(N.Occluded,a.framebuffer),this.performanceInfo.advance(oe.HUD_OCCLUDED)),this.performanceInfo.advance(oe.TRANSPARENT_TERRAIN),this._setTerrainCulling(!1),g&&(a.compositeToFramebuffer(this._bindParameters,g.colorTexture,ne.PremultipliedAlpha,1),g.release(),m&&(this._renderEdges(ie.OPAQUE),this.performanceInfo.advance(oe.OPAQUE_EDGES),f&&(this._oitEnabled?this._renderOITPass(me.Geometry):this._renderTransparentGeometry()),this.performanceInfo.advance(oe.TRANSPARENT),this._renderEdges(ie.TRANSPARENT),this.performanceInfo.advance(oe.TRANSPARENT_EDGES))),this._bindParameters.ssao=h(this._bindParameters.ssao),m&&this._renderLineCallouts(N.NotOccluded),this._setMultipassEnabled(!1),this._shadowAccumulator.render(this._bindParameters),a.bindFbo(),this._renderInternalSlot(K.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL),this._renderSlot(K.POSTPROCESSING_ENVIRONMENT_TRANSPARENT),this.performanceInfo.advance(oe.ENVIRONMENT),this._renderLaserlines(),this.performanceInfo.advance(oe.LASER_LINES),this._renderOccluded(),this.performanceInfo.advance(oe.OCCLUDED);const A=this._renderAntialiasing(e),R=A?.fbo??e;this.performanceInfo.advance(oe.ANTIALIASING),this._renderHUD(N.NotOccluded,R),this.performanceInfo.advance(oe.HUD),this._renderHighlights(R,this._bindParameters),this.performanceInfo.advance(oe.HIGHLIGHTS),this._magnifierEnabled&&this._magnifierHelper.render(this._rctx,this._bindParameters),R!==e&&(this._rctx.bindFramebuffer(e),this._compositingHelper.composite(this._bindParameters,A?.colorTexture,ne.None)),A?.release(),this._releaseFBOs(),this._offscreen.releaseBuffers(),this._renderContext.lastFrameCamera.copyFrom(this._bindParameters.camera),this._sliceHelper.plane=_,this._isRendering=!1,this.onPostRender&&this.onPostRender(),this.performanceInfo.finishFrame()}_prepareShaders(e,r){this._renderContext.output=D.Color,this._prepareOpaqueGeometrySlots(),this._setMultipassTerrain(e),this._prepareSlots(K.TRANSPARENT_TERRAIN),this._setMultipassTerrain(!1),e||this._prepareInternalSlots(this._materialRenderers,K.LINE_CALLOUTS),r&&this._prepareTransparencySlots(),this._prepareInternalSlots(this._materialRenderers,K.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL),this._prepareSlots(K.POSTPROCESSING_ENVIRONMENT_TRANSPARENT,K.LASERLINES),this._rctx.gl.flush()}_renderObjectAndLayerIdColor(e){if(null==e||!has("enable-feature:objectAndLayerId-rendering"))return;const r=this._renderContext.output;this._rctx.bindFramebuffer(e),this._offscreen.renderToFBO((()=>this._renderGeometryAndTransparentTerrainPass(D.ObjectAndLayerIdColor)),[0,0,0,0],!0,!0),this._rctx.bindFramebuffer(e),this._offscreen.renderToFBO((()=>{this._bindParameters.hudRenderStyle=N.NotOccluded,this._renderInternalSlot(K.HUD_MATERIAL)}),void 0,!0,!0),this._renderContext.output=r}finish(e){this._hasAnimations||this._animationTimestep.clear();const r=this.performanceInfo.gpuSamplingEnabled,t=e===G.BACKGROUND;if(t||r){const e=t?this.performanceInfo.elapsedTime:0,s=r?this.performanceInfo.totalGPUTimeSampler.last:this._rctx.gl.getError(),i=Math.max(e,s);this._animationTimestep.frame(i,t)}}readDepthPixels(e,r,t){const s=this._bindParameters.linearDepth?.fbo;if(s?.colorTexture)return void s.readPixels(r[0],r[1],r[2],r[3],le.RGBA,_e.UNSIGNED_BYTE,t);const i=this.fboCache.acquire(C.RGBA,this._offscreen.width,this._offscreen.height).acquireDepth(w.DEPTH16_BUFFER);this._rctx.bindFramebuffer(i.fbo),this._ensureBindParameters(e,e),this._bindParameters.camera.setGLViewport(this._rctx),this._rctx.setClearColor(0,0,0,0);const a=pe.COLOR_BUFFER_BIT|pe.DEPTH_BUFFER_BIT|pe.STENCIL_BUFFER_BIT;this._rctx.clearSafe(a),this._renderGeometryAndTransparentTerrainPass(D.Depth),i.fbo.readPixels(r[0],r[1],r[2],r[3],le.RGBA,_e.UNSIGNED_BYTE,t),i.release()}readHUDVisibility(e,r,t,s,i){this._bindParameters.hudVisibility?.fbo.readPixels(e,r,t,s,le.RGBA,_e.UNSIGNED_BYTE,i)}readAccumulatedShadow(e){return this._shadowAccumulator.readAccumulatedShadow(e[0],e[1])}_setMultipassTerrain(e){this._setMultipassEnabled(e),this._setTerrainCulling(e)}_setMultipassEnabled(e){this._bindParameters.multipassEnabled=e}_setTerrainCulling(e){this._bindParameters.multipassTerrain.cullAboveGround=e}_prepareSlots(...e){this._renderPlugins.prepareSlots(e)}_renderSlot(e,r=null,t=null){return this._renderPlugins.render(this._renderPlugins.prepare(e),r,t)}_renderEdges(e,r){const t=this._edgeView;if(t?.shouldRender()){const{width:s,height:i,depth:a}=this._offscreen,n=this.fboCache.acquire(C.RGBA,s,i),h=()=>t.render(this._bindParameters,e);this._offscreen.renderToTargets(h,n,r??a,Te),this._offscreen.compositeToFramebuffer(this._bindParameters,n.colorTexture,ne.Alpha,1),n.release()}}_renderShadowMap(e,r,t,s){const i=this._shadowMap;i.enabled&&(i.start(r,t,s,this.isFeatureEnabled(J.HighResolutionShadows),this._stage.view.qualitySettings.maximumPixelRatio),this._shadowHighlight.updateParameters(r,t),this._needsShadowHighlight?(this._renderShadowCascades(D.ShadowHighlight,this._shadowMap),i.moveSnapshot(ee.Highlight),i.clear(),this._renderShadowCascades(D.ShadowExcludeHighlight,this._shadowMap),i.copySnapshot(ee.Default),this._renderShadowCascades(D.ShadowHighlight,this._shadowMap)):this._renderShadowCascades(D.Shadow),i.finish(),this._rctx.bindFramebuffer(e),r.setGLViewport(this._rctx))}_renderShadowCascades(e,r=this._shadowMap){for(const t of r.cascades)t.camera.setGLViewport(this._rctx),this._prepare(t.camera,t.camera),this._renderGeometryAndTransparentTerrainPass(e)}get _needsLinearDepth(){return this._renderPlugins.consumes(D.Depth)||this.hasReflections||this._needsShadowHighlight||this._needsShadowCast}_renderLinearDepth(){this._needsLinearDepth?(this._bindParameters.linearDepth=this._offscreen.renderToCachedFBO(this._bindParameters.linearDepth,(()=>this._renderGeometryAndTransparentTerrainPass(D.Depth)),[0,0,0,0],C.RGBA,w.DEPTH24_BUFFER),this._bindParameters.linearDepth.releaseDepth(),this._offscreen.bindFbo()):this._bindParameters.linearDepth=h(this._bindParameters.linearDepth)}_renderTerrainLinearDepth(e){if(e){const e=this._renderContext.output;this._renderContext.output=D.Depth,this._bindParameters.multipassTerrain.linearDepth=this._offscreen.renderToCachedFBO(this._bindParameters.multipassTerrain.linearDepth,(()=>this._renderTransparentTerrain()),[-1e10,-1e10,-1e10,1]),this._bindParameters.multipassTerrain.linearDepth.releaseDepth(),this._renderContext.output=e}else this._bindParameters.multipassTerrain.linearDepth=h(this._bindParameters.multipassTerrain.linearDepth)}_renderGeometryLinearDepth(e){if(!e)return void(this._bindParameters.multipassGeometry.linearDepth=h(this._bindParameters.multipassGeometry.linearDepth));const r=this._renderContext.output;return this._bindParameters.multipassGeometry.linearDepth=this._offscreen.renderToCachedFBO(this._bindParameters.multipassGeometry.linearDepth,(()=>this._renderGeometryPass(D.Depth)),[1,1,1,1]),this._renderContext.output=r,this._bindParameters.multipassGeometry.linearDepth.detachDepth()}get _needsDepthRange(){return this._shadowMap.enabled||this._needsShadowCast}_computeDepthRange(e){if(!this._needsDepthRange)return q;const r=Q(e,this._materialRenderers,this._stage.layers);return V(r,this.renderPlugins.queryDepthRange(e)),r.near=Math.max(e.near,r.near),r.far=Math.min(e.far,r.far),r}_renderGeometryAndTransparentTerrainPass(e){this._renderContext.output=e,this._prepareSlots(K.TRANSPARENT_TERRAIN),this._renderGeometryPass(e),this._renderTransparentTerrain()}_renderGeometryPass(e){this._renderContext.output=e,this._prepareSlots(K.TRANSPARENT_MATERIAL),this._renderOpaqueGeometry(),this._renderTransparentGeometry()}_renderSSAO(){if(!this._ssao.produces())return;const e=this._offscreen.renderToCachedFBO(null,(()=>this._renderGeometryAndTransparentTerrainPass(D.Normal)),[0,0,0,0],C.RGBA4,w.DEPTH24_BUFFER);e.releaseDepth(),this._offscreen.bindFbo(),this._pluginInput.normalTexture=e.colorTexture,this._bindParameters.ssao=this._renderSlot(K.SSAO,this._pluginInput),e.release()}_prepareOpaqueGeometrySlots(){this._prepareSlots(K.INTEGRATED_MESH,K.OPAQUE_TERRAIN,K.OPAQUE_MATERIAL,K.POSTPROCESSING_ENVIRONMENT_OPAQUE),this._prepareInternalSlots(this._materialRenderers,K.OPAQUE_MATERIAL)}_renderOpaqueGeometry(){this._renderSlot(K.INTEGRATED_MESH),this._renderSlot(K.OPAQUE_TERRAIN),this._renderInternalSlot(K.OPAQUE_MATERIAL),this._renderSlot(K.OPAQUE_MATERIAL),this._renderSlot(K.POSTPROCESSING_ENVIRONMENT_OPAQUE)}_renderTransparentGeometry(){this._renderInternalSlot(K.TRANSPARENT_MATERIAL),this._renderSlot(K.TRANSPARENT_MATERIAL)}_renderTransparentTerrain(){const e=this._renderPlugins.prepare(K.TRANSPARENT_TERRAIN);if(0===e.size)return;const r=()=>this._renderPlugins.render(e,null);if(this._renderContext.output!==D.Color)return void r();const{width:t,height:s,depth:i}=this._offscreen,a=this.fboCache.acquire(C.RGBA,t,s);return this._offscreen.renderToTargets(r,a,i,[0,0,0,0]),a}_renderHUDVisibility(e){this._prepareInternalSlots(this._materialRenderers,K.OCCLUSION_PIXELS)?(this._bindParameters.hudVisibility=this._offscreen.renderHUDVisibility(this._bindParameters.hudVisibility,(()=>this._renderInternalSlot(K.OCCLUSION_PIXELS)),e),this._offscreen.bindFbo()):this._bindParameters.hudVisibility=h(this._bindParameters.hudVisibility)}_renderLineCallouts(e){if(this._bindParameters.hudRenderStyle=e,e===N.Occluded){const e=()=>this._renderInternalSlot(K.LINE_CALLOUTS),{width:r,height:t,color:s}=this._offscreen,i=this.fboCache.acquireDepth(w.DEPTH16_BUFFER,r,t);this._offscreen.renderToTargets(e,s,i,void 0,!0,!0),i.release()}else this._renderInternalSlot(K.LINE_CALLOUTS)}_renderLaserlines(){if(this._renderSlot(K.LASERLINES),this._renderPlugins.produces(K.LASERLINES_CONTRAST_CONTROL)){const e=this._offscreen,{width:r,height:t,depth:s}=e,i=this.fboCache.acquire(C.RGBA,r,t),a=()=>this._renderSlot(K.LASERLINES_CONTRAST_CONTROL);e.renderToTargets(a,i,s,Te),e.compositeToFramebuffer(this._bindParameters,i.colorTexture,ne.PremultipliedAlpha,1),i.release()}}_renderHUD(e,r){if(this._materialRenderersHas.hudElements)if(this._oitEnabled){const t=this._renderOITPass(me.HUD,e);this._rctx.bindFramebuffer(r),this._compositingHelper.composite(this._bindParameters,t.colorTexture,ne.PremultipliedAlpha),t.release()}else if(e===N.Occluded){const r=()=>this._renderHUDElements(e),{width:t,height:s,color:i}=this._offscreen,a=this.fboCache.acquireDepth(w.DEPTH16_BUFFER,t,s);this._offscreen.renderToTargets(r,i,a,void 0,!0,!0),a.release()}else this._renderHUDElements(e)}_renderHUDElements(e){this._bindParameters.hudRenderStyle=e,this._prepareInternalSlots(this._materialRenderers,K.LINE_CALLOUTS_HUD_DEPTH,K.HUD_MATERIAL,K.LABEL_MATERIAL),this._renderInternalSlot(K.LINE_CALLOUTS_HUD_DEPTH),this._renderInternalSlot(K.HUD_MATERIAL),this._renderInternalSlot(K.LABEL_MATERIAL)}get _needsShadowHighlight(){return this._shadowMap.enabled&&this._renderPlugins.produces(K.SHADOW_HIGHLIGHT)&&this.hasShadowHighlights}_renderHighlights(e,r){if(!this.hasHighlights||r.decorations===U.OFF)return;const t=()=>{this._renderGeometryAndTransparentTerrainPass(D.Highlight),this._rctx.clearSafe(pe.DEPTH_BUFFER_BIT),this._renderHUDElements(N.Both)},s=this._offscreen.renderToCachedFBO(null,t,[0,0,0,0],C.RGBA4,w.DEPTH_STENCIL_TEXTURE);this._needsShadowHighlight&&(this._pluginInput.highlightTexture=s.fbo.colorTexture,this._renderSlot(K.SHADOW_HIGHLIGHT,this._pluginInput,e)),s.releaseDepth(),this.renderPlugins.produces(K.HIGHLIGHT)&&(this._pluginInput.compositeTexture=null,this._pluginInput.normalTexture=null,this._pluginInput.highlightTexture=s.fbo.colorTexture,this._renderSlot(K.HIGHLIGHT,this._pluginInput,e)),s.release()}get _needsShadowCast(){return this._shadowAccumulator.isAccumulating}_accumulateShadows(e,r,t){this._needsShadowCast&&this._bindParameters.linearDepth?.colorTexture&&this._shadowAccumulator.renderAccumulation(this._bindParameters.linearDepth,e,r,t)}_prepareTransparencySlots(){this._renderContext.output=D.Alpha,this._bindParameters.transparencyPassType=te.Alpha,this._prepareInternalSlots(this._materialRenderers,K.TRANSPARENT_MATERIAL),this._prepareSlots(K.TRANSPARENT_MATERIAL),this._renderContext.output=D.Color,this._bindParameters.transparencyPassType=te.Color,this._prepareInternalSlots(this._materialRenderers,K.TRANSPARENT_MATERIAL),this._prepareSlots(K.TRANSPARENT_MATERIAL),this._bindParameters.transparencyPassType=te.FrontFace,this._prepareInternalSlots(this._materialRenderers,K.TRANSPARENT_MATERIAL),this._prepareSlots(K.TRANSPARENT_MATERIAL),this._bindParameters.transparencyPassType=te.NONE}_renderOITPass(e,r=N.Both){const t=e===me.HUD,s=t?this.fboCache.acquire(C.RGBA,this._offscreen.width,this._offscreen.height):null,i=t?()=>this._renderHUDElements(r):()=>this._renderTransparentGeometry(),a=this._renderContext.output;this._renderContext.output=D.Alpha,this._bindParameters.transparencyPassType=te.Alpha;const n=this._offscreen.renderOITPass(i,te.Alpha,t);this._renderContext.output=D.Color,this._bindParameters.transparencyPassType=te.Color;const h=this._offscreen.renderOITPass(i,te.Color,t);this._bindParameters.transparencyPassType=te.FrontFace;const o=this._offscreen.renderOITPass(i,te.FrontFace,t);return this._offscreen.compositeTransparentOntoOpaque(this._bindParameters,h,n,o,s),s?.releaseDepth(),o.release(),h.release(),n.release(),this._bindParameters.transparencyPassType=te.NONE,this._renderContext.output=a,s}_renderOccluded(){let e=0;ge.clear(),this._materialRenderers.forAll((r=>{r.material&&r.material.isVisible()&&r.material.renderOccluded===k.OccludeAndTransparentStencil&&(e|=r.material.renderOccluded,ge.push(r))}));const r=this._offscreen,t=(t,s,i,a,n)=>{if(0==(e&s))return;const{width:h,height:o,depth:d}=r,l=this.fboCache.acquire(C.RGBA,h,o);r.renderToTargets(i,l,d,[0,0,0,0],a,n),r.compositeToFramebuffer(this._bindParameters,l.colorTexture,ne.PremultipliedAlpha,t),l.release()};0!==ge.length&&(this._prepareInternalSlots(ge,K.OCCLUDER_MATERIAL,K.TRANSPARENT_OCCLUDER_MATERIAL),this._renderInternalSlot(K.OCCLUDER_MATERIAL,ge),t(.5,k.OccludeAndTransparentStencil,(()=>this._renderInternalSlot(K.TRANSPARENT_OCCLUDER_MATERIAL,ge)),!1,!1)),ge.clear(),this._materialRenderers.forAll((r=>{r.material&&r.material.isVisible()&&(r.material.renderOccluded===k.OccludeAndTransparent||r.material.renderOccluded===k.Transparent||r.material.renderOccluded===k.Opaque)&&(e|=r.material.renderOccluded,ge.push(r))}));const s=this._renderPlugins.renderOccludedFlags;if(e|=s,!e)return;const i=e=>{this._renderContext.renderOccludedMask=e,this._prepareInternalSlots(ge,K.OPAQUE_MATERIAL,K.TRANSPARENT_MATERIAL,K.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL),s>k.Occlude&&this._renderSlot(K.OCCLUDED_TERRAIN),this._renderInternalSlot(K.OPAQUE_MATERIAL,ge),this._renderInternalSlot(K.TRANSPARENT_MATERIAL,ge),this._renderInternalSlot(K.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL,ge),this._renderContext.resetRenderOccludedMask()};this._renderContext.output=D.Color,t(.5,k.OccludeAndTransparent,(()=>i(k.OccludeAndTransparent)),!0,B.OutlineVisualElementMask),t(.5,k.Transparent,(()=>i(k.Transparent)),!0,B.OutlineVisualElementMask),t(1,k.Opaque,(()=>i(k.Opaque)),!0,B.OutlineVisualElementMask),ge.clear()}_renderAntialiasing(e){const r=this._offscreen,t=this._magnifierEnabled&&null==e?this.fboCache.acquire(C.RGBA,r.width,r.height).acquireDepth(w.DEPTH16_BUFFER):null,s=t?.fbo??e;this._rctx.bindFramebuffer(s);const i=this._offscreen.colorTexture;return this.renderPlugins.produces(K.ANTIALIASING)?(this._pluginInput.compositeTexture=r.colorTexture,this._pluginInput.normalTexture=null,this._pluginInput.highlightTexture=null,this._renderSlot(K.ANTIALIASING,this._pluginInput,s)):null!=i&&this._compositingHelper.composite(this._bindParameters,i,ne.None),t}_prepare(e,r){this._needsTransparentPass=this._materialRenderers.some((e=>e.produces(K.TRANSPARENT_MATERIAL,D.Color))),this._bindParameters.camera=e,this._bindParameters.contentCamera=r}_ensureBindParameters(e,r){this._bindParameters.camera=e,this._bindParameters.contentCamera=r;const t=this._renderContext.offscreenRenderingHelper;this._bindParameters.mainColor=t.colorTexture,this._bindParameters.mainDepth=t.depthTexture}_ensureBindParametersSSR(e){if(this._bindParameters.ssr.lastFrameColor){null==this._ssrEnableTime&&(this._ssrEnableTime=e),this._renderContext.lastFrameCamera.equals(this._bindParameters.camera)?this._reprojectionMatrix=g:(f(Re,this._bindParameters.camera.viewMatrix),f(Ae,this._bindParameters.camera.projectionMatrix),T(Pe,Re,Ae),T(Pe,this._renderContext.lastFrameCamera.viewMatrix,Pe),T(Pe,this._renderContext.lastFrameCamera.projectionMatrix,Pe),this._reprojectionMatrix=Pe);const r=this._stage.view.qualitySettings.fadeDuration;this._bindParameters.ssr.fadeFactor=r>0?Math.min(r,e-this._ssrEnableTime)/r:1,this._bindParameters.ssr.fadeFactor<1&&this._requestRender()}else this._reprojectionMatrix=g,this._ssrEnableTime=null}_prepareInternalSlots(e,...r){let t=!1;for(const s of r)this._bindParameters.slot=s,e.forAll((e=>{e.material.shouldRender(this._renderContext)&&(t=null!=e.prepareTechnique(this._renderContext)||t)}));return t}_renderInternalSlot(e,r=this._materialRenderers){this._bindParameters.slot=e,r.forAll((e=>{if(e.material.shouldRender(this._renderContext)){const r=e.prepareTechnique(this._renderContext);r&&e.render(this._renderContext,r)}}))}get memoryInfo(){return{fbos:this.fboCache.peakMemoryUsage,vaos:this._materialRenderers.reduce(((e,r)=>e+r.usedMemory),0),plugins:this._renderPlugins.usedMemory}}get usedMemory(){return this.fboCache.peakMemoryUsage+(this.edgeView?.usedMemory??0)+this._materialRenderers.reduce(((e,r)=>e+r.usedMemory),0)+this._renderPlugins.usedMemory}get test(){const e=this;return{offscreen:this._offscreen,shadowMap:this._shadowMap,highlight:this._highlight,lighting:this._bindParameters.lighting,materialRenderers:this._materialRenderers,shadowAccumulator:this._shadowAccumulator,weatherIsFading:this._bindParameters.cloudsFade.isFading,resetRenderStateFeatures:()=>{e._renderStateFeatures=z(),this.renderPlugins.renderFeatureChanged(),this._requestRender()},getFramebufferTexture:r=>{switch(r){case fe.Color:return e._offscreen.colorTexture;case fe.LinearDepth:return e._bindParameters.linearDepth?.colorTexture;case fe.ShadowMap:return e._shadowMap.depthTexture;case fe.HudVisibility:return e._bindParameters.hudVisibility?.colorTexture}}}}};var me,fe;e([c()],ue.prototype,"_renderPlugins",void 0),e([c()],ue.prototype,"_shadowAccumulator",void 0),e([c()],ue.prototype,"_state",void 0),e([c()],ue.prototype,"_renderStateFeatures",void 0),e([c({readOnly:!0})],ue.prototype,"fullResolutionAtmosphere",null),e([c()],ue.prototype,"_smaa",void 0),e([c({autoDestroy:!0})],ue.prototype,"_edgeView",void 0),e([c()],ue.prototype,"updating",null),e([c()],ue.prototype,"isCameraFinal",null),ue=e([u("esri.views.3d.webgl-engine.lib.Renderer")],ue),function(e){e[e.Geometry=0]="Geometry",e[e.HUD=1]="HUD"}(me||(me={})),function(e){e[e.Color=0]="Color",e[e.LinearDepth=1]="LinearDepth",e[e.ShadowMap=2]="ShadowMap",e[e.HudVisibility=3]="HudVisibility"}(fe||(fe={}));const Te=[0,0,0,0],ge=new o,Ae=A(),Re=A(),Pe=A();function Ee(e){return r=>e.immediate.schedule(r)}export{fe as FramebufferId,ue as Renderer};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../../chunks/tslib.es6.js";import{isSome as t}from"../../../../../core/arrayUtils.js";import{destroyMaybe as r}from"../../../../../core/maybe.js";import{isAborted as a,throwIfAborted as n}from"../../../../../core/promiseUtils.js";import{property as s}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/accessorSupport/ensureType.js";import"../../../../../core/has.js";import{subclass as i}from"../../../../../core/accessorSupport/decorators/subclass.js";import{c as o}from"../../../../../chunks/mat4f64.js";import{g as l,d as c,m as h}from"../../../../../chunks/vec3.js";import{c as d}from"../../../../../chunks/vec3f64.js";import{c as u,f as m}from"../../../../../chunks/vec4f64.js";import{debugFlags as f}from"../../../support/debugFlags.js";import{glLayout as _}from"../../../support/buffer/glUtil.js";import{newLayout as p}from"../../../support/buffer/InterleavedLayout.js";import{ShaderOutput as g}from"../../core/shaderLibrary/ShaderOutput.js";import{ASyncPreparesRenderPlugin as I}from"../../effects/RenderPlugin.js";import{Camera as y}from"../Camera.js";import{Default3D as C}from"../DefaultVertexAttributeLocations.js";import{IntersectorType as v}from"../IntersectorInterfaces.js";import E from"../Octree.js";import{RenderSlot as R}from"../RenderSlot.js";import{assert as A}from"../Util.js";import{VertexAttribute as D}from"../VertexAttribute.js";import{InstanceData as T,StateFlags as b}from"./InstanceData.js";import{InstanceOctree as L}from"./InstanceOctree.js";import{LevelSelector as S}from"./LevelSelector.js";import{LodLevel as O}from"./LodLevel.js";import{RenderInstanceData as N}from"./RenderInstanceData.js";import{colorMixModes as j}from"../../materials/internal/MaterialUtil.js";import{encodeDoubleVec3 as x}from"../../materials/renderers/utils.js";import{DefaultMaterialDrawParameters as M}from"../../shaders/DefaultMaterialTechnique.js";import{TaskPriority as U,noBudget as w}from"../../../../support/Scheduler.js";import{bindVertexBufferLayout as F,unbindVertexBufferLayout as V}from"../../../../webgl/Util.js";const H=e=>{const t=e.baseBoundingSphere.radius,r=e.levels.map((e=>e.minScreenSpaceRadius));return new S(t,r)};let B=class extends I{constructor(e,t){super(e),this.type=v.LOD,this.isGround=!1,this.renderSlots=[R.OPAQUE_MATERIAL,R.TRANSPARENT_MATERIAL],this._levels=[],this._defaultRenderInstanceData=[new Array],this._highlightRenderInstanceData=[new Array],this._allRenderInstanceData=[this._defaultRenderInstanceData[0],this._highlightRenderInstanceData[0]],this._instanceIndex=0,this._cycleStartIndex=0,this._slicePlane=!1,this._camera=new y,this._updateCyclesWithStaticCamera=-1,this._needFullCycle=!1,this._instanceData=new T({shaderTransformation:e.shaderTransformation},e.optionalFields),this.addHandles(t.registerTask(U.LOD_RENDERER,this))}initialize(){this._instanceBufferLayout=q(this.optionalFields),this._glInstanceBufferLayout=_(this._instanceBufferLayout,1),this.addHandles([this._instanceData.events.on("instances-changed",(()=>this._requestUpdateCycle())),this._instanceData.events.on("instance-transform-changed",(({index:e})=>{this._requestUpdateCycle(),this.metadata.notifyGraphicGeometryChanged(e)})),this._instanceData.events.on("instance-visibility-changed",(({index:e})=>{this._requestUpdateCycle(!0),this.metadata.notifyGraphicVisibilityChanged(e)})),this._instanceData.events.on("instance-highlight-changed",(()=>this._requestUpdateCycle(!0)))])}get _enableLevelSelection(){return this.symbol.levels.length>1}get levels(){return this._levels}get baseBoundingBox(){return this._levels[this._levels.length-1].boundingBox}get baseBoundingSphere(){return this._levels[this._levels.length-1].boundingSphere}get baseMaterial(){return this._levels[this._levels.length-1].components[0].material}get slicePlaneEnabled(){return this._slicePlane}set slicePlaneEnabled(e){this._slicePlane=e}get layerUid(){return this.metadata.layerUid}get instanceData(){return this._instanceData}get usedMemory(){return this._allRenderInstanceData.reduce(((e,t)=>t.reduce(((e,t)=>e+t.usedMemory),e)),0)}get renderStats(){const e=this._instanceData.size,t=[];return this._levels.forEach(((e,r)=>{const a=this._allRenderInstanceData[0][r].size+this._allRenderInstanceData[1][r].size,n=e.triangleCount;t.push({renderedInstances:a,renderedTriangles:a*n,trianglesPerInstance:n})})),{totalInstances:e,renderedInstances:t.reduce(((e,t)=>e+t.renderedInstances),0),renderedTriangles:t.reduce(((e,t)=>e+t.renderedTriangles),0),levels:t}}async initializeRenderContext(e,r){this._context=e;const s=e.renderContext.rctx,i=await Promise.allSettled(this.symbol.levels.map((t=>(this._defaultRenderInstanceData[0].push(new N(s,this._instanceBufferLayout)),this._highlightRenderInstanceData[0].push(new N(s,this._instanceBufferLayout)),O.create(e,t,r))))),o=i.map((e=>"fulfilled"===e.status?e.value:null)).filter(t);if(a(r)||o.length!==i.length){o.forEach((e=>e.destroy())),n(r);for(const e of i)if("rejected"===e.status)throw e.reason}this._levels=o,this._levelSelector=H(this)}uninitializeRenderContext(){this._invalidateOctree(),this._levels.forEach((e=>e.destroy())),this._defaultRenderInstanceData[0].forEach((e=>e.destroy())),this._highlightRenderInstanceData[0].forEach((e=>e.destroy()))}_hasTransparentLevels(){return this._levels.some((e=>e.components.some((e=>e.material.canRender(R.TRANSPARENT_MATERIAL,g.Color)))))}canRender(e,t){return t===g.Highlight||t===g.ShadowHighlight?this._highlightRenderInstanceData[0].some((e=>e.size>0)):e!==R.TRANSPARENT_MATERIAL||this._hasTransparentLevels()}prepareRender(e){if(!f.LOD_INSTANCE_RENDERER_DISABLE_UPDATES){if(this._enableLevelSelection){const t=e.bindParameters.contentCamera.equals(this._camera);this._camera.copyFrom(e.bindParameters.contentCamera),t||this._requestUpdateCycle()}this._needFullCycle&&(this.runTask(w),this._needFullCycle=!1)}}prepareTechniques(e){if(!this.baseMaterial.isVisible()||!this.baseMaterial.isVisibleForOutput(e.output))return null;const t=this._getInstanceDatas(e.output);if(!t)return null;const r=new Array;return t.forEach((t=>this.levels.forEach(((a,n)=>{a.components.forEach((a=>r.push(this._beginComponent(e,t[n],a))))})))),r}render(e,t){const r=this._getInstanceDatas(e.output);if(!r||null==t)return;let a=0;e.rctx.bindVAO(),r.forEach((r=>this.levels.forEach(((n,s)=>{n.components.forEach((n=>this._renderComponent(e,t[a++],r[s],n,s)))}))))}_getInstanceDatas(e){const t=e!==g.Highlight&&e!==g.ShadowHighlight,r=e!==g.ShadowExcludeHighlight;return t&&r?this._allRenderInstanceData:t?this._defaultRenderInstanceData:r?this._highlightRenderInstanceData:null}intersect(e,t,r,a){if(!this.baseMaterial.isVisible()||null==this._octree)return;const n=d();l(n,a,r);const s=n=>{this._instanceData.getCombinedModelTransform(n,W),e.transform.set(W),h(K,r,e.transform.inverse),h(Y,a,e.transform.inverse);const s=this._instanceData.getState(n),i=this._instanceData.getLodLevel(n),o=this._levels.length;A(0!=(s&b.ACTIVE),"invalid instance state"),A(i>=0&&i<o,"invaid lod level"),this._levels[i].intersect(e,t,K,Y,n,this.metadata,o)};this.baseMaterial.parameters.verticalOffset?this._octree.forEach(s):this._octree.forEachAlongRay(r,n,s)}notifyShaderTransformationChanged(){this._invalidateOctree(),this._requestUpdateCycle()}get _octree(){if(null==this._octreeCached){const e=this._instanceData,t=e.view?.state;if(!t)return null;this._octreeCached=new L(e,this.baseBoundingSphere);for(let r=0;r<e.capacity;++r)t.get(r)&b.ACTIVE&&this._octreeCached.addInstance(r)}return this._octreeCached}_invalidateOctree(){this._octreeCached=r(this._octreeCached)}queryDepthRange(e){if(null==this._octree)return{near:1/0,far:-1/0};const t=e.viewForward,r=this._octree.findClosest(t,E.DepthOrder.FRONT_TO_BACK,e.frustum),a=this._octree.findClosest(t,E.DepthOrder.BACK_TO_FRONT,e.frustum);if(null==r||null==a)return{near:1/0,far:-1/0};const n=e.eye,s=this._instanceData.view;s.boundingSphere.getVec(r,k),l(k,k,n);const i=c(k,t)-k[3];s.boundingSphere.getVec(a,k),l(k,k,n);const o=c(k,t)+k[3];return{near:Math.max(e.near,i),far:Math.min(e.far,o)}}_requestUpdateCycle(e=!1){this._updateCyclesWithStaticCamera=-1,this._cycleStartIndex=this._instanceIndex,e&&(this._needFullCycle=!0,this._context.requestRender())}_startUpdateCycle(){this._updateCyclesWithStaticCamera++,this._allRenderInstanceData.forEach((e=>e.forEach((e=>e.startUpdateCycle()))))}get running(){return this._instanceData.size>0&&this._updateCyclesWithStaticCamera<1}runTask(e){const{_enableLevelSelection:t,_camera:r,_levelSelector:a}=this;this._allRenderInstanceData.forEach((e=>e.forEach((e=>e.beginUpdate()))));const n=this._instanceData,s=n.view;let i=n.size;const o=n.capacity;let l=this._instanceIndex;const c=Math.ceil(o/500);for(let h=0;h<i&&!e.done;++h){l===this._cycleStartIndex&&this._startUpdateCycle();const h=s.state.get(l);let d=0;if(!(h&b.ALLOCATED)){l=l+1===o?0:l+1,i++;continue}const u=s.lodLevel.get(l);if(h&b.DEFAULT_ACTIVE&&this._defaultRenderInstanceData[0][u].freeTail(),h&b.HIGHLIGHT_ACTIVE&&this._highlightRenderInstanceData[0][u].freeTail(),h&b.REMOVE)n.freeInstance(l);else if(h&b.VISIBLE){let e=0;t&&(s.modelOrigin.getVec(l,z),e=a.selectLevel(z,n.getCombinedMedianScaleFactor(l),r)),d=h&~(b.ACTIVE|b.TRANSFORM_CHANGED),e>=0&&(h&b.HIGHLIGHT?(P(this._highlightRenderInstanceData[0][e],s,l),d|=b.HIGHLIGHT_ACTIVE):(P(this._defaultRenderInstanceData[0][e],s,l),d|=b.DEFAULT_ACTIVE)),s.state.set(l,d),s.lodLevel.set(l,e)}else d=h&~(b.ACTIVE|b.TRANSFORM_CHANGED),s.state.set(l,d);if(null!=this._octreeCached){const e=!!(h&b.ACTIVE),t=!!(d&b.ACTIVE);!e&&t?this._octreeCached.addInstance(l):e&&!t?this._octreeCached.removeInstance(l):e&&t&&h&b.TRANSFORM_CHANGED&&(this._octreeCached.removeInstance(l),this._octreeCached.addInstance(l))}l=l+1===o?0:l+1,l%c==0&&e.madeProgress()}this._instanceIndex=l,this._allRenderInstanceData.forEach((e=>e.forEach((e=>e.endUpdate())))),this._context.requestRender()}_beginComponent(e,t,r){const{bindParameters:a,rctx:n,output:s}=e;if(0===t.size||!r.material.canRender(a.slot,e.output))return null;const i=r.glMaterials.load(n,a.slot,s);return null!=i?i.beginSlot(a):null}_renderComponent(e,t,r,a,n){if(!t)return;const{bindParameters:s,rctx:i}=e;i.appleAmdDriverHelper?.resetIndicesType();const o=i.bindTechnique(t,a.material.parameters,s);i.bindVAO(a.vao),t.ensureAttributeLocations(a.vao),o.bindDraw(Q,s,a.material.parameters),f.LOD_INSTANCE_RENDERER_COLORIZE_BY_LEVEL&&e.output===g.Color&&(o.setUniform4fv("externalColor",J[Math.min(n,J.length-1)]),o.setUniform1i("colorMixMode",j.replace));const l=r.capacity,c=r.headIndex,h=r.tailIndex,d=r.firstIndex,u=this._glInstanceBufferLayout,m=(e,n)=>{F(i,C,r.buffer,u,e),i.drawArraysInstanced(t.primitiveType,0,a.vertexCount,n-e),V(i,C,r.buffer,u)};a.material.parameters.transparent&&null!=d?c>h?(A(d>=h&&d<=c,"invalid firstIndex"),m(d,c),m(h,d)):c<h&&(d<=c?(A(d>=0&&d<=c,"invalid firstIndex"),m(d,c),m(h,l),m(0,d)):(A(d>=h&&d<=l,"invalid firstIndex"),m(d,l),m(0,c),m(h,d))):c>h?m(h,c):c<h&&(m(0,c),m(h,l)),i.bindVAO(null)}};function P(e,t,r){const a=e.allocateHead();G(t,r,e.view,a)}function G(e,t,r,a){x(e.modelOrigin,t,r.modelOriginHi,r.modelOriginLo,a),r.model.copyFrom(a,e.model,t),r.modelNormal.copyFrom(a,e.modelNormal,t),e.color&&r.color&&r.color.copyFrom(a,e.color,t),e.objectAndLayerIdColor&&r.objectAndLayerIdColor&&r.objectAndLayerIdColor.copyFrom(a,e.objectAndLayerIdColor,t),e.featureAttribute&&r.featureAttribute&&r.featureAttribute.copyFrom(a,e.featureAttribute,t)}function q(e){let t=p().vec3f(D.INSTANCEMODELORIGINHI).vec3f(D.INSTANCEMODELORIGINLO).mat3f(D.INSTANCEMODEL).mat3f(D.INSTANCEMODELNORMAL);return null!=e&&e.includes("featureAttribute")&&(t=t.vec4f(D.INSTANCEFEATUREATTRIBUTE)),null!=e&&e.includes("color")&&(t=t.vec4u8(D.INSTANCECOLOR)),null!=e&&e.includes("objectAndLayerIdColor")&&(t=t.vec4u8(D.INSTANCEOBJECTANDLAYERIDCOLOR)),t}e([s({constructOnly:!0})],B.prototype,"symbol",void 0),e([s({constructOnly:!0})],B.prototype,"optionalFields",void 0),e([s({constructOnly:!0})],B.prototype,"metadata",void 0),e([s({constructOnly:!0})],B.prototype,"shaderTransformation",void 0),e([s()],B.prototype,"_instanceData",void 0),e([s()],B.prototype,"_cycleStartIndex",void 0),e([s({readOnly:!0})],B.prototype,"_enableLevelSelection",null),e([s()],B.prototype,"_updateCyclesWithStaticCamera",void 0),e([s({readOnly:!0})],B.prototype,"running",null),B=e([i("esri.views.3d.webgl-engine.lib.lodRendering.LodRenderer")],B);const z=d(),k=u(),W=o(),K=d(),Y=d(),J=[m(1,0,1,1),m(0,0,1,1),m(0,1,0,1),m(1,1,0,1),m(1,0,0,1)],Q=new M;export{B as LodRenderer};
5
+ import{_ as e}from"../../../../../chunks/tslib.es6.js";import{isSome as t}from"../../../../../core/arrayUtils.js";import{destroyMaybe as r}from"../../../../../core/maybe.js";import{isAborted as a,throwIfAborted as s}from"../../../../../core/promiseUtils.js";import{property as n}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/accessorSupport/ensureType.js";import"../../../../../core/has.js";import{subclass as i}from"../../../../../core/accessorSupport/decorators/subclass.js";import{c as o}from"../../../../../chunks/mat4f64.js";import{g as l,d as c,m as h}from"../../../../../chunks/vec3.js";import{c as d}from"../../../../../chunks/vec3f64.js";import{c as u,f as m}from"../../../../../chunks/vec4f64.js";import{debugFlags as p}from"../../../support/debugFlags.js";import{glLayout as f}from"../../../support/buffer/glUtil.js";import{newLayout as _}from"../../../support/buffer/InterleavedLayout.js";import{ShaderOutput as g}from"../../core/shaderLibrary/ShaderOutput.js";import{ASyncPreparesRenderPlugin as I}from"../../effects/RenderPlugin.js";import{Camera as y}from"../Camera.js";import{Default3D as C}from"../DefaultVertexAttributeLocations.js";import{IntersectorType as v}from"../IntersectorInterfaces.js";import E from"../Octree.js";import{RenderSlot as A}from"../RenderSlot.js";import{assert as R}from"../Util.js";import{VertexAttribute as D}from"../VertexAttribute.js";import{InstanceData as T,StateFlags as b}from"./InstanceData.js";import{InstanceOctree as L}from"./InstanceOctree.js";import{LevelSelector as S}from"./LevelSelector.js";import{LodLevel as O}from"./LodLevel.js";import{RenderInstanceData as N}from"./RenderInstanceData.js";import{colorMixModes as j}from"../../materials/internal/MaterialUtil.js";import{encodeDoubleVec3 as x}from"../../materials/renderers/utils.js";import{DefaultMaterialDrawParameters as M}from"../../shaders/DefaultMaterialTechnique.js";import{TaskPriority as U,noBudget as w}from"../../../../support/Scheduler.js";import{bindVertexBufferLayout as F,unbindVertexBufferLayout as V}from"../../../../webgl/Util.js";const H=e=>{const t=e.baseBoundingSphere.radius,r=e.levels.map((e=>e.minScreenSpaceRadius));return new S(t,r)};let B=class extends I{constructor(e,t){super(e),this.type=v.LOD,this.isGround=!1,this.renderSlots=[A.OPAQUE_MATERIAL,A.TRANSPARENT_MATERIAL],this._levels=[],this._defaultRenderInstanceData=[new Array],this._highlightRenderInstanceData=[new Array],this._allRenderInstanceData=[this._defaultRenderInstanceData[0],this._highlightRenderInstanceData[0]],this._instanceIndex=0,this._cycleStartIndex=0,this._slicePlane=!1,this._camera=new y,this._updateCyclesWithStaticCamera=-1,this._needFullCycle=!1,this._instanceData=new T({shaderTransformation:e.shaderTransformation},e.optionalFields),this.addHandles(t.registerTask(U.LOD_RENDERER,this))}initialize(){this._instanceBufferLayout=q(this.optionalFields),this._glInstanceBufferLayout=f(this._instanceBufferLayout,1),this.addHandles([this._instanceData.events.on("instances-changed",(()=>this._requestUpdateCycle())),this._instanceData.events.on("instance-transform-changed",(({index:e})=>{this._requestUpdateCycle(),this.metadata.notifyGraphicGeometryChanged(e)})),this._instanceData.events.on("instance-visibility-changed",(({index:e})=>{this._requestUpdateCycle(!0),this.metadata.notifyGraphicVisibilityChanged(e)})),this._instanceData.events.on("instance-highlight-changed",(()=>this._requestUpdateCycle(!0)))])}get _enableLevelSelection(){return this.symbol.levels.length>1}get levels(){return this._levels}get baseBoundingBox(){return this._levels[this._levels.length-1].boundingBox}get baseBoundingSphere(){return this._levels[this._levels.length-1].boundingSphere}get baseMaterial(){return this._levels[this._levels.length-1].components[0].material}get slicePlaneEnabled(){return this._slicePlane}set slicePlaneEnabled(e){this._slicePlane=e}get layerUid(){return this.metadata.layerUid}get instanceData(){return this._instanceData}get usedMemory(){return this._allRenderInstanceData.reduce(((e,t)=>t.reduce(((e,t)=>e+t.usedMemory),e)),0)}get renderStats(){const e=this._instanceData.size,t=[];return this._levels.forEach(((e,r)=>{const a=this._allRenderInstanceData[0][r].size+this._allRenderInstanceData[1][r].size,s=e.triangleCount;t.push({renderedInstances:a,renderedTriangles:a*s,trianglesPerInstance:s})})),{totalInstances:e,renderedInstances:t.reduce(((e,t)=>e+t.renderedInstances),0),renderedTriangles:t.reduce(((e,t)=>e+t.renderedTriangles),0),levels:t}}async initializeRenderContext(e,r){this._context=e;const n=e.renderContext.rctx,i=await Promise.allSettled(this.symbol.levels.map((t=>(this._defaultRenderInstanceData[0].push(new N(n,this._instanceBufferLayout)),this._highlightRenderInstanceData[0].push(new N(n,this._instanceBufferLayout)),O.create(e,t,r))))),o=i.map((e=>"fulfilled"===e.status?e.value:null)).filter(t);if(a(r)||o.length!==i.length){o.forEach((e=>e.destroy())),s(r);for(const e of i)if("rejected"===e.status)throw e.reason}this._levels=o,this._levelSelector=H(this)}uninitializeRenderContext(){this._invalidateOctree(),this._levels.forEach((e=>e.destroy())),this._defaultRenderInstanceData[0].forEach((e=>e.destroy())),this._highlightRenderInstanceData[0].forEach((e=>e.destroy()))}_hasTransparentLevels(){return this._levels.some((e=>e.components.some((e=>e.material.produces(A.TRANSPARENT_MATERIAL,g.Color)))))}produces(e,t){return t===g.Highlight||t===g.ShadowHighlight?this._highlightRenderInstanceData[0].some((e=>e.size>0)):e!==A.TRANSPARENT_MATERIAL||this._hasTransparentLevels()}prepareRender(e){if(!p.LOD_INSTANCE_RENDERER_DISABLE_UPDATES){if(this._enableLevelSelection){const t=e.bindParameters.contentCamera.equals(this._camera);this._camera.copyFrom(e.bindParameters.contentCamera),t||this._requestUpdateCycle()}this._needFullCycle&&(this.runTask(w),this._needFullCycle=!1)}}prepareTechniques(e){if(!this.baseMaterial.isVisible()||!this.baseMaterial.isVisibleForOutput(e.output))return null;const t=this._getInstanceDatas(e.output);if(!t)return null;const r=new Array;return t.forEach((t=>this.levels.forEach(((a,s)=>{a.components.forEach((a=>r.push(this._beginComponent(e,t[s],a))))})))),r}render(e,t){const r=this._getInstanceDatas(e.output);if(!r||null==t)return;let a=0;e.rctx.bindVAO(),r.forEach((r=>this.levels.forEach(((s,n)=>{s.components.forEach((s=>this._renderComponent(e,t[a++],r[n],s,n)))}))))}_getInstanceDatas(e){const t=e!==g.Highlight&&e!==g.ShadowHighlight,r=e!==g.ShadowExcludeHighlight;return t&&r?this._allRenderInstanceData:t?this._defaultRenderInstanceData:r?this._highlightRenderInstanceData:null}intersect(e,t,r,a){if(!this.baseMaterial.isVisible()||null==this._octree)return;const s=d();l(s,a,r);const n=s=>{this._instanceData.getCombinedModelTransform(s,W),e.transform.set(W),h(K,r,e.transform.inverse),h(Y,a,e.transform.inverse);const n=this._instanceData.getState(s),i=this._instanceData.getLodLevel(s),o=this._levels.length;R(0!=(n&b.ACTIVE),"invalid instance state"),R(i>=0&&i<o,"invaid lod level"),this._levels[i].intersect(e,t,K,Y,s,this.metadata,o)};this.baseMaterial.parameters.verticalOffset?this._octree.forEach(n):this._octree.forEachAlongRay(r,s,n)}notifyShaderTransformationChanged(){this._invalidateOctree(),this._requestUpdateCycle()}get _octree(){if(null==this._octreeCached){const e=this._instanceData,t=e.view?.state;if(!t)return null;this._octreeCached=new L(e,this.baseBoundingSphere);for(let r=0;r<e.capacity;++r)t.get(r)&b.ACTIVE&&this._octreeCached.addInstance(r)}return this._octreeCached}_invalidateOctree(){this._octreeCached=r(this._octreeCached)}queryDepthRange(e){if(null==this._octree)return{near:1/0,far:-1/0};const t=e.viewForward,r=this._octree.findClosest(t,E.DepthOrder.FRONT_TO_BACK,e.frustum),a=this._octree.findClosest(t,E.DepthOrder.BACK_TO_FRONT,e.frustum);if(null==r||null==a)return{near:1/0,far:-1/0};const s=e.eye,n=this._instanceData.view;n.boundingSphere.getVec(r,k),l(k,k,s);const i=c(k,t)-k[3];n.boundingSphere.getVec(a,k),l(k,k,s);const o=c(k,t)+k[3];return{near:Math.max(e.near,i),far:Math.min(e.far,o)}}_requestUpdateCycle(e=!1){this._updateCyclesWithStaticCamera=-1,this._cycleStartIndex=this._instanceIndex,e&&(this._needFullCycle=!0,this._context.requestRender())}_startUpdateCycle(){this._updateCyclesWithStaticCamera++,this._allRenderInstanceData.forEach((e=>e.forEach((e=>e.startUpdateCycle()))))}get running(){return this._instanceData.size>0&&this._updateCyclesWithStaticCamera<1}runTask(e){const{_enableLevelSelection:t,_camera:r,_levelSelector:a}=this;this._allRenderInstanceData.forEach((e=>e.forEach((e=>e.beginUpdate()))));const s=this._instanceData,n=s.view;let i=s.size;const o=s.capacity;let l=this._instanceIndex;const c=Math.ceil(o/500);for(let h=0;h<i&&!e.done;++h){l===this._cycleStartIndex&&this._startUpdateCycle();const h=n.state.get(l);let d=0;if(!(h&b.ALLOCATED)){l=l+1===o?0:l+1,i++;continue}const u=n.lodLevel.get(l);if(h&b.DEFAULT_ACTIVE&&this._defaultRenderInstanceData[0][u].freeTail(),h&b.HIGHLIGHT_ACTIVE&&this._highlightRenderInstanceData[0][u].freeTail(),h&b.REMOVE)s.freeInstance(l);else if(h&b.VISIBLE){let e=0;t&&(n.modelOrigin.getVec(l,z),e=a.selectLevel(z,s.getCombinedMedianScaleFactor(l),r)),d=h&~(b.ACTIVE|b.TRANSFORM_CHANGED),e>=0&&(h&b.HIGHLIGHT?(P(this._highlightRenderInstanceData[0][e],n,l),d|=b.HIGHLIGHT_ACTIVE):(P(this._defaultRenderInstanceData[0][e],n,l),d|=b.DEFAULT_ACTIVE)),n.state.set(l,d),n.lodLevel.set(l,e)}else d=h&~(b.ACTIVE|b.TRANSFORM_CHANGED),n.state.set(l,d);if(null!=this._octreeCached){const e=!!(h&b.ACTIVE),t=!!(d&b.ACTIVE);!e&&t?this._octreeCached.addInstance(l):e&&!t?this._octreeCached.removeInstance(l):e&&t&&h&b.TRANSFORM_CHANGED&&(this._octreeCached.removeInstance(l),this._octreeCached.addInstance(l))}l=l+1===o?0:l+1,l%c==0&&e.madeProgress()}this._instanceIndex=l,this._allRenderInstanceData.forEach((e=>e.forEach((e=>e.endUpdate())))),this._context.requestRender()}_beginComponent(e,t,r){const{bindParameters:a,rctx:s,output:n}=e;if(0===t.size||!r.material.produces(a.slot,e.output))return null;const i=r.glMaterials.load(s,a.slot,n);return null!=i?i.beginSlot(a):null}_renderComponent(e,t,r,a,s){if(!t)return;const{bindParameters:n,rctx:i}=e;i.appleAmdDriverHelper?.resetIndicesType();const o=i.bindTechnique(t,a.material.parameters,n);i.bindVAO(a.vao),t.ensureAttributeLocations(a.vao),o.bindDraw(Q,n,a.material.parameters),p.LOD_INSTANCE_RENDERER_COLORIZE_BY_LEVEL&&e.output===g.Color&&(o.setUniform4fv("externalColor",J[Math.min(s,J.length-1)]),o.setUniform1i("colorMixMode",j.replace));const l=r.capacity,c=r.headIndex,h=r.tailIndex,d=r.firstIndex,u=this._glInstanceBufferLayout,m=(e,s)=>{F(i,C,r.buffer,u,e),i.drawArraysInstanced(t.primitiveType,0,a.vertexCount,s-e),V(i,C,r.buffer,u)};a.material.parameters.transparent&&null!=d?c>h?(R(d>=h&&d<=c,"invalid firstIndex"),m(d,c),m(h,d)):c<h&&(d<=c?(R(d>=0&&d<=c,"invalid firstIndex"),m(d,c),m(h,l),m(0,d)):(R(d>=h&&d<=l,"invalid firstIndex"),m(d,l),m(0,c),m(h,d))):c>h?m(h,c):c<h&&(m(0,c),m(h,l)),i.bindVAO(null)}};function P(e,t,r){const a=e.allocateHead();G(t,r,e.view,a)}function G(e,t,r,a){x(e.modelOrigin,t,r.modelOriginHi,r.modelOriginLo,a),r.model.copyFrom(a,e.model,t),r.modelNormal.copyFrom(a,e.modelNormal,t),e.color&&r.color&&r.color.copyFrom(a,e.color,t),e.objectAndLayerIdColor&&r.objectAndLayerIdColor&&r.objectAndLayerIdColor.copyFrom(a,e.objectAndLayerIdColor,t),e.featureAttribute&&r.featureAttribute&&r.featureAttribute.copyFrom(a,e.featureAttribute,t)}function q(e){let t=_().vec3f(D.INSTANCEMODELORIGINHI).vec3f(D.INSTANCEMODELORIGINLO).mat3f(D.INSTANCEMODEL).mat3f(D.INSTANCEMODELNORMAL);return null!=e&&e.includes("featureAttribute")&&(t=t.vec4f(D.INSTANCEFEATUREATTRIBUTE)),null!=e&&e.includes("color")&&(t=t.vec4u8(D.INSTANCECOLOR)),null!=e&&e.includes("objectAndLayerIdColor")&&(t=t.vec4u8(D.INSTANCEOBJECTANDLAYERIDCOLOR)),t}e([n({constructOnly:!0})],B.prototype,"symbol",void 0),e([n({constructOnly:!0})],B.prototype,"optionalFields",void 0),e([n({constructOnly:!0})],B.prototype,"metadata",void 0),e([n({constructOnly:!0})],B.prototype,"shaderTransformation",void 0),e([n()],B.prototype,"_instanceData",void 0),e([n()],B.prototype,"_cycleStartIndex",void 0),e([n({readOnly:!0})],B.prototype,"_enableLevelSelection",null),e([n()],B.prototype,"_updateCyclesWithStaticCamera",void 0),e([n({readOnly:!0})],B.prototype,"running",null),B=e([i("esri.views.3d.webgl-engine.lib.lodRendering.LodRenderer")],B);const z=d(),k=u(),W=o(),K=d(),Y=d(),J=[m(1,0,1,1),m(0,0,1,1),m(0,1,0,1),m(1,1,0,1),m(1,0,0,1)],Q=new M;export{B as LodRenderer};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{f as r}from"../../../../chunks/vec2f64.js";import{f as t}from"../../../../chunks/vec4f64.js";import{ShaderOutput as e}from"../core/shaderLibrary/ShaderOutput.js";import s from"../lib/GLMaterial.js";import{MaterialParameters as i}from"../lib/Material.js";import{RenderSlot as o}from"../lib/RenderSlot.js";import{DefaultBufferWriter as a}from"./DefaultBufferWriter.js";import{PositionUVLayout as n}from"./DefaultLayouts.js";import{TriangleMaterial as u}from"./TriangleMaterial.js";import{CheckerBoardTechnique as p}from"../shaders/CheckerBoardTechnique.js";import{CheckerBoardTechniqueConfiguration as f}from"../shaders/CheckerBoardTechniqueConfiguration.js";class h extends u{constructor(r){super(r,new l),this._configuration=new f}getConfiguration(r,t){return this._configuration.transparent=this.parameters.transparent,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.polygonOffset=this.parameters.polygonOffset,this._configuration.transparencyPassType=t.transparencyPassType,this._configuration.multipassEnabled=t.multipassEnabled,this._configuration.cullAboveGround=t.multipassTerrain.cullAboveGround,this._configuration}canRender(r,t){if(t===e.Color||t===e.Alpha){return r===(this.parameters.transparent?this.parameters.writeDepth?o.TRANSPARENT_MATERIAL:o.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL:o.OPAQUE_MATERIAL)||r===o.DRAPED_MATERIAL}return!1}createGLMaterial(r){return new c(r)}createBufferWriter(){return new a(n)}}class c extends s{beginSlot(r){return this.ensureTechnique(p,r)}}class l extends i{constructor(){super(...arguments),this.size=r(1,1),this.color1=t(.75,.75,.75,1),this.color2=t(.5,.5,.5,1),this.transparent=!1,this.writeDepth=!0,this.polygonOffset=!1}}export{h as CheckerBoardMaterial,l as Parameters};
5
+ import{f as r}from"../../../../chunks/vec2f64.js";import{f as t}from"../../../../chunks/vec4f64.js";import{ShaderOutput as e}from"../core/shaderLibrary/ShaderOutput.js";import s from"../lib/GLMaterial.js";import{MaterialParameters as i}from"../lib/Material.js";import{RenderSlot as o}from"../lib/RenderSlot.js";import{DefaultBufferWriter as a}from"./DefaultBufferWriter.js";import{PositionUVLayout as n}from"./DefaultLayouts.js";import{TriangleMaterial as u}from"./TriangleMaterial.js";import{CheckerBoardTechnique as p}from"../shaders/CheckerBoardTechnique.js";import{CheckerBoardTechniqueConfiguration as f}from"../shaders/CheckerBoardTechniqueConfiguration.js";class h extends u{constructor(r){super(r,new l),this._configuration=new f}getConfiguration(r,t){return this._configuration.transparent=this.parameters.transparent,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.polygonOffset=this.parameters.polygonOffset,this._configuration.transparencyPassType=t.transparencyPassType,this._configuration.multipassEnabled=t.multipassEnabled,this._configuration.cullAboveGround=t.multipassTerrain.cullAboveGround,this._configuration}produces(r,t){if(t===e.Color||t===e.Alpha){return r===(this.parameters.transparent?this.parameters.writeDepth?o.TRANSPARENT_MATERIAL:o.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL:o.OPAQUE_MATERIAL)||r===o.DRAPED_MATERIAL}return!1}createGLMaterial(r){return new c(r)}createBufferWriter(){return new a(n)}}class c extends s{beginSlot(r){return this.ensureTechnique(p,r)}}class l extends i{constructor(){super(...arguments),this.size=r(1,1),this.color1=t(.75,.75,.75,1),this.color2=t(.5,.5,.5,1),this.transparent=!1,this.writeDepth=!0,this.polygonOffset=!1}}export{h as CheckerBoardMaterial,l as Parameters};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import has from"../../../../core/has.js";import{Z as e}from"../../../../chunks/vec4f64.js";import{newLayout as t}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as r}from"../core/shaderLibrary/ShaderOutput.js";import{CullFaceOptions as s}from"../lib/basicInterfaces.js";import a from"../lib/GLMaterial.js";import{OITPolygonOffsetLimit as i}from"../lib/OrderIndependentTransparency.js";import{RenderSlot as o}from"../lib/RenderSlot.js";import{VertexAttribute as n}from"../lib/VertexAttribute.js";import{DefaultBufferWriter as h}from"./DefaultBufferWriter.js";import{TriangleMaterial as l}from"./TriangleMaterial.js";import{VisualVariablePassParameters as u}from"./VisualVariablePassParameters.js";import{ColorMaterialTechnique as c}from"../shaders/ColorMaterialTechnique.js";import{ColorMaterialTechniqueConfiguration as p}from"../shaders/ColorMaterialTechniqueConfiguration.js";class f extends l{constructor(e){super(e,new d),this.supportsEdges=!0,this._configuration=new p}getConfiguration(e,t){return this._configuration.output=e,this._configuration.cullFace=this.parameters.cullFace,this._configuration.hasVertexColors=this.parameters.hasVertexColors&&!this.parameters.vvColor,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.transparent=this.parameters.transparent,this._configuration.polygonOffset=this.parameters.polygonOffset,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.hasOccludees=this.parameters.hasOccludees,this._configuration.transparencyPassType=t.transparencyPassType,this._configuration.enableOffset=t.camera.relativeElevation<i,this._configuration.multipassEnabled=t.multipassEnabled,this._configuration.cullAboveGround=t.multipassTerrain.cullAboveGround,this._configuration.vvColor=!!this.parameters.vvColor,this._configuration}canRender(e,t){if(t===r.Color||t===r.Alpha||t===r.Highlight||t===r.Depth&&this.parameters.writeLinearDepth||t===r.ObjectAndLayerIdColor){if(e===o.DRAPED_MATERIAL)return!0;if(t===r.Highlight)return e===o.OPAQUE_MATERIAL;return e===(this.parameters.transparent?this.parameters.writeDepth?o.TRANSPARENT_MATERIAL:o.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL:o.OPAQUE_MATERIAL)}return!1}createGLMaterial(e){return new m(e)}createBufferWriter(){const e=t().vec3f(n.POSITION);return has("enable-feature:objectAndLayerId-rendering")&&e.vec4u8(n.OBJECTANDLAYERIDCOLOR),this.parameters.vvColor?e.f32(n.COLORFEATUREATTRIBUTE):e.vec4u8(n.COLOR),new h(e)}}class m extends a{_updateOccludeeState(e){e.hasOccludees!==this._material.parameters.hasOccludees&&this._material.setParameters({hasOccludees:e.hasOccludees})}beginSlot(e){return this._output!==r.Color&&this._output!==r.Alpha||this._updateOccludeeState(e),this.ensureTechnique(c,e)}}class d extends u{constructor(){super(...arguments),this.color=e,this.transparent=!1,this.writeDepth=!0,this.writeLinearDepth=!1,this.hasVertexColors=!1,this.polygonOffset=!1,this.hasSlicePlane=!1,this.cullFace=s.None,this.hasOccludees=!1}}export{f as ColorMaterial,d as Parameters};
5
+ import has from"../../../../core/has.js";import{Z as e}from"../../../../chunks/vec4f64.js";import{newLayout as t}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as r}from"../core/shaderLibrary/ShaderOutput.js";import{CullFaceOptions as s}from"../lib/basicInterfaces.js";import a from"../lib/GLMaterial.js";import{OITPolygonOffsetLimit as i}from"../lib/OrderIndependentTransparency.js";import{RenderSlot as o}from"../lib/RenderSlot.js";import{VertexAttribute as n}from"../lib/VertexAttribute.js";import{DefaultBufferWriter as h}from"./DefaultBufferWriter.js";import{TriangleMaterial as l}from"./TriangleMaterial.js";import{VisualVariablePassParameters as u}from"./VisualVariablePassParameters.js";import{ColorMaterialTechnique as c}from"../shaders/ColorMaterialTechnique.js";import{ColorMaterialTechniqueConfiguration as p}from"../shaders/ColorMaterialTechniqueConfiguration.js";class f extends l{constructor(e){super(e,new d),this.supportsEdges=!0,this._configuration=new p}getConfiguration(e,t){return this._configuration.output=e,this._configuration.cullFace=this.parameters.cullFace,this._configuration.hasVertexColors=this.parameters.hasVertexColors&&!this.parameters.vvColor,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.transparent=this.parameters.transparent,this._configuration.polygonOffset=this.parameters.polygonOffset,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.hasOccludees=this.parameters.hasOccludees,this._configuration.transparencyPassType=t.transparencyPassType,this._configuration.enableOffset=t.camera.relativeElevation<i,this._configuration.multipassEnabled=t.multipassEnabled,this._configuration.cullAboveGround=t.multipassTerrain.cullAboveGround,this._configuration.vvColor=!!this.parameters.vvColor,this._configuration}produces(e,t){if(t===r.Color||t===r.Alpha||t===r.Highlight||t===r.Depth&&this.parameters.writeLinearDepth||t===r.ObjectAndLayerIdColor){if(e===o.DRAPED_MATERIAL)return!0;if(t===r.Highlight)return e===o.OPAQUE_MATERIAL;return e===(this.parameters.transparent?this.parameters.writeDepth?o.TRANSPARENT_MATERIAL:o.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL:o.OPAQUE_MATERIAL)}return!1}createGLMaterial(e){return new m(e)}createBufferWriter(){const e=t().vec3f(n.POSITION);return has("enable-feature:objectAndLayerId-rendering")&&e.vec4u8(n.OBJECTANDLAYERIDCOLOR),this.parameters.vvColor?e.f32(n.COLORFEATUREATTRIBUTE):e.vec4u8(n.COLOR),new h(e)}}class m extends a{_updateOccludeeState(e){e.hasOccludees!==this._material.parameters.hasOccludees&&this._material.setParameters({hasOccludees:e.hasOccludees})}beginSlot(e){return this._output!==r.Color&&this._output!==r.Alpha||this._updateOccludeeState(e),this.ensureTechnique(c,e)}}class d extends u{constructor(){super(...arguments),this.color=e,this.transparent=!1,this.writeDepth=!0,this.writeLinearDepth=!1,this.hasVertexColors=!1,this.polygonOffset=!1,this.hasSlicePlane=!1,this.cullFace=s.None,this.hasOccludees=!1}}export{f as ColorMaterial,d as Parameters};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import has from"../../../../core/has.js";import{s as e,i as t,n as r,g as s,l as a,b as i,d as o,t as n}from"../../../../chunks/vec3.js";import{c as h,f as l}from"../../../../chunks/vec3f64.js";import{ViewingMode as c}from"../../../ViewingMode.js";import{newLayout as u}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as m}from"../core/shaderLibrary/ShaderOutput.js";import{NormalType as p}from"../core/shaderLibrary/attributes/NormalAttribute.glsl.js";import{NormalsDoubleSidedMode as d}from"../core/shaderLibrary/shading/Normals.glsl.js";import{PBRMode as f}from"../core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js";import{CullFaceOptions as g}from"../lib/basicInterfaces.js";import{GLTextureMaterial as T}from"../lib/GLTextureMaterial.js";import{Material as _}from"../lib/Material.js";import{OITPolygonOffsetLimit as x}from"../lib/OrderIndependentTransparency.js";import{RenderSlot as b}from"../lib/RenderSlot.js";import{VertexAttribute as S}from"../lib/VertexAttribute.js";import{getVerticalOffsetObject3D as v}from"../lib/verticalOffsetUtils.js";import{DefaultBufferWriter as O}from"./DefaultBufferWriter.js";import{verticalOffsetAtDistance as w,intersectTriangleGeometry as M}from"./internal/MaterialUtil.js";import{DefaultMaterialTechnique as C,DefaultMaterialPassParameters as A}from"../shaders/DefaultMaterialTechnique.js";import{DefaultMaterialTechniqueConfiguration as y}from"../shaders/DefaultMaterialTechniqueConfiguration.js";import{RealisticTreeTechnique as R}from"../shaders/RealisticTreeTechnique.js";class I extends _{constructor(e){super(e,L),this.supportsEdges=!0,this._configuration=new y,this._vertexBufferLayout=j(this.parameters)}isVisibleForOutput(e){return e!==m.Shadow&&e!==m.ShadowExcludeHighlight&&e!==m.ShadowHighlight||this.parameters.castShadows}isVisible(){const e=this.parameters;if(!super.isVisible()||0===e.layerOpacity)return!1;const{hasInstancedColor:t,hasVertexColors:r,hasSymbolColors:s,vvColor:a}=e,i="replace"===e.colorMixMode,o=e.opacity>0,n=e.externalColor&&e.externalColor[3]>0,h=t||a||s;return r&&h?i||o:r?i?n:o:h?i||o:i?n:o}getConfiguration(e,t){return this._configuration.output=e,this._configuration.hasNormalTexture=!!this.parameters.normalTextureId,this._configuration.hasColorTexture=!!this.parameters.textureId,this._configuration.hasVertexTangents=this.parameters.hasVertexTangents,this._configuration.instanced=this.parameters.isInstanced,this._configuration.instancedDoublePrecision=this.parameters.instancedDoublePrecision,this._configuration.vvSize=!!this.parameters.vvSize,this._configuration.hasVerticalOffset=null!=this.parameters.verticalOffset,this._configuration.hasScreenSizePerspective=null!=this.parameters.screenSizePerspective,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasSliceHighlight=this.parameters.hasSliceHighlight,this._configuration.alphaDiscardMode=this.parameters.textureAlphaMode,this._configuration.normalType=this.parameters.normalType,this._configuration.transparent=this.parameters.transparent,this._configuration.writeDepth=this.parameters.writeDepth,null!=this.parameters.customDepthTest&&(this._configuration.customDepthTest=this.parameters.customDepthTest),this._configuration.hasOccludees=this.parameters.hasOccludees,this._configuration.cullFace=this.parameters.hasSlicePlane?g.None:this.parameters.cullFace,this._configuration.multipassEnabled=t.multipassEnabled,this._configuration.cullAboveGround=t.multipassTerrain.cullAboveGround,this._configuration.hasModelTransformation=null!=this.parameters.modelTransformation,e!==m.Color&&e!==m.Alpha||(this._configuration.hasVertexColors=this.parameters.hasVertexColors,this._configuration.hasSymbolColors=this.parameters.hasSymbolColors,this.parameters.treeRendering?this._configuration.doubleSidedMode=d.WindingOrder:this._configuration.doubleSidedMode=this.parameters.doubleSided&&"normal"===this.parameters.doubleSidedType?d.View:this.parameters.doubleSided&&"winding-order"===this.parameters.doubleSidedType?d.WindingOrder:d.None,this._configuration.instancedColor=this.parameters.hasInstancedColor,this._configuration.receiveShadows=this.parameters.receiveShadows&&this.parameters.shadowMappingEnabled,this._configuration.receiveAmbientOcclusion=null!=t.ssao,this._configuration.vvColor=!!this.parameters.vvColor,this._configuration.textureAlphaPremultiplied=!!this.parameters.textureAlphaPremultiplied,this._configuration.pbrMode=this.parameters.usePBR?this.parameters.isSchematic?f.Schematic:f.Normal:f.Disabled,this._configuration.hasMetallicRoughnessTexture=!!this.parameters.metallicRoughnessTextureId,this._configuration.hasEmissionTexture=!!this.parameters.emissiveTextureId,this._configuration.hasOcclusionTexture=!!this.parameters.occlusionTextureId,this._configuration.offsetBackfaces=!(!this.parameters.transparent||!this.parameters.offsetTransparentBackfaces),this._configuration.transparencyPassType=t.transparencyPassType,this._configuration.enableOffset=t.camera.relativeElevation<x,this._configuration.snowCover=this.hasSnowCover(t),this._configuration.hasColorTextureTransform=!!this.parameters.colorTextureTransformMatrix,this._configuration.hasNormalTextureTransform=!!this.parameters.normalTextureTransformMatrix,this._configuration.hasEmissionTextureTransform=!!this.parameters.emissiveTextureTransformMatrix,this._configuration.hasOcclusionTextureTransform=!!this.parameters.occlusionTextureTransformMatrix,this._configuration.hasMetallicRoughnessTextureTransform=!!this.parameters.metallicRoughnessTextureTransformMatrix),this._configuration}hasSnowCover(e){return null!=e.weather&&e.weatherVisible&&"snowy"===e.weather.type&&"enabled"===e.weather.snowCover}intersect(h,l,u,m,p,d){if(null!=this.parameters.verticalOffset){const h=u.camera;e(z,l[12],l[13],l[14]);let d=null;switch(u.viewingMode){case c.Global:d=r(B,z);break;case c.Local:d=t(B,V)}let f=0;const g=s(G,z,h.eye),T=a(g),_=i(g,g,1/T);let x=null;this.parameters.screenSizePerspective&&(x=o(d,_)),f+=w(h,T,this.parameters.verticalOffset,x??0,this.parameters.screenSizePerspective),i(d,d,f),n(H,d,u.transform.inverseRotation),m=s(D,m,H),p=s(N,p,H)}M(h,u,m,p,v(u.verticalOffset),d)}canRender(e,t){if(t===m.Color||t===m.Alpha||t===m.Depth||t===m.Normal||t===m.Shadow||t===m.ShadowHighlight||t===m.ShadowExcludeHighlight||t===m.Highlight||t===m.ObjectAndLayerIdColor){return e===(this.parameters.transparent?this.parameters.writeDepth?b.TRANSPARENT_MATERIAL:b.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL:b.OPAQUE_MATERIAL)||e===b.DRAPED_MATERIAL}return!1}createGLMaterial(e){return new E(e)}createBufferWriter(){return new O(this._vertexBufferLayout)}}class E extends T{constructor(e){super({...e,...e.material.parameters})}_updateShadowState(e){e.shadowMap.enabled!==this._material.parameters.shadowMappingEnabled&&this._material.setParameters({shadowMappingEnabled:e.shadowMap.enabled})}_updateOccludeeState(e){e.hasOccludees!==this._material.parameters.hasOccludees&&this._material.setParameters({hasOccludees:e.hasOccludees})}beginSlot(t){this._output!==m.Color&&this._output!==m.Alpha||(this._updateShadowState(t),this._updateOccludeeState(t));const r=this._material.parameters;this.updateTexture(r.textureId);const s=t.camera.viewInverseTransposeMatrix;return e(r.origin,s[3],s[7],s[11]),this._material.setParameters(this.textureBindParameters),this.ensureTechnique(r.treeRendering?R:C,t)}}class P extends A{constructor(){super(...arguments),this.initTextureTransparent=!1,this.treeRendering=!1,this.hasVertexTangents=!1}}const L=new P;function j(e){const t=u().vec3f(S.POSITION);e.normalType===p.Compressed?t.vec2i16(S.NORMALCOMPRESSED,{glNormalized:!0}):t.vec3f(S.NORMAL),e.hasVertexTangents&&t.vec4f(S.TANGENT);return(e.textureId||e.normalTextureId||e.metallicRoughnessTextureId||e.emissiveTextureId||e.occlusionTextureId)&&t.vec2f(S.UV0),e.hasVertexColors&&t.vec4u8(S.COLOR),e.hasSymbolColors&&t.vec4u8(S.SYMBOLCOLOR),has("enable-feature:objectAndLayerId-rendering")&&t.vec4u8(S.OBJECTANDLAYERIDCOLOR),t}const D=h(),N=h(),V=l(0,0,1),B=h(),H=h(),z=h(),G=h();export{E as DefaultGLMaterial,I as DefaultMaterial,P as DefaultMaterialParameters};
5
+ import has from"../../../../core/has.js";import{s as e,i as t,n as r,g as s,l as a,b as i,d as o,t as n}from"../../../../chunks/vec3.js";import{c as h,f as l}from"../../../../chunks/vec3f64.js";import{ViewingMode as c}from"../../../ViewingMode.js";import{newLayout as u}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as m}from"../core/shaderLibrary/ShaderOutput.js";import{NormalType as p}from"../core/shaderLibrary/attributes/NormalAttribute.glsl.js";import{NormalsDoubleSidedMode as d}from"../core/shaderLibrary/shading/Normals.glsl.js";import{PBRMode as f}from"../core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js";import{CullFaceOptions as g}from"../lib/basicInterfaces.js";import{GLTextureMaterial as T}from"../lib/GLTextureMaterial.js";import{Material as _}from"../lib/Material.js";import{OITPolygonOffsetLimit as x}from"../lib/OrderIndependentTransparency.js";import{RenderSlot as b}from"../lib/RenderSlot.js";import{VertexAttribute as S}from"../lib/VertexAttribute.js";import{getVerticalOffsetObject3D as v}from"../lib/verticalOffsetUtils.js";import{DefaultBufferWriter as O}from"./DefaultBufferWriter.js";import{verticalOffsetAtDistance as w,intersectTriangleGeometry as M}from"./internal/MaterialUtil.js";import{DefaultMaterialTechnique as C,DefaultMaterialPassParameters as A}from"../shaders/DefaultMaterialTechnique.js";import{DefaultMaterialTechniqueConfiguration as y}from"../shaders/DefaultMaterialTechniqueConfiguration.js";import{RealisticTreeTechnique as R}from"../shaders/RealisticTreeTechnique.js";class I extends _{constructor(e){super(e,L),this.supportsEdges=!0,this._configuration=new y,this._vertexBufferLayout=j(this.parameters)}isVisibleForOutput(e){return e!==m.Shadow&&e!==m.ShadowExcludeHighlight&&e!==m.ShadowHighlight||this.parameters.castShadows}isVisible(){const e=this.parameters;if(!super.isVisible()||0===e.layerOpacity)return!1;const{hasInstancedColor:t,hasVertexColors:r,hasSymbolColors:s,vvColor:a}=e,i="replace"===e.colorMixMode,o=e.opacity>0,n=e.externalColor&&e.externalColor[3]>0,h=t||a||s;return r&&h?i||o:r?i?n:o:h?i||o:i?n:o}getConfiguration(e,t){return this._configuration.output=e,this._configuration.hasNormalTexture=!!this.parameters.normalTextureId,this._configuration.hasColorTexture=!!this.parameters.textureId,this._configuration.hasVertexTangents=this.parameters.hasVertexTangents,this._configuration.instanced=this.parameters.isInstanced,this._configuration.instancedDoublePrecision=this.parameters.instancedDoublePrecision,this._configuration.vvSize=!!this.parameters.vvSize,this._configuration.hasVerticalOffset=null!=this.parameters.verticalOffset,this._configuration.hasScreenSizePerspective=null!=this.parameters.screenSizePerspective,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasSliceHighlight=this.parameters.hasSliceHighlight,this._configuration.alphaDiscardMode=this.parameters.textureAlphaMode,this._configuration.normalType=this.parameters.normalType,this._configuration.transparent=this.parameters.transparent,this._configuration.writeDepth=this.parameters.writeDepth,null!=this.parameters.customDepthTest&&(this._configuration.customDepthTest=this.parameters.customDepthTest),this._configuration.hasOccludees=this.parameters.hasOccludees,this._configuration.cullFace=this.parameters.hasSlicePlane?g.None:this.parameters.cullFace,this._configuration.multipassEnabled=t.multipassEnabled,this._configuration.cullAboveGround=t.multipassTerrain.cullAboveGround,this._configuration.hasModelTransformation=null!=this.parameters.modelTransformation,e!==m.Color&&e!==m.Alpha||(this._configuration.hasVertexColors=this.parameters.hasVertexColors,this._configuration.hasSymbolColors=this.parameters.hasSymbolColors,this.parameters.treeRendering?this._configuration.doubleSidedMode=d.WindingOrder:this._configuration.doubleSidedMode=this.parameters.doubleSided&&"normal"===this.parameters.doubleSidedType?d.View:this.parameters.doubleSided&&"winding-order"===this.parameters.doubleSidedType?d.WindingOrder:d.None,this._configuration.instancedColor=this.parameters.hasInstancedColor,this._configuration.receiveShadows=this.parameters.receiveShadows&&this.parameters.shadowMappingEnabled,this._configuration.receiveAmbientOcclusion=null!=t.ssao,this._configuration.vvColor=!!this.parameters.vvColor,this._configuration.textureAlphaPremultiplied=!!this.parameters.textureAlphaPremultiplied,this._configuration.pbrMode=this.parameters.usePBR?this.parameters.isSchematic?f.Schematic:f.Normal:f.Disabled,this._configuration.hasMetallicRoughnessTexture=!!this.parameters.metallicRoughnessTextureId,this._configuration.hasEmissionTexture=!!this.parameters.emissiveTextureId,this._configuration.hasOcclusionTexture=!!this.parameters.occlusionTextureId,this._configuration.offsetBackfaces=!(!this.parameters.transparent||!this.parameters.offsetTransparentBackfaces),this._configuration.transparencyPassType=t.transparencyPassType,this._configuration.enableOffset=t.camera.relativeElevation<x,this._configuration.snowCover=this.hasSnowCover(t),this._configuration.hasColorTextureTransform=!!this.parameters.colorTextureTransformMatrix,this._configuration.hasNormalTextureTransform=!!this.parameters.normalTextureTransformMatrix,this._configuration.hasEmissionTextureTransform=!!this.parameters.emissiveTextureTransformMatrix,this._configuration.hasOcclusionTextureTransform=!!this.parameters.occlusionTextureTransformMatrix,this._configuration.hasMetallicRoughnessTextureTransform=!!this.parameters.metallicRoughnessTextureTransformMatrix),this._configuration}hasSnowCover(e){return null!=e.weather&&e.weatherVisible&&"snowy"===e.weather.type&&"enabled"===e.weather.snowCover}intersect(h,l,u,m,p,d){if(null!=this.parameters.verticalOffset){const h=u.camera;e(z,l[12],l[13],l[14]);let d=null;switch(u.viewingMode){case c.Global:d=r(B,z);break;case c.Local:d=t(B,V)}let f=0;const g=s(G,z,h.eye),T=a(g),_=i(g,g,1/T);let x=null;this.parameters.screenSizePerspective&&(x=o(d,_)),f+=w(h,T,this.parameters.verticalOffset,x??0,this.parameters.screenSizePerspective),i(d,d,f),n(H,d,u.transform.inverseRotation),m=s(D,m,H),p=s(N,p,H)}M(h,u,m,p,v(u.verticalOffset),d)}produces(e,t){if(t===m.Color||t===m.Alpha||t===m.Depth||t===m.Normal||t===m.Shadow||t===m.ShadowHighlight||t===m.ShadowExcludeHighlight||t===m.Highlight||t===m.ObjectAndLayerIdColor){return e===(this.parameters.transparent?this.parameters.writeDepth?b.TRANSPARENT_MATERIAL:b.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL:b.OPAQUE_MATERIAL)||e===b.DRAPED_MATERIAL}return!1}createGLMaterial(e){return new E(e)}createBufferWriter(){return new O(this._vertexBufferLayout)}}class E extends T{constructor(e){super({...e,...e.material.parameters})}_updateShadowState(e){e.shadowMap.enabled!==this._material.parameters.shadowMappingEnabled&&this._material.setParameters({shadowMappingEnabled:e.shadowMap.enabled})}_updateOccludeeState(e){e.hasOccludees!==this._material.parameters.hasOccludees&&this._material.setParameters({hasOccludees:e.hasOccludees})}beginSlot(t){this._output!==m.Color&&this._output!==m.Alpha||(this._updateShadowState(t),this._updateOccludeeState(t));const r=this._material.parameters;this.updateTexture(r.textureId);const s=t.camera.viewInverseTransposeMatrix;return e(r.origin,s[3],s[7],s[11]),this._material.setParameters(this.textureBindParameters),this.ensureTechnique(r.treeRendering?R:C,t)}}class P extends A{constructor(){super(...arguments),this.initTextureTransparent=!1,this.treeRendering=!1,this.hasVertexTangents=!1}}const L=new P;function j(e){const t=u().vec3f(S.POSITION);e.normalType===p.Compressed?t.vec2i16(S.NORMALCOMPRESSED,{glNormalized:!0}):t.vec3f(S.NORMAL),e.hasVertexTangents&&t.vec4f(S.TANGENT);return(e.textureId||e.normalTextureId||e.metallicRoughnessTextureId||e.emissiveTextureId||e.occlusionTextureId)&&t.vec2f(S.UV0),e.hasVertexColors&&t.vec4u8(S.COLOR),e.hasSymbolColors&&t.vec4u8(S.SYMBOLCOLOR),has("enable-feature:objectAndLayerId-rendering")&&t.vec4u8(S.OBJECTANDLAYERIDCOLOR),t}const D=h(),N=h(),V=l(0,0,1),B=h(),H=h(),z=h(),G=h();export{E as DefaultGLMaterial,I as DefaultMaterial,P as DefaultMaterialParameters};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import has from"../../../../core/has.js";import{clamp as e}from"../../../../core/mathUtils.js";import{f as t}from"../../../../chunks/mat3.js";import{c as s}from"../../../../chunks/mat3f64.js";import{a as r}from"../../../../chunks/mat4.js";import{c as i}from"../../../../chunks/mat4f64.js";import{j as a}from"../../../../chunks/vec2.js";import{a as n,f as o}from"../../../../chunks/vec2f64.js";import{s as c,m as l,n as f,g as u,b as p,i as h,l as m,h as d,t as g,d as O,e as S}from"../../../../chunks/vec3.js";import{c as A,f as v}from"../../../../chunks/vec3f64.js";import{b,c as T,f as I}from"../../../../chunks/vec4f64.js";import{isMat4 as _}from"../../../../core/libs/gl-matrix-2/types/mat4.js";import{create as x}from"../../../../geometry/support/aaBoundingRect.js";import{BufferViewVec4u8 as E}from"../../../../geometry/support/buffer/BufferView.js";import{evaluateModelTransformScale as P}from"../../layers/support/FastSymbolUpdates.js";import{debugFlags as y}from"../../support/debugFlags.js";import{newLayout as R}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as U}from"../core/shaderLibrary/ShaderOutput.js";import{HUDSpace as C}from"../core/shaderLibrary/hud/HUD.glsl.js";import{GLTextureMaterial as j,GLTextureMaterialBindParameters as L}from"../lib/GLTextureMaterial.js";import{Material as D,RenderOccludedFlag as M}from"../lib/Material.js";import{RenderSlot as z}from"../lib/RenderSlot.js";import{applyScaleFactor as w,applyPrecomputedScaleFactor as F,precomputeScaleFactor as V}from"../lib/screenSizePerspectiveUtils.js";import{assert as N}from"../lib/Util.js";import{VertexAttribute as B}from"../lib/VertexAttribute.js";import{ScaleInfo as H}from"./ScaleInfo.js";import{writePosition as X,writeNormal as k,writeColor as G,writeBufferVec4 as W,writeBufferVec4Zeros as q,writeObjectAndLayerIdColor as Y}from"./internal/bufferWriterUtils.js";import{verticalOffsetAtDistance as Z}from"./internal/MaterialUtil.js";import{c as J}from"../../../../chunks/HUDMaterial.glsl.js";import{HUDMaterialTechnique as K}from"../shaders/HUDMaterialTechnique.js";import{HUDMaterialTechniqueConfiguration as Q}from"../shaders/HUDMaterialTechniqueConfiguration.js";class $ extends D{constructor(e){super(e,new Te),this._configuration=new Q}getConfiguration(e,t){return this._configuration.output=e,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasVerticalOffset=!!this.parameters.verticalOffset,this._configuration.hasScreenSizePerspective=!!this.parameters.screenSizePerspective,this._configuration.screenCenterOffsetUnitsEnabled="screen"===this.parameters.centerOffsetUnits?C.Screen:C.World,this._configuration.hasPolygonOffset=this.parameters.polygonOffset,this._configuration.draped=this.parameters.isDraped,this._configuration.occlusionTestEnabled=this.parameters.occlusionTest,this._configuration.pixelSnappingEnabled=this.parameters.pixelSnappingEnabled,this._configuration.signedDistanceFieldEnabled=this.parameters.textureIsSignedDistanceField,this._configuration.sampleSignedDistanceFieldTexelCenter=this.parameters.sampleSignedDistanceFieldTexelCenter,this._configuration.vvSize=!!this.parameters.vvSize,this._configuration.vvColor=!!this.parameters.vvColor,this._configuration.occlusionPass=t.slot===z.OCCLUSION_PIXELS&&this.parameters.occlusionTest&&(e===U.Color||e===U.Alpha),e===U.Color&&(this._configuration.debugDrawLabelBorder=!!y.LABELS_SHOW_BORDER),e===U.Highlight&&(this._configuration.binaryHighlightOcclusionEnabled=this.parameters.binaryHighlightOcclusion),this._configuration.depthEnabled=this.parameters.depthEnabled,this._configuration.transparencyPassType=t.transparencyPassType,this._configuration.multipassEnabled=t.multipassEnabled,this._configuration.cullAboveGround=t.multipassTerrain.cullAboveGround,this._configuration}intersect(e,s,i,a,n,o){if(!i.options.selectionMode||!i.options.hud||!e.visible)return;const g=this.parameters,O=i.point,S=i.camera;let{scaleX:v,scaleY:b}=this._getScreenScale(e);v*=S.pixelRatio,b*=S.pixelRatio,t(ue,s),e.vertexAttributes.has(B.FEATUREATTRIBUTE)&&se(ue);const T=e.vertexAttributes.get(B.POSITION),I=e.vertexAttributes.get(B.SIZE),_=e.vertexAttributes.get(B.NORMAL),x=e.vertexAttributes.get(B.AUXPOS1);N(T.size>=3);const E=J(g),P="screen"===this.parameters.centerOffsetUnits;for(let t=0;t<T.data.length/T.size;t++){const e=t*T.size;c(ne,T.data[e],T.data[e+1],T.data[e+2]),l(ne,ne,s);const a=t*I.size;ve[0]=I.data[a]*v,ve[1]=I.data[a+1]*b,l(ne,ne,S.viewMatrix);const n=t*x.size;if(c(me,x.data[n],x.data[n+1],x.data[n+2]),!P&&(ne[0]+=me[0],ne[1]+=me[1],0!==me[2])){const e=me[2];f(me,ne),u(ne,ne,p(me,me,e))}const y=t*_.size;if(c(oe,_.data[y],_.data[y+1],_.data[y+2]),this._normalAndViewAngle(oe,ue,S,Oe),this._applyVerticalOffsetTransformationView(ne,Oe,S,ie),S.applyProjection(ne,ce),ce[0]>-1){ce[0]=Math.floor(ce[0]),ce[1]=Math.floor(ce[1]),P&&(me[0]||me[1])&&(ce[0]+=me[0],0!==me[1]&&(ce[1]+=w(me[1],ie.factorAlignment)),S.unapplyProjection(ce,ne)),ce[0]+=this.parameters.screenOffset[0],ce[1]+=this.parameters.screenOffset[1],F(ve,ie.factor,ve);const e=Se*S.pixelRatio;let t=0;if(g.textureIsSignedDistanceField&&(t=g.outlineSize*S.pixelRatio/2),O&&re(O,ce[0],ce[1],ve,e,t,g,E)){const e=i.ray;if(l(fe,ne,r(he,S.viewMatrix)),ce[0]=O[0],ce[1]=O[1],S.unprojectFromRenderScreen(ce,ne)){const t=A();h(t,e.direction);const s=1/m(t);p(t,t,s);o(d(e.origin,ne)*s,t,-1,!0,1,fe)}}}}}intersectDraped(e,t,s,r,i,a){const n=e.vertexAttributes.get(B.POSITION),o=e.vertexAttributes.get(B.SIZE),c=this.parameters,l=J(c);let{scaleX:f,scaleY:u}=this._getScreenScale(e);f*=e.screenToWorldRatio,u*=e.screenToWorldRatio;const p=Ae*e.screenToWorldRatio;for(let h=0;h<n.data.length/n.size;h++){const t=h*n.size,s=n.data[t],m=n.data[t+1],d=h*o.size;ve[0]=o.data[d]*f,ve[1]=o.data[d+1]*u;let g=0;c.textureIsSignedDistanceField&&(g=c.outlineSize*e.screenToWorldRatio/2),re(r,s,m,ve,p,g,c,l)&&i(a.dist,a.normal,-1,!1)}}createBufferWriter(){return new xe(this)}_normalAndViewAngle(e,s,r,i){return _(s)&&(s=t(pe,s)),g(i.normal,e,s),l(i.normal,i.normal,r.viewInverseTransposeMatrix),i.cosAngle=O(le,be),i}_updateScaleInfo(e,t,s){const r=this.parameters;null!=r.screenSizePerspective?V(s,t,r.screenSizePerspective,e.factor):(e.factor.scale=1,e.factor.factor=0,e.factor.minScaleFactor=0),null!=r.screenSizePerspectiveAlignment?V(s,t,r.screenSizePerspectiveAlignment,e.factorAlignment):(e.factorAlignment.factor=e.factor.factor,e.factorAlignment.scale=e.factor.scale,e.factorAlignment.minScaleFactor=e.factor.minScaleFactor)}applyShaderOffsetsView(e,t,s,r,i,a,n){const o=this._normalAndViewAngle(t,s,i,Oe);return this._applyVerticalGroundOffsetView(e,o,i,n),this._applyVerticalOffsetTransformationView(n,o,i,a),this._applyPolygonOffsetView(n,o,r[3],i,n),this._applyCenterOffsetView(n,r,n),n}applyShaderOffsetsNDC(e,t,s,r,i){return this._applyCenterOffsetNDC(e,t,s,r),null!=i&&h(i,r),this._applyPolygonOffsetNDC(r,t,s,r),r}_applyPolygonOffsetView(t,s,r,i,a){const n=i.aboveGround?1:-1;let o=Math.sign(r);0===o&&(o=n);const c=n*o;if(this.parameters.shaderPolygonOffset<=0)return h(a,t);const l=e(Math.abs(s.cosAngle),.01,1),f=1-Math.sqrt(1-l*l)/l/i.viewport[2];return p(a,t,c>0?f:1/f),a}_applyVerticalGroundOffsetView(e,t,s,r){const i=m(e),a=s.aboveGround?1:-1,n=.5*s.computeRenderPixelSizeAtDist(i),o=p(ne,t.normal,a*n);return S(r,e,o),r}_applyVerticalOffsetTransformationView(e,t,s,r){const i=this.parameters;if(!i.verticalOffset||!i.verticalOffset.screenLength){if(i.screenSizePerspective||i.screenSizePerspectiveAlignment){const s=m(e);this._updateScaleInfo(r,s,t.cosAngle)}else r.factor.scale=1,r.factorAlignment.scale=1;return e}const a=m(e),n=i.screenSizePerspectiveAlignment??i.screenSizePerspective,o=Z(s,a,i.verticalOffset,t.cosAngle,n);return this._updateScaleInfo(r,a,t.cosAngle),p(t.normal,t.normal,o),S(e,e,t.normal)}_applyCenterOffsetView(e,t,s){const r="screen"!==this.parameters.centerOffsetUnits;return s!==e&&h(s,e),r&&(s[0]+=t[0],s[1]+=t[1],t[2]&&(f(oe,s),S(s,s,p(oe,oe,t[2])))),s}_applyCenterOffsetNDC(e,t,s,r){const i="screen"!==this.parameters.centerOffsetUnits;return r!==e&&h(r,e),i||(r[0]+=t[0]/s.fullWidth*2,r[1]+=t[1]/s.fullHeight*2),r}_applyPolygonOffsetNDC(e,t,s,r){const i=this.parameters.shaderPolygonOffset;if(e!==r&&h(r,e),i){const e=s.aboveGround?1:-1,a=e*Math.sign(t[3]);r[2]-=(a||e)*i}return r}canRender(e,t){if(t===U.Color||t===U.Alpha||t===U.Highlight||t===U.ObjectAndLayerIdColor){if(e===z.DRAPED_MATERIAL)return!0;const{drawInSecondSlot:t,occlusionTest:s}=this.parameters;return e===(t?z.LABEL_MATERIAL:z.HUD_MATERIAL)||s&&e===z.OCCLUSION_PIXELS}return!1}createGLMaterial(e){return new ee(e)}calculateRelativeScreenBounds(e,t,s=x()){return te(this.parameters,e,t,s),s[2]=s[0]+e[0],s[3]=s[1]+e[1],s}_getScreenScale(e){const t=e.vertexAttributes.get(B.FEATUREATTRIBUTE);if(null==t)return{scaleX:1,scaleY:1};const s=b(t.data,ge),[r,i]=P(de,this.parameters,s);return{scaleX:r,scaleY:i}}}class ee extends j{constructor(e){super({...e,...e.material.parameters})}selectProgram(e){return this.ensureTechnique(K,e)}beginSlot(e){return this.updateTexture(this._material.parameters.textureId),this._material.setParameters(this.textureBindParameters),this.selectProgram(e)}}function te(e,t,s,r=ae){return a(r,e.anchorPosition),r[0]*=-t[0],r[1]*=-t[1],r[0]+=e.screenOffset[0]*s,r[1]+=e.screenOffset[1]*s,r}function se(e){const t=e[0],s=e[1],r=e[2],i=e[3],a=e[4],n=e[5],o=e[6],c=e[7],l=e[8],f=1/Math.sqrt(t*t+s*s+r*r),u=1/Math.sqrt(i*i+a*a+n*n),p=1/Math.sqrt(o*o+c*c+l*l);return e[0]=t*f,e[1]=s*f,e[2]=r*f,e[3]=i*u,e[4]=a*u,e[5]=n*u,e[6]=o*p,e[7]=c*p,e[8]=l*p,e}function re(e,t,s,r,i,a,n,o){let c=t-i-(o[0]>0?r[0]*o[0]:0),l=c+r[0]+2*i,f=s-i-(o[1]>0?r[1]*o[1]:0),u=f+r[1]+2*i;const p=n.distanceFieldBoundingBox;return n.textureIsSignedDistanceField&&null!=p&&(c+=r[0]*p[0],f+=r[1]*p[1],l-=r[0]*(1-p[2]),u-=r[1]*(1-p[3]),c-=a,l+=a,f-=a,u+=a),e[0]>c&&e[0]<l&&e[1]>f&&e[1]<u}const ie=new H,ae=n(),ne=A(),oe=A(),ce=T(),le=A(),fe=A(),ue=s(),pe=s(),he=i(),me=A(),de=T(),ge=T(),Oe={normal:le,cosAngle:0},Se=1,Ae=2,ve=[0,0],be=v(0,0,1);class Te extends L{constructor(){super(...arguments),this.renderOccluded=M.Occlude,this.isDecoration=!1,this.color=I(1,1,1,1),this.texCoordScale=[1,1],this.polygonOffset=!1,this.anchorPosition=o(.5,.5),this.screenOffset=[0,0],this.shaderPolygonOffset=1e-5,this.textureIsSignedDistanceField=!1,this.sampleSignedDistanceFieldTexelCenter=!1,this.outlineColor=I(1,1,1,1),this.outlineSize=0,this.vvSizeEnabled=!1,this.vvSize=null,this.vvColor=null,this.vvOpacity=null,this.vvSymbolAnchor=null,this.vvSymbolRotationMatrix=null,this.hasSlicePlane=!1,this.pixelSnappingEnabled=!0,this.occlusionTest=!0,this.binaryHighlightOcclusion=!0,this.centerOffsetUnits="world",this.drawInSecondSlot=!1,this.depthEnabled=!0,this.isDraped=!1}}const Ie=R().vec3f(B.POSITION).vec3f(B.NORMAL).vec2f(B.UV0).vec4u8(B.COLOR).vec2f(B.SIZE).vec4f(B.AUXPOS1).vec4f(B.FEATUREATTRIBUTE),_e=Ie.clone().vec4u8(B.OBJECTANDLAYERIDCOLOR);class xe{constructor(e){this._material=e,this.vertexBufferLayout=has("enable-feature:objectAndLayerId-rendering")?_e:Ie}elementCount(e){return 6*e.indices.get(B.POSITION).length}write(e,t,s,r,i){X(s.indices.get(B.POSITION),s.vertexAttributes.get(B.POSITION).data,e,r.position,i,6),k(s.indices.get(B.NORMAL),s.vertexAttributes.get(B.NORMAL).data,t,r.normal,i,6);const a=s.vertexAttributes.get(B.UV0).data;let n,o,c,l;if(null==a||a.length<4){const e=this._material.parameters;n=0,o=0,c=e.texCoordScale[0],l=e.texCoordScale[1]}else n=a[0],o=a[1],c=a[2],l=a[3];c=Math.min(1.99999,c+1),l=Math.min(1.99999,l+1);let f=s.indices.get(B.POSITION).length,u=i;const p=r.uv0;for(let g=0;g<f;++g)p.set(u,0,n),p.set(u,1,o),u+=1,p.set(u,0,c),p.set(u,1,o),u+=1,p.set(u,0,c),p.set(u,1,l),u+=1,p.set(u,0,c),p.set(u,1,l),u+=1,p.set(u,0,n),p.set(u,1,l),u+=1,p.set(u,0,n),p.set(u,1,o),u+=1;G(s.indices.get(B.COLOR),s.vertexAttributes.get(B.COLOR).data,4,r.color,i,6);const h=s.indices.get(B.SIZE),m=s.vertexAttributes.get(B.SIZE).data;f=h.length;const d=r.size;u=i;for(let g=0;g<f;++g){const e=m[2*h[g]],t=m[2*h[g]+1];for(let s=0;s<6;++s)d.set(u,0,e),d.set(u,1,t),u+=1}if(s.indices.get(B.AUXPOS1)&&s.vertexAttributes.get(B.AUXPOS1)?W(s.indices.get(B.AUXPOS1),s.vertexAttributes.get(B.AUXPOS1).data,r.auxpos1,i,6):q(r.auxpos1,i,6*f),s.indices.get(B.FEATUREATTRIBUTE)&&s.vertexAttributes.get(B.FEATUREATTRIBUTE)?W(s.indices.get(B.FEATUREATTRIBUTE),s.vertexAttributes.get(B.FEATUREATTRIBUTE).data,r.featureAttribute,i,6):q(r.featureAttribute,i,6*f),null!=s.objectAndLayerIdColor){if(s.indices.get(B.POSITION)){const e=s.indices.get(B.POSITION).length,t=r.getField(B.OBJECTANDLAYERIDCOLOR,E);Y(s.objectAndLayerIdColor,t,e,i,6)}}}}export{$ as HUDMaterial,Te as Parameters};
5
+ import has from"../../../../core/has.js";import{clamp as e}from"../../../../core/mathUtils.js";import{f as t}from"../../../../chunks/mat3.js";import{c as s}from"../../../../chunks/mat3f64.js";import{a as r}from"../../../../chunks/mat4.js";import{c as i}from"../../../../chunks/mat4f64.js";import{j as a}from"../../../../chunks/vec2.js";import{a as n,f as o}from"../../../../chunks/vec2f64.js";import{s as c,m as l,n as f,g as u,b as p,i as h,l as m,h as d,t as g,d as O,e as S}from"../../../../chunks/vec3.js";import{c as A,f as v}from"../../../../chunks/vec3f64.js";import{b,c as T,f as I}from"../../../../chunks/vec4f64.js";import{isMat4 as _}from"../../../../core/libs/gl-matrix-2/types/mat4.js";import{create as x}from"../../../../geometry/support/aaBoundingRect.js";import{BufferViewVec4u8 as E}from"../../../../geometry/support/buffer/BufferView.js";import{evaluateModelTransformScale as P}from"../../layers/support/FastSymbolUpdates.js";import{debugFlags as y}from"../../support/debugFlags.js";import{newLayout as R}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as U}from"../core/shaderLibrary/ShaderOutput.js";import{HUDSpace as C}from"../core/shaderLibrary/hud/HUD.glsl.js";import{GLTextureMaterial as j,GLTextureMaterialBindParameters as L}from"../lib/GLTextureMaterial.js";import{Material as D,RenderOccludedFlag as M}from"../lib/Material.js";import{RenderSlot as z}from"../lib/RenderSlot.js";import{applyScaleFactor as w,applyPrecomputedScaleFactor as F,precomputeScaleFactor as V}from"../lib/screenSizePerspectiveUtils.js";import{assert as N}from"../lib/Util.js";import{VertexAttribute as B}from"../lib/VertexAttribute.js";import{ScaleInfo as H}from"./ScaleInfo.js";import{writePosition as X,writeNormal as k,writeColor as G,writeBufferVec4 as W,writeBufferVec4Zeros as q,writeObjectAndLayerIdColor as Y}from"./internal/bufferWriterUtils.js";import{verticalOffsetAtDistance as Z}from"./internal/MaterialUtil.js";import{c as J}from"../../../../chunks/HUDMaterial.glsl.js";import{HUDMaterialTechnique as K}from"../shaders/HUDMaterialTechnique.js";import{HUDMaterialTechniqueConfiguration as Q}from"../shaders/HUDMaterialTechniqueConfiguration.js";class $ extends D{constructor(e){super(e,new Te),this._configuration=new Q}getConfiguration(e,t){return this._configuration.output=e,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasVerticalOffset=!!this.parameters.verticalOffset,this._configuration.hasScreenSizePerspective=!!this.parameters.screenSizePerspective,this._configuration.screenCenterOffsetUnitsEnabled="screen"===this.parameters.centerOffsetUnits?C.Screen:C.World,this._configuration.hasPolygonOffset=this.parameters.polygonOffset,this._configuration.draped=this.parameters.isDraped,this._configuration.occlusionTestEnabled=this.parameters.occlusionTest,this._configuration.pixelSnappingEnabled=this.parameters.pixelSnappingEnabled,this._configuration.signedDistanceFieldEnabled=this.parameters.textureIsSignedDistanceField,this._configuration.sampleSignedDistanceFieldTexelCenter=this.parameters.sampleSignedDistanceFieldTexelCenter,this._configuration.vvSize=!!this.parameters.vvSize,this._configuration.vvColor=!!this.parameters.vvColor,this._configuration.occlusionPass=t.slot===z.OCCLUSION_PIXELS&&this.parameters.occlusionTest&&(e===U.Color||e===U.Alpha),e===U.Color&&(this._configuration.debugDrawLabelBorder=!!y.LABELS_SHOW_BORDER),e===U.Highlight&&(this._configuration.binaryHighlightOcclusionEnabled=this.parameters.binaryHighlightOcclusion),this._configuration.depthEnabled=this.parameters.depthEnabled,this._configuration.transparencyPassType=t.transparencyPassType,this._configuration.multipassEnabled=t.multipassEnabled,this._configuration.cullAboveGround=t.multipassTerrain.cullAboveGround,this._configuration}intersect(e,s,i,a,n,o){if(!i.options.selectionMode||!i.options.hud||!e.visible)return;const g=this.parameters,O=i.point,S=i.camera;let{scaleX:v,scaleY:b}=this._getScreenScale(e);v*=S.pixelRatio,b*=S.pixelRatio,t(ue,s),e.vertexAttributes.has(B.FEATUREATTRIBUTE)&&se(ue);const T=e.vertexAttributes.get(B.POSITION),I=e.vertexAttributes.get(B.SIZE),_=e.vertexAttributes.get(B.NORMAL),x=e.vertexAttributes.get(B.AUXPOS1);N(T.size>=3);const E=J(g),P="screen"===this.parameters.centerOffsetUnits;for(let t=0;t<T.data.length/T.size;t++){const e=t*T.size;c(ne,T.data[e],T.data[e+1],T.data[e+2]),l(ne,ne,s);const a=t*I.size;ve[0]=I.data[a]*v,ve[1]=I.data[a+1]*b,l(ne,ne,S.viewMatrix);const n=t*x.size;if(c(me,x.data[n],x.data[n+1],x.data[n+2]),!P&&(ne[0]+=me[0],ne[1]+=me[1],0!==me[2])){const e=me[2];f(me,ne),u(ne,ne,p(me,me,e))}const y=t*_.size;if(c(oe,_.data[y],_.data[y+1],_.data[y+2]),this._normalAndViewAngle(oe,ue,S,Oe),this._applyVerticalOffsetTransformationView(ne,Oe,S,ie),S.applyProjection(ne,ce),ce[0]>-1){ce[0]=Math.floor(ce[0]),ce[1]=Math.floor(ce[1]),P&&(me[0]||me[1])&&(ce[0]+=me[0],0!==me[1]&&(ce[1]+=w(me[1],ie.factorAlignment)),S.unapplyProjection(ce,ne)),ce[0]+=this.parameters.screenOffset[0],ce[1]+=this.parameters.screenOffset[1],F(ve,ie.factor,ve);const e=Se*S.pixelRatio;let t=0;if(g.textureIsSignedDistanceField&&(t=g.outlineSize*S.pixelRatio/2),O&&re(O,ce[0],ce[1],ve,e,t,g,E)){const e=i.ray;if(l(fe,ne,r(he,S.viewMatrix)),ce[0]=O[0],ce[1]=O[1],S.unprojectFromRenderScreen(ce,ne)){const t=A();h(t,e.direction);const s=1/m(t);p(t,t,s);o(d(e.origin,ne)*s,t,-1,!0,1,fe)}}}}}intersectDraped(e,t,s,r,i,a){const n=e.vertexAttributes.get(B.POSITION),o=e.vertexAttributes.get(B.SIZE),c=this.parameters,l=J(c);let{scaleX:f,scaleY:u}=this._getScreenScale(e);f*=e.screenToWorldRatio,u*=e.screenToWorldRatio;const p=Ae*e.screenToWorldRatio;for(let h=0;h<n.data.length/n.size;h++){const t=h*n.size,s=n.data[t],m=n.data[t+1],d=h*o.size;ve[0]=o.data[d]*f,ve[1]=o.data[d+1]*u;let g=0;c.textureIsSignedDistanceField&&(g=c.outlineSize*e.screenToWorldRatio/2),re(r,s,m,ve,p,g,c,l)&&i(a.dist,a.normal,-1,!1)}}createBufferWriter(){return new xe(this)}_normalAndViewAngle(e,s,r,i){return _(s)&&(s=t(pe,s)),g(i.normal,e,s),l(i.normal,i.normal,r.viewInverseTransposeMatrix),i.cosAngle=O(le,be),i}_updateScaleInfo(e,t,s){const r=this.parameters;null!=r.screenSizePerspective?V(s,t,r.screenSizePerspective,e.factor):(e.factor.scale=1,e.factor.factor=0,e.factor.minScaleFactor=0),null!=r.screenSizePerspectiveAlignment?V(s,t,r.screenSizePerspectiveAlignment,e.factorAlignment):(e.factorAlignment.factor=e.factor.factor,e.factorAlignment.scale=e.factor.scale,e.factorAlignment.minScaleFactor=e.factor.minScaleFactor)}applyShaderOffsetsView(e,t,s,r,i,a,n){const o=this._normalAndViewAngle(t,s,i,Oe);return this._applyVerticalGroundOffsetView(e,o,i,n),this._applyVerticalOffsetTransformationView(n,o,i,a),this._applyPolygonOffsetView(n,o,r[3],i,n),this._applyCenterOffsetView(n,r,n),n}applyShaderOffsetsNDC(e,t,s,r,i){return this._applyCenterOffsetNDC(e,t,s,r),null!=i&&h(i,r),this._applyPolygonOffsetNDC(r,t,s,r),r}_applyPolygonOffsetView(t,s,r,i,a){const n=i.aboveGround?1:-1;let o=Math.sign(r);0===o&&(o=n);const c=n*o;if(this.parameters.shaderPolygonOffset<=0)return h(a,t);const l=e(Math.abs(s.cosAngle),.01,1),f=1-Math.sqrt(1-l*l)/l/i.viewport[2];return p(a,t,c>0?f:1/f),a}_applyVerticalGroundOffsetView(e,t,s,r){const i=m(e),a=s.aboveGround?1:-1,n=.5*s.computeRenderPixelSizeAtDist(i),o=p(ne,t.normal,a*n);return S(r,e,o),r}_applyVerticalOffsetTransformationView(e,t,s,r){const i=this.parameters;if(!i.verticalOffset||!i.verticalOffset.screenLength){if(i.screenSizePerspective||i.screenSizePerspectiveAlignment){const s=m(e);this._updateScaleInfo(r,s,t.cosAngle)}else r.factor.scale=1,r.factorAlignment.scale=1;return e}const a=m(e),n=i.screenSizePerspectiveAlignment??i.screenSizePerspective,o=Z(s,a,i.verticalOffset,t.cosAngle,n);return this._updateScaleInfo(r,a,t.cosAngle),p(t.normal,t.normal,o),S(e,e,t.normal)}_applyCenterOffsetView(e,t,s){const r="screen"!==this.parameters.centerOffsetUnits;return s!==e&&h(s,e),r&&(s[0]+=t[0],s[1]+=t[1],t[2]&&(f(oe,s),S(s,s,p(oe,oe,t[2])))),s}_applyCenterOffsetNDC(e,t,s,r){const i="screen"!==this.parameters.centerOffsetUnits;return r!==e&&h(r,e),i||(r[0]+=t[0]/s.fullWidth*2,r[1]+=t[1]/s.fullHeight*2),r}_applyPolygonOffsetNDC(e,t,s,r){const i=this.parameters.shaderPolygonOffset;if(e!==r&&h(r,e),i){const e=s.aboveGround?1:-1,a=e*Math.sign(t[3]);r[2]-=(a||e)*i}return r}produces(e,t){if(t===U.Color||t===U.Alpha||t===U.Highlight||t===U.ObjectAndLayerIdColor){if(e===z.DRAPED_MATERIAL)return!0;const{drawInSecondSlot:t,occlusionTest:s}=this.parameters;return e===(t?z.LABEL_MATERIAL:z.HUD_MATERIAL)||s&&e===z.OCCLUSION_PIXELS}return!1}createGLMaterial(e){return new ee(e)}calculateRelativeScreenBounds(e,t,s=x()){return te(this.parameters,e,t,s),s[2]=s[0]+e[0],s[3]=s[1]+e[1],s}_getScreenScale(e){const t=e.vertexAttributes.get(B.FEATUREATTRIBUTE);if(null==t)return{scaleX:1,scaleY:1};const s=b(t.data,ge),[r,i]=P(de,this.parameters,s);return{scaleX:r,scaleY:i}}}class ee extends j{constructor(e){super({...e,...e.material.parameters})}selectProgram(e){return this.ensureTechnique(K,e)}beginSlot(e){return this.updateTexture(this._material.parameters.textureId),this._material.setParameters(this.textureBindParameters),this.selectProgram(e)}}function te(e,t,s,r=ae){return a(r,e.anchorPosition),r[0]*=-t[0],r[1]*=-t[1],r[0]+=e.screenOffset[0]*s,r[1]+=e.screenOffset[1]*s,r}function se(e){const t=e[0],s=e[1],r=e[2],i=e[3],a=e[4],n=e[5],o=e[6],c=e[7],l=e[8],f=1/Math.sqrt(t*t+s*s+r*r),u=1/Math.sqrt(i*i+a*a+n*n),p=1/Math.sqrt(o*o+c*c+l*l);return e[0]=t*f,e[1]=s*f,e[2]=r*f,e[3]=i*u,e[4]=a*u,e[5]=n*u,e[6]=o*p,e[7]=c*p,e[8]=l*p,e}function re(e,t,s,r,i,a,n,o){let c=t-i-(o[0]>0?r[0]*o[0]:0),l=c+r[0]+2*i,f=s-i-(o[1]>0?r[1]*o[1]:0),u=f+r[1]+2*i;const p=n.distanceFieldBoundingBox;return n.textureIsSignedDistanceField&&null!=p&&(c+=r[0]*p[0],f+=r[1]*p[1],l-=r[0]*(1-p[2]),u-=r[1]*(1-p[3]),c-=a,l+=a,f-=a,u+=a),e[0]>c&&e[0]<l&&e[1]>f&&e[1]<u}const ie=new H,ae=n(),ne=A(),oe=A(),ce=T(),le=A(),fe=A(),ue=s(),pe=s(),he=i(),me=A(),de=T(),ge=T(),Oe={normal:le,cosAngle:0},Se=1,Ae=2,ve=[0,0],be=v(0,0,1);class Te extends L{constructor(){super(...arguments),this.renderOccluded=M.Occlude,this.isDecoration=!1,this.color=I(1,1,1,1),this.texCoordScale=[1,1],this.polygonOffset=!1,this.anchorPosition=o(.5,.5),this.screenOffset=[0,0],this.shaderPolygonOffset=1e-5,this.textureIsSignedDistanceField=!1,this.sampleSignedDistanceFieldTexelCenter=!1,this.outlineColor=I(1,1,1,1),this.outlineSize=0,this.vvSizeEnabled=!1,this.vvSize=null,this.vvColor=null,this.vvOpacity=null,this.vvSymbolAnchor=null,this.vvSymbolRotationMatrix=null,this.hasSlicePlane=!1,this.pixelSnappingEnabled=!0,this.occlusionTest=!0,this.binaryHighlightOcclusion=!0,this.centerOffsetUnits="world",this.drawInSecondSlot=!1,this.depthEnabled=!0,this.isDraped=!1}}const Ie=R().vec3f(B.POSITION).vec3f(B.NORMAL).vec2f(B.UV0).vec4u8(B.COLOR).vec2f(B.SIZE).vec4f(B.AUXPOS1).vec4f(B.FEATUREATTRIBUTE),_e=Ie.clone().vec4u8(B.OBJECTANDLAYERIDCOLOR);class xe{constructor(e){this._material=e,this.vertexBufferLayout=has("enable-feature:objectAndLayerId-rendering")?_e:Ie}elementCount(e){return 6*e.indices.get(B.POSITION).length}write(e,t,s,r,i){X(s.indices.get(B.POSITION),s.vertexAttributes.get(B.POSITION).data,e,r.position,i,6),k(s.indices.get(B.NORMAL),s.vertexAttributes.get(B.NORMAL).data,t,r.normal,i,6);const a=s.vertexAttributes.get(B.UV0).data;let n,o,c,l;if(null==a||a.length<4){const e=this._material.parameters;n=0,o=0,c=e.texCoordScale[0],l=e.texCoordScale[1]}else n=a[0],o=a[1],c=a[2],l=a[3];c=Math.min(1.99999,c+1),l=Math.min(1.99999,l+1);let f=s.indices.get(B.POSITION).length,u=i;const p=r.uv0;for(let g=0;g<f;++g)p.set(u,0,n),p.set(u,1,o),u+=1,p.set(u,0,c),p.set(u,1,o),u+=1,p.set(u,0,c),p.set(u,1,l),u+=1,p.set(u,0,c),p.set(u,1,l),u+=1,p.set(u,0,n),p.set(u,1,l),u+=1,p.set(u,0,n),p.set(u,1,o),u+=1;G(s.indices.get(B.COLOR),s.vertexAttributes.get(B.COLOR).data,4,r.color,i,6);const h=s.indices.get(B.SIZE),m=s.vertexAttributes.get(B.SIZE).data;f=h.length;const d=r.size;u=i;for(let g=0;g<f;++g){const e=m[2*h[g]],t=m[2*h[g]+1];for(let s=0;s<6;++s)d.set(u,0,e),d.set(u,1,t),u+=1}if(s.indices.get(B.AUXPOS1)&&s.vertexAttributes.get(B.AUXPOS1)?W(s.indices.get(B.AUXPOS1),s.vertexAttributes.get(B.AUXPOS1).data,r.auxpos1,i,6):q(r.auxpos1,i,6*f),s.indices.get(B.FEATUREATTRIBUTE)&&s.vertexAttributes.get(B.FEATUREATTRIBUTE)?W(s.indices.get(B.FEATUREATTRIBUTE),s.vertexAttributes.get(B.FEATUREATTRIBUTE).data,r.featureAttribute,i,6):q(r.featureAttribute,i,6*f),null!=s.objectAndLayerIdColor){if(s.indices.get(B.POSITION)){const e=s.indices.get(B.POSITION).length,t=r.getField(B.OBJECTANDLAYERIDCOLOR,E);Y(s.objectAndLayerIdColor,t,e,i,6)}}}}export{$ as HUDMaterial,Te as Parameters};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{s as t,k as e}from"../../../../chunks/vec2.js";import{a as r}from"../../../../chunks/vec2f64.js";import{newLayout as s}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as i}from"../core/shaderLibrary/ShaderOutput.js";import a from"../lib/GLMaterial.js";import{Material as n}from"../lib/Material.js";import{RenderSlot as o}from"../lib/RenderSlot.js";import{VertexAttribute as u}from"../lib/VertexAttribute.js";import{writePosition as c,writeBufferFloat as l}from"./internal/bufferWriterUtils.js";import{HeatmapDensityPassParameters as f,HeatmapDensityTechniqueConfiguration as m,HeatmapDensityTechnique as T}from"../shaders/HeatmapDensityTechnique.js";const h=2;class p extends f{constructor(){super(...arguments),this.isAttributeDriven=!1,this.usesHalfFloats=!1}}class d extends n{constructor(t){super(t,new p),this._configuration=new m}canRender(t,e){return t===o.DRAPED_MATERIAL&&e===i.Color}getConfiguration(){return this._configuration.isAttributeDriven=this.parameters.isAttributeDriven,this._configuration.usesHalfFloat=this.parameters.usesHalfFloats,this._configuration}createGLMaterial(t){return new A(t)}intersect(){}intersectDraped(r,s,i,a,n,o){const c=r.vertexAttributes.get(u.POSITION),{parameters:l}=this,{searchRadius:f}=l,{screenToWorldRatio:m}=r,T=f*m+h*m,p=T*T,d=c.data.length/c.size;for(let u=0;u<d;u++){const r=u*c.size,s=t(E,c.data[r],c.data[r+1]);e(s,a)<p&&n(o.dist,o.normal,-1,!1)}}createBufferWriter(){return new I(this.parameters.isAttributeDriven?g:b)}}class A extends a{beginSlot(t){return this.ensureTechnique(T,t)}}class I{constructor(t){this.vertexBufferLayout=t}elementCount(t){return t.indices.get(u.POSITION).length*v}write(t,e,r,s,i){c(r.indices.get(u.POSITION),r.vertexAttributes.get(u.POSITION).data,t,s.position,i,v);const a=r.indices.get(u.POSITION).length,n=s.uv0;let o=i;for(let u=0;u<a;++u)n.setValues(o++,-1,-1),n.setValues(o++,1,-1),n.setValues(o++,1,1),n.setValues(o++,1,1),n.setValues(o++,-1,1),n.setValues(o++,-1,-1);const f=u.FEATUREATTRIBUTE in s?s.featureAttribute:null;f&&l(r.indices.get(u.FEATUREATTRIBUTE),r.vertexAttributes.get(u.FEATUREATTRIBUTE).data,f,i,v)}}const b=s().vec3f(u.POSITION).vec2f(u.UV0),g=b.clone().f32(u.FEATUREATTRIBUTE),v=6,E=r();export{d as HeatmapDensityMaterial,p as HeatmapDensityMaterialParameters};
5
+ import{s as t,k as e}from"../../../../chunks/vec2.js";import{a as r}from"../../../../chunks/vec2f64.js";import{newLayout as s}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as i}from"../core/shaderLibrary/ShaderOutput.js";import a from"../lib/GLMaterial.js";import{Material as o}from"../lib/Material.js";import{RenderSlot as n}from"../lib/RenderSlot.js";import{VertexAttribute as u}from"../lib/VertexAttribute.js";import{writePosition as c,writeBufferFloat as l}from"./internal/bufferWriterUtils.js";import{HeatmapDensityPassParameters as f,HeatmapDensityTechniqueConfiguration as m,HeatmapDensityTechnique as T}from"../shaders/HeatmapDensityTechnique.js";const p=2;class h extends f{constructor(){super(...arguments),this.isAttributeDriven=!1,this.usesHalfFloats=!1}}class d extends o{constructor(t){super(t,new h),this._configuration=new m}produces(t,e){return t===n.DRAPED_MATERIAL&&e===i.Color}getConfiguration(){return this._configuration.isAttributeDriven=this.parameters.isAttributeDriven,this._configuration.usesHalfFloat=this.parameters.usesHalfFloats,this._configuration}createGLMaterial(t){return new A(t)}intersect(){}intersectDraped(r,s,i,a,o,n){const c=r.vertexAttributes.get(u.POSITION),{parameters:l}=this,{searchRadius:f}=l,{screenToWorldRatio:m}=r,T=f*m+p*m,h=T*T,d=c.data.length/c.size;for(let u=0;u<d;u++){const r=u*c.size,s=t(E,c.data[r],c.data[r+1]);e(s,a)<h&&o(n.dist,n.normal,-1,!1)}}createBufferWriter(){return new I(this.parameters.isAttributeDriven?g:b)}}class A extends a{beginSlot(t){return this.ensureTechnique(T,t)}}class I{constructor(t){this.vertexBufferLayout=t}elementCount(t){return t.indices.get(u.POSITION).length*v}write(t,e,r,s,i){c(r.indices.get(u.POSITION),r.vertexAttributes.get(u.POSITION).data,t,s.position,i,v);const a=r.indices.get(u.POSITION).length,o=s.uv0;let n=i;for(let u=0;u<a;++u)o.setValues(n++,-1,-1),o.setValues(n++,1,-1),o.setValues(n++,1,1),o.setValues(n++,1,1),o.setValues(n++,-1,1),o.setValues(n++,-1,-1);const f=u.FEATUREATTRIBUTE in s?s.featureAttribute:null;f&&l(r.indices.get(u.FEATUREATTRIBUTE),r.vertexAttributes.get(u.FEATUREATTRIBUTE).data,f,i,v)}}const b=s().vec3f(u.POSITION).vec2f(u.UV0),g=b.clone().f32(u.FEATUREATTRIBUTE),v=6,E=r();export{d as HeatmapDensityMaterial,h as HeatmapDensityMaterialParameters};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{ShaderOutput as e}from"../core/shaderLibrary/ShaderOutput.js";import{CullFaceOptions as t}from"../lib/basicInterfaces.js";import{GLTextureMaterial as r}from"../lib/GLTextureMaterial.js";import{MaterialParameters as a}from"../lib/Material.js";import{OITPolygonOffsetLimit as s}from"../lib/OrderIndependentTransparency.js";import{RenderSlot as i}from"../lib/RenderSlot.js";import{DefaultBufferWriter as n}from"./DefaultBufferWriter.js";import{PositionUVLayout as u}from"./DefaultLayouts.js";import{TriangleMaterial as o}from"./TriangleMaterial.js";import{ImageMaterialTechniqueConfiguration as h,ImageMaterialTechnique as l}from"../shaders/ImageMaterialTechnique.js";class c extends o{constructor(e){super(e,new m),this.supportsEdges=!0,this._configuration=new h}getConfiguration(e,t){return this._configuration.output=e,this._configuration.cullFace=this.parameters.cullFace,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.transparent=this.parameters.transparent,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.hasOccludees=this.parameters.hasOccludees,this._configuration.transparencyPassType=t.transparencyPassType,this._configuration.enableOffset=t.camera.relativeElevation<s,this._configuration.multipassEnabled=t.multipassEnabled,this._configuration.cullAboveGround=t.multipassTerrain.cullAboveGround,this._configuration}canRender(t,r){if(r===e.Color||r===e.Alpha||r===e.Highlight){if(t===i.DRAPED_MATERIAL)return!0;if(r===e.Highlight)return t===i.OPAQUE_MATERIAL;return t===(this.parameters.transparent?this.parameters.writeDepth?i.TRANSPARENT_MATERIAL:i.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL:i.OPAQUE_MATERIAL)}return!1}createGLMaterial(e){return new p(e)}createBufferWriter(){return new n(u)}}class p extends r{constructor(e){super({...e,...e.material.parameters})}_updateParameters(e){return this.updateTexture(this._material.parameters.textureId),this._material.setParameters(this.textureBindParameters),this.ensureTechnique(l,e)}_updateOccludeeState(e){e.hasOccludees!==this._material.parameters.hasOccludees&&(this._material.setParameters({hasOccludees:e.hasOccludees}),this._updateParameters(e))}beginSlot(t){return this._output!==e.Color&&this._output!==e.Alpha||this._updateOccludeeState(t),this._updateParameters(t)}}class m extends a{constructor(){super(...arguments),this.transparent=!1,this.writeDepth=!0,this.hasSlicePlane=!1,this.cullFace=t.None,this.hasOccludees=!1,this.opacity=1,this.textureId=null,this.initTextureTransparent=!0}}export{c as ImageMaterial,m as Parameters};
5
+ import{ShaderOutput as e}from"../core/shaderLibrary/ShaderOutput.js";import{CullFaceOptions as t}from"../lib/basicInterfaces.js";import{GLTextureMaterial as r}from"../lib/GLTextureMaterial.js";import{MaterialParameters as a}from"../lib/Material.js";import{OITPolygonOffsetLimit as s}from"../lib/OrderIndependentTransparency.js";import{RenderSlot as i}from"../lib/RenderSlot.js";import{DefaultBufferWriter as n}from"./DefaultBufferWriter.js";import{PositionUVLayout as u}from"./DefaultLayouts.js";import{TriangleMaterial as o}from"./TriangleMaterial.js";import{ImageMaterialTechniqueConfiguration as h,ImageMaterialTechnique as l}from"../shaders/ImageMaterialTechnique.js";class c extends o{constructor(e){super(e,new m),this.supportsEdges=!0,this._configuration=new h}getConfiguration(e,t){return this._configuration.output=e,this._configuration.cullFace=this.parameters.cullFace,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.transparent=this.parameters.transparent,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.hasOccludees=this.parameters.hasOccludees,this._configuration.transparencyPassType=t.transparencyPassType,this._configuration.enableOffset=t.camera.relativeElevation<s,this._configuration.multipassEnabled=t.multipassEnabled,this._configuration.cullAboveGround=t.multipassTerrain.cullAboveGround,this._configuration}produces(t,r){if(r===e.Color||r===e.Alpha||r===e.Highlight){if(t===i.DRAPED_MATERIAL)return!0;if(r===e.Highlight)return t===i.OPAQUE_MATERIAL;return t===(this.parameters.transparent?this.parameters.writeDepth?i.TRANSPARENT_MATERIAL:i.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL:i.OPAQUE_MATERIAL)}return!1}createGLMaterial(e){return new p(e)}createBufferWriter(){return new n(u)}}class p extends r{constructor(e){super({...e,...e.material.parameters})}_updateParameters(e){return this.updateTexture(this._material.parameters.textureId),this._material.setParameters(this.textureBindParameters),this.ensureTechnique(l,e)}_updateOccludeeState(e){e.hasOccludees!==this._material.parameters.hasOccludees&&(this._material.setParameters({hasOccludees:e.hasOccludees}),this._updateParameters(e))}beginSlot(t){return this._output!==e.Color&&this._output!==e.Alpha||this._updateOccludeeState(t),this._updateParameters(t)}}class m extends a{constructor(){super(...arguments),this.transparent=!1,this.writeDepth=!0,this.hasSlicePlane=!1,this.cullFace=t.None,this.hasOccludees=!1,this.opacity=1,this.textureId=null,this.initTextureTransparent=!0}}export{c as ImageMaterial,m as Parameters};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{f as e}from"../../../../chunks/vec2f32.js";import{newLayout as t}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as r}from"../core/shaderLibrary/ShaderOutput.js";import{HUDSpace as i}from"../core/shaderLibrary/hud/HUD.glsl.js";import s from"../lib/GLMaterial.js";import{Material as n,MaterialParameters as a}from"../lib/Material.js";import{RenderSlot as o}from"../lib/RenderSlot.js";import{VertexAttribute as u}from"../lib/VertexAttribute.js";import{writePosition as c,writeNormal as l,writeBufferVec4 as f}from"./internal/bufferWriterUtils.js";import{LineCalloutTechnique as h}from"../shaders/LineCalloutTechnique.js";import{LineCalloutTechniqueConfiguration as d}from"../shaders/LineCalloutTechniqueConfiguration.js";class m extends n{get uniqueMaterialIdentifier(){return this._uniqueMaterialIdentifier}constructor(e){super(e,new g),this._configuration=new d,this._uniqueMaterialIdentifier=m.uniqueMaterialIdentifier(this.parameters)}getPassParameters(){return this.parameters}getConfiguration(e,t){const r=t?.slot!==o.LINE_CALLOUTS;return this._configuration.occlusionTestEnabled=this.parameters.occlusionTest,this._configuration.hasVerticalOffset=null!=this.parameters.verticalOffset,this._configuration.hasScreenSizePerspective=null!=this.parameters.screenSizePerspective,this._configuration.depthHudEnabled=r,this._configuration.depthHudAlignStartEnabled=!!this.parameters.depthHUDAlignStart,this._configuration.screenCenterOffsetUnitsEnabled="screen"===this.parameters.centerOffsetUnits?i.Screen:i.World,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.multipassEnabled=t.multipassEnabled,this._configuration}intersect(){}canRender(e,t){if(t===r.Color)switch(e){case o.LINE_CALLOUTS:case o.LINE_CALLOUTS_HUD_DEPTH:return!0}return!1}createGLMaterial(e){return new p(e)}createBufferWriter(){return new I}validateParameters(e){const t=m.uniqueMaterialIdentifier(e);t!==this._uniqueMaterialIdentifier&&(this._uniqueMaterialIdentifier=t)}static uniqueMaterialIdentifier(e){return JSON.stringify({horizontalScreenOffset:e.horizontalScreenOffset??0,centerOffsetUnits:e.centerOffsetUnits||"world"})}}class p extends s{beginSlot(e){return this.ensureTechnique(h,e)}}class g extends a{constructor(){super(...arguments),this.horizontalScreenOffset=0,this.color=[0,0,0,1],this.size=1,this.occlusionTest=!1,this.shaderPolygonOffset=1e-5,this.depthHUDAlignStart=!1,this.centerOffsetUnits="world",this.hasSlicePlane=!1}}const O=t().vec3f(u.POSITION).vec3f(u.NORMAL).vec2f(u.UV0).vec4f(u.AUXPOS1),S=[e(0,0),e(1,0),e(0,1),e(1,0),e(1,1),e(0,1)];class I{constructor(){this.vertexBufferLayout=O}elementCount(e){return 6*e.indices.get(u.POSITION).length}write(e,t,r,i,s){c(r.indices.get(u.POSITION),r.vertexAttributes.get(u.POSITION).data,e,i.position,s,6),l(r.indices.get(u.NORMAL),r.vertexAttributes.get(u.NORMAL).data,t,i.normal,s,6),f(r.indices.get(u.AUXPOS1),r.vertexAttributes.get(u.AUXPOS1).data,i.auxpos1,s,6);for(let n=0;n<S.length;++n)i.uv0.setVec(s+n,S[n])}}export{m as LineCalloutMaterial,g as Parameters};
5
+ import{f as e}from"../../../../chunks/vec2f32.js";import{newLayout as t}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as r}from"../core/shaderLibrary/ShaderOutput.js";import{HUDSpace as i}from"../core/shaderLibrary/hud/HUD.glsl.js";import s from"../lib/GLMaterial.js";import{Material as n,MaterialParameters as a}from"../lib/Material.js";import{RenderSlot as o}from"../lib/RenderSlot.js";import{VertexAttribute as u}from"../lib/VertexAttribute.js";import{writePosition as c,writeNormal as l,writeBufferVec4 as f}from"./internal/bufferWriterUtils.js";import{LineCalloutTechnique as h}from"../shaders/LineCalloutTechnique.js";import{LineCalloutTechniqueConfiguration as d}from"../shaders/LineCalloutTechniqueConfiguration.js";class m extends n{get uniqueMaterialIdentifier(){return this._uniqueMaterialIdentifier}constructor(e){super(e,new g),this._configuration=new d,this._uniqueMaterialIdentifier=m.uniqueMaterialIdentifier(this.parameters)}getPassParameters(){return this.parameters}getConfiguration(e,t){const r=t?.slot!==o.LINE_CALLOUTS;return this._configuration.occlusionTestEnabled=this.parameters.occlusionTest,this._configuration.hasVerticalOffset=null!=this.parameters.verticalOffset,this._configuration.hasScreenSizePerspective=null!=this.parameters.screenSizePerspective,this._configuration.depthHudEnabled=r,this._configuration.depthHudAlignStartEnabled=!!this.parameters.depthHUDAlignStart,this._configuration.screenCenterOffsetUnitsEnabled="screen"===this.parameters.centerOffsetUnits?i.Screen:i.World,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.multipassEnabled=t.multipassEnabled,this._configuration}intersect(){}produces(e,t){if(t===r.Color)switch(e){case o.LINE_CALLOUTS:case o.LINE_CALLOUTS_HUD_DEPTH:return!0}return!1}createGLMaterial(e){return new p(e)}createBufferWriter(){return new I}validateParameters(e){const t=m.uniqueMaterialIdentifier(e);t!==this._uniqueMaterialIdentifier&&(this._uniqueMaterialIdentifier=t)}static uniqueMaterialIdentifier(e){return JSON.stringify({horizontalScreenOffset:e.horizontalScreenOffset??0,centerOffsetUnits:e.centerOffsetUnits||"world"})}}class p extends s{beginSlot(e){return this.ensureTechnique(h,e)}}class g extends a{constructor(){super(...arguments),this.horizontalScreenOffset=0,this.color=[0,0,0,1],this.size=1,this.occlusionTest=!1,this.shaderPolygonOffset=1e-5,this.depthHUDAlignStart=!1,this.centerOffsetUnits="world",this.hasSlicePlane=!1}}const O=t().vec3f(u.POSITION).vec3f(u.NORMAL).vec2f(u.UV0).vec4f(u.AUXPOS1),S=[e(0,0),e(1,0),e(0,1),e(1,0),e(1,1),e(0,1)];class I{constructor(){this.vertexBufferLayout=O}elementCount(e){return 6*e.indices.get(u.POSITION).length}write(e,t,r,i,s){c(r.indices.get(u.POSITION),r.vertexAttributes.get(u.POSITION).data,e,i.position,s,6),l(r.indices.get(u.NORMAL),r.vertexAttributes.get(u.NORMAL).data,t,i.normal,s,6),f(r.indices.get(u.AUXPOS1),r.vertexAttributes.get(u.AUXPOS1).data,i.auxpos1,s,6);for(let n=0;n<S.length;++n)i.uv0.setVec(s+n,S[n])}}export{m as LineCalloutMaterial,g as Parameters};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{s as e,G as t,m as r}from"../../../../chunks/vec3.js";import{c as i}from"../../../../chunks/vec3f64.js";import{newLayout as s}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as a}from"../core/shaderLibrary/ShaderOutput.js";import{GLTextureMaterial as n}from"../lib/GLTextureMaterial.js";import{Material as o,RenderOccludedFlag as h}from"../lib/Material.js";import{RenderSlot as c}from"../lib/RenderSlot.js";import{VertexAttribute as u}from"../lib/VertexAttribute.js";import{VisualVariablePassParameters as p}from"./VisualVariablePassParameters.js";import{vertexAttributeLocations as m,LineMarkerTechnique as l}from"../shaders/LineMarkerTechnique.js";import{LineMarkerTechniqueConfiguration as d,LineMarkerSpace as A,LineMarkerAnchor as T}from"../shaders/LineMarkerTechniqueConfiguration.js";import{CapType as _}from"../shaders/RibbonLineTechniqueConfiguration.js";class v extends o{constructor(e){super(e,new E),this._vertexAttributeLocations=m,this._configuration=new d,this._layout=this.createLayout()}getConfiguration(e,t){return this._configuration.output=e,this._configuration.space=t.slot===c.DRAPED_MATERIAL?A.Draped:this.parameters.worldSpace?A.World:A.Screen,this._configuration.hideOnShortSegments=this.parameters.hideOnShortSegments,this._configuration.hasCap=this.parameters.cap!==_.BUTT,this._configuration.anchor=this.parameters.anchor,this._configuration.hasTip=this.parameters.hasTip,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasOccludees=this.parameters.hasOccludees,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.vvSize=!!this.parameters.vvSize,this._configuration.vvColor=!!this.parameters.vvColor,this._configuration.vvOpacity=!!this.parameters.vvOpacity,this._configuration.occluder=this.parameters.renderOccluded===h.OccludeAndTransparentStencil,this._configuration.transparencyPassType=t.transparencyPassType,this._configuration.multipassEnabled=t.multipassEnabled,this._configuration.cullAboveGround=t.multipassTerrain.cullAboveGround,this._configuration}intersect(){}createLayout(){const e=s().vec3f(u.POSITION).vec2f(u.UV0).vec3f(u.AUXPOS1);return this.parameters.worldSpace&&e.vec3f(u.NORMAL),this.parameters.vvSize?e.f32(u.SIZEFEATUREATTRIBUTE):e.f32(u.SIZE),this.parameters.vvColor?e.f32(u.COLORFEATUREATTRIBUTE):e.vec4f(u.COLOR),this.parameters.vvOpacity&&e.f32(u.OPACITYFEATUREATTRIBUTE),e}createBufferWriter(){return new O(this._layout,this.parameters)}canRender(e,t){if(t===a.Color||t===a.Alpha||t===a.Highlight||t===a.Depth){if(e===c.DRAPED_MATERIAL)return!0;if(this.parameters.renderOccluded===h.OccludeAndTransparentStencil)return e===c.OPAQUE_MATERIAL||e===c.OCCLUDER_MATERIAL||e===c.TRANSPARENT_OCCLUDER_MATERIAL;if(t===a.Color||t===a.Alpha){return e===(this.parameters.writeDepth?c.TRANSPARENT_MATERIAL:c.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL)}return e===c.OPAQUE_MATERIAL}return!1}createGLMaterial(e){return new f(e)}}class f extends n{constructor(){super(...arguments),this._markerPrimitive=null}dispose(){super.dispose(),this._markerTextureRepository.release(this._markerPrimitive),this._markerPrimitive=null}_updateParameters(e){const t=this._material.parameters.markerPrimitive;return t!==this._markerPrimitive&&(this._material.setParameters({markerTexture:this._markerTextureRepository.swap(t,this._markerPrimitive)}),this._markerPrimitive=t),this._material.setParameters(this.textureBindParameters),this.ensureTechnique(l,e)}_updateOccludeeState(e){e.hasOccludees!==this._material.parameters.hasOccludees&&this._material.setParameters({hasOccludees:e.hasOccludees})}beginSlot(e){return this._output!==a.Color&&this._output!==a.Alpha||this._updateOccludeeState(e),this._updateParameters(e)}}class E extends p{constructor(){super(...arguments),this.width=0,this.color=[1,1,1,1],this.markerPrimitive="arrow",this.placement="end",this.cap=_.BUTT,this.anchor=T.Center,this.hasTip=!1,this.worldSpace=!1,this.hideOnShortSegments=!1,this.writeDepth=!0,this.hasSlicePlane=!1,this.vvFastUpdate=!1,this.hasOccludees=!1,this.markerTexture=null}}class O{constructor(e,t){this.vertexBufferLayout=e,this._parameters=t}elementCount(){return"begin-end"===this._parameters.placement?12:6}write(i,s,a,n,o){const h=a.vertexAttributes.get(u.POSITION).data,c=h.length/3;let p=[1,0,0];const m=a.vertexAttributes.get(u.NORMAL);this._parameters.worldSpace&&null!=m&&(p=m.data);let l=1,d=0;this._parameters.vvSize?d=a.vertexAttributes.get(u.SIZEFEATUREATTRIBUTE).data[0]:a.vertexAttributes.has(u.SIZE)&&(l=a.vertexAttributes.get(u.SIZE).data[0]);let A=[1,1,1,1],T=0;this._parameters.vvColor?T=a.vertexAttributes.get(u.COLORFEATUREATTRIBUTE).data[0]:a.vertexAttributes.has(u.COLOR)&&(A=a.vertexAttributes.get(u.COLOR).data);let _=0;this._parameters.vvOpacity&&(_=a.vertexAttributes.get(u.OPACITYFEATUREATTRIBUTE).data[0]);const v=new Float32Array(n.buffer);let f=o*(this.vertexBufferLayout.stride/4);const E=(e,t,r,i)=>{if(v[f++]=e[0],v[f++]=e[1],v[f++]=e[2],v[f++]=r[0],v[f++]=r[1],v[f++]=t[0],v[f++]=t[1],v[f++]=t[2],this._parameters.worldSpace&&(v[f++]=p[0],v[f++]=p[1],v[f++]=p[2]),this._parameters.vvSize?v[f++]=d:v[f++]=l,this._parameters.vvColor)v[f++]=T;else{const e=Math.min(4*i,A.length-4);v[f++]=A[e],v[f++]=A[e+1],v[f++]=A[e+2],v[f++]=A[e+3]}this._parameters.vvOpacity&&(v[f++]=_)};let O;!function(e){e[e.ASCENDING=1]="ASCENDING",e[e.DESCENDING=-1]="DESCENDING"}(O||(O={}));const g=(s,a)=>{const n=e(S,h[3*s],h[3*s+1],h[3*s+2]),o=R;let u=s+a;do{e(o,h[3*u],h[3*u+1],h[3*u+2]),u+=a}while(t(n,o)&&u>=0&&u<c);i&&(r(n,n,i),r(o,o,i)),E(n,o,[-1,-1],s),E(n,o,[1,-1],s),E(n,o,[1,1],s),E(n,o,[-1,-1],s),E(n,o,[1,1],s),E(n,o,[-1,1],s)},I=this._parameters.placement;"begin"!==I&&"begin-end"!==I||g(0,O.ASCENDING),"end"!==I&&"begin-end"!==I||g(c-1,O.DESCENDING)}}const S=i(),R=i();export{v as LineMarkerMaterial,E as Parameters};
5
+ import{s as e,G as t,m as r}from"../../../../chunks/vec3.js";import{c as i}from"../../../../chunks/vec3f64.js";import{newLayout as s}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as a}from"../core/shaderLibrary/ShaderOutput.js";import{GLTextureMaterial as o}from"../lib/GLTextureMaterial.js";import{Material as n,RenderOccludedFlag as h}from"../lib/Material.js";import{RenderSlot as c}from"../lib/RenderSlot.js";import{VertexAttribute as u}from"../lib/VertexAttribute.js";import{VisualVariablePassParameters as p}from"./VisualVariablePassParameters.js";import{vertexAttributeLocations as m,LineMarkerTechnique as l}from"../shaders/LineMarkerTechnique.js";import{LineMarkerTechniqueConfiguration as d,LineMarkerSpace as A,LineMarkerAnchor as T}from"../shaders/LineMarkerTechniqueConfiguration.js";import{CapType as _}from"../shaders/RibbonLineTechniqueConfiguration.js";class v extends n{constructor(e){super(e,new E),this._vertexAttributeLocations=m,this._configuration=new d,this._layout=this.createLayout()}getConfiguration(e,t){return this._configuration.output=e,this._configuration.space=t.slot===c.DRAPED_MATERIAL?A.Draped:this.parameters.worldSpace?A.World:A.Screen,this._configuration.hideOnShortSegments=this.parameters.hideOnShortSegments,this._configuration.hasCap=this.parameters.cap!==_.BUTT,this._configuration.anchor=this.parameters.anchor,this._configuration.hasTip=this.parameters.hasTip,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasOccludees=this.parameters.hasOccludees,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.vvSize=!!this.parameters.vvSize,this._configuration.vvColor=!!this.parameters.vvColor,this._configuration.vvOpacity=!!this.parameters.vvOpacity,this._configuration.occluder=this.parameters.renderOccluded===h.OccludeAndTransparentStencil,this._configuration.transparencyPassType=t.transparencyPassType,this._configuration.multipassEnabled=t.multipassEnabled,this._configuration.cullAboveGround=t.multipassTerrain.cullAboveGround,this._configuration}intersect(){}createLayout(){const e=s().vec3f(u.POSITION).vec2f(u.UV0).vec3f(u.AUXPOS1);return this.parameters.worldSpace&&e.vec3f(u.NORMAL),this.parameters.vvSize?e.f32(u.SIZEFEATUREATTRIBUTE):e.f32(u.SIZE),this.parameters.vvColor?e.f32(u.COLORFEATUREATTRIBUTE):e.vec4f(u.COLOR),this.parameters.vvOpacity&&e.f32(u.OPACITYFEATUREATTRIBUTE),e}createBufferWriter(){return new O(this._layout,this.parameters)}produces(e,t){if(t===a.Color||t===a.Alpha||t===a.Highlight||t===a.Depth){if(e===c.DRAPED_MATERIAL)return!0;if(this.parameters.renderOccluded===h.OccludeAndTransparentStencil)return e===c.OPAQUE_MATERIAL||e===c.OCCLUDER_MATERIAL||e===c.TRANSPARENT_OCCLUDER_MATERIAL;if(t===a.Color||t===a.Alpha){return e===(this.parameters.writeDepth?c.TRANSPARENT_MATERIAL:c.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL)}return e===c.OPAQUE_MATERIAL}return!1}createGLMaterial(e){return new f(e)}}class f extends o{constructor(){super(...arguments),this._markerPrimitive=null}dispose(){super.dispose(),this._markerTextureRepository.release(this._markerPrimitive),this._markerPrimitive=null}_updateParameters(e){const t=this._material.parameters.markerPrimitive;return t!==this._markerPrimitive&&(this._material.setParameters({markerTexture:this._markerTextureRepository.swap(t,this._markerPrimitive)}),this._markerPrimitive=t),this._material.setParameters(this.textureBindParameters),this.ensureTechnique(l,e)}_updateOccludeeState(e){e.hasOccludees!==this._material.parameters.hasOccludees&&this._material.setParameters({hasOccludees:e.hasOccludees})}beginSlot(e){return this._output!==a.Color&&this._output!==a.Alpha||this._updateOccludeeState(e),this._updateParameters(e)}}class E extends p{constructor(){super(...arguments),this.width=0,this.color=[1,1,1,1],this.markerPrimitive="arrow",this.placement="end",this.cap=_.BUTT,this.anchor=T.Center,this.hasTip=!1,this.worldSpace=!1,this.hideOnShortSegments=!1,this.writeDepth=!0,this.hasSlicePlane=!1,this.vvFastUpdate=!1,this.hasOccludees=!1,this.markerTexture=null}}class O{constructor(e,t){this.vertexBufferLayout=e,this._parameters=t}elementCount(){return"begin-end"===this._parameters.placement?12:6}write(i,s,a,o,n){const h=a.vertexAttributes.get(u.POSITION).data,c=h.length/3;let p=[1,0,0];const m=a.vertexAttributes.get(u.NORMAL);this._parameters.worldSpace&&null!=m&&(p=m.data);let l=1,d=0;this._parameters.vvSize?d=a.vertexAttributes.get(u.SIZEFEATUREATTRIBUTE).data[0]:a.vertexAttributes.has(u.SIZE)&&(l=a.vertexAttributes.get(u.SIZE).data[0]);let A=[1,1,1,1],T=0;this._parameters.vvColor?T=a.vertexAttributes.get(u.COLORFEATUREATTRIBUTE).data[0]:a.vertexAttributes.has(u.COLOR)&&(A=a.vertexAttributes.get(u.COLOR).data);let _=0;this._parameters.vvOpacity&&(_=a.vertexAttributes.get(u.OPACITYFEATUREATTRIBUTE).data[0]);const v=new Float32Array(o.buffer);let f=n*(this.vertexBufferLayout.stride/4);const E=(e,t,r,i)=>{if(v[f++]=e[0],v[f++]=e[1],v[f++]=e[2],v[f++]=r[0],v[f++]=r[1],v[f++]=t[0],v[f++]=t[1],v[f++]=t[2],this._parameters.worldSpace&&(v[f++]=p[0],v[f++]=p[1],v[f++]=p[2]),this._parameters.vvSize?v[f++]=d:v[f++]=l,this._parameters.vvColor)v[f++]=T;else{const e=Math.min(4*i,A.length-4);v[f++]=A[e],v[f++]=A[e+1],v[f++]=A[e+2],v[f++]=A[e+3]}this._parameters.vvOpacity&&(v[f++]=_)};let O;!function(e){e[e.ASCENDING=1]="ASCENDING",e[e.DESCENDING=-1]="DESCENDING"}(O||(O={}));const g=(s,a)=>{const o=e(S,h[3*s],h[3*s+1],h[3*s+2]),n=R;let u=s+a;do{e(n,h[3*u],h[3*u+1],h[3*u+2]),u+=a}while(t(o,n)&&u>=0&&u<c);i&&(r(o,o,i),r(n,n,i)),E(o,n,[-1,-1],s),E(o,n,[1,-1],s),E(o,n,[1,1],s),E(o,n,[-1,-1],s),E(o,n,[1,1],s),E(o,n,[-1,1],s)},I=this._parameters.placement;"begin"!==I&&"begin-end"!==I||g(0,O.ASCENDING),"end"!==I&&"begin-end"!==I||g(c-1,O.DESCENDING)}}const S=i(),R=i();export{v as LineMarkerMaterial,E as Parameters};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{s as t,n as e,g as r,c as s,h as o,m as n}from"../../../../chunks/vec3.js";import{c as i}from"../../../../chunks/vec3f64.js";import{f as a}from"../../../../chunks/vec4f64.js";import{newLayout as c}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as u}from"../core/shaderLibrary/ShaderOutput.js";import f from"../lib/GLMaterial.js";import{Material as l,MaterialParameters as p}from"../lib/Material.js";import{RenderSlot as h}from"../lib/RenderSlot.js";import{VertexAttribute as m}from"../lib/VertexAttribute.js";import{MeasurementArrowTechniqueConfiguration as d,MeasurementArrowTechnique as g}from"../shaders/MeasurementArrowTechnique.js";class O extends l{constructor(t){super(t,new T),this._configuration=new d}getConfiguration(t,e){return this._configuration.polygonOffsetEnabled=this.parameters.polygonOffset,this._configuration.transparent=this._transparent,this._configuration.transparencyPassType=e.transparencyPassType,this._configuration}intersect(){}canRender(t,e){if(e===u.Color||e===u.Alpha){return t===(this._transparent?h.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL:h.OPAQUE_MATERIAL)}return!1}createGLMaterial(t){return new A(t)}createBufferWriter(){return new j}get _transparent(){const{parameters:t}=this;return t.outlineColor[3]<1||t.stripeEvenColor[3]<1||t.stripeOddColor[3]<1}}class A extends f{beginSlot(t){return this.ensureTechnique(g,t)}}class T extends p{constructor(){super(...arguments),this.width=32,this.outlineSize=.2,this.outlineColor=a(1,.5,0,1),this.stripeEvenColor=a(1,1,1,1),this.stripeOddColor=a(1,.5,0,1),this.stripeLength=1,this.polygonOffset=!1}}const v=c().vec3f(m.POSITION).vec3f(m.NORMAL).vec2f(m.UV0).f32(m.AUXPOS1),I=i(),_=i(),b=i(),L=i(),S=i();class j{constructor(){this.vertexBufferLayout=v}elementCount(t){return 2*(t.indices.get(m.POSITION).length/2+1)}write(i,a,c,u,f){const l=c.vertexAttributes.get(m.POSITION).data,p=c.vertexAttributes.get(m.NORMAL).data,h=l.length/3,d=c&&c.indices&&c.indices.get(m.POSITION);d&&d.length!==2*(h-1)&&console.warn("MeasurementArrowMaterial does not support indices");const g=I,O=_,A=b,T=L,v=S,j=u.position,y=u.normal,E=u.uv0;let M=0;for(let m=0;m<h;++m){const c=3*m;if(t(g,l[c],l[c+1],l[c+2]),m<h-1){const o=3*(m+1);t(O,l[o],l[o+1],l[o+2]),t(v,p[o],p[o+1],p[o+2]),e(v,v),r(A,O,g),e(A,A),s(T,v,A),e(T,T)}const u=o(g,O);i&&a&&(n(g,g,i),n(O,O,i),n(T,T,a));const d=f+2*m,I=d+1;j.setVec(d,g),j.setVec(I,g),y.setVec(d,T),y.setVec(I,T),E.set(d,0,M),E.set(d,1,-1),E.set(I,0,M),E.set(I,1,1),m<h-1&&(M+=u)}const P=u.auxpos1;for(let t=0;t<2*h;++t)P.set(f+t,M)}}export{O as MeasurementArrowMaterial,T as Parameters};
5
+ import{s as t,n as e,g as r,c as s,h as o,m as n}from"../../../../chunks/vec3.js";import{c as i}from"../../../../chunks/vec3f64.js";import{f as a}from"../../../../chunks/vec4f64.js";import{newLayout as c}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as u}from"../core/shaderLibrary/ShaderOutput.js";import p from"../lib/GLMaterial.js";import{Material as f,MaterialParameters as l}from"../lib/Material.js";import{RenderSlot as h}from"../lib/RenderSlot.js";import{VertexAttribute as m}from"../lib/VertexAttribute.js";import{MeasurementArrowTechniqueConfiguration as d,MeasurementArrowTechnique as g}from"../shaders/MeasurementArrowTechnique.js";class O extends f{constructor(t){super(t,new T),this._configuration=new d}getConfiguration(t,e){return this._configuration.polygonOffsetEnabled=this.parameters.polygonOffset,this._configuration.transparent=this._transparent,this._configuration.transparencyPassType=e.transparencyPassType,this._configuration}intersect(){}produces(t,e){if(e===u.Color||e===u.Alpha){return t===(this._transparent?h.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL:h.OPAQUE_MATERIAL)}return!1}createGLMaterial(t){return new A(t)}createBufferWriter(){return new j}get _transparent(){const{parameters:t}=this;return t.outlineColor[3]<1||t.stripeEvenColor[3]<1||t.stripeOddColor[3]<1}}class A extends p{beginSlot(t){return this.ensureTechnique(g,t)}}class T extends l{constructor(){super(...arguments),this.width=32,this.outlineSize=.2,this.outlineColor=a(1,.5,0,1),this.stripeEvenColor=a(1,1,1,1),this.stripeOddColor=a(1,.5,0,1),this.stripeLength=1,this.polygonOffset=!1}}const v=c().vec3f(m.POSITION).vec3f(m.NORMAL).vec2f(m.UV0).f32(m.AUXPOS1),I=i(),_=i(),b=i(),L=i(),S=i();class j{constructor(){this.vertexBufferLayout=v}elementCount(t){return 2*(t.indices.get(m.POSITION).length/2+1)}write(i,a,c,u,p){const f=c.vertexAttributes.get(m.POSITION).data,l=c.vertexAttributes.get(m.NORMAL).data,h=f.length/3,d=c&&c.indices&&c.indices.get(m.POSITION);d&&d.length!==2*(h-1)&&console.warn("MeasurementArrowMaterial does not support indices");const g=I,O=_,A=b,T=L,v=S,j=u.position,y=u.normal,E=u.uv0;let M=0;for(let m=0;m<h;++m){const c=3*m;if(t(g,f[c],f[c+1],f[c+2]),m<h-1){const o=3*(m+1);t(O,f[o],f[o+1],f[o+2]),t(v,l[o],l[o+1],l[o+2]),e(v,v),r(A,O,g),e(A,A),s(T,v,A),e(T,T)}const u=o(g,O);i&&a&&(n(g,g,i),n(O,O,i),n(T,T,a));const d=p+2*m,I=d+1;j.setVec(d,g),j.setVec(I,g),y.setVec(d,T),y.setVec(I,T),E.set(d,0,M),E.set(d,1,-1),E.set(I,0,M),E.set(I,1,1),m<h-1&&(M+=u)}const P=u.auxpos1;for(let t=0;t<2*h;++t)P.set(p+t,M)}}export{O as MeasurementArrowMaterial,T as Parameters};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../core/Logger.js";import{clamp as t}from"../../../../core/mathUtils.js";import{createRenderScreenPointArray3 as r}from"../../../../core/screenUtils.js";import{j as s}from"../../../../chunks/vec2.js";import{s as i,g as o,d as n,b as a,e as l,i as c,l as u,h as p,m as f}from"../../../../chunks/vec3.js";import{c as h}from"../../../../chunks/vec3f64.js";import{O as m}from"../../../../chunks/vec4f64.js";import{PlaneIndex as d}from"../../../../geometry/support/frustum.js";import{create as g,distance2 as A,fromPoints as _,closestLineSegmentPoint as O}from"../../../../geometry/support/lineSegment.js";import{create as T,fromPoints as S,signedDistance as P,normal as j}from"../../../../geometry/support/plane.js";import{BufferViewVec3f as b,BufferViewVec2f as x}from"../../../../geometry/support/buffer/BufferView.js";import{ShaderOutput as R}from"../core/shaderLibrary/ShaderOutput.js";import y from"../lib/GLMaterial.js";import{Material as v,MaterialParameters as E}from"../lib/Material.js";import{RenderSlot as N}from"../lib/RenderSlot.js";import{isTranslationMatrix as I}from"../lib/Util.js";import{VertexAttribute as L}from"../lib/VertexAttribute.js";import{DefaultBufferWriter as w}from"./DefaultBufferWriter.js";import{PositionColorLayout as C,PositionLayout as U}from"./DefaultLayouts.js";import{writeDefaultAttributes as V}from"./internal/bufferWriterUtils.js";import{NativeLineTechnique as M}from"../shaders/NativeLineTechnique.js";import{NativeLineTechniqueConfiguration as D}from"../shaders/NativeLineTechniqueConfiguration.js";var B;!function(e){e[e.START=0]="START",e[e.END=1]="END"}(B||(B={}));class X extends v{constructor(e){super(e,new q),this._configuration=new D}getConfiguration(e,t){this._configuration.output=e,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasVertexColors=this.parameters.hasVertexColors,this._configuration.transparent=this.parameters.color[3]<1||this.parameters.width<1,this._configuration.draped=t.slot===N.DRAPED_MATERIAL;const r=null!=this.parameters.stipplePattern;return this._configuration.stippleEnabled=r,this._configuration.stippleOffColorEnabled=r&&null!=this.parameters.stippleOffColor,this._configuration.hasOccludees=this.parameters.hasOccludees,this._configuration.stipplePreferContinuous=this.parameters.stipplePreferContinuous,this._configuration}intersect(t,r,f,h,m,g){if(!f.options.selectionMode||!t.visible)return;if(!I(r))return void e.getLogger("esri.views.3d.webgl-engine.materials.NativeLineMaterial").error("intersection assumes a translation-only matrix");const T=t.vertexAttributes.get(L.POSITION).data,b=f.camera,x=ee;s(x,f.point);const R=2;i(te[0],x[0]-R,x[1]+R,0),i(te[1],x[0]+R,x[1]+R,0),i(te[2],x[0]+R,x[1]-R,0),i(te[3],x[0]-R,x[1]-R,0);for(let e=0;e<4;e++)if(!b.unprojectFromRenderScreen(te[e],re[e]))return;S(b.eye,re[0],re[1],se),S(b.eye,re[1],re[2],ie),S(b.eye,re[2],re[3],oe),S(b.eye,re[3],re[0],ne);let y=Number.MAX_VALUE,v=0;for(let e=0;e<T.length-5;e+=3){if(F[0]=T[e]+r[12],F[1]=T[e+1]+r[13],F[2]=T[e+2]+r[14],G[0]=T[e+3]+r[12],G[1]=T[e+4]+r[13],G[2]=T[e+5]+r[14],P(se,F)<0&&P(se,G)<0||P(ie,F)<0&&P(ie,G)<0||P(oe,F)<0&&P(oe,G)<0||P(ne,F)<0&&P(ne,G)<0)continue;if(b.projectToRenderScreen(F,Z),b.projectToRenderScreen(G,z),Z[2]<0&&z[2]>0){o(H,F,G);const e=b.frustum,t=-P(e[d.NEAR],F)/n(H,j(e[d.NEAR]));a(H,H,t),l(F,F,H),b.projectToRenderScreen(F,Z)}else if(Z[2]>0&&z[2]<0){o(H,G,F);const e=b.frustum,t=-P(e[d.NEAR],G)/n(H,j(e[d.NEAR]));a(H,H,t),l(G,G,H),b.projectToRenderScreen(G,z)}else if(Z[2]<0&&z[2]<0)continue;Z[2]=0,z[2]=0;const t=A(_(Z,z,Y),x);t<y&&(y=t,c(J,F),c(K,G),v=e/3)}const E=f.rayBegin,N=f.rayEnd;if(y<R*R){let e=Number.MAX_VALUE;if(O(_(J,K,Y),_(E,N,$),Q)){o(Q,Q,E);const t=u(Q);a(Q,Q,1/t),e=t/p(E,N)}g(e,Q,v,!1)}}intersectDraped(e,r,s,i,o,n){if(!s.options.selectionMode)return;const a=e.vertexAttributes.get(L.POSITION).data,l=e.vertexAttributes.get(L.SIZE),c=l?l.data[0]:0,u=i[0],p=i[1],f=((c+1)/2+4)*e.screenToWorldRatio;let h=Number.MAX_VALUE,m=0;for(let d=0;d<a.length-5;d+=3){const e=a[d],r=a[d+1],s=u-e,i=p-r,o=a[d+3]-e,n=a[d+4]-r,l=t((o*s+n*i)/(o*o+n*n),0,1),c=o*l-s,f=n*l-i,g=c*c+f*f;g<h&&(h=g,m=d/3)}h<f*f&&o(n.dist,n.normal,m,!1)}canRender(e,t){return!(t!==R.Color&&t!==R.Highlight&&t!==R.ObjectAndLayerIdColor||e!==N.OPAQUE_MATERIAL&&e!==N.DRAPED_MATERIAL)}createGLMaterial(e){return new k(e)}createBufferWriter(){const e=this.parameters.hasVertexColors?C:U;return null==this.parameters.stipplePattern?new w(e):new W(e.clone().vec3f(L.AUXPOS1).vec2f(L.UV0))}}class k extends y{constructor(){super(...arguments),this._stipplePattern=null}dispose(){super.dispose(),this._stippleTextureRepository.release(this._stipplePattern),this._stipplePattern=null}_updateOccludeeState(e){e.hasOccludees!==this._material.parameters.hasOccludees&&this._material.setParameters({hasOccludees:e.hasOccludees})}beginSlot(e){this._output===R.Color&&this._updateOccludeeState(e);const t=this._material.parameters.stipplePattern;return this._stipplePattern!==t&&(this._material.setParameters({stippleTexture:this._stippleTextureRepository.swap(t,this._stipplePattern)}),this._stipplePattern=t),this.ensureTechnique(M,e)}}class W{constructor(e){this.vertexBufferLayout=e}elementCount(e){return e.indices.get(L.POSITION).length}write(e,t,r,s,i){V(r,this.vertexBufferLayout,e,t,s,i),this._writeAuxpos1(e,r,s,i),this._writeUV0(e,r,s,i)}_writeAuxpos1(e,t,r,s){const i=r.getField(L.AUXPOS1,b),o=t.indices.get(L.POSITION),n=t.vertexAttributes.get(L.POSITION).data,a=e,l=i.typedBufferStride,c=i.typedBuffer;s*=l;for(let u=0;u<o.length-1;u+=2)for(const e of[1,0]){const t=3*o[u+e],r=n[t],i=n[t+1],p=n[t+2],f=a[0]*r+a[4]*i+a[8]*p+a[12],h=a[1]*r+a[5]*i+a[9]*p+a[13],m=a[2]*r+a[6]*i+a[10]*p+a[14];c[s]=f,c[s+1]=h,c[s+2]=m,s+=l}}_writeUV0(e,t,r,s){const o=r.getField(L.UV0,x),n=t.indices.get(L.POSITION),a=t.vertexAttributes.get(L.POSITION).data,l=t.vertexAttributes.get(L.DISTANCETOSTART)?.data,u=o.typedBufferStride,h=o.typedBuffer;let m=0;h[s*=u]=B.START,h[s+1]=m,s+=u;const d=3*n[0],g=i(F,a[d],a[d+1],a[d+2]);e&&f(g,g,e);const A=G,_=n.length-1;let O=1;const T=l?(e,t,r)=>m=l[r]:(e,t,r)=>m+=p(e,t);for(let p=1;p<_;p+=2){const t=3*n[p];i(A,a[t],a[t+1],a[t+2]),e&&f(A,A,e),T(g,A,O++);for(let e=0;e<2;++e)h[s]=1-e,h[s+1]=m,s+=u;c(g,A)}const S=3*n[_];i(A,a[S],a[S+1],a[S+2]),e&&f(A,A,e),T(g,A,O),h[s]=B.END,h[s+1]=m}}class q extends E{constructor(){super(...arguments),this.color=m,this.hasVertexColors=!1,this.hasSlicePlane=!1,this.width=1,this.stipplePreferContinuous=!0,this.hasOccludees=!1,this.stippleTexture=null}}const F=h(),G=h(),H=h(),Q=h(),Z=r(),z=r(),J=h(),K=h(),Y=g(),$=g(),ee=h(),te=[r(),r(),r(),r()],re=[h(),h(),h(),h()],se=T(),ie=T(),oe=T(),ne=T();export{X as NativeLineMaterial,q as Parameters};
5
+ import e from"../../../../core/Logger.js";import{clamp as t}from"../../../../core/mathUtils.js";import{createRenderScreenPointArray3 as r}from"../../../../core/screenUtils.js";import{j as s}from"../../../../chunks/vec2.js";import{s as i,g as o,d as n,b as a,e as l,i as u,l as c,h as p,m as f}from"../../../../chunks/vec3.js";import{c as h}from"../../../../chunks/vec3f64.js";import{O as m}from"../../../../chunks/vec4f64.js";import{PlaneIndex as d}from"../../../../geometry/support/frustum.js";import{create as g,distance2 as A,fromPoints as _,closestLineSegmentPoint as O}from"../../../../geometry/support/lineSegment.js";import{create as T,fromPoints as S,signedDistance as P,normal as j}from"../../../../geometry/support/plane.js";import{BufferViewVec3f as b,BufferViewVec2f as x}from"../../../../geometry/support/buffer/BufferView.js";import{ShaderOutput as y}from"../core/shaderLibrary/ShaderOutput.js";import R from"../lib/GLMaterial.js";import{Material as v,MaterialParameters as E}from"../lib/Material.js";import{RenderSlot as N}from"../lib/RenderSlot.js";import{isTranslationMatrix as I}from"../lib/Util.js";import{VertexAttribute as L}from"../lib/VertexAttribute.js";import{DefaultBufferWriter as w}from"./DefaultBufferWriter.js";import{PositionColorLayout as C,PositionLayout as U}from"./DefaultLayouts.js";import{writeDefaultAttributes as V}from"./internal/bufferWriterUtils.js";import{NativeLineTechnique as M}from"../shaders/NativeLineTechnique.js";import{NativeLineTechniqueConfiguration as D}from"../shaders/NativeLineTechniqueConfiguration.js";var B;!function(e){e[e.START=0]="START",e[e.END=1]="END"}(B||(B={}));class X extends v{constructor(e){super(e,new q),this._configuration=new D}getConfiguration(e,t){this._configuration.output=e,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasVertexColors=this.parameters.hasVertexColors,this._configuration.transparent=this.parameters.color[3]<1||this.parameters.width<1,this._configuration.draped=t.slot===N.DRAPED_MATERIAL;const r=null!=this.parameters.stipplePattern;return this._configuration.stippleEnabled=r,this._configuration.stippleOffColorEnabled=r&&null!=this.parameters.stippleOffColor,this._configuration.hasOccludees=this.parameters.hasOccludees,this._configuration.stipplePreferContinuous=this.parameters.stipplePreferContinuous,this._configuration}intersect(t,r,f,h,m,g){if(!f.options.selectionMode||!t.visible)return;if(!I(r))return void e.getLogger("esri.views.3d.webgl-engine.materials.NativeLineMaterial").error("intersection assumes a translation-only matrix");const T=t.vertexAttributes.get(L.POSITION).data,b=f.camera,x=ee;s(x,f.point);const y=2;i(te[0],x[0]-y,x[1]+y,0),i(te[1],x[0]+y,x[1]+y,0),i(te[2],x[0]+y,x[1]-y,0),i(te[3],x[0]-y,x[1]-y,0);for(let e=0;e<4;e++)if(!b.unprojectFromRenderScreen(te[e],re[e]))return;S(b.eye,re[0],re[1],se),S(b.eye,re[1],re[2],ie),S(b.eye,re[2],re[3],oe),S(b.eye,re[3],re[0],ne);let R=Number.MAX_VALUE,v=0;for(let e=0;e<T.length-5;e+=3){if(F[0]=T[e]+r[12],F[1]=T[e+1]+r[13],F[2]=T[e+2]+r[14],G[0]=T[e+3]+r[12],G[1]=T[e+4]+r[13],G[2]=T[e+5]+r[14],P(se,F)<0&&P(se,G)<0||P(ie,F)<0&&P(ie,G)<0||P(oe,F)<0&&P(oe,G)<0||P(ne,F)<0&&P(ne,G)<0)continue;if(b.projectToRenderScreen(F,Z),b.projectToRenderScreen(G,z),Z[2]<0&&z[2]>0){o(H,F,G);const e=b.frustum,t=-P(e[d.NEAR],F)/n(H,j(e[d.NEAR]));a(H,H,t),l(F,F,H),b.projectToRenderScreen(F,Z)}else if(Z[2]>0&&z[2]<0){o(H,G,F);const e=b.frustum,t=-P(e[d.NEAR],G)/n(H,j(e[d.NEAR]));a(H,H,t),l(G,G,H),b.projectToRenderScreen(G,z)}else if(Z[2]<0&&z[2]<0)continue;Z[2]=0,z[2]=0;const t=A(_(Z,z,Y),x);t<R&&(R=t,u(J,F),u(K,G),v=e/3)}const E=f.rayBegin,N=f.rayEnd;if(R<y*y){let e=Number.MAX_VALUE;if(O(_(J,K,Y),_(E,N,$),Q)){o(Q,Q,E);const t=c(Q);a(Q,Q,1/t),e=t/p(E,N)}g(e,Q,v,!1)}}intersectDraped(e,r,s,i,o,n){if(!s.options.selectionMode)return;const a=e.vertexAttributes.get(L.POSITION).data,l=e.vertexAttributes.get(L.SIZE),u=l?l.data[0]:0,c=i[0],p=i[1],f=((u+1)/2+4)*e.screenToWorldRatio;let h=Number.MAX_VALUE,m=0;for(let d=0;d<a.length-5;d+=3){const e=a[d],r=a[d+1],s=c-e,i=p-r,o=a[d+3]-e,n=a[d+4]-r,l=t((o*s+n*i)/(o*o+n*n),0,1),u=o*l-s,f=n*l-i,g=u*u+f*f;g<h&&(h=g,m=d/3)}h<f*f&&o(n.dist,n.normal,m,!1)}produces(e,t){return!(t!==y.Color&&t!==y.Highlight&&t!==y.ObjectAndLayerIdColor||e!==N.OPAQUE_MATERIAL&&e!==N.DRAPED_MATERIAL)}createGLMaterial(e){return new k(e)}createBufferWriter(){const e=this.parameters.hasVertexColors?C:U;return null==this.parameters.stipplePattern?new w(e):new W(e.clone().vec3f(L.AUXPOS1).vec2f(L.UV0))}}class k extends R{constructor(){super(...arguments),this._stipplePattern=null}dispose(){super.dispose(),this._stippleTextureRepository.release(this._stipplePattern),this._stipplePattern=null}_updateOccludeeState(e){e.hasOccludees!==this._material.parameters.hasOccludees&&this._material.setParameters({hasOccludees:e.hasOccludees})}beginSlot(e){this._output===y.Color&&this._updateOccludeeState(e);const t=this._material.parameters.stipplePattern;return this._stipplePattern!==t&&(this._material.setParameters({stippleTexture:this._stippleTextureRepository.swap(t,this._stipplePattern)}),this._stipplePattern=t),this.ensureTechnique(M,e)}}class W{constructor(e){this.vertexBufferLayout=e}elementCount(e){return e.indices.get(L.POSITION).length}write(e,t,r,s,i){V(r,this.vertexBufferLayout,e,t,s,i),this._writeAuxpos1(e,r,s,i),this._writeUV0(e,r,s,i)}_writeAuxpos1(e,t,r,s){const i=r.getField(L.AUXPOS1,b),o=t.indices.get(L.POSITION),n=t.vertexAttributes.get(L.POSITION).data,a=e,l=i.typedBufferStride,u=i.typedBuffer;s*=l;for(let c=0;c<o.length-1;c+=2)for(const e of[1,0]){const t=3*o[c+e],r=n[t],i=n[t+1],p=n[t+2],f=a[0]*r+a[4]*i+a[8]*p+a[12],h=a[1]*r+a[5]*i+a[9]*p+a[13],m=a[2]*r+a[6]*i+a[10]*p+a[14];u[s]=f,u[s+1]=h,u[s+2]=m,s+=l}}_writeUV0(e,t,r,s){const o=r.getField(L.UV0,x),n=t.indices.get(L.POSITION),a=t.vertexAttributes.get(L.POSITION).data,l=t.vertexAttributes.get(L.DISTANCETOSTART)?.data,c=o.typedBufferStride,h=o.typedBuffer;let m=0;h[s*=c]=B.START,h[s+1]=m,s+=c;const d=3*n[0],g=i(F,a[d],a[d+1],a[d+2]);e&&f(g,g,e);const A=G,_=n.length-1;let O=1;const T=l?(e,t,r)=>m=l[r]:(e,t,r)=>m+=p(e,t);for(let p=1;p<_;p+=2){const t=3*n[p];i(A,a[t],a[t+1],a[t+2]),e&&f(A,A,e),T(g,A,O++);for(let e=0;e<2;++e)h[s]=1-e,h[s+1]=m,s+=c;u(g,A)}const S=3*n[_];i(A,a[S],a[S+1],a[S+2]),e&&f(A,A,e),T(g,A,O),h[s]=B.END,h[s+1]=m}}class q extends E{constructor(){super(...arguments),this.color=m,this.hasVertexColors=!1,this.hasSlicePlane=!1,this.width=1,this.stipplePreferContinuous=!0,this.hasOccludees=!1,this.stippleTexture=null}}const F=h(),G=h(),H=h(),Q=h(),Z=r(),z=r(),J=h(),K=h(),Y=g(),$=g(),ee=h(),te=[r(),r(),r(),r()],re=[h(),h(),h(),h()],se=T(),ie=T(),oe=T(),ne=T();export{X as NativeLineMaterial,q as Parameters};