74 lines
43 KiB
JavaScript
74 lines
43 KiB
JavaScript
|
/**
|
||
|
* 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(t){r=t.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,n={requestFullscreen:void 0,exitFullscreen:void 0,fullscreenEnabled:void 0,fullscreenElement:void 0,fullscreenchange:void 0,fullscreenerror:void 0},E={};return r(E,{element:{get:function(){return E.supportsFullscreen()?document[n.fullscreenElement]:void 0}},changeEventName:{get:function(){return E.supportsFullscreen()?n.fullscreenchange:void 0}},errorEventName:{get:function(){return E.supportsFullscreen()?n.fullscreenerror:void 0}},enabled:{get:function(){return E.supportsFullscreen()?document[n.fullscreenEnabled]:void 0}},fullscreen:{get:function(){return E.supportsFullscreen()?null!==E.element:void 0}}}),E.supportsFullscreen=function(){if(e(t))return t;t=!1;var r=document.body;if("function"==typeof r.requestFullscreen)return n.requestFullscreen="requestFullscreen",n.exitFullscreen="exitFullscreen",n.fullscreenEnabled="fullscreenEnabled",n.fullscreenElement="fullscreenElement",n.fullscreenchange="fullscreenchange",n.fullscreenerror="fullscreenerror",t=!0;for(var E,_=["webkit","moz","o","ms","khtml"],i=0,T=_.length;T>i;++i){var o=_[i];E=o+"RequestFullscreen","function"==typeof r[E]?(n.requestFullscreen=E,t=!0):(E=o+"RequestFullScreen","function"==typeof r[E]&&(n.requestFullscreen=E,t=!0)),E=o+"ExitFullscreen","function"==typeof document[E]?n.exitFullscreen=E:(E=o+"CancelFullScreen","function"==typeof document[E]&&(n.exitFullscreen=E)),E=o+"FullscreenEnabled",void 0!==document[E]?n.fullscreenEnabled=E:(E=o+"FullScreenEnabled",void 0!==document[E]&&(n.fullscreenEnabled=E)),E=o+"FullscreenElement",void 0!==document[E]?n.fullscreenElement=E:(E=o+"FullScreenElement",void 0!==document[E]&&(n.fullscreenElement=E)),E=o+"fullscreenchange",void 0!==document["on"+E]&&("ms"===o&&(E="MSFullscreenChange"),n.fullscreenchange=E),E=o+"fullscreenerror",void 0!==document["on"+E]&&("ms"===o&&(E="MSFullscreenError"),n.fullscreenerror=E)}return t},E.requestFullscreen=function(e,r){E.supportsFullscreen()&&e[n.requestFullscreen]({vrDisplay:r})},E.exitFullscreen=function(){E.supportsFullscreen()&&document[n.exitFullscreen]()},E}),define("Core/RuntimeError",["./defined"],function(e){"use strict";function r(e){this.name="RuntimeError",this.message=e;var r;try{throw new Error}catch(t){r=t.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}),function(e){"use strict";e("ThirdParty/when",[],function(){function e(e,t,n,E){return r(e).then(t,n,E)}function r(e){var r,t;return e instanceof n?r=e:T(e)?(t=i(),e.then(function(e){t.resolve(e)},function(e){t.reject(e)},function(e){t.progress(e)}),r=t.promise):r=E(e),r}function t(r){return e(r,_)}function n(e){this.then=e}function E(e){var t=new n(function(t){try{return r(t?t(e):e)}catch(n){return _(n)}}
|
||
|
if(!n(e))throw new E("left is required.");if(!n(r))throw new E("right is required.");if(!n(_))throw new E("relativeEpsilon is required.");i=t(i,_);var T=Math.abs(e-r);return i>=T||T<=_*Math.max(Math.abs(e),Math.abs(r))},_.lessThan=function(e,r,t){if(!n(e))throw new E("first is required.");if(!n(r))throw new E("second is required.");if(!n(t))throw new E("relativeEpsilon is required.");return-t>e-r},_.lessThanOrEquals=function(e,r,t){if(!n(e))throw new E("first is required.");if(!n(r))throw new E("second is required.");if(!n(t))throw new E("relativeEpsilon is required.");return t>e-r},_.greaterThan=function(e,r,t){if(!n(e))throw new E("first is required.");if(!n(r))throw new E("second is required.");if(!n(t))throw new E("relativeEpsilon is required.");return e-r>t},_.greaterThanOrEquals=function(e,r,t){if(!n(e))throw new E("first is required.");if(!n(r))throw new E("second is required.");if(!n(t))throw new E("relativeEpsilon is required.");return e-r>-t};var i=[1];_.factorial=function(e){if("number"!=typeof e||0>e)throw new E("A number greater than or equal to 0 is required.");var r=i.length;if(e>=r)for(var t=i[r-1],n=r;e>=n;n++)i.push(t*n);return i[e]},_.incrementWrap=function(e,r,_){if(_=t(_,0),!n(e))throw new E("n is required.");if(_>=r)throw new E("maximumValue must be greater than minimumValue.");return++e,e>r&&(e=_),e},_.isPowerOfTwo=function(e){if("number"!=typeof e||0>e)throw new E("A number greater than or equal to 0 is required.");return 0!==e&&0===(e&e-1)},_.nextPowerOfTwo=function(e){if("number"!=typeof e||0>e)throw new E("A number greater than or equal to 0 is required.");return--e,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,++e,e},_.clamp=function(e,r,t){if(!n(e))throw new E("value is required");if(!n(r))throw new E("min is required.");if(!n(t))throw new E("max is required.");return r>e?r:e>t?t:e};var T=new e;return _.setRandomNumberSeed=function(r){if(!n(r))throw new E("seed is required.");T=new e(r)},_.nextRandomNumber=function(){return T.random()},_.randomBetween=function(e,r){return _.nextRandomNumber()*(r-e)+e},_.acosClamped=function(e){if(!n(e))throw new E("value is required.");return Math.acos(_.clamp(e,-1,1))},_.asinClamped=function(e){if(!n(e))throw new E("value is required.");return Math.asin(_.clamp(e,-1,1))},_.chordLength=function(e,r){if(!n(e))throw new E("angle is required.");if(!n(r))throw new E("radius is required.");return 2*r*Math.sin(.5*e)},_.logBase=function(e,r){if(!n(e))throw new E("number is required.");if(!n(r))throw new E("base is required.");return Math.log(e)/Math.log(r)},_.cbrt=t(Math.cbrt,function(e){var r=Math.pow(Math.abs(e),1/3);return 0>e?-r:r}),_.log2=t(Math.log2,function(e){return Math.log(e)*Math.LOG2E}),_.fog=function(e,r){var t=e*r;return 1-Math.exp(-(t*t))},_.fastApproximateAtan=function(e){return r.typeOf.number("x",e),e*(-.1784*Math.abs(e)-.0663*e*e+1.0301)},_.fastApproximateAtan2=function(e,t){r.typeOf.number("x",e),r.typeOf.number("y",t);var n,i,T=Math.abs(e);n=Math.abs(t),i=Math.max(T,n),n=Math.min(T,n);var o=n/i;if(isNaN(o))throw new E("either x or y must be nonzero");return T=_.fastApproximateAtan(o),T=Math.abs(t)>Math.abs(e)?_.PI_OVER_TWO-T:T,T=0>e?_.PI-T:T,T=0>t?-T:T},_}),define("Core/IndexDatatype",["./defined","./DeveloperError","./freezeObject","./Math","./WebGLConstants"],function(e,r,t,n,E){"use strict";var _={UNSIGNED_BYTE:E.UNSIGNED_BYTE,UNSIGNED_SHORT:E.UNSIGNED_SHORT,UNSIGNED_INT:E.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}throw new r("indexDatatype is required and must be a valid IndexDatatype constant.")},_.fromSizeInBytes=function(e){switch(e){case 2:return _.UNSIGNED_SHORT;case 4:return _.UNSIGNED_INT;case 1:return _.UNSIGNED_BYTE;default:throw new r("Size in bytes cannot be mapped to an IndexDatatype")}},_.validate=function(r){return e(r)&&(r===_.UNSIGNED_BYTE||r===_.UNSIGNED_SHORT||r===_.UNSIGNED_INT)},_.createTypedArray=function(t,E){if(!e(t))throw new r("numbe
|