bimland/dist/Cesium/Workers/CylinderGeometry-5c5fc56f.js

2 lines
4.8 KiB
JavaScript
Raw Normal View History

2023-07-26 17:04:38 +08:00
define(["exports","./arrayFill-4513d7ad","./buildModuleUrl-4e1b81e7","./Cartesian2-47311507","./Cartographic-3309dd0d","./ComponentDatatype-c140a87d","./CylinderGeometryLibrary-aa453214","./when-b60132fc","./Check-7b2a090c","./GeometryAttribute-3a88ba31","./GeometryAttributes-252e9929","./GeometryOffsetAttribute-fbeb6f1a","./IndexDatatype-8a5eead4","./Math-119be1a3","./PrimitiveType-a54dc62f","./VertexFormat-6446fca0"],(function(t,e,a,r,n,o,i,s,u,m,d,l,p,y,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++],u=t[e++],m=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=u,a._offsetAttribute=-1===m?void 0:m,a):(F.length=n,F.topRadius=o,F.bottomRadius=i,F.slices=u,F.offsetAttribute=-1===m?void 0:m,new x(F))},x.createGeometry=function(t){var u=t._length,b=t._topRadius,x=t._bottomRadius,_=t._vertexFormat,C=t._slices;if(!(u<=0||b<0||x<0||0===b&&0===x)){var F,w=C+C,G=C+w,D=w+w,R=i.CylinderGeometryLibrary.computePositions(u,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 M=_.tangent||_.bitangent,k=0,z=0,E=0,N=Math.atan2(x-b,u),I=v;I.z=Math.sin(N);var U=Math.cos(N),S=g,B=A;for(F=0;F<C;F++){var Y=F/C*y.CesiumMath.TWO_PI,Z=U*Math.cos(Y),J=U*Math.sin(Y);P&&(I.x=Z,I.y=J,M&&(S=n.Cartesian3.normalize(n.Cartesian3.cross(n.Cartesian3.UNIT_Z,I,S),S)),_.normal&&(T[k++]=I.x,T[k++]=I.y,T[k++]=I.z,T[k++]=I.x,T[k++]=I.y,T[k++]=I.z),_.tangent&&(O[z++]=S.x,O[z++]=S.y,O[z++]=S.z,O[z++]=S.x,O[z++]=S.y,O[z++]=S.z),_.bitangent&&(B=n.Cartesian3.normalize(n.Cartesian3.cross(I,S,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[k++]=0,T[k++]=0,T[k++]=-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[k++]=0,T[k++]=0,T[k++]=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=p.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 m.GeometryAttribute({componentDatatype:o.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:R})),_.normal&&($.normal=new m.GeometryAttribute({componentDatatype:o.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:T})),_.tangent&&($.tangent=new m.GeometryAttribute({componentDatatype:o.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:O})),_.bitangent&&($.bitangent=new m.GeometryAttribute({componentDatatype:o.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:L})),_.st&