2 lines
6.3 KiB
JavaScript
2 lines
6.3 KiB
JavaScript
|
define(["./arrayRemoveDuplicates-85770175","./BoundingRectangle-b88064b7","./Transforms-98ffa11d","./Matrix2-e3fb4559","./Cartesian3-7e9cc2ff","./Check-741c5f3c","./ComponentDatatype-aaeec80f","./CoplanarPolygonGeometryLibrary-d95ab18f","./defaultValue-81eec7ed","./GeometryAttribute-b025f9a8","./GeometryAttributes-32b29525","./GeometryInstance-ce434bcb","./GeometryPipeline-4b426993","./IndexDatatype-f1e3f799","./Math-5f585871","./Matrix4-d34187af","./PolygonGeometryLibrary-8f834b9d","./PolygonPipeline-6f83d8b1","./VertexFormat-d50a69ba","./_commonjsHelpers-3aae1032-26891ab7","./combine-3c023bda","./RuntimeError-26acdd3b","./WebGLConstants-508b9636","./OrientedBoundingBox-3db45505","./EllipsoidTangentPlane-fa1337e1","./AxisAlignedBoundingBox-37250ed6","./IntersectionTests-73b87d72","./Plane-4f75b3df","./AttributeCompression-e2e3f0dd","./EncodedCartesian3-aac44514","./ArcType-fc72c06c","./EllipsoidRhumbLine-9c6b32ea"],(function(e,t,n,o,a,r,i,s,l,c,p,y,u,m,d,g,b,f,h,x,C,P,A,w,F,G,L,E,v,T,D,_){"use strict";const V=new a.Cartesian3,k=new t.BoundingRectangle,R=new o.Cartesian2,M=new o.Cartesian2,I=new a.Cartesian3,B=new a.Cartesian3,H=new a.Cartesian3,O=new a.Cartesian3,z=new a.Cartesian3,S=new a.Cartesian3,N=new n.Quaternion,Q=new g.Matrix3,j=new g.Matrix3,U=new a.Cartesian3;function Y(e,t,r,s,l,y,u,b){const h=e.positions;let x=f.PolygonPipeline.triangulate(e.positions2D,e.holes);x.length<3&&(x=[0,1,2]);const C=m.IndexDatatype.createTypedArray(h.length,x.length);C.set(x);let P=Q;if(0!==s){let e=n.Quaternion.fromAxisAngle(y,s,N);if(P=g.Matrix3.fromQuaternion(e,P),t.tangent||t.bitangent){e=n.Quaternion.fromAxisAngle(y,-s,N);const o=g.Matrix3.fromQuaternion(e,j);u=a.Cartesian3.normalize(g.Matrix3.multiplyByVector(o,u,u),u),t.bitangent&&(b=a.Cartesian3.normalize(a.Cartesian3.cross(y,u,b),b))}}else P=g.Matrix3.clone(g.Matrix3.IDENTITY,P);const A=M;t.st&&(A.x=r.x,A.y=r.y);const w=h.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,_=0,k=0,I=0,B=0;for(let e=0;e<w;e++){const n=h[e];if(G[D++]=n.x,G[D++]=n.y,G[D++]=n.z,t.st){const e=l(g.Matrix3.multiplyByVector(P,n,V),R);o.Cartesian2.subtract(e,A,e);const t=d.CesiumMath.clamp(e.x/r.width,0,1),a=d.CesiumMath.clamp(e.y/r.height,0,1);T[B++]=t,T[B++]=a}t.normal&&(L[_++]=y.x,L[_++]=y.y,L[_++]=y.z),t.tangent&&(E[I++]=u.x,E[I++]=u.y,E[I++]=u.z),t.bitangent&&(v[k++]=b.x,v[k++]=b.y,v[k++]=b.z)}const H=new p.GeometryAttributes;return t.position&&(H.position=new c.GeometryAttribute({componentDatatype:i.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:G})),t.normal&&(H.normal=new c.GeometryAttribute({componentDatatype:i.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:L})),t.tangent&&(H.tangent=new c.GeometryAttribute({componentDatatype:i.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:E})),t.bitangent&&(H.bitangent=new c.GeometryAttribute({componentDatatype:i.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:v})),t.st&&(H.st=new c.GeometryAttribute({componentDatatype:i.ComponentDatatype.FLOAT,componentsPerAttribute:2,values:T})),new c.Geometry({attributes:H,indices:C,primitiveType:c.PrimitiveType.TRIANGLES})}function q(e){const t=(e=l.defaultValue(e,l.defaultValue.EMPTY_OBJECT)).polygonHierarchy,n=l.defaultValue(e.vertexFormat,h.VertexFormat.DEFAULT);this._vertexFormat=h.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)+h.VertexFormat.packedLength+o.Ellipsoid.packedLength+2}q.fromPositions=function(e){return new q({polygonHierarchy:{positions:(e=l.defaultValue(e,l.defaultValue.EMPTY_OBJECT)).positions},vertexFormat:e.vertexFormat,stRotation:e.stRotation,ellipsoid:e.ellipsoid})},q.pack=function(e,t,n){return n=l.defaultValue(n,0),n=b.PolygonGeometryLibrary.packPolygonHierarchy(e
|