@arcgis/core 5.2.0-next.44 → 5.2.0-next.46

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 (127) hide show
  1. package/assets/esri/core/workers/RemoteClient.js +1 -1
  2. package/assets/esri/core/workers/chunks/0e64e20fedfe01a1985f.js +1 -0
  3. package/assets/esri/core/workers/chunks/15351354afcbf840a23d.js +29 -0
  4. package/assets/esri/core/workers/chunks/2c0d92c0e3511775401a.js +29 -0
  5. package/assets/esri/core/workers/chunks/{f1f3fe9d2d96578f4f6b.js → 52efa4ded11c1e71f04f.js} +1 -1
  6. package/assets/esri/core/workers/chunks/{3252da57b800356116af.js → 68f7eaa3122de7c00adb.js} +1 -1
  7. package/assets/esri/core/workers/chunks/{e5c19e9b6fa53abdca8c.js → 728ea88e7d4733230e1f.js} +72 -73
  8. package/assets/esri/core/workers/chunks/{bac4d4a9f3a9b7f6864d.js → 744f34e379484e63277c.js} +2 -2
  9. package/assets/esri/core/workers/chunks/{fc880b275f5eaf42171e.js → 7777a79f26a06a6c5240.js} +1 -1
  10. package/assets/esri/core/workers/chunks/{76713b700e053f8bad29.js → 7c2784ebbe17d79f669c.js} +1 -1
  11. package/assets/esri/core/workers/chunks/{94cebc34e49da1e295ed.js → 8026cc0065f6520c4161.js} +1 -1
  12. package/assets/esri/core/workers/chunks/{3f4f1595c8a77d072b04.js → 85cd0cd721b27c497b18.js} +1 -1
  13. package/assets/esri/core/workers/chunks/{549295a5db9bf1536491.js → 8f9fb4e8a7d73db41664.js} +1 -1
  14. package/assets/esri/core/workers/chunks/{b3cefc1895bfd62fc440.js → 98f575c038da74ced2a6.js} +1 -1
  15. package/assets/esri/core/workers/chunks/{7684f0c771d312e05bb4.js → ad5c2b0de6713d0a93a4.js} +58 -58
  16. package/assets/esri/core/workers/chunks/{9b1199104a6822ab7340.js → ae9f9e975d7a9d442fa5.js} +1 -1
  17. package/assets/esri/core/workers/chunks/b3cd17daf5a297b96705.js +29 -0
  18. package/assets/esri/core/workers/chunks/{c316234837b7ca406b1c.js → c4b13124a9cfc78c42a6.js} +6 -6
  19. package/assets/esri/core/workers/chunks/c5e36544b2d1792e4c5f.js +1 -0
  20. package/assets/esri/core/workers/chunks/{04a167c110fb7811169d.js → cc637aec16918052548e.js} +1 -1
  21. package/assets/esri/core/workers/chunks/{0a0732ba8271d7dc985c.js → dee4019338a79c1ecd26.js} +1 -1
  22. package/assets/esri/core/workers/chunks/{96d5fed0235558c0e348.js → e9c48630757bea465b7e.js} +1 -1
  23. package/assets/esri/core/workers/chunks/{305ee2dd597c48a38e64.js → ed988360264574cd8f6b.js} +1 -1
  24. package/assets/esri/core/workers/chunks/{2974cddb0b0f67df7d2d.js → f2c8122d31aedc2604ee.js} +1 -1
  25. package/chunks/CutFillComposition.glsl.js +2 -2
  26. package/chunks/CutFillReduction.glsl.js +1 -1
  27. package/chunks/EmissionComposite.glsl.js +2 -0
  28. package/chunks/FocusAreaColor.glsl.js +1 -1
  29. package/chunks/Fog.glsl.js +20 -20
  30. package/chunks/GlobalIllumination.glsl.js +25 -25
  31. package/chunks/GlowBlur.glsl.js +16 -18
  32. package/chunks/GlowComposite.glsl.js +35 -0
  33. package/chunks/Laserline.glsl.js +13 -13
  34. package/chunks/LaserlinePath.glsl.js +11 -10
  35. package/chunks/Precipitation.glsl.js +6 -6
  36. package/chunks/ShadowCastVisualize.glsl.js +2 -2
  37. package/chunks/ShadowHighlight.glsl.js +3 -3
  38. package/chunks/Viewshed.glsl.js +3 -3
  39. package/config.js +1 -1
  40. package/core/screenUtils.js +1 -1
  41. package/core/types.d.ts +7 -0
  42. package/kernel.js +1 -1
  43. package/layers/VoxelWasmPerSceneView.js +1 -1
  44. package/package.json +4 -4
  45. package/support/revision.js +1 -1
  46. package/views/3d/environment/CloudyWeather.js +1 -1
  47. package/views/3d/environment/FoggyWeather.js +1 -1
  48. package/views/3d/environment/RainyWeather.js +1 -1
  49. package/views/3d/environment/SnowyWeather.js +1 -1
  50. package/views/3d/environment/SunnyWeather.js +1 -1
  51. package/views/3d/layers/I3SMeshView3D.js +1 -1
  52. package/views/3d/layers/i3s/I3SIntersectionHandler.js +1 -1
  53. package/views/3d/layers/i3s/I3SUtil.js +1 -1
  54. package/views/3d/layers/i3s/PointCloudRenderer.js +1 -1
  55. package/views/3d/layers/support/Tiles3DMeshIntersectionHandler.js +1 -1
  56. package/views/3d/support/debugFlags.js +1 -1
  57. package/views/3d/support/gaussianSplatting/GaussianSplatIntersectionHandler.js +1 -1
  58. package/views/3d/support/hitTest.js +1 -1
  59. package/views/3d/support/intersectionHitUtils.js +2 -0
  60. package/views/3d/terrain/TerrainRenderer.js +1 -1
  61. package/views/3d/webgl-engine/Stage.js +1 -1
  62. package/views/3d/webgl-engine/collections/Component/Material/ComponentData.glsl.js +12 -12
  63. package/views/3d/webgl-engine/collections/Component/UniformComponentParameters.js +1 -1
  64. package/views/3d/webgl-engine/core/FBOCache.js +1 -1
  65. package/views/3d/webgl-engine/core/shaderLibrary/ScreenSpacePass.glsl.js +2 -2
  66. package/views/3d/webgl-engine/core/shaderLibrary/output/getEmissions.glsl.js +8 -0
  67. package/views/3d/webgl-engine/core/shaderLibrary/util/blendEmission.glsl.js +2 -0
  68. package/views/3d/webgl-engine/effects/atmosphere/ChapmanAtmosphere.js +1 -1
  69. package/views/3d/webgl-engine/effects/debug/RenderNodeVisualizerNode.js +1 -1
  70. package/views/3d/webgl-engine/effects/focusArea/FocusAreaVisualization.js +1 -1
  71. package/views/3d/webgl-engine/effects/fog/Fog.glsl.js +1 -1
  72. package/views/3d/webgl-engine/effects/fog/Fog.js +1 -1
  73. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIllumination.glsl.js +1 -1
  74. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIllumination.js +1 -1
  75. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIlluminationTechniqueConfiguration.js +1 -1
  76. package/views/3d/webgl-engine/effects/glow/Glow.js +1 -1
  77. package/views/3d/webgl-engine/effects/glow/GlowBlur.glsl.js +1 -1
  78. package/views/3d/webgl-engine/effects/glow/GlowComposite.glsl.js +2 -0
  79. package/views/3d/webgl-engine/effects/glow/GlowCompositeTechnique.js +2 -0
  80. package/views/3d/webgl-engine/effects/haze/Haze.js +1 -1
  81. package/views/3d/webgl-engine/effects/highlight/ShadowHighlight.glsl.js +1 -1
  82. package/views/3d/webgl-engine/effects/highlight/ShadowHighlight.js +1 -1
  83. package/views/3d/webgl-engine/effects/laserlines/LaserLineRenderer.js +1 -1
  84. package/views/3d/webgl-engine/effects/laserlines/Laserline.glsl.js +1 -1
  85. package/views/3d/webgl-engine/effects/laserlines/LaserlinePath.glsl.js +1 -1
  86. package/views/3d/webgl-engine/effects/laserlines/LaserlinePathTechniqueConfiguration.js +1 -1
  87. package/views/3d/webgl-engine/effects/precipitation/Precipitation.js +1 -1
  88. package/views/3d/webgl-engine/effects/precipitation/PrecipitationTechniqueConfiguration.js +1 -1
  89. package/views/3d/webgl-engine/lib/CutFillComputation.js +1 -1
  90. package/views/3d/webgl-engine/lib/CutFillVisualization.js +1 -1
  91. package/views/3d/webgl-engine/lib/EmissionComposite.glsl.js +2 -0
  92. package/views/3d/webgl-engine/lib/EmissionComposite.js +2 -0
  93. package/views/3d/webgl-engine/lib/EmissionCompositeTechnique.js +2 -0
  94. package/views/3d/webgl-engine/lib/HUDIntersectorResult.js +1 -1
  95. package/views/3d/webgl-engine/lib/Intersector.js +1 -1
  96. package/views/3d/webgl-engine/lib/IntersectorResult.js +1 -1
  97. package/views/3d/webgl-engine/lib/MainFramebuffer.js +1 -1
  98. package/views/3d/webgl-engine/lib/PolygonIntersectionResults.js +1 -1
  99. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  100. package/views/3d/webgl-engine/lib/ShadowCastRenderer.js +1 -1
  101. package/views/3d/webgl-engine/lib/SortedRenderGeometryRenderer.js +1 -1
  102. package/views/3d/webgl-engine/lib/Viewshed.js +1 -1
  103. package/views/3d/webgl-engine/lib/intersectorUtilsConversions.js +1 -1
  104. package/views/3d/webgl-engine/lib/lodRendering/LodResources.js +1 -1
  105. package/views/3d/webgl-engine/parts/RenderView.js +1 -1
  106. package/views/3d/webgl-engine/shaders/CutFillComposition.glsl.js +1 -1
  107. package/views/3d/webgl-engine/shaders/EmissiveTechniqueConfiguration.js +2 -0
  108. package/views/3d/webgl-engine/shaders/OutputColorHighlightOLID.glsl.js +1 -1
  109. package/views/3d/webgl-engine/shaders/ViewshedTechnique.js +1 -1
  110. package/views/SceneView.d.ts +4 -3
  111. package/views/SceneView.js +1 -1
  112. package/views/support/TextureCompressionWorker.js +1 -1
  113. package/views/support/TextureCompressionWorkerHandle.js +1 -1
  114. package/views/webgl/Texture.js +1 -1
  115. package/assets/esri/core/workers/chunks/5b937c405788fd14be8b.js +0 -30
  116. package/assets/esri/core/workers/chunks/8a01fe8d78ca85ea4784.js +0 -1
  117. package/assets/esri/core/workers/chunks/a38a7e3a5aa9294ab918.js +0 -30
  118. package/assets/esri/core/workers/chunks/b75db3b1becf8265ec59.js +0 -30
  119. package/assets/esri/core/workers/chunks/ca419858910af5505d3d.js +0 -1
  120. package/chunks/GlowComposition.glsl.js +0 -39
  121. package/views/3d/webgl-engine/core/shaderLibrary/output/Emissions.glsl.js +0 -9
  122. package/views/3d/webgl-engine/effects/fog/FogTechniqueConfiguration.js +0 -2
  123. package/views/3d/webgl-engine/effects/glow/GlowBlurTechniqueConfiguration.js +0 -2
  124. package/views/3d/webgl-engine/effects/glow/GlowComposition.glsl.js +0 -2
  125. package/views/3d/webgl-engine/effects/glow/GlowCompositionTechnique.js +0 -2
  126. package/views/3d/webgl-engine/effects/glow/GlowCompositionTechniqueConfiguration.js +0 -2
  127. /package/assets/esri/core/workers/chunks/{bac4d4a9f3a9b7f6864d.js.LICENSE.txt → 744f34e379484e63277c.js.LICENSE.txt} +0 -0
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{intersectsSphere as e}from"../../../../geometry/support/frustum.js";import{I3sTarget as t}from"./Intersector.js";import{IntersectorResult as n}from"../../webgl-engine/lib/IntersectorResult.js";import{MeshIntersectionOptions as r}from"../../webgl-engine/lib/RayIntersections.js";import{getVerticalOffsetI3S as s}from"../../webgl-engine/lib/verticalOffsetUtils.js";class i{constructor(e,t){this.node=e,this.objectHandle=t}}class l{constructor(e){this.type=2,this._needVerticalOffset=!1,this.layerViewUid=e.layerViewUid,this.sublayerId=e.sublayerId,this._collection=e.collection,this._traverseNodeHierarchy=e.traverseNodeHierarchy,this.slicePlaneEnabled=e.slicePlaneEnabled,this.isGround=e.isGround}updateElevationAlignState(e,t){this._needVerticalOffset=e&&1===t}intersectRay(e,i,l,c,a,d){const u=2===e.options.store,b=e.ray.direction;let h=e=>e,f=e=>e;const y=s(e.verticalOffset??(this._needVerticalOffset?0:null));null!=e.verticalOffset&&null!=y&&(h=e=>y.applyToMbs(e),f=e=>y.applyToObb(e));const{results:R,tolerance:m}=e,p=new r(m,d,e.options.normalRequired),v=e=>{if(0===e.childrenLoaded)return!1;const t=e.serviceObbInRenderSR?.isValid?e.serviceObbInRenderSR:null;return!(t&&!f(t).intersectRay(l,b,m))};for(const{node:r,objectHandle:s}of this._traverseNodeHierarchy(v)){const a=r.serviceObbInRenderSR?.isValid?r.serviceObbInRenderSR:null,{serviceMbsInRenderSRElevationAdjusted:d}=r;!s||!a&&d.isValid&&!o(h(d),l,b,m)||null!=r.geometryObbInRenderSR&&!f(r.geometryObbInRenderSR).intersectRay(l,b,m)||this._collection.intersectRay(s,l,c,y,p,(s,o,a,d)=>{if(o<0||null!=i&&!i(l,c,o))return;const b=e=>{const n=new t(this.layerViewUid,this.sublayerId,r.index,s,d);e.set(this.type,n,o,a)};if(this.isGround&&(null==R.ground.distance||o<R.ground.distance)&&b(R.ground),!e.options.isFiltered&&((null==R.min.distance||o<R.min.distance)&&b(R.min),(null==R.max.distance||o>R.max.distance)&&b(R.max),u)){const t=new n(e.ray);b(t),e.results.all.push(t)}})}}*intersectScreenPolygon(n,r){if(null==n.camera)return;const i=s(this._needVerticalOffset?0:null),l=t=>{if(0===t.childrenLoaded)return!1;const n=t.serviceObbInRenderSR?.isValid?t.serviceObbInRenderSR:null;if(null!=n){if(!n.intersectsFrustumConservativeApproximation(r.broadPhaseFrustum))return!1}else{const n=t.serviceMbsInRenderSRElevationAdjusted;if(n.isValid&&!e(r.broadPhaseFrustum,n))return!1}return!0};for(const{node:e,objectHandle:s}of this._traverseNodeHierarchy(l))null!=s&&s.visible&&(null==e.geometryObbInRenderSR||e.geometryObbInRenderSR.intersectsFrustumConservativeApproximation(r.broadPhaseFrustum))&&(this._collection.intersectScreenPolygon(s,n,r,i,(r,s,i,l)=>{n.polygonResults.add(this.type,new t(this.layerViewUid,this.sublayerId,e.index,r,l),s)}),yield)}}function o(e,t,n,r=0){const s=e.radius+r,i=t[0]-e.center[0],l=t[1]-e.center[1],o=t[2]-e.center[2],[c,a,d]=n,u=c*i+a*l+d*o;return u*u-(c*c+a*a+d*d)*(i*i+l*l+o*o-s*s)>=0}export{l as I3SIntersectionHandler,i as TraversedIntersectionNode};
2
+ import{intersectsSphere as e}from"../../../../geometry/support/frustum.js";import{I3sTarget as t}from"./Intersector.js";import{IntersectorResultRay as n}from"../../webgl-engine/lib/IntersectorResult.js";import{MeshIntersectionOptions as r}from"../../webgl-engine/lib/RayIntersections.js";import{getVerticalOffsetI3S as s}from"../../webgl-engine/lib/verticalOffsetUtils.js";class i{constructor(e,t){this.node=e,this.objectHandle=t}}class l{constructor(e){this.type=2,this._needVerticalOffset=!1,this.layerViewUid=e.layerViewUid,this.sublayerId=e.sublayerId,this._collection=e.collection,this._traverseNodeHierarchy=e.traverseNodeHierarchy,this.slicePlaneEnabled=e.slicePlaneEnabled,this.isGround=e.isGround}updateElevationAlignState(e,t){this._needVerticalOffset=e&&1===t}intersectRay(e,i,l,c,a,d){const u=2===e.options.store,b=e.ray.direction;let h=e=>e,f=e=>e;const y=s(e.verticalOffset??(this._needVerticalOffset?0:null));null!=e.verticalOffset&&null!=y&&(h=e=>y.applyToMbs(e),f=e=>y.applyToObb(e));const{results:R,tolerance:m}=e,p=new r(m,d,e.options.normalRequired),v=e=>{if(0===e.childrenLoaded)return!1;const t=e.serviceObbInRenderSR?.isValid?e.serviceObbInRenderSR:null;return!(t&&!f(t).intersectRay(l,b,m))};for(const{node:r,objectHandle:s}of this._traverseNodeHierarchy(v)){const a=r.serviceObbInRenderSR?.isValid?r.serviceObbInRenderSR:null,{serviceMbsInRenderSRElevationAdjusted:d}=r;!s||!a&&d.isValid&&!o(h(d),l,b,m)||null!=r.geometryObbInRenderSR&&!f(r.geometryObbInRenderSR).intersectRay(l,b,m)||this._collection.intersectRay(s,l,c,y,p,(s,o,a,d)=>{if(o<0||null!=i&&!i(l,c,o))return;const b=e=>{const n=new t(this.layerViewUid,this.sublayerId,r.index,s,d);e.set(this.type,n,o,a)};if(this.isGround&&(null==R.ground.distance||o<R.ground.distance)&&b(R.ground),!e.options.isFiltered&&((null==R.min.distance||o<R.min.distance)&&b(R.min),(null==R.max.distance||o>R.max.distance)&&b(R.max),u)){const t=new n(e.ray);b(t),e.results.all.push(t)}})}}*intersectScreenPolygon(n,r){if(null==n.camera)return;const i=s(this._needVerticalOffset?0:null),l=t=>{if(0===t.childrenLoaded)return!1;const n=t.serviceObbInRenderSR?.isValid?t.serviceObbInRenderSR:null;if(null!=n){if(!n.intersectsFrustumConservativeApproximation(r.broadPhaseFrustum))return!1}else{const n=t.serviceMbsInRenderSRElevationAdjusted;if(n.isValid&&!e(r.broadPhaseFrustum,n))return!1}return!0};for(const{node:e,objectHandle:s}of this._traverseNodeHierarchy(l))null!=s&&s.visible&&(null==e.geometryObbInRenderSR||e.geometryObbInRenderSR.intersectsFrustumConservativeApproximation(r.broadPhaseFrustum))&&(this._collection.intersectScreenPolygon(s,n,r,i,(r,s,i,l)=>{n.polygonResults.add(this.type,new t(this.layerViewUid,this.sublayerId,e.index,r,l),s)}),yield)}}function o(e,t,n,r=0){const s=e.radius+r,i=t[0]-e.center[0],l=t[1]-e.center[1],o=t[2]-e.center[2],[c,a,d]=n,u=c*i+a*l+d*o;return u*u-(c*c+a*a+d*d)*(i*i+l*l+o*o-s*s)>=0}export{l as I3SIntersectionHandler,i as TraversedIntersectionNode};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import e from"../../../../request.js";import{binaryIndexOf as t}from"../../../../core/arrayUtils.js";import r from"../../../../core/Error.js";import has from"../../../../core/has.js";import{invert as o}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{transformMat4 as i,copy as s}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{canProjectWithoutEngine as l}from"../../../../geometry/projectionUtils.js";import c from"../../../../geometry/SpatialReference.js";import{projectVectorToVector as u}from"../../../../geometry/projection/projectVectorToVector.js";import{create as f,empty as p,expandPointInPlace as m,intersects as d}from"../../../../geometry/support/aaBoundingRect.js";import{fetchFeaturePopupFeatures as h}from"../../../../layers/support/featurePopupQueryUtils.js";import y from"../../../../rest/support/Query.js";import{readBinaryAttribute as g,getCachedAttributeValue as b}from"./I3SBinaryReader.js";import{computeGlobalTransformation as w}from"./I3SProjectionUtil.js";import{createSolidEdgeMaterial as v,createMaterialFromEdges as x}from"../support/edgeUtils.js";import{parseColorMixMode as S}from"../support/symbolColorUtils.js";import{Obb as M,compute as R}from"../../support/orientedBoundingBox.js";import{emissiveStrengthDefault as j}from"../../webgl-engine/core/shaderLibrary/output/Emissions.glsl.js";import{spatialReferenceIncompatibleError as I}from"../../../support/layerViewUtils.js";function T(e){return e?parseInt(e.slice(e.lastIndexOf("/")+1),10):void 0}function k(e){if(has("disable-feature:i3s-draco")||!e)return!1;for(const t of e)for(const e of t.geometryBuffers)if("draco"===e.compressedAttributes?.encoding)return!0;return!1}function U(e,t,r,o){r.traverse(t,t=>{const r=t.serviceMbsInIndexSR;return 0!==(null!=r&&L(e,r))&&(o(t),!0)})}function W(e,t,r){let o=0,n=0;for(let i=0;i<t.length&&o<e.length;i++)e[o]===t[i]&&(r(i)&&(e[n]=e[o],n++),o++);e.length=n}function C(e,r,o){let n=0,i=0;for(;n<o.length;){t(e,o[n])>=0===r&&(o[i]=o[n],i++),n++}o.length=i}function A(e,t){if(0===t.rotationScale[1]&&0===t.rotationScale[2]&&0===t.rotationScale[3]&&0===t.rotationScale[5]&&0===t.rotationScale[6]&&0===t.rotationScale[7])return K[0]=(e[0]-t.position[0])/t.rotationScale[0],K[1]=(e[1]-t.position[1])/t.rotationScale[4],K[2]=(e[2]-t.position[0])/t.rotationScale[0],K[3]=(e[3]-t.position[1])/t.rotationScale[4],K}const K=f();function L(e,t){const r=t.center[0],o=t.center[1],n=t.radius,i=e[0]-r,s=r-e[2],a=e[1]-o,l=o-e[3],c=Math.max(i,s,0),u=Math.max(a,l,0),f=c*c+u*u;if(f>n*n)return 0;if(f>0)return 1;return-Math.max(i,s,a,l)>n?3:2}function q(e,t,r){const o=new Array,n=r?.missingFields,i=r?.originalFields;let s=!1;for(const a of e){const e=t?.get(a);e?(i?.push(a),o.push(e.name),a!==e.name&&(s=!0)):n?.push(a)}return r&&"hasMismatchedCasing"in r&&(r.hasMismatchedCasing=s),o}async function F(e,t,o,n,i,s){if(0===t.length)return[];const a=e.attributeStorageInfo;if(null!=e.associatedLayer)try{return await B(e.associatedLayer,t,n,s)}catch(l){if(e.associatedLayer.loaded)throw l}if(a){const r=G(e,t,o,i),l=e.parsedUrl.path;return await Promise.allSettled(r.map(t=>O(l,a,t.node,t.indices,n,e.apiKey,e.customParameters,s).then(e=>{for(let r=0;r<t.graphics.length;r++){const o=t.graphics[r],n=e[r];if(o.attributes)for(const e in o.attributes)e in n||(n[e]=o.attributes[e]);o.attributes=n}}))),t}throw new r("scenelayer:no-attribute-source","This scene layer does not have a source for attributes available")}function G({globalIdField:e},t,r,o){const n=new Map,i=[],s=o();for(const a of t){const t=a.attributes?.[r],o=null==t?a.getGlobalId():void 0;for(let r=0;r<s.length;r++){const l=s[r],c=P(l,t,e,o);if(c<0)continue;let u=n.get(l.node);u||(u={node:l.node,indices:[],graphics:[]},i.push(u),n.set(l.node,u)),u.indices.push(c),u.graphics.push(a);for(let e=r;e>0;e--)s[e]=s[e-1];s[0]=l;break}}return i}function P(e,t,r,o){if(null!=t&&"number"==typeof t)return e.featureIds.indexOf(t);if(null==o||null==r)return-1;const n=e.attributeInfo?.attributeData?.[r];return n?n.indexOf(o):-1}async function B(e,t,r,o){const n=[],i={hasMismatchedCasing:!1,originalFields:n},s=q(r,e.fieldsIndex,i),a=new y({outFields:[...s]});if(await h(e,t,a,{updateSourceAttributes:!0,...o}),!i.hasMismatchedCasing)return t;for(let l=0;l<t.length;l++){const e=t[l];if(e.attributes)for(let t=0;t<n.length;t++){const r=n[t],o=s[t];o in e.attributes&&(e.attributes[r]=e.attributes[o],delete e.attributes[o])}}return t}function O(e,t,r,o,n,i,s,a){return E(e,t,r.resources.attributes,o,n,i,s,a)}async function E(t,r,o,n,i,s,a,l){const c=[];for(const e of r)if(e&&i.includes(e.name)){const r=`${t}/nodes/${o}/attributes/${e.key}/0`;c.push({url:r,storageInfo:e})}const u=await Promise.allSettled(c.map(t=>e(t.url,{responseType:"array-buffer",query:{...a,token:s},signal:l?.signal}).then(e=>g(t.storageInfo,e.data)))),f=[];for(const e of n){const t={};for(let r=0;r<u.length;r++){const o=u[r];if("fulfilled"===o.status){const n=o.value;t[c[r].storageInfo.name]=b(n,e)}}f.push(t)}return f}function V(e){const t=e.store,o=t.indexCRS||t.geographicCRS,n=void 0===o?t.indexWKT:void 0;if(n){if(!e.spatialReference)throw new r("layerview:no-store-spatial-reference-wkt-index-and-no-layer-spatial-reference","Found indexWKT in the scene layer store but no layer spatial reference",{});if(n!==e.spatialReference.wkt)throw new r("layerview:store-spatial-reference-wkt-index-incompatible","The indexWKT of the scene layer store does not match the WKT of the layer spatial reference",{})}const i=o?new c(T(o)):e.spatialReference;return i.equals(e.spatialReference)?e.spatialReference:i}function $(e){const t=e.store,o=t.vertexCRS||t.projectedCRS,n=void 0===o?t.vertexWKT:void 0;if(n){if(!e.spatialReference)throw new r("layerview:no-store-spatial-reference-wkt-vertex-and-no-layer-spatial-reference","Found vertexWKT in the scene layer store but no layer spatial reference",{});if(n!==e.spatialReference.wkt)throw new r("layerview:store-spatial-reference-wkt-vertex-incompatible","The vertexWKT of the scene layer store does not match the WKT of the layer spatial reference",{})}const i=o?new c(T(o)):e.spatialReference;return i.equals(e.spatialReference)?e.spatialReference:i}function z(e,t,r){if(!l(e,t))throw I("scene layer",e?.wkid,t?.wkid);if("local"===r&&!D(e,t))throw I("scene layer",e?.wkid,t?.wkid)}function Q(e,t,o){if(e.serviceUpdateTimeStamp?.lastUpdate!==t.serviceUpdateTimeStamp?.lastUpdate||!o.isEmpty||e.associatedLayer?.url!==t.associatedLayer?.url)throw new r("layerview:recycle-failed","Could not recycle layerview")}function D(e,t){return e.equals(t)||e.isWGS84&&t.isWebMercator||e.isWebMercator&&t.isWGS84}function Z(e,t,r){const o=V(e),n=$(e);z(o,t,r),z(n,t,r)}function H(e){return(null==e.geometryType||"triangles"===e.geometryType)&&((null==e.topology||"PerAttributeArray"===e.topology)&&null!=e.vertexAttributes?.position)}function J(e){if(null==e.store?.defaultGeometrySchema||!H(e.store.defaultGeometrySchema))throw new r("scenelayer:unsupported-geometry-schema","The geometry schema of this scene layer is not supported.",{url:e.parsedUrl.path})}function N(e,t){Z(e,t.spatialReference,t.viewingMode)}function X(e){return null!=e.geometryType&&"points"===e.geometryType&&((null==e.topology||"PerAttributeArray"===e.topology)&&((null==e.encoding||""===e.encoding||"lepcc-xyz"===e.encoding)&&null!=e.vertexAttributes?.position))}function Y(e){if(null==e.store?.defaultGeometrySchema||!X(e.store.defaultGeometrySchema))throw new r("pointcloud:unsupported-geometry-schema","The geometry schema of this point cloud scene layer is not supported.",{})}function _(e,t){z(e.spatialReference,t.spatialReference,t.viewingMode)}function ee(e){return"simple"===e.type||"class-breaks"===e.type||"unique-value"===e.type}function te(e){return"mesh-3d"===e.type}function re(e){if(null==e||!ee(e))return!0;if(("unique-value"===e.type||"class-breaks"===e.type)&&null==e.defaultSymbol)return!0;const t=e.symbols;if(0===t.length)return!0;for(const r of t){if(!te(r)||0===r.symbolLayers.length)return!0;for(const e of r.symbolLayers.items)if("fill"!==e.type||null==e.material?.color||"replace"!==e.material.colorMixMode)return!0}return!1}const oe=v({color:[0,0,0,0],opacity:0});class ne{constructor(){this.edgeMaterial=null,this.material=null,this.castShadows=!0}}function ie(e){const t=new ne;let r=!1,o=!1;for(const n of e.symbolLayers.items)if("fill"===n.type&&n.enabled){const e=n.material,i=n.edges;if(null!=e&&!r){const o=e.color,i=S(e.colorMixMode),s={strength:e.emissive?.strength??j,source:"color"===e.emissive?.source?1:0};t.material=null!=o?{color:[o.r/255,o.g/255,o.b/255],alpha:o.a,colorMixMode:i,emissive:s}:{color:[1,1,1],alpha:1,colorMixMode:1,emissive:s},t.castShadows=n.castShadows,r=!0}null==i||o||(t.edgeMaterial=x(i,{}),o=!0)}return t.material||(t.material={color:[1,1,1],alpha:1,colorMixMode:1,emissive:{strength:j,source:0}}),t}function se(e,t){return(0|e)+(0|t)|0}function ae(e,t,r,n,a,l,c){if(!l||0===l.length||null==t||!e.serviceMbsInIndexSR)return null;const f=w(e.serviceMbsInIndexSR,a,"none",r,t);o(de,f);let h=null;const y=()=>{if(!h)if(h=le,p(ue),null!=e.serviceObbInIndexSR){e.serviceObbInIndexSR.transform(fe,r,t,a,c),fe.getCorners(h);for(const e of h)i(e,e,de),m(ue,e)}else{const o=e.serviceMbsInIndexSR;if(!o)return;const n=o.radius;u(o.center,r,pe,t),i(pe,pe,de),pe[2]+=a;for(let e=0;e<8;++e){const t=1&e?n:-n,r=2&e?n:-n,o=4&e?n:-n,i=h[e];s(i,[pe[0]+t,pe[1]+r,pe[2]+o]),m(ue,i)}}};let g=1/0,b=-1/0;const v=e=>{if("replace"!==e.type)return;const r=e.geometry;if(!r?.hasZ)return;p(ce);const o=r.spatialReference||n,s=r.rings.reduce((e,r)=>r.reduce((e,r)=>(u(r,o,pe,t),i(pe,pe,de),m(ce,pe),Math.min(pe[2],e)),e),1/0);y(),d(ue,ce)&&(g=Math.min(g,s),b=Math.max(b,s))};if(l.forEach(e=>v(e)),g===1/0)return null;const x=(e,t,r)=>{i(pe,r,f),e[t]=pe[0],e[t+1]=pe[1],e[t+2]=pe[2],t+=24,r[2]=g,i(pe,r,f),e[t]=pe[0],e[t+1]=pe[1],e[t+2]=pe[2],t+=24,r[2]=b,i(pe,r,f),e[t]=pe[0],e[t+1]=pe[1],e[t+2]=pe[2]};for(let o=0;o<8;++o)x(me.data,3*o,h[o]);return R(me)}const le=[a(),a(),a(),a(),a(),a(),a(),a()],ce=f(),ue=f(),fe=new M,pe=a(),me={data:new Array(72),size:3,exclusive:!0,stride:3},de=n();export{ne as SymbolInfo,se as addWraparound,_ as checkPointCloudLayerCompatibleWithView,Y as checkPointCloudLayerValid,Q as checkRecyclable,N as checkSceneLayerCompatibleWithView,J as checkSceneLayerValid,z as checkSpatialReference,Z as checkSpatialReferences,ae as computeVisibilityObb,k as containsDraco,T as extractWkid,W as filterInPlace,q as findFieldsCaseInsensitive,U as findIntersectingNodes,A as getClipRect,V as getIndexCrs,ie as getSymbolInfo,$ as getVertexCrs,L as intersectBoundingRectWithMbs,D as isSupportedLocalModeProjection,C as objectIdFilter,E as queryAttributesFromCachedAttributesId,re as rendererNeedsTextures,oe as transparentEdgeMaterial,F as whenGraphicAttributes};
2
+ import e from"../../../../request.js";import{binaryIndexOf as t}from"../../../../core/arrayUtils.js";import r from"../../../../core/Error.js";import has from"../../../../core/has.js";import{invert as o}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{transformMat4 as i,copy as s}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{canProjectWithoutEngine as l}from"../../../../geometry/projectionUtils.js";import c from"../../../../geometry/SpatialReference.js";import{projectVectorToVector as u}from"../../../../geometry/projection/projectVectorToVector.js";import{create as f,empty as p,expandPointInPlace as m,intersects as d}from"../../../../geometry/support/aaBoundingRect.js";import{fetchFeaturePopupFeatures as h}from"../../../../layers/support/featurePopupQueryUtils.js";import y from"../../../../rest/support/Query.js";import{readBinaryAttribute as g,getCachedAttributeValue as b}from"./I3SBinaryReader.js";import{computeGlobalTransformation as w}from"./I3SProjectionUtil.js";import{createSolidEdgeMaterial as v,createMaterialFromEdges as x}from"../support/edgeUtils.js";import{parseColorMixMode as S}from"../support/symbolColorUtils.js";import{Obb as M,compute as R}from"../../support/orientedBoundingBox.js";import{emissiveStrengthDefault as j}from"../../webgl-engine/core/shaderLibrary/output/getEmissions.glsl.js";import{spatialReferenceIncompatibleError as I}from"../../../support/layerViewUtils.js";function T(e){return e?parseInt(e.slice(e.lastIndexOf("/")+1),10):void 0}function k(e){if(has("disable-feature:i3s-draco")||!e)return!1;for(const t of e)for(const e of t.geometryBuffers)if("draco"===e.compressedAttributes?.encoding)return!0;return!1}function U(e,t,r,o){r.traverse(t,t=>{const r=t.serviceMbsInIndexSR;return 0!==(null!=r&&L(e,r))&&(o(t),!0)})}function W(e,t,r){let o=0,n=0;for(let i=0;i<t.length&&o<e.length;i++)e[o]===t[i]&&(r(i)&&(e[n]=e[o],n++),o++);e.length=n}function C(e,r,o){let n=0,i=0;for(;n<o.length;){t(e,o[n])>=0===r&&(o[i]=o[n],i++),n++}o.length=i}function A(e,t){if(0===t.rotationScale[1]&&0===t.rotationScale[2]&&0===t.rotationScale[3]&&0===t.rotationScale[5]&&0===t.rotationScale[6]&&0===t.rotationScale[7])return K[0]=(e[0]-t.position[0])/t.rotationScale[0],K[1]=(e[1]-t.position[1])/t.rotationScale[4],K[2]=(e[2]-t.position[0])/t.rotationScale[0],K[3]=(e[3]-t.position[1])/t.rotationScale[4],K}const K=f();function L(e,t){const r=t.center[0],o=t.center[1],n=t.radius,i=e[0]-r,s=r-e[2],a=e[1]-o,l=o-e[3],c=Math.max(i,s,0),u=Math.max(a,l,0),f=c*c+u*u;if(f>n*n)return 0;if(f>0)return 1;return-Math.max(i,s,a,l)>n?3:2}function q(e,t,r){const o=new Array,n=r?.missingFields,i=r?.originalFields;let s=!1;for(const a of e){const e=t?.get(a);e?(i?.push(a),o.push(e.name),a!==e.name&&(s=!0)):n?.push(a)}return r&&"hasMismatchedCasing"in r&&(r.hasMismatchedCasing=s),o}async function F(e,t,o,n,i,s){if(0===t.length)return[];const a=e.attributeStorageInfo;if(null!=e.associatedLayer)try{return await B(e.associatedLayer,t,n,s)}catch(l){if(e.associatedLayer.loaded)throw l}if(a){const r=G(e,t,o,i),l=e.parsedUrl.path;return await Promise.allSettled(r.map(t=>O(l,a,t.node,t.indices,n,e.apiKey,e.customParameters,s).then(e=>{for(let r=0;r<t.graphics.length;r++){const o=t.graphics[r],n=e[r];if(o.attributes)for(const e in o.attributes)e in n||(n[e]=o.attributes[e]);o.attributes=n}}))),t}throw new r("scenelayer:no-attribute-source","This scene layer does not have a source for attributes available")}function G({globalIdField:e},t,r,o){const n=new Map,i=[],s=o();for(const a of t){const t=a.attributes?.[r],o=null==t?a.getGlobalId():void 0;for(let r=0;r<s.length;r++){const l=s[r],c=P(l,t,e,o);if(c<0)continue;let u=n.get(l.node);u||(u={node:l.node,indices:[],graphics:[]},i.push(u),n.set(l.node,u)),u.indices.push(c),u.graphics.push(a);for(let e=r;e>0;e--)s[e]=s[e-1];s[0]=l;break}}return i}function P(e,t,r,o){if(null!=t&&"number"==typeof t)return e.featureIds.indexOf(t);if(null==o||null==r)return-1;const n=e.attributeInfo?.attributeData?.[r];return n?n.indexOf(o):-1}async function B(e,t,r,o){const n=[],i={hasMismatchedCasing:!1,originalFields:n},s=q(r,e.fieldsIndex,i),a=new y({outFields:[...s]});if(await h(e,t,a,{updateSourceAttributes:!0,...o}),!i.hasMismatchedCasing)return t;for(let l=0;l<t.length;l++){const e=t[l];if(e.attributes)for(let t=0;t<n.length;t++){const r=n[t],o=s[t];o in e.attributes&&(e.attributes[r]=e.attributes[o],delete e.attributes[o])}}return t}function O(e,t,r,o,n,i,s,a){return E(e,t,r.resources.attributes,o,n,i,s,a)}async function E(t,r,o,n,i,s,a,l){const c=[];for(const e of r)if(e&&i.includes(e.name)){const r=`${t}/nodes/${o}/attributes/${e.key}/0`;c.push({url:r,storageInfo:e})}const u=await Promise.allSettled(c.map(t=>e(t.url,{responseType:"array-buffer",query:{...a,token:s},signal:l?.signal}).then(e=>g(t.storageInfo,e.data)))),f=[];for(const e of n){const t={};for(let r=0;r<u.length;r++){const o=u[r];if("fulfilled"===o.status){const n=o.value;t[c[r].storageInfo.name]=b(n,e)}}f.push(t)}return f}function V(e){const t=e.store,o=t.indexCRS||t.geographicCRS,n=void 0===o?t.indexWKT:void 0;if(n){if(!e.spatialReference)throw new r("layerview:no-store-spatial-reference-wkt-index-and-no-layer-spatial-reference","Found indexWKT in the scene layer store but no layer spatial reference",{});if(n!==e.spatialReference.wkt)throw new r("layerview:store-spatial-reference-wkt-index-incompatible","The indexWKT of the scene layer store does not match the WKT of the layer spatial reference",{})}const i=o?new c(T(o)):e.spatialReference;return i.equals(e.spatialReference)?e.spatialReference:i}function $(e){const t=e.store,o=t.vertexCRS||t.projectedCRS,n=void 0===o?t.vertexWKT:void 0;if(n){if(!e.spatialReference)throw new r("layerview:no-store-spatial-reference-wkt-vertex-and-no-layer-spatial-reference","Found vertexWKT in the scene layer store but no layer spatial reference",{});if(n!==e.spatialReference.wkt)throw new r("layerview:store-spatial-reference-wkt-vertex-incompatible","The vertexWKT of the scene layer store does not match the WKT of the layer spatial reference",{})}const i=o?new c(T(o)):e.spatialReference;return i.equals(e.spatialReference)?e.spatialReference:i}function z(e,t,r){if(!l(e,t))throw I("scene layer",e?.wkid,t?.wkid);if("local"===r&&!D(e,t))throw I("scene layer",e?.wkid,t?.wkid)}function Q(e,t,o){if(e.serviceUpdateTimeStamp?.lastUpdate!==t.serviceUpdateTimeStamp?.lastUpdate||!o.isEmpty||e.associatedLayer?.url!==t.associatedLayer?.url)throw new r("layerview:recycle-failed","Could not recycle layerview")}function D(e,t){return e.equals(t)||e.isWGS84&&t.isWebMercator||e.isWebMercator&&t.isWGS84}function Z(e,t,r){const o=V(e),n=$(e);z(o,t,r),z(n,t,r)}function H(e){return(null==e.geometryType||"triangles"===e.geometryType)&&((null==e.topology||"PerAttributeArray"===e.topology)&&null!=e.vertexAttributes?.position)}function J(e){if(null==e.store?.defaultGeometrySchema||!H(e.store.defaultGeometrySchema))throw new r("scenelayer:unsupported-geometry-schema","The geometry schema of this scene layer is not supported.",{url:e.parsedUrl.path})}function N(e,t){Z(e,t.spatialReference,t.viewingMode)}function X(e){return null!=e.geometryType&&"points"===e.geometryType&&((null==e.topology||"PerAttributeArray"===e.topology)&&((null==e.encoding||""===e.encoding||"lepcc-xyz"===e.encoding)&&null!=e.vertexAttributes?.position))}function Y(e){if(null==e.store?.defaultGeometrySchema||!X(e.store.defaultGeometrySchema))throw new r("pointcloud:unsupported-geometry-schema","The geometry schema of this point cloud scene layer is not supported.",{})}function _(e,t){z(e.spatialReference,t.spatialReference,t.viewingMode)}function ee(e){return"simple"===e.type||"class-breaks"===e.type||"unique-value"===e.type}function te(e){return"mesh-3d"===e.type}function re(e){if(null==e||!ee(e))return!0;if(("unique-value"===e.type||"class-breaks"===e.type)&&null==e.defaultSymbol)return!0;const t=e.symbols;if(0===t.length)return!0;for(const r of t){if(!te(r)||0===r.symbolLayers.length)return!0;for(const e of r.symbolLayers.items)if("fill"!==e.type||null==e.material?.color||"replace"!==e.material.colorMixMode)return!0}return!1}const oe=v({color:[0,0,0,0],opacity:0});class ne{constructor(){this.edgeMaterial=null,this.material=null,this.castShadows=!0}}function ie(e){const t=new ne;let r=!1,o=!1;for(const n of e.symbolLayers.items)if("fill"===n.type&&n.enabled){const e=n.material,i=n.edges;if(null!=e&&!r){const o=e.color,i=S(e.colorMixMode),s={strength:e.emissive?.strength??j,source:"color"===e.emissive?.source?1:0};t.material=null!=o?{color:[o.r/255,o.g/255,o.b/255],alpha:o.a,colorMixMode:i,emissive:s}:{color:[1,1,1],alpha:1,colorMixMode:1,emissive:s},t.castShadows=n.castShadows,r=!0}null==i||o||(t.edgeMaterial=x(i,{}),o=!0)}return t.material||(t.material={color:[1,1,1],alpha:1,colorMixMode:1,emissive:{strength:j,source:0}}),t}function se(e,t){return(0|e)+(0|t)|0}function ae(e,t,r,n,a,l,c){if(!l||0===l.length||null==t||!e.serviceMbsInIndexSR)return null;const f=w(e.serviceMbsInIndexSR,a,"none",r,t);o(de,f);let h=null;const y=()=>{if(!h)if(h=le,p(ue),null!=e.serviceObbInIndexSR){e.serviceObbInIndexSR.transform(fe,r,t,a,c),fe.getCorners(h);for(const e of h)i(e,e,de),m(ue,e)}else{const o=e.serviceMbsInIndexSR;if(!o)return;const n=o.radius;u(o.center,r,pe,t),i(pe,pe,de),pe[2]+=a;for(let e=0;e<8;++e){const t=1&e?n:-n,r=2&e?n:-n,o=4&e?n:-n,i=h[e];s(i,[pe[0]+t,pe[1]+r,pe[2]+o]),m(ue,i)}}};let g=1/0,b=-1/0;const v=e=>{if("replace"!==e.type)return;const r=e.geometry;if(!r?.hasZ)return;p(ce);const o=r.spatialReference||n,s=r.rings.reduce((e,r)=>r.reduce((e,r)=>(u(r,o,pe,t),i(pe,pe,de),m(ce,pe),Math.min(pe[2],e)),e),1/0);y(),d(ue,ce)&&(g=Math.min(g,s),b=Math.max(b,s))};if(l.forEach(e=>v(e)),g===1/0)return null;const x=(e,t,r)=>{i(pe,r,f),e[t]=pe[0],e[t+1]=pe[1],e[t+2]=pe[2],t+=24,r[2]=g,i(pe,r,f),e[t]=pe[0],e[t+1]=pe[1],e[t+2]=pe[2],t+=24,r[2]=b,i(pe,r,f),e[t]=pe[0],e[t+1]=pe[1],e[t+2]=pe[2]};for(let o=0;o<8;++o)x(me.data,3*o,h[o]);return R(me)}const le=[a(),a(),a(),a(),a(),a(),a(),a()],ce=f(),ue=f(),fe=new M,pe=a(),me={data:new Array(72),size:3,exclusive:!0,stride:3},de=n();export{ne as SymbolInfo,se as addWraparound,_ as checkPointCloudLayerCompatibleWithView,Y as checkPointCloudLayerValid,Q as checkRecyclable,N as checkSceneLayerCompatibleWithView,J as checkSceneLayerValid,z as checkSpatialReference,Z as checkSpatialReferences,ae as computeVisibilityObb,k as containsDraco,T as extractWkid,W as filterInPlace,q as findFieldsCaseInsensitive,U as findIntersectingNodes,A as getClipRect,V as getIndexCrs,ie as getSymbolInfo,$ as getVertexCrs,L as intersectBoundingRectWithMbs,D as isSupportedLocalModeProjection,C as objectIdFilter,E as queryAttributesFromCachedAttributesId,re as rendererNeedsTextures,oe as transparentEdgeMaterial,F as whenGraphicAttributes};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{disposeMaybe as t}from"../../../../core/maybe.js";import i from"../../../../core/PooledArray.js";import{createScreenPointArray as s}from"../../../../core/screenUtils.js";import{property as r,subclass as n}from"../../../../core/accessorSupport/decorators.js";import{subtract as o,length as a,scale as l,negate as h,dot as c,squaredLength as d,distance as u}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as g,clone as p}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{set as m}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{create as _,offset as f,contains as P,containsPoint as x,set as b,positiveInfinity as S,equals as w}from"../../../../geometry/support/aaBoundingBox.js";import{create as R}from"../../../../geometry/support/plane.js";import{fromPoints as y}from"../../../../geometry/support/ray.js";import{Sphere as z}from"../../../../geometry/support/sphere.js";import{PclTarget as v}from"./Intersector.js";import{PointCloudHighlights as j}from"./PointCloudHighlights.js";import{isColor as q,isHighlight as F,isDepth as H}from"../../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{SyncRenderPlugin as O}from"../../webgl-engine/effects/RenderPlugin.js";import{IntersectorResult as A}from"../../webgl-engine/lib/IntersectorResult.js";import{screenPolygonIntersectsCircle as E}from"../../webgl-engine/lib/screenPolygonOverlapUtils.js";import{VertexArrayObject as I}from"../../webgl-engine/lib/VertexArrayObject.js";import{P as B,g as M}from"../../../../chunks/PointRenderer.glsl.js";import{PointRendererTechnique as V,positionsLayout as N,colorsLayout as T}from"../../webgl-engine/shaders/PointRendererTechnique.js";import{PointRendererTechniqueConfiguration as C}from"../../webgl-engine/shaders/PointRendererTechniqueConfiguration.js";import{PrimitiveType as U}from"../../../webgl/enums.js";import{VertexBuffer as D}from"../../../webgl/VertexBuffer.js";let W=class extends O{constructor(e){super(e),this.type=6,this.isGround=!1,this._passParameters=new B,this._highlights=new j({forEachNode:e=>this.forEachNode(e),addHighlights:(e,t,i)=>this._addHighlights(e,t,i),removeHighlight:(e,t)=>this._removeHighlight(e,t)}),this.produces=new Map([[2,e=>q(e)||F(e)&&!this._highlights.empty],[3,e=>H(e)]]),this.point=g(),this.intersectionRayDir=g(),this.intersectionPlane=R(),this.nodeOriginOffset=g(),this.nodeBoundingBox=_(),this.layerViewUid="",this._slicePlaneEnabled=!1,this._configuration=new C,this._nodes=new i,this._highlightsInOrder=null}destroy(){this._nodes.prune()}hasHighlight(e){return this._highlights.has(e)}initializeRenderContext(e){this._context=e,e.requestRender()}uninitializeRenderContext(){}intersectRay(e,t,i,s){const{point:r,intersectionRayDir:n,nodeOriginOffset:u,intersectionPlane:p,layerViewUid:b,nodeBoundingBox:S}=this,w=y(i,s),R=this._passParameters,j=e.camera.perScreenPixelRatio/2,q=e.camera.near;o(n,s,i);const F=1/a(n);l(n,n,F);const H=g();h(H,n),m(p,n[0],n[1],n[2],-c(n,i));const O=new Y,E=new Y,I=new Array,B=_(R.clipBox);f(B,-i[0],-i[1],-i[2],B);const M=new J;this._nodes.forAll(a=>{const{isLeaf:l,coordinates:h}=a,g=a.splatSize*R.scaleFactor;let{min:m,max:_}=a.obb.signedDistanceRangePlane(p);m-=L(g,m+q,R,j,l),_-=L(g,_+q,R,j,l);const y=_<0,v=null!=O.dist&&null!=E.dist&&O.dist<m*F&&E.dist>_*F;if(y||v)return;const A=G(g,_+q,R,j,l);if(!new z(a.obb.getCenter($),a.obb.radius+A).intersectRay(w))return;if(!a.obb.intersectRay(i,n,A))return;const V=A*A;a.obb.toAaBoundingBox(S),f(S,-i[0],-i[1],-i[2],S);const N=!P(B,S);o(u,a.origin,i);const T=h.length/3;for(let o=0;o<T;o++){const p=3*o;if(r[0]=u[0]+h[p],r[1]=u[1]+h[p+1],r[2]=u[2]+h[p+2],N&&!x(B,r))continue;const m=c(r,n),_=m*m,f=d(r)-_;if(f>V)continue;const{distance:P,radius:S}=K(M,g,m+q,R,j,l),w=P-q;if(w<0)continue;if(f>S*S)continue;const y=w*F,z=e=>(e.point=e.point?Q(a,o,e.point):Q(a,o),e.dist=y,e.normal=H,e.node=a,e.pointId=o,e.layerViewUid=b,e);if((null==O.dist||y<O.dist)&&(null==t||t(i,s,y))&&z(O),0!==e.options.store&&(null==E.dist||y>E.dist)&&(null==t||t(i,s,y))&&z(E),2===e.options.store&&(null==t||t(i,s,y))){const e=new Y;I.push(z(e))}}});const V=e=>{const{layerViewUid:t,node:i,pointId:s}=e;return new v(e.point,t,s,()=>this.createGraphic(i,s,e.point))},N=(e,t)=>{const i=V(t);e.set(this.type,i,t.dist,t.normal)};if(Z(O)){const t=e.results.min;(null==t.distance||O.dist<t.distance)&&N(t,O)}if(Z(E)&&0!==e.options.store){const t=e.results.max;(null==t.distance||E.dist>t.distance)&&N(t,E)}if(2===e.options.store)for(const o of I){const t=new A(w);N(t,o),e.results.all.push(t)}}*intersectScreenPolygon(e,t){const i=e.camera,{screenPolygonPrimitiveProcessor:s}=e,{point:r,layerViewUid:n,_nodes:a}=this,l=this._passParameters,h=i.perScreenPixelRatio/2,{eye:d,near:g,viewForward:_}=i,f=m(ie,_[0],_[1],_[2],-c(_,d)),P=new J,{bounds:x,broadPhaseFrustum:b}=t,{scaleFactor:S}=l;for(let m=0;m<a.length;++m){const w=a.data[m],{isLeaf:R,obb:y}=w,z=w.splatSize*S,j=k(l,R),q=G(z,Math.max(y.signedDistanceRangePlane(f).max,g),l,h,R);if(!y.intersectsFrustumConservativeApproximationWithMargin(b,q))continue;const{coordinates:F}=w,H=F.length/3;for(let a=0;a<H;a++){if(!s.validatePoint(Q(w,a,r)))continue;if(!i.projectToScreen(r,ee))continue;if(!X(x,ee,j))continue;const m=c(o(te,r,d),_),{distance:f,radius:b}=K(P,z,m,l,h,R);if(f<g)continue;const S=b/i.computeScreenPixelSizeAtDist(f);E(t,ee,S)&&e.polygonResults.add(this.type,new v(p(r),n,null,()=>this.createGraphic(w,a,r)),u(d,r))}yield}}acquireTechniques(e){const t=10===e.output;return 0!==this._nodes.length&&(q(e.output)||H(e.output)&&3===e.bind.slot||t)?(this._nodes.forAll(t=>this._initNode(e,t)),this._configuration.drawScreenSize=this._passParameters.drawScreenSpace,this._configuration.useFixedSizes=this._passParameters.useFixedSizes,this._configuration.hasSlicePlane=this._slicePlaneEnabled,this._configuration.hasOccludees=e.bind.hasOccludees,this._configuration.clippingEnabled=this._clippingEnabled,this._configuration.hasHighlightMixTexture=t&&null!=e.bind.highlightMixTexture,this._configuration.output=e.output,this._configuration.hasEmission=e.bind.hasEmission,this._context.techniques.get(V,this._configuration)):null}render(e,t){const{rctx:i,bind:s,output:r}=e,n=i.bindTechnique(t,s,this._passParameters),o=10===r,a=s.highlight?.name??null;o&&!a||(o&&s.highlights!==this._highlightsInOrder&&this._updateResolvedHighlights(s.highlights),this._nodes.forAll(t=>{const r=o?t.resolvedHighlightRanges.get(a):null;0===t.coordinates.length||null==t.vao||o&&null==r||(n.assertCompatibleVertexAttributeLocations(t.vao),n.bindDraw(s,this._passParameters,t),i.bindVAO(t.vao),o?this._renderHighlightFragments(e,r):i.drawArrays(U.POINTS,0,t.coordinates.length/3))}))}_renderHighlightFragments(e,t){const{rctx:i}=e;for(let s=0;s<t.length;s+=2)i.drawArrays(U.POINTS,t[s],t[s+1])}set useFixedSizes(e){this._passParameters.useFixedSizes!==e&&(this._passParameters.useFixedSizes=e,this._requestRender())}get useFixedSizes(){return this._passParameters.useFixedSizes}set scaleFactor(e){this._passParameters.scaleFactor!==e&&(this._passParameters.scaleFactor=e,this._requestRender())}get scaleFactor(){return this._passParameters.scaleFactor}set minSizePx(e){this._passParameters.minSizePx!==e&&(this._passParameters.minSizePx=e,this._requestRender())}get minSizePx(){return this._passParameters.minSizePx}set useRealWorldSymbolSizes(e){this._passParameters.useRealWorldSymbolSizes!==e&&(this._passParameters.useRealWorldSymbolSizes=e,this._requestRender())}get useRealWorldSymbolSizes(){return this._passParameters.useRealWorldSymbolSizes}set size(e){this._passParameters.size!==e&&(this._passParameters.size=e,this._requestRender())}get size(){return this._passParameters.size}set sizePx(e){this._passParameters.sizePx!==e&&(this._passParameters.sizePx=e,this._requestRender())}get sizePx(){return this._passParameters.sizePx}set clippingBox(e){b(this._passParameters.clipBox,e||S)}get _clippingEnabled(){return!w(this._passParameters.clipBox,S,(e,t)=>e===t)}get slicePlaneEnabled(){return this._slicePlaneEnabled}set slicePlaneEnabled(e){this._slicePlaneEnabled!==e&&(this._slicePlaneEnabled=e,this._requestRender())}addNode(e){this._nodes.push(e),e.clearHighlights(),this._highlights.nodeAdded(e),this._requestRender()}removeNode(e){let i=null;return this._nodes.filterInPlace(s=>s.id!==e||(i=s,s.vao=t(s.vao),this._highlights.nodeRemoved(s),!1)),this._requestRender(),i}forEachNode(e){this._nodes.forEach(e)}removeAll(){this._nodes.forAll(e=>e.vao=t(e.vao)),this._highlights.removeAll(),this._nodes.clear(),this._requestRender()}highlight(e,t){return this._highlights.add(e,t)}_addHighlights(e,t,i){for(const s of t)e.addHighlight(s,i);this._highlightsInOrder&&e.updateResolvedHighlights(this._highlightsInOrder),this._requestRender()}_removeHighlight(e,t){e.removeHighlight(t),this._highlightsInOrder&&e.updateResolvedHighlights(this._highlightsInOrder),this._requestRender()}_initNode(e,t){t.vao??=new I(e.rctx,new Map([["positions",new D(e.rctx,N,t.coordinates)],["colors",new D(e.rctx,T,t.rgb)]]))}_requestRender(){this._context&&this._context.requestRender()}_updateResolvedHighlights(e){this._highlightsInOrder=e,this._nodes.forAll(t=>t.updateResolvedHighlights(e))}};function G(e,t,i,s,r){if(i.drawScreenSpace)return i.fixedSize*t*s;const n=M(r)*t*s;return i.useFixedSizes?Math.min(i.fixedSize/2,n):i.screenMinSize>0?Math.min(Math.max(i.screenMinSize*t*s,e/2),n):Math.min(e/2,n)}function L(e,t,i,s,r){return i.drawScreenSpace?0:G(e,t,i,s,r)}function k(e,t){return e.drawScreenSpace?e.fixedSize/2:M(t)/2}e([r({constructOnly:!0})],W.prototype,"createGraphic",void 0),W=e([n("esri.views.3d.layers.i3s.PointCloudRenderer")],W);class J{constructor(){this.distance=0,this.radius=0}}function K(e,t,i,s,r,n){const o=i-L(t,i,s,r,n);return e.distance=o,e.radius=G(t,o,s,r,n),e}function Q(e,t,i=g()){return i[0]=e.origin[0]+e.coordinates[3*t],i[1]=e.origin[1]+e.coordinates[3*t+1],i[2]=e.origin[2]+e.coordinates[3*t+2],i}function X(e,t,i){return t[0]>=e[0]-i&&t[0]<=e[2]+i&&t[1]>=e[1]-i&&t[1]<=e[3]+i}class Y{constructor(){this.node=null,this.pointId=null,this.point=null,this.dist=null,this.normal=null,this.layerViewUid=""}}function Z(e){return null!=e.dist&&null!=e.point&&null!=e.pointId&&null!=e.node}const $=g(),ee=s(),te=g(),ie=R();export{W as PointCloudRenderer};
2
+ import{__decorate as e}from"tslib";import{disposeMaybe as t}from"../../../../core/maybe.js";import i from"../../../../core/PooledArray.js";import{createScreenPointArray as s}from"../../../../core/screenUtils.js";import{property as r,subclass as n}from"../../../../core/accessorSupport/decorators.js";import{subtract as o,length as a,scale as l,negate as h,dot as c,squaredLength as d,distance as u}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as g,clone as p}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{set as m}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{create as _,offset as f,contains as P,containsPoint as x,set as b,positiveInfinity as S,equals as w}from"../../../../geometry/support/aaBoundingBox.js";import{create as R}from"../../../../geometry/support/plane.js";import{fromPoints as y}from"../../../../geometry/support/ray.js";import{Sphere as z}from"../../../../geometry/support/sphere.js";import{PclTarget as v}from"./Intersector.js";import{PointCloudHighlights as j}from"./PointCloudHighlights.js";import{isColor as q,isHighlight as F,isDepth as H}from"../../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{SyncRenderPlugin as O}from"../../webgl-engine/effects/RenderPlugin.js";import{IntersectorResultRay as A}from"../../webgl-engine/lib/IntersectorResult.js";import{screenPolygonIntersectsCircle as E}from"../../webgl-engine/lib/screenPolygonOverlapUtils.js";import{VertexArrayObject as I}from"../../webgl-engine/lib/VertexArrayObject.js";import{P as B,g as M}from"../../../../chunks/PointRenderer.glsl.js";import{PointRendererTechnique as V,positionsLayout as N,colorsLayout as T}from"../../webgl-engine/shaders/PointRendererTechnique.js";import{PointRendererTechniqueConfiguration as C}from"../../webgl-engine/shaders/PointRendererTechniqueConfiguration.js";import{PrimitiveType as U}from"../../../webgl/enums.js";import{VertexBuffer as D}from"../../../webgl/VertexBuffer.js";let W=class extends O{constructor(e){super(e),this.type=6,this.isGround=!1,this._passParameters=new B,this._highlights=new j({forEachNode:e=>this.forEachNode(e),addHighlights:(e,t,i)=>this._addHighlights(e,t,i),removeHighlight:(e,t)=>this._removeHighlight(e,t)}),this.produces=new Map([[2,e=>q(e)||F(e)&&!this._highlights.empty],[3,e=>H(e)]]),this.point=g(),this.intersectionRayDir=g(),this.intersectionPlane=R(),this.nodeOriginOffset=g(),this.nodeBoundingBox=_(),this.layerViewUid="",this._slicePlaneEnabled=!1,this._configuration=new C,this._nodes=new i,this._highlightsInOrder=null}destroy(){this._nodes.prune()}hasHighlight(e){return this._highlights.has(e)}initializeRenderContext(e){this._context=e,e.requestRender()}uninitializeRenderContext(){}intersectRay(e,t,i,s){const{point:r,intersectionRayDir:n,nodeOriginOffset:u,intersectionPlane:p,layerViewUid:b,nodeBoundingBox:S}=this,w=y(i,s),R=this._passParameters,j=e.camera.perScreenPixelRatio/2,q=e.camera.near;o(n,s,i);const F=1/a(n);l(n,n,F);const H=g();h(H,n),m(p,n[0],n[1],n[2],-c(n,i));const O=new Y,E=new Y,I=new Array,B=_(R.clipBox);f(B,-i[0],-i[1],-i[2],B);const M=new J;this._nodes.forAll(a=>{const{isLeaf:l,coordinates:h}=a,g=a.splatSize*R.scaleFactor;let{min:m,max:_}=a.obb.signedDistanceRangePlane(p);m-=L(g,m+q,R,j,l),_-=L(g,_+q,R,j,l);const y=_<0,v=null!=O.dist&&null!=E.dist&&O.dist<m*F&&E.dist>_*F;if(y||v)return;const A=G(g,_+q,R,j,l);if(!new z(a.obb.getCenter($),a.obb.radius+A).intersectRay(w))return;if(!a.obb.intersectRay(i,n,A))return;const V=A*A;a.obb.toAaBoundingBox(S),f(S,-i[0],-i[1],-i[2],S);const N=!P(B,S);o(u,a.origin,i);const T=h.length/3;for(let o=0;o<T;o++){const p=3*o;if(r[0]=u[0]+h[p],r[1]=u[1]+h[p+1],r[2]=u[2]+h[p+2],N&&!x(B,r))continue;const m=c(r,n),_=m*m,f=d(r)-_;if(f>V)continue;const{distance:P,radius:S}=K(M,g,m+q,R,j,l),w=P-q;if(w<0)continue;if(f>S*S)continue;const y=w*F,z=e=>(e.point=e.point?Q(a,o,e.point):Q(a,o),e.dist=y,e.normal=H,e.node=a,e.pointId=o,e.layerViewUid=b,e);if((null==O.dist||y<O.dist)&&(null==t||t(i,s,y))&&z(O),0!==e.options.store&&(null==E.dist||y>E.dist)&&(null==t||t(i,s,y))&&z(E),2===e.options.store&&(null==t||t(i,s,y))){const e=new Y;I.push(z(e))}}});const V=e=>{const{layerViewUid:t,node:i,pointId:s}=e;return new v(e.point,t,s,()=>this.createGraphic(i,s,e.point))},N=(e,t)=>{const i=V(t);e.set(this.type,i,t.dist,t.normal)};if(Z(O)){const t=e.results.min;(null==t.distance||O.dist<t.distance)&&N(t,O)}if(Z(E)&&0!==e.options.store){const t=e.results.max;(null==t.distance||E.dist>t.distance)&&N(t,E)}if(2===e.options.store)for(const o of I){const t=new A(w);N(t,o),e.results.all.push(t)}}*intersectScreenPolygon(e,t){const i=e.camera,{screenPolygonPrimitiveProcessor:s}=e,{point:r,layerViewUid:n,_nodes:a}=this,l=this._passParameters,h=i.perScreenPixelRatio/2,{eye:d,near:g,viewForward:_}=i,f=m(ie,_[0],_[1],_[2],-c(_,d)),P=new J,{bounds:x,broadPhaseFrustum:b}=t,{scaleFactor:S}=l;for(let m=0;m<a.length;++m){const w=a.data[m],{isLeaf:R,obb:y}=w,z=w.splatSize*S,j=k(l,R),q=G(z,Math.max(y.signedDistanceRangePlane(f).max,g),l,h,R);if(!y.intersectsFrustumConservativeApproximationWithMargin(b,q))continue;const{coordinates:F}=w,H=F.length/3;for(let a=0;a<H;a++){if(!s.validatePoint(Q(w,a,r)))continue;if(!i.projectToScreen(r,ee))continue;if(!X(x,ee,j))continue;const m=c(o(te,r,d),_),{distance:f,radius:b}=K(P,z,m,l,h,R);if(f<g)continue;const S=b/i.computeScreenPixelSizeAtDist(f);E(t,ee,S)&&e.polygonResults.add(this.type,new v(p(r),n,null,()=>this.createGraphic(w,a,r)),u(d,r))}yield}}acquireTechniques(e){const t=10===e.output;return 0!==this._nodes.length&&(q(e.output)||H(e.output)&&3===e.bind.slot||t)?(this._nodes.forAll(t=>this._initNode(e,t)),this._configuration.drawScreenSize=this._passParameters.drawScreenSpace,this._configuration.useFixedSizes=this._passParameters.useFixedSizes,this._configuration.hasSlicePlane=this._slicePlaneEnabled,this._configuration.hasOccludees=e.bind.hasOccludees,this._configuration.clippingEnabled=this._clippingEnabled,this._configuration.hasHighlightMixTexture=t&&null!=e.bind.highlightMixTexture,this._configuration.output=e.output,this._configuration.hasEmission=e.bind.hasEmission,this._context.techniques.get(V,this._configuration)):null}render(e,t){const{rctx:i,bind:s,output:r}=e,n=i.bindTechnique(t,s,this._passParameters),o=10===r,a=s.highlight?.name??null;o&&!a||(o&&s.highlights!==this._highlightsInOrder&&this._updateResolvedHighlights(s.highlights),this._nodes.forAll(t=>{const r=o?t.resolvedHighlightRanges.get(a):null;0===t.coordinates.length||null==t.vao||o&&null==r||(n.assertCompatibleVertexAttributeLocations(t.vao),n.bindDraw(s,this._passParameters,t),i.bindVAO(t.vao),o?this._renderHighlightFragments(e,r):i.drawArrays(U.POINTS,0,t.coordinates.length/3))}))}_renderHighlightFragments(e,t){const{rctx:i}=e;for(let s=0;s<t.length;s+=2)i.drawArrays(U.POINTS,t[s],t[s+1])}set useFixedSizes(e){this._passParameters.useFixedSizes!==e&&(this._passParameters.useFixedSizes=e,this._requestRender())}get useFixedSizes(){return this._passParameters.useFixedSizes}set scaleFactor(e){this._passParameters.scaleFactor!==e&&(this._passParameters.scaleFactor=e,this._requestRender())}get scaleFactor(){return this._passParameters.scaleFactor}set minSizePx(e){this._passParameters.minSizePx!==e&&(this._passParameters.minSizePx=e,this._requestRender())}get minSizePx(){return this._passParameters.minSizePx}set useRealWorldSymbolSizes(e){this._passParameters.useRealWorldSymbolSizes!==e&&(this._passParameters.useRealWorldSymbolSizes=e,this._requestRender())}get useRealWorldSymbolSizes(){return this._passParameters.useRealWorldSymbolSizes}set size(e){this._passParameters.size!==e&&(this._passParameters.size=e,this._requestRender())}get size(){return this._passParameters.size}set sizePx(e){this._passParameters.sizePx!==e&&(this._passParameters.sizePx=e,this._requestRender())}get sizePx(){return this._passParameters.sizePx}set clippingBox(e){b(this._passParameters.clipBox,e||S)}get _clippingEnabled(){return!w(this._passParameters.clipBox,S,(e,t)=>e===t)}get slicePlaneEnabled(){return this._slicePlaneEnabled}set slicePlaneEnabled(e){this._slicePlaneEnabled!==e&&(this._slicePlaneEnabled=e,this._requestRender())}addNode(e){this._nodes.push(e),e.clearHighlights(),this._highlights.nodeAdded(e),this._requestRender()}removeNode(e){let i=null;return this._nodes.filterInPlace(s=>s.id!==e||(i=s,s.vao=t(s.vao),this._highlights.nodeRemoved(s),!1)),this._requestRender(),i}forEachNode(e){this._nodes.forEach(e)}removeAll(){this._nodes.forAll(e=>e.vao=t(e.vao)),this._highlights.removeAll(),this._nodes.clear(),this._requestRender()}highlight(e,t){return this._highlights.add(e,t)}_addHighlights(e,t,i){for(const s of t)e.addHighlight(s,i);this._highlightsInOrder&&e.updateResolvedHighlights(this._highlightsInOrder),this._requestRender()}_removeHighlight(e,t){e.removeHighlight(t),this._highlightsInOrder&&e.updateResolvedHighlights(this._highlightsInOrder),this._requestRender()}_initNode(e,t){t.vao??=new I(e.rctx,new Map([["positions",new D(e.rctx,N,t.coordinates)],["colors",new D(e.rctx,T,t.rgb)]]))}_requestRender(){this._context&&this._context.requestRender()}_updateResolvedHighlights(e){this._highlightsInOrder=e,this._nodes.forAll(t=>t.updateResolvedHighlights(e))}};function G(e,t,i,s,r){if(i.drawScreenSpace)return i.fixedSize*t*s;const n=M(r)*t*s;return i.useFixedSizes?Math.min(i.fixedSize/2,n):i.screenMinSize>0?Math.min(Math.max(i.screenMinSize*t*s,e/2),n):Math.min(e/2,n)}function L(e,t,i,s,r){return i.drawScreenSpace?0:G(e,t,i,s,r)}function k(e,t){return e.drawScreenSpace?e.fixedSize/2:M(t)/2}e([r({constructOnly:!0})],W.prototype,"createGraphic",void 0),W=e([n("esri.views.3d.layers.i3s.PointCloudRenderer")],W);class J{constructor(){this.distance=0,this.radius=0}}function K(e,t,i,s,r,n){const o=i-L(t,i,s,r,n);return e.distance=o,e.radius=G(t,o,s,r,n),e}function Q(e,t,i=g()){return i[0]=e.origin[0]+e.coordinates[3*t],i[1]=e.origin[1]+e.coordinates[3*t+1],i[2]=e.origin[2]+e.coordinates[3*t+2],i}function X(e,t,i){return t[0]>=e[0]-i&&t[0]<=e[2]+i&&t[1]>=e[1]-i&&t[1]<=e[3]+i}class Y{constructor(){this.node=null,this.pointId=null,this.point=null,this.dist=null,this.normal=null,this.layerViewUid=""}}function Z(e){return null!=e.dist&&null!=e.point&&null!=e.pointId&&null!=e.node}const $=g(),ee=s(),te=g(),ie=R();export{W as PointCloudRenderer};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{create as e}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{project as t}from"../../../../geometry/projectionUtils.js";import{fromExtent as i}from"../../../../geometry/support/aaBoundingRect.js";import{Tiles3DTarget as n}from"../i3s/Intersector.js";import{createTileBVH as r}from"./Tiles3DBVH.js";import{ElevationRange as s}from"../../support/ElevationRange.js";import{IntersectorResult as o}from"../../webgl-engine/lib/IntersectorResult.js";import{MeshIntersectionOptions as l,computeInvDir as a,intersectAabbInvDir as c}from"../../webgl-engine/lib/RayIntersections.js";class d{constructor(e){this.layerView=e,this.type=8,this.slicePlaneEnabled=!1,this.isGround=!0,this.layerViewUid=e.uid;const n=e.view.viewingMode,s=(e.useEsriCrs?e.fullExtentInLocalViewSpatialReference:e.layer.fullExtent?t(e.layer.fullExtent,e.view.renderSpatialReference):void 0)??e.view.extent,o=i(s);this._bvh=r(n,o)}destroy(){this._bvh.destroy()}addTile(e){this._bvh.addTile(e)}removeTile(e){this._bvh.removeTile(e)}intersectRay(e,t,i,r,s,d){if(e.options.filteredLayerViewUids.includes(this.layerView.uid))return;const{results:m,tolerance:p}=e,h=2===e.options.store,{componentObjectCollection:f}=this.layerView.view.stage.renderView,g=new l(p,d,e.options.normalRequired),w=a(i,r,u),y=(s,l,a)=>{if(l<0)return;if(null!=t&&!t(i,r,l))return;const c=e=>{const t=new n(this.layerView.uid);e.set(this.type,t,l,a)};if(this.isGround&&(null==m.ground.distance||l<m.ground.distance)&&c(m.ground),!e.options.isFiltered&&((null==m.min.distance||l<m.min.distance)&&c(m.min),(null==m.max.distance||l>m.max.distance)&&c(m.max),h)){const t=new o(e.ray);c(t),e.results.all.push(t)}};this._bvh.forEachTileIntersectingRay(i,r,e=>{const{componentObjects:t}=e;for(const n of t)c(n.aabbInWorldCoordinates,i,w,0)&&f.intersectRay(n,i,r,null,g,y)},d)}getElevationRange(e){return this._bvh.getElevationRangeIntersectingSphere(e)??new s(0,0)}}const u=e();export{d as Tiles3DMeshIntersectionHandler};
2
+ import{create as e}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{project as t}from"../../../../geometry/projectionUtils.js";import{fromExtent as i}from"../../../../geometry/support/aaBoundingRect.js";import{Tiles3DTarget as n}from"../i3s/Intersector.js";import{createTileBVH as r}from"./Tiles3DBVH.js";import{ElevationRange as s}from"../../support/ElevationRange.js";import{IntersectorResultRay as o}from"../../webgl-engine/lib/IntersectorResult.js";import{MeshIntersectionOptions as l,computeInvDir as a,intersectAabbInvDir as c}from"../../webgl-engine/lib/RayIntersections.js";class d{constructor(e){this.layerView=e,this.type=8,this.slicePlaneEnabled=!1,this.isGround=!0,this.layerViewUid=e.uid;const n=e.view.viewingMode,s=(e.useEsriCrs?e.fullExtentInLocalViewSpatialReference:e.layer.fullExtent?t(e.layer.fullExtent,e.view.renderSpatialReference):void 0)??e.view.extent,o=i(s);this._bvh=r(n,o)}destroy(){this._bvh.destroy()}addTile(e){this._bvh.addTile(e)}removeTile(e){this._bvh.removeTile(e)}intersectRay(e,t,i,r,s,d){if(e.options.filteredLayerViewUids.includes(this.layerView.uid))return;const{results:m,tolerance:p}=e,h=2===e.options.store,{componentObjectCollection:f}=this.layerView.view.stage.renderView,g=new l(p,d,e.options.normalRequired),w=a(i,r,u),y=(s,l,a)=>{if(l<0)return;if(null!=t&&!t(i,r,l))return;const c=e=>{const t=new n(this.layerView.uid);e.set(this.type,t,l,a)};if(this.isGround&&(null==m.ground.distance||l<m.ground.distance)&&c(m.ground),!e.options.isFiltered&&((null==m.min.distance||l<m.min.distance)&&c(m.min),(null==m.max.distance||l>m.max.distance)&&c(m.max),h)){const t=new o(e.ray);c(t),e.results.all.push(t)}};this._bvh.forEachTileIntersectingRay(i,r,e=>{const{componentObjects:t}=e;for(const n of t)c(n.aabbInWorldCoordinates,i,w,0)&&f.intersectRay(n,i,r,null,g,y)},d)}getElevationRange(e){return this._bvh.getElevationRangeIntersectingSphere(e)??new s(0,0)}}const u=e();export{d as Tiles3DMeshIntersectionHandler};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as E}from"tslib";import _ from"../../../core/Accessor.js";import{property as S,subclass as o}from"../../../core/accessorSupport/decorators.js";let T=class extends _{constructor(){super(...arguments),this.SCENEVIEW_HITTEST_RETURN_INTERSECTOR=!1,this.DECONFLICTOR_SHOW_VISIBLE=!1,this.DECONFLICTOR_SHOW_INVISIBLE=!1,this.DECONFLICTOR_SHOW_GRID=!1,this.LABELS_SHOW_BORDER=!1,this.TEXT_SHOW_BASELINE=!1,this.TEXT_SHOW_BORDER=!1,this.OVERLAY_DRAW_DEBUG_TEXTURE=!1,this.OVERLAY_SHOW_CENTER=!1,this.SHOW_POI=!1,this.OCCLUSION_QUERY_DEBUG_PIXEL=!1,this.ENABLE_OPTIMIZATIONS=!0,this.TESTS_DISABLE_FAST_UPDATES=!1,this.DRAW_MESH_GEOMETRY_NORMALS=!1,this.FEATURE_TILE_FETCH_SHOW_TILES=!1,this.FEATURE_TILE_TREE_SHOW_TILES=!1,this.TERRAIN_TILE_TREE_SHOW_TILES=!1,this.I3S_TREE_SHOW_TILES=!1,this.I3S_SHOW_MODIFICATIONS=!1,this.LOD_INSTANCE_RENDERER_DISABLE_UPDATES=!1,this.LOD_INSTANCE_RENDERER_COLORIZE_BY_LEVEL=!1,this.EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES=!1,this.LINE_WIREFRAMES=!1,this.FLOW_GLOBAL_SCALE_THRESHOLD=null}};E([S()],T.prototype,"SCENEVIEW_HITTEST_RETURN_INTERSECTOR",void 0),E([S()],T.prototype,"DECONFLICTOR_SHOW_VISIBLE",void 0),E([S()],T.prototype,"DECONFLICTOR_SHOW_INVISIBLE",void 0),E([S()],T.prototype,"DECONFLICTOR_SHOW_GRID",void 0),E([S()],T.prototype,"LABELS_SHOW_BORDER",void 0),E([S()],T.prototype,"TEXT_SHOW_BASELINE",void 0),E([S()],T.prototype,"TEXT_SHOW_BORDER",void 0),E([S()],T.prototype,"OVERLAY_DRAW_DEBUG_TEXTURE",void 0),E([S()],T.prototype,"OVERLAY_SHOW_CENTER",void 0),E([S()],T.prototype,"SHOW_POI",void 0),E([S()],T.prototype,"OCCLUSION_QUERY_DEBUG_PIXEL",void 0),E([S()],T.prototype,"ENABLE_OPTIMIZATIONS",void 0),E([S()],T.prototype,"TESTS_DISABLE_FAST_UPDATES",void 0),E([S()],T.prototype,"DRAW_MESH_GEOMETRY_NORMALS",void 0),E([S()],T.prototype,"FEATURE_TILE_FETCH_SHOW_TILES",void 0),E([S()],T.prototype,"FEATURE_TILE_TREE_SHOW_TILES",void 0),E([S()],T.prototype,"TERRAIN_TILE_TREE_SHOW_TILES",void 0),E([S()],T.prototype,"I3S_TREE_SHOW_TILES",void 0),E([S()],T.prototype,"I3S_SHOW_MODIFICATIONS",void 0),E([S()],T.prototype,"LOD_INSTANCE_RENDERER_DISABLE_UPDATES",void 0),E([S()],T.prototype,"LOD_INSTANCE_RENDERER_COLORIZE_BY_LEVEL",void 0),E([S()],T.prototype,"EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES",void 0),E([S()],T.prototype,"LINE_WIREFRAMES",void 0),E([S()],T.prototype,"FLOW_GLOBAL_SCALE_THRESHOLD",void 0),T=E([o("esri.views.3d.support.debugFlags")],T);const t=new T;export{t as debugFlags};
2
+ import{__decorate as E}from"tslib";import _ from"../../../core/Accessor.js";import{property as S,subclass as o}from"../../../core/accessorSupport/decorators.js";let T=class extends _{constructor(){super(...arguments),this.SCENEVIEW_HITTEST_RETURN_INTERSECTOR=!1,this.DECONFLICTOR_SHOW_VISIBLE=!1,this.DECONFLICTOR_SHOW_INVISIBLE=!1,this.DECONFLICTOR_SHOW_GRID=!1,this.LABELS_SHOW_BORDER=!1,this.TEXT_SHOW_BASELINE=!1,this.TEXT_SHOW_BORDER=!1,this.OVERLAY_DRAW_DEBUG_TEXTURE=!1,this.OVERLAY_SHOW_CENTER=!1,this.SHOW_POI=!1,this.OCCLUSION_QUERY_DEBUG_PIXEL=!1,this.ENABLE_OPTIMIZATIONS=!0,this.TESTS_DISABLE_FAST_UPDATES=!1,this.DRAW_MESH_GEOMETRY_NORMALS=!1,this.FEATURE_TILE_FETCH_SHOW_TILES=!1,this.FEATURE_TILE_TREE_SHOW_TILES=!1,this.TERRAIN_TILE_TREE_SHOW_TILES=!1,this.I3S_TREE_SHOW_TILES=!1,this.I3S_SHOW_MODIFICATIONS=!1,this.UPDATING=!1,this.LOD_INSTANCE_RENDERER_DISABLE_UPDATES=!1,this.LOD_INSTANCE_RENDERER_COLORIZE_BY_LEVEL=!1,this.EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES=!1,this.LINE_WIREFRAMES=!1,this.FLOW_GLOBAL_SCALE_THRESHOLD=null}};E([S()],T.prototype,"SCENEVIEW_HITTEST_RETURN_INTERSECTOR",void 0),E([S()],T.prototype,"DECONFLICTOR_SHOW_VISIBLE",void 0),E([S()],T.prototype,"DECONFLICTOR_SHOW_INVISIBLE",void 0),E([S()],T.prototype,"DECONFLICTOR_SHOW_GRID",void 0),E([S()],T.prototype,"LABELS_SHOW_BORDER",void 0),E([S()],T.prototype,"TEXT_SHOW_BASELINE",void 0),E([S()],T.prototype,"TEXT_SHOW_BORDER",void 0),E([S()],T.prototype,"OVERLAY_DRAW_DEBUG_TEXTURE",void 0),E([S()],T.prototype,"OVERLAY_SHOW_CENTER",void 0),E([S()],T.prototype,"SHOW_POI",void 0),E([S()],T.prototype,"OCCLUSION_QUERY_DEBUG_PIXEL",void 0),E([S()],T.prototype,"ENABLE_OPTIMIZATIONS",void 0),E([S()],T.prototype,"TESTS_DISABLE_FAST_UPDATES",void 0),E([S()],T.prototype,"DRAW_MESH_GEOMETRY_NORMALS",void 0),E([S()],T.prototype,"FEATURE_TILE_FETCH_SHOW_TILES",void 0),E([S()],T.prototype,"FEATURE_TILE_TREE_SHOW_TILES",void 0),E([S()],T.prototype,"TERRAIN_TILE_TREE_SHOW_TILES",void 0),E([S()],T.prototype,"I3S_TREE_SHOW_TILES",void 0),E([S()],T.prototype,"I3S_SHOW_MODIFICATIONS",void 0),E([S()],T.prototype,"UPDATING",void 0),E([S()],T.prototype,"LOD_INSTANCE_RENDERER_DISABLE_UPDATES",void 0),E([S()],T.prototype,"LOD_INSTANCE_RENDERER_COLORIZE_BY_LEVEL",void 0),E([S()],T.prototype,"EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES",void 0),E([S()],T.prototype,"LINE_WIREFRAMES",void 0),E([S()],T.prototype,"FLOW_GLOBAL_SCALE_THRESHOLD",void 0),T=E([o("esri.views.3d.support.debugFlags")],T);const t=new T;export{t as debugFlags};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{subtract as t,length as i,scale as e,negate as n,dot as s,transformQuatValues as o}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{set as l}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{project as a}from"../../../../geometry/projectionUtils.js";import{intersects as c,contains as u}from"../../../../geometry/support/aaBoundingBox.js";import{fromExtent as d}from"../../../../geometry/support/aaBoundingRect.js";import{create as p}from"../../../../geometry/support/plane.js";import{fromPoints as f}from"../../../../geometry/support/ray.js";import{GaussianSplatTarget as h}from"../../layers/i3s/Intersector.js";import{createTileBVH as m}from"../../layers/support/Tiles3DBVH.js";import{ElevationRange as y}from"../ElevationRange.js";import{IntersectorResult as g}from"../../webgl-engine/lib/IntersectorResult.js";class w{constructor(t){this.layerView=t,this.type=0,this.slicePlaneEnabled=!1,this.isGround=!1,this._ellipsoidLocalRayOrigin=r(),this._ellipsoidLocalRayDir=r(),this.intersectionNormal=r(),this.intersectionRayDir=r(),this.intersectionPlane=p(),this.layerViewUid=t.uid;const i=t.view.viewingMode,e=(t.useEsriCrs?t.fullExtentInLocalViewSpatialReference:t.layer.fullExtent?a(t.layer.fullExtent,t.view.renderSpatialReference):void 0)??t.view.extent,n=d(e);this._bvh=m(i,n)}destroy(){this._bvh.destroy()}addTile(t){this._bvh.addTile(t)}removeTile(t){this._bvh.removeTile(t)}intersectRay(o,a,d,p,m,y){const{intersectionRayDir:w,intersectionPlane:R,layerViewUid:x,intersectionNormal:_}=this,j=f(d,p);t(w,p,d);const M=1/i(w);e(w,w,M),n(_,w),l(R,w[0],w[1],w[2],-s(w,d));const E=new v,S=new v,D=o.options.store,V=0===D,k=2===D,q=1===D||k,T=k?new Array:null,B=(t,i,e,n,s,o,l,a)=>{const c=t.point??(t.point=r());c[0]=e,c[1]=n,c[2]=s,t.dist=i,t.normal=_;const u=t.outwardDirection??(t.outwardDirection=r()),d=o*o+l*l+a*a;if(d>0){const t=1/Math.sqrt(d);u[0]=o*t,u[1]=l*t,u[2]=a*t}else u[0]=_[0],u[1]=_[1],u[2]=_[2];return t.layerViewUid=x,t},P=d[0],U=d[1],I=d[2],L=w[0],G=w[1],O=w[2],C=this.layerView.clippingBox,A=t=>{const{relativePositions:i,packedRotations:e,packedOpacityScaledScales:n,gaussianCount:s,obb:o,maxSplatMbsRadiusSquared:r}=t,l=o.centerX,c=o.centerY,u=o.centerZ;let f=-1;const h=C[0],m=C[1],y=C[2],g=C[3],w=C[4],b=C[5];for(let R=0,x=0;R<s;R++,x+=3){const t=i[x]+l,s=i[x+1]+c,o=i[x+2]+u;if(t<h||s<m||o<y||t>g||s>w||o>b)continue;const _=t-P,j=s-U,D=o-I,C=_*L+j*G+D*O;if(C<0&&C*C>r)continue;const A=C<0?0:C;if(_*_+j*j+D*D-A*A>r)continue;if(V&&null!=E.dist){f<0&&(f=Math.sqrt(r));if(Math.max(C-f,0)*M>=E.dist)continue}const N=this._intersectGaussianEllipsoid(_,j,D,L,G,O,e[R],n[R]);if(N<0)continue;const X=N*M;if(null!=a&&!a(d,p,X))continue;const Y=null==E.dist||X<E.dist,Z=q&&(null==S.dist||X>S.dist);if(!Y&&!Z&&!k)continue;const F=L*N,H=G*N,Q=O*N,z=P+F,J=U+H,K=I+Q,W=F-_,$=H-j,tt=Q-D;if(Y&&B(E,X,z,J,K,W,$,tt),Z&&B(S,X,z,J,K,W,$,tt),k){const t=new v;T.push(B(t,X,z,J,K,W,$,tt))}}},N=t=>{const{relativePositions:i,packedRotations:e,packedOpacityScaledScales:n,gaussianCount:s,obb:o,maxSplatMbsRadiusSquared:r}=t,l=o.centerX,c=o.centerY,u=o.centerZ;let f=-1;const h=P-l,m=U-c,y=I-u;for(let g=0,w=0;g<s;g++,w+=3){const t=i[w]-h,s=i[w+1]-m,o=i[w+2]-y,l=t*L+s*G+o*O;if(l<0&&l*l>r)continue;const c=l<0?0:l;if(t*t+s*s+o*o-c*c>r)continue;if(V&&null!=E.dist){f<0&&(f=Math.sqrt(r));if(Math.max(l-f,0)*M>=E.dist)continue}const u=this._intersectGaussianEllipsoid(t,s,o,L,G,O,e[g],n[g]);if(u<0)continue;const b=u*M;if(null!=a&&!a(d,p,b))continue;const R=null==E.dist||b<E.dist,x=q&&(null==S.dist||b>S.dist);if(!R&&!x&&!k)continue;const _=L*u,j=G*u,D=O*u,C=P+_,A=U+j,N=I+D,X=_-t,Y=j-s,Z=D-o;if(R&&B(E,b,C,A,N,X,Y,Z),x&&B(S,b,C,A,N,X,Y,Z),k){const t=new v;T.push(B(t,b,C,A,N,X,Y,Z))}}},X=(t,i)=>{const{min:e,max:n}=t.obb.signedDistanceRangePlane(R);if(n<0)return;const s=e*M;if(!(V&&null!=E.dist&&E.dist<s)){if(null!=E.dist&&null!=S.dist){const t=n*M;if(E.dist<s&&S.dist>t)return}i?A(t):N(t)}},Y=t=>{X(t,!1)},Z=t=>{const i=t.boundingBox;c(i,C)&&X(t,!u(C,i))};this._bvh.forEachTileIntersectingRay(d,p,null!=C?Z:Y,y);const F=(t,i)=>{const{layerViewUid:e}=i,n=new h(i.point,i.outwardDirection,e);t.set(0,n,i.dist,i.normal)};if(b(E)){const t=o.results.min;(null==t.distance||E.dist<t.distance)&&F(t,E)}if(b(S)&&q){const t=o.results.max;(null==t.distance||S.dist>t.distance)&&F(t,S)}if(k&&T?.length)for(const t of T){const i=new g(j);F(i,t),o.results.all.push(i)}}_intersectGaussianEllipsoid(t,i,e,n,s,r,l,a){const c=l>>>30,u=1023&l,d=l>>>10&1023,p=l>>>20&1023,f=(u&R)*x*(1-2*(u>>>9&1)),h=(d&R)*x*(1-2*(d>>>9&1)),m=(p&R)*x*(1-2*(p>>>9&1));let y,g,w,b;const v=f*f+h*h+m*m,j=Math.sqrt(Math.max(0,1-v));switch(c){case 0:y=j,g=m,w=h,b=f;break;case 1:y=m,g=j,w=h,b=f;break;case 2:y=m,g=h,w=j,b=f;break;default:y=m,g=h,w=f,b=j}const E=this._ellipsoidLocalRayOrigin;E[0]=-t,E[1]=-i,E[2]=-e,o(E,E,-y,-g,-w,b);const S=this._ellipsoidLocalRayDir;S[0]=n,S[1]=s,S[2]=r,o(S,S,-y,-g,-w,b);const D=M[255&a],V=M[a>>>8&255],k=M[a>>>16],q=E[0]*D,T=E[1]*V,B=E[2]*k,P=q*q+T*T+B*B;if(P<=1)return 0;const U=S[0]*D,I=S[1]*V,L=S[2]*k,G=U*U+I*I+L*L,O=q*U+T*I+B*L;if(O>0)return _;const C=O*O-G*(P-1);return C<0?_:(-O-Math.sqrt(C))/G}getElevationRange(t){return this._bvh.getElevationRangeIntersectingSphere(t)??new y(0,0)}}function b(t){return null!=t.dist&&null!=t.point}class v{constructor(){this.point=null,this.dist=null,this.normal=null,this.outwardDirection=null,this.layerViewUid=""}}const R=511,x=Math.SQRT1_2/R,_=-1,j=3,M=(()=>{const t=new Float64Array(256);for(let i=0;i<t.length;i++)t[i]=Math.exp(10-i/16)/j;return t})();export{w as GaussianSplatIntersectionHandler};
2
+ import{subtract as t,length as i,scale as e,negate as n,dot as s,transformQuatValues as o}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{set as l}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{project as a}from"../../../../geometry/projectionUtils.js";import{intersects as c,contains as u}from"../../../../geometry/support/aaBoundingBox.js";import{fromExtent as d}from"../../../../geometry/support/aaBoundingRect.js";import{create as p}from"../../../../geometry/support/plane.js";import{fromPoints as f}from"../../../../geometry/support/ray.js";import{GaussianSplatTarget as h}from"../../layers/i3s/Intersector.js";import{createTileBVH as m}from"../../layers/support/Tiles3DBVH.js";import{ElevationRange as y}from"../ElevationRange.js";import{IntersectorResultRay as g}from"../../webgl-engine/lib/IntersectorResult.js";class w{constructor(t){this.layerView=t,this.type=0,this.slicePlaneEnabled=!1,this.isGround=!1,this._ellipsoidLocalRayOrigin=r(),this._ellipsoidLocalRayDir=r(),this.intersectionNormal=r(),this.intersectionRayDir=r(),this.intersectionPlane=p(),this.layerViewUid=t.uid;const i=t.view.viewingMode,e=(t.useEsriCrs?t.fullExtentInLocalViewSpatialReference:t.layer.fullExtent?a(t.layer.fullExtent,t.view.renderSpatialReference):void 0)??t.view.extent,n=d(e);this._bvh=m(i,n)}destroy(){this._bvh.destroy()}addTile(t){this._bvh.addTile(t)}removeTile(t){this._bvh.removeTile(t)}intersectRay(o,a,d,p,m,y){const{intersectionRayDir:w,intersectionPlane:R,layerViewUid:x,intersectionNormal:_}=this,j=f(d,p);t(w,p,d);const M=1/i(w);e(w,w,M),n(_,w),l(R,w[0],w[1],w[2],-s(w,d));const E=new v,S=new v,D=o.options.store,V=0===D,k=2===D,q=1===D||k,T=k?new Array:null,B=(t,i,e,n,s,o,l,a)=>{const c=t.point??(t.point=r());c[0]=e,c[1]=n,c[2]=s,t.dist=i,t.normal=_;const u=t.outwardDirection??(t.outwardDirection=r()),d=o*o+l*l+a*a;if(d>0){const t=1/Math.sqrt(d);u[0]=o*t,u[1]=l*t,u[2]=a*t}else u[0]=_[0],u[1]=_[1],u[2]=_[2];return t.layerViewUid=x,t},P=d[0],U=d[1],I=d[2],L=w[0],G=w[1],O=w[2],C=this.layerView.clippingBox,A=t=>{const{relativePositions:i,packedRotations:e,packedOpacityScaledScales:n,gaussianCount:s,obb:o,maxSplatMbsRadiusSquared:r}=t,l=o.centerX,c=o.centerY,u=o.centerZ;let f=-1;const h=C[0],m=C[1],y=C[2],g=C[3],w=C[4],b=C[5];for(let R=0,x=0;R<s;R++,x+=3){const t=i[x]+l,s=i[x+1]+c,o=i[x+2]+u;if(t<h||s<m||o<y||t>g||s>w||o>b)continue;const _=t-P,j=s-U,D=o-I,C=_*L+j*G+D*O;if(C<0&&C*C>r)continue;const A=C<0?0:C;if(_*_+j*j+D*D-A*A>r)continue;if(V&&null!=E.dist){f<0&&(f=Math.sqrt(r));if(Math.max(C-f,0)*M>=E.dist)continue}const N=this._intersectGaussianEllipsoid(_,j,D,L,G,O,e[R],n[R]);if(N<0)continue;const X=N*M;if(null!=a&&!a(d,p,X))continue;const Y=null==E.dist||X<E.dist,Z=q&&(null==S.dist||X>S.dist);if(!Y&&!Z&&!k)continue;const F=L*N,H=G*N,Q=O*N,z=P+F,J=U+H,K=I+Q,W=F-_,$=H-j,tt=Q-D;if(Y&&B(E,X,z,J,K,W,$,tt),Z&&B(S,X,z,J,K,W,$,tt),k){const t=new v;T.push(B(t,X,z,J,K,W,$,tt))}}},N=t=>{const{relativePositions:i,packedRotations:e,packedOpacityScaledScales:n,gaussianCount:s,obb:o,maxSplatMbsRadiusSquared:r}=t,l=o.centerX,c=o.centerY,u=o.centerZ;let f=-1;const h=P-l,m=U-c,y=I-u;for(let g=0,w=0;g<s;g++,w+=3){const t=i[w]-h,s=i[w+1]-m,o=i[w+2]-y,l=t*L+s*G+o*O;if(l<0&&l*l>r)continue;const c=l<0?0:l;if(t*t+s*s+o*o-c*c>r)continue;if(V&&null!=E.dist){f<0&&(f=Math.sqrt(r));if(Math.max(l-f,0)*M>=E.dist)continue}const u=this._intersectGaussianEllipsoid(t,s,o,L,G,O,e[g],n[g]);if(u<0)continue;const b=u*M;if(null!=a&&!a(d,p,b))continue;const R=null==E.dist||b<E.dist,x=q&&(null==S.dist||b>S.dist);if(!R&&!x&&!k)continue;const _=L*u,j=G*u,D=O*u,C=P+_,A=U+j,N=I+D,X=_-t,Y=j-s,Z=D-o;if(R&&B(E,b,C,A,N,X,Y,Z),x&&B(S,b,C,A,N,X,Y,Z),k){const t=new v;T.push(B(t,b,C,A,N,X,Y,Z))}}},X=(t,i)=>{const{min:e,max:n}=t.obb.signedDistanceRangePlane(R);if(n<0)return;const s=e*M;if(!(V&&null!=E.dist&&E.dist<s)){if(null!=E.dist&&null!=S.dist){const t=n*M;if(E.dist<s&&S.dist>t)return}i?A(t):N(t)}},Y=t=>{X(t,!1)},Z=t=>{const i=t.boundingBox;c(i,C)&&X(t,!u(C,i))};this._bvh.forEachTileIntersectingRay(d,p,null!=C?Z:Y,y);const F=(t,i)=>{const{layerViewUid:e}=i,n=new h(i.point,i.outwardDirection,e);t.set(0,n,i.dist,i.normal)};if(b(E)){const t=o.results.min;(null==t.distance||E.dist<t.distance)&&F(t,E)}if(b(S)&&q){const t=o.results.max;(null==t.distance||S.dist>t.distance)&&F(t,S)}if(k&&T?.length)for(const t of T){const i=new g(j);F(i,t),o.results.all.push(i)}}_intersectGaussianEllipsoid(t,i,e,n,s,r,l,a){const c=l>>>30,u=1023&l,d=l>>>10&1023,p=l>>>20&1023,f=(u&R)*x*(1-2*(u>>>9&1)),h=(d&R)*x*(1-2*(d>>>9&1)),m=(p&R)*x*(1-2*(p>>>9&1));let y,g,w,b;const v=f*f+h*h+m*m,j=Math.sqrt(Math.max(0,1-v));switch(c){case 0:y=j,g=m,w=h,b=f;break;case 1:y=m,g=j,w=h,b=f;break;case 2:y=m,g=h,w=j,b=f;break;default:y=m,g=h,w=f,b=j}const E=this._ellipsoidLocalRayOrigin;E[0]=-t,E[1]=-i,E[2]=-e,o(E,E,-y,-g,-w,b);const S=this._ellipsoidLocalRayDir;S[0]=n,S[1]=s,S[2]=r,o(S,S,-y,-g,-w,b);const D=M[255&a],V=M[a>>>8&255],k=M[a>>>16],q=E[0]*D,T=E[1]*V,B=E[2]*k,P=q*q+T*T+B*B;if(P<=1)return 0;const U=S[0]*D,I=S[1]*V,L=S[2]*k,G=U*U+I*I+L*L,O=q*U+T*I+B*L;if(O>0)return _;const C=O*O-G*(P-1);return C<0?_:(-O-Math.sqrt(C))/G}getElevationRange(t){return this._bvh.getElevationRangeIntersectingSphere(t)??new y(0,0)}}function b(t){return null!=t.dist&&null!=t.point}class v{constructor(){this.point=null,this.dist=null,this.normal=null,this.outwardDirection=null,this.layerViewUid=""}}const R=511,x=Math.SQRT1_2/R,_=-1,j=3,M=(()=>{const t=new Float64Array(256);for(let i=0;i<t.length;i++)t[i]=Math.exp(10-i/16)/j;return t})();export{w as GaussianSplatIntersectionHandler};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import e from"../../../Graphic.js";import{isIterable as n}from"../../../core/iteratorUtils.js";import{screenPointObjectToArray as i,createScreenPointArray as r}from"../../../core/screenUtils.js";import{create as t}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import s from"../../../geometry/Point.js";import o from"../../../geometry/SpatialReference.js";import{projectVectorToVector as l}from"../../../geometry/projection/projectVectorToVector.js";import{fallbackObjectIDAttribute as c}from"../../../layers/LayerConstants.js";import{isIntegratedMeshLayer as a}from"../../../layers/support/layerUtils.js";import{debugFlags as u}from"./debugFlags.js";import{getElevationAtPoint as d}from"./ElevationProvider.js";import{Intersector as p}from"../webgl-engine/lib/Intersector.js";import{isValidIntersectorResult as m}from"../webgl-engine/lib/IntersectorResult.js";import{toHit as f,toOwner as g}from"../webgl-engine/lib/intersectorUtilsConversions.js";import{terrainId as y}from"../webgl-engine/lib/verticalOffsetUtils.js";async function w(e,n,i,t){const s=i?x(e,i):t,o=r(n.x,n.y);s.requiresGroundFeedback=!0,s.enableDraped=!0;const l=new p(e.state.viewingMode);l.options.selectionMode=!0,l.options.store=2,e.sceneIntersectionHelper.intersectIntersectorScreen(o,l,s);const c=await b(e,l.results.all,s.graphics),d=l.results.ground,f=g(d,e),y=null!=f&&"type"in f&&a(f)?f:null,w={screenPoint:n,results:c,ground:{mapPoint:U(e,d),distance:m(d)?d.distanceInRenderSpace:0,layer:y}};return u.SCENEVIEW_HITTEST_RETURN_INTERSECTOR&&(w.intersector=l),w}function h(e,n,r,t){const s=r?x(e,r):t,o=!(!s.graphics?.include&&!s.graphics?.exclude),l=!(!s.mediaElements?.include&&!s.mediaElements?.exclude),c=i(n);s.enableDraped=s.include&&!s.include.has(y)||s.exclude?.has(y);const a=e.sceneIntersectionHelper,u=new p(e.state.viewingMode);if(u.options.selectionMode=!0,u.options.store=o||l?2:0,u.options.excludeLabels=r?.excludeLabels??!1,a.intersectIntersectorScreen(c,u,s),o||l){for(const n of u.results.all){const i=f(n,e);if(null==i)return U(e,n);if(o&&("graphic"!==i.type||E(s.graphics,i.graphic)))return U(e,n);if(l&&("media"!==i.type||S(s.mediaElements,i.element)))return U(e,n)}return null}return U(e,u.results.min)}async function b(e,n,i){const r=new Array;let t,s;const o={defer(e){s=e()}};for(const l of n){const n=g(l,e);if(null!=n&&(n===e.map.ground||"type"in n&&a(n)))break;const c=f(l,e,o)??await s;if(s=null,null==c)continue;if("graphic"===c.type){t??=new Set;const e=j(c.graphic);if(t.has(e))continue;if(t.add(e),!E(i,c.graphic))continue}const u=U(e,l),d=l.distanceInRenderSpace;if("media"===c.type){const e=c.element.toSource(u);r.push({...c,mapPoint:u,distance:d,sourcePoint:e})}else r.push({...c,mapPoint:u,distance:d})}return r}function U(e,n,i){return n.getIntersectionPoint(C)?(i=V(e,C,i),7===n.intersector&&e.basemapTerrain&&(i.z=d(e.basemapTerrain,i)??0),i):null}function j(e){const n=e.getObjectId()??e.attributes?.[c];return e.origin&&null!=n?`o-${e.origin.id}-${n}`:`u-${e.uid}`}function E(e,n){return S(e,j(n))}function S(e,n){return null==e||(null==e.include||e.include.has(n))&&(null==e.exclude||!e.exclude.has(n))}function V(e,n,i){let r=e.spatialReference||o.WGS84;return l(n,e.renderSpatialReference,C,r)?n=C:(r=o.WGS84,l(n,e.renderSpatialReference,C,r)&&(n=C)),i?(i.x=n[0],i.y=n[1],i.z=n[2],i.spatialReference=r):i=new s(n,r),i}function x(e,n){const i=I(e,n.include,0),r=I(e,n.exclude,1);return{include:i.layerViewUids,exclude:r.layerViewUids,graphics:{include:i.graphicUids,exclude:r.graphicUids},mediaElements:{include:i.mediaElements,exclude:r.mediaElements}}}function I(i,r,t,s=new R){if(!r)return s;if(r instanceof e)M(s,j(r)),0===t&&(null!=i.graphicsView&&r.layer===i?P(s,i.graphicsView.uid):r.layer&&T(s,i,r.layer.uid));else if("layer"in r&&"element"in r)L(s,r.element),0===t&&T(s,i,r.layer.uid);else if(n(r))for(const e of r)e===i.graphics&&null!=i.graphicsView?P(s,i.graphicsView.uid):e===i.map.ground?P(s,y):I(i,e,t,s);else"layer"in r&&v(s,i,r),"uid"in r&&T(s,i,r.uid);return s}class R{constructor(){this.layerViewUids=null,this.graphicUids=null,this.mediaElements=null}}function T(e,n,i){const r=n.allLayerViews.find(e=>e.layer.uid===i);r&&P(e,r.uid)}function P(e,n){e.layerViewUids??=new Map,e.layerViewUids.set(n,!0)}function v(e,n,i){const r=n.allLayerViews.find(e=>e.layer.uid===i.layer.uid);if(!r)return;e.layerViewUids??=new Map;const t=e.layerViewUids.get(r.uid);!0!==t&&(t?t.add(i.id):e.layerViewUids.set(r.uid,new Set([i.id])))}function M(e,n){e.graphicUids??=new Set,e.graphicUids.add(n)}function L(e,n){e.mediaElements??=new Set,e.mediaElements.add(n)}const C=t();export{V as computeMapPointFromVec3d,x as externalToInternalIntersectOptions,w as hitTest,U as intersectResultToMapPoint,E as testGraphicUidFilter,h as toMap};
2
+ import e from"../../../Graphic.js";import{isIterable as n}from"../../../core/iteratorUtils.js";import{screenPointObjectToArray as t,isScreenPolygon as i,isScreenRect as r,createScreenPointArray as s,createScreenPoint as o}from"../../../core/screenUtils.js";import{create as l}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import c from"../../../geometry/Point.js";import a from"../../../geometry/SpatialReference.js";import{projectVectorToVector as u}from"../../../geometry/projection/projectVectorToVector.js";import{fallbackObjectIDAttribute as d}from"../../../layers/LayerConstants.js";import{isIntegratedMeshLayer as p}from"../../../layers/support/layerUtils.js";import{debugFlags as f}from"./debugFlags.js";import{getElevationAtPoint as m}from"./ElevationProvider.js";import{getGraphicHitDedupeKey as g,resolveOrderedIntersectionHits as y}from"./intersectionHitUtils.js";import{Intersector as h}from"../webgl-engine/lib/Intersector.js";import{isValidIntersectorResultRay as w}from"../webgl-engine/lib/IntersectorResult.js";import{toHit as b,toOwner as x}from"../webgl-engine/lib/intersectorUtilsConversions.js";import{terrainId as E}from"../webgl-engine/lib/verticalOffsetUtils.js";async function S(e,n,t,o){const l=t?v(e,t):o;if(i(n))return U(e,n,l,t?.excludeLabels);if(r(n))return U(e,j(n),l,t?.excludeLabels);const c=n,a=s(c.x,c.y);l.requiresGroundFeedback=!0,l.enableDraped=!0;const u=new h(e.state.viewingMode);u.options.selectionMode=!0,u.options.store=2,u.options.excludeLabels=t?.excludeLabels??!1,e.sceneIntersectionHelper.intersectIntersectorScreen(a,u,l);const d=await V(e,u.results.all,l.graphics,{getDistance:e=>e.distanceInRenderSpace,getMapPoint:n=>R(e,n),stopAtSupportSurface:!0}),m=u.results.ground,g=x(m,e),y=null!=g&&"type"in g&&p(g)?g:null,b={screenPoint:c,results:d,ground:{mapPoint:R(e,m),distance:w(m)?m.distanceInRenderSpace:0,layer:y}};return f.SCENEVIEW_HITTEST_RETURN_INTERSECTOR&&(b.intersector=u),b}async function U(e,n,i,r){i.enableDraped=!0;const s=new h(e.state.viewingMode);s.options.selectionMode=!0,s.options.store=2,s.options.excludeLabels=r??!1,await e.sceneIntersectionHelper.intersectIntersectorScreenPolygon(n.map(e=>t(e)),s,i);const l={screenPoint:o(0,0),results:await V(e,s.polygonResults.all,i.graphics,{getDistance:e=>e.distance,getMapPoint:()=>null}),ground:{mapPoint:null,distance:0,layer:null}};return f.SCENEVIEW_HITTEST_RETURN_INTERSECTOR&&(l.intersector=s),l}function j(e){return[o(e.x,e.y),o(e.x+e.width,e.y),o(e.x+e.width,e.y+e.height),o(e.x,e.y+e.height)]}function I(e,n,i,r){const s=i?v(e,i):r,o=!(!s.graphics?.include&&!s.graphics?.exclude),l=!(!s.mediaElements?.include&&!s.mediaElements?.exclude),c=t(n);s.enableDraped=s.include&&!s.include.has(E)||s.exclude?.has(E);const a=e.sceneIntersectionHelper,u=new h(e.state.viewingMode);if(u.options.selectionMode=!0,u.options.store=o||l?2:0,u.options.excludeLabels=i?.excludeLabels??!1,a.intersectIntersectorScreen(c,u,s),o||l){for(const n of u.results.all){const t=b(n,e);if(null==t)return R(e,n);if(o&&("graphic"!==t.type||P(s.graphics,t.graphic)))return R(e,n);if(l&&("media"!==t.type||M(s.mediaElements,t.element)))return R(e,n)}return null}return R(e,u.results.min)}async function V(e,n,t,i){const r=y(e,i.stopAtSupportSurface?function*(){for(const t of n){yield t;const n=x(t,e);if(null!=n&&(n===e.map.ground||"type"in n&&p(n)))break}}():n,{getDedupeKey:e=>"graphic"===e.type?T(e.graphic):null,filterHit:e=>"graphic"!==e.type||P(t,e.graphic)}),s=new Array;for await(const{input:o,hit:l}of r){const e=i.getMapPoint(o),n=i.getDistance(o);if("media"===l.type){const t=e?l.element.toSource(e):null;s.push({...l,mapPoint:e,distance:n,sourcePoint:t})}else s.push({...l,mapPoint:e,distance:n})}return s}function R(e,n,t){return n.getIntersectionPoint(W)?(t=L(e,W,t),7===n.intersector&&e.basemapTerrain&&(t.z=m(e.basemapTerrain,t)??0),t):null}function T(e){const n=e.getObjectId()??e.attributes?.[d];return e.origin&&null!=n?`o-${e.origin.id}-${n}`:`u-${g(e)}`}function P(e,n){return M(e,T(n))}function M(e,n){return null==e||(null==e.include||e.include.has(n))&&(null==e.exclude||!e.exclude.has(n))}function L(e,n,t){let i=e.spatialReference||a.WGS84;return u(n,e.renderSpatialReference,W,i)?n=W:(i=a.WGS84,u(n,e.renderSpatialReference,W,i)&&(n=W)),t?(t.x=n[0],t.y=n[1],t.z=n[2],t.spatialReference=i):t=new c(n,i),t}function v(e,n){const t=D(e,n.include,0),i=D(e,n.exclude,1);return{include:t.layerViewUids,exclude:i.layerViewUids,graphics:{include:t.graphicUids,exclude:i.graphicUids},mediaElements:{include:t.mediaElements,exclude:i.mediaElements}}}function D(t,i,r,s=new H){if(!i)return s;if(i instanceof e)G(s,T(i)),0===r&&(null!=t.graphicsView&&i.layer===t?N(s,t.graphicsView.uid):i.layer&&C(s,t,i.layer.uid));else if("layer"in i&&"element"in i)O(s,i.element),0===r&&C(s,t,i.layer.uid);else if(n(i))for(const e of i)e===t.graphics&&null!=t.graphicsView?N(s,t.graphicsView.uid):e===t.map.ground?N(s,E):D(t,e,r,s);else"layer"in i&&_(s,t,i),"uid"in i&&C(s,t,i.uid);return s}class H{constructor(){this.layerViewUids=null,this.graphicUids=null,this.mediaElements=null}}function C(e,n,t){const i=n.allLayerViews.find(e=>e.layer.uid===t);i&&N(e,i.uid)}function N(e,n){e.layerViewUids??=new Map,e.layerViewUids.set(n,!0)}function _(e,n,t){const i=n.allLayerViews.find(e=>e.layer.uid===t.layer.uid);if(!i)return;e.layerViewUids??=new Map;const r=e.layerViewUids.get(i.uid);!0!==r&&(r?r.add(t.id):e.layerViewUids.set(i.uid,new Set([t.id])))}function G(e,n){e.graphicUids??=new Set,e.graphicUids.add(n)}function O(e,n){e.mediaElements??=new Set,e.mediaElements.add(n)}const W=l();export{L as computeMapPointFromVec3d,v as externalToInternalIntersectOptions,S as hitTest,R as intersectResultToMapPoint,P as testGraphicUidFilter,I as toMap};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import{toHit as n}from"../webgl-engine/lib/intersectorUtilsConversions.js";async function*t(t,e,i={}){const{filterHit:o,getDedupeKey:l}=i;let s,u=null;const c={defer(n){s=n()}};for(const r of e){const e=n(r,t,c)??await s;if(s=null,null==e)continue;const i=l?.(e);if(null!=i){if(u??=new Set,u.has(i))continue;u.add(i)}o&&!o(e)||(yield{input:r,hit:e})}}function e(n){return`${n.uid}`}export{e as getGraphicHitDedupeKey,t as resolveOrderedIntersectionHits};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import has from"../../../core/has.js";import{disposeMaybe as t}from"../../../core/maybe.js";import{MemCachePool as i}from"../../../core/MemCachePool.js";import r from"../../../core/ObjectPool.js";import{watch as s,sync as n}from"../../../core/reactiveUtils.js";import{property as a,subclass as l}from"../../../core/accessorSupport/decorators.js";import{subtract as o,set as c,dot as h}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{ZEROS as d,fromValues as u,create as _}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as g,ZEROS as f}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{create as p,set as m}from"../../../geometry/support/aaBoundingBox.js";import{BufferViewVec3f as y}from"../../../geometry/support/buffer/BufferView.js";import{overlayRenderOccludedFlag as b}from"./OverlayRenderer.js";import{PatchRenderData as x}from"./PatchRenderData.js";import{TerrainAttributesCache as T}from"./TerrainAttributesCache.js";import{enableTerrainInternalChecks as R}from"./terrainUtils.js";import{TileRenderer as v}from"./TileRenderer.js";import{IteratorPreorder as P,fallsWithinLayerView as w,sortTiles as O,compareTiles as S}from"./tileUtils.js";import{getOverlayContentForOutputTerrain as D}from"../webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js";import{SyncRenderPlugin as B}from"../webgl-engine/effects/RenderPlugin.js";import{Vertices as E}from"../webgl-engine/lib/Attribute.js";import{IntersectorResult as F}from"../webgl-engine/lib/IntersectorResult.js";import{intersectAabbInvDirBefore as j,MeshIntersectionOptions as q,intersectTriangles as C}from"../webgl-engine/lib/RayIntersections.js";import{TriangleIntersectionData as A}from"../webgl-engine/lib/TriangleIntersectionData.js";import{terrainId as M,getVerticalOffsetTerrain as G}from"../webgl-engine/lib/verticalOffsetUtils.js";import{DrawParameters as I}from"../webgl-engine/materials/DrawParameters.js";import{hasShadowHighlights as U}from"../webgl-engine/shaders/ReceiveShadowsConfiguration.js";import{T as k}from"../../../chunks/Terrain.glsl.js";import{TerrainTechnique as N}from"../webgl-engine/shaders/TerrainTechnique.js";import{TerrainTechniqueConfiguration as L}from"../webgl-engine/shaders/TerrainTechniqueConfiguration.js";import{PrimitiveType as V}from"../../webgl/enums.js";const H=7,z=10,Q=200,W=p();let Z=class extends B{get visibleTiles(){return Array.from(this._visiblePatchesByOrigin.values()).flat()}get _isGlobal(){return 1===this._stage.viewingMode}get _techniques(){return this._context.techniques}get _rctx(){return this._context.renderContext.rctx}get renderOccludedFlags(){return this._overlayRenderer.renderOccludedFlags}constructor(e,t,s,n,a){super({}),this._overlayRenderer=e,this._stage=t,this._allTiles=s,this._compressionTracker=n,this.type=7,this.isGround=!0,this._passParameters=new k,this._drawParameters=new I,this._renderDataPool=new r(()=>new x),this._visiblePatchesByOrigin=new Map,this._allPatchesByOrigin=new Map,this._patchesByOriginDirty=!0,this._patchSortingDirty=!0,this._tileIterator=new P,this._castShadows=!1,this._inViewshed=!1,this._cutFillEnabled=!1,this._tileRenderer=null,this._stencilEnabledLayerExtents=new Array,this._numTilesRendered=0,this._numTilesCulled=0,this._numOriginsRendered=0,this.produces=new Map([[1,()=>1===this._desiredSlot],[7,()=>7===this._desiredSlot],[9,()=>this._produces()&&this.renderOccludedFlags===b]]),this._tileSize=256,this._configuration=new L(1===t.viewingMode),this._tileTextureCache=new i((e,t)=>a.newCache(e,t),"TileTexture"),this.tileGeometryCache=new T(a)}normalizeCtorArgs(){return{}}initialize(){this._stage.addRenderPlugin(this),this.addHandles(s(()=>this._overlayRenderer.renderOccludedFlags,()=>this.setNeedsRender(),n))}destroy(){this._stage.removeRenderPlugin(this),this._tileTextureCache.destroy(),this.tileGeometryCache.destroy(),this._allTiles.prune(),this._tileRenderer=null}_produces(){return this.visible&&!!this._rootTiles&&!this.renderingDisabled}set renderingDisabled(e){this._set("renderingDisabled",!!e),this.setDirty()}set visible(e){this._set("visible",!!e),this.setDirty()}updateHeading(e){this._tileRenderer?.updateHeading(e)}set transparency(e){this._configuration.transparencyMode!==e&&(this._configuration.transparencyMode=e,this.setNeedsRender())}get transparency(){return this._configuration.transparencyMode}get renderPatchBorders(){return this._configuration.tileBorders}set renderPatchBorders(e){this._configuration.tileBorders!==e&&(this._configuration.tileBorders=e,this.setNeedsRender(),this.notifyChange("renderPatchBorders"))}get layerViewUid(){return M}get slicePlaneEnabled(){return this._configuration.hasSlicePlane}set slicePlaneEnabled(e){this._configuration.hasSlicePlane!==e&&(this._configuration.hasSlicePlane=e,this.setNeedsRender())}set textureFadingEnabled(e){this._configuration.textureFadingEnabled!==e&&(this._configuration.textureFadingEnabled=e,this.setNeedsRender())}set pbrMode(e){this._configuration.pbrMode!==e&&(this._configuration.pbrMode=e,this.setNeedsRender())}setRootTiles(e){this._rootTiles=e,this.setDirty()}setStencilEnabledLayerExtents(e){this._stencilEnabledLayerExtents=e,this._setSortingDirty()}set tileSize(e){this._tileSize=e,null!=this._tileRenderer&&(this._tileRenderer.tileSize=e),this.setDirty()}get tileSize(){return this._tileSize}_ensureRenderData(e){e.renderData||(e.renderData=this._renderDataPool.acquire(),e.renderData.init(e,this._getLocalOriginOfTile(e)))}loadTile(e){this._ensureRenderData(e),this.updateTileGeometryState(e),this.reuseTextureFromParent(e)||this.updateTileTexture(e,32)}reuseTextureFromParent(e){const{parent:t}=e;if(!this._canReuseTextureFromParent(t,e))return!1;const i=g(1&e.lij[2]?.5:0,1&e.lij[1]?0:.5,.5,.5);return t.renderData?.reuseTexture(e.renderData,i)??!1}_canReuseTextureFromParent(e,t){if(!e)return!1;const{layerInfo:i,surface:r}=t;for(let s=0;s<i[1].length;s++){const i=r.layerViewByIndex(s,1);if(w(e,i)!==w(t,i))return!1}return!0}updateTileTexture(e,t){null!=this._tileRenderer&&(this._tileRenderer.updateTileTexture(e,32===t?0:2),this.setNeedsRender(),e.resetPendingUpdate(t))}updateTileGeometryState(e){for(const i of e.layerInfo[0])i.pendingUpdates&=-9;e.resetPendingUpdate(8);const t=e.renderData.updateGeometryState();return t&&this.setDirty(),t}updateGeometryIfNeeded(e){e.loaded&&e.renderData.updateGeometryIfNeeded(this._rctx)}unloadTile(e){const t=e.renderData;t&&(t.releaseGeometry(),this._renderDataPool.release(t),t.clear(),e.renderData=null,e.setMemoryDirty(),this.setDirty())}_getLocalOriginOfTile(e){const t=z-H,i=Math.max(0,Math.floor((e.level-t)/H)*H);if(this._isGlobal&&0===i)return d;for(;e.parent&&e.level>i;)e=e.parent;return e.centerAtSeaLevel}getStats(){return{numTilesRendered:this._numTilesRendered,numTilesCulled:this._numTilesCulled,numOriginsRendered:this._numOriginsRendered}}set wireframe(e){this._get("wireframe")!==e&&(this._set("wireframe",e),this.setNeedsRender())}setDirty(e=1){this._patchesByOriginDirty=!0,this._context.requestRender(e)}_setSortingDirty(e=1){this._patchSortingDirty=!0,this._context.requestRender(e)}setNeedsRender(e=1){this._context.requestRender(e)}initializeRenderContext(e){this._context=e,this._tileRenderer=new v(this._rctx,this._tileSize,this._techniques,this._tileTextureCache,this._compressionTracker),this.updateTileBackground()}uninitializeRenderContext(){this._tileRenderer=t(this._tileRenderer)}intersectRay(e,t,i,r){if(!this._rootTiles||e.options.selectOpaqueTerrainOnly&&e.options.selectionMode&&0!==this.transparency)return;const s=J,n=K;o(s,r,i),c(n,1/s[0],1/s[1],1/s[2]);const a=e.results.min,l=e.results.max,d=e.results.ground,u=0===e.options.store,_=!!e.results.ground.target,g=G(e.verticalOffset),f=e.tolerance;let p,b=u&&null!=a.distance?a.distance:1/0;const x=e.options,T=x.normalRequired||!x.backfacesTerrain,R=new q(f,!1,T),v=c=>{const _=c.renderData;if(!_?.vao)return;const v=_.geometry;m(W,v.boundingBox);const P=_.localOrigin;null!=g&&(g.localOrigin=P,g.applyToAabb(W));const w=W;if(X[0]=i[0]-P[0],X[1]=i[1]-P[1],X[2]=i[2]-P[2],!j(w,X,n,f,b))return;const O=(e,t,i)=>{e.set(this.type,c,t,i),b=u&&null!=a.distance?a.distance:1/0},S=(n,o,c)=>{if((!T||null!=o)&&n>=0&&(x.backfacesTerrain||h(o,s)<0)&&(x.invisibleTerrain||!x.selectionMode||null==t||t(i,r,n))){if((null==d.distance||n<d.distance)&&O(d,n,o),x.isFiltered)return;2===x.store&&(null==p?(p=new F(e.ray),O(p,n,o),e.results.all.push(p)):n<p.distance&&O(p,n,o)),(null==a.distance||n<a.distance)&&O(a,n,o),0!==x.store&&(null==l.distance||n>l.distance)&&O(l,n,o)}},D=Y;o(D,r,P);const{indices:B,indexCount:q}=v,M=v.vertexAttributes,G=M.getField("position",y),I=new E(G.typedBuffer,3,M.stride/4),U=q/3;if(!g&&U>Q){const e=c.renderData;e.intersectionData??=new A(B,U,I),e.intersectionData.intersectRay(X,D,R,S)}else C(X,D,0,U,B,I,g,R,S)},P=this._rootTiles;if(null!=P){(()=>{const t=this._tileIterator;t.reset(P);const r=e.options.invisibleTerrain;for(let e=t.next();e;e=t.next())!(e.visible||r&&e.intersectsClippingArea)||null==g&&!e.intersectsRay(i,s,f,b)||_&&this._useStencilForTile(e)?t.skipSubtree():v(e)})()}}processScaleRangeQueries(e,t){if(!t.done&&e)for(this._updatePatchGroups();e.updating&&!t.done;){e.prepare();for(const t of this._visiblePatchesByOrigin.values())for(const i of t)null!=i.renderData?.textureReference&&e.queriesForTile(i);e.process(),t.madeProgress()}}get _desiredSlot(){if(!this._produces())return null;switch(this.transparency){case 0:return 1;case 1:case 2:return 7;case 3:case 4:return null}}acquireTechniques(e){const{shadowMap:t,viewshedEnabled:i,cutFillComputationEnabled:r,slot:s,hasEmission:n,useFloatBlend:a}=e.bind,l=!!has("enable-feature:terrain-shadows")&&t.enabled;if(l!==this._castShadows&&(this._castShadows=l,this._patchesByOriginDirty=!0),this._inViewshed!==i&&(this._inViewshed=i,this._patchesByOriginDirty=!0),this._cutFillEnabled!==r&&(this._cutFillEnabled=r,this._patchesByOriginDirty=!0),3===this.transparency)return null;if(9===s){if(0===(e.renderOccludedMask&b))return null}else if(s!==this._desiredSlot)return null;const o=this._configuration;switch(o.screenSpaceReflections=o.cloudReflections=o.receiveShadows=o.hasShadowHighlights=o.receiveAmbientOcclusion=o.renderOccluded=o.hasHighlightMixTexture=!1,o.hasEmission=n,o.overlayMode=this._overlayRenderer.mode,o.useFloatBlend=a.value,e.output){case 0:case 1:case 2:{const i=e.bind;o.screenSpaceReflections=i.hasScreenSpaceReflections,o.cloudReflections=null!=i.clouds.data;const r=9===s;return o.receiveShadows=t.ready&&!r,o.hasShadowHighlights=U(o,e.bind),o.renderOccluded=r,o.receiveAmbientOcclusion=!r&&null!=i.ssao,o.receiveGlobalIllumination=!r&&i.globalIlluminationEnabled,this._acquireTechnique(e.output)}case 5:case 7:return this._castShadows?this._acquireTechnique(5):null;case 8:return this._inViewshed?this._acquireTechnique(8):null;case 9:return this._cutFillEnabled?this._acquireTechnique(9):null;case 3:case 4:return this._acquireTechnique(e.output);case 11:return this._acquireTechnique(11);case 10:return o.hasHighlightMixTexture=null!=e.bind.highlightMixTexture,this._overlayRenderer.hasHighlights?this._acquireTechnique(10):null}return null}render(e,t){switch(this._updatePatchGroups(),this._passParameters.useStencil=!1,this._passParameters.overlayContent=D(e.output,e.bind),e.output){case 0:case 1:case 2:return this._renderMaterialPass(e,t);case 3:case 4:case 11:return this._renderAuxiliaryPass(e,t,this._visiblePatchesByOrigin);case 10:{const i=e.bind.highlight?.name;i&&this._overlayRenderer.hasHighlights&&this._overlayRenderer.renders(2)&&this._overlayRenderer.hasHighlight(i)&&this._renderAuxiliaryPass(e,t,this._visiblePatchesByOrigin);break}case 5:case 7:case 8:case 9:return this._renderAuxiliaryPass(e,t,this._allPatchesByOrigin)}}updateTileBackground(e){if(null==this._tileRenderer)return;const t=this._tileRenderer;let i;if(null!=e){const t=e.toUnitRGBA();i=u(t[0]||0,t[1]||0,t[2]||0)}t.setBackground(i),this._allTiles.forAll(e=>t.updateTileTexture(e,0)),this._configuration.tileBlendInput=t.backgroundIsGrid?2:null!=t.backgroundColor?1:0,this.setNeedsRender()}_updatePatchGroups(){if(this._patchesByOriginDirty&&(this._rebuildPatchGroups(),this._patchesByOriginDirty=!1,this._patchSortingDirty=!0),this._patchSortingDirty){const e=Array.from(this._visiblePatchesByOrigin.values()),t=this._stencilEnabledLayerExtents;for(const i of e)O(i,t);e.sort((e,t)=>S(e[0],t[0])),this._visiblePatchesByOrigin=new Map(e.map(e=>[e[0].renderData.localOrigin,e])),this.notifyChange("visibleTiles"),this._patchSortingDirty=!1}}_rebuildPatchGroups(){const e=this._rootTiles;if(null!=e){e[0]?.surface.checkAllTilesWaterproofness(),this._visiblePatchesByOrigin.clear(),this._allPatchesByOrigin.clear();for(const t of e)this._rebuildPatchGroupsForRootTile(t)}}_rebuildPatchGroupsForRootTile(e){const t=this._tileIterator;for(t.resetOne(e);!t.done;){const e=t.next(),i=e.renderData;if(!i){this._numTilesCulled++;continue}const r=i.localOrigin;if(this._castShadows||this._inViewshed||this._cutFillEnabled){let t=this._allPatchesByOrigin.get(r);t||(t=[],this._allPatchesByOrigin.set(r,t)),t.push(e)}if(!e.visible){this._numTilesCulled++,t.skipSubtree();continue}let s=this._visiblePatchesByOrigin.get(r);s||(s=[],this._visiblePatchesByOrigin.set(r,s)),s.push(e),t.skipSubtree()}}_useStencilForTile(e){for(const t of this._stencilEnabledLayerExtents)if(e.intersectsExtent(t))return!0;return!1}_renderAuxiliaryPass(e,t,i){const{rctx:r,bind:s}=e;r.bindTechnique(t,s,this._passParameters);const n=this._stencilEnabledLayerExtents.length>0;i.forEach(i=>{this._drawParameters.origin=i[0].renderData.localOrigin,t.program.bindDraw(s,this._passParameters,this._drawParameters);for(let r=0;r<i.length;r++)this._renderPatch(e,t,i[r],V.TRIANGLES,n,null===this._passParameters.overlayContent)}),r.bindVAO(null)}_renderMaterialPass(e,t){const{rctx:i,bind:r}=e,s=i.bindTechnique(t,r,this._passParameters);this._numTilesRendered=0,this._numTilesCulled=0,this._numOriginsRendered=0;const n=9===r.slot;n&&(s.bindTexture("tex",i.emptyTexture),s.setUniform3fv("textureOpacities",d),s.setUniform4fv("texOffsetAndScale",f));const a=null!=this._tileRenderer?.backgroundColor?this._tileRenderer.backgroundColor:d;1===this._configuration.tileBlendInput&&s.setUniform3fv("backgroundColor",a);const l=this._stencilEnabledLayerExtents.length>0,o=this.wireframe?V.LINES:V.TRIANGLES;this._configuration.textureFadingEnabled&&s.bindTexture("texNext",i.emptyTexture);const c=this._visiblePatchesByOrigin;for(const h of c.values()){const i=h[0].renderData.localOrigin;this._drawParameters.origin=i,t.program.bindDraw(r,this._passParameters,this._drawParameters),this._numOriginsRendered++;for(const r of h){const i=r.renderData,a=i.textureReference;if(null!=a){if(!n){s.setUniform4fv("texOffsetAndScale",a.offsetAndScale),s.bindTexture("tex",a.texture.texture);const e=i.textureFadeFactor,t=e<1?i.nextTextureReference:null;this._configuration.textureFadingEnabled&&t&&e<1?(s.setUniform1f("fadeFactor",e),s.setUniform4fv("nextTexOffsetAndScale",t.offsetAndScale),s.setUniform3fv("nextTexOpacities",t.opacities),s.bindTexture("texNext",t.texture.texture)):s.setUniform1f("fadeFactor",1),i.textureIsFading&&this.setNeedsRender(2),s.setUniform3fv("textureOpacities",a.opacities)}this._renderPatch(e,t,r,o,l),r.renderOrder=this._numTilesRendered,this._numTilesRendered++}}}i.bindVAO(null)}_renderPatch(e,t,i,r,s,n=!1){const a=i.renderData,l=a.vao,o=l?.indexBuffer;if(!l||null==o)return void(R&&console.error("Rendered tile with no indices: ",i.lij," : ",a));const c=t.program;n||this._overlayRenderer.isEmpty||this._bindOverlayPatchData(c,a.overlay);const{rctx:h,bind:d}=e;s&&(this._passParameters.useStencil=this._useStencilForTile(i),h.setPipelineState(t.getPipeline(d,this._passParameters)));const u=a.geometry.indexCount;h.bindVAO(l),c.assertCompatibleVertexAttributeLocations(l),h.drawElements(r,u,o.indexType,0)}_bindOverlayPatchData(e,t){e.setUniform4fv("overlayTexOffset",t.offsets),e.setUniform4fv("overlayTexScale",t.scales)}_acquireTechnique(e){return this._configuration.output=e,this._techniques.get(N,this._configuration)}get test(){}hasHighlight(e){return this._overlayRenderer.hasHighlight(e)}};e([a({readOnly:!0})],Z.prototype,"visibleTiles",null),e([a({readOnly:!0})],Z.prototype,"_isGlobal",null),e([a()],Z.prototype,"renderOccludedFlags",null),e([a({value:!1})],Z.prototype,"renderingDisabled",null),e([a({value:!0})],Z.prototype,"visible",null),e([a()],Z.prototype,"renderPatchBorders",null),e([a()],Z.prototype,"wireframe",null),Z=e([l("esri.views.3d.terrain.TerrainRenderer")],Z);const J=_(),K=_(),X=_(),Y=_();export{Z as TerrainRenderer};
2
+ import{__decorate as e}from"tslib";import has from"../../../core/has.js";import{disposeMaybe as t}from"../../../core/maybe.js";import{MemCachePool as i}from"../../../core/MemCachePool.js";import r from"../../../core/ObjectPool.js";import{watch as s,sync as n}from"../../../core/reactiveUtils.js";import{property as a,subclass as l}from"../../../core/accessorSupport/decorators.js";import{subtract as o,set as c,dot as h}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{ZEROS as d,fromValues as u,create as _}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as g,ZEROS as f}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{create as p,set as m}from"../../../geometry/support/aaBoundingBox.js";import{BufferViewVec3f as y}from"../../../geometry/support/buffer/BufferView.js";import{overlayRenderOccludedFlag as b}from"./OverlayRenderer.js";import{PatchRenderData as x}from"./PatchRenderData.js";import{TerrainAttributesCache as T}from"./TerrainAttributesCache.js";import{enableTerrainInternalChecks as R}from"./terrainUtils.js";import{TileRenderer as v}from"./TileRenderer.js";import{IteratorPreorder as P,fallsWithinLayerView as w,sortTiles as O,compareTiles as S}from"./tileUtils.js";import{getOverlayContentForOutputTerrain as D}from"../webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js";import{SyncRenderPlugin as B}from"../webgl-engine/effects/RenderPlugin.js";import{Vertices as E}from"../webgl-engine/lib/Attribute.js";import{IntersectorResultRay as F}from"../webgl-engine/lib/IntersectorResult.js";import{intersectAabbInvDirBefore as j,MeshIntersectionOptions as q,intersectTriangles as C}from"../webgl-engine/lib/RayIntersections.js";import{TriangleIntersectionData as A}from"../webgl-engine/lib/TriangleIntersectionData.js";import{terrainId as M,getVerticalOffsetTerrain as G}from"../webgl-engine/lib/verticalOffsetUtils.js";import{DrawParameters as I}from"../webgl-engine/materials/DrawParameters.js";import{hasShadowHighlights as U}from"../webgl-engine/shaders/ReceiveShadowsConfiguration.js";import{T as k}from"../../../chunks/Terrain.glsl.js";import{TerrainTechnique as N}from"../webgl-engine/shaders/TerrainTechnique.js";import{TerrainTechniqueConfiguration as L}from"../webgl-engine/shaders/TerrainTechniqueConfiguration.js";import{PrimitiveType as V}from"../../webgl/enums.js";const H=7,z=10,Q=200,W=p();let Z=class extends B{get visibleTiles(){return Array.from(this._visiblePatchesByOrigin.values()).flat()}get _isGlobal(){return 1===this._stage.viewingMode}get _techniques(){return this._context.techniques}get _rctx(){return this._context.renderContext.rctx}get renderOccludedFlags(){return this._overlayRenderer.renderOccludedFlags}constructor(e,t,s,n,a){super({}),this._overlayRenderer=e,this._stage=t,this._allTiles=s,this._compressionTracker=n,this.type=7,this.isGround=!0,this._passParameters=new k,this._drawParameters=new I,this._renderDataPool=new r(()=>new x),this._visiblePatchesByOrigin=new Map,this._allPatchesByOrigin=new Map,this._patchesByOriginDirty=!0,this._patchSortingDirty=!0,this._tileIterator=new P,this._castShadows=!1,this._inViewshed=!1,this._cutFillEnabled=!1,this._tileRenderer=null,this._stencilEnabledLayerExtents=new Array,this._numTilesRendered=0,this._numTilesCulled=0,this._numOriginsRendered=0,this.produces=new Map([[1,()=>1===this._desiredSlot],[7,()=>7===this._desiredSlot],[9,()=>this._produces()&&this.renderOccludedFlags===b]]),this._tileSize=256,this._configuration=new L(1===t.viewingMode),this._tileTextureCache=new i((e,t)=>a.newCache(e,t),"TileTexture"),this.tileGeometryCache=new T(a)}normalizeCtorArgs(){return{}}initialize(){this._stage.addRenderPlugin(this),this.addHandles(s(()=>this._overlayRenderer.renderOccludedFlags,()=>this.setNeedsRender(),n))}destroy(){this._stage.removeRenderPlugin(this),this._tileTextureCache.destroy(),this.tileGeometryCache.destroy(),this._allTiles.prune(),this._tileRenderer=null}_produces(){return this.visible&&!!this._rootTiles&&!this.renderingDisabled}set renderingDisabled(e){this._set("renderingDisabled",!!e),this.setDirty()}set visible(e){this._set("visible",!!e),this.setDirty()}updateHeading(e){this._tileRenderer?.updateHeading(e)}set transparency(e){this._configuration.transparencyMode!==e&&(this._configuration.transparencyMode=e,this.setNeedsRender())}get transparency(){return this._configuration.transparencyMode}get renderPatchBorders(){return this._configuration.tileBorders}set renderPatchBorders(e){this._configuration.tileBorders!==e&&(this._configuration.tileBorders=e,this.setNeedsRender(),this.notifyChange("renderPatchBorders"))}get layerViewUid(){return M}get slicePlaneEnabled(){return this._configuration.hasSlicePlane}set slicePlaneEnabled(e){this._configuration.hasSlicePlane!==e&&(this._configuration.hasSlicePlane=e,this.setNeedsRender())}set textureFadingEnabled(e){this._configuration.textureFadingEnabled!==e&&(this._configuration.textureFadingEnabled=e,this.setNeedsRender())}set pbrMode(e){this._configuration.pbrMode!==e&&(this._configuration.pbrMode=e,this.setNeedsRender())}setRootTiles(e){this._rootTiles=e,this.setDirty()}setStencilEnabledLayerExtents(e){this._stencilEnabledLayerExtents=e,this._setSortingDirty()}set tileSize(e){this._tileSize=e,null!=this._tileRenderer&&(this._tileRenderer.tileSize=e),this.setDirty()}get tileSize(){return this._tileSize}_ensureRenderData(e){e.renderData||(e.renderData=this._renderDataPool.acquire(),e.renderData.init(e,this._getLocalOriginOfTile(e)))}loadTile(e){this._ensureRenderData(e),this.updateTileGeometryState(e),this.reuseTextureFromParent(e)||this.updateTileTexture(e,32)}reuseTextureFromParent(e){const{parent:t}=e;if(!this._canReuseTextureFromParent(t,e))return!1;const i=g(1&e.lij[2]?.5:0,1&e.lij[1]?0:.5,.5,.5);return t.renderData?.reuseTexture(e.renderData,i)??!1}_canReuseTextureFromParent(e,t){if(!e)return!1;const{layerInfo:i,surface:r}=t;for(let s=0;s<i[1].length;s++){const i=r.layerViewByIndex(s,1);if(w(e,i)!==w(t,i))return!1}return!0}updateTileTexture(e,t){null!=this._tileRenderer&&(this._tileRenderer.updateTileTexture(e,32===t?0:2),this.setNeedsRender(),e.resetPendingUpdate(t))}updateTileGeometryState(e){for(const i of e.layerInfo[0])i.pendingUpdates&=-9;e.resetPendingUpdate(8);const t=e.renderData.updateGeometryState();return t&&this.setDirty(),t}updateGeometryIfNeeded(e){e.loaded&&e.renderData.updateGeometryIfNeeded(this._rctx)}unloadTile(e){const t=e.renderData;t&&(t.releaseGeometry(),this._renderDataPool.release(t),t.clear(),e.renderData=null,e.setMemoryDirty(),this.setDirty())}_getLocalOriginOfTile(e){const t=z-H,i=Math.max(0,Math.floor((e.level-t)/H)*H);if(this._isGlobal&&0===i)return d;for(;e.parent&&e.level>i;)e=e.parent;return e.centerAtSeaLevel}getStats(){return{numTilesRendered:this._numTilesRendered,numTilesCulled:this._numTilesCulled,numOriginsRendered:this._numOriginsRendered}}set wireframe(e){this._get("wireframe")!==e&&(this._set("wireframe",e),this.setNeedsRender())}setDirty(e=1){this._patchesByOriginDirty=!0,this._context.requestRender(e)}_setSortingDirty(e=1){this._patchSortingDirty=!0,this._context.requestRender(e)}setNeedsRender(e=1){this._context.requestRender(e)}initializeRenderContext(e){this._context=e,this._tileRenderer=new v(this._rctx,this._tileSize,this._techniques,this._tileTextureCache,this._compressionTracker),this.updateTileBackground()}uninitializeRenderContext(){this._tileRenderer=t(this._tileRenderer)}intersectRay(e,t,i,r){if(!this._rootTiles||e.options.selectOpaqueTerrainOnly&&e.options.selectionMode&&0!==this.transparency)return;const s=J,n=K;o(s,r,i),c(n,1/s[0],1/s[1],1/s[2]);const a=e.results.min,l=e.results.max,d=e.results.ground,u=0===e.options.store,_=!!e.results.ground.target,g=G(e.verticalOffset),f=e.tolerance;let p,b=u&&null!=a.distance?a.distance:1/0;const x=e.options,T=x.normalRequired||!x.backfacesTerrain,R=new q(f,!1,T),v=c=>{const _=c.renderData;if(!_?.vao)return;const v=_.geometry;m(W,v.boundingBox);const P=_.localOrigin;null!=g&&(g.localOrigin=P,g.applyToAabb(W));const w=W;if(X[0]=i[0]-P[0],X[1]=i[1]-P[1],X[2]=i[2]-P[2],!j(w,X,n,f,b))return;const O=(e,t,i)=>{e.set(this.type,c,t,i),b=u&&null!=a.distance?a.distance:1/0},S=(n,o,c)=>{if((!T||null!=o)&&n>=0&&(x.backfacesTerrain||h(o,s)<0)&&(x.invisibleTerrain||!x.selectionMode||null==t||t(i,r,n))){if((null==d.distance||n<d.distance)&&O(d,n,o),x.isFiltered)return;2===x.store&&(null==p?(p=new F(e.ray),O(p,n,o),e.results.all.push(p)):n<p.distance&&O(p,n,o)),(null==a.distance||n<a.distance)&&O(a,n,o),0!==x.store&&(null==l.distance||n>l.distance)&&O(l,n,o)}},D=Y;o(D,r,P);const{indices:B,indexCount:q}=v,M=v.vertexAttributes,G=M.getField("position",y),I=new E(G.typedBuffer,3,M.stride/4),U=q/3;if(!g&&U>Q){const e=c.renderData;e.intersectionData??=new A(B,U,I),e.intersectionData.intersectRay(X,D,R,S)}else C(X,D,0,U,B,I,g,R,S)},P=this._rootTiles;if(null!=P){(()=>{const t=this._tileIterator;t.reset(P);const r=e.options.invisibleTerrain;for(let e=t.next();e;e=t.next())!(e.visible||r&&e.intersectsClippingArea)||null==g&&!e.intersectsRay(i,s,f,b)||_&&this._useStencilForTile(e)?t.skipSubtree():v(e)})()}}processScaleRangeQueries(e,t){if(!t.done&&e)for(this._updatePatchGroups();e.updating&&!t.done;){e.prepare();for(const t of this._visiblePatchesByOrigin.values())for(const i of t)null!=i.renderData?.textureReference&&e.queriesForTile(i);e.process(),t.madeProgress()}}get _desiredSlot(){if(!this._produces())return null;switch(this.transparency){case 0:return 1;case 1:case 2:return 7;case 3:case 4:return null}}acquireTechniques(e){const{shadowMap:t,viewshedEnabled:i,cutFillComputationEnabled:r,slot:s,hasEmission:n,useFloatBlend:a}=e.bind,l=!!has("enable-feature:terrain-shadows")&&t.enabled;if(l!==this._castShadows&&(this._castShadows=l,this._patchesByOriginDirty=!0),this._inViewshed!==i&&(this._inViewshed=i,this._patchesByOriginDirty=!0),this._cutFillEnabled!==r&&(this._cutFillEnabled=r,this._patchesByOriginDirty=!0),3===this.transparency)return null;if(9===s){if(0===(e.renderOccludedMask&b))return null}else if(s!==this._desiredSlot)return null;const o=this._configuration;switch(o.screenSpaceReflections=o.cloudReflections=o.receiveShadows=o.hasShadowHighlights=o.receiveAmbientOcclusion=o.renderOccluded=o.hasHighlightMixTexture=!1,o.hasEmission=n,o.overlayMode=this._overlayRenderer.mode,o.useFloatBlend=a.value,e.output){case 0:case 1:case 2:{const i=e.bind;o.screenSpaceReflections=i.hasScreenSpaceReflections,o.cloudReflections=null!=i.clouds.data;const r=9===s;return o.receiveShadows=t.ready&&!r,o.hasShadowHighlights=U(o,e.bind),o.renderOccluded=r,o.receiveAmbientOcclusion=!r&&null!=i.ssao,o.receiveGlobalIllumination=!r&&i.globalIlluminationEnabled,this._acquireTechnique(e.output)}case 5:case 7:return this._castShadows?this._acquireTechnique(5):null;case 8:return this._inViewshed?this._acquireTechnique(8):null;case 9:return this._cutFillEnabled?this._acquireTechnique(9):null;case 3:case 4:return this._acquireTechnique(e.output);case 11:return this._acquireTechnique(11);case 10:return o.hasHighlightMixTexture=null!=e.bind.highlightMixTexture,this._overlayRenderer.hasHighlights?this._acquireTechnique(10):null}return null}render(e,t){switch(this._updatePatchGroups(),this._passParameters.useStencil=!1,this._passParameters.overlayContent=D(e.output,e.bind),e.output){case 0:case 1:case 2:return this._renderMaterialPass(e,t);case 3:case 4:case 11:return this._renderAuxiliaryPass(e,t,this._visiblePatchesByOrigin);case 10:{const i=e.bind.highlight?.name;i&&this._overlayRenderer.hasHighlights&&this._overlayRenderer.renders(2)&&this._overlayRenderer.hasHighlight(i)&&this._renderAuxiliaryPass(e,t,this._visiblePatchesByOrigin);break}case 5:case 7:case 8:case 9:return this._renderAuxiliaryPass(e,t,this._allPatchesByOrigin)}}updateTileBackground(e){if(null==this._tileRenderer)return;const t=this._tileRenderer;let i;if(null!=e){const t=e.toUnitRGBA();i=u(t[0]||0,t[1]||0,t[2]||0)}t.setBackground(i),this._allTiles.forAll(e=>t.updateTileTexture(e,0)),this._configuration.tileBlendInput=t.backgroundIsGrid?2:null!=t.backgroundColor?1:0,this.setNeedsRender()}_updatePatchGroups(){if(this._patchesByOriginDirty&&(this._rebuildPatchGroups(),this._patchesByOriginDirty=!1,this._patchSortingDirty=!0),this._patchSortingDirty){const e=Array.from(this._visiblePatchesByOrigin.values()),t=this._stencilEnabledLayerExtents;for(const i of e)O(i,t);e.sort((e,t)=>S(e[0],t[0])),this._visiblePatchesByOrigin=new Map(e.map(e=>[e[0].renderData.localOrigin,e])),this.notifyChange("visibleTiles"),this._patchSortingDirty=!1}}_rebuildPatchGroups(){const e=this._rootTiles;if(null!=e){e[0]?.surface.checkAllTilesWaterproofness(),this._visiblePatchesByOrigin.clear(),this._allPatchesByOrigin.clear();for(const t of e)this._rebuildPatchGroupsForRootTile(t)}}_rebuildPatchGroupsForRootTile(e){const t=this._tileIterator;for(t.resetOne(e);!t.done;){const e=t.next(),i=e.renderData;if(!i){this._numTilesCulled++;continue}const r=i.localOrigin;if(this._castShadows||this._inViewshed||this._cutFillEnabled){let t=this._allPatchesByOrigin.get(r);t||(t=[],this._allPatchesByOrigin.set(r,t)),t.push(e)}if(!e.visible){this._numTilesCulled++,t.skipSubtree();continue}let s=this._visiblePatchesByOrigin.get(r);s||(s=[],this._visiblePatchesByOrigin.set(r,s)),s.push(e),t.skipSubtree()}}_useStencilForTile(e){for(const t of this._stencilEnabledLayerExtents)if(e.intersectsExtent(t))return!0;return!1}_renderAuxiliaryPass(e,t,i){const{rctx:r,bind:s}=e;r.bindTechnique(t,s,this._passParameters);const n=this._stencilEnabledLayerExtents.length>0;i.forEach(i=>{this._drawParameters.origin=i[0].renderData.localOrigin,t.program.bindDraw(s,this._passParameters,this._drawParameters);for(let r=0;r<i.length;r++)this._renderPatch(e,t,i[r],V.TRIANGLES,n,null===this._passParameters.overlayContent)}),r.bindVAO(null)}_renderMaterialPass(e,t){const{rctx:i,bind:r}=e,s=i.bindTechnique(t,r,this._passParameters);this._numTilesRendered=0,this._numTilesCulled=0,this._numOriginsRendered=0;const n=9===r.slot;n&&(s.bindTexture("tex",i.emptyTexture),s.setUniform3fv("textureOpacities",d),s.setUniform4fv("texOffsetAndScale",f));const a=null!=this._tileRenderer?.backgroundColor?this._tileRenderer.backgroundColor:d;1===this._configuration.tileBlendInput&&s.setUniform3fv("backgroundColor",a);const l=this._stencilEnabledLayerExtents.length>0,o=this.wireframe?V.LINES:V.TRIANGLES;this._configuration.textureFadingEnabled&&s.bindTexture("texNext",i.emptyTexture);const c=this._visiblePatchesByOrigin;for(const h of c.values()){const i=h[0].renderData.localOrigin;this._drawParameters.origin=i,t.program.bindDraw(r,this._passParameters,this._drawParameters),this._numOriginsRendered++;for(const r of h){const i=r.renderData,a=i.textureReference;if(null!=a){if(!n){s.setUniform4fv("texOffsetAndScale",a.offsetAndScale),s.bindTexture("tex",a.texture.texture);const e=i.textureFadeFactor,t=e<1?i.nextTextureReference:null;this._configuration.textureFadingEnabled&&t&&e<1?(s.setUniform1f("fadeFactor",e),s.setUniform4fv("nextTexOffsetAndScale",t.offsetAndScale),s.setUniform3fv("nextTexOpacities",t.opacities),s.bindTexture("texNext",t.texture.texture)):s.setUniform1f("fadeFactor",1),i.textureIsFading&&this.setNeedsRender(2),s.setUniform3fv("textureOpacities",a.opacities)}this._renderPatch(e,t,r,o,l),r.renderOrder=this._numTilesRendered,this._numTilesRendered++}}}i.bindVAO(null)}_renderPatch(e,t,i,r,s,n=!1){const a=i.renderData,l=a.vao,o=l?.indexBuffer;if(!l||null==o)return void(R&&console.error("Rendered tile with no indices: ",i.lij," : ",a));const c=t.program;n||this._overlayRenderer.isEmpty||this._bindOverlayPatchData(c,a.overlay);const{rctx:h,bind:d}=e;s&&(this._passParameters.useStencil=this._useStencilForTile(i),h.setPipelineState(t.getPipeline(d,this._passParameters)));const u=a.geometry.indexCount;h.bindVAO(l),c.assertCompatibleVertexAttributeLocations(l),h.drawElements(r,u,o.indexType,0)}_bindOverlayPatchData(e,t){e.setUniform4fv("overlayTexOffset",t.offsets),e.setUniform4fv("overlayTexScale",t.scales)}_acquireTechnique(e){return this._configuration.output=e,this._techniques.get(N,this._configuration)}get test(){}hasHighlight(e){return this._overlayRenderer.hasHighlight(e)}};e([a({readOnly:!0})],Z.prototype,"visibleTiles",null),e([a({readOnly:!0})],Z.prototype,"_isGlobal",null),e([a()],Z.prototype,"renderOccludedFlags",null),e([a({value:!1})],Z.prototype,"renderingDisabled",null),e([a({value:!0})],Z.prototype,"visible",null),e([a()],Z.prototype,"renderPatchBorders",null),e([a()],Z.prototype,"wireframe",null),Z=e([l("esri.views.3d.terrain.TerrainRenderer")],Z);const J=_(),K=_(),X=_(),Y=_();export{Z as TerrainRenderer};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import{removeUnordered as r}from"../../../core/arrayUtils.js";import{toConst as s}from"../../../core/compilerUtils.js";import"../../../core/has.js";import{destroyMaybe as i}from"../../../core/maybe.js";import{isPromiseLike as n}from"../../../core/promiseUtils.js";import{signal as o}from"../../../core/signal.js";import{property as d,subclass as h}from"../../../core/accessorSupport/decorators.js";import{isIntersectionHandler as a}from"../state/helpers/SceneIntersectionHelper.js";import{TextureCollection as l}from"../support/TextureCollection.js";import{ChangeSet as c}from"./lib/ChangeSet.js";import{Model as y}from"./parts/Model.js";import{RenderView as m}from"./parts/RenderView.js";import{TaskPriority as u,noBudget as _}from"../../support/Scheduler.js";import{Yield as p}from"../../support/Yield.js";let S=class extends t{constructor(e){super(e),this._model=new y,this._canCompact=o(!1),this._layers=new Array,this._asyncChangeSet=new c,this._syncChangeSet=new c,this._layerSyncSet=new Set,this._textures=new l(this,e.view.resourceController.scheduler),this._frameTask=e.view.resourceController.scheduler.registerTask(u.STAGE,this),this.addHandles(this._frameTask)}initialize(){try{this._renderView=new m({view:this.view},this)}catch(e){return void console.error("Failed to initialize render view",e)}}destroy(){this.removeAllHandles(),this._textures.destroy(),this._set("textures",null),this._renderView=i(this._renderView),this._set("renderView",null),this._layers.length=0,this._model=null,this._set("renderer",null),this.options.canvas=null,this._set("options",null)}get viewingMode(){return this.view.state.viewingMode}get updating(){return!this.destroyed&&!this.destroying&&(this.readyToRun||this.renderView.updating||this._frameTask.updating||this.textures.updating)}get renderView(){return this._renderView}get renderer(){return this.renderView?.renderer}get textures(){return this._textures}addTexture(e){this._model.addTexture(e),this.renderView.requestRender()}removeTexture(e){null!=e&&!this.destroyed&&this._model.hasTexture(e)&&(this._model.removeTexture(e),this.renderView.requestRender())}addTextures(e){null!=e&&(this._model.addTextures(e),this.renderView.requestRender())}removeTextures(e){null!=e&&(this._model?.removeTextures(e),this.renderView.requestRender())}forEachTexture(e){this._model.forEachTexture(e)}getTexture(e){return this._model.getTexture(e)}addLayer(e){this._layers.includes(e)||(this._model.addLayer(e),this._layers.push(e),this._model.dirtySet.layerAdded(e),this.renderView.requestRender())}removeLayer(e){null!=e&&!this.destroyed&&this._model.hasLayer(s(e))&&(this._model.dirtySet.layerRemoved(e),this.commitLayer(e),r(this._layers,e),this._model.dirtySet.assertLayerClean(e.id),this._model.removeLayer(e),this.renderView.requestRender())}getLayer(e){return this._model.getLayer(e)}handleEvent(e,t){this.destroyed||(this._model.dirtySet[e](t),this.renderView.requestRender())}get readyToRun(){return this._model.dirtySet.dirty||!this._asyncChangeSet.empty||this._canCompact.value}runTask(e){if(this._frameTask.processQueue(e),this._commit(e),this.renderer.compact(e),this._canCompact.value=this.renderer.canCompact,!e.hasProgressed)return p}compact(e){return this._canCompact.value=!1,this.renderer.compact(e)}_commit(e){const t=this._model.dirtySet;this._asyncChangeSet.empty||e.done||(this.renderer.commit(this._asyncChangeSet,e),this.renderView.requestRender(),e.madeProgress()),this._layers.forEach(r=>{if(e.done)return;const s=this._layerSyncSet.has(r.id)||1===r.updatePolicy,i=s?this._syncChangeSet:this._asyncChangeSet;t.commitLayer(r.id,i),this._layerSyncSet.delete(r.id),i.empty||(this.renderer.commit(i,s?_:e),this.renderView.requestRender(),e.madeProgress())}),this._syncChangeSet.empty||(this.renderer.commit(this._syncChangeSet,_),this.renderView.requestRender(),e.madeProgress()),this._layers.forEach(r=>{e.done||this._layerSyncSet.has(r.id)||0!==r.updatePolicy||(t.commitLayer(r.id,this._asyncChangeSet),this._asyncChangeSet.empty||(this.renderer.commit(this._asyncChangeSet,e),this.renderView.requestRender(),e.madeProgress()))}),this._layerSyncSet.clear(),this.notifyChange("readyToRun")}commitSyncLayers(){const e=this._model.dirtySet;this._layers.forEach(t=>{this._layerSyncSet.has(t.id)||1===t.updatePolicy?(e.commitLayer(t.id,this._syncChangeSet),this._layerSyncSet.delete(t.id)):e.commitSyncUpdates(t.id,this._syncChangeSet)});for(const t of this._layerSyncSet)e.commitLayer(t,this._syncChangeSet);this._layerSyncSet.clear(),this._syncChangeSet.empty||(this.renderer.commit(this._syncChangeSet,_),this.renderView.requestRender())}commitLayer(e){this._model.dirtySet.commitLayer(e.id,this._syncChangeSet),this._layerSyncSet.delete(e.id),this._syncChangeSet.empty||(this.renderer.commit(this._syncChangeSet,_),this.renderView.requestRender())}schedule(e,t){return this._frameTask.schedule(e,t)}reschedule(e,t){return this._frameTask.reschedule(e,t)}syncLayer(e){this._layerSyncSet.add(e),this.renderView.requestRender()}get layers(){return this._layers}addRenderPlugin(e,t){const r=this.renderer.plugins.add(e,t),s=()=>{a(e)&&this.view.sceneIntersectionHelper.addIntersectionHandler(e)};if(n(r))return r.then(s);s()}removeRenderPlugin(e){this.destroyed||(a(e)&&this.view.sceneIntersectionHelper.removeIntersectionHandler(e),this.renderer.plugins.remove(e))}get test(){}};e([d({constructOnly:!0})],S.prototype,"view",void 0),e([d({constructOnly:!0})],S.prototype,"options",void 0),e([d({constructOnly:!0})],S.prototype,"container",void 0),e([d({readOnly:!0})],S.prototype,"viewingMode",null),e([d({readOnly:!0})],S.prototype,"updating",null),e([d({readOnly:!0})],S.prototype,"renderView",null),e([d({readOnly:!0})],S.prototype,"renderer",null),e([d({readOnly:!0})],S.prototype,"textures",null),e([d({readOnly:!0})],S.prototype,"readyToRun",null),S=e([h("esri.views.3d.webgl-engine.Stage")],S);export{S as Stage};
2
+ import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import{removeUnordered as r}from"../../../core/arrayUtils.js";import{toConst as s}from"../../../core/compilerUtils.js";import"../../../core/has.js";import{destroyMaybe as i}from"../../../core/maybe.js";import{isPromiseLike as n}from"../../../core/promiseUtils.js";import{signal as o}from"../../../core/signal.js";import{property as d,subclass as a}from"../../../core/accessorSupport/decorators.js";import{isIntersectionHandler as h}from"../state/helpers/SceneIntersectionHelper.js";import{debugFlags as l}from"../support/debugFlags.js";import{TextureCollection as c}from"../support/TextureCollection.js";import{ChangeSet as y}from"./lib/ChangeSet.js";import{Model as m}from"./parts/Model.js";import{RenderView as u}from"./parts/RenderView.js";import{TaskPriority as p,noBudget as _}from"../../support/Scheduler.js";import{Yield as g}from"../../support/Yield.js";let S=class extends t{constructor(e){super(e),this._model=new m,this._canCompact=o(!1),this._layers=new Array,this._asyncChangeSet=new y,this._syncChangeSet=new y,this._layerSyncSet=new Set,this._textures=new c(this,e.view.resourceController.scheduler),this._frameTask=e.view.resourceController.scheduler.registerTask(p.STAGE,this),this.addHandles(this._frameTask)}initialize(){try{this._renderView=new u({view:this.view},this)}catch(e){return void console.error("Failed to initialize render view",e)}}destroy(){this.removeAllHandles(),this._textures.destroy(),this._set("textures",null),this._renderView=i(this._renderView),this._set("renderView",null),this._layers.length=0,this._model=null,this._set("renderer",null),this.options.canvas=null,this._set("options",null)}get viewingMode(){return this.view.state.viewingMode}get updating(){if(this.destroyed||this.destroying)return!1;const e=this.readyToRun||this.renderView.updating||this._frameTask.updating||this.textures.updating;return e&&l.UPDATING&&console.log(" Stage:",this.readyToRun,this.renderView.updating,this._frameTask.updating,this.textures.updating),e}get renderView(){return this._renderView}get renderer(){return this.renderView?.renderer}get textures(){return this._textures}addTexture(e){this._model.addTexture(e),this.renderView.requestRender()}removeTexture(e){null!=e&&!this.destroyed&&this._model.hasTexture(e)&&(this._model.removeTexture(e),this.renderView.requestRender())}addTextures(e){null!=e&&(this._model.addTextures(e),this.renderView.requestRender())}removeTextures(e){null!=e&&(this._model?.removeTextures(e),this.renderView.requestRender())}forEachTexture(e){this._model.forEachTexture(e)}getTexture(e){return this._model.getTexture(e)}addLayer(e){this._layers.includes(e)||(this._model.addLayer(e),this._layers.push(e),this._model.dirtySet.layerAdded(e),this.renderView.requestRender())}removeLayer(e){null!=e&&!this.destroyed&&this._model.hasLayer(s(e))&&(this._model.dirtySet.layerRemoved(e),this.commitLayer(e),r(this._layers,e),this._model.dirtySet.assertLayerClean(e.id),this._model.removeLayer(e),this.renderView.requestRender())}getLayer(e){return this._model.getLayer(e)}handleEvent(e,t){this.destroyed||(this._model.dirtySet[e](t),this.renderView.requestRender())}get readyToRun(){return this._model.dirtySet.dirty||!this._asyncChangeSet.empty||this._canCompact.value}runTask(e){if(this._frameTask.processQueue(e),this._commit(e),this.renderer.compact(e),this._canCompact.value=this.renderer.canCompact,!e.hasProgressed)return g}compact(e){return this._canCompact.value=!1,this.renderer.compact(e)}_commit(e){const t=this._model.dirtySet;this._asyncChangeSet.empty||e.done||(this.renderer.commit(this._asyncChangeSet,e),this.renderView.requestRender(),e.madeProgress()),this._layers.forEach(r=>{if(e.done)return;const s=this._layerSyncSet.has(r.id)||1===r.updatePolicy,i=s?this._syncChangeSet:this._asyncChangeSet;t.commitLayer(r.id,i),this._layerSyncSet.delete(r.id),i.empty||(this.renderer.commit(i,s?_:e),this.renderView.requestRender(),e.madeProgress())}),this._syncChangeSet.empty||(this.renderer.commit(this._syncChangeSet,_),this.renderView.requestRender(),e.madeProgress()),this._layers.forEach(r=>{e.done||this._layerSyncSet.has(r.id)||0!==r.updatePolicy||(t.commitLayer(r.id,this._asyncChangeSet),this._asyncChangeSet.empty||(this.renderer.commit(this._asyncChangeSet,e),this.renderView.requestRender(),e.madeProgress()))}),this._layerSyncSet.clear(),this.notifyChange("readyToRun")}commitSyncLayers(){const e=this._model.dirtySet;this._layers.forEach(t=>{this._layerSyncSet.has(t.id)||1===t.updatePolicy?(e.commitLayer(t.id,this._syncChangeSet),this._layerSyncSet.delete(t.id)):e.commitSyncUpdates(t.id,this._syncChangeSet)});for(const t of this._layerSyncSet)e.commitLayer(t,this._syncChangeSet);this._layerSyncSet.clear(),this._syncChangeSet.empty||(this.renderer.commit(this._syncChangeSet,_),this.renderView.requestRender())}commitLayer(e){this._model.dirtySet.commitLayer(e.id,this._syncChangeSet),this._layerSyncSet.delete(e.id),this._syncChangeSet.empty||(this.renderer.commit(this._syncChangeSet,_),this.renderView.requestRender())}schedule(e,t){return this._frameTask.schedule(e,t)}reschedule(e,t){return this._frameTask.reschedule(e,t)}syncLayer(e){this._layerSyncSet.add(e),this.renderView.requestRender()}get layers(){return this._layers}addRenderPlugin(e,t){const r=this.renderer.plugins.add(e,t),s=()=>{h(e)&&this.view.sceneIntersectionHelper.addIntersectionHandler(e)};if(n(r))return r.then(s);s()}removeRenderPlugin(e){this.destroyed||(h(e)&&this.view.sceneIntersectionHelper.removeIntersectionHandler(e),this.renderer.plugins.remove(e))}get test(){}};e([d({constructOnly:!0})],S.prototype,"view",void 0),e([d({constructOnly:!0})],S.prototype,"options",void 0),e([d({constructOnly:!0})],S.prototype,"container",void 0),e([d({readOnly:!0})],S.prototype,"viewingMode",null),e([d({readOnly:!0})],S.prototype,"updating",null),e([d({readOnly:!0})],S.prototype,"renderView",null),e([d({readOnly:!0})],S.prototype,"renderer",null),e([d({readOnly:!0})],S.prototype,"textures",null),e([d({readOnly:!0})],S.prototype,"readyToRun",null),S=e([a("esri.views.3d.webgl-engine.Stage")],S);export{S as Stage};
@@ -1,16 +1,16 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{DecodeSymbolColor as o}from"./DecodeSymbolColor.glsl.js";import{TextureBackedBufferModule as e}from"../../../core/shaderLibrary/TextureBackedBuffer.glsl.js";import{Float4DrawUniform as r}from"../../../core/shaderModules/Float4DrawUniform.js";import{FloatDrawUniform as t}from"../../../core/shaderModules/FloatDrawUniform.js";import{glsl as n,If as d}from"../../../core/shaderModules/glsl.js";import{IntegerDrawUniform as a}from"../../../core/shaderModules/IntegerDrawUniform.js";import{Texture2DUintDrawUniform as l}from"../../../core/shaderModules/Texture2DUintDrawUniform.js";import{olidEnabled as i}from"../../../effects/geometry/olidUtils.js";import{componentDataLayout as s,componentDataOlidLayout as c}from"../../../materials/DefaultLayouts.js";import{floatBlendScale as u}from"../../../shaders/floatBlendScale.glsl.js";function m(o,e){switch(e.componentDataType){case 1:return p(o,e);case 0:return M(o,e);case 2:return;default:e.componentDataType}}const f=new l("componentTextureBuffer",o=>o.textureBackedBuffer?.texture),v=new e({layout:s,itemIndexExpression:"componentIndex",bufferUniform:f}),x=new e({layout:c,itemIndexExpression:"componentIndex",bufferUniform:f});function C(){return i()?x:v}function p(e,r){const{vertex:t,fragment:a}=e,{output:l,hasEmission:i}=r,s=11===l,c=C().createBuilder(e,r);e.attributes.add("componentIndex","uint"),e.varyings.add("vExternalColorMixMode","mediump float"),e.varyings.add("vExternalColor","vec4"),s&&e.varyings.add("vObjectAndLayerIdColor","vec4"),i&&(e.varyings.add("emissiveStrength","float"),e.varyings.add("emissiveSource","int")),e.include(o),t.include(u,r),t.code.add(n`
2
+ import{__decorate as o}from"tslib";import{DecodeSymbolColor as e}from"./DecodeSymbolColor.glsl.js";import{TextureBackedBufferModule as r}from"../../../core/shaderLibrary/TextureBackedBuffer.glsl.js";import{EmissionsConfiguration as t,hasEmissiveStrengthFromUniform as n}from"../../../core/shaderLibrary/output/getEmissions.glsl.js";import{Float4DrawUniform as a}from"../../../core/shaderModules/Float4DrawUniform.js";import{FloatDrawUniform as d}from"../../../core/shaderModules/FloatDrawUniform.js";import{glsl as l,If as i}from"../../../core/shaderModules/glsl.js";import{IntegerDrawUniform as s}from"../../../core/shaderModules/IntegerDrawUniform.js";import{Texture2DUintDrawUniform as c}from"../../../core/shaderModules/Texture2DUintDrawUniform.js";import{parameter as u}from"../../../core/shaderTechnique/ShaderTechniqueConfiguration.js";import{olidEnabled as m}from"../../../effects/geometry/olidUtils.js";import{componentDataLayout as f,componentDataOlidLayout as v}from"../../../materials/DefaultLayouts.js";import{floatBlendScale as x}from"../../../shaders/floatBlendScale.glsl.js";class C extends t{constructor(){super(...arguments),this.componentDataType=0}}function p(o,e){switch(e.componentDataType){case 1:return b(o,e);case 0:case 2:return y(o,e);default:e.componentDataType}}o([u({count:2})],C.prototype,"componentDataType",void 0);const h=new c("componentTextureBuffer",o=>o.textureBackedBuffer?.texture),g=new r({layout:f,itemIndexExpression:"componentIndex",bufferUniform:h}),M=new r({layout:v,itemIndexExpression:"componentIndex",bufferUniform:h});function w(){return m()?M:g}function b(o,r){const{vertex:t,fragment:a}=o,{output:d,hasEmission:s}=r,c=11===d,u=w().createBuilder(o,r);o.attributes.add("componentIndex","uint"),o.varyings.add("vExternalColorMixMode","mediump float"),o.varyings.add("vExternalColor","vec4"),c&&o.varyings.add("vObjectAndLayerIdColor","vec4");const m=s&&!n(r);m&&(o.varyings.add("emissiveStrength","float"),o.varyings.add("emissiveSource","int")),o.include(e),t.include(x,r),t.code.add(l`
3
3
  float readElevationOffset() {
4
- return ${c.getTextureAttribute("elevationOffset")};
4
+ return ${u.getTextureAttribute("elevationOffset")};
5
5
  }
6
6
 
7
7
  void forwardEmissiveStrength() {
8
- ${d(i,n`emissiveStrength = clamp(${c.getTextureAttribute("emissiveStrength")}, 0.0, maxEmissiveStrength);
9
- emissiveSource = ${c.getTextureAttribute("emissiveSourceMode")} == 0u ? 0 : 1;`)}
8
+ ${i(m,l`emissiveStrength = clamp(${u.getTextureAttribute("emissiveStrength")}, 0.0, maxEmissiveStrength);
9
+ emissiveSource = ${u.getTextureAttribute("emissiveSourceMode")} == 0u ? 0 : 1;`)}
10
10
  }
11
11
 
12
12
  void forwardObjectAndLayerIdColor() {
13
- ${d(s,n`vObjectAndLayerIdColor = vec4(${c.getTextureAttribute("olidColor")})/255.0;`)}
13
+ ${i(c,l`vObjectAndLayerIdColor = vec4(${u.getTextureAttribute("olidColor")})/255.0;`)}
14
14
  }
15
15
 
16
16
  void decodeColorAndCastShadow(uvec4 colorAndCastShadowEncoded, out vec4 color, out bool castShadow) {
@@ -22,7 +22,7 @@ import{DecodeSymbolColor as o}from"./DecodeSymbolColor.glsl.js";import{TextureBa
22
22
 
23
23
  vec4 forwardExternalColor(out bool castShadows) {
24
24
  vec4 componentColor;
25
- decodeColorAndCastShadow(${c.getTextureAttribute("colorAndCastShadows")}, componentColor, castShadows);
25
+ decodeColorAndCastShadow(${u.getTextureAttribute("colorAndCastShadows")}, componentColor, castShadows);
26
26
 
27
27
  int decodedColorMixMode;
28
28
  vExternalColor = decodeSymbolColor(componentColor, decodedColorMixMode) * 0.003921568627451; // = 1/255;
@@ -30,16 +30,16 @@ import{DecodeSymbolColor as o}from"./DecodeSymbolColor.glsl.js";import{TextureBa
30
30
 
31
31
  return vExternalColor;
32
32
  }
33
- `),a.code.add(n`
33
+ `),a.code.add(l`
34
34
  void readExternalColor(out vec4 externalColor, out int externalColorMixMode) {
35
35
  externalColor = vExternalColor;
36
36
  externalColorMixMode = int(vExternalColorMixMode);
37
37
  }
38
38
 
39
39
  void outputObjectAndLayerIdColor() {
40
- ${s?n`fragColor = vObjectAndLayerIdColor;`:""}
40
+ ${c?l`fragColor = vObjectAndLayerIdColor;`:""}
41
41
  }
42
- `)}function M(o,e){const{vertex:l,fragment:i}=o;o.varyings.add("vExternalColor","vec4"),i.uniforms.add(new t("emissiveStrength",o=>o.componentParameters.emissiveStrength)),l.uniforms.add(new r("externalColor",o=>o.componentParameters.externalColor)).code.add(n`float readElevationOffset() {
42
+ `)}function y(o,e){const{vertex:r,fragment:t}=o;o.varyings.add("vExternalColor","vec4"),t.uniforms.add(new d("emissiveStrength",o=>o.componentParameters.emissiveStrength)),r.uniforms.add(new a("externalColor",o=>o.componentParameters.externalColor)).code.add(l`float readElevationOffset() {
43
43
  return 0.0;
44
44
  }
45
45
  void forwardObjectAndLayerIdColor() {}
@@ -48,13 +48,13 @@ vec4 forwardExternalColor(out bool castShadows) {
48
48
  vExternalColor = externalColor;
49
49
  castShadows = true;
50
50
  return externalColor;
51
- }`);const s=11===e.output;i.uniforms.add(new a("externalColorMixMode",o=>o.componentParameters.externalColorMixMode)).code.add(n`
51
+ }`);const n=11===e.output;t.uniforms.add(new s("externalColorMixMode",o=>o.componentParameters.externalColorMixMode)).code.add(l`
52
52
  void readExternalColor(out vec4 color, out int colorMixMode) {
53
53
  color = vExternalColor;
54
54
  colorMixMode = externalColorMixMode;
55
55
  }
56
56
 
57
57
  void outputObjectAndLayerIdColor() {
58
- ${d(s,"fragColor = vec4(0, 0, 0, 0);")}
58
+ ${i(n,"fragColor = vec4(0, 0, 0, 0);")}
59
59
  }
60
- `)}export{m as ComponentData};
60
+ `)}export{p as ComponentData,C as ComponentDataConfiguration};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{create as s}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{emissiveStrengthDefault as t}from"../../core/shaderLibrary/output/Emissions.glsl.js";class i{constructor(){this.externalColor=s(),this.externalColorMixMode=1,this.castShadows=!0,this.pickable=!0,this.elevationOffset=0,this.emissiveStrength=t,this.emissiveSource=0}}export{i as UniformComponentParameters};
2
+ import{create as s}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{emissiveStrengthDefault as t}from"../../core/shaderLibrary/output/getEmissions.glsl.js";class e{constructor(){this.externalColor=s(),this.externalColorMixMode=1,this.castShadows=!0,this.pickable=!0,this.elevationOffset=0,this.emissiveStrength=t,this.emissiveSource=0}}export{e as UniformComponentParameters};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import e from"../../webgl/ManagedColorAttachment.js";import{ManagedDepthTexture as t}from"../../webgl/ManagedDepthTexture.js";import a from"../../webgl/ManagedFBO.js";import{isDepthFormat as c,formatString as r,DepthTextureFormats as h,ColorFormats as i}from"./FBOCacheFormats.js";import{FBOCacheUsage as s}from"./FBOCacheUsage.js";import{FBOPool as o}from"./FBOPool.js";import{DepthStencilAttachment as n,ColorAttachment0 as l}from"../../../webgl/enums.js";import{DisposableFramebufferObject as u}from"../../../webgl/FramebufferObject.js";import m from"../../../webgl/Texture.js";class d{constructor(e){this.rctx=e,this._interactive=!1,this._usage=new s,this._acquired=new Set,this._cache=new o(e.newCache,"FBOCache"),this._colorCache=new o(e.newCache,"ColorAttachmentCache"),this._depthCache=new o(e.newCache,"DepthAttachmentCache")}destroy(){this._cache.destroy(),this._depthCache.destroy(),this._colorCache.destroy()}clean(){this._cache.clean(),this._colorCache.clean(),this._depthCache.clean()}frameStart(){this._cache.frame(),this._colorCache.frame(),this._depthCache.frame(),this.debugCallback?.(),this._usage.clear()}frameEnd(){this.debugCallback&&(this._usage.summarize(),this._acquired.forEach(e=>this.debugCallback?.(e.name,e.fbo)))}get usedMemory(){return Array.from(this._acquired.values()).reduce((e,t)=>e+t.usedMemory,this._cache.usedMemory+this._colorCache.usedMemory+this._depthCache.usedMemory)}set interactive(e){this._cache.interactive=this._colorCache.interactive=this._depthCache.interactive=e,this._interactive=e}get interactive(){return this._interactive}acquire(e,t,h,i=5){const s=p(i,e,t);let o=this._cache.pop(s);const{rctx:m}=this;if(o){o.retain(),o.setName(h);const e=o.getAttachment(n);e&&(e.name=C);const t=o.getAttachment(l);t&&(t.name=_(0)),m.unbindTexture(o.fbo.colorTexture)}else{const r=new u(m),d=(a,c,r)=>{c??=5;const h=this._acquireColor(c,e,t,r??_(a-l));return this.rctx.unbindTexture(h.attachment),o.attachColor(h,a),h.release(),o},p=a=>{a??=14;const c=this.acquireDepth(a,e,t,`${o.name} ${C}`);return o.attachDepth(c),c.release(),o},f=()=>{if(!o)return;this.debugCallback?.(o.name,o.fbo),this._acquired.delete(o);const e=c(i);e&&null!=o.getAttachment(n)||!e&&null!=o.getAttachment(l)?(e?(o.fbo?.invalidateAttachments([n]),o.detachAllColors()):(o.fbo?.invalidateAttachments([l]),o.detachAllButColor0()),this._trackRelease(o),this._cache.put(o)):o.dispose()};o=new a(s,h,r,d,p,f),c(i)?o.acquireDepth(i):o.acquireColor(l,i)}return this._trackAcquire(o,"f "+r(i),e,t),this._trackHandle(o)}acquireDepth(e,a,c,i){const s=p(e,a,c);let o=this._depthCache.pop(s);if(o)o.retain(),o.attachment.setShadowFiltering(!1);else{const r=new m(this.rctx,{...h[e],width:a,height:c});o=new t(s,r,()=>{this._trackRelease(o),this._depthCache.put(o)})}return o.name=i,this._trackAcquire(o,"d "+r(e),a,c),o}_acquireColor(t,a,c,h){const s=p(t,a,c);let o=this._colorCache.pop(s);if(o)o.retain();else{const r=new m(this.rctx,{...i[t],width:a,height:c,isImmutable:!0});o=new e(s,r,()=>{this._trackRelease(o),this._colorCache.put(o)})}return o.name=h,this._trackAcquire(o,"c "+r(t),a,c),o}_trackHandle(e){return this._acquired.add(e),e}_trackAcquire(e,t,a,c){this.debugCallback&&this._usage.add(e,t,a,c)}_trackRelease(e){this.debugCallback&&this._usage.remove(e)}}function _(e=0){return`color${e}`}const C="depth";function p(e,t,a){return`${t}x${a}:${e}`}export{d as FBOCache};
2
+ import e from"../../webgl/ManagedColorAttachment.js";import{ManagedDepthTexture as t}from"../../webgl/ManagedDepthTexture.js";import a from"../../webgl/ManagedFBO.js";import{isDepthFormat as c,formatString as r,DepthTextureFormats as h,ColorFormats as i}from"./FBOCacheFormats.js";import{FBOCacheUsage as s}from"./FBOCacheUsage.js";import{FBOPool as o}from"./FBOPool.js";import{DepthStencilAttachment as n,ColorAttachment0 as l}from"../../../webgl/enums.js";import{DisposableFramebufferObject as u}from"../../../webgl/FramebufferObject.js";import m from"../../../webgl/Texture.js";class d{constructor(e){this.rctx=e,this._interactive=!1,this._usage=new s,this._acquired=new Set,this._cache=new o(e.newCache,"FBOCache"),this._colorCache=new o(e.newCache,"ColorAttachmentCache"),this._depthCache=new o(e.newCache,"DepthAttachmentCache")}destroy(){this._cache.destroy(),this._depthCache.destroy(),this._colorCache.destroy()}clean(){this._cache.clean(),this._colorCache.clean(),this._depthCache.clean()}frameStart(){this._cache.frame(),this._colorCache.frame(),this._depthCache.frame(),this.debugCallback?.(),this._usage.clear()}frameEnd(){this.debugCallback&&(this._usage.summarize(),this._acquired.forEach(e=>this.debugCallback?.(e.name,e.fbo)))}get usedMemory(){return Array.from(this._acquired.values()).reduce((e,t)=>e+t.usedMemory,this._cache.usedMemory+this._colorCache.usedMemory+this._depthCache.usedMemory)}set interactive(e){this._cache.interactive=this._colorCache.interactive=this._depthCache.interactive=e,this._interactive=e}get interactive(){return this._interactive}acquire(e,t,h,i=5){const s=p(i,e,t);let o=this._cache.pop(s);const{rctx:m}=this;if(o){o.retain(),o.setName(h);const e=o.getAttachment(n);e&&(e.name=C);const t=o.getAttachment(l);t&&(t.name=_(0)),m.unbindTexture(o.fbo.colorTexture)}else{const r=new u(m),d=(a,c,r)=>{c??=5,r??=_(a-l);const h=this._acquireColor(c,e,t,r);return this.rctx.unbindTexture(h.attachment),o.attachColor(h,a),h.release(),o},p=a=>{a??=14;const c=this.acquireDepth(a,e,t,`${o.name} ${C}`);return o.attachDepth(c),c.release(),o},f=()=>{if(!o)return;this.debugCallback?.(o.name,o.fbo),this._acquired.delete(o);const e=c(i);e&&null!=o.getAttachment(n)||!e&&null!=o.getAttachment(l)?(e?(o.fbo?.invalidateAttachments([n]),o.detachAllColors()):(o.fbo?.invalidateAttachments([l]),o.detachAllButColor0()),this._trackRelease(o),this._cache.put(o)):o.dispose()};o=new a(s,h,r,d,p,f),c(i)?o.acquireDepth(i):o.acquireColor(l,i)}return this._trackAcquire(o,"f "+r(i),e,t),this._trackHandle(o)}acquireDepth(e,a,c,i){const s=p(e,a,c);let o=this._depthCache.pop(s);if(o)o.retain(),o.attachment.setShadowFiltering(!1);else{const r=new m(this.rctx,{...h[e],width:a,height:c});o=new t(s,r,()=>{this._trackRelease(o),this._depthCache.put(o)})}return o.name=i,this._trackAcquire(o,"d "+r(e),a,c),o}_acquireColor(t,a,c,h){const s=p(t,a,c);let o=this._colorCache.pop(s);if(o)o.retain();else{const r=new m(this.rctx,{...i[t],width:a,height:c,isImmutable:!0});o=new e(s,r,()=>{this._trackRelease(o),this._colorCache.put(o)})}return o.name=h,this._trackAcquire(o,"c "+r(t),a,c),o}_trackHandle(e){return this._acquired.add(e),e}_trackAcquire(e,t,a,c){this.debugCallback&&this._usage.add(e,t,a,c)}_trackRelease(e){this.debugCallback&&this._usage.remove(e)}}function _(e=0){return`color${e}`}const C="depth";function p(e,t,a){return`${t}x${a}:${e}`}export{d as FBOCache};
@@ -1,5 +1,5 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
2
  import{glsl as i}from"../shaderModules/glsl.js";function o(o,t=!0){o.attributes.add("position","vec2"),t&&o.varyings.add("uv","vec2"),o.vertex.main.add(i`
3
- gl_Position = vec4(position, 0.0, 1.0);
4
- ${t?i`uv = position * 0.5 + vec2(0.5);`:""}
3
+ gl_Position = vec4(position, 0.0, 1.0);
4
+ ${t?i`uv = position * 0.5 + vec2(0.5);`:""}
5
5
  `)}export{o as ScreenSpacePass};
@@ -0,0 +1,8 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import{__decorate as e}from"tslib";import{clamp as s}from"../../../../../../core/mathUtils.js";import{isColor as o}from"../ShaderOutput.js";import{ShaderOutputConfiguration as i}from"../ShaderOutputConfiguration.js";import{VertexTextureCoordinates as r}from"../attributes/VertexTextureCoordinates.glsl.js";import{Gamma as m}from"../shading/Gamma.glsl.js";import{Float3DrawUniform as t}from"../../shaderModules/Float3DrawUniform.js";import{Float3PassUniform as a}from"../../shaderModules/Float3PassUniform.js";import{FloatDrawUniform as n}from"../../shaderModules/FloatDrawUniform.js";import{FloatPassUniform as d}from"../../shaderModules/FloatPassUniform.js";import{glsl as c}from"../../shaderModules/glsl.js";import{Texture2DDrawUniform as u}from"../../shaderModules/Texture2DDrawUniform.js";import{Texture2DPassUniform as v}from"../../shaderModules/Texture2DPassUniform.js";import{parameter as l}from"../../shaderTechnique/ShaderTechniqueConfiguration.js";import{floatBlendReductionFactor as f}from"../../../shaders/floatBlendScale.glsl.js";const p=1;class h extends i{constructor(){super(...arguments),this.emissionSource=0}}function x(e,i){const{hasEmission:l,emissionSource:p,hasEmissiveTextureTransform:h,bindType:x}=i;if(!o(i.output)||!l)return;const S=e.fragment;S.include(m);const T=3===p||4===p||5===p;T&&(e.include(r,i),S.uniforms.add(1===x?new v("texEmission",e=>e.textureEmissive):new u("texEmission",e=>e.textureEmissive)));const j=2===p||T;if(j&&S.uniforms.add(1===x?new a("emissiveBaseColor",e=>e.emissiveBaseColor):new t("emissiveBaseColor",e=>e.emissiveBaseColor)),l&&g(i)){const e=e=>s(e??0,0,f);S.uniforms.add(1===x?new d("emissiveStrength",s=>e(s.emissiveStrength)):new n("emissiveStrength",s=>e(s.emissiveStrength)))}const C=7===p,b=5===p,E=1===p||6===p||C;S.code.add(c`vec4 getEmissions(vec3 symbolColor) {
3
+ vec4 emissions =`),j?b?S.code.add("emissiveSource == 0 ? vec4(emissiveBaseColor, 1.0): vec4(linearizeGamma(symbolColor), 1.0)"):S.code.add("vec4(emissiveBaseColor, 1.0)"):E?C?S.code.add("emissiveSource == 0 ? vec4(0.0): vec4(linearizeGamma(symbolColor), 1.0)"):S.code.add("vec4(linearizeGamma(symbolColor), 1.0)"):S.code.add("vec4(0.0)"),S.code.add(";"),T&&(b?S.code.add(c`
4
+ if(emissiveSource == 0) {
5
+ vec4 emissiveFromTex = textureLookup(texEmission, ${h?"emissiveUV":"vuv0"});
6
+ emissions *= vec4(linearizeGamma(emissiveFromTex.rgb), emissiveFromTex.a);
7
+ }
8
+ `):S.code.add(`vec4 emissiveFromTex = textureLookup(texEmission, ${h?"emissiveUV":"vuv0"});\n emissions *= vec4(linearizeGamma(emissiveFromTex.rgb), emissiveFromTex.a);`),S.code.add("emissions.a = emissions.rgb == vec3(0.0) ? 0.0: emissions.a;")),l&&S.code.add("emissions.rgb *= emissiveStrength;"),S.code.add("return emissions;}")}function g({emissionSource:e}){return 0===e||1===e||2===e||3===e}e([l({count:8})],h.prototype,"emissionSource",void 0),e([l()],h.prototype,"hasEmissiveTextureTransform",void 0);export{h as EmissionsConfiguration,p as emissiveStrengthDefault,x as getEmissions,g as hasEmissiveStrengthFromUniform};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ function a(a,i){i.hasEmissive&&(a.outputs.add("fragEmission","vec4",1),a.fragment.main.add("fragEmission = vec4(vec3(0.0), fragColor.a);"))}export{a as blendEmission};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{lerp as t}from"../../../../../core/mathUtils.js";import{disposeMaybe as r}from"../../../../../core/maybe.js";import{watch as s,syncAndInitial as i,initial as a}from"../../../../../core/reactiveUtils.js";import{subclass as o}from"../../../../../core/accessorSupport/decorators.js";import{set as n}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{set as m,length as h}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{ZEROS as p}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{earth as c}from"../../../../../geometry/support/Ellipsoid.js";import{OpaqueEnvironment as d}from"../OpaqueEnvironment.js";import{computeInnerAltitudeFade as u,innerAtmosphereDepth as l}from"./atmosphereUtils.js";import{ChapmanAtmospherePassParameters as f,ChapmanAtmosphereTechnique as b}from"./ChapmanAtmosphereTechnique.js";import{createQuadVAO as g}from"../../lib/glUtil3D.js";import{applyTextureResizeModulo as _}from"../../lib/textureUtils.js";import{A as P}from"../../../../../chunks/AtmosphereCompositing.glsl.js";import{AtmosphereCompositingTechnique as w}from"../../shaders/AtmosphereCompositingTechnique.js";import{DepthStencilAttachment as v,ColorAttachment0 as j,PrimitiveType as A}from"../../../../webgl/enums.js";import x from"../../../../../webscene/background/ColorBackground.js";let C=class extends d{constructor(){super(...arguments),this._compositingPassParameters=new P,this._vao=null,this._passParameters=new f}initialize(){this.addHandles([s(()=>this.view.environment.background,e=>{const t=e instanceof x?e.color.toUnitRGBA():p;m(this._passParameters.backgroundColor,t[0]*t[3],t[1]*t[3],t[2]*t[3])},i),s(()=>this.view.stage?.renderer?.highResolutionAtmosphere,e=>this._passParameters.reduced=!e,i),s(()=>this.view.map.ground.undergroundColor,e=>{this._passParameters.undergroundColor=e?.toUnitRGBA()??p,this.requestRender(1)},a),s(()=>this.view.environment.atmosphereEnabled,e=>e?this._enable():this._disable(),i)])}destroy(){this._vao=r(this._vao)}render(){const e=this.input;if(!this.bindParameters.mainDepth)return e;const r=this.renderingContext;this._vao??=g(r,1);const s=e.getAttachment(v);this._update();const i=this.techniques.getCompiled(b),a=this.techniques.getCompiled(w);if(!i||!a)return this.requestRender(1),e;if(!this._passParameters.reduced)return e.detachDepth(),r.bindFramebuffer(e.fbo),r.bindTechnique(i,this.bindParameters,this._passParameters),r.setDrawBuffers([j]),r.bindVAO(this._vao),r.drawArrays(A.TRIANGLE_STRIP,0,4),e.attachDepth(s),e;const o=r.getViewport(),n=this.bindParameters.camera,m=h(n.eye)-c.radius;let p;const d=c.atmosphereHeight;if(m<d){const e=Math.min(1,Math.max(0,m/d));p=t(.2,.3,e)}else{const e=Math.min(1,Math.max(0,(m-d)/(15*d)));p=t(.3,.6,e)}const u=this.renderingContext.parameters.maxTextureSize,l=_(Math.round(p*n.fullViewport[2]),u),f=_(Math.round(p*n.fullViewport[3]),u);r.setViewport(0,0,l,f);const P=this.fboCache.acquire(l,f,"chapman",5);return r.bindFramebuffer(P.fbo),r.clearFramebuffer([0,0,0,1],!0,!0),r.bindTechnique(i,this.bindParameters,this._passParameters),r.bindVAO(this._vao),r.drawArrays(A.TRIANGLE_STRIP,0,4),r.setViewport(o.x,o.y,o.width,o.height),this._compositingPassParameters.color=P.getTexture(),e.detachDepth(),r.bindFramebuffer(e.fbo),r.bindTechnique(a,this.bindParameters,this._compositingPassParameters),r.setDrawBuffers([j]),r.screen.draw(),e.attachDepth(s),P.release(),e}_update(){const e=this.view.basemapTerrain?.getLowerBoundRadius()??0;n(this._passParameters.radii,e,e+c.atmosphereHeight);const t=h(this.bindParameters.camera.eye);this._passParameters.altitudeFade=u(t-e),this._passParameters.innerFadeDistance=2*Math.sqrt((2*e-l)*l)}};C=e([o("esri.views.3d.webgl-engine.effects.atmosphere.ChapmanAtmosphere")],C);export{C as ChapmanAtmosphere};
2
+ import{__decorate as e}from"tslib";import{lerp as t}from"../../../../../core/mathUtils.js";import{disposeMaybe as r}from"../../../../../core/maybe.js";import{watch as s,syncAndInitial as i,initial as a}from"../../../../../core/reactiveUtils.js";import{subclass as o}from"../../../../../core/accessorSupport/decorators.js";import{set as n}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{set as m,length as h}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{ZEROS as p}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{earth as c}from"../../../../../geometry/support/Ellipsoid.js";import{OpaqueEnvironment as d}from"../OpaqueEnvironment.js";import{computeInnerAltitudeFade as u,innerAtmosphereDepth as l}from"./atmosphereUtils.js";import{ChapmanAtmospherePassParameters as f,ChapmanAtmosphereTechnique as b}from"./ChapmanAtmosphereTechnique.js";import{createQuadVAO as g}from"../../lib/glUtil3D.js";import{applyTextureResizeModulo as _}from"../../lib/textureUtils.js";import{A as P}from"../../../../../chunks/AtmosphereCompositing.glsl.js";import{AtmosphereCompositingTechnique as w}from"../../shaders/AtmosphereCompositingTechnique.js";import{DepthStencilAttachment as v,ColorAttachment0 as j,PrimitiveType as A}from"../../../../webgl/enums.js";import x from"../../../../../webscene/background/ColorBackground.js";let C=class extends d{constructor(){super(...arguments),this._compositingPassParameters=new P,this._vao=null,this._passParameters=new f}initialize(){this.addHandles([s(()=>this.view.environment.background,e=>{const t=e instanceof x?e.color.toUnitRGBA():p;m(this._passParameters.backgroundColor,t[0]*t[3],t[1]*t[3],t[2]*t[3])},i),s(()=>this.view.stage?.renderer?.highResolutionAtmosphere,e=>this._passParameters.reduced=!e,i),s(()=>this.view.map.ground.undergroundColor,e=>{this._passParameters.undergroundColor=e?.toUnitRGBA()??p,this.requestRender(1)},a),s(()=>this.view.environment.atmosphereEnabled,e=>e?this._enable():this._disable(),i)])}destroy(){this._vao=r(this._vao)}render(){const e=this.input;if(!this.bindParameters.mainDepth)return e;const r=this.renderingContext;this._vao??=g(r,1);const s=e.getAttachment(v);this._update();const i=this.techniques.getCompiled(b),a=this.techniques.getCompiled(w);if(!i||!a)return this.requestRender(1),e;if(!this._passParameters.reduced)return e.detachDepth(),r.bindFramebuffer(e.fbo),r.bindTechnique(i,this.bindParameters,this._passParameters),r.setDrawBuffers([j]),r.bindVAO(this._vao),r.drawArrays(A.TRIANGLE_STRIP,0,4),e.attachDepth(s),e;const o=r.getViewport(),n=this.bindParameters.camera,m=h(n.eye)-c.radius;let p;const d=c.atmosphereHeight;if(m<d){const e=Math.min(1,Math.max(0,m/d));p=t(.2,.3,e)}else{const e=Math.min(1,Math.max(0,(m-d)/(15*d)));p=t(.3,.6,e)}const u=this.renderingContext.parameters.maxTextureSize,l=_(Math.round(p*n.fullViewport[2]),u),f=_(Math.round(p*n.fullViewport[3]),u);r.setViewport(0,0,l,f);const P=this.fboCache.acquire(l,f,"chapman");return r.bindFramebuffer(P.fbo),r.clearFramebuffer([0,0,0,1],!0,!0),r.bindTechnique(i,this.bindParameters,this._passParameters),r.bindVAO(this._vao),r.drawArrays(A.TRIANGLE_STRIP,0,4),r.setViewport(o.x,o.y,o.width,o.height),this._compositingPassParameters.color=P.getTexture(),e.detachDepth(),r.bindFramebuffer(e.fbo),r.bindTechnique(a,this.bindParameters,this._compositingPassParameters),r.setDrawBuffers([j]),r.screen.draw(),e.attachDepth(s),P.release(),e}_update(){const e=this.view.basemapTerrain?.getLowerBoundRadius()??0;n(this._passParameters.radii,e,e+c.atmosphereHeight);const t=h(this.bindParameters.camera.eye);this._passParameters.altitudeFade=u(t-e),this._passParameters.innerFadeDistance=2*Math.sqrt((2*e-l)*l)}};C=e([o("esri.views.3d.webgl-engine.effects.atmosphere.ChapmanAtmosphere")],C);export{C as ChapmanAtmosphere};