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