Custom Gis Application with Arcgis Javascript API with modern layouting
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

14 lines
5.5 KiB

// All material copyright Esri, All Rights Reserved, unless otherwise specified.
// See https://js.arcgis.com/4.30/esri/copyright.txt for details.
//>>built
define("exports ../../../core/colorUtils ../../../core/Handles ../../../core/mathUtils ../../../core/reactiveUtils ../../../core/libs/gl-matrix-2/math/vec2 ../../../chunks/vec32 ../../../chunks/vec42 ../../../core/libs/gl-matrix-2/factories/vec4f64 ../../../geometry/support/Ellipsoid ./AtmosphereType ./atmosphereUtils ./ChapmanAtmosphereTechnique ./ChapmanAtmosphereTechniqueConfiguration ../webgl/formats ../webgl-engine/lib/DefaultVertexBufferLayouts ../webgl-engine/lib/glUtil3D ../webgl-engine/lib/textureUtils ../../../chunks/AtmosphereCompositing.glsl ../webgl-engine/shaders/AtmosphereCompositingTechnique ../../webgl/enums ../../../webscene/background/ColorBackground".split(" "),
function(q,v,w,f,m,x,n,y,z,g,A,e,l,B,C,D,E,r,F,t,G,H){class I{constructor(a,b){this._view=a;this._context=b;this.type=A.AtmosphereType.Realistic;this._handles=new w;this._compositingPassParameters=new F.AtmosphereCompositingPassParameters;this._passParameters=new l.ChapmanAtmospherePassParameters;this._rootTileElevationMin=NaN;this._lowerBoundEarthRadius=g.earth.radius;this._fadeHaze=0;this._updateRadius(g.earth.radius);a=this._context.renderContext.rctx;this._updateRootTileElevationBounds();this._handles.add([m.watch(()=>
this._view?.basemapTerrain?.rootTileElevationBounds,()=>this._view?.basemapTerrain?this._updateRootTileElevationBounds():null),m.watch(()=>this._view?.basemapTerrain?.visibleElevationBounds,()=>this._view?.basemapTerrain?this._updateVisibleElevationBounds():null),m.watch(()=>this._view?.environment.background,c=>{c=c instanceof H?v.unitRGBAFromColor(c.color):z.ZEROS;n.set(this._passParameters.backgroundColor,c[0]*c[3],c[1]*c[3],c[2]*c[3])},m.syncAndInitial)]);b=new B.ChapmanAtmosphereTechniqueConfiguration;
b.haze=!1;this._atmosphereTechnique=this._context.techniques.acquire(l.ChapmanAtmosphereTechnique,b);this._compositingTechnique=this._context.techniques.acquire(t.AtmosphereCompositingTechnique,b);b.haze=!0;this._atmosphereHazeTechnique=this._context.techniques.acquire(l.ChapmanAtmosphereTechnique,b);this._compositingHazeTechnique=this._context.techniques.acquire(t.AtmosphereCompositingTechnique,b);b.reduced=!0;b.haze=!1;this._atmosphereReducedTechnique=this._context.techniques.acquire(l.ChapmanAtmosphereTechnique,
b);b.haze=!0;this._atmosphereHazeReducedTechnique=this._context.techniques.acquire(l.ChapmanAtmosphereTechnique,b);this._vao=E.createQuadVAO(a,D.Pos2Tex)}destroy(){this._handles.destroy();this._compositingTechnique.release();this._compositingHazeTechnique.release();this._atmosphereTechnique.release();this._atmosphereHazeTechnique.release();this._atmosphereReducedTechnique.release();this._atmosphereHazeReducedTechnique.release();this._vao.dispose()}render(a,b){this._render(a,b?this._atmosphereTechnique:
this._atmosphereReducedTechnique,b,!1)}renderHaze(a,b,c){this._fadeHaze=b;this._render(a,c?this._atmosphereHazeTechnique:this._atmosphereHazeReducedTechnique,c,!0)}_render(a,b,c,h){const p=a.bindParameters.mainDepth;if(p){this._update(a.bindParameters.camera);this._passParameters.depthTexture=p;var u=a.rctx.bindTechnique(b,a.bindParameters,this._passParameters);b=a.offscreenRenderingHelper;if(c)b.renderDepthDetached(()=>this._renderCommon(u,a));else{c=a.rctx.getViewport();var d=n.length(a.bindParameters.camera.eye)-
g.earth.radius;if(d<e.atmosphereHeight){d=Math.min(1,Math.max(0,d/e.atmosphereHeight));var k=h?f.lerp(.4,.5,d):f.lerp(.2,.3,d)}else d=Math.min(1,Math.max(0,(d-e.atmosphereHeight)/(15*e.atmosphereHeight))),k=h?f.lerp(.5,1,d):f.lerp(.3,.6,d);d=r.applyTextureResizeModulo(Math.round(k*a.bindParameters.camera.fullViewport[2]));k=r.applyTextureResizeModulo(Math.round(k*a.bindParameters.camera.fullViewport[3]));a.rctx.setViewport(0,0,d,k);d=b.renderToCachedFBO(null,h?"chapman haze":"chapman",()=>this._renderCommon(u,
a),[0,0,0,1],C.ColorFormat.RGBA,null,d,k);a.rctx.setViewport(c.x,c.y,c.width,c.height);this._compositingPassParameters.color=d.getTexture();this._compositingPassParameters.depth=p;a.rctx.bindTechnique(h?this._compositingHazeTechnique:this._compositingTechnique,a.bindParameters,this._compositingPassParameters);b.renderDepthDetached(()=>a.rctx.screen.draw());d.release()}}}_renderCommon(a,b){null!=this._vao&&(b.rctx.bindVAO(this._vao),a.assertCompatibleVertexAttributeLocations(this._vao),b.rctx.drawArrays(G.PrimitiveType.TRIANGLE_STRIP,
0,4))}_updateRootTileElevationBounds(){const a=this._view.basemapTerrain.rootTileElevationBounds.min;a!==this._rootTileElevationMin&&(this._rootTileElevationMin=a,this._lowerBoundEarthRadius=g.earth.radius,this._updateVisibleElevationBounds())}_updateVisibleElevationBounds(){const a=(g.earth.radius+this._view.basemapTerrain.visibleElevationBounds.min)*Math.cos(Math.PI/16/16);a<this._lowerBoundEarthRadius&&this._updateRadius(a)}_updateRadius(a){this._lowerBoundEarthRadius=a;x.set(this._passParameters.radii,
a,a+e.atmosphereHeight);this._passParameters.innerFadeDistance=2*Math.sqrt((2*a-e.innerAtmosphereDepth)*e.innerAtmosphereDepth)}_update(a){if(a){a=n.squaredLength(a.eye);var b=Math.sqrt(a),c=a-this._passParameters.radii[1]*this._passParameters.radii[1],h=f.clamp((b-this._passParameters.radii[0])/e.atmosphereHeight,0,1);y.set(this._passParameters.heightParameters,b,a,c,h);this._passParameters.altitudeFade=e.computeInnerAltitudeFade(b-this._lowerBoundEarthRadius);this._passParameters.hazeStrength=f.lerp(f.lerp(.6,
1,f.smoothstep(9500,10500,b-g.earth.radius)),1,this._fadeHaze)}}}q.ChapmanAtmosphere=I;Object.defineProperty(q,Symbol.toStringTag,{value:"Module"})});