You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2 lines
15 KiB

define(["exports","./when-54c2dc71","./Check-6c0211bc","./Math-fc8cecf5","./Cartesian2-bddc1162","./Transforms-d07bb42c","./ComponentDatatype-6d99a1ee","./GeometryAttribute-be1a3386","./GeometryAttributes-4fcfcf40","./GeometryPipeline-c2d75081","./IndexDatatype-53503fee","./GeometryOffsetAttribute-7350d9af","./VertexFormat-7572c785","./EllipseGeometryLibrary-55d6b793","./GeometryInstance-161eaba2"],function(t,L,e,c,R,j,k,z,B,m,p,Y,d,H,y){"use strict";var U=new R.Cartesian3,Q=new R.Cartesian3,W=new R.Cartesian3,S=new R.Cartesian3,J=new R.Cartesian2,q=new j.Matrix3,Z=new j.Matrix3,K=new j.Quaternion,X=new R.Cartesian3,$=new R.Cartesian3,tt=new R.Cartesian3,et=new R.Cartographic,rt=new R.Cartesian3,at=new R.Cartesian2,it=new R.Cartesian2;function f(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,c=a.st?new Float32Array(2*l):void 0,p=a.normal?new Float32Array(3*l):void 0,y=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=X,x=$,g=tt,_=new j.GeographicProjection(s),b=_.project(s.cartesianToCartographic(i,et),rt),i=s.scaleToGeodeticSurface(i,U);s.geodeticSurfaceNormal(i,i);var C=q,v=Z;v=0!==u?(S=j.Quaternion.fromAxisAngle(i,u,K),C=j.Matrix3.fromQuaternion(S,C),S=j.Quaternion.fromAxisAngle(i,-u,K),j.Matrix3.fromQuaternion(S,v)):(C=j.Matrix3.clone(j.Matrix3.IDENTITY,C),j.Matrix3.clone(j.Matrix3.IDENTITY,v));for(var w=R.Cartesian2.fromElements(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,at),M=R.Cartesian2.fromElements(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,it),E=t.length,I=r?E:0,T=I/3*2,G=0;G<E;G+=3){var N,P=G+1,F=G+2,V=R.Cartesian3.fromArray(t,G,U);a.st&&(N=j.Matrix3.multiplyByVector(C,V,Q),N=_.project(s.cartesianToCartographic(N,et),W),R.Cartesian3.subtract(N,b,N),J.x=(N.x+n)/(2*n),J.y=(N.y+o)/(2*o),w.x=Math.min(J.x,w.x),w.y=Math.min(J.y,w.y),M.x=Math.max(J.x,M.x),M.y=Math.max(J.y,M.y),r&&(c[A+T]=J.x,c[A+1+T]=J.y),c[A++]=J.x,c[A++]=J.y),(a.normal||a.tangent||a.bitangent||m)&&(h=s.geodeticSurfaceNormal(V,h),m&&(f[G+I]=-h.x,f[P+I]=-h.y,f[F+I]=-h.z),(a.normal||a.tangent||a.bitangent)&&((a.tangent||a.bitangent)&&(x=R.Cartesian3.normalize(R.Cartesian3.cross(R.Cartesian3.UNIT_Z,h,x),x),j.Matrix3.multiplyByVector(v,x,x)),a.normal&&(p[G]=h.x,p[P]=h.y,p[F]=h.z,r&&(p[G+I]=-h.x,p[P+I]=-h.y,p[F+I]=-h.z)),a.tangent&&(y[G]=x.x,y[P]=x.y,y[F]=x.z,r&&(y[G+I]=-x.x,y[P+I]=-x.y,y[F+I]=-x.z)),a.bitangent&&(g=R.Cartesian3.normalize(R.Cartesian3.cross(h,x,g),g),d[G]=g.x,d[P]=g.y,d[F]=g.z,r&&(d[G+I]=g.x,d[P+I]=g.y,d[F+I]=g.z))))}if(a.st){E=c.length;for(var D=0;D<E;D+=2)c[D]=(c[D]-w.x)/(M.x-w.x),c[D+1]=(c[D+1]-w.y)/(M.y-w.y)}var O,S=new B.GeometryAttributes;return a.position&&(O=H.EllipseGeometryLibrary.raisePositionsToHeight(t,e,r),S.position=new z.GeometryAttribute({componentDatatype:k.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:O})),a.st&&(S.st=new z.GeometryAttribute({componentDatatype:k.ComponentDatatype.FLOAT,componentsPerAttribute:2,values:c})),a.normal&&(S.normal=new z.GeometryAttribute({componentDatatype:k.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:p})),a.tangent&&(S.tangent=new z.GeometryAttribute({componentDatatype:k.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:y})),a.bitangent&&(S.bitangent=new z.GeometryAttribute({componentDatatype:k.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:d})),m&&(S.extrudeDirection=new z.GeometryAttribute({componentDatatype:k.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:f})),r&&L.defined(e.offsetAttribute)&&(O=new Uint8Array(l),O=e.offsetAttribute===Y.GeometryOffsetAttribute.TOP?Y.arrayFill(O,1,0,l/2):(e=e.offsetAttribute===Y.GeometryOffsetAttribute.NONE?0:1,Y.arrayFill(O,e)),S.applyOffset=new z.GeometryAttribute({componentDatatype:k.ComponentDatatype.UNSIGNED_BYTE,componentsPerAttribute:1,values:O})),S}function A(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,n=(s-1)*s-1,a[i++]=o++,a[i++]=n