@arcgis/core 5.1.0-next.47 → 5.1.0-next.49

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 (133) hide show
  1. package/assets/esri/core/workers/RemoteClient.js +1 -1
  2. package/assets/esri/core/workers/chunks/{521a671182b0f79e3624.js → 193775b3b7de8f5dc578.js} +1 -1
  3. package/assets/esri/core/workers/chunks/{c0ecb68387e342dddf58.js → 25509953f19fbc4949a1.js} +1 -1
  4. package/assets/esri/core/workers/chunks/2669a7195f1de21a9cf3.js +1 -0
  5. package/assets/esri/core/workers/chunks/330da3828eefd8d72d3f.js +1 -0
  6. package/assets/esri/core/workers/chunks/36425d29aaa5852cb41d.js +1 -0
  7. package/assets/esri/core/workers/chunks/440a650ed0867a16f559.js +1 -0
  8. package/assets/esri/core/workers/chunks/{aa367ca7f8326fd67881.js → 4afddb66242438b38df0.js} +1 -1
  9. package/assets/esri/core/workers/chunks/5344919fc6e8050450f1.js +1 -0
  10. package/assets/esri/core/workers/chunks/53c149bca42595b7dd1e.js +1 -0
  11. package/assets/esri/core/workers/chunks/{6afdaa6c4555c467dca7.js → 54420b66fd53d6e19ba5.js} +1 -1
  12. package/assets/esri/core/workers/chunks/74814678942a47fd48fb.js +1 -0
  13. package/assets/esri/core/workers/chunks/797bf402489b3677a5f7.js +1 -0
  14. package/assets/esri/core/workers/chunks/{5c830cce32710d70dfa6.js → 7dba4121cdd20dbc4b20.js} +1 -1
  15. package/assets/esri/core/workers/chunks/947a715b608c8affd812.js +1 -0
  16. package/assets/esri/core/workers/chunks/{867c0cd99a005a3d8e08.js → 9f7b5749f3ceca8d5978.js} +12 -9
  17. package/assets/esri/core/workers/chunks/aa69cbaa38b49677ddff.js +1 -0
  18. package/assets/esri/core/workers/chunks/{beb53b372d356800f333.js → ab414a60808ea05a63e6.js} +1 -1
  19. package/assets/esri/core/workers/chunks/b98dd9fc9a7e3ff6bd49.js +1 -0
  20. package/assets/esri/core/workers/chunks/cb8c17daec7055bf99cc.js +1 -0
  21. package/assets/esri/core/workers/chunks/{a9f35127c3f5bf42036b.js → de359f89e03da18999fc.js} +1 -1
  22. package/chunks/Fog.glsl.js +3 -3
  23. package/chunks/GlowComposition.glsl.js +5 -3
  24. package/config.js +1 -1
  25. package/core/has.js +1 -1
  26. package/core/workers/Connection.js +1 -1
  27. package/core/workers/WorkerHandle.js +1 -1
  28. package/core/workers/workers.js +1 -1
  29. package/geometry/support/curves/bezierCurveUtils.js +1 -1
  30. package/kernel.js +1 -1
  31. package/layers/Lyr3DWorkerHandle.js +1 -1
  32. package/layers/OrientedImageryLayer.d.ts +152 -0
  33. package/layers/graphics/data/QueryEngineResult.js +1 -1
  34. package/layers/mixins/ArcGISCachedService.js +1 -1
  35. package/layers/mixins/ArcGISMapService.js +1 -1
  36. package/layers/support/RasterJobHandler.js +1 -1
  37. package/layers/support/layerUtils.js +1 -1
  38. package/package.json +1 -1
  39. package/smartMapping/statistics/support/statsWorker.js +1 -1
  40. package/support/revision.js +1 -1
  41. package/time/TimeExtent.d.ts +34 -0
  42. package/time/TimeInterval.d.ts +15 -0
  43. package/views/2d/engine/vectorTiles/TileHandler.js +1 -1
  44. package/views/2d/engine/vectorTiles/TileHandler3D.js +1 -1
  45. package/views/2d/engine/vectorTiles/TileManager.js +1 -1
  46. package/views/2d/engine/vectorTiles/VTLPainter3D.js +1 -1
  47. package/views/2d/engine/vectorTiles/VectorTile.js +1 -1
  48. package/views/2d/engine/vectorTiles/VectorTileContainer.js +1 -1
  49. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/vector-tiles/VTLShaderCircle.js +1 -1
  50. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/vector-tiles/VTLShaderFill.js +1 -1
  51. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/vector-tiles/VTLShaderIcon.js +1 -1
  52. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/vector-tiles/VTLShaderLine.js +1 -1
  53. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/vector-tiles/VTLShaderText.js +1 -1
  54. package/views/2d/engine/webgl/shaderGraph/techniques/vectorTiles/VTLTechniqueCircle.js +1 -1
  55. package/views/2d/engine/webgl/shaderGraph/techniques/vectorTiles/VTLTechniqueFill.js +1 -1
  56. package/views/2d/engine/webgl/shaderGraph/techniques/vectorTiles/VTLTechniqueLine.js +1 -1
  57. package/views/2d/engine/webgl/shaderGraph/techniques/vectorTiles/VTLTechniqueSymbol.js +1 -1
  58. package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
  59. package/views/2d/engine/webgl/util/Fader.js +2 -0
  60. package/views/2d/layers/VectorTileLayerView2D.js +1 -1
  61. package/views/3d/analysis/AreaMeasurement/support/AreaMeasurementVisualization.js +1 -1
  62. package/views/3d/analysis/Dimension/LengthDimensionSubTool.js +1 -1
  63. package/views/3d/analysis/DirectLineMeasurement/DirectLineMeasurementVisualization.js +1 -1
  64. package/views/3d/analysis/Slice/SliceTool.js +1 -1
  65. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillVisualization.js +1 -1
  66. package/views/3d/interactive/visualElements/ExtendedLineVisualElement.js +1 -1
  67. package/views/3d/interactive/visualElements/LineVisualElement.js +1 -1
  68. package/views/3d/interactive/visualElements/MeasurementAreaVisualElement.js +1 -1
  69. package/views/3d/interactive/visualElements/OutlineVisualElement.js +1 -1
  70. package/views/3d/interactive/visualElements/RightAngleQuadVisualElement.js +1 -1
  71. package/views/3d/layers/FlowSubView3D.js +1 -1
  72. package/views/3d/layers/GaussianSplatLayerView3D.js +1 -1
  73. package/views/3d/layers/SceneLayerWorkerHandle.js +1 -1
  74. package/views/3d/layers/graphics/Graphics3DLineSymbolLayer.js +1 -1
  75. package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.js +1 -1
  76. package/views/3d/layers/i3s/Intersector.js +1 -1
  77. package/views/3d/layers/support/patternUtils.js +1 -1
  78. package/views/3d/support/gaussianSplatting/GaussianSplatDataStore.js +1 -1
  79. package/views/3d/support/gaussianSplatting/GaussianSplatFadeHelper.js +1 -1
  80. package/views/3d/support/gaussianSplatting/GaussianSplatFadeTexture.js +1 -1
  81. package/views/3d/support/gaussianSplatting/GaussianSplatOrderTexture.js +1 -1
  82. package/views/3d/support/gaussianSplatting/GaussianSplatTextureAtlas.js +1 -1
  83. package/views/3d/terrain/TerrainRenderer.js +1 -1
  84. package/views/3d/webgl-engine/collections/Component/Material/ComponentTechnique.js +1 -1
  85. package/views/3d/webgl-engine/core/renderPasses/RenderPassManager.js +1 -1
  86. package/views/3d/webgl-engine/effects/fog/Fog.glsl.js +1 -1
  87. package/views/3d/webgl-engine/effects/fog/Fog.js +1 -1
  88. package/views/3d/webgl-engine/effects/fog/FogTechniqueConfiguration.js +1 -1
  89. package/views/3d/webgl-engine/effects/glow/GlowComposition.glsl.js +1 -1
  90. package/views/3d/webgl-engine/effects/glow/GlowRenderNode.js +1 -1
  91. package/views/3d/webgl-engine/lib/BindParameters.js +1 -1
  92. package/views/3d/webgl-engine/lib/OrderIndependentTransparency.js +1 -1
  93. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  94. package/views/3d/webgl-engine/lib/intersectorUtilsConversions.js +1 -1
  95. package/views/3d/webgl-engine/materials/ColorMaterial.js +1 -1
  96. package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
  97. package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
  98. package/views/3d/webgl-engine/materials/PathTechnique.js +1 -1
  99. package/views/3d/webgl-engine/materials/PathTechniqueConfiguration.js +1 -1
  100. package/views/3d/webgl-engine/materials/PatternMaterial.js +1 -1
  101. package/views/3d/webgl-engine/materials/PolygonOffset.js +2 -0
  102. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  103. package/views/3d/webgl-engine/materials/SlicePlaneMaterial.js +1 -1
  104. package/views/3d/webgl-engine/materials/TriangleMaterial.js +1 -1
  105. package/views/3d/webgl-engine/materials/TriangleTechniqueConfiguration.js +1 -1
  106. package/views/3d/webgl-engine/shaders/ColorMaterialTechnique.js +1 -1
  107. package/views/3d/webgl-engine/shaders/DefaultMaterialTechniqueConfiguration.js +1 -1
  108. package/views/3d/webgl-engine/shaders/Dithering.glsl.js +4 -0
  109. package/views/3d/webgl-engine/shaders/HUDMaterialTechnique.js +1 -1
  110. package/views/3d/webgl-engine/shaders/OutputColorHighlightOLID.glsl.js +11 -10
  111. package/views/3d/webgl-engine/shaders/PatternTechnique.js +1 -1
  112. package/views/3d/webgl-engine/shaders/RibbonLineTechnique.js +1 -1
  113. package/views/3d/webgl-engine/shaders/RibbonLineTechniqueConfiguration.js +1 -1
  114. package/views/3d/webgl-engine/shaders/ShadedColorMaterialTechnique.js +1 -1
  115. package/views/3d/webgl-engine/shaders/ShadedColorMaterialTechniqueConfiguration.js +1 -1
  116. package/views/SceneView.d.ts +2 -1
  117. package/views/SceneView.js +1 -1
  118. package/views/draw/plugins/FreehandSegmentPlugin.js +1 -1
  119. package/views/support/LayerViewManager.js +1 -1
  120. package/views/types.d.ts +33 -2
  121. package/widgets/Sketch/support/PluginManager.js +1 -1
  122. package/assets/esri/core/workers/chunks/0601c316da0256a60538.js +0 -1
  123. package/assets/esri/core/workers/chunks/13d55e3c9aea04116eaa.js +0 -1
  124. package/assets/esri/core/workers/chunks/1a6a77902dd8c84e059a.js +0 -1
  125. package/assets/esri/core/workers/chunks/54c1d31e1efab765ee7a.js +0 -1
  126. package/assets/esri/core/workers/chunks/5b515b5741733bcb4645.js +0 -1
  127. package/assets/esri/core/workers/chunks/7f07f490c6fcc794c8d9.js +0 -1
  128. package/assets/esri/core/workers/chunks/970d971551e42f7ae08d.js +0 -1
  129. package/assets/esri/core/workers/chunks/abcb39ad1e2d54710766.js +0 -1
  130. package/assets/esri/core/workers/chunks/c2aa3b1344b42a904234.js +0 -1
  131. package/assets/esri/core/workers/chunks/cf5e4cf9b1aa37eeb6b0.js +0 -1
  132. package/assets/esri/core/workers/chunks/e63046a9567d84228644.js +0 -1
  133. package/assets/esri/core/workers/chunks/f4ec2dcdc4bbf7dbcc94.js +0 -1
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as s}from"tslib";import{disposeMaybe as e}from"../../../../../core/maybe.js";import{subclass as t}from"../../../../../core/accessorSupport/decorators.js";import{fromMat4 as r,transpose as a,invert as i}from"../../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as o}from"../../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{set as h,copy as n}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as m}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{MaterialPassParameters as c,ShadowMapPassParameters as d,HighlightPassParameters as u,ViewshedShadowMapPassParameters as p,AllRenderPasses as l}from"./AllRenderPasses.js";import{TwoVectorPosition as _}from"../util/TwoVectorPosition.js";import{SyncRenderPlugin as w}from"../../effects/RenderPlugin.js";import{DepthRange as f}from"../../lib/DepthRange.js";import{SizedPixelFormat as P,DataType as g}from"../../../../webgl/enums.js";import x from"../../../../webgl/Texture.js";import{TextureDescriptor as y}from"../../../../webgl/TextureDescriptor.js";let b=class extends w{constructor(){super(...arguments),this.produces=new Map([[2,s=>this._produces(s,2)],[4,s=>this._produces(s,4)],[0,s=>this._produces(s,0)],[8,s=>this._produces(s,8)],[10,s=>this._produces(s,10)]]),this._drawParametersArray=new Array,this._drawParametersSet=new Set,this._transformationTexture=null,this._materialPassParameters=new c,this._shadowPassParameters=new d,this._highlightPassParameters=new u,this._viewshedPassParameters=new p,this._systems=new Set}initializeRenderContext(s){this._context=s,this._passes=new l(s,this)}get rctx(){return this._context.renderContext.rctx}get bind(){return this._context.renderContext.bind}uninitializeRenderContext(){}dispose(){this._context=null,this._systems.clear(),this._transformationTexture=e(this._transformationTexture),this._passes?.opaque.destroy(),this._passes?.transparent.destroy(),this._passes?.integratedMesh.destroy(),this._passes?.transparentIntegratedMesh.destroy(),this._passes?.occludedGround.destroy(),this._passes?.shadowMap.destroy(),this._passes?.highlight.destroy(),this._passes?.highlightIntegratedMesh.destroy(),this._passes?.highlightShadowMap.destroy(),this._passes?.viewshedShadowMap.destroy(),this._passes?.defaultShadowMap.destroy(),this._passes=null}register(s){this._systems.add(s)}_produces(s,e){return!!this._invoke(s,e,s=>s.count>0)}prepareRender(s){const{_systems:t,_passes:r}=this;if(0!==t.size&&null!=r){this._drawParametersSet.clear(),this._drawParametersArray.length=0,this._transformationTexture=e(this._transformationTexture);for(const s of Object.values(r))s.prepareSubmit();t.forEach(e=>e.submit(r,s.bind)),this._updateTransformationTexture();for(const s of Object.values(r))s.finishSubmit();this._context.techniques.frameUpdate()}}acquireTechniques(s){if(0===this._systems.size)return null;const e=5===s.output||6===s.output||7===s.output?this._shadowPassParameters:8===s.output?this._viewshedPassParameters:10===s.output?this._highlightPassParameters:this._materialPassParameters,{bind:t}=s;return this._updateParameters(t.camera,e,t.slot),this._invoke(s.output,s.bind.slot,(e,t)=>(t.transformationTexture=this._transformationTexture,e.acquire(t,s.bind)))}render(s,e){this._invoke(s.output,s.bind.slot,(t,r)=>t.dispatch(r,s.bind,e))}_invoke(s,e,t){if(null==this._passes)return null;switch(e){case 2:switch(s){case 0:case 1:case 2:case 3:case 4:case 11:return t(this._passes.opaque,this._materialPassParameters);case 10:return t(this._passes.highlight,this._highlightPassParameters);case 5:return t(this._passes.shadowMap,this._shadowPassParameters);case 6:return t(this._passes.highlightShadowMap,this._shadowPassParameters);case 7:return t(this._passes.defaultShadowMap,this._shadowPassParameters);case 8:return t(this._passes.viewshedShadowMap,this._viewshedPassParameters)}break;case 4:switch(s){case 0:case 1:case 2:case 3:case 4:case 11:return t(this._passes.transparent,this._materialPassParameters)}break;case 0:switch(s){case 0:case 1:case 2:case 3:case 4:case 11:case 9:return t(this._passes.integratedMesh,this._materialPassParameters);case 10:return t(this._passes.highlightIntegratedMesh,this._highlightPassParameters)}break;case 8:switch(s){case 0:case 1:case 2:return t(this._passes.transparentIntegratedMesh,this._materialPassParameters)}break;case 10:switch(s){case 0:case 1:case 2:case 3:case 4:case 11:return t(this._passes.occludedGround,this._materialPassParameters)}}return null}requestRender(){this._context.requestRender()}queryDepthRange(s){const e=new f;return this._systems.forEach(t=>e.union(t.queryDepthRange(s))),e}get hasEmitters(){let s=!1;return this._systems.forEach(e=>s=e.hasEmissions||s),s}_updateParameters(s,e,t){const o=s.viewInverseTransposeMatrix,m=4===t,c=10===t;h(T,o[3],o[7],o[11]),v.set(T),n(e.transformWorldFromViewTH,v.high),n(e.transformWorldFromViewTL,v.low),n(e.slicePlaneLocalOrigin,T),r(e.transformViewFromCameraRelativeRS,s.viewMatrix),0===e.identifier&&(this._materialPassParameters.transparent=m,this._materialPassParameters.occludedGround=c,a(M,e.transformViewFromCameraRelativeRS),i(e.transformNormalViewFromGlobal,M))}hasHighlight(s){for(const e of this._systems)if(e.hasHighlight(s))return!0;return!1}registerDrawParameters(s){if(!this._drawParametersSet.has(s)){this._drawParametersSet.add(s);const e=this._drawParametersArray.length;this._drawParametersArray.push(s),s.setTransformationDrawId(e)}}_updateTransformationTexture(){const s=this._drawParametersArray.length;if(0===s)return;const e=5,t=3*e,r=2**Math.ceil(Math.log2(s)),a=new Float32Array(r*t);for(let i=0;i<s;i++){const s=this._drawParametersArray[i];s.setTransformationDrawId(i);const e=i*t;a.set(s.transformationFloats,e)}if(this._transformationTexture&&this._transformationTexture.descriptor.height>=s)this._transformationTexture.updateData(0,0,0,e,s,a);else{this._transformationTexture?.dispose();const s=new y(e,r);s.internalFormat=P.RGB32F,s.dataType=g.FLOAT,s.hasMipmap=!1,s.isImmutable=!0,s.pixelFormat=6407,s.samplingMode=9728,this._transformationTexture=new x(this.rctx,s,a)}}};b=s([t("esri.views.3d.webgl-engine.core.renderPasses.RenderPassManager")],b);const T=m(),M=o(),v=new _;export{b as RenderPassManager};
2
+ import{__decorate as s}from"tslib";import{disposeMaybe as e}from"../../../../../core/maybe.js";import{subclass as t}from"../../../../../core/accessorSupport/decorators.js";import{fromMat4 as r,transpose as a,invert as i}from"../../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as o}from"../../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{set as h,copy as n}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as m}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{MaterialPassParameters as c,ShadowMapPassParameters as d,HighlightPassParameters as u,ViewshedShadowMapPassParameters as p,AllRenderPasses as l}from"./AllRenderPasses.js";import{TwoVectorPosition as _}from"../util/TwoVectorPosition.js";import{SyncRenderPlugin as w}from"../../effects/RenderPlugin.js";import{DepthRange as f}from"../../lib/DepthRange.js";import{SizedPixelFormat as P,DataType as g}from"../../../../webgl/enums.js";import x from"../../../../webgl/Texture.js";import{TextureDescriptor as y}from"../../../../webgl/TextureDescriptor.js";let b=class extends w{constructor(){super(...arguments),this.produces=new Map([[2,s=>this._produces(s,2)],[4,s=>this._produces(s,4)],[0,s=>this._produces(s,0)],[7,s=>this._produces(s,7)],[10,s=>this._produces(s,10)]]),this._drawParametersArray=new Array,this._drawParametersSet=new Set,this._transformationTexture=null,this._materialPassParameters=new c,this._shadowPassParameters=new d,this._highlightPassParameters=new u,this._viewshedPassParameters=new p,this._systems=new Set}initializeRenderContext(s){this._context=s,this._passes=new l(s,this)}get rctx(){return this._context.renderContext.rctx}get bind(){return this._context.renderContext.bind}uninitializeRenderContext(){}dispose(){this._context=null,this._systems.clear(),this._transformationTexture=e(this._transformationTexture),this._passes?.opaque.destroy(),this._passes?.transparent.destroy(),this._passes?.integratedMesh.destroy(),this._passes?.transparentIntegratedMesh.destroy(),this._passes?.occludedGround.destroy(),this._passes?.shadowMap.destroy(),this._passes?.highlight.destroy(),this._passes?.highlightIntegratedMesh.destroy(),this._passes?.highlightShadowMap.destroy(),this._passes?.viewshedShadowMap.destroy(),this._passes?.defaultShadowMap.destroy(),this._passes=null}register(s){this._systems.add(s)}_produces(s,e){return!!this._invoke(s,e,s=>s.count>0)}prepareRender(s){const{_systems:t,_passes:r}=this;if(0!==t.size&&null!=r){this._drawParametersSet.clear(),this._drawParametersArray.length=0,this._transformationTexture=e(this._transformationTexture);for(const s of Object.values(r))s.prepareSubmit();t.forEach(e=>e.submit(r,s.bind)),this._updateTransformationTexture();for(const s of Object.values(r))s.finishSubmit();this._context.techniques.frameUpdate()}}acquireTechniques(s){if(0===this._systems.size)return null;const e=5===s.output||6===s.output||7===s.output?this._shadowPassParameters:8===s.output?this._viewshedPassParameters:10===s.output?this._highlightPassParameters:this._materialPassParameters,{bind:t}=s;return this._updateParameters(t.camera,e,t.slot),this._invoke(s.output,s.bind.slot,(e,t)=>(t.transformationTexture=this._transformationTexture,e.acquire(t,s.bind)))}render(s,e){this._invoke(s.output,s.bind.slot,(t,r)=>t.dispatch(r,s.bind,e))}_invoke(s,e,t){if(null==this._passes)return null;switch(e){case 2:switch(s){case 0:case 1:case 2:case 3:case 4:case 11:return t(this._passes.opaque,this._materialPassParameters);case 10:return t(this._passes.highlight,this._highlightPassParameters);case 5:return t(this._passes.shadowMap,this._shadowPassParameters);case 6:return t(this._passes.highlightShadowMap,this._shadowPassParameters);case 7:return t(this._passes.defaultShadowMap,this._shadowPassParameters);case 8:return t(this._passes.viewshedShadowMap,this._viewshedPassParameters)}break;case 4:switch(s){case 0:case 1:case 2:case 3:case 4:case 11:return t(this._passes.transparent,this._materialPassParameters)}break;case 0:switch(s){case 0:case 1:case 2:case 3:case 4:case 11:case 9:return t(this._passes.integratedMesh,this._materialPassParameters);case 10:return t(this._passes.highlightIntegratedMesh,this._highlightPassParameters)}break;case 7:switch(s){case 0:case 1:case 2:return t(this._passes.transparentIntegratedMesh,this._materialPassParameters)}break;case 10:switch(s){case 0:case 1:case 2:case 3:case 4:case 11:return t(this._passes.occludedGround,this._materialPassParameters)}}return null}requestRender(){this._context.requestRender()}queryDepthRange(s){const e=new f;return this._systems.forEach(t=>e.union(t.queryDepthRange(s))),e}get hasEmitters(){let s=!1;return this._systems.forEach(e=>s=e.hasEmissions||s),s}_updateParameters(s,e,t){const o=s.viewInverseTransposeMatrix,m=4===t,c=10===t;h(T,o[3],o[7],o[11]),v.set(T),n(e.transformWorldFromViewTH,v.high),n(e.transformWorldFromViewTL,v.low),n(e.slicePlaneLocalOrigin,T),r(e.transformViewFromCameraRelativeRS,s.viewMatrix),0===e.identifier&&(this._materialPassParameters.transparent=m,this._materialPassParameters.occludedGround=c,a(M,e.transformViewFromCameraRelativeRS),i(e.transformNormalViewFromGlobal,M))}hasHighlight(s){for(const e of this._systems)if(e.hasHighlight(s))return!0;return!1}registerDrawParameters(s){if(!this._drawParametersSet.has(s)){this._drawParametersSet.add(s);const e=this._drawParametersArray.length;this._drawParametersArray.push(s),s.setTransformationDrawId(e)}}_updateTransformationTexture(){const s=this._drawParametersArray.length;if(0===s)return;const e=5,t=3*e,r=2**Math.ceil(Math.log2(s)),a=new Float32Array(r*t);for(let i=0;i<s;i++){const s=this._drawParametersArray[i];s.setTransformationDrawId(i);const e=i*t;a.set(s.transformationFloats,e)}if(this._transformationTexture&&this._transformationTexture.descriptor.height>=s)this._transformationTexture.updateData(0,0,0,e,s,a);else{this._transformationTexture?.dispose();const s=new y(e,r);s.internalFormat=P.RGB32F,s.dataType=g.FLOAT,s.hasMipmap=!1,s.isImmutable=!0,s.pixelFormat=6407,s.samplingMode=9728,this._transformationTexture=new x(this.rctx,s,a)}}};b=s([t("esri.views.3d.webgl-engine.core.renderPasses.RenderPassManager")],b);const T=m(),M=o(),v=new _;export{b as RenderPassManager};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import"../../core/shaderLibrary/output/ReadDepth.glsl.js";import"../../core/shaderLibrary/shading/Gamma.glsl.js";import"../../core/shaderModules/Float3PassUniform.js";import"../../core/shaderModules/FloatPassUniform.js";import"../../core/shaderModules/glsl.js";import"../../core/shaderModules/Texture2DBindUniform.js";import"../../core/shaderModules/Texture2DPassUniform.js";import"../raymarching/RayDistanceFalloff.glsl.js";import"../../shaders/ScreenSpacePassAtmosphere.glsl.js";import"../../shaders/ToneMapping.glsl.js";import"../../../../webgl/ShaderBuilder.js";export{F as FogPassParameters,b as build}from"../../../../../chunks/Fog.glsl.js";
2
+ import"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import"../../core/shaderLibrary/output/ReadDepth.glsl.js";import"../../core/shaderLibrary/shading/Gamma.glsl.js";import"../../core/shaderModules/Float3PassUniform.js";import"../../core/shaderModules/FloatPassUniform.js";import"../../core/shaderModules/glsl.js";import"../../core/shaderModules/Texture2DBindUniform.js";import"../../core/shaderModules/Texture2DPassUniform.js";import"../raymarching/RayDistanceFalloff.glsl.js";import"../../shaders/oitResolution.glsl.js";import"../../shaders/ScreenSpacePassAtmosphere.glsl.js";import"../../shaders/ToneMapping.glsl.js";import"../../../../webgl/ShaderBuilder.js";export{F as FogPassParameters,b as build}from"../../../../../chunks/Fog.glsl.js";
@@ -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,smoothstep as s}from"../../../../../core/mathUtils.js";import{releaseMaybe as r}from"../../../../../core/maybe.js";import{watch as a,syncAndInitial as i}from"../../../../../core/reactiveUtils.js";import{subclass as o}from"../../../../../core/accessorSupport/decorators.js";import{copy as n,normalize as h,dot as m,scale as p,lerp as c,length as l}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as d,fromValues as _}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as u}from"../../../../../geometry/ellipsoidUtils.js";import{InternalRenderCategory as f}from"../../../webgl.js";import{heightLimit as g}from"../../../environment/weather.js";import{TransparentEnvironment as P}from"../TransparentEnvironment.js";import{Blit as w}from"../blit/Blit.js";import{F as b}from"../../../../../chunks/Fog.glsl.js";import{FogTechnique as y}from"./FogTechnique.js";import{FogTechniqueConfiguration as v}from"./FogTechniqueConfiguration.js";import{ColorAttachment1 as F,DepthStencilAttachment as j,ColorAttachment0 as E}from"../../../../webgl/enums.js";const R=.95,q=1;let x=class extends P{constructor(t){super(t),this._configuration=new v,this._newParameters=new T,this._oldParameters=new T,this._fadedParameters=new T,this._parameters=this._newParameters,this._passParameters=new b,this._blit=null;const e=u(t.view.spatialReference);this._planetRadius=e.radius,this._atmosphereRadius=e.radius+e.atmosphereHeight}initialize(){this.addHandles([a(()=>this.view.environment.atmosphereEnabled,()=>this._updateEnabled(),i),a(()=>this.view.environment.weather,()=>this._updateEnabled(),i),a(()=>this._updateFogParameters(),()=>{},i)]),this.addHandles(a(()=>this._fadeFactor,t=>this._fade(t),i))}_updateEnabled(){this.view.environment.atmosphereEnabled&&this.view.environment.weather?this._enable():this._disable()}get _fadeFactor(){return this.view.stage?.renderer.renderContext.bind.clouds.fadeFactor??1}_fade(t){const{_newParameters:e,_oldParameters:s}=this;t>=1?(this._parameters=e,this._oldParameters.copyFrom(this._newParameters)):t<=0?this._parameters=s:(this._fadedParameters.lerp(s,e,t),this._parameters=this._fadedParameters)}_updateFogParameters(){const t=this.view.environment.weather,s="foggy"===t.type||"snowy"===t.type||"rainy"===t.type;this._newParameters.strength="foggy"===t.type?e(3e-5,.005,t.fogStrength**3):"snowy"===t.type||"rainy"===t.type?e(4e-6,2e-4,(t.precipitation??0)**3):0,this._newParameters.amount=s?1:0,"foggy"!==t.type&&"snowy"!==t.type||n(this._newParameters.color,H),"rainy"===t.type&&n(this._newParameters.color,A),this._fadeFactor>=1&&this._oldParameters.copyFrom(this._newParameters),this.requestRender(2)}precompile(){this._parameters.amount>0&&(this._configuration.hasEmissive=this.bindParameters.hasEmission,this.techniques.precompile(y,this._configuration))}render(t){const e=t.find(({name:t})=>t===f.TRANSPARENT_ENVIRONMENT);if(0===this._parameters.amount)return e;if(this._update(),this._passParameters.amount<=0)return e;const s=e.getAttachment(F);this._configuration.hasEmissive=null!=s;const a=this.techniques.getCompiled(y,this._configuration);if(!a)return this.requestRender(1),e;const i=e.getAttachment(j),o=this.renderingContext,{fullWidth:n,fullHeight:h}=this.bindParameters.camera,m=n,p=h;if(s){const t=this.bindParameters.hasFloatOit.value?8:5;this._passParameters.emission=this.fboCache.acquire(m,p,"glow horizontal",t),this._blit??=new w(this.techniques),this._blit.blitTexture(o,s?.attachment,this.bindParameters,this._passParameters.emission)}return e.attachDepth(null),o.bindFramebuffer(e.fbo),o.bindTechnique(a,this.bindParameters,this._passParameters),o.setDrawBuffers([E]),o.screen.draw(),e.attachDepth(i),this._passParameters.emission=r(this._passParameters.emission),e}_update(){const t=this.bindParameters.camera;h(C,t.eye);const e=Math.max(0,m(C,this.bindParameters.lighting.mainLight.direction)),r=this._parameters.color;p(N,r,.1),c(this._passParameters.color,N,r,e);const a=l(t.eye);this._passParameters.atmosphereC=a**2-this._atmosphereRadius**2,this._passParameters.amount=(1-s(R*g,q*g,Math.abs(a-this._planetRadius)))*this._parameters.amount,this._passParameters.strength=this._parameters.strength}get test(){return{parameters:this._passParameters}}};x=t([o("esri.views.3d.webgl-engine.effects.fog.Fog")],x);class T{constructor(){this.color=d(),this.strength=0,this.amount=0}copyFrom(t){this.amount=t.amount,this.strength=t.strength,n(this.color,t.color)}lerp(t,s,r){this.amount=e(t.amount,s.amount,r),this.strength=e(t.strength,s.strength,r),c(this.color,t.color,s.color,r)}}const C=d(),N=d(),A=_(.5,.5,.5),H=_(1.5,1.5,1.5);export{x as Fog,T as FogParameters};
2
+ import{__decorate as t}from"tslib";import{lerp as e,smoothstep as s}from"../../../../../core/mathUtils.js";import{releaseMaybe as r}from"../../../../../core/maybe.js";import{watch as a,syncAndInitial as i}from"../../../../../core/reactiveUtils.js";import{subclass as o}from"../../../../../core/accessorSupport/decorators.js";import{copy as n,normalize as h,dot as m,scale as p,lerp as c,length as l}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as d,fromValues as _}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as u}from"../../../../../geometry/ellipsoidUtils.js";import{InternalRenderCategory as f}from"../../../webgl.js";import{heightLimit as g}from"../../../environment/weather.js";import{TransparentEnvironment as P}from"../TransparentEnvironment.js";import{Blit as w}from"../blit/Blit.js";import{F as b}from"../../../../../chunks/Fog.glsl.js";import{FogTechnique as y}from"./FogTechnique.js";import{FogTechniqueConfiguration as v}from"./FogTechniqueConfiguration.js";import{ColorAttachment1 as F,DepthStencilAttachment as j,ColorAttachment0 as E}from"../../../../webgl/enums.js";const R=.95,q=1;let x=class extends P{constructor(t){super(t),this._configuration=new v,this._newParameters=new T,this._oldParameters=new T,this._fadedParameters=new T,this._parameters=this._newParameters,this._passParameters=new b,this._blit=null;const e=u(t.view.spatialReference);this._planetRadius=e.radius,this._atmosphereRadius=e.radius+e.atmosphereHeight}initialize(){this.addHandles([a(()=>this.view.environment.atmosphereEnabled,()=>this._updateEnabled(),i),a(()=>this.view.environment.weather,()=>this._updateEnabled(),i),a(()=>this._updateFogParameters(),()=>{},i)]),this.addHandles(a(()=>this._fadeFactor,t=>this._fade(t),i))}_updateEnabled(){this.view.environment.atmosphereEnabled&&this.view.environment.weather?this._enable():this._disable()}get _fadeFactor(){return this.view.stage?.renderer.renderContext.bind.clouds.fadeFactor??1}_fade(t){const{_newParameters:e,_oldParameters:s}=this;t>=1?(this._parameters=e,this._oldParameters.copyFrom(this._newParameters)):t<=0?this._parameters=s:(this._fadedParameters.lerp(s,e,t),this._parameters=this._fadedParameters)}_updateFogParameters(){const t=this.view.environment.weather,s="foggy"===t.type||"snowy"===t.type||"rainy"===t.type;this._newParameters.strength="foggy"===t.type?e(3e-5,.005,t.fogStrength**3):"snowy"===t.type||"rainy"===t.type?e(4e-6,2e-4,(t.precipitation??0)**3):0,this._newParameters.amount=s?1:0,"foggy"!==t.type&&"snowy"!==t.type||n(this._newParameters.color,H),"rainy"===t.type&&n(this._newParameters.color,A),this._fadeFactor>=1&&this._oldParameters.copyFrom(this._newParameters),this.requestRender(2)}precompile(){this._configuration.hasFloatOit=this.bindParameters.hasFloatOit.value,this._parameters.amount>0&&(this._configuration.hasEmissive=this.bindParameters.hasEmission,this.techniques.precompile(y,this._configuration))}render(t){const e=t.find(({name:t})=>t===f.TRANSPARENT_ENVIRONMENT);if(0===this._parameters.amount)return e;if(this._update(),this._passParameters.amount<=0)return e;const s=e.getAttachment(F);this._configuration.hasEmissive=null!=s;const a=this.techniques.getCompiled(y,this._configuration);if(!a)return this.requestRender(1),e;const i=e.getAttachment(j),o=this.renderingContext,{fullWidth:n,fullHeight:h}=this.bindParameters.camera,m=n,p=h;if(s){const t=this.bindParameters.hasFloatOit.value?8:5;this._passParameters.emission=this.fboCache.acquire(m,p,"glow horizontal",t),this._blit??=new w(this.techniques),this._blit.blitTexture(o,s?.attachment,this.bindParameters,this._passParameters.emission)}return e.attachDepth(null),o.bindFramebuffer(e.fbo),o.bindTechnique(a,this.bindParameters,this._passParameters),o.setDrawBuffers([E]),o.screen.draw(),e.attachDepth(i),this._passParameters.emission=r(this._passParameters.emission),e}_update(){const t=this.bindParameters.camera;h(C,t.eye);const e=Math.max(0,m(C,this.bindParameters.lighting.mainLight.direction)),r=this._parameters.color;p(N,r,.1),c(this._passParameters.color,N,r,e);const a=l(t.eye);this._passParameters.atmosphereC=a**2-this._atmosphereRadius**2,this._passParameters.amount=(1-s(R*g,q*g,Math.abs(a-this._planetRadius)))*this._parameters.amount,this._passParameters.strength=this._parameters.strength}get test(){return{parameters:this._passParameters}}};x=t([o("esri.views.3d.webgl-engine.effects.fog.Fog")],x);class T{constructor(){this.color=d(),this.strength=0,this.amount=0}copyFrom(t){this.amount=t.amount,this.strength=t.strength,n(this.color,t.color)}lerp(t,s,r){this.amount=e(t.amount,s.amount,r),this.strength=e(t.strength,s.strength,r),c(this.color,t.color,s.color,r)}}const C=d(),N=d(),A=_(.5,.5,.5),H=_(1.5,1.5,1.5);export{x as Fog,T as FogParameters};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as s}from"tslib";import{parameter as e,ShaderTechniqueConfiguration as i}from"../../core/shaderTechnique/ShaderTechniqueConfiguration.js";class o extends i{constructor(){super(...arguments),this.hasEmissive=!1}}s([e()],o.prototype,"hasEmissive",void 0);export{o as FogTechniqueConfiguration};
2
+ import{__decorate as o}from"tslib";import{parameter as s,ShaderTechniqueConfiguration as t}from"../../core/shaderTechnique/ShaderTechniqueConfiguration.js";class i extends t{constructor(){super(...arguments),this.hasFloatOit=!0,this.hasEmissive=!1}}o([s()],i.prototype,"hasFloatOit",void 0),o([s()],i.prototype,"hasEmissive",void 0);export{i as FogTechniqueConfiguration};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import"../../core/shaderLibrary/output/ReadDepth.glsl.js";import"../../core/shaderLibrary/shading/Gamma.glsl.js";import"../../core/shaderModules/FloatPassUniform.js";import"../../core/shaderModules/FloatsPassUniform.js";import"../../core/shaderModules/glsl.js";import"../../core/shaderModules/IntegerPassUniform.js";import"../../core/shaderModules/Texture2DBindUniform.js";import"../../core/shaderModules/Texture2DPassUniform.js";import"../raymarching/RayDistanceFalloff.glsl.js";import"../../shaders/oitResolution.glsl.js";import"../../shaders/ScreenSpacePassAtmosphere.glsl.js";import"../../shaders/ToneMapping.glsl.js";import"../../../../webgl/ShaderBuilder.js";export{G as GlowCompositionPassParameters,a as GlowLodFactors,c as build,m as mixPreset}from"../../../../../chunks/GlowComposition.glsl.js";
2
+ import"../../core/shaderLibrary/output/ReadDepth.glsl.js";import"../../core/shaderLibrary/shading/Gamma.glsl.js";import"../../core/shaderModules/FloatPassUniform.js";import"../../core/shaderModules/FloatsPassUniform.js";import"../../core/shaderModules/glsl.js";import"../../core/shaderModules/IntegerPassUniform.js";import"../../core/shaderModules/Texture2DBindUniform.js";import"../../core/shaderModules/Texture2DPassUniform.js";import"../raymarching/RayDistanceFalloff.glsl.js";import"../../shaders/Dithering.glsl.js";import"../../shaders/oitResolution.glsl.js";import"../../shaders/ScreenSpacePassAtmosphere.glsl.js";import"../../shaders/ToneMapping.glsl.js";import"../../../../webgl/ShaderBuilder.js";export{G as GlowCompositionPassParameters,a as GlowLodFactors,c as build,m as mixPreset}from"../../../../../chunks/GlowComposition.glsl.js";
@@ -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 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{oitReductionFactor as P}from"../../shaders/oitResolution.glsl.js";import{ColorAttachment1 as w,DepthStencilAttachment as C}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 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}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.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.hasFloatOit=this._blurHorizontalConfiguration.hasFloatOit=this._blurVerticalConfiguration.hasFloatOit=this.bindParameters.hasFloatOit.value,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.getTexture(),r=e.getAttachment(C);if(2===this._mode){this._compositionConfiguration.blurEnabled=!1;const t=this.techniques.getCompiled(f,this._compositionConfiguration);if(!t)return this.requestRender(1),e;const 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,w),c}this._compositionConfiguration.blurEnabled=!0;const o=this.techniques.getCompiled(u,this._blurHorizontalConfiguration),n=this.techniques.getCompiled(u,this._blurVerticalConfiguration),h=this.techniques.getCompiled(f,this._compositionConfiguration);if(!o||!n||!h)return this.requestRender(1),e;const m=this.fboCache,{fullWidth:l,fullHeight:p}=this.bindParameters.camera,g=this.renderingContext;let _=Math.ceil(l/2),d=Math.ceil(p/2);const b=5;this._blurParameters.emissionsToDownsample=i.attachment,this._blurParameters.inputScale=P,this._blurParameters.blurRadius=this._logicalBlurRadius;for(let a=0;a<b;a++){const t=m.acquire(_,d,"glow horizontal",8);this._prepareFBO(t,_,d),g.bindTechnique(o,this.bindParameters,this._blurParameters),g.screen.draw();const e=m.acquire(_,d,"glow vertical",8);this._blurParameters.inputScale=1,this._blurParameters.emissionsToDownsample=t.getTexture(),this._prepareFBO(e,_,d),g.bindTechnique(n,this.bindParameters,this._blurParameters),g.screen.draw(),t.release(),this._glowResults[a]=e,_=Math.ceil(_/2),d=Math.ceil(d/2),this._blurParameters.emissionsToDownsample=e.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=s,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 q=m.acquire(s.descriptor.width,s.descriptor.height,this.produces);return q.acquireColor(w,8,"emissive glow"),this._prepareFBO(q,l,p,!0),g.bindTechnique(h,this.bindParameters,this._compositionParameters),g.screen.draw(),this._glowResults.forEach(t=>t.release()),q.attachDepth(r),q}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{oitReductionFactor as P}from"../../shaders/oitResolution.glsl.js";import{ColorAttachment1 as w,DepthStencilAttachment as C}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 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}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.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.hasFloatOit=this._blurHorizontalConfiguration.hasFloatOit=this._blurVerticalConfiguration.hasFloatOit=this.bindParameters.hasFloatOit.value,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.getTexture(),r=e.getAttachment(C);if(2===this._mode){this._compositionConfiguration.blurEnabled=!1;const t=this.techniques.getCompiled(f,this._compositionConfiguration);if(!t)return this.requestRender(1),e;const 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,w),c}this._compositionConfiguration.blurEnabled=!0;const o=this.techniques.getCompiled(u,this._blurHorizontalConfiguration),n=this.techniques.getCompiled(u,this._blurVerticalConfiguration),h=this.techniques.getCompiled(f,this._compositionConfiguration);if(!o||!n||!h)return this.requestRender(1),e;const m=this.fboCache,{fullWidth:l,fullHeight:p}=this.bindParameters.camera,g=this.renderingContext;let _=Math.ceil(l/2),d=Math.ceil(p/2);const b=5;this._blurParameters.emissionsToDownsample=i.attachment,this._blurParameters.inputScale=P,this._blurParameters.blurRadius=this._logicalBlurRadius;for(let a=0;a<b;a++){const t=m.acquire(_,d,"glow horizontal",8);this._prepareFBO(t,_,d),g.bindTechnique(o,this.bindParameters,this._blurParameters),g.screen.draw();const e=m.acquire(_,d,"glow vertical",8);this._blurParameters.inputScale=1,this._blurParameters.emissionsToDownsample=t.getTexture(),this._prepareFBO(e,_,d),g.bindTechnique(n,this.bindParameters,this._blurParameters),g.screen.draw(),t.release(),this._glowResults[a]=e,_=Math.ceil(_/2),d=Math.ceil(d/2),this._blurParameters.emissionsToDownsample=e.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=s,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 q=m.acquire(s.descriptor.width,s.descriptor.height,this.produces);return q.acquireColor(w,this.bindParameters.hasFloatOit?8:5,"emissive glow"),this._prepareFBO(q,l,p,!0),g.bindTechnique(h,this.bindParameters,this._compositionParameters),g.screen.draw(),this._glowResults.forEach(t=>t.release()),q.attachDepth(r),q}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};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{releaseMaybe as t}from"../../../../core/maybe.js";import{signal as i}from"../../../../core/signal.js";import{create as e}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{create as h}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import s from"../../webgl/RenderCamera.js";import{CloudsParameters as r}from"../effects/clouds/CloudsParameters.js";import{OITPolygonOffsetLimit as n}from"./OrderIndependentTransparency.js";import{SceneLighting as l}from"../lighting/SceneLighting.js";class g{constructor(t,i){this.width=t,this.height=i}}class o{constructor(t,e){this._rctx=t,this.shadowMap=e,this._output=0,this.slot=2,this.slicePlane=null,this.hasOccludees=!1,this.hasEmission=!1,this.hasFloatOit=i(!0),this.enableFillLights=!0,this.alignPixelEnabled=!1,this.decorations=!0,this.overlayStretch=1,this.viewshedEnabled=!1,this.cutFillEnabled=!1,this._camera=new s,this._inverseViewport=h(),this._oldLighting=new l,this._newLighting=new l,this._fadedLighting=new l,this._lighting=this._newLighting,this.ssr=new a,this.terrainDepthTest=!1,this.cullAboveTerrain=!1,this.highlights=new Array,this.highlightOrderMap=new Map,this.highlightMixOrigin=h(),this.highlightMixTexture=null,this.hudRenderStyle=0,this.snowCover=0,this.clouds=new r,this.shadowHighlightsVisible=!1}destroy(){this._camera=null,this.contentCamera=null,this.depth=t(this.depth),this.geometryDepth=null,this.mainDepth=null,this.overlay=null,this.ssao=null,this.terrainDepth=null,this.shadowMap?.dispose()}get output(){return this._output}set output(t){this._output!==t&&(this._output=t,this._rctx.resetDrawBuffers(t))}get camera(){return this._camera}set camera(t){this._camera=t,this._inverseViewport[0]=1/t.fullViewport[2],this._inverseViewport[1]=1/t.fullViewport[3]}get enableOffset(){return 1===this.output&&this.camera.relativeElevation<n}get inverseViewport(){return this._inverseViewport}get lighting(){return this._lighting}fadeLighting(){switch(this.clouds.fadeFactor){case 0:this._lighting=this._oldLighting;break;default:this._fadedLighting.lerpLighting(this._oldLighting,this._newLighting,this.clouds.fadeFactor),this._lighting=this._fadedLighting;break;case 1:this._lighting=this._newLighting,this._oldLighting.copyFrom(this._newLighting)}}updateLighting(t,i,e,h){this._oldLighting.copyFrom(this.lighting),this._newLighting.noonFactor=i,this._newLighting.globalFactor=e,this._newLighting.set(t),this._oldLighting.updateLegacy(),1===h&&this.clouds.requestFade(),this.fadeLighting()}get highlight(){return null==this.highlightLevel?null:this.highlights[this.highlightLevel]}get depth(){return this._depth}set depth(t){t&&(t.name="geometry depth"),this._depth=t}get occluder(){return 11===this.slot||12===this.slot?this.slot:null}}class a{constructor(){this.fadeFactor=1,this.reprojectionMatrix=e()}}export{o as BindParameters,g as ViewportSize};
2
+ import{releaseMaybe as t}from"../../../../core/maybe.js";import{signal as i}from"../../../../core/signal.js";import{create as e}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{create as h}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import s from"../../webgl/RenderCamera.js";import{CloudsParameters as r}from"../effects/clouds/CloudsParameters.js";import{OITPolygonOffsetLimit as n}from"./OrderIndependentTransparency.js";import{SceneLighting as l}from"../lighting/SceneLighting.js";class g{constructor(t,i){this.width=t,this.height=i}}class o{constructor(t,e){this._rctx=t,this.shadowMap=e,this._output=0,this.slot=2,this.slicePlane=null,this.hasOccludees=!1,this.hasEmission=!1,this.hasFloatOit=i(!0),this.enableFillLights=!0,this.alignPixelEnabled=!1,this.decorations=!0,this.overlayStretch=1,this.viewshedEnabled=!1,this.cutFillEnabled=!1,this._camera=new s,this._inverseViewport=h(),this._oldLighting=new l,this._newLighting=new l,this._fadedLighting=new l,this._lighting=this._newLighting,this.ssr=new a,this.terrainDepthTest=!1,this.cullAboveTerrain=!1,this.highlights=new Array,this.highlightOrderMap=new Map,this.highlightMixOrigin=h(),this.highlightMixTexture=null,this.hudRenderStyle=0,this.snowCover=0,this.clouds=new r,this.shadowHighlightsVisible=!1}destroy(){this._camera=null,this.contentCamera=null,this.depth=t(this.depth),this.geometryDepth=null,this.mainDepth=null,this.overlay=null,this.ssao=null,this.terrainDepth=null,this.shadowMap?.dispose()}get output(){return this._output}set output(t){this._output!==t&&(this._output=t,this._rctx.resetDrawBuffers(t))}get camera(){return this._camera}set camera(t){this._camera=t,this._inverseViewport[0]=1/t.fullViewport[2],this._inverseViewport[1]=1/t.fullViewport[3]}get enableOITOffset(){return 1===this.output&&this.camera.relativeElevation<n}get inverseViewport(){return this._inverseViewport}get lighting(){return this._lighting}fadeLighting(){switch(this.clouds.fadeFactor){case 0:this._lighting=this._oldLighting;break;default:this._fadedLighting.lerpLighting(this._oldLighting,this._newLighting,this.clouds.fadeFactor),this._lighting=this._fadedLighting;break;case 1:this._lighting=this._newLighting,this._oldLighting.copyFrom(this._newLighting)}}updateLighting(t,i,e,h){this._oldLighting.copyFrom(this.lighting),this._newLighting.noonFactor=i,this._newLighting.globalFactor=e,this._newLighting.set(t),this._oldLighting.updateLegacy(),1===h&&this.clouds.requestFade(),this.fadeLighting()}get highlight(){return null==this.highlightLevel?null:this.highlights[this.highlightLevel]}get depth(){return this._depth}set depth(t){t&&(t.name="geometry depth"),this._depth=t}get occluder(){return 11===this.slot||12===this.slot?this.slot:null}}class a{constructor(){this.fadeFactor=1,this.reprojectionMatrix=e()}}export{o as BindParameters,g as ViewportSize};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{isOITColor as t}from"../core/shaderLibrary/ShaderOutput.js";import{defaultDepthWrite as r,premultipliedAlpha as e,unpremultipliedAlphaToPremultipliedAlpha as n,separateBlendingParams as u}from"../../../webgl/renderState.js";const c=u(1,0,1,771);function o(t,r=!1){switch(t){case 0:return r?e:n;case 1:return c;default:return null}}function a(t){if(t.draped)return null;switch(t.output){case 0:case 2:default:return t.writeDepth?r:null;case 1:return null}}function l(r,e=513){return{func:t(r)?515:e}}const s={factor:-1,units:-2},f=5e5;function i({output:r,enableOffset:e}){return e&&t(r)?s:null}export{s as OITPolygonOffset,f as OITPolygonOffsetLimit,o as blending,c as blendingColorAlpha,l as depthTest,a as depthWrite,i as oitPolygonOffset};
2
+ import{isOITColor as t}from"../core/shaderLibrary/ShaderOutput.js";import{OITPolygonOffset as e,PolygonOffsetSettings as r}from"../materials/PolygonOffset.js";import{defaultDepthWrite as n,premultipliedAlpha as u,unpremultipliedAlphaToPremultipliedAlpha as o,separateBlendingParams as f}from"../../../webgl/renderState.js";const l=f(1,0,1,771);function s(t,e=!1){switch(t){case 0:return e?u:o;case 1:return l;default:return null}}function a(t){if(t.draped)return null;switch(t.output){case 0:case 2:default:return t.writeDepth?n:null;case 1:return null}}function c(e,r=513){return{func:t(e)?515:r}}const i=5e5;function p({output:n,enableOITOffset:u,polygonOffset:o}){return t(n)?u?e:null:r[o]}export{i as OITPolygonOffsetLimit,s as blending,l as blendingColorAlpha,c as depthTest,a as depthWrite,p as oitPolygonOffset};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{update as t}from"../../../../core/arrayUtils.js";import{createTask as r}from"../../../../core/asyncUtils.js";import has from"../../../../core/has.js";import{removeMaybe as s,abortMaybe as i,destroyMaybe as a,releaseMaybe as n}from"../../../../core/maybe.js";import{throwIfAborted as h}from"../../../../core/promiseUtils.js";import{watch as o,syncAndInitial as d,initial as _,sync as u}from"../../../../core/reactiveUtils.js";import{signal as l}from"../../../../core/signal.js";import{property as m,subclass as p}from"../../../../core/accessorSupport/decorators.js";import{equals as c,invert as f,multiply as g}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as b,create as P}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as T}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{fromValues as w,ZEROS as E}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{pruneIndexArrays as C}from"../../../../geometry/support/Indices.js";import{RenderNodeOutput as A,InternalRenderCategory as S,AllRenderNodeOutputs as R,AllInternalRenderNodeOutputs as D}from"../../webgl.js";import{minNearDistanceInMeters as O}from"../../state/NearFarHeuristic.js";import{debugFlags as x}from"../../support/debugFlags.js";import"../../webgl/ManagedDepthAttachment.js";import{FBOCache as I}from"../core/FBOCache.js";import{RenderPassManager as y}from"../core/renderPasses/RenderPassManager.js";import{isColor as F}from"../core/shaderLibrary/ShaderOutput.js";import{distanceFadeEnd as v}from"../core/shaderLibrary/shading/ScreenSpaceConstants.js";import{RenderNodes as H}from"../effects/RenderNodes.js";import{RenderPluginManager as N}from"../effects/RenderPluginManager.js";import{WeatherFader as q}from"../effects/WeatherFader.js";import{innerAtmosphereFadeStart as G}from"../effects/atmosphere/atmosphereUtils.js";import{Blit as M}from"../effects/blit/Blit.js";import{maxHighlightsPerChannel as L,renderHighlightBuffer as U}from"../effects/highlight/Highlight.js";import{OITBlend as j}from"../effects/transparency/OITBlend.js";import{AnimationTimer as V}from"./AnimationTimer.js";import{AnimationTimeStep as B}from"./AnimationTimeStep.js";import{BoundingInfo as k}from"./BoundingInfo.js";import{Compositor as W}from"./Compositor.js";import{DepthRange as z}from"./DepthRange.js";import{depthRangeFromScene as Q}from"./depthRangeUtils.js";import{MainFramebuffer as Y}from"./MainFramebuffer.js";import{RenderContext as $,defaultRenderOccludedMask as J}from"./RenderContext.js";import{RendererBase as K}from"./RendererBase.js";import{setupFeatureDefaults as Z}from"./RenderFeature.js";import{RenderPluginInput as X}from"./RenderPluginInput.js";import{ShadowAccumulator as ee}from"./ShadowAccumulator.js";import{ShadowMap as te}from"./ShadowMap.js";import re from"./SliceHelper.js";import{MergedRenderer as se}from"../materials/renderers/MergedRenderer.js";import{RenderSceneResult as ie}from"../parts/renderUtils.js";import{RendererPerformanceInfo as ae,PerformanceCategory as ne}from"../statistics/RendererPerformanceInfo.js";import{PixelType as he,ColorAttachment1 as oe,ColorAttachment2 as de,ColorAttachment0 as _e}from"../../../webgl/enums.js";let ue=class extends K{constructor(e,t,r,s,i){super({stage:e}),this._techniques=r,this._rctx=s,this._requestRender=i,this._pluginsHas={occludedHudElements:!1,hudElements:!1,water:!1},this.renderPassManager=new y,this._isRendering=!1,this._inGlobeView=!1,this._backgroundColor=w(0,0,0,1),this._sliceHelper=new re,this.sceneDepthRange=l(z.Infinite),this._state=l(2),this._hasAnimations=!1,this._animationTimestep=new B,this._loadEdgeViewTask=null,this._edgeViewCallbacks=[],this._reprojectionMatrixVersion=l(0),this._hasOIT8=!has("disable-feature:oit8"),this._hasIOSEmission=this._hasOIT8&&!has("disable-feature:oit8-emissive"),this._renderHiddenTransparentEdges=()=>{},this._pluginInput=new X,this._hasTransparentGeometry=!1,this._oitCallouts=!1,this._releaseNodeInputs=e=>{for(const t of Ce)e.some(({name:e})=>e===t)&&this._pluginInput.release(t)},this._debugNeedsDepth=!1,this._fboCache=new I(s),this._compositor=new W(s,r),this._renderStateFeatures=l(Z(e.view.qualityProfile));const a=new te(this._fboCache,e.viewingMode);this._renderContext=new $(this._rctx,a,r),this._framebuffer=new Y(this._fboCache,this._bindParameters),this._performanceInfo=new ae(this._rctx),this._blit=new M(r),this._shadowAccumulator=new ee(this.fboCache,r,e,e=>{const t=this.shadowsEnabled;a.enabled=!0,this._ensureBindParametersCamera(e.camera,e.contentCamera),this._plugins.prepareRender(),a.enabled=t},(t,r,s)=>{const i=e.view.qualitySettings.maximumPixelRatio;t.shadowMap.start(t.camera,r,s,!0,i),this._renderShadowCascades(5,t.shadowMap),t.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(t.camera,t.contentCamera)},i),this._nodes=new H(this._renderContext),this._plugins=new N({renderContext:this._renderContext,techniques:r,materials:t,requestRender:i,controller:e}),this._plugins.add(this.renderPassManager),this.weatherFader=new q({view:e.view,context:this._renderContext}),this.addHandles([o(()=>e.view.state.camera,()=>i(),d),o(()=>x.EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES,e=>{this._renderHiddenTransparentEdges=e?()=>this._renderEdges(0):()=>{},i()},_),o(()=>e.view.environment.background?.color,e=>{const t=e?e.toUnitRGBA():E;T(this._backgroundColor,t[0]*t[3],t[1]*t[3],t[2]*t[3],t[3]),i()},d),o(()=>e.view.state.camera.relativeElevation,e=>this._inGlobeView=(e??1/0)>=v,d),o(()=>this._bindParameters.clouds.fadeFactor,()=>{this._bindParameters.fadeLighting(),this._requestRender(2)},u),o(()=>this._bindParameters.clouds.data?.state,()=>i(),u),o(()=>e.view.state.highlights,e=>{this._bindParameters.highlights=e,i()},_),o(()=>"sun"===e.view.environment.lighting?.type,e=>{this._bindParameters.enableFillLights=e,this._requestRender()},d)])}destroy(){this._gpuTimerHandle=s(this._gpuTimerHandle),this._nodes.destroy(),this._framebuffer.dispose(),this._shadowAccumulator.destroy(),this._shadowAccumulator=null,this._loadEdgeViewTask=i(this._loadEdgeViewTask),this._edgeView=a(this._edgeView),this.renderPassManager.dispose(),this.weatherFader=a(this.weatherFader),this._releaseFBOs(),this._disposeOffscreenBuffers(),this._fboCache.destroy(),this._fboCache=null,this._renderContext.destroy(),this._plugins.destroy(),this._plugins=null,this._pluginInput=null,this._oitBlendOrNil=null,this._nodes=null,this._framebuffer=null,this._performanceInfo=null,k.prune(),se.prune(),C()}get renderContext(){return this._renderContext}get _bindParameters(){return this._renderContext.bind}get _oitBlend(){return this._oitBlendOrNil??=new j(this._techniques),this._oitBlendOrNil}get performanceInfo(){return this._performanceInfo}updateRenderFeatures(e){this._renderStateFeatures.value=Z(e),this._requestRender()}isFeatureEnabled(e,t=this._state.value){return this._renderStateFeatures.value.get(t,e)??!1}setFeatureEnabled(e,t,r){this._renderStateFeatures.mutate(s=>s.set(t,e,r)),this._requestRender()}get _highQualityTransparency(){return this.isFeatureEnabled(1)}get hasReflections(){return this._pluginsHas.water&&this.isFeatureEnabled(5)}get _hasHighlights(){return this._plugins.produces(10,2,4,19,13,14,15)}hasHighlight(e){return this._plugins.hasHighlight(e)}get _hasHUDHighlights(){return this._plugins.produces(10,13,14,15)}get hasSSAO(){return this.isFeatureEnabled(4)&&!this._inGlobeView}get hasSMAA(){return this.isFeatureEnabled(0)}get _hasEmission(){return this._plugins.hasEmitters&&(this._hasIOSEmission||this.hasFloatOit)}get highResolutionAtmosphere(){return this.isFeatureEnabled(3)}get fboCache(){return this._fboCache}_releaseFBOs(){this._bindParameters.ssr.lastFrameColor=n(this._bindParameters.ssr.lastFrameColor),this._bindParameters.terrainDepth=n(this._bindParameters.terrainDepth),this._bindParameters.geometryDepth=n(this._bindParameters.geometryDepth),this._bindParameters.hudOcclusion=n(this._bindParameters.hudOcclusion),this._bindParameters.depth=n(this._bindParameters.depth)}_disposeOffscreenBuffers(){this._framebuffer.dispose(),this._disposeBindBuffers()}_disposeBindBuffers(){this._bindParameters.shadowMap.disposeOutputs()}get updating(){return this._loadEdgeViewTask&&!this._loadEdgeViewTask.finished||this._edgeView?.updating||this._shadowAccumulator.readyToRun||this._plugins.updating||this.weatherFader?.readyToRun||!this.isCameraFinal}loadEdgeView(){return this._loadEdgeViewTask||(this._loadEdgeViewTask=r(async e=>{const{EdgeView:t}=await import("./edgeRendering/EdgeView.js");h(e);const r=this._edgeView=new t({rctx:this._rctx,renderSR:this.stage.view.renderSpatialReference,viewingMode:this.stage.view.stage.viewingMode,techniques:this._techniques,setNeedsRender:()=>this._requestRender(),schedule:De(this.stage.view.resourceController)});return this.addHandles(o(()=>r.updating,()=>this._requestRender(),u)),this._requestRender(),this._edgeViewCallbacks.forEach(e=>e(r)),this._edgeViewCallbacks.length=0,r})),this._loadEdgeViewTask.promise}withEdgeView(e){this.loadEdgeView(),null==this._edgeView?this._edgeViewCallbacks.push(e):e(this._edgeView)}get edgeView(){return this._edgeView}get isCameraFinal(){return this._reprojectionMatrixVersion.value>=0&&c(this._bindParameters.ssr.reprojectionMatrix,b)}set _reprojectionMatrix(e){t(this._bindParameters.ssr.reprojectionMatrix,e)&&this._reprojectionMatrixVersion.value++}get shadowsEnabled(){return!!this._bindParameters.shadowMap.enabled}setParameters(e){void 0!==e.shadowMap&&this._bindParameters.shadowMap.enabled!==e.shadowMap&&(this._bindParameters.shadowMap.enabled=e.shadowMap,this._requestRender()),e.shadowCast&&this._shadowAccumulator.setParameters(e.shadowCast)}set slice(e){this._sliceHelper.update(e)&&this._requestRender()}get plugins(){return this._plugins}get hasFloatOit(){return this._rctx.driverTest.floatBufferBlend.result&&this.isFeatureEnabled(10)}get oitEnabled(){return this.hasFloatOit||this._hasOIT8}commit(e,t){return this._isRendering&&console.warn("Renderer.modify called while rendering"),!!super.commit(e,t,this._plugins.context)&&(this.updateHasFlags(),!0)}rendererAdded(e){this._plugins.add(e)}rendererRemoved(e){this._plugins.remove(e)}get occludedRequiresStencil(){return this.occludedRequiresOccludeeStencil||this.occludedRequiresIntegratedMeshStencil}get occludedRequiresOccludeeStencil(){return this._bindParameters.hasOccludees&&!!(8&this.plugins.renderOccludedFlags)}get occludedRequiresIntegratedMeshStencil(){return this._plugins.produces(0,0)&&this._plugins.produces(0,10)}updateHasFlags(){const has=this._pluginsHas;has.occludedHudElements=this._plugins.produces(0,14),has.hudElements=has.occludedHudElements||this._plugins.produces(0,...be),has.water=this._plugins.produces(4,20),this._bindParameters.hasOccludees=this._plugins.hasOccludees,this._requestRender()}updateAnimation(e,t){this._animationTimer??=new V(e.camera,t),this._animationTimer.advance(e.camera,t,this._animationTimeDilation);const r=this._hasAnimations;return this._hasAnimations=this._plugins.updateAnimation(this._animationTimer),this._hasAnimations=this._nodes.updateAnimation(this._animationTimer)||this._hasAnimations,this._hasAnimations!==r&&(this._gpuTimerHandle=r?s(this._gpuTimerHandle):this.performanceInfo.enableGPUPerformanceInfo()),this._hasAnimations}get animationTimestep(){return this._animationTimestep.value}get _animationTimeDilation(){return this._animationTimestep.timeDilation}resetAnimation(){this._animationTimestep.clear()}tick(){this.fboCache.clean()}render(e,t,r,s=!1){try{return this._isRendering=!0,this._render(e,t,r,s)}catch(i){console.error(`Exception during rendering: ${i}:\n${i.stack}`)}finally{this._isRendering=!1}return new ie(this._pluginInput.get(A.FINAL),null)}_render(e,t,r,s){const i=0===r;this.performanceInfo.startFrame(),this.fboCache.frameStart(),this.fboCache.interactive=i,this._disposeBindBuffers();const{camera:a,contentCamera:n,mode:h,alignPixelEnabled:o}=e;this._state.value=h,this._renderContext.time=t,this._bindParameters.output=0,this._bindParameters.hasEmission=this._hasEmission,this._bindParameters.alignPixelEnabled=o,this._bindParameters.decorations=!s,this._bindParameters.mainDepth=null,this._bindParameters.hasFloatOit.value=this.hasFloatOit;const d=!s||!this._sliceHelper.isDecoration;this._bindParameters.slicePlane=d?this._sliceHelper.plane:null,this._bindParameters.viewshedEnabled=this._nodes.produces(S.VIEWSHED),this._bindParameters.cutFillEnabled=this._nodes.produces(S.CUTFILL_COMPUTATION),this._renderOverlay(),a.setGLViewport(this._rctx);const _=this._framebuffer,u=_.initialize(a.fullWidth,a.fullHeight,this._backgroundColor);this.hasReflections?(u?.setName("last frame color"),this._bindParameters.ssr.lastFrameColor=u):u?.release(),this._ensureBindParametersCamera(a,n),this._ensureBindParametersWeatherFader(this._renderContext.time),this._plugins.sortTestsTransparentOrderedSlots(Te),this._plugins.prepareRender(),this._bindParameters.shadowHighlightsVisible=this._needsShadowHighlight&&!s,this._hasTransparentGeometry=this._plugins.produces(0,...me),this._precompilePrepasses(),this.performanceInfo.advance(ne.PREPARE);const l=this._computeShadowDepthRange(a);this._renderShadowMap(a,this._bindParameters.lighting.mainLight.direction,l),this._pluginInput.set("normals",this._renderNormals()),this._renderSSAOAndDepth(),this._renderShadowAccumulation(l,!i),this._oitCallouts=this._hasTransparentGeometry&&this.oitEnabled,this._ensureBindParametersSSR(t),this._precompileShaders(),this._bindParameters.output=0,_.bind(),this._bindParameters.mainDepth=_.depth.attachment,this._renderOpaque(),this._renderTransparent(),this._bindParameters.shadowMap.disposeOutput(5),this._renderCutFillComputation(),this._pluginInput.set(S.FOCUSAREA,this._renderFocusAreaGeometry()),_.update(e=>this._renderNodes(S.TRANSPARENT_ENVIRONMENT,e)),_.update(e=>this._renderNodes(S.VIEWSHED,e)),_.update(e=>this._renderNodes(S.LASERLINES,e)),_.update(e=>this._renderNodes(S.FOCUSAREA_COLOR,e)),this._pluginInput.release(S.FOCUSAREA),_.update(e=>this._renderNodes(S.OCCLUDED,e)),this._pluginInput.set("highlights",this._renderHighlightPrepass());const m=2===r?this._renderObjectAndLayerIdColor():null;_.update(e=>this._renderNodes(A.COMPOSITE,e)),this._bindParameters.shadowMap.disposeOutputs(),_.update(e=>this._renderNodes(S.ANTIALIASING,e));const p=this._hasPhotoshopTerrain||!this._hasTransparentGeometry?1:2;let c;return this._bindParameters.hasEmission=!1,this._hasHUDHighlights&&_.update(e=>this._renderHUD(p,e)),_.update(e=>this._renderNodes(S.HIGHLIGHT_COLOR,e)),this._hasHUDHighlights||_.update(e=>this._renderHUD(p,e)),this._bindParameters.hasEmission=this._hasEmission,_.update(e=>this._renderNodes(S.MAGNIFIER,e)),_.update(e=>this._renderNodes(A.FINAL,e)),i&&this._blit.toFramebuffer(this._rctx,_.color,this._bindParameters),this.onPostRender?.(),this._releaseFBOs(),_.releaseDepth(),this._renderContext.lastFrameCamera.copyFrom(this._bindParameters.camera),this.fboCache.frameEnd(),i||(c=_.color,c.retain(),this._releaseFBOs(),this._disposeOffscreenBuffers()),this.performanceInfo.finishFrame(),new ie(c,m)}_precompileShaders(){++this._plugins.context.techniques.precompiling,this._bindParameters.output=0;const e=this._bindParameters.hasEmission;this._precompileOpaqueGeometry(),this._nodes.precompile(e,S.OPAQUE_ENVIRONMENT,S.PRE_TRANSPARENT);const t=this._bindParameters;if(t.terrainDepthTest=t.cullAboveTerrain=this._needsTerrainDepth,this._bindParameters.output=3,this._plugins.precompile(...pe),this._needsDepth&&(this._precompileOpaqueGeometry(),this._precompileTransparentGeometry()),this._bindParameters.output=0,this._plugins.precompile(...pe),this._hasTransparentGeometry){const e=this._pluginsHas.occludedHudElements;this._oitBlend.precompile(this._bindParameters,e,0),this._pluginsHas.hudElements&&this._oitBlend.precompile(this._bindParameters,!1,1)}this._hasTransparentGeometry&&(this._precompileTransparentGeometry(),this._hasPhotoshopTerrain&&(t.cullAboveTerrain=!1,this._precompileTransparentGeometry(),t.cullAboveTerrain=this._needsTerrainDepth)),this._nodes.precompile(e,S.FOCUSAREA);const r=this._hasPhotoshopTerrain&&!this._needsTerrainDepth;this._compositor.precompile(this._usesPremultipliedAlphaBlit,!!this._needsEdges,r,e),this._oitCallouts||this._plugins.precompile(16),t.terrainDepthTest=t.cullAboveTerrain=!1,this._nodes.precompile(e,S.TRANSPARENT_ENVIRONMENT,S.VIEWSHED,S.CUTFILL_COMPUTATION,S.LASERLINES,S.FOCUSAREA_COLOR,S.OCCLUDED,S.ANTIALIASING),t.highlightMixTexture=t.highlights.length>1?this._rctx.emptyTexture:null,this._precompileHUD(0),t.hasEmission=!1,this._precompileHUD(0),this._precompileHUD(1),t.hasEmission=this._hasEmission,this._hasHighlights&&(t.highlights.forEach((e,r)=>{t.highlightLevel=r,this._precompileAllGeometry(10),this._hasHUDHighlights&&this._plugins.precompile(14,13)}),t.highlightLevel=null,this._nodes.precompile(e,S.HIGHLIGHT_COLOR)),t.highlightMixTexture=null,this._nodes.precompile(e,A.COMPOSITE,S.MAGNIFIER),this._shadowAccumulator.precompile(),this._plugins.precompile(9),--this._plugins.context.techniques.precompiling}_renderFocusAreaGeometry(){const e=this._nodes.produce(S.FOCUSAREA,this._pluginInput);return e&&this.performanceInfo.advance(ne.FOCUS_AREA_MASK),e}_renderObjectAndLayerIdColor(){if(!this._nodes.produces("olid"))return null;const e=this._bindParameters.output;++this._techniques.precompiling;const{width:t,height:r}=this._framebuffer.size;let s=this.fboCache.acquire(t,r,"olid");return s.acquireDepth(13),s=this._nodes.render(s,this._pluginInput),--this._techniques.precompiling,this.performanceInfo.advance(ne.OBJECT_AND_LAYER_ID_COLOR),this._bindParameters.output=e,s}finish(e){this._hasAnimations||this._animationTimestep.clear();const t=this.performanceInfo.gpuSamplingEnabled,r=0===e;if(r||t){const e=r?this.performanceInfo.elapsedTime:0;let s=0;t?s=this.performanceInfo.totalGPUTimeSampler.last:this._rctx.gl.finish();const i=Math.max(e,s);this._animationTimestep.frame(i,r)}}readMainDepth(e,t){const{mainDepth:r,camera:s}=this._bindParameters;if(!r)return;const i=this.fboCache.acquire(this._framebuffer.size.width,this._framebuffer.size.height,"linear depth");this._rctx.bindFramebuffer(i.fbo),s.setGLViewport(this._rctx),this._rctx.setScissorRect(e[0],e[1],e[2],e[3]),this._rctx.setScissorTestEnabled(!0),this._rctx.clearFramebuffer(E),this._compositor.blitDepthToLinearDepth(this._bindParameters,r),this._rctx.setScissorTestEnabled(!1),this._rctx.setScissorRect(0,0,this._rctx.gl.canvas.width,this._rctx.gl.canvas.width),i.fbo?.readPixels(e[0],e[1],e[2],e[3],6408,he.UNSIGNED_BYTE,t),i.release()}readAccumulatedShadow(e){return this._shadowAccumulator.readAccumulatedShadow(e[0],e[1])}get _needsEdges(){return this._edgeView?.shouldRender()?this._edgeView:null}_renderEdges(e){const t=this._needsEdges;if(!t)return;const{width:r,height:s}=this._framebuffer.size,i=this.fboCache.acquire(r,s,"edges"),a=this._bindParameters.geometryDepth,n=()=>t.render(this._bindParameters,e);this._renderToTargets(n,i,a??this._framebuffer.depth,E),this._framebuffer.bind(),this._compositor.composite(this._bindParameters,i.getTexture()),i.release(),this.performanceInfo.advance(1===e?ne.OPAQUE_EDGES:ne.TRANSPARENT_EDGES)}_renderOverlay(){this._bindParameters.overlay=this.overlay?.render(this._renderContext.time),this._bindParameters.overlay&&this.performanceInfo.advance(ne.OVERLAY)}_renderShadowMap(e,t,r){if(!this.shadowsEnabled)return;const s=this._bindParameters.shadowMap;s.start(e,t,r,this.isFeatureEnabled(6),this.stage.view.qualitySettings.maximumPixelRatio),this._needsShadowHighlight?(this._renderShadowCascades(7,s),s.clear(),this._renderShadowCascades(6,s)):this._renderShadowCascades(5),e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,this._bindParameters.contentCamera),this.performanceInfo.advance(ne.SHADOW_MAP)}_renderCutFillComputation(){this._nodes.produce(S.CUTFILL_COMPUTATION,this._pluginInput)?.release()}_precompileShadowCascades(e){0!==this._bindParameters.shadowMap.cascades.length&&this._precompileAllGeometry(e)}_renderShadowCascades(e,t=this._bindParameters.shadowMap){const r=this._bindParameters.output;t.bindFramebuffer();for(const s of t.cascades)s.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(s.camera,s.camera),this.renderAllGeometry(e);t.finish(e),this._bindParameters.output=r}get _needsDepth(){return this._nodes.requireGeometryDepth()||this.hasReflections||this._needsShadowHighlight||this._shadowAccumulator.active||this._debugNeedsDepth}get _usesPremultipliedAlphaBlit(){return this._pluginsHas.hudElements&&this.oitEnabled||this._hasPhotoshopTerrain}_renderSSAOAndDepth(){const e=this._pluginInput.get("normals");e?(this._pluginInput.set(S.SSAO,this._renderSSAO()),this._needsDepth?(this._rctx.bindFramebuffer(e.fbo),this._rctx.clear(1024),this._renderGeometryWithoutNormals(3),this._bindParameters.depth?.release(),this._bindParameters.depth=e.obtainDepthTexture(),this.performanceInfo.advance(ne.DEPTH)):(e.detachDepth(),this._bindParameters.depth=n(this._bindParameters.depth)),this.hasSSAO&&this._pluginInput.release("normals")):this._renderAllGeometryDepth()}_renderAllGeometryDepth(){if(this._bindParameters.depth=n(this._bindParameters.depth),!this._needsDepth)return;const{width:e,height:t}=this._framebuffer.size,r=this.fboCache.acquire(e,t,"geometry depth",13);this._rctx.bindFramebuffer(r.fbo),this._rctx.clear(1280),this.renderAllGeometry(3),this._bindParameters.depth=r.obtainDepthTexture(),r.release(),this.performanceInfo.advance(ne.DEPTH)}_renderTerrainDepth(){if(this._bindParameters.terrainDepth=n(this._bindParameters.terrainDepth),this._bindParameters.terrainDepthTest=this._bindParameters.cullAboveTerrain=this._needsTerrainDepth,!this._needsTerrainDepth)return;const e=this._bindParameters.output;this._bindParameters.output=3;const{width:t,height:r}=this._framebuffer.size,s=this.fboCache.acquire(t,r,"terrain depth",13);this._rctx.bindFramebuffer(s.fbo),this._rctx.clear(1280),this._renderTransparentGround(),this._bindParameters.terrainDepth=s.obtainDepthTexture(),s.release(),this._bindParameters.output=e}_renderGeometryDepth(){if(this._bindParameters.geometryDepth=n(this._bindParameters.geometryDepth),!this._needsTerrainDepth)return;const e=this._bindParameters.output,{width:t,height:r}=this._framebuffer.size,s=this.fboCache.acquire(t,r,"geometry depth",13);this._rctx.bindFramebuffer(s.fbo),this._rctx.clear(1280),this._renderOpaqueAndTransparentGeometry(3),this._bindParameters.output=e,this._bindParameters.geometryDepth=s.obtainDepthTexture(),s.release()}get _needsShadowDepthRange(){return this._bindParameters.shadowMap.enabled||this._shadowAccumulator.active}_computeShadowDepthRange(e){if(!this._needsShadowDepthRange)return z.Zero;const t=Q(e,this._plugins.plugins,this.stage.layers,0);return t.union(this._plugins.queryDepthRange(e)),t.near=Math.max(e.near,t.near),t.far=Math.min(e.far,t.far),t}updateSceneDepthRange(e){if(!this.stage.view.state.isGlobal)return void(this.sceneDepthRange.value=z.Infinite);if((this.stage.view.renderCoordsHelper?.getAltitude(e.eye)??0)<G)return void(this.sceneDepthRange.value=z.Infinite);const t=e.clone();t.near=O,t.far=1e10;const r=Q(t,this._plugins.plugins,this.stage.layers,1);r.union(this._plugins.queryDepthRange(t)),this.sceneDepthRange.value.equals(r)||(this.sceneDepthRange.value=r)}get _normalsRequired(){const e=this._nodes.require("normals",...R,S.VIEWSHED,S.LASERLINES);return(this.hasSSAO?1:0)+e}_precompilePrepasses(){this._normalsRequired&&this._precompileAllGeometry(4),this._needsDepth&&this._precompileAllGeometry(3),this.shadowsEnabled&&(this._needsShadowHighlight?(this._precompileShadowCascades(6),this._precompileShadowCascades(7)):this._precompileShadowCascades(5)),this._shadowAccumulator.active&&this._precompileAllGeometry(5),this.hasSSAO&&this._normalsRequired&&this._nodes.precompile(this._bindParameters.hasEmission,S.SSAO)}_renderNormals(){const e=this._normalsRequired;if(0===e)return;const{width:t,height:r}=this._framebuffer.size,s=this.fboCache.acquire(t,r,"normals",5);s.acquireDepth(13),this._rctx.bindFramebuffer(s.fbo),this._rctx.clearFramebuffer(E,!0,!0),this._bindParameters.output=4,this._plugins.render(...ce);const i=this._nodes.optional("normals",...R,S.VIEWSHED);return s.retain(e+i-1),this.performanceInfo.advance(ne.NORMALS),s}_renderSSAO(){const e=this._pluginInput.get("normals");if(this.hasSSAO&&e)return this._bindParameters.ssao=this._nodes.produce(S.SSAO,this._pluginInput),this._bindParameters.ssao&&this.performanceInfo.advance(ne.SSAO),this._bindParameters.ssao}_precompileAllGeometry(e){const t=this._bindParameters.output;this._bindParameters.output=e,this._precompileOpaqueGeometry(),this._precompileTransparentGeometry(),this._plugins.precompile(...pe),this._bindParameters.output=t}renderAllGeometry(e){this._bindParameters.output=e,this._renderOpaqueAndTransparentGeometry(e),this._renderTransparentGround()}precompileSlots(e,...t){for(const r of t)this._bindParameters.slot=r,e.precompile(this._renderContext)}precompileOccludedSlots(e,t){for(const r of t)this._renderContext.renderOccludedMask=r,this.precompileSlots(e,...ge);this._renderContext.renderOccludedMask=J}renderSlots(e,...t){for(const r of t)this._bindParameters.slot=r,e.forAll(e=>{const t=e.acquireTechniques(this._renderContext);t&&e.render(this._renderContext,t)})}renderOccludedSlots(e,t){this._renderContext.renderOccludedMask=t,this.plugins.renderOccludedFlags>1&&this._plugins.render(10),this.renderSlots(e,...ge),this._renderContext.renderOccludedMask=J}renderHUD(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(...we[e])}_renderHUDElements(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(17),this.renderHUD(e),this._bindParameters.hudRenderStyle=e,this._plugins.render(15)}precompileViewshedShadowMap(){this._precompileAllGeometry(8)}precompileCutFillReferenceDepth(){const e=this._bindParameters.output;this._bindParameters.output=9,this._plugins.precompile(...Ee),this._bindParameters.output=e}renderViewshedShadowMap(e){const{camera:t,contentCamera:r}=this._bindParameters,s=this._bindParameters.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this.renderAllGeometry(8),this._ensureBindParametersCamera(t,r),this._bindParameters.camera.setGLViewport(this._rctx),this._bindParameters.output=s}renderCutFillReferenceDepth(e){const{camera:t,contentCamera:r}=this._bindParameters,s=this._bindParameters.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this._bindParameters.output=9,this._plugins.render(...Ee),this._ensureBindParametersCamera(t,r),t.setGLViewport(this._rctx),this._bindParameters.output=s}_renderOpaqueAndTransparentGeometry(e){this._bindParameters.output=e,this._renderOpaqueGeometry(),this._renderTransparentGeometry()}_renderGeometryWithoutNormals(e){this._bindParameters.output=e,this._plugins.render(...fe)}_precompileOpaqueGeometry(){this._needsOpaquePass&&(this._plugins.precompile(...le),this._nodes.precompile(this._bindParameters.hasEmission,S.CUTFILL_COLOR,"opaque-color"))}_renderOpaqueGeometry(){this._plugins.render(...le)}_renderTransparentGeometry(){this._plugins.render(...me),this._oitCallouts&&this._plugins.render(16)}get _hasPhotoshopTerrain(){return this._plugins.produces(0,6)}get _needsTerrainDepth(){return this._highQualityTransparency&&this._hasPhotoshopTerrain}_renderPhotoshopTerrain(){if(!this._hasPhotoshopTerrain)return null;const{width:e,height:t}=this._framebuffer.size,r=this.fboCache.acquire(e,t,"transparent terrain"),s=()=>this._plugins.render(6);return this._renderToTargets(s,r,this._framebuffer.depth,E),this.performanceInfo.advance(ne.TRANSPARENT_TERRAIN),r}_renderTransparentGround(){this._plugins.render(...pe)}_renderLineCallouts(e){if(this._bindParameters.hudRenderStyle=e,0===e){const e=()=>this._plugins.render(16),{width:t,height:r}=this._framebuffer.size,s=this.fboCache.acquireDepth(this._hudDepthFormat,t,r,"line callouts");this._renderToTargets(e,this._framebuffer.color,s,void 0,!0,!0),s.release()}else this._plugins.render(16)}_precompileHUD(e){if(!this._pluginsHas.hudElements)return;const t=this._bindParameters.output,r=this._bindParameters.hudRenderStyle;this._bindParameters.hudRenderStyle=e,this.oitEnabled?(this._bindParameters.output=1,this._plugins.precompile(...be),this._bindParameters.output=2,this._plugins.precompile(...be),this._bindParameters.output=0,this._oitBlend.precompile(this._bindParameters,!1,1)):(this._bindParameters.output=0,this._plugins.precompile(...be)),this._hasHighlights&&(this._bindParameters.output=10,this._plugins.precompile(...be)),this._bindParameters.output=t,this._bindParameters.hudRenderStyle=r}_renderHUD(e,t){if(!this._pluginsHas.hudElements)return t;if(this.oitEnabled){const r=this._renderOIT(1,e);this._rctx.bindFramebuffer(t.fbo);const s=!!t.getTexture(oe);this._compositor.compositePreMultipliedAlpha(this._bindParameters,r.getTexture(),s),r.release()}else if(this._bindParameters.output=0,0===e){const t=()=>this._renderHUDElements(e),{width:r,height:s}=this._framebuffer.size,i=this.fboCache.acquireDepth(this._hudDepthFormat,r,s,"hud");this._renderToTargets(t,this._framebuffer.color,i,void 0,!0,!0),i.release()}else t.acquireDepth(this._hudDepthFormat),this._rctx.bindFramebuffer(t.fbo),this._rctx.clear(256),this._renderHUDElements(e),t.detachDepth();return this.performanceInfo.advance(0===e?ne.HUD_OCCLUDED:ne.HUD),t}get _needsShadowHighlight(){return this.shadowsEnabled&&this._plugins.produces(6,2)}_renderHighlightPrepass(){if(!this._hasHighlights)return;const{fboCache:e,_rctx:t,_bindParameters:r}=this,{width:s,height:i}=this._framebuffer.size,{highlights:a}=r,n=a.length>L?3:1,h=e.acquire(s,i,"highlights",n);h.acquireDepth(13);const o=this._plugins.produces(10,0);return o&&this._framebuffer.color.fbo&&h.fbo&&t.blitFramebuffer(this._framebuffer.color.fbo,h.fbo,1024),t.bindFramebuffer(h.fbo),t.gl.clearBufferuiv(6144,0,[0,0,0,0]),o||t.clear(1024),this._bindParameters.output=10,t.bindFramebuffer(h.fbo),U(t,e,s,i,r,()=>this._renderHighlightGeometries()),h.detachDepth(),this.performanceInfo.advance(ne.HIGHLIGHTS),h.retain(this._nodes.require("highlights",...D)+this._nodes.optional("highlights",...D)-1),h}_renderHighlightGeometries(){this._plugins.render(...Pe),this._rctx.clear(256),this._renderHUDElements(2)}_renderShadowAccumulation(e,t){this._shadowAccumulator.updateDepthRange(e),this._bindParameters.output=0,this._shadowAccumulator.accumulating&&this._bindParameters.depth&&this._shadowAccumulator.renderAccumulation(this._bindParameters,t)&&this.performanceInfo.advance(ne.ACCUMULATED_SHADOWS)}_precompileTransparentGeometry(){this.oitEnabled&&F(this._bindParameters.output)?(this._bindParameters.output=1,this._plugins.precompile(...me),this._oitCallouts&&this._plugins.precompile(16),this._bindParameters.output=2,this._plugins.precompile(...me),this._oitCallouts&&this._plugins.precompile(16),this._bindParameters.output=0):this._plugins.precompile(...me)}_renderOIT(e,t=2){const r=1===e,{width:s,height:i}=this._framebuffer.size,a=r?()=>this._renderHUDElements(t):()=>this._renderTransparentGeometry(),h=this._bindParameters,o=h.hasFloatOit.value?8:5,d=h.output;h.output=1;const _=r?"oit hud":"oit",u=this.fboCache.acquire(s,i,_,o),l=h.hasEmission&&(0===e||1!==t);l&&u.acquireColor(oe,o,"oit emissive");const m=l?de:oe;u.acquireColor(m,this.hasFloatOit?7:0,"oit alpha"),r||u.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(u.fbo),this._rctx.clearFramebuffer([0,0,0,1]),l&&this._rctx.clearBuffer(1,E),a(),u.detachDepth(),h.output=2;const p=this.fboCache.acquire(s,i,r?"oit hud front":"oit front");l&&p.acquireColor(oe,o,"oit emissive front"),r?p.acquireDepth(this._hudDepthFormat):p.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(p.fbo),this._rctx.clearFramebuffer(E,r),a(),p.detachDepth();const c=this._pluginsHas.occludedHudElements&&!r;let f;return h.hudOcclusion=n(this._bindParameters.hudOcclusion),h.output=0,r?(f=this.fboCache.acquire(s,i,"oit hud composite"),this._rctx.bindFramebuffer(f.fbo),this._rctx.setClearColor(0,0,0,1e-13),this._rctx.clear(16384)):(c&&(this._framebuffer.color.acquireColor(m,0,"hud occlusion"),this._rctx.clearBuffer(m-_e,E)),this._framebuffer.bind()),this._oitBlend.blend(this._rctx,u,p,h,l,c,e),f?.detachDepth(),r||(this._rctx.bindFramebuffer(p.fbo),this._framebuffer.bind(),c&&(h.hudOcclusion=this._framebuffer.color.obtainAttachment(m))),p.release(),u.release(),h.output=d,f}get _hudDepthFormat(){return this.isFeatureEnabled(8)?13:12}get _needsOpaquePass(){return this.plugins.produces(0,...le)||this.plugins.produces(5,...le)||this.plugins.produces(3,3)}_renderOpaque(){const e=this._needsOpaquePass;e&&(this._plugins.render(0,1),this._framebuffer.update(e=>this._renderNodes(S.CUTFILL_COLOR,e)),this._plugins.render(2,3));const t=this._framebuffer;this._renderTerrainDepth(),t.update(t=>this._renderNodes(A.OPAQUE,t,e)),this.fboCache.debugCallback?.(A.OPAQUE,t.color.fbo),t.update(e=>this._renderNodes(S.OPAQUE_ENVIRONMENT,e)),this.fboCache.debugCallback?.(S.OPAQUE_ENVIRONMENT,t.color.fbo),this._renderEdges(1)}_renderTransparent(){const e=this._framebuffer;e.bind(),e.update(e=>this._renderNodes(S.PRE_TRANSPARENT,e)),this.fboCache.debugCallback?.(S.PRE_TRANSPARENT,e.color.fbo),this._renderHiddenTransparentEdges(),this._hasTransparentGeometry&&(this.oitEnabled?this._renderOIT(0):this._renderTransparentGeometry()),e.update(e=>this._renderNodes(A.TRANSPARENT,e,this._hasTransparentGeometry)),this.fboCache.debugCallback?.(A.TRANSPARENT,e.color.fbo),this._renderGeometryDepth(),this._needsTerrainDepth||this._oitCallouts||this._plugins.render(16),this._renderEdges(0);const t=this._renderPhotoshopTerrain(),r=t?.getTexture();r&&this._renderHUD(0,e.color),this._bindParameters.cullAboveTerrain=!1,r&&(e.bind(),this._compositor.compositePreMultipliedAlpha(this._bindParameters,r),t?.release(),this._needsTerrainDepth&&(this._renderEdges(1),this._hasTransparentGeometry&&(this.oitEnabled?this._renderOIT(0):this._renderTransparentGeometry(),this.performanceInfo.advance(ne.TRANSPARENT)),this._renderEdges(0))),this._bindParameters.ssao=n(this._bindParameters.ssao),this._needsTerrainDepth&&this._renderLineCallouts(1),this._bindParameters.terrainDepthTest=!1,this._renderTransparentEnvironment()}_renderTransparentEnvironment(){this._shadowAccumulator.render(this._bindParameters),this.performanceInfo.advance(ne.APPLY_ACCUMULATED_SHADOWS),this._framebuffer.bind(),this._plugins.render(9),this.performanceInfo.advance(ne.TRANSPARENT_MATERIAL_WITHOUT_DEPTH)}_renderNodes(e,t,r=!1){const s=t.name;if(t.setName(e),this._pluginInput.set(e,t),!this._nodes.produces(e))return r&&this.performanceInfo.advance(e),t;this._fboCache.debugCallback?.(s,t.fbo);const i=this._nodes.render(t,this._pluginInput,this._releaseNodeInputs);return this.performanceInfo.advance(e),i}_ensureBindParametersCamera(e,t){this._bindParameters.camera=e,this._bindParameters.contentCamera=t}_ensureBindParametersWeatherFader(e){1===this.stage.viewingMode&&(this._bindParameters.clouds.data&&(this._bindParameters.clouds.fade(this._bindParameters.camera,e,this.stage.view.qualitySettings.fadeDuration),this.weatherFader?.cleanupCubemap()),this._bindParameters.snowCover=this.weatherFader?.snowCover??0)}_ensureBindParametersSSR(e){if(this._bindParameters.ssr.lastFrameColor){null==this._ssrEnableTime&&(this._ssrEnableTime=e),this._renderContext.lastFrameCamera.equals(this._bindParameters.camera)?this._reprojectionMatrix=b:(f(Se,this._bindParameters.camera.viewMatrix),f(Ae,this._bindParameters.camera.projectionMatrix),g(Re,Se,Ae),g(Re,this._renderContext.lastFrameCamera.viewMatrix,Re),g(Re,this._renderContext.lastFrameCamera.projectionMatrix,Re),this._reprojectionMatrix=Re);const t=this.stage.view.qualitySettings.fadeDuration;this._bindParameters.ssr.fadeFactor=t>0?Math.min(t,e-this._ssrEnableTime)/t:1,this._bindParameters.ssr.fadeFactor<1&&this._requestRender()}else this._reprojectionMatrix=b,this._ssrEnableTime=null}addRenderNode(e){this._nodes.add(e),this._requestRender()}removeRenderNode(e){this._nodes.remove(e),this._requestRender()}updateLighting(e,t,r,s){this._bindParameters.updateLighting(e,t,r,s),this._requestRender(1)}get usedMemory(){return{fbos:this.fboCache.usedMemory,plugins:this._plugins.usedMemory,edges:this.edgeView?.usedMemory??0,clouds:this.weatherFader?.usedMemory??0}}_renderToTargets(e,t,r,s,i=!1,a=!1){t.attachDepth(r),this._rctx.bindFramebuffer(t.fbo),this._rctx.clearFramebuffer(s,i,a),e(),t.detachDepth()}get test(){}};e([m({readOnly:!0})],ue.prototype,"highResolutionAtmosphere",null),e([m()],ue.prototype,"_edgeView",void 0),e([m()],ue.prototype,"updating",null),ue=e([p("esri.views.3d.webgl-engine.lib.Renderer")],ue);const le=[0,1,2,3],me=[7,8,4,5],pe=[6,7,8],ce=[0,1,2,4,...pe],fe=[3,5],ge=[2,4,9],be=[17,13,15,14],Pe=[4,5,2,3,0,1,...pe],Te=[4,9,5,12],we={0:[14],1:[13],2:[14,13],3:[14,13]},Ee=[0,1,...pe],Ce=["normals","highlights"],Ae=P(),Se=P(),Re=P();function De(e){return t=>e.immediate.schedule(t)}export{ue as Renderer};
2
+ import{__decorate as e}from"tslib";import{update as t}from"../../../../core/arrayUtils.js";import{createTask as r}from"../../../../core/asyncUtils.js";import has from"../../../../core/has.js";import{removeMaybe as s,abortMaybe as i,destroyMaybe as a,releaseMaybe as n}from"../../../../core/maybe.js";import{throwIfAborted as h}from"../../../../core/promiseUtils.js";import{watch as o,syncAndInitial as d,initial as _,sync as u}from"../../../../core/reactiveUtils.js";import{signal as l}from"../../../../core/signal.js";import{property as m,subclass as p}from"../../../../core/accessorSupport/decorators.js";import{equals as c,invert as f,multiply as g}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as b,create as P}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as T}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{fromValues as w,ZEROS as E}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{pruneIndexArrays as C}from"../../../../geometry/support/Indices.js";import{RenderNodeOutput as A,InternalRenderCategory as S,AllRenderNodeOutputs as R,AllInternalRenderNodeOutputs as D}from"../../webgl.js";import{minNearDistanceInMeters as O}from"../../state/NearFarHeuristic.js";import{debugFlags as x}from"../../support/debugFlags.js";import"../../webgl/ManagedDepthAttachment.js";import{FBOCache as I}from"../core/FBOCache.js";import{RenderPassManager as y}from"../core/renderPasses/RenderPassManager.js";import{isColor as F}from"../core/shaderLibrary/ShaderOutput.js";import{distanceFadeEnd as v}from"../core/shaderLibrary/shading/ScreenSpaceConstants.js";import{RenderNodes as H}from"../effects/RenderNodes.js";import{RenderPluginManager as N}from"../effects/RenderPluginManager.js";import{WeatherFader as q}from"../effects/WeatherFader.js";import{innerAtmosphereFadeStart as G}from"../effects/atmosphere/atmosphereUtils.js";import{Blit as M}from"../effects/blit/Blit.js";import{maxHighlightsPerChannel as L,renderHighlightBuffer as U}from"../effects/highlight/Highlight.js";import{OITBlend as j}from"../effects/transparency/OITBlend.js";import{AnimationTimer as V}from"./AnimationTimer.js";import{AnimationTimeStep as B}from"./AnimationTimeStep.js";import{BoundingInfo as k}from"./BoundingInfo.js";import{Compositor as W}from"./Compositor.js";import{DepthRange as z}from"./DepthRange.js";import{depthRangeFromScene as Q}from"./depthRangeUtils.js";import{MainFramebuffer as Y}from"./MainFramebuffer.js";import{RenderContext as $,defaultRenderOccludedMask as J}from"./RenderContext.js";import{RendererBase as K}from"./RendererBase.js";import{setupFeatureDefaults as Z}from"./RenderFeature.js";import{RenderPluginInput as X}from"./RenderPluginInput.js";import{ShadowAccumulator as ee}from"./ShadowAccumulator.js";import{ShadowMap as te}from"./ShadowMap.js";import re from"./SliceHelper.js";import{MergedRenderer as se}from"../materials/renderers/MergedRenderer.js";import{RenderSceneResult as ie}from"../parts/renderUtils.js";import{RendererPerformanceInfo as ae,PerformanceCategory as ne}from"../statistics/RendererPerformanceInfo.js";import{PixelType as he,ColorAttachment1 as oe,ColorAttachment2 as de,ColorAttachment0 as _e}from"../../../webgl/enums.js";let ue=class extends K{constructor(e,t,r,s,i){super({stage:e}),this._techniques=r,this._rctx=s,this._requestRender=i,this._pluginsHas={occludedHudElements:!1,hudElements:!1,water:!1},this.renderPassManager=new y,this._isRendering=!1,this._inGlobeView=!1,this._backgroundColor=w(0,0,0,1),this._sliceHelper=new re,this.sceneDepthRange=l(z.Infinite),this._state=l(2),this._hasAnimations=!1,this._animationTimestep=new B,this._loadEdgeViewTask=null,this._edgeViewCallbacks=[],this._reprojectionMatrixVersion=l(0),this._hasOIT8=!has("disable-feature:oit8"),this._hasIOSEmission=this._hasOIT8&&!has("disable-feature:oit8-emissive"),this._renderHiddenTransparentEdges=()=>{},this._pluginInput=new X,this._hasTransparentGeometry=!1,this._oitCallouts=!1,this._releaseNodeInputs=e=>{for(const t of Ce)e.some(({name:e})=>e===t)&&this._pluginInput.release(t)},this._debugNeedsDepth=!1,this._fboCache=new I(s),this._compositor=new W(s,r),this._renderStateFeatures=l(Z(e.view.qualityProfile));const a=new te(this._fboCache,e.viewingMode);this._renderContext=new $(this._rctx,a,r),this._framebuffer=new Y(this._fboCache,this._bindParameters),this._performanceInfo=new ae(this._rctx),this._blit=new M(r),this._shadowAccumulator=new ee(this.fboCache,r,e,e=>{const t=this.shadowsEnabled;a.enabled=!0,this._ensureBindParametersCamera(e.camera,e.contentCamera),this._plugins.prepareRender(),a.enabled=t},(t,r,s)=>{const i=e.view.qualitySettings.maximumPixelRatio;t.shadowMap.start(t.camera,r,s,!0,i),this._renderShadowCascades(5,t.shadowMap),t.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(t.camera,t.contentCamera)},i),this._nodes=new H(this._renderContext),this._plugins=new N({renderContext:this._renderContext,techniques:r,materials:t,requestRender:i,controller:e}),this._plugins.add(this.renderPassManager),this.weatherFader=new q({view:e.view,context:this._renderContext}),this.addHandles([o(()=>e.view.state.camera,()=>i(),d),o(()=>x.EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES,e=>{this._renderHiddenTransparentEdges=e?()=>this._renderEdges(0):()=>{},i()},_),o(()=>e.view.environment.background?.color,e=>{const t=e?e.toUnitRGBA():E;T(this._backgroundColor,t[0]*t[3],t[1]*t[3],t[2]*t[3],t[3]),i()},d),o(()=>e.view.state.camera.relativeElevation,e=>this._inGlobeView=(e??1/0)>=v,d),o(()=>this._bindParameters.clouds.fadeFactor,()=>{this._bindParameters.fadeLighting(),this._requestRender(2)},u),o(()=>this._bindParameters.clouds.data?.state,()=>i(),u),o(()=>e.view.state.highlights,e=>{this._bindParameters.highlights=e,i()},_),o(()=>"sun"===e.view.environment.lighting?.type,e=>{this._bindParameters.enableFillLights=e,this._requestRender()},d)])}destroy(){this._gpuTimerHandle=s(this._gpuTimerHandle),this._nodes.destroy(),this._framebuffer.dispose(),this._shadowAccumulator.destroy(),this._shadowAccumulator=null,this._loadEdgeViewTask=i(this._loadEdgeViewTask),this._edgeView=a(this._edgeView),this.renderPassManager.dispose(),this.weatherFader=a(this.weatherFader),this._releaseFBOs(),this._disposeOffscreenBuffers(),this._fboCache.destroy(),this._fboCache=null,this._renderContext.destroy(),this._plugins.destroy(),this._plugins=null,this._pluginInput=null,this._oitBlendOrNil=null,this._nodes=null,this._framebuffer=null,this._performanceInfo=null,k.prune(),se.prune(),C()}get renderContext(){return this._renderContext}get _bindParameters(){return this._renderContext.bind}get _oitBlend(){return this._oitBlendOrNil??=new j(this._techniques),this._oitBlendOrNil}get performanceInfo(){return this._performanceInfo}updateRenderFeatures(e){this._renderStateFeatures.value=Z(e),this._requestRender()}isFeatureEnabled(e,t=this._state.value){return this._renderStateFeatures.value.get(t,e)??!1}setFeatureEnabled(e,t,r){this._renderStateFeatures.mutate(s=>s.set(t,e,r)),this._requestRender()}get _highQualityTransparency(){return this.isFeatureEnabled(1)}get hasReflections(){return this._pluginsHas.water&&this.isFeatureEnabled(5)}get _hasHighlights(){return this._plugins.produces(10,2,4,19,13,14,15)}hasHighlight(e){return this._plugins.hasHighlight(e)}get _hasHUDHighlights(){return this._plugins.produces(10,13,14,15)}get hasSSAO(){return this.isFeatureEnabled(4)&&!this._inGlobeView}get hasSMAA(){return this.isFeatureEnabled(0)}get _hasEmission(){return this._plugins.hasEmitters&&(this._hasIOSEmission||this.hasFloatOit)}get highResolutionAtmosphere(){return this.isFeatureEnabled(3)}get fboCache(){return this._fboCache}_releaseFBOs(){this._bindParameters.ssr.lastFrameColor=n(this._bindParameters.ssr.lastFrameColor),this._bindParameters.terrainDepth=n(this._bindParameters.terrainDepth),this._bindParameters.geometryDepth=n(this._bindParameters.geometryDepth),this._bindParameters.hudOcclusion=n(this._bindParameters.hudOcclusion),this._bindParameters.depth=n(this._bindParameters.depth)}_disposeOffscreenBuffers(){this._framebuffer.dispose(),this._disposeBindBuffers()}_disposeBindBuffers(){this._bindParameters.shadowMap.disposeOutputs()}get updating(){return this._loadEdgeViewTask&&!this._loadEdgeViewTask.finished||this._edgeView?.updating||this._shadowAccumulator.readyToRun||this._plugins.updating||this.weatherFader?.readyToRun||!this.isCameraFinal}loadEdgeView(){return this._loadEdgeViewTask||(this._loadEdgeViewTask=r(async e=>{const{EdgeView:t}=await import("./edgeRendering/EdgeView.js");h(e);const r=this._edgeView=new t({rctx:this._rctx,renderSR:this.stage.view.renderSpatialReference,viewingMode:this.stage.view.stage.viewingMode,techniques:this._techniques,setNeedsRender:()=>this._requestRender(),schedule:De(this.stage.view.resourceController)});return this.addHandles(o(()=>r.updating,()=>this._requestRender(),u)),this._requestRender(),this._edgeViewCallbacks.forEach(e=>e(r)),this._edgeViewCallbacks.length=0,r})),this._loadEdgeViewTask.promise}withEdgeView(e){this.loadEdgeView(),null==this._edgeView?this._edgeViewCallbacks.push(e):e(this._edgeView)}get edgeView(){return this._edgeView}get isCameraFinal(){return this._reprojectionMatrixVersion.value>=0&&c(this._bindParameters.ssr.reprojectionMatrix,b)}set _reprojectionMatrix(e){t(this._bindParameters.ssr.reprojectionMatrix,e)&&this._reprojectionMatrixVersion.value++}get shadowsEnabled(){return!!this._bindParameters.shadowMap.enabled}setParameters(e){void 0!==e.shadowMap&&this._bindParameters.shadowMap.enabled!==e.shadowMap&&(this._bindParameters.shadowMap.enabled=e.shadowMap,this._requestRender()),e.shadowCast&&this._shadowAccumulator.setParameters(e.shadowCast)}set slice(e){this._sliceHelper.update(e)&&this._requestRender()}get plugins(){return this._plugins}get hasFloatOit(){return this._rctx.driverTest.floatBufferBlend.result&&this.isFeatureEnabled(10)}get oitEnabled(){return this.hasFloatOit||this._hasOIT8}commit(e,t){return this._isRendering&&console.warn("Renderer.modify called while rendering"),!!super.commit(e,t,this._plugins.context)&&(this.updateHasFlags(),!0)}rendererAdded(e){this._plugins.add(e)}rendererRemoved(e){this._plugins.remove(e)}get occludedRequiresStencil(){return this.occludedRequiresOccludeeStencil||this.occludedRequiresIntegratedMeshStencil}get occludedRequiresOccludeeStencil(){return this._bindParameters.hasOccludees&&!!(8&this.plugins.renderOccludedFlags)}get occludedRequiresIntegratedMeshStencil(){return this._plugins.produces(0,0)&&this._plugins.produces(0,10)}updateHasFlags(){const has=this._pluginsHas;has.occludedHudElements=this._plugins.produces(0,14),has.hudElements=has.occludedHudElements||this._plugins.produces(0,...be),has.water=this._plugins.produces(4,20),this._bindParameters.hasOccludees=this._plugins.hasOccludees,this._requestRender()}updateAnimation(e,t){this._animationTimer??=new V(e.camera,t),this._animationTimer.advance(e.camera,t,this._animationTimeDilation);const r=this._hasAnimations;return this._hasAnimations=this._plugins.updateAnimation(this._animationTimer),this._hasAnimations=this._nodes.updateAnimation(this._animationTimer)||this._hasAnimations,this._hasAnimations!==r&&(this._gpuTimerHandle=r?s(this._gpuTimerHandle):this.performanceInfo.enableGPUPerformanceInfo()),this._hasAnimations}get animationTimestep(){return this._animationTimestep.value}get _animationTimeDilation(){return this._animationTimestep.timeDilation}resetAnimation(){this._animationTimestep.clear()}tick(){this.fboCache.clean()}render(e,t,r,s=!1){try{return this._isRendering=!0,this._render(e,t,r,s)}catch(i){console.error(`Exception during rendering: ${i}:\n${i.stack}`)}finally{this._isRendering=!1}return new ie(this._pluginInput.get(A.FINAL),null)}_render(e,t,r,s){const i=0===r;this.performanceInfo.startFrame(),this.fboCache.frameStart(),this.fboCache.interactive=i,this._disposeBindBuffers();const{camera:a,contentCamera:n,mode:h,alignPixelEnabled:o}=e;this._state.value=h,this._renderContext.time=t,this._bindParameters.output=0,this._bindParameters.hasEmission=this._hasEmission,this._bindParameters.alignPixelEnabled=o,this._bindParameters.decorations=!s,this._bindParameters.mainDepth=null,this._bindParameters.hasFloatOit.value=this.hasFloatOit;const d=!s||!this._sliceHelper.isDecoration;this._bindParameters.slicePlane=d?this._sliceHelper.plane:null,this._bindParameters.viewshedEnabled=this._nodes.produces(S.VIEWSHED),this._bindParameters.cutFillEnabled=this._nodes.produces(S.CUTFILL_COMPUTATION),this._renderOverlay(),a.setGLViewport(this._rctx);const _=this._framebuffer,u=_.initialize(a.fullWidth,a.fullHeight,this._backgroundColor);this.hasReflections?(u?.setName("last frame color"),this._bindParameters.ssr.lastFrameColor=u):u?.release(),this._ensureBindParametersCamera(a,n),this._ensureBindParametersWeatherFader(this._renderContext.time),this._plugins.sortTestsTransparentOrderedSlots(Te),this._plugins.prepareRender(),this._bindParameters.shadowHighlightsVisible=this._needsShadowHighlight&&!s,this._hasTransparentGeometry=this._plugins.produces(0,...me),this._precompilePrepasses(),this.performanceInfo.advance(ne.PREPARE);const l=this._computeShadowDepthRange(a);this._renderShadowMap(a,this._bindParameters.lighting.mainLight.direction,l),this._pluginInput.set("normals",this._renderNormals()),this._renderSSAOAndDepth(),this._renderShadowAccumulation(l,!i),this._oitCallouts=this._hasTransparentGeometry&&this.oitEnabled,this._ensureBindParametersSSR(t),this._precompileShaders(),this._bindParameters.output=0,_.bind(),this._bindParameters.mainDepth=_.depth.attachment,this._renderOpaque(),this._renderTransparent(),this._bindParameters.shadowMap.disposeOutput(5),this._renderCutFillComputation(),this._pluginInput.set(S.FOCUSAREA,this._renderFocusAreaGeometry()),_.update(e=>this._renderNodes(S.TRANSPARENT_ENVIRONMENT,e)),_.update(e=>this._renderNodes(S.VIEWSHED,e)),_.update(e=>this._renderNodes(S.LASERLINES,e)),_.update(e=>this._renderNodes(S.FOCUSAREA_COLOR,e)),this._pluginInput.release(S.FOCUSAREA),_.update(e=>this._renderNodes(S.OCCLUDED,e)),this._pluginInput.set("highlights",this._renderHighlightPrepass());const m=2===r?this._renderObjectAndLayerIdColor():null;_.update(e=>this._renderNodes(A.COMPOSITE,e)),this._bindParameters.shadowMap.disposeOutputs(),_.update(e=>this._renderNodes(S.ANTIALIASING,e));const p=this._hasPhotoshopTerrain||!this._hasTransparentGeometry?1:2;let c;return this._bindParameters.hasEmission=!1,this._hasHUDHighlights&&_.update(e=>this._renderHUD(p,e)),_.update(e=>this._renderNodes(S.HIGHLIGHT_COLOR,e)),this._hasHUDHighlights||_.update(e=>this._renderHUD(p,e)),this._bindParameters.hasEmission=this._hasEmission,_.update(e=>this._renderNodes(S.MAGNIFIER,e)),_.update(e=>this._renderNodes(A.FINAL,e)),i&&this._blit.toFramebuffer(this._rctx,_.color,this._bindParameters),this.onPostRender?.(),this._releaseFBOs(),_.releaseDepth(),this._renderContext.lastFrameCamera.copyFrom(this._bindParameters.camera),this.fboCache.frameEnd(),i||(c=_.color,c.retain(),this._releaseFBOs(),this._disposeOffscreenBuffers()),this.performanceInfo.finishFrame(),new ie(c,m)}_precompileShaders(){++this._plugins.context.techniques.precompiling,this._bindParameters.output=0;const e=this._bindParameters.hasEmission;this._precompileOpaqueGeometry(),this._nodes.precompile(e,S.OPAQUE_ENVIRONMENT,S.PRE_TRANSPARENT);const t=this._bindParameters;if(t.terrainDepthTest=t.cullAboveTerrain=this._needsTerrainDepth,this._bindParameters.output=3,this._plugins.precompile(...pe),this._needsDepth&&(this._precompileOpaqueGeometry(),this._precompileTransparentGeometry()),this._bindParameters.output=0,this._plugins.precompile(...pe),this._hasTransparentGeometry){const e=this._pluginsHas.occludedHudElements;this._oitBlend.precompile(this._bindParameters,e,0),this._pluginsHas.hudElements&&this._oitBlend.precompile(this._bindParameters,!1,1)}this._hasTransparentGeometry&&(this._precompileTransparentGeometry(),this._hasPhotoshopTerrain&&(t.cullAboveTerrain=!1,this._precompileTransparentGeometry(),t.cullAboveTerrain=this._needsTerrainDepth)),this._nodes.precompile(e,S.FOCUSAREA);const r=this._hasPhotoshopTerrain&&!this._needsTerrainDepth;this._compositor.precompile(this._usesPremultipliedAlphaBlit,!!this._needsEdges,r,e),this._oitCallouts||this._plugins.precompile(16),t.terrainDepthTest=t.cullAboveTerrain=!1,this._nodes.precompile(e,S.TRANSPARENT_ENVIRONMENT,S.VIEWSHED,S.CUTFILL_COMPUTATION,S.LASERLINES,S.FOCUSAREA_COLOR,S.OCCLUDED,S.ANTIALIASING),t.highlightMixTexture=t.highlights.length>1?this._rctx.emptyTexture:null,this._precompileHUD(0),t.hasEmission=!1,this._precompileHUD(0),this._precompileHUD(1),t.hasEmission=this._hasEmission,this._hasHighlights&&(t.highlights.forEach((e,r)=>{t.highlightLevel=r,this._precompileAllGeometry(10),this._hasHUDHighlights&&this._plugins.precompile(14,13)}),t.highlightLevel=null,this._nodes.precompile(e,S.HIGHLIGHT_COLOR)),t.highlightMixTexture=null,this._nodes.precompile(e,A.COMPOSITE,S.MAGNIFIER),this._shadowAccumulator.precompile(),this._plugins.precompile(9),--this._plugins.context.techniques.precompiling}_renderFocusAreaGeometry(){const e=this._nodes.produce(S.FOCUSAREA,this._pluginInput);return e&&this.performanceInfo.advance(ne.FOCUS_AREA_MASK),e}_renderObjectAndLayerIdColor(){if(!this._nodes.produces("olid"))return null;const e=this._bindParameters.output;++this._techniques.precompiling;const{width:t,height:r}=this._framebuffer.size;let s=this.fboCache.acquire(t,r,"olid");return s.acquireDepth(13),s=this._nodes.render(s,this._pluginInput),--this._techniques.precompiling,this.performanceInfo.advance(ne.OBJECT_AND_LAYER_ID_COLOR),this._bindParameters.output=e,s}finish(e){this._hasAnimations||this._animationTimestep.clear();const t=this.performanceInfo.gpuSamplingEnabled,r=0===e;if(r||t){const e=r?this.performanceInfo.elapsedTime:0;let s=0;t?s=this.performanceInfo.totalGPUTimeSampler.last:this._rctx.gl.finish();const i=Math.max(e,s);this._animationTimestep.frame(i,r)}}readMainDepth(e,t){const{mainDepth:r,camera:s}=this._bindParameters;if(!r)return;const i=this.fboCache.acquire(this._framebuffer.size.width,this._framebuffer.size.height,"linear depth");this._rctx.bindFramebuffer(i.fbo),s.setGLViewport(this._rctx),this._rctx.setScissorRect(e[0],e[1],e[2],e[3]),this._rctx.setScissorTestEnabled(!0),this._rctx.clearFramebuffer(E),this._compositor.blitDepthToLinearDepth(this._bindParameters,r),this._rctx.setScissorTestEnabled(!1),this._rctx.setScissorRect(0,0,this._rctx.gl.canvas.width,this._rctx.gl.canvas.width),i.fbo?.readPixels(e[0],e[1],e[2],e[3],6408,he.UNSIGNED_BYTE,t),i.release()}readAccumulatedShadow(e){return this._shadowAccumulator.readAccumulatedShadow(e[0],e[1])}get _needsEdges(){return this._edgeView?.shouldRender()?this._edgeView:null}_renderEdges(e){const t=this._needsEdges;if(!t)return;const{width:r,height:s}=this._framebuffer.size,i=this.fboCache.acquire(r,s,"edges"),a=this._bindParameters.geometryDepth,n=()=>t.render(this._bindParameters,e);this._renderToTargets(n,i,a??this._framebuffer.depth,E),this._framebuffer.bind(),this._compositor.composite(this._bindParameters,i.getTexture()),i.release(),this.performanceInfo.advance(1===e?ne.OPAQUE_EDGES:ne.TRANSPARENT_EDGES)}_renderOverlay(){this._bindParameters.overlay=this.overlay?.render(this._renderContext.time),this._bindParameters.overlay&&this.performanceInfo.advance(ne.OVERLAY)}_renderShadowMap(e,t,r){if(!this.shadowsEnabled)return;const s=this._bindParameters.shadowMap;s.start(e,t,r,this.isFeatureEnabled(6),this.stage.view.qualitySettings.maximumPixelRatio),this._needsShadowHighlight?(this._renderShadowCascades(7,s),s.clear(),this._renderShadowCascades(6,s)):this._renderShadowCascades(5),e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,this._bindParameters.contentCamera),this.performanceInfo.advance(ne.SHADOW_MAP)}_renderCutFillComputation(){this._nodes.produce(S.CUTFILL_COMPUTATION,this._pluginInput)?.release()}_precompileShadowCascades(e){0!==this._bindParameters.shadowMap.cascades.length&&this._precompileAllGeometry(e)}_renderShadowCascades(e,t=this._bindParameters.shadowMap){const r=this._bindParameters.output;t.bindFramebuffer();for(const s of t.cascades)s.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(s.camera,s.camera),this.renderAllGeometry(e);t.finish(e),this._bindParameters.output=r}get _needsDepth(){return this._nodes.requireGeometryDepth()||this.hasReflections||this._needsShadowHighlight||this._shadowAccumulator.active||this._debugNeedsDepth}get _usesPremultipliedAlphaBlit(){return this._pluginsHas.hudElements&&this.oitEnabled||this._hasPhotoshopTerrain}_renderSSAOAndDepth(){const e=this._pluginInput.get("normals");e?(this._pluginInput.set(S.SSAO,this._renderSSAO()),this._needsDepth?(this._rctx.bindFramebuffer(e.fbo),this._rctx.clear(1024),this._renderGeometryWithoutNormals(3),this._bindParameters.depth?.release(),this._bindParameters.depth=e.obtainDepthTexture(),this.performanceInfo.advance(ne.DEPTH)):(e.detachDepth(),this._bindParameters.depth=n(this._bindParameters.depth)),this.hasSSAO&&this._pluginInput.release("normals")):this._renderAllGeometryDepth()}_renderAllGeometryDepth(){if(this._bindParameters.depth=n(this._bindParameters.depth),!this._needsDepth)return;const{width:e,height:t}=this._framebuffer.size,r=this.fboCache.acquire(e,t,"geometry depth",13);this._rctx.bindFramebuffer(r.fbo),this._rctx.clear(1280),this.renderAllGeometry(3),this._bindParameters.depth=r.obtainDepthTexture(),r.release(),this.performanceInfo.advance(ne.DEPTH)}_renderTerrainDepth(){if(this._bindParameters.terrainDepth=n(this._bindParameters.terrainDepth),this._bindParameters.terrainDepthTest=this._bindParameters.cullAboveTerrain=this._needsTerrainDepth,!this._needsTerrainDepth)return;const e=this._bindParameters.output;this._bindParameters.output=3;const{width:t,height:r}=this._framebuffer.size,s=this.fboCache.acquire(t,r,"terrain depth",13);this._rctx.bindFramebuffer(s.fbo),this._rctx.clear(1280),this._renderTransparentGround(),this._bindParameters.terrainDepth=s.obtainDepthTexture(),s.release(),this._bindParameters.output=e}_renderGeometryDepth(){if(this._bindParameters.geometryDepth=n(this._bindParameters.geometryDepth),!this._needsTerrainDepth)return;const e=this._bindParameters.output,{width:t,height:r}=this._framebuffer.size,s=this.fboCache.acquire(t,r,"geometry depth",13);this._rctx.bindFramebuffer(s.fbo),this._rctx.clear(1280),this._renderOpaqueAndTransparentGeometry(3),this._bindParameters.output=e,this._bindParameters.geometryDepth=s.obtainDepthTexture(),s.release()}get _needsShadowDepthRange(){return this._bindParameters.shadowMap.enabled||this._shadowAccumulator.active}_computeShadowDepthRange(e){if(!this._needsShadowDepthRange)return z.Zero;const t=Q(e,this._plugins.plugins,this.stage.layers,0);return t.union(this._plugins.queryDepthRange(e)),t.near=Math.max(e.near,t.near),t.far=Math.min(e.far,t.far),t}updateSceneDepthRange(e){if(!this.stage.view.state.isGlobal)return void(this.sceneDepthRange.value=z.Infinite);if((this.stage.view.renderCoordsHelper?.getAltitude(e.eye)??0)<G)return void(this.sceneDepthRange.value=z.Infinite);const t=e.clone();t.near=O,t.far=1e10;const r=Q(t,this._plugins.plugins,this.stage.layers,1);r.union(this._plugins.queryDepthRange(t)),this.sceneDepthRange.value.equals(r)||(this.sceneDepthRange.value=r)}get _normalsRequired(){const e=this._nodes.require("normals",...R,S.VIEWSHED,S.LASERLINES);return(this.hasSSAO?1:0)+e}_precompilePrepasses(){this._normalsRequired&&this._precompileAllGeometry(4),this._needsDepth&&this._precompileAllGeometry(3),this.shadowsEnabled&&(this._needsShadowHighlight?(this._precompileShadowCascades(6),this._precompileShadowCascades(7)):this._precompileShadowCascades(5)),this._shadowAccumulator.active&&this._precompileAllGeometry(5),this.hasSSAO&&this._normalsRequired&&this._nodes.precompile(this._bindParameters.hasEmission,S.SSAO)}_renderNormals(){const e=this._normalsRequired;if(0===e)return;const{width:t,height:r}=this._framebuffer.size,s=this.fboCache.acquire(t,r,"normals",5);s.acquireDepth(13),this._rctx.bindFramebuffer(s.fbo),this._rctx.clearFramebuffer(E,!0,!0),this._bindParameters.output=4,this._plugins.render(...ce);const i=this._nodes.optional("normals",...R,S.VIEWSHED);return s.retain(e+i-1),this.performanceInfo.advance(ne.NORMALS),s}_renderSSAO(){const e=this._pluginInput.get("normals");if(this.hasSSAO&&e)return this._bindParameters.ssao=this._nodes.produce(S.SSAO,this._pluginInput),this._bindParameters.ssao&&this.performanceInfo.advance(ne.SSAO),this._bindParameters.ssao}_precompileAllGeometry(e){const t=this._bindParameters.output;this._bindParameters.output=e,this._precompileOpaqueGeometry(),this._precompileTransparentGeometry(),this._plugins.precompile(...pe),this._bindParameters.output=t}renderAllGeometry(e){this._bindParameters.output=e,this._renderOpaqueAndTransparentGeometry(e),this._renderTransparentGround()}precompileSlots(e,...t){for(const r of t)this._bindParameters.slot=r,e.precompile(this._renderContext)}precompileOccludedSlots(e,t){for(const r of t)this._renderContext.renderOccludedMask=r,this.precompileSlots(e,...ge);this._renderContext.renderOccludedMask=J}renderSlots(e,...t){for(const r of t)this._bindParameters.slot=r,e.forAll(e=>{const t=e.acquireTechniques(this._renderContext);t&&e.render(this._renderContext,t)})}renderOccludedSlots(e,t){this._renderContext.renderOccludedMask=t,this.plugins.renderOccludedFlags>1&&this._plugins.render(10),this.renderSlots(e,...ge),this._renderContext.renderOccludedMask=J}renderHUD(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(...we[e])}_renderHUDElements(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(17),this.renderHUD(e),this._bindParameters.hudRenderStyle=e,this._plugins.render(15)}precompileViewshedShadowMap(){this._precompileAllGeometry(8)}precompileCutFillReferenceDepth(){const e=this._bindParameters.output;this._bindParameters.output=9,this._plugins.precompile(...Ee),this._bindParameters.output=e}renderViewshedShadowMap(e){const{camera:t,contentCamera:r}=this._bindParameters,s=this._bindParameters.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this.renderAllGeometry(8),this._ensureBindParametersCamera(t,r),this._bindParameters.camera.setGLViewport(this._rctx),this._bindParameters.output=s}renderCutFillReferenceDepth(e){const{camera:t,contentCamera:r}=this._bindParameters,s=this._bindParameters.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this._bindParameters.output=9,this._plugins.render(...Ee),this._ensureBindParametersCamera(t,r),t.setGLViewport(this._rctx),this._bindParameters.output=s}_renderOpaqueAndTransparentGeometry(e){this._bindParameters.output=e,this._renderOpaqueGeometry(),this._renderTransparentGeometry()}_renderGeometryWithoutNormals(e){this._bindParameters.output=e,this._plugins.render(...fe)}_precompileOpaqueGeometry(){this._needsOpaquePass&&(this._plugins.precompile(...le),this._nodes.precompile(this._bindParameters.hasEmission,S.CUTFILL_COLOR,"opaque-color"))}_renderOpaqueGeometry(){this._plugins.render(...le)}_renderTransparentGeometry(){this._plugins.render(...me),this._oitCallouts&&this._plugins.render(16)}get _hasPhotoshopTerrain(){return this._plugins.produces(0,6)}get _needsTerrainDepth(){return this._highQualityTransparency&&this._hasPhotoshopTerrain}_renderPhotoshopTerrain(){if(!this._hasPhotoshopTerrain)return null;const{width:e,height:t}=this._framebuffer.size,r=this.fboCache.acquire(e,t,"transparent terrain"),s=()=>this._plugins.render(6);return this._renderToTargets(s,r,this._framebuffer.depth,E),this.performanceInfo.advance(ne.TRANSPARENT_TERRAIN),r}_renderTransparentGround(){this._plugins.render(...pe)}_renderLineCallouts(e){if(this._bindParameters.hudRenderStyle=e,0===e){const e=()=>this._plugins.render(16),{width:t,height:r}=this._framebuffer.size,s=this.fboCache.acquireDepth(this._hudDepthFormat,t,r,"line callouts");this._renderToTargets(e,this._framebuffer.color,s,void 0,!0,!0),s.release()}else this._plugins.render(16)}_precompileHUD(e){if(!this._pluginsHas.hudElements)return;const t=this._bindParameters.output,r=this._bindParameters.hudRenderStyle;this._bindParameters.hudRenderStyle=e,this.oitEnabled?(this._bindParameters.output=1,this._plugins.precompile(...be),this._bindParameters.output=2,this._plugins.precompile(...be),this._bindParameters.output=0,this._oitBlend.precompile(this._bindParameters,!1,1)):(this._bindParameters.output=0,this._plugins.precompile(...be)),this._hasHighlights&&(this._bindParameters.output=10,this._plugins.precompile(...be)),this._bindParameters.output=t,this._bindParameters.hudRenderStyle=r}_renderHUD(e,t){if(!this._pluginsHas.hudElements)return t;if(this.oitEnabled){const r=this._renderOIT(1,e);this._rctx.bindFramebuffer(t.fbo);const s=!!t.getTexture(oe);this._compositor.compositePreMultipliedAlpha(this._bindParameters,r.getTexture(),s),r.release()}else if(this._bindParameters.output=0,0===e){const t=()=>this._renderHUDElements(e),{width:r,height:s}=this._framebuffer.size,i=this.fboCache.acquireDepth(this._hudDepthFormat,r,s,"hud");this._renderToTargets(t,this._framebuffer.color,i,void 0,!0,!0),i.release()}else t.acquireDepth(this._hudDepthFormat),this._rctx.bindFramebuffer(t.fbo),this._rctx.clear(256),this._renderHUDElements(e),t.detachDepth();return this.performanceInfo.advance(0===e?ne.HUD_OCCLUDED:ne.HUD),t}get _needsShadowHighlight(){return this.shadowsEnabled&&this._plugins.produces(6,2)}_renderHighlightPrepass(){if(!this._hasHighlights)return;const{fboCache:e,_rctx:t,_bindParameters:r}=this,{width:s,height:i}=this._framebuffer.size,{highlights:a}=r,n=a.length>L?3:1,h=e.acquire(s,i,"highlights",n);h.acquireDepth(13);const o=this._plugins.produces(10,0);return o&&this._framebuffer.color.fbo&&h.fbo&&t.blitFramebuffer(this._framebuffer.color.fbo,h.fbo,1024),t.bindFramebuffer(h.fbo),t.gl.clearBufferuiv(6144,0,[0,0,0,0]),o||t.clear(1024),this._bindParameters.output=10,t.bindFramebuffer(h.fbo),U(t,e,s,i,r,()=>this._renderHighlightGeometries()),h.detachDepth(),this.performanceInfo.advance(ne.HIGHLIGHTS),h.retain(this._nodes.require("highlights",...D)+this._nodes.optional("highlights",...D)-1),h}_renderHighlightGeometries(){this._plugins.render(...Pe),this._rctx.clear(256),this._renderHUDElements(2)}_renderShadowAccumulation(e,t){this._shadowAccumulator.updateDepthRange(e),this._bindParameters.output=0,this._shadowAccumulator.accumulating&&this._bindParameters.depth&&this._shadowAccumulator.renderAccumulation(this._bindParameters,t)&&this.performanceInfo.advance(ne.ACCUMULATED_SHADOWS)}_precompileTransparentGeometry(){this.oitEnabled&&F(this._bindParameters.output)?(this._bindParameters.output=1,this._plugins.precompile(...me),this._oitCallouts&&this._plugins.precompile(16),this._bindParameters.output=2,this._plugins.precompile(...me),this._oitCallouts&&this._plugins.precompile(16),this._bindParameters.output=0):this._plugins.precompile(...me)}_renderOIT(e,t=2){const r=1===e,{width:s,height:i}=this._framebuffer.size,a=r?()=>this._renderHUDElements(t):()=>this._renderTransparentGeometry(),h=this._bindParameters,o=h.hasFloatOit.value?8:5,d=h.output;h.output=1;const _=r?"oit hud":"oit",u=this.fboCache.acquire(s,i,_,o),l=h.hasEmission&&(0===e||1!==t);l&&u.acquireColor(oe,o,"oit emissive");const m=l?de:oe;u.acquireColor(m,this.hasFloatOit?7:0,"oit alpha"),r||u.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(u.fbo),this._rctx.clearFramebuffer([0,0,0,1]),l&&this._rctx.clearBuffer(1,E),a(),u.detachDepth(),h.output=2;const p=this.fboCache.acquire(s,i,r?"oit hud front":"oit front");l&&p.acquireColor(oe,o,"oit emissive front"),r?p.acquireDepth(this._hudDepthFormat):p.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(p.fbo),this._rctx.clearFramebuffer(E,r),a(),p.detachDepth();const c=this._pluginsHas.occludedHudElements&&!r;let f;return h.hudOcclusion=n(this._bindParameters.hudOcclusion),h.output=0,r?(f=this.fboCache.acquire(s,i,"oit hud composite"),this._rctx.bindFramebuffer(f.fbo),this._rctx.setClearColor(0,0,0,1e-13),this._rctx.clear(16384)):(c&&(this._framebuffer.color.acquireColor(m,0,"hud occlusion"),this._rctx.clearBuffer(m-_e,E)),this._framebuffer.bind()),this._oitBlend.blend(this._rctx,u,p,h,l,c,e),f?.detachDepth(),r||(this._rctx.bindFramebuffer(p.fbo),this._framebuffer.bind(),c&&(h.hudOcclusion=this._framebuffer.color.obtainAttachment(m))),p.release(),u.release(),h.output=d,f}get _hudDepthFormat(){return this.isFeatureEnabled(8)?13:12}get _needsOpaquePass(){return this.plugins.produces(0,...le)||this.plugins.produces(5,...le)||this.plugins.produces(3,3)}_renderOpaque(){const e=this._needsOpaquePass;e&&(this._plugins.render(0,1),this._framebuffer.update(e=>this._renderNodes(S.CUTFILL_COLOR,e)),this._plugins.render(2,3));const t=this._framebuffer;this._renderTerrainDepth(),t.update(t=>this._renderNodes(A.OPAQUE,t,e)),this.fboCache.debugCallback?.(A.OPAQUE,t.color.fbo),t.update(e=>this._renderNodes(S.OPAQUE_ENVIRONMENT,e)),this.fboCache.debugCallback?.(S.OPAQUE_ENVIRONMENT,t.color.fbo),this._renderEdges(1)}_renderTransparent(){const e=this._framebuffer;e.bind(),e.update(e=>this._renderNodes(S.PRE_TRANSPARENT,e)),this.fboCache.debugCallback?.(S.PRE_TRANSPARENT,e.color.fbo),this._renderHiddenTransparentEdges(),this._hasTransparentGeometry&&(this.oitEnabled?this._renderOIT(0):this._renderTransparentGeometry()),e.update(e=>this._renderNodes(A.TRANSPARENT,e,this._hasTransparentGeometry)),this.fboCache.debugCallback?.(A.TRANSPARENT,e.color.fbo),this._renderGeometryDepth(),this._needsTerrainDepth||this._oitCallouts||this._plugins.render(16),this._renderEdges(0);const t=this._renderPhotoshopTerrain(),r=t?.getTexture();r&&this._renderHUD(0,e.color),this._bindParameters.cullAboveTerrain=!1,r&&(e.bind(),this._compositor.compositePreMultipliedAlpha(this._bindParameters,r),t?.release(),this._needsTerrainDepth&&(this._renderEdges(1),this._hasTransparentGeometry&&(this.oitEnabled?this._renderOIT(0):this._renderTransparentGeometry(),this.performanceInfo.advance(ne.TRANSPARENT)),this._renderEdges(0))),this._bindParameters.ssao=n(this._bindParameters.ssao),this._needsTerrainDepth&&this._renderLineCallouts(1),this._bindParameters.terrainDepthTest=!1,this._renderTransparentEnvironment()}_renderTransparentEnvironment(){this._shadowAccumulator.render(this._bindParameters),this.performanceInfo.advance(ne.APPLY_ACCUMULATED_SHADOWS),this._framebuffer.bind(),this._plugins.render(9),this.performanceInfo.advance(ne.TRANSPARENT_MATERIAL_WITHOUT_DEPTH)}_renderNodes(e,t,r=!1){const s=t.name;if(t.setName(e),this._pluginInput.set(e,t),!this._nodes.produces(e))return r&&this.performanceInfo.advance(e),t;this._fboCache.debugCallback?.(s,t.fbo);const i=this._nodes.render(t,this._pluginInput,this._releaseNodeInputs);return this.performanceInfo.advance(e),i}_ensureBindParametersCamera(e,t){this._bindParameters.camera=e,this._bindParameters.contentCamera=t}_ensureBindParametersWeatherFader(e){1===this.stage.viewingMode&&(this._bindParameters.clouds.data&&(this._bindParameters.clouds.fade(this._bindParameters.camera,e,this.stage.view.qualitySettings.fadeDuration),this.weatherFader?.cleanupCubemap()),this._bindParameters.snowCover=this.weatherFader?.snowCover??0)}_ensureBindParametersSSR(e){if(this._bindParameters.ssr.lastFrameColor){null==this._ssrEnableTime&&(this._ssrEnableTime=e),this._renderContext.lastFrameCamera.equals(this._bindParameters.camera)?this._reprojectionMatrix=b:(f(Se,this._bindParameters.camera.viewMatrix),f(Ae,this._bindParameters.camera.projectionMatrix),g(Re,Se,Ae),g(Re,this._renderContext.lastFrameCamera.viewMatrix,Re),g(Re,this._renderContext.lastFrameCamera.projectionMatrix,Re),this._reprojectionMatrix=Re);const t=this.stage.view.qualitySettings.fadeDuration;this._bindParameters.ssr.fadeFactor=t>0?Math.min(t,e-this._ssrEnableTime)/t:1,this._bindParameters.ssr.fadeFactor<1&&this._requestRender()}else this._reprojectionMatrix=b,this._ssrEnableTime=null}addRenderNode(e){this._nodes.add(e),this._requestRender()}removeRenderNode(e){this._nodes.remove(e),this._requestRender()}updateLighting(e,t,r,s){this._bindParameters.updateLighting(e,t,r,s),this._requestRender(1)}get usedMemory(){return{fbos:this.fboCache.usedMemory,plugins:this._plugins.usedMemory,edges:this.edgeView?.usedMemory??0,clouds:this.weatherFader?.usedMemory??0}}_renderToTargets(e,t,r,s,i=!1,a=!1){t.attachDepth(r),this._rctx.bindFramebuffer(t.fbo),this._rctx.clearFramebuffer(s,i,a),e(),t.detachDepth()}get test(){}};e([m({readOnly:!0})],ue.prototype,"highResolutionAtmosphere",null),e([m()],ue.prototype,"_edgeView",void 0),e([m()],ue.prototype,"updating",null),ue=e([p("esri.views.3d.webgl-engine.lib.Renderer")],ue);const le=[0,1,2,3],me=[8,7,4,5],pe=[6,8,7],ce=[0,1,2,4,...pe],fe=[3,5],ge=[2,4,9],be=[17,13,15,14],Pe=[4,5,2,3,0,1,...pe],Te=[4,9,5,12],we={0:[14],1:[13],2:[14,13],3:[14,13]},Ee=[0,1,...pe],Ce=["normals","highlights"],Ae=P(),Se=P(),Re=P();function De(e){return t=>e.immediate.schedule(t)}export{ue as Renderer};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{getScale as r}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as e}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{diameter as t}from"../../../../geometry/support/aaBoundingBox.js";import{isPclIntersectorResult as n,isVoxelIntersectorResult as i,isI3sIntersectorResult as l}from"../../layers/i3s/Intersector.js";import{isOverlayIntersectorResult as a,isTerrainIntersectorResult as u}from"../../terrain/Intersector.js";import{isHUDIntersectorResult as o}from"./HUDIntersectorResult.js";import{isObjectIntersectorResult as c}from"./ObjectIntersectorResult.js";import{isLodIntersectorResult as s}from"./lodRendering/Intersector.js";function g(r,e){return c(r)||o(r)?V(r.target?.object,e):u(r)?e.map?.ground:r.target&&"layerViewUid"in r.target?V(r.target,e):null}function p(r,e){const t=f(r,e);return"graphic"===t?.type?t.graphic:null}function f(r,e,t={}){if(null==r)return null;if(c(r)||o(r))return d(r.target?.object,e,t);if(n(r)){const e=r.target.createGraphic();return{type:"graphic",graphic:e,layer:e.layer}}if(i(r)){const e=r.target.createVoxelGraphic();return{type:"graphic",graphic:e,layer:e.layer}}return a(r)||s(r)?d(r.target,e,t):l(r)?m(r.target,e,t):null}function d(r,e,t){if(null==r?.graphicUid)return null;const n=V(r,e);if(null==n)return null;if(n===e.graphics)return null==e.graphicsView||"number"!=typeof r.graphicUid?null:e.graphicsView.getHit(r.graphicUid,t);const i=e.allLayerViews.find(r=>r.layer===n);return!i||i.suspended||null==r.graphicUid?null:"getHit"in i?i.getHit(r.graphicUid,t):null}function m(r,e,t){const n=V(r,e);if(null==n)return null;const i=e.allLayerViews.find(r=>r.layer===n);if(!i||i.suspended||!("getGraphicFromIntersectorTarget"in i))return null;const l=t.defer;return y(i.getGraphicFromIntersectorTarget(r,{defer:l?r=>l(async()=>y(await r())):void 0}))}function h(r,e){const t=V(r,e);if(null==t)return null;const n=e.allLayerViews.find(r=>r.layer===t);return n&&!n.suspended&&"getAABBFromIntersectorTarget"in n?n.getAABBFromIntersectorTarget(r):null}function y(r){return null!=r?{type:"graphic",graphic:r,layer:r.layer}:null}function V(r,e){return null==r?.layerViewUid?null:null!=e.graphicsView&&r.layerViewUid===e.graphicsView.uid?e.graphics:e.allLayerViews.find(e=>e.uid===r.layerViewUid)?.layer}function w(e,n){if(c(e)||o(e))return e.target.object.boundingVolumeWorldSpace.bounds.radius;if(s(e)){r(b,e.transformation);const t=Math.max(b[0],b[1],b[2]);return e.target.baseBoundingSphere.radius*t}if(l(e)){const r=h(e.target,n);return r?.5*t(r):null}return null}function j(r){return!c(r)&&!o(r)&&(s(r)?r.target.numLodLevels>1:!!l(r))}const b=e();export{w as getIntersectedFeatureBSRadius,j as hasLod,p as toGraphic,f as toHit,g as toOwner};
2
+ import{getScale as r}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as t}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{diameter as e}from"../../../../geometry/support/aaBoundingBox.js";import{isGaussianSplatLayer as n}from"../../../../layers/support/layerUtils.js";import{isGaussianSplatIntersectorResult as i,isPclIntersectorResult as l,isVoxelIntersectorResult as a,isI3sIntersectorResult as u}from"../../layers/i3s/Intersector.js";import{isOverlayIntersectorResult as o,isTerrainIntersectorResult as c}from"../../terrain/Intersector.js";import{isHUDIntersectorResult as s}from"./HUDIntersectorResult.js";import{isObjectIntersectorResult as g}from"./ObjectIntersectorResult.js";import{isLodIntersectorResult as p}from"./lodRendering/Intersector.js";function f(r,t){return g(r)||s(r)?b(r.target?.object,t):c(r)?t.map?.ground:r.target&&"layerViewUid"in r.target?b(r.target,t):null}function d(r,t){const e=m(r,t);return"graphic"===e?.type?e.graphic:null}function m(r,t,e={}){if(null==r)return null;if(g(r)||s(r))return y(r.target?.object,t,e);if(i(r))return w(U(r.target,t));if(l(r)){const t=r.target.createGraphic();return{type:"graphic",graphic:t,layer:t.layer}}if(a(r)){const t=r.target.createVoxelGraphic();return{type:"graphic",graphic:t,layer:t.layer}}return o(r)||p(r)?y(r.target,t,e):u(r)?h(r.target,t,e):null}function y(r,t,e){if(null==r?.graphicUid)return null;const n=b(r,t);if(null==n)return null;if(n===t.graphics)return null==t.graphicsView||"number"!=typeof r.graphicUid?null:t.graphicsView.getHit(r.graphicUid,e);const i=t.allLayerViews.find(r=>r.layer===n);return!i||i.suspended||null==r.graphicUid?null:"getHit"in i?i.getHit(r.graphicUid,e):null}function h(r,t,e){const n=b(r,t);if(null==n)return null;const i=t.allLayerViews.find(r=>r.layer===n);if(!i||i.suspended||!("getGraphicFromIntersectorTarget"in i))return null;const l=e.defer;return j(i.getGraphicFromIntersectorTarget(r,{defer:l?r=>l(async()=>j(await r())):void 0}))}function V(r,t){const e=b(r,t);if(null==e)return null;const n=t.allLayerViews.find(r=>r.layer===e);return n&&!n.suspended&&"getAABBFromIntersectorTarget"in n?n.getAABBFromIntersectorTarget(r):null}function j(r){return null!=r?{type:"graphic",graphic:r,layer:r.layer}:null}function w(r){return n(r)?{type:"layer",layer:r}:null}function U(r,t){const e=b(r,t);return null!=e&&"type"in e?e:null}function b(r,t){return null==r?.layerViewUid?null:null!=t.graphicsView&&r.layerViewUid===t.graphicsView.uid?t.graphics:t.allLayerViews.find(t=>t.uid===r.layerViewUid)?.layer}function I(t,n){if(g(t)||s(t))return t.target.object.boundingVolumeWorldSpace.bounds.radius;if(p(t)){r(x,t.transformation);const e=Math.max(x[0],x[1],x[2]);return t.target.baseBoundingSphere.radius*e}if(u(t)){const r=V(t.target,n);return r?.5*e(r):null}return null}function B(r){return!g(r)&&!s(r)&&(p(r)?r.target.numLodLevels>1:!!u(r))}const x=t();export{I as getIntersectedFeatureBSRadius,B as hasLod,d as toGraphic,m as toHit,f as toOwner};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{ZEROS as t}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isColorOrOLID as e,isDepth as r,is2DGeometryOutput as s,isColor as i}from"../core/shaderLibrary/ShaderOutput.js";import a from"../lib/GLMaterial.js";import{DefaultBufferWriter as o}from"./DefaultBufferWriter.js";import{TriangleMaterial as n}from"./TriangleMaterial.js";import{VisualVariablePassParameters as h}from"./VisualVariablePassParameters.js";import{getLayout as p,ColorMaterialTechnique as u}from"../shaders/ColorMaterialTechnique.js";import{ColorMaterialTechniqueConfiguration as c}from"../shaders/ColorMaterialTechniqueConfiguration.js";import{alphaCutoff as l}from"../../../../webscene/support/AlphaCutoff.js";class m extends n{constructor(t){super(t,g),this._configuration=new c,this.supportsEdges=!0,this.produces=new Map([[2,t=>this._isOpaqueMaterialPass(t)],[3,t=>this._isOpaqueNoSSAODepthPass(t)],[4,t=>e(t)&&this.transparent&&this.parameters.writeDepth],[5,t=>r(t)&&this.transparent&&this.parameters.writeDepth],[9,t=>e(t)&&this.transparent&&!this.parameters.writeDepth],[19,t=>s(t)]])}updateConfiguration(t){super.updateConfiguration(t),this._configuration.cullFace=this.parameters.cullFace,this._configuration.hasVertexColors=this.parameters.hasVertexColors&&!this.parameters.vvColor,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.discardInvisibleFragments=this.transparent&&!this._isOpaquePass(t.output)&&this.parameters.discardInvisibleFragments,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.hasOccludees=t.hasOccludees,this._configuration.terrainDepthTest=t.terrainDepthTest&&i(t.output),this._configuration.cullAboveTerrain=t.cullAboveTerrain,this._configuration.hasVVColor=!!this.parameters.vvColor,this._configuration.draped=this.parameters.draped,this._configuration.emissionSource=this.hasEmissions?1:0}get visible(){return this.parameters.color[3]>=l}get transparent(){return this.parameters.color[3]<1||this.parameters.forceTransparentMode}get hasEmissions(){return this.parameters.emissiveStrength>0}_isOpaquePass(t){return i(t)||this._isOpaqueMaterialPass(t)||this._isOpaqueNoSSAODepthPass(t)}_isOpaqueMaterialPass(t){return 10===t||e(t)&&!this.transparent}_isOpaqueNoSSAODepthPass(t){return r(t)&&this.parameters.writeDepth&&!this.transparent}createGLMaterial(t){return new f(t)}createBufferWriter(){return new o(p(this.parameters))}}class f extends a{beginSlot(t){return this.getTechnique(u,t)}}class g extends h{constructor(){super(...arguments),this.color=t,this.forceTransparentMode=!1,this.writeDepth=!0,this.hasVertexColors=!1,this.polygonOffset=!1,this.hasSlicePlane=!1,this.cullFace=0,this.draped=!1,this.discardInvisibleFragments=!1,this.emissiveStrength=0,this.useIndexing=!1}}export{m as ColorMaterial,g as Parameters};
2
+ import{ZEROS as t}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isColorOrOLID as e,isDepth as r,is2DGeometryOutput as s,isColor as i}from"../core/shaderLibrary/ShaderOutput.js";import a from"../lib/GLMaterial.js";import{DefaultBufferWriter as o}from"./DefaultBufferWriter.js";import{TriangleMaterial as n}from"./TriangleMaterial.js";import{VisualVariablePassParameters as h}from"./VisualVariablePassParameters.js";import{getLayout as p,ColorMaterialTechnique as u}from"../shaders/ColorMaterialTechnique.js";import{ColorMaterialTechniqueConfiguration as c}from"../shaders/ColorMaterialTechniqueConfiguration.js";import{alphaCutoff as l}from"../../../../webscene/support/AlphaCutoff.js";class m extends n{constructor(t){super(t,g),this._configuration=new c,this.supportsEdges=!0,this.produces=new Map([[2,t=>this._isOpaqueMaterialPass(t)],[3,t=>this._isOpaqueNoSSAODepthPass(t)],[4,t=>e(t)&&this.transparent&&this.parameters.writeDepth],[5,t=>r(t)&&this.transparent&&this.parameters.writeDepth],[9,t=>e(t)&&this.transparent&&!this.parameters.writeDepth],[19,t=>s(t)]])}updateConfiguration(t){super.updateConfiguration(t),this._configuration.cullFace=this.parameters.cullFace,this._configuration.hasVertexColors=this.parameters.hasVertexColors&&!this.parameters.vvColor,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.discardInvisibleFragments=this.transparent&&!this._isOpaquePass(t.output)&&this.parameters.discardInvisibleFragments,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.hasOccludees=t.hasOccludees,this._configuration.terrainDepthTest=t.terrainDepthTest&&i(t.output),this._configuration.cullAboveTerrain=t.cullAboveTerrain,this._configuration.hasVVColor=!!this.parameters.vvColor,this._configuration.draped=this.parameters.draped,this._configuration.emissionSource=this.hasEmissions?1:0}get visible(){return this.parameters.color[3]>=l}get transparent(){return this.parameters.color[3]<1||this.parameters.forceTransparentMode}get hasEmissions(){return this.parameters.emissiveStrength>0}_isOpaquePass(t){return i(t)||this._isOpaqueMaterialPass(t)||this._isOpaqueNoSSAODepthPass(t)}_isOpaqueMaterialPass(t){return 10===t||e(t)&&!this.transparent}_isOpaqueNoSSAODepthPass(t){return r(t)&&this.parameters.writeDepth&&!this.transparent}createGLMaterial(t){return new f(t)}createBufferWriter(){return new o(p(this.parameters))}}class f extends a{beginSlot(t){return this.getTechnique(u,t)}}class g extends h{constructor(){super(...arguments),this.color=t,this.forceTransparentMode=!1,this.writeDepth=!0,this.hasVertexColors=!1,this.polygonOffset=0,this.hasSlicePlane=!1,this.cullFace=0,this.draped=!1,this.discardInvisibleFragments=!1,this.emissiveStrength=0,this.useIndexing=!1}}export{m as ColorMaterial,g as Parameters};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{exactEquals as e,set as t,copy as r,normalize as s,subtract as i,length as a,scale as o,dot as n,transformMat3 as l}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{ZEROS as u,create as c,fromValues as h}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{is3DGeometryOutputMRT as m,isShadowLike as p,isColor as d}from"../core/shaderLibrary/ShaderOutput.js";import{GLTextureMaterial as f}from"../lib/GLTextureMaterial.js";import{Material as T}from"../lib/Material.js";import{intersectTriangleGeometry as x}from"../lib/RayIntersections.js";import{getVerticalOffsetObject3D as g}from"../lib/verticalOffsetUtils.js";import{DefaultBufferWriter as v}from"./DefaultBufferWriter.js";import{verticalOffsetAtDistance as S}from"./internal/MaterialUtil.js";import{getLayout as b,DefaultMaterialPassParameters as M,DefaultMaterialTechnique as O}from"../shaders/DefaultMaterialTechnique.js";import{DefaultMaterialTechniqueConfiguration as C}from"../shaders/DefaultMaterialTechniqueConfiguration.js";import{RealisticTreeTechnique as w}from"../shaders/RealisticTreeTechnique.js";import{alphaCutoff as y}from"../../../../webscene/support/AlphaCutoff.js";class R extends T{constructor(e,t){super(e,P),this.materialType="default",this.supportsEdges=!0,this.intersectDraped=void 0,this.produces=new Map([[2,e=>(m(e)||p(e))&&!this.transparent],[4,e=>(m(e)||p(e))&&this.transparent&&this.parameters.writeDepth],[9,e=>(m(e)||p(e))&&this.transparent&&!this.parameters.writeDepth]]),this._layout=b(this.parameters),this._configuration=new C(t.spherical)}isVisibleForOutput(e){return 5!==e&&7!==e&&6!==e||this.parameters.castShadows}get visible(){const{layerOpacity:e,colorMixMode:t,opacity:r,externalColor:s}=this.parameters;return e*("replace"===t?1:r)*("ignore"===t||isNaN(s[3])?1:s[3])>=y}get _hasEmissiveBase(){return!!this.parameters.emissiveTextureId||!e(this.parameters.emissiveBaseColor,u)}get hasEmissions(){return this.parameters.emissiveStrength>0&&(0===this.parameters.emissiveSource&&this._hasEmissiveBase||1===this.parameters.emissiveSource)}updateConfiguration(e){super.updateConfiguration(e);const{parameters:t,_configuration:r}=this;r.hasNormalTexture=t.hasNormalTexture,r.hasColorTexture=t.hasColorTexture,r.hasMetallicRoughnessTexture=t.hasMetallicRoughnessTexture,r.hasOcclusionTexture=t.hasOcclusionTexture;const{treeRendering:s,doubleSided:i,doubleSidedType:a}=t;r.hasVertexTangents=!s&&t.hasVertexTangents,r.instanced=t.instanced,r.instancedDoublePrecision=t.instancedDoublePrecision,r.hasVVColor=!!t.vvColor,r.hasVVSize=!!t.vvSize,r.hasVerticalOffset=null!=t.verticalOffset,r.hasScreenSizePerspective=null!=t.screenSizePerspective,r.hasSlicePlane=t.hasSlicePlane,r.alphaDiscardMode=t.textureAlphaMode,r.normalType=s?0:t.normalType,r.transparent=this.transparent,r.writeDepth=t.writeDepth,r.customDepthTest=t.customDepthTest??0,r.hasOccludees=e.hasOccludees,r.cullFace=t.hasSlicePlane?0:t.cullFace,r.cullAboveTerrain=e.cullAboveTerrain,r.hasModelTransformation=!s&&null!=t.modelTransformation,r.hasVertexColors=t.hasVertexColors,r.hasSymbolColors=t.hasSymbolColors,r.doubleSidedMode=s?2:i&&"normal"===a?1:i&&"winding-order"===a?2:0,r.instancedFeatureAttribute=t.instancedFeatureAttribute,r.instancedColor=t.instancedColor,d(e.output)?(r.terrainDepthTest=e.terrainDepthTest,r.receiveShadows=t.receiveShadows,r.receiveAmbientOcclusion=t.receiveAmbientOcclusion&&null!=e.ssao):(r.terrainDepthTest=!1,r.receiveShadows=r.receiveAmbientOcclusion=!1),r.textureAlphaPremultiplied=!!t.textureAlphaPremultiplied,r.pbrMode=t.usePBR?t.isSchematic?2:1:0,r.emissionSource=t.emissionSource,r.offsetBackfaces=!(!this.transparent||!t.offsetTransparentBackfaces),r.enableOffset=e.enableOffset,r.snowCover=e.snowCover>0,r.hasColorTextureTransform=!!t.colorTextureTransformMatrix,r.hasNormalTextureTransform=!!t.normalTextureTransformMatrix,r.hasEmissionTextureTransform=!!t.emissiveTextureTransformMatrix,r.hasOcclusionTextureTransform=!!t.occlusionTextureTransformMatrix,r.hasMetallicRoughnessTextureTransform=!!t.metallicRoughnessTextureTransformMatrix}intersect(e,u,c,h,m,p){if(null!=this.parameters.verticalOffset){const e=c.camera;t(N,u[12],u[13],u[14]);let p=null;switch(c.viewingMode){case 1:p=s(B,N);break;case 2:p=r(B,V)}const d=i(z,N,e.eye),f=a(d),T=o(d,d,1/f);let x=null;this.parameters.screenSizePerspective&&(x=n(p,T));const g=S(e,f,this.parameters.verticalOffset,x??0,this.parameters.screenSizePerspective,null);o(p,p,g),l(_,p,c.transform.inverseRotation),h=i(A,h,_),m=i(I,m,_)}x(e,c,h,m,g(c.verticalOffset),p)}createGLMaterial(e){return new D(e)}createBufferWriter(){return new v(this._layout)}get transparent(){return j(this.parameters)}}class D extends f{constructor(e){super({...e,...e.material.parameters})}beginSlot(e){this._material.setParameters({receiveShadows:e.shadowMap.enabled});const r=this._material.parameters;this.updateTexture(r.textureId);const s=e.camera.viewInverseTransposeMatrix;return t(r.origin,s[3],s[7],s[11]),this._material.setParameters(this.textureBindParameters),this.getTechnique(r.treeRendering?w:O,e)}}class P extends M{constructor(){super(...arguments),this.treeRendering=!1,this.useIndexing=!1,this.hasVertexTangents=!1}get hasNormalTexture(){return!this.treeRendering&&!!this.normalTextureId}get hasColorTexture(){return!!this.textureId}get hasMetallicRoughnessTexture(){return!this.treeRendering&&!!this.metallicRoughnessTextureId}get hasOcclusionTexture(){return!this.treeRendering&&!!this.occlusionTextureId}get emissiveStrength(){return this.emissiveStrengthFromSymbol*this.emissiveStrengthKHR}get emissionSource(){return this.treeRendering?0:null!=this.emissiveTextureId&&0===this.emissiveSource?3:0===this.emissiveSource?2:1}get hasTextures(){return this.hasColorTexture||this.hasNormalTexture||this.hasMetallicRoughnessTexture||3===this.emissionSource||this.hasOcclusionTexture}}function j(e){const{drivenOpacity:t,opacity:r,externalColor:s,layerOpacity:i,texture:a,textureId:o,textureAlphaMode:n,colorMixMode:l}=e,u=s[3];return t||r<1&&"replace"!==l||u<1&&"ignore"!==l||i<1||(null!=a||null!=o)&&1!==n&&2!==n&&"replace"!==l}const A=c(),I=c(),V=h(0,0,1),B=c(),_=c(),N=c(),z=c();export{D as DefaultGLMaterial,R as DefaultMaterial,P as DefaultMaterialParameters,j as isTransparent};
2
+ import{exactEquals as e,set as t,copy as r,normalize as s,subtract as i,length as a,scale as o,dot as n,transformMat3 as l}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{ZEROS as u,create as c,fromValues as h}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{is3DGeometryOutputMRT as m,isShadowLike as p,isColor as d}from"../core/shaderLibrary/ShaderOutput.js";import{GLTextureMaterial as T}from"../lib/GLTextureMaterial.js";import{Material as f}from"../lib/Material.js";import{intersectTriangleGeometry as x}from"../lib/RayIntersections.js";import{getVerticalOffsetObject3D as g}from"../lib/verticalOffsetUtils.js";import{DefaultBufferWriter as v}from"./DefaultBufferWriter.js";import{verticalOffsetAtDistance as S}from"./internal/MaterialUtil.js";import{getLayout as b,DefaultMaterialPassParameters as M,DefaultMaterialTechnique as O}from"../shaders/DefaultMaterialTechnique.js";import{DefaultMaterialTechniqueConfiguration as C}from"../shaders/DefaultMaterialTechniqueConfiguration.js";import{RealisticTreeTechnique as w}from"../shaders/RealisticTreeTechnique.js";import{alphaCutoff as y}from"../../../../webscene/support/AlphaCutoff.js";class R extends f{constructor(e,t){super(e,P),this.materialType="default",this.supportsEdges=!0,this.intersectDraped=void 0,this.produces=new Map([[2,e=>(m(e)||p(e))&&!this.transparent],[4,e=>(m(e)||p(e))&&this.transparent&&this.parameters.writeDepth],[9,e=>(m(e)||p(e))&&this.transparent&&!this.parameters.writeDepth]]),this._layout=b(this.parameters),this._configuration=new C(t.spherical)}isVisibleForOutput(e){return 5!==e&&7!==e&&6!==e||this.parameters.castShadows}get visible(){const{layerOpacity:e,colorMixMode:t,opacity:r,externalColor:s}=this.parameters;return e*("replace"===t?1:r)*("ignore"===t||isNaN(s[3])?1:s[3])>=y}get _hasEmissiveBase(){return!!this.parameters.emissiveTextureId||!e(this.parameters.emissiveBaseColor,u)}get hasEmissions(){return this.parameters.emissiveStrength>0&&(0===this.parameters.emissiveSource&&this._hasEmissiveBase||1===this.parameters.emissiveSource)}updateConfiguration(e){super.updateConfiguration(e);const{parameters:t,_configuration:r}=this;r.hasNormalTexture=t.hasNormalTexture,r.hasColorTexture=t.hasColorTexture,r.hasMetallicRoughnessTexture=t.hasMetallicRoughnessTexture,r.hasOcclusionTexture=t.hasOcclusionTexture;const{treeRendering:s,doubleSided:i,doubleSidedType:a}=t;r.hasVertexTangents=!s&&t.hasVertexTangents,r.instanced=t.instanced,r.instancedDoublePrecision=t.instancedDoublePrecision,r.hasVVColor=!!t.vvColor,r.hasVVSize=!!t.vvSize,r.hasVerticalOffset=null!=t.verticalOffset,r.hasScreenSizePerspective=null!=t.screenSizePerspective,r.hasSlicePlane=t.hasSlicePlane,r.alphaDiscardMode=t.textureAlphaMode,r.normalType=s?0:t.normalType,r.transparent=this.transparent,r.enableOITOffset=e.enableOITOffset,r.writeDepth=t.writeDepth,r.customDepthTest=t.customDepthTest??0,r.hasOccludees=e.hasOccludees,r.cullFace=t.hasSlicePlane?0:t.cullFace,r.cullAboveTerrain=e.cullAboveTerrain,r.hasModelTransformation=!s&&null!=t.modelTransformation,r.hasVertexColors=t.hasVertexColors,r.hasSymbolColors=t.hasSymbolColors,r.doubleSidedMode=s?2:i&&"normal"===a?1:i&&"winding-order"===a?2:0,r.instancedFeatureAttribute=t.instancedFeatureAttribute,r.instancedColor=t.instancedColor,d(e.output)?(r.terrainDepthTest=e.terrainDepthTest,r.receiveShadows=t.receiveShadows,r.receiveAmbientOcclusion=t.receiveAmbientOcclusion&&null!=e.ssao):(r.terrainDepthTest=!1,r.receiveShadows=r.receiveAmbientOcclusion=!1),r.textureAlphaPremultiplied=!!t.textureAlphaPremultiplied,r.pbrMode=t.usePBR?t.isSchematic?2:1:0,r.emissionSource=t.emissionSource,r.offsetBackfaces=!(!this.transparent||!t.offsetTransparentBackfaces),r.snowCover=e.snowCover>0,r.hasColorTextureTransform=!!t.colorTextureTransformMatrix,r.hasNormalTextureTransform=!!t.normalTextureTransformMatrix,r.hasEmissionTextureTransform=!!t.emissiveTextureTransformMatrix,r.hasOcclusionTextureTransform=!!t.occlusionTextureTransformMatrix,r.hasMetallicRoughnessTextureTransform=!!t.metallicRoughnessTextureTransformMatrix}intersect(e,u,c,h,m,p){if(null!=this.parameters.verticalOffset){const e=c.camera;t(N,u[12],u[13],u[14]);let p=null;switch(c.viewingMode){case 1:p=s(B,N);break;case 2:p=r(B,V)}const d=i(z,N,e.eye),T=a(d),f=o(d,d,1/T);let x=null;this.parameters.screenSizePerspective&&(x=n(p,f));const g=S(e,T,this.parameters.verticalOffset,x??0,this.parameters.screenSizePerspective,null);o(p,p,g),l(_,p,c.transform.inverseRotation),h=i(I,h,_),m=i(A,m,_)}x(e,c,h,m,g(c.verticalOffset),p)}createGLMaterial(e){return new D(e)}createBufferWriter(){return new v(this._layout)}get transparent(){return j(this.parameters)}}class D extends T{constructor(e){super({...e,...e.material.parameters})}beginSlot(e){this._material.setParameters({receiveShadows:e.shadowMap.enabled});const r=this._material.parameters;this.updateTexture(r.textureId);const s=e.camera.viewInverseTransposeMatrix;return t(r.origin,s[3],s[7],s[11]),this._material.setParameters(this.textureBindParameters),this.getTechnique(r.treeRendering?w:O,e)}}class P extends M{constructor(){super(...arguments),this.treeRendering=!1,this.useIndexing=!1,this.hasVertexTangents=!1}get hasNormalTexture(){return!this.treeRendering&&!!this.normalTextureId}get hasColorTexture(){return!!this.textureId}get hasMetallicRoughnessTexture(){return!this.treeRendering&&!!this.metallicRoughnessTextureId}get hasOcclusionTexture(){return!this.treeRendering&&!!this.occlusionTextureId}get emissiveStrength(){return this.emissiveStrengthFromSymbol*this.emissiveStrengthKHR}get emissionSource(){return this.treeRendering?0:null!=this.emissiveTextureId&&0===this.emissiveSource?3:0===this.emissiveSource?2:1}get hasTextures(){return this.hasColorTexture||this.hasNormalTexture||this.hasMetallicRoughnessTexture||3===this.emissionSource||this.hasOcclusionTexture}}function j(e){const{drivenOpacity:t,opacity:r,externalColor:s,layerOpacity:i,texture:a,textureId:o,textureAlphaMode:n,colorMixMode:l}=e,u=s[3];return t||r<1&&"replace"!==l||u<1&&"ignore"!==l||i<1||(null!=a||null!=o)&&1!==n&&2!==n&&"replace"!==l}const I=c(),A=c(),V=h(0,0,1),B=c(),_=c(),N=c(),z=c();export{D as DefaultGLMaterial,R as DefaultMaterial,P as DefaultMaterialParameters,j as isTransparent};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{clamp as t}from"../../../../core/mathUtils.js";import{clone as e}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{fromValues as i}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as r}from"../../../../geometry/support/aaBoundingBox.js";import{isShadowLike as s,is3DGeometryOutputMRT as a,isColor as o}from"../core/shaderLibrary/ShaderOutput.js";import n from"../lib/GLMaterial.js";import{Material as h}from"../lib/Material.js";import{isPathGeometry as p}from"../lib/PathGeometry.js";import{MeshIntersectionOptions as c,intersectAabbInvDir as u}from"../lib/RayIntersections.js";import{DefaultBufferWriter as m}from"./DefaultBufferWriter.js";import{getLayout as l,PathPassParameters as d,PathTechnique as f}from"./PathTechnique.js";import{PathTechniqueConfiguration as b}from"./PathTechniqueConfiguration.js";import{alphaCutoff as g}from"../../../../webscene/support/AlphaCutoff.js";class _ extends h{constructor(t,e){super(t,w),this.supportsEdges=!0,this._pp0=i(0,0,1),this._pp1=i(0,0,0),this.produces=new Map([[2,t=>(this.parameters.castShadows&&s(t)||a(t))&&!this.transparent],[4,t=>(this.parameters.castShadows&&s(t)||a(t))&&this.transparent]]),this._configuration=new b(e.spherical)}get hasEmissions(){return this.parameters.emissiveStrength>0}updateConfiguration(t){super.updateConfiguration(t),this._configuration.hasVVSize=this.parameters.hasVVSize,this._configuration.hasVVColor=this.parameters.hasVVColor,this._configuration.hasVVOpacity=this.parameters.hasVVOpacity,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.transparent=this.transparent,this._configuration.hasOccludees=t.hasOccludees,o(t.output)?(this._configuration.doubleSidedMode=this.parameters.doubleSided&&"normal"===this.parameters.doubleSidedType?1:this.parameters.doubleSided&&"winding-order"===this.parameters.doubleSidedType?2:0,this._configuration.receiveShadows=t.shadowMap.enabled,this._configuration.receiveAmbientOcclusion=null!=t.ssao):this._configuration.receiveShadows=this._configuration.receiveAmbientOcclusion=!1,this._configuration.pbrMode=this.parameters.usePBR?2:0,this._configuration.emissionSource=this.parameters.usePBR?1:0,this._configuration.terrainDepthTest=t.terrainDepthTest,this._configuration.cullAboveTerrain=t.cullAboveTerrain,this._configuration.snowCover=t.snowCover>0}isVisibleForOutput(t){return 5!==t&&7!==t&&6!==t||this.parameters.castShadows}get visible(){return this.parameters.opacity>=g}intersect(t,e,i,r,s,a){this._intersect(t,i,r,s,a)}intersectDraped(t,e,i,r){return this._pp0[0]=this._pp1[0]=i[0],this._pp0[1]=this._pp1[1]=i[1],this._intersect(t,e,this._pp0,this._pp1,r)}_intersect(i,s,a,o,n){const h=i;if(!p(h))return;const m=h.path,l=e(this.parameters.size);if(this.parameters.vvSize){const{offset:e,factor:i,minSize:r,maxSize:s,fallback:a}=this.parameters.vvSize,o=m.sizeAttributeValue;Number.isNaN(o)?(l[0]*=a[0],l[1]*=a[2]):(l[0]*=t(e[0]+o*i[0],r[0],s[0]),l[1]*=t(e[2]+o*i[2],r[2],s[2]))}const d=new c(s.tolerance,!1,s.options.normalRequired),f=Math.max(l[0],l[1]),b=i.boundingInfo;if(null==b)return void v(m,l,a,o,d,n);const g=r(b.bbMin[0]-f,b.bbMin[1]-f,b.bbMin[2]-f,b.bbMax[0]+f,b.bbMax[1]+f,b.bbMax[2]+f),_=[o[0]-a[0],o[1]-a[1],o[2]-a[2]],S=Math.sqrt(_[0]*_[0]+_[1]*_[1]+_[2]*_[2]),w=[S/_[0],S/_[1],S/_[2]];u(g,a,w,s.tolerance)&&v(m,l,a,o,d,n)}createBufferWriter(){return new m(l(this.parameters))}createGLMaterial(t){return new S(t)}get transparent(){const{parameters:t}=this;return t.drivenOpacity||t.opacity<1}}class S extends n{beginSlot(t){return this.getTechnique(f,t)}}function v(t,e,i,r,s,a){t.baked.size&&t.baked.size[0]===e[0]&&t.baked.size[1]===e[1]||t.baked.bake(e),t.baked.intersect(i,r,s,a)}class w extends d{constructor(){super(...arguments),this.doubleSided=!1,this.doubleSidedType="normal",this.castShadows=!0,this.hasSlicePlane=!1,this.drivenOpacity=!1,this.usePBR=!1}}export{w as Parameters,_ as PathMaterial};
2
+ import{clamp as t}from"../../../../core/mathUtils.js";import{clone as e}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{fromValues as i}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as r}from"../../../../geometry/support/aaBoundingBox.js";import{isShadowLike as s,is3DGeometryOutputMRT as a,isColor as o}from"../core/shaderLibrary/ShaderOutput.js";import n from"../lib/GLMaterial.js";import{isPathGeometry as h}from"../lib/PathGeometry.js";import{MeshIntersectionOptions as p,intersectAabbInvDir as c}from"../lib/RayIntersections.js";import{DefaultBufferWriter as u}from"./DefaultBufferWriter.js";import{getLayout as m,PathPassParameters as l,PathTechnique as d}from"./PathTechnique.js";import{PathTechniqueConfiguration as f}from"./PathTechniqueConfiguration.js";import{TriangleMaterial as b}from"./TriangleMaterial.js";import{alphaCutoff as g}from"../../../../webscene/support/AlphaCutoff.js";class _ extends b{constructor(t,e){super(t,w),this.supportsEdges=!0,this._pp0=i(0,0,1),this._pp1=i(0,0,0),this.produces=new Map([[2,t=>(this.parameters.castShadows&&s(t)||a(t))&&!this.transparent],[4,t=>(this.parameters.castShadows&&s(t)||a(t))&&this.transparent]]),this._configuration=new f(e.spherical)}get hasEmissions(){return this.parameters.emissiveStrength>0}updateConfiguration(t){super.updateConfiguration(t),this._configuration.hasVVSize=this.parameters.hasVVSize,this._configuration.hasVVColor=this.parameters.hasVVColor,this._configuration.hasVVOpacity=this.parameters.hasVVOpacity,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.transparent=this.transparent,this._configuration.hasOccludees=t.hasOccludees,o(t.output)?(this._configuration.doubleSidedMode=this.parameters.doubleSided&&"normal"===this.parameters.doubleSidedType?1:this.parameters.doubleSided&&"winding-order"===this.parameters.doubleSidedType?2:0,this._configuration.receiveShadows=t.shadowMap.enabled,this._configuration.receiveAmbientOcclusion=null!=t.ssao):this._configuration.receiveShadows=this._configuration.receiveAmbientOcclusion=!1,this._configuration.pbrMode=this.parameters.usePBR?2:0,this._configuration.emissionSource=this.parameters.usePBR?1:0,this._configuration.terrainDepthTest=t.terrainDepthTest,this._configuration.cullAboveTerrain=t.cullAboveTerrain,this._configuration.snowCover=t.snowCover>0}isVisibleForOutput(t){return 5!==t&&7!==t&&6!==t||this.parameters.castShadows}get visible(){return this.parameters.opacity>=g}intersect(t,e,i,r,s,a){this._intersect(t,i,r,s,a)}intersectDraped(t,e,i,r){return this._pp0[0]=this._pp1[0]=i[0],this._pp0[1]=this._pp1[1]=i[1],this._intersect(t,e,this._pp0,this._pp1,r)}_intersect(i,s,a,o,n){const u=i;if(!h(u))return;const m=u.path,l=e(this.parameters.size);if(this.parameters.vvSize){const{offset:e,factor:i,minSize:r,maxSize:s,fallback:a}=this.parameters.vvSize,o=m.sizeAttributeValue;Number.isNaN(o)?(l[0]*=a[0],l[1]*=a[2]):(l[0]*=t(e[0]+o*i[0],r[0],s[0]),l[1]*=t(e[2]+o*i[2],r[2],s[2]))}const d=new p(s.tolerance,!1,s.options.normalRequired),f=Math.max(l[0],l[1]),b=i.boundingInfo;if(null==b)return void v(m,l,a,o,d,n);const g=r(b.bbMin[0]-f,b.bbMin[1]-f,b.bbMin[2]-f,b.bbMax[0]+f,b.bbMax[1]+f,b.bbMax[2]+f),_=[o[0]-a[0],o[1]-a[1],o[2]-a[2]],S=Math.sqrt(_[0]*_[0]+_[1]*_[1]+_[2]*_[2]),w=[S/_[0],S/_[1],S/_[2]];c(g,a,w,s.tolerance)&&v(m,l,a,o,d,n)}createBufferWriter(){return new u(m(this.parameters))}createGLMaterial(t){return new S(t)}get transparent(){const{parameters:t}=this;return t.drivenOpacity||t.opacity<1}}class S extends n{beginSlot(t){return this.getTechnique(d,t)}}function v(t,e,i,r,s,a){t.baked.size&&t.baked.size[0]===e[0]&&t.baked.size[1]===e[1]||t.baked.bake(e),t.baked.intersect(i,r,s,a)}class w extends l{constructor(){super(...arguments),this.doubleSided=!1,this.doubleSidedType="normal",this.polygonOffset=0,this.castShadows=!0,this.hasSlicePlane=!1,this.drivenOpacity=!1,this.usePBR=!1}}export{w as Parameters,_ as PathMaterial};
@@ -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{freeze as t,create as i,ZEROS as o}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{glLayout as s}from"../../support/buffer/glUtil.js";import{newLayout as l}from"../../support/buffer/InterleavedLayout.js";import{isOITColor as a}from"../core/shaderLibrary/ShaderOutput.js";import{PathVertexPositionPassParameters as n}from"../core/shaderLibrary/attributes/PathVertexPosition.glsl.js";import{ReloadableShader as m}from"../core/shaderTechnique/ReloadableShader.js";import{ShaderTechnique as c}from"../core/shaderTechnique/ShaderTechnique.js";import{olidEnabled as p}from"../effects/geometry/olidUtils.js";import{OITPolygonOffset as u,depthTest as f,blending as h}from"../lib/OrderIndependentTransparency.js";import{stencilBaseAllZerosParams as d,stencilWriteMaskOn as b}from"../lib/StencilUtils.js";import{P as g}from"../../../../chunks/Path.glsl.js";import{advancedMRRFactors as j}from"./pbrUtils.js";import{makePipelineState as S,defaultColorWrite as v,defaultDepthWrite as y,frontFaceCullingParams as P}from"../../../webgl/renderState.js";class T extends n{constructor(){super(...arguments),this.ambient=t(.2,.2,.2),this.diffuse=t(.8,.8,.8),this.opacity=1,this.origin=i(),this.modelTransformation=null,this.mrrFactors=j,this.emissiveStrengthFromSymbol=0,this.emissiveSource=1,this.emissiveBaseColor=o}get emissiveStrength(){return this.emissiveStrengthFromSymbol}}let V=class extends c{constructor(e,r){super(e,r,s(x(r))),this.shader=new m(g,()=>import("./Path.glsl.js"))}initializePipeline(e){const{output:r,transparent:t,hasSlicePlane:i,doubleSidedMode:o,hasOccludees:s}=e,l=!a(r);return S({blending:t?h(r):null,culling:i&&!t&&0!==o?P:null,depthTest:f(r),depthWrite:l?y:null,colorWrite:v,stencilWrite:s?b:null,stencilTest:s?d:null,polygonOffset:l?null:u})}};function x(e){const r=l().vec3f("position").vec4f16("profileVertexAndNormal").vec2i16("profileRight",{glNormalized:!0}).vec2i16("profileUp",{glNormalized:!0});return e.hasVVSize&&r.f32("sizeFeatureAttribute"),e.hasVVColor&&r.f32("colorFeatureAttribute"),e.hasVVOpacity&&r.f32("opacityFeatureAttribute"),p()&&r.vec4u8("olidColor"),r.vec3f16("profileAuxData"),r.freeze()}V=e([r("esri.views.3d.webgl-engine.materials.PathTechnique")],V);export{T as PathPassParameters,V as PathTechnique,x as getLayout};
2
+ import{__decorate as e}from"tslib";import{subclass as r}from"../../../../core/accessorSupport/decorators.js";import{freeze as t,create as i,ZEROS as o}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{glLayout as s}from"../../support/buffer/glUtil.js";import{newLayout as l}from"../../support/buffer/InterleavedLayout.js";import{isOITColor as a}from"../core/shaderLibrary/ShaderOutput.js";import{PathVertexPositionPassParameters as n}from"../core/shaderLibrary/attributes/PathVertexPosition.glsl.js";import{ReloadableShader as m}from"../core/shaderTechnique/ReloadableShader.js";import{ShaderTechnique as c}from"../core/shaderTechnique/ShaderTechnique.js";import{olidEnabled as p}from"../effects/geometry/olidUtils.js";import{oitPolygonOffset as u,depthTest as f,blending as h}from"../lib/OrderIndependentTransparency.js";import{stencilBaseAllZerosParams as d,stencilWriteMaskOn as b}from"../lib/StencilUtils.js";import{P as g}from"../../../../chunks/Path.glsl.js";import{advancedMRRFactors as j}from"./pbrUtils.js";import{makePipelineState as S,defaultColorWrite as v,defaultDepthWrite as y,frontFaceCullingParams as P}from"../../../webgl/renderState.js";class T extends n{constructor(){super(...arguments),this.ambient=t(.2,.2,.2),this.diffuse=t(.8,.8,.8),this.opacity=1,this.origin=i(),this.modelTransformation=null,this.mrrFactors=j,this.emissiveStrengthFromSymbol=0,this.emissiveSource=1,this.emissiveBaseColor=o}get emissiveStrength(){return this.emissiveStrengthFromSymbol}}let V=class extends c{constructor(e,r){super(e,r,s(x(r))),this.shader=new m(g,()=>import("./Path.glsl.js"))}initializePipeline(e){const{output:r,transparent:t,hasSlicePlane:i,doubleSidedMode:o,hasOccludees:s}=e,l=!a(r);return S({blending:t?h(r):null,culling:i&&!t&&0!==o?P:null,depthTest:f(r),depthWrite:l?y:null,colorWrite:v,stencilWrite:s?b:null,stencilTest:s?d:null,polygonOffset:u(e)})}};function x(e){const r=l().vec3f("position").vec4f16("profileVertexAndNormal").vec2i16("profileRight",{glNormalized:!0}).vec2i16("profileUp",{glNormalized:!0});return e.hasVVSize&&r.f32("sizeFeatureAttribute"),e.hasVVColor&&r.f32("colorFeatureAttribute"),e.hasVVOpacity&&r.f32("opacityFeatureAttribute"),p()&&r.vec4u8("olidColor"),r.vec3f16("profileAuxData"),r.freeze()}V=e([r("esri.views.3d.webgl-engine.materials.PathTechnique")],V);export{T as PathPassParameters,V as PathTechnique,x as getLayout};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{parameter as t}from"../core/shaderTechnique/ShaderTechniqueConfiguration.js";import{DefaultTechniqueConfiguration as o}from"./DefaultTechniqueConfiguration.js";class i extends o{constructor(e){super(),this.spherical=e,this.pbrMode=0,this.doubleSidedMode=0,this.emissionSource=0,this.receiveShadows=!1,this.receiveAmbientOcclusion=!1,this.hasVVSize=!1,this.hasVVColor=!1,this.hasVVOpacity=!1,this.transparent=!1,this.hasOccludees=!1,this.terrainDepthTest=!1,this.cullAboveTerrain=!1,this.snowCover=!1,this.textureCoordinateType=0,this.hasVVInstancing=!1,this.useCustomDTRExponentForWater=!1,this.useFillLights=!1,this.hasColorTexture=!1,this.hasMetallicRoughnessTexture=!1,this.hasOcclusionTexture=!1,this.hasNormalTexture=!1,this.draped=!1,this.overlayEnabled=!1}get discardInvisibleFragments(){return this.transparent}}e([t({count:7})],i.prototype,"pbrMode",void 0),e([t({count:3})],i.prototype,"doubleSidedMode",void 0),e([t({count:8})],i.prototype,"emissionSource",void 0),e([t()],i.prototype,"receiveShadows",void 0),e([t()],i.prototype,"receiveAmbientOcclusion",void 0),e([t()],i.prototype,"hasVVSize",void 0),e([t()],i.prototype,"hasVVColor",void 0),e([t()],i.prototype,"hasVVOpacity",void 0),e([t()],i.prototype,"transparent",void 0),e([t()],i.prototype,"hasOccludees",void 0),e([t()],i.prototype,"terrainDepthTest",void 0),e([t()],i.prototype,"cullAboveTerrain",void 0),e([t()],i.prototype,"snowCover",void 0);export{i as PathTechniqueConfiguration};
2
+ import{__decorate as e}from"tslib";import{parameter as t}from"../core/shaderTechnique/ShaderTechniqueConfiguration.js";import{TriangleTechniqueConfiguration as o}from"./TriangleTechniqueConfiguration.js";class i extends o{constructor(e){super(),this.spherical=e,this.pbrMode=0,this.doubleSidedMode=0,this.emissionSource=0,this.receiveShadows=!1,this.receiveAmbientOcclusion=!1,this.hasVVSize=!1,this.hasVVColor=!1,this.hasVVOpacity=!1,this.hasOccludees=!1,this.terrainDepthTest=!1,this.cullAboveTerrain=!1,this.snowCover=!1,this.textureCoordinateType=0,this.hasVVInstancing=!1,this.useCustomDTRExponentForWater=!1,this.useFillLights=!1,this.hasColorTexture=!1,this.hasMetallicRoughnessTexture=!1,this.hasOcclusionTexture=!1,this.hasNormalTexture=!1,this.draped=!1,this.overlayEnabled=!1}get discardInvisibleFragments(){return this.transparent}}e([t({count:7})],i.prototype,"pbrMode",void 0),e([t({count:3})],i.prototype,"doubleSidedMode",void 0),e([t({count:8})],i.prototype,"emissionSource",void 0),e([t()],i.prototype,"receiveShadows",void 0),e([t()],i.prototype,"receiveAmbientOcclusion",void 0),e([t()],i.prototype,"hasVVSize",void 0),e([t()],i.prototype,"hasVVColor",void 0),e([t()],i.prototype,"hasVVOpacity",void 0),e([t()],i.prototype,"hasOccludees",void 0),e([t()],i.prototype,"terrainDepthTest",void 0),e([t()],i.prototype,"cullAboveTerrain",void 0),e([t()],i.prototype,"snowCover",void 0);export{i as PathTechniqueConfiguration};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{IDENTITY as e}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{fromValues as t}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{BufferViewVec4f as r,BufferViewUint32 as s,BufferViewMat3f as i,BufferViewVec4u8 as o,BufferViewFloat as n}from"../../../../geometry/support/buffer/BufferView.js";import{isHighlightOrOLID as a,isColor as u,isDepth as l,isColorHighlightOrOLID as c}from"../core/shaderLibrary/ShaderOutput.js";import f from"../lib/GLMaterial.js";import{assert as h}from"../lib/Util.js";import{DefaultBufferWriter as p}from"./DefaultBufferWriter.js";import{TriangleMaterial as m}from"./TriangleMaterial.js";import{VisualVariablePassParameters as d}from"./VisualVariablePassParameters.js";import{writeAttributes as g,writeBufferVec4 as x,writeColor as b,writeVVFeatureAttribute as y}from"./internal/bufferWriterUtils.js";import{getLayout as j,getTextureLayout as v}from"../shaders/PatternLayouts.js";import{PatternTechnique as C}from"../shaders/PatternTechnique.js";import{PatternTechniqueConfiguration as w}from"../shaders/PatternTechniqueConfiguration.js";import{alphaCutoff as B}from"../../../../webscene/support/AlphaCutoff.js";class F extends m{constructor(e){super(e,P),this._configuration=new w,this.supportsEdges=!0,this.transparent=!0,this.produces=new Map([[2,e=>a(e)],[4,e=>u(e)],[5,e=>l(e)],[19,e=>this.parameters.draped&&c(e)]])}updateConfiguration(e){super.updateConfiguration(e),this._configuration.cullFace=this.parameters.cullFace,this._configuration.hasVertexColors=this.parameters.hasVertexColors&&!this.parameters.vvColor,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.style=this.parameters.style,this._configuration.draped=this.parameters.draped,this._configuration.terrainDepthTest=e.terrainDepthTest&&u(e.output),this._configuration.cullAboveTerrain=e.cullAboveTerrain,this._configuration.hasVVColor=!!this.parameters.vvColor,this._configuration.emissionSource=this.hasEmissions?1:0}get visible(){return this.parameters.color[3]>=B}get hasEmissions(){return this.parameters.emissiveStrength>0}createGLMaterial(e){return new S(e)}createBufferWriter(){return new T(j(this.parameters),v(this.parameters))}}class S extends f{beginSlot(e){return this.getTechnique(C,e)}}class T extends p{constructor(e,t){super(e),this.textureBufferLayout=t}elementCountTextureBuffer(e){return e.get("boundingRect")?.indices.length??0}write(e,t,i,o,n,a,u){const l=g(i,o,this.layout,e,t,n,a);for(const s of this.layout.fields.keys()){const e=i.get(s),t=e?.indices;if(e&&t)switch(s){case"uvMapSpace":{h(4===e.size);const t=n.getField(s,r);t&&x(e,t,a);break}}}const{textureBufferLayout:c}=this;if(null==c)return l;h(null!=u,"Using a texture layout, but the texture range for this instance was not provided");const f=u.from;h(1===u.numElements,"Provided more than one texture buffer element per polygon");const p=n.getField("textureElementIndex",s);h(null!=p,"Missing component index field");const m=i.get("position")?.indices.length??0;for(let r=0;r<m;++r)p.set(a+r,f);return l}writeTextureBuffer(t,r,s,a,u){const{textureBufferLayout:l}=this;if(null==l)return;const c=a.getField("boundingRect",i),f=s.get("boundingRect");c&&f&&(h(9===f.size),_(f,t??e,c,u));const p=a.getField("color",o),m=s.get("color");p&&m&&(h(3===m.size||4===m.size),b(m,m.size,p,u));const d=a.getField("colorFeatureAttribute",n),g=s.get("colorFeatureAttribute");d&&g&&(h(1===g.size),y(g,d,u))}}function _(e,t,r,s){const{data:i,indices:o}=e,n=t,a=r.typedBuffer,u=r.typedBufferStride,l=o.length;s*=u;for(let c=0;c<l;++c){const e=9*o[c],t=i[e],r=i[e+1],l=i[e+2];a[s]=n[0]*t+n[4]*r+n[8]*l+n[12],a[s+1]=n[1]*t+n[5]*r+n[9]*l+n[13],a[s+2]=n[2]*t+n[6]*r+n[10]*l+n[14];for(let o=3;o<9;++o)a[s+o]=i[e+o];s+=u}}class P extends d{constructor(){super(...arguments),this.color=t(1,1,1,1),this.emissiveStrength=0,this.hasVertexColors=!1,this.polygonOffset=!1,this.hasSlicePlane=!1,this.cullFace=0,this.hasOccludees=!1,this.style=2,this.draped=!0,this.useIndexing=!0}}export{P as Parameters,F as PatternMaterial};
2
+ import{IDENTITY as e}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{fromValues as t}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{BufferViewVec4f as r,BufferViewUint32 as s,BufferViewMat3f as i,BufferViewVec4u8 as o,BufferViewFloat as n}from"../../../../geometry/support/buffer/BufferView.js";import{isHighlightOrOLID as a,isColor as u,isDepth as l,isColorHighlightOrOLID as c}from"../core/shaderLibrary/ShaderOutput.js";import f from"../lib/GLMaterial.js";import{assert as h}from"../lib/Util.js";import{DefaultBufferWriter as p}from"./DefaultBufferWriter.js";import{TriangleMaterial as m}from"./TriangleMaterial.js";import{VisualVariablePassParameters as d}from"./VisualVariablePassParameters.js";import{writeAttributes as g,writeBufferVec4 as x,writeColor as b,writeVVFeatureAttribute as y}from"./internal/bufferWriterUtils.js";import{getLayout as j,getTextureLayout as v}from"../shaders/PatternLayouts.js";import{PatternTechnique as C}from"../shaders/PatternTechnique.js";import{PatternTechniqueConfiguration as w}from"../shaders/PatternTechniqueConfiguration.js";import{alphaCutoff as B}from"../../../../webscene/support/AlphaCutoff.js";class F extends m{constructor(e){super(e,P),this._configuration=new w,this.supportsEdges=!0,this.transparent=!0,this.produces=new Map([[2,e=>a(e)],[4,e=>u(e)],[5,e=>l(e)],[19,e=>this.parameters.draped&&c(e)]])}updateConfiguration(e){super.updateConfiguration(e),this._configuration.cullFace=this.parameters.cullFace,this._configuration.hasVertexColors=this.parameters.hasVertexColors&&!this.parameters.vvColor,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.style=this.parameters.style,this._configuration.draped=this.parameters.draped,this._configuration.terrainDepthTest=e.terrainDepthTest&&u(e.output),this._configuration.cullAboveTerrain=e.cullAboveTerrain,this._configuration.hasVVColor=!!this.parameters.vvColor,this._configuration.emissionSource=this.hasEmissions?1:0}get visible(){return this.parameters.color[3]>=B}get hasEmissions(){return this.parameters.emissiveStrength>0}createGLMaterial(e){return new S(e)}createBufferWriter(){return new T(j(this.parameters),v(this.parameters))}}class S extends f{beginSlot(e){return this.getTechnique(C,e)}}class T extends p{constructor(e,t){super(e),this.textureBufferLayout=t}elementCountTextureBuffer(e){return e.get("boundingRect")?.indices.length??0}write(e,t,i,o,n,a,u){const l=g(i,o,this.layout,e,t,n,a);for(const s of this.layout.fields.keys()){const e=i.get(s),t=e?.indices;if(e&&t)switch(s){case"uvMapSpace":{h(4===e.size);const t=n.getField(s,r);t&&x(e,t,a);break}}}const{textureBufferLayout:c}=this;if(null==c)return l;h(null!=u,"Using a texture layout, but the texture range for this instance was not provided");const f=u.from;h(1===u.numElements,"Provided more than one texture buffer element per polygon");const p=n.getField("textureElementIndex",s);h(null!=p,"Missing component index field");const m=i.get("position")?.indices.length??0;for(let r=0;r<m;++r)p.set(a+r,f);return l}writeTextureBuffer(t,r,s,a,u){const{textureBufferLayout:l}=this;if(null==l)return;const c=a.getField("boundingRect",i),f=s.get("boundingRect");c&&f&&(h(9===f.size),_(f,t??e,c,u));const p=a.getField("color",o),m=s.get("color");p&&m&&(h(3===m.size||4===m.size),b(m,m.size,p,u));const d=a.getField("colorFeatureAttribute",n),g=s.get("colorFeatureAttribute");d&&g&&(h(1===g.size),y(g,d,u))}}function _(e,t,r,s){const{data:i,indices:o}=e,n=t,a=r.typedBuffer,u=r.typedBufferStride,l=o.length;s*=u;for(let c=0;c<l;++c){const e=9*o[c],t=i[e],r=i[e+1],l=i[e+2];a[s]=n[0]*t+n[4]*r+n[8]*l+n[12],a[s+1]=n[1]*t+n[5]*r+n[9]*l+n[13],a[s+2]=n[2]*t+n[6]*r+n[10]*l+n[14];for(let o=3;o<9;++o)a[s+o]=i[e+o];s+=u}}class P extends d{constructor(){super(...arguments),this.color=t(1,1,1,1),this.emissiveStrength=0,this.hasVertexColors=!1,this.polygonOffset=0,this.hasSlicePlane=!1,this.cullFace=0,this.hasOccludees=!1,this.style=2,this.draped=!0,this.useIndexing=!0}}export{P as Parameters,F as PatternMaterial};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
+ const t={factor:-1,units:-1},n={factor:1,units:1},r={factor:1,units:2},o={factor:0,units:-4},a={factor:-1,units:-2},c=new Array;c[0]=null,c[1]=n,c[2]=t,c[3]=o;export{a as OITPolygonOffset,c as PolygonOffsetSettings,n as behindPolygonOffset,o as hudPolygonOffset,r as i3sHolePolygonOffset,t as inFrontPolygonOffset};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import t from"../../../../core/Logger.js";import{clamp as e}from"../../../../core/mathUtils.js";import{createRenderScreenPointArray3 as i}from"../../../../core/screenUtils.js";import{secondsFromMilliseconds as r,Seconds as s}from"../../../../core/time.js";import{copy as a}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{set as n,subtract as o,dot as l,scale as h,add as p,copy as m,length as c,distance as u,transformMat4 as f}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as d}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{set as g}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{ONES as b,create as _}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{makeFloat16Array as S}from"../../../../geometry/support/float16.js";import{distance2 as v,fromPoints as P,closestLineSegmentPoint as w,create as j}from"../../../../geometry/support/lineSegment.js";import{fromPoints as y,signedDistance as E,getNormal as T,create as z}from"../../../../geometry/support/plane.js";import{isHighlightOrOLID as A,isColor as C,isDepth as x,isColorHighlightOLIDOrDepth as L,is2DGeometryOutput as M}from"../core/shaderLibrary/ShaderOutput.js";import{olidEnabled as O}from"../effects/geometry/olidUtils.js";import V from"../lib/GLMaterial.js";import{Material as R}from"../lib/Material.js";import{isTranslationMatrix as F}from"../lib/Util.js";import{isImagePattern as N}from"./lineStippleUtils.js";import{VisualVariablePassParameters as k}from"./VisualVariablePassParameters.js";import{writeDeltaF16Vector as U}from"./internal/bufferWriterUtils.js";import{r as D}from"../../../../chunks/RibbonLine.glsl.js";import{getLayout as B,RibbonLineTechnique as W}from"../shaders/RibbonLineTechnique.js";import{RibbonLineTechniqueConfiguration as J}from"../shaders/RibbonLineTechniqueConfiguration.js";import{alphaCutoff as I}from"../../../../webscene/support/AlphaCutoff.js";class Y extends R{constructor(t,e){super(t,X),this.produces=new Map([[2,t=>A(t)||C(t)&&8===this.parameters.renderOccluded],[3,t=>x(t)],[11,t=>L(t)&&8===this.parameters.renderOccluded],[12,t=>L(t)&&8===this.parameters.renderOccluded],[4,t=>C(t)&&this.parameters.writeDepth&&8!==this.parameters.renderOccluded],[9,t=>C(t)&&!this.parameters.writeDepth&&8!==this.parameters.renderOccluded],[19,t=>M(t)]]),this._configuration=new J(e)}updateConfiguration(t){super.updateConfiguration(t);const e=19===t.slot,i=null!=this.parameters.stipplePattern&&null!=this.parameters.stippleTexture&&10!==t.output,r=i&&e&&this.parameters.isImagePattern();this._configuration.draped=e,this._configuration.stippleEnabled=i,this._configuration.stippleOffColorEnabled=i&&null!=this.parameters.stippleOffColor,this._configuration.stipplePreferContinuous=i&&this.parameters.stipplePreferContinuous,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.roundJoins="round"===this.parameters.join,this._configuration.capType=this.parameters.cap,this._configuration.applyMarkerOffset=null!=this.parameters.markerParameters&&Q(this.parameters.markerParameters),this._configuration.hasPolygonOffset=this.parameters.hasPolygonOffset,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.hasVVSize=this.parameters.hasVVSize,this._configuration.hasVVColor=this.parameters.hasVVColor,this._configuration.hasVVOpacity=this.parameters.hasVVOpacity,this._configuration.innerColorEnabled=this.parameters.innerWidth>0&&null!=this.parameters.innerColor,this._configuration.falloffEnabled=this.parameters.falloff>0,this._configuration.hasOccludees=t.hasOccludees,this._configuration.occluder=8===this.parameters.renderOccluded,this._configuration.terrainDepthTest=t.terrainDepthTest&&C(t.output),this._configuration.cullAboveTerrain=t.cullAboveTerrain,this._configuration.wireframe=this.parameters.wireframe,this._configuration.animation=this.parameters.animation,this._configuration.emissionSource=this.hasEmissions?1:0,this._configuration.hasScreenSizePerspective=!!this.parameters.screenSizePerspective&&!r,this._configuration.worldSizedImagePattern=r}get visible(){return this.parameters.color[3]>=I||null!=this.parameters.stipplePattern&&(this.parameters.stippleOffColor?.[3]??0)>I}setParameters(t,e){t.animation=this.parameters.animation,super.setParameters(t,e)}intersectDraped({attributes:t,screenToWorldRatio:i},r,s,a,n){if(!r.options.selectionMode)return;const o=t.get("size");let l=this.parameters.width;if(this.parameters.vvSize){const i=t.get("sizeFeatureAttribute").data[0];Number.isNaN(i)?l*=this.parameters.vvSize.fallback[0]:l*=e(this.parameters.vvSize.offset[0]+i*this.parameters.vvSize.factor[0],this.parameters.vvSize.minSize[0],this.parameters.vvSize.maxSize[0])}else o&&(l*=o.data[0]);const h=s[0],p=s[1],m=(l/2+4)*i;let c=Number.MAX_VALUE,u=0;const f=t.get("position").data,d=K(this.parameters,t)?f.length-2:f.length-5;for(let g=0;g<d;g+=3){const t=f[g],i=f[g+1],r=(g+3)%f.length,s=h-t,a=p-i,n=f[r]-t,o=f[r+1]-i,l=e((n*s+o*a)/(n*n+o*o),0,1),m=n*l-s,d=o*l-a,b=m*m+d*d;b<c&&(c=b,u=g/3)}c<m*m&&a(n.distance,n.normal,u)}intersect(i,r,s,f,d,g){const{options:b,camera:_,rayBegin:S,rayEnd:j}=s;if(!b.selectionMode||!i.visible||!_)return;if(!F(r))return void t.getLogger("esri.views.3d.webgl-engine.materials.RibbonLineMaterial").error("intersection assumes a translation-only matrix");const z=i.attributes,A=z.get("position").data;let C=this.parameters.width;if(this.parameters.vvSize){const t=z.get("sizeFeatureAttribute").data[0];Number.isNaN(t)||(C*=e(this.parameters.vvSize.offset[0]+t*this.parameters.vvSize.factor[0],this.parameters.vvSize.minSize[0],this.parameters.vvSize.maxSize[0]))}else z.has("size")&&(C*=z.get("size").data[0]);const x=it;a(x,s.point);const L=C*_.pixelRatio/2+4*_.pixelRatio;n(ut[0],x[0]-L,x[1]+L,0),n(ut[1],x[0]+L,x[1]+L,0),n(ut[2],x[0]+L,x[1]-L,0),n(ut[3],x[0]-L,x[1]-L,0);for(let t=0;t<4;t++)if(!_.unprojectFromRenderScreen(ut[t],ft[t]))return;y(_.eye,ft[0],ft[1],dt),y(_.eye,ft[1],ft[2],gt),y(_.eye,ft[2],ft[3],bt),y(_.eye,ft[3],ft[0],_t);let M=Number.MAX_VALUE,O=0;const V=K(this.parameters,z)?A.length-2:A.length-5;for(let t=0;t<V;t+=3){Z[0]=A[t]+r[12],Z[1]=A[t+1]+r[13],Z[2]=A[t+2]+r[14];const e=(t+3)%A.length;if($[0]=A[e]+r[12],$[1]=A[e+1]+r[13],$[2]=A[e+2]+r[14],E(dt,Z)<0&&E(dt,$)<0||E(gt,Z)<0&&E(gt,$)<0||E(bt,Z)<0&&E(bt,$)<0||E(_t,Z)<0&&E(_t,$)<0)continue;const i=_.projectToRenderScreen(Z,rt),s=_.projectToRenderScreen($,st);if(null==i||null==s)continue;if(i[2]<0&&s[2]>0){o(tt,Z,$);const t=_.frustum,e=-E(t[4],Z)/l(tt,T(t[4]));if(h(tt,tt,e),p(Z,Z,tt),!_.projectToRenderScreen(Z,i))continue}else if(i[2]>0&&s[2]<0){o(tt,$,Z);const t=_.frustum,e=-E(t[4],$)/l(tt,T(t[4]));if(h(tt,tt,e),p($,$,tt),!_.projectToRenderScreen($,s))continue}else if(i[2]<0&&s[2]<0)continue;i[2]=0,s[2]=0;const a=v(P(i,s,ot),x);a<M&&(M=a,m(at,Z),m(nt,$),O=t/3)}if(M<L*L){let t=Number.MAX_VALUE;if(w(P(at,nt,ot),P(S,j,lt),et)){o(et,et,S);const e=c(et);h(et,et,1/e),t=e/u(S,j)}g(t,et,O)}}get hasEmissions(){return this.parameters.emissiveStrength>0}createBufferWriter(){return new G(B(this.parameters),this.parameters)}createGLMaterial(t){return new q(t)}validateParameters(t){"miter"!==t.join&&(t.miterLimit=0),null!=t.markerParameters&&(t.markerScale=t.markerParameters.width/t.width)}update(t){return!!this.parameters.hasAnimation&&(this.setParameters({timeElapsed:r(t.time)},!1),0!==t.dt)}}class q extends V{constructor(){super(...arguments),this._stipplePattern=null}dispose(){super.dispose(),this._stippleTextures?.release(this._stipplePattern),this._stipplePattern=null}beginSlot(t){const{stipplePattern:e}=this._material.parameters;return this._stipplePattern!==e&&(this._material.setParameters({stippleTexture:this._stippleTextures.swap(e,this._stipplePattern)}),this._stipplePattern=e),this.getTechnique(W,t)}}class X extends k{constructor(){super(...arguments),this._width=0,this.color=b,this.join="miter",this.cap=0,this.miterLimit=5,this.writeDepth=!0,this.hasPolygonOffset=!1,this.stippleTexture=null,this.stipplePreferContinuous=!0,this.markerParameters=null,this.markerScale=1,this.hasSlicePlane=!1,this.vvFastUpdate=!1,this.isClosed=!1,this.falloff=0,this.innerWidth=0,this.wireframe=!1,this.timeElapsed=s(0),this.animation=0,this.animationSpeed=1,this.trailLength=1,this.startTime=s(0),this.endTime=s(1/0),this.emissiveStrength=0}get width(){return this.isImagePattern()?this.stipplePattern.width:this._width}set width(t){this._width=t}get transparent(){return this.color[3]<1||this.hasAnimation||null!=this.stipplePattern&&(this.stippleOffColor?.[3]??0)<1}get hasAnimation(){return 0!==this.animation}isImagePattern(){return N(this.stipplePattern)&&null!=this.stippleTexture}}class G{constructor(t,e){this.layout=t,this._parameters=e;const i=e.stipplePattern?1:0;switch(this._parameters.join){case"miter":case"bevel":this.numJoinSubdivisions=i;break;case"round":this.numJoinSubdivisions=D+i}}_isClosed(t){return K(this._parameters,t)}allocate(t){return this.layout.createBuffer(t)}elementCount(t){const e=2,i=t.get("position").indices.length/2+1,r=this._isClosed(t);let s=r?2:2*e;return s+=((r?i:i-1)-(r?0:1))*(2*this.numJoinSubdivisions+4),s+=2,this._parameters.wireframe&&(s=2+4*(s-2)),s}write(t,e,i,r,s,a){const o=this.layout,l=i.get("position"),h=l.indices,p=l.data.length/3,c=i.get("distanceToStart")?.data;h&&h.length!==2*(p-1)&&console.warn("RibbonLineMaterial does not support indices");const d=o.fields.has("sizeFeatureAttribute");let b=1,_=null;if(d){const t=i.get("sizeFeatureAttribute");1===t.data.length?b=t.data[0]:_=t.data}else b=i.get("size")?.data[0]??1;let v=[1,1,1,1],P=0,w=null;const j=o.fields.has("colorFeatureAttribute");if(j){const t=i.get("colorFeatureAttribute");1===t.data.length?P=t.data[0]:w=t.data}else v=i.get("color")?.data??v;const y=i.get("timeStamps")?.data,E=y&&o.fields.has("timeStamps"),T=o.fields.has("opacityFeatureAttribute");let z=0,A=null;if(T){const t=i.get("opacityFeatureAttribute");1===t.data.length?z=t.data[0]:A=t.data}const C=new Float32Array(s.buffer),x=S(s.buffer),L=new Uint8Array(s.buffer),M=o.stride/4;let V=a*M;const R=V;let F=0;const N=c?(t,e,i)=>F=c[i]:(t,e,i)=>F+=u(t,e),k=C.BYTES_PER_ELEMENT/x.BYTES_PER_ELEMENT,D=4/k,B=O(),W=(t,e,i,s,a,n,o,l)=>{C[V++]=e[0],C[V++]=e[1],C[V++]=e[2],U(t,e,x,V*k),V+=D,U(i,e,x,V*k),V+=D,C[V++]=l;let h=V*k;if(x[h++]=a,x[h++]=n,V=Math.ceil(h/k),j)C[V]=w?.[o]??P;else{const t=Math.min(4*o,v.length-4),e=4*V;L[e]=255*v[t],L[e+1]=255*v[t+1],L[e+2]=255*v[t+2],L[e+3]=255*v[t+3]}if(V++,C[V++]=_?.[o]??b,T&&(C[V++]=A?.[o]??z),B){let t=4*V;r?(L[t++]=r[0],L[t++]=r[1],L[t++]=r[2],L[t++]=r[3]):(L[t++]=0,L[t++]=0,L[t++]=0,L[t++]=0),V=Math.ceil(.25*t)}E&&(h=V*k,x[h++]=s[0],x[h++]=s[1],x[h++]=s[2],x[h++]=s[3],V=Math.ceil(h/k))};V+=M,n(pt,l.data[0],l.data[1],l.data[2]),E&&g(ct,y[0],y[1],y[2],y[3]),t&&f(pt,pt,t);const J=this._isClosed(i);if(J){const e=l.data.length-3;n(ht,l.data[e],l.data[e+1],l.data[e+2]),t&&f(ht,ht,t)}else n(mt,l.data[3],l.data[4],l.data[5]),t&&f(mt,mt,t),W(pt,pt,mt,ct,1,-4,0,0),W(pt,pt,mt,ct,1,4,0,0),m(ht,pt),m(pt,mt),E&&g(ct,y[4],y[5],y[6],y[7]);const I=J?0:1,Y=J?p:p-1;for(let u=I;u<Y;u++){const e=(u+1)%p*3;n(mt,l.data[e],l.data[e+1],l.data[e+2]),t&&f(mt,mt,t),N(ht,pt,u),W(ht,pt,mt,ct,0,-1,u,F),W(ht,pt,mt,ct,0,1,u,F);const i=this.numJoinSubdivisions;for(let t=0;t<i;++t){const e=(t+1)/(i+1);W(ht,pt,mt,ct,e,-1,u,F),W(ht,pt,mt,ct,e,1,u,F)}if(W(ht,pt,mt,ct,1,-2,u,F),W(ht,pt,mt,ct,1,2,u,F),m(ht,pt),m(pt,mt),E){const t=(u+1)%p*4;g(ct,y[t],y[t+1],y[t+2],y[t+3])}}J?(n(mt,l.data[3],l.data[4],l.data[5]),t&&f(mt,mt,t),F=N(ht,pt,Y),W(ht,pt,mt,ct,0,-1,I,F),W(ht,pt,mt,ct,0,1,I,F)):(F=N(ht,pt,Y),W(ht,pt,pt,ct,0,-5,Y,F),W(ht,pt,pt,ct,0,5,Y,F)),H(C,R+M,C,R,M);return V=H(C,V-M,C,V,M),this._parameters.wireframe&&this._addWireframeVertices(s,R,V,M),null}_addWireframeVertices(t,e,i,r){const s=new Float32Array(t.buffer,i*Float32Array.BYTES_PER_ELEMENT),a=new Float32Array(t.buffer,e*Float32Array.BYTES_PER_ELEMENT,i-e);let n=0;const o=t=>n=H(a,t,s,n,r);for(let l=0;l<a.length-1;l+=2*r)o(l),o(l+2*r),o(l+1*r),o(l+2*r),o(l+1*r),o(l+3*r)}}function H(t,e,i,r,s){for(let a=0;a<s;a++)i[r++]=t[e++];return r}function K(t,e){if(!t.isClosed)return!1;return e.get("position").indices.length>2}function Q(t){return 1===t.anchor&&t.hideOnShortSegments&&"begin-end"===t.placement&&t.worldSpace}const Z=d(),$=d(),tt=d(),et=d(),it=d(),rt=i(),st=i(),at=d(),nt=d(),ot=j(),lt=j(),ht=d(),pt=d(),mt=d(),ct=_(),ut=[i(),i(),i(),i()],ft=[d(),d(),d(),d()],dt=z(),gt=z(),bt=z(),_t=z();export{X as Parameters,Y as RibbonLineMaterial};
2
+ import t from"../../../../core/Logger.js";import{clamp as e}from"../../../../core/mathUtils.js";import{createRenderScreenPointArray3 as i}from"../../../../core/screenUtils.js";import{secondsFromMilliseconds as r,Seconds as s}from"../../../../core/time.js";import{copy as a}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{set as n,subtract as o,dot as l,scale as h,add as p,copy as m,length as c,distance as u,transformMat4 as f}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as d}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{set as g}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{ONES as b,create as _}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{makeFloat16Array as S}from"../../../../geometry/support/float16.js";import{distance2 as v,fromPoints as P,closestLineSegmentPoint as w,create as j}from"../../../../geometry/support/lineSegment.js";import{fromPoints as y,signedDistance as E,getNormal as T,create as z}from"../../../../geometry/support/plane.js";import{isHighlightOrOLID as A,isColor as C,isDepth as x,isColorHighlightOLIDOrDepth as L,is2DGeometryOutput as M}from"../core/shaderLibrary/ShaderOutput.js";import{olidEnabled as O}from"../effects/geometry/olidUtils.js";import V from"../lib/GLMaterial.js";import{Material as R}from"../lib/Material.js";import{isTranslationMatrix as F}from"../lib/Util.js";import{isImagePattern as N}from"./lineStippleUtils.js";import{VisualVariablePassParameters as k}from"./VisualVariablePassParameters.js";import{writeDeltaF16Vector as U}from"./internal/bufferWriterUtils.js";import{r as D}from"../../../../chunks/RibbonLine.glsl.js";import{getLayout as B,RibbonLineTechnique as W}from"../shaders/RibbonLineTechnique.js";import{RibbonLineTechniqueConfiguration as J}from"../shaders/RibbonLineTechniqueConfiguration.js";import{alphaCutoff as I}from"../../../../webscene/support/AlphaCutoff.js";class Y extends R{constructor(t,e){super(t,X),this.produces=new Map([[2,t=>A(t)||C(t)&&8===this.parameters.renderOccluded],[3,t=>x(t)],[11,t=>L(t)&&8===this.parameters.renderOccluded],[12,t=>L(t)&&8===this.parameters.renderOccluded],[4,t=>C(t)&&this.parameters.writeDepth&&8!==this.parameters.renderOccluded],[9,t=>C(t)&&!this.parameters.writeDepth&&8!==this.parameters.renderOccluded],[19,t=>M(t)]]),this._configuration=new J(e)}updateConfiguration(t){super.updateConfiguration(t);const e=19===t.slot,i=null!=this.parameters.stipplePattern&&null!=this.parameters.stippleTexture&&10!==t.output,r=i&&e&&this.parameters.isImagePattern();this._configuration.draped=e,this._configuration.polygonOffset=this.parameters.polygonOffset,this._configuration.stippleEnabled=i,this._configuration.stippleOffColorEnabled=i&&null!=this.parameters.stippleOffColor,this._configuration.stipplePreferContinuous=i&&this.parameters.stipplePreferContinuous,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.roundJoins="round"===this.parameters.join,this._configuration.capType=this.parameters.cap,this._configuration.applyMarkerOffset=null!=this.parameters.markerParameters&&Q(this.parameters.markerParameters),this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.hasVVSize=this.parameters.hasVVSize,this._configuration.hasVVColor=this.parameters.hasVVColor,this._configuration.hasVVOpacity=this.parameters.hasVVOpacity,this._configuration.innerColorEnabled=this.parameters.innerWidth>0&&null!=this.parameters.innerColor,this._configuration.falloffEnabled=this.parameters.falloff>0,this._configuration.hasOccludees=t.hasOccludees,this._configuration.occluder=8===this.parameters.renderOccluded,this._configuration.terrainDepthTest=t.terrainDepthTest&&C(t.output),this._configuration.cullAboveTerrain=t.cullAboveTerrain,this._configuration.wireframe=this.parameters.wireframe,this._configuration.animation=this.parameters.animation,this._configuration.emissionSource=this.hasEmissions?1:0,this._configuration.hasScreenSizePerspective=!!this.parameters.screenSizePerspective&&!r,this._configuration.worldSizedImagePattern=r}get visible(){return this.parameters.color[3]>=I||null!=this.parameters.stipplePattern&&(this.parameters.stippleOffColor?.[3]??0)>I}setParameters(t,e){t.animation=this.parameters.animation,super.setParameters(t,e)}intersectDraped({attributes:t,screenToWorldRatio:i},r,s,a,n){if(!r.options.selectionMode)return;const o=t.get("size");let l=this.parameters.width;if(this.parameters.vvSize){const i=t.get("sizeFeatureAttribute").data[0];Number.isNaN(i)?l*=this.parameters.vvSize.fallback[0]:l*=e(this.parameters.vvSize.offset[0]+i*this.parameters.vvSize.factor[0],this.parameters.vvSize.minSize[0],this.parameters.vvSize.maxSize[0])}else o&&(l*=o.data[0]);const h=s[0],p=s[1],m=(l/2+4)*i;let c=Number.MAX_VALUE,u=0;const f=t.get("position").data,d=K(this.parameters,t)?f.length-2:f.length-5;for(let g=0;g<d;g+=3){const t=f[g],i=f[g+1],r=(g+3)%f.length,s=h-t,a=p-i,n=f[r]-t,o=f[r+1]-i,l=e((n*s+o*a)/(n*n+o*o),0,1),m=n*l-s,d=o*l-a,b=m*m+d*d;b<c&&(c=b,u=g/3)}c<m*m&&a(n.distance,n.normal,u)}intersect(i,r,s,f,d,g){const{options:b,camera:_,rayBegin:S,rayEnd:j}=s;if(!b.selectionMode||!i.visible||!_)return;if(!F(r))return void t.getLogger("esri.views.3d.webgl-engine.materials.RibbonLineMaterial").error("intersection assumes a translation-only matrix");const z=i.attributes,A=z.get("position").data;let C=this.parameters.width;if(this.parameters.vvSize){const t=z.get("sizeFeatureAttribute").data[0];Number.isNaN(t)||(C*=e(this.parameters.vvSize.offset[0]+t*this.parameters.vvSize.factor[0],this.parameters.vvSize.minSize[0],this.parameters.vvSize.maxSize[0]))}else z.has("size")&&(C*=z.get("size").data[0]);const x=it;a(x,s.point);const L=C*_.pixelRatio/2+4*_.pixelRatio;n(ut[0],x[0]-L,x[1]+L,0),n(ut[1],x[0]+L,x[1]+L,0),n(ut[2],x[0]+L,x[1]-L,0),n(ut[3],x[0]-L,x[1]-L,0);for(let t=0;t<4;t++)if(!_.unprojectFromRenderScreen(ut[t],ft[t]))return;y(_.eye,ft[0],ft[1],dt),y(_.eye,ft[1],ft[2],gt),y(_.eye,ft[2],ft[3],bt),y(_.eye,ft[3],ft[0],_t);let M=Number.MAX_VALUE,O=0;const V=K(this.parameters,z)?A.length-2:A.length-5;for(let t=0;t<V;t+=3){Z[0]=A[t]+r[12],Z[1]=A[t+1]+r[13],Z[2]=A[t+2]+r[14];const e=(t+3)%A.length;if($[0]=A[e]+r[12],$[1]=A[e+1]+r[13],$[2]=A[e+2]+r[14],E(dt,Z)<0&&E(dt,$)<0||E(gt,Z)<0&&E(gt,$)<0||E(bt,Z)<0&&E(bt,$)<0||E(_t,Z)<0&&E(_t,$)<0)continue;const i=_.projectToRenderScreen(Z,rt),s=_.projectToRenderScreen($,st);if(null==i||null==s)continue;if(i[2]<0&&s[2]>0){o(tt,Z,$);const t=_.frustum,e=-E(t[4],Z)/l(tt,T(t[4]));if(h(tt,tt,e),p(Z,Z,tt),!_.projectToRenderScreen(Z,i))continue}else if(i[2]>0&&s[2]<0){o(tt,$,Z);const t=_.frustum,e=-E(t[4],$)/l(tt,T(t[4]));if(h(tt,tt,e),p($,$,tt),!_.projectToRenderScreen($,s))continue}else if(i[2]<0&&s[2]<0)continue;i[2]=0,s[2]=0;const a=v(P(i,s,ot),x);a<M&&(M=a,m(at,Z),m(nt,$),O=t/3)}if(M<L*L){let t=Number.MAX_VALUE;if(w(P(at,nt,ot),P(S,j,lt),et)){o(et,et,S);const e=c(et);h(et,et,1/e),t=e/u(S,j)}g(t,et,O)}}get hasEmissions(){return this.parameters.emissiveStrength>0}createBufferWriter(){return new G(B(this.parameters),this.parameters)}createGLMaterial(t){return new q(t)}validateParameters(t){"miter"!==t.join&&(t.miterLimit=0),null!=t.markerParameters&&(t.markerScale=t.markerParameters.width/t.width)}update(t){return!!this.parameters.hasAnimation&&(this.setParameters({timeElapsed:r(t.time)},!1),0!==t.dt)}}class q extends V{constructor(){super(...arguments),this._stipplePattern=null}dispose(){super.dispose(),this._stippleTextures?.release(this._stipplePattern),this._stipplePattern=null}beginSlot(t){const{stipplePattern:e}=this._material.parameters;return this._stipplePattern!==e&&(this._material.setParameters({stippleTexture:this._stippleTextures.swap(e,this._stipplePattern)}),this._stipplePattern=e),this.getTechnique(W,t)}}class X extends k{constructor(){super(...arguments),this._width=0,this.color=b,this.join="miter",this.cap=0,this.miterLimit=5,this.writeDepth=!0,this.polygonOffset=0,this.stippleTexture=null,this.stipplePreferContinuous=!0,this.markerParameters=null,this.markerScale=1,this.hasSlicePlane=!1,this.vvFastUpdate=!1,this.isClosed=!1,this.falloff=0,this.innerWidth=0,this.wireframe=!1,this.timeElapsed=s(0),this.animation=0,this.animationSpeed=1,this.trailLength=1,this.startTime=s(0),this.endTime=s(1/0),this.emissiveStrength=0}get width(){return this.isImagePattern()?this.stipplePattern.width:this._width}set width(t){this._width=t}get transparent(){return this.color[3]<1||this.hasAnimation||null!=this.stipplePattern&&(this.stippleOffColor?.[3]??0)<1}get hasAnimation(){return 0!==this.animation}isImagePattern(){return N(this.stipplePattern)&&null!=this.stippleTexture}}class G{constructor(t,e){this.layout=t,this._parameters=e;const i=e.stipplePattern?1:0;switch(this._parameters.join){case"miter":case"bevel":this.numJoinSubdivisions=i;break;case"round":this.numJoinSubdivisions=D+i}}_isClosed(t){return K(this._parameters,t)}allocate(t){return this.layout.createBuffer(t)}elementCount(t){const e=2,i=t.get("position").indices.length/2+1,r=this._isClosed(t);let s=r?2:2*e;return s+=((r?i:i-1)-(r?0:1))*(2*this.numJoinSubdivisions+4),s+=2,this._parameters.wireframe&&(s=2+4*(s-2)),s}write(t,e,i,r,s,a){const o=this.layout,l=i.get("position"),h=l.indices,p=l.data.length/3,c=i.get("distanceToStart")?.data;h&&h.length!==2*(p-1)&&console.warn("RibbonLineMaterial does not support indices");const d=o.fields.has("sizeFeatureAttribute");let b=1,_=null;if(d){const t=i.get("sizeFeatureAttribute");1===t.data.length?b=t.data[0]:_=t.data}else b=i.get("size")?.data[0]??1;let v=[1,1,1,1],P=0,w=null;const j=o.fields.has("colorFeatureAttribute");if(j){const t=i.get("colorFeatureAttribute");1===t.data.length?P=t.data[0]:w=t.data}else v=i.get("color")?.data??v;const y=i.get("timeStamps")?.data,E=y&&o.fields.has("timeStamps"),T=o.fields.has("opacityFeatureAttribute");let z=0,A=null;if(T){const t=i.get("opacityFeatureAttribute");1===t.data.length?z=t.data[0]:A=t.data}const C=new Float32Array(s.buffer),x=S(s.buffer),L=new Uint8Array(s.buffer),M=o.stride/4;let V=a*M;const R=V;let F=0;const N=c?(t,e,i)=>F=c[i]:(t,e,i)=>F+=u(t,e),k=C.BYTES_PER_ELEMENT/x.BYTES_PER_ELEMENT,D=4/k,B=O(),W=(t,e,i,s,a,n,o,l)=>{C[V++]=e[0],C[V++]=e[1],C[V++]=e[2],U(t,e,x,V*k),V+=D,U(i,e,x,V*k),V+=D,C[V++]=l;let h=V*k;if(x[h++]=a,x[h++]=n,V=Math.ceil(h/k),j)C[V]=w?.[o]??P;else{const t=Math.min(4*o,v.length-4),e=4*V;L[e]=255*v[t],L[e+1]=255*v[t+1],L[e+2]=255*v[t+2],L[e+3]=255*v[t+3]}if(V++,C[V++]=_?.[o]??b,T&&(C[V++]=A?.[o]??z),B){let t=4*V;r?(L[t++]=r[0],L[t++]=r[1],L[t++]=r[2],L[t++]=r[3]):(L[t++]=0,L[t++]=0,L[t++]=0,L[t++]=0),V=Math.ceil(.25*t)}E&&(h=V*k,x[h++]=s[0],x[h++]=s[1],x[h++]=s[2],x[h++]=s[3],V=Math.ceil(h/k))};V+=M,n(pt,l.data[0],l.data[1],l.data[2]),E&&g(ct,y[0],y[1],y[2],y[3]),t&&f(pt,pt,t);const J=this._isClosed(i);if(J){const e=l.data.length-3;n(ht,l.data[e],l.data[e+1],l.data[e+2]),t&&f(ht,ht,t)}else n(mt,l.data[3],l.data[4],l.data[5]),t&&f(mt,mt,t),W(pt,pt,mt,ct,1,-4,0,0),W(pt,pt,mt,ct,1,4,0,0),m(ht,pt),m(pt,mt),E&&g(ct,y[4],y[5],y[6],y[7]);const I=J?0:1,Y=J?p:p-1;for(let u=I;u<Y;u++){const e=(u+1)%p*3;n(mt,l.data[e],l.data[e+1],l.data[e+2]),t&&f(mt,mt,t),N(ht,pt,u),W(ht,pt,mt,ct,0,-1,u,F),W(ht,pt,mt,ct,0,1,u,F);const i=this.numJoinSubdivisions;for(let t=0;t<i;++t){const e=(t+1)/(i+1);W(ht,pt,mt,ct,e,-1,u,F),W(ht,pt,mt,ct,e,1,u,F)}if(W(ht,pt,mt,ct,1,-2,u,F),W(ht,pt,mt,ct,1,2,u,F),m(ht,pt),m(pt,mt),E){const t=(u+1)%p*4;g(ct,y[t],y[t+1],y[t+2],y[t+3])}}J?(n(mt,l.data[3],l.data[4],l.data[5]),t&&f(mt,mt,t),F=N(ht,pt,Y),W(ht,pt,mt,ct,0,-1,I,F),W(ht,pt,mt,ct,0,1,I,F)):(F=N(ht,pt,Y),W(ht,pt,pt,ct,0,-5,Y,F),W(ht,pt,pt,ct,0,5,Y,F)),H(C,R+M,C,R,M);return V=H(C,V-M,C,V,M),this._parameters.wireframe&&this._addWireframeVertices(s,R,V,M),null}_addWireframeVertices(t,e,i,r){const s=new Float32Array(t.buffer,i*Float32Array.BYTES_PER_ELEMENT),a=new Float32Array(t.buffer,e*Float32Array.BYTES_PER_ELEMENT,i-e);let n=0;const o=t=>n=H(a,t,s,n,r);for(let l=0;l<a.length-1;l+=2*r)o(l),o(l+2*r),o(l+1*r),o(l+2*r),o(l+1*r),o(l+3*r)}}function H(t,e,i,r,s){for(let a=0;a<s;a++)i[r++]=t[e++];return r}function K(t,e){if(!t.isClosed)return!1;return e.get("position").indices.length>2}function Q(t){return 1===t.anchor&&t.hideOnShortSegments&&"begin-end"===t.placement&&t.worldSpace}const Z=d(),$=d(),tt=d(),et=d(),it=d(),rt=i(),st=i(),at=d(),nt=d(),ot=j(),lt=j(),ht=d(),pt=d(),mt=d(),ct=_(),ut=[i(),i(),i(),i()],ft=[d(),d(),d(),d()],dt=z(),gt=z(),bt=z(),_t=z();export{X as Parameters,Y as RibbonLineMaterial};