2 lines
6.5 KiB
JavaScript
2 lines
6.5 KiB
JavaScript
|
define(["./arrayRemoveDuplicates-cea3b206","./BoundingRectangle-0e36efc3","./BoundingSphere-9a3b5656","./Cartesian2-bd414876","./Cartesian3-e0307675","./Check-741c5f3c","./ComponentDatatype-aaeec80f","./CoplanarPolygonGeometryLibrary-08d616f3","./defaultValue-81eec7ed","./GeometryAttribute-2b42a913","./GeometryAttributes-32b29525","./GeometryInstance-1b39c9e8","./GeometryPipeline-e7083fea","./IndexDatatype-3f3c99e8","./Math-e73894ab","./Matrix4-4c545f70","./PolygonGeometryLibrary-231711c2","./PolygonPipeline-04baeb41","./Transforms-5b829630","./VertexFormat-d50a69ba","./GeographicProjection-c931c7fb","./Rectangle-cf3e0e3e","./WebGLConstants-508b9636","./OrientedBoundingBox-c5d2adb7","./EllipsoidTangentPlane-4d138901","./AxisAlignedBoundingBox-8774439c","./IntersectionTests-80510c7b","./Plane-bc8b6777","./Matrix2-dc0c61cc","./AttributeCompression-8f752c03","./EncodedCartesian3-aafcc30f","./RuntimeError-26acdd3b","./ArcType-fc72c06c","./EllipsoidRhumbLine-592e8885","./when-422ea0ae","./Resource-8ae1a924","./combine-3c023bda"],(function(e,t,n,o,a,r,i,s,l,c,p,y,u,m,d,g,b,h,f,C,x,P,A,w,F,G,L,E,v,T,D,V,_,k,R,M,B){"use strict";const I=new a.Cartesian3,H=new t.BoundingRectangle,O=new o.Cartesian2,S=new o.Cartesian2,z=new a.Cartesian3,N=new a.Cartesian3,Q=new a.Cartesian3,j=new a.Cartesian3,U=new a.Cartesian3,Y=new a.Cartesian3,q=new f.Quaternion,J=new g.Matrix3,W=new g.Matrix3,Z=new a.Cartesian3;function K(e,t,n,r,s,l,y,u){const b=e.positions;let C=h.PolygonPipeline.triangulate(e.positions2D,e.holes);C.length<3&&(C=[0,1,2]);const x=m.IndexDatatype.createTypedArray(b.length,C.length);x.set(C);let P=J;if(0!==r){let e=f.Quaternion.fromAxisAngle(l,r,q);if(P=g.Matrix3.fromQuaternion(e,P),t.tangent||t.bitangent){e=f.Quaternion.fromAxisAngle(l,-r,q);const n=g.Matrix3.fromQuaternion(e,W);y=a.Cartesian3.normalize(g.Matrix3.multiplyByVector(n,y,y),y),t.bitangent&&(u=a.Cartesian3.normalize(a.Cartesian3.cross(l,y,u),u))}}else P=g.Matrix3.clone(g.Matrix3.IDENTITY,P);const A=S;t.st&&(A.x=n.x,A.y=n.y);const w=b.length,F=3*w,G=new Float64Array(F),L=t.normal?new Float32Array(F):void 0,E=t.tangent?new Float32Array(F):void 0,v=t.bitangent?new Float32Array(F):void 0,T=t.st?new Float32Array(2*w):void 0;let D=0,V=0,_=0,k=0,R=0;for(let e=0;e<w;e++){const a=b[e];if(G[D++]=a.x,G[D++]=a.y,G[D++]=a.z,t.st){const e=s(g.Matrix3.multiplyByVector(P,a,I),O);o.Cartesian2.subtract(e,A,e);const t=d.CesiumMath.clamp(e.x/n.width,0,1),r=d.CesiumMath.clamp(e.y/n.height,0,1);T[R++]=t,T[R++]=r}t.normal&&(L[V++]=l.x,L[V++]=l.y,L[V++]=l.z),t.tangent&&(E[k++]=y.x,E[k++]=y.y,E[k++]=y.z),t.bitangent&&(v[_++]=u.x,v[_++]=u.y,v[_++]=u.z)}const M=new p.GeometryAttributes;return t.position&&(M.position=new c.GeometryAttribute({componentDatatype:i.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:G})),t.normal&&(M.normal=new c.GeometryAttribute({componentDatatype:i.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:L})),t.tangent&&(M.tangent=new c.GeometryAttribute({componentDatatype:i.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:E})),t.bitangent&&(M.bitangent=new c.GeometryAttribute({componentDatatype:i.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:v})),t.st&&(M.st=new c.GeometryAttribute({componentDatatype:i.ComponentDatatype.FLOAT,componentsPerAttribute:2,values:T})),new c.Geometry({attributes:M,indices:x,primitiveType:c.PrimitiveType.TRIANGLES})}function X(e){const t=(e=l.defaultValue(e,l.defaultValue.EMPTY_OBJECT)).polygonHierarchy,n=l.defaultValue(e.vertexFormat,C.VertexFormat.DEFAULT);this._vertexFormat=C.VertexFormat.clone(n),this._polygonHierarchy=t,this._stRotation=l.defaultValue(e.stRotation,0),this._ellipsoid=o.Ellipsoid.clone(l.defaultValue(e.ellipsoid,o.Ellipsoid.WGS84)),this._workerName="createCoplanarPolygonGeometry",this.packedLength=b.PolygonGeometryLibrary.computeHierarchyPackedLength(t)+C.VertexFormat.packedLength+o.Ellipsoid.packedLength+2}X.fromPositions=function(e){return new X({polygonHierarchy:{positions:(e=l.defaultValue(e,l.defaultValue.EMPTY_OBJECT)).positions},vertexFormat:e.vertexFormat,stRotation:e.stRotation,ellips
|