bmh_cesium/public/lib/cesiumjs/CesiumUnminified/Workers/BoxGeometry-3a237d08.js

2 lines
8.0 KiB
JavaScript
Raw Normal View History

2025-03-09 23:23:50 +00:00
/* 2020-9-22 15:23:26 | 版权所有 军懋国兴 */
define(["exports","./when-cbf8cd21","./Check-35e1a91d","./Cartesian2-43e3a3be","./Transforms-2d1ac5ec","./ComponentDatatype-607c9a0c","./GeometryAttribute-2303bbfb","./GeometryAttributes-90846c5f","./GeometryOffsetAttribute-9c676324","./VertexFormat-fe64931e"],function(e,A,m,d,l,C,h,v,z,u){"use strict";var w=new d.Cartesian3;function s(e){var t=(e=A.defaultValue(e,A.defaultValue.EMPTY_OBJECT)).minimum,a=e.maximum;if(m.Check.typeOf.object("min",t),m.Check.typeOf.object("max",a),A.defined(e.offsetAttribute)&&e.offsetAttribute===z.GeometryOffsetAttribute.TOP)throw new m.DeveloperError("GeometryOffsetAttribute.TOP is not a supported options.offsetAttribute for this geometry.");var n=A.defaultValue(e.vertexFormat,u.VertexFormat.DEFAULT);this._minimum=d.Cartesian3.clone(t),this._maximum=d.Cartesian3.clone(a),this._vertexFormat=n,this._offsetAttribute=e.offsetAttribute,this._workerName="createBoxGeometry"}s.fromDimensions=function(e){var t=(e=A.defaultValue(e,A.defaultValue.EMPTY_OBJECT)).dimensions;m.Check.typeOf.object("dimensions",t),m.Check.typeOf.number.greaterThanOrEquals("dimensions.x",t.x,0),m.Check.typeOf.number.greaterThanOrEquals("dimensions.y",t.y,0),m.Check.typeOf.number.greaterThanOrEquals("dimensions.z",t.z,0);var a=d.Cartesian3.multiplyByScalar(t,.5,new d.Cartesian3);return new s({minimum:d.Cartesian3.negate(a,new d.Cartesian3),maximum:a,vertexFormat:e.vertexFormat,offsetAttribute:e.offsetAttribute})},s.fromAxisAlignedBoundingBox=function(e){return m.Check.typeOf.object("boundingBox",e),new s({minimum:e.minimum,maximum:e.maximum})},s.packedLength=2*d.Cartesian3.packedLength+u.VertexFormat.packedLength+1,s.pack=function(e,t,a){return m.Check.typeOf.object("value",e),m.Check.defined("array",t),a=A.defaultValue(a,0),d.Cartesian3.pack(e._minimum,t,a),d.Cartesian3.pack(e._maximum,t,a+d.Cartesian3.packedLength),u.VertexFormat.pack(e._vertexFormat,t,a+2*d.Cartesian3.packedLength),t[a+2*d.Cartesian3.packedLength+u.VertexFormat.packedLength]=A.defaultValue(e._offsetAttribute,-1),t};var t,y=new d.Cartesian3,f=new d.Cartesian3,p=new u.VertexFormat,c={minimum:y,maximum:f,vertexFormat:p,offsetAttribute:void 0};s.unpack=function(e,t,a){m.Check.defined("array",e),t=A.defaultValue(t,0);var n=d.Cartesian3.unpack(e,t,y),r=d.Cartesian3.unpack(e,t+d.Cartesian3.packedLength,f),i=u.VertexFormat.unpack(e,t+2*d.Cartesian3.packedLength,p),o=e[t+2*d.Cartesian3.packedLength+u.VertexFormat.packedLength];return A.defined(a)?(a._minimum=d.Cartesian3.clone(n,a._minimum),a._maximum=d.Cartesian3.clone(r,a._maximum),a._vertexFormat=u.VertexFormat.clone(i,a._vertexFormat),a._offsetAttribute=-1===o?void 0:o,a):(c.offsetAttribute=-1===o?void 0:o,new s(c))},s.createGeometry=function(e){var t=e._minimum,a=e._maximum,n=e._vertexFormat;if(!d.Cartesian3.equals(t,a)){var r,i,o,m,u,s,y=new v.GeometryAttributes;n.position&&(n.st||n.normal||n.tangent||n.bitangent)?(n.position&&((i=new Float64Array(72))[0]=t.x,i[1]=t.y,i[2]=a.z,i[3]=a.x,i[4]=t.y,i[5]=a.z,i[6]=a.x,i[7]=a.y,i[8]=a.z,i[9]=t.x,i[10]=a.y,i[11]=a.z,i[12]=t.x,i[13]=t.y,i[14]=t.z,i[15]=a.x,i[16]=t.y,i[17]=t.z,i[18]=a.x,i[19]=a.y,i[20]=t.z,i[21]=t.x,i[22]=a.y,i[23]=t.z,i[24]=a.x,i[25]=t.y,i[26]=t.z,i[27]=a.x,i[28]=a.y,i[29]=t.z,i[30]=a.x,i[31]=a.y,i[32]=a.z,i[33]=a.x,i[34]=t.y,i[35]=a.z,i[36]=t.x,i[37]=t.y,i[38]=t.z,i[39]=t.x,i[40]=a.y,i[41]=t.z,i[42]=t.x,i[43]=a.y,i[44]=a.z,i[45]=t.x,i[46]=t.y,i[47]=a.z,i[48]=t.x,i[49]=a.y,i[50]=t.z,i[51]=a.x,i[52]=a.y,i[53]=t.z,i[54]=a.x,i[55]=a.y,i[56]=a.z,i[57]=t.x,i[58]=a.y,i[59]=a.z,i[60]=t.x,i[61]=t.y,i[62]=t.z,i[63]=a.x,i[64]=t.y,i[65]=t.z,i[66]=a.x,i[67]=t.y,i[68]=a.z,i[69]=t.x,i[70]=t.y,i[71]=a.z,y.position=new h.GeometryAttribute({componentDatatype:C.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:i})),n.normal&&((o=new Float32Array(72))[0]=0,o[1]=0,o[2]=1,o[3]=0,o[4]=0,o[5]=1,o[6]=0,o[7]=0,o[8]=1,o[9]=0,o[10]=0,o[11]=1,o[12]=0,o[13]=0,o[14]=-1,o[15]=0,o[16]=0,o[17]=-1,o[18]=0,o[19]=0,o[20]=-1,o[21]=0,o[22]=0,o[23]=-1,o[24]=1,o[25]=0,o[26]=0,o[27]=1,o[28]=0,o[29]=0,o[30]=1,o[31]=0,o[32]=0,o[33]=1,o[34]=0,o[35]=0,o[36]=-1,o[37]=0,o[38]=0,o[39]=-1,