1 |
- define(["./arrayFill-4513d7ad","./buildModuleUrl-8cce5713","./Cartesian4-b0ddc4ba","./Check-7b2a090c","./FeatureDetection-ab6f364c","./when-b60132fc","./GeometryAttribute-923c2729","./GeometryAttributes-252e9929","./GeometryOffsetAttribute-fbeb6f1a","./VertexFormat-6446fca0","./Math-31e539c2","./WebGLConstants-aba9fc67"],(function(e,t,a,n,r,i,o,m,u,s,y,c){"use strict";var f=new a.Cartesian3;function p(e){var t=(e=i.defaultValue(e,i.defaultValue.EMPTY_OBJECT)).minimum,n=e.maximum,r=i.defaultValue(e.vertexFormat,s.VertexFormat.DEFAULT);this._minimum=a.Cartesian3.clone(t),this._maximum=a.Cartesian3.clone(n),this._vertexFormat=r,this._offsetAttribute=e.offsetAttribute,this._workerName="createBoxGeometry"}p.fromDimensions=function(e){var t=(e=i.defaultValue(e,i.defaultValue.EMPTY_OBJECT)).dimensions,n=a.Cartesian3.multiplyByScalar(t,.5,new a.Cartesian3);return new p({minimum:a.Cartesian3.negate(n,new a.Cartesian3),maximum:n,vertexFormat:e.vertexFormat,offsetAttribute:e.offsetAttribute})},p.fromAxisAlignedBoundingBox=function(e){return new p({minimum:e.minimum,maximum:e.maximum})},p.packedLength=2*a.Cartesian3.packedLength+s.VertexFormat.packedLength+1,p.pack=function(e,t,n){return n=i.defaultValue(n,0),a.Cartesian3.pack(e._minimum,t,n),a.Cartesian3.pack(e._maximum,t,n+a.Cartesian3.packedLength),s.VertexFormat.pack(e._vertexFormat,t,n+2*a.Cartesian3.packedLength),t[n+2*a.Cartesian3.packedLength+s.VertexFormat.packedLength]=i.defaultValue(e._offsetAttribute,-1),t};var x,l=new a.Cartesian3,A=new a.Cartesian3,b=new s.VertexFormat,d={minimum:l,maximum:A,vertexFormat:b,offsetAttribute:void 0};return p.unpack=function(e,t,n){t=i.defaultValue(t,0);var r=a.Cartesian3.unpack(e,t,l),o=a.Cartesian3.unpack(e,t+a.Cartesian3.packedLength,A),m=s.VertexFormat.unpack(e,t+2*a.Cartesian3.packedLength,b),u=e[t+2*a.Cartesian3.packedLength+s.VertexFormat.packedLength];return i.defined(n)?(n._minimum=a.Cartesian3.clone(r,n._minimum),n._maximum=a.Cartesian3.clone(o,n._maximum),n._vertexFormat=s.VertexFormat.clone(m,n._vertexFormat),n._offsetAttribute=-1===u?void 0:u,n):(d.offsetAttribute=-1===u?void 0:u,new p(d))},p.createGeometry=function(n){var s=n._minimum,y=n._maximum,c=n._vertexFormat;if(!a.Cartesian3.equals(s,y)){var p,x,l=new m.GeometryAttributes;if(c.position&&(c.st||c.normal||c.tangent||c.bitangent)){if(c.position&&((x=new Float64Array(72))[0]=s.x,x[1]=s.y,x[2]=y.z,x[3]=y.x,x[4]=s.y,x[5]=y.z,x[6]=y.x,x[7]=y.y,x[8]=y.z,x[9]=s.x,x[10]=y.y,x[11]=y.z,x[12]=s.x,x[13]=s.y,x[14]=s.z,x[15]=y.x,x[16]=s.y,x[17]=s.z,x[18]=y.x,x[19]=y.y,x[20]=s.z,x[21]=s.x,x[22]=y.y,x[23]=s.z,x[24]=y.x,x[25]=s.y,x[26]=s.z,x[27]=y.x,x[28]=y.y,x[29]=s.z,x[30]=y.x,x[31]=y.y,x[32]=y.z,x[33]=y.x,x[34]=s.y,x[35]=y.z,x[36]=s.x,x[37]=s.y,x[38]=s.z,x[39]=s.x,x[40]=y.y,x[41]=s.z,x[42]=s.x,x[43]=y.y,x[44]=y.z,x[45]=s.x,x[46]=s.y,x[47]=y.z,x[48]=s.x,x[49]=y.y,x[50]=s.z,x[51]=y.x,x[52]=y.y,x[53]=s.z,x[54]=y.x,x[55]=y.y,x[56]=y.z,x[57]=s.x,x[58]=y.y,x[59]=y.z,x[60]=s.x,x[61]=s.y,x[62]=s.z,x[63]=y.x,x[64]=s.y,x[65]=s.z,x[66]=y.x,x[67]=s.y,x[68]=y.z,x[69]=s.x,x[70]=s.y,x[71]=y.z,l.position=new o.GeometryAttribute({componentDatatype:r.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:x})),c.normal){var A=new Float32Array(72);A[0]=0,A[1]=0,A[2]=1,A[3]=0,A[4]=0,A[5]=1,A[6]=0,A[7]=0,A[8]=1,A[9]=0,A[10]=0,A[11]=1,A[12]=0,A[13]=0,A[14]=-1,A[15]=0,A[16]=0,A[17]=-1,A[18]=0,A[19]=0,A[20]=-1,A[21]=0,A[22]=0,A[23]=-1,A[24]=1,A[25]=0,A[26]=0,A[27]=1,A[28]=0,A[29]=0,A[30]=1,A[31]=0,A[32]=0,A[33]=1,A[34]=0,A[35]=0,A[36]=-1,A[37]=0,A[38]=0,A[39]=-1,A[40]=0,A[41]=0,A[42]=-1,A[43]=0,A[44]=0,A[45]=-1,A[46]=0,A[47]=0,A[48]=0,A[49]=1,A[50]=0,A[51]=0,A[52]=1,A[53]=0,A[54]=0,A[55]=1,A[56]=0,A[57]=0,A[58]=1,A[59]=0,A[60]=0,A[61]=-1,A[62]=0,A[63]=0,A[64]=-1,A[65]=0,A[66]=0,A[67]=-1,A[68]=0,A[69]=0,A[70]=-1,A[71]=0,l.normal=new o.GeometryAttribute({componentDatatype:r.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:A})}if(c.st){var b=new Float32Array(72),d=0;b[d++]=0,b[d++]=0,b[d++]=-1,b[d++]=1,b[d++]=0,b[d++]=-1,b[d++]=1,b[d++]=1,b[d++]=-1,b[d++]=0,b[d++]=1,b[d++]=-1,b[d++]=1,b[d++]=0,b[d++]=-1,b[d++]=0,b[d++]=0,b[d++]=-1,b[d++]=0,b[d++]=1,b[d++]=-1,b[d++]=1,b[d++]=1,b[d++]=-1,b[d++]=0,b[d++]=0,b[d++]=0,b[d++]=1,b[d++]=0,b[d++]=0,b[d++]=1,b[d++]=1,b[d++]=0,b[d++]=0,b[d++]=1,b[d++]=0,b[d++]=1,b[d++]=0,b[d++]=0,b[d++]=0,b[d++]=0,b[d++]=0,b[d++]=0,b[d++]=1,b[d++]=0,b[d++]=1,b[d++]=1,b[d++]=0,b[d++]=1,b[d++]=0,b[d++]=1,b[d++]=0,b[d++]=0,b[d++]=1,b[d++]=0,b[d++]=1,b[d++]=1,b[d++]=1,b[d++]=1,b[d++]=1,b[d++]=0,b[d++]=0,b[d++]=1,b[d++]=1,b[d++]=0,b[d++]=1,b[d++]=1,b[d++]=1,b[d++]=1,b[d++]=0,b[d++]=1,b[d++]=1,l.st=new o.GeometryAttribute({componentDatatype:r.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:b})}if(c.tangent){var C=new Float32Array(72);C[0]=1,C[1]=0,C[2]=0,C[3]=1,C[4]=0,C[5]=0,C[6]=1,C[7]=0,C[8]=0,C[9]=1,C[10]=0,C[11]=0,C[12]=-1,C[13]=0,C[14]=0,C[15]=-1,C[16]=0,C[17]=0,C[18]=-1,C[19]=0,C[20]=0,C[21]=-1,C[22]=0,C[23]=0,C[24]=0,C[25]=1,C[26]=0,C[27]=0,C[28]=1,C[29]=0,C[30]=0,C[31]=1,C[32]=0,C[33]=0,C[34]=1,C[35]=0,C[36]=0,C[37]=-1,C[38]=0,C[39]=0,C[40]=-1,C[41]=0,C[42]=0,C[43]=-1,C[44]=0,C[45]=0,C[46]=-1,C[47]=0,C[48]=-1,C[49]=0,C[50]=0,C[51]=-1,C[52]=0,C[53]=0,C[54]=-1,C[55]=0,C[56]=0,C[57]=-1,C[58]=0,C[59]=0,C[60]=1,C[61]=0,C[62]=0,C[63]=1,C[64]=0,C[65]=0,C[66]=1,C[67]=0,C[68]=0,C[69]=1,C[70]=0,C[71]=0,l.tangent=new o.GeometryAttribute({componentDatatype:r.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:C})}if(c.bitangent){var v=new Float32Array(72);v[0]=0,v[1]=1,v[2]=0,v[3]=0,v[4]=1,v[5]=0,v[6]=0,v[7]=1,v[8]=0,v[9]=0,v[10]=1,v[11]=0,v[12]=0,v[13]=1,v[14]=0,v[15]=0,v[16]=1,v[17]=0,v[18]=0,v[19]=1,v[20]=0,v[21]=0,v[22]=1,v[23]=0,v[24]=0,v[25]=0,v[26]=1,v[27]=0,v[28]=0,v[29]=1,v[30]=0,v[31]=0,v[32]=1,v[33]=0,v[34]=0,v[35]=1,v[36]=0,v[37]=0,v[38]=1,v[39]=0,v[40]=0,v[41]=1,v[42]=0,v[43]=0,v[44]=1,v[45]=0,v[46]=0,v[47]=1,v[48]=0,v[49]=0,v[50]=1,v[51]=0,v[52]=0,v[53]=1,v[54]=0,v[55]=0,v[56]=1,v[57]=0,v[58]=0,v[59]=1,v[60]=0,v[61]=0,v[62]=1,v[63]=0,v[64]=0,v[65]=1,v[66]=0,v[67]=0,v[68]=1,v[69]=0,v[70]=0,v[71]=1,l.bitangent=new o.GeometryAttribute({componentDatatype:r.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:v})}(p=new Uint16Array(36))[0]=0,p[1]=1,p[2]=2,p[3]=0,p[4]=2,p[5]=3,p[6]=6,p[7]=5,p[8]=4,p[9]=7,p[10]=6,p[11]=4,p[12]=8,p[13]=9,p[14]=10,p[15]=8,p[16]=10,p[17]=11,p[18]=14,p[19]=13,p[20]=12,p[21]=15,p[22]=14,p[23]=12,p[24]=18,p[25]=17,p[26]=16,p[27]=19,p[28]=18,p[29]=16,p[30]=20,p[31]=21,p[32]=22,p[33]=20,p[34]=22,p[35]=23}else(x=new Float64Array(24))[0]=s.x,x[1]=s.y,x[2]=s.z,x[3]=y.x,x[4]=s.y,x[5]=s.z,x[6]=y.x,x[7]=y.y,x[8]=s.z,x[9]=s.x,x[10]=y.y,x[11]=s.z,x[12]=s.x,x[13]=s.y,x[14]=y.z,x[15]=y.x,x[16]=s.y,x[17]=y.z,x[18]=y.x,x[19]=y.y,x[20]=y.z,x[21]=s.x,x[22]=y.y,x[23]=y.z,l.position=new o.GeometryAttribute({componentDatatype:r.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:x}),(p=new Uint16Array(36))[0]=4,p[1]=5,p[2]=6,p[3]=4,p[4]=6,p[5]=7,p[6]=1,p[7]=0,p[8]=3,p[9]=1,p[10]=3,p[11]=2,p[12]=1,p[13]=6,p[14]=5,p[15]=1,p[16]=2,p[17]=6,p[18]=2,p[19]=3,p[20]=7,p[21]=2,p[22]=7,p[23]=6,p[24]=3,p[25]=0,p[26]=4,p[27]=3,p[28]=4,p[29]=7,p[30]=0,p[31]=1,p[32]=5,p[33]=0,p[34]=5,p[35]=4;var F=a.Cartesian3.subtract(y,s,f),z=.5*a.Cartesian3.magnitude(F);if(i.defined(n._offsetAttribute)){var w=x.length,_=new Uint8Array(w/3),g=n._offsetAttribute===u.GeometryOffsetAttribute.NONE?0:1;e.arrayFill(_,g),l.applyOffset=new o.GeometryAttribute({componentDatatype:r.ComponentDatatype.UNSIGNED_BYTE,componentsPerAttribute:1,values:_})}return new o.Geometry({attributes:l,indices:p,primitiveType:t.PrimitiveType.TRIANGLES,boundingSphere:new t.BoundingSphere(a.Cartesian3.ZERO,z),offsetAttribute:n._offsetAttribute})}},p.getUnitBox=function(){return i.defined(x)||(x=p.createGeometry(p.fromDimensions({dimensions:new a.Cartesian3(1,1,1),vertexFormat:s.VertexFormat.POSITION_ONLY}))),x},function(e,t){return i.defined(t)&&(e=p.unpack(e,t)),p.createGeometry(e)}}));
|