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.
12 lines
5.0 KiB
12 lines
5.0 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 ../../../assets ../../../core/Accessor ../../../core/asyncUtils ../../../core/Error ../../../core/Logger ../../../core/maybe ../../../core/promiseUtils ../../../core/reactiveUtils ../../../core/accessorSupport/decorators/property ../../../core/has ../../../core/RandomLCG ../../../core/accessorSupport/decorators/subclass ../../../core/libs/gl-matrix-2/math/mat4 ../../../core/libs/gl-matrix-2/factories/mat4f64 ../../../core/support/UpdatingHandles ./StarsTechnique ../support/buffer/glUtil ../support/buffer/InterleavedLayout ../webgl-engine/lib/DefaultVertexAttributeLocations ../webgl-engine/lib/VertexArrayObject ../webgl-engine/lib/VertexAttribute ../../webgl/BufferObject ../../webgl/enums".split(" "), |
|
function(g,l,A,B,C,v,D,r,E,F,m,S,T,G,n,w,H,x,I,J,K,L,t,M,y){function N(a,b,c,h){const p=z.createBuffer(h),u=p.position,q=p.color,O=p.size;for(let e=0;e<h;e++){var d=b[2*e],f=b[2*e+1];u.set(e,0,-Math.cos(d)*Math.sin(f));u.set(e,1,-Math.sin(d)*Math.sin(f));u.set(e,2,-Math.cos(f));d=c[e];d=192<=d?[2.9,d-192]:160<=d?[2.5,d-160]:128<=d?[2,d-128]:96<=d?[1.5,d-96]:64<=d?[1,d-64]:32<=d?[.7,d-32]:[.4,d];f=P[d[1]];f=[parseInt(f.substring(0,2),16),parseInt(f.substring(2,4),16),parseInt(f.substring(4,6),16)]; |
|
q.set(e,0,255*f[0]);q.set(e,1,255*f[1]);q.set(e,2,255*f[2]);q.set(e,3,255);O.set(e,d[0])}return new L.VertexArrayObject(a,K.Default3D,{geometry:I.glLayout(z)},{geometry:M.BufferObject.createVertex(a,y.Usage.STATIC_DRAW,p.buffer)})}g.Stars=class extends B{get updating(){return this._updatingTracking.updating||this.loading}get loading(){return null!=this._loadDataTask&&!this._loadDataTask.finished}constructor(a){super(a);this._loadDataTask=null;this._numPoints=0;this._passParameters=new x.StarPassParameters; |
|
this._updatingTracking=new H.UpdatingHandles}initialize(){this._loadDataTask=this._createLoadDataTask()}destroy(){this._loadDataTask=r.abortMaybe(this._loadDataTask);this._updatingTracking.destroy();this._numPoints=0;this._technique=r.releaseMaybe(this._technique);this._vao=r.disposeMaybe(this._vao);k=null}render(a){const {rctx:b}=a;this._ensureResources(b);null!=this._technique&&null!=this._vao&&(this._technique.compiled?(a=b.bindTechnique(this._technique,a.bindParameters,this._passParameters),b.bindVAO(this._vao), |
|
a.assertCompatibleVertexAttributeLocations(this._vao),b.drawArrays(y.PrimitiveType.POINTS,0,this._numPoints)):this.requestRender())}_ensureResources(a){if(null==this._technique&&null!=k){this._technique=new x.StarsTechnique({rctx:a,viewingMode:this.view.state.viewingMode});this._numPoints=k.byteLength/9;var b=new Float32Array(k,0,2*this._numPoints),c=new Uint8Array(k,8*this._numPoints,this._numPoints);this._vao=N(a,b,c,this._numPoints);this._updatingTracking.add(()=>"virtual"!==this.view.environment.lighting.type? |
|
this.view.environment.lighting.date:null,h=>this._update(h),F.initial)}}_update(a){if(a){var b=a.getHours()/12,c=a.getMinutes()/60*(2/24),h=a.getSeconds()/60*(2/1440);b=(b+c+h-.9972222)%2;c=new Date(a.getFullYear(),0,1,11,58,56);h=new Date(a.getFullYear()+1,0,1,11,58,55);a=(+a-+c)/(+h-+c)*2;c=n.copy(this._passParameters.modelMatrix,Q);n.rotateZ(c,c,-a*Math.PI);n.multiply(c,R,c);n.rotateZ(c,c,-b*Math.PI);this.requestRender()}}_createLoadDataTask(){if(null!=k)return null;const a=C.createTask(async b=> |
|
{({data:b}=await A.fetchAsset("esri/views/3d/environment/resources/stars.wsv",{responseType:"array-buffer",signal:b}));if(!b)throw new v("stars:no-data-received","Failed to create stars because star catalogue is missing");const c=b.byteLength/9;if(0!==c%1||5E4<c||5E3>c)throw new v("stars:invalid-data","Failed to create stars because star catalogue data is invalid");k=b});a.promise.catch(b=>{E.isAbortError(b)||D.getLogger(this).error(b)}).then(()=>{this.destroyed||(this.requestRender(),this.notifyChange("updating"))}); |
|
return a}};l.__decorate([m.property({constructOnly:!0})],g.Stars.prototype,"view",void 0);l.__decorate([m.property({constructOnly:!0})],g.Stars.prototype,"requestRender",void 0);l.__decorate([m.property({readOnly:!0})],g.Stars.prototype,"updating",null);l.__decorate([m.property()],g.Stars.prototype,"_loadDataTask",void 0);l.__decorate([m.property()],g.Stars.prototype,"_updatingTracking",void 0);g.Stars=l.__decorate([G.subclass("esri.views.3d.environment.Stars")],g.Stars);const P="9bb2ff;9eb5ff;aabfff;bbccff;ccd8ff ;dae2ff;e4e9ff;eeefff;f8f6ff;fff9fb;fff5ef;fff1e5;ffeddb;ffe9d2;ffe6ca;ffe3c3;ffe0bb;ffddb4;ffdaad;ffd6a5;ffd29c;ffcc8f;ffc178;ffa94b;ff7b00".split(";"), |
|
R=w.fromValues(1,0,0,0,0,.9174771405229186,.39778850739794974,0,0,-.39778850739794974,.9174771405229186,0,0,0,0,1),Q=w.fromValues(1,0,0,0,0,.9174771405229186,-.39778850739794974,0,0,.39778850739794974,.9174771405229186,0,0,0,0,1),z=J.newLayout().vec3f(t.VertexAttribute.POSITION).vec4u8(t.VertexAttribute.COLOR).f32(t.VertexAttribute.SIZE);let k=null;Object.defineProperty(g,Symbol.toStringTag,{value:"Module"})}); |