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.
74 lines
40 KiB
74 lines
40 KiB
2 years ago
|
/**
|
||
|
* Cesium - https://github.com/AnalyticalGraphicsInc/cesium
|
||
|
*
|
||
|
* Copyright 2011-2017 Cesium Contributors
|
||
|
*
|
||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
|
* you may not use this file except in compliance with the License.
|
||
|
* You may obtain a copy of the License at
|
||
|
*
|
||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||
|
*
|
||
|
* Unless required by applicable law or agreed to in writing, software
|
||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
|
* See the License for the specific language governing permissions and
|
||
|
* limitations under the License.
|
||
|
*
|
||
|
* Columbus View (Pat. Pend.)
|
||
|
*
|
||
|
* Portions licensed separately.
|
||
|
* See https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md for full licensing details.
|
||
|
*/
|
||
|
/**
|
||
|
@license
|
||
|
when.js - https://github.com/cujojs/when
|
||
|
|
||
|
MIT License (c) copyright B Cavalier & J Hann
|
||
|
|
||
|
* A lightweight CommonJS Promises/A and when() implementation
|
||
|
* when is part of the cujo.js family of libraries (http://cujojs.com/)
|
||
|
*
|
||
|
* Licensed under the MIT License at:
|
||
|
* http://www.opensource.org/licenses/mit-license.php
|
||
|
*
|
||
|
* @version 1.7.1
|
||
|
*/
|
||
|
|
||
|
/**
|
||
|
@license
|
||
|
mersenne-twister.js - https://gist.github.com/banksean/300494
|
||
|
|
||
|
Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura,
|
||
|
All rights reserved.
|
||
|
|
||
|
Redistribution and use in source and binary forms, with or without
|
||
|
modification, are permitted provided that the following conditions
|
||
|
are met:
|
||
|
|
||
|
1. Redistributions of source code must retain the above copyright
|
||
|
notice, this list of conditions and the following disclaimer.
|
||
|
|
||
|
2. Redistributions in binary form must reproduce the above copyright
|
||
|
notice, this list of conditions and the following disclaimer in the
|
||
|
documentation and/or other materials provided with the distribution.
|
||
|
|
||
|
3. The names of its contributors may not be used to endorse or promote
|
||
|
products derived from this software without specific prior written
|
||
|
permission.
|
||
|
|
||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||
|
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||
|
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||
|
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||
|
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||
|
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||
|
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||
|
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||
|
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||
|
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||
|
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||
|
*/
|
||
|
|
||
|
!function(){define("Core/defined",[],function(){"use strict";function e(e){return void 0!==e&&null!==e}return e}),define("Core/freezeObject",["./defined"],function(e){"use strict";var r=Object.freeze;return e(r)||(r=function(e){return e}),r}),define("Core/defaultValue",["./freezeObject"],function(e){"use strict";function r(e,r){return void 0!==e&&null!==e?e:r}return r.EMPTY_OBJECT=e({}),r}),define("Core/DeveloperError",["./defined"],function(e){"use strict";function r(e){this.name="DeveloperError",this.message=e;var r;try{throw new Error}catch(e){r=e.stack}this.stack=r}return e(Object.create)&&(r.prototype=Object.create(Error.prototype),r.prototype.constructor=r),r.prototype.toString=function(){var r=this.name+": "+this.message;return e(this.stack)&&(r+="\n"+this.stack.toString()),r},r.throwInstantiationError=function(){throw new r("This function defines an interface and should not be called directly.")},r}),define("Core/defineProperties",["./defined"],function(e){"use strict";var r=function(){try{return"x"in Object.defineProperty({},"x",{})}catch(e){return!1}}(),t=Object.defineProperties;return r&&e(t)||(t=function(e){return e}),t}),define("Core/Fullscreen",["./defined","./defineProperties"],function(e,r){"use strict";var t,E={requestFullscreen:void 0,exitFullscreen:void 0,fullscreenEnabled:void 0,fullscreenElement:void 0,fullscreenchange:void 0,fullscreenerror:void 0},n={};return r(n,{element:{get:function(){if(n.supportsFullscreen())return document[E.fullscreenElement]}},changeEventName:{get:function(){if(n.supportsFullscreen())return E.fullscreenchange}},errorEventName:{get:function(){if(n.supportsFullscreen())return E.fullscreenerror}},enabled:{get:function(){if(n.supportsFullscreen())return document[E.fullscreenEnabled]}},fullscreen:{get:function(){if(n.supportsFullscreen())return null!==n.element}}}),n.supportsFullscreen=function(){if(e(t))return t;t=!1;var r=document.body;if("function"==typeof r.requestFullscreen)return E.requestFullscreen="requestFullscreen",E.exitFullscreen="exitFullscreen",E.fullscreenEnabled="fullscreenEnabled",E.fullscreenElement="fullscreenElement",E.fullscreenchange="fullscreenchange",E.fullscreenerror="fullscreenerror",t=!0;for(var n,_=["webkit","moz","o","ms","khtml"],T=0,R=_.length;T<R;++T){var A=_[T];n=A+"RequestFullscreen","function"==typeof r[n]?(E.requestFullscreen=n,t=!0):(n=A+"RequestFullScreen","function"==typeof r[n]&&(E.requestFullscreen=n,t=!0)),n=A+"ExitFullscreen","function"==typeof document[n]?E.exitFullscreen=n:(n=A+"CancelFullScreen","function"==typeof document[n]&&(E.exitFullscreen=n)),n=A+"FullscreenEnabled",void 0!==document[n]?E.fullscreenEnabled=n:(n=A+"FullScreenEnabled",void 0!==document[n]&&(E.fullscreenEnabled=n)),n=A+"FullscreenElement",void 0!==document[n]?E.fullscreenElement=n:(n=A+"FullScreenElement",void 0!==document[n]&&(E.fullscreenElement=n)),n=A+"fullscreenchange",void 0!==document["on"+n]&&("ms"===A&&(n="MSFullscreenChange"),E.fullscreenchange=n),n=A+"fullscreenerror",void 0!==document["on"+n]&&("ms"===A&&(n="MSFullscreenError"),E.fullscreenerror=n)}return t},n.requestFullscreen=function(e,r){n.supportsFullscreen()&&e[E.requestFullscreen]({vrDisplay:r})},n.exitFullscreen=function(){n.supportsFullscreen()&&document[E.exitFullscreen]()},n._names=E,n}),function(e){"use strict";e("ThirdParty/when",[],function(){function e(e,t,E,n){return r(e).then(t,E,n)}function r(e){var r,t;return e instanceof E?r=e:R(e)?(t=T(),e.then(function(e){t.resolve(e)},function(e){t.reject(e)},function(e){t.progress(e)}),r=t.promise):r=n(e),r}function t(r){return e(r,_)}function E(e){this.then=e}function n(e){return new E(function(t){try{return r(t?t(e):e)}catch(e){return _(e)}})}function _(e){return new E(function(t,E){try{return E?r(E(e)):_(e)}catch(e){return _(e)}})}function T(){function e(e,r,t){return a(e,r,t)}function t(e){return I(e)}function n(e){return I(_(e))}function R(e){return N(e)}var A,o,i,u,a,N,I;return o=new E(e),A={then:e,resolve:t,reject:n,progress:R,promise:o,resolver:{resolve:t,reject:n,progress:R}},i=[],u=[],a=function(e,r,t){var E,n;return E=T(),n="function
|
||
|
;return n=_.fastApproximateAtan(T),n=Math.abs(r)>Math.abs(e)?_.PI_OVER_TWO-n:n,n=e<0?_.PI-n:n,n=r<0?-n:n},_}),define("Core/IndexDatatype",["./defined","./DeveloperError","./freezeObject","./Math","./WebGLConstants"],function(e,r,t,E,n){"use strict";var _={UNSIGNED_BYTE:n.UNSIGNED_BYTE,UNSIGNED_SHORT:n.UNSIGNED_SHORT,UNSIGNED_INT:n.UNSIGNED_INT};return _.getSizeInBytes=function(e){switch(e){case _.UNSIGNED_BYTE:return Uint8Array.BYTES_PER_ELEMENT;case _.UNSIGNED_SHORT:return Uint16Array.BYTES_PER_ELEMENT;case _.UNSIGNED_INT:return Uint32Array.BYTES_PER_ELEMENT}},_.fromSizeInBytes=function(e){switch(e){case 2:return _.UNSIGNED_SHORT;case 4:return _.UNSIGNED_INT;case 1:return _.UNSIGNED_BYTE}},_.validate=function(r){return e(r)&&(r===_.UNSIGNED_BYTE||r===_.UNSIGNED_SHORT||r===_.UNSIGNED_INT)},_.createTypedArray=function(e,r){return e>=E.SIXTY_FOUR_KILOBYTES?new Uint32Array(r):new Uint16Array(r)},_.createTypedArrayFromArrayBuffer=function(e,r,t,n){return e>=E.SIXTY_FOUR_KILOBYTES?new Uint32Array(r,t,n):new Uint16Array(r,t,n)},t(_)}),define("Core/RuntimeError",["./defined"],function(e){"use strict";function r(e){this.name="RuntimeError",this.message=e;var r;try{throw new Error}catch(e){r=e.stack}this.stack=r}return e(Object.create)&&(r.prototype=Object.create(Error.prototype),r.prototype.constructor=r),r.prototype.toString=function(){var r=this.name+": "+this.message;return e(this.stack)&&(r+="\n"+this.stack.toString()),r},r}),define("Core/formatError",["./defined"],function(e){"use strict";function r(r){var t,E=r.name,n=r.message;t=e(E)&&e(n)?E+": "+n:r.toString();var _=r.stack;return e(_)&&(t+="\n"+_),t}return r}),define("Workers/createTaskProcessorWorker",["../ThirdParty/when","../Core/defaultValue","../Core/defined","../Core/formatError"],function(e,r,t,E){"use strict";function n(r,t,E){try{return r(t,E)}catch(r){return e.reject(r)}}function _(_){var T;return function(R){var A=R.data,o=[],i={id:A.id,result:void 0,error:void 0};return e(n(_,A.parameters,o)).then(function(e){i.result=e}).otherwise(function(e){e instanceof Error?i.error={name:e.name,message:e.message,stack:e.stack}:i.error=e}).always(function(){t(T)||(T=r(self.webkitPostMessage,self.postMessage)),A.canTransferArrayBuffer||(o.length=0);try{T(i,o)}catch(e){i.result=void 0,i.error="postMessage failed with error: "+E(e)+"\n with responseMessage: "+JSON.stringify(i),T(i)}})}}return _}),define("Workers/decodeDraco",["../Core/ComponentDatatype","../Core/defined","../Core/IndexDatatype","../Core/RuntimeError","./createTaskProcessorWorker"],function(e,r,t,E,n){"use strict";function _(e,r){for(var E=e.num_points(),n=e.num_faces(),_=new I.DracoInt32Array,T=3*n,R=t.createTypedArray(E,T),A=0,o=0;o<n;++o)r.GetFaceFromMesh(e,o,_),R[A+0]=_.GetValue(0),R[A+1]=_.GetValue(1),R[A+2]=_.GetValue(2),A+=3;return I.destroy(_),{typedArray:R,numberOfIndices:T}}function T(e,r,t,E,n){var _,T;E.quantizationBits<=8?(T=new I.DracoUInt8Array,_=new Uint8Array(n),r.GetAttributeUInt8ForAllPoints(e,t,T)):(T=new I.DracoUInt16Array,_=new Uint16Array(n),r.GetAttributeUInt16ForAllPoints(e,t,T));for(var R=0;R<n;++R)_[R]=T.GetValue(R);return I.destroy(T),_}function R(e,r,t,E){var n,_;switch(t.data_type()){case 1:case 11:_=new I.DracoInt8Array,n=new Int8Array(E),r.GetAttributeInt8ForAllPoints(e,t,_);break;case 2:_=new I.DracoUInt8Array,n=new Uint8Array(E),r.GetAttributeUInt8ForAllPoints(e,t,_);break;case 3:_=new I.DracoInt16Array,n=new Int16Array(E),r.GetAttributeInt16ForAllPoints(e,t,_);break;case 4:_=new I.DracoUInt16Array,n=new Uint16Array(E),r.GetAttributeUInt16ForAllPoints(e,t,_);break;case 5:case 7:_=new I.DracoInt32Array,n=new Int32Array(E),r.GetAttributeInt32ForAllPoints(e,t,_);break;case 6:case 8:_=new I.DracoUInt32Array,n=new Uint32Array(E),r.GetAttributeUInt32ForAllPoints(e,t,_);break;case 9:case 10:_=new I.DracoFloat32Array,n=new Float32Array(E),r.GetAttributeFloatForAllPoints(e,t,_)}for(var T=0;T<E;++T)n[T]=_.GetValue(T);return I.destroy(_),n}function A(t,E,n){var _,A=t.num_points(),o=n.num_components(),i=new I.AttributeQuantizationTransform;if(i.InitFromAttribute(n)){for(var u=new Arra
|