UNPKG

@doegis/core

Version:

DOE GIS API

3 lines (1 loc) 2.47 kB
import{_ as e}from"../../../../../chunks/tslib.es6.js";import{getAssetUrl as r}from"../../../../../assets.js";import t from"../../../../../core/Accessor.js";import s from"../../../../../core/Logger.js";import{disposeMaybe as a,isSome as o}from"../../../../../core/maybe.js";import{property as i}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/accessorSupport/ensureType.js";import"../../../../../core/arrayUtils.js";import{subclass as m}from"../../../../../core/accessorSupport/decorators/subclass.js";import{requestImage as p}from"../../../../../support/requestImageUtils.js";import{NoParameters as l}from"../../core/shaderModules/interfaces.js";import{ResourceState as n}from"../../lib/basicInterfaces.js";import{TextureType as h,PixelFormat as c,PixelType as d,TextureWrapMode as g,TextureSamplingMode as u}from"../../../../webgl/enums.js";import{Texture as w}from"../../../../webgl/Texture.js";let _=class extends t{constructor(){super(...arguments),this._passParameters=new f,this._loading=0}get passParameters(){return this._passParameters}destroy(){this._passParameters.waveNormal=a(this._passParameters.waveNormal),this._passParameters.wavePertubation=a(this._passParameters.wavePertubation)}get updating(){return this._loading>0}ensureResources(e){if(this._loading>0)return n.LOADING;if(o(this._passParameters.waveNormal)&&o(this._passParameters.wavePertubation))return n.LOADED;const t={target:h.TEXTURE_2D,pixelFormat:c.RGBA,dataType:d.UNSIGNED_BYTE,wrapMode:g.REPEAT,samplingMode:u.LINEAR_MIPMAP_LINEAR,hasMipmap:!0,maxAnisotropy:8};return++this._loading,p(r("esri/images/materials/water/normals.jpg")).then((r=>this._passParameters.waveNormal=new w(e,{...t,width:r.width,height:r.height},r))).catch((e=>s.getLogger(this.declaredClass).error("Failed to load water material normal texture.",e))).finally((()=>--this._loading)),++this._loading,p(r("esri/images/materials/water/perturbation.jpg")).then((r=>this._passParameters.wavePertubation=new w(e,{...t,width:r.width,height:r.height},r))).catch((e=>s.getLogger(this.declaredClass).error("Failed to load water material pertubation texture.",e))).finally((()=>--this._loading)),n.LOADING}};e([i()],_.prototype,"_loading",void 0),e([i({type:Boolean,readOnly:!0})],_.prototype,"updating",null),_=e([m("esri.views.3d.webgl-engine.materials.internal.WaterTextureRepository")],_);class f extends l{}export{f as WaterTexturePassParameters,_ as WaterTextureRepository};