@arcgis/core 5.2.0-next.43 → 5.2.0-next.45

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 (207) hide show
  1. package/assets/esri/core/workers/RemoteClient.js +1 -1
  2. package/assets/esri/core/workers/chunks/0115681a3de6df0aebdf.js +1 -0
  3. package/assets/esri/core/workers/chunks/025caafc70ac26f0a4ed.js +1 -0
  4. package/assets/esri/core/workers/chunks/{9de18cea5780319302cb.js → 04a167c110fb7811169d.js} +1 -1
  5. package/assets/esri/core/workers/chunks/{72fe7fb03c156f26a589.js → 08e18fb12533fc76e49c.js} +1 -1
  6. package/assets/esri/core/workers/chunks/{60e8524d324fd14444d7.js → 0a0732ba8271d7dc985c.js} +1 -1
  7. package/assets/esri/core/workers/chunks/0e64e20fedfe01a1985f.js +1 -0
  8. package/assets/esri/core/workers/chunks/{e6b5c015205d38abe037.js → 127b111ee53e4b9184f8.js} +1 -1
  9. package/assets/esri/core/workers/chunks/15351354afcbf840a23d.js +29 -0
  10. package/assets/esri/core/workers/chunks/{2d7cfc68a38dabd8898a.js → 176c5eaaa23a479c88e0.js} +1 -1
  11. package/assets/esri/core/workers/chunks/1d1f5578c7d8619f7a46.js +1 -0
  12. package/assets/esri/core/workers/chunks/268637fd6c50264acfc3.js +1 -0
  13. package/assets/esri/core/workers/chunks/296fa9fb80e521c30cb1.js +1 -0
  14. package/assets/esri/core/workers/chunks/{d7775ed1402946e414ef.js → 2974cddb0b0f67df7d2d.js} +1 -1
  15. package/assets/esri/core/workers/chunks/2c0d92c0e3511775401a.js +29 -0
  16. package/assets/esri/core/workers/chunks/{ce2320e7b9c4ca96ff27.js → 3252da57b800356116af.js} +1 -1
  17. package/assets/esri/core/workers/chunks/{fd47ee8598e37fea03fe.js → 384b619854ef8a3f6e94.js} +1 -1
  18. package/assets/esri/core/workers/chunks/3af923abeb6e65c4468f.js +1 -0
  19. package/assets/esri/core/workers/chunks/{20fefb9278501781de14.js → 3f4f1595c8a77d072b04.js} +1 -1
  20. package/assets/esri/core/workers/chunks/4f09f208ece2ec1db727.js +1 -0
  21. package/assets/esri/core/workers/chunks/{f1f3fe9d2d96578f4f6b.js → 52efa4ded11c1e71f04f.js} +1 -1
  22. package/assets/esri/core/workers/chunks/{57a1e2b716b74f0124f7.js → 549295a5db9bf1536491.js} +1 -1
  23. package/assets/esri/core/workers/chunks/{284e88805184334396fe.js → 57374213084bef59b776.js} +1 -1
  24. package/assets/esri/core/workers/chunks/{2a8d791aef3123e6a3c4.js → 57970d43cdcc5cf57a30.js} +1 -1
  25. package/assets/esri/core/workers/chunks/5f9c4dad6952c4c58ebf.js +1 -0
  26. package/assets/esri/core/workers/chunks/706230b70a36d2e038f7.js +1 -0
  27. package/assets/esri/core/workers/chunks/{4063ea53cba3dd897e53.js → 728ea88e7d4733230e1f.js} +71 -72
  28. package/assets/esri/core/workers/chunks/{e2f45990d8459d14cb90.js → 76713b700e053f8bad29.js} +1 -1
  29. package/assets/esri/core/workers/chunks/{d082de5dd83bd73d209b.js → 8026cc0065f6520c4161.js} +1 -1
  30. package/assets/esri/core/workers/chunks/93e705c1147cc8ceca02.js +1 -0
  31. package/assets/esri/core/workers/chunks/a8033e606b2db1ee332d.js +1 -0
  32. package/assets/esri/core/workers/chunks/{7684f0c771d312e05bb4.js → ad5c2b0de6713d0a93a4.js} +58 -58
  33. package/assets/esri/core/workers/chunks/{9b1199104a6822ab7340.js → ae9f9e975d7a9d442fa5.js} +1 -1
  34. package/assets/esri/core/workers/chunks/{6f408397e2c8a2ea9805.js → aea247138617e12b699b.js} +1 -1
  35. package/assets/esri/core/workers/chunks/{26e7884d8639df4d994b.js → b03dcf3d55266745f3d1.js} +1 -1
  36. package/assets/esri/core/workers/chunks/b3cd17daf5a297b96705.js +29 -0
  37. package/assets/esri/core/workers/chunks/{c0637d1c9337a6ba46b0.js → b3cefc1895bfd62fc440.js} +1 -1
  38. package/assets/esri/core/workers/chunks/{89682d9d4f606f82056b.js → bac4d4a9f3a9b7f6864d.js} +2 -2
  39. package/assets/esri/core/workers/chunks/{2f29f08cddd5add9388e.js → c01a121ebe571a848452.js} +1 -1
  40. package/assets/esri/core/workers/chunks/c3cd38ca8690286d40d7.js +1 -0
  41. package/assets/esri/core/workers/chunks/{c1845682cc9a5aac8703.js → c4b13124a9cfc78c42a6.js} +6 -6
  42. package/assets/esri/core/workers/chunks/c5e36544b2d1792e4c5f.js +1 -0
  43. package/assets/esri/core/workers/chunks/c6042825f61cd70d54d8.js +1 -0
  44. package/assets/esri/core/workers/chunks/{0646524250bb9fe82935.js → d8b67ca02cdc1e8191e3.js} +1 -1
  45. package/assets/esri/core/workers/chunks/db416ba3132034e20642.js +1 -0
  46. package/assets/esri/core/workers/chunks/{96d5fed0235558c0e348.js → e9c48630757bea465b7e.js} +1 -1
  47. package/assets/esri/core/workers/chunks/{e9511627418c6864148a.js → ed988360264574cd8f6b.js} +1 -1
  48. package/assets/esri/core/workers/chunks/f9b2727b41943d83d4ca.js +1 -0
  49. package/assets/esri/core/workers/chunks/{d45e30f15142b5861111.js → fc880b275f5eaf42171e.js} +1 -1
  50. package/assets/esri/libs/basisu/basis_encoder.wasm +0 -0
  51. package/assets/esri/libs/dxtEncoder/dxt_encoder.wasm +0 -0
  52. package/chunks/CutFillComposition.glsl.js +2 -2
  53. package/chunks/CutFillReduction.glsl.js +1 -1
  54. package/chunks/EmissionComposite.glsl.js +2 -0
  55. package/chunks/FocusAreaColor.glsl.js +1 -1
  56. package/chunks/Fog.glsl.js +20 -20
  57. package/chunks/GlobalIllumination.glsl.js +25 -25
  58. package/chunks/GlobalIlluminationBlur.glsl.js +1 -1
  59. package/chunks/GlowBlur.glsl.js +16 -18
  60. package/chunks/GlowComposite.glsl.js +35 -0
  61. package/chunks/Laserline.glsl.js +13 -13
  62. package/chunks/LaserlinePath.glsl.js +11 -10
  63. package/chunks/OITAddEmission.glsl.js +1 -1
  64. package/chunks/Precipitation.glsl.js +6 -6
  65. package/chunks/ShadowCastVisualize.glsl.js +2 -2
  66. package/chunks/ShadowHighlight.glsl.js +3 -3
  67. package/chunks/Viewshed.glsl.js +3 -3
  68. package/chunks/basis_encoder.js +1 -1
  69. package/chunks/dxt_encoder.js +1 -1
  70. package/config.js +1 -1
  71. package/core/screenUtils.js +1 -1
  72. package/core/types.d.ts +7 -0
  73. package/geometry/support/aaBoundingBox.js +1 -1
  74. package/geometry/support/frustum.js +1 -1
  75. package/kernel.js +1 -1
  76. package/layers/VoxelWasmPerSceneView.js +1 -1
  77. package/package.json +2 -2
  78. package/support/revision.js +1 -1
  79. package/views/2d/engine/webgl/Painter.js +1 -1
  80. package/views/2d/webglDeps.js +1 -1
  81. package/views/3d/environment/CloudyWeather.js +1 -1
  82. package/views/3d/environment/FoggyWeather.js +1 -1
  83. package/views/3d/environment/RainyWeather.js +1 -1
  84. package/views/3d/environment/SnowyWeather.js +1 -1
  85. package/views/3d/environment/SunnyWeather.js +1 -1
  86. package/views/3d/input/SceneInputManager.js +1 -1
  87. package/views/3d/layers/I3SMeshView3D.js +1 -1
  88. package/views/3d/layers/i3s/I3SGeometryUtil.js +1 -1
  89. package/views/3d/layers/i3s/I3SIndex.js +1 -1
  90. package/views/3d/layers/i3s/I3SIntersectionHandler.js +1 -1
  91. package/views/3d/layers/i3s/I3SMeshViewFilter.js +1 -1
  92. package/views/3d/layers/i3s/I3SUtil.js +1 -1
  93. package/views/3d/layers/i3s/PointCloudRenderer.js +1 -1
  94. package/views/3d/layers/support/Tiles3DMeshIntersectionHandler.js +1 -1
  95. package/views/3d/support/debugFlags.js +1 -1
  96. package/views/3d/support/gaussianSplatting/GaussianSplatIntersectionHandler.js +1 -1
  97. package/views/3d/support/hitTest.js +1 -1
  98. package/views/3d/support/intersectionHitUtils.js +2 -0
  99. package/views/3d/terrain/TerrainRenderer.js +1 -1
  100. package/views/3d/webgl-engine/Stage.js +1 -1
  101. package/views/3d/webgl-engine/collections/Component/ComponentObject.js +1 -1
  102. package/views/3d/webgl-engine/collections/Component/ComponentObjectCollection.js +1 -1
  103. package/views/3d/webgl-engine/collections/Component/ComponentObjectElevationAgnosticBVH.js +1 -1
  104. package/views/3d/webgl-engine/collections/Component/ComponentObjectElevationAgnosticComponentGeometryBVH.js +1 -1
  105. package/views/3d/webgl-engine/collections/Component/ComponentObjectFixedBVH.js +1 -1
  106. package/views/3d/webgl-engine/collections/Component/ElevationAgnosticBVH.js +1 -1
  107. package/views/3d/webgl-engine/collections/Component/IntersectionGeometry.js +1 -1
  108. package/views/3d/webgl-engine/collections/Component/Material/ComponentData.glsl.js +12 -12
  109. package/views/3d/webgl-engine/collections/Component/Transform.js +1 -1
  110. package/views/3d/webgl-engine/collections/Component/UniformComponentParameters.js +1 -1
  111. package/views/3d/webgl-engine/core/FBOCache.js +1 -1
  112. package/views/3d/webgl-engine/core/shaderLibrary/ScreenSpacePass.glsl.js +2 -2
  113. package/views/3d/webgl-engine/core/shaderLibrary/output/getEmissions.glsl.js +8 -0
  114. package/views/3d/webgl-engine/core/shaderLibrary/util/blendEmission.glsl.js +2 -0
  115. package/views/3d/webgl-engine/effects/atmosphere/ChapmanAtmosphere.js +1 -1
  116. package/views/3d/webgl-engine/effects/debug/RenderNodeVisualizerNode.js +1 -1
  117. package/views/3d/webgl-engine/effects/focusArea/FocusAreaVisualization.js +1 -1
  118. package/views/3d/webgl-engine/effects/fog/Fog.glsl.js +1 -1
  119. package/views/3d/webgl-engine/effects/fog/Fog.js +1 -1
  120. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIllumination.glsl.js +1 -1
  121. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIllumination.js +1 -1
  122. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIlluminationBlur.glsl.js +1 -1
  123. package/views/3d/webgl-engine/effects/glow/Glow.js +1 -1
  124. package/views/3d/webgl-engine/effects/glow/GlowBlur.glsl.js +1 -1
  125. package/views/3d/webgl-engine/effects/glow/GlowComposite.glsl.js +2 -0
  126. package/views/3d/webgl-engine/effects/glow/GlowCompositeTechnique.js +2 -0
  127. package/views/3d/webgl-engine/effects/haze/Haze.js +1 -1
  128. package/views/3d/webgl-engine/effects/highlight/ShadowHighlight.glsl.js +1 -1
  129. package/views/3d/webgl-engine/effects/highlight/ShadowHighlight.js +1 -1
  130. package/views/3d/webgl-engine/effects/laserlines/LaserLineRenderer.js +1 -1
  131. package/views/3d/webgl-engine/effects/laserlines/Laserline.glsl.js +1 -1
  132. package/views/3d/webgl-engine/effects/laserlines/LaserlinePath.glsl.js +1 -1
  133. package/views/3d/webgl-engine/effects/laserlines/LaserlinePathTechniqueConfiguration.js +1 -1
  134. package/views/3d/webgl-engine/effects/precipitation/Precipitation.js +1 -1
  135. package/views/3d/webgl-engine/effects/precipitation/PrecipitationTechniqueConfiguration.js +1 -1
  136. package/views/3d/webgl-engine/effects/transparency/OITAddEmission.glsl.js +1 -1
  137. package/views/3d/webgl-engine/effects/transparency/OITBlend.js +1 -1
  138. package/views/3d/webgl-engine/effects/transparency/OITBlendFragmentTechniqueConfiguration.js +1 -1
  139. package/views/3d/webgl-engine/effects/transparency/oitBlendFragment.glsl.js +1 -1
  140. package/views/3d/webgl-engine/lib/CutFillComputation.js +1 -1
  141. package/views/3d/webgl-engine/lib/CutFillVisualization.js +1 -1
  142. package/views/3d/webgl-engine/lib/EmissionComposite.glsl.js +2 -0
  143. package/views/3d/webgl-engine/lib/EmissionComposite.js +2 -0
  144. package/views/3d/webgl-engine/lib/EmissionCompositeTechnique.js +2 -0
  145. package/views/3d/webgl-engine/lib/HUDIntersectorResult.js +1 -1
  146. package/views/3d/webgl-engine/lib/Intersector.js +1 -1
  147. package/views/3d/webgl-engine/lib/IntersectorResult.js +1 -1
  148. package/views/3d/webgl-engine/lib/MainFramebuffer.js +1 -1
  149. package/views/3d/webgl-engine/lib/PolygonIntersectionResults.js +1 -1
  150. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  151. package/views/3d/webgl-engine/lib/ShadowCastRenderer.js +1 -1
  152. package/views/3d/webgl-engine/lib/SortedRenderGeometryRenderer.js +1 -1
  153. package/views/3d/webgl-engine/lib/TriangleIntersectionData.js +1 -1
  154. package/views/3d/webgl-engine/lib/Viewshed.js +1 -1
  155. package/views/3d/webgl-engine/lib/intersectorUtilsConversions.js +1 -1
  156. package/views/3d/webgl-engine/lib/lodRendering/LodResources.js +1 -1
  157. package/views/3d/webgl-engine/lib/screenPolygonOverlapUtils.js +1 -1
  158. package/views/3d/webgl-engine/lib/screenPolygonTriangleIntersections.js +1 -1
  159. package/views/3d/webgl-engine/parts/RenderView.js +1 -1
  160. package/views/3d/webgl-engine/shaders/CutFillComposition.glsl.js +1 -1
  161. package/views/3d/webgl-engine/shaders/EmissiveTechniqueConfiguration.js +2 -0
  162. package/views/3d/webgl-engine/shaders/GaussianSplatCompositionTechniqueConfiguration.js +1 -1
  163. package/views/3d/webgl-engine/shaders/OutputColorHighlightOLID.glsl.js +2 -2
  164. package/views/3d/webgl-engine/shaders/ViewshedTechnique.js +1 -1
  165. package/views/3d/webgl-engine/shaders/{oitResolution.glsl.js → floatBlendScale.glsl.js} +1 -1
  166. package/views/SceneView.d.ts +4 -3
  167. package/views/SceneView.js +1 -1
  168. package/views/input/BrowserEventSource.js +1 -1
  169. package/views/input/InputManager.js +1 -1
  170. package/views/support/TextureCompressionWorker.js +1 -1
  171. package/views/support/TextureCompressionWorkerHandle.js +1 -1
  172. package/views/support/imageReprojection.js +1 -1
  173. package/views/webgl/Texture.js +1 -1
  174. package/widgets/Sketch/SketchViewModel.js +1 -1
  175. package/assets/esri/core/workers/chunks/0d6afba80d2f8dcb5cf7.js +0 -1
  176. package/assets/esri/core/workers/chunks/1276df03201c1b855fee.js +0 -1
  177. package/assets/esri/core/workers/chunks/23570397304969f724b3.js +0 -1
  178. package/assets/esri/core/workers/chunks/34fcb776e4de1d870bbd.js +0 -30
  179. package/assets/esri/core/workers/chunks/474ea8c97d101e41b3f5.js +0 -1
  180. package/assets/esri/core/workers/chunks/7cb0681cc6a5e956cb15.js +0 -1
  181. package/assets/esri/core/workers/chunks/8b73694d5a97638a3a61.js +0 -1
  182. package/assets/esri/core/workers/chunks/8dee03779b569f233daf.js +0 -1
  183. package/assets/esri/core/workers/chunks/9ebc98746b1f085b82b7.js +0 -1
  184. package/assets/esri/core/workers/chunks/9ee3741eef73f3edb18b.js +0 -1
  185. package/assets/esri/core/workers/chunks/af97e19516dbbcfb5286.js +0 -1
  186. package/assets/esri/core/workers/chunks/b4047333265a2665aef9.js +0 -1
  187. package/assets/esri/core/workers/chunks/ca419858910af5505d3d.js +0 -1
  188. package/assets/esri/core/workers/chunks/cce83896093279c70449.js +0 -1
  189. package/assets/esri/core/workers/chunks/d5561dff043789494845.js +0 -1
  190. package/assets/esri/core/workers/chunks/dedf678490572c500a19.js +0 -30
  191. package/assets/esri/core/workers/chunks/e2c9393bec747f7876bb.js +0 -1
  192. package/assets/esri/core/workers/chunks/e94f2d6037fba042dc6e.js +0 -1
  193. package/assets/esri/core/workers/chunks/ec1a2e68957fae48e60b.js +0 -30
  194. package/assets/esri/core/workers/chunks/f5d7f69047e1b1116202.js +0 -1
  195. package/chunks/GlowComposition.glsl.js +0 -39
  196. package/views/2d/engine/webgl/MaterialManager.js +0 -2
  197. package/views/2d/engine/webgl/shaders/MaterialPrograms.js +0 -2
  198. package/views/2d/engine/webgl/shaders/sources/resolver.js +0 -2
  199. package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +0 -2
  200. package/views/3d/webgl-engine/core/shaderLibrary/output/Emissions.glsl.js +0 -9
  201. package/views/3d/webgl-engine/effects/fog/FogTechniqueConfiguration.js +0 -2
  202. package/views/3d/webgl-engine/effects/glow/GlowBlurTechniqueConfiguration.js +0 -2
  203. package/views/3d/webgl-engine/effects/glow/GlowComposition.glsl.js +0 -2
  204. package/views/3d/webgl-engine/effects/glow/GlowCompositionTechnique.js +0 -2
  205. package/views/3d/webgl-engine/effects/glow/GlowCompositionTechniqueConfiguration.js +0 -2
  206. package/views/webgl/ShaderCompiler.js +0 -2
  207. /package/assets/esri/core/workers/chunks/{89682d9d4f606f82056b.js.LICENSE.txt → bac4d4a9f3a9b7f6864d.js.LICENSE.txt} +0 -0
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{copy as t,sub as e}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as n}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as o}from"../../../../../geometry/support/aaBoundingBox.js";import{newDoubleArray as s}from"../../../../../geometry/support/DoubleArray.js";import{ComponentObjectElevationAgnosticComponentGeometryBVH as i,intersectTriangleRangeForComponent as a}from"./ComponentObjectElevationAgnosticComponentGeometryBVH.js";import{ElevationAgnosticBVH as r}from"./ElevationAgnosticBVH.js";import{MeshIntersectionOptions as c,computeInvDir as l,intersectAabbInvDir as m}from"../../lib/RayIntersections.js";import{elevationAlignVertexGlobal as h}from"../../lib/triangleIntersectionUtils.js";class p{constructor(t,e,o,s,i,a,c,l){this.vertexData=t,this.vertexStride=e,this.indexData=o,this._componentData=s,this._componentAabbs3D=i,this.geometryMinZ=a,this.planetCenterZ=c,this.localMode=l,this.maxBspNodeDepth=6,this.minElementCountForBVH=10,this.minBspNodeElementCount=3,this._ray0=u,this._ray1=D,this._invDir=n(),this._componentVerticalOffsets=null,this._verticalOffset=null,this._tolerance=0,this._intersectionOptions=y,this._callback=g,this.rayDirectionC=n(),this._componentIndexMap=null,this._bvh=new r(s.count,this),this.componentIntersectionData=new Array(s.count)}get numComponents(){return this._componentData.count}get minZGlobal(){return this.geometryMinZ-this.planetCenterZ}getAabbs2D(){return this.localMode?this.getAabbs2DLocal():this.getAabbs2DGlobal()}getAabbs2DGlobal(){const{numComponents:t,planetCenterZ:e,minZGlobal:n}=this,o=s(4*t),i=this._componentAabbs3D;for(let s=0;s<t;++s){const t=6*s,a=i[t+0],r=i[t+1],c=i[t+2],l=i[t+3],m=i[t+4],h=n/(c-e),p=n/(i[t+5]-e),b=Math.min(a*h,a*p),_=Math.min(r*h,r*p),f=Math.max(l*h,l*p),u=Math.max(m*h,m*p),D=4*s;o[D+0]=b,o[D+1]=_,o[D+2]=f,o[D+3]=u}return o}getAabbs2DLocal(){const{numComponents:t}=this,e=s(4*t),n=this._componentAabbs3D;for(let o=0;o<t;++o){const t=6*o,s=n[t+0],i=n[t+1],a=n[t+3],r=n[t+4],c=4*o;e[c+0]=s,e[c+1]=i,e[c+2]=a,e[c+3]=r}return e}intersectRay(t,e,n,o,s,i){const{isVerticalRay:a}=n;this._ray0=t,this._ray1=e,this._componentVerticalOffsets=s??null,this._verticalOffset=i??null,this._tolerance=n.tolerance,this._intersectionOptions=n,this._componentIndexMap=this._bvh.elementIndexMap,l(t,e,this._invDir),this._callback=o,this._bvh.intersectRay(t,e,a),this._callback=g}intersectRange(t,e){const n=this._componentIndexMap,o=this._componentData;for(let s=t;s<e;++s){const t=n?n[s]:s;o.isPickable(t)&&o.isVisible(t)&&this._intersectComponent(t)}}getComponentTriangleCount(t){const e=this._componentData.offsets,n=e[t]/3;return e[t+1]/3-n}getComponentAabb3D(t,e){const n=this._componentAabbs3D,o=6*t;return e[0]=n[o],e[1]=n[o+1],e[2]=n[o+2],e[3]=n[o+3],e[4]=n[o+4],e[5]=n[o+5],e}_intersectComponent(n){const o=this.getComponentAabb3D(n,b);let s=!1;const{localMode:r,_componentVerticalOffsets:c,_verticalOffset:l,_ray0:p,_ray1:u,_invDir:D,planetCenterZ:g,_tolerance:y,rayDirectionC:v,componentIntersectionData:x}=this,{isVerticalRay:A}=this._intersectionOptions,d=this._componentData.offsets,M=t(_,p),O=t(f,u),j=c?.[n]??0,V=j+(l?.offset??0);if(0!==V&&(r?(M[2]=p[2]-V,O[2]=u[2]-V,s=!0):(null!=l&&(l.componentOffset=j),A&&(h(M,-V,g,p),h(O,-V,g,u),s=!0))),null==l||s||0===V||l.applyToAabb(o),!m(o,M,D,y))return;e(v,O,M);const Z=d[n]/3,I=d[n+1]/3,R=I-Z,B=(t,e,o)=>this._callback(t,o,n,e),{vertexData:k,vertexStride:G,indexData:w,_intersectionOptions:E}=this,{normalRequired:H}=E;if(R>C){let t=x[n];null==t&&(t=new i(n,k,G,w,Z,I,this.geometryMinZ,g,r),x[n]=t),t.intersectRay(M,O,A,s?0:V,B,H)}else{a(M,v,Z,I,w,k,G,s?0:V,g,H,B)}}}const b=o(),_=n(),f=n(),u=n(),D=n(),g=()=>{},y=new c,C=40;export{p as ComponentObjectElevationAgnosticComponentBVH};
2
+ import{copy as t,sub as e}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as n}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as o,copy as s,expandWithAABB as i}from"../../../../../geometry/support/aaBoundingBox.js";import{newDoubleArray as r}from"../../../../../geometry/support/DoubleArray.js";import{intersectsTransformedAabb as a}from"../../../../../geometry/support/frustum.js";import{intersectTriangleRangeForComponent as l,intersectTriangleRangeScreenPolygonForComponent as c,ComponentObjectElevationAgnosticComponentGeometryBVH as h}from"./ComponentObjectElevationAgnosticComponentGeometryBVH.js";import{ElevationAgnosticBVH as m}from"./ElevationAgnosticBVH.js";import{MeshIntersectionOptions as p,computeInvDir as _,intersectAabbInvDir as f}from"../../lib/RayIntersections.js";import{elevationAlignVertexGlobal as b}from"../../lib/triangleIntersectionUtils.js";class u{constructor(t,e,o,s,i,r,a,l){this.vertexData=t,this.vertexStride=e,this.indexData=o,this._componentData=s,this._componentAabbs3D=i,this.geometryMinZ=r,this.planetCenterZ=a,this.localMode=l,this.maxBspNodeDepth=6,this.minElementCountForBVH=10,this.minBspNodeElementCount=3,this._ray0=P,this._ray1=v,this._invDir=n(),this._componentVerticalOffsets=null,this._verticalOffset=null,this._tolerance=0,this._intersectionOptions=I,this._callback=A,this._screenPolygonCallback=O,this._screenPolygonIntersector=null,this._screenPolygonQuery=null,this._screenPolygonTransformation=null,this._localModeOffsetDisplacement=new S,this._nodeAabbs3D=null,this.rayDirectionC=n(),this._intersectComponent=A,this._componentIndexMap=null,this._bvh=new m(s.count,this),this.componentIntersectionData=new Array(s.count)}get numComponents(){return this._componentData.count}get minZGlobal(){return this.geometryMinZ-this.planetCenterZ}getAabbs2D(){return this.localMode?this.getAabbs2DLocal():this.getAabbs2DGlobal()}getAabbs2DGlobal(){const{numComponents:t,planetCenterZ:e,minZGlobal:n}=this,o=r(4*t),s=this._componentAabbs3D;for(let i=0;i<t;++i){const t=6*i,r=s[t+0],a=s[t+1],l=s[t+2],c=s[t+3],h=s[t+4],m=n/(l-e),p=n/(s[t+5]-e),_=Math.min(r*m,r*p),f=Math.min(a*m,a*p),b=Math.max(c*m,c*p),u=Math.max(h*m,h*p),y=4*i;o[y+0]=_,o[y+1]=f,o[y+2]=b,o[y+3]=u}return o}getAabbs2DLocal(){const{numComponents:t}=this,e=r(4*t),n=this._componentAabbs3D;for(let o=0;o<t;++o){const t=6*o,s=n[t+0],i=n[t+1],r=n[t+3],a=n[t+4],l=4*o;e[l+0]=s,e[l+1]=i,e[l+2]=r,e[l+3]=a}return e}intersectRay(t,e,n,o,s,i){const{isVerticalRay:r}=n;this._ray0=t,this._ray1=e,this._componentVerticalOffsets=s??null,this._verticalOffset=i??null,this._tolerance=n.tolerance,this._intersectionOptions=n,this._intersectComponent=this._intersectComponentRay,this._componentIndexMap=this._bvh.elementIndexMap,_(t,e,this._invDir),this._callback=o,this._bvh.intersectRay(t,e,r),this._callback=A,this._intersectComponent=A}intersectScreenPolygon(t,e,n,o,s,i){this._componentVerticalOffsets=s??null,this._verticalOffset=i??null,this._screenPolygonIntersector=t,this._screenPolygonQuery=e,this._screenPolygonTransformation=n,this._screenPolygonCallback=o,this._componentIndexMap=this._bvh.elementIndexMap,this._intersectComponent=this._intersectComponentScreenPolygon,this._bvh.intersectNodes((t,e)=>this._intersectScreenPolygonNode(t,e)),this._componentIndexMap=null,this._componentVerticalOffsets=null,this._verticalOffset=null,this._screenPolygonCallback=O,this._screenPolygonTransformation=null,this._screenPolygonQuery=null,this._screenPolygonIntersector=null,this._intersectComponent=A}intersectRange(t,e){this._forEachIntersectableComponent(t,e,t=>{this._intersectComponent(t)})}getComponentTriangleCount(t){const e=this._componentData.offsets,n=e[t]/3;return e[t+1]/3-n}getComponentAabb3D(t,e){const n=this._componentAabbs3D,o=6*t;return e[0]=n[o],e[1]=n[o+1],e[2]=n[o+2],e[3]=n[o+3],e[4]=n[o+4],e[5]=n[o+5],e}_intersectComponentRay(n){const o=this.getComponentAabb3D(n,y);let s=!1;const{localMode:i,_componentVerticalOffsets:r,_verticalOffset:a,_ray0:c,_ray1:h,_invDir:m,planetCenterZ:p,_tolerance:_,rayDirectionC:u}=this,{isVerticalRay:g}=this._intersectionOptions,D=this._componentData.offsets,d=t(C,c),P=t(x,h),v=r?.[n]??0,A=v+(a?.offset??0);if(0!==A&&(i?(d[2]=c[2]-A,P[2]=h[2]-A,s=!0):(null!=a&&(a.componentOffset=v),g&&(b(d,-A,p,c),b(P,-A,p,h),s=!0))),null==a||s||0===A||a.applyToAabb(o),!f(o,d,m,_))return;e(u,P,d);const O=D[n]/3,I=D[n+1]/3,S=I-O,T=(t,e,o)=>this._callback(t,o,n,e),{vertexData:V,vertexStride:R,indexData:N,_intersectionOptions:j}=this,{normalRequired:B}=j;if(S>M){this._getOrCreateComponentGeometryBvh(n,O,I).intersectRay(d,P,g,s?0:A,T,B)}else{l(d,u,O,I,N,V,R,s?0:A,p,B,T)}}_intersectComponentScreenPolygon(t){const e=this._screenPolygonIntersector,n=this._screenPolygonQuery;if(null==e||null==n)return;const o=this.getComponentAabb3D(t,y),{_screenPolygonTransformation:i,_screenPolygonCallback:r,vertexData:l,vertexStride:h,indexData:m}=this,p=this._getScreenPolygonElevationDisplacement(t),_=null!=p?p.applyToAabb(s(g,o)):o;if(!a(n.broadPhaseFrustum,_,i))return;const f=this._componentData.offsets,b=f[t]/3,u=f[t+1]/3;if(u-b>M){return void this._getOrCreateComponentGeometryBvh(t,b,u).intersectScreenPolygon(e,i,n,p,(e,n,o)=>{r(e,n,t,o)})}const D=c(e,i,n,b,u,m,l,h,p);null!=D&&r(D.distance,D.primitiveIndex,t,D.point)}_intersectScreenPolygonNode(t,e){const n=this._screenPolygonQuery;if(null==n)return!1;const o=this._getScreenPolygonNodeAabb(t,e,g),{_screenPolygonTransformation:s}=this;return a(n.broadPhaseFrustum,o,s)}_forEachIntersectableComponent(t,e,n){const o=this._componentIndexMap,s=this._componentData;for(let i=t;i<e;++i){const t=o?o[i]:i;s.isPickable(t)&&s.isVisible(t)&&n(t)}}_getOrCreateComponentGeometryBvh(t,e,n){let o=this.componentIntersectionData[t];return null==o&&(o=new h(t,this.vertexData,this.vertexStride,this.indexData,e,n,this._componentAabbs3D[6*t+2],this._componentAabbs3D[6*t+5],this.geometryMinZ,this.planetCenterZ,this.localMode),this.componentIntersectionData[t]=o),o}_getScreenPolygonElevationDisplacement(t){const e=this._componentVerticalOffsets?.[t]??0;return this._getScreenPolygonDisplacementForOffset(e)}_getScreenPolygonDisplacementForOffset(t){const e=this._verticalOffset;return null!=e?0===t&&0===e.offset?null:(e.componentOffset=t,e):this.localMode&&0!==t?(this._localModeOffsetDisplacement.offset=t,this._localModeOffsetDisplacement):null}_getScreenPolygonNodeAabb(t,e,n){const o=this._getNodeAabb3D(t,e,n),[r,a]=this._getNodeComponentOffsetRange(t);if(r===a)return this._applyScreenPolygonDisplacementToAabb(o,r);const l=this._applyScreenPolygonDisplacementToAabb(s(D,o),r),c=this._applyScreenPolygonDisplacementToAabb(s(d,o),a);return i(l,c,n),n}_applyScreenPolygonDisplacementToAabb(t,e){const n=this._getScreenPolygonDisplacementForOffset(e);return null!=n?n.applyToAabb(t):t}_getNodeAabb3D(t,e,n){const r=this._nodeAabbs3D??=[],a=r[e];if(null!=a)return s(n,a);const l=this._componentIndexMap;let c=!1;for(let o=t.minIndexIndex;o<t.maxIndexIndex;++o){const t=l?l[o]:o,e=this.getComponentAabb3D(t,D);c?i(n,e):(s(n,e),c=!0)}const h=o();return s(h,n),r[e]=h,n}_getNodeComponentOffsetRange(t){const e=this._componentVerticalOffsets;if(null==e)return[0,0];const n=this._componentIndexMap;let o=0,s=0,i=!1;for(let r=t.minIndexIndex;r<t.maxIndexIndex;++r){const t=e[n?n[r]:r]??0;i?(o=Math.min(o,t),s=Math.max(s,t)):(o=t,s=t,i=!0)}return i?[o,s]:[0,0]}}const y=o(),g=o(),D=o(),d=o(),C=n(),x=n(),P=n(),v=n(),A=()=>{},O=()=>{},I=new p,M=40;class S{constructor(){this.offset=0}applyToVertex(t,e,n,o){return t[0]=e,t[1]=n,t[2]=o+this.offset,t}applyToAabb(t){return t[2]+=this.offset,t[5]+=this.offset,t}}export{u as ComponentObjectElevationAgnosticComponentBVH};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{copy as t,sub as e}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as i}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ElevationAgnosticBVH as r}from"./ElevationAgnosticBVH.js";import{intersectRayTrianglesWithVerticalOffsetENUGlobal as s,intersectRayTriangles as a}from"../../lib/RayIntersections.js";import{generateTriangleAabbsLocal as n,generateTriangleAabbsGlobal as h}from"../../lib/triangleIntersectionUtils.js";class l{constructor(t,e,s,a,n,h,l,o,c){this.componentIndex=t,this.vertexData=e,this.vertexStride=s,this.indexData=a,this.startTriangleNumber=n,this.endTriangleNumber=h,this.geometryMinZ=l,this.planetCenterZ=o,this.localMode=c,this.maxBspNodeDepth=8,this.minElementCountForBVH=20,this.minBspNodeElementCount=10,this.rayDirection=i(),this.ray0=i(),this.isVerticalRay=!1,this._triangleHitCallback=m,this.totalElevationOffset=0,this.normalRequired=!1,this._bvh=new r(h-n,this)}getAabbs2D(){return this.localMode?n(this.startTriangleNumber,this.endTriangleNumber,this.indexData,this.vertexData,this.vertexStride):h(this.startTriangleNumber,this.endTriangleNumber,this.indexData,this.vertexData,this.vertexStride,this.geometryMinZ,this.planetCenterZ)}get numTriangles(){return this.endTriangleNumber-this.startTriangleNumber}intersectRay(i,r,s,a,n,h){t(this.ray0,i),e(this.rayDirection,r,i),this.isVerticalRay=s,this.totalElevationOffset=a,this.normalRequired=h,this._triangleHitCallback=n,this._bvh.intersectRay(i,r,s),this._triangleHitCallback=m}intersectRange(t,e){const i=this._bvh.elementIndexMap;o(this.ray0,this.rayDirection,t,e,this.indexData,this.vertexData,this.vertexStride,this.totalElevationOffset,this.planetCenterZ,this.normalRequired,this._triangleHitCallback,i,this.startTriangleNumber)}getTriangleElevationOffset(t){return this.totalElevationOffset}}function o(t,e,i,r,n,h,l,o,m,c,g,b=null,u=0){0!==o?s(t,e,i,r,n,h,l,o,m,c,g,b,u):a(t,e,i,r,n,h,l,c,g,b,u)}function m(){}export{l as ComponentObjectElevationAgnosticComponentGeometryBVH,o as intersectTriangleRangeForComponent};
2
+ import{copy as e,sub as t}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as n}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as s,fromValues as i}from"../../../../../geometry/support/aaBoundingBox.js";import{intersectsTransformedAabb as r}from"../../../../../geometry/support/frustum.js";import{ElevationAgnosticBVH as o}from"./ElevationAgnosticBVH.js";import{intersectRayTrianglesWithVerticalOffsetENUGlobal as a,intersectRayTriangles as l}from"../../lib/RayIntersections.js";import{forEachTriangleRangeScreenPolygonHit as h,Hit as c}from"../../lib/screenPolygonTriangleIntersections.js";import{generateTriangleAabbsLocal as m,generateTriangleAabbsGlobal as g}from"../../lib/triangleIntersectionUtils.js";const y=()=>{};class u{constructor(e,t,s,i,r,a,l,h,c,m,g){this.componentIndex=e,this.vertexData=t,this.vertexStride=s,this.indexData=i,this.startTriangleNumber=r,this.endTriangleNumber=a,this.componentMinZ=l,this.componentMaxZ=h,this.geometryMinZ=c,this.planetCenterZ=m,this.localMode=g,this.maxBspNodeDepth=8,this.minElementCountForBVH=20,this.minBspNodeElementCount=10,this.rayDirection=n(),this.ray0=n(),this.isVerticalRay=!1,this._triangleHitCallback=p,this.totalElevationOffset=0,this.normalRequired=!1,this._screenPolygonDisplacement=null,this._screenPolygonIntersector=null,this._screenPolygonQuery=null,this._screenPolygonTransformation=null,this._screenPolygonBestDistance=Number.POSITIVE_INFINITY,this._screenPolygonBestTriangleNumber=-1,this._screenPolygonHasNormal=!1,this._screenPolygonBestNormal=n(),this._screenPolygonBestPoint=n(),this.intersectRange=y,this._bvh=new o(a-r,this)}getAabbs2D(){return this.localMode?m(this.startTriangleNumber,this.endTriangleNumber,this.indexData,this.vertexData,this.vertexStride):g(this.startTriangleNumber,this.endTriangleNumber,this.indexData,this.vertexData,this.vertexStride,this.geometryMinZ,this.planetCenterZ)}get numTriangles(){return this.endTriangleNumber-this.startTriangleNumber}intersectRay(n,s,i,r,o,a){e(this.ray0,n),t(this.rayDirection,s,n),this.isVerticalRay=i,this.totalElevationOffset=r,this.normalRequired=a,this.intersectRange=this._intersectRangeRay,this._triangleHitCallback=o,this._bvh.intersectRay(n,s,i),this._triangleHitCallback=p,this.intersectRange=y}intersectScreenPolygon(e,t,n,s,i){this._screenPolygonIntersector=e,this._screenPolygonTransformation=t,this._screenPolygonQuery=n,this._screenPolygonDisplacement=s,this._screenPolygonBestDistance=Number.POSITIVE_INFINITY,this.intersectRange=this._intersectRangeScreenPolygon,this._bvh.intersectNodes(e=>this._couldIntersectScreenPolygonNode(e)),this._screenPolygonBestDistance<Number.POSITIVE_INFINITY&&i(this._screenPolygonBestDistance,this._screenPolygonBestTriangleNumber,this._screenPolygonBestPoint,this._screenPolygonHasNormal?this._screenPolygonBestNormal:null),this._screenPolygonDisplacement=null,this._screenPolygonQuery=null,this._screenPolygonTransformation=null,this._screenPolygonIntersector=null,this.intersectRange=y}_intersectRangeRay(e,t){const n=this._bvh.elementIndexMap;_(this.ray0,this.rayDirection,e,t,this.indexData,this.vertexData,this.vertexStride,this.totalElevationOffset,this.planetCenterZ,this.normalRequired,this._triangleHitCallback,n,this.startTriangleNumber)}_intersectRangeScreenPolygon(t,n){const{_screenPolygonQuery:s,_screenPolygonIntersector:i}=this;if(!s||!i)return;const r=this._bvh.elementIndexMap,o=P(i,this._screenPolygonTransformation,s,t,n,this.indexData,this.vertexData,this.vertexStride,this._screenPolygonDisplacement,r,this.startTriangleNumber);null!=o&&o.distance<this._screenPolygonBestDistance&&(this._screenPolygonBestDistance=o.distance,this._screenPolygonBestTriangleNumber=o.primitiveIndex,this._screenPolygonHasNormal=o.hasNormal,e(this._screenPolygonBestPoint,o.point),o.hasNormal&&e(this._screenPolygonBestNormal,o.normal))}getTriangleElevationOffset(e){return this.totalElevationOffset}_couldIntersectScreenPolygonNode(e){const t=this._screenPolygonQuery;if(null==t)return!1;const n=this._getNodeAabb3D(e,f);return this._screenPolygonDisplacement?.applyToAabb(n),r(t.broadPhaseFrustum,n,this._screenPolygonTransformation)}_getNodeAabb3D(e,t){const[n,s,r,o]=e.aabb2D;if(this.localMode)return i(n,s,this.componentMinZ,r,o,this.componentMaxZ,t);const a=this.geometryMinZ-this.planetCenterZ,l=(this.componentMinZ-this.planetCenterZ)/a,h=(this.componentMaxZ-this.planetCenterZ)/a,c=n*l,m=n*h,g=r*l,y=r*h,u=s*l,_=s*h,P=o*l,p=o*h;return i(Math.min(c,m,g,y),Math.min(u,_,P,p),this.componentMinZ,Math.max(c,m,g,y),Math.max(u,_,P,p),this.componentMaxZ,t)}}function _(e,t,n,s,i,r,o,h,c,m,g,y=null,u=0){0!==h?a(e,t,n,s,i,r,o,h,c,m,g,y,u):l(e,t,n,s,i,r,o,m,g,y,u)}function P(t,n,s,i,r,o,a,l,c,m=null,g=0){let y=Number.POSITIVE_INFINITY,u=-1,_=!1,P=!1;for(const p of h(t,n,s,i,r,o,a,l,c,m,g))p.distance>=y||(y=p.distance,u=p.primitiveIndex,_=!0,P=p.hasNormal,e(b,p.point),p.hasNormal&&e(N,p.normal));return _?(d.update(y,u,b,P?N:null),d):null}function p(){}const b=n(),N=n(),d=new c(4),f=s();export{u as ComponentObjectElevationAgnosticComponentGeometryBVH,_ as intersectTriangleRangeForComponent,P as intersectTriangleRangeScreenPolygonForComponent};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{Vertices as t}from"../../lib/Attribute.js";import{TriangleIntersectionData as n}from"../../lib/TriangleIntersectionData.js";class e{constructor(e,r,s,o,i){this._componentOffsets=i,this._intersectionData=new n(s,o,new t(e,3,r))}intersectRay(t,n,e,s){const o=(t,n,e)=>{const o=r(this._componentOffsets,e);s(t,e,o,n)};this._intersectionData.intersectRay(t,n,e,o)}}function r(t,n){const{length:e}=t;if(0===e||n<t[0])return-1;if(n>t[e-1])return e;let r=0,s=e-1;for(;s-r>1;){const e=Math.round(.5*(r+s));n<=t[e]?s=e:r=e}return r}export{e as ComponentObjectFixedBVH};
2
+ import{Vertices as t}from"../../lib/Attribute.js";import{TriangleIntersectionData as n}from"../../lib/TriangleIntersectionData.js";class e{constructor(e,o,s,i,r){this._componentOffsets=r,this._intersectionData=new n(s,i,new t(e,3,o))}intersectRay(t,n,e,s){const i=(t,n,e)=>{const i=o(this._componentOffsets,e);s(t,e,i,n)};this._intersectionData.intersectRay(t,n,e,i)}intersectScreenPolygon(t,n,e,s){this._intersectionData.forEachScreenPolygonHit(t,e,n,null,(t,n,e)=>{const i=o(this._componentOffsets,n);i<0||i>=this._componentOffsets.length-1||s(t,n,i,e)})}}function o(t,n){const{length:e}=t;if(0===e||n<t[0])return-1;if(n>t[e-1])return e;let o=0,s=e-1;for(;s-o>1;){const e=Math.round(.5*(o+s));n<=t[e]?s=e:o=e}return o}export{e as ComponentObjectFixedBVH};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{clamp as t}from"../../../../../core/mathUtils.js";import{fromValues as e}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as n}from"../../../../../geometry/support/aaBoundingRect.js";import{createUintArray as i}from"../../lib/triangleIntersectionUtils.js";class s{constructor(t,n){this.elementCount=t,this.model=n,this._elementIndexMap=null,this._bspNodes=[],this._generatedBVH=!1,this.localMode=n.localMode,this.planetCenterZ=n.planetCenterZ,this.geometryMinZ=n.geometryMinZ,this.planetCenter=e(0,0,this.planetCenterZ),this.maxBspNodeDepth=n.maxBspNodeDepth??8,this.minElementCountForBVH=n.minElementCountForBVH??15,this.minBspNodeElementCount=n.minBspNodeElementCount??5}get elementIndexMap(){return this._ensureBVH(),this._elementIndexMap}get _skipBVH(){return this.elementCount<this.minElementCountForBVH||this.geometryMinZ<.5*this.planetCenterZ}_ensureBVH(){this._generatedBVH||this._skipBVH||0===this._bspNodes.length&&this._generateBsp()}intersectRay(t,e,n){this.elementCount<1||(this._skipBVH?this._intersectRayWithoutBVH(n):this._intersectRayWithBVH(t,e,n))}_intersectRayWithoutBVH(t){this._intersectRange(0,this.elementCount)}_intersectRange(t,e){this.model.intersectRange(t,e)}_intersectRayWithBVH(t,e,n){this._ensureBVH(),n?this._intersectGeometryWithBVHVerticalRay(t):this._intersectGeometryWithBVHGeneralRay(t,e)}_intersectGeometryWithBVHVerticalRay(t){let e=t[0],n=t[1];if(!this.localMode){const{geometryMinZ:i,planetCenterZ:s}=this,h=(i-s)/(t[2]-s);e=t[0]*h,n=t[1]*h}const{_bspNodes:i}=this;let s=0;for(;s>=0;){const t=i[s],{d:h,dim:a,minIndexIndex:o,minMidIndexIndex:r,maxMidIndexIndex:c,maxIndexIndex:m,aabb2D:d}=t;if(e<d[0]||e>d[2]||n<d[1]||n>d[3])break;if(-1===a||-1===t.child0&&-1===t.child1){this._intersectRange(o,m);break}{this._intersectRange(r,c);const i=(0===a?e:n)-h;if(i<0){if(-1===t.child0){this._intersectRange(o,r);break}s=t.child0}else{if(!(i>0))break;if(-1===t.child1){this._intersectRange(c,m);break}s=t.child1}}}}_intersectGeometryWithBVHGeneralRay(e,n){let i=e[0],s=e[1],h=n[0],a=n[1];const{geometryMinZ:o}=this;if(!this.localMode){let t=0,r=1;const c=Math.min(.5*this.planetCenterZ,o),m=e[2],d=n[2];if(m<c&&d<c)return;if(m<c&&(t=(c-m)/(d-m)),d<c&&(r=(c-m)/(d-m)),t>r)return;const l=(1-t)*e[0]+t*n[0],M=(1-t)*e[1]+t*n[1],u=(1-t)*e[2]+t*n[2],x=(1-r)*e[0]+r*n[0],p=(1-r)*e[1]+r*n[1],f=(1-r)*e[2]+r*n[2],{planetCenterZ:g}=this,_=o-g,B=_/(u-g);i=l*B,s=M*B;const I=_/(f-g);h=x*I,a=p*I}const r=h-i,c=a-s,m=this._bspNodes;let d=1;{const{aabb2D:t}=m[0],e=(t,e,n,i)=>{if(Math.abs(e)<1e-5*Math.max(i-n,1))return!1;const s=e>0,h=s?i:n,a=t+d*e;return(s?a<h:a>h)&&(d=Math.max((h-t)/e,d),!0)},n=()=>e(i,r,t[0],t[2]),h=()=>e(s,c,t[1],t[3]);Math.abs(r)>=Math.abs(c)?n()||h():h()||n()}const l=[0,0,d];let M=0;for(;M<l.length;){const e=l[M];let n=l[M+1],h=l[M+2];if(M+=3,n>h)continue;const a=m[e],{minIndexIndex:o,maxIndexIndex:u}=a,{child0:x,child1:p,minMidIndexIndex:f,maxMidIndexIndex:g,aabb2D:_,d:B,dim:I}=a;{const t=i+n*r,e=i+h*r,s=Math.min(t,e),a=Math.max(t,e),o=_[0],c=_[2];if(a<o||c<s)continue;if(s<o){const t=(o-i)/r;r>0?n=Math.max(n,t):h=Math.min(h,t)}if(c<a){const t=(c-i)/r;r>0?h=Math.min(h,t):n=Math.max(n,t)}}{const t=s+n*c,e=s+h*c,i=Math.min(t,e),a=Math.max(t,e),o=_[1],r=_[3];if(a<o||r<i)continue;if(i<o){const t=(o-s)/c;c>0?n=Math.max(n,t):h=Math.min(h,t)}if(r<a){const t=(r-s)/c;c>0?h=Math.min(h,t):n=Math.max(n,t)}}if(-1===x&&-1===p)this._intersectRange(o,u);else{const e=0===I?i:s,a=0===I?r:c,m=e+n*a,M=e+h*a,_=Math.min(m,M),b=Math.max(m,M),V=t((B-e)/a,0,d);o<f&&_<=B&&(-1!==x?(l.push(x),l.push(a>=0?n:Math.max(n,V)),l.push(a>=0?Math.min(h,V):h)):this._intersectRange(o,f)),this._intersectRange(f,g),g<u&&B<=b&&(-1!==p?(l.push(p),l.push(a>=0?Math.max(n,V):n),l.push(a>=0?h:Math.min(h,V))):this._intersectRange(g,u))}}}_generateBsp(){const{elementCount:t}=this;if(t<1)return;const e=i(t,t);this._elementIndexMap=e;for(let n=0;n<t;++n)e[n]=n;const s=this.model.getAabbs2D();let r=0;const d=this._bspNodes;d.length=0;const{localMode:l}=this;let M=!1;if(!l){const{planetCenterZ:t,geometryMinZ:e}=this;M=t>=0||e<.5*t}const u=[],x=(t,e,n,i,s)=>{u.push(t),u.push(e),u.push(n),u.push(i<0?-1:(s?0:1)+2*i)},{maxBspNodeDepth:p,minBspNodeElementCount:f}=this,g=(t,i,r,u,g)=>{const _=d.length;if(_>0&&(M||r>=p||i-t<f))return;const B=n();c(B,t,i,e,s);const{d:I,dim:b}=l?h(B):a(B),{rangeMidStart:V,rangeMidEnd:R}=o(t,i,b,I,e,s),y=r===p-1,C=!y&&V>=t+f,H=!y&&i>=R+f;if(C||H||0===_){const e=new m(t,V,R,i,b,I,B);if(C&&x(t,V,r+1,_,!0),H&&x(R,i,r+1,_,!1),d.push(e),-1!==u){const t=d[u];g?t.child0=_:t.child1=_}}};for(x(0,t,0,-1,!1);r<u.length;){const t=u[r],e=u[r+1],n=u[r+2],i=u[r+3];r+=4;const s=i>>1;g(t,e,n,s,i-(s<<1)==0)}this._generatedBVH=!0}}function h(t){const e=t[0],n=t[1],i=t[2],s=t[3];let h,a;return i-e>=s-n?(a=.5*(e+i),h=0):(a=.5*(n+s),h=1),{d:a,dim:h}}function a(t){const e=t[0],n=t[1],i=t[2],s=t[3];let h,a;return i-e>=s-n?(h=0,a=.5*(e+i)):(h=1,a=.5*(n+s)),{dim:h,d:a}}function o(t,e,n,i,s,h){let a=t;{let t=e;for(;a<t;){const e=s[a];r(e,n,i,h)<0?++a:(--t,s[a]=s[t],s[t]=e)}}const o=a;let c=a,m=e;for(;c<m;){const t=s[m-1];r(t,n,i,h)>0?--m:(s[m-1]=s[c],s[c]=t,++c)}return{rangeMidStart:o,rangeMidEnd:m}}function r(t,e,n,i){const s=4*t,h=i[s+0+e];return i[s+2+e]<n?-1:h>n?1:0}function c(t,e,n,i,s){let h=1/0,a=1/0,o=-1/0,r=-1/0;for(let c=e;c<n;++c){const t=4*i[c];h=Math.min(h,s[t+0]),a=Math.min(a,s[t+1]),o=Math.max(o,s[t+2]),r=Math.max(r,s[t+3])}t[0]=h,t[1]=a,t[2]=o,t[3]=r}class m{constructor(t,e,n,i,s,h,a){this.minIndexIndex=t,this.minMidIndexIndex=e,this.maxMidIndexIndex=n,this.maxIndexIndex=i,this.dim=s,this.d=h,this.aabb2D=a,this.child0=-1,this.child1=-1}}export{s as ElevationAgnosticBVH};
2
+ import{clamp as t}from"../../../../../core/mathUtils.js";import{fromValues as e}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as n}from"../../../../../geometry/support/aaBoundingRect.js";import{createUintArray as i}from"../../lib/triangleIntersectionUtils.js";class s{constructor(t,n){this.elementCount=t,this.model=n,this._elementIndexMap=null,this._bspNodes=[],this._generatedBVH=!1,this.localMode=n.localMode,this.planetCenterZ=n.planetCenterZ,this.geometryMinZ=n.geometryMinZ,this.planetCenter=e(0,0,this.planetCenterZ),this.maxBspNodeDepth=n.maxBspNodeDepth??8,this.minElementCountForBVH=n.minElementCountForBVH??15,this.minBspNodeElementCount=n.minBspNodeElementCount??5}get elementIndexMap(){return this._ensureBVH(),this._elementIndexMap}get _skipBVH(){return this.elementCount<this.minElementCountForBVH||this.geometryMinZ<.5*this.planetCenterZ}_ensureBVH(){this._generatedBVH||this._skipBVH||0===this._bspNodes.length&&this._generateBsp()}intersectRay(t,e,n){this.elementCount<1||(this._skipBVH?this._intersectRayWithoutBVH(n):this._intersectRayWithBVH(t,e,n))}intersectNodes(t){if(this.elementCount<1)return;if(this._skipBVH)return void this._intersectRange(0,this.elementCount);this._ensureBVH();const e=[0];for(;e.length>0;){const n=e.pop(),i=this._bspNodes[n];if(!t(i,n))continue;const{child0:s,child1:h,minIndexIndex:o,minMidIndexIndex:a,maxMidIndexIndex:r,maxIndexIndex:c}=i;-1!==s||-1!==h?(-1!==s?e.push(s):this._intersectRange(o,a),this._intersectRange(a,r),-1!==h?e.push(h):this._intersectRange(r,c)):this._intersectRange(o,c)}}_intersectRayWithoutBVH(t){this._intersectRange(0,this.elementCount)}_intersectRange(t,e){this.model.intersectRange(t,e)}_intersectRayWithBVH(t,e,n){this._ensureBVH(),n?this._intersectGeometryWithBVHVerticalRay(t):this._intersectGeometryWithBVHGeneralRay(t,e)}_intersectGeometryWithBVHVerticalRay(t){let e=t[0],n=t[1];if(!this.localMode){const{geometryMinZ:i,planetCenterZ:s}=this,h=(i-s)/(t[2]-s);e=t[0]*h,n=t[1]*h}const{_bspNodes:i}=this;let s=0;for(;s>=0;){const t=i[s],{d:h,dim:o,minIndexIndex:a,minMidIndexIndex:r,maxMidIndexIndex:c,maxIndexIndex:d,aabb2D:m}=t;if(e<m[0]||e>m[2]||n<m[1]||n>m[3])break;if(-1===o||-1===t.child0&&-1===t.child1){this._intersectRange(a,d);break}{this._intersectRange(r,c);const i=(0===o?e:n)-h;if(i<0){if(-1===t.child0){this._intersectRange(a,r);break}s=t.child0}else{if(!(i>0))break;if(-1===t.child1){this._intersectRange(c,d);break}s=t.child1}}}}_intersectGeometryWithBVHGeneralRay(e,n){let i=e[0],s=e[1],h=n[0],o=n[1];const{geometryMinZ:a}=this;if(!this.localMode){let t=0,r=1;const c=Math.min(.5*this.planetCenterZ,a),d=e[2],m=n[2];if(d<c&&m<c)return;if(d<c&&(t=(c-d)/(m-d)),m<c&&(r=(c-d)/(m-d)),t>r)return;const l=(1-t)*e[0]+t*n[0],x=(1-t)*e[1]+t*n[1],u=(1-t)*e[2]+t*n[2],p=(1-r)*e[0]+r*n[0],M=(1-r)*e[1]+r*n[1],f=(1-r)*e[2]+r*n[2],{planetCenterZ:_}=this,g=a-_,I=g/(u-_);i=l*I,s=x*I;const B=g/(f-_);h=p*B,o=M*B}const r=h-i,c=o-s,d=this._bspNodes;let m=1;{const{aabb2D:t}=d[0],e=(t,e,n,i)=>{if(Math.abs(e)<1e-5*Math.max(i-n,1))return!1;const s=e>0,h=s?i:n,o=t+m*e;return(s?o<h:o>h)&&(m=Math.max((h-t)/e,m),!0)},n=()=>e(i,r,t[0],t[2]),h=()=>e(s,c,t[1],t[3]);Math.abs(r)>=Math.abs(c)?n()||h():h()||n()}const l=[0,0,m];let x=0;for(;x<l.length;){const e=l[x];let n=l[x+1],h=l[x+2];if(x+=3,n>h)continue;const o=d[e],{minIndexIndex:a,maxIndexIndex:u}=o,{child0:p,child1:M,minMidIndexIndex:f,maxMidIndexIndex:_,aabb2D:g,d:I,dim:B}=o;{const t=i+n*r,e=i+h*r,s=Math.min(t,e),o=Math.max(t,e),a=g[0],c=g[2];if(o<a||c<s)continue;if(s<a){const t=(a-i)/r;r>0?n=Math.max(n,t):h=Math.min(h,t)}if(c<o){const t=(c-i)/r;r>0?h=Math.min(h,t):n=Math.max(n,t)}}{const t=s+n*c,e=s+h*c,i=Math.min(t,e),o=Math.max(t,e),a=g[1],r=g[3];if(o<a||r<i)continue;if(i<a){const t=(a-s)/c;c>0?n=Math.max(n,t):h=Math.min(h,t)}if(r<o){const t=(r-s)/c;c>0?h=Math.min(h,t):n=Math.max(n,t)}}if(-1===p&&-1===M)this._intersectRange(a,u);else{const e=0===B?i:s,o=0===B?r:c,d=e+n*o,x=e+h*o,g=Math.min(d,x),b=Math.max(d,x),R=t((I-e)/o,0,m);a<f&&g<=I&&(-1!==p?(l.push(p),l.push(o>=0?n:Math.max(n,R)),l.push(o>=0?Math.min(h,R):h)):this._intersectRange(a,f)),this._intersectRange(f,_),_<u&&I<=b&&(-1!==M?(l.push(M),l.push(o>=0?Math.max(n,R):n),l.push(o>=0?h:Math.min(h,R))):this._intersectRange(_,u))}}}_generateBsp(){const{elementCount:t}=this;if(t<1)return;const e=i(t,t);this._elementIndexMap=e;for(let n=0;n<t;++n)e[n]=n;const s=this.model.getAabbs2D();let r=0;const m=this._bspNodes;m.length=0;const{localMode:l}=this;let x=!1;if(!l){const{planetCenterZ:t,geometryMinZ:e}=this;x=t>=0||e<.5*t}const u=[],p=(t,e,n,i,s)=>{u.push(t),u.push(e),u.push(n),u.push(i<0?-1:(s?0:1)+2*i)},{maxBspNodeDepth:M,minBspNodeElementCount:f}=this,_=(t,i,r,u,_)=>{const g=m.length;if(g>0&&(x||r>=M||i-t<f))return;const I=n();c(I,t,i,e,s);const{d:B,dim:b}=l?h(I):o(I),{rangeMidStart:R,rangeMidEnd:V}=a(t,i,b,B,e,s),C=r===M-1,H=!C&&R>=t+f,y=!C&&i>=V+f;if(H||y||0===g){const e=new d(t,R,V,i,b,B,I);if(H&&p(t,R,r+1,g,!0),y&&p(V,i,r+1,g,!1),m.push(e),-1!==u){const t=m[u];_?t.child0=g:t.child1=g}}};for(p(0,t,0,-1,!1);r<u.length;){const t=u[r],e=u[r+1],n=u[r+2],i=u[r+3];r+=4;const s=i>>1;_(t,e,n,s,i-(s<<1)==0)}this._generatedBVH=!0}}function h(t){const e=t[0],n=t[1],i=t[2],s=t[3];let h,o;return i-e>=s-n?(o=.5*(e+i),h=0):(o=.5*(n+s),h=1),{d:o,dim:h}}function o(t){const e=t[0],n=t[1],i=t[2],s=t[3];let h,o;return i-e>=s-n?(h=0,o=.5*(e+i)):(h=1,o=.5*(n+s)),{dim:h,d:o}}function a(t,e,n,i,s,h){let o=t;{let t=e;for(;o<t;){const e=s[o];r(e,n,i,h)<0?++o:(--t,s[o]=s[t],s[t]=e)}}const a=o;let c=o,d=e;for(;c<d;){const t=s[d-1];r(t,n,i,h)>0?--d:(s[d-1]=s[c],s[c]=t,++c)}return{rangeMidStart:a,rangeMidEnd:d}}function r(t,e,n,i){const s=4*t,h=i[s+0+e];return i[s+2+e]<n?-1:h>n?1:0}function c(t,e,n,i,s){let h=1/0,o=1/0,a=-1/0,r=-1/0;for(let c=e;c<n;++c){const t=4*i[c];h=Math.min(h,s[t+0]),o=Math.min(o,s[t+1]),a=Math.max(a,s[t+2]),r=Math.max(r,s[t+3])}t[0]=h,t[1]=o,t[2]=a,t[3]=r}class d{constructor(t,e,n,i,s,h,o){this.minIndexIndex=t,this.minMidIndexIndex=e,this.maxMidIndexIndex=n,this.maxIndexIndex=i,this.dim=s,this.d=h,this.aabb2D=o,this.child0=-1,this.child1=-1}}export{s as ElevationAgnosticBVH};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{invert as t,transpose as s}from"../../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as e}from"../../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{sub as n,transformMat3 as i,negate 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{create as a}from"../../../../../geometry/support/aaBoundingBox.js";import{floatArrayFrom as h,floatArrayByteSize as m,newFloatArray as p}from"../../../../../geometry/support/FloatArray.js";import{indexArrayFrom as c,getContinuousIndexArray as l,indexArrayByteSize as _}from"../../../../../geometry/support/Indices.js";import{ComponentObjectElevationAgnosticComponentBVH as b}from"./ComponentObjectElevationAgnosticBVH.js";import{ComponentObjectFixedBVH as u}from"./ComponentObjectFixedBVH.js";class f{constructor(t,s,e,n){this.viewingMode=t,this._components=e,this._needsElevationAlignment=n,this.verticalOffset=null,this.componentVerticalOffsets=null,this._planetCenter=r(),this._componentBvh=null,this._aabb=a();const{indices:i,positions:o}=s,m=o.length/3;this._indices=i?c(i,m):l(m),this._positions=h(o)}get usedMemory(){return m(this._positions)+_(this._indices)}destroy(){this._positions=null,this._indices=null,this._perComponentAabbs=null,this._componentBvh=null}getComponentAabb(t,s){const e=this._ensureComponentAabbs(),n=6*t;return s[0]=e[n],s[1]=e[n+1],s[2]=e[n+2],s[3]=e[n+3],s[4]=e[n+4],s[5]=e[n+5],s}getComponentAabbs(){return this._ensureComponentAabbs()}_ensureComponentAabbs(){return this._perComponentAabbs||(this._perComponentAabbs=this._computePerComponentAabbs()),this._perComponentAabbs}getComponentPositions(t,s){s.indices=this._indices,s.data=this._positions,s.stride=3,s.startIndex=this._components.offsets[t],s.endIndex=this._components.offsets[t+1]}intersect(e,r,a,h,m,p,c){this.verticalOffset=a,this.componentVerticalOffsets=h;const{position:l}=m,_=n(d,e,l),b=n(g,r,l),u=t(C,m.rotationScale);i(_,_,u),i(b,b,u);const f=s(A,u);if(1===this.viewingMode){const t=this._planetCenter;o(t,l),i(t,t,u)}const v=(t,s,e,n)=>{c(e,t,n?i(M,n,f):null,s)};this._intersectComponents(_,b,h,a,v,p)}_computePerComponentAabbs(){const t=this._aabb,s=.5*(t[0]+t[3]),e=.5*(t[1]+t[4]),n=.5*(t[2]+t[5]),i=this._components.count,o=p(6*i),r=this._indices,a=this._positions,h=this._components.offsets;let m=0,c=1/0,l=1/0,_=1/0,b=-1/0,u=-1/0,f=-1/0;for(let p=0;p<i;p++){const t=h[p],i=h[p+1];let d=1/0,g=1/0,C=1/0,M=-1/0,A=-1/0,v=-1/0;if(t<i)for(let s=t;s<i;s++){const t=3*r[s],e=a[t],n=a[t+1],i=a[t+2];d=Math.min(d,e),g=Math.min(g,n),C=Math.min(C,i),M=Math.max(M,e),A=Math.max(A,n),v=Math.max(v,i)}else d=s,g=e,C=n,M=s,A=e,v=n;o[m++]=d,o[m++]=g,o[m++]=C,o[m++]=M,o[m++]=A,o[m++]=v,c=Math.min(c,d),l=Math.min(l,g),_=Math.min(_,C),b=Math.max(b,M),u=Math.max(u,A),f=Math.max(f,v)}return this._aabb[0]=c,this._aabb[1]=l,this._aabb[2]=_,this._aabb[3]=b,this._aabb[4]=u,this._aabb[5]=f,o}_intersectComponents(t,s,e,n,i,o){let r=this._componentBvh;null==r&&(r=this._needsElevationAlignment?new b(this._positions,v,this._indices,this._components,this._ensureComponentAabbs(),this.geometryMinZ,this.planetCenterZ,this.localMode):new u(this._positions,v,this._indices,this.numTriangles,this._components.offsets),this._componentBvh=r),r.intersectRay(t,s,o,i,e??void 0,n??void 0)}get geometryMinZ(){return this._aabb[2]}get planetCenterZ(){return this._planetCenter[2]}get numTriangles(){return this._indices.length/3}get localMode(){return 2===this.viewingMode}get positions(){return this._positions}get indices(){return this._indices}get aabb(){return this._ensureComponentAabbs(),this._aabb}}const d=r(),g=r(),C=e(),M=r(),A=e(),v=3;export{f as IntersectionGeometry};
2
+ import{transpose as t,invert as e}from"../../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as s}from"../../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as n}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{sub as i,transformMat3 as o,negate as r}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as a}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as h}from"../../../../../geometry/support/aaBoundingBox.js";import{floatArrayFrom as m,floatArrayByteSize as p,newFloatArray as c}from"../../../../../geometry/support/FloatArray.js";import{indexArrayFrom as _,getContinuousIndexArray as l,indexArrayByteSize as b}from"../../../../../geometry/support/Indices.js";import{ComponentObjectElevationAgnosticComponentBVH as u}from"./ComponentObjectElevationAgnosticBVH.js";import{ComponentObjectFixedBVH as f}from"./ComponentObjectFixedBVH.js";class g{constructor(t,e,s,n){this.viewingMode=t,this._components=s,this._needsElevationAlignment=n,this.verticalOffset=null,this.componentVerticalOffsets=null,this._planetCenter=a(),this._componentBvh=null,this._aabb=h();const{indices:i,positions:o}=e,r=o.length/3;this._indices=i?_(i,r):l(r),this._positions=m(o)}get usedMemory(){return p(this._positions)+b(this._indices)}destroy(){this._positions=null,this._indices=null,this._perComponentAabbs=null,this._componentBvh=null}getComponentAabb(t,e){const s=this._ensureComponentAabbs(),n=6*t;return e[0]=s[n],e[1]=s[n+1],e[2]=s[n+2],e[3]=s[n+3],e[4]=s[n+4],e[5]=s[n+5],e}getComponentAabbs(){return this._ensureComponentAabbs()}_ensureComponentAabbs(){return this._perComponentAabbs||(this._perComponentAabbs=this._computePerComponentAabbs()),this._perComponentAabbs}getComponentPositions(t,e){e.indices=this._indices,e.data=this._positions,e.stride=3,e.startIndex=this._components.offsets[t],e.endIndex=this._components.offsets[t+1]}intersectRay(e,s,n,r,a,h,m){const p=v;this._setupIntersect(n,r,a,p);const{position:c}=a,_=i(d,e,c),l=i(C,s,c);o(_,_,p),o(l,l,p);const b=t(x,p),u=(t,e,s,n)=>{m(s,t,n?o(A,n,b):null,e)};this._intersectComponents(_,l,r,n,u,h)}intersectScreenPolygon(t,e,s,n,i,o){this._setupIntersect(s,n,i);this._ensureComponentBvh().intersectScreenPolygon(t,e,i.toMat4(M),(t,e,s,n)=>o(s,t,n,e),n??void 0,s??void 0)}_setupIntersect(t,s,n,i=v){if(this.verticalOffset=t,this.componentVerticalOffsets=s,e(i,n.rotationScale),1===this.viewingMode){const t=this._planetCenter;r(t,n.position),o(t,t,i)}}_computePerComponentAabbs(){const t=this._aabb,e=.5*(t[0]+t[3]),s=.5*(t[1]+t[4]),n=.5*(t[2]+t[5]),i=this._components.count,o=c(6*i),r=this._indices,a=this._positions,h=this._components.offsets;let m=0,p=1/0,_=1/0,l=1/0,b=-1/0,u=-1/0,f=-1/0;for(let c=0;c<i;c++){const t=h[c],i=h[c+1];let g=1/0,d=1/0,C=1/0,v=-1/0,M=-1/0,A=-1/0;if(t<i)for(let e=t;e<i;e++){const t=3*r[e],s=a[t],n=a[t+1],i=a[t+2];g=Math.min(g,s),d=Math.min(d,n),C=Math.min(C,i),v=Math.max(v,s),M=Math.max(M,n),A=Math.max(A,i)}else g=e,d=s,C=n,v=e,M=s,A=n;o[m++]=g,o[m++]=d,o[m++]=C,o[m++]=v,o[m++]=M,o[m++]=A,p=Math.min(p,g),_=Math.min(_,d),l=Math.min(l,C),b=Math.max(b,v),u=Math.max(u,M),f=Math.max(f,A)}return this._aabb[0]=p,this._aabb[1]=_,this._aabb[2]=l,this._aabb[3]=b,this._aabb[4]=u,this._aabb[5]=f,o}_intersectComponents(t,e,s,n,i,o){this._ensureComponentBvh().intersectRay(t,e,o,i,s??void 0,n??void 0)}_ensureComponentBvh(){let t=this._componentBvh;return null==t&&(t=this._needsElevationAlignment?new u(this._positions,j,this._indices,this._components,this._ensureComponentAabbs(),this.geometryMinZ,this.planetCenterZ,this.localMode):new f(this._positions,j,this._indices,this.numTriangles,this._components.offsets),this._componentBvh=t),t}get geometryMinZ(){return this._aabb[2]}get planetCenterZ(){return this._planetCenter[2]}get numTriangles(){return this._indices.length/3}get localMode(){return 2===this.viewingMode}get positions(){return this._positions}get indices(){return this._indices}get aabb(){return this._ensureComponentAabbs(),this._aabb}}const d=a(),C=a(),v=s(),M=n(),A=a(),x=s(),j=3;export{g as IntersectionGeometry};
@@ -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{oitResolution as u}from"../../../shaders/oitResolution.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
- class t{constructor(t,o){this.position=t,this.rotationScale=o}}export{t as Transform};
2
+ import{transformMat3 as t,add as o}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";class i{constructor(t,o){this.position=t,this.rotationScale=o}applyVec3(i,r){return t(i,r,this.rotationScale),o(i,i,this.position),i}toMat4(t){const{position:o,rotationScale:i}=this;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=0,t[4]=i[3],t[5]=i[4],t[6]=i[5],t[7]=0,t[8]=i[6],t[9]=i[7],t[10]=i[8],t[11]=0,t[12]=o[0],t[13]=o[1],t[14]=o[2],t[15]=1,t}}export{i as Transform};
@@ -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};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{releaseMaybe as r}from"../../../../../core/maybe.js";import{property as t,subclass as o}from"../../../../../core/accessorSupport/decorators.js";import{ZEROS as n}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{RenderNodeOutput as i}from"../../../webgl.js";import s from"../../../webgl/RenderNode.js";import{If as a,glsl as c}from"../../core/shaderModules/glsl.js";import{Pos2Locations as u}from"../../lib/DefaultVertexBufferLayouts.js";import{floatBlendReductionFactor as l}from"../../shaders/oitResolution.glsl.js";import{checkWebGLError as h}from"../../../../webgl/checkWebGLError.js";import{ColorAttachment0 as p,SizedPixelFormat as d,DataType as f}from"../../../../webgl/enums.js";let m=class extends s{constructor(e){super(e),this.destroyedCB=null,this.consumes={required:[i.FINAL]},this.produces=i.FINAL,this.clearColor=n,this._focusedFBOType=7,this._programs=new Map}destroy(){this._programs.clear(),this.destroyedCB()}render(){const e=this.input;if(!this._focusedTexture)return e;const r=this.renderingContext,t=r.boundFramebuffer;r.bindFramebuffer(e.fbo),r.setClearColor(0,0,0,0),r.clear(16384);const o=this._focusedTexture.attachment,n=[g(o)],i=this._ensureProgram(r,!1,n);return r.useProgram(i),r.bindTexture(o,0),i.setUniform1i("colorTex0",0),i.setUniform1i("inputType",this._focusedFBOType),3===this._focusedFBOType&&i.setUniform2fv("nearFar",this.camera.nearFar),r.setDrawBuffers([p]),r.screen.draw(),r.bindFramebuffer(t),e}getDownscaledFBO(e,r,t,o,n,i){if(n?.startsWith(`${r}\n`)??!1){const r=1/2**e.level;t=e.width*r,o=e.height*r}else i=null;const s="linear depth"===r||r.includes("shadow"),a="overlay highlight"===r||"highlights"===r||"highlight mix"===r,c="highlight coverage"===r,u=e.colorTexture?.descriptor,l=u?.internalFormat,f=[],m=new Array,v=new Array;e.colorAttachments.forEach((r,t)=>{const o=e.getColorTexture(r);if(o){const e=g(o);f.push(e);const{descriptor:r}=o;"float"!==e||r.hasMipmap||r.isImmutable||(o.generateMipmap(),m[t]=!0)}if(t>0){const e=o?.descriptor.internalFormat;return void(e===d.RGBA8&&(o?.debugName?.indexOf("emissive")??-1)>=0?v.push(8):v.push(T(e)))}v.push(s?0:a?1:c?2:i??T(l))});const x=this.renderingContext,{depthStencilTexture:$}=e,b=this._ensureProgram(x,null!=$,f,e.level),C=this.fboCache.acquire(t,o,"fbo visualizer");x.useProgram(b);const R=x.boundFramebuffer;x.bindFramebuffer(C.fbo);const y=new Array;e.colorAttachments.forEach((r,t)=>{const o=`colorTex${t.toFixed()}`;x.bindTexture(e.getColorTexture(r),t),b.setUniform1i(o,t),t>0&&C.acquireColor(p+t,5,"fbo visualizer"),y.push(r)});const w=$?.descriptor.linearFilterDepth??!1;if($){const r=e.colorAttachments.length;$.setShadowFiltering(!1),x.bindTexture($,r),b.setUniform1i("depthTex",r);const t=p+r;t>p&&C.acquireColor(t,5,"fbo visualizer"),y.push(t)}x.gl.drawBuffers(y),h(x.gl);const B=x.getViewport();return x.setViewport(0,0,t,o),x.setClearColor(0,0,0,0),x.clear(16384),x.setBlendingEnabled(!0),x.setBlendFunction(1,771),b.setUniform1iv("inputTypes",v.length>0?v:[7]),b.setUniform2fv("nearFar",this.camera.nearFar),x.screen.draw(),h(x.gl),x.bindFramebuffer(R),x.setViewport(B.x,B.y,B.width,B.height),e.colorAttachments.forEach((t,o)=>{const i=e.getColorTexture(t);m[o]&&i?.clearMipmap(),n===F(r,e,t,!1)&&(this._focusedTexture?.release(),this._focusedTexture=C.getAttachment(t),this._focusedTexture?.retain(),this._focusedFBOType=9===v[o]?T(i?.descriptor.internalFormat):v[o])}),$&&$.setShadowFiltering(w),C}clearFocusedFBO(){this._focusedTexture=r(this._focusedTexture)}getPreviewContent(e,r,t,o){const n=this.renderingContext,i=o.includes("\ndepth"),s=this.fboCache.acquire(e,r,"fbo visualizer"),a=n.boundFramebuffer;n.bindFramebuffer(s?.fbo);const c=n.getViewport();n.setViewport(0,0,e,r),n.setClearColor(this.clearColor[0],this.clearColor[1],this.clearColor[2],this.clearColor[3]),n.clear(16384),n.setBlendingEnabled(!0),n.setBlendFunction(1,771);const u=t.attachment,l=this._ensureProgram(n,!1,[g(u)]);n.useProgram(l),n.bindTexture(u,0),l.setUniform1i("colorTex0",0),l.setUniform1iv("inputTypes",[i||u.descriptor.internalFormat!==d.RGBA16F?7:5]),n.screen.draw();const p=new ImageData(new Uint8ClampedArray(e*r*4),e,r);return n.gl.readPixels(0,0,e,r,6408,f.UNSIGNED_BYTE,new Uint8Array(p.data.buffer)),h(n.gl),n.bindFramebuffer(a),n.setViewport(c.x,c.y,c.width,c.height),s?.release(),p}_ensureProgram(e,r,t,o=0){const n=x({hasDepthAttachment:r,colorSamplerTypes:t,level:o}),i=this._programs.get(n);if(i)return i;const s="#version 300 es\n in vec2 position;\n out vec2 uv;\n\n void main() {\n gl_Position = vec4(position, 0.0, 1.0);\n uv = position * 0.5 + vec2(0.5);\n }",h=e=>{let r="";for(let t=0;t<e.length;++t){const o=e[t];r+=`layout(location = ${c.int(t)}) out vec4 fragColor${c.int(t)};\n uniform ${v(o)} colorTex${c.int(t)};`}return r},p=e=>e.reduce((e,r,t)=>e+`{\n int inputType = inputTypes[${t}];\n if (inputType == ${3..toFixed()}) {\n fragColor${t} = vec4(vec3(readTexture(colorTex${t}, uv, ${o}).r), 1.0);\n } else if (inputType == ${4..toFixed()}) {\n fragColor${t} = vec4(readTexture(colorTex${t}, uv, ${o}).rg, 0.0, 1.0);\n } else if (inputType == ${(0).toFixed()}) {\n float depth = 1.0 - ((-linearDepthFromTexture(colorTex${t}, uv) - nearFar[0]) / (nearFar[1] - nearFar[0]));\n fragColor${t} = vec4(vec3(depth), depth >= 0.999 ? 0.0 : 1.0);\n } else if (inputType == ${5..toFixed()}) {\n fragColor${t} = vec4(readTexture(colorTex${t}, uv, ${o}).rgb, 1.0);\n } else if (inputType == ${1..toFixed()}) {\n fragColor${t} = vec4(readTexture(colorTex${t}, uv, ${o})) * 255.0;\n fragColor${t} = vec4(fragColor${t}.rgb / fragColor${t}.a, fragColor${t}.a);\n } else if(inputType == ${2..toFixed()}) {\n vec2 texDim = vec2(textureSize(colorTex${t}, 0));\n ivec2 iuv = ivec2(uv * texDim);\n uvec2 hh = uvec2(texelFetch(colorTex${t}, iuv, 0).rg);\n fragColor${t} = vec4(\n ((hh & uvec2(0x55u)) != uvec2(0u)) ? 1.0 : 0.0,\n ((hh & uvec2(0xaau)) != uvec2(0u)) ? 1.0 : 0.0,\n 0.0,\n 1.0);\n } else if(inputType == ${8..toFixed()}) {\n fragColor${t} = vec4(readTexture(colorTex${t}, uv, ${o}));\n fragColor${t}.rgb *= ${l.toFixed(1)};\n } else if (inputType == ${9..toFixed()}) {\n fragColor${t} = vec4(vec3(readTexture(colorTex${t}, uv, ${o}).a), 1.0);\n } else {\n fragColor${t} = vec4(readTexture(colorTex${t}, uv, ${o}));\n }\n }`,""),d=t.length,f=`#version 300 es\n precision highp float;\n precision highp usampler2D;\n\n in vec2 uv;\n ${h(t)}\n ${a(r,`layout(location = ${c.int(d)}) out vec4 fragDepth;\n uniform sampler2D depthTex;`)}\n\n uniform int inputTypes[${t.length||1}];\n uniform vec2 nearFar;\n\n // Factors to convert rgba back to float\n const vec4 RGBA_2_FLOAT_FACTORS = vec4(\n 255.0 / (256.0),\n 255.0 / (256.0 * 256.0),\n 255.0 / (256.0 * 256.0 * 256.0),\n 255.0 / (256.0 * 256.0 * 256.0 * 256.0)\n );\n\n\n float rgbaToFloat(vec4 rgba) {\n // Convert components from 0->1 back to 0->255 and then add the components together with their corresponding\n // fixed point factors, i.e. (256^1, 256^2, 256^3, 256^4)\n return dot(rgba, RGBA_2_FLOAT_FACTORS);\n }\n\n float linearDepthFromFloat(float depth) {\n depth = pow(depth, 0.2);\n return -(depth * (nearFar[1] - nearFar[0]) + nearFar[0]);\n }\n\n float linearDepthFromRGBA(vec4 depth) {\n return linearDepthFromFloat(rgbaToFloat(depth));\n }\n\n vec4 readTexture(sampler2D tex, vec2 uv, int lod) {\n ivec2 iuv = ivec2(uv * vec2(textureSize(tex, lod)));\n return texelFetch(tex, iuv, lod);\n }\n\n ${"float"===t[0]?"float linearDepthFromTexture(sampler2D depthTex, vec2 uv) {\n ivec2 iuv = ivec2(uv * vec2(textureSize(depthTex, 0)));\n return linearDepthFromRGBA(texelFetch(depthTex, iuv, 0));\n }":"float linearDepthFromTexture(usampler2D depthTex, vec2 uv) {\n ivec2 iuv = ivec2(uv * vec2(textureSize(depthTex, 0)));\n return linearDepthFromRGBA(vec4(texelFetch(depthTex, iuv, 0)) * 255.0);\n }"}\n\n void main() {\n ${p(t)}\n ${a(r,"float depth = 1.0 - pow(texture(depthTex, uv).r, 10.0);\n fragDepth = vec4(vec3(depth), depth < 0.000001 ? 0.0 : 1.0);")}\n }`,m=e.programCache.get(s,f,u);return this._programs.set(n,m),m}};function v(e){switch(e){case"float":return"sampler2D";case"uint":return"usampler2D";case"int":return"isampler2D"}}function g(e){if(!e)return"float";const{internalFormat:r}=e.descriptor;switch(r){case d.R8I:case d.R16I:case d.R32I:case d.RG8I:case d.RG16I:case d.RG32I:case d.RGB8I:case d.RGB16I:case d.RGB32I:case d.RGBA8I:case d.RGBA16I:case d.RGBA32I:return"int";case d.R8UI:case d.R16UI:case d.R32UI:case d.RG8UI:case d.RG16UI:case d.RG32UI:case d.RGB8UI:case d.RGB16UI:case d.RGB32UI:case d.RGBA8UI:case d.RGBA16UI:case d.RGBA32UI:return"uint";default:return"float"}}function x(e){const{hasDepthAttachment:r,colorSamplerTypes:t,level:o}=e;return`${r?"Depth":""}${t.reduceRight((e,r)=>e+`|C${r}`,"")} ${o}`}function T(e){switch(e){case d.R16F:case d.R32F:case d.R8:return 3;case d.RG8:return 4;case d.RGBA16F:return 5;case d.RG8UI:return 6;default:return 7}}function F(e,r,t,o){return o?`${e}\ndepth`:`${e}\n${$(r,t)}`}function $(e,r){return`${e.getColorTexture(r)?.debugName??"color"+(r-p)}`}e([t()],m.prototype,"destroyedCB",void 0),e([t()],m.prototype,"consumes",void 0),e([t()],m.prototype,"produces",void 0),e([t()],m.prototype,"clearColor",void 0),m=e([o("esri.views.3d.webgl-engine.effects.debug.RenderNodeVisualizerNode")],m);export{m as RenderNodeVisualizerNode,F as getAttachmentName};
2
+ import{__decorate as e}from"tslib";import{releaseMaybe as r}from"../../../../../core/maybe.js";import{property as t,subclass as o}from"../../../../../core/accessorSupport/decorators.js";import{ZEROS as n}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{RenderNodeOutput as i}from"../../../webgl.js";import s from"../../../webgl/RenderNode.js";import{If as a,glsl as c}from"../../core/shaderModules/glsl.js";import{Pos2Locations as l}from"../../lib/DefaultVertexBufferLayouts.js";import{floatBlendReductionFactor as u}from"../../shaders/floatBlendScale.glsl.js";import{checkWebGLError as h}from"../../../../webgl/checkWebGLError.js";import{ColorAttachment0 as p,SizedPixelFormat as d,DataType as f}from"../../../../webgl/enums.js";let m=class extends s{constructor(e){super(e),this.destroyedCB=null,this.consumes={required:[i.FINAL]},this.produces=i.FINAL,this.clearColor=n,this._focusedFBOType=7,this._programs=new Map}destroy(){this._programs.clear(),this.destroyedCB()}render(){const e=this.input;if(!this._focusedTexture)return e;const r=this.renderingContext,t=r.boundFramebuffer;r.bindFramebuffer(e.fbo),r.setClearColor(0,0,0,0),r.clear(16384);const o=this._focusedTexture.attachment,n=[g(o)],i=this._ensureProgram(r,!1,n);return r.useProgram(i),r.bindTexture(o,0),i.setUniform1i("colorTex0",0),i.setUniform1i("inputType",this._focusedFBOType),3===this._focusedFBOType&&i.setUniform2fv("nearFar",this.camera.nearFar),r.setDrawBuffers([p]),r.screen.draw(),r.bindFramebuffer(t),e}getDownscaledFBO(e,r,t,o,n,i){if(n?.startsWith(`${r}\n`)??!1){const r=1/2**e.level;t=e.width*r,o=e.height*r}else i=null;const s="linear depth"===r||r.includes("shadow"),a="overlay highlight"===r||"highlights"===r||"highlight mix"===r,c="highlight coverage"===r,l=e.colorTexture?.descriptor,u=l?.internalFormat,f=[],m=new Array,v=new Array;e.colorAttachments.forEach((r,t)=>{const o=e.getColorTexture(r);if(o){const e=g(o);f.push(e);const{descriptor:r}=o;"float"!==e||r.hasMipmap||r.isImmutable||(o.generateMipmap(),m[t]=!0)}if(t>0){const e=o?.descriptor.internalFormat;return void(e===d.RGBA8&&(o?.debugName?.indexOf("emissive")??-1)>=0?v.push(8):v.push(T(e)))}v.push(s?0:a?1:c?2:i??T(u))});const x=this.renderingContext,{depthStencilTexture:$}=e,b=this._ensureProgram(x,null!=$,f,e.level),C=this.fboCache.acquire(t,o,"fbo visualizer");x.useProgram(b);const y=x.boundFramebuffer;x.bindFramebuffer(C.fbo);const R=new Array;e.colorAttachments.forEach((r,t)=>{const o=`colorTex${t.toFixed()}`;x.bindTexture(e.getColorTexture(r),t),b.setUniform1i(o,t),t>0&&C.acquireColor(p+t,5,"fbo visualizer"),R.push(r)});const w=$?.descriptor.linearFilterDepth??!1;if($){const r=e.colorAttachments.length;$.setShadowFiltering(!1),x.bindTexture($,r),b.setUniform1i("depthTex",r);const t=p+r;t>p&&C.acquireColor(t,5,"fbo visualizer"),R.push(t)}x.gl.drawBuffers(R),h(x.gl);const B=x.getViewport();return x.setViewport(0,0,t,o),x.setClearColor(0,0,0,0),x.clear(16384),x.setBlendingEnabled(!0),x.setBlendFunction(1,771),b.setUniform1iv("inputTypes",v.length>0?v:[7]),b.setUniform2fv("nearFar",this.camera.nearFar),x.screen.draw(),h(x.gl),x.bindFramebuffer(y),x.setViewport(B.x,B.y,B.width,B.height),e.colorAttachments.forEach((t,o)=>{const i=e.getColorTexture(t);m[o]&&i?.clearMipmap(),n===F(r,e,t,!1)&&(this._focusedTexture?.release(),this._focusedTexture=C.getAttachment(t),this._focusedTexture?.retain(),this._focusedFBOType=9===v[o]?T(i?.descriptor.internalFormat):v[o])}),$&&$.setShadowFiltering(w),C}clearFocusedFBO(){this._focusedTexture=r(this._focusedTexture)}getPreviewContent(e,r,t,o){const n=this.renderingContext,i=o.includes("\ndepth"),s=this.fboCache.acquire(e,r,"fbo visualizer"),a=n.boundFramebuffer;n.bindFramebuffer(s?.fbo);const c=n.getViewport();n.setViewport(0,0,e,r),n.setClearColor(this.clearColor[0],this.clearColor[1],this.clearColor[2],this.clearColor[3]),n.clear(16384),n.setBlendingEnabled(!0),n.setBlendFunction(1,771);const l=t.attachment,u=this._ensureProgram(n,!1,[g(l)]);n.useProgram(u),n.bindTexture(l,0),u.setUniform1i("colorTex0",0),u.setUniform1iv("inputTypes",[i||l.descriptor.internalFormat!==d.RGBA16F?7:5]),n.screen.draw();const p=new ImageData(new Uint8ClampedArray(e*r*4),e,r);return n.gl.readPixels(0,0,e,r,6408,f.UNSIGNED_BYTE,new Uint8Array(p.data.buffer)),h(n.gl),n.bindFramebuffer(a),n.setViewport(c.x,c.y,c.width,c.height),s?.release(),p}_ensureProgram(e,r,t,o=0){const n=x({hasDepthAttachment:r,colorSamplerTypes:t,level:o}),i=this._programs.get(n);if(i)return i;const s="#version 300 es\n in vec2 position;\n out vec2 uv;\n\n void main() {\n gl_Position = vec4(position, 0.0, 1.0);\n uv = position * 0.5 + vec2(0.5);\n }",h=e=>{let r="";for(let t=0;t<e.length;++t){const o=e[t];r+=`layout(location = ${c.int(t)}) out vec4 fragColor${c.int(t)};\n uniform ${v(o)} colorTex${c.int(t)};`}return r},p=e=>e.reduce((e,r,t)=>e+`{\n int inputType = inputTypes[${t}];\n if (inputType == ${3..toFixed()}) {\n fragColor${t} = vec4(vec3(readTexture(colorTex${t}, uv, ${o}).r), 1.0);\n } else if (inputType == ${4..toFixed()}) {\n fragColor${t} = vec4(readTexture(colorTex${t}, uv, ${o}).rg, 0.0, 1.0);\n } else if (inputType == ${(0).toFixed()}) {\n float depth = 1.0 - ((-linearDepthFromTexture(colorTex${t}, uv) - nearFar[0]) / (nearFar[1] - nearFar[0]));\n fragColor${t} = vec4(vec3(depth), depth >= 0.999 ? 0.0 : 1.0);\n } else if (inputType == ${5..toFixed()}) {\n // Currently only emissive glow uses mipmap levels - and it doubles the energy on each level.\n // Correct this for display. In the future when there are other mipmaps implement this cleaner.\n fragColor${t} = vec4(readTexture(colorTex${t}, uv, ${o}).rgb / pow(2.0, ${o}.0), 1.0);\n } else if (inputType == ${1..toFixed()}) {\n fragColor${t} = vec4(readTexture(colorTex${t}, uv, ${o})) * 255.0;\n fragColor${t} = vec4(fragColor${t}.rgb / fragColor${t}.a, fragColor${t}.a);\n } else if(inputType == ${2..toFixed()}) {\n vec2 texDim = vec2(textureSize(colorTex${t}, 0));\n ivec2 iuv = ivec2(uv * texDim);\n uvec2 hh = uvec2(texelFetch(colorTex${t}, iuv, 0).rg);\n fragColor${t} = vec4(\n ((hh & uvec2(0x55u)) != uvec2(0u)) ? 1.0 : 0.0,\n ((hh & uvec2(0xaau)) != uvec2(0u)) ? 1.0 : 0.0,\n 0.0,\n 1.0);\n } else if(inputType == ${8..toFixed()}) {\n fragColor${t} = vec4(readTexture(colorTex${t}, uv, ${o}));\n fragColor${t}.rgb *= ${u.toFixed(1)};\n } else if (inputType == ${9..toFixed()}) {\n fragColor${t} = vec4(vec3(readTexture(colorTex${t}, uv, ${o}).a), 1.0);\n } else {\n fragColor${t} = vec4(readTexture(colorTex${t}, uv, ${o}));\n }\n }`,""),d=t.length,f=`#version 300 es\n precision highp float;\n precision highp usampler2D;\n\n in vec2 uv;\n ${h(t)}\n ${a(r,`layout(location = ${c.int(d)}) out vec4 fragDepth;\n uniform sampler2D depthTex;`)}\n\n uniform int inputTypes[${t.length||1}];\n uniform vec2 nearFar;\n\n // Factors to convert rgba back to float\n const vec4 RGBA_2_FLOAT_FACTORS = vec4(\n 255.0 / (256.0),\n 255.0 / (256.0 * 256.0),\n 255.0 / (256.0 * 256.0 * 256.0),\n 255.0 / (256.0 * 256.0 * 256.0 * 256.0)\n );\n\n\n float rgbaToFloat(vec4 rgba) {\n // Convert components from 0->1 back to 0->255 and then add the components together with their corresponding\n // fixed point factors, i.e. (256^1, 256^2, 256^3, 256^4)\n return dot(rgba, RGBA_2_FLOAT_FACTORS);\n }\n\n float linearDepthFromFloat(float depth) {\n depth = pow(depth, 0.2);\n return -(depth * (nearFar[1] - nearFar[0]) + nearFar[0]);\n }\n\n float linearDepthFromRGBA(vec4 depth) {\n return linearDepthFromFloat(rgbaToFloat(depth));\n }\n\n vec4 readTexture(sampler2D tex, vec2 uv, int lod) {\n ivec2 iuv = ivec2(uv * vec2(textureSize(tex, lod)));\n return texelFetch(tex, iuv, lod);\n }\n\n ${"float"===t[0]?"float linearDepthFromTexture(sampler2D depthTex, vec2 uv) {\n ivec2 iuv = ivec2(uv * vec2(textureSize(depthTex, 0)));\n return linearDepthFromRGBA(texelFetch(depthTex, iuv, 0));\n }":"float linearDepthFromTexture(usampler2D depthTex, vec2 uv) {\n ivec2 iuv = ivec2(uv * vec2(textureSize(depthTex, 0)));\n return linearDepthFromRGBA(vec4(texelFetch(depthTex, iuv, 0)) * 255.0);\n }"}\n\n void main() {\n ${p(t)}\n ${a(r,"float depth = 1.0 - pow(texture(depthTex, uv).r, 10.0);\n fragDepth = vec4(vec3(depth), depth < 0.000001 ? 0.0 : 1.0);")}\n }`,m=e.programCache.get(s,f,l);return this._programs.set(n,m),m}};function v(e){switch(e){case"float":return"sampler2D";case"uint":return"usampler2D";case"int":return"isampler2D"}}function g(e){if(!e)return"float";const{internalFormat:r}=e.descriptor;switch(r){case d.R8I:case d.R16I:case d.R32I:case d.RG8I:case d.RG16I:case d.RG32I:case d.RGB8I:case d.RGB16I:case d.RGB32I:case d.RGBA8I:case d.RGBA16I:case d.RGBA32I:return"int";case d.R8UI:case d.R16UI:case d.R32UI:case d.RG8UI:case d.RG16UI:case d.RG32UI:case d.RGB8UI:case d.RGB16UI:case d.RGB32UI:case d.RGBA8UI:case d.RGBA16UI:case d.RGBA32UI:return"uint";default:return"float"}}function x(e){const{hasDepthAttachment:r,colorSamplerTypes:t,level:o}=e;return`${r?"Depth":""}${t.reduceRight((e,r)=>e+`|C${r}`,"")} ${o}`}function T(e){switch(e){case d.R16F:case d.R32F:case d.R8:return 3;case d.RG8:return 4;case d.RGBA16F:return 5;case d.RG8UI:return 6;default:return 7}}function F(e,r,t,o){return o?`${e}\ndepth`:`${e}\n${$(r,t)}`}function $(e,r){return`${e.getColorTexture(r)?.debugName??"color"+(r-p)}`}e([t()],m.prototype,"destroyedCB",void 0),e([t()],m.prototype,"consumes",void 0),e([t()],m.prototype,"produces",void 0),e([t()],m.prototype,"clearColor",void 0),m=e([o("esri.views.3d.webgl-engine.effects.debug.RenderNodeVisualizerNode")],m);export{m as RenderNodeVisualizerNode,F as getAttachmentName};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{watch as t}from"../../../../../core/reactiveUtils.js";import{property as r,subclass as s}from"../../../../../core/accessorSupport/decorators.js";import{ZEROS as i}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{InternalRenderCategory as o}from"../../../webgl.js";import a from"../../../webgl/RenderNode.js";import{F as n}from"../../../../../chunks/FocusAreaColor.glsl.js";import{FocusAreaColorTechnique as c}from"./FocusAreaColorTechnique.js";import{ColorAttachment0 as m}from"../../../../webgl/enums.js";let u=class extends a{constructor(e){super({...e,view:e.focusAreasView.view}),this.consumes={required:[o.FOCUSAREA_COLOR,o.FOCUSAREA]},this.produces=o.FOCUSAREA_COLOR,this._fadeDirection=0,this._passParameters=new n}fadeOut(e){this.removeAllHandles(),this._startTime=null,this._fadeDirection=1,this.addHandles(t(()=>this._passParameters.fadeFactor.value,t=>{0===t&&(this.removeAllHandles(),e())})),this.requestRender(2)}render(e){const t=this.input,r=this.techniques.getCompiled(c);if(!r)return this.requestRender(1),t;const s=this.focusAreasView.style,a=this.bindParameters;this._startTime??=this.view.stage?.renderer.renderContext.time;const n=this.view.qualitySettings.fadeDuration,u=n>0?Math.min(n,this.view.stage?.renderer.renderContext.time-this._startTime)/n:1,h=e.find(({name:e})=>e===o.FOCUSAREA),f=this.renderingContext,l="bright"===s;this._passParameters.color=l?t.getTexture():f.emptyTexture,this._passParameters.focusArea=h.getTexture(),this._passParameters.effect=d[s],this._passParameters.fadeFactor.value=0===this._fadeDirection?u:1-u;const p=a.camera,A=p.fullViewport[2],w=p.fullViewport[3],g=l?this.fboCache.acquire(A,w,this.produces).moveAttachments(t):t;return f.bindFramebuffer(g.fbo),l&&f.clearBuffer(0,i),f.bindTechnique(r,a,this._passParameters),f.setDrawBuffers([m]),f.screen.draw(),u<1&&this.requestRender(2),g}};e([r()],u.prototype,"consumes",void 0),e([r()],u.prototype,"produces",void 0),e([r({constructOnly:!0})],u.prototype,"focusAreasView",void 0),u=e([s("esri.views.3d.webgl-engine.effects.focusArea.FocusAreaVisualization")],u);const d={bright:0,dark:1};export{u as FocusAreaVisualization,d as styleToEffect};
2
+ import{__decorate as e}from"tslib";import{watch as s}from"../../../../../core/reactiveUtils.js";import{property as t,subclass as r}from"../../../../../core/accessorSupport/decorators.js";import{ZEROS as i}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{InternalRenderCategory as o}from"../../../webgl.js";import a from"../../../webgl/RenderNode.js";import{F as n}from"../../../../../chunks/FocusAreaColor.glsl.js";import{FocusAreaColorTechnique as c}from"./FocusAreaColorTechnique.js";import{EmissiveTechniqueConfiguration as h}from"../../shaders/EmissiveTechniqueConfiguration.js";let m=class extends a{constructor(e){super({...e,view:e.focusAreasView.view}),this.consumes={required:[o.FOCUSAREA_COLOR,o.FOCUSAREA]},this.produces=o.FOCUSAREA_COLOR,this._fadeDirection=0,this._configuration=new h,this._passParameters=new n}fadeOut(e){this.removeAllHandles(),this._startTime=null,this._fadeDirection=1,this.addHandles(s(()=>this._passParameters.fadeFactor.value,s=>{0===s&&(this.removeAllHandles(),e())})),this.requestRender(2)}precompile(){this._configuration.hasEmissive=0!==this.bindParameters.emissions,this.techniques.precompile(c,this._configuration)}render(e){const s=this.bindParameters;this._startTime??=this.view.stage?.renderer.renderContext.time;const t=this.view.qualitySettings.fadeDuration,r=t>0?Math.min(t,this.view.stage?.renderer.renderContext.time-this._startTime)/t:1,a=this.renderingContext,n=this.techniques.get(c,this._configuration),h=this.input,m=e.find(({name:e})=>e===o.FOCUSAREA),f="bright"===this.focusAreasView.style;this._passParameters.color=f?h.getTexture():a.emptyTexture,this._passParameters.focusArea=m.getTexture(),this._passParameters.effect=u[this.focusAreasView.style],this._passParameters.fadeFactor.value=0===this._fadeDirection?r:1-r;const d=s.camera,l=d.fullViewport[2],p=d.fullViewport[3],g=f?this.fboCache.acquire(l,p,this.produces).moveAttachments(h):h;return a.bindFramebuffer(g.fbo),f&&a.clearBuffer(0,i),a.bindTechnique(n,s,this._passParameters),a.screen.draw(),r<1&&this.requestRender(2),g}};e([t()],m.prototype,"consumes",void 0),e([t()],m.prototype,"produces",void 0),e([t({constructOnly:!0})],m.prototype,"focusAreasView",void 0),m=e([r("esri.views.3d.webgl-engine.effects.focusArea.FocusAreaVisualization")],m);const u={bright:0,dark:1};export{m as FocusAreaVisualization,u as styleToEffect};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import"../../core/shaderLibrary/output/ReadDepth.glsl.js";import"../../core/shaderLibrary/shading/Gamma.glsl.js";import"../../core/shaderModules/Float3PassUniform.js";import"../../core/shaderModules/FloatPassUniform.js";import"../../core/shaderModules/glsl.js";import"../../core/shaderModules/Texture2DBindUniform.js";import"../../core/shaderModules/Texture2DPassUniform.js";import"../raymarching/DistanceFalloff.glsl.js";import"../../shaders/oitResolution.glsl.js";import"../../shaders/ScreenSpacePassAtmosphere.glsl.js";import"../../shaders/ToneMapping.glsl.js";import"../../../../webgl/ShaderBuilder.js";export{F as FogPassParameters,b as build}from"../../../../../chunks/Fog.glsl.js";
2
+ import"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import"../../core/shaderLibrary/output/ReadDepth.glsl.js";import"../../core/shaderLibrary/shading/Gamma.glsl.js";import"../../core/shaderLibrary/util/ColorConversion.glsl.js";import"../../core/shaderModules/Float3PassUniform.js";import"../../core/shaderModules/FloatPassUniform.js";import"../../core/shaderModules/glsl.js";import"../../core/shaderModules/Texture2DBindUniform.js";import"../../core/shaderModules/Texture2DPassUniform.js";import"../raymarching/DistanceFalloff.glsl.js";import"../../shaders/ScreenSpacePassAtmosphere.glsl.js";import"../../shaders/ToneMapping.glsl.js";import"../../../../webgl/ShaderBuilder.js";export{F as FogPassParameters,b as build}from"../../../../../chunks/Fog.glsl.js";
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{smoothstep as t,lerp as s}from"../../../../../core/mathUtils.js";import{releaseMaybe as r}from"../../../../../core/maybe.js";import{watch as a,syncAndInitial as i}from"../../../../../core/reactiveUtils.js";import{subclass as n}from"../../../../../core/accessorSupport/decorators.js";import{add as o,normalize as h,dot as m,scale as p,lerp as c,length as g}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as _,fromValues as d}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as u}from"../../../../../geometry/ellipsoidUtils.js";import{heightLimit as l}from"../../../environment/weather.js";import{TransparentEnvironment as f}from"../TransparentEnvironment.js";import{betaRayleigh as P,betaCombined as w}from"../atmosphere/atmosphereUtils.js";import{F as b}from"../../../../../chunks/Fog.glsl.js";import{FogTechnique as v}from"./FogTechnique.js";import{FogTechniqueConfiguration as y}from"./FogTechniqueConfiguration.js";import{DepthStencilAttachment as j,ColorAttachment1 as F}from"../../../../webgl/enums.js";const B=.95,E=1;let q=class extends f{constructor(e){super(e),this._configuration=new y,this._newParameters=new x,this._oldParameters=new x,this._fadedParameters=new x,this._parameters=this._newParameters,this._passParameters=new b;const t=u(e.view.spatialReference);this._planetRadius=t.radius,this._atmosphereRadius=t.radius+t.atmosphereHeight}initialize(){this.addHandles([a(()=>this.view.environment.atmosphereEnabled,()=>this._updateEnabled(),i),a(()=>this.view.environment.weather,()=>this._updateEnabled(),i),a(()=>this._updateFogParameters(),()=>{},i)]),this.addHandles(a(()=>this._fadeFactor,e=>this._fade(e),i))}_updateEnabled(){this.view.environment.atmosphereEnabled&&this.view.environment.weather?this._enable():this._disable()}get _fadeFactor(){return this.view.stage?.renderer.renderContext.bind.clouds.fadeFactor??1}_fade(e){const{_newParameters:t,_oldParameters:s}=this;e>=1?(this._parameters=t,this._oldParameters.copy(this._newParameters)):e<=0?this._parameters=s:(this._fadedParameters.lerp(s,t,e),this._parameters=this._fadedParameters)}_updateFogParameters(){const{weather:e,weatherAvailable:t}=this.view.environment,s="foggy"===e.type||"snowy"===e.type||"rainy"===e.type;this._newParameters.strength=t?e.fogOpacity:0,this._newParameters.amount=s?1:0,"foggy"!==e.type&&"snowy"!==e.type||(this._newParameters.fogBrightness=D),"rainy"===e.type&&(this._newParameters.fogBrightness=H),this._fadeFactor>=1&&this._oldParameters.copy(this._newParameters),this.requestRender(2)}get strength(){return this._parameters.strength}precompile(){this._update(),this._passParameters.amount>0&&this.techniques.precompile(v,this._configuration)}render(){const e=this.input;if(0===this._parameters.amount)return e;const t=this._getTechnique();if(!t)return e;const s=this.renderingContext,a=e.getAttachment(j);return this._passParameters.emission=e.obtainAttachment(F),e.attachDepth(null),s.bindFramebuffer(e.fbo),s.bindTechnique(t,this.bindParameters,this._passParameters),s.screen.draw(),e.attachDepth(a),this._passParameters.emission&&(e.attachColor(this._passParameters.emission,F),this._passParameters.emission=r(this._passParameters.emission)),e}_getTechnique(){return this._update(),this._passParameters.amount>0?this.techniques.get(v,this._configuration):null}_update(){const e=this.bindParameters.camera;h(R,e.eye);const s=Math.max(0,m(R,this.bindParameters.lighting.mainLight.direction)),r=this._parameters.fogBrightness;p(this._passParameters.color,U,r),p(T,U,.1*r),c(this._passParameters.color,T,this._passParameters.color,s);const a=g(e.eye);this._passParameters.atmosphereC=a**2-this._atmosphereRadius**2,this._passParameters.amount=(1-t(B*l,E*l,Math.abs(a-this._planetRadius)))*this._parameters.amount,this._passParameters.strength=this._parameters.strength,this._configuration.useFloatBlend=this.view.environment.atmosphereEnabled&&this.bindParameters.useFloatBlend.value,this._configuration.hasEmissive=this.bindParameters.hasEmission}get test(){return{parameters:this._passParameters}}};q=e([n("esri.views.3d.webgl-engine.effects.fog.Fog")],q);class x{constructor(){this.fogBrightness=0,this.strength=0,this.amount=0}copy(e){this.fogBrightness=e.fogBrightness,this.strength=e.strength,this.amount=e.amount}lerp(e,t,r){this.fogBrightness=s(e.fogBrightness,t.fogBrightness,r),this.strength=s(e.strength,t.strength,r),this.amount=s(e.amount,t.amount,r)}}const R=_(),T=_(),C=d(3e-4,3e-4,3e-4),U=_();o(U,w,P),o(U,U,C),h(U,U);const A=U.reduce((e,t)=>e+t,0)/3,H=.5/A,D=1.5/A;export{q as Fog,x as FogParameters};
2
+ import{__decorate as e}from"tslib";import{smoothstep as t,lerp as s}from"../../../../../core/mathUtils.js";import{releaseMaybe as r}from"../../../../../core/maybe.js";import{watch as a,syncAndInitial as i}from"../../../../../core/reactiveUtils.js";import{signal as n}from"../../../../../core/signal.js";import{subclass as o}from"../../../../../core/accessorSupport/decorators.js";import{add as h,normalize as m,length as p,dot as c,scale as l,lerp as u}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as g,fromValues as d}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as _}from"../../../../../geometry/ellipsoidUtils.js";import{heightLimit as f}from"../../../environment/weather.js";import{TransparentEnvironment as P}from"../TransparentEnvironment.js";import{betaRayleigh as v,betaCombined as w}from"../atmosphere/atmosphereUtils.js";import{F as b}from"../../../../../chunks/Fog.glsl.js";import{FogTechnique as y}from"./FogTechnique.js";import{EmissiveTechniqueConfiguration as j}from"../../shaders/EmissiveTechniqueConfiguration.js";import{floatBlendReductionFactor as F}from"../../shaders/floatBlendScale.glsl.js";import{DepthStencilAttachment as B,ColorAttachment1 as q,SizedPixelFormat as E}from"../../../../webgl/enums.js";const x=.9*f,C=1.1*f;let R=class extends P{constructor(e){super(e),this._configuration=new j,this._newParameters=new T,this._oldParameters=new T,this._fadedParameters=new T,this._parameters=this._newParameters,this._passParameters=new b;const t=_(e.view.spatialReference);this._planetRadius=t.radius,this._atmosphereRadius=t.radius+t.atmosphereHeight}initialize(){this.addHandles([a(()=>this.view.environment.atmosphereEnabled,()=>this._updateEnabled(),i),a(()=>this.view.environment.weather,()=>this._updateEnabled(),i),a(()=>this._updateFogParameters(),()=>{},i)]),this.addHandles(a(()=>this._fadeFactor,e=>this._fade(e),i))}_updateEnabled(){this.view.environment.atmosphereEnabled&&this.view.environment.weather?this._enable():this._disable()}get _fadeFactor(){return this.view.stage?.renderer.renderContext.bind.clouds.fadeFactor??1}_fade(e){const{_newParameters:t,_oldParameters:s}=this;e>=1?(this._parameters=t,this._oldParameters.copy(this._newParameters)):e<=0?this._parameters=s:(this._fadedParameters.lerp(s,t,e),this._parameters=this._fadedParameters)}_updateFogParameters(){const{weather:e,weatherAvailable:t}=this.view.environment,s="foggy"===e.type||"snowy"===e.type||"rainy"===e.type;this._newParameters.strength.value=t?e.scattering:0,this._newParameters.amount.value=s?1:0,"foggy"!==e.type&&"snowy"!==e.type||(this._newParameters.fogBrightness=M),"rainy"===e.type&&(this._newParameters.fogBrightness=D),this._fadeFactor>=1&&this._oldParameters.copy(this._newParameters),this.requestRender(2)}get strength(){return this._parameters.strength.value*this._heightFade}get amount(){return this._parameters.amount.value*this._heightFade}get _heightFade(){const e=p(this.bindParameters.camera.eye);return 1-t(x,C,Math.abs(e-this._planetRadius))}precompile(){this._update(),this._passParameters.amount>0&&this.techniques.precompile(y,this._configuration)}render(){const e=this.input,t=this._getTechnique();if(!t)return e;const s=this.renderingContext,a=e.getAttachment(B);if(this._passParameters.emission=e.obtainAttachment(q),this._passParameters.inputScale=this._passParameters.emission?.attachment.descriptor.internalFormat===E.RGBA8?F:1,this._passParameters.emission){const t=1===this._passParameters.inputScale?8:5;e.acquireColor(q,t,"emissive")}return e.attachDepth(null),s.bindFramebuffer(e.fbo),s.bindTechnique(t,this.bindParameters,this._passParameters),s.screen.draw(),this._passParameters.emission=r(this._passParameters.emission),e.attachDepth(a),this.fboCache.debugCallback?.("fog-color",e.fbo),e}_getTechnique(){return this._update(),this._passParameters.amount>0?this.techniques.get(y,this._configuration):null}_update(){const e=this.bindParameters.camera;m(A,e.eye);const t=Math.max(0,c(A,this.bindParameters.lighting.mainLight.direction)),s=this._parameters.fogBrightness;l(this._passParameters.color,H,s),l(S,H,.1*s),u(this._passParameters.color,S,this._passParameters.color,t);const r=p(e.eye);this._passParameters.atmosphereC=r**2-this._atmosphereRadius**2,this._passParameters.amount=this.amount,this._passParameters.strength=this.strength,this._configuration.hasEmissive=this.bindParameters.hasEmission}get test(){return{parameters:this._passParameters}}};R=e([o("esri.views.3d.webgl-engine.effects.fog.Fog")],R);class T{constructor(){this.fogBrightness=0,this.strength=n(0),this.amount=n(0)}copy(e){this.fogBrightness=e.fogBrightness,this.strength.value=e.strength.value,this.amount.value=e.amount.value}lerp(e,t,r){this.fogBrightness=s(e.fogBrightness,t.fogBrightness,r),this.strength.value=s(e.strength.value,t.strength.value,r),this.amount.value=s(e.amount.value,t.amount.value,r)}}const A=g(),S=g(),U=d(3e-4,3e-4,3e-4),H=g();h(H,w,v),h(H,H,U),m(H,H);const k=H.reduce((e,t)=>e+t,0)/3,D=.5/k,M=1.5/k;export{R as Fog,T as FogParameters};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import"../../core/shaderLibrary/ScreenSpacePass.glsl.js";import"../../core/shaderLibrary/output/ReadDepthLastFrame.glsl.js";import"../../core/shaderLibrary/shading/Gamma.glsl.js";import"../../core/shaderLibrary/shading/MainLighting.glsl.js";import"../../core/shaderLibrary/shading/ScreenSpaceRayMarching.glsl.js";import"../../core/shaderLibrary/util/CameraSpace.glsl.js";import"../../core/shaderModules/FloatPassUniform.js";import"../../core/shaderModules/glsl.js";import"../../core/shaderModules/Matrix4BindUniform.js";import"../../core/shaderModules/Texture2DBindUniform.js";import"../../core/shaderModules/Texture2DPassUniform.js";import"./GlobalIlluminationColorQuantization.glsl.js";import"../../../../webgl/enums.js";import"../../../../webgl/NoParameters.js";import"../../../../webgl/ShaderBuilder.js";export{G as GlobalIlluminationPassParameters,c as build,e as defaultColorBleedWeight,d as defaultRayMarchMaxReach,f as defaultRayMarchMaxReachEmissionWeight,b as defaultRayMarchMaxSteps,g as defaultRayMarchMinReach,h as defaultRayMarchMinReachEmissionWeight,i as defaultRayMarchWorldReach}from"../../../../../chunks/GlobalIllumination.glsl.js";
2
+ import"../../core/shaderLibrary/ScreenSpacePass.glsl.js";import"../../core/shaderLibrary/output/ReadDepthLastFrame.glsl.js";import"../../core/shaderLibrary/shading/Gamma.glsl.js";import"../../core/shaderLibrary/shading/MainLighting.glsl.js";import"../../core/shaderLibrary/shading/ScreenSpaceRayMarching.glsl.js";import"../../core/shaderLibrary/util/CameraSpace.glsl.js";import"../../core/shaderModules/FloatBindUniform.js";import"../../core/shaderModules/FloatPassUniform.js";import"../../core/shaderModules/glsl.js";import"../../core/shaderModules/Matrix4BindUniform.js";import"../../core/shaderModules/Texture2DBindUniform.js";import"../../core/shaderModules/Texture2DPassUniform.js";import"./GlobalIlluminationColorQuantization.glsl.js";import"../../shaders/floatBlendScale.glsl.js";import"../../../../webgl/enums.js";import"../../../../webgl/NoParameters.js";import"../../../../webgl/ShaderBuilder.js";export{G as GlobalIlluminationPassParameters,c as build,e as defaultColorBleedWeight,d as defaultRayMarchMaxReach,f as defaultRayMarchMaxReachEmissionWeight,b as defaultRayMarchMaxSteps,g as defaultRayMarchMinReach,h as defaultRayMarchMinReachEmissionWeight,i as defaultRayMarchWorldReach}from"../../../../../chunks/GlobalIllumination.glsl.js";
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{releaseMaybe as t}from"../../../../../core/maybe.js";import{watch as a,syncAndInitial as r}from"../../../../../core/reactiveUtils.js";import{property as s,subclass as i}from"../../../../../core/accessorSupport/decorators.js";import{set as l}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{InternalRenderCategory as o}from"../../../webgl.js";import n from"../../../webgl/RenderNode.js";import{G as m}from"../../../../../chunks/GlobalIllumination.glsl.js";import{G as u}from"../../../../../chunks/GlobalIlluminationBlur.glsl.js";import{GlobalIlluminationBlurTechnique as h}from"./GlobalIlluminationBlurTechnique.js";import{GlobalIlluminationTechnique as c}from"./GlobalIlluminationTechnique.js";import{GlobalIlluminationTechniqueConfiguration as _}from"./GlobalIlluminationTechniqueConfiguration.js";import{G as p}from"../../../../../chunks/GlobalIlluminationUpscale.glsl.js";import{GlobalIlluminationUpscaleTechnique as d}from"./GlobalIlluminationUpscaleTechnique.js";import{DepthStencilAttachment as b,ColorAttachment1 as f}from"../../../../webgl/enums.js";const g=1;let I=class extends n{constructor(e){super(e),this.consumes={required:["normals"]},this.produces=o.AMBIENT_ILLUMINATION,this._passParameters=new m,this._drawParameters=new u,this._drawParametersUpscale=new p,this._maxFrames=256,this._lowQualityResolutionScale=.25,this._configuration=new _,this._globalIllumination=null,this._isGlobalIlluminationUpdate=!1,this._resetBuffer=!1}initialize(){this.addHandles(a(()=>this.view.stage.renderer.hasGlobalIllumination,()=>{this._resetAccumulatedFrames(),this._requestRender()},r))}destroy(){this._globalIllumination=t(this._globalIllumination)}resetAccumulatedFrames(){this._isGlobalIlluminationUpdate||this._resetAccumulatedFrames()}render(e){if(this._passParameters.accumulatedFrames>=this._maxFrames)return this._globalIllumination?.retain(),this._globalIllumination;const t=e.find(({name:e})=>"normals"===e),a=t?.getTexture(),r=t?.getTexture(b),s=this._mode;if(!a||!r)return this._emptyOutput;if(0===s)return this._resetBuffer=!1,this._emptyOutput;if(!this._canRender)return this._resetBuffer=!1,this._requestRender(),this._emptyOutput;const i=this.bindParameters;this._configuration.hasEmission=!!i.reprojection.lastFrameEmission;const n=this.techniques.getCompiled(c,this._configuration),m=this.techniques.getCompiled(h),u=1===s,_=u?this._lowQualityResolutionScale:1,p=u?this.techniques.getCompiled(d):null;if(!n||!m||u&&!p)return this._requestRender(),this._emptyOutput;const I=this.renderingContext,{camera:w}=i;this._passParameters.normalTexture=a,this._passParameters.depthTexture=r,this._passParameters.projScale=1/w.computeScreenPixelSizeAtDist(1),this._passParameters.scaleGlobalIllumination=_;const{fullWidth:P,fullHeight:x}=w,F=Math.max(1,Math.floor(P*_)),T=Math.max(1,Math.floor(x*_)),q=this.fboCache.acquire(F,T,"global illumination input").acquireColor(f,0);I.bindFramebuffer(q.fbo),I.setViewport(0,0,F,T),I.bindTechnique(n,i,this._passParameters,this._drawParameters),I.screen.draw();const G=q.obtainAttachment(f),C=Math.max(1,Math.round(F/g)),j=Math.max(1,Math.round(T/g)),y=this.fboCache.acquire(C,j,"global illumination blur horizontal");I.bindFramebuffer(y.fbo),this._drawParameters.texture=q.getTexture(),this._drawParameters.weightTexture=G.attachment,l(this._drawParameters.blurSize,0,g/T),I.bindTechnique(m,i,this._passParameters,this._drawParameters),I.setViewport(0,0,C,j),I.screen.draw(),q.release();const A=u?"global illumination blur vertical":o.AMBIENT_ILLUMINATION,M=this.fboCache.acquire(C,j,A);I.bindFramebuffer(M.fbo),I.setViewport(0,0,C,j),I.setClearColor(1,1,1,0),I.clear(16384),this._drawParameters.texture=y.getTexture(),this._drawParameters.weightTexture=G.attachment,l(this._drawParameters.blurSize,g/C,0),I.bindTechnique(m,i,this._passParameters,this._drawParameters),I.setViewport(0,0,C,j),I.screen.draw(),y.release(),M.attachColor(G,f),G.release();let R=M;return p&&(R=this.fboCache.acquire(P,x,o.AMBIENT_ILLUMINATION).acquireColor(f,0),I.bindFramebuffer(R.fbo),I.setViewport(0,0,P,x),I.setClearColor(1,1,1,0),I.clear(16384),this._drawParametersUpscale.colorTexture=M.getTexture(),this._drawParametersUpscale.weightTexture=M.getTexture(f),I.bindTechnique(p,i,this._passParameters,this._drawParametersUpscale),I.screen.draw(),M.release()),I.setViewport4fv(w.fullViewport),this._passParameters.temporalSampleFrame=(this._passParameters.temporalSampleFrame+1)%64,++this._passParameters.accumulatedFrames,this._cacheGlobalIllumination(R),this._passParameters.accumulatedFrames<this._maxFrames&&this._requestRender(),R}_requestRender(){this._isGlobalIlluminationUpdate=!0,this.requestRender(1),this._isGlobalIlluminationUpdate=!1}_cacheGlobalIllumination(e){this._globalIllumination!==e&&(this._globalIllumination=t(this._globalIllumination),this._globalIllumination=e,this._globalIllumination.retain())}get _emptyOutput(){const e=this.renderingContext,{fullWidth:t,fullHeight:a}=this.bindParameters.camera,r=this.fboCache.acquire(t,a,o.AMBIENT_ILLUMINATION).acquireColor(f,0);return e.bindFramebuffer(r.fbo),e.setViewport(0,0,t,a),e.clearBuffer(0,[0,0,0,1]),e.clearBuffer(1,[0,0,0,0]),r}get _canRender(){const{reprojection:e,hasEmission:t,globalIllumination:a}=this.bindParameters;return!(!e.lastFrameColor||t&&!e.lastFrameEmission||!e.lastFrameDepth||!a||this._resetBuffer)}get _mode(){const{hasGlobalIlluminationHighQuality:e,hasGlobalIllumination:t}=this.view.stage.renderer;return e?2:t?1:0}_resetAccumulatedFrames(){this._passParameters.accumulatedFrames=0,this._globalIllumination=t(this._globalIllumination)}get test(){const e=this;return{passParameters:this._passParameters,configuration:this._configuration,get maxFrames(){return e._maxFrames},set maxFrames(t){e._maxFrames=t},get lowQualityResolutionScale(){return e._lowQualityResolutionScale},set lowQualityResolutionScale(t){e._lowQualityResolutionScale=t},get mode(){return e._mode},restartAccumulation:()=>{this._resetAccumulatedFrames(),this._passParameters.temporalSampleFrame=0,this._resetBuffer=!0,this._requestRender()}}}};e([s()],I.prototype,"consumes",void 0),e([s()],I.prototype,"produces",void 0),I=e([i("esri.views.3d.webgl-engine.effects.globalIllumination.GlobalIllumination")],I);export{I as GlobalIllumination,g as blurSizePixels};
2
+ import{__decorate as e}from"tslib";import{releaseMaybe as t}from"../../../../../core/maybe.js";import{watch as r,syncAndInitial as s}from"../../../../../core/reactiveUtils.js";import{property as a,subclass as i}from"../../../../../core/accessorSupport/decorators.js";import{set as l}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{InternalRenderCategory as o}from"../../../webgl.js";import u from"../../../webgl/RenderNode.js";import{G as n}from"../../../../../chunks/GlobalIllumination.glsl.js";import{G as m}from"../../../../../chunks/GlobalIlluminationBlur.glsl.js";import{GlobalIlluminationBlurTechnique as h}from"./GlobalIlluminationBlurTechnique.js";import{GlobalIlluminationTechnique as c}from"./GlobalIlluminationTechnique.js";import{GlobalIlluminationTechniqueConfiguration as p}from"./GlobalIlluminationTechniqueConfiguration.js";import{G as _}from"../../../../../chunks/GlobalIlluminationUpscale.glsl.js";import{GlobalIlluminationUpscaleTechnique as d}from"./GlobalIlluminationUpscaleTechnique.js";import{DepthStencilAttachment as f,ColorAttachment1 as b}from"../../../../webgl/enums.js";const g=1;let w=class extends u{constructor(e){super(e),this.consumes={required:["normals"]},this.produces=o.AMBIENT_ILLUMINATION,this._passParameters=new n,this._drawParameters=new m,this._drawParametersUpscale=new _,this._maxFrames=256,this._lowQualityResolutionScale=.25,this._configuration=new p,this._lastOutput=null,this._isGlobalIlluminationUpdate=!1,this._resetBuffer=!1}initialize(){this.addHandles(r(()=>this.view.stage.renderer.hasGlobalIllumination,()=>{this._reset(),this._requestRender()},s))}destroy(){this._lastOutput=t(this._lastOutput)}resetAccumulatedFrames(){this._isGlobalIlluminationUpdate||this._reset()}render(e){if(this._passParameters.accumulatedFrames>=this._maxFrames)return this._lastOutput?.retain(),this._lastOutput;const t=e.find(({name:e})=>"normals"===e),r=t?.getTexture(),s=t?.getTexture(f),a=this._mode;if(!r||!s)return this._emptyOutput;if(0===a)return this._resetBuffer=!1,this._emptyOutput;if(!this._canRender)return this._resetBuffer=!1,this._requestRender(),this._emptyOutput;const i=this.bindParameters;this._configuration.hasEmission=!!i.reprojection.lastFrameEmission;const u=this.techniques.getCompiled(c,this._configuration),n=this.techniques.getCompiled(h),m=1===a,p=m?this._lowQualityResolutionScale:1,_=m?this.techniques.getCompiled(d):null;if(!u||!n||m&&!_)return this._requestRender(),this._emptyOutput;const w=this.renderingContext,{camera:P}=i;this._passParameters.normalTexture=r,this._passParameters.depthTexture=s,this._passParameters.projScale=1/P.computeScreenPixelSizeAtDist(1),this._passParameters.scaleGlobalIllumination=p;const{fullWidth:I,fullHeight:x}=P,T=Math.max(1,Math.floor(I*p)),q=Math.max(1,Math.floor(x*p)),F=this.fboCache.acquire(T,q,"global illumination input").acquireColor(b,0);w.bindFramebuffer(F.fbo),w.setViewport(0,0,T,q),w.bindTechnique(u,i,this._passParameters,this._drawParameters),w.screen.draw();const O=F.obtainAttachment(b),C=Math.max(1,Math.round(T/g)),G=Math.max(1,Math.round(q/g)),j=this.fboCache.acquire(C,G,"global illumination blur horizontal");w.bindFramebuffer(j.fbo),this._drawParameters.texture=F.getTexture(),this._drawParameters.weightTexture=O.attachment,l(this._drawParameters.blurSize,0,g/q),w.bindTechnique(n,i,this._passParameters,this._drawParameters),w.setViewport(0,0,C,G),w.screen.draw(),F.release();const y=m?"global illumination blur vertical":o.AMBIENT_ILLUMINATION,M=this.fboCache.acquire(C,G,y);w.bindFramebuffer(M.fbo),w.setViewport(0,0,C,G),w.setClearColor(1,1,1,0),w.clear(16384),this._drawParameters.texture=j.getTexture(),this._drawParameters.weightTexture=O.attachment,l(this._drawParameters.blurSize,g/C,0),w.bindTechnique(n,i,this._passParameters,this._drawParameters),w.setViewport(0,0,C,G),w.screen.draw(),j.release(),M.attachColor(O,b),O.release();let R=M;return _&&(R=this.fboCache.acquire(I,x,o.AMBIENT_ILLUMINATION).acquireColor(b,0),w.bindFramebuffer(R.fbo),w.setViewport(0,0,I,x),w.setClearColor(1,1,1,0),w.clear(16384),this._drawParametersUpscale.colorTexture=M.getTexture(),this._drawParametersUpscale.weightTexture=M.getTexture(b),w.bindTechnique(_,i,this._passParameters,this._drawParametersUpscale),w.screen.draw(),M.release()),w.setViewport4fv(P.fullViewport),this._passParameters.temporalSampleFrame=(this._passParameters.temporalSampleFrame+1)%64,++this._passParameters.accumulatedFrames,this._storeOutput(R),this._passParameters.accumulatedFrames<this._maxFrames&&this._requestRender(),R}_requestRender(){this._isGlobalIlluminationUpdate=!0,this.requestRender(1),this._isGlobalIlluminationUpdate=!1}_storeOutput(e){this._lastOutput!==e&&(this._lastOutput=t(this._lastOutput),this._lastOutput=e,this._lastOutput.retain())}get _emptyOutput(){const e=this.renderingContext,{fullWidth:t,fullHeight:r}=this.bindParameters.camera,s=this.fboCache.acquire(t,r,o.AMBIENT_ILLUMINATION).acquireColor(b,0);return e.bindFramebuffer(s.fbo),e.setViewport(0,0,t,r),e.clearBuffer(0,[0,0,0,1]),e.clearBuffer(1,[0,0,0,0]),s}get _canRender(){const{reprojection:e,hasEmission:t,globalIllumination:r}=this.bindParameters;return!(!e.lastFrameColor||t&&!e.lastFrameEmission||!e.lastFrameDepth||!r||this._resetBuffer)}get _mode(){const{hasGlobalIlluminationHighQuality:e,hasGlobalIllumination:t}=this.view.stage.renderer;return e?2:t?1:0}_reset(){this._passParameters.accumulatedFrames=0,this._lastOutput=t(this._lastOutput)}get test(){const e=this;return{passParameters:this._passParameters,configuration:this._configuration,get maxFrames(){return e._maxFrames},set maxFrames(t){e._maxFrames=t},get lowQualityResolutionScale(){return e._lowQualityResolutionScale},set lowQualityResolutionScale(t){e._lowQualityResolutionScale=t},get mode(){return e._mode},restartAccumulation:()=>{this._reset(),this._passParameters.temporalSampleFrame=0,this._resetBuffer=!0,this._requestRender()}}}};e([a()],w.prototype,"consumes",void 0),e([a()],w.prototype,"produces",void 0),w=e([i("esri.views.3d.webgl-engine.effects.globalIllumination.GlobalIllumination")],w);export{w as GlobalIllumination,g as blurSizePixels};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import"../../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import"../../core/shaderLibrary/ScreenSpacePass.glsl.js";import"../../core/shaderLibrary/output/ReadDepth.glsl.js";import"../../core/shaderLibrary/shading/GlobalIlluminationWeights.glsl.js";import"../../core/shaderLibrary/util/CameraSpace.glsl.js";import"../../core/shaderModules/BooleanBindUniform.js";import"../../core/shaderModules/Float2DrawUniform.js";import"../../core/shaderModules/FloatPassUniform.js";import"../../core/shaderModules/glsl.js";import"../../core/shaderModules/Texture2DDrawUniform.js";import"../../core/shaderModules/Texture2DPassUniform.js";import"./GlobalIlluminationColorQuantization.glsl.js";import"../../shaders/ditherNoise.glsl.js";import"../../shaders/oitResolution.glsl.js";import"../../../../webgl/NoParameters.js";import"../../../../webgl/ShaderBuilder.js";export{G as GlobalIlluminationBlurDrawParameters,b as build}from"../../../../../chunks/GlobalIlluminationBlur.glsl.js";
2
+ import"../../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import"../../core/shaderLibrary/ScreenSpacePass.glsl.js";import"../../core/shaderLibrary/output/ReadDepth.glsl.js";import"../../core/shaderLibrary/shading/GlobalIlluminationWeights.glsl.js";import"../../core/shaderLibrary/util/CameraSpace.glsl.js";import"../../core/shaderModules/BooleanBindUniform.js";import"../../core/shaderModules/Float2DrawUniform.js";import"../../core/shaderModules/FloatPassUniform.js";import"../../core/shaderModules/glsl.js";import"../../core/shaderModules/Texture2DDrawUniform.js";import"../../core/shaderModules/Texture2DPassUniform.js";import"./GlobalIlluminationColorQuantization.glsl.js";import"../../shaders/ditherNoise.glsl.js";import"../../shaders/floatBlendScale.glsl.js";import"../../../../webgl/NoParameters.js";import"../../../../webgl/ShaderBuilder.js";export{G as GlobalIlluminationBlurDrawParameters,b as build}from"../../../../../chunks/GlobalIlluminationBlur.glsl.js";
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as t}from"tslib";import{releaseMaybe as e}from"../../../../../core/maybe.js";import{watch as i,syncAndInitial as r}from"../../../../../core/reactiveUtils.js";import{property as s,subclass as o}from"../../../../../core/accessorSupport/decorators.js";import{set as a}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{length as n}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{ZEROS as h}from"../../../../../core/libs/gl-matrix-2/factories/vec4f32.js";import{getReferenceEllipsoid as l}from"../../../../../geometry/ellipsoidUtils.js";import{InternalRenderCategory as c}from"../../../webgl.js";import{TransparentEnvironment as m}from"../TransparentEnvironment.js";import{G as u}from"../../../../../chunks/GlowBlur.glsl.js";import{GlowBlurTechnique as p}from"./GlowBlurTechnique.js";import{GlowBlurTechniqueConfiguration as _}from"./GlowBlurTechniqueConfiguration.js";import{G as g,a as d,m as b}from"../../../../../chunks/GlowComposition.glsl.js";import{GlowCompositionTechnique as f}from"./GlowCompositionTechnique.js";import{GlowCompositionTechniqueConfiguration as P}from"./GlowCompositionTechniqueConfiguration.js";import{floatBlendReductionFactor as w}from"../../shaders/oitResolution.glsl.js";import{ColorAttachment1 as C,DepthStencilAttachment as v}from"../../../../webgl/enums.js";let T=class extends m{constructor(t){super(t),this.consumes={required:[c.TRANSPARENT_ENVIRONMENT,"emissive"]},this.produces=c.TRANSPARENT_ENVIRONMENT,this._scatteringFactors={realistic:new g([.9,.06,.03,.01,0,0],1),cartographicMin:new g([.58,.18,.12,.08,.04,0],1),cartographicDefault:new g([.99,.95,.75,.2,.1,.01],3),cartographicMax:new g([2.8,2.32,2.05,1.4,.4,.03],9)},this._blurHorizontalConfiguration=new _,this._blurVerticalConfiguration=new _,this._compositeConfiguration=new P,this._compositionParameters=new d,this._blurParameters=new u,this._blurScalePerLod=3.06,this._logicalBlurRadius=.0037;const e=l(t.view.spatialReference);this._atmosphereRadius=e.radius+e.atmosphereHeight,this._blurVerticalConfiguration.glowStage=1}initialize(){this.addHandles([i(()=>this._updateParameters(),()=>{},r)])}_updateParameters(){this._compositionParameters.minDisperse.preset=this._preset,this.requestRender(1)}_updateConfigurations(){this._compositeConfiguration.useFloatBlend=this._blurHorizontalConfiguration.useFloatBlend=this._blurVerticalConfiguration.useFloatBlend=this.bindParameters.useFloatBlend.value,this._compositeConfiguration.blurEnabled=2!==this._mode}precompile(){this._updateConfigurations(),this._compositeConfiguration.blurEnabled&&(this.techniques.precompile(p,this._blurHorizontalConfiguration),this.techniques.precompile(p,this._blurVerticalConfiguration)),this.techniques.precompile(f,this._compositeConfiguration)}render(){const t=this.input,i=t.getAttachment(C);if(!i?.attachment)return t;const r=t.getTexture(),s=t.getAttachment(v),o=this.fboCache,{fullWidth:a,fullHeight:h}=this.bindParameters.camera,l=this.renderingContext;this._updateConfigurations();const c=this.camera,m=n(c.eye);if(this._compositionParameters.fogOpacity=this.view.stage.renderView.fog?.strength??0,this._compositionParameters.color=r,this._compositionParameters.emission=i.attachment,this._compositionParameters.atmosphereC=m**2-this._atmosphereRadius**2,!this._compositeConfiguration.blurEnabled){const t=o.acquire(r.descriptor.width,r.descriptor.height,this.produces);this._setupFBO(t,a,h);const e=this.techniques.get(f,this._compositeConfiguration);return l.bindTechnique(e,this.bindParameters,this._compositionParameters),l.screen.draw(),t.attachDepth(s),t.attachColor(i,C),t}this._renderGlowMipMap();const u=o.acquire(r.descriptor.width,r.descriptor.height,this.produces);u.acquireColor(C,this.bindParameters.useFloatBlend.value?8:5,"emissive"),this._setupFBO(u,a,h,!0);const p=this.techniques.get(f,this._compositeConfiguration);return l.bindTechnique(p,this.bindParameters,this._compositionParameters),l.screen.draw(),this._compositionParameters.lodTexture=e(this._compositionParameters.lodTexture),u.attachDepth(s),u}_renderGlowMipMap(){const t=this.fboCache,{fullWidth:e,fullHeight:i}=this.camera,r=this.renderingContext,s=5,o=this.techniques.get(p,this._blurHorizontalConfiguration),n=this.techniques.get(p,this._blurVerticalConfiguration);this._blurParameters.input=this._compositionParameters.emission,this._blurParameters.inputScale=w,this._blurParameters.level=0,this._blurParameters.blurRadius=this._logicalBlurRadius,a(this._blurParameters.size,.5*e,.5*i);let h=Math.floor(this._blurParameters.size[0]),l=Math.floor(this._blurParameters.size[1]);const c=t.acquire(h,l,"glow horizontal",8);for(this._compositionParameters.lodTexture=t.acquire(h,l,"glow mipmap",9);h>1&&l>1&&this._blurParameters.level<s;)this._setupFBO(c,h,l),r.bindTechnique(o,this.bindParameters,this._blurParameters),r.screen.draw(),t.debugCallback?.(`glow horizontal ${this._blurParameters.level}`,c.fbo),this._blurParameters.inputScale=1,this._blurParameters.input=c.getTexture(),this._setupFBO(this._compositionParameters.lodTexture,h,l,!1,this._blurParameters.level),r.bindTechnique(n,this.bindParameters,this._blurParameters),r.screen.draw(),t.debugCallback?.(this._compositionParameters.lodTexture.name,this._compositionParameters.lodTexture.fbo),a(this._blurParameters.size,.5*h,.5*l),h=Math.floor(this._blurParameters.size[0]),l=Math.floor(this._blurParameters.size[1]),this._blurParameters.input=this._compositionParameters.lodTexture.getTexture(),this._blurParameters.blurRadius*=this._blurScalePerLod,++this._blurParameters.level;c.release(),this._compositionParameters.lodTexture.fbo.level=0}get _preset(){return 0===this._mode?this._scatteringFactors.realistic.preset:this._intensity<=.5?b(this._scatteringFactors.cartographicMin.preset,this._scatteringFactors.cartographicDefault.preset,2*this._intensity):b(this._scatteringFactors.cartographicDefault.preset,this._scatteringFactors.cartographicMax.preset,2*(this._intensity-.5))}get _mode(){return null==this.view.environment.lighting.glow?this.view.environment.atmosphereEnabled?0:2:1}get _intensity(){return this.view.environment.lighting.glow?.intensity??0}_setupFBO(t,e,i,r=!1,s=0){t.fbo.level=s;const o=this.renderingContext;o.bindFramebuffer(t.fbo),o.setViewport(0,0,e,i),o.setClearColor(0,0,0,0),o.clear(16384),r&&o.clearBuffer(1,h)}get test(){return{compositionParameters:this._compositionParameters,blurParameters:this._blurParameters,preset:this._preset,setMinDisperse:(t,e)=>{0===this._mode?this._scatteringFactors.realistic.preset[t]=e:(this._scatteringFactors.cartographicMin.preset[t]=e,this._scatteringFactors.cartographicMax.preset[t]=e)}}}};t([s()],T.prototype,"consumes",void 0),t([s()],T.prototype,"produces",void 0),T=t([o("esri.views.3d.webgl-engine.effects.glow.Glow")],T);export{T as Glow};
2
+ import{__decorate as e}from"tslib";import{lerp as t}from"../../../../../core/mathUtils.js";import{releaseMaybe as s}from"../../../../../core/maybe.js";import{watch as r,initial as i}from"../../../../../core/reactiveUtils.js";import{property as o,subclass as a}from"../../../../../core/accessorSupport/decorators.js";import{set as m}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{length as n}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{ZEROS as l}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{getReferenceEllipsoid as h}from"../../../../../geometry/ellipsoidUtils.js";import{InternalRenderCategory as c}from"../../../webgl.js";import{TransparentEnvironment as p}from"../TransparentEnvironment.js";import{G as u}from"../../../../../chunks/GlowBlur.glsl.js";import{GlowBlurTechnique as b}from"./GlowBlurTechnique.js";import{G as f}from"../../../../../chunks/GlowComposite.glsl.js";import{GlowCompositeTechnique as _}from"./GlowCompositeTechnique.js";import{FloatBlendScaleConfiguration as g,floatBlendReductionFactor as d}from"../../shaders/floatBlendScale.glsl.js";import{ColorAttachment1 as w,DrawBufferNone as P}from"../../../../webgl/enums.js";import{noParameters as v}from"../../../../webgl/NoParameters.js";let B=class extends p{constructor(e){super(e),this.consumes={required:[c.TRANSPARENT_ENVIRONMENT,"emissive"]},this.produces=c.TRANSPARENT_ENVIRONMENT,this._glowBoost={realistic:0,cartographicMin:.5,cartographicDefault:2.5,cartographicMax:5},this._compositeConfiguration=new g,this._compositeParameters=new f,this._blurParameters=new u;const t=h(e.view.spatialReference);this._atmosphereRadius=t.radius+t.atmosphereHeight}initialize(){this.addHandles([r(()=>this._mode,e=>2===e?this._disable():this._enable(),i),r(()=>this._boost,e=>{this._compositeParameters.boost=e,this.requestRender(1)},i),r(()=>this.view.stage.renderView.fog?.strength??0,e=>{this._compositeParameters.scattering=e,this.requestRender(1)},i)])}precompile(){this.techniques.precompile(b),this._compositeConfiguration.useFloatBlend=this.bindParameters.useFloatBlend.value,this.techniques.precompile(_,this._compositeConfiguration)}render(){const e=this.input;if(this._compositeParameters.emission=e.obtainAttachment(w),!this._compositeParameters.emission?.attachment)return e;const{fullWidth:t,fullHeight:r,eye:i}=this.bindParameters.camera,o=n(i);this._compositeParameters.atmosphereC=o**2-this._atmosphereRadius**2,this._compositeParameters.mipmapLevels=this._renderGlowMipMap();const a=this.renderingContext,m=e.obtainDepthTexture();e.acquireColor(w,8,"emissive"),a.bindFramebuffer(e.fbo),a.setViewport(0,0,t,r),a.clearBuffer(1,l);const h=a.setDrawBuffers([P,w]),c=this.techniques.get(_,this._compositeConfiguration);return a.bindTechnique(c,this.bindParameters,this._compositeParameters),a.screen.draw(),a.setDrawBuffers(h),this._compositeParameters.emission=s(this._compositeParameters.emission),this._compositeParameters.mipmapTexture=s(this._compositeParameters.mipmapTexture),e.attachDepth(m),m?.release(),this.fboCache.debugCallback?.("glow-color",e.fbo),e}_renderGlowMipMap(){const e=this.fboCache,{fullWidth:t,fullHeight:s}=this.camera,r=this.renderingContext;this._blurParameters.input=this._compositeParameters.emission?.attachment,this._blurParameters.inputScale=this.bindParameters.useFloatBlend.value?1:d,this._blurParameters.level=0,m(this._blurParameters.size,1,1);const i=Math.floor(.5*t),o=Math.floor(.5*s),a=e.acquire(i,s,"glow horizontal",8);let n,l=i,h=s;const c=this.techniques.get(b),p=r.bindTechnique(c,this.bindParameters,v);for(;l>=1&&h>=1;)this._blurParameters.isHorizontal=!0,this._setupFBO(a,l,h),p.bindDraw(this.bindParameters,v,this._blurParameters),r.screen.draw(),h=Math.floor(.5*h),this._blurParameters.input=a.getTexture(),this._blurParameters.inputScale=1,this._blurParameters.isHorizontal=!1,m(this._blurParameters.size,l/i,h/o),n??=e.acquire(l,h,"glow mipmap",9),this._setupFBO(n,l,h,this._blurParameters.level),p.bindDraw(this.bindParameters,v,this._blurParameters),r.screen.draw(),e.debugCallback?.(n.name,n.fbo),l=Math.floor(.5*l),this._blurParameters.input=n.getTexture(),++this._blurParameters.level;return a.release(),this._compositeParameters.mipmapTexture=n,n&&(n.fbo.level=0),this._blurParameters.level}get _boost(){return 0===this._mode?this._glowBoost.realistic:this._intensity<=.5?t(this._glowBoost.cartographicMin,this._glowBoost.cartographicDefault,2*this._intensity):t(this._glowBoost.cartographicDefault,this._glowBoost.cartographicMax,2*(this._intensity-.5))}get _mode(){return null==this.view.environment.lighting.glow?this.view.environment.atmosphereEnabled?0:2:1}get _intensity(){return this.view.environment.lighting.glow?.intensity??0}_setupFBO(e,t,s,r=0){e.fbo.level=r;const i=this.renderingContext;i.bindFramebuffer(e.fbo),i.setViewport(0,0,t,s),i.setClearColor(0,0,0,0),i.clear(16384)}};e([o()],B.prototype,"consumes",void 0),e([o()],B.prototype,"produces",void 0),B=e([a("esri.views.3d.webgl-engine.effects.glow.Glow")],B);export{B as Glow};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import"../../../../../core/arrayUtils.js";import"../../../../../core/mathUtils.js";import"../../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import"../../core/shaderLibrary/ScreenSpacePass.glsl.js";import"../../core/shaderLibrary/shading/Gamma.glsl.js";import"../../core/shaderModules/Float2PassUniform.js";import"../../core/shaderModules/FloatPassUniform.js";import"../../core/shaderModules/glsl.js";import"../../core/shaderModules/Texture2DPassUniform.js";import"../../../../webgl/NoParameters.js";import"../../../../webgl/ShaderBuilder.js";export{G as GlowBlurPassParameters,b as build}from"../../../../../chunks/GlowBlur.glsl.js";
2
+ import"../../../../../core/arrayUtils.js";import"../../../../../core/mathUtils.js";import"../../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import"../../core/shaderLibrary/ScreenSpacePass.glsl.js";import"../../core/shaderLibrary/shading/Gamma.glsl.js";import"../../core/shaderModules/BooleanDrawUniform.js";import"../../core/shaderModules/Float2DrawUniform.js";import"../../core/shaderModules/FloatDrawUniform.js";import"../../core/shaderModules/glsl.js";import"../../core/shaderModules/Texture2DDrawUniform.js";import"../../../../webgl/NoParameters.js";import"../../../../webgl/ShaderBuilder.js";export{G as GlowBlurDrawParameters,b as build,w as weights}from"../../../../../chunks/GlowBlur.glsl.js";
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import"../../core/shaderLibrary/output/ReadDepth.glsl.js";import"../../core/shaderLibrary/shading/Gamma.glsl.js";import"../../core/shaderModules/FloatPassUniform.js";import"../../core/shaderModules/glsl.js";import"../../core/shaderModules/Texture2DBindUniform.js";import"../../core/shaderModules/Texture2DPassUniform.js";import"../raymarching/DistanceFalloff.glsl.js";import"../../shaders/floatBlendScale.glsl.js";import"../../shaders/ScreenSpacePassAtmosphere.glsl.js";import"../../shaders/ToneMapping.glsl.js";import"../../../../webgl/ShaderBuilder.js";export{G as GlowCompositePassParameters,b as build}from"../../../../../chunks/GlowComposite.glsl.js";
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import{__decorate as e}from"tslib";import{subclass as o}from"../../../../../core/accessorSupport/decorators.js";import{ReloadableShader as r}from"../../core/shaderTechnique/ReloadableShader.js";import{ShaderTechnique as s}from"../../core/shaderTechnique/ShaderTechnique.js";import{a as i}from"../../../../../chunks/GlowComposite.glsl.js";import{makePipelineState as t,defaultColorWrite as l}from"../../../../webgl/renderState.js";let c=class extends s{constructor(){super(...arguments),this.shader=new r(i,()=>import("./GlowComposite.glsl.js"))}initializePipeline(){return t({colorWrite:l})}};c=e([o("esri.views.3d.webgl-engine.effects.glow.GlowCompositeTechnique")],c);export{c as GlowCompositeTechnique};