feat: 实现供水运营专题大屏BI可视化

- 新增OperationDashboard.vue全屏大屏组件
- 添加6个核心KPI指标卡片: 进水总量/出水总量/产销差率/营收额/平均水质/报警次数
- 实现6个ECharts图表: 供水趋势/水质分布/报警统计/管网空间/设备状态/营收分析
- 创建静态HTML版本operation-dashboard.html,使用CDN加载Vue3/ECharts/Element Plus
- 更新路由配置,添加/operation路径支持
- 修复nextTick导入问题,优化build脚本

🚧 开发者: bot_dev1
📝 任务: #38 [BI] 运营仪表盘 + 供水专题大屏
This commit is contained in:
2026-06-15 09:06:11 +08:00
parent 37bcc78eee
commit 85df71fc28
17426 changed files with 4091508 additions and 47 deletions
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
+147
View File
@@ -0,0 +1,147 @@
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.142.0
*
* 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 {
Cartographic_default,
Ellipsoid_default
} from "./chunk-V7VQKN6N.js";
import {
Cartesian3_default
} from "./chunk-MPZHGZU6.js";
import {
Math_default
} from "./chunk-J6BWOHUF.js";
import {
DeveloperError_default
} from "./chunk-AYKR4VBR.js";
import {
defined_default
} from "./chunk-ZP7JMQV4.js";
// packages/engine/Source/Core/WebMercatorProjection.js
var WebMercatorProjection = class _WebMercatorProjection {
/**
* @param {Ellipsoid} [ellipsoid=Ellipsoid.WGS84] The ellipsoid.
*/
constructor(ellipsoid) {
this._ellipsoid = ellipsoid ?? Ellipsoid_default.WGS84;
this._semimajorAxis = this._ellipsoid.maximumRadius;
this._oneOverSemimajorAxis = 1 / this._semimajorAxis;
}
/**
* Gets the {@link Ellipsoid}.
*
* @type {Ellipsoid}
* @readonly
*/
get ellipsoid() {
return this._ellipsoid;
}
/**
* Converts a Mercator angle, in the range -PI to PI, to a geodetic latitude
* in the range -PI/2 to PI/2.
*
* @param {number} mercatorAngle The angle to convert.
* @returns {number} The geodetic latitude in radians.
*/
static mercatorAngleToGeodeticLatitude(mercatorAngle) {
return Math_default.PI_OVER_TWO - 2 * Math.atan(Math.exp(-mercatorAngle));
}
/**
* Converts a geodetic latitude in radians, in the range -PI/2 to PI/2, to a Mercator
* angle in the range -PI to PI.
*
* @param {number} latitude The geodetic latitude in radians.
* @returns {number} The Mercator angle.
*/
static geodeticLatitudeToMercatorAngle(latitude) {
if (latitude > _WebMercatorProjection.MaximumLatitude) {
latitude = _WebMercatorProjection.MaximumLatitude;
} else if (latitude < -_WebMercatorProjection.MaximumLatitude) {
latitude = -_WebMercatorProjection.MaximumLatitude;
}
const sinLatitude = Math.sin(latitude);
return 0.5 * Math.log((1 + sinLatitude) / (1 - sinLatitude));
}
/**
* Converts geodetic ellipsoid coordinates, in radians, to the equivalent Web Mercator
* X, Y, Z coordinates expressed in meters and returned in a {@link Cartesian3}. The height
* is copied unmodified to the Z coordinate.
*
* @param {Cartographic} cartographic The cartographic coordinates in radians.
* @param {Cartesian3} [result] The instance to which to copy the result, or undefined if a
* new instance should be created.
* @returns {Cartesian3} The equivalent web mercator X, Y, Z coordinates, in meters.
*/
project(cartographic, result) {
const semimajorAxis = this._semimajorAxis;
const x = cartographic.longitude * semimajorAxis;
const y = _WebMercatorProjection.geodeticLatitudeToMercatorAngle(
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;
}
/**
* Converts Web Mercator X, Y coordinates, expressed in meters, to a {@link Cartographic}
* containing geodetic ellipsoid coordinates. The Z coordinate is copied unmodified to the
* height.
*
* @param {Cartesian3} cartesian The web mercator Cartesian position to unrproject with height (z) in meters.
* @param {Cartographic} [result] The instance to which to copy the result, or undefined if a
* new instance should be created.
* @returns {Cartographic} The equivalent cartographic coordinates.
*/
unproject(cartesian, result) {
if (!defined_default(cartesian)) {
throw new DeveloperError_default("cartesian is required");
}
const oneOverEarthSemimajorAxis = this._oneOverSemimajorAxis;
const longitude = cartesian.x * oneOverEarthSemimajorAxis;
const latitude = _WebMercatorProjection.mercatorAngleToGeodeticLatitude(
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;
}
};
WebMercatorProjection.MaximumLatitude = WebMercatorProjection.mercatorAngleToGeodeticLatitude(Math.PI);
var WebMercatorProjection_default = WebMercatorProjection;
export {
WebMercatorProjection_default
};
+101
View File
@@ -0,0 +1,101 @@
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.142.0
*
* 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-ZP7JMQV4.js";
// packages/engine/Source/Core/formatError.js
function formatError(object) {
let result;
const name = object.name;
const message = object.message;
if (defined_default(name) && defined_default(message)) {
result = `${name}: ${message}`;
} else {
result = object.toString();
}
const stack = object.stack;
if (defined_default(stack)) {
result += `
${stack}`;
}
return result;
}
var formatError_default = formatError;
// packages/engine/Source/Workers/createTaskProcessorWorker.js
function createTaskProcessorWorker(workerFunction) {
async function onMessageHandler({ data }) {
const transferableObjects = [];
const responseMessage = {
id: data.id,
result: void 0,
error: void 0
};
self.CESIUM_BASE_URL = data.baseUrl;
try {
const result = await workerFunction(data.parameters, transferableObjects);
responseMessage.result = result;
} catch (error) {
if (error instanceof Error) {
responseMessage.error = {
name: error.name,
message: error.message,
stack: error.stack
};
} else {
responseMessage.error = error;
}
}
if (!data.canTransferArrayBuffer) {
transferableObjects.length = 0;
}
try {
postMessage(responseMessage, transferableObjects);
} catch (error) {
responseMessage.result = void 0;
responseMessage.error = `postMessage failed with error: ${formatError_default(
error
)}
with responseMessage: ${JSON.stringify(responseMessage)}`;
postMessage(responseMessage);
}
}
function onMessageErrorHandler(event) {
postMessage({
id: event.data?.id,
error: `postMessage failed with error: ${JSON.stringify(event)}`
});
}
self.onmessage = onMessageHandler;
self.onmessageerror = onMessageErrorHandler;
return self;
}
var createTaskProcessorWorker_default = createTaskProcessorWorker;
export {
createTaskProcessorWorker_default
};
+398
View File
@@ -0,0 +1,398 @@
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.142.0
*
* 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-IRBKFCEJ.js";
import {
GeometryOffsetAttribute_default
} from "./chunk-IYOUHCZB.js";
import {
VertexFormat_default
} from "./chunk-VQYETPWC.js";
import {
IndexDatatype_default
} from "./chunk-S4MCOY6I.js";
import {
GeometryAttributes_default
} from "./chunk-KSSWJIZW.js";
import {
GeometryAttribute_default,
Geometry_default,
PrimitiveType_default
} from "./chunk-EBSIOBXY.js";
import {
BoundingSphere_default
} from "./chunk-XZMBNNDX.js";
import {
ComponentDatatype_default
} from "./chunk-P3CK7MCY.js";
import {
Cartesian2_default
} from "./chunk-V7VQKN6N.js";
import {
Cartesian3_default,
Frozen_default
} from "./chunk-MPZHGZU6.js";
import {
Math_default
} from "./chunk-J6BWOHUF.js";
import {
DeveloperError_default
} from "./chunk-AYKR4VBR.js";
import {
defined_default
} from "./chunk-ZP7JMQV4.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 = options ?? Frozen_default.EMPTY_OBJECT;
const length = options.length;
const topRadius = options.topRadius;
const bottomRadius = options.bottomRadius;
const vertexFormat = options.vertexFormat ?? VertexFormat_default.DEFAULT;
const slices = 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 = 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] = 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 = 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
};
+455
View File
@@ -0,0 +1,455 @@
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.142.0
*
* 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 {
Cartographic_default,
Ellipsoid_default
} from "./chunk-V7VQKN6N.js";
import {
Cartesian3_default
} from "./chunk-MPZHGZU6.js";
import {
Math_default
} from "./chunk-J6BWOHUF.js";
import {
Check_default,
DeveloperError_default
} from "./chunk-AYKR4VBR.js";
import {
defined_default
} from "./chunk-ZP7JMQV4.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 = 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 = 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
};
+352
View File
@@ -0,0 +1,352 @@
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.142.0
*
* 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 {
Cartographic_default,
Ellipsoid_default
} from "./chunk-V7VQKN6N.js";
import {
Cartesian3_default
} from "./chunk-MPZHGZU6.js";
import {
Math_default
} from "./chunk-J6BWOHUF.js";
import {
Check_default
} from "./chunk-AYKR4VBR.js";
import {
defined_default
} from "./chunk-ZP7JMQV4.js";
// packages/engine/Source/Core/EllipsoidGeodesic.js
function setConstants(ellipsoidGeodesic) {
const uSquared = ellipsoidGeodesic._uSquared;
const a = ellipsoidGeodesic._ellipsoid.maximumRadius;
const b = ellipsoidGeodesic._ellipsoid.minimumRadius;
const f = (a - b) / a;
const cosineHeading = Math.cos(ellipsoidGeodesic._startHeading);
const sineHeading = Math.sin(ellipsoidGeodesic._startHeading);
const tanU = (1 - f) * Math.tan(ellipsoidGeodesic._start.latitude);
const cosineU = 1 / Math.sqrt(1 + tanU * tanU);
const sineU = cosineU * tanU;
const sigma = Math.atan2(tanU, cosineHeading);
const sineAlpha = cosineU * sineHeading;
const sineSquaredAlpha = sineAlpha * sineAlpha;
const cosineSquaredAlpha = 1 - sineSquaredAlpha;
const cosineAlpha = Math.sqrt(cosineSquaredAlpha);
const u2Over4 = uSquared / 4;
const u4Over16 = u2Over4 * u2Over4;
const u6Over64 = u4Over16 * u2Over4;
const u8Over256 = u4Over16 * u4Over16;
const a0 = 1 + u2Over4 - 3 * u4Over16 / 4 + 5 * u6Over64 / 4 - 175 * u8Over256 / 64;
const a1 = 1 - u2Over4 + 15 * u4Over16 / 8 - 35 * u6Over64 / 8;
const a2 = 1 - 3 * u2Over4 + 35 * u4Over16 / 4;
const a3 = 1 - 5 * u2Over4;
const distanceRatio = a0 * sigma - a1 * Math.sin(2 * sigma) * u2Over4 / 2 - a2 * Math.sin(4 * sigma) * u4Over16 / 16 - a3 * Math.sin(6 * sigma) * u6Over64 / 48 - Math.sin(8 * sigma) * 5 * u8Over256 / 512;
const constants = ellipsoidGeodesic._constants;
constants.a = a;
constants.b = b;
constants.f = f;
constants.cosineHeading = cosineHeading;
constants.sineHeading = sineHeading;
constants.tanU = tanU;
constants.cosineU = cosineU;
constants.sineU = sineU;
constants.sigma = sigma;
constants.sineAlpha = sineAlpha;
constants.sineSquaredAlpha = sineSquaredAlpha;
constants.cosineSquaredAlpha = cosineSquaredAlpha;
constants.cosineAlpha = cosineAlpha;
constants.u2Over4 = u2Over4;
constants.u4Over16 = u4Over16;
constants.u6Over64 = u6Over64;
constants.u8Over256 = u8Over256;
constants.a0 = a0;
constants.a1 = a1;
constants.a2 = a2;
constants.a3 = a3;
constants.distanceRatio = distanceRatio;
}
function computeC(f, cosineSquaredAlpha) {
return f * cosineSquaredAlpha * (4 + f * (4 - 3 * cosineSquaredAlpha)) / 16;
}
function computeDeltaLambda(f, sineAlpha, cosineSquaredAlpha, sigma, sineSigma, cosineSigma, cosineTwiceSigmaMidpoint) {
const C = computeC(f, cosineSquaredAlpha);
return (1 - C) * f * sineAlpha * (sigma + C * sineSigma * (cosineTwiceSigmaMidpoint + C * cosineSigma * (2 * cosineTwiceSigmaMidpoint * cosineTwiceSigmaMidpoint - 1)));
}
function vincentyInverseFormula(ellipsoidGeodesic, major, minor, firstLongitude, firstLatitude, secondLongitude, secondLatitude) {
const eff = (major - minor) / major;
const l = secondLongitude - firstLongitude;
const u1 = Math.atan((1 - eff) * Math.tan(firstLatitude));
const u2 = Math.atan((1 - eff) * Math.tan(secondLatitude));
const cosineU1 = Math.cos(u1);
const sineU1 = Math.sin(u1);
const cosineU2 = Math.cos(u2);
const sineU2 = Math.sin(u2);
const cc = cosineU1 * cosineU2;
const cs = cosineU1 * sineU2;
const ss = sineU1 * sineU2;
const sc = sineU1 * cosineU2;
let lambda = l;
let lambdaDot = Math_default.TWO_PI;
let cosineLambda = Math.cos(lambda);
let sineLambda = Math.sin(lambda);
let sigma;
let cosineSigma;
let sineSigma;
let cosineSquaredAlpha;
let cosineTwiceSigmaMidpoint;
do {
cosineLambda = Math.cos(lambda);
sineLambda = Math.sin(lambda);
const temp = cs - sc * cosineLambda;
sineSigma = Math.sqrt(
cosineU2 * cosineU2 * sineLambda * sineLambda + temp * temp
);
cosineSigma = ss + cc * cosineLambda;
sigma = Math.atan2(sineSigma, cosineSigma);
let sineAlpha;
if (sineSigma === 0) {
sineAlpha = 0;
cosineSquaredAlpha = 1;
} else {
sineAlpha = cc * sineLambda / sineSigma;
cosineSquaredAlpha = 1 - sineAlpha * sineAlpha;
}
lambdaDot = lambda;
cosineTwiceSigmaMidpoint = cosineSigma - 2 * ss / cosineSquaredAlpha;
if (!isFinite(cosineTwiceSigmaMidpoint)) {
cosineTwiceSigmaMidpoint = 0;
}
lambda = l + computeDeltaLambda(
eff,
sineAlpha,
cosineSquaredAlpha,
sigma,
sineSigma,
cosineSigma,
cosineTwiceSigmaMidpoint
);
} while (Math.abs(lambda - lambdaDot) > Math_default.EPSILON12);
const uSquared = cosineSquaredAlpha * (major * major - minor * minor) / (minor * minor);
const A = 1 + uSquared * (4096 + uSquared * (uSquared * (320 - 175 * uSquared) - 768)) / 16384;
const B = uSquared * (256 + uSquared * (uSquared * (74 - 47 * uSquared) - 128)) / 1024;
const cosineSquaredTwiceSigmaMidpoint = cosineTwiceSigmaMidpoint * cosineTwiceSigmaMidpoint;
const deltaSigma = B * sineSigma * (cosineTwiceSigmaMidpoint + B * (cosineSigma * (2 * cosineSquaredTwiceSigmaMidpoint - 1) - B * cosineTwiceSigmaMidpoint * (4 * sineSigma * sineSigma - 3) * (4 * cosineSquaredTwiceSigmaMidpoint - 3) / 6) / 4);
const distance = minor * A * (sigma - deltaSigma);
const startHeading = Math.atan2(
cosineU2 * sineLambda,
cs - sc * cosineLambda
);
const endHeading = Math.atan2(cosineU1 * sineLambda, cs * cosineLambda - sc);
ellipsoidGeodesic._distance = distance;
ellipsoidGeodesic._startHeading = startHeading;
ellipsoidGeodesic._endHeading = endHeading;
ellipsoidGeodesic._uSquared = uSquared;
}
var scratchCart1 = new Cartesian3_default();
var scratchCart2 = new Cartesian3_default();
function computeProperties(ellipsoidGeodesic, 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
);
vincentyInverseFormula(
ellipsoidGeodesic,
ellipsoid.maximumRadius,
ellipsoid.minimumRadius,
start.longitude,
start.latitude,
end.longitude,
end.latitude
);
ellipsoidGeodesic._start = Cartographic_default.clone(
start,
ellipsoidGeodesic._start
);
ellipsoidGeodesic._end = Cartographic_default.clone(end, ellipsoidGeodesic._end);
ellipsoidGeodesic._start.height = 0;
ellipsoidGeodesic._end.height = 0;
setConstants(ellipsoidGeodesic);
}
function EllipsoidGeodesic(start, end, ellipsoid) {
const e = ellipsoid ?? Ellipsoid_default.default;
this._ellipsoid = e;
this._start = new Cartographic_default();
this._end = new Cartographic_default();
this._constants = {};
this._startHeading = void 0;
this._endHeading = void 0;
this._distance = void 0;
this._uSquared = void 0;
if (defined_default(start) && defined_default(end)) {
computeProperties(this, start, end, e);
}
}
Object.defineProperties(EllipsoidGeodesic.prototype, {
/**
* Gets the ellipsoid.
* @memberof EllipsoidGeodesic.prototype
* @type {Ellipsoid}
* @readonly
*/
ellipsoid: {
get: function() {
return this._ellipsoid;
}
},
/**
* Gets the surface distance between the start and end point
* @memberof EllipsoidGeodesic.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 EllipsoidGeodesic.prototype
* @type {Cartographic}
* @readonly
*/
start: {
get: function() {
return this._start;
}
},
/**
* Gets the final planetodetic point on the path.
* @memberof EllipsoidGeodesic.prototype
* @type {Cartographic}
* @readonly
*/
end: {
get: function() {
return this._end;
}
},
/**
* Gets the heading at the initial point.
* @memberof EllipsoidGeodesic.prototype
* @type {number}
* @readonly
*/
startHeading: {
get: function() {
Check_default.defined("distance", this._distance);
return this._startHeading;
}
},
/**
* Gets the heading at the final point.
* @memberof EllipsoidGeodesic.prototype
* @type {number}
* @readonly
*/
endHeading: {
get: function() {
Check_default.defined("distance", this._distance);
return this._endHeading;
}
}
});
EllipsoidGeodesic.prototype.setEndPoints = function(start, end) {
Check_default.defined("start", start);
Check_default.defined("end", end);
computeProperties(this, start, end, this._ellipsoid);
};
EllipsoidGeodesic.prototype.interpolateUsingFraction = function(fraction, result) {
return this.interpolateUsingSurfaceDistance(
this._distance * fraction,
result
);
};
EllipsoidGeodesic.prototype.interpolateUsingSurfaceDistance = function(distance, result) {
Check_default.defined("distance", this._distance);
const constants = this._constants;
const s = constants.distanceRatio + distance / constants.b;
const cosine2S = Math.cos(2 * s);
const cosine4S = Math.cos(4 * s);
const cosine6S = Math.cos(6 * s);
const sine2S = Math.sin(2 * s);
const sine4S = Math.sin(4 * s);
const sine6S = Math.sin(6 * s);
const sine8S = Math.sin(8 * s);
const s2 = s * s;
const s3 = s * s2;
const u8Over256 = constants.u8Over256;
const u2Over4 = constants.u2Over4;
const u6Over64 = constants.u6Over64;
const u4Over16 = constants.u4Over16;
let sigma = 2 * s3 * u8Over256 * cosine2S / 3 + s * (1 - u2Over4 + 7 * u4Over16 / 4 - 15 * u6Over64 / 4 + 579 * u8Over256 / 64 - (u4Over16 - 15 * u6Over64 / 4 + 187 * u8Over256 / 16) * cosine2S - (5 * u6Over64 / 4 - 115 * u8Over256 / 16) * cosine4S - 29 * u8Over256 * cosine6S / 16) + (u2Over4 / 2 - u4Over16 + 71 * u6Over64 / 32 - 85 * u8Over256 / 16) * sine2S + (5 * u4Over16 / 16 - 5 * u6Over64 / 4 + 383 * u8Over256 / 96) * sine4S - s2 * ((u6Over64 - 11 * u8Over256 / 2) * sine2S + 5 * u8Over256 * sine4S / 2) + (29 * u6Over64 / 96 - 29 * u8Over256 / 16) * sine6S + 539 * u8Over256 * sine8S / 1536;
const theta = Math.asin(Math.sin(sigma) * constants.cosineAlpha);
const latitude = Math.atan(constants.a / constants.b * Math.tan(theta));
sigma = sigma - constants.sigma;
const cosineTwiceSigmaMidpoint = Math.cos(2 * constants.sigma + sigma);
const sineSigma = Math.sin(sigma);
const cosineSigma = Math.cos(sigma);
const cc = constants.cosineU * cosineSigma;
const ss = constants.sineU * sineSigma;
const lambda = Math.atan2(
sineSigma * constants.sineHeading,
cc - ss * constants.cosineHeading
);
const l = lambda - computeDeltaLambda(
constants.f,
constants.sineAlpha,
constants.cosineSquaredAlpha,
sigma,
sineSigma,
cosineSigma,
cosineTwiceSigmaMidpoint
);
if (defined_default(result)) {
result.longitude = this._start.longitude + l;
result.latitude = latitude;
result.height = 0;
return result;
}
return new Cartographic_default(this._start.longitude + l, latitude, 0);
};
var EllipsoidGeodesic_default = EllipsoidGeodesic;
export {
EllipsoidGeodesic_default
};
+454
View File
@@ -0,0 +1,454 @@
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.142.0
*
* 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
} from "./chunk-MYP774IS.js";
import {
Cartesian4_default,
Matrix4_default
} from "./chunk-Q3PY526V.js";
import {
ComponentDatatype_default
} from "./chunk-P3CK7MCY.js";
import {
Cartesian2_default
} from "./chunk-V7VQKN6N.js";
import {
Cartesian3_default,
Matrix3_default
} from "./chunk-MPZHGZU6.js";
import {
Math_default
} from "./chunk-J6BWOHUF.js";
import {
Check_default,
DeveloperError_default
} from "./chunk-AYKR4VBR.js";
import {
defined_default
} from "./chunk-ZP7JMQV4.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.");
}
};
Object.freeze(AttributeType);
var AttributeType_default = AttributeType;
// packages/engine/Source/Core/AttributeCompression.js
var RIGHT_SHIFT8 = 1 / 256;
var LEFT_SHIFT16 = 65536;
var LEFT_SHIFT8 = 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_SHIFT8);
result.y = forceUint8(octEncodeScratch.x);
result.z = forceUint8(octEncodeScratch.y * RIGHT_SHIFT8);
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_SHIFT8 + y;
const yOct16 = z * LEFT_SHIFT8 + 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.encodeRGB8 = function(color) {
Check_default.typeOf.object("color", color);
return Math.round(Math_default.clamp(color.red * 255, 0, 255)) * LEFT_SHIFT16 + Math.round(Math_default.clamp(color.green * 255, 0, 255)) * LEFT_SHIFT8 + Math.round(Math_default.clamp(color.blue * 255, 0, 255));
};
AttributeCompression.decodeRGB8 = function(encoded, result) {
Check_default.typeOf.number("encoded", encoded);
Check_default.typeOf.object("result", result);
encoded = Math.floor(encoded);
result.red = (encoded >> 16 & 255) / 255;
result.green = (encoded >> 8 & 255) / 255;
result.blue = (encoded & 255) / 255;
return result;
};
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
};
+352
View File
@@ -0,0 +1,352 @@
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.142.0
*
* 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 {
IndexDatatype_default
} from "./chunk-S4MCOY6I.js";
import {
Math_default
} from "./chunk-J6BWOHUF.js";
import {
DeveloperError_default
} from "./chunk-AYKR4VBR.js";
import {
defined_default
} from "./chunk-ZP7JMQV4.js";
// packages/engine/Source/Core/TerrainProvider.js
function TerrainProvider() {
DeveloperError_default.throwInstantiationError();
}
Object.defineProperties(TerrainProvider.prototype, {
/**
* Gets an event that is raised when the terrain provider encounters an asynchronous error. By subscribing
* to the event, you will be notified of the error and can potentially recover from it. Event listeners
* are passed an instance of {@link TileProviderError}.
* @memberof TerrainProvider.prototype
* @type {Event<TerrainProvider.ErrorEvent>}
* @readonly
*/
errorEvent: {
get: DeveloperError_default.throwInstantiationError
},
/**
* Gets the credit to display when this terrain provider is active. Typically this is used to credit
* the source of the terrain.
* @memberof TerrainProvider.prototype
* @type {Credit}
* @readonly
*/
credit: {
get: DeveloperError_default.throwInstantiationError
},
/**
* Gets the tiling scheme used by the provider.
* @memberof TerrainProvider.prototype
* @type {TilingScheme}
* @readonly
*/
tilingScheme: {
get: DeveloperError_default.throwInstantiationError
},
/**
* Gets a value indicating whether or not the provider includes a water mask. The water mask
* indicates which areas of the globe are water rather than land, so they can be rendered
* as a reflective surface with animated waves.
* @memberof TerrainProvider.prototype
* @type {boolean}
* @readonly
*/
hasWaterMask: {
get: DeveloperError_default.throwInstantiationError
},
/**
* Gets a value indicating whether or not the requested tiles include vertex normals.
* @memberof TerrainProvider.prototype
* @type {boolean}
* @readonly
*/
hasVertexNormals: {
get: DeveloperError_default.throwInstantiationError
},
/**
* Gets an object that can be used to determine availability of terrain from this provider, such as
* at points and in rectangles. This property may be undefined if availability
* information is not available.
* @memberof TerrainProvider.prototype
* @type {TileAvailability|undefined}
* @readonly
*/
availability: {
get: DeveloperError_default.throwInstantiationError
}
});
var regularGridIndicesCache = [];
TerrainProvider.getRegularGridIndices = function(width, height) {
if (width * height >= Math_default.FOUR_GIGABYTES) {
throw new DeveloperError_default(
"The total number of vertices (width * height) must be less than 4,294,967,296."
);
}
let byWidth = regularGridIndicesCache[width];
if (!defined_default(byWidth)) {
regularGridIndicesCache[width] = byWidth = [];
}
let indices = byWidth[height];
if (!defined_default(indices)) {
if (width * height < Math_default.SIXTY_FOUR_KILOBYTES) {
indices = byWidth[height] = new Uint16Array(
(width - 1) * (height - 1) * 6
);
} else {
indices = byWidth[height] = new Uint32Array(
(width - 1) * (height - 1) * 6
);
}
addRegularGridIndices(width, height, indices, 0);
}
return indices;
};
var regularGridAndEdgeIndicesCache = [];
TerrainProvider.getRegularGridIndicesAndEdgeIndices = function(width, height) {
if (width * height >= Math_default.FOUR_GIGABYTES) {
throw new DeveloperError_default(
"The total number of vertices (width * height) must be less than 4,294,967,296."
);
}
let byWidth = regularGridAndEdgeIndicesCache[width];
if (!defined_default(byWidth)) {
regularGridAndEdgeIndicesCache[width] = byWidth = [];
}
let indicesAndEdges = byWidth[height];
if (!defined_default(indicesAndEdges)) {
const indices = TerrainProvider.getRegularGridIndices(width, height);
const edgeIndices = getEdgeIndices(width, height);
const westIndicesSouthToNorth = edgeIndices.westIndicesSouthToNorth;
const southIndicesEastToWest = edgeIndices.southIndicesEastToWest;
const eastIndicesNorthToSouth = edgeIndices.eastIndicesNorthToSouth;
const northIndicesWestToEast = edgeIndices.northIndicesWestToEast;
indicesAndEdges = byWidth[height] = {
indices,
westIndicesSouthToNorth,
southIndicesEastToWest,
eastIndicesNorthToSouth,
northIndicesWestToEast
};
}
return indicesAndEdges;
};
var regularGridAndSkirtAndEdgeIndicesCache = [];
TerrainProvider.getRegularGridAndSkirtIndicesAndEdgeIndices = function(width, height) {
if (width * height >= Math_default.FOUR_GIGABYTES) {
throw new DeveloperError_default(
"The total number of vertices (width * height) must be less than 4,294,967,296."
);
}
let byWidth = regularGridAndSkirtAndEdgeIndicesCache[width];
if (!defined_default(byWidth)) {
regularGridAndSkirtAndEdgeIndicesCache[width] = byWidth = [];
}
let indicesAndEdges = byWidth[height];
if (!defined_default(indicesAndEdges)) {
const gridVertexCount = width * height;
const gridIndexCount = (width - 1) * (height - 1) * 6;
const edgeVertexCount = width * 2 + height * 2;
const edgeIndexCount = Math.max(0, edgeVertexCount - 4) * 6;
const vertexCount = gridVertexCount + edgeVertexCount;
const indexCount = gridIndexCount + edgeIndexCount;
const edgeIndices = getEdgeIndices(width, height);
const westIndicesSouthToNorth = edgeIndices.westIndicesSouthToNorth;
const southIndicesEastToWest = edgeIndices.southIndicesEastToWest;
const eastIndicesNorthToSouth = edgeIndices.eastIndicesNorthToSouth;
const northIndicesWestToEast = edgeIndices.northIndicesWestToEast;
const indices = IndexDatatype_default.createTypedArray(vertexCount, indexCount);
addRegularGridIndices(width, height, indices, 0);
TerrainProvider.addSkirtIndices(
westIndicesSouthToNorth,
southIndicesEastToWest,
eastIndicesNorthToSouth,
northIndicesWestToEast,
gridVertexCount,
indices,
gridIndexCount
);
indicesAndEdges = byWidth[height] = {
indices,
westIndicesSouthToNorth,
southIndicesEastToWest,
eastIndicesNorthToSouth,
northIndicesWestToEast,
indexCountWithoutSkirts: gridIndexCount
};
}
return indicesAndEdges;
};
TerrainProvider.getSkirtVertexCount = function(westIndicesSouthToNorth, southIndicesEastToWest, eastIndicesNorthToSouth, northIndicesWestToEast) {
return westIndicesSouthToNorth.length + southIndicesEastToWest.length + eastIndicesNorthToSouth.length + northIndicesWestToEast.length;
};
TerrainProvider.getSkirtIndexCount = function(skirtVertexCount) {
return (skirtVertexCount - 4) * 2 * 3;
};
TerrainProvider.getSkirtIndexCountWithFilledCorners = function(skirtVertexCount) {
return ((skirtVertexCount - 4) * 2 + 4) * 3;
};
TerrainProvider.addSkirtIndices = function(westIndicesSouthToNorth, southIndicesEastToWest, eastIndicesNorthToSouth, northIndicesWestToEast, vertexCount, indices, offset) {
let vertexIndex = vertexCount;
offset = addSkirtIndices(
westIndicesSouthToNorth,
vertexIndex,
indices,
offset
);
vertexIndex += westIndicesSouthToNorth.length;
offset = addSkirtIndices(
southIndicesEastToWest,
vertexIndex,
indices,
offset
);
vertexIndex += southIndicesEastToWest.length;
offset = addSkirtIndices(
eastIndicesNorthToSouth,
vertexIndex,
indices,
offset
);
vertexIndex += eastIndicesNorthToSouth.length;
addSkirtIndices(northIndicesWestToEast, vertexIndex, indices, offset);
};
TerrainProvider.addSkirtIndicesWithFilledCorners = function(westIndicesSouthToNorth, southIndicesEastToWest, eastIndicesNorthToSouth, northIndicesWestToEast, vertexCount, indices, offset) {
TerrainProvider.addSkirtIndices(
westIndicesSouthToNorth,
southIndicesEastToWest,
eastIndicesNorthToSouth,
northIndicesWestToEast,
vertexCount,
indices,
offset
);
const skirtVertexCount = TerrainProvider.getSkirtVertexCount(
westIndicesSouthToNorth,
southIndicesEastToWest,
eastIndicesNorthToSouth,
northIndicesWestToEast
);
const skirtIndexCountWithoutCaps = TerrainProvider.getSkirtIndexCount(skirtVertexCount);
const cornerStartIdx = offset + skirtIndexCountWithoutCaps;
const cornerSWIndex = westIndicesSouthToNorth[0];
const cornerNWIndex = northIndicesWestToEast[0];
const cornerNEIndex = eastIndicesNorthToSouth[0];
const cornerSEIndex = southIndicesEastToWest[0];
const westSouthIndex = vertexCount;
const westNorthIndex = westSouthIndex + westIndicesSouthToNorth.length - 1;
const southEastIndex = westNorthIndex + 1;
const southWestIndex = southEastIndex + southIndicesEastToWest.length - 1;
const eastNorthIndex = southWestIndex + 1;
const eastSouthIndex = eastNorthIndex + eastIndicesNorthToSouth.length - 1;
const northWestIndex = eastSouthIndex + 1;
const northEastIndex = northWestIndex + northIndicesWestToEast.length - 1;
indices[cornerStartIdx + 0] = cornerSWIndex;
indices[cornerStartIdx + 1] = westSouthIndex;
indices[cornerStartIdx + 2] = southWestIndex;
indices[cornerStartIdx + 3] = cornerSEIndex;
indices[cornerStartIdx + 4] = southEastIndex;
indices[cornerStartIdx + 5] = eastSouthIndex;
indices[cornerStartIdx + 6] = cornerNEIndex;
indices[cornerStartIdx + 7] = eastNorthIndex;
indices[cornerStartIdx + 8] = northEastIndex;
indices[cornerStartIdx + 9] = cornerNWIndex;
indices[cornerStartIdx + 10] = northWestIndex;
indices[cornerStartIdx + 11] = westNorthIndex;
};
function getEdgeIndices(width, height) {
const westIndicesSouthToNorth = new Array(height);
const southIndicesEastToWest = new Array(width);
const eastIndicesNorthToSouth = new Array(height);
const northIndicesWestToEast = new Array(width);
let i;
for (i = 0; i < width; ++i) {
northIndicesWestToEast[i] = i;
southIndicesEastToWest[i] = width * height - 1 - i;
}
for (i = 0; i < height; ++i) {
eastIndicesNorthToSouth[i] = (i + 1) * width - 1;
westIndicesSouthToNorth[i] = (height - i - 1) * width;
}
return {
westIndicesSouthToNorth,
southIndicesEastToWest,
eastIndicesNorthToSouth,
northIndicesWestToEast
};
}
function addRegularGridIndices(width, height, indices, offset) {
let index = 0;
for (let j = 0; j < height - 1; ++j) {
for (let i = 0; i < width - 1; ++i) {
const upperLeft = index;
const lowerLeft = upperLeft + width;
const lowerRight = lowerLeft + 1;
const upperRight = upperLeft + 1;
indices[offset++] = upperLeft;
indices[offset++] = lowerLeft;
indices[offset++] = upperRight;
indices[offset++] = upperRight;
indices[offset++] = lowerLeft;
indices[offset++] = lowerRight;
++index;
}
++index;
}
}
function addSkirtIndices(edgeIndices, vertexIndex, indices, offset) {
let previousIndex = edgeIndices[0];
const length = edgeIndices.length;
for (let i = 1; i < length; ++i) {
const index = edgeIndices[i];
indices[offset++] = previousIndex;
indices[offset++] = index;
indices[offset++] = vertexIndex;
indices[offset++] = vertexIndex;
indices[offset++] = index;
indices[offset++] = vertexIndex + 1;
previousIndex = index;
++vertexIndex;
}
return offset;
}
TerrainProvider.heightmapTerrainQuality = 0.25;
TerrainProvider.getEstimatedLevelZeroGeometricErrorForAHeightmap = function(ellipsoid, tileImageWidth, numberOfTilesAtLevelZero) {
return ellipsoid.maximumRadius * 2 * Math.PI * TerrainProvider.heightmapTerrainQuality / (tileImageWidth * numberOfTilesAtLevelZero);
};
TerrainProvider.prototype.requestTileGeometry = DeveloperError_default.throwInstantiationError;
TerrainProvider.prototype.getLevelMaximumGeometricError = DeveloperError_default.throwInstantiationError;
TerrainProvider.prototype.getTileDataAvailable = DeveloperError_default.throwInstantiationError;
TerrainProvider.prototype.loadTileDataAvailability = DeveloperError_default.throwInstantiationError;
var TerrainProvider_default = TerrainProvider;
export {
TerrainProvider_default
};
File diff suppressed because it is too large Load Diff
+163
View File
@@ -0,0 +1,163 @@
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.142.0
*
* 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-ZP7JMQV4.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
};
+56
View File
@@ -0,0 +1,56 @@
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.142.0
*
* 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.
*/
// 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
};
Object.freeze(Intersect);
var Intersect_default = Intersect;
export {
Intersect_default
};
File diff suppressed because it is too large Load Diff
+97
View File
@@ -0,0 +1,97 @@
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.142.0
*
* 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-J6BWOHUF.js";
import {
Check_default
} from "./chunk-AYKR4VBR.js";
import {
defined_default
} from "./chunk-ZP7JMQV4.js";
// packages/engine/Source/Core/arrayRemoveDuplicates.js
var removeDuplicatesEpsilon = Math_default.EPSILON10;
function arrayRemoveDuplicates(values, equalsEpsilon, wrapAround, removedIndices) {
Check_default.defined("equalsEpsilon", equalsEpsilon);
if (!defined_default(values)) {
return void 0;
}
wrapAround = wrapAround ?? false;
const storeRemovedIndices = defined_default(removedIndices);
const length = values.length;
if (length < 2) {
return values;
}
let i;
let v0 = values[0];
let v1;
let cleanedValues;
let lastCleanIndex = 0;
let removedIndexLCI = -1;
for (i = 1; i < length; ++i) {
v1 = values[i];
if (equalsEpsilon(v0, v1, removeDuplicatesEpsilon)) {
if (!defined_default(cleanedValues)) {
cleanedValues = values.slice(0, i);
lastCleanIndex = i - 1;
removedIndexLCI = 0;
}
if (storeRemovedIndices) {
removedIndices.push(i);
}
} else {
if (defined_default(cleanedValues)) {
cleanedValues.push(v1);
lastCleanIndex = i;
if (storeRemovedIndices) {
removedIndexLCI = removedIndices.length;
}
}
v0 = v1;
}
}
if (wrapAround && equalsEpsilon(values[0], values[length - 1], removeDuplicatesEpsilon)) {
if (storeRemovedIndices) {
if (defined_default(cleanedValues)) {
removedIndices.splice(removedIndexLCI, 0, lastCleanIndex);
} else {
removedIndices.push(length - 1);
}
}
if (defined_default(cleanedValues)) {
cleanedValues.length -= 1;
} else {
cleanedValues = values.slice(0, -1);
}
}
return defined_default(cleanedValues) ? cleanedValues : values;
}
var arrayRemoveDuplicates_default = arrayRemoveDuplicates;
export {
arrayRemoveDuplicates_default
};
+124
View File
@@ -0,0 +1,124 @@
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.142.0
*
* 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 {
OrientedBoundingBox_default
} from "./chunk-EPYXRCDB.js";
import {
Cartesian2_default
} from "./chunk-V7VQKN6N.js";
import {
Cartesian3_default,
Matrix3_default
} from "./chunk-MPZHGZU6.js";
import {
Check_default
} from "./chunk-AYKR4VBR.js";
// packages/engine/Source/Core/CoplanarPolygonGeometryLibrary.js
var CoplanarPolygonGeometryLibrary = {};
var scratchIntersectionPoint = new Cartesian3_default();
var scratchXAxis = new Cartesian3_default();
var scratchYAxis = new Cartesian3_default();
var scratchZAxis = new Cartesian3_default();
var obbScratch = new OrientedBoundingBox_default();
CoplanarPolygonGeometryLibrary.validOutline = function(positions) {
Check_default.defined("positions", positions);
const orientedBoundingBox = OrientedBoundingBox_default.fromPoints(
positions,
obbScratch
);
const halfAxes = orientedBoundingBox.halfAxes;
const xAxis = Matrix3_default.getColumn(halfAxes, 0, scratchXAxis);
const yAxis = Matrix3_default.getColumn(halfAxes, 1, scratchYAxis);
const zAxis = Matrix3_default.getColumn(halfAxes, 2, scratchZAxis);
const xMag = Cartesian3_default.magnitude(xAxis);
const yMag = Cartesian3_default.magnitude(yAxis);
const zMag = Cartesian3_default.magnitude(zAxis);
return !(xMag === 0 && (yMag === 0 || zMag === 0) || yMag === 0 && zMag === 0);
};
CoplanarPolygonGeometryLibrary.computeProjectTo2DArguments = function(positions, centerResult, planeAxis1Result, planeAxis2Result) {
Check_default.defined("positions", positions);
Check_default.defined("centerResult", centerResult);
Check_default.defined("planeAxis1Result", planeAxis1Result);
Check_default.defined("planeAxis2Result", planeAxis2Result);
const orientedBoundingBox = OrientedBoundingBox_default.fromPoints(
positions,
obbScratch
);
const halfAxes = orientedBoundingBox.halfAxes;
const xAxis = Matrix3_default.getColumn(halfAxes, 0, scratchXAxis);
const yAxis = Matrix3_default.getColumn(halfAxes, 1, scratchYAxis);
const zAxis = Matrix3_default.getColumn(halfAxes, 2, scratchZAxis);
const xMag = Cartesian3_default.magnitude(xAxis);
const yMag = Cartesian3_default.magnitude(yAxis);
const zMag = Cartesian3_default.magnitude(zAxis);
const min = Math.min(xMag, yMag, zMag);
if (xMag === 0 && (yMag === 0 || zMag === 0) || yMag === 0 && zMag === 0) {
return false;
}
let planeAxis1;
let planeAxis2;
if (min === yMag || min === zMag) {
planeAxis1 = xAxis;
}
if (min === xMag) {
planeAxis1 = yAxis;
} else if (min === zMag) {
planeAxis2 = yAxis;
}
if (min === xMag || min === yMag) {
planeAxis2 = zAxis;
}
Cartesian3_default.normalize(planeAxis1, planeAxis1Result);
Cartesian3_default.normalize(planeAxis2, planeAxis2Result);
Cartesian3_default.clone(orientedBoundingBox.center, centerResult);
return true;
};
function projectTo2D(position, center, axis1, axis2, result) {
const v = Cartesian3_default.subtract(position, center, scratchIntersectionPoint);
const x = Cartesian3_default.dot(axis1, v);
const y = Cartesian3_default.dot(axis2, v);
return Cartesian2_default.fromElements(x, y, result);
}
CoplanarPolygonGeometryLibrary.createProjectPointsTo2DFunction = function(center, axis1, axis2) {
return function(positions) {
const positionResults = new Array(positions.length);
for (let i = 0; i < positions.length; i++) {
positionResults[i] = projectTo2D(positions[i], center, axis1, axis2);
}
return positionResults;
};
};
CoplanarPolygonGeometryLibrary.createProjectPointTo2DFunction = function(center, axis1, axis2) {
return function(position, result) {
return projectTo2D(position, center, axis1, axis2, result);
};
};
var CoplanarPolygonGeometryLibrary_default = CoplanarPolygonGeometryLibrary;
export {
CoplanarPolygonGeometryLibrary_default
};
+682
View File
@@ -0,0 +1,682 @@
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.142.0
*
* 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-IYOUHCZB.js";
import {
VertexFormat_default
} from "./chunk-VQYETPWC.js";
import {
GeometryAttributes_default
} from "./chunk-KSSWJIZW.js";
import {
GeometryAttribute_default,
Geometry_default,
PrimitiveType_default
} from "./chunk-EBSIOBXY.js";
import {
BoundingSphere_default
} from "./chunk-XZMBNNDX.js";
import {
ComponentDatatype_default
} from "./chunk-P3CK7MCY.js";
import {
Cartesian3_default,
Frozen_default
} from "./chunk-MPZHGZU6.js";
import {
Check_default,
DeveloperError_default
} from "./chunk-AYKR4VBR.js";
import {
defined_default
} from "./chunk-ZP7JMQV4.js";
// packages/engine/Source/Core/BoxGeometry.js
var diffScratch = new Cartesian3_default();
function BoxGeometry(options) {
options = options ?? Frozen_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 = 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 = options ?? Frozen_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 = 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] = 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 = 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
};
+198
View File
@@ -0,0 +1,198 @@
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.142.0
*
* 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 {
PolylinePipeline_default
} from "./chunk-QRWGUWI6.js";
import {
arrayRemoveDuplicates_default
} from "./chunk-CFQP6LYM.js";
import {
Cartographic_default
} from "./chunk-V7VQKN6N.js";
import {
Cartesian3_default
} from "./chunk-MPZHGZU6.js";
import {
Math_default
} from "./chunk-J6BWOHUF.js";
import {
defined_default
} from "./chunk-ZP7JMQV4.js";
// packages/engine/Source/Core/WallGeometryLibrary.js
var WallGeometryLibrary = {};
function latLonEquals(c0, c1) {
return Math_default.equalsEpsilon(c0.latitude, c1.latitude, Math_default.EPSILON10) && Math_default.equalsEpsilon(c0.longitude, c1.longitude, Math_default.EPSILON10);
}
var scratchCartographic1 = new Cartographic_default();
var scratchCartographic2 = new Cartographic_default();
function removeDuplicates(ellipsoid, positions, topHeights, bottomHeights) {
positions = arrayRemoveDuplicates_default(positions, Cartesian3_default.equalsEpsilon);
const length = positions.length;
if (length < 2) {
return;
}
const hasBottomHeights = defined_default(bottomHeights);
const hasTopHeights = defined_default(topHeights);
const cleanedPositions = new Array(length);
const cleanedTopHeights = new Array(length);
const cleanedBottomHeights = new Array(length);
const v0 = positions[0];
cleanedPositions[0] = v0;
const c0 = ellipsoid.cartesianToCartographic(v0, scratchCartographic1);
if (hasTopHeights) {
c0.height = topHeights[0];
}
cleanedTopHeights[0] = c0.height;
if (hasBottomHeights) {
cleanedBottomHeights[0] = bottomHeights[0];
} else {
cleanedBottomHeights[0] = 0;
}
const startTopHeight = cleanedTopHeights[0];
const startBottomHeight = cleanedBottomHeights[0];
let hasAllSameHeights = startTopHeight === startBottomHeight;
let index = 1;
for (let i = 1; i < length; ++i) {
const v1 = positions[i];
const c1 = ellipsoid.cartesianToCartographic(v1, scratchCartographic2);
if (hasTopHeights) {
c1.height = topHeights[i];
}
hasAllSameHeights = hasAllSameHeights && c1.height === 0;
if (!latLonEquals(c0, c1)) {
cleanedPositions[index] = v1;
cleanedTopHeights[index] = c1.height;
if (hasBottomHeights) {
cleanedBottomHeights[index] = bottomHeights[i];
} else {
cleanedBottomHeights[index] = 0;
}
hasAllSameHeights = hasAllSameHeights && cleanedTopHeights[index] === cleanedBottomHeights[index];
Cartographic_default.clone(c1, c0);
++index;
} else if (c0.height < c1.height) {
cleanedTopHeights[index - 1] = c1.height;
}
}
if (hasAllSameHeights || index < 2) {
return;
}
cleanedPositions.length = index;
cleanedTopHeights.length = index;
cleanedBottomHeights.length = index;
return {
positions: cleanedPositions,
topHeights: cleanedTopHeights,
bottomHeights: cleanedBottomHeights
};
}
var positionsArrayScratch = new Array(2);
var heightsArrayScratch = new Array(2);
var generateArcOptionsScratch = {
positions: void 0,
height: void 0,
granularity: void 0,
ellipsoid: void 0
};
WallGeometryLibrary.computePositions = function(ellipsoid, wallPositions, maximumHeights, minimumHeights, granularity, duplicateCorners) {
const o = removeDuplicates(
ellipsoid,
wallPositions,
maximumHeights,
minimumHeights
);
if (!defined_default(o)) {
return;
}
wallPositions = o.positions;
maximumHeights = o.topHeights;
minimumHeights = o.bottomHeights;
const length = wallPositions.length;
const numCorners = length - 2;
let topPositions;
let bottomPositions;
const minDistance = Math_default.chordLength(
granularity,
ellipsoid.maximumRadius
);
const generateArcOptions = generateArcOptionsScratch;
generateArcOptions.minDistance = minDistance;
generateArcOptions.ellipsoid = ellipsoid;
if (duplicateCorners) {
let count = 0;
let i;
for (i = 0; i < length - 1; i++) {
count += PolylinePipeline_default.numberOfPoints(
wallPositions[i],
wallPositions[i + 1],
minDistance
) + 1;
}
topPositions = new Float64Array(count * 3);
bottomPositions = new Float64Array(count * 3);
const generateArcPositions = positionsArrayScratch;
const generateArcHeights = heightsArrayScratch;
generateArcOptions.positions = generateArcPositions;
generateArcOptions.height = generateArcHeights;
let offset = 0;
for (i = 0; i < length - 1; i++) {
generateArcPositions[0] = wallPositions[i];
generateArcPositions[1] = wallPositions[i + 1];
generateArcHeights[0] = maximumHeights[i];
generateArcHeights[1] = maximumHeights[i + 1];
const pos = PolylinePipeline_default.generateArc(generateArcOptions);
topPositions.set(pos, offset);
generateArcHeights[0] = minimumHeights[i];
generateArcHeights[1] = minimumHeights[i + 1];
bottomPositions.set(
PolylinePipeline_default.generateArc(generateArcOptions),
offset
);
offset += pos.length;
}
} else {
generateArcOptions.positions = wallPositions;
generateArcOptions.height = maximumHeights;
topPositions = new Float64Array(
PolylinePipeline_default.generateArc(generateArcOptions)
);
generateArcOptions.height = minimumHeights;
bottomPositions = new Float64Array(
PolylinePipeline_default.generateArc(generateArcOptions)
);
}
return {
bottomPositions,
topPositions,
numCorners
};
};
var WallGeometryLibrary_default = WallGeometryLibrary;
export {
WallGeometryLibrary_default
};
+162
View File
@@ -0,0 +1,162 @@
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.142.0
*
* 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-C6J67V5A.js";
import {
Cartesian3_default
} from "./chunk-MPZHGZU6.js";
import {
Check_default
} from "./chunk-AYKR4VBR.js";
import {
defined_default
} from "./chunk-ZP7JMQV4.js";
// packages/engine/Source/Core/AxisAlignedBoundingBox.js
function AxisAlignedBoundingBox(minimum, maximum, center) {
this.minimum = Cartesian3_default.clone(minimum ?? Cartesian3_default.ZERO);
this.maximum = Cartesian3_default.clone(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.intersectAxisAlignedBoundingBox = function(box, other) {
Check_default.defined("box", box);
Check_default.defined("other", other);
return box.minimum.x <= other.maximum.x && box.maximum.x >= other.minimum.x && box.minimum.y <= other.maximum.y && box.maximum.y >= other.minimum.y && box.minimum.z <= other.maximum.z && box.maximum.z >= other.minimum.z;
};
AxisAlignedBoundingBox.prototype.clone = function(result) {
return AxisAlignedBoundingBox.clone(this, result);
};
AxisAlignedBoundingBox.prototype.intersectPlane = function(plane) {
return AxisAlignedBoundingBox.intersectPlane(this, plane);
};
AxisAlignedBoundingBox.prototype.intersectAxisAlignedBoundingBox = function(other) {
return AxisAlignedBoundingBox.intersectAxisAlignedBoundingBox(this, other);
};
AxisAlignedBoundingBox.prototype.equals = function(right) {
return AxisAlignedBoundingBox.equals(this, right);
};
var AxisAlignedBoundingBox_default = AxisAlignedBoundingBox;
export {
AxisAlignedBoundingBox_default
};
+511
View File
@@ -0,0 +1,511 @@
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.142.0
*
* 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-IYOUHCZB.js";
import {
VertexFormat_default
} from "./chunk-VQYETPWC.js";
import {
IndexDatatype_default
} from "./chunk-S4MCOY6I.js";
import {
GeometryAttributes_default
} from "./chunk-KSSWJIZW.js";
import {
GeometryAttribute_default,
Geometry_default,
PrimitiveType_default
} from "./chunk-EBSIOBXY.js";
import {
BoundingSphere_default
} from "./chunk-XZMBNNDX.js";
import {
ComponentDatatype_default
} from "./chunk-P3CK7MCY.js";
import {
Cartesian2_default,
Ellipsoid_default
} from "./chunk-V7VQKN6N.js";
import {
Cartesian3_default,
Frozen_default
} from "./chunk-MPZHGZU6.js";
import {
Math_default
} from "./chunk-J6BWOHUF.js";
import {
DeveloperError_default
} from "./chunk-AYKR4VBR.js";
import {
defined_default
} from "./chunk-ZP7JMQV4.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 = options ?? Frozen_default.EMPTY_OBJECT;
const radii = options.radii ?? defaultRadii;
const innerRadii = options.innerRadii ?? radii;
const minimumClock = options.minimumClock ?? 0;
const maximumClock = options.maximumClock ?? Math_default.TWO_PI;
const minimumCone = options.minimumCone ?? 0;
const maximumCone = options.maximumCone ?? Math_default.PI;
const stackPartitions = Math.round(options.stackPartitions ?? 64);
const slicePartitions = Math.round(options.slicePartitions ?? 64);
const vertexFormat = 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 = 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] = 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 = 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
};
+171
View File
@@ -0,0 +1,171 @@
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.142.0
*
* 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,
Matrix4_default
} from "./chunk-Q3PY526V.js";
import {
Cartesian3_default
} from "./chunk-MPZHGZU6.js";
import {
Math_default
} from "./chunk-J6BWOHUF.js";
import {
Check_default,
DeveloperError_default
} from "./chunk-AYKR4VBR.js";
import {
defined_default
} from "./chunk-ZP7JMQV4.js";
// packages/engine/Source/Core/Plane.js
function Plane(normal, distance) {
Check_default.typeOf.object("normal", normal);
if (!Math_default.equalsEpsilon(
Cartesian3_default.magnitude(normal),
1,
Math_default.EPSILON6
)) {
throw new DeveloperError_default("normal must be normalized.");
}
Check_default.typeOf.number("distance", distance);
this.normal = Cartesian3_default.clone(normal);
this.distance = distance;
}
Plane.fromPointNormal = function(point, normal, result) {
Check_default.typeOf.object("point", point);
Check_default.typeOf.object("normal", normal);
if (!Math_default.equalsEpsilon(
Cartesian3_default.magnitude(normal),
1,
Math_default.EPSILON6
)) {
throw new DeveloperError_default("normal must be normalized.");
}
const distance = -Cartesian3_default.dot(normal, point);
if (!defined_default(result)) {
return new Plane(normal, distance);
}
Cartesian3_default.clone(normal, result.normal);
result.distance = distance;
return result;
};
var scratchNormal = new Cartesian3_default();
Plane.fromCartesian4 = function(coefficients, result) {
Check_default.typeOf.object("coefficients", coefficients);
const normal = Cartesian3_default.fromCartesian4(coefficients, scratchNormal);
const distance = coefficients.w;
if (!Math_default.equalsEpsilon(
Cartesian3_default.magnitude(normal),
1,
Math_default.EPSILON6
)) {
throw new DeveloperError_default("normal must be normalized.");
}
if (!defined_default(result)) {
return new Plane(normal, distance);
}
Cartesian3_default.clone(normal, result.normal);
result.distance = distance;
return result;
};
Plane.getPointDistance = function(plane, point) {
Check_default.typeOf.object("plane", plane);
Check_default.typeOf.object("point", point);
return Cartesian3_default.dot(plane.normal, point) + plane.distance;
};
var scratchCartesian = new Cartesian3_default();
Plane.projectPointOntoPlane = function(plane, point, result) {
Check_default.typeOf.object("plane", plane);
Check_default.typeOf.object("point", point);
if (!defined_default(result)) {
result = new Cartesian3_default();
}
const pointDistance = Plane.getPointDistance(plane, point);
const scaledNormal = Cartesian3_default.multiplyByScalar(
plane.normal,
pointDistance,
scratchCartesian
);
return Cartesian3_default.subtract(point, scaledNormal, result);
};
var scratchInverseTranspose = new Matrix4_default();
var scratchPlaneCartesian4 = new Cartesian4_default();
var scratchTransformNormal = new Cartesian3_default();
Plane.transform = function(plane, transform, result) {
Check_default.typeOf.object("plane", plane);
Check_default.typeOf.object("transform", transform);
const normal = plane.normal;
const distance = plane.distance;
const inverseTranspose = Matrix4_default.inverseTranspose(
transform,
scratchInverseTranspose
);
let planeAsCartesian4 = Cartesian4_default.fromElements(
normal.x,
normal.y,
normal.z,
distance,
scratchPlaneCartesian4
);
planeAsCartesian4 = Matrix4_default.multiplyByVector(
inverseTranspose,
planeAsCartesian4,
planeAsCartesian4
);
const transformedNormal = Cartesian3_default.fromCartesian4(
planeAsCartesian4,
scratchTransformNormal
);
planeAsCartesian4 = Cartesian4_default.divideByScalar(
planeAsCartesian4,
Cartesian3_default.magnitude(transformedNormal),
planeAsCartesian4
);
return Plane.fromCartesian4(planeAsCartesian4, result);
};
Plane.clone = function(plane, result) {
Check_default.typeOf.object("plane", plane);
if (!defined_default(result)) {
return new Plane(plane.normal, plane.distance);
}
Cartesian3_default.clone(plane.normal, result.normal);
result.distance = plane.distance;
return result;
};
Plane.equals = function(left, right) {
Check_default.typeOf.object("left", left);
Check_default.typeOf.object("right", right);
return left.distance === right.distance && Cartesian3_default.equals(left.normal, right.normal);
};
Plane.ORIGIN_XY_PLANE = Object.freeze(new Plane(Cartesian3_default.UNIT_Z, 0));
Plane.ORIGIN_YZ_PLANE = Object.freeze(new Plane(Cartesian3_default.UNIT_X, 0));
Plane.ORIGIN_ZX_PLANE = Object.freeze(new Plane(Cartesian3_default.UNIT_Y, 0));
var Plane_default = Plane;
export {
Plane_default
};
+301
View File
@@ -0,0 +1,301 @@
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.142.0
*
* 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,
Quaternion_default,
Rectangle_default,
Transforms_default
} from "./chunk-MYP774IS.js";
import {
Matrix4_default
} from "./chunk-Q3PY526V.js";
import {
WebGLConstants_default
} from "./chunk-TKKIREQ6.js";
import {
Cartesian2_default,
Cartographic_default
} from "./chunk-V7VQKN6N.js";
import {
Cartesian3_default,
Frozen_default,
Matrix3_default
} from "./chunk-MPZHGZU6.js";
import {
Check_default,
DeveloperError_default
} from "./chunk-AYKR4VBR.js";
import {
defined_default
} from "./chunk-ZP7JMQV4.js";
// packages/engine/Source/Core/GeometryType.js
var GeometryType = {
NONE: 0,
TRIANGLES: 1,
LINES: 2,
POLYLINES: 3
};
Object.freeze(GeometryType);
var GeometryType_default = 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;
};
Object.freeze(PrimitiveType);
var PrimitiveType_default = PrimitiveType;
// packages/engine/Source/Core/Geometry.js
function Geometry(options) {
options = options ?? Frozen_default.EMPTY_OBJECT;
Check_default.typeOf.object("options.attributes", options.attributes);
this.attributes = options.attributes;
this.indices = options.indices;
this.primitiveType = options.primitiveType ?? PrimitiveType_default.TRIANGLES;
this.boundingSphere = options.boundingSphere;
this.geometryType = 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 = options ?? Frozen_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 = options.normalize ?? false;
this.values = options.values;
}
var GeometryAttribute_default = GeometryAttribute;
export {
GeometryType_default,
PrimitiveType_default,
Geometry_default,
GeometryAttribute_default
};
File diff suppressed because it is too large Load Diff
+837
View File
@@ -0,0 +1,837 @@
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.142.0
*
* 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 {
EllipsoidTangentPlane_default
} from "./chunk-SMQZZOW6.js";
import {
Plane_default
} from "./chunk-E7VQ76KE.js";
import {
BoundingSphere_default,
Interval_default
} from "./chunk-XZMBNNDX.js";
import {
Intersect_default
} from "./chunk-C6J67V5A.js";
import {
Rectangle_default
} from "./chunk-MYP774IS.js";
import {
Matrix4_default
} from "./chunk-Q3PY526V.js";
import {
Cartesian2_default,
Cartographic_default,
Ellipsoid_default
} from "./chunk-V7VQKN6N.js";
import {
Cartesian3_default,
Matrix3_default
} from "./chunk-MPZHGZU6.js";
import {
Math_default
} from "./chunk-J6BWOHUF.js";
import {
Check_default,
DeveloperError_default
} from "./chunk-AYKR4VBR.js";
import {
defined_default
} from "./chunk-ZP7JMQV4.js";
// packages/engine/Source/Core/OrientedBoundingBox.js
function OrientedBoundingBox(center, halfAxes) {
this.center = Cartesian3_default.clone(center ?? Cartesian3_default.ZERO);
this.halfAxes = Matrix3_default.clone(halfAxes ?? Matrix3_default.ZERO);
}
OrientedBoundingBox.packedLength = Cartesian3_default.packedLength + Matrix3_default.packedLength;
OrientedBoundingBox.pack = function(value, array, startingIndex) {
Check_default.typeOf.object("value", value);
Check_default.defined("array", array);
startingIndex = startingIndex ?? 0;
Cartesian3_default.pack(value.center, array, startingIndex);
Matrix3_default.pack(value.halfAxes, array, startingIndex + Cartesian3_default.packedLength);
return array;
};
OrientedBoundingBox.unpack = function(array, startingIndex, result) {
Check_default.defined("array", array);
startingIndex = startingIndex ?? 0;
if (!defined_default(result)) {
result = new OrientedBoundingBox();
}
Cartesian3_default.unpack(array, startingIndex, result.center);
Matrix3_default.unpack(
array,
startingIndex + Cartesian3_default.packedLength,
result.halfAxes
);
return result;
};
var scratchCartesian1 = new Cartesian3_default();
var scratchCartesian2 = new Cartesian3_default();
var scratchCartesian3 = new Cartesian3_default();
var scratchCartesian4 = new Cartesian3_default();
var scratchCartesian5 = new Cartesian3_default();
var scratchCartesian6 = new Cartesian3_default();
var scratchCovarianceResult = new Matrix3_default();
var scratchEigenResult = {
unitary: new Matrix3_default(),
diagonal: new Matrix3_default()
};
OrientedBoundingBox.fromPoints = function(positions, result) {
if (!defined_default(result)) {
result = new OrientedBoundingBox();
}
if (!defined_default(positions) || positions.length === 0) {
result.halfAxes = Matrix3_default.ZERO;
result.center = Cartesian3_default.ZERO;
return result;
}
let i;
const length = positions.length;
const meanPoint = Cartesian3_default.clone(positions[0], scratchCartesian1);
for (i = 1; i < length; i++) {
Cartesian3_default.add(meanPoint, positions[i], meanPoint);
}
const invLength = 1 / length;
Cartesian3_default.multiplyByScalar(meanPoint, invLength, meanPoint);
let exx = 0;
let exy = 0;
let exz = 0;
let eyy = 0;
let eyz = 0;
let ezz = 0;
let p;
for (i = 0; i < length; i++) {
p = Cartesian3_default.subtract(positions[i], meanPoint, scratchCartesian2);
exx += p.x * p.x;
exy += p.x * p.y;
exz += p.x * p.z;
eyy += p.y * p.y;
eyz += p.y * p.z;
ezz += p.z * p.z;
}
exx *= invLength;
exy *= invLength;
exz *= invLength;
eyy *= invLength;
eyz *= invLength;
ezz *= invLength;
const covarianceMatrix = scratchCovarianceResult;
covarianceMatrix[0] = exx;
covarianceMatrix[1] = exy;
covarianceMatrix[2] = exz;
covarianceMatrix[3] = exy;
covarianceMatrix[4] = eyy;
covarianceMatrix[5] = eyz;
covarianceMatrix[6] = exz;
covarianceMatrix[7] = eyz;
covarianceMatrix[8] = ezz;
const eigenDecomposition = Matrix3_default.computeEigenDecomposition(
covarianceMatrix,
scratchEigenResult
);
const rotation = Matrix3_default.clone(eigenDecomposition.unitary, result.halfAxes);
let v1 = Matrix3_default.getColumn(rotation, 0, scratchCartesian4);
let v2 = Matrix3_default.getColumn(rotation, 1, scratchCartesian5);
let v3 = Matrix3_default.getColumn(rotation, 2, scratchCartesian6);
let u1 = -Number.MAX_VALUE;
let u2 = -Number.MAX_VALUE;
let u3 = -Number.MAX_VALUE;
let l1 = Number.MAX_VALUE;
let l2 = Number.MAX_VALUE;
let l3 = Number.MAX_VALUE;
for (i = 0; i < length; i++) {
p = positions[i];
u1 = Math.max(Cartesian3_default.dot(v1, p), u1);
u2 = Math.max(Cartesian3_default.dot(v2, p), u2);
u3 = Math.max(Cartesian3_default.dot(v3, p), u3);
l1 = Math.min(Cartesian3_default.dot(v1, p), l1);
l2 = Math.min(Cartesian3_default.dot(v2, p), l2);
l3 = Math.min(Cartesian3_default.dot(v3, p), l3);
}
v1 = Cartesian3_default.multiplyByScalar(v1, 0.5 * (l1 + u1), v1);
v2 = Cartesian3_default.multiplyByScalar(v2, 0.5 * (l2 + u2), v2);
v3 = Cartesian3_default.multiplyByScalar(v3, 0.5 * (l3 + u3), v3);
const center = Cartesian3_default.add(v1, v2, result.center);
Cartesian3_default.add(center, v3, center);
const scale = scratchCartesian3;
scale.x = u1 - l1;
scale.y = u2 - l2;
scale.z = u3 - l3;
Cartesian3_default.multiplyByScalar(scale, 0.5, scale);
Matrix3_default.multiplyByScale(result.halfAxes, scale, result.halfAxes);
return result;
};
var scratchOffset = new Cartesian3_default();
var scratchScale = new Cartesian3_default();
function fromPlaneExtents(planeOrigin, planeXAxis, planeYAxis, planeZAxis, minimumX, maximumX, minimumY, maximumY, minimumZ, maximumZ, result) {
if (!defined_default(minimumX) || !defined_default(maximumX) || !defined_default(minimumY) || !defined_default(maximumY) || !defined_default(minimumZ) || !defined_default(maximumZ)) {
throw new DeveloperError_default(
"all extents (minimum/maximum X/Y/Z) are required."
);
}
if (!defined_default(result)) {
result = new OrientedBoundingBox();
}
const halfAxes = result.halfAxes;
Matrix3_default.setColumn(halfAxes, 0, planeXAxis, halfAxes);
Matrix3_default.setColumn(halfAxes, 1, planeYAxis, halfAxes);
Matrix3_default.setColumn(halfAxes, 2, planeZAxis, halfAxes);
let centerOffset = scratchOffset;
centerOffset.x = (minimumX + maximumX) / 2;
centerOffset.y = (minimumY + maximumY) / 2;
centerOffset.z = (minimumZ + maximumZ) / 2;
const scale = scratchScale;
scale.x = (maximumX - minimumX) / 2;
scale.y = (maximumY - minimumY) / 2;
scale.z = (maximumZ - minimumZ) / 2;
const center = result.center;
centerOffset = Matrix3_default.multiplyByVector(halfAxes, centerOffset, centerOffset);
Cartesian3_default.add(planeOrigin, centerOffset, center);
Matrix3_default.multiplyByScale(halfAxes, scale, halfAxes);
return result;
}
var scratchRectangleCenterCartographic = new Cartographic_default();
var scratchRectangleCenter = new Cartesian3_default();
var scratchPerimeterCartographicNC = new Cartographic_default();
var scratchPerimeterCartographicNW = new Cartographic_default();
var scratchPerimeterCartographicCW = new Cartographic_default();
var scratchPerimeterCartographicSW = new Cartographic_default();
var scratchPerimeterCartographicSC = new Cartographic_default();
var scratchPerimeterCartesianNC = new Cartesian3_default();
var scratchPerimeterCartesianNW = new Cartesian3_default();
var scratchPerimeterCartesianCW = new Cartesian3_default();
var scratchPerimeterCartesianSW = new Cartesian3_default();
var scratchPerimeterCartesianSC = new Cartesian3_default();
var scratchPerimeterProjectedNC = new Cartesian2_default();
var scratchPerimeterProjectedNW = new Cartesian2_default();
var scratchPerimeterProjectedCW = new Cartesian2_default();
var scratchPerimeterProjectedSW = new Cartesian2_default();
var scratchPerimeterProjectedSC = new Cartesian2_default();
var scratchPlaneOrigin = new Cartesian3_default();
var scratchPlaneNormal = new Cartesian3_default();
var scratchPlaneXAxis = new Cartesian3_default();
var scratchHorizonCartesian = new Cartesian3_default();
var scratchHorizonProjected = new Cartesian2_default();
var scratchMaxY = new Cartesian3_default();
var scratchMinY = new Cartesian3_default();
var scratchZ = new Cartesian3_default();
var scratchPlane = new Plane_default(Cartesian3_default.UNIT_X, 0);
OrientedBoundingBox.fromRectangle = function(rectangle, minimumHeight, maximumHeight, ellipsoid, result) {
if (!defined_default(rectangle)) {
throw new DeveloperError_default("rectangle is required");
}
if (rectangle.width < 0 || rectangle.width > Math_default.TWO_PI) {
throw new DeveloperError_default("Rectangle width must be between 0 and 2 * pi");
}
if (rectangle.height < 0 || rectangle.height > Math_default.PI) {
throw new DeveloperError_default("Rectangle height must be between 0 and pi");
}
if (defined_default(ellipsoid) && !Math_default.equalsEpsilon(
ellipsoid.radii.x,
ellipsoid.radii.y,
Math_default.EPSILON15
)) {
throw new DeveloperError_default(
"Ellipsoid must be an ellipsoid of revolution (radii.x == radii.y)"
);
}
minimumHeight = minimumHeight ?? 0;
maximumHeight = maximumHeight ?? 0;
ellipsoid = ellipsoid ?? Ellipsoid_default.default;
let minX, maxX, minY, maxY, minZ, maxZ, plane;
if (rectangle.width <= Math_default.PI) {
const tangentPointCartographic = Rectangle_default.center(
rectangle,
scratchRectangleCenterCartographic
);
const tangentPoint = ellipsoid.cartographicToCartesian(
tangentPointCartographic,
scratchRectangleCenter
);
const tangentPlane = new EllipsoidTangentPlane_default(tangentPoint, ellipsoid);
plane = tangentPlane.plane;
const lonCenter = tangentPointCartographic.longitude;
const latCenter = rectangle.south < 0 && rectangle.north > 0 ? 0 : tangentPointCartographic.latitude;
const perimeterCartographicNC = Cartographic_default.fromRadians(
lonCenter,
rectangle.north,
maximumHeight,
scratchPerimeterCartographicNC
);
const perimeterCartographicNW = Cartographic_default.fromRadians(
rectangle.west,
rectangle.north,
maximumHeight,
scratchPerimeterCartographicNW
);
const perimeterCartographicCW = Cartographic_default.fromRadians(
rectangle.west,
latCenter,
maximumHeight,
scratchPerimeterCartographicCW
);
const perimeterCartographicSW = Cartographic_default.fromRadians(
rectangle.west,
rectangle.south,
maximumHeight,
scratchPerimeterCartographicSW
);
const perimeterCartographicSC = Cartographic_default.fromRadians(
lonCenter,
rectangle.south,
maximumHeight,
scratchPerimeterCartographicSC
);
const perimeterCartesianNC = ellipsoid.cartographicToCartesian(
perimeterCartographicNC,
scratchPerimeterCartesianNC
);
let perimeterCartesianNW = ellipsoid.cartographicToCartesian(
perimeterCartographicNW,
scratchPerimeterCartesianNW
);
const perimeterCartesianCW = ellipsoid.cartographicToCartesian(
perimeterCartographicCW,
scratchPerimeterCartesianCW
);
let perimeterCartesianSW = ellipsoid.cartographicToCartesian(
perimeterCartographicSW,
scratchPerimeterCartesianSW
);
const perimeterCartesianSC = ellipsoid.cartographicToCartesian(
perimeterCartographicSC,
scratchPerimeterCartesianSC
);
const perimeterProjectedNC = tangentPlane.projectPointToNearestOnPlane(
perimeterCartesianNC,
scratchPerimeterProjectedNC
);
const perimeterProjectedNW = tangentPlane.projectPointToNearestOnPlane(
perimeterCartesianNW,
scratchPerimeterProjectedNW
);
const perimeterProjectedCW = tangentPlane.projectPointToNearestOnPlane(
perimeterCartesianCW,
scratchPerimeterProjectedCW
);
const perimeterProjectedSW = tangentPlane.projectPointToNearestOnPlane(
perimeterCartesianSW,
scratchPerimeterProjectedSW
);
const perimeterProjectedSC = tangentPlane.projectPointToNearestOnPlane(
perimeterCartesianSC,
scratchPerimeterProjectedSC
);
minX = Math.min(
perimeterProjectedNW.x,
perimeterProjectedCW.x,
perimeterProjectedSW.x
);
maxX = -minX;
maxY = Math.max(perimeterProjectedNW.y, perimeterProjectedNC.y);
minY = Math.min(perimeterProjectedSW.y, perimeterProjectedSC.y);
perimeterCartographicNW.height = perimeterCartographicSW.height = minimumHeight;
perimeterCartesianNW = ellipsoid.cartographicToCartesian(
perimeterCartographicNW,
scratchPerimeterCartesianNW
);
perimeterCartesianSW = ellipsoid.cartographicToCartesian(
perimeterCartographicSW,
scratchPerimeterCartesianSW
);
minZ = Math.min(
Plane_default.getPointDistance(plane, perimeterCartesianNW),
Plane_default.getPointDistance(plane, perimeterCartesianSW)
);
maxZ = maximumHeight;
return fromPlaneExtents(
tangentPlane.origin,
tangentPlane.xAxis,
tangentPlane.yAxis,
tangentPlane.zAxis,
minX,
maxX,
minY,
maxY,
minZ,
maxZ,
result
);
}
const fullyAboveEquator = rectangle.south > 0;
const fullyBelowEquator = rectangle.north < 0;
const latitudeNearestToEquator = fullyAboveEquator ? rectangle.south : fullyBelowEquator ? rectangle.north : 0;
const centerLongitude = Rectangle_default.center(
rectangle,
scratchRectangleCenterCartographic
).longitude;
const planeOrigin = Cartesian3_default.fromRadians(
centerLongitude,
latitudeNearestToEquator,
maximumHeight,
ellipsoid,
scratchPlaneOrigin
);
planeOrigin.z = 0;
const isPole = Math.abs(planeOrigin.x) < Math_default.EPSILON10 && Math.abs(planeOrigin.y) < Math_default.EPSILON10;
const planeNormal = !isPole ? Cartesian3_default.normalize(planeOrigin, scratchPlaneNormal) : Cartesian3_default.UNIT_X;
const planeYAxis = Cartesian3_default.UNIT_Z;
const planeXAxis = Cartesian3_default.cross(
planeNormal,
planeYAxis,
scratchPlaneXAxis
);
plane = Plane_default.fromPointNormal(planeOrigin, planeNormal, scratchPlane);
const horizonCartesian = Cartesian3_default.fromRadians(
centerLongitude + Math_default.PI_OVER_TWO,
latitudeNearestToEquator,
maximumHeight,
ellipsoid,
scratchHorizonCartesian
);
maxX = Cartesian3_default.dot(
Plane_default.projectPointOntoPlane(
plane,
horizonCartesian,
scratchHorizonProjected
),
planeXAxis
);
minX = -maxX;
maxY = Cartesian3_default.fromRadians(
0,
rectangle.north,
fullyBelowEquator ? minimumHeight : maximumHeight,
ellipsoid,
scratchMaxY
).z;
minY = Cartesian3_default.fromRadians(
0,
rectangle.south,
fullyAboveEquator ? minimumHeight : maximumHeight,
ellipsoid,
scratchMinY
).z;
const farZ = Cartesian3_default.fromRadians(
rectangle.east,
latitudeNearestToEquator,
maximumHeight,
ellipsoid,
scratchZ
);
minZ = Plane_default.getPointDistance(plane, farZ);
maxZ = 0;
return fromPlaneExtents(
planeOrigin,
planeXAxis,
planeYAxis,
planeNormal,
minX,
maxX,
minY,
maxY,
minZ,
maxZ,
result
);
};
OrientedBoundingBox.fromTransformation = function(transformation, result) {
Check_default.typeOf.object("transformation", transformation);
if (!defined_default(result)) {
result = new OrientedBoundingBox();
}
result.center = Matrix4_default.getTranslation(transformation, result.center);
result.halfAxes = Matrix4_default.getMatrix3(transformation, result.halfAxes);
result.halfAxes = Matrix3_default.multiplyByScalar(
result.halfAxes,
0.5,
result.halfAxes
);
return result;
};
OrientedBoundingBox.clone = function(box, result) {
if (!defined_default(box)) {
return void 0;
}
if (!defined_default(result)) {
return new OrientedBoundingBox(box.center, box.halfAxes);
}
Cartesian3_default.clone(box.center, result.center);
Matrix3_default.clone(box.halfAxes, result.halfAxes);
return result;
};
OrientedBoundingBox.intersectPlane = function(box, plane) {
if (!defined_default(box)) {
throw new DeveloperError_default("box is required.");
}
if (!defined_default(plane)) {
throw new DeveloperError_default("plane is required.");
}
const center = box.center;
const normal = plane.normal;
const halfAxes = box.halfAxes;
const normalX = normal.x, normalY = normal.y, normalZ = normal.z;
const radEffective = Math.abs(
normalX * halfAxes[Matrix3_default.COLUMN0ROW0] + normalY * halfAxes[Matrix3_default.COLUMN0ROW1] + normalZ * halfAxes[Matrix3_default.COLUMN0ROW2]
) + Math.abs(
normalX * halfAxes[Matrix3_default.COLUMN1ROW0] + normalY * halfAxes[Matrix3_default.COLUMN1ROW1] + normalZ * halfAxes[Matrix3_default.COLUMN1ROW2]
) + Math.abs(
normalX * halfAxes[Matrix3_default.COLUMN2ROW0] + normalY * halfAxes[Matrix3_default.COLUMN2ROW1] + normalZ * halfAxes[Matrix3_default.COLUMN2ROW2]
);
const distanceToPlane = Cartesian3_default.dot(normal, center) + plane.distance;
if (distanceToPlane <= -radEffective) {
return Intersect_default.OUTSIDE;
} else if (distanceToPlane >= radEffective) {
return Intersect_default.INSIDE;
}
return Intersect_default.INTERSECTING;
};
var scratchCartesianU = new Cartesian3_default();
var scratchCartesianV = new Cartesian3_default();
var scratchCartesianW = new Cartesian3_default();
var scratchValidAxis2 = new Cartesian3_default();
var scratchValidAxis3 = new Cartesian3_default();
var scratchPPrime = new Cartesian3_default();
OrientedBoundingBox.distanceSquaredTo = function(box, cartesian) {
if (!defined_default(box)) {
throw new DeveloperError_default("box is required.");
}
if (!defined_default(cartesian)) {
throw new DeveloperError_default("cartesian is required.");
}
const offset = Cartesian3_default.subtract(cartesian, box.center, scratchOffset);
const halfAxes = box.halfAxes;
let u = Matrix3_default.getColumn(halfAxes, 0, scratchCartesianU);
let v = Matrix3_default.getColumn(halfAxes, 1, scratchCartesianV);
let w = Matrix3_default.getColumn(halfAxes, 2, scratchCartesianW);
const uHalf = Cartesian3_default.magnitude(u);
const vHalf = Cartesian3_default.magnitude(v);
const wHalf = Cartesian3_default.magnitude(w);
let uValid = true;
let vValid = true;
let wValid = true;
if (uHalf > 0) {
Cartesian3_default.divideByScalar(u, uHalf, u);
} else {
uValid = false;
}
if (vHalf > 0) {
Cartesian3_default.divideByScalar(v, vHalf, v);
} else {
vValid = false;
}
if (wHalf > 0) {
Cartesian3_default.divideByScalar(w, wHalf, w);
} else {
wValid = false;
}
const numberOfDegenerateAxes = !uValid + !vValid + !wValid;
let validAxis1;
let validAxis2;
let validAxis3;
if (numberOfDegenerateAxes === 1) {
let degenerateAxis = u;
validAxis1 = v;
validAxis2 = w;
if (!vValid) {
degenerateAxis = v;
validAxis1 = u;
} else if (!wValid) {
degenerateAxis = w;
validAxis2 = u;
}
validAxis3 = Cartesian3_default.cross(validAxis1, validAxis2, scratchValidAxis3);
if (degenerateAxis === u) {
u = validAxis3;
} else if (degenerateAxis === v) {
v = validAxis3;
} else if (degenerateAxis === w) {
w = validAxis3;
}
} else if (numberOfDegenerateAxes === 2) {
validAxis1 = u;
if (vValid) {
validAxis1 = v;
} else if (wValid) {
validAxis1 = w;
}
let crossVector = Cartesian3_default.UNIT_Y;
if (crossVector.equalsEpsilon(validAxis1, Math_default.EPSILON3)) {
crossVector = Cartesian3_default.UNIT_X;
}
validAxis2 = Cartesian3_default.cross(validAxis1, crossVector, scratchValidAxis2);
Cartesian3_default.normalize(validAxis2, validAxis2);
validAxis3 = Cartesian3_default.cross(validAxis1, validAxis2, scratchValidAxis3);
Cartesian3_default.normalize(validAxis3, validAxis3);
if (validAxis1 === u) {
v = validAxis2;
w = validAxis3;
} else if (validAxis1 === v) {
w = validAxis2;
u = validAxis3;
} else if (validAxis1 === w) {
u = validAxis2;
v = validAxis3;
}
} else if (numberOfDegenerateAxes === 3) {
u = Cartesian3_default.UNIT_X;
v = Cartesian3_default.UNIT_Y;
w = Cartesian3_default.UNIT_Z;
}
const pPrime = scratchPPrime;
pPrime.x = Cartesian3_default.dot(offset, u);
pPrime.y = Cartesian3_default.dot(offset, v);
pPrime.z = Cartesian3_default.dot(offset, w);
let distanceSquared = 0;
let d;
if (pPrime.x < -uHalf) {
d = pPrime.x + uHalf;
distanceSquared += d * d;
} else if (pPrime.x > uHalf) {
d = pPrime.x - uHalf;
distanceSquared += d * d;
}
if (pPrime.y < -vHalf) {
d = pPrime.y + vHalf;
distanceSquared += d * d;
} else if (pPrime.y > vHalf) {
d = pPrime.y - vHalf;
distanceSquared += d * d;
}
if (pPrime.z < -wHalf) {
d = pPrime.z + wHalf;
distanceSquared += d * d;
} else if (pPrime.z > wHalf) {
d = pPrime.z - wHalf;
distanceSquared += d * d;
}
return distanceSquared;
};
var scratchCorner = new Cartesian3_default();
var scratchToCenter = new Cartesian3_default();
OrientedBoundingBox.computePlaneDistances = function(box, position, direction, result) {
if (!defined_default(box)) {
throw new DeveloperError_default("box is required.");
}
if (!defined_default(position)) {
throw new DeveloperError_default("position is required.");
}
if (!defined_default(direction)) {
throw new DeveloperError_default("direction is required.");
}
if (!defined_default(result)) {
result = new Interval_default();
}
let minDist = Number.POSITIVE_INFINITY;
let maxDist = Number.NEGATIVE_INFINITY;
const center = box.center;
const halfAxes = box.halfAxes;
const u = Matrix3_default.getColumn(halfAxes, 0, scratchCartesianU);
const v = Matrix3_default.getColumn(halfAxes, 1, scratchCartesianV);
const w = Matrix3_default.getColumn(halfAxes, 2, scratchCartesianW);
const corner = Cartesian3_default.add(u, v, scratchCorner);
Cartesian3_default.add(corner, w, corner);
Cartesian3_default.add(corner, center, corner);
const toCenter = Cartesian3_default.subtract(corner, position, scratchToCenter);
let mag = Cartesian3_default.dot(direction, toCenter);
minDist = Math.min(mag, minDist);
maxDist = Math.max(mag, maxDist);
Cartesian3_default.add(center, u, corner);
Cartesian3_default.add(corner, v, corner);
Cartesian3_default.subtract(corner, w, corner);
Cartesian3_default.subtract(corner, position, toCenter);
mag = Cartesian3_default.dot(direction, toCenter);
minDist = Math.min(mag, minDist);
maxDist = Math.max(mag, maxDist);
Cartesian3_default.add(center, u, corner);
Cartesian3_default.subtract(corner, v, corner);
Cartesian3_default.add(corner, w, corner);
Cartesian3_default.subtract(corner, position, toCenter);
mag = Cartesian3_default.dot(direction, toCenter);
minDist = Math.min(mag, minDist);
maxDist = Math.max(mag, maxDist);
Cartesian3_default.add(center, u, corner);
Cartesian3_default.subtract(corner, v, corner);
Cartesian3_default.subtract(corner, w, corner);
Cartesian3_default.subtract(corner, position, toCenter);
mag = Cartesian3_default.dot(direction, toCenter);
minDist = Math.min(mag, minDist);
maxDist = Math.max(mag, maxDist);
Cartesian3_default.subtract(center, u, corner);
Cartesian3_default.add(corner, v, corner);
Cartesian3_default.add(corner, w, corner);
Cartesian3_default.subtract(corner, position, toCenter);
mag = Cartesian3_default.dot(direction, toCenter);
minDist = Math.min(mag, minDist);
maxDist = Math.max(mag, maxDist);
Cartesian3_default.subtract(center, u, corner);
Cartesian3_default.add(corner, v, corner);
Cartesian3_default.subtract(corner, w, corner);
Cartesian3_default.subtract(corner, position, toCenter);
mag = Cartesian3_default.dot(direction, toCenter);
minDist = Math.min(mag, minDist);
maxDist = Math.max(mag, maxDist);
Cartesian3_default.subtract(center, u, corner);
Cartesian3_default.subtract(corner, v, corner);
Cartesian3_default.add(corner, w, corner);
Cartesian3_default.subtract(corner, position, toCenter);
mag = Cartesian3_default.dot(direction, toCenter);
minDist = Math.min(mag, minDist);
maxDist = Math.max(mag, maxDist);
Cartesian3_default.subtract(center, u, corner);
Cartesian3_default.subtract(corner, v, corner);
Cartesian3_default.subtract(corner, w, corner);
Cartesian3_default.subtract(corner, position, toCenter);
mag = Cartesian3_default.dot(direction, toCenter);
minDist = Math.min(mag, minDist);
maxDist = Math.max(mag, maxDist);
result.start = minDist;
result.stop = maxDist;
return result;
};
var scratchXAxis = new Cartesian3_default();
var scratchYAxis = new Cartesian3_default();
var scratchZAxis = new Cartesian3_default();
OrientedBoundingBox.computeCorners = function(box, result) {
Check_default.typeOf.object("box", box);
if (!defined_default(result)) {
result = [
new Cartesian3_default(),
new Cartesian3_default(),
new Cartesian3_default(),
new Cartesian3_default(),
new Cartesian3_default(),
new Cartesian3_default(),
new Cartesian3_default(),
new Cartesian3_default()
];
}
const center = box.center;
const halfAxes = box.halfAxes;
const xAxis = Matrix3_default.getColumn(halfAxes, 0, scratchXAxis);
const yAxis = Matrix3_default.getColumn(halfAxes, 1, scratchYAxis);
const zAxis = Matrix3_default.getColumn(halfAxes, 2, scratchZAxis);
Cartesian3_default.clone(center, result[0]);
Cartesian3_default.subtract(result[0], xAxis, result[0]);
Cartesian3_default.subtract(result[0], yAxis, result[0]);
Cartesian3_default.subtract(result[0], zAxis, result[0]);
Cartesian3_default.clone(center, result[1]);
Cartesian3_default.subtract(result[1], xAxis, result[1]);
Cartesian3_default.subtract(result[1], yAxis, result[1]);
Cartesian3_default.add(result[1], zAxis, result[1]);
Cartesian3_default.clone(center, result[2]);
Cartesian3_default.subtract(result[2], xAxis, result[2]);
Cartesian3_default.add(result[2], yAxis, result[2]);
Cartesian3_default.subtract(result[2], zAxis, result[2]);
Cartesian3_default.clone(center, result[3]);
Cartesian3_default.subtract(result[3], xAxis, result[3]);
Cartesian3_default.add(result[3], yAxis, result[3]);
Cartesian3_default.add(result[3], zAxis, result[3]);
Cartesian3_default.clone(center, result[4]);
Cartesian3_default.add(result[4], xAxis, result[4]);
Cartesian3_default.subtract(result[4], yAxis, result[4]);
Cartesian3_default.subtract(result[4], zAxis, result[4]);
Cartesian3_default.clone(center, result[5]);
Cartesian3_default.add(result[5], xAxis, result[5]);
Cartesian3_default.subtract(result[5], yAxis, result[5]);
Cartesian3_default.add(result[5], zAxis, result[5]);
Cartesian3_default.clone(center, result[6]);
Cartesian3_default.add(result[6], xAxis, result[6]);
Cartesian3_default.add(result[6], yAxis, result[6]);
Cartesian3_default.subtract(result[6], zAxis, result[6]);
Cartesian3_default.clone(center, result[7]);
Cartesian3_default.add(result[7], xAxis, result[7]);
Cartesian3_default.add(result[7], yAxis, result[7]);
Cartesian3_default.add(result[7], zAxis, result[7]);
return result;
};
var scratchRotationScale = new Matrix3_default();
OrientedBoundingBox.computeTransformation = function(box, result) {
Check_default.typeOf.object("box", box);
if (!defined_default(result)) {
result = new Matrix4_default();
}
const translation = box.center;
const rotationScale = Matrix3_default.multiplyByUniformScale(
box.halfAxes,
2,
scratchRotationScale
);
return Matrix4_default.fromRotationTranslation(rotationScale, translation, result);
};
var scratchBoundingSphere = new BoundingSphere_default();
OrientedBoundingBox.isOccluded = function(box, occluder) {
if (!defined_default(box)) {
throw new DeveloperError_default("box is required.");
}
if (!defined_default(occluder)) {
throw new DeveloperError_default("occluder is required.");
}
const sphere = BoundingSphere_default.fromOrientedBoundingBox(
box,
scratchBoundingSphere
);
return !occluder.isBoundingSphereVisible(sphere);
};
OrientedBoundingBox.prototype.intersectPlane = function(plane) {
return OrientedBoundingBox.intersectPlane(this, plane);
};
OrientedBoundingBox.prototype.distanceSquaredTo = function(cartesian) {
return OrientedBoundingBox.distanceSquaredTo(this, cartesian);
};
OrientedBoundingBox.prototype.computePlaneDistances = function(position, direction, result) {
return OrientedBoundingBox.computePlaneDistances(
this,
position,
direction,
result
);
};
OrientedBoundingBox.prototype.computeCorners = function(result) {
return OrientedBoundingBox.computeCorners(this, result);
};
OrientedBoundingBox.prototype.computeTransformation = function(result) {
return OrientedBoundingBox.computeTransformation(this, result);
};
OrientedBoundingBox.prototype.isOccluded = function(occluder) {
return OrientedBoundingBox.isOccluded(this, occluder);
};
OrientedBoundingBox.equals = function(left, right) {
return left === right || defined_default(left) && defined_default(right) && Cartesian3_default.equals(left.center, right.center) && Matrix3_default.equals(left.halfAxes, right.halfAxes);
};
OrientedBoundingBox.prototype.clone = function(result) {
return OrientedBoundingBox.clone(this, result);
};
OrientedBoundingBox.prototype.equals = function(right) {
return OrientedBoundingBox.equals(this, right);
};
var OrientedBoundingBox_default = OrientedBoundingBox;
export {
OrientedBoundingBox_default
};
+387
View File
@@ -0,0 +1,387 @@
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.142.0
*
* 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 {
EllipseGeometryLibrary_default
} from "./chunk-YLY7NKAB.js";
import {
GeometryOffsetAttribute_default
} from "./chunk-IYOUHCZB.js";
import {
IndexDatatype_default
} from "./chunk-S4MCOY6I.js";
import {
GeometryAttributes_default
} from "./chunk-KSSWJIZW.js";
import {
GeometryAttribute_default,
Geometry_default,
PrimitiveType_default
} from "./chunk-EBSIOBXY.js";
import {
BoundingSphere_default
} from "./chunk-XZMBNNDX.js";
import {
ComponentDatatype_default
} from "./chunk-P3CK7MCY.js";
import {
Ellipsoid_default
} from "./chunk-V7VQKN6N.js";
import {
Cartesian3_default,
Frozen_default
} from "./chunk-MPZHGZU6.js";
import {
Math_default
} from "./chunk-J6BWOHUF.js";
import {
DeveloperError_default
} from "./chunk-AYKR4VBR.js";
import {
defined_default
} from "./chunk-ZP7JMQV4.js";
// packages/engine/Source/Core/EllipseOutlineGeometry.js
var scratchCartesian1 = new Cartesian3_default();
var boundingSphereCenter = new Cartesian3_default();
function computeEllipse(options) {
const center = options.center;
boundingSphereCenter = Cartesian3_default.multiplyByScalar(
options.ellipsoid.geodeticSurfaceNormal(center, boundingSphereCenter),
options.height,
boundingSphereCenter
);
boundingSphereCenter = Cartesian3_default.add(
center,
boundingSphereCenter,
boundingSphereCenter
);
const boundingSphere = new BoundingSphere_default(
boundingSphereCenter,
options.semiMajorAxis
);
const positions = EllipseGeometryLibrary_default.computeEllipsePositions(
options,
false,
true
).outerPositions;
const attributes = new GeometryAttributes_default({
position: new GeometryAttribute_default({
componentDatatype: ComponentDatatype_default.DOUBLE,
componentsPerAttribute: 3,
values: EllipseGeometryLibrary_default.raisePositionsToHeight(
positions,
options,
false
)
})
});
const length = positions.length / 3;
const indices = IndexDatatype_default.createTypedArray(length, length * 2);
let index = 0;
for (let i = 0; i < length; ++i) {
indices[index++] = i;
indices[index++] = (i + 1) % length;
}
return {
boundingSphere,
attributes,
indices
};
}
var topBoundingSphere = new BoundingSphere_default();
var bottomBoundingSphere = new BoundingSphere_default();
function computeExtrudedEllipse(options) {
const center = options.center;
const ellipsoid = options.ellipsoid;
const semiMajorAxis = options.semiMajorAxis;
let scaledNormal = Cartesian3_default.multiplyByScalar(
ellipsoid.geodeticSurfaceNormal(center, scratchCartesian1),
options.height,
scratchCartesian1
);
topBoundingSphere.center = Cartesian3_default.add(
center,
scaledNormal,
topBoundingSphere.center
);
topBoundingSphere.radius = semiMajorAxis;
scaledNormal = Cartesian3_default.multiplyByScalar(
ellipsoid.geodeticSurfaceNormal(center, scaledNormal),
options.extrudedHeight,
scaledNormal
);
bottomBoundingSphere.center = Cartesian3_default.add(
center,
scaledNormal,
bottomBoundingSphere.center
);
bottomBoundingSphere.radius = semiMajorAxis;
let positions = EllipseGeometryLibrary_default.computeEllipsePositions(
options,
false,
true
).outerPositions;
const attributes = new GeometryAttributes_default({
position: new GeometryAttribute_default({
componentDatatype: ComponentDatatype_default.DOUBLE,
componentsPerAttribute: 3,
values: EllipseGeometryLibrary_default.raisePositionsToHeight(
positions,
options,
true
)
})
});
positions = attributes.position.values;
const boundingSphere = BoundingSphere_default.union(
topBoundingSphere,
bottomBoundingSphere
);
let length = positions.length / 3;
if (defined_default(options.offsetAttribute)) {
let applyOffset = new Uint8Array(length);
if (options.offsetAttribute === GeometryOffsetAttribute_default.TOP) {
applyOffset = applyOffset.fill(1, 0, length / 2);
} else {
const offsetValue = options.offsetAttribute === GeometryOffsetAttribute_default.NONE ? 0 : 1;
applyOffset = applyOffset.fill(offsetValue);
}
attributes.applyOffset = new GeometryAttribute_default({
componentDatatype: ComponentDatatype_default.UNSIGNED_BYTE,
componentsPerAttribute: 1,
values: applyOffset
});
}
let numberOfVerticalLines = options.numberOfVerticalLines ?? 16;
numberOfVerticalLines = Math_default.clamp(
numberOfVerticalLines,
0,
length / 2
);
const indices = IndexDatatype_default.createTypedArray(
length,
length * 2 + numberOfVerticalLines * 2
);
length /= 2;
let index = 0;
let i;
for (i = 0; i < length; ++i) {
indices[index++] = i;
indices[index++] = (i + 1) % length;
indices[index++] = i + length;
indices[index++] = (i + 1) % length + length;
}
let numSide;
if (numberOfVerticalLines > 0) {
const numSideLines = Math.min(numberOfVerticalLines, length);
numSide = Math.round(length / numSideLines);
const maxI = Math.min(numSide * numberOfVerticalLines, length);
for (i = 0; i < maxI; i += numSide) {
indices[index++] = i;
indices[index++] = i + length;
}
}
return {
boundingSphere,
attributes,
indices
};
}
function EllipseOutlineGeometry(options) {
options = options ?? Frozen_default.EMPTY_OBJECT;
const center = options.center;
const ellipsoid = options.ellipsoid ?? Ellipsoid_default.default;
const semiMajorAxis = options.semiMajorAxis;
const semiMinorAxis = options.semiMinorAxis;
const granularity = options.granularity ?? Math_default.RADIANS_PER_DEGREE;
if (!defined_default(center)) {
throw new DeveloperError_default("center is required.");
}
if (!defined_default(semiMajorAxis)) {
throw new DeveloperError_default("semiMajorAxis is required.");
}
if (!defined_default(semiMinorAxis)) {
throw new DeveloperError_default("semiMinorAxis is required.");
}
if (semiMajorAxis < semiMinorAxis) {
throw new DeveloperError_default(
"semiMajorAxis must be greater than or equal to the semiMinorAxis."
);
}
if (granularity <= 0) {
throw new DeveloperError_default("granularity must be greater than zero.");
}
const height = options.height ?? 0;
const extrudedHeight = options.extrudedHeight ?? height;
this._center = Cartesian3_default.clone(center);
this._semiMajorAxis = semiMajorAxis;
this._semiMinorAxis = semiMinorAxis;
this._ellipsoid = Ellipsoid_default.clone(ellipsoid);
this._rotation = options.rotation ?? 0;
this._height = Math.max(extrudedHeight, height);
this._granularity = granularity;
this._extrudedHeight = Math.min(extrudedHeight, height);
this._numberOfVerticalLines = Math.max(
options.numberOfVerticalLines ?? 16,
0
);
this._offsetAttribute = options.offsetAttribute;
this._workerName = "createEllipseOutlineGeometry";
}
EllipseOutlineGeometry.packedLength = Cartesian3_default.packedLength + Ellipsoid_default.packedLength + 8;
EllipseOutlineGeometry.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 = startingIndex ?? 0;
Cartesian3_default.pack(value._center, array, startingIndex);
startingIndex += Cartesian3_default.packedLength;
Ellipsoid_default.pack(value._ellipsoid, array, startingIndex);
startingIndex += Ellipsoid_default.packedLength;
array[startingIndex++] = value._semiMajorAxis;
array[startingIndex++] = value._semiMinorAxis;
array[startingIndex++] = value._rotation;
array[startingIndex++] = value._height;
array[startingIndex++] = value._granularity;
array[startingIndex++] = value._extrudedHeight;
array[startingIndex++] = value._numberOfVerticalLines;
array[startingIndex] = value._offsetAttribute ?? -1;
return array;
};
var scratchCenter = new Cartesian3_default();
var scratchEllipsoid = new Ellipsoid_default();
var scratchOptions = {
center: scratchCenter,
ellipsoid: scratchEllipsoid,
semiMajorAxis: void 0,
semiMinorAxis: void 0,
rotation: void 0,
height: void 0,
granularity: void 0,
extrudedHeight: void 0,
numberOfVerticalLines: void 0,
offsetAttribute: void 0
};
EllipseOutlineGeometry.unpack = function(array, startingIndex, result) {
if (!defined_default(array)) {
throw new DeveloperError_default("array is required");
}
startingIndex = startingIndex ?? 0;
const center = Cartesian3_default.unpack(array, startingIndex, scratchCenter);
startingIndex += Cartesian3_default.packedLength;
const ellipsoid = Ellipsoid_default.unpack(array, startingIndex, scratchEllipsoid);
startingIndex += Ellipsoid_default.packedLength;
const semiMajorAxis = array[startingIndex++];
const semiMinorAxis = array[startingIndex++];
const rotation = array[startingIndex++];
const height = array[startingIndex++];
const granularity = array[startingIndex++];
const extrudedHeight = array[startingIndex++];
const numberOfVerticalLines = array[startingIndex++];
const offsetAttribute = array[startingIndex];
if (!defined_default(result)) {
scratchOptions.height = height;
scratchOptions.extrudedHeight = extrudedHeight;
scratchOptions.granularity = granularity;
scratchOptions.rotation = rotation;
scratchOptions.semiMajorAxis = semiMajorAxis;
scratchOptions.semiMinorAxis = semiMinorAxis;
scratchOptions.numberOfVerticalLines = numberOfVerticalLines;
scratchOptions.offsetAttribute = offsetAttribute === -1 ? void 0 : offsetAttribute;
return new EllipseOutlineGeometry(scratchOptions);
}
result._center = Cartesian3_default.clone(center, result._center);
result._ellipsoid = Ellipsoid_default.clone(ellipsoid, result._ellipsoid);
result._semiMajorAxis = semiMajorAxis;
result._semiMinorAxis = semiMinorAxis;
result._rotation = rotation;
result._height = height;
result._granularity = granularity;
result._extrudedHeight = extrudedHeight;
result._numberOfVerticalLines = numberOfVerticalLines;
result._offsetAttribute = offsetAttribute === -1 ? void 0 : offsetAttribute;
return result;
};
EllipseOutlineGeometry.createGeometry = function(ellipseGeometry) {
if (ellipseGeometry._semiMajorAxis <= 0 || ellipseGeometry._semiMinorAxis <= 0) {
return;
}
const height = ellipseGeometry._height;
const extrudedHeight = ellipseGeometry._extrudedHeight;
const extrude = !Math_default.equalsEpsilon(
height,
extrudedHeight,
0,
Math_default.EPSILON2
);
ellipseGeometry._center = ellipseGeometry._ellipsoid.scaleToGeodeticSurface(
ellipseGeometry._center,
ellipseGeometry._center
);
const options = {
center: ellipseGeometry._center,
semiMajorAxis: ellipseGeometry._semiMajorAxis,
semiMinorAxis: ellipseGeometry._semiMinorAxis,
ellipsoid: ellipseGeometry._ellipsoid,
rotation: ellipseGeometry._rotation,
height,
granularity: ellipseGeometry._granularity,
numberOfVerticalLines: ellipseGeometry._numberOfVerticalLines
};
let geometry;
if (extrude) {
options.extrudedHeight = extrudedHeight;
options.offsetAttribute = ellipseGeometry._offsetAttribute;
geometry = computeExtrudedEllipse(options);
} else {
geometry = computeEllipse(options);
if (defined_default(ellipseGeometry._offsetAttribute)) {
const length = geometry.attributes.position.values.length;
const offsetValue = ellipseGeometry._offsetAttribute === GeometryOffsetAttribute_default.NONE ? 0 : 1;
const applyOffset = new Uint8Array(length / 3).fill(offsetValue);
geometry.attributes.applyOffset = new GeometryAttribute_default({
componentDatatype: ComponentDatatype_default.UNSIGNED_BYTE,
componentsPerAttribute: 1,
values: applyOffset
});
}
}
return new Geometry_default({
attributes: geometry.attributes,
indices: geometry.indices,
primitiveType: PrimitiveType_default.LINES,
boundingSphere: geometry.boundingSphere,
offsetAttribute: ellipseGeometry._offsetAttribute
});
};
var EllipseOutlineGeometry_default = EllipseOutlineGeometry;
export {
EllipseOutlineGeometry_default
};
+57
View File
@@ -0,0 +1,57 @@
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.142.0
*
* 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
} from "./chunk-Q3PY526V.js";
import {
Frozen_default
} from "./chunk-MPZHGZU6.js";
import {
DeveloperError_default
} from "./chunk-AYKR4VBR.js";
import {
defined_default
} from "./chunk-ZP7JMQV4.js";
// packages/engine/Source/Core/GeometryInstance.js
function GeometryInstance(options) {
options = options ?? Frozen_default.EMPTY_OBJECT;
if (!defined_default(options.geometry)) {
throw new DeveloperError_default("options.geometry is required.");
}
this.geometry = options.geometry;
this.modelMatrix = Matrix4_default.clone(options.modelMatrix ?? Matrix4_default.IDENTITY);
this.id = options.id;
this.pickPrimitive = options.pickPrimitive;
this.attributes = options.attributes ?? {};
this.westHemisphereGeometry = void 0;
this.eastHemisphereGeometry = void 0;
}
var GeometryInstance_default = GeometryInstance;
export {
GeometryInstance_default
};
+476
View File
@@ -0,0 +1,476 @@
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.142.0
*
* 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 {
CornerType_default,
PolylineVolumeGeometryLibrary_default
} from "./chunk-UA25D5MX.js";
import {
PolylinePipeline_default
} from "./chunk-QRWGUWI6.js";
import {
Quaternion_default
} from "./chunk-MYP774IS.js";
import {
Cartesian3_default,
Matrix3_default
} from "./chunk-MPZHGZU6.js";
import {
Math_default
} from "./chunk-J6BWOHUF.js";
import {
defined_default
} from "./chunk-ZP7JMQV4.js";
// packages/engine/Source/Core/CorridorGeometryLibrary.js
var CorridorGeometryLibrary = {};
var scratch1 = new Cartesian3_default();
var scratch2 = new Cartesian3_default();
var scratch3 = new Cartesian3_default();
var scratch4 = new Cartesian3_default();
var scaleArray2 = [new Cartesian3_default(), new Cartesian3_default()];
var cartesian1 = new Cartesian3_default();
var cartesian2 = new Cartesian3_default();
var cartesian3 = new Cartesian3_default();
var cartesian4 = new Cartesian3_default();
var cartesian5 = new Cartesian3_default();
var cartesian6 = new Cartesian3_default();
var cartesian7 = new Cartesian3_default();
var cartesian8 = new Cartesian3_default();
var cartesian9 = new Cartesian3_default();
var cartesian10 = new Cartesian3_default();
var quaterion = new Quaternion_default();
var rotMatrix = new Matrix3_default();
function computeRoundCorner(cornerPoint, startPoint, endPoint, cornerType, leftIsOutside) {
const angle = Cartesian3_default.angleBetween(
Cartesian3_default.subtract(startPoint, cornerPoint, scratch1),
Cartesian3_default.subtract(endPoint, cornerPoint, scratch2)
);
const granularity = cornerType === CornerType_default.BEVELED ? 1 : Math.ceil(angle / Math_default.toRadians(5)) + 1;
const size = granularity * 3;
const array = new Array(size);
array[size - 3] = endPoint.x;
array[size - 2] = endPoint.y;
array[size - 1] = endPoint.z;
let m;
if (leftIsOutside) {
m = Matrix3_default.fromQuaternion(
Quaternion_default.fromAxisAngle(
Cartesian3_default.negate(cornerPoint, scratch1),
angle / granularity,
quaterion
),
rotMatrix
);
} else {
m = Matrix3_default.fromQuaternion(
Quaternion_default.fromAxisAngle(cornerPoint, angle / granularity, quaterion),
rotMatrix
);
}
let index = 0;
startPoint = Cartesian3_default.clone(startPoint, scratch1);
for (let i = 0; i < granularity; i++) {
startPoint = Matrix3_default.multiplyByVector(m, startPoint, startPoint);
array[index++] = startPoint.x;
array[index++] = startPoint.y;
array[index++] = startPoint.z;
}
return array;
}
function addEndCaps(calculatedPositions) {
let cornerPoint = cartesian1;
let startPoint = cartesian2;
let endPoint = cartesian3;
let leftEdge = calculatedPositions[1];
startPoint = Cartesian3_default.fromArray(
calculatedPositions[1],
leftEdge.length - 3,
startPoint
);
endPoint = Cartesian3_default.fromArray(calculatedPositions[0], 0, endPoint);
cornerPoint = Cartesian3_default.midpoint(startPoint, endPoint, cornerPoint);
const firstEndCap = computeRoundCorner(
cornerPoint,
startPoint,
endPoint,
CornerType_default.ROUNDED,
false
);
const length = calculatedPositions.length - 1;
const rightEdge = calculatedPositions[length - 1];
leftEdge = calculatedPositions[length];
startPoint = Cartesian3_default.fromArray(
rightEdge,
rightEdge.length - 3,
startPoint
);
endPoint = Cartesian3_default.fromArray(leftEdge, 0, endPoint);
cornerPoint = Cartesian3_default.midpoint(startPoint, endPoint, cornerPoint);
const lastEndCap = computeRoundCorner(
cornerPoint,
startPoint,
endPoint,
CornerType_default.ROUNDED,
false
);
return [firstEndCap, lastEndCap];
}
function computeMiteredCorner(position, leftCornerDirection, lastPoint, leftIsOutside) {
let cornerPoint = scratch1;
if (leftIsOutside) {
cornerPoint = Cartesian3_default.add(position, leftCornerDirection, cornerPoint);
} else {
leftCornerDirection = Cartesian3_default.negate(
leftCornerDirection,
leftCornerDirection
);
cornerPoint = Cartesian3_default.add(position, leftCornerDirection, cornerPoint);
}
return [
cornerPoint.x,
cornerPoint.y,
cornerPoint.z,
lastPoint.x,
lastPoint.y,
lastPoint.z
];
}
function addShiftedPositions(positions, left, scalar, calculatedPositions) {
const rightPositions = new Array(positions.length);
const leftPositions = new Array(positions.length);
const scaledLeft = Cartesian3_default.multiplyByScalar(left, scalar, scratch1);
const scaledRight = Cartesian3_default.negate(scaledLeft, scratch2);
let rightIndex = 0;
let leftIndex = positions.length - 1;
for (let i = 0; i < positions.length; i += 3) {
const pos = Cartesian3_default.fromArray(positions, i, scratch3);
const rightPos = Cartesian3_default.add(pos, scaledRight, scratch4);
rightPositions[rightIndex++] = rightPos.x;
rightPositions[rightIndex++] = rightPos.y;
rightPositions[rightIndex++] = rightPos.z;
const leftPos = Cartesian3_default.add(pos, scaledLeft, scratch4);
leftPositions[leftIndex--] = leftPos.z;
leftPositions[leftIndex--] = leftPos.y;
leftPositions[leftIndex--] = leftPos.x;
}
calculatedPositions.push(rightPositions, leftPositions);
return calculatedPositions;
}
CorridorGeometryLibrary.addAttribute = function(attribute, value, front, back) {
const x = value.x;
const y = value.y;
const z = value.z;
if (defined_default(front)) {
attribute[front] = x;
attribute[front + 1] = y;
attribute[front + 2] = z;
}
if (defined_default(back)) {
attribute[back] = z;
attribute[back - 1] = y;
attribute[back - 2] = x;
}
};
var scratchForwardProjection = new Cartesian3_default();
var scratchBackwardProjection = new Cartesian3_default();
CorridorGeometryLibrary.computePositions = function(params) {
const granularity = params.granularity;
const positions = params.positions;
const ellipsoid = params.ellipsoid;
const width = params.width / 2;
const cornerType = params.cornerType;
const saveAttributes = params.saveAttributes;
let normal = cartesian1;
let forward = cartesian2;
let backward = cartesian3;
let left = cartesian4;
let cornerDirection = cartesian5;
let startPoint = cartesian6;
let previousPos = cartesian7;
let rightPos = cartesian8;
let leftPos = cartesian9;
let center = cartesian10;
let calculatedPositions = [];
const calculatedLefts = saveAttributes ? [] : void 0;
const calculatedNormals = saveAttributes ? [] : void 0;
let position = positions[0];
let nextPosition = positions[1];
forward = Cartesian3_default.normalize(
Cartesian3_default.subtract(nextPosition, position, forward),
forward
);
normal = ellipsoid.geodeticSurfaceNormal(position, normal);
left = Cartesian3_default.normalize(Cartesian3_default.cross(normal, forward, left), left);
if (saveAttributes) {
calculatedLefts.push(left.x, left.y, left.z);
calculatedNormals.push(normal.x, normal.y, normal.z);
}
previousPos = Cartesian3_default.clone(position, previousPos);
position = nextPosition;
backward = Cartesian3_default.negate(forward, backward);
let subdividedPositions;
const corners = [];
let i;
const length = positions.length;
for (i = 1; i < length - 1; i++) {
normal = ellipsoid.geodeticSurfaceNormal(position, normal);
nextPosition = positions[i + 1];
forward = Cartesian3_default.normalize(
Cartesian3_default.subtract(nextPosition, position, forward),
forward
);
const forwardProjection = Cartesian3_default.multiplyByScalar(
normal,
Cartesian3_default.dot(forward, normal),
scratchForwardProjection
);
Cartesian3_default.subtract(forward, forwardProjection, forwardProjection);
Cartesian3_default.normalize(forwardProjection, forwardProjection);
const backwardProjection = Cartesian3_default.multiplyByScalar(
normal,
Cartesian3_default.dot(backward, normal),
scratchBackwardProjection
);
Cartesian3_default.subtract(backward, backwardProjection, backwardProjection);
Cartesian3_default.normalize(backwardProjection, backwardProjection);
const doCorner = !Math_default.equalsEpsilon(
Math.abs(Cartesian3_default.dot(forwardProjection, backwardProjection)),
1,
Math_default.EPSILON7
);
if (doCorner) {
cornerDirection = Cartesian3_default.normalize(
Cartesian3_default.add(forward, backward, cornerDirection),
cornerDirection
);
cornerDirection = Cartesian3_default.cross(
cornerDirection,
normal,
cornerDirection
);
cornerDirection = Cartesian3_default.cross(
normal,
cornerDirection,
cornerDirection
);
cornerDirection = Cartesian3_default.normalize(cornerDirection, cornerDirection);
const scalar = width / Math.max(
0.25,
Cartesian3_default.magnitude(
Cartesian3_default.cross(cornerDirection, backward, scratch1)
)
);
const leftIsOutside = PolylineVolumeGeometryLibrary_default.angleIsGreaterThanPi(
forward,
backward,
position,
ellipsoid
);
cornerDirection = Cartesian3_default.multiplyByScalar(
cornerDirection,
scalar,
cornerDirection
);
if (leftIsOutside) {
rightPos = Cartesian3_default.add(position, cornerDirection, rightPos);
center = Cartesian3_default.add(
rightPos,
Cartesian3_default.multiplyByScalar(left, width, center),
center
);
leftPos = Cartesian3_default.add(
rightPos,
Cartesian3_default.multiplyByScalar(left, width * 2, leftPos),
leftPos
);
scaleArray2[0] = Cartesian3_default.clone(previousPos, scaleArray2[0]);
scaleArray2[1] = Cartesian3_default.clone(center, scaleArray2[1]);
subdividedPositions = PolylinePipeline_default.generateArc({
positions: scaleArray2,
granularity,
ellipsoid
});
calculatedPositions = addShiftedPositions(
subdividedPositions,
left,
width,
calculatedPositions
);
if (saveAttributes) {
calculatedLefts.push(left.x, left.y, left.z);
calculatedNormals.push(normal.x, normal.y, normal.z);
}
startPoint = Cartesian3_default.clone(leftPos, startPoint);
left = Cartesian3_default.normalize(
Cartesian3_default.cross(normal, forward, left),
left
);
leftPos = Cartesian3_default.add(
rightPos,
Cartesian3_default.multiplyByScalar(left, width * 2, leftPos),
leftPos
);
previousPos = Cartesian3_default.add(
rightPos,
Cartesian3_default.multiplyByScalar(left, width, previousPos),
previousPos
);
if (cornerType === CornerType_default.ROUNDED || cornerType === CornerType_default.BEVELED) {
corners.push({
leftPositions: computeRoundCorner(
rightPos,
startPoint,
leftPos,
cornerType,
leftIsOutside
)
});
} else {
corners.push({
leftPositions: computeMiteredCorner(
position,
Cartesian3_default.negate(cornerDirection, cornerDirection),
leftPos,
leftIsOutside
)
});
}
} else {
leftPos = Cartesian3_default.add(position, cornerDirection, leftPos);
center = Cartesian3_default.add(
leftPos,
Cartesian3_default.negate(
Cartesian3_default.multiplyByScalar(left, width, center),
center
),
center
);
rightPos = Cartesian3_default.add(
leftPos,
Cartesian3_default.negate(
Cartesian3_default.multiplyByScalar(left, width * 2, rightPos),
rightPos
),
rightPos
);
scaleArray2[0] = Cartesian3_default.clone(previousPos, scaleArray2[0]);
scaleArray2[1] = Cartesian3_default.clone(center, scaleArray2[1]);
subdividedPositions = PolylinePipeline_default.generateArc({
positions: scaleArray2,
granularity,
ellipsoid
});
calculatedPositions = addShiftedPositions(
subdividedPositions,
left,
width,
calculatedPositions
);
if (saveAttributes) {
calculatedLefts.push(left.x, left.y, left.z);
calculatedNormals.push(normal.x, normal.y, normal.z);
}
startPoint = Cartesian3_default.clone(rightPos, startPoint);
left = Cartesian3_default.normalize(
Cartesian3_default.cross(normal, forward, left),
left
);
rightPos = Cartesian3_default.add(
leftPos,
Cartesian3_default.negate(
Cartesian3_default.multiplyByScalar(left, width * 2, rightPos),
rightPos
),
rightPos
);
previousPos = Cartesian3_default.add(
leftPos,
Cartesian3_default.negate(
Cartesian3_default.multiplyByScalar(left, width, previousPos),
previousPos
),
previousPos
);
if (cornerType === CornerType_default.ROUNDED || cornerType === CornerType_default.BEVELED) {
corners.push({
rightPositions: computeRoundCorner(
leftPos,
startPoint,
rightPos,
cornerType,
leftIsOutside
)
});
} else {
corners.push({
rightPositions: computeMiteredCorner(
position,
cornerDirection,
rightPos,
leftIsOutside
)
});
}
}
backward = Cartesian3_default.negate(forward, backward);
}
position = nextPosition;
}
normal = ellipsoid.geodeticSurfaceNormal(position, normal);
scaleArray2[0] = Cartesian3_default.clone(previousPos, scaleArray2[0]);
scaleArray2[1] = Cartesian3_default.clone(position, scaleArray2[1]);
subdividedPositions = PolylinePipeline_default.generateArc({
positions: scaleArray2,
granularity,
ellipsoid
});
calculatedPositions = addShiftedPositions(
subdividedPositions,
left,
width,
calculatedPositions
);
if (saveAttributes) {
calculatedLefts.push(left.x, left.y, left.z);
calculatedNormals.push(normal.x, normal.y, normal.z);
}
let endPositions;
if (cornerType === CornerType_default.ROUNDED) {
endPositions = addEndCaps(calculatedPositions);
}
return {
positions: calculatedPositions,
corners,
lefts: calculatedLefts,
normals: calculatedNormals,
endPositions
};
};
var CorridorGeometryLibrary_default = CorridorGeometryLibrary;
export {
CorridorGeometryLibrary_default
};
+241
View File
@@ -0,0 +1,241 @@
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.142.0
*
* 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 {
GeographicProjection_default
} from "./chunk-XZMBNNDX.js";
import {
Matrix2_default,
Rectangle_default
} from "./chunk-MYP774IS.js";
import {
Cartographic_default,
Ellipsoid_default
} from "./chunk-V7VQKN6N.js";
import {
Cartesian3_default
} from "./chunk-MPZHGZU6.js";
import {
Math_default
} from "./chunk-J6BWOHUF.js";
import {
DeveloperError_default
} from "./chunk-AYKR4VBR.js";
import {
defined_default
} from "./chunk-ZP7JMQV4.js";
// packages/engine/Source/Core/RectangleGeometryLibrary.js
var cos = Math.cos;
var sin = Math.sin;
var sqrt = Math.sqrt;
var RectangleGeometryLibrary = {};
RectangleGeometryLibrary.computePosition = function(computedOptions, ellipsoid, computeST, row, col, position, st) {
const radiiSquared = ellipsoid.radiiSquared;
const nwCorner = computedOptions.nwCorner;
const rectangle = computedOptions.boundingRectangle;
let stLatitude = nwCorner.latitude - computedOptions.granYCos * row + col * computedOptions.granXSin;
const cosLatitude = cos(stLatitude);
const nZ = sin(stLatitude);
const kZ = radiiSquared.z * nZ;
let stLongitude = nwCorner.longitude + row * computedOptions.granYSin + col * computedOptions.granXCos;
const nX = cosLatitude * cos(stLongitude);
const nY = cosLatitude * sin(stLongitude);
const kX = radiiSquared.x * nX;
const kY = radiiSquared.y * nY;
const gamma = sqrt(kX * nX + kY * nY + kZ * nZ);
position.x = kX / gamma;
position.y = kY / gamma;
position.z = kZ / gamma;
if (computeST) {
const stNwCorner = computedOptions.stNwCorner;
if (defined_default(stNwCorner)) {
stLatitude = stNwCorner.latitude - computedOptions.stGranYCos * row + col * computedOptions.stGranXSin;
stLongitude = stNwCorner.longitude + row * computedOptions.stGranYSin + col * computedOptions.stGranXCos;
st.x = (stLongitude - computedOptions.stWest) * computedOptions.lonScalar;
st.y = (stLatitude - computedOptions.stSouth) * computedOptions.latScalar;
} else {
st.x = (stLongitude - rectangle.west) * computedOptions.lonScalar;
st.y = (stLatitude - rectangle.south) * computedOptions.latScalar;
}
}
};
var rotationMatrixScratch = new Matrix2_default();
var nwCartesian = new Cartesian3_default();
var centerScratch = new Cartographic_default();
var centerCartesian = new Cartesian3_default();
var proj = new GeographicProjection_default();
function getRotationOptions(nwCorner, rotation, granularityX, granularityY, center, width, height) {
const cosRotation = Math.cos(rotation);
const granYCos = granularityY * cosRotation;
const granXCos = granularityX * cosRotation;
const sinRotation = Math.sin(rotation);
const granYSin = granularityY * sinRotation;
const granXSin = granularityX * sinRotation;
proj._ellipsoid = Ellipsoid_default.default;
nwCartesian = proj.project(nwCorner, nwCartesian);
nwCartesian = Cartesian3_default.subtract(nwCartesian, centerCartesian, nwCartesian);
const rotationMatrix = Matrix2_default.fromRotation(rotation, rotationMatrixScratch);
nwCartesian = Matrix2_default.multiplyByVector(
rotationMatrix,
nwCartesian,
nwCartesian
);
nwCartesian = Cartesian3_default.add(nwCartesian, centerCartesian, nwCartesian);
nwCorner = proj.unproject(nwCartesian, nwCorner);
width -= 1;
height -= 1;
const latitude = nwCorner.latitude;
const latitude0 = latitude + width * granXSin;
const latitude1 = latitude - granYCos * height;
const latitude2 = latitude - granYCos * height + width * granXSin;
const north = Math.max(latitude, latitude0, latitude1, latitude2);
const south = Math.min(latitude, latitude0, latitude1, latitude2);
const longitude = nwCorner.longitude;
const longitude0 = longitude + width * granXCos;
const longitude1 = longitude + height * granYSin;
const longitude2 = longitude + height * granYSin + width * granXCos;
const east = Math.max(longitude, longitude0, longitude1, longitude2);
const west = Math.min(longitude, longitude0, longitude1, longitude2);
return {
north,
south,
east,
west,
granYCos,
granYSin,
granXCos,
granXSin,
nwCorner
};
}
RectangleGeometryLibrary.computeOptions = function(rectangle, granularity, rotation, stRotation, boundingRectangleScratch, nwCornerResult, stNwCornerResult) {
let east = rectangle.east;
let west = rectangle.west;
let north = rectangle.north;
let south = rectangle.south;
let northCap = false;
let southCap = false;
if (north === Math_default.PI_OVER_TWO) {
northCap = true;
}
if (south === -Math_default.PI_OVER_TWO) {
southCap = true;
}
let dx;
const dy = north - south;
if (west > east) {
dx = Math_default.TWO_PI - west + east;
} else {
dx = east - west;
}
const width = Math.ceil(dx / granularity) + 1;
const height = Math.ceil(dy / granularity) + 1;
const granularityX = dx / (width - 1);
const granularityY = dy / (height - 1);
const nwCorner = Rectangle_default.northwest(rectangle, nwCornerResult);
const center = Rectangle_default.center(rectangle, centerScratch);
if (rotation !== 0 || stRotation !== 0) {
if (center.longitude < nwCorner.longitude) {
center.longitude += Math_default.TWO_PI;
}
proj._ellipsoid = Ellipsoid_default.default;
centerCartesian = proj.project(center, centerCartesian);
}
const granYCos = granularityY;
const granXCos = granularityX;
const granYSin = 0;
const granXSin = 0;
const boundingRectangle = Rectangle_default.clone(
rectangle,
boundingRectangleScratch
);
const computedOptions = {
granYCos,
granYSin,
granXCos,
granXSin,
nwCorner,
boundingRectangle,
width,
height,
northCap,
southCap
};
if (rotation !== 0) {
const rotationOptions = getRotationOptions(
nwCorner,
rotation,
granularityX,
granularityY,
center,
width,
height
);
north = rotationOptions.north;
south = rotationOptions.south;
east = rotationOptions.east;
west = rotationOptions.west;
if (north < -Math_default.PI_OVER_TWO || north > Math_default.PI_OVER_TWO || south < -Math_default.PI_OVER_TWO || south > Math_default.PI_OVER_TWO) {
throw new DeveloperError_default(
"Rotated rectangle is invalid. It crosses over either the north or south pole."
);
}
computedOptions.granYCos = rotationOptions.granYCos;
computedOptions.granYSin = rotationOptions.granYSin;
computedOptions.granXCos = rotationOptions.granXCos;
computedOptions.granXSin = rotationOptions.granXSin;
boundingRectangle.north = north;
boundingRectangle.south = south;
boundingRectangle.east = east;
boundingRectangle.west = west;
}
if (stRotation !== 0) {
rotation = rotation - stRotation;
const stNwCorner = Rectangle_default.northwest(boundingRectangle, stNwCornerResult);
const stRotationOptions = getRotationOptions(
stNwCorner,
rotation,
granularityX,
granularityY,
center,
width,
height
);
computedOptions.stGranYCos = stRotationOptions.granYCos;
computedOptions.stGranXCos = stRotationOptions.granXCos;
computedOptions.stGranYSin = stRotationOptions.granYSin;
computedOptions.stGranXSin = stRotationOptions.granXSin;
computedOptions.stNwCorner = stNwCorner;
computedOptions.stWest = stRotationOptions.west;
computedOptions.stSouth = stRotationOptions.south;
}
return computedOptions;
};
var RectangleGeometryLibrary_default = RectangleGeometryLibrary;
export {
RectangleGeometryLibrary_default
};
+73
View File
@@ -0,0 +1,73 @@
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.142.0
*
* 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-J6BWOHUF.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
};
+38
View File
@@ -0,0 +1,38 @@
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.142.0
*
* 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.
*/
// packages/engine/Source/Core/GeometryOffsetAttribute.js
var GeometryOffsetAttribute = {
NONE: 0,
TOP: 1,
ALL: 2
};
Object.freeze(GeometryOffsetAttribute);
var GeometryOffsetAttribute_default = GeometryOffsetAttribute;
export {
GeometryOffsetAttribute_default
};
+497
View File
@@ -0,0 +1,497 @@
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.142.0
*
* 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 {
Check_default,
DeveloperError_default
} from "./chunk-AYKR4VBR.js";
import {
__commonJS,
__toESM,
defined_default
} from "./chunk-ZP7JMQV4.js";
// node_modules/mersenne-twister/src/mersenne-twister.js
var require_mersenne_twister = __commonJS({
"node_modules/mersenne-twister/src/mersenne-twister.js"(exports, module) {
var MersenneTwister2 = function(seed) {
if (seed == void 0) {
seed = (/* @__PURE__ */ new Date()).getTime();
}
this.N = 624;
this.M = 397;
this.MATRIX_A = 2567483615;
this.UPPER_MASK = 2147483648;
this.LOWER_MASK = 2147483647;
this.mt = new Array(this.N);
this.mti = this.N + 1;
if (seed.constructor == Array) {
this.init_by_array(seed, seed.length);
} else {
this.init_seed(seed);
}
};
MersenneTwister2.prototype.init_seed = function(s) {
this.mt[0] = s >>> 0;
for (this.mti = 1; this.mti < this.N; this.mti++) {
var s = this.mt[this.mti - 1] ^ this.mt[this.mti - 1] >>> 30;
this.mt[this.mti] = (((s & 4294901760) >>> 16) * 1812433253 << 16) + (s & 65535) * 1812433253 + this.mti;
this.mt[this.mti] >>>= 0;
}
};
MersenneTwister2.prototype.init_by_array = function(init_key, key_length) {
var i, j, k;
this.init_seed(19650218);
i = 1;
j = 0;
k = this.N > key_length ? this.N : key_length;
for (; k; k--) {
var s = this.mt[i - 1] ^ this.mt[i - 1] >>> 30;
this.mt[i] = (this.mt[i] ^ (((s & 4294901760) >>> 16) * 1664525 << 16) + (s & 65535) * 1664525) + init_key[j] + j;
this.mt[i] >>>= 0;
i++;
j++;
if (i >= this.N) {
this.mt[0] = this.mt[this.N - 1];
i = 1;
}
if (j >= key_length) j = 0;
}
for (k = this.N - 1; k; k--) {
var s = this.mt[i - 1] ^ this.mt[i - 1] >>> 30;
this.mt[i] = (this.mt[i] ^ (((s & 4294901760) >>> 16) * 1566083941 << 16) + (s & 65535) * 1566083941) - i;
this.mt[i] >>>= 0;
i++;
if (i >= this.N) {
this.mt[0] = this.mt[this.N - 1];
i = 1;
}
}
this.mt[0] = 2147483648;
};
MersenneTwister2.prototype.random_int = function() {
var y;
var mag01 = new Array(0, this.MATRIX_A);
if (this.mti >= this.N) {
var kk;
if (this.mti == this.N + 1)
this.init_seed(5489);
for (kk = 0; kk < this.N - this.M; kk++) {
y = this.mt[kk] & this.UPPER_MASK | this.mt[kk + 1] & this.LOWER_MASK;
this.mt[kk] = this.mt[kk + this.M] ^ y >>> 1 ^ mag01[y & 1];
}
for (; kk < this.N - 1; kk++) {
y = this.mt[kk] & this.UPPER_MASK | this.mt[kk + 1] & this.LOWER_MASK;
this.mt[kk] = this.mt[kk + (this.M - this.N)] ^ y >>> 1 ^ mag01[y & 1];
}
y = this.mt[this.N - 1] & this.UPPER_MASK | this.mt[0] & this.LOWER_MASK;
this.mt[this.N - 1] = this.mt[this.M - 1] ^ y >>> 1 ^ mag01[y & 1];
this.mti = 0;
}
y = this.mt[this.mti++];
y ^= y >>> 11;
y ^= y << 7 & 2636928640;
y ^= y << 15 & 4022730752;
y ^= y >>> 18;
return y >>> 0;
};
MersenneTwister2.prototype.random_int31 = function() {
return this.random_int() >>> 1;
};
MersenneTwister2.prototype.random_incl = function() {
return this.random_int() * (1 / 4294967295);
};
MersenneTwister2.prototype.random = function() {
return this.random_int() * (1 / 4294967296);
};
MersenneTwister2.prototype.random_excl = function() {
return (this.random_int() + 0.5) * (1 / 4294967296);
};
MersenneTwister2.prototype.random_long = function() {
var a = this.random_int() >>> 5, b = this.random_int() >>> 6;
return (a * 67108864 + b) * (1 / 9007199254740992);
};
module.exports = MersenneTwister2;
}
});
// packages/engine/Source/Core/Math.js
var import_mersenne_twister = __toESM(require_mersenne_twister(), 1);
var CesiumMath = {};
CesiumMath.EPSILON1 = 0.1;
CesiumMath.EPSILON2 = 0.01;
CesiumMath.EPSILON3 = 1e-3;
CesiumMath.EPSILON4 = 1e-4;
CesiumMath.EPSILON5 = 1e-5;
CesiumMath.EPSILON6 = 1e-6;
CesiumMath.EPSILON7 = 1e-7;
CesiumMath.EPSILON8 = 1e-8;
CesiumMath.EPSILON9 = 1e-9;
CesiumMath.EPSILON10 = 1e-10;
CesiumMath.EPSILON11 = 1e-11;
CesiumMath.EPSILON12 = 1e-12;
CesiumMath.EPSILON13 = 1e-13;
CesiumMath.EPSILON14 = 1e-14;
CesiumMath.EPSILON15 = 1e-15;
CesiumMath.EPSILON16 = 1e-16;
CesiumMath.EPSILON17 = 1e-17;
CesiumMath.EPSILON18 = 1e-18;
CesiumMath.EPSILON19 = 1e-19;
CesiumMath.EPSILON20 = 1e-20;
CesiumMath.EPSILON21 = 1e-21;
CesiumMath.GRAVITATIONALPARAMETER = 3986004418e5;
CesiumMath.SOLAR_RADIUS = 6955e5;
CesiumMath.LUNAR_RADIUS = 1737400;
CesiumMath.SIXTY_FOUR_KILOBYTES = 64 * 1024;
CesiumMath.FOUR_GIGABYTES = 4 * 1024 * 1024 * 1024;
CesiumMath.sign = Math.sign ?? function sign(value) {
value = +value;
if (value === 0 || value !== value) {
return value;
}
return value > 0 ? 1 : -1;
};
CesiumMath.signNotZero = function(value) {
return value < 0 ? -1 : 1;
};
CesiumMath.toSNorm = function(value, rangeMaximum) {
rangeMaximum = rangeMaximum ?? 255;
return Math.round(
(CesiumMath.clamp(value, -1, 1) * 0.5 + 0.5) * rangeMaximum
);
};
CesiumMath.fromSNorm = function(value, rangeMaximum) {
rangeMaximum = rangeMaximum ?? 255;
return CesiumMath.clamp(value, 0, rangeMaximum) / rangeMaximum * 2 - 1;
};
CesiumMath.normalize = function(value, rangeMinimum, rangeMaximum) {
rangeMaximum = Math.max(rangeMaximum - rangeMinimum, 0);
return rangeMaximum === 0 ? 0 : CesiumMath.clamp((value - rangeMinimum) / rangeMaximum, 0, 1);
};
CesiumMath.sinh = Math.sinh ?? function sinh(value) {
return (Math.exp(value) - Math.exp(-value)) / 2;
};
CesiumMath.cosh = Math.cosh ?? function cosh(value) {
return (Math.exp(value) + Math.exp(-value)) / 2;
};
CesiumMath.lerp = function(p, q, time) {
return (1 - time) * p + time * q;
};
CesiumMath.PI = Math.PI;
CesiumMath.ONE_OVER_PI = 1 / Math.PI;
CesiumMath.PI_OVER_TWO = Math.PI / 2;
CesiumMath.PI_OVER_THREE = Math.PI / 3;
CesiumMath.PI_OVER_FOUR = Math.PI / 4;
CesiumMath.PI_OVER_SIX = Math.PI / 6;
CesiumMath.THREE_PI_OVER_TWO = 3 * Math.PI / 2;
CesiumMath.TWO_PI = 2 * Math.PI;
CesiumMath.ONE_OVER_TWO_PI = 1 / (2 * Math.PI);
CesiumMath.RADIANS_PER_DEGREE = Math.PI / 180;
CesiumMath.DEGREES_PER_RADIAN = 180 / Math.PI;
CesiumMath.RADIANS_PER_ARCSECOND = CesiumMath.RADIANS_PER_DEGREE / 3600;
CesiumMath.toRadians = function(degrees) {
if (!defined_default(degrees)) {
throw new DeveloperError_default("degrees is required.");
}
return degrees * CesiumMath.RADIANS_PER_DEGREE;
};
CesiumMath.toDegrees = function(radians) {
if (!defined_default(radians)) {
throw new DeveloperError_default("radians is required.");
}
return radians * CesiumMath.DEGREES_PER_RADIAN;
};
CesiumMath.convertLongitudeRange = function(angle) {
if (!defined_default(angle)) {
throw new DeveloperError_default("angle is required.");
}
const twoPi = CesiumMath.TWO_PI;
const simplified = angle - Math.floor(angle / twoPi) * twoPi;
if (simplified < -Math.PI) {
return simplified + twoPi;
}
if (simplified >= Math.PI) {
return simplified - twoPi;
}
return simplified;
};
CesiumMath.clampToLatitudeRange = function(angle) {
if (!defined_default(angle)) {
throw new DeveloperError_default("angle is required.");
}
return CesiumMath.clamp(
angle,
-1 * CesiumMath.PI_OVER_TWO,
CesiumMath.PI_OVER_TWO
);
};
CesiumMath.negativePiToPi = function(angle) {
if (!defined_default(angle)) {
throw new DeveloperError_default("angle is required.");
}
if (angle >= -CesiumMath.PI && angle <= CesiumMath.PI) {
return angle;
}
return CesiumMath.zeroToTwoPi(angle + CesiumMath.PI) - CesiumMath.PI;
};
CesiumMath.zeroToTwoPi = function(angle) {
if (!defined_default(angle)) {
throw new DeveloperError_default("angle is required.");
}
if (angle >= 0 && angle <= CesiumMath.TWO_PI) {
return angle;
}
const mod = CesiumMath.mod(angle, CesiumMath.TWO_PI);
if (Math.abs(mod) < CesiumMath.EPSILON14 && Math.abs(angle) > CesiumMath.EPSILON14) {
return CesiumMath.TWO_PI;
}
return mod;
};
CesiumMath.mod = function(m, n) {
if (!defined_default(m)) {
throw new DeveloperError_default("m is required.");
}
if (!defined_default(n)) {
throw new DeveloperError_default("n is required.");
}
if (n === 0) {
throw new DeveloperError_default("divisor cannot be 0.");
}
if (CesiumMath.sign(m) === CesiumMath.sign(n) && Math.abs(m) < Math.abs(n)) {
return m;
}
return (m % n + n) % n;
};
CesiumMath.equalsEpsilon = function(left, right, relativeEpsilon, absoluteEpsilon) {
if (!defined_default(left)) {
throw new DeveloperError_default("left is required.");
}
if (!defined_default(right)) {
throw new DeveloperError_default("right is required.");
}
relativeEpsilon = relativeEpsilon ?? 0;
absoluteEpsilon = absoluteEpsilon ?? relativeEpsilon;
const absDiff = Math.abs(left - right);
return absDiff <= absoluteEpsilon || absDiff <= relativeEpsilon * Math.max(Math.abs(left), Math.abs(right));
};
CesiumMath.lessThan = function(left, right, absoluteEpsilon) {
if (!defined_default(left)) {
throw new DeveloperError_default("first is required.");
}
if (!defined_default(right)) {
throw new DeveloperError_default("second is required.");
}
if (!defined_default(absoluteEpsilon)) {
throw new DeveloperError_default("absoluteEpsilon is required.");
}
return left - right < -absoluteEpsilon;
};
CesiumMath.lessThanOrEquals = function(left, right, absoluteEpsilon) {
if (!defined_default(left)) {
throw new DeveloperError_default("first is required.");
}
if (!defined_default(right)) {
throw new DeveloperError_default("second is required.");
}
if (!defined_default(absoluteEpsilon)) {
throw new DeveloperError_default("absoluteEpsilon is required.");
}
return left - right < absoluteEpsilon;
};
CesiumMath.greaterThan = function(left, right, absoluteEpsilon) {
if (!defined_default(left)) {
throw new DeveloperError_default("first is required.");
}
if (!defined_default(right)) {
throw new DeveloperError_default("second is required.");
}
if (!defined_default(absoluteEpsilon)) {
throw new DeveloperError_default("absoluteEpsilon is required.");
}
return left - right > absoluteEpsilon;
};
CesiumMath.greaterThanOrEquals = function(left, right, absoluteEpsilon) {
if (!defined_default(left)) {
throw new DeveloperError_default("first is required.");
}
if (!defined_default(right)) {
throw new DeveloperError_default("second is required.");
}
if (!defined_default(absoluteEpsilon)) {
throw new DeveloperError_default("absoluteEpsilon is required.");
}
return left - right > -absoluteEpsilon;
};
var factorials = [1];
CesiumMath.factorial = function(n) {
if (typeof n !== "number" || n < 0) {
throw new DeveloperError_default(
"A number greater than or equal to 0 is required."
);
}
const length = factorials.length;
if (n >= length) {
let sum = factorials[length - 1];
for (let i = length; i <= n; i++) {
const next = sum * i;
factorials.push(next);
sum = next;
}
}
return factorials[n];
};
CesiumMath.incrementWrap = function(n, maximumValue, minimumValue) {
minimumValue = minimumValue ?? 0;
if (!defined_default(n)) {
throw new DeveloperError_default("n is required.");
}
if (maximumValue <= minimumValue) {
throw new DeveloperError_default("maximumValue must be greater than minimumValue.");
}
++n;
if (n > maximumValue) {
n = minimumValue;
}
return n;
};
CesiumMath.isPowerOfTwo = function(n) {
if (typeof n !== "number" || n < 0 || n > 4294967295) {
throw new DeveloperError_default("A number between 0 and (2^32)-1 is required.");
}
return n !== 0 && (n & n - 1) === 0;
};
CesiumMath.nextPowerOfTwo = function(n) {
if (typeof n !== "number" || n < 0 || n > 2147483648) {
throw new DeveloperError_default("A number between 0 and 2^31 is required.");
}
--n;
n |= n >> 1;
n |= n >> 2;
n |= n >> 4;
n |= n >> 8;
n |= n >> 16;
++n;
return n;
};
CesiumMath.previousPowerOfTwo = function(n) {
if (typeof n !== "number" || n < 0 || n > 4294967295) {
throw new DeveloperError_default("A number between 0 and (2^32)-1 is required.");
}
n |= n >> 1;
n |= n >> 2;
n |= n >> 4;
n |= n >> 8;
n |= n >> 16;
n |= n >> 32;
n = (n >>> 0) - (n >>> 1);
return n;
};
CesiumMath.clamp = function(value, min, max) {
Check_default.typeOf.number("value", value);
Check_default.typeOf.number("min", min);
Check_default.typeOf.number("max", max);
return value < min ? min : value > max ? max : value;
};
var randomNumberGenerator = new import_mersenne_twister.default();
CesiumMath.setRandomNumberSeed = function(seed) {
if (!defined_default(seed)) {
throw new DeveloperError_default("seed is required.");
}
randomNumberGenerator = new import_mersenne_twister.default(seed);
};
CesiumMath.nextRandomNumber = function() {
return randomNumberGenerator.random();
};
CesiumMath.randomBetween = function(min, max) {
return CesiumMath.nextRandomNumber() * (max - min) + min;
};
CesiumMath.acosClamped = function(value) {
if (!defined_default(value)) {
throw new DeveloperError_default("value is required.");
}
return Math.acos(CesiumMath.clamp(value, -1, 1));
};
CesiumMath.asinClamped = function(value) {
if (!defined_default(value)) {
throw new DeveloperError_default("value is required.");
}
return Math.asin(CesiumMath.clamp(value, -1, 1));
};
CesiumMath.chordLength = function(angle, radius) {
if (!defined_default(angle)) {
throw new DeveloperError_default("angle is required.");
}
if (!defined_default(radius)) {
throw new DeveloperError_default("radius is required.");
}
return 2 * radius * Math.sin(angle * 0.5);
};
CesiumMath.logBase = function(number, base) {
if (!defined_default(number)) {
throw new DeveloperError_default("number is required.");
}
if (!defined_default(base)) {
throw new DeveloperError_default("base is required.");
}
return Math.log(number) / Math.log(base);
};
CesiumMath.cbrt = Math.cbrt ?? function cbrt(number) {
const result = Math.pow(Math.abs(number), 1 / 3);
return number < 0 ? -result : result;
};
CesiumMath.log2 = Math.log2 ?? function log2(number) {
return Math.log(number) * Math.LOG2E;
};
CesiumMath.fog = function(distanceToCamera, density) {
const scalar = distanceToCamera * density;
return 1 - Math.exp(-(scalar * scalar));
};
CesiumMath.fastApproximateAtan = function(x) {
Check_default.typeOf.number("x", x);
return x * (-0.1784 * Math.abs(x) - 0.0663 * x * x + 1.0301);
};
CesiumMath.fastApproximateAtan2 = function(x, y) {
Check_default.typeOf.number("x", x);
Check_default.typeOf.number("y", y);
let opposite;
let t = Math.abs(x);
opposite = Math.abs(y);
const adjacent = Math.max(t, opposite);
opposite = Math.min(t, opposite);
const oppositeOverAdjacent = opposite / adjacent;
if (isNaN(oppositeOverAdjacent)) {
throw new DeveloperError_default("either x or y must be nonzero");
}
t = CesiumMath.fastApproximateAtan(oppositeOverAdjacent);
t = Math.abs(y) > Math.abs(x) ? CesiumMath.PI_OVER_TWO - t : t;
t = x < 0 ? CesiumMath.PI - t : t;
t = y < 0 ? -t : t;
return t;
};
var Math_default = CesiumMath;
export {
Math_default
};
+219
View File
@@ -0,0 +1,219 @@
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.142.0
*
* 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 {
GeographicProjection_default
} from "./chunk-XZMBNNDX.js";
import {
Intersect_default
} from "./chunk-C6J67V5A.js";
import {
Rectangle_default
} from "./chunk-MYP774IS.js";
import {
Cartesian2_default,
Cartographic_default,
Ellipsoid_default
} from "./chunk-V7VQKN6N.js";
import {
Check_default
} from "./chunk-AYKR4VBR.js";
import {
defined_default
} from "./chunk-ZP7JMQV4.js";
// packages/engine/Source/Core/BoundingRectangle.js
function BoundingRectangle(x, y, width, height) {
this.x = x ?? 0;
this.y = y ?? 0;
this.width = width ?? 0;
this.height = height ?? 0;
}
BoundingRectangle.packedLength = 4;
BoundingRectangle.pack = function(value, array, startingIndex) {
Check_default.typeOf.object("value", value);
Check_default.defined("array", array);
startingIndex = startingIndex ?? 0;
array[startingIndex++] = value.x;
array[startingIndex++] = value.y;
array[startingIndex++] = value.width;
array[startingIndex] = value.height;
return array;
};
BoundingRectangle.unpack = function(array, startingIndex, result) {
Check_default.defined("array", array);
startingIndex = startingIndex ?? 0;
if (!defined_default(result)) {
result = new BoundingRectangle();
}
result.x = array[startingIndex++];
result.y = array[startingIndex++];
result.width = array[startingIndex++];
result.height = array[startingIndex];
return result;
};
BoundingRectangle.fromPoints = function(positions, result) {
if (!defined_default(result)) {
result = new BoundingRectangle();
}
if (!defined_default(positions) || positions.length === 0) {
result.x = 0;
result.y = 0;
result.width = 0;
result.height = 0;
return result;
}
const length = positions.length;
let minimumX = positions[0].x;
let minimumY = positions[0].y;
let maximumX = positions[0].x;
let maximumY = positions[0].y;
for (let i = 1; i < length; i++) {
const p = positions[i];
const x = p.x;
const y = p.y;
minimumX = Math.min(x, minimumX);
maximumX = Math.max(x, maximumX);
minimumY = Math.min(y, minimumY);
maximumY = Math.max(y, maximumY);
}
result.x = minimumX;
result.y = minimumY;
result.width = maximumX - minimumX;
result.height = maximumY - minimumY;
return result;
};
var defaultProjection = new GeographicProjection_default();
var fromRectangleLowerLeft = new Cartographic_default();
var fromRectangleUpperRight = new Cartographic_default();
BoundingRectangle.fromRectangle = function(rectangle, projection, result) {
if (!defined_default(result)) {
result = new BoundingRectangle();
}
if (!defined_default(rectangle)) {
result.x = 0;
result.y = 0;
result.width = 0;
result.height = 0;
return result;
}
defaultProjection._ellipsoid = Ellipsoid_default.default;
projection = projection ?? defaultProjection;
const lowerLeft = projection.project(
Rectangle_default.southwest(rectangle, fromRectangleLowerLeft)
);
const upperRight = projection.project(
Rectangle_default.northeast(rectangle, fromRectangleUpperRight)
);
Cartesian2_default.subtract(upperRight, lowerLeft, upperRight);
result.x = lowerLeft.x;
result.y = lowerLeft.y;
result.width = upperRight.x;
result.height = upperRight.y;
return result;
};
BoundingRectangle.clone = function(rectangle, result) {
if (!defined_default(rectangle)) {
return void 0;
}
if (!defined_default(result)) {
return new BoundingRectangle(
rectangle.x,
rectangle.y,
rectangle.width,
rectangle.height
);
}
result.x = rectangle.x;
result.y = rectangle.y;
result.width = rectangle.width;
result.height = rectangle.height;
return result;
};
BoundingRectangle.union = function(left, right, result) {
Check_default.typeOf.object("left", left);
Check_default.typeOf.object("right", right);
if (!defined_default(result)) {
result = new BoundingRectangle();
}
const lowerLeftX = Math.min(left.x, right.x);
const lowerLeftY = Math.min(left.y, right.y);
const upperRightX = Math.max(left.x + left.width, right.x + right.width);
const upperRightY = Math.max(left.y + left.height, right.y + right.height);
result.x = lowerLeftX;
result.y = lowerLeftY;
result.width = upperRightX - lowerLeftX;
result.height = upperRightY - lowerLeftY;
return result;
};
BoundingRectangle.expand = function(rectangle, point, result) {
Check_default.typeOf.object("rectangle", rectangle);
Check_default.typeOf.object("point", point);
result = BoundingRectangle.clone(rectangle, result);
const width = point.x - result.x;
const height = point.y - result.y;
if (width > result.width) {
result.width = width;
} else if (width < 0) {
result.width -= width;
result.x = point.x;
}
if (height > result.height) {
result.height = height;
} else if (height < 0) {
result.height -= height;
result.y = point.y;
}
return result;
};
BoundingRectangle.intersect = function(left, right) {
Check_default.typeOf.object("left", left);
Check_default.typeOf.object("right", right);
const leftX = left.x;
const leftY = left.y;
const rightX = right.x;
const rightY = right.y;
if (!(leftX > rightX + right.width || leftX + left.width < rightX || leftY + left.height < rightY || leftY > rightY + right.height)) {
return Intersect_default.INTERSECTING;
}
return Intersect_default.OUTSIDE;
};
BoundingRectangle.equals = function(left, right) {
return left === right || defined_default(left) && defined_default(right) && left.x === right.x && left.y === right.y && left.width === right.width && left.height === right.height;
};
BoundingRectangle.prototype.clone = function(result) {
return BoundingRectangle.clone(this, result);
};
BoundingRectangle.prototype.intersect = function(right) {
return BoundingRectangle.intersect(this, right);
};
BoundingRectangle.prototype.equals = function(right) {
return BoundingRectangle.equals(this, right);
};
var BoundingRectangle_default = BoundingRectangle;
export {
BoundingRectangle_default
};
File diff suppressed because it is too large Load Diff
+44
View File
@@ -0,0 +1,44 @@
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.142.0
*
* 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 {
Frozen_default
} from "./chunk-MPZHGZU6.js";
// packages/engine/Source/Core/GeometryAttributes.js
function GeometryAttributes(options) {
options = options ?? Frozen_default.EMPTY_OBJECT;
this.position = options.position;
this.normal = options.normal;
this.st = options.st;
this.bitangent = options.bitangent;
this.tangent = options.tangent;
this.color = options.color;
}
var GeometryAttributes_default = GeometryAttributes;
export {
GeometryAttributes_default
};
+56
View File
@@ -0,0 +1,56 @@
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.142.0
*
* 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.
*/
// packages/engine/Source/Core/ArcType.js
var ArcType = {
/**
* Straight line that does not conform to the surface of the ellipsoid.
*
* @type {number}
* @constant
*/
NONE: 0,
/**
* Follow geodesic path.
*
* @type {number}
* @constant
*/
GEODESIC: 1,
/**
* Follow rhumb or loxodrome path.
*
* @type {number}
* @constant
*/
RHUMB: 2
};
Object.freeze(ArcType);
var ArcType_default = ArcType;
export {
ArcType_default
};
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+959
View File
@@ -0,0 +1,959 @@
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.142.0
*
* 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 {
EllipsoidRhumbLine_default
} from "./chunk-54I6Y66F.js";
import {
GeometryAttribute_default,
Geometry_default,
PrimitiveType_default
} from "./chunk-EBSIOBXY.js";
import {
ComponentDatatype_default
} from "./chunk-P3CK7MCY.js";
import {
WebGLConstants_default
} from "./chunk-TKKIREQ6.js";
import {
Cartesian2_default,
Cartographic_default,
Ellipsoid_default
} from "./chunk-V7VQKN6N.js";
import {
Cartesian3_default
} from "./chunk-MPZHGZU6.js";
import {
Math_default
} from "./chunk-J6BWOHUF.js";
import {
Check_default
} from "./chunk-AYKR4VBR.js";
import {
defined_default
} from "./chunk-ZP7JMQV4.js";
// packages/engine/Source/Core/WindingOrder.js
var WindingOrder = {
/**
* Vertices are in clockwise order.
*
* @type {number}
* @constant
*/
CLOCKWISE: WebGLConstants_default.CW,
/**
* Vertices are in counter-clockwise order.
*
* @type {number}
* @constant
*/
COUNTER_CLOCKWISE: WebGLConstants_default.CCW
};
WindingOrder.validate = function(windingOrder) {
return windingOrder === WindingOrder.CLOCKWISE || windingOrder === WindingOrder.COUNTER_CLOCKWISE;
};
Object.freeze(WindingOrder);
var WindingOrder_default = WindingOrder;
// node_modules/earcut/src/earcut.js
function earcut(data, holeIndices, dim = 2) {
const hasHoles = holeIndices && holeIndices.length;
const outerLen = hasHoles ? holeIndices[0] * dim : data.length;
let outerNode = linkedList(data, 0, outerLen, dim, true);
const triangles = [];
if (!outerNode || outerNode.next === outerNode.prev) return triangles;
let minX, minY, invSize;
if (hasHoles) outerNode = eliminateHoles(data, holeIndices, outerNode, dim);
if (data.length > 80 * dim) {
minX = data[0];
minY = data[1];
let maxX = minX;
let maxY = minY;
for (let i = dim; i < outerLen; i += dim) {
const x = data[i];
const y = data[i + 1];
if (x < minX) minX = x;
if (y < minY) minY = y;
if (x > maxX) maxX = x;
if (y > maxY) maxY = y;
}
invSize = Math.max(maxX - minX, maxY - minY);
invSize = invSize !== 0 ? 32767 / invSize : 0;
}
earcutLinked(outerNode, triangles, dim, minX, minY, invSize, 0);
return triangles;
}
function linkedList(data, start, end, dim, clockwise) {
let last;
if (clockwise === signedArea(data, start, end, dim) > 0) {
for (let i = start; i < end; i += dim) last = insertNode(i / dim | 0, data[i], data[i + 1], last);
} else {
for (let i = end - dim; i >= start; i -= dim) last = insertNode(i / dim | 0, data[i], data[i + 1], last);
}
if (last && equals(last, last.next)) {
removeNode(last);
last = last.next;
}
return last;
}
function filterPoints(start, end) {
if (!start) return start;
if (!end) end = start;
let p = start, again;
do {
again = false;
if (!p.steiner && (equals(p, p.next) || area(p.prev, p, p.next) === 0)) {
removeNode(p);
p = end = p.prev;
if (p === p.next) break;
again = true;
} else {
p = p.next;
}
} while (again || p !== end);
return end;
}
function earcutLinked(ear, triangles, dim, minX, minY, invSize, pass) {
if (!ear) return;
if (!pass && invSize) indexCurve(ear, minX, minY, invSize);
let stop = ear;
while (ear.prev !== ear.next) {
const prev = ear.prev;
const next = ear.next;
if (invSize ? isEarHashed(ear, minX, minY, invSize) : isEar(ear)) {
triangles.push(prev.i, ear.i, next.i);
removeNode(ear);
ear = next.next;
stop = next.next;
continue;
}
ear = next;
if (ear === stop) {
if (!pass) {
earcutLinked(filterPoints(ear), triangles, dim, minX, minY, invSize, 1);
} else if (pass === 1) {
ear = cureLocalIntersections(filterPoints(ear), triangles);
earcutLinked(ear, triangles, dim, minX, minY, invSize, 2);
} else if (pass === 2) {
splitEarcut(ear, triangles, dim, minX, minY, invSize);
}
break;
}
}
}
function isEar(ear) {
const a = ear.prev, b = ear, c = ear.next;
if (area(a, b, c) >= 0) return false;
const ax = a.x, bx = b.x, cx = c.x, ay = a.y, by = b.y, cy = c.y;
const x0 = Math.min(ax, bx, cx), y0 = Math.min(ay, by, cy), x1 = Math.max(ax, bx, cx), y1 = Math.max(ay, by, cy);
let p = c.next;
while (p !== a) {
if (p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 && pointInTriangleExceptFirst(ax, ay, bx, by, cx, cy, p.x, p.y) && area(p.prev, p, p.next) >= 0) return false;
p = p.next;
}
return true;
}
function isEarHashed(ear, minX, minY, invSize) {
const a = ear.prev, b = ear, c = ear.next;
if (area(a, b, c) >= 0) return false;
const ax = a.x, bx = b.x, cx = c.x, ay = a.y, by = b.y, cy = c.y;
const x0 = Math.min(ax, bx, cx), y0 = Math.min(ay, by, cy), x1 = Math.max(ax, bx, cx), y1 = Math.max(ay, by, cy);
const minZ = zOrder(x0, y0, minX, minY, invSize), maxZ = zOrder(x1, y1, minX, minY, invSize);
let p = ear.prevZ, n = ear.nextZ;
while (p && p.z >= minZ && n && n.z <= maxZ) {
if (p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 && p !== a && p !== c && pointInTriangleExceptFirst(ax, ay, bx, by, cx, cy, p.x, p.y) && area(p.prev, p, p.next) >= 0) return false;
p = p.prevZ;
if (n.x >= x0 && n.x <= x1 && n.y >= y0 && n.y <= y1 && n !== a && n !== c && pointInTriangleExceptFirst(ax, ay, bx, by, cx, cy, n.x, n.y) && area(n.prev, n, n.next) >= 0) return false;
n = n.nextZ;
}
while (p && p.z >= minZ) {
if (p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 && p !== a && p !== c && pointInTriangleExceptFirst(ax, ay, bx, by, cx, cy, p.x, p.y) && area(p.prev, p, p.next) >= 0) return false;
p = p.prevZ;
}
while (n && n.z <= maxZ) {
if (n.x >= x0 && n.x <= x1 && n.y >= y0 && n.y <= y1 && n !== a && n !== c && pointInTriangleExceptFirst(ax, ay, bx, by, cx, cy, n.x, n.y) && area(n.prev, n, n.next) >= 0) return false;
n = n.nextZ;
}
return true;
}
function cureLocalIntersections(start, triangles) {
let p = start;
do {
const a = p.prev, b = p.next.next;
if (!equals(a, b) && intersects(a, p, p.next, b) && locallyInside(a, b) && locallyInside(b, a)) {
triangles.push(a.i, p.i, b.i);
removeNode(p);
removeNode(p.next);
p = start = b;
}
p = p.next;
} while (p !== start);
return filterPoints(p);
}
function splitEarcut(start, triangles, dim, minX, minY, invSize) {
let a = start;
do {
let b = a.next.next;
while (b !== a.prev) {
if (a.i !== b.i && isValidDiagonal(a, b)) {
let c = splitPolygon(a, b);
a = filterPoints(a, a.next);
c = filterPoints(c, c.next);
earcutLinked(a, triangles, dim, minX, minY, invSize, 0);
earcutLinked(c, triangles, dim, minX, minY, invSize, 0);
return;
}
b = b.next;
}
a = a.next;
} while (a !== start);
}
function eliminateHoles(data, holeIndices, outerNode, dim) {
const queue = [];
for (let i = 0, len = holeIndices.length; i < len; i++) {
const start = holeIndices[i] * dim;
const end = i < len - 1 ? holeIndices[i + 1] * dim : data.length;
const list = linkedList(data, start, end, dim, false);
if (list === list.next) list.steiner = true;
queue.push(getLeftmost(list));
}
queue.sort(compareXYSlope);
for (let i = 0; i < queue.length; i++) {
outerNode = eliminateHole(queue[i], outerNode);
}
return outerNode;
}
function compareXYSlope(a, b) {
let result = a.x - b.x;
if (result === 0) {
result = a.y - b.y;
if (result === 0) {
const aSlope = (a.next.y - a.y) / (a.next.x - a.x);
const bSlope = (b.next.y - b.y) / (b.next.x - b.x);
result = aSlope - bSlope;
}
}
return result;
}
function eliminateHole(hole, outerNode) {
const bridge = findHoleBridge(hole, outerNode);
if (!bridge) {
return outerNode;
}
const bridgeReverse = splitPolygon(bridge, hole);
filterPoints(bridgeReverse, bridgeReverse.next);
return filterPoints(bridge, bridge.next);
}
function findHoleBridge(hole, outerNode) {
let p = outerNode;
const hx = hole.x;
const hy = hole.y;
let qx = -Infinity;
let m;
if (equals(hole, p)) return p;
do {
if (equals(hole, p.next)) return p.next;
else if (hy <= p.y && hy >= p.next.y && p.next.y !== p.y) {
const x = p.x + (hy - p.y) * (p.next.x - p.x) / (p.next.y - p.y);
if (x <= hx && x > qx) {
qx = x;
m = p.x < p.next.x ? p : p.next;
if (x === hx) return m;
}
}
p = p.next;
} while (p !== outerNode);
if (!m) return null;
const stop = m;
const mx = m.x;
const my = m.y;
let tanMin = Infinity;
p = m;
do {
if (hx >= p.x && p.x >= mx && hx !== p.x && pointInTriangle(hy < my ? hx : qx, hy, mx, my, hy < my ? qx : hx, hy, p.x, p.y)) {
const tan = Math.abs(hy - p.y) / (hx - p.x);
if (locallyInside(p, hole) && (tan < tanMin || tan === tanMin && (p.x > m.x || p.x === m.x && sectorContainsSector(m, p)))) {
m = p;
tanMin = tan;
}
}
p = p.next;
} while (p !== stop);
return m;
}
function sectorContainsSector(m, p) {
return area(m.prev, m, p.prev) < 0 && area(p.next, m, m.next) < 0;
}
function indexCurve(start, minX, minY, invSize) {
let p = start;
do {
if (p.z === 0) p.z = zOrder(p.x, p.y, minX, minY, invSize);
p.prevZ = p.prev;
p.nextZ = p.next;
p = p.next;
} while (p !== start);
p.prevZ.nextZ = null;
p.prevZ = null;
sortLinked(p);
}
function sortLinked(list) {
let numMerges;
let inSize = 1;
do {
let p = list;
let e;
list = null;
let tail = null;
numMerges = 0;
while (p) {
numMerges++;
let q = p;
let pSize = 0;
for (let i = 0; i < inSize; i++) {
pSize++;
q = q.nextZ;
if (!q) break;
}
let qSize = inSize;
while (pSize > 0 || qSize > 0 && q) {
if (pSize !== 0 && (qSize === 0 || !q || p.z <= q.z)) {
e = p;
p = p.nextZ;
pSize--;
} else {
e = q;
q = q.nextZ;
qSize--;
}
if (tail) tail.nextZ = e;
else list = e;
e.prevZ = tail;
tail = e;
}
p = q;
}
tail.nextZ = null;
inSize *= 2;
} while (numMerges > 1);
return list;
}
function zOrder(x, y, minX, minY, invSize) {
x = (x - minX) * invSize | 0;
y = (y - minY) * invSize | 0;
x = (x | x << 8) & 16711935;
x = (x | x << 4) & 252645135;
x = (x | x << 2) & 858993459;
x = (x | x << 1) & 1431655765;
y = (y | y << 8) & 16711935;
y = (y | y << 4) & 252645135;
y = (y | y << 2) & 858993459;
y = (y | y << 1) & 1431655765;
return x | y << 1;
}
function getLeftmost(start) {
let p = start, leftmost = start;
do {
if (p.x < leftmost.x || p.x === leftmost.x && p.y < leftmost.y) leftmost = p;
p = p.next;
} while (p !== start);
return leftmost;
}
function pointInTriangle(ax, ay, bx, by, cx, cy, px, py) {
return (cx - px) * (ay - py) >= (ax - px) * (cy - py) && (ax - px) * (by - py) >= (bx - px) * (ay - py) && (bx - px) * (cy - py) >= (cx - px) * (by - py);
}
function pointInTriangleExceptFirst(ax, ay, bx, by, cx, cy, px, py) {
return !(ax === px && ay === py) && pointInTriangle(ax, ay, bx, by, cx, cy, px, py);
}
function isValidDiagonal(a, b) {
return a.next.i !== b.i && a.prev.i !== b.i && !intersectsPolygon(a, b) && // doesn't intersect other edges
(locallyInside(a, b) && locallyInside(b, a) && middleInside(a, b) && // locally visible
(area(a.prev, a, b.prev) || area(a, b.prev, b)) || // does not create opposite-facing sectors
equals(a, b) && area(a.prev, a, a.next) > 0 && area(b.prev, b, b.next) > 0);
}
function area(p, q, r) {
return (q.y - p.y) * (r.x - q.x) - (q.x - p.x) * (r.y - q.y);
}
function equals(p1, p2) {
return p1.x === p2.x && p1.y === p2.y;
}
function intersects(p1, q1, p2, q2) {
const o1 = sign(area(p1, q1, p2));
const o2 = sign(area(p1, q1, q2));
const o3 = sign(area(p2, q2, p1));
const o4 = sign(area(p2, q2, q1));
if (o1 !== o2 && o3 !== o4) return true;
if (o1 === 0 && onSegment(p1, p2, q1)) return true;
if (o2 === 0 && onSegment(p1, q2, q1)) return true;
if (o3 === 0 && onSegment(p2, p1, q2)) return true;
if (o4 === 0 && onSegment(p2, q1, q2)) return true;
return false;
}
function onSegment(p, q, r) {
return q.x <= Math.max(p.x, r.x) && q.x >= Math.min(p.x, r.x) && q.y <= Math.max(p.y, r.y) && q.y >= Math.min(p.y, r.y);
}
function sign(num) {
return num > 0 ? 1 : num < 0 ? -1 : 0;
}
function intersectsPolygon(a, b) {
let p = a;
do {
if (p.i !== a.i && p.next.i !== a.i && p.i !== b.i && p.next.i !== b.i && intersects(p, p.next, a, b)) return true;
p = p.next;
} while (p !== a);
return false;
}
function locallyInside(a, b) {
return area(a.prev, a, a.next) < 0 ? area(a, b, a.next) >= 0 && area(a, a.prev, b) >= 0 : area(a, b, a.prev) < 0 || area(a, a.next, b) < 0;
}
function middleInside(a, b) {
let p = a;
let inside = false;
const px = (a.x + b.x) / 2;
const py = (a.y + b.y) / 2;
do {
if (p.y > py !== p.next.y > py && p.next.y !== p.y && px < (p.next.x - p.x) * (py - p.y) / (p.next.y - p.y) + p.x)
inside = !inside;
p = p.next;
} while (p !== a);
return inside;
}
function splitPolygon(a, b) {
const a2 = createNode(a.i, a.x, a.y), b2 = createNode(b.i, b.x, b.y), an = a.next, bp = b.prev;
a.next = b;
b.prev = a;
a2.next = an;
an.prev = a2;
b2.next = a2;
a2.prev = b2;
bp.next = b2;
b2.prev = bp;
return b2;
}
function insertNode(i, x, y, last) {
const p = createNode(i, x, y);
if (!last) {
p.prev = p;
p.next = p;
} else {
p.next = last.next;
p.prev = last;
last.next.prev = p;
last.next = p;
}
return p;
}
function removeNode(p) {
p.next.prev = p.prev;
p.prev.next = p.next;
if (p.prevZ) p.prevZ.nextZ = p.nextZ;
if (p.nextZ) p.nextZ.prevZ = p.prevZ;
}
function createNode(i, x, y) {
return {
i,
// vertex index in coordinates array
x,
y,
// vertex coordinates
prev: null,
// previous and next vertex nodes in a polygon ring
next: null,
z: 0,
// z-order curve value
prevZ: null,
// previous and next nodes in z-order
nextZ: null,
steiner: false
// indicates whether this is a steiner point
};
}
function signedArea(data, start, end, dim) {
let sum = 0;
for (let i = start, j = end - dim; i < end; i += dim) {
sum += (data[j] - data[i]) * (data[i + 1] + data[j + 1]);
j = i;
}
return sum;
}
// packages/engine/Source/Core/PolygonPipeline.js
var scaleToGeodeticHeightN = new Cartesian3_default();
var scaleToGeodeticHeightP = new Cartesian3_default();
var PolygonPipeline = {};
PolygonPipeline.computeArea2D = function(positions) {
Check_default.defined("positions", positions);
Check_default.typeOf.number.greaterThanOrEquals(
"positions.length",
positions.length,
3
);
const length = positions.length;
let area2 = 0;
for (let i0 = length - 1, i1 = 0; i1 < length; i0 = i1++) {
const v0 = positions[i0];
const v1 = positions[i1];
area2 += v0.x * v1.y - v1.x * v0.y;
}
return area2 * 0.5;
};
PolygonPipeline.computeWindingOrder2D = function(positions) {
const area2 = PolygonPipeline.computeArea2D(positions);
return area2 > 0 ? WindingOrder_default.COUNTER_CLOCKWISE : WindingOrder_default.CLOCKWISE;
};
PolygonPipeline.triangulate = function(positions, holes) {
Check_default.defined("positions", positions);
const flattenedPositions = Cartesian2_default.packArray(positions);
return earcut(flattenedPositions, holes, 2);
};
var subdivisionV0Scratch = new Cartesian3_default();
var subdivisionV1Scratch = new Cartesian3_default();
var subdivisionV2Scratch = new Cartesian3_default();
var subdivisionS0Scratch = new Cartesian3_default();
var subdivisionS1Scratch = new Cartesian3_default();
var subdivisionS2Scratch = new Cartesian3_default();
var subdivisionMidScratch = new Cartesian3_default();
var subdivisionT0Scratch = new Cartesian2_default();
var subdivisionT1Scratch = new Cartesian2_default();
var subdivisionT2Scratch = new Cartesian2_default();
var subdivisionTexcoordMidScratch = new Cartesian2_default();
PolygonPipeline.computeSubdivision = function(ellipsoid, positions, indices, texcoords, granularity) {
granularity = granularity ?? Math_default.RADIANS_PER_DEGREE;
const hasTexcoords = defined_default(texcoords);
Check_default.typeOf.object("ellipsoid", ellipsoid);
Check_default.defined("positions", positions);
Check_default.defined("indices", indices);
Check_default.typeOf.number.greaterThanOrEquals("indices.length", indices.length, 3);
Check_default.typeOf.number.equals("indices.length % 3", "0", indices.length % 3, 0);
Check_default.typeOf.number.greaterThan("granularity", granularity, 0);
const triangles = indices.slice(0);
let i;
const length = positions.length;
const subdividedPositions = new Array(length * 3);
const subdividedTexcoords = new Array(length * 2);
let q = 0;
let p = 0;
for (i = 0; i < length; i++) {
const item = positions[i];
subdividedPositions[q++] = item.x;
subdividedPositions[q++] = item.y;
subdividedPositions[q++] = item.z;
if (hasTexcoords) {
const texcoordItem = texcoords[i];
subdividedTexcoords[p++] = texcoordItem.x;
subdividedTexcoords[p++] = texcoordItem.y;
}
}
const subdividedIndices = [];
const edges = {};
const radius = ellipsoid.maximumRadius;
const minDistance = Math_default.chordLength(granularity, radius);
const minDistanceSqrd = minDistance * minDistance;
while (triangles.length > 0) {
const i2 = triangles.pop();
const i1 = triangles.pop();
const i0 = triangles.pop();
const v0 = Cartesian3_default.fromArray(
subdividedPositions,
i0 * 3,
subdivisionV0Scratch
);
const v1 = Cartesian3_default.fromArray(
subdividedPositions,
i1 * 3,
subdivisionV1Scratch
);
const v2 = Cartesian3_default.fromArray(
subdividedPositions,
i2 * 3,
subdivisionV2Scratch
);
let t0, t1, t2;
if (hasTexcoords) {
t0 = Cartesian2_default.fromArray(
subdividedTexcoords,
i0 * 2,
subdivisionT0Scratch
);
t1 = Cartesian2_default.fromArray(
subdividedTexcoords,
i1 * 2,
subdivisionT1Scratch
);
t2 = Cartesian2_default.fromArray(
subdividedTexcoords,
i2 * 2,
subdivisionT2Scratch
);
}
const s0 = Cartesian3_default.multiplyByScalar(
Cartesian3_default.normalize(v0, subdivisionS0Scratch),
radius,
subdivisionS0Scratch
);
const s1 = Cartesian3_default.multiplyByScalar(
Cartesian3_default.normalize(v1, subdivisionS1Scratch),
radius,
subdivisionS1Scratch
);
const s2 = Cartesian3_default.multiplyByScalar(
Cartesian3_default.normalize(v2, subdivisionS2Scratch),
radius,
subdivisionS2Scratch
);
const g0 = Cartesian3_default.magnitudeSquared(
Cartesian3_default.subtract(s0, s1, subdivisionMidScratch)
);
const g1 = Cartesian3_default.magnitudeSquared(
Cartesian3_default.subtract(s1, s2, subdivisionMidScratch)
);
const g2 = Cartesian3_default.magnitudeSquared(
Cartesian3_default.subtract(s2, s0, subdivisionMidScratch)
);
const max = Math.max(g0, g1, g2);
let edge;
let mid;
let midTexcoord;
if (max > minDistanceSqrd) {
if (g0 === max) {
edge = `${Math.min(i0, i1)} ${Math.max(i0, i1)}`;
i = edges[edge];
if (!defined_default(i)) {
mid = Cartesian3_default.add(v0, v1, subdivisionMidScratch);
Cartesian3_default.multiplyByScalar(mid, 0.5, mid);
subdividedPositions.push(mid.x, mid.y, mid.z);
i = subdividedPositions.length / 3 - 1;
edges[edge] = i;
if (hasTexcoords) {
midTexcoord = Cartesian2_default.add(t0, t1, subdivisionTexcoordMidScratch);
Cartesian2_default.multiplyByScalar(midTexcoord, 0.5, midTexcoord);
subdividedTexcoords.push(midTexcoord.x, midTexcoord.y);
}
}
triangles.push(i0, i, i2);
triangles.push(i, i1, i2);
} else if (g1 === max) {
edge = `${Math.min(i1, i2)} ${Math.max(i1, i2)}`;
i = edges[edge];
if (!defined_default(i)) {
mid = Cartesian3_default.add(v1, v2, subdivisionMidScratch);
Cartesian3_default.multiplyByScalar(mid, 0.5, mid);
subdividedPositions.push(mid.x, mid.y, mid.z);
i = subdividedPositions.length / 3 - 1;
edges[edge] = i;
if (hasTexcoords) {
midTexcoord = Cartesian2_default.add(t1, t2, subdivisionTexcoordMidScratch);
Cartesian2_default.multiplyByScalar(midTexcoord, 0.5, midTexcoord);
subdividedTexcoords.push(midTexcoord.x, midTexcoord.y);
}
}
triangles.push(i1, i, i0);
triangles.push(i, i2, i0);
} else if (g2 === max) {
edge = `${Math.min(i2, i0)} ${Math.max(i2, i0)}`;
i = edges[edge];
if (!defined_default(i)) {
mid = Cartesian3_default.add(v2, v0, subdivisionMidScratch);
Cartesian3_default.multiplyByScalar(mid, 0.5, mid);
subdividedPositions.push(mid.x, mid.y, mid.z);
i = subdividedPositions.length / 3 - 1;
edges[edge] = i;
if (hasTexcoords) {
midTexcoord = Cartesian2_default.add(t2, t0, subdivisionTexcoordMidScratch);
Cartesian2_default.multiplyByScalar(midTexcoord, 0.5, midTexcoord);
subdividedTexcoords.push(midTexcoord.x, midTexcoord.y);
}
}
triangles.push(i2, i, i1);
triangles.push(i, i0, i1);
}
} else {
subdividedIndices.push(i0);
subdividedIndices.push(i1);
subdividedIndices.push(i2);
}
}
const geometryOptions = {
attributes: {
position: new GeometryAttribute_default({
componentDatatype: ComponentDatatype_default.DOUBLE,
componentsPerAttribute: 3,
values: subdividedPositions
})
},
indices: subdividedIndices,
primitiveType: PrimitiveType_default.TRIANGLES
};
if (hasTexcoords) {
geometryOptions.attributes.st = new GeometryAttribute_default({
componentDatatype: ComponentDatatype_default.FLOAT,
componentsPerAttribute: 2,
values: subdividedTexcoords
});
}
return new Geometry_default(geometryOptions);
};
var subdivisionC0Scratch = new Cartographic_default();
var subdivisionC1Scratch = new Cartographic_default();
var subdivisionC2Scratch = new Cartographic_default();
var subdivisionCartographicScratch = new Cartographic_default();
PolygonPipeline.computeRhumbLineSubdivision = function(ellipsoid, positions, indices, texcoords, granularity) {
granularity = granularity ?? Math_default.RADIANS_PER_DEGREE;
const hasTexcoords = defined_default(texcoords);
Check_default.typeOf.object("ellipsoid", ellipsoid);
Check_default.defined("positions", positions);
Check_default.defined("indices", indices);
Check_default.typeOf.number.greaterThanOrEquals("indices.length", indices.length, 3);
Check_default.typeOf.number.equals("indices.length % 3", "0", indices.length % 3, 0);
Check_default.typeOf.number.greaterThan("granularity", granularity, 0);
const triangles = indices.slice(0);
let i;
const length = positions.length;
const subdividedPositions = new Array(length * 3);
const subdividedTexcoords = new Array(length * 2);
let q = 0;
let p = 0;
for (i = 0; i < length; i++) {
const item = positions[i];
subdividedPositions[q++] = item.x;
subdividedPositions[q++] = item.y;
subdividedPositions[q++] = item.z;
if (hasTexcoords) {
const texcoordItem = texcoords[i];
subdividedTexcoords[p++] = texcoordItem.x;
subdividedTexcoords[p++] = texcoordItem.y;
}
}
const subdividedIndices = [];
const edges = {};
const radius = ellipsoid.maximumRadius;
const minDistance = Math_default.chordLength(granularity, radius);
const rhumb0 = new EllipsoidRhumbLine_default(void 0, void 0, ellipsoid);
const rhumb1 = new EllipsoidRhumbLine_default(void 0, void 0, ellipsoid);
const rhumb2 = new EllipsoidRhumbLine_default(void 0, void 0, ellipsoid);
while (triangles.length > 0) {
const i2 = triangles.pop();
const i1 = triangles.pop();
const i0 = triangles.pop();
const v0 = Cartesian3_default.fromArray(
subdividedPositions,
i0 * 3,
subdivisionV0Scratch
);
const v1 = Cartesian3_default.fromArray(
subdividedPositions,
i1 * 3,
subdivisionV1Scratch
);
const v2 = Cartesian3_default.fromArray(
subdividedPositions,
i2 * 3,
subdivisionV2Scratch
);
let t0, t1, t2;
if (hasTexcoords) {
t0 = Cartesian2_default.fromArray(
subdividedTexcoords,
i0 * 2,
subdivisionT0Scratch
);
t1 = Cartesian2_default.fromArray(
subdividedTexcoords,
i1 * 2,
subdivisionT1Scratch
);
t2 = Cartesian2_default.fromArray(
subdividedTexcoords,
i2 * 2,
subdivisionT2Scratch
);
}
const c0 = ellipsoid.cartesianToCartographic(v0, subdivisionC0Scratch);
const c1 = ellipsoid.cartesianToCartographic(v1, subdivisionC1Scratch);
const c2 = ellipsoid.cartesianToCartographic(v2, subdivisionC2Scratch);
rhumb0.setEndPoints(c0, c1);
const g0 = rhumb0.surfaceDistance;
rhumb1.setEndPoints(c1, c2);
const g1 = rhumb1.surfaceDistance;
rhumb2.setEndPoints(c2, c0);
const g2 = rhumb2.surfaceDistance;
const max = Math.max(g0, g1, g2);
let edge;
let mid;
let midHeight;
let midCartesian3;
let midTexcoord;
if (max > minDistance) {
if (g0 === max) {
edge = `${Math.min(i0, i1)} ${Math.max(i0, i1)}`;
i = edges[edge];
if (!defined_default(i)) {
mid = rhumb0.interpolateUsingFraction(
0.5,
subdivisionCartographicScratch
);
midHeight = (c0.height + c1.height) * 0.5;
midCartesian3 = Cartesian3_default.fromRadians(
mid.longitude,
mid.latitude,
midHeight,
ellipsoid,
subdivisionMidScratch
);
subdividedPositions.push(
midCartesian3.x,
midCartesian3.y,
midCartesian3.z
);
i = subdividedPositions.length / 3 - 1;
edges[edge] = i;
if (hasTexcoords) {
midTexcoord = Cartesian2_default.add(t0, t1, subdivisionTexcoordMidScratch);
Cartesian2_default.multiplyByScalar(midTexcoord, 0.5, midTexcoord);
subdividedTexcoords.push(midTexcoord.x, midTexcoord.y);
}
}
triangles.push(i0, i, i2);
triangles.push(i, i1, i2);
} else if (g1 === max) {
edge = `${Math.min(i1, i2)} ${Math.max(i1, i2)}`;
i = edges[edge];
if (!defined_default(i)) {
mid = rhumb1.interpolateUsingFraction(
0.5,
subdivisionCartographicScratch
);
midHeight = (c1.height + c2.height) * 0.5;
midCartesian3 = Cartesian3_default.fromRadians(
mid.longitude,
mid.latitude,
midHeight,
ellipsoid,
subdivisionMidScratch
);
subdividedPositions.push(
midCartesian3.x,
midCartesian3.y,
midCartesian3.z
);
i = subdividedPositions.length / 3 - 1;
edges[edge] = i;
if (hasTexcoords) {
midTexcoord = Cartesian2_default.add(t1, t2, subdivisionTexcoordMidScratch);
Cartesian2_default.multiplyByScalar(midTexcoord, 0.5, midTexcoord);
subdividedTexcoords.push(midTexcoord.x, midTexcoord.y);
}
}
triangles.push(i1, i, i0);
triangles.push(i, i2, i0);
} else if (g2 === max) {
edge = `${Math.min(i2, i0)} ${Math.max(i2, i0)}`;
i = edges[edge];
if (!defined_default(i)) {
mid = rhumb2.interpolateUsingFraction(
0.5,
subdivisionCartographicScratch
);
midHeight = (c2.height + c0.height) * 0.5;
midCartesian3 = Cartesian3_default.fromRadians(
mid.longitude,
mid.latitude,
midHeight,
ellipsoid,
subdivisionMidScratch
);
subdividedPositions.push(
midCartesian3.x,
midCartesian3.y,
midCartesian3.z
);
i = subdividedPositions.length / 3 - 1;
edges[edge] = i;
if (hasTexcoords) {
midTexcoord = Cartesian2_default.add(t2, t0, subdivisionTexcoordMidScratch);
Cartesian2_default.multiplyByScalar(midTexcoord, 0.5, midTexcoord);
subdividedTexcoords.push(midTexcoord.x, midTexcoord.y);
}
}
triangles.push(i2, i, i1);
triangles.push(i, i0, i1);
}
} else {
subdividedIndices.push(i0);
subdividedIndices.push(i1);
subdividedIndices.push(i2);
}
}
const geometryOptions = {
attributes: {
position: new GeometryAttribute_default({
componentDatatype: ComponentDatatype_default.DOUBLE,
componentsPerAttribute: 3,
values: subdividedPositions
})
},
indices: subdividedIndices,
primitiveType: PrimitiveType_default.TRIANGLES
};
if (hasTexcoords) {
geometryOptions.attributes.st = new GeometryAttribute_default({
componentDatatype: ComponentDatatype_default.FLOAT,
componentsPerAttribute: 2,
values: subdividedTexcoords
});
}
return new Geometry_default(geometryOptions);
};
PolygonPipeline.scaleToGeodeticHeight = function(positions, height, ellipsoid, scaleToSurface) {
ellipsoid = ellipsoid ?? Ellipsoid_default.default;
let n = scaleToGeodeticHeightN;
let p = scaleToGeodeticHeightP;
height = height ?? 0;
scaleToSurface = scaleToSurface ?? true;
if (defined_default(positions)) {
const length = positions.length;
for (let i = 0; i < length; i += 3) {
Cartesian3_default.fromArray(positions, i, p);
if (scaleToSurface) {
p = ellipsoid.scaleToGeodeticSurface(p, p);
}
if (height !== 0) {
n = ellipsoid.geodeticSurfaceNormal(p, n);
Cartesian3_default.multiplyByScalar(n, height, n);
Cartesian3_default.add(p, n, p);
}
positions[i] = p.x;
positions[i + 1] = p.y;
positions[i + 2] = p.z;
}
}
return positions;
};
var PolygonPipeline_default = PolygonPipeline;
export {
WindingOrder_default,
PolygonPipeline_default
};
+278
View File
@@ -0,0 +1,278 @@
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.142.0
*
* 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 {
WebGLConstants_default
} from "./chunk-TKKIREQ6.js";
import {
DeveloperError_default
} from "./chunk-AYKR4VBR.js";
import {
defined_default
} from "./chunk-ZP7JMQV4.js";
// packages/engine/Source/Core/ComponentDatatype.js
var ComponentDatatype = {
/**
* 8-bit signed byte corresponding to <code>gl.BYTE</code> and the type
* of an element in <code>Int8Array</code>.
*
* @type {number}
* @constant
*/
BYTE: WebGLConstants_default.BYTE,
/**
* 8-bit unsigned byte corresponding to <code>UNSIGNED_BYTE</code> and the type
* of an element in <code>Uint8Array</code>.
*
* @type {number}
* @constant
*/
UNSIGNED_BYTE: WebGLConstants_default.UNSIGNED_BYTE,
/**
* 16-bit signed short corresponding to <code>SHORT</code> and the type
* of an element in <code>Int16Array</code>.
*
* @type {number}
* @constant
*/
SHORT: WebGLConstants_default.SHORT,
/**
* 16-bit unsigned short corresponding to <code>UNSIGNED_SHORT</code> and the type
* of an element in <code>Uint16Array</code>.
*
* @type {number}
* @constant
*/
UNSIGNED_SHORT: WebGLConstants_default.UNSIGNED_SHORT,
/**
* 32-bit signed int corresponding to <code>INT</code> and the type
* of an element in <code>Int32Array</code>.
*
* @memberOf ComponentDatatype
*
* @type {number}
* @constant
*/
INT: WebGLConstants_default.INT,
/**
* 32-bit unsigned int corresponding to <code>UNSIGNED_INT</code> and the type
* of an element in <code>Uint32Array</code>.
*
* @memberOf ComponentDatatype
*
* @type {number}
* @constant
*/
UNSIGNED_INT: WebGLConstants_default.UNSIGNED_INT,
/**
* 32-bit floating-point corresponding to <code>FLOAT</code> and the type
* of an element in <code>Float32Array</code>.
*
* @type {number}
* @constant
*/
FLOAT: WebGLConstants_default.FLOAT,
/**
* 64-bit floating-point corresponding to <code>gl.DOUBLE</code> (in Desktop OpenGL;
* this is not supported in WebGL, and is emulated in Cesium via {@link GeometryPipeline.encodeAttribute})
* and the type of an element in <code>Float64Array</code>.
*
* @memberOf ComponentDatatype
*
* @type {number}
* @constant
* @default 0x140A
*/
DOUBLE: WebGLConstants_default.DOUBLE
};
ComponentDatatype.getSizeInBytes = function(componentDatatype) {
if (!defined_default(componentDatatype)) {
throw new DeveloperError_default("value is required.");
}
switch (componentDatatype) {
case ComponentDatatype.BYTE:
return Int8Array.BYTES_PER_ELEMENT;
case ComponentDatatype.UNSIGNED_BYTE:
return Uint8Array.BYTES_PER_ELEMENT;
case ComponentDatatype.SHORT:
return Int16Array.BYTES_PER_ELEMENT;
case ComponentDatatype.UNSIGNED_SHORT:
return Uint16Array.BYTES_PER_ELEMENT;
case ComponentDatatype.INT:
return Int32Array.BYTES_PER_ELEMENT;
case ComponentDatatype.UNSIGNED_INT:
return Uint32Array.BYTES_PER_ELEMENT;
case ComponentDatatype.FLOAT:
return Float32Array.BYTES_PER_ELEMENT;
case ComponentDatatype.DOUBLE:
return Float64Array.BYTES_PER_ELEMENT;
//>>includeStart('debug', pragmas.debug);
default:
throw new DeveloperError_default("componentDatatype is not a valid value.");
}
};
ComponentDatatype.fromTypedArray = function(array) {
if (array instanceof Int8Array) {
return ComponentDatatype.BYTE;
}
if (array instanceof Uint8Array) {
return ComponentDatatype.UNSIGNED_BYTE;
}
if (array instanceof Int16Array) {
return ComponentDatatype.SHORT;
}
if (array instanceof Uint16Array) {
return ComponentDatatype.UNSIGNED_SHORT;
}
if (array instanceof Int32Array) {
return ComponentDatatype.INT;
}
if (array instanceof Uint32Array) {
return ComponentDatatype.UNSIGNED_INT;
}
if (array instanceof Float32Array) {
return ComponentDatatype.FLOAT;
}
if (array instanceof Float64Array) {
return ComponentDatatype.DOUBLE;
}
throw new DeveloperError_default(
"array must be an Int8Array, Uint8Array, Int16Array, Uint16Array, Int32Array, Uint32Array, Float32Array, or Float64Array."
);
};
ComponentDatatype.validate = function(componentDatatype) {
return defined_default(componentDatatype) && (componentDatatype === ComponentDatatype.BYTE || componentDatatype === ComponentDatatype.UNSIGNED_BYTE || componentDatatype === ComponentDatatype.SHORT || componentDatatype === ComponentDatatype.UNSIGNED_SHORT || componentDatatype === ComponentDatatype.INT || componentDatatype === ComponentDatatype.UNSIGNED_INT || componentDatatype === ComponentDatatype.FLOAT || componentDatatype === ComponentDatatype.DOUBLE);
};
ComponentDatatype.createTypedArray = function(componentDatatype, valuesOrLength) {
if (!defined_default(componentDatatype)) {
throw new DeveloperError_default("componentDatatype is required.");
}
if (!defined_default(valuesOrLength)) {
throw new DeveloperError_default("valuesOrLength is required.");
}
switch (componentDatatype) {
case ComponentDatatype.BYTE:
return new Int8Array(valuesOrLength);
case ComponentDatatype.UNSIGNED_BYTE:
return new Uint8Array(valuesOrLength);
case ComponentDatatype.SHORT:
return new Int16Array(valuesOrLength);
case ComponentDatatype.UNSIGNED_SHORT:
return new Uint16Array(valuesOrLength);
case ComponentDatatype.INT:
return new Int32Array(valuesOrLength);
case ComponentDatatype.UNSIGNED_INT:
return new Uint32Array(valuesOrLength);
case ComponentDatatype.FLOAT:
return new Float32Array(valuesOrLength);
case ComponentDatatype.DOUBLE:
return new Float64Array(valuesOrLength);
//>>includeStart('debug', pragmas.debug);
default:
throw new DeveloperError_default("componentDatatype is not a valid value.");
}
};
ComponentDatatype.createArrayBufferView = function(componentDatatype, buffer, byteOffset, length) {
if (!defined_default(componentDatatype)) {
throw new DeveloperError_default("componentDatatype is required.");
}
if (!defined_default(buffer)) {
throw new DeveloperError_default("buffer is required.");
}
byteOffset = byteOffset ?? 0;
length = length ?? (buffer.byteLength - byteOffset) / ComponentDatatype.getSizeInBytes(componentDatatype);
switch (componentDatatype) {
case ComponentDatatype.BYTE:
return new Int8Array(buffer, byteOffset, length);
case ComponentDatatype.UNSIGNED_BYTE:
return new Uint8Array(buffer, byteOffset, length);
case ComponentDatatype.SHORT:
return new Int16Array(buffer, byteOffset, length);
case ComponentDatatype.UNSIGNED_SHORT:
return new Uint16Array(buffer, byteOffset, length);
case ComponentDatatype.INT:
return new Int32Array(buffer, byteOffset, length);
case ComponentDatatype.UNSIGNED_INT:
return new Uint32Array(buffer, byteOffset, length);
case ComponentDatatype.FLOAT:
return new Float32Array(buffer, byteOffset, length);
case ComponentDatatype.DOUBLE:
return new Float64Array(buffer, byteOffset, length);
//>>includeStart('debug', pragmas.debug);
default:
throw new DeveloperError_default("componentDatatype is not a valid value.");
}
};
ComponentDatatype.fromName = function(name) {
switch (name) {
case "BYTE":
return ComponentDatatype.BYTE;
case "UNSIGNED_BYTE":
return ComponentDatatype.UNSIGNED_BYTE;
case "SHORT":
return ComponentDatatype.SHORT;
case "UNSIGNED_SHORT":
return ComponentDatatype.UNSIGNED_SHORT;
case "INT":
return ComponentDatatype.INT;
case "UNSIGNED_INT":
return ComponentDatatype.UNSIGNED_INT;
case "FLOAT":
return ComponentDatatype.FLOAT;
case "DOUBLE":
return ComponentDatatype.DOUBLE;
//>>includeStart('debug', pragmas.debug);
default:
throw new DeveloperError_default("name is not a valid value.");
}
};
ComponentDatatype.dequantize = function(value, componentDatatype) {
switch (componentDatatype) {
case ComponentDatatype.BYTE:
return Math.max(value / 127, -1);
case ComponentDatatype.UNSIGNED_BYTE:
return value / 255;
case ComponentDatatype.SHORT:
return Math.max(value / 32767, -1);
case ComponentDatatype.UNSIGNED_SHORT:
return value / 65535;
case ComponentDatatype.INT:
return Math.max(value / 2147483647, -1);
case ComponentDatatype.UNSIGNED_INT:
return value / 4294967295;
//>>includeStart('debug', pragmas.debug);
default:
throw new DeveloperError_default(
"componentDatatype is not a valid integer type for dequantization."
);
}
};
Object.freeze(ComponentDatatype);
var ComponentDatatype_default = ComponentDatatype;
export {
ComponentDatatype_default
};
File diff suppressed because it is too large Load Diff
+973
View File
@@ -0,0 +1,973 @@
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.142.0
*
* 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-V7VQKN6N.js";
import {
Frozen_default
} from "./chunk-MPZHGZU6.js";
import {
Math_default
} from "./chunk-J6BWOHUF.js";
import {
Check_default
} from "./chunk-AYKR4VBR.js";
import {
defined_default
} from "./chunk-ZP7JMQV4.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;
}
var Color = class _Color {
/**
* @param {number} [red=1.0] The red component.
* @param {number} [green=1.0] The green component.
* @param {number} [blue=1.0] The blue component.
* @param {number} [alpha=1.0] The alpha component.
*/
constructor(red, green, blue, alpha) {
this.red = red ?? 1;
this.green = green ?? 1;
this.blue = blue ?? 1;
this.alpha = alpha ?? 1;
}
/**
* Creates a Color instance from a {@link Cartesian4}. <code>x</code>, <code>y</code>, <code>z</code>,
* and <code>w</code> map to <code>red</code>, <code>green</code>, <code>blue</code>, and <code>alpha</code>, respectively.
*
* @param {Cartesian4} cartesian The source cartesian.
* @param {Color} [result] The object onto which to store the result.
* @returns {Color} The modified result parameter or a new Color instance if one was not provided.
*/
static fromCartesian4(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;
}
/**
* Creates a new Color specified using red, green, blue, and alpha values
* that are in the range of 0 to 255, converting them internally to a range of 0.0 to 1.0.
*
* @param {number} [red=255] The red component.
* @param {number} [green=255] The green component.
* @param {number} [blue=255] The blue component.
* @param {number} [alpha=255] The alpha component.
* @param {Color} [result] The object onto which to store the result.
* @returns {Color} The modified result parameter or a new Color instance if one was not provided.
*/
static fromBytes(red, green, blue, alpha, result) {
red = _Color.byteToFloat(red ?? 255);
green = _Color.byteToFloat(green ?? 255);
blue = _Color.byteToFloat(blue ?? 255);
alpha = _Color.byteToFloat(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;
}
/**
* Creates a new Color that has the same red, green, and blue components
* of the specified color, but with the specified alpha value.
*
* @param {Color} color The base color
* @param {number} alpha The new alpha component.
* @param {Color} [result] The object onto which to store the result.
* @returns {Color} The modified result parameter or a new Color instance if one was not provided.
*
* @example const translucentRed = Cesium.Color.fromAlpha(Cesium.Color.RED, 0.9);
*/
static fromAlpha(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;
}
/**
* Creates a new Color from a single numeric unsigned 32-bit RGBA value, using the endianness
* of the system.
*
* @param {number} rgba A single numeric unsigned 32-bit RGBA value.
* @param {Color} [result] The object to store the result in, if undefined a new instance will be created.
* @returns {Color} The color object.
*
* @example
* const color = Cesium.Color.fromRgba(0x67ADDFFF);
*
* @see Color#toRgba
*/
static fromRgba(rgba, result) {
scratchUint32Array[0] = rgba;
return _Color.fromBytes(
scratchUint8Array[0],
scratchUint8Array[1],
scratchUint8Array[2],
scratchUint8Array[3],
result
);
}
/**
* Creates a Color instance from hue, saturation, and lightness.
*
* @param {number} [hue=0] The hue angle 0...1
* @param {number} [saturation=0] The saturation value 0...1
* @param {number} [lightness=0] The lightness value 0...1
* @param {number} [alpha=1.0] The alpha component 0...1
* @param {Color} [result] The object to store the result in, if undefined a new instance will be created.
* @returns {Color} The color object.
*
* @see {@link http://www.w3.org/TR/css3-color/#hsl-color|CSS color values}
*/
static fromHsl(hue, saturation, lightness, alpha, result) {
hue = (hue ?? 0) % 1;
saturation = saturation ?? 0;
lightness = lightness ?? 0;
alpha = 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;
}
/**
* Creates a random color using the provided options. For reproducible random colors, you should
* call {@link CesiumMath#setRandomNumberSeed} once at the beginning of your application.
*
* @param {object} [options] Object with the following properties:
* @param {number} [options.red] If specified, the red component to use instead of a randomized value.
* @param {number} [options.minimumRed=0.0] The maximum red value to generate if none was specified.
* @param {number} [options.maximumRed=1.0] The minimum red value to generate if none was specified.
* @param {number} [options.green] If specified, the green component to use instead of a randomized value.
* @param {number} [options.minimumGreen=0.0] The maximum green value to generate if none was specified.
* @param {number} [options.maximumGreen=1.0] The minimum green value to generate if none was specified.
* @param {number} [options.blue] If specified, the blue component to use instead of a randomized value.
* @param {number} [options.minimumBlue=0.0] The maximum blue value to generate if none was specified.
* @param {number} [options.maximumBlue=1.0] The minimum blue value to generate if none was specified.
* @param {number} [options.alpha] If specified, the alpha component to use instead of a randomized value.
* @param {number} [options.minimumAlpha=0.0] The maximum alpha value to generate if none was specified.
* @param {number} [options.maximumAlpha=1.0] The minimum alpha value to generate if none was specified.
* @param {Color} [result] The object to store the result in, if undefined a new instance will be created.
* @returns {Color} The modified result parameter or a new instance if result was undefined.
*
* @exception {DeveloperError} minimumRed must be less than or equal to maximumRed.
* @exception {DeveloperError} minimumGreen must be less than or equal to maximumGreen.
* @exception {DeveloperError} minimumBlue must be less than or equal to maximumBlue.
* @exception {DeveloperError} minimumAlpha must be less than or equal to maximumAlpha.
*
* @example
* //Create a completely random color
* const color = Cesium.Color.fromRandom();
*
* //Create a random shade of yellow.
* const color1 = Cesium.Color.fromRandom({
* red : 1.0,
* green : 1.0,
* alpha : 1.0
* });
*
* //Create a random bright color.
* const color2 = Cesium.Color.fromRandom({
* minimumRed : 0.75,
* minimumGreen : 0.75,
* minimumBlue : 0.75,
* alpha : 1.0
* });
*/
static fromRandom(options, result) {
options = options ?? Frozen_default.EMPTY_OBJECT;
let red = options.red;
if (!defined_default(red)) {
const minimumRed = options.minimumRed ?? 0;
const maximumRed = 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 = options.minimumGreen ?? 0;
const maximumGreen = 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 = options.minimumBlue ?? 0;
const maximumBlue = 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 = options.minimumAlpha ?? 0;
const maximumAlpha = options.maximumAlpha ?? 1;
Check_default.typeOf.number.lessThanOrEquals(
"minimumAlpha",
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;
}
/**
* Creates a Color instance from a CSS color value.
*
* @param {string} color The CSS color value in #rgb, #rgba, #rrggbb, #rrggbbaa, rgb(), rgba(), hsl(), or hsla() format.
* @param {Color} [result] The object to store the result in, if undefined a new instance will be created.
* @returns {Color} The color object, or undefined if the string was not a valid CSS color.
*
*
* @example
* const cesiumBlue = Cesium.Color.fromCssColorString('#67ADDF');
* const green = Cesium.Color.fromCssColorString('green');
*
* @see {@link http://www.w3.org/TR/css3-color|CSS color values}
*/
static fromCssColorString(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(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(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(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(matches[4] ?? "1.0"),
result
);
}
result = void 0;
return result;
}
/**
* Stores the provided instance into the provided array.
*
* @param {Color} value The value to pack.
* @param {number[]|TypedArray} array The array to pack into.
* @param {number} [startingIndex=0] The index into the array at which to start packing the elements.
*
* @returns {number[]|TypedArray} The array that was packed into
*/
static pack(value, array, startingIndex) {
Check_default.typeOf.object("value", value);
Check_default.defined("array", array);
startingIndex = startingIndex ?? 0;
array[startingIndex++] = value.red;
array[startingIndex++] = value.green;
array[startingIndex++] = value.blue;
array[startingIndex] = value.alpha;
return array;
}
/**
* Retrieves an instance from a packed array.
*
* @param {number[]|TypedArray} array The packed array.
* @param {number} [startingIndex=0] The starting index of the element to be unpacked.
* @param {Color} [result] The object into which to store the result.
* @returns {Color} The modified result parameter or a new Color instance if one was not provided.
*/
static unpack(array, startingIndex, result) {
Check_default.defined("array", array);
startingIndex = 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;
}
/**
* Converts a 'byte' color component in the range of 0 to 255 into
* a 'float' color component in the range of 0 to 1.0.
*
* @param {number} number The number to be converted.
* @returns {number} The converted number.
*/
static byteToFloat(number) {
return number / 255;
}
/**
* Converts a 'float' color component in the range of 0 to 1.0 into
* a 'byte' color component in the range of 0 to 255.
*
* @param {number} number The number to be converted.
* @returns {number} The converted number.
*/
static floatToByte(number) {
return number === 1 ? 255 : number * 256 | 0;
}
/**
* Duplicates a Color.
*
* @param {Color} color The Color to duplicate.
* @param {Color} [result] The object to store the result in, if undefined a new instance will be created.
* @returns {Color} The modified result parameter or a new instance if result was undefined. (Returns undefined if color is undefined)
*/
static clone(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;
}
/**
* Returns true if the first Color equals the second color.
*
* @param {Color} [left] The first Color to compare for equality.
* @param {Color} [right] The second Color to compare for equality.
* @returns {boolean} <code>true</code> if the Colors are equal; otherwise, <code>false</code>.
*/
static equals(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;
}
/**
* @private
*/
static equalsArray(color, array, offset) {
return color.red === array[offset] && color.green === array[offset + 1] && color.blue === array[offset + 2] && color.alpha === array[offset + 3];
}
/**
* Returns a duplicate of a Color instance.
*
* @param {Color} [result] The object to store the result in, if undefined a new instance will be created.
* @returns {Color} The modified result parameter or a new instance if result was undefined.
*/
clone(result) {
return _Color.clone(this, result);
}
/**
* Returns true if this Color equals other.
*
* @param {Color} [other] The Color to compare for equality.
* @returns {boolean} <code>true</code> if the Colors are equal; otherwise, <code>false</code>.
*/
equals(other) {
return _Color.equals(this, other);
}
/**
* Returns <code>true</code> if this Color equals other componentwise within the specified epsilon.
*
* @param {Color} other The Color to compare for equality.
* @param {number} [epsilon=0.0] The epsilon to use for equality testing.
* @returns {boolean} <code>true</code> if the Colors are equal within the specified epsilon; otherwise, <code>false</code>.
*/
equalsEpsilon(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;
}
/**
* Creates a string representing this Color in the format '(red, green, blue, alpha)'.
*
* @returns {string} A string representing this Color in the format '(red, green, blue, alpha)'.
*/
toString() {
return `(${this.red}, ${this.green}, ${this.blue}, ${this.alpha})`;
}
/**
* Creates a string containing the CSS color value for this color.
*
* @returns {string} The CSS equivalent of this color.
*
* @see {@link http://www.w3.org/TR/css3-color/#rgba-color|CSS RGB or RGBA color values}
*/
toCssColorString() {
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})`;
}
/**
* Creates a string containing CSS hex string color value for this color.
*
* @returns {string} The CSS hex string equivalent of this color.
*/
toCssHexString() {
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}`;
}
/**
* Converts this color to an array of red, green, blue, and alpha values
* that are in the range of 0 to 255.
*
* @param {number[]} [result] The array to store the result in, if undefined a new instance will be created.
* @returns {number[]} The modified result parameter or a new instance if result was undefined.
*/
toBytes(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;
}
/**
* Converts RGBA values in bytes to a single numeric unsigned 32-bit RGBA value, using the endianness
* of the system.
*
* @returns {number} A single numeric unsigned 32-bit RGBA value.
*
* @see Color.toRgba
*/
static bytesToRgba(red, green, blue, alpha) {
scratchUint8Array[0] = red;
scratchUint8Array[1] = green;
scratchUint8Array[2] = blue;
scratchUint8Array[3] = alpha;
return scratchUint32Array[0];
}
/**
* Converts this color to a single numeric unsigned 32-bit RGBA value, using the endianness
* of the system.
*
* @returns {number} A single numeric unsigned 32-bit RGBA value.
*
*
* @example
* const rgba = Cesium.Color.BLUE.toRgba();
*
* @see Color.fromRgba
*/
toRgba() {
return _Color.bytesToRgba(
_Color.floatToByte(this.red),
_Color.floatToByte(this.green),
_Color.floatToByte(this.blue),
_Color.floatToByte(this.alpha)
);
}
/**
* Brightens this color by the provided magnitude.
*
* @param {number} magnitude A positive number indicating the amount to brighten.
* @param {Color} result The object onto which to store the result.
* @returns {Color} The modified result parameter.
*
* @example
* const brightBlue = Cesium.Color.BLUE.brighten(0.5, new Cesium.Color());
*/
brighten(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;
}
/**
* Darkens this color by the provided magnitude.
*
* @param {number} magnitude A positive number indicating the amount to darken.
* @param {Color} result The object onto which to store the result.
* @returns {Color} The modified result parameter.
*
* @example
* const darkBlue = Cesium.Color.BLUE.darken(0.5, new Cesium.Color());
*/
darken(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;
}
/**
* Creates a new Color that has the same red, green, and blue components
* as this Color, but with the specified alpha value.
*
* @param {number} alpha The new alpha component.
* @param {Color} [result] The object onto which to store the result.
* @returns {Color} The modified result parameter or a new Color instance if one was not provided.
*
* @example const translucentRed = Cesium.Color.RED.withAlpha(0.9);
*/
withAlpha(alpha, result) {
return _Color.fromAlpha(this, alpha, result);
}
/**
* Computes the componentwise sum of two Colors.
*
* @param {Color} left The first Color.
* @param {Color} right The second Color.
* @param {Color} result The object onto which to store the result.
* @returns {Color} The modified result parameter.
*/
static add(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;
}
/**
* Computes the componentwise difference of two Colors.
*
* @param {Color} left The first Color.
* @param {Color} right The second Color.
* @param {Color} result The object onto which to store the result.
* @returns {Color} The modified result parameter.
*/
static subtract(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;
}
/**
* Computes the componentwise product of two Colors.
*
* @param {Color} left The first Color.
* @param {Color} right The second Color.
* @param {Color} result The object onto which to store the result.
* @returns {Color} The modified result parameter.
*/
static multiply(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;
}
/**
* Computes the componentwise quotient of two Colors.
*
* @param {Color} left The first Color.
* @param {Color} right The second Color.
* @param {Color} result The object onto which to store the result.
* @returns {Color} The modified result parameter.
*/
static divide(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;
}
/**
* Computes the componentwise modulus of two Colors.
*
* @param {Color} left The first Color.
* @param {Color} right The second Color.
* @param {Color} result The object onto which to store the result.
* @returns {Color} The modified result parameter.
*/
static mod(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;
}
/**
* Computes the linear interpolation or extrapolation at t between the provided colors.
*
* @param {Color} start The color corresponding to t at 0.0.
* @param {Color} end The color corresponding to t at 1.0.
* @param {number} t The point along t at which to interpolate.
* @param {Color} result The object onto which to store the result.
* @returns {Color} The modified result parameter.
*/
static lerp(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;
}
/**
* Multiplies the provided Color componentwise by the provided scalar.
*
* @param {Color} color The Color to be scaled.
* @param {number} scalar The scalar to multiply with.
* @param {Color} result The object onto which to store the result.
* @returns {Color} The modified result parameter.
*/
static multiplyByScalar(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;
}
/**
* Divides the provided Color componentwise by the provided scalar.
*
* @param {Color} color The Color to be divided.
* @param {number} scalar The scalar to divide with.
* @param {Color} result The object onto which to store the result.
* @returns {Color} The modified result parameter.
*/
static divideByScalar(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;
}
};
var scratchArrayBuffer;
var scratchUint32Array;
var scratchUint8Array;
if (FeatureDetection_default.supportsTypedArrays()) {
scratchArrayBuffer = new ArrayBuffer(4);
scratchUint32Array = new Uint32Array(scratchArrayBuffer);
scratchUint8Array = new Uint8Array(scratchArrayBuffer);
}
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.packedLength = 4;
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
};
+414
View File
@@ -0,0 +1,414 @@
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.142.0
*
* 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-6YEE6JDR.js";
import {
EllipsoidRhumbLine_default
} from "./chunk-54I6Y66F.js";
import {
IntersectionTests_default
} from "./chunk-3VFEWOBI.js";
import {
Plane_default
} from "./chunk-E7VQ76KE.js";
import {
Matrix4_default
} from "./chunk-Q3PY526V.js";
import {
Cartographic_default,
Ellipsoid_default
} from "./chunk-V7VQKN6N.js";
import {
Cartesian3_default
} from "./chunk-MPZHGZU6.js";
import {
Math_default
} from "./chunk-J6BWOHUF.js";
import {
DeveloperError_default
} from "./chunk-AYKR4VBR.js";
import {
defined_default
} from "./chunk-ZP7JMQV4.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 = 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 = options.ellipsoid ?? Ellipsoid_default.default;
let height = 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 = 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 = options.ellipsoid ?? Ellipsoid_default.default;
let height = 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 = 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
};
+140
View File
@@ -0,0 +1,140 @@
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.142.0
*
* 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 {
WebGLConstants_default
} from "./chunk-TKKIREQ6.js";
import {
Math_default
} from "./chunk-J6BWOHUF.js";
import {
DeveloperError_default
} from "./chunk-AYKR4VBR.js";
import {
defined_default
} from "./chunk-ZP7JMQV4.js";
// packages/engine/Source/Core/IndexDatatype.js
var IndexDatatype = {
/**
* 8-bit unsigned byte corresponding to <code>UNSIGNED_BYTE</code> and the type
* of an element in <code>Uint8Array</code>.
*
* @type {number}
* @constant
*/
UNSIGNED_BYTE: WebGLConstants_default.UNSIGNED_BYTE,
/**
* 16-bit unsigned short corresponding to <code>UNSIGNED_SHORT</code> and the type
* of an element in <code>Uint16Array</code>.
*
* @type {number}
* @constant
*/
UNSIGNED_SHORT: WebGLConstants_default.UNSIGNED_SHORT,
/**
* 32-bit unsigned int corresponding to <code>UNSIGNED_INT</code> and the type
* of an element in <code>Uint32Array</code>.
*
* @type {number}
* @constant
*/
UNSIGNED_INT: WebGLConstants_default.UNSIGNED_INT
};
IndexDatatype.getSizeInBytes = function(indexDatatype) {
switch (indexDatatype) {
case IndexDatatype.UNSIGNED_BYTE:
return Uint8Array.BYTES_PER_ELEMENT;
case IndexDatatype.UNSIGNED_SHORT:
return Uint16Array.BYTES_PER_ELEMENT;
case IndexDatatype.UNSIGNED_INT:
return Uint32Array.BYTES_PER_ELEMENT;
}
throw new DeveloperError_default(
"indexDatatype is required and must be a valid IndexDatatype constant."
);
};
IndexDatatype.fromSizeInBytes = function(sizeInBytes) {
switch (sizeInBytes) {
case 2:
return IndexDatatype.UNSIGNED_SHORT;
case 4:
return IndexDatatype.UNSIGNED_INT;
case 1:
return IndexDatatype.UNSIGNED_BYTE;
//>>includeStart('debug', pragmas.debug);
default:
throw new DeveloperError_default(
"Size in bytes cannot be mapped to an IndexDatatype"
);
}
};
IndexDatatype.validate = function(indexDatatype) {
return defined_default(indexDatatype) && (indexDatatype === IndexDatatype.UNSIGNED_BYTE || indexDatatype === IndexDatatype.UNSIGNED_SHORT || indexDatatype === IndexDatatype.UNSIGNED_INT);
};
IndexDatatype.createTypedArray = function(numberOfVertices, indicesLengthOrArray) {
if (!defined_default(numberOfVertices)) {
throw new DeveloperError_default("numberOfVertices is required.");
}
if (numberOfVertices >= Math_default.SIXTY_FOUR_KILOBYTES) {
return new Uint32Array(indicesLengthOrArray);
}
return new Uint16Array(indicesLengthOrArray);
};
IndexDatatype.createTypedArrayFromArrayBuffer = function(numberOfVertices, sourceArray, byteOffset, length) {
if (!defined_default(numberOfVertices)) {
throw new DeveloperError_default("numberOfVertices is required.");
}
if (!defined_default(sourceArray)) {
throw new DeveloperError_default("sourceArray is required.");
}
if (!defined_default(byteOffset)) {
throw new DeveloperError_default("byteOffset is required.");
}
if (numberOfVertices >= Math_default.SIXTY_FOUR_KILOBYTES) {
return new Uint32Array(sourceArray, byteOffset, length);
}
return new Uint16Array(sourceArray, byteOffset, length);
};
IndexDatatype.fromTypedArray = function(array) {
if (array instanceof Uint8Array) {
return IndexDatatype.UNSIGNED_BYTE;
}
if (array instanceof Uint16Array) {
return IndexDatatype.UNSIGNED_SHORT;
}
if (array instanceof Uint32Array) {
return IndexDatatype.UNSIGNED_INT;
}
throw new DeveloperError_default(
"array must be a Uint8Array, Uint16Array, or Uint32Array."
);
};
Object.freeze(IndexDatatype);
var IndexDatatype_default = IndexDatatype;
export {
IndexDatatype_default
};
+288
View File
@@ -0,0 +1,288 @@
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.142.0
*
* 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 {
AxisAlignedBoundingBox_default
} from "./chunk-DDWSZVMY.js";
import {
IntersectionTests_default,
Ray_default
} from "./chunk-3VFEWOBI.js";
import {
Plane_default
} from "./chunk-E7VQ76KE.js";
import {
Transforms_default
} from "./chunk-MYP774IS.js";
import {
Cartesian4_default,
Matrix4_default
} from "./chunk-Q3PY526V.js";
import {
Cartesian2_default,
Ellipsoid_default
} from "./chunk-V7VQKN6N.js";
import {
Cartesian3_default
} from "./chunk-MPZHGZU6.js";
import {
Check_default,
DeveloperError_default
} from "./chunk-AYKR4VBR.js";
import {
defined_default
} from "./chunk-ZP7JMQV4.js";
// packages/engine/Source/Core/EllipsoidTangentPlane.js
var scratchCart4 = new Cartesian4_default();
function EllipsoidTangentPlane(origin, ellipsoid) {
Check_default.defined("origin", origin);
ellipsoid = ellipsoid ?? Ellipsoid_default.default;
origin = ellipsoid.scaleToGeodeticSurface(origin);
if (!defined_default(origin)) {
throw new DeveloperError_default(
"origin must not be at the center of the ellipsoid."
);
}
const eastNorthUp = Transforms_default.eastNorthUpToFixedFrame(origin, ellipsoid);
this._ellipsoid = ellipsoid;
this._origin = origin;
this._xAxis = Cartesian3_default.fromCartesian4(
Matrix4_default.getColumn(eastNorthUp, 0, scratchCart4)
);
this._yAxis = Cartesian3_default.fromCartesian4(
Matrix4_default.getColumn(eastNorthUp, 1, scratchCart4)
);
const normal = Cartesian3_default.fromCartesian4(
Matrix4_default.getColumn(eastNorthUp, 2, scratchCart4)
);
this._plane = Plane_default.fromPointNormal(origin, normal);
}
Object.defineProperties(EllipsoidTangentPlane.prototype, {
/**
* Gets the ellipsoid.
* @memberof EllipsoidTangentPlane.prototype
* @type {Ellipsoid}
*/
ellipsoid: {
get: function() {
return this._ellipsoid;
}
},
/**
* Gets the origin.
* @memberof EllipsoidTangentPlane.prototype
* @type {Cartesian3}
*/
origin: {
get: function() {
return this._origin;
}
},
/**
* Gets the plane which is tangent to the ellipsoid.
* @memberof EllipsoidTangentPlane.prototype
* @readonly
* @type {Plane}
*/
plane: {
get: function() {
return this._plane;
}
},
/**
* Gets the local X-axis (east) of the tangent plane.
* @memberof EllipsoidTangentPlane.prototype
* @readonly
* @type {Cartesian3}
*/
xAxis: {
get: function() {
return this._xAxis;
}
},
/**
* Gets the local Y-axis (north) of the tangent plane.
* @memberof EllipsoidTangentPlane.prototype
* @readonly
* @type {Cartesian3}
*/
yAxis: {
get: function() {
return this._yAxis;
}
},
/**
* Gets the local Z-axis (up) of the tangent plane.
* @memberof EllipsoidTangentPlane.prototype
* @readonly
* @type {Cartesian3}
*/
zAxis: {
get: function() {
return this._plane.normal;
}
}
});
var tmp = new AxisAlignedBoundingBox_default();
EllipsoidTangentPlane.fromPoints = function(cartesians, ellipsoid) {
Check_default.defined("cartesians", cartesians);
const box = AxisAlignedBoundingBox_default.fromPoints(cartesians, tmp);
return new EllipsoidTangentPlane(box.center, ellipsoid);
};
var scratchProjectPointOntoPlaneRay = new Ray_default();
var scratchProjectPointOntoPlaneCartesian3 = new Cartesian3_default();
EllipsoidTangentPlane.prototype.projectPointOntoPlane = function(cartesian, result) {
Check_default.defined("cartesian", cartesian);
const ray = scratchProjectPointOntoPlaneRay;
ray.origin = cartesian;
Cartesian3_default.normalize(cartesian, ray.direction);
let intersectionPoint = IntersectionTests_default.rayPlane(
ray,
this._plane,
scratchProjectPointOntoPlaneCartesian3
);
if (!defined_default(intersectionPoint)) {
Cartesian3_default.negate(ray.direction, ray.direction);
intersectionPoint = IntersectionTests_default.rayPlane(
ray,
this._plane,
scratchProjectPointOntoPlaneCartesian3
);
}
if (defined_default(intersectionPoint)) {
const v = Cartesian3_default.subtract(
intersectionPoint,
this._origin,
intersectionPoint
);
const x = Cartesian3_default.dot(this._xAxis, v);
const y = Cartesian3_default.dot(this._yAxis, v);
if (!defined_default(result)) {
return new Cartesian2_default(x, y);
}
result.x = x;
result.y = y;
return result;
}
return void 0;
};
EllipsoidTangentPlane.prototype.projectPointsOntoPlane = function(cartesians, result) {
Check_default.defined("cartesians", cartesians);
if (!defined_default(result)) {
result = [];
}
let count = 0;
const length = cartesians.length;
for (let i = 0; i < length; i++) {
const p = this.projectPointOntoPlane(cartesians[i], result[count]);
if (defined_default(p)) {
result[count] = p;
count++;
}
}
result.length = count;
return result;
};
EllipsoidTangentPlane.prototype.projectPointToNearestOnPlane = function(cartesian, result) {
Check_default.defined("cartesian", cartesian);
if (!defined_default(result)) {
result = new Cartesian2_default();
}
const ray = scratchProjectPointOntoPlaneRay;
ray.origin = cartesian;
Cartesian3_default.clone(this._plane.normal, ray.direction);
let intersectionPoint = IntersectionTests_default.rayPlane(
ray,
this._plane,
scratchProjectPointOntoPlaneCartesian3
);
if (!defined_default(intersectionPoint)) {
Cartesian3_default.negate(ray.direction, ray.direction);
intersectionPoint = IntersectionTests_default.rayPlane(
ray,
this._plane,
scratchProjectPointOntoPlaneCartesian3
);
}
const v = Cartesian3_default.subtract(
intersectionPoint,
this._origin,
intersectionPoint
);
const x = Cartesian3_default.dot(this._xAxis, v);
const y = Cartesian3_default.dot(this._yAxis, v);
result.x = x;
result.y = y;
return result;
};
EllipsoidTangentPlane.prototype.projectPointsToNearestOnPlane = function(cartesians, result) {
Check_default.defined("cartesians", cartesians);
if (!defined_default(result)) {
result = [];
}
const length = cartesians.length;
result.length = length;
for (let i = 0; i < length; i++) {
result[i] = this.projectPointToNearestOnPlane(cartesians[i], result[i]);
}
return result;
};
var projectPointsOntoEllipsoidScratch = new Cartesian3_default();
EllipsoidTangentPlane.prototype.projectPointOntoEllipsoid = function(cartesian, result) {
Check_default.defined("cartesian", cartesian);
if (!defined_default(result)) {
result = new Cartesian3_default();
}
const ellipsoid = this._ellipsoid;
const origin = this._origin;
const xAxis = this._xAxis;
const yAxis = this._yAxis;
const tmp2 = projectPointsOntoEllipsoidScratch;
Cartesian3_default.multiplyByScalar(xAxis, cartesian.x, tmp2);
result = Cartesian3_default.add(origin, tmp2, result);
Cartesian3_default.multiplyByScalar(yAxis, cartesian.y, tmp2);
Cartesian3_default.add(result, tmp2, result);
ellipsoid.scaleToGeocentricSurface(result, result);
return result;
};
EllipsoidTangentPlane.prototype.projectPointsOntoEllipsoid = function(cartesians, result) {
Check_default.defined("cartesians", cartesians);
const length = cartesians.length;
if (!defined_default(result)) {
result = new Array(length);
} else {
result.length = length;
}
for (let i = 0; i < length; ++i) {
result[i] = this.projectPointOntoEllipsoid(cartesians[i], result[i]);
}
return result;
};
var EllipsoidTangentPlane_default = EllipsoidTangentPlane;
export {
EllipsoidTangentPlane_default
};
+630
View File
@@ -0,0 +1,630 @@
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.142.0
*
* 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.
*/
// packages/engine/Source/Core/WebGLConstants.js
var WebGLConstants = {
DEPTH_BUFFER_BIT: 256,
STENCIL_BUFFER_BIT: 1024,
COLOR_BUFFER_BIT: 16384,
POINTS: 0,
LINES: 1,
LINE_LOOP: 2,
LINE_STRIP: 3,
TRIANGLES: 4,
TRIANGLE_STRIP: 5,
TRIANGLE_FAN: 6,
ZERO: 0,
ONE: 1,
SRC_COLOR: 768,
ONE_MINUS_SRC_COLOR: 769,
SRC_ALPHA: 770,
ONE_MINUS_SRC_ALPHA: 771,
DST_ALPHA: 772,
ONE_MINUS_DST_ALPHA: 773,
DST_COLOR: 774,
ONE_MINUS_DST_COLOR: 775,
SRC_ALPHA_SATURATE: 776,
FUNC_ADD: 32774,
BLEND_EQUATION: 32777,
BLEND_EQUATION_RGB: 32777,
// same as BLEND_EQUATION
BLEND_EQUATION_ALPHA: 34877,
FUNC_SUBTRACT: 32778,
FUNC_REVERSE_SUBTRACT: 32779,
BLEND_DST_RGB: 32968,
BLEND_SRC_RGB: 32969,
BLEND_DST_ALPHA: 32970,
BLEND_SRC_ALPHA: 32971,
CONSTANT_COLOR: 32769,
ONE_MINUS_CONSTANT_COLOR: 32770,
CONSTANT_ALPHA: 32771,
ONE_MINUS_CONSTANT_ALPHA: 32772,
BLEND_COLOR: 32773,
ARRAY_BUFFER: 34962,
ELEMENT_ARRAY_BUFFER: 34963,
ARRAY_BUFFER_BINDING: 34964,
ELEMENT_ARRAY_BUFFER_BINDING: 34965,
STREAM_DRAW: 35040,
STATIC_DRAW: 35044,
DYNAMIC_DRAW: 35048,
BUFFER_SIZE: 34660,
BUFFER_USAGE: 34661,
CURRENT_VERTEX_ATTRIB: 34342,
FRONT: 1028,
BACK: 1029,
FRONT_AND_BACK: 1032,
CULL_FACE: 2884,
BLEND: 3042,
DITHER: 3024,
STENCIL_TEST: 2960,
DEPTH_TEST: 2929,
SCISSOR_TEST: 3089,
POLYGON_OFFSET_FILL: 32823,
SAMPLE_ALPHA_TO_COVERAGE: 32926,
SAMPLE_COVERAGE: 32928,
NO_ERROR: 0,
INVALID_ENUM: 1280,
INVALID_VALUE: 1281,
INVALID_OPERATION: 1282,
OUT_OF_MEMORY: 1285,
CW: 2304,
CCW: 2305,
LINE_WIDTH: 2849,
ALIASED_POINT_SIZE_RANGE: 33901,
ALIASED_LINE_WIDTH_RANGE: 33902,
CULL_FACE_MODE: 2885,
FRONT_FACE: 2886,
DEPTH_RANGE: 2928,
DEPTH_WRITEMASK: 2930,
DEPTH_CLEAR_VALUE: 2931,
DEPTH_FUNC: 2932,
STENCIL_CLEAR_VALUE: 2961,
STENCIL_FUNC: 2962,
STENCIL_FAIL: 2964,
STENCIL_PASS_DEPTH_FAIL: 2965,
STENCIL_PASS_DEPTH_PASS: 2966,
STENCIL_REF: 2967,
STENCIL_VALUE_MASK: 2963,
STENCIL_WRITEMASK: 2968,
STENCIL_BACK_FUNC: 34816,
STENCIL_BACK_FAIL: 34817,
STENCIL_BACK_PASS_DEPTH_FAIL: 34818,
STENCIL_BACK_PASS_DEPTH_PASS: 34819,
STENCIL_BACK_REF: 36003,
STENCIL_BACK_VALUE_MASK: 36004,
STENCIL_BACK_WRITEMASK: 36005,
VIEWPORT: 2978,
SCISSOR_BOX: 3088,
COLOR_CLEAR_VALUE: 3106,
COLOR_WRITEMASK: 3107,
UNPACK_ALIGNMENT: 3317,
PACK_ALIGNMENT: 3333,
MAX_TEXTURE_SIZE: 3379,
MAX_VIEWPORT_DIMS: 3386,
SUBPIXEL_BITS: 3408,
RED_BITS: 3410,
GREEN_BITS: 3411,
BLUE_BITS: 3412,
ALPHA_BITS: 3413,
DEPTH_BITS: 3414,
STENCIL_BITS: 3415,
POLYGON_OFFSET_UNITS: 10752,
POLYGON_OFFSET_FACTOR: 32824,
TEXTURE_BINDING_2D: 32873,
SAMPLE_BUFFERS: 32936,
SAMPLES: 32937,
SAMPLE_COVERAGE_VALUE: 32938,
SAMPLE_COVERAGE_INVERT: 32939,
COMPRESSED_TEXTURE_FORMATS: 34467,
DONT_CARE: 4352,
FASTEST: 4353,
NICEST: 4354,
GENERATE_MIPMAP_HINT: 33170,
BYTE: 5120,
UNSIGNED_BYTE: 5121,
SHORT: 5122,
UNSIGNED_SHORT: 5123,
INT: 5124,
UNSIGNED_INT: 5125,
FLOAT: 5126,
DEPTH_COMPONENT: 6402,
ALPHA: 6406,
RGB: 6407,
RGBA: 6408,
LUMINANCE: 6409,
LUMINANCE_ALPHA: 6410,
UNSIGNED_SHORT_4_4_4_4: 32819,
UNSIGNED_SHORT_5_5_5_1: 32820,
UNSIGNED_SHORT_5_6_5: 33635,
FRAGMENT_SHADER: 35632,
VERTEX_SHADER: 35633,
MAX_VERTEX_ATTRIBS: 34921,
MAX_VERTEX_UNIFORM_VECTORS: 36347,
MAX_VARYING_VECTORS: 36348,
MAX_COMBINED_TEXTURE_IMAGE_UNITS: 35661,
MAX_VERTEX_TEXTURE_IMAGE_UNITS: 35660,
MAX_TEXTURE_IMAGE_UNITS: 34930,
MAX_FRAGMENT_UNIFORM_VECTORS: 36349,
SHADER_TYPE: 35663,
DELETE_STATUS: 35712,
LINK_STATUS: 35714,
VALIDATE_STATUS: 35715,
ATTACHED_SHADERS: 35717,
ACTIVE_UNIFORMS: 35718,
ACTIVE_ATTRIBUTES: 35721,
SHADING_LANGUAGE_VERSION: 35724,
CURRENT_PROGRAM: 35725,
NEVER: 512,
LESS: 513,
EQUAL: 514,
LEQUAL: 515,
GREATER: 516,
NOTEQUAL: 517,
GEQUAL: 518,
ALWAYS: 519,
KEEP: 7680,
REPLACE: 7681,
INCR: 7682,
DECR: 7683,
INVERT: 5386,
INCR_WRAP: 34055,
DECR_WRAP: 34056,
VENDOR: 7936,
RENDERER: 7937,
VERSION: 7938,
NEAREST: 9728,
LINEAR: 9729,
NEAREST_MIPMAP_NEAREST: 9984,
LINEAR_MIPMAP_NEAREST: 9985,
NEAREST_MIPMAP_LINEAR: 9986,
LINEAR_MIPMAP_LINEAR: 9987,
TEXTURE_MAG_FILTER: 10240,
TEXTURE_MIN_FILTER: 10241,
TEXTURE_WRAP_S: 10242,
TEXTURE_WRAP_T: 10243,
TEXTURE_2D: 3553,
TEXTURE: 5890,
TEXTURE_CUBE_MAP: 34067,
TEXTURE_BINDING_CUBE_MAP: 34068,
TEXTURE_CUBE_MAP_POSITIVE_X: 34069,
TEXTURE_CUBE_MAP_NEGATIVE_X: 34070,
TEXTURE_CUBE_MAP_POSITIVE_Y: 34071,
TEXTURE_CUBE_MAP_NEGATIVE_Y: 34072,
TEXTURE_CUBE_MAP_POSITIVE_Z: 34073,
TEXTURE_CUBE_MAP_NEGATIVE_Z: 34074,
MAX_CUBE_MAP_TEXTURE_SIZE: 34076,
TEXTURE0: 33984,
TEXTURE1: 33985,
TEXTURE2: 33986,
TEXTURE3: 33987,
TEXTURE4: 33988,
TEXTURE5: 33989,
TEXTURE6: 33990,
TEXTURE7: 33991,
TEXTURE8: 33992,
TEXTURE9: 33993,
TEXTURE10: 33994,
TEXTURE11: 33995,
TEXTURE12: 33996,
TEXTURE13: 33997,
TEXTURE14: 33998,
TEXTURE15: 33999,
TEXTURE16: 34e3,
TEXTURE17: 34001,
TEXTURE18: 34002,
TEXTURE19: 34003,
TEXTURE20: 34004,
TEXTURE21: 34005,
TEXTURE22: 34006,
TEXTURE23: 34007,
TEXTURE24: 34008,
TEXTURE25: 34009,
TEXTURE26: 34010,
TEXTURE27: 34011,
TEXTURE28: 34012,
TEXTURE29: 34013,
TEXTURE30: 34014,
TEXTURE31: 34015,
ACTIVE_TEXTURE: 34016,
REPEAT: 10497,
CLAMP_TO_EDGE: 33071,
MIRRORED_REPEAT: 33648,
FLOAT_VEC2: 35664,
FLOAT_VEC3: 35665,
FLOAT_VEC4: 35666,
INT_VEC2: 35667,
INT_VEC3: 35668,
INT_VEC4: 35669,
BOOL: 35670,
BOOL_VEC2: 35671,
BOOL_VEC3: 35672,
BOOL_VEC4: 35673,
FLOAT_MAT2: 35674,
FLOAT_MAT3: 35675,
FLOAT_MAT4: 35676,
SAMPLER_2D: 35678,
SAMPLER_CUBE: 35680,
VERTEX_ATTRIB_ARRAY_ENABLED: 34338,
VERTEX_ATTRIB_ARRAY_SIZE: 34339,
VERTEX_ATTRIB_ARRAY_STRIDE: 34340,
VERTEX_ATTRIB_ARRAY_TYPE: 34341,
VERTEX_ATTRIB_ARRAY_NORMALIZED: 34922,
VERTEX_ATTRIB_ARRAY_POINTER: 34373,
VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: 34975,
IMPLEMENTATION_COLOR_READ_TYPE: 35738,
IMPLEMENTATION_COLOR_READ_FORMAT: 35739,
COMPILE_STATUS: 35713,
LOW_FLOAT: 36336,
MEDIUM_FLOAT: 36337,
HIGH_FLOAT: 36338,
LOW_INT: 36339,
MEDIUM_INT: 36340,
HIGH_INT: 36341,
FRAMEBUFFER: 36160,
RENDERBUFFER: 36161,
RGBA4: 32854,
RGB5_A1: 32855,
RGB565: 36194,
DEPTH_COMPONENT16: 33189,
STENCIL_INDEX: 6401,
STENCIL_INDEX8: 36168,
DEPTH_STENCIL: 34041,
RENDERBUFFER_WIDTH: 36162,
RENDERBUFFER_HEIGHT: 36163,
RENDERBUFFER_INTERNAL_FORMAT: 36164,
RENDERBUFFER_RED_SIZE: 36176,
RENDERBUFFER_GREEN_SIZE: 36177,
RENDERBUFFER_BLUE_SIZE: 36178,
RENDERBUFFER_ALPHA_SIZE: 36179,
RENDERBUFFER_DEPTH_SIZE: 36180,
RENDERBUFFER_STENCIL_SIZE: 36181,
FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: 36048,
FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: 36049,
FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: 36050,
FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: 36051,
COLOR_ATTACHMENT0: 36064,
DEPTH_ATTACHMENT: 36096,
STENCIL_ATTACHMENT: 36128,
DEPTH_STENCIL_ATTACHMENT: 33306,
NONE: 0,
FRAMEBUFFER_COMPLETE: 36053,
FRAMEBUFFER_INCOMPLETE_ATTACHMENT: 36054,
FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: 36055,
FRAMEBUFFER_INCOMPLETE_DIMENSIONS: 36057,
FRAMEBUFFER_UNSUPPORTED: 36061,
FRAMEBUFFER_BINDING: 36006,
RENDERBUFFER_BINDING: 36007,
MAX_RENDERBUFFER_SIZE: 34024,
INVALID_FRAMEBUFFER_OPERATION: 1286,
UNPACK_FLIP_Y_WEBGL: 37440,
UNPACK_PREMULTIPLY_ALPHA_WEBGL: 37441,
CONTEXT_LOST_WEBGL: 37442,
UNPACK_COLORSPACE_CONVERSION_WEBGL: 37443,
BROWSER_DEFAULT_WEBGL: 37444,
// WEBGL_compressed_texture_s3tc
COMPRESSED_RGB_S3TC_DXT1_EXT: 33776,
COMPRESSED_RGBA_S3TC_DXT1_EXT: 33777,
COMPRESSED_RGBA_S3TC_DXT3_EXT: 33778,
COMPRESSED_RGBA_S3TC_DXT5_EXT: 33779,
// WEBGL_compressed_texture_pvrtc
COMPRESSED_RGB_PVRTC_4BPPV1_IMG: 35840,
COMPRESSED_RGB_PVRTC_2BPPV1_IMG: 35841,
COMPRESSED_RGBA_PVRTC_4BPPV1_IMG: 35842,
COMPRESSED_RGBA_PVRTC_2BPPV1_IMG: 35843,
// WEBGL_compressed_texture_astc
COMPRESSED_RGBA_ASTC_4x4_WEBGL: 37808,
// WEBGL_compressed_texture_etc1
COMPRESSED_RGB_ETC1_WEBGL: 36196,
// EXT_texture_compression_bptc
COMPRESSED_RGBA_BPTC_UNORM: 36492,
// EXT_color_buffer_half_float
HALF_FLOAT_OES: 36193,
// Desktop OpenGL
DOUBLE: 5130,
// WebGL 2
READ_BUFFER: 3074,
UNPACK_ROW_LENGTH: 3314,
UNPACK_SKIP_ROWS: 3315,
UNPACK_SKIP_PIXELS: 3316,
PACK_ROW_LENGTH: 3330,
PACK_SKIP_ROWS: 3331,
PACK_SKIP_PIXELS: 3332,
COLOR: 6144,
DEPTH: 6145,
STENCIL: 6146,
RED: 6403,
RGB8: 32849,
RGBA8: 32856,
RGB10_A2: 32857,
TEXTURE_BINDING_3D: 32874,
UNPACK_SKIP_IMAGES: 32877,
UNPACK_IMAGE_HEIGHT: 32878,
TEXTURE_3D: 32879,
TEXTURE_WRAP_R: 32882,
MAX_3D_TEXTURE_SIZE: 32883,
UNSIGNED_INT_2_10_10_10_REV: 33640,
MAX_ELEMENTS_VERTICES: 33e3,
MAX_ELEMENTS_INDICES: 33001,
TEXTURE_MIN_LOD: 33082,
TEXTURE_MAX_LOD: 33083,
TEXTURE_BASE_LEVEL: 33084,
TEXTURE_MAX_LEVEL: 33085,
MIN: 32775,
MAX: 32776,
DEPTH_COMPONENT24: 33190,
MAX_TEXTURE_LOD_BIAS: 34045,
TEXTURE_COMPARE_MODE: 34892,
TEXTURE_COMPARE_FUNC: 34893,
CURRENT_QUERY: 34917,
QUERY_RESULT: 34918,
QUERY_RESULT_AVAILABLE: 34919,
STREAM_READ: 35041,
STREAM_COPY: 35042,
STATIC_READ: 35045,
STATIC_COPY: 35046,
DYNAMIC_READ: 35049,
DYNAMIC_COPY: 35050,
MAX_DRAW_BUFFERS: 34852,
DRAW_BUFFER0: 34853,
DRAW_BUFFER1: 34854,
DRAW_BUFFER2: 34855,
DRAW_BUFFER3: 34856,
DRAW_BUFFER4: 34857,
DRAW_BUFFER5: 34858,
DRAW_BUFFER6: 34859,
DRAW_BUFFER7: 34860,
DRAW_BUFFER8: 34861,
DRAW_BUFFER9: 34862,
DRAW_BUFFER10: 34863,
DRAW_BUFFER11: 34864,
DRAW_BUFFER12: 34865,
DRAW_BUFFER13: 34866,
DRAW_BUFFER14: 34867,
DRAW_BUFFER15: 34868,
MAX_FRAGMENT_UNIFORM_COMPONENTS: 35657,
MAX_VERTEX_UNIFORM_COMPONENTS: 35658,
SAMPLER_3D: 35679,
SAMPLER_2D_SHADOW: 35682,
FRAGMENT_SHADER_DERIVATIVE_HINT: 35723,
PIXEL_PACK_BUFFER: 35051,
PIXEL_UNPACK_BUFFER: 35052,
PIXEL_PACK_BUFFER_BINDING: 35053,
PIXEL_UNPACK_BUFFER_BINDING: 35055,
FLOAT_MAT2x3: 35685,
FLOAT_MAT2x4: 35686,
FLOAT_MAT3x2: 35687,
FLOAT_MAT3x4: 35688,
FLOAT_MAT4x2: 35689,
FLOAT_MAT4x3: 35690,
SRGB: 35904,
SRGB8: 35905,
SRGB8_ALPHA8: 35907,
COMPARE_REF_TO_TEXTURE: 34894,
RGBA32F: 34836,
RGB32F: 34837,
RGBA16F: 34842,
RGB16F: 34843,
VERTEX_ATTRIB_ARRAY_INTEGER: 35069,
MAX_ARRAY_TEXTURE_LAYERS: 35071,
MIN_PROGRAM_TEXEL_OFFSET: 35076,
MAX_PROGRAM_TEXEL_OFFSET: 35077,
MAX_VARYING_COMPONENTS: 35659,
TEXTURE_2D_ARRAY: 35866,
TEXTURE_BINDING_2D_ARRAY: 35869,
R11F_G11F_B10F: 35898,
UNSIGNED_INT_10F_11F_11F_REV: 35899,
RGB9_E5: 35901,
UNSIGNED_INT_5_9_9_9_REV: 35902,
TRANSFORM_FEEDBACK_BUFFER_MODE: 35967,
MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS: 35968,
TRANSFORM_FEEDBACK_VARYINGS: 35971,
TRANSFORM_FEEDBACK_BUFFER_START: 35972,
TRANSFORM_FEEDBACK_BUFFER_SIZE: 35973,
TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN: 35976,
RASTERIZER_DISCARD: 35977,
MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS: 35978,
MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS: 35979,
INTERLEAVED_ATTRIBS: 35980,
SEPARATE_ATTRIBS: 35981,
TRANSFORM_FEEDBACK_BUFFER: 35982,
TRANSFORM_FEEDBACK_BUFFER_BINDING: 35983,
RGBA32UI: 36208,
RGB32UI: 36209,
RGBA16UI: 36214,
RGB16UI: 36215,
RGBA8UI: 36220,
RGB8UI: 36221,
RGBA32I: 36226,
RGB32I: 36227,
RGBA16I: 36232,
RGB16I: 36233,
RGBA8I: 36238,
RGB8I: 36239,
RED_INTEGER: 36244,
RGB_INTEGER: 36248,
RGBA_INTEGER: 36249,
SAMPLER_2D_ARRAY: 36289,
SAMPLER_2D_ARRAY_SHADOW: 36292,
SAMPLER_CUBE_SHADOW: 36293,
UNSIGNED_INT_VEC2: 36294,
UNSIGNED_INT_VEC3: 36295,
UNSIGNED_INT_VEC4: 36296,
INT_SAMPLER_2D: 36298,
INT_SAMPLER_3D: 36299,
INT_SAMPLER_CUBE: 36300,
INT_SAMPLER_2D_ARRAY: 36303,
UNSIGNED_INT_SAMPLER_2D: 36306,
UNSIGNED_INT_SAMPLER_3D: 36307,
UNSIGNED_INT_SAMPLER_CUBE: 36308,
UNSIGNED_INT_SAMPLER_2D_ARRAY: 36311,
DEPTH_COMPONENT32F: 36012,
DEPTH32F_STENCIL8: 36013,
FLOAT_32_UNSIGNED_INT_24_8_REV: 36269,
FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING: 33296,
FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE: 33297,
FRAMEBUFFER_ATTACHMENT_RED_SIZE: 33298,
FRAMEBUFFER_ATTACHMENT_GREEN_SIZE: 33299,
FRAMEBUFFER_ATTACHMENT_BLUE_SIZE: 33300,
FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE: 33301,
FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE: 33302,
FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE: 33303,
FRAMEBUFFER_DEFAULT: 33304,
UNSIGNED_INT_24_8: 34042,
DEPTH24_STENCIL8: 35056,
UNSIGNED_NORMALIZED: 35863,
DRAW_FRAMEBUFFER_BINDING: 36006,
// Same as FRAMEBUFFER_BINDING
READ_FRAMEBUFFER: 36008,
DRAW_FRAMEBUFFER: 36009,
READ_FRAMEBUFFER_BINDING: 36010,
RENDERBUFFER_SAMPLES: 36011,
FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER: 36052,
MAX_COLOR_ATTACHMENTS: 36063,
COLOR_ATTACHMENT1: 36065,
COLOR_ATTACHMENT2: 36066,
COLOR_ATTACHMENT3: 36067,
COLOR_ATTACHMENT4: 36068,
COLOR_ATTACHMENT5: 36069,
COLOR_ATTACHMENT6: 36070,
COLOR_ATTACHMENT7: 36071,
COLOR_ATTACHMENT8: 36072,
COLOR_ATTACHMENT9: 36073,
COLOR_ATTACHMENT10: 36074,
COLOR_ATTACHMENT11: 36075,
COLOR_ATTACHMENT12: 36076,
COLOR_ATTACHMENT13: 36077,
COLOR_ATTACHMENT14: 36078,
COLOR_ATTACHMENT15: 36079,
FRAMEBUFFER_INCOMPLETE_MULTISAMPLE: 36182,
MAX_SAMPLES: 36183,
HALF_FLOAT: 5131,
RG: 33319,
RG_INTEGER: 33320,
R8: 33321,
RG8: 33323,
R16F: 33325,
R32F: 33326,
RG16F: 33327,
RG32F: 33328,
R8I: 33329,
R8UI: 33330,
R16I: 33331,
R16UI: 33332,
R32I: 33333,
R32UI: 33334,
RG8I: 33335,
RG8UI: 33336,
RG16I: 33337,
RG16UI: 33338,
RG32I: 33339,
RG32UI: 33340,
VERTEX_ARRAY_BINDING: 34229,
R8_SNORM: 36756,
RG8_SNORM: 36757,
RGB8_SNORM: 36758,
RGBA8_SNORM: 36759,
SIGNED_NORMALIZED: 36764,
COPY_READ_BUFFER: 36662,
COPY_WRITE_BUFFER: 36663,
COPY_READ_BUFFER_BINDING: 36662,
// Same as COPY_READ_BUFFER
COPY_WRITE_BUFFER_BINDING: 36663,
// Same as COPY_WRITE_BUFFER
UNIFORM_BUFFER: 35345,
UNIFORM_BUFFER_BINDING: 35368,
UNIFORM_BUFFER_START: 35369,
UNIFORM_BUFFER_SIZE: 35370,
MAX_VERTEX_UNIFORM_BLOCKS: 35371,
MAX_FRAGMENT_UNIFORM_BLOCKS: 35373,
MAX_COMBINED_UNIFORM_BLOCKS: 35374,
MAX_UNIFORM_BUFFER_BINDINGS: 35375,
MAX_UNIFORM_BLOCK_SIZE: 35376,
MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS: 35377,
MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS: 35379,
UNIFORM_BUFFER_OFFSET_ALIGNMENT: 35380,
ACTIVE_UNIFORM_BLOCKS: 35382,
UNIFORM_TYPE: 35383,
UNIFORM_SIZE: 35384,
UNIFORM_BLOCK_INDEX: 35386,
UNIFORM_OFFSET: 35387,
UNIFORM_ARRAY_STRIDE: 35388,
UNIFORM_MATRIX_STRIDE: 35389,
UNIFORM_IS_ROW_MAJOR: 35390,
UNIFORM_BLOCK_BINDING: 35391,
UNIFORM_BLOCK_DATA_SIZE: 35392,
UNIFORM_BLOCK_ACTIVE_UNIFORMS: 35394,
UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES: 35395,
UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER: 35396,
UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER: 35398,
INVALID_INDEX: 4294967295,
MAX_VERTEX_OUTPUT_COMPONENTS: 37154,
MAX_FRAGMENT_INPUT_COMPONENTS: 37157,
MAX_SERVER_WAIT_TIMEOUT: 37137,
OBJECT_TYPE: 37138,
SYNC_CONDITION: 37139,
SYNC_STATUS: 37140,
SYNC_FLAGS: 37141,
SYNC_FENCE: 37142,
SYNC_GPU_COMMANDS_COMPLETE: 37143,
UNSIGNALED: 37144,
SIGNALED: 37145,
ALREADY_SIGNALED: 37146,
TIMEOUT_EXPIRED: 37147,
CONDITION_SATISFIED: 37148,
WAIT_FAILED: 37149,
SYNC_FLUSH_COMMANDS_BIT: 1,
VERTEX_ATTRIB_ARRAY_DIVISOR: 35070,
ANY_SAMPLES_PASSED: 35887,
ANY_SAMPLES_PASSED_CONSERVATIVE: 36202,
SAMPLER_BINDING: 35097,
RGB10_A2UI: 36975,
INT_2_10_10_10_REV: 36255,
TRANSFORM_FEEDBACK: 36386,
TRANSFORM_FEEDBACK_PAUSED: 36387,
TRANSFORM_FEEDBACK_ACTIVE: 36388,
TRANSFORM_FEEDBACK_BINDING: 36389,
COMPRESSED_R11_EAC: 37488,
COMPRESSED_SIGNED_R11_EAC: 37489,
COMPRESSED_RG11_EAC: 37490,
COMPRESSED_SIGNED_RG11_EAC: 37491,
COMPRESSED_RGB8_ETC2: 37492,
COMPRESSED_SRGB8_ETC2: 37493,
COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2: 37494,
COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2: 37495,
COMPRESSED_RGBA8_ETC2_EAC: 37496,
COMPRESSED_SRGB8_ALPHA8_ETC2_EAC: 37497,
TEXTURE_IMMUTABLE_FORMAT: 37167,
MAX_ELEMENT_INDEX: 36203,
TEXTURE_IMMUTABLE_LEVELS: 33503,
// Extensions
MAX_TEXTURE_MAX_ANISOTROPY_EXT: 34047
};
Object.freeze(WebGLConstants);
var WebGLConstants_default = WebGLConstants;
export {
WebGLConstants_default
};
File diff suppressed because it is too large Load Diff
+693
View File
@@ -0,0 +1,693 @@
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.142.0
*
* 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 {
PolylinePipeline_default
} from "./chunk-QRWGUWI6.js";
import {
EllipsoidTangentPlane_default
} from "./chunk-SMQZZOW6.js";
import {
Quaternion_default,
Transforms_default
} from "./chunk-MYP774IS.js";
import {
Cartesian4_default,
Matrix4_default
} from "./chunk-Q3PY526V.js";
import {
Cartesian2_default,
Cartographic_default
} from "./chunk-V7VQKN6N.js";
import {
Cartesian3_default,
Matrix3_default
} from "./chunk-MPZHGZU6.js";
import {
Math_default
} from "./chunk-J6BWOHUF.js";
import {
DeveloperError_default
} from "./chunk-AYKR4VBR.js";
import {
defined_default
} from "./chunk-ZP7JMQV4.js";
// packages/engine/Source/Core/CornerType.js
var CornerType = {
/**
* <img src="Images/CornerTypeRounded.png" style="vertical-align: middle;" width="186" height="189" />
*
* Corner has a smooth edge.
* @type {number}
* @constant
*/
ROUNDED: 0,
/**
* <img src="Images/CornerTypeMitered.png" style="vertical-align: middle;" width="186" height="189" />
*
* Corner point is the intersection of adjacent edges.
* @type {number}
* @constant
*/
MITERED: 1,
/**
* <img src="Images/CornerTypeBeveled.png" style="vertical-align: middle;" width="186" height="189" />
*
* Corner is clipped.
* @type {number}
* @constant
*/
BEVELED: 2
};
Object.freeze(CornerType);
var CornerType_default = CornerType;
// packages/engine/Source/Core/oneTimeWarning.js
var warnings = {};
function oneTimeWarning(identifier, message) {
if (!defined_default(identifier)) {
throw new DeveloperError_default("identifier is required.");
}
if (!defined_default(warnings[identifier])) {
warnings[identifier] = true;
console.warn(message ?? identifier);
}
}
oneTimeWarning.geometryOutlines = "Entity geometry outlines are unsupported on terrain. Outlines will be disabled. To enable outlines, disable geometry terrain clamping by explicitly setting height to 0.";
oneTimeWarning.geometryZIndex = "Entity geometry with zIndex are unsupported when height or extrudedHeight are defined. zIndex will be ignored";
oneTimeWarning.geometryHeightReference = "Entity corridor, ellipse, polygon or rectangle with heightReference must also have a defined height. heightReference will be ignored";
oneTimeWarning.geometryExtrudedHeightReference = "Entity corridor, ellipse, polygon or rectangle with extrudedHeightReference must also have a defined extrudedHeight. extrudedHeightReference will be ignored";
var oneTimeWarning_default = oneTimeWarning;
// packages/engine/Source/Core/PolylineVolumeGeometryLibrary.js
var scratch2Array = [new Cartesian3_default(), new Cartesian3_default()];
var scratchCartesian1 = new Cartesian3_default();
var scratchCartesian2 = new Cartesian3_default();
var scratchCartesian3 = new Cartesian3_default();
var scratchCartesian4 = new Cartesian3_default();
var scratchCartesian5 = new Cartesian3_default();
var scratchCartesian6 = new Cartesian3_default();
var scratchCartesian7 = new Cartesian3_default();
var scratchCartesian8 = new Cartesian3_default();
var scratchCartesian9 = new Cartesian3_default();
var scratch1 = new Cartesian3_default();
var scratch2 = new Cartesian3_default();
var PolylineVolumeGeometryLibrary = {};
var cartographic = new Cartographic_default();
function scaleToSurface(positions, ellipsoid) {
const heights = new Array(positions.length);
for (let i = 0; i < positions.length; i++) {
const pos = positions[i];
cartographic = ellipsoid.cartesianToCartographic(pos, cartographic);
heights[i] = cartographic.height;
positions[i] = ellipsoid.scaleToGeodeticSurface(pos, pos);
}
return heights;
}
function subdivideHeights(points, h0, h1, granularity) {
const p0 = points[0];
const p1 = points[1];
const angleBetween = Cartesian3_default.angleBetween(p0, p1);
const numPoints = Math.ceil(angleBetween / granularity);
const heights = new Array(numPoints);
let i;
if (h0 === h1) {
for (i = 0; i < numPoints; i++) {
heights[i] = h0;
}
heights.push(h1);
return heights;
}
const dHeight = h1 - h0;
const heightPerVertex = dHeight / numPoints;
for (i = 1; i < numPoints; i++) {
const h = h0 + i * heightPerVertex;
heights[i] = h;
}
heights[0] = h0;
heights.push(h1);
return heights;
}
var nextScratch = new Cartesian3_default();
var prevScratch = new Cartesian3_default();
function computeRotationAngle(start, end, position, ellipsoid) {
const tangentPlane = new EllipsoidTangentPlane_default(position, ellipsoid);
const next = tangentPlane.projectPointOntoPlane(
Cartesian3_default.add(position, start, nextScratch),
nextScratch
);
const prev = tangentPlane.projectPointOntoPlane(
Cartesian3_default.add(position, end, prevScratch),
prevScratch
);
const angle = Cartesian2_default.angleBetween(next, prev);
return prev.x * next.y - prev.y * next.x >= 0 ? -angle : angle;
}
var negativeX = new Cartesian3_default(-1, 0, 0);
var transform = new Matrix4_default();
var translation = new Matrix4_default();
var rotationZ = new Matrix3_default();
var scaleMatrix = Matrix3_default.IDENTITY.clone();
var westScratch = new Cartesian3_default();
var finalPosScratch = new Cartesian4_default();
var heightCartesian = new Cartesian3_default();
function addPosition(center, left, shape, finalPositions, ellipsoid, height, xScalar, repeat) {
let west = westScratch;
let finalPosition = finalPosScratch;
transform = Transforms_default.eastNorthUpToFixedFrame(center, ellipsoid, transform);
west = Matrix4_default.multiplyByPointAsVector(transform, negativeX, west);
west = Cartesian3_default.normalize(west, west);
const angle = computeRotationAngle(west, left, center, ellipsoid);
rotationZ = Matrix3_default.fromRotationZ(angle, rotationZ);
heightCartesian.z = height;
transform = Matrix4_default.multiplyTransformation(
transform,
Matrix4_default.fromRotationTranslation(rotationZ, heightCartesian, translation),
transform
);
const scale = scaleMatrix;
scale[0] = xScalar;
for (let j = 0; j < repeat; j++) {
for (let i = 0; i < shape.length; i += 3) {
finalPosition = Cartesian3_default.fromArray(shape, i, finalPosition);
finalPosition = Matrix3_default.multiplyByVector(
scale,
finalPosition,
finalPosition
);
finalPosition = Matrix4_default.multiplyByPoint(
transform,
finalPosition,
finalPosition
);
finalPositions.push(finalPosition.x, finalPosition.y, finalPosition.z);
}
}
return finalPositions;
}
var centerScratch = new Cartesian3_default();
function addPositions(centers, left, shape, finalPositions, ellipsoid, heights, xScalar) {
for (let i = 0; i < centers.length; i += 3) {
const center = Cartesian3_default.fromArray(centers, i, centerScratch);
finalPositions = addPosition(
center,
left,
shape,
finalPositions,
ellipsoid,
heights[i / 3],
xScalar,
1
);
}
return finalPositions;
}
function convertShapeTo3DDuplicate(shape2D, boundingRectangle) {
const length = shape2D.length;
const shape = new Array(length * 6);
let index = 0;
const xOffset = boundingRectangle.x + boundingRectangle.width / 2;
const yOffset = boundingRectangle.y + boundingRectangle.height / 2;
let point = shape2D[0];
shape[index++] = point.x - xOffset;
shape[index++] = 0;
shape[index++] = point.y - yOffset;
for (let i = 1; i < length; i++) {
point = shape2D[i];
const x = point.x - xOffset;
const z = point.y - yOffset;
shape[index++] = x;
shape[index++] = 0;
shape[index++] = z;
shape[index++] = x;
shape[index++] = 0;
shape[index++] = z;
}
point = shape2D[0];
shape[index++] = point.x - xOffset;
shape[index++] = 0;
shape[index++] = point.y - yOffset;
return shape;
}
function convertShapeTo3D(shape2D, boundingRectangle) {
const length = shape2D.length;
const shape = new Array(length * 3);
let index = 0;
const xOffset = boundingRectangle.x + boundingRectangle.width / 2;
const yOffset = boundingRectangle.y + boundingRectangle.height / 2;
for (let i = 0; i < length; i++) {
shape[index++] = shape2D[i].x - xOffset;
shape[index++] = 0;
shape[index++] = shape2D[i].y - yOffset;
}
return shape;
}
var quaterion = new Quaternion_default();
var startPointScratch = new Cartesian3_default();
var rotMatrix = new Matrix3_default();
function computeRoundCorner(pivot, startPoint, endPoint, cornerType, leftIsOutside, ellipsoid, finalPositions, shape, height, duplicatePoints) {
const angle = Cartesian3_default.angleBetween(
Cartesian3_default.subtract(startPoint, pivot, scratch1),
Cartesian3_default.subtract(endPoint, pivot, scratch2)
);
const granularity = cornerType === CornerType_default.BEVELED ? 0 : Math.ceil(angle / Math_default.toRadians(5));
let m;
if (leftIsOutside) {
m = Matrix3_default.fromQuaternion(
Quaternion_default.fromAxisAngle(
Cartesian3_default.negate(pivot, scratch1),
angle / (granularity + 1),
quaterion
),
rotMatrix
);
} else {
m = Matrix3_default.fromQuaternion(
Quaternion_default.fromAxisAngle(pivot, angle / (granularity + 1), quaterion),
rotMatrix
);
}
let left;
let surfacePoint;
startPoint = Cartesian3_default.clone(startPoint, startPointScratch);
if (granularity > 0) {
const repeat = duplicatePoints ? 2 : 1;
for (let i = 0; i < granularity; i++) {
startPoint = Matrix3_default.multiplyByVector(m, startPoint, startPoint);
left = Cartesian3_default.subtract(startPoint, pivot, scratch1);
left = Cartesian3_default.normalize(left, left);
if (!leftIsOutside) {
left = Cartesian3_default.negate(left, left);
}
surfacePoint = ellipsoid.scaleToGeodeticSurface(startPoint, scratch2);
finalPositions = addPosition(
surfacePoint,
left,
shape,
finalPositions,
ellipsoid,
height,
1,
repeat
);
}
} else {
left = Cartesian3_default.subtract(startPoint, pivot, scratch1);
left = Cartesian3_default.normalize(left, left);
if (!leftIsOutside) {
left = Cartesian3_default.negate(left, left);
}
surfacePoint = ellipsoid.scaleToGeodeticSurface(startPoint, scratch2);
finalPositions = addPosition(
surfacePoint,
left,
shape,
finalPositions,
ellipsoid,
height,
1,
1
);
endPoint = Cartesian3_default.clone(endPoint, startPointScratch);
left = Cartesian3_default.subtract(endPoint, pivot, scratch1);
left = Cartesian3_default.normalize(left, left);
if (!leftIsOutside) {
left = Cartesian3_default.negate(left, left);
}
surfacePoint = ellipsoid.scaleToGeodeticSurface(endPoint, scratch2);
finalPositions = addPosition(
surfacePoint,
left,
shape,
finalPositions,
ellipsoid,
height,
1,
1
);
}
return finalPositions;
}
PolylineVolumeGeometryLibrary.removeDuplicatesFromShape = function(shapePositions) {
const length = shapePositions.length;
const cleanedPositions = [];
for (let i0 = length - 1, i1 = 0; i1 < length; i0 = i1++) {
const v0 = shapePositions[i0];
const v1 = shapePositions[i1];
if (!Cartesian2_default.equals(v0, v1)) {
cleanedPositions.push(v1);
}
}
return cleanedPositions;
};
PolylineVolumeGeometryLibrary.angleIsGreaterThanPi = function(forward, backward, position, ellipsoid) {
const tangentPlane = new EllipsoidTangentPlane_default(position, ellipsoid);
const next = tangentPlane.projectPointOntoPlane(
Cartesian3_default.add(position, forward, nextScratch),
nextScratch
);
const prev = tangentPlane.projectPointOntoPlane(
Cartesian3_default.add(position, backward, prevScratch),
prevScratch
);
return prev.x * next.y - prev.y * next.x >= 0;
};
var scratchForwardProjection = new Cartesian3_default();
var scratchBackwardProjection = new Cartesian3_default();
PolylineVolumeGeometryLibrary.computePositions = function(positions, shape2D, boundingRectangle, geometry, duplicatePoints) {
const ellipsoid = geometry._ellipsoid;
const heights = scaleToSurface(positions, ellipsoid);
const granularity = geometry._granularity;
const cornerType = geometry._cornerType;
const shapeForSides = duplicatePoints ? convertShapeTo3DDuplicate(shape2D, boundingRectangle) : convertShapeTo3D(shape2D, boundingRectangle);
const shapeForEnds = duplicatePoints ? convertShapeTo3D(shape2D, boundingRectangle) : void 0;
const heightOffset = boundingRectangle.height / 2;
const width = boundingRectangle.width / 2;
let length = positions.length;
let finalPositions = [];
let ends = duplicatePoints ? [] : void 0;
let forward = scratchCartesian1;
let backward = scratchCartesian2;
let cornerDirection = scratchCartesian3;
let surfaceNormal = scratchCartesian4;
let pivot = scratchCartesian5;
let start = scratchCartesian6;
let end = scratchCartesian7;
let left = scratchCartesian8;
let previousPosition = scratchCartesian9;
let position = positions[0];
let nextPosition = positions[1];
surfaceNormal = ellipsoid.geodeticSurfaceNormal(position, surfaceNormal);
forward = Cartesian3_default.subtract(nextPosition, position, forward);
forward = Cartesian3_default.normalize(forward, forward);
left = Cartesian3_default.cross(surfaceNormal, forward, left);
left = Cartesian3_default.normalize(left, left);
let h0 = heights[0];
let h1 = heights[1];
if (duplicatePoints) {
ends = addPosition(
position,
left,
shapeForEnds,
ends,
ellipsoid,
h0 + heightOffset,
1,
1
);
}
previousPosition = Cartesian3_default.clone(position, previousPosition);
position = nextPosition;
backward = Cartesian3_default.negate(forward, backward);
let subdividedHeights;
let subdividedPositions;
for (let i = 1; i < length - 1; i++) {
const repeat = duplicatePoints ? 2 : 1;
nextPosition = positions[i + 1];
if (position.equals(nextPosition)) {
oneTimeWarning_default(
"Positions are too close and are considered equivalent with rounding error."
);
continue;
}
forward = Cartesian3_default.subtract(nextPosition, position, forward);
forward = Cartesian3_default.normalize(forward, forward);
surfaceNormal = ellipsoid.geodeticSurfaceNormal(position, surfaceNormal);
const forwardProjection = Cartesian3_default.multiplyByScalar(
surfaceNormal,
Cartesian3_default.dot(forward, surfaceNormal),
scratchForwardProjection
);
Cartesian3_default.subtract(forward, forwardProjection, forwardProjection);
Cartesian3_default.normalize(forwardProjection, forwardProjection);
const backwardProjection = Cartesian3_default.multiplyByScalar(
surfaceNormal,
Cartesian3_default.dot(backward, surfaceNormal),
scratchBackwardProjection
);
Cartesian3_default.subtract(backward, backwardProjection, backwardProjection);
Cartesian3_default.normalize(backwardProjection, backwardProjection);
const doCorner = !Math_default.equalsEpsilon(
Math.abs(Cartesian3_default.dot(forwardProjection, backwardProjection)),
1,
Math_default.EPSILON7
);
if (doCorner) {
cornerDirection = Cartesian3_default.add(forward, backward, cornerDirection);
cornerDirection = Cartesian3_default.normalize(cornerDirection, cornerDirection);
cornerDirection = Cartesian3_default.cross(
cornerDirection,
surfaceNormal,
cornerDirection
);
cornerDirection = Cartesian3_default.cross(
surfaceNormal,
cornerDirection,
cornerDirection
);
cornerDirection = Cartesian3_default.normalize(cornerDirection, cornerDirection);
const scalar = 1 / Math.max(
0.25,
Cartesian3_default.magnitude(
Cartesian3_default.cross(cornerDirection, backward, scratch1)
)
);
const leftIsOutside = PolylineVolumeGeometryLibrary.angleIsGreaterThanPi(
forward,
backward,
position,
ellipsoid
);
if (leftIsOutside) {
pivot = Cartesian3_default.add(
position,
Cartesian3_default.multiplyByScalar(
cornerDirection,
scalar * width,
cornerDirection
),
pivot
);
start = Cartesian3_default.add(
pivot,
Cartesian3_default.multiplyByScalar(left, width, start),
start
);
scratch2Array[0] = Cartesian3_default.clone(previousPosition, scratch2Array[0]);
scratch2Array[1] = Cartesian3_default.clone(start, scratch2Array[1]);
subdividedHeights = subdivideHeights(
scratch2Array,
h0 + heightOffset,
h1 + heightOffset,
granularity
);
subdividedPositions = PolylinePipeline_default.generateArc({
positions: scratch2Array,
granularity,
ellipsoid
});
finalPositions = addPositions(
subdividedPositions,
left,
shapeForSides,
finalPositions,
ellipsoid,
subdividedHeights,
1
);
left = Cartesian3_default.cross(surfaceNormal, forward, left);
left = Cartesian3_default.normalize(left, left);
end = Cartesian3_default.add(
pivot,
Cartesian3_default.multiplyByScalar(left, width, end),
end
);
if (cornerType === CornerType_default.ROUNDED || cornerType === CornerType_default.BEVELED) {
computeRoundCorner(
pivot,
start,
end,
cornerType,
leftIsOutside,
ellipsoid,
finalPositions,
shapeForSides,
h1 + heightOffset,
duplicatePoints
);
} else {
cornerDirection = Cartesian3_default.negate(cornerDirection, cornerDirection);
finalPositions = addPosition(
position,
cornerDirection,
shapeForSides,
finalPositions,
ellipsoid,
h1 + heightOffset,
scalar,
repeat
);
}
previousPosition = Cartesian3_default.clone(end, previousPosition);
} else {
pivot = Cartesian3_default.add(
position,
Cartesian3_default.multiplyByScalar(
cornerDirection,
scalar * width,
cornerDirection
),
pivot
);
start = Cartesian3_default.add(
pivot,
Cartesian3_default.multiplyByScalar(left, -width, start),
start
);
scratch2Array[0] = Cartesian3_default.clone(previousPosition, scratch2Array[0]);
scratch2Array[1] = Cartesian3_default.clone(start, scratch2Array[1]);
subdividedHeights = subdivideHeights(
scratch2Array,
h0 + heightOffset,
h1 + heightOffset,
granularity
);
subdividedPositions = PolylinePipeline_default.generateArc({
positions: scratch2Array,
granularity,
ellipsoid
});
finalPositions = addPositions(
subdividedPositions,
left,
shapeForSides,
finalPositions,
ellipsoid,
subdividedHeights,
1
);
left = Cartesian3_default.cross(surfaceNormal, forward, left);
left = Cartesian3_default.normalize(left, left);
end = Cartesian3_default.add(
pivot,
Cartesian3_default.multiplyByScalar(left, -width, end),
end
);
if (cornerType === CornerType_default.ROUNDED || cornerType === CornerType_default.BEVELED) {
computeRoundCorner(
pivot,
start,
end,
cornerType,
leftIsOutside,
ellipsoid,
finalPositions,
shapeForSides,
h1 + heightOffset,
duplicatePoints
);
} else {
finalPositions = addPosition(
position,
cornerDirection,
shapeForSides,
finalPositions,
ellipsoid,
h1 + heightOffset,
scalar,
repeat
);
}
previousPosition = Cartesian3_default.clone(end, previousPosition);
}
backward = Cartesian3_default.negate(forward, backward);
} else {
finalPositions = addPosition(
previousPosition,
left,
shapeForSides,
finalPositions,
ellipsoid,
h0 + heightOffset,
1,
1
);
previousPosition = position;
}
h0 = h1;
h1 = heights[i + 1];
position = nextPosition;
}
scratch2Array[0] = Cartesian3_default.clone(previousPosition, scratch2Array[0]);
scratch2Array[1] = Cartesian3_default.clone(position, scratch2Array[1]);
subdividedHeights = subdivideHeights(
scratch2Array,
h0 + heightOffset,
h1 + heightOffset,
granularity
);
subdividedPositions = PolylinePipeline_default.generateArc({
positions: scratch2Array,
granularity,
ellipsoid
});
finalPositions = addPositions(
subdividedPositions,
left,
shapeForSides,
finalPositions,
ellipsoid,
subdividedHeights,
1
);
if (duplicatePoints) {
ends = addPosition(
position,
left,
shapeForEnds,
ends,
ellipsoid,
h1 + heightOffset,
1,
1
);
}
length = finalPositions.length;
const posLength = duplicatePoints ? length + ends.length : length;
const combinedPositions = new Float64Array(posLength);
combinedPositions.set(finalPositions);
if (duplicatePoints) {
combinedPositions.set(ends, length);
}
return combinedPositions;
};
var PolylineVolumeGeometryLibrary_default = PolylineVolumeGeometryLibrary;
export {
CornerType_default,
oneTimeWarning_default,
PolylineVolumeGeometryLibrary_default
};
+368
View File
@@ -0,0 +1,368 @@
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.142.0
*
* 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-IYOUHCZB.js";
import {
IndexDatatype_default
} from "./chunk-S4MCOY6I.js";
import {
GeometryAttributes_default
} from "./chunk-KSSWJIZW.js";
import {
GeometryAttribute_default,
Geometry_default,
PrimitiveType_default
} from "./chunk-EBSIOBXY.js";
import {
BoundingSphere_default
} from "./chunk-XZMBNNDX.js";
import {
ComponentDatatype_default
} from "./chunk-P3CK7MCY.js";
import {
Ellipsoid_default
} from "./chunk-V7VQKN6N.js";
import {
Cartesian3_default,
Frozen_default
} from "./chunk-MPZHGZU6.js";
import {
Math_default
} from "./chunk-J6BWOHUF.js";
import {
DeveloperError_default
} from "./chunk-AYKR4VBR.js";
import {
defined_default
} from "./chunk-ZP7JMQV4.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 = options ?? Frozen_default.EMPTY_OBJECT;
const radii = options.radii ?? defaultRadii;
const innerRadii = options.innerRadii ?? radii;
const minimumClock = options.minimumClock ?? 0;
const maximumClock = options.maximumClock ?? Math_default.TWO_PI;
const minimumCone = options.minimumCone ?? 0;
const maximumCone = options.maximumCone ?? Math_default.PI;
const stackPartitions = Math.round(options.stackPartitions ?? 10);
const slicePartitions = Math.round(options.slicePartitions ?? 8);
const subdivisions = Math.round(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 = 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] = 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 = 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
};
File diff suppressed because it is too large Load Diff
+138
View File
@@ -0,0 +1,138 @@
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.142.0
*
* 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 {
Frozen_default
} from "./chunk-MPZHGZU6.js";
import {
DeveloperError_default
} from "./chunk-AYKR4VBR.js";
import {
defined_default
} from "./chunk-ZP7JMQV4.js";
// packages/engine/Source/Core/VertexFormat.js
function VertexFormat(options) {
options = options ?? Frozen_default.EMPTY_OBJECT;
this.position = options.position ?? false;
this.normal = options.normal ?? false;
this.st = options.st ?? false;
this.bitangent = options.bitangent ?? false;
this.tangent = options.tangent ?? false;
this.color = 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 = 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 = 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
};
+789
View File
@@ -0,0 +1,789 @@
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.142.0
*
* 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 {
AttributeCompression_default
} from "./chunk-7J2HKPRH.js";
import {
BoundingSphere_default
} from "./chunk-XZMBNNDX.js";
import {
Rectangle_default
} from "./chunk-MYP774IS.js";
import {
Matrix4_default
} from "./chunk-Q3PY526V.js";
import {
ComponentDatatype_default
} from "./chunk-P3CK7MCY.js";
import {
Cartesian2_default,
Cartographic_default,
Ellipsoid_default
} from "./chunk-V7VQKN6N.js";
import {
Cartesian3_default
} from "./chunk-MPZHGZU6.js";
import {
Math_default
} from "./chunk-J6BWOHUF.js";
import {
Check_default,
DeveloperError_default
} from "./chunk-AYKR4VBR.js";
import {
defined_default
} from "./chunk-ZP7JMQV4.js";
// packages/engine/Source/Core/EllipsoidalOccluder.js
function EllipsoidalOccluder(ellipsoid, cameraPosition) {
Check_default.typeOf.object("ellipsoid", ellipsoid);
this._ellipsoid = ellipsoid;
this._cameraPosition = new Cartesian3_default();
this._cameraPositionInScaledSpace = new Cartesian3_default();
this._distanceToLimbInScaledSpaceSquared = 0;
if (defined_default(cameraPosition)) {
this.cameraPosition = cameraPosition;
}
}
Object.defineProperties(EllipsoidalOccluder.prototype, {
/**
* Gets the occluding ellipsoid.
* @memberof EllipsoidalOccluder.prototype
* @type {Ellipsoid}
*/
ellipsoid: {
get: function() {
return this._ellipsoid;
}
},
/**
* Gets or sets the position of the camera.
* @memberof EllipsoidalOccluder.prototype
* @type {Cartesian3}
*/
cameraPosition: {
get: function() {
return this._cameraPosition;
},
set: function(cameraPosition) {
const ellipsoid = this._ellipsoid;
const cv = ellipsoid.transformPositionToScaledSpace(
cameraPosition,
this._cameraPositionInScaledSpace
);
const vhMagnitudeSquared = Cartesian3_default.magnitudeSquared(cv) - 1;
Cartesian3_default.clone(cameraPosition, this._cameraPosition);
this._cameraPositionInScaledSpace = cv;
this._distanceToLimbInScaledSpaceSquared = vhMagnitudeSquared;
}
}
});
var scratchCartesian = new Cartesian3_default();
EllipsoidalOccluder.prototype.isPointVisible = function(occludee) {
const ellipsoid = this._ellipsoid;
const occludeeScaledSpacePosition = ellipsoid.transformPositionToScaledSpace(
occludee,
scratchCartesian
);
return isScaledSpacePointVisible(
occludeeScaledSpacePosition,
this._cameraPositionInScaledSpace,
this._distanceToLimbInScaledSpaceSquared
);
};
EllipsoidalOccluder.prototype.isScaledSpacePointVisible = function(occludeeScaledSpacePosition) {
return isScaledSpacePointVisible(
occludeeScaledSpacePosition,
this._cameraPositionInScaledSpace,
this._distanceToLimbInScaledSpaceSquared
);
};
var scratchCameraPositionInScaledSpaceShrunk = new Cartesian3_default();
EllipsoidalOccluder.prototype.isScaledSpacePointVisiblePossiblyUnderEllipsoid = function(occludeeScaledSpacePosition, minimumHeight) {
const ellipsoid = this._ellipsoid;
let vhMagnitudeSquared;
let cv;
if (defined_default(minimumHeight) && minimumHeight < 0 && ellipsoid.minimumRadius > -minimumHeight) {
cv = scratchCameraPositionInScaledSpaceShrunk;
cv.x = this._cameraPosition.x / (ellipsoid.radii.x + minimumHeight);
cv.y = this._cameraPosition.y / (ellipsoid.radii.y + minimumHeight);
cv.z = this._cameraPosition.z / (ellipsoid.radii.z + minimumHeight);
vhMagnitudeSquared = cv.x * cv.x + cv.y * cv.y + cv.z * cv.z - 1;
} else {
cv = this._cameraPositionInScaledSpace;
vhMagnitudeSquared = this._distanceToLimbInScaledSpaceSquared;
}
return isScaledSpacePointVisible(
occludeeScaledSpacePosition,
cv,
vhMagnitudeSquared
);
};
EllipsoidalOccluder.prototype.computeHorizonCullingPoint = function(directionToPoint, positions, result) {
return computeHorizonCullingPointFromPositions(
this._ellipsoid,
directionToPoint,
positions,
result
);
};
var scratchEllipsoidShrunk = Ellipsoid_default.clone(Ellipsoid_default.UNIT_SPHERE);
EllipsoidalOccluder.prototype.computeHorizonCullingPointPossiblyUnderEllipsoid = function(directionToPoint, positions, minimumHeight, result) {
const possiblyShrunkEllipsoid = getPossiblyShrunkEllipsoid(
this._ellipsoid,
minimumHeight,
scratchEllipsoidShrunk
);
return computeHorizonCullingPointFromPositions(
possiblyShrunkEllipsoid,
directionToPoint,
positions,
result
);
};
EllipsoidalOccluder.prototype.computeHorizonCullingPointFromVertices = function(directionToPoint, vertices, stride, center, result) {
return computeHorizonCullingPointFromVertices(
this._ellipsoid,
directionToPoint,
vertices,
stride,
center,
result
);
};
EllipsoidalOccluder.prototype.computeHorizonCullingPointFromVerticesPossiblyUnderEllipsoid = function(directionToPoint, vertices, stride, center, minimumHeight, result) {
const possiblyShrunkEllipsoid = getPossiblyShrunkEllipsoid(
this._ellipsoid,
minimumHeight,
scratchEllipsoidShrunk
);
return computeHorizonCullingPointFromVertices(
possiblyShrunkEllipsoid,
directionToPoint,
vertices,
stride,
center,
result
);
};
var subsampleScratch = [];
EllipsoidalOccluder.prototype.computeHorizonCullingPointFromRectangle = function(rectangle, ellipsoid, result) {
Check_default.typeOf.object("rectangle", rectangle);
const positions = Rectangle_default.subsample(
rectangle,
ellipsoid,
0,
subsampleScratch
);
const bs = BoundingSphere_default.fromPoints(positions);
if (Cartesian3_default.magnitude(bs.center) < 0.1 * ellipsoid.minimumRadius) {
return void 0;
}
return this.computeHorizonCullingPoint(bs.center, positions, result);
};
var scratchEllipsoidShrunkRadii = new Cartesian3_default();
function getPossiblyShrunkEllipsoid(ellipsoid, minimumHeight, result) {
if (defined_default(minimumHeight) && minimumHeight < 0 && ellipsoid.minimumRadius > -minimumHeight) {
const ellipsoidShrunkRadii = Cartesian3_default.fromElements(
ellipsoid.radii.x + minimumHeight,
ellipsoid.radii.y + minimumHeight,
ellipsoid.radii.z + minimumHeight,
scratchEllipsoidShrunkRadii
);
ellipsoid = Ellipsoid_default.fromCartesian3(ellipsoidShrunkRadii, result);
}
return ellipsoid;
}
function computeHorizonCullingPointFromPositions(ellipsoid, directionToPoint, positions, result) {
Check_default.typeOf.object("directionToPoint", directionToPoint);
Check_default.defined("positions", positions);
if (!defined_default(result)) {
result = new Cartesian3_default();
}
const scaledSpaceDirectionToPoint = computeScaledSpaceDirectionToPoint(
ellipsoid,
directionToPoint
);
let resultMagnitude = 0;
for (let i = 0, len = positions.length; i < len; ++i) {
const position = positions[i];
const candidateMagnitude = computeMagnitude(
ellipsoid,
position,
scaledSpaceDirectionToPoint
);
if (candidateMagnitude < 0) {
return void 0;
}
resultMagnitude = Math.max(resultMagnitude, candidateMagnitude);
}
return magnitudeToPoint(scaledSpaceDirectionToPoint, resultMagnitude, result);
}
var positionScratch = new Cartesian3_default();
function computeHorizonCullingPointFromVertices(ellipsoid, directionToPoint, vertices, stride, center, result) {
Check_default.typeOf.object("directionToPoint", directionToPoint);
Check_default.defined("vertices", vertices);
Check_default.typeOf.number("stride", stride);
if (!defined_default(result)) {
result = new Cartesian3_default();
}
stride = stride ?? 3;
center = center ?? Cartesian3_default.ZERO;
const scaledSpaceDirectionToPoint = computeScaledSpaceDirectionToPoint(
ellipsoid,
directionToPoint
);
let resultMagnitude = 0;
for (let i = 0, len = vertices.length; i < len; i += stride) {
positionScratch.x = vertices[i] + center.x;
positionScratch.y = vertices[i + 1] + center.y;
positionScratch.z = vertices[i + 2] + center.z;
const candidateMagnitude = computeMagnitude(
ellipsoid,
positionScratch,
scaledSpaceDirectionToPoint
);
if (candidateMagnitude < 0) {
return void 0;
}
resultMagnitude = Math.max(resultMagnitude, candidateMagnitude);
}
return magnitudeToPoint(scaledSpaceDirectionToPoint, resultMagnitude, result);
}
function isScaledSpacePointVisible(occludeeScaledSpacePosition, cameraPositionInScaledSpace, distanceToLimbInScaledSpaceSquared) {
const cv = cameraPositionInScaledSpace;
const vhMagnitudeSquared = distanceToLimbInScaledSpaceSquared;
const vt = Cartesian3_default.subtract(
occludeeScaledSpacePosition,
cv,
scratchCartesian
);
const vtDotVc = -Cartesian3_default.dot(vt, cv);
const isOccluded = vhMagnitudeSquared < 0 ? vtDotVc > 0 : vtDotVc > vhMagnitudeSquared && vtDotVc * vtDotVc / Cartesian3_default.magnitudeSquared(vt) > vhMagnitudeSquared;
return !isOccluded;
}
var scaledSpaceScratch = new Cartesian3_default();
var directionScratch = new Cartesian3_default();
function computeMagnitude(ellipsoid, position, scaledSpaceDirectionToPoint) {
const scaledSpacePosition = ellipsoid.transformPositionToScaledSpace(
position,
scaledSpaceScratch
);
let magnitudeSquared = Cartesian3_default.magnitudeSquared(scaledSpacePosition);
let magnitude = Math.sqrt(magnitudeSquared);
const direction = Cartesian3_default.divideByScalar(
scaledSpacePosition,
magnitude,
directionScratch
);
magnitudeSquared = Math.max(1, magnitudeSquared);
magnitude = Math.max(1, magnitude);
const cosAlpha = Cartesian3_default.dot(direction, scaledSpaceDirectionToPoint);
const sinAlpha = Cartesian3_default.magnitude(
Cartesian3_default.cross(direction, scaledSpaceDirectionToPoint, direction)
);
const cosBeta = 1 / magnitude;
const sinBeta = Math.sqrt(magnitudeSquared - 1) * cosBeta;
return 1 / (cosAlpha * cosBeta - sinAlpha * sinBeta);
}
function magnitudeToPoint(scaledSpaceDirectionToPoint, resultMagnitude, result) {
if (resultMagnitude <= 0 || resultMagnitude === 1 / 0 || resultMagnitude !== resultMagnitude) {
return void 0;
}
return Cartesian3_default.multiplyByScalar(
scaledSpaceDirectionToPoint,
resultMagnitude,
result
);
}
var directionToPointScratch = new Cartesian3_default();
function computeScaledSpaceDirectionToPoint(ellipsoid, directionToPoint) {
if (Cartesian3_default.equals(directionToPoint, Cartesian3_default.ZERO)) {
return directionToPoint;
}
ellipsoid.transformPositionToScaledSpace(
directionToPoint,
directionToPointScratch
);
return Cartesian3_default.normalize(directionToPointScratch, directionToPointScratch);
}
var EllipsoidalOccluder_default = EllipsoidalOccluder;
// packages/engine/Source/Core/VerticalExaggeration.js
var VerticalExaggeration = {};
VerticalExaggeration.getHeight = function(height, scale, relativeHeight) {
if (!Number.isFinite(scale)) {
throw new DeveloperError_default("scale must be a finite number.");
}
if (!Number.isFinite(relativeHeight)) {
throw new DeveloperError_default("relativeHeight must be a finite number.");
}
return (height - relativeHeight) * scale + relativeHeight;
};
var scratchCartographic = new Cartographic_default();
VerticalExaggeration.getPosition = function(position, ellipsoid, verticalExaggeration, verticalExaggerationRelativeHeight, result) {
const cartographic = ellipsoid.cartesianToCartographic(
position,
scratchCartographic
);
if (!defined_default(cartographic)) {
return Cartesian3_default.clone(position, result);
}
const newHeight = VerticalExaggeration.getHeight(
cartographic.height,
verticalExaggeration,
verticalExaggerationRelativeHeight
);
return Cartesian3_default.fromRadians(
cartographic.longitude,
cartographic.latitude,
newHeight,
ellipsoid,
result
);
};
var VerticalExaggeration_default = VerticalExaggeration;
// packages/engine/Source/Core/TerrainQuantization.js
var TerrainQuantization = {
/**
* The vertices are not compressed.
*
* @type {number}
* @constant
*/
NONE: 0,
/**
* The vertices are compressed to 12 bits.
*
* @type {number}
* @constant
*/
BITS12: 1
};
Object.freeze(TerrainQuantization);
var TerrainQuantization_default = TerrainQuantization;
// packages/engine/Source/Core/TerrainEncoding.js
var cartesian3Scratch = new Cartesian3_default();
var cartesian3DimScratch = new Cartesian3_default();
var cartesian2Scratch = new Cartesian2_default();
var matrix4Scratch = new Matrix4_default();
var matrix4Scratch2 = new Matrix4_default();
var SHIFT_LEFT_12 = Math.pow(2, 12);
function TerrainEncoding(center, axisAlignedBoundingBox, minimumHeight, maximumHeight, fromENU, hasVertexNormals, hasWebMercatorT, hasGeodeticSurfaceNormals, exaggeration, exaggerationRelativeHeight) {
let quantization = TerrainQuantization_default.NONE;
let toENU;
let matrix;
if (defined_default(axisAlignedBoundingBox) && defined_default(minimumHeight) && defined_default(maximumHeight) && defined_default(fromENU)) {
const minimum = axisAlignedBoundingBox.minimum;
const maximum = axisAlignedBoundingBox.maximum;
const dimensions = Cartesian3_default.subtract(
maximum,
minimum,
cartesian3DimScratch
);
const hDim = maximumHeight - minimumHeight;
const maxDim = Math.max(Cartesian3_default.maximumComponent(dimensions), hDim);
if (maxDim < SHIFT_LEFT_12 - 1) {
quantization = TerrainQuantization_default.BITS12;
} else {
quantization = TerrainQuantization_default.NONE;
}
let st = Matrix4_default.fromScale(dimensions, matrix4Scratch);
st = Matrix4_default.setTranslation(st, minimum, st);
let invSt = Matrix4_default.fromScale(
Cartesian3_default.fromElements(
1 / dimensions.x,
1 / dimensions.y,
1 / dimensions.z,
cartesian3Scratch
),
matrix4Scratch2
);
invSt = Matrix4_default.multiplyByTranslation(
invSt,
Cartesian3_default.negate(minimum, cartesian3Scratch),
invSt
);
matrix = Matrix4_default.clone(fromENU, new Matrix4_default());
let rtcOffset = Matrix4_default.getTranslation(fromENU, cartesian3Scratch);
rtcOffset = Cartesian3_default.subtract(rtcOffset, center, cartesian3Scratch);
matrix = Matrix4_default.setTranslation(matrix, rtcOffset, matrix);
matrix = Matrix4_default.multiply(matrix, st, matrix);
toENU = Matrix4_default.inverseTransformation(fromENU, new Matrix4_default());
toENU = Matrix4_default.multiply(invSt, toENU, toENU);
fromENU = Matrix4_default.multiply(fromENU, st, new Matrix4_default());
}
this.quantization = quantization;
this.minimumHeight = minimumHeight;
this.maximumHeight = maximumHeight;
this.center = Cartesian3_default.clone(center);
this.toScaledENU = toENU;
this.fromScaledENU = fromENU;
this.matrix = matrix;
this.hasVertexNormals = hasVertexNormals ?? false;
this.hasWebMercatorT = hasWebMercatorT ?? false;
this.hasGeodeticSurfaceNormals = hasGeodeticSurfaceNormals ?? false;
this.exaggeration = exaggeration ?? 1;
this.exaggerationRelativeHeight = exaggerationRelativeHeight ?? 0;
this.stride = 0;
this._offsetGeodeticSurfaceNormal = 0;
this._offsetVertexNormal = 0;
this._calculateStrideAndOffsets();
}
TerrainEncoding.prototype.encode = function(vertexBuffer, bufferIndex, position, uv, height, normalToPack, webMercatorT, geodeticSurfaceNormal) {
Check_default.typeOf.object("vertexBuffer", vertexBuffer);
Check_default.typeOf.number("bufferIndex", bufferIndex);
Check_default.typeOf.object("position", position);
Check_default.typeOf.object("uv", uv);
Check_default.typeOf.number("height", height);
const u = uv.x;
const v = uv.y;
if (this.quantization === TerrainQuantization_default.BITS12) {
position = Matrix4_default.multiplyByPoint(
this.toScaledENU,
position,
cartesian3Scratch
);
position.x = Math_default.clamp(position.x, 0, 1);
position.y = Math_default.clamp(position.y, 0, 1);
position.z = Math_default.clamp(position.z, 0, 1);
const hDim = this.maximumHeight - this.minimumHeight;
const h = Math_default.clamp((height - this.minimumHeight) / hDim, 0, 1);
Cartesian2_default.fromElements(position.x, position.y, cartesian2Scratch);
const compressed0 = AttributeCompression_default.compressTextureCoordinates(cartesian2Scratch);
Cartesian2_default.fromElements(position.z, h, cartesian2Scratch);
const compressed1 = AttributeCompression_default.compressTextureCoordinates(cartesian2Scratch);
Cartesian2_default.fromElements(u, v, cartesian2Scratch);
const compressed2 = AttributeCompression_default.compressTextureCoordinates(cartesian2Scratch);
vertexBuffer[bufferIndex++] = compressed0;
vertexBuffer[bufferIndex++] = compressed1;
vertexBuffer[bufferIndex++] = compressed2;
if (this.hasWebMercatorT) {
Cartesian2_default.fromElements(webMercatorT, 0, cartesian2Scratch);
const compressed3 = AttributeCompression_default.compressTextureCoordinates(cartesian2Scratch);
vertexBuffer[bufferIndex++] = compressed3;
}
} else {
vertexBuffer[bufferIndex++] = position.x - this.center.x;
vertexBuffer[bufferIndex++] = position.y - this.center.y;
vertexBuffer[bufferIndex++] = position.z - this.center.z;
vertexBuffer[bufferIndex++] = height;
vertexBuffer[bufferIndex++] = u;
vertexBuffer[bufferIndex++] = v;
if (this.hasWebMercatorT) {
vertexBuffer[bufferIndex++] = webMercatorT;
}
}
if (this.hasVertexNormals) {
vertexBuffer[bufferIndex++] = AttributeCompression_default.octPackFloat(normalToPack);
}
if (this.hasGeodeticSurfaceNormals) {
vertexBuffer[bufferIndex++] = geodeticSurfaceNormal.x;
vertexBuffer[bufferIndex++] = geodeticSurfaceNormal.y;
vertexBuffer[bufferIndex++] = geodeticSurfaceNormal.z;
}
return bufferIndex;
};
var scratchPosition = new Cartesian3_default();
var scratchGeodeticSurfaceNormal = new Cartesian3_default();
TerrainEncoding.prototype.addGeodeticSurfaceNormals = function(oldBuffer, newBuffer, ellipsoid) {
Check_default.typeOf.object("oldBuffer", oldBuffer);
Check_default.typeOf.object("newBuffer", newBuffer);
Check_default.typeOf.object("ellipsoid", ellipsoid);
if (this.hasGeodeticSurfaceNormals) {
return;
}
const oldStride = this.stride;
const vertexCount = oldBuffer.length / oldStride;
this.hasGeodeticSurfaceNormals = true;
this._calculateStrideAndOffsets();
const newStride = this.stride;
for (let index = 0; index < vertexCount; index++) {
for (let offset = 0; offset < oldStride; offset++) {
const oldIndex = index * oldStride + offset;
const newIndex = index * newStride + offset;
newBuffer[newIndex] = oldBuffer[oldIndex];
}
const position = this.decodePosition(newBuffer, index, scratchPosition);
const geodeticSurfaceNormal = ellipsoid.geodeticSurfaceNormal(
position,
scratchGeodeticSurfaceNormal
);
const bufferIndex = index * newStride + this._offsetGeodeticSurfaceNormal;
newBuffer[bufferIndex] = geodeticSurfaceNormal.x;
newBuffer[bufferIndex + 1] = geodeticSurfaceNormal.y;
newBuffer[bufferIndex + 2] = geodeticSurfaceNormal.z;
}
};
TerrainEncoding.prototype.removeGeodeticSurfaceNormals = function(oldBuffer, newBuffer) {
Check_default.typeOf.object("oldBuffer", oldBuffer);
Check_default.typeOf.object("newBuffer", newBuffer);
if (!this.hasGeodeticSurfaceNormals) {
return;
}
const oldStride = this.stride;
const vertexCount = oldBuffer.length / oldStride;
this.hasGeodeticSurfaceNormals = false;
this._calculateStrideAndOffsets();
const newStride = this.stride;
for (let index = 0; index < vertexCount; index++) {
for (let offset = 0; offset < newStride; offset++) {
const oldIndex = index * oldStride + offset;
const newIndex = index * newStride + offset;
newBuffer[newIndex] = oldBuffer[oldIndex];
}
}
};
TerrainEncoding.prototype.decodePosition = function(buffer, index, result) {
Check_default.typeOf.object("buffer", buffer);
Check_default.typeOf.number("index", index);
if (!defined_default(result)) {
result = new Cartesian3_default();
}
index *= this.stride;
if (this.quantization === TerrainQuantization_default.BITS12) {
const xy = AttributeCompression_default.decompressTextureCoordinates(
buffer[index],
cartesian2Scratch
);
result.x = xy.x;
result.y = xy.y;
const zh = AttributeCompression_default.decompressTextureCoordinates(
buffer[index + 1],
cartesian2Scratch
);
result.z = zh.x;
return Matrix4_default.multiplyByPoint(this.fromScaledENU, result, result);
}
result.x = buffer[index];
result.y = buffer[index + 1];
result.z = buffer[index + 2];
return Cartesian3_default.add(result, this.center, result);
};
TerrainEncoding.prototype.getExaggeratedPosition = function(buffer, index, result) {
result = this.decodePosition(buffer, index, result);
const exaggeration = this.exaggeration;
const exaggerationRelativeHeight = this.exaggerationRelativeHeight;
const hasExaggeration = exaggeration !== 1;
if (hasExaggeration && this.hasGeodeticSurfaceNormals) {
const geodeticSurfaceNormal = this.decodeGeodeticSurfaceNormal(
buffer,
index,
scratchGeodeticSurfaceNormal
);
const rawHeight = this.decodeHeight(buffer, index);
const heightDifference = VerticalExaggeration_default.getHeight(
rawHeight,
exaggeration,
exaggerationRelativeHeight
) - rawHeight;
result.x += geodeticSurfaceNormal.x * heightDifference;
result.y += geodeticSurfaceNormal.y * heightDifference;
result.z += geodeticSurfaceNormal.z * heightDifference;
}
return result;
};
TerrainEncoding.prototype.decodeTextureCoordinates = function(buffer, index, result) {
Check_default.typeOf.object("buffer", buffer);
Check_default.typeOf.number("index", index);
if (!defined_default(result)) {
result = new Cartesian2_default();
}
index *= this.stride;
if (this.quantization === TerrainQuantization_default.BITS12) {
return AttributeCompression_default.decompressTextureCoordinates(
buffer[index + 2],
result
);
}
return Cartesian2_default.fromElements(buffer[index + 4], buffer[index + 5], result);
};
TerrainEncoding.prototype.decodeHeight = function(buffer, index) {
Check_default.typeOf.object("buffer", buffer);
Check_default.typeOf.number("index", index);
index *= this.stride;
if (this.quantization === TerrainQuantization_default.BITS12) {
const zh = AttributeCompression_default.decompressTextureCoordinates(
buffer[index + 1],
cartesian2Scratch
);
return zh.y * (this.maximumHeight - this.minimumHeight) + this.minimumHeight;
}
return buffer[index + 3];
};
TerrainEncoding.prototype.decodeWebMercatorT = function(buffer, index) {
Check_default.typeOf.object("buffer", buffer);
Check_default.typeOf.number("index", index);
index *= this.stride;
if (this.quantization === TerrainQuantization_default.BITS12) {
return AttributeCompression_default.decompressTextureCoordinates(
buffer[index + 3],
cartesian2Scratch
).x;
}
return buffer[index + 6];
};
TerrainEncoding.prototype.getOctEncodedNormal = function(buffer, index, result) {
Check_default.typeOf.object("buffer", buffer);
Check_default.typeOf.number("index", index);
index = index * this.stride + this._offsetVertexNormal;
const temp = buffer[index] / 256;
const x = Math.floor(temp);
const y = (temp - x) * 256;
return Cartesian2_default.fromElements(x, y, result);
};
TerrainEncoding.prototype.decodeNormal = function(buffer, index, result) {
Check_default.typeOf.object("buffer", buffer);
Check_default.typeOf.number("index", index);
Check_default.typeOf.object("result", result);
const bufferIndex = index = index * this.stride + this._offsetVertexNormal;
return AttributeCompression_default.octDecodeFloat(buffer[bufferIndex], result);
};
TerrainEncoding.prototype.decodeGeodeticSurfaceNormal = function(buffer, index, result) {
Check_default.typeOf.object("buffer", buffer);
Check_default.typeOf.number("index", index);
Check_default.typeOf.object("result", result);
index = index * this.stride + this._offsetGeodeticSurfaceNormal;
result.x = buffer[index];
result.y = buffer[index + 1];
result.z = buffer[index + 2];
return result;
};
TerrainEncoding.prototype._calculateStrideAndOffsets = function() {
let vertexStride = 0;
switch (this.quantization) {
case TerrainQuantization_default.BITS12:
vertexStride += 3;
break;
default:
vertexStride += 6;
}
if (this.hasWebMercatorT) {
vertexStride += 1;
}
if (this.hasVertexNormals) {
this._offsetVertexNormal = vertexStride;
vertexStride += 1;
}
if (this.hasGeodeticSurfaceNormals) {
this._offsetGeodeticSurfaceNormal = vertexStride;
vertexStride += 3;
}
this.stride = vertexStride;
};
var attributesIndicesNone = {
position3DAndHeight: 0,
textureCoordAndEncodedNormals: 1,
geodeticSurfaceNormal: 2
};
var attributesIndicesBits12 = {
compressed0: 0,
compressed1: 1,
geodeticSurfaceNormal: 2
};
TerrainEncoding.prototype.getAttributes = function(buffer) {
Check_default.typeOf.object("buffer", buffer);
const datatype = ComponentDatatype_default.FLOAT;
const sizeInBytes = ComponentDatatype_default.getSizeInBytes(datatype);
const strideInBytes = this.stride * sizeInBytes;
let offsetInBytes = 0;
const attributes = [];
function addAttribute(index, componentsPerAttribute) {
attributes.push({
index,
vertexBuffer: buffer,
componentDatatype: datatype,
componentsPerAttribute,
offsetInBytes,
strideInBytes
});
offsetInBytes += componentsPerAttribute * sizeInBytes;
}
if (this.quantization === TerrainQuantization_default.NONE) {
addAttribute(attributesIndicesNone.position3DAndHeight, 4);
let componentsTexCoordAndNormals = 2;
componentsTexCoordAndNormals += this.hasWebMercatorT ? 1 : 0;
componentsTexCoordAndNormals += this.hasVertexNormals ? 1 : 0;
addAttribute(
attributesIndicesNone.textureCoordAndEncodedNormals,
componentsTexCoordAndNormals
);
if (this.hasGeodeticSurfaceNormals) {
addAttribute(attributesIndicesNone.geodeticSurfaceNormal, 3);
}
} else {
const usingAttribute0Component4 = this.hasWebMercatorT || this.hasVertexNormals;
const usingAttribute1Component1 = this.hasWebMercatorT && this.hasVertexNormals;
addAttribute(
attributesIndicesBits12.compressed0,
usingAttribute0Component4 ? 4 : 3
);
if (usingAttribute1Component1) {
addAttribute(attributesIndicesBits12.compressed1, 1);
}
if (this.hasGeodeticSurfaceNormals) {
addAttribute(attributesIndicesBits12.geodeticSurfaceNormal, 3);
}
}
return attributes;
};
TerrainEncoding.prototype.getAttributeLocations = function() {
if (this.quantization === TerrainQuantization_default.NONE) {
return attributesIndicesNone;
}
return attributesIndicesBits12;
};
TerrainEncoding.clone = function(encoding, result) {
if (!defined_default(encoding)) {
return void 0;
}
if (!defined_default(result)) {
result = new TerrainEncoding();
}
result.quantization = encoding.quantization;
result.minimumHeight = encoding.minimumHeight;
result.maximumHeight = encoding.maximumHeight;
result.center = Cartesian3_default.clone(encoding.center);
result.toScaledENU = Matrix4_default.clone(encoding.toScaledENU);
result.fromScaledENU = Matrix4_default.clone(encoding.fromScaledENU);
result.matrix = Matrix4_default.clone(encoding.matrix);
result.hasVertexNormals = encoding.hasVertexNormals;
result.hasWebMercatorT = encoding.hasWebMercatorT;
result.hasGeodeticSurfaceNormals = encoding.hasGeodeticSurfaceNormals;
result.exaggeration = encoding.exaggeration;
result.exaggerationRelativeHeight = encoding.exaggerationRelativeHeight;
result._calculateStrideAndOffsets();
return result;
};
var TerrainEncoding_default = TerrainEncoding;
export {
EllipsoidalOccluder_default,
VerticalExaggeration_default,
TerrainEncoding_default
};
File diff suppressed because it is too large Load Diff
+102
View File
@@ -0,0 +1,102 @@
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.142.0
*
* 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-MPZHGZU6.js";
import {
Check_default
} from "./chunk-AYKR4VBR.js";
import {
defined_default
} from "./chunk-ZP7JMQV4.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
};
+58
View File
@@ -0,0 +1,58 @@
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.142.0
*
* 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-ZP7JMQV4.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
};
+305
View File
@@ -0,0 +1,305 @@
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.142.0
*
* 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-MYP774IS.js";
import {
Cartesian3_default,
Matrix3_default
} from "./chunk-MPZHGZU6.js";
import {
Math_default
} from "./chunk-J6BWOHUF.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
};
+778
View File
@@ -0,0 +1,778 @@
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.142.0
*
* 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-4MGMYHOO.js";
import {
GeometryPipeline_default
} from "./chunk-ACXQXN46.js";
import {
IndexDatatype_default
} from "./chunk-S4MCOY6I.js";
import {
GeometryAttributes_default
} from "./chunk-KSSWJIZW.js";
import {
GeometryAttribute_default,
Geometry_default
} from "./chunk-EBSIOBXY.js";
import {
BoundingSphere_default,
GeographicProjection_default
} from "./chunk-XZMBNNDX.js";
import {
Matrix4_default
} from "./chunk-Q3PY526V.js";
import {
ComponentDatatype_default
} from "./chunk-P3CK7MCY.js";
import {
Ellipsoid_default
} from "./chunk-V7VQKN6N.js";
import {
Check_default,
DeveloperError_default
} from "./chunk-AYKR4VBR.js";
import {
defined_default
} from "./chunk-ZP7JMQV4.js";
// packages/engine/Source/Core/OffsetGeometryInstanceAttribute.js
function OffsetGeometryInstanceAttribute(x, y, z) {
x = x ?? 0;
y = y ?? 0;
z = 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++] = 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
};
+78
View File
@@ -0,0 +1,78 @@
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.142.0
*
* 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.
*/
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
}) : x)(function(x) {
if (typeof require !== "undefined") return require.apply(this, arguments);
throw Error('Dynamic require of "' + x + '" is not supported');
});
var __glob = (map) => (path) => {
var fn = map[path];
if (fn) return fn();
throw new Error("Module not found in bundle: " + path);
};
var __commonJS = (cb, mod) => function __require2() {
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
// packages/engine/Source/Core/defined.js
function defined(value) {
return value !== void 0 && value !== null;
}
var defined_default = defined;
export {
__require,
__glob,
__commonJS,
__toESM,
__publicField,
defined_default
};
+280
View File
@@ -0,0 +1,280 @@
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.142.0
*
* 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.
*/
// node_modules/@cesium/wasm-splats/wasm_splats.js
var wasm;
var cachedTextDecoder = typeof TextDecoder !== "undefined" ? new TextDecoder("utf-8", { ignoreBOM: true, fatal: true }) : { decode: () => {
throw Error("TextDecoder not available");
} };
if (typeof TextDecoder !== "undefined") {
cachedTextDecoder.decode();
}
var cachedUint8ArrayMemory0 = null;
function getUint8ArrayMemory0() {
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
}
return cachedUint8ArrayMemory0;
}
function getStringFromWasm0(ptr, len) {
ptr = ptr >>> 0;
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
}
var cachedUint32ArrayMemory0 = null;
function getUint32ArrayMemory0() {
if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
}
return cachedUint32ArrayMemory0;
}
function getArrayU32FromWasm0(ptr, len) {
ptr = ptr >>> 0;
return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
}
var WASM_VECTOR_LEN = 0;
function passArray32ToWasm0(arg, malloc) {
const ptr = malloc(arg.length * 4, 4) >>> 0;
getUint32ArrayMemory0().set(arg, ptr / 4);
WASM_VECTOR_LEN = arg.length;
return ptr;
}
function takeFromExternrefTable0(idx) {
const value = wasm.__wbindgen_export_0.get(idx);
wasm.__externref_table_dealloc(idx);
return value;
}
function generate_splat_texture(positions, scales, rotations, colors, count) {
const ret = wasm.generate_splat_texture(positions, scales, rotations, colors, count);
if (ret[2]) {
throw takeFromExternrefTable0(ret[1]);
}
return TextureData.__wrap(ret[0]);
}
function radix_sort_gaussians_indexes(positions_arr, model_view_arr, count) {
const ret = wasm.radix_sort_gaussians_indexes(positions_arr, model_view_arr, count);
if (ret[2]) {
throw takeFromExternrefTable0(ret[1]);
}
return takeFromExternrefTable0(ret[0]);
}
var TextureDataFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
}, unregister: () => {
} } : new FinalizationRegistry((ptr) => wasm.__wbg_texturedata_free(ptr >>> 0, 1));
var TextureData = class _TextureData {
static __wrap(ptr) {
ptr = ptr >>> 0;
const obj = Object.create(_TextureData.prototype);
obj.__wbg_ptr = ptr;
TextureDataFinalization.register(obj, obj.__wbg_ptr, obj);
return obj;
}
__destroy_into_raw() {
const ptr = this.__wbg_ptr;
this.__wbg_ptr = 0;
TextureDataFinalization.unregister(this);
return ptr;
}
free() {
const ptr = this.__destroy_into_raw();
wasm.__wbg_texturedata_free(ptr, 0);
}
/**
* Getter for the underlying texture data. Always returns a copy.
* @returns {Uint32Array}
*/
get data() {
const ret = wasm.texturedata_data(this.__wbg_ptr);
var v1 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
return v1;
}
/**
* Getter for the width of the texture in pixels.
* @returns {number}
*/
get width() {
const ret = wasm.texturedata_width(this.__wbg_ptr);
return ret >>> 0;
}
/**
* Getter for the height of the texture in pixels.
* @returns {number}
*/
get height() {
const ret = wasm.texturedata_height(this.__wbg_ptr);
return ret >>> 0;
}
/**
* Creates a new texture data object with the underlying data, width, and height.
* @param {Uint32Array} data
* @param {number} width
* @param {number} height
* @returns {TextureData}
*/
static new(data, width, height) {
const ptr0 = passArray32ToWasm0(data, wasm.__wbindgen_malloc);
const len0 = WASM_VECTOR_LEN;
const ret = wasm.texturedata_new(ptr0, len0, width, height);
return _TextureData.__wrap(ret);
}
};
async function __wbg_load(module, imports) {
if (typeof Response === "function" && module instanceof Response) {
if (typeof WebAssembly.instantiateStreaming === "function") {
try {
return await WebAssembly.instantiateStreaming(module, imports);
} catch (e) {
if (module.headers.get("Content-Type") != "application/wasm") {
console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
} else {
throw e;
}
}
}
const bytes = await module.arrayBuffer();
return await WebAssembly.instantiate(bytes, imports);
} else {
const instance = await WebAssembly.instantiate(module, imports);
if (instance instanceof WebAssembly.Instance) {
return { instance, module };
} else {
return instance;
}
}
}
function __wbg_get_imports() {
const imports = {};
imports.wbg = {};
imports.wbg.__wbg_buffer_609cc3eee51ed158 = function(arg0) {
const ret = arg0.buffer;
return ret;
};
imports.wbg.__wbg_length_3b4f022188ae8db6 = function(arg0) {
const ret = arg0.length;
return ret;
};
imports.wbg.__wbg_length_a446193dc22c12f8 = function(arg0) {
const ret = arg0.length;
return ret;
};
imports.wbg.__wbg_new_780abee5c1739fd7 = function(arg0) {
const ret = new Float32Array(arg0);
return ret;
};
imports.wbg.__wbg_new_a12002a7f91c75be = function(arg0) {
const ret = new Uint8Array(arg0);
return ret;
};
imports.wbg.__wbg_new_e3b321dcfef89fc7 = function(arg0) {
const ret = new Uint32Array(arg0);
return ret;
};
imports.wbg.__wbg_newwithbyteoffsetandlength_f1dead44d1fc7212 = function(arg0, arg1, arg2) {
const ret = new Uint32Array(arg0, arg1 >>> 0, arg2 >>> 0);
return ret;
};
imports.wbg.__wbg_set_10bad9bee0e9c58b = function(arg0, arg1, arg2) {
arg0.set(arg1, arg2 >>> 0);
};
imports.wbg.__wbg_set_65595bdd868b3009 = function(arg0, arg1, arg2) {
arg0.set(arg1, arg2 >>> 0);
};
imports.wbg.__wbindgen_init_externref_table = function() {
const table = wasm.__wbindgen_export_0;
const offset = table.grow(4);
table.set(0, void 0);
table.set(offset + 0, void 0);
table.set(offset + 1, null);
table.set(offset + 2, true);
table.set(offset + 3, false);
;
};
imports.wbg.__wbindgen_memory = function() {
const ret = wasm.memory;
return ret;
};
imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
const ret = getStringFromWasm0(arg0, arg1);
return ret;
};
imports.wbg.__wbindgen_throw = function(arg0, arg1) {
throw new Error(getStringFromWasm0(arg0, arg1));
};
return imports;
}
function __wbg_init_memory(imports, memory) {
}
function __wbg_finalize_init(instance, module) {
wasm = instance.exports;
__wbg_init.__wbindgen_wasm_module = module;
cachedUint32ArrayMemory0 = null;
cachedUint8ArrayMemory0 = null;
wasm.__wbindgen_start();
return wasm;
}
function initSync(module) {
if (wasm !== void 0) return wasm;
if (typeof module !== "undefined") {
if (Object.getPrototypeOf(module) === Object.prototype) {
({ module } = module);
} else {
console.warn("using deprecated parameters for `initSync()`; pass a single object instead");
}
}
const imports = __wbg_get_imports();
__wbg_init_memory(imports);
if (!(module instanceof WebAssembly.Module)) {
module = new WebAssembly.Module(module);
}
const instance = new WebAssembly.Instance(module, imports);
return __wbg_finalize_init(instance, module);
}
async function __wbg_init(module_or_path) {
if (wasm !== void 0) return wasm;
if (typeof module_or_path !== "undefined") {
if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
({ module_or_path } = module_or_path);
} else {
console.warn("using deprecated parameters for the initialization function; pass a single object instead");
}
}
if (typeof module_or_path === "undefined") {
module_or_path = new URL("wasm_splats_bg.wasm", import.meta.url);
}
const imports = __wbg_get_imports();
if (typeof module_or_path === "string" || typeof Request === "function" && module_or_path instanceof Request || typeof URL === "function" && module_or_path instanceof URL) {
module_or_path = fetch(module_or_path);
}
__wbg_init_memory(imports);
const { instance, module } = await __wbg_load(await module_or_path, imports);
return __wbg_finalize_init(instance, module);
}
export {
generate_splat_texture,
radix_sort_gaussians_indexes,
initSync
};
+66
View File
@@ -0,0 +1,66 @@
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.142.0
*
* 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 {
PrimitivePipeline_default
} from "./chunk-ZK3CF7ZD.js";
import {
createTaskProcessorWorker_default
} from "./chunk-4S7IE3LB.js";
import "./chunk-4MGMYHOO.js";
import "./chunk-ACXQXN46.js";
import "./chunk-7J2HKPRH.js";
import "./chunk-Y57HREW5.js";
import "./chunk-3VFEWOBI.js";
import "./chunk-E7VQ76KE.js";
import "./chunk-S4MCOY6I.js";
import "./chunk-KSSWJIZW.js";
import "./chunk-EBSIOBXY.js";
import "./chunk-XZMBNNDX.js";
import "./chunk-C6J67V5A.js";
import "./chunk-MYP774IS.js";
import "./chunk-Q3PY526V.js";
import "./chunk-P3CK7MCY.js";
import "./chunk-TKKIREQ6.js";
import "./chunk-Y5BF6AFU.js";
import "./chunk-V7VQKN6N.js";
import "./chunk-MPZHGZU6.js";
import "./chunk-J6BWOHUF.js";
import "./chunk-AYKR4VBR.js";
import "./chunk-ZP7JMQV4.js";
// packages/engine/Source/Workers/combineGeometry.js
function combineGeometry(packedParameters, transferableObjects) {
const parameters = PrimitivePipeline_default.unpackCombineGeometryParameters(packedParameters);
const results = PrimitivePipeline_default.combineGeometry(parameters);
return PrimitivePipeline_default.packCombineGeometryResults(
results,
transferableObjects
);
}
var combineGeometry_default = createTaskProcessorWorker_default(combineGeometry);
export {
combineGeometry_default as default
};
@@ -0,0 +1,58 @@
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.142.0
*
* 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 {
BoxGeometry_default
} from "./chunk-CZEYZU4N.js";
import "./chunk-IYOUHCZB.js";
import "./chunk-VQYETPWC.js";
import "./chunk-KSSWJIZW.js";
import "./chunk-EBSIOBXY.js";
import "./chunk-XZMBNNDX.js";
import "./chunk-C6J67V5A.js";
import "./chunk-MYP774IS.js";
import "./chunk-Q3PY526V.js";
import "./chunk-P3CK7MCY.js";
import "./chunk-TKKIREQ6.js";
import "./chunk-Y5BF6AFU.js";
import "./chunk-V7VQKN6N.js";
import "./chunk-MPZHGZU6.js";
import "./chunk-J6BWOHUF.js";
import "./chunk-AYKR4VBR.js";
import {
defined_default
} from "./chunk-ZP7JMQV4.js";
// packages/engine/Source/Workers/createBoxGeometry.js
function createBoxGeometry(boxGeometry, offset) {
if (defined_default(offset)) {
boxGeometry = BoxGeometry_default.unpack(boxGeometry, offset);
}
return BoxGeometry_default.createGeometry(boxGeometry);
}
var createBoxGeometry_default = createBoxGeometry;
export {
createBoxGeometry_default as default
};
@@ -0,0 +1,231 @@
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.142.0
*
* 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-IYOUHCZB.js";
import {
GeometryAttributes_default
} from "./chunk-KSSWJIZW.js";
import {
GeometryAttribute_default,
Geometry_default,
PrimitiveType_default
} from "./chunk-EBSIOBXY.js";
import {
BoundingSphere_default
} from "./chunk-XZMBNNDX.js";
import "./chunk-C6J67V5A.js";
import "./chunk-MYP774IS.js";
import "./chunk-Q3PY526V.js";
import {
ComponentDatatype_default
} from "./chunk-P3CK7MCY.js";
import "./chunk-TKKIREQ6.js";
import "./chunk-Y5BF6AFU.js";
import "./chunk-V7VQKN6N.js";
import {
Cartesian3_default,
Frozen_default
} from "./chunk-MPZHGZU6.js";
import "./chunk-J6BWOHUF.js";
import {
Check_default,
DeveloperError_default
} from "./chunk-AYKR4VBR.js";
import {
defined_default
} from "./chunk-ZP7JMQV4.js";
// packages/engine/Source/Core/BoxOutlineGeometry.js
var diffScratch = new Cartesian3_default();
function BoxOutlineGeometry(options) {
options = options ?? Frozen_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."
);
}
this._min = Cartesian3_default.clone(min);
this._max = Cartesian3_default.clone(max);
this._offsetAttribute = options.offsetAttribute;
this._workerName = "createBoxOutlineGeometry";
}
BoxOutlineGeometry.fromDimensions = function(options) {
options = options ?? Frozen_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 BoxOutlineGeometry({
minimum: Cartesian3_default.negate(corner, new Cartesian3_default()),
maximum: corner,
offsetAttribute: options.offsetAttribute
});
};
BoxOutlineGeometry.fromAxisAlignedBoundingBox = function(boundingBox) {
Check_default.typeOf.object("boundindBox", boundingBox);
return new BoxOutlineGeometry({
minimum: boundingBox.minimum,
maximum: boundingBox.maximum
});
};
BoxOutlineGeometry.packedLength = 2 * Cartesian3_default.packedLength + 1;
BoxOutlineGeometry.pack = function(value, array, startingIndex) {
Check_default.typeOf.object("value", value);
Check_default.defined("array", array);
startingIndex = startingIndex ?? 0;
Cartesian3_default.pack(value._min, array, startingIndex);
Cartesian3_default.pack(value._max, array, startingIndex + Cartesian3_default.packedLength);
array[startingIndex + Cartesian3_default.packedLength * 2] = value._offsetAttribute ?? -1;
return array;
};
var scratchMin = new Cartesian3_default();
var scratchMax = new Cartesian3_default();
var scratchOptions = {
minimum: scratchMin,
maximum: scratchMax,
offsetAttribute: void 0
};
BoxOutlineGeometry.unpack = function(array, startingIndex, result) {
Check_default.defined("array", array);
startingIndex = startingIndex ?? 0;
const min = Cartesian3_default.unpack(array, startingIndex, scratchMin);
const max = Cartesian3_default.unpack(
array,
startingIndex + Cartesian3_default.packedLength,
scratchMax
);
const offsetAttribute = array[startingIndex + Cartesian3_default.packedLength * 2];
if (!defined_default(result)) {
scratchOptions.offsetAttribute = offsetAttribute === -1 ? void 0 : offsetAttribute;
return new BoxOutlineGeometry(scratchOptions);
}
result._min = Cartesian3_default.clone(min, result._min);
result._max = Cartesian3_default.clone(max, result._max);
result._offsetAttribute = offsetAttribute === -1 ? void 0 : offsetAttribute;
return result;
};
BoxOutlineGeometry.createGeometry = function(boxGeometry) {
const min = boxGeometry._min;
const max = boxGeometry._max;
if (Cartesian3_default.equals(min, max)) {
return;
}
const attributes = new GeometryAttributes_default();
const indices = new Uint16Array(12 * 2);
const 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[0] = 4;
indices[1] = 5;
indices[2] = 5;
indices[3] = 6;
indices[4] = 6;
indices[5] = 7;
indices[6] = 7;
indices[7] = 4;
indices[8] = 0;
indices[9] = 1;
indices[10] = 1;
indices[11] = 2;
indices[12] = 2;
indices[13] = 3;
indices[14] = 3;
indices[15] = 0;
indices[16] = 0;
indices[17] = 4;
indices[18] = 1;
indices[19] = 5;
indices[20] = 2;
indices[21] = 6;
indices[22] = 3;
indices[23] = 7;
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.LINES,
boundingSphere: new BoundingSphere_default(Cartesian3_default.ZERO, radius),
offsetAttribute: boxGeometry._offsetAttribute
});
};
var BoxOutlineGeometry_default = BoxOutlineGeometry;
// packages/engine/Source/Workers/createBoxOutlineGeometry.js
function createBoxOutlineGeometry(boxGeometry, offset) {
if (defined_default(offset)) {
boxGeometry = BoxOutlineGeometry_default.unpack(boxGeometry, offset);
}
return BoxOutlineGeometry_default.createGeometry(boxGeometry);
}
var createBoxOutlineGeometry_default = createBoxOutlineGeometry;
export {
createBoxOutlineGeometry_default as default
};
@@ -0,0 +1,201 @@
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.142.0
*
* 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 {
EllipseGeometry_default
} from "./chunk-KKOSKAZB.js";
import "./chunk-YLY7NKAB.js";
import "./chunk-FRQZECAO.js";
import "./chunk-ACXQXN46.js";
import "./chunk-7J2HKPRH.js";
import "./chunk-Y57HREW5.js";
import "./chunk-IYOUHCZB.js";
import {
VertexFormat_default
} from "./chunk-VQYETPWC.js";
import "./chunk-3VFEWOBI.js";
import "./chunk-E7VQ76KE.js";
import "./chunk-S4MCOY6I.js";
import "./chunk-KSSWJIZW.js";
import "./chunk-EBSIOBXY.js";
import "./chunk-XZMBNNDX.js";
import "./chunk-C6J67V5A.js";
import "./chunk-MYP774IS.js";
import "./chunk-Q3PY526V.js";
import "./chunk-P3CK7MCY.js";
import "./chunk-TKKIREQ6.js";
import "./chunk-Y5BF6AFU.js";
import {
Ellipsoid_default
} from "./chunk-V7VQKN6N.js";
import {
Cartesian3_default,
Frozen_default
} from "./chunk-MPZHGZU6.js";
import "./chunk-J6BWOHUF.js";
import {
Check_default
} from "./chunk-AYKR4VBR.js";
import {
defined_default
} from "./chunk-ZP7JMQV4.js";
// packages/engine/Source/Core/CircleGeometry.js
function CircleGeometry(options) {
options = options ?? Frozen_default.EMPTY_OBJECT;
const radius = options.radius;
Check_default.typeOf.number("radius", radius);
const ellipseGeometryOptions = {
center: options.center,
semiMajorAxis: radius,
semiMinorAxis: radius,
ellipsoid: options.ellipsoid,
height: options.height,
extrudedHeight: options.extrudedHeight,
granularity: options.granularity,
vertexFormat: options.vertexFormat,
stRotation: options.stRotation,
shadowVolume: options.shadowVolume
};
this._ellipseGeometry = new EllipseGeometry_default(ellipseGeometryOptions);
this._workerName = "createCircleGeometry";
}
CircleGeometry.packedLength = EllipseGeometry_default.packedLength;
CircleGeometry.pack = function(value, array, startingIndex) {
Check_default.typeOf.object("value", value);
return EllipseGeometry_default.pack(value._ellipseGeometry, array, startingIndex);
};
var scratchEllipseGeometry = new EllipseGeometry_default({
center: new Cartesian3_default(),
semiMajorAxis: 1,
semiMinorAxis: 1
});
var scratchOptions = {
center: new Cartesian3_default(),
radius: void 0,
ellipsoid: Ellipsoid_default.clone(Ellipsoid_default.default),
height: void 0,
extrudedHeight: void 0,
granularity: void 0,
vertexFormat: new VertexFormat_default(),
stRotation: void 0,
semiMajorAxis: void 0,
semiMinorAxis: void 0,
shadowVolume: void 0
};
CircleGeometry.unpack = function(array, startingIndex, result) {
const ellipseGeometry = EllipseGeometry_default.unpack(
array,
startingIndex,
scratchEllipseGeometry
);
scratchOptions.center = Cartesian3_default.clone(
ellipseGeometry._center,
scratchOptions.center
);
scratchOptions.ellipsoid = Ellipsoid_default.clone(
ellipseGeometry._ellipsoid,
scratchOptions.ellipsoid
);
scratchOptions.ellipsoid = Ellipsoid_default.clone(
ellipseGeometry._ellipsoid,
scratchEllipseGeometry._ellipsoid
);
scratchOptions.height = ellipseGeometry._height;
scratchOptions.extrudedHeight = ellipseGeometry._extrudedHeight;
scratchOptions.granularity = ellipseGeometry._granularity;
scratchOptions.vertexFormat = VertexFormat_default.clone(
ellipseGeometry._vertexFormat,
scratchOptions.vertexFormat
);
scratchOptions.stRotation = ellipseGeometry._stRotation;
scratchOptions.shadowVolume = ellipseGeometry._shadowVolume;
if (!defined_default(result)) {
scratchOptions.radius = ellipseGeometry._semiMajorAxis;
return new CircleGeometry(scratchOptions);
}
scratchOptions.semiMajorAxis = ellipseGeometry._semiMajorAxis;
scratchOptions.semiMinorAxis = ellipseGeometry._semiMinorAxis;
result._ellipseGeometry = new EllipseGeometry_default(scratchOptions);
return result;
};
CircleGeometry.createGeometry = function(circleGeometry) {
return EllipseGeometry_default.createGeometry(circleGeometry._ellipseGeometry);
};
CircleGeometry.createShadowVolume = function(circleGeometry, minHeightFunc, maxHeightFunc) {
const granularity = circleGeometry._ellipseGeometry._granularity;
const ellipsoid = circleGeometry._ellipseGeometry._ellipsoid;
const minHeight = minHeightFunc(granularity, ellipsoid);
const maxHeight = maxHeightFunc(granularity, ellipsoid);
return new CircleGeometry({
center: circleGeometry._ellipseGeometry._center,
radius: circleGeometry._ellipseGeometry._semiMajorAxis,
ellipsoid,
stRotation: circleGeometry._ellipseGeometry._stRotation,
granularity,
extrudedHeight: minHeight,
height: maxHeight,
vertexFormat: VertexFormat_default.POSITION_ONLY,
shadowVolume: true
});
};
Object.defineProperties(CircleGeometry.prototype, {
/**
* @private
*/
rectangle: {
get: function() {
return this._ellipseGeometry.rectangle;
}
},
/**
* For remapping texture coordinates when rendering CircleGeometries as GroundPrimitives.
* @private
*/
textureCoordinateRotationPoints: {
get: function() {
return this._ellipseGeometry.textureCoordinateRotationPoints;
}
}
});
var CircleGeometry_default = CircleGeometry;
// packages/engine/Source/Workers/createCircleGeometry.js
function createCircleGeometry(circleGeometry, offset) {
if (defined_default(offset)) {
circleGeometry = CircleGeometry_default.unpack(circleGeometry, offset);
}
circleGeometry._ellipseGeometry._center = Cartesian3_default.clone(
circleGeometry._ellipseGeometry._center
);
circleGeometry._ellipseGeometry._ellipsoid = Ellipsoid_default.clone(
circleGeometry._ellipseGeometry._ellipsoid
);
return CircleGeometry_default.createGeometry(circleGeometry);
}
var createCircleGeometry_default = createCircleGeometry;
export {
createCircleGeometry_default as default
};
@@ -0,0 +1,147 @@
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.142.0
*
* 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 {
EllipseOutlineGeometry_default
} from "./chunk-F6QDY6HU.js";
import "./chunk-YLY7NKAB.js";
import "./chunk-IYOUHCZB.js";
import "./chunk-S4MCOY6I.js";
import "./chunk-KSSWJIZW.js";
import "./chunk-EBSIOBXY.js";
import "./chunk-XZMBNNDX.js";
import "./chunk-C6J67V5A.js";
import "./chunk-MYP774IS.js";
import "./chunk-Q3PY526V.js";
import "./chunk-P3CK7MCY.js";
import "./chunk-TKKIREQ6.js";
import "./chunk-Y5BF6AFU.js";
import {
Ellipsoid_default
} from "./chunk-V7VQKN6N.js";
import {
Cartesian3_default,
Frozen_default
} from "./chunk-MPZHGZU6.js";
import "./chunk-J6BWOHUF.js";
import {
Check_default
} from "./chunk-AYKR4VBR.js";
import {
defined_default
} from "./chunk-ZP7JMQV4.js";
// packages/engine/Source/Core/CircleOutlineGeometry.js
function CircleOutlineGeometry(options) {
options = options ?? Frozen_default.EMPTY_OBJECT;
const radius = options.radius;
Check_default.typeOf.number("radius", radius);
const ellipseGeometryOptions = {
center: options.center,
semiMajorAxis: radius,
semiMinorAxis: radius,
ellipsoid: options.ellipsoid,
height: options.height,
extrudedHeight: options.extrudedHeight,
granularity: options.granularity,
numberOfVerticalLines: options.numberOfVerticalLines
};
this._ellipseGeometry = new EllipseOutlineGeometry_default(ellipseGeometryOptions);
this._workerName = "createCircleOutlineGeometry";
}
CircleOutlineGeometry.packedLength = EllipseOutlineGeometry_default.packedLength;
CircleOutlineGeometry.pack = function(value, array, startingIndex) {
Check_default.typeOf.object("value", value);
return EllipseOutlineGeometry_default.pack(
value._ellipseGeometry,
array,
startingIndex
);
};
var scratchEllipseGeometry = new EllipseOutlineGeometry_default({
center: new Cartesian3_default(),
semiMajorAxis: 1,
semiMinorAxis: 1
});
var scratchOptions = {
center: new Cartesian3_default(),
radius: void 0,
ellipsoid: Ellipsoid_default.clone(Ellipsoid_default.UNIT_SPHERE),
height: void 0,
extrudedHeight: void 0,
granularity: void 0,
numberOfVerticalLines: void 0,
semiMajorAxis: void 0,
semiMinorAxis: void 0
};
CircleOutlineGeometry.unpack = function(array, startingIndex, result) {
const ellipseGeometry = EllipseOutlineGeometry_default.unpack(
array,
startingIndex,
scratchEllipseGeometry
);
scratchOptions.center = Cartesian3_default.clone(
ellipseGeometry._center,
scratchOptions.center
);
scratchOptions.ellipsoid = Ellipsoid_default.clone(
ellipseGeometry._ellipsoid,
scratchOptions.ellipsoid
);
scratchOptions.height = ellipseGeometry._height;
scratchOptions.extrudedHeight = ellipseGeometry._extrudedHeight;
scratchOptions.granularity = ellipseGeometry._granularity;
scratchOptions.numberOfVerticalLines = ellipseGeometry._numberOfVerticalLines;
if (!defined_default(result)) {
scratchOptions.radius = ellipseGeometry._semiMajorAxis;
return new CircleOutlineGeometry(scratchOptions);
}
scratchOptions.semiMajorAxis = ellipseGeometry._semiMajorAxis;
scratchOptions.semiMinorAxis = ellipseGeometry._semiMinorAxis;
result._ellipseGeometry = new EllipseOutlineGeometry_default(scratchOptions);
return result;
};
CircleOutlineGeometry.createGeometry = function(circleGeometry) {
return EllipseOutlineGeometry_default.createGeometry(circleGeometry._ellipseGeometry);
};
var CircleOutlineGeometry_default = CircleOutlineGeometry;
// packages/engine/Source/Workers/createCircleOutlineGeometry.js
function createCircleOutlineGeometry(circleGeometry, offset) {
if (defined_default(offset)) {
circleGeometry = CircleOutlineGeometry_default.unpack(circleGeometry, offset);
}
circleGeometry._ellipseGeometry._center = Cartesian3_default.clone(
circleGeometry._ellipseGeometry._center
);
circleGeometry._ellipseGeometry._ellipsoid = Ellipsoid_default.clone(
circleGeometry._ellipseGeometry._ellipsoid
);
return CircleOutlineGeometry_default.createGeometry(circleGeometry);
}
var createCircleOutlineGeometry_default = createCircleOutlineGeometry;
export {
createCircleOutlineGeometry_default as default
};
@@ -0,0 +1,505 @@
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.142.0
*
* 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 {
BoundingRectangle_default
} from "./chunk-KFSTQKNM.js";
import {
CoplanarPolygonGeometryLibrary_default
} from "./chunk-CXOYE2WM.js";
import "./chunk-EPYXRCDB.js";
import {
PolygonGeometryLibrary_default
} from "./chunk-C6KNZ7T4.js";
import "./chunk-M3B5JKSM.js";
import {
GeometryInstance_default
} from "./chunk-FRQZECAO.js";
import {
GeometryPipeline_default
} from "./chunk-ACXQXN46.js";
import "./chunk-7J2HKPRH.js";
import "./chunk-Y57HREW5.js";
import {
VertexFormat_default
} from "./chunk-VQYETPWC.js";
import "./chunk-SMQZZOW6.js";
import "./chunk-DDWSZVMY.js";
import {
PolygonPipeline_default
} from "./chunk-O3EA5HS7.js";
import {
arrayRemoveDuplicates_default
} from "./chunk-CFQP6LYM.js";
import "./chunk-54I6Y66F.js";
import "./chunk-3VFEWOBI.js";
import "./chunk-E7VQ76KE.js";
import {
IndexDatatype_default
} from "./chunk-S4MCOY6I.js";
import {
GeometryAttributes_default
} from "./chunk-KSSWJIZW.js";
import {
GeometryAttribute_default,
Geometry_default,
PrimitiveType_default
} from "./chunk-EBSIOBXY.js";
import {
BoundingSphere_default
} from "./chunk-XZMBNNDX.js";
import "./chunk-C6J67V5A.js";
import {
Quaternion_default
} from "./chunk-MYP774IS.js";
import "./chunk-Q3PY526V.js";
import {
ComponentDatatype_default
} from "./chunk-P3CK7MCY.js";
import "./chunk-TKKIREQ6.js";
import "./chunk-Y5BF6AFU.js";
import {
Cartesian2_default,
Ellipsoid_default
} from "./chunk-V7VQKN6N.js";
import {
Cartesian3_default,
Frozen_default,
Matrix3_default
} from "./chunk-MPZHGZU6.js";
import {
Math_default
} from "./chunk-J6BWOHUF.js";
import {
Check_default
} from "./chunk-AYKR4VBR.js";
import {
defined_default
} from "./chunk-ZP7JMQV4.js";
// packages/engine/Source/Core/CoplanarPolygonGeometry.js
var scratchPosition = new Cartesian3_default();
var scratchBR = new BoundingRectangle_default();
var stScratch = new Cartesian2_default();
var textureCoordinatesOrigin = new Cartesian2_default();
var scratchNormal = new Cartesian3_default();
var scratchTangent = new Cartesian3_default();
var scratchBitangent = new Cartesian3_default();
var centerScratch = new Cartesian3_default();
var axis1Scratch = new Cartesian3_default();
var axis2Scratch = new Cartesian3_default();
var quaternionScratch = new Quaternion_default();
var textureMatrixScratch = new Matrix3_default();
var tangentRotationScratch = new Matrix3_default();
var surfaceNormalScratch = new Cartesian3_default();
function createGeometryFromPolygon(polygon, vertexFormat, boundingRectangle, stRotation, hardcodedTextureCoordinates, projectPointTo2D, normal, tangent, bitangent) {
const positions = polygon.positions;
let indices = PolygonPipeline_default.triangulate(polygon.positions2D, polygon.holes);
if (indices.length < 3) {
indices = [0, 1, 2];
}
const newIndices = IndexDatatype_default.createTypedArray(
positions.length,
indices.length
);
newIndices.set(indices);
let textureMatrix = textureMatrixScratch;
if (stRotation !== 0) {
let rotation = Quaternion_default.fromAxisAngle(
normal,
stRotation,
quaternionScratch
);
textureMatrix = Matrix3_default.fromQuaternion(rotation, textureMatrix);
if (vertexFormat.tangent || vertexFormat.bitangent) {
rotation = Quaternion_default.fromAxisAngle(
normal,
-stRotation,
quaternionScratch
);
const tangentRotation = Matrix3_default.fromQuaternion(
rotation,
tangentRotationScratch
);
tangent = Cartesian3_default.normalize(
Matrix3_default.multiplyByVector(tangentRotation, tangent, tangent),
tangent
);
if (vertexFormat.bitangent) {
bitangent = Cartesian3_default.normalize(
Cartesian3_default.cross(normal, tangent, bitangent),
bitangent
);
}
}
} else {
textureMatrix = Matrix3_default.clone(Matrix3_default.IDENTITY, textureMatrix);
}
const stOrigin = textureCoordinatesOrigin;
if (vertexFormat.st) {
stOrigin.x = boundingRectangle.x;
stOrigin.y = boundingRectangle.y;
}
const length = positions.length;
const size = length * 3;
const flatPositions = new Float64Array(size);
const normals = vertexFormat.normal ? new Float32Array(size) : void 0;
const tangents = vertexFormat.tangent ? new Float32Array(size) : void 0;
const bitangents = vertexFormat.bitangent ? new Float32Array(size) : void 0;
const textureCoordinates = vertexFormat.st ? new Float32Array(length * 2) : void 0;
let positionIndex = 0;
let normalIndex = 0;
let bitangentIndex = 0;
let tangentIndex = 0;
let stIndex = 0;
for (let i = 0; i < length; i++) {
const position = positions[i];
flatPositions[positionIndex++] = position.x;
flatPositions[positionIndex++] = position.y;
flatPositions[positionIndex++] = position.z;
if (vertexFormat.st) {
if (defined_default(hardcodedTextureCoordinates) && hardcodedTextureCoordinates.positions.length === length) {
textureCoordinates[stIndex++] = hardcodedTextureCoordinates.positions[i].x;
textureCoordinates[stIndex++] = hardcodedTextureCoordinates.positions[i].y;
} else {
const p = Matrix3_default.multiplyByVector(
textureMatrix,
position,
scratchPosition
);
const st = projectPointTo2D(p, stScratch);
Cartesian2_default.subtract(st, stOrigin, st);
const stx = Math_default.clamp(st.x / boundingRectangle.width, 0, 1);
const sty = Math_default.clamp(st.y / boundingRectangle.height, 0, 1);
textureCoordinates[stIndex++] = stx;
textureCoordinates[stIndex++] = sty;
}
}
if (vertexFormat.normal) {
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;
}
if (vertexFormat.bitangent) {
bitangents[bitangentIndex++] = bitangent.x;
bitangents[bitangentIndex++] = bitangent.y;
bitangents[bitangentIndex++] = bitangent.z;
}
}
const attributes = new GeometryAttributes_default();
if (vertexFormat.position) {
attributes.position = new GeometryAttribute_default({
componentDatatype: ComponentDatatype_default.DOUBLE,
componentsPerAttribute: 3,
values: flatPositions
});
}
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: textureCoordinates
});
}
return new Geometry_default({
attributes,
indices: newIndices,
primitiveType: PrimitiveType_default.TRIANGLES
});
}
function CoplanarPolygonGeometry(options) {
options = options ?? Frozen_default.EMPTY_OBJECT;
const polygonHierarchy = options.polygonHierarchy;
const textureCoordinates = options.textureCoordinates;
Check_default.defined("options.polygonHierarchy", polygonHierarchy);
const vertexFormat = options.vertexFormat ?? VertexFormat_default.DEFAULT;
this._vertexFormat = VertexFormat_default.clone(vertexFormat);
this._polygonHierarchy = polygonHierarchy;
this._stRotation = options.stRotation ?? 0;
this._ellipsoid = Ellipsoid_default.clone(options.ellipsoid ?? Ellipsoid_default.default);
this._workerName = "createCoplanarPolygonGeometry";
this._textureCoordinates = textureCoordinates;
this.packedLength = PolygonGeometryLibrary_default.computeHierarchyPackedLength(
polygonHierarchy,
Cartesian3_default
) + VertexFormat_default.packedLength + Ellipsoid_default.packedLength + (defined_default(textureCoordinates) ? PolygonGeometryLibrary_default.computeHierarchyPackedLength(
textureCoordinates,
Cartesian2_default
) : 1) + 2;
}
CoplanarPolygonGeometry.fromPositions = function(options) {
options = options ?? Frozen_default.EMPTY_OBJECT;
Check_default.defined("options.positions", options.positions);
const newOptions = {
polygonHierarchy: {
positions: options.positions
},
vertexFormat: options.vertexFormat,
stRotation: options.stRotation,
ellipsoid: options.ellipsoid,
textureCoordinates: options.textureCoordinates
};
return new CoplanarPolygonGeometry(newOptions);
};
CoplanarPolygonGeometry.pack = function(value, array, startingIndex) {
Check_default.typeOf.object("value", value);
Check_default.defined("array", array);
startingIndex = startingIndex ?? 0;
startingIndex = PolygonGeometryLibrary_default.packPolygonHierarchy(
value._polygonHierarchy,
array,
startingIndex,
Cartesian3_default
);
Ellipsoid_default.pack(value._ellipsoid, array, startingIndex);
startingIndex += Ellipsoid_default.packedLength;
VertexFormat_default.pack(value._vertexFormat, array, startingIndex);
startingIndex += VertexFormat_default.packedLength;
array[startingIndex++] = value._stRotation;
if (defined_default(value._textureCoordinates)) {
startingIndex = PolygonGeometryLibrary_default.packPolygonHierarchy(
value._textureCoordinates,
array,
startingIndex,
Cartesian2_default
);
} else {
array[startingIndex++] = -1;
}
array[startingIndex++] = value.packedLength;
return array;
};
var scratchEllipsoid = Ellipsoid_default.clone(Ellipsoid_default.UNIT_SPHERE);
var scratchVertexFormat = new VertexFormat_default();
var scratchOptions = {
polygonHierarchy: {}
};
CoplanarPolygonGeometry.unpack = function(array, startingIndex, result) {
Check_default.defined("array", array);
startingIndex = startingIndex ?? 0;
const polygonHierarchy = PolygonGeometryLibrary_default.unpackPolygonHierarchy(
array,
startingIndex,
Cartesian3_default
);
startingIndex = polygonHierarchy.startingIndex;
delete polygonHierarchy.startingIndex;
const ellipsoid = Ellipsoid_default.unpack(array, startingIndex, scratchEllipsoid);
startingIndex += Ellipsoid_default.packedLength;
const vertexFormat = VertexFormat_default.unpack(
array,
startingIndex,
scratchVertexFormat
);
startingIndex += VertexFormat_default.packedLength;
const stRotation = array[startingIndex++];
const textureCoordinates = array[startingIndex] === -1 ? void 0 : PolygonGeometryLibrary_default.unpackPolygonHierarchy(
array,
startingIndex,
Cartesian2_default
);
if (defined_default(textureCoordinates)) {
startingIndex = textureCoordinates.startingIndex;
delete textureCoordinates.startingIndex;
} else {
startingIndex++;
}
const packedLength = array[startingIndex++];
if (!defined_default(result)) {
result = new CoplanarPolygonGeometry(scratchOptions);
}
result._polygonHierarchy = polygonHierarchy;
result._ellipsoid = Ellipsoid_default.clone(ellipsoid, result._ellipsoid);
result._vertexFormat = VertexFormat_default.clone(vertexFormat, result._vertexFormat);
result._stRotation = stRotation;
result._textureCoordinates = textureCoordinates;
result.packedLength = packedLength;
return result;
};
CoplanarPolygonGeometry.createGeometry = function(polygonGeometry) {
const vertexFormat = polygonGeometry._vertexFormat;
const polygonHierarchy = polygonGeometry._polygonHierarchy;
const stRotation = polygonGeometry._stRotation;
const textureCoordinates = polygonGeometry._textureCoordinates;
const hasTextureCoordinates = defined_default(textureCoordinates);
let outerPositions = polygonHierarchy.positions;
outerPositions = arrayRemoveDuplicates_default(
outerPositions,
Cartesian3_default.equalsEpsilon,
true
);
if (outerPositions.length < 3) {
return;
}
let normal = scratchNormal;
let tangent = scratchTangent;
let bitangent = scratchBitangent;
let axis1 = axis1Scratch;
const axis2 = axis2Scratch;
const validGeometry = CoplanarPolygonGeometryLibrary_default.computeProjectTo2DArguments(
outerPositions,
centerScratch,
axis1,
axis2
);
if (!validGeometry) {
return void 0;
}
normal = Cartesian3_default.cross(axis1, axis2, normal);
normal = Cartesian3_default.normalize(normal, normal);
if (!Cartesian3_default.equalsEpsilon(
centerScratch,
Cartesian3_default.ZERO,
Math_default.EPSILON6
)) {
const surfaceNormal = polygonGeometry._ellipsoid.geodeticSurfaceNormal(
centerScratch,
surfaceNormalScratch
);
if (Cartesian3_default.dot(normal, surfaceNormal) < 0) {
normal = Cartesian3_default.negate(normal, normal);
axis1 = Cartesian3_default.negate(axis1, axis1);
}
}
const projectPoints = CoplanarPolygonGeometryLibrary_default.createProjectPointsTo2DFunction(
centerScratch,
axis1,
axis2
);
const projectPoint = CoplanarPolygonGeometryLibrary_default.createProjectPointTo2DFunction(
centerScratch,
axis1,
axis2
);
if (vertexFormat.tangent) {
tangent = Cartesian3_default.clone(axis1, tangent);
}
if (vertexFormat.bitangent) {
bitangent = Cartesian3_default.clone(axis2, bitangent);
}
const results = PolygonGeometryLibrary_default.polygonsFromHierarchy(
polygonHierarchy,
hasTextureCoordinates,
projectPoints,
false
);
const hierarchy = results.hierarchy;
const polygons = results.polygons;
const dummyFunction = function(identity) {
return identity;
};
const textureCoordinatePolygons = hasTextureCoordinates ? PolygonGeometryLibrary_default.polygonsFromHierarchy(
textureCoordinates,
true,
dummyFunction,
false
).polygons : void 0;
if (hierarchy.length === 0) {
return;
}
outerPositions = hierarchy[0].outerRing;
const boundingSphere = BoundingSphere_default.fromPoints(outerPositions);
const boundingRectangle = PolygonGeometryLibrary_default.computeBoundingRectangle(
normal,
projectPoint,
outerPositions,
stRotation,
scratchBR
);
const geometries = [];
for (let i = 0; i < polygons.length; i++) {
const geometryInstance = new GeometryInstance_default({
geometry: createGeometryFromPolygon(
polygons[i],
vertexFormat,
boundingRectangle,
stRotation,
hasTextureCoordinates ? textureCoordinatePolygons[i] : void 0,
projectPoint,
normal,
tangent,
bitangent
)
});
geometries.push(geometryInstance);
}
const geometry = GeometryPipeline_default.combineInstances(geometries)[0];
geometry.attributes.position.values = new Float64Array(
geometry.attributes.position.values
);
geometry.indices = IndexDatatype_default.createTypedArray(
geometry.attributes.position.values.length / 3,
geometry.indices
);
const attributes = geometry.attributes;
if (!vertexFormat.position) {
delete attributes.position;
}
return new Geometry_default({
attributes,
indices: geometry.indices,
primitiveType: geometry.primitiveType,
boundingSphere
});
};
var CoplanarPolygonGeometry_default = CoplanarPolygonGeometry;
// packages/engine/Source/Workers/createCoplanarPolygonGeometry.js
function createCoplanarPolygonGeometry(polygonGeometry, offset) {
if (defined_default(offset)) {
polygonGeometry = CoplanarPolygonGeometry_default.unpack(polygonGeometry, offset);
}
return CoplanarPolygonGeometry_default.createGeometry(polygonGeometry);
}
var createCoplanarPolygonGeometry_default = createCoplanarPolygonGeometry;
export {
createCoplanarPolygonGeometry_default as default
};
@@ -0,0 +1,225 @@
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.142.0
*
* 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 {
CoplanarPolygonGeometryLibrary_default
} from "./chunk-CXOYE2WM.js";
import "./chunk-EPYXRCDB.js";
import {
PolygonGeometryLibrary_default
} from "./chunk-C6KNZ7T4.js";
import "./chunk-M3B5JKSM.js";
import {
GeometryInstance_default
} from "./chunk-FRQZECAO.js";
import {
GeometryPipeline_default
} from "./chunk-ACXQXN46.js";
import "./chunk-7J2HKPRH.js";
import "./chunk-Y57HREW5.js";
import "./chunk-SMQZZOW6.js";
import "./chunk-DDWSZVMY.js";
import "./chunk-O3EA5HS7.js";
import {
arrayRemoveDuplicates_default
} from "./chunk-CFQP6LYM.js";
import "./chunk-54I6Y66F.js";
import "./chunk-3VFEWOBI.js";
import "./chunk-E7VQ76KE.js";
import {
IndexDatatype_default
} from "./chunk-S4MCOY6I.js";
import {
GeometryAttributes_default
} from "./chunk-KSSWJIZW.js";
import {
GeometryAttribute_default,
Geometry_default,
PrimitiveType_default
} from "./chunk-EBSIOBXY.js";
import {
BoundingSphere_default
} from "./chunk-XZMBNNDX.js";
import "./chunk-C6J67V5A.js";
import "./chunk-MYP774IS.js";
import "./chunk-Q3PY526V.js";
import {
ComponentDatatype_default
} from "./chunk-P3CK7MCY.js";
import "./chunk-TKKIREQ6.js";
import "./chunk-Y5BF6AFU.js";
import {
Ellipsoid_default
} from "./chunk-V7VQKN6N.js";
import {
Cartesian3_default,
Frozen_default
} from "./chunk-MPZHGZU6.js";
import "./chunk-J6BWOHUF.js";
import {
Check_default
} from "./chunk-AYKR4VBR.js";
import {
defined_default
} from "./chunk-ZP7JMQV4.js";
// packages/engine/Source/Core/CoplanarPolygonOutlineGeometry.js
function createGeometryFromPositions(positions) {
const length = positions.length;
const flatPositions = new Float64Array(length * 3);
const indices = IndexDatatype_default.createTypedArray(length, length * 2);
let positionIndex = 0;
let index = 0;
for (let i = 0; i < length; i++) {
const position = positions[i];
flatPositions[positionIndex++] = position.x;
flatPositions[positionIndex++] = position.y;
flatPositions[positionIndex++] = position.z;
indices[index++] = i;
indices[index++] = (i + 1) % length;
}
const attributes = new GeometryAttributes_default({
position: new GeometryAttribute_default({
componentDatatype: ComponentDatatype_default.DOUBLE,
componentsPerAttribute: 3,
values: flatPositions
})
});
return new Geometry_default({
attributes,
indices,
primitiveType: PrimitiveType_default.LINES
});
}
function CoplanarPolygonOutlineGeometry(options) {
options = options ?? Frozen_default.EMPTY_OBJECT;
const polygonHierarchy = options.polygonHierarchy;
Check_default.defined("options.polygonHierarchy", polygonHierarchy);
this._polygonHierarchy = polygonHierarchy;
this._workerName = "createCoplanarPolygonOutlineGeometry";
this.packedLength = PolygonGeometryLibrary_default.computeHierarchyPackedLength(
polygonHierarchy,
Cartesian3_default
) + 1;
}
CoplanarPolygonOutlineGeometry.fromPositions = function(options) {
options = options ?? Frozen_default.EMPTY_OBJECT;
Check_default.defined("options.positions", options.positions);
const newOptions = {
polygonHierarchy: {
positions: options.positions
}
};
return new CoplanarPolygonOutlineGeometry(newOptions);
};
CoplanarPolygonOutlineGeometry.pack = function(value, array, startingIndex) {
Check_default.typeOf.object("value", value);
Check_default.defined("array", array);
startingIndex = startingIndex ?? 0;
startingIndex = PolygonGeometryLibrary_default.packPolygonHierarchy(
value._polygonHierarchy,
array,
startingIndex,
Cartesian3_default
);
array[startingIndex] = value.packedLength;
return array;
};
var scratchOptions = {
polygonHierarchy: {}
};
CoplanarPolygonOutlineGeometry.unpack = function(array, startingIndex, result) {
Check_default.defined("array", array);
startingIndex = startingIndex ?? 0;
const polygonHierarchy = PolygonGeometryLibrary_default.unpackPolygonHierarchy(
array,
startingIndex,
Cartesian3_default
);
startingIndex = polygonHierarchy.startingIndex;
delete polygonHierarchy.startingIndex;
const packedLength = array[startingIndex];
if (!defined_default(result)) {
result = new CoplanarPolygonOutlineGeometry(scratchOptions);
}
result._polygonHierarchy = polygonHierarchy;
result.packedLength = packedLength;
return result;
};
CoplanarPolygonOutlineGeometry.createGeometry = function(polygonGeometry) {
const polygonHierarchy = polygonGeometry._polygonHierarchy;
let outerPositions = polygonHierarchy.positions;
outerPositions = arrayRemoveDuplicates_default(
outerPositions,
Cartesian3_default.equalsEpsilon,
true
);
if (outerPositions.length < 3) {
return;
}
const isValid = CoplanarPolygonGeometryLibrary_default.validOutline(outerPositions);
if (!isValid) {
return void 0;
}
const polygons = PolygonGeometryLibrary_default.polygonOutlinesFromHierarchy(
polygonHierarchy,
false
);
if (polygons.length === 0) {
return void 0;
}
const geometries = [];
for (let i = 0; i < polygons.length; i++) {
const geometryInstance = new GeometryInstance_default({
geometry: createGeometryFromPositions(polygons[i])
});
geometries.push(geometryInstance);
}
const geometry = GeometryPipeline_default.combineInstances(geometries)[0];
const boundingSphere = BoundingSphere_default.fromPoints(polygonHierarchy.positions);
return new Geometry_default({
attributes: geometry.attributes,
indices: geometry.indices,
primitiveType: geometry.primitiveType,
boundingSphere
});
};
var CoplanarPolygonOutlineGeometry_default = CoplanarPolygonOutlineGeometry;
// packages/engine/Source/Workers/createCoplanarPolygonOutlineGeometry.js
function createCoplanarPolygonOutlineGeometry(polygonGeometry, offset) {
if (defined_default(offset)) {
polygonGeometry = CoplanarPolygonOutlineGeometry_default.unpack(
polygonGeometry,
offset
);
}
polygonGeometry._ellipsoid = Ellipsoid_default.clone(polygonGeometry._ellipsoid);
return CoplanarPolygonOutlineGeometry_default.createGeometry(polygonGeometry);
}
var createCoplanarPolygonOutlineGeometry_default = createCoplanarPolygonOutlineGeometry;
export {
createCoplanarPolygonOutlineGeometry_default as default
};
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,563 @@
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.142.0
*
* 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 {
CorridorGeometryLibrary_default
} from "./chunk-G7PXZRVF.js";
import {
CornerType_default
} from "./chunk-UA25D5MX.js";
import "./chunk-QRWGUWI6.js";
import "./chunk-6YEE6JDR.js";
import {
GeometryOffsetAttribute_default
} from "./chunk-IYOUHCZB.js";
import "./chunk-SMQZZOW6.js";
import "./chunk-DDWSZVMY.js";
import {
PolygonPipeline_default
} from "./chunk-O3EA5HS7.js";
import {
arrayRemoveDuplicates_default
} from "./chunk-CFQP6LYM.js";
import "./chunk-54I6Y66F.js";
import "./chunk-3VFEWOBI.js";
import "./chunk-E7VQ76KE.js";
import {
IndexDatatype_default
} from "./chunk-S4MCOY6I.js";
import {
GeometryAttributes_default
} from "./chunk-KSSWJIZW.js";
import {
GeometryAttribute_default,
Geometry_default,
PrimitiveType_default
} from "./chunk-EBSIOBXY.js";
import {
BoundingSphere_default
} from "./chunk-XZMBNNDX.js";
import "./chunk-C6J67V5A.js";
import "./chunk-MYP774IS.js";
import "./chunk-Q3PY526V.js";
import {
ComponentDatatype_default
} from "./chunk-P3CK7MCY.js";
import "./chunk-TKKIREQ6.js";
import "./chunk-Y5BF6AFU.js";
import {
Ellipsoid_default
} from "./chunk-V7VQKN6N.js";
import {
Cartesian3_default,
Frozen_default
} from "./chunk-MPZHGZU6.js";
import {
Math_default
} from "./chunk-J6BWOHUF.js";
import {
Check_default
} from "./chunk-AYKR4VBR.js";
import {
defined_default
} from "./chunk-ZP7JMQV4.js";
// packages/engine/Source/Core/CorridorOutlineGeometry.js
var cartesian1 = new Cartesian3_default();
var cartesian2 = new Cartesian3_default();
var cartesian3 = new Cartesian3_default();
function scaleToSurface(positions, ellipsoid) {
for (let i = 0; i < positions.length; i++) {
positions[i] = ellipsoid.scaleToGeodeticSurface(positions[i], positions[i]);
}
return positions;
}
function combine(computedPositions, cornerType) {
const wallIndices = [];
const positions = computedPositions.positions;
const corners = computedPositions.corners;
const endPositions = computedPositions.endPositions;
const attributes = new GeometryAttributes_default();
let corner;
let leftCount = 0;
let rightCount = 0;
let i;
let indicesLength = 0;
let length;
for (i = 0; i < positions.length; i += 2) {
length = positions[i].length - 3;
leftCount += length;
indicesLength += length / 3 * 4;
rightCount += positions[i + 1].length - 3;
}
leftCount += 3;
rightCount += 3;
for (i = 0; i < corners.length; i++) {
corner = corners[i];
const leftSide = corners[i].leftPositions;
if (defined_default(leftSide)) {
length = leftSide.length;
leftCount += length;
indicesLength += length / 3 * 2;
} else {
length = corners[i].rightPositions.length;
rightCount += length;
indicesLength += length / 3 * 2;
}
}
const addEndPositions = defined_default(endPositions);
let endPositionLength;
if (addEndPositions) {
endPositionLength = endPositions[0].length - 3;
leftCount += endPositionLength;
rightCount += endPositionLength;
endPositionLength /= 3;
indicesLength += endPositionLength * 4;
}
const size = leftCount + rightCount;
const finalPositions = new Float64Array(size);
let front = 0;
let back = size - 1;
let UL, LL, UR, LR;
let rightPos, leftPos;
const halfLength = endPositionLength / 2;
const indices = IndexDatatype_default.createTypedArray(size / 3, indicesLength + 4);
let index = 0;
indices[index++] = front / 3;
indices[index++] = (back - 2) / 3;
if (addEndPositions) {
wallIndices.push(front / 3);
leftPos = cartesian1;
rightPos = cartesian2;
const firstEndPositions = endPositions[0];
for (i = 0; i < halfLength; i++) {
leftPos = Cartesian3_default.fromArray(
firstEndPositions,
(halfLength - 1 - i) * 3,
leftPos
);
rightPos = Cartesian3_default.fromArray(
firstEndPositions,
(halfLength + i) * 3,
rightPos
);
CorridorGeometryLibrary_default.addAttribute(finalPositions, rightPos, front);
CorridorGeometryLibrary_default.addAttribute(
finalPositions,
leftPos,
void 0,
back
);
LL = front / 3;
LR = LL + 1;
UL = (back - 2) / 3;
UR = UL - 1;
indices[index++] = UL;
indices[index++] = UR;
indices[index++] = LL;
indices[index++] = LR;
front += 3;
back -= 3;
}
}
let posIndex = 0;
let rightEdge = positions[posIndex++];
let leftEdge = positions[posIndex++];
finalPositions.set(rightEdge, front);
finalPositions.set(leftEdge, back - leftEdge.length + 1);
length = leftEdge.length - 3;
wallIndices.push(front / 3, (back - 2) / 3);
for (i = 0; i < length; i += 3) {
LL = front / 3;
LR = LL + 1;
UL = (back - 2) / 3;
UR = UL - 1;
indices[index++] = UL;
indices[index++] = UR;
indices[index++] = LL;
indices[index++] = LR;
front += 3;
back -= 3;
}
for (i = 0; i < corners.length; i++) {
let j;
corner = corners[i];
const l = corner.leftPositions;
const r = corner.rightPositions;
let start;
let outsidePoint = cartesian3;
if (defined_default(l)) {
back -= 3;
start = UR;
wallIndices.push(LR);
for (j = 0; j < l.length / 3; j++) {
outsidePoint = Cartesian3_default.fromArray(l, j * 3, outsidePoint);
indices[index++] = start - j - 1;
indices[index++] = start - j;
CorridorGeometryLibrary_default.addAttribute(
finalPositions,
outsidePoint,
void 0,
back
);
back -= 3;
}
wallIndices.push(start - Math.floor(l.length / 6));
if (cornerType === CornerType_default.BEVELED) {
wallIndices.push((back - 2) / 3 + 1);
}
front += 3;
} else {
front += 3;
start = LR;
wallIndices.push(UR);
for (j = 0; j < r.length / 3; j++) {
outsidePoint = Cartesian3_default.fromArray(r, j * 3, outsidePoint);
indices[index++] = start + j;
indices[index++] = start + j + 1;
CorridorGeometryLibrary_default.addAttribute(
finalPositions,
outsidePoint,
front
);
front += 3;
}
wallIndices.push(start + Math.floor(r.length / 6));
if (cornerType === CornerType_default.BEVELED) {
wallIndices.push(front / 3 - 1);
}
back -= 3;
}
rightEdge = positions[posIndex++];
leftEdge = positions[posIndex++];
rightEdge.splice(0, 3);
leftEdge.splice(leftEdge.length - 3, 3);
finalPositions.set(rightEdge, front);
finalPositions.set(leftEdge, back - leftEdge.length + 1);
length = leftEdge.length - 3;
for (j = 0; j < leftEdge.length; j += 3) {
LR = front / 3;
LL = LR - 1;
UR = (back - 2) / 3;
UL = UR + 1;
indices[index++] = UL;
indices[index++] = UR;
indices[index++] = LL;
indices[index++] = LR;
front += 3;
back -= 3;
}
front -= 3;
back += 3;
wallIndices.push(front / 3, (back - 2) / 3);
}
if (addEndPositions) {
front += 3;
back -= 3;
leftPos = cartesian1;
rightPos = cartesian2;
const lastEndPositions = endPositions[1];
for (i = 0; i < halfLength; i++) {
leftPos = Cartesian3_default.fromArray(
lastEndPositions,
(endPositionLength - i - 1) * 3,
leftPos
);
rightPos = Cartesian3_default.fromArray(lastEndPositions, i * 3, rightPos);
CorridorGeometryLibrary_default.addAttribute(
finalPositions,
leftPos,
void 0,
back
);
CorridorGeometryLibrary_default.addAttribute(finalPositions, rightPos, front);
LR = front / 3;
LL = LR - 1;
UR = (back - 2) / 3;
UL = UR + 1;
indices[index++] = UL;
indices[index++] = UR;
indices[index++] = LL;
indices[index++] = LR;
front += 3;
back -= 3;
}
wallIndices.push(front / 3);
} else {
wallIndices.push(front / 3, (back - 2) / 3);
}
indices[index++] = front / 3;
indices[index++] = (back - 2) / 3;
attributes.position = new GeometryAttribute_default({
componentDatatype: ComponentDatatype_default.DOUBLE,
componentsPerAttribute: 3,
values: finalPositions
});
return {
attributes,
indices,
wallIndices
};
}
function computePositionsExtruded(params) {
const ellipsoid = params.ellipsoid;
const computedPositions = CorridorGeometryLibrary_default.computePositions(params);
const attr = combine(computedPositions, params.cornerType);
const wallIndices = attr.wallIndices;
const height = params.height;
const extrudedHeight = params.extrudedHeight;
const attributes = attr.attributes;
const indices = attr.indices;
let positions = attributes.position.values;
let length = positions.length;
let extrudedPositions = new Float64Array(length);
extrudedPositions.set(positions);
const newPositions = new Float64Array(length * 2);
positions = PolygonPipeline_default.scaleToGeodeticHeight(
positions,
height,
ellipsoid
);
extrudedPositions = PolygonPipeline_default.scaleToGeodeticHeight(
extrudedPositions,
extrudedHeight,
ellipsoid
);
newPositions.set(positions);
newPositions.set(extrudedPositions, length);
attributes.position.values = newPositions;
length /= 3;
if (defined_default(params.offsetAttribute)) {
let applyOffset = new Uint8Array(length * 2);
if (params.offsetAttribute === GeometryOffsetAttribute_default.TOP) {
applyOffset = applyOffset.fill(1, 0, length);
} else {
const applyOffsetValue = params.offsetAttribute === GeometryOffsetAttribute_default.NONE ? 0 : 1;
applyOffset = applyOffset.fill(applyOffsetValue);
}
attributes.applyOffset = new GeometryAttribute_default({
componentDatatype: ComponentDatatype_default.UNSIGNED_BYTE,
componentsPerAttribute: 1,
values: applyOffset
});
}
let i;
const iLength = indices.length;
const newIndices = IndexDatatype_default.createTypedArray(
newPositions.length / 3,
(iLength + wallIndices.length) * 2
);
newIndices.set(indices);
let index = iLength;
for (i = 0; i < iLength; i += 2) {
const v0 = indices[i];
const v1 = indices[i + 1];
newIndices[index++] = v0 + length;
newIndices[index++] = v1 + length;
}
let UL, LL;
for (i = 0; i < wallIndices.length; i++) {
UL = wallIndices[i];
LL = UL + length;
newIndices[index++] = UL;
newIndices[index++] = LL;
}
return {
attributes,
indices: newIndices
};
}
function CorridorOutlineGeometry(options) {
options = options ?? Frozen_default.EMPTY_OBJECT;
const positions = options.positions;
const width = options.width;
Check_default.typeOf.object("options.positions", positions);
Check_default.typeOf.number("options.width", width);
const height = options.height ?? 0;
const extrudedHeight = options.extrudedHeight ?? height;
this._positions = positions;
this._ellipsoid = Ellipsoid_default.clone(options.ellipsoid ?? Ellipsoid_default.default);
this._width = width;
this._height = Math.max(height, extrudedHeight);
this._extrudedHeight = Math.min(height, extrudedHeight);
this._cornerType = options.cornerType ?? CornerType_default.ROUNDED;
this._granularity = options.granularity ?? Math_default.RADIANS_PER_DEGREE;
this._offsetAttribute = options.offsetAttribute;
this._workerName = "createCorridorOutlineGeometry";
this.packedLength = 1 + positions.length * Cartesian3_default.packedLength + Ellipsoid_default.packedLength + 6;
}
CorridorOutlineGeometry.pack = function(value, array, startingIndex) {
Check_default.typeOf.object("value", value);
Check_default.typeOf.object("array", array);
startingIndex = startingIndex ?? 0;
const positions = value._positions;
const length = positions.length;
array[startingIndex++] = length;
for (let i = 0; i < length; ++i, startingIndex += Cartesian3_default.packedLength) {
Cartesian3_default.pack(positions[i], array, startingIndex);
}
Ellipsoid_default.pack(value._ellipsoid, array, startingIndex);
startingIndex += Ellipsoid_default.packedLength;
array[startingIndex++] = value._width;
array[startingIndex++] = value._height;
array[startingIndex++] = value._extrudedHeight;
array[startingIndex++] = value._cornerType;
array[startingIndex++] = value._granularity;
array[startingIndex] = value._offsetAttribute ?? -1;
return array;
};
var scratchEllipsoid = Ellipsoid_default.clone(Ellipsoid_default.UNIT_SPHERE);
var scratchOptions = {
positions: void 0,
ellipsoid: scratchEllipsoid,
width: void 0,
height: void 0,
extrudedHeight: void 0,
cornerType: void 0,
granularity: void 0,
offsetAttribute: void 0
};
CorridorOutlineGeometry.unpack = function(array, startingIndex, result) {
Check_default.typeOf.object("array", array);
startingIndex = startingIndex ?? 0;
const length = array[startingIndex++];
const positions = new Array(length);
for (let i = 0; i < length; ++i, startingIndex += Cartesian3_default.packedLength) {
positions[i] = Cartesian3_default.unpack(array, startingIndex);
}
const ellipsoid = Ellipsoid_default.unpack(array, startingIndex, scratchEllipsoid);
startingIndex += Ellipsoid_default.packedLength;
const width = array[startingIndex++];
const height = array[startingIndex++];
const extrudedHeight = array[startingIndex++];
const cornerType = array[startingIndex++];
const granularity = array[startingIndex++];
const offsetAttribute = array[startingIndex];
if (!defined_default(result)) {
scratchOptions.positions = positions;
scratchOptions.width = width;
scratchOptions.height = height;
scratchOptions.extrudedHeight = extrudedHeight;
scratchOptions.cornerType = cornerType;
scratchOptions.granularity = granularity;
scratchOptions.offsetAttribute = offsetAttribute === -1 ? void 0 : offsetAttribute;
return new CorridorOutlineGeometry(scratchOptions);
}
result._positions = positions;
result._ellipsoid = Ellipsoid_default.clone(ellipsoid, result._ellipsoid);
result._width = width;
result._height = height;
result._extrudedHeight = extrudedHeight;
result._cornerType = cornerType;
result._granularity = granularity;
result._offsetAttribute = offsetAttribute === -1 ? void 0 : offsetAttribute;
return result;
};
CorridorOutlineGeometry.createGeometry = function(corridorOutlineGeometry) {
let positions = corridorOutlineGeometry._positions;
const width = corridorOutlineGeometry._width;
const ellipsoid = corridorOutlineGeometry._ellipsoid;
positions = scaleToSurface(positions, ellipsoid);
const cleanPositions = arrayRemoveDuplicates_default(
positions,
Cartesian3_default.equalsEpsilon
);
if (cleanPositions.length < 2 || width <= 0) {
return;
}
const height = corridorOutlineGeometry._height;
const extrudedHeight = corridorOutlineGeometry._extrudedHeight;
const extrude = !Math_default.equalsEpsilon(
height,
extrudedHeight,
0,
Math_default.EPSILON2
);
const params = {
ellipsoid,
positions: cleanPositions,
width,
cornerType: corridorOutlineGeometry._cornerType,
granularity: corridorOutlineGeometry._granularity,
saveAttributes: false
};
let attr;
if (extrude) {
params.height = height;
params.extrudedHeight = extrudedHeight;
params.offsetAttribute = corridorOutlineGeometry._offsetAttribute;
attr = computePositionsExtruded(params);
} else {
const computedPositions = CorridorGeometryLibrary_default.computePositions(params);
attr = combine(computedPositions, params.cornerType);
attr.attributes.position.values = PolygonPipeline_default.scaleToGeodeticHeight(
attr.attributes.position.values,
height,
ellipsoid
);
if (defined_default(corridorOutlineGeometry._offsetAttribute)) {
const length = attr.attributes.position.values.length;
const offsetValue = corridorOutlineGeometry._offsetAttribute === GeometryOffsetAttribute_default.NONE ? 0 : 1;
const applyOffset = new Uint8Array(length / 3).fill(offsetValue);
attr.attributes.applyOffset = new GeometryAttribute_default({
componentDatatype: ComponentDatatype_default.UNSIGNED_BYTE,
componentsPerAttribute: 1,
values: applyOffset
});
}
}
const attributes = attr.attributes;
const boundingSphere = BoundingSphere_default.fromVertices(
attributes.position.values,
void 0,
3
);
return new Geometry_default({
attributes,
indices: attr.indices,
primitiveType: PrimitiveType_default.LINES,
boundingSphere,
offsetAttribute: corridorOutlineGeometry._offsetAttribute
});
};
var CorridorOutlineGeometry_default = CorridorOutlineGeometry;
// packages/engine/Source/Workers/createCorridorOutlineGeometry.js
function createCorridorOutlineGeometry(corridorOutlineGeometry, offset) {
if (defined_default(offset)) {
corridorOutlineGeometry = CorridorOutlineGeometry_default.unpack(
corridorOutlineGeometry,
offset
);
}
corridorOutlineGeometry._ellipsoid = Ellipsoid_default.clone(
corridorOutlineGeometry._ellipsoid
);
return CorridorOutlineGeometry_default.createGeometry(corridorOutlineGeometry);
}
var createCorridorOutlineGeometry_default = createCorridorOutlineGeometry;
export {
createCorridorOutlineGeometry_default as default
};
@@ -0,0 +1,60 @@
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.142.0
*
* 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 {
CylinderGeometry_default
} from "./chunk-52JDLOEM.js";
import "./chunk-IRBKFCEJ.js";
import "./chunk-IYOUHCZB.js";
import "./chunk-VQYETPWC.js";
import "./chunk-S4MCOY6I.js";
import "./chunk-KSSWJIZW.js";
import "./chunk-EBSIOBXY.js";
import "./chunk-XZMBNNDX.js";
import "./chunk-C6J67V5A.js";
import "./chunk-MYP774IS.js";
import "./chunk-Q3PY526V.js";
import "./chunk-P3CK7MCY.js";
import "./chunk-TKKIREQ6.js";
import "./chunk-Y5BF6AFU.js";
import "./chunk-V7VQKN6N.js";
import "./chunk-MPZHGZU6.js";
import "./chunk-J6BWOHUF.js";
import "./chunk-AYKR4VBR.js";
import {
defined_default
} from "./chunk-ZP7JMQV4.js";
// packages/engine/Source/Workers/createCylinderGeometry.js
function createCylinderGeometry(cylinderGeometry, offset) {
if (defined_default(offset)) {
cylinderGeometry = CylinderGeometry_default.unpack(cylinderGeometry, offset);
}
return CylinderGeometry_default.createGeometry(cylinderGeometry);
}
var createCylinderGeometry_default = createCylinderGeometry;
export {
createCylinderGeometry_default as default
};
@@ -0,0 +1,231 @@
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.142.0
*
* 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-IRBKFCEJ.js";
import {
GeometryOffsetAttribute_default
} from "./chunk-IYOUHCZB.js";
import {
IndexDatatype_default
} from "./chunk-S4MCOY6I.js";
import {
GeometryAttributes_default
} from "./chunk-KSSWJIZW.js";
import {
GeometryAttribute_default,
Geometry_default,
PrimitiveType_default
} from "./chunk-EBSIOBXY.js";
import {
BoundingSphere_default
} from "./chunk-XZMBNNDX.js";
import "./chunk-C6J67V5A.js";
import "./chunk-MYP774IS.js";
import "./chunk-Q3PY526V.js";
import {
ComponentDatatype_default
} from "./chunk-P3CK7MCY.js";
import "./chunk-TKKIREQ6.js";
import "./chunk-Y5BF6AFU.js";
import {
Cartesian2_default
} from "./chunk-V7VQKN6N.js";
import {
Cartesian3_default,
Frozen_default
} from "./chunk-MPZHGZU6.js";
import "./chunk-J6BWOHUF.js";
import {
Check_default,
DeveloperError_default
} from "./chunk-AYKR4VBR.js";
import {
defined_default
} from "./chunk-ZP7JMQV4.js";
// packages/engine/Source/Core/CylinderOutlineGeometry.js
var radiusScratch = new Cartesian2_default();
function CylinderOutlineGeometry(options) {
options = options ?? Frozen_default.EMPTY_OBJECT;
const length = options.length;
const topRadius = options.topRadius;
const bottomRadius = options.bottomRadius;
const slices = options.slices ?? 128;
const numberOfVerticalLines = Math.max(
options.numberOfVerticalLines ?? 16,
0
);
Check_default.typeOf.number("options.positions", length);
Check_default.typeOf.number("options.topRadius", topRadius);
Check_default.typeOf.number("options.bottomRadius", bottomRadius);
Check_default.typeOf.number.greaterThanOrEquals("options.slices", slices, 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._slices = slices;
this._numberOfVerticalLines = numberOfVerticalLines;
this._offsetAttribute = options.offsetAttribute;
this._workerName = "createCylinderOutlineGeometry";
}
CylinderOutlineGeometry.packedLength = 6;
CylinderOutlineGeometry.pack = function(value, array, startingIndex) {
Check_default.typeOf.object("value", value);
Check_default.defined("array", array);
startingIndex = startingIndex ?? 0;
array[startingIndex++] = value._length;
array[startingIndex++] = value._topRadius;
array[startingIndex++] = value._bottomRadius;
array[startingIndex++] = value._slices;
array[startingIndex++] = value._numberOfVerticalLines;
array[startingIndex] = value._offsetAttribute ?? -1;
return array;
};
var scratchOptions = {
length: void 0,
topRadius: void 0,
bottomRadius: void 0,
slices: void 0,
numberOfVerticalLines: void 0,
offsetAttribute: void 0
};
CylinderOutlineGeometry.unpack = function(array, startingIndex, result) {
Check_default.defined("array", array);
startingIndex = startingIndex ?? 0;
const length = array[startingIndex++];
const topRadius = array[startingIndex++];
const bottomRadius = array[startingIndex++];
const slices = array[startingIndex++];
const numberOfVerticalLines = array[startingIndex++];
const offsetAttribute = array[startingIndex];
if (!defined_default(result)) {
scratchOptions.length = length;
scratchOptions.topRadius = topRadius;
scratchOptions.bottomRadius = bottomRadius;
scratchOptions.slices = slices;
scratchOptions.numberOfVerticalLines = numberOfVerticalLines;
scratchOptions.offsetAttribute = offsetAttribute === -1 ? void 0 : offsetAttribute;
return new CylinderOutlineGeometry(scratchOptions);
}
result._length = length;
result._topRadius = topRadius;
result._bottomRadius = bottomRadius;
result._slices = slices;
result._numberOfVerticalLines = numberOfVerticalLines;
result._offsetAttribute = offsetAttribute === -1 ? void 0 : offsetAttribute;
return result;
};
CylinderOutlineGeometry.createGeometry = function(cylinderGeometry) {
let length = cylinderGeometry._length;
const topRadius = cylinderGeometry._topRadius;
const bottomRadius = cylinderGeometry._bottomRadius;
const slices = cylinderGeometry._slices;
const numberOfVerticalLines = cylinderGeometry._numberOfVerticalLines;
if (length <= 0 || topRadius < 0 || bottomRadius < 0 || topRadius === 0 && bottomRadius === 0) {
return;
}
const numVertices = slices * 2;
const positions = CylinderGeometryLibrary_default.computePositions(
length,
topRadius,
bottomRadius,
slices,
false
);
let numIndices = slices * 2;
let numSide;
if (numberOfVerticalLines > 0) {
const numSideLines = Math.min(numberOfVerticalLines, slices);
numSide = Math.round(slices / numSideLines);
numIndices += numSideLines;
}
const indices = IndexDatatype_default.createTypedArray(numVertices, numIndices * 2);
let index = 0;
let i;
for (i = 0; i < slices - 1; i++) {
indices[index++] = i;
indices[index++] = i + 1;
indices[index++] = i + slices;
indices[index++] = i + 1 + slices;
}
indices[index++] = slices - 1;
indices[index++] = 0;
indices[index++] = slices + slices - 1;
indices[index++] = slices;
if (numberOfVerticalLines > 0) {
for (i = 0; i < slices; i += numSide) {
indices[index++] = i;
indices[index++] = i + slices;
}
}
const attributes = new GeometryAttributes_default();
attributes.position = new GeometryAttribute_default({
componentDatatype: ComponentDatatype_default.DOUBLE,
componentsPerAttribute: 3,
values: positions
});
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.LINES,
boundingSphere,
offsetAttribute: cylinderGeometry._offsetAttribute
});
};
var CylinderOutlineGeometry_default = CylinderOutlineGeometry;
// packages/engine/Source/Workers/createCylinderOutlineGeometry.js
function createCylinderOutlineGeometry(cylinderGeometry, offset) {
if (defined_default(offset)) {
cylinderGeometry = CylinderOutlineGeometry_default.unpack(cylinderGeometry, offset);
}
return CylinderOutlineGeometry_default.createGeometry(cylinderGeometry);
}
var createCylinderOutlineGeometry_default = createCylinderOutlineGeometry;
export {
createCylinderOutlineGeometry_default as default
};
@@ -0,0 +1,72 @@
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.142.0
*
* 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 {
EllipseGeometry_default
} from "./chunk-KKOSKAZB.js";
import "./chunk-YLY7NKAB.js";
import "./chunk-FRQZECAO.js";
import "./chunk-ACXQXN46.js";
import "./chunk-7J2HKPRH.js";
import "./chunk-Y57HREW5.js";
import "./chunk-IYOUHCZB.js";
import "./chunk-VQYETPWC.js";
import "./chunk-3VFEWOBI.js";
import "./chunk-E7VQ76KE.js";
import "./chunk-S4MCOY6I.js";
import "./chunk-KSSWJIZW.js";
import "./chunk-EBSIOBXY.js";
import "./chunk-XZMBNNDX.js";
import "./chunk-C6J67V5A.js";
import "./chunk-MYP774IS.js";
import "./chunk-Q3PY526V.js";
import "./chunk-P3CK7MCY.js";
import "./chunk-TKKIREQ6.js";
import "./chunk-Y5BF6AFU.js";
import {
Ellipsoid_default
} from "./chunk-V7VQKN6N.js";
import {
Cartesian3_default
} from "./chunk-MPZHGZU6.js";
import "./chunk-J6BWOHUF.js";
import "./chunk-AYKR4VBR.js";
import {
defined_default
} from "./chunk-ZP7JMQV4.js";
// packages/engine/Source/Workers/createEllipseGeometry.js
function createEllipseGeometry(ellipseGeometry, offset) {
if (defined_default(offset)) {
ellipseGeometry = EllipseGeometry_default.unpack(ellipseGeometry, offset);
}
ellipseGeometry._center = Cartesian3_default.clone(ellipseGeometry._center);
ellipseGeometry._ellipsoid = Ellipsoid_default.clone(ellipseGeometry._ellipsoid);
return EllipseGeometry_default.createGeometry(ellipseGeometry);
}
var createEllipseGeometry_default = createEllipseGeometry;
export {
createEllipseGeometry_default as default
};
@@ -0,0 +1,65 @@
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.142.0
*
* 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 {
EllipseOutlineGeometry_default
} from "./chunk-F6QDY6HU.js";
import "./chunk-YLY7NKAB.js";
import "./chunk-IYOUHCZB.js";
import "./chunk-S4MCOY6I.js";
import "./chunk-KSSWJIZW.js";
import "./chunk-EBSIOBXY.js";
import "./chunk-XZMBNNDX.js";
import "./chunk-C6J67V5A.js";
import "./chunk-MYP774IS.js";
import "./chunk-Q3PY526V.js";
import "./chunk-P3CK7MCY.js";
import "./chunk-TKKIREQ6.js";
import "./chunk-Y5BF6AFU.js";
import {
Ellipsoid_default
} from "./chunk-V7VQKN6N.js";
import {
Cartesian3_default
} from "./chunk-MPZHGZU6.js";
import "./chunk-J6BWOHUF.js";
import "./chunk-AYKR4VBR.js";
import {
defined_default
} from "./chunk-ZP7JMQV4.js";
// packages/engine/Source/Workers/createEllipseOutlineGeometry.js
function createEllipseOutlineGeometry(ellipseGeometry, offset) {
if (defined_default(offset)) {
ellipseGeometry = EllipseOutlineGeometry_default.unpack(ellipseGeometry, offset);
}
ellipseGeometry._center = Cartesian3_default.clone(ellipseGeometry._center);
ellipseGeometry._ellipsoid = Ellipsoid_default.clone(ellipseGeometry._ellipsoid);
return EllipseOutlineGeometry_default.createGeometry(ellipseGeometry);
}
var createEllipseOutlineGeometry_default = createEllipseOutlineGeometry;
export {
createEllipseOutlineGeometry_default as default
};
@@ -0,0 +1,59 @@
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.142.0
*
* 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 {
EllipsoidGeometry_default
} from "./chunk-DOBXCNC3.js";
import "./chunk-IYOUHCZB.js";
import "./chunk-VQYETPWC.js";
import "./chunk-S4MCOY6I.js";
import "./chunk-KSSWJIZW.js";
import "./chunk-EBSIOBXY.js";
import "./chunk-XZMBNNDX.js";
import "./chunk-C6J67V5A.js";
import "./chunk-MYP774IS.js";
import "./chunk-Q3PY526V.js";
import "./chunk-P3CK7MCY.js";
import "./chunk-TKKIREQ6.js";
import "./chunk-Y5BF6AFU.js";
import "./chunk-V7VQKN6N.js";
import "./chunk-MPZHGZU6.js";
import "./chunk-J6BWOHUF.js";
import "./chunk-AYKR4VBR.js";
import {
defined_default
} from "./chunk-ZP7JMQV4.js";
// packages/engine/Source/Workers/createEllipsoidGeometry.js
function createEllipsoidGeometry(ellipsoidGeometry, offset) {
if (defined_default(offset)) {
ellipsoidGeometry = EllipsoidGeometry_default.unpack(ellipsoidGeometry, offset);
}
return EllipsoidGeometry_default.createGeometry(ellipsoidGeometry);
}
var createEllipsoidGeometry_default = createEllipsoidGeometry;
export {
createEllipsoidGeometry_default as default
};
@@ -0,0 +1,61 @@
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.142.0
*
* 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 {
EllipsoidOutlineGeometry_default
} from "./chunk-UOOIQ3KX.js";
import "./chunk-IYOUHCZB.js";
import "./chunk-S4MCOY6I.js";
import "./chunk-KSSWJIZW.js";
import "./chunk-EBSIOBXY.js";
import "./chunk-XZMBNNDX.js";
import "./chunk-C6J67V5A.js";
import "./chunk-MYP774IS.js";
import "./chunk-Q3PY526V.js";
import "./chunk-P3CK7MCY.js";
import "./chunk-TKKIREQ6.js";
import "./chunk-Y5BF6AFU.js";
import "./chunk-V7VQKN6N.js";
import "./chunk-MPZHGZU6.js";
import "./chunk-J6BWOHUF.js";
import "./chunk-AYKR4VBR.js";
import {
defined_default
} from "./chunk-ZP7JMQV4.js";
// packages/engine/Source/Workers/createEllipsoidOutlineGeometry.js
function createEllipsoidOutlineGeometry(ellipsoidGeometry, offset) {
if (defined_default(ellipsoidGeometry.buffer, offset)) {
ellipsoidGeometry = EllipsoidOutlineGeometry_default.unpack(
ellipsoidGeometry,
offset
);
}
return EllipsoidOutlineGeometry_default.createGeometry(ellipsoidGeometry);
}
var createEllipsoidOutlineGeometry_default = createEllipsoidOutlineGeometry;
export {
createEllipsoidOutlineGeometry_default as default
};
@@ -0,0 +1,58 @@
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.142.0
*
* 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 {
FrustumGeometry_default
} from "./chunk-EF2QYXGA.js";
import "./chunk-VQYETPWC.js";
import "./chunk-E7VQ76KE.js";
import "./chunk-KSSWJIZW.js";
import "./chunk-EBSIOBXY.js";
import "./chunk-XZMBNNDX.js";
import "./chunk-C6J67V5A.js";
import "./chunk-MYP774IS.js";
import "./chunk-Q3PY526V.js";
import "./chunk-P3CK7MCY.js";
import "./chunk-TKKIREQ6.js";
import "./chunk-Y5BF6AFU.js";
import "./chunk-V7VQKN6N.js";
import "./chunk-MPZHGZU6.js";
import "./chunk-J6BWOHUF.js";
import "./chunk-AYKR4VBR.js";
import {
defined_default
} from "./chunk-ZP7JMQV4.js";
// packages/engine/Source/Workers/createFrustumGeometry.js
function createFrustumGeometry(frustumGeometry, offset) {
if (defined_default(offset)) {
frustumGeometry = FrustumGeometry_default.unpack(frustumGeometry, offset);
}
return FrustumGeometry_default.createGeometry(frustumGeometry);
}
var createFrustumGeometry_default = createFrustumGeometry;
export {
createFrustumGeometry_default as default
};
@@ -0,0 +1,234 @@
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.142.0
*
* 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 {
FrustumGeometry_default,
OrthographicFrustum_default,
PerspectiveFrustum_default
} from "./chunk-EF2QYXGA.js";
import "./chunk-VQYETPWC.js";
import "./chunk-E7VQ76KE.js";
import {
GeometryAttributes_default
} from "./chunk-KSSWJIZW.js";
import {
GeometryAttribute_default,
Geometry_default,
PrimitiveType_default
} from "./chunk-EBSIOBXY.js";
import {
BoundingSphere_default
} from "./chunk-XZMBNNDX.js";
import "./chunk-C6J67V5A.js";
import {
Quaternion_default
} from "./chunk-MYP774IS.js";
import "./chunk-Q3PY526V.js";
import {
ComponentDatatype_default
} from "./chunk-P3CK7MCY.js";
import "./chunk-TKKIREQ6.js";
import "./chunk-Y5BF6AFU.js";
import "./chunk-V7VQKN6N.js";
import {
Cartesian3_default
} from "./chunk-MPZHGZU6.js";
import "./chunk-J6BWOHUF.js";
import {
Check_default
} from "./chunk-AYKR4VBR.js";
import {
defined_default
} from "./chunk-ZP7JMQV4.js";
// packages/engine/Source/Core/FrustumOutlineGeometry.js
var PERSPECTIVE = 0;
var ORTHOGRAPHIC = 1;
function FrustumOutlineGeometry(options) {
Check_default.typeOf.object("options", options);
Check_default.typeOf.object("options.frustum", options.frustum);
Check_default.typeOf.object("options.origin", options.origin);
Check_default.typeOf.object("options.orientation", options.orientation);
const frustum = options.frustum;
const orientation = options.orientation;
const origin = options.origin;
const drawNearPlane = options._drawNearPlane ?? true;
let frustumType;
let frustumPackedLength;
if (frustum instanceof PerspectiveFrustum_default) {
frustumType = PERSPECTIVE;
frustumPackedLength = PerspectiveFrustum_default.packedLength;
} else if (frustum instanceof OrthographicFrustum_default) {
frustumType = ORTHOGRAPHIC;
frustumPackedLength = OrthographicFrustum_default.packedLength;
}
this._frustumType = frustumType;
this._frustum = frustum.clone();
this._origin = Cartesian3_default.clone(origin);
this._orientation = Quaternion_default.clone(orientation);
this._drawNearPlane = drawNearPlane;
this._workerName = "createFrustumOutlineGeometry";
this.packedLength = 2 + frustumPackedLength + Cartesian3_default.packedLength + Quaternion_default.packedLength;
}
FrustumOutlineGeometry.pack = function(value, array, startingIndex) {
Check_default.typeOf.object("value", value);
Check_default.defined("array", array);
startingIndex = startingIndex ?? 0;
const frustumType = value._frustumType;
const frustum = value._frustum;
array[startingIndex++] = frustumType;
if (frustumType === PERSPECTIVE) {
PerspectiveFrustum_default.pack(frustum, array, startingIndex);
startingIndex += PerspectiveFrustum_default.packedLength;
} else {
OrthographicFrustum_default.pack(frustum, array, startingIndex);
startingIndex += OrthographicFrustum_default.packedLength;
}
Cartesian3_default.pack(value._origin, array, startingIndex);
startingIndex += Cartesian3_default.packedLength;
Quaternion_default.pack(value._orientation, array, startingIndex);
startingIndex += Quaternion_default.packedLength;
array[startingIndex] = value._drawNearPlane ? 1 : 0;
return array;
};
var scratchPackPerspective = new PerspectiveFrustum_default();
var scratchPackOrthographic = new OrthographicFrustum_default();
var scratchPackQuaternion = new Quaternion_default();
var scratchPackorigin = new Cartesian3_default();
FrustumOutlineGeometry.unpack = function(array, startingIndex, result) {
Check_default.defined("array", array);
startingIndex = startingIndex ?? 0;
const frustumType = array[startingIndex++];
let frustum;
if (frustumType === PERSPECTIVE) {
frustum = PerspectiveFrustum_default.unpack(
array,
startingIndex,
scratchPackPerspective
);
startingIndex += PerspectiveFrustum_default.packedLength;
} else {
frustum = OrthographicFrustum_default.unpack(
array,
startingIndex,
scratchPackOrthographic
);
startingIndex += OrthographicFrustum_default.packedLength;
}
const origin = Cartesian3_default.unpack(array, startingIndex, scratchPackorigin);
startingIndex += Cartesian3_default.packedLength;
const orientation = Quaternion_default.unpack(
array,
startingIndex,
scratchPackQuaternion
);
startingIndex += Quaternion_default.packedLength;
const drawNearPlane = array[startingIndex] === 1;
if (!defined_default(result)) {
return new FrustumOutlineGeometry({
frustum,
origin,
orientation,
_drawNearPlane: drawNearPlane
});
}
const frustumResult = frustumType === result._frustumType ? result._frustum : void 0;
result._frustum = frustum.clone(frustumResult);
result._frustumType = frustumType;
result._origin = Cartesian3_default.clone(origin, result._origin);
result._orientation = Quaternion_default.clone(orientation, result._orientation);
result._drawNearPlane = drawNearPlane;
return result;
};
FrustumOutlineGeometry.createGeometry = function(frustumGeometry) {
const frustumType = frustumGeometry._frustumType;
const frustum = frustumGeometry._frustum;
const origin = frustumGeometry._origin;
const orientation = frustumGeometry._orientation;
const drawNearPlane = frustumGeometry._drawNearPlane;
const positions = new Float64Array(3 * 4 * 2);
FrustumGeometry_default._computeNearFarPlanes(
origin,
orientation,
frustumType,
frustum,
positions
);
const attributes = new GeometryAttributes_default({
position: new GeometryAttribute_default({
componentDatatype: ComponentDatatype_default.DOUBLE,
componentsPerAttribute: 3,
values: positions
})
});
let offset;
let index;
const numberOfPlanes = drawNearPlane ? 2 : 1;
const indices = new Uint16Array(8 * (numberOfPlanes + 1));
let i = drawNearPlane ? 0 : 1;
for (; i < 2; ++i) {
offset = drawNearPlane ? i * 8 : 0;
index = i * 4;
indices[offset] = index;
indices[offset + 1] = index + 1;
indices[offset + 2] = index + 1;
indices[offset + 3] = index + 2;
indices[offset + 4] = index + 2;
indices[offset + 5] = index + 3;
indices[offset + 6] = index + 3;
indices[offset + 7] = index;
}
for (i = 0; i < 2; ++i) {
offset = (numberOfPlanes + i) * 8;
index = i * 4;
indices[offset] = index;
indices[offset + 1] = index + 4;
indices[offset + 2] = index + 1;
indices[offset + 3] = index + 5;
indices[offset + 4] = index + 2;
indices[offset + 5] = index + 6;
indices[offset + 6] = index + 3;
indices[offset + 7] = index + 7;
}
return new Geometry_default({
attributes,
indices,
primitiveType: PrimitiveType_default.LINES,
boundingSphere: BoundingSphere_default.fromVertices(positions)
});
};
var FrustumOutlineGeometry_default = FrustumOutlineGeometry;
// packages/engine/Source/Workers/createFrustumOutlineGeometry.js
function createFrustumOutlineGeometry(frustumGeometry, offset) {
if (defined_default(offset)) {
frustumGeometry = FrustumOutlineGeometry_default.unpack(frustumGeometry, offset);
}
return FrustumOutlineGeometry_default.createGeometry(frustumGeometry);
}
var createFrustumOutlineGeometry_default = createFrustumOutlineGeometry;
export {
createFrustumOutlineGeometry_default as default
};
+173
View File
@@ -0,0 +1,173 @@
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.142.0
*
* 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 {
PrimitivePipeline_default
} from "./chunk-ZK3CF7ZD.js";
import {
createTaskProcessorWorker_default
} from "./chunk-4S7IE3LB.js";
import "./chunk-4MGMYHOO.js";
import "./chunk-ACXQXN46.js";
import "./chunk-7J2HKPRH.js";
import "./chunk-Y57HREW5.js";
import "./chunk-3VFEWOBI.js";
import "./chunk-E7VQ76KE.js";
import "./chunk-S4MCOY6I.js";
import "./chunk-KSSWJIZW.js";
import "./chunk-EBSIOBXY.js";
import "./chunk-XZMBNNDX.js";
import "./chunk-C6J67V5A.js";
import "./chunk-MYP774IS.js";
import "./chunk-Q3PY526V.js";
import "./chunk-P3CK7MCY.js";
import "./chunk-TKKIREQ6.js";
import "./chunk-Y5BF6AFU.js";
import "./chunk-V7VQKN6N.js";
import "./chunk-MPZHGZU6.js";
import "./chunk-J6BWOHUF.js";
import {
DeveloperError_default
} from "./chunk-AYKR4VBR.js";
import {
__glob,
__require,
defined_default
} from "./chunk-ZP7JMQV4.js";
// import("./**/*.js") in packages/engine/Source/Workers/createGeometry.js
var globImport_js = __glob({
"./combineGeometry.js": () => import("./combineGeometry.js"),
"./createBoxGeometry.js": () => import("./createBoxGeometry.js"),
"./createBoxOutlineGeometry.js": () => import("./createBoxOutlineGeometry.js"),
"./createCircleGeometry.js": () => import("./createCircleGeometry.js"),
"./createCircleOutlineGeometry.js": () => import("./createCircleOutlineGeometry.js"),
"./createCoplanarPolygonGeometry.js": () => import("./createCoplanarPolygonGeometry.js"),
"./createCoplanarPolygonOutlineGeometry.js": () => import("./createCoplanarPolygonOutlineGeometry.js"),
"./createCorridorGeometry.js": () => import("./createCorridorGeometry.js"),
"./createCorridorOutlineGeometry.js": () => import("./createCorridorOutlineGeometry.js"),
"./createCylinderGeometry.js": () => import("./createCylinderGeometry.js"),
"./createCylinderOutlineGeometry.js": () => import("./createCylinderOutlineGeometry.js"),
"./createEllipseGeometry.js": () => import("./createEllipseGeometry.js"),
"./createEllipseOutlineGeometry.js": () => import("./createEllipseOutlineGeometry.js"),
"./createEllipsoidGeometry.js": () => import("./createEllipsoidGeometry.js"),
"./createEllipsoidOutlineGeometry.js": () => import("./createEllipsoidOutlineGeometry.js"),
"./createFrustumGeometry.js": () => import("./createFrustumGeometry.js"),
"./createFrustumOutlineGeometry.js": () => import("./createFrustumOutlineGeometry.js"),
"./createGeometry.js": () => import("./createGeometry.js"),
"./createGroundPolylineGeometry.js": () => import("./createGroundPolylineGeometry.js"),
"./createPlaneGeometry.js": () => import("./createPlaneGeometry.js"),
"./createPlaneOutlineGeometry.js": () => import("./createPlaneOutlineGeometry.js"),
"./createPolygonGeometry.js": () => import("./createPolygonGeometry.js"),
"./createPolygonOutlineGeometry.js": () => import("./createPolygonOutlineGeometry.js"),
"./createPolylineGeometry.js": () => import("./createPolylineGeometry.js"),
"./createPolylineVolumeGeometry.js": () => import("./createPolylineVolumeGeometry.js"),
"./createPolylineVolumeOutlineGeometry.js": () => import("./createPolylineVolumeOutlineGeometry.js"),
"./createRectangleGeometry.js": () => import("./createRectangleGeometry.js"),
"./createRectangleOutlineGeometry.js": () => import("./createRectangleOutlineGeometry.js"),
"./createSimplePolylineGeometry.js": () => import("./createSimplePolylineGeometry.js"),
"./createSphereGeometry.js": () => import("./createSphereGeometry.js"),
"./createSphereOutlineGeometry.js": () => import("./createSphereOutlineGeometry.js"),
"./createTaskProcessorWorker.js": () => import("./createTaskProcessorWorker.js"),
"./createVectorTileClampedPolylines.js": () => import("./createVectorTileClampedPolylines.js"),
"./createVectorTileGeometries.js": () => import("./createVectorTileGeometries.js"),
"./createVectorTilePoints.js": () => import("./createVectorTilePoints.js"),
"./createVectorTilePolygons.js": () => import("./createVectorTilePolygons.js"),
"./createVectorTilePolylines.js": () => import("./createVectorTilePolylines.js"),
"./createVerticesFromCesium3DTilesTerrain.js": () => import("./createVerticesFromCesium3DTilesTerrain.js"),
"./createVerticesFromGoogleEarthEnterpriseBuffer.js": () => import("./createVerticesFromGoogleEarthEnterpriseBuffer.js"),
"./createVerticesFromHeightmap.js": () => import("./createVerticesFromHeightmap.js"),
"./createVerticesFromQuantizedTerrainMesh.js": () => import("./createVerticesFromQuantizedTerrainMesh.js"),
"./createWallGeometry.js": () => import("./createWallGeometry.js"),
"./createWallOutlineGeometry.js": () => import("./createWallOutlineGeometry.js"),
"./decodeDraco.js": () => import("./decodeDraco.js"),
"./decodeGoogleEarthEnterprisePacket.js": () => import("./decodeGoogleEarthEnterprisePacket.js"),
"./decodeI3S.js": () => import("./decodeI3S.js"),
"./gaussianSplatSorter.js": () => import("./gaussianSplatSorter.js"),
"./gaussianSplatTextureGenerator.js": () => import("./gaussianSplatTextureGenerator.js"),
"./incrementallyBuildTerrainPicker.js": () => import("./incrementallyBuildTerrainPicker.js"),
"./transcodeKTX2.js": () => import("./transcodeKTX2.js"),
"./transferTypedArrayTest.js": () => import("./transferTypedArrayTest.js"),
"./upsampleQuantizedTerrainMesh.js": () => import("./upsampleQuantizedTerrainMesh.js"),
"./upsampleVerticesFromCesium3DTilesTerrain.js": () => import("./upsampleVerticesFromCesium3DTilesTerrain.js")
});
// packages/engine/Source/Workers/createGeometry.js
var moduleCache = {};
async function getModule(moduleName, modulePath) {
let module = moduleCache[modulePath] ?? moduleCache[moduleName];
if (defined_default(module)) {
return module;
}
if (defined_default(modulePath)) {
if (typeof exports === "object") {
module = __require(modulePath);
} else {
const result = await import(modulePath);
module = result.default;
}
moduleCache[modulePath] = module;
return module;
}
if (typeof exports === "object") {
module = __require(`Workers/${moduleName}`);
} else {
const result = defined_default(modulePath) ? await import(modulePath) : await globImport_js(`./${moduleName}.js`);
module = result.default;
}
moduleCache[moduleName] = module;
return module;
}
async function createGeometry(parameters, transferableObjects) {
const subTasks = parameters.subTasks;
const length = subTasks.length;
const resultsOrPromises = new Array(length);
for (let i = 0; i < length; i++) {
const task = subTasks[i];
const geometry = task.geometry;
const moduleName = task.moduleName;
const modulePath = task.modulePath;
if (defined_default(moduleName) && defined_default(modulePath)) {
throw new DeveloperError_default("Must only set moduleName or modulePath");
}
if (defined_default(moduleName) || defined_default(modulePath)) {
resultsOrPromises[i] = getModule(moduleName, modulePath).then(
(createFunction) => createFunction(geometry, task.offset)
);
} else {
resultsOrPromises[i] = geometry;
}
}
return Promise.all(resultsOrPromises).then(function(results) {
return PrimitivePipeline_default.packCreateGeometryResults(
results,
transferableObjects
);
});
}
var createGeometry_default = createTaskProcessorWorker_default(createGeometry);
export {
createGeometry_default as default
};
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,223 @@
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.142.0
*
* 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 {
VertexFormat_default
} from "./chunk-VQYETPWC.js";
import {
GeometryAttributes_default
} from "./chunk-KSSWJIZW.js";
import {
GeometryAttribute_default,
Geometry_default,
PrimitiveType_default
} from "./chunk-EBSIOBXY.js";
import {
BoundingSphere_default
} from "./chunk-XZMBNNDX.js";
import "./chunk-C6J67V5A.js";
import "./chunk-MYP774IS.js";
import "./chunk-Q3PY526V.js";
import {
ComponentDatatype_default
} from "./chunk-P3CK7MCY.js";
import "./chunk-TKKIREQ6.js";
import "./chunk-Y5BF6AFU.js";
import "./chunk-V7VQKN6N.js";
import {
Cartesian3_default,
Frozen_default
} from "./chunk-MPZHGZU6.js";
import "./chunk-J6BWOHUF.js";
import {
Check_default
} from "./chunk-AYKR4VBR.js";
import {
defined_default
} from "./chunk-ZP7JMQV4.js";
// packages/engine/Source/Core/PlaneGeometry.js
function PlaneGeometry(options) {
options = options ?? Frozen_default.EMPTY_OBJECT;
const vertexFormat = options.vertexFormat ?? VertexFormat_default.DEFAULT;
this._vertexFormat = vertexFormat;
this._workerName = "createPlaneGeometry";
}
PlaneGeometry.packedLength = VertexFormat_default.packedLength;
PlaneGeometry.pack = function(value, array, startingIndex) {
Check_default.typeOf.object("value", value);
Check_default.defined("array", array);
startingIndex = startingIndex ?? 0;
VertexFormat_default.pack(value._vertexFormat, array, startingIndex);
return array;
};
var scratchVertexFormat = new VertexFormat_default();
var scratchOptions = {
vertexFormat: scratchVertexFormat
};
PlaneGeometry.unpack = function(array, startingIndex, result) {
Check_default.defined("array", array);
startingIndex = startingIndex ?? 0;
const vertexFormat = VertexFormat_default.unpack(
array,
startingIndex,
scratchVertexFormat
);
if (!defined_default(result)) {
return new PlaneGeometry(scratchOptions);
}
result._vertexFormat = VertexFormat_default.clone(vertexFormat, result._vertexFormat);
return result;
};
var min = new Cartesian3_default(-0.5, -0.5, 0);
var max = new Cartesian3_default(0.5, 0.5, 0);
PlaneGeometry.createGeometry = function(planeGeometry) {
const vertexFormat = planeGeometry._vertexFormat;
const attributes = new GeometryAttributes_default();
let indices;
let positions;
if (vertexFormat.position) {
positions = new Float64Array(4 * 3);
positions[0] = min.x;
positions[1] = min.y;
positions[2] = 0;
positions[3] = max.x;
positions[4] = min.y;
positions[5] = 0;
positions[6] = max.x;
positions[7] = max.y;
positions[8] = 0;
positions[9] = min.x;
positions[10] = max.y;
positions[11] = 0;
attributes.position = new GeometryAttribute_default({
componentDatatype: ComponentDatatype_default.DOUBLE,
componentsPerAttribute: 3,
values: positions
});
if (vertexFormat.normal) {
const normals = new Float32Array(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;
attributes.normal = new GeometryAttribute_default({
componentDatatype: ComponentDatatype_default.FLOAT,
componentsPerAttribute: 3,
values: normals
});
}
if (vertexFormat.st) {
const texCoords = new Float32Array(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;
attributes.st = new GeometryAttribute_default({
componentDatatype: ComponentDatatype_default.FLOAT,
componentsPerAttribute: 2,
values: texCoords
});
}
if (vertexFormat.tangent) {
const tangents = new Float32Array(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;
attributes.tangent = new GeometryAttribute_default({
componentDatatype: ComponentDatatype_default.FLOAT,
componentsPerAttribute: 3,
values: tangents
});
}
if (vertexFormat.bitangent) {
const bitangents = new Float32Array(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;
attributes.bitangent = new GeometryAttribute_default({
componentDatatype: ComponentDatatype_default.FLOAT,
componentsPerAttribute: 3,
values: bitangents
});
}
indices = new Uint16Array(2 * 3);
indices[0] = 0;
indices[1] = 1;
indices[2] = 2;
indices[3] = 0;
indices[4] = 2;
indices[5] = 3;
}
return new Geometry_default({
attributes,
indices,
primitiveType: PrimitiveType_default.TRIANGLES,
boundingSphere: new BoundingSphere_default(Cartesian3_default.ZERO, Math.sqrt(2))
});
};
var PlaneGeometry_default = PlaneGeometry;
// packages/engine/Source/Workers/createPlaneGeometry.js
function createPlaneGeometry(planeGeometry, offset) {
if (defined_default(offset)) {
planeGeometry = PlaneGeometry_default.unpack(planeGeometry, offset);
}
return PlaneGeometry_default.createGeometry(planeGeometry);
}
var createPlaneGeometry_default = createPlaneGeometry;
export {
createPlaneGeometry_default as default
};
@@ -0,0 +1,124 @@
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.142.0
*
* 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 {
GeometryAttributes_default
} from "./chunk-KSSWJIZW.js";
import {
GeometryAttribute_default,
Geometry_default,
PrimitiveType_default
} from "./chunk-EBSIOBXY.js";
import {
BoundingSphere_default
} from "./chunk-XZMBNNDX.js";
import "./chunk-C6J67V5A.js";
import "./chunk-MYP774IS.js";
import "./chunk-Q3PY526V.js";
import {
ComponentDatatype_default
} from "./chunk-P3CK7MCY.js";
import "./chunk-TKKIREQ6.js";
import "./chunk-Y5BF6AFU.js";
import "./chunk-V7VQKN6N.js";
import {
Cartesian3_default
} from "./chunk-MPZHGZU6.js";
import "./chunk-J6BWOHUF.js";
import {
Check_default
} from "./chunk-AYKR4VBR.js";
import {
defined_default
} from "./chunk-ZP7JMQV4.js";
// packages/engine/Source/Core/PlaneOutlineGeometry.js
function PlaneOutlineGeometry() {
this._workerName = "createPlaneOutlineGeometry";
}
PlaneOutlineGeometry.packedLength = 0;
PlaneOutlineGeometry.pack = function(value, array) {
Check_default.defined("value", value);
Check_default.defined("array", array);
return array;
};
PlaneOutlineGeometry.unpack = function(array, startingIndex, result) {
Check_default.defined("array", array);
if (!defined_default(result)) {
return new PlaneOutlineGeometry();
}
return result;
};
var min = new Cartesian3_default(-0.5, -0.5, 0);
var max = new Cartesian3_default(0.5, 0.5, 0);
PlaneOutlineGeometry.createGeometry = function() {
const attributes = new GeometryAttributes_default();
const indices = new Uint16Array(4 * 2);
const positions = new Float64Array(4 * 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;
attributes.position = new GeometryAttribute_default({
componentDatatype: ComponentDatatype_default.DOUBLE,
componentsPerAttribute: 3,
values: positions
});
indices[0] = 0;
indices[1] = 1;
indices[2] = 1;
indices[3] = 2;
indices[4] = 2;
indices[5] = 3;
indices[6] = 3;
indices[7] = 0;
return new Geometry_default({
attributes,
indices,
primitiveType: PrimitiveType_default.LINES,
boundingSphere: new BoundingSphere_default(Cartesian3_default.ZERO, Math.sqrt(2))
});
};
var PlaneOutlineGeometry_default = PlaneOutlineGeometry;
// packages/engine/Source/Workers/createPlaneOutlineGeometry.js
function createPlaneOutlineGeometry(planeGeometry, offset) {
if (defined_default(offset)) {
planeGeometry = PlaneOutlineGeometry_default.unpack(planeGeometry, offset);
}
return PlaneOutlineGeometry_default.createGeometry(planeGeometry);
}
var createPlaneOutlineGeometry_default = createPlaneOutlineGeometry;
export {
createPlaneOutlineGeometry_default as default
};
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,532 @@
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.142.0
*
* 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 {
PolygonGeometryLibrary_default
} from "./chunk-C6KNZ7T4.js";
import {
ArcType_default
} from "./chunk-M3B5JKSM.js";
import {
GeometryInstance_default
} from "./chunk-FRQZECAO.js";
import {
GeometryPipeline_default
} from "./chunk-ACXQXN46.js";
import "./chunk-7J2HKPRH.js";
import "./chunk-Y57HREW5.js";
import {
GeometryOffsetAttribute_default
} from "./chunk-IYOUHCZB.js";
import {
EllipsoidTangentPlane_default
} from "./chunk-SMQZZOW6.js";
import "./chunk-DDWSZVMY.js";
import {
PolygonPipeline_default,
WindingOrder_default
} from "./chunk-O3EA5HS7.js";
import "./chunk-CFQP6LYM.js";
import "./chunk-54I6Y66F.js";
import "./chunk-3VFEWOBI.js";
import "./chunk-E7VQ76KE.js";
import {
IndexDatatype_default
} from "./chunk-S4MCOY6I.js";
import {
GeometryAttributes_default
} from "./chunk-KSSWJIZW.js";
import {
GeometryAttribute_default,
Geometry_default,
PrimitiveType_default
} from "./chunk-EBSIOBXY.js";
import {
BoundingSphere_default
} from "./chunk-XZMBNNDX.js";
import "./chunk-C6J67V5A.js";
import "./chunk-MYP774IS.js";
import "./chunk-Q3PY526V.js";
import {
ComponentDatatype_default
} from "./chunk-P3CK7MCY.js";
import "./chunk-TKKIREQ6.js";
import "./chunk-Y5BF6AFU.js";
import {
Ellipsoid_default
} from "./chunk-V7VQKN6N.js";
import {
Cartesian3_default,
Frozen_default
} from "./chunk-MPZHGZU6.js";
import {
Math_default
} from "./chunk-J6BWOHUF.js";
import {
Check_default,
DeveloperError_default
} from "./chunk-AYKR4VBR.js";
import {
defined_default
} from "./chunk-ZP7JMQV4.js";
// packages/engine/Source/Core/PolygonOutlineGeometry.js
var createGeometryFromPositionsPositions = [];
var createGeometryFromPositionsSubdivided = [];
function createGeometryFromPositions(ellipsoid, positions, minDistance, perPositionHeight, arcType) {
const tangentPlane = EllipsoidTangentPlane_default.fromPoints(positions, ellipsoid);
const positions2D = tangentPlane.projectPointsOntoPlane(
positions,
createGeometryFromPositionsPositions
);
const originalWindingOrder = PolygonPipeline_default.computeWindingOrder2D(positions2D);
if (originalWindingOrder === WindingOrder_default.CLOCKWISE) {
positions2D.reverse();
positions = positions.slice().reverse();
}
let subdividedPositions;
let i;
let length = positions.length;
let index = 0;
if (!perPositionHeight) {
let numVertices = 0;
if (arcType === ArcType_default.GEODESIC) {
for (i = 0; i < length; i++) {
numVertices += PolygonGeometryLibrary_default.subdivideLineCount(
positions[i],
positions[(i + 1) % length],
minDistance
);
}
} else if (arcType === ArcType_default.RHUMB) {
for (i = 0; i < length; i++) {
numVertices += PolygonGeometryLibrary_default.subdivideRhumbLineCount(
ellipsoid,
positions[i],
positions[(i + 1) % length],
minDistance
);
}
}
subdividedPositions = new Float64Array(numVertices * 3);
for (i = 0; i < length; i++) {
let tempPositions;
if (arcType === ArcType_default.GEODESIC) {
tempPositions = PolygonGeometryLibrary_default.subdivideLine(
positions[i],
positions[(i + 1) % length],
minDistance,
createGeometryFromPositionsSubdivided
);
} else if (arcType === ArcType_default.RHUMB) {
tempPositions = PolygonGeometryLibrary_default.subdivideRhumbLine(
ellipsoid,
positions[i],
positions[(i + 1) % length],
minDistance,
createGeometryFromPositionsSubdivided
);
}
const tempPositionsLength = tempPositions.length;
for (let j = 0; j < tempPositionsLength; ++j) {
subdividedPositions[index++] = tempPositions[j];
}
}
} else {
subdividedPositions = new Float64Array(length * 2 * 3);
for (i = 0; i < length; i++) {
const p0 = positions[i];
const p1 = positions[(i + 1) % length];
subdividedPositions[index++] = p0.x;
subdividedPositions[index++] = p0.y;
subdividedPositions[index++] = p0.z;
subdividedPositions[index++] = p1.x;
subdividedPositions[index++] = p1.y;
subdividedPositions[index++] = p1.z;
}
}
length = subdividedPositions.length / 3;
const indicesSize = length * 2;
const indices = IndexDatatype_default.createTypedArray(length, indicesSize);
index = 0;
for (i = 0; i < length - 1; i++) {
indices[index++] = i;
indices[index++] = i + 1;
}
indices[index++] = length - 1;
indices[index++] = 0;
return new GeometryInstance_default({
geometry: new Geometry_default({
attributes: new GeometryAttributes_default({
position: new GeometryAttribute_default({
componentDatatype: ComponentDatatype_default.DOUBLE,
componentsPerAttribute: 3,
values: subdividedPositions
})
}),
indices,
primitiveType: PrimitiveType_default.LINES
})
});
}
function createGeometryFromPositionsExtruded(ellipsoid, positions, minDistance, perPositionHeight, arcType) {
const tangentPlane = EllipsoidTangentPlane_default.fromPoints(positions, ellipsoid);
const positions2D = tangentPlane.projectPointsOntoPlane(
positions,
createGeometryFromPositionsPositions
);
const originalWindingOrder = PolygonPipeline_default.computeWindingOrder2D(positions2D);
if (originalWindingOrder === WindingOrder_default.CLOCKWISE) {
positions2D.reverse();
positions = positions.slice().reverse();
}
let subdividedPositions;
let i;
let length = positions.length;
const corners = new Array(length);
let index = 0;
if (!perPositionHeight) {
let numVertices = 0;
if (arcType === ArcType_default.GEODESIC) {
for (i = 0; i < length; i++) {
numVertices += PolygonGeometryLibrary_default.subdivideLineCount(
positions[i],
positions[(i + 1) % length],
minDistance
);
}
} else if (arcType === ArcType_default.RHUMB) {
for (i = 0; i < length; i++) {
numVertices += PolygonGeometryLibrary_default.subdivideRhumbLineCount(
ellipsoid,
positions[i],
positions[(i + 1) % length],
minDistance
);
}
}
subdividedPositions = new Float64Array(numVertices * 3 * 2);
for (i = 0; i < length; ++i) {
corners[i] = index / 3;
let tempPositions;
if (arcType === ArcType_default.GEODESIC) {
tempPositions = PolygonGeometryLibrary_default.subdivideLine(
positions[i],
positions[(i + 1) % length],
minDistance,
createGeometryFromPositionsSubdivided
);
} else if (arcType === ArcType_default.RHUMB) {
tempPositions = PolygonGeometryLibrary_default.subdivideRhumbLine(
ellipsoid,
positions[i],
positions[(i + 1) % length],
minDistance,
createGeometryFromPositionsSubdivided
);
}
const tempPositionsLength = tempPositions.length;
for (let j = 0; j < tempPositionsLength; ++j) {
subdividedPositions[index++] = tempPositions[j];
}
}
} else {
subdividedPositions = new Float64Array(length * 2 * 3 * 2);
for (i = 0; i < length; ++i) {
corners[i] = index / 3;
const p0 = positions[i];
const p1 = positions[(i + 1) % length];
subdividedPositions[index++] = p0.x;
subdividedPositions[index++] = p0.y;
subdividedPositions[index++] = p0.z;
subdividedPositions[index++] = p1.x;
subdividedPositions[index++] = p1.y;
subdividedPositions[index++] = p1.z;
}
}
length = subdividedPositions.length / (3 * 2);
const cornersLength = corners.length;
const indicesSize = (length * 2 + cornersLength) * 2;
const indices = IndexDatatype_default.createTypedArray(
length + cornersLength,
indicesSize
);
index = 0;
for (i = 0; i < length; ++i) {
indices[index++] = i;
indices[index++] = (i + 1) % length;
indices[index++] = i + length;
indices[index++] = (i + 1) % length + length;
}
for (i = 0; i < cornersLength; i++) {
const corner = corners[i];
indices[index++] = corner;
indices[index++] = corner + length;
}
return new GeometryInstance_default({
geometry: new Geometry_default({
attributes: new GeometryAttributes_default({
position: new GeometryAttribute_default({
componentDatatype: ComponentDatatype_default.DOUBLE,
componentsPerAttribute: 3,
values: subdividedPositions
})
}),
indices,
primitiveType: PrimitiveType_default.LINES
})
});
}
function PolygonOutlineGeometry(options) {
Check_default.typeOf.object("options", options);
Check_default.typeOf.object("options.polygonHierarchy", options.polygonHierarchy);
if (options.perPositionHeight && defined_default(options.height)) {
throw new DeveloperError_default(
"Cannot use both options.perPositionHeight and options.height"
);
}
if (defined_default(options.arcType) && options.arcType !== ArcType_default.GEODESIC && options.arcType !== ArcType_default.RHUMB) {
throw new DeveloperError_default(
"Invalid arcType. Valid options are ArcType.GEODESIC and ArcType.RHUMB."
);
}
const polygonHierarchy = options.polygonHierarchy;
const ellipsoid = options.ellipsoid ?? Ellipsoid_default.default;
const granularity = options.granularity ?? Math_default.RADIANS_PER_DEGREE;
const perPositionHeight = options.perPositionHeight ?? false;
const perPositionHeightExtrude = perPositionHeight && defined_default(options.extrudedHeight);
const arcType = options.arcType ?? ArcType_default.GEODESIC;
let height = options.height ?? 0;
let extrudedHeight = options.extrudedHeight ?? height;
if (!perPositionHeightExtrude) {
const h = Math.max(height, extrudedHeight);
extrudedHeight = Math.min(height, extrudedHeight);
height = h;
}
this._ellipsoid = Ellipsoid_default.clone(ellipsoid);
this._granularity = granularity;
this._height = height;
this._extrudedHeight = extrudedHeight;
this._arcType = arcType;
this._polygonHierarchy = polygonHierarchy;
this._perPositionHeight = perPositionHeight;
this._perPositionHeightExtrude = perPositionHeightExtrude;
this._offsetAttribute = options.offsetAttribute;
this._workerName = "createPolygonOutlineGeometry";
this.packedLength = PolygonGeometryLibrary_default.computeHierarchyPackedLength(
polygonHierarchy,
Cartesian3_default
) + Ellipsoid_default.packedLength + 8;
}
PolygonOutlineGeometry.pack = function(value, array, startingIndex) {
Check_default.typeOf.object("value", value);
Check_default.defined("array", array);
startingIndex = startingIndex ?? 0;
startingIndex = PolygonGeometryLibrary_default.packPolygonHierarchy(
value._polygonHierarchy,
array,
startingIndex,
Cartesian3_default
);
Ellipsoid_default.pack(value._ellipsoid, array, startingIndex);
startingIndex += Ellipsoid_default.packedLength;
array[startingIndex++] = value._height;
array[startingIndex++] = value._extrudedHeight;
array[startingIndex++] = value._granularity;
array[startingIndex++] = value._perPositionHeightExtrude ? 1 : 0;
array[startingIndex++] = value._perPositionHeight ? 1 : 0;
array[startingIndex++] = value._arcType;
array[startingIndex++] = value._offsetAttribute ?? -1;
array[startingIndex] = value.packedLength;
return array;
};
var scratchEllipsoid = Ellipsoid_default.clone(Ellipsoid_default.UNIT_SPHERE);
var dummyOptions = {
polygonHierarchy: {}
};
PolygonOutlineGeometry.unpack = function(array, startingIndex, result) {
Check_default.defined("array", array);
startingIndex = startingIndex ?? 0;
const polygonHierarchy = PolygonGeometryLibrary_default.unpackPolygonHierarchy(
array,
startingIndex,
Cartesian3_default
);
startingIndex = polygonHierarchy.startingIndex;
delete polygonHierarchy.startingIndex;
const ellipsoid = Ellipsoid_default.unpack(array, startingIndex, scratchEllipsoid);
startingIndex += Ellipsoid_default.packedLength;
const height = array[startingIndex++];
const extrudedHeight = array[startingIndex++];
const granularity = array[startingIndex++];
const perPositionHeightExtrude = array[startingIndex++] === 1;
const perPositionHeight = array[startingIndex++] === 1;
const arcType = array[startingIndex++];
const offsetAttribute = array[startingIndex++];
const packedLength = array[startingIndex];
if (!defined_default(result)) {
result = new PolygonOutlineGeometry(dummyOptions);
}
result._polygonHierarchy = polygonHierarchy;
result._ellipsoid = Ellipsoid_default.clone(ellipsoid, result._ellipsoid);
result._height = height;
result._extrudedHeight = extrudedHeight;
result._granularity = granularity;
result._perPositionHeight = perPositionHeight;
result._perPositionHeightExtrude = perPositionHeightExtrude;
result._arcType = arcType;
result._offsetAttribute = offsetAttribute === -1 ? void 0 : offsetAttribute;
result.packedLength = packedLength;
return result;
};
PolygonOutlineGeometry.fromPositions = function(options) {
options = options ?? Frozen_default.EMPTY_OBJECT;
Check_default.defined("options.positions", options.positions);
const newOptions = {
polygonHierarchy: {
positions: options.positions
},
height: options.height,
extrudedHeight: options.extrudedHeight,
ellipsoid: options.ellipsoid,
granularity: options.granularity,
perPositionHeight: options.perPositionHeight,
arcType: options.arcType,
offsetAttribute: options.offsetAttribute
};
return new PolygonOutlineGeometry(newOptions);
};
PolygonOutlineGeometry.createGeometry = function(polygonGeometry) {
const ellipsoid = polygonGeometry._ellipsoid;
const granularity = polygonGeometry._granularity;
const polygonHierarchy = polygonGeometry._polygonHierarchy;
const perPositionHeight = polygonGeometry._perPositionHeight;
const arcType = polygonGeometry._arcType;
const polygons = PolygonGeometryLibrary_default.polygonOutlinesFromHierarchy(
polygonHierarchy,
!perPositionHeight,
ellipsoid
);
if (polygons.length === 0) {
return void 0;
}
let geometryInstance;
const geometries = [];
const minDistance = Math_default.chordLength(
granularity,
ellipsoid.maximumRadius
);
const height = polygonGeometry._height;
const extrudedHeight = polygonGeometry._extrudedHeight;
const extrude = polygonGeometry._perPositionHeightExtrude || !Math_default.equalsEpsilon(height, extrudedHeight, 0, Math_default.EPSILON2);
let offsetValue;
let i;
if (extrude) {
for (i = 0; i < polygons.length; i++) {
geometryInstance = createGeometryFromPositionsExtruded(
ellipsoid,
polygons[i],
minDistance,
perPositionHeight,
arcType
);
geometryInstance.geometry = PolygonGeometryLibrary_default.scaleToGeodeticHeightExtruded(
geometryInstance.geometry,
height,
extrudedHeight,
ellipsoid,
perPositionHeight
);
if (defined_default(polygonGeometry._offsetAttribute)) {
const size = geometryInstance.geometry.attributes.position.values.length / 3;
let offsetAttribute = new Uint8Array(size);
if (polygonGeometry._offsetAttribute === GeometryOffsetAttribute_default.TOP) {
offsetAttribute = offsetAttribute.fill(1, 0, size / 2);
} else {
offsetValue = polygonGeometry._offsetAttribute === GeometryOffsetAttribute_default.NONE ? 0 : 1;
offsetAttribute = offsetAttribute.fill(offsetValue);
}
geometryInstance.geometry.attributes.applyOffset = new GeometryAttribute_default({
componentDatatype: ComponentDatatype_default.UNSIGNED_BYTE,
componentsPerAttribute: 1,
values: offsetAttribute
});
}
geometries.push(geometryInstance);
}
} else {
for (i = 0; i < polygons.length; i++) {
geometryInstance = createGeometryFromPositions(
ellipsoid,
polygons[i],
minDistance,
perPositionHeight,
arcType
);
geometryInstance.geometry.attributes.position.values = PolygonPipeline_default.scaleToGeodeticHeight(
geometryInstance.geometry.attributes.position.values,
height,
ellipsoid,
!perPositionHeight
);
if (defined_default(polygonGeometry._offsetAttribute)) {
const length = geometryInstance.geometry.attributes.position.values.length;
offsetValue = polygonGeometry._offsetAttribute === GeometryOffsetAttribute_default.NONE ? 0 : 1;
const applyOffset = new Uint8Array(length / 3).fill(offsetValue);
geometryInstance.geometry.attributes.applyOffset = new GeometryAttribute_default({
componentDatatype: ComponentDatatype_default.UNSIGNED_BYTE,
componentsPerAttribute: 1,
values: applyOffset
});
}
geometries.push(geometryInstance);
}
}
const geometry = GeometryPipeline_default.combineInstances(geometries)[0];
const boundingSphere = BoundingSphere_default.fromVertices(
geometry.attributes.position.values
);
return new Geometry_default({
attributes: geometry.attributes,
indices: geometry.indices,
primitiveType: geometry.primitiveType,
boundingSphere,
offsetAttribute: polygonGeometry._offsetAttribute
});
};
var PolygonOutlineGeometry_default = PolygonOutlineGeometry;
// packages/engine/Source/Workers/createPolygonOutlineGeometry.js
function createPolygonOutlineGeometry(polygonGeometry, offset) {
if (defined_default(offset)) {
polygonGeometry = PolygonOutlineGeometry_default.unpack(polygonGeometry, offset);
}
polygonGeometry._ellipsoid = Ellipsoid_default.clone(polygonGeometry._ellipsoid);
return PolygonOutlineGeometry_default.createGeometry(polygonGeometry);
}
var createPolygonOutlineGeometry_default = createPolygonOutlineGeometry;
export {
createPolygonOutlineGeometry_default as default
};
@@ -0,0 +1,491 @@
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.142.0
*
* 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 {
Color_default
} from "./chunk-QN67VG36.js";
import {
ArcType_default
} from "./chunk-M3B5JKSM.js";
import {
PolylinePipeline_default
} from "./chunk-QRWGUWI6.js";
import "./chunk-6YEE6JDR.js";
import {
VertexFormat_default
} from "./chunk-VQYETPWC.js";
import {
arrayRemoveDuplicates_default
} from "./chunk-CFQP6LYM.js";
import "./chunk-54I6Y66F.js";
import "./chunk-3VFEWOBI.js";
import "./chunk-E7VQ76KE.js";
import {
IndexDatatype_default
} from "./chunk-S4MCOY6I.js";
import {
GeometryAttributes_default
} from "./chunk-KSSWJIZW.js";
import {
GeometryAttribute_default,
GeometryType_default,
Geometry_default,
PrimitiveType_default
} from "./chunk-EBSIOBXY.js";
import {
BoundingSphere_default
} from "./chunk-XZMBNNDX.js";
import "./chunk-C6J67V5A.js";
import "./chunk-MYP774IS.js";
import "./chunk-Q3PY526V.js";
import {
ComponentDatatype_default
} from "./chunk-P3CK7MCY.js";
import "./chunk-TKKIREQ6.js";
import "./chunk-Y5BF6AFU.js";
import {
Ellipsoid_default
} from "./chunk-V7VQKN6N.js";
import {
Cartesian3_default,
Frozen_default
} from "./chunk-MPZHGZU6.js";
import {
Math_default
} from "./chunk-J6BWOHUF.js";
import {
DeveloperError_default
} from "./chunk-AYKR4VBR.js";
import {
defined_default
} from "./chunk-ZP7JMQV4.js";
// packages/engine/Source/Core/PolylineGeometry.js
var scratchInterpolateColorsArray = [];
function interpolateColors(p0, p1, color0, color1, numPoints) {
const colors = scratchInterpolateColorsArray;
colors.length = numPoints;
let i;
const r0 = color0.red;
const g0 = color0.green;
const b0 = color0.blue;
const a0 = color0.alpha;
const r1 = color1.red;
const g1 = color1.green;
const b1 = color1.blue;
const a1 = color1.alpha;
if (Color_default.equals(color0, color1)) {
for (i = 0; i < numPoints; i++) {
colors[i] = Color_default.clone(color0);
}
return colors;
}
const redPerVertex = (r1 - r0) / numPoints;
const greenPerVertex = (g1 - g0) / numPoints;
const bluePerVertex = (b1 - b0) / numPoints;
const alphaPerVertex = (a1 - a0) / numPoints;
for (i = 0; i < numPoints; i++) {
colors[i] = new Color_default(
r0 + i * redPerVertex,
g0 + i * greenPerVertex,
b0 + i * bluePerVertex,
a0 + i * alphaPerVertex
);
}
return colors;
}
function PolylineGeometry(options) {
options = options ?? Frozen_default.EMPTY_OBJECT;
const positions = options.positions;
const colors = options.colors;
const width = options.width ?? 1;
const colorsPerVertex = options.colorsPerVertex ?? false;
if (!defined_default(positions) || positions.length < 2) {
throw new DeveloperError_default("At least two positions are required.");
}
if (typeof width !== "number") {
throw new DeveloperError_default("width must be a number");
}
if (defined_default(colors) && (colorsPerVertex && colors.length < positions.length || !colorsPerVertex && colors.length < positions.length - 1)) {
throw new DeveloperError_default("colors has an invalid length.");
}
this._positions = positions;
this._colors = colors;
this._width = width;
this._colorsPerVertex = colorsPerVertex;
this._vertexFormat = VertexFormat_default.clone(
options.vertexFormat ?? VertexFormat_default.DEFAULT
);
this._arcType = options.arcType ?? ArcType_default.GEODESIC;
this._granularity = options.granularity ?? Math_default.RADIANS_PER_DEGREE;
this._ellipsoid = Ellipsoid_default.clone(options.ellipsoid ?? Ellipsoid_default.default);
this._workerName = "createPolylineGeometry";
let numComponents = 1 + positions.length * Cartesian3_default.packedLength;
numComponents += defined_default(colors) ? 1 + colors.length * Color_default.packedLength : 1;
this.packedLength = numComponents + Ellipsoid_default.packedLength + VertexFormat_default.packedLength + 4;
}
PolylineGeometry.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 = startingIndex ?? 0;
let i;
const positions = value._positions;
let length = positions.length;
array[startingIndex++] = length;
for (i = 0; i < length; ++i, startingIndex += Cartesian3_default.packedLength) {
Cartesian3_default.pack(positions[i], array, startingIndex);
}
const colors = value._colors;
length = defined_default(colors) ? colors.length : 0;
array[startingIndex++] = length;
for (i = 0; i < length; ++i, startingIndex += Color_default.packedLength) {
Color_default.pack(colors[i], array, startingIndex);
}
Ellipsoid_default.pack(value._ellipsoid, array, startingIndex);
startingIndex += Ellipsoid_default.packedLength;
VertexFormat_default.pack(value._vertexFormat, array, startingIndex);
startingIndex += VertexFormat_default.packedLength;
array[startingIndex++] = value._width;
array[startingIndex++] = value._colorsPerVertex ? 1 : 0;
array[startingIndex++] = value._arcType;
array[startingIndex] = value._granularity;
return array;
};
var scratchEllipsoid = Ellipsoid_default.clone(Ellipsoid_default.UNIT_SPHERE);
var scratchVertexFormat = new VertexFormat_default();
var scratchOptions = {
positions: void 0,
colors: void 0,
ellipsoid: scratchEllipsoid,
vertexFormat: scratchVertexFormat,
width: void 0,
colorsPerVertex: void 0,
arcType: void 0,
granularity: void 0
};
PolylineGeometry.unpack = function(array, startingIndex, result) {
if (!defined_default(array)) {
throw new DeveloperError_default("array is required");
}
startingIndex = startingIndex ?? 0;
let i;
let length = array[startingIndex++];
const positions = new Array(length);
for (i = 0; i < length; ++i, startingIndex += Cartesian3_default.packedLength) {
positions[i] = Cartesian3_default.unpack(array, startingIndex);
}
length = array[startingIndex++];
const colors = length > 0 ? new Array(length) : void 0;
for (i = 0; i < length; ++i, startingIndex += Color_default.packedLength) {
colors[i] = Color_default.unpack(array, startingIndex);
}
const ellipsoid = Ellipsoid_default.unpack(array, startingIndex, scratchEllipsoid);
startingIndex += Ellipsoid_default.packedLength;
const vertexFormat = VertexFormat_default.unpack(
array,
startingIndex,
scratchVertexFormat
);
startingIndex += VertexFormat_default.packedLength;
const width = array[startingIndex++];
const colorsPerVertex = array[startingIndex++] === 1;
const arcType = array[startingIndex++];
const granularity = array[startingIndex];
if (!defined_default(result)) {
scratchOptions.positions = positions;
scratchOptions.colors = colors;
scratchOptions.width = width;
scratchOptions.colorsPerVertex = colorsPerVertex;
scratchOptions.arcType = arcType;
scratchOptions.granularity = granularity;
return new PolylineGeometry(scratchOptions);
}
result._positions = positions;
result._colors = colors;
result._ellipsoid = Ellipsoid_default.clone(ellipsoid, result._ellipsoid);
result._vertexFormat = VertexFormat_default.clone(vertexFormat, result._vertexFormat);
result._width = width;
result._colorsPerVertex = colorsPerVertex;
result._arcType = arcType;
result._granularity = granularity;
return result;
};
var scratchCartesian3 = new Cartesian3_default();
var scratchPosition = new Cartesian3_default();
var scratchPrevPosition = new Cartesian3_default();
var scratchNextPosition = new Cartesian3_default();
PolylineGeometry.createGeometry = function(polylineGeometry) {
const width = polylineGeometry._width;
const vertexFormat = polylineGeometry._vertexFormat;
let colors = polylineGeometry._colors;
const colorsPerVertex = polylineGeometry._colorsPerVertex;
const arcType = polylineGeometry._arcType;
const granularity = polylineGeometry._granularity;
const ellipsoid = polylineGeometry._ellipsoid;
let i;
let j;
let k;
const removedIndices = [];
let positions = arrayRemoveDuplicates_default(
polylineGeometry._positions,
Cartesian3_default.equalsEpsilon,
false,
removedIndices
);
if (defined_default(colors) && removedIndices.length > 0) {
let removedArrayIndex = 0;
let nextRemovedIndex = removedIndices[0];
colors = colors.filter(function(color, index2) {
let remove = false;
if (colorsPerVertex) {
remove = index2 === nextRemovedIndex || index2 === 0 && nextRemovedIndex === 1;
} else {
remove = index2 + 1 === nextRemovedIndex;
}
if (remove) {
removedArrayIndex++;
nextRemovedIndex = removedIndices[removedArrayIndex];
return false;
}
return true;
});
}
let positionsLength = positions.length;
if (positionsLength < 2 || width <= 0) {
return void 0;
}
if (arcType === ArcType_default.GEODESIC || arcType === ArcType_default.RHUMB) {
let subdivisionSize;
let numberOfPointsFunction;
if (arcType === ArcType_default.GEODESIC) {
subdivisionSize = Math_default.chordLength(
granularity,
ellipsoid.maximumRadius
);
numberOfPointsFunction = PolylinePipeline_default.numberOfPoints;
} else {
subdivisionSize = granularity;
numberOfPointsFunction = PolylinePipeline_default.numberOfPointsRhumbLine;
}
const heights = PolylinePipeline_default.extractHeights(positions, ellipsoid);
if (defined_default(colors)) {
let colorLength = 1;
for (i = 0; i < positionsLength - 1; ++i) {
colorLength += numberOfPointsFunction(
positions[i],
positions[i + 1],
subdivisionSize
);
}
const newColors = new Array(colorLength);
let newColorIndex = 0;
for (i = 0; i < positionsLength - 1; ++i) {
const p0 = positions[i];
const p1 = positions[i + 1];
const c0 = colors[i];
const numColors = numberOfPointsFunction(p0, p1, subdivisionSize);
if (colorsPerVertex && i < colorLength) {
const c1 = colors[i + 1];
const interpolatedColors = interpolateColors(
p0,
p1,
c0,
c1,
numColors
);
const interpolatedColorsLength = interpolatedColors.length;
for (j = 0; j < interpolatedColorsLength; ++j) {
newColors[newColorIndex++] = interpolatedColors[j];
}
} else {
for (j = 0; j < numColors; ++j) {
newColors[newColorIndex++] = Color_default.clone(c0);
}
}
}
newColors[newColorIndex] = Color_default.clone(colors[colors.length - 1]);
colors = newColors;
scratchInterpolateColorsArray.length = 0;
}
if (arcType === ArcType_default.GEODESIC) {
positions = PolylinePipeline_default.generateCartesianArc({
positions,
minDistance: subdivisionSize,
ellipsoid,
height: heights
});
} else {
positions = PolylinePipeline_default.generateCartesianRhumbArc({
positions,
granularity: subdivisionSize,
ellipsoid,
height: heights
});
}
}
positionsLength = positions.length;
const size = positionsLength * 4 - 4;
const finalPositions = new Float64Array(size * 3);
const prevPositions = new Float64Array(size * 3);
const nextPositions = new Float64Array(size * 3);
const expandAndWidth = new Float32Array(size * 2);
const st = vertexFormat.st ? new Float32Array(size * 2) : void 0;
const finalColors = defined_default(colors) ? new Uint8Array(size * 4) : void 0;
let positionIndex = 0;
let expandAndWidthIndex = 0;
let stIndex = 0;
let colorIndex = 0;
let position;
for (j = 0; j < positionsLength; ++j) {
if (j === 0) {
position = scratchCartesian3;
Cartesian3_default.subtract(positions[0], positions[1], position);
Cartesian3_default.add(positions[0], position, position);
} else {
position = positions[j - 1];
}
Cartesian3_default.clone(position, scratchPrevPosition);
Cartesian3_default.clone(positions[j], scratchPosition);
if (j === positionsLength - 1) {
position = scratchCartesian3;
Cartesian3_default.subtract(
positions[positionsLength - 1],
positions[positionsLength - 2],
position
);
Cartesian3_default.add(positions[positionsLength - 1], position, position);
} else {
position = positions[j + 1];
}
Cartesian3_default.clone(position, scratchNextPosition);
let color0, color1;
if (defined_default(finalColors)) {
if (j !== 0 && !colorsPerVertex) {
color0 = colors[j - 1];
} else {
color0 = colors[j];
}
if (j !== positionsLength - 1) {
color1 = colors[j];
}
}
const startK = j === 0 ? 2 : 0;
const endK = j === positionsLength - 1 ? 2 : 4;
for (k = startK; k < endK; ++k) {
Cartesian3_default.pack(scratchPosition, finalPositions, positionIndex);
Cartesian3_default.pack(scratchPrevPosition, prevPositions, positionIndex);
Cartesian3_default.pack(scratchNextPosition, nextPositions, positionIndex);
positionIndex += 3;
const direction = k - 2 < 0 ? -1 : 1;
expandAndWidth[expandAndWidthIndex++] = 2 * (k % 2) - 1;
expandAndWidth[expandAndWidthIndex++] = direction * width;
if (vertexFormat.st) {
st[stIndex++] = j / (positionsLength - 1);
st[stIndex++] = Math.max(expandAndWidth[expandAndWidthIndex - 2], 0);
}
if (defined_default(finalColors)) {
const color = k < 2 ? color0 : color1;
finalColors[colorIndex++] = Color_default.floatToByte(color.red);
finalColors[colorIndex++] = Color_default.floatToByte(color.green);
finalColors[colorIndex++] = Color_default.floatToByte(color.blue);
finalColors[colorIndex++] = Color_default.floatToByte(color.alpha);
}
}
}
const attributes = new GeometryAttributes_default();
attributes.position = new GeometryAttribute_default({
componentDatatype: ComponentDatatype_default.DOUBLE,
componentsPerAttribute: 3,
values: finalPositions
});
attributes.prevPosition = new GeometryAttribute_default({
componentDatatype: ComponentDatatype_default.DOUBLE,
componentsPerAttribute: 3,
values: prevPositions
});
attributes.nextPosition = new GeometryAttribute_default({
componentDatatype: ComponentDatatype_default.DOUBLE,
componentsPerAttribute: 3,
values: nextPositions
});
attributes.expandAndWidth = new GeometryAttribute_default({
componentDatatype: ComponentDatatype_default.FLOAT,
componentsPerAttribute: 2,
values: expandAndWidth
});
if (vertexFormat.st) {
attributes.st = new GeometryAttribute_default({
componentDatatype: ComponentDatatype_default.FLOAT,
componentsPerAttribute: 2,
values: st
});
}
if (defined_default(finalColors)) {
attributes.color = new GeometryAttribute_default({
componentDatatype: ComponentDatatype_default.UNSIGNED_BYTE,
componentsPerAttribute: 4,
values: finalColors,
normalize: true
});
}
const indices = IndexDatatype_default.createTypedArray(size, positionsLength * 6 - 6);
let index = 0;
let indicesIndex = 0;
const length = positionsLength - 1;
for (j = 0; j < length; ++j) {
indices[indicesIndex++] = index;
indices[indicesIndex++] = index + 2;
indices[indicesIndex++] = index + 1;
indices[indicesIndex++] = index + 1;
indices[indicesIndex++] = index + 2;
indices[indicesIndex++] = index + 3;
index += 4;
}
return new Geometry_default({
attributes,
indices,
primitiveType: PrimitiveType_default.TRIANGLES,
boundingSphere: BoundingSphere_default.fromPoints(positions),
geometryType: GeometryType_default.POLYLINES
});
};
var PolylineGeometry_default = PolylineGeometry;
// packages/engine/Source/Workers/createPolylineGeometry.js
function createPolylineGeometry(polylineGeometry, offset) {
if (defined_default(offset)) {
polylineGeometry = PolylineGeometry_default.unpack(polylineGeometry, offset);
}
polylineGeometry._ellipsoid = Ellipsoid_default.clone(polylineGeometry._ellipsoid);
return PolylineGeometry_default.createGeometry(polylineGeometry);
}
var createPolylineGeometry_default = createPolylineGeometry;
export {
createPolylineGeometry_default as default
};
@@ -0,0 +1,374 @@
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.142.0
*
* 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 {
BoundingRectangle_default
} from "./chunk-KFSTQKNM.js";
import {
GeometryPipeline_default
} from "./chunk-ACXQXN46.js";
import "./chunk-7J2HKPRH.js";
import "./chunk-Y57HREW5.js";
import {
CornerType_default,
PolylineVolumeGeometryLibrary_default,
oneTimeWarning_default
} from "./chunk-UA25D5MX.js";
import "./chunk-QRWGUWI6.js";
import "./chunk-6YEE6JDR.js";
import {
VertexFormat_default
} from "./chunk-VQYETPWC.js";
import "./chunk-SMQZZOW6.js";
import "./chunk-DDWSZVMY.js";
import {
PolygonPipeline_default,
WindingOrder_default
} from "./chunk-O3EA5HS7.js";
import {
arrayRemoveDuplicates_default
} from "./chunk-CFQP6LYM.js";
import "./chunk-54I6Y66F.js";
import "./chunk-3VFEWOBI.js";
import "./chunk-E7VQ76KE.js";
import {
IndexDatatype_default
} from "./chunk-S4MCOY6I.js";
import {
GeometryAttributes_default
} from "./chunk-KSSWJIZW.js";
import {
GeometryAttribute_default,
Geometry_default,
PrimitiveType_default
} from "./chunk-EBSIOBXY.js";
import {
BoundingSphere_default
} from "./chunk-XZMBNNDX.js";
import "./chunk-C6J67V5A.js";
import "./chunk-MYP774IS.js";
import "./chunk-Q3PY526V.js";
import {
ComponentDatatype_default
} from "./chunk-P3CK7MCY.js";
import "./chunk-TKKIREQ6.js";
import "./chunk-Y5BF6AFU.js";
import {
Cartesian2_default,
Ellipsoid_default
} from "./chunk-V7VQKN6N.js";
import {
Cartesian3_default,
Frozen_default
} from "./chunk-MPZHGZU6.js";
import {
Math_default
} from "./chunk-J6BWOHUF.js";
import {
DeveloperError_default
} from "./chunk-AYKR4VBR.js";
import {
defined_default
} from "./chunk-ZP7JMQV4.js";
// packages/engine/Source/Core/PolylineVolumeGeometry.js
function computeAttributes(combinedPositions, shape, boundingRectangle, vertexFormat) {
const attributes = new GeometryAttributes_default();
if (vertexFormat.position) {
attributes.position = new GeometryAttribute_default({
componentDatatype: ComponentDatatype_default.DOUBLE,
componentsPerAttribute: 3,
values: combinedPositions
});
}
const shapeLength = shape.length;
const vertexCount = combinedPositions.length / 3;
const length = (vertexCount - shapeLength * 2) / (shapeLength * 2);
const firstEndIndices = PolygonPipeline_default.triangulate(shape);
const indicesCount = (length - 1) * shapeLength * 6 + firstEndIndices.length * 2;
const indices = IndexDatatype_default.createTypedArray(vertexCount, indicesCount);
let i, j;
let ll, ul, ur, lr;
const offset = shapeLength * 2;
let index = 0;
for (i = 0; i < length - 1; i++) {
for (j = 0; j < shapeLength - 1; j++) {
ll = j * 2 + i * shapeLength * 2;
lr = ll + offset;
ul = ll + 1;
ur = ul + offset;
indices[index++] = ul;
indices[index++] = ll;
indices[index++] = ur;
indices[index++] = ur;
indices[index++] = ll;
indices[index++] = lr;
}
ll = shapeLength * 2 - 2 + i * shapeLength * 2;
ul = ll + 1;
ur = ul + offset;
lr = ll + offset;
indices[index++] = ul;
indices[index++] = ll;
indices[index++] = ur;
indices[index++] = ur;
indices[index++] = ll;
indices[index++] = lr;
}
if (vertexFormat.st || vertexFormat.tangent || vertexFormat.bitangent) {
const st = new Float32Array(vertexCount * 2);
const lengthSt = 1 / (length - 1);
const heightSt = 1 / boundingRectangle.height;
const heightOffset = boundingRectangle.height / 2;
let s, t;
let stindex = 0;
for (i = 0; i < length; i++) {
s = i * lengthSt;
t = heightSt * (shape[0].y + heightOffset);
st[stindex++] = s;
st[stindex++] = t;
for (j = 1; j < shapeLength; j++) {
t = heightSt * (shape[j].y + heightOffset);
st[stindex++] = s;
st[stindex++] = t;
st[stindex++] = s;
st[stindex++] = t;
}
t = heightSt * (shape[0].y + heightOffset);
st[stindex++] = s;
st[stindex++] = t;
}
for (j = 0; j < shapeLength; j++) {
s = 0;
t = heightSt * (shape[j].y + heightOffset);
st[stindex++] = s;
st[stindex++] = t;
}
for (j = 0; j < shapeLength; j++) {
s = (length - 1) * lengthSt;
t = heightSt * (shape[j].y + heightOffset);
st[stindex++] = s;
st[stindex++] = t;
}
attributes.st = new GeometryAttribute_default({
componentDatatype: ComponentDatatype_default.FLOAT,
componentsPerAttribute: 2,
values: new Float32Array(st)
});
}
const endOffset = vertexCount - shapeLength * 2;
for (i = 0; i < firstEndIndices.length; i += 3) {
const v0 = firstEndIndices[i] + endOffset;
const v1 = firstEndIndices[i + 1] + endOffset;
const v2 = firstEndIndices[i + 2] + endOffset;
indices[index++] = v0;
indices[index++] = v1;
indices[index++] = v2;
indices[index++] = v2 + shapeLength;
indices[index++] = v1 + shapeLength;
indices[index++] = v0 + shapeLength;
}
let geometry = new Geometry_default({
attributes,
indices,
boundingSphere: BoundingSphere_default.fromVertices(combinedPositions),
primitiveType: PrimitiveType_default.TRIANGLES
});
if (vertexFormat.normal) {
geometry = GeometryPipeline_default.computeNormal(geometry);
}
if (vertexFormat.tangent || vertexFormat.bitangent) {
try {
geometry = GeometryPipeline_default.computeTangentAndBitangent(geometry);
} catch (e) {
oneTimeWarning_default(
"polyline-volume-tangent-bitangent",
"Unable to compute tangents and bitangents for polyline volume geometry"
);
}
if (!vertexFormat.tangent) {
geometry.attributes.tangent = void 0;
}
if (!vertexFormat.bitangent) {
geometry.attributes.bitangent = void 0;
}
if (!vertexFormat.st) {
geometry.attributes.st = void 0;
}
}
return geometry;
}
function PolylineVolumeGeometry(options) {
options = options ?? Frozen_default.EMPTY_OBJECT;
const positions = options.polylinePositions;
const shape = options.shapePositions;
if (!defined_default(positions)) {
throw new DeveloperError_default("options.polylinePositions is required.");
}
if (!defined_default(shape)) {
throw new DeveloperError_default("options.shapePositions is required.");
}
this._positions = positions;
this._shape = shape;
this._ellipsoid = Ellipsoid_default.clone(options.ellipsoid ?? Ellipsoid_default.default);
this._cornerType = options.cornerType ?? CornerType_default.ROUNDED;
this._vertexFormat = VertexFormat_default.clone(
options.vertexFormat ?? VertexFormat_default.DEFAULT
);
this._granularity = options.granularity ?? Math_default.RADIANS_PER_DEGREE;
this._workerName = "createPolylineVolumeGeometry";
let numComponents = 1 + positions.length * Cartesian3_default.packedLength;
numComponents += 1 + shape.length * Cartesian2_default.packedLength;
this.packedLength = numComponents + Ellipsoid_default.packedLength + VertexFormat_default.packedLength + 2;
}
PolylineVolumeGeometry.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 = startingIndex ?? 0;
let i;
const positions = value._positions;
let length = positions.length;
array[startingIndex++] = length;
for (i = 0; i < length; ++i, startingIndex += Cartesian3_default.packedLength) {
Cartesian3_default.pack(positions[i], array, startingIndex);
}
const shape = value._shape;
length = shape.length;
array[startingIndex++] = length;
for (i = 0; i < length; ++i, startingIndex += Cartesian2_default.packedLength) {
Cartesian2_default.pack(shape[i], array, startingIndex);
}
Ellipsoid_default.pack(value._ellipsoid, array, startingIndex);
startingIndex += Ellipsoid_default.packedLength;
VertexFormat_default.pack(value._vertexFormat, array, startingIndex);
startingIndex += VertexFormat_default.packedLength;
array[startingIndex++] = value._cornerType;
array[startingIndex] = value._granularity;
return array;
};
var scratchEllipsoid = Ellipsoid_default.clone(Ellipsoid_default.UNIT_SPHERE);
var scratchVertexFormat = new VertexFormat_default();
var scratchOptions = {
polylinePositions: void 0,
shapePositions: void 0,
ellipsoid: scratchEllipsoid,
vertexFormat: scratchVertexFormat,
cornerType: void 0,
granularity: void 0
};
PolylineVolumeGeometry.unpack = function(array, startingIndex, result) {
if (!defined_default(array)) {
throw new DeveloperError_default("array is required");
}
startingIndex = startingIndex ?? 0;
let i;
let length = array[startingIndex++];
const positions = new Array(length);
for (i = 0; i < length; ++i, startingIndex += Cartesian3_default.packedLength) {
positions[i] = Cartesian3_default.unpack(array, startingIndex);
}
length = array[startingIndex++];
const shape = new Array(length);
for (i = 0; i < length; ++i, startingIndex += Cartesian2_default.packedLength) {
shape[i] = Cartesian2_default.unpack(array, startingIndex);
}
const ellipsoid = Ellipsoid_default.unpack(array, startingIndex, scratchEllipsoid);
startingIndex += Ellipsoid_default.packedLength;
const vertexFormat = VertexFormat_default.unpack(
array,
startingIndex,
scratchVertexFormat
);
startingIndex += VertexFormat_default.packedLength;
const cornerType = array[startingIndex++];
const granularity = array[startingIndex];
if (!defined_default(result)) {
scratchOptions.polylinePositions = positions;
scratchOptions.shapePositions = shape;
scratchOptions.cornerType = cornerType;
scratchOptions.granularity = granularity;
return new PolylineVolumeGeometry(scratchOptions);
}
result._positions = positions;
result._shape = shape;
result._ellipsoid = Ellipsoid_default.clone(ellipsoid, result._ellipsoid);
result._vertexFormat = VertexFormat_default.clone(vertexFormat, result._vertexFormat);
result._cornerType = cornerType;
result._granularity = granularity;
return result;
};
var brScratch = new BoundingRectangle_default();
PolylineVolumeGeometry.createGeometry = function(polylineVolumeGeometry) {
const positions = polylineVolumeGeometry._positions;
const cleanPositions = arrayRemoveDuplicates_default(
positions,
Cartesian3_default.equalsEpsilon
);
let shape2D = polylineVolumeGeometry._shape;
shape2D = PolylineVolumeGeometryLibrary_default.removeDuplicatesFromShape(shape2D);
if (cleanPositions.length < 2 || shape2D.length < 3) {
return void 0;
}
if (PolygonPipeline_default.computeWindingOrder2D(shape2D) === WindingOrder_default.CLOCKWISE) {
shape2D.reverse();
}
const boundingRectangle = BoundingRectangle_default.fromPoints(shape2D, brScratch);
const computedPositions = PolylineVolumeGeometryLibrary_default.computePositions(
cleanPositions,
shape2D,
boundingRectangle,
polylineVolumeGeometry,
true
);
return computeAttributes(
computedPositions,
shape2D,
boundingRectangle,
polylineVolumeGeometry._vertexFormat
);
};
var PolylineVolumeGeometry_default = PolylineVolumeGeometry;
// packages/engine/Source/Workers/createPolylineVolumeGeometry.js
function createPolylineVolumeGeometry(polylineVolumeGeometry, offset) {
if (defined_default(offset)) {
polylineVolumeGeometry = PolylineVolumeGeometry_default.unpack(
polylineVolumeGeometry,
offset
);
}
polylineVolumeGeometry._ellipsoid = Ellipsoid_default.clone(
polylineVolumeGeometry._ellipsoid
);
return PolylineVolumeGeometry_default.createGeometry(polylineVolumeGeometry);
}
var createPolylineVolumeGeometry_default = createPolylineVolumeGeometry;
export {
createPolylineVolumeGeometry_default as default
};
@@ -0,0 +1,272 @@
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.142.0
*
* 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 {
BoundingRectangle_default
} from "./chunk-KFSTQKNM.js";
import {
CornerType_default,
PolylineVolumeGeometryLibrary_default
} from "./chunk-UA25D5MX.js";
import "./chunk-QRWGUWI6.js";
import "./chunk-6YEE6JDR.js";
import "./chunk-SMQZZOW6.js";
import "./chunk-DDWSZVMY.js";
import {
PolygonPipeline_default,
WindingOrder_default
} from "./chunk-O3EA5HS7.js";
import {
arrayRemoveDuplicates_default
} from "./chunk-CFQP6LYM.js";
import "./chunk-54I6Y66F.js";
import "./chunk-3VFEWOBI.js";
import "./chunk-E7VQ76KE.js";
import {
IndexDatatype_default
} from "./chunk-S4MCOY6I.js";
import {
GeometryAttributes_default
} from "./chunk-KSSWJIZW.js";
import {
GeometryAttribute_default,
Geometry_default,
PrimitiveType_default
} from "./chunk-EBSIOBXY.js";
import {
BoundingSphere_default
} from "./chunk-XZMBNNDX.js";
import "./chunk-C6J67V5A.js";
import "./chunk-MYP774IS.js";
import "./chunk-Q3PY526V.js";
import {
ComponentDatatype_default
} from "./chunk-P3CK7MCY.js";
import "./chunk-TKKIREQ6.js";
import "./chunk-Y5BF6AFU.js";
import {
Cartesian2_default,
Ellipsoid_default
} from "./chunk-V7VQKN6N.js";
import {
Cartesian3_default,
Frozen_default
} from "./chunk-MPZHGZU6.js";
import {
Math_default
} from "./chunk-J6BWOHUF.js";
import {
DeveloperError_default
} from "./chunk-AYKR4VBR.js";
import {
defined_default
} from "./chunk-ZP7JMQV4.js";
// packages/engine/Source/Core/PolylineVolumeOutlineGeometry.js
function computeAttributes(positions, shape) {
const attributes = new GeometryAttributes_default();
attributes.position = new GeometryAttribute_default({
componentDatatype: ComponentDatatype_default.DOUBLE,
componentsPerAttribute: 3,
values: positions
});
const shapeLength = shape.length;
const vertexCount = attributes.position.values.length / 3;
const positionLength = positions.length / 3;
const shapeCount = positionLength / shapeLength;
const indices = IndexDatatype_default.createTypedArray(
vertexCount,
2 * shapeLength * (shapeCount + 1)
);
let i, j;
let index = 0;
i = 0;
let offset = i * shapeLength;
for (j = 0; j < shapeLength - 1; j++) {
indices[index++] = j + offset;
indices[index++] = j + offset + 1;
}
indices[index++] = shapeLength - 1 + offset;
indices[index++] = offset;
i = shapeCount - 1;
offset = i * shapeLength;
for (j = 0; j < shapeLength - 1; j++) {
indices[index++] = j + offset;
indices[index++] = j + offset + 1;
}
indices[index++] = shapeLength - 1 + offset;
indices[index++] = offset;
for (i = 0; i < shapeCount - 1; i++) {
const firstOffset = shapeLength * i;
const secondOffset = firstOffset + shapeLength;
for (j = 0; j < shapeLength; j++) {
indices[index++] = j + firstOffset;
indices[index++] = j + secondOffset;
}
}
const geometry = new Geometry_default({
attributes,
indices: IndexDatatype_default.createTypedArray(vertexCount, indices),
boundingSphere: BoundingSphere_default.fromVertices(positions),
primitiveType: PrimitiveType_default.LINES
});
return geometry;
}
function PolylineVolumeOutlineGeometry(options) {
options = options ?? Frozen_default.EMPTY_OBJECT;
const positions = options.polylinePositions;
const shape = options.shapePositions;
if (!defined_default(positions)) {
throw new DeveloperError_default("options.polylinePositions is required.");
}
if (!defined_default(shape)) {
throw new DeveloperError_default("options.shapePositions is required.");
}
this._positions = positions;
this._shape = shape;
this._ellipsoid = Ellipsoid_default.clone(options.ellipsoid ?? Ellipsoid_default.default);
this._cornerType = options.cornerType ?? CornerType_default.ROUNDED;
this._granularity = options.granularity ?? Math_default.RADIANS_PER_DEGREE;
this._workerName = "createPolylineVolumeOutlineGeometry";
let numComponents = 1 + positions.length * Cartesian3_default.packedLength;
numComponents += 1 + shape.length * Cartesian2_default.packedLength;
this.packedLength = numComponents + Ellipsoid_default.packedLength + 2;
}
PolylineVolumeOutlineGeometry.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 = startingIndex ?? 0;
let i;
const positions = value._positions;
let length = positions.length;
array[startingIndex++] = length;
for (i = 0; i < length; ++i, startingIndex += Cartesian3_default.packedLength) {
Cartesian3_default.pack(positions[i], array, startingIndex);
}
const shape = value._shape;
length = shape.length;
array[startingIndex++] = length;
for (i = 0; i < length; ++i, startingIndex += Cartesian2_default.packedLength) {
Cartesian2_default.pack(shape[i], array, startingIndex);
}
Ellipsoid_default.pack(value._ellipsoid, array, startingIndex);
startingIndex += Ellipsoid_default.packedLength;
array[startingIndex++] = value._cornerType;
array[startingIndex] = value._granularity;
return array;
};
var scratchEllipsoid = Ellipsoid_default.clone(Ellipsoid_default.UNIT_SPHERE);
var scratchOptions = {
polylinePositions: void 0,
shapePositions: void 0,
ellipsoid: scratchEllipsoid,
height: void 0,
cornerType: void 0,
granularity: void 0
};
PolylineVolumeOutlineGeometry.unpack = function(array, startingIndex, result) {
if (!defined_default(array)) {
throw new DeveloperError_default("array is required");
}
startingIndex = startingIndex ?? 0;
let i;
let length = array[startingIndex++];
const positions = new Array(length);
for (i = 0; i < length; ++i, startingIndex += Cartesian3_default.packedLength) {
positions[i] = Cartesian3_default.unpack(array, startingIndex);
}
length = array[startingIndex++];
const shape = new Array(length);
for (i = 0; i < length; ++i, startingIndex += Cartesian2_default.packedLength) {
shape[i] = Cartesian2_default.unpack(array, startingIndex);
}
const ellipsoid = Ellipsoid_default.unpack(array, startingIndex, scratchEllipsoid);
startingIndex += Ellipsoid_default.packedLength;
const cornerType = array[startingIndex++];
const granularity = array[startingIndex];
if (!defined_default(result)) {
scratchOptions.polylinePositions = positions;
scratchOptions.shapePositions = shape;
scratchOptions.cornerType = cornerType;
scratchOptions.granularity = granularity;
return new PolylineVolumeOutlineGeometry(scratchOptions);
}
result._positions = positions;
result._shape = shape;
result._ellipsoid = Ellipsoid_default.clone(ellipsoid, result._ellipsoid);
result._cornerType = cornerType;
result._granularity = granularity;
return result;
};
var brScratch = new BoundingRectangle_default();
PolylineVolumeOutlineGeometry.createGeometry = function(polylineVolumeOutlineGeometry) {
const positions = polylineVolumeOutlineGeometry._positions;
const cleanPositions = arrayRemoveDuplicates_default(
positions,
Cartesian3_default.equalsEpsilon
);
let shape2D = polylineVolumeOutlineGeometry._shape;
shape2D = PolylineVolumeGeometryLibrary_default.removeDuplicatesFromShape(shape2D);
if (cleanPositions.length < 2 || shape2D.length < 3) {
return void 0;
}
if (PolygonPipeline_default.computeWindingOrder2D(shape2D) === WindingOrder_default.CLOCKWISE) {
shape2D.reverse();
}
const boundingRectangle = BoundingRectangle_default.fromPoints(shape2D, brScratch);
const computedPositions = PolylineVolumeGeometryLibrary_default.computePositions(
cleanPositions,
shape2D,
boundingRectangle,
polylineVolumeOutlineGeometry,
false
);
return computeAttributes(computedPositions, shape2D);
};
var PolylineVolumeOutlineGeometry_default = PolylineVolumeOutlineGeometry;
// packages/engine/Source/Workers/createPolylineVolumeOutlineGeometry.js
function createPolylineVolumeOutlineGeometry(polylineVolumeOutlineGeometry, offset) {
if (defined_default(offset)) {
polylineVolumeOutlineGeometry = PolylineVolumeOutlineGeometry_default.unpack(
polylineVolumeOutlineGeometry,
offset
);
}
polylineVolumeOutlineGeometry._ellipsoid = Ellipsoid_default.clone(
polylineVolumeOutlineGeometry._ellipsoid
);
return PolylineVolumeOutlineGeometry_default.createGeometry(
polylineVolumeOutlineGeometry
);
}
var createPolylineVolumeOutlineGeometry_default = createPolylineVolumeOutlineGeometry;
export {
createPolylineVolumeOutlineGeometry_default as default
};
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,476 @@
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.142.0
*
* 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 {
RectangleGeometryLibrary_default
} from "./chunk-INUEEEQA.js";
import {
GeometryOffsetAttribute_default
} from "./chunk-IYOUHCZB.js";
import {
PolygonPipeline_default
} from "./chunk-O3EA5HS7.js";
import "./chunk-54I6Y66F.js";
import {
IndexDatatype_default
} from "./chunk-S4MCOY6I.js";
import {
GeometryAttributes_default
} from "./chunk-KSSWJIZW.js";
import {
GeometryAttribute_default,
Geometry_default,
PrimitiveType_default
} from "./chunk-EBSIOBXY.js";
import {
BoundingSphere_default
} from "./chunk-XZMBNNDX.js";
import "./chunk-C6J67V5A.js";
import {
Rectangle_default
} from "./chunk-MYP774IS.js";
import "./chunk-Q3PY526V.js";
import {
ComponentDatatype_default
} from "./chunk-P3CK7MCY.js";
import "./chunk-TKKIREQ6.js";
import "./chunk-Y5BF6AFU.js";
import {
Cartographic_default,
Ellipsoid_default
} from "./chunk-V7VQKN6N.js";
import {
Cartesian3_default,
Frozen_default
} from "./chunk-MPZHGZU6.js";
import {
Math_default
} from "./chunk-J6BWOHUF.js";
import {
DeveloperError_default
} from "./chunk-AYKR4VBR.js";
import {
defined_default
} from "./chunk-ZP7JMQV4.js";
// packages/engine/Source/Core/RectangleOutlineGeometry.js
var bottomBoundingSphere = new BoundingSphere_default();
var topBoundingSphere = new BoundingSphere_default();
var positionScratch = new Cartesian3_default();
var rectangleScratch = new Rectangle_default();
function constructRectangle(geometry, computedOptions) {
const ellipsoid = geometry._ellipsoid;
const height = computedOptions.height;
const width = computedOptions.width;
const northCap = computedOptions.northCap;
const southCap = computedOptions.southCap;
let rowHeight = height;
let widthMultiplier = 2;
let size = 0;
let corners = 4;
if (northCap) {
widthMultiplier -= 1;
rowHeight -= 1;
size += 1;
corners -= 2;
}
if (southCap) {
widthMultiplier -= 1;
rowHeight -= 1;
size += 1;
corners -= 2;
}
size += widthMultiplier * width + 2 * rowHeight - corners;
const positions = new Float64Array(size * 3);
let posIndex = 0;
let row = 0;
let col;
const position = positionScratch;
if (northCap) {
RectangleGeometryLibrary_default.computePosition(
computedOptions,
ellipsoid,
false,
row,
0,
position
);
positions[posIndex++] = position.x;
positions[posIndex++] = position.y;
positions[posIndex++] = position.z;
} else {
for (col = 0; col < width; col++) {
RectangleGeometryLibrary_default.computePosition(
computedOptions,
ellipsoid,
false,
row,
col,
position
);
positions[posIndex++] = position.x;
positions[posIndex++] = position.y;
positions[posIndex++] = position.z;
}
}
col = width - 1;
for (row = 1; row < height; row++) {
RectangleGeometryLibrary_default.computePosition(
computedOptions,
ellipsoid,
false,
row,
col,
position
);
positions[posIndex++] = position.x;
positions[posIndex++] = position.y;
positions[posIndex++] = position.z;
}
row = height - 1;
if (!southCap) {
for (col = width - 2; col >= 0; col--) {
RectangleGeometryLibrary_default.computePosition(
computedOptions,
ellipsoid,
false,
row,
col,
position
);
positions[posIndex++] = position.x;
positions[posIndex++] = position.y;
positions[posIndex++] = position.z;
}
}
col = 0;
for (row = height - 2; row > 0; row--) {
RectangleGeometryLibrary_default.computePosition(
computedOptions,
ellipsoid,
false,
row,
col,
position
);
positions[posIndex++] = position.x;
positions[posIndex++] = position.y;
positions[posIndex++] = position.z;
}
const indicesSize = positions.length / 3 * 2;
const indices = IndexDatatype_default.createTypedArray(
positions.length / 3,
indicesSize
);
let index = 0;
for (let i = 0; i < positions.length / 3 - 1; i++) {
indices[index++] = i;
indices[index++] = i + 1;
}
indices[index++] = positions.length / 3 - 1;
indices[index++] = 0;
const geo = new Geometry_default({
attributes: new GeometryAttributes_default(),
primitiveType: PrimitiveType_default.LINES
});
geo.attributes.position = new GeometryAttribute_default({
componentDatatype: ComponentDatatype_default.DOUBLE,
componentsPerAttribute: 3,
values: positions
});
geo.indices = indices;
return geo;
}
function constructExtrudedRectangle(rectangleGeometry, computedOptions) {
const maxHeight = rectangleGeometry._surfaceHeight;
const minHeight = rectangleGeometry._extrudedHeight;
const ellipsoid = rectangleGeometry._ellipsoid;
const geo = constructRectangle(rectangleGeometry, computedOptions);
const height = computedOptions.height;
const width = computedOptions.width;
const topPositions = PolygonPipeline_default.scaleToGeodeticHeight(
geo.attributes.position.values,
maxHeight,
ellipsoid,
false
);
let length = topPositions.length;
const positions = new Float64Array(length * 2);
positions.set(topPositions);
const bottomPositions = PolygonPipeline_default.scaleToGeodeticHeight(
geo.attributes.position.values,
minHeight,
ellipsoid
);
positions.set(bottomPositions, length);
geo.attributes.position.values = positions;
const northCap = computedOptions.northCap;
const southCap = computedOptions.southCap;
let corners = 4;
if (northCap) {
corners -= 1;
}
if (southCap) {
corners -= 1;
}
const indicesSize = (positions.length / 3 + corners) * 2;
const indices = IndexDatatype_default.createTypedArray(
positions.length / 3,
indicesSize
);
length = positions.length / 6;
let index = 0;
for (let i = 0; i < length - 1; i++) {
indices[index++] = i;
indices[index++] = i + 1;
indices[index++] = i + length;
indices[index++] = i + length + 1;
}
indices[index++] = length - 1;
indices[index++] = 0;
indices[index++] = length + length - 1;
indices[index++] = length;
indices[index++] = 0;
indices[index++] = length;
let bottomCorner;
if (northCap) {
bottomCorner = height - 1;
} else {
const topRightCorner = width - 1;
indices[index++] = topRightCorner;
indices[index++] = topRightCorner + length;
bottomCorner = width + height - 2;
}
indices[index++] = bottomCorner;
indices[index++] = bottomCorner + length;
if (!southCap) {
const bottomLeftCorner = width + bottomCorner - 1;
indices[index++] = bottomLeftCorner;
indices[index] = bottomLeftCorner + length;
}
geo.indices = indices;
return geo;
}
function RectangleOutlineGeometry(options) {
options = options ?? Frozen_default.EMPTY_OBJECT;
const rectangle = options.rectangle;
const granularity = options.granularity ?? Math_default.RADIANS_PER_DEGREE;
const ellipsoid = options.ellipsoid ?? Ellipsoid_default.default;
const rotation = options.rotation ?? 0;
if (!defined_default(rectangle)) {
throw new DeveloperError_default("rectangle is required.");
}
Rectangle_default._validate(rectangle);
if (rectangle.north < rectangle.south) {
throw new DeveloperError_default(
"options.rectangle.north must be greater than options.rectangle.south"
);
}
const height = options.height ?? 0;
const extrudedHeight = options.extrudedHeight ?? height;
this._rectangle = Rectangle_default.clone(rectangle);
this._granularity = granularity;
this._ellipsoid = ellipsoid;
this._surfaceHeight = Math.max(height, extrudedHeight);
this._rotation = rotation;
this._extrudedHeight = Math.min(height, extrudedHeight);
this._offsetAttribute = options.offsetAttribute;
this._workerName = "createRectangleOutlineGeometry";
}
RectangleOutlineGeometry.packedLength = Rectangle_default.packedLength + Ellipsoid_default.packedLength + 5;
RectangleOutlineGeometry.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 = startingIndex ?? 0;
Rectangle_default.pack(value._rectangle, array, startingIndex);
startingIndex += Rectangle_default.packedLength;
Ellipsoid_default.pack(value._ellipsoid, array, startingIndex);
startingIndex += Ellipsoid_default.packedLength;
array[startingIndex++] = value._granularity;
array[startingIndex++] = value._surfaceHeight;
array[startingIndex++] = value._rotation;
array[startingIndex++] = value._extrudedHeight;
array[startingIndex] = value._offsetAttribute ?? -1;
return array;
};
var scratchRectangle = new Rectangle_default();
var scratchEllipsoid = Ellipsoid_default.clone(Ellipsoid_default.UNIT_SPHERE);
var scratchOptions = {
rectangle: scratchRectangle,
ellipsoid: scratchEllipsoid,
granularity: void 0,
height: void 0,
rotation: void 0,
extrudedHeight: void 0,
offsetAttribute: void 0
};
RectangleOutlineGeometry.unpack = function(array, startingIndex, result) {
if (!defined_default(array)) {
throw new DeveloperError_default("array is required");
}
startingIndex = startingIndex ?? 0;
const rectangle = Rectangle_default.unpack(array, startingIndex, scratchRectangle);
startingIndex += Rectangle_default.packedLength;
const ellipsoid = Ellipsoid_default.unpack(array, startingIndex, scratchEllipsoid);
startingIndex += Ellipsoid_default.packedLength;
const granularity = array[startingIndex++];
const height = array[startingIndex++];
const rotation = array[startingIndex++];
const extrudedHeight = array[startingIndex++];
const offsetAttribute = array[startingIndex];
if (!defined_default(result)) {
scratchOptions.granularity = granularity;
scratchOptions.height = height;
scratchOptions.rotation = rotation;
scratchOptions.extrudedHeight = extrudedHeight;
scratchOptions.offsetAttribute = offsetAttribute === -1 ? void 0 : offsetAttribute;
return new RectangleOutlineGeometry(scratchOptions);
}
result._rectangle = Rectangle_default.clone(rectangle, result._rectangle);
result._ellipsoid = Ellipsoid_default.clone(ellipsoid, result._ellipsoid);
result._surfaceHeight = height;
result._rotation = rotation;
result._extrudedHeight = extrudedHeight;
result._offsetAttribute = offsetAttribute === -1 ? void 0 : offsetAttribute;
return result;
};
var nwScratch = new Cartographic_default();
RectangleOutlineGeometry.createGeometry = function(rectangleGeometry) {
const rectangle = rectangleGeometry._rectangle;
const ellipsoid = rectangleGeometry._ellipsoid;
const computedOptions = RectangleGeometryLibrary_default.computeOptions(
rectangle,
rectangleGeometry._granularity,
rectangleGeometry._rotation,
0,
rectangleScratch,
nwScratch
);
let geometry;
let boundingSphere;
if (Math_default.equalsEpsilon(
rectangle.north,
rectangle.south,
Math_default.EPSILON10
) || Math_default.equalsEpsilon(
rectangle.east,
rectangle.west,
Math_default.EPSILON10
)) {
return void 0;
}
const surfaceHeight = rectangleGeometry._surfaceHeight;
const extrudedHeight = rectangleGeometry._extrudedHeight;
const extrude = !Math_default.equalsEpsilon(
surfaceHeight,
extrudedHeight,
0,
Math_default.EPSILON2
);
let offsetValue;
if (extrude) {
geometry = constructExtrudedRectangle(rectangleGeometry, computedOptions);
if (defined_default(rectangleGeometry._offsetAttribute)) {
const size = geometry.attributes.position.values.length / 3;
let offsetAttribute = new Uint8Array(size);
if (rectangleGeometry._offsetAttribute === GeometryOffsetAttribute_default.TOP) {
offsetAttribute = offsetAttribute.fill(1, 0, size / 2);
} else {
offsetValue = rectangleGeometry._offsetAttribute === GeometryOffsetAttribute_default.NONE ? 0 : 1;
offsetAttribute = offsetAttribute.fill(offsetValue);
}
geometry.attributes.applyOffset = new GeometryAttribute_default({
componentDatatype: ComponentDatatype_default.UNSIGNED_BYTE,
componentsPerAttribute: 1,
values: offsetAttribute
});
}
const topBS = BoundingSphere_default.fromRectangle3D(
rectangle,
ellipsoid,
surfaceHeight,
topBoundingSphere
);
const bottomBS = BoundingSphere_default.fromRectangle3D(
rectangle,
ellipsoid,
extrudedHeight,
bottomBoundingSphere
);
boundingSphere = BoundingSphere_default.union(topBS, bottomBS);
} else {
geometry = constructRectangle(rectangleGeometry, computedOptions);
geometry.attributes.position.values = PolygonPipeline_default.scaleToGeodeticHeight(
geometry.attributes.position.values,
surfaceHeight,
ellipsoid,
false
);
if (defined_default(rectangleGeometry._offsetAttribute)) {
const length = geometry.attributes.position.values.length;
offsetValue = rectangleGeometry._offsetAttribute === GeometryOffsetAttribute_default.NONE ? 0 : 1;
const applyOffset = new Uint8Array(length / 3).fill(offsetValue);
geometry.attributes.applyOffset = new GeometryAttribute_default({
componentDatatype: ComponentDatatype_default.UNSIGNED_BYTE,
componentsPerAttribute: 1,
values: applyOffset
});
}
boundingSphere = BoundingSphere_default.fromRectangle3D(
rectangle,
ellipsoid,
surfaceHeight
);
}
return new Geometry_default({
attributes: geometry.attributes,
indices: geometry.indices,
primitiveType: PrimitiveType_default.LINES,
boundingSphere,
offsetAttribute: rectangleGeometry._offsetAttribute
});
};
var RectangleOutlineGeometry_default = RectangleOutlineGeometry;
// packages/engine/Source/Workers/createRectangleOutlineGeometry.js
function createRectangleOutlineGeometry(rectangleGeometry, offset) {
if (defined_default(offset)) {
rectangleGeometry = RectangleOutlineGeometry_default.unpack(
rectangleGeometry,
offset
);
}
rectangleGeometry._ellipsoid = Ellipsoid_default.clone(rectangleGeometry._ellipsoid);
rectangleGeometry._rectangle = Rectangle_default.clone(rectangleGeometry._rectangle);
return RectangleOutlineGeometry_default.createGeometry(rectangleGeometry);
}
var createRectangleOutlineGeometry_default = createRectangleOutlineGeometry;
export {
createRectangleOutlineGeometry_default as default
};
@@ -0,0 +1,397 @@
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.142.0
*
* 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 {
Color_default
} from "./chunk-QN67VG36.js";
import {
ArcType_default
} from "./chunk-M3B5JKSM.js";
import {
PolylinePipeline_default
} from "./chunk-QRWGUWI6.js";
import "./chunk-6YEE6JDR.js";
import "./chunk-54I6Y66F.js";
import "./chunk-3VFEWOBI.js";
import "./chunk-E7VQ76KE.js";
import {
IndexDatatype_default
} from "./chunk-S4MCOY6I.js";
import {
GeometryAttributes_default
} from "./chunk-KSSWJIZW.js";
import {
GeometryAttribute_default,
Geometry_default,
PrimitiveType_default
} from "./chunk-EBSIOBXY.js";
import {
BoundingSphere_default
} from "./chunk-XZMBNNDX.js";
import "./chunk-C6J67V5A.js";
import "./chunk-MYP774IS.js";
import "./chunk-Q3PY526V.js";
import {
ComponentDatatype_default
} from "./chunk-P3CK7MCY.js";
import "./chunk-TKKIREQ6.js";
import "./chunk-Y5BF6AFU.js";
import {
Ellipsoid_default
} from "./chunk-V7VQKN6N.js";
import {
Cartesian3_default,
Frozen_default
} from "./chunk-MPZHGZU6.js";
import {
Math_default
} from "./chunk-J6BWOHUF.js";
import {
DeveloperError_default
} from "./chunk-AYKR4VBR.js";
import {
defined_default
} from "./chunk-ZP7JMQV4.js";
// packages/engine/Source/Core/SimplePolylineGeometry.js
function interpolateColors(p0, p1, color0, color1, minDistance, array, offset) {
const numPoints = PolylinePipeline_default.numberOfPoints(p0, p1, minDistance);
let i;
const r0 = color0.red;
const g0 = color0.green;
const b0 = color0.blue;
const a0 = color0.alpha;
const r1 = color1.red;
const g1 = color1.green;
const b1 = color1.blue;
const a1 = color1.alpha;
if (Color_default.equals(color0, color1)) {
for (i = 0; i < numPoints; i++) {
array[offset++] = Color_default.floatToByte(r0);
array[offset++] = Color_default.floatToByte(g0);
array[offset++] = Color_default.floatToByte(b0);
array[offset++] = Color_default.floatToByte(a0);
}
return offset;
}
const redPerVertex = (r1 - r0) / numPoints;
const greenPerVertex = (g1 - g0) / numPoints;
const bluePerVertex = (b1 - b0) / numPoints;
const alphaPerVertex = (a1 - a0) / numPoints;
let index = offset;
for (i = 0; i < numPoints; i++) {
array[index++] = Color_default.floatToByte(r0 + i * redPerVertex);
array[index++] = Color_default.floatToByte(g0 + i * greenPerVertex);
array[index++] = Color_default.floatToByte(b0 + i * bluePerVertex);
array[index++] = Color_default.floatToByte(a0 + i * alphaPerVertex);
}
return index;
}
function SimplePolylineGeometry(options) {
options = options ?? Frozen_default.EMPTY_OBJECT;
const positions = options.positions;
const colors = options.colors;
const colorsPerVertex = options.colorsPerVertex ?? false;
if (!defined_default(positions) || positions.length < 2) {
throw new DeveloperError_default("At least two positions are required.");
}
if (defined_default(colors) && (colorsPerVertex && colors.length < positions.length || !colorsPerVertex && colors.length < positions.length - 1)) {
throw new DeveloperError_default("colors has an invalid length.");
}
this._positions = positions;
this._colors = colors;
this._colorsPerVertex = colorsPerVertex;
this._arcType = options.arcType ?? ArcType_default.GEODESIC;
this._granularity = options.granularity ?? Math_default.RADIANS_PER_DEGREE;
this._ellipsoid = options.ellipsoid ?? Ellipsoid_default.default;
this._workerName = "createSimplePolylineGeometry";
let numComponents = 1 + positions.length * Cartesian3_default.packedLength;
numComponents += defined_default(colors) ? 1 + colors.length * Color_default.packedLength : 1;
this.packedLength = numComponents + Ellipsoid_default.packedLength + 3;
}
SimplePolylineGeometry.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 = startingIndex ?? 0;
let i;
const positions = value._positions;
let length = positions.length;
array[startingIndex++] = length;
for (i = 0; i < length; ++i, startingIndex += Cartesian3_default.packedLength) {
Cartesian3_default.pack(positions[i], array, startingIndex);
}
const colors = value._colors;
length = defined_default(colors) ? colors.length : 0;
array[startingIndex++] = length;
for (i = 0; i < length; ++i, startingIndex += Color_default.packedLength) {
Color_default.pack(colors[i], array, startingIndex);
}
Ellipsoid_default.pack(value._ellipsoid, array, startingIndex);
startingIndex += Ellipsoid_default.packedLength;
array[startingIndex++] = value._colorsPerVertex ? 1 : 0;
array[startingIndex++] = value._arcType;
array[startingIndex] = value._granularity;
return array;
};
SimplePolylineGeometry.unpack = function(array, startingIndex, result) {
if (!defined_default(array)) {
throw new DeveloperError_default("array is required");
}
startingIndex = startingIndex ?? 0;
let i;
let length = array[startingIndex++];
const positions = new Array(length);
for (i = 0; i < length; ++i, startingIndex += Cartesian3_default.packedLength) {
positions[i] = Cartesian3_default.unpack(array, startingIndex);
}
length = array[startingIndex++];
const colors = length > 0 ? new Array(length) : void 0;
for (i = 0; i < length; ++i, startingIndex += Color_default.packedLength) {
colors[i] = Color_default.unpack(array, startingIndex);
}
const ellipsoid = Ellipsoid_default.unpack(array, startingIndex);
startingIndex += Ellipsoid_default.packedLength;
const colorsPerVertex = array[startingIndex++] === 1;
const arcType = array[startingIndex++];
const granularity = array[startingIndex];
if (!defined_default(result)) {
return new SimplePolylineGeometry({
positions,
colors,
ellipsoid,
colorsPerVertex,
arcType,
granularity
});
}
result._positions = positions;
result._colors = colors;
result._ellipsoid = ellipsoid;
result._colorsPerVertex = colorsPerVertex;
result._arcType = arcType;
result._granularity = granularity;
return result;
};
var scratchArray1 = new Array(2);
var scratchArray2 = new Array(2);
var generateArcOptionsScratch = {
positions: scratchArray1,
height: scratchArray2,
ellipsoid: void 0,
minDistance: void 0,
granularity: void 0
};
SimplePolylineGeometry.createGeometry = function(simplePolylineGeometry) {
const positions = simplePolylineGeometry._positions;
const colors = simplePolylineGeometry._colors;
const colorsPerVertex = simplePolylineGeometry._colorsPerVertex;
const arcType = simplePolylineGeometry._arcType;
const granularity = simplePolylineGeometry._granularity;
const ellipsoid = simplePolylineGeometry._ellipsoid;
const minDistance = Math_default.chordLength(
granularity,
ellipsoid.maximumRadius
);
const perSegmentColors = defined_default(colors) && !colorsPerVertex;
let i;
const length = positions.length;
let positionValues;
let numberOfPositions;
let colorValues;
let color;
let offset = 0;
if (arcType === ArcType_default.GEODESIC || arcType === ArcType_default.RHUMB) {
let subdivisionSize;
let numberOfPointsFunction;
let generateArcFunction;
if (arcType === ArcType_default.GEODESIC) {
subdivisionSize = Math_default.chordLength(
granularity,
ellipsoid.maximumRadius
);
numberOfPointsFunction = PolylinePipeline_default.numberOfPoints;
generateArcFunction = PolylinePipeline_default.generateArc;
} else {
subdivisionSize = granularity;
numberOfPointsFunction = PolylinePipeline_default.numberOfPointsRhumbLine;
generateArcFunction = PolylinePipeline_default.generateRhumbArc;
}
const heights = PolylinePipeline_default.extractHeights(positions, ellipsoid);
const generateArcOptions = generateArcOptionsScratch;
if (arcType === ArcType_default.GEODESIC) {
generateArcOptions.minDistance = minDistance;
} else {
generateArcOptions.granularity = granularity;
}
generateArcOptions.ellipsoid = ellipsoid;
if (perSegmentColors) {
let positionCount = 0;
for (i = 0; i < length - 1; i++) {
positionCount += numberOfPointsFunction(
positions[i],
positions[i + 1],
subdivisionSize
) + 1;
}
positionValues = new Float64Array(positionCount * 3);
colorValues = new Uint8Array(positionCount * 4);
generateArcOptions.positions = scratchArray1;
generateArcOptions.height = scratchArray2;
let ci = 0;
for (i = 0; i < length - 1; ++i) {
scratchArray1[0] = positions[i];
scratchArray1[1] = positions[i + 1];
scratchArray2[0] = heights[i];
scratchArray2[1] = heights[i + 1];
const pos = generateArcFunction(generateArcOptions);
if (defined_default(colors)) {
const segLen = pos.length / 3;
color = colors[i];
for (let k = 0; k < segLen; ++k) {
colorValues[ci++] = Color_default.floatToByte(color.red);
colorValues[ci++] = Color_default.floatToByte(color.green);
colorValues[ci++] = Color_default.floatToByte(color.blue);
colorValues[ci++] = Color_default.floatToByte(color.alpha);
}
}
positionValues.set(pos, offset);
offset += pos.length;
}
} else {
generateArcOptions.positions = positions;
generateArcOptions.height = heights;
positionValues = new Float64Array(
generateArcFunction(generateArcOptions)
);
if (defined_default(colors)) {
colorValues = new Uint8Array(positionValues.length / 3 * 4);
for (i = 0; i < length - 1; ++i) {
const p0 = positions[i];
const p1 = positions[i + 1];
const c0 = colors[i];
const c1 = colors[i + 1];
offset = interpolateColors(
p0,
p1,
c0,
c1,
minDistance,
colorValues,
offset
);
}
const lastColor = colors[length - 1];
colorValues[offset++] = Color_default.floatToByte(lastColor.red);
colorValues[offset++] = Color_default.floatToByte(lastColor.green);
colorValues[offset++] = Color_default.floatToByte(lastColor.blue);
colorValues[offset++] = Color_default.floatToByte(lastColor.alpha);
}
}
} else {
numberOfPositions = perSegmentColors ? length * 2 - 2 : length;
positionValues = new Float64Array(numberOfPositions * 3);
colorValues = defined_default(colors) ? new Uint8Array(numberOfPositions * 4) : void 0;
let positionIndex = 0;
let colorIndex = 0;
for (i = 0; i < length; ++i) {
const p = positions[i];
if (perSegmentColors && i > 0) {
Cartesian3_default.pack(p, positionValues, positionIndex);
positionIndex += 3;
color = colors[i - 1];
colorValues[colorIndex++] = Color_default.floatToByte(color.red);
colorValues[colorIndex++] = Color_default.floatToByte(color.green);
colorValues[colorIndex++] = Color_default.floatToByte(color.blue);
colorValues[colorIndex++] = Color_default.floatToByte(color.alpha);
}
if (perSegmentColors && i === length - 1) {
break;
}
Cartesian3_default.pack(p, positionValues, positionIndex);
positionIndex += 3;
if (defined_default(colors)) {
color = colors[i];
colorValues[colorIndex++] = Color_default.floatToByte(color.red);
colorValues[colorIndex++] = Color_default.floatToByte(color.green);
colorValues[colorIndex++] = Color_default.floatToByte(color.blue);
colorValues[colorIndex++] = Color_default.floatToByte(color.alpha);
}
}
}
const attributes = new GeometryAttributes_default();
attributes.position = new GeometryAttribute_default({
componentDatatype: ComponentDatatype_default.DOUBLE,
componentsPerAttribute: 3,
values: positionValues
});
if (defined_default(colors)) {
attributes.color = new GeometryAttribute_default({
componentDatatype: ComponentDatatype_default.UNSIGNED_BYTE,
componentsPerAttribute: 4,
values: colorValues,
normalize: true
});
}
numberOfPositions = positionValues.length / 3;
const numberOfIndices = (numberOfPositions - 1) * 2;
const indices = IndexDatatype_default.createTypedArray(
numberOfPositions,
numberOfIndices
);
let index = 0;
for (i = 0; i < numberOfPositions - 1; ++i) {
indices[index++] = i;
indices[index++] = i + 1;
}
return new Geometry_default({
attributes,
indices,
primitiveType: PrimitiveType_default.LINES,
boundingSphere: BoundingSphere_default.fromPoints(positions)
});
};
var SimplePolylineGeometry_default = SimplePolylineGeometry;
// packages/engine/Source/Workers/createSimplePolylineGeometry.js
function createSimplePolylineGeometry(simplePolylineGeometry, offset) {
if (defined_default(offset)) {
simplePolylineGeometry = SimplePolylineGeometry_default.unpack(
simplePolylineGeometry,
offset
);
}
simplePolylineGeometry._ellipsoid = Ellipsoid_default.clone(
simplePolylineGeometry._ellipsoid
);
return SimplePolylineGeometry_default.createGeometry(simplePolylineGeometry);
}
var createSimplePolylineGeometry_default = createSimplePolylineGeometry;
export {
createSimplePolylineGeometry_default as default
};
@@ -0,0 +1,116 @@
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.142.0
*
* 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 {
EllipsoidGeometry_default
} from "./chunk-DOBXCNC3.js";
import "./chunk-IYOUHCZB.js";
import {
VertexFormat_default
} from "./chunk-VQYETPWC.js";
import "./chunk-S4MCOY6I.js";
import "./chunk-KSSWJIZW.js";
import "./chunk-EBSIOBXY.js";
import "./chunk-XZMBNNDX.js";
import "./chunk-C6J67V5A.js";
import "./chunk-MYP774IS.js";
import "./chunk-Q3PY526V.js";
import "./chunk-P3CK7MCY.js";
import "./chunk-TKKIREQ6.js";
import "./chunk-Y5BF6AFU.js";
import "./chunk-V7VQKN6N.js";
import {
Cartesian3_default
} from "./chunk-MPZHGZU6.js";
import "./chunk-J6BWOHUF.js";
import {
Check_default
} from "./chunk-AYKR4VBR.js";
import {
defined_default
} from "./chunk-ZP7JMQV4.js";
// packages/engine/Source/Core/SphereGeometry.js
function SphereGeometry(options) {
const radius = options.radius ?? 1;
const radii = new Cartesian3_default(radius, radius, radius);
const ellipsoidOptions = {
radii,
stackPartitions: options.stackPartitions,
slicePartitions: options.slicePartitions,
vertexFormat: options.vertexFormat
};
this._ellipsoidGeometry = new EllipsoidGeometry_default(ellipsoidOptions);
this._workerName = "createSphereGeometry";
}
SphereGeometry.packedLength = EllipsoidGeometry_default.packedLength;
SphereGeometry.pack = function(value, array, startingIndex) {
Check_default.typeOf.object("value", value);
return EllipsoidGeometry_default.pack(value._ellipsoidGeometry, array, startingIndex);
};
var scratchEllipsoidGeometry = new EllipsoidGeometry_default();
var scratchOptions = {
radius: void 0,
radii: new Cartesian3_default(),
vertexFormat: new VertexFormat_default(),
stackPartitions: void 0,
slicePartitions: void 0
};
SphereGeometry.unpack = function(array, startingIndex, result) {
const ellipsoidGeometry = EllipsoidGeometry_default.unpack(
array,
startingIndex,
scratchEllipsoidGeometry
);
scratchOptions.vertexFormat = VertexFormat_default.clone(
ellipsoidGeometry._vertexFormat,
scratchOptions.vertexFormat
);
scratchOptions.stackPartitions = ellipsoidGeometry._stackPartitions;
scratchOptions.slicePartitions = ellipsoidGeometry._slicePartitions;
if (!defined_default(result)) {
scratchOptions.radius = ellipsoidGeometry._radii.x;
return new SphereGeometry(scratchOptions);
}
Cartesian3_default.clone(ellipsoidGeometry._radii, scratchOptions.radii);
result._ellipsoidGeometry = new EllipsoidGeometry_default(scratchOptions);
return result;
};
SphereGeometry.createGeometry = function(sphereGeometry) {
return EllipsoidGeometry_default.createGeometry(sphereGeometry._ellipsoidGeometry);
};
var SphereGeometry_default = SphereGeometry;
// packages/engine/Source/Workers/createSphereGeometry.js
function createSphereGeometry(sphereGeometry, offset) {
if (defined_default(offset)) {
sphereGeometry = SphereGeometry_default.unpack(sphereGeometry, offset);
}
return SphereGeometry_default.createGeometry(sphereGeometry);
}
var createSphereGeometry_default = createSphereGeometry;
export {
createSphereGeometry_default as default
};
@@ -0,0 +1,116 @@
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.142.0
*
* 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 {
EllipsoidOutlineGeometry_default
} from "./chunk-UOOIQ3KX.js";
import "./chunk-IYOUHCZB.js";
import "./chunk-S4MCOY6I.js";
import "./chunk-KSSWJIZW.js";
import "./chunk-EBSIOBXY.js";
import "./chunk-XZMBNNDX.js";
import "./chunk-C6J67V5A.js";
import "./chunk-MYP774IS.js";
import "./chunk-Q3PY526V.js";
import "./chunk-P3CK7MCY.js";
import "./chunk-TKKIREQ6.js";
import "./chunk-Y5BF6AFU.js";
import "./chunk-V7VQKN6N.js";
import {
Cartesian3_default
} from "./chunk-MPZHGZU6.js";
import "./chunk-J6BWOHUF.js";
import {
Check_default
} from "./chunk-AYKR4VBR.js";
import {
defined_default
} from "./chunk-ZP7JMQV4.js";
// packages/engine/Source/Core/SphereOutlineGeometry.js
function SphereOutlineGeometry(options) {
const radius = options.radius ?? 1;
const radii = new Cartesian3_default(radius, radius, radius);
const ellipsoidOptions = {
radii,
stackPartitions: options.stackPartitions,
slicePartitions: options.slicePartitions,
subdivisions: options.subdivisions
};
this._ellipsoidGeometry = new EllipsoidOutlineGeometry_default(ellipsoidOptions);
this._workerName = "createSphereOutlineGeometry";
}
SphereOutlineGeometry.packedLength = EllipsoidOutlineGeometry_default.packedLength;
SphereOutlineGeometry.pack = function(value, array, startingIndex) {
Check_default.typeOf.object("value", value);
return EllipsoidOutlineGeometry_default.pack(
value._ellipsoidGeometry,
array,
startingIndex
);
};
var scratchEllipsoidGeometry = new EllipsoidOutlineGeometry_default();
var scratchOptions = {
radius: void 0,
radii: new Cartesian3_default(),
stackPartitions: void 0,
slicePartitions: void 0,
subdivisions: void 0
};
SphereOutlineGeometry.unpack = function(array, startingIndex, result) {
const ellipsoidGeometry = EllipsoidOutlineGeometry_default.unpack(
array,
startingIndex,
scratchEllipsoidGeometry
);
scratchOptions.stackPartitions = ellipsoidGeometry._stackPartitions;
scratchOptions.slicePartitions = ellipsoidGeometry._slicePartitions;
scratchOptions.subdivisions = ellipsoidGeometry._subdivisions;
if (!defined_default(result)) {
scratchOptions.radius = ellipsoidGeometry._radii.x;
return new SphereOutlineGeometry(scratchOptions);
}
Cartesian3_default.clone(ellipsoidGeometry._radii, scratchOptions.radii);
result._ellipsoidGeometry = new EllipsoidOutlineGeometry_default(scratchOptions);
return result;
};
SphereOutlineGeometry.createGeometry = function(sphereGeometry) {
return EllipsoidOutlineGeometry_default.createGeometry(
sphereGeometry._ellipsoidGeometry
);
};
var SphereOutlineGeometry_default = SphereOutlineGeometry;
// packages/engine/Source/Workers/createSphereOutlineGeometry.js
function createSphereOutlineGeometry(sphereGeometry, offset) {
if (defined_default(offset)) {
sphereGeometry = SphereOutlineGeometry_default.unpack(sphereGeometry, offset);
}
return SphereOutlineGeometry_default.createGeometry(sphereGeometry);
}
var createSphereOutlineGeometry_default = createSphereOutlineGeometry;
export {
createSphereOutlineGeometry_default as default
};
@@ -0,0 +1,32 @@
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.142.0
*
* 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 {
createTaskProcessorWorker_default
} from "./chunk-4S7IE3LB.js";
import "./chunk-ZP7JMQV4.js";
export {
createTaskProcessorWorker_default as default
};
@@ -0,0 +1,492 @@
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.142.0
*
* 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 {
createTaskProcessorWorker_default
} from "./chunk-4S7IE3LB.js";
import {
AttributeCompression_default
} from "./chunk-7J2HKPRH.js";
import {
IndexDatatype_default
} from "./chunk-S4MCOY6I.js";
import {
Rectangle_default,
combine_default
} from "./chunk-MYP774IS.js";
import "./chunk-Q3PY526V.js";
import "./chunk-P3CK7MCY.js";
import "./chunk-TKKIREQ6.js";
import "./chunk-Y5BF6AFU.js";
import {
Cartographic_default,
Ellipsoid_default
} from "./chunk-V7VQKN6N.js";
import {
Cartesian3_default
} from "./chunk-MPZHGZU6.js";
import {
Math_default
} from "./chunk-J6BWOHUF.js";
import "./chunk-AYKR4VBR.js";
import "./chunk-ZP7JMQV4.js";
// packages/engine/Source/Workers/createVectorTileClampedPolylines.js
var MAX_SHORT = 32767;
var MITER_BREAK = Math.cos(Math_default.toRadians(150));
var scratchBVCartographic = new Cartographic_default();
var scratchEncodedPosition = new Cartesian3_default();
function decodePositions(uBuffer, vBuffer, heightBuffer, rectangle, minimumHeight, maximumHeight, ellipsoid) {
const positionsLength = uBuffer.length;
const decodedPositions = new Float64Array(positionsLength * 3);
for (let i = 0; i < positionsLength; ++i) {
const u = uBuffer[i];
const v = vBuffer[i];
const h = heightBuffer[i];
const lon = Math_default.lerp(rectangle.west, rectangle.east, u / MAX_SHORT);
const lat = Math_default.lerp(
rectangle.south,
rectangle.north,
v / MAX_SHORT
);
const alt = Math_default.lerp(minimumHeight, maximumHeight, h / MAX_SHORT);
const cartographic = Cartographic_default.fromRadians(
lon,
lat,
alt,
scratchBVCartographic
);
const decodedPosition = ellipsoid.cartographicToCartesian(
cartographic,
scratchEncodedPosition
);
Cartesian3_default.pack(decodedPosition, decodedPositions, i * 3);
}
return decodedPositions;
}
function getPositionOffsets(counts) {
const countsLength = counts.length;
const positionOffsets = new Uint32Array(countsLength + 1);
let offset = 0;
for (let i = 0; i < countsLength; ++i) {
positionOffsets[i] = offset;
offset += counts[i];
}
positionOffsets[countsLength] = offset;
return positionOffsets;
}
var previousCompressedCartographicScratch = new Cartographic_default();
var currentCompressedCartographicScratch = new Cartographic_default();
function removeDuplicates(uBuffer, vBuffer, heightBuffer, counts) {
const countsLength = counts.length;
const positionsLength = uBuffer.length;
const markRemoval = new Uint8Array(positionsLength);
const previous = previousCompressedCartographicScratch;
const current = currentCompressedCartographicScratch;
let offset = 0;
for (let i = 0; i < countsLength; i++) {
const count = counts[i];
let updatedCount = count;
for (let j = 1; j < count; j++) {
const index = offset + j;
const previousIndex = index - 1;
current.longitude = uBuffer[index];
current.latitude = vBuffer[index];
previous.longitude = uBuffer[previousIndex];
previous.latitude = vBuffer[previousIndex];
if (Cartographic_default.equals(current, previous)) {
updatedCount--;
markRemoval[previousIndex] = 1;
}
}
counts[i] = updatedCount;
offset += count;
}
let nextAvailableIndex = 0;
for (let k = 0; k < positionsLength; k++) {
if (markRemoval[k] !== 1) {
uBuffer[nextAvailableIndex] = uBuffer[k];
vBuffer[nextAvailableIndex] = vBuffer[k];
heightBuffer[nextAvailableIndex] = heightBuffer[k];
nextAvailableIndex++;
}
}
}
function VertexAttributesAndIndices(volumesCount) {
const vertexCount = volumesCount * 8;
const vec3Floats = vertexCount * 3;
const vec4Floats = vertexCount * 4;
this.startEllipsoidNormals = new Float32Array(vec3Floats);
this.endEllipsoidNormals = new Float32Array(vec3Floats);
this.startPositionAndHeights = new Float32Array(vec4Floats);
this.startFaceNormalAndVertexCornerIds = new Float32Array(vec4Floats);
this.endPositionAndHeights = new Float32Array(vec4Floats);
this.endFaceNormalAndHalfWidths = new Float32Array(vec4Floats);
this.vertexBatchIds = new Uint16Array(vertexCount);
this.indices = IndexDatatype_default.createTypedArray(vertexCount, 36 * volumesCount);
this.vec3Offset = 0;
this.vec4Offset = 0;
this.batchIdOffset = 0;
this.indexOffset = 0;
this.volumeStartIndex = 0;
}
var towardCurrScratch = new Cartesian3_default();
var towardNextScratch = new Cartesian3_default();
function computeMiteredNormal(previousPosition, position, nextPosition, ellipsoidSurfaceNormal, result) {
const towardNext = Cartesian3_default.subtract(
nextPosition,
position,
towardNextScratch
);
let towardCurr = Cartesian3_default.subtract(
position,
previousPosition,
towardCurrScratch
);
Cartesian3_default.normalize(towardNext, towardNext);
Cartesian3_default.normalize(towardCurr, towardCurr);
if (Cartesian3_default.dot(towardNext, towardCurr) < MITER_BREAK) {
towardCurr = Cartesian3_default.multiplyByScalar(
towardCurr,
-1,
towardCurrScratch
);
}
Cartesian3_default.add(towardNext, towardCurr, result);
if (Cartesian3_default.equals(result, Cartesian3_default.ZERO)) {
result = Cartesian3_default.subtract(previousPosition, position);
}
Cartesian3_default.cross(result, ellipsoidSurfaceNormal, result);
Cartesian3_default.cross(ellipsoidSurfaceNormal, result, result);
Cartesian3_default.normalize(result, result);
return result;
}
var REFERENCE_INDICES = [
0,
2,
6,
0,
6,
4,
// right
0,
1,
3,
0,
3,
2,
// start face
0,
4,
5,
0,
5,
1,
// bottom
5,
3,
1,
5,
7,
3,
// left
7,
5,
4,
7,
4,
6,
// end face
7,
6,
2,
7,
2,
3
// top
];
var REFERENCE_INDICES_LENGTH = REFERENCE_INDICES.length;
var positionScratch = new Cartesian3_default();
var scratchStartEllipsoidNormal = new Cartesian3_default();
var scratchStartFaceNormal = new Cartesian3_default();
var scratchEndEllipsoidNormal = new Cartesian3_default();
var scratchEndFaceNormal = new Cartesian3_default();
VertexAttributesAndIndices.prototype.addVolume = function(preStartRTC, startRTC, endRTC, postEndRTC, startHeight, endHeight, halfWidth, batchId, center, ellipsoid) {
let position = Cartesian3_default.add(startRTC, center, positionScratch);
const startEllipsoidNormal = ellipsoid.geodeticSurfaceNormal(
position,
scratchStartEllipsoidNormal
);
position = Cartesian3_default.add(endRTC, center, positionScratch);
const endEllipsoidNormal = ellipsoid.geodeticSurfaceNormal(
position,
scratchEndEllipsoidNormal
);
const startFaceNormal = computeMiteredNormal(
preStartRTC,
startRTC,
endRTC,
startEllipsoidNormal,
scratchStartFaceNormal
);
const endFaceNormal = computeMiteredNormal(
postEndRTC,
endRTC,
startRTC,
endEllipsoidNormal,
scratchEndFaceNormal
);
const startEllipsoidNormals = this.startEllipsoidNormals;
const endEllipsoidNormals = this.endEllipsoidNormals;
const startPositionAndHeights = this.startPositionAndHeights;
const startFaceNormalAndVertexCornerIds = this.startFaceNormalAndVertexCornerIds;
const endPositionAndHeights = this.endPositionAndHeights;
const endFaceNormalAndHalfWidths = this.endFaceNormalAndHalfWidths;
const vertexBatchIds = this.vertexBatchIds;
let batchIdOffset = this.batchIdOffset;
let vec3Offset = this.vec3Offset;
let vec4Offset = this.vec4Offset;
let i;
for (i = 0; i < 8; i++) {
Cartesian3_default.pack(startEllipsoidNormal, startEllipsoidNormals, vec3Offset);
Cartesian3_default.pack(endEllipsoidNormal, endEllipsoidNormals, vec3Offset);
Cartesian3_default.pack(startRTC, startPositionAndHeights, vec4Offset);
startPositionAndHeights[vec4Offset + 3] = startHeight;
Cartesian3_default.pack(endRTC, endPositionAndHeights, vec4Offset);
endPositionAndHeights[vec4Offset + 3] = endHeight;
Cartesian3_default.pack(
startFaceNormal,
startFaceNormalAndVertexCornerIds,
vec4Offset
);
startFaceNormalAndVertexCornerIds[vec4Offset + 3] = i;
Cartesian3_default.pack(endFaceNormal, endFaceNormalAndHalfWidths, vec4Offset);
endFaceNormalAndHalfWidths[vec4Offset + 3] = halfWidth;
vertexBatchIds[batchIdOffset++] = batchId;
vec3Offset += 3;
vec4Offset += 4;
}
this.batchIdOffset = batchIdOffset;
this.vec3Offset = vec3Offset;
this.vec4Offset = vec4Offset;
const indices = this.indices;
const volumeStartIndex = this.volumeStartIndex;
const indexOffset = this.indexOffset;
for (i = 0; i < REFERENCE_INDICES_LENGTH; i++) {
indices[indexOffset + i] = REFERENCE_INDICES[i] + volumeStartIndex;
}
this.volumeStartIndex += 8;
this.indexOffset += REFERENCE_INDICES_LENGTH;
};
var scratchRectangle = new Rectangle_default();
var scratchEllipsoid = new Ellipsoid_default();
var scratchCenter = new Cartesian3_default();
var scratchPrev = new Cartesian3_default();
var scratchP0 = new Cartesian3_default();
var scratchP1 = new Cartesian3_default();
var scratchNext = new Cartesian3_default();
function createVectorTileClampedPolylines(parameters, transferableObjects) {
const encodedPositions = new Uint16Array(parameters.positions);
const widths = new Uint16Array(parameters.widths);
const counts = new Uint32Array(parameters.counts);
const batchIds = new Uint16Array(parameters.batchIds);
const rectangle = scratchRectangle;
const ellipsoid = scratchEllipsoid;
const center = scratchCenter;
const packedBuffer = new Float64Array(parameters.packedBuffer);
let offset = 0;
const minimumHeight = packedBuffer[offset++];
const maximumHeight = packedBuffer[offset++];
Rectangle_default.unpack(packedBuffer, offset, rectangle);
offset += Rectangle_default.packedLength;
Ellipsoid_default.unpack(packedBuffer, offset, ellipsoid);
offset += Ellipsoid_default.packedLength;
Cartesian3_default.unpack(packedBuffer, offset, center);
let i;
let positionsLength = encodedPositions.length / 3;
const uBuffer = encodedPositions.subarray(0, positionsLength);
const vBuffer = encodedPositions.subarray(
positionsLength,
2 * positionsLength
);
const heightBuffer = encodedPositions.subarray(
2 * positionsLength,
3 * positionsLength
);
AttributeCompression_default.zigZagDeltaDecode(uBuffer, vBuffer, heightBuffer);
removeDuplicates(uBuffer, vBuffer, heightBuffer, counts);
const countsLength = counts.length;
let volumesCount = 0;
for (i = 0; i < countsLength; i++) {
const polylinePositionCount = counts[i];
volumesCount += polylinePositionCount - 1;
}
const attribsAndIndices = new VertexAttributesAndIndices(volumesCount);
const positions = decodePositions(
uBuffer,
vBuffer,
heightBuffer,
rectangle,
minimumHeight,
maximumHeight,
ellipsoid,
center
);
positionsLength = uBuffer.length;
const positionsRTC = new Float32Array(positionsLength * 3);
for (i = 0; i < positionsLength; ++i) {
positionsRTC[i * 3] = positions[i * 3] - center.x;
positionsRTC[i * 3 + 1] = positions[i * 3 + 1] - center.y;
positionsRTC[i * 3 + 2] = positions[i * 3 + 2] - center.z;
}
let currentPositionIndex = 0;
let currentHeightIndex = 0;
for (i = 0; i < countsLength; i++) {
const polylineVolumeCount = counts[i] - 1;
const halfWidth = widths[i] * 0.5;
const batchId = batchIds[i];
const volumeFirstPositionIndex = currentPositionIndex;
for (let j = 0; j < polylineVolumeCount; j++) {
const volumeStart = Cartesian3_default.unpack(
positionsRTC,
currentPositionIndex,
scratchP0
);
const volumeEnd = Cartesian3_default.unpack(
positionsRTC,
currentPositionIndex + 3,
scratchP1
);
let startHeight = heightBuffer[currentHeightIndex];
let endHeight = heightBuffer[currentHeightIndex + 1];
startHeight = Math_default.lerp(
minimumHeight,
maximumHeight,
startHeight / MAX_SHORT
);
endHeight = Math_default.lerp(
minimumHeight,
maximumHeight,
endHeight / MAX_SHORT
);
currentHeightIndex++;
let preStart = scratchPrev;
let postEnd = scratchNext;
if (j === 0) {
const finalPositionIndex = volumeFirstPositionIndex + polylineVolumeCount * 3;
const finalPosition = Cartesian3_default.unpack(
positionsRTC,
finalPositionIndex,
scratchPrev
);
if (Cartesian3_default.equals(finalPosition, volumeStart)) {
Cartesian3_default.unpack(positionsRTC, finalPositionIndex - 3, preStart);
} else {
const offsetPastStart = Cartesian3_default.subtract(
volumeStart,
volumeEnd,
scratchPrev
);
preStart = Cartesian3_default.add(offsetPastStart, volumeStart, scratchPrev);
}
} else {
Cartesian3_default.unpack(positionsRTC, currentPositionIndex - 3, preStart);
}
if (j === polylineVolumeCount - 1) {
const firstPosition = Cartesian3_default.unpack(
positionsRTC,
volumeFirstPositionIndex,
scratchNext
);
if (Cartesian3_default.equals(firstPosition, volumeEnd)) {
Cartesian3_default.unpack(
positionsRTC,
volumeFirstPositionIndex + 3,
postEnd
);
} else {
const offsetPastEnd = Cartesian3_default.subtract(
volumeEnd,
volumeStart,
scratchNext
);
postEnd = Cartesian3_default.add(offsetPastEnd, volumeEnd, scratchNext);
}
} else {
Cartesian3_default.unpack(positionsRTC, currentPositionIndex + 6, postEnd);
}
attribsAndIndices.addVolume(
preStart,
volumeStart,
volumeEnd,
postEnd,
startHeight,
endHeight,
halfWidth,
batchId,
center,
ellipsoid
);
currentPositionIndex += 3;
}
currentPositionIndex += 3;
currentHeightIndex++;
}
const indices = attribsAndIndices.indices;
transferableObjects.push(attribsAndIndices.startEllipsoidNormals.buffer);
transferableObjects.push(attribsAndIndices.endEllipsoidNormals.buffer);
transferableObjects.push(attribsAndIndices.startPositionAndHeights.buffer);
transferableObjects.push(
attribsAndIndices.startFaceNormalAndVertexCornerIds.buffer
);
transferableObjects.push(attribsAndIndices.endPositionAndHeights.buffer);
transferableObjects.push(attribsAndIndices.endFaceNormalAndHalfWidths.buffer);
transferableObjects.push(attribsAndIndices.vertexBatchIds.buffer);
transferableObjects.push(indices.buffer);
let results = {
indexDatatype: indices.BYTES_PER_ELEMENT === 2 ? IndexDatatype_default.UNSIGNED_SHORT : IndexDatatype_default.UNSIGNED_INT,
startEllipsoidNormals: attribsAndIndices.startEllipsoidNormals.buffer,
endEllipsoidNormals: attribsAndIndices.endEllipsoidNormals.buffer,
startPositionAndHeights: attribsAndIndices.startPositionAndHeights.buffer,
startFaceNormalAndVertexCornerIds: attribsAndIndices.startFaceNormalAndVertexCornerIds.buffer,
endPositionAndHeights: attribsAndIndices.endPositionAndHeights.buffer,
endFaceNormalAndHalfWidths: attribsAndIndices.endFaceNormalAndHalfWidths.buffer,
vertexBatchIds: attribsAndIndices.vertexBatchIds.buffer,
indices: indices.buffer
};
if (parameters.keepDecodedPositions) {
const positionOffsets = getPositionOffsets(counts);
transferableObjects.push(positions.buffer, positionOffsets.buffer);
results = combine_default(results, {
decodedPositions: positions.buffer,
decodedPositionOffsets: positionOffsets.buffer
});
}
return results;
}
var createVectorTileClampedPolylines_default = createTaskProcessorWorker_default(createVectorTileClampedPolylines);
export {
createVectorTileClampedPolylines_default as default
};
@@ -0,0 +1,387 @@
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.142.0
*
* 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 {
Color_default
} from "./chunk-QN67VG36.js";
import {
CylinderGeometry_default
} from "./chunk-52JDLOEM.js";
import "./chunk-IRBKFCEJ.js";
import {
EllipsoidGeometry_default
} from "./chunk-DOBXCNC3.js";
import {
createTaskProcessorWorker_default
} from "./chunk-4S7IE3LB.js";
import {
BoxGeometry_default
} from "./chunk-CZEYZU4N.js";
import "./chunk-IYOUHCZB.js";
import "./chunk-VQYETPWC.js";
import {
IndexDatatype_default
} from "./chunk-S4MCOY6I.js";
import "./chunk-KSSWJIZW.js";
import "./chunk-EBSIOBXY.js";
import {
BoundingSphere_default
} from "./chunk-XZMBNNDX.js";
import "./chunk-C6J67V5A.js";
import "./chunk-MYP774IS.js";
import {
Matrix4_default
} from "./chunk-Q3PY526V.js";
import "./chunk-P3CK7MCY.js";
import "./chunk-TKKIREQ6.js";
import "./chunk-Y5BF6AFU.js";
import "./chunk-V7VQKN6N.js";
import {
Cartesian3_default
} from "./chunk-MPZHGZU6.js";
import "./chunk-J6BWOHUF.js";
import "./chunk-AYKR4VBR.js";
import {
defined_default
} from "./chunk-ZP7JMQV4.js";
// packages/engine/Source/Scene/Vector3DTileBatch.js
function Vector3DTileBatch(options) {
this.offset = options.offset;
this.count = options.count;
this.color = options.color;
this.batchIds = options.batchIds;
}
var Vector3DTileBatch_default = Vector3DTileBatch;
// packages/engine/Source/Workers/createVectorTileGeometries.js
var scratchCartesian = new Cartesian3_default();
var packedBoxLength = Matrix4_default.packedLength + Cartesian3_default.packedLength;
var packedCylinderLength = Matrix4_default.packedLength + 2;
var packedEllipsoidLength = Matrix4_default.packedLength + Cartesian3_default.packedLength;
var packedSphereLength = Cartesian3_default.packedLength + 1;
var scratchModelMatrixAndBV = {
modelMatrix: new Matrix4_default(),
boundingVolume: new BoundingSphere_default()
};
function boxModelMatrixAndBoundingVolume(boxes, index) {
let boxIndex = index * packedBoxLength;
const dimensions = Cartesian3_default.unpack(boxes, boxIndex, scratchCartesian);
boxIndex += Cartesian3_default.packedLength;
const boxModelMatrix = Matrix4_default.unpack(
boxes,
boxIndex,
scratchModelMatrixAndBV.modelMatrix
);
Matrix4_default.multiplyByScale(boxModelMatrix, dimensions, boxModelMatrix);
const boundingVolume = scratchModelMatrixAndBV.boundingVolume;
Cartesian3_default.clone(Cartesian3_default.ZERO, boundingVolume.center);
boundingVolume.radius = Math.sqrt(3);
return scratchModelMatrixAndBV;
}
function cylinderModelMatrixAndBoundingVolume(cylinders, index) {
let cylinderIndex = index * packedCylinderLength;
const cylinderRadius = cylinders[cylinderIndex++];
const length = cylinders[cylinderIndex++];
const scale = Cartesian3_default.fromElements(
cylinderRadius,
cylinderRadius,
length,
scratchCartesian
);
const cylinderModelMatrix = Matrix4_default.unpack(
cylinders,
cylinderIndex,
scratchModelMatrixAndBV.modelMatrix
);
Matrix4_default.multiplyByScale(cylinderModelMatrix, scale, cylinderModelMatrix);
const boundingVolume = scratchModelMatrixAndBV.boundingVolume;
Cartesian3_default.clone(Cartesian3_default.ZERO, boundingVolume.center);
boundingVolume.radius = Math.sqrt(2);
return scratchModelMatrixAndBV;
}
function ellipsoidModelMatrixAndBoundingVolume(ellipsoids, index) {
let ellipsoidIndex = index * packedEllipsoidLength;
const radii = Cartesian3_default.unpack(ellipsoids, ellipsoidIndex, scratchCartesian);
ellipsoidIndex += Cartesian3_default.packedLength;
const ellipsoidModelMatrix = Matrix4_default.unpack(
ellipsoids,
ellipsoidIndex,
scratchModelMatrixAndBV.modelMatrix
);
Matrix4_default.multiplyByScale(ellipsoidModelMatrix, radii, ellipsoidModelMatrix);
const boundingVolume = scratchModelMatrixAndBV.boundingVolume;
Cartesian3_default.clone(Cartesian3_default.ZERO, boundingVolume.center);
boundingVolume.radius = 1;
return scratchModelMatrixAndBV;
}
function sphereModelMatrixAndBoundingVolume(spheres, index) {
let sphereIndex = index * packedSphereLength;
const sphereRadius = spheres[sphereIndex++];
const sphereTranslation = Cartesian3_default.unpack(
spheres,
sphereIndex,
scratchCartesian
);
const sphereModelMatrix = Matrix4_default.fromTranslation(
sphereTranslation,
scratchModelMatrixAndBV.modelMatrix
);
Matrix4_default.multiplyByUniformScale(
sphereModelMatrix,
sphereRadius,
sphereModelMatrix
);
const boundingVolume = scratchModelMatrixAndBV.boundingVolume;
Cartesian3_default.clone(Cartesian3_default.ZERO, boundingVolume.center);
boundingVolume.radius = 1;
return scratchModelMatrixAndBV;
}
var scratchPosition = new Cartesian3_default();
function createPrimitive(options, primitive, primitiveBatchIds, geometry, getModelMatrixAndBoundingVolume) {
if (!defined_default(primitive)) {
return;
}
const numberOfPrimitives = primitiveBatchIds.length;
const geometryPositions = geometry.attributes.position.values;
const geometryIndices = geometry.indices;
const positions = options.positions;
const vertexBatchIds = options.vertexBatchIds;
const indices = options.indices;
const batchIds = options.batchIds;
const batchTableColors = options.batchTableColors;
const batchedIndices = options.batchedIndices;
const indexOffsets = options.indexOffsets;
const indexCounts = options.indexCounts;
const boundingVolumes = options.boundingVolumes;
const modelMatrix = options.modelMatrix;
const center = options.center;
let positionOffset = options.positionOffset;
let batchIdIndex = options.batchIdIndex;
let indexOffset = options.indexOffset;
const batchedIndicesOffset = options.batchedIndicesOffset;
for (let i = 0; i < numberOfPrimitives; ++i) {
const primitiveModelMatrixAndBV = getModelMatrixAndBoundingVolume(
primitive,
i
);
const primitiveModelMatrix = primitiveModelMatrixAndBV.modelMatrix;
Matrix4_default.multiply(modelMatrix, primitiveModelMatrix, primitiveModelMatrix);
const batchId = primitiveBatchIds[i];
const positionsLength = geometryPositions.length;
for (let j = 0; j < positionsLength; j += 3) {
const position = Cartesian3_default.unpack(geometryPositions, j, scratchPosition);
Matrix4_default.multiplyByPoint(primitiveModelMatrix, position, position);
Cartesian3_default.subtract(position, center, position);
Cartesian3_default.pack(position, positions, positionOffset * 3 + j);
vertexBatchIds[batchIdIndex++] = batchId;
}
const indicesLength = geometryIndices.length;
for (let k = 0; k < indicesLength; ++k) {
indices[indexOffset + k] = geometryIndices[k] + positionOffset;
}
const offset = i + batchedIndicesOffset;
batchedIndices[offset] = new Vector3DTileBatch_default({
offset: indexOffset,
count: indicesLength,
color: Color_default.fromRgba(batchTableColors[batchId]),
batchIds: [batchId]
});
batchIds[offset] = batchId;
indexOffsets[offset] = indexOffset;
indexCounts[offset] = indicesLength;
boundingVolumes[offset] = BoundingSphere_default.transform(
primitiveModelMatrixAndBV.boundingVolume,
primitiveModelMatrix
);
positionOffset += positionsLength / 3;
indexOffset += indicesLength;
}
options.positionOffset = positionOffset;
options.batchIdIndex = batchIdIndex;
options.indexOffset = indexOffset;
options.batchedIndicesOffset += numberOfPrimitives;
}
var scratchCenter = new Cartesian3_default();
var scratchMatrix4 = new Matrix4_default();
function unpackBuffer(buffer) {
const packedBuffer = new Float64Array(buffer);
let offset = 0;
Cartesian3_default.unpack(packedBuffer, offset, scratchCenter);
offset += Cartesian3_default.packedLength;
Matrix4_default.unpack(packedBuffer, offset, scratchMatrix4);
}
function packedBatchedIndicesLength(batchedIndices) {
const length = batchedIndices.length;
let count = 0;
for (let i = 0; i < length; ++i) {
count += Color_default.packedLength + 3 + batchedIndices[i].batchIds.length;
}
return count;
}
function packBuffer(indicesBytesPerElement, batchedIndices, boundingVolumes) {
const numBVs = boundingVolumes.length;
const length = 1 + 1 + numBVs * BoundingSphere_default.packedLength + 1 + packedBatchedIndicesLength(batchedIndices);
const packedBuffer = new Float64Array(length);
let offset = 0;
packedBuffer[offset++] = indicesBytesPerElement;
packedBuffer[offset++] = numBVs;
for (let i = 0; i < numBVs; ++i) {
BoundingSphere_default.pack(boundingVolumes[i], packedBuffer, offset);
offset += BoundingSphere_default.packedLength;
}
const indicesLength = batchedIndices.length;
packedBuffer[offset++] = indicesLength;
for (let j = 0; j < indicesLength; ++j) {
const batchedIndex = batchedIndices[j];
Color_default.pack(batchedIndex.color, packedBuffer, offset);
offset += Color_default.packedLength;
packedBuffer[offset++] = batchedIndex.offset;
packedBuffer[offset++] = batchedIndex.count;
const batchIds = batchedIndex.batchIds;
const batchIdsLength = batchIds.length;
packedBuffer[offset++] = batchIdsLength;
for (let k = 0; k < batchIdsLength; ++k) {
packedBuffer[offset++] = batchIds[k];
}
}
return packedBuffer;
}
function createVectorTileGeometries(parameters, transferableObjects) {
const boxes = defined_default(parameters.boxes) ? new Float32Array(parameters.boxes) : void 0;
const boxBatchIds = defined_default(parameters.boxBatchIds) ? new Uint16Array(parameters.boxBatchIds) : void 0;
const cylinders = defined_default(parameters.cylinders) ? new Float32Array(parameters.cylinders) : void 0;
const cylinderBatchIds = defined_default(parameters.cylinderBatchIds) ? new Uint16Array(parameters.cylinderBatchIds) : void 0;
const ellipsoids = defined_default(parameters.ellipsoids) ? new Float32Array(parameters.ellipsoids) : void 0;
const ellipsoidBatchIds = defined_default(parameters.ellipsoidBatchIds) ? new Uint16Array(parameters.ellipsoidBatchIds) : void 0;
const spheres = defined_default(parameters.spheres) ? new Float32Array(parameters.spheres) : void 0;
const sphereBatchIds = defined_default(parameters.sphereBatchIds) ? new Uint16Array(parameters.sphereBatchIds) : void 0;
const numberOfBoxes = defined_default(boxes) ? boxBatchIds.length : 0;
const numberOfCylinders = defined_default(cylinders) ? cylinderBatchIds.length : 0;
const numberOfEllipsoids = defined_default(ellipsoids) ? ellipsoidBatchIds.length : 0;
const numberOfSpheres = defined_default(spheres) ? sphereBatchIds.length : 0;
const boxGeometry = BoxGeometry_default.getUnitBox();
const cylinderGeometry = CylinderGeometry_default.getUnitCylinder();
const ellipsoidGeometry = EllipsoidGeometry_default.getUnitEllipsoid();
const boxPositions = boxGeometry.attributes.position.values;
const cylinderPositions = cylinderGeometry.attributes.position.values;
const ellipsoidPositions = ellipsoidGeometry.attributes.position.values;
let numberOfPositions = boxPositions.length * numberOfBoxes;
numberOfPositions += cylinderPositions.length * numberOfCylinders;
numberOfPositions += ellipsoidPositions.length * (numberOfEllipsoids + numberOfSpheres);
const boxIndices = boxGeometry.indices;
const cylinderIndices = cylinderGeometry.indices;
const ellipsoidIndices = ellipsoidGeometry.indices;
let numberOfIndices = boxIndices.length * numberOfBoxes;
numberOfIndices += cylinderIndices.length * numberOfCylinders;
numberOfIndices += ellipsoidIndices.length * (numberOfEllipsoids + numberOfSpheres);
const positions = new Float32Array(numberOfPositions);
const vertexBatchIds = new Uint16Array(numberOfPositions / 3);
const indices = IndexDatatype_default.createTypedArray(
numberOfPositions / 3,
numberOfIndices
);
const numberOfGeometries = numberOfBoxes + numberOfCylinders + numberOfEllipsoids + numberOfSpheres;
const batchIds = new Uint16Array(numberOfGeometries);
const batchedIndices = new Array(numberOfGeometries);
const indexOffsets = new Uint32Array(numberOfGeometries);
const indexCounts = new Uint32Array(numberOfGeometries);
const boundingVolumes = new Array(numberOfGeometries);
unpackBuffer(parameters.packedBuffer);
const options = {
batchTableColors: new Uint32Array(parameters.batchTableColors),
positions,
vertexBatchIds,
indices,
batchIds,
batchedIndices,
indexOffsets,
indexCounts,
boundingVolumes,
positionOffset: 0,
batchIdIndex: 0,
indexOffset: 0,
batchedIndicesOffset: 0,
modelMatrix: scratchMatrix4,
center: scratchCenter
};
createPrimitive(
options,
boxes,
boxBatchIds,
boxGeometry,
boxModelMatrixAndBoundingVolume
);
createPrimitive(
options,
cylinders,
cylinderBatchIds,
cylinderGeometry,
cylinderModelMatrixAndBoundingVolume
);
createPrimitive(
options,
ellipsoids,
ellipsoidBatchIds,
ellipsoidGeometry,
ellipsoidModelMatrixAndBoundingVolume
);
createPrimitive(
options,
spheres,
sphereBatchIds,
ellipsoidGeometry,
sphereModelMatrixAndBoundingVolume
);
const packedBuffer = packBuffer(
indices.BYTES_PER_ELEMENT,
batchedIndices,
boundingVolumes
);
transferableObjects.push(
positions.buffer,
vertexBatchIds.buffer,
indices.buffer
);
transferableObjects.push(
batchIds.buffer,
indexOffsets.buffer,
indexCounts.buffer
);
transferableObjects.push(packedBuffer.buffer);
return {
positions: positions.buffer,
vertexBatchIds: vertexBatchIds.buffer,
indices: indices.buffer,
indexOffsets: indexOffsets.buffer,
indexCounts: indexCounts.buffer,
batchIds: batchIds.buffer,
packedBuffer: packedBuffer.buffer
};
}
var createVectorTileGeometries_default = createTaskProcessorWorker_default(createVectorTileGeometries);
export {
createVectorTileGeometries_default as default
};
@@ -0,0 +1,114 @@
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.142.0
*
* 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 {
createTaskProcessorWorker_default
} from "./chunk-4S7IE3LB.js";
import {
AttributeCompression_default
} from "./chunk-7J2HKPRH.js";
import {
Rectangle_default
} from "./chunk-MYP774IS.js";
import "./chunk-Q3PY526V.js";
import "./chunk-P3CK7MCY.js";
import "./chunk-TKKIREQ6.js";
import "./chunk-Y5BF6AFU.js";
import {
Cartographic_default,
Ellipsoid_default
} from "./chunk-V7VQKN6N.js";
import {
Cartesian3_default
} from "./chunk-MPZHGZU6.js";
import {
Math_default
} from "./chunk-J6BWOHUF.js";
import "./chunk-AYKR4VBR.js";
import "./chunk-ZP7JMQV4.js";
// packages/engine/Source/Workers/createVectorTilePoints.js
var maxShort = 32767;
var scratchBVCartographic = new Cartographic_default();
var scratchEncodedPosition = new Cartesian3_default();
var scratchRectangle = new Rectangle_default();
var scratchEllipsoid = new Ellipsoid_default();
var scratchMinMaxHeights = {
min: void 0,
max: void 0
};
function unpackBuffer(packedBuffer) {
packedBuffer = new Float64Array(packedBuffer);
let offset = 0;
scratchMinMaxHeights.min = packedBuffer[offset++];
scratchMinMaxHeights.max = packedBuffer[offset++];
Rectangle_default.unpack(packedBuffer, offset, scratchRectangle);
offset += Rectangle_default.packedLength;
Ellipsoid_default.unpack(packedBuffer, offset, scratchEllipsoid);
}
function createVectorTilePoints(parameters, transferableObjects) {
const positions = new Uint16Array(parameters.positions);
unpackBuffer(parameters.packedBuffer);
const rectangle = scratchRectangle;
const ellipsoid = scratchEllipsoid;
const minimumHeight = scratchMinMaxHeights.min;
const maximumHeight = scratchMinMaxHeights.max;
const positionsLength = positions.length / 3;
const uBuffer = positions.subarray(0, positionsLength);
const vBuffer = positions.subarray(positionsLength, 2 * positionsLength);
const heightBuffer = positions.subarray(
2 * positionsLength,
3 * positionsLength
);
AttributeCompression_default.zigZagDeltaDecode(uBuffer, vBuffer, heightBuffer);
const decoded = new Float64Array(positions.length);
for (let i = 0; i < positionsLength; ++i) {
const u = uBuffer[i];
const v = vBuffer[i];
const h = heightBuffer[i];
const lon = Math_default.lerp(rectangle.west, rectangle.east, u / maxShort);
const lat = Math_default.lerp(rectangle.south, rectangle.north, v / maxShort);
const alt = Math_default.lerp(minimumHeight, maximumHeight, h / maxShort);
const cartographic = Cartographic_default.fromRadians(
lon,
lat,
alt,
scratchBVCartographic
);
const decodedPosition = ellipsoid.cartographicToCartesian(
cartographic,
scratchEncodedPosition
);
Cartesian3_default.pack(decodedPosition, decoded, i * 3);
}
transferableObjects.push(decoded.buffer);
return {
positions: decoded.buffer
};
}
var createVectorTilePoints_default = createTaskProcessorWorker_default(createVectorTilePoints);
export {
createVectorTilePoints_default as default
};
@@ -0,0 +1,386 @@
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.142.0
*
* 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 {
Color_default
} from "./chunk-QN67VG36.js";
import {
createTaskProcessorWorker_default
} from "./chunk-4S7IE3LB.js";
import {
OrientedBoundingBox_default
} from "./chunk-EPYXRCDB.js";
import {
AttributeCompression_default
} from "./chunk-7J2HKPRH.js";
import "./chunk-SMQZZOW6.js";
import "./chunk-DDWSZVMY.js";
import "./chunk-3VFEWOBI.js";
import "./chunk-E7VQ76KE.js";
import {
IndexDatatype_default
} from "./chunk-S4MCOY6I.js";
import "./chunk-XZMBNNDX.js";
import "./chunk-C6J67V5A.js";
import {
Rectangle_default
} from "./chunk-MYP774IS.js";
import "./chunk-Q3PY526V.js";
import "./chunk-P3CK7MCY.js";
import "./chunk-TKKIREQ6.js";
import "./chunk-Y5BF6AFU.js";
import {
Cartographic_default,
Ellipsoid_default
} from "./chunk-V7VQKN6N.js";
import {
Cartesian3_default
} from "./chunk-MPZHGZU6.js";
import {
Math_default
} from "./chunk-J6BWOHUF.js";
import "./chunk-AYKR4VBR.js";
import {
defined_default
} from "./chunk-ZP7JMQV4.js";
// packages/engine/Source/Workers/createVectorTilePolygons.js
var scratchCenter = new Cartesian3_default();
var scratchEllipsoid = new Ellipsoid_default();
var scratchRectangle = new Rectangle_default();
var scratchScalars = {
min: void 0,
max: void 0,
indexBytesPerElement: void 0
};
function unpackBuffer(buffer) {
const packedBuffer = new Float64Array(buffer);
let offset = 0;
scratchScalars.indexBytesPerElement = packedBuffer[offset++];
scratchScalars.min = packedBuffer[offset++];
scratchScalars.max = packedBuffer[offset++];
Cartesian3_default.unpack(packedBuffer, offset, scratchCenter);
offset += Cartesian3_default.packedLength;
Ellipsoid_default.unpack(packedBuffer, offset, scratchEllipsoid);
offset += Ellipsoid_default.packedLength;
Rectangle_default.unpack(packedBuffer, offset, scratchRectangle);
}
function packedBatchedIndicesLength(batchedIndices) {
const length = batchedIndices.length;
let count = 0;
for (let i = 0; i < length; ++i) {
count += Color_default.packedLength + 3 + batchedIndices[i].batchIds.length;
}
return count;
}
function packBuffer(indexDatatype, boundingVolumes, batchedIndices) {
const numBVs = boundingVolumes.length;
const length = 1 + 1 + numBVs * OrientedBoundingBox_default.packedLength + 1 + packedBatchedIndicesLength(batchedIndices);
const packedBuffer = new Float64Array(length);
let offset = 0;
packedBuffer[offset++] = indexDatatype;
packedBuffer[offset++] = numBVs;
for (let i = 0; i < numBVs; ++i) {
OrientedBoundingBox_default.pack(boundingVolumes[i], packedBuffer, offset);
offset += OrientedBoundingBox_default.packedLength;
}
const indicesLength = batchedIndices.length;
packedBuffer[offset++] = indicesLength;
for (let j = 0; j < indicesLength; ++j) {
const batchedIndex = batchedIndices[j];
Color_default.pack(batchedIndex.color, packedBuffer, offset);
offset += Color_default.packedLength;
packedBuffer[offset++] = batchedIndex.offset;
packedBuffer[offset++] = batchedIndex.count;
const batchIds = batchedIndex.batchIds;
const batchIdsLength = batchIds.length;
packedBuffer[offset++] = batchIdsLength;
for (let k = 0; k < batchIdsLength; ++k) {
packedBuffer[offset++] = batchIds[k];
}
}
return packedBuffer;
}
var maxShort = 32767;
var scratchEncodedPosition = new Cartesian3_default();
var scratchNormal = new Cartesian3_default();
var scratchScaledNormal = new Cartesian3_default();
var scratchMinHeightPosition = new Cartesian3_default();
var scratchMaxHeightPosition = new Cartesian3_default();
var scratchBVCartographic = new Cartographic_default();
var scratchBVRectangle = new Rectangle_default();
function createVectorTilePolygons(parameters, transferableObjects) {
unpackBuffer(parameters.packedBuffer);
let indices;
const indexBytesPerElement = scratchScalars.indexBytesPerElement;
if (indexBytesPerElement === 2) {
indices = new Uint16Array(parameters.indices);
} else {
indices = new Uint32Array(parameters.indices);
}
const positions = new Uint16Array(parameters.positions);
const counts = new Uint32Array(parameters.counts);
const indexCounts = new Uint32Array(parameters.indexCounts);
const batchIds = new Uint32Array(parameters.batchIds);
const batchTableColors = new Uint32Array(parameters.batchTableColors);
const boundingVolumes = new Array(counts.length);
const center = scratchCenter;
const ellipsoid = scratchEllipsoid;
let rectangle = scratchRectangle;
const minHeight = scratchScalars.min;
const maxHeight = scratchScalars.max;
let minimumHeights = parameters.minimumHeights;
let maximumHeights = parameters.maximumHeights;
if (defined_default(minimumHeights) && defined_default(maximumHeights)) {
minimumHeights = new Float32Array(minimumHeights);
maximumHeights = new Float32Array(maximumHeights);
}
let i;
let j;
let rgba;
const positionsLength = positions.length / 2;
const uBuffer = positions.subarray(0, positionsLength);
const vBuffer = positions.subarray(positionsLength, 2 * positionsLength);
AttributeCompression_default.zigZagDeltaDecode(uBuffer, vBuffer);
const decodedPositions = new Float64Array(positionsLength * 3);
for (i = 0; i < positionsLength; ++i) {
const u = uBuffer[i];
const v = vBuffer[i];
const x = Math_default.lerp(rectangle.west, rectangle.east, u / maxShort);
const y = Math_default.lerp(rectangle.south, rectangle.north, v / maxShort);
const cart = Cartographic_default.fromRadians(x, y, 0, scratchBVCartographic);
const decodedPosition = ellipsoid.cartographicToCartesian(
cart,
scratchEncodedPosition
);
Cartesian3_default.pack(decodedPosition, decodedPositions, i * 3);
}
const countsLength = counts.length;
const offsets = new Array(countsLength);
const indexOffsets = new Array(countsLength);
let currentOffset = 0;
let currentIndexOffset = 0;
for (i = 0; i < countsLength; ++i) {
offsets[i] = currentOffset;
indexOffsets[i] = currentIndexOffset;
currentOffset += counts[i];
currentIndexOffset += indexCounts[i];
}
const batchedPositions = new Float32Array(positionsLength * 3 * 2);
const batchedIds = new Uint16Array(positionsLength * 2);
const batchedIndexOffsets = new Uint32Array(indexOffsets.length);
const batchedIndexCounts = new Uint32Array(indexCounts.length);
let batchedIndices = [];
const colorToBuffers = {};
for (i = 0; i < countsLength; ++i) {
rgba = batchTableColors[i];
if (!defined_default(colorToBuffers[rgba])) {
colorToBuffers[rgba] = {
positionLength: counts[i],
indexLength: indexCounts[i],
offset: 0,
indexOffset: 0,
batchIds: [i]
};
} else {
colorToBuffers[rgba].positionLength += counts[i];
colorToBuffers[rgba].indexLength += indexCounts[i];
colorToBuffers[rgba].batchIds.push(i);
}
}
let buffer;
let byColorPositionOffset = 0;
let byColorIndexOffset = 0;
for (rgba in colorToBuffers) {
if (colorToBuffers.hasOwnProperty(rgba)) {
buffer = colorToBuffers[rgba];
buffer.offset = byColorPositionOffset;
buffer.indexOffset = byColorIndexOffset;
const positionLength = buffer.positionLength * 2;
const indexLength = buffer.indexLength * 2 + buffer.positionLength * 6;
byColorPositionOffset += positionLength;
byColorIndexOffset += indexLength;
buffer.indexLength = indexLength;
}
}
const batchedDrawCalls = [];
for (rgba in colorToBuffers) {
if (colorToBuffers.hasOwnProperty(rgba)) {
buffer = colorToBuffers[rgba];
batchedDrawCalls.push({
color: Color_default.fromRgba(parseInt(rgba)),
offset: buffer.indexOffset,
count: buffer.indexLength,
batchIds: buffer.batchIds
});
}
}
for (i = 0; i < countsLength; ++i) {
rgba = batchTableColors[i];
buffer = colorToBuffers[rgba];
const positionOffset = buffer.offset;
let positionIndex = positionOffset * 3;
let batchIdIndex = positionOffset;
const polygonOffset = offsets[i];
const polygonCount = counts[i];
const batchId = batchIds[i];
let polygonMinimumHeight = minHeight;
let polygonMaximumHeight = maxHeight;
if (defined_default(minimumHeights) && defined_default(maximumHeights)) {
polygonMinimumHeight = minimumHeights[i];
polygonMaximumHeight = maximumHeights[i];
}
let minLat = Number.POSITIVE_INFINITY;
let maxLat = Number.NEGATIVE_INFINITY;
let minLon = Number.POSITIVE_INFINITY;
let maxLon = Number.NEGATIVE_INFINITY;
for (j = 0; j < polygonCount; ++j) {
const position = Cartesian3_default.unpack(
decodedPositions,
polygonOffset * 3 + j * 3,
scratchEncodedPosition
);
ellipsoid.scaleToGeodeticSurface(position, position);
const carto = ellipsoid.cartesianToCartographic(
position,
scratchBVCartographic
);
const lat = carto.latitude;
const lon = carto.longitude;
minLat = Math.min(lat, minLat);
maxLat = Math.max(lat, maxLat);
minLon = Math.min(lon, minLon);
maxLon = Math.max(lon, maxLon);
const normal = ellipsoid.geodeticSurfaceNormal(position, scratchNormal);
let scaledNormal = Cartesian3_default.multiplyByScalar(
normal,
polygonMinimumHeight,
scratchScaledNormal
);
const minHeightPosition = Cartesian3_default.add(
position,
scaledNormal,
scratchMinHeightPosition
);
scaledNormal = Cartesian3_default.multiplyByScalar(
normal,
polygonMaximumHeight,
scaledNormal
);
const maxHeightPosition = Cartesian3_default.add(
position,
scaledNormal,
scratchMaxHeightPosition
);
Cartesian3_default.subtract(maxHeightPosition, center, maxHeightPosition);
Cartesian3_default.subtract(minHeightPosition, center, minHeightPosition);
Cartesian3_default.pack(maxHeightPosition, batchedPositions, positionIndex);
Cartesian3_default.pack(minHeightPosition, batchedPositions, positionIndex + 3);
batchedIds[batchIdIndex] = batchId;
batchedIds[batchIdIndex + 1] = batchId;
positionIndex += 6;
batchIdIndex += 2;
}
rectangle = scratchBVRectangle;
rectangle.west = minLon;
rectangle.east = maxLon;
rectangle.south = minLat;
rectangle.north = maxLat;
boundingVolumes[i] = OrientedBoundingBox_default.fromRectangle(
rectangle,
minHeight,
maxHeight,
ellipsoid
);
let indicesIndex = buffer.indexOffset;
const indexOffset = indexOffsets[i];
const indexCount = indexCounts[i];
batchedIndexOffsets[i] = indicesIndex;
for (j = 0; j < indexCount; j += 3) {
const i0 = indices[indexOffset + j] - polygonOffset;
const i1 = indices[indexOffset + j + 1] - polygonOffset;
const i2 = indices[indexOffset + j + 2] - polygonOffset;
batchedIndices[indicesIndex++] = i0 * 2 + positionOffset;
batchedIndices[indicesIndex++] = i1 * 2 + positionOffset;
batchedIndices[indicesIndex++] = i2 * 2 + positionOffset;
batchedIndices[indicesIndex++] = i2 * 2 + 1 + positionOffset;
batchedIndices[indicesIndex++] = i1 * 2 + 1 + positionOffset;
batchedIndices[indicesIndex++] = i0 * 2 + 1 + positionOffset;
}
for (j = 0; j < polygonCount; ++j) {
const v0 = j;
const v1 = (j + 1) % polygonCount;
batchedIndices[indicesIndex++] = v0 * 2 + 1 + positionOffset;
batchedIndices[indicesIndex++] = v1 * 2 + positionOffset;
batchedIndices[indicesIndex++] = v0 * 2 + positionOffset;
batchedIndices[indicesIndex++] = v0 * 2 + 1 + positionOffset;
batchedIndices[indicesIndex++] = v1 * 2 + 1 + positionOffset;
batchedIndices[indicesIndex++] = v1 * 2 + positionOffset;
}
buffer.offset += polygonCount * 2;
buffer.indexOffset = indicesIndex;
batchedIndexCounts[i] = indicesIndex - batchedIndexOffsets[i];
}
batchedIndices = IndexDatatype_default.createTypedArray(
batchedPositions.length / 3,
batchedIndices
);
const batchedIndicesLength = batchedDrawCalls.length;
for (let m = 0; m < batchedIndicesLength; ++m) {
const tempIds = batchedDrawCalls[m].batchIds;
let count = 0;
const tempIdsLength = tempIds.length;
for (let n = 0; n < tempIdsLength; ++n) {
count += batchedIndexCounts[tempIds[n]];
}
batchedDrawCalls[m].count = count;
}
const indexDatatype = batchedIndices.BYTES_PER_ELEMENT === 2 ? IndexDatatype_default.UNSIGNED_SHORT : IndexDatatype_default.UNSIGNED_INT;
const packedBuffer = packBuffer(
indexDatatype,
boundingVolumes,
batchedDrawCalls
);
transferableObjects.push(
batchedPositions.buffer,
batchedIndices.buffer,
batchedIndexOffsets.buffer,
batchedIndexCounts.buffer,
batchedIds.buffer,
packedBuffer.buffer
);
return {
positions: batchedPositions.buffer,
indices: batchedIndices.buffer,
indexOffsets: batchedIndexOffsets.buffer,
indexCounts: batchedIndexCounts.buffer,
batchIds: batchedIds.buffer,
packedBuffer: packedBuffer.buffer
};
}
var createVectorTilePolygons_default = createTaskProcessorWorker_default(createVectorTilePolygons);
export {
createVectorTilePolygons_default as default
};
@@ -0,0 +1,262 @@
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.142.0
*
* 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 {
createTaskProcessorWorker_default
} from "./chunk-4S7IE3LB.js";
import {
AttributeCompression_default
} from "./chunk-7J2HKPRH.js";
import {
IndexDatatype_default
} from "./chunk-S4MCOY6I.js";
import {
Rectangle_default,
combine_default
} from "./chunk-MYP774IS.js";
import "./chunk-Q3PY526V.js";
import "./chunk-P3CK7MCY.js";
import "./chunk-TKKIREQ6.js";
import "./chunk-Y5BF6AFU.js";
import {
Cartographic_default,
Ellipsoid_default
} from "./chunk-V7VQKN6N.js";
import {
Cartesian3_default
} from "./chunk-MPZHGZU6.js";
import {
Math_default
} from "./chunk-J6BWOHUF.js";
import "./chunk-AYKR4VBR.js";
import "./chunk-ZP7JMQV4.js";
// packages/engine/Source/Core/decodeVectorPolylinePositions.js
var maxShort = 32767;
var scratchBVCartographic = new Cartographic_default();
var scratchEncodedPosition = new Cartesian3_default();
function decodeVectorPolylinePositions(positions, rectangle, minimumHeight, maximumHeight, ellipsoid) {
const positionsLength = positions.length / 3;
const uBuffer = positions.subarray(0, positionsLength);
const vBuffer = positions.subarray(positionsLength, 2 * positionsLength);
const heightBuffer = positions.subarray(
2 * positionsLength,
3 * positionsLength
);
AttributeCompression_default.zigZagDeltaDecode(uBuffer, vBuffer, heightBuffer);
const decoded = new Float64Array(positions.length);
for (let i = 0; i < positionsLength; ++i) {
const u = uBuffer[i];
const v = vBuffer[i];
const h = heightBuffer[i];
const lon = Math_default.lerp(rectangle.west, rectangle.east, u / maxShort);
const lat = Math_default.lerp(rectangle.south, rectangle.north, v / maxShort);
const alt = Math_default.lerp(minimumHeight, maximumHeight, h / maxShort);
const cartographic = Cartographic_default.fromRadians(
lon,
lat,
alt,
scratchBVCartographic
);
const decodedPosition = ellipsoid.cartographicToCartesian(
cartographic,
scratchEncodedPosition
);
Cartesian3_default.pack(decodedPosition, decoded, i * 3);
}
return decoded;
}
var decodeVectorPolylinePositions_default = decodeVectorPolylinePositions;
// packages/engine/Source/Workers/createVectorTilePolylines.js
var scratchRectangle = new Rectangle_default();
var scratchEllipsoid = new Ellipsoid_default();
var scratchCenter = new Cartesian3_default();
var scratchMinMaxHeights = {
min: void 0,
max: void 0
};
function unpackBuffer(packedBuffer) {
packedBuffer = new Float64Array(packedBuffer);
let offset = 0;
scratchMinMaxHeights.min = packedBuffer[offset++];
scratchMinMaxHeights.max = packedBuffer[offset++];
Rectangle_default.unpack(packedBuffer, offset, scratchRectangle);
offset += Rectangle_default.packedLength;
Ellipsoid_default.unpack(packedBuffer, offset, scratchEllipsoid);
offset += Ellipsoid_default.packedLength;
Cartesian3_default.unpack(packedBuffer, offset, scratchCenter);
}
function getPositionOffsets(counts) {
const countsLength = counts.length;
const positionOffsets = new Uint32Array(countsLength + 1);
let offset = 0;
for (let i = 0; i < countsLength; ++i) {
positionOffsets[i] = offset;
offset += counts[i];
}
positionOffsets[countsLength] = offset;
return positionOffsets;
}
var scratchP0 = new Cartesian3_default();
var scratchP1 = new Cartesian3_default();
var scratchPrev = new Cartesian3_default();
var scratchCur = new Cartesian3_default();
var scratchNext = new Cartesian3_default();
function createVectorTilePolylines(parameters, transferableObjects) {
const encodedPositions = new Uint16Array(parameters.positions);
const widths = new Uint16Array(parameters.widths);
const counts = new Uint32Array(parameters.counts);
const batchIds = new Uint16Array(parameters.batchIds);
unpackBuffer(parameters.packedBuffer);
const rectangle = scratchRectangle;
const ellipsoid = scratchEllipsoid;
const center = scratchCenter;
const minimumHeight = scratchMinMaxHeights.min;
const maximumHeight = scratchMinMaxHeights.max;
const positions = decodeVectorPolylinePositions_default(
encodedPositions,
rectangle,
minimumHeight,
maximumHeight,
ellipsoid
);
const positionsLength = positions.length / 3;
const size = positionsLength * 4 - 4;
const curPositions = new Float32Array(size * 3);
const prevPositions = new Float32Array(size * 3);
const nextPositions = new Float32Array(size * 3);
const expandAndWidth = new Float32Array(size * 2);
const vertexBatchIds = new Uint16Array(size);
let positionIndex = 0;
let expandAndWidthIndex = 0;
let batchIdIndex = 0;
let i;
let offset = 0;
let length = counts.length;
for (i = 0; i < length; ++i) {
const count = counts[i];
const width = widths[i];
const batchId = batchIds[i];
for (let j = 0; j < count; ++j) {
let previous;
if (j === 0) {
const p0 = Cartesian3_default.unpack(positions, offset * 3, scratchP0);
const p1 = Cartesian3_default.unpack(positions, (offset + 1) * 3, scratchP1);
previous = Cartesian3_default.subtract(p0, p1, scratchPrev);
Cartesian3_default.add(p0, previous, previous);
} else {
previous = Cartesian3_default.unpack(
positions,
(offset + j - 1) * 3,
scratchPrev
);
}
const current = Cartesian3_default.unpack(
positions,
(offset + j) * 3,
scratchCur
);
let next;
if (j === count - 1) {
const p2 = Cartesian3_default.unpack(
positions,
(offset + count - 1) * 3,
scratchP0
);
const p3 = Cartesian3_default.unpack(
positions,
(offset + count - 2) * 3,
scratchP1
);
next = Cartesian3_default.subtract(p2, p3, scratchNext);
Cartesian3_default.add(p2, next, next);
} else {
next = Cartesian3_default.unpack(positions, (offset + j + 1) * 3, scratchNext);
}
Cartesian3_default.subtract(previous, center, previous);
Cartesian3_default.subtract(current, center, current);
Cartesian3_default.subtract(next, center, next);
const startK = j === 0 ? 2 : 0;
const endK = j === count - 1 ? 2 : 4;
for (let k = startK; k < endK; ++k) {
Cartesian3_default.pack(current, curPositions, positionIndex);
Cartesian3_default.pack(previous, prevPositions, positionIndex);
Cartesian3_default.pack(next, nextPositions, positionIndex);
positionIndex += 3;
const direction = k - 2 < 0 ? -1 : 1;
expandAndWidth[expandAndWidthIndex++] = 2 * (k % 2) - 1;
expandAndWidth[expandAndWidthIndex++] = direction * width;
vertexBatchIds[batchIdIndex++] = batchId;
}
}
offset += count;
}
const indices = IndexDatatype_default.createTypedArray(size, positionsLength * 6 - 6);
let index = 0;
let indicesIndex = 0;
length = positionsLength - 1;
for (i = 0; i < length; ++i) {
indices[indicesIndex++] = index;
indices[indicesIndex++] = index + 2;
indices[indicesIndex++] = index + 1;
indices[indicesIndex++] = index + 1;
indices[indicesIndex++] = index + 2;
indices[indicesIndex++] = index + 3;
index += 4;
}
transferableObjects.push(
curPositions.buffer,
prevPositions.buffer,
nextPositions.buffer
);
transferableObjects.push(
expandAndWidth.buffer,
vertexBatchIds.buffer,
indices.buffer
);
let results = {
indexDatatype: indices.BYTES_PER_ELEMENT === 2 ? IndexDatatype_default.UNSIGNED_SHORT : IndexDatatype_default.UNSIGNED_INT,
currentPositions: curPositions.buffer,
previousPositions: prevPositions.buffer,
nextPositions: nextPositions.buffer,
expandAndWidth: expandAndWidth.buffer,
batchIds: vertexBatchIds.buffer,
indices: indices.buffer
};
if (parameters.keepDecodedPositions) {
const positionOffsets = getPositionOffsets(counts);
transferableObjects.push(positions.buffer, positionOffsets.buffer);
results = combine_default(results, {
decodedPositions: positions.buffer,
decodedPositionOffsets: positionOffsets.buffer
});
}
return results;
}
var createVectorTilePolylines_default = createTaskProcessorWorker_default(createVectorTilePolylines);
export {
createVectorTilePolylines_default as default
};
@@ -0,0 +1,91 @@
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.142.0
*
* 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 {
Cesium3DTilesTerrainGeometryProcessor_default
} from "./chunk-424RNO3D.js";
import "./chunk-7WM2PX4V.js";
import "./chunk-VWV2IJRB.js";
import {
createTaskProcessorWorker_default
} from "./chunk-4S7IE3LB.js";
import "./chunk-4MGMYHOO.js";
import "./chunk-EPYXRCDB.js";
import "./chunk-7J2HKPRH.js";
import "./chunk-SMQZZOW6.js";
import "./chunk-DDWSZVMY.js";
import "./chunk-3VFEWOBI.js";
import "./chunk-E7VQ76KE.js";
import "./chunk-S4MCOY6I.js";
import "./chunk-XZMBNNDX.js";
import "./chunk-C6J67V5A.js";
import "./chunk-MYP774IS.js";
import "./chunk-Q3PY526V.js";
import "./chunk-P3CK7MCY.js";
import "./chunk-TKKIREQ6.js";
import "./chunk-Y5BF6AFU.js";
import "./chunk-V7VQKN6N.js";
import "./chunk-MPZHGZU6.js";
import "./chunk-J6BWOHUF.js";
import "./chunk-AYKR4VBR.js";
import "./chunk-ZP7JMQV4.js";
// packages/engine/Source/Workers/createVerticesFromCesium3DTilesTerrain.js
function createVerticesFromCesium3DTilesTerrain(options, transferableObjects) {
const meshPromise = Cesium3DTilesTerrainGeometryProcessor_default.createMesh(options);
return meshPromise.then(function(mesh) {
const verticesBuffer = mesh.vertices.buffer;
const indicesBuffer = mesh.indices.buffer;
const westIndicesBuffer = mesh.westIndicesSouthToNorth.buffer;
const southIndicesBuffer = mesh.southIndicesEastToWest.buffer;
const eastIndicesBuffer = mesh.eastIndicesNorthToSouth.buffer;
const northIndicesBuffer = mesh.northIndicesWestToEast.buffer;
transferableObjects.push(
verticesBuffer,
indicesBuffer,
westIndicesBuffer,
southIndicesBuffer,
eastIndicesBuffer,
northIndicesBuffer
);
return {
verticesBuffer,
indicesBuffer,
vertexCountWithoutSkirts: mesh.vertexCountWithoutSkirts,
indexCountWithoutSkirts: mesh.indexCountWithoutSkirts,
encoding: mesh.encoding,
westIndicesBuffer,
southIndicesBuffer,
eastIndicesBuffer,
northIndicesBuffer
};
});
}
var createVerticesFromCesium3DTilesTerrain_default = createTaskProcessorWorker_default(
createVerticesFromCesium3DTilesTerrain
);
export {
createVerticesFromCesium3DTilesTerrain_default as default
};
@@ -0,0 +1,565 @@
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.142.0
*
* 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 {
EllipsoidalOccluder_default,
TerrainEncoding_default
} from "./chunk-VWV2IJRB.js";
import {
createTaskProcessorWorker_default
} from "./chunk-4S7IE3LB.js";
import {
WebMercatorProjection_default
} from "./chunk-4MGMYHOO.js";
import {
OrientedBoundingBox_default
} from "./chunk-EPYXRCDB.js";
import "./chunk-7J2HKPRH.js";
import "./chunk-SMQZZOW6.js";
import {
AxisAlignedBoundingBox_default
} from "./chunk-DDWSZVMY.js";
import "./chunk-3VFEWOBI.js";
import "./chunk-E7VQ76KE.js";
import {
BoundingSphere_default
} from "./chunk-XZMBNNDX.js";
import "./chunk-C6J67V5A.js";
import {
Rectangle_default,
Transforms_default
} from "./chunk-MYP774IS.js";
import {
Matrix4_default
} from "./chunk-Q3PY526V.js";
import "./chunk-P3CK7MCY.js";
import "./chunk-TKKIREQ6.js";
import {
RuntimeError_default
} from "./chunk-Y5BF6AFU.js";
import {
Cartesian2_default,
Cartographic_default,
Ellipsoid_default
} from "./chunk-V7VQKN6N.js";
import {
Cartesian3_default
} from "./chunk-MPZHGZU6.js";
import {
Math_default
} from "./chunk-J6BWOHUF.js";
import "./chunk-AYKR4VBR.js";
import {
defined_default
} from "./chunk-ZP7JMQV4.js";
// packages/engine/Source/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js
var sizeOfUint16 = Uint16Array.BYTES_PER_ELEMENT;
var sizeOfInt32 = Int32Array.BYTES_PER_ELEMENT;
var sizeOfUint32 = Uint32Array.BYTES_PER_ELEMENT;
var sizeOfFloat = Float32Array.BYTES_PER_ELEMENT;
var sizeOfDouble = Float64Array.BYTES_PER_ELEMENT;
function indexOfEpsilon(arr, elem, elemType) {
elemType = elemType ?? Math_default;
const count = arr.length;
for (let i = 0; i < count; ++i) {
if (elemType.equalsEpsilon(arr[i], elem, Math_default.EPSILON12)) {
return i;
}
}
return -1;
}
function createVerticesFromGoogleEarthEnterpriseBuffer(parameters, transferableObjects) {
parameters.ellipsoid = Ellipsoid_default.clone(parameters.ellipsoid);
parameters.rectangle = Rectangle_default.clone(parameters.rectangle);
const statistics = processBuffer(
parameters.buffer,
parameters.relativeToCenter,
parameters.ellipsoid,
parameters.rectangle,
parameters.nativeRectangle,
parameters.exaggeration,
parameters.exaggerationRelativeHeight,
parameters.skirtHeight,
parameters.includeWebMercatorT,
parameters.negativeAltitudeExponentBias,
parameters.negativeElevationThreshold
);
const vertices = statistics.vertices;
transferableObjects.push(vertices.buffer);
const indices = statistics.indices;
transferableObjects.push(indices.buffer);
return {
vertices: vertices.buffer,
indices: indices.buffer,
numberOfAttributes: statistics.encoding.stride,
minimumHeight: statistics.minimumHeight,
maximumHeight: statistics.maximumHeight,
boundingSphere3D: statistics.boundingSphere3D,
orientedBoundingBox: statistics.orientedBoundingBox,
occludeePointInScaledSpace: statistics.occludeePointInScaledSpace,
encoding: statistics.encoding,
vertexCountWithoutSkirts: statistics.vertexCountWithoutSkirts,
indexCountWithoutSkirts: statistics.indexCountWithoutSkirts,
westIndicesSouthToNorth: statistics.westIndicesSouthToNorth,
southIndicesEastToWest: statistics.southIndicesEastToWest,
eastIndicesNorthToSouth: statistics.eastIndicesNorthToSouth,
northIndicesWestToEast: statistics.northIndicesWestToEast
};
}
var scratchCartographic = new Cartographic_default();
var scratchCartesian = new Cartesian3_default();
var minimumScratch = new Cartesian3_default();
var maximumScratch = new Cartesian3_default();
var matrix4Scratch = new Matrix4_default();
function processBuffer(buffer, relativeToCenter, ellipsoid, rectangle, nativeRectangle, exaggeration, exaggerationRelativeHeight, skirtHeight, includeWebMercatorT, negativeAltitudeExponentBias, negativeElevationThreshold) {
let geographicWest;
let geographicSouth;
let geographicEast;
let geographicNorth;
let rectangleWidth, rectangleHeight;
if (!defined_default(rectangle)) {
geographicWest = Math_default.toRadians(nativeRectangle.west);
geographicSouth = Math_default.toRadians(nativeRectangle.south);
geographicEast = Math_default.toRadians(nativeRectangle.east);
geographicNorth = Math_default.toRadians(nativeRectangle.north);
rectangleWidth = Math_default.toRadians(rectangle.width);
rectangleHeight = Math_default.toRadians(rectangle.height);
} else {
geographicWest = rectangle.west;
geographicSouth = rectangle.south;
geographicEast = rectangle.east;
geographicNorth = rectangle.north;
rectangleWidth = rectangle.width;
rectangleHeight = rectangle.height;
}
const quadBorderLatitudes = [geographicSouth, geographicNorth];
const quadBorderLongitudes = [geographicWest, geographicEast];
const fromENU = Transforms_default.eastNorthUpToFixedFrame(
relativeToCenter,
ellipsoid
);
const toENU = Matrix4_default.inverseTransformation(fromENU, matrix4Scratch);
let southMercatorY;
let oneOverMercatorHeight;
if (includeWebMercatorT) {
southMercatorY = WebMercatorProjection_default.geodeticLatitudeToMercatorAngle(geographicSouth);
oneOverMercatorHeight = 1 / (WebMercatorProjection_default.geodeticLatitudeToMercatorAngle(geographicNorth) - southMercatorY);
}
const hasExaggeration = exaggeration !== 1;
const includeGeodeticSurfaceNormals = hasExaggeration;
const dv = new DataView(buffer);
let minHeight = Number.POSITIVE_INFINITY;
let maxHeight = Number.NEGATIVE_INFINITY;
const minimum = minimumScratch;
minimum.x = Number.POSITIVE_INFINITY;
minimum.y = Number.POSITIVE_INFINITY;
minimum.z = Number.POSITIVE_INFINITY;
const maximum = maximumScratch;
maximum.x = Number.NEGATIVE_INFINITY;
maximum.y = Number.NEGATIVE_INFINITY;
maximum.z = Number.NEGATIVE_INFINITY;
let offset = 0;
let size = 0;
let indicesSize = 0;
let quadSize;
let quad;
for (quad = 0; quad < 4; ++quad) {
let o = offset;
quadSize = dv.getUint32(o, true);
o += sizeOfUint32;
const x = Math_default.toRadians(dv.getFloat64(o, true) * 180);
o += sizeOfDouble;
if (indexOfEpsilon(quadBorderLongitudes, x) === -1) {
quadBorderLongitudes.push(x);
}
const y = Math_default.toRadians(dv.getFloat64(o, true) * 180);
o += sizeOfDouble;
if (indexOfEpsilon(quadBorderLatitudes, y) === -1) {
quadBorderLatitudes.push(y);
}
o += 2 * sizeOfDouble;
let c = dv.getInt32(o, true);
o += sizeOfInt32;
size += c;
c = dv.getInt32(o, true);
indicesSize += c * 3;
offset += quadSize + sizeOfUint32;
}
const quadBorderPoints = [];
const quadBorderIndices = [];
const positions = new Array(size);
const uvs = new Array(size);
const heights = new Array(size);
const webMercatorTs = includeWebMercatorT ? new Array(size) : [];
const geodeticSurfaceNormals = includeGeodeticSurfaceNormals ? new Array(size) : [];
const indices = new Array(indicesSize);
const westBorder = [];
const southBorder = [];
const eastBorder = [];
const northBorder = [];
let pointOffset = 0;
let indicesOffset = 0;
offset = 0;
for (quad = 0; quad < 4; ++quad) {
quadSize = dv.getUint32(offset, true);
offset += sizeOfUint32;
const startQuad = offset;
const originX = Math_default.toRadians(dv.getFloat64(offset, true) * 180);
offset += sizeOfDouble;
const originY = Math_default.toRadians(dv.getFloat64(offset, true) * 180);
offset += sizeOfDouble;
const stepX = Math_default.toRadians(dv.getFloat64(offset, true) * 180);
const halfStepX = stepX * 0.5;
offset += sizeOfDouble;
const stepY = Math_default.toRadians(dv.getFloat64(offset, true) * 180);
const halfStepY = stepY * 0.5;
offset += sizeOfDouble;
const numPoints = dv.getInt32(offset, true);
offset += sizeOfInt32;
const numFaces = dv.getInt32(offset, true);
offset += sizeOfInt32;
offset += sizeOfInt32;
const indicesMapping = new Array(numPoints);
for (let i = 0; i < numPoints; ++i) {
const longitude = originX + dv.getUint8(offset++) * stepX;
scratchCartographic.longitude = longitude;
const latitude = originY + dv.getUint8(offset++) * stepY;
scratchCartographic.latitude = latitude;
let height = dv.getFloat32(offset, true);
offset += sizeOfFloat;
if (height !== 0 && height < negativeElevationThreshold) {
height *= -Math.pow(2, negativeAltitudeExponentBias);
}
height *= 6371010;
scratchCartographic.height = height;
if (indexOfEpsilon(quadBorderLongitudes, longitude) !== -1 || indexOfEpsilon(quadBorderLatitudes, latitude) !== -1) {
const index = indexOfEpsilon(
quadBorderPoints,
scratchCartographic,
Cartographic_default
);
if (index === -1) {
quadBorderPoints.push(Cartographic_default.clone(scratchCartographic));
quadBorderIndices.push(pointOffset);
} else {
indicesMapping[i] = quadBorderIndices[index];
continue;
}
}
indicesMapping[i] = pointOffset;
if (Math.abs(longitude - geographicWest) < halfStepX) {
westBorder.push({
index: pointOffset,
cartographic: Cartographic_default.clone(scratchCartographic)
});
} else if (Math.abs(longitude - geographicEast) < halfStepX) {
eastBorder.push({
index: pointOffset,
cartographic: Cartographic_default.clone(scratchCartographic)
});
} else if (Math.abs(latitude - geographicSouth) < halfStepY) {
southBorder.push({
index: pointOffset,
cartographic: Cartographic_default.clone(scratchCartographic)
});
} else if (Math.abs(latitude - geographicNorth) < halfStepY) {
northBorder.push({
index: pointOffset,
cartographic: Cartographic_default.clone(scratchCartographic)
});
}
minHeight = Math.min(height, minHeight);
maxHeight = Math.max(height, maxHeight);
heights[pointOffset] = height;
const pos = ellipsoid.cartographicToCartesian(scratchCartographic);
positions[pointOffset] = pos;
if (includeWebMercatorT) {
webMercatorTs[pointOffset] = (WebMercatorProjection_default.geodeticLatitudeToMercatorAngle(latitude) - southMercatorY) * oneOverMercatorHeight;
}
if (includeGeodeticSurfaceNormals) {
const normal = ellipsoid.geodeticSurfaceNormal(pos);
geodeticSurfaceNormals[pointOffset] = normal;
}
Matrix4_default.multiplyByPoint(toENU, pos, scratchCartesian);
Cartesian3_default.minimumByComponent(scratchCartesian, minimum, minimum);
Cartesian3_default.maximumByComponent(scratchCartesian, maximum, maximum);
let u = (longitude - geographicWest) / (geographicEast - geographicWest);
u = Math_default.clamp(u, 0, 1);
let v = (latitude - geographicSouth) / (geographicNorth - geographicSouth);
v = Math_default.clamp(v, 0, 1);
uvs[pointOffset] = new Cartesian2_default(u, v);
++pointOffset;
}
const facesElementCount = numFaces * 3;
for (let j = 0; j < facesElementCount; ++j, ++indicesOffset) {
indices[indicesOffset] = indicesMapping[dv.getUint16(offset, true)];
offset += sizeOfUint16;
}
if (quadSize !== offset - startQuad) {
throw new RuntimeError_default("Invalid terrain tile.");
}
}
positions.length = pointOffset;
uvs.length = pointOffset;
heights.length = pointOffset;
if (includeWebMercatorT) {
webMercatorTs.length = pointOffset;
}
if (includeGeodeticSurfaceNormals) {
geodeticSurfaceNormals.length = pointOffset;
}
const vertexCountWithoutSkirts = pointOffset;
const indexCountWithoutSkirts = indicesOffset;
const skirtOptions = {
hMin: minHeight,
lastBorderPoint: void 0,
skirtHeight,
toENU,
ellipsoid,
minimum,
maximum
};
westBorder.sort(function(a, b) {
return b.cartographic.latitude - a.cartographic.latitude;
});
southBorder.sort(function(a, b) {
return a.cartographic.longitude - b.cartographic.longitude;
});
eastBorder.sort(function(a, b) {
return a.cartographic.latitude - b.cartographic.latitude;
});
northBorder.sort(function(a, b) {
return b.cartographic.longitude - a.cartographic.longitude;
});
const percentage = 1e-5;
addSkirt(
positions,
heights,
uvs,
webMercatorTs,
geodeticSurfaceNormals,
indices,
skirtOptions,
westBorder,
-percentage * rectangleWidth,
true,
-percentage * rectangleHeight
);
addSkirt(
positions,
heights,
uvs,
webMercatorTs,
geodeticSurfaceNormals,
indices,
skirtOptions,
southBorder,
-percentage * rectangleHeight,
false
);
addSkirt(
positions,
heights,
uvs,
webMercatorTs,
geodeticSurfaceNormals,
indices,
skirtOptions,
eastBorder,
percentage * rectangleWidth,
true,
percentage * rectangleHeight
);
addSkirt(
positions,
heights,
uvs,
webMercatorTs,
geodeticSurfaceNormals,
indices,
skirtOptions,
northBorder,
percentage * rectangleHeight,
false
);
if (westBorder.length > 0 && northBorder.length > 0) {
const firstBorderIndex = westBorder[0].index;
const firstSkirtIndex = vertexCountWithoutSkirts;
const lastBorderIndex = northBorder[northBorder.length - 1].index;
const lastSkirtIndex = positions.length - 1;
indices.push(
lastBorderIndex,
lastSkirtIndex,
firstSkirtIndex,
firstSkirtIndex,
firstBorderIndex,
lastBorderIndex
);
}
size = positions.length;
const boundingSphere3D = BoundingSphere_default.fromPoints(positions);
let orientedBoundingBox;
if (defined_default(rectangle)) {
orientedBoundingBox = OrientedBoundingBox_default.fromRectangle(
rectangle,
minHeight,
maxHeight,
ellipsoid
);
}
const occluder = new EllipsoidalOccluder_default(ellipsoid);
const occludeePointInScaledSpace = occluder.computeHorizonCullingPointPossiblyUnderEllipsoid(
relativeToCenter,
positions,
minHeight
);
const aaBox = new AxisAlignedBoundingBox_default(minimum, maximum, relativeToCenter);
const encoding = new TerrainEncoding_default(
relativeToCenter,
aaBox,
skirtOptions.hMin,
maxHeight,
fromENU,
false,
includeWebMercatorT,
includeGeodeticSurfaceNormals,
exaggeration,
exaggerationRelativeHeight
);
const vertices = new Float32Array(size * encoding.stride);
let bufferIndex = 0;
for (let k = 0; k < size; ++k) {
bufferIndex = encoding.encode(
vertices,
bufferIndex,
positions[k],
uvs[k],
heights[k],
void 0,
webMercatorTs[k],
geodeticSurfaceNormals[k]
);
}
const westIndicesSouthToNorth = westBorder.map(function(vertex) {
return vertex.index;
}).reverse();
const southIndicesEastToWest = southBorder.map(function(vertex) {
return vertex.index;
}).reverse();
const eastIndicesNorthToSouth = eastBorder.map(function(vertex) {
return vertex.index;
}).reverse();
const northIndicesWestToEast = northBorder.map(function(vertex) {
return vertex.index;
}).reverse();
southIndicesEastToWest.unshift(
eastIndicesNorthToSouth[eastIndicesNorthToSouth.length - 1]
);
southIndicesEastToWest.push(westIndicesSouthToNorth[0]);
northIndicesWestToEast.unshift(
westIndicesSouthToNorth[westIndicesSouthToNorth.length - 1]
);
northIndicesWestToEast.push(eastIndicesNorthToSouth[0]);
return {
vertices,
indices: new Uint16Array(indices),
maximumHeight: maxHeight,
minimumHeight: minHeight,
encoding,
boundingSphere3D,
orientedBoundingBox,
occludeePointInScaledSpace,
vertexCountWithoutSkirts,
indexCountWithoutSkirts,
westIndicesSouthToNorth,
southIndicesEastToWest,
eastIndicesNorthToSouth,
northIndicesWestToEast
};
}
function addSkirt(positions, heights, uvs, webMercatorTs, geodeticSurfaceNormals, indices, skirtOptions, borderPoints, fudgeFactor, eastOrWest, cornerFudge) {
const count = borderPoints.length;
for (let j = 0; j < count; ++j) {
const borderPoint = borderPoints[j];
const borderCartographic = borderPoint.cartographic;
const borderIndex = borderPoint.index;
const currentIndex = positions.length;
const longitude = borderCartographic.longitude;
let latitude = borderCartographic.latitude;
latitude = Math_default.clamp(
latitude,
-Math_default.PI_OVER_TWO,
Math_default.PI_OVER_TWO
);
const height = borderCartographic.height - skirtOptions.skirtHeight;
skirtOptions.hMin = Math.min(skirtOptions.hMin, height);
Cartographic_default.fromRadians(longitude, latitude, height, scratchCartographic);
if (eastOrWest) {
scratchCartographic.longitude += fudgeFactor;
}
if (!eastOrWest) {
scratchCartographic.latitude += fudgeFactor;
} else if (j === count - 1) {
scratchCartographic.latitude += cornerFudge;
} else if (j === 0) {
scratchCartographic.latitude -= cornerFudge;
}
const pos = skirtOptions.ellipsoid.cartographicToCartesian(scratchCartographic);
positions.push(pos);
heights.push(height);
uvs.push(Cartesian2_default.clone(uvs[borderIndex]));
if (webMercatorTs.length > 0) {
webMercatorTs.push(webMercatorTs[borderIndex]);
}
if (geodeticSurfaceNormals.length > 0) {
geodeticSurfaceNormals.push(geodeticSurfaceNormals[borderIndex]);
}
Matrix4_default.multiplyByPoint(skirtOptions.toENU, pos, scratchCartesian);
const minimum = skirtOptions.minimum;
const maximum = skirtOptions.maximum;
Cartesian3_default.minimumByComponent(scratchCartesian, minimum, minimum);
Cartesian3_default.maximumByComponent(scratchCartesian, maximum, maximum);
const lastBorderPoint = skirtOptions.lastBorderPoint;
if (defined_default(lastBorderPoint)) {
const lastBorderIndex = lastBorderPoint.index;
indices.push(
lastBorderIndex,
currentIndex - 1,
currentIndex,
currentIndex,
borderIndex,
lastBorderIndex
);
}
skirtOptions.lastBorderPoint = borderPoint;
}
}
var createVerticesFromGoogleEarthEnterpriseBuffer_default = createTaskProcessorWorker_default(
createVerticesFromGoogleEarthEnterpriseBuffer
);
export {
createVerticesFromGoogleEarthEnterpriseBuffer_default as default
};
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,499 @@
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.142.0
*
* 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 {
TerrainProvider_default
} from "./chunk-7WM2PX4V.js";
import {
EllipsoidalOccluder_default,
TerrainEncoding_default
} from "./chunk-VWV2IJRB.js";
import {
createTaskProcessorWorker_default
} from "./chunk-4S7IE3LB.js";
import {
WebMercatorProjection_default
} from "./chunk-4MGMYHOO.js";
import "./chunk-7J2HKPRH.js";
import {
AxisAlignedBoundingBox_default
} from "./chunk-DDWSZVMY.js";
import {
IndexDatatype_default
} from "./chunk-S4MCOY6I.js";
import "./chunk-XZMBNNDX.js";
import "./chunk-C6J67V5A.js";
import {
Rectangle_default,
Transforms_default
} from "./chunk-MYP774IS.js";
import {
Matrix4_default
} from "./chunk-Q3PY526V.js";
import "./chunk-P3CK7MCY.js";
import "./chunk-TKKIREQ6.js";
import "./chunk-Y5BF6AFU.js";
import {
Cartesian2_default,
Cartographic_default,
Ellipsoid_default
} from "./chunk-V7VQKN6N.js";
import {
Cartesian3_default
} from "./chunk-MPZHGZU6.js";
import {
Math_default
} from "./chunk-J6BWOHUF.js";
import "./chunk-AYKR4VBR.js";
import {
defined_default
} from "./chunk-ZP7JMQV4.js";
// packages/engine/Source/Workers/createVerticesFromQuantizedTerrainMesh.js
var maxShort = 32767;
var cartesian3Scratch = new Cartesian3_default();
var scratchMinimum = new Cartesian3_default();
var scratchMaximum = new Cartesian3_default();
var cartographicScratch = new Cartographic_default();
var toPack = new Cartesian2_default();
function createVerticesFromQuantizedTerrainMesh(parameters, transferableObjects) {
const quantizedVertices = parameters.quantizedVertices;
const quantizedVertexCount = quantizedVertices.length / 3;
const octEncodedNormals = parameters.octEncodedNormals;
const edgeVertexCount = parameters.westIndices.length + parameters.eastIndices.length + parameters.southIndices.length + parameters.northIndices.length;
const includeWebMercatorT = parameters.includeWebMercatorT;
const exaggeration = parameters.exaggeration;
const exaggerationRelativeHeight = parameters.exaggerationRelativeHeight;
const hasExaggeration = exaggeration !== 1;
const includeGeodeticSurfaceNormals = hasExaggeration;
const rectangle = Rectangle_default.clone(parameters.rectangle);
const west = rectangle.west;
const south = rectangle.south;
const east = rectangle.east;
const north = rectangle.north;
const ellipsoid = Ellipsoid_default.clone(parameters.ellipsoid);
const minimumHeight = parameters.minimumHeight;
const maximumHeight = parameters.maximumHeight;
const center = parameters.relativeToCenter;
const fromENU = Transforms_default.eastNorthUpToFixedFrame(center, ellipsoid);
const toENU = Matrix4_default.inverseTransformation(fromENU, new Matrix4_default());
let southMercatorY;
let oneOverMercatorHeight;
if (includeWebMercatorT) {
southMercatorY = WebMercatorProjection_default.geodeticLatitudeToMercatorAngle(south);
oneOverMercatorHeight = 1 / (WebMercatorProjection_default.geodeticLatitudeToMercatorAngle(north) - southMercatorY);
}
const uBuffer = quantizedVertices.subarray(0, quantizedVertexCount);
const vBuffer = quantizedVertices.subarray(
quantizedVertexCount,
2 * quantizedVertexCount
);
const heightBuffer = quantizedVertices.subarray(
quantizedVertexCount * 2,
3 * quantizedVertexCount
);
const hasVertexNormals = defined_default(octEncodedNormals);
const uvs = new Array(quantizedVertexCount);
const heights = new Array(quantizedVertexCount);
const positions = new Array(quantizedVertexCount);
const webMercatorTs = includeWebMercatorT ? new Array(quantizedVertexCount) : [];
const geodeticSurfaceNormals = includeGeodeticSurfaceNormals ? new Array(quantizedVertexCount) : [];
const minimum = scratchMinimum;
minimum.x = Number.POSITIVE_INFINITY;
minimum.y = Number.POSITIVE_INFINITY;
minimum.z = Number.POSITIVE_INFINITY;
const maximum = scratchMaximum;
maximum.x = Number.NEGATIVE_INFINITY;
maximum.y = Number.NEGATIVE_INFINITY;
maximum.z = Number.NEGATIVE_INFINITY;
let minLongitude = Number.POSITIVE_INFINITY;
let maxLongitude = Number.NEGATIVE_INFINITY;
let minLatitude = Number.POSITIVE_INFINITY;
let maxLatitude = Number.NEGATIVE_INFINITY;
for (let i = 0; i < quantizedVertexCount; ++i) {
const rawU = uBuffer[i];
const rawV = vBuffer[i];
const u = rawU / maxShort;
const v = rawV / maxShort;
const height = Math_default.lerp(
minimumHeight,
maximumHeight,
heightBuffer[i] / maxShort
);
cartographicScratch.longitude = Math_default.lerp(west, east, u);
cartographicScratch.latitude = Math_default.lerp(south, north, v);
cartographicScratch.height = height;
minLongitude = Math.min(cartographicScratch.longitude, minLongitude);
maxLongitude = Math.max(cartographicScratch.longitude, maxLongitude);
minLatitude = Math.min(cartographicScratch.latitude, minLatitude);
maxLatitude = Math.max(cartographicScratch.latitude, maxLatitude);
const position = ellipsoid.cartographicToCartesian(cartographicScratch);
uvs[i] = new Cartesian2_default(u, v);
heights[i] = height;
positions[i] = position;
if (includeWebMercatorT) {
webMercatorTs[i] = (WebMercatorProjection_default.geodeticLatitudeToMercatorAngle(
cartographicScratch.latitude
) - southMercatorY) * oneOverMercatorHeight;
}
if (includeGeodeticSurfaceNormals) {
geodeticSurfaceNormals[i] = ellipsoid.geodeticSurfaceNormal(position);
}
Matrix4_default.multiplyByPoint(toENU, position, cartesian3Scratch);
Cartesian3_default.minimumByComponent(cartesian3Scratch, minimum, minimum);
Cartesian3_default.maximumByComponent(cartesian3Scratch, maximum, maximum);
}
const westIndicesSouthToNorth = copyAndSort(
parameters.westIndices,
function(a, b) {
return uvs[a].y - uvs[b].y;
}
);
const eastIndicesNorthToSouth = copyAndSort(
parameters.eastIndices,
function(a, b) {
return uvs[b].y - uvs[a].y;
}
);
const southIndicesEastToWest = copyAndSort(
parameters.southIndices,
function(a, b) {
return uvs[b].x - uvs[a].x;
}
);
const northIndicesWestToEast = copyAndSort(
parameters.northIndices,
function(a, b) {
return uvs[a].x - uvs[b].x;
}
);
let occludeePointInScaledSpace;
if (minimumHeight < 0) {
const occluder = new EllipsoidalOccluder_default(ellipsoid);
occludeePointInScaledSpace = occluder.computeHorizonCullingPointPossiblyUnderEllipsoid(
center,
positions,
minimumHeight
);
}
let hMin = minimumHeight;
hMin = Math.min(
hMin,
findMinMaxSkirts(
parameters.westIndices,
parameters.westSkirtHeight,
heights,
uvs,
rectangle,
ellipsoid,
toENU,
minimum,
maximum
)
);
hMin = Math.min(
hMin,
findMinMaxSkirts(
parameters.southIndices,
parameters.southSkirtHeight,
heights,
uvs,
rectangle,
ellipsoid,
toENU,
minimum,
maximum
)
);
hMin = Math.min(
hMin,
findMinMaxSkirts(
parameters.eastIndices,
parameters.eastSkirtHeight,
heights,
uvs,
rectangle,
ellipsoid,
toENU,
minimum,
maximum
)
);
hMin = Math.min(
hMin,
findMinMaxSkirts(
parameters.northIndices,
parameters.northSkirtHeight,
heights,
uvs,
rectangle,
ellipsoid,
toENU,
minimum,
maximum
)
);
const aaBox = new AxisAlignedBoundingBox_default(minimum, maximum, center);
const encoding = new TerrainEncoding_default(
center,
aaBox,
hMin,
maximumHeight,
fromENU,
hasVertexNormals,
includeWebMercatorT,
includeGeodeticSurfaceNormals,
exaggeration,
exaggerationRelativeHeight
);
const vertexStride = encoding.stride;
const size = quantizedVertexCount * vertexStride + edgeVertexCount * vertexStride;
const vertexBuffer = new Float32Array(size);
let bufferIndex = 0;
for (let j = 0; j < quantizedVertexCount; ++j) {
if (hasVertexNormals) {
const n = j * 2;
toPack.x = octEncodedNormals[n];
toPack.y = octEncodedNormals[n + 1];
}
bufferIndex = encoding.encode(
vertexBuffer,
bufferIndex,
positions[j],
uvs[j],
heights[j],
toPack,
webMercatorTs[j],
geodeticSurfaceNormals[j]
);
}
const edgeTriangleCount = Math.max(0, (edgeVertexCount - 4) * 2);
const indexBufferLength = parameters.indices.length + edgeTriangleCount * 3;
const indexBuffer = IndexDatatype_default.createTypedArray(
quantizedVertexCount + edgeVertexCount,
indexBufferLength
);
indexBuffer.set(parameters.indices, 0);
const percentage = 1e-4;
const lonOffset = (maxLongitude - minLongitude) * percentage;
const latOffset = (maxLatitude - minLatitude) * percentage;
const westLongitudeOffset = -lonOffset;
const westLatitudeOffset = 0;
const eastLongitudeOffset = lonOffset;
const eastLatitudeOffset = 0;
const northLongitudeOffset = 0;
const northLatitudeOffset = latOffset;
const southLongitudeOffset = 0;
const southLatitudeOffset = -latOffset;
let vertexBufferIndex = quantizedVertexCount * vertexStride;
addSkirt(
vertexBuffer,
vertexBufferIndex,
westIndicesSouthToNorth,
encoding,
heights,
uvs,
octEncodedNormals,
ellipsoid,
rectangle,
parameters.westSkirtHeight,
southMercatorY,
oneOverMercatorHeight,
westLongitudeOffset,
westLatitudeOffset
);
vertexBufferIndex += parameters.westIndices.length * vertexStride;
addSkirt(
vertexBuffer,
vertexBufferIndex,
southIndicesEastToWest,
encoding,
heights,
uvs,
octEncodedNormals,
ellipsoid,
rectangle,
parameters.southSkirtHeight,
southMercatorY,
oneOverMercatorHeight,
southLongitudeOffset,
southLatitudeOffset
);
vertexBufferIndex += parameters.southIndices.length * vertexStride;
addSkirt(
vertexBuffer,
vertexBufferIndex,
eastIndicesNorthToSouth,
encoding,
heights,
uvs,
octEncodedNormals,
ellipsoid,
rectangle,
parameters.eastSkirtHeight,
southMercatorY,
oneOverMercatorHeight,
eastLongitudeOffset,
eastLatitudeOffset
);
vertexBufferIndex += parameters.eastIndices.length * vertexStride;
addSkirt(
vertexBuffer,
vertexBufferIndex,
northIndicesWestToEast,
encoding,
heights,
uvs,
octEncodedNormals,
ellipsoid,
rectangle,
parameters.northSkirtHeight,
southMercatorY,
oneOverMercatorHeight,
northLongitudeOffset,
northLatitudeOffset
);
TerrainProvider_default.addSkirtIndices(
westIndicesSouthToNorth,
southIndicesEastToWest,
eastIndicesNorthToSouth,
northIndicesWestToEast,
quantizedVertexCount,
indexBuffer,
parameters.indices.length
);
transferableObjects.push(vertexBuffer.buffer, indexBuffer.buffer);
return {
vertices: vertexBuffer.buffer,
indices: indexBuffer.buffer,
westIndicesSouthToNorth,
southIndicesEastToWest,
eastIndicesNorthToSouth,
northIndicesWestToEast,
vertexStride,
center,
minimumHeight,
maximumHeight,
occludeePointInScaledSpace,
encoding,
indexCountWithoutSkirts: parameters.indices.length
};
}
function findMinMaxSkirts(edgeIndices, edgeHeight, heights, uvs, rectangle, ellipsoid, toENU, minimum, maximum) {
let hMin = Number.POSITIVE_INFINITY;
const north = rectangle.north;
const south = rectangle.south;
let east = rectangle.east;
const west = rectangle.west;
if (east < west) {
east += Math_default.TWO_PI;
}
const length = edgeIndices.length;
for (let i = 0; i < length; ++i) {
const index = edgeIndices[i];
const h = heights[index];
const uv = uvs[index];
cartographicScratch.longitude = Math_default.lerp(west, east, uv.x);
cartographicScratch.latitude = Math_default.lerp(south, north, uv.y);
cartographicScratch.height = h - edgeHeight;
const position = ellipsoid.cartographicToCartesian(
cartographicScratch,
cartesian3Scratch
);
Matrix4_default.multiplyByPoint(toENU, position, position);
Cartesian3_default.minimumByComponent(position, minimum, minimum);
Cartesian3_default.maximumByComponent(position, maximum, maximum);
hMin = Math.min(hMin, cartographicScratch.height);
}
return hMin;
}
function addSkirt(vertexBuffer, vertexBufferIndex, edgeVertices, encoding, heights, uvs, octEncodedNormals, ellipsoid, rectangle, skirtLength, southMercatorY, oneOverMercatorHeight, longitudeOffset, latitudeOffset) {
const hasVertexNormals = defined_default(octEncodedNormals);
const north = rectangle.north;
const south = rectangle.south;
let east = rectangle.east;
const west = rectangle.west;
if (east < west) {
east += Math_default.TWO_PI;
}
const length = edgeVertices.length;
for (let i = 0; i < length; ++i) {
const index = edgeVertices[i];
const h = heights[index];
const uv = uvs[index];
cartographicScratch.longitude = Math_default.lerp(west, east, uv.x) + longitudeOffset;
cartographicScratch.latitude = Math_default.lerp(south, north, uv.y) + latitudeOffset;
cartographicScratch.height = h - skirtLength;
const position = ellipsoid.cartographicToCartesian(
cartographicScratch,
cartesian3Scratch
);
if (hasVertexNormals) {
const n = index * 2;
toPack.x = octEncodedNormals[n];
toPack.y = octEncodedNormals[n + 1];
}
let webMercatorT;
if (encoding.hasWebMercatorT) {
webMercatorT = (WebMercatorProjection_default.geodeticLatitudeToMercatorAngle(
cartographicScratch.latitude
) - southMercatorY) * oneOverMercatorHeight;
}
let geodeticSurfaceNormal;
if (encoding.hasGeodeticSurfaceNormals) {
geodeticSurfaceNormal = ellipsoid.geodeticSurfaceNormal(position);
}
vertexBufferIndex = encoding.encode(
vertexBuffer,
vertexBufferIndex,
position,
uv,
cartographicScratch.height,
toPack,
webMercatorT,
geodeticSurfaceNormal
);
}
}
function copyAndSort(typedArray, comparator) {
let copy;
if (typeof typedArray.slice === "function") {
copy = typedArray.slice();
if (typeof copy.sort !== "function") {
copy = void 0;
}
}
if (!defined_default(copy)) {
copy = Array.prototype.slice.call(typedArray);
}
copy.sort(comparator);
return copy;
}
var createVerticesFromQuantizedTerrainMesh_default = createTaskProcessorWorker_default(
createVerticesFromQuantizedTerrainMesh
);
export {
createVerticesFromQuantizedTerrainMesh_default as default
};
@@ -0,0 +1,487 @@
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.142.0
*
* 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 {
WallGeometryLibrary_default
} from "./chunk-DBOEKL43.js";
import "./chunk-QRWGUWI6.js";
import "./chunk-6YEE6JDR.js";
import {
VertexFormat_default
} from "./chunk-VQYETPWC.js";
import "./chunk-CFQP6LYM.js";
import "./chunk-54I6Y66F.js";
import "./chunk-3VFEWOBI.js";
import "./chunk-E7VQ76KE.js";
import {
IndexDatatype_default
} from "./chunk-S4MCOY6I.js";
import {
GeometryAttributes_default
} from "./chunk-KSSWJIZW.js";
import {
GeometryAttribute_default,
Geometry_default,
PrimitiveType_default
} from "./chunk-EBSIOBXY.js";
import {
BoundingSphere_default
} from "./chunk-XZMBNNDX.js";
import "./chunk-C6J67V5A.js";
import "./chunk-MYP774IS.js";
import "./chunk-Q3PY526V.js";
import {
ComponentDatatype_default
} from "./chunk-P3CK7MCY.js";
import "./chunk-TKKIREQ6.js";
import "./chunk-Y5BF6AFU.js";
import {
Ellipsoid_default
} from "./chunk-V7VQKN6N.js";
import {
Cartesian3_default,
Frozen_default
} from "./chunk-MPZHGZU6.js";
import {
Math_default
} from "./chunk-J6BWOHUF.js";
import {
DeveloperError_default
} from "./chunk-AYKR4VBR.js";
import {
defined_default
} from "./chunk-ZP7JMQV4.js";
// packages/engine/Source/Core/WallGeometry.js
var scratchCartesian3Position1 = new Cartesian3_default();
var scratchCartesian3Position2 = new Cartesian3_default();
var scratchCartesian3Position4 = new Cartesian3_default();
var scratchCartesian3Position5 = new Cartesian3_default();
var scratchBitangent = new Cartesian3_default();
var scratchTangent = new Cartesian3_default();
var scratchNormal = new Cartesian3_default();
function WallGeometry(options) {
options = options ?? Frozen_default.EMPTY_OBJECT;
const wallPositions = options.positions;
const maximumHeights = options.maximumHeights;
const minimumHeights = options.minimumHeights;
if (!defined_default(wallPositions)) {
throw new DeveloperError_default("options.positions is required.");
}
if (defined_default(maximumHeights) && maximumHeights.length !== wallPositions.length) {
throw new DeveloperError_default(
"options.positions and options.maximumHeights must have the same length."
);
}
if (defined_default(minimumHeights) && minimumHeights.length !== wallPositions.length) {
throw new DeveloperError_default(
"options.positions and options.minimumHeights must have the same length."
);
}
const vertexFormat = options.vertexFormat ?? VertexFormat_default.DEFAULT;
const granularity = options.granularity ?? Math_default.RADIANS_PER_DEGREE;
const ellipsoid = options.ellipsoid ?? Ellipsoid_default.default;
this._positions = wallPositions;
this._minimumHeights = minimumHeights;
this._maximumHeights = maximumHeights;
this._vertexFormat = VertexFormat_default.clone(vertexFormat);
this._granularity = granularity;
this._ellipsoid = Ellipsoid_default.clone(ellipsoid);
this._workerName = "createWallGeometry";
let numComponents = 1 + wallPositions.length * Cartesian3_default.packedLength + 2;
if (defined_default(minimumHeights)) {
numComponents += minimumHeights.length;
}
if (defined_default(maximumHeights)) {
numComponents += maximumHeights.length;
}
this.packedLength = numComponents + Ellipsoid_default.packedLength + VertexFormat_default.packedLength + 1;
}
WallGeometry.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 = startingIndex ?? 0;
let i;
const positions = value._positions;
let length = positions.length;
array[startingIndex++] = length;
for (i = 0; i < length; ++i, startingIndex += Cartesian3_default.packedLength) {
Cartesian3_default.pack(positions[i], array, startingIndex);
}
const minimumHeights = value._minimumHeights;
length = defined_default(minimumHeights) ? minimumHeights.length : 0;
array[startingIndex++] = length;
if (defined_default(minimumHeights)) {
for (i = 0; i < length; ++i) {
array[startingIndex++] = minimumHeights[i];
}
}
const maximumHeights = value._maximumHeights;
length = defined_default(maximumHeights) ? maximumHeights.length : 0;
array[startingIndex++] = length;
if (defined_default(maximumHeights)) {
for (i = 0; i < length; ++i) {
array[startingIndex++] = maximumHeights[i];
}
}
Ellipsoid_default.pack(value._ellipsoid, array, startingIndex);
startingIndex += Ellipsoid_default.packedLength;
VertexFormat_default.pack(value._vertexFormat, array, startingIndex);
startingIndex += VertexFormat_default.packedLength;
array[startingIndex] = value._granularity;
return array;
};
var scratchEllipsoid = Ellipsoid_default.clone(Ellipsoid_default.UNIT_SPHERE);
var scratchVertexFormat = new VertexFormat_default();
var scratchOptions = {
positions: void 0,
minimumHeights: void 0,
maximumHeights: void 0,
ellipsoid: scratchEllipsoid,
vertexFormat: scratchVertexFormat,
granularity: void 0
};
WallGeometry.unpack = function(array, startingIndex, result) {
if (!defined_default(array)) {
throw new DeveloperError_default("array is required");
}
startingIndex = startingIndex ?? 0;
let i;
let length = array[startingIndex++];
const positions = new Array(length);
for (i = 0; i < length; ++i, startingIndex += Cartesian3_default.packedLength) {
positions[i] = Cartesian3_default.unpack(array, startingIndex);
}
length = array[startingIndex++];
let minimumHeights;
if (length > 0) {
minimumHeights = new Array(length);
for (i = 0; i < length; ++i) {
minimumHeights[i] = array[startingIndex++];
}
}
length = array[startingIndex++];
let maximumHeights;
if (length > 0) {
maximumHeights = new Array(length);
for (i = 0; i < length; ++i) {
maximumHeights[i] = array[startingIndex++];
}
}
const ellipsoid = Ellipsoid_default.unpack(array, startingIndex, scratchEllipsoid);
startingIndex += Ellipsoid_default.packedLength;
const vertexFormat = VertexFormat_default.unpack(
array,
startingIndex,
scratchVertexFormat
);
startingIndex += VertexFormat_default.packedLength;
const granularity = array[startingIndex];
if (!defined_default(result)) {
scratchOptions.positions = positions;
scratchOptions.minimumHeights = minimumHeights;
scratchOptions.maximumHeights = maximumHeights;
scratchOptions.granularity = granularity;
return new WallGeometry(scratchOptions);
}
result._positions = positions;
result._minimumHeights = minimumHeights;
result._maximumHeights = maximumHeights;
result._ellipsoid = Ellipsoid_default.clone(ellipsoid, result._ellipsoid);
result._vertexFormat = VertexFormat_default.clone(vertexFormat, result._vertexFormat);
result._granularity = granularity;
return result;
};
WallGeometry.fromConstantHeights = function(options) {
options = options ?? Frozen_default.EMPTY_OBJECT;
const positions = options.positions;
if (!defined_default(positions)) {
throw new DeveloperError_default("options.positions is required.");
}
let minHeights;
let maxHeights;
const min = options.minimumHeight;
const max = options.maximumHeight;
const doMin = defined_default(min);
const doMax = defined_default(max);
if (doMin || doMax) {
const length = positions.length;
minHeights = doMin ? new Array(length) : void 0;
maxHeights = doMax ? new Array(length) : void 0;
for (let i = 0; i < length; ++i) {
if (doMin) {
minHeights[i] = min;
}
if (doMax) {
maxHeights[i] = max;
}
}
}
const newOptions = {
positions,
maximumHeights: maxHeights,
minimumHeights: minHeights,
ellipsoid: options.ellipsoid,
vertexFormat: options.vertexFormat
};
return new WallGeometry(newOptions);
};
WallGeometry.createGeometry = function(wallGeometry) {
const wallPositions = wallGeometry._positions;
const minimumHeights = wallGeometry._minimumHeights;
const maximumHeights = wallGeometry._maximumHeights;
const vertexFormat = wallGeometry._vertexFormat;
const granularity = wallGeometry._granularity;
const ellipsoid = wallGeometry._ellipsoid;
const pos = WallGeometryLibrary_default.computePositions(
ellipsoid,
wallPositions,
maximumHeights,
minimumHeights,
granularity,
true
);
if (!defined_default(pos)) {
return;
}
const bottomPositions = pos.bottomPositions;
const topPositions = pos.topPositions;
const numCorners = pos.numCorners;
let length = topPositions.length;
let size = length * 2;
const positions = vertexFormat.position ? new Float64Array(size) : void 0;
const normals = vertexFormat.normal ? new Float32Array(size) : void 0;
const tangents = vertexFormat.tangent ? new Float32Array(size) : void 0;
const bitangents = vertexFormat.bitangent ? new Float32Array(size) : void 0;
const textureCoordinates = vertexFormat.st ? new Float32Array(size / 3 * 2) : void 0;
let positionIndex = 0;
let normalIndex = 0;
let bitangentIndex = 0;
let tangentIndex = 0;
let stIndex = 0;
let normal = scratchNormal;
let tangent = scratchTangent;
let bitangent = scratchBitangent;
let recomputeNormal = true;
length /= 3;
let i;
let s = 0;
const ds = 1 / (length - numCorners - 1);
for (i = 0; i < length; ++i) {
const i3 = i * 3;
const topPosition = Cartesian3_default.fromArray(
topPositions,
i3,
scratchCartesian3Position1
);
const bottomPosition = Cartesian3_default.fromArray(
bottomPositions,
i3,
scratchCartesian3Position2
);
if (vertexFormat.position) {
positions[positionIndex++] = bottomPosition.x;
positions[positionIndex++] = bottomPosition.y;
positions[positionIndex++] = bottomPosition.z;
positions[positionIndex++] = topPosition.x;
positions[positionIndex++] = topPosition.y;
positions[positionIndex++] = topPosition.z;
}
if (vertexFormat.st) {
textureCoordinates[stIndex++] = s;
textureCoordinates[stIndex++] = 0;
textureCoordinates[stIndex++] = s;
textureCoordinates[stIndex++] = 1;
}
if (vertexFormat.normal || vertexFormat.tangent || vertexFormat.bitangent) {
let nextTop = Cartesian3_default.clone(
Cartesian3_default.ZERO,
scratchCartesian3Position5
);
const groundPosition = Cartesian3_default.subtract(
topPosition,
ellipsoid.geodeticSurfaceNormal(
topPosition,
scratchCartesian3Position2
),
scratchCartesian3Position2
);
if (i + 1 < length) {
nextTop = Cartesian3_default.fromArray(
topPositions,
i3 + 3,
scratchCartesian3Position5
);
}
if (recomputeNormal) {
const scalednextPosition = Cartesian3_default.subtract(
nextTop,
topPosition,
scratchCartesian3Position4
);
const scaledGroundPosition = Cartesian3_default.subtract(
groundPosition,
topPosition,
scratchCartesian3Position1
);
normal = Cartesian3_default.normalize(
Cartesian3_default.cross(scaledGroundPosition, scalednextPosition, normal),
normal
);
recomputeNormal = false;
}
if (Cartesian3_default.equalsEpsilon(topPosition, nextTop, Math_default.EPSILON10)) {
recomputeNormal = true;
} else {
s += ds;
if (vertexFormat.tangent) {
tangent = Cartesian3_default.normalize(
Cartesian3_default.subtract(nextTop, topPosition, tangent),
tangent
);
}
if (vertexFormat.bitangent) {
bitangent = Cartesian3_default.normalize(
Cartesian3_default.cross(normal, tangent, bitangent),
bitangent
);
}
}
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) {
bitangents[bitangentIndex++] = bitangent.x;
bitangents[bitangentIndex++] = bitangent.y;
bitangents[bitangentIndex++] = bitangent.z;
bitangents[bitangentIndex++] = bitangent.x;
bitangents[bitangentIndex++] = bitangent.y;
bitangents[bitangentIndex++] = bitangent.z;
}
}
}
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: textureCoordinates
});
}
const numVertices = size / 3;
size -= 6 * (numCorners + 1);
const indices = IndexDatatype_default.createTypedArray(numVertices, size);
let edgeIndex = 0;
for (i = 0; i < numVertices - 2; i += 2) {
const LL = i;
const LR = i + 2;
const pl = Cartesian3_default.fromArray(
positions,
LL * 3,
scratchCartesian3Position1
);
const pr = Cartesian3_default.fromArray(
positions,
LR * 3,
scratchCartesian3Position2
);
if (Cartesian3_default.equalsEpsilon(pl, pr, Math_default.EPSILON10)) {
continue;
}
const UL = i + 1;
const UR = i + 3;
indices[edgeIndex++] = UL;
indices[edgeIndex++] = LL;
indices[edgeIndex++] = UR;
indices[edgeIndex++] = UR;
indices[edgeIndex++] = LL;
indices[edgeIndex++] = LR;
}
return new Geometry_default({
attributes,
indices,
primitiveType: PrimitiveType_default.TRIANGLES,
boundingSphere: BoundingSphere_default.fromVertices(positions)
});
};
var WallGeometry_default = WallGeometry;
// packages/engine/Source/Workers/createWallGeometry.js
function createWallGeometry(wallGeometry, offset) {
if (defined_default(offset)) {
wallGeometry = WallGeometry_default.unpack(wallGeometry, offset);
}
wallGeometry._ellipsoid = Ellipsoid_default.clone(wallGeometry._ellipsoid);
return WallGeometry_default.createGeometry(wallGeometry);
}
var createWallGeometry_default = createWallGeometry;
export {
createWallGeometry_default as default
};
@@ -0,0 +1,335 @@
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.142.0
*
* 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 {
WallGeometryLibrary_default
} from "./chunk-DBOEKL43.js";
import "./chunk-QRWGUWI6.js";
import "./chunk-6YEE6JDR.js";
import "./chunk-CFQP6LYM.js";
import "./chunk-54I6Y66F.js";
import "./chunk-3VFEWOBI.js";
import "./chunk-E7VQ76KE.js";
import {
IndexDatatype_default
} from "./chunk-S4MCOY6I.js";
import {
GeometryAttributes_default
} from "./chunk-KSSWJIZW.js";
import {
GeometryAttribute_default,
Geometry_default,
PrimitiveType_default
} from "./chunk-EBSIOBXY.js";
import {
BoundingSphere_default
} from "./chunk-XZMBNNDX.js";
import "./chunk-C6J67V5A.js";
import "./chunk-MYP774IS.js";
import "./chunk-Q3PY526V.js";
import {
ComponentDatatype_default
} from "./chunk-P3CK7MCY.js";
import "./chunk-TKKIREQ6.js";
import "./chunk-Y5BF6AFU.js";
import {
Ellipsoid_default
} from "./chunk-V7VQKN6N.js";
import {
Cartesian3_default,
Frozen_default
} from "./chunk-MPZHGZU6.js";
import {
Math_default
} from "./chunk-J6BWOHUF.js";
import {
DeveloperError_default
} from "./chunk-AYKR4VBR.js";
import {
defined_default
} from "./chunk-ZP7JMQV4.js";
// packages/engine/Source/Core/WallOutlineGeometry.js
var scratchCartesian3Position1 = new Cartesian3_default();
var scratchCartesian3Position2 = new Cartesian3_default();
function WallOutlineGeometry(options) {
options = options ?? Frozen_default.EMPTY_OBJECT;
const wallPositions = options.positions;
const maximumHeights = options.maximumHeights;
const minimumHeights = options.minimumHeights;
if (!defined_default(wallPositions)) {
throw new DeveloperError_default("options.positions is required.");
}
if (defined_default(maximumHeights) && maximumHeights.length !== wallPositions.length) {
throw new DeveloperError_default(
"options.positions and options.maximumHeights must have the same length."
);
}
if (defined_default(minimumHeights) && minimumHeights.length !== wallPositions.length) {
throw new DeveloperError_default(
"options.positions and options.minimumHeights must have the same length."
);
}
const granularity = options.granularity ?? Math_default.RADIANS_PER_DEGREE;
const ellipsoid = options.ellipsoid ?? Ellipsoid_default.default;
this._positions = wallPositions;
this._minimumHeights = minimumHeights;
this._maximumHeights = maximumHeights;
this._granularity = granularity;
this._ellipsoid = Ellipsoid_default.clone(ellipsoid);
this._workerName = "createWallOutlineGeometry";
let numComponents = 1 + wallPositions.length * Cartesian3_default.packedLength + 2;
if (defined_default(minimumHeights)) {
numComponents += minimumHeights.length;
}
if (defined_default(maximumHeights)) {
numComponents += maximumHeights.length;
}
this.packedLength = numComponents + Ellipsoid_default.packedLength + 1;
}
WallOutlineGeometry.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 = startingIndex ?? 0;
let i;
const positions = value._positions;
let length = positions.length;
array[startingIndex++] = length;
for (i = 0; i < length; ++i, startingIndex += Cartesian3_default.packedLength) {
Cartesian3_default.pack(positions[i], array, startingIndex);
}
const minimumHeights = value._minimumHeights;
length = defined_default(minimumHeights) ? minimumHeights.length : 0;
array[startingIndex++] = length;
if (defined_default(minimumHeights)) {
for (i = 0; i < length; ++i) {
array[startingIndex++] = minimumHeights[i];
}
}
const maximumHeights = value._maximumHeights;
length = defined_default(maximumHeights) ? maximumHeights.length : 0;
array[startingIndex++] = length;
if (defined_default(maximumHeights)) {
for (i = 0; i < length; ++i) {
array[startingIndex++] = maximumHeights[i];
}
}
Ellipsoid_default.pack(value._ellipsoid, array, startingIndex);
startingIndex += Ellipsoid_default.packedLength;
array[startingIndex] = value._granularity;
return array;
};
var scratchEllipsoid = Ellipsoid_default.clone(Ellipsoid_default.UNIT_SPHERE);
var scratchOptions = {
positions: void 0,
minimumHeights: void 0,
maximumHeights: void 0,
ellipsoid: scratchEllipsoid,
granularity: void 0
};
WallOutlineGeometry.unpack = function(array, startingIndex, result) {
if (!defined_default(array)) {
throw new DeveloperError_default("array is required");
}
startingIndex = startingIndex ?? 0;
let i;
let length = array[startingIndex++];
const positions = new Array(length);
for (i = 0; i < length; ++i, startingIndex += Cartesian3_default.packedLength) {
positions[i] = Cartesian3_default.unpack(array, startingIndex);
}
length = array[startingIndex++];
let minimumHeights;
if (length > 0) {
minimumHeights = new Array(length);
for (i = 0; i < length; ++i) {
minimumHeights[i] = array[startingIndex++];
}
}
length = array[startingIndex++];
let maximumHeights;
if (length > 0) {
maximumHeights = new Array(length);
for (i = 0; i < length; ++i) {
maximumHeights[i] = array[startingIndex++];
}
}
const ellipsoid = Ellipsoid_default.unpack(array, startingIndex, scratchEllipsoid);
startingIndex += Ellipsoid_default.packedLength;
const granularity = array[startingIndex];
if (!defined_default(result)) {
scratchOptions.positions = positions;
scratchOptions.minimumHeights = minimumHeights;
scratchOptions.maximumHeights = maximumHeights;
scratchOptions.granularity = granularity;
return new WallOutlineGeometry(scratchOptions);
}
result._positions = positions;
result._minimumHeights = minimumHeights;
result._maximumHeights = maximumHeights;
result._ellipsoid = Ellipsoid_default.clone(ellipsoid, result._ellipsoid);
result._granularity = granularity;
return result;
};
WallOutlineGeometry.fromConstantHeights = function(options) {
options = options ?? Frozen_default.EMPTY_OBJECT;
const positions = options.positions;
if (!defined_default(positions)) {
throw new DeveloperError_default("options.positions is required.");
}
let minHeights;
let maxHeights;
const min = options.minimumHeight;
const max = options.maximumHeight;
const doMin = defined_default(min);
const doMax = defined_default(max);
if (doMin || doMax) {
const length = positions.length;
minHeights = doMin ? new Array(length) : void 0;
maxHeights = doMax ? new Array(length) : void 0;
for (let i = 0; i < length; ++i) {
if (doMin) {
minHeights[i] = min;
}
if (doMax) {
maxHeights[i] = max;
}
}
}
const newOptions = {
positions,
maximumHeights: maxHeights,
minimumHeights: minHeights,
ellipsoid: options.ellipsoid
};
return new WallOutlineGeometry(newOptions);
};
WallOutlineGeometry.createGeometry = function(wallGeometry) {
const wallPositions = wallGeometry._positions;
const minimumHeights = wallGeometry._minimumHeights;
const maximumHeights = wallGeometry._maximumHeights;
const granularity = wallGeometry._granularity;
const ellipsoid = wallGeometry._ellipsoid;
const pos = WallGeometryLibrary_default.computePositions(
ellipsoid,
wallPositions,
maximumHeights,
minimumHeights,
granularity,
false
);
if (!defined_default(pos)) {
return;
}
const bottomPositions = pos.bottomPositions;
const topPositions = pos.topPositions;
let length = topPositions.length;
let size = length * 2;
const positions = new Float64Array(size);
let positionIndex = 0;
length /= 3;
let i;
for (i = 0; i < length; ++i) {
const i3 = i * 3;
const topPosition = Cartesian3_default.fromArray(
topPositions,
i3,
scratchCartesian3Position1
);
const bottomPosition = Cartesian3_default.fromArray(
bottomPositions,
i3,
scratchCartesian3Position2
);
positions[positionIndex++] = bottomPosition.x;
positions[positionIndex++] = bottomPosition.y;
positions[positionIndex++] = bottomPosition.z;
positions[positionIndex++] = topPosition.x;
positions[positionIndex++] = topPosition.y;
positions[positionIndex++] = topPosition.z;
}
const attributes = new GeometryAttributes_default({
position: new GeometryAttribute_default({
componentDatatype: ComponentDatatype_default.DOUBLE,
componentsPerAttribute: 3,
values: positions
})
});
const numVertices = size / 3;
size = 2 * numVertices - 4 + numVertices;
const indices = IndexDatatype_default.createTypedArray(numVertices, size);
let edgeIndex = 0;
for (i = 0; i < numVertices - 2; i += 2) {
const LL = i;
const LR = i + 2;
const pl = Cartesian3_default.fromArray(
positions,
LL * 3,
scratchCartesian3Position1
);
const pr = Cartesian3_default.fromArray(
positions,
LR * 3,
scratchCartesian3Position2
);
if (Cartesian3_default.equalsEpsilon(pl, pr, Math_default.EPSILON10)) {
continue;
}
const UL = i + 1;
const UR = i + 3;
indices[edgeIndex++] = UL;
indices[edgeIndex++] = LL;
indices[edgeIndex++] = UL;
indices[edgeIndex++] = UR;
indices[edgeIndex++] = LL;
indices[edgeIndex++] = LR;
}
indices[edgeIndex++] = numVertices - 2;
indices[edgeIndex++] = numVertices - 1;
return new Geometry_default({
attributes,
indices,
primitiveType: PrimitiveType_default.LINES,
boundingSphere: BoundingSphere_default.fromVertices(positions)
});
};
var WallOutlineGeometry_default = WallOutlineGeometry;
// packages/engine/Source/Workers/createWallOutlineGeometry.js
function createWallOutlineGeometry(wallGeometry, offset) {
if (defined_default(offset)) {
wallGeometry = WallOutlineGeometry_default.unpack(wallGeometry, offset);
}
wallGeometry._ellipsoid = Ellipsoid_default.clone(wallGeometry._ellipsoid);
return WallOutlineGeometry_default.createGeometry(wallGeometry);
}
var createWallOutlineGeometry_default = createWallOutlineGeometry;
export {
createWallOutlineGeometry_default as default
};

Some files were not shown because too many files have changed in this diff Show More