@arcgis/core 5.2.0-next.21 → 5.2.0-next.22

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 (171) hide show
  1. package/Graphic.d.ts +1 -0
  2. package/assets/esri/core/workers/RemoteClient.js +1 -1
  3. package/assets/esri/core/workers/chunks/0eb0ce43b4813cae968f.js +2 -0
  4. package/assets/esri/core/workers/chunks/{2dbd88566abac030e965.js → 162dada6a199d1efdf86.js} +2 -2
  5. package/assets/esri/core/workers/chunks/1a4bec464daa9662ab2a.js +1 -0
  6. package/assets/esri/core/workers/chunks/{b375abfb2a2d9c63e20a.js → 2255a21c7b959f04d941.js} +1 -1
  7. package/assets/esri/core/workers/chunks/292498a9c7d462d215c6.js +1 -0
  8. package/assets/esri/core/workers/chunks/3b4fc67f6cb7393fbd97.js +1 -0
  9. package/assets/esri/core/workers/chunks/{909e67dee8c30e391d69.js → 44e32ed3a570593a7245.js} +1 -1
  10. package/assets/esri/core/workers/chunks/{6649acaceab00ad30e7f.js → 50345dfc00380b158c96.js} +1 -1
  11. package/assets/esri/core/workers/chunks/{da47fdffb5969694a2ae.js → 5b42f8aa0247adc2d065.js} +1 -1
  12. package/assets/esri/core/workers/chunks/{d7acbc2ddff4cee8a465.js → 5ee887fc6e1e0e70e02f.js} +1 -1
  13. package/assets/esri/core/workers/chunks/66c2cfe11161d5dc989a.js +1 -0
  14. package/assets/esri/core/workers/chunks/6c0c77de1934f35dc45f.js +1 -0
  15. package/assets/esri/core/workers/chunks/{f7f820483e45c05ab9e4.js → 75df436e6e9773bdcfc2.js} +1 -1
  16. package/assets/esri/core/workers/chunks/780519b60aa674a61a74.js +1 -0
  17. package/assets/esri/core/workers/chunks/{a2247f4c3116efb16c4f.js → 7e23de8d9b2d938808f6.js} +1 -1
  18. package/assets/esri/core/workers/chunks/7fc8516111bd869256fc.js +1 -0
  19. package/assets/esri/core/workers/chunks/8579eba21f40630d073d.js +1 -0
  20. package/assets/esri/core/workers/chunks/928b18e13e015330d44b.js +1 -0
  21. package/assets/esri/core/workers/chunks/9434c76ad39c936dba90.js +1 -0
  22. package/assets/esri/core/workers/chunks/a54773c9bbc751619b3f.js +2 -0
  23. package/assets/esri/core/workers/chunks/{ac16016964be3b684e98.js → aded4e704e09a28edc8f.js} +1 -1
  24. package/assets/esri/core/workers/chunks/{eccbddaec4be44c86f79.js → b0b3c67b7d37bd854d95.js} +2 -2
  25. package/assets/esri/core/workers/chunks/{7175f0c6a6e56b685d20.js → b419fd36337e76e2d4a3.js} +6 -6
  26. package/assets/esri/core/workers/chunks/{05d597dd117766beadd8.js → b91a15522692781560b4.js} +1 -1
  27. package/assets/esri/core/workers/chunks/be4275a4b8977ec3eb61.js +1 -0
  28. package/assets/esri/core/workers/chunks/c86d388d216adbb15a05.js +1 -0
  29. package/assets/esri/core/workers/chunks/{0b522e05668bef729b1b.js → ceb5bd9f2afaa2ea0808.js} +1 -1
  30. package/assets/esri/core/workers/chunks/d07068c44d560e4ce02e.js +1 -0
  31. package/assets/esri/core/workers/chunks/{19493c9c7e1d2ac0f80f.js → d4e0346209fabc58f929.js} +1 -1
  32. package/assets/esri/core/workers/chunks/{5809e70a8e57e9b05959.js → dd795c95cdc3812b5b49.js} +1 -1
  33. package/assets/esri/core/workers/chunks/{f0519b06987471456b69.js → e29c8c10331edfa83277.js} +1 -1
  34. package/assets/esri/core/workers/chunks/{44b30bce8e9a75b9e1b3.js → ef94d25d1cceb25ea9fe.js} +2 -2
  35. package/assets/esri/core/workers/chunks/f02a9408ba3893484c6c.js +1 -0
  36. package/assets/esri/core/workers/chunks/f7344d855f1092383abe.js +1 -0
  37. package/assets/esri/core/workers/chunks/{f1ff33584680d8718400.js → fb9f8b6cc2b4ae5b60df.js} +1 -1
  38. package/assets/esri/core/workers/chunks/{ecbf84a1f42e6188faab.js → fd629872b5c07853f695.js} +1 -1
  39. package/assets/esri/libs/parquet/pkg/bundle_bg.wasm +0 -0
  40. package/assets/esri/themes/base/widgets/_BatchAttributeForm.scss +5 -1
  41. package/assets/esri/themes/dark/main.css +1 -1
  42. package/assets/esri/themes/light/main.css +1 -1
  43. package/assets/esri/themes/light/view.css +1 -1
  44. package/chunks/GaussianSplat.glsl.js +4 -4
  45. package/chunks/GaussianSplatShadow.glsl.js +1 -1
  46. package/config.js +1 -1
  47. package/core/date.js +1 -1
  48. package/form/FormTemplate.d.ts +15 -20
  49. package/form/elements/AttachmentElement.d.ts +38 -11
  50. package/form/elements/Element.d.ts +9 -6
  51. package/form/elements/FieldElement.d.ts +0 -1
  52. package/form/elements/GroupElement.d.ts +4 -6
  53. package/form/elements/RelationshipElement.d.ts +8 -8
  54. package/form/elements/inputs/attachments/AttachmentInput.d.ts +34 -18
  55. package/form/elements/inputs/attachments/AudioInput.d.ts +4 -3
  56. package/form/elements/inputs/attachments/DocumentInput.d.ts +2 -6
  57. package/form/elements/inputs/attachments/ImageInput.d.ts +4 -3
  58. package/form/elements/inputs/attachments/Input.d.ts +6 -3
  59. package/form/elements/inputs/attachments/SignatureInput.d.ts +3 -3
  60. package/form/elements/inputs/attachments/VideoInput.d.ts +4 -3
  61. package/form/elements.d.ts +6 -12
  62. package/form/types.d.ts +0 -4
  63. package/kernel.js +1 -1
  64. package/layers/AnnotationFeatureLayer.d.ts +2 -1
  65. package/layers/DimensionFeatureLayer.d.ts +2 -1
  66. package/layers/OrientedImageryLayer.js +1 -1
  67. package/layers/ParquetLayer.js +1 -1
  68. package/layers/graphics/sources/ParquetSource.js +1 -1
  69. package/layers/graphics/sources/geojson/GeoJSONSourceWorker.js +1 -1
  70. package/layers/graphics/sources/geojson/geojson.js +1 -1
  71. package/layers/graphics/sources/parquet/FileProvider.js +1 -1
  72. package/layers/graphics/sources/parquet/PortalParquetLayerFileProvider.js +1 -1
  73. package/layers/graphics/sources/parquet/fileProviderChangedError.js +2 -0
  74. package/layers/graphics/sources/support/ParquetSourceWorker.js +1 -1
  75. package/layers/mixins/EditBusLayer.js +1 -1
  76. package/layers/orientedImagery/core/utils.js +1 -1
  77. package/layers/support/RasterBandInfo.js +1 -1
  78. package/layers/types.d.ts +1 -0
  79. package/package.json +2 -2
  80. package/rest/support/AttachmentQuery.d.ts +13 -1
  81. package/rest/support/AttachmentQuery.js +1 -1
  82. package/rest/support/OutDistance.d.ts +5 -1
  83. package/rest/support/PrintParameters.d.ts +2 -1
  84. package/rest/support/Query.d.ts +2 -0
  85. package/support/basemapUtils.js +1 -1
  86. package/support/revision.js +1 -1
  87. package/symbols/SimpleMarkerSymbol.d.ts +2 -2
  88. package/views/2d/engine/AFeatureContainer.js +1 -1
  89. package/views/2d/engine/webgl/AttributeStoreView.js +1 -1
  90. package/views/2d/engine/webgl/mesh/templates/shapingUtils.js +1 -1
  91. package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimatedMarkerMeshWriter.js +1 -1
  92. package/views/2d/engine/webgl/shaderGraph/techniques/text/TextShader.js +1 -1
  93. package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
  94. package/views/2d/layers/features/FeatureContainer.js +1 -1
  95. package/views/2d/layers/features/sources/strategies/ParquetTileLoadStrategy.js +1 -1
  96. package/views/2d/layers/support/annodime/DimensionInfo.js +1 -1
  97. package/views/2d/layers/support/annodime/cimAnnotations.js +1 -1
  98. package/views/3d/analysis/LineOfSight/LineOfSightReshapeTool3D.js +1 -1
  99. package/views/3d/analysis/LineOfSight/LineOfSightTool2.js +1 -1
  100. package/views/3d/analysis/ShadowCastAnalysisView3D.js +1 -1
  101. package/views/3d/interactive/editingTools/reshape/ReshapeOperation.js +1 -1
  102. package/views/3d/interactive/editingTools/reshape/ReshapeTool3D.js +1 -1
  103. package/views/3d/layers/GaussianSplatLayerView3D.js +1 -1
  104. package/views/3d/layers/GaussianSplatLayerViewPerformanceInfo.js +1 -1
  105. package/views/3d/layers/graphics/tessellationUtils.js +1 -1
  106. package/views/3d/state/controllers/PinchAndPanControllerLocal.js +1 -1
  107. package/views/3d/state/utils/navigationUtils.js +1 -1
  108. package/views/3d/support/gaussianSplatting/GaussianSplatAtlasPages.js +1 -1
  109. package/views/3d/support/gaussianSplatting/GaussianSplatDataStore.js +1 -1
  110. package/views/3d/support/gaussianSplatting/GaussianSplatHeaderTexture.js +2 -0
  111. package/views/3d/support/gaussianSplatting/GaussianSplatTextureAtlas.js +1 -1
  112. package/views/3d/webgl-engine/core/shaderLibrary/output/Emissions.glsl.js +4 -4
  113. package/views/3d/webgl-engine/core/shaderLibrary/util/GaussianSplatTextureFetch.glsl.js +13 -12
  114. package/views/3d/webgl-engine/effects/glow/Glow.js +1 -1
  115. package/views/3d/webgl-engine/lib/GaussianSplatRenderNode.js +1 -1
  116. package/views/3d/webgl-engine/lib/GaussianSplatShadowRenderNode.js +1 -1
  117. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  118. package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
  119. package/views/3d/webgl-engine/shaders/OutputColorHighlightOLID.glsl.js +1 -1
  120. package/views/View2D.d.ts +2 -2
  121. package/views/layers/AnnotationFeatureLayerView.d.ts +9 -1
  122. package/views/layers/DimensionFeatureLayerView.d.ts +9 -1
  123. package/views/layers/FeatureLikeLayerView.js +1 -1
  124. package/widgets/BasemapGallery.js +1 -1
  125. package/widgets/BatchAttributeForm/attachmentUtils.js +1 -1
  126. package/widgets/BatchAttributeForm/batchAttributeFormUtils.js +1 -1
  127. package/widgets/BatchAttributeForm/css.js +1 -1
  128. package/widgets/BatchAttributeForm/inputs/AttachmentElementInput.js +1 -1
  129. package/widgets/BatchAttributeForm.js +1 -1
  130. package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
  131. package/widgets/Editor/UpdateRecordWorkflow.js +1 -1
  132. package/widgets/Editor/UpdateWorkflow.js +1 -1
  133. package/widgets/Editor/types.d.ts +12 -0
  134. package/widgets/Editor/workflowUtils.js +1 -1
  135. package/widgets/Editor.js +1 -1
  136. package/widgets/FeatureForm/FeatureFormViewModel.d.ts +16 -12
  137. package/widgets/FeatureForm.d.ts +14 -16
  138. package/widgets/FeatureTable/Grid/Grid.js +1 -1
  139. package/widgets/FeatureTable/Grid/GridViewModel.js +1 -1
  140. package/widgets/FeatureTable/Grid/types.d.ts +20 -0
  141. package/widgets/FeatureTable.d.ts +14 -2
  142. package/widgets/FeatureTable.js +1 -1
  143. package/widgets/OrientedImageryViewer/components/ImageLocationWidget.js +1 -1
  144. package/widgets/OrientedImageryViewer/components/ImageViewerViewModel.js +1 -1
  145. package/widgets/OrientedImageryViewer/navigation/queries.js +1 -1
  146. package/widgets/OrientedImageryViewer/navigation/utils.js +1 -1
  147. package/widgets/OrientedImageryViewer/support/panConstraint.js +1 -1
  148. package/widgets/OrientedImageryViewer.js +1 -1
  149. package/widgets/ShadowCast/ShadowCastViewModel.js +1 -1
  150. package/assets/esri/core/workers/chunks/057d288d795b853295f1.js +0 -2
  151. package/assets/esri/core/workers/chunks/26aa8190ac439f634c5b.js +0 -1
  152. package/assets/esri/core/workers/chunks/3192586ec7fc73ed1165.js +0 -1
  153. package/assets/esri/core/workers/chunks/33866e6e6de1bab64599.js +0 -1
  154. package/assets/esri/core/workers/chunks/360fd810d70d21c092d9.js +0 -1
  155. package/assets/esri/core/workers/chunks/3e89f487c5851c954d8b.js +0 -1
  156. package/assets/esri/core/workers/chunks/5aa375b0c6a205134703.js +0 -1
  157. package/assets/esri/core/workers/chunks/5f0bc019add4aff3130c.js +0 -1
  158. package/assets/esri/core/workers/chunks/630ad47857de3cf726d1.js +0 -1
  159. package/assets/esri/core/workers/chunks/754f7ed62afc4e0a1972.js +0 -2
  160. package/assets/esri/core/workers/chunks/7ee76504e7fea389a1c9.js +0 -1
  161. package/assets/esri/core/workers/chunks/8331e04ebe0a54b04ab6.js +0 -1
  162. package/assets/esri/core/workers/chunks/8c64c6b8d7376a9d1c91.js +0 -1
  163. package/assets/esri/core/workers/chunks/c30ca771dd3f7198142b.js +0 -1
  164. package/assets/esri/core/workers/chunks/e5fcd8e7a4a660ef6ad6.js +0 -1
  165. package/assets/esri/core/workers/chunks/f47319d36f1527277923.js +0 -1
  166. package/assets/esri/core/workers/chunks/ff00ac01f0baaecaa890.js +0 -1
  167. /package/assets/esri/core/workers/chunks/{057d288d795b853295f1.js.LICENSE.txt → 0eb0ce43b4813cae968f.js.LICENSE.txt} +0 -0
  168. /package/assets/esri/core/workers/chunks/{2dbd88566abac030e965.js.LICENSE.txt → 162dada6a199d1efdf86.js.LICENSE.txt} +0 -0
  169. /package/assets/esri/core/workers/chunks/{44b30bce8e9a75b9e1b3.js.LICENSE.txt → a54773c9bbc751619b3f.js.LICENSE.txt} +0 -0
  170. /package/assets/esri/core/workers/chunks/{eccbddaec4be44c86f79.js.LICENSE.txt → b0b3c67b7d37bd854d95.js.LICENSE.txt} +0 -0
  171. /package/assets/esri/core/workers/chunks/{754f7ed62afc4e0a1972.js.LICENSE.txt → ef94d25d1cceb25ea9fe.js.LICENSE.txt} +0 -0
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as t}from"tslib";import{createScreenPointArray as i,screenPointObjectToArray as e}from"../../../../core/screenUtils.js";import{property as n,subclass as o}from"../../../../core/accessorSupport/decorators.js";import{copy as s,distance as r}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{negate as a,copy as m,dot as h,subtract as l,length as c,normalize as _,scale as p,add as u}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as d,fromValues as g}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{wrapAxisAngle as C}from"../../../../geometry/support/axisAngle.js";import{create as v,fromNormalAndOffset as b,setOffsetFromPoint as S,negate as M,getNormal as w}from"../../../../geometry/support/plane.js";import{pixelDistanceToInteractionFactor as P,applyAll as z}from"../../camera/constraintUtils.js";import{ConstraintOptions as f}from"../../camera/constraintUtils/ConstraintOptions.js";import{ExponentialFalloff as V}from"../../input/util.js";import{getVoxelWasm as H}from"../../layers/VoxelWasm.js";import{InteractiveController as E}from"./InteractiveController.js";import{PanPlanarMomentumController as j}from"./momentum/PanPlanarMomentumController.js";import{RotationMomentumController as F}from"./momentum/RotationMomentumController.js";import{ZoomPlanarMomentumController as y}from"./momentum/ZoomPlanarMomentumController.js";import{inferNavigationMode as L,excludeTerrain as Y,getTiltScaleFactor as x,maxPanDistanceModifier as A,minPinchAndPanCameraHeight as O,pivotSearchAreaSize as R,centroid as T,applyZoomToPoint as U,applyPanPlanar as D,normalizeRotationDelta as I,applyRotation as Z,intersectPlaneFromScreenPointAtEye as k,findHorizonScreenY as G,intersectsPlaneAtScreenPoint as W,computeHorizonDownLimitScreenY as q,computeHorizonUpLimitScreenY as B,shouldClampScreenY as J}from"../utils/navigationUtils.js";import K from"../../webgl/RenderCamera.js";import{PanPlanarMomentumEstimator as N}from"../../../navigation/PanPlanarMomentumEstimator.js";import{RotationMomentumEstimator as Q}from"../../../navigation/RotationMomentumEstimator.js";import{ZoomMomentumEstimator as X}from"../../../navigation/ZoomMomentumEstimator.js";const $=g(0,0,1);let tt=class extends E{constructor(t){super(t),this.forceHorizontalPan=!1,this._rotationValueSmooth=new V(.05),this._scalingValueSmooth=new V(.05),this._planeHorizontal=v(),this._planeVertical=v(),this._rotationMomentumEstimator=new Q,this._panMomentumEstimator=new N(300,12,.9),this._zoomMomentumEstimator=new X,this._beginRadius=0,this._beginCenter=d(),this._beginAngle=0,this._tmpPoints=[],this._navigationMode=1,this._beginCenterScreen=i(),this._tmpCentroid3d=d(),this._tmpCentroid2d=i(),this._tmp2d=i(),this._clampedScreenPoint=i(),this._horizonScreenY=null,this._panLimitScreenY=null,this._panLimitFromAbove=!1,this._pointerCount=0,this._beginCamera=new K,this._constraintOptions=new f(15,0,0,this._beginCamera)}begin(t){if(!this.running)return;const i=this.view.navigation.momentumEnabled;this._zoomMomentumEstimator.enabled=i,this._rotationMomentumEstimator.enabled=i,this._panMomentumEstimator.enabled=i,this._beginRadius=t.radius,this._pointerCount=t.pointers.size,this._beginAngle=t.angle,this._rotationValueSmooth.reset(),this._scalingValueSmooth.reset(),e(t.center,this._beginCenterScreen),b($,0,this._planeHorizontal);const n=d();a(n,this.startCamera.viewForward);const o=d();m(o,$);const r=h(n,o);this.forceHorizontalPan?this._navigationMode=1:this._navigationMode=L(this.startCamera,this._beginCenterScreen,this.view.renderCoordsHelper,this.view.viewingMode),1===this._navigationMode&&(this._initClampValues(),s(this._beginCenterScreen,this._clampScreenPointToHorizonPaddingRegion(this._beginCenterScreen)));const g=d(),C=this._intersectionHelper.intersectScreenFreePointFallback(this._beginCenterScreen,g,this.view.basemapTerrain.invisible?Y:{}),v=x(o,this.startCamera.viewForward,A)*Math.max(Math.abs(this.view.camera.position.z),O);S(this._planeHorizontal,this._planeHorizontal,g),this.startCamera.aboveGround||M(this._planeHorizontal,this._planeHorizontal);const P=d(),z=d(),f=d();l(P,g,this.currentCamera.eye);const V=c(P);if(_(P,P),0===this._navigationMode){p(o,o,r),l(w(this._planeVertical),n,o),_(w(this._planeVertical),w(this._planeVertical)),S(this._planeVertical,this._planeVertical,g);const i=this.view.stage.renderView.getMinimalDepthForArea(H(this.view),this._beginCenterScreen[0],this._beginCenterScreen[1],this.view.state.camera,R);let e=null!=i?i:v;C&&(e=Math.min(e,V)),m(f,u(z,this.currentCamera.eye,p(z,P,e))),this._planeVertical[3]=-h(w(this._planeVertical),f),this._computePlanePoints(t.pointers,this._planeVertical,this.startCamera,this._tmpPoints),T(this._tmpPoints,this._beginCenter)}else{const i=C?V:v;m(f,u(z,this.currentCamera.eye,p(z,P,i))),this._planeHorizontal[3]=-h(w(this._planeHorizontal),f),this._computePlanePoints(t.pointers,this._planeHorizontal,this.startCamera,this._tmpPoints),T(this._tmpPoints,this._beginCenter)}this._beginCamera.copyFrom(this.startCamera)}update(t){if(!this.running)return;this.currentCamera.copyFrom(this.startCamera);const i=t.pointers.size>1,n=1===this._navigationMode?this._planeHorizontal:this._planeVertical,o=this._beginCenter;if(i){const i=this._beginRadius/t.radius,e=.001875*Math.min(Math.max(t.radius,40),120);this._scalingValueSmooth.gain=e,this._scalingValueSmooth.update(i),U(this.currentCamera,o,this._scalingValueSmooth.value,this.view.state.constraints.minimumPoiDistance),this._zoomMomentumEstimator.add(this._scalingValueSmooth.value,.001*t.timestamp),this._constraintOptions.interactionType=1,this._constraintOptions.interactionFactor=P(Math.abs(t.radius-this._beginRadius)),z(this.view,this.currentCamera,this._constraintOptions)}this._computePlanePoints(t.pointers,n,this.currentCamera,this._tmpPoints),T(this._tmpPoints,this._tmpCentroid3d),e(t.center,this._tmpCentroid2d);const s=1===this._navigationMode?this._clampScreenPointToHorizonPaddingRegion(this._tmpCentroid2d):this._tmpCentroid2d;if(D(this.currentCamera,o,this._tmpCentroid3d),this._panMomentumEstimator.add(s,this._tmpCentroid3d,.001*t.timestamp),this._constraintOptions.interactionType=4,this._constraintOptions.interactionFactor=P(r(this._beginCenterScreen,s)),z(this.view,this.currentCamera,this._constraintOptions),i){const i=o,e=this._rotationValueSmooth.value,n=e+I(t.angle-e),s=.00125*Math.min(Math.max(t.radius,40),120);this._rotationValueSmooth.gain=s,this._rotationValueSmooth.update(n);const r=this._rotationValueSmooth.value-this._beginAngle;this._rotationMomentumEstimator.add(r,.001*t.timestamp);const a=w(this._planeHorizontal);Z(this.currentCamera,i,C(a,r)),this._constraintOptions.interactionType=2,this._constraintOptions.interactionFactor=P(Math.abs(t.radius*r)),z(this.view,this.currentCamera,this._constraintOptions)}this.commitCamera()}end(t){t.pointers.size===this._pointerCount&&this.update(t),this.finishController();const i=this.view.animationsEnabled&&this._zoomMomentumEstimator.evaluateMomentum();if(i)return new y({view:this.view,momentum:i,zoomCenter:this._beginCenter});const e=this.view.animationsEnabled&&this._rotationMomentumEstimator.evaluateMomentum();if(e)return new F({view:this.view,momentum:e,center:this._beginCenter,axis:w(this._planeHorizontal)});const n=this.view.animationsEnabled&&this._panMomentumEstimator.evaluateMomentum();return n?new j({view:this.view,momentum:n}):null}_computePlanePoints(t,i,e,n){n.length=t.size;const o=this._tmp2d;let s=0;return t.forEach(t=>{o[0]=t.x,o[1]=t.y;const r=1===this._navigationMode?this._clampScreenPointToHorizonPaddingRegion(o):o;void 0===n[s]&&(n[s]=d()),k(i,e,r,n[s]),s+=1}),n}_initClampValues(){if(this._horizonScreenY=G(this.startCamera,t=>W(this._planeHorizontal,this.startCamera,this._beginCenterScreen[0],t)),null==this._horizonScreenY)return this._panLimitScreenY=null,void(this._panLimitFromAbove=!1);this._panLimitFromAbove=this._beginCenterScreen[1]<this._horizonScreenY,this._panLimitScreenY=this._panLimitFromAbove?q(this.startCamera,this._horizonScreenY):B(this.startCamera,this._horizonScreenY)}_clampScreenPointToHorizonPaddingRegion(t){if(s(this._clampedScreenPoint,t),null==this._panLimitScreenY)return this._clampedScreenPoint;const i=G(this.startCamera,i=>W(this._planeHorizontal,this.currentCamera,t[0],i));return null!=i&&(this._horizonScreenY=i,this._panLimitScreenY=this._panLimitFromAbove?q(this.currentCamera,i):B(this.currentCamera,i)),J(t[1],this._panLimitFromAbove,this._panLimitScreenY)&&(this._clampedScreenPoint[1]=this._panLimitScreenY,this._panMomentumEstimator.reset()),this._clampedScreenPoint}get _intersectionHelper(){return this.view.sceneIntersectionHelper}};t([n()],tt.prototype,"forceHorizontalPan",void 0),tt=t([o("esri.views.3d.state.controllers.PinchAndPanControllerLocal")],tt);export{tt as PinchAndPanControllerLocal};
2
+ import{__decorate as t}from"tslib";import{createScreenPointArray as i,screenPointObjectToArray as e}from"../../../../core/screenUtils.js";import{property as n,subclass as o}from"../../../../core/accessorSupport/decorators.js";import{copy as s,distance as r}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{negate as a,copy as m,dot as h,subtract as l,length as c,normalize as _,scale as p,add as u}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as d,fromValues as g}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{wrapAxisAngle as C}from"../../../../geometry/support/axisAngle.js";import{create as v,fromNormalAndOffset as b,setOffsetFromPoint as S,negate as M,getNormal as w}from"../../../../geometry/support/plane.js";import{pixelDistanceToInteractionFactor as z,applyAll as P}from"../../camera/constraintUtils.js";import{ConstraintOptions as f}from"../../camera/constraintUtils/ConstraintOptions.js";import{ExponentialFalloff as V}from"../../input/util.js";import{getVoxelWasm as H}from"../../layers/VoxelWasm.js";import{InteractiveController as E}from"./InteractiveController.js";import{PanPlanarMomentumController as j}from"./momentum/PanPlanarMomentumController.js";import{RotationMomentumController as F}from"./momentum/RotationMomentumController.js";import{ZoomPlanarMomentumController as y}from"./momentum/ZoomPlanarMomentumController.js";import{inferNavigationMode as Y,excludeTerrain as x,getTiltScaleFactor as L,maxPanDistanceModifier as A,minPinchAndPanCameraHeight as O,pivotSearchAreaSize as R,centroid as T,applyZoomToPoint as U,applyPanPlanar as D,normalizeRotationDelta as I,applyRotation as Z,intersectPlaneFromScreenPointAtEye as k,findPlaneHorizonY as G,computeHorizonDownLimitScreenY as W,computeHorizonUpLimitScreenY as q,shouldClampScreenY as B}from"../utils/navigationUtils.js";import J from"../../webgl/RenderCamera.js";import{PanPlanarMomentumEstimator as K}from"../../../navigation/PanPlanarMomentumEstimator.js";import{RotationMomentumEstimator as N}from"../../../navigation/RotationMomentumEstimator.js";import{ZoomMomentumEstimator as Q}from"../../../navigation/ZoomMomentumEstimator.js";const X=g(0,0,1);let $=class extends E{constructor(t){super(t),this.forceHorizontalPan=!1,this._rotationValueSmooth=new V(.05),this._scalingValueSmooth=new V(.05),this._planeHorizontal=v(),this._planeVertical=v(),this._rotationMomentumEstimator=new N,this._panMomentumEstimator=new K(300,12,.9),this._zoomMomentumEstimator=new Q,this._beginRadius=0,this._beginCenter=d(),this._beginAngle=0,this._tmpPoints=[],this._navigationMode=1,this._beginCenterScreen=i(),this._tmpCentroid3d=d(),this._tmpCentroid2d=i(),this._tmp2d=i(),this._clampedScreenPoint=i(),this._horizonScreenY=null,this._panLimitScreenY=null,this._panLimitFromAbove=!1,this._pointerCount=0,this._beginCamera=new J,this._constraintOptions=new f(15,0,0,this._beginCamera)}begin(t){if(!this.running)return;const i=this.view.navigation.momentumEnabled;this._zoomMomentumEstimator.enabled=i,this._rotationMomentumEstimator.enabled=i,this._panMomentumEstimator.enabled=i,this._beginRadius=t.radius,this._pointerCount=t.pointers.size,this._beginAngle=t.angle,this._rotationValueSmooth.reset(),this._scalingValueSmooth.reset(),e(t.center,this._beginCenterScreen),b(X,0,this._planeHorizontal);const n=d();a(n,this.startCamera.viewForward);const o=d();m(o,X);const r=h(n,o);this.forceHorizontalPan?this._navigationMode=1:this._navigationMode=Y(this.startCamera,this._beginCenterScreen,this.view.renderCoordsHelper,this.view.viewingMode),1===this._navigationMode&&(this._initClampValues(),s(this._beginCenterScreen,this._clampScreenPointToHorizonPaddingRegion(this._beginCenterScreen)));const g=d(),C=this._intersectionHelper.intersectScreenFreePointFallback(this._beginCenterScreen,g,this.view.basemapTerrain.invisible?x:{}),v=L(o,this.startCamera.viewForward,A)*Math.max(Math.abs(this.view.camera.position.z),O);S(this._planeHorizontal,this._planeHorizontal,g),this.startCamera.aboveGround||M(this._planeHorizontal,this._planeHorizontal);const z=d(),P=d(),f=d();l(z,g,this.currentCamera.eye);const V=c(z);if(_(z,z),0===this._navigationMode){p(o,o,r),l(w(this._planeVertical),n,o),_(w(this._planeVertical),w(this._planeVertical)),S(this._planeVertical,this._planeVertical,g);const i=this.view.stage.renderView.getMinimalDepthForArea(H(this.view),this._beginCenterScreen[0],this._beginCenterScreen[1],this.view.state.camera,R);let e=null!=i?i:v;C&&(e=Math.min(e,V)),m(f,u(P,this.currentCamera.eye,p(P,z,e))),this._planeVertical[3]=-h(w(this._planeVertical),f),this._computePlanePoints(t.pointers,this._planeVertical,this.startCamera,this._tmpPoints),T(this._tmpPoints,this._beginCenter)}else{const i=C?V:v;m(f,u(P,this.currentCamera.eye,p(P,z,i))),this._planeHorizontal[3]=-h(w(this._planeHorizontal),f),this._computePlanePoints(t.pointers,this._planeHorizontal,this.startCamera,this._tmpPoints),T(this._tmpPoints,this._beginCenter)}this._beginCamera.copyFrom(this.startCamera)}update(t){if(!this.running)return;this.currentCamera.copyFrom(this.startCamera);const i=t.pointers.size>1,n=1===this._navigationMode?this._planeHorizontal:this._planeVertical,o=this._beginCenter;if(i){const i=this._beginRadius/t.radius,e=.001875*Math.min(Math.max(t.radius,40),120);this._scalingValueSmooth.gain=e,this._scalingValueSmooth.update(i),U(this.currentCamera,o,this._scalingValueSmooth.value,this.view.state.constraints.minimumPoiDistance),this._zoomMomentumEstimator.add(this._scalingValueSmooth.value,.001*t.timestamp),this._constraintOptions.interactionType=1,this._constraintOptions.interactionFactor=z(Math.abs(t.radius-this._beginRadius)),P(this.view,this.currentCamera,this._constraintOptions)}this._computePlanePoints(t.pointers,n,this.currentCamera,this._tmpPoints),T(this._tmpPoints,this._tmpCentroid3d),e(t.center,this._tmpCentroid2d);const s=1===this._navigationMode?this._clampScreenPointToHorizonPaddingRegion(this._tmpCentroid2d):this._tmpCentroid2d;if(D(this.currentCamera,o,this._tmpCentroid3d),this._panMomentumEstimator.add(s,this._tmpCentroid3d,.001*t.timestamp),this._constraintOptions.interactionType=4,this._constraintOptions.interactionFactor=z(r(this._beginCenterScreen,s)),P(this.view,this.currentCamera,this._constraintOptions),i){const i=o,e=this._rotationValueSmooth.value,n=e+I(t.angle-e),s=.00125*Math.min(Math.max(t.radius,40),120);this._rotationValueSmooth.gain=s,this._rotationValueSmooth.update(n);const r=this._rotationValueSmooth.value-this._beginAngle;this._rotationMomentumEstimator.add(r,.001*t.timestamp);const a=w(this._planeHorizontal);Z(this.currentCamera,i,C(a,r)),this._constraintOptions.interactionType=2,this._constraintOptions.interactionFactor=z(Math.abs(t.radius*r)),P(this.view,this.currentCamera,this._constraintOptions)}this.commitCamera()}end(t){t.pointers.size===this._pointerCount&&this.update(t),this.finishController();const i=this.view.animationsEnabled&&this._zoomMomentumEstimator.evaluateMomentum();if(i)return new y({view:this.view,momentum:i,zoomCenter:this._beginCenter});const e=this.view.animationsEnabled&&this._rotationMomentumEstimator.evaluateMomentum();if(e)return new F({view:this.view,momentum:e,center:this._beginCenter,axis:w(this._planeHorizontal)});const n=this.view.animationsEnabled&&this._panMomentumEstimator.evaluateMomentum();return n?new j({view:this.view,momentum:n}):null}_computePlanePoints(t,i,e,n){n.length=t.size;const o=this._tmp2d;let s=0;return t.forEach(t=>{o[0]=t.x,o[1]=t.y;const r=1===this._navigationMode?this._clampScreenPointToHorizonPaddingRegion(o):o;void 0===n[s]&&(n[s]=d()),k(i,e,r,n[s]),s+=1}),n}_initClampValues(){this._horizonScreenY=G(this.startCamera,this._planeHorizontal),this._panLimitFromAbove=this._beginCenterScreen[1]<this._horizonScreenY,this._panLimitScreenY=this._panLimitFromAbove?W(this.startCamera,this._horizonScreenY):q(this.startCamera,this._horizonScreenY)}_clampScreenPointToHorizonPaddingRegion(t){return s(this._clampedScreenPoint,t),null==this._panLimitScreenY||(this._horizonScreenY=G(this.currentCamera,this._planeHorizontal),this._panLimitScreenY=this._panLimitFromAbove?W(this.currentCamera,this._horizonScreenY):q(this.currentCamera,this._horizonScreenY),B(t[1],this._panLimitFromAbove,this._panLimitScreenY)&&(this._clampedScreenPoint[1]=this._panLimitScreenY,this._panMomentumEstimator.reset())),this._clampedScreenPoint}get _intersectionHelper(){return this.view.sceneIntersectionHelper}};t([n()],$.prototype,"forceHorizontalPan",void 0),$=t([o("esri.views.3d.state.controllers.PinchAndPanControllerLocal")],$);export{$ as PinchAndPanControllerLocal};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{cyclicalPI as t}from"../../../../core/Cyclical.js";import{deg2rad as e,clamp as n,acosClamped as r,asinClamped as o}from"../../../../core/mathUtils.js";import{createScreenPointArray as i}from"../../../../core/screenUtils.js";import{fromRotation as a,exactEquals as s,rotate as c,multiply as l}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as u,create as m}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as f}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as p}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{length as h,dot as M,subtract as g,normalize as y,squaredDistance as d,copy as b,transformMat4 as x,add as j,distance as v,cross as P,scale as z,lerp as w,set as I}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as R}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as A,axis as H,fromPoints as S,wrapAxisAngle as T}from"../../../../geometry/support/axisAngle.js";import{coordinateSystemFromOneAxisAndNormalVector as U,vectorCoordinates as G}from"../../../../geometry/support/coordinateSystem.js";import{create as k,fromNormalAndOffset as E,intersectRay as q}from"../../../../geometry/support/plane.js";import{Sphere as C}from"../../../../geometry/support/sphere.js";import{sm4d as F,sv3d as O}from"../../../../geometry/support/vectorStacks.js";import{fromScreenAtEye as W,fromScreen as B}from"../../support/geometryUtils/ray.js";import{intersectScreen as D}from"../../support/geometryUtils/sphere.js";import J from"../../webgl/RenderCamera.js";import{terrainId as K}from"../../webgl-engine/lib/verticalOffsetUtils.js";const L=30,N=[1,3e8],Q=8,V=[200,1508e5],X=5,Y=50,Z=5,$=10,_=80,tt=90,et=1e-6,nt={exclude:new Set([K])};function rt(t,e,n){return n[0]=e[0]/(t.fullWidth/t.pixelRatio),n[1]=e[1]/(t.fullHeight/t.pixelRatio),n}function ot(t){for(;t>Math.PI;)t-=2*Math.PI;for(;t<-Math.PI;)t+=2*Math.PI;return t}function it(t,e,n){const r=a(F.get(),n[3],H(n));null==r||s(r,u)||(g(fe,t.eye,e),x(fe,fe,r),t.eye=j(fe,fe,e),g(fe,t.center,e),x(fe,fe,r),t.center=j(fe,fe,e),t.up=x(fe,t.up,r))}function at(t,e,n,r){return q(t,B(e,n,de),r)}function st(t,e,n,r){return q(t,W(e,n,de),r)}function ct(t,e,n,r){const o=O.get();let i=1-n;g(o,e,t.eye);const a=h(o);let s=a*(1-i);i>=0&&s<r&&(s=r,i=-(s-a)/a),Math.abs(a-s)<et||(z(o,o,i),t.eye=j(fe,t.eye,o),t.center=w(fe,t.center,e,i))}function lt(t,e,n){e.getScreenCenter(ut),D(t,e,ut,fe)&&(e.center=fe);const r=e.distance,o=r*n;if(Math.abs(r-o)<et)return;const i=z(O.get(),e.viewForward,o);e.eye=g(fe,e.center,i)}const ut=i();function mt(t,e){I(e,0,0,0);for(const n of t)j(e,e,n);z(e,e,1/t.length)}function ft(t,e,n,r){return Math.sin(t/h(e))*(n+r.radius)}function pt(t,e,n,r){return ft(Math.PI/2,e,n,r)+(t-Math.PI/2)}const ht={Elevation:3e4,Angle:e(16)},Mt=.05,gt=12,yt=12,dt=e(80);function bt(t,e,n,r,o,i){const a=R(),s=new C;let c=!0,l=!0;const{eye:u}=e;return t.intersectScreen(n,a,i)&&Zt(u,a,r)?s.radius=h(a):(l=!1,e.aboveGround&&0!==o?s.radius=Math.max(h(e.center),.9*r):s.radius=h(e.eye)-e.relativeElevation,1===o?Pt(s,e,n,a):c=D(s,e,n,a)),{sphere:s,scenePickPoint:c?a:null,hasGeometryIntersection:l}}function xt(t,e,n,r){const o=t.relativeElevation;if(o>ht.Elevation&&"global"===r)return 1;W(t,e,be);const i=Math.sign(o),a=n.worldUpAtPosition(t.eye,fe);return-i*M(a,be.direction)<Math.sin(ht.Angle)*h(be.direction)?0:1}function jt(t,e,n){g(vt,n,e),t.eye=g(fe,t.eye,vt),t.center=g(fe,t.center,vt)}const vt=R();function Pt(t,e,n,r){const o=W(e,n,de);return null!=o&&(t.closestPointOnSilhouette(o,zt),t.intersectRay(o,r)?!(d(zt,o.origin)<d(r,o.origin))||(b(r,zt),!1):(g(wt,e.eye,e.center),y(wt,wt),E(wt,-M(y(wt,wt),zt),It),q(It,o,r),!1))}const zt=R(),wt=R(),It=k();function Rt(t,e){const n=t.fullHeight/t.pixelRatio,r=e(0),o=e(n);if(r||!o)return null;let i=0,a=n;for(let s=0;s<yt;s++){const t=.5*(i+a);e(t)?a=t:i=t}return a}function At(t,e,n){return e?t>n:t<n}function Ht(t,e){const n=t.fullHeight/t.pixelRatio,r=Math.max(e,n-e);return Math.max(gt,Mt*r)}function St(t,e){const n=t.fullHeight/t.pixelRatio;return Math.min(n,e+Ht(t,e))}function Tt(t,e){return Math.max(0,e-Ht(t,e))}function Ut(t,e,n,r){return xe[0]=n,xe[1]=r,t.intersectRay(W(e,xe,de),fe)}function Gt(t,e,n,r){return xe[0]=n,xe[1]=r,q(t,W(e,xe,de),fe)}function kt(i,a,s,c,l,u){let m=0;if(P(Me,i,a),g(pe,i,a),h(i)<=l||!c.aboveGround){P(s,pe,c.eye);const f=M(i,a)/(h(i)*h(a));if(f<.9999)m=r(f);else{const t=h(P(R(),i,a))/(h(i)*h(a));m=o(t)}const p=Math.cos(n(t.normalize(e(u)),0,dt));m=-m-Math.max(0,h(a)-l)/(p*l)}else g(Et,c.eye,c.center),P(s,pe,Et),m=-h(pe)/l;return y(s,s),z(s,s,h(Me)),m}const Et=R();function qt(o,i,a,s){let c,l;const u=Math.cos(n(t.normalize(e(s)),0,dt));return c=i>a?-(i-a)/(u*a):i<-a?Math.PI-(i+a)/(u*a):r(i/a),l=o>a?-(o-a)/(u*a):o<-a?Math.PI-(o+a)/(u*a):r(o/a),(l-c)*a}function Ct(t,e,n,r,o,i,a,s,c,l){const u=qt(t[2],e[2],i.radius,s),m=c?qt(t[0],e[0],i.radius,180):e[0]-t[0],p=Math.sin(a)*m-Math.cos(a)*u,h=Math.cos(a)*m+Math.sin(a)*u;y(fe,o);const g=c?p/Math.sqrt(Math.abs(i.radius**2-M(n,fe)**2)):p/i.radius,d=h/Math.sqrt(Math.abs(i.radius**2-M(n,r)**2));f(l,g,d)}function Ft(t,e,n,r,o,i,a,s,c,l){P(Me,t,e),U(i.up,i.eye,ee,ne,re),U([0,0,1],i.eye,$t,_t,te),b(n,_t),b(r,$t),y(n,n),z(n,n,h(Me)),G(t,y(ne,ne),y(re,re),y(ee,ee),oe),G(e,ne,re,ee,ie),Ct(oe,ie,t,$t,_t,a,s,c,l,o)}function Ot(t,e,n,r,o,i,s){a(ce,o,r),a(le,s,i),l(ue,ce,le),g(e,t,n),x(e,e,ue),j(e,e,n)}function Wt(t,e,n,r,o,i){a(ce,r,n),a(le,i,o),l(ue,ce,le),g(fe,t.eye,e),x(fe,fe,ue),t.eye=j(fe,fe,e),g(fe,t.center,e),x(fe,fe,ue),t.center=j(fe,fe,e),g(fe,t.up,e),x(fe,fe,ue),t.up=j(fe,fe,e)}const Bt={Pole:.95,Angle:e(18),Tilt:45,TiltHysteresisMargin:1e-7};let Dt=!1;function Jt(t,e,n,r,o,i){const a=Math.abs(r)>Math.PI-Bt.Angle||Math.abs(r)<Bt.Angle,s=(Math.abs(t[2])<n*Bt.Pole||Math.abs(e)>n)&&i;return a&&s?!Dt&&o<Bt.Tilt-Bt.TiltHysteresisMargin?Dt=!0:Dt&&o>Bt.Tilt+Bt.TiltHysteresisMargin&&(Dt=!1):Dt=!1,Dt}function Kt(t,e,n,r,o,i){if(i)S(n,r,se),it(e,t.center,se);else{const i=kt(n,r,ge,e,t.radius,o);it(e,t.center,T(ge,i))}}function Lt(t,e,n,r,o,i,a){const s=a?20:1,c=1e-12;let l,u;b(me,r),he.copyFrom(e);for(let m=0;m<s&&d(n,me)>c&&(l=d(n,me),Ft(n,me,_t,$t,ae,he,t,o,i,a),Wt(he,t.center,$t,ae[1],_t,ae[0]),Ot(me,me,t.center,$t,ae[1],_t,ae[0]),u=d(n,me),u<l||0===m);m++)e.copyFrom(he)}function Nt(n,r,o,i,a,s,c){Jt(o,M(r.up,o),n.radius,-t.normalize(e(a)),s,r.aboveGround)?Lt(n,r,o,i,-t.normalize(e(a)),s,c):Kt(n,r,o,i,s,c)}function Qt(t,e,n,r,o,i){const{eye:a}=t;U([0,0,1],a,$t,_t,te);const s=e.translation[0]*n.pan,l="zoom"===o.mode?0:e.translation[1]*n.pan,u=Math.max(Math.sqrt(Math.abs(1-M(t.center,$t)**2/h(t.center)**2)),.5),m=(Math.sin(i)*l+Math.cos(i)*s)/u,f=-Math.cos(i)*l+Math.sin(i)*s;switch(c(r.pan.matrix,r.pan.matrix,m,$t),r.pan.enabled=!0,o.mode){case"pan":c(r.pan.matrix,r.pan.matrix,f,_t),r.pan.enabled=!0;break;case"zoom":r.zoom=-e.translation[1]*n.zoom}}function Vt(t,e,n,r,o){const{eye:i,viewRight:a}=t,s=P(O.get(),a,i),l=e.translation[0]*n.pan;switch(0!==l&&(c(r.pan.matrix,r.pan.matrix,-l,s),r.pan.enabled=!0),o.mode){case"pan":{const t=e.translation[1]*n.pan;0!==t&&(c(r.pan.matrix,r.pan.matrix,t,a),r.pan.enabled=!0);break}case"zoom":r.zoom=-e.translation[1]*n.zoom}}function Xt(n,r,o,i,a,s,c,l,u){Jt(n.center,M(n.up,n.center),h(n.center),-t.normalize(e(s)),c,r.aboveGround)?Qt(r,o,i,l,u,-t.normalize(e(a))):Vt(r,o,i,l,u)}function Yt(t,e,n=1/0){const r=Math.abs(M(t,e));return Math.min(n,1/r)}function Zt(t,e,n){const r=v(t,e),o=h(t);return r<Math.max(o,n)}const $t=R(),_t=R(),te=R(),ee=R(),ne=R(),re=R(),oe=R(),ie=R(),ae=p(),se=A(),ce=m(),le=m(),ue=m(),me=R(),fe=R(),pe=R();let he=new J;const Me=R(),ge=R();function ye(){he=new J}const de={origin:R(),direction:R()},be={origin:R(),direction:R()},xe=i();export{dt as TiltThresholdPanningSpeed,ht as VerticalPanTresholds,jt as applyPanPlanar,Kt as applyPanSphericalDirectRotation,Lt as applyPanSphericalPreserveHeading,it as applyRotation,Wt as applyRotationWithTwoAxes,lt as applyZoomOnSphere,ct as applyZoomToPoint,mt as centroid,ye as cleanupNavigationUtils,Tt as computeHorizonDownLimitScreenY,Ht as computeHorizonPadding,St as computeHorizonUpLimitScreenY,et as distanceComparisonTolerance,nt as excludeTerrain,Rt as findHorizonScreenY,Yt as getTiltScaleFactor,xt as inferNavigationMode,at as intersectPlaneFromScreenPoint,st as intersectPlaneFromScreenPointAtEye,Gt as intersectsPlaneAtScreenPoint,Ut as intersectsSphereAtScreenPoint,Zt as isHitOnSamePlanetSide,qt as lengthFromPoints,X as maxPanDistanceModifier,Z as maxRotatePivotDistanceModifier,L as maxZoomPivotDistanceModifier,Q as maxZoomStepDistanceModifier,Y as minPinchAndPanCameraHeight,$ as minRotatePivotDistance,rt as normalizeCoordinate,ot as normalizeRotationDelta,pt as offSurfaceTiltToEyeTiltGlobal,ft as onSurfaceTiltToEyeTiltGlobal,Xt as panMotionToRotationMatrix,Nt as panToPosition,bt as pickPointAndInitSphere,_ as pivotSearchAreaSize,Bt as preservingHeadingThresholds,Mt as relativeHorizonPanPadding,tt as rotatePivotSearchAreaSize,Ot as rotatePointAroundTwoAxes,kt as rotationAngleAndAxisDirectRotation,Ft as rotationAnglesAndAxesHeadingPreserving,Ct as rotationAnglesHeadingPreserving,At as shouldClampScreenY,Jt as shouldPreserveHeading,Pt as sphereOrPlanePointFromScreenPoint,N as zoomPivotDistanceClamp,V as zoomStepDistanceClamp};
2
+ import{cyclicalPI as t}from"../../../../core/Cyclical.js";import{deg2rad as e,clamp as n,acosClamped as r,asinClamped as o}from"../../../../core/mathUtils.js";import{createScreenPointArray as i}from"../../../../core/screenUtils.js";import{fromRotation as a,exactEquals as s,rotate as c,multiply as l}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as u,create as m}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as f}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as p}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{length as h,dot as M,subtract as g,normalize as y,squaredDistance as d,copy as b,transformMat4 as x,add as j,distance as v,cross as P,scale as w,lerp as z,set as I}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as R}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as A,axis as H,fromPoints as S,wrapAxisAngle as T}from"../../../../geometry/support/axisAngle.js";import{coordinateSystemFromOneAxisAndNormalVector as U,vectorCoordinates as G}from"../../../../geometry/support/coordinateSystem.js";import{create as k,fromNormalAndOffset as E,intersectRay as F,projectVector as q}from"../../../../geometry/support/plane.js";import{Sphere as C}from"../../../../geometry/support/sphere.js";import{sm4d as O,sv3d as W}from"../../../../geometry/support/vectorStacks.js";import{fromScreenAtEye as B,fromScreen as D}from"../../support/geometryUtils/ray.js";import{intersectScreen as J}from"../../support/geometryUtils/sphere.js";import K from"../../webgl/RenderCamera.js";import{terrainId as L}from"../../webgl-engine/lib/verticalOffsetUtils.js";const N=30,Q=[1,3e8],V=8,X=[200,1508e5],Y=5,Z=50,$=5,_=10,tt=80,et=90,nt=1e-6,rt={exclude:new Set([L])};function ot(t,e,n){return n[0]=e[0]/(t.fullWidth/t.pixelRatio),n[1]=e[1]/(t.fullHeight/t.pixelRatio),n}function it(t){for(;t>Math.PI;)t-=2*Math.PI;for(;t<-Math.PI;)t+=2*Math.PI;return t}function at(t,e,n){const r=a(O.get(),n[3],H(n));null==r||s(r,u)||(g(ye,t.eye,e),x(ye,ye,r),t.eye=j(ye,ye,e),g(ye,t.center,e),x(ye,ye,r),t.center=j(ye,ye,e),t.up=x(ye,t.up,r))}function st(t,e,n,r){return F(t,D(e,n,Pe),r)}function ct(t,e,n,r){return F(t,B(e,n,Pe),r)}function lt(t,e,n,r){const o=W.get();let i=1-n;g(o,e,t.eye);const a=h(o);let s=a*(1-i);i>=0&&s<r&&(s=r,i=-(s-a)/a),Math.abs(a-s)<nt||(w(o,o,i),t.eye=j(ye,t.eye,o),t.center=z(ye,t.center,e,i))}function ut(t,e,n){e.getScreenCenter(mt),J(t,e,mt,ye)&&(e.center=ye);const r=e.distance,o=r*n;if(Math.abs(r-o)<nt)return;const i=w(W.get(),e.viewForward,o);e.eye=g(ye,e.center,i)}const mt=i();function ft(t,e){I(e,0,0,0);for(const n of t)j(e,e,n);w(e,e,1/t.length)}function pt(t,e,n,r){return Math.sin(t/h(e))*(n+r.radius)}function ht(t,e,n,r){return pt(Math.PI/2,e,n,r)+(t-Math.PI/2)}const Mt={Elevation:3e4,Angle:e(16)},gt=.05,yt=12,dt=12,bt=e(80);function xt(t,e,n,r,o,i){const a=R(),s=new C;let c=!0,l=!0;const{eye:u}=e;return t.intersectScreen(n,a,i)&&ne(u,a,r)?s.radius=h(a):(l=!1,e.aboveGround&&0!==o?s.radius=Math.max(h(e.center),.9*r):s.radius=h(e.eye)-e.relativeElevation,1===o?wt(s,e,n,a):c=J(s,e,n,a)),{sphere:s,scenePickPoint:c?a:null,hasGeometryIntersection:l}}function jt(t,e,n,r){const o=t.relativeElevation;if(o>Mt.Elevation&&"global"===r)return 1;B(t,e,we);const i=Math.sign(o),a=n.worldUpAtPosition(t.eye,ye);return-i*M(a,we.direction)<Math.sin(Mt.Angle)*h(we.direction)?0:1}function vt(t,e,n){g(Pt,n,e),t.eye=g(ye,t.eye,Pt),t.center=g(ye,t.center,Pt)}const Pt=R();function wt(t,e,n,r){const o=B(e,n,Pe);return null!=o&&(t.closestPointOnSilhouette(o,zt),t.intersectRay(o,r)?!(d(zt,o.origin)<d(r,o.origin))||(b(r,zt),!1):(g(It,e.eye,e.center),y(It,It),E(It,-M(y(It,It),zt),Rt),F(Rt,o,r),!1))}const zt=R(),It=R(),Rt=k();function At(t,e){const n=t.fullHeight/t.pixelRatio,r=e(0),o=e(n);if(r||!o)return null;let i=0,a=n;for(let s=0;s<dt;s++){const t=.5*(i+a);e(t)?a=t:i=t}return a}const Ht=R(),St=R(),Tt=i();function Ut(t,e){return q(e,t.viewForward,Ht),j(St,t.eye,Ht),t.projectToScreen(St,Tt),Tt[1]}function Gt(t,e,n){return e?t>n:t<n}function kt(t,e){const n=t.fullHeight/t.pixelRatio,r=Math.max(e,n-e);return Math.max(yt,gt*r)}function Et(t,e){const n=t.fullHeight/t.pixelRatio;return Math.min(n,e+kt(t,e))}function Ft(t,e){return Math.max(0,e-kt(t,e))}function qt(t,e,n,r){return ze[0]=n,ze[1]=r,t.intersectRay(B(e,ze,Pe),ye)}function Ct(t,e,n,r){return ze[0]=n,ze[1]=r,F(t,B(e,ze,Pe),ye)}function Ot(i,a,s,c,l,u){let m=0;if(P(xe,i,a),g(de,i,a),h(i)<=l||!c.aboveGround){P(s,de,c.eye);const f=M(i,a)/(h(i)*h(a));if(f<.9999)m=r(f);else{const t=h(P(R(),i,a))/(h(i)*h(a));m=o(t)}const p=Math.cos(n(t.normalize(e(u)),0,bt));m=-m-Math.max(0,h(a)-l)/(p*l)}else g(Wt,c.eye,c.center),P(s,de,Wt),m=-h(de)/l;return y(s,s),w(s,s,h(xe)),m}const Wt=R();function Bt(o,i,a,s){let c,l;const u=Math.cos(n(t.normalize(e(s)),0,bt));return c=i>a?-(i-a)/(u*a):i<-a?Math.PI-(i+a)/(u*a):r(i/a),l=o>a?-(o-a)/(u*a):o<-a?Math.PI-(o+a)/(u*a):r(o/a),(l-c)*a}function Dt(t,e,n,r,o,i,a,s,c,l){const u=Bt(t[2],e[2],i.radius,s),m=c?Bt(t[0],e[0],i.radius,180):e[0]-t[0],p=Math.sin(a)*m-Math.cos(a)*u,h=Math.cos(a)*m+Math.sin(a)*u;y(ye,o);const g=c?p/Math.sqrt(Math.abs(i.radius**2-M(n,ye)**2)):p/i.radius,d=h/Math.sqrt(Math.abs(i.radius**2-M(n,r)**2));f(l,g,d)}function Jt(t,e,n,r,o,i,a,s,c,l){P(xe,t,e),U(i.up,i.eye,ae,se,ce),U([0,0,1],i.eye,re,oe,ie),b(n,oe),b(r,re),y(n,n),w(n,n,h(xe)),G(t,y(se,se),y(ce,ce),y(ae,ae),le),G(e,se,ce,ae,ue),Dt(le,ue,t,re,oe,a,s,c,l,o)}function Kt(t,e,n,r,o,i,s){a(pe,o,r),a(he,s,i),l(Me,pe,he),g(e,t,n),x(e,e,Me),j(e,e,n)}function Lt(t,e,n,r,o,i){a(pe,r,n),a(he,i,o),l(Me,pe,he),g(ye,t.eye,e),x(ye,ye,Me),t.eye=j(ye,ye,e),g(ye,t.center,e),x(ye,ye,Me),t.center=j(ye,ye,e),g(ye,t.up,e),x(ye,ye,Me),t.up=j(ye,ye,e)}const Nt={Pole:.95,Angle:e(18),Tilt:45,TiltHysteresisMargin:1e-7};let Qt=!1;function Vt(t,e,n,r,o,i){const a=Math.abs(r)>Math.PI-Nt.Angle||Math.abs(r)<Nt.Angle,s=(Math.abs(t[2])<n*Nt.Pole||Math.abs(e)>n)&&i;return a&&s?!Qt&&o<Nt.Tilt-Nt.TiltHysteresisMargin?Qt=!0:Qt&&o>Nt.Tilt+Nt.TiltHysteresisMargin&&(Qt=!1):Qt=!1,Qt}function Xt(t,e,n,r,o,i){if(i)S(n,r,fe),at(e,t.center,fe);else{const i=Ot(n,r,je,e,t.radius,o);at(e,t.center,T(je,i))}}function Yt(t,e,n,r,o,i,a){const s=a?20:1,c=1e-12;let l,u;b(ge,r),be.copyFrom(e);for(let m=0;m<s&&d(n,ge)>c&&(l=d(n,ge),Jt(n,ge,oe,re,me,be,t,o,i,a),Lt(be,t.center,re,me[1],oe,me[0]),Kt(ge,ge,t.center,re,me[1],oe,me[0]),u=d(n,ge),u<l||0===m);m++)e.copyFrom(be)}function Zt(n,r,o,i,a,s,c){Vt(o,M(r.up,o),n.radius,-t.normalize(e(a)),s,r.aboveGround)?Yt(n,r,o,i,-t.normalize(e(a)),s,c):Xt(n,r,o,i,s,c)}function $t(t,e,n,r,o,i){const{eye:a}=t;U([0,0,1],a,re,oe,ie);const s=e.translation[0]*n.pan,l="zoom"===o.mode?0:e.translation[1]*n.pan,u=Math.max(Math.sqrt(Math.abs(1-M(t.center,re)**2/h(t.center)**2)),.5),m=(Math.sin(i)*l+Math.cos(i)*s)/u,f=-Math.cos(i)*l+Math.sin(i)*s;switch(c(r.pan.matrix,r.pan.matrix,m,re),r.pan.enabled=!0,o.mode){case"pan":c(r.pan.matrix,r.pan.matrix,f,oe),r.pan.enabled=!0;break;case"zoom":r.zoom=-e.translation[1]*n.zoom}}function _t(t,e,n,r,o){const{eye:i,viewRight:a}=t,s=P(W.get(),a,i),l=e.translation[0]*n.pan;switch(0!==l&&(c(r.pan.matrix,r.pan.matrix,-l,s),r.pan.enabled=!0),o.mode){case"pan":{const t=e.translation[1]*n.pan;0!==t&&(c(r.pan.matrix,r.pan.matrix,t,a),r.pan.enabled=!0);break}case"zoom":r.zoom=-e.translation[1]*n.zoom}}function te(n,r,o,i,a,s,c,l,u){Vt(n.center,M(n.up,n.center),h(n.center),-t.normalize(e(s)),c,r.aboveGround)?$t(r,o,i,l,u,-t.normalize(e(a))):_t(r,o,i,l,u)}function ee(t,e,n=1/0){const r=Math.abs(M(t,e));return Math.min(n,1/r)}function ne(t,e,n){const r=v(t,e),o=h(t);return r<Math.max(o,n)}const re=R(),oe=R(),ie=R(),ae=R(),se=R(),ce=R(),le=R(),ue=R(),me=p(),fe=A(),pe=m(),he=m(),Me=m(),ge=R(),ye=R(),de=R();let be=new K;const xe=R(),je=R();function ve(){be=new K}const Pe={origin:R(),direction:R()},we={origin:R(),direction:R()},ze=i();export{bt as TiltThresholdPanningSpeed,Mt as VerticalPanTresholds,vt as applyPanPlanar,Xt as applyPanSphericalDirectRotation,Yt as applyPanSphericalPreserveHeading,at as applyRotation,Lt as applyRotationWithTwoAxes,ut as applyZoomOnSphere,lt as applyZoomToPoint,ft as centroid,ve as cleanupNavigationUtils,Ft as computeHorizonDownLimitScreenY,kt as computeHorizonPadding,Et as computeHorizonUpLimitScreenY,nt as distanceComparisonTolerance,rt as excludeTerrain,At as findHorizonScreenY,Ut as findPlaneHorizonY,ee as getTiltScaleFactor,jt as inferNavigationMode,st as intersectPlaneFromScreenPoint,ct as intersectPlaneFromScreenPointAtEye,Ct as intersectsPlaneAtScreenPoint,qt as intersectsSphereAtScreenPoint,ne as isHitOnSamePlanetSide,Bt as lengthFromPoints,Y as maxPanDistanceModifier,$ as maxRotatePivotDistanceModifier,N as maxZoomPivotDistanceModifier,V as maxZoomStepDistanceModifier,Z as minPinchAndPanCameraHeight,_ as minRotatePivotDistance,ot as normalizeCoordinate,it as normalizeRotationDelta,ht as offSurfaceTiltToEyeTiltGlobal,pt as onSurfaceTiltToEyeTiltGlobal,te as panMotionToRotationMatrix,Zt as panToPosition,xt as pickPointAndInitSphere,tt as pivotSearchAreaSize,Nt as preservingHeadingThresholds,gt as relativeHorizonPanPadding,et as rotatePivotSearchAreaSize,Kt as rotatePointAroundTwoAxes,Ot as rotationAngleAndAxisDirectRotation,Jt as rotationAnglesAndAxesHeadingPreserving,Dt as rotationAnglesHeadingPreserving,Gt as shouldClampScreenY,Vt as shouldPreserveHeading,wt as sphereOrPlanePointFromScreenPoint,Q as zoomPivotDistanceClamp,X as zoomStepDistanceClamp};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- const t=4096,s=64,e=1023,i=e+1,n=t*s/i,r=4,o=i*r,h=e*r,a=t*s;class c{constructor(t=n){this._pageCount=t;const s=Math.ceil(t/32);this._bitset=new Uint32Array(s)}get pageCount(){return this._pageCount}isAllocated(t){const s=t/32|0,e=t%32;return!!(this._bitset[s]&1<<e)}allocate(t){const s=t/32|0,e=t%32;this._bitset[s]|=1<<e}free(t){const s=t/32|0,e=t%32;this._bitset[s]&=~(1<<e)}findFirstFreePage(){for(let t=0;t<this._bitset.length;t++)if(4294967295!==this._bitset[t])for(let s=0;s<32;s++){const e=32*t+s;if(e>=this._pageCount)break;if(!(this._bitset[t]&1<<s))return e}return null}resize(t){this._pageCount=t;const s=Math.ceil(t/32),e=this._bitset.length;if(s!==e){const t=new Uint32Array(s),i=Math.min(e,s);t.set(this._bitset.subarray(0,i)),this._bitset=t}this._clearExcessBits(this._bitset,t)}_clearExcessBits(t,s){const e=Math.floor((s-1)/32),i=(s-1)%32;if(s>0&&i<31){const s=(1<<i+1)-1;t[e]&=s}e+1<t.length&&t.fill(0,e+1)}}export{c as GaussianSplatAtlasPages,i as elementsPerSplatPage,e as gaussiansPerSplatPage,s as initialSplatAtlasTextureHeight,n as initialSplatAtlasTexturePages,a as minExpectedGaussianCount,r as packedGaussianSizeInU32,t as splatAtlasTextureWidth,o as splatPageSizeInU32,h as splatPageSizeInU32WithoutHeader};
2
+ const t=4096,s=64,e=1024,i=t*s/e,n=4,r=e*n,o=t*s;class h{constructor(t=i){this._pageCount=t;const s=Math.ceil(t/32);this._bitset=new Uint32Array(s)}get pageCount(){return this._pageCount}isAllocated(t){const s=t/32|0,e=t%32;return!!(this._bitset[s]&1<<e)}allocate(t){const s=t/32|0,e=t%32;this._bitset[s]|=1<<e}free(t){const s=t/32|0,e=t%32;this._bitset[s]&=~(1<<e)}findFirstFreePage(){for(let t=0;t<this._bitset.length;t++)if(4294967295!==this._bitset[t])for(let s=0;s<32;s++){const e=32*t+s;if(e>=this._pageCount)break;if(!(this._bitset[t]&1<<s))return e}return null}resize(t){this._pageCount=t;const s=Math.ceil(t/32),e=this._bitset.length;if(s!==e){const t=new Uint32Array(s),i=Math.min(e,s);t.set(this._bitset.subarray(0,i)),this._bitset=t}this._clearExcessBits(this._bitset,t)}_clearExcessBits(t,s){const e=Math.floor((s-1)/32),i=(s-1)%32;if(s>0&&i<31){const s=(1<<i+1)-1;t[e]&=s}e+1<t.length&&t.fill(0,e+1)}}export{h as GaussianSplatAtlasPages,e as gaussiansPerPage,s as initialSplatAtlasTextureHeight,i as initialSplatAtlasTexturePages,o as minExpectedGaussianCount,n as packedGaussianSizeInU32,t as splatAtlasTextureWidth,r as splatPageSizeInU32};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{reallocGrowthFactor as e}from"../../../../core/arrayUtils.js";import{abortMaybe as t}from"../../../../core/maybe.js";import{estimateNumberArrayMemory as s}from"../../../../core/memoryEstimations.js";import{isAbortError as i}from"../../../../core/promiseUtils.js";import{signal as r}from"../../../../core/signal.js";import{Milliseconds as o,now as a}from"../../../../core/time.js";import{exactEquals as n,copy as l,normalize as h}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as u}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as d,exactEquals as _,intersects as c,copy as p}from"../../../../geometry/support/aaBoundingBox.js";import{makeScheduleFunction as f}from"../../layers/support/makeScheduleFunction.js";import{GaussianSplatSortWorkerHandle as m}from"../GaussianSplatWorkerHandle.js";import{GaussianSplatFadeTexture as g}from"./GaussianSplatFadeTexture.js";import{GaussianSplatOrderTexture as T}from"./GaussianSplatOrderTexture.js";import{GaussianSplatTextureAtlas as b}from"./GaussianSplatTextureAtlas.js";import{DepthRange as S}from"../../webgl-engine/lib/DepthRange.js";import{TaskPriority as y}from"../../../support/Scheduler.js";class C{constructor(e,t,s){this._updating=r(!1),this._useDeterministicSort=!1,this._sortBufferMemory=0,this.visibleGaussians=0,this._visibleTileDepthRange=new S,this._previousVisibleTileDepthRangeEye=u(),this._previousVisibleTileDepthRangeViewForward=u(),this._previousVisibleTileDepthRangeClippingBox=d(),this._latestSortedGaussianTilesVersion=0,this._previousVisibleTileDepthRangeTilesVersion=-1,this._previousVisibleTileDepthRangeHasClippingBox=!1,this._bufferCapacity=0,this._requestedLyr3dVisibilityChange=0,this._latestCompletedLyr3dVisibilityChange=0,this._latestUpdatedGaussianTiles=new Array,this._latestSortedGaussianTiles=new Array,this._nextCommittedVisibleGaussianTiles=new Array,this._cameraDirectionNormalized=u(),this._frameTask=null,this._workerHandle=null,this._sortAbortController=null,this._isSorting=!1,this._pendingSortTask=!1,this._scheduledSortStartTimeout=null,this._lastSortStartTime=o(-1/0),this._sortInterval=o(80),this._renderer=e,this._onSortComplete=t,this._orderTexture=new T(this._renderer.renderingContext),this._fadingTexture=new g(this._renderer.renderingContext),this._textureAtlas=new b(this._renderer.renderingContext,this._renderer.view.resourceController.memoryController,this._renderer.fboCache,s);const{resourceController:i}=this._renderer.view;this._workerHandle=new m(f(i)),this._frameTask=i.scheduler.registerTask(y.GAUSSIAN_SPLAT_SORTING)}get textureAtlas(){return this._textureAtlas}get orderTexture(){return this._orderTexture}get fadingTexture(){return this._fadingTexture}get textureAtlasMemory(){return this._textureAtlas.usedMemory}get orderTextureMemory(){return this._orderTexture.usedMemory}get fadingTextureMemory(){return this._fadingTexture.usedMemory}get sortBufferMemory(){return this._sortBufferMemory}get usedMemory(){return this.textureAtlasMemory+this.orderTextureMemory+this.fadingTextureMemory+this.sortBufferMemory}queryVisibleTileDepthRange(e,t){if(0===this.visibleGaussians)return null;const{eye:s,viewForward:i}=e,r=s[0],o=s[1],a=s[2],h=i[0],u=i[1],d=i[2],f=this._visibleTileDepthRange;if(this._previousVisibleTileDepthRangeTilesVersion===this._latestSortedGaussianTilesVersion&&n(this._previousVisibleTileDepthRangeEye,s)&&n(this._previousVisibleTileDepthRangeViewForward,i)&&(null==t?!this._previousVisibleTileDepthRangeHasClippingBox:this._previousVisibleTileDepthRangeHasClippingBox&&_(this._previousVisibleTileDepthRangeClippingBox,t)))return f.near<=f.far?f:null;let m=1/0,g=-1/0;const T=this._latestSortedGaussianTiles;for(let n=0;n<T.length;n++){const e=T[n];if(null!=t){const s=e.boundingBox;if(!c(s,t))continue}const s=h*(e.obbCenterX-r)+u*(e.obbCenterY-o)+d*(e.obbCenterZ-a),i=e.paddedMbsRadius,l=s-i;l<m&&(m=l);const _=s+i;_>g&&(g=_)}const b=m<=g;return b?f.set(m,g):f.set(1/0,-1/0),this._previousVisibleTileDepthRangeTilesVersion=this._latestSortedGaussianTilesVersion,this._previousVisibleTileDepthRangeHasClippingBox=null!=t,l(this._previousVisibleTileDepthRangeEye,s),l(this._previousVisibleTileDepthRangeViewForward,i),null!=t&&p(this._previousVisibleTileDepthRangeClippingBox,t),b?f:null}updateGaussianVisibility(e,t){this._latestUpdatedGaussianTiles=e,this._requestedLyr3dVisibilityChange=t,this.requestSort()}get updating(){return this._updating.value}destroy(){this._sortAbortController=t(this._sortAbortController),this._pendingSortTask=!1,this._updating.value=!1,null!=this._scheduledSortStartTimeout&&(clearTimeout(this._scheduledSortStartTimeout),this._scheduledSortStartTimeout=null),this._frameTask.remove(),this._workerHandle?.destroyWorkerAndSelf(),this._textureAtlas.destroy(),this._orderTexture.destroy(),this._fadingTexture.destroy()}requestSort(){return this._updating.value=!0,!this._pendingSortTask&&(this._pendingSortTask=!0,this._scheduleSortStart(),!0)}_scheduleSortStart(){if(this._isSorting)return;const e=a()-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(){if(this._isSorting||!this._pendingSortTask)return;const e=new AbortController;this._sortAbortController=e,this._isSorting=!0,this._pendingSortTask=!1,this._lastSortStartTime=a(),this._sortOnWorker(e.signal).finally(()=>{this._sortAbortController===e&&(this._sortAbortController=null),this._handleSortComplete()})}_handleSortComplete(){this._isSorting=!1,this._pendingSortTask?this._scheduleSortStart():this._updating.value=!1}_clearBuffersAndTextures(){this._atlasIndicesBuffer=void 0,this._sortedAtlasIndicesBuffer=void 0,this._distancesBuffer=void 0,this._bufferCapacity=0,this._sortBufferMemory=0,this._orderTexture.clear(),this._textureAtlas.clear()}_computeExpandedCapacity(t,s){let i=Math.max(1,t);for(;i<s;)i=Math.ceil(i*e);return i}_ensureSortBufferCapacities(e){if(this._bufferCapacity<e){const t=this._computeExpandedCapacity(this._bufferCapacity,e);this._atlasIndicesBuffer=new Uint32Array(t),this._sortedAtlasIndicesBuffer=new Uint32Array(t),this._distancesBuffer=new Float64Array(t),this._bufferCapacity=t,this._sortBufferMemory=s(this._atlasIndicesBuffer,this._sortedAtlasIndicesBuffer,this._distancesBuffer)}}_clearAllBuffersAndTextures(){this._clearBuffersAndTextures(),this._latestSortedGaussianTiles.length=0,this._nextCommittedVisibleGaussianTiles.length=0,this._previousVisibleTileDepthRangeTilesVersion=-1,this._workerHandle?.clear()}async _sortOnWorker(e){try{if(0===this._latestUpdatedGaussianTiles.length)return this.visibleGaussians=0,this._clearAllBuffersAndTextures(),this._latestCompletedLyr3dVisibilityChange=this._requestedLyr3dVisibilityChange,this._onSortComplete(this._latestSortedGaussianTiles,this._latestCompletedLyr3dVisibilityChange),void this._renderer.requestRender(1);this._useDeterministicSort&&this._latestUpdatedGaussianTiles.sort((e,t)=>e.obb.centerX-t.obb.centerX||e.obb.centerY-t.obb.centerY||e.obb.centerZ-t.obb.centerZ);const t=this._latestUpdatedGaussianTiles,s=t.length,i=this._requestedLyr3dVisibilityChange;let r=0;for(let e=0;e<s;e++)r+=t[e].gaussianCount;this._ensureSortBufferCapacities(r),this._textureAtlas.ensureTextureAtlas();const o=this._renderer.camera;h(this._cameraDirectionNormalized,o.ray.direction);const a=this._cameraDirectionNormalized[0],n=this._cameraDirectionNormalized[1],l=this._cameraDirectionNormalized[2];let u=0;const d=this._atlasIndicesBuffer,_=this._distancesBuffer,p=this._renderer.clippingBox,f=this._nextCommittedVisibleGaussianTiles;f.length=0;let m=0;const{frustum:g}=o,T=this._renderer.tileCullingRevision,b=g[0],S=g[1],y=g[2],C=g[3],x=g[4],V=g[5];for(let e=0;e<s;e++){const s=t[e],{gaussianAtlasIndices:i,relativePositions:r,obbCenterX:o,obbCenterY:h,obbCenterZ:g,paddedMbsRadius:v}=s,A=s.gaussianCount;if(s.cullingRevision!==T){let e=null==p||c(s.boundingBox,p);if(e){const t=1.5*v;e=b[0]*o+b[1]*h+b[2]*g+b[3]<t&&S[0]*o+S[1]*h+S[2]*g+S[3]<t&&y[0]*o+y[1]*h+y[2]*g+y[3]<t&&C[0]*o+C[1]*h+C[2]*g+C[3]<t&&x[0]*o+x[1]*h+x[2]*g+x[3]<t&&V[0]*o+V[1]*h+V[2]*g+V[3]<t}s.cullingRevision=T,s.cullingVisible=e}if(!s.cullingVisible)continue;d.set(i,u),f[m++]=s;const B=a*o+n*h+l*g,G=u+A;for(let e=u,t=0;e<G;e++,t+=3){const s=r[t],i=r[t+1],o=r[t+2];_[e]=s*a+i*n+o*l+B}u=G}if(f.length=m,0===u)return this.visibleGaussians=0,this._clearAllBuffersAndTextures(),this._latestCompletedLyr3dVisibilityChange=i,this._onSortComplete(this._latestSortedGaussianTiles,this._latestCompletedLyr3dVisibilityChange),void this._renderer.requestRender(1);const v={distances:this._distancesBuffer,atlasIndices:this._atlasIndicesBuffer,sortedAtlasIndices:this._sortedAtlasIndicesBuffer,numGaussians:u,preciseSort:this._useDeterministicSort},A=await(this._workerHandle?.sort(v,e));if(e.aborted)return;A&&(this._distancesBuffer=A.distances,this._atlasIndicesBuffer=A.atlasIndices,this._sortedAtlasIndicesBuffer=A.sortedAtlasIndices);const B=async e=>{this._orderTexture.setData(this._sortedAtlasIndicesBuffer,u);const t=this._latestSortedGaussianTiles;this._latestSortedGaussianTiles=f,this._nextCommittedVisibleGaussianTiles=t,this._latestSortedGaussianTilesVersion++,this._latestCompletedLyr3dVisibilityChange=i,this.visibleGaussians=u,this._onSortComplete(this._latestSortedGaussianTiles,this._latestCompletedLyr3dVisibilityChange),this._renderer.requestRender(1),e.madeProgress()};await this._frameTask.schedule(B,e)}catch(t){if(i(t))return}}set useDeterministicSort(e){this._useDeterministicSort=e}}export{C as GaussianSplatDataStore};
2
+ import{reallocGrowthFactor as e}from"../../../../core/arrayUtils.js";import{abortMaybe as t}from"../../../../core/maybe.js";import{estimateNumberArrayMemory as s}from"../../../../core/memoryEstimations.js";import{isAbortError as i}from"../../../../core/promiseUtils.js";import{signal as r}from"../../../../core/signal.js";import{Milliseconds as a,now as o}from"../../../../core/time.js";import{exactEquals as n,copy as l,normalize as h}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as u}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as d,exactEquals as _,intersects as c,copy as p}from"../../../../geometry/support/aaBoundingBox.js";import{makeScheduleFunction as f}from"../../layers/support/makeScheduleFunction.js";import{GaussianSplatSortWorkerHandle as m}from"../GaussianSplatWorkerHandle.js";import{GaussianSplatFadeTexture as g}from"./GaussianSplatFadeTexture.js";import{GaussianSplatHeaderTexture as T}from"./GaussianSplatHeaderTexture.js";import{GaussianSplatOrderTexture as b}from"./GaussianSplatOrderTexture.js";import{GaussianSplatTextureAtlas as S}from"./GaussianSplatTextureAtlas.js";import{DepthRange as y}from"../../webgl-engine/lib/DepthRange.js";import{TaskPriority as x}from"../../../support/Scheduler.js";class C{constructor(e,t,s){this._updating=r(!1),this._useDeterministicSort=!1,this._sortBufferMemory=0,this.visibleGaussians=0,this._visibleTileDepthRange=new y,this._previousVisibleTileDepthRangeEye=u(),this._previousVisibleTileDepthRangeViewForward=u(),this._previousVisibleTileDepthRangeClippingBox=d(),this._latestSortedGaussianTilesVersion=0,this._previousVisibleTileDepthRangeTilesVersion=-1,this._previousVisibleTileDepthRangeHasClippingBox=!1,this._bufferCapacity=0,this._requestedLyr3dVisibilityChange=0,this._latestCompletedLyr3dVisibilityChange=0,this._latestUpdatedGaussianTiles=new Array,this._latestSortedGaussianTiles=new Array,this._nextCommittedVisibleGaussianTiles=new Array,this._cameraDirectionNormalized=u(),this._frameTask=null,this._workerHandle=null,this._sortAbortController=null,this._isSorting=!1,this._pendingSortTask=!1,this._scheduledSortStartTimeout=null,this._lastSortStartTime=a(-1/0),this._sortInterval=a(80),this._renderer=e,this._onSortComplete=t,this._orderTexture=new b(this._renderer.renderingContext),this._fadingTexture=new g(this._renderer.renderingContext),this._headerTexture=new T(this._renderer.renderingContext),this._textureAtlas=new S(this._renderer.renderingContext,this._renderer.view.resourceController.memoryController,this._renderer.fboCache,s);const{resourceController:i}=this._renderer.view;this._workerHandle=new m(f(i)),this._frameTask=i.scheduler.registerTask(x.GAUSSIAN_SPLAT_SORTING)}get textureAtlas(){return this._textureAtlas}get orderTexture(){return this._orderTexture}get fadingTexture(){return this._fadingTexture}get headerTexture(){return this._headerTexture}get textureAtlasMemory(){return this._textureAtlas.usedMemory}get orderTextureMemory(){return this._orderTexture.usedMemory}get fadingTextureMemory(){return this._fadingTexture.usedMemory}get headerTextureMemory(){return this._headerTexture.usedMemory}get sortBufferMemory(){return this._sortBufferMemory}get usedMemory(){return this.textureAtlasMemory+this.headerTextureMemory+this.orderTextureMemory+this.fadingTextureMemory+this.sortBufferMemory}queryVisibleTileDepthRange(e,t){if(0===this.visibleGaussians)return null;const{eye:s,viewForward:i}=e,r=s[0],a=s[1],o=s[2],h=i[0],u=i[1],d=i[2],f=this._visibleTileDepthRange;if(this._previousVisibleTileDepthRangeTilesVersion===this._latestSortedGaussianTilesVersion&&n(this._previousVisibleTileDepthRangeEye,s)&&n(this._previousVisibleTileDepthRangeViewForward,i)&&(null==t?!this._previousVisibleTileDepthRangeHasClippingBox:this._previousVisibleTileDepthRangeHasClippingBox&&_(this._previousVisibleTileDepthRangeClippingBox,t)))return f.near<=f.far?f:null;let m=1/0,g=-1/0;const T=this._latestSortedGaussianTiles;for(let n=0;n<T.length;n++){const e=T[n];if(null!=t){const s=e.boundingBox;if(!c(s,t))continue}const s=h*(e.obbCenterX-r)+u*(e.obbCenterY-a)+d*(e.obbCenterZ-o),i=e.paddedMbsRadius,l=s-i;l<m&&(m=l);const _=s+i;_>g&&(g=_)}const b=m<=g;return b?f.set(m,g):f.set(1/0,-1/0),this._previousVisibleTileDepthRangeTilesVersion=this._latestSortedGaussianTilesVersion,this._previousVisibleTileDepthRangeHasClippingBox=null!=t,l(this._previousVisibleTileDepthRangeEye,s),l(this._previousVisibleTileDepthRangeViewForward,i),null!=t&&p(this._previousVisibleTileDepthRangeClippingBox,t),b?f:null}updateGaussianVisibility(e,t){this._latestUpdatedGaussianTiles=e,this._requestedLyr3dVisibilityChange=t,this.requestSort()}get updating(){return this._updating.value}destroy(){this._sortAbortController=t(this._sortAbortController),this._pendingSortTask=!1,this._updating.value=!1,null!=this._scheduledSortStartTimeout&&(clearTimeout(this._scheduledSortStartTimeout),this._scheduledSortStartTimeout=null),this._frameTask.remove(),this._workerHandle?.destroyWorkerAndSelf(),this._textureAtlas.destroy(),this._headerTexture.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=o()-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(){if(this._isSorting||!this._pendingSortTask)return;const e=new AbortController;this._sortAbortController=e,this._isSorting=!0,this._pendingSortTask=!1,this._lastSortStartTime=o(),this._sortOnWorker(e.signal).finally(()=>{this._sortAbortController===e&&(this._sortAbortController=null),this._handleSortComplete()})}_handleSortComplete(){this._isSorting=!1,this._pendingSortTask?this._scheduleSortStart():this._updating.value=!1}_clearBuffersAndTextures(){this._atlasIndicesBuffer=void 0,this._sortedAtlasIndicesBuffer=void 0,this._distancesBuffer=void 0,this._bufferCapacity=0,this._sortBufferMemory=0,this._orderTexture.clear(),this._textureAtlas.clear(),this._headerTexture.clear()}_computeExpandedCapacity(t,s){let i=Math.max(1,t);for(;i<s;)i=Math.ceil(i*e);return i}_ensureSortBufferCapacities(e){if(this._bufferCapacity<e){const t=this._computeExpandedCapacity(this._bufferCapacity,e);this._atlasIndicesBuffer=new Uint32Array(t),this._sortedAtlasIndicesBuffer=new Uint32Array(t),this._distancesBuffer=new Float64Array(t),this._bufferCapacity=t,this._sortBufferMemory=s(this._atlasIndicesBuffer,this._sortedAtlasIndicesBuffer,this._distancesBuffer)}}_clearAllBuffersAndTextures(){this._clearBuffersAndTextures(),this._latestSortedGaussianTiles.length=0,this._nextCommittedVisibleGaussianTiles.length=0,this._previousVisibleTileDepthRangeTilesVersion=-1,this._workerHandle?.clear()}async _sortOnWorker(e){try{if(0===this._latestUpdatedGaussianTiles.length)return this.visibleGaussians=0,this._clearAllBuffersAndTextures(),this._latestCompletedLyr3dVisibilityChange=this._requestedLyr3dVisibilityChange,this._onSortComplete(this._latestSortedGaussianTiles,this._latestCompletedLyr3dVisibilityChange),void this._renderer.requestRender(1);this._useDeterministicSort&&this._latestUpdatedGaussianTiles.sort((e,t)=>e.obb.centerX-t.obb.centerX||e.obb.centerY-t.obb.centerY||e.obb.centerZ-t.obb.centerZ);const t=this._latestUpdatedGaussianTiles,s=t.length,i=this._requestedLyr3dVisibilityChange;let r=0;for(let e=0;e<s;e++)r+=t[e].gaussianCount;this._ensureSortBufferCapacities(r),this._textureAtlas.ensureTextureAtlas(),this._headerTexture.ensureCapacity(this._textureAtlas.pageAllocator.pageCount);const a=this._renderer.camera;h(this._cameraDirectionNormalized,a.ray.direction);const o=this._cameraDirectionNormalized[0],n=this._cameraDirectionNormalized[1],l=this._cameraDirectionNormalized[2];let u=0;const d=this._atlasIndicesBuffer,_=this._distancesBuffer,p=this._renderer.clippingBox,f=this._nextCommittedVisibleGaussianTiles;f.length=0;let m=0;const{frustum:g}=a,T=this._renderer.tileCullingRevision,b=g[0],S=g[1],y=g[2],x=g[3],C=g[4],A=g[5];for(let e=0;e<s;e++){const s=t[e],{gaussianAtlasIndices:i,relativePositions:r,obbCenterX:a,obbCenterY:h,obbCenterZ:g,paddedMbsRadius:V}=s,v=s.gaussianCount;if(s.cullingRevision!==T){let e=null==p||c(s.boundingBox,p);if(e){const t=1.5*V;e=b[0]*a+b[1]*h+b[2]*g+b[3]<t&&S[0]*a+S[1]*h+S[2]*g+S[3]<t&&y[0]*a+y[1]*h+y[2]*g+y[3]<t&&x[0]*a+x[1]*h+x[2]*g+x[3]<t&&C[0]*a+C[1]*h+C[2]*g+C[3]<t&&A[0]*a+A[1]*h+A[2]*g+A[3]<t}s.cullingRevision=T,s.cullingVisible=e}if(!s.cullingVisible)continue;d.set(i,u),f[m++]=s;const B=o*a+n*h+l*g,G=u+v;for(let e=u,t=0;e<G;e++,t+=3){const s=r[t],i=r[t+1],a=r[t+2];_[e]=s*o+i*n+a*l+B}u=G}if(f.length=m,0===u)return this.visibleGaussians=0,this._clearAllBuffersAndTextures(),this._latestCompletedLyr3dVisibilityChange=i,this._onSortComplete(this._latestSortedGaussianTiles,this._latestCompletedLyr3dVisibilityChange),void this._renderer.requestRender(1);const V={distances:this._distancesBuffer,atlasIndices:this._atlasIndicesBuffer,sortedAtlasIndices:this._sortedAtlasIndicesBuffer,numGaussians:u,preciseSort:this._useDeterministicSort},v=await(this._workerHandle?.sort(V,e));if(e.aborted)return;v&&(this._distancesBuffer=v.distances,this._atlasIndicesBuffer=v.atlasIndices,this._sortedAtlasIndicesBuffer=v.sortedAtlasIndices);const B=async e=>{this._orderTexture.setData(this._sortedAtlasIndicesBuffer,u);const t=this._latestSortedGaussianTiles;this._latestSortedGaussianTiles=f,this._nextCommittedVisibleGaussianTiles=t,this._latestSortedGaussianTilesVersion++,this._latestCompletedLyr3dVisibilityChange=i,this.visibleGaussians=u,this._onSortComplete(this._latestSortedGaussianTiles,this._latestCompletedLyr3dVisibilityChange),this._renderer.requestRender(1),e.madeProgress()};await this._frameTask.schedule(B,e)}catch(t){if(i(t))return}}set useDeterministicSort(e){this._useDeterministicSort=e}}export{C as GaussianSplatDataStore};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import{reallocGrowthFactor as e}from"../../../../core/arrayUtils.js";import{estimateNumberArrayMemory as t}from"../../../../core/memoryEstimations.js";import{fromValues as r}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import"../../../webgl/BufferObject.js";import"../../../webgl/FramebufferObject.js";import"../../../webgl/Program.js";import"../../../../core/has.js";import"../../../webgl/Renderbuffer.js";import s from"../../../webgl/Texture.js";import"../../../../core/Logger.js";import{PixelType as i,SizedPixelFormat as a}from"../../../webgl/enums.js";import"../../../webgl/Util.js";import{initialSplatAtlasTexturePages as o,packedGaussianSizeInU32 as h}from"./GaussianSplatAtlasPages.js";import{TextureDescriptor as u}from"../../../webgl/TextureDescriptor.js";class m{constructor(e){this.texture=null,this._headerTextureCapacity=0,this._rctx=e}get usedMemory(){return(this.texture?.usedMemory??0)+t(this._headerBuffer)}ensureCapacity(t){const r=this.texture;if(this._headerTextureCapacity>=t&&r?.hasWebGLTextureObject)return;const m=Math.max(Math.ceil(t*e),o,this._headerTextureCapacity),[c,p]=this._evalTextureSize(m),l=c*p,f=this._headerBuffer,d=new Uint32Array(l*h);f&&d.set(f.subarray(0,Math.min(f.length,d.length))),this._headerBuffer=d,this._headerTextureCapacity=l,this.texture?.dispose();const n=new u;n.width=c,n.height=p,n.pixelFormat=36249,n.dataType=i.UNSIGNED_INT,n.internalFormat=a.RGBA32UI,n.wrapMode=33071,n.samplingMode=9728,n.isImmutable=!0,this.texture=new s(this._rctx,n),this.texture.updateData(0,0,0,c,p,this._headerBuffer)}update(e,t){this.ensureCapacity(e+1);const r=e*h;this._headerBuffer.set(t,r);const s=this.texture,i=s.descriptor.width,a=e%i,o=Math.floor(e/i);s.updateData(0,a,o,1,1,this._headerBuffer.subarray(r,r+4))}clear(){this.texture?.dispose(),this.texture=null}destroy(){this._headerBuffer=void 0,this._headerTextureCapacity=0,this.clear()}_evalTextureSize(e){const t=Math.ceil(Math.sqrt(e)),s=Math.ceil(e/t);return r(t,s)}}export{m as GaussianSplatHeaderTexture};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{reallocGrowthFactor as t}from"../../../../core/arrayUtils.js";import{initialSplatAtlasTextureHeight as e,GaussianSplatAtlasPages as s,splatAtlasTextureWidth as r,elementsPerSplatPage as a}from"./GaussianSplatAtlasPages.js";import{PixelType as i,SizedPixelFormat as l}from"../../../webgl/enums.js";import{DisposableFramebufferObject as h}from"../../../webgl/FramebufferObject.js";import o from"../../../webgl/Texture.js";import{TextureDescriptor as u}from"../../../webgl/TextureDescriptor.js";class c{constructor(t,r,a,i){this._splatAtlasTextureHeight=e,this.texture=null,this._rctx=t,this._fboCache=a,this._onCachedTextureEvicted=i,this.pageAllocator=new s,this._cache=r.newCache("gaussian texture cache",t=>{t.dispose(),this._onCachedTextureEvicted()})}get usedMemory(){return this.texture?.usedMemory??0}ensureTextureAtlas(){if(this.texture?.hasWebGLTextureObject)return;this.texture=null;const t=this._cache.pop("splatTextureAtlas");if(t)return void(this.texture=t);const e=new u;e.height=this._splatAtlasTextureHeight,e.width=r,e.pixelFormat=36249,e.dataType=i.UNSIGNED_INT,e.internalFormat=l.RGBA32UI,e.samplingMode=9728,e.wrapMode=33071,e.isImmutable=!0,this.texture=new o(this._rctx,e),this._updatePageAllocator()}grow(){if(!this.texture)return this.ensureTextureAtlas(),!1;const e=Math.floor(this._splatAtlasTextureHeight*t);if(e*r>this._rctx.parameters.maxPreferredTexturePixels)return!1;const s=new h(this._rctx,this.texture),a=this._fboCache.acquire(r,e,"gaussian splat atlas resize",12);return this._rctx.blitFramebuffer(s,a.fbo,16384,9728,0,0,r,this._splatAtlasTextureHeight,0,0,r,this._splatAtlasTextureHeight),this.texture=a.fbo?.detachColorTexture(),s.dispose(),a.dispose(),this._splatAtlasTextureHeight=e,this._updatePageAllocator(),!0}requestPage(){let t=this.pageAllocator.findFirstFreePage();return null===t&&this.grow()&&(t=this.pageAllocator.findFirstFreePage()),null!==t&&this.pageAllocator.allocate(t),t}freePage(t){this.pageAllocator.free(t)}update(t,e,s){this.ensureTextureAtlas(),this.texture.updateData(0,t,e,a,1,s)}_updatePageAllocator(){const t=r*this._splatAtlasTextureHeight/a;this.pageAllocator.pageCount!==t&&this.pageAllocator.resize(t)}clear(){this.texture&&(this._cache.put("splatTextureAtlas",this.texture),this.texture=null)}destroy(){this._onCachedTextureEvicted=()=>{},this._cache.destroy(),this.texture?.dispose(),this.texture=null}}export{c as GaussianSplatTextureAtlas};
2
+ import{has}from"../../../../applications/Components/baUtils.js";import{reallocGrowthFactor as t}from"../../../../core/arrayUtils.js";import{initialSplatAtlasTextureHeight as e,GaussianSplatAtlasPages as s,splatAtlasTextureWidth as r,gaussiansPerPage as a}from"./GaussianSplatAtlasPages.js";import{PixelType as i,SizedPixelFormat as l}from"../../../webgl/enums.js";import{DisposableFramebufferObject as o}from"../../../webgl/FramebufferObject.js";import h from"../../../webgl/Texture.js";import{TextureDescriptor as u}from"../../../webgl/TextureDescriptor.js";class c{constructor(t,r,a,i){this._splatAtlasTextureHeight=e,this.texture=null,this._rctx=t,this._fboCache=a,this._onCachedTextureEvicted=i,this.pageAllocator=new s,this._cache=r.newCache("gaussian texture cache",t=>{t.dispose(),this._onCachedTextureEvicted()})}get usedMemory(){return this.texture?.usedMemory??0}ensureTextureAtlas(){if(this.texture?.hasWebGLTextureObject)return;this.texture=null;const t=this._cache.pop("splatTextureAtlas");if(t)return void(this.texture=t);const e=new u;e.height=this._splatAtlasTextureHeight,e.width=r,e.pixelFormat=36249,e.dataType=i.UNSIGNED_INT,e.internalFormat=l.RGBA32UI,e.samplingMode=9728,e.wrapMode=33071,e.isImmutable=!0,this.texture=new h(this._rctx,e),this._updatePageAllocator()}grow(){if(!this.texture)return this.ensureTextureAtlas(),!1;const e=Math.floor(this._splatAtlasTextureHeight*t);if(e>Math.min(has("esri-mobile")?4096:16384,this._rctx.parameters.maxTextureSize))return!1;const s=new o(this._rctx,this.texture),a=this._fboCache.acquire(r,e,"gaussian splat atlas resize",12);return this._rctx.blitFramebuffer(s,a.fbo,16384,9728,0,0,r,this._splatAtlasTextureHeight,0,0,r,this._splatAtlasTextureHeight),this.texture=a.fbo?.detachColorTexture(),s.dispose(),a.dispose(),this._splatAtlasTextureHeight=e,this._updatePageAllocator(),!0}requestPage(){let t=this.pageAllocator.findFirstFreePage();return null===t&&this.grow()&&(t=this.pageAllocator.findFirstFreePage()),null!==t&&this.pageAllocator.allocate(t),t}freePage(t){this.pageAllocator.free(t)}update(t,e,s){this.ensureTextureAtlas(),this.texture.updateData(0,t,e,a,1,s)}_updatePageAllocator(){const t=r*this._splatAtlasTextureHeight/a;this.pageAllocator.pageCount!==t&&this.pageAllocator.resize(t)}clear(){this.texture&&(this._cache.put("splatTextureAtlas",this.texture),this.texture=null)}destroy(){this._onCachedTextureEvicted=()=>{},this._cache.destroy(),this.texture?.dispose(),this.texture=null}}export{c as GaussianSplatTextureAtlas};
@@ -1,9 +1,9 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{clamp as e}from"../../../../../../core/mathUtils.js";import{isColor as s}from"../ShaderOutput.js";import{VertexTextureCoordinates as i}from"../attributes/VertexTextureCoordinates.glsl.js";import{Gamma as o}from"../shading/Gamma.glsl.js";import{Float3DrawUniform as r}from"../../shaderModules/Float3DrawUniform.js";import{Float3PassUniform as m}from"../../shaderModules/Float3PassUniform.js";import{FloatDrawUniform as t}from"../../shaderModules/FloatDrawUniform.js";import{FloatPassUniform as n}from"../../shaderModules/FloatPassUniform.js";import{If as a,glsl as v}from"../../shaderModules/glsl.js";import{Texture2DDrawUniform as l}from"../../shaderModules/Texture2DDrawUniform.js";import{Texture2DPassUniform as u}from"../../shaderModules/Texture2DPassUniform.js";import{maxEmissiveStrength as f}from"../../../shaders/oitResolution.glsl.js";const c=1,d=1;function g(c,g){if(!s(g.output))return;c.fragment.include(o);const{emissionSource:x,hasEmissiveTextureTransform:p,bindType:h}=g,j=3===x||4===x||5===x;j&&(c.include(i,g),c.fragment.uniforms.add(1===h?new u("texEmission",e=>e.textureEmissive):new l("texEmission",e=>e.textureEmissive)));const T=2===x||j;T&&c.fragment.uniforms.add(1===h?new m("emissiveBaseColor",e=>e.emissiveBaseColor):new r("emissiveBaseColor",e=>e.emissiveBaseColor));const w=0!==x;if(w&&!(7===x||6===x||4===x||5===x)){const s=s=>e(s??0,0,f);c.fragment.uniforms.add(1===h?new n("emissiveStrength",e=>s(e.emissiveStrength)):new t("emissiveStrength",e=>s(e.emissiveStrength)))}const C=7===x,b=5===x,F=1===x||6===x||C;c.fragment.code.add(v`
2
+ import{clamp as e}from"../../../../../../core/mathUtils.js";import{isColor as s}from"../ShaderOutput.js";import{VertexTextureCoordinates as i}from"../attributes/VertexTextureCoordinates.glsl.js";import{Gamma as o}from"../shading/Gamma.glsl.js";import{Float3DrawUniform as r}from"../../shaderModules/Float3DrawUniform.js";import{Float3PassUniform as m}from"../../shaderModules/Float3PassUniform.js";import{FloatDrawUniform as t}from"../../shaderModules/FloatDrawUniform.js";import{FloatPassUniform as n}from"../../shaderModules/FloatPassUniform.js";import{If as a,glsl as v}from"../../shaderModules/glsl.js";import{Texture2DDrawUniform as l}from"../../shaderModules/Texture2DDrawUniform.js";import{Texture2DPassUniform as u}from"../../shaderModules/Texture2DPassUniform.js";import{maxEmissiveStrength as f}from"../../../shaders/oitResolution.glsl.js";const c=1,d=1;function g(c,g){if(!s(g.output))return;c.fragment.include(o);const{emissionSource:x,hasEmissiveTextureTransform:p,bindType:h}=g,j=3===x||4===x||5===x;j&&(c.include(i,g),c.fragment.uniforms.add(1===h?new u("texEmission",e=>e.textureEmissive):new l("texEmission",e=>e.textureEmissive)));const T=2===x||j;T&&c.fragment.uniforms.add(1===h?new m("emissiveBaseColor",e=>e.emissiveBaseColor):new r("emissiveBaseColor",e=>e.emissiveBaseColor));const C=0!==x;if(C&&!(7===x||6===x||4===x||5===x)){const s=s=>e(s??0,0,f);c.fragment.uniforms.add(1===h?new n("emissiveStrength",e=>s(e.emissiveStrength)):new t("emissiveStrength",e=>s(e.emissiveStrength)))}const b=7===x,F=5===x,S=1===x||6===x||b;c.fragment.code.add(v`
3
3
  vec4 getEmissions(vec3 symbolColor) {
4
- vec4 emissions = ${T?b?"emissiveSource == 0 ? vec4(emissiveBaseColor, 1.0): vec4(linearizeGamma(symbolColor), 1.0)":"vec4(emissiveBaseColor, 1.0)":F?C?"emissiveSource == 0 ? vec4(0.0): vec4(linearizeGamma(symbolColor), 1.0)":"vec4(linearizeGamma(symbolColor), 1.0)":"vec4(0.0)"};
5
- ${a(j,`${a(b,`if(emissiveSource == 0) {\n vec4 emissiveFromTex = textureLookup(texEmission, ${p?"emissiveUV":"vuv0"});\n emissions *= vec4(linearizeGamma(emissiveFromTex.rgb), emissiveFromTex.a);\n }`,`vec4 emissiveFromTex = textureLookup(texEmission, ${p?"emissiveUV":"vuv0"});\n emissions *= vec4(linearizeGamma(emissiveFromTex.rgb), emissiveFromTex.a);`)}\n emissions.w = emissions.rgb == vec3(0.0) ? 0.0: emissions.w;`)}
6
- ${a(w,`emissions.rgb *= emissiveStrength * ${v.float(d)};`)}
4
+ vec4 emissions = ${T?F?"emissiveSource == 0 ? vec4(emissiveBaseColor, 1.0): vec4(linearizeGamma(symbolColor), 1.0)":"vec4(emissiveBaseColor, 1.0)":S?b?"emissiveSource == 0 ? vec4(0.0): vec4(linearizeGamma(symbolColor), 1.0)":"vec4(linearizeGamma(symbolColor), 1.0)":"vec4(0.0)"};
5
+ ${a(j,`${a(F,`if(emissiveSource == 0) {\n vec4 emissiveFromTex = textureLookup(texEmission, ${p?"emissiveUV":"vuv0"});\n emissions *= vec4(linearizeGamma(emissiveFromTex.rgb), emissiveFromTex.a);\n }`,`vec4 emissiveFromTex = textureLookup(texEmission, ${p?"emissiveUV":"vuv0"});\n emissions *= vec4(linearizeGamma(emissiveFromTex.rgb), emissiveFromTex.a);`)}\n emissions.a = emissions.rgb == vec3(0.0) ? 0.0: emissions.a;`)}
6
+ ${a(C,`emissions.rgb *= emissiveStrength * ${v.float(d)};`)}
7
7
  return emissions;
8
8
  }
9
9
  `)}export{g as Emissions,d as emissiveStrengthBoost,c as emissiveStrengthDefault};
@@ -1,5 +1,5 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{splatAtlasTextureWidth as e,elementsPerSplatPage as a}from"../../../../support/gaussianSplatting/GaussianSplatAtlasPages.js";import{glsl as n}from"../../shaderModules/glsl.js";function i(e){e.code.add(n`
2
+ import{splatAtlasTextureWidth as e,gaussiansPerPage as a}from"../../../../support/gaussianSplatting/GaussianSplatAtlasPages.js";import{glsl as n}from"../../shaderModules/glsl.js";function t(e){e.code.add(n`
3
3
  uint fetchOrderedGaussianIndex(uint instanceID) {
4
4
  uint orderTextureWidth = uint(textureSize(splatOrderTexture, 0).x);
5
5
  uint x = instanceID % orderTextureWidth;
@@ -9,18 +9,23 @@ import{splatAtlasTextureWidth as e,elementsPerSplatPage as a}from"../../../../su
9
9
  }
10
10
 
11
11
  uvec4 fetchPackedGaussian(uint gaussianIndex) {
12
- uint gaussianIndexX = gaussianIndex & ${t}u;
13
- uint gaussianIndexY = gaussianIndex >> ${s}u;
12
+ uint gaussianIndexX = gaussianIndex & ${n.uint(i)};
13
+ uint gaussianIndexY = gaussianIndex >> ${n.uint(s)};
14
14
 
15
15
  return texelFetch(splatAtlasTexture, ivec2(gaussianIndexX, gaussianIndexY), 0);
16
16
  }
17
17
 
18
+ uint fetchGaussianPageIndex(uint gaussianIndex) {
19
+ return gaussianIndex >> ${n.uint(u)};
20
+ }
21
+
18
22
  uvec4 fetchPackedGaussianHeader(uint gaussianIndex) {
19
- uint headerIndex = gaussianIndex | ${u}u;
20
- uint headerIndexX = headerIndex & ${t}u;
21
- uint headerIndexY = headerIndex >> ${s}u;
23
+ uint pageIndex = fetchGaussianPageIndex(gaussianIndex);
24
+ uint headerTextureWidth = uint(textureSize(splatHeaderTexture, 0).x);
25
+ uint headerIndexX = pageIndex % headerTextureWidth;
26
+ uint headerIndexY = pageIndex / headerTextureWidth;
22
27
 
23
- return texelFetch(splatAtlasTexture, ivec2(headerIndexX, headerIndexY), 0);
28
+ return texelFetch(splatHeaderTexture, ivec2(headerIndexX, headerIndexY), 0);
24
29
  }
25
30
 
26
31
  vec3 fetchGaussianCameraRelativePosition(uint gaussianIndex, uvec4 packedGaussian) {
@@ -29,8 +34,4 @@ import{splatAtlasTextureWidth as e,elementsPerSplatPage as a}from"../../../../su
29
34
 
30
35
  return unpackCameraRelativeGaussianPosition(packedHeader, tileOriginRelativePosition);
31
36
  }
32
-
33
- uint fetchGaussianPageIndex(uint gaussianIndex) {
34
- return gaussianIndex >> ${d}u;
35
- }
36
- `)}const t=""+(e-1),s=`${Math.log2(e)}`,u=""+(a-1),d=`${Math.log2(a)}`;export{i as GaussianSplatTextureFetch};
37
+ `)}const i=e-1,s=Math.log2(e),u=Math.log2(a);export{t as GaussianSplatTextureFetch};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as t}from"tslib";import{releaseMaybe as e}from"../../../../../core/maybe.js";import{watch as i,syncAndInitial as r}from"../../../../../core/reactiveUtils.js";import{property as s,subclass as o}from"../../../../../core/accessorSupport/decorators.js";import{set as a}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{length as n}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{ZEROS as h}from"../../../../../core/libs/gl-matrix-2/factories/vec4f32.js";import{getReferenceEllipsoid as l}from"../../../../../geometry/ellipsoidUtils.js";import{InternalRenderCategory as c}from"../../../webgl.js";import{TransparentEnvironment as m}from"../TransparentEnvironment.js";import{G as u}from"../../../../../chunks/GlowBlur.glsl.js";import{GlowBlurTechnique as p}from"./GlowBlurTechnique.js";import{GlowBlurTechniqueConfiguration as _}from"./GlowBlurTechniqueConfiguration.js";import{G as g,a as d,m as b}from"../../../../../chunks/GlowComposition.glsl.js";import{GlowCompositionTechnique as f}from"./GlowCompositionTechnique.js";import{GlowCompositionTechniqueConfiguration as P}from"./GlowCompositionTechniqueConfiguration.js";import{floatBlendReductionFactor as w}from"../../shaders/oitResolution.glsl.js";import{ColorAttachment1 as C,DepthStencilAttachment as T}from"../../../../webgl/enums.js";let v=class extends m{constructor(t){super(t),this.consumes={required:[c.TRANSPARENT_ENVIRONMENT,"emissive"]},this.produces=c.TRANSPARENT_ENVIRONMENT,this._scatteringFactors={realistic:new g([.8,.12,.05,.02,.01,0],1),cartographicMin:new g([.4,.18,.25,.12,.05,0],1),cartographicDefault:new g([1.17,1.08,.78,.4,.26,.11],4),cartographicMax:new g([3.59,3.9,2.46,1.4,.93,.44],13)},this._blurHorizontalConfiguration=new _,this._blurVerticalConfiguration=new _,this._compositeConfiguration=new P,this._compositionParameters=new d,this._blurParameters=new u,this._blurScalePerLod=3.06,this._logicalBlurRadius=.0037;const e=l(t.view.spatialReference);this._atmosphereRadius=e.radius+e.atmosphereHeight,this._blurVerticalConfiguration.glowStage=1}initialize(){this.addHandles([i(()=>this._updateParameters(),()=>{},r)])}_updateParameters(){this._compositionParameters.minDisperse.preset=this._preset,this.requestRender(1)}_updateConfigurations(){this._compositeConfiguration.useFloatBlend=this._blurHorizontalConfiguration.useFloatBlend=this._blurVerticalConfiguration.useFloatBlend=this.bindParameters.useFloatBlend.value,this._compositeConfiguration.blurEnabled=2!==this._mode}precompile(){this._updateConfigurations(),this._compositeConfiguration.blurEnabled&&(this.techniques.precompile(p,this._blurHorizontalConfiguration),this.techniques.precompile(p,this._blurVerticalConfiguration)),this.techniques.precompile(f,this._compositeConfiguration)}render(t){const i=t.find(({name:t})=>t===c.TRANSPARENT_ENVIRONMENT),r=i.getAttachment(C);if(!r?.attachment)return i;const s=i.getTexture(),o=i.getAttachment(T),a=this.fboCache,{fullWidth:h,fullHeight:l}=this.bindParameters.camera,m=this.renderingContext;this._updateConfigurations();const u=this.camera,p=n(u.eye);if(this._compositionParameters.fogOpacity=this.view.stage.renderView.fog?.strength??0,this._compositionParameters.color=s,this._compositionParameters.emission=r.attachment,this._compositionParameters.atmosphereC=p**2-this._atmosphereRadius**2,!this._compositeConfiguration.blurEnabled){const t=a.acquire(s.descriptor.width,s.descriptor.height,this.produces);this._setupFBO(t,h,l);const e=this.techniques.get(f,this._compositeConfiguration);return m.bindTechnique(e,this.bindParameters,this._compositionParameters),m.screen.draw(),t.attachDepth(o),t.attachColor(r,C),t}this._renderGlowMipMap();const _=a.acquire(s.descriptor.width,s.descriptor.height,this.produces);_.acquireColor(C,this.bindParameters.useFloatBlend.value?8:5,"emissive glow"),this._setupFBO(_,h,l,!0);const g=this.techniques.get(f,this._compositeConfiguration);return m.bindTechnique(g,this.bindParameters,this._compositionParameters),m.screen.draw(),this._compositionParameters.lodTexture=e(this._compositionParameters.lodTexture),_.attachDepth(o),_}_renderGlowMipMap(){const t=this.fboCache,{fullWidth:e,fullHeight:i}=this.camera,r=this.renderingContext,s=5,o=this.techniques.get(p,this._blurHorizontalConfiguration),n=this.techniques.get(p,this._blurVerticalConfiguration);this._blurParameters.input=this._compositionParameters.emission,this._blurParameters.inputScale=w,this._blurParameters.level=0,this._blurParameters.blurRadius=this._logicalBlurRadius,a(this._blurParameters.size,.5*e,.5*i);let h=Math.floor(this._blurParameters.size[0]),l=Math.floor(this._blurParameters.size[1]);const c=t.acquire(h,l,"glow horizontal",8);for(this._compositionParameters.lodTexture=t.acquire(h,l,"glow mipmap",9);h>1&&l>1&&this._blurParameters.level<s;)this._setupFBO(c,h,l),r.bindTechnique(o,this.bindParameters,this._blurParameters),r.screen.draw(),t.debugCallback?.(`glow horizontal ${this._blurParameters.level}`,c.fbo),this._blurParameters.inputScale=1,this._blurParameters.input=c.getTexture(),this._setupFBO(this._compositionParameters.lodTexture,h,l,!1,this._blurParameters.level),r.bindTechnique(n,this.bindParameters,this._blurParameters),r.screen.draw(),t.debugCallback?.(this._compositionParameters.lodTexture.name,this._compositionParameters.lodTexture.fbo),a(this._blurParameters.size,.5*h,.5*l),h=Math.floor(this._blurParameters.size[0]),l=Math.floor(this._blurParameters.size[1]),this._blurParameters.input=this._compositionParameters.lodTexture.getTexture(),this._blurParameters.blurRadius*=this._blurScalePerLod,++this._blurParameters.level;c.release(),this._compositionParameters.lodTexture.fbo.level=0}get _preset(){return 0===this._mode?this._scatteringFactors.realistic.preset:this._intensity<=.5?b(this._scatteringFactors.cartographicMin.preset,this._scatteringFactors.cartographicDefault.preset,2*this._intensity):b(this._scatteringFactors.cartographicDefault.preset,this._scatteringFactors.cartographicMax.preset,2*(this._intensity-.5))}get _mode(){return null==this.view.environment.lighting.glow?this.view.environment.atmosphereEnabled?0:2:1}get _intensity(){return this.view.environment.lighting.glow?.intensity??0}_setupFBO(t,e,i,r=!1,s=0){t.fbo.level=s;const o=this.renderingContext;o.bindFramebuffer(t.fbo),o.setViewport(0,0,e,i),o.setClearColor(0,0,0,0),o.clear(16384),r&&o.clearBuffer(1,h)}get test(){return{compositionParameters:this._compositionParameters,blurParameters:this._blurParameters,preset:this._preset,setMinDisperse:(t,e)=>{0===this._mode?this._scatteringFactors.realistic.preset[t]=e:(this._scatteringFactors.cartographicMin.preset[t]=e,this._scatteringFactors.cartographicMax.preset[t]=e)}}}};t([s()],v.prototype,"consumes",void 0),t([s()],v.prototype,"produces",void 0),v=t([o("esri.views.3d.webgl-engine.effects.glow.Glow")],v);export{v as Glow};
2
+ import{__decorate as t}from"tslib";import{releaseMaybe as e}from"../../../../../core/maybe.js";import{watch as i,syncAndInitial as r}from"../../../../../core/reactiveUtils.js";import{property as s,subclass as o}from"../../../../../core/accessorSupport/decorators.js";import{set as a}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{length as n}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{ZEROS as h}from"../../../../../core/libs/gl-matrix-2/factories/vec4f32.js";import{getReferenceEllipsoid as l}from"../../../../../geometry/ellipsoidUtils.js";import{InternalRenderCategory as c}from"../../../webgl.js";import{TransparentEnvironment as m}from"../TransparentEnvironment.js";import{G as u}from"../../../../../chunks/GlowBlur.glsl.js";import{GlowBlurTechnique as p}from"./GlowBlurTechnique.js";import{GlowBlurTechniqueConfiguration as _}from"./GlowBlurTechniqueConfiguration.js";import{G as g,a as d,m as b}from"../../../../../chunks/GlowComposition.glsl.js";import{GlowCompositionTechnique as f}from"./GlowCompositionTechnique.js";import{GlowCompositionTechniqueConfiguration as P}from"./GlowCompositionTechniqueConfiguration.js";import{floatBlendReductionFactor as w}from"../../shaders/oitResolution.glsl.js";import{ColorAttachment1 as C,DepthStencilAttachment as T}from"../../../../webgl/enums.js";let v=class extends m{constructor(t){super(t),this.consumes={required:[c.TRANSPARENT_ENVIRONMENT,"emissive"]},this.produces=c.TRANSPARENT_ENVIRONMENT,this._scatteringFactors={realistic:new g([.9,.06,.03,.01,0,0],1),cartographicMin:new g([.58,.18,.12,.08,.04,0],1),cartographicDefault:new g([.99,.95,.75,.2,.1,.01],3),cartographicMax:new g([2.8,2.32,2.05,1.4,.4,.03],9)},this._blurHorizontalConfiguration=new _,this._blurVerticalConfiguration=new _,this._compositeConfiguration=new P,this._compositionParameters=new d,this._blurParameters=new u,this._blurScalePerLod=3.06,this._logicalBlurRadius=.0037;const e=l(t.view.spatialReference);this._atmosphereRadius=e.radius+e.atmosphereHeight,this._blurVerticalConfiguration.glowStage=1}initialize(){this.addHandles([i(()=>this._updateParameters(),()=>{},r)])}_updateParameters(){this._compositionParameters.minDisperse.preset=this._preset,this.requestRender(1)}_updateConfigurations(){this._compositeConfiguration.useFloatBlend=this._blurHorizontalConfiguration.useFloatBlend=this._blurVerticalConfiguration.useFloatBlend=this.bindParameters.useFloatBlend.value,this._compositeConfiguration.blurEnabled=2!==this._mode}precompile(){this._updateConfigurations(),this._compositeConfiguration.blurEnabled&&(this.techniques.precompile(p,this._blurHorizontalConfiguration),this.techniques.precompile(p,this._blurVerticalConfiguration)),this.techniques.precompile(f,this._compositeConfiguration)}render(t){const i=t.find(({name:t})=>t===c.TRANSPARENT_ENVIRONMENT),r=i.getAttachment(C);if(!r?.attachment)return i;const s=i.getTexture(),o=i.getAttachment(T),a=this.fboCache,{fullWidth:h,fullHeight:l}=this.bindParameters.camera,m=this.renderingContext;this._updateConfigurations();const u=this.camera,p=n(u.eye);if(this._compositionParameters.fogOpacity=this.view.stage.renderView.fog?.strength??0,this._compositionParameters.color=s,this._compositionParameters.emission=r.attachment,this._compositionParameters.atmosphereC=p**2-this._atmosphereRadius**2,!this._compositeConfiguration.blurEnabled){const t=a.acquire(s.descriptor.width,s.descriptor.height,this.produces);this._setupFBO(t,h,l);const e=this.techniques.get(f,this._compositeConfiguration);return m.bindTechnique(e,this.bindParameters,this._compositionParameters),m.screen.draw(),t.attachDepth(o),t.attachColor(r,C),t}this._renderGlowMipMap();const _=a.acquire(s.descriptor.width,s.descriptor.height,this.produces);_.acquireColor(C,this.bindParameters.useFloatBlend.value?8:5,"emissive glow"),this._setupFBO(_,h,l,!0);const g=this.techniques.get(f,this._compositeConfiguration);return m.bindTechnique(g,this.bindParameters,this._compositionParameters),m.screen.draw(),this._compositionParameters.lodTexture=e(this._compositionParameters.lodTexture),_.attachDepth(o),_}_renderGlowMipMap(){const t=this.fboCache,{fullWidth:e,fullHeight:i}=this.camera,r=this.renderingContext,s=5,o=this.techniques.get(p,this._blurHorizontalConfiguration),n=this.techniques.get(p,this._blurVerticalConfiguration);this._blurParameters.input=this._compositionParameters.emission,this._blurParameters.inputScale=w,this._blurParameters.level=0,this._blurParameters.blurRadius=this._logicalBlurRadius,a(this._blurParameters.size,.5*e,.5*i);let h=Math.floor(this._blurParameters.size[0]),l=Math.floor(this._blurParameters.size[1]);const c=t.acquire(h,l,"glow horizontal",8);for(this._compositionParameters.lodTexture=t.acquire(h,l,"glow mipmap",9);h>1&&l>1&&this._blurParameters.level<s;)this._setupFBO(c,h,l),r.bindTechnique(o,this.bindParameters,this._blurParameters),r.screen.draw(),t.debugCallback?.(`glow horizontal ${this._blurParameters.level}`,c.fbo),this._blurParameters.inputScale=1,this._blurParameters.input=c.getTexture(),this._setupFBO(this._compositionParameters.lodTexture,h,l,!1,this._blurParameters.level),r.bindTechnique(n,this.bindParameters,this._blurParameters),r.screen.draw(),t.debugCallback?.(this._compositionParameters.lodTexture.name,this._compositionParameters.lodTexture.fbo),a(this._blurParameters.size,.5*h,.5*l),h=Math.floor(this._blurParameters.size[0]),l=Math.floor(this._blurParameters.size[1]),this._blurParameters.input=this._compositionParameters.lodTexture.getTexture(),this._blurParameters.blurRadius*=this._blurScalePerLod,++this._blurParameters.level;c.release(),this._compositionParameters.lodTexture.fbo.level=0}get _preset(){return 0===this._mode?this._scatteringFactors.realistic.preset:this._intensity<=.5?b(this._scatteringFactors.cartographicMin.preset,this._scatteringFactors.cartographicDefault.preset,2*this._intensity):b(this._scatteringFactors.cartographicDefault.preset,this._scatteringFactors.cartographicMax.preset,2*(this._intensity-.5))}get _mode(){return null==this.view.environment.lighting.glow?this.view.environment.atmosphereEnabled?0:2:1}get _intensity(){return this.view.environment.lighting.glow?.intensity??0}_setupFBO(t,e,i,r=!1,s=0){t.fbo.level=s;const o=this.renderingContext;o.bindFramebuffer(t.fbo),o.setViewport(0,0,e,i),o.setClearColor(0,0,0,0),o.clear(16384),r&&o.clearBuffer(1,h)}get test(){return{compositionParameters:this._compositionParameters,blurParameters:this._blurParameters,preset:this._preset,setMinDisperse:(t,e)=>{0===this._mode?this._scatteringFactors.realistic.preset[t]=e:(this._scatteringFactors.cartographicMin.preset[t]=e,this._scatteringFactors.cartographicMax.preset[t]=e)}}}};t([s()],v.prototype,"consumes",void 0),t([s()],v.prototype,"produces",void 0),v=t([o("esri.views.3d.webgl-engine.effects.glow.Glow")],v);export{v as Glow};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{watch as i}from"../../../../core/reactiveUtils.js";import{property as t,subclass as s}from"../../../../core/accessorSupport/decorators.js";import{set as a}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{copy as r,set as o,scale as n,floor as h,subtract as l}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as p}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as u,set as m,positiveInfinity as c,equals as d}from"../../../../geometry/support/aaBoundingBox.js";import{InternalRenderCategory as _}from"../../webgl.js";import{addWraparound as g}from"../../layers/i3s/I3SUtil.js";import C from"../../webgl/RenderNode.js";import{G as f}from"../../../../chunks/GaussianSplat.glsl.js";import{G as P}from"../../../../chunks/GaussianSplatComposition.glsl.js";import{GaussianSplatCompositionTechnique as b}from"../shaders/GaussianSplatCompositionTechnique.js";import{GaussianSplatCompositionTechniqueConfiguration as v}from"../shaders/GaussianSplatCompositionTechniqueConfiguration.js";import{G as S}from"../../../../chunks/GaussianSplatDepthComposition.glsl.js";import{GaussianSplatDepthCompositionTechnique as x}from"../shaders/GaussianSplatDepthCompositionTechnique.js";import{GaussianSplatTechnique as q}from"../shaders/GaussianSplatTechnique.js";import{GaussianSplatTechniqueConfiguration as w}from"../shaders/GaussianSplatTechniqueConfiguration.js";import{ColorAttachment1 as R,DepthStencilAttachment as E,PrimitiveType as D}from"../../../webgl/enums.js";var y;let T=class extends C{static{y=this}constructor(e){super(e),this.produces=_.GAUSSIAN_SPLAT,this._slicePlaneEnabled=!1,this.layerView=null,this._passParameters=new f,this._compositionPassParameters=new P,this._depthCompositionPassParameters=new S,this._compositionConfiguration=new v,this._clipBox=u(),this._previousCameraDirection=p(),this._previousSortRequestCameraDirection=p(),this._tileCullingRevision=0,this._sortRequestDirectionEpsilon=.01,this._directionChangeEpsilon=.001,this._configuration=new w(e.view.state.isGlobal),m(this._clipBox,c)}async initialize(){this.addHandles([i(()=>this.view.state.camera,()=>this._onCameraChange()),i(()=>2===this.view.state.mode,()=>this.requestRender(1))])}precompile(){this._updateConfigurations(),this._compositionConfiguration.useFloatBlend=this.bindParameters.useFloatBlend.value,this._compositionConfiguration.hasEmission=this.bindParameters.hasOpaqueEmission,this.techniques.precompile(q,this._configuration),this.techniques.precompile(b,this._compositionConfiguration),this.techniques.precompile(x)}render(e){const i=e.find(({name:e})=>e===this.produces);if(this._updateConfigurations(),this._handleFading(),!this._data.visibleGaussians||!this._data.orderTexture.texture||!this._data.textureAtlas.texture)return i;const t=i.getAttachment(R);this._compositionConfiguration.useFloatBlend=this.bindParameters.useFloatBlend.value,this._compositionConfiguration.hasEmission=null!=t;const{fullWidth:s,fullHeight:a}=this.bindParameters.camera;this._prepareParameters(a,s);const r=this.renderingContext,o=this.fboCache,n=o.acquire(s,a,"gaussian color output"),h=i.getAttachment(E);n.attachDepth(h);const l=this.techniques.get(q,this._configuration);this._renderGaussianColorAndDepth(n,l);const p=o.acquire(s,a,this.produces);this._depthCompositionPassParameters.splatDepth=n.getTexture(R),p.attachDepth(i.getAttachment(E)),r.bindFramebuffer(p.fbo);const u=this.techniques.get(x);r.bindTechnique(u,this.bindParameters,this._depthCompositionPassParameters),r.screen.draw(),this._compositionPassParameters.color=i.getTexture(),this._compositionPassParameters.splatColor=n.getTexture(),t?(p.acquireColor(R,8,"emissive"),this._compositionPassParameters.emission=i.getTexture(R)):this._compositionPassParameters.emission=null,r.bindFramebuffer(p.fbo);const m=this.techniques.get(b,this._compositionConfiguration);return r.bindTechnique(m,this.bindParameters,this._compositionPassParameters),r.screen.draw(),n.release(),p}get slicePlaneEnabled(){return this._slicePlaneEnabled}set slicePlaneEnabled(e){this._slicePlaneEnabled!==e&&(this._slicePlaneEnabled=e,this.requestRender(1))}set clippingBox(e){const i=e||c;this._hasSameClipBox(i)||(m(this._clipBox,i),this._tileCullingRevision=g(this._tileCullingRevision,1),this._data.requestSort(),this.requestRender(1))}get clippingBox(){return this._clippingEnabled?this._clipBox:null}get tileCullingRevision(){return this._tileCullingRevision}get _clippingEnabled(){return!d(this._clipBox,c,(e,i)=>e===i)}get _isIdle(){return 2===this.view.state.mode}get _data(){return this.layerView.data}get _fadeHelper(){return this.layerView.fadeHelper}_updateConfigurations(){const{idleMinimumOpacity:e,nonIdleMinimumOpacity:i}=this.view.qualitySettings.gaussianSplat;this._configuration.alphaCutoff=this._isIdle?e:i,this._configuration.fadingEnabled=this._fadeHelper.fadingEnabled,this._configuration.receiveShadows=this.bindParameters.shadowMap.ready,this._configuration.hasShadowHighlights=this._configuration.receiveShadows&&this.bindParameters.hasShadowHighlights,this._configuration.clippingEnabled=this._clippingEnabled,this._configuration.hasSlicePlane=this._slicePlaneEnabled&&null!=this.bindParameters.slicePlane}_onCameraChange(){this._tileCullingRevision=g(this._tileCullingRevision,1);const e=this.view.state.camera.ray.direction;if(!this._directionChanged(e))return;if(r(this._previousCameraDirection,e),!this._shouldRequestSort(e))return;this._data.requestSort()&&r(this._previousSortRequestCameraDirection,e)}_directionChanged(e){return Math.abs(e[0]-this._previousCameraDirection[0])>this._directionChangeEpsilon||Math.abs(e[1]-this._previousCameraDirection[1])>this._directionChangeEpsilon||Math.abs(e[2]-this._previousCameraDirection[2])>this._directionChangeEpsilon}_shouldRequestSort(e){return Math.abs(e[0]-this._previousSortRequestCameraDirection[0])>this._sortRequestDirectionEpsilon||Math.abs(e[1]-this._previousSortRequestCameraDirection[1])>this._sortRequestDirectionEpsilon||Math.abs(e[2]-this._previousSortRequestCameraDirection[2])>this._sortRequestDirectionEpsilon}_prepareParameters(e,i){this._passParameters.splatOrder=this._data.orderTexture.texture,this._passParameters.splatFading=this._data.fadingTexture.texture,this._passParameters.splatAtlas=this._data.textureAtlas.texture;const t=Math.tan(.5*this.camera.fovY),s=t/e*i;a(this._passParameters.tanFov,s,t),this._passParameters.focalLength=e/(2*t);const o=this.view.qualitySettings.gaussianSplat,n=this._isIdle?o.idleMinimumSplatPixelRadius:o.nonIdleMinimumSplatPixelRadius;this._passParameters.minSplatRadius=n*Math.sqrt(i*e)/Math.sqrt(2073600),r(this._passParameters.origin,this.bindParameters.camera.eye),this._prepareHighPrecisionCameraPosition(),this._updateSlicePlaneLocalOrigin(),this._updateClipUniforms()}_updateClipUniforms(){const e=this.clippingBox||c,[i,t,s,a,r,n]=e,[h,l,p]=this.camera.eye,{clipMinCameraRelative:u,clipMaxCameraRelative:m}=this._passParameters;o(u,i-h,t-l,s-p),o(m,a-h,r-l,n-p)}_updateSlicePlaneLocalOrigin(){this._passParameters.slicePlaneLocalOrigin=this.camera.eye}_hasSameClipBox(e){return d(this._clipBox,e,(e,i)=>e===i)}_renderGaussianColorAndDepth(e,i){const t=this.renderingContext;e.acquireColor(R,5,"gaussian depth output"),t.bindFramebuffer(e.fbo),t.setClearColor(0,0,0,0),t.clear(16384),this.renderingContext.bindTechnique(i,this.bindParameters,this._passParameters),this.renderingContext.drawArraysInstanced(D.TRIANGLE_STRIP,0,4,this._data.visibleGaussians)}_prepareHighPrecisionCameraPosition(){n(this._passParameters.tileCameraPosition,this.camera.eye,1/y.tileSize),h(this._passParameters.tileCameraPosition,this._passParameters.tileCameraPosition),n(this._passParameters.cameraDelta,this._passParameters.tileCameraPosition,y.tileSize),l(this._passParameters.cameraDelta,this.camera.eye,this._passParameters.cameraDelta)}_handleFading(){if(0===this._fadeHelper.numFadingTiles)return void(this._previousFrameStart=null);this._previousFrameStart??=this.view.stage.renderer.renderContext.time;const e=this.view.stage?.renderer.renderContext.time-this._previousFrameStart;this._fadeHelper.updateAllTileFading(e),this._previousFrameStart=this.view.stage.renderer.renderContext.time,this._data.fadingTexture.updateTexture(this._data.textureAtlas.pageAllocator.pageCount)}static{this.tileSize=2.048}};e([t()],T.prototype,"produces",void 0),e([t({constructOnly:!0})],T.prototype,"layerView",void 0),T=y=e([s("esri.views.3d.webgl-engine.lib.GaussianSplatRenderNode")],T);export{T as GaussianSplatRenderNode};
2
+ import{__decorate as e}from"tslib";import{watch as t}from"../../../../core/reactiveUtils.js";import{property as i,subclass as s}from"../../../../core/accessorSupport/decorators.js";import{set as a}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{copy as r,set as o,scale as n,floor as h,subtract as l}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as p}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as u,set as m,positiveInfinity as c,equals as d}from"../../../../geometry/support/aaBoundingBox.js";import{InternalRenderCategory as _}from"../../webgl.js";import{addWraparound as g}from"../../layers/i3s/I3SUtil.js";import C from"../../webgl/RenderNode.js";import{G as f}from"../../../../chunks/GaussianSplat.glsl.js";import{G as P}from"../../../../chunks/GaussianSplatComposition.glsl.js";import{GaussianSplatCompositionTechnique as b}from"../shaders/GaussianSplatCompositionTechnique.js";import{GaussianSplatCompositionTechniqueConfiguration as v}from"../shaders/GaussianSplatCompositionTechniqueConfiguration.js";import{G as x}from"../../../../chunks/GaussianSplatDepthComposition.glsl.js";import{GaussianSplatDepthCompositionTechnique as S}from"../shaders/GaussianSplatDepthCompositionTechnique.js";import{GaussianSplatTechnique as q}from"../shaders/GaussianSplatTechnique.js";import{GaussianSplatTechniqueConfiguration as w}from"../shaders/GaussianSplatTechniqueConfiguration.js";import{ColorAttachment1 as R,DepthStencilAttachment as E,PrimitiveType as D}from"../../../webgl/enums.js";var T;let y=class extends C{static{T=this}constructor(e){super(e),this.produces=_.GAUSSIAN_SPLAT,this._slicePlaneEnabled=!1,this.layerView=null,this._passParameters=new f,this._compositionPassParameters=new P,this._depthCompositionPassParameters=new x,this._compositionConfiguration=new v,this._clipBox=u(),this._previousCameraDirection=p(),this._previousSortRequestCameraDirection=p(),this._tileCullingRevision=0,this._sortRequestDirectionEpsilon=.01,this._directionChangeEpsilon=.001,this._configuration=new w(e.view.state.isGlobal),m(this._clipBox,c)}async initialize(){this.addHandles([t(()=>this.view.state.camera,()=>this._onCameraChange()),t(()=>2===this.view.state.mode,()=>this.requestRender(1))])}precompile(){this._updateConfigurations(),this._compositionConfiguration.useFloatBlend=this.bindParameters.useFloatBlend.value,this._compositionConfiguration.hasEmission=this.bindParameters.hasOpaqueEmission,this.techniques.precompile(q,this._configuration),this.techniques.precompile(b,this._compositionConfiguration),this.techniques.precompile(S)}render(e){const t=e.find(({name:e})=>e===this.produces);if(this._updateConfigurations(),this._handleFading(),!(this._data.visibleGaussians&&this._data.orderTexture.texture&&this._data.textureAtlas.texture&&this._data.headerTexture.texture))return t;const i=t.getAttachment(R);this._compositionConfiguration.useFloatBlend=this.bindParameters.useFloatBlend.value,this._compositionConfiguration.hasEmission=null!=i;const{fullWidth:s,fullHeight:a}=this.bindParameters.camera;this._prepareParameters(a,s);const r=this.renderingContext,o=this.fboCache,n=o.acquire(s,a,"gaussian color output"),h=t.getAttachment(E);n.attachDepth(h);const l=this.techniques.get(q,this._configuration);this._renderGaussianColorAndDepth(n,l);const p=o.acquire(s,a,this.produces);this._depthCompositionPassParameters.splatDepth=n.getTexture(R),p.attachDepth(t.getAttachment(E)),r.bindFramebuffer(p.fbo);const u=this.techniques.get(S);r.bindTechnique(u,this.bindParameters,this._depthCompositionPassParameters),r.screen.draw(),this._compositionPassParameters.color=t.getTexture(),this._compositionPassParameters.splatColor=n.getTexture(),i?(p.acquireColor(R,8,"emissive"),this._compositionPassParameters.emission=t.getTexture(R)):this._compositionPassParameters.emission=null,r.bindFramebuffer(p.fbo);const m=this.techniques.get(b,this._compositionConfiguration);return r.bindTechnique(m,this.bindParameters,this._compositionPassParameters),r.screen.draw(),n.release(),p}get slicePlaneEnabled(){return this._slicePlaneEnabled}set slicePlaneEnabled(e){this._slicePlaneEnabled!==e&&(this._slicePlaneEnabled=e,this.requestRender(1))}set clippingBox(e){const t=e||c;this._hasSameClipBox(t)||(m(this._clipBox,t),this._tileCullingRevision=g(this._tileCullingRevision,1),this._data.requestSort(),this.requestRender(1))}get clippingBox(){return this._clippingEnabled?this._clipBox:null}get tileCullingRevision(){return this._tileCullingRevision}get _clippingEnabled(){return!d(this._clipBox,c,(e,t)=>e===t)}get _isIdle(){return 2===this.view.state.mode}get _data(){return this.layerView.data}get _fadeHelper(){return this.layerView.fadeHelper}_updateConfigurations(){const{idleMinimumOpacity:e,nonIdleMinimumOpacity:t}=this.view.qualitySettings.gaussianSplat;this._configuration.alphaCutoff=this._isIdle?e:t,this._configuration.fadingEnabled=this._fadeHelper.fadingEnabled,this._configuration.receiveShadows=this.bindParameters.shadowMap.ready,this._configuration.hasShadowHighlights=this._configuration.receiveShadows&&this.bindParameters.hasShadowHighlights,this._configuration.clippingEnabled=this._clippingEnabled,this._configuration.hasSlicePlane=this._slicePlaneEnabled&&null!=this.bindParameters.slicePlane}_onCameraChange(){this._tileCullingRevision=g(this._tileCullingRevision,1);const e=this.view.state.camera.ray.direction;if(!this._directionChanged(e))return;if(r(this._previousCameraDirection,e),!this._shouldRequestSort(e))return;this._data.requestSort()&&r(this._previousSortRequestCameraDirection,e)}_directionChanged(e){return Math.abs(e[0]-this._previousCameraDirection[0])>this._directionChangeEpsilon||Math.abs(e[1]-this._previousCameraDirection[1])>this._directionChangeEpsilon||Math.abs(e[2]-this._previousCameraDirection[2])>this._directionChangeEpsilon}_shouldRequestSort(e){return Math.abs(e[0]-this._previousSortRequestCameraDirection[0])>this._sortRequestDirectionEpsilon||Math.abs(e[1]-this._previousSortRequestCameraDirection[1])>this._sortRequestDirectionEpsilon||Math.abs(e[2]-this._previousSortRequestCameraDirection[2])>this._sortRequestDirectionEpsilon}_prepareParameters(e,t){this._passParameters.splatOrder=this._data.orderTexture.texture,this._passParameters.splatFading=this._data.fadingTexture.texture,this._passParameters.splatAtlas=this._data.textureAtlas.texture,this._passParameters.splatHeader=this._data.headerTexture.texture;const i=Math.tan(.5*this.camera.fovY),s=i/e*t;a(this._passParameters.tanFov,s,i),this._passParameters.focalLength=e/(2*i);const o=this.view.qualitySettings.gaussianSplat,n=this._isIdle?o.idleMinimumSplatPixelRadius:o.nonIdleMinimumSplatPixelRadius;this._passParameters.minSplatRadius=n*Math.sqrt(t*e)/Math.sqrt(2073600),r(this._passParameters.origin,this.bindParameters.camera.eye),this._prepareHighPrecisionCameraPosition(),this._updateSlicePlaneLocalOrigin(),this._updateClipUniforms()}_updateClipUniforms(){const e=this.clippingBox||c,[t,i,s,a,r,n]=e,[h,l,p]=this.camera.eye,{clipMinCameraRelative:u,clipMaxCameraRelative:m}=this._passParameters;o(u,t-h,i-l,s-p),o(m,a-h,r-l,n-p)}_updateSlicePlaneLocalOrigin(){this._passParameters.slicePlaneLocalOrigin=this.camera.eye}_hasSameClipBox(e){return d(this._clipBox,e,(e,t)=>e===t)}_renderGaussianColorAndDepth(e,t){const i=this.renderingContext;e.acquireColor(R,5,"gaussian depth output"),i.bindFramebuffer(e.fbo),i.setClearColor(0,0,0,0),i.clear(16384),this.renderingContext.bindTechnique(t,this.bindParameters,this._passParameters),this.renderingContext.drawArraysInstanced(D.TRIANGLE_STRIP,0,4,this._data.visibleGaussians)}_prepareHighPrecisionCameraPosition(){n(this._passParameters.tileCameraPosition,this.camera.eye,1/T.tileSize),h(this._passParameters.tileCameraPosition,this._passParameters.tileCameraPosition),n(this._passParameters.cameraDelta,this._passParameters.tileCameraPosition,T.tileSize),l(this._passParameters.cameraDelta,this.camera.eye,this._passParameters.cameraDelta)}_handleFading(){if(0===this._fadeHelper.numFadingTiles)return void(this._previousFrameStart=null);this._previousFrameStart??=this.view.stage.renderer.renderContext.time;const e=this.view.stage?.renderer.renderContext.time-this._previousFrameStart;this._fadeHelper.updateAllTileFading(e),this._previousFrameStart=this.view.stage.renderer.renderContext.time,this._data.fadingTexture.updateTexture(this._data.textureAtlas.pageAllocator.pageCount)}static{this.tileSize=2.048}};e([i()],y.prototype,"produces",void 0),e([i({constructOnly:!0})],y.prototype,"layerView",void 0),y=T=e([s("esri.views.3d.webgl-engine.lib.GaussianSplatRenderNode")],y);export{y as GaussianSplatRenderNode};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{property as i,subclass as t}from"../../../../core/accessorSupport/decorators.js";import{set as s,scale as a,floor as r,subtract as o}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{positiveInfinity as l}from"../../../../geometry/support/aaBoundingBox.js";import{InternalRenderCategory as p}from"../../webgl.js";import h from"../../webgl/RenderNode.js";import{GaussianSplatRenderNode as m}from"./GaussianSplatRenderNode.js";import{G as d}from"../../../../chunks/GaussianSplatShadow.glsl.js";import{GaussianSplatShadowTechnique as u}from"../shaders/GaussianSplatShadowTechnique.js";import{GaussianSplatTechniqueConfiguration as c}from"../shaders/GaussianSplatTechniqueConfiguration.js";import{PrimitiveType as _}from"../../../webgl/enums.js";let P=class extends h{constructor(e){super(e),this.produces=p.SHADOW_CASTERS,this.layerView=null,this._passParameters=new d,this._cameraPosition=n(),this._configuration=new c(e.view.state.isGlobal)}render(){const e=this.bindRenderTarget();return this._render(),e}queryDepthRange(e){return this.layerView.suspended?null:this._data.queryVisibleTileDepthRange(e,this.layerView.clippingBox)}get _data(){return this.layerView.data}get _clippingEnabled(){return null!=this.layerView.clippingBox}get _isIdle(){return 2===this.view.state.mode}_render(){const e=this._data;if(this.layerView.suspended||0===e.visibleGaussians||!e.orderTexture.texture||!e.textureAtlas.texture)return;this._updateShadowConfigurations();const i=this.techniques.getCompiled(u,this._configuration);i?(this._prepareShadowParameters(this.bindParameters.camera),this.renderingContext.bindTechnique(i,this.bindParameters,this._passParameters),this.renderingContext.drawArraysInstanced(_.TRIANGLE_STRIP,0,4,e.visibleGaussians)):this.requestRender(1)}_updateShadowConfigurations(){this._configuration.clippingEnabled=this._clippingEnabled,this._configuration.hasSlicePlane=this.layerView.slicePlaneEnabled&&null!=this.bindParameters.slicePlane,this._configuration.output=this.bindParameters.output}_prepareShadowParameters(e){const i=this._data;this._passParameters.splatOrder=i.orderTexture.texture,this._passParameters.splatAtlas=i.textureAtlas.texture;const{fullHeight:t,fullWidth:s}=e,a=this.view.qualitySettings.gaussianSplat,r=this._isIdle?a.idleMinimumSplatPixelRadius:a.nonIdleMinimumSplatPixelRadius;this._passParameters.minSplatRadius=r*Math.sqrt(s*t)/Math.sqrt(2073600),this._updateShadowCameraPosition(e),this._prepareShadowHighPrecisionCameraPosition(),this._passParameters.slicePlaneLocalOrigin=this._cameraPosition,this._updateShadowClipUniforms()}_updateShadowClipUniforms(){const e=this.layerView.clippingBox||l,[i,t,a,r,o,n]=e,[p,h,m]=this._cameraPosition,{clipMinCameraRelative:d,clipMaxCameraRelative:u}=this._passParameters;s(d,i-p,t-h,a-m),s(u,r-p,o-h,n-m)}_prepareShadowHighPrecisionCameraPosition(){a(this._passParameters.tileCameraPosition,this._cameraPosition,1/m.tileSize),r(this._passParameters.tileCameraPosition,this._passParameters.tileCameraPosition),a(this._passParameters.cameraDelta,this._passParameters.tileCameraPosition,m.tileSize),o(this._passParameters.cameraDelta,this._cameraPosition,this._passParameters.cameraDelta)}_updateShadowCameraPosition(e){const i=e.viewInverseTransposeMatrix;s(this._cameraPosition,i[3],i[7],i[11])}};e([i()],P.prototype,"produces",void 0),e([i({constructOnly:!0})],P.prototype,"layerView",void 0),P=e([t("esri.views.3d.webgl-engine.lib.GaussianSplatShadowRenderNode")],P);export{P as GaussianSplatShadowRenderNode};
2
+ import{__decorate as e}from"tslib";import{property as t,subclass as i}from"../../../../core/accessorSupport/decorators.js";import{set as a,scale as s,floor as r,subtract as o}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{positiveInfinity as l}from"../../../../geometry/support/aaBoundingBox.js";import{InternalRenderCategory as h}from"../../webgl.js";import p from"../../webgl/RenderNode.js";import{GaussianSplatRenderNode as d}from"./GaussianSplatRenderNode.js";import{G as m}from"../../../../chunks/GaussianSplatShadow.glsl.js";import{GaussianSplatShadowTechnique as u}from"../shaders/GaussianSplatShadowTechnique.js";import{GaussianSplatTechniqueConfiguration as c}from"../shaders/GaussianSplatTechniqueConfiguration.js";import{PrimitiveType as _}from"../../../webgl/enums.js";let P=class extends p{constructor(e){super(e),this.produces=h.SHADOW_CASTERS,this.layerView=null,this._passParameters=new m,this._cameraPosition=n(),this._configuration=new c(e.view.state.isGlobal)}render(){const e=this.bindRenderTarget();return this._render(),e}queryDepthRange(e){return this.layerView.suspended?null:this._data.queryVisibleTileDepthRange(e,this.layerView.clippingBox)}get _data(){return this.layerView.data}get _clippingEnabled(){return null!=this.layerView.clippingBox}get _isIdle(){return 2===this.view.state.mode}_render(){const e=this._data;if(this.layerView.suspended||0===e.visibleGaussians||!e.orderTexture.texture||!e.textureAtlas.texture||!e.headerTexture.texture)return;this._updateShadowConfigurations();const t=this.techniques.getCompiled(u,this._configuration);t?(this._prepareShadowParameters(this.bindParameters.camera),this.renderingContext.bindTechnique(t,this.bindParameters,this._passParameters),this.renderingContext.drawArraysInstanced(_.TRIANGLE_STRIP,0,4,e.visibleGaussians)):this.requestRender(1)}_updateShadowConfigurations(){this._configuration.clippingEnabled=this._clippingEnabled,this._configuration.hasSlicePlane=this.layerView.slicePlaneEnabled&&null!=this.bindParameters.slicePlane,this._configuration.output=this.bindParameters.output}_prepareShadowParameters(e){const t=this._data;this._passParameters.splatOrder=t.orderTexture.texture,this._passParameters.splatAtlas=t.textureAtlas.texture,this._passParameters.splatHeader=t.headerTexture.texture;const{fullHeight:i,fullWidth:a}=e,s=this.view.qualitySettings.gaussianSplat,r=this._isIdle?s.idleMinimumSplatPixelRadius:s.nonIdleMinimumSplatPixelRadius;this._passParameters.minSplatRadius=r*Math.sqrt(a*i)/Math.sqrt(2073600),this._updateShadowCameraPosition(e),this._prepareShadowHighPrecisionCameraPosition(),this._passParameters.slicePlaneLocalOrigin=this._cameraPosition,this._updateShadowClipUniforms()}_updateShadowClipUniforms(){const e=this.layerView.clippingBox||l,[t,i,s,r,o,n]=e,[h,p,d]=this._cameraPosition,{clipMinCameraRelative:m,clipMaxCameraRelative:u}=this._passParameters;a(m,t-h,i-p,s-d),a(u,r-h,o-p,n-d)}_prepareShadowHighPrecisionCameraPosition(){s(this._passParameters.tileCameraPosition,this._cameraPosition,1/d.tileSize),r(this._passParameters.tileCameraPosition,this._passParameters.tileCameraPosition),s(this._passParameters.cameraDelta,this._passParameters.tileCameraPosition,d.tileSize),o(this._passParameters.cameraDelta,this._cameraPosition,this._passParameters.cameraDelta)}_updateShadowCameraPosition(e){const t=e.viewInverseTransposeMatrix;a(this._cameraPosition,t[3],t[7],t[11])}};e([t()],P.prototype,"produces",void 0),e([t({constructOnly:!0})],P.prototype,"layerView",void 0),P=e([i("esri.views.3d.webgl-engine.lib.GaussianSplatShadowRenderNode")],P);export{P as GaussianSplatShadowRenderNode};