@cesium/engine 23.0.0 → 24.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Build/Workers/{chunk-QTOHIXGF.js → chunk-2N4KDHS3.js} +10 -10
- package/Build/Workers/{chunk-SQTRWKO2.js → chunk-44EMEGKW.js} +5 -5
- package/Build/Workers/{chunk-OHBM4YG4.js → chunk-4TIG36AW.js} +12 -12
- package/Build/Workers/{chunk-BNBD2YZK.js → chunk-5A2SW66E.js} +16 -16
- package/Build/Workers/{chunk-52K3GJKG.js → chunk-5GXYJQ2K.js} +3 -3
- package/Build/Workers/{chunk-NQCAZU7S.js → chunk-63SIWPLS.js} +13 -13
- package/Build/Workers/{chunk-UEEGWJJP.js → chunk-6MPGQEHA.js} +2 -2
- package/Build/Workers/{chunk-PQVNT5CJ.js → chunk-6RMS4S72.js} +6 -6
- package/Build/Workers/{chunk-HYTFXWMY.js → chunk-6WLHJFD3.js} +7 -7
- package/Build/Workers/{chunk-DT5SJBKA.js → chunk-72VYSVEW.js} +9 -9
- package/Build/Workers/{chunk-JUGY5AZN.js → chunk-7MDYBRYJ.js} +4 -4
- package/Build/Workers/{chunk-6SLGTBB2.js → chunk-7O5XJTVE.js} +5 -5
- package/Build/Workers/{chunk-4UNQX2MP.js → chunk-7QRFIKWQ.js} +2 -2
- package/Build/Workers/{chunk-GN5NEUDT.js → chunk-7TYLCBGK.js} +8 -8
- package/Build/Workers/{chunk-SGKTBHFQ.js → chunk-7X322WP2.js} +13 -13
- package/Build/Workers/{chunk-T43FXHNC.js → chunk-A47HVBC5.js} +7 -7
- package/Build/Workers/{chunk-FSDVXW7M.js → chunk-AF3MU2RL.js} +5 -5
- package/Build/Workers/{chunk-3B65YFXC.js → chunk-AJLTU6PF.js} +1 -1
- package/Build/Workers/{chunk-OQ3EAJNW.js → chunk-AMIHNSST.js} +2 -2
- package/Build/Workers/{chunk-N4AWE7TZ.js → chunk-B6SCUUFP.js} +10 -10
- package/Build/Workers/{chunk-OMXN7YF4.js → chunk-BJD6QGXZ.js} +12 -12
- package/Build/Workers/{chunk-APDKMX7W.js → chunk-C6P4IG5P.js} +6 -6
- package/Build/Workers/{chunk-QA24Q62E.js → chunk-D4EJ2NXG.js} +17 -17
- package/Build/Workers/{chunk-HYLEKKO5.js → chunk-DHKPFLSJ.js} +1 -1
- package/Build/Workers/{chunk-MQJG522T.js → chunk-DVB56LG7.js} +6 -6
- package/Build/Workers/{chunk-Y5AJSEEN.js → chunk-EDXL4W76.js} +2 -2
- package/Build/Workers/{chunk-QQX7S5QT.js → chunk-EV3VGO6Y.js} +17 -17
- package/Build/Workers/{chunk-IFA7VHHP.js → chunk-GOQBUCXH.js} +10 -10
- package/Build/Workers/{chunk-5A7YSAXT.js → chunk-GQUNK2XC.js} +14 -14
- package/Build/Workers/{chunk-36LBFITA.js → chunk-HKUES6UG.js} +12 -12
- package/Build/Workers/{chunk-OC6X22PG.js → chunk-HRHRYFHS.js} +9 -9
- package/Build/Workers/{chunk-L7RDJ4V7.js → chunk-HXJMS2ZI.js} +1 -1
- package/Build/Workers/{chunk-NAYRNPEP.js → chunk-ILMFADZA.js} +4 -4
- package/Build/Workers/{chunk-AA33B6PU.js → chunk-ISY4EZCA.js} +4 -4
- package/Build/Workers/{chunk-7KRN6JPQ.js → chunk-J6AW5YHS.js} +14 -14
- package/Build/Workers/{chunk-OQBPOKPZ.js → chunk-JCI63T3K.js} +6 -6
- package/Build/Workers/{chunk-2WI4HGJU.js → chunk-KLPGTXS3.js} +6 -6
- package/Build/Workers/{chunk-5R7SBUTW.js → chunk-LIB2H534.js} +10 -10
- package/Build/Workers/{chunk-IYVDOB5V.js → chunk-LXMCPFFS.js} +4 -4
- package/Build/Workers/{chunk-NUYLNQKV.js → chunk-MKM27KGV.js} +2 -2
- package/Build/Workers/{chunk-R7M4XNPP.js → chunk-N65BAKSH.js} +8 -8
- package/Build/Workers/{chunk-4LGFX2P5.js → chunk-NKT5K3K3.js} +11 -11
- package/Build/Workers/{chunk-NNHU33JK.js → chunk-NPF7SSHZ.js} +7 -7
- package/Build/Workers/{chunk-LDQWNMEC.js → chunk-PVV64VFW.js} +1 -1
- package/Build/Workers/{chunk-WKXDCVBO.js → chunk-Q3C6VQH6.js} +4 -4
- package/Build/Workers/{chunk-ARCFIOKA.js → chunk-RQNJD3O4.js} +12 -12
- package/Build/Workers/{chunk-G3YT7M7A.js → chunk-UIGVOKKI.js} +1 -1
- package/Build/Workers/{chunk-ZIW5FCIW.js → chunk-UQU4RXLT.js} +27 -19
- package/Build/Workers/{chunk-MT5M7RLZ.js → chunk-VLDEUTOP.js} +2 -2
- package/Build/Workers/{chunk-5JP5FG7U.js → chunk-VMVOUQ5J.js} +7 -7
- package/Build/Workers/{chunk-2GL2EUEE.js → chunk-XJRBB253.js} +11 -11
- package/Build/Workers/{chunk-ESD4IEOU.js → chunk-XY6HMDGI.js} +5 -5
- package/Build/Workers/{chunk-56OHFSLH.js → chunk-Y7HNNPNK.js} +10 -10
- package/Build/Workers/{chunk-6FVFM2KB.js → chunk-YAOZMOFL.js} +5 -5
- package/Build/Workers/{chunk-AP6XWET5.js → chunk-YJZGW74L.js} +8 -8
- package/Build/Workers/{chunk-KPYU6YZG.js → chunk-YQFTYQMZ.js} +1 -1
- package/Build/Workers/{chunk-5VKZVPO5.js → chunk-ZBZRTRJB.js} +10 -10
- package/Build/Workers/combineGeometry.js +24 -24
- package/Build/Workers/createBoxGeometry.js +18 -18
- package/Build/Workers/createBoxOutlineGeometry.js +16 -16
- package/Build/Workers/createCircleGeometry.js +26 -26
- package/Build/Workers/createCircleOutlineGeometry.js +19 -19
- package/Build/Workers/createCoplanarPolygonGeometry.js +33 -33
- package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +31 -31
- package/Build/Workers/createCorridorGeometry.js +29 -29
- package/Build/Workers/createCorridorOutlineGeometry.js +28 -28
- package/Build/Workers/createCylinderGeometry.js +20 -20
- package/Build/Workers/createCylinderOutlineGeometry.js +18 -18
- package/Build/Workers/createEllipseGeometry.js +26 -26
- package/Build/Workers/createEllipseOutlineGeometry.js +19 -19
- package/Build/Workers/createEllipsoidGeometry.js +19 -19
- package/Build/Workers/createEllipsoidOutlineGeometry.js +18 -18
- package/Build/Workers/createFrustumGeometry.js +18 -18
- package/Build/Workers/createFrustumOutlineGeometry.js +18 -18
- package/Build/Workers/createGeometry.js +24 -24
- package/Build/Workers/createGroundPolylineGeometry.js +22 -22
- package/Build/Workers/createPlaneGeometry.js +16 -16
- package/Build/Workers/createPlaneOutlineGeometry.js +15 -15
- package/Build/Workers/createPolygonGeometry.js +32 -32
- package/Build/Workers/createPolygonOutlineGeometry.js +30 -30
- package/Build/Workers/createPolylineGeometry.js +25 -25
- package/Build/Workers/createPolylineVolumeGeometry.js +31 -31
- package/Build/Workers/createPolylineVolumeOutlineGeometry.js +27 -27
- package/Build/Workers/createRectangleGeometry.js +27 -27
- package/Build/Workers/createRectangleOutlineGeometry.js +20 -20
- package/Build/Workers/createSimplePolylineGeometry.js +23 -23
- package/Build/Workers/createSphereGeometry.js +19 -19
- package/Build/Workers/createSphereOutlineGeometry.js +18 -18
- package/Build/Workers/createTaskProcessorWorker.js +3 -3
- package/Build/Workers/createVectorTileClampedPolylines.js +14 -14
- package/Build/Workers/createVectorTileGeometries.js +24 -24
- package/Build/Workers/createVectorTilePoints.js +13 -13
- package/Build/Workers/createVectorTilePolygons.js +22 -22
- package/Build/Workers/createVectorTilePolylines.js +14 -14
- package/Build/Workers/createVerticesFromCesium3DTilesTerrain.js +25 -25
- package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +22 -22
- package/Build/Workers/createVerticesFromHeightmap.js +22 -22
- package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +20 -20
- package/Build/Workers/createWallGeometry.js +25 -25
- package/Build/Workers/createWallOutlineGeometry.js +24 -24
- package/Build/Workers/decodeDraco.js +10 -10
- package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +5 -5
- package/Build/Workers/decodeI3S.js +12 -12
- package/Build/Workers/gaussianSplatSorter.js +4 -4
- package/Build/Workers/gaussianSplatTextureGenerator.js +4 -4
- package/Build/Workers/incrementallyBuildTerrainPicker.js +10 -10
- package/Build/Workers/transcodeKTX2.js +6 -6
- package/Build/Workers/transferTypedArrayTest.js +1 -1
- package/Build/Workers/upsampleQuantizedTerrainMesh.js +22 -22
- package/Build/Workers/upsampleVerticesFromCesium3DTilesTerrain.js +25 -25
- package/Source/Core/BoundingSphere.js +1 -1
- package/Source/Core/Cartesian2.js +7 -5
- package/Source/Core/Cartesian3.js +8 -6
- package/Source/Core/Cartesian4.js +8 -6
- package/Source/Core/Color.js +5 -3
- package/Source/Core/DeveloperError.js +2 -1
- package/Source/Core/ITwinPlatform.js +1 -0
- package/Source/Core/Ion.js +1 -1
- package/Source/Core/S2Cell.js +2 -2
- package/Source/Core/TerrainMesh.js +10 -1
- package/Source/Core/TerrainPicker.js +1 -0
- package/Source/Core/WallGeometry.js +1 -1
- package/Source/Core/WallOutlineGeometry.js +1 -1
- package/Source/Core/assert.js +27 -0
- package/Source/Core/globalTypes.js +4 -0
- package/Source/DataSources/CzmlDataSource.js +9 -0
- package/Source/DataSources/PathGraphics.js +13 -0
- package/Source/DataSources/PathVisualizer.js +330 -18
- package/Source/DataSources/StaticGeometryColorBatch.js +7 -2
- package/Source/DataSources/StaticGeometryPerMaterialBatch.js +7 -2
- package/Source/DataSources/StaticGroundGeometryPerMaterialBatch.js +3 -1
- package/Source/DataSources/StaticGroundPolylinePerMaterialBatch.js +3 -1
- package/Source/Renderer/Context.js +1 -1
- package/Source/Renderer/RenderState.js +2 -2
- package/Source/Renderer/VertexArray.js +80 -0
- package/Source/Scene/ArcGisMapService.js +1 -1
- package/Source/Scene/BillboardCollection.js +65 -364
- package/Source/Scene/BufferPoint.js +148 -0
- package/Source/Scene/BufferPointCollection.js +135 -0
- package/Source/Scene/BufferPointMaterial.js +95 -0
- package/Source/Scene/BufferPolygon.js +516 -0
- package/Source/Scene/BufferPolygonCollection.js +368 -0
- package/Source/Scene/BufferPolygonMaterial.js +41 -0
- package/Source/Scene/BufferPolyline.js +185 -0
- package/Source/Scene/BufferPolylineCollection.js +136 -0
- package/Source/Scene/BufferPolylineMaterial.js +93 -0
- package/Source/Scene/BufferPrimitive.js +347 -0
- package/Source/Scene/BufferPrimitiveCollection.js +702 -0
- package/Source/Scene/BufferPrimitiveMaterial.js +140 -0
- package/Source/Scene/Cesium3DTileContent.js +5 -1
- package/Source/Scene/Cesium3DTileContentFactory.js +9 -0
- package/Source/Scene/Cesium3DTileStyle.js +22 -0
- package/Source/Scene/Cesium3DTileset.js +1 -0
- package/Source/Scene/ClippingPolygonCollection.js +270 -101
- package/Source/Scene/CubeMapPanorama.js +4 -4
- package/Source/Scene/GaussianSplat3DTileContent.js +40 -46
- package/Source/Scene/GaussianSplatPrimitive.js +413 -70
- package/Source/Scene/GetFeatureInfoFormat.js +3 -3
- package/Source/Scene/GltfLoader.js +227 -34
- package/Source/Scene/GltfSpzLoader.js +109 -0
- package/Source/Scene/ITwinData.js +1 -0
- package/Source/Scene/Label.js +32 -0
- package/Source/Scene/LabelCollection.js +14 -13
- package/Source/Scene/Material.js +2 -0
- package/Source/Scene/Megatexture.js +1 -0
- package/Source/Scene/MetadataClassProperty.js +24 -10
- package/Source/Scene/MetadataComponentType.js +115 -23
- package/Source/Scene/Model/CustomShaderPipelineStage.js +3 -1
- package/Source/Scene/Model/EdgeVisibilityPipelineStage.js +761 -263
- package/Source/Scene/Model/MaterialPipelineStage.js +147 -0
- package/Source/Scene/Model/MetadataPipelineStage.js +3 -3
- package/Source/Scene/Model/ModelDrawCommand.js +6 -0
- package/Source/Scene/Model/ModelReader.js +1 -1
- package/Source/Scene/Model/ModelUtility.js +3 -1
- package/Source/Scene/Model/createVectorTileBuffersFromModelComponents.js +330 -0
- package/Source/Scene/ModelComponents.js +1632 -1542
- package/Source/Scene/PickedMetadataInfo.js +1 -0
- package/Source/Scene/ScreenSpaceCameraController.js +13 -0
- package/Source/Scene/SkyBox.js +17 -8
- package/Source/Scene/TileBoundingRegion.js +1 -1
- package/Source/Scene/TileBoundingS2Cell.js +1 -1
- package/Source/Scene/TileBoundingSphere.js +1 -1
- package/Source/Scene/TweenCollection.js +7 -0
- package/Source/Scene/VectorGltf3DTileContent.js +382 -0
- package/Source/Scene/VertexAttributeSemantic.js +14 -0
- package/Source/Scene/WebMapServiceImageryProvider.js +2 -2
- package/Source/Scene/WebMapTileServiceImageryProvider.js +366 -131
- package/Source/Scene/parseStructuralMetadata.js +97 -37
- package/Source/Scene/renderBufferPointCollection.js +334 -0
- package/Source/Scene/renderBufferPolygonCollection.js +386 -0
- package/Source/Scene/renderBufferPolylineCollection.js +529 -0
- package/Source/Shaders/BillboardCollectionFS.glsl +2 -77
- package/Source/Shaders/BillboardCollectionFS.js +2 -77
- package/Source/Shaders/BillboardCollectionVS.glsl +2 -60
- package/Source/Shaders/BillboardCollectionVS.js +2 -60
- package/Source/Shaders/BufferPointMaterialFS.glsl +27 -0
- package/Source/Shaders/BufferPointMaterialFS.js +29 -0
- package/Source/Shaders/BufferPointMaterialVS.glsl +48 -0
- package/Source/Shaders/BufferPointMaterialVS.js +50 -0
- package/Source/Shaders/BufferPolygonMaterialFS.glsl +13 -0
- package/Source/Shaders/BufferPolygonMaterialFS.js +15 -0
- package/Source/Shaders/BufferPolygonMaterialVS.glsl +30 -0
- package/Source/Shaders/BufferPolygonMaterialVS.js +32 -0
- package/Source/Shaders/BufferPolylineMaterialFS.glsl +13 -0
- package/Source/Shaders/BufferPolylineMaterialFS.js +15 -0
- package/Source/Shaders/BufferPolylineMaterialVS.glsl +49 -0
- package/Source/Shaders/BufferPolylineMaterialVS.js +51 -0
- package/Source/Shaders/Model/EdgeVisibilityStageFS.glsl +34 -48
- package/Source/Shaders/Model/EdgeVisibilityStageFS.js +34 -49
- package/Source/Shaders/Model/EdgeVisibilityStageVS.glsl +98 -0
- package/Source/Shaders/Model/EdgeVisibilityStageVS.js +100 -0
- package/Source/Shaders/Model/ModelFS.glsl +15 -0
- package/Source/Shaders/Model/ModelFS.js +15 -0
- package/Source/Shaders/Model/ModelVS.glsl +8 -0
- package/Source/Shaders/Model/ModelVS.js +8 -0
- package/Source/Shaders/PolygonSignedDistanceFS.glsl +64 -33
- package/Source/Shaders/PolygonSignedDistanceFS.js +64 -33
- package/Source/Shaders/PrimitiveGaussianSplatVS.glsl +9 -2
- package/Source/Shaders/PrimitiveGaussianSplatVS.js +9 -2
- package/Source/Shaders/Voxels/VoxelFS.glsl +1 -1
- package/Source/Shaders/Voxels/VoxelFS.js +1 -1
- package/Source/Workers/decodeDraco.js +3 -0
- package/Source/Workers/decodeI3S.js +5 -2
- package/index.d.ts +1007 -111
- package/index.js +368 -343
- package/package.json +2 -2
package/Source/Core/S2Cell.js
CHANGED
|
@@ -376,7 +376,7 @@ S2Cell.prototype.getCenter = function (ellipsoid) {
|
|
|
376
376
|
let center = getS2Center(this._cellId, this._level);
|
|
377
377
|
// Normalize XYZ.
|
|
378
378
|
center = Cartesian3.normalize(center, center);
|
|
379
|
-
const cartographic =
|
|
379
|
+
const cartographic = Cartographic.fromCartesian(
|
|
380
380
|
center,
|
|
381
381
|
Ellipsoid.UNIT_SPHERE,
|
|
382
382
|
);
|
|
@@ -405,7 +405,7 @@ S2Cell.prototype.getVertex = function (index, ellipsoid) {
|
|
|
405
405
|
let vertex = getS2Vertex(this._cellId, this._level, index);
|
|
406
406
|
// Normalize XYZ.
|
|
407
407
|
vertex = Cartesian3.normalize(vertex, vertex);
|
|
408
|
-
const cartographic =
|
|
408
|
+
const cartographic = Cartographic.fromCartesian(
|
|
409
409
|
vertex,
|
|
410
410
|
Ellipsoid.UNIT_SPHERE,
|
|
411
411
|
);
|
|
@@ -3,6 +3,7 @@ import Cartesian3 from "./Cartesian3.js";
|
|
|
3
3
|
import Cartographic from "./Cartographic.js";
|
|
4
4
|
import defined from "./defined.js";
|
|
5
5
|
import Ellipsoid from "./Ellipsoid.js";
|
|
6
|
+
import CesiumMath from "./Math.js";
|
|
6
7
|
import Matrix4 from "./Matrix4.js";
|
|
7
8
|
import OrientedBoundingBox from "./OrientedBoundingBox.js";
|
|
8
9
|
import TerrainPicker from "./TerrainPicker.js";
|
|
@@ -235,7 +236,14 @@ function computeTransform(mesh, result) {
|
|
|
235
236
|
mesh.orientedBoundingBox,
|
|
236
237
|
);
|
|
237
238
|
|
|
238
|
-
|
|
239
|
+
OrientedBoundingBox.computeTransformation(obb, result);
|
|
240
|
+
const zScale = Matrix4.getScale(result, scratchScale).z;
|
|
241
|
+
if (zScale <= CesiumMath.EPSILON16) {
|
|
242
|
+
scratchScale.z = 1.0;
|
|
243
|
+
Matrix4.setScale(result, scratchScale, result);
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
return result;
|
|
239
247
|
}
|
|
240
248
|
|
|
241
249
|
const scratchSWCartesian = new Cartesian3();
|
|
@@ -244,6 +252,7 @@ const scratchSWCartographic = new Cartographic();
|
|
|
244
252
|
const scratchNECartographic = new Cartographic();
|
|
245
253
|
const scratchScale2D = new Cartesian3();
|
|
246
254
|
const scratchCenter2D = new Cartesian3();
|
|
255
|
+
const scratchScale = new Cartesian3();
|
|
247
256
|
|
|
248
257
|
/**
|
|
249
258
|
* Get the terrain tile's model-to-world transform matrix for 2D or Columbus View modes.
|
|
@@ -73,6 +73,7 @@ const incrementallyBuildTerrainPickerTaskProcessor = new TaskProcessor(
|
|
|
73
73
|
Object.defineProperties(TerrainPicker.prototype, {
|
|
74
74
|
/**
|
|
75
75
|
* Indicates whether the terrain picker needs to be rebuilt due to changes in the underlying terrain mesh's vertices or indices.
|
|
76
|
+
* @memberof TerrainPicker.prototype
|
|
76
77
|
* @type {boolean}
|
|
77
78
|
*/
|
|
78
79
|
needsRebuild: {
|
|
@@ -617,7 +617,7 @@ WallGeometry.createGeometry = function (wallGeometry) {
|
|
|
617
617
|
attributes: attributes,
|
|
618
618
|
indices: indices,
|
|
619
619
|
primitiveType: PrimitiveType.TRIANGLES,
|
|
620
|
-
boundingSphere:
|
|
620
|
+
boundingSphere: BoundingSphere.fromVertices(positions),
|
|
621
621
|
});
|
|
622
622
|
};
|
|
623
623
|
export default WallGeometry;
|
|
@@ -425,7 +425,7 @@ WallOutlineGeometry.createGeometry = function (wallGeometry) {
|
|
|
425
425
|
attributes: attributes,
|
|
426
426
|
indices: indices,
|
|
427
427
|
primitiveType: PrimitiveType.LINES,
|
|
428
|
-
boundingSphere:
|
|
428
|
+
boundingSphere: BoundingSphere.fromVertices(positions),
|
|
429
429
|
});
|
|
430
430
|
};
|
|
431
431
|
export default WallOutlineGeometry;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
|
|
3
|
+
import DeveloperError from "./DeveloperError.js";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Checks that a condition is truthy, throwing a specified message if condition
|
|
7
|
+
* fails. The `asserts condition` return type allows TypeScript to narrow the
|
|
8
|
+
* types of the condition and enforce stricter types without further if/else
|
|
9
|
+
* checks or nullish coalescing.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* assert(object.optionalProperty, 'Missing .optionalProperty');
|
|
13
|
+
* object.optionalProperty.toString(); // safe; no type error.
|
|
14
|
+
*
|
|
15
|
+
* @function
|
|
16
|
+
*
|
|
17
|
+
* @param {*} condition
|
|
18
|
+
* @param {string} msg
|
|
19
|
+
* @ignore
|
|
20
|
+
*/
|
|
21
|
+
function assert(condition, msg) {
|
|
22
|
+
if (!condition) {
|
|
23
|
+
throw new DeveloperError(msg);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export default assert;
|
|
@@ -8,6 +8,10 @@
|
|
|
8
8
|
* @typedef {Float64ArrayConstructor|Float32ArrayConstructor|Uint32ArrayConstructor|Uint16ArrayConstructor|Uint8ArrayConstructor|Int32ArrayConstructor|Int16ArrayConstructor|Int8ArrayConstructor} TypedArrayConstructor
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
+
/**
|
|
12
|
+
* @typedef {{destroy: Function}} Destroyable
|
|
13
|
+
*/
|
|
14
|
+
|
|
11
15
|
/**
|
|
12
16
|
* This file is omitted from 'workspaceSourceFiles' in 'scripts/build.js', and
|
|
13
17
|
* must provide type-only exports exclusively, without runtime values.
|
|
@@ -3645,6 +3645,15 @@ function processPath(entity, packet, entityCollection, sourceUri) {
|
|
|
3645
3645
|
sourceUri,
|
|
3646
3646
|
entityCollection,
|
|
3647
3647
|
);
|
|
3648
|
+
processPacketData(
|
|
3649
|
+
String,
|
|
3650
|
+
path,
|
|
3651
|
+
"relativeTo",
|
|
3652
|
+
pathData.relativeTo,
|
|
3653
|
+
interval,
|
|
3654
|
+
sourceUri,
|
|
3655
|
+
entityCollection,
|
|
3656
|
+
);
|
|
3648
3657
|
}
|
|
3649
3658
|
|
|
3650
3659
|
function processPoint(entity, packet, entityCollection, sourceUri) {
|
|
@@ -17,6 +17,7 @@ import createPropertyDescriptor from "./createPropertyDescriptor.js";
|
|
|
17
17
|
* @property {Property | number} [resolution=60] A numeric Property specifying the maximum number of seconds to step when sampling the position.
|
|
18
18
|
* @property {MaterialProperty | Color} [material=Color.WHITE] A Property specifying the material used to draw the path.
|
|
19
19
|
* @property {Property | DistanceDisplayCondition} [distanceDisplayCondition] A Property specifying at what distance from the camera that this path will be displayed.
|
|
20
|
+
* @property {Property | string} [relativeTo] A Property specifying the frame in which to visualize the path. Use another entity's id to visualize the path relative to that entity, or use the string values "FIXED" or "INERTIAL" to visualize the path in those reference frames.
|
|
20
21
|
*/
|
|
21
22
|
|
|
22
23
|
/**
|
|
@@ -43,6 +44,8 @@ function PathGraphics(options) {
|
|
|
43
44
|
this._materialSubscription = undefined;
|
|
44
45
|
this._distanceDisplayCondition = undefined;
|
|
45
46
|
this._distanceDisplayConditionSubscription = undefined;
|
|
47
|
+
this._relativeTo = undefined;
|
|
48
|
+
this._relativeToSubscription = undefined;
|
|
46
49
|
|
|
47
50
|
this.merge(options ?? Frozen.EMPTY_OBJECT);
|
|
48
51
|
}
|
|
@@ -114,6 +117,14 @@ Object.defineProperties(PathGraphics.prototype, {
|
|
|
114
117
|
distanceDisplayCondition: createPropertyDescriptor(
|
|
115
118
|
"distanceDisplayCondition",
|
|
116
119
|
),
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Gets or sets the frame in which to visualize the path. Use another entity's id to visualize the path relative to that entity, or use the string values "FIXED" or "INERTIAL" to visualize the path in those reference frames.
|
|
123
|
+
* @memberof PathGraphics.prototype
|
|
124
|
+
* @type {Property|undefined}
|
|
125
|
+
* @experimental This feature is not final and is subject to change without Cesium's standard deprecation policy.
|
|
126
|
+
*/
|
|
127
|
+
relativeTo: createPropertyDescriptor("relativeTo"),
|
|
117
128
|
});
|
|
118
129
|
|
|
119
130
|
/**
|
|
@@ -133,6 +144,7 @@ PathGraphics.prototype.clone = function (result) {
|
|
|
133
144
|
result.resolution = this.resolution;
|
|
134
145
|
result.material = this.material;
|
|
135
146
|
result.distanceDisplayCondition = this.distanceDisplayCondition;
|
|
147
|
+
result.relativeTo = this.relativeTo;
|
|
136
148
|
return result;
|
|
137
149
|
};
|
|
138
150
|
|
|
@@ -157,5 +169,6 @@ PathGraphics.prototype.merge = function (source) {
|
|
|
157
169
|
this.material = this.material ?? source.material;
|
|
158
170
|
this.distanceDisplayCondition =
|
|
159
171
|
this.distanceDisplayCondition ?? source.distanceDisplayCondition;
|
|
172
|
+
this.relativeTo = this.relativeTo ?? source.relativeTo;
|
|
160
173
|
};
|
|
161
174
|
export default PathGraphics;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import AssociativeArray from "../Core/AssociativeArray.js";
|
|
2
2
|
import Cartesian3 from "../Core/Cartesian3.js";
|
|
3
|
+
import CesiumMath from "../Core/Math.js";
|
|
3
4
|
import defined from "../Core/defined.js";
|
|
4
5
|
import destroyObject from "../Core/destroyObject.js";
|
|
5
6
|
import DeveloperError from "../Core/DeveloperError.js";
|
|
7
|
+
import Entity from "./Entity.js";
|
|
6
8
|
import JulianDate from "../Core/JulianDate.js";
|
|
7
9
|
import Matrix3 from "../Core/Matrix3.js";
|
|
8
10
|
import Matrix4 from "../Core/Matrix4.js";
|
|
@@ -20,6 +22,183 @@ import ReferenceProperty from "./ReferenceProperty.js";
|
|
|
20
22
|
import SampledPositionProperty from "./SampledPositionProperty.js";
|
|
21
23
|
import ScaledPositionProperty from "./ScaledPositionProperty.js";
|
|
22
24
|
import TimeIntervalCollectionPositionProperty from "./TimeIntervalCollectionPositionProperty.js";
|
|
25
|
+
import Quaternion from "../Core/Quaternion.js";
|
|
26
|
+
|
|
27
|
+
const update3DMatrix3Scratch1 = new Matrix3();
|
|
28
|
+
const update3DMatrix3Scratch2 = new Matrix3();
|
|
29
|
+
const update3DMatrix3Scratch3 = new Matrix3();
|
|
30
|
+
const update3DCartesian3Scratch0 = new Cartesian3();
|
|
31
|
+
const update3DCartesian3Scratch1 = new Cartesian3();
|
|
32
|
+
const update3DCartesian3Scratch2 = new Cartesian3();
|
|
33
|
+
const update3DCartesian3Scratch3 = new Cartesian3();
|
|
34
|
+
|
|
35
|
+
const transformOrientationScratch = new Quaternion();
|
|
36
|
+
const transformVvlhScratch = new Matrix4();
|
|
37
|
+
const transformRotationScratch = new Matrix3();
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Transforms a path entity's position into the local frame of the reference entity.
|
|
41
|
+
* If the reference entity has an orientation, uses that orientation to define the local frame.
|
|
42
|
+
* Otherwise, falls back to a VVLH (Vehicle Velocity Local Horizontal) frame derived from the reference entity's velocity.
|
|
43
|
+
*
|
|
44
|
+
* @param {JulianDate} time The time at which to evaluate the orientation or VVLH frame.
|
|
45
|
+
* @param {Cartesian3} pathEntityPos The position of the path entity in the FIXED reference frame.
|
|
46
|
+
* @param {Cartesian3} refEntityPos The position of the reference entity in the FIXED reference frame.
|
|
47
|
+
* @param {Entity} refEntity The reference entity whose frame to transform into.
|
|
48
|
+
* @param {Cartesian3} result The object onto which to store the result.
|
|
49
|
+
* @returns {Cartesian3 | undefined} The transformed position in the reference entity's local frame, or undefined if either input position is undefined.
|
|
50
|
+
*/
|
|
51
|
+
function transformToEntityFrame(
|
|
52
|
+
time,
|
|
53
|
+
pathEntityPos,
|
|
54
|
+
refEntityPos,
|
|
55
|
+
refEntity,
|
|
56
|
+
result,
|
|
57
|
+
) {
|
|
58
|
+
if (!defined(pathEntityPos) || !defined(refEntityPos)) {
|
|
59
|
+
return undefined;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
Cartesian3.subtract(pathEntityPos, refEntityPos, result);
|
|
63
|
+
if (defined(refEntity.orientation)) {
|
|
64
|
+
if (refEntity.orientation.getValue(time, transformOrientationScratch)) {
|
|
65
|
+
Quaternion.conjugate(
|
|
66
|
+
transformOrientationScratch,
|
|
67
|
+
transformOrientationScratch,
|
|
68
|
+
);
|
|
69
|
+
Matrix3.fromQuaternion(
|
|
70
|
+
transformOrientationScratch,
|
|
71
|
+
transformRotationScratch,
|
|
72
|
+
);
|
|
73
|
+
Matrix3.multiplyByVector(transformRotationScratch, result, result);
|
|
74
|
+
}
|
|
75
|
+
} else if (
|
|
76
|
+
defined(
|
|
77
|
+
computeVvlhTransform(time, refEntity.position, transformVvlhScratch),
|
|
78
|
+
)
|
|
79
|
+
) {
|
|
80
|
+
Matrix4.inverse(transformVvlhScratch, transformVvlhScratch);
|
|
81
|
+
Matrix4.getRotation(transformVvlhScratch, transformRotationScratch);
|
|
82
|
+
Matrix3.multiplyByVector(transformRotationScratch, result, result);
|
|
83
|
+
} else {
|
|
84
|
+
// If neither ref entity's orientation nor VVLH are defined, return undefined
|
|
85
|
+
// This could happen if, for a given position of the entity we are drawing the path for,
|
|
86
|
+
// the ref entity doesn't have a position defined
|
|
87
|
+
return undefined;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
return result;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Compute the vehicle velocity, local horizontal (VVLH) transform for a position property at a given time.
|
|
95
|
+
* The VVLH axes is defined based on the motion of the provided position point as follows:
|
|
96
|
+
* - The X axis is directed toward the point's velocity vector, in the direction of motion.
|
|
97
|
+
* - The Y axis is along the angular momentum vector.
|
|
98
|
+
* - The Z axis is along the position vector.
|
|
99
|
+
*
|
|
100
|
+
* @param {JulianDate} time The time at which to compute the VVLH transform.
|
|
101
|
+
* @param {PositionProperty} positionProperty The position to compute the VVLH frame for.
|
|
102
|
+
* @param {Matrix4} result The object onto which to store the result.
|
|
103
|
+
* @returns {Matrix4} The VVLH transform.
|
|
104
|
+
*/
|
|
105
|
+
function computeVvlhTransform(time, positionProperty, result) {
|
|
106
|
+
const cartesian = positionProperty.getValue(time, update3DCartesian3Scratch0);
|
|
107
|
+
if (defined(cartesian)) {
|
|
108
|
+
// The time delta was determined based on how fast satellites move compared to vehicles near the surface.
|
|
109
|
+
// Slower moving vehicles will most likely default to east-north-up, while faster ones will be LVLH.
|
|
110
|
+
const deltaTime = JulianDate.addSeconds(time, 0.01, new JulianDate());
|
|
111
|
+
const deltaCartesian = positionProperty.getValue(
|
|
112
|
+
deltaTime,
|
|
113
|
+
update3DCartesian3Scratch1,
|
|
114
|
+
);
|
|
115
|
+
if (
|
|
116
|
+
defined(deltaCartesian) &&
|
|
117
|
+
!Cartesian3.equalsEpsilon(cartesian, deltaCartesian, CesiumMath.EPSILON16)
|
|
118
|
+
) {
|
|
119
|
+
let toInertial = Transforms.computeFixedToIcrfMatrix(
|
|
120
|
+
time,
|
|
121
|
+
update3DMatrix3Scratch1,
|
|
122
|
+
);
|
|
123
|
+
let toInertialDelta = Transforms.computeFixedToIcrfMatrix(
|
|
124
|
+
deltaTime,
|
|
125
|
+
update3DMatrix3Scratch2,
|
|
126
|
+
);
|
|
127
|
+
let toFixed;
|
|
128
|
+
|
|
129
|
+
if (!defined(toInertial) || !defined(toInertialDelta)) {
|
|
130
|
+
toFixed = Transforms.computeTemeToPseudoFixedMatrix(
|
|
131
|
+
time,
|
|
132
|
+
update3DMatrix3Scratch3,
|
|
133
|
+
);
|
|
134
|
+
toInertial = Matrix3.transpose(toFixed, update3DMatrix3Scratch1);
|
|
135
|
+
toInertialDelta = Transforms.computeTemeToPseudoFixedMatrix(
|
|
136
|
+
deltaTime,
|
|
137
|
+
update3DMatrix3Scratch2,
|
|
138
|
+
);
|
|
139
|
+
Matrix3.transpose(toInertialDelta, toInertialDelta);
|
|
140
|
+
} else {
|
|
141
|
+
toFixed = Matrix3.transpose(toInertial, update3DMatrix3Scratch3);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
// Z along the position
|
|
145
|
+
const zBasis = update3DCartesian3Scratch2;
|
|
146
|
+
Cartesian3.normalize(cartesian, zBasis);
|
|
147
|
+
Cartesian3.normalize(deltaCartesian, deltaCartesian);
|
|
148
|
+
|
|
149
|
+
Matrix3.multiplyByVector(toInertial, zBasis, zBasis);
|
|
150
|
+
Matrix3.multiplyByVector(toInertialDelta, deltaCartesian, deltaCartesian);
|
|
151
|
+
|
|
152
|
+
// Y is along the angular momentum vector (e.g. "orbit normal")
|
|
153
|
+
const yBasis = Cartesian3.cross(
|
|
154
|
+
zBasis,
|
|
155
|
+
deltaCartesian,
|
|
156
|
+
update3DCartesian3Scratch3,
|
|
157
|
+
);
|
|
158
|
+
if (
|
|
159
|
+
!Cartesian3.equalsEpsilon(yBasis, Cartesian3.ZERO, CesiumMath.EPSILON16)
|
|
160
|
+
) {
|
|
161
|
+
// X is along the cross of y and z (right handed basis / in the direction of motion)
|
|
162
|
+
const xBasis = Cartesian3.cross(
|
|
163
|
+
yBasis,
|
|
164
|
+
zBasis,
|
|
165
|
+
update3DCartesian3Scratch1,
|
|
166
|
+
);
|
|
167
|
+
|
|
168
|
+
Matrix3.multiplyByVector(toFixed, xBasis, xBasis);
|
|
169
|
+
Matrix3.multiplyByVector(toFixed, yBasis, yBasis);
|
|
170
|
+
Matrix3.multiplyByVector(toFixed, zBasis, zBasis);
|
|
171
|
+
|
|
172
|
+
Cartesian3.normalize(xBasis, xBasis);
|
|
173
|
+
Cartesian3.normalize(yBasis, yBasis);
|
|
174
|
+
Cartesian3.normalize(zBasis, zBasis);
|
|
175
|
+
|
|
176
|
+
if (!defined(result)) {
|
|
177
|
+
result = new Matrix4();
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
result[0] = xBasis.x;
|
|
181
|
+
result[1] = xBasis.y;
|
|
182
|
+
result[2] = xBasis.z;
|
|
183
|
+
result[3] = 0.0;
|
|
184
|
+
result[4] = yBasis.x;
|
|
185
|
+
result[5] = yBasis.y;
|
|
186
|
+
result[6] = yBasis.z;
|
|
187
|
+
result[7] = 0.0;
|
|
188
|
+
result[8] = zBasis.x;
|
|
189
|
+
result[9] = zBasis.y;
|
|
190
|
+
result[10] = zBasis.z;
|
|
191
|
+
result[11] = 0.0;
|
|
192
|
+
result[12] = cartesian.x;
|
|
193
|
+
result[13] = cartesian.y;
|
|
194
|
+
result[14] = cartesian.z;
|
|
195
|
+
result[15] = 1.0;
|
|
196
|
+
return result;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
return undefined;
|
|
201
|
+
}
|
|
23
202
|
|
|
24
203
|
const defaultResolution = 60.0;
|
|
25
204
|
const defaultWidth = 1.0;
|
|
@@ -35,6 +214,7 @@ function EntityData(entity) {
|
|
|
35
214
|
this.updater = undefined;
|
|
36
215
|
}
|
|
37
216
|
|
|
217
|
+
const sampleScratch = new Cartesian3();
|
|
38
218
|
function subSampleSampledProperty(
|
|
39
219
|
property,
|
|
40
220
|
start,
|
|
@@ -46,12 +226,38 @@ function subSampleSampledProperty(
|
|
|
46
226
|
startingIndex,
|
|
47
227
|
result,
|
|
48
228
|
) {
|
|
229
|
+
let refEntity;
|
|
230
|
+
let refPosition;
|
|
231
|
+
|
|
232
|
+
let entityFrame = false;
|
|
233
|
+
if (referenceFrame instanceof Entity) {
|
|
234
|
+
refEntity = referenceFrame;
|
|
235
|
+
refPosition = refEntity.position;
|
|
236
|
+
referenceFrame = ReferenceFrame.FIXED;
|
|
237
|
+
entityFrame = true;
|
|
238
|
+
}
|
|
239
|
+
|
|
49
240
|
let r = startingIndex;
|
|
50
241
|
//Always step exactly on start (but only use it if it exists.)
|
|
51
242
|
let tmp;
|
|
243
|
+
let tmp2;
|
|
52
244
|
tmp = property.getValueInReferenceFrame(start, referenceFrame, result[r]);
|
|
53
|
-
if (
|
|
54
|
-
|
|
245
|
+
if (!entityFrame) {
|
|
246
|
+
if (defined(tmp)) {
|
|
247
|
+
result[r++] = tmp;
|
|
248
|
+
}
|
|
249
|
+
} else {
|
|
250
|
+
tmp2 = refPosition.getValueInReferenceFrame(
|
|
251
|
+
start,
|
|
252
|
+
referenceFrame,
|
|
253
|
+
sampleScratch,
|
|
254
|
+
);
|
|
255
|
+
|
|
256
|
+
// Transform to frame of reference - either reference entity's orientation, or VVLH
|
|
257
|
+
tmp = transformToEntityFrame(start, tmp, tmp2, refEntity, tmp);
|
|
258
|
+
if (defined(tmp)) {
|
|
259
|
+
result[r++] = tmp;
|
|
260
|
+
}
|
|
55
261
|
}
|
|
56
262
|
|
|
57
263
|
let steppedOnNow =
|
|
@@ -78,8 +284,22 @@ function subSampleSampledProperty(
|
|
|
78
284
|
referenceFrame,
|
|
79
285
|
result[r],
|
|
80
286
|
);
|
|
81
|
-
if (
|
|
82
|
-
|
|
287
|
+
if (!entityFrame) {
|
|
288
|
+
if (defined(tmp)) {
|
|
289
|
+
result[r++] = tmp;
|
|
290
|
+
}
|
|
291
|
+
} else {
|
|
292
|
+
tmp2 = refPosition.getValueInReferenceFrame(
|
|
293
|
+
updateTime,
|
|
294
|
+
referenceFrame,
|
|
295
|
+
sampleScratch,
|
|
296
|
+
);
|
|
297
|
+
if (defined(tmp) && defined(tmp2)) {
|
|
298
|
+
tmp = transformToEntityFrame(updateTime, tmp, tmp2, refEntity, tmp);
|
|
299
|
+
if (defined(tmp)) {
|
|
300
|
+
result[r++] = tmp;
|
|
301
|
+
}
|
|
302
|
+
}
|
|
83
303
|
}
|
|
84
304
|
steppedOnNow = true;
|
|
85
305
|
}
|
|
@@ -93,8 +313,22 @@ function subSampleSampledProperty(
|
|
|
93
313
|
referenceFrame,
|
|
94
314
|
result[r],
|
|
95
315
|
);
|
|
96
|
-
if (
|
|
97
|
-
|
|
316
|
+
if (!entityFrame) {
|
|
317
|
+
if (defined(tmp)) {
|
|
318
|
+
result[r++] = tmp;
|
|
319
|
+
}
|
|
320
|
+
} else {
|
|
321
|
+
tmp2 = refPosition.getValueInReferenceFrame(
|
|
322
|
+
current,
|
|
323
|
+
referenceFrame,
|
|
324
|
+
sampleScratch,
|
|
325
|
+
);
|
|
326
|
+
if (defined(tmp) && defined(tmp2)) {
|
|
327
|
+
tmp = transformToEntityFrame(current, tmp, tmp2, refEntity, tmp);
|
|
328
|
+
if (defined(tmp)) {
|
|
329
|
+
result[r++] = tmp;
|
|
330
|
+
}
|
|
331
|
+
}
|
|
98
332
|
}
|
|
99
333
|
}
|
|
100
334
|
|
|
@@ -129,8 +363,22 @@ function subSampleSampledProperty(
|
|
|
129
363
|
|
|
130
364
|
//Always step exactly on stop (but only use it if it exists.)
|
|
131
365
|
tmp = property.getValueInReferenceFrame(stop, referenceFrame, result[r]);
|
|
132
|
-
if (
|
|
133
|
-
|
|
366
|
+
if (!entityFrame) {
|
|
367
|
+
if (defined(tmp)) {
|
|
368
|
+
result[r++] = tmp;
|
|
369
|
+
}
|
|
370
|
+
} else {
|
|
371
|
+
tmp2 = refPosition.getValueInReferenceFrame(
|
|
372
|
+
stop,
|
|
373
|
+
referenceFrame,
|
|
374
|
+
sampleScratch,
|
|
375
|
+
);
|
|
376
|
+
if (defined(tmp) && defined(tmp2)) {
|
|
377
|
+
tmp = transformToEntityFrame(stop, tmp, tmp2, refEntity, tmp);
|
|
378
|
+
if (defined(tmp)) {
|
|
379
|
+
result[r++] = tmp;
|
|
380
|
+
}
|
|
381
|
+
}
|
|
134
382
|
}
|
|
135
383
|
|
|
136
384
|
return r;
|
|
@@ -484,6 +732,8 @@ function subSample(
|
|
|
484
732
|
}
|
|
485
733
|
|
|
486
734
|
const toFixedScratch = new Matrix3();
|
|
735
|
+
const updateOrientationScratch = new Quaternion();
|
|
736
|
+
const updateRotationScratch = new Matrix3();
|
|
487
737
|
function PolylineUpdater(scene, referenceFrame) {
|
|
488
738
|
this._unusedIndexes = [];
|
|
489
739
|
this._polylineCollection = new PolylineCollection();
|
|
@@ -493,16 +743,38 @@ function PolylineUpdater(scene, referenceFrame) {
|
|
|
493
743
|
}
|
|
494
744
|
|
|
495
745
|
PolylineUpdater.prototype.update = function (time) {
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
746
|
+
const frame = this._referenceFrame;
|
|
747
|
+
if (frame === ReferenceFrame.INERTIAL) {
|
|
748
|
+
let toFixed = Transforms.computeIcrfToFixedMatrix(time, toFixedScratch);
|
|
749
|
+
if (!defined(toFixed)) {
|
|
750
|
+
toFixed = Transforms.computeTemeToPseudoFixedMatrix(time, toFixedScratch);
|
|
751
|
+
}
|
|
501
752
|
Matrix4.fromRotationTranslation(
|
|
502
753
|
toFixed,
|
|
503
754
|
Cartesian3.ZERO,
|
|
504
755
|
this._polylineCollection.modelMatrix,
|
|
505
756
|
);
|
|
757
|
+
} else if (frame instanceof Entity) {
|
|
758
|
+
const position = frame.position.getValue(time);
|
|
759
|
+
|
|
760
|
+
// Use the reference frame entity's orientation if it has one
|
|
761
|
+
if (defined(frame.orientation)) {
|
|
762
|
+
if (defined(frame.orientation.getValue(time, updateOrientationScratch))) {
|
|
763
|
+
// Calculate the model matrix that places the body-frame path points into the world
|
|
764
|
+
Matrix3.fromQuaternion(updateOrientationScratch, updateRotationScratch);
|
|
765
|
+
Matrix4.fromRotationTranslation(
|
|
766
|
+
updateRotationScratch,
|
|
767
|
+
position,
|
|
768
|
+
this._polylineCollection.modelMatrix,
|
|
769
|
+
);
|
|
770
|
+
}
|
|
771
|
+
} else {
|
|
772
|
+
computeVvlhTransform(
|
|
773
|
+
time,
|
|
774
|
+
frame.position,
|
|
775
|
+
this._polylineCollection.modelMatrix,
|
|
776
|
+
);
|
|
777
|
+
}
|
|
506
778
|
}
|
|
507
779
|
};
|
|
508
780
|
|
|
@@ -597,8 +869,7 @@ PolylineUpdater.prototype.updateObject = function (time, item) {
|
|
|
597
869
|
defaultResolution,
|
|
598
870
|
);
|
|
599
871
|
|
|
600
|
-
|
|
601
|
-
polyline.positions = subSample(
|
|
872
|
+
const positions = subSample(
|
|
602
873
|
positionProperty,
|
|
603
874
|
sampleStart,
|
|
604
875
|
sampleStop,
|
|
@@ -607,6 +878,16 @@ PolylineUpdater.prototype.updateObject = function (time, item) {
|
|
|
607
878
|
resolution,
|
|
608
879
|
polyline.positions.slice(),
|
|
609
880
|
);
|
|
881
|
+
|
|
882
|
+
// If the path only has one point, don't show it
|
|
883
|
+
// This can happen if the position is sampled at a time when it is only defined at a single point
|
|
884
|
+
if (positions.length < 2) {
|
|
885
|
+
polyline.show = false;
|
|
886
|
+
return;
|
|
887
|
+
}
|
|
888
|
+
|
|
889
|
+
polyline.show = true;
|
|
890
|
+
polyline.positions = positions;
|
|
610
891
|
polyline.material = MaterialProperty.getValue(
|
|
611
892
|
time,
|
|
612
893
|
pathGraphics._material,
|
|
@@ -710,15 +991,40 @@ PathVisualizer.prototype.update = function (time) {
|
|
|
710
991
|
const item = items[i];
|
|
711
992
|
const entity = item.entity;
|
|
712
993
|
const positionProperty = entity._position;
|
|
994
|
+
const pathGraphics = entity._path;
|
|
713
995
|
|
|
714
996
|
const lastUpdater = item.updater;
|
|
715
997
|
|
|
998
|
+
let isRelative = false;
|
|
999
|
+
|
|
716
1000
|
let frameToVisualize = ReferenceFrame.FIXED;
|
|
1001
|
+
let frameToVisualizeKey = frameToVisualize.toString();
|
|
717
1002
|
if (this._scene.mode === SceneMode.SCENE3D) {
|
|
718
|
-
|
|
1003
|
+
const relativeTo = Property.getValueOrUndefined(
|
|
1004
|
+
pathGraphics.relativeTo,
|
|
1005
|
+
time,
|
|
1006
|
+
);
|
|
1007
|
+
if (defined(relativeTo)) {
|
|
1008
|
+
if (relativeTo === "FIXED") {
|
|
1009
|
+
frameToVisualize = ReferenceFrame.FIXED;
|
|
1010
|
+
frameToVisualizeKey = frameToVisualize.toString();
|
|
1011
|
+
} else if (relativeTo === "INERTIAL") {
|
|
1012
|
+
frameToVisualize = ReferenceFrame.INERTIAL;
|
|
1013
|
+
frameToVisualizeKey = frameToVisualize.toString();
|
|
1014
|
+
} else {
|
|
1015
|
+
// Path should be relative to entity
|
|
1016
|
+
// Current implementation uses VVLH, ignores entity orientation
|
|
1017
|
+
isRelative = true;
|
|
1018
|
+
frameToVisualize = this._entityCollection.getById(relativeTo);
|
|
1019
|
+
frameToVisualizeKey = relativeTo;
|
|
1020
|
+
}
|
|
1021
|
+
} else {
|
|
1022
|
+
frameToVisualize = positionProperty.referenceFrame;
|
|
1023
|
+
frameToVisualizeKey = frameToVisualize.toString();
|
|
1024
|
+
}
|
|
719
1025
|
}
|
|
720
1026
|
|
|
721
|
-
let currentUpdater = this._updaters[
|
|
1027
|
+
let currentUpdater = this._updaters[frameToVisualizeKey];
|
|
722
1028
|
|
|
723
1029
|
if (lastUpdater === currentUpdater && defined(currentUpdater)) {
|
|
724
1030
|
currentUpdater.updateObject(time, item);
|
|
@@ -729,10 +1035,14 @@ PathVisualizer.prototype.update = function (time) {
|
|
|
729
1035
|
lastUpdater.removeObject(item);
|
|
730
1036
|
}
|
|
731
1037
|
|
|
1038
|
+
if (isRelative && !defined(frameToVisualize)) {
|
|
1039
|
+
continue;
|
|
1040
|
+
}
|
|
1041
|
+
|
|
732
1042
|
if (!defined(currentUpdater)) {
|
|
733
1043
|
currentUpdater = new PolylineUpdater(this._scene, frameToVisualize);
|
|
734
1044
|
currentUpdater.update(time);
|
|
735
|
-
this._updaters[
|
|
1045
|
+
this._updaters[frameToVisualizeKey] = currentUpdater;
|
|
736
1046
|
}
|
|
737
1047
|
|
|
738
1048
|
item.updater = currentUpdater;
|
|
@@ -820,4 +1130,6 @@ PathVisualizer.prototype._onCollectionChanged = function (
|
|
|
820
1130
|
|
|
821
1131
|
//for testing
|
|
822
1132
|
PathVisualizer._subSample = subSample;
|
|
1133
|
+
PathVisualizer._computeVvlhTransform = computeVvlhTransform;
|
|
1134
|
+
PathVisualizer._transformToEntityFrame = transformToEntityFrame;
|
|
823
1135
|
export default PathVisualizer;
|
|
@@ -147,18 +147,23 @@ Batch.prototype.update = function (time) {
|
|
|
147
147
|
this.depthFailMaterial,
|
|
148
148
|
);
|
|
149
149
|
}
|
|
150
|
-
|
|
150
|
+
|
|
151
|
+
const DepthFailAppearanceType = this.depthFailAppearanceType;
|
|
152
|
+
|
|
153
|
+
depthFailAppearance = new DepthFailAppearanceType({
|
|
151
154
|
material: this.depthFailMaterial,
|
|
152
155
|
translucent: this.translucent,
|
|
153
156
|
closed: this.closed,
|
|
154
157
|
});
|
|
155
158
|
}
|
|
156
159
|
|
|
160
|
+
const AppearanceType = this.appearanceType;
|
|
161
|
+
|
|
157
162
|
primitive = new Primitive({
|
|
158
163
|
show: false,
|
|
159
164
|
asynchronous: true,
|
|
160
165
|
geometryInstances: geometries.slice(),
|
|
161
|
-
appearance: new
|
|
166
|
+
appearance: new AppearanceType({
|
|
162
167
|
translucent: this.translucent,
|
|
163
168
|
closed: this.closed,
|
|
164
169
|
}),
|