/* COPYRIGHT Esri - https://js.arcgis.com/5.1.2/LICENSE.txt */
import{releaseMaybe as t}from"../../../../core/maybe.js";import{signal as i}from"../../../../core/signal.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import e from"../../webgl/RenderCamera.js";import{isColor as h}from"../core/shaderLibrary/ShaderOutput.js";import{CloudsParameters as n}from"../effects/clouds/CloudsParameters.js";import{ReprojectionUniforms as r}from"./ReprojectionUniforms.js";import{ScreenSpaceReflectionsUniforms as o}from"./ScreenSpaceReflectionsUniforms.js";import{SceneLighting as a}from"../lighting/SceneLighting.js";class l{constructor(t,i){this.width=t,this.height=i}}const g=5e5;class u{constructor(t,h){this._rctx=t,this.shadowMap=h,this._output=0,this.slot=2,this.slicePlane=null,this.hasOccludees=!1,this.emissions=0,this.transparentWithoutDepthEmissionDimmingPass=!1,this.useFloatBlend=i(!0),this.enableFillLights=!0,this.alignPixelEnabled=!1,this.decorations=!0,this.overlayStretch=1,this.viewshedEnabled=!1,this.cutFillComputationEnabled=!1,this.cutFillVisualizationEnabled=!1,this._camera=new e,this._inverseViewport=s(),this._oldLighting=new a,this._newLighting=new a,this._fadedLighting=new a,this._lighting=this._newLighting,this.screenSpaceReflections=new o,this.reprojection=new r,this.highlights=new Array,this.highlightMixOrigin=s(),this.highlightMixTexture=null,this.globalIlluminationEnabled=!1,this.hudRenderStyle=0,this.snowCover=0,this.clouds=new n,this.hasShadowHighlights=!1}destroy(){this._camera=this.contentCamera=null,this.mainDepth=this.overlay=this.ssao=this.shadowHighlight=null,this.depth=t(this.depth),this.shadowMap?.dispose()}get output(){return this._output}set output(t){this._output!==t&&(this._output=t,this._rctx.resetDrawBuffers(t))}get hasEmission(){switch(this.output){case 0:return this.hasOpaqueEmission;case 1:case 2:return this.hasTransparentEmission;default:return!1}}get hasOpaqueEmission(){return 1===this.emissions||3===this.emissions}get hasTransparentEmission(){return 2===this.emissions||3===this.emissions}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<g}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,s,e){this._oldLighting.copyFrom(this.lighting),this._newLighting.noonFactor=i,this._newLighting.globalFactor=s,this._newLighting.set(t),this._oldLighting.updateLegacy(),1===e&&this.clouds.requestFade(),this.fadeLighting()}get hasScreenSpaceReflections(){return h(this.output)&&this.screenSpaceReflections.enabled&&null!=this.reprojection.lastFrameColor}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 10===this.slot||11===this.slot?this.slot:null}}export{u as BindParameters,l as ViewportSize};
