@arcgis/core 5.1.0-next.35 → 5.1.0-next.37

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 (206) hide show
  1. package/applications/Components/analysisUtils.js +1 -1
  2. package/assets/esri/core/workers/RemoteClient.js +1 -1
  3. package/assets/esri/core/workers/chunks/{e09722903e63f6cc2540.js → 03894992558d063d0d5e.js} +1 -1
  4. package/assets/esri/core/workers/chunks/13838b6c045425e73cf8.js +1 -0
  5. package/assets/esri/core/workers/chunks/1d54b71c43d9d6a5f713.js +1 -0
  6. package/assets/esri/core/workers/chunks/29ff5325e604dd0adc37.js +1 -0
  7. package/assets/esri/core/workers/chunks/34f79355145c8e4c59dd.js +1 -0
  8. package/assets/esri/core/workers/chunks/3be111488365768fd917.js +1 -0
  9. package/assets/esri/core/workers/chunks/448620052233e51b496c.js +1 -0
  10. package/assets/esri/core/workers/chunks/{973e3743cb7fdaa27f80.js → 4e07827ab870c65377d3.js} +1 -1
  11. package/assets/esri/core/workers/chunks/{2d49a611ad3441d7e759.js → 64450e280d602c5b0863.js} +5 -5
  12. package/assets/esri/core/workers/chunks/{eb811adbc5243d293ef5.js → 653d61aaaacb169b9418.js} +1 -1
  13. package/assets/esri/core/workers/chunks/{64e1273e4e79c73ed579.js → 8346c342b822487a5477.js} +1 -1
  14. package/assets/esri/core/workers/chunks/{a7a9716582b256d76e5b.js → 873c1b705ac3d4e6c384.js} +1 -1
  15. package/assets/esri/core/workers/chunks/{527547fa10d52cb3a7b1.js → 888f6387e795d45a7ad3.js} +2 -2
  16. package/assets/esri/core/workers/chunks/{7c16493ea34c49a6291e.js → 8ed7ff651241f8adc4bf.js} +1 -1
  17. package/assets/esri/core/workers/chunks/{bd902ae413887082b453.js → 9360a24ba765742f4e81.js} +1 -1
  18. package/assets/esri/core/workers/chunks/{2128a66f522d15493ce2.js → 98a84dc2988297bd6ab1.js} +1 -1
  19. package/assets/esri/core/workers/chunks/b396b5186d618fad1cee.js +1 -0
  20. package/assets/esri/core/workers/chunks/{a35d1be700ebd3109397.js → b5403c8b5099179dc16d.js} +2 -2
  21. package/assets/esri/core/workers/chunks/{f5144e570952ca62a1b0.js → b98c24229463029504e8.js} +1 -1
  22. package/assets/esri/core/workers/chunks/{19955d064c17ba2fd9ad.js → ba4e018492bd3327cd95.js} +1 -1
  23. package/assets/esri/core/workers/chunks/{0e78678281bcb888964d.js → c2e4cf3a277a6f40c7c2.js} +1 -1
  24. package/assets/esri/core/workers/chunks/d42d670edfae902c677b.js +2 -0
  25. package/assets/esri/core/workers/chunks/d6c2c9fedde498ad1a8c.js +2 -0
  26. package/assets/esri/core/workers/chunks/{e8ae71e482b8d5f54a72.js → dec51409372764e7093d.js} +1 -1
  27. package/assets/esri/core/workers/chunks/{6f1c590abd0e3adeb8fc.js → e011318fb8f8e59bc1f1.js} +1 -1
  28. package/assets/esri/core/workers/chunks/{b859d98fa1c39f8e4099.js → e0a63b5861e8c975097e.js} +1 -1
  29. package/assets/esri/core/workers/chunks/{04094d576bfa11d90f73.js → ebcfc20c1d92d90bf661.js} +1 -1
  30. package/assets/esri/core/workers/chunks/{2f20a21db44bd8448e9e.js → ecddd8c7593d3483ed09.js} +1 -1
  31. package/assets/esri/core/workers/chunks/{eaeb95be8d4032513247.js → fbada7f029b293d934ac.js} +2 -2
  32. package/assets/esri/core/workers/chunks/{67de5225b2c66c9c7bc9.js → ffc87a038712a4c9d2cb.js} +1 -1
  33. package/chunks/ChapmanAtmosphere.glsl.js +4 -4
  34. package/chunks/Clouds.glsl.js +14 -14
  35. package/chunks/ComponentShader.glsl.js +1 -1
  36. package/chunks/DefaultMaterial.glsl.js +1 -1
  37. package/chunks/GaussianSplat.glsl.js +2 -2
  38. package/chunks/GeodeticDistanceCalculator-Ce-woMPw.js +1 -1
  39. package/chunks/GeodeticUtils.js +1 -1
  40. package/chunks/Haze.glsl.js +4 -4
  41. package/chunks/MultiPathImpl.js +1 -1
  42. package/chunks/NoiseTextureAtlas.glsl.js +34 -34
  43. package/chunks/OperatorGeodesicBuffer.js +1 -1
  44. package/chunks/OperatorGeodeticArea.js +1 -1
  45. package/chunks/OperatorGeodeticDensifyByLength.js +1 -1
  46. package/chunks/OperatorGeodeticLength.js +1 -1
  47. package/chunks/OperatorProximityGeodesic.js +1 -1
  48. package/chunks/OperatorShapePreservingLength.js +1 -1
  49. package/chunks/OperatorShapePreservingProject.js +1 -1
  50. package/chunks/Path.glsl.js +2 -2
  51. package/chunks/Point2D.js +1 -1
  52. package/chunks/RealisticTree.glsl.js +1 -1
  53. package/chunks/SlicePlaneMaterial.glsl.js +6 -5
  54. package/chunks/SpatialReference.js +1 -1
  55. package/config.js +1 -1
  56. package/geometry/operators/gx/operatorAlphaShape.js +1 -1
  57. package/geometry/operators/gx/operatorPolygonSlicer.js +1 -1
  58. package/intl.js +1 -1
  59. package/kernel.js +1 -1
  60. package/layers/graphics/dehydratedPoint.js +1 -1
  61. package/layers/video/VideoController.js +1 -1
  62. package/package.json +4 -4
  63. package/support/revision.js +1 -1
  64. package/views/2d/layers/MediaLayerView2D.js +1 -1
  65. package/views/2d/layers/TileLayerView2D.js +1 -1
  66. package/views/3d/analysis/AreaMeasurement/support/AreaMeasurementVisualization.js +1 -1
  67. package/views/3d/analysis/Dimension/DimensionController.js +1 -1
  68. package/views/3d/analysis/Dimension/lengthDimensionUtils.js +1 -1
  69. package/views/3d/analysis/DirectLineMeasurement/DirectLineMeasurementController.js +1 -1
  70. package/views/3d/analysis/DirectLineMeasurement/DirectLineMeasurementVisualization.js +1 -1
  71. package/views/3d/analysis/DirectLineMeasurementAnalysisView3D.js +1 -1
  72. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillVisualization.js +1 -1
  73. package/views/3d/environment/EnvironmentRenderer.js +1 -1
  74. package/views/3d/interactive/SnappingVisualizer3D.js +1 -1
  75. package/views/3d/interactive/measurementTools/directLineMeasurement3D/DirectLineMeasurement3DView.js +1 -1
  76. package/views/3d/interactive/visualElements/LineVisualElement.js +1 -1
  77. package/views/3d/interactive/visualElements/MeasurementArrowVisualElement.js +1 -1
  78. package/views/3d/interactive/visualElements/RightAngleQuadVisualElement.js +1 -1
  79. package/views/3d/layers/GaussianSplatLayerView3D.js +1 -1
  80. package/views/3d/layers/i3s/I3SViewportQueries.js +1 -1
  81. package/views/3d/state/NearFarHeuristic.js +1 -1
  82. package/views/3d/support/gaussianSplatting/GaussianSplatDataStore.js +1 -1
  83. package/views/3d/support/gaussianSplatting/GaussianSplatIntersectionHandler.js +1 -1
  84. package/views/3d/support/gaussianSplatting/GaussianTile.js +1 -1
  85. package/views/3d/webgl-engine/collections/Component/Material/ComponentShader.glsl.js +1 -1
  86. package/views/3d/{environment → webgl-engine/effects/atmosphere}/ChapmanApproximation.glsl.js +3 -3
  87. package/views/3d/webgl-engine/effects/atmosphere/ChapmanAtmosphere.glsl.js +2 -0
  88. package/views/3d/webgl-engine/effects/atmosphere/ChapmanAtmosphere.js +2 -0
  89. package/views/3d/webgl-engine/effects/atmosphere/ChapmanAtmosphereTechnique.js +2 -0
  90. package/views/3d/webgl-engine/effects/atmosphere/ChapmanAtmosphereTechniqueConfiguration.js +2 -0
  91. package/views/3d/{environment → webgl-engine/effects/atmosphere}/ChapmanRaymarching.glsl.js +5 -5
  92. package/views/3d/webgl-engine/effects/atmosphere/LocalAtmosphere.js +2 -0
  93. package/views/3d/webgl-engine/effects/atmosphere/MarsAtmosphere.js +2 -0
  94. package/views/3d/webgl-engine/effects/atmosphere/SimpleAtmosphere.glsl.js +2 -0
  95. package/views/3d/webgl-engine/effects/atmosphere/SimpleAtmosphereTechnique.js +2 -0
  96. package/views/3d/webgl-engine/effects/atmosphere/SimpleAtmosphereTechniqueConfiguration.js +2 -0
  97. package/views/3d/webgl-engine/effects/atmosphere/atmosphereUtils.js +2 -0
  98. package/views/3d/webgl-engine/effects/clouds/Clouds.glsl.js +2 -0
  99. package/views/3d/webgl-engine/effects/clouds/CloudsComposition.glsl.js +2 -0
  100. package/views/3d/webgl-engine/effects/clouds/CloudsComposition.js +2 -0
  101. package/views/3d/webgl-engine/effects/clouds/CloudsCompositionTechnique.js +2 -0
  102. package/views/3d/webgl-engine/effects/clouds/CloudsParameters.js +2 -0
  103. package/views/3d/webgl-engine/effects/clouds/CloudsRenderer.js +2 -0
  104. package/views/3d/webgl-engine/effects/clouds/CloudsTechnique.js +2 -0
  105. package/views/3d/webgl-engine/effects/clouds/CloudsTechniqueConfiguration.js +2 -0
  106. package/views/3d/webgl-engine/effects/clouds/NoiseTextureAtlas.glsl.js +2 -0
  107. package/views/3d/webgl-engine/effects/clouds/NoiseTextureAtlas.js +2 -0
  108. package/views/3d/webgl-engine/effects/clouds/NoiseTextureAtlasConfiguration.js +2 -0
  109. package/views/3d/webgl-engine/effects/clouds/NoiseTextureAtlasDimensions.js +2 -0
  110. package/views/3d/webgl-engine/effects/clouds/NoiseTextureAtlasTechnique.js +2 -0
  111. package/views/3d/webgl-engine/effects/fog/Fog.glsl.js +2 -0
  112. package/views/3d/webgl-engine/effects/fog/Fog.js +2 -0
  113. package/views/3d/webgl-engine/effects/fog/FogTechnique.js +2 -0
  114. package/views/3d/webgl-engine/effects/fog/FogTechniqueConfiguration.js +2 -0
  115. package/views/3d/webgl-engine/effects/haze/Haze.glsl.js +1 -1
  116. package/views/3d/webgl-engine/effects/haze/HazeTechnique.js +1 -1
  117. package/views/3d/webgl-engine/effects/precipitation/Precipitation.glsl.js +2 -0
  118. package/views/3d/webgl-engine/effects/precipitation/Precipitation.js +2 -0
  119. package/views/3d/webgl-engine/effects/precipitation/PrecipitationTechnique.js +2 -0
  120. package/views/3d/webgl-engine/effects/precipitation/PrecipitationTechniqueConfiguration.js +2 -0
  121. package/views/3d/webgl-engine/lib/BindParameters.js +1 -1
  122. package/views/3d/webgl-engine/lib/GaussianSplatRenderNode.js +1 -1
  123. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  124. package/views/3d/webgl-engine/lib/RenderingContext.js +1 -1
  125. package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
  126. package/views/3d/webgl-engine/materials/Path.glsl.js +1 -1
  127. package/views/3d/webgl-engine/materials/SlicePlaneMaterial.js +1 -1
  128. package/views/3d/webgl-engine/materials/renderers/VaoRenderer.js +1 -1
  129. package/views/3d/webgl-engine/parts/RenderView.js +1 -1
  130. package/views/3d/webgl-engine/shaders/DefaultMaterial.glsl.js +1 -1
  131. package/views/3d/webgl-engine/shaders/GaussianSplat.glsl.js +1 -1
  132. package/views/3d/webgl-engine/shaders/GaussianSplatTechniqueConfiguration.js +1 -1
  133. package/views/3d/webgl-engine/shaders/RealisticTree.glsl.js +1 -1
  134. package/views/3d/webgl-engine/shaders/SlicePlaneMaterial.glsl.js +1 -1
  135. package/views/3d/webgl-engine/shaders/SlicePlaneMaterialTechniqueConfiguration.js +2 -0
  136. package/views/VideoView.js +1 -1
  137. package/views/interactive/sketch/normalizedPoint.js +1 -1
  138. package/views/interactive/snapping/LineSnapper.js +1 -1
  139. package/views/interactive/snapping/ParallelLineSnapper.js +1 -1
  140. package/views/interactive/snapping/RightAngleSnapper.js +1 -1
  141. package/views/interactive/snapping/RightAngleTriangleSnapper.js +1 -1
  142. package/views/interactive/snapping/SelfSnappingEngine.js +1 -1
  143. package/views/interactive/snapping/SnappingAlgorithm.js +1 -1
  144. package/views/interactive/snapping/SnappingManager.js +1 -1
  145. package/views/interactive/snapping/candidates/dehydrated/DehydratedVertexSnappingCandidate.js +1 -1
  146. package/views/interactive/tooltip/infos/TooltipInfoWithCoordinates.js +1 -1
  147. package/views/support/MeasurementWorker.js +1 -1
  148. package/views/support/MeasurementWorkerHandle.js +1 -1
  149. package/views/support/measurementWorkerUtils.js +1 -1
  150. package/views/webgl/WebGLDriverTest.js +1 -1
  151. package/widgets/OrientedImageryViewer.js +1 -1
  152. package/assets/esri/core/workers/chunks/144acac9bb1aa78f1170.js +0 -1
  153. package/assets/esri/core/workers/chunks/4490f8eeeb2ee04daa9d.js +0 -2
  154. package/assets/esri/core/workers/chunks/63722607fbf8d411188d.js +0 -1
  155. package/assets/esri/core/workers/chunks/6ac84e6d33104e74398d.js +0 -1
  156. package/assets/esri/core/workers/chunks/a53979c45ee429e21b99.js +0 -2
  157. package/assets/esri/core/workers/chunks/b1ddc837a6805a09d0da.js +0 -1
  158. package/assets/esri/core/workers/chunks/ce3e192fbb53a9c6eb3b.js +0 -1
  159. package/assets/esri/core/workers/chunks/de5719ef663224860af5.js +0 -1
  160. package/assets/esri/core/workers/chunks/f7506c9d57b2ae0c5fd3.js +0 -1
  161. package/views/3d/environment/ChapmanAtmosphere.glsl.js +0 -2
  162. package/views/3d/environment/ChapmanAtmosphere.js +0 -2
  163. package/views/3d/environment/ChapmanAtmosphereTechnique.js +0 -2
  164. package/views/3d/environment/ChapmanAtmosphereTechniqueConfiguration.js +0 -2
  165. package/views/3d/environment/Clouds.glsl.js +0 -2
  166. package/views/3d/environment/CloudsComposition.glsl.js +0 -2
  167. package/views/3d/environment/CloudsComposition.js +0 -2
  168. package/views/3d/environment/CloudsCompositionTechnique.js +0 -2
  169. package/views/3d/environment/CloudsParameters.js +0 -2
  170. package/views/3d/environment/CloudsRenderer.js +0 -2
  171. package/views/3d/environment/CloudsTechnique.js +0 -2
  172. package/views/3d/environment/CloudsTechniqueConfiguration.js +0 -2
  173. package/views/3d/environment/Fog.glsl.js +0 -2
  174. package/views/3d/environment/Fog.js +0 -2
  175. package/views/3d/environment/FogTechnique.js +0 -2
  176. package/views/3d/environment/FogTechniqueConfiguration.js +0 -2
  177. package/views/3d/environment/LocalAtmosphere.js +0 -2
  178. package/views/3d/environment/MarsAtmosphere.js +0 -2
  179. package/views/3d/environment/NoiseTextureAtlas.glsl.js +0 -2
  180. package/views/3d/environment/NoiseTextureAtlas.js +0 -2
  181. package/views/3d/environment/NoiseTextureAtlasConfiguration.js +0 -2
  182. package/views/3d/environment/NoiseTextureAtlasDimensions.js +0 -2
  183. package/views/3d/environment/NoiseTextureAtlasTechnique.js +0 -2
  184. package/views/3d/environment/Precipitation.glsl.js +0 -2
  185. package/views/3d/environment/Precipitation.js +0 -2
  186. package/views/3d/environment/PrecipitationTechnique.js +0 -2
  187. package/views/3d/environment/PrecipitationTechniqueConfiguration.js +0 -2
  188. package/views/3d/environment/SimpleAtmosphere.glsl.js +0 -2
  189. package/views/3d/environment/SimpleAtmosphereTechnique.js +0 -2
  190. package/views/3d/environment/SimpleAtmosphereTechniqueConfiguration.js +0 -2
  191. package/views/3d/environment/atmosphereUtils.js +0 -2
  192. package/views/support/geodesicAreaMeasurementUtils.js +0 -2
  193. package/views/support/geodesicLengthMeasurementUtils.js +0 -2
  194. package/views/support/geodesicMeasurementUtils.js +0 -2
  195. package/views/webgl/AppleAmdDriverHelper.js +0 -2
  196. package/views/webgl/testAppleAmdDrawArrays.js +0 -2
  197. /package/assets/esri/core/workers/chunks/{4490f8eeeb2ee04daa9d.js.LICENSE.txt → 888f6387e795d45a7ad3.js.LICENSE.txt} +0 -0
  198. /package/assets/esri/core/workers/chunks/{a35d1be700ebd3109397.js.LICENSE.txt → b5403c8b5099179dc16d.js.LICENSE.txt} +0 -0
  199. /package/assets/esri/core/workers/chunks/{a53979c45ee429e21b99.js.LICENSE.txt → d42d670edfae902c677b.js.LICENSE.txt} +0 -0
  200. /package/assets/esri/core/workers/chunks/{527547fa10d52cb3a7b1.js.LICENSE.txt → d6c2c9fedde498ad1a8c.js.LICENSE.txt} +0 -0
  201. /package/assets/esri/core/workers/chunks/{eaeb95be8d4032513247.js.LICENSE.txt → fbada7f029b293d934ac.js.LICENSE.txt} +0 -0
  202. /package/views/3d/{environment/resources → webgl-engine/effects/atmosphere}/MarsAtmosphereTexture.js +0 -0
  203. /package/views/3d/{environment/resources → webgl-engine/effects/atmosphere}/SimpleAtmosphereTexture.js +0 -0
  204. /package/views/3d/{environment → webgl-engine/effects/clouds}/Clouds.js +0 -0
  205. /package/views/3d/{environment → webgl-engine/effects/clouds}/CloudsPresets.js +0 -0
  206. /package/views/3d/webgl-engine/effects/{weather → snowcover}/SnowCover.glsl.js +0 -0
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as t}from"tslib";import e from"../../../../../core/Accessor.js";import{multiplyOpacityToUnitRGBA as i,getContrast as s,colorVectorEquals as o,colorVectorToColorAndOpacity as n}from"../../../../../core/colorUtils.js";import"../../../../../core/has.js";import{destroyMaybe as a}from"../../../../../core/maybe.js";import{watch as r,initial as l}from"../../../../../core/reactiveUtils.js";import{property as h,subclass as d}from"../../../../../core/accessorSupport/decorators.js";import{create as c}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromPoints as p}from"../../../../../geometry/support/lineSegment.js";import{Manipulator3D as u}from"../../Manipulator3D.js";import{createManipulatorMaterial as g}from"../../manipulatorUtils.js";import{RenderObject as m}from"../../RenderObject.js";import{LaserlineVisualElement as _}from"../../visualElements/LaserlineVisualElement.js";import{createSphereGeometry as y}from"../../../webgl-engine/lib/GeometryUtil.js";let v=class extends e{constructor(t){super(t),this.cursorPoint=null,this._visible=!1,this._laserLine=null,this.laserLineEnabled=!0,this._lastDraggedHandle=null}initialize(){this._laserLine=new _({view:this.view,attached:!0,isDecoration:!0}),this._updateVisibility(this._visible),this._connectToAnalysisView(),this.addHandles(r(()=>this._params,({laserLineGlowColor:t,laserLineInnerColor:e,laserLineGlobalAlpha:i})=>{const s=this._laserLine,o=s.style;s.style={...o,innerColor:e,glowColor:t,globalAlpha:i}}))}destroy(){this._laserLine=a(this._laserLine)}get _params(){const{accentColor:t}=this.view.effectiveTheme;return{laserLineGlowColor:t.toUnitRGB(),laserLineGlowWidth:8,laserLineGlowFalloff:8,laserLineInnerColor:s(t).toUnitRGB(),laserLineInnerWidth:.75,laserLineGlobalAlpha:.75*t.a,handleColor:i(t,.5),handleRadius:5}}get visible(){return this._visible}set visible(t){t?this.show():this.hide()}get testData(){}get _cursorPosition(){const t=c(),e=this.cursorPoint;return e&&this.view.renderCoordsHelper.toRenderCoords(e,t),t}get _startPosition(){const t=c(),e=this.analysis.startPoint;return e&&this.view.renderCoordsHelper.toRenderCoords(e,t),t}get _endPosition(){const t=c(),e=this.analysis.endPoint;return e&&this.view.renderCoordsHelper.toRenderCoords(e,t),t}get _laserLineParams(){const t=this._focusPosition,{active:e,lineState:i}=this.toolState,s=this.analysisViewData,o=this.laserLineEnabled&&!!t&&"measured"!==i&&e;if(!o||!this.visible||null==s||s.destroyed)return{heightManifoldTarget:null,pointDistanceLine:null,lineVerticalPlaneSegment:null};const n=s.actualVisualizedMeasurement,a="local"!==this.view.viewingMode&&o&&!!this.analysis.startPoint&&"geodesic"===n,r=o&&2===s.viewMode;return{heightManifoldTarget:"euclidean"===n?t:null,pointDistanceLine:a?this._pointDistanceLine:null,lineVerticalPlaneSegment:r?p(this._startPosition,this._endPosition):null}}get _focusPosition(){const{lineState:t}=this.toolState,e=this.analysisViewData,i=null!=e&&!e.destroyed&&1===e.measurementMode&&1===e.viewMode;switch(t){case"drawing":return i?this._startPosition:this.analysis.endPoint?this._endPosition:this._startPosition;case"editing":return i?"start"===this._lastDraggedHandle?this._endPosition:this._startPosition:"start"===this._lastDraggedHandle?this._startPosition:this._endPosition;default:return null!=this.cursorPoint?this._cursorPosition:null}}get _pointDistanceLine(){return{origin:"drawing"===this.toolState.lineState||"end"===this._lastDraggedHandle?this._startPosition:this._endPosition,target:this._focusPosition}}createManipulators(){const t=this._params,{view:e}=this,i=()=>{const i=g(t.handleColor),s=[new m(y(i,1,32,32))],o=new u({view:e,renderObjects:s});return o.available=!1,o.radius=t.handleRadius,[o,i]},[s,a]=i(),[l,h]=i(),d=new u({view:this.view,available:!1,interactive:!1});null!=this.analysis.startPoint&&(s.location=this.analysis.startPoint,s.available=!0),null!=this.analysis.endPoint&&(l.location=this.analysis.endPoint,l.available=!0);const c=()=>{let t=this._lastDraggedHandle;s.grabbing&&!l.grabbing&&(t="start"),l.grabbing&&!s.grabbing&&(t="end"),s.grabbing||l.grabbing||(t=null),this._lastDraggedHandle=t},p=s.events.on("grab-changed",c),_=l.events.on("grab-changed",c);return this.addHandles([p,_,r(()=>n(this._params.handleColor),t=>{a.setParameters({color:t}),h.setParameters({color:t})},{equals:o})],"manipulators"),{start:s,end:l,cursor:d}}show(){this.destroyed||this._visible||this._updateVisibility(!0)}hide(){!this.destroyed&&this._visible&&this._updateVisibility(!1)}_connectToAnalysisView(){this.removeHandles("analysis-view"),this.addHandles([r(()=>this.analysisViewData?.destroyed,t=>{t&&this.removeHandles("analysis-view")},l),r(()=>["measured"===this.toolState.lineState,this.analysisViewData],([t,e])=>{null==e||e.destroyed||(e.allowVisualElementsOrientationChange=!t)},l),r(()=>this._laserLineParams,t=>{const e=this._laserLine;e.heightManifoldTarget=t.heightManifoldTarget,e.pointDistanceLine=t.pointDistanceLine,e.lineVerticalPlaneSegment=t.lineVerticalPlaneSegment},l)],"analysis-view")}_updateVisibility(t){this.initialized&&(this._visible=t,t&&(this._laserLine.style={innerColor:this._params.laserLineInnerColor,innerWidth:this._params.laserLineInnerWidth,glowColor:this._params.laserLineGlowColor,glowWidth:this._params.laserLineGlowWidth,glowFalloff:this._params.laserLineGlowFalloff,globalAlpha:this._params.laserLineGlobalAlpha}),this._laserLine.visible=t)}};t([h({constructOnly:!0})],v.prototype,"view",void 0),t([h()],v.prototype,"_params",null),t([h({constructOnly:!0})],v.prototype,"analysis",void 0),t([h({constructOnly:!0})],v.prototype,"analysisViewData",void 0),t([h()],v.prototype,"cursorPoint",void 0),t([h()],v.prototype,"toolState",void 0),t([h()],v.prototype,"visible",null),t([h()],v.prototype,"testData",null),t([h()],v.prototype,"_visible",void 0),t([h()],v.prototype,"_laserLine",void 0),t([h({constructOnly:!0})],v.prototype,"laserLineEnabled",void 0),t([h()],v.prototype,"_cursorPosition",null),t([h()],v.prototype,"_startPosition",null),t([h()],v.prototype,"_endPosition",null),t([h()],v.prototype,"_lastDraggedHandle",void 0),t([h()],v.prototype,"_laserLineParams",null),t([h()],v.prototype,"_focusPosition",null),t([h()],v.prototype,"_pointDistanceLine",null),v=t([d("esri.views.3d.interactive.measurementTools.directLineMeasurement3D.DirectLineMeasurement3DView")],v);export{v as DirectLineMeasurement3DView};
2
+ import{__decorate as e}from"tslib";import t from"../../../../../core/Accessor.js";import{multiplyOpacityToUnitRGBA as i,getContrast as s,colorVectorEquals as n,colorVectorToColorAndOpacity as o}from"../../../../../core/colorUtils.js";import"../../../../../core/has.js";import{destroyMaybe as a}from"../../../../../core/maybe.js";import{watch as r,initial as l}from"../../../../../core/reactiveUtils.js";import{property as d,subclass as h}from"../../../../../core/accessorSupport/decorators.js";import{create as c}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromPoints as p}from"../../../../../geometry/support/lineSegment.js";import{Manipulator3D as u}from"../../Manipulator3D.js";import{createManipulatorMaterial as g}from"../../manipulatorUtils.js";import{RenderObject as m}from"../../RenderObject.js";import{LaserlineVisualElement as _}from"../../visualElements/LaserlineVisualElement.js";import{createSphereGeometry as y}from"../../../webgl-engine/lib/GeometryUtil.js";let v=class extends t{constructor(e){super(e),this.cursorPoint=null,this._visible=!1,this._laserLine=null,this.laserLineEnabled=!0,this._lastDraggedHandle=null}initialize(){this._laserLine=new _({view:this.view,attached:!0,isDecoration:!0}),this._updateVisibility(this._visible),this._connectToAnalysisView(),this.addHandles(r(()=>this._params,({laserLineGlowColor:e,laserLineInnerColor:t,laserLineGlobalAlpha:i})=>{const s=this._laserLine,n=s.style;s.style={...n,innerColor:t,glowColor:e,globalAlpha:i}}))}destroy(){this._laserLine=a(this._laserLine)}get _params(){const{accentColor:e}=this.view.effectiveTheme;return{laserLineGlowColor:e.toUnitRGB(),laserLineGlowWidth:8,laserLineGlowFalloff:8,laserLineInnerColor:s(e).toUnitRGB(),laserLineInnerWidth:.75,laserLineGlobalAlpha:.75*e.a,handleColor:i(e,.5),handleRadius:5}}get visible(){return this._visible}set visible(e){e?this.show():this.hide()}get testData(){}get _cursorPosition(){const e=c(),t=this.cursorPoint;return t&&this.view.renderCoordsHelper.toRenderCoords(t,e),e}get _startPosition(){const e=c(),t=this.analysis.startPoint;return t&&this.view.renderCoordsHelper.toRenderCoords(t,e),e}get _endPosition(){const e=c(),t=this.analysis.endPoint;return t&&this.view.renderCoordsHelper.toRenderCoords(t,e),e}get _laserLineParams(){const e=this._focusPosition,{active:t,lineState:i}=this.toolState,s=this.analysisViewData,n=this.laserLineEnabled&&!!e&&"measured"!==i&&t;if(!n||!this.visible||null==s||s.destroyed)return{heightManifoldTarget:null,pointDistanceLine:null,lineVerticalPlaneSegment:null};const o=s.actualVisualizedMeasurement,a="local"!==this.view.viewingMode&&n&&!!this.analysis.startPoint&&"geodesic"===o,r=n&&2===s.viewMode;return{heightManifoldTarget:"euclidean"===o?e:null,pointDistanceLine:a?this._pointDistanceLine:null,lineVerticalPlaneSegment:r?p(this._startPosition,this._endPosition):null}}get _focusPosition(){const{lineState:e}=this.toolState,t=this.analysisViewData,i=null!=t&&!t.destroyed&&1===t.measurementMode&&1===t.viewMode;switch(e){case"drawing":return i?this._startPosition:this.analysis.endPoint?this._endPosition:this._startPosition;case"editing":return i?"start"===this._lastDraggedHandle?this._endPosition:this._startPosition:"start"===this._lastDraggedHandle?this._startPosition:this._endPosition;default:return null!=this.cursorPoint?this._cursorPosition:null}}get _pointDistanceLine(){return{origin:"drawing"===this.toolState.lineState||"end"===this._lastDraggedHandle?this._startPosition:this._endPosition,target:this._focusPosition}}createManipulators(){const e=this._params,{view:t}=this,i=()=>{const i=g(e.handleColor);i.setParameters({testsTransparentRenderOrder:5});const s=[new m(y(i,1,32,32))],n=new u({view:t,renderObjects:s});return n.available=!1,n.radius=e.handleRadius,[n,i]},[s,a]=i(),[l,d]=i(),h=new u({view:this.view,available:!1,interactive:!1});null!=this.analysis.startPoint&&(s.location=this.analysis.startPoint,s.available=!0),null!=this.analysis.endPoint&&(l.location=this.analysis.endPoint,l.available=!0);const c=()=>{let e=this._lastDraggedHandle;s.grabbing&&!l.grabbing&&(e="start"),l.grabbing&&!s.grabbing&&(e="end"),s.grabbing||l.grabbing||(e=null),this._lastDraggedHandle=e},p=s.events.on("grab-changed",c),_=l.events.on("grab-changed",c);return this.addHandles([p,_,r(()=>o(this._params.handleColor),e=>{a.setParameters({color:e}),d.setParameters({color:e})},{equals:n})],"manipulators"),{start:s,end:l,cursor:h}}show(){this.destroyed||this._visible||this._updateVisibility(!0)}hide(){!this.destroyed&&this._visible&&this._updateVisibility(!1)}_connectToAnalysisView(){this.removeHandles("analysis-view"),this.addHandles([r(()=>this.analysisViewData?.destroyed,e=>{e&&this.removeHandles("analysis-view")},l),r(()=>["measured"===this.toolState.lineState,this.analysisViewData],([e,t])=>{null==t||t.destroyed||(t.allowVisualElementsOrientationChange=!e)},l),r(()=>this._laserLineParams,e=>{const t=this._laserLine;t.heightManifoldTarget=e.heightManifoldTarget,t.pointDistanceLine=e.pointDistanceLine,t.lineVerticalPlaneSegment=e.lineVerticalPlaneSegment},l)],"analysis-view")}_updateVisibility(e){this.initialized&&(this._visible=e,e&&(this._laserLine.style={innerColor:this._params.laserLineInnerColor,innerWidth:this._params.laserLineInnerWidth,glowColor:this._params.laserLineGlowColor,glowWidth:this._params.laserLineGlowWidth,glowFalloff:this._params.laserLineGlowFalloff,globalAlpha:this._params.laserLineGlobalAlpha}),this._laserLine.visible=e)}};e([d({constructOnly:!0})],v.prototype,"view",void 0),e([d()],v.prototype,"_params",null),e([d({constructOnly:!0})],v.prototype,"analysis",void 0),e([d({constructOnly:!0})],v.prototype,"analysisViewData",void 0),e([d()],v.prototype,"cursorPoint",void 0),e([d()],v.prototype,"toolState",void 0),e([d()],v.prototype,"visible",null),e([d()],v.prototype,"testData",null),e([d()],v.prototype,"_visible",void 0),e([d()],v.prototype,"_laserLine",void 0),e([d({constructOnly:!0})],v.prototype,"laserLineEnabled",void 0),e([d()],v.prototype,"_cursorPosition",null),e([d()],v.prototype,"_startPosition",null),e([d()],v.prototype,"_endPosition",null),e([d()],v.prototype,"_lastDraggedHandle",void 0),e([d()],v.prototype,"_laserLineParams",null),e([d()],v.prototype,"_focusPosition",null),e([d()],v.prototype,"_pointDistanceLine",null),v=e([h("esri.views.3d.interactive.measurementTools.directLineMeasurement3D.DirectLineMeasurement3DView")],v);export{v as DirectLineMeasurement3DView};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{fromTranslation as e}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as t}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as r,transformMat4 as s}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{ZEROS as i,create as o}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as a}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{Object3DVisualElement as n}from"./Object3DVisualElement.js";import{lineStripsToParameters as l,createGeometry as m}from"../../support/engineContent/line.js";import{isImagePattern as p}from"../../webgl-engine/materials/lineStippleUtils.js";import{RibbonLineMaterial as h}from"../../webgl-engine/materials/RibbonLineMaterial.js";class d extends n{constructor(e,t){super(e),this._hasExternalMaterial=!1,this._hasExternalMaterial=null!=t,this._material=t??new h({width:1,color:a(1,0,1,1),stipplePreferContinuous:!0,isClosed:!1,falloff:0,innerWidth:1,hasPolygonOffset:!1,renderOccluded:4,isDecoration:!!e.isDecoration,writeDepth:!0},e.view.state.isGlobal),this.applyProperties(e)}setGeometryFromPoint(e,t=1e3){const r=o();this.view.renderCoordsHelper.toRenderCoords(e,r)&&this.setGeometryFromRenderSpacePoint(r,t)}setGeometryFromRenderSpacePoint(e,t=1e3){this.geometry=[[[e[0]-t,e[1],e[2]],[e[0]+t,e[1],e[2]]],[[e[0],e[1]-t,e[2]],[e[0],e[1]+t,e[2]]],[[e[0],e[1],e[2]-t],[e[0],e[1],e[2]+t]]]}setGeometryFromExtent(e){const t=this.view.spatialReference,s=o(),i=o(),a=100,n=[];r(s,e[0],e[1],a),this.view.renderCoordsHelper.toRenderCoords(s,t,i),n.push([i[0],i[1],i[2]]),r(s,e[2],e[1],a),this.view.renderCoordsHelper.toRenderCoords(s,t,i),n.push([i[0],i[1],i[2]]),r(s,e[2],e[3],a),this.view.renderCoordsHelper.toRenderCoords(s,t,i),n.push([i[0],i[1],i[2]]),r(s,e[0],e[3],a),this.view.renderCoordsHelper.toRenderCoords(s,t,i),n.push([i[0],i[1],i[2]]),r(s,e[0],e[1],a),this.view.renderCoordsHelper.toRenderCoords(s,t,i),n.push([i[0],i[1],i[2]]),r(s,e[0],e[1],a),this.view.renderCoordsHelper.toRenderCoords(s,t,i),n.push([i[0],i[1],i[2]]),this.geometry=[n]}setGeometryFromFrustum(e){const t=[];e.lines.forEach(e=>{t.push([e.origin[0],e.origin[1],e.origin[2]]),t.push([e.endpoint[0],e.endpoint[1],e.endpoint[2]])}),this.geometry=[t]}setGeometryFromBoundedPlane(e){const t=[],r=e.origin,s=e.basis1,i=e.basis2,a=.5,n=o(),l=o(),m=o(),p=o();n[0]=r[0]-s[0]*a-i[0]*a,n[1]=r[1]-s[1]*a-i[1]*a,n[2]=r[2]-s[2]*a-i[2]*a,l[0]=r[0]-s[0]*a+i[0]*a,l[1]=r[1]-s[1]*a+i[1]*a,l[2]=r[2]-s[2]*a+i[2]*a,m[0]=r[0]+s[0]*a+i[0]*a,m[1]=r[1]+s[1]*a+i[1]*a,m[2]=r[2]+s[2]*a+i[2]*a,p[0]=r[0]+s[0]*a-i[0]*a,p[1]=r[1]+s[1]*a-i[1]*a,p[2]=r[2]+s[2]*a-i[2]*a,t.push([n[0],n[1],n[2]]),t.push([l[0],l[1],l[2]]),t.push([m[0],m[1],m[2]]),t.push([p[0],p[1],p[2]]),t.push([n[0],n[1],n[2]]),this.geometry=[t]}setGeometryFromSegment(t){if(!t.visible)return void(this.geometry=null);const r=t.endRenderSpace;this.transform=e(f,r);const{points:s}=t.createRenderGeometry(r,this.view.renderCoordsHelper);this.geometry=[s]}setGeometryFromSegments(t,r=i){this.transform=e(f,r),this.geometry=t.filter(({visible:e})=>e).map(e=>e.createRenderGeometry(r,this.view.renderCoordsHelper).points)}getTransformedGeometry(){return null==this._geometry?null:this._geometry.map(e=>e.map(e=>s(o(),e,this.transform)))}get renderOccluded(){return this._material.parameters.renderOccluded}set renderOccluded(e){this._material.setParameters({renderOccluded:e})}get tansparentRenderOrder(){return this._material.parameters.testsTransparentRenderOrder}set tansparentRenderOrder(e){this._material.setParameters({testsTransparentRenderOrder:e})}get geometry(){return this._geometry}set geometry(e){this._geometry=e,this.recreateGeometry()}get width(){return this._material.parameters.width}set width(e){this._material.setParameters({width:e})}get color(){return this._material.parameters.color}set color(e){const t=1===e[3];this._material.setParameters({color:e,writeDepth:t})}get innerWidth(){return this._material.parameters.innerWidth}set innerWidth(e){this._material.setParameters({innerWidth:e})}get innerColor(){return this._material.parameters.innerColor}set innerColor(e){this._material.setParameters({innerColor:e})}get stipplePattern(){const{stipplePattern:e}=this._material.parameters;return p(e)?null:e}set stipplePattern(e){null!=this._material&&this._material.setParameters({stipplePattern:e})}get stippleOffColor(){return this._material.parameters.stippleOffColor}set stippleOffColor(e){this._material.setParameters({stippleOffColor:e})}get stipplePreferContinuous(){return this._material.parameters.stipplePreferContinuous}set stipplePreferContinuous(e){this._material.setParameters({stipplePreferContinuous:e})}get falloff(){return this._material.parameters.falloff}set falloff(e){this._material.setParameters({falloff:e})}get polygonOffset(){return this._material.parameters.hasPolygonOffset}set polygonOffset(e){this._material.setParameters({hasPolygonOffset:e})}createExternalResources(){}destroyExternalResources(){}createGeometries(e){for(const t of l(this.geometry)){const r=m(this._material,t);e.addGeometry(r)}}forEachMaterial(e){this._hasExternalMaterial||e(this._material)}}const f=t();export{d as LineVisualElement};
2
+ import{fromTranslation as e}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as t}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as r,transformMat4 as s}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{ZEROS as i,create as o}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as a}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{Object3DVisualElement as n}from"./Object3DVisualElement.js";import{lineStripsToParameters as l,createGeometry as m}from"../../support/engineContent/line.js";import{isImagePattern as p}from"../../webgl-engine/materials/lineStippleUtils.js";import{RibbonLineMaterial as h}from"../../webgl-engine/materials/RibbonLineMaterial.js";class d extends n{constructor(e,t){super(e),this._hasExternalMaterial=!1,this._hasExternalMaterial=null!=t,this._material=t??new h({width:1,color:a(1,0,1,1),stipplePreferContinuous:!0,isClosed:!1,falloff:0,innerWidth:1,hasPolygonOffset:!1,renderOccluded:4,isDecoration:!!e.isDecoration,writeDepth:!0},e.view.state.isGlobal),this.applyProperties(e)}setGeometryFromPoint(e,t=1e3){const r=o();this.view.renderCoordsHelper.toRenderCoords(e,r)&&this.setGeometryFromRenderSpacePoint(r,t)}setGeometryFromRenderSpacePoint(e,t=1e3){this.geometry=[[[e[0]-t,e[1],e[2]],[e[0]+t,e[1],e[2]]],[[e[0],e[1]-t,e[2]],[e[0],e[1]+t,e[2]]],[[e[0],e[1],e[2]-t],[e[0],e[1],e[2]+t]]]}setGeometryFromExtent(e){const t=this.view.spatialReference,s=o(),i=o(),a=100,n=[];r(s,e[0],e[1],a),this.view.renderCoordsHelper.toRenderCoords(s,t,i),n.push([i[0],i[1],i[2]]),r(s,e[2],e[1],a),this.view.renderCoordsHelper.toRenderCoords(s,t,i),n.push([i[0],i[1],i[2]]),r(s,e[2],e[3],a),this.view.renderCoordsHelper.toRenderCoords(s,t,i),n.push([i[0],i[1],i[2]]),r(s,e[0],e[3],a),this.view.renderCoordsHelper.toRenderCoords(s,t,i),n.push([i[0],i[1],i[2]]),r(s,e[0],e[1],a),this.view.renderCoordsHelper.toRenderCoords(s,t,i),n.push([i[0],i[1],i[2]]),r(s,e[0],e[1],a),this.view.renderCoordsHelper.toRenderCoords(s,t,i),n.push([i[0],i[1],i[2]]),this.geometry=[n]}setGeometryFromFrustum(e){const t=[];e.lines.forEach(e=>{t.push([e.origin[0],e.origin[1],e.origin[2]]),t.push([e.endpoint[0],e.endpoint[1],e.endpoint[2]])}),this.geometry=[t]}setGeometryFromBoundedPlane(e){const t=[],r=e.origin,s=e.basis1,i=e.basis2,a=.5,n=o(),l=o(),m=o(),p=o();n[0]=r[0]-s[0]*a-i[0]*a,n[1]=r[1]-s[1]*a-i[1]*a,n[2]=r[2]-s[2]*a-i[2]*a,l[0]=r[0]-s[0]*a+i[0]*a,l[1]=r[1]-s[1]*a+i[1]*a,l[2]=r[2]-s[2]*a+i[2]*a,m[0]=r[0]+s[0]*a+i[0]*a,m[1]=r[1]+s[1]*a+i[1]*a,m[2]=r[2]+s[2]*a+i[2]*a,p[0]=r[0]+s[0]*a-i[0]*a,p[1]=r[1]+s[1]*a-i[1]*a,p[2]=r[2]+s[2]*a-i[2]*a,t.push([n[0],n[1],n[2]]),t.push([l[0],l[1],l[2]]),t.push([m[0],m[1],m[2]]),t.push([p[0],p[1],p[2]]),t.push([n[0],n[1],n[2]]),this.geometry=[t]}setGeometryFromSegment(t){if(!t.visible)return void(this.geometry=null);const r=t.endRenderSpace;this.transform=e(f,r);const{points:s}=t.createRenderGeometry(r,this.view.renderCoordsHelper);this.geometry=[s]}setGeometryFromSegments(t,r=i){this.transform=e(f,r),this.geometry=t.filter(({visible:e})=>e).map(e=>e.createRenderGeometry(r,this.view.renderCoordsHelper).points)}getTransformedGeometry(){return null==this._geometry?null:this._geometry.map(e=>e.map(e=>s(o(),e,this.transform)))}get renderOccluded(){return this._material.parameters.renderOccluded}set renderOccluded(e){this._material.setParameters({renderOccluded:e})}get transparentRenderOrder(){return this._material.parameters.testsTransparentRenderOrder}set transparentRenderOrder(e){this._material.setParameters({testsTransparentRenderOrder:e})}get geometry(){return this._geometry}set geometry(e){this._geometry=e,this.recreateGeometry()}get width(){return this._material.parameters.width}set width(e){this._material.setParameters({width:e})}get color(){return this._material.parameters.color}set color(e){const t=1===e[3];this._material.setParameters({color:e,writeDepth:t})}get innerWidth(){return this._material.parameters.innerWidth}set innerWidth(e){this._material.setParameters({innerWidth:e})}get innerColor(){return this._material.parameters.innerColor}set innerColor(e){this._material.setParameters({innerColor:e})}get stipplePattern(){const{stipplePattern:e}=this._material.parameters;return p(e)?null:e}set stipplePattern(e){null!=this._material&&this._material.setParameters({stipplePattern:e})}get stippleOffColor(){return this._material.parameters.stippleOffColor}set stippleOffColor(e){this._material.setParameters({stippleOffColor:e})}get stipplePreferContinuous(){return this._material.parameters.stipplePreferContinuous}set stipplePreferContinuous(e){this._material.setParameters({stipplePreferContinuous:e})}get falloff(){return this._material.parameters.falloff}set falloff(e){this._material.setParameters({falloff:e})}get polygonOffset(){return this._material.parameters.hasPolygonOffset}set polygonOffset(e){this._material.setParameters({hasPolygonOffset:e})}createExternalResources(){}destroyExternalResources(){}createGeometries(e){for(const t of l(this.geometry)){const r=m(this._material,t);e.addGeometry(r)}}forEachMaterial(e){this._hasExternalMaterial||e(this._material)}}const f=t();export{d as LineVisualElement};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{colorVectorEquals as t}from"../../../../core/colorUtils.js";import e from"../../../../core/Handles.js";import{destroyMaybe as r}from"../../../../core/maybe.js";import{watch as s}from"../../../../core/reactiveUtils.js";import{create as o}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{copy as i,subtract as a,sub as n,cross as l,len as h}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{copy as d}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{create as m}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{sv3d as _}from"../../../../geometry/support/vectorStacks.js";import{Object3DVisualElement as p}from"./Object3DVisualElement.js";import{headingTiltToDirectionUp as g}from"../../support/cameraUtils.js";import{createDirectionUp as u}from"../../support/cameraUtilsInternal.js";import{createPolylineGeometry as w}from"../../webgl-engine/lib/GeometryUtil.js";import{MeasurementArrowMaterial as f}from"../../webgl-engine/materials/MeasurementArrowMaterial.js";class C extends p{constructor(t){super(t),this._arrowWidth=16,this._arrowSubdivisions=128,this._origin=c(),this._originTransform=o(),this._arrowCenter=c(),this._renderOccluded=4,this._geometry=null,this._stripeLength=1,this._stripesEnabled=!0,this._color=m(),this._contrastColor=m(),this.applyProperties(t)}get renderOccluded(){return this._renderOccluded}set renderOccluded(t){t!==this._renderOccluded&&(this._renderOccluded=t,this._arrowMaterial?.setParameters({renderOccluded:t}))}get geometry(){return this._geometry}set geometry(t){this._geometry=t,this._geometryChanged()}get stripeLength(){return this._stripeLength}set stripeLength(t){this._stripeLength=t,this.attached&&this._arrowMaterial.setParameters({stripeLength:this._stripeLength})}get stripesEnabled(){return this._stripesEnabled}set stripesEnabled(t){if(this._stripesEnabled=t,this.attached){const t=this._stripesEnabled?this._contrastColor:this._color;this._arrowMaterial.setParameters({stripeEvenColor:t})}}get color(){return this._color}set color(e){t(e,this._color)||(d(this._color,e),this._updateArrowColor())}get contrastColor(){return this._contrastColor}set contrastColor(e){t(e,this._color)||(d(this._contrastColor,e),this._updateArrowColor())}createExternalResources(){const t=this._color,r=this._contrastColor,o=this._stripesEnabled?r:t;this._arrowMaterial=new f({outlineColor:t,stripeEvenColor:o,stripeOddColor:t,renderOccluded:this.renderOccluded,polygonOffset:!0,isDecoration:this.isDecoration}),this._handles=new e,this._handles.add(s(()=>this.view.state.camera,()=>{this._viewChanged()}))}destroyExternalResources(){this._arrowMaterial=null,this._handles=r(this._handles)}forEachMaterial(t){t(this._arrowMaterial)}createGeometries(t){if(null==this._geometry?.startRenderSpace||null==this._geometry.endRenderSpace)return;const e=this._createArrowGeometry(this._geometry.startRenderSpace,this._geometry.endRenderSpace,this._origin,this._geometry);e.transformation=this._originTransform,t.addGeometry(e),this._viewChanged()}_createArrowGeometry(t,e,r,s){const o=this.view,n=o.renderCoordsHelper,l=[],h=[],c=(t,e)=>{const s=_.get();a(s,t,r),l.push(s),h.push(e)};if("euclidean"===s.type){s.eval(.5,this._arrowCenter);const r=_.get();if(n.worldUpAtPosition(this._arrowCenter,r),y(t,e,r)){const{heading:e,tilt:s}=o.camera,{direction:a}=g(o,t,e,s,b);i(r,a)}c(t,r),c(e,r)}else{s.eval(.5,this._arrowCenter);const t=this._arrowSubdivisions+1&-2;for(let e=0;e<t;++e){const r=e/(t-1),o=_.get(),i=_.get();s.eval(r,o),n.worldUpAtPosition(o,i),c(o,i)}}return w(this._arrowMaterial,l,h)}_geometryChanged(){this.recreateGeometry()}_viewChanged(){if(this.view.ready&&this.attached&&null!=this._geometry){const t=this.view.state.camera.computeScreenPixelSizeAt(this._arrowCenter);this._arrowMaterial.setParameters({width:this._arrowWidth*t})}}_updateArrowColor(){if(!this.attached)return;const t=this._color,e=this._contrastColor,r=this._stripesEnabled?e:t,s=t,o=t;this._arrowMaterial.setParameters({stripeEvenColor:r,outlineColor:s,stripeOddColor:o})}}function y(t,e,r){const s=n(v,e,t),o=l(v,s,r);return 0===h(o)}const v=c(),b=u();export{C as MeasurementArrowVisualElement};
2
+ import{colorVectorEquals as r}from"../../../../core/colorUtils.js";import e from"../../../../core/Handles.js";import{destroyMaybe as t}from"../../../../core/maybe.js";import{watch as s}from"../../../../core/reactiveUtils.js";import{create as o}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{copy as i,subtract as a,sub as n,cross as h,len as l}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{copy as d}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{create as _}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{sv3d as m}from"../../../../geometry/support/vectorStacks.js";import{Object3DVisualElement as p}from"./Object3DVisualElement.js";import{headingTiltToDirectionUp as g}from"../../support/cameraUtils.js";import{createDirectionUp as u}from"../../support/cameraUtilsInternal.js";import{createPolylineGeometry as w}from"../../webgl-engine/lib/GeometryUtil.js";import{MeasurementArrowMaterial as f}from"../../webgl-engine/materials/MeasurementArrowMaterial.js";class C extends p{constructor(r){super(r),this._arrowWidth=16,this._arrowSubdivisions=128,this._origin=c(),this._originTransform=o(),this._arrowCenter=c(),this._renderOccluded=4,this._geometry=null,this._stripeLength=1,this._stripesEnabled=!0,this._color=_(),this._contrastColor=_(),this.applyProperties(r)}get renderOccluded(){return this._renderOccluded}set renderOccluded(r){r!==this._renderOccluded&&(this._renderOccluded=r,this._arrowMaterial?.setParameters({renderOccluded:r}))}get transparentRenderOrder(){return this._transparentRenderOrder}set transparentRenderOrder(r){this._transparentRenderOrder=r,this._arrowMaterial&&this._arrowMaterial.setParameters({testsTransparentRenderOrder:r})}get geometry(){return this._geometry}set geometry(r){this._geometry=r,this._geometryChanged()}get stripeLength(){return this._stripeLength}set stripeLength(r){this._stripeLength=r,this.attached&&this._arrowMaterial.setParameters({stripeLength:this._stripeLength})}get stripesEnabled(){return this._stripesEnabled}set stripesEnabled(r){if(this._stripesEnabled=r,this.attached){const r=this._stripesEnabled?this._contrastColor:this._color;this._arrowMaterial.setParameters({stripeEvenColor:r})}}get color(){return this._color}set color(e){r(e,this._color)||(d(this._color,e),this._updateArrowColor())}get contrastColor(){return this._contrastColor}set contrastColor(e){r(e,this._color)||(d(this._contrastColor,e),this._updateArrowColor())}createExternalResources(){const r=this._color,t=this._contrastColor,o=this._stripesEnabled?t:r;this._arrowMaterial=new f({outlineColor:r,stripeEvenColor:o,stripeOddColor:r,renderOccluded:this.renderOccluded,polygonOffset:!0,isDecoration:this.isDecoration,testsTransparentRenderOrder:this._transparentRenderOrder}),this._handles=new e,this._handles.add(s(()=>this.view.state.camera,()=>{this._viewChanged()}))}destroyExternalResources(){this._arrowMaterial=null,this._handles=t(this._handles)}forEachMaterial(r){r(this._arrowMaterial)}createGeometries(r){if(null==this._geometry?.startRenderSpace||null==this._geometry.endRenderSpace)return;const e=this._createArrowGeometry(this._geometry.startRenderSpace,this._geometry.endRenderSpace,this._origin,this._geometry);e.transformation=this._originTransform,r.addGeometry(e),this._viewChanged()}_createArrowGeometry(r,e,t,s){const o=this.view,n=o.renderCoordsHelper,h=[],l=[],c=(r,e)=>{const s=m.get();a(s,r,t),h.push(s),l.push(e)};if("euclidean"===s.type){s.eval(.5,this._arrowCenter);const t=m.get();if(n.worldUpAtPosition(this._arrowCenter,t),y(r,e,t)){const{heading:e,tilt:s}=o.camera,{direction:a}=g(o,r,e,s,b);i(t,a)}c(r,t),c(e,t)}else{s.eval(.5,this._arrowCenter);const r=this._arrowSubdivisions+1&-2;for(let e=0;e<r;++e){const t=e/(r-1),o=m.get(),i=m.get();s.eval(t,o),n.worldUpAtPosition(o,i),c(o,i)}}return w(this._arrowMaterial,h,l)}_geometryChanged(){this.recreateGeometry()}_viewChanged(){if(this.view.ready&&this.attached&&null!=this._geometry){const r=this.view.state.camera.computeScreenPixelSizeAt(this._arrowCenter);this._arrowMaterial.setParameters({width:this._arrowWidth*r})}}_updateArrowColor(){if(!this.attached)return;const r=this._color,e=this._contrastColor,t=this._stripesEnabled?e:r,s=r,o=r;this._arrowMaterial.setParameters({stripeEvenColor:t,outlineColor:s,stripeOddColor:o})}}function y(r,e,t){const s=n(v,e,r),o=h(v,s,t);return 0===l(o)}const v=c(),b=u();export{C as MeasurementArrowVisualElement};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{watch as e}from"../../../../core/reactiveUtils.js";import{fromTranslation as t,scale as r}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{distance as s,normalize as a,subtract as o,copy as n,exactEquals as l,add as c}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as u,ZEROS as h}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{copy as d}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{fromValues as m}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{sv3d as _}from"../../../../geometry/support/vectorStacks.js";import{makeDehydratedPoint as p}from"../../../../layers/graphics/dehydratedPoint.js";import{EngineVisualElement as f}from"./EngineVisualElement.js";import{drapedZ as g}from"../../terrain/OverlayRenderer.js";import{Attribute as M}from"../../webgl-engine/lib/Attribute.js";import{Geometry as b}from"../../webgl-engine/lib/Geometry.js";import{createPolylineGeometry as R}from"../../webgl-engine/lib/GeometryUtil.js";import{RenderGeometry as O}from"../../webgl-engine/lib/RenderGeometry.js";import{ColorMaterial as j}from"../../webgl-engine/materials/ColorMaterial.js";import{RibbonLineMaterial as D}from"../../webgl-engine/materials/RibbonLineMaterial.js";class w extends f{constructor(e){super(e),this._maxSize=0,this._position=u(),this._up=u(),this._right=u(),this._renderOccluded=4,this._color=m(1,0,0,1),this._outlineColor=m(0,0,0,1),this._outlineSize=0,this._size=32,this._outlineRenderOccluded=16,this.applyProperties(e)}createObject3DResourceFactory(e){return{view:e,createResources:e=>this._createObject3DResources(e),destroyResources:()=>{},cameraChanged:()=>this._updateTransformObject3D(),forEachMaterial:(e,t)=>{t(e.outlineMaterial),t(e.quadMaterial)}}}createDrapedResourceFactory(e){return{view:e,createResources:()=>this._createDrapedResources(),destroyResources:y,forEachMaterial:(e,t)=>{t(e.outlineMaterial),t(e.quadMaterial)}}}get renderOccluded(){return this._renderOccluded}set renderOccluded(e){e!==this._renderOccluded&&(this._renderOccluded=e,this._updateQuadMaterial())}get isDecoration(){return this._isDecoration}set isDecoration(e){this._isDecoration=e,this._updateOutlineMaterial(),this._updateQuadMaterial()}get color(){return this._color}set color(e){d(this._color,e),this._updateQuadMaterial()}get outlineColor(){return this._outlineColor}set outlineColor(e){d(this._outlineColor,e),this._updateOutlineMaterial()}get outlineSize(){return this._outlineSize}set outlineSize(e){const t=0===this._outlineSize!=(0===e);this._outlineSize=e,t?this.recreateGeometry():this._updateOutlineMaterial()}get size(){return this._size}set size(e){e!==this._size&&(this._size=e,this._updateTransform())}get outlineRenderOccluded(){return this._outlineRenderOccluded}set outlineRenderOccluded(e){this._outlineRenderOccluded=e,this._updateOutlineMaterial()}set geometry({previous:e,center:t,next:r}){this._maxSize=Math.min(s(t,e),s(t,r))/3,a(this._up,o(this._up,e,t)),a(this._right,o(this._right,r,t)),n(this._position,t),this.recreateGeometry()}_createObject3DResources(e){const t=new j(this._quadMaterialParameters),r=0===this._outlineSize?void 0:new D(this._outlineMaterialParameters,this.view.state.isGlobal);return this._createObject3DGeometries(e,t,r),{quadMaterial:t,outlineMaterial:r}}_createObject3DGeometries(e,t,r){if(l(this._up,h)&&l(this._right,h))return;const i=this._createGeometries(t,r);for(const s of i)e.addGeometry(s);this._updateTransformObject3D(e)}_createDrapedResources(){const t=new j(this._quadMaterialParameters),r=0===this._outlineSize?void 0:new D(this._outlineMaterialParameters,this.view.state.isGlobal),i=this._createGeometries(t,r).map(e=>new O(e));this._setTransformDraped(i);return{quadMaterial:t,outlineMaterial:r,geometries:i,pixelRatioHandle:e(()=>this.view.state.contentPixelRatio,()=>this.drapedResources.recreateGeometry())}}_createGeometries(e,t){const{up:r,right:i,corner:s}=this._getVertices(),a=z(r,i,s,e);if(!t)return[a];return[a,R(t,[r,s,i])]}_getVertices(){let e=this._up,t=this._right;const r=c(_.get(),e,t);return this.isDraped&&(e=n(_.get(),e),t=n(_.get(),t),e[2]=0,t[2]=0,r[2]=0),{up:e,right:t,corner:r}}_updateTransform(){this.isDraped?this.drapedResources.recreateGeometry():this._updateTransformObject3D()}_updateTransformObject3D(e=this.object3dResources.object){if(!e)return;const i=this.view.state.camera,s=this._size*i.computeScreenPixelSizeAt(this._position),a=Math.min(this._maxSize,s);t(v,this._position),r(v,v,[a,a,a]),e.transformation=v}_setTransformDraped(e){if(0===e.length)return;const{view:{overlayManager:i,state:{contentPixelRatio:s}}}=this,{_position:a,_size:o}=this,l=n(_.get(),a);l[2]=g;const c=x;c.spatialReference=i.spatialReference,c.x=l[0],c.y=l[1];const u=o*(this.view.overlayPixelSizeInMapUnits(c)*s),h=Math.min(this._maxSize,u);t(v,l),r(v,v,[h,h,1]);for(const t of e)t.transformation=v}get _quadMaterialParameters(){return{color:this._color,forceTransparentMode:!0,writeDepth:!1,polygonOffset:!0,renderOccluded:this._renderOccluded,isDecoration:this.isDecoration}}_updateQuadMaterial(){this.object3dResources.resources?.quadMaterial.setParameters(this._quadMaterialParameters),this.drapedResources.resources?.quadMaterial.setParameters(this._quadMaterialParameters)}get _outlineMaterialParameters(){return{color:this._outlineColor,width:this._outlineSize,renderOccluded:this._outlineRenderOccluded,isDecoration:this.isDecoration}}_updateOutlineMaterial(){this.object3dResources.resources?.outlineMaterial?.setParameters(this._outlineMaterialParameters),this.drapedResources.resources?.outlineMaterial?.setParameters(this._outlineMaterialParameters)}}function y(e){e.pixelRatioHandle.remove(),e.geometries=[]}function z(e,t,r,i){return new b(i,[["position",new M([0,0,0,...t,...e,...r],[0,1,2,1,2,3],3,!0)]])}const v=i(),x=p(0,0,void 0,null);export{w as RightAngleQuadVisualElement};
2
+ import{watch as e}from"../../../../core/reactiveUtils.js";import{fromTranslation as t,scale as r}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{distance as s,normalize as a,subtract as o,copy as n,exactEquals as l,add as c}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as u,ZEROS as d}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{copy as h}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{fromValues as m}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{sv3d as _}from"../../../../geometry/support/vectorStacks.js";import{makeDehydratedPoint as p}from"../../../../layers/graphics/dehydratedPoint.js";import{EngineVisualElement as g}from"./EngineVisualElement.js";import{drapedZ as f}from"../../terrain/OverlayRenderer.js";import{Attribute as M}from"../../webgl-engine/lib/Attribute.js";import{Geometry as R}from"../../webgl-engine/lib/Geometry.js";import{createPolylineGeometry as O}from"../../webgl-engine/lib/GeometryUtil.js";import{RenderGeometry as b}from"../../webgl-engine/lib/RenderGeometry.js";import{ColorMaterial as j}from"../../webgl-engine/materials/ColorMaterial.js";import{RibbonLineMaterial as D}from"../../webgl-engine/materials/RibbonLineMaterial.js";class w extends g{constructor(e){super(e),this._maxSize=0,this._position=u(),this._up=u(),this._right=u(),this._renderOccluded=4,this._color=m(1,0,0,1),this._outlineColor=m(0,0,0,1),this._outlineSize=0,this._size=32,this._outlineRenderOccluded=16,this.applyProperties(e)}createObject3DResourceFactory(e){return{view:e,createResources:e=>this._createObject3DResources(e),destroyResources:()=>{},cameraChanged:()=>this._updateTransformObject3D(),forEachMaterial:(e,t)=>{t(e.outlineMaterial),t(e.quadMaterial)}}}createDrapedResourceFactory(e){return{view:e,createResources:()=>this._createDrapedResources(),destroyResources:y,forEachMaterial:(e,t)=>{t(e.outlineMaterial),t(e.quadMaterial)}}}get renderOccluded(){return this._renderOccluded}set renderOccluded(e){e!==this._renderOccluded&&(this._renderOccluded=e,this._updateQuadMaterial())}get transparentRenderOrder(){return this._transparentRenderOrder}set transparentRenderOrder(e){this._transparentRenderOrder=e,this._updateQuadMaterial()}get isDecoration(){return this._isDecoration}set isDecoration(e){this._isDecoration=e,this._updateOutlineMaterial(),this._updateQuadMaterial()}get color(){return this._color}set color(e){h(this._color,e),this._updateQuadMaterial()}get outlineColor(){return this._outlineColor}set outlineColor(e){h(this._outlineColor,e),this._updateOutlineMaterial()}get outlineSize(){return this._outlineSize}set outlineSize(e){const t=0===this._outlineSize!=(0===e);this._outlineSize=e,t?this.recreateGeometry():this._updateOutlineMaterial()}get size(){return this._size}set size(e){e!==this._size&&(this._size=e,this._updateTransform())}get outlineRenderOccluded(){return this._outlineRenderOccluded}set outlineRenderOccluded(e){this._outlineRenderOccluded=e,this._updateOutlineMaterial()}set geometry({previous:e,center:t,next:r}){this._maxSize=Math.min(s(t,e),s(t,r))/3,a(this._up,o(this._up,e,t)),a(this._right,o(this._right,r,t)),n(this._position,t),this.recreateGeometry()}_createObject3DResources(e){const t=new j(this._quadMaterialParameters),r=0===this._outlineSize?void 0:new D(this._outlineMaterialParameters,this.view.state.isGlobal);return this._createObject3DGeometries(e,t,r),{quadMaterial:t,outlineMaterial:r}}_createObject3DGeometries(e,t,r){if(l(this._up,d)&&l(this._right,d))return;const i=this._createGeometries(t,r);for(const s of i)e.addGeometry(s);this._updateTransformObject3D(e)}_createDrapedResources(){const t=new j(this._quadMaterialParameters),r=0===this._outlineSize?void 0:new D(this._outlineMaterialParameters,this.view.state.isGlobal),i=this._createGeometries(t,r).map(e=>new b(e));this._setTransformDraped(i);return{quadMaterial:t,outlineMaterial:r,geometries:i,pixelRatioHandle:e(()=>this.view.state.contentPixelRatio,()=>this.drapedResources.recreateGeometry())}}_createGeometries(e,t){const{up:r,right:i,corner:s}=this._getVertices(),a=z(r,i,s,e);if(!t)return[a];return[a,O(t,[r,s,i])]}_getVertices(){let e=this._up,t=this._right;const r=c(_.get(),e,t);return this.isDraped&&(e=n(_.get(),e),t=n(_.get(),t),e[2]=0,t[2]=0,r[2]=0),{up:e,right:t,corner:r}}_updateTransform(){this.isDraped?this.drapedResources.recreateGeometry():this._updateTransformObject3D()}_updateTransformObject3D(e=this.object3dResources.object){if(!e)return;const i=this.view.state.camera,s=this._size*i.computeScreenPixelSizeAt(this._position),a=Math.min(this._maxSize,s);t(v,this._position),r(v,v,[a,a,a]),e.transformation=v}_setTransformDraped(e){if(0===e.length)return;const{view:{overlayManager:i,state:{contentPixelRatio:s}}}=this,{_position:a,_size:o}=this,l=n(_.get(),a);l[2]=f;const c=x;c.spatialReference=i.spatialReference,c.x=l[0],c.y=l[1];const u=o*(this.view.overlayPixelSizeInMapUnits(c)*s),d=Math.min(this._maxSize,u);t(v,l),r(v,v,[d,d,1]);for(const t of e)t.transformation=v}get _quadMaterialParameters(){return{color:this._color,forceTransparentMode:!0,writeDepth:!1,polygonOffset:!0,renderOccluded:this._renderOccluded,isDecoration:this.isDecoration,testsTransparentRenderOrder:this._transparentRenderOrder}}_updateQuadMaterial(){this.object3dResources.resources?.quadMaterial.setParameters(this._quadMaterialParameters),this.drapedResources.resources?.quadMaterial.setParameters(this._quadMaterialParameters)}get _outlineMaterialParameters(){return{color:this._outlineColor,width:this._outlineSize,renderOccluded:this._outlineRenderOccluded,isDecoration:this.isDecoration}}_updateOutlineMaterial(){this.object3dResources.resources?.outlineMaterial?.setParameters(this._outlineMaterialParameters),this.drapedResources.resources?.outlineMaterial?.setParameters(this._outlineMaterialParameters)}}function y(e){e.pixelRatioHandle.remove(),e.geometries=[]}function z(e,t,r,i){return new R(i,[["position",new M([0,0,0,...t,...e,...r],[0,1,2,1,2,3],3,!0)]])}const v=i(),x=p(0,0,void 0,null);export{w as RightAngleQuadVisualElement};
@@ -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 s}from"../../../core/maybe.js";import{watch as i,syncAndInitial 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 u}from"../../../geometry/ellipsoidUtils.js";import d from"../../../geometry/HeightModelInfo.js";import{isCompatible as m}from"../../../geometry/support/heightModelInfoUtils.js";import{isPlateCarree as c,isWebMercator as p,equals as f,isGeographic as g}from"../../../geometry/support/spatialReferenceUtils.js";import y from"../../../geometry/support/WKIDUnitConversion.js";import{getHeightModelInfoFromVCS as _}from"../../../layers/support/tiles3DUtils.js";import{getElevationOffsetInMeters as w}from"../../../support/elevationInfoUtils.js";import{getMetersPerUnit as v}from"../../../symbols/support/unitConversionUtils.js";import{GaussianSplatLayerViewPerformanceInfo as b}from"./GaussianSplatLayerViewPerformanceInfo.js";import{LayerView3D as S}from"./LayerView3D.js";import{addLayerViewToWasm as C,getLyr3DWasm as x,removeLayerViewFromWasm as M}from"./Lyr3DWasm.js";import{LayerElevationProvider as H}from"./i3s/LayerElevationProvider.js";import{ElevationRange as j}from"../support/ElevationRange.js";import{Obb as E}from"../support/orientedBoundingBox.js";import{splatPageSizeInU32 as P,elementsPerSplatPage as U,packedGaussianSizeInU32 as G,splatPageSizeInU32WithoutHeader as V,gaussiansPerSplatPage as A,splatAtlasTextureWidth as I}from"../support/gaussianSplatting/GaussianSplatAtlasPages.js";import{GaussianSplatDataStore as R}from"../support/gaussianSplatting/GaussianSplatDataStore.js";import{GaussianSplatFadeHelper as T}from"../support/gaussianSplatting/GaussianSplatFadeHelper.js";import{GaussianSplatIntersectionHandler as O}from"../support/gaussianSplatting/GaussianSplatIntersectionHandler.js";import{GaussianTile as L}from"../support/gaussianSplatting/GaussianTile.js";import{GaussianSplatRenderNode as F}from"../webgl-engine/lib/GaussianSplatRenderNode.js";import k from"../../layers/LayerView.js";import{spatialReferenceIncompatibleError as B,isInEffectiveScaleRange as D}from"../../support/layerViewUtils.js";import{TaskPriority as z}from"../../support/Scheduler.js";const q=()=>t.getLogger("esri.views.3d.layers.GaussianSplatLayerView3D");let N=class extends(S(k)){constructor(e){super(e),this.type="gaussian-splat-3d",this.ignoresMemoryFactor=!1,this._tileHandles=new Map,this._pageBuffer=new Uint32Array(P),this._tmpObbsWithChangedVisibility=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(z.GAUSSIAN_SPLAT_TEXTURE_ATLAS)}initialize(){if(!this._canProjectWithoutEngine())throw B("layer",this.layer.spatialReference.wkid,this.view.renderSpatialReference?.wkid);const e=C(this).then(e=>{this._wasmLayerId=e,this._renderNode=new F({view:this.view,layerView:this}),this.data=new R(this._renderNode),this.fadeHelper=new T(this),this._intersectionHandler=new O(this),this.view.sceneIntersectionHelper.addIntersectionHandler(this._intersectionHandler),this._elevationProvider=new H({view:this.view,layerElevationSource:this,intersectionHandler:this._intersectionHandler}),this.view.elevationProvider.register(2,this._elevationProvider),this.addHandles([i(()=>this.layer.elevationInfo,e=>this._elevationInfoChanged(e))]),this._suspendedHandle=i(()=>this.suspended,e=>this._wasm?.setEnabled(this,!e),r),this.setMaximumGaussianCount(this.view.qualitySettings.gaussianSplat.maximumNumberOfGaussians)});this.addHandles([i(()=>this.view.qualitySettings.fadeDuration,e=>{this.fadeHelper.onFadeDurationChanged(e),this.data.fadingTexture.updateTexture(this.data.textureAtlas.pageAllocator.pageCount)}),i(()=>this.view.qualitySettings.gaussianSplat.maximumNumberOfGaussians,e=>this.setMaximumGaussianCount(e*this.view.quality)),i(()=>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 x(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 w(this.layer.elevationInfo)}get elevationRange(){const e=this.fullExtent;return e?.zmin&&e?.zmax?new j(e.zmin,e.zmax):null}getElevationRange(e){return this._intersectionHandler.getElevationRange(e)}get fullExtent(){return this.layer.fullExtent}get visibleAtCurrentScale(){return D(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 s=t.desc.prims[0],i=s.vertexCount,r=s.atrbs[0].view,a=s.atrbs[0].view.byteCount,n=s.atrbs[0].view.byteOffset;let o=null;if("U32"!==r.type)return q().warnOnce("unexpected meshData.data format"),{memUsageBytes:0,numGaussians:0};o=new Uint32Array(t.data.buffer,n,a/4);const l=this.extractHeader(o),d=Math.ceil(i/A),m=new Uint32Array(i),c=new Array;let p=!1,f=0;const g=async e=>{for(;f<d&&!e.done&&!p;f++){let t=this.data.textureAtlas.requestPage();if(null===t&&(this._freeInvisibleTiles(),t=this.data.textureAtlas.requestPage()),null!==t){c.push(t);const s=i-f*A,r=Math.min(s,A),a=f*A;for(let e=0;e<r;e++)m[e+a]=e+U*t;const n=f*V;this._pageBuffer.set(o.subarray(n,n+r*G)),this._pageBuffer.set(l.packedHeader,V);const h=t*U,u=h%I,d=Math.floor(h/I);this.data.textureAtlas.update(u,d,this._pageBuffer),e.madeProgress()}else p=!0}f<d&&!p&&await this._frameTask.schedule(g)};if(await this._frameTask.schedule(g),p)return q().warnOnce("ran out of gaussian splat memory"),{memUsageBytes:0,numGaussians:0};const y=new Float32Array(3*i),_=new Float32Array(i),w=2.048,v=l.tileOrigin.x*w,b=l.tileOrigin.y*w,S=l.tileOrigin.z*w,C=l.invPosScale;let x=null;if(t.desc.obb){const e=t.desc.obb.quaternion;x=new E(t.desc.obb.center,t.desc.obb.halfSize,h(...e))}x||(q().warnOnce("encountered tile without a bounding box"),x=new E);const M=x.centerX,H=x.centerY,P=x.centerZ,R=new j,T=this.view.state.isGlobal,O=T?u(this.view.spatialReference).radius:0;let F=0,k=0,B=0;const D=async e=>{for(;B<i&&!e.done;B++){const t=B*G,{rawX:s,rawY:i,rawZ:r}=this._extractGaussianPosition(o,t),a=this._extractGaussianSphericalScale(o,t),n=s*C+v,l=i*C+b,h=r*C+S;y[F]=n-M,y[F+1]=l-H,y[F+2]=h-P;const u=T?Math.sqrt(n*n+l*l+h*h)-O:h;R.expandElevationRangeValues(u,u),_[B]=a*a,k=Math.max(k,a),F+=3,e.madeProgress()}B<i&&await this._frameTask.schedule(D)};await this._frameTask.schedule(D);const{fullExtent:z}=this.layer;z?.hasZ&&z.zmax&&z.zmin&&(R.minElevation=Math.max(R.minElevation,z.zmin),R.maxElevation=Math.min(R.maxElevation,z.zmax));const N=new L(e.handle,x,m,c,y,_,k,R);return this._memCache.put(`${N.handle}`,N),this._tileHandles.set(e.handle,N),this._cacheMemory+=N.usedMemory,{memUsageBytes:N.usedMemory,numGaussians:i}}_extractGaussianPosition(e,t){const s=e[t+1];return{rawX:16383&s,rawY:s>>>14&16383,rawZ:s>>>28&15|(1023&e[t+2])<<4}}_extractGaussianSphericalScale(e,t){const s=e[t+2],i=s>>>10&255,r=s>>>18&255,a=s>>>26&63|(3&e[t+3])<<6,n=Math.exp(i/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.isTileFadingOut(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}`)}setRenderableVisibility(e,t,s){const i=this._tmpObbsWithChangedVisibility;i.length=0;for(let r=0;r<s;r++){if(!t[r])continue;const s=e[r],a=this._tileHandles.get(s);a&&(a.isVisible&&!this.fadeHelper.isTileFadingOut(a)||(a.isVisible=!0,i.push(a.obb),this.fadeHelper.isTileFadingOut(a)||this._popTileFromCache(a),this.fadeHelper.fadeTile(a,0)))}for(let r=0;r<s;r++){if(t[r])continue;const s=e[r],a=this._tileHandles.get(s);a&&a.isVisible&&(i.push(a.obb),this.fadeHelper.fadeTile(a,1))}i.length>0&&this._elevationProvider&&this._elevationProvider.notifyObjectsChanged(i),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=s(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)||p(this.view.renderSpatialReference))return!0;if(this.layer.esriCrsSpatialReference&&f(this.layer.esriCrsSpatialReference,this.view.renderSpatialReference)){if(115700===this.layer.esriCrsSpatialReference.vcsWkid)return!1;let e=_(this.layer.esriCrsSpatialReference);if(!e){const t=this.layer.esriCrsSpatialReference;let s="meters";!g(t)&&t.wkid&&-1!==t.wkid&&(s=a(y.units[y[t.wkid]])),s&&(e=new d({heightModel:"gravity-related-height",heightUnit:s}))}const t=this.view.heightModelInfo;return this._useEsriCrs=0===m(e,t,!1),this._useEsriCrs&&(e&&(this._metersPerVCSUnit=n(1,"meters",e.heightUnit)),this.fullExtentInLocalViewSpatialReference=this.layer.esriCrsFullExtent),this._useEsriCrs}return!1}_elevationInfoChanged(e){if(e?.offset)if(this._useEsriCrs){const t=v(e?.unit)/this._metersPerVCSUnit,s=e?.offset??0;this._wasm?.setLayerOffset(this,s*t)}else this._wasm?.setLayerOffset(this,w(e));else this._wasm?.setLayerOffset(this,0)}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,s=this.reinterpretU32AsFloat(e[t]),i=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:s,y:i,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(s=>{s.isVisible?e++:t++}),new b(this.usedMemory,e,t,this.cachedMemory)}get test(){}};e([o()],N.prototype,"layer",void 0),e([o()],N.prototype,"elevationOffset",null),e([o({readOnly:!0})],N.prototype,"visibleAtCurrentScale",null),e([o()],N.prototype,"fullExtentInLocalViewSpatialReference",void 0),N=e([l("esri.views.3d.layers.GaussianSplatLayerView3D")],N);const W=N;export{W 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,syncAndInitial 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 u}from"../../../geometry/ellipsoidUtils.js";import d 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 M,removeLayerViewFromWasm as H}from"./Lyr3DWasm.js";import{LayerElevationProvider as j}from"./i3s/LayerElevationProvider.js";import{ElevationRange as E}from"../support/ElevationRange.js";import{projectToBoundingBox as P}from"../support/extentUtils.js";import{Obb as U}from"../support/orientedBoundingBox.js";import{splatPageSizeInU32 as A,elementsPerSplatPage as G,packedGaussianSizeInU32 as V,splatPageSizeInU32WithoutHeader as R,gaussiansPerSplatPage as I,splatAtlasTextureWidth as O}from"../support/gaussianSplatting/GaussianSplatAtlasPages.js";import{GaussianSplatDataStore as T}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 z,isInEffectiveScaleRange as q}from"../../support/layerViewUtils.js";import{TaskPriority as N}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(A),this._tmpObbsWithChangedVisibility=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(N.GAUSSIAN_SPLAT_TEXTURE_ATLAS)}get _clippingBox(){if(!this.view?.clippingArea)return null;const e=m();return P(this.view.clippingArea,e,this.view.renderSpatialReference)?e:null}get clippingBox(){return this._renderNode?.clippingBox??null}initialize(){if(!this._canProjectWithoutEngine())throw z("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 T(this._renderNode),this.fadeHelper=new L(this),this._intersectionHandler=new B(this),this.view.sceneIntersectionHelper.addIntersectionHandler(this._intersectionHandler),this._elevationProvider=new j({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))]),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 M(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 E(e.zmin,e.zmax):null}getElevationRange(e){return this._intersectionHandler.getElevationRange(e)}get fullExtent(){return this.layer.fullExtent}get visibleAtCurrentScale(){return q(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),d=Math.ceil(s/I),m=new Uint32Array(s),p=new Array;let c=!1,f=0;const g=async e=>{for(;f<d&&!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*I,r=Math.min(i,I),a=f*I;for(let e=0;e<r;e++)m[e+a]=e+G*t;const n=f*R;this._pageBuffer.set(o.subarray(n,n+r*V)),this._pageBuffer.set(l.packedHeader,R);const h=t*G,u=h%O,d=Math.floor(h/O);this.data.textureAtlas.update(u,d,this._pageBuffer),e.madeProgress()}else c=!0}f<d&&!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 M=C.centerX,H=C.centerY,j=C.centerZ,P=new E,A=this.view.state.isGlobal,T=A?u(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*V,{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-M,y[L+1]=l-H,y[L+2]=h-j;const u=A?Math.sqrt(n*n+l*l+h*h)-T:h;P.expandElevationRangeValues(u,u),_[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:z}=this.layer;z?.hasZ&&z.zmax&&z.zmin&&(P.minElevation=Math.max(P.minElevation,z.zmin),P.maxElevation=Math.min(P.maxElevation,z.zmax));const q=new F(e.handle,C,m,p,y,_,B,P);return this._memCache.put(`${q.handle}`,q),this._tileHandles.set(e.handle,q),this._cacheMemory+=q.usedMemory,{memUsageBytes:q.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.isTileFadingOut(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}`)}setRenderableVisibility(e,t,i){const s=this._tmpObbsWithChangedVisibility;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.obb),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.obb),this.fadeHelper.fadeTile(a,1))}s.length>0&&this._elevationProvider&&this._elevationProvider.notifyObjectsChanged(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(){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(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 d({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,"meters",e.heightUnit)),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)}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};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{normalize as e,sub as t,dot as i,scaleAndAdd as s,set as n,equals as r,subtract as o,len as a,sqrDist as c,copy as u,scale as l,dist as d,distance as h,length as m,squaredLength as _,squaredDistance as p,add as f}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as v}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as R}from"../../../../geometry/ellipsoidUtils.js";import{getSphericalPCPF as S}from"../../../../geometry/spatialReferenceEllipsoidUtils.js";import{projectBoundingSphere as b}from"../../../../geometry/projection/projectBoundingSphere.js";import{getProjector as g}from"../../../../geometry/projection/projectors.js";import{create as M,fromMatrix as x,intersectsSphere as I,createPoints as C}from"../../../../geometry/support/frustum.js";import{signedDistance as E,getNormal as D}from"../../../../geometry/support/plane.js";import{isPlateCarree as P}from"../../../../geometry/support/spatialReferenceUtils.js";import{Sphere as A}from"../../../../geometry/support/sphere.js";import{evaluateElevationAlignmentAtPoint as O}from"../graphics/elevationAlignmentUtils.js";import{ElevationContext as F}from"../graphics/ElevationContext.js";import{createContextWithoutExpressionSupport as V,extractExpressionInfo as j}from"../graphics/featureExpressionInfoUtils.js";import{intersectBoundingRectWithMbs as B}from"./I3SUtil.js";import{SphereCylinderLocal as w,SphereConeGlobal as L}from"./SphereCone.js";import{Obb as y,computeOffsetObb as U}from"../../support/orientedBoundingBox.js";const q=1e5;class G{get _frustumMbsCenter(){return this._frustumMbs.center}get _frustumMbsRadius(){return this._frustumMbs.radius}get _frustumPlanes(){return this._frustum}constructor(e,t,i,s,n,r,o,a,c={}){this._indexSR=e,this._renderCoordsHelper=t,this._clippingArea=n,this._elevationProvider=r,this._viewingMode=o,this._options=c,this._frustum=M(),this._frustumMbs=new A,this._viewDirection=v(),this._useFrustumCulling=!1,this._poi=v(),this._cameraPOIDirection=v(),this._elevationContext=null,this.minDistance=1/0,this.maxDistance=0,this.maxLodLevel=2,this._screenspaceErrorBias=c.screenspaceErrorBias||1,this._progressiveLoadFactor=c.progressiveLoadFactor||1,this.updateCamera(i,s);const u=this._renderCoordsHelper.spatialReference;this._renderSR=u,this._renderSRSphericalPCPF=S(u),this._isGlobalMode=u===this._renderSRSphericalPCPF,this.updateElevationInfo(a),this._isECEFOBBInLocalMode=this._indexSR.isWGS84&&(u.isWebMercator||P(u)),this._indexSREllipsoidRadius=R(this._indexSR).radius,this._indexSRSphericalPCPF=S(e),this._projectorIndexSRToIndexSRSphericalPCPF=g(this._indexSR,this._indexSRSphericalPCPF)}updateElevationInfo(e){null!=e?(this._elevationContext=F.fromElevationInfo(e),this._elevationContext.setFeatureExpressionInfoContext(V(j(e,!1)))):this._elevationContext=null}updateCamera(n,r){if(this._useFrustumCulling=r,e(this._viewDirection,n.viewForward),r){x(n.viewMatrix,n.projectionMatrix,this._frustum,z);{const e=n.eye,r=T;t(r,z[4],e);const o=.5*i(r,r)/i(this._viewDirection,r),a=this._frustumMbs,c=a.center;s(c,e,this._viewDirection,o);const u=1+o;a.radius=u}}this._screenSizeFactor=1/(n.perScreenPixelRatio/2),this._camPos=n.eye,this._updateCameraPOIDirection(),this.minDistance=1/0,this.maxDistance=0}setPointOfInterest(e){this._poi=e,this._updateCameraPOIDirection()}updateScreenSpaceErrorBias(e){const t=this._screenspaceErrorBias;return this._screenspaceErrorBias=e,t}updateClippingArea(e){this._clippingArea=e}expandElevationRange(e,t,i){if(null==this._elevationContext)return;const s=e.serviceMbsInIndexSR;if(!s)return;const n="relative-to-scene"===this._elevationContext.mode?"scene":"ground",r=this._elevationProvider;if(r.getSphereElevationRange){const e=r.getSphereElevationRange(s,this._indexSR,n);if(e)return void i.expandElevationRange(e)}const[o,a,c]=s.center,u=r.getElevation(o,a,c,this._indexSR,n);u&&i.expandElevationRangeValues(u,u);const l=t?null:r.getRootElevationRange?.();l&&i.expandElevationRange(l)}calculateServiceMbsInRenderSR(e){const{serviceMbsInRenderSR:t}=e;if(t.isValid)return t;const{serviceMbsInIndexSR:i}=e;if(!i?.isValid)return t;const s=ie;return b(i,this._indexSR,s,this._renderSR),e.updateServiceMbsInRenderSR(s)}calculateServiceMbsInRenderSRElevationAdjusted(e){const{serviceMbsInRenderSRElevationAdjusted:t}=e;if(t.isValid)return t;const{serviceMbsInIndexSR:i}=e,s=this.calculateServiceMbsInRenderSR(e);if(!s.isValid||!i?.isValid)return t;const n=ie;n.copyFrom(s);const{_elevationContext:r}=this;if(r){const{minElevation:t}=e,{_renderCoordsHelper:s}=this,o=i.center;let a=0;if(Number.isFinite(t)){let i=0,c=0;const{maxElevation:u}=e,l=o[2];switch(r.mode){case"relative-to-ground":case"relative-to-scene":i=r.geometryZWithOffset(l,s)+t-l,c=u-t;break;case"on-the-ground":i=t-l,c=u-t}a=i+.5*c,n.radius+=.5*c}else n.radius<q&&(a=O(o,this._elevationProvider,r,s)-o[2]);a&&ae(n,a,this._viewingMode)}return e.updateServiceMbsInRenderSRElevationAdjusted(n)}calculateMbsConeInRenderSR(e){const{mbsConeInRenderSR:t}=e;if(t)return t;if(!e.elevationRangeValid)return null;const{minElevation:i,maxElevation:s}=e;if(!(Number.isFinite(i)&&i<s))return null;const n=this.calculateServiceMbsInRenderSR(e);if(!n.isValid)return null;const r=this._renderCoordsHelper.referenceEllipsoid.radius,o=2===this._viewingMode?new w(n,i,s):new L(n,r+i,r+s);return e.updateMbsConeInRenderSR(o)}getAndUpdateVisibilityObbInRenderSR(e){{const t=e.visibilityObbInRenderSR;if(t)return t}const t=.01*this._indexSREllipsoidRadius,{serviceMbsInIndexSR:i,serviceObbInIndexSR:s}=e;if(null==s||!i||!s.isValid||this._isECEFOBBInLocalMode&&(s.halfSizeX>t||s.halfSizeY>t||s.halfSizeZ>t))return null;{let t=e.serviceObbInRenderSR;if(null==t)t=new y,e.serviceObbInRenderSR=t;else if(t.isValid)return t;const r=i.radius;let o=0,a=0;const c=s.centerZ,u=this._renderCoordsHelper,l=this._elevationContext;if(l&&e.elevationRangeValid){const{minElevation:t,maxElevation:i}=e;switch(l.mode){case"relative-to-ground":case"relative-to-scene":o=l.geometryZWithOffset(c,u)+t-c,a=i-t;break;case"on-the-ground":o=t-c,a=i-t}}else if(l&&r<q){const e=n(Y,s.centerX,s.centerY,c);o=O(e,this._elevationProvider,l,u)-c}const d=a>0,h=d?X:t;return s.transform(h,this._indexSR,this._renderSR,o,this._renderSRSphericalPCPF,this._indexSRSphericalPCPF,this._projectorIndexSRToIndexSRSphericalPCPF),d&&U(h,0,a,this._viewingMode,t),t}}getNodeObbInRenderSRIndependentOfElevationOffset(e){{const t=e.visibilityObbInRenderSR??e.serviceObbInRenderSR??null;if(t?.isValid)return t}const t=e.serviceObbInIndexSR;if(!t)return null;const i=.2;return 2===this._viewingMode&&Math.max(...t.halfSize)>i*this._indexSREllipsoidRadius?null:(t.transform(X,this._indexSR,this._renderSR,void 0,this._renderSRSphericalPCPF,this._indexSRSphericalPCPF,this._projectorIndexSRToIndexSRSphericalPCPF),X)}ensureElevationAgnosticBoundingVolume(e){return!e.elevationAgnosticBoundingVolume.valid&&e.level>0&&(1===this._viewingMode?this._updateElevationAgnosticBoundingVolumeGlobal(e):this._updateElevationAgnosticBoundingVolumeLocal(e)),e.elevationAgnosticBoundingVolume}_updateCameraPOIDirection(){r(this._poi,this._camPos)?this._cameraPOIDirection=this._viewDirection:(o(this._cameraPOIDirection,this._camPos,this._poi),e(this._cameraPOIDirection,this._cameraPOIDirection))}_updateElevationAgnosticBoundingVolumeGlobal(t){const s=this.getNodeObbInRenderSRIndependentOfElevationOffset(t),n=t.elevationAgnosticBoundingVolume;let r,o=-1;if(s){const t=Y;s.getCenter(t),e(t,t),r=t,s.getCorners(J);for(const s of J){e(s,s);const r=i(s,t);if(r<=0)return void n.invalidate();const a=Math.sqrt(1-r*r);o=Math.max(o,a)}}else{const i=t.serviceMbsInRenderSR;if(!i.isValid)return void n.invalidate();const{center:s,radius:c}=i,u=a(s);if(u<c)return void n.invalidate();o=c/u,r=e(te,s)}n.set(r,o+ce)}_updateElevationAgnosticBoundingVolumeLocal(e){const t=e.elevationAgnosticBoundingVolume,i=this.getNodeObbInRenderSRIndependentOfElevationOffset(e);if(i){const e=i.getCenter(Y);e[2]=0;let s=0;const n=K;i.getCorners(J);for(const t of J){t[2]=0;const e=c(n,t);s=Math.max(s,e)}t.set(e,Math.sqrt(s))}else{const i=e.serviceMbsInRenderSR;if(i.isValid){const e=u(Y,i.center);e[2]=0,t.set(e,i.radius)}}}isNodeVisible(e){if(!this._isMBSinClippingArea(this.calculateServiceMbsInRenderSR(e)))return!1;if(!this._useFrustumCulling)return!0;const t=this.getAndUpdateVisibilityObbInRenderSR(e);return t?t.intersectsFrustumConservativeApproximation(this._frustum):I(this._frustum,this.calculateServiceMbsInRenderSRElevationAdjusted(e))}isElevationAgnosticBoundingVolumeVisible(e){return!this._useFrustumCulling||(!e.valid||(1===this._viewingMode?this._isConeVisibleInFrustum(e):this._isCylinderVisibleInFrustum(e)))}_isConeVisibleInFrustum(n){if(!this._isConeVisibleInFrustumMbs(n)||!n.valid)return!1;const r=n.radius;if(r>.9)return!0;const o=this._frustumPlanes,a=this._frustumMbsCenter,c=n.getAxis(te),u=i(c,a),d=this._frustumMbsRadius,h=u-d,m=u+d;if(h<=0)return!0;const _=l(k,c,h),p=l(H,c,m),f=r/Math.sqrt(1-r*r);for(const v of o){const n=D(v),r=e(Z,n),o=i(r,c);if(Math.abs(1-o)<.01)continue;const a=Q;l(a,c,o),t(a,a,r),e(a,a);const u=$;s(u,_,a,h*f);if(E(v,u)<=0)continue;s(u,p,a,m*f);if(E(v,u)<=0)continue;return!1}return!0}_isConeVisibleInFrustumMbs(e){const t=e.radius;if(t>.9)return!0;const s=this._frustumMbsRadius,n=this._frustumMbsCenter,r=a(n);if(r<=s)return!0;const o=e.getAxis(te),c=i(o,n);{const e=l(W,o,c);if(d(e,n)<s)return!0}const u=c/r;if(c<=0){return-u<s}const h=Math.sqrt(1-u*u);if(h<t)return!0;const m=s/r;return h*Math.sqrt(1-m*m)-m*u<t}isObbVisibleIndependentOfElevation(e,t){if(!this._useFrustumCulling)return!0;if(!e.valid)return!0;const s=this._frustumMbsRadius,n=this._frustumMbsCenter,r=this._frustumPlanes,o=J;if(t.getCorners(o),1===this._viewingMode){const t=e.getAxis(te),a=i(t,n),c=a-s,u=a+s;if(c<=0)return!0;for(const e of r){let s=!0;for(const n of o){const r=i(n,t),o=ee;if(l(o,n,c/r),E(e,o)<=0){s=!1;break}const a=ee;if(l(a,n,u/r),E(e,a)<=0){s=!1;break}}if(s)return!1}}else{const e=n[2]-s,t=n[2]+s;for(const i of r){let s=!0;const n=D(i),r=n[0],a=n[1],c=n[2],u=i[3];for(const i of o){const n=r*i[0]+a*i[1]+u;if(n+c*e<=0||n+c*t<=0){s=!1;break}}if(s)return!1}}return!0}_isCylinderVisibleInFrustum(e){const t=this._frustumMbsCenter,i=this._frustumMbsRadius,s=u(W,t);s[2]=0;const n=e.radius,r=e.getAxis(te);return d(s,r)<=n+i}isGeometryVisible(e){if(!this._useFrustumCulling)return!0;const t=e.geometryObbInRenderSR;return t?.intersectsFrustumConservativeApproximation(this._frustum)??this.isNodeVisible(e)}_isMBSinClippingArea(e){return null==this._clippingArea||0!==B(this._clippingArea,e)}_screenSpaceDiameterMbs(e,t){const i=this.calcCameraDistanceAndUpdateMinmaxWithCone(e);return i<0?.5*Number.MAX_VALUE:t/i*this._screenSizeFactor}calcCameraDistanceAndUpdateMinmaxWithCone(e){const t=this.calculateMbsConeInRenderSR(e),i=t?.calculateSurfaceDistanceFromPoint(this._camPos)??this.calcCameraDistanceAndUpdateMinmax(e);return t&&this._updateMinMaxDistance(i),i}calcCameraDistanceAndUpdateMinmax(e){return this.calcCameraDistanceToCenterAndUpdateMinmax(e)-this.calculateServiceMbsInRenderSRElevationAdjusted(e).radius}calcCameraDistanceToCenterAndUpdateMinmax(e){const t=this.calculateServiceMbsInRenderSRElevationAdjusted(e),i=h(t.center,this._camPos);return this._updateMinMaxDistance(i),i}calcAngleDependentLoD(e){const{center:s,radius:n}=this.calculateServiceMbsInRenderSRElevationAdjusted(e),r=t(K,s,this._camPos),o=(Math.abs(i(s,r))/m(s)+n)/m(r);return Math.min(1,o)}hasLOD(e){return 0!==e.lodMetric}_getDistanceGlobeMode(e,t){const s=m(t.center),n=m(e)-s;l(se,e,i(e,t.center)/_(e));const r=p(t.center,se),a=t.radius;if(r<=a*a)return Math.abs(n);{const r=l(se,t.center,1/s),c=l(ne,r,s-a*a/2/s),u=e,d=o(re,u,c),_=o(re,d,l(oe,r,i(r,d))),p=f(re,c,l(re,_,a/m(_)));let v=h(u,p);if(n>=2e5){const e=o(ne,u,p);let t=i(e,r)/m(e);t<.08&&(t=1e-4),v/=t}return v}}_getDistance(e,t){return this._isGlobalMode?this._getDistanceGlobeMode(e,t):N(e,t)}_updateMinMaxDistance(e){e>0?(this.minDistance=Math.min(this.minDistance,e),this.maxDistance=Math.max(this.maxDistance,e)):(this.minDistance=0,this.maxDistance=Math.max(this.maxDistance,-e))}getLodLevel(e){if(0===e.lodMetric)return 0;if(0===e.childCount)return this.maxLodLevel;if(this._useFrustumCulling&&this._progressiveLoadFactor<1){const t=this._progressiveLoadFactor*this._screenspaceErrorBias,i=this._screenspaceErrorBias;return this.evaluateLODmetric(e,t)?this.evaluateLODmetric(e,i)?2:1:0}return this.evaluateLODmetric(e,this._screenspaceErrorBias)?this.maxLodLevel:0}evaluateLODmetric(e,t){switch(e.lodMetric){case 1:{let i=this._screenSpaceDiameterMbs(e,(e.serviceMbsInIndexSR?.radius??0)*t);return this._options.angleDependentLoD&&(i*=this.calcAngleDependentLoD(e)),i<e.maxError}case 2:{const i=this.calculateServiceMbsInRenderSRElevationAdjusted(e),s=this._getDistance(this._camPos,i),n=2*s/this._screenSizeFactor,r=s+i.radius;return this._updateMinMaxDistance(r),e.maxError*t<=n}case 3:return this._screenSpaceDiameterMbs(e,e.maxError)*t<10;case 4:return this.calcCameraDistanceAndUpdateMinmax(e)>e.maxError*t}return!1}distToCameraPOIRay(e){if(null==e)return 0;const t=this.calculateServiceMbsInRenderSRElevationAdjusted(e),s=t.center,n=i(s,this._cameraPOIDirection),r=n*n,o=_(s)-r;return Math.sqrt(o)-t.radius}distCameraToPOI(){return h(this._camPos,this._poi)}}function N(e,t){const i=e[0]-t.center[0],s=e[1]-t.center[1],n=e[2]-t.center[2],r=i*i+s*s,o=t.radius;if(r<=o*o)return Math.abs(n);const a=Math.sqrt(r)-o;return Math.sqrt(n*n+a*a)}const z=C(),T=v(),W=v(),k=v(),H=v(),Z=v(),X=new y,Y=v(),J=[v(),v(),v(),v(),v(),v(),v(),v()],K=v(),Q=v(),$=v(),ee=v(),te=v(),ie=new A,se=v(),ne=v(),re=v(),oe=v();function ae(e,t,i){if(2===i)e.center[2]+=t;else{const i=m(e.center);l(e.center,e.center,1+t/i)}}const ce=.001;export{G as default};
2
+ import{normalize as e,sub as t,dot as i,scaleAndAdd as s,set as n,equals as r,subtract as o,len as a,sqrDist as c,copy as u,scale as l,dist as d,distance as h,length as m,squaredLength as _,squaredDistance as p,add as f}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as v}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as R}from"../../../../geometry/ellipsoidUtils.js";import{getSphericalPCPF as S}from"../../../../geometry/spatialReferenceEllipsoidUtils.js";import{projectBoundingSphere as b}from"../../../../geometry/projection/projectBoundingSphere.js";import{getProjector as g}from"../../../../geometry/projection/projectors.js";import{create as M,fromMatrix as x,intersectsSphere as I,createPoints as C}from"../../../../geometry/support/frustum.js";import{signedDistance as E,getNormal as D}from"../../../../geometry/support/plane.js";import{isPlateCarree as P}from"../../../../geometry/support/spatialReferenceUtils.js";import{Sphere as A}from"../../../../geometry/support/sphere.js";import{evaluateElevationAlignmentAtPoint as O}from"../graphics/elevationAlignmentUtils.js";import{ElevationContext as F}from"../graphics/ElevationContext.js";import{createContextWithoutExpressionSupport as V,extractExpressionInfo as j}from"../graphics/featureExpressionInfoUtils.js";import{intersectBoundingRectWithMbs as B}from"./I3SUtil.js";import{SphereCylinderLocal as w,SphereConeGlobal as L}from"./SphereCone.js";import{Obb as y,computeOffsetObb as U}from"../../support/orientedBoundingBox.js";const q=1e5;class G{get _frustumMbsCenter(){return this._frustumMbs.center}get _frustumMbsRadius(){return this._frustumMbs.radius}get _frustumPlanes(){return this._frustum}constructor(e,t,i,s,n,r,o,a,c={}){this._indexSR=e,this._renderCoordsHelper=t,this._clippingArea=n,this._elevationProvider=r,this._viewingMode=o,this._options=c,this._frustum=M(),this._frustumMbs=new A,this._viewDirection=v(),this._useFrustumCulling=!1,this._poi=v(),this._cameraPOIDirection=v(),this._elevationContext=null,this.minDistance=1/0,this.maxDistance=0,this.maxLodLevel=2,this._screenspaceErrorBias=c.screenspaceErrorBias||1,this._progressiveLoadFactor=c.progressiveLoadFactor||1,this.updateCamera(i,s);const u=this._renderCoordsHelper.spatialReference;this._renderSR=u,this._renderSRSphericalPCPF=S(u),this._isGlobalMode=u===this._renderSRSphericalPCPF,this.updateElevationInfo(a),this._isECEFOBBInLocalMode=this._indexSR.isWGS84&&(u.isWebMercator||P(u)),this._indexSREllipsoidRadius=R(this._indexSR).radius,this._indexSRSphericalPCPF=S(e),this._projectorIndexSRToIndexSRSphericalPCPF=g(this._indexSR,this._indexSRSphericalPCPF)}updateElevationInfo(e){null!=e?(this._elevationContext=F.fromElevationInfo(e),this._elevationContext.setFeatureExpressionInfoContext(V(j(e,!1)))):this._elevationContext=null}updateCamera(n,r){if(this._useFrustumCulling=r,e(this._viewDirection,n.viewForward),r){x(n.viewMatrix,n.projectionMatrix,this._frustum,z);{const e=n.eye,r=T;t(r,z[4],e);const o=.5*i(r,r)/i(this._viewDirection,r),a=this._frustumMbs,c=a.center;s(c,e,this._viewDirection,o);const u=1+o;a.radius=u}}this._screenSizeFactor=1/(n.perScreenPixelRatio/2),this._camPos=n.eye,this._updateCameraPOIDirection(),this.minDistance=1/0,this.maxDistance=0}setPointOfInterest(e){this._poi=e,this._updateCameraPOIDirection()}updateScreenSpaceErrorBias(e){const t=this._screenspaceErrorBias;return this._screenspaceErrorBias=e,t}updateClippingArea(e){this._clippingArea=e}expandElevationRange(e,t,i){if(null==this._elevationContext)return;const s=e.serviceMbsInIndexSR;if(!s)return;const n="relative-to-scene"===this._elevationContext.mode?"scene":"ground",r=this._elevationProvider;if(r.getSphereElevationRange){const e=r.getSphereElevationRange(s,this._indexSR,n);if(e)return void i.expandElevationRange(e)}const[o,a,c]=s.center,u=r.getElevation(o,a,c,this._indexSR,n);u&&i.expandElevationRangeValues(u,u);const l=t?null:r.getRootElevationRange?.();l&&i.expandElevationRange(l)}calculateServiceMbsInRenderSR(e){const{serviceMbsInRenderSR:t}=e;if(t.isValid)return t;const{serviceMbsInIndexSR:i}=e;if(!i?.isValid)return t;const s=ie;return b(i,this._indexSR,s,this._renderSR),e.updateServiceMbsInRenderSR(s)}calculateServiceMbsInRenderSRElevationAdjusted(e){const{serviceMbsInRenderSRElevationAdjusted:t}=e;if(t.isValid)return t;const{serviceMbsInIndexSR:i}=e,s=this.calculateServiceMbsInRenderSR(e);if(!s.isValid||!i?.isValid)return t;const n=ie;n.copyFrom(s);const{_elevationContext:r}=this;if(r){const{minElevation:t}=e,{_renderCoordsHelper:s}=this,o=i.center;let a=0;if(Number.isFinite(t)){let i=0,c=0;const{maxElevation:u}=e,l=o[2];switch(r.mode){case"relative-to-ground":case"relative-to-scene":i=r.geometryZWithOffset(l,s)+t-l,c=u-t;break;case"on-the-ground":i=t-l,c=u-t}a=i+.5*c,n.radius+=.5*c}else n.radius<q&&(a=O(o,this._elevationProvider,r,s)-o[2]);a&&ae(n,a,this._viewingMode)}return e.updateServiceMbsInRenderSRElevationAdjusted(n)}calculateMbsConeInRenderSR(e){const{mbsConeInRenderSR:t}=e;if(t)return t;if(!e.elevationRangeValid)return null;const{minElevation:i,maxElevation:s}=e;if(!(Number.isFinite(i)&&i<s))return null;const n=this.calculateServiceMbsInRenderSR(e);if(!n.isValid)return null;const r=this._renderCoordsHelper.referenceEllipsoid.radius,o=2===this._viewingMode?new w(n,i,s):new L(n,r+i,r+s);return e.updateMbsConeInRenderSR(o)}getAndUpdateVisibilityObbInRenderSR(e){{const t=e.visibilityObbInRenderSR;if(t)return t}const t=.01*this._indexSREllipsoidRadius,{serviceMbsInIndexSR:i,serviceObbInIndexSR:s}=e;if(null==s||!i||!s.isValid||this._isECEFOBBInLocalMode&&(s.halfSizeX>t||s.halfSizeY>t||s.halfSizeZ>t))return null;{let t=e.serviceObbInRenderSR;if(null==t)t=new y,e.serviceObbInRenderSR=t;else if(t.isValid)return t;const r=i.radius;let o=0,a=0;const c=s.centerZ,u=this._renderCoordsHelper,l=this._elevationContext;if(l&&e.elevationRangeValid){const{minElevation:t,maxElevation:i}=e;switch(l.mode){case"relative-to-ground":case"relative-to-scene":o=l.geometryZWithOffset(c,u)+t-c,a=i-t;break;case"on-the-ground":o=t-c,a=i-t}}else if(l&&r<q){const e=n(Y,s.centerX,s.centerY,c);o=O(e,this._elevationProvider,l,u)-c}const d=a>0,h=d?X:t;return s.transform(h,this._indexSR,this._renderSR,o,this._renderSRSphericalPCPF,this._indexSRSphericalPCPF,this._projectorIndexSRToIndexSRSphericalPCPF),d&&U(h,0,a,this._viewingMode,t),t}}getNodeObbInRenderSRIndependentOfElevationOffset(e){{const t=e.visibilityObbInRenderSR??e.serviceObbInRenderSR??null;if(t?.isValid)return t}const t=e.serviceObbInIndexSR;if(!t)return null;const i=.2;return 2===this._viewingMode&&Math.max(...t.halfSize)>i*this._indexSREllipsoidRadius?null:(t.transform(X,this._indexSR,this._renderSR,void 0,this._renderSRSphericalPCPF,this._indexSRSphericalPCPF,this._projectorIndexSRToIndexSRSphericalPCPF),X)}ensureElevationAgnosticBoundingVolume(e){return!e.elevationAgnosticBoundingVolume.valid&&e.level>0&&(1===this._viewingMode?this._updateElevationAgnosticBoundingVolumeGlobal(e):this._updateElevationAgnosticBoundingVolumeLocal(e)),e.elevationAgnosticBoundingVolume}_updateCameraPOIDirection(){r(this._poi,this._camPos)?this._cameraPOIDirection=this._viewDirection:(o(this._cameraPOIDirection,this._camPos,this._poi),e(this._cameraPOIDirection,this._cameraPOIDirection))}_updateElevationAgnosticBoundingVolumeGlobal(t){const s=this.getNodeObbInRenderSRIndependentOfElevationOffset(t),n=t.elevationAgnosticBoundingVolume;let r,o=-1;if(s){const t=Y;s.getCenter(t),e(t,t),r=t,s.getCorners(J);for(const s of J){e(s,s);const r=i(s,t);if(r<=0)return void n.invalidate();const a=Math.sqrt(Math.max(0,1-r*r));o=Math.max(o,a)}}else{const i=t.serviceMbsInRenderSR;if(!i.isValid)return void n.invalidate();const{center:s,radius:c}=i,u=a(s);if(u<c)return void n.invalidate();o=c/u,r=e(te,s)}n.set(r,o+ce)}_updateElevationAgnosticBoundingVolumeLocal(e){const t=e.elevationAgnosticBoundingVolume,i=this.getNodeObbInRenderSRIndependentOfElevationOffset(e);if(i){const e=i.getCenter(Y);e[2]=0;let s=0;const n=K;i.getCorners(J);for(const t of J){t[2]=0;const e=c(n,t);s=Math.max(s,e)}t.set(e,Math.sqrt(s))}else{const i=e.serviceMbsInRenderSR;if(i.isValid){const e=u(Y,i.center);e[2]=0,t.set(e,i.radius)}}}isNodeVisible(e){if(!this._isMBSinClippingArea(this.calculateServiceMbsInRenderSR(e)))return!1;if(!this._useFrustumCulling)return!0;const t=this.getAndUpdateVisibilityObbInRenderSR(e);return t?t.intersectsFrustumConservativeApproximation(this._frustum):I(this._frustum,this.calculateServiceMbsInRenderSRElevationAdjusted(e))}isElevationAgnosticBoundingVolumeVisible(e){return!this._useFrustumCulling||(!e.valid||(1===this._viewingMode?this._isConeVisibleInFrustum(e):this._isCylinderVisibleInFrustum(e)))}_isConeVisibleInFrustum(n){if(!this._isConeVisibleInFrustumMbs(n)||!n.valid)return!1;const r=n.radius;if(r>.9)return!0;const o=this._frustumPlanes,a=this._frustumMbsCenter,c=n.getAxis(te),u=i(c,a),d=this._frustumMbsRadius,h=u-d,m=u+d;if(h<=0)return!0;const _=l(k,c,h),p=l(H,c,m),f=r/Math.sqrt(1-r*r);for(const v of o){const n=D(v),r=e(Z,n),o=i(r,c);if(Math.abs(1-o)<.01)continue;const a=Q;l(a,c,o),t(a,a,r),e(a,a);const u=$;s(u,_,a,h*f);if(E(v,u)<=0)continue;s(u,p,a,m*f);if(E(v,u)<=0)continue;return!1}return!0}_isConeVisibleInFrustumMbs(e){const t=e.radius;if(t>.9)return!0;const s=this._frustumMbsRadius,n=this._frustumMbsCenter,r=a(n);if(r<=s)return!0;const o=e.getAxis(te),c=i(o,n);{const e=l(W,o,c);if(d(e,n)<s)return!0}const u=c/r;if(c<=0){return-u<s}const h=Math.sqrt(1-u*u);if(h<t)return!0;const m=s/r;return h*Math.sqrt(1-m*m)-m*u<t}isObbVisibleIndependentOfElevation(e,t){if(!this._useFrustumCulling)return!0;if(!e.valid)return!0;const s=this._frustumMbsRadius,n=this._frustumMbsCenter,r=this._frustumPlanes,o=J;if(t.getCorners(o),1===this._viewingMode){const t=e.getAxis(te),a=i(t,n),c=a-s,u=a+s;if(c<=0)return!0;for(const e of r){let s=!0;for(const n of o){const r=i(n,t),o=ee;if(l(o,n,c/r),E(e,o)<=0){s=!1;break}const a=ee;if(l(a,n,u/r),E(e,a)<=0){s=!1;break}}if(s)return!1}}else{const e=n[2]-s,t=n[2]+s;for(const i of r){let s=!0;const n=D(i),r=n[0],a=n[1],c=n[2],u=i[3];for(const i of o){const n=r*i[0]+a*i[1]+u;if(n+c*e<=0||n+c*t<=0){s=!1;break}}if(s)return!1}}return!0}_isCylinderVisibleInFrustum(e){const t=this._frustumMbsCenter,i=this._frustumMbsRadius,s=u(W,t);s[2]=0;const n=e.radius,r=e.getAxis(te);return d(s,r)<=n+i}isGeometryVisible(e){if(!this._useFrustumCulling)return!0;const t=e.geometryObbInRenderSR;return t?.intersectsFrustumConservativeApproximation(this._frustum)??this.isNodeVisible(e)}_isMBSinClippingArea(e){return null==this._clippingArea||0!==B(this._clippingArea,e)}_screenSpaceDiameterMbs(e,t){const i=this.calcCameraDistanceAndUpdateMinmaxWithCone(e);return i<0?.5*Number.MAX_VALUE:t/i*this._screenSizeFactor}calcCameraDistanceAndUpdateMinmaxWithCone(e){const t=this.calculateMbsConeInRenderSR(e),i=t?.calculateSurfaceDistanceFromPoint(this._camPos)??this.calcCameraDistanceAndUpdateMinmax(e);return t&&this._updateMinMaxDistance(i),i}calcCameraDistanceAndUpdateMinmax(e){return this.calcCameraDistanceToCenterAndUpdateMinmax(e)-this.calculateServiceMbsInRenderSRElevationAdjusted(e).radius}calcCameraDistanceToCenterAndUpdateMinmax(e){const t=this.calculateServiceMbsInRenderSRElevationAdjusted(e),i=h(t.center,this._camPos);return this._updateMinMaxDistance(i),i}calcAngleDependentLoD(e){const{center:s,radius:n}=this.calculateServiceMbsInRenderSRElevationAdjusted(e),r=t(K,s,this._camPos),o=(Math.abs(i(s,r))/m(s)+n)/m(r);return Math.min(1,o)}hasLOD(e){return 0!==e.lodMetric}_getDistanceGlobeMode(e,t){const s=m(t.center),n=m(e)-s;l(se,e,i(e,t.center)/_(e));const r=p(t.center,se),a=t.radius;if(r<=a*a)return Math.abs(n);{const r=l(se,t.center,1/s),c=l(ne,r,s-a*a/2/s),u=e,d=o(re,u,c),_=o(re,d,l(oe,r,i(r,d))),p=f(re,c,l(re,_,a/m(_)));let v=h(u,p);if(n>=2e5){const e=o(ne,u,p);let t=i(e,r)/m(e);t<.08&&(t=1e-4),v/=t}return v}}_getDistance(e,t){return this._isGlobalMode?this._getDistanceGlobeMode(e,t):N(e,t)}_updateMinMaxDistance(e){e>0?(this.minDistance=Math.min(this.minDistance,e),this.maxDistance=Math.max(this.maxDistance,e)):(this.minDistance=0,this.maxDistance=Math.max(this.maxDistance,-e))}getLodLevel(e){if(0===e.lodMetric)return 0;if(0===e.childCount)return this.maxLodLevel;if(this._useFrustumCulling&&this._progressiveLoadFactor<1){const t=this._progressiveLoadFactor*this._screenspaceErrorBias,i=this._screenspaceErrorBias;return this.evaluateLODmetric(e,t)?this.evaluateLODmetric(e,i)?2:1:0}return this.evaluateLODmetric(e,this._screenspaceErrorBias)?this.maxLodLevel:0}evaluateLODmetric(e,t){switch(e.lodMetric){case 1:{let i=this._screenSpaceDiameterMbs(e,(e.serviceMbsInIndexSR?.radius??0)*t);return this._options.angleDependentLoD&&(i*=this.calcAngleDependentLoD(e)),i<e.maxError}case 2:{const i=this.calculateServiceMbsInRenderSRElevationAdjusted(e),s=this._getDistance(this._camPos,i),n=2*s/this._screenSizeFactor,r=s+i.radius;return this._updateMinMaxDistance(r),e.maxError*t<=n}case 3:return this._screenSpaceDiameterMbs(e,e.maxError)*t<10;case 4:return this.calcCameraDistanceAndUpdateMinmax(e)>e.maxError*t}return!1}distToCameraPOIRay(e){if(null==e)return 0;const t=this.calculateServiceMbsInRenderSRElevationAdjusted(e),s=t.center,n=i(s,this._cameraPOIDirection),r=n*n,o=_(s)-r;return Math.sqrt(o)-t.radius}distCameraToPOI(){return h(this._camPos,this._poi)}}function N(e,t){const i=e[0]-t.center[0],s=e[1]-t.center[1],n=e[2]-t.center[2],r=i*i+s*s,o=t.radius;if(r<=o*o)return Math.abs(n);const a=Math.sqrt(r)-o;return Math.sqrt(n*n+a*a)}const z=C(),T=v(),W=v(),k=v(),H=v(),Z=v(),X=new y,Y=v(),J=[v(),v(),v(),v(),v(),v(),v(),v()],K=v(),Q=v(),$=v(),ee=v(),te=v(),ie=new A,se=v(),ne=v(),re=v(),oe=v();function ae(e,t,i){if(2===i)e.center[2]+=t;else{const i=m(e.center);l(e.center,e.center,1+t/i)}}const ce=.001;export{G as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{acosClamped as e,lerp as t,clamp as i}from"../../../core/mathUtils.js";import{getMetersPerUnitForSR as r}from"../../../core/units.js";import{length as a,normalize as n,scale as s,dot as o,subtract as m,set as c}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as l}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as h}from"../../../geometry/ellipsoidUtils.js";import p from"../../../geometry/Extent.js";import{create as u,fromValues as x}from"../../../geometry/support/ray.js";import{Sphere as f}from"../../../geometry/support/sphere.js";import{computeInnerAltitudeFade as M}from"../environment/atmosphereUtils.js";import{DepthRange as y}from"../webgl-engine/lib/DepthRange.js";function d(e,t,i){return 1===e?new _(t,i):new v(t,i)}class v{constructor(e,t){this._elevationProvider=e,this._referenceEllipsoid=h(t),this._unitInMeters=r(t,this._referenceEllipsoid.metersPerDegree)}compute(e,r,a,s){const{eye:l,center:h}=e,p=this._unitInMeters,u=l[2]*p,x=u-s,f=this._elevationProvider?.visibleElevationRange,M=f?x>=0?u-p*f.minElevation:p*f.maxElevation-u:u,y=r??V,d={x:y.xmax-y.xmin,y:y.ymax-y.ymin,z:4*Math.max(y.xmax-y.xmin,y.ymax-y.ymin)},v=Math.max(d.x,d.y,d.z),_=m(I,h,l),E=c(z,_[0]>0?y.xmax:y.xmin,_[1]>0?y.ymax:y.ymin,_[2]>0?v/2:-v/2);m(E,E,l),n(_,_);const b=1.1*o(E,_)*p,w=Math.abs(x),D=Math.sqrt(w*(w+2*this._referenceEllipsoid.radius)),U=Math.max(y.xmax-y.xmin,y.ymax-y.ymin),A=U*P*p,q=i((M-A)/(U*F*p-A),0,1)**3,H=Math.min(t(D,b,q),D)*Math.max(Math.log(Math.abs(x)),1);return g(Math.min(H,Math.max(34064e4,v))/p,j,p,R)}computeFarDistance(e,t,i){return i}}class _{constructor(e,t){this._elevationProvider=e,this._referenceEllipsoid=h(t)}compute(r,c,l,h){const{eye:p}=r,u=a(p),f=this._referenceEllipsoid.radius,d=u-f,v=this._computeVirtualAltitude(d,h),_=this._elevationProvider?.visibleElevationRange.maxElevation??0,F=M(v),P=this._computeFarDistance(u,v,h),V=(Math.log(v)-E)/(b-E);g(P,i(j-V*(j-w),w,j),1,R);const q=f+_,H=f+this._referenceEllipsoid.atmosphereHeight,Y=Math.max(q,H),k=u-Y;if(F>0&&k>D){const i=n(z,s(z,r.eye,-1)),c=n(I,r.viewForward),h=e(o(i,c)),p=.5*r.fovY,u=Math.cos(p);let f=y.Infinite.near;if(h<=p)f=k*u;else{const e=n(z,r.viewUp),t=Math.tan(p),i=s(z,e,t),o=n(z,m(z,c,i)),l=x(r.eye,o,A);if(U.radius=Y,U.intersectRay(l,z)){const e=m(z,z,r.eye);f=a(e)*u}}const M=.99*Math.min(l.near,f);M<y.Infinite.near&&M>R.near&&(R.near=t(R.near,M,F))}return R}computeFarDistance(e,t){const i=a(e),r=i-this._referenceEllipsoid.radius,n=this._computeVirtualAltitude(r,t);return this._computeFarDistance(i,n,t)}_computeFarDistance(e,t,i){const r=this._referenceEllipsoid.radius,a=r+Math.min(0,i),n=M(t),s=Math.sqrt(t*(t+2*a)),o=s+Math.min(.2*s,.01*r);return n<.5?o:1.2*(e+r)}_computeVirtualAltitude(e,t){const i=Math.abs(e-t);return Math.max(i,Math.abs(e))}}function g(e,t,i,r){const a=D/i,n=e/t;return n>a?(r.far=e,r.near=n):(r.near=a,r.far=r.near*t),r}const E=7.983,b=16.994,j=2e4,w=100,D=2,F=.001,P=1e-4,z=l(),I=l(),R={near:0,far:0},U=new f,A=u(),V=new p({xmin:0,ymin:0,zmin:0,xmax:0,ymax:0,zmax:0});export{_ as NearFarHeuristicGlobal,d as createNearFarHeuristic,D as minNearDistanceInMeters};
2
+ import{acosClamped as e,lerp as t,clamp as i}from"../../../core/mathUtils.js";import{getMetersPerUnitForSR as r}from"../../../core/units.js";import{length as a,normalize as n,scale as s,dot as o,subtract as m,set as c}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as l}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as h}from"../../../geometry/ellipsoidUtils.js";import p from"../../../geometry/Extent.js";import{create as u,fromValues as x}from"../../../geometry/support/ray.js";import{Sphere as f}from"../../../geometry/support/sphere.js";import{computeInnerAltitudeFade as M}from"../webgl-engine/effects/atmosphere/atmosphereUtils.js";import{DepthRange as y}from"../webgl-engine/lib/DepthRange.js";function d(e,t,i){return 1===e?new _(t,i):new v(t,i)}class v{constructor(e,t){this._elevationProvider=e,this._referenceEllipsoid=h(t),this._unitInMeters=r(t,this._referenceEllipsoid.metersPerDegree)}compute(e,r,a,s){const{eye:l,center:h}=e,p=this._unitInMeters,u=l[2]*p,x=u-s,f=this._elevationProvider?.visibleElevationRange,M=f?x>=0?u-p*f.minElevation:p*f.maxElevation-u:u,y=r??V,d={x:y.xmax-y.xmin,y:y.ymax-y.ymin,z:4*Math.max(y.xmax-y.xmin,y.ymax-y.ymin)},v=Math.max(d.x,d.y,d.z),_=m(I,h,l),E=c(z,_[0]>0?y.xmax:y.xmin,_[1]>0?y.ymax:y.ymin,_[2]>0?v/2:-v/2);m(E,E,l),n(_,_);const b=1.1*o(E,_)*p,w=Math.abs(x),D=Math.sqrt(w*(w+2*this._referenceEllipsoid.radius)),U=Math.max(y.xmax-y.xmin,y.ymax-y.ymin),A=U*P*p,q=i((M-A)/(U*F*p-A),0,1)**3,H=Math.min(t(D,b,q),D)*Math.max(Math.log(Math.abs(x)),1);return g(Math.min(H,Math.max(34064e4,v))/p,j,p,R)}computeFarDistance(e,t,i){return i}}class _{constructor(e,t){this._elevationProvider=e,this._referenceEllipsoid=h(t)}compute(r,c,l,h){const{eye:p}=r,u=a(p),f=this._referenceEllipsoid.radius,d=u-f,v=this._computeVirtualAltitude(d,h),_=this._elevationProvider?.visibleElevationRange.maxElevation??0,F=M(v),P=this._computeFarDistance(u,v,h),V=(Math.log(v)-E)/(b-E);g(P,i(j-V*(j-w),w,j),1,R);const q=f+_,H=f+this._referenceEllipsoid.atmosphereHeight,Y=Math.max(q,H),k=u-Y;if(F>0&&k>D){const i=n(z,s(z,r.eye,-1)),c=n(I,r.viewForward),h=e(o(i,c)),p=.5*r.fovY,u=Math.cos(p);let f=y.Infinite.near;if(h<=p)f=k*u;else{const e=n(z,r.viewUp),t=Math.tan(p),i=s(z,e,t),o=n(z,m(z,c,i)),l=x(r.eye,o,A);if(U.radius=Y,U.intersectRay(l,z)){const e=m(z,z,r.eye);f=a(e)*u}}const M=.99*Math.min(l.near,f);M<y.Infinite.near&&M>R.near&&(R.near=t(R.near,M,F))}return R}computeFarDistance(e,t){const i=a(e),r=i-this._referenceEllipsoid.radius,n=this._computeVirtualAltitude(r,t);return this._computeFarDistance(i,n,t)}_computeFarDistance(e,t,i){const r=this._referenceEllipsoid.radius,a=r+Math.min(0,i),n=M(t),s=Math.sqrt(t*(t+2*a)),o=s+Math.min(.2*s,.01*r);return n<.5?o:1.2*(e+r)}_computeVirtualAltitude(e,t){const i=Math.abs(e-t);return Math.max(i,Math.abs(e))}}function g(e,t,i,r){const a=D/i,n=e/t;return n>a?(r.far=e,r.near=n):(r.near=a,r.far=r.near*t),r}const E=7.983,b=16.994,j=2e4,w=100,D=2,F=.001,P=1e-4,z=l(),I=l(),R={near:0,far:0},U=new f,A=u(),V=new p({xmin:0,ymin:0,zmin:0,xmax:0,ymax:0,zmax:0});export{_ as NearFarHeuristicGlobal,d as createNearFarHeuristic,D as minNearDistanceInMeters};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{reallocGrowthFactor as e}from"../../../../core/arrayUtils.js";import{signal as t}from"../../../../core/signal.js";import{Milliseconds as r,now as s}from"../../../../core/time.js";import{normalize as i}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{intersectsSphere as n}from"../../../../geometry/support/frustum.js";import{Sphere as o}from"../../../../geometry/support/sphere.js";import{makeScheduleFunction as u}from"../../layers/support/makeScheduleFunction.js";import{GaussianSplatSortWorkerHandle as h}from"../GaussianSplatWorkerHandle.js";import{GaussianSplatFadeTexture as d}from"./GaussianSplatFadeTexture.js";import{GaussianSplatOrderTexture as l}from"./GaussianSplatOrderTexture.js";import{GaussianSplatTextureAtlas as _}from"./GaussianSplatTextureAtlas.js";import{TaskPriority as c}from"../../../support/Scheduler.js";class f{constructor(e){this._updating=t(!1),this._useDeterministicSort=!1,this.visibleGaussians=0,this._visibleGaussianTiles=new Array,this._bufferCapacity=0,this._minimumBoundingSphere=new o,this._cameraDirectionNormalized=a(),this._frameTask=null,this._workerHandle=null,this._isSorting=!1,this._pendingSortTask=!1,this._scheduledSortStartTimeout=null,this._lastSortStartTime=r(-1/0),this._sortInterval=r(80),this._renderer=e,this._orderTexture=new l(this._renderer.renderingContext),this._fadingTexture=new d(this._renderer.renderingContext),this._textureAtlas=new _(this._renderer.renderingContext,this._renderer.view.resourceController.memoryController,this._renderer.fboCache);const{resourceController:s}=this._renderer.view;this._workerHandle=new h(u(s)),this._frameTask=s.scheduler.registerTask(c.GAUSSIAN_SPLAT_SORTING)}get textureAtlas(){return this._textureAtlas}get orderTexture(){return this._orderTexture}get fadingTexture(){return this._fadingTexture}get visibleGaussianTiles(){return this._visibleGaussianTiles}forEachTile(e){for(const t of this._visibleGaussianTiles)e(t)}updateGaussianVisibility(e){this._visibleGaussianTiles=e,this.requestSort()}get updating(){return this._updating.value}destroy(){this._pendingSortTask=!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 e=s()-this._lastSortStartTime,t=this._sortInterval-e;t<=0?this._startSortIfRequired():null==this._scheduledSortStartTimeout&&(this._scheduledSortStartTimeout=setTimeout(()=>{this._scheduledSortStartTimeout=null,this._pendingSortTask&&!this._isSorting&&this._scheduleSortStart()},t))}_startSortIfRequired(){!this._isSorting&&this._pendingSortTask&&(this._isSorting=!0,this._pendingSortTask=!1,this._lastSortStartTime=s(),this._sortOnWorker().finally(()=>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(t,r){let s=Math.max(1,t);for(;s<r;)s=Math.ceil(s*e);return s}_ensureSortBufferCapacities(e){if(this._bufferCapacity<e){const t=this._computeExpandedCapacity(this._bufferCapacity,e);this._atlasIndicesBuffer=new Uint32Array(t),this._distancesBuffer=new Float64Array(t),this._sortOrderBuffer=new Uint32Array(t),this._bufferCapacity=t}}_ensureSortedAtlasIndicesBufferCapacity(e){if(!(e<=0)&&(!this._sortedAtlasIndicesBuffer||this._sortedAtlasIndicesBuffer.length<e)){const t=this._sortedAtlasIndicesBuffer?.length??0,r=this._computeExpandedCapacity(t,e);this._sortedAtlasIndicesBuffer=new Uint32Array(r)}}_clearAllBuffersAndTextures(){this._clearBuffersAndTextures(),this._workerHandle?.clear()}async _sortOnWorker(){if(0===this._visibleGaussianTiles.length)return this.visibleGaussians=0,this._clearAllBuffersAndTextures(),void this._renderer.requestRender(1);this._useDeterministicSort&&this._visibleGaussianTiles.sort((e,t)=>e.obb.centerX-t.obb.centerX||e.obb.centerY-t.obb.centerY||e.obb.centerZ-t.obb.centerZ);const e=this._visibleGaussianTiles,t=e.length;let r=0;for(let i=0;i<t;i++)r+=e[i].gaussianAtlasIndices.length;this._ensureSortBufferCapacities(r),this._textureAtlas.ensureTextureAtlas();const{frustum:s}=this._renderer.camera;i(this._cameraDirectionNormalized,this._renderer.camera.ray.direction);const a=this._cameraDirectionNormalized[0],o=this._cameraDirectionNormalized[1],u=this._cameraDirectionNormalized[2];let h=0;const d=1.5,l=this._atlasIndicesBuffer,_=this._distancesBuffer,c=this._sortOrderBuffer,f=this._minimumBoundingSphere,m=f.center;for(let i=0;i<t;i++){const t=e[i],{gaussianAtlasIndices:r,relativePositions:c,obb:S,maxScale:p}=t,T=r.length,{centerX:g,centerY:x,centerZ:b}=S;if(m[0]=g,m[1]=x,m[2]=b,f.radius=(S.radius+p)*d,!n(s,f))continue;l.set(r,h);const A=a*g+o*x+u*b,B=h+T;for(let e=h,s=0;e<B;e++,s+=3){const t=c[s],r=c[s+1],i=c[s+2];_[e]=t*a+r*o+i*u+A}h=B}for(let i=0;i<h;i++)c[i]=i;if(0===h)return this.visibleGaussians=0,this._clearAllBuffersAndTextures(),void this._renderer.requestRender(1);const S={distances:this._distancesBuffer,sortOrderIndices:this._sortOrderBuffer,numGaussians:h,preciseSort:this._useDeterministicSort},p=await(this._workerHandle?.sort(S));p&&(this._distancesBuffer=p.distances,this._sortOrderBuffer=p.sortedOrderIndices);const T=async e=>{const{paddedSize:t}=this._orderTexture.ensureCapacity(h);this._ensureSortedAtlasIndicesBufferCapacity(t);const r=this._atlasIndicesBuffer,s=this._sortOrderBuffer,i=this._sortedAtlasIndicesBuffer;for(let a=0;a<h;a++)i[a]=r[s[a]];this._orderTexture.setData(i,h),this.visibleGaussians=h,this._renderer.requestRender(1),e.madeProgress()};await this._frameTask.schedule(T)}set useDeterministicSort(e){this._useDeterministicSort=e}}export{f as GaussianSplatDataStore};
2
+ import{reallocGrowthFactor as e}from"../../../../core/arrayUtils.js";import{signal as t}from"../../../../core/signal.js";import{Milliseconds as r,now as s}from"../../../../core/time.js";import{normalize as i}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 n}from"../../../../geometry/support/aaBoundingBox.js";import{intersectsSphere as o}from"../../../../geometry/support/frustum.js";import{Sphere as u}from"../../../../geometry/support/sphere.js";import{makeScheduleFunction as h}from"../../layers/support/makeScheduleFunction.js";import{GaussianSplatSortWorkerHandle as d}from"../GaussianSplatWorkerHandle.js";import{GaussianSplatFadeTexture as l}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(e){this._updating=t(!1),this._useDeterministicSort=!1,this.visibleGaussians=0,this._visibleGaussianTiles=new Array,this._bufferCapacity=0,this._minimumBoundingSphere=new u,this._cameraDirectionNormalized=a(),this._frameTask=null,this._workerHandle=null,this._isSorting=!1,this._pendingSortTask=!1,this._scheduledSortStartTimeout=null,this._lastSortStartTime=r(-1/0),this._sortInterval=r(80),this._renderer=e,this._orderTexture=new _(this._renderer.renderingContext),this._fadingTexture=new l(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}get visibleGaussianTiles(){return this._visibleGaussianTiles}forEachTile(e){for(const t of this._visibleGaussianTiles)e(t)}updateGaussianVisibility(e){this._visibleGaussianTiles=e,this.requestSort()}get updating(){return this._updating.value}destroy(){this._pendingSortTask=!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 e=s()-this._lastSortStartTime,t=this._sortInterval-e;t<=0?this._startSortIfRequired():null==this._scheduledSortStartTimeout&&(this._scheduledSortStartTimeout=setTimeout(()=>{this._scheduledSortStartTimeout=null,this._pendingSortTask&&!this._isSorting&&this._scheduleSortStart()},t))}_startSortIfRequired(){!this._isSorting&&this._pendingSortTask&&(this._isSorting=!0,this._pendingSortTask=!1,this._lastSortStartTime=s(),this._sortOnWorker().finally(()=>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(t,r){let s=Math.max(1,t);for(;s<r;)s=Math.ceil(s*e);return s}_ensureSortBufferCapacities(e){if(this._bufferCapacity<e){const t=this._computeExpandedCapacity(this._bufferCapacity,e);this._atlasIndicesBuffer=new Uint32Array(t),this._distancesBuffer=new Float64Array(t),this._sortOrderBuffer=new Uint32Array(t),this._bufferCapacity=t}}_ensureSortedAtlasIndicesBufferCapacity(e){if(!(e<=0)&&(!this._sortedAtlasIndicesBuffer||this._sortedAtlasIndicesBuffer.length<e)){const t=this._sortedAtlasIndicesBuffer?.length??0,r=this._computeExpandedCapacity(t,e);this._sortedAtlasIndicesBuffer=new Uint32Array(r)}}_clearAllBuffersAndTextures(){this._clearBuffersAndTextures(),this._workerHandle?.clear()}async _sortOnWorker(){if(0===this._visibleGaussianTiles.length)return this.visibleGaussians=0,this._clearAllBuffersAndTextures(),void this._renderer.requestRender(1);this._useDeterministicSort&&this._visibleGaussianTiles.sort((e,t)=>e.obb.centerX-t.obb.centerX||e.obb.centerY-t.obb.centerY||e.obb.centerZ-t.obb.centerZ);const e=this._visibleGaussianTiles,t=e.length;let r=0;for(let i=0;i<t;i++)r+=e[i].gaussianAtlasIndices.length;this._ensureSortBufferCapacities(r),this._textureAtlas.ensureTextureAtlas();const{frustum:s}=this._renderer.camera;i(this._cameraDirectionNormalized,this._renderer.camera.ray.direction);const a=this._cameraDirectionNormalized[0],u=this._cameraDirectionNormalized[1],h=this._cameraDirectionNormalized[2];let d=0;const l=1.5,_=this._atlasIndicesBuffer,c=this._distancesBuffer,f=this._sortOrderBuffer,m=this._minimumBoundingSphere,S=m.center,p=this._renderer.clippingBox;for(let i=0;i<t;i++){const t=e[i],{gaussianAtlasIndices:r,relativePositions:f,obb:T,maxScale:g}=t,x=r.length;if(null!=p&&null!=t.boundingBox&&!n(t.boundingBox,p))continue;const{centerX:b,centerY:B,centerZ:A}=T;if(S[0]=b,S[1]=B,S[2]=A,m.radius=(T.radius+g)*l,!o(s,m))continue;_.set(r,d);const y=a*b+u*B+h*A,v=d+x;for(let e=d,s=0;e<v;e++,s+=3){const t=f[s],r=f[s+1],i=f[s+2];c[e]=t*a+r*u+i*h+y}d=v}for(let i=0;i<d;i++)f[i]=i;if(0===d)return this.visibleGaussians=0,this._clearAllBuffersAndTextures(),void this._renderer.requestRender(1);const T={distances:this._distancesBuffer,sortOrderIndices:this._sortOrderBuffer,numGaussians:d,preciseSort:this._useDeterministicSort},g=await(this._workerHandle?.sort(T));g&&(this._distancesBuffer=g.distances,this._sortOrderBuffer=g.sortedOrderIndices);const x=async e=>{const{paddedSize:t}=this._orderTexture.ensureCapacity(d);this._ensureSortedAtlasIndicesBufferCapacity(t);const r=this._atlasIndicesBuffer,s=this._sortOrderBuffer,i=this._sortedAtlasIndicesBuffer;for(let a=0;a<d;a++)i[a]=r[s[a]];this._orderTexture.setData(i,d),this.visibleGaussians=d,this._renderer.requestRender(1),e.madeProgress()};await this._frameTask.schedule(x)}set useDeterministicSort(e){this._useDeterministicSort=e}}export{m as GaussianSplatDataStore};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{subtract as t,length as e,scale as i,negate as n,dot as s,set as o}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as r,fromValues as l}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{set as a}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{create as c}from"../../../../geometry/support/plane.js";import{fromPoints as u}from"../../../../geometry/support/ray.js";import{GaussianSplatTarget as m}from"../../layers/i3s/Intersector.js";import{ElevationRange as d}from"../ElevationRange.js";import{IntersectorResult as p}from"../../webgl-engine/lib/IntersectorResult.js";class f{constructor(t){this.layerView=t,this.type=0,this.slicePlaneEnabled=!1,this.isGround=!1,this.intersectionNormal=r(),this.intersectionRayDir=r(),this.intersectionPlane=c(),this.layerViewUid=t.uid}intersect(r,c,d,f){const{intersectionRayDir:w,intersectionPlane:y,layerViewUid:b,intersectionNormal:V}=this,v=u(d,f);t(w,f,d);const R=1/e(w);i(w,w,R),n(V,w),a(y,w[0],w[1],w[2],-s(w,d));const j=new g,x=new g,E=r.options.store,P=2===E,I=0!==E,U=P?new Array:null,D=(t,e,i,n,s)=>(t.point=t.point?o(t.point,i,n,s):l(i,n,s),t.dist=e,t.normal=V,t.layerViewUid=b,t),A=d[0],N=d[1],S=d[2],T=w[0],q=w[1],G=w[2];this.layerView.data.forEachTile(t=>{const e=t.obb.minimumDistancePlane(y),i=t.obb.maximumDistancePlane(y),n=i<0,s=null!=j.dist&&null!=x.dist&&j.dist<e*R&&x.dist>i*R;if(n||s)return;if(!t.boundingVolumeIntersectsRay(d,w))return;const{relativePositions:o,squaredScales:r,gaussianAtlasIndices:l,obb:a}=t,u=a.centerX,m=a.centerY,p=a.centerZ,h=A-u,b=N-m,V=S-p,v=l.length;for(let w=0,y=0;w<v;w++,y+=3){const t=o[y]-h,e=o[y+1]-b,i=o[y+2]-V,n=t*T+e*q+i*G;if(n<0)continue;if(t*t+e*e+i*i-n*n>r[w])continue;const s=n*R;if(!(!c||c(d,f,s)))continue;const l=o[y]+u,a=o[y+1]+m,v=o[y+2]+p;if((null==j.dist||s<j.dist)&&D(j,s,l,a,v),I&&(null==x.dist||s>x.dist)&&D(x,s,l,a,v),P){const t=new g;U.push(D(t,s,l,a,v))}}});const X=(t,e)=>{const{layerViewUid:i}=e,n=new m(e.point,i);t.set(0,n,e.dist,e.normal)};if(h(j)){const t=r.results.min;(null==t.distance||j.dist<t.distance)&&X(t,j)}if(h(x)&&0!==r.options.store){const t=r.results.max;(null==t.distance||x.dist>t.distance)&&X(t,x)}if(P&&U?.length)for(const t of U){const e=new p(v);X(e,t),r.results.all.push(e)}}getElevationRange(t){let e=null;return this.layerView.data.forEachTile(i=>{e?.contains(i.elevationRange)||i.boundingVolumeIntersectsSphere(t)&&(e||(e=new d),e.expandElevationRange(i.elevationRange))}),e||(e=new d(0,0)),e}}function h(t){return null!=t.dist&&null!=t.point}class g{constructor(){this.point=null,this.dist=null,this.normal=null,this.layerViewUid=""}}export{f as GaussianSplatIntersectionHandler};
2
+ import{subtract as t,length as i,scale as n,negate as e,dot as s,set as o}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as r,fromValues as l}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{set as a}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{intersects as c,contains as u}from"../../../../geometry/support/aaBoundingBox.js";import{create as d}from"../../../../geometry/support/plane.js";import{fromPoints as m}from"../../../../geometry/support/ray.js";import{GaussianSplatTarget as f}from"../../layers/i3s/Intersector.js";import{ElevationRange as p}from"../ElevationRange.js";import{IntersectorResult as h}from"../../webgl-engine/lib/IntersectorResult.js";class g{constructor(t){this.layerView=t,this.type=0,this.slicePlaneEnabled=!1,this.isGround=!1,this.intersectionNormal=r(),this.intersectionRayDir=r(),this.intersectionPlane=d(),this.layerViewUid=t.uid}intersect(r,d,p,g){const{intersectionRayDir:b,intersectionPlane:V,layerViewUid:x,intersectionNormal:j}=this,v=m(p,g);t(b,g,p);const R=1/i(b);n(b,b,R),e(j,b),a(V,b[0],b[1],b[2],-s(b,p));const E=new y,P=new y,I=r.options.store,U=2===I,B=0!==I,D=U?new Array:null,A=(t,i,n,e,s)=>(t.point=t.point?o(t.point,n,e,s):l(n,e,s),t.dist=i,t.normal=j,t.layerViewUid=x,t),N=p[0],S=p[1],T=p[2],q=b[0],G=b[1],X=b[2],Y=this.layerView.clippingBox;this.layerView.data.forEachTile(t=>{let i=!1;if(null!=Y){const n=t.boundingBox;if(null==n)return;if(!c(n,Y))return;i=!u(Y,n)}const n=t.obb.minimumDistancePlane(V),e=t.obb.maximumDistancePlane(V),s=e<0,o=!B&&null!=E.dist&&E.dist<n*R,r=null!=E.dist&&null!=P.dist&&E.dist<n*R&&P.dist>e*R;if(s||o||r)return;if(!t.boundingVolumeIntersectsRay(p,b))return;const{relativePositions:l,squaredScales:a,gaussianAtlasIndices:m,obb:f}=t,h=f.centerX,w=f.centerY,x=f.centerZ,j=N-h,v=S-w,I=T-x,Z=m.length;if(i)for(let c=0,u=0;c<Z;c++,u+=3){const t=l[u]+h,i=l[u+1]+w,n=l[u+2]+x;if(t<Y[0]||i<Y[1]||n<Y[2]||t>Y[3]||i>Y[4]||n>Y[5])continue;const e=t-N,s=i-S,o=n-T,r=e*q+s*G+o*X;if(r<0)continue;if(e*e+s*s+o*o-r*r>a[c])continue;const m=r*R;if((!d||d(p,g,m))&&((null==E.dist||m<E.dist)&&A(E,m,t,i,n),B&&(null==P.dist||m>P.dist)&&A(P,m,t,i,n),U)){const e=new y;D.push(A(e,m,t,i,n))}}else for(let c=0,u=0;c<Z;c++,u+=3){const t=l[u]-j,i=l[u+1]-v,n=l[u+2]-I,e=t*q+i*G+n*X;if(e<0)continue;if(t*t+i*i+n*n-e*e>a[c])continue;const s=e*R;if(!(!d||d(p,g,s)))continue;const o=t+N,r=i+S,m=n+T;if((null==E.dist||s<E.dist)&&A(E,s,o,r,m),B&&(null==P.dist||s>P.dist)&&A(P,s,o,r,m),U){const t=new y;D.push(A(t,s,o,r,m))}}});const Z=(t,i)=>{const{layerViewUid:n}=i,e=new f(i.point,n);t.set(0,e,i.dist,i.normal)};if(w(E)){const t=r.results.min;(null==t.distance||E.dist<t.distance)&&Z(t,E)}if(w(P)&&0!==r.options.store){const t=r.results.max;(null==t.distance||P.dist>t.distance)&&Z(t,P)}if(U&&D?.length)for(const t of D){const i=new h(v);Z(i,t),r.results.all.push(i)}}getElevationRange(t){let i=null;return this.layerView.data.forEachTile(n=>{i?.contains(n.elevationRange)||n.boundingVolumeIntersectsSphere(t)&&(i||(i=new p),i.expandElevationRange(n.elevationRange))}),i||(i=new p(0,0)),i}}function w(t){return null!=t.dist&&null!=t.point}class y{constructor(){this.point=null,this.dist=null,this.normal=null,this.layerViewUid=""}}export{g as GaussianSplatIntersectionHandler};
@@ -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{splatPageSizeInU32 as e}from"./GaussianSplatAtlasPages.js";class i{constructor(i,r,o,n,a,b,h,u){this.handle=i,this.obb=r,this.gaussianAtlasIndices=o,this.pageIds=n,this.relativePositions=a,this.squaredScales=b,this.maxScale=h,this.elevationRange=u,this.isVisible=!1,this.fadeDirection=0,this.opacityModifier=0,this.usedMemory=t(this.gaussianAtlasIndices,this.relativePositions,this.squaredScales)+this.pageIds.length*e*4;const c=s();r?.getCenter(c),this._obbCenterX=c[0],this._obbCenterY=c[1],this._obbCenterZ=c[2];const d=r?.radius??-1;this._obbRadius=d;const l=d<0?-1:d*d;this._obbRadiusSquared=l;const f=r?.halfSize;this._obbShortestHalfsize=f?Math.min(f[0],f[1],f[2]):0}boundingVolumeIntersectsRay(t,s){if(!this.obb)return!0;const{_obbCenterX:e,_obbCenterY:i,_obbCenterZ:r}=this,o=e-t[0],n=i-t[1],a=r-t[2],b=o*s[0]+n*s[1]+a*s[2],h=o*o+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,r=s+i,o=this._obbCenterX-e[0];if(o>r)return!1;const n=this._obbCenterY-e[1];if(n>r)return!1;const a=this._obbCenterZ-e[2];if(a>r)return!1;const b=o*o+n*n+a*a;if(b>r*r)return!1;if(b<=(this._obbShortestHalfsize+i)**2)return!0;return Math.sqrt(b)+s<=i||(this.obb?.intersectSphere(t)??!0)}}export{i 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 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};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import"./ComponentData.glsl.js";import"../../../core/shaderLibrary/ForwardLinearDepthToWriteShadowMap.glsl.js";import"../../../core/shaderLibrary/ShaderOutput.js";import"../../../core/shaderLibrary/Slice.glsl.js";import"../../../core/shaderLibrary/attributes/TextureCoordinateAttribute.glsl.js";import"../../../core/shaderLibrary/attributes/VertexColor.glsl.js";import"../../../core/shaderLibrary/attributes/VertexNormal.glsl.js";import"../../../core/shaderLibrary/attributes/VertexPosition.glsl.js";import"../../../core/shaderLibrary/output/OutputDepth.glsl.js";import"../../../core/shaderLibrary/output/OutputHighlight.glsl.js";import"../../../core/shaderLibrary/output/OutputHighlightOverlay.js";import"../../../core/shaderLibrary/output/ReadDepth.glsl.js";import"../../../core/shaderLibrary/shading/ComputeFragmentNormals.glsl.js";import"../../../core/shaderLibrary/shading/ComputeMaterialColor.glsl.js";import"../../../core/shaderLibrary/shading/ComputeNormalTexture.glsl.js";import"../../../core/shaderLibrary/shading/EvaluateSceneLighting.glsl.js";import"../../../core/shaderLibrary/shading/MainLighting.glsl.js";import"../../../core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js";import"../../../core/shaderLibrary/shading/PiUtils.glsl.js";import"../../../core/shaderLibrary/shading/ReadBaseColorTexture.glsl.js";import"../../../core/shaderLibrary/shading/ReadShadowMap.glsl.js";import"../../../core/shaderLibrary/shading/TerrainDepthTest.glsl.js";import"../../../core/shaderLibrary/terrain/Overlay.glsl.js";import"../../../core/shaderLibrary/util/DiscardOrAdjustAlpha.glsl.js";import"../../../core/shaderModules/BooleanDrawUniform.js";import"../../../core/shaderModules/glsl.js";import"../../../core/shaderModules/Texture2DBindUniform.js";import"../../../effects/weather/SnowCover.glsl.js";import"../../../shaders/OutputColorHighlightOLID.glsl.js";import"../../../shaders/SphereDepthInterpolate.glsl.js";import"../../../../../webgl/ShaderBuilder.js";import"../../../../../../webscene/support/AlphaCutoff.js";export{b as build}from"../../../../../../chunks/ComponentShader.glsl.js";
2
+ import"./ComponentData.glsl.js";import"../../../core/shaderLibrary/ForwardLinearDepthToWriteShadowMap.glsl.js";import"../../../core/shaderLibrary/ShaderOutput.js";import"../../../core/shaderLibrary/Slice.glsl.js";import"../../../core/shaderLibrary/attributes/TextureCoordinateAttribute.glsl.js";import"../../../core/shaderLibrary/attributes/VertexColor.glsl.js";import"../../../core/shaderLibrary/attributes/VertexNormal.glsl.js";import"../../../core/shaderLibrary/attributes/VertexPosition.glsl.js";import"../../../core/shaderLibrary/output/OutputDepth.glsl.js";import"../../../core/shaderLibrary/output/OutputHighlight.glsl.js";import"../../../core/shaderLibrary/output/OutputHighlightOverlay.js";import"../../../core/shaderLibrary/output/ReadDepth.glsl.js";import"../../../core/shaderLibrary/shading/ComputeFragmentNormals.glsl.js";import"../../../core/shaderLibrary/shading/ComputeMaterialColor.glsl.js";import"../../../core/shaderLibrary/shading/ComputeNormalTexture.glsl.js";import"../../../core/shaderLibrary/shading/EvaluateSceneLighting.glsl.js";import"../../../core/shaderLibrary/shading/MainLighting.glsl.js";import"../../../core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js";import"../../../core/shaderLibrary/shading/PiUtils.glsl.js";import"../../../core/shaderLibrary/shading/ReadBaseColorTexture.glsl.js";import"../../../core/shaderLibrary/shading/ReadShadowMap.glsl.js";import"../../../core/shaderLibrary/shading/TerrainDepthTest.glsl.js";import"../../../core/shaderLibrary/terrain/Overlay.glsl.js";import"../../../core/shaderLibrary/util/DiscardOrAdjustAlpha.glsl.js";import"../../../core/shaderModules/BooleanDrawUniform.js";import"../../../core/shaderModules/glsl.js";import"../../../core/shaderModules/Texture2DBindUniform.js";import"../../../effects/snowcover/SnowCover.glsl.js";import"../../../shaders/OutputColorHighlightOLID.glsl.js";import"../../../shaders/SphereDepthInterpolate.glsl.js";import"../../../../../webgl/ShaderBuilder.js";import"../../../../../../webscene/support/AlphaCutoff.js";export{b as build}from"../../../../../../chunks/ComponentShader.glsl.js";
@@ -1,5 +1,5 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{clamp as e}from"../../../core/mathUtils.js";import{create as t}from"../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{squaredLength as r}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{earth as s}from"../../../geometry/support/Ellipsoid.js";import{Float2PassUniform as a}from"../webgl-engine/core/shaderModules/Float2PassUniform.js";import{Float3BindUniform as i}from"../webgl-engine/core/shaderModules/Float3BindUniform.js";import{FloatsPassUniform as o}from"../webgl-engine/core/shaderModules/FloatsPassUniform.js";import{glsl as n}from"../webgl-engine/core/shaderModules/glsl.js";import{SphereIntersect as c}from"../webgl-engine/shaders/SphereIntersect.glsl.js";import{NoParameters as h}from"../../webgl/NoParameters.js";class l extends h{constructor(){super(...arguments),this.radii=t()}}function m(e){e.code.add(n`float chapmanApproximation(float thickness, float height, float cosZenith) {
2
+ import{clamp as e}from"../../../../../core/mathUtils.js";import{create as t}from"../../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{squaredLength as r}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{earth as s}from"../../../../../geometry/support/Ellipsoid.js";import{Float2PassUniform as a}from"../../core/shaderModules/Float2PassUniform.js";import{Float3BindUniform as o}from"../../core/shaderModules/Float3BindUniform.js";import{FloatsPassUniform as i}from"../../core/shaderModules/FloatsPassUniform.js";import{glsl as n}from"../../core/shaderModules/glsl.js";import{SphereIntersect as c}from"../../shaders/SphereIntersect.glsl.js";import{NoParameters as h}from"../../../../webgl/NoParameters.js";class l extends h{constructor(){super(...arguments),this.radii=t()}}function m(e){e.code.add(n`float chapmanApproximation(float thickness, float height, float cosZenith) {
3
3
  float c = sqrt(thickness + height);
4
4
  float cExpH = c * exp(-height);
5
5
  if (cosZenith >= 0.0) {
@@ -11,7 +11,7 @@ return 2.0 * c0 * exp(thickness - x0) - cExpH / (1.0 - c * cosZenith);
11
11
  }
12
12
  }`),e.constants.add("scaleHeight","float",s.scaleHeight*s.atmosphereHeight).uniforms.add(new a("radii",e=>e.radii)).code.add(n`float getOpticalDepth(vec3 position, vec3 dir, float h) {
13
13
  return scaleHeight * chapmanApproximation(radii[0] / scaleHeight, h, dot(normalize(position), dir));
14
- }`),e.include(c),e.constants.add("planetRadiusReduction","float",p).uniforms.add(new o("heightParameters",5,(e,t)=>d(t,e)),new i("cameraPosition",e=>e.camera.eye)).code.add(n`vec4 planetIntersect(vec3 rayDir) {
14
+ }`),e.include(c),e.constants.add("planetRadiusReduction","float",p).uniforms.add(new i("heightParameters",5,(e,t)=>d(t,e)),new o("cameraPosition",e=>e.camera.eye)).code.add(n`vec4 planetIntersect(vec3 rayDir) {
15
15
  float rayPlanetDistanceReduced = heightParameters[4];
16
16
  vec2 rayPlanetIntersect = sphereIntersect(cameraPosition, rayDir, rayPlanetDistanceReduced);
17
17
  vec2 rayAtmosphereIntersect = sphereIntersect(cameraPosition, rayDir, heightParameters[1]);
@@ -30,4 +30,4 @@ start = rayPlanetIntersect.y;
30
30
  }
31
31
  float end = hitsPlanet ? rayPlanetIntersect.x : rayAtmosphereIntersect.y;
32
32
  return vec4(0.0, hitsPlanet ? 1.0 : 0.0, start, end);
33
- }`)}function d({camera:t},{radii:a}){const i=r(t.eye),o=Math.sqrt(i);return f[0]=o,f[1]=i-a[1]**2,f[2]=e((o-a[0])/s.atmosphereHeight,0,1),f[3]=i-a[0]**2,f[4]=i-(a[0]-p)**2,f}const p=2e4,f=new Array;export{m as ChapmanApproximation,l as ChapmanApproximationPassParameters,d as getHeightParameters};
33
+ }`)}function d({camera:t},{radii:a}){const o=r(t.eye),i=Math.sqrt(o);return f[0]=i,f[1]=o-a[1]**2,f[2]=e((i-a[0])/s.atmosphereHeight,0,1),f[3]=o-a[0]**2,f[4]=o-(a[0]-p)**2,f}const p=2e4,f=new Array;export{m as ChapmanApproximation,l as ChapmanApproximationPassParameters,d as getHeightParameters};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
+ import"../../core/shaderLibrary/shading/Gamma.glsl.js";import"../../core/shaderLibrary/shading/MainLighting.glsl.js";import"../../core/shaderModules/Float2PassUniform.js";import"../../core/shaderModules/Float3BindUniform.js";import"../../core/shaderModules/Float3PassUniform.js";import"../../core/shaderModules/Float4PassUniform.js";import"../../core/shaderModules/FloatPassUniform.js";import"../../core/shaderModules/FloatsPassUniform.js";import"../../core/shaderModules/glsl.js";import"../../core/shaderModules/Texture2DBindUniform.js";import"./ChapmanApproximation.glsl.js";import"./ChapmanRaymarching.glsl.js";import"../../shaders/ScreenSpacePassAtmosphere.glsl.js";import"../../shaders/SphereIntersect.glsl.js";import"../../shaders/ToneMapping.glsl.js";import"../../../../webgl/ShaderBuilder.js";export{b as build}from"../../../../../chunks/ChapmanAtmosphere.glsl.js";
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
+ import{__decorate as e}from"tslib";import{lerp as t}from"../../../../../core/mathUtils.js";import{disposeMaybe as r}from"../../../../../core/maybe.js";import{watch as s,syncAndInitial as i,initial as o}from"../../../../../core/reactiveUtils.js";import{subclass as a}from"../../../../../core/accessorSupport/decorators.js";import{set as n}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{set as m,length as h}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{ZEROS as c}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{earth as p}from"../../../../../geometry/support/Ellipsoid.js";import{InternalRenderCategory as d}from"../../../webgl.js";import{OpaqueEnvironment as u}from"../OpaqueEnvironment.js";import{computeInnerAltitudeFade as f,innerAtmosphereDepth as l}from"./atmosphereUtils.js";import{ChapmanAtmospherePassParameters as g,ChapmanAtmosphereTechnique as b}from"./ChapmanAtmosphereTechnique.js";import{ChapmanAtmosphereTechniqueConfiguration as _}from"./ChapmanAtmosphereTechniqueConfiguration.js";import{createQuadVAO as w}from"../../lib/glUtil3D.js";import{applyTextureResizeModulo as P}from"../../lib/textureUtils.js";import{A as j}from"../../../../../chunks/AtmosphereCompositing.glsl.js";import{AtmosphereCompositingTechnique as v}from"../../shaders/AtmosphereCompositingTechnique.js";import{DepthStencilAttachment as A,ColorAttachment0 as q,PrimitiveType as x}from"../../../../webgl/enums.js";import C from"../../../../../webscene/background/ColorBackground.js";let T=class extends u{constructor(){super(...arguments),this._compositingPassParameters=new j,this._vao=null,this._passParameters=new g,this._configuration=new _}initialize(){this.addHandles([s(()=>this.view.environment.background,e=>{const t=e instanceof C?e.color.toUnitRGBA():c;m(this._passParameters.backgroundColor,t[0]*t[3],t[1]*t[3],t[2]*t[3])},i),s(()=>this.view.stage?.renderer?.highResolutionAtmosphere,e=>this._configuration.reduced=!e,i),s(()=>this.view.map.ground.undergroundColor,e=>{this._passParameters.undergroundColor=e?.toUnitRGBA()??c,this.requestRender(1)},o),s(()=>this.view.environment.atmosphereEnabled,e=>e?this._enable():this._disable(),i)])}destroy(){this._vao=r(this._vao)}precompile(){this.techniques.precompile(b,this._configuration),this.techniques.precompile(v)}render(e){const r=e.find(({name:e})=>e===d.OPAQUE_ENVIRONMENT);if(!this.bindParameters.mainDepth)return r;const s=this.renderingContext;this._vao??=w(s,1);const i=r.getAttachment(A);this._update();const o=this.techniques.getCompiled(b,this._configuration);if(!o)return this.requestRender(1),r;if(!this._configuration.reduced)return r.detachDepth(),s.bindFramebuffer(r.fbo),s.bindTechnique(o,this.bindParameters,this._passParameters),s.setDrawBuffers([q]),s.bindVAO(this._vao),s.drawArrays(x.TRIANGLE_STRIP,0,4),r.attachDepth(i),r;const a=this.techniques.get(v);if(!a.compiled)return this.requestRender(1),r;const n=s.getViewport(),m=this.bindParameters.camera,c=h(m.eye)-p.radius;let u;const f=p.atmosphereHeight;if(c<f){const e=Math.min(1,Math.max(0,c/f));u=t(.2,.3,e)}else{const e=Math.min(1,Math.max(0,(c-f)/(15*f)));u=t(.3,.6,e)}const l=this.renderingContext.parameters.maxTextureSize,g=P(Math.round(u*m.fullViewport[2]),l),_=P(Math.round(u*m.fullViewport[3]),l);s.setViewport(0,0,g,_);const j=this.fboCache.acquire(g,_,"chapman",5);return s.bindFramebuffer(j.fbo),s.clearFramebuffer([0,0,0,1],!0,!0),s.bindTechnique(o,this.bindParameters,this._passParameters),s.bindVAO(this._vao),s.drawArrays(x.TRIANGLE_STRIP,0,4),s.setViewport(n.x,n.y,n.width,n.height),this._compositingPassParameters.color=j.getTexture(),r.detachDepth(),s.bindFramebuffer(r.fbo),s.bindTechnique(a,this.bindParameters,this._compositingPassParameters),s.setDrawBuffers([q]),s.screen.draw(),r.attachDepth(i),j.release(),r}_update(){const e=this.view.basemapTerrain?.getLowerBoundRadius()??0;n(this._passParameters.radii,e,e+p.atmosphereHeight);const t=h(this.bindParameters.camera.eye);this._passParameters.altitudeFade=f(t-e),this._passParameters.innerFadeDistance=2*Math.sqrt((2*e-l)*l)}};T=e([a("esri.views.3d.webgl-engine.effects.atmosphere.ChapmanAtmosphere")],T);export{T as ChapmanAtmosphere};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
+ import{__decorate as e}from"tslib";import{subclass as r}from"../../../../../core/accessorSupport/decorators.js";import{create as o}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as s}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{ReloadableShader as t}from"../../core/shaderTechnique/ReloadableShader.js";import{ShaderTechnique as i}from"../../core/shaderTechnique/ShaderTechnique.js";import{ChapmanApproximationPassParameters as a}from"./ChapmanApproximation.glsl.js";import{C as m}from"../../../../../chunks/ChapmanAtmosphere.glsl.js";import{Pos2TexF16 as c}from"../../lib/DefaultVertexBufferLayouts.js";import{makePipelineState as n,defaultColorWrite as p,copySource as l,simpleBlendingParams as h}from"../../../../webgl/renderState.js";class d extends a{constructor(){super(...arguments),this.innerFadeDistance=0,this.altitudeFade=0,this.backgroundColor=o(),this.undergroundColor=s()}}let u=class extends i{constructor(e,r){super(e,r,c),this.shader=new t(m,()=>import("./ChapmanAtmosphere.glsl.js"))}initializePipeline(e){return n({blending:e.reduced?l:h(770,771),depthTest:{func:e.reduced?519:515},colorWrite:p})}};u=e([r("esri.views.3d.webgl-engine.effects.atmosphere.ChapmanAtmosphereTechnique")],u);export{d as ChapmanAtmospherePassParameters,u as ChapmanAtmosphereTechnique};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
+ import{__decorate as e}from"tslib";import{parameter as r,ShaderTechniqueConfiguration as o}from"../../core/shaderTechnique/ShaderTechniqueConfiguration.js";class t extends o{constructor(){super(...arguments),this.reduced=!1}}e([r()],t.prototype,"reduced",void 0);export{t as ChapmanAtmosphereTechniqueConfiguration};
@@ -1,11 +1,11 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{betaRayleigh as e,betaCombined as t,betaMie as a}from"./atmosphereUtils.js";import{ChapmanApproximation as i}from"./ChapmanApproximation.glsl.js";import{Float3BindUniform as l}from"../webgl-engine/core/shaderModules/Float3BindUniform.js";import{If as r,glsl as s}from"../webgl-engine/core/shaderModules/glsl.js";function o(o,p){o.include(i),o.constants.add("betaRayleigh","vec3",e),o.constants.add("betaCombined","vec3",t),o.constants.add("betaMie","float",a),o.constants.add("steps","int",6),o.uniforms.add(new l("cameraPosition",e=>e.camera.eye)).code.add(s`
2
+ import{Float3BindUniform as e}from"../../core/shaderModules/Float3BindUniform.js";import{If as t,glsl as a}from"../../core/shaderModules/glsl.js";import{betaRayleigh as i,betaCombined as l,betaMie as r}from"./atmosphereUtils.js";import{ChapmanApproximation as s}from"./ChapmanApproximation.glsl.js";function o(o,p){o.include(s),o.constants.add("betaRayleigh","vec3",i),o.constants.add("betaCombined","vec3",l),o.constants.add("betaMie","float",r),o.constants.add("steps","int",6),o.uniforms.add(new e("cameraPosition",e=>e.camera.eye)).code.add(a`
3
3
  vec3 raymarchAtmosphere(vec3 rayDir, vec3 lightDir, float terrainDepth) {
4
4
  vec4 ray = planetIntersect(rayDir);
5
5
  if(ray.x == 1.0) {
6
6
  return vec3(0);
7
7
  }
8
- ${r(p,"if (terrainDepth != -1.0) { ray.w = terrainDepth; }")}
8
+ ${t(p,"if (terrainDepth != -1.0) { ray.w = terrainDepth; }")}
9
9
 
10
10
  vec3 samplePoint = cameraPosition + rayDir * ray.w;
11
11
  float multiplier = ray.y == 1.0 ? -1.0 : 1.0;
@@ -22,14 +22,14 @@ import{betaRayleigh as e,betaCombined as t,betaMie as a}from"./atmosphereUtils.j
22
22
 
23
23
  if (i > 0) {
24
24
  scattering *= exp(-(mix(betaCombined, betaRayleigh, 0.5) + betaMie) * max(0.0, (opticalDepth - lastOpticalDepth)));
25
- ${r(!p,"scattering *= mix(2.5, 1.0, clamp((length(cameraPosition) - radii[0]) / 50e3, 0.0, 1.0))")};
25
+ ${t(!p,"scattering *= mix(2.5, 1.0, clamp((length(cameraPosition) - radii[0]) / 50e3, 0.0, 1.0))")};
26
26
  }
27
27
 
28
28
  if (dot(normalize(samplePoint), lightDir) > -0.3) {
29
29
  float scale = exp(-scaleFract);
30
30
  float lightDepth = getOpticalDepth(samplePoint, lightDir, scaleFract);
31
31
  scattering += scale * exp(-(betaCombined + betaMie) * lightDepth);
32
- ${r(!p,"scattering += scale * exp(-(0.25 * betaCombined ) * lightDepth);")}
32
+ ${t(!p,"scattering += scale * exp(-(0.25 * betaCombined ) * lightDepth);")}
33
33
  }
34
34
  lastOpticalDepth = opticalDepth;
35
35
  }
@@ -37,7 +37,7 @@ import{betaRayleigh as e,betaCombined as t,betaMie as a}from"./atmosphereUtils.j
37
37
  float mu = dot(rayDir, lightDir);
38
38
  float mumu = 1.0 + mu * mu;
39
39
  float phaseRayleigh = 0.0596831 * mumu;
40
- ${r(p,"return 3.0 * scattering * stepSize * phaseRayleigh * betaRayleigh;",s`
40
+ ${t(p,"return 3.0 * scattering * stepSize * phaseRayleigh * betaRayleigh;",a`
41
41
  const float g = 0.8;
42
42
  const float gg = g * g;
43
43
  float phaseMie = 0.1193662 * ((1.0 - gg) * mumu) / (pow(1.0 + gg - 2.0 * mu * g, 1.5) * (2.0 + gg));
@@ -0,0 +1,2 @@
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 r,initial as s}from"../../../../../core/reactiveUtils.js";import{subclass as i}from"../../../../../core/accessorSupport/decorators.js";import{copy as o}from"../../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as a}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{InternalRenderCategory as m}from"../../../webgl.js";import{glLayout as n}from"../../../support/buffer/glUtil.js";import{OpaqueEnvironment as p}from"../OpaqueEnvironment.js";import{S as f}from"../../../../../chunks/SimpleAtmosphere.glsl.js";import{SimpleAtmosphereTechnique as h,layout as c}from"./SimpleAtmosphereTechnique.js";import{SimpleAtmosphereTechniqueConfiguration as l}from"./SimpleAtmosphereTechniqueConfiguration.js";import{earthAtmosphereTextureSimple as u}from"./SimpleAtmosphereTexture.js";import{createPolySphereData as b}from"../../lib/GeometryUtil.js";import{VertexArrayObject as _}from"../../lib/VertexArrayObject.js";import{ColorAttachment0 as d,PrimitiveType as g}from"../../../../webgl/enums.js";import v from"../../../../webgl/Texture.js";import{TextureDescriptor as j}from"../../../../webgl/TextureDescriptor.js";import{VertexBuffer as w}from"../../../../webgl/VertexBuffer.js";let x=class extends p{constructor(){super(...arguments),this._configuration=new l,this._passParameters=new f,this._vao=null,this._vaoCount=0}initialize(){this._configuration.geometry=1,this.addHandles([r(()=>this.view.environment.atmosphereEnabled,e=>e?this._enable():this._disable(),s)])}destroy(){this._passParameters.texture=t(this._passParameters.texture),this._vao=t(this._vao)}precompile(){this.techniques.precompile(h,this._configuration)}render(e){const t=e.find(({name:e})=>e===m.OPAQUE_ENVIRONMENT),r=this.techniques.getCompiled(h,this._configuration);if(!r)return this.requestRender(1),t;const s=this.renderingContext;if(this._vao||(this._vao=A(s),this._vaoCount=this._vao.vertexCount("geometry")),!this._passParameters.texture){const e=new j(1,512);e.wrapMode=33071,e.flipped=!0,this._passParameters.texture=new v(s,e,u)}const i=s.bindTechnique(r,this.bindParameters,this._passParameters);return s.setDrawBuffers([d]),P(C,this.bindParameters.camera.viewMatrix),i.setUniformMatrix4fv("view",C),s.bindVAO(this._vao),i.assertCompatibleVertexAttributeLocations(this._vao),s.drawArrays(g.TRIANGLES,0,this._vaoCount),t}};function A(e){const t=b(1,2,!1),{data:r,indices:s}=t[0][1],i=c.createBuffer(s.length),o=i.position;for(let a=0;a<s.length;++a){const e=3*s[a%3==0?a+2:a%3==2?a-2:a];o.set(a,0,r[e]),o.set(a,1,r[e+1]),o.set(a,2,r[e+2])}return new _(e,new w(e,n(c),i.buffer))}function P(e,t){o(e,t),e[12]=0,e[13]=0,e[14]=0,e[15]=1}x=e([i("esri.views.3d.webgl-engine.effects.atmosphere.LocalAtmosphere")],x);const C=a();export{x as LocalAtmosphere};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
+ import{__decorate as t}from"tslib";import{lerp as e,clamp as r}from"../../../../../core/mathUtils.js";import{disposeMaybe as s}from"../../../../../core/maybe.js";import{watch as i,initial as o}from"../../../../../core/reactiveUtils.js";import{subclass as a}from"../../../../../core/accessorSupport/decorators.js";import{lookAt as m}from"../../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as n}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as h}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{length as p,scale as c,add as l,distance as u,cross as _,squaredLength as f}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as d}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as g}from"../../../../../geometry/ellipsoidUtils.js";import{newFloatArray as x}from"../../../../../geometry/support/FloatArray.js";import{InternalRenderCategory as b}from"../../../webgl.js";import{makePiecewiseLinearFunction as j}from"../../../support/mathUtils.js";import{glLayout as V}from"../../../support/buffer/glUtil.js";import{OpaqueEnvironment as P}from"../OpaqueEnvironment.js";import{computeInnerAltitudeFade as v,innerAtmosphereDepth as w}from"./atmosphereUtils.js";import{marsAtmosphereTextureSimple as R}from"./MarsAtmosphereTexture.js";import{S as A}from"../../../../../chunks/SimpleAtmosphere.glsl.js";import{SimpleAtmosphereTechnique as y,layout as S}from"./SimpleAtmosphereTechnique.js";import{SimpleAtmosphereTechniqueConfiguration as q}from"./SimpleAtmosphereTechniqueConfiguration.js";import{createQuadVAO as F}from"../../lib/glUtil3D.js";import{project as M}from"../../lib/Util.js";import{VertexArrayObject as T}from"../../lib/VertexArrayObject.js";import{PrimitiveType as U}from"../../../../webgl/enums.js";import E from"../../../../webgl/Texture.js";import{TextureDescriptor as C}from"../../../../webgl/TextureDescriptor.js";import{VertexBuffer as O}from"../../../../webgl/VertexBuffer.js";const N=128,I=-w,W=0,B=50,D=()=>1-511/512,G=j([[50,.1015625],[500,.21875],[5e3,1-250/512],[5e4,.4140625]]);let L=class extends P{constructor(t){super(t),this._passParameters=new A,this._configuration=new q,this._vao=null,this._fadeVao=null,this._texV1=1;const e=t.view,r=g(e.spatialReference),{outerAtmosphereRimWidth:s,radius:i}=r;this._planetRadius=i,this._innerRimFactor=1+I/i,this._middleRimFactor=1+W/i,this._outerRimFactor=1+s/i,this._texV0=W/s,this._texVScale=this._texV1-this._texV0;const o=e.stage.renderView.techniques;o.precompile(y,this._configuration),this._configuration.geometry=2,o.precompile(y,this._configuration)}initialize(){this.addHandles(i(()=>this.view.environment.atmosphereEnabled,t=>t?this._enable():this._disable(),o))}destroy(){this._passParameters.texture=s(this._passParameters.texture),this._fadeVao=s(this._fadeVao),this._vao=s(this._vao)}render(t){const e=t.find(({name:t})=>t===b.OPAQUE_ENVIRONMENT);this._update();const r=this.renderingContext;if(!this._passParameters.texture){const t=new C(1,512);t.wrapMode=33071,t.flipped=!0,this._passParameters.texture=new E(r,t,R)}if(this._passParameters.undergroundFadeAlpha<1){this._vao??=this._createRibbon(r),this._configuration.geometry=0;const t=this.techniques.getCompiled(y,this._configuration);if(!t)return this.requestRender(1),e;r.bindTechnique(t,this.bindParameters,this._passParameters),r.bindVAO(this._vao),r.drawArrays(U.TRIANGLES,0,this._vao.vertexCount("geometry"))}if(this._passParameters.undergroundFadeAlpha>0){this._fadeVao??=F(r),this._configuration.geometry=2;const t=this.techniques.getCompiled(y,this._configuration);if(!t)return this.requestRender(1),e;r.bindTechnique(t,this.bindParameters,this._passParameters),r.bindVAO(this._fadeVao),r.drawArrays(U.TRIANGLE_STRIP,0,this._fadeVao.vertexCount("geometry"))}return e}_update(){const t=this.bindParameters.camera,s=d(),i=this._planetRadius,o=p(t.eye),a=o-i;if(a<0){const t=Math.min(-a/5e3,1);this._passParameters.undergroundFadeAlpha=t}else this._passParameters.undergroundFadeAlpha=0;const m=Math.max(B,a),n=i+I;this._passParameters.innerScale=J(i+m,i,n)-1,this._passParameters.altitudeFade=v(a),c(s,t.eye,(i+B)/o),k(s,t.center,t.up,i,this._passParameters.silhouette);const l=this._computeScreenRimWidth(t,s,t.up,this._passParameters.silhouette),u=D(),_=G(a);let f=this._texV0+u*this._texVScale,g=this._texV0+l*_*this._texVScale;if(a>B){k(t.eye,t.center,t.up,i,this._passParameters.silhouette);const s=this._computeScreenRimWidth(t,t.eye,t.up,this._passParameters.silhouette),o=r((s-1.5)/(l-1.5),0,1);f=this._texV0+o*u*this._texVScale,g=this._texV0+e(this._texV1,l*_,o)*this._texVScale}h(this._passParameters.texV,f,g)}_createRibbon(t){const e=x(3+3*N*3),r=new Uint32Array(3*N*5);e[0]=0,e[1]=0,e[2]=-1;for(let o=0;o<N;o++){const t=9*o+3;e[t]=o,e[t+1]=this._innerRimFactor,e[t+2]=-1,e[t+3]=o,e[t+4]=this._middleRimFactor,e[t+5]=0,e[t+6]=o,e[t+7]=this._outerRimFactor,e[t+8]=1;const s=3*o+1,i=o===N-1?1:s+3,a=15*o;r[a]=s,r[a+1]=s+1,r[a+2]=i+1,r[a+3]=i+1,r[a+4]=i,r[a+5]=s,r[a+6]=s+1,r[a+7]=s+2,r[a+8]=i+2,r[a+9]=i+2,r[a+10]=i+1,r[a+11]=s+1,r[a+12]=s,r[a+13]=i,r[a+14]=0}const s=S.createBuffer(r.length),i=s.position;for(let o=0;o<r.length;++o){const t=3*r[o];i.set(o,0,e[t]),i.set(o,1,e[t+1]),i.set(o,2,e[t+2])}return new T(t,new O(t,V(S),s.buffer))}_computeScreenRimWidth(t,e,r,s){return l(H,s.center,s.v2),c(Q,H,this._outerRimFactor),m(z,e,H,r),M(H,z,t.projectionMatrix,t.viewport,H),M(Q,z,t.projectionMatrix,t.viewport,Q),u(H,Q)/t.height}};function k(t,e,r,s,i){const o=p(t),a=s*Math.sqrt(o*o-s*s)/o,m=Math.sqrt(s*s-a*a),n=i.v1,h=i.v2;return c(i.center,t,m/o),_(n,t,e),f(n)<1&&_(n,t,r),c(n,n,a/p(n)),_(h,n,t),c(h,h,a/p(h)),a}L=t([a("esri.views.3d.webgl-engine.effects.atmosphere.MarsAtmosphere")],L);const z=n(),H=d(),Q=d();function J(t,e,r){return t*t/(Math.sqrt(t*t-e*e)*Math.sqrt(t*t-r*r)+e*r)}export{L as MarsAtmosphere};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
+ import"../../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import"../../core/shaderLibrary/Transform.glsl.js";import"../../core/shaderLibrary/shading/MainLighting.glsl.js";import"../../core/shaderModules/Float2PassUniform.js";import"../../core/shaderModules/Float3BindUniform.js";import"../../core/shaderModules/Float3PassUniform.js";import"../../core/shaderModules/FloatPassUniform.js";import"../../core/shaderModules/glsl.js";import"../../core/shaderModules/Matrix4BindUniform.js";import"../../core/shaderModules/Texture2DPassUniform.js";import"../../../../webgl/NoParameters.js";import"../../../../webgl/ShaderBuilder.js";export{b as SilhouetteCircle,S as SimpleAtmospherePassParameters,c as build}from"../../../../../chunks/SimpleAtmosphere.glsl.js";
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
+ import{__decorate as e}from"tslib";import{subclass as r}from"../../../../../core/accessorSupport/decorators.js";import{glLayout as o}from"../../../support/buffer/glUtil.js";import{newLayout as t}from"../../../support/buffer/InterleavedLayout.js";import{ReloadableShader as s}from"../../core/shaderTechnique/ReloadableShader.js";import{ShaderTechnique as i}from"../../core/shaderTechnique/ShaderTechnique.js";import{a as p}from"../../../../../chunks/SimpleAtmosphere.glsl.js";import{makePipelineState as m,defaultColorWrite as l,backFaceCullingParams as n,unpremultipliedAlphaToPremultipliedAlpha as c}from"../../../../webgl/renderState.js";let a=class extends i{constructor(e,r){super(e,r,o(f)),this.shader=new s(p,()=>import("./SimpleAtmosphere.glsl.js"))}initializePipeline(e){const r=1===e.geometry;return m({blending:c,culling:r?n:void 0,depthTest:{func:515},colorWrite:l})}};a=e([r("esri.views.3d.webgl-engine.effects.atmosphere.SimpleAtmosphereTechnique")],a);const f=t().vec3f("position").freeze();export{a as SimpleAtmosphereTechnique,f as layout};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
+ import{__decorate as e}from"tslib";import{parameter as o}from"../../core/shaderTechnique/ShaderTechniqueConfiguration.js";import{DefaultTechniqueConfiguration as r}from"../../materials/DefaultTechniqueConfiguration.js";class t extends r{constructor(){super(...arguments),this.geometry=0}}e([o({count:3})],t.prototype,"geometry",void 0);export{t as SimpleAtmosphereTechniqueConfiguration};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
+ import{clamp as e}from"../../../../../core/mathUtils.js";import{fromValues as r}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";function o(r){return e((r-t)/i,0,1)}const t=1e5,i=1e6-t,c=1e4,m=r(5802e-9,13558e-9,331e-7),s=3,f=r(65e-8*s,1881e-9*s,85e-9*s),n=3996e-9,a=r(m[0]+f[0],m[1]+f[1],m[2]+f[2]);export{a as betaCombined,n as betaMie,f as betaOzone,m as betaRayleigh,o as computeInnerAltitudeFade,c as innerAtmosphereDepth,t as innerAtmosphereFadeStart};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
+ import"../../../../../core/has.js";import"../../../../../core/mathUtils.js";import"../../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import"../../../../../core/libs/gl-matrix-2/math/vec2.js";import"../../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import"../../core/shaderLibrary/ScreenSpacePass.glsl.js";import"../../core/shaderModules/BooleanPassUniform.js";import"../../core/shaderModules/Float2PassUniform.js";import"../../core/shaderModules/FloatPassUniform.js";import"../../core/shaderModules/glsl.js";import"../../core/shaderModules/Matrix3PassUniform.js";import"../../core/shaderModules/Texture2DPassUniform.js";import"./NoiseTextureAtlasDimensions.js";import"../../shaders/SphereIntersect.glsl.js";import"../../../../webgl/NoParameters.js";import"../../../../webgl/ShaderBuilder.js";export{C as CloudsPassParameters,b as build,c as cubeMapSize}from"../../../../../chunks/Clouds.glsl.js";