2 lines
35 KiB
JavaScript
2 lines
35 KiB
JavaScript
/* 2020-9-22 15:23:25 | 版权所有 军懋国兴 */
|
|
define(["exports","./when-cbf8cd21","./Check-35e1a91d","./Math-69007a69","./Cartesian2-43e3a3be","./Transforms-2d1ac5ec","./ComponentDatatype-607c9a0c","./GeometryAttribute-2303bbfb","./AttributeCompression-ea810287","./EncodedCartesian3-29a09d7b","./IndexDatatype-79bb407c","./IntersectionTests-459f6f08","./Plane-46b5436f"],function(e,F,M,_,U,Y,q,R,E,l,x,Z,i){"use strict";var A=new U.Cartesian3,D=new U.Cartesian3,P=new U.Cartesian3;var o={calculateACMR:function(e){var t=(e=F.defaultValue(e,F.defaultValue.EMPTY_OBJECT)).indices,r=e.maximumIndex,i=F.defaultValue(e.cacheSize,24);if(!F.defined(t))throw new M.DeveloperError("indices is required.");var a=t.length;if(a<3||a%3!=0)throw new M.DeveloperError("indices length must be a multiple of three.");if(r<=0)throw new M.DeveloperError("maximumIndex must be greater than zero.");if(i<3)throw new M.DeveloperError("cacheSize must be greater than two.");if(!F.defined(r))for(var n=r=0,o=t[n];n<a;)r<o&&(r=o),o=t[++n];for(var s=[],u=0;u<r+1;u++)s[u]=0;for(var p=i+1,d=0;d<a;++d)p-s[t[d]]>i&&(s[t[d]]=p,++p);return(p-i+1)/(a/3)}};o.tipsify=function(e){var t=(e=F.defaultValue(e,F.defaultValue.EMPTY_OBJECT)).indices,r=e.maximumIndex,i=F.defaultValue(e.cacheSize,24);function a(e,t,r,i,a,n,o){for(var s,u=-1,p=-1,d=0;d<r.length;){var l=r[d];i[l].numLiveTriangles&&(s=0,a-i[l].timeStamp+2*i[l].numLiveTriangles<=t&&(s=a-i[l].timeStamp),(p<s||-1===p)&&(p=s,u=l)),++d}return-1===u?function(e,t,r){for(;1<=t.length;){var i=t[t.length-1];if(t.splice(t.length-1,1),0<e[i].numLiveTriangles)return i}for(;b<r;){if(0<e[b].numLiveTriangles)return++b-1;++b}return-1}(i,n,o):u}if(!F.defined(t))throw new M.DeveloperError("indices is required.");var n=t.length;if(n<3||n%3!=0)throw new M.DeveloperError("indices length must be a multiple of three.");if(r<=0)throw new M.DeveloperError("maximumIndex must be greater than zero.");if(i<3)throw new M.DeveloperError("cacheSize must be greater than two.");var o=0,s=0,u=t[s],p=n;if(F.defined(r))o=r+1;else{for(;s<p;)o<u&&(o=u),u=t[++s];if(-1===o)return 0;++o}for(var d=[],l=0;l<o;l++)d[l]={numLiveTriangles:0,timeStamp:0,vertexTriangles:[]};for(var f=s=0;s<p;)d[t[s]].vertexTriangles.push(f),++d[t[s]].numLiveTriangles,d[t[s+1]].vertexTriangles.push(f),++d[t[s+1]].numLiveTriangles,d[t[s+2]].vertexTriangles.push(f),++d[t[s+2]].numLiveTriangles,++f,s+=3;var v,m,y,c,h=0,C=i+1,b=1,w=[],g=[],T=0,A=[],E=n/3,D=[];for(l=0;l<E;l++)D[l]=!1;for(;-1!==h;){w=[],c=(m=d[h]).vertexTriangles.length;for(var x=0;x<c;++x)if(!D[f=m.vertexTriangles[x]]){D[f]=!0,s=f+f+f;for(var P=0;P<3;++P)y=t[s],w.push(y),g.push(y),A[T]=y,++T,--(v=d[y]).numLiveTriangles,C-v.timeStamp>i&&(v.timeStamp=C,++C),++s}h=a(0,i,w,d,C,g,o)}return A};var t={};function s(e,t,r,i,a){e[t++]=r,e[t++]=i,e[t++]=i,e[t++]=a,e[t++]=a,e[t]=r}function m(e){var t,r,i={};for(t in e){e.hasOwnProperty(t)&&F.defined(e[t])&&F.defined(e[t].values)&&(r=e[t],i[t]=new R.GeometryAttribute({componentDatatype:r.componentDatatype,componentsPerAttribute:r.componentsPerAttribute,normalize:r.normalize,values:[]}))}return i}t.toWireframe=function(e){if(!F.defined(e))throw new M.DeveloperError("geometry is required.");var t=e.indices;if(F.defined(t)){switch(e.primitiveType){case R.PrimitiveType.TRIANGLES:e.indices=function(e){for(var t=e.length,r=t/3*6,i=x.IndexDatatype.createTypedArray(t,r),a=0,n=0;n<t;n+=3,a+=6)s(i,a,e[n],e[n+1],e[n+2]);return i}(t);break;case R.PrimitiveType.TRIANGLE_STRIP:e.indices=function(e){var t=e.length;if(3<=t){var r=6*(t-2),i=x.IndexDatatype.createTypedArray(t,r);s(i,0,e[0],e[1],e[2]);for(var a=6,n=3;n<t;++n,a+=6)s(i,a,e[n-1],e[n],e[n-2]);return i}return new Uint16Array}(t);break;case R.PrimitiveType.TRIANGLE_FAN:e.indices=function(e){if(0<e.length){for(var t=e.length-1,r=6*(t-1),i=x.IndexDatatype.createTypedArray(t,r),a=e[0],n=0,o=1;o<t;++o,n+=6)s(i,n,a,e[o],e[o+1]);return i}return new Uint16Array}(t);break;default:throw new M.DeveloperError("geometry.primitiveType must be TRIANGLES, TRIANGLE_STRIP, or TRIANGLE_FAN.")}e.primitiveType=R.PrimitiveType.LINES}return e},t.createLineSegmentsForVectors=function(e,t,r){if(t=F.defaultValue(t,"normal"),!F.defined(e))throw new M.DeveloperError("geometry is required.");if(!F.defined(e.attributes.position))throw new M.DeveloperError("geometry.attributes.position is required.");if(!F.defined(e.attributes[t]))throw new M.DeveloperError("geometry.attributes must have an attribute with the same name as the attributeName parameter, "+t+".");r=F.defaultValue(r,1e4);for(var i,a=e.attributes.position.values,n=e.attributes[t].values,o=a.length,s=new Float64Array(2*o),u=0,p=0;p<o;p+=3)s[u++]=a[p],s[u++]=a[p+1],s[u++]=a[p+2],s[u++]=a[p]+n[p]*r,s[u++]=a[p+1]+n[p+1]*r,s[u++]=a[p+2]+n[p+2]*r;var d=e.boundingSphere;return F.defined(d)&&(i=new Y.BoundingSphere(d.center,d.radius+r)),new R.Geometry({attributes:{position:new R.GeometryAttribute({componentDatatype:q.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:s})},primitiveType:R.PrimitiveType.LINES,boundingSphere:i})},t.createAttributeLocations=function(e){if(!F.defined(e))throw new M.DeveloperError("geometry is required.");for(var t,r=["position","positionHigh","positionLow","position3DHigh","position3DLow","position2DHigh","position2DLow","pickColor","normal","st","tangent","bitangent","extrudeDirection","compressedAttributes"],i=e.attributes,a={},n=0,o=r.length,s=0;s<o;++s){var u=r[s];F.defined(i[u])&&(a[u]=n++)}for(t in i)i.hasOwnProperty(t)&&!F.defined(a[t])&&(a[t]=n++);return a},t.reorderForPreVertexCache=function(e){if(!F.defined(e))throw new M.DeveloperError("geometry is required.");var t=R.Geometry.computeNumberOfVertices(e),r=e.indices;if(F.defined(r)){for(var i=new Int32Array(t),a=0;a<t;a++)i[a]=-1;for(var n,o=r,s=o.length,u=x.IndexDatatype.createTypedArray(t,s),p=0,d=0,l=0;p<s;)-1!==(n=i[o[p]])?u[d]=n:(i[n=o[p]]=l,u[d]=l,++l),++p,++d;e.indices=u;var f,v=e.attributes;for(f in v)if(v.hasOwnProperty(f)&&F.defined(v[f])&&F.defined(v[f].values)){for(var m=v[f],y=m.values,c=0,h=m.componentsPerAttribute,C=q.ComponentDatatype.createTypedArray(m.componentDatatype,l*h);c<t;){var b=i[c];if(-1!==b)for(var w=0;w<h;w++)C[h*b+w]=y[h*c+w];++c}m.values=C}}return e},t.reorderForPostVertexCache=function(e,t){if(!F.defined(e))throw new M.DeveloperError("geometry is required.");var r=e.indices;if(e.primitiveType===R.PrimitiveType.TRIANGLES&&F.defined(r)){for(var i=r.length,a=0,n=0;n<i;n++)r[n]>a&&(a=r[n]);e.indices=o.tipsify({indices:r,maximumIndex:a,cacheSize:t})}return e},t.fitToUnsignedShortIndices=function(e){if(!F.defined(e))throw new M.DeveloperError("geometry is required.");if(F.defined(e.indices)&&e.primitiveType!==R.PrimitiveType.TRIANGLES&&e.primitiveType!==R.PrimitiveType.LINES&&e.primitiveType!==R.PrimitiveType.POINTS)throw new M.DeveloperError("geometry.primitiveType must equal to PrimitiveType.TRIANGLES, PrimitiveType.LINES, or PrimitiveType.POINTS.");var t=[],r=R.Geometry.computeNumberOfVertices(e);if(F.defined(e.indices)&&r>=_.CesiumMath.SIXTY_FOUR_KILOBYTES){var i,a=[],n=[],o=0,s=m(e.attributes),u=e.indices,p=u.length;e.primitiveType===R.PrimitiveType.TRIANGLES?i=3:e.primitiveType===R.PrimitiveType.LINES?i=2:e.primitiveType===R.PrimitiveType.POINTS&&(i=1);for(var d=0;d<p;d+=i){for(var l=0;l<i;++l){var f=u[d+l],v=a[f];F.defined(v)||(v=o++,a[f]=v,function(e,t,r){for(var i in t)if(t.hasOwnProperty(i)&&F.defined(t[i])&&F.defined(t[i].values))for(var a=t[i],n=0;n<a.componentsPerAttribute;++n)e[i].values.push(a.values[r*a.componentsPerAttribute+n])}(s,e.attributes,f)),n.push(v)}o+i>=_.CesiumMath.SIXTY_FOUR_KILOBYTES&&(t.push(new R.Geometry({attributes:s,indices:n,primitiveType:e.primitiveType,boundingSphere:e.boundingSphere,boundingSphereCV:e.boundingSphereCV})),a=[],n=[],o=0,s=m(e.attributes))}0!==n.length&&t.push(new R.Geometry({attributes:s,indices:n,primitiveType:e.primitiveType,boundingSphere:e.boundingSphere,boundingSphereCV:e.boundingSphereCV}))}else t.push(e);return t};var y=new U.Cartesian3,c=new U.Cartographic;t.projectTo2D=function(e,t,r,i,a){if(!F.defined(e))throw new M.DeveloperError("geometry is required.");if(!F.defined(t))throw new M.DeveloperError("attributeName is required.");if(!F.defined(r))throw new M.DeveloperError("attributeName3D is required.");if(!F.defined(i))throw new M.DeveloperError("attributeName2D is required.");if(!F.defined(e.attributes[t]))throw new M.DeveloperError("geometry must have attribute matching the attributeName argument: "+t+".");if(e.attributes[t].componentDatatype!==q.ComponentDatatype.DOUBLE)throw new M.DeveloperError("The attribute componentDatatype must be ComponentDatatype.DOUBLE.");for(var n=e.attributes[t],o=(a=F.defined(a)?a:new Y.GeographicProjection).ellipsoid,s=n.values,u=new Float64Array(s.length),p=0,d=0;d<s.length;d+=3){var l=U.Cartesian3.fromArray(s,d,y),f=o.cartesianToCartographic(l,c);if(!F.defined(f))throw new M.DeveloperError("Could not project point ("+l.x+", "+l.y+", "+l.z+") to 2D.");var v=a.project(f,y);u[p++]=v.x,u[p++]=v.y,u[p++]=v.z}return e.attributes[r]=n,e.attributes[i]=new R.GeometryAttribute({componentDatatype:q.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:u}),delete e.attributes[t],e};var f={high:0,low:0};t.encodeAttribute=function(e,t,r,i){if(!F.defined(e))throw new M.DeveloperError("geometry is required.");if(!F.defined(t))throw new M.DeveloperError("attributeName is required.");if(!F.defined(r))throw new M.DeveloperError("attributeHighName is required.");if(!F.defined(i))throw new M.DeveloperError("attributeLowName is required.");if(!F.defined(e.attributes[t]))throw new M.DeveloperError("geometry must have attribute matching the attributeName argument: "+t+".");if(e.attributes[t].componentDatatype!==q.ComponentDatatype.DOUBLE)throw new M.DeveloperError("The attribute componentDatatype must be ComponentDatatype.DOUBLE.");for(var a=e.attributes[t],n=a.values,o=n.length,s=new Float32Array(o),u=new Float32Array(o),p=0;p<o;++p)l.EncodedCartesian3.encode(n[p],f),s[p]=f.high,u[p]=f.low;var d=a.componentsPerAttribute;return e.attributes[r]=new R.GeometryAttribute({componentDatatype:q.ComponentDatatype.FLOAT,componentsPerAttribute:d,values:s}),e.attributes[i]=new R.GeometryAttribute({componentDatatype:q.ComponentDatatype.FLOAT,componentsPerAttribute:d,values:u}),delete e.attributes[t],e};var n=new U.Cartesian3;function a(e,t){if(F.defined(t))for(var r=t.values,i=r.length,a=0;a<i;a+=3)U.Cartesian3.unpack(r,a,n),Y.Matrix4.multiplyByPoint(e,n,n),U.Cartesian3.pack(n,r,a)}function u(e,t){if(F.defined(t))for(var r=t.values,i=r.length,a=0;a<i;a+=3)U.Cartesian3.unpack(r,a,n),Y.Matrix3.multiplyByVector(e,n,n),n=U.Cartesian3.normalize(n,n),U.Cartesian3.pack(n,r,a)}var p=new Y.Matrix4,d=new Y.Matrix3;t.transformToWorldCoordinates=function(e){if(!F.defined(e))throw new M.DeveloperError("instance is required.");var t=e.modelMatrix;if(Y.Matrix4.equals(t,Y.Matrix4.IDENTITY))return e;var r=e.geometry.attributes;a(t,r.position),a(t,r.prevPosition),a(t,r.nextPosition),(F.defined(r.normal)||F.defined(r.tangent)||F.defined(r.bitangent))&&(Y.Matrix4.inverse(t,p),Y.Matrix4.transpose(p,p),Y.Matrix4.getMatrix3(p,d),u(d,r.normal),u(d,r.tangent),u(d,r.bitangent));var i=e.geometry.boundingSphere;return F.defined(i)&&(e.geometry.boundingSphere=Y.BoundingSphere.transform(i,t,i)),e.modelMatrix=Y.Matrix4.clone(Y.Matrix4.IDENTITY),e};var I=new U.Cartesian3;function v(e,t){var r,i,a=e.length,n=e[0].modelMatrix,o=F.defined(e[0][t].indices),s=e[0][t].primitiveType;for(m=1;m<a;++m){if(!Y.Matrix4.equals(e[m].modelMatrix,n))throw new M.DeveloperError("All instances must have the same modelMatrix.");if(F.defined(e[m][t].indices)!==o)throw new M.DeveloperError("All instance geometries must have an indices or not have one.");if(e[m][t].primitiveType!==s)throw new M.DeveloperError("All instance geometries must have the same primitiveType.")}var u,p,d,l,f=function(e,t){var r,i=e.length,a={},n=e[0][t].attributes;for(r in n)if(n.hasOwnProperty(r)&&F.defined(n[r])&&F.defined(n[r].values)){for(var o=n[r],s=o.values.length,u=!0,p=1;p<i;++p){var d=e[p][t].attributes[r];if(!F.defined(d)||o.componentDatatype!==d.componentDatatype||o.componentsPerAttribute!==d.componentsPerAttribute||o.normalize!==d.normalize){u=!1;break}s+=d.values.length}u&&(a[r]=new R.GeometryAttribute({componentDatatype:o.componentDatatype,componentsPerAttribute:o.componentsPerAttribute,normalize:o.normalize,values:q.ComponentDatatype.createTypedArray(o.componentDatatype,s)}))}return a}(e,t);for(r in f)if(f.hasOwnProperty(r))for(u=f[r].values,m=g=0;m<a;++m)for(d=(p=e[m][t].attributes[r].values).length,i=0;i<d;++i)u[g++]=p[i];if(o){for(var v=0,m=0;m<a;++m)v+=e[m][t].indices.length;var y=R.Geometry.computeNumberOfVertices(new R.Geometry({attributes:f,primitiveType:R.PrimitiveType.POINTS})),c=x.IndexDatatype.createTypedArray(y,v),h=0,C=0;for(m=0;m<a;++m){for(var b=e[m][t].indices,w=b.length,g=0;g<w;++g)c[h++]=C+b[g];C+=R.Geometry.computeNumberOfVertices(e[m][t])}l=c}var T,A=new U.Cartesian3,E=0;for(m=0;m<a;++m){if(T=e[m][t].boundingSphere,!F.defined(T)){A=void 0;break}U.Cartesian3.add(T.center,A,A)}if(F.defined(A))for(U.Cartesian3.divideByScalar(A,a,A),m=0;m<a;++m){T=e[m][t].boundingSphere;var D=U.Cartesian3.magnitude(U.Cartesian3.subtract(T.center,A,I))+T.radius;E<D&&(E=D)}return new R.Geometry({attributes:f,indices:l,primitiveType:s,boundingSphere:F.defined(A)?new Y.BoundingSphere(A,E):void 0})}t.combineInstances=function(e){if(!F.defined(e)||e.length<1)throw new M.DeveloperError("instances is required and must have length greater than zero.");for(var t=[],r=[],i=e.length,a=0;a<i;++a){var n=e[a];F.defined(n.geometry)?t.push(n):F.defined(n.westHemisphereGeometry)&&F.defined(n.eastHemisphereGeometry)&&r.push(n)}var o=[];return 0<t.length&&o.push(v(t,"geometry")),0<r.length&&(o.push(v(r,"westHemisphereGeometry")),o.push(v(r,"eastHemisphereGeometry"))),o};var T=new U.Cartesian3,S=new U.Cartesian3,N=new U.Cartesian3,O=new U.Cartesian3;t.computeNormal=function(e){if(!F.defined(e))throw new M.DeveloperError("geometry is required.");if(!F.defined(e.attributes.position)||!F.defined(e.attributes.position.values))throw new M.DeveloperError("geometry.attributes.position.values is required.");if(!F.defined(e.indices))throw new M.DeveloperError("geometry.indices is required.");if(e.indices.length<2||e.indices.length%3!=0)throw new M.DeveloperError("geometry.indices length must be greater than 0 and be a multiple of 3.");if(e.primitiveType!==R.PrimitiveType.TRIANGLES)throw new M.DeveloperError("geometry.primitiveType must be PrimitiveType.TRIANGLES.");for(var t=e.indices,r=e.attributes,i=r.position.values,a=r.position.values.length/3,n=t.length,o=new Array(a),s=new Array(n/3),u=new Array(n),p=0;p<a;p++)o[p]={indexOffset:0,count:0,currentCount:0};var d=0;for(p=0;p<n;p+=3){var l=t[p],f=t[p+1],v=t[p+2],m=3*l,y=3*f,c=3*v;S.x=i[m],S.y=i[1+m],S.z=i[2+m],N.x=i[y],N.y=i[1+y],N.z=i[2+y],O.x=i[c],O.y=i[1+c],O.z=i[2+c],o[l].count++,o[f].count++,o[v].count++,U.Cartesian3.subtract(N,S,N),U.Cartesian3.subtract(O,S,O),s[d]=U.Cartesian3.cross(N,O,new U.Cartesian3),d++}var h=0;for(p=0;p<a;p++)o[p].indexOffset+=h,h+=o[p].count;for(p=d=0;p<n;p+=3){var C=(g=o[t[p]]).indexOffset+g.currentCount;u[C]=d,g.currentCount++,u[(g=o[t[p+1]]).indexOffset+g.currentCount]=d,g.currentCount++,u[(g=o[t[p+2]]).indexOffset+g.currentCount]=d,g.currentCount++,d++}var b=new Float32Array(3*a);for(p=0;p<a;p++){var w=3*p,g=o[p];if(U.Cartesian3.clone(U.Cartesian3.ZERO,T),0<g.count){for(d=0;d<g.count;d++)U.Cartesian3.add(T,s[u[g.indexOffset+d]],T);U.Cartesian3.equalsEpsilon(U.Cartesian3.ZERO,T,_.CesiumMath.EPSILON10)&&U.Cartesian3.clone(s[u[g.indexOffset]],T)}U.Cartesian3.equalsEpsilon(U.Cartesian3.ZERO,T,_.CesiumMath.EPSILON10)&&(T.z=1),U.Cartesian3.normalize(T,T),b[w]=T.x,b[1+w]=T.y,b[2+w]=T.z}return e.attributes.normal=new R.GeometryAttribute({componentDatatype:q.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:b}),e};var B=new U.Cartesian3,V=new U.Cartesian3,k=new U.Cartesian3;t.computeTangentAndBitangent=function(e){if(!F.defined(e))throw new M.DeveloperError("geometry is required.");var t=e.attributes,r=e.indices;if(!F.defined(t.position)||!F.defined(t.position.values))throw new M.DeveloperError("geometry.attributes.position.values is required.");if(!F.defined(t.normal)||!F.defined(t.normal.values))throw new M.DeveloperError("geometry.attributes.normal.values is required.");if(!F.defined(t.st)||!F.defined(t.st.values))throw new M.DeveloperError("geometry.attributes.st.values is required.");if(!F.defined(r))throw new M.DeveloperError("geometry.indices is required.");if(r.length<2||r.length%3!=0)throw new M.DeveloperError("geometry.indices length must be greater than 0 and be a multiple of 3.");if(e.primitiveType!==R.PrimitiveType.TRIANGLES)throw new M.DeveloperError("geometry.primitiveType must be PrimitiveType.TRIANGLES.");for(var i=e.attributes.position.values,a=e.attributes.normal.values,n=e.attributes.st.values,o=e.attributes.position.values.length/3,s=r.length,u=new Array(3*o),p=0;p<u.length;p++)u[p]=0;for(p=0;p<s;p+=3){var d,l=r[p],f=r[p+1],v=r[p+2],m=3*f,y=3*v,c=2*l,h=2*f,C=2*v,b=i[d=3*l],w=i[d+1],g=i[d+2],T=n[c],A=n[1+c],E=n[1+h]-A,D=n[1+C]-A,x=1/((n[h]-T)*D-(n[C]-T)*E),P=(D*(i[m]-b)-E*(i[y]-b))*x,I=(D*(i[m+1]-w)-E*(i[y+1]-w))*x,S=(D*(i[m+2]-g)-E*(i[y+2]-g))*x;u[d]+=P,u[d+1]+=I,u[d+2]+=S,u[m]+=P,u[m+1]+=I,u[m+2]+=S,u[y]+=P,u[y+1]+=I,u[y+2]+=S}var N=new Float32Array(3*o),O=new Float32Array(3*o);for(p=0;p<o;p++){m=(d=3*p)+1,y=d+2;var L=U.Cartesian3.fromArray(a,d,B),z=U.Cartesian3.fromArray(u,d,k),G=U.Cartesian3.dot(L,z);U.Cartesian3.multiplyByScalar(L,G,V),U.Cartesian3.normalize(U.Cartesian3.subtract(z,V,z),z),N[d]=z.x,N[m]=z.y,N[y]=z.z,U.Cartesian3.normalize(U.Cartesian3.cross(L,z,z),z),O[d]=z.x,O[m]=z.y,O[y]=z.z}return e.attributes.tangent=new R.GeometryAttribute({componentDatatype:q.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:N}),e.attributes.bitangent=new R.GeometryAttribute({componentDatatype:q.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:O}),e};var L=new U.Cartesian2,z=new U.Cartesian3,G=new U.Cartesian3,H=new U.Cartesian3,W=new U.Cartesian2;function h(e){switch(e.primitiveType){case R.PrimitiveType.TRIANGLE_FAN:return function(e){var t=R.Geometry.computeNumberOfVertices(e);if(t<3)throw new M.DeveloperError("The number of vertices must be at least three.");var r=x.IndexDatatype.createTypedArray(t,3*(t-2));r[0]=1,r[1]=0,r[2]=2;for(var i=3,a=3;a<t;++a)r[i++]=a-1,r[i++]=0,r[i++]=a;return e.indices=r,e.primitiveType=R.PrimitiveType.TRIANGLES,e}(e);case R.PrimitiveType.TRIANGLE_STRIP:return function(e){var t=R.Geometry.computeNumberOfVertices(e);if(t<3)throw new M.DeveloperError("The number of vertices must be at least 3.");var r=x.IndexDatatype.createTypedArray(t,3*(t-2));r[0]=0,r[1]=1,r[2]=2,3<t&&(r[3]=0,r[4]=2,r[5]=3);for(var i=6,a=3;a<t-1;a+=2)r[i++]=a,r[i++]=a-1,r[i++]=a+1,a+2<t&&(r[i++]=a,r[i++]=a+1,r[i++]=a+2);return e.indices=r,e.primitiveType=R.PrimitiveType.TRIANGLES,e}(e);case R.PrimitiveType.TRIANGLES:return function(e){if(F.defined(e.indices))return e;var t=R.Geometry.computeNumberOfVertices(e);if(t<3)throw new M.DeveloperError("The number of vertices must be at least three.");if(t%3!=0)throw new M.DeveloperError("The number of vertices must be a multiple of three.");for(var r=x.IndexDatatype.createTypedArray(t,t),i=0;i<t;++i)r[i]=i;return e.indices=r,e}(e);case R.PrimitiveType.LINE_STRIP:return function(e){var t=R.Geometry.computeNumberOfVertices(e);if(t<2)throw new M.DeveloperError("The number of vertices must be at least two.");var r=x.IndexDatatype.createTypedArray(t,2*(t-1));r[0]=0,r[1]=1;for(var i=2,a=2;a<t;++a)r[i++]=a-1,r[i++]=a;return e.indices=r,e.primitiveType=R.PrimitiveType.LINES,e}(e);case R.PrimitiveType.LINE_LOOP:return function(e){var t=R.Geometry.computeNumberOfVertices(e);if(t<2)throw new M.DeveloperError("The number of vertices must be at least two.");var r=x.IndexDatatype.createTypedArray(t,2*t);r[0]=0,r[1]=1;for(var i=2,a=2;a<t;++a)r[i++]=a-1,r[i++]=a;return r[i++]=t-1,r[i]=0,e.indices=r,e.primitiveType=R.PrimitiveType.LINES,e}(e);case R.PrimitiveType.LINES:return function(e){if(F.defined(e.indices))return e;var t=R.Geometry.computeNumberOfVertices(e);if(t<2)throw new M.DeveloperError("The number of vertices must be at least two.");if(t%2!=0)throw new M.DeveloperError("The number of vertices must be a multiple of 2.");for(var r=x.IndexDatatype.createTypedArray(t,t),i=0;i<t;++i)r[i]=i;return e.indices=r,e}(e)}return e}function C(e,t){Math.abs(e.y)<_.CesiumMath.EPSILON6&&(e.y=t?-_.CesiumMath.EPSILON6:_.CesiumMath.EPSILON6)}t.compressVertices=function(e){if(!F.defined(e))throw new M.DeveloperError("geometry is required.");var t=e.attributes.extrudeDirection;if(F.defined(t)){for(var r=t.values,i=r.length/3,a=new Float32Array(2*i),n=0,o=0;o<i;++o)U.Cartesian3.fromArray(r,3*o,z),U.Cartesian3.equals(z,U.Cartesian3.ZERO)?n+=2:(W=E.AttributeCompression.octEncodeInRange(z,65535,W),a[n++]=W.x,a[n++]=W.y);return e.attributes.compressedAttributes=new R.GeometryAttribute({componentDatatype:q.ComponentDatatype.FLOAT,componentsPerAttribute:2,values:a}),delete e.attributes.extrudeDirection,e}var s=e.attributes.normal,u=e.attributes.st,p=F.defined(s),d=F.defined(u);if(!p&&!d)return e;var l,f,v,m,y=e.attributes.tangent,c=e.attributes.bitangent,h=F.defined(y),C=F.defined(c);p&&(l=s.values),d&&(f=u.values),h&&(v=y.values),C&&(m=c.values);var b=i=(p?l.length:f.length)/(p?3:2),w=d&&p?2:1;b*=w+=h||C?1:0;var g=new Float32Array(b),T=0;for(o=0;o<i;++o){d&&(U.Cartesian2.fromArray(f,2*o,L),g[T++]=E.AttributeCompression.compressTextureCoordinates(L));var A=3*o;p&&F.defined(v)&&F.defined(m)?(U.Cartesian3.fromArray(l,A,z),U.Cartesian3.fromArray(v,A,G),U.Cartesian3.fromArray(m,A,H),E.AttributeCompression.octPack(z,G,H,L),g[T++]=L.x,g[T++]=L.y):(p&&(U.Cartesian3.fromArray(l,A,z),g[T++]=E.AttributeCompression.octEncodeFloat(z)),h&&(U.Cartesian3.fromArray(v,A,z),g[T++]=E.AttributeCompression.octEncodeFloat(z)),C&&(U.Cartesian3.fromArray(m,A,z),g[T++]=E.AttributeCompression.octEncodeFloat(z)))}return e.attributes.compressedAttributes=new R.GeometryAttribute({componentDatatype:q.ComponentDatatype.FLOAT,componentsPerAttribute:w,values:g}),p&&delete e.attributes.normal,d&&delete e.attributes.st,C&&delete e.attributes.bitangent,h&&delete e.attributes.tangent,e};var b=new U.Cartesian3;function w(e,t,r,i){U.Cartesian3.add(e,U.Cartesian3.multiplyByScalar(U.Cartesian3.subtract(t,e,b),e.y/(e.y-t.y),b),r),U.Cartesian3.clone(r,i),C(r,!0),C(i,!1)}var g=new U.Cartesian3,X=new U.Cartesian3,j=new U.Cartesian3,J=new U.Cartesian3,K={positions:new Array(7),indices:new Array(9)};function Q(e,t,r){if(!(0<=e.x||0<=t.x||0<=r.x)){!function(e,t,r){if(0!==e.y&&0!==t.y&&0!==r.y)return C(e,e.y<0),C(t,t.y<0),C(r,r.y<0);var i=Math.abs(e.y),a=Math.abs(t.y),n=Math.abs(r.y),o=a<i?n<i?_.CesiumMath.sign(e.y):_.CesiumMath.sign(r.y):n<a?_.CesiumMath.sign(t.y):_.CesiumMath.sign(r.y),s=o<0;C(e,s),C(t,s),C(r,s)}(e,t,r);var i=e.y<0,a=t.y<0,n=r.y<0,o=0;o+=i?1:0,o+=a?1:0,o+=n?1:0;var s=K.indices;1==o?(s[1]=3,s[2]=4,s[5]=6,s[7]=6,s[8]=5,i?(w(e,t,g,j),w(e,r,X,J),s[0]=0,s[3]=1,s[4]=2,s[6]=1):a?(w(t,r,g,j),w(t,e,X,J),s[0]=1,s[3]=2,s[4]=0,s[6]=2):n&&(w(r,e,g,j),w(r,t,X,J),s[0]=2,s[3]=0,s[4]=1,s[6]=0)):2==o&&(s[2]=4,s[4]=4,s[5]=3,s[7]=5,s[8]=6,i?a?n||(w(r,e,g,j),w(r,t,X,J),s[0]=0,s[1]=1,s[3]=0,s[6]=2):(w(t,r,g,j),w(t,e,X,J),s[0]=2,s[1]=0,s[3]=2,s[6]=1):(w(e,t,g,j),w(e,r,X,J),s[0]=1,s[1]=2,s[3]=1,s[6]=0));var u=K.positions;return u[0]=e,u[1]=t,u[2]=r,u.length=3,1!=o&&2!=o||(u[3]=g,u[4]=X,u[5]=j,u[6]=J,u.length=7),K}}function $(e,t){var r,i=e.attributes;if(0!==i.position.values.length){for(var a in i){i.hasOwnProperty(a)&&F.defined(i[a])&&F.defined(i[a].values)&&((r=i[a]).values=q.ComponentDatatype.createTypedArray(r.componentDatatype,r.values))}var n=R.Geometry.computeNumberOfVertices(e);return e.indices=x.IndexDatatype.createTypedArray(n,e.indices),t&&(e.boundingSphere=Y.BoundingSphere.fromVertices(i.position.values)),e}}function ee(e){var t,r,i=e.attributes,a={};for(t in i){i.hasOwnProperty(t)&&F.defined(i[t])&&F.defined(i[t].values)&&(r=i[t],a[t]=new R.GeometryAttribute({componentDatatype:r.componentDatatype,componentsPerAttribute:r.componentsPerAttribute,normalize:r.normalize,values:[]}))}return new R.Geometry({attributes:a,indices:[],primitiveType:e.primitiveType})}function te(e,t,r){var i=F.defined(e.geometry.boundingSphere);t=$(t,i),r=$(r,i),F.defined(r)&&!F.defined(t)?e.geometry=r:!F.defined(r)&&F.defined(t)?e.geometry=t:(e.westHemisphereGeometry=t,e.eastHemisphereGeometry=r,e.geometry=void 0)}function r(f,v){var m=new f,y=new f,c=new f;return function(e,t,r,i,a,n,o,s){var u=f.fromArray(a,e*v,m),p=f.fromArray(a,t*v,y),d=f.fromArray(a,r*v,c);f.multiplyByScalar(u,i.x,u),f.multiplyByScalar(p,i.y,p),f.multiplyByScalar(d,i.z,d);var l=f.add(u,p,u);f.add(l,d,l),s&&f.normalize(l,l),f.pack(l,n,o*v)}}var re=r(Y.Cartesian4,4),ie=r(U.Cartesian3,3),ae=r(U.Cartesian2,2),ne=function(e,t,r,i,a,n,o){var s=a[e]*i.x,u=a[t]*i.y,p=a[r]*i.z;n[o]=s+u+p>_.CesiumMath.EPSILON6?1:0},oe=new U.Cartesian3,se=new U.Cartesian3,ue=new U.Cartesian3,pe=new U.Cartesian3;function de(e,t,r,i,a,n,o,s,u,p,d,l,f,v,m,y){if(F.defined(n)||F.defined(o)||F.defined(s)||F.defined(u)||F.defined(p)||0!==v){var c,h,C,b,w=function(e,t,r,i,a){var n,o,s,u,p,d,l,f;if(M.Check.defined("point",e),M.Check.defined("p0",t),M.Check.defined("p1",r),M.Check.defined("p2",i),F.defined(a)||(a=new U.Cartesian3),F.defined(t.z)){if(U.Cartesian3.equalsEpsilon(e,t,_.CesiumMath.EPSILON14))return U.Cartesian3.clone(U.Cartesian3.UNIT_X,a);if(U.Cartesian3.equalsEpsilon(e,r,_.CesiumMath.EPSILON14))return U.Cartesian3.clone(U.Cartesian3.UNIT_Y,a);if(U.Cartesian3.equalsEpsilon(e,i,_.CesiumMath.EPSILON14))return U.Cartesian3.clone(U.Cartesian3.UNIT_Z,a);n=U.Cartesian3.subtract(r,t,A),o=U.Cartesian3.subtract(i,t,D),s=U.Cartesian3.subtract(e,t,P),u=U.Cartesian3.dot(n,n),p=U.Cartesian3.dot(n,o),d=U.Cartesian3.dot(n,s),l=U.Cartesian3.dot(o,o),f=U.Cartesian3.dot(o,s)}else{if(U.Cartesian2.equalsEpsilon(e,t,_.CesiumMath.EPSILON14))return U.Cartesian3.clone(U.Cartesian3.UNIT_X,a);if(U.Cartesian2.equalsEpsilon(e,r,_.CesiumMath.EPSILON14))return U.Cartesian3.clone(U.Cartesian3.UNIT_Y,a);if(U.Cartesian2.equalsEpsilon(e,i,_.CesiumMath.EPSILON14))return U.Cartesian3.clone(U.Cartesian3.UNIT_Z,a);n=U.Cartesian2.subtract(r,t,A),o=U.Cartesian2.subtract(i,t,D),s=U.Cartesian2.subtract(e,t,P),u=U.Cartesian2.dot(n,n),p=U.Cartesian2.dot(n,o),d=U.Cartesian2.dot(n,s),l=U.Cartesian2.dot(o,o),f=U.Cartesian2.dot(o,s)}a.y=l*d-p*f,a.z=u*f-p*d;var v=u*l-p*p;return 0!==a.y&&(a.y/=v),0!==a.z&&(a.z/=v),a.x=1-a.y-a.z,a}(i,U.Cartesian3.fromArray(a,3*e,oe),U.Cartesian3.fromArray(a,3*t,se),U.Cartesian3.fromArray(a,3*r,ue),pe);if(F.defined(n)&&ie(e,t,r,w,n,l.normal.values,y,!0),F.defined(p)&&(c=U.Cartesian3.fromArray(p,3*e,oe),h=U.Cartesian3.fromArray(p,3*t,se),C=U.Cartesian3.fromArray(p,3*r,ue),U.Cartesian3.multiplyByScalar(c,w.x,c),U.Cartesian3.multiplyByScalar(h,w.y,h),U.Cartesian3.multiplyByScalar(C,w.z,C),U.Cartesian3.equals(c,U.Cartesian3.ZERO)&&U.Cartesian3.equals(h,U.Cartesian3.ZERO)&&U.Cartesian3.equals(C,U.Cartesian3.ZERO)?((b=oe).x=0,b.y=0,b.z=0):(b=U.Cartesian3.add(c,h,c),U.Cartesian3.add(b,C,b),U.Cartesian3.normalize(b,b)),U.Cartesian3.pack(b,l.extrudeDirection.values,3*y)),F.defined(d)&&ne(e,t,r,w,d,l.applyOffset.values,y),F.defined(o)&&ie(e,t,r,w,o,l.tangent.values,y,!0),F.defined(s)&&ie(e,t,r,w,s,l.bitangent.values,y,!0),F.defined(u)&&ae(e,t,r,w,u,l.st.values,y),0<v)for(var g=0;g<v;g++){var T=f[g];!function(e,t,r,i,a,n,o){var s=n.componentsPerAttribute,u=n.values,p=o.values;switch(s){case 4:re(e,t,r,i,u,p,a,!1);break;case 3:ie(e,t,r,i,u,p,a,!1);break;case 2:ae(e,t,r,i,u,p,a,!1);break;default:p[a]=u[e]*i.x+u[t]*i.y+u[r]*i.z}}(e,t,r,w,y,m[T],l[T])}}}function le(e,t,r,i,a,n){var o=e.position.values.length/3;if(-1===a)return e.position.values.push(n.x,n.y,n.z),t.push(o),o;var s=i[a],u=r[s];return-1===u?(r[s]=o,e.position.values.push(n.x,n.y,n.z),t.push(o),o):(t.push(u),u)}var fe={position:!0,normal:!0,bitangent:!0,tangent:!0,st:!0,extrudeDirection:!0,applyOffset:!0};function ve(e){var t,r=e.geometry,i=r.attributes,a=i.position.values,n=F.defined(i.normal)?i.normal.values:void 0,o=F.defined(i.bitangent)?i.bitangent.values:void 0,s=F.defined(i.tangent)?i.tangent.values:void 0,u=F.defined(i.st)?i.st.values:void 0,p=F.defined(i.extrudeDirection)?i.extrudeDirection.values:void 0,d=F.defined(i.applyOffset)?i.applyOffset.values:void 0,l=r.indices,f=[];for(t in i)i.hasOwnProperty(t)&&!fe[t]&&F.defined(i[t])&&f.push(t);var v,m,y=f.length,c=ee(r),h=ee(r),C=[];C.length=a.length/3;var b=[];for(b.length=a.length/3,g=0;g<C.length;++g)C[g]=-1,b[g]=-1;for(var w=l.length,g=0;g<w;g+=3){var T=l[g],A=l[g+1],E=l[g+2],D=U.Cartesian3.fromArray(a,3*T),x=U.Cartesian3.fromArray(a,3*A),P=U.Cartesian3.fromArray(a,3*E),I=Q(D,x,P);if(F.defined(I)&&3<I.positions.length)for(var S=I.positions,N=I.indices,O=N.length,L=0;L<O;++L){var z=N[L],G=S[z],M=G.y<0?(v=h.attributes,m=h.indices,C):(v=c.attributes,m=c.indices,b);de(T,A,E,G,a,n,s,o,u,p,d,v,f,y,i,le(v,m,M,l,z<3?g+z:-1,G))}else F.defined(I)&&(D=I.positions[0],x=I.positions[1],P=I.positions[2]),M=D.y<0?(v=h.attributes,m=h.indices,C):(v=c.attributes,m=c.indices,b),de(T,A,E,D,a,n,s,o,u,p,d,v,f,y,i,le(v,m,M,l,g,D)),de(T,A,E,x,a,n,s,o,u,p,d,v,f,y,i,le(v,m,M,l,g+1,x)),de(T,A,E,P,a,n,s,o,u,p,d,v,f,y,i,le(v,m,M,l,g+2,P))}te(e,h,c)}var me=i.Plane.fromPointNormal(U.Cartesian3.ZERO,U.Cartesian3.UNIT_Y),ye=new U.Cartesian3,ce=new U.Cartesian3;function he(e,t,r,i,a,n,o){var s;F.defined(o)&&(s=U.Cartesian3.fromArray(i,3*e,oe),U.Cartesian3.equalsEpsilon(s,r,_.CesiumMath.EPSILON10)?n.applyOffset.values[a]=o[e]:n.applyOffset.values[a]=o[t])}function Ce(e){var t,r=e.geometry,i=r.attributes,a=i.position.values,n=F.defined(i.applyOffset)?i.applyOffset.values:void 0,o=r.indices,s=ee(r),u=ee(r),p=o.length,d=[];d.length=a.length/3;var l=[];for(l.length=a.length/3,t=0;t<d.length;++t)d[t]=-1,l[t]=-1;for(t=0;t<p;t+=2){var f=o[t],v=o[t+1],m=U.Cartesian3.fromArray(a,3*f,oe),y=U.Cartesian3.fromArray(a,3*v,se);Math.abs(m.y)<_.CesiumMath.EPSILON6&&(m.y<0?m.y=-_.CesiumMath.EPSILON6:m.y=_.CesiumMath.EPSILON6),Math.abs(y.y)<_.CesiumMath.EPSILON6&&(y.y<0?y.y=-_.CesiumMath.EPSILON6:y.y=_.CesiumMath.EPSILON6);var c,h,C,b,w,g=s.attributes,T=s.indices,A=l,E=u.attributes,D=u.indices,x=d,P=Z.IntersectionTests.lineSegmentPlane(m,y,me,ue);F.defined(P)?(c=U.Cartesian3.multiplyByScalar(U.Cartesian3.UNIT_Y,5*_.CesiumMath.EPSILON9,ye),m.y<0&&(U.Cartesian3.negate(c,c),g=u.attributes,T=u.indices,A=d,E=s.attributes,D=s.indices,x=l),h=U.Cartesian3.add(P,c,ce),he(f,v,m,a,le(g,T,A,o,t,m),g,n),he(f,v,h,a,le(g,T,A,o,-1,h),g,n),U.Cartesian3.negate(c,c),U.Cartesian3.add(P,c,h),he(f,v,h,a,le(E,D,x,o,-1,h),E,n),he(f,v,y,a,le(E,D,x,o,t+1,y),E,n)):(w=m.y<0?(C=u.attributes,b=u.indices,d):(C=s.attributes,b=s.indices,l),he(f,v,m,a,le(C,b,w,o,t,m),C,n),he(f,v,y,a,le(C,b,w,o,t+1,y),C,n))}te(e,u,s)}var be=new U.Cartesian2,we=new U.Cartesian2,ge=new U.Cartesian3,Te=new U.Cartesian3,Ae=new U.Cartesian3,Ee=new U.Cartesian3,De=new U.Cartesian3,xe=new U.Cartesian3,Pe=new Y.Cartesian4;function Ie(e){for(var t=e.attributes,r=t.position.values,i=t.prevPosition.values,a=t.nextPosition.values,n=r.length,o=0;o<n;o+=3){var s,u,p=U.Cartesian3.unpack(r,o,ge);0<p.x||(s=U.Cartesian3.unpack(i,o,Te),(p.y<0&&0<s.y||0<p.y&&s.y<0)&&(0<o-3?(i[o]=r[o-3],i[o+1]=r[o-2],i[o+2]=r[o-1]):U.Cartesian3.pack(p,i,o)),u=U.Cartesian3.unpack(a,o,Ae),(p.y<0&&0<u.y||0<p.y&&u.y<0)&&(o+3<n?(a[o]=r[o+3],a[o+1]=r[o+4],a[o+2]=r[o+5]):U.Cartesian3.pack(p,a,o)))}}var Se=5*_.CesiumMath.EPSILON9,Ne=_.CesiumMath.EPSILON6;t.splitLongitude=function(e){if(!F.defined(e))throw new M.DeveloperError("instance is required.");var t=e.geometry,r=t.boundingSphere;if(F.defined(r)&&(0<r.center.x-r.radius||Y.BoundingSphere.intersectPlane(r,i.Plane.ORIGIN_ZX_PLANE)!==Y.Intersect.INTERSECTING))return e;if(t.geometryType!==R.GeometryType.NONE)switch(t.geometryType){case R.GeometryType.POLYLINES:!function(e){for(var t,r=e.geometry,i=r.attributes,a=i.position.values,n=i.prevPosition.values,o=i.nextPosition.values,s=i.expandAndWidth.values,u=F.defined(i.st)?i.st.values:void 0,p=F.defined(i.color)?i.color.values:void 0,d=ee(r),l=ee(r),f=!1,v=a.length/3,m=0;m<v;m+=4){var y=m,c=m+2,h=U.Cartesian3.fromArray(a,3*y,ge),C=U.Cartesian3.fromArray(a,3*c,Te);if(Math.abs(h.y)<Ne)for(h.y=Ne*(C.y<0?-1:1),a[3*m+1]=h.y,a[3*(m+1)+1]=h.y,M=3*y;M<3*y+12;M+=3)n[M]=a[3*m],n[M+1]=a[3*m+1],n[M+2]=a[3*m+2];if(Math.abs(C.y)<Ne)for(C.y=Ne*(h.y<0?-1:1),a[3*(m+2)+1]=C.y,a[3*(m+3)+1]=C.y,M=3*y;M<3*y+12;M+=3)o[M]=a[3*(m+2)],o[M+1]=a[3*(m+2)+1],o[M+2]=a[3*(m+2)+2];var b=d.attributes,w=d.indices,g=l.attributes,T=l.indices,A=Z.IntersectionTests.lineSegmentPlane(h,C,me,Ee);if(F.defined(A)){f=!0;var E=U.Cartesian3.multiplyByScalar(U.Cartesian3.UNIT_Y,Se,De);h.y<0&&(U.Cartesian3.negate(E,E),b=l.attributes,w=l.indices,g=d.attributes,T=d.indices);var D=U.Cartesian3.add(A,E,xe);b.position.values.push(h.x,h.y,h.z,h.x,h.y,h.z),b.position.values.push(D.x,D.y,D.z),b.position.values.push(D.x,D.y,D.z),b.prevPosition.values.push(n[3*y],n[3*y+1],n[3*y+2]),b.prevPosition.values.push(n[3*y+3],n[3*y+4],n[3*y+5]),b.prevPosition.values.push(h.x,h.y,h.z,h.x,h.y,h.z),b.nextPosition.values.push(D.x,D.y,D.z),b.nextPosition.values.push(D.x,D.y,D.z),b.nextPosition.values.push(D.x,D.y,D.z),b.nextPosition.values.push(D.x,D.y,D.z),U.Cartesian3.negate(E,E),U.Cartesian3.add(A,E,D),g.position.values.push(D.x,D.y,D.z),g.position.values.push(D.x,D.y,D.z),g.position.values.push(C.x,C.y,C.z,C.x,C.y,C.z),g.prevPosition.values.push(D.x,D.y,D.z),g.prevPosition.values.push(D.x,D.y,D.z),g.prevPosition.values.push(D.x,D.y,D.z),g.prevPosition.values.push(D.x,D.y,D.z),g.nextPosition.values.push(C.x,C.y,C.z,C.x,C.y,C.z),g.nextPosition.values.push(o[3*c],o[3*c+1],o[3*c+2]),g.nextPosition.values.push(o[3*c+3],o[3*c+4],o[3*c+5]);var x=U.Cartesian2.fromArray(s,2*y,be),P=Math.abs(x.y);b.expandAndWidth.values.push(-1,P,1,P),b.expandAndWidth.values.push(-1,-P,1,-P),g.expandAndWidth.values.push(-1,P,1,P),g.expandAndWidth.values.push(-1,-P,1,-P);var I=U.Cartesian3.magnitudeSquared(U.Cartesian3.subtract(A,h,Ae));if(I/=U.Cartesian3.magnitudeSquared(U.Cartesian3.subtract(C,h,Ae)),F.defined(p)){for(var S=Y.Cartesian4.fromArray(p,4*y,Pe),N=Y.Cartesian4.fromArray(p,4*c,Pe),O=_.CesiumMath.lerp(S.x,N.x,I),L=_.CesiumMath.lerp(S.y,N.y,I),z=_.CesiumMath.lerp(S.z,N.z,I),G=_.CesiumMath.lerp(S.w,N.w,I),M=4*y;M<4*y+8;++M)b.color.values.push(p[M]);for(b.color.values.push(O,L,z,G),b.color.values.push(O,L,z,G),g.color.values.push(O,L,z,G),g.color.values.push(O,L,z,G),M=4*c;M<4*c+8;++M)g.color.values.push(p[M])}if(F.defined(u)){var q=U.Cartesian2.fromArray(u,2*y,be),R=U.Cartesian2.fromArray(u,2*(m+3),we),B=_.CesiumMath.lerp(q.x,R.x,I);for(M=2*y;M<2*y+4;++M)b.st.values.push(u[M]);for(b.st.values.push(B,q.y),b.st.values.push(B,R.y),g.st.values.push(B,q.y),g.st.values.push(B,R.y),M=2*c;M<2*c+4;++M)g.st.values.push(u[M])}t=b.position.values.length/3-4,w.push(t,t+2,t+1),w.push(t+1,t+2,t+3),t=g.position.values.length/3-4,T.push(t,t+2,t+1),T.push(t+1,t+2,t+3)}else{var V,k=h.y<0?(V=l.attributes,l.indices):(V=d.attributes,d.indices);for(V.position.values.push(h.x,h.y,h.z),V.position.values.push(h.x,h.y,h.z),V.position.values.push(C.x,C.y,C.z),V.position.values.push(C.x,C.y,C.z),M=3*m;M<3*m+12;++M)V.prevPosition.values.push(n[M]),V.nextPosition.values.push(o[M]);for(M=2*m;M<2*m+8;++M)V.expandAndWidth.values.push(s[M]),F.defined(u)&&V.st.values.push(u[M]);if(F.defined(p))for(M=4*m;M<4*m+16;++M)V.color.values.push(p[M]);t=V.position.values.length/3-4,k.push(t,t+2,t+1),k.push(t+1,t+2,t+3)}}f&&(Ie(l),Ie(d)),te(e,l,d)}(e);break;case R.GeometryType.TRIANGLES:ve(e);break;case R.GeometryType.LINES:Ce(e)}else h(t),t.primitiveType===R.PrimitiveType.TRIANGLES?ve(e):t.primitiveType===R.PrimitiveType.LINES&&Ce(e);return e},e.GeometryPipeline=t}); |