@arcgis/core 5.1.0-next.25 → 5.1.0-next.27

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 (161) hide show
  1. package/PopupTemplate.d.ts +12 -8
  2. package/README.md +4 -5
  3. package/applications/Components/testUtils.js +1 -1
  4. package/applications/Components/viewUtils.js +1 -1
  5. package/assets/esri/core/workers/RemoteClient.js +1 -1
  6. package/assets/esri/core/workers/chunks/{7a2e9626d0853a6d1547.js → 01e4cc34be6265843258.js} +1 -1
  7. package/assets/esri/core/workers/chunks/0389ebb63510dd7024de.js +2 -0
  8. package/assets/esri/core/workers/chunks/03e20ac54d6f141b5001.js +1 -0
  9. package/assets/esri/core/workers/chunks/049ec6dcb5d9519029fe.js +1 -0
  10. package/assets/esri/core/workers/chunks/{54794b18edc584fd7515.js → 07528211e59740c47aaa.js} +1 -1
  11. package/assets/esri/core/workers/chunks/{6e32e7b2ea2ea1a1fc04.js → 1069b92c2c5fe5f0398b.js} +1 -1
  12. package/assets/esri/core/workers/chunks/17078f4ab1b3e33c80b4.js +1 -0
  13. package/assets/esri/core/workers/chunks/23079a2e584fca0bdb66.js +1 -0
  14. package/assets/esri/core/workers/chunks/{6fde745f3a62e7f5a97d.js → 36fd18a05ba503e6f3b5.js} +1 -1
  15. package/assets/esri/core/workers/chunks/{a78ac951c00f090d9024.js → 3a018c78859b5edec4fd.js} +1 -1
  16. package/assets/esri/core/workers/chunks/{abc2471cfa9430ca5645.js → 3a8f2f6ac3c3e7e71c00.js} +1 -1
  17. package/assets/esri/core/workers/chunks/{7189e03cc24f5c10865a.js → 4490f8eeeb2ee04daa9d.js} +2 -2
  18. package/assets/esri/core/workers/chunks/{593e9c8ac3b3b02deeb9.js → 4b4cf6efde26dd80f4ad.js} +1 -1
  19. package/assets/esri/core/workers/chunks/4e9b3b4b3dcce94c99a5.js +1 -0
  20. package/assets/esri/core/workers/chunks/{14792047c5519dd89828.js → 541619f434b643f0526d.js} +1 -1
  21. package/assets/esri/core/workers/chunks/{4fc6dd1423075e145b29.js → 5fff383615ba93adbf36.js} +1 -1
  22. package/assets/esri/core/workers/chunks/{25bc7c7bc2793d209640.js → 776c0c38b9179dda00b3.js} +1 -1
  23. package/assets/esri/core/workers/chunks/{e6f51f66b71e0d6525ec.js → 8dcc8df5925f66e45b8c.js} +1 -1
  24. package/assets/esri/core/workers/chunks/8eae33c4d8932b7a6bc1.js +1 -0
  25. package/assets/esri/core/workers/chunks/{f5c5a9e771074f780fc8.js → 94563b007647a9c4ad76.js} +1 -1
  26. package/assets/esri/core/workers/chunks/{0140dc583e20b031eac9.js → 952ff668d202e80b43b0.js} +1 -1
  27. package/assets/esri/core/workers/chunks/a061a17b62686f945e81.js +1 -0
  28. package/assets/esri/core/workers/chunks/{835d6dd8c5a00682d879.js → a1eb8c6fd9a885cbaec9.js} +1 -1
  29. package/assets/esri/core/workers/chunks/{9e7eea56e96f012f9ff4.js → a7d06c1553dfb6e83fe6.js} +1 -1
  30. package/assets/esri/core/workers/chunks/b1ddc837a6805a09d0da.js +1 -0
  31. package/assets/esri/core/workers/chunks/b9d68a5dcb50999d3a90.js +1 -0
  32. package/assets/esri/core/workers/chunks/{f12f96770a45ce6d1ed7.js → c3a0b38abf0a12a466fa.js} +1 -1
  33. package/assets/esri/core/workers/chunks/{e2661d39c48376163adf.js → c55c70dde682084867a2.js} +1 -1
  34. package/assets/esri/core/workers/chunks/{2de299ff3a902d380be6.js → c814abf3e67d9eadbc6b.js} +1 -1
  35. package/assets/esri/core/workers/chunks/c9bfe3d8416856c4a657.js +1 -0
  36. package/assets/esri/core/workers/chunks/e4faccd48060349b8da1.js +1 -0
  37. package/assets/esri/core/workers/chunks/{f1c1f7583fa13dff9b5c.js → e611f37bc22f75ce8a06.js} +44 -38
  38. package/assets/esri/core/workers/chunks/{deee88e3f1641c6ef5db.js → ee6f7c5d3c2f187645ff.js} +1 -1
  39. package/assets/esri/core/workers/chunks/ef29e9e575091ef3adbb.js +1 -0
  40. package/assets/esri/core/workers/chunks/{ef267b938327c41727c1.js → f89b7b0ccfbd1e5f9a0f.js} +1 -1
  41. package/assets/esri/core/workers/chunks/{c794f7be868e53ca4a8c.js → fb05f27710fb50691d7a.js} +1 -1
  42. package/assets/esri/themes/base/widgets/_OrientedImageryViewerNavigationUI.scss +4 -1
  43. package/assets/esri/themes/dark/main.css +1 -1
  44. package/assets/esri/themes/light/main.css +1 -1
  45. package/assets/esri/themes/light/view.css +1 -1
  46. package/chunks/ImageMaterial.glsl.js +7 -7
  47. package/chunks/MeasurementArrow.glsl.js +5 -8
  48. package/chunks/ShadowCastAccumulate.glsl.js +5 -10
  49. package/chunks/ShadowHighlight.glsl.js +1 -1
  50. package/chunks/vec3.js +1 -1
  51. package/chunks/vec4.js +1 -1
  52. package/config.d.ts +2 -2
  53. package/config.js +1 -1
  54. package/editing/templateUtils.js +1 -1
  55. package/geometry/support/buffer/math/common.js +1 -1
  56. package/geometry/support/buffer/math/vec3.js +1 -1
  57. package/kernel.js +1 -1
  58. package/layers/Lyr3DWasmPerSceneView.js +1 -1
  59. package/layers/support/FeatureReductionBinning.d.ts +3 -4
  60. package/layers/support/FeatureReductionBinning.js +1 -1
  61. package/layers/support/FeatureReductionCluster.d.ts +3 -4
  62. package/layers/support/FeatureReductionCluster.js +1 -1
  63. package/layers/support/featureReductionProperties.js +1 -1
  64. package/package.json +3 -3
  65. package/renderers/FlowRenderer.d.ts +6 -2
  66. package/support/actions/ActionBase.d.ts +5 -3
  67. package/support/actions/ActionBase.js +1 -1
  68. package/support/basemapDefinitions.js +1 -1
  69. package/support/revision.js +1 -1
  70. package/symbols/Font.d.ts +1 -1
  71. package/symbols/TextSymbol.d.ts +1 -1
  72. package/symbols/cim/CIMSymbolRasterizer.js +1 -1
  73. package/symbols/support/densifyForPreview.js +2 -0
  74. package/symbols/support/previewSymbol2D.js +1 -1
  75. package/views/2d/analysis/AreaMeasurement/AreaMeasurementTool.js +1 -1
  76. package/views/2d/analysis/DistanceMeasurement/DistanceMeasurementTool.js +1 -1
  77. package/views/2d/engine/vectorTiles/VectorTileContainer.js +1 -1
  78. package/views/2d/engine/vectorTiles/expression/expression.js +1 -1
  79. package/views/2d/engine/vectorTiles/shaders/VTLMaterial.js +1 -1
  80. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/vector-tiles/VTLShaderFill.js +1 -1
  81. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/vector-tiles/VTLShaderLine.js +1 -1
  82. package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
  83. package/views/2d/layers/MediaLayerView2D.js +1 -1
  84. package/views/2d/layers/imagery/VectorFieldView2D.js +1 -1
  85. package/views/3d/GroundView3D.js +1 -1
  86. package/views/3d/environment/ChapmanAtmosphere.js +1 -1
  87. package/views/3d/environment/CloudsComposition.js +1 -1
  88. package/views/3d/environment/CloudsRenderer.js +1 -1
  89. package/views/3d/environment/Fog.js +1 -1
  90. package/views/3d/environment/LocalAtmosphere.js +1 -1
  91. package/views/3d/environment/MarsAtmosphere.js +1 -1
  92. package/views/3d/environment/NoiseTextureAtlas.js +1 -1
  93. package/views/3d/environment/Precipitation.js +1 -1
  94. package/views/3d/environment/PrecipitationTechnique.js +1 -1
  95. package/views/3d/layers/MediaLayerView3D.js +1 -1
  96. package/views/3d/layers/PointCloudLayerView3D.js +1 -1
  97. package/views/3d/webgl-engine/core/shaderLibrary/shading/ReadShadowMap.glsl.js +12 -6
  98. package/views/3d/webgl-engine/core/shaderTechnique/ShaderTechniqueRepository.js +1 -1
  99. package/views/3d/webgl-engine/effects/RenderNodes.js +1 -1
  100. package/views/3d/webgl-engine/effects/blit/Blit.js +1 -1
  101. package/views/3d/webgl-engine/effects/focusArea/FocusAreaColorNode.js +1 -1
  102. package/views/3d/webgl-engine/effects/focusArea/FocusAreaColorTechnique.js +1 -1
  103. package/views/3d/webgl-engine/effects/focusArea/FocusAreaMaskNode.js +1 -1
  104. package/views/3d/webgl-engine/effects/glow/GlowBlurTechnique.js +1 -1
  105. package/views/3d/webgl-engine/effects/glow/GlowCompositionTechnique.js +1 -1
  106. package/views/3d/webgl-engine/effects/glow/GlowRenderNode.js +1 -1
  107. package/views/3d/webgl-engine/effects/haze/Haze.js +1 -1
  108. package/views/3d/webgl-engine/effects/haze/HazeCompositingTechnique.js +1 -1
  109. package/views/3d/webgl-engine/effects/highlight/Highlight.js +1 -1
  110. package/views/3d/webgl-engine/effects/highlight/ShadowHighlight.js +1 -1
  111. package/views/3d/webgl-engine/effects/laserlines/LaserLineRenderer.js +1 -1
  112. package/views/3d/webgl-engine/effects/magnifier/Magnifier.js +1 -1
  113. package/views/3d/webgl-engine/effects/smaa/SMAA.js +1 -1
  114. package/views/3d/webgl-engine/effects/smaa/SMAABlendWeightsTechnique.js +1 -1
  115. package/views/3d/webgl-engine/effects/smaa/SMAABlurTechnique.js +1 -1
  116. package/views/3d/webgl-engine/effects/smaa/SMAAEdgeDetectTechnique.js +1 -1
  117. package/views/3d/webgl-engine/effects/ssao/SSAO.js +1 -1
  118. package/views/3d/webgl-engine/effects/stars/Stars.js +1 -1
  119. package/views/3d/webgl-engine/lib/BasisUtil.js +1 -1
  120. package/views/3d/webgl-engine/lib/CutFillColor.js +1 -1
  121. package/views/3d/webgl-engine/lib/CutFillDepth.js +1 -1
  122. package/views/3d/webgl-engine/lib/GaussianSplatRenderNode.js +1 -1
  123. package/views/3d/webgl-engine/lib/Program.js +1 -1
  124. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  125. package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
  126. package/views/3d/webgl-engine/lib/ShadowMap.js +1 -1
  127. package/views/3d/webgl-engine/lib/Viewshed.js +1 -1
  128. package/views/3d/webgl-engine/lib/depthRangeUtils.js +1 -1
  129. package/views/3d/webgl-engine/shaders/ImageMaterial.glsl.js +1 -1
  130. package/views/3d/webgl-engine/shaders/MeasurementArrow.glsl.js +1 -1
  131. package/views/3d/webgl-engine/shaders/MeasurementArrowTechnique.js +1 -1
  132. package/views/3d/webgl-engine/shaders/MeasurementArrowTechniqueConfiguration.js +1 -1
  133. package/views/3d/webgl-engine/shaders/ShadowCastAccumulate.glsl.js +1 -1
  134. package/views/layers/MediaLayerView.d.ts +90 -4
  135. package/views/layers/MediaLayerView.js +1 -1
  136. package/views/support/waitForResources.js +1 -1
  137. package/widgets/Features/FeaturesViewModel.d.ts +14 -19
  138. package/widgets/Features.d.ts +1 -1
  139. package/widgets/Measurement.d.ts +1 -1
  140. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  141. package/widgets/OrientedImageryViewer/components/Arrow.js +1 -1
  142. package/widgets/Popup.d.ts +1 -1
  143. package/widgets/ValuePicker.d.ts +1 -1
  144. package/widgets/support/legacyIcon.js +1 -1
  145. package/assets/esri/core/workers/chunks/1be4e308280149eae4fb.js +0 -1
  146. package/assets/esri/core/workers/chunks/1dcd057695f8db79eca2.js +0 -1
  147. package/assets/esri/core/workers/chunks/1df8330823841b5bb6a5.js +0 -1
  148. package/assets/esri/core/workers/chunks/2063b49607a03f7718ee.js +0 -1
  149. package/assets/esri/core/workers/chunks/2b76a8897ad7ba284d33.js +0 -1
  150. package/assets/esri/core/workers/chunks/36da644678e6acf3bdb5.js +0 -1
  151. package/assets/esri/core/workers/chunks/4754610760f3f634adf9.js +0 -2
  152. package/assets/esri/core/workers/chunks/551fee27bf3abf0c41fd.js +0 -1
  153. package/assets/esri/core/workers/chunks/57b620d7e029747adca3.js +0 -1
  154. package/assets/esri/core/workers/chunks/74e3c224e879edb37812.js +0 -1
  155. package/assets/esri/core/workers/chunks/868c8a152cb1452b9a94.js +0 -1
  156. package/assets/esri/core/workers/chunks/e839c5f3a0213091a399.js +0 -1
  157. package/assets/esri/core/workers/chunks/feececf6809231f72c5a.js +0 -1
  158. package/views/layers/MediaLayerViewMixin.d.ts +0 -109
  159. package/views/layers/MediaLayerViewMixin.js +0 -2
  160. /package/assets/esri/core/workers/chunks/{4754610760f3f634adf9.js.LICENSE.txt → 0389ebb63510dd7024de.js.LICENSE.txt} +0 -0
  161. /package/assets/esri/core/workers/chunks/{7189e03cc24f5c10865a.js.LICENSE.txt → 4490f8eeeb2ee04daa9d.js.LICENSE.txt} +0 -0
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as t}from"tslib";import{lerp as e}from"../../../../../core/mathUtils.js";import{watch as i,syncAndInitial as s}from"../../../../../core/reactiveUtils.js";import{property as r,subclass as o}from"../../../../../core/accessorSupport/decorators.js";import{length as a}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{ZEROS as n}from"../../../../../core/libs/gl-matrix-2/factories/vec4f32.js";import{getReferenceEllipsoid as h}from"../../../../../geometry/ellipsoidUtils.js";import{InternalRenderCategory as c}from"../../../webgl.js";import{TransparentEnvironment as m}from"../TransparentEnvironment.js";import{G as l}from"../../../../../chunks/GlowBlur.glsl.js";import{GlowBlurTechnique as p}from"./GlowBlurTechnique.js";import{GlowBlurTechniqueConfiguration as u}from"./GlowBlurTechniqueConfiguration.js";import{G as g,a as _,m as d}from"../../../../../chunks/GlowComposition.glsl.js";import{GlowCompositionTechnique as f}from"./GlowCompositionTechnique.js";import{GlowCompositionTechniqueConfiguration as w}from"./GlowCompositionTechniqueConfiguration.js";import{ColorAttachment1 as b,DepthStencilAttachment as P}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._blurHorizontalConfiguration=new u,this._blurVerticalConfiguration=new u,this._compositionConfiguration=new w,this._compositionParameters=new g,this._blurParameters=new l,this._blurScalePerLod=3.06,this._logicalBlurRadius=.0037,this._mode=0,this._intensity=.5,this._scatteringFactors={realistic:new _([.8,.12,.05,.02,.01,0]),maximumFog:new _([0,.27,.6,1.05,1.58,2.1],!1),cartographicMin:new _([.4,.18,.25,.12,.05,0],!1),cartographicDefault:new _([1.17,1.08,.78,.4,.26,.11],!1),cartographicMax:new _([3.59,3.9,2.46,1.4,.93,.44],!1)},this._glowResults=new Array;const e=h(t.view.spatialReference);this._atmosphereRadius=e.radius+e.atmosphereHeight;t.view.stage.renderView.techniques.precompile(f,this._compositionConfiguration),this._compositionParameters.minDisperse=new _([.8,.12,.05,.02,.01,0])}initialize(){this.addHandles([i(()=>this._updateFogParameters(),()=>{},s),i(()=>this._updateParameters(),()=>{},s)])}_updateParameters(){const t=this.view.environment.lighting.glow;this._mode=null==t?this.view.environment.atmosphereEnabled?0:2:1,t&&(this._intensity=t.intensity),this._compositionParameters.minDisperse&&(this._compositionParameters.minDisperse.presets=this.getPreset(this._mode)),this.precompile(),this.requestRender(1)}_updateFogParameters(){const t=this.view.environment.weather;"sunny"===t.type||"cloudy"===t.type?this._compositionParameters.distanceModifier=0:this._compositionParameters.distanceModifier="foggy"===t.type?e(3e-5,.005,t.fogStrength**3):e(4e-6,2e-4,(t.precipitation??0)**3),this._compositionParameters.maxDisperse=this._scatteringFactors.maximumFog,this.requestRender(1)}precompile(){this.techniques.precompile(p,this._blurHorizontalConfiguration),this._blurVerticalConfiguration.glowStage=1,this.techniques.precompile(p,this._blurVerticalConfiguration),this._compositionConfiguration.blurEnabled=!0,this.techniques.precompile(f,this._compositionConfiguration),this._compositionConfiguration.blurEnabled=!1,this.techniques.precompile(f,this._compositionConfiguration)}render(t){const e=t.find(({name:t})=>t===c.TRANSPARENT_ENVIRONMENT),i=e.getAttachment(b);if(!i?.attachment)return e;const s=2!==this._mode;this._compositionConfiguration.blurEnabled=s;const r=e.getAttachment(P);if(!s){const t=this.techniques.get(f,this._compositionConfiguration);if(!t.compiled)return this.requestRender(1),e;const s=e.getTexture(),o=this.fboCache,{fullWidth:a,fullHeight:n}=this.bindParameters.camera,h=this.renderingContext,c=o.acquire(s.descriptor.width,s.descriptor.height,this.produces);return this._prepareFBO(c,a,n),this._compositionParameters.color=s,this._compositionParameters.emission=i.attachment,h.bindTechnique(t,this.bindParameters,this._compositionParameters),h.screen.draw(),c.attachDepth(r),c.attachColor(i,b),c}const o=this.techniques.get(p,this._blurHorizontalConfiguration),n=this.techniques.get(p,this._blurVerticalConfiguration),h=this.techniques.get(f,this._compositionConfiguration);if(!o.compiled||!n.compiled||!h.compiled)return this.requestRender(1),e;const m=e.getTexture(),l=this.fboCache,{fullWidth:u,fullHeight:g}=this.bindParameters.camera,_=this.renderingContext;let d=i.attachment,w=Math.ceil(u/2),T=Math.ceil(g/2);const C=5;this._blurParameters.blurRadius=this._logicalBlurRadius;for(let a=0;a<C;a++){const t=l.acquire(w,T,"glow horizontal",8);this._blurParameters.emissionsToDownsample=d,this._prepareFBO(t,w,T),_.bindTechnique(o,this.bindParameters,this._blurParameters),_.screen.draw();const e=l.acquire(w,T,"glow vertical",8);this._blurParameters.emissionsToDownsample=t.getTexture(),this._prepareFBO(e,w,T),_.bindTechnique(n,this.bindParameters,this._blurParameters),_.screen.draw(),t.release(),this._glowResults[a]=e,w=Math.ceil(w/2),T=Math.ceil(T/2),d=this._glowResults[a].getTexture(),this._blurParameters.blurRadius*=this._blurScalePerLod}const R=this.bindParameters.camera,q=a(R.eye);this._compositionParameters.atmosphereC=q**2-this._atmosphereRadius**2,this._compositionParameters.color=m,this._compositionParameters.emission=i.attachment,this._compositionParameters.lodTexture0=this._glowResults[0].getTexture(),this._compositionParameters.lodTexture1=this._glowResults[1].getTexture(),this._compositionParameters.lodTexture2=this._glowResults[2].getTexture(),this._compositionParameters.lodTexture3=this._glowResults[3].getTexture(),this._compositionParameters.lodTexture4=this._glowResults[4].getTexture();const x=l.acquire(m.descriptor.width,m.descriptor.height,this.produces);return x.acquireColor(b,8,"emissive glow"),this._prepareFBO(x,u,g,!0),_.bindTechnique(h,this.bindParameters,this._compositionParameters),_.screen.draw(),this._glowResults.forEach(t=>t.release()),x.attachDepth(r),x}getPreset(t){return 0===t?this._scatteringFactors.realistic.presets:this._intensity<=.5?d(this._scatteringFactors.cartographicMin.presets,this._scatteringFactors.cartographicDefault.presets,2*this._intensity):d(this._scatteringFactors.cartographicDefault.presets,this._scatteringFactors.cartographicMax.presets,2*(this._intensity-.5))}_prepareFBO(t,e,i,s=!1){const r=this.renderingContext;r.bindFramebuffer(t.fbo),r.setViewport(0,0,e,i),r.setClearColor(0,0,0,0),r.clear(16384),s&&r.clearBuffer(1,n)}get test(){return{compositionParameters:this._compositionParameters,blurParameters:this._blurParameters,setBlurLodCombination:t=>{this._compositionParameters.dispersionWeight=t},getPresets:this.getPreset(this._mode),setMinDisperse:(t,e)=>{0===this._mode?this._scatteringFactors.realistic.presets[t]=e:(this._scatteringFactors.cartographicMin.presets[t]=e,this._scatteringFactors.cartographicMax.presets[t]=e)},toggleTonemapping:t=>{this._compositionConfiguration.tonemappingEnabled=t,this.requestRender(1)}}}};t([r()],T.prototype,"consumes",void 0),t([r()],T.prototype,"produces",void 0),T=t([o("esri.views.3d.webgl-engine.effects.glow.GlowRenderNode")],T);export{T as GlowRenderNode};
2
+ import{__decorate as t}from"tslib";import{lerp as e}from"../../../../../core/mathUtils.js";import{watch as i,syncAndInitial as s}from"../../../../../core/reactiveUtils.js";import{property as r,subclass as o}from"../../../../../core/accessorSupport/decorators.js";import{length as a}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{ZEROS as n}from"../../../../../core/libs/gl-matrix-2/factories/vec4f32.js";import{getReferenceEllipsoid as h}from"../../../../../geometry/ellipsoidUtils.js";import{InternalRenderCategory as c}from"../../../webgl.js";import{TransparentEnvironment as m}from"../TransparentEnvironment.js";import{G as l}from"../../../../../chunks/GlowBlur.glsl.js";import{GlowBlurTechnique as u}from"./GlowBlurTechnique.js";import{GlowBlurTechniqueConfiguration as p}from"./GlowBlurTechniqueConfiguration.js";import{G as g,a as _,m as d}from"../../../../../chunks/GlowComposition.glsl.js";import{GlowCompositionTechnique as f}from"./GlowCompositionTechnique.js";import{GlowCompositionTechniqueConfiguration as b}from"./GlowCompositionTechniqueConfiguration.js";import{ColorAttachment1 as w,DepthStencilAttachment as P}from"../../../../webgl/enums.js";let C=class extends m{constructor(t){super(t),this.consumes={required:[c.TRANSPARENT_ENVIRONMENT,"emissive"]},this.produces=c.TRANSPARENT_ENVIRONMENT,this._blurHorizontalConfiguration=new p,this._blurVerticalConfiguration=new p,this._compositionConfiguration=new b,this._compositionParameters=new g,this._blurParameters=new l,this._blurScalePerLod=3.06,this._logicalBlurRadius=.0037,this._mode=0,this._intensity=.5,this._scatteringFactors={realistic:new _([.8,.12,.05,.02,.01,0]),maximumFog:new _([0,.27,.6,1.05,1.58,2.1],!1),cartographicMin:new _([.4,.18,.25,.12,.05,0],!1),cartographicDefault:new _([1.17,1.08,.78,.4,.26,.11],!1),cartographicMax:new _([3.59,3.9,2.46,1.4,.93,.44],!1)},this._glowResults=new Array;const e=h(t.view.spatialReference);this._atmosphereRadius=e.radius+e.atmosphereHeight,this._compositionParameters.minDisperse=new _([.8,.12,.05,.02,.01,0])}initialize(){this.addHandles([i(()=>this._updateFogParameters(),()=>{},s),i(()=>this._updateParameters(),()=>{},s)])}_updateParameters(){const t=this.view.environment.lighting.glow;this._mode=null==t?this.view.environment.atmosphereEnabled?0:2:1,t&&(this._intensity=t.intensity),this._compositionParameters.minDisperse&&(this._compositionParameters.minDisperse.presets=this.getPreset(this._mode)),this.requestRender(1)}_updateFogParameters(){const t=this.view.environment.weather;"sunny"===t.type||"cloudy"===t.type?this._compositionParameters.distanceModifier=0:this._compositionParameters.distanceModifier="foggy"===t.type?e(3e-5,.005,t.fogStrength**3):e(4e-6,2e-4,(t.precipitation??0)**3),this._compositionParameters.maxDisperse=this._scatteringFactors.maximumFog,this.requestRender(1)}precompile(){this._compositionConfiguration.blurEnabled=2!==this._mode,this._compositionConfiguration.blurEnabled&&(this.techniques.precompile(u,this._blurHorizontalConfiguration),this._blurVerticalConfiguration.glowStage=1,this.techniques.precompile(u,this._blurVerticalConfiguration)),this.techniques.precompile(f,this._compositionConfiguration)}render(t){const e=t.find(({name:t})=>t===c.TRANSPARENT_ENVIRONMENT),i=e.getAttachment(w);if(!i?.attachment)return e;const s=e.getAttachment(P);if(2===this._mode){this._compositionConfiguration.blurEnabled=!1;const t=this.techniques.getCompiled(f,this._compositionConfiguration);if(!t)return this.requestRender(1),e;const r=e.getTexture(),o=this.fboCache,{fullWidth:a,fullHeight:n}=this.bindParameters.camera,h=this.renderingContext,c=o.acquire(r.descriptor.width,r.descriptor.height,this.produces);return this._prepareFBO(c,a,n),this._compositionParameters.color=r,this._compositionParameters.emission=i.attachment,h.bindTechnique(t,this.bindParameters,this._compositionParameters),h.screen.draw(),c.attachDepth(s),c.attachColor(i,w),c}this._compositionConfiguration.blurEnabled=!0;const r=this.techniques.getCompiled(u,this._blurHorizontalConfiguration),o=this.techniques.getCompiled(u,this._blurVerticalConfiguration),n=this.techniques.getCompiled(f,this._compositionConfiguration);if(!r||!o||!n)return this.requestRender(1),e;const h=e.getTexture(),m=this.fboCache,{fullWidth:l,fullHeight:p}=this.bindParameters.camera,g=this.renderingContext;let _=i.attachment,d=Math.ceil(l/2),b=Math.ceil(p/2);const C=5;this._blurParameters.blurRadius=this._logicalBlurRadius;for(let a=0;a<C;a++){const t=m.acquire(d,b,"glow horizontal",8);this._blurParameters.emissionsToDownsample=_,this._prepareFBO(t,d,b),g.bindTechnique(r,this.bindParameters,this._blurParameters),g.screen.draw();const e=m.acquire(d,b,"glow vertical",8);this._blurParameters.emissionsToDownsample=t.getTexture(),this._prepareFBO(e,d,b),g.bindTechnique(o,this.bindParameters,this._blurParameters),g.screen.draw(),t.release(),this._glowResults[a]=e,d=Math.ceil(d/2),b=Math.ceil(b/2),_=this._glowResults[a].getTexture(),this._blurParameters.blurRadius*=this._blurScalePerLod}const T=this.bindParameters.camera,R=a(T.eye);this._compositionParameters.atmosphereC=R**2-this._atmosphereRadius**2,this._compositionParameters.color=h,this._compositionParameters.emission=i.attachment,this._compositionParameters.lodTexture0=this._glowResults[0].getTexture(),this._compositionParameters.lodTexture1=this._glowResults[1].getTexture(),this._compositionParameters.lodTexture2=this._glowResults[2].getTexture(),this._compositionParameters.lodTexture3=this._glowResults[3].getTexture(),this._compositionParameters.lodTexture4=this._glowResults[4].getTexture();const x=m.acquire(h.descriptor.width,h.descriptor.height,this.produces);return x.acquireColor(w,8,"emissive glow"),this._prepareFBO(x,l,p,!0),g.bindTechnique(n,this.bindParameters,this._compositionParameters),g.screen.draw(),this._glowResults.forEach(t=>t.release()),x.attachDepth(s),x}getPreset(t){return 0===t?this._scatteringFactors.realistic.presets:this._intensity<=.5?d(this._scatteringFactors.cartographicMin.presets,this._scatteringFactors.cartographicDefault.presets,2*this._intensity):d(this._scatteringFactors.cartographicDefault.presets,this._scatteringFactors.cartographicMax.presets,2*(this._intensity-.5))}_prepareFBO(t,e,i,s=!1){const r=this.renderingContext;r.bindFramebuffer(t.fbo),r.setViewport(0,0,e,i),r.setClearColor(0,0,0,0),r.clear(16384),s&&r.clearBuffer(1,n)}get test(){return{compositionParameters:this._compositionParameters,blurParameters:this._blurParameters,setBlurLodCombination:t=>{this._compositionParameters.dispersionWeight=t},getPresets:this.getPreset(this._mode),setMinDisperse:(t,e)=>{0===this._mode?this._scatteringFactors.realistic.presets[t]=e:(this._scatteringFactors.cartographicMin.presets[t]=e,this._scatteringFactors.cartographicMax.presets[t]=e)},toggleTonemapping:t=>{this._compositionConfiguration.tonemappingEnabled=t,this.requestRender(1)}}}};t([r()],C.prototype,"consumes",void 0),t([r()],C.prototype,"produces",void 0),C=t([o("esri.views.3d.webgl-engine.effects.glow.GlowRenderNode")],C);export{C as GlowRenderNode};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{lerp as t,smoothstep as i}from"../../../../../core/mathUtils.js";import{disposeMaybe as r}from"../../../../../core/maybe.js";import{watch as s,syncAndInitial as o}from"../../../../../core/reactiveUtils.js";import{subclass as a}from"../../../../../core/accessorSupport/decorators.js";import{set as n}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{length as h}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{earth as m}from"../../../../../geometry/support/Ellipsoid.js";import{TransparentEnvironment as c}from"../TransparentEnvironment.js";import{H as u}from"../../../../../chunks/HazeCompositing.glsl.js";import{HazeCompositingTechnique as d}from"./HazeCompositingTechnique.js";import{HazePassParameters as p,HazeTechnique as f}from"./HazeTechnique.js";import{HazeTechniqueConfiguration as l}from"./HazeTechniqueConfiguration.js";import{createQuadVAO as _}from"../../lib/glUtil3D.js";import{applyTextureResizeModulo as g}from"../../lib/textureUtils.js";import{DepthStencilAttachment as b,PrimitiveType as w}from"../../../../webgl/enums.js";let P=class extends c{constructor(e){super(e),this._compositingPassParameters=new u,this._passParameters=new p,this._hazeConfiguration=new l,this._oldAmount=1,this._newAmount=1,this._amount=this._newAmount}initialize(){this.addHandles([s(()=>this.view.environment.atmosphereEnabled,e=>e?this._enable():this._disable(),o),s(()=>this.view.stage?.renderer.renderContext.bind.clouds.fadeFactor??1,e=>this._fade(e),o),s(()=>this.view.environment.weather.type,e=>this._newAmount="rainy"===e?0:1,o),s(()=>this.view.stage.renderer?.highResolutionAtmosphere,e=>this._hazeConfiguration.reduced=!e,o)])}_fade(e){e>=1?(this._amount=this._newAmount,this._oldAmount=this._newAmount):this._amount=e<=0?this._oldAmount:t(this._oldAmount,this._newAmount,e)}destroy(){this._vao=r(this._vao)}precompile(){this.techniques.precompile(f,this._hazeConfiguration),this.techniques.precompile(d)}render(e){const i=e.find(({name:e})=>e===this.produces);if(!this.bindParameters.mainDepth)return i;const r=this.techniques.get(f,this._hazeConfiguration);if(!r.compiled)return i;const s=this.renderingContext,o=i.getAttachment(b);if(this._update(),!this._hazeConfiguration.reduced)return i.detachDepth(),s.bindFramebuffer(i.fbo),s.bindTechnique(r,this.bindParameters,this._passParameters),this._renderCommon(s),i.attachDepth(o),i;const a=this.techniques.get(d);if(!a.compiled)return i;const n=s.getViewport(),c=this.camera,u=h(c.eye)-m.radius;let p;const l=m.atmosphereHeight;if(u<l){const e=Math.min(1,Math.max(0,u/l));p=t(.4,.5,e)}else{const e=Math.min(1,Math.max(0,(u-l)/(15*l)));p=t(.5,1,e)}const _=this.renderingContext.parameters.maxTextureSize,w=g(Math.round(p*c.fullViewport[2]),_),P=g(Math.round(p*c.fullViewport[3]),_);s.setViewport(0,0,w,P);const v=this.fboCache.acquire(w,P,"haze",5);return s.bindFramebuffer(v.fbo),s.clearFramebuffer([0,0,0,1],!0,!0),s.bindTechnique(r,this.bindParameters,this._passParameters),this._renderCommon(s),s.setViewport(n.x,n.y,n.width,n.height),this._compositingPassParameters.color=v.getTexture(),i.detachDepth(),s.bindFramebuffer(i.fbo),s.bindTechnique(a,this.bindParameters,this._compositingPassParameters),s.screen.draw(),i.attachDepth(o),v.release(),i}_renderCommon(e){this._vao??=_(e,1),e.bindVAO(this._vao),e.drawArrays(w.TRIANGLE_STRIP,0,4)}_update(){const e=this.view.basemapTerrain?.getLowerBoundRadius()??0;n(this._passParameters.radii,e,e+m.atmosphereHeight);const r=h(this.bindParameters.camera.eye);this._passParameters.hazeStrength=t(t(.6,1,i(9500,10500,r-m.radius)),1,this._amount)}};P=e([a("esri.views.3d.webgl-engine.effects.haze.Haze")],P);export{P as Haze};
2
+ import{__decorate as e}from"tslib";import{lerp as t,smoothstep as i}from"../../../../../core/mathUtils.js";import{disposeMaybe as r}from"../../../../../core/maybe.js";import{watch as s,syncAndInitial as o}from"../../../../../core/reactiveUtils.js";import{subclass as a}from"../../../../../core/accessorSupport/decorators.js";import{set as n}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{length as h}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{earth as m}from"../../../../../geometry/support/Ellipsoid.js";import{TransparentEnvironment as u}from"../TransparentEnvironment.js";import{H as d}from"../../../../../chunks/HazeCompositing.glsl.js";import{HazeCompositingTechnique as c}from"./HazeCompositingTechnique.js";import{HazePassParameters as p,HazeTechnique as f}from"./HazeTechnique.js";import{HazeTechniqueConfiguration as l}from"./HazeTechniqueConfiguration.js";import{createQuadVAO as _}from"../../lib/glUtil3D.js";import{applyTextureResizeModulo as g}from"../../lib/textureUtils.js";import{DepthStencilAttachment as b,PrimitiveType as w}from"../../../../webgl/enums.js";let C=class extends u{constructor(e){super(e),this._compositingPassParameters=new d,this._passParameters=new p,this._hazeConfiguration=new l,this._oldAmount=1,this._newAmount=1,this._amount=this._newAmount}initialize(){this.addHandles([s(()=>this.view.environment.atmosphereEnabled,e=>e?this._enable():this._disable(),o),s(()=>this.view.stage?.renderer.renderContext.bind.clouds.fadeFactor??1,e=>this._fade(e),o),s(()=>this.view.environment.weather.type,e=>this._newAmount="rainy"===e?0:1,o),s(()=>this.view.stage.renderer?.highResolutionAtmosphere,e=>this._hazeConfiguration.reduced=!e,o)])}_fade(e){e>=1?(this._amount=this._newAmount,this._oldAmount=this._newAmount):this._amount=e<=0?this._oldAmount:t(this._oldAmount,this._newAmount,e)}destroy(){this._vao=r(this._vao)}precompile(){this.techniques.precompile(f,this._hazeConfiguration),this._hazeConfiguration.reduced&&this.techniques.precompile(c)}render(e){const i=e.find(({name:e})=>e===this.produces);if(!this.bindParameters.mainDepth)return i;const r=this.techniques.getCompiled(f,this._hazeConfiguration);if(!r)return i;const s=this.renderingContext,o=i.getAttachment(b);if(this._update(),!this._hazeConfiguration.reduced)return i.detachDepth(),s.bindFramebuffer(i.fbo),s.bindTechnique(r,this.bindParameters,this._passParameters),this._renderCommon(s),i.attachDepth(o),i;const a=this.techniques.getCompiled(c);if(!a)return i;const n=s.getViewport(),u=this.camera,d=h(u.eye)-m.radius;let p;const l=m.atmosphereHeight;if(d<l){const e=Math.min(1,Math.max(0,d/l));p=t(.4,.5,e)}else{const e=Math.min(1,Math.max(0,(d-l)/(15*l)));p=t(.5,1,e)}const _=this.renderingContext.parameters.maxTextureSize,w=g(Math.round(p*u.fullViewport[2]),_),C=g(Math.round(p*u.fullViewport[3]),_);s.setViewport(0,0,w,C);const P=this.fboCache.acquire(w,C,"haze",5);return s.bindFramebuffer(P.fbo),s.clearFramebuffer([0,0,0,1],!0,!0),s.bindTechnique(r,this.bindParameters,this._passParameters),this._renderCommon(s),s.setViewport(n.x,n.y,n.width,n.height),this._compositingPassParameters.color=P.getTexture(),i.detachDepth(),s.bindFramebuffer(i.fbo),s.bindTechnique(a,this.bindParameters,this._compositingPassParameters),s.screen.draw(),i.attachDepth(o),P.release(),i}_renderCommon(e){this._vao??=_(e,1),e.bindVAO(this._vao),e.drawArrays(w.TRIANGLE_STRIP,0,4)}_update(){const e=this.view.basemapTerrain?.getLowerBoundRadius()??0;n(this._passParameters.radii,e,e+m.atmosphereHeight);const r=h(this.bindParameters.camera.eye);this._passParameters.hazeStrength=t(t(.6,1,i(9500,10500,r-m.radius)),1,this._amount)}};C=e([a("esri.views.3d.webgl-engine.effects.haze.Haze")],C);export{C as Haze};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{subclass as r}from"../../../../../core/accessorSupport/decorators.js";import{ReloadableShader as o}from"../../core/shaderTechnique/ReloadableShader.js";import{ShaderTechnique as i}from"../../core/shaderTechnique/ShaderTechnique.js";import{a as s}from"../../../../../chunks/HazeCompositing.glsl.js";import{makePipelineState as t,defaultColorWrite as n,separateBlendingParams as a}from"../../../../webgl/renderState.js";let c=class extends i{constructor(){super(...arguments),this.shader=new o(s,()=>import("./HazeCompositing.glsl.js")),this.ignoreUnused=!0}initializePipeline(){return t({blending:a(1,0,769,1),depthTest:{func:519},colorWrite:n})}};c=e([r("esri.views.3d.webgl-engine.effects.haze.HazeCompositingTechnique")],c);export{c as HazeCompositingTechnique};
2
+ import{__decorate as e}from"tslib";import{subclass as r}from"../../../../../core/accessorSupport/decorators.js";import{ReloadableShader as o}from"../../core/shaderTechnique/ReloadableShader.js";import{ShaderTechnique as i}from"../../core/shaderTechnique/ShaderTechnique.js";import{a as s}from"../../../../../chunks/HazeCompositing.glsl.js";import{makePipelineState as t,defaultColorWrite as n,separateBlendingParams as a}from"../../../../webgl/renderState.js";let c=class extends i{constructor(){super(...arguments),this.shader=new o(s,()=>import("./HazeCompositing.glsl.js"))}initializePipeline(){return t({blending:a(1,0,769,1),depthTest:{func:519},colorWrite:n})}};c=e([r("esri.views.3d.webgl-engine.effects.haze.HazeCompositingTechnique")],c);export{c as HazeCompositingTechnique};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import"../../../../../core/has.js";import{releaseMaybe as t,disposeMaybe as i}from"../../../../../core/maybe.js";import{watch as r,initial as s}from"../../../../../core/reactiveUtils.js";import{property as o,subclass as h}from"../../../../../core/accessorSupport/decorators.js";import{set as n}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{InternalRenderCategory as l}from"../../../webgl.js";import a from"../../../webgl/RenderNode.js";import{HighlightApplyTechnique as g}from"./HighlightApplyTechnique.js";import{H as c}from"../../../../../chunks/HighlightBlur.glsl.js";import{HighlightBlurTechnique as u}from"./HighlightBlurTechnique.js";import{H as m,g as p}from"../../../../../chunks/HighlightDownsample.glsl.js";import{HighlightDownsampleTechnique as d}from"./HighlightDownsampleTechnique.js";import{HighlightPassParameters as f}from"./HighlightPassParameters.js";import{HighlightToSingleTechnique as b}from"./HighlightToSingleTechnique.js";import{NoVertex as w}from"../../lib/DefaultVertexBufferLayouts.js";import{VertexArrayObject as x}from"../../lib/VertexArrayObject.js";import{BufferObject as T}from"../../../../webgl/BufferObject.js";import{PrimitiveType as _,DataType as C}from"../../../../webgl/enums.js";import v from"../../../../webgl/Texture.js";import{TextureDescriptor as O}from"../../../../webgl/TextureDescriptor.js";import{VertexBuffer as H}from"../../../../webgl/VertexBuffer.js";let j=class extends a{constructor(){super(...arguments),this.produces=l.HIGHLIGHT_COLOR,this.consumes={required:[l.HIGHLIGHT_COLOR,"highlights"]},this._downsampleDrawParameters=new m,this._passParameters=new f,this._highlightBlurDrawParameters=new c,this._grid=new P}initialize(){this.addHandles([r(()=>this._updateOptionsTexture(),()=>{},s)])}destroy(){this._grid.coverage=t(this._grid.coverage),this._grid.vao=i(this._grid.vao),this._passParameters.highlightOptionsTexture=t(this._passParameters.highlightOptionsTexture)}_updateOptionsTexture(){if(null==this._passParameters.highlightOptionsTexture){const e=new O(16,2);e.internalFormat=6408,e.samplingMode=9728,this._passParameters.highlightOptionsTexture=new v(this.renderingContext,e,null)}this._passParameters.highlightOptionsTexture.setData(q(this.view.state.highlights)),this.requestRender(1)}precompile(){this.bindParameters.decorations&&(this.techniques.precompile(d),this.techniques.precompile(b),this.techniques.precompile(u),this.techniques.precompile(g))}render(e){const t=e.find(({name:e})=>e===l.HIGHLIGHT_COLOR),{techniques:i,bindParameters:r}=this;if(!r.decorations)return t;if(!i.get(d).compiled)return this.requestRender(1),t;const s=e.find(({name:e})=>"highlights"===e).getTexture();return this._renderHighlightPostprocess(s,t),t}_prepareAndDownSample(e){this._gridUpdateResources(e);const t=this.techniques.get(d),i=this._gridComputeCoverage(t,e),{horizontalCellCount:r,verticalCellCount:s}=i,o=this._passParameters;return o.horizontalCellCount=r,o.verticalCellCount=s,o.coverageTexture=i.coverage?.getTexture(),i}_renderGrid(e){const t=e.verticalCellCount*e.horizontalCellCount;this.renderingContext.bindVAO(e.vao),this.renderingContext.drawElementsInstanced(_.TRIANGLES,6,C.UNSIGNED_BYTE,0,t)}_renderHighlightPostprocess(e,t){const{fboCache:i,techniques:r,bindParameters:s,_passParameters:o,renderingContext:h}=this,l=r.get(b),a=r.get(u),c=r.get(g);if(!c.compiled||!a.compiled||!l.compiled)return void this.requestRender(1);o.highlightTexture=e;const m=this._prepareAndDownSample(e),{width:p,height:d}=e.descriptor;o.highlightTexture=e;const{camera:f}=s,{fullWidth:w,fullHeight:x,pixelRatio:T,fullViewport:_}=f,C=Math.ceil(w/T),v=Math.ceil(x/T),{_highlightBlurDrawParameters:O}=this,H=this.view.stage.renderView.renderer,{highlights:j}=s;for(let g=0;g<j.length;++g){const{name:e}=j[g];if(!H.hasHighlight(e))continue;o.highlightLevel=g,h.setClearColor(0,0,0,0);const r=i.acquire(p,d,"single highlight",2);h.bindFramebuffer(r.fbo),h.setViewport(0,0,p,d),h.clear(16384),h.bindTechnique(l,s,o),this._renderGrid(m),O.blurInput=r.getTexture(),n(O.blurSize,1/C,0);const u=i.acquire(C,v,"single highlight blur",2);h.unbindTexture(u.fbo?.colorTexture),h.bindFramebuffer(u.fbo),h.setViewport(0,0,C,v),h.clear(16384),h.bindTechnique(a,s,o,O),this._renderGrid(m),r.release(),n(O.blurSize,0,1/v),o.highlightBlurTexture=u.getTexture(),h.bindFramebuffer(t.fbo),h.setViewport4fv(_),h.bindTechnique(c,s,o,O),this._renderGrid(m),u.release()}o.coverageTexture=o.highlightTexture=null}_gridUpdateResources(e){const t=this._grid,{width:i,height:r}=e.descriptor;if(t.horizontalCellCount=Math.ceil(i/p),t.verticalCellCount=Math.ceil(r/p),t.vao)return;const s=this.renderingContext,o=T.createIndex(s,35044,R);t.vao=new x(s,new H(s,w),o)}_gridComputeCoverage(e,t){const i=this.renderingContext,r=this._grid,s=t.descriptor,o=Math.ceil(s.width/p),h=Math.ceil(s.height/p);this._downsampleDrawParameters.input=t;const{highlights:n}=this.bindParameters;r.coverage?.release();const l=this.fboCache.acquire(o,h,"highlight coverage",n.length>G?3:1);return r.coverage=l,i.bindFramebuffer(l.fbo),i.bindTechnique(e,this.bindParameters,this._passParameters,this._downsampleDrawParameters),i.setViewport(0,0,o,h),i.screen.draw(),r}get test(){}};e([o()],j.prototype,"produces",void 0),e([o()],j.prototype,"consumes",void 0),j=e([h("esri.views.3d.webgl-engine.effects.highlight.Highlight")],j);class P{constructor(){this.coverage=null,this.vao=null,this.verticalCellCount=0,this.horizontalCellCount=0,this.viewportWidth=0,this.viewportHeight=0}}function q(e){const t=new Uint8Array(128);let i=0;for(const r of e){const e=4*i,s=4*i+64;++i;const{color:o}=r,h=r.haloColor??o;t[e+0]=o.r,t[e+1]=o.g,t[e+2]=o.b,t[e+3]=r.fillOpacity*o.a*255,t[s+0]=h.r,t[s+1]=h.g,t[s+2]=h.b,t[s+3]=r.haloOpacity*h.a*255}return t}let D=0;function y(e){let t=0;for(const r of e){const{name:e}=r;t+=e.length;const{color:i,fillOpacity:s,haloColor:o,haloOpacity:h}=r;t+=i.r+i.g+i.b+i.a+s,t+=o?o.r+o.g+o.b+o.a+h:0}const i=e.at(0);if(i){const{shadowOpacity:e,shadowDifference:r,shadowColor:s}=i;t+=e+r+s.r+s.g+s.b+s.a}return D+++(t>=0?0:1)}const R=new Uint8Array([0,1,2,2,1,3]);function I(e,t,i,r,s,o,h=0){const{highlights:l}=s,a=l.length>1?t.acquire(i,r,"highlight mix",l.length>G?3:1):null,{gl:g}=e;if(a){const t=e.getBoundFramebufferObject();e.bindFramebuffer(a.fbo),g.clearBufferuiv(g.COLOR,0,[0,0,0,0]),e.bindFramebuffer(t)}const c=a?.getTexture();s.highlightMixTexture=c,n(s.highlightMixOrigin,h,0),l.forEach((t,n)=>{if(n>0){const t=v.TEXTURE_UNIT_FOR_UPDATES;e.bindTexture(c,t),e.setActiveTexture(t),g.copyTexSubImage2D(3553,0,0,0,h,0,i,r),e.bindTexture(null,t)}e.clear(256),s.highlightLevel=n,o()}),s.highlightLevel=null,s.highlightMixTexture=null,a?.release()}const G=4;export{j as Highlight,G as maxHighlightsPerChannel,I as renderHighlightBuffer,y as trackHighlightOptions};
2
+ import{__decorate as e}from"tslib";import"../../../../../core/has.js";import{releaseMaybe as t,disposeMaybe as i}from"../../../../../core/maybe.js";import{watch as r,initial as s}from"../../../../../core/reactiveUtils.js";import{property as o,subclass as h}from"../../../../../core/accessorSupport/decorators.js";import{set as n}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{InternalRenderCategory as l}from"../../../webgl.js";import a from"../../../webgl/RenderNode.js";import{HighlightApplyTechnique as g}from"./HighlightApplyTechnique.js";import{H as c}from"../../../../../chunks/HighlightBlur.glsl.js";import{HighlightBlurTechnique as u}from"./HighlightBlurTechnique.js";import{H as m,g as p}from"../../../../../chunks/HighlightDownsample.glsl.js";import{HighlightDownsampleTechnique as d}from"./HighlightDownsampleTechnique.js";import{HighlightPassParameters as f}from"./HighlightPassParameters.js";import{HighlightToSingleTechnique as b}from"./HighlightToSingleTechnique.js";import{NoVertex as w}from"../../lib/DefaultVertexBufferLayouts.js";import{VertexArrayObject as x}from"../../lib/VertexArrayObject.js";import{BufferObject as T}from"../../../../webgl/BufferObject.js";import{PrimitiveType as C,DataType as _}from"../../../../webgl/enums.js";import v from"../../../../webgl/Texture.js";import{TextureDescriptor as O}from"../../../../webgl/TextureDescriptor.js";import{VertexBuffer as H}from"../../../../webgl/VertexBuffer.js";let j=class extends a{constructor(){super(...arguments),this.produces=l.HIGHLIGHT_COLOR,this.consumes={required:[l.HIGHLIGHT_COLOR,"highlights"]},this._downsampleDrawParameters=new m,this._passParameters=new f,this._highlightBlurDrawParameters=new c,this._grid=new P}initialize(){this.addHandles([r(()=>this._updateOptionsTexture(),()=>{},s)])}destroy(){this._grid.coverage=t(this._grid.coverage),this._grid.vao=i(this._grid.vao),this._passParameters.highlightOptionsTexture=t(this._passParameters.highlightOptionsTexture)}_updateOptionsTexture(){if(null==this._passParameters.highlightOptionsTexture){const e=new O(16,2);e.internalFormat=6408,e.samplingMode=9728,this._passParameters.highlightOptionsTexture=new v(this.renderingContext,e,null)}this._passParameters.highlightOptionsTexture.setData(q(this.view.state.highlights)),this.requestRender(1)}precompile(){this.bindParameters.decorations&&(this.techniques.precompile(d),this.techniques.precompile(b),this.techniques.precompile(u),this.techniques.precompile(g))}render(e){const t=e.find(({name:e})=>e===l.HIGHLIGHT_COLOR),{techniques:i,bindParameters:r}=this;if(!r.decorations)return t;if(!i.getCompiled(d))return this.requestRender(1),t;const s=e.find(({name:e})=>"highlights"===e).getTexture();return this._renderHighlightPostprocess(s,t),t}_prepareAndDownSample(e){this._gridUpdateResources(e);const t=this.techniques.get(d),i=this._gridComputeCoverage(t,e),{horizontalCellCount:r,verticalCellCount:s}=i,o=this._passParameters;return o.horizontalCellCount=r,o.verticalCellCount=s,o.coverageTexture=i.coverage?.getTexture(),i}_renderGrid(e){const t=e.verticalCellCount*e.horizontalCellCount;this.renderingContext.bindVAO(e.vao),this.renderingContext.drawElementsInstanced(C.TRIANGLES,6,_.UNSIGNED_BYTE,0,t)}_renderHighlightPostprocess(e,t){const{fboCache:i,techniques:r,bindParameters:s,_passParameters:o,renderingContext:h}=this,l=r.getCompiled(b),a=r.getCompiled(u),c=r.getCompiled(g);if(!c||!a||!l)return void this.requestRender(1);o.highlightTexture=e;const m=this._prepareAndDownSample(e),{width:p,height:d}=e.descriptor;o.highlightTexture=e;const{camera:f}=s,{fullWidth:w,fullHeight:x,pixelRatio:T,fullViewport:C}=f,_=Math.ceil(w/T),v=Math.ceil(x/T),{_highlightBlurDrawParameters:O}=this,H=this.view.stage.renderView.renderer,{highlights:j}=s;for(let g=0;g<j.length;++g){const{name:e}=j[g];if(!H.hasHighlight(e))continue;o.highlightLevel=g,h.setClearColor(0,0,0,0);const r=i.acquire(p,d,"single highlight",2);h.bindFramebuffer(r.fbo),h.setViewport(0,0,p,d),h.clear(16384),h.bindTechnique(l,s,o),this._renderGrid(m),O.blurInput=r.getTexture(),n(O.blurSize,1/_,0);const u=i.acquire(_,v,"single highlight blur",2);h.unbindTexture(u.fbo?.colorTexture),h.bindFramebuffer(u.fbo),h.setViewport(0,0,_,v),h.clear(16384),h.bindTechnique(a,s,o,O),this._renderGrid(m),r.release(),n(O.blurSize,0,1/v),o.highlightBlurTexture=u.getTexture(),h.bindFramebuffer(t.fbo),h.setViewport4fv(C),h.bindTechnique(c,s,o,O),this._renderGrid(m),u.release()}o.coverageTexture=o.highlightTexture=null}_gridUpdateResources(e){const t=this._grid,{width:i,height:r}=e.descriptor;if(t.horizontalCellCount=Math.ceil(i/p),t.verticalCellCount=Math.ceil(r/p),t.vao)return;const s=this.renderingContext,o=T.createIndex(s,35044,R);t.vao=new x(s,new H(s,w),o)}_gridComputeCoverage(e,t){const i=this.renderingContext,r=this._grid,s=t.descriptor,o=Math.ceil(s.width/p),h=Math.ceil(s.height/p);this._downsampleDrawParameters.input=t;const{highlights:n}=this.bindParameters;r.coverage?.release();const l=this.fboCache.acquire(o,h,"highlight coverage",n.length>G?3:1);return r.coverage=l,i.bindFramebuffer(l.fbo),i.bindTechnique(e,this.bindParameters,this._passParameters,this._downsampleDrawParameters),i.setViewport(0,0,o,h),i.screen.draw(),r}get test(){}};e([o()],j.prototype,"produces",void 0),e([o()],j.prototype,"consumes",void 0),j=e([h("esri.views.3d.webgl-engine.effects.highlight.Highlight")],j);class P{constructor(){this.coverage=null,this.vao=null,this.verticalCellCount=0,this.horizontalCellCount=0,this.viewportWidth=0,this.viewportHeight=0}}function q(e){const t=new Uint8Array(128);let i=0;for(const r of e){const e=4*i,s=4*i+64;++i;const{color:o}=r,h=r.haloColor??o;t[e+0]=o.r,t[e+1]=o.g,t[e+2]=o.b,t[e+3]=r.fillOpacity*o.a*255,t[s+0]=h.r,t[s+1]=h.g,t[s+2]=h.b,t[s+3]=r.haloOpacity*h.a*255}return t}let D=0;function y(e){let t=0;for(const r of e){const{name:e}=r;t+=e.length;const{color:i,fillOpacity:s,haloColor:o,haloOpacity:h}=r;t+=i.r+i.g+i.b+i.a+s,t+=o?o.r+o.g+o.b+o.a+h:0}const i=e.at(0);if(i){const{shadowOpacity:e,shadowDifference:r,shadowColor:s}=i;t+=e+r+s.r+s.g+s.b+s.a}return D+++(t>=0?0:1)}const R=new Uint8Array([0,1,2,2,1,3]);function I(e,t,i,r,s,o,h=0){const{highlights:l}=s,a=l.length>1?t.acquire(i,r,"highlight mix",l.length>G?3:1):null,{gl:g}=e;if(a){const t=e.getBoundFramebufferObject();e.bindFramebuffer(a.fbo),g.clearBufferuiv(g.COLOR,0,[0,0,0,0]),e.bindFramebuffer(t)}const c=a?.getTexture();s.highlightMixTexture=c,n(s.highlightMixOrigin,h,0),l.forEach((t,n)=>{if(n>0){const t=v.TEXTURE_UNIT_FOR_UPDATES;e.bindTexture(c,t),e.setActiveTexture(t),g.copyTexSubImage2D(3553,0,0,0,h,0,i,r),e.bindTexture(null,t)}e.clear(256),s.highlightLevel=n,o()}),s.highlightLevel=null,s.highlightMixTexture=null,a?.release()}const G=4;export{j as Highlight,G as maxHighlightsPerChannel,I as renderHighlightBuffer,y as trackHighlightOptions};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{smoothstep as t,clamp as i}from"../../../../../core/mathUtils.js";import{watch as s,syncAndInitial as r}from"../../../../../core/reactiveUtils.js";import{property as a,subclass as h}from"../../../../../core/accessorSupport/decorators.js";import{normalize as o,set as c,dot as n}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as d}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{RenderNodeOutput as p}from"../../../webgl.js";import m from"../../../webgl/RenderNode.js";import{ShadowHighlightPassParameters as l,ShadowHighlightTechnique as u}from"./ShadowHighlightTechnique.js";import{defaultShadowOpacity as g,defaultShadowDifference as f,defaultShadowColor as w}from"../../../../support/HighlightDefaults.js";const _=1/512,O=4e4,y=5e4;let P=class extends m{constructor(e){super(e),this.produces=p.COMPOSITE,this.consumes={required:[p.COMPOSITE,"highlights"]},this._passParameters=new l,this._maxOpacity=1,this._shadowDifference=.2}initialize(){this.addHandles([s(()=>this.view.defaultHighlight?.shadowOpacity,e=>{this._passParameters.shadowOpacity=e??g,this._updateOccludedShadowOpacity(),this._ensureMaxOpacity()},r),s(()=>this.view.defaultHighlight?.shadowDifference,e=>{this._shadowDifference=e??f,this._updateOccludedShadowOpacity(),this._ensureMaxOpacity()},r),s(()=>this.view.defaultHighlight?.shadowColor,e=>{this._passParameters.shadowColor=(e??w).toUnitRGBA(),this._ensureMaxOpacity()},r)])}_updateOccludedShadowOpacity(){this._passParameters.occludedShadowOpacity=this._passParameters.shadowOpacity*(1-this._shadowDifference)}_ensureMaxOpacity(){const e=Math.max(this._passParameters.shadowOpacity,this._passParameters.occludedShadowOpacity);this._maxOpacity=e*this._passParameters.shadowColor[3],this.requestRender(1)}precompile(){this._ensureIfVisible()&&this.techniques.precompile(u)}render(e){const t=e.find(({name:e})=>e===p.COMPOSITE),i=this.bindParameters;if(!i.shadowHighlightsVisible||!i.depth||!this._ensureIfVisible())return t;const s=this.techniques.get(u);if(!s.compiled)return this.requestRender(1),t;this._passParameters.highlightTexture=e.find(({name:e})=>"highlights"===e)?.getTexture(),this._passParameters.origin=i.camera.center;const r=this.renderingContext;return r.bindFramebuffer(t.fbo),r.bindTechnique(s,i,this._passParameters),r.screen.draw(),t}_ensureIfVisible(){const e=this.bindParameters;if(!e.shadowHighlightsVisible||!e.depth)return!1;const{camera:s,lighting:r}=e;this._passParameters.opacityElevation=1-t(O,y,s.relativeElevation);const a=1===this.viewingMode?o(b,s.center):c(b,0,0,1),h=n(a,r.mainLight.direction);return this._passParameters.dayNightTerminator=t(0,1,i(30*h,0,1)),this._maxOpacity*this._passParameters.opacityElevation*this._passParameters.dayNightTerminator>=_}};e([a()],P.prototype,"produces",void 0),e([a()],P.prototype,"consumes",void 0),e([a({constructOnly:!0})],P.prototype,"viewingMode",void 0),P=e([h("esri.views.3d.webgl-engine.effects.highlight.ShadowHighlight")],P);const b=d();export{P as ShadowHighlight};
2
+ import{__decorate as e}from"tslib";import{smoothstep as t,clamp as i}from"../../../../../core/mathUtils.js";import{watch as s,syncAndInitial as r}from"../../../../../core/reactiveUtils.js";import{property as a,subclass as h}from"../../../../../core/accessorSupport/decorators.js";import{normalize as o,set as c,dot as n}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as d}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{RenderNodeOutput as p}from"../../../webgl.js";import m from"../../../webgl/RenderNode.js";import{ShadowHighlightPassParameters as l,ShadowHighlightTechnique as u}from"./ShadowHighlightTechnique.js";import{defaultShadowOpacity as g,defaultShadowDifference as f,defaultShadowColor as w}from"../../../../support/HighlightDefaults.js";const _=1/512,O=4e4,y=5e4;let P=class extends m{constructor(e){super(e),this.produces=p.COMPOSITE,this.consumes={required:[p.COMPOSITE,"highlights"]},this._passParameters=new l,this._maxOpacity=1,this._shadowDifference=.2}initialize(){this.addHandles([s(()=>this.view.defaultHighlight?.shadowOpacity,e=>{this._passParameters.shadowOpacity=e??g,this._updateOccludedShadowOpacity(),this._ensureMaxOpacity()},r),s(()=>this.view.defaultHighlight?.shadowDifference,e=>{this._shadowDifference=e??f,this._updateOccludedShadowOpacity(),this._ensureMaxOpacity()},r),s(()=>this.view.defaultHighlight?.shadowColor,e=>{this._passParameters.shadowColor=(e??w).toUnitRGBA(),this._ensureMaxOpacity()},r)])}_updateOccludedShadowOpacity(){this._passParameters.occludedShadowOpacity=this._passParameters.shadowOpacity*(1-this._shadowDifference)}_ensureMaxOpacity(){const e=Math.max(this._passParameters.shadowOpacity,this._passParameters.occludedShadowOpacity);this._maxOpacity=e*this._passParameters.shadowColor[3],this.requestRender(1)}precompile(){this._ensureIfVisible()&&this.techniques.precompile(u)}render(e){const t=e.find(({name:e})=>e===p.COMPOSITE),i=this.bindParameters;if(!i.shadowHighlightsVisible||!i.depth||!this._ensureIfVisible())return t;const s=this.techniques.getCompiled(u);if(!s)return this.requestRender(1),t;this._passParameters.highlightTexture=e.find(({name:e})=>"highlights"===e)?.getTexture(),this._passParameters.origin=i.camera.center;const r=this.renderingContext;return r.bindFramebuffer(t.fbo),r.bindTechnique(s,i,this._passParameters),r.screen.draw(),t}_ensureIfVisible(){const e=this.bindParameters;if(!e.shadowHighlightsVisible||!e.depth)return!1;const{camera:s,lighting:r}=e;this._passParameters.opacityElevation=1-t(O,y,s.relativeElevation);const a=1===this.viewingMode?o(b,s.center):c(b,0,0,1),h=n(a,r.mainLight.direction);return this._passParameters.dayNightTerminator=t(0,1,i(30*h,0,1)),this._maxOpacity*this._passParameters.opacityElevation*this._passParameters.dayNightTerminator>=_}};e([a()],P.prototype,"produces",void 0),e([a()],P.prototype,"consumes",void 0),e([a({constructOnly:!0})],P.prototype,"viewingMode",void 0),P=e([h("esri.views.3d.webgl-engine.effects.highlight.ShadowHighlight")],P);const b=d();export{P as ShadowHighlight};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import"../../../../../core/has.js";import{disposeMaybe as t}from"../../../../../core/maybe.js";import{property as i,subclass as n}from"../../../../../core/accessorSupport/decorators.js";import{copy as s,add as r}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{fromRay as a,getStart as l,getEnd as h,create as o}from"../../../../../geometry/support/clipRay.js";import{intersectClipRay as c}from"../../../../../geometry/support/frustum.js";import{copy as d}from"../../../../../geometry/support/lineSegment.js";import{wrap as p}from"../../../../../geometry/support/ray.js";import{InternalRenderCategory as u}from"../../../webgl.js";import m from"../../../webgl/RenderNode.js";import{Blit as g}from"../blit/Blit.js";import{LaserlinePathData as _}from"./LaserlinePathData.js";import{LaserlinePathPassParameters as b,LaserlinePathTechnique as f}from"./LaserlinePathTechnique.js";import{LaserlinePathTechniqueConfiguration as P}from"./LaserlinePathTechniqueConfiguration.js";import{LaserlineTechnique as E}from"./LaserlineTechnique.js";import{LaserlineTechniqueConfiguration as q}from"./LaserlineTechniqueConfiguration.js";import{updateParameters as V}from"../../materials/internal/MaterialUtil.js";let L=class extends m{constructor(e){super(e),this.isDecoration=!0,this.produces=u.LASERLINES,this.consumes={required:[u.LASERLINES,"normals"]},this.requireGeometryDepth=!0,this._configuration=new q,this._pathTechniqueConfiguration=new P,this._heightManifoldEnabled=!1,this._pointDistanceEnabled=!1,this._lineVerticalPlaneEnabled=!1,this._intersectsLineEnabled=!1,this._intersectsLineInfinite=!1,this._pathVerticalPlaneEnabled=!1,this._passParameters=new b;const t=e.view.stage.renderView.techniques,i=new P;i.contrastControlEnabled=e.contrastControlEnabled,t.precompile(f,i)}initialize(){this._passParameters.renderCoordsHelper=this.view.renderCoordsHelper,this._pathTechniqueConfiguration.spherical=1===this.view.state.viewingMode,this._pathTechniqueConfiguration.contrastControlEnabled=this.contrastControlEnabled,this._techniques.precompile(f,this._pathTechniqueConfiguration),this._blit=new g(this._techniques,2)}destroy(){this._pathVerticalPlaneData=t(this._pathVerticalPlaneData),this._blit=null}get _techniques(){return this.view.stage.renderView.techniques}get heightManifoldEnabled(){return this._heightManifoldEnabled}set heightManifoldEnabled(e){this._heightManifoldEnabled!==e&&(this._heightManifoldEnabled=e,this.requestRender(1))}get heightManifoldTarget(){return this._passParameters.heightManifoldTarget}set heightManifoldTarget(e){s(this._passParameters.heightManifoldTarget,e),this.requestRender(1)}get pointDistanceEnabled(){return this._pointDistanceEnabled}set pointDistanceEnabled(e){e!==this._pointDistanceEnabled&&(this._pointDistanceEnabled=e,this.requestRender(1))}get pointDistanceTarget(){return this._passParameters.pointDistanceTarget}set pointDistanceTarget(e){s(this._passParameters.pointDistanceTarget,e),this.requestRender(1)}get pointDistanceOrigin(){return this._passParameters.pointDistanceOrigin}set pointDistanceOrigin(e){s(this._passParameters.pointDistanceOrigin,e),this.requestRender(1)}get lineVerticalPlaneEnabled(){return this._lineVerticalPlaneEnabled}set lineVerticalPlaneEnabled(e){e!==this._lineVerticalPlaneEnabled&&(this._lineVerticalPlaneEnabled=e,this.requestRender(1))}get lineVerticalPlaneSegment(){return this._passParameters.lineVerticalPlaneSegment}set lineVerticalPlaneSegment(e){d(e,this._passParameters.lineVerticalPlaneSegment),this.requestRender(1)}get intersectsLineEnabled(){return this._intersectsLineEnabled}set intersectsLineEnabled(e){e!==this._intersectsLineEnabled&&(this._intersectsLineEnabled=e,this.requestRender(1))}get intersectsLineSegment(){return this._passParameters.intersectsLineSegment}set intersectsLineSegment(e){d(e,this._passParameters.intersectsLineSegment),this.requestRender(1)}get intersectsLineInfinite(){return this._intersectsLineInfinite}set intersectsLineInfinite(e){e!==this._intersectsLineInfinite&&(this._intersectsLineInfinite=e,this.requestRender(1))}get pathVerticalPlaneEnabled(){return this._pathVerticalPlaneEnabled}set pathVerticalPlaneEnabled(e){e!==this._pathVerticalPlaneEnabled&&(this._pathVerticalPlaneEnabled=e,null!=this._pathVerticalPlaneData&&this.requestRender(1))}set pathVerticalPlaneVertices(e){null==this._pathVerticalPlaneData&&(this._pathVerticalPlaneData=new _(this._passParameters.renderCoordsHelper)),this._pathVerticalPlaneData.vertices=e,this.pathVerticalPlaneEnabled&&this.requestRender(1)}set pathVerticalPlaneBuffers(e){null==this._pathVerticalPlaneData&&(this._pathVerticalPlaneData=new _(this._passParameters.renderCoordsHelper)),this._pathVerticalPlaneData.buffers=e,this.pathVerticalPlaneEnabled&&this.requestRender(1)}setParameters(e){V(this._passParameters,e)&&this.requestRender(1)}precompile(){this._acquireTechnique(),this._blit?.precompile(),this.pathVerticalPlaneEnabled&&this._pathVerticalPlaneData&&this._techniques.precompile(f,this._pathTechniqueConfiguration)}render(e){const t=e.find(({name:e})=>e===this.produces);if(this.isDecoration&&!this.bindParameters.decorations||null==this._blit)return t;const i=this.renderingContext,n=e.find(({name:e})=>"normals"===e);this._passParameters.normals=n?.getTexture();const s=()=>{(this.heightManifoldEnabled||this.pointDistanceEnabled||this.lineVerticalPlaneSegment||this.intersectsLineEnabled)&&this._renderUnified(),this.pathVerticalPlaneEnabled&&this._renderPath()};if(!this.contrastControlEnabled)return i.bindFramebuffer(t.fbo),s(),t;this._passParameters.colors=t.getTexture();const r=this.fboCache.acquire(t.fbo.width,t.fbo.height,"laser lines");return i.bindFramebuffer(r.fbo),i.setClearColor(0,0,0,0),i.clear(16640),s(),i.unbindTexture(t.getTexture()),this._blit.blend(i,r,t,this.bindParameters)||this.requestRender(1),r.release(),t}_acquireTechnique(){return this._configuration.heightManifoldEnabled=this.heightManifoldEnabled,this._configuration.lineVerticalPlaneEnabled=this.lineVerticalPlaneEnabled,this._configuration.pointDistanceEnabled=this.pointDistanceEnabled,this._configuration.intersectsLineEnabled=this.intersectsLineEnabled,this._configuration.contrastControlEnabled=this.contrastControlEnabled,this._configuration.spherical=1===this.view.state.viewingMode,this._techniques.get(E,this._configuration)}_renderUnified(){if(!this._updatePassParameters())return;const e=this._acquireTechnique();if(e.compiled){const t=this.renderingContext;t.bindTechnique(e,this.bindParameters,this._passParameters),t.screen.draw()}else this.requestRender(1)}_renderPath(){if(null==this._pathVerticalPlaneData)return;const e=this._techniques.get(f,this._pathTechniqueConfiguration);if(e.compiled){const t=this.renderingContext;this._passParameters.origin=this._pathVerticalPlaneData.origin,t.bindTechnique(e,this.bindParameters,this._passParameters),this._pathVerticalPlaneData.draw(t)}else this.requestRender(1)}_updatePassParameters(){if(!this._intersectsLineEnabled)return!0;const e=this.bindParameters.camera,t=this._passParameters;if(this._intersectsLineInfinite){if(a(p(t.intersectsLineSegment.origin,t.intersectsLineSegment.vector),D),D.c0=-Number.MAX_VALUE,!c(e.frustum,D))return!1;l(D,t.lineStartWorld),h(D,t.lineEndWorld)}else s(t.lineStartWorld,t.intersectsLineSegment.origin),r(t.lineEndWorld,t.intersectsLineSegment.origin,t.intersectsLineSegment.vector);return!0}get test(){}};e([i({constructOnly:!0})],L.prototype,"contrastControlEnabled",void 0),e([i()],L.prototype,"isDecoration",void 0),e([i()],L.prototype,"produces",void 0),e([i()],L.prototype,"consumes",void 0),L=e([n("esri.views.3d.webgl-engine.effects.laserlines.LaserLineRenderer")],L);const D=o();export{L as LaserLineRenderer};
2
+ import{__decorate as e}from"tslib";import"../../../../../core/has.js";import{disposeMaybe as t}from"../../../../../core/maybe.js";import{property as i,subclass as n}from"../../../../../core/accessorSupport/decorators.js";import{copy as s,add as r}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{fromRay as a,getStart as l,getEnd as h,create as o}from"../../../../../geometry/support/clipRay.js";import{intersectClipRay as c}from"../../../../../geometry/support/frustum.js";import{copy as d}from"../../../../../geometry/support/lineSegment.js";import{wrap as p}from"../../../../../geometry/support/ray.js";import{InternalRenderCategory as u}from"../../../webgl.js";import m from"../../../webgl/RenderNode.js";import{Blit as g}from"../blit/Blit.js";import{LaserlinePathData as _}from"./LaserlinePathData.js";import{LaserlinePathPassParameters as b,LaserlinePathTechnique as f}from"./LaserlinePathTechnique.js";import{LaserlinePathTechniqueConfiguration as P}from"./LaserlinePathTechniqueConfiguration.js";import{LaserlineTechnique as E}from"./LaserlineTechnique.js";import{LaserlineTechniqueConfiguration as q}from"./LaserlineTechniqueConfiguration.js";import{updateParameters as V}from"../../materials/internal/MaterialUtil.js";let L=class extends m{constructor(e){super(e),this.isDecoration=!0,this.produces=u.LASERLINES,this.consumes={required:[u.LASERLINES,"normals"]},this.requireGeometryDepth=!0,this._configuration=new q,this._pathTechniqueConfiguration=new P,this._heightManifoldEnabled=!1,this._pointDistanceEnabled=!1,this._lineVerticalPlaneEnabled=!1,this._intersectsLineEnabled=!1,this._intersectsLineInfinite=!1,this._pathVerticalPlaneEnabled=!1,this._passParameters=new b;const t=e.view.stage.renderView.techniques,i=new P;i.contrastControlEnabled=e.contrastControlEnabled,t.precompile(f,i)}initialize(){this._passParameters.renderCoordsHelper=this.view.renderCoordsHelper,this._pathTechniqueConfiguration.spherical=1===this.view.state.viewingMode,this._pathTechniqueConfiguration.contrastControlEnabled=this.contrastControlEnabled,this._techniques.precompile(f,this._pathTechniqueConfiguration),this._blit=new g(this._techniques,2)}destroy(){this._pathVerticalPlaneData=t(this._pathVerticalPlaneData),this._blit=null}get _techniques(){return this.view.stage.renderView.techniques}get heightManifoldEnabled(){return this._heightManifoldEnabled}set heightManifoldEnabled(e){this._heightManifoldEnabled!==e&&(this._heightManifoldEnabled=e,this.requestRender(1))}get heightManifoldTarget(){return this._passParameters.heightManifoldTarget}set heightManifoldTarget(e){s(this._passParameters.heightManifoldTarget,e),this.requestRender(1)}get pointDistanceEnabled(){return this._pointDistanceEnabled}set pointDistanceEnabled(e){e!==this._pointDistanceEnabled&&(this._pointDistanceEnabled=e,this.requestRender(1))}get pointDistanceTarget(){return this._passParameters.pointDistanceTarget}set pointDistanceTarget(e){s(this._passParameters.pointDistanceTarget,e),this.requestRender(1)}get pointDistanceOrigin(){return this._passParameters.pointDistanceOrigin}set pointDistanceOrigin(e){s(this._passParameters.pointDistanceOrigin,e),this.requestRender(1)}get lineVerticalPlaneEnabled(){return this._lineVerticalPlaneEnabled}set lineVerticalPlaneEnabled(e){e!==this._lineVerticalPlaneEnabled&&(this._lineVerticalPlaneEnabled=e,this.requestRender(1))}get lineVerticalPlaneSegment(){return this._passParameters.lineVerticalPlaneSegment}set lineVerticalPlaneSegment(e){d(e,this._passParameters.lineVerticalPlaneSegment),this.requestRender(1)}get intersectsLineEnabled(){return this._intersectsLineEnabled}set intersectsLineEnabled(e){e!==this._intersectsLineEnabled&&(this._intersectsLineEnabled=e,this.requestRender(1))}get intersectsLineSegment(){return this._passParameters.intersectsLineSegment}set intersectsLineSegment(e){d(e,this._passParameters.intersectsLineSegment),this.requestRender(1)}get intersectsLineInfinite(){return this._intersectsLineInfinite}set intersectsLineInfinite(e){e!==this._intersectsLineInfinite&&(this._intersectsLineInfinite=e,this.requestRender(1))}get pathVerticalPlaneEnabled(){return this._pathVerticalPlaneEnabled}set pathVerticalPlaneEnabled(e){e!==this._pathVerticalPlaneEnabled&&(this._pathVerticalPlaneEnabled=e,null!=this._pathVerticalPlaneData&&this.requestRender(1))}set pathVerticalPlaneVertices(e){null==this._pathVerticalPlaneData&&(this._pathVerticalPlaneData=new _(this._passParameters.renderCoordsHelper)),this._pathVerticalPlaneData.vertices=e,this.pathVerticalPlaneEnabled&&this.requestRender(1)}set pathVerticalPlaneBuffers(e){null==this._pathVerticalPlaneData&&(this._pathVerticalPlaneData=new _(this._passParameters.renderCoordsHelper)),this._pathVerticalPlaneData.buffers=e,this.pathVerticalPlaneEnabled&&this.requestRender(1)}setParameters(e){V(this._passParameters,e)&&this.requestRender(1)}precompile(){this._acquireTechnique(),this._blit?.precompile(),this.pathVerticalPlaneEnabled&&this._pathVerticalPlaneData&&this._techniques.precompile(f,this._pathTechniqueConfiguration)}render(e){const t=e.find(({name:e})=>e===this.produces);if(this.isDecoration&&!this.bindParameters.decorations||null==this._blit)return t;const i=this.renderingContext,n=e.find(({name:e})=>"normals"===e);this._passParameters.normals=n?.getTexture();const s=()=>{(this.heightManifoldEnabled||this.pointDistanceEnabled||this.lineVerticalPlaneSegment||this.intersectsLineEnabled)&&this._renderUnified(),this.pathVerticalPlaneEnabled&&this._renderPath()};if(!this.contrastControlEnabled)return i.bindFramebuffer(t.fbo),s(),t;this._passParameters.colors=t.getTexture();const r=this.fboCache.acquire(t.fbo.width,t.fbo.height,"laser lines");return i.bindFramebuffer(r.fbo),i.setClearColor(0,0,0,0),i.clear(16640),s(),i.unbindTexture(t.getTexture()),this._blit.blend(i,r,t,this.bindParameters)||this.requestRender(1),r.release(),t}_acquireTechnique(){return this._configuration.heightManifoldEnabled=this.heightManifoldEnabled,this._configuration.lineVerticalPlaneEnabled=this.lineVerticalPlaneEnabled,this._configuration.pointDistanceEnabled=this.pointDistanceEnabled,this._configuration.intersectsLineEnabled=this.intersectsLineEnabled,this._configuration.contrastControlEnabled=this.contrastControlEnabled,this._configuration.spherical=1===this.view.state.viewingMode,this._techniques.getCompiled(E,this._configuration)}_renderUnified(){if(!this._updatePassParameters())return;const e=this._acquireTechnique();if(e){const t=this.renderingContext;t.bindTechnique(e,this.bindParameters,this._passParameters),t.screen.draw()}else this.requestRender(1)}_renderPath(){if(null==this._pathVerticalPlaneData)return;const e=this._techniques.get(f,this._pathTechniqueConfiguration);if(e.compiled){const t=this.renderingContext;this._passParameters.origin=this._pathVerticalPlaneData.origin,t.bindTechnique(e,this.bindParameters,this._passParameters),this._pathVerticalPlaneData.draw(t)}else this.requestRender(1)}_updatePassParameters(){if(!this._intersectsLineEnabled)return!0;const e=this.bindParameters.camera,t=this._passParameters;if(this._intersectsLineInfinite){if(a(p(t.intersectsLineSegment.origin,t.intersectsLineSegment.vector),D),D.c0=-Number.MAX_VALUE,!c(e.frustum,D))return!1;l(D,t.lineStartWorld),h(D,t.lineEndWorld)}else s(t.lineStartWorld,t.intersectsLineSegment.origin),r(t.lineEndWorld,t.intersectsLineSegment.origin,t.intersectsLineSegment.vector);return!0}get test(){}};e([i({constructOnly:!0})],L.prototype,"contrastControlEnabled",void 0),e([i()],L.prototype,"isDecoration",void 0),e([i()],L.prototype,"produces",void 0),e([i()],L.prototype,"consumes",void 0),L=e([n("esri.views.3d.webgl-engine.effects.laserlines.LaserLineRenderer")],L);const D=o();export{L as LaserLineRenderer};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{createTask as s}from"../../../../../core/asyncUtils.js";import{clamp as i}from"../../../../../core/mathUtils.js";import{disposeMaybe as r}from"../../../../../core/maybe.js";import{watch as t,syncAndInitial as a}from"../../../../../core/reactiveUtils.js";import{createScreenPointArray as o,createRenderScreenPointArray as m,screenPointObjectToArray as n}from"../../../../../core/screenUtils.js";import{isSVG as h}from"../../../../../core/urlUtils.js";import{property as l,subclass as u}from"../../../../../core/accessorSupport/decorators.js";import{requestImage as p}from"../../../../../request/image.js";import{InternalRenderCategory as c}from"../../../webgl.js";import _ from"../../../webgl/RenderNode.js";import{M as g}from"../../../../../chunks/Magnifier.glsl.js";import{MagnifierTechnique as d}from"./MagnifierTechnique.js";import{createQuadVAO as f}from"../../lib/glUtil3D.js";import{loadMagnifierResources as v}from"../../../../magnifier/resources.js";import{PrimitiveType as T}from"../../../../webgl/enums.js";import k from"../../../../webgl/Texture.js";import{TextureDescriptor as P}from"../../../../webgl/TextureDescriptor.js";let y=class extends _{constructor(){super(...arguments),this.produces=c.MAGNIFIER,this.consumes={required:[c.MAGNIFIER]},this._imageSources=null,this._imageLoadTask=null,this._passParameters=new g,this._magnifier=null,this._tmpScreenPoint=o(),this._tmpRenderPoint=m()}initialize(){this.addHandles([t(()=>this.view.magnifier,e=>this._update(e),a)])}_update(e){if(e===this._magnifier)return;this.removeAllHandles(),this._magnifier=e;const s=()=>{const e=this._validMagnifier;e?(this._loadResources(e),this.produces=c.MAGNIFIER):this.produces="disabled",this.requestRender()};this._magnifier&&this.addHandles(t(()=>this._magnifier?.version,s)),s()}get _validMagnifier(){return this._magnifier?.visible&&this._magnifier?.position&&this._magnifier?.size>0?this._magnifier:null}get _factor(){return this._magnifier?.factor||1}destroy(){this._magnifier=null,null!=this._imageLoadTask&&(this._imageLoadTask.task.abort(),this._imageLoadTask=null),this._disposeTextures(),this._vao=r(this._vao)}_disposeTextures(){this._passParameters.mask=r(this._passParameters.mask),this._passParameters.overlay=r(this._passParameters.overlay),this._passParameters.input=r(this._passParameters.input)}precompile(){this._imageSources&&this.techniques.precompile(d)}render(e){const s=this._validMagnifier,r=e.find(({name:e})=>e===c.MAGNIFIER);if(null==s)return r;if(null==this._imageSources)return this.requestRender(1),r;const t=this.renderingContext,a=this.camera.pixelRatio,o=Math.ceil(a*s.size);this._vao??=f(t,0,0,1);const m=this.techniques.get(d);if(this._ensureTextureResources(t,o),!m.compiled||!this._passParameters.input)return this.requestRender(1),r;const h=Math.ceil(1/this._factor*o),l=this._passParameters.input;l.resize(h,h),n(s.position,this._tmpScreenPoint);const u=this.camera.screenToRender(this._tmpScreenPoint,this._tmpRenderPoint),p=this.camera.fullWidth,_=this.camera.fullHeight,g=.5*h,v=.5*h;u[0]=i(u[0],g,p-g-1),u[1]=i(u[1],v,_-v-1);const k=Math.floor(u[0]-g),P=Math.floor(u[1]-v);t.bindFramebuffer(r.fbo);return m.program.bindTexture("textureInput",l),t.gl.copyTexImage2D(l.descriptor.target,0,l.descriptor.pixelFormat,k,P,h,h,0),this._passParameters.magnifier=s,t.bindTechnique(m,this.bindParameters,this._passParameters),t.bindVAO(this._vao),t.drawArrays(T.TRIANGLE_STRIP,0,4),r}_loadResources(e){const{maskUrl:i,overlayUrl:r}=e;this._imageLoadTask?.maskUrl===i&&this._imageLoadTask?.overlayUrl===r||(this._imageLoadTask?.task.abort(),this._imageLoadTask=this._imageSources=null),this._imageSources||this._imageLoadTask||(this._imageLoadTask={maskUrl:i,overlayUrl:r,task:s(async e=>{const s=null==i||null==r?v(e):null,t=null!=i?p(i,{signal:e}):s.then(e=>e.mask),a=null!=r?p(r,{signal:e}):s.then(e=>e.overlay);this._imageSources={mask:await t,overlay:await a}})})}_ensureTextureResources(e,s){null==this._imageSources||this._passParameters.size===s&&this._passParameters.input&&this._passParameters.mask&&this._passParameters.overlay||(this._disposeTextures(),this._imageSources.overlay.width=this._imageSources.mask.width=s,this._imageSources.overlay.height=this._imageSources.mask.height=s,this._passParameters.overlay=new k(e,this._createTextureDescriptor(s,6408,this._imageSources.overlay),this._imageSources.overlay),this._passParameters.mask=new k(e,this._createTextureDescriptor(s,6406,this._imageSources.mask),this._imageSources.mask),this._passParameters.input=new k(e,this._createTextureDescriptor(s,6408,null)))}_createTextureDescriptor(e,s,i){const r=this.renderingContext,t=new P(e);return t.pixelFormat=t.internalFormat=s,t.wrapMode=33071,t.flipped=!!i,t.preMultiplyAlpha=!(6408!==s||!i||h(i.src)&&r.driverTest.svgPremultipliesAlpha.result),t}};e([l()],y.prototype,"produces",void 0),e([l()],y.prototype,"consumes",void 0),e([l()],y.prototype,"_imageSources",void 0),e([l()],y.prototype,"_imageLoadTask",void 0),y=e([u("esri.views.3d.webgl-engine.effects.magnifier.Magnifier")],y);export{y as Magnifier};
2
+ import{__decorate as e}from"tslib";import{createTask as s}from"../../../../../core/asyncUtils.js";import{clamp as i}from"../../../../../core/mathUtils.js";import{disposeMaybe as r}from"../../../../../core/maybe.js";import{watch as t,syncAndInitial as a}from"../../../../../core/reactiveUtils.js";import{createScreenPointArray as o,createRenderScreenPointArray as m,screenPointObjectToArray as n}from"../../../../../core/screenUtils.js";import{isSVG as h}from"../../../../../core/urlUtils.js";import{property as l,subclass as u}from"../../../../../core/accessorSupport/decorators.js";import{requestImage as p}from"../../../../../request/image.js";import{InternalRenderCategory as c}from"../../../webgl.js";import _ from"../../../webgl/RenderNode.js";import{M as g}from"../../../../../chunks/Magnifier.glsl.js";import{MagnifierTechnique as d}from"./MagnifierTechnique.js";import{createQuadVAO as f}from"../../lib/glUtil3D.js";import{loadMagnifierResources as v}from"../../../../magnifier/resources.js";import{PrimitiveType as T}from"../../../../webgl/enums.js";import k from"../../../../webgl/Texture.js";import{TextureDescriptor as P}from"../../../../webgl/TextureDescriptor.js";let y=class extends _{constructor(){super(...arguments),this.produces=c.MAGNIFIER,this.consumes={required:[c.MAGNIFIER]},this._imageSources=null,this._imageLoadTask=null,this._passParameters=new g,this._magnifier=null,this._tmpScreenPoint=o(),this._tmpRenderPoint=m()}initialize(){this.addHandles([t(()=>this.view.magnifier,e=>this._update(e),a)])}_update(e){if(e===this._magnifier)return;this.removeAllHandles(),this._magnifier=e;const s=()=>{const e=this._validMagnifier;e?(this._loadResources(e),this.produces=c.MAGNIFIER):this.produces="disabled",this.requestRender()};this._magnifier&&this.addHandles(t(()=>this._magnifier?.version,s)),s()}get _validMagnifier(){return this._magnifier?.visible&&this._magnifier?.position&&this._magnifier?.size>0?this._magnifier:null}get _factor(){return this._magnifier?.factor||1}destroy(){this._magnifier=null,null!=this._imageLoadTask&&(this._imageLoadTask.task.abort(),this._imageLoadTask=null),this._disposeTextures(),this._vao=r(this._vao)}_disposeTextures(){this._passParameters.mask=r(this._passParameters.mask),this._passParameters.overlay=r(this._passParameters.overlay),this._passParameters.input=r(this._passParameters.input)}precompile(){this._imageSources&&this.techniques.precompile(d)}render(e){const s=this._validMagnifier,r=e.find(({name:e})=>e===c.MAGNIFIER);if(null==s)return r;if(null==this._imageSources)return this.requestRender(1),r;const t=this.renderingContext,a=this.camera.pixelRatio,o=Math.ceil(a*s.size);this._vao??=f(t,0,0,1);const m=this.techniques.getCompiled(d);if(this._ensureTextureResources(t,o),!m||!this._passParameters.input)return this.requestRender(1),r;const h=Math.ceil(1/this._factor*o),l=this._passParameters.input;l.resize(h,h),n(s.position,this._tmpScreenPoint);const u=this.camera.screenToRender(this._tmpScreenPoint,this._tmpRenderPoint),p=this.camera.fullWidth,_=this.camera.fullHeight,g=.5*h,v=.5*h;u[0]=i(u[0],g,p-g-1),u[1]=i(u[1],v,_-v-1);const k=Math.floor(u[0]-g),P=Math.floor(u[1]-v);t.bindFramebuffer(r.fbo);return m.program.bindTexture("textureInput",l),t.gl.copyTexImage2D(l.descriptor.target,0,l.descriptor.pixelFormat,k,P,h,h,0),this._passParameters.magnifier=s,t.bindTechnique(m,this.bindParameters,this._passParameters),t.bindVAO(this._vao),t.drawArrays(T.TRIANGLE_STRIP,0,4),r}_loadResources(e){const{maskUrl:i,overlayUrl:r}=e;this._imageLoadTask?.maskUrl===i&&this._imageLoadTask?.overlayUrl===r||(this._imageLoadTask?.task.abort(),this._imageLoadTask=this._imageSources=null),this._imageSources||this._imageLoadTask||(this._imageLoadTask={maskUrl:i,overlayUrl:r,task:s(async e=>{const s=null==i||null==r?v(e):null,t=null!=i?p(i,{signal:e}):s.then(e=>e.mask),a=null!=r?p(r,{signal:e}):s.then(e=>e.overlay);this._imageSources={mask:await t,overlay:await a}})})}_ensureTextureResources(e,s){null==this._imageSources||this._passParameters.size===s&&this._passParameters.input&&this._passParameters.mask&&this._passParameters.overlay||(this._disposeTextures(),this._imageSources.overlay.width=this._imageSources.mask.width=s,this._imageSources.overlay.height=this._imageSources.mask.height=s,this._passParameters.overlay=new k(e,this._createTextureDescriptor(s,6408,this._imageSources.overlay),this._imageSources.overlay),this._passParameters.mask=new k(e,this._createTextureDescriptor(s,6406,this._imageSources.mask),this._imageSources.mask),this._passParameters.input=new k(e,this._createTextureDescriptor(s,6408,null)))}_createTextureDescriptor(e,s,i){const r=this.renderingContext,t=new P(e);return t.pixelFormat=t.internalFormat=s,t.wrapMode=33071,t.flipped=!!i,t.preMultiplyAlpha=!(6408!==s||!i||h(i.src)&&r.driverTest.svgPremultipliesAlpha.result),t}};e([l()],y.prototype,"produces",void 0),e([l()],y.prototype,"consumes",void 0),e([l()],y.prototype,"_imageSources",void 0),e([l()],y.prototype,"_imageLoadTask",void 0),y=e([u("esri.views.3d.webgl-engine.effects.magnifier.Magnifier")],y);export{y as Magnifier};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import r from"../../../../../core/Logger.js";import{abortMaybe as t,disposeMaybe as s}from"../../../../../core/maybe.js";import{throwIfAborted as i,isAbortError as a}from"../../../../../core/promiseUtils.js";import{watch as o,syncAndInitial as n}from"../../../../../core/reactiveUtils.js";import{property as h,subclass as c}from"../../../../../core/accessorSupport/decorators.js";import{requestImage as l}from"../../../../../request/image.js";import{InternalRenderCategory as u}from"../../../webgl.js";import m from"../../../webgl/RenderNode.js";import{SMAABlendWeightsTechnique as d}from"./SMAABlendWeightsTechnique.js";import{SMAABlurTechnique as p}from"./SMAABlurTechnique.js";import{SMAAEdgeDetectTechnique as b}from"./SMAAEdgeDetectTechnique.js";import{SMAAPassParameters as f}from"./SMAAPassParameters.js";import T from"../../../../webgl/Texture.js";import{TextureDescriptor as x}from"../../../../webgl/TextureDescriptor.js";let _=class extends m{constructor(e){super(e),this.produces="disabled",this.consumes={required:[u.ANTIALIASING]},this._areaTexture=null,this._searchTexture=null,this._smaaParameters=new f}initialize(){this.addHandles([o(()=>this.isEnabled(),e=>e?this.view.addUpdatingPromise(this.enable()):this.disable(),n)])}async enable(){if(this.destroyed)return;if(this.produces=u.ANTIALIASING,this.requestRender(1),this._abortController||this._areaTexture&&this._searchTexture)return;this.techniques.precompile(b),this.techniques.precompile(d),this.techniques.precompile(p),this._abortController=new AbortController;const e=this._abortController.signal;try{const r=await import("./SMAAData.js");i(e),await this._loadTextures(r,e),i(e),this.requestRender(1)}catch(t){a(t)||r.getLogger(this).errorOnce(t)}this._abortController=null}async _loadTextures(e,r){i(r);const[t,s]=await Promise.allSettled([l(e.areaTexture,{signal:r}),l(e.searchTexure,{signal:r})]);if(i(r),"fulfilled"!==t.status||"fulfilled"!==s.status)return;const a=this.renderingContext;this._areaTexture=g(a,9729,6407,t.value),this._searchTexture=g(a,9728,6409,s.value)}disable(){this.produces="disabled",this.requestRender(1)}destroy(){this._abortController=t(this._abortController),this._searchTexture=s(this._searchTexture),this._areaTexture=s(this._areaTexture)}precompile(){this.techniques.precompile(b),this.techniques.precompile(d),this.techniques.precompile(p)}render(e){const r=e.find(({name:e})=>e===u.ANTIALIASING);if(!this._areaTexture||!this._searchTexture)return this.requestRender(1),r;const t=this.techniques.get(b),s=this.techniques.get(d),i=this.techniques.get(p);if(!t.compiled||!s.compiled||!i.compiled)return this.requestRender(1),r;const{width:a,height:o}=r.fbo,n=this.renderingContext;n.setViewport(0,0,a,o);const h=this.fboCache.acquire(a,o,"smaa edges",2);n.bindFramebuffer(h.fbo),n.setClearColor(0,0,0,1),n.clear(16384),this._smaaParameters.color=r.getTexture();const c=this.bindParameters;n.bindTechnique(t,c,this._smaaParameters),n.screen.draw();const l=this.fboCache.acquire(a,o,"smaa blend");n.bindFramebuffer(l.fbo),n.setClearColor(0,0,1,1),n.clear(16384),this._smaaParameters.inputTexture=h.getTexture(),this._smaaParameters.areaTexture=this._areaTexture,this._smaaParameters.searchTexture=this._searchTexture,n.bindTechnique(s,c,this._smaaParameters),n.screen.draw(),h.release();const m=this.fboCache.acquire(a,o,u.ANTIALIASING);return n.bindFramebuffer(m.fbo),n.setClearColor(0,1,0,1),n.clear(16384),this._smaaParameters.inputTexture=l.getTexture(),n.bindTechnique(i,c,this._smaaParameters),n.screen.draw(),l.release(),m}};function g(e,r,t,s){const i=new x(s.width,s.height);return i.pixelFormat=t,i.wrapMode=33071,i.samplingMode=r,new T(e,i,s)}e([h()],_.prototype,"produces",void 0),e([h()],_.prototype,"consumes",void 0),e([h({constructOnly:!0})],_.prototype,"isEnabled",void 0),e([h()],_.prototype,"_abortController",void 0),_=e([c("esri.views.3d.webgl-engine.effects.smaa.SMAA")],_);export{_ as SMAA};
2
+ import{__decorate as e}from"tslib";import r from"../../../../../core/Logger.js";import{abortMaybe as t,disposeMaybe as s}from"../../../../../core/maybe.js";import{throwIfAborted as i,isAbortError as a}from"../../../../../core/promiseUtils.js";import{watch as o,syncAndInitial as n}from"../../../../../core/reactiveUtils.js";import{property as h,subclass as l}from"../../../../../core/accessorSupport/decorators.js";import{requestImage as u}from"../../../../../request/image.js";import{InternalRenderCategory as c}from"../../../webgl.js";import m from"../../../webgl/RenderNode.js";import{SMAABlendWeightsTechnique as d}from"./SMAABlendWeightsTechnique.js";import{SMAABlurTechnique as p}from"./SMAABlurTechnique.js";import{SMAAEdgeDetectTechnique as b}from"./SMAAEdgeDetectTechnique.js";import{SMAAPassParameters as f}from"./SMAAPassParameters.js";import T from"../../../../webgl/Texture.js";import{TextureDescriptor as x}from"../../../../webgl/TextureDescriptor.js";let _=class extends m{constructor(e){super(e),this.produces="disabled",this.consumes={required:[c.ANTIALIASING]},this._areaTexture=null,this._searchTexture=null,this._smaaParameters=new f}initialize(){this.addHandles([o(()=>this.isEnabled(),e=>e?this.view.addUpdatingPromise(this.enable()):this.disable(),n)])}async enable(){if(this.destroyed)return;if(this.produces=c.ANTIALIASING,this.requestRender(1),this._abortController||this._areaTexture&&this._searchTexture)return;this._abortController=new AbortController;const e=this._abortController.signal;try{const r=await import("./SMAAData.js");i(e),await this._loadTextures(r,e),i(e),this.requestRender(1)}catch(t){a(t)||r.getLogger(this).errorOnce(t)}this._abortController=null}async _loadTextures(e,r){i(r);const[t,s]=await Promise.allSettled([u(e.areaTexture,{signal:r}),u(e.searchTexure,{signal:r})]);if(i(r),"fulfilled"!==t.status||"fulfilled"!==s.status)return;const a=this.renderingContext;this._areaTexture=g(a,9729,6407,t.value),this._searchTexture=g(a,9728,6409,s.value)}disable(){this.produces="disabled",this.requestRender(1)}destroy(){this._abortController=t(this._abortController),this._searchTexture=s(this._searchTexture),this._areaTexture=s(this._areaTexture)}precompile(){this.techniques.precompile(b),this.techniques.precompile(d),this.techniques.precompile(p)}render(e){const r=e.find(({name:e})=>e===c.ANTIALIASING),t=this.techniques.getCompiled(b),s=this.techniques.getCompiled(d),i=this.techniques.getCompiled(p);if(!(this._areaTexture&&this._searchTexture&&t&&s&&i))return this.requestRender(1),r;const{width:a,height:o}=r.fbo,n=this.renderingContext;n.setViewport(0,0,a,o);const h=this.fboCache.acquire(a,o,"smaa edges",2);n.bindFramebuffer(h.fbo),n.setClearColor(0,0,0,1),n.clear(16384),this._smaaParameters.color=r.getTexture();const l=this.bindParameters;n.bindTechnique(t,l,this._smaaParameters),n.screen.draw();const u=this.fboCache.acquire(a,o,"smaa blend");n.bindFramebuffer(u.fbo),n.setClearColor(0,0,1,1),n.clear(16384),this._smaaParameters.inputTexture=h.getTexture(),this._smaaParameters.areaTexture=this._areaTexture,this._smaaParameters.searchTexture=this._searchTexture,n.bindTechnique(s,l,this._smaaParameters),n.screen.draw(),h.release();const m=this.fboCache.acquire(a,o,c.ANTIALIASING);return n.bindFramebuffer(m.fbo),n.setClearColor(0,1,0,1),n.clear(16384),this._smaaParameters.inputTexture=u.getTexture(),n.bindTechnique(i,l,this._smaaParameters),n.screen.draw(),u.release(),m}};function g(e,r,t,s){const i=new x(s.width,s.height);return i.pixelFormat=t,i.wrapMode=33071,i.samplingMode=r,new T(e,i,s)}e([h()],_.prototype,"produces",void 0),e([h()],_.prototype,"consumes",void 0),e([h({constructOnly:!0})],_.prototype,"isEnabled",void 0),e([h()],_.prototype,"_abortController",void 0),_=e([l("esri.views.3d.webgl-engine.effects.smaa.SMAA")],_);export{_ as SMAA};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{subclass as r}from"../../../../../core/accessorSupport/decorators.js";import{ReloadableShader as s}from"../../core/shaderTechnique/ReloadableShader.js";import{ShaderTechnique as i}from"../../core/shaderTechnique/ShaderTechnique.js";import{B as o}from"../../../../../chunks/BlendWeights.glsl.js";import{makePipelineState as t,defaultColorWrite as n}from"../../../../webgl/renderState.js";let l=class extends i{constructor(){super(...arguments),this.shader=new s(o,()=>import("./BlendWeights.glsl.js")),this.ignoreUnused=!0}initializePipeline(){return t({colorWrite:n})}};l=e([r("esri.views.3d.webgl-engine.effects.smaa.SMAABlendWeightsTechnique")],l);export{l as SMAABlendWeightsTechnique};
2
+ import{__decorate as e}from"tslib";import{subclass as r}from"../../../../../core/accessorSupport/decorators.js";import{ReloadableShader as s}from"../../core/shaderTechnique/ReloadableShader.js";import{ShaderTechnique as i}from"../../core/shaderTechnique/ShaderTechnique.js";import{B as o}from"../../../../../chunks/BlendWeights.glsl.js";import{makePipelineState as t,defaultColorWrite as l}from"../../../../webgl/renderState.js";let n=class extends i{constructor(){super(...arguments),this.shader=new s(o,()=>import("./BlendWeights.glsl.js"))}initializePipeline(){return t({colorWrite:l})}};n=e([r("esri.views.3d.webgl-engine.effects.smaa.SMAABlendWeightsTechnique")],n);export{n as SMAABlendWeightsTechnique};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{subclass as r}from"../../../../../core/accessorSupport/decorators.js";import{ReloadableShader as s}from"../../core/shaderTechnique/ReloadableShader.js";import{ShaderTechnique as o}from"../../core/shaderTechnique/ShaderTechnique.js";import{B as i}from"../../../../../chunks/Blur.glsl.js";import{makePipelineState as t,defaultColorWrite as l}from"../../../../webgl/renderState.js";let c=class extends o{constructor(){super(...arguments),this.shader=new s(i,()=>import("./Blur.glsl.js")),this.ignoreUnused=!0}initializePipeline(){return t({colorWrite:l})}};c=e([r("esri.views.3d.webgl-engine.effects.smaa.SMAABlurTechnique")],c);export{c as SMAABlurTechnique};
2
+ import{__decorate as e}from"tslib";import{subclass as r}from"../../../../../core/accessorSupport/decorators.js";import{ReloadableShader as s}from"../../core/shaderTechnique/ReloadableShader.js";import{ShaderTechnique as o}from"../../core/shaderTechnique/ShaderTechnique.js";import{B as i}from"../../../../../chunks/Blur.glsl.js";import{makePipelineState as t,defaultColorWrite as l}from"../../../../webgl/renderState.js";let c=class extends o{constructor(){super(...arguments),this.shader=new s(i,()=>import("./Blur.glsl.js"))}initializePipeline(){return t({colorWrite:l})}};c=e([r("esri.views.3d.webgl-engine.effects.smaa.SMAABlurTechnique")],c);export{c as SMAABlurTechnique};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{subclass as r}from"../../../../../core/accessorSupport/decorators.js";import{ReloadableShader as s}from"../../core/shaderTechnique/ReloadableShader.js";import{ShaderTechnique as t}from"../../core/shaderTechnique/ShaderTechnique.js";import{E as o}from"../../../../../chunks/EdgeDetect.glsl.js";import{makePipelineState as i,defaultColorWrite as c}from"../../../../webgl/renderState.js";let n=class extends t{constructor(){super(...arguments),this.shader=new s(o,()=>import("./EdgeDetect.glsl.js")),this.ignoreUnused=!0}initializePipeline(){return i({colorWrite:c})}};n=e([r("esri.views.3d.webgl-engine.effects.smaa.SMAAEdgeDetectTechnique")],n);export{n as SMAAEdgeDetectTechnique};
2
+ import{__decorate as e}from"tslib";import{subclass as r}from"../../../../../core/accessorSupport/decorators.js";import{ReloadableShader as t}from"../../core/shaderTechnique/ReloadableShader.js";import{ShaderTechnique as s}from"../../core/shaderTechnique/ShaderTechnique.js";import{E as o}from"../../../../../chunks/EdgeDetect.glsl.js";import{makePipelineState as i,defaultColorWrite as c}from"../../../../webgl/renderState.js";let a=class extends s{constructor(){super(...arguments),this.shader=new t(o,()=>import("./EdgeDetect.glsl.js"))}initializePipeline(){return i({colorWrite:c})}};a=e([r("esri.views.3d.webgl-engine.effects.smaa.SMAAEdgeDetectTechnique")],a);export{a as SMAAEdgeDetectTechnique};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{clamp as r}from"../../../../../core/mathUtils.js";import{disposeMaybe as t}from"../../../../../core/maybe.js";import{watch as s}from"../../../../../core/reactiveUtils.js";import{Milliseconds as i}from"../../../../../core/time.js";import{property as a,subclass as o}from"../../../../../core/accessorSupport/decorators.js";import{set as n}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{InternalRenderCategory as m}from"../../../webgl.js";import p from"../../../webgl/RenderNode.js";import{distanceFadeEnd as c,distanceFadeStart as h}from"../../core/shaderLibrary/shading/ScreenSpaceConstants.js";import{g as l}from"../../../../../chunks/SSAO.glsl.js";import{SSAOBlurTechnique as u}from"./SSAOBlurTechnique.js";import{noiseData as d}from"./SSAONoiseData.js";import{SSAOPassParameters as f,BlurDrawParameters as b}from"./SSAOParameters.js";import{SSAOTechnique as w}from"./SSAOTechnique.js";import{DepthStencilAttachment as S}from"../../../../webgl/enums.js";import _ from"../../../../webgl/Texture.js";import{TextureDescriptor as T}from"../../../../webgl/TextureDescriptor.js";const P=2;let g=class extends p{constructor(e){super(e),this.consumes={required:["normals"]},this.produces=m.SSAO,this.isEnabled=()=>!1,this._enableTime=i(0),this._passParameters=new f,this._drawParameters=new b}initialize(){const e=Uint8Array.from(atob(d),e=>e.charCodeAt(0)),r=new T(32);r.wrapMode=33071,r.pixelFormat=6407,r.wrapMode=10497,r.hasMipmap=!0,this._passParameters.noiseTexture=new _(this.renderingContext,r,e),this.addHandles(s(()=>this.isEnabled(),()=>this._enableTime=i(0)))}destroy(){this._passParameters.noiseTexture=t(this._passParameters.noiseTexture)}precompile(){this.techniques.precompile(w),this.techniques.precompile(u)}render(e){const t=e.find(({name:e})=>"normals"===e),s=t?.getTexture(),a=t?.getTexture(S);if(!s||!a)return;const o=this.techniques.get(w),p=this.techniques.get(u);if(!o.compiled||!p.compiled)return this._enableTime=i(performance.now()),void this.requestRender(1);0===this._enableTime&&(this._enableTime=i(performance.now()));const d=this.renderingContext,f=this.view.qualitySettings.fadeDuration,b=this.bindParameters,_=b.camera,T=_.relativeElevation,g=r((c-T)/(c-h),0,1),j=f>0?Math.min(f,performance.now()-this._enableTime)/f:1,q=j*g;this._passParameters.normalTexture=s,this._passParameters.depthTexture=a,this._passParameters.projScale=1/_.computeScreenPixelSizeAtDist(1),this._passParameters.intensity=4*x/l(_)**6*q;const v=_.fullViewport[2],A=_.fullViewport[3],y=this.fboCache.acquire(v,A,"ssao input",2);d.bindFramebuffer(y.fbo),d.setViewport(0,0,v,A),d.bindTechnique(o,b,this._passParameters,this._drawParameters),d.screen.draw();const C=Math.round(v/P),O=Math.round(A/P),V=this.fboCache.acquire(C,O,"ssao blur",0);d.bindFramebuffer(V.fbo),this._drawParameters.colorTexture=y.getTexture(),n(this._drawParameters.blurSize,0,P/A),d.bindTechnique(p,b,this._passParameters,this._drawParameters),d.setViewport(0,0,C,O),d.screen.draw(),y.release();const M=this.fboCache.acquire(C,O,m.SSAO,0);return d.bindFramebuffer(M.fbo),d.setViewport(0,0,v,A),d.setClearColor(1,1,1,0),d.clear(16384),this._drawParameters.colorTexture=V.getTexture(),n(this._drawParameters.blurSize,P/v,0),d.bindTechnique(p,b,this._passParameters,this._drawParameters),d.setViewport(0,0,C,O),d.screen.draw(),d.setViewport4fv(_.fullViewport),V.release(),j<1&&this.requestRender(2),M}};e([a()],g.prototype,"consumes",void 0),e([a()],g.prototype,"produces",void 0),e([a({constructOnly:!0})],g.prototype,"isEnabled",void 0),g=e([o("esri.views.3d.webgl-engine.effects.ssao.SSAO")],g);const x=.5;export{g as SSAO,P as blurSizePixels};
2
+ import{__decorate as e}from"tslib";import{clamp as r}from"../../../../../core/mathUtils.js";import{disposeMaybe as t}from"../../../../../core/maybe.js";import{watch as s}from"../../../../../core/reactiveUtils.js";import{Milliseconds as i}from"../../../../../core/time.js";import{property as a,subclass as o}from"../../../../../core/accessorSupport/decorators.js";import{set as n}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{InternalRenderCategory as m}from"../../../webgl.js";import p from"../../../webgl/RenderNode.js";import{distanceFadeEnd as c,distanceFadeStart as h}from"../../core/shaderLibrary/shading/ScreenSpaceConstants.js";import{g as l}from"../../../../../chunks/SSAO.glsl.js";import{SSAOBlurTechnique as u}from"./SSAOBlurTechnique.js";import{noiseData as d}from"./SSAONoiseData.js";import{SSAOPassParameters as f,BlurDrawParameters as b}from"./SSAOParameters.js";import{SSAOTechnique as w}from"./SSAOTechnique.js";import{DepthStencilAttachment as S}from"../../../../webgl/enums.js";import _ from"../../../../webgl/Texture.js";import{TextureDescriptor as T}from"../../../../webgl/TextureDescriptor.js";const P=2;let g=class extends p{constructor(e){super(e),this.consumes={required:["normals"]},this.produces=m.SSAO,this.isEnabled=()=>!1,this._enableTime=i(0),this._passParameters=new f,this._drawParameters=new b}initialize(){const e=Uint8Array.from(atob(d),e=>e.charCodeAt(0)),r=new T(32);r.wrapMode=33071,r.pixelFormat=6407,r.wrapMode=10497,r.hasMipmap=!0,this._passParameters.noiseTexture=new _(this.renderingContext,r,e),this.addHandles(s(()=>this.isEnabled(),()=>this._enableTime=i(0)))}destroy(){this._passParameters.noiseTexture=t(this._passParameters.noiseTexture)}precompile(){this.techniques.precompile(w),this.techniques.precompile(u)}render(e){const t=e.find(({name:e})=>"normals"===e),s=t?.getTexture(),a=t?.getTexture(S);if(!s||!a)return;const o=this.techniques.getCompiled(w),p=this.techniques.getCompiled(u);if(!o||!p)return this._enableTime=i(performance.now()),void this.requestRender(1);0===this._enableTime&&(this._enableTime=i(performance.now()));const d=this.renderingContext,f=this.view.qualitySettings.fadeDuration,b=this.bindParameters,_=b.camera,T=_.relativeElevation,g=r((c-T)/(c-h),0,1),j=f>0?Math.min(f,performance.now()-this._enableTime)/f:1,q=j*g;this._passParameters.normalTexture=s,this._passParameters.depthTexture=a,this._passParameters.projScale=1/_.computeScreenPixelSizeAtDist(1),this._passParameters.intensity=4*x/l(_)**6*q;const v=_.fullViewport[2],A=_.fullViewport[3],C=this.fboCache.acquire(v,A,"ssao input",2);d.bindFramebuffer(C.fbo),d.setViewport(0,0,v,A),d.bindTechnique(o,b,this._passParameters,this._drawParameters),d.screen.draw();const y=Math.round(v/P),O=Math.round(A/P),V=this.fboCache.acquire(y,O,"ssao blur",0);d.bindFramebuffer(V.fbo),this._drawParameters.colorTexture=C.getTexture(),n(this._drawParameters.blurSize,0,P/A),d.bindTechnique(p,b,this._passParameters,this._drawParameters),d.setViewport(0,0,y,O),d.screen.draw(),C.release();const M=this.fboCache.acquire(y,O,m.SSAO,0);return d.bindFramebuffer(M.fbo),d.setViewport(0,0,v,A),d.setClearColor(1,1,1,0),d.clear(16384),this._drawParameters.colorTexture=V.getTexture(),n(this._drawParameters.blurSize,P/v,0),d.bindTechnique(p,b,this._passParameters,this._drawParameters),d.setViewport(0,0,y,O),d.screen.draw(),d.setViewport4fv(_.fullViewport),V.release(),j<1&&this.requestRender(2),M}};e([a()],g.prototype,"consumes",void 0),e([a()],g.prototype,"produces",void 0),e([a({constructOnly:!0})],g.prototype,"isEnabled",void 0),g=e([o("esri.views.3d.webgl-engine.effects.ssao.SSAO")],g);const x=.5;export{g as SSAO,P as blurSizePixels};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as t}from"tslib";import{fetchAsset as e}from"../../../../../assets.js";import{createTask as s}from"../../../../../core/asyncUtils.js";import r from"../../../../../core/Error.js";import i from"../../../../../core/Logger.js";import{abortMaybe as a,disposeMaybe as n}from"../../../../../core/maybe.js";import{isAbortError as o}from"../../../../../core/promiseUtils.js";import{watch as f,initial as c,syncAndInitial as m}from"../../../../../core/reactiveUtils.js";import{subclass as h}from"../../../../../core/accessorSupport/decorators.js";import{copy as u,rotateZ as l,multiply as d}from"../../../../../core/libs/gl-matrix-2/math/mat4.js";import{fromValues as p}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{InternalRenderCategory as b}from"../../../webgl.js";import{glLayout as _}from"../../../support/buffer/glUtil.js";import{OpaqueEnvironment as g}from"../OpaqueEnvironment.js";import{StarPassParameters as w,StarsTechnique as v,layout as j}from"./StarsTechnique.js";import{VertexArrayObject as P}from"../../lib/VertexArrayObject.js";import{PrimitiveType as y}from"../../../../webgl/enums.js";import{VertexBuffer as D}from"../../../../webgl/VertexBuffer.js";let T=class extends g{constructor(){super(...arguments),this._numPoints=0,this._passParameters=new w}initialize(){this.addHandles([f(()=>this.view.environment.starsEnabled,t=>t?this._enable():this._disable(),c),f(()=>"virtual"===this.view.environment.lighting.type?null:this.view.environment.lighting.date,t=>this._update(t),m)])}_enable(){super._enable(),this._loadDataTask=this._createLoadDataTask()}get loading(){return!!this._loadDataTask&&!this._loadDataTask.finished}destroy(){this._loadDataTask=a(this._loadDataTask),this._numPoints=0,this._vao=n(this._vao),this._starData=null}precompile(){this.techniques.precompile(v)}render(t){const e=t.find(({name:t})=>t===b.OPAQUE_ENVIRONMENT),s=this.renderingContext;if(this.loading)return this.requestRender(1),e;if(!this._starData)return e;this._vao??=this._ensureResources(this._starData,s);const r=this.techniques.get(v);return r.compiled?(s.bindTechnique(r,this.bindParameters,this._passParameters),s.bindVAO(this._vao),s.drawArrays(y.POINTS,0,this._numPoints),e):(this.requestRender(1),e)}_ensureResources(t,e){this._numPoints=t.byteLength/L;return M(e,new Float32Array(t,0,2*this._numPoints),new Uint8Array(t,2*this._numPoints*4,this._numPoints),this._numPoints)}_update(t){if(!t)return;const e=(t.getHours()/12+t.getMinutes()/60*(2/24)+t.getSeconds()/60*(2/1440)-.9972222)%2,s=2*q(t),r=u(this._passParameters.modelMatrix,E);l(r,r,-s*Math.PI),d(r,A,r),l(r,r,-e*Math.PI),this.requestRender(1)}_createLoadDataTask(){if(this._starData)return null;const t=s(async t=>{const{data:s}=await e("esri/views/3d/environment/resources/stars.wsv",{responseType:"array-buffer",signal:t});x(s),this._starData=s});return t.promise.catch(t=>{o(t)||i.getLogger(this).error(t)}).then(()=>{this.destroyed||this.requestRender(1)}),t}};function M(t,e,s,r){const i=j.createBuffer(r),a=i.position,n=i.color,o=i.size;for(let f=0;f<r;f++){const t=e[2*f],r=e[2*f+1];a.set(f,0,-Math.cos(t)*Math.sin(r)),a.set(f,1,-Math.sin(t)*Math.sin(r)),a.set(f,2,-Math.cos(r));const i=I(s[f]),c=k(R[i[1]]);n.set(f,0,255*c[0]),n.set(f,1,255*c[1]),n.set(f,2,255*c[2]),n.set(f,3,255),o.set(f,i[0])}return new P(t,new D(t,_(j),i.buffer))}function q(t){const e=t,s=new Date(t.getFullYear(),0,1,11,58,56);return(+e-+s)/(+new Date(t.getFullYear()+1,0,1,11,58,55)-+s)}function x(t){if(!t)throw new r("stars:no-data-received","Failed to create stars because star catalogue is missing");const e=t.byteLength/L;if(e%1!=0||e>5e4||e<5e3)throw new r("stars:invalid-data","Failed to create stars because star catalogue data is invalid")}function k(t){return[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)]}function I(t){return t>=192?[2.9,t-192]:t>=160?[2.5,t-160]:t>=128?[2,t-128]:t>=96?[1.5,t-96]:t>=64?[1,t-64]:t>=32?[.7,t-32]:[.4,t]}T=t([h("esri.views.3d.webgl-engine.effects.stars.Stars")],T);const R=["9bb2ff","9eb5ff","aabfff","bbccff","ccd8ff ","dae2ff","e4e9ff","eeefff","f8f6ff","fff9fb","fff5ef","fff1e5","ffeddb","ffe9d2","ffe6ca","ffe3c3","ffe0bb","ffddb4","ffdaad","ffd6a5","ffd29c","ffcc8f","ffc178","ffa94b","ff7b00"],A=p(1,0,0,0,0,.9174771405229186,.39778850739794974,0,0,-.39778850739794974,.9174771405229186,0,0,0,0,1),E=p(1,0,0,0,0,.9174771405229186,-.39778850739794974,0,0,.39778850739794974,.9174771405229186,0,0,0,0,1),L=9;export{T as Stars};
2
+ import{__decorate as t}from"tslib";import{fetchAsset as e}from"../../../../../assets.js";import{createTask as s}from"../../../../../core/asyncUtils.js";import r from"../../../../../core/Error.js";import i from"../../../../../core/Logger.js";import{abortMaybe as a,disposeMaybe as n}from"../../../../../core/maybe.js";import{isAbortError as o}from"../../../../../core/promiseUtils.js";import{watch as f,initial as c,syncAndInitial as m}from"../../../../../core/reactiveUtils.js";import{subclass as h}from"../../../../../core/accessorSupport/decorators.js";import{copy as u,rotateZ as l,multiply as d}from"../../../../../core/libs/gl-matrix-2/math/mat4.js";import{fromValues as p}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{InternalRenderCategory as b}from"../../../webgl.js";import{glLayout as _}from"../../../support/buffer/glUtil.js";import{OpaqueEnvironment as g}from"../OpaqueEnvironment.js";import{StarPassParameters as w,StarsTechnique as v,layout as j}from"./StarsTechnique.js";import{VertexArrayObject as P}from"../../lib/VertexArrayObject.js";import{PrimitiveType as y}from"../../../../webgl/enums.js";import{VertexBuffer as D}from"../../../../webgl/VertexBuffer.js";let T=class extends g{constructor(){super(...arguments),this._numPoints=0,this._passParameters=new w}initialize(){this.addHandles([f(()=>this.view.environment.starsEnabled,t=>t?this._enable():this._disable(),c),f(()=>"virtual"===this.view.environment.lighting.type?null:this.view.environment.lighting.date,t=>this._update(t),m)])}_enable(){super._enable(),this._loadDataTask=this._createLoadDataTask()}get loading(){return!!this._loadDataTask&&!this._loadDataTask.finished}destroy(){this._loadDataTask=a(this._loadDataTask),this._numPoints=0,this._vao=n(this._vao),this._starData=null}precompile(){this.techniques.precompile(v)}render(t){const e=t.find(({name:t})=>t===b.OPAQUE_ENVIRONMENT),s=this.renderingContext;if(this.loading)return this.requestRender(1),e;if(!this._starData)return e;this._vao??=this._ensureResources(this._starData,s);const r=this.techniques.getCompiled(v);return r?(s.bindTechnique(r,this.bindParameters,this._passParameters),s.bindVAO(this._vao),s.drawArrays(y.POINTS,0,this._numPoints),e):(this.requestRender(1),e)}_ensureResources(t,e){this._numPoints=t.byteLength/L;return M(e,new Float32Array(t,0,2*this._numPoints),new Uint8Array(t,2*this._numPoints*4,this._numPoints),this._numPoints)}_update(t){if(!t)return;const e=(t.getHours()/12+t.getMinutes()/60*(2/24)+t.getSeconds()/60*(2/1440)-.9972222)%2,s=2*q(t),r=u(this._passParameters.modelMatrix,E);l(r,r,-s*Math.PI),d(r,A,r),l(r,r,-e*Math.PI),this.requestRender(1)}_createLoadDataTask(){if(this._starData)return null;const t=s(async t=>{const{data:s}=await e("esri/views/3d/environment/resources/stars.wsv",{responseType:"array-buffer",signal:t});x(s),this._starData=s});return t.promise.catch(t=>{o(t)||i.getLogger(this).error(t)}).then(()=>{this.destroyed||this.requestRender(1)}),t}};function M(t,e,s,r){const i=j.createBuffer(r),a=i.position,n=i.color,o=i.size;for(let f=0;f<r;f++){const t=e[2*f],r=e[2*f+1];a.set(f,0,-Math.cos(t)*Math.sin(r)),a.set(f,1,-Math.sin(t)*Math.sin(r)),a.set(f,2,-Math.cos(r));const i=I(s[f]),c=k(R[i[1]]);n.set(f,0,255*c[0]),n.set(f,1,255*c[1]),n.set(f,2,255*c[2]),n.set(f,3,255),o.set(f,i[0])}return new P(t,new D(t,_(j),i.buffer))}function q(t){const e=t,s=new Date(t.getFullYear(),0,1,11,58,56);return(+e-+s)/(+new Date(t.getFullYear()+1,0,1,11,58,55)-+s)}function x(t){if(!t)throw new r("stars:no-data-received","Failed to create stars because star catalogue is missing");const e=t.byteLength/L;if(e%1!=0||e>5e4||e<5e3)throw new r("stars:invalid-data","Failed to create stars because star catalogue data is invalid")}function k(t){return[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)]}function I(t){return t>=192?[2.9,t-192]:t>=160?[2.5,t-160]:t>=128?[2,t-128]:t>=96?[1.5,t-96]:t>=64?[1,t-64]:t>=32?[.7,t-32]:[.4,t]}T=t([h("esri.views.3d.webgl-engine.effects.stars.Stars")],T);const R=["9bb2ff","9eb5ff","aabfff","bbccff","ccd8ff ","dae2ff","e4e9ff","eeefff","f8f6ff","fff9fb","fff5ef","fff1e5","ffeddb","ffe9d2","ffe6ca","ffe3c3","ffe0bb","ffddb4","ffdaad","ffd6a5","ffd29c","ffcc8f","ffc178","ffa94b","ff7b00"],A=p(1,0,0,0,0,.9174771405229186,.39778850739794974,0,0,-.39778850739794974,.9174771405229186,0,0,0,0,1),E=p(1,0,0,0,0,.9174771405229186,-.39778850739794974,0,0,.39778850739794974,.9174771405229186,0,0,0,0,1),L=9;export{T as Stars};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{getBasisTranscoder as e}from"../../../../libs/basisu/BasisUTranscoder.js";import{CompressedTextureFormat as t}from"../../../webgl/enums.js";import n from"../../../webgl/Texture.js";import{getFormatBytesPerElement as s}from"../../../webgl/Util.js";let r=null,i=null;async function a(){return null==i&&(i=e(),r=await i),i}function l(e,t){if(null==r)return e.byteLength;const n=new r.BasisFile(new Uint8Array(e)),s=u(n)?o(n.getNumLevels(0),n.getHasAlpha(),n.getImageWidth(0,0),n.getImageHeight(0,0),t):0;return n.close(),n.delete(),s}function g(e,t){if(null==r)return e.byteLength;const n=new r.KTX2File(new Uint8Array(e)),s=c(n)?o(n.getLevels(),n.getHasAlpha(),n.getWidth(),n.getHeight(),t):0;return n.close(),n.delete(),s}function o(e,n,r,i,a){const l=s(n?t.COMPRESSED_RGBA8_ETC2_EAC:t.COMPRESSED_RGB8_ETC2),g=a&&e>1?(4**e-1)/(3*4**(e-1)):1;return Math.ceil(r*i*l*g)}function u(e){return e.getNumImages()>=1&&!e.isUASTC()}function c(e){return e.getFaces()>=1&&e.isETC1S()}async function m(e,t,n){null==r&&(r=await a());const s=new r.BasisFile(new Uint8Array(n));if(!u(s))return null;s.startTranscoding();const i=T(e,t,s.getNumLevels(0),s.getHasAlpha(),s.getImageWidth(0,0),s.getImageHeight(0,0),(e,t)=>s.getImageTranscodedSizeInBytes(0,e,t),(e,t,n)=>s.transcodeImage(n,0,e,t,0,0));return s.close(),s.delete(),i}async function h(e,t,n){null==r&&(r=await a());const s=new r.KTX2File(new Uint8Array(n));if(!c(s))return null;s.startTranscoding();const i=T(e,t,s.getLevels(),s.getHasAlpha(),s.getWidth(),s.getHeight(),(e,t)=>s.getImageTranscodedSizeInBytes(e,0,0,t),(e,t,n)=>s.transcodeImage(n,e,0,0,t,0,-1,-1));return s.close(),s.delete(),i}function T(e,s,r,i,a,l,g,o){const{compressedTextureETC:u,compressedTextureS3TC:c}=e.capabilities,[m,h]=u?i?[1,t.COMPRESSED_RGBA8_ETC2_EAC]:[0,t.COMPRESSED_RGB8_ETC2]:c?i?[3,t.COMPRESSED_RGBA_S3TC_DXT5_EXT]:[2,t.COMPRESSED_RGB_S3TC_DXT1_EXT]:[13,6408],T=s.hasMipmap?r:Math.min(1,r),d=[];for(let t=0;t<T;t++)d.push(new Uint8Array(g(t,m))),o(t,m,d[t]);return s.internalFormat=h,s.hasMipmap=d.length>1,s.samplingMode=s.hasMipmap?9987:9729,s.width=a,s.height=l,new n(e,s,{type:"compressed",levels:d})}export{c as checkKTX2,m as createTextureBasis,h as createTextureKTX2,l as estimateMemoryBasis,g as estimateMemoryKTX2,a as loadBasisTranscoder};
2
+ import{getBasisTranscoder as e}from"../../../../libs/basisu/BasisUTranscoder.js";import{CompressedTextureFormat as t}from"../../../webgl/enums.js";import n from"../../../webgl/Texture.js";import{getFormatBytesPerElement as s}from"../../../webgl/Util.js";let r=null,i=null;async function a(){return null==i&&(i=e(),r=await i),i}function l(e,t){if(null==r)return e.byteLength;const n=new r.BasisFile(new Uint8Array(e)),s=u(n)?o(n.getNumLevels(0),n.getHasAlpha(),n.getImageWidth(0,0),n.getImageHeight(0,0),t):0;return n.close(),n.delete(),s}function g(e,t){if(null==r)return e.byteLength;const n=new r.KTX2File(new Uint8Array(e)),s=c(n)?o(n.getLevels(),n.getHasAlpha(),n.getWidth(),n.getHeight(),t):0;return n.close(),n.delete(),s}function o(e,n,r,i,a){const l=s(n?t.COMPRESSED_RGBA8_ETC2_EAC:t.COMPRESSED_RGB8_ETC2),g=a&&e>1?(4**e-1)/(3*4**(e-1)):1;return Math.ceil(r*i*l*g)}function u(e){return e.getNumImages()>=1&&!e.isUASTC()}function c(e){return e.getFaces()>=1&&(e.isETC1S()||e.isUASTC())}async function m(e,t,n){null==r&&(r=await a());const s=new r.BasisFile(new Uint8Array(n));if(!u(s))return null;s.startTranscoding();const i=h(e,t,s.getNumLevels(0),s.getHasAlpha(),s.getImageWidth(0,0),s.getImageHeight(0,0),(e,t)=>s.getImageTranscodedSizeInBytes(0,e,t),(e,t,n)=>s.transcodeImage(n,0,e,t,0,0));return s.close(),s.delete(),i}async function T(e,t,n){null==r&&(r=await a());const s=new r.KTX2File(new Uint8Array(n));if(!c(s))return null;s.startTranscoding();const i=h(e,t,s.getLevels(),s.getHasAlpha(),s.getWidth(),s.getHeight(),(e,t)=>s.getImageTranscodedSizeInBytes(e,0,0,t),(e,t,n)=>s.transcodeImage(n,e,0,0,t,0,-1,-1));return s.close(),s.delete(),i}function h(e,s,r,i,a,l,g,o){const{compressedTextureETC:u,compressedTextureS3TC:c}=e.capabilities,[m,T]=u?i?[1,t.COMPRESSED_RGBA8_ETC2_EAC]:[0,t.COMPRESSED_RGB8_ETC2]:c?i?[3,t.COMPRESSED_RGBA_S3TC_DXT5_EXT]:[2,t.COMPRESSED_RGB_S3TC_DXT1_EXT]:[13,6408],h=s.hasMipmap?r:Math.min(1,r),d=[];for(let t=0;t<h;t++)d.push(new Uint8Array(g(t,m))),o(t,m,d[t]);return s.internalFormat=T,s.hasMipmap=d.length>1,s.samplingMode=s.hasMipmap?9987:9729,s.width=a,s.height=l,new n(e,s,{type:"compressed",levels:d})}export{c as checkKTX2,m as createTextureBasis,T as createTextureKTX2,l as estimateMemoryBasis,g as estimateMemoryKTX2,a as loadBasisTranscoder};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{disposeMaybe as t}from"../../../../core/maybe.js";import{watch as i,syncAndInitial as s}from"../../../../core/reactiveUtils.js";import{property as o,subclass as r}from"../../../../core/accessorSupport/decorators.js";import{copy as l}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{RenderNodeOutput as a,InternalRenderCategory as n}from"../../webgl.js";import{glLayout as u}from"../../support/buffer/glUtil.js";import{newLayout as c}from"../../support/buffer/InterleavedLayout.js";import h from"../../webgl/RenderNode.js";import{VertexArrayObject as m}from"./VertexArrayObject.js";import{C as d}from"../../../../chunks/CutFillComposition.glsl.js";import{CutFillCompositionTechnique as f}from"../shaders/CutFillCompositionTechnique.js";import{C as p}from"../../../../chunks/CutFillMask.glsl.js";import{CutFillMaskTechnique as C}from"../shaders/CutFillMaskTechnique.js";import{DefaultMaterialPassParameters as _,DefaultMaterialDrawParameters as b,DefaultMaterialTechnique as g}from"../shaders/DefaultMaterialTechnique.js";import{DefaultMaterialTechniqueConfiguration as T}from"../shaders/DefaultMaterialTechniqueConfiguration.js";import{DepthStencilAttachment as q,PrimitiveType as V}from"../../../webgl/enums.js";import{noParameters as v}from"../../../webgl/NoParameters.js";import{VertexBuffer as w}from"../../../webgl/VertexBuffer.js";let F=class extends h{constructor(e){super(e),this.consumes={required:[a.OPAQUE]},this.produces=n.CUTFILL_COLOR,this.measureType="cut-fill",this._vaoCut=null,this._vaoFill=null,this._maskParameters=new p,this._cutVolumeParameters=new _,this._fillVolumeParameters=new _,this._compositeParameters=new d,this._drawParameters=new b;const t=1===e.view.state.viewingMode;this._cutVolumeTechniqueConfiguration=new T(t),this._cutVolumeTechniqueConfiguration.customDepthTest=2,this._cutVolumeTechniqueConfiguration.writeDepth=!1,this._cutVolumeTechniqueConfiguration.cullFace=1,this._cutVolumeTechniqueConfiguration.doubleSidedMode=2,this._fillVolumeTechniqueConfiguration=new T(t),this._fillVolumeTechniqueConfiguration.cullFace=2}initialize(){this.addHandles([i(()=>[this.cutColor,this.fillColor],()=>this._updateColors(),s),i(()=>this.measureType,()=>{this.precompile(),this.requestRender(1)},s)])}destroy(){this._disposeVaos()}precompile(){"cut-fill"===this.measureType?(this._cutVolumeTechniqueConfiguration.cullFace=1,this._cutVolumeTechniqueConfiguration.doubleSidedMode=2):(this._cutVolumeTechniqueConfiguration.cullFace=0,this._cutVolumeTechniqueConfiguration.doubleSidedMode=0),this.techniques.precompile(g,this._cutVolumeTechniqueConfiguration),this.techniques.precompile(g,this._fillVolumeTechniqueConfiguration),this.techniques.precompile(C),this.techniques.precompile(f)}render(e){const t=this.techniques.get(g,this._cutVolumeTechniqueConfiguration),i=this.techniques.get(g,this._fillVolumeTechniqueConfiguration),s=this.techniques.get(C),o=this.techniques.get(f),r=e.find(({name:e})=>e===this.produces);if(!this._vaoCut||!this._vaoFill)return r;const l=this._vaoCut.vertexCount("geometry"),a=this._vaoFill.vertexCount("geometry");if(!(t&&i&&s.compiled&&o.compiled))return this.requestRender(1),r;const n=this.bindParameters,u=n.camera,c=u.fullViewport[2],h=u.fullViewport[3],m=this.renderingContext,d=this.fboCache,p=d.acquire(c,h,"cutfill color mask",2);p.attachDepth(r.getAttachment(q)),m.bindFramebuffer(p.fbo),m.setClearColor(0,0,0,1),m.clear(17408),m.setViewport(0,0,c,h),m.bindTechnique(s,n,v,this._maskParameters),m.setFaceCullingEnabled(!1),m.setStencilTestEnabled(!0),m.setStencilOpSeparate(1028,7680,34055,7680),m.setStencilOpSeparate(1029,7680,34056,7680),m.setDepthWriteEnabled(!1),m.bindVAO(this._vaoCut),m.setDepthTestEnabled(!0),m.setStencilWriteMask(255),m.setStencilFunction(519,0,255),m.setColorMask(!1,!1,!1,!1),m.drawArrays(V.TRIANGLES,0,l),m.setDepthTestEnabled(!1),m.setStencilWriteMask(0),m.setStencilFunction(517,0,255),m.setColorMask(!0,!1,!1,!1),m.drawArrays(V.TRIANGLES,0,l),m.bindVAO(this._vaoFill),m.setDepthTestEnabled(!0),m.setStencilWriteMask(255),m.setStencilFunction(519,0,255),m.setColorMask(!1,!0,!1,!1),m.drawArrays(V.TRIANGLES,0,a);const _=d.acquire(c,h,"cutfill color volumes",5);_.attachDepth(r.getAttachment(q)),m.bindFramebuffer(_.fbo),m.setClearColor(0,0,0,0),m.clear(16384),m.setColorMask(!0,!0,!0,!0),m.bindTechnique(t,this.bindParameters,this._cutVolumeParameters,this._drawParameters),m.setPolygonOffset(1,1),m.setPolygonOffsetFillEnabled(!0),m.bindVAO(this._vaoCut),m.drawArrays(V.TRIANGLES,0,l),m.bindTechnique(i,this.bindParameters,this._fillVolumeParameters,this._drawParameters),m.setPolygonOffset(0,0),m.setPolygonOffsetFillEnabled(!1),m.bindVAO(this._vaoFill),m.drawArrays(V.TRIANGLES,0,a);const b=this.fboCache.acquire(c,h,this.produces);return m.bindFramebuffer(b.fbo),this._compositeParameters.color=r.getTexture(),this._compositeParameters.cutFillVolumes=_.getTexture(),this._compositeParameters.cutFillMask=p.getTexture(),this.borderColor.toUnitRGBA(this._compositeParameters.borderColor),m.bindTechnique(o,n,this._compositeParameters),m.screen.draw(),p.release(),_.release(),b.attachDepth(r.getAttachment(q)),b}enable(){this.produces=n.CUTFILL_COLOR,this.requestRender(1)}disable(){this.produces="disabled",this.requestRender(1)}updateGeometries(e,t,i){this._disposeVaos(),this._vaoCut=this._createVao(e),this._vaoFill=this._createVao(t),this._maskParameters.origin=i,l(this._drawParameters.origin,i),this.requestRender(1)}_updateColors(){this._cutVolumeParameters.diffuse=this.cutColor.toUnitRGB(),this._cutVolumeParameters.opacity=this.cutColor.a,this._fillVolumeParameters.diffuse=this.fillColor.toUnitRGB(),this._fillVolumeParameters.opacity=this.fillColor.a,this.requestRender(1)}_createVao(e){const t=e.reduce((e,{indicesBottom:t,indicesExtruded:i})=>e+t.length+i.length,0),i=this.renderingContext,s=P.createBuffer(t),{position:o,normal:r}=s;let l=0;for(const n of e){const{vertices:e,normals:t,indicesBottom:i,indicesExtruded:s}=n;for(let a=0;a<i.length;a++){const s=3*i[a];o.set(l,0,e[s]),o.set(l,1,e[s+1]),o.set(l,2,e[s+2]),r.set(l,0,t[s]),r.set(l,1,t[s+1]),r.set(l,2,t[s+2]),l++}for(let a=0;a<s.length;a++){const i=3*s[a];o.set(l,0,e[i]),o.set(l,1,e[i+1]),o.set(l,2,e[i+2]),r.set(l,0,t[i]),r.set(l,1,t[i+1]),r.set(l,2,t[i+2]),l++}}const a=new w(i,u(P),s.buffer);return new m(i,a)}_disposeVaos(){this._vaoCut=t(this._vaoCut),this._vaoFill=t(this._vaoFill)}};e([o()],F.prototype,"consumes",void 0),e([o()],F.prototype,"produces",void 0),e([o()],F.prototype,"cutColor",void 0),e([o()],F.prototype,"fillColor",void 0),e([o()],F.prototype,"borderColor",void 0),e([o()],F.prototype,"measureType",void 0),F=e([r("esri.views.3d.webgl-engine.lib.CutFillColor")],F);const P=c().vec3f("position").vec3f("normal").freeze();class y{constructor(e,t,i,s){this.vertices=e,this.indicesBottom=t,this.indicesExtruded=i,this.normals=s}}export{F as CutFillColor,y as VolumeGeometry};
2
+ import{__decorate as e}from"tslib";import{disposeMaybe as t}from"../../../../core/maybe.js";import{watch as i,syncAndInitial as s}from"../../../../core/reactiveUtils.js";import{property as o,subclass as r}from"../../../../core/accessorSupport/decorators.js";import{copy as l}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{RenderNodeOutput as a,InternalRenderCategory as n}from"../../webgl.js";import{glLayout as u}from"../../support/buffer/glUtil.js";import{newLayout as c}from"../../support/buffer/InterleavedLayout.js";import h from"../../webgl/RenderNode.js";import{VertexArrayObject as m}from"./VertexArrayObject.js";import{C as d}from"../../../../chunks/CutFillComposition.glsl.js";import{CutFillCompositionTechnique as p}from"../shaders/CutFillCompositionTechnique.js";import{C as f}from"../../../../chunks/CutFillMask.glsl.js";import{CutFillMaskTechnique as C}from"../shaders/CutFillMaskTechnique.js";import{DefaultMaterialPassParameters as _,DefaultMaterialDrawParameters as b,DefaultMaterialTechnique as g}from"../shaders/DefaultMaterialTechnique.js";import{DefaultMaterialTechniqueConfiguration as V}from"../shaders/DefaultMaterialTechniqueConfiguration.js";import{DepthStencilAttachment as v,PrimitiveType as w}from"../../../webgl/enums.js";import{noParameters as F}from"../../../webgl/NoParameters.js";import{VertexBuffer as P}from"../../../webgl/VertexBuffer.js";let y=class extends h{constructor(e){super(e),this.consumes={required:[a.OPAQUE]},this.produces=n.CUTFILL_COLOR,this.measureType="cut-fill",this._vaoCut=null,this._vaoFill=null,this._maskParameters=new f,this._cutVolumeParameters=new _,this._fillVolumeParameters=new _,this._compositeParameters=new d,this._drawParameters=new b;const t=1===e.view.state.viewingMode;this._cutVolumeConfiguration=new V(t),this._cutVolumeConfiguration.customDepthTest=2,this._cutVolumeConfiguration.writeDepth=!1,this._cutVolumeConfiguration.cullFace=1,this._cutVolumeConfiguration.doubleSidedMode=2,this._fillVolumeConfiguration=new V(t),this._fillVolumeConfiguration.cullFace=2}initialize(){this.addHandles([i(()=>[this.cutColor,this.fillColor],()=>this._updateColors(),s),i(()=>this.measureType,()=>{this.precompile(),this.requestRender(1)},s)])}destroy(){this._disposeVaos()}precompile(){"cut-fill"===this.measureType?(this._cutVolumeConfiguration.cullFace=1,this._cutVolumeConfiguration.doubleSidedMode=2):(this._cutVolumeConfiguration.cullFace=0,this._cutVolumeConfiguration.doubleSidedMode=0),this.techniques.precompile(g,this._cutVolumeConfiguration),this.techniques.precompile(g,this._fillVolumeConfiguration),this.techniques.precompile(C),this.techniques.precompile(p)}render(e){const t=this.techniques.getCompiled(g,this._cutVolumeConfiguration),i=this.techniques.getCompiled(g,this._fillVolumeConfiguration),s=this.techniques.getCompiled(C),o=this.techniques.getCompiled(p),r=e.find(({name:e})=>e===this.produces);if(!this._vaoCut||!this._vaoFill)return r;const l=this._vaoCut.vertexCount("geometry"),a=this._vaoFill.vertexCount("geometry");if(!(t&&i&&s&&o))return this.requestRender(1),r;const n=this.bindParameters,u=n.camera,c=u.fullViewport[2],h=u.fullViewport[3],m=this.renderingContext,d=this.fboCache,f=d.acquire(c,h,"cutfill color mask",2);f.attachDepth(r.getAttachment(v)),m.bindFramebuffer(f.fbo),m.setClearColor(0,0,0,1),m.clear(17408),m.setViewport(0,0,c,h),m.bindTechnique(s,n,F,this._maskParameters),m.setFaceCullingEnabled(!1),m.setStencilTestEnabled(!0),m.setStencilOpSeparate(1028,7680,34055,7680),m.setStencilOpSeparate(1029,7680,34056,7680),m.setDepthWriteEnabled(!1),m.bindVAO(this._vaoCut),m.setDepthTestEnabled(!0),m.setStencilWriteMask(255),m.setStencilFunction(519,0,255),m.setColorMask(!1,!1,!1,!1),m.drawArrays(w.TRIANGLES,0,l),m.setDepthTestEnabled(!1),m.setStencilWriteMask(0),m.setStencilFunction(517,0,255),m.setColorMask(!0,!1,!1,!1),m.drawArrays(w.TRIANGLES,0,l),m.bindVAO(this._vaoFill),m.setDepthTestEnabled(!0),m.setStencilWriteMask(255),m.setStencilFunction(519,0,255),m.setColorMask(!1,!0,!1,!1),m.drawArrays(w.TRIANGLES,0,a);const _=d.acquire(c,h,"cutfill color volumes",5);_.attachDepth(r.getAttachment(v)),m.bindFramebuffer(_.fbo),m.setClearColor(0,0,0,0),m.clear(16384),m.setColorMask(!0,!0,!0,!0),m.bindTechnique(t,this.bindParameters,this._cutVolumeParameters,this._drawParameters),m.setPolygonOffset(1,1),m.setPolygonOffsetFillEnabled(!0),m.bindVAO(this._vaoCut),m.drawArrays(w.TRIANGLES,0,l),m.bindTechnique(i,this.bindParameters,this._fillVolumeParameters,this._drawParameters),m.setPolygonOffset(0,0),m.setPolygonOffsetFillEnabled(!1),m.bindVAO(this._vaoFill),m.drawArrays(w.TRIANGLES,0,a);const b=this.fboCache.acquire(c,h,this.produces);return m.bindFramebuffer(b.fbo),this._compositeParameters.color=r.getTexture(),this._compositeParameters.cutFillVolumes=_.getTexture(),this._compositeParameters.cutFillMask=f.getTexture(),this.borderColor.toUnitRGBA(this._compositeParameters.borderColor),m.bindTechnique(o,n,this._compositeParameters),m.screen.draw(),f.release(),_.release(),b.attachDepth(r.getAttachment(v)),b}enable(){this.produces=n.CUTFILL_COLOR,this.requestRender(1)}disable(){this.produces="disabled",this.requestRender(1)}updateGeometries(e,t,i){this._disposeVaos(),this._vaoCut=this._createVao(e),this._vaoFill=this._createVao(t),this._maskParameters.origin=i,l(this._drawParameters.origin,i),this.requestRender(1)}_updateColors(){this._cutVolumeParameters.diffuse=this.cutColor.toUnitRGB(),this._cutVolumeParameters.opacity=this.cutColor.a,this._fillVolumeParameters.diffuse=this.fillColor.toUnitRGB(),this._fillVolumeParameters.opacity=this.fillColor.a,this.requestRender(1)}_createVao(e){const t=e.reduce((e,{indicesBottom:t,indicesExtruded:i})=>e+t.length+i.length,0),i=this.renderingContext,s=T.createBuffer(t),{position:o,normal:r}=s;let l=0;for(const n of e){const{vertices:e,normals:t,indicesBottom:i,indicesExtruded:s}=n;for(let a=0;a<i.length;a++){const s=3*i[a];o.set(l,0,e[s]),o.set(l,1,e[s+1]),o.set(l,2,e[s+2]),r.set(l,0,t[s]),r.set(l,1,t[s+1]),r.set(l,2,t[s+2]),l++}for(let a=0;a<s.length;a++){const i=3*s[a];o.set(l,0,e[i]),o.set(l,1,e[i+1]),o.set(l,2,e[i+2]),r.set(l,0,t[i]),r.set(l,1,t[i+1]),r.set(l,2,t[i+2]),l++}}const a=new P(i,u(T),s.buffer);return new m(i,a)}_disposeVaos(){this._vaoCut=t(this._vaoCut),this._vaoFill=t(this._vaoFill)}};e([o()],y.prototype,"consumes",void 0),e([o()],y.prototype,"produces",void 0),e([o()],y.prototype,"cutColor",void 0),e([o()],y.prototype,"fillColor",void 0),e([o()],y.prototype,"borderColor",void 0),e([o()],y.prototype,"measureType",void 0),y=e([r("esri.views.3d.webgl-engine.lib.CutFillColor")],y);const T=c().vec3f("position").vec3f("normal").freeze();class q{constructor(e,t,i,s){this.vertices=e,this.indicesBottom=t,this.indicesExtruded=i,this.normals=s}}export{y as CutFillColor,q as VolumeGeometry};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as t}from"tslib";import{nextPowerOfTwo as e}from"../../../../core/mathUtils.js";import{disposeMaybe as i,destroyMaybe as r}from"../../../../core/maybe.js";import{property as s,subclass as h}from"../../../../core/accessorSupport/decorators.js";import{ortho as o}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{set as n}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{create as u}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UNIT_X as c,ZEROS as l}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{RenderNodeOutput as d,InternalRenderCategory as p}from"../../webgl.js";import{Frustum as _}from"../../state/Frustum.js";import{glLayout as f}from"../../support/buffer/glUtil.js";import{newLayout as m}from"../../support/buffer/InterleavedLayout.js";import g from"../../webgl/RenderCamera.js";import F from"../../webgl/RenderNode.js";import{ShaderOutputConfiguration as C}from"../core/shaderLibrary/ShaderOutputConfiguration.js";import{VertexArrayObject as w}from"./VertexArrayObject.js";import{C as R}from"../../../../chunks/CutFillDepth.glsl.js";import{CutFillDepthTechnique as P}from"../shaders/CutFillDepthTechnique.js";import{CutFillDepthTechniqueConfiguration as T}from"../shaders/CutFillDepthTechniqueConfiguration.js";import{C as b}from"../../../../chunks/CutFillReduction.glsl.js";import{CutFillReductionTechnique as x}from"../shaders/CutFillReductionTechnique.js";import{CutFillReductionTechniqueConfiguration as D}from"../shaders/CutFillReductionTechniqueConfiguration.js";import{C as B}from"../../../../chunks/CutFillTargetDepth.glsl.js";import{CutFillTargetDepthTechnique as y}from"../shaders/CutFillTargetDepthTechnique.js";import{ImmediateTask as j,TaskPriority as q}from"../../../support/Scheduler.js";import{Yield as S}from"../../../support/Yield.js";import{PrimitiveType as v,DataType as E}from"../../../webgl/enums.js";import{Sync as V}from"../../../webgl/Sync.js";import{VertexBuffer as O}from"../../../webgl/VertexBuffer.js";let A=class extends F{constructor(t){super(t),this.consumes={required:[d.TRANSPARENT]},this.produces=p.CUTFILL_DEPTH,this._cutFillTargetDepthConfiguration=new C,this._cutFillDepthConfiguration=new T,this._cutFillReductionConfiguration=new D,this._cutFillTargetDepthParameters=new B,this._cutFillDepthParameters=new R,this._cutFillReductionParameters=new b,this.needsRender=!1,this.readyToRun=!1,this.done=!0,this._frameTask=j,this._results=new k,this._localOrigin=u(),this._maxTextureSize=512,this._width=0,this._height=0,this._reducedWidth=0,this._reducedHeight=0,this._depthFormat=13,this._colorFormat=10,this._numChannels=2,this._targetVao=null,this._numReductions=3,this._reductionPasses=0,this._pixelBufferSize=0,this._pixelBufferOffset=0,this._perReductionPixelBufferSize=0}initialize(){this._frameTask=this.view.resourceController.scheduler.registerTask(q.VOLUME_MEASUREMENT,this),this.addHandles(this._frameTask),this._maxTextureSize=Math.min(this._maxTextureSize,this.fboCache.rctx.parameters.maxTextureSize),this._cutFillTargetDepthConfiguration.output=7,this._frustum=new _(this.view.renderCoordsHelper)}destroy(){this._targetVao=i(this._targetVao);const t=this.gl;this._sync=r(this._sync),this._pixelBuffer&&(t.deleteBuffer(this._pixelBuffer),this._pixelBuffer=null,this._pixelBufferSize=0)}precompile(){this.techniques.precompile(y,this._cutFillTargetDepthConfiguration),this._cutFillDepthConfiguration.preparePass=0,this.techniques.precompile(P,this._cutFillDepthConfiguration),this._cutFillDepthConfiguration.preparePass=1,this.techniques.precompile(P,this._cutFillDepthConfiguration),this._cutFillReductionConfiguration.reductionPass=0,this.techniques.precompile(x,this._cutFillReductionConfiguration),this._cutFillReductionConfiguration.reductionPass=1,this.techniques.precompile(x,this._cutFillReductionConfiguration),this._cutFillReductionConfiguration.reductionPass=2,this.techniques.precompile(x,this._cutFillReductionConfiguration),this.view.stage.renderer.precompileCutFill()}render(t){const e=t.find(({name:t})=>t===p.CUTFILL_DEPTH);if(!this._orthographicCamera||!this._targetVao||!this.needsRender||this._sync)return e;const i=this.techniques.get(y,this._cutFillTargetDepthConfiguration);this._cutFillDepthConfiguration.preparePass=0;const r=this.techniques.get(P,this._cutFillDepthConfiguration);this._cutFillDepthConfiguration.preparePass=1;const s=this.techniques.get(P,this._cutFillDepthConfiguration);this._cutFillReductionConfiguration.reductionPass=0;const h=this.techniques.get(x,this._cutFillReductionConfiguration);this._cutFillReductionConfiguration.reductionPass=1;const o=this.techniques.get(x,this._cutFillReductionConfiguration);this._cutFillReductionConfiguration.reductionPass=2;const n=this.techniques.get(x,this._cutFillReductionConfiguration);if(!(i.compiled&&r.compiled&&s.compiled&&h.compiled&&o.compiled&&n.compiled))return this.requestRender(1),e;this.needsRender=!1;const a=this.renderingContext,u=this.fboCache,d=this.gl,_=a.getViewport(),f=u.acquire(this._width,this._height,"cutfill reference depth",this._depthFormat);a.bindFramebuffer(f.fbo),a.setViewport(0,0,this._width,this._height),a.clear(1280),this.view.stage.renderer.renderCutFillReferenceDepth(this._orthographicCamera);const m=u.acquire(this._width,this._height,"cutfill target depth",this._depthFormat);a.bindFramebuffer(m.fbo),a.setViewport(0,0,this._width,this._height),a.setClearDepth(1),a.clear(256),this._cutFillTargetDepthParameters.origin=this._localOrigin,this._cutFillTargetDepthParameters.cutFillCamera=this._orthographicCamera,a.bindTechnique(i,this.bindParameters,this._cutFillTargetDepthParameters),a.bindVAO(this._targetVao),a.drawArrays(v.TRIANGLES,0,this._targetVao.vertexCount("geometry"));const g=u.acquire(this._width,this._height,"cutfill reduction even",this._colorFormat),F=u.acquire(this._width,this._height,"cutfill reduction odd",this._colorFormat);return this._cutFillDepthParameters.referenceDepthTexture=f.depthTexture,this._cutFillDepthParameters.targetDepthTexture=m.depthTexture,this._pixelBuffer||(this._pixelBuffer=d.createBuffer()),d.bindBuffer(d.PIXEL_PACK_BUFFER,this._pixelBuffer),d.bufferData(d.PIXEL_PACK_BUFFER,this._pixelBufferSize,d.STREAM_READ),this._prepareFBO(g,this.width,this.height),a.bindTechnique(r,this.bindParameters,this._cutFillDepthParameters),a.screen.draw(),this._runPyramidReduction(g,F,h),this._prepareFBO(g,this.width,this.height,c),a.bindTechnique(s,this.bindParameters,this._cutFillDepthParameters),a.screen.draw(),this._runPyramidReduction(g,F,o),this._prepareFBO(g,this.width,this.height,l),a.bindTechnique(s,this.bindParameters,this._cutFillDepthParameters),a.screen.draw(),this._runPyramidReduction(g,F,n),f.release(),m.release(),g.release(),F.release(),d.bindBuffer(d.PIXEL_PACK_BUFFER,null),a.setViewport(_.x,_.y,_.width,_.height),this._sync=new V(d),setTimeout(()=>this.readyToRun=!0,0),e}update(t,i){if(!this.done)return;this.done=!1;const r=this.renderingContext,{cameraDimensions:{width:s,height:h},localOriginRenderSpace:o}=t,n=this._maxTextureSize,a=h/s,u=s>h?n:n/a,c=s>h?n*a:n;this._width=e(u),this._height=e(c);const l=[this._width,this._height];this._orthographicCamera=this._createCamera(t,l),this._frustum?.update(this._orthographicCamera),this._updateTargetVao(r,i),this._localOrigin=o,this._reductionPasses=Math.ceil(Math.log2(Math.min(this._width,this._height))),this._reducedWidth=Math.ceil(this._width/2**this._reductionPasses),this._reducedHeight=Math.ceil(this._height/2**this._reductionPasses),this._perReductionPixelBufferSize=this._reducedWidth*this._reducedHeight*this._numChannels*4,this._pixelBufferSize=this._perReductionPixelBufferSize*this._numReductions,this._pixelBufferOffset=0,this.needsRender=!0,this.requestRender(1)}runTask(){if(!this._sync)return void(this.readyToRun=!1);try{if(!this._sync.poll())return S}catch(e){return this.readyToRun=!1,void(this._sync=r(this._sync))}this.readyToRun=!1,this._sync=r(this._sync);const t=this.gl;this._cpuBuffer=new Float32Array(this._pixelBufferSize/4),t.bindBuffer(t.PIXEL_PACK_BUFFER,this._pixelBuffer),t.getBufferSubData(t.PIXEL_PACK_BUFFER,0,this._cpuBuffer),t.bindBuffer(t.PIXEL_PACK_BUFFER,null),this._updateResults(this._cpuBuffer),this.done=!0}getResults(){return this._results}get frustum(){return this._frustum}get width(){return this._width}get height(){return this._height}get updating(){return this.readyToRun||!this.done||this._frameTask.updating}_runPyramidReduction(t,e,i){const r=this.renderingContext,s=this.gl;let h=this._width,o=this._height;for(let n=0;n<this._reductionPasses;n++)h=Math.ceil(h/2),o=Math.ceil(o/2),this._cutFillReductionParameters.depthTexture=t.getTexture(),this._prepareFBO(e,h,o),r.bindTechnique(i,this.bindParameters,this._cutFillReductionParameters),r.screen.draw(),[t,e]=[e,t];s.readPixels(0,0,h,o,33319,E.FLOAT,this._pixelBufferOffset),this._pixelBufferOffset+=this._perReductionPixelBufferSize}_updateResults(t){const e=new U(0,1,a()),i=new U(0,0,a());for(let r=0;r<this._reducedWidth;r++)for(let s=0;s<this._reducedHeight;s++){let h=(r+s*this._reducedWidth)*this._numChannels;const o=this._reducedWidth*this._reducedHeight*this._numChannels;e.totalDepth+=t[h],i.totalDepth+=t[h+1],h+=o;const n=t[h];n<e.labelDepth&&(e.labelDepth=n,L(e.labelCoords,t[h+1],this._width)),h+=o;const a=t[h];a>i.labelDepth&&(i.labelDepth=a,L(i.labelCoords,t[h+1],this._width))}this._results=new k(this._width,this._height,e,i)}_prepareFBO(t,e,i,r=l){const s=this.renderingContext;s.bindFramebuffer(t.fbo),s.setViewport(0,0,e,i),s.setClearColor(r[0],r[1],r[2],r[3]),s.clear(16384)}_createCamera(t,e){const{cameraPositionRenderSpace:i,localOriginRenderSpace:r,northVector:s,cameraDimensions:{width:h,height:n},cameraNearFar:{near:a,far:u}}=t,c=new g({eye:i,center:r,up:s,near:a,far:u});return c.viewport=[0,0,e[0],e[1]],o(c.projectionMatrix,-h/2,h/2,-n/2,n/2,a,u),c}_updateTargetVao(t,e){this._targetVao=i(this._targetVao);const r=e.reduce((t,e)=>t+e.indices.length,0),s=z.createBuffer(r),h=s.position;let o=0;for(const i of e){const{positions:t,indices:e}=i;for(let i=0;i<e.length;++i){const r=3*e[i];h.set(o,0,t[r]),h.set(o,1,t[r+1]),h.set(o,2,t[r+2]),o++}}const n=new O(t,f(z),s.buffer);this._targetVao=new w(t,n)}};t([s()],A.prototype,"consumes",void 0),t([s()],A.prototype,"produces",void 0),t([s()],A.prototype,"needsRender",void 0),t([s()],A.prototype,"readyToRun",void 0),t([s()],A.prototype,"done",void 0),t([s()],A.prototype,"updating",null),t([s()],A.prototype,"_frameTask",void 0),A=t([h("esri.views.3d.webgl-engine.lib.CutFillDepth")],A);const z=m().vec3f("position").freeze();function L(t,e,i){const r=e%i,s=Math.floor(e/i);n(t,r,s)}class M{constructor(t,e){this.positions=t,this.indices=e}}class U{constructor(t,e,i){this.totalDepth=t,this.labelDepth=e,this.labelCoords=i}}class k{constructor(t=0,e=0,i=new U(0,1,a()),r=new U(0,0,a())){this.width=t,this.height=e,this.cut=i,this.fill=r}}export{A as CutFillDepth,U as DepthResult,k as RenderResult,M as TargetGeometryRenderInfo};
2
+ import{__decorate as t}from"tslib";import{nextPowerOfTwo as e}from"../../../../core/mathUtils.js";import{disposeMaybe as i,destroyMaybe as r}from"../../../../core/maybe.js";import{property as s,subclass as h}from"../../../../core/accessorSupport/decorators.js";import{ortho as o}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{set as n}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{create as u}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UNIT_X as l,ZEROS as c}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{RenderNodeOutput as d,InternalRenderCategory as p}from"../../webgl.js";import{Frustum as _}from"../../state/Frustum.js";import{glLayout as f}from"../../support/buffer/glUtil.js";import{newLayout as m}from"../../support/buffer/InterleavedLayout.js";import g from"../../webgl/RenderCamera.js";import C from"../../webgl/RenderNode.js";import{ShaderOutputConfiguration as F}from"../core/shaderLibrary/ShaderOutputConfiguration.js";import{VertexArrayObject as w}from"./VertexArrayObject.js";import{C as R}from"../../../../chunks/CutFillDepth.glsl.js";import{CutFillDepthTechnique as P}from"../shaders/CutFillDepthTechnique.js";import{CutFillDepthTechniqueConfiguration as T}from"../shaders/CutFillDepthTechniqueConfiguration.js";import{C as b}from"../../../../chunks/CutFillReduction.glsl.js";import{CutFillReductionTechnique as x}from"../shaders/CutFillReductionTechnique.js";import{CutFillReductionTechniqueConfiguration as D}from"../shaders/CutFillReductionTechniqueConfiguration.js";import{C as B}from"../../../../chunks/CutFillTargetDepth.glsl.js";import{CutFillTargetDepthTechnique as y}from"../shaders/CutFillTargetDepthTechnique.js";import{ImmediateTask as j,TaskPriority as q}from"../../../support/Scheduler.js";import{Yield as S}from"../../../support/Yield.js";import{PrimitiveType as v,DataType as E}from"../../../webgl/enums.js";import{Sync as V}from"../../../webgl/Sync.js";import{VertexBuffer as O}from"../../../webgl/VertexBuffer.js";let A=class extends C{constructor(t){super(t),this.consumes={required:[d.TRANSPARENT]},this.produces=p.CUTFILL_DEPTH,this._cutFillTargetDepthConfiguration=new F,this._cutFillDepthConfiguration=new T,this._cutFillReductionConfiguration=new D,this._cutFillTargetDepthParameters=new B,this._cutFillDepthParameters=new R,this._cutFillReductionParameters=new b,this.needsRender=!1,this.readyToRun=!1,this.done=!0,this._frameTask=j,this._results=new k,this._localOrigin=u(),this._maxTextureSize=512,this._width=0,this._height=0,this._reducedWidth=0,this._reducedHeight=0,this._depthFormat=13,this._colorFormat=10,this._numChannels=2,this._targetVao=null,this._numReductions=3,this._reductionPasses=0,this._pixelBufferSize=0,this._pixelBufferOffset=0,this._perReductionPixelBufferSize=0}initialize(){this._frameTask=this.view.resourceController.scheduler.registerTask(q.VOLUME_MEASUREMENT,this),this.addHandles(this._frameTask),this._maxTextureSize=Math.min(this._maxTextureSize,this.fboCache.rctx.parameters.maxTextureSize),this._cutFillTargetDepthConfiguration.output=7,this._frustum=new _(this.view.renderCoordsHelper)}destroy(){this._targetVao=i(this._targetVao);const t=this.gl;this._sync=r(this._sync),this._pixelBuffer&&(t.deleteBuffer(this._pixelBuffer),this._pixelBuffer=null,this._pixelBufferSize=0)}precompile(){this.techniques.precompile(y,this._cutFillTargetDepthConfiguration),this._cutFillDepthConfiguration.preparePass=0,this.techniques.precompile(P,this._cutFillDepthConfiguration),this._cutFillDepthConfiguration.preparePass=1,this.techniques.precompile(P,this._cutFillDepthConfiguration),this._cutFillReductionConfiguration.reductionPass=0,this.techniques.precompile(x,this._cutFillReductionConfiguration),this._cutFillReductionConfiguration.reductionPass=1,this.techniques.precompile(x,this._cutFillReductionConfiguration),this._cutFillReductionConfiguration.reductionPass=2,this.techniques.precompile(x,this._cutFillReductionConfiguration),this.view.stage.renderer.precompileCutFill()}render(t){const e=t.find(({name:t})=>t===p.CUTFILL_DEPTH);if(!this._orthographicCamera||!this._targetVao||!this.needsRender||this._sync)return e;const i=this.techniques.getCompiled(y,this._cutFillTargetDepthConfiguration);this._cutFillDepthConfiguration.preparePass=0;const r=this.techniques.getCompiled(P,this._cutFillDepthConfiguration);this._cutFillDepthConfiguration.preparePass=1;const s=this.techniques.getCompiled(P,this._cutFillDepthConfiguration);this._cutFillReductionConfiguration.reductionPass=0;const h=this.techniques.getCompiled(x,this._cutFillReductionConfiguration);this._cutFillReductionConfiguration.reductionPass=1;const o=this.techniques.getCompiled(x,this._cutFillReductionConfiguration);this._cutFillReductionConfiguration.reductionPass=2;const n=this.techniques.getCompiled(x,this._cutFillReductionConfiguration);if(!(i&&r&&s&&h&&o&&n))return this.requestRender(1),e;this.needsRender=!1;const a=this.renderingContext,u=this.fboCache,d=this.gl,_=a.getViewport(),f=u.acquire(this._width,this._height,"cutfill reference depth",this._depthFormat);a.bindFramebuffer(f.fbo),a.setViewport(0,0,this._width,this._height),a.clear(1280),this.view.stage.renderer.renderCutFillReferenceDepth(this._orthographicCamera);const m=u.acquire(this._width,this._height,"cutfill target depth",this._depthFormat);a.bindFramebuffer(m.fbo),a.setViewport(0,0,this._width,this._height),a.setClearDepth(1),a.clear(256),this._cutFillTargetDepthParameters.origin=this._localOrigin,this._cutFillTargetDepthParameters.cutFillCamera=this._orthographicCamera,a.bindTechnique(i,this.bindParameters,this._cutFillTargetDepthParameters),a.bindVAO(this._targetVao),a.drawArrays(v.TRIANGLES,0,this._targetVao.vertexCount("geometry"));const g=u.acquire(this._width,this._height,"cutfill reduction even",this._colorFormat),C=u.acquire(this._width,this._height,"cutfill reduction odd",this._colorFormat);return this._cutFillDepthParameters.referenceDepthTexture=f.depthTexture,this._cutFillDepthParameters.targetDepthTexture=m.depthTexture,this._pixelBuffer||(this._pixelBuffer=d.createBuffer()),d.bindBuffer(d.PIXEL_PACK_BUFFER,this._pixelBuffer),d.bufferData(d.PIXEL_PACK_BUFFER,this._pixelBufferSize,d.STREAM_READ),this._prepareFBO(g,this.width,this.height),a.bindTechnique(r,this.bindParameters,this._cutFillDepthParameters),a.screen.draw(),this._runPyramidReduction(g,C,h),this._prepareFBO(g,this.width,this.height,l),a.bindTechnique(s,this.bindParameters,this._cutFillDepthParameters),a.screen.draw(),this._runPyramidReduction(g,C,o),this._prepareFBO(g,this.width,this.height,c),a.bindTechnique(s,this.bindParameters,this._cutFillDepthParameters),a.screen.draw(),this._runPyramidReduction(g,C,n),f.release(),m.release(),g.release(),C.release(),d.bindBuffer(d.PIXEL_PACK_BUFFER,null),a.setViewport(_.x,_.y,_.width,_.height),this._sync=new V(d),setTimeout(()=>this.readyToRun=!0,0),e}update(t,i){if(!this.done)return;this.done=!1;const r=this.renderingContext,{cameraDimensions:{width:s,height:h},localOriginRenderSpace:o}=t,n=this._maxTextureSize,a=h/s,u=s>h?n:n/a,l=s>h?n*a:n;this._width=e(u),this._height=e(l);const c=[this._width,this._height];this._orthographicCamera=this._createCamera(t,c),this._frustum?.update(this._orthographicCamera),this._updateTargetVao(r,i),this._localOrigin=o,this._reductionPasses=Math.ceil(Math.log2(Math.min(this._width,this._height))),this._reducedWidth=Math.ceil(this._width/2**this._reductionPasses),this._reducedHeight=Math.ceil(this._height/2**this._reductionPasses),this._perReductionPixelBufferSize=this._reducedWidth*this._reducedHeight*this._numChannels*4,this._pixelBufferSize=this._perReductionPixelBufferSize*this._numReductions,this._pixelBufferOffset=0,this.needsRender=!0,this.requestRender(1)}runTask(){if(!this._sync)return void(this.readyToRun=!1);try{if(!this._sync.poll())return S}catch(e){return this.readyToRun=!1,void(this._sync=r(this._sync))}this.readyToRun=!1,this._sync=r(this._sync);const t=this.gl;this._cpuBuffer=new Float32Array(this._pixelBufferSize/4),t.bindBuffer(t.PIXEL_PACK_BUFFER,this._pixelBuffer),t.getBufferSubData(t.PIXEL_PACK_BUFFER,0,this._cpuBuffer),t.bindBuffer(t.PIXEL_PACK_BUFFER,null),this._updateResults(this._cpuBuffer),this.done=!0}getResults(){return this._results}get frustum(){return this._frustum}get width(){return this._width}get height(){return this._height}get updating(){return this.readyToRun||!this.done||this._frameTask.updating}_runPyramidReduction(t,e,i){const r=this.renderingContext,s=this.gl;let h=this._width,o=this._height;for(let n=0;n<this._reductionPasses;n++)h=Math.ceil(h/2),o=Math.ceil(o/2),this._cutFillReductionParameters.depthTexture=t.getTexture(),this._prepareFBO(e,h,o),r.bindTechnique(i,this.bindParameters,this._cutFillReductionParameters),r.screen.draw(),[t,e]=[e,t];s.readPixels(0,0,h,o,33319,E.FLOAT,this._pixelBufferOffset),this._pixelBufferOffset+=this._perReductionPixelBufferSize}_updateResults(t){const e=new U(0,1,a()),i=new U(0,0,a());for(let r=0;r<this._reducedWidth;r++)for(let s=0;s<this._reducedHeight;s++){let h=(r+s*this._reducedWidth)*this._numChannels;const o=this._reducedWidth*this._reducedHeight*this._numChannels;e.totalDepth+=t[h],i.totalDepth+=t[h+1],h+=o;const n=t[h];n<e.labelDepth&&(e.labelDepth=n,L(e.labelCoords,t[h+1],this._width)),h+=o;const a=t[h];a>i.labelDepth&&(i.labelDepth=a,L(i.labelCoords,t[h+1],this._width))}this._results=new k(this._width,this._height,e,i)}_prepareFBO(t,e,i,r=c){const s=this.renderingContext;s.bindFramebuffer(t.fbo),s.setViewport(0,0,e,i),s.setClearColor(r[0],r[1],r[2],r[3]),s.clear(16384)}_createCamera(t,e){const{cameraPositionRenderSpace:i,localOriginRenderSpace:r,northVector:s,cameraDimensions:{width:h,height:n},cameraNearFar:{near:a,far:u}}=t,l=new g({eye:i,center:r,up:s,near:a,far:u});return l.viewport=[0,0,e[0],e[1]],o(l.projectionMatrix,-h/2,h/2,-n/2,n/2,a,u),l}_updateTargetVao(t,e){this._targetVao=i(this._targetVao);const r=e.reduce((t,e)=>t+e.indices.length,0),s=z.createBuffer(r),h=s.position;let o=0;for(const i of e){const{positions:t,indices:e}=i;for(let i=0;i<e.length;++i){const r=3*e[i];h.set(o,0,t[r]),h.set(o,1,t[r+1]),h.set(o,2,t[r+2]),o++}}const n=new O(t,f(z),s.buffer);this._targetVao=new w(t,n)}};t([s()],A.prototype,"consumes",void 0),t([s()],A.prototype,"produces",void 0),t([s()],A.prototype,"needsRender",void 0),t([s()],A.prototype,"readyToRun",void 0),t([s()],A.prototype,"done",void 0),t([s()],A.prototype,"updating",null),t([s()],A.prototype,"_frameTask",void 0),A=t([h("esri.views.3d.webgl-engine.lib.CutFillDepth")],A);const z=m().vec3f("position").freeze();function L(t,e,i){const r=e%i,s=Math.floor(e/i);n(t,r,s)}class M{constructor(t,e){this.positions=t,this.indices=e}}class U{constructor(t,e,i){this.totalDepth=t,this.labelDepth=e,this.labelCoords=i}}class k{constructor(t=0,e=0,i=new U(0,1,a()),r=new U(0,0,a())){this.width=t,this.height=e,this.cut=i,this.fill=r}}export{A as CutFillDepth,U as DepthResult,k as RenderResult,M as TargetGeometryRenderInfo};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{watch as t}from"../../../../core/reactiveUtils.js";import{property as s,subclass as a}from"../../../../core/accessorSupport/decorators.js";import{set as i}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{copy as r,scale as o,floor as n,subtract as h}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as m}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{InternalRenderCategory as p}from"../../webgl.js";import l from"../../webgl/RenderNode.js";import{G as u}from"../../../../chunks/GaussianSplat.glsl.js";import{G as c}from"../../../../chunks/GaussianSplatComposition.glsl.js";import{GaussianSplatCompositionTechnique as d}from"../shaders/GaussianSplatCompositionTechnique.js";import{G as _}from"../../../../chunks/GaussianSplatDepthComposition.glsl.js";import{GaussianSplatDepthCompositionTechnique as g}from"../shaders/GaussianSplatDepthCompositionTechnique.js";import{GaussianSplatTechnique as P}from"../shaders/GaussianSplatTechnique.js";import{GaussianSplatTechniqueConfiguration as f}from"../shaders/GaussianSplatTechniqueConfiguration.js";import{DepthStencilAttachment as b,ColorAttachment1 as C,PrimitiveType as v}from"../../../webgl/enums.js";var S;let x=class extends l{static{S=this}constructor(e){super(e),this._slicePlaneEnabled=!1,this.produces=p.GAUSSIAN_SPLAT,this.layerView=null,this._passParameters=new u,this._compositionPassParameters=new c,this._depthCompositionPassParameters=new _,this._previousCameraPosition=m(),this._previousCameraDirection=m(),this._configuration=new f(e.view.state.isGlobal)}async initialize(){this.addHandles([t(()=>this.view.state.camera,()=>this._onCameraChange())])}precompile(){this._configuration.alphaCutoff=this.view.qualitySettings.gaussianSplat.minimumOpacity,this._configuration.terrainDepthTest=this.bindParameters.terrainDepthTest,this._configuration.fadingEnabled=this._fadeHelper.fadingEnabled,this.techniques.precompile(P,this._configuration),this.techniques.precompile(d),this.techniques.precompile(g)}render(e){const t=e.find(({name:e})=>e===p.GAUSSIAN_SPLAT);if(this._handleFading(),!this._data.visibleGaussians||!this._data.orderTexture.texture||!this._data.textureAtlas.texture)return t;const s=this.techniques.get(P,this._configuration),a=this.techniques.get(d),i=this.techniques.get(g);if(!s.compiled||!i.compiled||!a.compiled)return this.requestRender(1),t;const{fullWidth:r,fullHeight:o}=this.bindParameters.camera;this._prepareParameters(o,r);const n=this.renderingContext,h=this.fboCache,m=h.acquire(r,o,"gaussian color output"),l=t.getAttachment(b);m.attachDepth(l),this._renderGaussianColorAndDepth(m,s);const u=h.acquire(r,o,this.produces);return this._depthCompositionPassParameters.splatDepth=m.getTexture(C),u.attachDepth(t.getAttachment(b)),n.bindFramebuffer(u.fbo),n.bindTechnique(i,this.bindParameters,this._depthCompositionPassParameters),n.screen.draw(),this._compositionPassParameters.color=t.getTexture(),this._compositionPassParameters.splatColor=m.getTexture(),n.bindFramebuffer(u.fbo),n.bindTechnique(a,this.bindParameters,this._compositionPassParameters),n.screen.draw(),m.release(),u}get slicePlaneEnabled(){return this._slicePlaneEnabled}set slicePlaneEnabled(e){this._slicePlaneEnabled!==e&&(this._slicePlaneEnabled=e,this.requestRender(1))}get _data(){return this.layerView.data}get _fadeHelper(){return this.layerView.fadeHelper}destroy(){super.destroy()}_onCameraChange(){const e=this.view.state.camera.eye,t=this.view.state.camera.ray.direction,s=.001;(Math.abs(e[0]-this._previousCameraPosition[0])>s||Math.abs(e[1]-this._previousCameraPosition[1])>s||Math.abs(e[2]-this._previousCameraPosition[2])>s||Math.abs(t[0]-this._previousCameraDirection[0])>s||Math.abs(t[1]-this._previousCameraDirection[1])>s||Math.abs(t[2]-this._previousCameraDirection[2])>s)&&(r(this._previousCameraPosition,e),r(this._previousCameraDirection,t),this._data.requestSort())}_prepareParameters(e,t){this._passParameters.splatOrder=this._data.orderTexture.texture,this._passParameters.splatFading=this._data.fadingTexture.texture,this._passParameters.splatAtlas=this._data.textureAtlas.texture;const s=Math.tan(.5*this.camera.fovY),a=s/e*t;i(this._passParameters.tanFov,a,s),this._passParameters.focalLength=e/(2*s);const r=this.view.qualitySettings.gaussianSplat.minimumSplatPixelRadius;this._passParameters.minSplatRadius=r*Math.sqrt(t*e)/Math.sqrt(2073600),this._prepareHighPrecisionCameraPosition()}_renderGaussianColorAndDepth(e,t){const s=this.renderingContext;e.acquireColor(C,5,"gaussian depth output"),s.bindFramebuffer(e.fbo),s.setClearColor(0,0,0,0),s.clear(16384),this.renderingContext.bindTechnique(t,this.bindParameters,this._passParameters),this.renderingContext.drawArraysInstanced(v.TRIANGLE_STRIP,0,4,this._data.visibleGaussians)}_prepareHighPrecisionCameraPosition(){o(this._passParameters.tileCameraPosition,this.camera.eye,1/S.tileSize),n(this._passParameters.tileCameraPosition,this._passParameters.tileCameraPosition),o(this._passParameters.cameraDelta,this._passParameters.tileCameraPosition,S.tileSize),h(this._passParameters.cameraDelta,this.camera.eye,this._passParameters.cameraDelta)}_handleFading(){if(0===this._fadeHelper.numFadingTiles)return void(this._previousFrameStart=null);this._previousFrameStart??=this.view.stage.renderer.renderContext.time;const e=this.view.stage?.renderer.renderContext.time-this._previousFrameStart;this._fadeHelper.updateAllTileFading(e),this._previousFrameStart=this.view.stage.renderer.renderContext.time,this._data.fadingTexture.updateTexture(this._data.textureAtlas.pageAllocator.pageCount)}static{this.tileSize=2.048}};e([s()],x.prototype,"produces",void 0),e([s({constructOnly:!0})],x.prototype,"layerView",void 0),x=S=e([a("esri.views.3d.webgl-engine.lib.GaussianSplatRenderNode")],x);export{x as GaussianSplatRenderNode};
2
+ import{__decorate as e}from"tslib";import{watch as t}from"../../../../core/reactiveUtils.js";import{property as s,subclass as a}from"../../../../core/accessorSupport/decorators.js";import{set as i}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{copy as r,scale as o,floor as n,subtract as h}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as m}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{InternalRenderCategory as p}from"../../webgl.js";import l from"../../webgl/RenderNode.js";import{G as u}from"../../../../chunks/GaussianSplat.glsl.js";import{G as d}from"../../../../chunks/GaussianSplatComposition.glsl.js";import{GaussianSplatCompositionTechnique as c}from"../shaders/GaussianSplatCompositionTechnique.js";import{G as _}from"../../../../chunks/GaussianSplatDepthComposition.glsl.js";import{GaussianSplatDepthCompositionTechnique as g}from"../shaders/GaussianSplatDepthCompositionTechnique.js";import{GaussianSplatTechnique as P}from"../shaders/GaussianSplatTechnique.js";import{GaussianSplatTechniqueConfiguration as f}from"../shaders/GaussianSplatTechniqueConfiguration.js";import{DepthStencilAttachment as C,ColorAttachment1 as b,PrimitiveType as v}from"../../../webgl/enums.js";var S;let x=class extends l{static{S=this}constructor(e){super(e),this._slicePlaneEnabled=!1,this.produces=p.GAUSSIAN_SPLAT,this.layerView=null,this._passParameters=new u,this._compositionPassParameters=new d,this._depthCompositionPassParameters=new _,this._previousCameraPosition=m(),this._previousCameraDirection=m(),this._configuration=new f(e.view.state.isGlobal)}async initialize(){this.addHandles([t(()=>this.view.state.camera,()=>this._onCameraChange())])}precompile(){this._configuration.alphaCutoff=this.view.qualitySettings.gaussianSplat.minimumOpacity,this._configuration.terrainDepthTest=this.bindParameters.terrainDepthTest,this._configuration.fadingEnabled=this._fadeHelper.fadingEnabled,this.techniques.precompile(P,this._configuration),this.techniques.precompile(c),this.techniques.precompile(g)}render(e){const t=e.find(({name:e})=>e===p.GAUSSIAN_SPLAT);if(this._handleFading(),!this._data.visibleGaussians||!this._data.orderTexture.texture||!this._data.textureAtlas.texture)return t;const s=this.techniques.getCompiled(P,this._configuration),a=this.techniques.getCompiled(c),i=this.techniques.getCompiled(g);if(!s||!i||!a)return this.requestRender(1),t;const{fullWidth:r,fullHeight:o}=this.bindParameters.camera;this._prepareParameters(o,r);const n=this.renderingContext,h=this.fboCache,m=h.acquire(r,o,"gaussian color output"),l=t.getAttachment(C);m.attachDepth(l),this._renderGaussianColorAndDepth(m,s);const u=h.acquire(r,o,this.produces);return this._depthCompositionPassParameters.splatDepth=m.getTexture(b),u.attachDepth(t.getAttachment(C)),n.bindFramebuffer(u.fbo),n.bindTechnique(i,this.bindParameters,this._depthCompositionPassParameters),n.screen.draw(),this._compositionPassParameters.color=t.getTexture(),this._compositionPassParameters.splatColor=m.getTexture(),n.bindFramebuffer(u.fbo),n.bindTechnique(a,this.bindParameters,this._compositionPassParameters),n.screen.draw(),m.release(),u}get slicePlaneEnabled(){return this._slicePlaneEnabled}set slicePlaneEnabled(e){this._slicePlaneEnabled!==e&&(this._slicePlaneEnabled=e,this.requestRender(1))}get _data(){return this.layerView.data}get _fadeHelper(){return this.layerView.fadeHelper}destroy(){super.destroy()}_onCameraChange(){const e=this.view.state.camera.eye,t=this.view.state.camera.ray.direction,s=.001;(Math.abs(e[0]-this._previousCameraPosition[0])>s||Math.abs(e[1]-this._previousCameraPosition[1])>s||Math.abs(e[2]-this._previousCameraPosition[2])>s||Math.abs(t[0]-this._previousCameraDirection[0])>s||Math.abs(t[1]-this._previousCameraDirection[1])>s||Math.abs(t[2]-this._previousCameraDirection[2])>s)&&(r(this._previousCameraPosition,e),r(this._previousCameraDirection,t),this._data.requestSort())}_prepareParameters(e,t){this._passParameters.splatOrder=this._data.orderTexture.texture,this._passParameters.splatFading=this._data.fadingTexture.texture,this._passParameters.splatAtlas=this._data.textureAtlas.texture;const s=Math.tan(.5*this.camera.fovY),a=s/e*t;i(this._passParameters.tanFov,a,s),this._passParameters.focalLength=e/(2*s);const r=this.view.qualitySettings.gaussianSplat.minimumSplatPixelRadius;this._passParameters.minSplatRadius=r*Math.sqrt(t*e)/Math.sqrt(2073600),this._prepareHighPrecisionCameraPosition()}_renderGaussianColorAndDepth(e,t){const s=this.renderingContext;e.acquireColor(b,5,"gaussian depth output"),s.bindFramebuffer(e.fbo),s.setClearColor(0,0,0,0),s.clear(16384),this.renderingContext.bindTechnique(t,this.bindParameters,this._passParameters),this.renderingContext.drawArraysInstanced(v.TRIANGLE_STRIP,0,4,this._data.visibleGaussians)}_prepareHighPrecisionCameraPosition(){o(this._passParameters.tileCameraPosition,this.camera.eye,1/S.tileSize),n(this._passParameters.tileCameraPosition,this._passParameters.tileCameraPosition),o(this._passParameters.cameraDelta,this._passParameters.tileCameraPosition,S.tileSize),h(this._passParameters.cameraDelta,this.camera.eye,this._passParameters.cameraDelta)}_handleFading(){if(0===this._fadeHelper.numFadingTiles)return void(this._previousFrameStart=null);this._previousFrameStart??=this.view.stage.renderer.renderContext.time;const e=this.view.stage?.renderer.renderContext.time-this._previousFrameStart;this._fadeHelper.updateAllTileFading(e),this._previousFrameStart=this.view.stage.renderer.renderContext.time,this._data.fadingTexture.updateTexture(this._data.textureAtlas.pageAllocator.pageCount)}static{this.tileSize=2.048}};e([s()],x.prototype,"produces",void 0),e([s({constructOnly:!0})],x.prototype,"layerView",void 0),x=S=e([a("esri.views.3d.webgl-engine.lib.GaussianSplatRenderNode")],x);export{x as GaussianSplatRenderNode};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import"../../../../core/has.js";import{webglDebugEnabled as t}from"../../../webgl/checkWebGLError.js";class r{constructor(r,e,i){this._context=r,this.locations=i,this._textures=new Map,this.source=t()?e:null,e.attributeNames.forEach(t=>{i.has(t)||console.error(`Missing VertexAttributeLocation for ${t} used in shader`)}),this._glProgram=r.programCache.get(e.generate("vertex",!0),e.generate("fragment",!0),i),this._glProgram.stop=()=>{throw new Error("Wrapped _glProgram used directly")},this.bind=e.generateBind(this),this.bindPass=e.generateBindPass(this),this.bindDraw=e.generateBindDraw(this)}get glName(){return this._glProgram.glName}get hasTransformFeedbackVaryings(){return this._glProgram.hasTransformFeedbackVaryings}get compiled(){return this._glProgram.compiled}setUniform1b(t,r){this._glProgram.setUniform1i(t,r?1:0)}setUniform1i(t,r){this._glProgram.setUniform1i(t,r)}setUniform1f(t,r,e){this._glProgram.setUniform1f(t,r,e)}setUniform2fv(t,r,e){this._glProgram.setUniform2fv(t,r,e)}setUniform3fv(t,r,e){this._glProgram.setUniform3fv(t,r,e)}setUniform4fv(t,r,e){this._glProgram.setUniform4fv(t,r,e)}setUniformMatrix3fv(t,r,e){this._glProgram.setUniformMatrix3fv(t,r,!1,e)}setUniformMatrix4fv(t,r,e){this._glProgram.setUniformMatrix4fv(t,r,!1,e)}setUniformMatrices4fv(t,r,e){this._glProgram.setUniformMatrices4fv(t,r,!1,e)}setUniform1fv(t,r,e){this._glProgram.setUniform1fv(t,r,e)}setUniform1iv(t,r){this._glProgram.setUniform1iv(t,r)}setUniform2iv(t,r){this._glProgram.setUniform2iv(t,r)}setUniform3iv(t,r){this._glProgram.setUniform3iv(t,r)}setUniform4iv(t,r){this._glProgram.setUniform4iv(t,r)}assertCompatibleVertexAttributeLocations(t,r){let e=t.locations;if(r){const t=new Map(e);r.forEach((r,i)=>t.set(i,e.size+r)),e=t}e.size!==this.locations.size&&console.error(`VertexAttributeLocations are incompatible: ${e}, ${this.locations}`),this.locations.forEach((t,r)=>{e.get(r)!==t&&console.error(`VertexAttributeLocations are incompatible: Program has ${r} at position ${t}, VAO has it at position ${e.get(r)}.`)})}stop(){this._textures.clear()}bindTexture(r,e){if(!e?.glName){const i=`Texture sampler ${r} in ${this._context.debugBoundTechnique} has no given Texture in ${(new Error).stack}`;t()&&console.error(i),e=this._context.emptyTexture}const i=this._ensureTextureUnit(r,e);this._context.useProgram(this),this.setUniform1i(r,i.unit),this._context.bindTexture(e,i.unit)}_ensureTextureUnit(t,r){let e=this._textures.get(t);return null==e?(e={texture:r,unit:this._textures.size},this._textures.set(t,e)):e.texture=r,e}}export{r as Program};
2
+ import"../../../../core/has.js";import t from"../../../../core/Logger.js";import{webglDebugEnabled as r}from"../../../webgl/checkWebGLError.js";class e{constructor(e,i,s){this._context=e,this.locations=s,this._textures=new Map,this.source=r()?i:null,i.attributeNames.forEach(r=>{s.has(r)||t.getLogger("esri.views.3d.webgl-engine.lib.Program").error(`Missing VertexAttributeLocation for ${r} used in shader`)}),this._glProgram=e.programCache.get(i.generate("vertex",!0),i.generate("fragment",!0),s),this._glProgram.stop=()=>{throw new Error("Wrapped _glProgram used directly")},this.bind=i.generateBind(this),this.bindPass=i.generateBindPass(this),this.bindDraw=i.generateBindDraw(this)}get glName(){return this._glProgram.glName}get hasTransformFeedbackVaryings(){return this._glProgram.hasTransformFeedbackVaryings}get compiled(){return this._glProgram.compiled}setUniform1b(t,r){this._glProgram.setUniform1i(t,r?1:0)}setUniform1i(t,r){this._glProgram.setUniform1i(t,r)}setUniform1f(t,r,e){this._glProgram.setUniform1f(t,r,e)}setUniform2fv(t,r,e){this._glProgram.setUniform2fv(t,r,e)}setUniform3fv(t,r,e){this._glProgram.setUniform3fv(t,r,e)}setUniform4fv(t,r,e){this._glProgram.setUniform4fv(t,r,e)}setUniformMatrix3fv(t,r,e){this._glProgram.setUniformMatrix3fv(t,r,!1,e)}setUniformMatrix4fv(t,r,e){this._glProgram.setUniformMatrix4fv(t,r,!1,e)}setUniformMatrices4fv(t,r,e){this._glProgram.setUniformMatrices4fv(t,r,!1,e)}setUniform1fv(t,r,e){this._glProgram.setUniform1fv(t,r,e)}setUniform1iv(t,r){this._glProgram.setUniform1iv(t,r)}setUniform2iv(t,r){this._glProgram.setUniform2iv(t,r)}setUniform3iv(t,r){this._glProgram.setUniform3iv(t,r)}setUniform4iv(t,r){this._glProgram.setUniform4iv(t,r)}assertCompatibleVertexAttributeLocations(t,r){let e=t.locations;if(r){const t=new Map(e);r.forEach((r,i)=>t.set(i,e.size+r)),e=t}e.size!==this.locations.size&&console.error(`VertexAttributeLocations are incompatible: ${e}, ${this.locations}`),this.locations.forEach((t,r)=>{e.get(r)!==t&&console.error(`VertexAttributeLocations are incompatible: Program has ${r} at position ${t}, VAO has it at position ${e.get(r)}.`)})}stop(){this._textures.clear()}bindTexture(t,e){if(!e?.glName){const i=`Texture sampler ${t} in ${this._context.debugBoundTechnique} has no given Texture in ${(new Error).stack}`;r()&&console.error(i),e=this._context.emptyTexture}const i=this._ensureTextureUnit(t,e);this._context.useProgram(this),this.setUniform1i(t,i.unit),this._context.bindTexture(e,i.unit)}_ensureTextureUnit(t,r){let e=this._textures.get(t);return null==e?(e={texture:r,unit:this._textures.size},this._textures.set(t,e)):e.texture=r,e}}export{e as Program};