qa-regulatory-gwj-vue/static/map/cesium91/CesiumUnminified/Workers/AttributeCompression-8f752c...

2 lines
3.7 KiB
JavaScript
Raw Permalink Normal View History

2023-11-07 10:04:37 +08:00
define(["exports","./Cartesian2-bd414876","./Cartesian3-e0307675","./ComponentDatatype-aaeec80f","./Check-741c5f3c","./defaultValue-81eec7ed","./Math-e73894ab","./Matrix4-4c545f70","./Matrix2-dc0c61cc"],(function(t,e,n,o,a,c,r,s,u){"use strict";const i={SCALAR:"SCALAR",VEC2:"VEC2",VEC3:"VEC3",VEC4:"VEC4",MAT2:"MAT2",MAT3:"MAT3",MAT4:"MAT4",getMathType:function(t){switch(t){case i.SCALAR:return Number;case i.VEC2:return e.Cartesian2;case i.VEC3:return n.Cartesian3;case i.VEC4:return s.Cartesian4;case i.MAT2:return u.Matrix2;case i.MAT3:return s.Matrix3;case i.MAT4:return s.Matrix4}},getNumberOfComponents:function(t){switch(t){case i.SCALAR:return 1;case i.VEC2:return 2;case i.VEC3:return 3;case i.VEC4:case i.MAT2:return 4;case i.MAT3:return 9;case i.MAT4:return 16}},getGlslType:function(t){switch(t){case i.SCALAR:return"float";case i.VEC2:return"vec2";case i.VEC3:return"vec3";case i.VEC4:return"vec4";case i.MAT2:return"mat2";case i.MAT3:return"mat3";case i.MAT4:return"mat4"}}};var C=Object.freeze(i);const M=1/256,f={octEncodeInRange:function(t,e,n){if(n.x=t.x/(Math.abs(t.x)+Math.abs(t.y)+Math.abs(t.z)),n.y=t.y/(Math.abs(t.x)+Math.abs(t.y)+Math.abs(t.z)),t.z<0){const t=n.x,e=n.y;n.x=(1-Math.abs(e))*r.CesiumMath.signNotZero(t),n.y=(1-Math.abs(t))*r.CesiumMath.signNotZero(e)}return n.x=r.CesiumMath.toSNorm(n.x,e),n.y=r.CesiumMath.toSNorm(n.y,e),n},octEncode:function(t,e){return f.octEncodeInRange(t,255,e)}},d=new e.Cartesian2,m=new Uint8Array(1);function y(t){return m[0]=t,m[0]}f.octEncodeToCartesian4=function(t,e){return f.octEncodeInRange(t,65535,d),e.x=y(d.x*M),e.y=y(d.x),e.z=y(d.y*M),e.w=y(d.y),e},f.octDecodeInRange=function(t,e,o,a){if(a.x=r.CesiumMath.fromSNorm(t,o),a.y=r.CesiumMath.fromSNorm(e,o),a.z=1-(Math.abs(a.x)+Math.abs(a.y)),a.z<0){const t=a.x;a.x=(1-Math.abs(a.y))*r.CesiumMath.signNotZero(t),a.y=(1-Math.abs(t))*r.CesiumMath.signNotZero(a.y)}return n.Cartesian3.normalize(a,a)},f.octDecode=function(t,e,n){return f.octDecodeInRange(t,e,255,n)},f.octDecodeFromCartesian4=function(t,e){const n=256*t.x+t.y,o=256*t.z+t.w;return f.octDecodeInRange(n,o,65535,e)},f.octPackFloat=function(t){return 256*t.x+t.y};const h=new e.Cartesian2;function x(t){return t>>1^-(1&t)}f.octEncodeFloat=function(t){return f.octEncode(t,h),f.octPackFloat(h)},f.octDecodeFloat=function(t,e){const n=t/256,o=Math.floor(n),a=256*(n-o);return f.octDecode(o,a,e)},f.octPack=function(t,e,n,o){const a=f.octEncodeFloat(t),c=f.octEncodeFloat(e),r=f.octEncode(n,h);return o.x=65536*r.x+a,o.y=65536*r.y+c,o},f.octUnpack=function(t,e,n,o){let a=t.x/65536;const c=Math.floor(a),r=65536*(a-c);a=t.y/65536;const s=Math.floor(a),u=65536*(a-s);f.octDecodeFloat(r,e),f.octDecodeFloat(u,n),f.octDecode(c,s,o)},f.compressTextureCoordinates=function(t){return 4096*(4095*t.x|0)+(4095*t.y|0)},f.decompressTextureCoordinates=function(t,e){const n=t/4096,o=Math.floor(n);return e.x=o/4095,e.y=(t-4096*o)/4095,e},f.zigZagDeltaDecode=function(t,e,n){const o=t.length;let a=0,r=0,s=0;for(let u=0;u<o;++u)a+=x(t[u]),r+=x(e[u]),t[u]=a,e[u]=r,c.defined(n)&&(s+=x(n[u]),n[u]=s)},f.dequantize=function(t,e,n,a){const c=C.getNumberOfComponents(n);let r;switch(e){case o.ComponentDatatype.BYTE:r=127;break;case o.ComponentDatatype.UNSIGNED_BYTE:r=255;break;case o.ComponentDatatype.SHORT:r=32767;break;case o.ComponentDatatype.UNSIGNED_SHORT:r=65535;break;case o.ComponentDatatype.INT:r=2147483647;break;case o.ComponentDatatype.UNSIGNED_INT:r=4294967295}const s=new Float32Array(a*c);for(let e=0;e<a;e++)for(let n=0;n<c;n++){const o=e*c+n;s[o]=Math.max(t[o]/r,-1)}return s},f.decodeRGB565=function(t,e){const n=t.length;c.defined(e)||(e=new Float32Array(3*n));const o=1/31;for(let a=0;a<n;a++){const n=t[a],c=n>>11,r=n>>5&63,s=31&n,u=3*a;e[u]=c*o,e[u+1]=.015873015873015872*r,e[u+2]=s*o}return e},t.AttributeCompression=f}));