/* COPYRIGHT Esri - https://js.arcgis.com/5.0/LICENSE.txt */
import{__decorate as e}from"tslib";import{disposeMaybe as t}from"../../../core/maybe.js";import{watch as i,initial as s}from"../../../core/reactiveUtils.js";import{subclass as r}from"../../../core/accessorSupport/decorators.js";import{InternalRenderCategory as o}from"../webgl.js";import{CloudsCompositionTechnique as n}from"./CloudsCompositionTechnique.js";import{OpaqueEnvironment as m}from"../webgl-engine/effects/OpaqueEnvironment.js";import{createQuadVAO as a}from"../webgl-engine/lib/glUtil3D.js";import{PrimitiveType as d}from"../../webgl/enums.js";let l=class extends m{initialize(){this.techniques.precompile(n),this.addHandles([i(()=>null!=this.view.environment.weather&&this.view.environment.atmosphereEnabled,e=>e?this._enable():this._disable(),s)])}destroy(){this._vao=t(this._vao)}render(e){const t=e.find(({name:e})=>e===o.OPAQUE_ENVIRONMENT),i=this.bindParameters.clouds;if(!i.data)return t;const s=this.techniques.get(n);if(!s.compiled)return this.requestRender(1),t;const r=this.renderingContext;this._vao??=a(r);const m=r.bindTechnique(s,this.bindParameters);return r.bindVAO(this._vao),m.assertCompatibleVertexAttributeLocations(this._vao),r.drawArrays(d.TRIANGLE_STRIP,0,4),i.isFading&&this.requestRender(2),t}};l=e([r("esri.views.3d.environment.CloudsComposition")],l);export{l as CloudsComposition};
