2 lines
15 KiB
JavaScript
2 lines
15 KiB
JavaScript
|
define(["./when-cbf8cd21","./Check-35e1a91d","./Math-e66fad2a","./Cartesian2-44433f55","./Transforms-d9350502","./RuntimeError-f4c64df1","./WebGLConstants-95ceb4e9","./ComponentDatatype-7ee14e67","./GeometryAttribute-424f2c6a","./GeometryAttributes-90846c5f","./AttributeCompression-170b3be0","./GeometryPipeline-5896d55c","./EncodedCartesian3-86f19ac2","./IndexDatatype-66caba23","./IntersectionTests-d04ec592","./Plane-94f78648","./GeometryOffsetAttribute-84f7eff3","./VertexFormat-cc24f342","./GeometryInstance-505d80ea","./EllipsoidRhumbLine-862a2df4","./PolygonPipeline-94be9b1d","./RectangleGeometryLibrary-ee91fd16"],function(mt,t,pt,dt,k,e,a,gt,yt,r,n,ft,i,ht,o,s,vt,bt,_t,l,At,H){"use strict";var xt=new dt.Cartesian3,wt=new dt.Cartesian3,Ct=new dt.Cartesian3,Rt=new dt.Cartesian3,_=new dt.Rectangle,z=new dt.Cartesian2,A=new k.BoundingSphere,x=new k.BoundingSphere;function Et(t,e){var a=new yt.Geometry({attributes:new r.GeometryAttributes,primitiveType:yt.PrimitiveType.TRIANGLES});return a.attributes.position=new yt.GeometryAttribute({componentDatatype:gt.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:e.positions}),t.normal&&(a.attributes.normal=new yt.GeometryAttribute({componentDatatype:gt.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:e.normals})),t.tangent&&(a.attributes.tangent=new yt.GeometryAttribute({componentDatatype:gt.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:e.tangents})),t.bitangent&&(a.attributes.bitangent=new yt.GeometryAttribute({componentDatatype:gt.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:e.bitangents})),a}var Ft=new dt.Cartesian3,Gt=new dt.Cartesian3;function Pt(t,e){var a=t._vertexFormat,r=t._ellipsoid,n=e.height,i=e.width,o=e.northCap,s=e.southCap,l=0,u=n,c=n,m=0;o&&(--c,m+=l=1),s&&(--u,--c,m+=1),m+=i*c;for(var p=a.position?new Float64Array(3*m):void 0,d=a.st?new Float32Array(2*m):void 0,g=0,y=0,f=xt,h=z,v=Number.MAX_VALUE,b=Number.MAX_VALUE,_=-Number.MAX_VALUE,A=-Number.MAX_VALUE,x=l;x<u;++x)for(var w=0;w<i;++w)H.RectangleGeometryLibrary.computePosition(e,r,a.st,x,w,f,h),p[g++]=f.x,p[g++]=f.y,p[g++]=f.z,a.st&&(d[y++]=h.x,d[y++]=h.y,v=Math.min(v,h.x),b=Math.min(b,h.y),_=Math.max(_,h.x),A=Math.max(A,h.y));if(o&&(H.RectangleGeometryLibrary.computePosition(e,r,a.st,0,0,f,h),p[g++]=f.x,p[g++]=f.y,p[g++]=f.z,a.st&&(d[y++]=h.x,d[y++]=h.y,v=h.x,b=h.y,_=h.x,A=h.y)),s&&(H.RectangleGeometryLibrary.computePosition(e,r,a.st,n-1,0,f,h),p[g++]=f.x,p[g++]=f.y,p[g]=f.z,a.st&&(d[y++]=h.x,d[y]=h.y,v=Math.min(v,h.x),b=Math.min(b,h.y),_=Math.max(_,h.x),A=Math.max(A,h.y))),a.st&&(v<0||b<0||1<_||1<A))for(var C=0;C<d.length;C+=2)d[C]=(d[C]-v)/(_-v),d[C+1]=(d[C+1]-b)/(A-b);var R=function(t,e,a,r){var n=t.length,i=e.normal?new Float32Array(n):void 0,o=e.tangent?new Float32Array(n):void 0,s=e.bitangent?new Float32Array(n):void 0,l=0,u=Rt,c=Ct,m=wt;if(e.normal||e.tangent||e.bitangent)for(var p=0;p<n;p+=3){var d=dt.Cartesian3.fromArray(t,p,xt),g=l+1,y=l+2,m=a.geodeticSurfaceNormal(d,m);(e.tangent||e.bitangent)&&(dt.Cartesian3.cross(dt.Cartesian3.UNIT_Z,m,c),k.Matrix3.multiplyByVector(r,c,c),dt.Cartesian3.normalize(c,c),e.bitangent&&dt.Cartesian3.normalize(dt.Cartesian3.cross(m,c,u),u)),e.normal&&(i[l]=m.x,i[g]=m.y,i[y]=m.z),e.tangent&&(o[l]=c.x,o[g]=c.y,o[y]=c.z),e.bitangent&&(s[l]=u.x,s[g]=u.y,s[y]=u.z),l+=3}return Et(e,{positions:t,normals:i,tangents:o,bitangents:s})}(p,a,r,e.tangentRotationMatrix),E=6*(i-1)*(c-1);o&&(E+=3*(i-1)),s&&(E+=3*(i-1));for(var F=ht.IndexDatatype.createTypedArray(m,E),G=0,P=0,V=0;V<c-1;++V){for(var L=0;L<i-1;++L){var D=G+i,M=D+1,T=G+1;F[P++]=G,F[P++]=D,F[P++]=T,F[P++]=T,F[P++]=D,F[P++]=M,++G}++G}if(o||s){var O,N,S=m-1,I=m-1;if(o&&s&&(S=m-2),G=0,o)for(V=0;V<i-1;V++)N=(O=G)+1,F[P++]=S,F[P++]=O,F[P++]=N,++G;if(s)for(G=(c-1)*i,V=0;V<i-1;V++)N=(O=G)+1,F[P++]=O,F[P++]=I,F[P++]=N,++G}return R.indices=F,a.st&&(R.attributes.st=new yt.GeometryAttribute({componentDatatype:gt.ComponentDatatype.FLOAT,componentsPerAttribute:2,values:d})),R}function Vt(t,e,a,r,n){return t[e++]=r[a],t[e++]=r[a+1],t[e++]=r[a+2],t[e++]=n[a],t[e++]=n[a+1],t[e]=n[a+2],t}function Lt(t,e,a,r)
|