196 lines
6.3 KiB
JavaScript
196 lines
6.3 KiB
JavaScript
|
/**
|
||
|
* @license
|
||
|
* Cesium - https://github.com/CesiumGS/cesium
|
||
|
* Version 1.117
|
||
|
*
|
||
|
* 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-A6NCZSL3.js";
|
||
|
import "./chunk-GIFJ77E4.js";
|
||
|
import "./chunk-AOIKO5Y7.js";
|
||
|
import "./chunk-PK7TEP3J.js";
|
||
|
import "./chunk-PS6AEMBR.js";
|
||
|
import "./chunk-AOFMPKUB.js";
|
||
|
import "./chunk-S4XDCPKD.js";
|
||
|
import {
|
||
|
VertexFormat_default
|
||
|
} from "./chunk-4KIUON73.js";
|
||
|
import "./chunk-G7CJQKKD.js";
|
||
|
import "./chunk-FOZQIHZK.js";
|
||
|
import "./chunk-WWP3I7R5.js";
|
||
|
import "./chunk-RL73GOEF.js";
|
||
|
import "./chunk-34DGOKCO.js";
|
||
|
import "./chunk-NI2R52QD.js";
|
||
|
import "./chunk-I5TDPPC4.js";
|
||
|
import "./chunk-TMMOULW3.js";
|
||
|
import {
|
||
|
Cartesian3_default,
|
||
|
Ellipsoid_default
|
||
|
} from "./chunk-C5CE4OG6.js";
|
||
|
import "./chunk-4PHPQRSH.js";
|
||
|
import "./chunk-PEABJLCK.js";
|
||
|
import "./chunk-WFICTTOE.js";
|
||
|
import {
|
||
|
defaultValue_default
|
||
|
} from "./chunk-UCPPWV64.js";
|
||
|
import {
|
||
|
Check_default
|
||
|
} from "./chunk-U4IMCOF5.js";
|
||
|
import {
|
||
|
defined_default
|
||
|
} from "./chunk-BDUJXBVF.js";
|
||
|
|
||
|
// packages/engine/Source/Core/CircleGeometry.js
|
||
|
function CircleGeometry(options) {
|
||
|
options = defaultValue_default(options, defaultValue_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.UNIT_SPHERE),
|
||
|
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.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
|
||
|
};
|