|
|
/** * @license * Cesium - https://github.com/CesiumGS/cesium
* Version 1.140.0 * * Copyright 2011-2022 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/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
*/
import{k as N}from"./chunk-MWY74K7V.js";import{a as S,b as z}from"./chunk-YECQFZBX.js";import{a as p}from"./chunk-TOK3PZ73.js";import{b as C}from"./chunk-QQJ4EFK2.js";import{a as T,b as w}from"./chunk-XXWWJ3QU.js";import{a as m}from"./chunk-N6SIW7ZL.js";import{a as h,b as c}from"./chunk-K35RPNUR.js";import{e as b}from"./chunk-RTRJ3LVQ.js";var a={SCALAR:"SCALAR",VEC2:"VEC2",VEC3:"VEC3",VEC4:"VEC4",MAT2:"MAT2",MAT3:"MAT3",MAT4:"MAT4"};a.getMathType=function(e){switch(e){case a.SCALAR:return Number;case a.VEC2:return C;case a.VEC3:return T;case a.VEC4:return S;case a.MAT2:return N;case a.MAT3:return w;case a.MAT4:return z;default:throw new h("attributeType is not a valid value.")}};a.getNumberOfComponents=function(e){switch(e){case a.SCALAR:return 1;case a.VEC2:return 2;case a.VEC3:return 3;case a.VEC4:case a.MAT2:return 4;case a.MAT3:return 9;case a.MAT4:return 16;default:throw new h("attributeType is not a valid value.")}};a.getAttributeLocationCount=function(e){switch(e){case a.SCALAR:case a.VEC2:case a.VEC3:case a.VEC4:return 1;case a.MAT2:return 2;case a.MAT3:return 3;case a.MAT4:return 4;default:throw new h("attributeType is not a valid value.")}};a.getGlslType=function(e){switch(c.typeOf.string("attributeType",e),e){case a.SCALAR:return"float";case a.VEC2:return"vec2";case a.VEC3:return"vec3";case a.VEC4:return"vec4";case a.MAT2:return"mat2";case a.MAT3:return"mat3";case a.MAT4:return"mat4";default:throw new h("attributeType is not a valid value.")}};var F=Object.freeze(a);var V=1/256,k=65536,l=256,r={};r.octEncodeInRange=function(e,t,n){c.defined("vector",e),c.defined("result",n);let o=T.magnitudeSquared(e);if(Math.abs(o-1)>m.EPSILON6)throw new h("vector must be normalized.");if(n.x=e.x/(Math.abs(e.x)+Math.abs(e.y)+Math.abs(e.z)),n.y=e.y/(Math.abs(e.x)+Math.abs(e.y)+Math.abs(e.z)),e.z<0){let i=n.x,d=n.y;n.x=(1-Math.abs(d))*m.signNotZero(i),n.y=(1-Math.abs(i))*m.signNotZero(d)}return n.x=m.toSNorm(n.x,t),n.y=m.toSNorm(n.y,t),n};r.octEncode=function(e,t){return r.octEncodeInRange(e,255,t)};var E=new C,D=new Uint8Array(1);function M(e){return D[0]=e,D[0]}r.octEncodeToCartesian4=function(e,t){return r.octEncodeInRange(e,65535,E),t.x=M(E.x*V),t.y=M(E.x),t.z=M(E.y*V),t.w=M(E.y),t};r.octDecodeInRange=function(e,t,n,o){if(c.defined("result",o),e<0||e>n||t<0||t>n)throw new h(`x and y must be unsigned normalized integers between 0 and ${n}`);if(o.x=m.fromSNorm(e,n),o.y=m.fromSNorm(t,n),o.z=1-(Math.abs(o.x)+Math.abs(o.y)),o.z<0){let i=o.x;o.x=(1-Math.abs(o.y))*m.signNotZero(i),o.y=(1-Math.abs(i))*m.signNotZero(o.y)}return T.normalize(o,o)};r.octDecode=function(e,t,n){return r.octDecodeInRange(e,t,255,n)};r.octDecodeFromCartesian4=function(e,t){c.typeOf.object("encoded",e),c.typeOf.object("result",t);let n=e.x,o=e.y,i=e.z,d=e.w;if(n<0||n>255||o<0||o>255||i<0||i>255||d<0||d>255)throw new h("x, y, z, and w must be unsigned normalized integers between 0 and 255");let f=n*l+o,s=i*l+d;return r.octDecodeInRange(f,s,65535,t)};r.octPackFloat=function(e){return c.defined("encoded",e),256*e.x+e.y};var x=new C;r.octEncodeFloat=function(e){return r.octEncode(e,x),r.octPackFloat(x)};r.octDecodeFloat=function(e,t){c.defined("value",e);let n=e/256,o=Math.floor(n),i=(n-o)*256;return r.octDecode(o,i,t)};r.octPack=function(e,t,n,o){c.defined("v1",e),c.defined("v2",t),c.defined("v3",n),c.defined("result",o);let i=r.octEncodeFloat(e),d=r.octEncodeFloat(t),f=r.octEncode(n,x);return o.x=65536*f.x+i,o.y=65536*f.y+d,o};r.octUnpack=function(e,t,n,o){c.defined("packed",e),c.defined("v1",t),c.defined("v2",n),c.defined("v3",o);let i=e.x/65536,d=Math.floor(i),f=(i-d)*65536;i=e.y/65536;let s=Math.floor(i),u=(i-s)*65536;r.octDecodeFloat(f,t),r.octDecodeFloat(u,n),r.octDecode(d,s,o)};r.compressTextureCoordinates=function(e){c.defined("textureCoordinates",e);let t=e.x*4095|0,n=e.y*4095|0;return 4096*t+n};r.decompressTextureCoordinates=function(e,t){c.defined("compressed",e),c.defined("result",t);let n=e/4096,o=Math.floor(n);return t.x=o/4095,t.y=(e-o*4096)/4095,t};function g(e){return e>>1^-(e&1)}r.zigZagDeltaDecode=function(e,t,n){c.defined("uBuffer",e),c.de
|