From 01ae301710a879bb4e7129ecc27483b78b3785d4 Mon Sep 17 00:00:00 2001 From: Daisuke Matsumoto Date: Tue, 2 Jul 2019 11:47:53 +0900 Subject: [PATCH] update to version 0.6.0 --- _deploy/public/mapray-js/v0.6.0/mapray.js | 6 ++++++ package.json | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 _deploy/public/mapray-js/v0.6.0/mapray.js diff --git a/_deploy/public/mapray-js/v0.6.0/mapray.js b/_deploy/public/mapray-js/v0.6.0/mapray.js new file mode 100644 index 00000000..1136bfee --- /dev/null +++ b/_deploy/public/mapray-js/v0.6.0/mapray.js @@ -0,0 +1,6 @@ +!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("mapray",[],t):"object"==typeof exports?exports.mapray=t():e.mapray=t()}(this,function(){return function(e){function t(n){if(r[n])return r[n].exports;var i=r[n]={exports:{},id:n,loaded:!1};return e[n].call(i.exports,i,i.exports,t),i.loaded=!0,i.exports}var r={};return t.m=e,t.c=r,t.p="",t(0)}([function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}Object.defineProperty(t,"__esModule",{value:!0});var a,o=r(29),u=n(o),s=r(12),_=n(s),l=r(1),c=n(l),f=r(22),h=n(f),d=r(3),v=n(d),y=r(17),p=n(y),m=r(18),g=n(m),b=r(9),w=n(b),x=r(26),E=n(x),k=r(37),T=n(k),M=r(2),O=n(M),A=r(23),P=n(A),I=r(27),R=n(I),N=r(24),F=n(N),L=r(4),D=n(L),S=r(15),j=n(S),C=r(19),U=n(C),V=r(28),z=n(V),B=r(25),q=n(B),G=r(38),Y=n(G),X=(a={Viewer:u.default,Camera:_.default,GeoMath:c.default,Ray:h.default,CredentialMode:v.default,Layer:p.default,LayerCollection:g.default,DemProvider:w.default,StandardDemProvider:E.default,CloudDemProvider:T.default,ImageProvider:O.default,RenderCallback:P.default,StandardImageProvider:R.default,Scene:F.default,Entity:D.default,GenericEntity:j.default,MarkerLineEntity:U.default},i(a,"MarkerLineEntity",U.default),i(a,"TextEntity",z.default),i(a,"TextEntity",z.default),i(a,"SceneLoader",q.default),i(a,"SceneLoader",q.default),i(a,"DebugStats",Y.default),a);window.maprayRequestAnimationFrame=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame,window.maprayCancelAnimationFrame=window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||window.oCancelAnimationFrame;var H=window.performance,Z=H&&(H.now||H.mozNow||H.msNow||H.oNow||H.webkitNow),W=new Date;window.maprayNow=Z?function(){return Z.call(H)}:function(){return W.getTime()},Math.maprayLog2=Math.log2||function(e){return 1.4426950408889634*Math.log(e)},t.default=X,e.exports=t.default},function(e,t){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t){for(var r=0;r0?r.latitude=90:a<0?r.latitude=-90:r.latitude=0,r.longitude=0),r.height=Math.sqrt(o+u+s)-e.EARTH_RADIUS,r}},{key:"frustum_matrix",value:function(e,t,r,n,i,a,o){return o[0]=2*i/(t-e),o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=2*i/(n-r),o[6]=0,o[7]=0,o[8]=(t+e)/(t-e),o[9]=(n+r)/(n-r),o[10]=(a+i)/(i-a),o[11]=-1,o[12]=0,o[13]=0,o[14]=2*a*i/(i-a),o[15]=0,o}},{key:"lookat_matrix",value:function(t,r,n,i){var a=e._xaxis,o=e._yaxis,u=e._zaxis;return u[0]=t[0]-r[0],u[1]=t[1]-r[1],u[2]=t[2]-r[2],e.normalize3(u,u),e.cross3(n,u,a),e.normalize3(a,a),e.cross3(u,a,o),i[0]=a[0],i[1]=a[1],i[2]=a[2],i[3]=0,i[4]=o[0],i[5]=o[1],i[6]=o[2],i[7]=0,i[8]=u[0],i[9]=u[1],i[10]=u[2],i[11]=0,i[12]=t[0],i[13]=t[1],i[14]=t[2],i[15]=1,i}},{key:"rotation_matrix",value:function(t,r,n){var i=r*e.DEGREE,a=Math.sin(i),o=Math.cos(i),u=t[0],s=t[1],_=t[2];return n[0]=u*u*(1-o)+o,n[1]=u*s*(1-o)+_*a,n[2]=u*_*(1-o)-s*a,n[3]=0,n[4]=u*s*(1-o)-_*a,n[5]=s*s*(1-o)+o,n[6]=s*_*(1-o)+u*a,n[7]=0,n[8]=u*_*(1-o)+s*a,n[9]=s*_*(1-o)-u*a,n[10]=_*_*(1-o)+o,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,n}},{key:"kml_model_matrix",value:function(t,r,n,i,a){var o=t*e.DEGREE,u=r*e.DEGREE,s=n*e.DEGREE,_=Math.sin(o),l=Math.cos(o),c=Math.sin(u),f=Math.cos(u),h=Math.sin(s),d=Math.cos(s),v=i[0],y=i[1],p=i[2];return a[0]=v*(_*h*c+l*d),a[1]=v*(l*h*c-_*d),a[2]=v*h*f,a[3]=0,a[4]=y*_*f,a[5]=y*l*f,a[6]=-y*c,a[7]=0,a[8]=p*(_*d*c-l*h),a[9]=p*(l*d*c+_*h),a[10]=p*d*f,a[11]=0,a[12]=0,a[13]=0,a[14]=0,a[15]=1,a}},{key:"gudermannian",value:function(e){return 2*Math.atan(Math.exp(e))-Math.PI/2}},{key:"invGudermannian",value:function(e){return Math.log(Math.tan(e/2+Math.PI/4))}},{key:"clamp",value:function(e,t,r){return Math.min(Math.max(e,t),r)}}]),e}();i.EARTH_RADIUS=6378137,i.DEGREE=.017453292519943295,i.LOG2PI=1.6514961294723187,i._xaxis=i.createVector3(),i._yaxis=i.createVector3(),i._zaxis=i.createVector3(),t.default=i,e.exports=t.default},function(e,t){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t){for(var r=0;r=0)return!1}return!0}}]),e}();s._obj_to_view=u.default.createMatrix(),s._bbox_points=[];for(var _=0;_<8;++_)s._bbox_points.push(u.default.createVector3());t.default=s,e.exports=t.default},function(e,t){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t){for(var r=0;rthis._upper_bound*this._max_accesses){var t=Math.floor(this._lower_bound*this._max_accesses);this._reduceCache(t)}++this._frame_counter}},{key:"_performNewRequests",value:function(){var e=Math.min(this._max_requesteds-this._num_requesteds,this._new_requesteds.length);this._new_requesteds.sort(function(e,t){var r=e[0],n=t[0];return n.req_power-r.req_power});var t=this;this._new_requesteds.slice(0,e).forEach(function(e){var r=e[0],n=e[1],i=e[2],a=e[3];t._requestTileTexture(n,i,a,r)}),this._new_requesteds.slice(e).forEach(function(e){var t=e[0];t.state=g.NONE}),this._new_requesteds.length=0}},{key:"_requestTileTexture",value:function(e,t,r,n){var i=this;n.data=this._provider.requestTile(e,t,r,function(a){n.state===g.REQUESTED&&(a?(n.data=new c.default(e,t,r,i._createTexture(a)),n.state=g.LOADED):(n.data=null,n.state=g.FAILED),--i._num_requesteds)}),++this._num_requesteds}},{key:"_createTexture",value:function(e){var t=this._glenv.context,r=this._aniso_ext,n=t.TEXTURE_2D,i=t.createTexture();return t.bindTexture(n,i),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,!0),t.texImage2D(n,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,e),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,!1),this._use_mipmap&&t.generateMipmap(n),t.texParameteri(n,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texParameteri(n,t.TEXTURE_MIN_FILTER,this._use_mipmap?t.LINEAR_MIPMAP_LINEAR:t.LINEAR),t.texParameteri(n,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(n,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),r&&t.texParameterf(t.TEXTURE_2D,r.TEXTURE_MAX_ANISOTROPY_EXT,this._max_aniso),t.bindTexture(n,null),i}},{key:"_reduceCache",value:function(e){var t=new p(this._croot);t.nodes.sort(function(e,t){var r=t.aframe-e.aframe;return 0==r&&e.state===g.LOADED&&t.state===g.LOADED?e.data.z-t.data.z:r});var r=this._glenv.context;t.nodes.slice(e).forEach(function(e){e.state===g.LOADED&&e.data.dispose(r),e.state=g.NONE,e.data=null}),t.clean()}}]),e}();d._findNearestAncestors_result=new Array(2);var v=function(){function e(){i(this,e),this.children=[null,null,null,null],this.state=g.NONE,this.data=null,this.req_power=-1,this.aframe=-1}return a(e,[{key:"updateRequestPower",value:function(e){e>this.req_power&&(this.req_power=e)}},{key:"touch",value:function(){this.aframe=!0}}]),e}(),y=function(){function e(t,r){i(this,e),this.num_loadeds=0,this.num_accesses=0,this._frame=r,this._traverse(t)}return a(e,[{key:"_traverse",value:function(e){for(var t=e.children,r=e.aframe===!0,n=0;n<4;++n){var i=t[n];null!==i&&(r=this._traverse(i)||r)}return e.state===g.LOADED&&(++this.num_loadeds,r&&++this.num_accesses),r&&(e.aframe=this._frame),r}}]),e}(),p=function(){function e(t){i(this,e),this._root=t,this.nodes=[],this._traverse(t)}return a(e,[{key:"_traverse",value:function(e){var t=e.state;t!==g.LOADED&&t!==g.FAILED||this.nodes.push(e);for(var r=e.children,n=0;n<4;++n){var i=r[n]; +null!==i&&this._traverse(i)}}},{key:"clean",value:function(){this._clean_recur(this._root)}},{key:"_clean_recur",value:function(e){for(var t=e.state===g.NONE,r=e.children,n=0;n<4;++n){var i=r[n];if(null!==i){var a=this._clean_recur(i);a===!0&&(r[n]=null),t=a&&t}}return t}}]),e}(),m=function(){function e(t,r){i(this,e),this._owner=t,this._traverse(r)}return a(e,[{key:"_traverse",value:function(e){for(var t=e.children,r=0;r<4;++r){var n=t[r];null!==n&&this._traverse(n)}if(e.state===g.REQUESTED){var i=this._owner;e.state=g.NONE,i._provider.cancelRequest(e.data),--i._num_requesteds}}}]),e}(),g={NONE:{id:"NONE"},LOADED:{id:"LOADED"},REQUESTED:{id:"REQUESTED"},FAILED:{id:"FAILED"}};t.default=d,e.exports=t.default},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var r=0;rthis._flake_reduce_thresh*e&&this._reduceFlakes(e),this._num_cache_meshes>this._mesh_reduce_lower&&this._num_cache_meshes>this._mesh_reduce_thresh*this._num_touch_meshes&&this._reduceMeshes(),this._num_touch_flakes=0,this._num_touch_meshes=0,++this._frame_counter}},{key:"_requestRoot",value:function(){var e=this,t=0,r=0,n=0;this._root_cancel_id=this._dem_provider.requestTile(t,r,n,function(i){if(i){var a=new _.default(t,r,n,e._ρ,i);e._avg_height=a.newAvgHeightMaps(),e._root_flake=new d(null,t,r,n),e._root_flake.setupRoot(e,a),e._status=h.READY}else e._status=h.FAILED;e._root_cancel_id=null,--e._num_dem_requesteds}),++this._num_dem_requesteds}},{key:"_reduceFlakes",value:function(e){var t=this._root_flake.flattenFlakes();t.sort(function(e,t){return e.compareForReduce(t)});var r=Math.floor(this._flake_reduce_factor*e);t.slice(r).forEach(function(e){return e.dispose()})}},{key:"_reduceMeshes",value:function(){var e=this._root_flake.flattenMeshes();e.sort(function(e,t){return e.compareForReduce(t)});var t=Math.floor(this._mesh_reduce_factor*this._num_touch_meshes);e.slice(t).forEach(function(e){return e.dispose()})}},{key:"glenv",get:function(){return this._glenv}},{key:"dem_provider",get:function(){return this._dem_provider}},{key:"status",get:function(){return this._status}},{key:"root_flake",get:function(){var e=this._root_flake;return e.touch(),e}}]),e}(),h={NOT_READY:{id:"NOT_READY"},READY:{id:"READY"},FAILED:{id:"FAILED"}};f.Status=h;var d=function(){function e(t,r,n,a){i(this,e),this.z=r,this.x=n,this.y=a,this._parent=t,this._children=[null,null,null,null],this._globe=null!==t?t._globe:null,this._dem_data=null,this._dem_state=p.NONE,this._meshes=[],this._prev_Za_dem=null,this._prev_Zr_dem=null,this._base_height=0,this._height_min=0,this._height_max=0,this._dem_zlimit=0,this._gocs_x_min=0,this._gocs_x_max=0,this._gocs_y_min=0,this._gocs_y_max=0,this._gocs_z_min=0,this._gocs_z_max=0,this._aframe=-1,null!==this._globe&&(this._globe._num_cache_flakes+=1)}return a(e,[{key:"setupRoot",value:function(e,t){this._globe=e,this._dem_data=t,this._dem_state=p.LOADED,this._estimate(),e._num_cache_flakes+=1}},{key:"newChild",value:function(t,r){var n=t+2*r,i=this._children[n];return null===i&&(i=new e(this,this.z+1,2*this.x+t,2*this.y+r),this._children[n]=i),i._estimate(),i.touch(),i}},{key:"isInvisible",value:function(e){switch(this.z){case 0:return this._isInvisible_0(e);default:return this._isInvisible_N(e)}}},{key:"findMesh",value:function(t){var r,n=Math.pow(2,-t)*e.ε;r=n<=2?Math.max(Math.ceil(u.default.LOG2PI-this.z-Math.maprayLog2(Math.acos(1-n))),0):0;var i,a=this._getCosφ();i=n*a<=2?Math.max(Math.ceil(u.default.LOG2PI-this.z+Math.maprayLog2(a/Math.acos(1-n*a))),0):0;var o=this._getMeshNode(t,r,i);return o.touch(),o.mesh}},{key:"findRayDistance",value:function(e,t){var r;for(r=this;r._dem_state!==p.LOADED;r=r._parent);if(this.z-r.z===this._globe._ρ)return this._findQuadRayDistance(e,t,r);if(this._cullForRayDistance(e,t))return t;for(var n=t,i=0;i<2;++i)for(var a=0;a<2;++a)n=this.newChild(a,i).findRayDistance(e,n);return n}},{key:"dispose",value:function(){var e,t=this._parent;if(null!==t){for(var r=this._globe,n=this._meshes;n.length>0;)n[0].dispose();var i=this._children;for(e=0;e<4;++e){var a=i[e];null!==a&&a.dispose()}var o=t._children;for(e=0;e<4;++e)if(o[e]===this){o[e]=null;break}this._parent=null,this._dem_state===p.REQUESTED&&(r._dem_provider.cancelRequest(this._dem_data),--r._num_dem_requesteds),r._num_cache_flakes-=1}}},{key:"flattenFlakes",value:function(){var e=[];return this._flattenFlakes(e),e}},{key:"flattenMeshes",value:function(){var e=[];return this._flattenMeshes(e),e}},{key:"compareForReduce",value:function(e){var t=this,r=e,n=r._aframe-t._aframe;return 0!==n?n:t.z-r.z}},{key:"_flattenFlakes",value:function(e){e.push(this);for(var t=this._children,r=0;r<4;++r){var n=t[r];null!==n&&n._flattenFlakes(e)}}},{key:"_flattenMeshes",value:function(e){Array.prototype.push.apply(e,this._meshes);for(var t=this._children,r=0;r<4;++r){var n=t[r];null!==n&&n._flattenMeshes(e)}}},{key:"touch",value:function(){var e=this._globe;this._aframe!==e._frame_counter&&(this._aframe=e._frame_counter,e._num_touch_flakes+=1)}},{key:"_getMeshNode",value:function(e,t,r){for(var n=this._getMeshDemBinary(e),i=n.getDivisionPowers(this,e,t,r),a=this._meshes,o=a.length,u=0;u0&&this._requestAncestorDemTile(Math.min(r.z+n,t))}return r}},{key:"_findNearestDemTile",value:function(e){for(var t=this,r=this.z-e,n=0;n=t._max_dem_requesteds)){for(var r=this,n=this.z-e,i=0;i0){var t=this.y,r=Math.pow(2,1-e),n=Math.abs(1-r*t),i=Math.abs(1-r*(t+1)),a=Math.exp(Math.PI*Math.min(n,i));return 2*a/(a*a+1)}return 1}},{key:"_estimate",value:function(){if(this._prev_Za_dem!==this){var e,t=this.z,r=this._globe._ρ;if(t0){if(f=(o-n)/p,fu&&p<0&&(f=(u-n)/p,f0){if(f=(s-i)/m,f_&&m<0&&(f=(_-i)/m,f0){if(f=(l-a)/g,fc&&g<0&&(f=(c-a)/g,f=0&&d=0&&u.default.dot3(u.default.cross3(p,m,e._temp_ray_10),l)>=0&&u.default.dot3(u.default.cross3(m,y,e._temp_ray_11),l)>=0)return d}}return r}}]),e}();d.ε=.0625,d.Fm=-2,d.Fp=2,d.πr=Math.PI*u.default.EARTH_RADIUS,d._temp_positions=function(){for(var e=[],t=0;t<4;++t)e.push(u.default.createVector3());return e}(),d._temp_ray_1=u.default.createVector3(),d._temp_ray_2=u.default.createVector3(),d._temp_ray_3=u.default.createVector3(),d._temp_ray_4=u.default.createVector3(),d._temp_ray_5=u.default.createVector3(),d._temp_ray_6=u.default.createVector3(),d._temp_ray_7=u.default.createVector3(),d._temp_ray_8=u.default.createVector3(),d._temp_ray_9=u.default.createVector3(),d._temp_ray_10=u.default.createVector3(),d._temp_ray_11=u.default.createVector3();var v=function(){function e(){i(this,e),this._history=[],this._max_value=0,this._hsize=200}return a(e,[{key:"getMaxValue",value:function(t){var r=this._history,n=this._max_value;return r.lengthn&&(this._max_value=t):t>=n?(this._max_value=t,r.shift()):r[0]t&&(t=i)}return t}}]),e}(),y=function(){function e(t,r,n){i(this,e),this._flake=t,this._dem=r,this._pow_u=n[0],this._pow_v=n[1],this._aframe=-1,this.mesh=new c.default(t._globe.glenv,t,n,r),t._globe._num_cache_meshes+=1}return a(e,[{key:"match",value:function(e,t){return this._dem===e&&this._pow_u===t[0]&&this._pow_v===t[1]}},{key:"touch",value:function(){var e=this._flake._globe;this._aframe!==e._frame_counter&&(this._aframe=e._frame_counter,e._num_touch_meshes+=1)}},{key:"dispose",value:function(){if(null!==this.mesh){for(var e=this._flake,t=e._meshes,r=t.length,n=0;n0;)this.remove(0)}},{key:"add",value:function(e){this.insert(this.num_layers,e)}},{key:"insert",value:function(e,t){this._layers.splice(e,0,new u.default(this,t)),this.dirtyDrawingLayers()}},{key:"remove",value:function(e){this._layers.splice(e,1),this.dirtyDrawingLayers()}},{key:"numDrawingLayers",value:function(){return null===this._draw_layers&&this._updataDrawingLayers(),this._draw_layers.length}},{key:"getDrawingLayer",value:function(e){return null===this._draw_layers&&this._updataDrawingLayers(),this._draw_layers[e]}},{key:"endFrame",value:function(){for(var e=this._layers,t=0;tn){for(var i=new Float64Array(Math.max(r,2*n)),a=this._buffer,o=this._num_floats,u=0;uf&&(f=p),m>h&&(h=m),g>d&&(d=g)}var b=this._pivot;b[0]=o/a,b[1]=u/a,b[2]=s/a;var w=this._bbox,x=w[0],E=w[1];x[0]=_,x[1]=l,x[2]=c,E[0]=f,E[1]=h,E[2]=d}},{key:"_createVertices",value:function(){for(var e=this._buffer,t=e[0],r=e[1],n=e[2],i=this._num_floats/3,a=i-1,o=4*a,u=new Float32Array(8*o),s=0;s=0&&t.splice(r,1)}},{key:"getEntity",value:function(e){return this._entity_list[e]}},{key:"draw",value:function(e){for(var t=[],r=[],n=0;n=0&&this._loaders.splice(t,1)}},{key:"glenv",get:function(){return this._glenv}},{key:"num_entities",get:function(){return this._entity_list.length}}]),e}();t.default=i,e.exports=t.default},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){}function o(e,t){return{url:e}}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){for(var r=0;r0;){var r=new k(e);r.isValid()&&t.push(r)}return t}},{key:"_createTexture",value:function(t,r){var n=e._createCanvasContext(t,r);n.textAlign="left",n.textBaseline="alphabetic",n.fillStyle="rgba( 255, 255, 255, 1.0 )";for(var i=this._items,a=0;a0;){var o=t.shift(),u=o.width_pixel+b.SAFETY_PIXEL_MARGIN;if(r+u<=b.MAX_IMAGE_WIDTH)a.push(o),r+=u,n=Math.max(o.height_pixel,n);else{if(0!=a.length){t.unshift(o);break}o.cancel()}}this._items=a,this._width_assumed=r,this._height_pixel=n}return u(e,[{key:"isValid",value:function(){return this._items.length>0}},{key:"locate",value:function(e){var t=this._items,r=0;r+=b.SAFETY_PIXEL_MARGIN;for(var n=0;n1)return 0;var l=this._globe,c=l.findHighestAccuracy(s,_);if(null===c)return 0;var f=l.dem_provider.getResolutionPower(),h=1<=1){var i=this._create_first_map(n);this._maps.push(i);for(var a=i,o=-2;o>=-t;--o){var u=this._create_next_map(o,a);this._maps.push(u),a=u}}}return n(e,[{key:"_create_first_map",value:function(e){for(var t=4,r=1<this._z)return 0==this.getQuadLevel(e,t,r);var n=this._qlevels;return 0==n[0]||0==n[1]||0==n[2]||0==n[3]}},{key:"getQuadLevel",value:function(e,t,r){var n=Math.pow(2,this._z-e),i=Math.floor(2*((t+.5)*n-this._x)),a=Math.floor(2*((r+.5)*n-this._y));return this._qlevels[2*a+i]}},{key:"getQuadLevelDirect",value:function(e,t){var r=Math.round(Math.pow(2,this._z+1)),n=u.default.clamp(Math.floor(e*r),0,r-1)%2,i=u.default.clamp(Math.floor(t*r),0,r-1)%2;return this._qlevels[2*i+n]}},{key:"getHeights",value:function(t,r){var n=4,i=n*(r*this._size+t),a=n*this._size,o=e._getHeights_result;return o[0]=this._body.getFloat32(i,!0),o[1]=this._body.getFloat32(i+n,!0),o[2]=this._body.getFloat32(i+a,!0),o[3]=this._body.getFloat32(i+a+n,!0),o}},{key:"getDivisionPowers",value:function(t,r,n,i){var a=t.z,o=this._z,s=u.default.LOG2PI-this._ρ+1,_=this._getComplexity(a,t.x,t.y),l=Math.min(o+this._ρ,Math.round(r+s+_))-a,c=e._getDivisionPowers_result;return c[0]=Math.max(n,l),c[1]=Math.max(i,l),c}},{key:"newSampler",value:function(e){var t=e.z-this._z>this._ρ?_.default:c.default;return new t(this._z,this._x,this._y,this._ρ,this._body)}},{key:"newAvgHeightMaps",value:function(){return new h.default(this._ρ,this._body)}},{key:"_createωArray",value:function(t){for(var r=4,n=[],i=0,a=0;a<3;++a){for(var o=1<<2*a,u=new Float32Array(o),s=0;sm&&(b=u.default.createVector4(b),b[3]=m),u.default.transformPlane_A(r,b,w),i.push(w)}this._clip_planes=i}},{key:"traverse",value:function(){return this._collectFlakes(this._globe.root_flake),this._debug_stats&&(this._debug_stats.num_procA_flakes=this._num_procA_flakes,this._debug_stats.num_procB_flakes=this._num_procB_flakes),this._rflake_list}},{key:"_collectFlakes",value:function(t){if(null!==this._debug_stats&&(this._num_procA_flakes+=1),!t.isInvisible(this._clip_planes)){if(t.ze.MAX_LOD_INTERVAL||n>t.z?void this._collectNextLevelFlakes(t):void this._addRenderFlake(t,r)}}},{key:"_collectNextLevelFlakes",value:function(e){for(var t=0;t<2;++t)for(var r=0;r<2;++r)this._collectFlakes(e.newChild(r,t))}},{key:"_getLevelOfDetailRange",value:function(e){for(var t=Math.PI,r=e.z,n=e.x,i=e.y,a=Math.pow(2,1-r)*t,o=-t+n*a,s=t-(i+1)*a,_=t/32,l=Math.ceil(a/_),c=a/l,f=u.default.EARTH_RADIUS+e.base_height,h=this._view_pos_Q,d=this._view_dir_wU,v=this._view_dir_N,y=this._view_dir_V,p=Number.MAX_VALUE,m=-Number.MAX_VALUE,g=0,b=s;g=0){if(!(r.default_scene_index=1&&(this._default=this._entries[0])}return a(e,[{key:"setOffsetTransform",value:function(e){s.default.copyMatrix(e,this._offset_transform)}},{key:"createPrimitives",value:function(e){var t=this._getEntry(e);if(null===t)return null;var r=[],n=!0,i=!1,a=void 0;try{for(var o,u=t.primitives[Symbol.iterator]();!(n=(o=u.next()).done);n=!0){var _=o.value,l=_.fastClone();s.default.mul_AA(this._offset_transform,l.transform,l.transform),l.properties=T.fastCloneProperties(l.properties),r.push(l)}}catch(e){i=!0,a=e}finally{try{!n&&u.return&&u.return()}finally{if(i)throw a}}return r}},{key:"_getEntry",value:function(e){if("number"==typeof e){if(0<=e&&e0)return this._entries[0];return null}}]),e}(),k=function(){function e(t,r,n){i(this,e);var a=new T(t,r,n);this._primitives=a.primitives}return a(e,[{key:"primitives",get:function(){return this._primitives}}]),e}(),T=function(){function e(t,r,n){i(this,e),n.buffer_map||(n.buffer_map=new Map,n.texture_map=new Map),this._mr_scene=t,this._glenv=t.glenv,this._primitives=[],this._buffer_map=n.buffer_map,this._texture_map=n.texture_map;var a=s.default.setIdentity(s.default.createMatrix()),o=!0,u=!1,_=void 0;try{for(var l,c=r.root_nodes[Symbol.iterator]();!(o=(l=c.next()).done);o=!0){var f=l.value;this._addNode(f,a)}}catch(e){u=!0,_=e}finally{try{!o&&c.return&&c.return()}finally{if(u)throw _}}}return a(e,[{key:"_addNode",value:function(t,r){var n=e._getNodeToScene(t,r);if(null!==t.mesh){var i=!0,a=!1,o=void 0;try{for(var u,s=t.mesh.primitives[Symbol.iterator]();!(i=(u=s.next()).done);i=!0){var _=u.value;this._primitives.push(this._createPrimitive(_,n))}}catch(e){a=!0,o=e}finally{try{!i&&s.return&&s.return()}finally{if(a)throw o}}}var l=!0,c=!1,f=void 0;try{for(var h,d=t.children[Symbol.iterator]();!(l=(h=d.next()).done);l=!0){var v=h.value;this._addNode(v,n)}}catch(e){c=!0,f=e}finally{try{!l&&d.return&&d.return()}finally{if(c)throw f}}}},{key:"_createPrimitive",value:function(e,t){var r=this._createMesh(e),n=this._createMaterial(e),i=new l.default(this._glenv,r,n,s.default.createMatrix(t));return i.pivot=this._createMeshPivot(e),i.bbox=this._createBoundingBox(e),i.properties=this._createProperties(e),i}},{key:"_createMesh",value:function(t){var r=new f.default.Initializer(e._convertPrimitiveMode(t),e._calcNumVertices(t)),n=t.attributes;for(var i in n)this._addAttribToInit(r,i,n[i]);var a=t.indices;return null!==a&&this._addIndexToInit(r,a),new f.default(this._glenv,r)}},{key:"_addAttribToInit",value:function(t,r,n){var i=this._findMeshBuffer(n.bufferView.buffer,d.default.Target.ATTRIBUTE),a=e._NumComponents[n.type],o=e._ComponentType[n.componentType],u={normalized:n.normalized,byte_stride:n.bufferView.byteStride,byte_offset:n.bufferView.byteOffset+n.byteOffset},s=e._VertexAttribId[r]||r;t.addAttribute(s,i,a,o,u)}},{key:"_addIndexToInit",value:function(t,r){var n=this._findMeshBuffer(r.bufferView.buffer,d.default.Target.INDEX),i=r.count,a=e._ComponentType[r.componentType],o={byte_offset:r.bufferView.byteOffset+r.byteOffset};t.addIndex(n,i,a,o)}},{key:"_findMeshBuffer",value:function(e,t){var r=this._buffer_map.get(e);return void 0===r&&(r=new d.default(this._glenv,e.binary,{target:t}),this._buffer_map.set(e,r)),r}},{key:"_createMaterial",value:function(e){var t=this._mr_scene;return t._ModelEntity_model_material||(t._ModelEntity_model_material=new m.default(t.glenv)),t._ModelEntity_model_material}},{key:"_createMeshPivot",value:function(e){var t=null,r=this._createBoundingBox(e);if(null!==r){t=s.default.createVector3();for(var n=0;n<3;++n)t[n]=(r[0][n]+r[1][n])/2}return t}},{key:"_createBoundingBox",value:function(e){var t=null,r=e.attributes.POSITION;if(void 0!==r){var n=r.min,i=r.max;null!==n&&null!==i&&(t=[s.default.createVector3(n),s.default.createVector3(i)])}return t}},{key:"_createProperties",value:function(e){var t=e.material;if(null===t)return{pbrMetallicRoughness:{baseColorFactor:s.default.createVector4f([1,1,1,1]),baseColorTexture:null,metallicFactor:1,roughnessFactor:1,metallicRoughnessTexture:null},doubleSided:!1,alphaMode:"OPAQUE",alphaCutoff:.5,emissiveFactor:s.default.createVector3f([0,0,0]),emissiveTexture:null,normalTexture:null,occlusionTexture:null};var r=t.pbrMetallicRoughness;return{pbrMetallicRoughness:{baseColorFactor:s.default.createVector4f(r.baseColorFactor),baseColorTexture:this._createTextureParam(r.baseColorTexture),metallicFactor:r.metallicFactor,roughnessFactor:r.roughnessFactor,metallicRoughnessTexture:this._createTextureParam(r.metallicRoughnessTexture)},doubleSided:t.doubleSided,alphaMode:t.alphaMode,alphaCutoff:t.alphaCutoff,emissiveFactor:s.default.createVector3f(t.emissiveFactor),emissiveTexture:this._createTextureParam(t.emissiveTexture),normalTexture:this._createTextureParam(t.normalTexture),occlusionTexture:this._createTextureParam(t.occlusionTexture)}}},{key:"_createTextureParam",value:function(e){if(null===e)return null;var t={texture:this._findTexture(e.texture),texCoord:e.texCoord};return e instanceof b.default?t.scale=e.scale:e instanceof x.default&&(t.strength=e.strength),t}},{key:"_findTexture",value:function(e){var t=this._texture_map.get(e);if(void 0===t){var r=e.sampler,n=this._glenv.context,i={mag_filter:void 0!==r.magFilter?r.magFilter:n.LINEAR,min_filter:void 0!==r.minFilter?r.minFilter:n.LINEAR_MIPMAP_LINEAR,wrap_s:r.wrapS,wrap_t:r.wrapT,flip_y:!1};t=new y.default(this._glenv,e.source.image,i),this._texture_map.set(e,t)}return t}},{key:"primitives",get:function(){return this._primitives}}],[{key:"_getNodeToScene",value:function(e,t){var r=t,n=e.matrix;return null!==n&&(r=s.default.createMatrix(),s.default.mul_AA(t,n,r)),r}},{key:"_convertPrimitiveMode",value:function(t){return e._DrawMode[t.mode]}},{key:"_calcNumVertices",value:function(e){var t=e.attributes,r=[];for(var n in t){var i=t[n];r.push(i.count)}return Math.min.apply(null,r)}},{key:"fastCloneProperties",value:function(t){var r=t.pbrMetallicRoughness;return{pbrMetallicRoughness:{baseColorFactor:s.default.createVector3f(r.baseColorFactor),baseColorTexture:e._fastCloneTextureParam(r.baseColorTexture),metallicFactor:r.metallicFactor,roughnessFactor:r.roughnessFactor,metallicRoughnessTexture:e._fastCloneTextureParam(r.metallicRoughnessTexture)},doubleSided:t.doubleSided,alphaMode:t.alphaMode,alphaCutoff:t.alphaCutoff,emissiveFactor:s.default.createVector3f(t.emissiveFactor),emissiveTexture:e._fastCloneTextureParam(t.emissiveTexture),normalTexture:e._fastCloneTextureParam(t.normalTexture),occlusionTexture:e._fastCloneTextureParam(t.occlusionTexture)}}},{key:"_fastCloneTextureParam",value:function(e){if(null===e)return null;var t={texture:e.texture,texCoord:e.texCoord};return"scale"in e?t.scale=e.scale:"strength"in e&&(t.strength=e.strength),t}}]),e}();T._DrawMode={0:f.default.DrawMode.POINTS,1:f.default.DrawMode.LINES,2:f.default.DrawMode.LINE_LOOP,3:f.default.DrawMode.LINE_STRIP,4:f.default.DrawMode.TRIANGLES,5:f.default.DrawMode.TRIANGLE_STRIP,6:f.default.DrawMode.TRIANGLE_FAN},T._NumComponents={SCALAR:1,VEC2:2,VEC3:3,VEC4:4},T._ComponentType={5120:f.default.ComponentType.BYTE,5121:f.default.ComponentType.UNSIGNED_BYTE,5122:f.default.ComponentType.SHORT,5123:f.default.ComponentType.UNSIGNED_SHORT,5125:f.default.ComponentType.UNSIGNED_INT,5126:f.default.ComponentType.FLOAT},T._VertexAttribId={POSITION:"a_position",NORMAL:"a_normal",TANGENT:"a_tangent",TEXCOORD_0:"a_texcoord",TEXCOORD_1:"a_texcoord1",COLOR_0:"a_color"},t.default=E,e.exports=t.default},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){for(var r=0;r=1&&null===s[0]?null:{corner_lod:[e.lod_00,e.lod_10,e.lod_01,e.lod_11],image_hi:this._getImageParamater(s[0],i,a,o,u),image_lo:this._getImageParamater(s[1],i,a,o,u-1)}}},{key:"_getImageParamater",value:function(e,t,r,n,i){var a;return null!==e?(a=Math.pow(2,e.z-t),{lod:e.z-this._image_zbias,texture:e.texture,texcoord_rect:[r*a-e.x,1-(n+1)*a+e.y,a,a]}):(a=Math.pow(2,-t),{lod:-this._image_zbias,texture:this._dummy_tile_texture,texcoord_rect:[r*a-Math.floor(a*(r+.5)),1-(n+1)*a+Math.floor(a*(n+.5)),a,a]})}},{key:"_createDummyTileTexture",value:function(e){var t=e.context,r=t.TEXTURE_2D,n=t.createTexture(),i=[128,128,128,255];return t.bindTexture(r,n),t.texImage2D(r,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,new Uint8Array(i)),t.bindTexture(r,null),n}}]),t}(_.default);y.TEXUNIT_IMAGE_HI=0,y.TEXUNIT_IMAGE_LO=1,t.default=y,e.exports=t.default},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){for(var r=0;r=e.first&&e.last>=this.first}},{key:"mergeRange",value:function(e){return{first:Math.min(this.first,e.first),last:Math.max(this.last,e.last)}}}]),e}();t.default=i,e.exports=t.default},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e){return{url:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var r=0;r=0?this._base_uri.substr(0,n+1):"";return i+e}},{key:"makeBinaryFetchParams",value:function(e){var t=this._transform_binary(e),r={credentials:(t.credentials||b.default.OMIT).credentials};return t.headers&&(r.headers=t.headers),{url:t.url,init:r}}},{key:"makeImageLoadParams",value:function(e){var t=this._transform_image(e),r={url:t.url};return t.credentials===b.default.SAME_ORIGIN?r.crossOrigin="anonymous":t.credentials===b.default.INCLUDE&&(r.crossOrigin="use-credentials"),r}},{key:"findBuffer",value:function(e){return void 0===this._buffer_entries[e]&&(this._buffer_entries[e]=new f.default(new y.default(this,e))),this._buffer_entries[e].buffer}},{key:"findImage",value:function(e){return void 0===this._image_entries[e]&&(this._image_entries[e]=new d.default(new m.default(this,e))),this._image_entries[e].image}},{key:"addAccessor",value:function(e,t){var r=this._buffer_entries[e.bufferView.buffer.index];switch(t){case"ATTRIBUTE":r.addAttributeAccessor(e);break;case"INDEX":r.addIndexAccessor(e)}}},{key:"addTextureInfo",value:function(e){var t=e.texture.source,r=this._image_entries[t.index];r.addTextureInfo(e)}},{key:"onStartLoadBuffer",value:function(){this._load_count+=1}},{key:"onFinishLoadBuffer",value:function(e){e&&(this._load_error=e),this._load_count-=1,this._onFinishLoadSomething()}},{key:"onStartLoadImage",value:function(){this._load_count+=1}},{key:"onFinishLoadImage",value:function(e){e&&(this._load_error=e),this._load_count-=1,this._onFinishLoadSomething()}},{key:"_onFinishLoadBody",value:function(){this._body_finished=!0,this._onFinishLoadSomething()}},{key:"_onFinishLoadSomething",value:function(){this._settled||(null!==this._load_error?(this._reject(this._load_error),this._settled=!0):this._body_finished&&0==this._load_count&&(this._rewriteBuffersForByteOrder(),this._splitBuffersAndRebuildAccessors(),this._rebuildTextureInfo(),this._resolve(new s.default(this._scenes,this._default_scene_index)),this._settled=!0))}},{key:"_rewriteBuffersForByteOrder",value:function(){var e=!0,t=!1,r=void 0;try{for(var n,i=this._buffer_entries[Symbol.iterator]();!(e=(n=i.next()).done);e=!0){var a=n.value;void 0!==a&&a.rewriteByteOrder()}}catch(e){t=!0,r=e}finally{try{!e&&i.return&&i.return()}finally{if(t)throw r}}}},{key:"_splitBuffersAndRebuildAccessors",value:function(){var e=!0,t=!1,r=void 0;try{for(var n,i=this._buffer_entries[Symbol.iterator]();!(e=(n=i.next()).done);e=!0){var a=n.value;void 0!==a&&a.splitBufferAndRebuildAccessors()}}catch(e){t=!0,r=e}finally{try{!e&&i.return&&i.return()}finally{if(t)throw r}}}},{key:"_rebuildTextureInfo",value:function(){var e=!0,t=!1,r=void 0;try{for(var n,i=this._image_entries[Symbol.iterator]();!(e=(n=i.next()).done);e=!0){var a=n.value;void 0!==a&&a.rebuildTextureInfo()}}catch(e){t=!0,r=e}finally{try{!e&&i.return&&i.return()}finally{if(t)throw r}}}},{key:"gjson",get:function(){return this._gjson}}]),e}();t.default=w,e.exports=t.default},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var r=0;r