2 lines
15 KiB
JavaScript
2 lines
15 KiB
JavaScript
|
define(["exports","./when-cbf8cd21","./Check-35e1a91d","./Math-e66fad2a","./Cartesian2-44433f55","./Transforms-d9350502","./ComponentDatatype-7ee14e67","./GeometryAttribute-424f2c6a","./GeometryAttributes-90846c5f","./GeometryPipeline-5896d55c","./IndexDatatype-66caba23","./GeometryOffsetAttribute-84f7eff3","./VertexFormat-cc24f342","./EllipseGeometryLibrary-62962323","./GeometryInstance-505d80ea"],function(t,U,e,y,Q,W,J,q,Z,b,C,K,f,B,v){"use strict";var X=new Q.Cartesian3,$=new Q.Cartesian3,tt=new Q.Cartesian3,et=new Q.Cartesian3,rt=new Q.Cartesian2,at=new W.Matrix3,Y=new W.Matrix3,it=new W.Quaternion,nt=new Q.Cartesian3,ot=new Q.Cartesian3,st=new Q.Cartesian3,ut=new Q.Cartographic,lt=new Q.Cartesian3,mt=new Q.Cartesian2,pt=new Q.Cartesian2;function w(t,e,r){var a=e.vertexFormat,i=e.center,n=e.semiMajorAxis,o=e.semiMinorAxis,s=e.ellipsoid,u=e.stRotation,l=r?t.length/3*2:t.length/3,m=e.shadowVolume,p=a.st?new Float32Array(2*l):void 0,y=a.normal?new Float32Array(3*l):void 0,c=a.tangent?new Float32Array(3*l):void 0,d=a.bitangent?new Float32Array(3*l):void 0,f=m?new Float32Array(3*l):void 0,A=0,h=nt,x=ot,g=st,_=new W.GeographicProjection(s),b=_.project(s.cartesianToCartographic(i,ut),lt),C=s.scaleToGeodeticSurface(i,X);s.geodeticSurfaceNormal(C,C);var v,w=at,M=Y;M=0!==u?(v=W.Quaternion.fromAxisAngle(C,u,it),w=W.Matrix3.fromQuaternion(v,w),v=W.Quaternion.fromAxisAngle(C,-u,it),W.Matrix3.fromQuaternion(v,M)):(w=W.Matrix3.clone(W.Matrix3.IDENTITY,w),W.Matrix3.clone(W.Matrix3.IDENTITY,M));for(var E=Q.Cartesian2.fromElements(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,mt),I=Q.Cartesian2.fromElements(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,pt),T=t.length,G=r?T:0,N=G/3*2,P=0;P<T;P+=3){var F,V,D=P+1,O=P+2,S=Q.Cartesian3.fromArray(t,P,X);a.st&&(F=W.Matrix3.multiplyByVector(w,S,$),V=_.project(s.cartesianToCartographic(F,ut),tt),Q.Cartesian3.subtract(V,b,V),rt.x=(V.x+n)/(2*n),rt.y=(V.y+o)/(2*o),E.x=Math.min(rt.x,E.x),E.y=Math.min(rt.y,E.y),I.x=Math.max(rt.x,I.x),I.y=Math.max(rt.y,I.y),r&&(p[A+N]=rt.x,p[A+1+N]=rt.y),p[A++]=rt.x,p[A++]=rt.y),(a.normal||a.tangent||a.bitangent||m)&&(h=s.geodeticSurfaceNormal(S,h),m&&(f[P+G]=-h.x,f[D+G]=-h.y,f[O+G]=-h.z),(a.normal||a.tangent||a.bitangent)&&((a.tangent||a.bitangent)&&(x=Q.Cartesian3.normalize(Q.Cartesian3.cross(Q.Cartesian3.UNIT_Z,h,x),x),W.Matrix3.multiplyByVector(M,x,x)),a.normal&&(y[P]=h.x,y[D]=h.y,y[O]=h.z,r&&(y[P+G]=-h.x,y[D+G]=-h.y,y[O+G]=-h.z)),a.tangent&&(c[P]=x.x,c[D]=x.y,c[O]=x.z,r&&(c[P+G]=-x.x,c[D+G]=-x.y,c[O+G]=-x.z)),a.bitangent&&(g=Q.Cartesian3.normalize(Q.Cartesian3.cross(h,x,g),g),d[P]=g.x,d[D]=g.y,d[O]=g.z,r&&(d[P+G]=g.x,d[D+G]=g.y,d[O+G]=g.z))))}if(a.st){T=p.length;for(var L=0;L<T;L+=2)p[L]=(p[L]-E.x)/(I.x-E.x),p[L+1]=(p[L+1]-E.y)/(I.y-E.y)}var R,j,k,z=new Z.GeometryAttributes;return a.position&&(R=B.EllipseGeometryLibrary.raisePositionsToHeight(t,e,r),z.position=new q.GeometryAttribute({componentDatatype:J.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:R})),a.st&&(z.st=new q.GeometryAttribute({componentDatatype:J.ComponentDatatype.FLOAT,componentsPerAttribute:2,values:p})),a.normal&&(z.normal=new q.GeometryAttribute({componentDatatype:J.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:y})),a.tangent&&(z.tangent=new q.GeometryAttribute({componentDatatype:J.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:c})),a.bitangent&&(z.bitangent=new q.GeometryAttribute({componentDatatype:J.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:d})),m&&(z.extrudeDirection=new q.GeometryAttribute({componentDatatype:J.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:f})),r&&U.defined(e.offsetAttribute)&&(k=new Uint8Array(l),k=e.offsetAttribute===K.GeometryOffsetAttribute.TOP?K.arrayFill(k,1,0,l/2):(j=e.offsetAttribute===K.GeometryOffsetAttribute.NONE?0:1,K.arrayFill(k,j)),z.applyOffset=new q.GeometryAttribute({componentDatatype:J.ComponentDatatype.UNSIGNED_BYTE,componentsPerAttribute:1,values:k})),z}function M(t){for(var e,r,a=new Array(t*(t+1)*12-6),i=0,n=0,o=1,s=0;s<3;s++)a[i++]=o++,a[i++]=n,a[i++]=o;for(s=2;s<t+1;++s){for(o=s*(s+1)-1,
|