2 lines
15 KiB
JavaScript
2 lines
15 KiB
JavaScript
|
define(["exports","./arrayFill-4513d7ad","./BoundingSphere-561b54d0","./Cartesian2-47311507","./Cartographic-3309dd0d","./Check-7b2a090c","./ComponentDatatype-c140a87d","./when-b60132fc","./EllipseGeometryLibrary-134c564a","./GeometryAttribute-3a42bbdc","./GeometryAttributes-252e9929","./GeometryInstance-41780fb6","./GeometryOffsetAttribute-fbeb6f1a","./GeometryPipeline-e1b82a4e","./IndexDatatype-8a5eead4","./Math-119be1a3","./PrimitiveType-39acab88","./Transforms-cb0006b0","./VertexFormat-6446fca0"],(function(e,t,r,a,i,n,o,s,l,u,m,p,y,c,d,f,A,h,x){"use strict";var g=new i.Cartesian3,b=new i.Cartesian3,_=new i.Cartesian3,v=new i.Cartesian3,C=new a.Cartesian2,w=new r.Matrix3,M=new r.Matrix3,E=new h.Quaternion,I=new i.Cartesian3,T=new i.Cartesian3,G=new i.Cartesian3,N=new i.Cartographic,P=new i.Cartesian3,F=new a.Cartesian2,V=new a.Cartesian2;function D(e,n,p){var c=n.vertexFormat,d=n.center,f=n.semiMajorAxis,A=n.semiMinorAxis,x=n.ellipsoid,v=n.stRotation,D=p?e.length/3*2:e.length/3,S=n.shadowVolume,O=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=S?new Float32Array(3*D):void 0,z=0,B=I,Y=T,H=G,U=new r.GeographicProjection(x),Q=U.project(x.cartesianToCartographic(d,N),P),W=x.scaleToGeodeticSurface(d,g);x.geodeticSurfaceNormal(W,W);var J=w,q=M;if(0!==v){var Z=h.Quaternion.fromAxisAngle(W,v,E);J=r.Matrix3.fromQuaternion(Z,J),Z=h.Quaternion.fromAxisAngle(W,-v,E),q=r.Matrix3.fromQuaternion(Z,q)}else J=r.Matrix3.clone(r.Matrix3.IDENTITY,J),q=r.Matrix3.clone(r.Matrix3.IDENTITY,q);for(var K=a.Cartesian2.fromElements(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,F),X=a.Cartesian2.fromElements(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,V),$=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,g);if(c.st){var oe=r.Matrix3.multiplyByVector(J,ne,b),se=U.project(x.cartesianToCartographic(oe,N),_);i.Cartesian3.subtract(se,Q,se),C.x=(se.x+f)/(2*f),C.y=(se.y+A)/(2*A),K.x=Math.min(C.x,K.x),K.y=Math.min(C.y,K.y),X.x=Math.max(C.x,X.x),X.y=Math.max(C.y,X.y),p&&(O[z+te]=C.x,O[z+1+te]=C.y),O[z++]=C.x,O[z++]=C.y}(c.normal||c.tangent||c.bitangent||S)&&(B=x.geodeticSurfaceNormal(ne,B),S&&(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),r.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){$=O.length;for(var le=0;le<$;le+=2)O[le]=(O[le]-K.x)/(X.x-K.x),O[le+1]=(O[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:O})),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})),S&&(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,
|