UNPKG

@arcgis/core

Version:

ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API

6 lines (5 loc) 2.26 kB
/* All material copyright ESRI, All Rights Reserved, unless otherwise specified. See https://js.arcgis.com/4.33/esri/copyright.txt for details. */ import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import{disposeMaybe as r}from"../../../core/maybe.js";import{property as s}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as o}from"../../../core/accessorSupport/decorators/subclass.js";import{equals as i,copy as n}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{N as c}from"../../../chunks/NoiseTextureAtlas.glsl.js";import{NoiseTextureAtlasTechniqueConfiguration as a,NoiseTextureRenderMode as m}from"./NoiseTextureAtlasConfiguration.js";import{atlasSize as h}from"./NoiseTextureAtlasDimensions.js";import{NoiseTextureAtlasTechnique as p}from"./NoiseTextureAtlasTechnique.js";import{FramebufferObject as u}from"../../webgl/FramebufferObject.js";import{TextureDescriptor as d}from"../../webgl/TextureDescriptor.js";let x=class extends t{constructor(e){super(e),this._needsRender=!0,this._passParameters=new c,this._configuration=new a,this._fbo=new u(e.context.renderContext.rctx,new d(h)),e.context.techniques.precompile(p,new a);const t=new a;t.mode=m.WeatherMap,e.context.techniques.precompile(p,t)}get textureAtlas(){if(this._texture&&!this._needsRender)return this._texture;this._configuration.mode=this._texture?m.WeatherMap:m.Full;const e=this.context.techniques.get(p,this._configuration);return e.compiled&&(this._texture=this._render(e)),this._texture}updateWeatherMap(e){i(this._passParameters.weatherTile,e)||(n(this._passParameters.weatherTile,e),this._needsRender=!0)}destroy(){this._fbo=r(this._fbo)}_render(e){if(!this._fbo)return null;const t=this.context.renderContext.rctx,r=t.getViewport();return t.setViewport(0,0,h,h),t.bindFramebuffer(this._fbo),t.bindTechnique(e,this.context.renderContext.bind,this._passParameters),t.screen.draw(),t.setViewport(r.x,r.y,r.width,r.height),this._needsRender=!1,this._fbo.colorTexture}};e([s({constructOnly:!0})],x.prototype,"context",void 0),x=e([o("esri.views.3d.environment.NoiseTextureAtlas")],x);export{x as NoiseTextureAtlas};