锦水三维代码
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

2 years ago
define(["exports","./GeometryOffsetAttribute-def3b741","./Transforms-a73b3b3b","./Cartesian2-8417ca3d","./Check-d18af7c4","./ComponentDatatype-9204e9f6","./when-208fe5b0","./EllipseGeometryLibrary-2412418f","./GeometryAttribute-04a19cfe","./GeometryAttributes-b0b294d8","./GeometryInstance-d919cab6","./GeometryPipeline-5e672526","./IndexDatatype-d47ad6f6","./Math-4e53b694","./VertexFormat-e8cbf5b3"],function(t,L,R,j,e,k,z,B,Y,H,m,p,y,c,d){"use strict";var U=new j.Cartesian3,Q=new j.Cartesian3,W=new j.Cartesian3,S=new j.Cartesian3,J=new j.Cartesian2,q=new R.Matrix3,Z=new R.Matrix3,K=new R.Quaternion,X=new j.Cartesian3,$=new j.Cartesian3,tt=new j.Cartesian3,et=new j.Cartographic,rt=new j.Cartesian3,at=new j.Cartesian2,it=new j.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,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=X,x=$,g=tt,b=new R.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=R.Quaternion.fromAxisAngle(i,u,K),C=R.Matrix3.fromQuaternion(S,C),S=R.Quaternion.fromAxisAngle(i,-u,K),R.Matrix3.fromQuaternion(S,v)):(C=R.Matrix3.clone(R.Matrix3.IDENTITY,C),R.Matrix3.clone(R.Matrix3.IDENTITY,v));for(var w=j.Cartesian2.fromElements(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,at),M=j.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=j.Cartesian3.fromArray(t,G,U);a.st&&(N=R.Matrix3.multiplyByVector(C,V,Q),N=b.project(s.cartesianToCartographic(N,et),W),j.Cartesian3.subtract(N,_,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&&(p[A+T]=J.x,p[A+1+T]=J.y),p[A++]=J.x,p[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=j.Cartesian3.normalize(j.Cartesian3.cross(j.Cartesian3.UNIT_Z,h,x),x),R.Matrix3.multiplyByVector(v,x,x)),a.normal&&(y[G]=h.x,y[P]=h.y,y[F]=h.z,r&&(y[G+I]=-h.x,y[P+I]=-h.y,y[F+I]=-h.z)),a.tangent&&(c[G]=x.x,c[P]=x.y,c[F]=x.z,r&&(c[G+I]=-x.x,c[P+I]=-x.y,c[F+I]=-x.z)),a.bitangent&&(g=j.Cartesian3.normalize(j.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)for(var E=p.length,D=0;D<E;D+=2)p[D]=(p[D]-w.x)/(M.x-w.x),p[D+1]=(p[D+1]-w.y)/(M.y-w.y);var O,S=new H.GeometryAttributes;return a.position&&(O=B.EllipseGeometryLibrary.raisePositionsToHeight(t,e,r),S.position=new Y.GeometryAttribute({componentDatatype:k.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:O})),a.st&&(S.st=new Y.GeometryAttribute({componentDatatype:k.ComponentDatatype.FLOAT,componentsPerAttribute:2,values:p})),a.normal&&(S.normal=new Y.GeometryAttribute({componentDatatype:k.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:y})),a.tangent&&(S.tangent=new Y.GeometryAttribute({componentDatatype:k.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:c})),a.bitangent&&(S.bitangent=new Y.GeometryAttribute({componentDatatype:k.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:d})),m&&(S.extrudeDirection=new Y.GeometryAttribute({componentDatatype:k.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:f})),r&&z.defined(e.offsetAttribute)&&(O=new Uint8Array(l),O=e.offsetAttribute===L.GeometryOffsetAttribute.TOP?L.arrayFill(O,1,0,l/2):(e=e.offsetAttribute===L.GeometryOffsetAttribute.NONE?0:1,L.arrayFill(O,e)),S.applyOffset=new Y.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,