define([ 'exports', './GeometryOffsetAttribute-ff1e192c', './Transforms-7cd3197b', './Matrix2-f2da41d4', './RuntimeError-ffe03243', './ComponentDatatype-17b06483', './when-229515d6', './GeometryAttribute-80036e07', './GeometryAttributes-b253752a', './VertexFormat-565d6a6c', ], function (t, e, a, n, r, i, o, m, u, s) { 'use strict'; var y = new n.Cartesian3(); function p(t) { var e = (t = o.defaultValue(t, o.defaultValue.EMPTY_OBJECT)).minimum, a = t.maximum, r = o.defaultValue(t.vertexFormat, s.VertexFormat.DEFAULT); (this._minimum = n.Cartesian3.clone(e)), (this._maximum = n.Cartesian3.clone(a)), (this._vertexFormat = r), (this._offsetAttribute = t.offsetAttribute), (this._workerName = 'createBoxGeometry'); } (p.fromDimensions = function (t) { var e = (t = o.defaultValue(t, o.defaultValue.EMPTY_OBJECT)).dimensions, a = n.Cartesian3.multiplyByScalar(e, 0.5, new n.Cartesian3()); return new p({ minimum: n.Cartesian3.negate(a, new n.Cartesian3()), maximum: a, vertexFormat: t.vertexFormat, offsetAttribute: t.offsetAttribute, }); }), (p.fromAxisAlignedBoundingBox = function (t) { return new p({ minimum: t.minimum, maximum: t.maximum }); }), (p.packedLength = 2 * n.Cartesian3.packedLength + s.VertexFormat.packedLength + 1), (p.pack = function (t, e, a) { return ( (a = o.defaultValue(a, 0)), n.Cartesian3.pack(t._minimum, e, a), n.Cartesian3.pack(t._maximum, e, a + n.Cartesian3.packedLength), s.VertexFormat.pack(t._vertexFormat, e, a + 2 * n.Cartesian3.packedLength), (e[a + 2 * n.Cartesian3.packedLength + s.VertexFormat.packedLength] = o.defaultValue( t._offsetAttribute, -1 )), e ); }); var x, f = new n.Cartesian3(), c = new n.Cartesian3(), A = new s.VertexFormat(), l = { minimum: f, maximum: c, vertexFormat: A, offsetAttribute: void 0 }; (p.unpack = function (t, e, a) { e = o.defaultValue(e, 0); var r = n.Cartesian3.unpack(t, e, f), i = n.Cartesian3.unpack(t, e + n.Cartesian3.packedLength, c), m = s.VertexFormat.unpack(t, e + 2 * n.Cartesian3.packedLength, A), u = t[e + 2 * n.Cartesian3.packedLength + s.VertexFormat.packedLength]; return o.defined(a) ? ((a._minimum = n.Cartesian3.clone(r, a._minimum)), (a._maximum = n.Cartesian3.clone(i, a._maximum)), (a._vertexFormat = s.VertexFormat.clone(m, a._vertexFormat)), (a._offsetAttribute = -1 === u ? void 0 : u), a) : ((l.offsetAttribute = -1 === u ? void 0 : u), new p(l)); }), (p.createGeometry = function (t) { var r = t._minimum, s = t._maximum, p = t._vertexFormat; if (!n.Cartesian3.equals(r, s)) { var x, f, c = new u.GeometryAttributes(); if (p.position && (p.st || p.normal || p.tangent || p.bitangent)) { if ( (p.position && (((f = new Float64Array(72))[0] = r.x), (f[1] = r.y), (f[2] = s.z), (f[3] = s.x), (f[4] = r.y), (f[5] = s.z), (f[6] = s.x), (f[7] = s.y), (f[8] = s.z), (f[9] = r.x), (f[10] = s.y), (f[11] = s.z), (f[12] = r.x), (f[13] = r.y), (f[14] = r.z), (f[15] = s.x), (f[16] = r.y), (f[17] = r.z), (f[18] = s.x), (f[19] = s.y), (f[20] = r.z), (f[21] = r.x), (f[22] = s.y), (f[23] = r.z), (f[24] = s.x), (f[25] = r.y), (f[26] = r.z), (f[27] = s.x), (f[28] = s.y), (f[29] = r.z), (f[30] = s.x), (f[31] = s.y), (f[32] = s.z), (f[33] = s.x), (f[34] = r.y), (f[35] = s.z), (f[36] = r.x), (f[37] = r.y), (f[38] = r.z), (f[39] = r.x), (f[40] = s.y), (f[41] = r.z), (f[42] = r.x), (f[43] = s.y), (f[44] = s.z), (f[45] = r.x), (f[46] = r.y), (f[47] = s.z), (f[48] = r.x), (f[49] = s.y), (f[50] = r.z), (f[51] = s.x), (f[52] = s.y), (f[53] = r.z), (f[54] = s.x), (f[55] = s.y), (f[56] = s.z), (f[57] = r.x), (f[58] = s.y), (f[59] = s.z), (f[60] = r.x), (f[61] = r.y), (f[62] = r.z), (f[63] = s.x), (f[64] = r.y), (f[65] = r.z), (f[66] = s.x), (f[67] = r.y), (f[68] = s.z), (f[69] = r.x), (f[70] = r.y), (f[71] = s.z), (c.position = new m.GeometryAttribute({ componentDatatype: i.ComponentDatatype.DOUBLE, componentsPerAttribute: 3, values: f, }))), p.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), (c.normal = new m.GeometryAttribute({ componentDatatype: i.ComponentDatatype.FLOAT, componentsPerAttribute: 3, values: A, })); } if (p.st) { var l = new Float32Array(48); (l[0] = 0), (l[1] = 0), (l[2] = 1), (l[3] = 0), (l[4] = 1), (l[5] = 1), (l[6] = 0), (l[7] = 1), (l[8] = 1), (l[9] = 0), (l[10] = 0), (l[11] = 0), (l[12] = 0), (l[13] = 1), (l[14] = 1), (l[15] = 1), (l[16] = 0), (l[17] = 0), (l[18] = 1), (l[19] = 0), (l[20] = 1), (l[21] = 1), (l[22] = 0), (l[23] = 1), (l[24] = 1), (l[25] = 0), (l[26] = 0), (l[27] = 0), (l[28] = 0), (l[29] = 1), (l[30] = 1), (l[31] = 1), (l[32] = 1), (l[33] = 0), (l[34] = 0), (l[35] = 0), (l[36] = 0), (l[37] = 1), (l[38] = 1), (l[39] = 1), (l[40] = 0), (l[41] = 0), (l[42] = 1), (l[43] = 0), (l[44] = 1), (l[45] = 1), (l[46] = 0), (l[47] = 1), (c.st = new m.GeometryAttribute({ componentDatatype: i.ComponentDatatype.FLOAT, componentsPerAttribute: 2, values: l, })); } if (p.tangent) { var d = new Float32Array(72); (d[0] = 1), (d[1] = 0), (d[2] = 0), (d[3] = 1), (d[4] = 0), (d[5] = 0), (d[6] = 1), (d[7] = 0), (d[8] = 0), (d[9] = 1), (d[10] = 0), (d[11] = 0), (d[12] = -1), (d[13] = 0), (d[14] = 0), (d[15] = -1), (d[16] = 0), (d[17] = 0), (d[18] = -1), (d[19] = 0), (d[20] = 0), (d[21] = -1), (d[22] = 0), (d[23] = 0), (d[24] = 0), (d[25] = 1), (d[26] = 0), (d[27] = 0), (d[28] = 1), (d[29] = 0), (d[30] = 0), (d[31] = 1), (d[32] = 0), (d[33] = 0), (d[34] = 1), (d[35] = 0), (d[36] = 0), (d[37] = -1), (d[38] = 0), (d[39] = 0), (d[40] = -1), (d[41] = 0), (d[42] = 0), (d[43] = -1), (d[44] = 0), (d[45] = 0), (d[46] = -1), (d[47] = 0), (d[48] = -1), (d[49] = 0), (d[50] = 0), (d[51] = -1), (d[52] = 0), (d[53] = 0), (d[54] = -1), (d[55] = 0), (d[56] = 0), (d[57] = -1), (d[58] = 0), (d[59] = 0), (d[60] = 1), (d[61] = 0), (d[62] = 0), (d[63] = 1), (d[64] = 0), (d[65] = 0), (d[66] = 1), (d[67] = 0), (d[68] = 0), (d[69] = 1), (d[70] = 0), (d[71] = 0), (c.tangent = new m.GeometryAttribute({ componentDatatype: i.ComponentDatatype.FLOAT, componentsPerAttribute: 3, values: d, })); } if (p.bitangent) { var b = new Float32Array(72); (b[0] = 0), (b[1] = 1), (b[2] = 0), (b[3] = 0), (b[4] = 1), (b[5] = 0), (b[6] = 0), (b[7] = 1), (b[8] = 0), (b[9] = 0), (b[10] = 1), (b[11] = 0), (b[12] = 0), (b[13] = 1), (b[14] = 0), (b[15] = 0), (b[16] = 1), (b[17] = 0), (b[18] = 0), (b[19] = 1), (b[20] = 0), (b[21] = 0), (b[22] = 1), (b[23] = 0), (b[24] = 0), (b[25] = 0), (b[26] = 1), (b[27] = 0), (b[28] = 0), (b[29] = 1), (b[30] = 0), (b[31] = 0), (b[32] = 1), (b[33] = 0), (b[34] = 0), (b[35] = 1), (b[36] = 0), (b[37] = 0), (b[38] = 1), (b[39] = 0), (b[40] = 0), (b[41] = 1), (b[42] = 0), (b[43] = 0), (b[44] = 1), (b[45] = 0), (b[46] = 0), (b[47] = 1), (b[48] = 0), (b[49] = 0), (b[50] = 1), (b[51] = 0), (b[52] = 0), (b[53] = 1), (b[54] = 0), (b[55] = 0), (b[56] = 1), (b[57] = 0), (b[58] = 0), (b[59] = 1), (b[60] = 0), (b[61] = 0), (b[62] = 1), (b[63] = 0), (b[64] = 0), (b[65] = 1), (b[66] = 0), (b[67] = 0), (b[68] = 1), (b[69] = 0), (b[70] = 0), (b[71] = 1), (c.bitangent = new m.GeometryAttribute({ componentDatatype: i.ComponentDatatype.FLOAT, componentsPerAttribute: 3, values: b, })); } ((x = new Uint16Array(36))[0] = 0), (x[1] = 1), (x[2] = 2), (x[3] = 0), (x[4] = 2), (x[5] = 3), (x[6] = 6), (x[7] = 5), (x[8] = 4), (x[9] = 7), (x[10] = 6), (x[11] = 4), (x[12] = 8), (x[13] = 9), (x[14] = 10), (x[15] = 8), (x[16] = 10), (x[17] = 11), (x[18] = 14), (x[19] = 13), (x[20] = 12), (x[21] = 15), (x[22] = 14), (x[23] = 12), (x[24] = 18), (x[25] = 17), (x[26] = 16), (x[27] = 19), (x[28] = 18), (x[29] = 16), (x[30] = 20), (x[31] = 21), (x[32] = 22), (x[33] = 20), (x[34] = 22), (x[35] = 23); } else ((f = new Float64Array(24))[0] = r.x), (f[1] = r.y), (f[2] = r.z), (f[3] = s.x), (f[4] = r.y), (f[5] = r.z), (f[6] = s.x), (f[7] = s.y), (f[8] = r.z), (f[9] = r.x), (f[10] = s.y), (f[11] = r.z), (f[12] = r.x), (f[13] = r.y), (f[14] = s.z), (f[15] = s.x), (f[16] = r.y), (f[17] = s.z), (f[18] = s.x), (f[19] = s.y), (f[20] = s.z), (f[21] = r.x), (f[22] = s.y), (f[23] = s.z), (c.position = new m.GeometryAttribute({ componentDatatype: i.ComponentDatatype.DOUBLE, componentsPerAttribute: 3, values: f, })), ((x = new Uint16Array(36))[0] = 4), (x[1] = 5), (x[2] = 6), (x[3] = 4), (x[4] = 6), (x[5] = 7), (x[6] = 1), (x[7] = 0), (x[8] = 3), (x[9] = 1), (x[10] = 3), (x[11] = 2), (x[12] = 1), (x[13] = 6), (x[14] = 5), (x[15] = 1), (x[16] = 2), (x[17] = 6), (x[18] = 2), (x[19] = 3), (x[20] = 7), (x[21] = 2), (x[22] = 7), (x[23] = 6), (x[24] = 3), (x[25] = 0), (x[26] = 4), (x[27] = 3), (x[28] = 4), (x[29] = 7), (x[30] = 0), (x[31] = 1), (x[32] = 5), (x[33] = 0), (x[34] = 5), (x[35] = 4); var C = n.Cartesian3.subtract(s, r, y), v = 0.5 * n.Cartesian3.magnitude(C); if (o.defined(t._offsetAttribute)) { var z = f.length, F = new Uint8Array(z / 3), w = t._offsetAttribute === e.GeometryOffsetAttribute.NONE ? 0 : 1; e.arrayFill(F, w), (c.applyOffset = new m.GeometryAttribute({ componentDatatype: i.ComponentDatatype.UNSIGNED_BYTE, componentsPerAttribute: 1, values: F, })); } return new m.Geometry({ attributes: c, indices: x, primitiveType: m.PrimitiveType.TRIANGLES, boundingSphere: new a.BoundingSphere(n.Cartesian3.ZERO, v), offsetAttribute: t._offsetAttribute, }); } }), (p.getUnitBox = function () { return ( o.defined(x) || (x = p.createGeometry( p.fromDimensions({ dimensions: new n.Cartesian3(1, 1, 1), vertexFormat: s.VertexFormat.POSITION_ONLY, }) )), x ); }), (t.BoxGeometry = p); });