NongFaHeZuoSheGuanLi/public/Cesium/Workers/S3MBTilesParser.js

2 lines
92 KiB
JavaScript
Raw Normal View History

2024-07-17 08:39:11 +08:00
define(["require","./createTaskProcessorWorker","./Check-7b2a090c","./FeatureDetection-806b12f0","./when-b60132fc","./Cartesian2-47311507","./Cartographic-3309dd0d","./Cartesian4-3ca25aab","./Color-2a095a27","./ComponentDatatype-c140a87d","./getStringFromTypedArray-c37342c0","./buildModuleUrl-8958744c","./S3MCompressType-75aa9ff0","./IndexDatatype-8a5eead4","./RuntimeError-4a5c8994","./BoundingRectangle-1f901ba8","./S3MPixelFormat-4f2b7689","./pako_inflate-f73548c4","./arrayFill-4513d7ad","./CompressedTextureBuffer-290a1ff4","./PixelFormat-9345f1c7","./Math-119be1a3","./WebGLConstants-4ae0db90","./Event-16a2dfbf"],(function(t,e,r,a,n,A,o,i,B,E,C,s,y,l,d,f,u,P,c,p,T,L,D,g){"use strict";function F(t,e,r){if("function"==typeof t.slice)return t.slice(e,r);for(var n=Array.prototype.slice.call(t,e,r),A=a.FeatureDetection.typedArrayTypes,o=A.length,i=0;i<o;++i)if(t instanceof A[i]){n=new A[i](n);break}return n}function M(){}var m;function I(t,e,r){var a,A=t.num_points(),o=r.num_components(),i=new m.AttributeQuantizationTransform;if(i.InitFromAttribute(r)){for(var B=new Array(o),C=0;C<o;++C)B[C]=i.min_value(C);a={quantizationBits:i.quantization_bits(),minValues:B,range:i.range(),octEncoded:!1}}m.destroy(i),(i=new m.AttributeOctahedronTransform).InitFromAttribute(r)&&(a={quantizationBits:i.quantization_bits(),octEncoded:!0}),m.destroy(i);var s,y=A*o;s=n.defined(a)?function(t,e,r,a,n){var A,o;a.quantizationBits<=8?(o=new m.DracoUInt8Array,A=new Uint8Array(n),e.GetAttributeUInt8ForAllPoints(t,r,o)):(o=new m.DracoUInt16Array,A=new Uint16Array(n),e.GetAttributeUInt16ForAllPoints(t,r,o));for(var i=0;i<n;++i)A[i]=o.GetValue(i);return m.destroy(o),A}(t,e,r,a,y):function(t,e,r,a){var n,A;switch(r.data_type()){case 1:case 11:A=new m.DracoInt8Array,n=new Int8Array(a),e.GetAttributeInt8ForAllPoints(t,r,A);break;case 2:A=new m.DracoUInt8Array,n=new Uint8Array(a),e.GetAttributeUInt8ForAllPoints(t,r,A);break;case 3:A=new m.DracoInt16Array,n=new Int16Array(a),e.GetAttributeInt16ForAllPoints(t,r,A);break;case 4:A=new m.DracoUInt16Array,n=new Uint16Array(a),e.GetAttributeUInt16ForAllPoints(t,r,A);break;case 5:case 7:A=new m.DracoInt32Array,n=new Int32Array(a),e.GetAttributeInt32ForAllPoints(t,r,A);break;case 6:case 8:A=new m.DracoUInt32Array,n=new Uint32Array(a),e.GetAttributeUInt32ForAllPoints(t,r,A);break;case 9:case 10:A=new m.DracoFloat32Array,n=new Float32Array(a),e.GetAttributeFloatForAllPoints(t,r,A)}for(var o=0;o<a;++o)n[o]=A.GetValue(o);return m.destroy(A),n}(t,e,r,y);var l=E.ComponentDatatype.fromTypedArray(s);return{array:s,data:{componentsPerAttribute:o,componentDatatype:l,byteOffset:r.byte_offset(),byteStride:E.ComponentDatatype.getSizeInBytes(l)*o,normalized:r.normalized(),quantization:a}}}var v=new o.Cartesian3(40680631590769,40680631590769,40408299984661.445),_=new o.Cartesian3,S=new o.Cartesian3;function O(t,e,r,a){var A=Math.cos(e);_.x=A*Math.cos(t),_.y=A*Math.sin(t),_.z=Math.sin(e),_=o.Cartesian3.normalize(_,_),o.Cartesian3.multiplyComponents(v,_,S);var i=Math.sqrt(o.Cartesian3.dot(_,S));return S=o.Cartesian3.divideByScalar(S,i,S),_=o.Cartesian3.multiplyByScalar(_,r,_),n.defined(a)||(a=new o.Cartesian3),o.Cartesian3.add(S,_,a)}var N=new a.Matrix4,h=new a.Matrix4,R=new o.Cartesian3,G=new o.Cartographic;function x(t,e,r,B,C,s,l,d){var f=void 0,u=void 0,P=void 0,c=void 0,p=r.vertexAttributes,T=r.attrLocation;if(r.nCompressOptions=0,n.defined(B.posUniqueID)&&B.posUniqueID>=0){n.defined(d)||(r.nCompressOptions|=y.VertexCompressOption.SVC_Vertex);var L=e.GetAttribute(t,B.posUniqueID),D=I(t,e,L),g=D.data.componentsPerAttribute;r.verticesCount=D.array.length/g,r.vertCompressConstant=D.data.quantization.range/(1<<D.data.quantization.quantizationBits);var F=D.data.quantization.minValues;r.minVerticesValue=new i.Cartesian4(F[0],F[1],F[2],1),g>3&&(r.minVerticesValue.w=F[3]);var M=r.verticesCount;if(s&&(f=new o.Cartographic,u=new o.Cartographic,P=new Float32Array(2*M),c=new Float64Array(2*M)),n.defined(d)){var m=D.array,v=3===g?o.Cartesian3.unpackArray(m):i.Cartesian4.unpackArray(m);for(let t=0,e=v.length;t<e;t++){let e=v[t];o.Cartesian3.m