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.
10 lines
3.8 KiB
10 lines
3.8 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 ../../../chunks/tslib.es6 ../../../core/Accessor ../../../core/mathUtils ../../../core/maybe ../../../core/time ../../../core/accessorSupport/decorators/property ../../../core/has ../../../core/Logger ../../../core/RandomLCG ../../../core/accessorSupport/decorators/subclass ../../../geometry/ellipsoidUtils ./PrecipitationTechnique ./PrecipitationTechniqueConfiguration ../support/buffer/glUtil ../support/buffer/InterleavedLayout ../webgl-engine/lib/AnimationTimer ../webgl-engine/lib/VertexArrayObject ../webgl-engine/lib/VertexAttribute ../../webgl/BufferObject ../../webgl/enums ../../webgl/Util".split(" "), |
|
function(c,k,x,n,g,y,p,E,F,G,z,A,d,h,q,r,B,C,t,u,l,v){c.Precipitation=class extends x{constructor(a){super(a);this._numParticles=25E4;this._rainSpeed=.1;this._snowSpeed=.01;this._passParameters=new d.PrecipitationPassParameters;this._animation=new B.AnimationTimer;this._passParameters.time=0;this._passParameters.radius=A.getReferenceEllipsoid(a.view.spatialReference).radius;this._techniques=a.context.techniques}destroy(){this._numParticles=0;this._snowTechniqueCached=g.releaseMaybe(this._snowTechniqueCached); |
|
this._rainTechniqueCached=g.releaseMaybe(this._rainTechniqueCached);this._vao=g.disposeMaybe(this._vao);this._instanceIdBuffer=g.disposeMaybe(this._instanceIdBuffer)}get _rainTechnique(){if(null==this._rainTechniqueCached){const a=new h.PrecipitationTechniqueConfiguration;a.type=h.PrecipitationType.Rain;this._rainTechniqueCached=this._techniques.acquire(d.PrecipitationTechnique,a)}return this._rainTechniqueCached}get _snowTechnique(){if(null==this._snowTechniqueCached){const a=new h.PrecipitationTechniqueConfiguration; |
|
a.type=h.PrecipitationType.Snow;this._snowTechniqueCached=this._techniques.acquire(d.PrecipitationTechnique,a)}return this._snowTechniqueCached}update(a){return this._animation.advance(a)}render(a,b,e){const m="rainy"===e?this._rainTechnique:this._snowTechnique;if(m.compiled){var f=a.rctx;this._ensureResources(f);null!=m&&null!=this._vao&&null!=this._instanceIdBuffer&&(null!=a.bindParameters.cloudsFade.data&&(this._passParameters.opacity=a.bindParameters.cloudsFade.opacity),0>=this._passParameters.opacity|| |
|
(b=.5>b?n.lerp(0,.35,2*b):n.lerp(.35,1,2*(b-.5)),this._passParameters.time=("rainy"===e?this._rainSpeed:this._snowSpeed)*y.secondsFromMilliseconds(this._animation.time)%1E5,a=f.bindTechnique(m,a.bindParameters,this._passParameters),f.bindVAO(this._vao),a.assertCompatibleVertexAttributeLocations(this._vao),v.bindVertexBufferLayout(f,d.attributeLocations,this._instanceIdBuffer,w,0),f.drawArraysInstanced(l.PrimitiveType.TRIANGLES,0,3,this._numParticles*b),v.unbindVertexBufferLayout(f,d.attributeLocations, |
|
this._instanceIdBuffer,w)))}else this.context.requestRender()}_ensureResources(a){if(null==this._vao){const b=new Float32Array([-1,0,1,1,0,-1,1,0,1]);this._vao=new C.VertexArrayObject(a,d.attributeLocations,{geometry:q.glLayout(D)},{geometry:u.BufferObject.createVertex(a,l.Usage.STATIC_DRAW,b)})}null==this._instanceIdBuffer&&(this._instanceIdBuffer=this._createInstanceIndices(a))}_createInstanceIndices(a){const b=[];for(let e=0;e<this._numParticles;e++)b.push(e);return u.BufferObject.createVertex(a, |
|
l.Usage.STATIC_DRAW,new Float32Array(b))}};k.__decorate([p.property({constructOnly:!0})],c.Precipitation.prototype,"context",void 0);k.__decorate([p.property({constructOnly:!0})],c.Precipitation.prototype,"view",void 0);c.Precipitation=k.__decorate([z.subclass("esri.views.3d.environment.Precipitation")],c.Precipitation);const D=r.newLayout().vec3f(t.VertexAttribute.POSITION),w=q.glLayout(r.newLayout().f32(t.VertexAttribute.INSTANCEFEATUREATTRIBUTE),1);Object.defineProperty(c,Symbol.toStringTag,{value:"Module"})}); |