2 lines
15 KiB
JavaScript
2 lines
15 KiB
JavaScript
|
define(["exports","./arrayFill-4513d7ad","./buildModuleUrl-4e1b81e7","./Cartesian2-47311507","./Cartographic-3309dd0d","./Check-7b2a090c","./ComponentDatatype-c140a87d","./when-b60132fc","./EllipseGeometryLibrary-96261ee5","./GeometryAttribute-3a88ba31","./GeometryAttributes-252e9929","./GeometryInstance-68aae013","./GeometryOffsetAttribute-fbeb6f1a","./GeometryPipeline-9d1ef0b6","./IndexDatatype-8a5eead4","./Math-119be1a3","./PrimitiveType-a54dc62f","./VertexFormat-6446fca0"],(function(e,t,r,a,i,n,o,s,l,u,m,p,y,c,d,f,A,h){"use strict";var x=new i.Cartesian3,g=new i.Cartesian3,_=new i.Cartesian3,b=new i.Cartesian3,v=new a.Cartesian2,C=new A.Matrix3,w=new A.Matrix3,M=new u.Quaternion,E=new i.Cartesian3,I=new i.Cartesian3,T=new i.Cartesian3,G=new i.Cartographic,N=new i.Cartesian3,P=new a.Cartesian2,F=new a.Cartesian2;function V(e,n,p){var c=n.vertexFormat,d=n.center,f=n.semiMajorAxis,h=n.semiMinorAxis,b=n.ellipsoid,V=n.stRotation,D=p?e.length/3*2:e.length/3,O=n.shadowVolume,S=c.st?new Float32Array(2*D):void 0,L=c.normal?new Float32Array(3*D):void 0,R=c.tangent?new Float32Array(3*D):void 0,j=c.bitangent?new Float32Array(3*D):void 0,k=O?new Float32Array(3*D):void 0,z=0,B=E,Y=I,H=T,U=new r.GeographicProjection(b),Q=U.project(b.cartesianToCartographic(d,G),N),W=b.scaleToGeodeticSurface(d,x);b.geodeticSurfaceNormal(W,W);var J=C,q=w;if(0!==V){var Z=u.Quaternion.fromAxisAngle(W,V,M);J=A.Matrix3.fromQuaternion(Z,J),Z=u.Quaternion.fromAxisAngle(W,-V,M),q=A.Matrix3.fromQuaternion(Z,q)}else J=A.Matrix3.clone(A.Matrix3.IDENTITY,J),q=A.Matrix3.clone(A.Matrix3.IDENTITY,q);for(var K=a.Cartesian2.fromElements(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,P),X=a.Cartesian2.fromElements(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,F),$=e.length,ee=p?$:0,te=ee/3*2,re=0;re<$;re+=3){var ae=re+1,ie=re+2,ne=i.Cartesian3.fromArray(e,re,x);if(c.st){var oe=A.Matrix3.multiplyByVector(J,ne,g),se=U.project(b.cartesianToCartographic(oe,G),_);i.Cartesian3.subtract(se,Q,se),v.x=(se.x+f)/(2*f),v.y=(se.y+h)/(2*h),K.x=Math.min(v.x,K.x),K.y=Math.min(v.y,K.y),X.x=Math.max(v.x,X.x),X.y=Math.max(v.y,X.y),p&&(S[z+te]=v.x,S[z+1+te]=v.y),S[z++]=v.x,S[z++]=v.y}(c.normal||c.tangent||c.bitangent||O)&&(B=b.geodeticSurfaceNormal(ne,B),O&&(k[re+ee]=-B.x,k[ae+ee]=-B.y,k[ie+ee]=-B.z),(c.normal||c.tangent||c.bitangent)&&((c.tangent||c.bitangent)&&(Y=i.Cartesian3.normalize(i.Cartesian3.cross(i.Cartesian3.UNIT_Z,B,Y),Y),A.Matrix3.multiplyByVector(q,Y,Y)),c.normal&&(L[re]=B.x,L[ae]=B.y,L[ie]=B.z,p&&(L[re+ee]=-B.x,L[ae+ee]=-B.y,L[ie+ee]=-B.z)),c.tangent&&(R[re]=Y.x,R[ae]=Y.y,R[ie]=Y.z,p&&(R[re+ee]=-Y.x,R[ae+ee]=-Y.y,R[ie+ee]=-Y.z)),c.bitangent&&(H=i.Cartesian3.normalize(i.Cartesian3.cross(B,Y,H),H),j[re]=H.x,j[ae]=H.y,j[ie]=H.z,p&&(j[re+ee]=H.x,j[ae+ee]=H.y,j[ie+ee]=H.z))))}if(c.st){$=S.length;for(var le=0;le<$;le+=2)S[le]=(S[le]-K.x)/(X.x-K.x),S[le+1]=(S[le+1]-K.y)/(X.y-K.y)}var ue=new m.GeometryAttributes;if(c.position){var me=l.EllipseGeometryLibrary.raisePositionsToHeight(e,n,p);ue.position=new u.GeometryAttribute({componentDatatype:o.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:me})}if(c.st&&(ue.st=new u.GeometryAttribute({componentDatatype:o.ComponentDatatype.FLOAT,componentsPerAttribute:2,values:S})),c.normal&&(ue.normal=new u.GeometryAttribute({componentDatatype:o.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:L})),c.tangent&&(ue.tangent=new u.GeometryAttribute({componentDatatype:o.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:R})),c.bitangent&&(ue.bitangent=new u.GeometryAttribute({componentDatatype:o.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:j})),O&&(ue.extrudeDirection=new u.GeometryAttribute({componentDatatype:o.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:k})),p&&s.defined(n.offsetAttribute)){var pe=new Uint8Array(D);if(n.offsetAttribute===y.GeometryOffsetAttribute.TOP)pe=t.arrayFill(pe,1,0,D/2);else{var ye=n.offsetAttribute===y.GeometryOffsetAttribute.NONE?0:1;pe=t.arrayFill(pe,ye)}ue.applyOffset=new u.GeometryAttribute({componentDatatype:o.ComponentDatatype.UNSIGNED_BYTE,componentsPerAttribute:1,v
|