qa-prevention-gwj-vue/static/map/cesium91/CesiumUnminified/Workers/CylinderGeometry-73e7e8e1.js

2 lines
4.8 KiB
JavaScript

define(["exports","./GeometryOffsetAttribute-ed56ff58","./BoundingSphere-9a3b5656","./Cartesian2-bd414876","./Cartesian3-e0307675","./ComponentDatatype-aaeec80f","./CylinderGeometryLibrary-6ad7b69e","./defaultValue-81eec7ed","./Check-741c5f3c","./GeometryAttribute-2b42a913","./GeometryAttributes-32b29525","./IndexDatatype-3f3c99e8","./Math-e73894ab","./VertexFormat-d50a69ba"],(function(t,e,n,a,o,r,i,s,u,m,c,l,d,p){"use strict";const f=new a.Cartesian2,y=new o.Cartesian3,b=new o.Cartesian3,A=new o.Cartesian3,g=new o.Cartesian3;function h(t){const e=(t=s.defaultValue(t,s.defaultValue.EMPTY_OBJECT)).length,n=t.topRadius,a=t.bottomRadius,o=s.defaultValue(t.vertexFormat,p.VertexFormat.DEFAULT),r=s.defaultValue(t.slices,128);this._length=e,this._topRadius=n,this._bottomRadius=a,this._vertexFormat=p.VertexFormat.clone(o),this._slices=r,this._offsetAttribute=t.offsetAttribute,this._workerName="createCylinderGeometry"}h.packedLength=p.VertexFormat.packedLength+5,h.pack=function(t,e,n){return n=s.defaultValue(n,0),p.VertexFormat.pack(t._vertexFormat,e,n),n+=p.VertexFormat.packedLength,e[n++]=t._length,e[n++]=t._topRadius,e[n++]=t._bottomRadius,e[n++]=t._slices,e[n]=s.defaultValue(t._offsetAttribute,-1),e};const x=new p.VertexFormat,_={vertexFormat:x,length:void 0,topRadius:void 0,bottomRadius:void 0,slices:void 0,offsetAttribute:void 0};let C;h.unpack=function(t,e,n){e=s.defaultValue(e,0);const a=p.VertexFormat.unpack(t,e,x);e+=p.VertexFormat.packedLength;const o=t[e++],r=t[e++],i=t[e++],u=t[e++],m=t[e];return s.defined(n)?(n._vertexFormat=p.VertexFormat.clone(a,n._vertexFormat),n._length=o,n._topRadius=r,n._bottomRadius=i,n._slices=u,n._offsetAttribute=-1===m?void 0:m,n):(_.length=o,_.topRadius=r,_.bottomRadius=i,_.slices=u,_.offsetAttribute=-1===m?void 0:m,new h(_))},h.createGeometry=function(t){let u=t._length;const p=t._topRadius,h=t._bottomRadius,x=t._vertexFormat,_=t._slices;if(u<=0||p<0||h<0||0===p&&0===h)return;const C=_+_,F=_+C,v=C+C,w=i.CylinderGeometryLibrary.computePositions(u,p,h,_,!0),G=x.st?new Float32Array(2*v):void 0,V=x.normal?new Float32Array(3*v):void 0,D=x.tangent?new Float32Array(3*v):void 0,R=x.bitangent?new Float32Array(3*v):void 0;let O;const T=x.normal||x.tangent||x.bitangent;if(T){const t=x.tangent||x.bitangent;let e=0,n=0,a=0;const r=Math.atan2(h-p,u),i=y;i.z=Math.sin(r);const s=Math.cos(r);let m=A,c=b;for(O=0;O<_;O++){const r=O/_*d.CesiumMath.TWO_PI,u=s*Math.cos(r),l=s*Math.sin(r);T&&(i.x=u,i.y=l,t&&(m=o.Cartesian3.normalize(o.Cartesian3.cross(o.Cartesian3.UNIT_Z,i,m),m)),x.normal&&(V[e++]=i.x,V[e++]=i.y,V[e++]=i.z,V[e++]=i.x,V[e++]=i.y,V[e++]=i.z),x.tangent&&(D[n++]=m.x,D[n++]=m.y,D[n++]=m.z,D[n++]=m.x,D[n++]=m.y,D[n++]=m.z),x.bitangent&&(c=o.Cartesian3.normalize(o.Cartesian3.cross(i,m,c),c),R[a++]=c.x,R[a++]=c.y,R[a++]=c.z,R[a++]=c.x,R[a++]=c.y,R[a++]=c.z))}for(O=0;O<_;O++)x.normal&&(V[e++]=0,V[e++]=0,V[e++]=-1),x.tangent&&(D[n++]=1,D[n++]=0,D[n++]=0),x.bitangent&&(R[a++]=0,R[a++]=-1,R[a++]=0);for(O=0;O<_;O++)x.normal&&(V[e++]=0,V[e++]=0,V[e++]=1),x.tangent&&(D[n++]=1,D[n++]=0,D[n++]=0),x.bitangent&&(R[a++]=0,R[a++]=1,R[a++]=0)}const L=12*_-12,P=l.IndexDatatype.createTypedArray(v,L);let k=0,M=0;for(O=0;O<_-1;O++)P[k++]=M,P[k++]=M+2,P[k++]=M+3,P[k++]=M,P[k++]=M+3,P[k++]=M+1,M+=2;for(P[k++]=C-2,P[k++]=0,P[k++]=1,P[k++]=C-2,P[k++]=1,P[k++]=C-1,O=1;O<_-1;O++)P[k++]=C+O+1,P[k++]=C+O,P[k++]=C;for(O=1;O<_-1;O++)P[k++]=F,P[k++]=F+O,P[k++]=F+O+1;let z=0;if(x.st){const t=Math.max(p,h);for(O=0;O<v;O++){const e=o.Cartesian3.fromArray(w,3*O,g);G[z++]=(e.x+t)/(2*t),G[z++]=(e.y+t)/(2*t)}}const E=new c.GeometryAttributes;x.position&&(E.position=new m.GeometryAttribute({componentDatatype:r.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:w})),x.normal&&(E.normal=new m.GeometryAttribute({componentDatatype:r.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:V})),x.tangent&&(E.tangent=new m.GeometryAttribute({componentDatatype:r.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:D})),x.bitangent&&(E.bitangent=new m.GeometryAttribute({componentDatatype:r.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:R})),x.st&&(E.st=new m.GeometryAttribute({componentDatatype:r.ComponentDatatype.FLOAT,componentsPerAttribute:2,values:G})),f.x=.5*u,f.y=Math.max(h,p);const N=new n.BoundingSphere(o.Cartesian3.ZERO,a.Cartesian2.magnitude(f));if(s.defined(t._offsetAttribute)){u=w.length;const n=new Uint8Array(u/3),a=t._offsetAttribute===e.GeometryOffsetAttribute.NONE?0:1;e.arrayFill(n,a),E.applyOffset=new m.GeometryAttribute({componentDatatype:r.ComponentDatatype.UNSIGNED_BYTE,componentsPerAttribute:1,values:n})}return new m.Geometry({attributes:E,indices:P,primitiveType:m.PrimitiveType.TRIANGLES,boundingSphere:N,offsetAttribute:t._offsetAttribute})},h.getUnitCylinder=function(){return s.defined(C)||(C=h.createGeometry(new h({topRadius:1,bottomRadius:1,length:1,vertexFormat:p.VertexFormat.POSITION_ONLY}))),C},t.CylinderGeometry=h}));