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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (190) hide show
  1. package/analysis/VolumeMeasurement/volumeMeasurementConfiguration.js +1 -1
  2. package/applications/Components/navigationDuration.d.ts +15 -0
  3. package/applications/Components/navigationDuration.js +2 -0
  4. package/assets/esri/core/workers/RemoteClient.js +1 -1
  5. package/assets/esri/core/workers/chunks/05bc675c029ed311427f.js +1 -0
  6. package/assets/esri/core/workers/chunks/{123e15c9e068a053d54e.js → 05d25a98c54679233902.js} +1 -1
  7. package/assets/esri/core/workers/chunks/{16a46688df5fad5cf8d5.js → 0b4a2361b9f9a6c0b8a7.js} +1 -1
  8. package/assets/esri/core/workers/chunks/{1fdd736c4932655ff1d9.js → 0e88e61d89f89994c4bf.js} +1 -1
  9. package/assets/esri/core/workers/chunks/0f2ab57e4eb722b3b0c0.js +1 -0
  10. package/assets/esri/core/workers/chunks/{ce59ec4f0cfbdf780bcb.js → 1f91280032aa42b1585b.js} +1 -1
  11. package/assets/esri/core/workers/chunks/254898b41cabe313b6ce.js +1 -0
  12. package/assets/esri/core/workers/chunks/26cafd20c8d03c274389.js +1 -0
  13. package/assets/esri/core/workers/chunks/{a69f1879735a031f62e9.js → 2a2d5f9ea42cb2eee9c6.js} +1 -1
  14. package/assets/esri/core/workers/chunks/{c03190faca955bffc8c1.js → 2bc6edeb3156d241677b.js} +1 -1
  15. package/assets/esri/core/workers/chunks/{d587b7842091affdaac3.js → 3158a3487d3e8a61b680.js} +1 -1
  16. package/assets/esri/core/workers/chunks/{07e791530677f7e70f32.js → 3a2ecb883fdb5c598544.js} +2 -2
  17. package/assets/esri/core/workers/chunks/{d7456829e404874a9e2f.js → 3e0752a81a7247c567ab.js} +1 -1
  18. package/assets/esri/core/workers/chunks/{fcda652fb5262696d59c.js → 3ef740d25dc17bef11b2.js} +1 -1
  19. package/assets/esri/core/workers/chunks/{2304f7b8173cf86dd805.js → 457bbf27e9bc18132464.js} +1 -1
  20. package/assets/esri/core/workers/chunks/45eddf3918973fa8d751.js +1 -0
  21. package/assets/esri/core/workers/chunks/4a6186001323b47c23a4.js +1 -0
  22. package/assets/esri/core/workers/chunks/{0b79630ad435a7734104.js → 4b3622fc355fd2fd8678.js} +1 -1
  23. package/assets/esri/core/workers/chunks/{193775b3b7de8f5dc578.js → 4fb718174c6e07d752e0.js} +1 -1
  24. package/assets/esri/core/workers/chunks/{cd14b6157862f33ab116.js → 5143f74f1fe7533a6069.js} +1 -1
  25. package/assets/esri/core/workers/chunks/{36425d29aaa5852cb41d.js → 522bc1d79dbe957301e4.js} +1 -1
  26. package/assets/esri/core/workers/chunks/{f80f04657762666b9165.js → 52dbfd7519555028a8af.js} +1 -1
  27. package/assets/esri/core/workers/chunks/{f4472e3486fdc33abb9a.js → 56bce3a6701f8549606b.js} +1 -1
  28. package/assets/esri/core/workers/chunks/572fcd33ae3648ed4f9c.js +1 -0
  29. package/assets/esri/core/workers/chunks/{d6f1ed8d8f76a32bc81d.js → 576a1784e93c5406e657.js} +1 -1
  30. package/assets/esri/core/workers/chunks/{ddc7956d80498518551e.js → 5a1d975b3e9e6b7eff67.js} +1 -1
  31. package/assets/esri/core/workers/chunks/5a83ea967ecde01d5622.js +1 -0
  32. package/assets/esri/core/workers/chunks/{4c38af9ae023fde2b5cd.js → 5aff2d6ae0d2a2d92ecc.js} +1 -1
  33. package/assets/esri/core/workers/chunks/5eb9fdb076488de9cd83.js +1 -0
  34. package/assets/esri/core/workers/chunks/{b59f03c64e4965d87291.js → 66fc3c4d6c54eee231b9.js} +1 -1
  35. package/assets/esri/core/workers/chunks/{de359f89e03da18999fc.js → 691d0a60354b6458b9de.js} +1 -1
  36. package/assets/esri/core/workers/chunks/{d44217de4c73475f9c66.js → 73a045061e69a22b6869.js} +1 -1
  37. package/assets/esri/core/workers/chunks/76064c2c801da55cd844.js +1 -0
  38. package/assets/esri/core/workers/chunks/770880ad43f252962017.js +1 -0
  39. package/assets/esri/core/workers/chunks/{52c90975cf22add7ee2b.js → 78cb6b9ab32abdd1d530.js} +1 -1
  40. package/assets/esri/core/workers/chunks/{11fed97adc9bca0f95e9.js → 7b6e3cc086d13da770fa.js} +1 -1
  41. package/assets/esri/core/workers/chunks/{d69cdee402ba4fc3735f.js → 7ed2aa1092c0a2c839c0.js} +1 -1
  42. package/assets/esri/core/workers/chunks/{097c037705ab485372ee.js → 83113a9e284701d053b5.js} +1 -1
  43. package/assets/esri/core/workers/chunks/8418ad9ad7b6481ebe82.js +1 -0
  44. package/assets/esri/core/workers/chunks/{173d94e162b210dee0a2.js → 85c72d9fa533552a6e8a.js} +1 -1
  45. package/assets/esri/core/workers/chunks/{5d202f60891fcae7174d.js → 861a7d0e665add901e11.js} +1 -1
  46. package/assets/esri/core/workers/chunks/{16ed8c0af8bb8b400163.js → 87077f4cbca13e030411.js} +1 -1
  47. package/assets/esri/core/workers/chunks/{199f70c0373f6008a545.js → 8df0c154bb0d79a905c0.js} +1 -1
  48. package/assets/esri/core/workers/chunks/{0f4759efc0982fb0ea03.js → 9066f095f16448c0a04e.js} +1 -1
  49. package/assets/esri/core/workers/chunks/91718795fc4ca6516ac7.js +1 -0
  50. package/assets/esri/core/workers/chunks/{796d27d1bbb2eed53cbd.js → 9321f5ec514805307219.js} +1 -1
  51. package/assets/esri/core/workers/chunks/{57dc80942e51dedd8335.js → 93d1118f7a909d123b40.js} +1 -1
  52. package/assets/esri/core/workers/chunks/{e6220c1fa887e21ffbbd.js → 9a235c92f21df2c17aa8.js} +1 -1
  53. package/assets/esri/core/workers/chunks/{6666ef3fd6ce877a4509.js → 9d11e7972bc298cb94ce.js} +1 -1
  54. package/assets/esri/core/workers/chunks/a11f05ddd8314b648f76.js +1 -0
  55. package/assets/esri/core/workers/chunks/{d4961d307651431328a8.js → a256edc8337e462f80f0.js} +1 -1
  56. package/assets/esri/core/workers/chunks/{2714ec856c2b3223425b.js → a41fabf8b2cf15b7d0c9.js} +1 -1
  57. package/assets/esri/core/workers/chunks/{e2d1d9929ed7744785a1.js → a7a553e245ba011d259f.js} +1 -1
  58. package/assets/esri/core/workers/chunks/{7ef1c1f765b6d423e474.js → a9eb90b901e64e67b7a3.js} +1 -1
  59. package/assets/esri/core/workers/chunks/{21decfc1e477fb769204.js → aa7aaeae31ddb259e55e.js} +1 -1
  60. package/assets/esri/core/workers/chunks/{a7b315a660f0f4e1d197.js → ad1946c084219bb678a0.js} +1 -1
  61. package/assets/esri/core/workers/chunks/b056b4c79bcd542dd1d2.js +1 -0
  62. package/assets/esri/core/workers/chunks/{bae1d6dd2376dff271e8.js → b1a0a7cdaf50f98adb3e.js} +1 -1
  63. package/assets/esri/core/workers/chunks/{c1ad062ccc1817cbee4c.js → b20f4c82d0b44fdb4670.js} +1 -1
  64. package/assets/esri/core/workers/chunks/{1a1e57267306c07e5bdb.js → b3f0600729227b458a75.js} +1 -1
  65. package/assets/esri/core/workers/chunks/{16f5cd740321a3539bf1.js → bacc343a79828e456de7.js} +1 -1
  66. package/assets/esri/core/workers/chunks/{e23fc5853e2f4016936b.js → c250799c131aa4ed2c35.js} +1 -1
  67. package/assets/esri/core/workers/chunks/{a495e60996a36ce19a32.js → c4da2ca1dee0c44051d0.js} +1 -1
  68. package/assets/esri/core/workers/chunks/{be60a6e210186ff09ae2.js → c6149e0ac1c103e03baf.js} +1 -1
  69. package/assets/esri/core/workers/chunks/c69fefe9d51ac7c2b0a6.js +1 -0
  70. package/assets/esri/core/workers/chunks/{bbb9659f79511c2c4690.js → c91d39e8e14be3d8bdf5.js} +1 -1
  71. package/assets/esri/core/workers/chunks/{c93454e37ae0f124bcb0.js → c9c5e6996f36ec4b1558.js} +1 -1
  72. package/assets/esri/core/workers/chunks/{4c8c69d081ed37bf5bc5.js → cd391415b8b8320e12e4.js} +1 -1
  73. package/assets/esri/core/workers/chunks/d3b3e8c6d7096bc59489.js +1 -0
  74. package/assets/esri/core/workers/chunks/{bad82ce3f84f7efb7ab7.js → da2a10e72a315c3c1f82.js} +1 -1
  75. package/assets/esri/core/workers/chunks/de79645e559a2d1ffa67.js +1 -0
  76. package/assets/esri/core/workers/chunks/{8569ae372fc64641b6b1.js → e2e3c39876bbe019c57a.js} +1 -1
  77. package/assets/esri/core/workers/chunks/{d31e68e73527c88b8276.js → e7e565e7c0ce1464c6b0.js} +1 -1
  78. package/assets/esri/core/workers/chunks/{f3f26f6116ab9126c2e7.js → e8a23ae30d586e3a973c.js} +1 -1
  79. package/assets/esri/core/workers/chunks/{d1aa1d51662f4a01e793.js → ea068f75397c3b3337ec.js} +3 -3
  80. package/assets/esri/core/workers/chunks/{c09bc36347e8eb9fff00.js → f09446b9ff937a84d6d3.js} +1 -1
  81. package/assets/esri/core/workers/chunks/{354b309c8225336bc1e5.js → f6d047358d14328f3622.js} +1 -1
  82. package/assets/esri/core/workers/chunks/{b43889ed9737c27e89f1.js → fb9a889ec9fd23739a14.js} +1 -1
  83. package/assets/esri/core/workers/chunks/{b2a67fe89f6505498bc3.js → fe1b67ab7748a3aef231.js} +1 -1
  84. package/assets/esri/themes/base/_Ui.scss +3 -3
  85. package/assets/esri/themes/base/_mixins.scss +2 -2
  86. package/assets/esri/themes/base/widgets/_Attachments.scss +3 -3
  87. package/assets/esri/themes/base/widgets/_BasemapGallery.scss +8 -8
  88. package/assets/esri/themes/base/widgets/_BasemapToggle.scss +1 -1
  89. package/assets/esri/themes/base/widgets/_BuildingExplorer.scss +1 -1
  90. package/assets/esri/themes/base/widgets/_BuildingLevelPicker.scss +4 -4
  91. package/assets/esri/themes/base/widgets/_BuildingPhasePicker.scss +1 -1
  92. package/assets/esri/themes/base/widgets/_CoordinateConversion.scss +2 -2
  93. package/assets/esri/themes/base/widgets/_DatePicker.scss +4 -4
  94. package/assets/esri/themes/base/widgets/_Daylight.scss +1 -1
  95. package/assets/esri/themes/base/widgets/_Editor.scss +2 -2
  96. package/assets/esri/themes/base/widgets/_ElevationProfile.scss +2 -2
  97. package/assets/esri/themes/base/widgets/_FeatureMedia.scss +1 -1
  98. package/assets/esri/themes/base/widgets/_FeatureTable.scss +1 -1
  99. package/assets/esri/themes/base/widgets/_FloorFilter.scss +2 -2
  100. package/assets/esri/themes/base/widgets/_Grid.scss +1 -1
  101. package/assets/esri/themes/base/widgets/_GridControls.scss +1 -1
  102. package/assets/esri/themes/base/widgets/_ItemList.scss +1 -1
  103. package/assets/esri/themes/base/widgets/_Legend.scss +1 -1
  104. package/assets/esri/themes/base/widgets/_LineOfSight.scss +1 -1
  105. package/assets/esri/themes/base/widgets/_OrientedImageryViewer.scss +1 -1
  106. package/assets/esri/themes/base/widgets/_OrientedImageryViewerNavigationUI.scss +3 -3
  107. package/assets/esri/themes/base/widgets/_Popup.scss +1 -1
  108. package/assets/esri/themes/base/widgets/_Print.scss +3 -3
  109. package/assets/esri/themes/base/widgets/_Sketch.scss +1 -1
  110. package/assets/esri/themes/base/widgets/_Slice.scss +1 -1
  111. package/assets/esri/themes/base/widgets/_Slider.scss +3 -3
  112. package/assets/esri/themes/base/widgets/_SnappingControls.scss +2 -2
  113. package/assets/esri/themes/base/widgets/_Spinner.scss +2 -2
  114. package/assets/esri/themes/base/widgets/_Swipe.scss +2 -2
  115. package/assets/esri/themes/base/widgets/_Tooltip.scss +2 -2
  116. package/assets/esri/themes/base/widgets/_UtilityNetworkTrace.scss +1 -1
  117. package/assets/esri/themes/base/widgets/_VideoPlayer.scss +2 -2
  118. package/assets/esri/themes/base/widgets/_Widget.scss +8 -8
  119. package/assets/esri/themes/dark/main.css +1 -1
  120. package/assets/esri/themes/light/main.css +1 -1
  121. package/assets/esri/themes/light/view.css +1 -1
  122. package/chunks/CutFillComposition.glsl.js +10 -4
  123. package/chunks/RibbonLine.glsl.js +75 -63
  124. package/chunks/Water.glsl.js +24 -16
  125. package/config.js +1 -1
  126. package/geometry/operators/offsetOperator.d.ts +1 -1
  127. package/geometry/operators/proximityOperator.d.ts +1 -1
  128. package/geometry/support/curves/bezierCurveUtils.js +1 -1
  129. package/geometry/support/curves/circularArcUtils.js +1 -1
  130. package/geometry/support/curves/ellipticArc4Utils.js +1 -1
  131. package/geometry/support/curves/ellipticArc7Utils.js +1 -1
  132. package/geometry/support/zscale.js +1 -1
  133. package/interfaces.d.ts +7 -0
  134. package/kernel.js +1 -1
  135. package/layers/LinkChartLayer.js +1 -1
  136. package/layers/OrientedImageryLayer.d.ts +0 -152
  137. package/layers/OrientedImageryLayer.js +1 -1
  138. package/layers/support/layerUtils.js +1 -1
  139. package/package.json +1 -1
  140. package/portal/schemas/definitions.js +1 -1
  141. package/support/revision.js +1 -1
  142. package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
  143. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillVisualization.js +1 -1
  144. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementShiftTool.js +1 -1
  145. package/views/3d/interactive/manipulators/ShiftManipulator.js +1 -1
  146. package/views/3d/layers/GaussianSplatLayerView3D.js +1 -1
  147. package/views/3d/layers/graphics/Graphics3DLineSymbolLayer.js +1 -1
  148. package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.js +1 -1
  149. package/views/3d/layers/graphics/lineUtils.js +1 -1
  150. package/views/3d/support/gaussianSplatting/GaussianSplatDataStore.js +1 -1
  151. package/views/3d/support/gaussianSplatting/GaussianSplatFadeHelper.js +1 -1
  152. package/views/3d/support/gaussianSplatting/GaussianTile.js +1 -1
  153. package/views/3d/terrain/TerrainRenderer.js +1 -1
  154. package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
  155. package/views/3d/webgl-engine/core/shaderLibrary/ShaderOutput.js +1 -1
  156. package/views/3d/webgl-engine/core/shaderTechnique/ShaderTechniqueRepository.js +1 -1
  157. package/views/3d/webgl-engine/lib/BindParameters.js +1 -1
  158. package/views/3d/webgl-engine/lib/CutFillComputationRenderNode.js +1 -1
  159. package/views/3d/webgl-engine/lib/CutFillVisualizationRenderNode.js +1 -1
  160. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  161. package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
  162. package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
  163. package/views/3d/webgl-engine/materials/PolygonOffset.js +1 -1
  164. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  165. package/views/3d/webgl-engine/materials/Water.glsl.js +1 -1
  166. package/views/3d/webgl-engine/materials/WaterMaterial.js +1 -1
  167. package/views/3d/webgl-engine/shaders/RibbonLineTechnique.js +1 -1
  168. package/views/3d/webgl-engine/shaders/RibbonLineTechniqueConfiguration.js +1 -1
  169. package/views/3d/webgl.js +1 -1
  170. package/views/draw/plugins/TangentArcSegmentPlugin.js +2 -0
  171. package/views/webgl/checkWebGLError.js +1 -1
  172. package/widgets/Sketch/support/PluginManager.js +1 -1
  173. package/assets/esri/core/workers/chunks/0ab19ad980fda1cf402a.js +0 -1
  174. package/assets/esri/core/workers/chunks/1cce2f8837ad765acf44.js +0 -1
  175. package/assets/esri/core/workers/chunks/20f9f3470cad47d01803.js +0 -1
  176. package/assets/esri/core/workers/chunks/23a9070e9362b8439770.js +0 -1
  177. package/assets/esri/core/workers/chunks/28ac3a75130fe2b57ac7.js +0 -1
  178. package/assets/esri/core/workers/chunks/36a0e48113ab59a4f21d.js +0 -1
  179. package/assets/esri/core/workers/chunks/440a650ed0867a16f559.js +0 -1
  180. package/assets/esri/core/workers/chunks/440f76c397a813b0dcf9.js +0 -1
  181. package/assets/esri/core/workers/chunks/5344919fc6e8050450f1.js +0 -1
  182. package/assets/esri/core/workers/chunks/5e9bd5ed6ecee5b15127.js +0 -1
  183. package/assets/esri/core/workers/chunks/64845b1f53eca9db1229.js +0 -1
  184. package/assets/esri/core/workers/chunks/7278cc37e85f0242f19b.js +0 -1
  185. package/assets/esri/core/workers/chunks/7d56b2ac5030dd8b748e.js +0 -1
  186. package/assets/esri/core/workers/chunks/96e799ca97989a6ed448.js +0 -1
  187. package/assets/esri/core/workers/chunks/9db2ff1d4cbb5d1b623e.js +0 -1
  188. package/assets/esri/core/workers/chunks/ab414a60808ea05a63e6.js +0 -1
  189. package/assets/esri/core/workers/chunks/ec65c9c72507ef9a9cf9.js +0 -1
  190. package/assets/esri/core/workers/chunks/f1767b8ba82fdd9bd947.js +0 -1
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import"../../../core/has.js";import t from"../../../core/Logger.js";import{removeMaybe as i}from"../../../core/maybe.js";import{watch as s,initial as r}from"../../../core/reactiveUtils.js";import{unitFromRESTJSON as a,convertUnit as n}from"../../../core/units.js";import{property as o,subclass as l}from"../../../core/accessorSupport/decorators.js";import{fromValues as h}from"../../../core/libs/gl-matrix-2/factories/quatf64.js";import{getReferenceEllipsoid as d}from"../../../geometry/ellipsoidUtils.js";import u from"../../../geometry/HeightModelInfo.js";import{create as m}from"../../../geometry/support/aaBoundingBox.js";import{isCompatible as p}from"../../../geometry/support/heightModelInfoUtils.js";import{isPlateCarree as c,isWebMercator as f,equals as g,isGeographic as y}from"../../../geometry/support/spatialReferenceUtils.js";import _ from"../../../geometry/support/WKIDUnitConversion.js";import{getHeightModelInfoFromVCS as w}from"../../../layers/support/tiles3DUtils.js";import{getElevationOffsetInMeters as v}from"../../../support/elevationInfoUtils.js";import{getMetersPerUnit as b}from"../../../symbols/support/unitConversionUtils.js";import{GaussianSplatLayerViewPerformanceInfo as x}from"./GaussianSplatLayerViewPerformanceInfo.js";import{LayerView3D as S}from"./LayerView3D.js";import{addLayerViewToWasm as C,getLyr3DWasm as H,removeLayerViewFromWasm as M}from"./Lyr3DWasm.js";import{LayerElevationProvider as E}from"./i3s/LayerElevationProvider.js";import{ElevationRange as P}from"../support/ElevationRange.js";import{projectToBoundingBox as j}from"../support/extentUtils.js";import{Obb as U}from"../support/orientedBoundingBox.js";import{splatPageSizeInU32 as T,elementsPerSplatPage as A,packedGaussianSizeInU32 as G,splatPageSizeInU32WithoutHeader as V,gaussiansPerSplatPage as R,splatAtlasTextureWidth as I}from"../support/gaussianSplatting/GaussianSplatAtlasPages.js";import{GaussianSplatDataStore as O}from"../support/gaussianSplatting/GaussianSplatDataStore.js";import{GaussianSplatFadeHelper as L}from"../support/gaussianSplatting/GaussianSplatFadeHelper.js";import{GaussianSplatIntersectionHandler as B}from"../support/gaussianSplatting/GaussianSplatIntersectionHandler.js";import{GaussianTile as F}from"../support/gaussianSplatting/GaussianTile.js";import{GaussianSplatRenderNode as k}from"../webgl-engine/lib/GaussianSplatRenderNode.js";import D from"../../layers/LayerView.js";import{spatialReferenceIncompatibleError as N,isInEffectiveScaleRange as z}from"../../support/layerViewUtils.js";import{TaskPriority as q}from"../../support/Scheduler.js";const W=()=>t.getLogger("esri.views.3d.layers.GaussianSplatLayerView3D");let $=class extends(S(D)){constructor(e){super(e),this.type="gaussian-splat-3d",this.ignoresMemoryFactor=!1,this._tileHandles=new Map,this._pageBuffer=new Uint32Array(T),this._tmpTilesWithChangedVisibility=new Array,this._wasmLayerId=-1,this._metersPerVCSUnit=1,this._usedMemory=0,this._cacheMemory=0,this._useEsriCrs=!1,this.fullExtentInLocalViewSpatialReference=null,this._suspendedHandle=null,this._conversionBuffer=new ArrayBuffer(4),this._u32View=new Uint32Array(this._conversionBuffer),this._f32View=new Float32Array(this._conversionBuffer);const t=e.view.resourceController;this._memCache=t.memoryController.newCache(`GaussianSplat-${this.uid}`,e=>this._deleteTile(e)),this._frameTask=t.scheduler.registerTask(q.GAUSSIAN_SPLAT_TEXTURE_ATLAS)}get _clippingBox(){if(!this.view?.clippingArea)return null;const e=m();return j(this.view.clippingArea,e,this.view.renderSpatialReference)?e:null}get clippingBox(){return this._renderNode?.clippingBox??null}initialize(){if(!this._canProjectWithoutEngine())throw N("layer",this.layer.spatialReference.wkid,this.view.renderSpatialReference?.wkid);const e=C(this).then(e=>{this._wasmLayerId=e,this._renderNode=new k({view:this.view,layerView:this}),this.data=new O(this._renderNode),this.fadeHelper=new L(this),this._intersectionHandler=new B(this),this.view.sceneIntersectionHelper.addIntersectionHandler(this._intersectionHandler),this._elevationProvider=new E({view:this.view,layerElevationSource:this,intersectionHandler:this._intersectionHandler}),this.view.elevationProvider.register(2,this._elevationProvider),this.addHandles([s(()=>this.layer.elevationInfo,e=>this._elevationInfoChanged(e)),s(()=>this.slicePlaneEnabled,e=>this._slicePlaneEnabledChanged(e),r)]),this._suspendedHandle=s(()=>this.suspended,e=>this._wasm?.setEnabled(this,!e),r),this.addHandles([s(()=>this._clippingBox,e=>this._renderNode.clippingBox=e,r)]),this.setMaximumGaussianCount(this.view.qualitySettings.gaussianSplat.maximumNumberOfGaussians)});this.addHandles([s(()=>this.view.qualitySettings.fadeDuration,e=>{this.fadeHelper.onFadeDurationChanged(e),this.data.fadingTexture.updateTexture(this.data.textureAtlas.pageAllocator.pageCount)}),s(()=>this.view.qualitySettings.gaussianSplat.maximumNumberOfGaussians,e=>this.setMaximumGaussianCount(e*this.view.quality)),s(()=>this.view.quality,e=>this.setMaximumGaussianCount(this.view.qualitySettings.gaussianSplat.maximumNumberOfGaussians*e))]),this.addResolvingPromise(e)}get wasmLayerId(){return this._wasmLayerId}get metersPerVCSUnit(){return this._metersPerVCSUnit}get tileHandles(){return this._tileHandles}get _wasm(){return H(this.view)}get usedMemory(){return this._usedMemory}get cachedMemory(){return this._cacheMemory}get unloadedMemory(){return 0}get useEsriCrs(){return this._useEsriCrs}get elevationProvider(){return this._elevationProvider}get elevationOffset(){return v(this.layer.elevationInfo)}get elevationRange(){const e=this.fullExtent;return e?.zmin&&e?.zmax?new P(e.zmin,e.zmax):null}getElevationRange(e){return this._intersectionHandler.getElevationRange(e)}get fullExtent(){return this.layer.fullExtent}get visibleAtCurrentScale(){return z(this.layer.effectiveScaleRange,this.view.scale)}isUpdating(){const e=this._wasm;return!(this._wasmLayerId<0||null==e)&&(e.isUpdating(this._wasmLayerId)||this.data.updating||this.fadeHelper.updating)}updatingFlagChanged(){this.notifyChange("updating")}async createRenderable(e){const t=e.meshData;if(null==t.data)throw new Error("meshData.data undefined");if(t.desc=JSON.parse(t.desc),null==t.desc)throw new Error("meshData.desc undefined");const i=t.desc.prims[0],s=i.vertexCount,r=i.atrbs[0].view,a=i.atrbs[0].view.byteCount,n=i.atrbs[0].view.byteOffset;let o=null;if("U32"!==r.type)return W().warnOnce("unexpected meshData.data format"),{memUsageBytes:0,numGaussians:0};o=new Uint32Array(t.data.buffer,n,a/4);const l=this.extractHeader(o),u=Math.ceil(s/R),m=new Uint32Array(s),p=new Array;let c=!1,f=0;const g=async e=>{for(;f<u&&!e.done&&!c;f++){let t=this.data.textureAtlas.requestPage();if(null===t&&(this._freeInvisibleTiles(),t=this.data.textureAtlas.requestPage()),null!==t){p.push(t);const i=s-f*R,r=Math.min(i,R),a=f*R;for(let e=0;e<r;e++)m[e+a]=e+A*t;const n=f*V;this._pageBuffer.set(o.subarray(n,n+r*G)),this._pageBuffer.set(l.packedHeader,V);const h=t*A,d=h%I,u=Math.floor(h/I);this.data.textureAtlas.update(d,u,this._pageBuffer),e.madeProgress()}else c=!0}f<u&&!c&&await this._frameTask.schedule(g)};if(await this._frameTask.schedule(g),c)return W().warnOnce("ran out of gaussian splat memory"),{memUsageBytes:0,numGaussians:0};const y=new Float32Array(3*s),_=new Float32Array(s),w=2.048,v=l.tileOrigin.x*w,b=l.tileOrigin.y*w,x=l.tileOrigin.z*w,S=l.invPosScale;let C=null;if(t.desc.obb){const e=t.desc.obb.quaternion;C=new U(t.desc.obb.center,t.desc.obb.halfSize,h(...e))}C||(W().warnOnce("encountered tile without a bounding box"),C=new U);const H=C.centerX,M=C.centerY,E=C.centerZ,j=new P,T=this.view.state.isGlobal,O=T?d(this.view.spatialReference).radius:0;let L=0,B=0,k=0;const D=async e=>{for(;k<s&&!e.done;k++){const t=k*G,{rawX:i,rawY:s,rawZ:r}=this._extractGaussianPosition(o,t),a=this._extractGaussianSphericalScale(o,t),n=i*S+v,l=s*S+b,h=r*S+x;y[L]=n-H,y[L+1]=l-M,y[L+2]=h-E;const d=T?Math.sqrt(n*n+l*l+h*h)-O:h;j.expandElevationRangeValues(d,d),_[k]=a*a,B=Math.max(B,a),L+=3,e.madeProgress()}k<s&&await this._frameTask.schedule(D)};await this._frameTask.schedule(D);const{fullExtent:N}=this.layer;N?.hasZ&&N.zmax&&N.zmin&&(j.minElevation=Math.max(j.minElevation,N.zmin),j.maxElevation=Math.min(j.maxElevation,N.zmax));const z=new F(e.handle,C,m,p,y,_,B,j);return this._memCache.put(`${z.handle}`,z),this._tileHandles.set(e.handle,z),this._cacheMemory+=z.usedMemory,{memUsageBytes:z.usedMemory,numGaussians:s}}_extractGaussianPosition(e,t){const i=e[t+1];return{rawX:16383&i,rawY:i>>>14&16383,rawZ:i>>>28&15|(1023&e[t+2])<<4}}_extractGaussianSphericalScale(e,t){const i=e[t+2],s=i>>>10&255,r=i>>>18&255,a=i>>>26&63|(3&e[t+3])<<6,n=Math.exp(s/16-10),o=Math.exp(r/16-10),l=Math.exp(a/16-10);return Math.max(n,o,l)}freeRenderable(e){const t=this._tileHandles.get(e);t&&(t.isVisible?(this.fadeHelper.onTileDiscarded(t),this._usedMemory-=t.usedMemory):this._cacheMemory-=t.usedMemory,t.pageIds.forEach(e=>this.data.textureAtlas.freePage(e)),this.freeObject(t),this._tileHandles.delete(e)),this.updateGaussians()}freeObject(e){this._memCache.pop(`${e.handle}`)}notifyTileObbsChanged(e){this._elevationProvider&&this._elevationProvider.notifyObjectsChangedFunctional(t=>{for(const i of e)t(i.obb)})}setRenderableVisibility(e,t,i){const s=this._tmpTilesWithChangedVisibility;s.length=0;for(let r=0;r<i;r++){if(!t[r])continue;const i=e[r],a=this._tileHandles.get(i);a&&(a.isVisible&&!this.fadeHelper.isTileFadingOut(a)||(a.isVisible=!0,s.push(a),this.fadeHelper.isTileFadingOut(a)||this._popTileFromCache(a),this.fadeHelper.fadeTile(a,0)))}for(let r=0;r<i;r++){if(t[r])continue;const i=e[r],a=this._tileHandles.get(i);a&&a.isVisible&&(s.push(a),this.fadeHelper.fadeTile(a,1))}s.length>0&&this.notifyTileObbsChanged(s),this.updateGaussians()}_popTileFromCache(e){this._usedMemory+=e.usedMemory,this._cacheMemory-=e.usedMemory,this._memCache.pop(`${e.handle}`)}moveTileToCache(e){this._usedMemory-=e.usedMemory,this._cacheMemory+=e.usedMemory,this._memCache.put(`${e.handle}`,e)}destroy(){M(this),this._suspendedHandle&&(this._suspendedHandle=i(this._suspendedHandle)),this._intersectionHandler&&(this.view.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler),this._intersectionHandler=null),this._elevationProvider&&this.view.elevationProvider&&(this._elevationProvider.notifyObjectsChangedFunctional(e=>{for(const t of this._tileHandles.values())e(t.obb)}),this.view.elevationProvider.unregister(this._elevationProvider),this._elevationProvider=null),this._frameTask.remove(),this._renderNode.destroy(),this.data.destroy(),this._memCache.destroy()}_canProjectWithoutEngine(){if(1===this.view.state.viewingMode)return!0;if(c(this.view.renderSpatialReference)||f(this.view.renderSpatialReference))return!0;if(this.layer.esriCrsSpatialReference&&g(this.layer.esriCrsSpatialReference,this.view.renderSpatialReference)){if(115700===this.layer.esriCrsSpatialReference.vcsWkid)return!1;let e=w(this.layer.esriCrsSpatialReference);if(!e){const t=this.layer.esriCrsSpatialReference;let i="meters";!y(t)&&t.wkid&&-1!==t.wkid&&(i=a(_.units[_[t.wkid]])),i&&(e=new u({heightModel:"gravity-related-height",heightUnit:i}))}const t=this.view.heightModelInfo;return this._useEsriCrs=0===p(e,t,!1),this._useEsriCrs&&(e&&(this._metersPerVCSUnit=n(1,e.heightUnit,"meters")),this.fullExtentInLocalViewSpatialReference=this.layer.esriCrsFullExtent),this._useEsriCrs}return!1}_elevationInfoChanged(e){if(e?.offset)if(this._useEsriCrs){const t=b(e?.unit)/this._metersPerVCSUnit,i=e?.offset??0;this._wasm?.setLayerOffset(this,i*t)}else this._wasm?.setLayerOffset(this,v(e));else this._wasm?.setLayerOffset(this,0)}_slicePlaneEnabledChanged(e){this._renderNode&&(this._renderNode.slicePlaneEnabled=e),this._intersectionHandler&&(this._intersectionHandler.slicePlaneEnabled=e)}updateGaussians(){const e=new Array;for(const t of this._tileHandles.values())t.isVisible&&e.push(t);this.data.updateGaussianVisibility(e),this.notifyChange("updating")}setMaximumGaussianCount(e){this._wasm?.setMaximumGaussianSplatCount(e)}_freeInvisibleTiles(){for(const e of this._tileHandles.values())e.isVisible||this._deleteTile(e)}extractHeader(e){const t=e.length-4,i=this.reinterpretU32AsFloat(e[t]),s=this.reinterpretU32AsFloat(e[t+1]),r=this.reinterpretU32AsFloat(e[t+2]),a=1/(1<<(255&e[t+3]));return{packedHeader:e.subarray(t,t+4),tileOrigin:{x:i,y:s,z:r},invPosScale:a}}_deleteTile(e){this._wasm?.onRenderableEvicted(this,e.handle,e.usedMemory),this.freeRenderable(e.handle)}reinterpretU32AsFloat(e){return this._u32View[0]=e,this._f32View[0]}get performanceInfo(){let e=0,t=0;return this._tileHandles.forEach(i=>{i.isVisible?e++:t++}),new x(this.usedMemory,e,t,this.cachedMemory)}get test(){}};e([o()],$.prototype,"layer",void 0),e([o({readOnly:!0})],$.prototype,"_clippingBox",null),e([o()],$.prototype,"elevationOffset",null),e([o({readOnly:!0})],$.prototype,"visibleAtCurrentScale",null),e([o()],$.prototype,"fullExtentInLocalViewSpatialReference",void 0),$=e([l("esri.views.3d.layers.GaussianSplatLayerView3D")],$);const X=$;export{X as default};
2
+ import{__decorate as e}from"tslib";import"../../../core/has.js";import t from"../../../core/Logger.js";import{removeMaybe as i}from"../../../core/maybe.js";import{watch as s,initial as a}from"../../../core/reactiveUtils.js";import{unitFromRESTJSON as r,convertUnit as n}from"../../../core/units.js";import{property as l,subclass as o}from"../../../core/accessorSupport/decorators.js";import{fromValues as h}from"../../../core/libs/gl-matrix-2/factories/quatf64.js";import{getReferenceEllipsoid as d}from"../../../geometry/ellipsoidUtils.js";import u from"../../../geometry/HeightModelInfo.js";import{create as c}from"../../../geometry/support/aaBoundingBox.js";import{isCompatible as p}from"../../../geometry/support/heightModelInfoUtils.js";import{isPlateCarree as m,isWebMercator as f,equals as g,isGeographic as _}from"../../../geometry/support/spatialReferenceUtils.js";import y from"../../../geometry/support/WKIDUnitConversion.js";import{getHeightModelInfoFromVCS as w}from"../../../layers/support/tiles3DUtils.js";import{getElevationOffsetInMeters as v}from"../../../support/elevationInfoUtils.js";import{getMetersPerUnit as S}from"../../../symbols/support/unitConversionUtils.js";import{GaussianSplatLayerViewPerformanceInfo as C}from"./GaussianSplatLayerViewPerformanceInfo.js";import{LayerView3D as b}from"./LayerView3D.js";import{addLayerViewToWasm as x,getLyr3DWasm as I,removeLayerViewFromWasm as H}from"./Lyr3DWasm.js";import{LayerElevationProvider as M}from"./i3s/LayerElevationProvider.js";import{ElevationRange as A}from"../support/ElevationRange.js";import{projectToBoundingBox as E}from"../support/extentUtils.js";import{Obb as F}from"../support/orientedBoundingBox.js";import{splatPageSizeInU32 as T,elementsPerSplatPage as P,packedGaussianSizeInU32 as j,splatPageSizeInU32WithoutHeader as O,gaussiansPerSplatPage as U,splatAtlasTextureWidth as G}from"../support/gaussianSplatting/GaussianSplatAtlasPages.js";import{GaussianSplatDataStore as R}from"../support/gaussianSplatting/GaussianSplatDataStore.js";import{GaussianSplatFadeHelper as V}from"../support/gaussianSplatting/GaussianSplatFadeHelper.js";import{GaussianSplatIntersectionHandler as L}from"../support/gaussianSplatting/GaussianSplatIntersectionHandler.js";import{GaussianTile as B}from"../support/gaussianSplatting/GaussianTile.js";import{GaussianSplatRenderNode as k}from"../webgl-engine/lib/GaussianSplatRenderNode.js";import D from"../../layers/LayerView.js";import{spatialReferenceIncompatibleError as N,isInEffectiveScaleRange as z}from"../../support/layerViewUtils.js";import{TaskPriority as q}from"../../support/Scheduler.js";const W=()=>t.getLogger("esri.views.3d.layers.GaussianSplatLayerView3D");let $=class extends(b(D)){constructor(e){super(e),this.type="gaussian-splat-3d",this.ignoresMemoryFactor=!1,this._tileHandles=new Map,this._pageBuffer=new Uint32Array(T),this._tmpTilesWithChangedVisibility=new Array,this._currentLyr3dVisibilityChange=0,this._tileFadeInsAwaitingInitialSort=new Map,this._tileFadeOutsAwaitingInitialSort=new Map,this._tmpSortedTileHandles=new Set,this._wasmLayerId=-1,this._metersPerVCSUnit=1,this._usedMemory=0,this._cacheMemory=0,this._useEsriCrs=!1,this.fullExtentInLocalViewSpatialReference=null,this._suspendedHandle=null,this._conversionBuffer=new ArrayBuffer(4),this._u32View=new Uint32Array(this._conversionBuffer),this._f32View=new Float32Array(this._conversionBuffer);const t=e.view.resourceController;this._memCache=t.memoryController.newCache(`GaussianSplat-${this.uid}`,e=>this._deleteTile(e)),this._frameTask=t.scheduler.registerTask(q.GAUSSIAN_SPLAT_TEXTURE_ATLAS)}get _clippingBox(){if(!this.view?.clippingArea)return null;const e=c();return E(this.view.clippingArea,e,this.view.renderSpatialReference)?e:null}get clippingBox(){return this._renderNode?.clippingBox??null}initialize(){if(!this._canProjectWithoutEngine())throw N("layer",this.layer.spatialReference.wkid,this.view.renderSpatialReference?.wkid);const e=x(this).then(e=>{this._wasmLayerId=e,this._renderNode=new k({view:this.view,layerView:this}),this.data=new R(this._renderNode,(e,t)=>this._onSortComplete(e,t)),this.fadeHelper=new V(this),this._intersectionHandler=new L(this),this.view.sceneIntersectionHelper.addIntersectionHandler(this._intersectionHandler),this._elevationProvider=new M({view:this.view,layerElevationSource:this,intersectionHandler:this._intersectionHandler}),this.view.elevationProvider.register(2,this._elevationProvider),this.addHandles([s(()=>this.layer.elevationInfo,e=>this._elevationInfoChanged(e)),s(()=>this.slicePlaneEnabled,e=>this._slicePlaneEnabledChanged(e),a)]),this._suspendedHandle=s(()=>this.suspended,e=>this._wasm?.setEnabled(this,!e),a),this.addHandles([s(()=>this._clippingBox,e=>this._renderNode.clippingBox=e,a)]),this.setMaximumGaussianCount(this.view.qualitySettings.gaussianSplat.maximumNumberOfGaussians)});this.addHandles([s(()=>this.view.qualitySettings.fadeDuration,e=>{this.fadeHelper.onFadeDurationChanged(e),this.data.fadingTexture.updateTexture(this.data.textureAtlas.pageAllocator.pageCount)}),s(()=>this.view.qualitySettings.gaussianSplat.maximumNumberOfGaussians,e=>this.setMaximumGaussianCount(e*this.view.quality)),s(()=>this.view.quality,e=>this.setMaximumGaussianCount(this.view.qualitySettings.gaussianSplat.maximumNumberOfGaussians*e))]),this.addResolvingPromise(e)}get wasmLayerId(){return this._wasmLayerId}get metersPerVCSUnit(){return this._metersPerVCSUnit}get tileHandles(){return this._tileHandles}get _wasm(){return I(this.view)}get usedMemory(){return this._usedMemory}get cachedMemory(){return this._cacheMemory}get unloadedMemory(){return 0}get useEsriCrs(){return this._useEsriCrs}get elevationProvider(){return this._elevationProvider}get elevationOffset(){return v(this.layer.elevationInfo)}get elevationRange(){const e=this.fullExtent;return e?.zmin&&e?.zmax?new A(e.zmin,e.zmax):null}getElevationRange(e){return this._intersectionHandler.getElevationRange(e)}get fullExtent(){return this.layer.fullExtent}get visibleAtCurrentScale(){return z(this.layer.effectiveScaleRange,this.view.scale)}isUpdating(){const e=this._wasm;return!(this._wasmLayerId<0||null==e)&&(e.isUpdating(this._wasmLayerId)||this.data.updating||this.fadeHelper.updating)}updatingFlagChanged(){this.notifyChange("updating")}async createRenderable(e){const t=e.meshData;if(null==t.data)throw new Error("meshData.data undefined");if(t.desc=JSON.parse(t.desc),null==t.desc)throw new Error("meshData.desc undefined");const i=t.desc.prims[0],s=i.vertexCount,a=i.atrbs[0].view,r=i.atrbs[0].view.byteCount,n=i.atrbs[0].view.byteOffset;let l=null;if("U32"!==a.type)return W().warnOnce("unexpected meshData.data format"),{memUsageBytes:0,numGaussians:0};l=new Uint32Array(t.data.buffer,n,r/4);const o=this.extractHeader(l),u=Math.ceil(s/U),c=new Uint32Array(s),p=new Array;let m=!1,f=0;const g=async e=>{for(;f<u&&!e.done&&!m;f++){let t=this.data.textureAtlas.requestPage();if(null===t&&(this._freeInvisibleTiles(),t=this.data.textureAtlas.requestPage()),null!==t){p.push(t);const i=s-f*U,a=Math.min(i,U),r=f*U;for(let e=0;e<a;e++)c[e+r]=e+P*t;const n=f*O;this._pageBuffer.set(l.subarray(n,n+a*j)),this._pageBuffer.set(o.packedHeader,O);const h=t*P,d=h%G,u=Math.floor(h/G);this.data.textureAtlas.update(d,u,this._pageBuffer),e.madeProgress()}else m=!0}f<u&&!m&&await this._frameTask.schedule(g)};if(await this._frameTask.schedule(g),m)return W().warnOnce("ran out of gaussian splat memory"),{memUsageBytes:0,numGaussians:0};const _=new Float32Array(3*s),y=new Float32Array(s),w=2.048,v=o.tileOrigin.x*w,S=o.tileOrigin.y*w,C=o.tileOrigin.z*w,b=o.invPosScale;let x=null;if(t.desc.obb){const e=t.desc.obb.quaternion;x=new F(t.desc.obb.center,t.desc.obb.halfSize,h(...e))}x||(W().warnOnce("encountered tile without a bounding box"),x=new F);const I=x.centerX,H=x.centerY,M=x.centerZ,E=new A,T=this.view.state.isGlobal,R=T?d(this.view.spatialReference).radius:0;let V=0,L=0,k=0;const D=async e=>{for(;k<s&&!e.done;k++){const t=k*j,{rawX:i,rawY:s,rawZ:a}=this._extractGaussianPosition(l,t),r=this._extractGaussianSphericalScale(l,t),n=i*b+v,o=s*b+S,h=a*b+C;_[V]=n-I,_[V+1]=o-H,_[V+2]=h-M;const d=T?Math.sqrt(n*n+o*o+h*h)-R:h;E.expandElevationRangeValues(d,d),y[k]=r*r,L=Math.max(L,r),V+=3,e.madeProgress()}k<s&&await this._frameTask.schedule(D)};await this._frameTask.schedule(D);const{fullExtent:N}=this.layer;N?.hasZ&&N.zmax&&N.zmin&&(E.minElevation=Math.max(E.minElevation,N.zmin),E.maxElevation=Math.min(E.maxElevation,N.zmax));const z=new B(e.handle,x,c,p,_,y,L,E);return this._memCache.put(`${z.handle}`,z),this._tileHandles.set(e.handle,z),this._cacheMemory+=z.usedMemory,{memUsageBytes:z.usedMemory,numGaussians:s}}_extractGaussianPosition(e,t){const i=e[t+1];return{rawX:16383&i,rawY:i>>>14&16383,rawZ:i>>>28&15|(1023&e[t+2])<<4}}_extractGaussianSphericalScale(e,t){const i=e[t+2],s=i>>>10&255,a=i>>>18&255,r=i>>>26&63|(3&e[t+3])<<6,n=Math.exp(s/16-10),l=Math.exp(a/16-10),o=Math.exp(r/16-10);return Math.max(n,l,o)}freeRenderable(e){this._tileFadeInsAwaitingInitialSort.delete(e),this._tileFadeOutsAwaitingInitialSort.delete(e);const t=this._tileHandles.get(e);t&&(0!==t.lifecycleState?(this.fadeHelper.onTileDiscarded(t),this._usedMemory-=t.usedMemory):this._cacheMemory-=t.usedMemory,t.pageIds.forEach(e=>this.data.textureAtlas.freePage(e)),this.freeObject(t),this._tileHandles.delete(e)),this.updateGaussians()}freeObject(e){this._memCache.pop(`${e.handle}`)}notifyTileObbsChanged(e){this._elevationProvider&&this._elevationProvider.notifyObjectsChangedFunctional(t=>{for(const i of e)t(i.obb)})}setRenderableVisibility(e,t,i){const s=this._currentLyr3dVisibilityChange+1;let a=!1;for(let r=0;r<i;r++){const i=this._tileHandles.get(e[r]);if(!i)continue;const n=t[r]?this._prepareTileFadeIn(i,s):this._prepareTileFadeOut(i,s);a||=n}a&&(this._currentLyr3dVisibilityChange=s,this.updateGaussians())}_prepareTileFadeIn(e,t){const i=this._tileFadeOutsAwaitingInitialSort.delete(e.handle);return 2===e.lifecycleState?(this.fadeHelper.fadeTile(e,0),i):this._tileFadeInsAwaitingInitialSort.get(e.handle)!==t?(0===e.lifecycleState&&this._popTileFromCache(e),e.lifecycleState=1,this._tileFadeInsAwaitingInitialSort.set(e.handle,t),!0):i}_prepareTileFadeOut(e,t){const i=this._tileFadeInsAwaitingInitialSort.delete(e.handle);return i&&1===e.lifecycleState&&(this.moveTileToCache(e),e.lifecycleState=0),2!==e.lifecycleState?i:this._tileFadeOutsAwaitingInitialSort.get(e.handle)!==t?(this._tileFadeOutsAwaitingInitialSort.set(e.handle,t),!0):i}_onSortComplete(e,t){const i=this._tmpTilesWithChangedVisibility;i.length=0;const s=this._tmpSortedTileHandles;s.clear();for(let r=0;r<e.length;r++){const t=e[r];s.add(t.handle)}let a=this._triggerFadeIns(t,s,i);a=this._triggerFadeOuts(t,i),s.clear(),i.length>0&&this.notifyTileObbsChanged(i),a&&this.updateGaussians()}_triggerFadeIns(e,t,i){let s=!1;for(const[a,r]of this._tileFadeInsAwaitingInitialSort){if(r>e||!t.has(a))continue;const n=this._tileHandles.get(a);if(!n){this._tileFadeInsAwaitingInitialSort.delete(a);continue}const l=0===n.lifecycleState;2!==n.lifecycleState&&(n.lifecycleState=2,l&&this._popTileFromCache(n),i.push(n),s=!0),this.fadeHelper.fadeTile(n,0),this._tileFadeInsAwaitingInitialSort.delete(a)}return s}_triggerFadeOuts(e,t){let i=!1;for(const[s,a]of this._tileFadeOutsAwaitingInitialSort){if(a>e)continue;const r=this._tileHandles.get(s);if(r){const e=2===r.lifecycleState;this.fadeHelper.fadeTile(r,1),e&&0===r.lifecycleState&&(t.push(r),i=!0)}this._tileFadeOutsAwaitingInitialSort.delete(s)}return i}_popTileFromCache(e){this._usedMemory+=e.usedMemory,this._cacheMemory-=e.usedMemory,this._memCache.pop(`${e.handle}`)}moveTileToCache(e){this._usedMemory-=e.usedMemory,this._cacheMemory+=e.usedMemory,this._memCache.put(`${e.handle}`,e)}destroy(){H(this),this._suspendedHandle&&(this._suspendedHandle=i(this._suspendedHandle)),this._intersectionHandler&&(this.view.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler),this._intersectionHandler=null),this._elevationProvider&&this.view.elevationProvider&&(this._elevationProvider.notifyObjectsChangedFunctional(e=>{for(const t of this._tileHandles.values())e(t.obb)}),this.view.elevationProvider.unregister(this._elevationProvider),this._elevationProvider=null),this._frameTask.remove(),this._renderNode.destroy(),this.data.destroy(),this._memCache.destroy()}_canProjectWithoutEngine(){if(1===this.view.state.viewingMode)return!0;if(m(this.view.renderSpatialReference)||f(this.view.renderSpatialReference))return!0;if(this.layer.esriCrsSpatialReference&&g(this.layer.esriCrsSpatialReference,this.view.renderSpatialReference)){if(115700===this.layer.esriCrsSpatialReference.vcsWkid)return!1;let e=w(this.layer.esriCrsSpatialReference);if(!e){const t=this.layer.esriCrsSpatialReference;let i="meters";!_(t)&&t.wkid&&-1!==t.wkid&&(i=r(y.units[y[t.wkid]])),i&&(e=new u({heightModel:"gravity-related-height",heightUnit:i}))}const t=this.view.heightModelInfo;return this._useEsriCrs=0===p(e,t,!1),this._useEsriCrs&&(e&&(this._metersPerVCSUnit=n(1,e.heightUnit,"meters")),this.fullExtentInLocalViewSpatialReference=this.layer.esriCrsFullExtent),this._useEsriCrs}return!1}_elevationInfoChanged(e){if(e?.offset)if(this._useEsriCrs){const t=S(e?.unit)/this._metersPerVCSUnit,i=e?.offset??0;this._wasm?.setLayerOffset(this,i*t)}else this._wasm?.setLayerOffset(this,v(e));else this._wasm?.setLayerOffset(this,0)}_slicePlaneEnabledChanged(e){this._renderNode&&(this._renderNode.slicePlaneEnabled=e),this._intersectionHandler&&(this._intersectionHandler.slicePlaneEnabled=e)}updateGaussians(){const e=new Array;for(const t of this._tileHandles.values())0!==t.lifecycleState&&e.push(t);this.data.updateGaussianVisibility(e,this._currentLyr3dVisibilityChange),this.notifyChange("updating")}setMaximumGaussianCount(e){this._wasm?.setMaximumGaussianSplatCount(e)}_freeInvisibleTiles(){for(const e of this._tileHandles.values())0===e.lifecycleState&&this._deleteTile(e)}extractHeader(e){const t=e.length-4,i=this.reinterpretU32AsFloat(e[t]),s=this.reinterpretU32AsFloat(e[t+1]),a=this.reinterpretU32AsFloat(e[t+2]),r=1/(1<<(255&e[t+3]));return{packedHeader:e.subarray(t,t+4),tileOrigin:{x:i,y:s,z:a},invPosScale:r}}_deleteTile(e){this._wasm?.onRenderableEvicted(this,e.handle,e.usedMemory),this.freeRenderable(e.handle)}reinterpretU32AsFloat(e){return this._u32View[0]=e,this._f32View[0]}get performanceInfo(){let e=0,t=0;return this._tileHandles.forEach(i=>{0===i.lifecycleState?t++:e++}),new C(this.usedMemory,e,t,this.cachedMemory)}get test(){}};e([l()],$.prototype,"layer",void 0),e([l({readOnly:!0})],$.prototype,"_clippingBox",null),e([l()],$.prototype,"elevationOffset",null),e([l({readOnly:!0})],$.prototype,"visibleAtCurrentScale",null),e([l()],$.prototype,"fullExtentInLocalViewSpatialReference",void 0),$=e([o("esri.views.3d.layers.GaussianSplatLayerView3D")],$);const X=$;export{X as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{has}from"../../../../applications/Components/baUtils.js";import e from"../../../../core/Error.js";import{px2pt as t,pt2px as r}from"../../../../core/screenUtils.js";import{fromValues as i}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{copy as a}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{ZEROS as s,clone as o,ones as l}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import n from"../../../../geometry/Extent.js";import c from"../../../../geometry/Polygon.js";import{create as p,fromBuffer as h,intersectsClippingArea as m,empty as u,expandWithAABB as _,expandWithBuffer as y}from"../../../../geometry/support/aaBoundingBox.js";import{getDriverAxisSizeValueAny as d}from"../../../../renderers/support/renderingInfoUtils.js";import{sharedGeometryElevationAligner as g}from"./ElevationAligners.js";import{elevationModeChangeUpdateType as f,needsElevationUpdates2D as b}from"./elevationAlignmentUtils.js";import{Graphics3DDrapedGraphicLayer as v}from"./Graphics3DDrapedGraphicLayer.js";import{Graphics3DObject3DGraphicLayer as C}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as P,nanFallbackColor as M}from"./Graphics3DSymbolLayer.js";import{parseCapType as k,parseLineMarkerStyle as w}from"./lineUtils.js";import{initFastSymbolUpdatesState as S,updateFastSymbolUpdatesState as L,getAttributeValue as x,getSizeAttributeValue as z,ConvertOptions as U}from"../support/FastSymbolUpdates.js";import{debugFlags as j}from"../../support/debugFlags.js";import{createGeometry as V}from"../../support/engineContent/line.js";import{geometryToRenderInfo as O,geometryToRenderInfoDraped as A}from"../../support/renderInfoUtils/line.js";import{Object3D as E}from"../../webgl-engine/lib/Object3D.js";import{RenderGeometry as G}from"../../webgl-engine/lib/RenderGeometry.js";import{LineMarkerMaterial as D}from"../../webgl-engine/materials/LineMarkerMaterial.js";import{getStipplePatternForLinePattern as F}from"../../webgl-engine/materials/lineStippleUtils.js";import{RibbonLineMaterial as R}from"../../webgl-engine/materials/RibbonLineMaterial.js";const I=["polyline","polygon","extent"];class W extends P{static{this.elevationModeChangeTypes={definedChanged:2,staysOnTheGround:0,onTheGroundChanged:2}}constructor(e,t,r,i){super(e,t,r,i,T(t))}async doLoad(){this._fastUpdates=S(this._context.renderer,this._fastVisualVariableConvertOptions());const r=!0;if(this._fastMarkerUpdates=S(this._context.renderer,this._fastVisualVariableConvertOptions(r)),!this._drivenProperties.size){if((null!=this.symbolLayer.size?this.symbolLayer.size:t(1))<0)throw new e("graphics3dlinesymbollayer:invalid-size","Symbol sizes may not be negative values")}}_getMaterialParameters(e,t){const r=this._screenSizePerspective,{symbolLayer:i}=this,a={...this._getMaterialColorParameters(t),width:this._computeMaterialWidth(i?.size),polygonOffset:3,join:i.join||"miter",cap:k(i.cap||"butt"),hasSlicePlane:this._context.slicePlaneEnabled,isClosed:e,stipplePattern:F(i.pattern??i.imagePattern),emissiveStrength:this._emissiveStrength,screenSizePerspective:r};return 4===t&&this._fastMarkerUpdates?.visualVariables?{...a,...this._fastMarkerUpdates.materialParameters}:this._fastUpdates?.visualVariables?{...a,...this._fastUpdates.materialParameters}:a}_getMaterialColorParameters(e){const t=4===e,r=this._getCombinedOpacityAndColor(t&&this._markerColor||this._materialColor);return this._patternHidesLine&&!t&&(r[3]=0),{color:r}}get _materialColor(){return this.symbolLayer.material?.color}get _emissiveStrength(){if(has("enable-feature:emissive-on-none-volumetrics")){const e=this.symbolLayer.material?.emissive;return("color"===e?.source?e?.strength:void 0)??0}return 0}get _markerColor(){return this.symbolLayer.marker?.color}get _lineMaterial(){return null==this._materials[0]&&(this._materials[0]=new R(this._getMaterialParameters(!1,0),this.view.state.isGlobal)),this._materials[0]}get _ringMaterial(){return null==this._materials[1]&&(this._materials[1]=new R(this._getMaterialParameters(!0,1),this.view.state.isGlobal)),this._materials[1]}get _wireframeLineMaterial(){return null==this._materials[2]&&(this._materials[2]=new R({...this._getMaterialParameters(!1,2),wireframe:!0},this.view.state.isGlobal)),this._materials[2]}get _wireframeRingMaterial(){return null==this._materials[3]&&(this._materials[3]=new R({...this._getMaterialParameters(!0,3),wireframe:!0},this.view.state.isGlobal)),this._materials[3]}get _markerMaterial(){return null==this._materials[4]&&null!=this.symbolLayer.marker&&(this._materials[4]=new D({...this._getMaterialParameters(!1,4),placement:this.symbolLayer.marker.placement,markerPrimitive:w(this.symbolLayer.marker.style)},this.view.state.isGlobal)),this._materials[4]}_getDrivenSize(e){if(this._drivenProperties.size){const t=e.size;return null!=t?r(d(t.output)):this._getFallbackSize()}return 1}_getDrivenColor({color:e,opacity:t}){const r=l();return this._drivenProperties.color&&(a(r,e?.output??this._getFallbackOpacityAndColor(s)),null==t)||this._drivenProperties.opacity&&(e||this._materialColor)&&(r[3]=t?.output??this._getFallbackOpacity()),r}_getDrivenMarkerColor({color:e,opacity:t}){const r=l();return this._drivenProperties.color&&(a(r,e?.output??this._getFallbackMarkerOpacityAndColor(s)),null==t)||this._drivenProperties.opacity&&(e||this._markerColor||this._materialColor)&&(r[3]=t?.output??this._getFallbackMarkerOpacity()),r}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,I,this.symbolLayer.type))return null;const r=this.createElevationContextForGraphic(t);return this.ensureDrapedStatus("on-the-ground"===r.mode),this.draped?this._createAsOverlay(e):this._createAs3DShape(e,r,t.uid)}applyRendererDiff(e,t){for(const r in e.diff){if("visualVariables"!==r)return 0;{const e=this._fastUpdates;if(!L(e,t,this._fastVisualVariableConvertOptions()))return 0;for(const t of this._materials)t instanceof R&&t.setParameters(e.materialParameters);const r=this._fastMarkerUpdates,i=!0;if(!L(r,t,this._fastVisualVariableConvertOptions(i)))return 0;for(const t of this._materials)t instanceof D&&t.setParameters(r.materialParameters)}}return 2}prepareSymbolLayerPatch(e){if("partial"!==e.diff.type)return;const t=e.diff.diff,r={};"complete"===t.size?.type&&(r.width=this._computeMaterialWidth(t.size.newValue),delete t.size),"complete"===t.cap?.type&&(r.cap=k(t.cap.newValue??"butt"),delete t.cap);const i=this._prepareMarkerPatch(e,t);this._prepareMaterialPatch(e,t,i),e.symbolLayerStatePatches.push(()=>{for(const e of this._materials)e?.setParameters(r)})}layerOpacityChanged(){for(let e=0;e<5;e++)this._materials[e]?.setParameters(this._getMaterialColorParameters(e))}get _screenSizePerspective(){return!this.draped&&this._context.screenSizePerspectiveEnabled?this.view.screenSizePerspective.parameters:null}layerScreenSizePerspectiveChanged(){const e=this._screenSizePerspective;for(const t of this._materials)t?.setParameters({screenSizePerspective:e})}layerElevationInfoChanged(e,t,r){const i=this._elevationContext.mode,a=f(W.elevationModeChangeTypes,r,i);if(1!==a)return a;const s=b(i);return this.updateGraphics3DGraphicElevationInfo(e,t,()=>s)}slicePlaneEnabledChanged(){const e={hasSlicePlane:this._context.slicePlaneEnabled};for(const t of this._materials)t?.setParameters(e);return!0}physicalBasedRenderingChanged(){return!0}_createAs3DShape(e,t,r){const i=H(e.graphic.geometry),a="polygon"===i.type?i.rings:i.paths,s=new Array,o=p(),l=O(i,this._context.elevationProvider,this._context.renderCoordsHelper,t),n="polygon"===i.type?"rings":"paths";this._logGeometryCreationWarnings(l,a,n,"LineSymbol3DLayer");for(let p=0;p<l.lines.length;p++){const t=l.lines[p],a=t.position,n=t.mapPositions;if(null!=this._context.clippingExtent&&(h(n,o),!m(o,this._context.clippingExtent)))continue;const c=this._createGeometry("polygon"===i.type?this._ringMaterial:this._lineMaterial,e,a,n,i.type,1,r);if(s.push(c),j.LINE_WIREFRAMES&&s.push(c.instantiate({material:"polygon"===i.type?this._wireframeRingMaterial:this._wireframeLineMaterial})),null!=this._markerMaterial){const t=c.instantiate({material:this._markerMaterial});t.attributes.has("color")&&t.setAttributeData("color",this._getDrivenMarkerColor(e.renderingInfo)),s.push(t)}}if(0===s.length)return null;const c=this._context.layerViewUid,u=new E({geometries:s,castShadow:!1,layerViewUid:c,graphicUid:r}),_=new C(this,u,null,g,t);return _.alignedSampledElevation=l.sampledElevation,_.needsElevationUpdates=b(t.mode),_}_createGeometry(e,t,r,i,a,s,o){const l=0===s?{spatialReference:this._context.overlaySR,renderCoordsHelper:this._context.renderCoordsHelper}:null,n="polygon"===a,c=this._fastUpdates?.visualVariables.color,p=this._fastUpdates?.visualVariables.size,h=this._fastUpdates?.visualVariables.opacity,m=this._context.layerViewUid,u=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:o,layerViewUid:m}),{renderingInfo:_}=t,y={position:r,size:p?null:this._getDrivenSize(_),color:c?null:this._getDrivenColor(_),sizeFeature:p?z(p,_.size):null,colorFeature:c?x(c,_.color):null,opacityFeature:h?x(h,_.opacity):null};return V(e,{overlayInfo:l,removeDuplicateStartEnd:n,mapPositions:i,attributeData:y},u)}_createAsOverlay(e){const t=e.graphic,r=H(t.geometry),i="polygon"===r.type?r.rings:r.paths,a="polygon"===r.type?this._ringMaterial:this._lineMaterial;a.renderPriority=this._renderPriority;const s=j.LINE_WIREFRAMES?"polygon"===r.type?this._wireframeRingMaterial:this._wireframeLineMaterial:null,o=this._markerMaterial;null!=s&&(s.renderPriority=this._renderPriority-.001),null!=o&&(o.renderPriority=this._renderPriority-.002);const l=new Array,n=p(),c=u(),d=A(r,this._context.overlaySR),g="polygon"===r.type?"rings":"paths";this._logGeometryCreationWarnings(d,i,g,"LineSymbol3DLayer");for(const p of d.lines){if(h(p.position,n),!m(n,this._context.clippingExtent))continue;_(c,n);const i=this._createGeometry(a,e,p.position,void 0,r.type,0,t.uid),u=e=>{const r=this._context.layerViewUid,i=new G(e,{layerViewUid:r,graphicUid:t.uid});l.push(i)};if(null!=o){const t=i.instantiate({material:o});t.attributes.has("color")&&t.setAttributeData("color",this._getDrivenMarkerColor(e.renderingInfo)),u(t);const r=this.symbolLayer.marker.placement;"begin"!==r&&"begin-end"!==r||y(n,p.position,0,1),"end"!==r&&"begin-end"!==r||y(n,p.position,p.position.length-3,1)}u(i),j.LINE_WIREFRAMES&&u(i.instantiate({material:s}))}return new v(this,l,c,this._context.drapeSourceRenderer)}get _patternHidesLine(){const e=this.symbolLayer.pattern;return null!=e&&"style"===e.type&&"none"===e.style}_computeMaterialWidth(e){return e=e??t(1),this._drivenProperties.size?this._fastUpdates?.visualVariables.size?r(1):1:r(e)}_prepareMaterialPatch(e,t,r){const i=t.material;if(null==i)return void(r.changed&&r.useMaterialColor&&B(this._getCombinedOpacityAndColor(this._materialColor),this._materials[4],e));if("collection"===i.type)return;const a="complete"===i.type?i.newValue?.color:"complete"===i.diff.color?.type?i.diff.color.newValue:null,s=this._getCombinedOpacityAndColor(a);r.useMaterialColor&&B(o(s),this._materials[4],e),this._patternHidesLine&&(s[3]=0),B(s,this._materials[0],e),delete t.material}_prepareMarkerPatch(e,t){const r=t.marker,i=this._markerMaterial;if(null==r||"partial"!==r.type||null==r.diff||null!=r.diff.placement||null!=r.diff.style&&"complete"!==r.diff.style.type||null!=r.diff.color&&"complete"!==r.diff.color.type||null==i)return{changed:!1,useMaterialColor:null==this._markerColor};const a=r.diff.color,s=null!=a,o=s?a.newValue:null,l=null==o&&null==this._markerColor;o&&B(this._getCombinedOpacityAndColor(o),i,e);const n=r.diff.style?.newValue;return n&&e.symbolLayerStatePatches.push(()=>i.setParameters({markerPrimitive:w(n)})),delete t.marker,{changed:s,useMaterialColor:l}}_fastVisualVariableConvertOptions(e=!1){const t=this._getFallbackSize();return new U({supports:{size:!0,color:!0,rotation:!1,opacity:!0},fallbackColor:e?this._getFallbackMarkerOpacityAndColor(M):this._getFallbackOpacityAndColor(M),fallbackSize:i(t,t,t)})}_getFallbackOpacityAndColor(e){return this._materialColor?.toUnitRGBA()??e}_getFallbackOpacity(){return this._materialColor?.a??0}_getFallbackMarkerOpacityAndColor(e){return this.symbolLayer?.marker?.color?.toUnitRGBA()??this._getFallbackOpacityAndColor(e)}_getFallbackMarkerOpacity(){return this.symbolLayer?.marker?.color?.a??this._getFallbackOpacity()}_getFallbackSize(){const e=this.symbolLayer?.size;return null!=e?r(e):1}}function H(e){switch(e.type){case"extent":if(e instanceof n)return c.fromExtent(e);break;case"polygon":case"polyline":return e}return null}function B(e,t,r){null!=t&&r.symbolLayerStatePatches.push(()=>t.setParameters({color:e}))}function T(e){const t=e.material?.color,r=e.marker?.color??t;return 1===(t?.a??0)&&1===(r?.a??0)}export{W as Graphics3DLineSymbolLayer};
2
+ import{has}from"../../../../applications/Components/baUtils.js";import e from"../../../../core/Error.js";import{px2pt as t,pt2px as r}from"../../../../core/screenUtils.js";import{fromValues as i}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{copy as a}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{ZEROS as s,clone as o,ones as l}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import n from"../../../../geometry/Extent.js";import c from"../../../../geometry/Polygon.js";import{create as p,fromBuffer as h,intersectsClippingArea as m,empty as u,expandWithAABB as y,expandWithBuffer as _}from"../../../../geometry/support/aaBoundingBox.js";import{getDriverAxisSizeValueAny as d}from"../../../../renderers/support/renderingInfoUtils.js";import{sharedGeometryElevationAligner as f}from"./ElevationAligners.js";import{elevationModeChangeUpdateType as g,needsElevationUpdates2D as b}from"./elevationAlignmentUtils.js";import{Graphics3DDrapedGraphicLayer as v}from"./Graphics3DDrapedGraphicLayer.js";import{Graphics3DObject3DGraphicLayer as C}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as P,nanFallbackColor as M}from"./Graphics3DSymbolLayer.js";import{parseCapType as k,computeSymbolLayerIndex as w,parseLineMarkerStyle as S}from"./lineUtils.js";import{initFastSymbolUpdatesState as L,updateFastSymbolUpdatesState as x,getAttributeValue as z,getSizeAttributeValue as U,ConvertOptions as j}from"../support/FastSymbolUpdates.js";import{debugFlags as O}from"../../support/debugFlags.js";import{createGeometry as V}from"../../support/engineContent/line.js";import{geometryToRenderInfo as A,geometryToRenderInfoDraped as E}from"../../support/renderInfoUtils/line.js";import{Object3D as G}from"../../webgl-engine/lib/Object3D.js";import{RenderGeometry as D}from"../../webgl-engine/lib/RenderGeometry.js";import{LineMarkerMaterial as F}from"../../webgl-engine/materials/LineMarkerMaterial.js";import{getStipplePatternForLinePattern as R}from"../../webgl-engine/materials/lineStippleUtils.js";import{RibbonLineMaterial as I}from"../../webgl-engine/materials/RibbonLineMaterial.js";const W=["polyline","polygon","extent"];class H extends P{static{this.elevationModeChangeTypes={definedChanged:2,staysOnTheGround:0,onTheGroundChanged:2}}constructor(e,t,r,i){super(e,t,r,i,N(t))}async doLoad(){this._fastUpdates=L(this._context.renderer,this._fastVisualVariableConvertOptions());const r=!0;if(this._fastMarkerUpdates=L(this._context.renderer,this._fastVisualVariableConvertOptions(r)),!this._drivenProperties.size){if((null!=this.symbolLayer.size?this.symbolLayer.size:t(1))<0)throw new e("graphics3dlinesymbollayer:invalid-size","Symbol sizes may not be negative values")}}_getMaterialParameters(e,t){const r=this._screenSizePerspective,{symbolLayer:i}=this,a={...this._getMaterialColorParameters(t),width:this._computeMaterialWidth(i?.size),polygonOffset:3,polygonOffsetIndex:w(this._renderPriority,this._renderPriorityStep),join:i.join||"miter",cap:k(i.cap||"butt"),hasSlicePlane:this._context.slicePlaneEnabled,isClosed:e,stipplePattern:R(i.pattern??i.imagePattern),emissiveStrength:this._emissiveStrength,screenSizePerspective:r};return 4===t&&this._fastMarkerUpdates?.visualVariables?{...a,...this._fastMarkerUpdates.materialParameters}:this._fastUpdates?.visualVariables?{...a,...this._fastUpdates.materialParameters}:a}_getMaterialColorParameters(e){const t=4===e,r=this._getCombinedOpacityAndColor(t&&this._markerColor||this._materialColor);return this._patternHidesLine&&!t&&(r[3]=0),{color:r}}get _materialColor(){return this.symbolLayer.material?.color}get _emissiveStrength(){if(has("enable-feature:emissive-on-none-volumetrics")){const e=this.symbolLayer.material?.emissive;return("color"===e?.source?e?.strength:void 0)??0}return 0}get _markerColor(){return this.symbolLayer.marker?.color}get _lineMaterial(){return null==this._materials[0]&&(this._materials[0]=new I(this._getMaterialParameters(!1,0),this.view.state.isGlobal)),this._materials[0]}get _ringMaterial(){return null==this._materials[1]&&(this._materials[1]=new I(this._getMaterialParameters(!0,1),this.view.state.isGlobal)),this._materials[1]}get _wireframeLineMaterial(){return null==this._materials[2]&&(this._materials[2]=new I({...this._getMaterialParameters(!1,2),wireframe:!0},this.view.state.isGlobal)),this._materials[2]}get _wireframeRingMaterial(){return null==this._materials[3]&&(this._materials[3]=new I({...this._getMaterialParameters(!0,3),wireframe:!0},this.view.state.isGlobal)),this._materials[3]}get _markerMaterial(){return null==this._materials[4]&&null!=this.symbolLayer.marker&&(this._materials[4]=new F({...this._getMaterialParameters(!1,4),placement:this.symbolLayer.marker.placement,markerPrimitive:S(this.symbolLayer.marker.style)},this.view.state.isGlobal)),this._materials[4]}_getDrivenSize(e){if(this._drivenProperties.size){const t=e.size;return null!=t?r(d(t.output)):this._getFallbackSize()}return 1}_getDrivenColor({color:e,opacity:t}){const r=l();return this._drivenProperties.color&&(a(r,e?.output??this._getFallbackOpacityAndColor(s)),null==t)||this._drivenProperties.opacity&&(e||this._materialColor)&&(r[3]=t?.output??this._getFallbackOpacity()),r}_getDrivenMarkerColor({color:e,opacity:t}){const r=l();return this._drivenProperties.color&&(a(r,e?.output??this._getFallbackMarkerOpacityAndColor(s)),null==t)||this._drivenProperties.opacity&&(e||this._markerColor||this._materialColor)&&(r[3]=t?.output??this._getFallbackMarkerOpacity()),r}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,W,this.symbolLayer.type))return null;const r=this.createElevationContextForGraphic(t);return this.ensureDrapedStatus("on-the-ground"===r.mode),this.draped?this._createAsOverlay(e):this._createAs3DShape(e,r,t.uid)}applyRendererDiff(e,t){for(const r in e.diff){if("visualVariables"!==r)return 0;{const e=this._fastUpdates;if(!x(e,t,this._fastVisualVariableConvertOptions()))return 0;for(const t of this._materials)t instanceof I&&t.setParameters(e.materialParameters);const r=this._fastMarkerUpdates,i=!0;if(!x(r,t,this._fastVisualVariableConvertOptions(i)))return 0;for(const t of this._materials)t instanceof F&&t.setParameters(r.materialParameters)}}return 2}prepareSymbolLayerPatch(e){if("partial"!==e.diff.type)return;const t=e.diff.diff,r={};"complete"===t.size?.type&&(r.width=this._computeMaterialWidth(t.size.newValue),delete t.size),"complete"===t.cap?.type&&(r.cap=k(t.cap.newValue??"butt"),delete t.cap);const i=this._prepareMarkerPatch(e,t);this._prepareMaterialPatch(e,t,i),e.symbolLayerStatePatches.push(()=>{for(const e of this._materials)e?.setParameters(r)})}layerOpacityChanged(){for(let e=0;e<5;e++)this._materials[e]?.setParameters(this._getMaterialColorParameters(e))}get _screenSizePerspective(){return!this.draped&&this._context.screenSizePerspectiveEnabled?this.view.screenSizePerspective.parameters:null}layerScreenSizePerspectiveChanged(){const e=this._screenSizePerspective;for(const t of this._materials)t?.setParameters({screenSizePerspective:e})}layerElevationInfoChanged(e,t,r){const i=this._elevationContext.mode,a=g(H.elevationModeChangeTypes,r,i);if(1!==a)return a;const s=b(i);return this.updateGraphics3DGraphicElevationInfo(e,t,()=>s)}slicePlaneEnabledChanged(){const e={hasSlicePlane:this._context.slicePlaneEnabled};for(const t of this._materials)t?.setParameters(e);return!0}physicalBasedRenderingChanged(){return!0}_createAs3DShape(e,t,r){const i=B(e.graphic.geometry),a="polygon"===i.type?i.rings:i.paths,s=new Array,o=p(),l=A(i,this._context.elevationProvider,this._context.renderCoordsHelper,t),n="polygon"===i.type?"rings":"paths";this._logGeometryCreationWarnings(l,a,n,"LineSymbol3DLayer");for(let p=0;p<l.lines.length;p++){const t=l.lines[p],a=t.position,n=t.mapPositions;if(null!=this._context.clippingExtent&&(h(n,o),!m(o,this._context.clippingExtent)))continue;const c=this._createGeometry("polygon"===i.type?this._ringMaterial:this._lineMaterial,e,a,n,i.type,1,r);if(s.push(c),O.LINE_WIREFRAMES&&s.push(c.instantiate({material:"polygon"===i.type?this._wireframeRingMaterial:this._wireframeLineMaterial})),null!=this._markerMaterial){const t=c.instantiate({material:this._markerMaterial});t.attributes.has("color")&&t.setAttributeData("color",this._getDrivenMarkerColor(e.renderingInfo)),s.push(t)}}if(0===s.length)return null;const c=this._context.layerViewUid,u=new G({geometries:s,castShadow:!1,layerViewUid:c,graphicUid:r}),y=new C(this,u,null,f,t);return y.alignedSampledElevation=l.sampledElevation,y.needsElevationUpdates=b(t.mode),y}_createGeometry(e,t,r,i,a,s,o){const l=0===s?{spatialReference:this._context.overlaySR,renderCoordsHelper:this._context.renderCoordsHelper}:null,n="polygon"===a,c=this._fastUpdates?.visualVariables.color,p=this._fastUpdates?.visualVariables.size,h=this._fastUpdates?.visualVariables.opacity,m=this._context.layerViewUid,u=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:o,layerViewUid:m}),{renderingInfo:y}=t,_={position:r,size:p?null:this._getDrivenSize(y),color:c?null:this._getDrivenColor(y),sizeFeature:p?U(p,y.size):null,colorFeature:c?z(c,y.color):null,opacityFeature:h?z(h,y.opacity):null};return V(e,{overlayInfo:l,removeDuplicateStartEnd:n,mapPositions:i,attributeData:_},u)}_createAsOverlay(e){const t=e.graphic,r=B(t.geometry),i="polygon"===r.type?r.rings:r.paths,a="polygon"===r.type?this._ringMaterial:this._lineMaterial;a.renderPriority=this._renderPriority;const s=O.LINE_WIREFRAMES?"polygon"===r.type?this._wireframeRingMaterial:this._wireframeLineMaterial:null,o=this._markerMaterial;null!=s&&(s.renderPriority=this._renderPriority-.001),null!=o&&(o.renderPriority=this._renderPriority-.002);const l=new Array,n=p(),c=u(),d=E(r,this._context.overlaySR),f="polygon"===r.type?"rings":"paths";this._logGeometryCreationWarnings(d,i,f,"LineSymbol3DLayer");for(const p of d.lines){if(h(p.position,n),!m(n,this._context.clippingExtent))continue;y(c,n);const i=this._createGeometry(a,e,p.position,void 0,r.type,0,t.uid),u=e=>{const r=this._context.layerViewUid,i=new D(e,{layerViewUid:r,graphicUid:t.uid});l.push(i)};if(null!=o){const t=i.instantiate({material:o});t.attributes.has("color")&&t.setAttributeData("color",this._getDrivenMarkerColor(e.renderingInfo)),u(t);const r=this.symbolLayer.marker.placement;"begin"!==r&&"begin-end"!==r||_(n,p.position,0,1),"end"!==r&&"begin-end"!==r||_(n,p.position,p.position.length-3,1)}u(i),O.LINE_WIREFRAMES&&u(i.instantiate({material:s}))}return new v(this,l,c,this._context.drapeSourceRenderer)}get _patternHidesLine(){const e=this.symbolLayer.pattern;return null!=e&&"style"===e.type&&"none"===e.style}_computeMaterialWidth(e){return e=e??t(1),this._drivenProperties.size?this._fastUpdates?.visualVariables.size?r(1):1:r(e)}_prepareMaterialPatch(e,t,r){const i=t.material;if(null==i)return void(r.changed&&r.useMaterialColor&&T(this._getCombinedOpacityAndColor(this._materialColor),this._materials[4],e));if("collection"===i.type)return;const a="complete"===i.type?i.newValue?.color:"complete"===i.diff.color?.type?i.diff.color.newValue:null,s=this._getCombinedOpacityAndColor(a);r.useMaterialColor&&T(o(s),this._materials[4],e),this._patternHidesLine&&(s[3]=0),T(s,this._materials[0],e),delete t.material}_prepareMarkerPatch(e,t){const r=t.marker,i=this._markerMaterial;if(null==r||"partial"!==r.type||null==r.diff||null!=r.diff.placement||null!=r.diff.style&&"complete"!==r.diff.style.type||null!=r.diff.color&&"complete"!==r.diff.color.type||null==i)return{changed:!1,useMaterialColor:null==this._markerColor};const a=r.diff.color,s=null!=a,o=s?a.newValue:null,l=null==o&&null==this._markerColor;o&&T(this._getCombinedOpacityAndColor(o),i,e);const n=r.diff.style?.newValue;return n&&e.symbolLayerStatePatches.push(()=>i.setParameters({markerPrimitive:S(n)})),delete t.marker,{changed:s,useMaterialColor:l}}_fastVisualVariableConvertOptions(e=!1){const t=this._getFallbackSize();return new j({supports:{size:!0,color:!0,rotation:!1,opacity:!0},fallbackColor:e?this._getFallbackMarkerOpacityAndColor(M):this._getFallbackOpacityAndColor(M),fallbackSize:i(t,t,t)})}_getFallbackOpacityAndColor(e){return this._materialColor?.toUnitRGBA()??e}_getFallbackOpacity(){return this._materialColor?.a??0}_getFallbackMarkerOpacityAndColor(e){return this.symbolLayer?.marker?.color?.toUnitRGBA()??this._getFallbackOpacityAndColor(e)}_getFallbackMarkerOpacity(){return this.symbolLayer?.marker?.color?.a??this._getFallbackOpacity()}_getFallbackSize(){const e=this.symbolLayer?.size;return null!=e?r(e):1}}function B(e){switch(e.type){case"extent":if(e instanceof n)return c.fromExtent(e);break;case"polygon":case"polyline":return e}return null}function T(e,t,r){null!=t&&r.symbolLayerStatePatches.push(()=>t.setParameters({color:e}))}function N(e){const t=e.material?.color,r=e.marker?.color??t;return 1===(t?.a??0)&&1===(r?.a??0)}export{H as Graphics3DLineSymbolLayer};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import has from"../../../../core/has.js";import{pt2px as e}from"../../../../core/screenUtils.js";import{e as t}from"../../../../chunks/earcut.js";import{ZEROS as r}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{fromBuffer as i,intersectsClippingArea as s,empty as o,expandWithAABB as n,create as a}from"../../../../geometry/support/aaBoundingBox.js";import{newDoubleArray as l}from"../../../../geometry/support/DoubleArray.js";import{newFloatArray as c,floatSubArray as p}from"../../../../geometry/support/FloatArray.js";import{elevationModeChangeUpdateType as h,needsElevationUpdates2D as u}from"./elevationAlignmentUtils.js";import{Graphics3DDrapedGraphicLayer as m}from"./Graphics3DDrapedGraphicLayer.js";import{Graphics3DObject3DGraphicLayer as d}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as _}from"./Graphics3DSymbolLayer.js";import{mixinColorAndOpacity as g}from"./graphicUtils.js";import{parseCapType as y}from"./lineUtils.js";import{geometryAsPolygon as f,createIndices3D as v,createColorGeometry as b,PolygonCreationDataBase as S}from"./polygonUtils.js";import{initFastSymbolUpdatesState as x,updateFastSymbolUpdatesState as C,getAttributeValue as P,ConvertOptions as D}from"../support/FastSymbolUpdates.js";import{createMaterial as O,uvElevationAligner as U}from"../support/patternUtils.js";import{createMapSpaceUVCoords as j,createMapSpaceUVCoordsDraped as w}from"../support/uvUtils.js";import{createGeometry as G}from"../../support/engineContent/line.js";import{polygonToRenderInfo as A,polygonToRenderInfoDraped as E}from"../../support/renderInfoUtils/polygon.js";import{Object3D as L}from"../../webgl-engine/lib/Object3D.js";import{RenderGeometry as M}from"../../webgl-engine/lib/RenderGeometry.js";import{isScreenSizePerspectiveEnabled as V}from"../../webgl-engine/lib/screenSizePerspectiveUtils.js";import{getStipplePatternForLinePattern as R}from"../../webgl-engine/materials/lineStippleUtils.js";import{PatternMaterial as I}from"../../webgl-engine/materials/PatternMaterial.js";import{RibbonLineMaterial as z}from"../../webgl-engine/materials/RibbonLineMaterial.js";const B=["polyline","polygon","extent"];class F extends _{static{this.elevationModeChangeTypes={definedChanged:2,staysOnTheGround:0,onTheGroundChanged:2}}constructor(e,t,r,i){super(e,t,r,i,q(t)),this._needsUV=!1,this._materials=[]}async doLoad(){this._fastUpdates=x(this._context.renderer,this._vvConvertOptions)}get _materialColor(){return this.symbolLayer.material?.color}get _emissiveStrength(){if(has("enable-feature:emissive-on-none-volumetrics")){const e=this.symbolLayer.material?.emissive;return("color"===e?.source?e?.strength:void 0)??0}return 0}_createMaterials(){if(this._materials.length>0)return;const t=this._materialColor,r=this._getCombinedOpacityAndColor(t);this._materials[0]=O(this.symbolLayer,{color:r,forceTransparentMode:this.needsDrivenTransparentPass,discardInvisibleFragments:!0,hasVertexColors:this._drivenProperties.color||this._drivenProperties.opacity,draped:this.draped,hasSlicePlane:this._context.slicePlaneEnabled,emissiveStrength:this._emissiveStrength,...this._fastUpdates?.materialParameters}),this._needsUV=this._materials[0]instanceof I;const i=this.symbolLayer.outline;if(W(i)){const t=R(i.pattern);this._materials[1]=new z({width:e(i.size),color:this._getOutlineColor(),polygonOffset:3,hasSlicePlane:this._context.slicePlaneEnabled,isClosed:!0,stipplePattern:t,cap:y(i.patternCap||"butt"),screenSizePerspective:this._outlineScreenSizePerspective},this.view.state.isGlobal)}}get _outlineScreenSizePerspective(){return!this.draped&&V(this._context.layer.screenSizePerspectiveEnabled)?this.view.screenSizePerspective.parameters:null}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,B,this.symbolLayer.type))return null;const r=this._getDrivenUInt8Color(e.renderingInfo,this._materialColor,!1),i=this.createElevationContextForGraphic(t);return this.ensureDrapedStatus("on-the-ground"===i.mode),this._createMaterials(),this.draped?this._createAsOverlay(e.renderingInfo,t,r):this._createAs3DShape(e.renderingInfo,t,r,i)}applyRendererDiff(e,t){for(const r in e.diff){if("visualVariables"!==r)return 0;if(!C(this._fastUpdates,t,this._vvConvertOptions))return 0;this._materials[0]?.setParameters(this._fastUpdates.materialParameters)}return 2}layerOpacityChanged(){if(null!=this._materials[0]){const e=this._materials[0].parameters.color,t=this._materialColor,r=this._getCombinedOpacity(t);this._materials[0].setParameters({color:[e[0],e[1],e[2],r],forceTransparentMode:this.needsDrivenTransparentPass})}if(null!=this._materials[1]){const e=this._materials[1].parameters.color;this._materials[1].setParameters({color:[e[0],e[1],e[2],this._getOutlineOpacity()]})}}layerScreenSizePerspectiveChanged(){this._materials[1]?.setParameters({screenSizePerspective:this._outlineScreenSizePerspective})}layerElevationInfoChanged(e,t,r){const i=this._elevationContext.mode,s=h(F.elevationModeChangeTypes,r,i);if(1!==s)return s;const o=u(i);return this.updateGraphics3DGraphicElevationInfo(e,t,()=>o)}slicePlaneEnabledChanged(){if(this._materials[0]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),this._materials[1]){const e={hasSlicePlane:this._context.slicePlaneEnabled};this._materials[1].setParameters(e)}return!0}physicalBasedRenderingChanged(){return!0}_createAs3DShape(e,t,r,i){const s=f(t.geometry);if(!s)return null;const o=A(s,this._context.elevationProvider,this._context.renderCoordsHelper,i),n=new H(o,r,this._context.layerViewUid,t.uid),a=n.renderData.position.length/3;if(this._needsUV&&(n.uvMapSpace=c(4*a,!0),n.boundingRect=l(9),j(n.uvMapSpace,n.boundingRect,n.renderData.position,this._context.renderCoordsHelper)),n.olidColor=this._context.stage.renderView?.getObjectAndLayerIdColor(n),this._createAs3DShapeFill(e,n),this._materials[1]&&this._createAs3DShapeOutline(n),this._logGeometryCreationWarnings(n.renderData,s.rings,"rings","FillSymbol3DLayer"),0===n.outGeometries.length)return null;const p=new L({geometries:n.outGeometries,castShadow:!1,layerViewUid:this._context.layerViewUid,graphicUid:t.uid}),h=new d(this,p,null,U,i);return h.alignedSampledElevation=n.renderData.sampledElevation,h.needsElevationUpdates=u(i.mode),h}_createAs3DShapeFill(e,t){const r=t.renderData.polygons;for(const{position:o,mapPositions:n,holeIndices:a,index:l,count:c}of r){if(null!=this._context.clippingExtent&&(i(n,T),!s(T,this._context.clippingExtent)))continue;const r=v(n,a,this._context.elevationProvider.spatialReference);if(0===r.length)continue;const h=this._fastUpdates?.visualVariables.color,u=b({material:this._materials[0],indices:r,mapPositions:n,attributeData:{position:o,color:h?null:t.color,colorFeature:h?P(h,e.color):null,uvMapSpace:this._needsUV?p(t.uvMapSpace,4*l,4*c):null,boundingRect:this._needsUV?t.boundingRect:null,olidColor:t.olidColor}});t.outGeometries.push(u)}}_createAs3DShapeOutline(e){if(null==this._materials[1])return;const t=e.renderData.outlines;for(const{mapPositions:r,position:o}of t){if(null!=this._context.clippingExtent&&(i(r,T),!s(T,this._context.clippingExtent)))continue;const t=G(this._materials[1],{overlayInfo:null,removeDuplicateStartEnd:!0,mapPositions:r,attributeData:{position:o}},e.olidColor);e.outGeometries.push(t)}}_createAsOverlay(e,t,r){const i=f(t.geometry);if(null==i)return null;this._materials[0].renderPriority=this._renderPriority+this._renderPriorityStep/2,null!=this._materials[1]&&(this._materials[1].renderPriority=this._renderPriority);const s=E(i,this._context.overlaySR),n=new k(s,r,this._context.layerViewUid,t.uid),a=n.renderData.position.length/3;return this._needsUV&&(n.uvMapSpace=c(4*a,!0),w(n.uvMapSpace,n.renderData.position,this._context.overlaySR,this._context.graphicsCoreOwner.view.state.viewingMode)),n.outBoundingBox=o(),n.olidColor=this._context.stage.renderView?.getObjectAndLayerIdColor(n),this._createAsOverlayFill(e,n),this._materials[1]&&this._createAsOverlayOutline(n),this._logGeometryCreationWarnings(n.renderData,i.rings,"rings","FillSymbol3DLayer"),0===n.outGeometries.length?null:new m(this,n.outGeometries,n.outBoundingBox,this._context.drapeSourceRenderer)}_createAsOverlayFill(e,r){const o=r.renderData.polygons;for(const{position:a,holeIndices:l,index:c,count:h}of o){const o=i(a,T);if(!s(o,this._context.clippingExtent))continue;const u=t(a,l,3);if(0===u.length)continue;n(r.outBoundingBox,o);const m=this._fastUpdates?.visualVariables.color,d=b({material:this._materials[0],indices:u,attributeData:{position:a,color:m?null:r.color,colorFeature:m?P(m,e.color):null,uvMapSpace:this._needsUV?p(r.uvMapSpace,4*c,4*h):null,olidColor:r.olidColor}});r.outGeometries.push(new M(d,r))}}_createAsOverlayOutline(e){if(null==this._materials[1])return;const t=e.renderData.outlines;for(let r=0;r<t.length;++r){const{position:o}=t[r];if(i(o,T),!s(T,this._context.clippingExtent))continue;n(e.outBoundingBox,T);const a=G(this._materials[1],{overlayInfo:{spatialReference:this._context.overlaySR,renderCoordsHelper:this._context.renderCoordsHelper},removeDuplicateStartEnd:!0,attributeData:{position:o}},e.olidColor);e.outGeometries.push(new M(a,e))}}_getOutlineOpacity(){const e=this.symbolLayer?.outline?.color;return(this.draped?1:this._getLayerOpacity())*(null!=e?e.a:0)}_getOutlineColor(){const e=this.symbolLayer?.outline?.color,t=this._getOutlineOpacity();return g(e?.toUnitRGB(),t)}test(){return{...super.test(),createAsOverlay:(e,t,r)=>this._createAsOverlay(e,t,r),createAs3DShape:(e,t,r,i)=>this._createAs3DShape(e,t,r,i)}}get _vvConvertOptions(){return new D({supports:{size:!1,color:!0,rotation:!1,opacity:!1},fallbackColor:this._materialColor?.toUnitRGBA()??r})}}const T=a();class H extends S{constructor(e,t,r,i){super(e,r,i),this.color=t}}class k extends S{constructor(e,t,r,i){super(e,r,i),this.color=t}}function W(e){return null!=e?.size&&e.size>0&&null!=e.color&&(null==e.pattern||"style"!==e.pattern.type||"none"!==e.pattern.style)}function q(e){return 1===(e.material?.color?.a??0)}export{F as Graphics3DPolygonFillSymbolLayer};
2
+ import has from"../../../../core/has.js";import{pt2px as e}from"../../../../core/screenUtils.js";import{e as t}from"../../../../chunks/earcut.js";import{ZEROS as r}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{fromBuffer as i,intersectsClippingArea as s,empty as o,expandWithAABB as n,create as a}from"../../../../geometry/support/aaBoundingBox.js";import{newDoubleArray as l}from"../../../../geometry/support/DoubleArray.js";import{newFloatArray as c,floatSubArray as p}from"../../../../geometry/support/FloatArray.js";import{elevationModeChangeUpdateType as h,needsElevationUpdates2D as u}from"./elevationAlignmentUtils.js";import{Graphics3DDrapedGraphicLayer as d}from"./Graphics3DDrapedGraphicLayer.js";import{Graphics3DObject3DGraphicLayer as m}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as _}from"./Graphics3DSymbolLayer.js";import{mixinColorAndOpacity as g}from"./graphicUtils.js";import{parseCapType as y,computeSymbolLayerIndex as f}from"./lineUtils.js";import{geometryAsPolygon as v,createIndices3D as b,createColorGeometry as S,PolygonCreationDataBase as x}from"./polygonUtils.js";import{initFastSymbolUpdatesState as C,updateFastSymbolUpdatesState as P,getAttributeValue as D,ConvertOptions as O}from"../support/FastSymbolUpdates.js";import{createMaterial as U,uvElevationAligner as j}from"../support/patternUtils.js";import{createMapSpaceUVCoords as w,createMapSpaceUVCoordsDraped as G}from"../support/uvUtils.js";import{createGeometry as A}from"../../support/engineContent/line.js";import{polygonToRenderInfo as E,polygonToRenderInfoDraped as L}from"../../support/renderInfoUtils/polygon.js";import{Object3D as M}from"../../webgl-engine/lib/Object3D.js";import{RenderGeometry as V}from"../../webgl-engine/lib/RenderGeometry.js";import{isScreenSizePerspectiveEnabled as R}from"../../webgl-engine/lib/screenSizePerspectiveUtils.js";import{getStipplePatternForLinePattern as I}from"../../webgl-engine/materials/lineStippleUtils.js";import{PatternMaterial as z}from"../../webgl-engine/materials/PatternMaterial.js";import{RibbonLineMaterial as B}from"../../webgl-engine/materials/RibbonLineMaterial.js";const F=["polyline","polygon","extent"];class T extends _{static{this.elevationModeChangeTypes={definedChanged:2,staysOnTheGround:0,onTheGroundChanged:2}}constructor(e,t,r,i){super(e,t,r,i,J(t)),this._needsUV=!1,this._materials=[]}async doLoad(){this._fastUpdates=C(this._context.renderer,this._vvConvertOptions)}get _materialColor(){return this.symbolLayer.material?.color}get _emissiveStrength(){if(has("enable-feature:emissive-on-none-volumetrics")){const e=this.symbolLayer.material?.emissive;return("color"===e?.source?e?.strength:void 0)??0}return 0}_createMaterials(){if(this._materials.length>0)return;const t=this._materialColor,r=this._getCombinedOpacityAndColor(t);this._materials[0]=U(this.symbolLayer,{color:r,forceTransparentMode:this.needsDrivenTransparentPass,discardInvisibleFragments:!0,hasVertexColors:this._drivenProperties.color||this._drivenProperties.opacity,draped:this.draped,hasSlicePlane:this._context.slicePlaneEnabled,emissiveStrength:this._emissiveStrength,...this._fastUpdates?.materialParameters}),this._needsUV=this._materials[0]instanceof z;const i=this.symbolLayer.outline;if(q(i)){const t=I(i.pattern);this._materials[1]=new B({width:e(i.size),color:this._getOutlineColor(),polygonOffset:3,polygonOffsetIndex:f(this._renderPriority,this._renderPriorityStep),hasSlicePlane:this._context.slicePlaneEnabled,isClosed:!0,stipplePattern:t,cap:y(i.patternCap||"butt"),screenSizePerspective:this._outlineScreenSizePerspective},this.view.state.isGlobal)}}get _outlineScreenSizePerspective(){return!this.draped&&R(this._context.layer.screenSizePerspectiveEnabled)?this.view.screenSizePerspective.parameters:null}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,F,this.symbolLayer.type))return null;const r=this._getDrivenUInt8Color(e.renderingInfo,this._materialColor,!1),i=this.createElevationContextForGraphic(t);return this.ensureDrapedStatus("on-the-ground"===i.mode),this._createMaterials(),this.draped?this._createAsOverlay(e.renderingInfo,t,r):this._createAs3DShape(e.renderingInfo,t,r,i)}applyRendererDiff(e,t){for(const r in e.diff){if("visualVariables"!==r)return 0;if(!P(this._fastUpdates,t,this._vvConvertOptions))return 0;this._materials[0]?.setParameters(this._fastUpdates.materialParameters)}return 2}layerOpacityChanged(){if(null!=this._materials[0]){const e=this._materials[0].parameters.color,t=this._materialColor,r=this._getCombinedOpacity(t);this._materials[0].setParameters({color:[e[0],e[1],e[2],r],forceTransparentMode:this.needsDrivenTransparentPass})}if(null!=this._materials[1]){const e=this._materials[1].parameters.color;this._materials[1].setParameters({color:[e[0],e[1],e[2],this._getOutlineOpacity()]})}}layerScreenSizePerspectiveChanged(){this._materials[1]?.setParameters({screenSizePerspective:this._outlineScreenSizePerspective})}layerElevationInfoChanged(e,t,r){const i=this._elevationContext.mode,s=h(T.elevationModeChangeTypes,r,i);if(1!==s)return s;const o=u(i);return this.updateGraphics3DGraphicElevationInfo(e,t,()=>o)}slicePlaneEnabledChanged(){if(this._materials[0]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),this._materials[1]){const e={hasSlicePlane:this._context.slicePlaneEnabled};this._materials[1].setParameters(e)}return!0}physicalBasedRenderingChanged(){return!0}_createAs3DShape(e,t,r,i){const s=v(t.geometry);if(!s)return null;const o=E(s,this._context.elevationProvider,this._context.renderCoordsHelper,i),n=new k(o,r,this._context.layerViewUid,t.uid),a=n.renderData.position.length/3;if(this._needsUV&&(n.uvMapSpace=c(4*a,!0),n.boundingRect=l(9),w(n.uvMapSpace,n.boundingRect,n.renderData.position,this._context.renderCoordsHelper)),n.olidColor=this._context.stage.renderView?.getObjectAndLayerIdColor(n),this._createAs3DShapeFill(e,n),this._materials[1]&&this._createAs3DShapeOutline(n),this._logGeometryCreationWarnings(n.renderData,s.rings,"rings","FillSymbol3DLayer"),0===n.outGeometries.length)return null;const p=new M({geometries:n.outGeometries,castShadow:!1,layerViewUid:this._context.layerViewUid,graphicUid:t.uid}),h=new m(this,p,null,j,i);return h.alignedSampledElevation=n.renderData.sampledElevation,h.needsElevationUpdates=u(i.mode),h}_createAs3DShapeFill(e,t){const r=t.renderData.polygons;for(const{position:o,mapPositions:n,holeIndices:a,index:l,count:c}of r){if(null!=this._context.clippingExtent&&(i(n,H),!s(H,this._context.clippingExtent)))continue;const r=b(n,a,this._context.elevationProvider.spatialReference);if(0===r.length)continue;const h=this._fastUpdates?.visualVariables.color,u=S({material:this._materials[0],indices:r,mapPositions:n,attributeData:{position:o,color:h?null:t.color,colorFeature:h?D(h,e.color):null,uvMapSpace:this._needsUV?p(t.uvMapSpace,4*l,4*c):null,boundingRect:this._needsUV?t.boundingRect:null,olidColor:t.olidColor}});t.outGeometries.push(u)}}_createAs3DShapeOutline(e){if(null==this._materials[1])return;const t=e.renderData.outlines;for(const{mapPositions:r,position:o}of t){if(null!=this._context.clippingExtent&&(i(r,H),!s(H,this._context.clippingExtent)))continue;const t=A(this._materials[1],{overlayInfo:null,removeDuplicateStartEnd:!0,mapPositions:r,attributeData:{position:o}},e.olidColor);e.outGeometries.push(t)}}_createAsOverlay(e,t,r){const i=v(t.geometry);if(null==i)return null;this._materials[0].renderPriority=this._renderPriority+this._renderPriorityStep/2,null!=this._materials[1]&&(this._materials[1].renderPriority=this._renderPriority);const s=L(i,this._context.overlaySR),n=new W(s,r,this._context.layerViewUid,t.uid),a=n.renderData.position.length/3;return this._needsUV&&(n.uvMapSpace=c(4*a,!0),G(n.uvMapSpace,n.renderData.position,this._context.overlaySR,this._context.graphicsCoreOwner.view.state.viewingMode)),n.outBoundingBox=o(),n.olidColor=this._context.stage.renderView?.getObjectAndLayerIdColor(n),this._createAsOverlayFill(e,n),this._materials[1]&&this._createAsOverlayOutline(n),this._logGeometryCreationWarnings(n.renderData,i.rings,"rings","FillSymbol3DLayer"),0===n.outGeometries.length?null:new d(this,n.outGeometries,n.outBoundingBox,this._context.drapeSourceRenderer)}_createAsOverlayFill(e,r){const o=r.renderData.polygons;for(const{position:a,holeIndices:l,index:c,count:h}of o){const o=i(a,H);if(!s(o,this._context.clippingExtent))continue;const u=t(a,l,3);if(0===u.length)continue;n(r.outBoundingBox,o);const d=this._fastUpdates?.visualVariables.color,m=S({material:this._materials[0],indices:u,attributeData:{position:a,color:d?null:r.color,colorFeature:d?D(d,e.color):null,uvMapSpace:this._needsUV?p(r.uvMapSpace,4*c,4*h):null,olidColor:r.olidColor}});r.outGeometries.push(new V(m,r))}}_createAsOverlayOutline(e){if(null==this._materials[1])return;const t=e.renderData.outlines;for(let r=0;r<t.length;++r){const{position:o}=t[r];if(i(o,H),!s(H,this._context.clippingExtent))continue;n(e.outBoundingBox,H);const a=A(this._materials[1],{overlayInfo:{spatialReference:this._context.overlaySR,renderCoordsHelper:this._context.renderCoordsHelper},removeDuplicateStartEnd:!0,attributeData:{position:o}},e.olidColor);e.outGeometries.push(new V(a,e))}}_getOutlineOpacity(){const e=this.symbolLayer?.outline?.color;return(this.draped?1:this._getLayerOpacity())*(null!=e?e.a:0)}_getOutlineColor(){const e=this.symbolLayer?.outline?.color,t=this._getOutlineOpacity();return g(e?.toUnitRGB(),t)}test(){return{...super.test(),createAsOverlay:(e,t,r)=>this._createAsOverlay(e,t,r),createAs3DShape:(e,t,r,i)=>this._createAs3DShape(e,t,r,i)}}get _vvConvertOptions(){return new O({supports:{size:!1,color:!0,rotation:!1,opacity:!1},fallbackColor:this._materialColor?.toUnitRGBA()??r})}}const H=a();class k extends x{constructor(e,t,r,i){super(e,r,i),this.color=t}}class W extends x{constructor(e,t,r,i){super(e,r,i),this.color=t}}function q(e){return null!=e?.size&&e.size>0&&null!=e.color&&(null==e.pattern||"style"!==e.pattern.type||"none"!==e.pattern.style)}function J(e){return 1===(e.material?.color?.a??0)}export{T as Graphics3DPolygonFillSymbolLayer};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- function r(r){switch(r){case"butt":return 0;case"square":return 1;case"round":return 2;default:return null}}function t(r){return"diamond"===r?"kite":r}export{r as parseCapType,t as parseLineMarkerStyle};
2
+ import{clamp as n}from"../../../../core/mathUtils.js";import{POLYGON_OFFSET_INDEX_COUNT as r}from"../../webgl-engine/shaders/RibbonLineTechniqueConfiguration.js";function e(n){switch(n){case"butt":return 0;case"square":return 1;case"round":return 2;default:return null}}function t(n){return"diamond"===n?"kite":n}function u(e,t){return n(Math.round((1-e)/t-1),0,r-1)}export{u as computeSymbolLayerIndex,e as parseCapType,t as parseLineMarkerStyle};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{reallocGrowthFactor as t}from"../../../../core/arrayUtils.js";import{abortMaybe as e}from"../../../../core/maybe.js";import{isAbortError as r}from"../../../../core/promiseUtils.js";import{signal as s}from"../../../../core/signal.js";import{Milliseconds as i,now as o}from"../../../../core/time.js";import{normalize as n}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{intersects as u}from"../../../../geometry/support/aaBoundingBox.js";import{intersectsSphere as l}from"../../../../geometry/support/frustum.js";import{Sphere as h}from"../../../../geometry/support/sphere.js";import{makeScheduleFunction as d}from"../../layers/support/makeScheduleFunction.js";import{GaussianSplatSortWorkerHandle as _}from"../GaussianSplatWorkerHandle.js";import{GaussianSplatFadeTexture as c}from"./GaussianSplatFadeTexture.js";import{GaussianSplatOrderTexture as f}from"./GaussianSplatOrderTexture.js";import{GaussianSplatTextureAtlas as m}from"./GaussianSplatTextureAtlas.js";import{TaskPriority as p}from"../../../support/Scheduler.js";class S{constructor(t){this._updating=s(!1),this._useDeterministicSort=!1,this.visibleGaussians=0,this._visibleGaussianTiles=new Array,this._bufferCapacity=0,this._minimumBoundingSphere=new h,this._cameraDirectionNormalized=a(),this._frameTask=null,this._workerHandle=null,this._sortAbortController=null,this._isSorting=!1,this._pendingSortTask=!1,this._scheduledSortStartTimeout=null,this._lastSortStartTime=i(-1/0),this._sortInterval=i(80),this._renderer=t,this._orderTexture=new f(this._renderer.renderingContext),this._fadingTexture=new c(this._renderer.renderingContext),this._textureAtlas=new m(this._renderer.renderingContext,this._renderer.view.resourceController.memoryController,this._renderer.fboCache);const{resourceController:e}=this._renderer.view;this._workerHandle=new _(d(e)),this._frameTask=e.scheduler.registerTask(p.GAUSSIAN_SPLAT_SORTING)}get textureAtlas(){return this._textureAtlas}get orderTexture(){return this._orderTexture}get fadingTexture(){return this._fadingTexture}get visibleGaussianTiles(){return this._visibleGaussianTiles}forEachTile(t){for(const e of this._visibleGaussianTiles)t(e)}updateGaussianVisibility(t){this._visibleGaussianTiles=t,this.requestSort()}get updating(){return this._updating.value}destroy(){this._sortAbortController=e(this._sortAbortController),this._pendingSortTask=!1,this._updating.value=!1,null!=this._scheduledSortStartTimeout&&(clearTimeout(this._scheduledSortStartTimeout),this._scheduledSortStartTimeout=null),this._frameTask.remove(),this._workerHandle?.destroyWorkerAndSelf(),this._textureAtlas.destroy(),this._orderTexture.destroy(),this._fadingTexture.destroy()}requestSort(){return this._updating.value=!0,!this._pendingSortTask&&(this._pendingSortTask=!0,this._scheduleSortStart(),!0)}_scheduleSortStart(){if(this._isSorting)return;const t=o()-this._lastSortStartTime,e=this._sortInterval-t;e<=0?this._startSortIfRequired():null==this._scheduledSortStartTimeout&&(this._scheduledSortStartTimeout=setTimeout(()=>{this._scheduledSortStartTimeout=null,this._pendingSortTask&&!this._isSorting&&this._scheduleSortStart()},e))}_startSortIfRequired(){if(this._isSorting||!this._pendingSortTask)return;const t=new AbortController;this._sortAbortController=t,this._isSorting=!0,this._pendingSortTask=!1,this._lastSortStartTime=o(),this._sortOnWorker(t.signal).finally(()=>{this._sortAbortController===t&&(this._sortAbortController=null),this._handleSortComplete()})}_handleSortComplete(){this._isSorting=!1,this._pendingSortTask?this._scheduleSortStart():this._updating.value=!1}_clearBuffersAndTextures(){this._atlasIndicesBuffer=void 0,this._sortedAtlasIndicesBuffer=void 0,this._distancesBuffer=void 0,this._sortOrderBuffer=void 0,this._bufferCapacity=0,this._orderTexture.clear(),this._textureAtlas.clear()}_computeExpandedCapacity(e,r){let s=Math.max(1,e);for(;s<r;)s=Math.ceil(s*t);return s}_ensureSortBufferCapacities(t){if(this._bufferCapacity<t){const e=this._computeExpandedCapacity(this._bufferCapacity,t);this._atlasIndicesBuffer=new Uint32Array(e),this._distancesBuffer=new Float64Array(e),this._sortOrderBuffer=new Uint32Array(e),this._bufferCapacity=e}}_ensureSortedAtlasIndicesBufferCapacity(t){if(!(t<=0)&&(!this._sortedAtlasIndicesBuffer||this._sortedAtlasIndicesBuffer.length<t)){const e=this._sortedAtlasIndicesBuffer?.length??0,r=this._computeExpandedCapacity(e,t);this._sortedAtlasIndicesBuffer=new Uint32Array(r)}}_clearAllBuffersAndTextures(){this._clearBuffersAndTextures(),this._workerHandle?.clear()}async _sortOnWorker(t){try{if(0===this._visibleGaussianTiles.length)return this.visibleGaussians=0,this._clearAllBuffersAndTextures(),void this._renderer.requestRender(1);this._useDeterministicSort&&this._visibleGaussianTiles.sort((t,e)=>t.obb.centerX-e.obb.centerX||t.obb.centerY-e.obb.centerY||t.obb.centerZ-e.obb.centerZ);const e=this._visibleGaussianTiles,r=e.length;let s=0;for(let t=0;t<r;t++)s+=e[t].gaussianAtlasIndices.length;this._ensureSortBufferCapacities(s),this._textureAtlas.ensureTextureAtlas();const{frustum:i}=this._renderer.camera;n(this._cameraDirectionNormalized,this._renderer.camera.ray.direction);const o=this._cameraDirectionNormalized[0],a=this._cameraDirectionNormalized[1],h=this._cameraDirectionNormalized[2];let d=0;const _=1.5,c=this._atlasIndicesBuffer,f=this._distancesBuffer,m=this._sortOrderBuffer,p=this._minimumBoundingSphere,S=p.center,T=this._renderer.clippingBox;for(let t=0;t<r;t++){const r=e[t],{gaussianAtlasIndices:s,relativePositions:n,obb:m,maxScale:g}=r,b=s.length;if(null!=T&&null!=r.boundingBox&&!u(r.boundingBox,T))continue;const{centerX:A,centerY:x,centerZ:B}=m;if(S[0]=A,S[1]=x,S[2]=B,p.radius=(m.radius+g)*_,!l(i,p))continue;c.set(s,d);const y=o*A+a*x+h*B,v=d+b;for(let t=d,e=0;t<v;t++,e+=3){const r=n[e],s=n[e+1],i=n[e+2];f[t]=r*o+s*a+i*h+y}d=v}for(let t=0;t<d;t++)m[t]=t;if(0===d)return this.visibleGaussians=0,this._clearAllBuffersAndTextures(),void this._renderer.requestRender(1);const g={distances:this._distancesBuffer,sortOrderIndices:this._sortOrderBuffer,numGaussians:d,preciseSort:this._useDeterministicSort},b=await(this._workerHandle?.sort(g,t));if(t.aborted)return;b&&(this._distancesBuffer=b.distances,this._sortOrderBuffer=b.sortedOrderIndices);const A=async t=>{const{paddedSize:e}=this._orderTexture.ensureCapacity(d);this._ensureSortedAtlasIndicesBufferCapacity(e);const r=this._atlasIndicesBuffer,s=this._sortOrderBuffer,i=this._sortedAtlasIndicesBuffer;for(let o=0;o<d;o++)i[o]=r[s[o]];this._orderTexture.setData(i,d),this.visibleGaussians=d,this._renderer.requestRender(1),t.madeProgress()};await this._frameTask.schedule(A,t)}catch(e){if(r(e))return}}set useDeterministicSort(t){this._useDeterministicSort=t}}export{S as GaussianSplatDataStore};
2
+ import{reallocGrowthFactor as t}from"../../../../core/arrayUtils.js";import{abortMaybe as e}from"../../../../core/maybe.js";import{isAbortError as s}from"../../../../core/promiseUtils.js";import{signal as r}from"../../../../core/signal.js";import{Milliseconds as i,now as a}from"../../../../core/time.js";import{normalize as o}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{intersects as l}from"../../../../geometry/support/aaBoundingBox.js";import{makeScheduleFunction as h}from"../../layers/support/makeScheduleFunction.js";import{GaussianSplatSortWorkerHandle as d}from"../GaussianSplatWorkerHandle.js";import{GaussianSplatFadeTexture as u}from"./GaussianSplatFadeTexture.js";import{GaussianSplatOrderTexture as _}from"./GaussianSplatOrderTexture.js";import{GaussianSplatTextureAtlas as c}from"./GaussianSplatTextureAtlas.js";import{TaskPriority as f}from"../../../support/Scheduler.js";class m{constructor(t,e){this._updating=r(!1),this._useDeterministicSort=!1,this.visibleGaussians=0,this._bufferCapacity=0,this._requestedLyr3dVisibilityChange=0,this._latestCompletedLyr3dVisibilityChange=0,this._latestUpdatedGaussianTiles=new Array,this._latestSortedGaussianTiles=new Array,this._nextCommittedVisibleGaussianTiles=new Array,this._cameraDirectionNormalized=n(),this._frameTask=null,this._workerHandle=null,this._sortAbortController=null,this._isSorting=!1,this._pendingSortTask=!1,this._scheduledSortStartTimeout=null,this._lastSortStartTime=i(-1/0),this._sortInterval=i(80),this._renderer=t,this._onSortComplete=e,this._orderTexture=new _(this._renderer.renderingContext),this._fadingTexture=new u(this._renderer.renderingContext),this._textureAtlas=new c(this._renderer.renderingContext,this._renderer.view.resourceController.memoryController,this._renderer.fboCache);const{resourceController:s}=this._renderer.view;this._workerHandle=new d(h(s)),this._frameTask=s.scheduler.registerTask(f.GAUSSIAN_SPLAT_SORTING)}get textureAtlas(){return this._textureAtlas}get orderTexture(){return this._orderTexture}get fadingTexture(){return this._fadingTexture}forEachTile(t){for(const e of this._latestUpdatedGaussianTiles)t(e)}updateGaussianVisibility(t,e){this._latestUpdatedGaussianTiles=t,this._requestedLyr3dVisibilityChange=e,this.requestSort()}get updating(){return this._updating.value}destroy(){this._sortAbortController=e(this._sortAbortController),this._pendingSortTask=!1,this._updating.value=!1,null!=this._scheduledSortStartTimeout&&(clearTimeout(this._scheduledSortStartTimeout),this._scheduledSortStartTimeout=null),this._frameTask.remove(),this._workerHandle?.destroyWorkerAndSelf(),this._textureAtlas.destroy(),this._orderTexture.destroy(),this._fadingTexture.destroy()}requestSort(){return this._updating.value=!0,!this._pendingSortTask&&(this._pendingSortTask=!0,this._scheduleSortStart(),!0)}_scheduleSortStart(){if(this._isSorting)return;const t=a()-this._lastSortStartTime,e=this._sortInterval-t;e<=0?this._startSortIfRequired():null==this._scheduledSortStartTimeout&&(this._scheduledSortStartTimeout=setTimeout(()=>{this._scheduledSortStartTimeout=null,this._pendingSortTask&&!this._isSorting&&this._scheduleSortStart()},e))}_startSortIfRequired(){if(this._isSorting||!this._pendingSortTask)return;const t=new AbortController;this._sortAbortController=t,this._isSorting=!0,this._pendingSortTask=!1,this._lastSortStartTime=a(),this._sortOnWorker(t.signal).finally(()=>{this._sortAbortController===t&&(this._sortAbortController=null),this._handleSortComplete()})}_handleSortComplete(){this._isSorting=!1,this._pendingSortTask?this._scheduleSortStart():this._updating.value=!1}_clearBuffersAndTextures(){this._atlasIndicesBuffer=void 0,this._sortedAtlasIndicesBuffer=void 0,this._distancesBuffer=void 0,this._sortOrderBuffer=void 0,this._bufferCapacity=0,this._orderTexture.clear(),this._textureAtlas.clear()}_computeExpandedCapacity(e,s){let r=Math.max(1,e);for(;r<s;)r=Math.ceil(r*t);return r}_ensureSortBufferCapacities(t){if(this._bufferCapacity<t){const e=this._computeExpandedCapacity(this._bufferCapacity,t);this._atlasIndicesBuffer=new Uint32Array(e),this._distancesBuffer=new Float64Array(e),this._sortOrderBuffer=new Uint32Array(e),this._bufferCapacity=e}}_ensureSortedAtlasIndicesBufferCapacity(t){if(!(t<=0)&&(!this._sortedAtlasIndicesBuffer||this._sortedAtlasIndicesBuffer.length<t)){const e=this._sortedAtlasIndicesBuffer?.length??0,s=this._computeExpandedCapacity(e,t);this._sortedAtlasIndicesBuffer=new Uint32Array(s)}}_clearAllBuffersAndTextures(){this._clearBuffersAndTextures(),this._latestSortedGaussianTiles.length=0,this._nextCommittedVisibleGaussianTiles.length=0,this._workerHandle?.clear()}async _sortOnWorker(t){try{if(0===this._latestUpdatedGaussianTiles.length)return this.visibleGaussians=0,this._clearAllBuffersAndTextures(),this._latestCompletedLyr3dVisibilityChange=this._requestedLyr3dVisibilityChange,this._onSortComplete(this._latestSortedGaussianTiles,this._latestCompletedLyr3dVisibilityChange),void this._renderer.requestRender(1);this._useDeterministicSort&&this._latestUpdatedGaussianTiles.sort((t,e)=>t.obb.centerX-e.obb.centerX||t.obb.centerY-e.obb.centerY||t.obb.centerZ-e.obb.centerZ);const e=this._latestUpdatedGaussianTiles,s=e.length,r=this._requestedLyr3dVisibilityChange;let i=0;for(let t=0;t<s;t++)i+=e[t].gaussianAtlasIndices.length;this._ensureSortBufferCapacities(i),this._textureAtlas.ensureTextureAtlas(),o(this._cameraDirectionNormalized,this._renderer.camera.ray.direction);const a=this._cameraDirectionNormalized[0],n=this._cameraDirectionNormalized[1],h=this._cameraDirectionNormalized[2];let d=0;const u=this._atlasIndicesBuffer,_=this._distancesBuffer,c=this._sortOrderBuffer,f=this._renderer.clippingBox,m=this._nextCommittedVisibleGaussianTiles;m.length=0;let p=0;for(let t=0;t<s;t++){const s=e[t],{gaussianAtlasIndices:r,relativePositions:i,obb:o}=s,c=r.length;if(null!=f&&null!=s.boundingBox&&!l(s.boundingBox,f))continue;const{centerX:S,centerY:g,centerZ:T}=o;u.set(r,d),m[p++]=s;const y=a*S+n*g+h*T,C=d+c;for(let t=d,e=0;t<C;t++,e+=3){const s=i[e],r=i[e+1],o=i[e+2];_[t]=s*a+r*n+o*h+y}d=C}m.length=p;for(let t=0;t<d;t++)c[t]=t;if(0===d)return this.visibleGaussians=0,this._clearAllBuffersAndTextures(),this._latestCompletedLyr3dVisibilityChange=r,this._onSortComplete(this._latestSortedGaussianTiles,this._latestCompletedLyr3dVisibilityChange),void this._renderer.requestRender(1);const S={distances:this._distancesBuffer,sortOrderIndices:this._sortOrderBuffer,numGaussians:d,preciseSort:this._useDeterministicSort},g=await(this._workerHandle?.sort(S,t));if(t.aborted)return;g&&(this._distancesBuffer=g.distances,this._sortOrderBuffer=g.sortedOrderIndices);const T=async t=>{const{paddedSize:e}=this._orderTexture.ensureCapacity(d);this._ensureSortedAtlasIndicesBufferCapacity(e);const s=this._atlasIndicesBuffer,i=this._sortOrderBuffer,a=this._sortedAtlasIndicesBuffer;for(let r=0;r<d;r++)a[r]=s[i[r]];this._orderTexture.setData(a,d);const o=this._latestSortedGaussianTiles;this._latestSortedGaussianTiles=m,this._nextCommittedVisibleGaussianTiles=o,this._latestCompletedLyr3dVisibilityChange=r,this.visibleGaussians=d,this._onSortComplete(this._latestSortedGaussianTiles,this._latestCompletedLyr3dVisibilityChange),this._renderer.requestRender(1),t.madeProgress()};await this._frameTask.schedule(T,t)}catch(e){if(s(e))return}}set useDeterministicSort(t){this._useDeterministicSort=t}}export{m as GaussianSplatDataStore};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{signal as e}from"../../../../core/signal.js";class i{static{this.fadeInEase=e=>e*(2-e)}static{this.fadeOutEase=e=>e*e}constructor(i){this.layerView=i,this._numFadingTiles=e(0),this._tmpFullyFadedOutTiles=new Array}get numFadingTiles(){return this._numFadingTiles.value}fadeTile(e,i){const t=this._getTargetOpacity(i);if(e.fadeDirection=i,0===this.fadeDuration)return void this._instantTileFading(e,t);const a=e.opacityModifier;if(a!==t){const i=1-Math.abs(t-a);this._startTileFading(e,i)}else this._stopTileFading(e)}updateAllTileFading(e){const i=this._tmpFullyFadedOutTiles;i.length=0,this.layerView.tileHandles.forEach(t=>{this._updateTileFading(t,e)&&i.push(t)});i.length>0&&(this.layerView.updateGaussians(),this.layerView.notifyTileObbsChanged(i)),this._numFadingTiles.value>0&&this.layerView.view.stage?.renderView.requestRender(2)}onFadeDurationChanged(e){0===e&&this.numFadingTiles>0&&this._instantlyFullyFadeAllTiles()}isTileFadingOut(e){return null!=e.fadeProgress&&1===e.fadeDirection}onTileDiscarded(e){null!=e.fadeProgress&&this._numFadingTiles.value--}get updating(){return this._numFadingTiles.value>0}get fadeDuration(){return this.layerView.view.qualitySettings.fadeDuration}get fadingEnabled(){return 0!==this.fadeDuration}_startTileFading(e,i){null==e.fadeProgress&&this._numFadingTiles.value++,e.fadeProgress=i}_stopTileFading(e){null!=e.fadeProgress&&(1===e.fadeDirection&&this._onTileFullyFadedOut(e),this._numFadingTiles.value--,e.fadeProgress=null)}_updateTileFading(e,t){const{fadeProgress:a,fadeDirection:s}=e;if(null==a)return!1;const n=this._fadeDirectionToSign(s),l=n*this.fadeDuration,d=this._getTargetOpacity(s),r=t/Math.abs(l||1),u=Math.min(a+r,1),o=n*(1-(0===s?i.fadeInEase:i.fadeOutEase)(u)),g=1===u;if(e.opacityModifier=g?d:d-o,g){const i=1===s;return this._stopTileFading(e),this._updateOpacityModifier(e),i}return e.fadeProgress=u,this._updateOpacityModifier(e),!1}_updateOpacityModifier(e){const i=255*e.opacityModifier;for(let t=0;t<e.pageIds.length;t++){const a=e.pageIds[t];this.layerView.data.fadingTexture.updateBuffer(i,a)}}_instantTileFading(e,i){e.fadeProgress=null,e.opacityModifier=i,this._updateOpacityModifier(e),1===e.fadeDirection&&this._onTileFullyFadedOut(e)}_instantlyFullyFadeAllTiles(){const e=this._tmpFullyFadedOutTiles;e.length=0,this.layerView.tileHandles.forEach(i=>{if(null!=i.fadeProgress){const t=1===i.fadeDirection;this._instantTileFading(i,this._getTargetOpacity(i.fadeDirection)),t&&e.push(i)}});e.length>0&&(this.layerView.updateGaussians(),this.layerView.notifyTileObbsChanged(e)),this._numFadingTiles.value=0}_onTileFullyFadedOut(e){e.isVisible=!1,this.layerView.moveTileToCache(e)}_fadeDirectionToSign(e){return 0===e?1:-1}_getTargetOpacity(e){return 0===e?1:0}}export{i as GaussianSplatFadeHelper};
2
+ import{signal as e}from"../../../../core/signal.js";class i{static{this.fadeInEase=e=>e*(2-e)}static{this.fadeOutEase=e=>e*e}constructor(i){this.layerView=i,this._numFadingTiles=e(0),this._tmpFullyFadedOutTiles=new Array}get numFadingTiles(){return this._numFadingTiles.value}fadeTile(e,i){const t=this._getTargetOpacity(i);if(e.fadeDirection=i,0===this.fadeDuration)return void this._instantTileFading(e,t);const a=e.opacityModifier;if(a!==t){const i=1-Math.abs(t-a);this._startTileFading(e,i)}else this._stopTileFading(e)}updateAllTileFading(e){const i=this._tmpFullyFadedOutTiles;i.length=0,this.layerView.tileHandles.forEach(t=>{this._updateTileFading(t,e)&&i.push(t)});i.length>0&&(this.layerView.updateGaussians(),this.layerView.notifyTileObbsChanged(i)),this._numFadingTiles.value>0&&this.layerView.view.stage?.renderView.requestRender(2)}onFadeDurationChanged(e){0===e&&this.numFadingTiles>0&&this._instantlyFullyFadeAllTiles()}isTileFadingOut(e){return null!=e.fadeProgress&&1===e.fadeDirection}onTileDiscarded(e){null!=e.fadeProgress&&this._numFadingTiles.value--}get updating(){return this._numFadingTiles.value>0}get fadeDuration(){return this.layerView.view.qualitySettings.fadeDuration}get fadingEnabled(){return 0!==this.fadeDuration}_startTileFading(e,i){null==e.fadeProgress&&this._numFadingTiles.value++,e.fadeProgress=i}_stopTileFading(e){null!=e.fadeProgress&&(1===e.fadeDirection&&this._onTileFullyFadedOut(e),this._numFadingTiles.value--,e.fadeProgress=null)}_updateTileFading(e,t){const{fadeProgress:a,fadeDirection:s}=e;if(null==a)return!1;const n=this._fadeDirectionToSign(s),l=n*this.fadeDuration,d=this._getTargetOpacity(s),r=t/Math.abs(l||1),u=Math.min(a+r,1),o=n*(1-(0===s?i.fadeInEase:i.fadeOutEase)(u)),g=1===u;if(e.opacityModifier=g?d:d-o,g){const i=1===s;return this._stopTileFading(e),this._updateOpacityModifier(e),i}return e.fadeProgress=u,this._updateOpacityModifier(e),!1}_updateOpacityModifier(e){const i=255*e.opacityModifier;for(let t=0;t<e.pageIds.length;t++){const a=e.pageIds[t];this.layerView.data.fadingTexture.updateBuffer(i,a)}}_instantTileFading(e,i){e.fadeProgress=null,e.opacityModifier=i,this._updateOpacityModifier(e),1===e.fadeDirection&&this._onTileFullyFadedOut(e)}_instantlyFullyFadeAllTiles(){const e=this._tmpFullyFadedOutTiles;e.length=0,this.layerView.tileHandles.forEach(i=>{if(null!=i.fadeProgress){const t=1===i.fadeDirection;this._instantTileFading(i,this._getTargetOpacity(i.fadeDirection)),t&&e.push(i)}});e.length>0&&(this.layerView.updateGaussians(),this.layerView.notifyTileObbsChanged(e)),this._numFadingTiles.value=0}_onTileFullyFadedOut(e){e.lifecycleState=0,this.layerView.moveTileToCache(e)}_fadeDirectionToSign(e){return 0===e?1:-1}_getTargetOpacity(e){return 0===e?1:0}}export{i as GaussianSplatFadeHelper};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{estimateNumberArrayMemory as t}from"../../../../core/memoryEstimations.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as i}from"../../../../geometry/support/aaBoundingBox.js";import{splatPageSizeInU32 as e}from"./GaussianSplatAtlasPages.js";class o{constructor(o,r,n,a,b,h,u,c){this.handle=o,this.obb=r,this.gaussianAtlasIndices=n,this.pageIds=a,this.relativePositions=b,this.squaredScales=h,this.maxScale=u,this.elevationRange=c,this.isVisible=!1,this.fadeDirection=0,this.opacityModifier=0,this.boundingBox=null,this.usedMemory=t(this.gaussianAtlasIndices,this.relativePositions,this.squaredScales)+this.pageIds.length*e*4;const d=s();r.getCenter(d),this._obbCenterX=d[0],this._obbCenterY=d[1],this._obbCenterZ=d[2];const l=r.radius??-1;this._obbRadius=l;const f=l<0?-1:l*l;this._obbRadiusSquared=f;const m=r.halfSize;this._obbShortestHalfsize=m?Math.min(m[0],m[1],m[2]):0;const g=i();r.toAaBoundingBox(g),this.boundingBox=g}boundingVolumeIntersectsRay(t,s){if(!this.obb)return!0;const{_obbCenterX:i,_obbCenterY:e,_obbCenterZ:o}=this,r=i-t[0],n=e-t[1],a=o-t[2],b=r*s[0]+n*s[1]+a*s[2],h=r*r+n*n+a*a-b*b;return(this._obbRadiusSquared<0||h<=this._obbRadiusSquared)&&this.obb.intersectRay(t,s)}boundingVolumeIntersectsSphere(t){const s=this._obbRadius;if(s<0)return!0;const i=t.center,e=t.radius,o=s+e,r=this._obbCenterX-i[0];if(r>o)return!1;const n=this._obbCenterY-i[1];if(n>o)return!1;const a=this._obbCenterZ-i[2];if(a>o)return!1;const b=r*r+n*n+a*a;if(b>o*o)return!1;if(b<=(this._obbShortestHalfsize+e)**2)return!0;return Math.sqrt(b)+s<=e||(this.obb?.intersectSphere(t)??!0)}}export{o as GaussianTile};
2
+ import{estimateNumberArrayMemory as t}from"../../../../core/memoryEstimations.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as e}from"../../../../geometry/support/aaBoundingBox.js";import{splatPageSizeInU32 as i}from"./GaussianSplatAtlasPages.js";class o{constructor(o,r,n,a,b,h,u,c){this.handle=o,this.obb=r,this.gaussianAtlasIndices=n,this.pageIds=a,this.relativePositions=b,this.squaredScales=h,this.maxScale=u,this.elevationRange=c,this.lifecycleState=0,this.fadeDirection=0,this.opacityModifier=0,this.boundingBox=null,this.usedMemory=t(this.gaussianAtlasIndices,this.relativePositions,this.squaredScales)+this.pageIds.length*i*4;const d=s();r.getCenter(d),this._obbCenterX=d[0],this._obbCenterY=d[1],this._obbCenterZ=d[2];const l=r.radius??-1;this._obbRadius=l;const f=l<0?-1:l*l;this._obbRadiusSquared=f;const m=r.halfSize;this._obbShortestHalfsize=m?Math.min(m[0],m[1],m[2]):0;const g=e();r.toAaBoundingBox(g),this.boundingBox=g}boundingVolumeIntersectsRay(t,s){if(!this.obb)return!0;const{_obbCenterX:e,_obbCenterY:i,_obbCenterZ:o}=this,r=e-t[0],n=i-t[1],a=o-t[2],b=r*s[0]+n*s[1]+a*s[2],h=r*r+n*n+a*a-b*b;return(this._obbRadiusSquared<0||h<=this._obbRadiusSquared)&&this.obb.intersectRay(t,s)}boundingVolumeIntersectsSphere(t){const s=this._obbRadius;if(s<0)return!0;const e=t.center,i=t.radius,o=s+i,r=this._obbCenterX-e[0];if(r>o)return!1;const n=this._obbCenterY-e[1];if(n>o)return!1;const a=this._obbCenterZ-e[2];if(a>o)return!1;const b=r*r+n*n+a*a;if(b>o*o)return!1;if(b<=(this._obbShortestHalfsize+i)**2)return!0;return Math.sqrt(b)+s<=i||(this.obb?.intersectSphere(t)??!0)}}export{o as GaussianTile};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import has from"../../../core/has.js";import{disposeMaybe as t}from"../../../core/maybe.js";import{MemCachePool as i}from"../../../core/MemCachePool.js";import r from"../../../core/ObjectPool.js";import{watch as s,sync as n}from"../../../core/reactiveUtils.js";import{property as a,subclass as l}from"../../../core/accessorSupport/decorators.js";import{subtract as o,set as c,dot as d}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{ZEROS as h,fromValues as u,create as _}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as g,ZEROS as f}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{create as p,set as m}from"../../../geometry/support/aaBoundingBox.js";import{BufferViewVec3f as y}from"../../../geometry/support/buffer/BufferView.js";import{overlayRenderOccludedFlag as b}from"./OverlayRenderer.js";import{PatchRenderData as x}from"./PatchRenderData.js";import{TerrainAttributesCache as T}from"./TerrainAttributesCache.js";import{enableTerrainInternalChecks as R}from"./terrainUtils.js";import{TileRenderer as v}from"./TileRenderer.js";import{IteratorPreorder as P,fallsWithinLayerView as O,sortTiles as w,compareTiles as S}from"./tileUtils.js";import{getOverlayContentForOutputTerrain as D}from"../webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js";import{SyncRenderPlugin as B}from"../webgl-engine/effects/RenderPlugin.js";import{Vertices as E}from"../webgl-engine/lib/Attribute.js";import{IntersectorResult as F}from"../webgl-engine/lib/IntersectorResult.js";import{intersectAabbInvDirBefore as j,MeshIntersectionOptions as q,intersectTriangles as C}from"../webgl-engine/lib/RayIntersections.js";import{TriangleIntersectionData as A}from"../webgl-engine/lib/TriangleIntersectionData.js";import{terrainId as M,getVerticalOffsetTerrain as G}from"../webgl-engine/lib/verticalOffsetUtils.js";import{DrawParameters as U}from"../webgl-engine/materials/DrawParameters.js";import{T as k}from"../../../chunks/Terrain.glsl.js";import{TerrainTechnique as I}from"../webgl-engine/shaders/TerrainTechnique.js";import{TerrainTechniqueConfiguration as N}from"../webgl-engine/shaders/TerrainTechniqueConfiguration.js";import{PrimitiveType as L}from"../../webgl/enums.js";const V=7,z=10,H=200,Q=p();let W=class extends B{get visibleTiles(){return Array.from(this._visiblePatchesByOrigin.values()).flat()}get _isGlobal(){return 1===this._stage.viewingMode}get _techniques(){return this._context.techniques}get _rctx(){return this._context.renderContext.rctx}get renderOccludedFlags(){return this._overlayRenderer.renderOccludedFlags}constructor(e,t,s,n,a){super({}),this._overlayRenderer=e,this._stage=t,this._allTiles=s,this._compressionTracker=n,this.type=7,this.isGround=!0,this._passParameters=new k,this._drawParameters=new U,this._renderDataPool=new r(()=>new x),this._visiblePatchesByOrigin=new Map,this._allPatchesByOrigin=new Map,this._patchesByOriginDirty=!0,this._patchSortingDirty=!0,this._tileIterator=new P,this._castShadows=!1,this._inViewshed=!1,this._cutFillEnabled=!1,this._tileRenderer=null,this._stencilEnabledLayerExtents=new Array,this._numTilesRendered=0,this._numTilesCulled=0,this._numOriginsRendered=0,this.produces=new Map([[1,()=>1===this._desiredSlot],[6,()=>6===this._desiredSlot],[8,()=>8===this._desiredSlot],[10,()=>this._produces()&&this.renderOccludedFlags===b]]),this._tileSize=256,this._configuration=new N(1===t.viewingMode),this._tileTextureCache=new i((e,t)=>a.newCache(e,t),"TileTexture"),this.tileGeometryCache=new T(a)}normalizeCtorArgs(){return{}}initialize(){this._stage.addRenderPlugin(this),this.addHandles(s(()=>this._overlayRenderer.renderOccludedFlags,()=>this.setNeedsRender(),n))}destroy(){this._stage.removeRenderPlugin(this),this._tileTextureCache.destroy(),this.tileGeometryCache.destroy(),this._allTiles.prune(),this._tileRenderer=null}get _oitEnabled(){return this._stage.renderer.oitEnabled}_produces(){return this.visible&&!!this._rootTiles&&!this.renderingDisabled}set renderingDisabled(e){this._set("renderingDisabled",!!e),this.setDirty()}set visible(e){this._set("visible",!!e),this.setDirty()}updateHeading(e){this._tileRenderer?.updateHeading(e)}set transparency(e){this._configuration.transparencyMode!==e&&(this._configuration.transparencyMode=e,this.setNeedsRender())}get transparency(){return this._configuration.transparencyMode}get renderPatchBorders(){return this._configuration.tileBorders}set renderPatchBorders(e){this._configuration.tileBorders!==e&&(this._configuration.tileBorders=e,this.setNeedsRender(),this.notifyChange("renderPatchBorders"))}get layerViewUid(){return M}get slicePlaneEnabled(){return this._configuration.hasSlicePlane}set slicePlaneEnabled(e){this._configuration.hasSlicePlane!==e&&(this._configuration.hasSlicePlane=e,this.setNeedsRender())}set textureFadingEnabled(e){this._configuration.textureFadingEnabled!==e&&(this._configuration.textureFadingEnabled=e,this.setNeedsRender())}set pbrMode(e){this._configuration.pbrMode!==e&&(this._configuration.pbrMode=e,this.setNeedsRender())}setRootTiles(e){this._rootTiles=e,this.setDirty()}setStencilEnabledLayerExtents(e){this._stencilEnabledLayerExtents=e,this._setSortingDirty()}set tileSize(e){this._tileSize=e,null!=this._tileRenderer&&(this._tileRenderer.tileSize=e),this.setDirty()}get tileSize(){return this._tileSize}_ensureRenderData(e){e.renderData||(e.renderData=this._renderDataPool.acquire(),e.renderData.init(e,this._getLocalOriginOfTile(e)))}loadTile(e){this._ensureRenderData(e),this.updateTileGeometryState(e),this.reuseTextureFromParent(e)||this.updateTileTexture(e,32)}reuseTextureFromParent(e){const{parent:t}=e;if(!this._canReuseTextureFromParent(t,e))return!1;const i=g(1&e.lij[2]?.5:0,1&e.lij[1]?0:.5,.5,.5);return t.renderData?.reuseTexture(e.renderData,i)??!1}_canReuseTextureFromParent(e,t){if(!e)return!1;const{layerInfo:i,surface:r}=t;for(let s=0;s<i[1].length;s++){const i=r.layerViewByIndex(s,1);if(O(e,i)!==O(t,i))return!1}return!0}updateTileTexture(e,t){null!=this._tileRenderer&&(this._tileRenderer.updateTileTexture(e,32===t?0:2),this.setNeedsRender(),e.resetPendingUpdate(t))}updateTileGeometryState(e){for(const i of e.layerInfo[0])i.pendingUpdates&=-9;e.resetPendingUpdate(8);const t=e.renderData.updateGeometryState();return t&&this.setDirty(),t}updateGeometryIfNeeded(e){e.loaded&&e.renderData.updateGeometryIfNeeded(this._rctx)}unloadTile(e){const t=e.renderData;t&&(t.releaseGeometry(),this._renderDataPool.release(t),t.clear(),e.renderData=null,e.setMemoryDirty(),this.setDirty())}_getLocalOriginOfTile(e){const t=z-V,i=Math.max(0,Math.floor((e.level-t)/V)*V);if(this._isGlobal&&0===i)return h;for(;e.parent&&e.level>i;)e=e.parent;return e.centerAtSeaLevel}getStats(){return{numTilesRendered:this._numTilesRendered,numTilesCulled:this._numTilesCulled,numOriginsRendered:this._numOriginsRendered}}set wireframe(e){this._get("wireframe")!==e&&(this._set("wireframe",e),this.setNeedsRender())}setDirty(e=1){this._patchesByOriginDirty=!0,this._context.requestRender(e)}_setSortingDirty(e=1){this._patchSortingDirty=!0,this._context.requestRender(e)}setNeedsRender(e=1){this._context.requestRender(e)}initializeRenderContext(e){this._context=e,this._tileRenderer=new v(this._rctx,this._tileSize,this._techniques,this._tileTextureCache,this._compressionTracker),this.updateTileBackground()}uninitializeRenderContext(){this._tileRenderer=t(this._tileRenderer)}intersect(e,t,i,r){if(!this._rootTiles||e.options.selectOpaqueTerrainOnly&&e.options.selectionMode&&0!==this.transparency)return;const s=Z,n=J;o(s,r,i),c(n,1/s[0],1/s[1],1/s[2]);const a=e.results.min,l=e.results.max,h=e.results.ground,u=0===e.options.store,_=!!e.results.ground.target,g=G(e.verticalOffset),f=e.tolerance;let p,b=u&&null!=a.distance?a.distance:1/0;const x=e.options,T=x.normalRequired||!x.backfacesTerrain,R=new q(f,!1,T),v=c=>{const _=c.renderData;if(!_?.vao)return;const v=_.geometry;m(Q,v.boundingBox);const P=_.localOrigin;null!=g&&(g.localOrigin=P,g.applyToAabb(Q));const O=Q;if(K[0]=i[0]-P[0],K[1]=i[1]-P[1],K[2]=i[2]-P[2],!j(O,K,n,f,b))return;const w=(e,t,i)=>{e.set(this.type,c,t,i),b=u&&null!=a.distance?a.distance:1/0},S=(n,o,c)=>{if((!T||null!=o)&&n>=0&&(x.backfacesTerrain||d(o,s)<0)&&(x.invisibleTerrain||!x.selectionMode||null==t||t(i,r,n))){if((null==h.distance||n<h.distance)&&w(h,n,o),x.isFiltered)return;2===x.store&&(null==p?(p=new F(e.ray),w(p,n,o),e.results.all.push(p)):n<p.distance&&w(p,n,o)),(null==a.distance||n<a.distance)&&w(a,n,o),0!==x.store&&(null==l.distance||n>l.distance)&&w(l,n,o)}},D=X;o(D,r,P);const{indices:B,indexCount:q}=v,M=v.vertexAttributes,G=M.getField("position",y),U=new E(G.typedBuffer,3,M.stride/4),k=q/3;if(!g&&k>H){const e=c.renderData;e.intersectionData??=new A(B,k,U),e.intersectionData.intersectRay(K,D,R,S)}else C(K,D,0,k,B,U,g,R,S)},P=this._rootTiles;if(null!=P){(()=>{const t=this._tileIterator;t.reset(P);const r=e.options.invisibleTerrain;for(let e=t.next();e;e=t.next())!(e.visible||r&&e.intersectsClippingArea)||null==g&&!e.intersectsRay(i,s,f,b)||_&&this._useStencilForTile(e)?t.skipSubtree():v(e)})()}}processScaleRangeQueries(e,t){if(!t.done&&e)for(this._updatePatchGroups();e.updating&&!t.done;){e.prepare();for(const t of this._visiblePatchesByOrigin.values())for(const i of t)null!=i.renderData?.textureReference&&e.queriesForTile(i);e.process(),t.madeProgress()}}get _desiredSlot(){if(!this._produces())return null;switch(this.transparency){case 0:return 1;case 1:case 2:return this._oitEnabled?8:6;case 3:case 4:return null}}acquireTechniques(e){const{shadowMap:t,viewshedEnabled:i,cutFillEnabled:r,slot:s,hasEmission:n,useFloatBlend:a}=e.bind,l=!!has("enable-feature:terrain-shadows")&&t.enabled;if(l!==this._castShadows&&(this._castShadows=l,this._patchesByOriginDirty=!0),this._inViewshed!==i&&(this._inViewshed=i,this._patchesByOriginDirty=!0),this._cutFillEnabled!==r&&(this._cutFillEnabled=r,this._patchesByOriginDirty=!0),3===this.transparency)return null;if(10===s){if(0===(e.renderOccludedMask&b))return null}else if(s!==this._desiredSlot)return null;const o=this._configuration;switch(o.screenSpaceReflections=o.cloudReflections=o.receiveShadows=o.receiveAmbientOcclusion=o.renderOccluded=o.hasHighlightMixTexture=o.hasEmission=!1,o.overlayMode=this._overlayRenderer.mode,o.useFloatBlend=a.value,e.output){case 0:case 1:case 2:{const{screenSpaceReflections:i,reprojection:r,clouds:a,ssao:l}=e.bind;o.screenSpaceReflections=i.enabled&&null!=r.lastFrameColor,o.cloudReflections=null!=a.data;const c=10===s;return o.receiveShadows=t.ready&&!c,o.renderOccluded=c,o.receiveAmbientOcclusion=!c&&null!=l,o.hasEmission=n,this._acquireTechnique(e.output)}case 5:case 7:return this._castShadows?this._acquireTechnique(5):null;case 8:return this._inViewshed?this._acquireTechnique(8):null;case 9:return this._cutFillEnabled?this._acquireTechnique(9):null;case 3:case 4:return this._acquireTechnique(e.output);case 11:return this._acquireTechnique(11);case 10:return o.hasHighlightMixTexture=null!=e.bind.highlightMixTexture,this._overlayRenderer.hasHighlights?this._acquireTechnique(10):null}return null}render(e,t){switch(this._updatePatchGroups(),t.useStencil=!1,this._passParameters.overlayContent=D(e.output,e.bind),e.output){case 0:case 1:case 2:return this._renderMaterialPass(e,t);case 3:case 4:case 11:return this._renderAuxiliaryPass(e,t,this._visiblePatchesByOrigin);case 10:{const i=e.bind.highlight?.name;i&&this._overlayRenderer.hasHighlights&&this._overlayRenderer.renders(2)&&this._overlayRenderer.hasHighlight(i)&&this._renderAuxiliaryPass(e,t,this._visiblePatchesByOrigin);break}case 5:case 7:case 8:case 9:return this._renderAuxiliaryPass(e,t,this._allPatchesByOrigin)}}updateTileBackground(e){if(null==this._tileRenderer)return;const t=this._tileRenderer;let i;if(null!=e){const t=e.toUnitRGBA();i=u(t[0]||0,t[1]||0,t[2]||0)}t.setBackground(i),this._allTiles.forAll(e=>t.updateTileTexture(e,0)),this._configuration.tileBlendInput=t.backgroundIsGrid?2:null!=t.backgroundColor?1:0,this.setNeedsRender()}_updatePatchGroups(){if(this._patchesByOriginDirty&&(this._rebuildPatchGroups(),this._patchesByOriginDirty=!1,this._patchSortingDirty=!0),this._patchSortingDirty){const e=Array.from(this._visiblePatchesByOrigin.values()),t=this._stencilEnabledLayerExtents;for(const i of e)w(i,t);e.sort((e,t)=>S(e[0],t[0])),this._visiblePatchesByOrigin=new Map(e.map(e=>[e[0].renderData.localOrigin,e])),this.notifyChange("visibleTiles"),this._patchSortingDirty=!1}}_rebuildPatchGroups(){const e=this._rootTiles;if(null!=e){e[0]?.surface.checkAllTilesWaterproofness(),this._visiblePatchesByOrigin.clear(),this._allPatchesByOrigin.clear();for(const t of e)this._rebuildPatchGroupsForRootTile(t)}}_rebuildPatchGroupsForRootTile(e){const t=this._tileIterator;for(t.resetOne(e);!t.done;){const e=t.next(),i=e.renderData;if(!i){this._numTilesCulled++;continue}const r=i.localOrigin;if(this._castShadows||this._inViewshed||this._cutFillEnabled){let t=this._allPatchesByOrigin.get(r);t||(t=[],this._allPatchesByOrigin.set(r,t)),t.push(e)}if(!e.visible){this._numTilesCulled++,t.skipSubtree();continue}let s=this._visiblePatchesByOrigin.get(r);s||(s=[],this._visiblePatchesByOrigin.set(r,s)),s.push(e),t.skipSubtree()}}_useStencilForTile(e){for(const t of this._stencilEnabledLayerExtents)if(e.intersectsExtent(t))return!0;return!1}_renderAuxiliaryPass(e,t,i){const{rctx:r,bind:s}=e;r.bindTechnique(t,s,this._passParameters);const n=this._stencilEnabledLayerExtents.length>0;i.forEach(i=>{this._drawParameters.origin=i[0].renderData.localOrigin,t.program.bindDraw(s,this._passParameters,this._drawParameters);for(let r=0;r<i.length;r++)this._renderPatch(e,t,i[r],L.TRIANGLES,n,null===this._passParameters.overlayContent)}),r.bindVAO(null)}_renderMaterialPass(e,t){const{rctx:i,bind:r}=e,s=i.bindTechnique(t,r,this._passParameters);this._numTilesRendered=0,this._numTilesCulled=0,this._numOriginsRendered=0;const n=10===r.slot;n&&(s.bindTexture("tex",i.emptyTexture),s.setUniform3fv("textureOpacities",h),s.setUniform4fv("texOffsetAndScale",f));const a=null!=this._tileRenderer?.backgroundColor?this._tileRenderer.backgroundColor:h;1===this._configuration.tileBlendInput&&s.setUniform3fv("backgroundColor",a);const l=this._stencilEnabledLayerExtents.length>0,o=this.wireframe?L.LINES:L.TRIANGLES;this._configuration.textureFadingEnabled&&s.bindTexture("texNext",i.emptyTexture);const c=this._visiblePatchesByOrigin;for(const d of c.values()){const i=d[0].renderData.localOrigin;this._drawParameters.origin=i,t.program.bindDraw(r,this._passParameters,this._drawParameters),this._numOriginsRendered++;for(const r of d){const i=r.renderData,a=i.textureReference;if(null!=a){if(!n){s.setUniform4fv("texOffsetAndScale",a.offsetAndScale),s.bindTexture("tex",a.texture.texture);const e=i.textureFadeFactor,t=e<1?i.nextTextureReference:null;this._configuration.textureFadingEnabled&&t&&e<1?(s.setUniform1f("fadeFactor",e),s.setUniform4fv("nextTexOffsetAndScale",t.offsetAndScale),s.setUniform3fv("nextTexOpacities",t.opacities),s.bindTexture("texNext",t.texture.texture)):s.setUniform1f("fadeFactor",1),i.textureIsFading&&this.setNeedsRender(2),s.setUniform3fv("textureOpacities",a.opacities)}this._renderPatch(e,t,r,o,l),r.renderOrder=this._numTilesRendered,this._numTilesRendered++}}}i.bindVAO(null)}_renderPatch(e,t,i,r,s,n=!1){const a=i.renderData,l=a.vao,o=l?.indexBuffer;if(!l||null==o)return void(R&&console.error("Rendered tile with no indices: ",i.lij," : ",a));const c=t.program;n||this._overlayRenderer.isEmpty||this._bindOverlayPatchData(c,a.overlay);const{rctx:d,bind:h}=e;s&&(t.useStencil=this._useStencilForTile(i),d.setPipelineState(t.getPipeline(h)));const u=a.geometry.indexCount;d.bindVAO(l),c.assertCompatibleVertexAttributeLocations(l),d.drawElements(r,u,o.indexType,0)}_bindOverlayPatchData(e,t){e.setUniform4fv("overlayTexOffset",t.offsets),e.setUniform4fv("overlayTexScale",t.scales)}_acquireTechnique(e){return this._configuration.output=e,this._techniques.get(I,this._configuration)}get test(){}hasHighlight(e){return this._overlayRenderer.hasHighlight(e)}};e([a({readOnly:!0})],W.prototype,"visibleTiles",null),e([a({readOnly:!0})],W.prototype,"_isGlobal",null),e([a()],W.prototype,"renderOccludedFlags",null),e([a({value:!1})],W.prototype,"renderingDisabled",null),e([a({value:!0})],W.prototype,"visible",null),e([a()],W.prototype,"renderPatchBorders",null),e([a()],W.prototype,"wireframe",null),W=e([l("esri.views.3d.terrain.TerrainRenderer")],W);const Z=_(),J=_(),K=_(),X=_();export{W as TerrainRenderer};
2
+ import{__decorate as e}from"tslib";import has from"../../../core/has.js";import{disposeMaybe as t}from"../../../core/maybe.js";import{MemCachePool as i}from"../../../core/MemCachePool.js";import r from"../../../core/ObjectPool.js";import{watch as s,sync as n}from"../../../core/reactiveUtils.js";import{property as a,subclass as l}from"../../../core/accessorSupport/decorators.js";import{subtract as o,set as c,dot as d}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{ZEROS as h,fromValues as u,create as _}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as g,ZEROS as f}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{create as p,set as m}from"../../../geometry/support/aaBoundingBox.js";import{BufferViewVec3f as y}from"../../../geometry/support/buffer/BufferView.js";import{overlayRenderOccludedFlag as b}from"./OverlayRenderer.js";import{PatchRenderData as x}from"./PatchRenderData.js";import{TerrainAttributesCache as T}from"./TerrainAttributesCache.js";import{enableTerrainInternalChecks as R}from"./terrainUtils.js";import{TileRenderer as v}from"./TileRenderer.js";import{IteratorPreorder as P,fallsWithinLayerView as O,sortTiles as w,compareTiles as S}from"./tileUtils.js";import{getOverlayContentForOutputTerrain as D}from"../webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js";import{SyncRenderPlugin as B}from"../webgl-engine/effects/RenderPlugin.js";import{Vertices as E}from"../webgl-engine/lib/Attribute.js";import{IntersectorResult as F}from"../webgl-engine/lib/IntersectorResult.js";import{intersectAabbInvDirBefore as j,MeshIntersectionOptions as q,intersectTriangles as C}from"../webgl-engine/lib/RayIntersections.js";import{TriangleIntersectionData as A}from"../webgl-engine/lib/TriangleIntersectionData.js";import{terrainId as M,getVerticalOffsetTerrain as G}from"../webgl-engine/lib/verticalOffsetUtils.js";import{DrawParameters as U}from"../webgl-engine/materials/DrawParameters.js";import{T as k}from"../../../chunks/Terrain.glsl.js";import{TerrainTechnique as I}from"../webgl-engine/shaders/TerrainTechnique.js";import{TerrainTechniqueConfiguration as N}from"../webgl-engine/shaders/TerrainTechniqueConfiguration.js";import{PrimitiveType as L}from"../../webgl/enums.js";const V=7,z=10,H=200,Q=p();let W=class extends B{get visibleTiles(){return Array.from(this._visiblePatchesByOrigin.values()).flat()}get _isGlobal(){return 1===this._stage.viewingMode}get _techniques(){return this._context.techniques}get _rctx(){return this._context.renderContext.rctx}get renderOccludedFlags(){return this._overlayRenderer.renderOccludedFlags}constructor(e,t,s,n,a){super({}),this._overlayRenderer=e,this._stage=t,this._allTiles=s,this._compressionTracker=n,this.type=7,this.isGround=!0,this._passParameters=new k,this._drawParameters=new U,this._renderDataPool=new r(()=>new x),this._visiblePatchesByOrigin=new Map,this._allPatchesByOrigin=new Map,this._patchesByOriginDirty=!0,this._patchSortingDirty=!0,this._tileIterator=new P,this._castShadows=!1,this._inViewshed=!1,this._cutFillEnabled=!1,this._tileRenderer=null,this._stencilEnabledLayerExtents=new Array,this._numTilesRendered=0,this._numTilesCulled=0,this._numOriginsRendered=0,this.produces=new Map([[1,()=>1===this._desiredSlot],[6,()=>6===this._desiredSlot],[8,()=>8===this._desiredSlot],[10,()=>this._produces()&&this.renderOccludedFlags===b]]),this._tileSize=256,this._configuration=new N(1===t.viewingMode),this._tileTextureCache=new i((e,t)=>a.newCache(e,t),"TileTexture"),this.tileGeometryCache=new T(a)}normalizeCtorArgs(){return{}}initialize(){this._stage.addRenderPlugin(this),this.addHandles(s(()=>this._overlayRenderer.renderOccludedFlags,()=>this.setNeedsRender(),n))}destroy(){this._stage.removeRenderPlugin(this),this._tileTextureCache.destroy(),this.tileGeometryCache.destroy(),this._allTiles.prune(),this._tileRenderer=null}get _oitEnabled(){return this._stage.renderer.oitEnabled}_produces(){return this.visible&&!!this._rootTiles&&!this.renderingDisabled}set renderingDisabled(e){this._set("renderingDisabled",!!e),this.setDirty()}set visible(e){this._set("visible",!!e),this.setDirty()}updateHeading(e){this._tileRenderer?.updateHeading(e)}set transparency(e){this._configuration.transparencyMode!==e&&(this._configuration.transparencyMode=e,this.setNeedsRender())}get transparency(){return this._configuration.transparencyMode}get renderPatchBorders(){return this._configuration.tileBorders}set renderPatchBorders(e){this._configuration.tileBorders!==e&&(this._configuration.tileBorders=e,this.setNeedsRender(),this.notifyChange("renderPatchBorders"))}get layerViewUid(){return M}get slicePlaneEnabled(){return this._configuration.hasSlicePlane}set slicePlaneEnabled(e){this._configuration.hasSlicePlane!==e&&(this._configuration.hasSlicePlane=e,this.setNeedsRender())}set textureFadingEnabled(e){this._configuration.textureFadingEnabled!==e&&(this._configuration.textureFadingEnabled=e,this.setNeedsRender())}set pbrMode(e){this._configuration.pbrMode!==e&&(this._configuration.pbrMode=e,this.setNeedsRender())}setRootTiles(e){this._rootTiles=e,this.setDirty()}setStencilEnabledLayerExtents(e){this._stencilEnabledLayerExtents=e,this._setSortingDirty()}set tileSize(e){this._tileSize=e,null!=this._tileRenderer&&(this._tileRenderer.tileSize=e),this.setDirty()}get tileSize(){return this._tileSize}_ensureRenderData(e){e.renderData||(e.renderData=this._renderDataPool.acquire(),e.renderData.init(e,this._getLocalOriginOfTile(e)))}loadTile(e){this._ensureRenderData(e),this.updateTileGeometryState(e),this.reuseTextureFromParent(e)||this.updateTileTexture(e,32)}reuseTextureFromParent(e){const{parent:t}=e;if(!this._canReuseTextureFromParent(t,e))return!1;const i=g(1&e.lij[2]?.5:0,1&e.lij[1]?0:.5,.5,.5);return t.renderData?.reuseTexture(e.renderData,i)??!1}_canReuseTextureFromParent(e,t){if(!e)return!1;const{layerInfo:i,surface:r}=t;for(let s=0;s<i[1].length;s++){const i=r.layerViewByIndex(s,1);if(O(e,i)!==O(t,i))return!1}return!0}updateTileTexture(e,t){null!=this._tileRenderer&&(this._tileRenderer.updateTileTexture(e,32===t?0:2),this.setNeedsRender(),e.resetPendingUpdate(t))}updateTileGeometryState(e){for(const i of e.layerInfo[0])i.pendingUpdates&=-9;e.resetPendingUpdate(8);const t=e.renderData.updateGeometryState();return t&&this.setDirty(),t}updateGeometryIfNeeded(e){e.loaded&&e.renderData.updateGeometryIfNeeded(this._rctx)}unloadTile(e){const t=e.renderData;t&&(t.releaseGeometry(),this._renderDataPool.release(t),t.clear(),e.renderData=null,e.setMemoryDirty(),this.setDirty())}_getLocalOriginOfTile(e){const t=z-V,i=Math.max(0,Math.floor((e.level-t)/V)*V);if(this._isGlobal&&0===i)return h;for(;e.parent&&e.level>i;)e=e.parent;return e.centerAtSeaLevel}getStats(){return{numTilesRendered:this._numTilesRendered,numTilesCulled:this._numTilesCulled,numOriginsRendered:this._numOriginsRendered}}set wireframe(e){this._get("wireframe")!==e&&(this._set("wireframe",e),this.setNeedsRender())}setDirty(e=1){this._patchesByOriginDirty=!0,this._context.requestRender(e)}_setSortingDirty(e=1){this._patchSortingDirty=!0,this._context.requestRender(e)}setNeedsRender(e=1){this._context.requestRender(e)}initializeRenderContext(e){this._context=e,this._tileRenderer=new v(this._rctx,this._tileSize,this._techniques,this._tileTextureCache,this._compressionTracker),this.updateTileBackground()}uninitializeRenderContext(){this._tileRenderer=t(this._tileRenderer)}intersect(e,t,i,r){if(!this._rootTiles||e.options.selectOpaqueTerrainOnly&&e.options.selectionMode&&0!==this.transparency)return;const s=Z,n=J;o(s,r,i),c(n,1/s[0],1/s[1],1/s[2]);const a=e.results.min,l=e.results.max,h=e.results.ground,u=0===e.options.store,_=!!e.results.ground.target,g=G(e.verticalOffset),f=e.tolerance;let p,b=u&&null!=a.distance?a.distance:1/0;const x=e.options,T=x.normalRequired||!x.backfacesTerrain,R=new q(f,!1,T),v=c=>{const _=c.renderData;if(!_?.vao)return;const v=_.geometry;m(Q,v.boundingBox);const P=_.localOrigin;null!=g&&(g.localOrigin=P,g.applyToAabb(Q));const O=Q;if(K[0]=i[0]-P[0],K[1]=i[1]-P[1],K[2]=i[2]-P[2],!j(O,K,n,f,b))return;const w=(e,t,i)=>{e.set(this.type,c,t,i),b=u&&null!=a.distance?a.distance:1/0},S=(n,o,c)=>{if((!T||null!=o)&&n>=0&&(x.backfacesTerrain||d(o,s)<0)&&(x.invisibleTerrain||!x.selectionMode||null==t||t(i,r,n))){if((null==h.distance||n<h.distance)&&w(h,n,o),x.isFiltered)return;2===x.store&&(null==p?(p=new F(e.ray),w(p,n,o),e.results.all.push(p)):n<p.distance&&w(p,n,o)),(null==a.distance||n<a.distance)&&w(a,n,o),0!==x.store&&(null==l.distance||n>l.distance)&&w(l,n,o)}},D=X;o(D,r,P);const{indices:B,indexCount:q}=v,M=v.vertexAttributes,G=M.getField("position",y),U=new E(G.typedBuffer,3,M.stride/4),k=q/3;if(!g&&k>H){const e=c.renderData;e.intersectionData??=new A(B,k,U),e.intersectionData.intersectRay(K,D,R,S)}else C(K,D,0,k,B,U,g,R,S)},P=this._rootTiles;if(null!=P){(()=>{const t=this._tileIterator;t.reset(P);const r=e.options.invisibleTerrain;for(let e=t.next();e;e=t.next())!(e.visible||r&&e.intersectsClippingArea)||null==g&&!e.intersectsRay(i,s,f,b)||_&&this._useStencilForTile(e)?t.skipSubtree():v(e)})()}}processScaleRangeQueries(e,t){if(!t.done&&e)for(this._updatePatchGroups();e.updating&&!t.done;){e.prepare();for(const t of this._visiblePatchesByOrigin.values())for(const i of t)null!=i.renderData?.textureReference&&e.queriesForTile(i);e.process(),t.madeProgress()}}get _desiredSlot(){if(!this._produces())return null;switch(this.transparency){case 0:return 1;case 1:case 2:return this._oitEnabled?8:6;case 3:case 4:return null}}acquireTechniques(e){const{shadowMap:t,viewshedEnabled:i,cutFillComputationEnabled:r,slot:s,hasEmission:n,useFloatBlend:a}=e.bind,l=!!has("enable-feature:terrain-shadows")&&t.enabled;if(l!==this._castShadows&&(this._castShadows=l,this._patchesByOriginDirty=!0),this._inViewshed!==i&&(this._inViewshed=i,this._patchesByOriginDirty=!0),this._cutFillEnabled!==r&&(this._cutFillEnabled=r,this._patchesByOriginDirty=!0),3===this.transparency)return null;if(10===s){if(0===(e.renderOccludedMask&b))return null}else if(s!==this._desiredSlot)return null;const o=this._configuration;switch(o.screenSpaceReflections=o.cloudReflections=o.receiveShadows=o.receiveAmbientOcclusion=o.renderOccluded=o.hasHighlightMixTexture=o.hasEmission=!1,o.overlayMode=this._overlayRenderer.mode,o.useFloatBlend=a.value,e.output){case 0:case 1:case 2:{const i=e.bind;o.screenSpaceReflections=i.hasScreenSpaceReflections,o.cloudReflections=null!=i.clouds.data;const r=10===s;return o.receiveShadows=t.ready&&!r,o.renderOccluded=r,o.receiveAmbientOcclusion=!r&&null!=i.ssao,o.hasEmission=n,this._acquireTechnique(e.output)}case 5:case 7:return this._castShadows?this._acquireTechnique(5):null;case 8:return this._inViewshed?this._acquireTechnique(8):null;case 9:return this._cutFillEnabled?this._acquireTechnique(9):null;case 3:case 4:return this._acquireTechnique(e.output);case 11:return this._acquireTechnique(11);case 10:return o.hasHighlightMixTexture=null!=e.bind.highlightMixTexture,this._overlayRenderer.hasHighlights?this._acquireTechnique(10):null}return null}render(e,t){switch(this._updatePatchGroups(),t.useStencil=!1,this._passParameters.overlayContent=D(e.output,e.bind),e.output){case 0:case 1:case 2:return this._renderMaterialPass(e,t);case 3:case 4:case 11:return this._renderAuxiliaryPass(e,t,this._visiblePatchesByOrigin);case 10:{const i=e.bind.highlight?.name;i&&this._overlayRenderer.hasHighlights&&this._overlayRenderer.renders(2)&&this._overlayRenderer.hasHighlight(i)&&this._renderAuxiliaryPass(e,t,this._visiblePatchesByOrigin);break}case 5:case 7:case 8:case 9:return this._renderAuxiliaryPass(e,t,this._allPatchesByOrigin)}}updateTileBackground(e){if(null==this._tileRenderer)return;const t=this._tileRenderer;let i;if(null!=e){const t=e.toUnitRGBA();i=u(t[0]||0,t[1]||0,t[2]||0)}t.setBackground(i),this._allTiles.forAll(e=>t.updateTileTexture(e,0)),this._configuration.tileBlendInput=t.backgroundIsGrid?2:null!=t.backgroundColor?1:0,this.setNeedsRender()}_updatePatchGroups(){if(this._patchesByOriginDirty&&(this._rebuildPatchGroups(),this._patchesByOriginDirty=!1,this._patchSortingDirty=!0),this._patchSortingDirty){const e=Array.from(this._visiblePatchesByOrigin.values()),t=this._stencilEnabledLayerExtents;for(const i of e)w(i,t);e.sort((e,t)=>S(e[0],t[0])),this._visiblePatchesByOrigin=new Map(e.map(e=>[e[0].renderData.localOrigin,e])),this.notifyChange("visibleTiles"),this._patchSortingDirty=!1}}_rebuildPatchGroups(){const e=this._rootTiles;if(null!=e){e[0]?.surface.checkAllTilesWaterproofness(),this._visiblePatchesByOrigin.clear(),this._allPatchesByOrigin.clear();for(const t of e)this._rebuildPatchGroupsForRootTile(t)}}_rebuildPatchGroupsForRootTile(e){const t=this._tileIterator;for(t.resetOne(e);!t.done;){const e=t.next(),i=e.renderData;if(!i){this._numTilesCulled++;continue}const r=i.localOrigin;if(this._castShadows||this._inViewshed||this._cutFillEnabled){let t=this._allPatchesByOrigin.get(r);t||(t=[],this._allPatchesByOrigin.set(r,t)),t.push(e)}if(!e.visible){this._numTilesCulled++,t.skipSubtree();continue}let s=this._visiblePatchesByOrigin.get(r);s||(s=[],this._visiblePatchesByOrigin.set(r,s)),s.push(e),t.skipSubtree()}}_useStencilForTile(e){for(const t of this._stencilEnabledLayerExtents)if(e.intersectsExtent(t))return!0;return!1}_renderAuxiliaryPass(e,t,i){const{rctx:r,bind:s}=e;r.bindTechnique(t,s,this._passParameters);const n=this._stencilEnabledLayerExtents.length>0;i.forEach(i=>{this._drawParameters.origin=i[0].renderData.localOrigin,t.program.bindDraw(s,this._passParameters,this._drawParameters);for(let r=0;r<i.length;r++)this._renderPatch(e,t,i[r],L.TRIANGLES,n,null===this._passParameters.overlayContent)}),r.bindVAO(null)}_renderMaterialPass(e,t){const{rctx:i,bind:r}=e,s=i.bindTechnique(t,r,this._passParameters);this._numTilesRendered=0,this._numTilesCulled=0,this._numOriginsRendered=0;const n=10===r.slot;n&&(s.bindTexture("tex",i.emptyTexture),s.setUniform3fv("textureOpacities",h),s.setUniform4fv("texOffsetAndScale",f));const a=null!=this._tileRenderer?.backgroundColor?this._tileRenderer.backgroundColor:h;1===this._configuration.tileBlendInput&&s.setUniform3fv("backgroundColor",a);const l=this._stencilEnabledLayerExtents.length>0,o=this.wireframe?L.LINES:L.TRIANGLES;this._configuration.textureFadingEnabled&&s.bindTexture("texNext",i.emptyTexture);const c=this._visiblePatchesByOrigin;for(const d of c.values()){const i=d[0].renderData.localOrigin;this._drawParameters.origin=i,t.program.bindDraw(r,this._passParameters,this._drawParameters),this._numOriginsRendered++;for(const r of d){const i=r.renderData,a=i.textureReference;if(null!=a){if(!n){s.setUniform4fv("texOffsetAndScale",a.offsetAndScale),s.bindTexture("tex",a.texture.texture);const e=i.textureFadeFactor,t=e<1?i.nextTextureReference:null;this._configuration.textureFadingEnabled&&t&&e<1?(s.setUniform1f("fadeFactor",e),s.setUniform4fv("nextTexOffsetAndScale",t.offsetAndScale),s.setUniform3fv("nextTexOpacities",t.opacities),s.bindTexture("texNext",t.texture.texture)):s.setUniform1f("fadeFactor",1),i.textureIsFading&&this.setNeedsRender(2),s.setUniform3fv("textureOpacities",a.opacities)}this._renderPatch(e,t,r,o,l),r.renderOrder=this._numTilesRendered,this._numTilesRendered++}}}i.bindVAO(null)}_renderPatch(e,t,i,r,s,n=!1){const a=i.renderData,l=a.vao,o=l?.indexBuffer;if(!l||null==o)return void(R&&console.error("Rendered tile with no indices: ",i.lij," : ",a));const c=t.program;n||this._overlayRenderer.isEmpty||this._bindOverlayPatchData(c,a.overlay);const{rctx:d,bind:h}=e;s&&(t.useStencil=this._useStencilForTile(i),d.setPipelineState(t.getPipeline(h)));const u=a.geometry.indexCount;d.bindVAO(l),c.assertCompatibleVertexAttributeLocations(l),d.drawElements(r,u,o.indexType,0)}_bindOverlayPatchData(e,t){e.setUniform4fv("overlayTexOffset",t.offsets),e.setUniform4fv("overlayTexScale",t.scales)}_acquireTechnique(e){return this._configuration.output=e,this._techniques.get(I,this._configuration)}get test(){}hasHighlight(e){return this._overlayRenderer.hasHighlight(e)}};e([a({readOnly:!0})],W.prototype,"visibleTiles",null),e([a({readOnly:!0})],W.prototype,"_isGlobal",null),e([a()],W.prototype,"renderOccludedFlags",null),e([a({value:!1})],W.prototype,"renderingDisabled",null),e([a({value:!0})],W.prototype,"visible",null),e([a()],W.prototype,"renderPatchBorders",null),e([a()],W.prototype,"wireframe",null),W=e([l("esri.views.3d.terrain.TerrainRenderer")],W);const Z=_(),J=_(),K=_(),X=_();export{W as TerrainRenderer};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{exactEquals as e}from"../../../../../../core/libs/gl-matrix-2/math/vec3.js";import{ZEROS as t}from"../../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ComponentTechnique as r}from"./ComponentTechnique.js";import{ComponentTechniqueConfiguration as s}from"./ComponentTechniqueConfiguration.js";import{MaterialBase as i}from"../../../core/material/MaterialBase.js";import{isColor as o}from"../../../core/shaderLibrary/ShaderOutput.js";class a extends i{constructor(e,t,r,i,o){super(),this.parameters=e,this.key=o,this.usePBR=e.usePBR,this.hasParametersFromSource=e.hasParametersFromSource,this.isGround=e.isGround,this.slicePlaneEnabled=e.slicePlaneEnabled,this.isIntegratedMesh=e.isIntegratedMesh,this.applySSAO=e.applySSAO,this.hasEmissions=u(e,r,i),this.materialPass=n(e,r),this._configuration=new s(i),this._initializeMaterialConfiguration(e,t,r,i)}destroy(){}acquireTechnique(e,t,s,i){const o=this._updateConfiguration(t,s);return e.get(r,o,i.layout)}_initializeMaterialConfiguration(e,t,r,s){const i=this._configuration;i.hasMetallicRoughnessTexture=null!=e.metallicRoughnessTexture,i.hasOcclusionTexture=null!=e.occlusionTexture,i.hasNormalTexture=null!=e.normalTexture,i.sphereDepthInterpolate=e.sphereDepthInterpolate&&i.spherical,i.ellipsoidMode=e.ellipsoidMode,i.doubleSidedMode=e.doubleSided?1:0,i.hasColorTexture=null!=e.baseColorTexture,i.cullFace=e.cullFace,i.alphaDiscardMode=e.alphaDiscardMode,i.hasVertexColors=t.hasVertexColors,i.textureCoordinateType=t.textureCoordinateType,i.shadeNormals=t.shadeNormals,i.normalType=t.hasNormals?1:2,i.polygonOffset=e.polygonOffset,i.vertexPositionRotationType=t.vertexPositionRotationType,i.vertexNormalRotationType=t.vertexNormalRotationType,i.componentDataType=r.componentDataType,i.emissionSource=c(e,r,s)}_updateConfiguration(e,t){const r=this._configuration,{identifier:s}=e,i=0===s;r.output=t.output,r.enableOITOffset=t.enableOITOffset,r.hasEmission=t.hasEmission&&i,r.renderOccluded=10===t.slot,r.terrainDepthTest=i&&t.terrainDepthTest,r.cullAboveTerrain=!!i&&t.cullAboveTerrain;const a=this.isIntegratedMesh?d(t)?h(t)?3:2:1:0;r.integratedMeshMode=a,r.pbrMode=3===a?4:this.usePBR?this.hasParametersFromSource?0!==r.shadeNormals&&this.isIntegratedMesh?0:2:1:0,r.hasSlicePlane=null!=t.slicePlane&&this.slicePlaneEnabled,r.isGroundSlice=r.hasSlicePlane&&this.isGround;const{materialPass:n}=this;r.transparent=i&&(1===n||2===n&&e.transparent||4===n)||r.isGroundSlice,r.hasHighlightMixTexture=2===s&&null!=t.highlightMixTexture,r.snowCover=i&&t.snowCover>0,r.vertexDiscardMode=i&&2===n?e.transparent?2:1:0;const l=o(t.output);return r.receiveAmbientOcclusion=l&&this.applySSAO&&!r.renderOccluded&&null!=t.ssao?.getTexture(),r.hasOccludees=l&&t.hasOccludees,r.receiveShadows=l&&t.shadowMap.ready,r.screenSpaceReflections=l&&t.screenSpaceReflections.enabled&&null!=t.reprojection.lastFrameColor,r.cloudReflections=l&&null!=t.clouds.data?.cubeMap?.colorTexture,r}}function n(e,t){const{alphaDiscardMode:r,isIntegratedMesh:s,slicePlaneEnabled:i}=e,{transparent:o,opaqueOverride:a}=t,n=e.opacity<1,l=e.baseColor[3]<1;if(s)return n||i?4:3;if(n)return 1;if(0===a)return 0;if(l||0===r||3===r)return 1;switch(o){case 2:return 0;case 0:return 1;case 1:return 2}}function l(r){return null!=r.emissionTexture||!e(r.emissiveBaseColor,t)}function u(e,t,r){const s=l(e);return r.hasEmissionSupport&&2!==t.emissiveOverride&&(s||2!==t.emissiveSourceOverride)}function c(e,t,r){const s=null!=e.emissionTexture,{emissiveSourceOverride:i}=t,o=1===i,a=2===i,n=u(e,t,r),c=l(e);return n?c?a?s?4:2:o?s?5:7:6:o?7:6:0}function h(e){return null!=e.overlay?.getTexture(3)}function d(e){return null!=e.overlay?.getTexture(1)}export{a as ComponentMaterial,c as calculateEmissionSource,u as calculateHasEmissions,l as calculateHasEmissiveBase,n as computeMaterialPass};
2
+ import{exactEquals as e}from"../../../../../../core/libs/gl-matrix-2/math/vec3.js";import{ZEROS as t}from"../../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ComponentTechnique as r}from"./ComponentTechnique.js";import{ComponentTechniqueConfiguration as s}from"./ComponentTechniqueConfiguration.js";import{MaterialBase as i}from"../../../core/material/MaterialBase.js";import{isColor as o}from"../../../core/shaderLibrary/ShaderOutput.js";class a extends i{constructor(e,t,r,i,o){super(),this.parameters=e,this.key=o,this.usePBR=e.usePBR,this.hasParametersFromSource=e.hasParametersFromSource,this.isGround=e.isGround,this.slicePlaneEnabled=e.slicePlaneEnabled,this.isIntegratedMesh=e.isIntegratedMesh,this.applySSAO=e.applySSAO,this.hasEmissions=u(e,r,i),this.materialPass=n(e,r),this._configuration=new s(i),this._initializeMaterialConfiguration(e,t,r,i)}destroy(){}acquireTechnique(e,t,s,i){const o=this._updateConfiguration(t,s);return e.get(r,o,i.layout)}_initializeMaterialConfiguration(e,t,r,s){const i=this._configuration;i.hasMetallicRoughnessTexture=null!=e.metallicRoughnessTexture,i.hasOcclusionTexture=null!=e.occlusionTexture,i.hasNormalTexture=null!=e.normalTexture,i.sphereDepthInterpolate=e.sphereDepthInterpolate&&i.spherical,i.ellipsoidMode=e.ellipsoidMode,i.doubleSidedMode=e.doubleSided?1:0,i.hasColorTexture=null!=e.baseColorTexture,i.cullFace=e.cullFace,i.alphaDiscardMode=e.alphaDiscardMode,i.hasVertexColors=t.hasVertexColors,i.textureCoordinateType=t.textureCoordinateType,i.shadeNormals=t.shadeNormals,i.normalType=t.hasNormals?1:2,i.polygonOffset=e.polygonOffset,i.vertexPositionRotationType=t.vertexPositionRotationType,i.vertexNormalRotationType=t.vertexNormalRotationType,i.componentDataType=r.componentDataType,i.emissionSource=c(e,r,s)}_updateConfiguration(e,t){const r=this._configuration,{identifier:s}=e,i=0===s;r.output=t.output,r.enableOITOffset=t.enableOITOffset,r.hasEmission=t.hasEmission&&i,r.renderOccluded=10===t.slot,r.terrainDepthTest=i&&t.terrainDepthTest,r.cullAboveTerrain=!!i&&t.cullAboveTerrain;const a=this.isIntegratedMesh?d(t)?h(t)?3:2:1:0;r.integratedMeshMode=a,r.pbrMode=3===a?4:this.usePBR?this.hasParametersFromSource?0!==r.shadeNormals&&this.isIntegratedMesh?0:2:1:0,r.hasSlicePlane=null!=t.slicePlane&&this.slicePlaneEnabled,r.isGroundSlice=r.hasSlicePlane&&this.isGround;const{materialPass:n}=this;r.transparent=i&&(1===n||2===n&&e.transparent||4===n)||r.isGroundSlice,r.hasHighlightMixTexture=2===s&&null!=t.highlightMixTexture,r.snowCover=i&&t.snowCover>0,r.vertexDiscardMode=i&&2===n?e.transparent?2:1:0;const l=o(t.output);return r.receiveAmbientOcclusion=l&&this.applySSAO&&!r.renderOccluded&&null!=t.ssao?.getTexture(),r.hasOccludees=l&&t.hasOccludees,r.receiveShadows=l&&t.shadowMap.ready,r.screenSpaceReflections=t.hasScreenSpaceReflections,r.cloudReflections=l&&null!=t.clouds.data?.cubeMap?.colorTexture,r}}function n(e,t){const{alphaDiscardMode:r,isIntegratedMesh:s,slicePlaneEnabled:i}=e,{transparent:o,opaqueOverride:a}=t,n=e.opacity<1,l=e.baseColor[3]<1;if(s)return n||i?4:3;if(n)return 1;if(0===a)return 0;if(l||0===r||3===r)return 1;switch(o){case 2:return 0;case 0:return 1;case 1:return 2}}function l(r){return null!=r.emissionTexture||!e(r.emissiveBaseColor,t)}function u(e,t,r){const s=l(e);return r.hasEmissionSupport&&2!==t.emissiveOverride&&(s||2!==t.emissiveSourceOverride)}function c(e,t,r){const s=null!=e.emissionTexture,{emissiveSourceOverride:i}=t,o=1===i,a=2===i,n=u(e,t,r),c=l(e);return n?c?a?s?4:2:o?s?5:7:6:o?7:6:0}function h(e){return null!=e.overlay?.getTexture(3)}function d(e){return null!=e.overlay?.getTexture(1)}export{a as ComponentMaterial,c as calculateEmissionSource,u as calculateHasEmissions,l as calculateHasEmissiveBase,n as computeMaterialPass};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- function n(n){return 5===n||6===n||7===n}function r(r){return n(r)||8===r||9===r}function t(n){return b(n)||4===n}function u(n){return 10===n||11===n}function e(n){return i(n)||u(n)}function o(n){return 1===n}function c(n){return 2===n}function f(n){return o(n)||c(n)}function i(n){return 0===n||f(n)}function p(n){return 10===n}function x(n){return i(n)||11===n}function a(n){return i(n)||u(n)}function b(n){return a(n)||d(n)}function d(n){return 3===n}function g(n){return d(n)||r(n)}export{e as is2DGeometryOutput,t as is3DGeometryOutputMRT,i as isColor,b as isColorHighlightOLIDOrDepth,a as isColorHighlightOrOLID,x as isColorOrOLID,d as isDepth,g as isDepthOrShadowLike,p as isHighlight,u as isHighlightOrOLID,f as isOIT,o as isOITColor,c as isOITFrontFace,n as isShadow,r as isShadowLike};
2
+ function n(n){return 5===n||6===n||7===n}function r(r){return n(r)||8===r||9===r}function t(n){return d(n)||4===n}function u(n){return t(n)||r(n)}function e(n){return 10===n||11===n}function o(n){return p(n)||e(n)}function c(n){return 1===n}function f(n){return 2===n}function i(n){return c(n)||f(n)}function p(n){return 0===n||i(n)}function x(n){return 10===n}function a(n){return p(n)||11===n}function b(n){return p(n)||e(n)}function d(n){return b(n)||g(n)}function g(n){return 3===n}function h(n){return g(n)||r(n)}export{o as is2DGeometryOutput,t as is3DGeometry,u as is3DGeometryOrShadowLike,p as isColor,d as isColorHighlightOLIDOrDepth,b as isColorHighlightOrOLID,a as isColorOrOLID,g as isDepth,h as isDepthOrShadowLike,x as isHighlight,e as isHighlightOrOLID,i as isOIT,c as isOITColor,f as isOITFrontFace,n as isShadow,r as isShadowLike};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import e from"../../../../../core/Error.js";import"../../../../../core/has.js";import{NestedMap as t}from"../../../../../core/NestedMap.js";import{ShaderTechniqueConfiguration as o}from"./ShaderTechniqueConfiguration.js";class c{constructor(e){this._context=e,this._debug=null,this._precompiling=this._debug?0:1,this._cache=new t}get context(){return this._context}get precompiling(){return this._precompiling}set precompiling(e){this._precompiling=e,0===e&&this.context.rctx.gl.flush()}destroy(){this._cache.forAll(e=>e.destroy()),this._cache.clear(),this._context=null}precompile(e,t=i){++this.precompiling,this.get(e,t),--this.precompiling}get(t,o=i,c){const r=o.key.code;let s=this._cache.get(t,r);if(null==s){if(s=new t(this.context,o,c),this._debug){if(0===this._precompiling){let c=`Uncached shader compile in ${(new Error).stack}\n for configuration\n${o.decode()}`;const n=this._cache.getInner(t);throw n?.size&&(c+="\n\n cached configurations:\n",c+=Array.from(n.values()).map(e=>o.decode(e.key)).sort().join("\n\n")),console.log(c),new e("shader:uncached-compile",c)}this._debug.set(s,new n(o,(new Error).stack))}this._cache.set(t,r,s)}return s}getCompiled(e,t=i,o){const c=this.get(e,t,o);return c.compiled?c:null}frameUpdate(){this._debug&&this._cache.forAll(t=>{if(!t.unused||t.ignoreUnused)return;const o=this._debug?.get(t),c=`Unused shader technique for ${t.declaredClass}\n${o?.configuration.decode(t.key)} \nfrom\n${o?.stack}`;throw console.log(c),new e("shader:unused-precompile",c)})}async reloadAll(){const e=new Array;this._cache.forEach(t=>e.push(r(t))),await Promise.all(e)}}class n{constructor(e,t){this.configuration=e,this.stack=t}}async function r(e){let t=!0;e.forEach(async e=>{await e.reload(t),t=!1})}const i=new o;export{i as NoConfiguration,c as ShaderTechniqueRepository};
2
+ import e from"../../../../../core/Error.js";import"../../../../../core/has.js";import{NestedMap as t}from"../../../../../core/NestedMap.js";import{ShaderTechniqueConfiguration as i}from"./ShaderTechniqueConfiguration.js";class r{constructor(e){this._context=e,this._debug=null,this._precompiling=this._debug?0:1,this._cache=new t,this._frame=0,this._debug&&"stackTraceLimit"in Error&&(Error.stackTraceLimit=50)}destroy(){this._cache.forAll(([e])=>e.destroy()),this._cache.clear(),this._context=null}get context(){return this._context}get precompiling(){return this._precompiling}set precompiling(e){this._precompiling=e,0===e&&this.context.rctx.gl.flush()}precompile(e,t=s){++this.precompiling,this.get(e,t),--this.precompiling}get(t,i=s,r){const c=i.key.code;let n=this._cache.get(t,c)?.[0];if(null==n){if(n=new t(this.context,i,r),this._debug){if(0===this._precompiling){const r=`Uncached ${n.declaredClass} compile in ${(new Error).stack}\n for configuration\n${i.decode()}`+this._debugCachedConfigurations(i,t);throw console.log(r),new e("shader:uncached-compile",r)}this._debug.set(n,new o(i,(new Error).stack))}this._cache.set(t,c,[n,this._frame])}return n}getCompiled(e,t=s,i){++this.precompiling;const r=this.get(e,t,i);return--this.precompiling,r.compiled?r:null}frameUpdate(){this._debug&&(this._cache.forAll(([t])=>{if(!t.unused||t.ignoreUnused)return;const i=this._debug?.get(t),r=`Unused ${t.declaredClass} for\n${i?.configuration.decode(t.key)} \nfrom\n${i?.stack}`;throw console.log(r),new e("shader:unused-precompile",r)}),++this._frame)}async reloadAll(){const e=new Array;this._cache.forEach(t=>e.push(c(t))),await Promise.all(e)}_debugCachedConfigurations(e,t){const i=this._cache.getInner(t);if(i?.size){let t="\n\n cached configurations:\n";return t+=Array.from(i.values()).map(([t,i])=>`at frame ${i}: ${e.decode(t.key)}`).sort().join("\n\n"),t}return""}}class o{constructor(e,t){this.configuration=e,this.stack=t}}async function c(e){let t=!0;e.forEach(async([e])=>{await e.reload(t),t=!1})}const s=new i;export{s as NoConfiguration,r as ShaderTechniqueRepository};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{releaseMaybe as t}from"../../../../core/maybe.js";import{signal as i}from"../../../../core/signal.js";import{create as e}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import h from"../../webgl/RenderCamera.js";import{CloudsParameters as s}from"../effects/clouds/CloudsParameters.js";import{ReprojectionUniforms as r}from"./ReprojectionUniforms.js";import{ScreenSpaceReflectionsUniforms as n}from"./ScreenSpaceReflectionsUniforms.js";import{SceneLighting as l}from"../lighting/SceneLighting.js";class g{constructor(t,i){this.width=t,this.height=i}}const o=5e5;class a{constructor(t,g){this._rctx=t,this.shadowMap=g,this._output=0,this.slot=2,this.slicePlane=null,this.hasOccludees=!1,this.hasEmission=!1,this.useFloatBlend=i(!0),this.enableFillLights=!0,this.alignPixelEnabled=!1,this.decorations=!0,this.overlayStretch=1,this.viewshedEnabled=!1,this.cutFillEnabled=!1,this._camera=new h,this._inverseViewport=e(),this._oldLighting=new l,this._newLighting=new l,this._fadedLighting=new l,this._lighting=this._newLighting,this.screenSpaceReflections=new n,this.reprojection=new r,this.terrainDepthTest=!1,this.cullAboveTerrain=!1,this.highlights=new Array,this.highlightOrderMap=new Map,this.highlightMixOrigin=e(),this.highlightMixTexture=null,this.hudRenderStyle=0,this.snowCover=0,this.clouds=new s,this.hasShadowHighlights=!1}destroy(){this._camera=null,this.contentCamera=null,this.depth=t(this.depth),this.geometryDepth=null,this.mainDepth=null,this.overlay=null,this.ssao=null,this.terrainDepth=null,this.shadowMap?.dispose()}get output(){return this._output}set output(t){this._output!==t&&(this._output=t,this._rctx.resetDrawBuffers(t))}get camera(){return this._camera}set camera(t){this._camera=t,this._inverseViewport[0]=1/t.fullViewport[2],this._inverseViewport[1]=1/t.fullViewport[3]}get enableOITOffset(){return 1===this.output&&this.camera.relativeElevation<o}get inverseViewport(){return this._inverseViewport}get lighting(){return this._lighting}fadeLighting(){switch(this.clouds.fadeFactor){case 0:this._lighting=this._oldLighting;break;default:this._fadedLighting.lerpLighting(this._oldLighting,this._newLighting,this.clouds.fadeFactor),this._lighting=this._fadedLighting;break;case 1:this._lighting=this._newLighting,this._oldLighting.copyFrom(this._newLighting)}}updateLighting(t,i,e,h){this._oldLighting.copyFrom(this.lighting),this._newLighting.noonFactor=i,this._newLighting.globalFactor=e,this._newLighting.set(t),this._oldLighting.updateLegacy(),1===h&&this.clouds.requestFade(),this.fadeLighting()}get highlight(){return null==this.highlightLevel?null:this.highlights[this.highlightLevel]}get depth(){return this._depth}set depth(t){t&&(t.name="geometry depth"),this._depth=t}get occluder(){return 11===this.slot||12===this.slot?this.slot:null}}export{a as BindParameters,g as ViewportSize};
2
+ import{releaseMaybe as t}from"../../../../core/maybe.js";import{signal as i}from"../../../../core/signal.js";import{create as e}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import h from"../../webgl/RenderCamera.js";import{isColor as s}from"../core/shaderLibrary/ShaderOutput.js";import{CloudsParameters as r}from"../effects/clouds/CloudsParameters.js";import{ReprojectionUniforms as n}from"./ReprojectionUniforms.js";import{ScreenSpaceReflectionsUniforms as l}from"./ScreenSpaceReflectionsUniforms.js";import{SceneLighting as o}from"../lighting/SceneLighting.js";class g{constructor(t,i){this.width=t,this.height=i}}const a=5e5;class c{constructor(t,s){this._rctx=t,this.shadowMap=s,this._output=0,this.slot=2,this.slicePlane=null,this.hasOccludees=!1,this.hasEmission=!1,this.useFloatBlend=i(!0),this.enableFillLights=!0,this.alignPixelEnabled=!1,this.decorations=!0,this.overlayStretch=1,this.viewshedEnabled=!1,this.cutFillComputationEnabled=!1,this.cutFillVisualizationEnabled=!1,this._camera=new h,this._inverseViewport=e(),this._oldLighting=new o,this._newLighting=new o,this._fadedLighting=new o,this._lighting=this._newLighting,this.screenSpaceReflections=new l,this.reprojection=new n,this.terrainDepthTest=!1,this.cullAboveTerrain=!1,this.highlights=new Array,this.highlightOrderMap=new Map,this.highlightMixOrigin=e(),this.highlightMixTexture=null,this.hudRenderStyle=0,this.snowCover=0,this.clouds=new r,this.hasShadowHighlights=!1}destroy(){this._camera=null,this.contentCamera=null,this.depth=t(this.depth),this.geometryDepth=null,this.mainDepth=null,this.overlay=null,this.ssao=null,this.terrainDepth=null,this.shadowMap?.dispose()}get output(){return this._output}set output(t){this._output!==t&&(this._output=t,this._rctx.resetDrawBuffers(t))}get camera(){return this._camera}set camera(t){this._camera=t,this._inverseViewport[0]=1/t.fullViewport[2],this._inverseViewport[1]=1/t.fullViewport[3]}get enableOITOffset(){return 1===this.output&&this.camera.relativeElevation<a}get inverseViewport(){return this._inverseViewport}get lighting(){return this._lighting}fadeLighting(){switch(this.clouds.fadeFactor){case 0:this._lighting=this._oldLighting;break;default:this._fadedLighting.lerpLighting(this._oldLighting,this._newLighting,this.clouds.fadeFactor),this._lighting=this._fadedLighting;break;case 1:this._lighting=this._newLighting,this._oldLighting.copyFrom(this._newLighting)}}updateLighting(t,i,e,h){this._oldLighting.copyFrom(this.lighting),this._newLighting.noonFactor=i,this._newLighting.globalFactor=e,this._newLighting.set(t),this._oldLighting.updateLegacy(),1===h&&this.clouds.requestFade(),this.fadeLighting()}get hasScreenSpaceReflections(){return s(this.output)&&this.screenSpaceReflections.enabled&&null!=this.reprojection.lastFrameColor}get highlight(){return null==this.highlightLevel?null:this.highlights[this.highlightLevel]}get depth(){return this._depth}set depth(t){t&&(t.name="geometry depth"),this._depth=t}get occluder(){return 11===this.slot||12===this.slot?this.slot:null}}export{c as BindParameters,g as ViewportSize};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as t}from"tslib";import{nextPowerOfTwo as e}from"../../../../core/mathUtils.js";import{disposeMaybe as i,destroyMaybe as r}from"../../../../core/maybe.js";import{property as s,subclass as h}from"../../../../core/accessorSupport/decorators.js";import{ortho as o}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{set as n}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as u}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UNIT_X as c,ZEROS as l}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{RenderNodeOutput as d,InternalRenderCategory as p}from"../../webgl.js";import{Frustum as f}from"../../state/Frustum.js";import{glLayout as _}from"../../support/buffer/glUtil.js";import{newLayout as m}from"../../support/buffer/InterleavedLayout.js";import g from"../../webgl/RenderCamera.js";import C from"../../webgl/RenderNode.js";import{ShaderOutputConfiguration as F}from"../core/shaderLibrary/ShaderOutputConfiguration.js";import{VertexArrayObject as R}from"./VertexArrayObject.js";import{C as w}from"../../../../chunks/CutFillDepth.glsl.js";import{CutFillDepthTechnique as x}from"../shaders/CutFillDepthTechnique.js";import{CutFillDepthTechniqueConfiguration as P}from"../shaders/CutFillDepthTechniqueConfiguration.js";import{C as T}from"../../../../chunks/CutFillReduction.glsl.js";import{CutFillReductionTechnique as y}from"../shaders/CutFillReductionTechnique.js";import{CutFillReductionTechniqueConfiguration as b}from"../shaders/CutFillReductionTechniqueConfiguration.js";import{C as B}from"../../../../chunks/CutFillTargetDepth.glsl.js";import{CutFillTargetDepthTechnique as D}from"../shaders/CutFillTargetDepthTechnique.js";import{ImmediateTask as j,TaskPriority as q}from"../../../support/Scheduler.js";import{Yield as E}from"../../../support/Yield.js";import{PrimitiveType as S,DataType as v}from"../../../webgl/enums.js";import{Sync as O}from"../../../webgl/Sync.js";import{VertexBuffer as V}from"../../../webgl/VertexBuffer.js";let A=class extends C{constructor(t){super(t),this.consumes={required:[d.TRANSPARENT]},this.produces=p.CUTFILL_COMPUTATION,this._cutFillTargetDepthConfiguration=new F,this._cutFillDepthConfiguration=new P,this._cutFillReductionConfiguration=new b,this._cutFillTargetDepthParameters=new B,this._cutFillDepthParameters=new w,this._cutFillReductionParameters=new T,this.needsRender=!1,this.readyToRun=!1,this.done=!0,this._frameTask=j,this._result=new k,this._localOrigin=a(),this._maxTextureSize=512,this._width=0,this._height=0,this._reducedWidth=0,this._reducedHeight=0,this._depthFormat=13,this._colorFormat=10,this._numChannels=2,this._targetGeometryVao=null,this._numReductions=3,this._reductionPasses=0,this._pixelBufferSize=0,this._pixelBufferOffset=0,this._perReductionPixelBufferSize=0}initialize(){this._frameTask=this.view.resourceController.scheduler.registerTask(q.VOLUME_MEASUREMENT,this),this.addHandles(this._frameTask),this._maxTextureSize=Math.min(this._maxTextureSize,this.fboCache.rctx.parameters.maxTextureSize),this._cutFillTargetDepthConfiguration.output=9,this._frustum=new f(this.view.renderCoordsHelper)}destroy(){this._targetGeometryVao=i(this._targetGeometryVao);const t=this.gl;this._sync=r(this._sync),this._pixelBuffer&&(t.deleteBuffer(this._pixelBuffer),this._pixelBuffer=null,this._pixelBufferSize=0)}precompile(){this.techniques.precompile(D,this._cutFillTargetDepthConfiguration),this._cutFillDepthConfiguration.preparePass=0,this.techniques.precompile(x,this._cutFillDepthConfiguration),this._cutFillDepthConfiguration.preparePass=1,this.techniques.precompile(x,this._cutFillDepthConfiguration),this._cutFillReductionConfiguration.reductionPass=0,this.techniques.precompile(y,this._cutFillReductionConfiguration),this._cutFillReductionConfiguration.reductionPass=1,this.techniques.precompile(y,this._cutFillReductionConfiguration),this._cutFillReductionConfiguration.reductionPass=2,this.techniques.precompile(y,this._cutFillReductionConfiguration),this.view.stage.renderer.precompileCutFillReferenceDepth()}render(t){const e=t.find(({name:t})=>t===this.produces);if(!this._orthographicCamera||!this._targetGeometryVao||!this.needsRender||this._sync)return e;const i=this.techniques.getCompiled(D,this._cutFillTargetDepthConfiguration);this._cutFillDepthConfiguration.preparePass=0;const r=this.techniques.getCompiled(x,this._cutFillDepthConfiguration);this._cutFillDepthConfiguration.preparePass=1;const s=this.techniques.getCompiled(x,this._cutFillDepthConfiguration);this._cutFillReductionConfiguration.reductionPass=0;const h=this.techniques.getCompiled(y,this._cutFillReductionConfiguration);this._cutFillReductionConfiguration.reductionPass=1;const o=this.techniques.getCompiled(y,this._cutFillReductionConfiguration);this._cutFillReductionConfiguration.reductionPass=2;const n=this.techniques.getCompiled(y,this._cutFillReductionConfiguration);if(!(i&&r&&s&&h&&o&&n))return this.requestRender(1),e;this.needsRender=!1;const u=this.renderingContext,a=this.fboCache,d=this.gl,p=u.getViewport(),f=a.acquire(this._width,this._height,"cutfill reference depth",this._depthFormat);u.bindFramebuffer(f.fbo),u.setViewport(0,0,this._width,this._height),u.clear(1280),this.view.stage.renderer.renderCutFillReferenceDepth(this._orthographicCamera);const _=a.acquire(this._width,this._height,"cutfill target depth",this._depthFormat);u.bindFramebuffer(_.fbo),u.setViewport(0,0,this._width,this._height),u.setClearDepth(1),u.clear(256),this._cutFillTargetDepthParameters.origin=this._localOrigin,this._cutFillTargetDepthParameters.cutFillCamera=this._orthographicCamera,u.bindTechnique(i,this.bindParameters,this._cutFillTargetDepthParameters),u.bindVAO(this._targetGeometryVao),u.drawArrays(S.TRIANGLES,0,this._targetGeometryVao.vertexCount("geometry"));const m=a.acquire(this._width,this._height,"cutfill reduction even",this._colorFormat),g=a.acquire(this._width,this._height,"cutfill reduction odd",this._colorFormat);return this._cutFillDepthParameters.referenceDepthTexture=f.depthTexture,this._cutFillDepthParameters.targetDepthTexture=_.depthTexture,this._pixelBuffer||(this._pixelBuffer=d.createBuffer()),d.bindBuffer(d.PIXEL_PACK_BUFFER,this._pixelBuffer),d.bufferData(d.PIXEL_PACK_BUFFER,this._pixelBufferSize,d.STREAM_READ),this._prepareFBO(m,this.width,this.height),u.bindTechnique(r,this.bindParameters,this._cutFillDepthParameters),u.screen.draw(),this._runPyramidReduction(m,g,h),this._prepareFBO(m,this.width,this.height,c),u.bindTechnique(s,this.bindParameters,this._cutFillDepthParameters),u.screen.draw(),this._runPyramidReduction(m,g,o),this._prepareFBO(m,this.width,this.height,l),u.bindTechnique(s,this.bindParameters,this._cutFillDepthParameters),u.screen.draw(),this._runPyramidReduction(m,g,n),f.release(),_.release(),m.release(),g.release(),d.bindBuffer(d.PIXEL_PACK_BUFFER,null),u.setViewport(p.x,p.y,p.width,p.height),this._sync=new O(d),setTimeout(()=>this.readyToRun=!0,0),e}update(t,i){if(!this.done)return;this.done=!1;const r=this.renderingContext,{cameraDimensions:{width:s,height:h},localOriginRenderSpace:o}=t,n=this._maxTextureSize,u=h/s,a=s>h?n:n/u,c=s>h?n*u:n;this._width=e(a),this._height=e(c);const l=[this._width,this._height];this._orthographicCamera=this._createCamera(t,l),this._frustum?.update(this._orthographicCamera),this._updateTargetVao(r,i),this._localOrigin=o,this._reductionPasses=Math.ceil(Math.log2(Math.min(this._width,this._height))),this._reducedWidth=Math.ceil(this._width/2**this._reductionPasses),this._reducedHeight=Math.ceil(this._height/2**this._reductionPasses),this._perReductionPixelBufferSize=this._reducedWidth*this._reducedHeight*this._numChannels*4,this._pixelBufferSize=this._perReductionPixelBufferSize*this._numReductions,this._pixelBufferOffset=0,this.needsRender=!0,this.requestRender(1)}runTask(){if(!this._sync)return void(this.readyToRun=!1);try{if(!this._sync.poll())return E}catch(e){return this.readyToRun=!1,void(this._sync=r(this._sync))}this.readyToRun=!1,this._sync=r(this._sync);const t=this.gl;this._cpuBuffer=new Float32Array(this._pixelBufferSize/4),t.bindBuffer(t.PIXEL_PACK_BUFFER,this._pixelBuffer),t.getBufferSubData(t.PIXEL_PACK_BUFFER,0,this._cpuBuffer),t.bindBuffer(t.PIXEL_PACK_BUFFER,null),this._updateResults(this._cpuBuffer),this.done=!0}getResult(){return this._result}get frustum(){return this._frustum}get width(){return this._width}get height(){return this._height}get updating(){return this.readyToRun||!this.done||this._frameTask.updating}_runPyramidReduction(t,e,i){const r=this.renderingContext,s=this.gl;let h=this._width,o=this._height;for(let n=0;n<this._reductionPasses;n++)h=Math.ceil(h/2),o=Math.ceil(o/2),this._cutFillReductionParameters.depthTexture=t.getTexture(),this._prepareFBO(e,h,o),r.bindTechnique(i,this.bindParameters,this._cutFillReductionParameters),r.screen.draw(),[t,e]=[e,t];s.readPixels(0,0,h,o,33319,v.FLOAT,this._pixelBufferOffset),this._pixelBufferOffset+=this._perReductionPixelBufferSize}_updateResults(t){const e=new U(0,1,u()),i=new U(0,0,u());for(let r=0;r<this._reducedWidth;r++)for(let s=0;s<this._reducedHeight;s++){let h=(r+s*this._reducedWidth)*this._numChannels;const o=this._reducedWidth*this._reducedHeight*this._numChannels;e.totalDepth+=t[h],i.totalDepth+=t[h+1],h+=o;const n=t[h];n<e.depthExtremum&&(e.depthExtremum=n,M(e.depthExtremumCoords,t[h+1],this._width)),h+=o;const u=t[h];u>i.depthExtremum&&(i.depthExtremum=u,M(i.depthExtremumCoords,t[h+1],this._width))}this._result=new k(this._width,this._height,e,i)}_prepareFBO(t,e,i,r=l){const s=this.renderingContext;s.bindFramebuffer(t.fbo),s.setViewport(0,0,e,i),s.setClearColor(r[0],r[1],r[2],r[3]),s.clear(16384)}_createCamera(t,e){const{cameraPositionRenderSpace:i,localOriginRenderSpace:r,northVector:s,cameraDimensions:{width:h,height:n},cameraNearFar:{near:u,far:a}}=t,c=new g({eye:i,center:r,up:s,near:u,far:a});return c.viewport=[0,0,e[0],e[1]],o(c.projectionMatrix,-h/2,h/2,-n/2,n/2,u,a),c}_updateTargetVao(t,e){this._targetGeometryVao=i(this._targetGeometryVao);const r=e.reduce((t,e)=>t+e.indices.length,0),s=z.createBuffer(r),h=s.position;let o=0;for(const i of e){const{positions:t,indices:e}=i;for(let i=0;i<e.length;++i){const r=3*e[i];h.set(o,0,t[r]),h.set(o,1,t[r+1]),h.set(o,2,t[r+2]),o++}}const n=new V(t,_(z),s.buffer);this._targetGeometryVao=new R(t,n)}};t([s()],A.prototype,"consumes",void 0),t([s()],A.prototype,"produces",void 0),t([s()],A.prototype,"needsRender",void 0),t([s()],A.prototype,"readyToRun",void 0),t([s()],A.prototype,"done",void 0),t([s()],A.prototype,"updating",null),t([s()],A.prototype,"_frameTask",void 0),A=t([h("esri.views.3d.webgl-engine.lib.CutFillComputationRenderNode")],A);const z=m().vec3f("position").freeze();function M(t,e,i){const r=e%i,s=Math.floor(e/i);n(t,r,s)}class L{constructor(t,e){this.positions=t,this.indices=e}}class U{constructor(t,e,i){this.totalDepth=t,this.depthExtremum=e,this.depthExtremumCoords=i}}class k{constructor(t=0,e=0,i=new U(0,1,u()),r=new U(0,0,u())){this.width=t,this.height=e,this.cut=i,this.fill=r}}export{A as CutFillComputationRenderNode,k as CutFillComputationResult,U as CutFillDepthResult,L as TargetGeometryRenderInfo};
2
+ import{__decorate as t}from"tslib";import{nextPowerOfTwo as e}from"../../../../core/mathUtils.js";import{disposeMaybe as i,destroyMaybe as r}from"../../../../core/maybe.js";import{property as s,subclass as h}from"../../../../core/accessorSupport/decorators.js";import{ortho as o}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{set as n}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as u}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UNIT_X as c,ZEROS as l}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{RenderNodeOutput as d,InternalRenderCategory as p}from"../../webgl.js";import{Frustum as f}from"../../state/Frustum.js";import{glLayout as _}from"../../support/buffer/glUtil.js";import{newLayout as m}from"../../support/buffer/InterleavedLayout.js";import g from"../../webgl/RenderCamera.js";import C from"../../webgl/RenderNode.js";import{ShaderOutputConfiguration as F}from"../core/shaderLibrary/ShaderOutputConfiguration.js";import{VertexArrayObject as R}from"./VertexArrayObject.js";import{C as w}from"../../../../chunks/CutFillDepth.glsl.js";import{CutFillDepthTechnique as x}from"../shaders/CutFillDepthTechnique.js";import{CutFillDepthTechniqueConfiguration as P}from"../shaders/CutFillDepthTechniqueConfiguration.js";import{C as T}from"../../../../chunks/CutFillReduction.glsl.js";import{CutFillReductionTechnique as y}from"../shaders/CutFillReductionTechnique.js";import{CutFillReductionTechniqueConfiguration as b}from"../shaders/CutFillReductionTechniqueConfiguration.js";import{C as B}from"../../../../chunks/CutFillTargetDepth.glsl.js";import{CutFillTargetDepthTechnique as D}from"../shaders/CutFillTargetDepthTechnique.js";import{ImmediateTask as j,TaskPriority as q}from"../../../support/Scheduler.js";import{Yield as E}from"../../../support/Yield.js";import{PrimitiveType as S,DataType as O}from"../../../webgl/enums.js";import{Sync as v}from"../../../webgl/Sync.js";import{VertexBuffer as V}from"../../../webgl/VertexBuffer.js";let A=class extends C{constructor(t){super(t),this.consumes={required:[d.TRANSPARENT]},this.produces=p.CUTFILL_COMPUTATION,this._cutFillTargetDepthConfiguration=new F,this._cutFillDepthConfiguration=new P,this._cutFillReductionConfiguration=new b,this._cutFillTargetDepthParameters=new B,this._cutFillDepthParameters=new w,this._cutFillReductionParameters=new T,this.needsRender=!1,this.readyToRun=!1,this.done=!0,this._frameTask=j,this._result=new k,this._localOrigin=a(),this._maxTextureSize=512,this._width=0,this._height=0,this._reducedWidth=0,this._reducedHeight=0,this._depthFormat=13,this._colorFormat=10,this._numChannels=2,this._targetGeometryVao=null,this._numReductions=3,this._reductionPasses=0,this._pixelBufferSize=0,this._pixelBufferOffset=0,this._perReductionPixelBufferSize=0}initialize(){this._frameTask=this.view.resourceController.scheduler.registerTask(q.VOLUME_MEASUREMENT,this),this.addHandles(this._frameTask),this._maxTextureSize=Math.min(this._maxTextureSize,this.fboCache.rctx.parameters.maxTextureSize),this._cutFillTargetDepthConfiguration.output=9,this._frustum=new f(this.view.renderCoordsHelper)}destroy(){this._targetGeometryVao=i(this._targetGeometryVao);const t=this.gl;this._sync=r(this._sync),this._pixelBuffer&&(t.deleteBuffer(this._pixelBuffer),this._pixelBuffer=null,this._pixelBufferSize=0)}precompile(){this.techniques.precompile(D,this._cutFillTargetDepthConfiguration),this._cutFillDepthConfiguration.preparePass=0,this.techniques.precompile(x,this._cutFillDepthConfiguration),this._cutFillDepthConfiguration.preparePass=1,this.techniques.precompile(x,this._cutFillDepthConfiguration),this._cutFillReductionConfiguration.reductionPass=0,this.techniques.precompile(y,this._cutFillReductionConfiguration),this._cutFillReductionConfiguration.reductionPass=1,this.techniques.precompile(y,this._cutFillReductionConfiguration),this._cutFillReductionConfiguration.reductionPass=2,this.techniques.precompile(y,this._cutFillReductionConfiguration),this.view.stage.renderer.precompileCutFillOrthographicReferenceDepth()}render(t){const e=t.find(({name:t})=>t===this.produces);if(!this._orthographicCamera||!this._targetGeometryVao||!this.needsRender||this._sync)return e;const i=this.techniques.getCompiled(D,this._cutFillTargetDepthConfiguration);this._cutFillDepthConfiguration.preparePass=0;const r=this.techniques.getCompiled(x,this._cutFillDepthConfiguration);this._cutFillDepthConfiguration.preparePass=1;const s=this.techniques.getCompiled(x,this._cutFillDepthConfiguration);this._cutFillReductionConfiguration.reductionPass=0;const h=this.techniques.getCompiled(y,this._cutFillReductionConfiguration);this._cutFillReductionConfiguration.reductionPass=1;const o=this.techniques.getCompiled(y,this._cutFillReductionConfiguration);this._cutFillReductionConfiguration.reductionPass=2;const n=this.techniques.getCompiled(y,this._cutFillReductionConfiguration);if(!(i&&r&&s&&h&&o&&n))return this.requestRender(1),e;this.needsRender=!1;const u=this.renderingContext,a=this.fboCache,d=this.gl,p=u.getViewport(),f=a.acquire(this._width,this._height,"cutfill reference depth",this._depthFormat);u.bindFramebuffer(f.fbo),u.setViewport(0,0,this._width,this._height),u.clear(1280),this.view.stage.renderer.renderCutFillOrthographicReferenceDepth(this._orthographicCamera);const _=a.acquire(this._width,this._height,"cutfill target depth",this._depthFormat);u.bindFramebuffer(_.fbo),u.setViewport(0,0,this._width,this._height),u.setClearDepth(1),u.clear(256),this._cutFillTargetDepthParameters.origin=this._localOrigin,this._cutFillTargetDepthParameters.cutFillCamera=this._orthographicCamera,u.bindTechnique(i,this.bindParameters,this._cutFillTargetDepthParameters),u.bindVAO(this._targetGeometryVao),u.drawArrays(S.TRIANGLES,0,this._targetGeometryVao.vertexCount("geometry"));const m=a.acquire(this._width,this._height,"cutfill reduction even",this._colorFormat),g=a.acquire(this._width,this._height,"cutfill reduction odd",this._colorFormat);return this._cutFillDepthParameters.referenceDepthTexture=f.depthTexture,this._cutFillDepthParameters.targetDepthTexture=_.depthTexture,this._pixelBuffer||(this._pixelBuffer=d.createBuffer()),d.bindBuffer(d.PIXEL_PACK_BUFFER,this._pixelBuffer),d.bufferData(d.PIXEL_PACK_BUFFER,this._pixelBufferSize,d.STREAM_READ),this._prepareFBO(m,this.width,this.height),u.bindTechnique(r,this.bindParameters,this._cutFillDepthParameters),u.screen.draw(),this._runPyramidReduction(m,g,h),this._prepareFBO(m,this.width,this.height,c),u.bindTechnique(s,this.bindParameters,this._cutFillDepthParameters),u.screen.draw(),this._runPyramidReduction(m,g,o),this._prepareFBO(m,this.width,this.height,l),u.bindTechnique(s,this.bindParameters,this._cutFillDepthParameters),u.screen.draw(),this._runPyramidReduction(m,g,n),f.release(),_.release(),m.release(),g.release(),d.bindBuffer(d.PIXEL_PACK_BUFFER,null),u.setViewport(p.x,p.y,p.width,p.height),this._sync=new v(d),setTimeout(()=>this.readyToRun=!0,0),e}update(t,i){if(!this.done)return;this.done=!1;const r=this.renderingContext,{cameraDimensions:{width:s,height:h},localOriginRenderSpace:o}=t,n=this._maxTextureSize,u=h/s,a=s>h?n:n/u,c=s>h?n*u:n;this._width=e(a),this._height=e(c);const l=[this._width,this._height];this._orthographicCamera=this._createCamera(t,l),this._frustum?.update(this._orthographicCamera),this._updateTargetVao(r,i),this._localOrigin=o,this._reductionPasses=Math.ceil(Math.log2(Math.min(this._width,this._height))),this._reducedWidth=Math.ceil(this._width/2**this._reductionPasses),this._reducedHeight=Math.ceil(this._height/2**this._reductionPasses),this._perReductionPixelBufferSize=this._reducedWidth*this._reducedHeight*this._numChannels*4,this._pixelBufferSize=this._perReductionPixelBufferSize*this._numReductions,this._pixelBufferOffset=0,this.needsRender=!0,this.requestRender(1)}runTask(){if(!this._sync)return void(this.readyToRun=!1);try{if(!this._sync.poll())return E}catch(e){return this.readyToRun=!1,void(this._sync=r(this._sync))}this.readyToRun=!1,this._sync=r(this._sync);const t=this.gl;this._cpuBuffer=new Float32Array(this._pixelBufferSize/4),t.bindBuffer(t.PIXEL_PACK_BUFFER,this._pixelBuffer),t.getBufferSubData(t.PIXEL_PACK_BUFFER,0,this._cpuBuffer),t.bindBuffer(t.PIXEL_PACK_BUFFER,null),this._updateResults(this._cpuBuffer),this.done=!0}getResult(){return this._result}get frustum(){return this._frustum}get width(){return this._width}get height(){return this._height}get updating(){return this.readyToRun||!this.done||this._frameTask.updating}_runPyramidReduction(t,e,i){const r=this.renderingContext,s=this.gl;let h=this._width,o=this._height;for(let n=0;n<this._reductionPasses;n++)h=Math.ceil(h/2),o=Math.ceil(o/2),this._cutFillReductionParameters.depthTexture=t.getTexture(),this._prepareFBO(e,h,o),r.bindTechnique(i,this.bindParameters,this._cutFillReductionParameters),r.screen.draw(),[t,e]=[e,t];s.readPixels(0,0,h,o,33319,O.FLOAT,this._pixelBufferOffset),this._pixelBufferOffset+=this._perReductionPixelBufferSize}_updateResults(t){const e=new U(0,1,u()),i=new U(0,0,u());for(let r=0;r<this._reducedWidth;r++)for(let s=0;s<this._reducedHeight;s++){let h=(r+s*this._reducedWidth)*this._numChannels;const o=this._reducedWidth*this._reducedHeight*this._numChannels;e.totalDepth+=t[h],i.totalDepth+=t[h+1],h+=o;const n=t[h];n<e.depthExtremum&&(e.depthExtremum=n,M(e.depthExtremumCoords,t[h+1],this._width)),h+=o;const u=t[h];u>i.depthExtremum&&(i.depthExtremum=u,M(i.depthExtremumCoords,t[h+1],this._width))}this._result=new k(this._width,this._height,e,i)}_prepareFBO(t,e,i,r=l){const s=this.renderingContext;s.bindFramebuffer(t.fbo),s.setViewport(0,0,e,i),s.setClearColor(r[0],r[1],r[2],r[3]),s.clear(16384)}_createCamera(t,e){const{cameraPositionRenderSpace:i,localOriginRenderSpace:r,northVector:s,cameraDimensions:{width:h,height:n},cameraNearFar:{near:u,far:a}}=t,c=new g({eye:i,center:r,up:s,near:u,far:a});return c.viewport=[0,0,e[0],e[1]],o(c.projectionMatrix,-h/2,h/2,-n/2,n/2,u,a),c}_updateTargetVao(t,e){this._targetGeometryVao=i(this._targetGeometryVao);const r=e.reduce((t,e)=>t+e.indices.length,0),s=z.createBuffer(r),h=s.position;let o=0;for(const i of e){const{positions:t,indices:e}=i;for(let i=0;i<e.length;++i){const r=3*e[i];h.set(o,0,t[r]),h.set(o,1,t[r+1]),h.set(o,2,t[r+2]),o++}}const n=new V(t,_(z),s.buffer);this._targetGeometryVao=new R(t,n)}};t([s()],A.prototype,"consumes",void 0),t([s()],A.prototype,"produces",void 0),t([s()],A.prototype,"needsRender",void 0),t([s()],A.prototype,"readyToRun",void 0),t([s()],A.prototype,"done",void 0),t([s()],A.prototype,"updating",null),t([s()],A.prototype,"_frameTask",void 0),A=t([h("esri.views.3d.webgl-engine.lib.CutFillComputationRenderNode")],A);const z=m().vec3f("position").freeze();function M(t,e,i){const r=e%i,s=Math.floor(e/i);n(t,r,s)}class L{constructor(t,e){this.positions=t,this.indices=e}}class U{constructor(t,e,i){this.totalDepth=t,this.depthExtremum=e,this.depthExtremumCoords=i}}class k{constructor(t=0,e=0,i=new U(0,1,u()),r=new U(0,0,u())){this.width=t,this.height=e,this.cut=i,this.fill=r}}export{A as CutFillComputationRenderNode,k as CutFillComputationResult,U as CutFillDepthResult,L as TargetGeometryRenderInfo};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{disposeMaybe as t}from"../../../../core/maybe.js";import{watch as i,syncAndInitial as s}from"../../../../core/reactiveUtils.js";import{property as o,subclass as r}from"../../../../core/accessorSupport/decorators.js";import{copy as l}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{RenderNodeOutput as a,InternalRenderCategory as n}from"../../webgl.js";import{glLayout as u}from"../../support/buffer/glUtil.js";import{newLayout as c}from"../../support/buffer/InterleavedLayout.js";import h from"../../webgl/RenderNode.js";import{VertexArrayObject as m}from"./VertexArrayObject.js";import{C as d}from"../../../../chunks/CutFillComposition.glsl.js";import{CutFillCompositionTechnique as f}from"../shaders/CutFillCompositionTechnique.js";import{C as p}from"../../../../chunks/CutFillMask.glsl.js";import{CutFillMaskTechnique as C}from"../shaders/CutFillMaskTechnique.js";import{DefaultMaterialPassParameters as _,DefaultMaterialDrawParameters as b,DefaultMaterialTechnique as g}from"../shaders/DefaultMaterialTechnique.js";import{DefaultMaterialTechniqueConfiguration as V}from"../shaders/DefaultMaterialTechniqueConfiguration.js";import{DepthStencilAttachment as v,PrimitiveType as w}from"../../../webgl/enums.js";import{noParameters as F}from"../../../webgl/NoParameters.js";import{VertexBuffer as P}from"../../../webgl/VertexBuffer.js";let y=class extends h{constructor(e){super(e),this.consumes={required:[a.OPAQUE]},this.produces=n.CUTFILL_COLOR,this.measureType="cut-fill",this._vaoCut=null,this._vaoFill=null,this._maskParameters=new p,this._cutVolumeParameters=new _,this._fillVolumeParameters=new _,this._compositeParameters=new d,this._drawParameters=new b;const t=1===e.view.state.viewingMode;this._cutVolumeConfiguration=new V(t),this._cutVolumeConfiguration.customDepthTest=2,this._cutVolumeConfiguration.writeDepth=!1,this._cutVolumeConfiguration.cullFace=1,this._cutVolumeConfiguration.doubleSidedMode=2,this._fillVolumeConfiguration=new V(t),this._fillVolumeConfiguration.cullFace=2}initialize(){this.addHandles([i(()=>[this.cutColor,this.fillColor],()=>this._updateColors(),s),i(()=>this.measureType,()=>this.requestRender(1),s)])}destroy(){this._disposeVaos()}precompile(){"cut-fill"===this.measureType?(this._cutVolumeConfiguration.cullFace=1,this._cutVolumeConfiguration.doubleSidedMode=2):(this._cutVolumeConfiguration.cullFace=0,this._cutVolumeConfiguration.doubleSidedMode=0),this.techniques.precompile(g,this._cutVolumeConfiguration),this.techniques.precompile(g,this._fillVolumeConfiguration),this.techniques.precompile(C),this.techniques.precompile(f)}render(e){const t=this.techniques.getCompiled(g,this._cutVolumeConfiguration),i=this.techniques.getCompiled(g,this._fillVolumeConfiguration),s=this.techniques.getCompiled(C),o=this.techniques.getCompiled(f),r=e.find(({name:e})=>e===this.produces);if(!this._vaoCut||!this._vaoFill)return r;const l=this._vaoCut.vertexCount("geometry"),a=this._vaoFill.vertexCount("geometry");if(!(t&&i&&s&&o))return this.requestRender(1),r;const n=this.bindParameters,u=n.camera,c=u.fullViewport[2],h=u.fullViewport[3],m=this.renderingContext,d=this.fboCache,p=d.acquire(c,h,"cutfill color mask",2);p.attachDepth(r.getAttachment(v)),m.bindFramebuffer(p.fbo),m.setClearColor(0,0,0,1),m.clear(17408),m.setViewport(0,0,c,h),m.bindTechnique(s,n,F,this._maskParameters),m.setFaceCullingEnabled(!1),m.setStencilTestEnabled(!0),m.setStencilOpSeparate(1028,7680,34055,7680),m.setStencilOpSeparate(1029,7680,34056,7680),m.setDepthWriteEnabled(!1),m.bindVAO(this._vaoCut),m.setDepthTestEnabled(!0),m.setStencilWriteMask(255),m.setStencilFunction(519,0,255),m.setColorMask(!1,!1,!1,!1),m.drawArrays(w.TRIANGLES,0,l),m.setDepthTestEnabled(!1),m.setStencilWriteMask(0),m.setStencilFunction(517,0,255),m.setColorMask(!0,!1,!1,!1),m.drawArrays(w.TRIANGLES,0,l),m.bindVAO(this._vaoFill),m.setDepthTestEnabled(!0),m.setStencilWriteMask(255),m.setStencilFunction(519,0,255),m.setColorMask(!1,!0,!1,!1),m.drawArrays(w.TRIANGLES,0,a);const _=d.acquire(c,h,"cutfill color volumes",5);_.attachDepth(r.getAttachment(v)),m.bindFramebuffer(_.fbo),m.setClearColor(0,0,0,0),m.clear(16384),m.setColorMask(!0,!0,!0,!0),m.bindTechnique(t,this.bindParameters,this._cutVolumeParameters,this._drawParameters),m.setPolygonOffset(1,1),m.setPolygonOffsetFillEnabled(!0),m.bindVAO(this._vaoCut),m.drawArrays(w.TRIANGLES,0,l),m.bindTechnique(i,this.bindParameters,this._fillVolumeParameters,this._drawParameters),m.setPolygonOffset(0,0),m.setPolygonOffsetFillEnabled(!1),m.bindVAO(this._vaoFill),m.drawArrays(w.TRIANGLES,0,a);const b=this.fboCache.acquire(c,h,this.produces);return m.bindFramebuffer(b.fbo),this._compositeParameters.color=r.getTexture(),this._compositeParameters.cutFillVolumes=_.getTexture(),this._compositeParameters.cutFillMask=p.getTexture(),this.borderColor.toUnitRGBA(this._compositeParameters.borderColor),m.bindTechnique(o,n,this._compositeParameters),m.screen.draw(),p.release(),_.release(),b.attachDepth(r.getAttachment(v)),b}enable(){this.produces=n.CUTFILL_COLOR,this.requestRender(1)}disable(){this.produces="disabled",this.requestRender(1)}updateGeometries(e,t,i){this._disposeVaos(),this._vaoCut=this._createVao(e),this._vaoFill=this._createVao(t),this._maskParameters.origin=i,l(this._drawParameters.origin,i),this.requestRender(1)}_updateColors(){this._cutVolumeParameters.diffuse=this.cutColor.toUnitRGB(),this._cutVolumeParameters.opacity=this.cutColor.a,this._fillVolumeParameters.diffuse=this.fillColor.toUnitRGB(),this._fillVolumeParameters.opacity=this.fillColor.a,this.requestRender(1)}_createVao(e){const t=e.reduce((e,{indicesBottom:t,indicesExtruded:i})=>e+t.length+i.length,0),i=this.renderingContext,s=T.createBuffer(t),{position:o,normal:r}=s;let l=0;for(const n of e){const{vertices:e,normals:t,indicesBottom:i,indicesExtruded:s}=n;for(let a=0;a<i.length;a++){const s=3*i[a];o.set(l,0,e[s]),o.set(l,1,e[s+1]),o.set(l,2,e[s+2]),r.set(l,0,t[s]),r.set(l,1,t[s+1]),r.set(l,2,t[s+2]),l++}for(let a=0;a<s.length;a++){const i=3*s[a];o.set(l,0,e[i]),o.set(l,1,e[i+1]),o.set(l,2,e[i+2]),r.set(l,0,t[i]),r.set(l,1,t[i+1]),r.set(l,2,t[i+2]),l++}}const a=new P(i,u(T),s.buffer);return new m(i,a)}_disposeVaos(){this._vaoCut=t(this._vaoCut),this._vaoFill=t(this._vaoFill)}};e([o()],y.prototype,"consumes",void 0),e([o()],y.prototype,"produces",void 0),e([o()],y.prototype,"cutColor",void 0),e([o()],y.prototype,"fillColor",void 0),e([o()],y.prototype,"borderColor",void 0),e([o()],y.prototype,"measureType",void 0),y=e([r("esri.views.3d.webgl-engine.lib.CutFillVisualizationRenderNode")],y);const T=c().vec3f("position").vec3f("normal").freeze();class q{constructor(e,t,i,s){this.vertices=e,this.indicesBottom=t,this.indicesExtruded=i,this.normals=s}}export{y as CutFillVisualizationRenderNode,q as VolumeGeometry};
2
+ import{__decorate as e}from"tslib";import{disposeMaybe as t}from"../../../../core/maybe.js";import{watch as i,syncAndInitial as s}from"../../../../core/reactiveUtils.js";import{property as o,subclass as r}from"../../../../core/accessorSupport/decorators.js";import{copy as a}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{InternalRenderCategory as l}from"../../webgl.js";import{glLayout as u}from"../../support/buffer/glUtil.js";import{newLayout as n}from"../../support/buffer/InterleavedLayout.js";import c from"../../webgl/RenderNode.js";import{VertexArrayObject as m}from"./VertexArrayObject.js";import{C as h}from"../../../../chunks/CutFillComposition.glsl.js";import{CutFillCompositionTechnique as d}from"../shaders/CutFillCompositionTechnique.js";import{C as f}from"../../../../chunks/CutFillMask.glsl.js";import{CutFillMaskTechnique as p}from"../shaders/CutFillMaskTechnique.js";import{DefaultMaterialPassParameters as C,DefaultMaterialDrawParameters as _,DefaultMaterialTechnique as b}from"../shaders/DefaultMaterialTechnique.js";import{DefaultMaterialTechniqueConfiguration as g}from"../shaders/DefaultMaterialTechniqueConfiguration.js";import{DepthStencilAttachment as V,PrimitiveType as v}from"../../../webgl/enums.js";import{noParameters as T}from"../../../webgl/NoParameters.js";import{VertexBuffer as w}from"../../../webgl/VertexBuffer.js";let F=class extends c{constructor(e){super(e),this.consumes={required:[l.CUTFILL_COLOR,l.GROUND_DEPTH]},this.produces=l.CUTFILL_COLOR,this.measureType="cut-fill",this._vaoCut=null,this._vaoFill=null,this._maskParameters=new f,this._cutVolumeParameters=new C,this._fillVolumeParameters=new C,this._compositeParameters=new h,this._drawParameters=new _;const t=1===e.view.state.viewingMode;this._cutVolumeConfiguration=new g(t),this._cutVolumeConfiguration.customDepthTest=2,this._cutVolumeConfiguration.writeDepth=!1,this._cutVolumeConfiguration.cullFace=1,this._cutVolumeConfiguration.doubleSidedMode=2,this._fillVolumeConfiguration=new g(t),this._fillVolumeConfiguration.customDepthTest=1,this._fillVolumeConfiguration.cullFace=2}initialize(){this.addHandles([i(()=>[this.cutColor,this.fillColor],()=>this._updateColors(),s),i(()=>this.measureType,()=>this.requestRender(1),s)])}destroy(){this._disposeVaos()}precompile(){"cut-fill"===this.measureType?(this._cutVolumeConfiguration.cullFace=1,this._cutVolumeConfiguration.doubleSidedMode=2):(this._cutVolumeConfiguration.cullFace=0,this._cutVolumeConfiguration.doubleSidedMode=0),this.techniques.precompile(b,this._cutVolumeConfiguration),this.techniques.precompile(b,this._fillVolumeConfiguration),this.techniques.precompile(p),this.techniques.precompile(d)}render(e){const t=this.techniques.getCompiled(b,this._cutVolumeConfiguration),i=this.techniques.getCompiled(b,this._fillVolumeConfiguration),s=this.techniques.getCompiled(p),o=this.techniques.getCompiled(d),r=e.find(({name:e})=>e===this.produces);if(!this._vaoCut||!this._vaoFill)return r;const a=this._vaoCut.vertexCount("geometry"),u=this._vaoFill.vertexCount("geometry");if(!(t&&i&&s&&o))return this.requestRender(1),r;const n=this.bindParameters,c=n.camera,m=c.fullViewport[2],h=c.fullViewport[3],f=this.renderingContext,C=this.fboCache,_=e.find(({name:e})=>e===l.GROUND_DEPTH),g=C.acquire(m,h,"cutfill color mask",2);g.attachDepth(_.getAttachment(V)),f.bindFramebuffer(g.fbo),f.setClearColor(0,0,0,1),f.clear(17408),f.setViewport(0,0,m,h),f.bindTechnique(s,n,T,this._maskParameters),f.setFaceCullingEnabled(!1),f.setStencilTestEnabled(!0),f.setStencilOpSeparate(1028,7680,34055,7680),f.setStencilOpSeparate(1029,7680,34056,7680),f.setDepthWriteEnabled(!1),f.bindVAO(this._vaoCut),f.setDepthTestEnabled(!0),f.setStencilWriteMask(255),f.setStencilFunction(519,0,255),f.setColorMask(!1,!1,!1,!1),f.drawArrays(v.TRIANGLES,0,a),f.setDepthTestEnabled(!1),f.setStencilWriteMask(0),f.setStencilFunction(517,0,255),f.setColorMask(!0,!1,!1,!1),f.drawArrays(v.TRIANGLES,0,a),f.bindVAO(this._vaoFill),f.setDepthTestEnabled(!0),f.setStencilWriteMask(255),f.setStencilFunction(519,0,255),f.setColorMask(!1,!0,!1,!1),f.drawArrays(v.TRIANGLES,0,u);const w=C.acquire(m,h,"cutfill color cut volume",5);w.acquireDepth(13),f.blitFramebuffer(r.fbo,w.fbo,256),f.bindFramebuffer(w.fbo),f.setClearColor(0,0,0,0),f.clear(16384),f.setColorMask(!0,!0,!0,!0),f.bindTechnique(t,this.bindParameters,this._cutVolumeParameters,this._drawParameters),f.bindVAO(this._vaoCut),f.drawArrays(v.TRIANGLES,0,a);const F=C.acquire(m,h,"cutfill color fill volume",5);F.acquireDepth(13),f.blitFramebuffer(r.fbo,F.fbo,256),f.bindFramebuffer(F.fbo),f.setClearColor(0,0,0,0),f.clear(16384),f.setColorMask(!0,!0,!0,!0),f.bindTechnique(i,this.bindParameters,this._fillVolumeParameters,this._drawParameters),f.bindVAO(this._vaoFill),f.drawArrays(v.TRIANGLES,0,u);const P=this.fboCache.acquire(m,h,this.produces);return f.bindFramebuffer(P.fbo),this._compositeParameters.color=r.getTexture(),this._compositeParameters.cutVolume=w.getTexture(),this._compositeParameters.fillVolume=F.getTexture(),this._compositeParameters.cutFillMask=g.getTexture(),this._compositeParameters.sceneDepth=r.getTexture(V),this._compositeParameters.referenceDepth=_.getTexture(V),this.borderColor.toUnitRGBA(this._compositeParameters.borderColor),f.bindTechnique(o,n,this._compositeParameters),f.screen.draw(),g.release(),w.release(),F.release(),P.attachDepth(r.getAttachment(V)),P}enable(){this.produces=l.CUTFILL_COLOR,this.requestRender(1)}disable(){this.produces="disabled",this.requestRender(1)}updateGeometries(e,t,i){this._disposeVaos(),this._vaoCut=this._createVao(e),this._vaoFill=this._createVao(t),this._maskParameters.origin=i,a(this._drawParameters.origin,i),this.requestRender(1)}_updateColors(){this._cutVolumeParameters.diffuse=this.cutColor.toUnitRGB(),this._cutVolumeParameters.opacity=this.cutColor.a,this._fillVolumeParameters.diffuse=this.fillColor.toUnitRGB(),this._fillVolumeParameters.opacity=this.fillColor.a,this.requestRender(1)}_createVao(e){const t=e.reduce((e,{indicesBottom:t,indicesExtruded:i})=>e+t.length+i.length,0),i=this.renderingContext,s=P.createBuffer(t),{position:o,normal:r}=s;let a=0;for(const u of e){const{vertices:e,normals:t,indicesBottom:i,indicesExtruded:s}=u;for(let l=0;l<i.length;l++){const s=3*i[l];o.set(a,0,e[s]),o.set(a,1,e[s+1]),o.set(a,2,e[s+2]),r.set(a,0,t[s]),r.set(a,1,t[s+1]),r.set(a,2,t[s+2]),a++}for(let l=0;l<s.length;l++){const i=3*s[l];o.set(a,0,e[i]),o.set(a,1,e[i+1]),o.set(a,2,e[i+2]),r.set(a,0,t[i]),r.set(a,1,t[i+1]),r.set(a,2,t[i+2]),a++}}const l=new w(i,u(P),s.buffer);return new m(i,l)}_disposeVaos(){this._vaoCut=t(this._vaoCut),this._vaoFill=t(this._vaoFill)}};e([o()],F.prototype,"consumes",void 0),e([o()],F.prototype,"produces",void 0),e([o()],F.prototype,"cutColor",void 0),e([o()],F.prototype,"fillColor",void 0),e([o()],F.prototype,"borderColor",void 0),e([o()],F.prototype,"measureType",void 0),F=e([r("esri.views.3d.webgl-engine.lib.CutFillVisualizationRenderNode")],F);const P=n().vec3f("position").vec3f("normal").freeze();class q{constructor(e,t,i,s){this.vertices=e,this.indicesBottom=t,this.indicesExtruded=i,this.normals=s}}export{F as CutFillVisualizationRenderNode,q as VolumeGeometry};