Agriculture-front-end/public/Cesium/Workers/CylinderGeometry-3c6f6674.js

2 lines
4.8 KiB
JavaScript
Raw Normal View History

2023-04-16 22:33:44 +08:00
define(["exports","./arrayFill-4513d7ad","./BoundingSphere-561b54d0","./Cartesian2-47311507","./Cartographic-3309dd0d","./ComponentDatatype-c140a87d","./CylinderGeometryLibrary-aa453214","./when-b60132fc","./Check-7b2a090c","./GeometryAttribute-3a42bbdc","./GeometryAttributes-252e9929","./GeometryOffsetAttribute-fbeb6f1a","./IndexDatatype-8a5eead4","./Math-119be1a3","./PrimitiveType-39acab88","./VertexFormat-6446fca0"],(function(t,e,a,r,n,o,i,s,m,u,d,p,y,l,f,b){"use strict";var c=new r.Cartesian2,v=new n.Cartesian3,A=new n.Cartesian3,g=new n.Cartesian3,h=new n.Cartesian3;function x(t){var e=(t=s.defaultValue(t,s.defaultValue.EMPTY_OBJECT)).length,a=t.topRadius,r=t.bottomRadius,n=s.defaultValue(t.vertexFormat,b.VertexFormat.DEFAULT),o=s.defaultValue(t.slices,128);this._length=e,this._topRadius=a,this._bottomRadius=r,this._vertexFormat=b.VertexFormat.clone(n),this._slices=o,this._offsetAttribute=t.offsetAttribute,this._workerName="createCylinderGeometry"}x.packedLength=b.VertexFormat.packedLength+5,x.pack=function(t,e,a){return a=s.defaultValue(a,0),b.VertexFormat.pack(t._vertexFormat,e,a),a+=b.VertexFormat.packedLength,e[a++]=t._length,e[a++]=t._topRadius,e[a++]=t._bottomRadius,e[a++]=t._slices,e[a]=s.defaultValue(t._offsetAttribute,-1),e};var _,C=new b.VertexFormat,F={vertexFormat:C,length:void 0,topRadius:void 0,bottomRadius:void 0,slices:void 0,offsetAttribute:void 0};x.unpack=function(t,e,a){e=s.defaultValue(e,0);var r=b.VertexFormat.unpack(t,e,C);e+=b.VertexFormat.packedLength;var n=t[e++],o=t[e++],i=t[e++],m=t[e++],u=t[e];return s.defined(a)?(a._vertexFormat=b.VertexFormat.clone(r,a._vertexFormat),a._length=n,a._topRadius=o,a._bottomRadius=i,a._slices=m,a._offsetAttribute=-1===u?void 0:u,a):(F.length=n,F.topRadius=o,F.bottomRadius=i,F.slices=m,F.offsetAttribute=-1===u?void 0:u,new x(F))},x.createGeometry=function(t){var m=t._length,b=t._topRadius,x=t._bottomRadius,_=t._vertexFormat,C=t._slices;if(!(m<=0||b<0||x<0||0===b&&0===x)){var F,w=C+C,G=C+w,D=w+w,R=i.CylinderGeometryLibrary.computePositions(m,b,x,C,!0),V=_.st?new Float32Array(2*D):void 0,T=_.normal?new Float32Array(3*D):void 0,O=_.tangent?new Float32Array(3*D):void 0,L=_.bitangent?new Float32Array(3*D):void 0,P=_.normal||_.tangent||_.bitangent;if(P){var k=_.tangent||_.bitangent,M=0,z=0,E=0,N=Math.atan2(x-b,m),I=v;I.z=Math.sin(N);var S=Math.cos(N),U=g,B=A;for(F=0;F<C;F++){var Y=F/C*l.CesiumMath.TWO_PI,Z=S*Math.cos(Y),J=S*Math.sin(Y);P&&(I.x=Z,I.y=J,k&&(U=n.Cartesian3.normalize(n.Cartesian3.cross(n.Cartesian3.UNIT_Z,I,U),U)),_.normal&&(T[M++]=I.x,T[M++]=I.y,T[M++]=I.z,T[M++]=I.x,T[M++]=I.y,T[M++]=I.z),_.tangent&&(O[z++]=U.x,O[z++]=U.y,O[z++]=U.z,O[z++]=U.x,O[z++]=U.y,O[z++]=U.z),_.bitangent&&(B=n.Cartesian3.normalize(n.Cartesian3.cross(I,U,B),B),L[E++]=B.x,L[E++]=B.y,L[E++]=B.z,L[E++]=B.x,L[E++]=B.y,L[E++]=B.z))}for(F=0;F<C;F++)_.normal&&(T[M++]=0,T[M++]=0,T[M++]=-1),_.tangent&&(O[z++]=1,O[z++]=0,O[z++]=0),_.bitangent&&(L[E++]=0,L[E++]=-1,L[E++]=0);for(F=0;F<C;F++)_.normal&&(T[M++]=0,T[M++]=0,T[M++]=1),_.tangent&&(O[z++]=1,O[z++]=0,O[z++]=0),_.bitangent&&(L[E++]=0,L[E++]=1,L[E++]=0)}var W=12*C-12,j=y.IndexDatatype.createTypedArray(D,W),q=0,H=0;for(F=0;F<C-1;F++)j[q++]=H,j[q++]=H+2,j[q++]=H+3,j[q++]=H,j[q++]=H+3,j[q++]=H+1,H+=2;for(j[q++]=w-2,j[q++]=0,j[q++]=1,j[q++]=w-2,j[q++]=1,j[q++]=w-1,F=1;F<C-1;F++)j[q++]=w+F+1,j[q++]=w+F,j[q++]=w;for(F=1;F<C-1;F++)j[q++]=G,j[q++]=G+F,j[q++]=G+F+1;var K=0;if(_.st){var Q=Math.max(b,x);for(F=0;F<D;F++){var X=n.Cartesian3.fromArray(R,3*F,h);V[K++]=(X.x+Q)/(2*Q),V[K++]=(X.y+Q)/(2*Q)}}var $=new d.GeometryAttributes;_.position&&($.position=new u.GeometryAttribute({componentDatatype:o.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:R})),_.normal&&($.normal=new u.GeometryAttribute({componentDatatype:o.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:T})),_.tangent&&($.tangent=new u.GeometryAttribute({componentDatatype:o.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:O})),_.bitangent&&($.bitangent=new u.GeometryAttribute({componentDatatype:o.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:L})),_.st&