Commit 155e1be1 authored by Santhanavanich's avatar Santhanavanich
Browse files

Merge branch 'upload' into 'master'

upload application

See merge request !2
parents 12535794 b60fc2e0
Pipeline #11100 passed with stage
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.121.2
*
* Copyright 2011-2022 Cesium Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Columbus View (Pat. Pend.)
*
* Portions licensed separately.
* See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
*/
import {
GeometryOffsetAttribute_default
} from "./chunk-GBT7MJ6X.js";
import {
VertexFormat_default
} from "./chunk-JBSKHTNX.js";
import {
GeometryAttributes_default
} from "./chunk-X7IQYYHF.js";
import {
GeometryAttribute_default,
Geometry_default,
PrimitiveType_default
} from "./chunk-JXVLNVXC.js";
import {
BoundingSphere_default
} from "./chunk-KHZNBFOH.js";
import {
ComponentDatatype_default
} from "./chunk-XIUSRWL6.js";
import {
Cartesian3_default
} from "./chunk-FFLMY4TE.js";
import {
defaultValue_default
} from "./chunk-U5HSOKPQ.js";
import {
Check_default,
DeveloperError_default
} from "./chunk-P6TRGU3S.js";
import {
defined_default
} from "./chunk-YCDZX5LS.js";
// packages/engine/Source/Core/BoxGeometry.js
var diffScratch = new Cartesian3_default();
function BoxGeometry(options) {
options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
const min = options.minimum;
const max = options.maximum;
Check_default.typeOf.object("min", min);
Check_default.typeOf.object("max", max);
if (defined_default(options.offsetAttribute) && options.offsetAttribute === GeometryOffsetAttribute_default.TOP) {
throw new DeveloperError_default(
"GeometryOffsetAttribute.TOP is not a supported options.offsetAttribute for this geometry."
);
}
const vertexFormat = defaultValue_default(options.vertexFormat, VertexFormat_default.DEFAULT);
this._minimum = Cartesian3_default.clone(min);
this._maximum = Cartesian3_default.clone(max);
this._vertexFormat = vertexFormat;
this._offsetAttribute = options.offsetAttribute;
this._workerName = "createBoxGeometry";
}
BoxGeometry.fromDimensions = function(options) {
options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
const dimensions = options.dimensions;
Check_default.typeOf.object("dimensions", dimensions);
Check_default.typeOf.number.greaterThanOrEquals("dimensions.x", dimensions.x, 0);
Check_default.typeOf.number.greaterThanOrEquals("dimensions.y", dimensions.y, 0);
Check_default.typeOf.number.greaterThanOrEquals("dimensions.z", dimensions.z, 0);
const corner = Cartesian3_default.multiplyByScalar(dimensions, 0.5, new Cartesian3_default());
return new BoxGeometry({
minimum: Cartesian3_default.negate(corner, new Cartesian3_default()),
maximum: corner,
vertexFormat: options.vertexFormat,
offsetAttribute: options.offsetAttribute
});
};
BoxGeometry.fromAxisAlignedBoundingBox = function(boundingBox) {
Check_default.typeOf.object("boundingBox", boundingBox);
return new BoxGeometry({
minimum: boundingBox.minimum,
maximum: boundingBox.maximum
});
};
BoxGeometry.packedLength = 2 * Cartesian3_default.packedLength + VertexFormat_default.packedLength + 1;
BoxGeometry.pack = function(value, array, startingIndex) {
Check_default.typeOf.object("value", value);
Check_default.defined("array", array);
startingIndex = defaultValue_default(startingIndex, 0);
Cartesian3_default.pack(value._minimum, array, startingIndex);
Cartesian3_default.pack(
value._maximum,
array,
startingIndex + Cartesian3_default.packedLength
);
VertexFormat_default.pack(
value._vertexFormat,
array,
startingIndex + 2 * Cartesian3_default.packedLength
);
array[startingIndex + 2 * Cartesian3_default.packedLength + VertexFormat_default.packedLength] = defaultValue_default(value._offsetAttribute, -1);
return array;
};
var scratchMin = new Cartesian3_default();
var scratchMax = new Cartesian3_default();
var scratchVertexFormat = new VertexFormat_default();
var scratchOptions = {
minimum: scratchMin,
maximum: scratchMax,
vertexFormat: scratchVertexFormat,
offsetAttribute: void 0
};
BoxGeometry.unpack = function(array, startingIndex, result) {
Check_default.defined("array", array);
startingIndex = defaultValue_default(startingIndex, 0);
const min = Cartesian3_default.unpack(array, startingIndex, scratchMin);
const max = Cartesian3_default.unpack(
array,
startingIndex + Cartesian3_default.packedLength,
scratchMax
);
const vertexFormat = VertexFormat_default.unpack(
array,
startingIndex + 2 * Cartesian3_default.packedLength,
scratchVertexFormat
);
const offsetAttribute = array[startingIndex + 2 * Cartesian3_default.packedLength + VertexFormat_default.packedLength];
if (!defined_default(result)) {
scratchOptions.offsetAttribute = offsetAttribute === -1 ? void 0 : offsetAttribute;
return new BoxGeometry(scratchOptions);
}
result._minimum = Cartesian3_default.clone(min, result._minimum);
result._maximum = Cartesian3_default.clone(max, result._maximum);
result._vertexFormat = VertexFormat_default.clone(vertexFormat, result._vertexFormat);
result._offsetAttribute = offsetAttribute === -1 ? void 0 : offsetAttribute;
return result;
};
BoxGeometry.createGeometry = function(boxGeometry) {
const min = boxGeometry._minimum;
const max = boxGeometry._maximum;
const vertexFormat = boxGeometry._vertexFormat;
if (Cartesian3_default.equals(min, max)) {
return;
}
const attributes = new GeometryAttributes_default();
let indices;
let positions;
if (vertexFormat.position && (vertexFormat.st || vertexFormat.normal || vertexFormat.tangent || vertexFormat.bitangent)) {
if (vertexFormat.position) {
positions = new Float64Array(6 * 4 * 3);
positions[0] = min.x;
positions[1] = min.y;
positions[2] = max.z;
positions[3] = max.x;
positions[4] = min.y;
positions[5] = max.z;
positions[6] = max.x;
positions[7] = max.y;
positions[8] = max.z;
positions[9] = min.x;
positions[10] = max.y;
positions[11] = max.z;
positions[12] = min.x;
positions[13] = min.y;
positions[14] = min.z;
positions[15] = max.x;
positions[16] = min.y;
positions[17] = min.z;
positions[18] = max.x;
positions[19] = max.y;
positions[20] = min.z;
positions[21] = min.x;
positions[22] = max.y;
positions[23] = min.z;
positions[24] = max.x;
positions[25] = min.y;
positions[26] = min.z;
positions[27] = max.x;
positions[28] = max.y;
positions[29] = min.z;
positions[30] = max.x;
positions[31] = max.y;
positions[32] = max.z;
positions[33] = max.x;
positions[34] = min.y;
positions[35] = max.z;
positions[36] = min.x;
positions[37] = min.y;
positions[38] = min.z;
positions[39] = min.x;
positions[40] = max.y;
positions[41] = min.z;
positions[42] = min.x;
positions[43] = max.y;
positions[44] = max.z;
positions[45] = min.x;
positions[46] = min.y;
positions[47] = max.z;
positions[48] = min.x;
positions[49] = max.y;
positions[50] = min.z;
positions[51] = max.x;
positions[52] = max.y;
positions[53] = min.z;
positions[54] = max.x;
positions[55] = max.y;
positions[56] = max.z;
positions[57] = min.x;
positions[58] = max.y;
positions[59] = max.z;
positions[60] = min.x;
positions[61] = min.y;
positions[62] = min.z;
positions[63] = max.x;
positions[64] = min.y;
positions[65] = min.z;
positions[66] = max.x;
positions[67] = min.y;
positions[68] = max.z;
positions[69] = min.x;
positions[70] = min.y;
positions[71] = max.z;
attributes.position = new GeometryAttribute_default({
componentDatatype: ComponentDatatype_default.DOUBLE,
componentsPerAttribute: 3,
values: positions
});
}
if (vertexFormat.normal) {
const normals = new Float32Array(6 * 4 * 3);
normals[0] = 0;
normals[1] = 0;
normals[2] = 1;
normals[3] = 0;
normals[4] = 0;
normals[5] = 1;
normals[6] = 0;
normals[7] = 0;
normals[8] = 1;
normals[9] = 0;
normals[10] = 0;
normals[11] = 1;
normals[12] = 0;
normals[13] = 0;
normals[14] = -1;
normals[15] = 0;
normals[16] = 0;
normals[17] = -1;
normals[18] = 0;
normals[19] = 0;
normals[20] = -1;
normals[21] = 0;
normals[22] = 0;
normals[23] = -1;
normals[24] = 1;
normals[25] = 0;
normals[26] = 0;
normals[27] = 1;
normals[28] = 0;
normals[29] = 0;
normals[30] = 1;
normals[31] = 0;
normals[32] = 0;
normals[33] = 1;
normals[34] = 0;
normals[35] = 0;
normals[36] = -1;
normals[37] = 0;
normals[38] = 0;
normals[39] = -1;
normals[40] = 0;
normals[41] = 0;
normals[42] = -1;
normals[43] = 0;
normals[44] = 0;
normals[45] = -1;
normals[46] = 0;
normals[47] = 0;
normals[48] = 0;
normals[49] = 1;
normals[50] = 0;
normals[51] = 0;
normals[52] = 1;
normals[53] = 0;
normals[54] = 0;
normals[55] = 1;
normals[56] = 0;
normals[57] = 0;
normals[58] = 1;
normals[59] = 0;
normals[60] = 0;
normals[61] = -1;
normals[62] = 0;
normals[63] = 0;
normals[64] = -1;
normals[65] = 0;
normals[66] = 0;
normals[67] = -1;
normals[68] = 0;
normals[69] = 0;
normals[70] = -1;
normals[71] = 0;
attributes.normal = new GeometryAttribute_default({
componentDatatype: ComponentDatatype_default.FLOAT,
componentsPerAttribute: 3,
values: normals
});
}
if (vertexFormat.st) {
const texCoords = new Float32Array(6 * 4 * 2);
texCoords[0] = 0;
texCoords[1] = 0;
texCoords[2] = 1;
texCoords[3] = 0;
texCoords[4] = 1;
texCoords[5] = 1;
texCoords[6] = 0;
texCoords[7] = 1;
texCoords[8] = 1;
texCoords[9] = 0;
texCoords[10] = 0;
texCoords[11] = 0;
texCoords[12] = 0;
texCoords[13] = 1;
texCoords[14] = 1;
texCoords[15] = 1;
texCoords[16] = 0;
texCoords[17] = 0;
texCoords[18] = 1;
texCoords[19] = 0;
texCoords[20] = 1;
texCoords[21] = 1;
texCoords[22] = 0;
texCoords[23] = 1;
texCoords[24] = 1;
texCoords[25] = 0;
texCoords[26] = 0;
texCoords[27] = 0;
texCoords[28] = 0;
texCoords[29] = 1;
texCoords[30] = 1;
texCoords[31] = 1;
texCoords[32] = 1;
texCoords[33] = 0;
texCoords[34] = 0;
texCoords[35] = 0;
texCoords[36] = 0;
texCoords[37] = 1;
texCoords[38] = 1;
texCoords[39] = 1;
texCoords[40] = 0;
texCoords[41] = 0;
texCoords[42] = 1;
texCoords[43] = 0;
texCoords[44] = 1;
texCoords[45] = 1;
texCoords[46] = 0;
texCoords[47] = 1;
attributes.st = new GeometryAttribute_default({
componentDatatype: ComponentDatatype_default.FLOAT,
componentsPerAttribute: 2,
values: texCoords
});
}
if (vertexFormat.tangent) {
const tangents = new Float32Array(6 * 4 * 3);
tangents[0] = 1;
tangents[1] = 0;
tangents[2] = 0;
tangents[3] = 1;
tangents[4] = 0;
tangents[5] = 0;
tangents[6] = 1;
tangents[7] = 0;
tangents[8] = 0;
tangents[9] = 1;
tangents[10] = 0;
tangents[11] = 0;
tangents[12] = -1;
tangents[13] = 0;
tangents[14] = 0;
tangents[15] = -1;
tangents[16] = 0;
tangents[17] = 0;
tangents[18] = -1;
tangents[19] = 0;
tangents[20] = 0;
tangents[21] = -1;
tangents[22] = 0;
tangents[23] = 0;
tangents[24] = 0;
tangents[25] = 1;
tangents[26] = 0;
tangents[27] = 0;
tangents[28] = 1;
tangents[29] = 0;
tangents[30] = 0;
tangents[31] = 1;
tangents[32] = 0;
tangents[33] = 0;
tangents[34] = 1;
tangents[35] = 0;
tangents[36] = 0;
tangents[37] = -1;
tangents[38] = 0;
tangents[39] = 0;
tangents[40] = -1;
tangents[41] = 0;
tangents[42] = 0;
tangents[43] = -1;
tangents[44] = 0;
tangents[45] = 0;
tangents[46] = -1;
tangents[47] = 0;
tangents[48] = -1;
tangents[49] = 0;
tangents[50] = 0;
tangents[51] = -1;
tangents[52] = 0;
tangents[53] = 0;
tangents[54] = -1;
tangents[55] = 0;
tangents[56] = 0;
tangents[57] = -1;
tangents[58] = 0;
tangents[59] = 0;
tangents[60] = 1;
tangents[61] = 0;
tangents[62] = 0;
tangents[63] = 1;
tangents[64] = 0;
tangents[65] = 0;
tangents[66] = 1;
tangents[67] = 0;
tangents[68] = 0;
tangents[69] = 1;
tangents[70] = 0;
tangents[71] = 0;
attributes.tangent = new GeometryAttribute_default({
componentDatatype: ComponentDatatype_default.FLOAT,
componentsPerAttribute: 3,
values: tangents
});
}
if (vertexFormat.bitangent) {
const bitangents = new Float32Array(6 * 4 * 3);
bitangents[0] = 0;
bitangents[1] = 1;
bitangents[2] = 0;
bitangents[3] = 0;
bitangents[4] = 1;
bitangents[5] = 0;
bitangents[6] = 0;
bitangents[7] = 1;
bitangents[8] = 0;
bitangents[9] = 0;
bitangents[10] = 1;
bitangents[11] = 0;
bitangents[12] = 0;
bitangents[13] = 1;
bitangents[14] = 0;
bitangents[15] = 0;
bitangents[16] = 1;
bitangents[17] = 0;
bitangents[18] = 0;
bitangents[19] = 1;
bitangents[20] = 0;
bitangents[21] = 0;
bitangents[22] = 1;
bitangents[23] = 0;
bitangents[24] = 0;
bitangents[25] = 0;
bitangents[26] = 1;
bitangents[27] = 0;
bitangents[28] = 0;
bitangents[29] = 1;
bitangents[30] = 0;
bitangents[31] = 0;
bitangents[32] = 1;
bitangents[33] = 0;
bitangents[34] = 0;
bitangents[35] = 1;
bitangents[36] = 0;
bitangents[37] = 0;
bitangents[38] = 1;
bitangents[39] = 0;
bitangents[40] = 0;
bitangents[41] = 1;
bitangents[42] = 0;
bitangents[43] = 0;
bitangents[44] = 1;
bitangents[45] = 0;
bitangents[46] = 0;
bitangents[47] = 1;
bitangents[48] = 0;
bitangents[49] = 0;
bitangents[50] = 1;
bitangents[51] = 0;
bitangents[52] = 0;
bitangents[53] = 1;
bitangents[54] = 0;
bitangents[55] = 0;
bitangents[56] = 1;
bitangents[57] = 0;
bitangents[58] = 0;
bitangents[59] = 1;
bitangents[60] = 0;
bitangents[61] = 0;
bitangents[62] = 1;
bitangents[63] = 0;
bitangents[64] = 0;
bitangents[65] = 1;
bitangents[66] = 0;
bitangents[67] = 0;
bitangents[68] = 1;
bitangents[69] = 0;
bitangents[70] = 0;
bitangents[71] = 1;
attributes.bitangent = new GeometryAttribute_default({
componentDatatype: ComponentDatatype_default.FLOAT,
componentsPerAttribute: 3,
values: bitangents
});
}
indices = new Uint16Array(6 * 2 * 3);
indices[0] = 0;
indices[1] = 1;
indices[2] = 2;
indices[3] = 0;
indices[4] = 2;
indices[5] = 3;
indices[6] = 4 + 2;
indices[7] = 4 + 1;
indices[8] = 4 + 0;
indices[9] = 4 + 3;
indices[10] = 4 + 2;
indices[11] = 4 + 0;
indices[12] = 8 + 0;
indices[13] = 8 + 1;
indices[14] = 8 + 2;
indices[15] = 8 + 0;
indices[16] = 8 + 2;
indices[17] = 8 + 3;
indices[18] = 12 + 2;
indices[19] = 12 + 1;
indices[20] = 12 + 0;
indices[21] = 12 + 3;
indices[22] = 12 + 2;
indices[23] = 12 + 0;
indices[24] = 16 + 2;
indices[25] = 16 + 1;
indices[26] = 16 + 0;
indices[27] = 16 + 3;
indices[28] = 16 + 2;
indices[29] = 16 + 0;
indices[30] = 20 + 0;
indices[31] = 20 + 1;
indices[32] = 20 + 2;
indices[33] = 20 + 0;
indices[34] = 20 + 2;
indices[35] = 20 + 3;
} else {
positions = new Float64Array(8 * 3);
positions[0] = min.x;
positions[1] = min.y;
positions[2] = min.z;
positions[3] = max.x;
positions[4] = min.y;
positions[5] = min.z;
positions[6] = max.x;
positions[7] = max.y;
positions[8] = min.z;
positions[9] = min.x;
positions[10] = max.y;
positions[11] = min.z;
positions[12] = min.x;
positions[13] = min.y;
positions[14] = max.z;
positions[15] = max.x;
positions[16] = min.y;
positions[17] = max.z;
positions[18] = max.x;
positions[19] = max.y;
positions[20] = max.z;
positions[21] = min.x;
positions[22] = max.y;
positions[23] = max.z;
attributes.position = new GeometryAttribute_default({
componentDatatype: ComponentDatatype_default.DOUBLE,
componentsPerAttribute: 3,
values: positions
});
indices = new Uint16Array(6 * 2 * 3);
indices[0] = 4;
indices[1] = 5;
indices[2] = 6;
indices[3] = 4;
indices[4] = 6;
indices[5] = 7;
indices[6] = 1;
indices[7] = 0;
indices[8] = 3;
indices[9] = 1;
indices[10] = 3;
indices[11] = 2;
indices[12] = 1;
indices[13] = 6;
indices[14] = 5;
indices[15] = 1;
indices[16] = 2;
indices[17] = 6;
indices[18] = 2;
indices[19] = 3;
indices[20] = 7;
indices[21] = 2;
indices[22] = 7;
indices[23] = 6;
indices[24] = 3;
indices[25] = 0;
indices[26] = 4;
indices[27] = 3;
indices[28] = 4;
indices[29] = 7;
indices[30] = 0;
indices[31] = 1;
indices[32] = 5;
indices[33] = 0;
indices[34] = 5;
indices[35] = 4;
}
const diff = Cartesian3_default.subtract(max, min, diffScratch);
const radius = Cartesian3_default.magnitude(diff) * 0.5;
if (defined_default(boxGeometry._offsetAttribute)) {
const length = positions.length;
const offsetValue = boxGeometry._offsetAttribute === GeometryOffsetAttribute_default.NONE ? 0 : 1;
const applyOffset = new Uint8Array(length / 3).fill(offsetValue);
attributes.applyOffset = new GeometryAttribute_default({
componentDatatype: ComponentDatatype_default.UNSIGNED_BYTE,
componentsPerAttribute: 1,
values: applyOffset
});
}
return new Geometry_default({
attributes,
indices,
primitiveType: PrimitiveType_default.TRIANGLES,
boundingSphere: new BoundingSphere_default(Cartesian3_default.ZERO, radius),
offsetAttribute: boxGeometry._offsetAttribute
});
};
var unitBoxGeometry;
BoxGeometry.getUnitBox = function() {
if (!defined_default(unitBoxGeometry)) {
unitBoxGeometry = BoxGeometry.createGeometry(
BoxGeometry.fromDimensions({
dimensions: new Cartesian3_default(1, 1, 1),
vertexFormat: VertexFormat_default.POSITION_ONLY
})
);
}
return unitBoxGeometry;
};
var BoxGeometry_default = BoxGeometry;
export {
BoxGeometry_default
};
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.121.2
*
* Copyright 2011-2022 Cesium Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Columbus View (Pat. Pend.)
*
* Portions licensed separately.
* See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
*/
import {
FeatureDetection_default
} from "./chunk-FFLMY4TE.js";
import {
Math_default
} from "./chunk-WGDFYAGC.js";
import {
defaultValue_default
} from "./chunk-U5HSOKPQ.js";
import {
Check_default
} from "./chunk-P6TRGU3S.js";
import {
defined_default
} from "./chunk-YCDZX5LS.js";
// packages/engine/Source/Core/Color.js
function hue2rgb(m1, m2, h) {
if (h < 0) {
h += 1;
}
if (h > 1) {
h -= 1;
}
if (h * 6 < 1) {
return m1 + (m2 - m1) * 6 * h;
}
if (h * 2 < 1) {
return m2;
}
if (h * 3 < 2) {
return m1 + (m2 - m1) * (2 / 3 - h) * 6;
}
return m1;
}
function Color(red, green, blue, alpha) {
this.red = defaultValue_default(red, 1);
this.green = defaultValue_default(green, 1);
this.blue = defaultValue_default(blue, 1);
this.alpha = defaultValue_default(alpha, 1);
}
Color.fromCartesian4 = function(cartesian, result) {
Check_default.typeOf.object("cartesian", cartesian);
if (!defined_default(result)) {
return new Color(cartesian.x, cartesian.y, cartesian.z, cartesian.w);
}
result.red = cartesian.x;
result.green = cartesian.y;
result.blue = cartesian.z;
result.alpha = cartesian.w;
return result;
};
Color.fromBytes = function(red, green, blue, alpha, result) {
red = Color.byteToFloat(defaultValue_default(red, 255));
green = Color.byteToFloat(defaultValue_default(green, 255));
blue = Color.byteToFloat(defaultValue_default(blue, 255));
alpha = Color.byteToFloat(defaultValue_default(alpha, 255));
if (!defined_default(result)) {
return new Color(red, green, blue, alpha);
}
result.red = red;
result.green = green;
result.blue = blue;
result.alpha = alpha;
return result;
};
Color.fromAlpha = function(color, alpha, result) {
Check_default.typeOf.object("color", color);
Check_default.typeOf.number("alpha", alpha);
if (!defined_default(result)) {
return new Color(color.red, color.green, color.blue, alpha);
}
result.red = color.red;
result.green = color.green;
result.blue = color.blue;
result.alpha = alpha;
return result;
};
var scratchArrayBuffer;
var scratchUint32Array;
var scratchUint8Array;
if (FeatureDetection_default.supportsTypedArrays()) {
scratchArrayBuffer = new ArrayBuffer(4);
scratchUint32Array = new Uint32Array(scratchArrayBuffer);
scratchUint8Array = new Uint8Array(scratchArrayBuffer);
}
Color.fromRgba = function(rgba, result) {
scratchUint32Array[0] = rgba;
return Color.fromBytes(
scratchUint8Array[0],
scratchUint8Array[1],
scratchUint8Array[2],
scratchUint8Array[3],
result
);
};
Color.fromHsl = function(hue, saturation, lightness, alpha, result) {
hue = defaultValue_default(hue, 0) % 1;
saturation = defaultValue_default(saturation, 0);
lightness = defaultValue_default(lightness, 0);
alpha = defaultValue_default(alpha, 1);
let red = lightness;
let green = lightness;
let blue = lightness;
if (saturation !== 0) {
let m2;
if (lightness < 0.5) {
m2 = lightness * (1 + saturation);
} else {
m2 = lightness + saturation - lightness * saturation;
}
const m1 = 2 * lightness - m2;
red = hue2rgb(m1, m2, hue + 1 / 3);
green = hue2rgb(m1, m2, hue);
blue = hue2rgb(m1, m2, hue - 1 / 3);
}
if (!defined_default(result)) {
return new Color(red, green, blue, alpha);
}
result.red = red;
result.green = green;
result.blue = blue;
result.alpha = alpha;
return result;
};
Color.fromRandom = function(options, result) {
options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
let red = options.red;
if (!defined_default(red)) {
const minimumRed = defaultValue_default(options.minimumRed, 0);
const maximumRed = defaultValue_default(options.maximumRed, 1);
Check_default.typeOf.number.lessThanOrEquals("minimumRed", minimumRed, maximumRed);
red = minimumRed + Math_default.nextRandomNumber() * (maximumRed - minimumRed);
}
let green = options.green;
if (!defined_default(green)) {
const minimumGreen = defaultValue_default(options.minimumGreen, 0);
const maximumGreen = defaultValue_default(options.maximumGreen, 1);
Check_default.typeOf.number.lessThanOrEquals(
"minimumGreen",
minimumGreen,
maximumGreen
);
green = minimumGreen + Math_default.nextRandomNumber() * (maximumGreen - minimumGreen);
}
let blue = options.blue;
if (!defined_default(blue)) {
const minimumBlue = defaultValue_default(options.minimumBlue, 0);
const maximumBlue = defaultValue_default(options.maximumBlue, 1);
Check_default.typeOf.number.lessThanOrEquals(
"minimumBlue",
minimumBlue,
maximumBlue
);
blue = minimumBlue + Math_default.nextRandomNumber() * (maximumBlue - minimumBlue);
}
let alpha = options.alpha;
if (!defined_default(alpha)) {
const minimumAlpha = defaultValue_default(options.minimumAlpha, 0);
const maximumAlpha = defaultValue_default(options.maximumAlpha, 1);
Check_default.typeOf.number.lessThanOrEquals(
"minumumAlpha",
minimumAlpha,
maximumAlpha
);
alpha = minimumAlpha + Math_default.nextRandomNumber() * (maximumAlpha - minimumAlpha);
}
if (!defined_default(result)) {
return new Color(red, green, blue, alpha);
}
result.red = red;
result.green = green;
result.blue = blue;
result.alpha = alpha;
return result;
};
var rgbaMatcher = /^#([0-9a-f])([0-9a-f])([0-9a-f])([0-9a-f])?$/i;
var rrggbbaaMatcher = /^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})?$/i;
var rgbParenthesesMatcher = /^rgba?\s*\(\s*([0-9.]+%?)\s*[,\s]+\s*([0-9.]+%?)\s*[,\s]+\s*([0-9.]+%?)(?:\s*[,\s/]+\s*([0-9.]+))?\s*\)$/i;
var hslParenthesesMatcher = /^hsla?\s*\(\s*([0-9.]+)\s*[,\s]+\s*([0-9.]+%)\s*[,\s]+\s*([0-9.]+%)(?:\s*[,\s/]+\s*([0-9.]+))?\s*\)$/i;
Color.fromCssColorString = function(color, result) {
Check_default.typeOf.string("color", color);
if (!defined_default(result)) {
result = new Color();
}
color = color.trim();
const namedColor = Color[color.toUpperCase()];
if (defined_default(namedColor)) {
Color.clone(namedColor, result);
return result;
}
let matches = rgbaMatcher.exec(color);
if (matches !== null) {
result.red = parseInt(matches[1], 16) / 15;
result.green = parseInt(matches[2], 16) / 15;
result.blue = parseInt(matches[3], 16) / 15;
result.alpha = parseInt(defaultValue_default(matches[4], "f"), 16) / 15;
return result;
}
matches = rrggbbaaMatcher.exec(color);
if (matches !== null) {
result.red = parseInt(matches[1], 16) / 255;
result.green = parseInt(matches[2], 16) / 255;
result.blue = parseInt(matches[3], 16) / 255;
result.alpha = parseInt(defaultValue_default(matches[4], "ff"), 16) / 255;
return result;
}
matches = rgbParenthesesMatcher.exec(color);
if (matches !== null) {
result.red = parseFloat(matches[1]) / ("%" === matches[1].substr(-1) ? 100 : 255);
result.green = parseFloat(matches[2]) / ("%" === matches[2].substr(-1) ? 100 : 255);
result.blue = parseFloat(matches[3]) / ("%" === matches[3].substr(-1) ? 100 : 255);
result.alpha = parseFloat(defaultValue_default(matches[4], "1.0"));
return result;
}
matches = hslParenthesesMatcher.exec(color);
if (matches !== null) {
return Color.fromHsl(
parseFloat(matches[1]) / 360,
parseFloat(matches[2]) / 100,
parseFloat(matches[3]) / 100,
parseFloat(defaultValue_default(matches[4], "1.0")),
result
);
}
result = void 0;
return result;
};
Color.packedLength = 4;
Color.pack = function(value, array, startingIndex) {
Check_default.typeOf.object("value", value);
Check_default.defined("array", array);
startingIndex = defaultValue_default(startingIndex, 0);
array[startingIndex++] = value.red;
array[startingIndex++] = value.green;
array[startingIndex++] = value.blue;
array[startingIndex] = value.alpha;
return array;
};
Color.unpack = function(array, startingIndex, result) {
Check_default.defined("array", array);
startingIndex = defaultValue_default(startingIndex, 0);
if (!defined_default(result)) {
result = new Color();
}
result.red = array[startingIndex++];
result.green = array[startingIndex++];
result.blue = array[startingIndex++];
result.alpha = array[startingIndex];
return result;
};
Color.byteToFloat = function(number) {
return number / 255;
};
Color.floatToByte = function(number) {
return number === 1 ? 255 : number * 256 | 0;
};
Color.clone = function(color, result) {
if (!defined_default(color)) {
return void 0;
}
if (!defined_default(result)) {
return new Color(color.red, color.green, color.blue, color.alpha);
}
result.red = color.red;
result.green = color.green;
result.blue = color.blue;
result.alpha = color.alpha;
return result;
};
Color.equals = function(left, right) {
return left === right || //
defined_default(left) && //
defined_default(right) && //
left.red === right.red && //
left.green === right.green && //
left.blue === right.blue && //
left.alpha === right.alpha;
};
Color.equalsArray = function(color, array, offset) {
return color.red === array[offset] && color.green === array[offset + 1] && color.blue === array[offset + 2] && color.alpha === array[offset + 3];
};
Color.prototype.clone = function(result) {
return Color.clone(this, result);
};
Color.prototype.equals = function(other) {
return Color.equals(this, other);
};
Color.prototype.equalsEpsilon = function(other, epsilon) {
return this === other || //
defined_default(other) && //
Math.abs(this.red - other.red) <= epsilon && //
Math.abs(this.green - other.green) <= epsilon && //
Math.abs(this.blue - other.blue) <= epsilon && //
Math.abs(this.alpha - other.alpha) <= epsilon;
};
Color.prototype.toString = function() {
return `(${this.red}, ${this.green}, ${this.blue}, ${this.alpha})`;
};
Color.prototype.toCssColorString = function() {
const red = Color.floatToByte(this.red);
const green = Color.floatToByte(this.green);
const blue = Color.floatToByte(this.blue);
if (this.alpha === 1) {
return `rgb(${red},${green},${blue})`;
}
return `rgba(${red},${green},${blue},${this.alpha})`;
};
Color.prototype.toCssHexString = function() {
let r = Color.floatToByte(this.red).toString(16);
if (r.length < 2) {
r = `0${r}`;
}
let g = Color.floatToByte(this.green).toString(16);
if (g.length < 2) {
g = `0${g}`;
}
let b = Color.floatToByte(this.blue).toString(16);
if (b.length < 2) {
b = `0${b}`;
}
if (this.alpha < 1) {
let hexAlpha = Color.floatToByte(this.alpha).toString(16);
if (hexAlpha.length < 2) {
hexAlpha = `0${hexAlpha}`;
}
return `#${r}${g}${b}${hexAlpha}`;
}
return `#${r}${g}${b}`;
};
Color.prototype.toBytes = function(result) {
const red = Color.floatToByte(this.red);
const green = Color.floatToByte(this.green);
const blue = Color.floatToByte(this.blue);
const alpha = Color.floatToByte(this.alpha);
if (!defined_default(result)) {
return [red, green, blue, alpha];
}
result[0] = red;
result[1] = green;
result[2] = blue;
result[3] = alpha;
return result;
};
Color.prototype.toRgba = function() {
scratchUint8Array[0] = Color.floatToByte(this.red);
scratchUint8Array[1] = Color.floatToByte(this.green);
scratchUint8Array[2] = Color.floatToByte(this.blue);
scratchUint8Array[3] = Color.floatToByte(this.alpha);
return scratchUint32Array[0];
};
Color.prototype.brighten = function(magnitude, result) {
Check_default.typeOf.number("magnitude", magnitude);
Check_default.typeOf.number.greaterThanOrEquals("magnitude", magnitude, 0);
Check_default.typeOf.object("result", result);
magnitude = 1 - magnitude;
result.red = 1 - (1 - this.red) * magnitude;
result.green = 1 - (1 - this.green) * magnitude;
result.blue = 1 - (1 - this.blue) * magnitude;
result.alpha = this.alpha;
return result;
};
Color.prototype.darken = function(magnitude, result) {
Check_default.typeOf.number("magnitude", magnitude);
Check_default.typeOf.number.greaterThanOrEquals("magnitude", magnitude, 0);
Check_default.typeOf.object("result", result);
magnitude = 1 - magnitude;
result.red = this.red * magnitude;
result.green = this.green * magnitude;
result.blue = this.blue * magnitude;
result.alpha = this.alpha;
return result;
};
Color.prototype.withAlpha = function(alpha, result) {
return Color.fromAlpha(this, alpha, result);
};
Color.add = function(left, right, result) {
Check_default.typeOf.object("left", left);
Check_default.typeOf.object("right", right);
Check_default.typeOf.object("result", result);
result.red = left.red + right.red;
result.green = left.green + right.green;
result.blue = left.blue + right.blue;
result.alpha = left.alpha + right.alpha;
return result;
};
Color.subtract = function(left, right, result) {
Check_default.typeOf.object("left", left);
Check_default.typeOf.object("right", right);
Check_default.typeOf.object("result", result);
result.red = left.red - right.red;
result.green = left.green - right.green;
result.blue = left.blue - right.blue;
result.alpha = left.alpha - right.alpha;
return result;
};
Color.multiply = function(left, right, result) {
Check_default.typeOf.object("left", left);
Check_default.typeOf.object("right", right);
Check_default.typeOf.object("result", result);
result.red = left.red * right.red;
result.green = left.green * right.green;
result.blue = left.blue * right.blue;
result.alpha = left.alpha * right.alpha;
return result;
};
Color.divide = function(left, right, result) {
Check_default.typeOf.object("left", left);
Check_default.typeOf.object("right", right);
Check_default.typeOf.object("result", result);
result.red = left.red / right.red;
result.green = left.green / right.green;
result.blue = left.blue / right.blue;
result.alpha = left.alpha / right.alpha;
return result;
};
Color.mod = function(left, right, result) {
Check_default.typeOf.object("left", left);
Check_default.typeOf.object("right", right);
Check_default.typeOf.object("result", result);
result.red = left.red % right.red;
result.green = left.green % right.green;
result.blue = left.blue % right.blue;
result.alpha = left.alpha % right.alpha;
return result;
};
Color.lerp = function(start, end, t, result) {
Check_default.typeOf.object("start", start);
Check_default.typeOf.object("end", end);
Check_default.typeOf.number("t", t);
Check_default.typeOf.object("result", result);
result.red = Math_default.lerp(start.red, end.red, t);
result.green = Math_default.lerp(start.green, end.green, t);
result.blue = Math_default.lerp(start.blue, end.blue, t);
result.alpha = Math_default.lerp(start.alpha, end.alpha, t);
return result;
};
Color.multiplyByScalar = function(color, scalar, result) {
Check_default.typeOf.object("color", color);
Check_default.typeOf.number("scalar", scalar);
Check_default.typeOf.object("result", result);
result.red = color.red * scalar;
result.green = color.green * scalar;
result.blue = color.blue * scalar;
result.alpha = color.alpha * scalar;
return result;
};
Color.divideByScalar = function(color, scalar, result) {
Check_default.typeOf.object("color", color);
Check_default.typeOf.number("scalar", scalar);
Check_default.typeOf.object("result", result);
result.red = color.red / scalar;
result.green = color.green / scalar;
result.blue = color.blue / scalar;
result.alpha = color.alpha / scalar;
return result;
};
Color.ALICEBLUE = Object.freeze(Color.fromCssColorString("#F0F8FF"));
Color.ANTIQUEWHITE = Object.freeze(Color.fromCssColorString("#FAEBD7"));
Color.AQUA = Object.freeze(Color.fromCssColorString("#00FFFF"));
Color.AQUAMARINE = Object.freeze(Color.fromCssColorString("#7FFFD4"));
Color.AZURE = Object.freeze(Color.fromCssColorString("#F0FFFF"));
Color.BEIGE = Object.freeze(Color.fromCssColorString("#F5F5DC"));
Color.BISQUE = Object.freeze(Color.fromCssColorString("#FFE4C4"));
Color.BLACK = Object.freeze(Color.fromCssColorString("#000000"));
Color.BLANCHEDALMOND = Object.freeze(Color.fromCssColorString("#FFEBCD"));
Color.BLUE = Object.freeze(Color.fromCssColorString("#0000FF"));
Color.BLUEVIOLET = Object.freeze(Color.fromCssColorString("#8A2BE2"));
Color.BROWN = Object.freeze(Color.fromCssColorString("#A52A2A"));
Color.BURLYWOOD = Object.freeze(Color.fromCssColorString("#DEB887"));
Color.CADETBLUE = Object.freeze(Color.fromCssColorString("#5F9EA0"));
Color.CHARTREUSE = Object.freeze(Color.fromCssColorString("#7FFF00"));
Color.CHOCOLATE = Object.freeze(Color.fromCssColorString("#D2691E"));
Color.CORAL = Object.freeze(Color.fromCssColorString("#FF7F50"));
Color.CORNFLOWERBLUE = Object.freeze(Color.fromCssColorString("#6495ED"));
Color.CORNSILK = Object.freeze(Color.fromCssColorString("#FFF8DC"));
Color.CRIMSON = Object.freeze(Color.fromCssColorString("#DC143C"));
Color.CYAN = Object.freeze(Color.fromCssColorString("#00FFFF"));
Color.DARKBLUE = Object.freeze(Color.fromCssColorString("#00008B"));
Color.DARKCYAN = Object.freeze(Color.fromCssColorString("#008B8B"));
Color.DARKGOLDENROD = Object.freeze(Color.fromCssColorString("#B8860B"));
Color.DARKGRAY = Object.freeze(Color.fromCssColorString("#A9A9A9"));
Color.DARKGREEN = Object.freeze(Color.fromCssColorString("#006400"));
Color.DARKGREY = Color.DARKGRAY;
Color.DARKKHAKI = Object.freeze(Color.fromCssColorString("#BDB76B"));
Color.DARKMAGENTA = Object.freeze(Color.fromCssColorString("#8B008B"));
Color.DARKOLIVEGREEN = Object.freeze(Color.fromCssColorString("#556B2F"));
Color.DARKORANGE = Object.freeze(Color.fromCssColorString("#FF8C00"));
Color.DARKORCHID = Object.freeze(Color.fromCssColorString("#9932CC"));
Color.DARKRED = Object.freeze(Color.fromCssColorString("#8B0000"));
Color.DARKSALMON = Object.freeze(Color.fromCssColorString("#E9967A"));
Color.DARKSEAGREEN = Object.freeze(Color.fromCssColorString("#8FBC8F"));
Color.DARKSLATEBLUE = Object.freeze(Color.fromCssColorString("#483D8B"));
Color.DARKSLATEGRAY = Object.freeze(Color.fromCssColorString("#2F4F4F"));
Color.DARKSLATEGREY = Color.DARKSLATEGRAY;
Color.DARKTURQUOISE = Object.freeze(Color.fromCssColorString("#00CED1"));
Color.DARKVIOLET = Object.freeze(Color.fromCssColorString("#9400D3"));
Color.DEEPPINK = Object.freeze(Color.fromCssColorString("#FF1493"));
Color.DEEPSKYBLUE = Object.freeze(Color.fromCssColorString("#00BFFF"));
Color.DIMGRAY = Object.freeze(Color.fromCssColorString("#696969"));
Color.DIMGREY = Color.DIMGRAY;
Color.DODGERBLUE = Object.freeze(Color.fromCssColorString("#1E90FF"));
Color.FIREBRICK = Object.freeze(Color.fromCssColorString("#B22222"));
Color.FLORALWHITE = Object.freeze(Color.fromCssColorString("#FFFAF0"));
Color.FORESTGREEN = Object.freeze(Color.fromCssColorString("#228B22"));
Color.FUCHSIA = Object.freeze(Color.fromCssColorString("#FF00FF"));
Color.GAINSBORO = Object.freeze(Color.fromCssColorString("#DCDCDC"));
Color.GHOSTWHITE = Object.freeze(Color.fromCssColorString("#F8F8FF"));
Color.GOLD = Object.freeze(Color.fromCssColorString("#FFD700"));
Color.GOLDENROD = Object.freeze(Color.fromCssColorString("#DAA520"));
Color.GRAY = Object.freeze(Color.fromCssColorString("#808080"));
Color.GREEN = Object.freeze(Color.fromCssColorString("#008000"));
Color.GREENYELLOW = Object.freeze(Color.fromCssColorString("#ADFF2F"));
Color.GREY = Color.GRAY;
Color.HONEYDEW = Object.freeze(Color.fromCssColorString("#F0FFF0"));
Color.HOTPINK = Object.freeze(Color.fromCssColorString("#FF69B4"));
Color.INDIANRED = Object.freeze(Color.fromCssColorString("#CD5C5C"));
Color.INDIGO = Object.freeze(Color.fromCssColorString("#4B0082"));
Color.IVORY = Object.freeze(Color.fromCssColorString("#FFFFF0"));
Color.KHAKI = Object.freeze(Color.fromCssColorString("#F0E68C"));
Color.LAVENDER = Object.freeze(Color.fromCssColorString("#E6E6FA"));
Color.LAVENDAR_BLUSH = Object.freeze(Color.fromCssColorString("#FFF0F5"));
Color.LAWNGREEN = Object.freeze(Color.fromCssColorString("#7CFC00"));
Color.LEMONCHIFFON = Object.freeze(Color.fromCssColorString("#FFFACD"));
Color.LIGHTBLUE = Object.freeze(Color.fromCssColorString("#ADD8E6"));
Color.LIGHTCORAL = Object.freeze(Color.fromCssColorString("#F08080"));
Color.LIGHTCYAN = Object.freeze(Color.fromCssColorString("#E0FFFF"));
Color.LIGHTGOLDENRODYELLOW = Object.freeze(Color.fromCssColorString("#FAFAD2"));
Color.LIGHTGRAY = Object.freeze(Color.fromCssColorString("#D3D3D3"));
Color.LIGHTGREEN = Object.freeze(Color.fromCssColorString("#90EE90"));
Color.LIGHTGREY = Color.LIGHTGRAY;
Color.LIGHTPINK = Object.freeze(Color.fromCssColorString("#FFB6C1"));
Color.LIGHTSEAGREEN = Object.freeze(Color.fromCssColorString("#20B2AA"));
Color.LIGHTSKYBLUE = Object.freeze(Color.fromCssColorString("#87CEFA"));
Color.LIGHTSLATEGRAY = Object.freeze(Color.fromCssColorString("#778899"));
Color.LIGHTSLATEGREY = Color.LIGHTSLATEGRAY;
Color.LIGHTSTEELBLUE = Object.freeze(Color.fromCssColorString("#B0C4DE"));
Color.LIGHTYELLOW = Object.freeze(Color.fromCssColorString("#FFFFE0"));
Color.LIME = Object.freeze(Color.fromCssColorString("#00FF00"));
Color.LIMEGREEN = Object.freeze(Color.fromCssColorString("#32CD32"));
Color.LINEN = Object.freeze(Color.fromCssColorString("#FAF0E6"));
Color.MAGENTA = Object.freeze(Color.fromCssColorString("#FF00FF"));
Color.MAROON = Object.freeze(Color.fromCssColorString("#800000"));
Color.MEDIUMAQUAMARINE = Object.freeze(Color.fromCssColorString("#66CDAA"));
Color.MEDIUMBLUE = Object.freeze(Color.fromCssColorString("#0000CD"));
Color.MEDIUMORCHID = Object.freeze(Color.fromCssColorString("#BA55D3"));
Color.MEDIUMPURPLE = Object.freeze(Color.fromCssColorString("#9370DB"));
Color.MEDIUMSEAGREEN = Object.freeze(Color.fromCssColorString("#3CB371"));
Color.MEDIUMSLATEBLUE = Object.freeze(Color.fromCssColorString("#7B68EE"));
Color.MEDIUMSPRINGGREEN = Object.freeze(Color.fromCssColorString("#00FA9A"));
Color.MEDIUMTURQUOISE = Object.freeze(Color.fromCssColorString("#48D1CC"));
Color.MEDIUMVIOLETRED = Object.freeze(Color.fromCssColorString("#C71585"));
Color.MIDNIGHTBLUE = Object.freeze(Color.fromCssColorString("#191970"));
Color.MINTCREAM = Object.freeze(Color.fromCssColorString("#F5FFFA"));
Color.MISTYROSE = Object.freeze(Color.fromCssColorString("#FFE4E1"));
Color.MOCCASIN = Object.freeze(Color.fromCssColorString("#FFE4B5"));
Color.NAVAJOWHITE = Object.freeze(Color.fromCssColorString("#FFDEAD"));
Color.NAVY = Object.freeze(Color.fromCssColorString("#000080"));
Color.OLDLACE = Object.freeze(Color.fromCssColorString("#FDF5E6"));
Color.OLIVE = Object.freeze(Color.fromCssColorString("#808000"));
Color.OLIVEDRAB = Object.freeze(Color.fromCssColorString("#6B8E23"));
Color.ORANGE = Object.freeze(Color.fromCssColorString("#FFA500"));
Color.ORANGERED = Object.freeze(Color.fromCssColorString("#FF4500"));
Color.ORCHID = Object.freeze(Color.fromCssColorString("#DA70D6"));
Color.PALEGOLDENROD = Object.freeze(Color.fromCssColorString("#EEE8AA"));
Color.PALEGREEN = Object.freeze(Color.fromCssColorString("#98FB98"));
Color.PALETURQUOISE = Object.freeze(Color.fromCssColorString("#AFEEEE"));
Color.PALEVIOLETRED = Object.freeze(Color.fromCssColorString("#DB7093"));
Color.PAPAYAWHIP = Object.freeze(Color.fromCssColorString("#FFEFD5"));
Color.PEACHPUFF = Object.freeze(Color.fromCssColorString("#FFDAB9"));
Color.PERU = Object.freeze(Color.fromCssColorString("#CD853F"));
Color.PINK = Object.freeze(Color.fromCssColorString("#FFC0CB"));
Color.PLUM = Object.freeze(Color.fromCssColorString("#DDA0DD"));
Color.POWDERBLUE = Object.freeze(Color.fromCssColorString("#B0E0E6"));
Color.PURPLE = Object.freeze(Color.fromCssColorString("#800080"));
Color.RED = Object.freeze(Color.fromCssColorString("#FF0000"));
Color.ROSYBROWN = Object.freeze(Color.fromCssColorString("#BC8F8F"));
Color.ROYALBLUE = Object.freeze(Color.fromCssColorString("#4169E1"));
Color.SADDLEBROWN = Object.freeze(Color.fromCssColorString("#8B4513"));
Color.SALMON = Object.freeze(Color.fromCssColorString("#FA8072"));
Color.SANDYBROWN = Object.freeze(Color.fromCssColorString("#F4A460"));
Color.SEAGREEN = Object.freeze(Color.fromCssColorString("#2E8B57"));
Color.SEASHELL = Object.freeze(Color.fromCssColorString("#FFF5EE"));
Color.SIENNA = Object.freeze(Color.fromCssColorString("#A0522D"));
Color.SILVER = Object.freeze(Color.fromCssColorString("#C0C0C0"));
Color.SKYBLUE = Object.freeze(Color.fromCssColorString("#87CEEB"));
Color.SLATEBLUE = Object.freeze(Color.fromCssColorString("#6A5ACD"));
Color.SLATEGRAY = Object.freeze(Color.fromCssColorString("#708090"));
Color.SLATEGREY = Color.SLATEGRAY;
Color.SNOW = Object.freeze(Color.fromCssColorString("#FFFAFA"));
Color.SPRINGGREEN = Object.freeze(Color.fromCssColorString("#00FF7F"));
Color.STEELBLUE = Object.freeze(Color.fromCssColorString("#4682B4"));
Color.TAN = Object.freeze(Color.fromCssColorString("#D2B48C"));
Color.TEAL = Object.freeze(Color.fromCssColorString("#008080"));
Color.THISTLE = Object.freeze(Color.fromCssColorString("#D8BFD8"));
Color.TOMATO = Object.freeze(Color.fromCssColorString("#FF6347"));
Color.TURQUOISE = Object.freeze(Color.fromCssColorString("#40E0D0"));
Color.VIOLET = Object.freeze(Color.fromCssColorString("#EE82EE"));
Color.WHEAT = Object.freeze(Color.fromCssColorString("#F5DEB3"));
Color.WHITE = Object.freeze(Color.fromCssColorString("#FFFFFF"));
Color.WHITESMOKE = Object.freeze(Color.fromCssColorString("#F5F5F5"));
Color.YELLOW = Object.freeze(Color.fromCssColorString("#FFFF00"));
Color.YELLOWGREEN = Object.freeze(Color.fromCssColorString("#9ACD32"));
Color.TRANSPARENT = Object.freeze(new Color(0, 0, 0, 0));
var Color_default = Color;
export {
Color_default
};
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.121.2
*
* Copyright 2011-2022 Cesium Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Columbus View (Pat. Pend.)
*
* Portions licensed separately.
* See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
*/
import {
WebMercatorProjection_default
} from "./chunk-RJM36CNY.js";
import {
GeometryPipeline_default
} from "./chunk-7ZZ5LMZY.js";
import {
IndexDatatype_default
} from "./chunk-C4WPMOKT.js";
import {
GeometryAttributes_default
} from "./chunk-X7IQYYHF.js";
import {
GeometryAttribute_default,
Geometry_default
} from "./chunk-JXVLNVXC.js";
import {
BoundingSphere_default,
GeographicProjection_default
} from "./chunk-KHZNBFOH.js";
import {
Matrix4_default
} from "./chunk-6SQMLVGV.js";
import {
ComponentDatatype_default
} from "./chunk-XIUSRWL6.js";
import {
Ellipsoid_default
} from "./chunk-FFLMY4TE.js";
import {
defaultValue_default
} from "./chunk-U5HSOKPQ.js";
import {
Check_default,
DeveloperError_default
} from "./chunk-P6TRGU3S.js";
import {
defined_default
} from "./chunk-YCDZX5LS.js";
// packages/engine/Source/Core/OffsetGeometryInstanceAttribute.js
function OffsetGeometryInstanceAttribute(x, y, z) {
x = defaultValue_default(x, 0);
y = defaultValue_default(y, 0);
z = defaultValue_default(z, 0);
this.value = new Float32Array([x, y, z]);
}
Object.defineProperties(OffsetGeometryInstanceAttribute.prototype, {
/**
* The datatype of each component in the attribute, e.g., individual elements in
* {@link OffsetGeometryInstanceAttribute#value}.
*
* @memberof OffsetGeometryInstanceAttribute.prototype
*
* @type {ComponentDatatype}
* @readonly
*
* @default {@link ComponentDatatype.FLOAT}
*/
componentDatatype: {
get: function() {
return ComponentDatatype_default.FLOAT;
}
},
/**
* The number of components in the attributes, i.e., {@link OffsetGeometryInstanceAttribute#value}.
*
* @memberof OffsetGeometryInstanceAttribute.prototype
*
* @type {number}
* @readonly
*
* @default 3
*/
componentsPerAttribute: {
get: function() {
return 3;
}
},
/**
* When <code>true</code> and <code>componentDatatype</code> is an integer format,
* indicate that the components should be mapped to the range [0, 1] (unsigned)
* or [-1, 1] (signed) when they are accessed as floating-point for rendering.
*
* @memberof OffsetGeometryInstanceAttribute.prototype
*
* @type {boolean}
* @readonly
*
* @default false
*/
normalize: {
get: function() {
return false;
}
}
});
OffsetGeometryInstanceAttribute.fromCartesian3 = function(offset) {
Check_default.defined("offset", offset);
return new OffsetGeometryInstanceAttribute(offset.x, offset.y, offset.z);
};
OffsetGeometryInstanceAttribute.toValue = function(offset, result) {
Check_default.defined("offset", offset);
if (!defined_default(result)) {
result = new Float32Array([offset.x, offset.y, offset.z]);
}
result[0] = offset.x;
result[1] = offset.y;
result[2] = offset.z;
return result;
};
var OffsetGeometryInstanceAttribute_default = OffsetGeometryInstanceAttribute;
// packages/engine/Source/Scene/PrimitivePipeline.js
function transformToWorldCoordinates(instances, primitiveModelMatrix, scene3DOnly) {
let toWorld = !scene3DOnly;
const length = instances.length;
let i;
if (!toWorld && length > 1) {
const modelMatrix = instances[0].modelMatrix;
for (i = 1; i < length; ++i) {
if (!Matrix4_default.equals(modelMatrix, instances[i].modelMatrix)) {
toWorld = true;
break;
}
}
}
if (toWorld) {
for (i = 0; i < length; ++i) {
if (defined_default(instances[i].geometry)) {
GeometryPipeline_default.transformToWorldCoordinates(instances[i]);
}
}
} else {
Matrix4_default.multiplyTransformation(
primitiveModelMatrix,
instances[0].modelMatrix,
primitiveModelMatrix
);
}
}
function addGeometryBatchId(geometry, batchId) {
const attributes = geometry.attributes;
const positionAttr = attributes.position;
const numberOfComponents = positionAttr.values.length / positionAttr.componentsPerAttribute;
attributes.batchId = new GeometryAttribute_default({
componentDatatype: ComponentDatatype_default.FLOAT,
componentsPerAttribute: 1,
values: new Float32Array(numberOfComponents)
});
const values = attributes.batchId.values;
for (let j = 0; j < numberOfComponents; ++j) {
values[j] = batchId;
}
}
function addBatchIds(instances) {
const length = instances.length;
for (let i = 0; i < length; ++i) {
const instance = instances[i];
if (defined_default(instance.geometry)) {
addGeometryBatchId(instance.geometry, i);
} else if (defined_default(instance.westHemisphereGeometry) && defined_default(instance.eastHemisphereGeometry)) {
addGeometryBatchId(instance.westHemisphereGeometry, i);
addGeometryBatchId(instance.eastHemisphereGeometry, i);
}
}
}
function geometryPipeline(parameters) {
const instances = parameters.instances;
const projection = parameters.projection;
const uintIndexSupport = parameters.elementIndexUintSupported;
const scene3DOnly = parameters.scene3DOnly;
const vertexCacheOptimize = parameters.vertexCacheOptimize;
const compressVertices = parameters.compressVertices;
const modelMatrix = parameters.modelMatrix;
let i;
let geometry;
let primitiveType;
let length = instances.length;
for (i = 0; i < length; ++i) {
if (defined_default(instances[i].geometry)) {
primitiveType = instances[i].geometry.primitiveType;
break;
}
}
for (i = 1; i < length; ++i) {
if (defined_default(instances[i].geometry) && instances[i].geometry.primitiveType !== primitiveType) {
throw new DeveloperError_default(
"All instance geometries must have the same primitiveType."
);
}
}
transformToWorldCoordinates(instances, modelMatrix, scene3DOnly);
if (!scene3DOnly) {
for (i = 0; i < length; ++i) {
if (defined_default(instances[i].geometry)) {
GeometryPipeline_default.splitLongitude(instances[i]);
}
}
}
addBatchIds(instances);
if (vertexCacheOptimize) {
for (i = 0; i < length; ++i) {
const instance = instances[i];
if (defined_default(instance.geometry)) {
GeometryPipeline_default.reorderForPostVertexCache(instance.geometry);
GeometryPipeline_default.reorderForPreVertexCache(instance.geometry);
} else if (defined_default(instance.westHemisphereGeometry) && defined_default(instance.eastHemisphereGeometry)) {
GeometryPipeline_default.reorderForPostVertexCache(
instance.westHemisphereGeometry
);
GeometryPipeline_default.reorderForPreVertexCache(
instance.westHemisphereGeometry
);
GeometryPipeline_default.reorderForPostVertexCache(
instance.eastHemisphereGeometry
);
GeometryPipeline_default.reorderForPreVertexCache(
instance.eastHemisphereGeometry
);
}
}
}
let geometries = GeometryPipeline_default.combineInstances(instances);
length = geometries.length;
for (i = 0; i < length; ++i) {
geometry = geometries[i];
const attributes = geometry.attributes;
if (!scene3DOnly) {
for (const name in attributes) {
if (attributes.hasOwnProperty(name) && attributes[name].componentDatatype === ComponentDatatype_default.DOUBLE) {
const name3D = `${name}3D`;
const name2D = `${name}2D`;
GeometryPipeline_default.projectTo2D(
geometry,
name,
name3D,
name2D,
projection
);
if (defined_default(geometry.boundingSphere) && name === "position") {
geometry.boundingSphereCV = BoundingSphere_default.fromVertices(
geometry.attributes.position2D.values
);
}
GeometryPipeline_default.encodeAttribute(
geometry,
name3D,
`${name3D}High`,
`${name3D}Low`
);
GeometryPipeline_default.encodeAttribute(
geometry,
name2D,
`${name2D}High`,
`${name2D}Low`
);
}
}
} else {
for (const name in attributes) {
if (attributes.hasOwnProperty(name) && attributes[name].componentDatatype === ComponentDatatype_default.DOUBLE) {
GeometryPipeline_default.encodeAttribute(
geometry,
name,
`${name}3DHigh`,
`${name}3DLow`
);
}
}
}
if (compressVertices) {
GeometryPipeline_default.compressVertices(geometry);
}
}
if (!uintIndexSupport) {
let splitGeometries = [];
length = geometries.length;
for (i = 0; i < length; ++i) {
geometry = geometries[i];
splitGeometries = splitGeometries.concat(
GeometryPipeline_default.fitToUnsignedShortIndices(geometry)
);
}
geometries = splitGeometries;
}
return geometries;
}
function createPickOffsets(instances, geometryName, geometries, pickOffsets) {
let offset;
let indexCount;
let geometryIndex;
const offsetIndex = pickOffsets.length - 1;
if (offsetIndex >= 0) {
const pickOffset = pickOffsets[offsetIndex];
offset = pickOffset.offset + pickOffset.count;
geometryIndex = pickOffset.index;
indexCount = geometries[geometryIndex].indices.length;
} else {
offset = 0;
geometryIndex = 0;
indexCount = geometries[geometryIndex].indices.length;
}
const length = instances.length;
for (let i = 0; i < length; ++i) {
const instance = instances[i];
const geometry = instance[geometryName];
if (!defined_default(geometry)) {
continue;
}
const count = geometry.indices.length;
if (offset + count > indexCount) {
offset = 0;
indexCount = geometries[++geometryIndex].indices.length;
}
pickOffsets.push({
index: geometryIndex,
offset,
count
});
offset += count;
}
}
function createInstancePickOffsets(instances, geometries) {
const pickOffsets = [];
createPickOffsets(instances, "geometry", geometries, pickOffsets);
createPickOffsets(
instances,
"westHemisphereGeometry",
geometries,
pickOffsets
);
createPickOffsets(
instances,
"eastHemisphereGeometry",
geometries,
pickOffsets
);
return pickOffsets;
}
var PrimitivePipeline = {};
PrimitivePipeline.combineGeometry = function(parameters) {
let geometries;
let attributeLocations;
const instances = parameters.instances;
const length = instances.length;
let pickOffsets;
let offsetInstanceExtend;
let hasOffset = false;
if (length > 0) {
geometries = geometryPipeline(parameters);
if (geometries.length > 0) {
attributeLocations = GeometryPipeline_default.createAttributeLocations(
geometries[0]
);
if (parameters.createPickOffsets) {
pickOffsets = createInstancePickOffsets(instances, geometries);
}
}
if (defined_default(instances[0].attributes) && defined_default(instances[0].attributes.offset)) {
offsetInstanceExtend = new Array(length);
hasOffset = true;
}
}
const boundingSpheres = new Array(length);
const boundingSpheresCV = new Array(length);
for (let i = 0; i < length; ++i) {
const instance = instances[i];
const geometry = instance.geometry;
if (defined_default(geometry)) {
boundingSpheres[i] = geometry.boundingSphere;
boundingSpheresCV[i] = geometry.boundingSphereCV;
if (hasOffset) {
offsetInstanceExtend[i] = instance.geometry.offsetAttribute;
}
}
const eastHemisphereGeometry = instance.eastHemisphereGeometry;
const westHemisphereGeometry = instance.westHemisphereGeometry;
if (defined_default(eastHemisphereGeometry) && defined_default(westHemisphereGeometry)) {
if (defined_default(eastHemisphereGeometry.boundingSphere) && defined_default(westHemisphereGeometry.boundingSphere)) {
boundingSpheres[i] = BoundingSphere_default.union(
eastHemisphereGeometry.boundingSphere,
westHemisphereGeometry.boundingSphere
);
}
if (defined_default(eastHemisphereGeometry.boundingSphereCV) && defined_default(westHemisphereGeometry.boundingSphereCV)) {
boundingSpheresCV[i] = BoundingSphere_default.union(
eastHemisphereGeometry.boundingSphereCV,
westHemisphereGeometry.boundingSphereCV
);
}
}
}
return {
geometries,
modelMatrix: parameters.modelMatrix,
attributeLocations,
pickOffsets,
offsetInstanceExtend,
boundingSpheres,
boundingSpheresCV
};
};
function transferGeometry(geometry, transferableObjects) {
const attributes = geometry.attributes;
for (const name in attributes) {
if (attributes.hasOwnProperty(name)) {
const attribute = attributes[name];
if (defined_default(attribute) && defined_default(attribute.values)) {
transferableObjects.push(attribute.values.buffer);
}
}
}
if (defined_default(geometry.indices)) {
transferableObjects.push(geometry.indices.buffer);
}
}
function transferGeometries(geometries, transferableObjects) {
const length = geometries.length;
for (let i = 0; i < length; ++i) {
transferGeometry(geometries[i], transferableObjects);
}
}
function countCreateGeometryResults(items) {
let count = 1;
const length = items.length;
for (let i = 0; i < length; i++) {
const geometry = items[i];
++count;
if (!defined_default(geometry)) {
continue;
}
const attributes = geometry.attributes;
count += 7 + 2 * BoundingSphere_default.packedLength + (defined_default(geometry.indices) ? geometry.indices.length : 0);
for (const property in attributes) {
if (attributes.hasOwnProperty(property) && defined_default(attributes[property])) {
const attribute = attributes[property];
count += 5 + attribute.values.length;
}
}
}
return count;
}
PrimitivePipeline.packCreateGeometryResults = function(items, transferableObjects) {
const packedData = new Float64Array(countCreateGeometryResults(items));
const stringTable = [];
const stringHash = {};
const length = items.length;
let count = 0;
packedData[count++] = length;
for (let i = 0; i < length; i++) {
const geometry = items[i];
const validGeometry = defined_default(geometry);
packedData[count++] = validGeometry ? 1 : 0;
if (!validGeometry) {
continue;
}
packedData[count++] = geometry.primitiveType;
packedData[count++] = geometry.geometryType;
packedData[count++] = defaultValue_default(geometry.offsetAttribute, -1);
const validBoundingSphere = defined_default(geometry.boundingSphere) ? 1 : 0;
packedData[count++] = validBoundingSphere;
if (validBoundingSphere) {
BoundingSphere_default.pack(geometry.boundingSphere, packedData, count);
}
count += BoundingSphere_default.packedLength;
const validBoundingSphereCV = defined_default(geometry.boundingSphereCV) ? 1 : 0;
packedData[count++] = validBoundingSphereCV;
if (validBoundingSphereCV) {
BoundingSphere_default.pack(geometry.boundingSphereCV, packedData, count);
}
count += BoundingSphere_default.packedLength;
const attributes = geometry.attributes;
const attributesToWrite = [];
for (const property in attributes) {
if (attributes.hasOwnProperty(property) && defined_default(attributes[property])) {
attributesToWrite.push(property);
if (!defined_default(stringHash[property])) {
stringHash[property] = stringTable.length;
stringTable.push(property);
}
}
}
packedData[count++] = attributesToWrite.length;
for (let q = 0; q < attributesToWrite.length; q++) {
const name = attributesToWrite[q];
const attribute = attributes[name];
packedData[count++] = stringHash[name];
packedData[count++] = attribute.componentDatatype;
packedData[count++] = attribute.componentsPerAttribute;
packedData[count++] = attribute.normalize ? 1 : 0;
packedData[count++] = attribute.values.length;
packedData.set(attribute.values, count);
count += attribute.values.length;
}
const indicesLength = defined_default(geometry.indices) ? geometry.indices.length : 0;
packedData[count++] = indicesLength;
if (indicesLength > 0) {
packedData.set(geometry.indices, count);
count += indicesLength;
}
}
transferableObjects.push(packedData.buffer);
return {
stringTable,
packedData
};
};
PrimitivePipeline.unpackCreateGeometryResults = function(createGeometryResult) {
const stringTable = createGeometryResult.stringTable;
const packedGeometry = createGeometryResult.packedData;
let i;
const result = new Array(packedGeometry[0]);
let resultIndex = 0;
let packedGeometryIndex = 1;
while (packedGeometryIndex < packedGeometry.length) {
const valid = packedGeometry[packedGeometryIndex++] === 1;
if (!valid) {
result[resultIndex++] = void 0;
continue;
}
const primitiveType = packedGeometry[packedGeometryIndex++];
const geometryType = packedGeometry[packedGeometryIndex++];
let offsetAttribute = packedGeometry[packedGeometryIndex++];
if (offsetAttribute === -1) {
offsetAttribute = void 0;
}
let boundingSphere;
let boundingSphereCV;
const validBoundingSphere = packedGeometry[packedGeometryIndex++] === 1;
if (validBoundingSphere) {
boundingSphere = BoundingSphere_default.unpack(
packedGeometry,
packedGeometryIndex
);
}
packedGeometryIndex += BoundingSphere_default.packedLength;
const validBoundingSphereCV = packedGeometry[packedGeometryIndex++] === 1;
if (validBoundingSphereCV) {
boundingSphereCV = BoundingSphere_default.unpack(
packedGeometry,
packedGeometryIndex
);
}
packedGeometryIndex += BoundingSphere_default.packedLength;
let length;
let values;
let componentsPerAttribute;
const attributes = new GeometryAttributes_default();
const numAttributes = packedGeometry[packedGeometryIndex++];
for (i = 0; i < numAttributes; i++) {
const name = stringTable[packedGeometry[packedGeometryIndex++]];
const componentDatatype = packedGeometry[packedGeometryIndex++];
componentsPerAttribute = packedGeometry[packedGeometryIndex++];
const normalize = packedGeometry[packedGeometryIndex++] !== 0;
length = packedGeometry[packedGeometryIndex++];
values = ComponentDatatype_default.createTypedArray(componentDatatype, length);
for (let valuesIndex = 0; valuesIndex < length; valuesIndex++) {
values[valuesIndex] = packedGeometry[packedGeometryIndex++];
}
attributes[name] = new GeometryAttribute_default({
componentDatatype,
componentsPerAttribute,
normalize,
values
});
}
let indices;
length = packedGeometry[packedGeometryIndex++];
if (length > 0) {
const numberOfVertices = values.length / componentsPerAttribute;
indices = IndexDatatype_default.createTypedArray(numberOfVertices, length);
for (i = 0; i < length; i++) {
indices[i] = packedGeometry[packedGeometryIndex++];
}
}
result[resultIndex++] = new Geometry_default({
primitiveType,
geometryType,
boundingSphere,
boundingSphereCV,
indices,
attributes,
offsetAttribute
});
}
return result;
};
function packInstancesForCombine(instances, transferableObjects) {
const length = instances.length;
const packedData = new Float64Array(1 + length * 19);
let count = 0;
packedData[count++] = length;
for (let i = 0; i < length; i++) {
const instance = instances[i];
Matrix4_default.pack(instance.modelMatrix, packedData, count);
count += Matrix4_default.packedLength;
if (defined_default(instance.attributes) && defined_default(instance.attributes.offset)) {
const values = instance.attributes.offset.value;
packedData[count] = values[0];
packedData[count + 1] = values[1];
packedData[count + 2] = values[2];
}
count += 3;
}
transferableObjects.push(packedData.buffer);
return packedData;
}
function unpackInstancesForCombine(data) {
const packedInstances = data;
const result = new Array(packedInstances[0]);
let count = 0;
let i = 1;
while (i < packedInstances.length) {
const modelMatrix = Matrix4_default.unpack(packedInstances, i);
let attributes;
i += Matrix4_default.packedLength;
if (defined_default(packedInstances[i])) {
attributes = {
offset: new OffsetGeometryInstanceAttribute_default(
packedInstances[i],
packedInstances[i + 1],
packedInstances[i + 2]
)
};
}
i += 3;
result[count++] = {
modelMatrix,
attributes
};
}
return result;
}
PrimitivePipeline.packCombineGeometryParameters = function(parameters, transferableObjects) {
const createGeometryResults = parameters.createGeometryResults;
const length = createGeometryResults.length;
for (let i = 0; i < length; i++) {
transferableObjects.push(createGeometryResults[i].packedData.buffer);
}
return {
createGeometryResults: parameters.createGeometryResults,
packedInstances: packInstancesForCombine(
parameters.instances,
transferableObjects
),
ellipsoid: parameters.ellipsoid,
isGeographic: parameters.projection instanceof GeographicProjection_default,
elementIndexUintSupported: parameters.elementIndexUintSupported,
scene3DOnly: parameters.scene3DOnly,
vertexCacheOptimize: parameters.vertexCacheOptimize,
compressVertices: parameters.compressVertices,
modelMatrix: parameters.modelMatrix,
createPickOffsets: parameters.createPickOffsets
};
};
PrimitivePipeline.unpackCombineGeometryParameters = function(packedParameters) {
const instances = unpackInstancesForCombine(packedParameters.packedInstances);
const createGeometryResults = packedParameters.createGeometryResults;
const length = createGeometryResults.length;
let instanceIndex = 0;
for (let resultIndex = 0; resultIndex < length; resultIndex++) {
const geometries = PrimitivePipeline.unpackCreateGeometryResults(
createGeometryResults[resultIndex]
);
const geometriesLength = geometries.length;
for (let geometryIndex = 0; geometryIndex < geometriesLength; geometryIndex++) {
const geometry = geometries[geometryIndex];
const instance = instances[instanceIndex];
instance.geometry = geometry;
++instanceIndex;
}
}
const ellipsoid = Ellipsoid_default.clone(packedParameters.ellipsoid);
const projection = packedParameters.isGeographic ? new GeographicProjection_default(ellipsoid) : new WebMercatorProjection_default(ellipsoid);
return {
instances,
ellipsoid,
projection,
elementIndexUintSupported: packedParameters.elementIndexUintSupported,
scene3DOnly: packedParameters.scene3DOnly,
vertexCacheOptimize: packedParameters.vertexCacheOptimize,
compressVertices: packedParameters.compressVertices,
modelMatrix: Matrix4_default.clone(packedParameters.modelMatrix),
createPickOffsets: packedParameters.createPickOffsets
};
};
function packBoundingSpheres(boundingSpheres) {
const length = boundingSpheres.length;
const bufferLength = 1 + (BoundingSphere_default.packedLength + 1) * length;
const buffer = new Float32Array(bufferLength);
let bufferIndex = 0;
buffer[bufferIndex++] = length;
for (let i = 0; i < length; ++i) {
const bs = boundingSpheres[i];
if (!defined_default(bs)) {
buffer[bufferIndex++] = 0;
} else {
buffer[bufferIndex++] = 1;
BoundingSphere_default.pack(boundingSpheres[i], buffer, bufferIndex);
}
bufferIndex += BoundingSphere_default.packedLength;
}
return buffer;
}
function unpackBoundingSpheres(buffer) {
const result = new Array(buffer[0]);
let count = 0;
let i = 1;
while (i < buffer.length) {
if (buffer[i++] === 1) {
result[count] = BoundingSphere_default.unpack(buffer, i);
}
++count;
i += BoundingSphere_default.packedLength;
}
return result;
}
PrimitivePipeline.packCombineGeometryResults = function(results, transferableObjects) {
if (defined_default(results.geometries)) {
transferGeometries(results.geometries, transferableObjects);
}
const packedBoundingSpheres = packBoundingSpheres(results.boundingSpheres);
const packedBoundingSpheresCV = packBoundingSpheres(
results.boundingSpheresCV
);
transferableObjects.push(
packedBoundingSpheres.buffer,
packedBoundingSpheresCV.buffer
);
return {
geometries: results.geometries,
attributeLocations: results.attributeLocations,
modelMatrix: results.modelMatrix,
pickOffsets: results.pickOffsets,
offsetInstanceExtend: results.offsetInstanceExtend,
boundingSpheres: packedBoundingSpheres,
boundingSpheresCV: packedBoundingSpheresCV
};
};
PrimitivePipeline.unpackCombineGeometryResults = function(packedResult) {
return {
geometries: packedResult.geometries,
attributeLocations: packedResult.attributeLocations,
modelMatrix: packedResult.modelMatrix,
pickOffsets: packedResult.pickOffsets,
offsetInstanceExtend: packedResult.offsetInstanceExtend,
boundingSpheres: unpackBoundingSpheres(packedResult.boundingSpheres),
boundingSpheresCV: unpackBoundingSpheres(packedResult.boundingSpheresCV)
};
};
var PrimitivePipeline_default = PrimitivePipeline;
export {
PrimitivePipeline_default
};
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.121.2
*
* Copyright 2011-2022 Cesium Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Columbus View (Pat. Pend.)
*
* Portions licensed separately.
* See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
*/
import {
GeometryOffsetAttribute_default
} from "./chunk-GBT7MJ6X.js";
import {
VertexFormat_default
} from "./chunk-JBSKHTNX.js";
import {
IndexDatatype_default
} from "./chunk-C4WPMOKT.js";
import {
GeometryAttributes_default
} from "./chunk-X7IQYYHF.js";
import {
GeometryAttribute_default,
Geometry_default,
PrimitiveType_default
} from "./chunk-JXVLNVXC.js";
import {
BoundingSphere_default
} from "./chunk-KHZNBFOH.js";
import {
ComponentDatatype_default
} from "./chunk-XIUSRWL6.js";
import {
Cartesian2_default,
Cartesian3_default,
Ellipsoid_default
} from "./chunk-FFLMY4TE.js";
import {
Math_default
} from "./chunk-WGDFYAGC.js";
import {
defaultValue_default
} from "./chunk-U5HSOKPQ.js";
import {
DeveloperError_default
} from "./chunk-P6TRGU3S.js";
import {
defined_default
} from "./chunk-YCDZX5LS.js";
// packages/engine/Source/Core/EllipsoidGeometry.js
var scratchPosition = new Cartesian3_default();
var scratchNormal = new Cartesian3_default();
var scratchTangent = new Cartesian3_default();
var scratchBitangent = new Cartesian3_default();
var scratchNormalST = new Cartesian3_default();
var defaultRadii = new Cartesian3_default(1, 1, 1);
var cos = Math.cos;
var sin = Math.sin;
function EllipsoidGeometry(options) {
options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
const radii = defaultValue_default(options.radii, defaultRadii);
const innerRadii = defaultValue_default(options.innerRadii, radii);
const minimumClock = defaultValue_default(options.minimumClock, 0);
const maximumClock = defaultValue_default(options.maximumClock, Math_default.TWO_PI);
const minimumCone = defaultValue_default(options.minimumCone, 0);
const maximumCone = defaultValue_default(options.maximumCone, Math_default.PI);
const stackPartitions = Math.round(defaultValue_default(options.stackPartitions, 64));
const slicePartitions = Math.round(defaultValue_default(options.slicePartitions, 64));
const vertexFormat = defaultValue_default(options.vertexFormat, VertexFormat_default.DEFAULT);
if (slicePartitions < 3) {
throw new DeveloperError_default(
"options.slicePartitions cannot be less than three."
);
}
if (stackPartitions < 3) {
throw new DeveloperError_default(
"options.stackPartitions cannot be less than three."
);
}
this._radii = Cartesian3_default.clone(radii);
this._innerRadii = Cartesian3_default.clone(innerRadii);
this._minimumClock = minimumClock;
this._maximumClock = maximumClock;
this._minimumCone = minimumCone;
this._maximumCone = maximumCone;
this._stackPartitions = stackPartitions;
this._slicePartitions = slicePartitions;
this._vertexFormat = VertexFormat_default.clone(vertexFormat);
this._offsetAttribute = options.offsetAttribute;
this._workerName = "createEllipsoidGeometry";
}
EllipsoidGeometry.packedLength = 2 * Cartesian3_default.packedLength + VertexFormat_default.packedLength + 7;
EllipsoidGeometry.pack = function(value, array, startingIndex) {
if (!defined_default(value)) {
throw new DeveloperError_default("value is required");
}
if (!defined_default(array)) {
throw new DeveloperError_default("array is required");
}
startingIndex = defaultValue_default(startingIndex, 0);
Cartesian3_default.pack(value._radii, array, startingIndex);
startingIndex += Cartesian3_default.packedLength;
Cartesian3_default.pack(value._innerRadii, array, startingIndex);
startingIndex += Cartesian3_default.packedLength;
VertexFormat_default.pack(value._vertexFormat, array, startingIndex);
startingIndex += VertexFormat_default.packedLength;
array[startingIndex++] = value._minimumClock;
array[startingIndex++] = value._maximumClock;
array[startingIndex++] = value._minimumCone;
array[startingIndex++] = value._maximumCone;
array[startingIndex++] = value._stackPartitions;
array[startingIndex++] = value._slicePartitions;
array[startingIndex] = defaultValue_default(value._offsetAttribute, -1);
return array;
};
var scratchRadii = new Cartesian3_default();
var scratchInnerRadii = new Cartesian3_default();
var scratchVertexFormat = new VertexFormat_default();
var scratchOptions = {
radii: scratchRadii,
innerRadii: scratchInnerRadii,
vertexFormat: scratchVertexFormat,
minimumClock: void 0,
maximumClock: void 0,
minimumCone: void 0,
maximumCone: void 0,
stackPartitions: void 0,
slicePartitions: void 0,
offsetAttribute: void 0
};
EllipsoidGeometry.unpack = function(array, startingIndex, result) {
if (!defined_default(array)) {
throw new DeveloperError_default("array is required");
}
startingIndex = defaultValue_default(startingIndex, 0);
const radii = Cartesian3_default.unpack(array, startingIndex, scratchRadii);
startingIndex += Cartesian3_default.packedLength;
const innerRadii = Cartesian3_default.unpack(array, startingIndex, scratchInnerRadii);
startingIndex += Cartesian3_default.packedLength;
const vertexFormat = VertexFormat_default.unpack(
array,
startingIndex,
scratchVertexFormat
);
startingIndex += VertexFormat_default.packedLength;
const minimumClock = array[startingIndex++];
const maximumClock = array[startingIndex++];
const minimumCone = array[startingIndex++];
const maximumCone = array[startingIndex++];
const stackPartitions = array[startingIndex++];
const slicePartitions = array[startingIndex++];
const offsetAttribute = array[startingIndex];
if (!defined_default(result)) {
scratchOptions.minimumClock = minimumClock;
scratchOptions.maximumClock = maximumClock;
scratchOptions.minimumCone = minimumCone;
scratchOptions.maximumCone = maximumCone;
scratchOptions.stackPartitions = stackPartitions;
scratchOptions.slicePartitions = slicePartitions;
scratchOptions.offsetAttribute = offsetAttribute === -1 ? void 0 : offsetAttribute;
return new EllipsoidGeometry(scratchOptions);
}
result._radii = Cartesian3_default.clone(radii, result._radii);
result._innerRadii = Cartesian3_default.clone(innerRadii, result._innerRadii);
result._vertexFormat = VertexFormat_default.clone(vertexFormat, result._vertexFormat);
result._minimumClock = minimumClock;
result._maximumClock = maximumClock;
result._minimumCone = minimumCone;
result._maximumCone = maximumCone;
result._stackPartitions = stackPartitions;
result._slicePartitions = slicePartitions;
result._offsetAttribute = offsetAttribute === -1 ? void 0 : offsetAttribute;
return result;
};
EllipsoidGeometry.createGeometry = function(ellipsoidGeometry) {
const radii = ellipsoidGeometry._radii;
if (radii.x <= 0 || radii.y <= 0 || radii.z <= 0) {
return;
}
const innerRadii = ellipsoidGeometry._innerRadii;
if (innerRadii.x <= 0 || innerRadii.y <= 0 || innerRadii.z <= 0) {
return;
}
const minimumClock = ellipsoidGeometry._minimumClock;
const maximumClock = ellipsoidGeometry._maximumClock;
const minimumCone = ellipsoidGeometry._minimumCone;
const maximumCone = ellipsoidGeometry._maximumCone;
const vertexFormat = ellipsoidGeometry._vertexFormat;
let slicePartitions = ellipsoidGeometry._slicePartitions + 1;
let stackPartitions = ellipsoidGeometry._stackPartitions + 1;
slicePartitions = Math.round(
slicePartitions * Math.abs(maximumClock - minimumClock) / Math_default.TWO_PI
);
stackPartitions = Math.round(
stackPartitions * Math.abs(maximumCone - minimumCone) / Math_default.PI
);
if (slicePartitions < 2) {
slicePartitions = 2;
}
if (stackPartitions < 2) {
stackPartitions = 2;
}
let i;
let j;
let index = 0;
const phis = [minimumCone];
const thetas = [minimumClock];
for (i = 0; i < stackPartitions; i++) {
phis.push(
minimumCone + i * (maximumCone - minimumCone) / (stackPartitions - 1)
);
}
phis.push(maximumCone);
for (j = 0; j < slicePartitions; j++) {
thetas.push(
minimumClock + j * (maximumClock - minimumClock) / (slicePartitions - 1)
);
}
thetas.push(maximumClock);
const numPhis = phis.length;
const numThetas = thetas.length;
let extraIndices = 0;
let vertexMultiplier = 1;
const hasInnerSurface = innerRadii.x !== radii.x || innerRadii.y !== radii.y || innerRadii.z !== radii.z;
let isTopOpen = false;
let isBotOpen = false;
let isClockOpen = false;
if (hasInnerSurface) {
vertexMultiplier = 2;
if (minimumCone > 0) {
isTopOpen = true;
extraIndices += slicePartitions - 1;
}
if (maximumCone < Math.PI) {
isBotOpen = true;
extraIndices += slicePartitions - 1;
}
if ((maximumClock - minimumClock) % Math_default.TWO_PI) {
isClockOpen = true;
extraIndices += (stackPartitions - 1) * 2 + 1;
} else {
extraIndices += 1;
}
}
const vertexCount = numThetas * numPhis * vertexMultiplier;
const positions = new Float64Array(vertexCount * 3);
const isInner = new Array(vertexCount).fill(false);
const negateNormal = new Array(vertexCount).fill(false);
const indexCount = slicePartitions * stackPartitions * vertexMultiplier;
const numIndices = 6 * (indexCount + extraIndices + 1 - (slicePartitions + stackPartitions) * vertexMultiplier);
const indices = IndexDatatype_default.createTypedArray(indexCount, numIndices);
const normals = vertexFormat.normal ? new Float32Array(vertexCount * 3) : void 0;
const tangents = vertexFormat.tangent ? new Float32Array(vertexCount * 3) : void 0;
const bitangents = vertexFormat.bitangent ? new Float32Array(vertexCount * 3) : void 0;
const st = vertexFormat.st ? new Float32Array(vertexCount * 2) : void 0;
const sinPhi = new Array(numPhis);
const cosPhi = new Array(numPhis);
for (i = 0; i < numPhis; i++) {
sinPhi[i] = sin(phis[i]);
cosPhi[i] = cos(phis[i]);
}
const sinTheta = new Array(numThetas);
const cosTheta = new Array(numThetas);
for (j = 0; j < numThetas; j++) {
cosTheta[j] = cos(thetas[j]);
sinTheta[j] = sin(thetas[j]);
}
for (i = 0; i < numPhis; i++) {
for (j = 0; j < numThetas; j++) {
positions[index++] = radii.x * sinPhi[i] * cosTheta[j];
positions[index++] = radii.y * sinPhi[i] * sinTheta[j];
positions[index++] = radii.z * cosPhi[i];
}
}
let vertexIndex = vertexCount / 2;
if (hasInnerSurface) {
for (i = 0; i < numPhis; i++) {
for (j = 0; j < numThetas; j++) {
positions[index++] = innerRadii.x * sinPhi[i] * cosTheta[j];
positions[index++] = innerRadii.y * sinPhi[i] * sinTheta[j];
positions[index++] = innerRadii.z * cosPhi[i];
isInner[vertexIndex] = true;
if (i > 0 && i !== numPhis - 1 && j !== 0 && j !== numThetas - 1) {
negateNormal[vertexIndex] = true;
}
vertexIndex++;
}
}
}
index = 0;
let topOffset;
let bottomOffset;
for (i = 1; i < numPhis - 2; i++) {
topOffset = i * numThetas;
bottomOffset = (i + 1) * numThetas;
for (j = 1; j < numThetas - 2; j++) {
indices[index++] = bottomOffset + j;
indices[index++] = bottomOffset + j + 1;
indices[index++] = topOffset + j + 1;
indices[index++] = bottomOffset + j;
indices[index++] = topOffset + j + 1;
indices[index++] = topOffset + j;
}
}
if (hasInnerSurface) {
const offset = numPhis * numThetas;
for (i = 1; i < numPhis - 2; i++) {
topOffset = offset + i * numThetas;
bottomOffset = offset + (i + 1) * numThetas;
for (j = 1; j < numThetas - 2; j++) {
indices[index++] = bottomOffset + j;
indices[index++] = topOffset + j;
indices[index++] = topOffset + j + 1;
indices[index++] = bottomOffset + j;
indices[index++] = topOffset + j + 1;
indices[index++] = bottomOffset + j + 1;
}
}
}
let outerOffset;
let innerOffset;
if (hasInnerSurface) {
if (isTopOpen) {
innerOffset = numPhis * numThetas;
for (i = 1; i < numThetas - 2; i++) {
indices[index++] = i;
indices[index++] = i + 1;
indices[index++] = innerOffset + i + 1;
indices[index++] = i;
indices[index++] = innerOffset + i + 1;
indices[index++] = innerOffset + i;
}
}
if (isBotOpen) {
outerOffset = numPhis * numThetas - numThetas;
innerOffset = numPhis * numThetas * vertexMultiplier - numThetas;
for (i = 1; i < numThetas - 2; i++) {
indices[index++] = outerOffset + i + 1;
indices[index++] = outerOffset + i;
indices[index++] = innerOffset + i;
indices[index++] = outerOffset + i + 1;
indices[index++] = innerOffset + i;
indices[index++] = innerOffset + i + 1;
}
}
}
if (isClockOpen) {
for (i = 1; i < numPhis - 2; i++) {
innerOffset = numThetas * numPhis + numThetas * i;
outerOffset = numThetas * i;
indices[index++] = innerOffset;
indices[index++] = outerOffset + numThetas;
indices[index++] = outerOffset;
indices[index++] = innerOffset;
indices[index++] = innerOffset + numThetas;
indices[index++] = outerOffset + numThetas;
}
for (i = 1; i < numPhis - 2; i++) {
innerOffset = numThetas * numPhis + numThetas * (i + 1) - 1;
outerOffset = numThetas * (i + 1) - 1;
indices[index++] = outerOffset + numThetas;
indices[index++] = innerOffset;
indices[index++] = outerOffset;
indices[index++] = outerOffset + numThetas;
indices[index++] = innerOffset + numThetas;
indices[index++] = innerOffset;
}
}
const attributes = new GeometryAttributes_default();
if (vertexFormat.position) {
attributes.position = new GeometryAttribute_default({
componentDatatype: ComponentDatatype_default.DOUBLE,
componentsPerAttribute: 3,
values: positions
});
}
let stIndex = 0;
let normalIndex = 0;
let tangentIndex = 0;
let bitangentIndex = 0;
const vertexCountHalf = vertexCount / 2;
let ellipsoid;
const ellipsoidOuter = Ellipsoid_default.fromCartesian3(radii);
const ellipsoidInner = Ellipsoid_default.fromCartesian3(innerRadii);
if (vertexFormat.st || vertexFormat.normal || vertexFormat.tangent || vertexFormat.bitangent) {
for (i = 0; i < vertexCount; i++) {
ellipsoid = isInner[i] ? ellipsoidInner : ellipsoidOuter;
const position = Cartesian3_default.fromArray(positions, i * 3, scratchPosition);
const normal = ellipsoid.geodeticSurfaceNormal(position, scratchNormal);
if (negateNormal[i]) {
Cartesian3_default.negate(normal, normal);
}
if (vertexFormat.st) {
const normalST = Cartesian2_default.negate(normal, scratchNormalST);
st[stIndex++] = Math.atan2(normalST.y, normalST.x) / Math_default.TWO_PI + 0.5;
st[stIndex++] = Math.asin(normal.z) / Math.PI + 0.5;
}
if (vertexFormat.normal) {
normals[normalIndex++] = normal.x;
normals[normalIndex++] = normal.y;
normals[normalIndex++] = normal.z;
}
if (vertexFormat.tangent || vertexFormat.bitangent) {
const tangent = scratchTangent;
let tangetOffset = 0;
let unit;
if (isInner[i]) {
tangetOffset = vertexCountHalf;
}
if (!isTopOpen && i >= tangetOffset && i < tangetOffset + numThetas * 2) {
unit = Cartesian3_default.UNIT_X;
} else {
unit = Cartesian3_default.UNIT_Z;
}
Cartesian3_default.cross(unit, normal, tangent);
Cartesian3_default.normalize(tangent, tangent);
if (vertexFormat.tangent) {
tangents[tangentIndex++] = tangent.x;
tangents[tangentIndex++] = tangent.y;
tangents[tangentIndex++] = tangent.z;
}
if (vertexFormat.bitangent) {
const bitangent = Cartesian3_default.cross(normal, tangent, scratchBitangent);
Cartesian3_default.normalize(bitangent, bitangent);
bitangents[bitangentIndex++] = bitangent.x;
bitangents[bitangentIndex++] = bitangent.y;
bitangents[bitangentIndex++] = bitangent.z;
}
}
}
if (vertexFormat.st) {
attributes.st = new GeometryAttribute_default({
componentDatatype: ComponentDatatype_default.FLOAT,
componentsPerAttribute: 2,
values: st
});
}
if (vertexFormat.normal) {
attributes.normal = new GeometryAttribute_default({
componentDatatype: ComponentDatatype_default.FLOAT,
componentsPerAttribute: 3,
values: normals
});
}
if (vertexFormat.tangent) {
attributes.tangent = new GeometryAttribute_default({
componentDatatype: ComponentDatatype_default.FLOAT,
componentsPerAttribute: 3,
values: tangents
});
}
if (vertexFormat.bitangent) {
attributes.bitangent = new GeometryAttribute_default({
componentDatatype: ComponentDatatype_default.FLOAT,
componentsPerAttribute: 3,
values: bitangents
});
}
}
if (defined_default(ellipsoidGeometry._offsetAttribute)) {
const length = positions.length;
const offsetValue = ellipsoidGeometry._offsetAttribute === GeometryOffsetAttribute_default.NONE ? 0 : 1;
const applyOffset = new Uint8Array(length / 3).fill(offsetValue);
attributes.applyOffset = new GeometryAttribute_default({
componentDatatype: ComponentDatatype_default.UNSIGNED_BYTE,
componentsPerAttribute: 1,
values: applyOffset
});
}
return new Geometry_default({
attributes,
indices,
primitiveType: PrimitiveType_default.TRIANGLES,
boundingSphere: BoundingSphere_default.fromEllipsoid(ellipsoidOuter),
offsetAttribute: ellipsoidGeometry._offsetAttribute
});
};
var unitEllipsoidGeometry;
EllipsoidGeometry.getUnitEllipsoid = function() {
if (!defined_default(unitEllipsoidGeometry)) {
unitEllipsoidGeometry = EllipsoidGeometry.createGeometry(
new EllipsoidGeometry({
radii: new Cartesian3_default(1, 1, 1),
vertexFormat: VertexFormat_default.POSITION_ONLY
})
);
}
return unitEllipsoidGeometry;
};
var EllipsoidGeometry_default = EllipsoidGeometry;
export {
EllipsoidGeometry_default
};
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.121.2
*
* Copyright 2011-2022 Cesium Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Columbus View (Pat. Pend.)
*
* Portions licensed separately.
* See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
*/
import {
ArcType_default
} from "./chunk-XWOUPGUF.js";
import {
GeometryPipeline_default
} from "./chunk-7ZZ5LMZY.js";
import {
PolygonPipeline_default,
WindingOrder_default
} from "./chunk-TI3TRKIC.js";
import {
arrayRemoveDuplicates_default
} from "./chunk-57H6I3SV.js";
import {
EllipsoidRhumbLine_default
} from "./chunk-JSQJDZI4.js";
import {
IntersectionTests_default
} from "./chunk-QQOZO7KO.js";
import {
Plane_default
} from "./chunk-EDLRS3AW.js";
import {
IndexDatatype_default
} from "./chunk-C4WPMOKT.js";
import {
GeometryAttributes_default
} from "./chunk-X7IQYYHF.js";
import {
GeometryAttribute_default,
Geometry_default,
PrimitiveType_default
} from "./chunk-JXVLNVXC.js";
import {
Quaternion_default
} from "./chunk-6SQMLVGV.js";
import {
ComponentDatatype_default
} from "./chunk-XIUSRWL6.js";
import {
Cartesian2_default,
Cartesian3_default,
Cartographic_default,
Ellipsoid_default,
Matrix3_default
} from "./chunk-FFLMY4TE.js";
import {
Math_default
} from "./chunk-WGDFYAGC.js";
import {
defaultValue_default
} from "./chunk-U5HSOKPQ.js";
import {
defined_default
} from "./chunk-YCDZX5LS.js";
// packages/engine/Source/Core/PolygonHierarchy.js
function PolygonHierarchy(positions, holes) {
this.positions = defined_default(positions) ? positions : [];
this.holes = defined_default(holes) ? holes : [];
}
var PolygonHierarchy_default = PolygonHierarchy;
// packages/engine/Source/Core/Queue.js
function Queue() {
this._array = [];
this._offset = 0;
this._length = 0;
}
Object.defineProperties(Queue.prototype, {
/**
* The length of the queue.
*
* @memberof Queue.prototype
*
* @type {number}
* @readonly
*/
length: {
get: function() {
return this._length;
}
}
});
Queue.prototype.enqueue = function(item) {
this._array.push(item);
this._length++;
};
Queue.prototype.dequeue = function() {
if (this._length === 0) {
return void 0;
}
const array = this._array;
let offset = this._offset;
const item = array[offset];
array[offset] = void 0;
offset++;
if (offset > 10 && offset * 2 > array.length) {
this._array = array.slice(offset);
offset = 0;
}
this._offset = offset;
this._length--;
return item;
};
Queue.prototype.peek = function() {
if (this._length === 0) {
return void 0;
}
return this._array[this._offset];
};
Queue.prototype.contains = function(item) {
return this._array.indexOf(item) !== -1;
};
Queue.prototype.clear = function() {
this._array.length = this._offset = this._length = 0;
};
Queue.prototype.sort = function(compareFunction) {
if (this._offset > 0) {
this._array = this._array.slice(this._offset);
this._offset = 0;
}
this._array.sort(compareFunction);
};
var Queue_default = Queue;
// packages/engine/Source/Core/PolygonGeometryLibrary.js
var PolygonGeometryLibrary = {};
PolygonGeometryLibrary.computeHierarchyPackedLength = function(polygonHierarchy, CartesianX) {
let numComponents = 0;
const stack = [polygonHierarchy];
while (stack.length > 0) {
const hierarchy = stack.pop();
if (!defined_default(hierarchy)) {
continue;
}
numComponents += 2;
const positions = hierarchy.positions;
const holes = hierarchy.holes;
if (defined_default(positions) && positions.length > 0) {
numComponents += positions.length * CartesianX.packedLength;
}
if (defined_default(holes)) {
const length = holes.length;
for (let i = 0; i < length; ++i) {
stack.push(holes[i]);
}
}
}
return numComponents;
};
PolygonGeometryLibrary.packPolygonHierarchy = function(polygonHierarchy, array, startingIndex, CartesianX) {
const stack = [polygonHierarchy];
while (stack.length > 0) {
const hierarchy = stack.pop();
if (!defined_default(hierarchy)) {
continue;
}
const positions = hierarchy.positions;
const holes = hierarchy.holes;
array[startingIndex++] = defined_default(positions) ? positions.length : 0;
array[startingIndex++] = defined_default(holes) ? holes.length : 0;
if (defined_default(positions)) {
const positionsLength = positions.length;
for (let i = 0; i < positionsLength; ++i, startingIndex += CartesianX.packedLength) {
CartesianX.pack(positions[i], array, startingIndex);
}
}
if (defined_default(holes)) {
const holesLength = holes.length;
for (let j = 0; j < holesLength; ++j) {
stack.push(holes[j]);
}
}
}
return startingIndex;
};
PolygonGeometryLibrary.unpackPolygonHierarchy = function(array, startingIndex, CartesianX) {
const positionsLength = array[startingIndex++];
const holesLength = array[startingIndex++];
const positions = new Array(positionsLength);
const holes = holesLength > 0 ? new Array(holesLength) : void 0;
for (let i = 0; i < positionsLength; ++i, startingIndex += CartesianX.packedLength) {
positions[i] = CartesianX.unpack(array, startingIndex);
}
for (let j = 0; j < holesLength; ++j) {
holes[j] = PolygonGeometryLibrary.unpackPolygonHierarchy(
array,
startingIndex,
CartesianX
);
startingIndex = holes[j].startingIndex;
delete holes[j].startingIndex;
}
return {
positions,
holes,
startingIndex
};
};
var distance2DScratch = new Cartesian2_default();
function getPointAtDistance2D(p0, p1, distance, length) {
Cartesian2_default.subtract(p1, p0, distance2DScratch);
Cartesian2_default.multiplyByScalar(
distance2DScratch,
distance / length,
distance2DScratch
);
Cartesian2_default.add(p0, distance2DScratch, distance2DScratch);
return [distance2DScratch.x, distance2DScratch.y];
}
var distanceScratch = new Cartesian3_default();
function getPointAtDistance(p0, p1, distance, length) {
Cartesian3_default.subtract(p1, p0, distanceScratch);
Cartesian3_default.multiplyByScalar(
distanceScratch,
distance / length,
distanceScratch
);
Cartesian3_default.add(p0, distanceScratch, distanceScratch);
return [distanceScratch.x, distanceScratch.y, distanceScratch.z];
}
PolygonGeometryLibrary.subdivideLineCount = function(p0, p1, minDistance) {
const distance = Cartesian3_default.distance(p0, p1);
const n = distance / minDistance;
const countDivide = Math.max(0, Math.ceil(Math_default.log2(n)));
return Math.pow(2, countDivide);
};
var scratchCartographic0 = new Cartographic_default();
var scratchCartographic1 = new Cartographic_default();
var scratchCartographic2 = new Cartographic_default();
var scratchCartesian0 = new Cartesian3_default();
var scratchRhumbLine = new EllipsoidRhumbLine_default();
PolygonGeometryLibrary.subdivideRhumbLineCount = function(ellipsoid, p0, p1, minDistance) {
const c0 = ellipsoid.cartesianToCartographic(p0, scratchCartographic0);
const c1 = ellipsoid.cartesianToCartographic(p1, scratchCartographic1);
const rhumb = new EllipsoidRhumbLine_default(c0, c1, ellipsoid);
const n = rhumb.surfaceDistance / minDistance;
const countDivide = Math.max(0, Math.ceil(Math_default.log2(n)));
return Math.pow(2, countDivide);
};
PolygonGeometryLibrary.subdivideTexcoordLine = function(t0, t1, p0, p1, minDistance, result) {
const subdivisions = PolygonGeometryLibrary.subdivideLineCount(
p0,
p1,
minDistance
);
const length2D = Cartesian2_default.distance(t0, t1);
const distanceBetweenCoords = length2D / subdivisions;
const texcoords = result;
texcoords.length = subdivisions * 2;
let index = 0;
for (let i = 0; i < subdivisions; i++) {
const t = getPointAtDistance2D(t0, t1, i * distanceBetweenCoords, length2D);
texcoords[index++] = t[0];
texcoords[index++] = t[1];
}
return texcoords;
};
PolygonGeometryLibrary.subdivideLine = function(p0, p1, minDistance, result) {
const numVertices = PolygonGeometryLibrary.subdivideLineCount(
p0,
p1,
minDistance
);
const length = Cartesian3_default.distance(p0, p1);
const distanceBetweenVertices = length / numVertices;
if (!defined_default(result)) {
result = [];
}
const positions = result;
positions.length = numVertices * 3;
let index = 0;
for (let i = 0; i < numVertices; i++) {
const p = getPointAtDistance(p0, p1, i * distanceBetweenVertices, length);
positions[index++] = p[0];
positions[index++] = p[1];
positions[index++] = p[2];
}
return positions;
};
PolygonGeometryLibrary.subdivideTexcoordRhumbLine = function(t0, t1, ellipsoid, p0, p1, minDistance, result) {
const c0 = ellipsoid.cartesianToCartographic(p0, scratchCartographic0);
const c1 = ellipsoid.cartesianToCartographic(p1, scratchCartographic1);
scratchRhumbLine.setEndPoints(c0, c1);
const n = scratchRhumbLine.surfaceDistance / minDistance;
const countDivide = Math.max(0, Math.ceil(Math_default.log2(n)));
const subdivisions = Math.pow(2, countDivide);
const length2D = Cartesian2_default.distance(t0, t1);
const distanceBetweenCoords = length2D / subdivisions;
const texcoords = result;
texcoords.length = subdivisions * 2;
let index = 0;
for (let i = 0; i < subdivisions; i++) {
const t = getPointAtDistance2D(t0, t1, i * distanceBetweenCoords, length2D);
texcoords[index++] = t[0];
texcoords[index++] = t[1];
}
return texcoords;
};
PolygonGeometryLibrary.subdivideRhumbLine = function(ellipsoid, p0, p1, minDistance, result) {
const c0 = ellipsoid.cartesianToCartographic(p0, scratchCartographic0);
const c1 = ellipsoid.cartesianToCartographic(p1, scratchCartographic1);
const rhumb = new EllipsoidRhumbLine_default(c0, c1, ellipsoid);
const n = rhumb.surfaceDistance / minDistance;
const countDivide = Math.max(0, Math.ceil(Math_default.log2(n)));
const numVertices = Math.pow(2, countDivide);
const distanceBetweenVertices = rhumb.surfaceDistance / numVertices;
if (!defined_default(result)) {
result = [];
}
const positions = result;
positions.length = numVertices * 3;
let index = 0;
for (let i = 0; i < numVertices; i++) {
const c = rhumb.interpolateUsingSurfaceDistance(
i * distanceBetweenVertices,
scratchCartographic2
);
const p = ellipsoid.cartographicToCartesian(c, scratchCartesian0);
positions[index++] = p.x;
positions[index++] = p.y;
positions[index++] = p.z;
}
return positions;
};
var scaleToGeodeticHeightN1 = new Cartesian3_default();
var scaleToGeodeticHeightN2 = new Cartesian3_default();
var scaleToGeodeticHeightP1 = new Cartesian3_default();
var scaleToGeodeticHeightP2 = new Cartesian3_default();
PolygonGeometryLibrary.scaleToGeodeticHeightExtruded = function(geometry, maxHeight, minHeight, ellipsoid, perPositionHeight) {
ellipsoid = defaultValue_default(ellipsoid, Ellipsoid_default.default);
const n1 = scaleToGeodeticHeightN1;
let n2 = scaleToGeodeticHeightN2;
const p = scaleToGeodeticHeightP1;
let p2 = scaleToGeodeticHeightP2;
if (defined_default(geometry) && defined_default(geometry.attributes) && defined_default(geometry.attributes.position)) {
const positions = geometry.attributes.position.values;
const length = positions.length / 2;
for (let i = 0; i < length; i += 3) {
Cartesian3_default.fromArray(positions, i, p);
ellipsoid.geodeticSurfaceNormal(p, n1);
p2 = ellipsoid.scaleToGeodeticSurface(p, p2);
n2 = Cartesian3_default.multiplyByScalar(n1, minHeight, n2);
n2 = Cartesian3_default.add(p2, n2, n2);
positions[i + length] = n2.x;
positions[i + 1 + length] = n2.y;
positions[i + 2 + length] = n2.z;
if (perPositionHeight) {
p2 = Cartesian3_default.clone(p, p2);
}
n2 = Cartesian3_default.multiplyByScalar(n1, maxHeight, n2);
n2 = Cartesian3_default.add(p2, n2, n2);
positions[i] = n2.x;
positions[i + 1] = n2.y;
positions[i + 2] = n2.z;
}
}
return geometry;
};
PolygonGeometryLibrary.polygonOutlinesFromHierarchy = function(polygonHierarchy, scaleToEllipsoidSurface, ellipsoid) {
const polygons = [];
const queue = new Queue_default();
queue.enqueue(polygonHierarchy);
let i;
let j;
let length;
while (queue.length !== 0) {
const outerNode = queue.dequeue();
let outerRing = outerNode.positions;
if (scaleToEllipsoidSurface) {
length = outerRing.length;
for (i = 0; i < length; i++) {
ellipsoid.scaleToGeodeticSurface(outerRing[i], outerRing[i]);
}
}
outerRing = arrayRemoveDuplicates_default(
outerRing,
Cartesian3_default.equalsEpsilon,
true
);
if (outerRing.length < 3) {
continue;
}
const numChildren = outerNode.holes ? outerNode.holes.length : 0;
for (i = 0; i < numChildren; i++) {
const hole = outerNode.holes[i];
let holePositions = hole.positions;
if (scaleToEllipsoidSurface) {
length = holePositions.length;
for (j = 0; j < length; ++j) {
ellipsoid.scaleToGeodeticSurface(holePositions[j], holePositions[j]);
}
}
holePositions = arrayRemoveDuplicates_default(
holePositions,
Cartesian3_default.equalsEpsilon,
true
);
if (holePositions.length < 3) {
continue;
}
polygons.push(holePositions);
let numGrandchildren = 0;
if (defined_default(hole.holes)) {
numGrandchildren = hole.holes.length;
}
for (j = 0; j < numGrandchildren; j++) {
queue.enqueue(hole.holes[j]);
}
}
polygons.push(outerRing);
}
return polygons;
};
var scratchRhumbIntersection = new Cartographic_default();
function computeEquatorIntersectionRhumb(start, end, ellipsoid) {
const c0 = ellipsoid.cartesianToCartographic(start, scratchCartographic0);
const c1 = ellipsoid.cartesianToCartographic(end, scratchCartographic1);
if (Math.sign(c0.latitude) === Math.sign(c1.latitude)) {
return;
}
scratchRhumbLine.setEndPoints(c0, c1);
const intersection = scratchRhumbLine.findIntersectionWithLatitude(
0,
scratchRhumbIntersection
);
if (!defined_default(intersection)) {
return;
}
let minLongitude = Math.min(c0.longitude, c1.longitude);
let maxLongitude = Math.max(c0.longitude, c1.longitude);
if (Math.abs(maxLongitude - minLongitude) > Math_default.PI) {
const swap = minLongitude;
minLongitude = maxLongitude;
maxLongitude = swap;
}
if (intersection.longitude < minLongitude || intersection.longitude > maxLongitude) {
return;
}
return ellipsoid.cartographicToCartesian(intersection);
}
function computeEquatorIntersection(start, end, ellipsoid, arcType) {
if (arcType === ArcType_default.RHUMB) {
return computeEquatorIntersectionRhumb(start, end, ellipsoid);
}
const intersection = IntersectionTests_default.lineSegmentPlane(
start,
end,
Plane_default.ORIGIN_XY_PLANE
);
if (!defined_default(intersection)) {
return;
}
return ellipsoid.scaleToGeodeticSurface(intersection, intersection);
}
var scratchCartographic = new Cartographic_default();
function computeEdgesOnPlane(positions, ellipsoid, arcType) {
const edgesOnPlane = [];
let startPoint, endPoint, type, next, intersection, i = 0;
while (i < positions.length) {
startPoint = positions[i];
endPoint = positions[(i + 1) % positions.length];
type = Math_default.sign(startPoint.z);
next = Math_default.sign(endPoint.z);
const getLongitude = (position) => {
const cartographic = ellipsoid.cartesianToCartographic(
position,
scratchCartographic
);
return cartographic.longitude;
};
if (type === 0) {
edgesOnPlane.push({
position: i,
type,
visited: false,
next,
theta: getLongitude(startPoint)
});
} else if (next !== 0) {
intersection = computeEquatorIntersection(
startPoint,
endPoint,
ellipsoid,
arcType
);
++i;
if (!defined_default(intersection)) {
continue;
}
positions.splice(i, 0, intersection);
edgesOnPlane.push({
position: i,
type,
visited: false,
next,
theta: getLongitude(intersection)
});
}
++i;
}
return edgesOnPlane;
}
function wirePolygon(polygons, polygonIndex, positions, edgesOnPlane, toDelete, startIndex, abovePlane) {
const polygon = [];
let i = startIndex;
const getMatchingEdge = (i2) => (edge) => edge.position === i2;
const polygonsToWire = [];
do {
const position = positions[i];
polygon.push(position);
const edgeIndex = edgesOnPlane.findIndex(getMatchingEdge(i));
const edge = edgesOnPlane[edgeIndex];
if (!defined_default(edge)) {
++i;
continue;
}
const { visited: hasBeenVisited, type, next } = edge;
edge.visited = true;
if (type === 0) {
if (next === 0) {
const previousEdge = edgesOnPlane[edgeIndex - (abovePlane ? 1 : -1)];
if (previousEdge?.position === i + 1) {
previousEdge.visited = true;
} else {
++i;
continue;
}
}
if (!hasBeenVisited && abovePlane && next > 0 || startIndex === i && !abovePlane && next < 0) {
++i;
continue;
}
}
const followEdge = abovePlane ? type >= 0 : type <= 0;
if (!followEdge) {
++i;
continue;
}
if (!hasBeenVisited) {
polygonsToWire.push(i);
}
const nextEdgeIndex = edgeIndex + (abovePlane ? 1 : -1);
const nextEdge = edgesOnPlane[nextEdgeIndex];
if (!defined_default(nextEdge)) {
++i;
continue;
}
i = nextEdge.position;
} while (i < positions.length && i >= 0 && i !== startIndex && polygon.length < positions.length);
polygons.splice(polygonIndex, toDelete, polygon);
for (const index of polygonsToWire) {
polygonIndex = wirePolygon(
polygons,
++polygonIndex,
positions,
edgesOnPlane,
0,
index,
!abovePlane
);
}
return polygonIndex;
}
PolygonGeometryLibrary.splitPolygonsOnEquator = function(outerRings, ellipsoid, arcType, result) {
if (!defined_default(result)) {
result = [];
}
result.splice(0, 0, ...outerRings);
result.length = outerRings.length;
let currentPolygon = 0;
while (currentPolygon < result.length) {
const outerRing = result[currentPolygon];
const positions = outerRing.slice();
if (outerRing.length < 3) {
result[currentPolygon] = positions;
++currentPolygon;
continue;
}
const edgesOnPlane = computeEdgesOnPlane(positions, ellipsoid, arcType);
if (positions.length === outerRing.length || edgesOnPlane.length <= 1) {
result[currentPolygon] = positions;
++currentPolygon;
continue;
}
edgesOnPlane.sort((a, b) => {
return a.theta - b.theta;
});
const north = positions[0].z >= 0;
currentPolygon = wirePolygon(
result,
currentPolygon,
positions,
edgesOnPlane,
1,
0,
north
);
}
return result;
};
PolygonGeometryLibrary.polygonsFromHierarchy = function(polygonHierarchy, keepDuplicates, projectPointsTo2D, scaleToEllipsoidSurface, ellipsoid, splitPolygons) {
const hierarchy = [];
const polygons = [];
const queue = new Queue_default();
queue.enqueue(polygonHierarchy);
let split = defined_default(splitPolygons);
while (queue.length !== 0) {
const outerNode = queue.dequeue();
let outerRing = outerNode.positions;
const holes = outerNode.holes;
let i;
let length;
if (scaleToEllipsoidSurface) {
length = outerRing.length;
for (i = 0; i < length; i++) {
ellipsoid.scaleToGeodeticSurface(outerRing[i], outerRing[i]);
}
}
if (!keepDuplicates) {
outerRing = arrayRemoveDuplicates_default(
outerRing,
Cartesian3_default.equalsEpsilon,
true
);
}
if (outerRing.length < 3) {
continue;
}
let positions2D = projectPointsTo2D(outerRing);
if (!defined_default(positions2D)) {
continue;
}
const holeIndices = [];
let originalWindingOrder = PolygonPipeline_default.computeWindingOrder2D(
positions2D
);
if (originalWindingOrder === WindingOrder_default.CLOCKWISE) {
positions2D.reverse();
outerRing = outerRing.slice().reverse();
}
if (split) {
split = false;
let polygons2 = [outerRing];
polygons2 = splitPolygons(polygons2, polygons2);
if (polygons2.length > 1) {
for (const positions2 of polygons2) {
queue.enqueue(new PolygonHierarchy_default(positions2, holes));
}
continue;
}
}
let positions = outerRing.slice();
const numChildren = defined_default(holes) ? holes.length : 0;
const polygonHoles = [];
let j;
for (i = 0; i < numChildren; i++) {
const hole = holes[i];
let holePositions = hole.positions;
if (scaleToEllipsoidSurface) {
length = holePositions.length;
for (j = 0; j < length; ++j) {
ellipsoid.scaleToGeodeticSurface(holePositions[j], holePositions[j]);
}
}
if (!keepDuplicates) {
holePositions = arrayRemoveDuplicates_default(
holePositions,
Cartesian3_default.equalsEpsilon,
true
);
}
if (holePositions.length < 3) {
continue;
}
const holePositions2D = projectPointsTo2D(holePositions);
if (!defined_default(holePositions2D)) {
continue;
}
originalWindingOrder = PolygonPipeline_default.computeWindingOrder2D(
holePositions2D
);
if (originalWindingOrder === WindingOrder_default.CLOCKWISE) {
holePositions2D.reverse();
holePositions = holePositions.slice().reverse();
}
polygonHoles.push(holePositions);
holeIndices.push(positions.length);
positions = positions.concat(holePositions);
positions2D = positions2D.concat(holePositions2D);
let numGrandchildren = 0;
if (defined_default(hole.holes)) {
numGrandchildren = hole.holes.length;
}
for (j = 0; j < numGrandchildren; j++) {
queue.enqueue(hole.holes[j]);
}
}
hierarchy.push({
outerRing,
holes: polygonHoles
});
polygons.push({
positions,
positions2D,
holes: holeIndices
});
}
return {
hierarchy,
polygons
};
};
var computeBoundingRectangleCartesian2 = new Cartesian2_default();
var computeBoundingRectangleCartesian3 = new Cartesian3_default();
var computeBoundingRectangleQuaternion = new Quaternion_default();
var computeBoundingRectangleMatrix3 = new Matrix3_default();
PolygonGeometryLibrary.computeBoundingRectangle = function(planeNormal, projectPointTo2D, positions, angle, result) {
const rotation = Quaternion_default.fromAxisAngle(
planeNormal,
angle,
computeBoundingRectangleQuaternion
);
const textureMatrix = Matrix3_default.fromQuaternion(
rotation,
computeBoundingRectangleMatrix3
);
let minX = Number.POSITIVE_INFINITY;
let maxX = Number.NEGATIVE_INFINITY;
let minY = Number.POSITIVE_INFINITY;
let maxY = Number.NEGATIVE_INFINITY;
const length = positions.length;
for (let i = 0; i < length; ++i) {
const p = Cartesian3_default.clone(
positions[i],
computeBoundingRectangleCartesian3
);
Matrix3_default.multiplyByVector(textureMatrix, p, p);
const st = projectPointTo2D(p, computeBoundingRectangleCartesian2);
if (defined_default(st)) {
minX = Math.min(minX, st.x);
maxX = Math.max(maxX, st.x);
minY = Math.min(minY, st.y);
maxY = Math.max(maxY, st.y);
}
}
result.x = minX;
result.y = minY;
result.width = maxX - minX;
result.height = maxY - minY;
return result;
};
PolygonGeometryLibrary.createGeometryFromPositions = function(ellipsoid, polygon, textureCoordinates, granularity, perPositionHeight, vertexFormat, arcType) {
let indices = PolygonPipeline_default.triangulate(polygon.positions2D, polygon.holes);
if (indices.length < 3) {
indices = [0, 1, 2];
}
const positions = polygon.positions;
const hasTexcoords = defined_default(textureCoordinates);
const texcoords = hasTexcoords ? textureCoordinates.positions : void 0;
if (perPositionHeight) {
const length = positions.length;
const flattenedPositions = new Array(length * 3);
let index = 0;
for (let i = 0; i < length; i++) {
const p = positions[i];
flattenedPositions[index++] = p.x;
flattenedPositions[index++] = p.y;
flattenedPositions[index++] = p.z;
}
const geometryOptions = {
attributes: {
position: new GeometryAttribute_default({
componentDatatype: ComponentDatatype_default.DOUBLE,
componentsPerAttribute: 3,
values: flattenedPositions
})
},
indices,
primitiveType: PrimitiveType_default.TRIANGLES
};
if (hasTexcoords) {
geometryOptions.attributes.st = new GeometryAttribute_default({
componentDatatype: ComponentDatatype_default.FLOAT,
componentsPerAttribute: 2,
values: Cartesian2_default.packArray(texcoords)
});
}
const geometry = new Geometry_default(geometryOptions);
if (vertexFormat.normal) {
return GeometryPipeline_default.computeNormal(geometry);
}
return geometry;
}
if (arcType === ArcType_default.GEODESIC) {
return PolygonPipeline_default.computeSubdivision(
ellipsoid,
positions,
indices,
texcoords,
granularity
);
} else if (arcType === ArcType_default.RHUMB) {
return PolygonPipeline_default.computeRhumbLineSubdivision(
ellipsoid,
positions,
indices,
texcoords,
granularity
);
}
};
var computeWallTexcoordsSubdivided = [];
var computeWallIndicesSubdivided = [];
var p1Scratch = new Cartesian3_default();
var p2Scratch = new Cartesian3_default();
PolygonGeometryLibrary.computeWallGeometry = function(positions, textureCoordinates, ellipsoid, granularity, perPositionHeight, arcType) {
let edgePositions;
let topEdgeLength;
let i;
let p1;
let p2;
let t1;
let t2;
let edgeTexcoords;
let topEdgeTexcoordLength;
let length = positions.length;
let index = 0;
let textureIndex = 0;
const hasTexcoords = defined_default(textureCoordinates);
const texcoords = hasTexcoords ? textureCoordinates.positions : void 0;
if (!perPositionHeight) {
const minDistance = Math_default.chordLength(
granularity,
ellipsoid.maximumRadius
);
let numVertices = 0;
if (arcType === ArcType_default.GEODESIC) {
for (i = 0; i < length; i++) {
numVertices += PolygonGeometryLibrary.subdivideLineCount(
positions[i],
positions[(i + 1) % length],
minDistance
);
}
} else if (arcType === ArcType_default.RHUMB) {
for (i = 0; i < length; i++) {
numVertices += PolygonGeometryLibrary.subdivideRhumbLineCount(
ellipsoid,
positions[i],
positions[(i + 1) % length],
minDistance
);
}
}
topEdgeLength = (numVertices + length) * 3;
edgePositions = new Array(topEdgeLength * 2);
if (hasTexcoords) {
topEdgeTexcoordLength = (numVertices + length) * 2;
edgeTexcoords = new Array(topEdgeTexcoordLength * 2);
}
for (i = 0; i < length; i++) {
p1 = positions[i];
p2 = positions[(i + 1) % length];
let tempPositions;
let tempTexcoords;
if (hasTexcoords) {
t1 = texcoords[i];
t2 = texcoords[(i + 1) % length];
}
if (arcType === ArcType_default.GEODESIC) {
tempPositions = PolygonGeometryLibrary.subdivideLine(
p1,
p2,
minDistance,
computeWallIndicesSubdivided
);
if (hasTexcoords) {
tempTexcoords = PolygonGeometryLibrary.subdivideTexcoordLine(
t1,
t2,
p1,
p2,
minDistance,
computeWallTexcoordsSubdivided
);
}
} else if (arcType === ArcType_default.RHUMB) {
tempPositions = PolygonGeometryLibrary.subdivideRhumbLine(
ellipsoid,
p1,
p2,
minDistance,
computeWallIndicesSubdivided
);
if (hasTexcoords) {
tempTexcoords = PolygonGeometryLibrary.subdivideTexcoordRhumbLine(
t1,
t2,
ellipsoid,
p1,
p2,
minDistance,
computeWallTexcoordsSubdivided
);
}
}
const tempPositionsLength = tempPositions.length;
for (let j = 0; j < tempPositionsLength; ++j, ++index) {
edgePositions[index] = tempPositions[j];
edgePositions[index + topEdgeLength] = tempPositions[j];
}
edgePositions[index] = p2.x;
edgePositions[index + topEdgeLength] = p2.x;
++index;
edgePositions[index] = p2.y;
edgePositions[index + topEdgeLength] = p2.y;
++index;
edgePositions[index] = p2.z;
edgePositions[index + topEdgeLength] = p2.z;
++index;
if (hasTexcoords) {
const tempTexcoordsLength = tempTexcoords.length;
for (let k = 0; k < tempTexcoordsLength; ++k, ++textureIndex) {
edgeTexcoords[textureIndex] = tempTexcoords[k];
edgeTexcoords[textureIndex + topEdgeTexcoordLength] = tempTexcoords[k];
}
edgeTexcoords[textureIndex] = t2.x;
edgeTexcoords[textureIndex + topEdgeTexcoordLength] = t2.x;
++textureIndex;
edgeTexcoords[textureIndex] = t2.y;
edgeTexcoords[textureIndex + topEdgeTexcoordLength] = t2.y;
++textureIndex;
}
}
} else {
topEdgeLength = length * 3 * 2;
edgePositions = new Array(topEdgeLength * 2);
if (hasTexcoords) {
topEdgeTexcoordLength = length * 2 * 2;
edgeTexcoords = new Array(topEdgeTexcoordLength * 2);
}
for (i = 0; i < length; i++) {
p1 = positions[i];
p2 = positions[(i + 1) % length];
edgePositions[index] = edgePositions[index + topEdgeLength] = p1.x;
++index;
edgePositions[index] = edgePositions[index + topEdgeLength] = p1.y;
++index;
edgePositions[index] = edgePositions[index + topEdgeLength] = p1.z;
++index;
edgePositions[index] = edgePositions[index + topEdgeLength] = p2.x;
++index;
edgePositions[index] = edgePositions[index + topEdgeLength] = p2.y;
++index;
edgePositions[index] = edgePositions[index + topEdgeLength] = p2.z;
++index;
if (hasTexcoords) {
t1 = texcoords[i];
t2 = texcoords[(i + 1) % length];
edgeTexcoords[textureIndex] = edgeTexcoords[textureIndex + topEdgeTexcoordLength] = t1.x;
++textureIndex;
edgeTexcoords[textureIndex] = edgeTexcoords[textureIndex + topEdgeTexcoordLength] = t1.y;
++textureIndex;
edgeTexcoords[textureIndex] = edgeTexcoords[textureIndex + topEdgeTexcoordLength] = t2.x;
++textureIndex;
edgeTexcoords[textureIndex] = edgeTexcoords[textureIndex + topEdgeTexcoordLength] = t2.y;
++textureIndex;
}
}
}
length = edgePositions.length;
const indices = IndexDatatype_default.createTypedArray(
length / 3,
length - positions.length * 6
);
let edgeIndex = 0;
length /= 6;
for (i = 0; i < length; i++) {
const UL = i;
const UR = UL + 1;
const LL = UL + length;
const LR = LL + 1;
p1 = Cartesian3_default.fromArray(edgePositions, UL * 3, p1Scratch);
p2 = Cartesian3_default.fromArray(edgePositions, UR * 3, p2Scratch);
if (Cartesian3_default.equalsEpsilon(
p1,
p2,
Math_default.EPSILON10,
Math_default.EPSILON10
)) {
continue;
}
indices[edgeIndex++] = UL;
indices[edgeIndex++] = LL;
indices[edgeIndex++] = UR;
indices[edgeIndex++] = UR;
indices[edgeIndex++] = LL;
indices[edgeIndex++] = LR;
}
const geometryOptions = {
attributes: new GeometryAttributes_default({
position: new GeometryAttribute_default({
componentDatatype: ComponentDatatype_default.DOUBLE,
componentsPerAttribute: 3,
values: edgePositions
})
}),
indices,
primitiveType: PrimitiveType_default.TRIANGLES
};
if (hasTexcoords) {
geometryOptions.attributes.st = new GeometryAttribute_default({
componentDatatype: ComponentDatatype_default.FLOAT,
componentsPerAttribute: 2,
values: edgeTexcoords
});
}
const geometry = new Geometry_default(geometryOptions);
return geometry;
};
var PolygonGeometryLibrary_default = PolygonGeometryLibrary;
export {
PolygonGeometryLibrary_default
};
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.121.2
*
* Copyright 2011-2022 Cesium Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Columbus View (Pat. Pend.)
*
* Portions licensed separately.
* See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
*/
import {
defaultValue_default
} from "./chunk-U5HSOKPQ.js";
import {
DeveloperError_default
} from "./chunk-P6TRGU3S.js";
import {
defined_default
} from "./chunk-YCDZX5LS.js";
// packages/engine/Source/Core/VertexFormat.js
function VertexFormat(options) {
options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
this.position = defaultValue_default(options.position, false);
this.normal = defaultValue_default(options.normal, false);
this.st = defaultValue_default(options.st, false);
this.bitangent = defaultValue_default(options.bitangent, false);
this.tangent = defaultValue_default(options.tangent, false);
this.color = defaultValue_default(options.color, false);
}
VertexFormat.POSITION_ONLY = Object.freeze(
new VertexFormat({
position: true
})
);
VertexFormat.POSITION_AND_NORMAL = Object.freeze(
new VertexFormat({
position: true,
normal: true
})
);
VertexFormat.POSITION_NORMAL_AND_ST = Object.freeze(
new VertexFormat({
position: true,
normal: true,
st: true
})
);
VertexFormat.POSITION_AND_ST = Object.freeze(
new VertexFormat({
position: true,
st: true
})
);
VertexFormat.POSITION_AND_COLOR = Object.freeze(
new VertexFormat({
position: true,
color: true
})
);
VertexFormat.ALL = Object.freeze(
new VertexFormat({
position: true,
normal: true,
st: true,
tangent: true,
bitangent: true
})
);
VertexFormat.DEFAULT = VertexFormat.POSITION_NORMAL_AND_ST;
VertexFormat.packedLength = 6;
VertexFormat.pack = function(value, array, startingIndex) {
if (!defined_default(value)) {
throw new DeveloperError_default("value is required");
}
if (!defined_default(array)) {
throw new DeveloperError_default("array is required");
}
startingIndex = defaultValue_default(startingIndex, 0);
array[startingIndex++] = value.position ? 1 : 0;
array[startingIndex++] = value.normal ? 1 : 0;
array[startingIndex++] = value.st ? 1 : 0;
array[startingIndex++] = value.tangent ? 1 : 0;
array[startingIndex++] = value.bitangent ? 1 : 0;
array[startingIndex] = value.color ? 1 : 0;
return array;
};
VertexFormat.unpack = function(array, startingIndex, result) {
if (!defined_default(array)) {
throw new DeveloperError_default("array is required");
}
startingIndex = defaultValue_default(startingIndex, 0);
if (!defined_default(result)) {
result = new VertexFormat();
}
result.position = array[startingIndex++] === 1;
result.normal = array[startingIndex++] === 1;
result.st = array[startingIndex++] === 1;
result.tangent = array[startingIndex++] === 1;
result.bitangent = array[startingIndex++] === 1;
result.color = array[startingIndex] === 1;
return result;
};
VertexFormat.clone = function(vertexFormat, result) {
if (!defined_default(vertexFormat)) {
return void 0;
}
if (!defined_default(result)) {
result = new VertexFormat();
}
result.position = vertexFormat.position;
result.normal = vertexFormat.normal;
result.st = vertexFormat.st;
result.tangent = vertexFormat.tangent;
result.bitangent = vertexFormat.bitangent;
result.color = vertexFormat.color;
return result;
};
var VertexFormat_default = VertexFormat;
export {
VertexFormat_default
};
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.121.2
*
* Copyright 2011-2022 Cesium Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Columbus View (Pat. Pend.)
*
* Portions licensed separately.
* See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
*/
import {
Quaternion_default
} from "./chunk-6SQMLVGV.js";
import {
Cartesian3_default,
Matrix3_default
} from "./chunk-FFLMY4TE.js";
import {
Math_default
} from "./chunk-WGDFYAGC.js";
// packages/engine/Source/Core/EllipseGeometryLibrary.js
var EllipseGeometryLibrary = {};
var rotAxis = new Cartesian3_default();
var tempVec = new Cartesian3_default();
var unitQuat = new Quaternion_default();
var rotMtx = new Matrix3_default();
function pointOnEllipsoid(theta, rotation, northVec, eastVec, aSqr, ab, bSqr, mag, unitPos, result) {
const azimuth = theta + rotation;
Cartesian3_default.multiplyByScalar(eastVec, Math.cos(azimuth), rotAxis);
Cartesian3_default.multiplyByScalar(northVec, Math.sin(azimuth), tempVec);
Cartesian3_default.add(rotAxis, tempVec, rotAxis);
let cosThetaSquared = Math.cos(theta);
cosThetaSquared = cosThetaSquared * cosThetaSquared;
let sinThetaSquared = Math.sin(theta);
sinThetaSquared = sinThetaSquared * sinThetaSquared;
const radius = ab / Math.sqrt(bSqr * cosThetaSquared + aSqr * sinThetaSquared);
const angle = radius / mag;
Quaternion_default.fromAxisAngle(rotAxis, angle, unitQuat);
Matrix3_default.fromQuaternion(unitQuat, rotMtx);
Matrix3_default.multiplyByVector(rotMtx, unitPos, result);
Cartesian3_default.normalize(result, result);
Cartesian3_default.multiplyByScalar(result, mag, result);
return result;
}
var scratchCartesian1 = new Cartesian3_default();
var scratchCartesian2 = new Cartesian3_default();
var scratchCartesian3 = new Cartesian3_default();
var scratchNormal = new Cartesian3_default();
EllipseGeometryLibrary.raisePositionsToHeight = function(positions, options, extrude) {
const ellipsoid = options.ellipsoid;
const height = options.height;
const extrudedHeight = options.extrudedHeight;
const size = extrude ? positions.length / 3 * 2 : positions.length / 3;
const finalPositions = new Float64Array(size * 3);
const length = positions.length;
const bottomOffset = extrude ? length : 0;
for (let i = 0; i < length; i += 3) {
const i1 = i + 1;
const i2 = i + 2;
const position = Cartesian3_default.fromArray(positions, i, scratchCartesian1);
ellipsoid.scaleToGeodeticSurface(position, position);
const extrudedPosition = Cartesian3_default.clone(position, scratchCartesian2);
const normal = ellipsoid.geodeticSurfaceNormal(position, scratchNormal);
const scaledNormal = Cartesian3_default.multiplyByScalar(
normal,
height,
scratchCartesian3
);
Cartesian3_default.add(position, scaledNormal, position);
if (extrude) {
Cartesian3_default.multiplyByScalar(normal, extrudedHeight, scaledNormal);
Cartesian3_default.add(extrudedPosition, scaledNormal, extrudedPosition);
finalPositions[i + bottomOffset] = extrudedPosition.x;
finalPositions[i1 + bottomOffset] = extrudedPosition.y;
finalPositions[i2 + bottomOffset] = extrudedPosition.z;
}
finalPositions[i] = position.x;
finalPositions[i1] = position.y;
finalPositions[i2] = position.z;
}
return finalPositions;
};
var unitPosScratch = new Cartesian3_default();
var eastVecScratch = new Cartesian3_default();
var northVecScratch = new Cartesian3_default();
EllipseGeometryLibrary.computeEllipsePositions = function(options, addFillPositions, addEdgePositions) {
const semiMinorAxis = options.semiMinorAxis;
const semiMajorAxis = options.semiMajorAxis;
const rotation = options.rotation;
const center = options.center;
const granularity = options.granularity * 8;
const aSqr = semiMinorAxis * semiMinorAxis;
const bSqr = semiMajorAxis * semiMajorAxis;
const ab = semiMajorAxis * semiMinorAxis;
const mag = Cartesian3_default.magnitude(center);
const unitPos = Cartesian3_default.normalize(center, unitPosScratch);
let eastVec = Cartesian3_default.cross(Cartesian3_default.UNIT_Z, center, eastVecScratch);
eastVec = Cartesian3_default.normalize(eastVec, eastVec);
const northVec = Cartesian3_default.cross(unitPos, eastVec, northVecScratch);
let numPts = 1 + Math.ceil(Math_default.PI_OVER_TWO / granularity);
const deltaTheta = Math_default.PI_OVER_TWO / (numPts - 1);
let theta = Math_default.PI_OVER_TWO - numPts * deltaTheta;
if (theta < 0) {
numPts -= Math.ceil(Math.abs(theta) / deltaTheta);
}
const size = 2 * (numPts * (numPts + 2));
const positions = addFillPositions ? new Array(size * 3) : void 0;
let positionIndex = 0;
let position = scratchCartesian1;
let reflectedPosition = scratchCartesian2;
const outerPositionsLength = numPts * 4 * 3;
let outerRightIndex = outerPositionsLength - 1;
let outerLeftIndex = 0;
const outerPositions = addEdgePositions ? new Array(outerPositionsLength) : void 0;
let i;
let j;
let numInterior;
let t;
let interiorPosition;
theta = Math_default.PI_OVER_TWO;
position = pointOnEllipsoid(
theta,
rotation,
northVec,
eastVec,
aSqr,
ab,
bSqr,
mag,
unitPos,
position
);
if (addFillPositions) {
positions[positionIndex++] = position.x;
positions[positionIndex++] = position.y;
positions[positionIndex++] = position.z;
}
if (addEdgePositions) {
outerPositions[outerRightIndex--] = position.z;
outerPositions[outerRightIndex--] = position.y;
outerPositions[outerRightIndex--] = position.x;
}
theta = Math_default.PI_OVER_TWO - deltaTheta;
for (i = 1; i < numPts + 1; ++i) {
position = pointOnEllipsoid(
theta,
rotation,
northVec,
eastVec,
aSqr,
ab,
bSqr,
mag,
unitPos,
position
);
reflectedPosition = pointOnEllipsoid(
Math.PI - theta,
rotation,
northVec,
eastVec,
aSqr,
ab,
bSqr,
mag,
unitPos,
reflectedPosition
);
if (addFillPositions) {
positions[positionIndex++] = position.x;
positions[positionIndex++] = position.y;
positions[positionIndex++] = position.z;
numInterior = 2 * i + 2;
for (j = 1; j < numInterior - 1; ++j) {
t = j / (numInterior - 1);
interiorPosition = Cartesian3_default.lerp(
position,
reflectedPosition,
t,
scratchCartesian3
);
positions[positionIndex++] = interiorPosition.x;
positions[positionIndex++] = interiorPosition.y;
positions[positionIndex++] = interiorPosition.z;
}
positions[positionIndex++] = reflectedPosition.x;
positions[positionIndex++] = reflectedPosition.y;
positions[positionIndex++] = reflectedPosition.z;
}
if (addEdgePositions) {
outerPositions[outerRightIndex--] = position.z;
outerPositions[outerRightIndex--] = position.y;
outerPositions[outerRightIndex--] = position.x;
outerPositions[outerLeftIndex++] = reflectedPosition.x;
outerPositions[outerLeftIndex++] = reflectedPosition.y;
outerPositions[outerLeftIndex++] = reflectedPosition.z;
}
theta = Math_default.PI_OVER_TWO - (i + 1) * deltaTheta;
}
for (i = numPts; i > 1; --i) {
theta = Math_default.PI_OVER_TWO - (i - 1) * deltaTheta;
position = pointOnEllipsoid(
-theta,
rotation,
northVec,
eastVec,
aSqr,
ab,
bSqr,
mag,
unitPos,
position
);
reflectedPosition = pointOnEllipsoid(
theta + Math.PI,
rotation,
northVec,
eastVec,
aSqr,
ab,
bSqr,
mag,
unitPos,
reflectedPosition
);
if (addFillPositions) {
positions[positionIndex++] = position.x;
positions[positionIndex++] = position.y;
positions[positionIndex++] = position.z;
numInterior = 2 * (i - 1) + 2;
for (j = 1; j < numInterior - 1; ++j) {
t = j / (numInterior - 1);
interiorPosition = Cartesian3_default.lerp(
position,
reflectedPosition,
t,
scratchCartesian3
);
positions[positionIndex++] = interiorPosition.x;
positions[positionIndex++] = interiorPosition.y;
positions[positionIndex++] = interiorPosition.z;
}
positions[positionIndex++] = reflectedPosition.x;
positions[positionIndex++] = reflectedPosition.y;
positions[positionIndex++] = reflectedPosition.z;
}
if (addEdgePositions) {
outerPositions[outerRightIndex--] = position.z;
outerPositions[outerRightIndex--] = position.y;
outerPositions[outerRightIndex--] = position.x;
outerPositions[outerLeftIndex++] = reflectedPosition.x;
outerPositions[outerLeftIndex++] = reflectedPosition.y;
outerPositions[outerLeftIndex++] = reflectedPosition.z;
}
}
theta = Math_default.PI_OVER_TWO;
position = pointOnEllipsoid(
-theta,
rotation,
northVec,
eastVec,
aSqr,
ab,
bSqr,
mag,
unitPos,
position
);
const r = {};
if (addFillPositions) {
positions[positionIndex++] = position.x;
positions[positionIndex++] = position.y;
positions[positionIndex++] = position.z;
r.positions = positions;
r.numPts = numPts;
}
if (addEdgePositions) {
outerPositions[outerRightIndex--] = position.z;
outerPositions[outerRightIndex--] = position.y;
outerPositions[outerRightIndex--] = position.x;
r.outerPositions = outerPositions;
}
return r;
};
var EllipseGeometryLibrary_default = EllipseGeometryLibrary;
export {
EllipseGeometryLibrary_default
};
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.121.2
*
* Copyright 2011-2022 Cesium Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Columbus View (Pat. Pend.)
*
* Portions licensed separately.
* See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
*/
import {
Cartesian3_default,
Cartographic_default,
Ellipsoid_default
} from "./chunk-FFLMY4TE.js";
import {
Math_default
} from "./chunk-WGDFYAGC.js";
import {
defaultValue_default
} from "./chunk-U5HSOKPQ.js";
import {
Check_default,
DeveloperError_default
} from "./chunk-P6TRGU3S.js";
import {
defined_default
} from "./chunk-YCDZX5LS.js";
// packages/engine/Source/Core/EllipsoidRhumbLine.js
function calculateM(ellipticity, major, latitude) {
if (ellipticity === 0) {
return major * latitude;
}
const e2 = ellipticity * ellipticity;
const e4 = e2 * e2;
const e6 = e4 * e2;
const e8 = e6 * e2;
const e10 = e8 * e2;
const e12 = e10 * e2;
const phi = latitude;
const sin2Phi = Math.sin(2 * phi);
const sin4Phi = Math.sin(4 * phi);
const sin6Phi = Math.sin(6 * phi);
const sin8Phi = Math.sin(8 * phi);
const sin10Phi = Math.sin(10 * phi);
const sin12Phi = Math.sin(12 * phi);
return major * ((1 - e2 / 4 - 3 * e4 / 64 - 5 * e6 / 256 - 175 * e8 / 16384 - 441 * e10 / 65536 - 4851 * e12 / 1048576) * phi - (3 * e2 / 8 + 3 * e4 / 32 + 45 * e6 / 1024 + 105 * e8 / 4096 + 2205 * e10 / 131072 + 6237 * e12 / 524288) * sin2Phi + (15 * e4 / 256 + 45 * e6 / 1024 + 525 * e8 / 16384 + 1575 * e10 / 65536 + 155925 * e12 / 8388608) * sin4Phi - (35 * e6 / 3072 + 175 * e8 / 12288 + 3675 * e10 / 262144 + 13475 * e12 / 1048576) * sin6Phi + (315 * e8 / 131072 + 2205 * e10 / 524288 + 43659 * e12 / 8388608) * sin8Phi - (693 * e10 / 1310720 + 6237 * e12 / 5242880) * sin10Phi + 1001 * e12 / 8388608 * sin12Phi);
}
function calculateInverseM(M, ellipticity, major) {
const d = M / major;
if (ellipticity === 0) {
return d;
}
const d2 = d * d;
const d3 = d2 * d;
const d4 = d3 * d;
const e = ellipticity;
const e2 = e * e;
const e4 = e2 * e2;
const e6 = e4 * e2;
const e8 = e6 * e2;
const e10 = e8 * e2;
const e12 = e10 * e2;
const sin2D = Math.sin(2 * d);
const cos2D = Math.cos(2 * d);
const sin4D = Math.sin(4 * d);
const cos4D = Math.cos(4 * d);
const sin6D = Math.sin(6 * d);
const cos6D = Math.cos(6 * d);
const sin8D = Math.sin(8 * d);
const cos8D = Math.cos(8 * d);
const sin10D = Math.sin(10 * d);
const cos10D = Math.cos(10 * d);
const sin12D = Math.sin(12 * d);
return d + d * e2 / 4 + 7 * d * e4 / 64 + 15 * d * e6 / 256 + 579 * d * e8 / 16384 + 1515 * d * e10 / 65536 + 16837 * d * e12 / 1048576 + (3 * d * e4 / 16 + 45 * d * e6 / 256 - d * (32 * d2 - 561) * e8 / 4096 - d * (232 * d2 - 1677) * e10 / 16384 + d * (399985 - 90560 * d2 + 512 * d4) * e12 / 5242880) * cos2D + (21 * d * e6 / 256 + 483 * d * e8 / 4096 - d * (224 * d2 - 1969) * e10 / 16384 - d * (33152 * d2 - 112599) * e12 / 1048576) * cos4D + (151 * d * e8 / 4096 + 4681 * d * e10 / 65536 + 1479 * d * e12 / 16384 - 453 * d3 * e12 / 32768) * cos6D + (1097 * d * e10 / 65536 + 42783 * d * e12 / 1048576) * cos8D + 8011 * d * e12 / 1048576 * cos10D + (3 * e2 / 8 + 3 * e4 / 16 + 213 * e6 / 2048 - 3 * d2 * e6 / 64 + 255 * e8 / 4096 - 33 * d2 * e8 / 512 + 20861 * e10 / 524288 - 33 * d2 * e10 / 512 + d4 * e10 / 1024 + 28273 * e12 / 1048576 - 471 * d2 * e12 / 8192 + 9 * d4 * e12 / 4096) * sin2D + (21 * e4 / 256 + 21 * e6 / 256 + 533 * e8 / 8192 - 21 * d2 * e8 / 512 + 197 * e10 / 4096 - 315 * d2 * e10 / 4096 + 584039 * e12 / 16777216 - 12517 * d2 * e12 / 131072 + 7 * d4 * e12 / 2048) * sin4D + (151 * e6 / 6144 + 151 * e8 / 4096 + 5019 * e10 / 131072 - 453 * d2 * e10 / 16384 + 26965 * e12 / 786432 - 8607 * d2 * e12 / 131072) * sin6D + (1097 * e8 / 131072 + 1097 * e10 / 65536 + 225797 * e12 / 10485760 - 1097 * d2 * e12 / 65536) * sin8D + (8011 * e10 / 2621440 + 8011 * e12 / 1048576) * sin10D + 293393 * e12 / 251658240 * sin12D;
}
function calculateSigma(ellipticity, latitude) {
if (ellipticity === 0) {
return Math.log(Math.tan(0.5 * (Math_default.PI_OVER_TWO + latitude)));
}
const eSinL = ellipticity * Math.sin(latitude);
return Math.log(Math.tan(0.5 * (Math_default.PI_OVER_TWO + latitude))) - ellipticity / 2 * Math.log((1 + eSinL) / (1 - eSinL));
}
function calculateHeading(ellipsoidRhumbLine, firstLongitude, firstLatitude, secondLongitude, secondLatitude) {
const sigma1 = calculateSigma(ellipsoidRhumbLine._ellipticity, firstLatitude);
const sigma2 = calculateSigma(
ellipsoidRhumbLine._ellipticity,
secondLatitude
);
return Math.atan2(
Math_default.negativePiToPi(secondLongitude - firstLongitude),
sigma2 - sigma1
);
}
function calculateArcLength(ellipsoidRhumbLine, major, minor, firstLongitude, firstLatitude, secondLongitude, secondLatitude) {
const heading = ellipsoidRhumbLine._heading;
const deltaLongitude = secondLongitude - firstLongitude;
let distance = 0;
if (Math_default.equalsEpsilon(
Math.abs(heading),
Math_default.PI_OVER_TWO,
Math_default.EPSILON8
)) {
if (major === minor) {
distance = major * Math.cos(firstLatitude) * Math_default.negativePiToPi(deltaLongitude);
} else {
const sinPhi = Math.sin(firstLatitude);
distance = major * Math.cos(firstLatitude) * Math_default.negativePiToPi(deltaLongitude) / Math.sqrt(1 - ellipsoidRhumbLine._ellipticitySquared * sinPhi * sinPhi);
}
} else {
const M1 = calculateM(
ellipsoidRhumbLine._ellipticity,
major,
firstLatitude
);
const M2 = calculateM(
ellipsoidRhumbLine._ellipticity,
major,
secondLatitude
);
distance = (M2 - M1) / Math.cos(heading);
}
return Math.abs(distance);
}
var scratchCart1 = new Cartesian3_default();
var scratchCart2 = new Cartesian3_default();
function computeProperties(ellipsoidRhumbLine, start, end, ellipsoid) {
const firstCartesian = Cartesian3_default.normalize(
ellipsoid.cartographicToCartesian(start, scratchCart2),
scratchCart1
);
const lastCartesian = Cartesian3_default.normalize(
ellipsoid.cartographicToCartesian(end, scratchCart2),
scratchCart2
);
Check_default.typeOf.number.greaterThanOrEquals(
"value",
Math.abs(
Math.abs(Cartesian3_default.angleBetween(firstCartesian, lastCartesian)) - Math.PI
),
0.0125
);
const major = ellipsoid.maximumRadius;
const minor = ellipsoid.minimumRadius;
const majorSquared = major * major;
const minorSquared = minor * minor;
ellipsoidRhumbLine._ellipticitySquared = (majorSquared - minorSquared) / majorSquared;
ellipsoidRhumbLine._ellipticity = Math.sqrt(
ellipsoidRhumbLine._ellipticitySquared
);
ellipsoidRhumbLine._start = Cartographic_default.clone(
start,
ellipsoidRhumbLine._start
);
ellipsoidRhumbLine._start.height = 0;
ellipsoidRhumbLine._end = Cartographic_default.clone(end, ellipsoidRhumbLine._end);
ellipsoidRhumbLine._end.height = 0;
ellipsoidRhumbLine._heading = calculateHeading(
ellipsoidRhumbLine,
start.longitude,
start.latitude,
end.longitude,
end.latitude
);
ellipsoidRhumbLine._distance = calculateArcLength(
ellipsoidRhumbLine,
ellipsoid.maximumRadius,
ellipsoid.minimumRadius,
start.longitude,
start.latitude,
end.longitude,
end.latitude
);
}
function interpolateUsingSurfaceDistance(start, heading, distance, major, ellipticity, result) {
if (distance === 0) {
return Cartographic_default.clone(start, result);
}
const ellipticitySquared = ellipticity * ellipticity;
let longitude;
let latitude;
let deltaLongitude;
if (Math.abs(Math_default.PI_OVER_TWO - Math.abs(heading)) > Math_default.EPSILON8) {
const M1 = calculateM(ellipticity, major, start.latitude);
const deltaM = distance * Math.cos(heading);
const M2 = M1 + deltaM;
latitude = calculateInverseM(M2, ellipticity, major);
if (Math.abs(heading) < Math_default.EPSILON10) {
longitude = Math_default.negativePiToPi(start.longitude);
} else {
const sigma1 = calculateSigma(ellipticity, start.latitude);
const sigma2 = calculateSigma(ellipticity, latitude);
deltaLongitude = Math.tan(heading) * (sigma2 - sigma1);
longitude = Math_default.negativePiToPi(start.longitude + deltaLongitude);
}
} else {
latitude = start.latitude;
let localRad;
if (ellipticity === 0) {
localRad = major * Math.cos(start.latitude);
} else {
const sinPhi = Math.sin(start.latitude);
localRad = major * Math.cos(start.latitude) / Math.sqrt(1 - ellipticitySquared * sinPhi * sinPhi);
}
deltaLongitude = distance / localRad;
if (heading > 0) {
longitude = Math_default.negativePiToPi(start.longitude + deltaLongitude);
} else {
longitude = Math_default.negativePiToPi(start.longitude - deltaLongitude);
}
}
if (defined_default(result)) {
result.longitude = longitude;
result.latitude = latitude;
result.height = 0;
return result;
}
return new Cartographic_default(longitude, latitude, 0);
}
function EllipsoidRhumbLine(start, end, ellipsoid) {
const e = defaultValue_default(ellipsoid, Ellipsoid_default.default);
this._ellipsoid = e;
this._start = new Cartographic_default();
this._end = new Cartographic_default();
this._heading = void 0;
this._distance = void 0;
this._ellipticity = void 0;
this._ellipticitySquared = void 0;
if (defined_default(start) && defined_default(end)) {
computeProperties(this, start, end, e);
}
}
Object.defineProperties(EllipsoidRhumbLine.prototype, {
/**
* Gets the ellipsoid.
* @memberof EllipsoidRhumbLine.prototype
* @type {Ellipsoid}
* @readonly
*/
ellipsoid: {
get: function() {
return this._ellipsoid;
}
},
/**
* Gets the surface distance between the start and end point
* @memberof EllipsoidRhumbLine.prototype
* @type {number}
* @readonly
*/
surfaceDistance: {
get: function() {
Check_default.defined("distance", this._distance);
return this._distance;
}
},
/**
* Gets the initial planetodetic point on the path.
* @memberof EllipsoidRhumbLine.prototype
* @type {Cartographic}
* @readonly
*/
start: {
get: function() {
return this._start;
}
},
/**
* Gets the final planetodetic point on the path.
* @memberof EllipsoidRhumbLine.prototype
* @type {Cartographic}
* @readonly
*/
end: {
get: function() {
return this._end;
}
},
/**
* Gets the heading from the start point to the end point.
* @memberof EllipsoidRhumbLine.prototype
* @type {number}
* @readonly
*/
heading: {
get: function() {
Check_default.defined("distance", this._distance);
return this._heading;
}
}
});
EllipsoidRhumbLine.fromStartHeadingDistance = function(start, heading, distance, ellipsoid, result) {
Check_default.defined("start", start);
Check_default.defined("heading", heading);
Check_default.defined("distance", distance);
Check_default.typeOf.number.greaterThan("distance", distance, 0);
const e = defaultValue_default(ellipsoid, Ellipsoid_default.default);
const major = e.maximumRadius;
const minor = e.minimumRadius;
const majorSquared = major * major;
const minorSquared = minor * minor;
const ellipticity = Math.sqrt((majorSquared - minorSquared) / majorSquared);
heading = Math_default.negativePiToPi(heading);
const end = interpolateUsingSurfaceDistance(
start,
heading,
distance,
e.maximumRadius,
ellipticity
);
if (!defined_default(result) || defined_default(ellipsoid) && !ellipsoid.equals(result.ellipsoid)) {
return new EllipsoidRhumbLine(start, end, e);
}
result.setEndPoints(start, end);
return result;
};
EllipsoidRhumbLine.prototype.setEndPoints = function(start, end) {
Check_default.defined("start", start);
Check_default.defined("end", end);
computeProperties(this, start, end, this._ellipsoid);
};
EllipsoidRhumbLine.prototype.interpolateUsingFraction = function(fraction, result) {
return this.interpolateUsingSurfaceDistance(
fraction * this._distance,
result
);
};
EllipsoidRhumbLine.prototype.interpolateUsingSurfaceDistance = function(distance, result) {
Check_default.typeOf.number("distance", distance);
if (!defined_default(this._distance) || this._distance === 0) {
throw new DeveloperError_default(
"EllipsoidRhumbLine must have distinct start and end set."
);
}
return interpolateUsingSurfaceDistance(
this._start,
this._heading,
distance,
this._ellipsoid.maximumRadius,
this._ellipticity,
result
);
};
EllipsoidRhumbLine.prototype.findIntersectionWithLongitude = function(intersectionLongitude, result) {
Check_default.typeOf.number("intersectionLongitude", intersectionLongitude);
if (!defined_default(this._distance) || this._distance === 0) {
throw new DeveloperError_default(
"EllipsoidRhumbLine must have distinct start and end set."
);
}
const ellipticity = this._ellipticity;
const heading = this._heading;
const absHeading = Math.abs(heading);
const start = this._start;
intersectionLongitude = Math_default.negativePiToPi(intersectionLongitude);
if (Math_default.equalsEpsilon(
Math.abs(intersectionLongitude),
Math.PI,
Math_default.EPSILON14
)) {
intersectionLongitude = Math_default.sign(start.longitude) * Math.PI;
}
if (!defined_default(result)) {
result = new Cartographic_default();
}
if (Math.abs(Math_default.PI_OVER_TWO - absHeading) <= Math_default.EPSILON8) {
result.longitude = intersectionLongitude;
result.latitude = start.latitude;
result.height = 0;
return result;
} else if (Math_default.equalsEpsilon(
Math.abs(Math_default.PI_OVER_TWO - absHeading),
Math_default.PI_OVER_TWO,
Math_default.EPSILON8
)) {
if (Math_default.equalsEpsilon(
intersectionLongitude,
start.longitude,
Math_default.EPSILON12
)) {
return void 0;
}
result.longitude = intersectionLongitude;
result.latitude = Math_default.PI_OVER_TWO * Math_default.sign(Math_default.PI_OVER_TWO - heading);
result.height = 0;
return result;
}
const phi1 = start.latitude;
const eSinPhi1 = ellipticity * Math.sin(phi1);
const leftComponent = Math.tan(0.5 * (Math_default.PI_OVER_TWO + phi1)) * Math.exp((intersectionLongitude - start.longitude) / Math.tan(heading));
const denominator = (1 + eSinPhi1) / (1 - eSinPhi1);
let newPhi = start.latitude;
let phi;
do {
phi = newPhi;
const eSinPhi = ellipticity * Math.sin(phi);
const numerator = (1 + eSinPhi) / (1 - eSinPhi);
newPhi = 2 * Math.atan(
leftComponent * Math.pow(numerator / denominator, ellipticity / 2)
) - Math_default.PI_OVER_TWO;
} while (!Math_default.equalsEpsilon(newPhi, phi, Math_default.EPSILON12));
result.longitude = intersectionLongitude;
result.latitude = newPhi;
result.height = 0;
return result;
};
EllipsoidRhumbLine.prototype.findIntersectionWithLatitude = function(intersectionLatitude, result) {
Check_default.typeOf.number("intersectionLatitude", intersectionLatitude);
if (!defined_default(this._distance) || this._distance === 0) {
throw new DeveloperError_default(
"EllipsoidRhumbLine must have distinct start and end set."
);
}
const ellipticity = this._ellipticity;
const heading = this._heading;
const start = this._start;
if (Math_default.equalsEpsilon(
Math.abs(heading),
Math_default.PI_OVER_TWO,
Math_default.EPSILON8
)) {
return;
}
const sigma1 = calculateSigma(ellipticity, start.latitude);
const sigma2 = calculateSigma(ellipticity, intersectionLatitude);
const deltaLongitude = Math.tan(heading) * (sigma2 - sigma1);
const longitude = Math_default.negativePiToPi(start.longitude + deltaLongitude);
if (defined_default(result)) {
result.longitude = longitude;
result.latitude = intersectionLatitude;
result.height = 0;
return result;
}
return new Cartographic_default(longitude, intersectionLatitude, 0);
};
var EllipsoidRhumbLine_default = EllipsoidRhumbLine;
export {
EllipsoidRhumbLine_default
};
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.121.2
*
* Copyright 2011-2022 Cesium Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Columbus View (Pat. Pend.)
*
* Portions licensed separately.
* See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
*/
import {
Matrix2_default,
Matrix4_default,
Quaternion_default,
Rectangle_default,
Transforms_default
} from "./chunk-6SQMLVGV.js";
import {
Cartesian2_default,
Cartesian3_default,
Cartographic_default,
Matrix3_default
} from "./chunk-FFLMY4TE.js";
import {
WebGLConstants_default
} from "./chunk-3HQMMUPU.js";
import {
defaultValue_default
} from "./chunk-U5HSOKPQ.js";
import {
Check_default,
DeveloperError_default
} from "./chunk-P6TRGU3S.js";
import {
defined_default
} from "./chunk-YCDZX5LS.js";
// packages/engine/Source/Core/GeometryType.js
var GeometryType = {
NONE: 0,
TRIANGLES: 1,
LINES: 2,
POLYLINES: 3
};
var GeometryType_default = Object.freeze(GeometryType);
// packages/engine/Source/Core/PrimitiveType.js
var PrimitiveType = {
/**
* Points primitive where each vertex (or index) is a separate point.
*
* @type {number}
* @constant
*/
POINTS: WebGLConstants_default.POINTS,
/**
* Lines primitive where each two vertices (or indices) is a line segment. Line segments are not necessarily connected.
*
* @type {number}
* @constant
*/
LINES: WebGLConstants_default.LINES,
/**
* Line loop primitive where each vertex (or index) after the first connects a line to
* the previous vertex, and the last vertex implicitly connects to the first.
*
* @type {number}
* @constant
*/
LINE_LOOP: WebGLConstants_default.LINE_LOOP,
/**
* Line strip primitive where each vertex (or index) after the first connects a line to the previous vertex.
*
* @type {number}
* @constant
*/
LINE_STRIP: WebGLConstants_default.LINE_STRIP,
/**
* Triangles primitive where each three vertices (or indices) is a triangle. Triangles do not necessarily share edges.
*
* @type {number}
* @constant
*/
TRIANGLES: WebGLConstants_default.TRIANGLES,
/**
* Triangle strip primitive where each vertex (or index) after the first two connect to
* the previous two vertices forming a triangle. For example, this can be used to model a wall.
*
* @type {number}
* @constant
*/
TRIANGLE_STRIP: WebGLConstants_default.TRIANGLE_STRIP,
/**
* Triangle fan primitive where each vertex (or index) after the first two connect to
* the previous vertex and the first vertex forming a triangle. For example, this can be used
* to model a cone or circle.
*
* @type {number}
* @constant
*/
TRIANGLE_FAN: WebGLConstants_default.TRIANGLE_FAN
};
PrimitiveType.isLines = function(primitiveType) {
return primitiveType === PrimitiveType.LINES || primitiveType === PrimitiveType.LINE_LOOP || primitiveType === PrimitiveType.LINE_STRIP;
};
PrimitiveType.isTriangles = function(primitiveType) {
return primitiveType === PrimitiveType.TRIANGLES || primitiveType === PrimitiveType.TRIANGLE_STRIP || primitiveType === PrimitiveType.TRIANGLE_FAN;
};
PrimitiveType.validate = function(primitiveType) {
return primitiveType === PrimitiveType.POINTS || primitiveType === PrimitiveType.LINES || primitiveType === PrimitiveType.LINE_LOOP || primitiveType === PrimitiveType.LINE_STRIP || primitiveType === PrimitiveType.TRIANGLES || primitiveType === PrimitiveType.TRIANGLE_STRIP || primitiveType === PrimitiveType.TRIANGLE_FAN;
};
var PrimitiveType_default = Object.freeze(PrimitiveType);
// packages/engine/Source/Core/Geometry.js
function Geometry(options) {
options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
Check_default.typeOf.object("options.attributes", options.attributes);
this.attributes = options.attributes;
this.indices = options.indices;
this.primitiveType = defaultValue_default(
options.primitiveType,
PrimitiveType_default.TRIANGLES
);
this.boundingSphere = options.boundingSphere;
this.geometryType = defaultValue_default(options.geometryType, GeometryType_default.NONE);
this.boundingSphereCV = options.boundingSphereCV;
this.offsetAttribute = options.offsetAttribute;
}
Geometry.computeNumberOfVertices = function(geometry) {
Check_default.typeOf.object("geometry", geometry);
let numberOfVertices = -1;
for (const property in geometry.attributes) {
if (geometry.attributes.hasOwnProperty(property) && defined_default(geometry.attributes[property]) && defined_default(geometry.attributes[property].values)) {
const attribute = geometry.attributes[property];
const num = attribute.values.length / attribute.componentsPerAttribute;
if (numberOfVertices !== num && numberOfVertices !== -1) {
throw new DeveloperError_default(
"All attribute lists must have the same number of attributes."
);
}
numberOfVertices = num;
}
}
return numberOfVertices;
};
var rectangleCenterScratch = new Cartographic_default();
var enuCenterScratch = new Cartesian3_default();
var fixedFrameToEnuScratch = new Matrix4_default();
var boundingRectanglePointsCartographicScratch = [
new Cartographic_default(),
new Cartographic_default(),
new Cartographic_default()
];
var boundingRectanglePointsEnuScratch = [
new Cartesian2_default(),
new Cartesian2_default(),
new Cartesian2_default()
];
var points2DScratch = [new Cartesian2_default(), new Cartesian2_default(), new Cartesian2_default()];
var pointEnuScratch = new Cartesian3_default();
var enuRotationScratch = new Quaternion_default();
var enuRotationMatrixScratch = new Matrix4_default();
var rotation2DScratch = new Matrix2_default();
Geometry._textureCoordinateRotationPoints = function(positions, stRotation, ellipsoid, boundingRectangle) {
let i;
const rectangleCenter = Rectangle_default.center(
boundingRectangle,
rectangleCenterScratch
);
const enuCenter = Cartographic_default.toCartesian(
rectangleCenter,
ellipsoid,
enuCenterScratch
);
const enuToFixedFrame = Transforms_default.eastNorthUpToFixedFrame(
enuCenter,
ellipsoid,
fixedFrameToEnuScratch
);
const fixedFrameToEnu = Matrix4_default.inverse(
enuToFixedFrame,
fixedFrameToEnuScratch
);
const boundingPointsEnu = boundingRectanglePointsEnuScratch;
const boundingPointsCarto = boundingRectanglePointsCartographicScratch;
boundingPointsCarto[0].longitude = boundingRectangle.west;
boundingPointsCarto[0].latitude = boundingRectangle.south;
boundingPointsCarto[1].longitude = boundingRectangle.west;
boundingPointsCarto[1].latitude = boundingRectangle.north;
boundingPointsCarto[2].longitude = boundingRectangle.east;
boundingPointsCarto[2].latitude = boundingRectangle.south;
let posEnu = pointEnuScratch;
for (i = 0; i < 3; i++) {
Cartographic_default.toCartesian(boundingPointsCarto[i], ellipsoid, posEnu);
posEnu = Matrix4_default.multiplyByPointAsVector(fixedFrameToEnu, posEnu, posEnu);
boundingPointsEnu[i].x = posEnu.x;
boundingPointsEnu[i].y = posEnu.y;
}
const rotation = Quaternion_default.fromAxisAngle(
Cartesian3_default.UNIT_Z,
-stRotation,
enuRotationScratch
);
const textureMatrix = Matrix3_default.fromQuaternion(
rotation,
enuRotationMatrixScratch
);
const positionsLength = positions.length;
let enuMinX = Number.POSITIVE_INFINITY;
let enuMinY = Number.POSITIVE_INFINITY;
let enuMaxX = Number.NEGATIVE_INFINITY;
let enuMaxY = Number.NEGATIVE_INFINITY;
for (i = 0; i < positionsLength; i++) {
posEnu = Matrix4_default.multiplyByPointAsVector(
fixedFrameToEnu,
positions[i],
posEnu
);
posEnu = Matrix3_default.multiplyByVector(textureMatrix, posEnu, posEnu);
enuMinX = Math.min(enuMinX, posEnu.x);
enuMinY = Math.min(enuMinY, posEnu.y);
enuMaxX = Math.max(enuMaxX, posEnu.x);
enuMaxY = Math.max(enuMaxY, posEnu.y);
}
const toDesiredInComputed = Matrix2_default.fromRotation(
stRotation,
rotation2DScratch
);
const points2D = points2DScratch;
points2D[0].x = enuMinX;
points2D[0].y = enuMinY;
points2D[1].x = enuMinX;
points2D[1].y = enuMaxY;
points2D[2].x = enuMaxX;
points2D[2].y = enuMinY;
const boundingEnuMin = boundingPointsEnu[0];
const boundingPointsWidth = boundingPointsEnu[2].x - boundingEnuMin.x;
const boundingPointsHeight = boundingPointsEnu[1].y - boundingEnuMin.y;
for (i = 0; i < 3; i++) {
const point2D = points2D[i];
Matrix2_default.multiplyByVector(toDesiredInComputed, point2D, point2D);
point2D.x = (point2D.x - boundingEnuMin.x) / boundingPointsWidth;
point2D.y = (point2D.y - boundingEnuMin.y) / boundingPointsHeight;
}
const minXYCorner = points2D[0];
const maxYCorner = points2D[1];
const maxXCorner = points2D[2];
const result = new Array(6);
Cartesian2_default.pack(minXYCorner, result);
Cartesian2_default.pack(maxYCorner, result, 2);
Cartesian2_default.pack(maxXCorner, result, 4);
return result;
};
var Geometry_default = Geometry;
// packages/engine/Source/Core/GeometryAttribute.js
function GeometryAttribute(options) {
options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
if (!defined_default(options.componentDatatype)) {
throw new DeveloperError_default("options.componentDatatype is required.");
}
if (!defined_default(options.componentsPerAttribute)) {
throw new DeveloperError_default("options.componentsPerAttribute is required.");
}
if (options.componentsPerAttribute < 1 || options.componentsPerAttribute > 4) {
throw new DeveloperError_default(
"options.componentsPerAttribute must be between 1 and 4."
);
}
if (!defined_default(options.values)) {
throw new DeveloperError_default("options.values is required.");
}
this.componentDatatype = options.componentDatatype;
this.componentsPerAttribute = options.componentsPerAttribute;
this.normalize = defaultValue_default(options.normalize, false);
this.values = options.values;
}
var GeometryAttribute_default = GeometryAttribute;
export {
GeometryType_default,
PrimitiveType_default,
Geometry_default,
GeometryAttribute_default
};
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.121.2
*
* Copyright 2011-2022 Cesium Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Columbus View (Pat. Pend.)
*
* Portions licensed separately.
* See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
*/
import {
Matrix4_default,
Rectangle_default
} from "./chunk-6SQMLVGV.js";
import {
Cartesian3_default,
Cartographic_default,
Ellipsoid_default,
Matrix3_default
} from "./chunk-FFLMY4TE.js";
import {
Math_default
} from "./chunk-WGDFYAGC.js";
import {
defaultValue_default
} from "./chunk-U5HSOKPQ.js";
import {
Check_default,
DeveloperError_default
} from "./chunk-P6TRGU3S.js";
import {
defined_default
} from "./chunk-YCDZX5LS.js";
// packages/engine/Source/Core/GeographicProjection.js
function GeographicProjection(ellipsoid) {
this._ellipsoid = defaultValue_default(ellipsoid, Ellipsoid_default.default);
this._semimajorAxis = this._ellipsoid.maximumRadius;
this._oneOverSemimajorAxis = 1 / this._semimajorAxis;
}
Object.defineProperties(GeographicProjection.prototype, {
/**
* Gets the {@link Ellipsoid}.
*
* @memberof GeographicProjection.prototype
*
* @type {Ellipsoid}
* @readonly
*/
ellipsoid: {
get: function() {
return this._ellipsoid;
}
}
});
GeographicProjection.prototype.project = function(cartographic, result) {
const semimajorAxis = this._semimajorAxis;
const x = cartographic.longitude * semimajorAxis;
const y = cartographic.latitude * semimajorAxis;
const z = cartographic.height;
if (!defined_default(result)) {
return new Cartesian3_default(x, y, z);
}
result.x = x;
result.y = y;
result.z = z;
return result;
};
GeographicProjection.prototype.unproject = function(cartesian, result) {
if (!defined_default(cartesian)) {
throw new DeveloperError_default("cartesian is required");
}
const oneOverEarthSemimajorAxis = this._oneOverSemimajorAxis;
const longitude = cartesian.x * oneOverEarthSemimajorAxis;
const latitude = cartesian.y * oneOverEarthSemimajorAxis;
const height = cartesian.z;
if (!defined_default(result)) {
return new Cartographic_default(longitude, latitude, height);
}
result.longitude = longitude;
result.latitude = latitude;
result.height = height;
return result;
};
var GeographicProjection_default = GeographicProjection;
// packages/engine/Source/Core/Intersect.js
var Intersect = {
/**
* Represents that an object is not contained within the frustum.
*
* @type {number}
* @constant
*/
OUTSIDE: -1,
/**
* Represents that an object intersects one of the frustum's planes.
*
* @type {number}
* @constant
*/
INTERSECTING: 0,
/**
* Represents that an object is fully within the frustum.
*
* @type {number}
* @constant
*/
INSIDE: 1
};
var Intersect_default = Object.freeze(Intersect);
// packages/engine/Source/Core/Interval.js
function Interval(start, stop) {
this.start = defaultValue_default(start, 0);
this.stop = defaultValue_default(stop, 0);
}
var Interval_default = Interval;
// packages/engine/Source/Core/BoundingSphere.js
function BoundingSphere(center, radius) {
this.center = Cartesian3_default.clone(defaultValue_default(center, Cartesian3_default.ZERO));
this.radius = defaultValue_default(radius, 0);
}
var fromPointsXMin = new Cartesian3_default();
var fromPointsYMin = new Cartesian3_default();
var fromPointsZMin = new Cartesian3_default();
var fromPointsXMax = new Cartesian3_default();
var fromPointsYMax = new Cartesian3_default();
var fromPointsZMax = new Cartesian3_default();
var fromPointsCurrentPos = new Cartesian3_default();
var fromPointsScratch = new Cartesian3_default();
var fromPointsRitterCenter = new Cartesian3_default();
var fromPointsMinBoxPt = new Cartesian3_default();
var fromPointsMaxBoxPt = new Cartesian3_default();
var fromPointsNaiveCenterScratch = new Cartesian3_default();
var volumeConstant = 4 / 3 * Math_default.PI;
BoundingSphere.fromPoints = function(positions, result) {
if (!defined_default(result)) {
result = new BoundingSphere();
}
if (!defined_default(positions) || positions.length === 0) {
result.center = Cartesian3_default.clone(Cartesian3_default.ZERO, result.center);
result.radius = 0;
return result;
}
const currentPos = Cartesian3_default.clone(positions[0], fromPointsCurrentPos);
const xMin = Cartesian3_default.clone(currentPos, fromPointsXMin);
const yMin = Cartesian3_default.clone(currentPos, fromPointsYMin);
const zMin = Cartesian3_default.clone(currentPos, fromPointsZMin);
const xMax = Cartesian3_default.clone(currentPos, fromPointsXMax);
const yMax = Cartesian3_default.clone(currentPos, fromPointsYMax);
const zMax = Cartesian3_default.clone(currentPos, fromPointsZMax);
const numPositions = positions.length;
let i;
for (i = 1; i < numPositions; i++) {
Cartesian3_default.clone(positions[i], currentPos);
const x = currentPos.x;
const y = currentPos.y;
const z = currentPos.z;
if (x < xMin.x) {
Cartesian3_default.clone(currentPos, xMin);
}
if (x > xMax.x) {
Cartesian3_default.clone(currentPos, xMax);
}
if (y < yMin.y) {
Cartesian3_default.clone(currentPos, yMin);
}
if (y > yMax.y) {
Cartesian3_default.clone(currentPos, yMax);
}
if (z < zMin.z) {
Cartesian3_default.clone(currentPos, zMin);
}
if (z > zMax.z) {
Cartesian3_default.clone(currentPos, zMax);
}
}
const xSpan = Cartesian3_default.magnitudeSquared(
Cartesian3_default.subtract(xMax, xMin, fromPointsScratch)
);
const ySpan = Cartesian3_default.magnitudeSquared(
Cartesian3_default.subtract(yMax, yMin, fromPointsScratch)
);
const zSpan = Cartesian3_default.magnitudeSquared(
Cartesian3_default.subtract(zMax, zMin, fromPointsScratch)
);
let diameter1 = xMin;
let diameter2 = xMax;
let maxSpan = xSpan;
if (ySpan > maxSpan) {
maxSpan = ySpan;
diameter1 = yMin;
diameter2 = yMax;
}
if (zSpan > maxSpan) {
maxSpan = zSpan;
diameter1 = zMin;
diameter2 = zMax;
}
const ritterCenter = fromPointsRitterCenter;
ritterCenter.x = (diameter1.x + diameter2.x) * 0.5;
ritterCenter.y = (diameter1.y + diameter2.y) * 0.5;
ritterCenter.z = (diameter1.z + diameter2.z) * 0.5;
let radiusSquared = Cartesian3_default.magnitudeSquared(
Cartesian3_default.subtract(diameter2, ritterCenter, fromPointsScratch)
);
let ritterRadius = Math.sqrt(radiusSquared);
const minBoxPt = fromPointsMinBoxPt;
minBoxPt.x = xMin.x;
minBoxPt.y = yMin.y;
minBoxPt.z = zMin.z;
const maxBoxPt = fromPointsMaxBoxPt;
maxBoxPt.x = xMax.x;
maxBoxPt.y = yMax.y;
maxBoxPt.z = zMax.z;
const naiveCenter = Cartesian3_default.midpoint(
minBoxPt,
maxBoxPt,
fromPointsNaiveCenterScratch
);
let naiveRadius = 0;
for (i = 0; i < numPositions; i++) {
Cartesian3_default.clone(positions[i], currentPos);
const r = Cartesian3_default.magnitude(
Cartesian3_default.subtract(currentPos, naiveCenter, fromPointsScratch)
);
if (r > naiveRadius) {
naiveRadius = r;
}
const oldCenterToPointSquared = Cartesian3_default.magnitudeSquared(
Cartesian3_default.subtract(currentPos, ritterCenter, fromPointsScratch)
);
if (oldCenterToPointSquared > radiusSquared) {
const oldCenterToPoint = Math.sqrt(oldCenterToPointSquared);
ritterRadius = (ritterRadius + oldCenterToPoint) * 0.5;
radiusSquared = ritterRadius * ritterRadius;
const oldToNew = oldCenterToPoint - ritterRadius;
ritterCenter.x = (ritterRadius * ritterCenter.x + oldToNew * currentPos.x) / oldCenterToPoint;
ritterCenter.y = (ritterRadius * ritterCenter.y + oldToNew * currentPos.y) / oldCenterToPoint;
ritterCenter.z = (ritterRadius * ritterCenter.z + oldToNew * currentPos.z) / oldCenterToPoint;
}
}
if (ritterRadius < naiveRadius) {
Cartesian3_default.clone(ritterCenter, result.center);
result.radius = ritterRadius;
} else {
Cartesian3_default.clone(naiveCenter, result.center);
result.radius = naiveRadius;
}
return result;
};
var defaultProjection = new GeographicProjection_default();
var fromRectangle2DLowerLeft = new Cartesian3_default();
var fromRectangle2DUpperRight = new Cartesian3_default();
var fromRectangle2DSouthwest = new Cartographic_default();
var fromRectangle2DNortheast = new Cartographic_default();
BoundingSphere.fromRectangle2D = function(rectangle, projection, result) {
return BoundingSphere.fromRectangleWithHeights2D(
rectangle,
projection,
0,
0,
result
);
};
BoundingSphere.fromRectangleWithHeights2D = function(rectangle, projection, minimumHeight, maximumHeight, result) {
if (!defined_default(result)) {
result = new BoundingSphere();
}
if (!defined_default(rectangle)) {
result.center = Cartesian3_default.clone(Cartesian3_default.ZERO, result.center);
result.radius = 0;
return result;
}
defaultProjection._ellipsoid = Ellipsoid_default.default;
projection = defaultValue_default(projection, defaultProjection);
Rectangle_default.southwest(rectangle, fromRectangle2DSouthwest);
fromRectangle2DSouthwest.height = minimumHeight;
Rectangle_default.northeast(rectangle, fromRectangle2DNortheast);
fromRectangle2DNortheast.height = maximumHeight;
const lowerLeft = projection.project(
fromRectangle2DSouthwest,
fromRectangle2DLowerLeft
);
const upperRight = projection.project(
fromRectangle2DNortheast,
fromRectangle2DUpperRight
);
const width = upperRight.x - lowerLeft.x;
const height = upperRight.y - lowerLeft.y;
const elevation = upperRight.z - lowerLeft.z;
result.radius = Math.sqrt(width * width + height * height + elevation * elevation) * 0.5;
const center = result.center;
center.x = lowerLeft.x + width * 0.5;
center.y = lowerLeft.y + height * 0.5;
center.z = lowerLeft.z + elevation * 0.5;
return result;
};
var fromRectangle3DScratch = [];
BoundingSphere.fromRectangle3D = function(rectangle, ellipsoid, surfaceHeight, result) {
ellipsoid = defaultValue_default(ellipsoid, Ellipsoid_default.default);
surfaceHeight = defaultValue_default(surfaceHeight, 0);
if (!defined_default(result)) {
result = new BoundingSphere();
}
if (!defined_default(rectangle)) {
result.center = Cartesian3_default.clone(Cartesian3_default.ZERO, result.center);
result.radius = 0;
return result;
}
const positions = Rectangle_default.subsample(
rectangle,
ellipsoid,
surfaceHeight,
fromRectangle3DScratch
);
return BoundingSphere.fromPoints(positions, result);
};
BoundingSphere.fromVertices = function(positions, center, stride, result) {
if (!defined_default(result)) {
result = new BoundingSphere();
}
if (!defined_default(positions) || positions.length === 0) {
result.center = Cartesian3_default.clone(Cartesian3_default.ZERO, result.center);
result.radius = 0;
return result;
}
center = defaultValue_default(center, Cartesian3_default.ZERO);
stride = defaultValue_default(stride, 3);
Check_default.typeOf.number.greaterThanOrEquals("stride", stride, 3);
const currentPos = fromPointsCurrentPos;
currentPos.x = positions[0] + center.x;
currentPos.y = positions[1] + center.y;
currentPos.z = positions[2] + center.z;
const xMin = Cartesian3_default.clone(currentPos, fromPointsXMin);
const yMin = Cartesian3_default.clone(currentPos, fromPointsYMin);
const zMin = Cartesian3_default.clone(currentPos, fromPointsZMin);
const xMax = Cartesian3_default.clone(currentPos, fromPointsXMax);
const yMax = Cartesian3_default.clone(currentPos, fromPointsYMax);
const zMax = Cartesian3_default.clone(currentPos, fromPointsZMax);
const numElements = positions.length;
let i;
for (i = 0; i < numElements; i += stride) {
const x = positions[i] + center.x;
const y = positions[i + 1] + center.y;
const z = positions[i + 2] + center.z;
currentPos.x = x;
currentPos.y = y;
currentPos.z = z;
if (x < xMin.x) {
Cartesian3_default.clone(currentPos, xMin);
}
if (x > xMax.x) {
Cartesian3_default.clone(currentPos, xMax);
}
if (y < yMin.y) {
Cartesian3_default.clone(currentPos, yMin);
}
if (y > yMax.y) {
Cartesian3_default.clone(currentPos, yMax);
}
if (z < zMin.z) {
Cartesian3_default.clone(currentPos, zMin);
}
if (z > zMax.z) {
Cartesian3_default.clone(currentPos, zMax);
}
}
const xSpan = Cartesian3_default.magnitudeSquared(
Cartesian3_default.subtract(xMax, xMin, fromPointsScratch)
);
const ySpan = Cartesian3_default.magnitudeSquared(
Cartesian3_default.subtract(yMax, yMin, fromPointsScratch)
);
const zSpan = Cartesian3_default.magnitudeSquared(
Cartesian3_default.subtract(zMax, zMin, fromPointsScratch)
);
let diameter1 = xMin;
let diameter2 = xMax;
let maxSpan = xSpan;
if (ySpan > maxSpan) {
maxSpan = ySpan;
diameter1 = yMin;
diameter2 = yMax;
}
if (zSpan > maxSpan) {
maxSpan = zSpan;
diameter1 = zMin;
diameter2 = zMax;
}
const ritterCenter = fromPointsRitterCenter;
ritterCenter.x = (diameter1.x + diameter2.x) * 0.5;
ritterCenter.y = (diameter1.y + diameter2.y) * 0.5;
ritterCenter.z = (diameter1.z + diameter2.z) * 0.5;
let radiusSquared = Cartesian3_default.magnitudeSquared(
Cartesian3_default.subtract(diameter2, ritterCenter, fromPointsScratch)
);
let ritterRadius = Math.sqrt(radiusSquared);
const minBoxPt = fromPointsMinBoxPt;
minBoxPt.x = xMin.x;
minBoxPt.y = yMin.y;
minBoxPt.z = zMin.z;
const maxBoxPt = fromPointsMaxBoxPt;
maxBoxPt.x = xMax.x;
maxBoxPt.y = yMax.y;
maxBoxPt.z = zMax.z;
const naiveCenter = Cartesian3_default.midpoint(
minBoxPt,
maxBoxPt,
fromPointsNaiveCenterScratch
);
let naiveRadius = 0;
for (i = 0; i < numElements; i += stride) {
currentPos.x = positions[i] + center.x;
currentPos.y = positions[i + 1] + center.y;
currentPos.z = positions[i + 2] + center.z;
const r = Cartesian3_default.magnitude(
Cartesian3_default.subtract(currentPos, naiveCenter, fromPointsScratch)
);
if (r > naiveRadius) {
naiveRadius = r;
}
const oldCenterToPointSquared = Cartesian3_default.magnitudeSquared(
Cartesian3_default.subtract(currentPos, ritterCenter, fromPointsScratch)
);
if (oldCenterToPointSquared > radiusSquared) {
const oldCenterToPoint = Math.sqrt(oldCenterToPointSquared);
ritterRadius = (ritterRadius + oldCenterToPoint) * 0.5;
radiusSquared = ritterRadius * ritterRadius;
const oldToNew = oldCenterToPoint - ritterRadius;
ritterCenter.x = (ritterRadius * ritterCenter.x + oldToNew * currentPos.x) / oldCenterToPoint;
ritterCenter.y = (ritterRadius * ritterCenter.y + oldToNew * currentPos.y) / oldCenterToPoint;
ritterCenter.z = (ritterRadius * ritterCenter.z + oldToNew * currentPos.z) / oldCenterToPoint;
}
}
if (ritterRadius < naiveRadius) {
Cartesian3_default.clone(ritterCenter, result.center);
result.radius = ritterRadius;
} else {
Cartesian3_default.clone(naiveCenter, result.center);
result.radius = naiveRadius;
}
return result;
};
BoundingSphere.fromEncodedCartesianVertices = function(positionsHigh, positionsLow, result) {
if (!defined_default(result)) {
result = new BoundingSphere();
}
if (!defined_default(positionsHigh) || !defined_default(positionsLow) || positionsHigh.length !== positionsLow.length || positionsHigh.length === 0) {
result.center = Cartesian3_default.clone(Cartesian3_default.ZERO, result.center);
result.radius = 0;
return result;
}
const currentPos = fromPointsCurrentPos;
currentPos.x = positionsHigh[0] + positionsLow[0];
currentPos.y = positionsHigh[1] + positionsLow[1];
currentPos.z = positionsHigh[2] + positionsLow[2];
const xMin = Cartesian3_default.clone(currentPos, fromPointsXMin);
const yMin = Cartesian3_default.clone(currentPos, fromPointsYMin);
const zMin = Cartesian3_default.clone(currentPos, fromPointsZMin);
const xMax = Cartesian3_default.clone(currentPos, fromPointsXMax);
const yMax = Cartesian3_default.clone(currentPos, fromPointsYMax);
const zMax = Cartesian3_default.clone(currentPos, fromPointsZMax);
const numElements = positionsHigh.length;
let i;
for (i = 0; i < numElements; i += 3) {
const x = positionsHigh[i] + positionsLow[i];
const y = positionsHigh[i + 1] + positionsLow[i + 1];
const z = positionsHigh[i + 2] + positionsLow[i + 2];
currentPos.x = x;
currentPos.y = y;
currentPos.z = z;
if (x < xMin.x) {
Cartesian3_default.clone(currentPos, xMin);
}
if (x > xMax.x) {
Cartesian3_default.clone(currentPos, xMax);
}
if (y < yMin.y) {
Cartesian3_default.clone(currentPos, yMin);
}
if (y > yMax.y) {
Cartesian3_default.clone(currentPos, yMax);
}
if (z < zMin.z) {
Cartesian3_default.clone(currentPos, zMin);
}
if (z > zMax.z) {
Cartesian3_default.clone(currentPos, zMax);
}
}
const xSpan = Cartesian3_default.magnitudeSquared(
Cartesian3_default.subtract(xMax, xMin, fromPointsScratch)
);
const ySpan = Cartesian3_default.magnitudeSquared(
Cartesian3_default.subtract(yMax, yMin, fromPointsScratch)
);
const zSpan = Cartesian3_default.magnitudeSquared(
Cartesian3_default.subtract(zMax, zMin, fromPointsScratch)
);
let diameter1 = xMin;
let diameter2 = xMax;
let maxSpan = xSpan;
if (ySpan > maxSpan) {
maxSpan = ySpan;
diameter1 = yMin;
diameter2 = yMax;
}
if (zSpan > maxSpan) {
maxSpan = zSpan;
diameter1 = zMin;
diameter2 = zMax;
}
const ritterCenter = fromPointsRitterCenter;
ritterCenter.x = (diameter1.x + diameter2.x) * 0.5;
ritterCenter.y = (diameter1.y + diameter2.y) * 0.5;
ritterCenter.z = (diameter1.z + diameter2.z) * 0.5;
let radiusSquared = Cartesian3_default.magnitudeSquared(
Cartesian3_default.subtract(diameter2, ritterCenter, fromPointsScratch)
);
let ritterRadius = Math.sqrt(radiusSquared);
const minBoxPt = fromPointsMinBoxPt;
minBoxPt.x = xMin.x;
minBoxPt.y = yMin.y;
minBoxPt.z = zMin.z;
const maxBoxPt = fromPointsMaxBoxPt;
maxBoxPt.x = xMax.x;
maxBoxPt.y = yMax.y;
maxBoxPt.z = zMax.z;
const naiveCenter = Cartesian3_default.midpoint(
minBoxPt,
maxBoxPt,
fromPointsNaiveCenterScratch
);
let naiveRadius = 0;
for (i = 0; i < numElements; i += 3) {
currentPos.x = positionsHigh[i] + positionsLow[i];
currentPos.y = positionsHigh[i + 1] + positionsLow[i + 1];
currentPos.z = positionsHigh[i + 2] + positionsLow[i + 2];
const r = Cartesian3_default.magnitude(
Cartesian3_default.subtract(currentPos, naiveCenter, fromPointsScratch)
);
if (r > naiveRadius) {
naiveRadius = r;
}
const oldCenterToPointSquared = Cartesian3_default.magnitudeSquared(
Cartesian3_default.subtract(currentPos, ritterCenter, fromPointsScratch)
);
if (oldCenterToPointSquared > radiusSquared) {
const oldCenterToPoint = Math.sqrt(oldCenterToPointSquared);
ritterRadius = (ritterRadius + oldCenterToPoint) * 0.5;
radiusSquared = ritterRadius * ritterRadius;
const oldToNew = oldCenterToPoint - ritterRadius;
ritterCenter.x = (ritterRadius * ritterCenter.x + oldToNew * currentPos.x) / oldCenterToPoint;
ritterCenter.y = (ritterRadius * ritterCenter.y + oldToNew * currentPos.y) / oldCenterToPoint;
ritterCenter.z = (ritterRadius * ritterCenter.z + oldToNew * currentPos.z) / oldCenterToPoint;
}
}
if (ritterRadius < naiveRadius) {
Cartesian3_default.clone(ritterCenter, result.center);
result.radius = ritterRadius;
} else {
Cartesian3_default.clone(naiveCenter, result.center);
result.radius = naiveRadius;
}
return result;
};
BoundingSphere.fromCornerPoints = function(corner, oppositeCorner, result) {
Check_default.typeOf.object("corner", corner);
Check_default.typeOf.object("oppositeCorner", oppositeCorner);
if (!defined_default(result)) {
result = new BoundingSphere();
}
const center = Cartesian3_default.midpoint(corner, oppositeCorner, result.center);
result.radius = Cartesian3_default.distance(center, oppositeCorner);
return result;
};
BoundingSphere.fromEllipsoid = function(ellipsoid, result) {
Check_default.typeOf.object("ellipsoid", ellipsoid);
if (!defined_default(result)) {
result = new BoundingSphere();
}
Cartesian3_default.clone(Cartesian3_default.ZERO, result.center);
result.radius = ellipsoid.maximumRadius;
return result;
};
var fromBoundingSpheresScratch = new Cartesian3_default();
BoundingSphere.fromBoundingSpheres = function(boundingSpheres, result) {
if (!defined_default(result)) {
result = new BoundingSphere();
}
if (!defined_default(boundingSpheres) || boundingSpheres.length === 0) {
result.center = Cartesian3_default.clone(Cartesian3_default.ZERO, result.center);
result.radius = 0;
return result;
}
const length = boundingSpheres.length;
if (length === 1) {
return BoundingSphere.clone(boundingSpheres[0], result);
}
if (length === 2) {
return BoundingSphere.union(boundingSpheres[0], boundingSpheres[1], result);
}
const positions = [];
let i;
for (i = 0; i < length; i++) {
positions.push(boundingSpheres[i].center);
}
result = BoundingSphere.fromPoints(positions, result);
const center = result.center;
let radius = result.radius;
for (i = 0; i < length; i++) {
const tmp = boundingSpheres[i];
radius = Math.max(
radius,
Cartesian3_default.distance(center, tmp.center, fromBoundingSpheresScratch) + tmp.radius
);
}
result.radius = radius;
return result;
};
var fromOrientedBoundingBoxScratchU = new Cartesian3_default();
var fromOrientedBoundingBoxScratchV = new Cartesian3_default();
var fromOrientedBoundingBoxScratchW = new Cartesian3_default();
BoundingSphere.fromOrientedBoundingBox = function(orientedBoundingBox, result) {
Check_default.defined("orientedBoundingBox", orientedBoundingBox);
if (!defined_default(result)) {
result = new BoundingSphere();
}
const halfAxes = orientedBoundingBox.halfAxes;
const u = Matrix3_default.getColumn(halfAxes, 0, fromOrientedBoundingBoxScratchU);
const v = Matrix3_default.getColumn(halfAxes, 1, fromOrientedBoundingBoxScratchV);
const w = Matrix3_default.getColumn(halfAxes, 2, fromOrientedBoundingBoxScratchW);
Cartesian3_default.add(u, v, u);
Cartesian3_default.add(u, w, u);
result.center = Cartesian3_default.clone(orientedBoundingBox.center, result.center);
result.radius = Cartesian3_default.magnitude(u);
return result;
};
var scratchFromTransformationCenter = new Cartesian3_default();
var scratchFromTransformationScale = new Cartesian3_default();
BoundingSphere.fromTransformation = function(transformation, result) {
Check_default.typeOf.object("transformation", transformation);
if (!defined_default(result)) {
result = new BoundingSphere();
}
const center = Matrix4_default.getTranslation(
transformation,
scratchFromTransformationCenter
);
const scale = Matrix4_default.getScale(
transformation,
scratchFromTransformationScale
);
const radius = 0.5 * Cartesian3_default.magnitude(scale);
result.center = Cartesian3_default.clone(center, result.center);
result.radius = radius;
return result;
};
BoundingSphere.clone = function(sphere, result) {
if (!defined_default(sphere)) {
return void 0;
}
if (!defined_default(result)) {
return new BoundingSphere(sphere.center, sphere.radius);
}
result.center = Cartesian3_default.clone(sphere.center, result.center);
result.radius = sphere.radius;
return result;
};
BoundingSphere.packedLength = 4;
BoundingSphere.pack = function(value, array, startingIndex) {
Check_default.typeOf.object("value", value);
Check_default.defined("array", array);
startingIndex = defaultValue_default(startingIndex, 0);
const center = value.center;
array[startingIndex++] = center.x;
array[startingIndex++] = center.y;
array[startingIndex++] = center.z;
array[startingIndex] = value.radius;
return array;
};
BoundingSphere.unpack = function(array, startingIndex, result) {
Check_default.defined("array", array);
startingIndex = defaultValue_default(startingIndex, 0);
if (!defined_default(result)) {
result = new BoundingSphere();
}
const center = result.center;
center.x = array[startingIndex++];
center.y = array[startingIndex++];
center.z = array[startingIndex++];
result.radius = array[startingIndex];
return result;
};
var unionScratch = new Cartesian3_default();
var unionScratchCenter = new Cartesian3_default();
BoundingSphere.union = function(left, right, result) {
Check_default.typeOf.object("left", left);
Check_default.typeOf.object("right", right);
if (!defined_default(result)) {
result = new BoundingSphere();
}
const leftCenter = left.center;
const leftRadius = left.radius;
const rightCenter = right.center;
const rightRadius = right.radius;
const toRightCenter = Cartesian3_default.subtract(
rightCenter,
leftCenter,
unionScratch
);
const centerSeparation = Cartesian3_default.magnitude(toRightCenter);
if (leftRadius >= centerSeparation + rightRadius) {
left.clone(result);
return result;
}
if (rightRadius >= centerSeparation + leftRadius) {
right.clone(result);
return result;
}
const halfDistanceBetweenTangentPoints = (leftRadius + centerSeparation + rightRadius) * 0.5;
const center = Cartesian3_default.multiplyByScalar(
toRightCenter,
(-leftRadius + halfDistanceBetweenTangentPoints) / centerSeparation,
unionScratchCenter
);
Cartesian3_default.add(center, leftCenter, center);
Cartesian3_default.clone(center, result.center);
result.radius = halfDistanceBetweenTangentPoints;
return result;
};
var expandScratch = new Cartesian3_default();
BoundingSphere.expand = function(sphere, point, result) {
Check_default.typeOf.object("sphere", sphere);
Check_default.typeOf.object("point", point);
result = BoundingSphere.clone(sphere, result);
const radius = Cartesian3_default.magnitude(
Cartesian3_default.subtract(point, result.center, expandScratch)
);
if (radius > result.radius) {
result.radius = radius;
}
return result;
};
BoundingSphere.intersectPlane = function(sphere, plane) {
Check_default.typeOf.object("sphere", sphere);
Check_default.typeOf.object("plane", plane);
const center = sphere.center;
const radius = sphere.radius;
const normal = plane.normal;
const distanceToPlane = Cartesian3_default.dot(normal, center) + plane.distance;
if (distanceToPlane < -radius) {
return Intersect_default.OUTSIDE;
} else if (distanceToPlane < radius) {
return Intersect_default.INTERSECTING;
}
return Intersect_default.INSIDE;
};
BoundingSphere.transform = function(sphere, transform, result) {
Check_default.typeOf.object("sphere", sphere);
Check_default.typeOf.object("transform", transform);
if (!defined_default(result)) {
result = new BoundingSphere();
}
result.center = Matrix4_default.multiplyByPoint(
transform,
sphere.center,
result.center
);
result.radius = Matrix4_default.getMaximumScale(transform) * sphere.radius;
return result;
};
var distanceSquaredToScratch = new Cartesian3_default();
BoundingSphere.distanceSquaredTo = function(sphere, cartesian) {
Check_default.typeOf.object("sphere", sphere);
Check_default.typeOf.object("cartesian", cartesian);
const diff = Cartesian3_default.subtract(
sphere.center,
cartesian,
distanceSquaredToScratch
);
const distance = Cartesian3_default.magnitude(diff) - sphere.radius;
if (distance <= 0) {
return 0;
}
return distance * distance;
};
BoundingSphere.transformWithoutScale = function(sphere, transform, result) {
Check_default.typeOf.object("sphere", sphere);
Check_default.typeOf.object("transform", transform);
if (!defined_default(result)) {
result = new BoundingSphere();
}
result.center = Matrix4_default.multiplyByPoint(
transform,
sphere.center,
result.center
);
result.radius = sphere.radius;
return result;
};
var scratchCartesian3 = new Cartesian3_default();
BoundingSphere.computePlaneDistances = function(sphere, position, direction, result) {
Check_default.typeOf.object("sphere", sphere);
Check_default.typeOf.object("position", position);
Check_default.typeOf.object("direction", direction);
if (!defined_default(result)) {
result = new Interval_default();
}
const toCenter = Cartesian3_default.subtract(
sphere.center,
position,
scratchCartesian3
);
const mag = Cartesian3_default.dot(direction, toCenter);
result.start = mag - sphere.radius;
result.stop = mag + sphere.radius;
return result;
};
var projectTo2DNormalScratch = new Cartesian3_default();
var projectTo2DEastScratch = new Cartesian3_default();
var projectTo2DNorthScratch = new Cartesian3_default();
var projectTo2DWestScratch = new Cartesian3_default();
var projectTo2DSouthScratch = new Cartesian3_default();
var projectTo2DCartographicScratch = new Cartographic_default();
var projectTo2DPositionsScratch = new Array(8);
for (let n = 0; n < 8; ++n) {
projectTo2DPositionsScratch[n] = new Cartesian3_default();
}
var projectTo2DProjection = new GeographicProjection_default();
BoundingSphere.projectTo2D = function(sphere, projection, result) {
Check_default.typeOf.object("sphere", sphere);
projectTo2DProjection._ellipsoid = Ellipsoid_default.default;
projection = defaultValue_default(projection, projectTo2DProjection);
const ellipsoid = projection.ellipsoid;
let center = sphere.center;
const radius = sphere.radius;
let normal;
if (Cartesian3_default.equals(center, Cartesian3_default.ZERO)) {
normal = Cartesian3_default.clone(Cartesian3_default.UNIT_X, projectTo2DNormalScratch);
} else {
normal = ellipsoid.geodeticSurfaceNormal(center, projectTo2DNormalScratch);
}
const east = Cartesian3_default.cross(
Cartesian3_default.UNIT_Z,
normal,
projectTo2DEastScratch
);
Cartesian3_default.normalize(east, east);
const north = Cartesian3_default.cross(normal, east, projectTo2DNorthScratch);
Cartesian3_default.normalize(north, north);
Cartesian3_default.multiplyByScalar(normal, radius, normal);
Cartesian3_default.multiplyByScalar(north, radius, north);
Cartesian3_default.multiplyByScalar(east, radius, east);
const south = Cartesian3_default.negate(north, projectTo2DSouthScratch);
const west = Cartesian3_default.negate(east, projectTo2DWestScratch);
const positions = projectTo2DPositionsScratch;
let corner = positions[0];
Cartesian3_default.add(normal, north, corner);
Cartesian3_default.add(corner, east, corner);
corner = positions[1];
Cartesian3_default.add(normal, north, corner);
Cartesian3_default.add(corner, west, corner);
corner = positions[2];
Cartesian3_default.add(normal, south, corner);
Cartesian3_default.add(corner, west, corner);
corner = positions[3];
Cartesian3_default.add(normal, south, corner);
Cartesian3_default.add(corner, east, corner);
Cartesian3_default.negate(normal, normal);
corner = positions[4];
Cartesian3_default.add(normal, north, corner);
Cartesian3_default.add(corner, east, corner);
corner = positions[5];
Cartesian3_default.add(normal, north, corner);
Cartesian3_default.add(corner, west, corner);
corner = positions[6];
Cartesian3_default.add(normal, south, corner);
Cartesian3_default.add(corner, west, corner);
corner = positions[7];
Cartesian3_default.add(normal, south, corner);
Cartesian3_default.add(corner, east, corner);
const length = positions.length;
for (let i = 0; i < length; ++i) {
const position = positions[i];
Cartesian3_default.add(center, position, position);
const cartographic = ellipsoid.cartesianToCartographic(
position,
projectTo2DCartographicScratch
);
projection.project(cartographic, position);
}
result = BoundingSphere.fromPoints(positions, result);
center = result.center;
const x = center.x;
const y = center.y;
const z = center.z;
center.x = z;
center.y = x;
center.z = y;
return result;
};
BoundingSphere.isOccluded = function(sphere, occluder) {
Check_default.typeOf.object("sphere", sphere);
Check_default.typeOf.object("occluder", occluder);
return !occluder.isBoundingSphereVisible(sphere);
};
BoundingSphere.equals = function(left, right) {
return left === right || defined_default(left) && defined_default(right) && Cartesian3_default.equals(left.center, right.center) && left.radius === right.radius;
};
BoundingSphere.prototype.intersectPlane = function(plane) {
return BoundingSphere.intersectPlane(this, plane);
};
BoundingSphere.prototype.distanceSquaredTo = function(cartesian) {
return BoundingSphere.distanceSquaredTo(this, cartesian);
};
BoundingSphere.prototype.computePlaneDistances = function(position, direction, result) {
return BoundingSphere.computePlaneDistances(
this,
position,
direction,
result
);
};
BoundingSphere.prototype.isOccluded = function(occluder) {
return BoundingSphere.isOccluded(this, occluder);
};
BoundingSphere.prototype.equals = function(right) {
return BoundingSphere.equals(this, right);
};
BoundingSphere.prototype.clone = function(result) {
return BoundingSphere.clone(this, result);
};
BoundingSphere.prototype.volume = function() {
const radius = this.radius;
return volumeConstant * radius * radius * radius;
};
var BoundingSphere_default = BoundingSphere;
export {
GeographicProjection_default,
Intersect_default,
Interval_default,
BoundingSphere_default
};
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.121.2
*
* Copyright 2011-2022 Cesium Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Columbus View (Pat. Pend.)
*
* Portions licensed separately.
* See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
*/
import {
CylinderGeometryLibrary_default
} from "./chunk-O72GZTSE.js";
import {
GeometryOffsetAttribute_default
} from "./chunk-GBT7MJ6X.js";
import {
VertexFormat_default
} from "./chunk-JBSKHTNX.js";
import {
IndexDatatype_default
} from "./chunk-C4WPMOKT.js";
import {
GeometryAttributes_default
} from "./chunk-X7IQYYHF.js";
import {
GeometryAttribute_default,
Geometry_default,
PrimitiveType_default
} from "./chunk-JXVLNVXC.js";
import {
BoundingSphere_default
} from "./chunk-KHZNBFOH.js";
import {
ComponentDatatype_default
} from "./chunk-XIUSRWL6.js";
import {
Cartesian2_default,
Cartesian3_default
} from "./chunk-FFLMY4TE.js";
import {
Math_default
} from "./chunk-WGDFYAGC.js";
import {
defaultValue_default
} from "./chunk-U5HSOKPQ.js";
import {
DeveloperError_default
} from "./chunk-P6TRGU3S.js";
import {
defined_default
} from "./chunk-YCDZX5LS.js";
// packages/engine/Source/Core/CylinderGeometry.js
var radiusScratch = new Cartesian2_default();
var normalScratch = new Cartesian3_default();
var bitangentScratch = new Cartesian3_default();
var tangentScratch = new Cartesian3_default();
var positionScratch = new Cartesian3_default();
function CylinderGeometry(options) {
options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
const length = options.length;
const topRadius = options.topRadius;
const bottomRadius = options.bottomRadius;
const vertexFormat = defaultValue_default(options.vertexFormat, VertexFormat_default.DEFAULT);
const slices = defaultValue_default(options.slices, 128);
if (!defined_default(length)) {
throw new DeveloperError_default("options.length must be defined.");
}
if (!defined_default(topRadius)) {
throw new DeveloperError_default("options.topRadius must be defined.");
}
if (!defined_default(bottomRadius)) {
throw new DeveloperError_default("options.bottomRadius must be defined.");
}
if (slices < 3) {
throw new DeveloperError_default(
"options.slices must be greater than or equal to 3."
);
}
if (defined_default(options.offsetAttribute) && options.offsetAttribute === GeometryOffsetAttribute_default.TOP) {
throw new DeveloperError_default(
"GeometryOffsetAttribute.TOP is not a supported options.offsetAttribute for this geometry."
);
}
this._length = length;
this._topRadius = topRadius;
this._bottomRadius = bottomRadius;
this._vertexFormat = VertexFormat_default.clone(vertexFormat);
this._slices = slices;
this._offsetAttribute = options.offsetAttribute;
this._workerName = "createCylinderGeometry";
}
CylinderGeometry.packedLength = VertexFormat_default.packedLength + 5;
CylinderGeometry.pack = function(value, array, startingIndex) {
if (!defined_default(value)) {
throw new DeveloperError_default("value is required");
}
if (!defined_default(array)) {
throw new DeveloperError_default("array is required");
}
startingIndex = defaultValue_default(startingIndex, 0);
VertexFormat_default.pack(value._vertexFormat, array, startingIndex);
startingIndex += VertexFormat_default.packedLength;
array[startingIndex++] = value._length;
array[startingIndex++] = value._topRadius;
array[startingIndex++] = value._bottomRadius;
array[startingIndex++] = value._slices;
array[startingIndex] = defaultValue_default(value._offsetAttribute, -1);
return array;
};
var scratchVertexFormat = new VertexFormat_default();
var scratchOptions = {
vertexFormat: scratchVertexFormat,
length: void 0,
topRadius: void 0,
bottomRadius: void 0,
slices: void 0,
offsetAttribute: void 0
};
CylinderGeometry.unpack = function(array, startingIndex, result) {
if (!defined_default(array)) {
throw new DeveloperError_default("array is required");
}
startingIndex = defaultValue_default(startingIndex, 0);
const vertexFormat = VertexFormat_default.unpack(
array,
startingIndex,
scratchVertexFormat
);
startingIndex += VertexFormat_default.packedLength;
const length = array[startingIndex++];
const topRadius = array[startingIndex++];
const bottomRadius = array[startingIndex++];
const slices = array[startingIndex++];
const offsetAttribute = array[startingIndex];
if (!defined_default(result)) {
scratchOptions.length = length;
scratchOptions.topRadius = topRadius;
scratchOptions.bottomRadius = bottomRadius;
scratchOptions.slices = slices;
scratchOptions.offsetAttribute = offsetAttribute === -1 ? void 0 : offsetAttribute;
return new CylinderGeometry(scratchOptions);
}
result._vertexFormat = VertexFormat_default.clone(vertexFormat, result._vertexFormat);
result._length = length;
result._topRadius = topRadius;
result._bottomRadius = bottomRadius;
result._slices = slices;
result._offsetAttribute = offsetAttribute === -1 ? void 0 : offsetAttribute;
return result;
};
CylinderGeometry.createGeometry = function(cylinderGeometry) {
let length = cylinderGeometry._length;
const topRadius = cylinderGeometry._topRadius;
const bottomRadius = cylinderGeometry._bottomRadius;
const vertexFormat = cylinderGeometry._vertexFormat;
const slices = cylinderGeometry._slices;
if (length <= 0 || topRadius < 0 || bottomRadius < 0 || topRadius === 0 && bottomRadius === 0) {
return;
}
const twoSlices = slices + slices;
const threeSlices = slices + twoSlices;
const numVertices = twoSlices + twoSlices;
const positions = CylinderGeometryLibrary_default.computePositions(
length,
topRadius,
bottomRadius,
slices,
true
);
const st = vertexFormat.st ? new Float32Array(numVertices * 2) : void 0;
const normals = vertexFormat.normal ? new Float32Array(numVertices * 3) : void 0;
const tangents = vertexFormat.tangent ? new Float32Array(numVertices * 3) : void 0;
const bitangents = vertexFormat.bitangent ? new Float32Array(numVertices * 3) : void 0;
let i;
const computeNormal = vertexFormat.normal || vertexFormat.tangent || vertexFormat.bitangent;
if (computeNormal) {
const computeTangent = vertexFormat.tangent || vertexFormat.bitangent;
let normalIndex = 0;
let tangentIndex = 0;
let bitangentIndex = 0;
const theta = Math.atan2(bottomRadius - topRadius, length);
const normal = normalScratch;
normal.z = Math.sin(theta);
const normalScale = Math.cos(theta);
let tangent = tangentScratch;
let bitangent = bitangentScratch;
for (i = 0; i < slices; i++) {
const angle = i / slices * Math_default.TWO_PI;
const x = normalScale * Math.cos(angle);
const y = normalScale * Math.sin(angle);
if (computeNormal) {
normal.x = x;
normal.y = y;
if (computeTangent) {
tangent = Cartesian3_default.normalize(
Cartesian3_default.cross(Cartesian3_default.UNIT_Z, normal, tangent),
tangent
);
}
if (vertexFormat.normal) {
normals[normalIndex++] = normal.x;
normals[normalIndex++] = normal.y;
normals[normalIndex++] = normal.z;
normals[normalIndex++] = normal.x;
normals[normalIndex++] = normal.y;
normals[normalIndex++] = normal.z;
}
if (vertexFormat.tangent) {
tangents[tangentIndex++] = tangent.x;
tangents[tangentIndex++] = tangent.y;
tangents[tangentIndex++] = tangent.z;
tangents[tangentIndex++] = tangent.x;
tangents[tangentIndex++] = tangent.y;
tangents[tangentIndex++] = tangent.z;
}
if (vertexFormat.bitangent) {
bitangent = Cartesian3_default.normalize(
Cartesian3_default.cross(normal, tangent, bitangent),
bitangent
);
bitangents[bitangentIndex++] = bitangent.x;
bitangents[bitangentIndex++] = bitangent.y;
bitangents[bitangentIndex++] = bitangent.z;
bitangents[bitangentIndex++] = bitangent.x;
bitangents[bitangentIndex++] = bitangent.y;
bitangents[bitangentIndex++] = bitangent.z;
}
}
}
for (i = 0; i < slices; i++) {
if (vertexFormat.normal) {
normals[normalIndex++] = 0;
normals[normalIndex++] = 0;
normals[normalIndex++] = -1;
}
if (vertexFormat.tangent) {
tangents[tangentIndex++] = 1;
tangents[tangentIndex++] = 0;
tangents[tangentIndex++] = 0;
}
if (vertexFormat.bitangent) {
bitangents[bitangentIndex++] = 0;
bitangents[bitangentIndex++] = -1;
bitangents[bitangentIndex++] = 0;
}
}
for (i = 0; i < slices; i++) {
if (vertexFormat.normal) {
normals[normalIndex++] = 0;
normals[normalIndex++] = 0;
normals[normalIndex++] = 1;
}
if (vertexFormat.tangent) {
tangents[tangentIndex++] = 1;
tangents[tangentIndex++] = 0;
tangents[tangentIndex++] = 0;
}
if (vertexFormat.bitangent) {
bitangents[bitangentIndex++] = 0;
bitangents[bitangentIndex++] = 1;
bitangents[bitangentIndex++] = 0;
}
}
}
const numIndices = 12 * slices - 12;
const indices = IndexDatatype_default.createTypedArray(numVertices, numIndices);
let index = 0;
let j = 0;
for (i = 0; i < slices - 1; i++) {
indices[index++] = j;
indices[index++] = j + 2;
indices[index++] = j + 3;
indices[index++] = j;
indices[index++] = j + 3;
indices[index++] = j + 1;
j += 2;
}
indices[index++] = twoSlices - 2;
indices[index++] = 0;
indices[index++] = 1;
indices[index++] = twoSlices - 2;
indices[index++] = 1;
indices[index++] = twoSlices - 1;
for (i = 1; i < slices - 1; i++) {
indices[index++] = twoSlices + i + 1;
indices[index++] = twoSlices + i;
indices[index++] = twoSlices;
}
for (i = 1; i < slices - 1; i++) {
indices[index++] = threeSlices;
indices[index++] = threeSlices + i;
indices[index++] = threeSlices + i + 1;
}
let textureCoordIndex = 0;
if (vertexFormat.st) {
const rad = Math.max(topRadius, bottomRadius);
for (i = 0; i < numVertices; i++) {
const position = Cartesian3_default.fromArray(positions, i * 3, positionScratch);
st[textureCoordIndex++] = (position.x + rad) / (2 * rad);
st[textureCoordIndex++] = (position.y + rad) / (2 * rad);
}
}
const attributes = new GeometryAttributes_default();
if (vertexFormat.position) {
attributes.position = new GeometryAttribute_default({
componentDatatype: ComponentDatatype_default.DOUBLE,
componentsPerAttribute: 3,
values: positions
});
}
if (vertexFormat.normal) {
attributes.normal = new GeometryAttribute_default({
componentDatatype: ComponentDatatype_default.FLOAT,
componentsPerAttribute: 3,
values: normals
});
}
if (vertexFormat.tangent) {
attributes.tangent = new GeometryAttribute_default({
componentDatatype: ComponentDatatype_default.FLOAT,
componentsPerAttribute: 3,
values: tangents
});
}
if (vertexFormat.bitangent) {
attributes.bitangent = new GeometryAttribute_default({
componentDatatype: ComponentDatatype_default.FLOAT,
componentsPerAttribute: 3,
values: bitangents
});
}
if (vertexFormat.st) {
attributes.st = new GeometryAttribute_default({
componentDatatype: ComponentDatatype_default.FLOAT,
componentsPerAttribute: 2,
values: st
});
}
radiusScratch.x = length * 0.5;
radiusScratch.y = Math.max(bottomRadius, topRadius);
const boundingSphere = new BoundingSphere_default(
Cartesian3_default.ZERO,
Cartesian2_default.magnitude(radiusScratch)
);
if (defined_default(cylinderGeometry._offsetAttribute)) {
length = positions.length;
const offsetValue = cylinderGeometry._offsetAttribute === GeometryOffsetAttribute_default.NONE ? 0 : 1;
const applyOffset = new Uint8Array(length / 3).fill(offsetValue);
attributes.applyOffset = new GeometryAttribute_default({
componentDatatype: ComponentDatatype_default.UNSIGNED_BYTE,
componentsPerAttribute: 1,
values: applyOffset
});
}
return new Geometry_default({
attributes,
indices,
primitiveType: PrimitiveType_default.TRIANGLES,
boundingSphere,
offsetAttribute: cylinderGeometry._offsetAttribute
});
};
var unitCylinderGeometry;
CylinderGeometry.getUnitCylinder = function() {
if (!defined_default(unitCylinderGeometry)) {
unitCylinderGeometry = CylinderGeometry.createGeometry(
new CylinderGeometry({
topRadius: 1,
bottomRadius: 1,
length: 1,
vertexFormat: VertexFormat_default.POSITION_ONLY
})
);
}
return unitCylinderGeometry;
};
var CylinderGeometry_default = CylinderGeometry;
export {
CylinderGeometry_default
};
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.121.2
*
* Copyright 2011-2022 Cesium Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Columbus View (Pat. Pend.)
*
* Portions licensed separately.
* See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
*/
import {
Cartesian4_default,
Matrix2_default,
Matrix4_default
} from "./chunk-6SQMLVGV.js";
import {
ComponentDatatype_default
} from "./chunk-XIUSRWL6.js";
import {
Cartesian2_default,
Cartesian3_default,
Matrix3_default
} from "./chunk-FFLMY4TE.js";
import {
Math_default
} from "./chunk-WGDFYAGC.js";
import {
Check_default,
DeveloperError_default
} from "./chunk-P6TRGU3S.js";
import {
defined_default
} from "./chunk-YCDZX5LS.js";
// packages/engine/Source/Scene/AttributeType.js
var AttributeType = {
/**
* The attribute is a single component.
*
* @type {string}
* @constant
*/
SCALAR: "SCALAR",
/**
* The attribute is a two-component vector.
*
* @type {string}
* @constant
*/
VEC2: "VEC2",
/**
* The attribute is a three-component vector.
*
* @type {string}
* @constant
*/
VEC3: "VEC3",
/**
* The attribute is a four-component vector.
*
* @type {string}
* @constant
*/
VEC4: "VEC4",
/**
* The attribute is a 2x2 matrix.
*
* @type {string}
* @constant
*/
MAT2: "MAT2",
/**
* The attribute is a 3x3 matrix.
*
* @type {string}
* @constant
*/
MAT3: "MAT3",
/**
* The attribute is a 4x4 matrix.
*
* @type {string}
* @constant
*/
MAT4: "MAT4"
};
AttributeType.getMathType = function(attributeType) {
switch (attributeType) {
case AttributeType.SCALAR:
return Number;
case AttributeType.VEC2:
return Cartesian2_default;
case AttributeType.VEC3:
return Cartesian3_default;
case AttributeType.VEC4:
return Cartesian4_default;
case AttributeType.MAT2:
return Matrix2_default;
case AttributeType.MAT3:
return Matrix3_default;
case AttributeType.MAT4:
return Matrix4_default;
//>>includeStart('debug', pragmas.debug);
default:
throw new DeveloperError_default("attributeType is not a valid value.");
}
};
AttributeType.getNumberOfComponents = function(attributeType) {
switch (attributeType) {
case AttributeType.SCALAR:
return 1;
case AttributeType.VEC2:
return 2;
case AttributeType.VEC3:
return 3;
case AttributeType.VEC4:
case AttributeType.MAT2:
return 4;
case AttributeType.MAT3:
return 9;
case AttributeType.MAT4:
return 16;
//>>includeStart('debug', pragmas.debug);
default:
throw new DeveloperError_default("attributeType is not a valid value.");
}
};
AttributeType.getAttributeLocationCount = function(attributeType) {
switch (attributeType) {
case AttributeType.SCALAR:
case AttributeType.VEC2:
case AttributeType.VEC3:
case AttributeType.VEC4:
return 1;
case AttributeType.MAT2:
return 2;
case AttributeType.MAT3:
return 3;
case AttributeType.MAT4:
return 4;
//>>includeStart('debug', pragmas.debug);
default:
throw new DeveloperError_default("attributeType is not a valid value.");
}
};
AttributeType.getGlslType = function(attributeType) {
Check_default.typeOf.string("attributeType", attributeType);
switch (attributeType) {
case AttributeType.SCALAR:
return "float";
case AttributeType.VEC2:
return "vec2";
case AttributeType.VEC3:
return "vec3";
case AttributeType.VEC4:
return "vec4";
case AttributeType.MAT2:
return "mat2";
case AttributeType.MAT3:
return "mat3";
case AttributeType.MAT4:
return "mat4";
//>>includeStart('debug', pragmas.debug);
default:
throw new DeveloperError_default("attributeType is not a valid value.");
}
};
var AttributeType_default = Object.freeze(AttributeType);
// packages/engine/Source/Core/AttributeCompression.js
var RIGHT_SHIFT = 1 / 256;
var LEFT_SHIFT = 256;
var AttributeCompression = {};
AttributeCompression.octEncodeInRange = function(vector, rangeMax, result) {
Check_default.defined("vector", vector);
Check_default.defined("result", result);
const magSquared = Cartesian3_default.magnitudeSquared(vector);
if (Math.abs(magSquared - 1) > Math_default.EPSILON6) {
throw new DeveloperError_default("vector must be normalized.");
}
result.x = vector.x / (Math.abs(vector.x) + Math.abs(vector.y) + Math.abs(vector.z));
result.y = vector.y / (Math.abs(vector.x) + Math.abs(vector.y) + Math.abs(vector.z));
if (vector.z < 0) {
const x = result.x;
const y = result.y;
result.x = (1 - Math.abs(y)) * Math_default.signNotZero(x);
result.y = (1 - Math.abs(x)) * Math_default.signNotZero(y);
}
result.x = Math_default.toSNorm(result.x, rangeMax);
result.y = Math_default.toSNorm(result.y, rangeMax);
return result;
};
AttributeCompression.octEncode = function(vector, result) {
return AttributeCompression.octEncodeInRange(vector, 255, result);
};
var octEncodeScratch = new Cartesian2_default();
var uint8ForceArray = new Uint8Array(1);
function forceUint8(value) {
uint8ForceArray[0] = value;
return uint8ForceArray[0];
}
AttributeCompression.octEncodeToCartesian4 = function(vector, result) {
AttributeCompression.octEncodeInRange(vector, 65535, octEncodeScratch);
result.x = forceUint8(octEncodeScratch.x * RIGHT_SHIFT);
result.y = forceUint8(octEncodeScratch.x);
result.z = forceUint8(octEncodeScratch.y * RIGHT_SHIFT);
result.w = forceUint8(octEncodeScratch.y);
return result;
};
AttributeCompression.octDecodeInRange = function(x, y, rangeMax, result) {
Check_default.defined("result", result);
if (x < 0 || x > rangeMax || y < 0 || y > rangeMax) {
throw new DeveloperError_default(
`x and y must be unsigned normalized integers between 0 and ${rangeMax}`
);
}
result.x = Math_default.fromSNorm(x, rangeMax);
result.y = Math_default.fromSNorm(y, rangeMax);
result.z = 1 - (Math.abs(result.x) + Math.abs(result.y));
if (result.z < 0) {
const oldVX = result.x;
result.x = (1 - Math.abs(result.y)) * Math_default.signNotZero(oldVX);
result.y = (1 - Math.abs(oldVX)) * Math_default.signNotZero(result.y);
}
return Cartesian3_default.normalize(result, result);
};
AttributeCompression.octDecode = function(x, y, result) {
return AttributeCompression.octDecodeInRange(x, y, 255, result);
};
AttributeCompression.octDecodeFromCartesian4 = function(encoded, result) {
Check_default.typeOf.object("encoded", encoded);
Check_default.typeOf.object("result", result);
const x = encoded.x;
const y = encoded.y;
const z = encoded.z;
const w = encoded.w;
if (x < 0 || x > 255 || y < 0 || y > 255 || z < 0 || z > 255 || w < 0 || w > 255) {
throw new DeveloperError_default(
"x, y, z, and w must be unsigned normalized integers between 0 and 255"
);
}
const xOct16 = x * LEFT_SHIFT + y;
const yOct16 = z * LEFT_SHIFT + w;
return AttributeCompression.octDecodeInRange(xOct16, yOct16, 65535, result);
};
AttributeCompression.octPackFloat = function(encoded) {
Check_default.defined("encoded", encoded);
return 256 * encoded.x + encoded.y;
};
var scratchEncodeCart2 = new Cartesian2_default();
AttributeCompression.octEncodeFloat = function(vector) {
AttributeCompression.octEncode(vector, scratchEncodeCart2);
return AttributeCompression.octPackFloat(scratchEncodeCart2);
};
AttributeCompression.octDecodeFloat = function(value, result) {
Check_default.defined("value", value);
const temp = value / 256;
const x = Math.floor(temp);
const y = (temp - x) * 256;
return AttributeCompression.octDecode(x, y, result);
};
AttributeCompression.octPack = function(v1, v2, v3, result) {
Check_default.defined("v1", v1);
Check_default.defined("v2", v2);
Check_default.defined("v3", v3);
Check_default.defined("result", result);
const encoded1 = AttributeCompression.octEncodeFloat(v1);
const encoded2 = AttributeCompression.octEncodeFloat(v2);
const encoded3 = AttributeCompression.octEncode(v3, scratchEncodeCart2);
result.x = 65536 * encoded3.x + encoded1;
result.y = 65536 * encoded3.y + encoded2;
return result;
};
AttributeCompression.octUnpack = function(packed, v1, v2, v3) {
Check_default.defined("packed", packed);
Check_default.defined("v1", v1);
Check_default.defined("v2", v2);
Check_default.defined("v3", v3);
let temp = packed.x / 65536;
const x = Math.floor(temp);
const encodedFloat1 = (temp - x) * 65536;
temp = packed.y / 65536;
const y = Math.floor(temp);
const encodedFloat2 = (temp - y) * 65536;
AttributeCompression.octDecodeFloat(encodedFloat1, v1);
AttributeCompression.octDecodeFloat(encodedFloat2, v2);
AttributeCompression.octDecode(x, y, v3);
};
AttributeCompression.compressTextureCoordinates = function(textureCoordinates) {
Check_default.defined("textureCoordinates", textureCoordinates);
const x = textureCoordinates.x * 4095 | 0;
const y = textureCoordinates.y * 4095 | 0;
return 4096 * x + y;
};
AttributeCompression.decompressTextureCoordinates = function(compressed, result) {
Check_default.defined("compressed", compressed);
Check_default.defined("result", result);
const temp = compressed / 4096;
const xZeroTo4095 = Math.floor(temp);
result.x = xZeroTo4095 / 4095;
result.y = (compressed - xZeroTo4095 * 4096) / 4095;
return result;
};
function zigZagDecode(value) {
return value >> 1 ^ -(value & 1);
}
AttributeCompression.zigZagDeltaDecode = function(uBuffer, vBuffer, heightBuffer) {
Check_default.defined("uBuffer", uBuffer);
Check_default.defined("vBuffer", vBuffer);
Check_default.typeOf.number.equals(
"uBuffer.length",
"vBuffer.length",
uBuffer.length,
vBuffer.length
);
if (defined_default(heightBuffer)) {
Check_default.typeOf.number.equals(
"uBuffer.length",
"heightBuffer.length",
uBuffer.length,
heightBuffer.length
);
}
const count = uBuffer.length;
let u = 0;
let v = 0;
let height = 0;
for (let i = 0; i < count; ++i) {
u += zigZagDecode(uBuffer[i]);
v += zigZagDecode(vBuffer[i]);
uBuffer[i] = u;
vBuffer[i] = v;
if (defined_default(heightBuffer)) {
height += zigZagDecode(heightBuffer[i]);
heightBuffer[i] = height;
}
}
};
AttributeCompression.dequantize = function(typedArray, componentDatatype, type, count) {
Check_default.defined("typedArray", typedArray);
Check_default.defined("componentDatatype", componentDatatype);
Check_default.defined("type", type);
Check_default.defined("count", count);
const componentsPerAttribute = AttributeType_default.getNumberOfComponents(type);
let divisor;
switch (componentDatatype) {
case ComponentDatatype_default.BYTE:
divisor = 127;
break;
case ComponentDatatype_default.UNSIGNED_BYTE:
divisor = 255;
break;
case ComponentDatatype_default.SHORT:
divisor = 32767;
break;
case ComponentDatatype_default.UNSIGNED_SHORT:
divisor = 65535;
break;
case ComponentDatatype_default.INT:
divisor = 2147483647;
break;
case ComponentDatatype_default.UNSIGNED_INT:
divisor = 4294967295;
break;
//>>includeStart('debug', pragmas.debug);
default:
throw new DeveloperError_default(
`Cannot dequantize component datatype: ${componentDatatype}`
);
}
const dequantizedTypedArray = new Float32Array(
count * componentsPerAttribute
);
for (let i = 0; i < count; i++) {
for (let j = 0; j < componentsPerAttribute; j++) {
const index = i * componentsPerAttribute + j;
dequantizedTypedArray[index] = Math.max(
typedArray[index] / divisor,
-1
);
}
}
return dequantizedTypedArray;
};
AttributeCompression.decodeRGB565 = function(typedArray, result) {
Check_default.defined("typedArray", typedArray);
const expectedLength = typedArray.length * 3;
if (defined_default(result)) {
Check_default.typeOf.number.equals(
"result.length",
"typedArray.length * 3",
result.length,
expectedLength
);
}
const count = typedArray.length;
if (!defined_default(result)) {
result = new Float32Array(count * 3);
}
const mask5 = (1 << 5) - 1;
const mask6 = (1 << 6) - 1;
const normalize5 = 1 / 31;
const normalize6 = 1 / 63;
for (let i = 0; i < count; i++) {
const value = typedArray[i];
const red = value >> 11;
const green = value >> 5 & mask6;
const blue = value & mask5;
const offset = 3 * i;
result[offset] = red * normalize5;
result[offset + 1] = green * normalize6;
result[offset + 2] = blue * normalize5;
}
return result;
};
var AttributeCompression_default = AttributeCompression;
export {
AttributeCompression_default
};
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.121.2
*
* Copyright 2011-2022 Cesium Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Columbus View (Pat. Pend.)
*
* Portions licensed separately.
* See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
*/
import {
defined_default
} from "./chunk-YCDZX5LS.js";
// packages/engine/Source/Core/RuntimeError.js
function RuntimeError(message) {
this.name = "RuntimeError";
this.message = message;
let stack;
try {
throw new Error();
} catch (e) {
stack = e.stack;
}
this.stack = stack;
}
if (defined_default(Object.create)) {
RuntimeError.prototype = Object.create(Error.prototype);
RuntimeError.prototype.constructor = RuntimeError;
}
RuntimeError.prototype.toString = function() {
let str = `${this.name}: ${this.message}`;
if (defined_default(this.stack)) {
str += `
${this.stack.toString()}`;
}
return str;
};
var RuntimeError_default = RuntimeError;
export {
RuntimeError_default
};
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.121.2
*
* Copyright 2011-2022 Cesium Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Columbus View (Pat. Pend.)
*
* Portions licensed separately.
* See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
*/
import {
__commonJS,
__require
} from "./chunk-YCDZX5LS.js";
// node_modules/draco3d/draco_decoder_nodejs.js
var require_draco_decoder_nodejs = __commonJS({
"node_modules/draco3d/draco_decoder_nodejs.js"(exports, module) {
var $jscomp = $jscomp || {};
$jscomp.scope = {};
$jscomp.arrayIteratorImpl = function(k) {
var n = 0;
return function() {
return n < k.length ? { done: false, value: k[n++] } : { done: true };
};
};
$jscomp.arrayIterator = function(k) {
return { next: $jscomp.arrayIteratorImpl(k) };
};
$jscomp.makeIterator = function(k) {
var n = "undefined" != typeof Symbol && Symbol.iterator && k[Symbol.iterator];
return n ? n.call(k) : $jscomp.arrayIterator(k);
};
$jscomp.ASSUME_ES5 = false;
$jscomp.ASSUME_NO_NATIVE_MAP = false;
$jscomp.ASSUME_NO_NATIVE_SET = false;
$jscomp.SIMPLE_FROUND_POLYFILL = false;
$jscomp.ISOLATE_POLYFILLS = false;
$jscomp.FORCE_POLYFILL_PROMISE = false;
$jscomp.FORCE_POLYFILL_PROMISE_WHEN_NO_UNHANDLED_REJECTION = false;
$jscomp.getGlobal = function(k) {
k = ["object" == typeof globalThis && globalThis, k, "object" == typeof window && window, "object" == typeof self && self, "object" == typeof global && global];
for (var n = 0; n < k.length; ++n) {
var l = k[n];
if (l && l.Math == Math) return l;
}
throw Error("Cannot find global object");
};
$jscomp.global = $jscomp.getGlobal(exports);
$jscomp.defineProperty = $jscomp.ASSUME_ES5 || "function" == typeof Object.defineProperties ? Object.defineProperty : function(k, n, l) {
if (k == Array.prototype || k == Object.prototype) return k;
k[n] = l.value;
return k;
};
$jscomp.IS_SYMBOL_NATIVE = "function" === typeof Symbol && "symbol" === typeof Symbol("x");
$jscomp.TRUST_ES6_POLYFILLS = !$jscomp.ISOLATE_POLYFILLS || $jscomp.IS_SYMBOL_NATIVE;
$jscomp.polyfills = {};
$jscomp.propertyToPolyfillSymbol = {};
$jscomp.POLYFILL_PREFIX = "$jscp$";
$jscomp.polyfill = function(k, n, l, p) {
n && ($jscomp.ISOLATE_POLYFILLS ? $jscomp.polyfillIsolated(k, n, l, p) : $jscomp.polyfillUnisolated(k, n, l, p));
};
$jscomp.polyfillUnisolated = function(k, n, l, p) {
l = $jscomp.global;
k = k.split(".");
for (p = 0; p < k.length - 1; p++) {
var h = k[p];
if (!(h in l)) return;
l = l[h];
}
k = k[k.length - 1];
p = l[k];
n = n(p);
n != p && null != n && $jscomp.defineProperty(l, k, { configurable: true, writable: true, value: n });
};
$jscomp.polyfillIsolated = function(k, n, l, p) {
var h = k.split(".");
k = 1 === h.length;
p = h[0];
p = !k && p in $jscomp.polyfills ? $jscomp.polyfills : $jscomp.global;
for (var A = 0; A < h.length - 1; A++) {
var f = h[A];
if (!(f in p)) return;
p = p[f];
}
h = h[h.length - 1];
l = $jscomp.IS_SYMBOL_NATIVE && "es6" === l ? p[h] : null;
n = n(l);
null != n && (k ? $jscomp.defineProperty($jscomp.polyfills, h, { configurable: true, writable: true, value: n }) : n !== l && (void 0 === $jscomp.propertyToPolyfillSymbol[h] && (l = 1e9 * Math.random() >>> 0, $jscomp.propertyToPolyfillSymbol[h] = $jscomp.IS_SYMBOL_NATIVE ? $jscomp.global.Symbol(h) : $jscomp.POLYFILL_PREFIX + l + "$" + h), $jscomp.defineProperty(p, $jscomp.propertyToPolyfillSymbol[h], { configurable: true, writable: true, value: n })));
};
$jscomp.polyfill("Promise", function(k) {
function n() {
this.batch_ = null;
}
function l(f) {
return f instanceof h ? f : new h(function(q, v) {
q(f);
});
}
if (k && (!($jscomp.FORCE_POLYFILL_PROMISE || $jscomp.FORCE_POLYFILL_PROMISE_WHEN_NO_UNHANDLED_REJECTION && "undefined" === typeof $jscomp.global.PromiseRejectionEvent) || !$jscomp.global.Promise || -1 === $jscomp.global.Promise.toString().indexOf("[native code]"))) return k;
n.prototype.asyncExecute = function(f) {
if (null == this.batch_) {
this.batch_ = [];
var q = this;
this.asyncExecuteFunction(function() {
q.executeBatch_();
});
}
this.batch_.push(f);
};
var p = $jscomp.global.setTimeout;
n.prototype.asyncExecuteFunction = function(f) {
p(f, 0);
};
n.prototype.executeBatch_ = function() {
for (; this.batch_ && this.batch_.length; ) {
var f = this.batch_;
this.batch_ = [];
for (var q = 0; q < f.length; ++q) {
var v = f[q];
f[q] = null;
try {
v();
} catch (z) {
this.asyncThrow_(z);
}
}
}
this.batch_ = null;
};
n.prototype.asyncThrow_ = function(f) {
this.asyncExecuteFunction(function() {
throw f;
});
};
var h = function(f) {
this.state_ = 0;
this.result_ = void 0;
this.onSettledCallbacks_ = [];
this.isRejectionHandled_ = false;
var q = this.createResolveAndReject_();
try {
f(q.resolve, q.reject);
} catch (v) {
q.reject(v);
}
};
h.prototype.createResolveAndReject_ = function() {
function f(z) {
return function(O) {
v || (v = true, z.call(q, O));
};
}
var q = this, v = false;
return { resolve: f(this.resolveTo_), reject: f(this.reject_) };
};
h.prototype.resolveTo_ = function(f) {
if (f === this) this.reject_(new TypeError("A Promise cannot resolve to itself"));
else if (f instanceof h) this.settleSameAsPromise_(f);
else {
a: switch (typeof f) {
case "object":
var q = null != f;
break a;
case "function":
q = true;
break a;
default:
q = false;
}
q ? this.resolveToNonPromiseObj_(f) : this.fulfill_(f);
}
};
h.prototype.resolveToNonPromiseObj_ = function(f) {
var q = void 0;
try {
q = f.then;
} catch (v) {
this.reject_(v);
return;
}
"function" == typeof q ? this.settleSameAsThenable_(q, f) : this.fulfill_(f);
};
h.prototype.reject_ = function(f) {
this.settle_(2, f);
};
h.prototype.fulfill_ = function(f) {
this.settle_(1, f);
};
h.prototype.settle_ = function(f, q) {
if (0 != this.state_) throw Error("Cannot settle(" + f + ", " + q + "): Promise already settled in state" + this.state_);
this.state_ = f;
this.result_ = q;
2 === this.state_ && this.scheduleUnhandledRejectionCheck_();
this.executeOnSettledCallbacks_();
};
h.prototype.scheduleUnhandledRejectionCheck_ = function() {
var f = this;
p(function() {
if (f.notifyUnhandledRejection_()) {
var q = $jscomp.global.console;
"undefined" !== typeof q && q.error(f.result_);
}
}, 1);
};
h.prototype.notifyUnhandledRejection_ = function() {
if (this.isRejectionHandled_) return false;
var f = $jscomp.global.CustomEvent, q = $jscomp.global.Event, v = $jscomp.global.dispatchEvent;
if ("undefined" === typeof v) return true;
"function" === typeof f ? f = new f("unhandledrejection", { cancelable: true }) : "function" === typeof q ? f = new q("unhandledrejection", { cancelable: true }) : (f = $jscomp.global.document.createEvent("CustomEvent"), f.initCustomEvent("unhandledrejection", false, true, f));
f.promise = this;
f.reason = this.result_;
return v(f);
};
h.prototype.executeOnSettledCallbacks_ = function() {
if (null != this.onSettledCallbacks_) {
for (var f = 0; f < this.onSettledCallbacks_.length; ++f) A.asyncExecute(this.onSettledCallbacks_[f]);
this.onSettledCallbacks_ = null;
}
};
var A = new n();
h.prototype.settleSameAsPromise_ = function(f) {
var q = this.createResolveAndReject_();
f.callWhenSettled_(q.resolve, q.reject);
};
h.prototype.settleSameAsThenable_ = function(f, q) {
var v = this.createResolveAndReject_();
try {
f.call(q, v.resolve, v.reject);
} catch (z) {
v.reject(z);
}
};
h.prototype.then = function(f, q) {
function v(t, x) {
return "function" == typeof t ? function(D) {
try {
z(t(D));
} catch (R) {
O(R);
}
} : x;
}
var z, O, ba = new h(function(t, x) {
z = t;
O = x;
});
this.callWhenSettled_(v(f, z), v(q, O));
return ba;
};
h.prototype.catch = function(f) {
return this.then(void 0, f);
};
h.prototype.callWhenSettled_ = function(f, q) {
function v() {
switch (z.state_) {
case 1:
f(z.result_);
break;
case 2:
q(z.result_);
break;
default:
throw Error("Unexpected state: " + z.state_);
}
}
var z = this;
null == this.onSettledCallbacks_ ? A.asyncExecute(v) : this.onSettledCallbacks_.push(v);
this.isRejectionHandled_ = true;
};
h.resolve = l;
h.reject = function(f) {
return new h(function(q, v) {
v(f);
});
};
h.race = function(f) {
return new h(function(q, v) {
for (var z = $jscomp.makeIterator(f), O = z.next(); !O.done; O = z.next()) l(O.value).callWhenSettled_(q, v);
});
};
h.all = function(f) {
var q = $jscomp.makeIterator(f), v = q.next();
return v.done ? l([]) : new h(function(z, O) {
function ba(D) {
return function(R) {
t[D] = R;
x--;
0 == x && z(t);
};
}
var t = [], x = 0;
do
t.push(void 0), x++, l(v.value).callWhenSettled_(ba(t.length - 1), O), v = q.next();
while (!v.done);
});
};
return h;
}, "es6", "es3");
$jscomp.owns = function(k, n) {
return Object.prototype.hasOwnProperty.call(k, n);
};
$jscomp.assign = $jscomp.TRUST_ES6_POLYFILLS && "function" == typeof Object.assign ? Object.assign : function(k, n) {
for (var l = 1; l < arguments.length; l++) {
var p = arguments[l];
if (p) for (var h in p) $jscomp.owns(p, h) && (k[h] = p[h]);
}
return k;
};
$jscomp.polyfill("Object.assign", function(k) {
return k || $jscomp.assign;
}, "es6", "es3");
$jscomp.checkStringArgs = function(k, n, l) {
if (null == k) throw new TypeError("The 'this' value for String.prototype." + l + " must not be null or undefined");
if (n instanceof RegExp) throw new TypeError("First argument to String.prototype." + l + " must not be a regular expression");
return k + "";
};
$jscomp.polyfill("String.prototype.startsWith", function(k) {
return k ? k : function(n, l) {
var p = $jscomp.checkStringArgs(this, n, "startsWith");
n += "";
var h = p.length, A = n.length;
l = Math.max(0, Math.min(l | 0, p.length));
for (var f = 0; f < A && l < h; ) if (p[l++] != n[f++]) return false;
return f >= A;
};
}, "es6", "es3");
$jscomp.polyfill("Array.prototype.copyWithin", function(k) {
function n(l) {
l = Number(l);
return Infinity === l || -Infinity === l ? l : l | 0;
}
return k ? k : function(l, p, h) {
var A = this.length;
l = n(l);
p = n(p);
h = void 0 === h ? A : n(h);
l = 0 > l ? Math.max(A + l, 0) : Math.min(l, A);
p = 0 > p ? Math.max(A + p, 0) : Math.min(p, A);
h = 0 > h ? Math.max(A + h, 0) : Math.min(h, A);
if (l < p) for (; p < h; ) p in this ? this[l++] = this[p++] : (delete this[l++], p++);
else for (h = Math.min(h, A + p - l), l += h - p; h > p; ) --h in this ? this[--l] = this[h] : delete this[--l];
return this;
};
}, "es6", "es3");
$jscomp.typedArrayCopyWithin = function(k) {
return k ? k : Array.prototype.copyWithin;
};
$jscomp.polyfill("Int8Array.prototype.copyWithin", $jscomp.typedArrayCopyWithin, "es6", "es5");
$jscomp.polyfill("Uint8Array.prototype.copyWithin", $jscomp.typedArrayCopyWithin, "es6", "es5");
$jscomp.polyfill("Uint8ClampedArray.prototype.copyWithin", $jscomp.typedArrayCopyWithin, "es6", "es5");
$jscomp.polyfill("Int16Array.prototype.copyWithin", $jscomp.typedArrayCopyWithin, "es6", "es5");
$jscomp.polyfill("Uint16Array.prototype.copyWithin", $jscomp.typedArrayCopyWithin, "es6", "es5");
$jscomp.polyfill("Int32Array.prototype.copyWithin", $jscomp.typedArrayCopyWithin, "es6", "es5");
$jscomp.polyfill("Uint32Array.prototype.copyWithin", $jscomp.typedArrayCopyWithin, "es6", "es5");
$jscomp.polyfill("Float32Array.prototype.copyWithin", $jscomp.typedArrayCopyWithin, "es6", "es5");
$jscomp.polyfill("Float64Array.prototype.copyWithin", $jscomp.typedArrayCopyWithin, "es6", "es5");
var DracoDecoderModule = function() {
var k = "undefined" !== typeof document && document.currentScript ? document.currentScript.src : void 0;
"undefined" !== typeof __filename && (k = k || __filename);
return function(n) {
function l(e) {
return a.locateFile ? a.locateFile(e, U) : U + e;
}
function p(e, b, c) {
var d = b + c;
for (c = b; e[c] && !(c >= d); ) ++c;
if (16 < c - b && e.buffer && va) return va.decode(e.subarray(b, c));
for (d = ""; b < c; ) {
var g = e[b++];
if (g & 128) {
var u = e[b++] & 63;
if (192 == (g & 224)) d += String.fromCharCode((g & 31) << 6 | u);
else {
var X = e[b++] & 63;
g = 224 == (g & 240) ? (g & 15) << 12 | u << 6 | X : (g & 7) << 18 | u << 12 | X << 6 | e[b++] & 63;
65536 > g ? d += String.fromCharCode(g) : (g -= 65536, d += String.fromCharCode(55296 | g >> 10, 56320 | g & 1023));
}
} else d += String.fromCharCode(g);
}
return d;
}
function h(e, b) {
return e ? p(ea, e, b) : "";
}
function A() {
var e = ja.buffer;
a.HEAP8 = Y = new Int8Array(e);
a.HEAP16 = new Int16Array(e);
a.HEAP32 = ca = new Int32Array(e);
a.HEAPU8 = ea = new Uint8Array(e);
a.HEAPU16 = new Uint16Array(e);
a.HEAPU32 = V = new Uint32Array(e);
a.HEAPF32 = new Float32Array(e);
a.HEAPF64 = new Float64Array(e);
}
function f(e) {
if (a.onAbort) a.onAbort(e);
e = "Aborted(" + e + ")";
da(e);
wa = true;
e = new WebAssembly.RuntimeError(e + ". Build with -sASSERTIONS for more info.");
ka(e);
throw e;
}
function q(e) {
try {
if (e == P && fa) return new Uint8Array(fa);
if (ma) return ma(e);
throw "both async and sync fetching of the wasm failed";
} catch (b) {
f(b);
}
}
function v() {
if (!fa && (xa || ha)) {
if ("function" == typeof fetch && !P.startsWith("file://")) return fetch(P, { credentials: "same-origin" }).then(function(e) {
if (!e.ok) throw "failed to load wasm binary file at '" + P + "'";
return e.arrayBuffer();
}).catch(function() {
return q(P);
});
if (na) return new Promise(function(e, b) {
na(P, function(c) {
e(new Uint8Array(c));
}, b);
});
}
return Promise.resolve().then(function() {
return q(P);
});
}
function z(e) {
for (; 0 < e.length; ) e.shift()(a);
}
function O(e) {
this.excPtr = e;
this.ptr = e - 24;
this.set_type = function(b) {
V[this.ptr + 4 >> 2] = b;
};
this.get_type = function() {
return V[this.ptr + 4 >> 2];
};
this.set_destructor = function(b) {
V[this.ptr + 8 >> 2] = b;
};
this.get_destructor = function() {
return V[this.ptr + 8 >> 2];
};
this.set_refcount = function(b) {
ca[this.ptr >> 2] = b;
};
this.set_caught = function(b) {
Y[this.ptr + 12 >> 0] = b ? 1 : 0;
};
this.get_caught = function() {
return 0 != Y[this.ptr + 12 >> 0];
};
this.set_rethrown = function(b) {
Y[this.ptr + 13 >> 0] = b ? 1 : 0;
};
this.get_rethrown = function() {
return 0 != Y[this.ptr + 13 >> 0];
};
this.init = function(b, c) {
this.set_adjusted_ptr(0);
this.set_type(b);
this.set_destructor(c);
this.set_refcount(0);
this.set_caught(false);
this.set_rethrown(false);
};
this.add_ref = function() {
ca[this.ptr >> 2] += 1;
};
this.release_ref = function() {
var b = ca[this.ptr >> 2];
ca[this.ptr >> 2] = b - 1;
return 1 === b;
};
this.set_adjusted_ptr = function(b) {
V[this.ptr + 16 >> 2] = b;
};
this.get_adjusted_ptr = function() {
return V[this.ptr + 16 >> 2];
};
this.get_exception_ptr = function() {
if (ya(this.get_type())) return V[this.excPtr >> 2];
var b = this.get_adjusted_ptr();
return 0 !== b ? b : this.excPtr;
};
}
function ba() {
function e() {
if (!la && (la = true, a.calledRun = true, !wa)) {
za = true;
z(oa);
Aa(a);
if (a.onRuntimeInitialized) a.onRuntimeInitialized();
if (a.postRun) for ("function" == typeof a.postRun && (a.postRun = [a.postRun]); a.postRun.length; ) Ba.unshift(a.postRun.shift());
z(Ba);
}
}
if (!(0 < aa)) {
if (a.preRun) for ("function" == typeof a.preRun && (a.preRun = [a.preRun]); a.preRun.length; ) Ca.unshift(a.preRun.shift());
z(Ca);
0 < aa || (a.setStatus ? (a.setStatus("Running..."), setTimeout(function() {
setTimeout(function() {
a.setStatus("");
}, 1);
e();
}, 1)) : e());
}
}
function t() {
}
function x(e) {
return (e || t).__cache__;
}
function D(e, b) {
var c = x(b), d = c[e];
if (d) return d;
d = Object.create((b || t).prototype);
d.ptr = e;
return c[e] = d;
}
function R(e) {
if ("string" === typeof e) {
for (var b = 0, c = 0; c < e.length; ++c) {
var d = e.charCodeAt(c);
127 >= d ? b++ : 2047 >= d ? b += 2 : 55296 <= d && 57343 >= d ? (b += 4, ++c) : b += 3;
}
b = Array(b + 1);
c = 0;
d = b.length;
if (0 < d) {
d = c + d - 1;
for (var g = 0; g < e.length; ++g) {
var u = e.charCodeAt(g);
if (55296 <= u && 57343 >= u) {
var X = e.charCodeAt(++g);
u = 65536 + ((u & 1023) << 10) | X & 1023;
}
if (127 >= u) {
if (c >= d) break;
b[c++] = u;
} else {
if (2047 >= u) {
if (c + 1 >= d) break;
b[c++] = 192 | u >> 6;
} else {
if (65535 >= u) {
if (c + 2 >= d) break;
b[c++] = 224 | u >> 12;
} else {
if (c + 3 >= d) break;
b[c++] = 240 | u >> 18;
b[c++] = 128 | u >> 12 & 63;
}
b[c++] = 128 | u >> 6 & 63;
}
b[c++] = 128 | u & 63;
}
}
b[c] = 0;
}
e = r.alloc(b, Y);
r.copy(b, Y, e);
return e;
}
return e;
}
function pa(e) {
if ("object" === typeof e) {
var b = r.alloc(e, Y);
r.copy(e, Y, b);
return b;
}
return e;
}
function Z() {
throw "cannot construct a VoidPtr, no constructor in IDL";
}
function S() {
this.ptr = Da();
x(S)[this.ptr] = this;
}
function Q() {
this.ptr = Ea();
x(Q)[this.ptr] = this;
}
function W() {
this.ptr = Fa();
x(W)[this.ptr] = this;
}
function w() {
this.ptr = Ga();
x(w)[this.ptr] = this;
}
function C() {
this.ptr = Ha();
x(C)[this.ptr] = this;
}
function F() {
this.ptr = Ia();
x(F)[this.ptr] = this;
}
function G() {
this.ptr = Ja();
x(G)[this.ptr] = this;
}
function E() {
this.ptr = Ka();
x(E)[this.ptr] = this;
}
function T() {
this.ptr = La();
x(T)[this.ptr] = this;
}
function B() {
throw "cannot construct a Status, no constructor in IDL";
}
function H() {
this.ptr = Ma();
x(H)[this.ptr] = this;
}
function I() {
this.ptr = Na();
x(I)[this.ptr] = this;
}
function J() {
this.ptr = Oa();
x(J)[this.ptr] = this;
}
function K() {
this.ptr = Pa();
x(K)[this.ptr] = this;
}
function L() {
this.ptr = Qa();
x(L)[this.ptr] = this;
}
function M() {
this.ptr = Ra();
x(M)[this.ptr] = this;
}
function N() {
this.ptr = Sa();
x(N)[this.ptr] = this;
}
function y() {
this.ptr = Ta();
x(y)[this.ptr] = this;
}
function m() {
this.ptr = Ua();
x(m)[this.ptr] = this;
}
n = void 0 === n ? {} : n;
var a = "undefined" != typeof n ? n : {}, Aa, ka;
a.ready = new Promise(function(e, b) {
Aa = e;
ka = b;
});
var Va = false, Wa = false;
a.onRuntimeInitialized = function() {
Va = true;
if (Wa && "function" === typeof a.onModuleLoaded) a.onModuleLoaded(a);
};
a.onModuleParsed = function() {
Wa = true;
if (Va && "function" === typeof a.onModuleLoaded) a.onModuleLoaded(a);
};
a.isVersionSupported = function(e) {
if ("string" !== typeof e) return false;
e = e.split(".");
return 2 > e.length || 3 < e.length ? false : 1 == e[0] && 0 <= e[1] && 5 >= e[1] ? true : 0 != e[0] || 10 < e[1] ? false : true;
};
var Xa = Object.assign({}, a), xa = "object" == typeof window, ha = "function" == typeof importScripts, Ya = "object" == typeof process && "object" == typeof process.versions && "string" == typeof process.versions.node, U = "";
if (Ya) {
var Za = __require("fs"), qa = __require("path");
U = ha ? qa.dirname(U) + "/" : __dirname + "/";
var $a = function(e, b) {
e = e.startsWith("file://") ? new URL(e) : qa.normalize(e);
return Za.readFileSync(e, b ? void 0 : "utf8");
};
var ma = function(e) {
e = $a(e, true);
e.buffer || (e = new Uint8Array(e));
return e;
};
var na = function(e, b, c) {
e = e.startsWith("file://") ? new URL(e) : qa.normalize(e);
Za.readFile(e, function(d, g) {
d ? c(d) : b(g.buffer);
});
};
1 < process.argv.length && process.argv[1].replace(/\\/g, "/");
process.argv.slice(2);
a.inspect = function() {
return "[Emscripten Module object]";
};
} else if (xa || ha) ha ? U = self.location.href : "undefined" != typeof document && document.currentScript && (U = document.currentScript.src), k && (U = k), U = 0 !== U.indexOf("blob:") ? U.substr(0, U.replace(/[?#].*/, "").lastIndexOf("/") + 1) : "", $a = function(e) {
var b = new XMLHttpRequest();
b.open("GET", e, false);
b.send(null);
return b.responseText;
}, ha && (ma = function(e) {
var b = new XMLHttpRequest();
b.open("GET", e, false);
b.responseType = "arraybuffer";
b.send(null);
return new Uint8Array(b.response);
}), na = function(e, b, c) {
var d = new XMLHttpRequest();
d.open("GET", e, true);
d.responseType = "arraybuffer";
d.onload = function() {
200 == d.status || 0 == d.status && d.response ? b(d.response) : c();
};
d.onerror = c;
d.send(null);
};
var ud = a.print || console.log.bind(console), da = a.printErr || console.warn.bind(console);
Object.assign(a, Xa);
Xa = null;
var fa;
a.wasmBinary && (fa = a.wasmBinary);
"object" != typeof WebAssembly && f("no native wasm support detected");
var ja, wa = false, va = "undefined" != typeof TextDecoder ? new TextDecoder("utf8") : void 0, Y, ea, ca, V, Ca = [], oa = [], Ba = [], za = false, aa = 0, ra = null, ia = null;
var P = "draco_decoder.wasm";
P.startsWith("data:application/octet-stream;base64,") || (P = l(P));
var vd = 0, wd = [null, [], []], xd = { b: function(e, b, c) {
new O(e).init(b, c);
vd++;
throw e;
}, a: function() {
f("");
}, g: function(e, b, c) {
ea.copyWithin(e, b, b + c);
}, e: function(e) {
var b = ea.length;
e >>>= 0;
if (2147483648 < e) return false;
for (var c = 1; 4 >= c; c *= 2) {
var d = b * (1 + 0.2 / c);
d = Math.min(d, e + 100663296);
var g = Math;
d = Math.max(e, d);
g = g.min.call(g, 2147483648, d + (65536 - d % 65536) % 65536);
a: {
d = ja.buffer;
try {
ja.grow(g - d.byteLength + 65535 >>> 16);
A();
var u = 1;
break a;
} catch (X) {
}
u = void 0;
}
if (u) return true;
}
return false;
}, f: function(e) {
return 52;
}, d: function(e, b, c, d, g) {
return 70;
}, c: function(e, b, c, d) {
for (var g = 0, u = 0; u < c; u++) {
var X = V[b >> 2], ab = V[b + 4 >> 2];
b += 8;
for (var sa = 0; sa < ab; sa++) {
var ta = ea[X + sa], ua = wd[e];
0 === ta || 10 === ta ? ((1 === e ? ud : da)(p(ua, 0)), ua.length = 0) : ua.push(ta);
}
g += ab;
}
V[d >> 2] = g;
return 0;
} };
(function() {
function e(g, u) {
a.asm = g.exports;
ja = a.asm.h;
A();
oa.unshift(a.asm.i);
aa--;
a.monitorRunDependencies && a.monitorRunDependencies(aa);
0 == aa && (null !== ra && (clearInterval(ra), ra = null), ia && (g = ia, ia = null, g()));
}
function b(g) {
e(g.instance);
}
function c(g) {
return v().then(function(u) {
return WebAssembly.instantiate(u, d);
}).then(function(u) {
return u;
}).then(g, function(u) {
da("failed to asynchronously prepare wasm: " + u);
f(u);
});
}
var d = { a: xd };
aa++;
a.monitorRunDependencies && a.monitorRunDependencies(aa);
if (a.instantiateWasm) try {
return a.instantiateWasm(d, e);
} catch (g) {
da("Module.instantiateWasm callback failed with error: " + g), ka(g);
}
(function() {
return fa || "function" != typeof WebAssembly.instantiateStreaming || P.startsWith("data:application/octet-stream;base64,") || P.startsWith("file://") || Ya || "function" != typeof fetch ? c(b) : fetch(P, { credentials: "same-origin" }).then(function(g) {
return WebAssembly.instantiateStreaming(g, d).then(b, function(u) {
da("wasm streaming compile failed: " + u);
da("falling back to ArrayBuffer instantiation");
return c(b);
});
});
})().catch(ka);
return {};
})();
var bb = a._emscripten_bind_VoidPtr___destroy___0 = function() {
return (bb = a._emscripten_bind_VoidPtr___destroy___0 = a.asm.k).apply(null, arguments);
}, Da = a._emscripten_bind_DecoderBuffer_DecoderBuffer_0 = function() {
return (Da = a._emscripten_bind_DecoderBuffer_DecoderBuffer_0 = a.asm.l).apply(null, arguments);
}, cb = a._emscripten_bind_DecoderBuffer_Init_2 = function() {
return (cb = a._emscripten_bind_DecoderBuffer_Init_2 = a.asm.m).apply(null, arguments);
}, db = a._emscripten_bind_DecoderBuffer___destroy___0 = function() {
return (db = a._emscripten_bind_DecoderBuffer___destroy___0 = a.asm.n).apply(null, arguments);
}, Ea = a._emscripten_bind_AttributeTransformData_AttributeTransformData_0 = function() {
return (Ea = a._emscripten_bind_AttributeTransformData_AttributeTransformData_0 = a.asm.o).apply(null, arguments);
}, eb = a._emscripten_bind_AttributeTransformData_transform_type_0 = function() {
return (eb = a._emscripten_bind_AttributeTransformData_transform_type_0 = a.asm.p).apply(null, arguments);
}, fb = a._emscripten_bind_AttributeTransformData___destroy___0 = function() {
return (fb = a._emscripten_bind_AttributeTransformData___destroy___0 = a.asm.q).apply(null, arguments);
}, Fa = a._emscripten_bind_GeometryAttribute_GeometryAttribute_0 = function() {
return (Fa = a._emscripten_bind_GeometryAttribute_GeometryAttribute_0 = a.asm.r).apply(null, arguments);
}, gb = a._emscripten_bind_GeometryAttribute___destroy___0 = function() {
return (gb = a._emscripten_bind_GeometryAttribute___destroy___0 = a.asm.s).apply(null, arguments);
}, Ga = a._emscripten_bind_PointAttribute_PointAttribute_0 = function() {
return (Ga = a._emscripten_bind_PointAttribute_PointAttribute_0 = a.asm.t).apply(null, arguments);
}, hb = a._emscripten_bind_PointAttribute_size_0 = function() {
return (hb = a._emscripten_bind_PointAttribute_size_0 = a.asm.u).apply(null, arguments);
}, ib = a._emscripten_bind_PointAttribute_GetAttributeTransformData_0 = function() {
return (ib = a._emscripten_bind_PointAttribute_GetAttributeTransformData_0 = a.asm.v).apply(null, arguments);
}, jb = a._emscripten_bind_PointAttribute_attribute_type_0 = function() {
return (jb = a._emscripten_bind_PointAttribute_attribute_type_0 = a.asm.w).apply(null, arguments);
}, kb = a._emscripten_bind_PointAttribute_data_type_0 = function() {
return (kb = a._emscripten_bind_PointAttribute_data_type_0 = a.asm.x).apply(null, arguments);
}, lb = a._emscripten_bind_PointAttribute_num_components_0 = function() {
return (lb = a._emscripten_bind_PointAttribute_num_components_0 = a.asm.y).apply(null, arguments);
}, mb = a._emscripten_bind_PointAttribute_normalized_0 = function() {
return (mb = a._emscripten_bind_PointAttribute_normalized_0 = a.asm.z).apply(null, arguments);
}, nb = a._emscripten_bind_PointAttribute_byte_stride_0 = function() {
return (nb = a._emscripten_bind_PointAttribute_byte_stride_0 = a.asm.A).apply(null, arguments);
}, ob = a._emscripten_bind_PointAttribute_byte_offset_0 = function() {
return (ob = a._emscripten_bind_PointAttribute_byte_offset_0 = a.asm.B).apply(null, arguments);
}, pb = a._emscripten_bind_PointAttribute_unique_id_0 = function() {
return (pb = a._emscripten_bind_PointAttribute_unique_id_0 = a.asm.C).apply(null, arguments);
}, qb = a._emscripten_bind_PointAttribute___destroy___0 = function() {
return (qb = a._emscripten_bind_PointAttribute___destroy___0 = a.asm.D).apply(null, arguments);
}, Ha = a._emscripten_bind_AttributeQuantizationTransform_AttributeQuantizationTransform_0 = function() {
return (Ha = a._emscripten_bind_AttributeQuantizationTransform_AttributeQuantizationTransform_0 = a.asm.E).apply(null, arguments);
}, rb = a._emscripten_bind_AttributeQuantizationTransform_InitFromAttribute_1 = function() {
return (rb = a._emscripten_bind_AttributeQuantizationTransform_InitFromAttribute_1 = a.asm.F).apply(null, arguments);
}, sb = a._emscripten_bind_AttributeQuantizationTransform_quantization_bits_0 = function() {
return (sb = a._emscripten_bind_AttributeQuantizationTransform_quantization_bits_0 = a.asm.G).apply(null, arguments);
}, tb = a._emscripten_bind_AttributeQuantizationTransform_min_value_1 = function() {
return (tb = a._emscripten_bind_AttributeQuantizationTransform_min_value_1 = a.asm.H).apply(null, arguments);
}, ub = a._emscripten_bind_AttributeQuantizationTransform_range_0 = function() {
return (ub = a._emscripten_bind_AttributeQuantizationTransform_range_0 = a.asm.I).apply(null, arguments);
}, vb = a._emscripten_bind_AttributeQuantizationTransform___destroy___0 = function() {
return (vb = a._emscripten_bind_AttributeQuantizationTransform___destroy___0 = a.asm.J).apply(null, arguments);
}, Ia = a._emscripten_bind_AttributeOctahedronTransform_AttributeOctahedronTransform_0 = function() {
return (Ia = a._emscripten_bind_AttributeOctahedronTransform_AttributeOctahedronTransform_0 = a.asm.K).apply(null, arguments);
}, wb = a._emscripten_bind_AttributeOctahedronTransform_InitFromAttribute_1 = function() {
return (wb = a._emscripten_bind_AttributeOctahedronTransform_InitFromAttribute_1 = a.asm.L).apply(
null,
arguments
);
}, xb = a._emscripten_bind_AttributeOctahedronTransform_quantization_bits_0 = function() {
return (xb = a._emscripten_bind_AttributeOctahedronTransform_quantization_bits_0 = a.asm.M).apply(null, arguments);
}, yb = a._emscripten_bind_AttributeOctahedronTransform___destroy___0 = function() {
return (yb = a._emscripten_bind_AttributeOctahedronTransform___destroy___0 = a.asm.N).apply(null, arguments);
}, Ja = a._emscripten_bind_PointCloud_PointCloud_0 = function() {
return (Ja = a._emscripten_bind_PointCloud_PointCloud_0 = a.asm.O).apply(
null,
arguments
);
}, zb = a._emscripten_bind_PointCloud_num_attributes_0 = function() {
return (zb = a._emscripten_bind_PointCloud_num_attributes_0 = a.asm.P).apply(null, arguments);
}, Ab = a._emscripten_bind_PointCloud_num_points_0 = function() {
return (Ab = a._emscripten_bind_PointCloud_num_points_0 = a.asm.Q).apply(null, arguments);
}, Bb = a._emscripten_bind_PointCloud___destroy___0 = function() {
return (Bb = a._emscripten_bind_PointCloud___destroy___0 = a.asm.R).apply(null, arguments);
}, Ka = a._emscripten_bind_Mesh_Mesh_0 = function() {
return (Ka = a._emscripten_bind_Mesh_Mesh_0 = a.asm.S).apply(null, arguments);
}, Cb = a._emscripten_bind_Mesh_num_faces_0 = function() {
return (Cb = a._emscripten_bind_Mesh_num_faces_0 = a.asm.T).apply(null, arguments);
}, Db = a._emscripten_bind_Mesh_num_attributes_0 = function() {
return (Db = a._emscripten_bind_Mesh_num_attributes_0 = a.asm.U).apply(null, arguments);
}, Eb = a._emscripten_bind_Mesh_num_points_0 = function() {
return (Eb = a._emscripten_bind_Mesh_num_points_0 = a.asm.V).apply(null, arguments);
}, Fb = a._emscripten_bind_Mesh___destroy___0 = function() {
return (Fb = a._emscripten_bind_Mesh___destroy___0 = a.asm.W).apply(null, arguments);
}, La = a._emscripten_bind_Metadata_Metadata_0 = function() {
return (La = a._emscripten_bind_Metadata_Metadata_0 = a.asm.X).apply(null, arguments);
}, Gb = a._emscripten_bind_Metadata___destroy___0 = function() {
return (Gb = a._emscripten_bind_Metadata___destroy___0 = a.asm.Y).apply(null, arguments);
}, Hb = a._emscripten_bind_Status_code_0 = function() {
return (Hb = a._emscripten_bind_Status_code_0 = a.asm.Z).apply(null, arguments);
}, Ib = a._emscripten_bind_Status_ok_0 = function() {
return (Ib = a._emscripten_bind_Status_ok_0 = a.asm._).apply(null, arguments);
}, Jb = a._emscripten_bind_Status_error_msg_0 = function() {
return (Jb = a._emscripten_bind_Status_error_msg_0 = a.asm.$).apply(null, arguments);
}, Kb = a._emscripten_bind_Status___destroy___0 = function() {
return (Kb = a._emscripten_bind_Status___destroy___0 = a.asm.aa).apply(null, arguments);
}, Ma = a._emscripten_bind_DracoFloat32Array_DracoFloat32Array_0 = function() {
return (Ma = a._emscripten_bind_DracoFloat32Array_DracoFloat32Array_0 = a.asm.ba).apply(null, arguments);
}, Lb = a._emscripten_bind_DracoFloat32Array_GetValue_1 = function() {
return (Lb = a._emscripten_bind_DracoFloat32Array_GetValue_1 = a.asm.ca).apply(null, arguments);
}, Mb = a._emscripten_bind_DracoFloat32Array_size_0 = function() {
return (Mb = a._emscripten_bind_DracoFloat32Array_size_0 = a.asm.da).apply(null, arguments);
}, Nb = a._emscripten_bind_DracoFloat32Array___destroy___0 = function() {
return (Nb = a._emscripten_bind_DracoFloat32Array___destroy___0 = a.asm.ea).apply(null, arguments);
}, Na = a._emscripten_bind_DracoInt8Array_DracoInt8Array_0 = function() {
return (Na = a._emscripten_bind_DracoInt8Array_DracoInt8Array_0 = a.asm.fa).apply(null, arguments);
}, Ob = a._emscripten_bind_DracoInt8Array_GetValue_1 = function() {
return (Ob = a._emscripten_bind_DracoInt8Array_GetValue_1 = a.asm.ga).apply(null, arguments);
}, Pb = a._emscripten_bind_DracoInt8Array_size_0 = function() {
return (Pb = a._emscripten_bind_DracoInt8Array_size_0 = a.asm.ha).apply(null, arguments);
}, Qb = a._emscripten_bind_DracoInt8Array___destroy___0 = function() {
return (Qb = a._emscripten_bind_DracoInt8Array___destroy___0 = a.asm.ia).apply(null, arguments);
}, Oa = a._emscripten_bind_DracoUInt8Array_DracoUInt8Array_0 = function() {
return (Oa = a._emscripten_bind_DracoUInt8Array_DracoUInt8Array_0 = a.asm.ja).apply(null, arguments);
}, Rb = a._emscripten_bind_DracoUInt8Array_GetValue_1 = function() {
return (Rb = a._emscripten_bind_DracoUInt8Array_GetValue_1 = a.asm.ka).apply(null, arguments);
}, Sb = a._emscripten_bind_DracoUInt8Array_size_0 = function() {
return (Sb = a._emscripten_bind_DracoUInt8Array_size_0 = a.asm.la).apply(null, arguments);
}, Tb = a._emscripten_bind_DracoUInt8Array___destroy___0 = function() {
return (Tb = a._emscripten_bind_DracoUInt8Array___destroy___0 = a.asm.ma).apply(null, arguments);
}, Pa = a._emscripten_bind_DracoInt16Array_DracoInt16Array_0 = function() {
return (Pa = a._emscripten_bind_DracoInt16Array_DracoInt16Array_0 = a.asm.na).apply(null, arguments);
}, Ub = a._emscripten_bind_DracoInt16Array_GetValue_1 = function() {
return (Ub = a._emscripten_bind_DracoInt16Array_GetValue_1 = a.asm.oa).apply(null, arguments);
}, Vb = a._emscripten_bind_DracoInt16Array_size_0 = function() {
return (Vb = a._emscripten_bind_DracoInt16Array_size_0 = a.asm.pa).apply(null, arguments);
}, Wb = a._emscripten_bind_DracoInt16Array___destroy___0 = function() {
return (Wb = a._emscripten_bind_DracoInt16Array___destroy___0 = a.asm.qa).apply(null, arguments);
}, Qa = a._emscripten_bind_DracoUInt16Array_DracoUInt16Array_0 = function() {
return (Qa = a._emscripten_bind_DracoUInt16Array_DracoUInt16Array_0 = a.asm.ra).apply(null, arguments);
}, Xb = a._emscripten_bind_DracoUInt16Array_GetValue_1 = function() {
return (Xb = a._emscripten_bind_DracoUInt16Array_GetValue_1 = a.asm.sa).apply(null, arguments);
}, Yb = a._emscripten_bind_DracoUInt16Array_size_0 = function() {
return (Yb = a._emscripten_bind_DracoUInt16Array_size_0 = a.asm.ta).apply(null, arguments);
}, Zb = a._emscripten_bind_DracoUInt16Array___destroy___0 = function() {
return (Zb = a._emscripten_bind_DracoUInt16Array___destroy___0 = a.asm.ua).apply(null, arguments);
}, Ra = a._emscripten_bind_DracoInt32Array_DracoInt32Array_0 = function() {
return (Ra = a._emscripten_bind_DracoInt32Array_DracoInt32Array_0 = a.asm.va).apply(null, arguments);
}, $b = a._emscripten_bind_DracoInt32Array_GetValue_1 = function() {
return ($b = a._emscripten_bind_DracoInt32Array_GetValue_1 = a.asm.wa).apply(null, arguments);
}, ac = a._emscripten_bind_DracoInt32Array_size_0 = function() {
return (ac = a._emscripten_bind_DracoInt32Array_size_0 = a.asm.xa).apply(null, arguments);
}, bc = a._emscripten_bind_DracoInt32Array___destroy___0 = function() {
return (bc = a._emscripten_bind_DracoInt32Array___destroy___0 = a.asm.ya).apply(null, arguments);
}, Sa = a._emscripten_bind_DracoUInt32Array_DracoUInt32Array_0 = function() {
return (Sa = a._emscripten_bind_DracoUInt32Array_DracoUInt32Array_0 = a.asm.za).apply(null, arguments);
}, cc = a._emscripten_bind_DracoUInt32Array_GetValue_1 = function() {
return (cc = a._emscripten_bind_DracoUInt32Array_GetValue_1 = a.asm.Aa).apply(null, arguments);
}, dc = a._emscripten_bind_DracoUInt32Array_size_0 = function() {
return (dc = a._emscripten_bind_DracoUInt32Array_size_0 = a.asm.Ba).apply(null, arguments);
}, ec = a._emscripten_bind_DracoUInt32Array___destroy___0 = function() {
return (ec = a._emscripten_bind_DracoUInt32Array___destroy___0 = a.asm.Ca).apply(null, arguments);
}, Ta = a._emscripten_bind_MetadataQuerier_MetadataQuerier_0 = function() {
return (Ta = a._emscripten_bind_MetadataQuerier_MetadataQuerier_0 = a.asm.Da).apply(null, arguments);
}, fc = a._emscripten_bind_MetadataQuerier_HasEntry_2 = function() {
return (fc = a._emscripten_bind_MetadataQuerier_HasEntry_2 = a.asm.Ea).apply(null, arguments);
}, gc = a._emscripten_bind_MetadataQuerier_GetIntEntry_2 = function() {
return (gc = a._emscripten_bind_MetadataQuerier_GetIntEntry_2 = a.asm.Fa).apply(null, arguments);
}, hc = a._emscripten_bind_MetadataQuerier_GetIntEntryArray_3 = function() {
return (hc = a._emscripten_bind_MetadataQuerier_GetIntEntryArray_3 = a.asm.Ga).apply(null, arguments);
}, ic = a._emscripten_bind_MetadataQuerier_GetDoubleEntry_2 = function() {
return (ic = a._emscripten_bind_MetadataQuerier_GetDoubleEntry_2 = a.asm.Ha).apply(null, arguments);
}, jc = a._emscripten_bind_MetadataQuerier_GetStringEntry_2 = function() {
return (jc = a._emscripten_bind_MetadataQuerier_GetStringEntry_2 = a.asm.Ia).apply(null, arguments);
}, kc = a._emscripten_bind_MetadataQuerier_NumEntries_1 = function() {
return (kc = a._emscripten_bind_MetadataQuerier_NumEntries_1 = a.asm.Ja).apply(null, arguments);
}, lc = a._emscripten_bind_MetadataQuerier_GetEntryName_2 = function() {
return (lc = a._emscripten_bind_MetadataQuerier_GetEntryName_2 = a.asm.Ka).apply(null, arguments);
}, mc = a._emscripten_bind_MetadataQuerier___destroy___0 = function() {
return (mc = a._emscripten_bind_MetadataQuerier___destroy___0 = a.asm.La).apply(null, arguments);
}, Ua = a._emscripten_bind_Decoder_Decoder_0 = function() {
return (Ua = a._emscripten_bind_Decoder_Decoder_0 = a.asm.Ma).apply(null, arguments);
}, nc = a._emscripten_bind_Decoder_DecodeArrayToPointCloud_3 = function() {
return (nc = a._emscripten_bind_Decoder_DecodeArrayToPointCloud_3 = a.asm.Na).apply(null, arguments);
}, oc = a._emscripten_bind_Decoder_DecodeArrayToMesh_3 = function() {
return (oc = a._emscripten_bind_Decoder_DecodeArrayToMesh_3 = a.asm.Oa).apply(null, arguments);
}, pc = a._emscripten_bind_Decoder_GetAttributeId_2 = function() {
return (pc = a._emscripten_bind_Decoder_GetAttributeId_2 = a.asm.Pa).apply(null, arguments);
}, qc = a._emscripten_bind_Decoder_GetAttributeIdByName_2 = function() {
return (qc = a._emscripten_bind_Decoder_GetAttributeIdByName_2 = a.asm.Qa).apply(null, arguments);
}, rc = a._emscripten_bind_Decoder_GetAttributeIdByMetadataEntry_3 = function() {
return (rc = a._emscripten_bind_Decoder_GetAttributeIdByMetadataEntry_3 = a.asm.Ra).apply(null, arguments);
}, sc = a._emscripten_bind_Decoder_GetAttribute_2 = function() {
return (sc = a._emscripten_bind_Decoder_GetAttribute_2 = a.asm.Sa).apply(null, arguments);
}, tc = a._emscripten_bind_Decoder_GetAttributeByUniqueId_2 = function() {
return (tc = a._emscripten_bind_Decoder_GetAttributeByUniqueId_2 = a.asm.Ta).apply(null, arguments);
}, uc = a._emscripten_bind_Decoder_GetMetadata_1 = function() {
return (uc = a._emscripten_bind_Decoder_GetMetadata_1 = a.asm.Ua).apply(null, arguments);
}, vc = a._emscripten_bind_Decoder_GetAttributeMetadata_2 = function() {
return (vc = a._emscripten_bind_Decoder_GetAttributeMetadata_2 = a.asm.Va).apply(null, arguments);
}, wc = a._emscripten_bind_Decoder_GetFaceFromMesh_3 = function() {
return (wc = a._emscripten_bind_Decoder_GetFaceFromMesh_3 = a.asm.Wa).apply(null, arguments);
}, xc = a._emscripten_bind_Decoder_GetTriangleStripsFromMesh_2 = function() {
return (xc = a._emscripten_bind_Decoder_GetTriangleStripsFromMesh_2 = a.asm.Xa).apply(null, arguments);
}, yc = a._emscripten_bind_Decoder_GetTrianglesUInt16Array_3 = function() {
return (yc = a._emscripten_bind_Decoder_GetTrianglesUInt16Array_3 = a.asm.Ya).apply(null, arguments);
}, zc = a._emscripten_bind_Decoder_GetTrianglesUInt32Array_3 = function() {
return (zc = a._emscripten_bind_Decoder_GetTrianglesUInt32Array_3 = a.asm.Za).apply(null, arguments);
}, Ac = a._emscripten_bind_Decoder_GetAttributeFloat_3 = function() {
return (Ac = a._emscripten_bind_Decoder_GetAttributeFloat_3 = a.asm._a).apply(null, arguments);
}, Bc = a._emscripten_bind_Decoder_GetAttributeFloatForAllPoints_3 = function() {
return (Bc = a._emscripten_bind_Decoder_GetAttributeFloatForAllPoints_3 = a.asm.$a).apply(null, arguments);
}, Cc = a._emscripten_bind_Decoder_GetAttributeIntForAllPoints_3 = function() {
return (Cc = a._emscripten_bind_Decoder_GetAttributeIntForAllPoints_3 = a.asm.ab).apply(null, arguments);
}, Dc = a._emscripten_bind_Decoder_GetAttributeInt8ForAllPoints_3 = function() {
return (Dc = a._emscripten_bind_Decoder_GetAttributeInt8ForAllPoints_3 = a.asm.bb).apply(null, arguments);
}, Ec = a._emscripten_bind_Decoder_GetAttributeUInt8ForAllPoints_3 = function() {
return (Ec = a._emscripten_bind_Decoder_GetAttributeUInt8ForAllPoints_3 = a.asm.cb).apply(null, arguments);
}, Fc = a._emscripten_bind_Decoder_GetAttributeInt16ForAllPoints_3 = function() {
return (Fc = a._emscripten_bind_Decoder_GetAttributeInt16ForAllPoints_3 = a.asm.db).apply(null, arguments);
}, Gc = a._emscripten_bind_Decoder_GetAttributeUInt16ForAllPoints_3 = function() {
return (Gc = a._emscripten_bind_Decoder_GetAttributeUInt16ForAllPoints_3 = a.asm.eb).apply(null, arguments);
}, Hc = a._emscripten_bind_Decoder_GetAttributeInt32ForAllPoints_3 = function() {
return (Hc = a._emscripten_bind_Decoder_GetAttributeInt32ForAllPoints_3 = a.asm.fb).apply(null, arguments);
}, Ic = a._emscripten_bind_Decoder_GetAttributeUInt32ForAllPoints_3 = function() {
return (Ic = a._emscripten_bind_Decoder_GetAttributeUInt32ForAllPoints_3 = a.asm.gb).apply(null, arguments);
}, Jc = a._emscripten_bind_Decoder_GetAttributeDataArrayForAllPoints_5 = function() {
return (Jc = a._emscripten_bind_Decoder_GetAttributeDataArrayForAllPoints_5 = a.asm.hb).apply(null, arguments);
}, Kc = a._emscripten_bind_Decoder_SkipAttributeTransform_1 = function() {
return (Kc = a._emscripten_bind_Decoder_SkipAttributeTransform_1 = a.asm.ib).apply(null, arguments);
}, Lc = a._emscripten_bind_Decoder_GetEncodedGeometryType_Deprecated_1 = function() {
return (Lc = a._emscripten_bind_Decoder_GetEncodedGeometryType_Deprecated_1 = a.asm.jb).apply(null, arguments);
}, Mc = a._emscripten_bind_Decoder_DecodeBufferToPointCloud_2 = function() {
return (Mc = a._emscripten_bind_Decoder_DecodeBufferToPointCloud_2 = a.asm.kb).apply(null, arguments);
}, Nc = a._emscripten_bind_Decoder_DecodeBufferToMesh_2 = function() {
return (Nc = a._emscripten_bind_Decoder_DecodeBufferToMesh_2 = a.asm.lb).apply(null, arguments);
}, Oc = a._emscripten_bind_Decoder___destroy___0 = function() {
return (Oc = a._emscripten_bind_Decoder___destroy___0 = a.asm.mb).apply(null, arguments);
}, Pc = a._emscripten_enum_draco_AttributeTransformType_ATTRIBUTE_INVALID_TRANSFORM = function() {
return (Pc = a._emscripten_enum_draco_AttributeTransformType_ATTRIBUTE_INVALID_TRANSFORM = a.asm.nb).apply(null, arguments);
}, Qc = a._emscripten_enum_draco_AttributeTransformType_ATTRIBUTE_NO_TRANSFORM = function() {
return (Qc = a._emscripten_enum_draco_AttributeTransformType_ATTRIBUTE_NO_TRANSFORM = a.asm.ob).apply(null, arguments);
}, Rc = a._emscripten_enum_draco_AttributeTransformType_ATTRIBUTE_QUANTIZATION_TRANSFORM = function() {
return (Rc = a._emscripten_enum_draco_AttributeTransformType_ATTRIBUTE_QUANTIZATION_TRANSFORM = a.asm.pb).apply(null, arguments);
}, Sc = a._emscripten_enum_draco_AttributeTransformType_ATTRIBUTE_OCTAHEDRON_TRANSFORM = function() {
return (Sc = a._emscripten_enum_draco_AttributeTransformType_ATTRIBUTE_OCTAHEDRON_TRANSFORM = a.asm.qb).apply(null, arguments);
}, Tc = a._emscripten_enum_draco_GeometryAttribute_Type_INVALID = function() {
return (Tc = a._emscripten_enum_draco_GeometryAttribute_Type_INVALID = a.asm.rb).apply(null, arguments);
}, Uc = a._emscripten_enum_draco_GeometryAttribute_Type_POSITION = function() {
return (Uc = a._emscripten_enum_draco_GeometryAttribute_Type_POSITION = a.asm.sb).apply(null, arguments);
}, Vc = a._emscripten_enum_draco_GeometryAttribute_Type_NORMAL = function() {
return (Vc = a._emscripten_enum_draco_GeometryAttribute_Type_NORMAL = a.asm.tb).apply(null, arguments);
}, Wc = a._emscripten_enum_draco_GeometryAttribute_Type_COLOR = function() {
return (Wc = a._emscripten_enum_draco_GeometryAttribute_Type_COLOR = a.asm.ub).apply(null, arguments);
}, Xc = a._emscripten_enum_draco_GeometryAttribute_Type_TEX_COORD = function() {
return (Xc = a._emscripten_enum_draco_GeometryAttribute_Type_TEX_COORD = a.asm.vb).apply(null, arguments);
}, Yc = a._emscripten_enum_draco_GeometryAttribute_Type_GENERIC = function() {
return (Yc = a._emscripten_enum_draco_GeometryAttribute_Type_GENERIC = a.asm.wb).apply(null, arguments);
}, Zc = a._emscripten_enum_draco_EncodedGeometryType_INVALID_GEOMETRY_TYPE = function() {
return (Zc = a._emscripten_enum_draco_EncodedGeometryType_INVALID_GEOMETRY_TYPE = a.asm.xb).apply(null, arguments);
}, $c = a._emscripten_enum_draco_EncodedGeometryType_POINT_CLOUD = function() {
return ($c = a._emscripten_enum_draco_EncodedGeometryType_POINT_CLOUD = a.asm.yb).apply(null, arguments);
}, ad = a._emscripten_enum_draco_EncodedGeometryType_TRIANGULAR_MESH = function() {
return (ad = a._emscripten_enum_draco_EncodedGeometryType_TRIANGULAR_MESH = a.asm.zb).apply(null, arguments);
}, bd = a._emscripten_enum_draco_DataType_DT_INVALID = function() {
return (bd = a._emscripten_enum_draco_DataType_DT_INVALID = a.asm.Ab).apply(null, arguments);
}, cd = a._emscripten_enum_draco_DataType_DT_INT8 = function() {
return (cd = a._emscripten_enum_draco_DataType_DT_INT8 = a.asm.Bb).apply(null, arguments);
}, dd = a._emscripten_enum_draco_DataType_DT_UINT8 = function() {
return (dd = a._emscripten_enum_draco_DataType_DT_UINT8 = a.asm.Cb).apply(null, arguments);
}, ed = a._emscripten_enum_draco_DataType_DT_INT16 = function() {
return (ed = a._emscripten_enum_draco_DataType_DT_INT16 = a.asm.Db).apply(null, arguments);
}, fd = a._emscripten_enum_draco_DataType_DT_UINT16 = function() {
return (fd = a._emscripten_enum_draco_DataType_DT_UINT16 = a.asm.Eb).apply(null, arguments);
}, gd = a._emscripten_enum_draco_DataType_DT_INT32 = function() {
return (gd = a._emscripten_enum_draco_DataType_DT_INT32 = a.asm.Fb).apply(null, arguments);
}, hd = a._emscripten_enum_draco_DataType_DT_UINT32 = function() {
return (hd = a._emscripten_enum_draco_DataType_DT_UINT32 = a.asm.Gb).apply(null, arguments);
}, id = a._emscripten_enum_draco_DataType_DT_INT64 = function() {
return (id = a._emscripten_enum_draco_DataType_DT_INT64 = a.asm.Hb).apply(null, arguments);
}, jd = a._emscripten_enum_draco_DataType_DT_UINT64 = function() {
return (jd = a._emscripten_enum_draco_DataType_DT_UINT64 = a.asm.Ib).apply(null, arguments);
}, kd = a._emscripten_enum_draco_DataType_DT_FLOAT32 = function() {
return (kd = a._emscripten_enum_draco_DataType_DT_FLOAT32 = a.asm.Jb).apply(
null,
arguments
);
}, ld = a._emscripten_enum_draco_DataType_DT_FLOAT64 = function() {
return (ld = a._emscripten_enum_draco_DataType_DT_FLOAT64 = a.asm.Kb).apply(null, arguments);
}, md = a._emscripten_enum_draco_DataType_DT_BOOL = function() {
return (md = a._emscripten_enum_draco_DataType_DT_BOOL = a.asm.Lb).apply(null, arguments);
}, nd = a._emscripten_enum_draco_DataType_DT_TYPES_COUNT = function() {
return (nd = a._emscripten_enum_draco_DataType_DT_TYPES_COUNT = a.asm.Mb).apply(null, arguments);
}, od = a._emscripten_enum_draco_StatusCode_OK = function() {
return (od = a._emscripten_enum_draco_StatusCode_OK = a.asm.Nb).apply(null, arguments);
}, pd = a._emscripten_enum_draco_StatusCode_DRACO_ERROR = function() {
return (pd = a._emscripten_enum_draco_StatusCode_DRACO_ERROR = a.asm.Ob).apply(null, arguments);
}, qd = a._emscripten_enum_draco_StatusCode_IO_ERROR = function() {
return (qd = a._emscripten_enum_draco_StatusCode_IO_ERROR = a.asm.Pb).apply(null, arguments);
}, rd = a._emscripten_enum_draco_StatusCode_INVALID_PARAMETER = function() {
return (rd = a._emscripten_enum_draco_StatusCode_INVALID_PARAMETER = a.asm.Qb).apply(null, arguments);
}, sd = a._emscripten_enum_draco_StatusCode_UNSUPPORTED_VERSION = function() {
return (sd = a._emscripten_enum_draco_StatusCode_UNSUPPORTED_VERSION = a.asm.Rb).apply(null, arguments);
}, td = a._emscripten_enum_draco_StatusCode_UNKNOWN_VERSION = function() {
return (td = a._emscripten_enum_draco_StatusCode_UNKNOWN_VERSION = a.asm.Sb).apply(null, arguments);
};
a._malloc = function() {
return (a._malloc = a.asm.Tb).apply(null, arguments);
};
a._free = function() {
return (a._free = a.asm.Ub).apply(null, arguments);
};
var ya = function() {
return (ya = a.asm.Vb).apply(null, arguments);
};
a.___start_em_js = 15856;
a.___stop_em_js = 15954;
var la;
ia = function b() {
la || ba();
la || (ia = b);
};
if (a.preInit) for ("function" == typeof a.preInit && (a.preInit = [a.preInit]); 0 < a.preInit.length; ) a.preInit.pop()();
ba();
t.prototype = Object.create(t.prototype);
t.prototype.constructor = t;
t.prototype.__class__ = t;
t.__cache__ = {};
a.WrapperObject = t;
a.getCache = x;
a.wrapPointer = D;
a.castObject = function(b, c) {
return D(b.ptr, c);
};
a.NULL = D(0);
a.destroy = function(b) {
if (!b.__destroy__) throw "Error: Cannot destroy object. (Did you create it yourself?)";
b.__destroy__();
delete x(b.__class__)[b.ptr];
};
a.compare = function(b, c) {
return b.ptr === c.ptr;
};
a.getPointer = function(b) {
return b.ptr;
};
a.getClass = function(b) {
return b.__class__;
};
var r = { buffer: 0, size: 0, pos: 0, temps: [], needed: 0, prepare: function() {
if (r.needed) {
for (var b = 0; b < r.temps.length; b++) a._free(r.temps[b]);
r.temps.length = 0;
a._free(r.buffer);
r.buffer = 0;
r.size += r.needed;
r.needed = 0;
}
r.buffer || (r.size += 128, r.buffer = a._malloc(r.size), r.buffer || f(void 0));
r.pos = 0;
}, alloc: function(b, c) {
r.buffer || f(void 0);
b = b.length * c.BYTES_PER_ELEMENT;
b = b + 7 & -8;
r.pos + b >= r.size ? (0 < b || f(void 0), r.needed += b, c = a._malloc(b), r.temps.push(c)) : (c = r.buffer + r.pos, r.pos += b);
return c;
}, copy: function(b, c, d) {
d >>>= 0;
switch (c.BYTES_PER_ELEMENT) {
case 2:
d >>>= 1;
break;
case 4:
d >>>= 2;
break;
case 8:
d >>>= 3;
}
for (var g = 0; g < b.length; g++) c[d + g] = b[g];
} };
Z.prototype = Object.create(t.prototype);
Z.prototype.constructor = Z;
Z.prototype.__class__ = Z;
Z.__cache__ = {};
a.VoidPtr = Z;
Z.prototype.__destroy__ = Z.prototype.__destroy__ = function() {
bb(this.ptr);
};
S.prototype = Object.create(t.prototype);
S.prototype.constructor = S;
S.prototype.__class__ = S;
S.__cache__ = {};
a.DecoderBuffer = S;
S.prototype.Init = S.prototype.Init = function(b, c) {
var d = this.ptr;
r.prepare();
"object" == typeof b && (b = pa(b));
c && "object" === typeof c && (c = c.ptr);
cb(d, b, c);
};
S.prototype.__destroy__ = S.prototype.__destroy__ = function() {
db(this.ptr);
};
Q.prototype = Object.create(t.prototype);
Q.prototype.constructor = Q;
Q.prototype.__class__ = Q;
Q.__cache__ = {};
a.AttributeTransformData = Q;
Q.prototype.transform_type = Q.prototype.transform_type = function() {
return eb(this.ptr);
};
Q.prototype.__destroy__ = Q.prototype.__destroy__ = function() {
fb(this.ptr);
};
W.prototype = Object.create(t.prototype);
W.prototype.constructor = W;
W.prototype.__class__ = W;
W.__cache__ = {};
a.GeometryAttribute = W;
W.prototype.__destroy__ = W.prototype.__destroy__ = function() {
gb(this.ptr);
};
w.prototype = Object.create(t.prototype);
w.prototype.constructor = w;
w.prototype.__class__ = w;
w.__cache__ = {};
a.PointAttribute = w;
w.prototype.size = w.prototype.size = function() {
return hb(this.ptr);
};
w.prototype.GetAttributeTransformData = w.prototype.GetAttributeTransformData = function() {
return D(ib(this.ptr), Q);
};
w.prototype.attribute_type = w.prototype.attribute_type = function() {
return jb(this.ptr);
};
w.prototype.data_type = w.prototype.data_type = function() {
return kb(this.ptr);
};
w.prototype.num_components = w.prototype.num_components = function() {
return lb(this.ptr);
};
w.prototype.normalized = w.prototype.normalized = function() {
return !!mb(this.ptr);
};
w.prototype.byte_stride = w.prototype.byte_stride = function() {
return nb(this.ptr);
};
w.prototype.byte_offset = w.prototype.byte_offset = function() {
return ob(this.ptr);
};
w.prototype.unique_id = w.prototype.unique_id = function() {
return pb(this.ptr);
};
w.prototype.__destroy__ = w.prototype.__destroy__ = function() {
qb(this.ptr);
};
C.prototype = Object.create(t.prototype);
C.prototype.constructor = C;
C.prototype.__class__ = C;
C.__cache__ = {};
a.AttributeQuantizationTransform = C;
C.prototype.InitFromAttribute = C.prototype.InitFromAttribute = function(b) {
var c = this.ptr;
b && "object" === typeof b && (b = b.ptr);
return !!rb(c, b);
};
C.prototype.quantization_bits = C.prototype.quantization_bits = function() {
return sb(this.ptr);
};
C.prototype.min_value = C.prototype.min_value = function(b) {
var c = this.ptr;
b && "object" === typeof b && (b = b.ptr);
return tb(c, b);
};
C.prototype.range = C.prototype.range = function() {
return ub(this.ptr);
};
C.prototype.__destroy__ = C.prototype.__destroy__ = function() {
vb(this.ptr);
};
F.prototype = Object.create(t.prototype);
F.prototype.constructor = F;
F.prototype.__class__ = F;
F.__cache__ = {};
a.AttributeOctahedronTransform = F;
F.prototype.InitFromAttribute = F.prototype.InitFromAttribute = function(b) {
var c = this.ptr;
b && "object" === typeof b && (b = b.ptr);
return !!wb(c, b);
};
F.prototype.quantization_bits = F.prototype.quantization_bits = function() {
return xb(this.ptr);
};
F.prototype.__destroy__ = F.prototype.__destroy__ = function() {
yb(this.ptr);
};
G.prototype = Object.create(t.prototype);
G.prototype.constructor = G;
G.prototype.__class__ = G;
G.__cache__ = {};
a.PointCloud = G;
G.prototype.num_attributes = G.prototype.num_attributes = function() {
return zb(this.ptr);
};
G.prototype.num_points = G.prototype.num_points = function() {
return Ab(this.ptr);
};
G.prototype.__destroy__ = G.prototype.__destroy__ = function() {
Bb(this.ptr);
};
E.prototype = Object.create(t.prototype);
E.prototype.constructor = E;
E.prototype.__class__ = E;
E.__cache__ = {};
a.Mesh = E;
E.prototype.num_faces = E.prototype.num_faces = function() {
return Cb(this.ptr);
};
E.prototype.num_attributes = E.prototype.num_attributes = function() {
return Db(this.ptr);
};
E.prototype.num_points = E.prototype.num_points = function() {
return Eb(this.ptr);
};
E.prototype.__destroy__ = E.prototype.__destroy__ = function() {
Fb(this.ptr);
};
T.prototype = Object.create(t.prototype);
T.prototype.constructor = T;
T.prototype.__class__ = T;
T.__cache__ = {};
a.Metadata = T;
T.prototype.__destroy__ = T.prototype.__destroy__ = function() {
Gb(this.ptr);
};
B.prototype = Object.create(t.prototype);
B.prototype.constructor = B;
B.prototype.__class__ = B;
B.__cache__ = {};
a.Status = B;
B.prototype.code = B.prototype.code = function() {
return Hb(this.ptr);
};
B.prototype.ok = B.prototype.ok = function() {
return !!Ib(this.ptr);
};
B.prototype.error_msg = B.prototype.error_msg = function() {
return h(Jb(this.ptr));
};
B.prototype.__destroy__ = B.prototype.__destroy__ = function() {
Kb(this.ptr);
};
H.prototype = Object.create(t.prototype);
H.prototype.constructor = H;
H.prototype.__class__ = H;
H.__cache__ = {};
a.DracoFloat32Array = H;
H.prototype.GetValue = H.prototype.GetValue = function(b) {
var c = this.ptr;
b && "object" === typeof b && (b = b.ptr);
return Lb(c, b);
};
H.prototype.size = H.prototype.size = function() {
return Mb(this.ptr);
};
H.prototype.__destroy__ = H.prototype.__destroy__ = function() {
Nb(this.ptr);
};
I.prototype = Object.create(t.prototype);
I.prototype.constructor = I;
I.prototype.__class__ = I;
I.__cache__ = {};
a.DracoInt8Array = I;
I.prototype.GetValue = I.prototype.GetValue = function(b) {
var c = this.ptr;
b && "object" === typeof b && (b = b.ptr);
return Ob(c, b);
};
I.prototype.size = I.prototype.size = function() {
return Pb(this.ptr);
};
I.prototype.__destroy__ = I.prototype.__destroy__ = function() {
Qb(this.ptr);
};
J.prototype = Object.create(t.prototype);
J.prototype.constructor = J;
J.prototype.__class__ = J;
J.__cache__ = {};
a.DracoUInt8Array = J;
J.prototype.GetValue = J.prototype.GetValue = function(b) {
var c = this.ptr;
b && "object" === typeof b && (b = b.ptr);
return Rb(c, b);
};
J.prototype.size = J.prototype.size = function() {
return Sb(this.ptr);
};
J.prototype.__destroy__ = J.prototype.__destroy__ = function() {
Tb(this.ptr);
};
K.prototype = Object.create(t.prototype);
K.prototype.constructor = K;
K.prototype.__class__ = K;
K.__cache__ = {};
a.DracoInt16Array = K;
K.prototype.GetValue = K.prototype.GetValue = function(b) {
var c = this.ptr;
b && "object" === typeof b && (b = b.ptr);
return Ub(c, b);
};
K.prototype.size = K.prototype.size = function() {
return Vb(this.ptr);
};
K.prototype.__destroy__ = K.prototype.__destroy__ = function() {
Wb(this.ptr);
};
L.prototype = Object.create(t.prototype);
L.prototype.constructor = L;
L.prototype.__class__ = L;
L.__cache__ = {};
a.DracoUInt16Array = L;
L.prototype.GetValue = L.prototype.GetValue = function(b) {
var c = this.ptr;
b && "object" === typeof b && (b = b.ptr);
return Xb(c, b);
};
L.prototype.size = L.prototype.size = function() {
return Yb(this.ptr);
};
L.prototype.__destroy__ = L.prototype.__destroy__ = function() {
Zb(this.ptr);
};
M.prototype = Object.create(t.prototype);
M.prototype.constructor = M;
M.prototype.__class__ = M;
M.__cache__ = {};
a.DracoInt32Array = M;
M.prototype.GetValue = M.prototype.GetValue = function(b) {
var c = this.ptr;
b && "object" === typeof b && (b = b.ptr);
return $b(c, b);
};
M.prototype.size = M.prototype.size = function() {
return ac(this.ptr);
};
M.prototype.__destroy__ = M.prototype.__destroy__ = function() {
bc(this.ptr);
};
N.prototype = Object.create(t.prototype);
N.prototype.constructor = N;
N.prototype.__class__ = N;
N.__cache__ = {};
a.DracoUInt32Array = N;
N.prototype.GetValue = N.prototype.GetValue = function(b) {
var c = this.ptr;
b && "object" === typeof b && (b = b.ptr);
return cc(c, b);
};
N.prototype.size = N.prototype.size = function() {
return dc(this.ptr);
};
N.prototype.__destroy__ = N.prototype.__destroy__ = function() {
ec(this.ptr);
};
y.prototype = Object.create(t.prototype);
y.prototype.constructor = y;
y.prototype.__class__ = y;
y.__cache__ = {};
a.MetadataQuerier = y;
y.prototype.HasEntry = y.prototype.HasEntry = function(b, c) {
var d = this.ptr;
r.prepare();
b && "object" === typeof b && (b = b.ptr);
c = c && "object" === typeof c ? c.ptr : R(c);
return !!fc(d, b, c);
};
y.prototype.GetIntEntry = y.prototype.GetIntEntry = function(b, c) {
var d = this.ptr;
r.prepare();
b && "object" === typeof b && (b = b.ptr);
c = c && "object" === typeof c ? c.ptr : R(c);
return gc(d, b, c);
};
y.prototype.GetIntEntryArray = y.prototype.GetIntEntryArray = function(b, c, d) {
var g = this.ptr;
r.prepare();
b && "object" === typeof b && (b = b.ptr);
c = c && "object" === typeof c ? c.ptr : R(c);
d && "object" === typeof d && (d = d.ptr);
hc(g, b, c, d);
};
y.prototype.GetDoubleEntry = y.prototype.GetDoubleEntry = function(b, c) {
var d = this.ptr;
r.prepare();
b && "object" === typeof b && (b = b.ptr);
c = c && "object" === typeof c ? c.ptr : R(c);
return ic(d, b, c);
};
y.prototype.GetStringEntry = y.prototype.GetStringEntry = function(b, c) {
var d = this.ptr;
r.prepare();
b && "object" === typeof b && (b = b.ptr);
c = c && "object" === typeof c ? c.ptr : R(c);
return h(jc(d, b, c));
};
y.prototype.NumEntries = y.prototype.NumEntries = function(b) {
var c = this.ptr;
b && "object" === typeof b && (b = b.ptr);
return kc(c, b);
};
y.prototype.GetEntryName = y.prototype.GetEntryName = function(b, c) {
var d = this.ptr;
b && "object" === typeof b && (b = b.ptr);
c && "object" === typeof c && (c = c.ptr);
return h(lc(d, b, c));
};
y.prototype.__destroy__ = y.prototype.__destroy__ = function() {
mc(this.ptr);
};
m.prototype = Object.create(t.prototype);
m.prototype.constructor = m;
m.prototype.__class__ = m;
m.__cache__ = {};
a.Decoder = m;
m.prototype.DecodeArrayToPointCloud = m.prototype.DecodeArrayToPointCloud = function(b, c, d) {
var g = this.ptr;
r.prepare();
"object" == typeof b && (b = pa(b));
c && "object" === typeof c && (c = c.ptr);
d && "object" === typeof d && (d = d.ptr);
return D(nc(g, b, c, d), B);
};
m.prototype.DecodeArrayToMesh = m.prototype.DecodeArrayToMesh = function(b, c, d) {
var g = this.ptr;
r.prepare();
"object" == typeof b && (b = pa(b));
c && "object" === typeof c && (c = c.ptr);
d && "object" === typeof d && (d = d.ptr);
return D(oc(g, b, c, d), B);
};
m.prototype.GetAttributeId = m.prototype.GetAttributeId = function(b, c) {
var d = this.ptr;
b && "object" === typeof b && (b = b.ptr);
c && "object" === typeof c && (c = c.ptr);
return pc(d, b, c);
};
m.prototype.GetAttributeIdByName = m.prototype.GetAttributeIdByName = function(b, c) {
var d = this.ptr;
r.prepare();
b && "object" === typeof b && (b = b.ptr);
c = c && "object" === typeof c ? c.ptr : R(c);
return qc(d, b, c);
};
m.prototype.GetAttributeIdByMetadataEntry = m.prototype.GetAttributeIdByMetadataEntry = function(b, c, d) {
var g = this.ptr;
r.prepare();
b && "object" === typeof b && (b = b.ptr);
c = c && "object" === typeof c ? c.ptr : R(c);
d = d && "object" === typeof d ? d.ptr : R(d);
return rc(g, b, c, d);
};
m.prototype.GetAttribute = m.prototype.GetAttribute = function(b, c) {
var d = this.ptr;
b && "object" === typeof b && (b = b.ptr);
c && "object" === typeof c && (c = c.ptr);
return D(sc(d, b, c), w);
};
m.prototype.GetAttributeByUniqueId = m.prototype.GetAttributeByUniqueId = function(b, c) {
var d = this.ptr;
b && "object" === typeof b && (b = b.ptr);
c && "object" === typeof c && (c = c.ptr);
return D(tc(d, b, c), w);
};
m.prototype.GetMetadata = m.prototype.GetMetadata = function(b) {
var c = this.ptr;
b && "object" === typeof b && (b = b.ptr);
return D(uc(c, b), T);
};
m.prototype.GetAttributeMetadata = m.prototype.GetAttributeMetadata = function(b, c) {
var d = this.ptr;
b && "object" === typeof b && (b = b.ptr);
c && "object" === typeof c && (c = c.ptr);
return D(vc(d, b, c), T);
};
m.prototype.GetFaceFromMesh = m.prototype.GetFaceFromMesh = function(b, c, d) {
var g = this.ptr;
b && "object" === typeof b && (b = b.ptr);
c && "object" === typeof c && (c = c.ptr);
d && "object" === typeof d && (d = d.ptr);
return !!wc(g, b, c, d);
};
m.prototype.GetTriangleStripsFromMesh = m.prototype.GetTriangleStripsFromMesh = function(b, c) {
var d = this.ptr;
b && "object" === typeof b && (b = b.ptr);
c && "object" === typeof c && (c = c.ptr);
return xc(d, b, c);
};
m.prototype.GetTrianglesUInt16Array = m.prototype.GetTrianglesUInt16Array = function(b, c, d) {
var g = this.ptr;
b && "object" === typeof b && (b = b.ptr);
c && "object" === typeof c && (c = c.ptr);
d && "object" === typeof d && (d = d.ptr);
return !!yc(g, b, c, d);
};
m.prototype.GetTrianglesUInt32Array = m.prototype.GetTrianglesUInt32Array = function(b, c, d) {
var g = this.ptr;
b && "object" === typeof b && (b = b.ptr);
c && "object" === typeof c && (c = c.ptr);
d && "object" === typeof d && (d = d.ptr);
return !!zc(g, b, c, d);
};
m.prototype.GetAttributeFloat = m.prototype.GetAttributeFloat = function(b, c, d) {
var g = this.ptr;
b && "object" === typeof b && (b = b.ptr);
c && "object" === typeof c && (c = c.ptr);
d && "object" === typeof d && (d = d.ptr);
return !!Ac(g, b, c, d);
};
m.prototype.GetAttributeFloatForAllPoints = m.prototype.GetAttributeFloatForAllPoints = function(b, c, d) {
var g = this.ptr;
b && "object" === typeof b && (b = b.ptr);
c && "object" === typeof c && (c = c.ptr);
d && "object" === typeof d && (d = d.ptr);
return !!Bc(g, b, c, d);
};
m.prototype.GetAttributeIntForAllPoints = m.prototype.GetAttributeIntForAllPoints = function(b, c, d) {
var g = this.ptr;
b && "object" === typeof b && (b = b.ptr);
c && "object" === typeof c && (c = c.ptr);
d && "object" === typeof d && (d = d.ptr);
return !!Cc(g, b, c, d);
};
m.prototype.GetAttributeInt8ForAllPoints = m.prototype.GetAttributeInt8ForAllPoints = function(b, c, d) {
var g = this.ptr;
b && "object" === typeof b && (b = b.ptr);
c && "object" === typeof c && (c = c.ptr);
d && "object" === typeof d && (d = d.ptr);
return !!Dc(g, b, c, d);
};
m.prototype.GetAttributeUInt8ForAllPoints = m.prototype.GetAttributeUInt8ForAllPoints = function(b, c, d) {
var g = this.ptr;
b && "object" === typeof b && (b = b.ptr);
c && "object" === typeof c && (c = c.ptr);
d && "object" === typeof d && (d = d.ptr);
return !!Ec(g, b, c, d);
};
m.prototype.GetAttributeInt16ForAllPoints = m.prototype.GetAttributeInt16ForAllPoints = function(b, c, d) {
var g = this.ptr;
b && "object" === typeof b && (b = b.ptr);
c && "object" === typeof c && (c = c.ptr);
d && "object" === typeof d && (d = d.ptr);
return !!Fc(g, b, c, d);
};
m.prototype.GetAttributeUInt16ForAllPoints = m.prototype.GetAttributeUInt16ForAllPoints = function(b, c, d) {
var g = this.ptr;
b && "object" === typeof b && (b = b.ptr);
c && "object" === typeof c && (c = c.ptr);
d && "object" === typeof d && (d = d.ptr);
return !!Gc(g, b, c, d);
};
m.prototype.GetAttributeInt32ForAllPoints = m.prototype.GetAttributeInt32ForAllPoints = function(b, c, d) {
var g = this.ptr;
b && "object" === typeof b && (b = b.ptr);
c && "object" === typeof c && (c = c.ptr);
d && "object" === typeof d && (d = d.ptr);
return !!Hc(g, b, c, d);
};
m.prototype.GetAttributeUInt32ForAllPoints = m.prototype.GetAttributeUInt32ForAllPoints = function(b, c, d) {
var g = this.ptr;
b && "object" === typeof b && (b = b.ptr);
c && "object" === typeof c && (c = c.ptr);
d && "object" === typeof d && (d = d.ptr);
return !!Ic(g, b, c, d);
};
m.prototype.GetAttributeDataArrayForAllPoints = m.prototype.GetAttributeDataArrayForAllPoints = function(b, c, d, g, u) {
var X = this.ptr;
b && "object" === typeof b && (b = b.ptr);
c && "object" === typeof c && (c = c.ptr);
d && "object" === typeof d && (d = d.ptr);
g && "object" === typeof g && (g = g.ptr);
u && "object" === typeof u && (u = u.ptr);
return !!Jc(X, b, c, d, g, u);
};
m.prototype.SkipAttributeTransform = m.prototype.SkipAttributeTransform = function(b) {
var c = this.ptr;
b && "object" === typeof b && (b = b.ptr);
Kc(c, b);
};
m.prototype.GetEncodedGeometryType_Deprecated = m.prototype.GetEncodedGeometryType_Deprecated = function(b) {
var c = this.ptr;
b && "object" === typeof b && (b = b.ptr);
return Lc(c, b);
};
m.prototype.DecodeBufferToPointCloud = m.prototype.DecodeBufferToPointCloud = function(b, c) {
var d = this.ptr;
b && "object" === typeof b && (b = b.ptr);
c && "object" === typeof c && (c = c.ptr);
return D(Mc(d, b, c), B);
};
m.prototype.DecodeBufferToMesh = m.prototype.DecodeBufferToMesh = function(b, c) {
var d = this.ptr;
b && "object" === typeof b && (b = b.ptr);
c && "object" === typeof c && (c = c.ptr);
return D(Nc(d, b, c), B);
};
m.prototype.__destroy__ = m.prototype.__destroy__ = function() {
Oc(this.ptr);
};
(function() {
function b() {
a.ATTRIBUTE_INVALID_TRANSFORM = Pc();
a.ATTRIBUTE_NO_TRANSFORM = Qc();
a.ATTRIBUTE_QUANTIZATION_TRANSFORM = Rc();
a.ATTRIBUTE_OCTAHEDRON_TRANSFORM = Sc();
a.INVALID = Tc();
a.POSITION = Uc();
a.NORMAL = Vc();
a.COLOR = Wc();
a.TEX_COORD = Xc();
a.GENERIC = Yc();
a.INVALID_GEOMETRY_TYPE = Zc();
a.POINT_CLOUD = $c();
a.TRIANGULAR_MESH = ad();
a.DT_INVALID = bd();
a.DT_INT8 = cd();
a.DT_UINT8 = dd();
a.DT_INT16 = ed();
a.DT_UINT16 = fd();
a.DT_INT32 = gd();
a.DT_UINT32 = hd();
a.DT_INT64 = id();
a.DT_UINT64 = jd();
a.DT_FLOAT32 = kd();
a.DT_FLOAT64 = ld();
a.DT_BOOL = md();
a.DT_TYPES_COUNT = nd();
a.OK = od();
a.DRACO_ERROR = pd();
a.IO_ERROR = qd();
a.INVALID_PARAMETER = rd();
a.UNSUPPORTED_VERSION = sd();
a.UNKNOWN_VERSION = td();
}
za ? b() : oa.unshift(b);
})();
if ("function" === typeof a.onModuleParsed) a.onModuleParsed();
a.Decoder.prototype.GetEncodedGeometryType = function(b) {
if (b.__class__ && b.__class__ === a.DecoderBuffer) return a.Decoder.prototype.GetEncodedGeometryType_Deprecated(b);
if (8 > b.byteLength) return a.INVALID_GEOMETRY_TYPE;
switch (b[7]) {
case 0:
return a.POINT_CLOUD;
case 1:
return a.TRIANGULAR_MESH;
default:
return a.INVALID_GEOMETRY_TYPE;
}
};
return n.ready;
};
}();
"object" === typeof exports && "object" === typeof module ? module.exports = DracoDecoderModule : "function" === typeof define && define.amd ? define([], function() {
return DracoDecoderModule;
}) : "object" === typeof exports && (exports.DracoDecoderModule = DracoDecoderModule);
}
});
export {
require_draco_decoder_nodejs
};
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.121.2
*
* Copyright 2011-2022 Cesium Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Columbus View (Pat. Pend.)
*
* Portions licensed separately.
* See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
*/
import {
Intersect_default
} from "./chunk-KHZNBFOH.js";
import {
Cartesian3_default
} from "./chunk-FFLMY4TE.js";
import {
defaultValue_default
} from "./chunk-U5HSOKPQ.js";
import {
Check_default
} from "./chunk-P6TRGU3S.js";
import {
defined_default
} from "./chunk-YCDZX5LS.js";
// packages/engine/Source/Core/AxisAlignedBoundingBox.js
function AxisAlignedBoundingBox(minimum, maximum, center) {
this.minimum = Cartesian3_default.clone(defaultValue_default(minimum, Cartesian3_default.ZERO));
this.maximum = Cartesian3_default.clone(defaultValue_default(maximum, Cartesian3_default.ZERO));
if (!defined_default(center)) {
center = Cartesian3_default.midpoint(this.minimum, this.maximum, new Cartesian3_default());
} else {
center = Cartesian3_default.clone(center);
}
this.center = center;
}
AxisAlignedBoundingBox.fromCorners = function(minimum, maximum, result) {
Check_default.defined("minimum", minimum);
Check_default.defined("maximum", maximum);
if (!defined_default(result)) {
result = new AxisAlignedBoundingBox();
}
result.minimum = Cartesian3_default.clone(minimum, result.minimum);
result.maximum = Cartesian3_default.clone(maximum, result.maximum);
result.center = Cartesian3_default.midpoint(minimum, maximum, result.center);
return result;
};
AxisAlignedBoundingBox.fromPoints = function(positions, result) {
if (!defined_default(result)) {
result = new AxisAlignedBoundingBox();
}
if (!defined_default(positions) || positions.length === 0) {
result.minimum = Cartesian3_default.clone(Cartesian3_default.ZERO, result.minimum);
result.maximum = Cartesian3_default.clone(Cartesian3_default.ZERO, result.maximum);
result.center = Cartesian3_default.clone(Cartesian3_default.ZERO, result.center);
return result;
}
let minimumX = positions[0].x;
let minimumY = positions[0].y;
let minimumZ = positions[0].z;
let maximumX = positions[0].x;
let maximumY = positions[0].y;
let maximumZ = positions[0].z;
const length = positions.length;
for (let i = 1; i < length; i++) {
const p = positions[i];
const x = p.x;
const y = p.y;
const z = p.z;
minimumX = Math.min(x, minimumX);
maximumX = Math.max(x, maximumX);
minimumY = Math.min(y, minimumY);
maximumY = Math.max(y, maximumY);
minimumZ = Math.min(z, minimumZ);
maximumZ = Math.max(z, maximumZ);
}
const minimum = result.minimum;
minimum.x = minimumX;
minimum.y = minimumY;
minimum.z = minimumZ;
const maximum = result.maximum;
maximum.x = maximumX;
maximum.y = maximumY;
maximum.z = maximumZ;
result.center = Cartesian3_default.midpoint(minimum, maximum, result.center);
return result;
};
AxisAlignedBoundingBox.clone = function(box, result) {
if (!defined_default(box)) {
return void 0;
}
if (!defined_default(result)) {
return new AxisAlignedBoundingBox(box.minimum, box.maximum, box.center);
}
result.minimum = Cartesian3_default.clone(box.minimum, result.minimum);
result.maximum = Cartesian3_default.clone(box.maximum, result.maximum);
result.center = Cartesian3_default.clone(box.center, result.center);
return result;
};
AxisAlignedBoundingBox.equals = function(left, right) {
return left === right || defined_default(left) && defined_default(right) && Cartesian3_default.equals(left.center, right.center) && Cartesian3_default.equals(left.minimum, right.minimum) && Cartesian3_default.equals(left.maximum, right.maximum);
};
var intersectScratch = new Cartesian3_default();
AxisAlignedBoundingBox.intersectPlane = function(box, plane) {
Check_default.defined("box", box);
Check_default.defined("plane", plane);
intersectScratch = Cartesian3_default.subtract(
box.maximum,
box.minimum,
intersectScratch
);
const h = Cartesian3_default.multiplyByScalar(
intersectScratch,
0.5,
intersectScratch
);
const normal = plane.normal;
const e = h.x * Math.abs(normal.x) + h.y * Math.abs(normal.y) + h.z * Math.abs(normal.z);
const s = Cartesian3_default.dot(box.center, normal) + plane.distance;
if (s - e > 0) {
return Intersect_default.INSIDE;
}
if (s + e < 0) {
return Intersect_default.OUTSIDE;
}
return Intersect_default.INTERSECTING;
};
AxisAlignedBoundingBox.prototype.clone = function(result) {
return AxisAlignedBoundingBox.clone(this, result);
};
AxisAlignedBoundingBox.prototype.intersectPlane = function(plane) {
return AxisAlignedBoundingBox.intersectPlane(this, plane);
};
AxisAlignedBoundingBox.prototype.equals = function(right) {
return AxisAlignedBoundingBox.equals(this, right);
};
var AxisAlignedBoundingBox_default = AxisAlignedBoundingBox;
export {
AxisAlignedBoundingBox_default
};
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.121.2
*
* Copyright 2011-2022 Cesium Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Columbus View (Pat. Pend.)
*
* Portions licensed separately.
* See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
*/
import {
Cartesian3_default
} from "./chunk-FFLMY4TE.js";
import {
Check_default
} from "./chunk-P6TRGU3S.js";
import {
defined_default
} from "./chunk-YCDZX5LS.js";
// packages/engine/Source/Core/EncodedCartesian3.js
function EncodedCartesian3() {
this.high = Cartesian3_default.clone(Cartesian3_default.ZERO);
this.low = Cartesian3_default.clone(Cartesian3_default.ZERO);
}
EncodedCartesian3.encode = function(value, result) {
Check_default.typeOf.number("value", value);
if (!defined_default(result)) {
result = {
high: 0,
low: 0
};
}
let doubleHigh;
if (value >= 0) {
doubleHigh = Math.floor(value / 65536) * 65536;
result.high = doubleHigh;
result.low = value - doubleHigh;
} else {
doubleHigh = Math.floor(-value / 65536) * 65536;
result.high = -doubleHigh;
result.low = value + doubleHigh;
}
return result;
};
var scratchEncode = {
high: 0,
low: 0
};
EncodedCartesian3.fromCartesian = function(cartesian, result) {
Check_default.typeOf.object("cartesian", cartesian);
if (!defined_default(result)) {
result = new EncodedCartesian3();
}
const high = result.high;
const low = result.low;
EncodedCartesian3.encode(cartesian.x, scratchEncode);
high.x = scratchEncode.high;
low.x = scratchEncode.low;
EncodedCartesian3.encode(cartesian.y, scratchEncode);
high.y = scratchEncode.high;
low.y = scratchEncode.low;
EncodedCartesian3.encode(cartesian.z, scratchEncode);
high.z = scratchEncode.high;
low.z = scratchEncode.low;
return result;
};
var encodedP = new EncodedCartesian3();
EncodedCartesian3.writeElements = function(cartesian, cartesianArray, index) {
Check_default.defined("cartesianArray", cartesianArray);
Check_default.typeOf.number("index", index);
Check_default.typeOf.number.greaterThanOrEquals("index", index, 0);
EncodedCartesian3.fromCartesian(cartesian, encodedP);
const high = encodedP.high;
const low = encodedP.low;
cartesianArray[index] = high.x;
cartesianArray[index + 1] = high.y;
cartesianArray[index + 2] = high.z;
cartesianArray[index + 3] = low.x;
cartesianArray[index + 4] = low.y;
cartesianArray[index + 5] = low.z;
};
var EncodedCartesian3_default = EncodedCartesian3;
export {
EncodedCartesian3_default
};
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.121.2
*
* Copyright 2011-2022 Cesium Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Columbus View (Pat. Pend.)
*
* Portions licensed separately.
* See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
*/
import {
Math_default
} from "./chunk-WGDFYAGC.js";
// packages/engine/Source/Core/CylinderGeometryLibrary.js
var CylinderGeometryLibrary = {};
CylinderGeometryLibrary.computePositions = function(length, topRadius, bottomRadius, slices, fill) {
const topZ = length * 0.5;
const bottomZ = -topZ;
const twoSlice = slices + slices;
const size = fill ? 2 * twoSlice : twoSlice;
const positions = new Float64Array(size * 3);
let i;
let index = 0;
let tbIndex = 0;
const bottomOffset = fill ? twoSlice * 3 : 0;
const topOffset = fill ? (twoSlice + slices) * 3 : slices * 3;
for (i = 0; i < slices; i++) {
const angle = i / slices * Math_default.TWO_PI;
const x = Math.cos(angle);
const y = Math.sin(angle);
const bottomX = x * bottomRadius;
const bottomY = y * bottomRadius;
const topX = x * topRadius;
const topY = y * topRadius;
positions[tbIndex + bottomOffset] = bottomX;
positions[tbIndex + bottomOffset + 1] = bottomY;
positions[tbIndex + bottomOffset + 2] = bottomZ;
positions[tbIndex + topOffset] = topX;
positions[tbIndex + topOffset + 1] = topY;
positions[tbIndex + topOffset + 2] = topZ;
tbIndex += 3;
if (fill) {
positions[index++] = bottomX;
positions[index++] = bottomY;
positions[index++] = bottomZ;
positions[index++] = topX;
positions[index++] = topY;
positions[index++] = topZ;
}
}
return positions;
};
var CylinderGeometryLibrary_default = CylinderGeometryLibrary;
export {
CylinderGeometryLibrary_default
};
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.121.2
*
* Copyright 2011-2022 Cesium Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Columbus View (Pat. Pend.)
*
* Portions licensed separately.
* See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
*/
import {
GeometryOffsetAttribute_default
} from "./chunk-GBT7MJ6X.js";
import {
IndexDatatype_default
} from "./chunk-C4WPMOKT.js";
import {
GeometryAttributes_default
} from "./chunk-X7IQYYHF.js";
import {
GeometryAttribute_default,
Geometry_default,
PrimitiveType_default
} from "./chunk-JXVLNVXC.js";
import {
BoundingSphere_default
} from "./chunk-KHZNBFOH.js";
import {
ComponentDatatype_default
} from "./chunk-XIUSRWL6.js";
import {
Cartesian3_default,
Ellipsoid_default
} from "./chunk-FFLMY4TE.js";
import {
Math_default
} from "./chunk-WGDFYAGC.js";
import {
defaultValue_default
} from "./chunk-U5HSOKPQ.js";
import {
DeveloperError_default
} from "./chunk-P6TRGU3S.js";
import {
defined_default
} from "./chunk-YCDZX5LS.js";
// packages/engine/Source/Core/EllipsoidOutlineGeometry.js
var defaultRadii = new Cartesian3_default(1, 1, 1);
var cos = Math.cos;
var sin = Math.sin;
function EllipsoidOutlineGeometry(options) {
options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
const radii = defaultValue_default(options.radii, defaultRadii);
const innerRadii = defaultValue_default(options.innerRadii, radii);
const minimumClock = defaultValue_default(options.minimumClock, 0);
const maximumClock = defaultValue_default(options.maximumClock, Math_default.TWO_PI);
const minimumCone = defaultValue_default(options.minimumCone, 0);
const maximumCone = defaultValue_default(options.maximumCone, Math_default.PI);
const stackPartitions = Math.round(defaultValue_default(options.stackPartitions, 10));
const slicePartitions = Math.round(defaultValue_default(options.slicePartitions, 8));
const subdivisions = Math.round(defaultValue_default(options.subdivisions, 128));
if (stackPartitions < 1) {
throw new DeveloperError_default("options.stackPartitions cannot be less than 1");
}
if (slicePartitions < 0) {
throw new DeveloperError_default("options.slicePartitions cannot be less than 0");
}
if (subdivisions < 0) {
throw new DeveloperError_default(
"options.subdivisions must be greater than or equal to zero."
);
}
if (defined_default(options.offsetAttribute) && options.offsetAttribute === GeometryOffsetAttribute_default.TOP) {
throw new DeveloperError_default(
"GeometryOffsetAttribute.TOP is not a supported options.offsetAttribute for this geometry."
);
}
this._radii = Cartesian3_default.clone(radii);
this._innerRadii = Cartesian3_default.clone(innerRadii);
this._minimumClock = minimumClock;
this._maximumClock = maximumClock;
this._minimumCone = minimumCone;
this._maximumCone = maximumCone;
this._stackPartitions = stackPartitions;
this._slicePartitions = slicePartitions;
this._subdivisions = subdivisions;
this._offsetAttribute = options.offsetAttribute;
this._workerName = "createEllipsoidOutlineGeometry";
}
EllipsoidOutlineGeometry.packedLength = 2 * Cartesian3_default.packedLength + 8;
EllipsoidOutlineGeometry.pack = function(value, array, startingIndex) {
if (!defined_default(value)) {
throw new DeveloperError_default("value is required");
}
if (!defined_default(array)) {
throw new DeveloperError_default("array is required");
}
startingIndex = defaultValue_default(startingIndex, 0);
Cartesian3_default.pack(value._radii, array, startingIndex);
startingIndex += Cartesian3_default.packedLength;
Cartesian3_default.pack(value._innerRadii, array, startingIndex);
startingIndex += Cartesian3_default.packedLength;
array[startingIndex++] = value._minimumClock;
array[startingIndex++] = value._maximumClock;
array[startingIndex++] = value._minimumCone;
array[startingIndex++] = value._maximumCone;
array[startingIndex++] = value._stackPartitions;
array[startingIndex++] = value._slicePartitions;
array[startingIndex++] = value._subdivisions;
array[startingIndex] = defaultValue_default(value._offsetAttribute, -1);
return array;
};
var scratchRadii = new Cartesian3_default();
var scratchInnerRadii = new Cartesian3_default();
var scratchOptions = {
radii: scratchRadii,
innerRadii: scratchInnerRadii,
minimumClock: void 0,
maximumClock: void 0,
minimumCone: void 0,
maximumCone: void 0,
stackPartitions: void 0,
slicePartitions: void 0,
subdivisions: void 0,
offsetAttribute: void 0
};
EllipsoidOutlineGeometry.unpack = function(array, startingIndex, result) {
if (!defined_default(array)) {
throw new DeveloperError_default("array is required");
}
startingIndex = defaultValue_default(startingIndex, 0);
const radii = Cartesian3_default.unpack(array, startingIndex, scratchRadii);
startingIndex += Cartesian3_default.packedLength;
const innerRadii = Cartesian3_default.unpack(array, startingIndex, scratchInnerRadii);
startingIndex += Cartesian3_default.packedLength;
const minimumClock = array[startingIndex++];
const maximumClock = array[startingIndex++];
const minimumCone = array[startingIndex++];
const maximumCone = array[startingIndex++];
const stackPartitions = array[startingIndex++];
const slicePartitions = array[startingIndex++];
const subdivisions = array[startingIndex++];
const offsetAttribute = array[startingIndex];
if (!defined_default(result)) {
scratchOptions.minimumClock = minimumClock;
scratchOptions.maximumClock = maximumClock;
scratchOptions.minimumCone = minimumCone;
scratchOptions.maximumCone = maximumCone;
scratchOptions.stackPartitions = stackPartitions;
scratchOptions.slicePartitions = slicePartitions;
scratchOptions.subdivisions = subdivisions;
scratchOptions.offsetAttribute = offsetAttribute === -1 ? void 0 : offsetAttribute;
return new EllipsoidOutlineGeometry(scratchOptions);
}
result._radii = Cartesian3_default.clone(radii, result._radii);
result._innerRadii = Cartesian3_default.clone(innerRadii, result._innerRadii);
result._minimumClock = minimumClock;
result._maximumClock = maximumClock;
result._minimumCone = minimumCone;
result._maximumCone = maximumCone;
result._stackPartitions = stackPartitions;
result._slicePartitions = slicePartitions;
result._subdivisions = subdivisions;
result._offsetAttribute = offsetAttribute === -1 ? void 0 : offsetAttribute;
return result;
};
EllipsoidOutlineGeometry.createGeometry = function(ellipsoidGeometry) {
const radii = ellipsoidGeometry._radii;
if (radii.x <= 0 || radii.y <= 0 || radii.z <= 0) {
return;
}
const innerRadii = ellipsoidGeometry._innerRadii;
if (innerRadii.x <= 0 || innerRadii.y <= 0 || innerRadii.z <= 0) {
return;
}
const minimumClock = ellipsoidGeometry._minimumClock;
const maximumClock = ellipsoidGeometry._maximumClock;
const minimumCone = ellipsoidGeometry._minimumCone;
const maximumCone = ellipsoidGeometry._maximumCone;
const subdivisions = ellipsoidGeometry._subdivisions;
const ellipsoid = Ellipsoid_default.fromCartesian3(radii);
let slicePartitions = ellipsoidGeometry._slicePartitions + 1;
let stackPartitions = ellipsoidGeometry._stackPartitions + 1;
slicePartitions = Math.round(
slicePartitions * Math.abs(maximumClock - minimumClock) / Math_default.TWO_PI
);
stackPartitions = Math.round(
stackPartitions * Math.abs(maximumCone - minimumCone) / Math_default.PI
);
if (slicePartitions < 2) {
slicePartitions = 2;
}
if (stackPartitions < 2) {
stackPartitions = 2;
}
let extraIndices = 0;
let vertexMultiplier = 1;
const hasInnerSurface = innerRadii.x !== radii.x || innerRadii.y !== radii.y || innerRadii.z !== radii.z;
let isTopOpen = false;
let isBotOpen = false;
if (hasInnerSurface) {
vertexMultiplier = 2;
if (minimumCone > 0) {
isTopOpen = true;
extraIndices += slicePartitions;
}
if (maximumCone < Math.PI) {
isBotOpen = true;
extraIndices += slicePartitions;
}
}
const vertexCount = subdivisions * vertexMultiplier * (stackPartitions + slicePartitions);
const positions = new Float64Array(vertexCount * 3);
const numIndices = 2 * (vertexCount + extraIndices - (slicePartitions + stackPartitions) * vertexMultiplier);
const indices = IndexDatatype_default.createTypedArray(vertexCount, numIndices);
let i;
let j;
let theta;
let phi;
let index = 0;
const sinPhi = new Array(stackPartitions);
const cosPhi = new Array(stackPartitions);
for (i = 0; i < stackPartitions; i++) {
phi = minimumCone + i * (maximumCone - minimumCone) / (stackPartitions - 1);
sinPhi[i] = sin(phi);
cosPhi[i] = cos(phi);
}
const sinTheta = new Array(subdivisions);
const cosTheta = new Array(subdivisions);
for (i = 0; i < subdivisions; i++) {
theta = minimumClock + i * (maximumClock - minimumClock) / (subdivisions - 1);
sinTheta[i] = sin(theta);
cosTheta[i] = cos(theta);
}
for (i = 0; i < stackPartitions; i++) {
for (j = 0; j < subdivisions; j++) {
positions[index++] = radii.x * sinPhi[i] * cosTheta[j];
positions[index++] = radii.y * sinPhi[i] * sinTheta[j];
positions[index++] = radii.z * cosPhi[i];
}
}
if (hasInnerSurface) {
for (i = 0; i < stackPartitions; i++) {
for (j = 0; j < subdivisions; j++) {
positions[index++] = innerRadii.x * sinPhi[i] * cosTheta[j];
positions[index++] = innerRadii.y * sinPhi[i] * sinTheta[j];
positions[index++] = innerRadii.z * cosPhi[i];
}
}
}
sinPhi.length = subdivisions;
cosPhi.length = subdivisions;
for (i = 0; i < subdivisions; i++) {
phi = minimumCone + i * (maximumCone - minimumCone) / (subdivisions - 1);
sinPhi[i] = sin(phi);
cosPhi[i] = cos(phi);
}
sinTheta.length = slicePartitions;
cosTheta.length = slicePartitions;
for (i = 0; i < slicePartitions; i++) {
theta = minimumClock + i * (maximumClock - minimumClock) / (slicePartitions - 1);
sinTheta[i] = sin(theta);
cosTheta[i] = cos(theta);
}
for (i = 0; i < subdivisions; i++) {
for (j = 0; j < slicePartitions; j++) {
positions[index++] = radii.x * sinPhi[i] * cosTheta[j];
positions[index++] = radii.y * sinPhi[i] * sinTheta[j];
positions[index++] = radii.z * cosPhi[i];
}
}
if (hasInnerSurface) {
for (i = 0; i < subdivisions; i++) {
for (j = 0; j < slicePartitions; j++) {
positions[index++] = innerRadii.x * sinPhi[i] * cosTheta[j];
positions[index++] = innerRadii.y * sinPhi[i] * sinTheta[j];
positions[index++] = innerRadii.z * cosPhi[i];
}
}
}
index = 0;
for (i = 0; i < stackPartitions * vertexMultiplier; i++) {
const topOffset = i * subdivisions;
for (j = 0; j < subdivisions - 1; j++) {
indices[index++] = topOffset + j;
indices[index++] = topOffset + j + 1;
}
}
let offset = stackPartitions * subdivisions * vertexMultiplier;
for (i = 0; i < slicePartitions; i++) {
for (j = 0; j < subdivisions - 1; j++) {
indices[index++] = offset + i + j * slicePartitions;
indices[index++] = offset + i + (j + 1) * slicePartitions;
}
}
if (hasInnerSurface) {
offset = stackPartitions * subdivisions * vertexMultiplier + slicePartitions * subdivisions;
for (i = 0; i < slicePartitions; i++) {
for (j = 0; j < subdivisions - 1; j++) {
indices[index++] = offset + i + j * slicePartitions;
indices[index++] = offset + i + (j + 1) * slicePartitions;
}
}
}
if (hasInnerSurface) {
let outerOffset = stackPartitions * subdivisions * vertexMultiplier;
let innerOffset = outerOffset + subdivisions * slicePartitions;
if (isTopOpen) {
for (i = 0; i < slicePartitions; i++) {
indices[index++] = outerOffset + i;
indices[index++] = innerOffset + i;
}
}
if (isBotOpen) {
outerOffset += subdivisions * slicePartitions - slicePartitions;
innerOffset += subdivisions * slicePartitions - slicePartitions;
for (i = 0; i < slicePartitions; i++) {
indices[index++] = outerOffset + i;
indices[index++] = innerOffset + i;
}
}
}
const attributes = new GeometryAttributes_default({
position: new GeometryAttribute_default({
componentDatatype: ComponentDatatype_default.DOUBLE,
componentsPerAttribute: 3,
values: positions
})
});
if (defined_default(ellipsoidGeometry._offsetAttribute)) {
const length = positions.length;
const offsetValue = ellipsoidGeometry._offsetAttribute === GeometryOffsetAttribute_default.NONE ? 0 : 1;
const applyOffset = new Uint8Array(length / 3).fill(offsetValue);
attributes.applyOffset = new GeometryAttribute_default({
componentDatatype: ComponentDatatype_default.UNSIGNED_BYTE,
componentsPerAttribute: 1,
values: applyOffset
});
}
return new Geometry_default({
attributes,
indices,
primitiveType: PrimitiveType_default.LINES,
boundingSphere: BoundingSphere_default.fromEllipsoid(ellipsoid),
offsetAttribute: ellipsoidGeometry._offsetAttribute
});
};
var EllipsoidOutlineGeometry_default = EllipsoidOutlineGeometry;
export {
EllipsoidOutlineGeometry_default
};
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.121.2
*
* Copyright 2011-2022 Cesium Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Columbus View (Pat. Pend.)
*
* Portions licensed separately.
* See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
*/
import {
defined_default
} from "./chunk-YCDZX5LS.js";
// packages/engine/Source/Core/DeveloperError.js
function DeveloperError(message) {
this.name = "DeveloperError";
this.message = message;
let stack;
try {
throw new Error();
} catch (e) {
stack = e.stack;
}
this.stack = stack;
}
if (defined_default(Object.create)) {
DeveloperError.prototype = Object.create(Error.prototype);
DeveloperError.prototype.constructor = DeveloperError;
}
DeveloperError.prototype.toString = function() {
let str = `${this.name}: ${this.message}`;
if (defined_default(this.stack)) {
str += `
${this.stack.toString()}`;
}
return str;
};
DeveloperError.throwInstantiationError = function() {
throw new DeveloperError(
"This function defines an interface and should not be called directly."
);
};
var DeveloperError_default = DeveloperError;
// packages/engine/Source/Core/Check.js
var Check = {};
Check.typeOf = {};
function getUndefinedErrorMessage(name) {
return `${name} is required, actual value was undefined`;
}
function getFailedTypeErrorMessage(actual, expected, name) {
return `Expected ${name} to be typeof ${expected}, actual typeof was ${actual}`;
}
Check.defined = function(name, test) {
if (!defined_default(test)) {
throw new DeveloperError_default(getUndefinedErrorMessage(name));
}
};
Check.typeOf.func = function(name, test) {
if (typeof test !== "function") {
throw new DeveloperError_default(
getFailedTypeErrorMessage(typeof test, "function", name)
);
}
};
Check.typeOf.string = function(name, test) {
if (typeof test !== "string") {
throw new DeveloperError_default(
getFailedTypeErrorMessage(typeof test, "string", name)
);
}
};
Check.typeOf.number = function(name, test) {
if (typeof test !== "number") {
throw new DeveloperError_default(
getFailedTypeErrorMessage(typeof test, "number", name)
);
}
};
Check.typeOf.number.lessThan = function(name, test, limit) {
Check.typeOf.number(name, test);
if (test >= limit) {
throw new DeveloperError_default(
`Expected ${name} to be less than ${limit}, actual value was ${test}`
);
}
};
Check.typeOf.number.lessThanOrEquals = function(name, test, limit) {
Check.typeOf.number(name, test);
if (test > limit) {
throw new DeveloperError_default(
`Expected ${name} to be less than or equal to ${limit}, actual value was ${test}`
);
}
};
Check.typeOf.number.greaterThan = function(name, test, limit) {
Check.typeOf.number(name, test);
if (test <= limit) {
throw new DeveloperError_default(
`Expected ${name} to be greater than ${limit}, actual value was ${test}`
);
}
};
Check.typeOf.number.greaterThanOrEquals = function(name, test, limit) {
Check.typeOf.number(name, test);
if (test < limit) {
throw new DeveloperError_default(
`Expected ${name} to be greater than or equal to ${limit}, actual value was ${test}`
);
}
};
Check.typeOf.object = function(name, test) {
if (typeof test !== "object") {
throw new DeveloperError_default(
getFailedTypeErrorMessage(typeof test, "object", name)
);
}
};
Check.typeOf.bool = function(name, test) {
if (typeof test !== "boolean") {
throw new DeveloperError_default(
getFailedTypeErrorMessage(typeof test, "boolean", name)
);
}
};
Check.typeOf.bigint = function(name, test) {
if (typeof test !== "bigint") {
throw new DeveloperError_default(
getFailedTypeErrorMessage(typeof test, "bigint", name)
);
}
};
Check.typeOf.number.equals = function(name1, name2, test1, test2) {
Check.typeOf.number(name1, test1);
Check.typeOf.number(name2, test2);
if (test1 !== test2) {
throw new DeveloperError_default(
`${name1} must be equal to ${name2}, the actual values are ${test1} and ${test2}`
);
}
};
var Check_default = Check;
export {
DeveloperError_default,
Check_default
};
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.121.2
*
* Copyright 2011-2022 Cesium Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Columbus View (Pat. Pend.)
*
* Portions licensed separately.
* See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
*/
import {
EllipsoidGeodesic_default
} from "./chunk-C3EQ27WF.js";
import {
EllipsoidRhumbLine_default
} from "./chunk-JSQJDZI4.js";
import {
IntersectionTests_default
} from "./chunk-QQOZO7KO.js";
import {
Plane_default
} from "./chunk-EDLRS3AW.js";
import {
Matrix4_default
} from "./chunk-6SQMLVGV.js";
import {
Cartesian3_default,
Cartographic_default,
Ellipsoid_default
} from "./chunk-FFLMY4TE.js";
import {
Math_default
} from "./chunk-WGDFYAGC.js";
import {
defaultValue_default
} from "./chunk-U5HSOKPQ.js";
import {
DeveloperError_default
} from "./chunk-P6TRGU3S.js";
import {
defined_default
} from "./chunk-YCDZX5LS.js";
// packages/engine/Source/Core/PolylinePipeline.js
var PolylinePipeline = {};
PolylinePipeline.numberOfPoints = function(p0, p1, minDistance) {
const distance = Cartesian3_default.distance(p0, p1);
return Math.ceil(distance / minDistance);
};
PolylinePipeline.numberOfPointsRhumbLine = function(p0, p1, granularity) {
const radiansDistanceSquared = Math.pow(p0.longitude - p1.longitude, 2) + Math.pow(p0.latitude - p1.latitude, 2);
return Math.max(
1,
Math.ceil(Math.sqrt(radiansDistanceSquared / (granularity * granularity)))
);
};
var cartoScratch = new Cartographic_default();
PolylinePipeline.extractHeights = function(positions, ellipsoid) {
const length = positions.length;
const heights = new Array(length);
for (let i = 0; i < length; i++) {
const p = positions[i];
heights[i] = ellipsoid.cartesianToCartographic(p, cartoScratch).height;
}
return heights;
};
var wrapLongitudeInversMatrix = new Matrix4_default();
var wrapLongitudeOrigin = new Cartesian3_default();
var wrapLongitudeXZNormal = new Cartesian3_default();
var wrapLongitudeXZPlane = new Plane_default(Cartesian3_default.UNIT_X, 0);
var wrapLongitudeYZNormal = new Cartesian3_default();
var wrapLongitudeYZPlane = new Plane_default(Cartesian3_default.UNIT_X, 0);
var wrapLongitudeIntersection = new Cartesian3_default();
var wrapLongitudeOffset = new Cartesian3_default();
var subdivideHeightsScratchArray = [];
function subdivideHeights(numPoints, h0, h1) {
const heights = subdivideHeightsScratchArray;
heights.length = numPoints;
let i;
if (h0 === h1) {
for (i = 0; i < numPoints; i++) {
heights[i] = h0;
}
return heights;
}
const dHeight = h1 - h0;
const heightPerVertex = dHeight / numPoints;
for (i = 0; i < numPoints; i++) {
const h = h0 + i * heightPerVertex;
heights[i] = h;
}
return heights;
}
var carto1 = new Cartographic_default();
var carto2 = new Cartographic_default();
var cartesian = new Cartesian3_default();
var scaleFirst = new Cartesian3_default();
var scaleLast = new Cartesian3_default();
var ellipsoidGeodesic = new EllipsoidGeodesic_default();
var ellipsoidRhumb = new EllipsoidRhumbLine_default();
function generateCartesianArc(p0, p1, minDistance, ellipsoid, h0, h1, array, offset) {
const first = ellipsoid.scaleToGeodeticSurface(p0, scaleFirst);
const last = ellipsoid.scaleToGeodeticSurface(p1, scaleLast);
const numPoints = PolylinePipeline.numberOfPoints(p0, p1, minDistance);
const start = ellipsoid.cartesianToCartographic(first, carto1);
const end = ellipsoid.cartesianToCartographic(last, carto2);
const heights = subdivideHeights(numPoints, h0, h1);
ellipsoidGeodesic.setEndPoints(start, end);
const surfaceDistanceBetweenPoints = ellipsoidGeodesic.surfaceDistance / numPoints;
let index = offset;
start.height = h0;
let cart = ellipsoid.cartographicToCartesian(start, cartesian);
Cartesian3_default.pack(cart, array, index);
index += 3;
for (let i = 1; i < numPoints; i++) {
const carto = ellipsoidGeodesic.interpolateUsingSurfaceDistance(
i * surfaceDistanceBetweenPoints,
carto2
);
carto.height = heights[i];
cart = ellipsoid.cartographicToCartesian(carto, cartesian);
Cartesian3_default.pack(cart, array, index);
index += 3;
}
return index;
}
function generateCartesianRhumbArc(p0, p1, granularity, ellipsoid, h0, h1, array, offset) {
const start = ellipsoid.cartesianToCartographic(p0, carto1);
const end = ellipsoid.cartesianToCartographic(p1, carto2);
const numPoints = PolylinePipeline.numberOfPointsRhumbLine(
start,
end,
granularity
);
start.height = 0;
end.height = 0;
const heights = subdivideHeights(numPoints, h0, h1);
if (!ellipsoidRhumb.ellipsoid.equals(ellipsoid)) {
ellipsoidRhumb = new EllipsoidRhumbLine_default(void 0, void 0, ellipsoid);
}
ellipsoidRhumb.setEndPoints(start, end);
const surfaceDistanceBetweenPoints = ellipsoidRhumb.surfaceDistance / numPoints;
let index = offset;
start.height = h0;
let cart = ellipsoid.cartographicToCartesian(start, cartesian);
Cartesian3_default.pack(cart, array, index);
index += 3;
for (let i = 1; i < numPoints; i++) {
const carto = ellipsoidRhumb.interpolateUsingSurfaceDistance(
i * surfaceDistanceBetweenPoints,
carto2
);
carto.height = heights[i];
cart = ellipsoid.cartographicToCartesian(carto, cartesian);
Cartesian3_default.pack(cart, array, index);
index += 3;
}
return index;
}
PolylinePipeline.wrapLongitude = function(positions, modelMatrix) {
const cartesians = [];
const segments = [];
if (defined_default(positions) && positions.length > 0) {
modelMatrix = defaultValue_default(modelMatrix, Matrix4_default.IDENTITY);
const inverseModelMatrix = Matrix4_default.inverseTransformation(
modelMatrix,
wrapLongitudeInversMatrix
);
const origin = Matrix4_default.multiplyByPoint(
inverseModelMatrix,
Cartesian3_default.ZERO,
wrapLongitudeOrigin
);
const xzNormal = Cartesian3_default.normalize(
Matrix4_default.multiplyByPointAsVector(
inverseModelMatrix,
Cartesian3_default.UNIT_Y,
wrapLongitudeXZNormal
),
wrapLongitudeXZNormal
);
const xzPlane = Plane_default.fromPointNormal(
origin,
xzNormal,
wrapLongitudeXZPlane
);
const yzNormal = Cartesian3_default.normalize(
Matrix4_default.multiplyByPointAsVector(
inverseModelMatrix,
Cartesian3_default.UNIT_X,
wrapLongitudeYZNormal
),
wrapLongitudeYZNormal
);
const yzPlane = Plane_default.fromPointNormal(
origin,
yzNormal,
wrapLongitudeYZPlane
);
let count = 1;
cartesians.push(Cartesian3_default.clone(positions[0]));
let prev = cartesians[0];
const length = positions.length;
for (let i = 1; i < length; ++i) {
const cur = positions[i];
if (Plane_default.getPointDistance(yzPlane, prev) < 0 || Plane_default.getPointDistance(yzPlane, cur) < 0) {
const intersection = IntersectionTests_default.lineSegmentPlane(
prev,
cur,
xzPlane,
wrapLongitudeIntersection
);
if (defined_default(intersection)) {
const offset = Cartesian3_default.multiplyByScalar(
xzNormal,
5e-9,
wrapLongitudeOffset
);
if (Plane_default.getPointDistance(xzPlane, prev) < 0) {
Cartesian3_default.negate(offset, offset);
}
cartesians.push(
Cartesian3_default.add(intersection, offset, new Cartesian3_default())
);
segments.push(count + 1);
Cartesian3_default.negate(offset, offset);
cartesians.push(
Cartesian3_default.add(intersection, offset, new Cartesian3_default())
);
count = 1;
}
}
cartesians.push(Cartesian3_default.clone(positions[i]));
count++;
prev = cur;
}
segments.push(count);
}
return {
positions: cartesians,
lengths: segments
};
};
PolylinePipeline.generateArc = function(options) {
if (!defined_default(options)) {
options = {};
}
const positions = options.positions;
if (!defined_default(positions)) {
throw new DeveloperError_default("options.positions is required.");
}
const length = positions.length;
const ellipsoid = defaultValue_default(options.ellipsoid, Ellipsoid_default.default);
let height = defaultValue_default(options.height, 0);
const hasHeightArray = Array.isArray(height);
if (length < 1) {
return [];
} else if (length === 1) {
const p = ellipsoid.scaleToGeodeticSurface(positions[0], scaleFirst);
height = hasHeightArray ? height[0] : height;
if (height !== 0) {
const n = ellipsoid.geodeticSurfaceNormal(p, cartesian);
Cartesian3_default.multiplyByScalar(n, height, n);
Cartesian3_default.add(p, n, p);
}
return [p.x, p.y, p.z];
}
let minDistance = options.minDistance;
if (!defined_default(minDistance)) {
const granularity = defaultValue_default(
options.granularity,
Math_default.RADIANS_PER_DEGREE
);
minDistance = Math_default.chordLength(granularity, ellipsoid.maximumRadius);
}
let numPoints = 0;
let i;
for (i = 0; i < length - 1; i++) {
numPoints += PolylinePipeline.numberOfPoints(
positions[i],
positions[i + 1],
minDistance
);
}
const arrayLength = (numPoints + 1) * 3;
const newPositions = new Array(arrayLength);
let offset = 0;
for (i = 0; i < length - 1; i++) {
const p0 = positions[i];
const p1 = positions[i + 1];
const h0 = hasHeightArray ? height[i] : height;
const h1 = hasHeightArray ? height[i + 1] : height;
offset = generateCartesianArc(
p0,
p1,
minDistance,
ellipsoid,
h0,
h1,
newPositions,
offset
);
}
subdivideHeightsScratchArray.length = 0;
const lastPoint = positions[length - 1];
const carto = ellipsoid.cartesianToCartographic(lastPoint, carto1);
carto.height = hasHeightArray ? height[length - 1] : height;
const cart = ellipsoid.cartographicToCartesian(carto, cartesian);
Cartesian3_default.pack(cart, newPositions, arrayLength - 3);
return newPositions;
};
var scratchCartographic0 = new Cartographic_default();
var scratchCartographic1 = new Cartographic_default();
PolylinePipeline.generateRhumbArc = function(options) {
if (!defined_default(options)) {
options = {};
}
const positions = options.positions;
if (!defined_default(positions)) {
throw new DeveloperError_default("options.positions is required.");
}
const length = positions.length;
const ellipsoid = defaultValue_default(options.ellipsoid, Ellipsoid_default.default);
let height = defaultValue_default(options.height, 0);
const hasHeightArray = Array.isArray(height);
if (length < 1) {
return [];
} else if (length === 1) {
const p = ellipsoid.scaleToGeodeticSurface(positions[0], scaleFirst);
height = hasHeightArray ? height[0] : height;
if (height !== 0) {
const n = ellipsoid.geodeticSurfaceNormal(p, cartesian);
Cartesian3_default.multiplyByScalar(n, height, n);
Cartesian3_default.add(p, n, p);
}
return [p.x, p.y, p.z];
}
const granularity = defaultValue_default(
options.granularity,
Math_default.RADIANS_PER_DEGREE
);
let numPoints = 0;
let i;
let c0 = ellipsoid.cartesianToCartographic(
positions[0],
scratchCartographic0
);
let c1;
for (i = 0; i < length - 1; i++) {
c1 = ellipsoid.cartesianToCartographic(
positions[i + 1],
scratchCartographic1
);
numPoints += PolylinePipeline.numberOfPointsRhumbLine(c0, c1, granularity);
c0 = Cartographic_default.clone(c1, scratchCartographic0);
}
const arrayLength = (numPoints + 1) * 3;
const newPositions = new Array(arrayLength);
let offset = 0;
for (i = 0; i < length - 1; i++) {
const p0 = positions[i];
const p1 = positions[i + 1];
const h0 = hasHeightArray ? height[i] : height;
const h1 = hasHeightArray ? height[i + 1] : height;
offset = generateCartesianRhumbArc(
p0,
p1,
granularity,
ellipsoid,
h0,
h1,
newPositions,
offset
);
}
subdivideHeightsScratchArray.length = 0;
const lastPoint = positions[length - 1];
const carto = ellipsoid.cartesianToCartographic(lastPoint, carto1);
carto.height = hasHeightArray ? height[length - 1] : height;
const cart = ellipsoid.cartographicToCartesian(carto, cartesian);
Cartesian3_default.pack(cart, newPositions, arrayLength - 3);
return newPositions;
};
PolylinePipeline.generateCartesianArc = function(options) {
const numberArray = PolylinePipeline.generateArc(options);
const size = numberArray.length / 3;
const newPositions = new Array(size);
for (let i = 0; i < size; i++) {
newPositions[i] = Cartesian3_default.unpack(numberArray, i * 3);
}
return newPositions;
};
PolylinePipeline.generateCartesianRhumbArc = function(options) {
const numberArray = PolylinePipeline.generateRhumbArc(options);
const size = numberArray.length / 3;
const newPositions = new Array(size);
for (let i = 0; i < size; i++) {
newPositions[i] = Cartesian3_default.unpack(numberArray, i * 3);
}
return newPositions;
};
var PolylinePipeline_default = PolylinePipeline;
export {
PolylinePipeline_default
};
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment